Set DlgPrintProcedure.SelectedSlave property to -1 to support RunAutomatic method when processing single unit data

Added code to set orientation to landscape when width > length of document
Utilized new FormatStepData.TabData property RNOExcludeMacros in SetTabText method to support VCSummer format
Added new method ReplaceStepToken and utilized method for processing VCSummer data
Changed RomanPart and RomanNumbering properties to static
Added new property SectionConfigCheckOffIndex for processing VCSummer data
Added new property stpCheckOff for processing VCSummer data
Modified code in SectionDefaultEnabledCheckOff method for processing VCSummer data
Added new property SectionDefaultEnabled for processing VCSummer data
Added new property IsLowestLevelStep for processing VCSummer data
Made Text property of MetaTag class public for processing VCSummer data
This commit is contained in:
Rich 2013-06-11 18:43:03 +00:00
parent 924e5c024e
commit de21ab4c8f
3 changed files with 94 additions and 23 deletions

View File

@ -709,6 +709,8 @@ namespace VEPROMS
if (dvi != null) if (dvi != null)
{ {
DlgPrintProcedure prnDlg = new DlgPrintProcedure(dvi,true); DlgPrintProcedure prnDlg = new DlgPrintProcedure(dvi,true);
if (dvi.MultiUnitCount == 0)
prnDlg.SelectedSlave = -1;
prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window
//prnDlg.FormClosed += new FormClosedEventHandler(prnDlg_FormClosed); //prnDlg.FormClosed += new FormClosedEventHandler(prnDlg_FormClosed);
//while (!_RunNext) Application.DoEvents(); //while (!_RunNext) Application.DoEvents();

View File

@ -658,7 +658,7 @@ namespace VEPROMS.CSLA.Library
LBRange myRange = selxy.Paragraphs.First.Range; LBRange myRange = selxy.Paragraphs.First.Range;
float yTop = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage); float yTop = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
float yTop1 = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary); float yTop1 = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary);
// some data had regular text embedded in the xyplot definition. If so, the plain text must // some data had regular text embedded in the xyplot definition. If so, the plain text must
// be left in the file. Otherwise, we can replace with empty text. // be left in the file. Otherwise, we can replace with empty text.
string resXyPlot = xyplot; string resXyPlot = xyplot;
@ -670,8 +670,8 @@ namespace VEPROMS.CSLA.Library
} }
else else
{ {
selxy.Text = ""; selxy.Text = "";
if (cnt > 0) for (int icnt = 0; icnt < cnt; icnt++) selxy.Text = selxy.Text + "\r"; if (cnt>0)for (int icnt = 0; icnt < cnt; icnt++) selxy.Text = selxy.Text + "\r";
} }
pngFile = VlnSettings.TemporaryFolder + @"\XYPlot" + filecount.ToString() + @".png"; //@"C:\Temp\XYPlot1.png"; pngFile = VlnSettings.TemporaryFolder + @"\XYPlot" + filecount.ToString() + @".png"; //@"C:\Temp\XYPlot1.png";
@ -961,6 +961,9 @@ namespace VEPROMS.CSLA.Library
if (myDoc.PageSetup.BottomMargin != 9999999) if (myDoc.PageSetup.BottomMargin != 9999999)
{ {
// the + 1 in the next line allows for rounding. // the + 1 in the next line allows for rounding.
if (newWidth > newLength)
if(myDoc.PageSetup.Orientation != LBWdOrientation.wdOrientLandscape)
myDoc.PageSetup.Orientation = LBWdOrientation.wdOrientLandscape;
myDoc.PageSetup.BottomMargin = newBottom; myDoc.PageSetup.BottomMargin = newBottom;
myDoc.PageSetup.RightMargin = newRight; myDoc.PageSetup.RightMargin = newRight;
myDoc.PageSetup.LeftMargin = newLeft; myDoc.PageSetup.LeftMargin = newLeft;
@ -984,7 +987,7 @@ namespace VEPROMS.CSLA.Library
, _MySection.ItemID, _MySection.MyDocVersion.MyFolder.Name, _MySection.ShortPath); , _MySection.ItemID, _MySection.MyDocVersion.MyFolder.Name, _MySection.ShortPath);
} }
else else
_MyLog.Error("Could not set margins", ex); _MyLog.Error("Could not set margins", ex);
} }
} }
} }

