diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index 055976b6..c8d0b308 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -709,6 +709,8 @@ namespace VEPROMS if (dvi != null) { DlgPrintProcedure prnDlg = new DlgPrintProcedure(dvi,true); + if (dvi.MultiUnitCount == 0) + prnDlg.SelectedSlave = -1; prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window //prnDlg.FormClosed += new FormClosedEventHandler(prnDlg_FormClosed); //while (!_RunNext) Application.DoEvents(); diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index 0c991e7a..76453730 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -658,7 +658,7 @@ namespace VEPROMS.CSLA.Library LBRange myRange = selxy.Paragraphs.First.Range; float yTop = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage); float yTop1 = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary); - + // 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. string resXyPlot = xyplot; @@ -670,8 +670,8 @@ namespace VEPROMS.CSLA.Library } else { - selxy.Text = ""; - if (cnt > 0) for (int icnt = 0; icnt < cnt; icnt++) selxy.Text = selxy.Text + "\r"; + selxy.Text = ""; + 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"; @@ -961,6 +961,9 @@ namespace VEPROMS.CSLA.Library if (myDoc.PageSetup.BottomMargin != 9999999) { // 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.RightMargin = newRight; myDoc.PageSetup.LeftMargin = newLeft; @@ -984,7 +987,7 @@ namespace VEPROMS.CSLA.Library , _MySection.ItemID, _MySection.MyDocVersion.MyFolder.Name, _MySection.ShortPath); } else - _MyLog.Error("Could not set margins", ex); + _MyLog.Error("Could not set margins", ex); } } } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index a5b827c1..cf3bf194 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -2409,7 +2409,7 @@ namespace VEPROMS.CSLA.Library _MyTab.Text = ""; _MyTab.CleanText = ""; return; - } + } int stepType = (int)(MyContent.Type % 10000); string tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint; if (ActiveFormat.Name.ToUpper() == "WCNCKL" || ActiveFormat.Name.ToUpper() == "WSTCKL") @@ -2426,6 +2426,8 @@ namespace VEPROMS.CSLA.Library { _MyTab.CleanText = ((ItemInfo)ActiveParent).MyTab.CleanText; _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}")) _MyTab.AsteriskOffset = -10; return; @@ -2807,9 +2809,10 @@ namespace VEPROMS.CSLA.Library } return ActiveSection.MyTab.CleanText.TrimEnd(); } - + private string CheckNoteCautionTab(string tbformat) { + tbformat = ReplaceStepToken(tbformat); string prevTbFormat = null; string nextTbFormat = null; StepData nextStepData = null; @@ -2818,12 +2821,14 @@ namespace VEPROMS.CSLA.Library // int prevStepType = ((int)MyPrevious.MyContent.Type) % 10000; StepData prevStepData = MyPrevious.FormatStepData; // ActiveFormat.PlantFormat.FormatData.StepDataList[prevStepType]; prevTbFormat = MyPrevious.IsInRNO ? prevStepData.TabData.RNOIdentPrint : prevStepData.TabData.IdentPrint; + prevTbFormat = ReplaceStepToken(prevTbFormat); } if (NextItem != null) { nextStepData = NextItem.FormatStepData; // tried to duplicate functionality from 16-bit code. 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. if (FormatStepData.TabData.Justify == "Center") @@ -2848,7 +2853,11 @@ namespace VEPROMS.CSLA.Library } else { - if (MyPrevious != null) _MyHeader = null; + if (MyPrevious != null) + { + if(tbformat == prevTbFormat) + _MyHeader = null; + } tbformat = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB; TabToIdentBAdjustFont(); @@ -2897,7 +2906,6 @@ namespace VEPROMS.CSLA.Library //} return tbformat; } - public bool MixCautionNotesDiffType() { if (!FormatStepData.MixCautionsAndNotes) return false; @@ -2906,6 +2914,24 @@ namespace VEPROMS.CSLA.Library 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() { if ((FormatStepData.TabData.Font.Style & E_Style.Underline) > 0) @@ -2940,8 +2966,8 @@ namespace VEPROMS.CSLA.Library Tens = 4, Units = 6 } - private string _Romans = "MDCLXVI"; - private string RomanPart(RomanOffset offset, int value) + private static string _Romans = "MDCLXVI"; + private static string RomanPart(RomanOffset offset, int value) { int iFive = value / 5; int iUnits = value % 5; @@ -2950,7 +2976,7 @@ namespace VEPROMS.CSLA.Library _Romans.Substring(((int)offset) - iFive - iFour, iFive | iFour) + "".PadRight(iUnits % 4, _Romans[((int)offset)]); } - private string RomanNumbering(int number) + public static string RomanNumbering(int number) { int thousands = number / 1000; 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' return stc.Step_CheckOffIndex; } + private int SectionConfigCheckOffIndex + { + get + { + SectionConfig sc = ActiveSection.MyConfig as SectionConfig; + return sc.Section_CheckoffListSelection; + } + } private int SectionDefaultCheckOffIndex() { ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData; @@ -3139,27 +3173,56 @@ namespace VEPROMS.CSLA.Library } 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 if (stpCoIndx == -1) return null; 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. if (sectCoIndx == -1) return null; 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 null; } - private bool IsLowestLevelStep() + + private bool stpCheckOff { - // This test only checks if using the section default, otherwise the code above, uses what the checkoff - // that is set in the config. - StepConfig stc = MyConfig as StepConfig; - if (stc != null && stc.Step_CheckOffIndex == 0) + get { - 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() { @@ -3199,7 +3262,12 @@ namespace VEPROMS.CSLA.Library { public VE_Font MyFont; 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 MetaTag() { @@ -4381,8 +4449,6 @@ namespace VEPROMS.CSLA.Library } else { - //if (dr.GetInt32("ItemID") == 336) - // Console.WriteLine("here"); ItemInfo itemInfo = null; int itemType = dr.GetInt32("Type") / 10000; switch (itemType)