diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 9959d85b..a43774de 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -42,7 +42,7 @@ namespace Volian.Print.Library // is a single column section. //bool _skipEndMessage = MyPageHelper.MySection.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.EndForSingle; SectionInfo si = MyItemInfo.MyActiveSection as SectionInfo; - bool _skipEndMessage = si.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.EndForSingle; + bool _skipEndMessage = si != null && si.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.EndForSingle; // TODO: This does not account for a long step as the last step that would exceed more than one page and // that has an end message that needs to be accounted for in determining pagination. To do that the last @@ -174,9 +174,9 @@ namespace Volian.Print.Library bool doSectionTitleContinued = false; if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) { - float vtnHeight = SixLinesPerInch; - foreach (vlnText vtn in MyPageHelper.NotesToFootNotes) vtnHeight += vtn.Height; - yEndMsg += vtnHeight; // * vlnPrintObject.SixLinesPerInch); + float vpHeight = SixLinesPerInch; + foreach (vlnParagraph vp in MyPageHelper.NotesToFootNotes) vpHeight += vp.Height; + yEndMsg += vpHeight; } if (MyItemInfo.MyPrevious != null && !MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader) { diff --git a/PROMS/Volian.Print.Library/vlnChangeBar.cs b/PROMS/Volian.Print.Library/vlnChangeBar.cs index 1b51152b..dac8e7ef 100644 --- a/PROMS/Volian.Print.Library/vlnChangeBar.cs +++ b/PROMS/Volian.Print.Library/vlnChangeBar.cs @@ -165,11 +165,27 @@ namespace Volian.Print.Library cb.Stroke(); DebugPdf(cb, XOffset + xAdj - 1.5F, YOffset - yAdj + 4); DebugPdf(cb, XOffset + xAdj - 1.5F, YChangeBarBottomExtend - yAdj - 1); + if (Messages != null) { + // if doing messages at top, then remove duplicates if they are next to each other. + // If this was not done, the location of messages was not correct. + if (_MsgAtTop && Messages.Count > 1) + { + string lastNoDup = ""; + SortedDictionary tmpNoDup = new SortedDictionary(); + foreach (KeyValuePair nodupM in Messages) + { + vlnChangeBarMessage noDupCmb = (vlnChangeBarMessage)nodupM.Value; + if (lastNoDup != noDupCmb.Message) tmpNoDup.Add(nodupM.Key, noDupCmb); + lastNoDup = noDupCmb.Message; + } + Messages = tmpNoDup; + } // Loop through messages for this change bar. The first message is the bottom-most, which is always put out. // Working up, if the current message is the same as the one below it, don't put it out. string lastMsg = null; + int incrementMsgAtTop = (Messages == null ? 0 : Messages.Count-1); foreach (KeyValuePair kvp in Messages) { float yBottom = (float)System.Convert.ToDouble(kvp.Key); @@ -194,7 +210,11 @@ namespace Volian.Print.Library float h = GetParagraphHeight(cb, myparagraph, w); cb.SetColorFill(changeBarColor); float yloc = yBottom + h - Rtf2Pdf.Offset.Y + 2.7F; - if (_MsgAtTop) yloc = YOffset; + if (_MsgAtTop) + { + yloc = YOffset - ((incrementMsgAtTop * h)); // + 2); + incrementMsgAtTop--; + } Rtf2Pdf.TextAt(cb, myparagraph, XOffset + xAdj - Rtf2Pdf.Offset.X + 3, yloc, w, h, "", yBottomMargin); lastMsg = vcbm.Message; }