View File

@ -2409,7 +2409,7 @@ namespace VEPROMS.CSLA.Library
_MyTab.Text = ""; _MyTab.Text = "";
_MyTab.CleanText = ""; _MyTab.CleanText = "";
return; return;
} }
int stepType = (int)(MyContent.Type % 10000); int stepType = (int)(MyContent.Type % 10000);
string tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint; string tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint;
if (ActiveFormat.Name.ToUpper() == "WCNCKL" || ActiveFormat.Name.ToUpper() == "WSTCKL") if (ActiveFormat.Name.ToUpper() == "WCNCKL" || ActiveFormat.Name.ToUpper() == "WSTCKL")
@ -2426,6 +2426,8 @@ namespace VEPROMS.CSLA.Library
{ {
_MyTab.CleanText = ((ItemInfo)ActiveParent).MyTab.CleanText; _MyTab.CleanText = ((ItemInfo)ActiveParent).MyTab.CleanText;
_MyTab.Text = ((ItemInfo)ActiveParent).MyTab.Text; _MyTab.Text = ((ItemInfo)ActiveParent).MyTab.Text;
if (((ItemInfo)ActiveParent).FormatStepData.TabData.RNOExcludeMacros)
_MyTab.Text = Regex.Replace(_MyTab.Text, "{!.+?}", " ");
if (((ItemInfo)ActiveParent).FormatStepData.TabData.RNOIdentPrint.Contains("{asterisk}")) if (((ItemInfo)ActiveParent).FormatStepData.TabData.RNOIdentPrint.Contains("{asterisk}"))
_MyTab.AsteriskOffset = -10; _MyTab.AsteriskOffset = -10;
return; return;
@ -2807,9 +2809,10 @@ namespace VEPROMS.CSLA.Library
} }
return ActiveSection.MyTab.CleanText.TrimEnd(); return ActiveSection.MyTab.CleanText.TrimEnd();
} }
private string CheckNoteCautionTab(string tbformat) private string CheckNoteCautionTab(string tbformat)
{ {
tbformat = ReplaceStepToken(tbformat);
string prevTbFormat = null; string prevTbFormat = null;
string nextTbFormat = null; string nextTbFormat = null;
StepData nextStepData = null; StepData nextStepData = null;
@ -2818,12 +2821,14 @@ namespace VEPROMS.CSLA.Library
// int prevStepType = ((int)MyPrevious.MyContent.Type) % 10000; // int prevStepType = ((int)MyPrevious.MyContent.Type) % 10000;
StepData prevStepData = MyPrevious.FormatStepData; // ActiveFormat.PlantFormat.FormatData.StepDataList[prevStepType]; StepData prevStepData = MyPrevious.FormatStepData; // ActiveFormat.PlantFormat.FormatData.StepDataList[prevStepType];
prevTbFormat = MyPrevious.IsInRNO ? prevStepData.TabData.RNOIdentPrint : prevStepData.TabData.IdentPrint; prevTbFormat = MyPrevious.IsInRNO ? prevStepData.TabData.RNOIdentPrint : prevStepData.TabData.IdentPrint;
prevTbFormat = ReplaceStepToken(prevTbFormat);
} }
if (NextItem != null) if (NextItem != null)
{ {
nextStepData = NextItem.FormatStepData; nextStepData = NextItem.FormatStepData;
// tried to duplicate functionality from 16-bit code. // tried to duplicate functionality from 16-bit code.
nextTbFormat = NextItem.IsInRNO ? nextStepData.TabData.RNOIdentPrint : nextStepData.TabData.IdentPrint; nextTbFormat = NextItem.IsInRNO ? nextStepData.TabData.RNOIdentPrint : nextStepData.TabData.IdentPrint;
nextTbFormat = ReplaceStepToken(nextTbFormat);
} }
// Handle the centered tab - if this tab is centered make it a header. // Handle the centered tab - if this tab is centered make it a header.
if (FormatStepData.TabData.Justify == "Center") if (FormatStepData.TabData.Justify == "Center")
@ -2848,7 +2853,11 @@ namespace VEPROMS.CSLA.Library
} }
else else
{ {
if (MyPrevious != null) _MyHeader = null; if (MyPrevious != null)
{
if(tbformat == prevTbFormat)
_MyHeader = null;
}
tbformat = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB; tbformat = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
TabToIdentBAdjustFont(); TabToIdentBAdjustFont();
@ -2897,7 +2906,6 @@ namespace VEPROMS.CSLA.Library
//} //}
return tbformat; return tbformat;
} }
public bool MixCautionNotesDiffType() public bool MixCautionNotesDiffType()
{ {
if (!FormatStepData.MixCautionsAndNotes) return false; if (!FormatStepData.MixCautionsAndNotes) return false;
@ -2906,6 +2914,24 @@ namespace VEPROMS.CSLA.Library
return false; return false;
} }
private string ReplaceStepToken(string tbformat)
{
if (tbformat.Trim().EndsWith("`"))
{
ItemInfo tmp = this;
string sep = string.Empty;
string hlsOrdinal = string.Empty;
do
{
hlsOrdinal = tmp.MyParent.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray()) + sep + hlsOrdinal;
tmp = tmp.MyParent;
sep = ".";
} while (!tmp.IsHigh);
tbformat = tbformat.Replace("`", " " + hlsOrdinal);
}
return tbformat;
}
private bool TabToIdentBAdjustFont() private bool TabToIdentBAdjustFont()
{ {
if ((FormatStepData.TabData.Font.Style & E_Style.Underline) > 0) if ((FormatStepData.TabData.Font.Style & E_Style.Underline) > 0)
@ -2940,8 +2966,8 @@ namespace VEPROMS.CSLA.Library
Tens = 4, Tens = 4,
Units = 6 Units = 6
} }
private string _Romans = "MDCLXVI"; private static string _Romans = "MDCLXVI";
private string RomanPart(RomanOffset offset, int value) private static string RomanPart(RomanOffset offset, int value)
{ {
int iFive = value / 5; int iFive = value / 5;
int iUnits = value % 5; int iUnits = value % 5;
@ -2950,7 +2976,7 @@ namespace VEPROMS.CSLA.Library
_Romans.Substring(((int)offset) - iFive - iFour, iFive | iFour) + _Romans.Substring(((int)offset) - iFive - iFour, iFive | iFour) +
"".PadRight(iUnits % 4, _Romans[((int)offset)]); "".PadRight(iUnits % 4, _Romans[((int)offset)]);
} }
private string RomanNumbering(int number) public static string RomanNumbering(int number)
{ {
int thousands = number / 1000; int thousands = number / 1000;
int hundreds = (number % 1000) / 100; int hundreds = (number % 1000) / 100;
@ -3130,6 +3156,14 @@ namespace VEPROMS.CSLA.Library
if (stc != null && stc.Step_CheckOffIndex == 1) return -1; // index of 1, always means 'No Checkoff' if (stc != null && stc.Step_CheckOffIndex == 1) return -1; // index of 1, always means 'No Checkoff'
return stc.Step_CheckOffIndex; return stc.Step_CheckOffIndex;
} }
private int SectionConfigCheckOffIndex
{
get
{
SectionConfig sc = ActiveSection.MyConfig as SectionConfig;
return sc.Section_CheckoffListSelection;
}
}
private int SectionDefaultCheckOffIndex() private int SectionDefaultCheckOffIndex()
{ {
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData; ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
@ -3139,27 +3173,56 @@ namespace VEPROMS.CSLA.Library
} }
public CheckOff GetCheckOffStep() public CheckOff GetCheckOffStep()
{ {
if (!IsStep || !SectionHasCheckOffs()) return null; if (!IsStep) return null;
if (SectionDefaultEnabled) return SectionDefaultEnabledCheckOff;
if(!SectionHasCheckOffs()) return null;
int stpCoIndx = CheckOffIndex(); // this step has a checkoff defined int stpCoIndx = CheckOffIndex(); // this step has a checkoff defined
if (stpCoIndx == -1) return null; if (stpCoIndx == -1) return null;
if (stpCoIndx > 1) return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[stpCoIndx]; if (stpCoIndx > 1) return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[stpCoIndx];
int sectCoIndx = SectionDefaultCheckOffIndex(); // no checkoff on step, see if there is a section default. int sectCoIndx = SectionDefaultCheckOffIndex(); // no checkoff on step, see if there is a section default.
if (sectCoIndx == -1) return null; if (sectCoIndx == -1) return null;
if ((ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffOnHLSOnly && IsHigh) if ((ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffOnHLSOnly && IsHigh)
|| (!ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffOnHLSOnly && IsLowestLevelStep())) // && !RNOsHighHasCheckOff())) || (!ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffOnHLSOnly && IsLowestLevelStep && stpCheckOff)) // && !RNOsHighHasCheckOff()))
return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[sectCoIndx]; return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[sectCoIndx];
return null; return null;
} }
private bool IsLowestLevelStep()
private bool stpCheckOff
{ {
// This test only checks if using the section default, otherwise the code above, uses what the checkoff get
// that is set in the config.
StepConfig stc = MyConfig as StepConfig;
if (stc != null && stc.Step_CheckOffIndex == 0)
{ {
if (!(IsCaution || IsNote || IsTable || Steps != null || MyParent.IsCaution || MyParent.IsNote)) return true; StepConfig stc = MyConfig as StepConfig;
return (stc != null && stc.Step_CheckOffIndex == 0);
}
}
private CheckOff SectionDefaultEnabledCheckOff
{
get
{
int sectCoIndx = SectionConfigCheckOffIndex; // no checkoff on step, see if there is a section default.
if (IsLowestLevelStep) // && !RNOsHighHasCheckOff()))
return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[sectCoIndx];
return null;
}
}
private bool SectionDefaultEnabled
{
get
{
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && pd.CheckOffData.CheckOffList.Count == 2 && pd.CheckOffData.CheckOffList[0].MenuItem == "Enabled")
return true; // if only two items, first is macro - use it.
return false;
}
}
private bool IsLowestLevelStep
{
get
{
return (!(IsCaution || IsNote || IsTable || Steps != null || MyParent.IsCaution || MyParent.IsNote));
} }
return false;
} }
private bool RNOsHighHasCheckOff() private bool RNOsHighHasCheckOff()
{ {
@ -3199,7 +3262,12 @@ namespace VEPROMS.CSLA.Library
{ {
public VE_Font MyFont; public VE_Font MyFont;
public ContentAlignment Justify = ContentAlignment.MiddleLeft; public ContentAlignment Justify = ContentAlignment.MiddleLeft;
public string Text; // may include tokens, such as macros for circles/diamonds, etc private string _Text; // may include tokens, such as macros for circles/diamonds, etc
public string Text
{
get { return _Text; }
set { _Text = value; }
}
public string CleanText; // all tokens removed public string CleanText; // all tokens removed
public MetaTag() public MetaTag()
{ {
@ -4381,8 +4449,6 @@ namespace VEPROMS.CSLA.Library
} }
else else
{ {
//if (dr.GetInt32("ItemID") == 336)
// Console.WriteLine("here");
ItemInfo itemInfo = null; ItemInfo itemInfo = null;
int itemType = dr.GetInt32("Type") / 10000; int itemType = dr.GetInt32("Type") / 10000;
switch (itemType) switch (itemType)