Compare commits

..

4 Commits

137 changed files with 16395 additions and 26809 deletions
@@ -1395,7 +1395,7 @@ namespace VEPROMS
DoCreatePDF(); // create indivitual pdfs DoCreatePDF(); // create indivitual pdfs
if (_MergedPdfPath != null && _MergedPdfPath != PDFPath) PDFPath = _MergedPfd.Folder = _MergedPdfPath; if (_MergedPdfPath != null && _MergedPdfPath != PDFPath) PDFPath = _MergedPfd.Folder = _MergedPdfPath;
// C2021-063 pass in whether to generate Alarm Point List text when a merge is done // C2021-063 pass in whether to generate Alarm Point List text when a merge is done
if (!_MergedPfd.DoTheMerge(PromsPrinter.MergedLandscapePages,cbxAlmPtTxt.Checked)) return; // merge them together. if (!_MergedPfd.DoTheMerge(cbxAlmPtTxt.Checked)) return; // merge them together.
// if the property to show the file after printing is set (on the version dialog), display it. Otherwise do a dialog to let user know it's done // if the property to show the file after printing is set (on the version dialog), display it. Otherwise do a dialog to let user know it's done
if (_DocVersionConfig.Print_MergedPdfsViewAfter) if (_DocVersionConfig.Print_MergedPdfsViewAfter)
{ {
+5 -6
View File
@@ -1001,7 +1001,7 @@ namespace VEPROMS
fs.Close(); fs.Close();
System.Diagnostics.Process.Start(fileName); System.Diagnostics.Process.Start(fileName);
} }
catch (Exception ex) catch (Exception)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@@ -1767,7 +1767,7 @@ namespace VEPROMS
} }
else if (args.TypesSelected == "Complete RO Report") else if (args.TypesSelected == "Complete RO Report")
{ {
Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.RODataFile, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\CompleteROReport.pdf", args.RofstLookup, args.CompleteROReport, args.ConvertCaretToDelta, args.IncludeEmptyROFields, args.PaperSize); Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.RODataFile, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\CompleteROReport.pdf", args.RofstLookup, args.ConvertCaretToDelta, args.IncludeEmptyROFields, args.PaperSize);
myReport.Build(); myReport.Build();
} }
else if (args.TypesSelected == "RO Summary Report") else if (args.TypesSelected == "RO Summary Report")
@@ -4499,7 +4499,6 @@ namespace VEPROMS
{ {
infoPanel.Expanded = true; infoPanel.Expanded = true;
infoTabs.SelectedTab = infotabTags; infoTabs.SelectedTab = infotabTags;
displayTags.HighlightChangeStep();
} }
else if (args.PanelTabName == "Change Image Size") else if (args.PanelTabName == "Change Image Size")
{ {
@@ -4620,7 +4619,7 @@ namespace VEPROMS
// also change the text on the buttons to read either Find or Find/Replace // also change the text on the buttons to read either Find or Find/Replace
// also toggle the Replace tab on the dialog based on the user's accessibility to the procedure // also toggle the Replace tab on the dialog based on the user's accessibility to the procedure
bool isReviewer = !MyUserInfo.IsAllowedToEdit(tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion); bool isReviewer = !MyUserInfo.IsAllowedToEdit(tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion);
pnl.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling(true); pnl.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling();
this.dlgFindReplace.ToggleReplaceTab(isReviewer ? E_ViewMode.View : E_ViewMode.Edit); this.dlgFindReplace.ToggleReplaceTab(isReviewer ? E_ViewMode.View : E_ViewMode.Edit);
pnl.MyStepTabPanel.MyStepTabRibbon.ToggleFindReplaceToolTip(isReviewer); pnl.MyStepTabPanel.MyStepTabRibbon.ToggleFindReplaceToolTip(isReviewer);
} }
@@ -5266,8 +5265,8 @@ namespace VEPROMS
{ {
if (SelectedDVI != null) if (SelectedDVI != null)
displayReports.Mydocversion = SelectedDVI; displayReports.Mydocversion = SelectedDVI;
displayReports.advTreeProcSetsFillIn(reportFocus); displayReports.advTreeProcSetsFillIn();
displayReports.advTreeROFillIn(reportFocus); displayReports.advTreeROFillIn();
displayReports.SelectReferencedObjectTab(); // to enable RO selection displayReports.SelectReferencedObjectTab(); // to enable RO selection
} }
} }
@@ -1,34 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Volian.Controls.Library
{
class AlphabeticalNumbering
{
//private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static string Letter(int number)
{
char c = (char)(number + 64);
return c.ToString();
}
public static string Convert(int number)
{
string retval=string.Empty;
if (number > 26) retval += Letter((number-1) / 26);
retval += Letter(1 + ((number-1) % 26));
return retval;
}
//private static int[] _TestLetters = new int[] {
// 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,
// 52,53,78,79,104,105
// };
//public static void ShowLetters()
//{
// for (int i = 0; i < _TestLetters.Length; i++)
// {
// if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", _TestLetters[i], Convert(_TestLetters[i]));
// }
//}
}
}
@@ -1,16 +1,11 @@
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Linq;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using Volian.Base.Library;
using Volian.Pipe.Library; using Volian.Pipe.Library;
namespace Volian.Controls.Library namespace Volian.Controls.Library
@@ -64,14 +59,14 @@ namespace Volian.Controls.Library
AddAttribute(xe, "Text", myItemInfo.DisplayText); AddAttribute(xe, "Text", myItemInfo.DisplayText);
_ProcList.DocumentElement.AppendChild(xe); _ProcList.DocumentElement.AppendChild(xe);
if (myItemInfo.Cautions != null) foreach (StepInfo caui in myItemInfo.Cautions) AddItem(myItemInfo.ItemID, caui); if (myItemInfo.Cautions != null) foreach (StepInfo caui in myItemInfo.Cautions.OfType<StepInfo>()) AddItem(myItemInfo.ItemID, caui);
if (myItemInfo.Notes != null) foreach (StepInfo noti in myItemInfo.Notes) AddItem(myItemInfo.ItemID, noti); if (myItemInfo.Notes != null) foreach (StepInfo noti in myItemInfo.Notes.OfType<StepInfo>()) AddItem(myItemInfo.ItemID, noti);
if (myItemInfo.RNOs != null) foreach (StepInfo rnoi in myItemInfo.RNOs) AddItem(myItemInfo.ItemID, rnoi); if (myItemInfo.RNOs != null) foreach (StepInfo rnoi in myItemInfo.RNOs.OfType<StepInfo>()) AddItem(myItemInfo.ItemID, rnoi);
if (myItemInfo.Sections != null) foreach (SectionInfo seci in myItemInfo.Sections) AddItem(myItemInfo.ItemID, seci); if (myItemInfo.Sections != null) foreach (SectionInfo seci in myItemInfo.Sections.OfType<SectionInfo>()) AddItem(myItemInfo.ItemID, seci);
if (myItemInfo.Steps != null) if (myItemInfo.Steps != null)
{ {
if(myItemInfo.IsSection || (myItemInfo.IsHigh && SubStepHasRNOs(myItemInfo.Steps))) if(myItemInfo.IsSection || (myItemInfo.IsHigh && SubStepHasRNOs(myItemInfo.Steps)))
foreach (StepInfo stpi in myItemInfo.Steps) AddItem(myItemInfo.ItemID, stpi); foreach (StepInfo stpi in myItemInfo.Steps.OfType<StepInfo>()) AddItem(myItemInfo.ItemID, stpi);
} }
} }
} }
@@ -102,7 +97,6 @@ namespace Volian.Controls.Library
{ {
_CurrentItem = value; _CurrentItem = value;
SetupCurrentItemValues(); SetupCurrentItemValues();
SetupConfigEdit();
// B2017-126 Only turn-on NamedPipe if Command Line parameter /NamedPipe is used. // B2017-126 Only turn-on NamedPipe if Command Line parameter /NamedPipe is used.
// This eliminates waiting for the Pipe if the command line parameter is not used. // This eliminates waiting for the Pipe if the command line parameter is not used.
if (ExeType > 0 && Volian.Base.Library.VlnSettings.GetCommandFlag("NamedPipe")) SendPromsAnnotationData(); if (ExeType > 0 && Volian.Base.Library.VlnSettings.GetCommandFlag("NamedPipe")) SendPromsAnnotationData();
@@ -130,10 +124,7 @@ namespace Volian.Controls.Library
if (ai.TypeID == ExeType) return ai; if (ai.TypeID == ExeType) return ai;
return null; return null;
} }
private void SetupConfigEdit()
{
//if (ExeType == 0) ; // initialize ExeType
}
private string _ExePath; private string _ExePath;
private string _PipeOut; private string _PipeOut;
private string _PipeIn; private string _PipeIn;
@@ -256,9 +247,6 @@ namespace Volian.Controls.Library
public AnnotationDetails() public AnnotationDetails()
{ {
InitializeComponent(); InitializeComponent();
//#if(DEBUG)
//Resize+=new EventHandler(AnnotationDetails_Resize); // Debug the resize event
//#endif
Resize += AnnotationDetails_Resize; Resize += AnnotationDetails_Resize;
} }
@@ -284,17 +272,12 @@ namespace Volian.Controls.Library
// CSM B2024-068 / B2024-069 - check if current annotation is not selected before removal of annotation // CSM B2024-068 / B2024-069 - check if current annotation is not selected before removal of annotation
if (CurrentAnnotation != null) if (CurrentAnnotation != null)
{ {
//using (Annotation annotation = CurrentAnnotation.Get())
//{
// annotation.Delete();
_AnnotationSearch.LoadingList = true; _AnnotationSearch.LoadingList = true;
Annotation.DeleteAnnotation(CurrentAnnotation); Annotation.DeleteAnnotation(CurrentAnnotation);
// annotation.Save();
_AnnotationSearch.LoadingList = false; _AnnotationSearch.LoadingList = false;
CurrentAnnotation = null; CurrentAnnotation = null;
UpdateAnnotationGrid(); UpdateAnnotationGrid();
_AnnotationSearch.UpdateAnnotationSearchResults(); // B2019-004: update search results list when an annotation is removed. _AnnotationSearch.UpdateAnnotationSearchResults(); // B2019-004: update search results list when an annotation is removed.
//}
} }
else else
{ {
@@ -425,14 +408,6 @@ namespace Volian.Controls.Library
} }
} }
private void CheckClientProcess()
{
if (ClientProcess.HasExited)
{
ClientProcess = null;
StartClientProcess();
}
}
void ClientProcess_Exited(object sender, EventArgs e) void ClientProcess_Exited(object sender, EventArgs e)
{ {
ClientProcess = null; ClientProcess = null;
@@ -477,7 +452,6 @@ namespace Volian.Controls.Library
{ {
XmlDocument xdConfig = new XmlDocument(); XmlDocument xdConfig = new XmlDocument();
xdConfig.LoadXml(ai.Config); xdConfig.LoadXml(ai.Config);
ProcedureInfo currentProc = CurrentItem.MyProcedure;
XmlNode nd = xdMessage.DocumentElement.SelectSingleNode("//PromsAnnotationConfig"); XmlNode nd = xdMessage.DocumentElement.SelectSingleNode("//PromsAnnotationConfig");
nd.AppendChild(xdMessage.ImportNode(xdConfig.DocumentElement, true)); nd.AppendChild(xdMessage.ImportNode(xdConfig.DocumentElement, true));
} }
@@ -595,7 +569,7 @@ namespace Volian.Controls.Library
} }
private XmlNode GetNode(XmlDocument xd, string nodeName) private XmlNode GetNode(XmlDocument xd, string nodeName)
{ {
return xd.DocumentElement.SelectSingleNode("//" + nodeName); return xd.DocumentElement.SelectSingleNode($"//{nodeName}");
} }
private string GetAttribute(XmlDocument xd, string nodeName, string attrName) private string GetAttribute(XmlDocument xd, string nodeName, string attrName)
{ {
@@ -670,7 +644,7 @@ namespace Volian.Controls.Library
if (!_LoadingGrid && (dgAnnotations.FirstDisplayedScrollingRowIndex != -1)) if (!_LoadingGrid && (dgAnnotations.FirstDisplayedScrollingRowIndex != -1))
dgAnnotations.FirstDisplayedScrollingRowIndex = row; dgAnnotations.FirstDisplayedScrollingRowIndex = row;
} }
catch (Exception ex) catch (Exception)
{ {
_MyLog.InfoFormat("Trying to open an annotation which has been removed"); _MyLog.InfoFormat("Trying to open an annotation which has been removed");
} }
@@ -692,8 +666,6 @@ namespace Volian.Controls.Library
using (Annotation annotation = Annotation.MakeAnnotation(myItem, annotationType, rtxbComment.Rtf, rtxbComment.Text, "")) using (Annotation annotation = Annotation.MakeAnnotation(myItem, annotationType, rtxbComment.Rtf, rtxbComment.Text, ""))
{ {
CurrentAnnotation = AnnotationInfo.Get(annotation.AnnotationID); CurrentAnnotation = AnnotationInfo.Get(annotation.AnnotationID);
//annotation.DTS = DateTime.Now;
//annotation.Save();
} }
} }
} }
@@ -724,7 +696,7 @@ namespace Volian.Controls.Library
private void btnEPAnnotation_Click(object sender, EventArgs e) private void btnEPAnnotation_Click(object sender, EventArgs e)
{ {
frmEPAnnotationDetails EPfrm = new frmEPAnnotationDetails(CurrentAnnotation); frmEPAnnotationDetails EPfrm = new frmEPAnnotationDetails(CurrentAnnotation);
DialogResult dr = EPfrm.ShowDialog(this); _ = EPfrm.ShowDialog(this);
} }
} }
} }
+4 -32
View File
@@ -1,8 +1,5 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
@@ -11,17 +8,9 @@ namespace Volian.Controls.Library
public partial class BorderListBox : ListBox public partial class BorderListBox : ListBox
{ {
#region Properties #region Properties
public GridLinePattern SelectedLinePattern public GridLinePattern SelectedLinePattern => (Items[SelectedIndex] as GridLBItem).LinePattern;
{
get { return (Items[SelectedIndex] as GridLBItem).LinePattern; }
}
#endregion #endregion
#region ctor #region ctor
public BorderListBox()
{
InitializeComponent();
SetupOptions();
}
public BorderListBox(IContainer container) public BorderListBox(IContainer container)
{ {
container.Add(this); container.Add(this);
@@ -31,9 +20,7 @@ namespace Volian.Controls.Library
private void SetupOptions() private void SetupOptions()
{ {
this.DrawMode = DrawMode.OwnerDrawFixed; this.DrawMode = DrawMode.OwnerDrawFixed;
//this.Font.Size;
DrawItem += new DrawItemEventHandler(BorderListBox_DrawItem); DrawItem += new DrawItemEventHandler(BorderListBox_DrawItem);
//MeasureItem += new MeasureItemEventHandler(BorderListBox_MeasureItem);
Items.Add(new GridLBItem(GridLinePattern.None)); Items.Add(new GridLBItem(GridLinePattern.None));
Items.Add(new GridLBItem(GridLinePattern.Single)); Items.Add(new GridLBItem(GridLinePattern.Single));
Items.Add(new GridLBItem(GridLinePattern.Double)); Items.Add(new GridLBItem(GridLinePattern.Double));
@@ -55,10 +42,6 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Event Handlers #region Event Handlers
//void BorderListBox_MeasureItem(object sender, MeasureItemEventArgs e)
//{
// e.ItemHeight = 22;
//}
private int _MaxLabelWidth = 0; private int _MaxLabelWidth = 0;
private int MaxLabelWidth(Graphics gr) private int MaxLabelWidth(Graphics gr)
{ {
@@ -103,24 +86,13 @@ namespace Volian.Controls.Library
public class GridLBItem public class GridLBItem
{ {
#region Properties #region Properties
private GridLinePattern _LinePattern; public GridLinePattern LinePattern { get; set; }
public GridLinePattern LinePattern
{
get { return _LinePattern; }
set { _LinePattern = value; }
}
#endregion #endregion
#region ctor #region ctor
public GridLBItem(GridLinePattern linePattern) public GridLBItem(GridLinePattern linePattern) => LinePattern = linePattern;
{
LinePattern = linePattern;
}
#endregion #endregion
#region Public Methods #region Public Methods
public override string ToString() public override string ToString() => LinePattern.ToString();
{
return LinePattern.ToString();
}
#endregion #endregion
} }
} }
@@ -1,8 +1,5 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Drawing; using System.Drawing;
using C1.Win.C1FlexGrid; using C1.Win.C1FlexGrid;
@@ -16,7 +13,7 @@ namespace Volian.Controls.Library
public event BorderSelectionPanelEvent BordersChanged; public event BorderSelectionPanelEvent BordersChanged;
private void OnBordersChanged(object sender, EventArgs args) private void OnBordersChanged(object sender, EventArgs args)
{ {
if (BordersChanged != null) BordersChanged(sender, args); BordersChanged?.Invoke(sender, args);
} }
#endregion #endregion
#region Properties #region Properties
@@ -155,8 +152,6 @@ namespace Volian.Controls.Library
} }
public void InitializeBorder(VlnFlexGrid myFlexGrid, CellRange myRange) public void InitializeBorder(VlnFlexGrid myFlexGrid, CellRange myRange)
{ {
//if (myRange.r1 == 0 && myRange.c1 == 0 && myRange.r2 == 2 && myRange.c2 == 2)
//Console.WriteLine("here");
_TopBorder = GridLinePattern.Unknown; _TopBorder = GridLinePattern.Unknown;
_InsideHorizontalBorder = GridLinePattern.Unknown; _InsideHorizontalBorder = GridLinePattern.Unknown;
_BottomBorder = GridLinePattern.Unknown; _BottomBorder = GridLinePattern.Unknown;
@@ -249,18 +244,11 @@ namespace Volian.Controls.Library
DrawBackground(e, x1, y1, x2, y2, w1, h1, w2, h2, offset, HasRows, HasColumns); DrawBackground(e, x1, y1, x2, y2, w1, h1, w2, h2, offset, HasRows, HasColumns);
DrawBorder(e, x1, y1, x2, y2); DrawBorder(e, x1, y1, x2, y2);
} }
#pragma warning disable IDE0060 // Remove unused parameter
private static void DrawBackground(PaintEventArgs e, int x1, int y1, int x2, int y2, int w1, int h1, int w2, int h2, int offset,bool hasRows, bool hasColumns) private static void DrawBackground(PaintEventArgs e, int x1, int y1, int x2, int y2, int w1, int h1, int w2, int h2, int offset,bool hasRows, bool hasColumns)
#pragma warning restore IDE0060 // Remove unused parameter
{ {
e.Graphics.FillRectangle(Brushes.White, offset, offset, w2 - 2* offset, h2 - 2* offset); e.Graphics.FillRectangle(Brushes.White, offset, offset, w2 - 2* offset, h2 - 2* offset);
// Old Backgound - Shows corners
//e.Graphics.DrawLine(Pens.LightBlue, x1, offset, x1, y1);
//e.Graphics.DrawLine(Pens.LightBlue, x2, offset, x2, y1);
//e.Graphics.DrawLine(Pens.LightBlue, x1, y2, x1, h2 - offset);
//e.Graphics.DrawLine(Pens.LightBlue, x2, y2, x2, h2 - offset);
//e.Graphics.DrawLine(Pens.LightBlue, offset, y1, x1, y1);
//e.Graphics.DrawLine(Pens.LightBlue, x2, y1, w2 - offset, y1);
//e.Graphics.DrawLine(Pens.LightBlue, offset, y2, x1, y2);
//e.Graphics.DrawLine(Pens.LightBlue, x2, y2, w2 - offset, y2);
// Horizontal Lines // Horizontal Lines
e.Graphics.DrawLine(Pens.LightBlue, offset, y1, w2 - offset, y1); e.Graphics.DrawLine(Pens.LightBlue, offset, y1, w2 - offset, y1);
if (hasRows) e.Graphics.DrawLine(Pens.LightBlue, x1 + offset, (y1 + y2) / 2, x2 - offset , (y1 + y2) / 2); if (hasRows) e.Graphics.DrawLine(Pens.LightBlue, x1 + offset, (y1 + y2) / 2, x2 - offset , (y1 + y2) / 2);
@@ -287,8 +275,8 @@ namespace Volian.Controls.Library
if (LineWidth(linePattern) == 3) if (LineWidth(linePattern) == 3)
{ {
dxo2 = dxo1 = -1; dxo2 = dxo1 = -1;
dyi2 = dyo1 = LineWidth(startPattern) == 3 ? -1 : 0; dyo1 = LineWidth(startPattern) == 3 ? -1 : 0;
dyi1 =dyo2 = LineWidth(endPattern) == 3 ? 1 : 0; dyo2 = LineWidth(endPattern) == 3 ? 1 : 0;
dxi1 = -dxo1; dxi2 = -dxo2; dyi1 = -dyo1; dyi2 = -dyo2; dxi1 = -dxo1; dxi2 = -dxo2; dyi1 = -dyo1; dyi2 = -dyo2;
if (linePattern == GridLinePattern.Thick) dyo2++; // Fix for bug in Graphics. Seems to happen when line is thick. if (linePattern == GridLinePattern.Thick) dyo2++; // Fix for bug in Graphics. Seems to happen when line is thick.
} }
@@ -303,8 +291,8 @@ namespace Volian.Controls.Library
if (LineWidth(linePattern) == 3) if (LineWidth(linePattern) == 3)
{ {
dyo2 = dyo1 = 1; dyo2 = dyo1 = 1;
dxi2 = dxo1 = LineWidth(startPattern) == 3 ? -1 : 0; dxo1 = LineWidth(startPattern) == 3 ? -1 : 0;
dxi1 = dxo2 = LineWidth(endPattern) == 3 ? 1 : 0; dxo2 = LineWidth(endPattern) == 3 ? 1 : 0;
dxi1 = -dxo1;dxi2 = -dxo2;dyi1 = -dyo1;dyi2 = -dyo2; dxi1 = -dxo1;dxi2 = -dxo2;dyi1 = -dyo1;dyi2 = -dyo2;
if (linePattern == GridLinePattern.Thick) dxo2++; // Fix for bug in Graphics. Seems to happen when line is thick. if (linePattern == GridLinePattern.Thick) dxo2++; // Fix for bug in Graphics. Seems to happen when line is thick.
} }
@@ -347,7 +335,7 @@ namespace Volian.Controls.Library
{ {
if (linePattern == GridLinePattern.None) return; if (linePattern == GridLinePattern.None) return;
int dyi1 = 0; int dyi2 = 0; int dxi1 = 0; int dxi2 = 0; int dyi1 = 0; int dyi2 = 0; int dxi1 = 0; int dxi2 = 0;
int dyo1 = 0; int dyo2 = 0; int dxo1 = 0; int dxo2 = 0; int dyo1; int dyo2; int dxo1 = 0; int dxo2 = 0;
if (LineWidth(linePattern) == 3) if (LineWidth(linePattern) == 3)
{ {
dxo2 = dxo1 = 1; dxo2 = dxo1 = 1;
@@ -368,7 +356,7 @@ namespace Volian.Controls.Library
{ {
if (linePattern == GridLinePattern.None) return; if (linePattern == GridLinePattern.None) return;
int dyi1 = 0; int dyi2 = 0; int dxi1 = 0; int dxi2 = 0; int dyi1 = 0; int dyi2 = 0; int dxi1 = 0; int dxi2 = 0;
int dyo1 = 0; int dyo2 = 0; int dxo1 = 0; int dxo2 = 0; int dyo1 = 0; int dyo2 = 0; int dxo1; int dxo2;
if (LineWidth(linePattern) == 3) if (LineWidth(linePattern) == 3)
{ {
dyo2 = dyo1 = -1; dyo2 = dyo1 = -1;
+14 -54
View File
@@ -1,33 +1,24 @@
using C1.Win.C1FlexGrid; using C1.Win.C1FlexGrid;
using System; using System;
using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
public partial class frmImportWordContents : Form public partial class frmImportWordContents : Form
{ {
private static string GetTableText()
{
return TblFlexGrid.GetSearchableText();
}
private static VlnFlexGrid _TblFlexGrid = null; private static VlnFlexGrid _TblFlexGrid = null;
public static VlnFlexGrid TblFlexGrid public static VlnFlexGrid TblFlexGrid
{ {
get { get {
if (_TblFlexGrid == null) _TblFlexGrid = new VlnFlexGrid(); if (_TblFlexGrid == null) _TblFlexGrid = new VlnFlexGrid();
return frmImportWordContents._TblFlexGrid; return _TblFlexGrid;
} }
set { frmImportWordContents._TblFlexGrid = value; } set { _TblFlexGrid = value; }
} }
private static void LoadTable2(XmlNode xn) private static void LoadTable2(XmlNode xn)
@@ -54,15 +45,7 @@ namespace Volian.Controls.Library
fg.BringToFront(); fg.BringToFront();
fg.Invalidate(); fg.Invalidate();
Application.DoEvents(); Application.DoEvents();
//ShowColumnWidths(fg);
fg.MakeRTFcells(false); fg.MakeRTFcells(false);
//ShowMergedCells(fg);
//ShowColumnWidths(fg);
//Well, Can I save the table
//using (Step step = MakeCSLAStep(mySteps, mySteps.Count, null, {TableContent}, 20008, E_FromType.Table))
//{
// Grid.MakeGrid(step.MyContent, fg.GetXMLData(), "");
//}
} }
public static VlnFlexGrid _MyFlexGrid = null; public static VlnFlexGrid _MyFlexGrid = null;
private static void AddTableRow(XmlNode xr, VlnFlexGrid fg, int rows) private static void AddTableRow(XmlNode xr, VlnFlexGrid fg, int rows)
@@ -73,14 +56,7 @@ namespace Volian.Controls.Library
foreach (XmlNode xc in xr.ChildNodes) foreach (XmlNode xc in xr.ChildNodes)
{ {
++cols; ++cols;
//if (xc.InnerText.Contains("RC-V200"))
// Console.WriteLine(xc.InnerText);
//if (xc.InnerText.Contains("RC-V121"))
// Console.WriteLine(xc.InnerText);
//if (xc.InnerXml.Contains("AB 137") || xc.InnerXml.Contains("3013N01"))
// Console.WriteLine("here");
CellRange cr2 = GetMyMergedRange(fg, rows - 1, cols - 1); CellRange cr2 = GetMyMergedRange(fg, rows - 1, cols - 1);
//Console.WriteLine("Check {0}", cr2);
while (cr2.c1 != cols - 1 || cr2.r1 != rows - 1) while (cr2.c1 != cols - 1 || cr2.r1 != rows - 1)
{ {
cols++; cols++;
@@ -123,7 +99,6 @@ namespace Volian.Controls.Library
break; break;
} }
} }
//ShowMergedCells(fg);
if (xc.Name == "td") if (xc.Name == "td")
{ {
AddTableColumn(xc, fg, rows, cols); AddTableColumn(xc, fg, rows, cols);
@@ -131,26 +106,9 @@ namespace Volian.Controls.Library
} }
} }
//private static void ShowColumnWidths(VlnFlexGrid fg)
//{
// foreach (Column c in fg.Cols)
// Console.WriteLine("Width[{0}]={1}", c.Index, c.Width);
//}
private static void ShowMergedCells(VlnFlexGrid fg)
{
for (int r = 0; r < fg.Rows.Count; r++)
{
for (int c = 0; c < fg.Cols.Count; c++)
{
CellRange cr3 = GetMyMergedRange(fg, r, c);
if (fg.MergedRanges.Contains(cr3))
Console.WriteLine("cr3 r={0},c={1},rng={2}", r, c, cr3);
}
}
}
private static int GetSpan(string span) private static int GetSpan(string span)
{ {
int retval = int.Parse("0" + (span ?? "")); int retval = int.Parse($"0{span ?? ""}");
if (retval == 0) return 0; if (retval == 0) return 0;
return retval - 1; return retval - 1;
} }
@@ -175,11 +133,13 @@ namespace Volian.Controls.Library
if (r2 > fg.Rows.Count) fg.Rows.Count = r2; if (r2 > fg.Rows.Count) fg.Rows.Count = r2;
int c2 = c1 + GetSpan(colspan); int c2 = c1 + GetSpan(colspan);
if (c2 > fg.Cols.Count) fg.Cols.Count = c2; if (c2 > fg.Cols.Count) fg.Cols.Count = c2;
CellRange cr = new CellRange(); CellRange cr = new CellRange
cr.r1 = r1 - 1; {
cr.r2 = r2 - 1; r1 = r1 - 1,
cr.c1 = c1 - 1; r2 = r2 - 1,
cr.c2 = c2 - 1; c1 = c1 - 1,
c2 = c2 - 1
};
fg.MergedRanges.Add(cr); fg.MergedRanges.Add(cr);
//Console.WriteLine("Merged {0}", cr); //Console.WriteLine("Merged {0}", cr);
} }
@@ -194,7 +154,7 @@ namespace Volian.Controls.Library
} }
return fg.GetMergedRange(r, c); return fg.GetMergedRange(r, c);
} }
private static Regex regNumber = new Regex("^[0-9]+$", RegexOptions.Compiled); private static readonly Regex regNumber = new Regex("^[0-9]+$", RegexOptions.Compiled);
private static void AddTableColumn(XmlNode xc, VlnFlexGrid fg, int rows, int cols) private static void AddTableColumn(XmlNode xc, VlnFlexGrid fg, int rows, int cols)
{ {
//Console.WriteLine("Rows {0}, Cols {1}", rows, cols); //Console.WriteLine("Rows {0}, Cols {1}", rows, cols);
@@ -218,7 +178,7 @@ namespace Volian.Controls.Library
{ {
if (xn.Name == "p") if (xn.Name == "p")
{ {
sb.Append(prefix + xn.InnerText); sb.Append($"{prefix}{xn.InnerText}");
} }
if (xn.Name == "ul") if (xn.Name == "ul")
{ {
@@ -226,11 +186,11 @@ namespace Volian.Controls.Library
{ {
if (xn2.Name == "li") if (xn2.Name == "li")
{ {
sb.Append(prefix + "*" + xn.InnerText); sb.Append($"{prefix}*{xn.InnerText}");
} }
if (xn2.Name == "p") if (xn2.Name == "p")
{ {
sb.Append(prefix + xn.InnerText); sb.Append($"{prefix}{xn.InnerText}");
} }
} }
} }
@@ -1,11 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace Volian.Controls.Library namespace Volian.Controls.Library
+25 -179
View File
@@ -1,12 +1,7 @@
using System; using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text; using System.Text;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
using System.Reflection; using System.Reflection;
using LBWordLibrary; using LBWordLibrary;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
@@ -17,7 +12,7 @@ namespace Volian.Controls.Library
public partial class DSOTabPanel : DevComponents.DotNetBar.PanelDockContainer public partial class DSOTabPanel : DevComponents.DotNetBar.PanelDockContainer
{ {
#region Private Fields #region Private Fields
private DisplayTabControl _MyDisplayTabControl; private readonly DisplayTabControl _MyDisplayTabControl;
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private AxEDWordLib.AxEDWord _MyEdWord; // B2017-133 Edraw DSO Framer Replacement private AxEDWordLib.AxEDWord _MyEdWord; // B2017-133 Edraw DSO Framer Replacement
public AxEDWordLib.AxEDWord MyEdWord public AxEDWordLib.AxEDWord MyEdWord
@@ -26,9 +21,7 @@ namespace Volian.Controls.Library
set { _MyEdWord = value; } set { _MyEdWord = value; }
} }
private TransparentPanel _MyTransparentPanel; private TransparentPanel _MyTransparentPanel;
private static int _Count = 0; private readonly DocumentInfo _MyDocumentInfo;
private DocumentInfo _MyDocumentInfo;
private int _MyCount;
private DisplayTabItem _MyDisplayTabItem; private DisplayTabItem _MyDisplayTabItem;
private DSOFile _DSOFile; private DSOFile _DSOFile;
public static int MSWordLimit = 10; public static int MSWordLimit = 10;
@@ -43,11 +36,7 @@ namespace Volian.Controls.Library
/// <summary> /// <summary>
/// Count of DSO Pages open. Limited to 18 in DisplayTabControl /// Count of DSO Pages open. Limited to 18 in DisplayTabControl
/// </summary> /// </summary>
public static int Count public static int Count { get; set; } = 0;
{
get { return _Count; }
set { _Count = value; }
}
/// <summary> /// <summary>
/// Pointer to the related DisplayTabItem /// Pointer to the related DisplayTabItem
/// </summary> /// </summary>
@@ -90,23 +79,17 @@ namespace Volian.Controls.Library
if (_MyEdWord == null) return false; // B2017-133 Edraw Is Dirty Property if (_MyEdWord == null) return false; // B2017-133 Edraw Is Dirty Property
// B2017-249 Recover Temporary File And AutoSave support for MSWord // B2017-249 Recover Temporary File And AutoSave support for MSWord
return _MyEdWord.IsDirty() || MyDSOFile.ContentIsDirty; return _MyEdWord.IsDirty() || MyDSOFile.ContentIsDirty;
//LBDocumentClass doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//return !doc.Saved;
} }
} }
private bool _OverrideClose = false;
public bool OverrideClose public bool OverrideClose { get; set; } = false;
{
get { return _OverrideClose; }
set { _OverrideClose = value; }
}
public E_ViewMode PanelViewEditMode = E_ViewMode.Edit; public E_ViewMode PanelViewEditMode = E_ViewMode.Edit;
#endregion #endregion
//private frmPG _frm = null; //private frmPG _frm = null;
#region Constructors #region Constructors
private Timer _RefreshTimer; private readonly Timer _RefreshTimer;
private ItemInfo _ItemInfo; private readonly ItemInfo _ItemInfo;
private bool _AllowedToEdit; private readonly bool _AllowedToEdit;
public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myDisplayTabControl, ItemInfo itemInfo, bool allowedToEdit) public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myDisplayTabControl, ItemInfo itemInfo, bool allowedToEdit)
{ {
_MyDisplayTabControl = myDisplayTabControl; _MyDisplayTabControl = myDisplayTabControl;
@@ -117,8 +100,10 @@ namespace Volian.Controls.Library
_MyDocumentInfo = documentInfo; _MyDocumentInfo = documentInfo;
SetupDSO(); SetupDSO();
if (_MyEdWord == null) return; //B2017-219 could not open the word attachment so just return if (_MyEdWord == null) return; //B2017-219 could not open the word attachment so just return
_RefreshTimer = new Timer(); // Enabled is false and interval is 1/10th of second. _RefreshTimer = new Timer
_RefreshTimer.Interval = 500;// B2017-133 Edraw {
Interval = 500// B2017-133 Edraw
}; // Enabled is false and interval is 1/10th of second.
ClientSizeChanged += new EventHandler(DSOTabPanel_ClientSizeChanged); ClientSizeChanged += new EventHandler(DSOTabPanel_ClientSizeChanged);
_RefreshTimer.Tick += new EventHandler(_RefreshTimer_Tick); _RefreshTimer.Tick += new EventHandler(_RefreshTimer_Tick);
// B2018-070 Activate MS Word Panel // B2018-070 Activate MS Word Panel
@@ -145,21 +130,14 @@ namespace Volian.Controls.Library
_MyEdWord.DisablePrintHotKey(true); _MyEdWord.DisablePrintHotKey(true);
} }
// B2019-161 When tracking timing time this action // B2019-161 When tracking timing time this action
private static VolianTimer _TimeActivity = new VolianTimer("DSOTabPanel.cs _RefreshTimer_Tick", 148); private static readonly VolianTimer _TimeActivity = new VolianTimer("DSOTabPanel.cs _RefreshTimer_Tick", 148);
void _RefreshTimer_Tick(object sender, EventArgs e) void _RefreshTimer_Tick(object sender, EventArgs e)
{ {
_TimeActivity.Open(); _TimeActivity.Open();
_RefreshTimer.Enabled = false; _RefreshTimer.Enabled = false;
if (_MyEdWord != null)// B2017-133 Edraw
{
// B2018-070 Activate MS Word Panel // B2018-070 Activate MS Word Panel
_MyEdWord.GotoItem(EDWordLib.WdGoToItem.wdGoToObject, EDWordLib.WdGoToDirection.wdGoToNext, 0, null); _MyEdWord?.GotoItem(EDWordLib.WdGoToItem.wdGoToObject, EDWordLib.WdGoToDirection.wdGoToNext, 0, null);
}
//else
//{
// _MyDisplayTabControl.CloseTabItem(_MyDisplayTabItem);
//}
_TimeActivity.Close(); _TimeActivity.Close();
} }
@@ -180,8 +158,7 @@ namespace Volian.Controls.Library
} }
private void SetupDSO() private void SetupDSO()
{ {
_Count++; // Increment the count of open Word documents (Limit = MSWordLimit) Count++; // Increment the count of open Word documents (Limit = MSWordLimit)
_MyCount = _Count;
this._MyTransparentPanel = new TransparentPanel(); this._MyTransparentPanel = new TransparentPanel();
this._MyEdWord = new AxEDWordLib.AxEDWord();// B2017-133 Edraw this._MyEdWord = new AxEDWordLib.AxEDWord();// B2017-133 Edraw
_MyEdWord.BeginInit(); _MyEdWord.BeginInit();
@@ -195,14 +172,8 @@ namespace Volian.Controls.Library
this._MyTransparentPanel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this._MyTransparentPanel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._MyTransparentPanel.ForeColor = System.Drawing.Color.Brown; // This is the color used to show InActive on the right side on the Word this._MyTransparentPanel.ForeColor = System.Drawing.Color.Brown; // This is the color used to show InActive on the right side on the Word
// document menu line. // document menu line.
//this._MyTransPanel.Location = new System.Drawing.Point(0, 0);
//this._MyTransPanel.Name = "transPanel1";
//this._MyTransPanel.Size = new System.Drawing.Size(370, 423);
//this._MyTransPanel.TabIndex = 1;
this._MyTransparentPanel.Click += new EventHandler(_MyTransparentPanel_Click); this._MyTransparentPanel.Click += new EventHandler(_MyTransparentPanel_Click);
this._MyEdWord.Dock = System.Windows.Forms.DockStyle.Fill; this._MyEdWord.Dock = System.Windows.Forms.DockStyle.Fill;
//System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab));
//this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState")));
_MyEdWord.EndInit(); _MyEdWord.EndInit();
LBDocumentClass doc; LBDocumentClass doc;
try try
@@ -215,18 +186,13 @@ namespace Volian.Controls.Library
this._MyEdWord.Open(MyDSOFile.MyFile.FullName); this._MyEdWord.Open(MyDSOFile.MyFile.FullName);
doc = new LBDocumentClass(_MyEdWord.ActiveDocument()); doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
} }
catch (Exception ex) catch (Exception)
{ {
// B2017-137 Restore Previous valid version if the current version cannot be opened, // B2017-137 Restore Previous valid version if the current version cannot be opened,
using (DocumentAuditInfoList dail = DocumentAuditInfoList.Get(MyDocumentInfo.DocID)) using (DocumentAuditInfoList dail = DocumentAuditInfoList.Get(MyDocumentInfo.DocID))
{ {
if (dail.Count > 0) if (dail.Count > 0)
{ {
//DocumentAuditInfo dai = dail[0];
//foreach (DocumentAuditInfo tmpa in dail)
//{
// if (tmpa.DTS > dai.DTS) dai = tmpa;
//}
if (MessageBox.Show("Do you want to revert to a previous version?", "Error in MS Word section", if (MessageBox.Show("Do you want to revert to a previous version?", "Error in MS Word section",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{ {
@@ -242,12 +208,6 @@ namespace Volian.Controls.Library
MyDSOFile.SaveFile(0, "", _ItemInfo, false, StatusChanged); // B2017-219 save the restored document to database MyDSOFile.SaveFile(0, "", _ItemInfo, false, StatusChanged); // B2017-219 save the restored document to database
this._MyEdWord = null; // B2017-219 Set MyEdWord to null - we will check for this in the calling functions this._MyEdWord = null; // B2017-219 Set MyEdWord to null - we will check for this in the calling functions
return; return;
//_MyDocumentInfo = DocumentInfo.Get(MyDocumentInfo.DocID);
//DocumentInfo.Refresh(myDoc);
////_DSOFile = null;
//this._MyEdWord.Open(MyDSOFile.MyFile.FullName);
//doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//doc.Range(1, 1);
} }
} }
@@ -267,19 +227,16 @@ namespace Volian.Controls.Library
} }
doc = new LBDocumentClass(_MyEdWord.ActiveDocument()); doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//Console.WriteLine("Version {0}", doc.Application.Version); //Console.WriteLine("Version {0}", doc.Application.Version);
float ver; if (!float.TryParse(doc.Application.Version, out float ver))
if (!float.TryParse(doc.Application.Version, out ver))
ver = 12.0F; ver = 12.0F;
this.Enter += new EventHandler(DSOTabPanel_Enter); this.Enter += new EventHandler(DSOTabPanel_Enter);
// B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel // B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel
this.Leave += DSOTabPanel_Leave; this.Leave += DSOTabPanel_Leave;
Application.DoEvents(); Application.DoEvents();
// The following line corrects Symbol characters in MSWord Sections
// CheckForSymbolCharacters(doc);
InitializeWordDocument(doc); InitializeWordDocument(doc);
FindSearchString(); FindSearchString();
} }
catch (Exception ex) catch (Exception)
{ {
//string message = ShowException(ex); //string message = ShowException(ex);
//Console.WriteLine("\r\n-------------\r\n{0}{1}{2}\r\n-------------\r\n", MyDSOFile.MyFile.FullName, ex.GetType().Name, message); //Console.WriteLine("\r\n-------------\r\n{0}{1}{2}\r\n-------------\r\n", MyDSOFile.MyFile.FullName, ex.GetType().Name, message);
@@ -301,8 +258,6 @@ namespace Volian.Controls.Library
DocStyle ds = MyDocumentInfo.DocumentEntries[0].MyContent.ContentItems[0].MyDocStyle; DocStyle ds = MyDocumentInfo.DocumentEntries[0].MyContent.ContentItems[0].MyDocStyle;
// this will cause an error and goto the Catch if the family or size is null, // this will cause an error and goto the Catch if the family or size is null,
// Westinghouse needs it to to this - at least for now // Westinghouse needs it to to this - at least for now
//if (ds.Font.Family != null) doc.Application.Selection.Font.Name = ds.Font.Family;
//if (ds.Font.Size != null) doc.Application.Selection.Font.Size = (float)ds.Font.Size;
doc.Application.Selection.Font.Name = ds.Font.Family; doc.Application.Selection.Font.Name = ds.Font.Family;
doc.Application.Selection.Font.Size = (float)ds.Font.Size; doc.Application.Selection.Font.Size = (float)ds.Font.Size;
doc.Application.Selection.ParagraphFormat.SpaceBefore = 0; doc.Application.Selection.ParagraphFormat.SpaceBefore = 0;
@@ -314,12 +269,12 @@ namespace Volian.Controls.Library
if (doc.ActiveWindow.ActivePane.View.Zoom.Percentage < 40) if (doc.ActiveWindow.ActivePane.View.Zoom.Percentage < 40)
doc.ActiveWindow.ActivePane.View.Zoom.Percentage = 100; doc.ActiveWindow.ActivePane.View.Zoom.Percentage = 100;
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0059:Unnecessary assignment of a value", Justification = "found set for debugging purposes")]
public void FindSearchString() public void FindSearchString()
{ {
if (SearchString == null) return; if (SearchString == null) return;
// Get the Document // Get the Document
LBDocumentClass wordDoc = new LBDocumentClass(_MyEdWord.ActiveDocument()); LBDocumentClass wordDoc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//LBSelection sel = wordDoc.Application.Selection;
LBFind find = wordDoc.Application.Selection.Find; LBFind find = wordDoc.Application.Selection.Find;
find.ClearFormatting(); find.ClearFormatting();
bool wildCards = SearchString.Contains("?") || SearchString.Contains("*"); bool wildCards = SearchString.Contains("?") || SearchString.Contains("*");
@@ -350,51 +305,10 @@ namespace Volian.Controls.Library
if (sel.Start == sel.End) return null; if (sel.Start == sel.End) return null;
return sel.Text; return sel.Text;
} }
private string ShowException(Exception ex)
{
string sep = "\r\n ";
StringBuilder sb = new StringBuilder();
do
{
sb.Append(sep + ex.Message);
sep += " ";
ex = ex.InnerException;
} while (ex != null);
return sb.ToString();
}
//void _MyDSOFramer_Leave(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSO Leave {0}", this.MyDocumentInfo.DocID);
//}
//void _MyDSOFramer_Enter(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSO Enter {0}", this.MyDocumentInfo.DocID);
//}
//void _MyDSOFramer_GotFocus(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSO Got Focus {0}",this.MyDocumentInfo.DocID);
//}
//void _MyDSOFramer_LostFocus(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSO Lost Focus {0}", this.MyDocumentInfo.DocID);
//}
public void EnterPanel() public void EnterPanel()
{ {
DSOTabPanel_Enter(this, new EventArgs()); DSOTabPanel_Enter(this, new EventArgs());
} }
//void DSOTabPanel_LostFocus(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSOTabPanel_LostFocus {0} DocID {1} Index {2} {3}", _In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName);
//}
//void DSOTabPanel_GotFocus(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSOTabPanel_GotFocus {0} DocID {1} Index {2} {3}", _In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName);
//}
#endregion #endregion
#region Event Handlers #region Event Handlers
/// <summary> /// <summary>
@@ -415,29 +329,16 @@ namespace Volian.Controls.Library
{ {
this.Select(); this.Select();
} }
///// <summary>
///// If the user presses the save button, tell the file to save it's contents to the database
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//void _MyDSOFramer_OnSaveCompleted(object sender, AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEvent e)
//{
// _MyLog.WarnFormat("_MyDSOFramer_OnSaveCompleted");
// Volian.Base.Library.vlnStackTrace.ShowStack("_MyDSOFramer_OnSaveCompleted");
// SaveDSO_Phase2();
//}
private void SaveDSO_Phase2() private void SaveDSO_Phase2()
{ {
// Unfortunately, the only way to handle view mode for DSO Framer is to not save. // Unfortunately, the only way to handle view mode for DSO Framer is to not save.
if (PanelViewEditMode == E_ViewMode.View) if (PanelViewEditMode == E_ViewMode.View)
{ {
MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip); MessageBox.Show($"Currently in VIEW mode,\r\n cannot Save {_MyDisplayTabItem.Tooltip}");
return; return;
} }
LBDocumentClass doc = new LBDocumentClass(_MyEdWord.ActiveDocument()); LBDocumentClass doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//while (doc.Saved = false)
// Application.DoEvents();
string tmp = GetReflectiveProperty(_MyEdWord.ActiveDocument(), "FullName"); string tmp = GetReflectiveProperty(_MyEdWord.ActiveDocument(), "FullName");
if (System.IO.File.Exists(tmp)) if (System.IO.File.Exists(tmp))
MyDSOFile.FullName = tmp; MyDSOFile.FullName = tmp;
@@ -451,10 +352,7 @@ namespace Volian.Controls.Library
if (myei != null && myei.MyDocument != null && myei.MyDocument.LibTitle != null && myei.MyDocument.LibTitle != "") if (myei != null && myei.MyDocument != null && myei.MyDocument.LibTitle != null && myei.MyDocument.LibTitle != "")
{ {
// C2019-033 - make save options more clear with respect to library documents // C2019-033 - make save options more clear with respect to library documents
string msgstr = "Save to Library Document?" + string msgstr = $"Save to Library Document?\n\n YES - Save for all usages of this Library Document.\n\n NO - Unlink this Section from the Library Document and Save in this Word Section.\n\n{_MyDocumentInfo.LibraryDocumentUsageAll}";
"\n\n YES - Save for all usages of this Library Document." +
"\n\n NO - Unlink this Section from the Library Document and Save in this Word Section.\n\n" +
_MyDocumentInfo.LibraryDocumentUsageAll;
DialogResult ans = FlexibleMessageBox.Show(msgstr, "Document Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question); DialogResult ans = FlexibleMessageBox.Show(msgstr, "Document Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans == DialogResult.No) cvtLibDoc = true; if (ans == DialogResult.No) cvtLibDoc = true;
} }
@@ -475,16 +373,6 @@ namespace Volian.Controls.Library
tc.ONStatusChanged(this, new DisplayTabControlStatusEventArgs(type, count, text)); tc.ONStatusChanged(this, new DisplayTabControlStatusEventArgs(type, count, text));
} }
} }
///// <summary>
///// Before a document closes check to see if it's contents should be saved.
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//void _MyDSOFramer_BeforeDocumentClosed(object sender, AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEvent e)
//{
// SaveDSOPhase1();
//}
private void SaveDSO_Phase1() private void SaveDSO_Phase1()
{ {
try try
@@ -494,7 +382,6 @@ namespace Volian.Controls.Library
this.Enter -= new EventHandler(DSOTabPanel_Enter); this.Enter -= new EventHandler(DSOTabPanel_Enter);
// B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel // B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel
this.Leave -= DSOTabPanel_Leave; this.Leave -= DSOTabPanel_Leave;
// SaveDirty(); // SaveDirty happens in CloseDSO(bool)
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -514,11 +401,6 @@ namespace Volian.Controls.Library
bool stat = _MyEdWord.Save();// B2017-133 Edraw bool stat = _MyEdWord.Save();// B2017-133 Edraw
//Console.WriteLine("Save = {0}", stat); //Console.WriteLine("Save = {0}", stat);
SaveDSO_Phase2(); SaveDSO_Phase2();
//_MyDSOFramer_OnSaveCompleted(this, null);
// These are handled in the method above
//LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
//MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
//MyDSOFile.SaveFile(doc.Length, doc.Ascii);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -543,13 +425,12 @@ namespace Volian.Controls.Library
// Unfortunately, the only way to handle view mode for DSO Framer is to not save. // Unfortunately, the only way to handle view mode for DSO Framer is to not save.
if (PanelViewEditMode == E_ViewMode.View || !_AllowedToEdit) if (PanelViewEditMode == E_ViewMode.View || !_AllowedToEdit)
{ {
MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip); MessageBox.Show($"Currently in VIEW mode,\r\n cannot Save {_MyDisplayTabItem.Tooltip}");
return false; return false;
} }
//if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.MyItemInfo.TabTitle + "\r\n" + _MyDisplayTabItem.MyItemInfo.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
// B2017-249 Recover Temporary File And AutoSave support for MSWord // B2017-249 Recover Temporary File And AutoSave support for MSWord
// C2019-033 - make save options more clear with respect to library documents second dialog will appear if Yes is selected and it's a library document // C2019-033 - make save options more clear with respect to library documents second dialog will appear if Yes is selected and it's a library document
string msgstr = "Save changes to " + (MyDSOFile.MyDocument.ContentIsDirty ? "Recovered Version of " : "") + _MyDisplayTabItem.Text; string msgstr = $"Save changes to {(MyDSOFile.MyDocument.ContentIsDirty ? "Recovered Version of " : "")}{_MyDisplayTabItem.Text}";
if (FlexibleMessageBox.Show(msgstr, (IsDirty ? "Document has Changed" : "Previous Changes were not Saved"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) if (FlexibleMessageBox.Show(msgstr, (IsDirty ? "Document has Changed" : "Previous Changes were not Saved"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
return SaveDSO(); return SaveDSO();
//Console.WriteLine("Delete {0}", MyDSOFile.MyFile.Name); //Console.WriteLine("Delete {0}", MyDSOFile.MyFile.Name);
@@ -595,15 +476,6 @@ namespace Volian.Controls.Library
StepTabPanel stpanel = _MyDisplayTabControl.GetProcedureTabPanel(MyDisplayTabItem.MyItemInfo); StepTabPanel stpanel = _MyDisplayTabControl.GetProcedureTabPanel(MyDisplayTabItem.MyItemInfo);
PanelViewEditMode = (stpanel == null) ? E_ViewMode.Edit : stpanel.MyStepPanel.VwMode; PanelViewEditMode = (stpanel == null) ? E_ViewMode.Edit : stpanel.MyStepPanel.VwMode;
} }
try
{
//_MyDSOFramer.EventsEnabled = true;
//_MyEdWord.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.ErrorFormat("DSOTabPage_Enter", ex);
}
if (_In_DSOTabPanel_Enter) return; if (_In_DSOTabPanel_Enter) return;
//vlnStackTrace.ShowStack("DSOTabPanel_Enter {0} DocID {1} Index {2} {3}",_In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName); //vlnStackTrace.ShowStack("DSOTabPanel_Enter {0} DocID {1} Index {2} {3}",_In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName);
_In_DSOTabPanel_Enter = true; _In_DSOTabPanel_Enter = true;
@@ -628,15 +500,6 @@ namespace Volian.Controls.Library
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool CloseDSO() public bool CloseDSO()
{
return CloseDSO(false);
}
/// <summary>
/// Cleans-up the DSO Framer window
/// </summary>
/// <param name="force"></param>
/// <returns></returns>
public bool CloseDSO(bool force)
{ {
_MyLog.Debug("CloseDSO"); _MyLog.Debug("CloseDSO");
bool result = true; bool result = true;
@@ -652,38 +515,21 @@ namespace Volian.Controls.Library
_MyEdWord = null; _MyEdWord = null;
// B2017-249 Recover Temporary File And AutoSave support for MSWord // B2017-249 Recover Temporary File And AutoSave support for MSWord
if (DeleteOnClose) MyDSOFile.MyFile.Delete(); if (DeleteOnClose) MyDSOFile.MyFile.Delete();
_Count--; Count--;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
if (_MyLog.IsErrorEnabled) _MyLog.Error("SaveDSO - " + this.Name, ex); if (_MyLog.IsErrorEnabled) _MyLog.Error($"SaveDSO - {this.Name}", ex);
result = false; result = false;
} }
return result; return result;
} }
/// <summary>
/// Activates the current DSO Framer window (Word)
/// </summary>
public void Activate()
{
try
{
//this._MyEdWord.Activate();
//if (_MyCount <= MSWordLimit)
// this._MyEdWord.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("Activate", ex);
}
}
#endregion #endregion
#region DocumentProperties #region DocumentProperties
private string GetReflectiveProperty(object objectToInspect, string propertyName) private string GetReflectiveProperty(object objectToInspect, string propertyName)
{ {
string returnString = "";
//To use reflection on an object, you //To use reflection on an object, you
// first need to get an instance // first need to get an instance
// of that object's type. // of that object's type.
@@ -1,8 +1,6 @@
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
using log4net.Util;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
@@ -18,8 +16,7 @@ namespace Volian.Controls.Library
public event DisplayApplicabilityEvent ApplicabilityViewModeChanged; public event DisplayApplicabilityEvent ApplicabilityViewModeChanged;
private void OnApplicabilityViewModeChanged() private void OnApplicabilityViewModeChanged()
{ {
if (ApplicabilityViewModeChanged != null) ApplicabilityViewModeChanged?.Invoke(this, new EventArgs());
ApplicabilityViewModeChanged(this, new EventArgs());
} }
private DisplayTabItem _MyDisplayTabItem = null; private DisplayTabItem _MyDisplayTabItem = null;
@@ -104,9 +101,9 @@ namespace Volian.Controls.Library
Location = new System.Drawing.Point(0, 49), Location = new System.Drawing.Point(0, 49),
Margin = new System.Windows.Forms.Padding(4), Margin = new System.Windows.Forms.Padding(4),
Name = "gpSubItem", Name = "gpSubItem",
Padding = new System.Windows.Forms.Padding(13, 12, 13, 37) Padding = new System.Windows.Forms.Padding(13, 12, 13, 37),
BackColor = Color.Transparent
}; };
gpSubItem.BackColor = Color.Transparent;
gpSubItem.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; gpSubItem.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
gpSubItem.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; gpSubItem.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
gpSubItem.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; gpSubItem.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near;
@@ -118,7 +115,9 @@ namespace Volian.Controls.Library
gpSubItem.Size = new System.Drawing.Size(400, 250); gpSubItem.Size = new System.Drawing.Size(400, 250);
return gpSubItem; return gpSubItem;
} }
#pragma warning disable IDE0044 // Add readonly modifier
private Dictionary<int, CheckBox> MyCheckBoxes = new Dictionary<int, CheckBox>(); private Dictionary<int, CheckBox> MyCheckBoxes = new Dictionary<int, CheckBox>();
#pragma warning restore IDE0044 // Add readonly modifier
private string _MyApplicability = string.Empty; private string _MyApplicability = string.Empty;
public string MyApplicability public string MyApplicability
{ {
@@ -132,14 +131,16 @@ namespace Volian.Controls.Library
private void AddItemMode(string name, string value, ref DevComponents.DotNetBar.Controls.GroupPanel gpSubItem) private void AddItemMode(string name, string value, ref DevComponents.DotNetBar.Controls.GroupPanel gpSubItem)
{ {
CheckBox cb = new CheckBox(); CheckBox cb = new CheckBox
cb.BackColor = Color.Transparent; {
cb.Height = 24; BackColor = Color.Transparent,
cb.Width = 75; Height = 24,
cb.AutoSize = true; Width = 75,
cb.Text = name; AutoSize = true,
cb.Tag = value; Text = name,
cb.Dock = DockStyle.Top; Tag = value,
Dock = DockStyle.Top
};
gpSubItem.Controls.Add(cb); gpSubItem.Controls.Add(cb);
cb.BringToFront(); cb.BringToFront();
cb.CheckedChanged += new EventHandler(cb_CheckedChanged); cb.CheckedChanged += new EventHandler(cb_CheckedChanged);
@@ -219,7 +220,7 @@ namespace Volian.Controls.Library
List<InvalidTransition> invalidTrans = WillTransitionsBeValidCommand.Execute(MyItemInfo.ItemID, MyApplicability); List<InvalidTransition> invalidTrans = WillTransitionsBeValidCommand.Execute(MyItemInfo.ItemID, MyApplicability);
// B2021-149: for Procedure level PC/PC, continue processing if all 'invalid' transitions are internal (query used // B2021-149: for Procedure level PC/PC, continue processing if all 'invalid' transitions are internal (query used
// return internal and external for the procedure level) // return internal and external for the procedure level)
if ((!MyItemInfo.IsProcedure && invalidTrans.Count == 0) || IsProcWithNoExternalTrans(MyItemInfo, invalidTrans)) if ((!MyItemInfo.IsProcedure && invalidTrans.Count == 0) || IsProcWithNoExternalTrans(invalidTrans))
{ {
// C2021 - 027: Procedure level PC/PC // C2021 - 027: Procedure level PC/PC
if (MyItemInfo.IsProcedure && MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ProcAppl) if (MyItemInfo.IsProcedure && MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ProcAppl)
@@ -279,7 +280,7 @@ namespace Volian.Controls.Library
// C2026-023: Check for Transitions when setting Applicability to all for a level // C2026-023: Check for Transitions when setting Applicability to all for a level
List<InvalidTransition> invalidTrans = WillTransitionsBeValidCommand.Execute(startitm.ItemID, MasterSlave_ApplicabilityTmp.ToString()); List<InvalidTransition> invalidTrans = WillTransitionsBeValidCommand.Execute(startitm.ItemID, MasterSlave_ApplicabilityTmp.ToString());
if (IsProcWithNoExternalTrans(startitm, invalidTrans)) if (IsProcWithNoExternalTrans(invalidTrans))
{ {
StepConfig sc2 = startitm.MyConfig as StepConfig; StepConfig sc2 = startitm.MyConfig as StepConfig;
using (Content cnt = Content.Get(startitm.MyContent.ContentID)) using (Content cnt = Content.Get(startitm.MyContent.ContentID))
@@ -319,7 +320,7 @@ namespace Volian.Controls.Library
} }
// B2021-149: for procedure, only consider external transitions as invalid // B2021-149: for procedure, only consider external transitions as invalid
private bool IsProcWithNoExternalTrans(ItemInfo ii, List<InvalidTransition> invalidTrans) private bool IsProcWithNoExternalTrans(List<InvalidTransition> invalidTrans)
{ {
if (invalidTrans.Count == 0) return true; if (invalidTrans.Count == 0) return true;
foreach (InvalidTransition iT in invalidTrans) foreach (InvalidTransition iT in invalidTrans)
@@ -434,17 +435,16 @@ namespace Volian.Controls.Library
foreach (CheckBox cb in MyCheckBoxes.Values) foreach (CheckBox cb in MyCheckBoxes.Values)
cb.Enabled = true; cb.Enabled = true;
} }
private void AddViewMode(string name, string value)
{
AddViewMode(name, value, false);
}
private void AddViewMode(string name, string value, bool selected) private void AddViewMode(string name, string value, bool selected)
{ {
RadioButton rb = new RadioButton(); RadioButton rb = new RadioButton
rb.BackColor = Color.Transparent; {
rb.Text = name; BackColor = Color.Transparent,
rb.Tag = value; Text = name,
rb.Dock = DockStyle.Top; Tag = value,
Dock = DockStyle.Top
};
gpMode.Controls.Add(rb); gpMode.Controls.Add(rb);
rb.BringToFront(); rb.BringToFront();
rb.Checked = selected; rb.Checked = selected;
@@ -469,7 +469,7 @@ namespace Volian.Controls.Library
// C2021 - 027: Procedure level PC/PC - handle procedure level too for viewing in editor // C2021 - 027: Procedure level PC/PC - handle procedure level too for viewing in editor
if (MyDisplayTabItem.MyStepTabPanel.SelectedItemInfo != null && MyDisplayTabItem.MyStepTabPanel.SelectedItemInfo.IsProcedure) if (MyDisplayTabItem.MyStepTabPanel.SelectedItemInfo != null && MyDisplayTabItem.MyStepTabPanel.SelectedItemInfo.IsProcedure)
ei = MyDisplayTabItem.MyStepTabPanel.SelectedEditItem; ei = MyDisplayTabItem.MyStepTabPanel.SelectedEditItem;
if (ei != null) ei.MyStepRTB.Focus(); ei?.MyStepRTB.Focus();
} }
} }
@@ -489,7 +489,7 @@ namespace Volian.Controls.Library
void DisplayApplicability_VisibleChanged(object sender, EventArgs e) void DisplayApplicability_VisibleChanged(object sender, EventArgs e)
{ {
MyItemInfo = MyItemInfo; MyItemInfo = MyItemInfo;
gpItem.Enabled = ShowItemSelection && UserInfo.CanEdit(MyUserInfo,(MyItemInfo == null) ? null : MyItemInfo.MyDocVersion); //Can Change Applicability gpItem.Enabled = ShowItemSelection && UserInfo.CanEdit(MyUserInfo,MyItemInfo?.MyDocVersion); //Can Change Applicability
} }
} }
} }
@@ -1,9 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
@@ -18,8 +13,7 @@ namespace Volian.Controls.Library
public event ResetBookMarksInPROMSWindowsEvent ResetBookMarksInPROMSWindows; public event ResetBookMarksInPROMSWindowsEvent ResetBookMarksInPROMSWindows;
private void OnResetBookMarksInPROMSWindows() private void OnResetBookMarksInPROMSWindows()
{ {
if (ResetBookMarksInPROMSWindows != null) ResetBookMarksInPROMSWindows?.Invoke(this, new EventArgs());
ResetBookMarksInPROMSWindows(this, new EventArgs());
} }
#endregion //delegates and Events #endregion //delegates and Events
#region Properties #region Properties
@@ -30,7 +24,6 @@ namespace Volian.Controls.Library
set { _MyBookMarks = value; } set { _MyBookMarks = value; }
} }
private ItemInfo _CurItemInfo = null; private ItemInfo _CurItemInfo = null;
private bool _Initalizing = false;
private DisplayTabControl _MyDisplayTabControl; private DisplayTabControl _MyDisplayTabControl;
public DisplayTabControl MyDisplayTabControl public DisplayTabControl MyDisplayTabControl
{ {
@@ -53,24 +46,11 @@ namespace Volian.Controls.Library
_CurItemInfo = MyEditItem.MyItemInfo; _CurItemInfo = MyEditItem.MyItemInfo;
} }
} }
//private StepRTB _MyRTB;
//public StepRTB MyRTB
//{
// get { return _MyRTB; }
// set
// {
// if (value == null) return;
// if (_CurItemInfo != null && _CurItemInfo.ItemID == value.MyItemInfo.ItemID) return;
// _MyRTB = value;
// _CurItemInfo = MyRTB.MyItemInfo;
// }
//}
#endregion #endregion
#region Constructors #region Constructors
public DisplayBookMarks() public DisplayBookMarks()
{ {
InitializeComponent(); InitializeComponent();
//SetupBookMarks();
} }
public void SetupBookMarks() public void SetupBookMarks()
{ {
@@ -81,9 +61,6 @@ namespace Volian.Controls.Library
} }
lbxBookMarks.SelectedValueChanged += new EventHandler(lbxBookMarks_SelectedValueChanged); lbxBookMarks.SelectedValueChanged += new EventHandler(lbxBookMarks_SelectedValueChanged);
RefreshBookMarkData(); RefreshBookMarkData();
//btnPrevPos.Enabled = false;
//lbxBookMarks.Enabled = false;
//_PrevBookMark = null;
} }
void _MyBookMarks_AfterRemove(object sender) void _MyBookMarks_AfterRemove(object sender)
@@ -148,8 +125,7 @@ namespace Volian.Controls.Library
} }
private void lbxBookMarks_Click(object sender, EventArgs e) private void lbxBookMarks_Click(object sender, EventArgs e)
{ {
MostRecentItem itm = lbxBookMarks.SelectedValue as MostRecentItem; if (lbxBookMarks.SelectedValue is MostRecentItem itm)
if(itm != null)
MyDisplayTabControl.OpenItem(itm.MyItemInfo); MyDisplayTabControl.OpenItem(itm.MyItemInfo);
} }
#endregion #endregion
@@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Linq;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
@@ -30,7 +26,7 @@ namespace Volian.Controls.Library
{ {
if (!DesignMode && _MainStepSection == null) // B2019-043 need to check if we are just saving changes to the user interface if (!DesignMode && _MainStepSection == null) // B2019-043 need to check if we are just saving changes to the user interface
{ {
foreach (SectionInfo si in MyItemInfo.MyProcedure.Sections) foreach (SectionInfo si in MyItemInfo.MyProcedure.Sections.OfType<SectionInfo>())
{ {
SectionConfig sc = (SectionConfig)si.MyConfig; SectionConfig sc = (SectionConfig)si.MyConfig;
if (sc.Section_OriginalSteps == "Y") _MainStepSection = si; if (sc.Section_OriginalSteps == "Y") _MainStepSection = si;
@@ -39,9 +35,6 @@ namespace Volian.Controls.Library
return _MainStepSection; return _MainStepSection;
} }
} }
//private ItemInfo _firstStep;
//private ItemInfo _lastStep;
private bool _Initializing;
public DisplayFoldoutMaint() public DisplayFoldoutMaint()
{ {
@@ -56,11 +49,10 @@ namespace Volian.Controls.Library
if (MyItemInfo != null) if (MyItemInfo != null)
{ {
if (MyItemInfo.MyProcedure.Sections == null || MyItemInfo.MyProcedure.Sections.Count == 0) return; if (MyItemInfo.MyProcedure.Sections == null || MyItemInfo.MyProcedure.Sections.Count == 0) return;
_Initializing = true;
ProcedureInfo pi = MyItemInfo.MyProcedure; ProcedureInfo pi = MyItemInfo.MyProcedure;
listBoxFoldouts.Items.Clear(); listBoxFoldouts.Items.Clear();
lstCBSteps.Items.Clear(); lstCBSteps.Items.Clear();
foreach (SectionInfo si in pi.Sections) foreach (SectionInfo si in pi.Sections.OfType<SectionInfo>())
if (si.DisplayText.ToUpper().StartsWith("FOLDOUT")) listBoxFoldouts.Items.Add(si); if (si.DisplayText.ToUpper().StartsWith("FOLDOUT")) listBoxFoldouts.Items.Add(si);
if (listBoxFoldouts.Items.Count > 0) listBoxFoldouts.SelectedIndex = 0; if (listBoxFoldouts.Items.Count > 0) listBoxFoldouts.SelectedIndex = 0;
else else
@@ -71,7 +63,6 @@ namespace Volian.Controls.Library
// find default step section & use its steps to fill in tree. // find default step section & use its steps to fill in tree.
FillInSteps(); FillInSteps();
_Initializing = false;
} }
} }
private void FillInSteps() private void FillInSteps()
@@ -80,8 +71,7 @@ namespace Volian.Controls.Library
ItemInfo startitm = MainStepSection.Steps != null && MainStepSection.Steps.Count > 0 ? MainStepSection.Steps[0] : null; ItemInfo startitm = MainStepSection.Steps != null && MainStepSection.Steps.Count > 0 ? MainStepSection.Steps[0] : null;
while (startitm != null) while (startitm != null)
{ {
StepConfig sc = startitm.MyConfig as StepConfig; if (startitm.MyConfig is StepConfig sc)
if (sc != null)
{ {
if (sc.Step_FloatingFoldout == foldOutselected.ItemID) if (sc.Step_FloatingFoldout == foldOutselected.ItemID)
{ {
@@ -102,8 +92,7 @@ namespace Volian.Controls.Library
for (int i = 0; i < lstCBSteps.Items.Count; i++) for (int i = 0; i < lstCBSteps.Items.Count; i++)
{ {
ItemInfo startitm = lstCBSteps.Items[i] as ItemInfo; ItemInfo startitm = lstCBSteps.Items[i] as ItemInfo;
StepConfig sc = startitm.MyConfig as StepConfig; if (startitm.MyConfig is StepConfig sc)
if (sc != null)
lstCBSteps.SetItemChecked(itemInList, sc.Step_FloatingFoldout == foldOutselected.ItemID); lstCBSteps.SetItemChecked(itemInList, sc.Step_FloatingFoldout == foldOutselected.ItemID);
else else
lstCBSteps.SetItemChecked(itemInList, false); lstCBSteps.SetItemChecked(itemInList, false);
+11 -203
View File
@@ -1,9 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using System.IO; using System.IO;
@@ -21,29 +19,21 @@ namespace Volian.Controls.Library
public event DisplayHistoryReportEvent SummaryPrintRequest; public event DisplayHistoryReportEvent SummaryPrintRequest;
private void OnChronologyPrintRequest(DisplayHistoryReportEventArgs args) private void OnChronologyPrintRequest(DisplayHistoryReportEventArgs args)
{ {
if (ChronologyPrintRequest != null) ChronologyPrintRequest?.Invoke(this, args);
ChronologyPrintRequest(this, args);
} }
private void OnSummaryPrintRequest(DisplayHistoryReportEventArgs args) private void OnSummaryPrintRequest(DisplayHistoryReportEventArgs args)
{ {
if (SummaryPrintRequest != null) SummaryPrintRequest?.Invoke(this, args);
SummaryPrintRequest(this, args);
} }
public event DisplayHistoryEvent HistorySelectionChanged; public event DisplayHistoryEvent HistorySelectionChanged;
private void OnHistorySelectionChanged(DisplayHistoryEventArgs args) private void OnHistorySelectionChanged(DisplayHistoryEventArgs args)
{ {
if (HistorySelectionChanged != null) HistorySelectionChanged?.Invoke(this, args);
HistorySelectionChanged(this, args);
}
public event ItemRestoredHandler ItemRestored;
private void OnItemRestored(ItemInfo restoredItemInfo)
{
if (ItemRestored != null) ItemRestored(restoredItemInfo);
} }
public event AnnotationRestoredHandler AnnotationRestored; public event AnnotationRestoredHandler AnnotationRestored;
private void OnAnnotationRestored(AnnotationInfo restoredAnnotationInfo, ItemInfo currentItem) private void OnAnnotationRestored(AnnotationInfo restoredAnnotationInfo, ItemInfo currentItem)
{ {
if (AnnotationRestored != null) AnnotationRestored(restoredAnnotationInfo, currentItem); AnnotationRestored?.Invoke(restoredAnnotationInfo, currentItem);
} }
#endregion #endregion
private ContentAuditInfoList _ChronologyAuditList; private ContentAuditInfoList _ChronologyAuditList;
@@ -176,10 +166,8 @@ namespace Volian.Controls.Library
SetRevDate(MyProcedureInfo.DTS); SetRevDate(MyProcedureInfo.DTS);
else else
{ {
DateTime revDate; if (!DateTime.TryParse(cfg.Print_RevDate, out DateTime revDate)) revDate = MyProcedureInfo.ChangeBarDate; // DateTime.Now;
if (!DateTime.TryParse(cfg.Print_RevDate, out revDate)) revDate = MyProcedureInfo.ChangeBarDate; // DateTime.Now;
SetRevDate(revDate); SetRevDate(revDate);
//SetRevDate(DateTime.Parse(cfg.Print_RevDate));
} }
} }
} }
@@ -222,8 +210,7 @@ namespace Volian.Controls.Library
{ {
if (lbChanges.SelectedIndex > -1) if (lbChanges.SelectedIndex > -1)
{ {
ContentAuditInfo cai = lbChanges.SelectedItem as ContentAuditInfo; if (lbChanges.SelectedItem is ContentAuditInfo cai)
if (cai != null)
{ {
// The following line was incorrectly showing a message stating that the item was deleted when it was not. // The following line was incorrectly showing a message stating that the item was deleted when it was not.
//if (cai.DeleteStatus > 0 || (cai.DeleteStatus == 0 && cai.ActionWhen.Year == DateTime.MinValue.Year)) //if (cai.DeleteStatus > 0 || (cai.DeleteStatus == 0 && cai.ActionWhen.Year == DateTime.MinValue.Year))
@@ -236,7 +223,7 @@ namespace Volian.Controls.Library
OnHistorySelectionChanged(new DisplayHistoryEventArgs(cai.ItemID)); OnHistorySelectionChanged(new DisplayHistoryEventArgs(cai.ItemID));
} }
// If the selected item is deleted display a message rather than crashing // If the selected item is deleted display a message rather than crashing
catch (Exception ex) catch (Exception)
{ {
FlexibleMessageBox.Show("This item has been deleted.", "Deleted Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); FlexibleMessageBox.Show("This item has been deleted.", "Deleted Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
} }
@@ -252,12 +239,10 @@ namespace Volian.Controls.Library
private void UpdateHistory() private void UpdateHistory()
{ {
this.Cursor = Cursors.WaitCursor; this.Cursor = Cursors.WaitCursor;
//DateTime start = DateTime.Now;
//Console.WriteLine(start); //Console.WriteLine(start);
#region setup #region setup
btnRestore.Enabled = false; btnRestore.Enabled = false;
myRTB.Clear(); myRTB.Clear();
//myRTB.LastRtf = string.Empty;
myVFG.Clear(); myVFG.Clear();
myPicBox.Image = null; myPicBox.Image = null;
if (!tvAudits.IsDisposed) // fixes a crash that happend while debugging separate windows, have not been able to reproduce. left this IF check in just in case. - jsj 2-1-2018 if (!tvAudits.IsDisposed) // fixes a crash that happend while debugging separate windows, have not been able to reproduce. left this IF check in just in case. - jsj 2-1-2018
@@ -269,8 +254,6 @@ namespace Volian.Controls.Library
} }
MyItemInfo.RefreshItemAnnotations(); MyItemInfo.RefreshItemAnnotations();
#endregion #endregion
//if (AnnotationOnly)
//{
#region annotation deleted #region annotation deleted
//annotation deleted by itemid //annotation deleted by itemid
TreeNode annotationDeleted = null; TreeNode annotationDeleted = null;
@@ -319,14 +302,11 @@ namespace Volian.Controls.Library
} }
//end annotation change //end annotation change
#endregion #endregion
// return;
//}
#region content changes #region content changes
//content changes //content changes
TreeNode contentHistory = null; TreeNode contentHistory = null;
if (MyItemInfo == null) return; if (MyItemInfo == null) return;
ContentAuditInfoList cail = ContentAuditInfoList.Get(MyItemInfo.ContentID, MyItemInfo.MyProcedure.DTS); ContentAuditInfoList cail = ContentAuditInfoList.Get(MyItemInfo.ContentID, MyItemInfo.MyProcedure.DTS);
// ContentAuditInfoList cail = ContentAuditInfoList.GetChronology(MyItemInfo.MyProcedure.ItemID, MyItemInfo.ItemID, false);
ContentInfo ci = ContentInfo.Get(MyItemInfo.ContentID); ContentInfo ci = ContentInfo.Get(MyItemInfo.ContentID);
foreach (ContentAuditInfo cai in cail) foreach (ContentAuditInfo cai in cail)
{ {
@@ -378,155 +358,10 @@ namespace Volian.Controls.Library
#endregion #endregion
#region items #region items
TreeNode deletedItems = null; TreeNode deletedItems = null;
TreeNode previousItem = null;
TreeNode nextItem = null;
TreeNode procedurePart = null;
TreeNode sectionPart = null;
TreeNode cautionPart = null;
TreeNode notePart = null;
TreeNode rnoPart = null;
TreeNode stepPart = null;
TreeNode tablePart = null;
#endregion #endregion
ItemAuditInfoList iail = ItemAuditInfoList.Get(MyItemInfo.ItemID); ItemAuditInfoList iail = ItemAuditInfoList.Get(MyItemInfo.ItemID);
foreach (ItemAuditInfo iai in iail) foreach (ItemAuditInfo iai in iail)
{ {
#region old style
// switch (iai.Level)
// {
// #region previous item
// case 0: //previous item
// {
// #region old style
// //if (previousItem == null)
// // previousItem = tvAudits.Nodes.Add("Deleted Previous Item"); //previousItem = tvAudits.Nodes.Add("Previous Item");
// //TreeNode tn = previousItem.Nodes.Add(iai.ToString());
// //tn.Tag = iai;
// #endregion
// #region new style
// if (deletedItems == null)
// deletedItems = tvAudits.Nodes.Add("Deleted Items");
// TreeNode tnn = deletedItems.Nodes.Add(iai.ToString());
// tnn.Tag = iai;
// #endregion
// break;
// }
// #endregion
// #region next item
// case 1: //next item
// {
// #region old style
// //if (nextItem == null)
// // nextItem = tvAudits.Nodes.Add("Deleted Next Item"); //nextItem = tvAudits.Nodes.Add("Next Item");
// //TreeNode tn = nextItem.Nodes.Add(iai.ToString());
// //tn.Tag = iai;
// #endregion
// #region new style
// if (deletedItems == null)
// deletedItems = tvAudits.Nodes.Add("Deleted Items");
// TreeNode tnn = deletedItems.Nodes.Add(iai.ToString());
// tnn.Tag = iai;
// #endregion
// break;
// }
// #endregion
// case 2: //parts
// {
// #region old style
// //PartAuditInfoList pail = null;
// //pail = PartAuditInfoList.GetByDeleteStatus(iai.DeleteStatus);
// //if (pail.Count == 0)
// // pail = PartAuditInfoList.GetByItemID(iai.ItemID);
// //foreach (PartAuditInfo pai in pail)
// //{
// // if (pai.ContentID == MyItemInfo.ContentID)
// // {
// // switch (pai.FromType)
// // {
// // #region procedure part
// // case 1: //procedures
// // {
// // if (procedurePart == null)
// // procedurePart = tvAudits.Nodes.Add("Deleted Procedures"); //procedurePart = tvAudits.Nodes.Add("Procedures");
// // TreeNode tn = procedurePart.Nodes.Add(iai.ToString());
// // tn.Tag = iai;
// // break;
// // }
// // #endregion
// // #region section part
// // case 2: //sections
// // {
// // if (sectionPart == null)
// // sectionPart = tvAudits.Nodes.Add("Deleted Sections"); //sectionPart = tvAudits.Nodes.Add("Sections");
// // TreeNode tn = sectionPart.Nodes.Add(iai.ToString());
// // tn.Tag = iai;
// // break;
// // }
// // #endregion
// // #region caution part
// // case 3: //cautions
// // {
// // if (cautionPart == null)
// // cautionPart = tvAudits.Nodes.Add("Deleted Cautions"); //cautionPart = tvAudits.Nodes.Add("Cautions");
// // TreeNode tn = cautionPart.Nodes.Add(iai.ToString());
// // tn.Tag = iai;
// // break;
// // }
// // #endregion
// // #region note part
// // case 4: //notes
// // {
// // if (notePart == null)
// // notePart = tvAudits.Nodes.Add("Deleted Notes"); //notePart = tvAudits.Nodes.Add("Notes");
// // TreeNode tn = notePart.Nodes.Add(iai.ToString());
// // tn.Tag = iai;
// // break;
// // }
// // #endregion
// // #region rno part
// // case 5: //rnos
// // {
// // if (rnoPart == null)
// // rnoPart = tvAudits.Nodes.Add("Deleted RNOs"); //rnoPart = tvAudits.Nodes.Add("RNOs");
// // TreeNode tn = rnoPart.Nodes.Add(iai.ToString());
// // tn.Tag = iai;
// // break;
// // }
// // #endregion
// // #region step part
// // case 6: //steps
// // {
// // if (stepPart == null)
// // stepPart = tvAudits.Nodes.Add("Deleted Steps"); //stepPart = tvAudits.Nodes.Add("Steps");
// // TreeNode tn = stepPart.Nodes.Add(iai.ToString());
// // tn.Tag = iai;
// // break;
// // }
// // #endregion
// // #region table part
// // case 7: //tables
// // {
// // if (tablePart == null)
// // tablePart = tvAudits.Nodes.Add("Deleted Tables"); //tablePart = tvAudits.Nodes.Add("Tables");
// // TreeNode tn = tablePart.Nodes.Add(iai.ToString());
// // tn.Tag = iai;
// // break;
// // }
// // #endregion
// // }
// // }
// //}
// #endregion
// #region new style
// if (deletedItems == null)
// deletedItems = tvAudits.Nodes.Add("Deleted Items");
// TreeNode tnn = deletedItems.Nodes.Add(iai.ToString());
// tnn.Tag = iai;
// #endregion
// break;
// }
//}
#endregion
#region new style #region new style
// B2023-117 if DeleteStatus is zero,don't try to get Audit Info List // B2023-117 if DeleteStatus is zero,don't try to get Audit Info List
if (iai.DeleteStatus == 0) continue; if (iai.DeleteStatus == 0) continue;
@@ -552,7 +387,7 @@ namespace Volian.Controls.Library
} }
} }
} }
TreeNode tnn = deletedItems.Nodes.Add(iai.ToString() + "; Reason: " + strR); TreeNode tnn = deletedItems.Nodes.Add($"{iai}; Reason: {strR}");
tnn.Tag = iai; tnn.Tag = iai;
#endregion #endregion
} }
@@ -572,10 +407,8 @@ namespace Volian.Controls.Library
} }
private void WalkProcedure() private void WalkProcedure()
{ {
//return;
this.ParentForm.Cursor = Cursors.WaitCursor; this.ParentForm.Cursor = Cursors.WaitCursor;
Application.DoEvents(); Application.DoEvents();
//DateTime start = DateTime.Now;
//Console.WriteLine(start); //Console.WriteLine(start);
lbChanges.Items.Clear(); lbChanges.Items.Clear();
if (MyProcedureInfo == null) if (MyProcedureInfo == null)
@@ -611,7 +444,7 @@ namespace Volian.Controls.Library
// in the list box and should not be because some MyRevDate's did not have time included. // in the list box and should not be because some MyRevDate's did not have time included.
if (CompareDateOrDateTime(cai.DTS, MyRevDate) || cai.ActionWhen > MyRevDate) if (CompareDateOrDateTime(cai.DTS, MyRevDate) || cai.ActionWhen > MyRevDate)
{ {
string itemTitle = FixPath(cai.Path); _ = FixPath(cai.Path);
lbChanges.Items.Add(cai); lbChanges.Items.Add(cai);
} }
} }
@@ -630,7 +463,7 @@ namespace Volian.Controls.Library
{ {
ItemInfo iii = aai.MyItemInfo; ItemInfo iii = aai.MyItemInfo;
if (iii != null) if (iii != null)
stepnum = FixPath(iii.SearchPath); _ = FixPath(iii.SearchPath);
} }
if (aai.DTS > MyRevDate) if (aai.DTS > MyRevDate)
lbChanges.Items.Add(aai); lbChanges.Items.Add(aai);
@@ -650,25 +483,13 @@ namespace Volian.Controls.Library
private void btnViewChronologyReport_Click(object sender, EventArgs e) private void btnViewChronologyReport_Click(object sender, EventArgs e)
{ {
RefreshList(); RefreshList();
//if (lbChanges.Items.Count > 0)
//{
//jcb added 20120425 to suppress annotations in report
//jcb commented out 20130409 per bug C2012-022
//_AnnotationList = AnnotationAuditInfoList.GetChronology(0, 0, MyProcedureInfo.ChangeBarDate);
//added setting selected slave in order for reports to replace unit number,etc jcb 20101010 //added setting selected slave in order for reports to replace unit number,etc jcb 20101010
MyItemInfo.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = ApplDisplayMode; MyItemInfo.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = ApplDisplayMode;
// OnChronologyPrintRequest(new DisplayHistoryReportEventArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MyChronology.pdf", MyItemInfo.MyProcedure, _ChronologyAuditList, _AnnotationList));
OnChronologyPrintRequest(new DisplayHistoryReportEventArgs(string.Format(@"{0}\{1} Chronology of Changes.pdf", Volian.Base.Library.VlnSettings.TemporaryFolder, MyItemInfo.MyProcedure.PDFNumber), MyItemInfo.MyProcedure, _ChronologyAuditList, _AnnotationList)); OnChronologyPrintRequest(new DisplayHistoryReportEventArgs(string.Format(@"{0}\{1} Chronology of Changes.pdf", Volian.Base.Library.VlnSettings.TemporaryFolder, MyItemInfo.MyProcedure.PDFNumber), MyItemInfo.MyProcedure, _ChronologyAuditList, _AnnotationList));
//}
} }
private void btnViewSummaryReport_Click(object sender, EventArgs e) private void btnViewSummaryReport_Click(object sender, EventArgs e)
{ {
RefreshList(); RefreshList();
//if (lbChanges.Items.Count > 0)
//{
//jcb added 20120425 to suppress annotations in report
//jcb commented out 20130409 per bug C2012-022
//_AnnotationList = AnnotationAuditInfoList.GetChronology(0, 0, MyProcedureInfo.ChangeBarDate);
//added setting selected slave in order for reports to replace unit number,etc jcb 20101010 //added setting selected slave in order for reports to replace unit number,etc jcb 20101010
MyItemInfo.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = ApplDisplayMode; MyItemInfo.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = ApplDisplayMode;
@@ -676,7 +497,6 @@ namespace Volian.Controls.Library
//C2024- 038 - Summary of Changes report generation enhancements //C2024- 038 - Summary of Changes report generation enhancements
//check if need to modify //check if need to modify
// _SummaryAuditList
if (DT_SumAsOf.Checked) if (DT_SumAsOf.Checked)
dhr.AuditList = FilterSummaryByDate(_SummaryAuditList, DT_SumAsOf.Value); dhr.AuditList = FilterSummaryByDate(_SummaryAuditList, DT_SumAsOf.Value);
else else
@@ -685,7 +505,6 @@ namespace Volian.Controls.Library
//C2024- 038 - Summary of Changes report generation enhancements //C2024- 038 - Summary of Changes report generation enhancements
// if Exclude Annotations Checked // if Exclude Annotations Checked
// send an empty list instead of // send an empty list instead of
//_AnnotationList
if (cbSumExcludeAnn.Checked) if (cbSumExcludeAnn.Checked)
dhr.AnnotationList = new AnnotationAuditInfoList(null); dhr.AnnotationList = new AnnotationAuditInfoList(null);
else if (DT_SumAsOf.Checked) else if (DT_SumAsOf.Checked)
@@ -799,11 +618,7 @@ namespace Volian.Controls.Library
if (myRoFst != null) myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate); if (myRoFst != null) myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
ii = MyItemInfo.RestoreItem(iai, myRoFst); ii = MyItemInfo.RestoreItem(iai, myRoFst);
if (myRoFst != null) myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate); if (myRoFst != null) myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
//_MyEditItem.AddChild((E_FromType)fromtype, contenttype);
//ii.ItemParts[0].FromType
//ii.MyContent.Type
EditItem nextItem = MyEditItem.GetNextItem((E_FromType)ii.ItemParts[0].FromType, ii); EditItem nextItem = MyEditItem.GetNextItem((E_FromType)ii.ItemParts[0].FromType, ii);
//MyEditItem.AddChild(ii.MyContent.Text, (E_FromType)ii.ItemParts[0].FromType, (int)ii.MyContent.Type, null);
if (ii.IsStep) if (ii.IsStep)
ii = StepInfo.Get(ii.ItemID); ii = StepInfo.Get(ii.ItemID);
else if (ii.IsSection) else if (ii.IsSection)
@@ -1051,10 +866,6 @@ namespace Volian.Controls.Library
myRTB.Visible = true; myRTB.Visible = true;
myRTB.BringToFront(); myRTB.BringToFront();
myVFG.Visible = false; myVFG.Visible = false;
// myRTB.Font = new Font("Arial", 12, FontStyle.Regular);
// myRTB.Text = cai.Text;
//myRTB.SetupRichText("bozo", MyItemInfo.FormatStepData == null ? MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font : MyItemInfo.FormatStepData.Font);
//myRTB.LastRtf = string.Empty;
myRTB.SetupRichText(cai.Text, MyItemInfo.FormatStepData == null ? MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font : MyItemInfo.FormatStepData.Font); myRTB.SetupRichText(cai.Text, MyItemInfo.FormatStepData == null ? MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font : MyItemInfo.FormatStepData.Font);
} }
} }
@@ -1067,8 +878,6 @@ namespace Volian.Controls.Library
{ {
if (cai.DeleteStatus == iai.DeleteStatus) if (cai.DeleteStatus == iai.DeleteStatus)
{ {
//myRTB.Font = new Font("Arial", 12, FontStyle.Regular);
//myRTB.Text = cai.Text;
myRTB.SetupRichText(cai.Text, MyItemInfo.FormatStepData == null ? MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font : MyItemInfo.FormatStepData.Font); myRTB.SetupRichText(cai.Text, MyItemInfo.FormatStepData == null ? MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font : MyItemInfo.FormatStepData.Font);
} }
} }
@@ -1079,7 +888,6 @@ namespace Volian.Controls.Library
AnnotationAuditInfo iai = tn.Tag as AnnotationAuditInfo; AnnotationAuditInfo iai = tn.Tag as AnnotationAuditInfo;
myRTB.Font = new Font("Arial", 12, FontStyle.Regular); myRTB.Font = new Font("Arial", 12, FontStyle.Regular);
myRTB.Rtf = iai.RtfText; myRTB.Rtf = iai.RtfText;
//myRTB.Rtf = iai.RtfText;
} }
} }
else else
@@ -1121,7 +929,7 @@ namespace Volian.Controls.Library
myTimer.Enabled = true; myTimer.Enabled = true;
} }
// B2019-161 When tracking timing time this action // B2019-161 When tracking timing time this action
private static VolianTimer _TimeActivity = new VolianTimer("DisplayHistory myTimer_Tick", 974); private static readonly VolianTimer _TimeActivity = new VolianTimer("DisplayHistory myTimer_Tick", 974);
private void myTimer_Tick(object sender, System.EventArgs e) private void myTimer_Tick(object sender, System.EventArgs e)
{ {
+12 -37
View File
@@ -1,14 +1,7 @@
using System; using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.IO; using System.IO;
using AT.STO.UI.Win;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library namespace Volian.Controls.Library
@@ -30,7 +23,7 @@ namespace Volian.Controls.Library
get { return _LibDocList; } get { return _LibDocList; }
set { _LibDocList = value; } set { _LibDocList = value; }
} }
private Color saveGroupPanelUsages; private readonly Color saveGroupPanelUsages;
#endregion #endregion
#region Constructors #region Constructors
public DisplayLibDocs() public DisplayLibDocs()
@@ -76,8 +69,7 @@ namespace Volian.Controls.Library
public event DisplayLibDocEvent PrintRequest; public event DisplayLibDocEvent PrintRequest;
private void OnPrintRequest(DisplayLibDocEventArgs args) private void OnPrintRequest(DisplayLibDocEventArgs args)
{ {
if (PrintRequest != null) PrintRequest?.Invoke(this, args);
PrintRequest(this, args);
} }
private void listBoxLibDocs_Click(object sender, EventArgs e) private void listBoxLibDocs_Click(object sender, EventArgs e)
@@ -125,9 +117,9 @@ namespace Volian.Controls.Library
foreach (ItemInfo ii in dicnt.LibraryDocumentUsageList) foreach (ItemInfo ii in dicnt.LibraryDocumentUsageList)
{ {
if (ii.MyDocVersion != null) if (ii.MyDocVersion != null)
listBoxUsages.Items.Add(ii.MyProcedure.ToString() + " - " + ii.DisplayNumber + " " + ii.DisplayText); listBoxUsages.Items.Add($"{ii.MyProcedure} - {ii.DisplayNumber} {ii.DisplayText}");
} }
btnPrint.Enabled = listBoxLibDocs.Items.Count > 0 ? true : false; btnPrint.Enabled = listBoxLibDocs.Items.Count > 0;
} }
private void btnDelLibDoc_Click(object sender, EventArgs e) private void btnDelLibDoc_Click(object sender, EventArgs e)
{ {
@@ -139,7 +131,7 @@ namespace Volian.Controls.Library
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("error deleting doc = " + ex.Message); Console.WriteLine($"error deleting doc = {ex.Message}");
} }
LibDocListFillIn(_DisplayTabControl); LibDocListFillIn(_DisplayTabControl);
} }
@@ -203,12 +195,13 @@ namespace Volian.Controls.Library
private void btnImpLibDoc_Click(object sender, EventArgs e) private void btnImpLibDoc_Click(object sender, EventArgs e)
{ {
OpenFileDialog openFileDialog1 = new OpenFileDialog(); OpenFileDialog openFileDialog1 = new OpenFileDialog
{
openFileDialog1.InitialDirectory = "c:\\"; InitialDirectory = "c:\\",
openFileDialog1.Filter = "Word files (*.doc;*.rtf;*.docx)|*.doc;*.rtf;*.docx|All files (*.*)|*.*"; Filter = "Word files (*.doc;*.rtf;*.docx)|*.doc;*.rtf;*.docx|All files (*.*)|*.*",
openFileDialog1.FilterIndex = 0; FilterIndex = 0,
openFileDialog1.RestoreDirectory = true; RestoreDirectory = true
};
if (openFileDialog1.ShowDialog() == DialogResult.OK) if (openFileDialog1.ShowDialog() == DialogResult.OK)
{ {
@@ -352,24 +345,6 @@ namespace Volian.Controls.Library
get { return _PaperSize; } get { return _PaperSize; }
set { _PaperSize = value; } set { _PaperSize = value; }
} }
//private string _SearchString = null;
//public string SearchString
//{
// get { return _SearchString; }
// set { _SearchString = value; }
//}
//private string _TypesSelected;
//public string TypesSelected
//{
// get { return _TypesSelected; }
// set { _TypesSelected = value; }
//}
//private ICollection<ItemInfo> _MyItemInfoList;
//public ICollection<ItemInfo> MyItemInfoList
//{
// get { return _MyItemInfoList; }
// set { _MyItemInfoList = value; }
//}
public DisplayLibDocEventArgs(string reportTitle, DocumentInfoList libDocList, string paperSize) public DisplayLibDocEventArgs(string reportTitle, DocumentInfoList libDocList, string paperSize)
{ {
_ReportTitle = reportTitle; _ReportTitle = reportTitle;
+40 -64
View File
@@ -7,7 +7,6 @@ using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using Volian.Base.Library; using Volian.Base.Library;
@@ -17,29 +16,22 @@ namespace Volian.Controls.Library
{ {
public partial class DisplayRO : UserControl public partial class DisplayRO : UserControl
{ {
#region Log4Net
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
#region Fields #region Fields
private const string DummyNodeText = "VLN_DUMMY_NODE"; private const string DummyNodeText = "VLN_DUMMY_NODE";
private const int MaxNumSearchRecords = 1000; private const int MaxNumSearchRecords = 1000;
// B2019-161 When tracking timing time this action // B2019-161 When tracking timing time this action
private static VolianTimer _timeActivity = new VolianTimer("DisplayRO MyRTB_SelectionChanged", 117); private static readonly VolianTimer _timeActivity = new VolianTimer("DisplayRO MyRTB_SelectionChanged", 117);
private static Regex _regExGetNumber = new Regex(@"^ *[+-]?[.,0-9/]+(E[+-]?[0-9]+)?"); private static readonly Regex _regExGetNumber = new Regex(@"^ *[+-]?[.,0-9/]+(E[+-]?[0-9]+)?");
private static UserInfo _myUserInfo = null; private static UserInfo _myUserInfo = null;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Timer Not ReadOnly")]
private Timer _searchTimer = null; private Timer _searchTimer = null;
private string _lastSearchValue = string.Empty;
private ProgressBarItem _progressBar; private ProgressBarItem _progressBar;
private DisplayTabControl _tabControl; private DisplayTabControl _tabControl;
private StepRTB _myRTB; private StepRTB _myRTB;
private string _selectedRoidBeforeRoEditor = null;
private ROFstInfo _myROFST; private ROFstInfo _myROFST;
private DocVersionInfo _docVersionInfo; private DocVersionInfo _docVersionInfo;
@@ -51,12 +43,9 @@ namespace Volian.Controls.Library
private int? _currDocVersionID = null; private int? _currDocVersionID = null;
private RoUsageInfo _curROLink; private RoUsageInfo _curROLink;
private E_ROValueType _curROTypeFilter = E_ROValueType.All;
private ROFSTLookup.rochild selectedChld; private ROFSTLookup.rochild selectedChld;
private DisplayTags displayTags;
#endregion #endregion
@@ -286,15 +275,17 @@ namespace Volian.Controls.Library
if (_searchTimer == null) if (_searchTimer == null)
{ {
_searchTimer = new Timer(); _searchTimer = new Timer
_searchTimer.Interval = 1000; {
Interval = 1000
};
_searchTimer.Tick += new EventHandler(SelectionTimer_Tick); _searchTimer.Tick += new EventHandler(SelectionTimer_Tick);
_searchTimer.Stop(); _searchTimer.Stop();
} }
// Initialize the DisplayTags object // Initialize the DisplayTags object
displayTags = new DisplayTags(); _ = new DisplayTags();
} }
@@ -405,9 +396,8 @@ namespace Volian.Controls.Library
{ {
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections // B2022-088: [JPR] Find Doc Ro button not working in Word Sections
// B2022-098: [JPR] ROs not being resolved in Word Sections // B2022-098: [JPR] ROs not being resolved in Word Sections
if (e.Node.Tag is ROFSTLookup.rochild) if (e.Node.Tag is ROFSTLookup.rochild chld)
{ {
ROFSTLookup.rochild chld = (ROFSTLookup.rochild)e.Node.Tag;
selectedChld = chld; selectedChld = chld;
if (chld.value != null) if (chld.value != null)
@@ -513,7 +503,7 @@ namespace Volian.Controls.Library
} }
else if (selectedChld.type == 4) // x/y plot else if (selectedChld.type == 4) // x/y plot
{ {
frmXYPlot plot = new frmXYPlot(selectedChld.appid + " - " + selectedChld.title, selectedChld.value); frmXYPlot plot = new frmXYPlot($"{selectedChld.appid} - {selectedChld.title}", selectedChld.value);
plot.Show(); plot.Show();
} }
} }
@@ -527,7 +517,7 @@ namespace Volian.Controls.Library
private void btnFindDocRO_Click(object sender, EventArgs e) private void btnFindDocRO_Click(object sender, EventArgs e)
{ {
// C2016-044: support click of the 'Find Doc RO' button: // C2016-044: support click of the 'Find Doc RO' button:
DisplayTabItem dti = (_tabControl == null) ? null : _tabControl.SelectedDisplayTabItem; DisplayTabItem dti = _tabControl?.SelectedDisplayTabItem;
if (dti != null && dti.MyDSOTabPanel != null) if (dti != null && dti.MyDSOTabPanel != null)
{ {
@@ -567,15 +557,12 @@ namespace Volian.Controls.Library
string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable
object obj = tvROFST.SelectedNode.Tag; object obj = tvROFST.SelectedNode.Tag;
if (obj is ROFSTLookup.rochild) if (obj is ROFSTLookup.rochild roch)
{ {
ROFSTLookup.rochild roch = (ROFSTLookup.rochild)obj; string args = $"\"{MyROFST.MyRODb.FolderPath}\" {roch.roid.Substring(0, 12).ToLower()}";
_selectedRoidBeforeRoEditor = roch.roid;
string args = "\"" + MyROFST.MyRODb.FolderPath + "\" " + roch.roid.Substring(0,12).ToLower();
// C2017-003: ro data in sql server, check for sql connection string // C2017-003: ro data in sql server, check for sql connection string
if (MyROFST.MyRODb.DBConnectionString != "cstring") args = args + " \"" + MyROFST.MyRODb.DBConnectionString + "\""; if (MyROFST.MyRODb.DBConnectionString != "cstring") args = $"{args} \"{MyROFST.MyRODb.DBConnectionString}\"";
// C2021-026 pass in Parent/Child information (list of the children) // C2021-026 pass in Parent/Child information (list of the children)
// B2022-019 look at all DocVersions to find ParentChild information // B2022-019 look at all DocVersions to find ParentChild information
@@ -589,7 +576,7 @@ namespace Volian.Controls.Library
DocVersionConfig dvc = dvi.DocVersionConfig; DocVersionConfig dvc = dvi.DocVersionConfig;
if (dvc != null && dvc.Unit_Name != "" && dvc.Unit_Count > 1) // B2021-089 only pass in applicability info if defined for more than one unit if (dvc != null && dvc.Unit_Name != "" && dvc.Unit_Count > 1) // B2021-089 only pass in applicability info if defined for more than one unit
{ {
args += " \"PC=" + dvc.Unit_Name + "\""; args += $" \"PC={dvc.Unit_Name}\"";
break; break;
} }
} }
@@ -703,8 +690,10 @@ namespace Volian.Controls.Library
{ {
ROFSTLookup.rodbi db = dbs[i]; ROFSTLookup.rodbi db = dbs[i];
TreeNode tn = new TreeNode(db.dbiTitle); TreeNode tn = new TreeNode(db.dbiTitle)
tn.Tag = db; {
Tag = db
};
tvROFST.Nodes.Add(tn); tvROFST.Nodes.Add(tn);
AddDummyGroup(db, tn); AddDummyGroup(db, tn);
@@ -773,8 +762,6 @@ namespace Volian.Controls.Library
tvROFST.Nodes.Remove(unitInfoNode); tvROFST.Nodes.Remove(unitInfoNode);
} }
_curROTypeFilter = _roTypeFilter;
return updatedROs; return updatedROs;
} }
@@ -790,11 +777,9 @@ namespace Volian.Controls.Library
if (match1.Success && !match1.Value.Contains("/") && match2.Success && !match2.Value.Contains("/")) // Compare the numeric value? if (match1.Success && !match1.Value.Contains("/") && match2.Success && !match2.Value.Contains("/")) // Compare the numeric value?
{ {
double dbl1;
double dbl2;
//B2017-232 changed from Parse to TryParse. AEP had figure title that had a number containing two periods which caused Parse to error? //B2017-232 changed from Parse to TryParse. AEP had figure title that had a number containing two periods which caused Parse to error?
if (double.TryParse(match1.ToString(), out dbl1) && double.TryParse(match2.ToString(), out dbl2)) if (double.TryParse(match1.ToString(), out double dbl1) && double.TryParse(match2.ToString(), out double dbl2))
{ {
if (dbl1 != dbl2) //B2021-144 if the numerical is identical default to the string comparison? if (dbl1 != dbl2) //B2021-144 if the numerical is identical default to the string comparison?
return dbl1 > dbl2; return dbl1 > dbl2;
@@ -817,15 +802,13 @@ namespace Volian.Controls.Library
//object tag = tn.Tag; //object tag = tn.Tag;
ROFSTLookup.rochild[] children = null; ROFSTLookup.rochild[] children = null;
if (tn.Tag is ROFSTLookup.rodbi) if (tn.Tag is ROFSTLookup.rodbi db)
{ {
ROFSTLookup.rodbi db = (ROFSTLookup.rodbi)tn.Tag;
MyROFSTLookup.LoadChildren(ref db); MyROFSTLookup.LoadChildren(ref db);
children = db.children; children = db.children;
} }
else if (tn.Tag is ROFSTLookup.rochild) else if (tn.Tag is ROFSTLookup.rochild ch)
{ {
ROFSTLookup.rochild ch = (ROFSTLookup.rochild)tn.Tag;
MyROFSTLookup.LoadChildren(ref ch); MyROFSTLookup.LoadChildren(ref ch);
children = ch.children; children = ch.children;
} }
@@ -864,8 +847,10 @@ namespace Volian.Controls.Library
if (roc.value == null) if (roc.value == null)
{ {
tmp = new TreeNode(roc.title); tmp = new TreeNode(roc.title)
tmp.Tag = roc; {
Tag = roc
};
int index = FindIndex(tn.Nodes, tmp.Text); int index = FindIndex(tn.Nodes, tmp.Text);
tn.Nodes.Insert(index, tmp); tn.Nodes.Insert(index, tmp);
@@ -876,8 +861,10 @@ namespace Volian.Controls.Library
else else
{ {
tmp = new TreeNode(roc.title); tmp = new TreeNode(roc.title)
tmp.Tag = roc; {
Tag = roc
};
if (tmp.Text.IndexOf("\\u") > -1) // RO Editor add symbols C2022 - 003 if (tmp.Text.IndexOf("\\u") > -1) // RO Editor add symbols C2022 - 003
{ {
@@ -912,7 +899,7 @@ namespace Volian.Controls.Library
// Clean-up Roid if necessary // Clean-up Roid if necessary
roid = ROFSTLookup.FormatRoidKey(roid); roid = ROFSTLookup.FormatRoidKey(roid);
bool multValSel = (roid.Length == 16) ? true : false; bool multValSel = (roid.Length == 16);
string db = roid.Substring(0, 4); string db = roid.Substring(0, 4);
int dbiID = MyROFSTLookup.GetRODatabaseTitleIndex(roid); int dbiID = MyROFSTLookup.GetRODatabaseTitleIndex(roid);
@@ -941,7 +928,7 @@ namespace Volian.Controls.Library
if (roid.StartsWith("FFFF")) if (roid.StartsWith("FFFF"))
dbNode = tvROFST.Nodes.Cast<TreeNode>().Where(x => (x.Tag.Equals(null)) && (x.Text.Equals("Unit Information"))).FirstOrDefault(); dbNode = tvROFST.Nodes.Cast<TreeNode>().Where(x => (x.Tag.Equals(null)) && (x.Text.Equals("Unit Information"))).FirstOrDefault();
else else
dbNode = tvROFST.Nodes.Cast<TreeNode>().Where(x => (x.Tag is ROFSTLookup.rodbi) && ((ROFSTLookup.rodbi)x.Tag).dbiID == dbiID).FirstOrDefault(); dbNode = tvROFST.Nodes.Cast<TreeNode>().Where(x => (x.Tag is ROFSTLookup.rodbi rodbi) && rodbi.dbiID == dbiID).FirstOrDefault();
if (dbNode != null) if (dbNode != null)
{ {
@@ -957,7 +944,7 @@ namespace Volian.Controls.Library
LoadChildren(tnExpand); LoadChildren(tnExpand);
tnExpand.Expand(); tnExpand.Expand();
TreeNode chldNode = tnExpand.Nodes.Cast<TreeNode>().Where(x => (x.Tag is ROFSTLookup.rochild) && ((ROFSTLookup.rochild)x.Tag).ID == citm).FirstOrDefault(); TreeNode chldNode = tnExpand.Nodes.Cast<TreeNode>().FirstOrDefault(x => (x.Tag is ROFSTLookup.rochild rochild) && rochild.ID == citm);
if (chldNode != null) if (chldNode != null)
{ {
tnExpand = chldNode; tnExpand = chldNode;
@@ -1009,10 +996,9 @@ namespace Volian.Controls.Library
Object obj = tvROFST.SelectedNode.Tag; Object obj = tvROFST.SelectedNode.Tag;
if (obj is ROFSTLookup.rochild) if (obj is ROFSTLookup.rochild roc)
{ {
ROFSTLookup.rochild roc = (ROFSTLookup.rochild)obj; DisplayTabItem dti = TabControl.SelectedDisplayTabItem;
DisplayTabItem dti = TabControl.SelectedDisplayTabItem; //.OpenItem(_ItemInfo); // open the corresponding procedure text
if (dti.MyDSOTabPanel != null) // A Word Document tab is the active tab if (dti.MyDSOTabPanel != null) // A Word Document tab is the active tab
{ {
@@ -1020,10 +1006,7 @@ namespace Volian.Controls.Library
// Insert the RO text at the current cursor position in the word document // Insert the RO text at the current cursor position in the word document
// NOTE: assuming any type of RO can be put in an Accessory (MSWord) Document // NOTE: assuming any type of RO can be put in an Accessory (MSWord) Document
if (dti.MyDSOTabPanel != null) dti.MyDSOTabPanel?.InsertText(accPageID);
{
dti.MyDSOTabPanel.InsertText(accPageID);
}
} }
else if (MyRTB != null) // a Procedure Steps section tab is active else if (MyRTB != null) // a Procedure Steps section tab is active
{ {
@@ -1125,12 +1108,9 @@ namespace Volian.Controls.Library
string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable
Object obj = tvROFST.SelectedNode.Tag; Object obj = tvROFST.SelectedNode.Tag;
if (obj is ROFSTLookup.rochild) if (obj is ROFSTLookup.rochild roc)
{ {
ROFSTLookup.rochild roc = (ROFSTLookup.rochild)obj; string args = $"\"{_myROFST.MyRODb.FolderPath}\" {roc.roid.ToLower()}";
_selectedRoidBeforeRoEditor = roc.roid;
string args = "\"" + _myROFST.MyRODb.FolderPath + "\" " + roc.roid.ToLower();
if (!Directory.Exists(_myROFST.MyRODb.FolderPath)) if (!Directory.Exists(_myROFST.MyRODb.FolderPath))
{ {
@@ -1139,7 +1119,7 @@ namespace Volian.Controls.Library
} }
// C2017-003: ro data in sql server, check for sql connection string // C2017-003: ro data in sql server, check for sql connection string
if (_myROFST.MyRODb.DBConnectionString != "cstring") args = args + " \"" + _myROFST.MyRODb.DBConnectionString + "\""; if (_myROFST.MyRODb.DBConnectionString != "cstring") args = $"{args} \"{_myROFST.MyRODb.DBConnectionString}\"";
// C2021-026 pass in Parent/Child information (list of the children) // C2021-026 pass in Parent/Child information (list of the children)
// B2022-019 look at all DocVersions to find ParentChild information // B2022-019 look at all DocVersions to find ParentChild information
@@ -1153,7 +1133,7 @@ namespace Volian.Controls.Library
if (jdvc != null && jdvc.Unit_Name != "" && jdvc.Unit_Count > 1) // B2021-089 only pass in applicability info if defined for more than one unit if (jdvc != null && jdvc.Unit_Name != "" && jdvc.Unit_Count > 1) // B2021-089 only pass in applicability info if defined for more than one unit
{ {
args += " \"PC=" + jdvc.Unit_Name + "\""; args += $" \"PC={jdvc.Unit_Name}\"";
break; break;
} }
} }
@@ -1197,7 +1177,6 @@ namespace Volian.Controls.Library
lbFound.DataSource = null; lbFound.DataSource = null;
lbFound.Visible = false; lbFound.Visible = false;
_lastSearchValue = searchValue;
} }
else if (searchValue.Contains("#Link:ReferencedObject")) // RO Link (roid) else if (searchValue.Contains("#Link:ReferencedObject")) // RO Link (roid)
{ {
@@ -1219,7 +1198,6 @@ namespace Volian.Controls.Library
lbFound.DataSource = null; lbFound.DataSource = null;
lbFound.Visible = false; lbFound.Visible = false;
_lastSearchValue = searchValue;
} }
else // if (searchValue != _lastSearchValue) else // if (searchValue != _lastSearchValue)
{ {
@@ -1248,12 +1226,10 @@ namespace Volian.Controls.Library
lbFound.Visible = false; lbFound.Visible = false;
} }
_lastSearchValue = searchValue;
} }
} }
else else
{ {
_lastSearchValue = string.Empty;
lbFound.DataSource = null; lbFound.DataSource = null;
lbFound.Visible = false; lbFound.Visible = false;
} }
+140 -253
View File
@@ -1,15 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using DevComponents.DotNetBar; using DevComponents.DotNetBar;
using DevComponents.AdvTree; using DevComponents.AdvTree;
using System.Text.RegularExpressions;
using Volian.Base.Library; using Volian.Base.Library;
@@ -23,8 +19,7 @@ namespace Volian.Controls.Library
private void OnPrintRequest(DisplayReportsEventArgs args) private void OnPrintRequest(DisplayReportsEventArgs args)
{ {
if (PrintRequest != null) PrintRequest?.Invoke(this, args);
PrintRequest(this, args);
} }
#endregion #endregion
@@ -34,16 +29,17 @@ namespace Volian.Controls.Library
// B2022-026 RO Memeory reduction logic change - defined dummy node text variable to ensure consistancy // B2022-026 RO Memeory reduction logic change - defined dummy node text variable to ensure consistancy
private const string DummyNodeText = "VLN_DUMMY_NODE"; private const string DummyNodeText = "VLN_DUMMY_NODE";
#pragma warning disable IDE0044 // Add readonly modifier
private List<DocVersionInfo> lstCheckedDocVersions = new List<DocVersionInfo>(); private List<DocVersionInfo> lstCheckedDocVersions = new List<DocVersionInfo>();
private List<object> lstCheckedROs = new List<object>(); private List<object> lstCheckedROs = new List<object>();
private List<ItemInfoList> lstReportResults = new List<ItemInfoList>();
private List<string> ROList = new List<string>(); private List<string> ROList = new List<string>();
private List<object> lstROObj = new List<object>(); #pragma warning restore IDE0044 // Add readonly modifier
private int _MyRODbID; private int _MyRODbID;
private DocVersionInfo _MyDocVersion; private DocVersionInfo _MyDocVersion;
private ROFSTLookup _MyROFSTLookup; private ROFSTLookup _MyROFSTLookup;
private ItemInfoList _ReportResult; private ItemInfoList _ReportResult;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private Dictionary<string, string> AccIDROIDdic = new Dictionary<string, string>(); private Dictionary<string, string> AccIDROIDdic = new Dictionary<string, string>();
static int blankKeyCnt = 0; static int blankKeyCnt = 0;
@@ -104,10 +100,8 @@ namespace Volian.Controls.Library
set set
{ {
if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface
//if (!Visible) return; // don't reset anything if the form is invisible.
_MyROFSTLookup = value; // define the tree nodes based on this rofst _MyROFSTLookup = value; // define the tree nodes based on this rofst
advTreeROFillIn(true); advTreeROFillIn();
//LoadROComboTree();
} }
} }
@@ -154,7 +148,7 @@ namespace Volian.Controls.Library
tabROReports.PerformClick(); tabROReports.PerformClick();
} }
public void advTreeROFillIn(bool blSeachTabClicked) public void advTreeROFillIn()
{ {
DevComponents.AdvTree.Node topnode = null; DevComponents.AdvTree.Node topnode = null;
advTreeRO.Nodes.Clear(); advTreeRO.Nodes.Clear();
@@ -168,10 +162,12 @@ namespace Volian.Controls.Library
advTreeRO.AfterCollapse -= new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse); advTreeRO.AfterCollapse -= new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse);
advTreeRO.AfterCollapse += new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse); advTreeRO.AfterCollapse += new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse);
topnode = new DevComponents.AdvTree.Node(); topnode = new DevComponents.AdvTree.Node
topnode.Text = "All Referenced Objects"; {
topnode.Tag = null; Text = "All Referenced Objects",
topnode.CheckBoxVisible = true; Tag = null,
CheckBoxVisible = true
};
advTreeRO.Nodes.Add(topnode); advTreeRO.Nodes.Add(topnode);
@@ -194,7 +190,7 @@ namespace Volian.Controls.Library
} }
} }
public void advTreeProcSetsFillIn(bool blSeachTabClicked) public void advTreeProcSetsFillIn()
{ {
DevComponents.AdvTree.Node topnode = null; DevComponents.AdvTree.Node topnode = null;
int cntnd = 0; int cntnd = 0;
@@ -203,40 +199,28 @@ namespace Volian.Controls.Library
int fiCount = fi.ChildFolderCount; int fiCount = fi.ChildFolderCount;
advTreeProcSets.Nodes.Clear(); advTreeProcSets.Nodes.Clear();
lstCheckedDocVersions.Clear(); lstCheckedDocVersions.Clear();
topnode = new DevComponents.AdvTree.Node(); topnode = new DevComponents.AdvTree.Node
topnode.Text = "Available Procedure Sets"; {
topnode.Tag = fi; Text = "Available Procedure Sets",
Tag = fi
};
advTreeProcSets.Nodes.Add(topnode); advTreeProcSets.Nodes.Add(topnode);
//advTreeProcSets.AfterNodeInsert += new TreeNodeCollectionEventHandler(advTreeProcSets_AfterNodeInsert);
foreach (FolderInfo fic in fi.SortedChildFolders) foreach (FolderInfo fic in fi.SortedChildFolders)
{ {
DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node(); DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node
newnode.Text = fic.ToString(); {
newnode.Tag = fic; Text = fic.ToString(),
Tag = fic
};
//int tmp;
//if (topnode == null)
//{
// newnode.Text = "Available Procedure Sets";
// tmp = advTreeProcSets.Nodes.Add(newnode);
// topnode = newnode;
//}
//else
//{
// newnode.Selectable = true;
// newnode.CheckBoxAlignment = DevComponents.AdvTree.eCellPartAlignment.NearCenter;
// newnode.CheckBoxStyle = eCheckBoxStyle.CheckBox;
// newnode.CheckBoxThreeState = false;
// newnode.CheckBoxVisible = true;
// tmp = topnode.Nodes.Add(newnode);
//}
cntnd++; cntnd++;
if (fic.ChildFolderCount > 0 || fic.FolderDocVersionCount > 0) // allow for '+' for tree expansion if (fic.ChildFolderCount > 0 || fic.FolderDocVersionCount > 0) // allow for '+' for tree expansion
{ {
DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node(); DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node
tnt.Text = DummyNodeText; {
Text = DummyNodeText
};
newnode.Nodes.Add(tnt); newnode.Nodes.Add(tnt);
topnode.Nodes.Add(newnode); topnode.Nodes.Add(newnode);
} }
@@ -247,8 +231,10 @@ namespace Volian.Controls.Library
{ {
cntnd++; cntnd++;
fi = Mydocversion.MyFolder; fi = Mydocversion.MyFolder;
topnode = new DevComponents.AdvTree.Node(); topnode = new DevComponents.AdvTree.Node
topnode.Text = fi.ToString(); {
Text = fi.ToString()
};
advTreeProcSets.Nodes.Add(topnode); advTreeProcSets.Nodes.Add(topnode);
topnode.Tag = fi; topnode.Tag = fi;
} }
@@ -262,8 +248,6 @@ namespace Volian.Controls.Library
else else
advTreeProcSets.Nodes[0].SelectedCell = advTreeProcSets.Nodes[0].Cells[0]; // select the first node - fixes cosmetic problem advTreeProcSets.Nodes[0].SelectedCell = advTreeProcSets.Nodes[0].Cells[0]; // select the first node - fixes cosmetic problem
//if (blSeachTabClicked)
// cbxTextSearchText.Focus(); // set initial focus to enter search text
} }
#endregion #endregion
@@ -272,12 +256,8 @@ namespace Volian.Controls.Library
private void GenerateAccIDSortedROList() private void GenerateAccIDSortedROList()
{ {
//Dictionary<string, string> AccIDROIDdic = new Dictionary<string, string>();
List<string> AccPgIDsList = new List<string>(); List<string> AccPgIDsList = new List<string>();
AccIDROIDdic.Clear(); AccIDROIDdic.Clear();
string rtnStr = "";
ROFSTLookup.rochild[] chld = null;
ROFSTLookup.rochild ch; ROFSTLookup.rochild ch;
ROList.Clear(); ROList.Clear();
@@ -287,7 +267,7 @@ namespace Volian.Controls.Library
{ {
foreach (ROFSTLookup.rodbi rodbi in _MyROFSTLookup.GetRODatabaseList(true)) foreach (ROFSTLookup.rodbi rodbi in _MyROFSTLookup.GetRODatabaseList(true))
{ {
rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", rodbi.dbiID.ToString("X4")); string rtnStr = $"{_MyRODbID}:{string.Format("{0}", rodbi.dbiID.ToString("X4"))}";
if (rodbi.children != null) if (rodbi.children != null)
{ {
@@ -304,9 +284,8 @@ namespace Volian.Controls.Library
continue; continue;
} }
else if (rolkup is ROFSTLookup.rodbi) else if (rolkup is ROFSTLookup.rodbi rodbi)
{ {
ROFSTLookup.rodbi rodbi = (ROFSTLookup.rodbi)rolkup;
//Try to lazy load the children - B2022-026 RO Memory Reduction code //Try to lazy load the children - B2022-026 RO Memory Reduction code
if (rodbi.children == null || rodbi.children.Length <= 0) if (rodbi.children == null || rodbi.children.Length <= 0)
@@ -321,13 +300,13 @@ namespace Volian.Controls.Library
} }
else else
{ {
ROList.Add(_MyRODbID.ToString() + ":" + string.Format("{0}", rodbi.dbiID.ToString("X4"))); ROList.Add($"{_MyRODbID}:{string.Format("{0}", rodbi.dbiID.ToString("X4"))}");
} }
} }
else if (rolkup is ROFSTLookup.rochild) else if (rolkup is ROFSTLookup.rochild rochild)
{ {
ch = (ROFSTLookup.rochild)rolkup; ch = rochild;
chld = ch.children; ROFSTLookup.rochild[] chld = ch.children;
//Try to lazy load the children - B2022-026 RO Memory Reduction code //Try to lazy load the children - B2022-026 RO Memory Reduction code
if (ch.children == null || ch.children.Length <= 0) if (ch.children == null || ch.children.Length <= 0)
@@ -359,13 +338,13 @@ namespace Volian.Controls.Library
private void PutROChildrenInDictionary(string rodbidPrefix, object roObj) private void PutROChildrenInDictionary(string rodbidPrefix, object roObj)
{ {
ROFSTLookup.rochild chld = (ROFSTLookup.rochild)roObj; ROFSTLookup.rochild chld = (ROFSTLookup.rochild)roObj;
string rtnstr = rodbidPrefix;// "";
string keystr = ((chld.appid == "") ? GetNextBlankKey() : chld.appid) + chld.roid.Substring(0, 4); string keystr = ((chld.appid == "") ? GetNextBlankKey() : chld.appid) + chld.roid.Substring(0, 4);
//Try to lazy load the children - B2022-026 RO Memory Reduction //Try to lazy load the children - B2022-026 RO Memory Reduction
if (chld.children == null || chld.children.Length <= 0) if (chld.children == null || chld.children.Length <= 0)
chld.children = MyROFSTLookup.GetRoChildrenByRoid(chld.roid, true); chld.children = MyROFSTLookup.GetRoChildrenByRoid(chld.roid, true);
string rtnstr;
// If still no children - B2022-026 RO Memory Reduction code - check children length // If still no children - B2022-026 RO Memory Reduction code - check children length
if (chld.children == null || chld.children.Length <= 0) // get a single ROID if (chld.children == null || chld.children.Length <= 0) // get a single ROID
{ {
@@ -403,7 +382,7 @@ namespace Volian.Controls.Library
if (AccIDROIDdic.ContainsKey(keystr)) // For duplicates, append the parent title (B2017-011) so adding to dictionary doesn't crash. if (AccIDROIDdic.ContainsKey(keystr)) // For duplicates, append the parent title (B2017-011) so adding to dictionary doesn't crash.
{ {
keystr = keystr + "|" + chld.title; keystr = $"{keystr}|{chld.title}";
} }
AccIDROIDdic.Add(keystr, rtnstr); AccIDROIDdic.Add(keystr, rtnstr);
@@ -416,7 +395,6 @@ namespace Volian.Controls.Library
private void GenerateROList() private void GenerateROList()
{ {
string rtnStr = ""; string rtnStr = "";
ROFSTLookup.rochild[] chld = null;
ROFSTLookup.rochild ch; ROFSTLookup.rochild ch;
ROList.Clear(); ROList.Clear();
@@ -427,26 +405,26 @@ namespace Volian.Controls.Library
// B2022-026 RO Memory Reduction code - added flag to load all children // B2022-026 RO Memory Reduction code - added flag to load all children
foreach (ROFSTLookup.rodbi rodbi in _MyROFSTLookup.GetRODatabaseList(true)) foreach (ROFSTLookup.rodbi rodbi in _MyROFSTLookup.GetRODatabaseList(true))
{ {
rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", rodbi.dbiID.ToString("X4")); rtnStr = $"{_MyRODbID}:{string.Format("{0}", rodbi.dbiID.ToString("X4"))}";
ROList.Add(rtnStr); ROList.Add(rtnStr);
} }
continue; continue;
} }
else if (rolkup is ROFSTLookup.rodbi) else if (rolkup is ROFSTLookup.rodbi rodbi)
{ {
rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", ((ROFSTLookup.rodbi)rolkup).dbiID.ToString("X4")); rtnStr = $"{_MyRODbID}:{string.Format("{0}", rodbi.dbiID.ToString("X4"))}";
} }
else if (rolkup is ROFSTLookup.rochild) else if (rolkup is ROFSTLookup.rochild rochild)
{ {
ch = (ROFSTLookup.rochild)rolkup; ch = rochild;
//Try to lazy load the children - B2022-026 RO Memory Reduction code //Try to lazy load the children - B2022-026 RO Memory Reduction code
if (ch.children == null || ch.children.Length <= 0) if (ch.children == null || ch.children.Length <= 0)
ch.children = MyROFSTLookup.GetRoChildrenByRoid(ch.roid, true); ch.children = MyROFSTLookup.GetRoChildrenByRoid(ch.roid, true);
chld = ch.children; ROFSTLookup.rochild[] chld = ch.children;
rtnStr = _MyRODbID.ToString() + ":" + GetROChildren(rolkup).TrimEnd(','); // GetROChildren(rolkup).TrimEnd(',') grabs the children of the selected item rtnStr = $"{_MyRODbID}:{GetROChildren(rolkup).TrimEnd(',')}"; // GetROChildren(rolkup).TrimEnd(',') grabs the children of the selected item
} }
ROList.Add(rtnStr); ROList.Add(rtnStr);
@@ -603,7 +581,7 @@ namespace Volian.Controls.Library
labelX1.Visible = cmbxROUsageSort.Visible = cbxROUsage.Checked; labelX1.Visible = cmbxROUsageSort.Visible = cbxROUsage.Checked;
// reset the RO tree and clear anything that was selected // reset the RO tree and clear anything that was selected
advTreeROFillIn(true); advTreeROFillIn();
lstCheckedROs.Clear(); lstCheckedROs.Clear();
cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked; cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked;
@@ -689,7 +667,6 @@ namespace Volian.Controls.Library
return ""; return "";
} }
//string roapp = Environment.GetEnvironmentVariable("roapp");
string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable
if (roapp == null) if (roapp == null)
{ {
@@ -703,7 +680,6 @@ namespace Volian.Controls.Library
return ""; return "";
} }
//string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" " + "\"" + ROList + "\"";
if (!Directory.Exists(MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath)) if (!Directory.Exists(MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath))
{ {
MessageBox.Show(string.Format("RO Database directory does not exist: {0}", MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath)); MessageBox.Show(string.Format("RO Database directory does not exist: {0}", MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath));
@@ -711,14 +687,14 @@ namespace Volian.Controls.Library
} }
string cmpRptExePath = roapp.Substring(0, roapp.LastIndexOf("\\")) + "\\CmpRpt.exe "; string cmpRptExePath = roapp.Substring(0, roapp.LastIndexOf("\\")) + "\\CmpRpt.exe ";
roDataFile = MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\\" + roDataFile; roDataFile = $"{MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath}\\{roDataFile}";
try try
{ {
if (File.Exists(roDataFile)) File.Delete(roDataFile); if (File.Exists(roDataFile)) File.Delete(roDataFile);
Application.DoEvents(); Application.DoEvents();
string fname = VlnSettings.TemporaryFolder + "\\ROCompleteRprt.txt"; string fname = $"{VlnSettings.TemporaryFolder}\\ROCompleteRprt.txt";
FileInfo fi = new FileInfo(fname); FileInfo fi = new FileInfo(fname);
using (StreamWriter sw = fi.CreateText()) using (StreamWriter sw = fi.CreateText())
{ {
@@ -726,9 +702,9 @@ namespace Volian.Controls.Library
sw.Close(); sw.Close();
} }
string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" \"/f=" + fname + "\""; string roloc = $"\"{MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath}\" \"/f={fname}\"";
// C2017-003: ro data in sql server, check for sql connection string // C2017-003: ro data in sql server, check for sql connection string
if (MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString != "cstring") roloc = roloc + " \"/sql=" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString + "\""; if (MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString != "cstring") roloc = $"{roloc} \"/sql={MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString}\"";
// C2021-026 pass in Parent/Child information (list of the children) // C2021-026 pass in Parent/Child information (list of the children)
// B2022-019 look at all DocVersions to find ParentChild information // B2022-019 look at all DocVersions to find ParentChild information
@@ -736,9 +712,8 @@ namespace Volian.Controls.Library
DocVersionInfoList dvil = DocVersionInfoList.Get(); DocVersionInfoList dvil = DocVersionInfoList.Get();
foreach (DocVersionInfo dvi in dvil) foreach (DocVersionInfo dvi in dvil)
{ {
DocVersionConfig dvc = dvi.DocVersionConfig as DocVersionConfig; if (dvi.DocVersionConfig is DocVersionConfig dvc && dvc.Unit_Name != "" && dvc.Unit_Count > 1) // B2021-089 only pass in applicability info if defined for more than one unit
if (dvc != null && dvc.Unit_Name != "" && dvc.Unit_Count > 1) // B2021-089 only pass in applicability info if defined for more than one unit roloc += $" \"/PC={dvc.Unit_Name}\"";
roloc += " \"/PC=" + dvc.Unit_Name + "\"";
break; break;
} }
@@ -752,7 +727,7 @@ namespace Volian.Controls.Library
while (ex.InnerException != null) while (ex.InnerException != null)
ex = ex.InnerException; ex = ex.InnerException;
string tmpmsg = ex.Message; string tmpmsg = ex.Message;
MessageBox.Show(tmpmsg, "RO Report Error: " + ex.GetType().Name); MessageBox.Show(tmpmsg, $"RO Report Error: {ex.GetType().Name}");
} }
return roDataFile; return roDataFile;
} }
@@ -827,19 +802,6 @@ namespace Volian.Controls.Library
#region (Procedure List) #region (Procedure List)
private DevComponents.AdvTree.Node NewAdvTreeNode(string nodetext, bool selectable, bool chxbxvisable)
{
DevComponents.AdvTree.Node newnode;
newnode = new DevComponents.AdvTree.Node();
newnode.Text = nodetext;
newnode.Selectable = selectable;
newnode.CheckBoxAlignment = DevComponents.AdvTree.eCellPartAlignment.NearCenter;
newnode.CheckBoxStyle = eCheckBoxStyle.CheckBox;
newnode.CheckBoxThreeState = false;
newnode.CheckBoxVisible = chxbxvisable;
return newnode;
}
private void advTreeProcSets_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e) private void advTreeProcSets_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e)
{ {
DevComponents.AdvTree.Node par = e.Node; DevComponents.AdvTree.Node par = e.Node;
@@ -856,14 +818,18 @@ namespace Volian.Controls.Library
{ {
foreach (FolderInfo fic in fi.SortedChildFolders) foreach (FolderInfo fic in fi.SortedChildFolders)
{ {
DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node(); DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node
newnode.Text = fic.ToString(); {
newnode.Tag = fic; Text = fic.ToString(),
Tag = fic
};
par.Nodes.Add(newnode); par.Nodes.Add(newnode);
if (fic.HasChildren) // allow for '+' for tree expansion if (fic.HasChildren) // allow for '+' for tree expansion
{ {
DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node(); DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node
tnt.Text = DummyNodeText; {
Text = DummyNodeText
};
newnode.Nodes.Add(tnt); newnode.Nodes.Add(tnt);
} }
} }
@@ -872,14 +838,16 @@ namespace Volian.Controls.Library
{ {
foreach (DocVersionInfo dv in fi.FolderDocVersions) foreach (DocVersionInfo dv in fi.FolderDocVersions)
{ {
DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node(); DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node
newnode.Text = dv.ToString(); {
newnode.Tag = dv; Text = dv.ToString(),
newnode.Selectable = true; Tag = dv,
newnode.CheckBoxAlignment = DevComponents.AdvTree.eCellPartAlignment.NearCenter; Selectable = true,
newnode.CheckBoxStyle = eCheckBoxStyle.CheckBox; CheckBoxAlignment = DevComponents.AdvTree.eCellPartAlignment.NearCenter,
newnode.CheckBoxThreeState = false; CheckBoxStyle = eCheckBoxStyle.CheckBox,
newnode.CheckBoxVisible = true; CheckBoxThreeState = false,
CheckBoxVisible = true
};
par.Nodes.Add(newnode); par.Nodes.Add(newnode);
} }
} }
@@ -913,30 +881,15 @@ namespace Volian.Controls.Library
{ {
if (lstCheckedDocVersions.Count == 0) if (lstCheckedDocVersions.Count == 0)
Mydocversion = null; Mydocversion = null;
// do this if either none, or more than one procedure set selected
//advTreeStepTypes.Nodes.Clear();
//lstCheckedStepTypes.Clear();
//lstCheckedStepTypesStr.Clear();
//Node newnode = new DevComponents.AdvTree.Node();
//newnode.Text = "....select a procedure set for types to appear...";
//advTreeStepTypes.Nodes.Add(newnode);
//buildStepTypePannelTitle();
} }
} }
//// Enable the RO combo list only if at least one procedure set node
//// is selected
//cmboTreeROs.Enabled = (lstCheckedDocVersions.Count > 0);
//gpFindROs.Enabled = cmboTreeROs.Enabled;
//SetupContextMenu();
//buildSetToSearchPanelTitle();
EnableOrDisablePrintButton(); EnableOrDisablePrintButton();
} }
private void advTreeProcSets_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e) private void advTreeProcSets_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
{ {
DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode; _ = advTreeProcSets.SelectedNode;
} }
private void advTreeProcSetsPreSelect() private void advTreeProcSetsPreSelect()
@@ -998,8 +951,10 @@ namespace Volian.Controls.Library
{ {
if (rodbi.children != null && rodbi.children.Length > 0) if (rodbi.children != null && rodbi.children.Length > 0)
{ {
DevComponents.AdvTree.Node tmp = new DevComponents.AdvTree.Node(); DevComponents.AdvTree.Node tmp = new DevComponents.AdvTree.Node
tmp.Text = DummyNodeText; {
Text = DummyNodeText
};
tn.Nodes.Add(tmp); tn.Nodes.Add(tmp);
} }
} }
@@ -1015,12 +970,9 @@ namespace Volian.Controls.Library
if (tn.HasChildNodes && tn.Nodes[0].Text != DummyNodeText) return; // already loaded. if (tn.HasChildNodes && tn.Nodes[0].Text != DummyNodeText) return; // already loaded.
if (tn.HasChildNodes && tn.Nodes[0].Text == DummyNodeText) tn.Nodes[0].Remove(); if (tn.HasChildNodes && tn.Nodes[0].Text == DummyNodeText) tn.Nodes[0].Remove();
object tag = tn.Tag; ROFSTLookup.rochild[] chld;
ROFSTLookup.rochild[] chld = null; if (tn.Tag is ROFSTLookup.rodbi db)
if (tn.Tag is ROFSTLookup.rodbi)
{ {
ROFSTLookup.rodbi db = (ROFSTLookup.rodbi)tn.Tag;
//Try to lazy load the children - B2022-026 RO Memory Reduction code //Try to lazy load the children - B2022-026 RO Memory Reduction code
if (db.children == null || db.children.Length <= 0) if (db.children == null || db.children.Length <= 0)
@@ -1028,9 +980,8 @@ namespace Volian.Controls.Library
chld = db.children; chld = db.children;
} }
else if (tn.Tag is ROFSTLookup.rochild) else if (tn.Tag is ROFSTLookup.rochild ch)
{ {
ROFSTLookup.rochild ch = (ROFSTLookup.rochild)tn.Tag;
//Try to lazy load the children - B2022-026 RO Memory Reduction code //Try to lazy load the children - B2022-026 RO Memory Reduction code
if (ch.children == null || ch.children.Length <= 0) if (ch.children == null || ch.children.Length <= 0)
@@ -1048,16 +999,14 @@ namespace Volian.Controls.Library
// B2022-026 RO Memory Reduction code - check child length // B2022-026 RO Memory Reduction code - check child length
if (chld != null && chld.Length > 0) if (chld != null && chld.Length > 0)
{ {
//ProgressBar_Initialize(chld.Length, tn.Text);
for (int i = 0; i < chld.Length; i++) for (int i = 0; i < chld.Length; i++)
{ {
//ProgressBar_SetValue(i);
DevComponents.AdvTree.Node tmp = null;
// Try to Lazy Load children - B2022-026 RO Memory Reduction code // Try to Lazy Load children - B2022-026 RO Memory Reduction code
if (chld[i].children == null || chld[i].children.Length <= 0) if (chld[i].children == null || chld[i].children.Length <= 0)
chld[i].children = MyROFSTLookup.GetRoChildrenByRoid(chld[i].roid, true); chld[i].children = MyROFSTLookup.GetRoChildrenByRoid(chld[i].roid, true);
Node tmp;
// if this is a group, i.e. type 0, add a dummy node // if this is a group, i.e. type 0, add a dummy node
if (chld[i].type == 0 && chld[i].children == null) if (chld[i].type == 0 && chld[i].children == null)
{ {
@@ -1067,22 +1016,28 @@ namespace Volian.Controls.Library
// B2023-094: don't crash if chld[i].children count is 0, signals an empty group // B2023-094: don't crash if chld[i].children count is 0, signals an empty group
else if (chld[i].value == null && (cbxROUsage.Checked || (chld[i].children != null && chld[i].children.Length > 0 && chld[i].children[0].ParentID != 0))) else if (chld[i].value == null && (cbxROUsage.Checked || (chld[i].children != null && chld[i].children.Length > 0 && chld[i].children[0].ParentID != 0)))
{ {
tmp = new DevComponents.AdvTree.Node(); tmp = new DevComponents.AdvTree.Node
tmp.Text = chld[i].title; {
tmp.Tag = chld[i]; Text = chld[i].title,
tmp.CheckBoxVisible = true; Tag = chld[i],
CheckBoxVisible = true
};
int index = FindIndex(tn.Nodes, tmp.Text); int index = FindIndex(tn.Nodes, tmp.Text);
tn.Nodes.Insert(index, tmp); tn.Nodes.Insert(index, tmp);
DevComponents.AdvTree.Node sub = new DevComponents.AdvTree.Node(); DevComponents.AdvTree.Node sub = new DevComponents.AdvTree.Node
sub.Text = DummyNodeText; {
Text = DummyNodeText
};
tmp.Nodes.Add(sub); tmp.Nodes.Add(sub);
} }
else else
{ {
tmp = new DevComponents.AdvTree.Node(); tmp = new DevComponents.AdvTree.Node
tmp.Text = chld[i].title; {
tmp.Tag = chld[i]; Text = chld[i].title,
tmp.CheckBoxVisible = true; Tag = chld[i],
CheckBoxVisible = true
};
int index = FindIndex(tn.Nodes, tmp.Text); int index = FindIndex(tn.Nodes, tmp.Text);
tn.Nodes.Insert(index, tmp); tn.Nodes.Insert(index, tmp);
} }
@@ -1093,12 +1048,11 @@ namespace Volian.Controls.Library
private void advTreeRO_AfterExpandorCollapse(object sender, AdvTreeNodeEventArgs e) private void advTreeRO_AfterExpandorCollapse(object sender, AdvTreeNodeEventArgs e)
{ {
Node bottomNode = BottomTreeNode(advTreeRO.Nodes); Node bottomNode = BottomTreeNode(advTreeRO.Nodes);
Node lastNode = advTreeRO.Nodes[advTreeRO.Nodes.Count - 1]; _ = advTreeRO.Nodes[advTreeRO.Nodes.Count - 1];
int top = advTreeRO.Nodes[0].Bounds.Top; int top = advTreeRO.Nodes[0].Bounds.Top;
int bottom = bottomNode.Bounds.Bottom + 5;
int hScrollBarHeight = advTreeRO.HScrollBar != null ? advTreeRO.HScrollBar.Height : 0; int hScrollBarHeight = advTreeRO.HScrollBar != null ? advTreeRO.HScrollBar.Height : 0;
bottom = bottomNode.Bounds.Bottom + 5; int bottom = bottomNode.Bounds.Bottom + 5;
advTreeRO.Size = new Size(advTreeRO.Size.Width, Math.Min(525, bottom - top + hScrollBarHeight)); advTreeRO.Size = new Size(advTreeRO.Size.Width, Math.Min(525, bottom - top + hScrollBarHeight));
if (advTreeRO.VScrollBar != null && bottom < advTreeRO.Size.Height) if (advTreeRO.VScrollBar != null && bottom < advTreeRO.Size.Height)
@@ -1106,8 +1060,7 @@ namespace Volian.Controls.Library
int yLookFor = (bottom - advTreeRO.Size.Height) + 2 * hScrollBarHeight; int yLookFor = (bottom - advTreeRO.Size.Height) + 2 * hScrollBarHeight;
Node topNode = FindTreeNodeAt(advTreeRO.Nodes, yLookFor); Node topNode = FindTreeNodeAt(advTreeRO.Nodes, yLookFor);
if (topNode != null) topNode?.EnsureVisible();
topNode.EnsureVisible();
} }
} }
@@ -1166,94 +1119,35 @@ namespace Volian.Controls.Library
{ {
#region Fields #region Fields
private string _ReportTitle;
private string _TypesSelected;
private ICollection<ItemInfo> _MyItemInfoList;
private bool _SortUsageByProcedure;
private string _RODataFile = "";
private bool _CompleteROReport = true;
private ROFSTLookup _rofstLookup;
private List<string> _ROListForReport;
private bool _IncludeMissingROs = true;
private bool _ConvertCaretToDelta = true;
private bool _IncludeEmptyROFields = true;
private string _PaperSize = "Letter";
#endregion #endregion
#region Properties #region Properties
public string ReportTitle public string ReportTitle { get; set; }
{
get { return _ReportTitle; }
set { _ReportTitle = value; }
}
public string TypesSelected public string TypesSelected { get; set; }
{
get { return _TypesSelected; }
set { _TypesSelected = value; }
}
public ICollection<ItemInfo> MyItemInfoList public ICollection<ItemInfo> MyItemInfoList { get; set; }
{
get { return _MyItemInfoList; }
set { _MyItemInfoList = value; }
}
public bool SortUsageByProcedure public bool SortUsageByProcedure { get; set; }
{
get { return _SortUsageByProcedure; }
set { _SortUsageByProcedure = value; }
}
public string RODataFile public string RODataFile { get; set; } = "";
{
get { return _RODataFile; }
set { _RODataFile = value; }
}
public bool CompleteROReport public bool CompleteROReport { get; set; } = true;
{
get { return _CompleteROReport; }
set { _CompleteROReport = value; }
}
public ROFSTLookup RofstLookup public ROFSTLookup RofstLookup { get; set; }
{
get { return _rofstLookup; }
set { _rofstLookup = value; }
}
public List<string> ROListForReport public List<string> ROListForReport { get; set; }
{
get { return _ROListForReport; }
set { _ROListForReport = value; }
}
public bool IncludeMissingROs public bool IncludeMissingROs { get; set; } = true;
{
get { return _IncludeMissingROs; }
set { _IncludeMissingROs = value; }
}
public bool ConvertCaretToDelta public bool ConvertCaretToDelta { get; set; } = true;
{
get { return _ConvertCaretToDelta; }
set { _ConvertCaretToDelta = value; }
}
public bool IncludeEmptyROFields public bool IncludeEmptyROFields { get; set; } = true;
{
get { return _IncludeEmptyROFields; }
set { _IncludeEmptyROFields = value; }
}
public string PaperSize // C2020-002 paper size is now set in the format files public string PaperSize // C2020-002 paper size is now set in the format files
{ { get; set; } = "Letter";
get { return _PaperSize; }
set { _PaperSize = value; }
}
#endregion #endregion
@@ -1270,12 +1164,12 @@ namespace Volian.Controls.Library
/// <param name="paperSize"></param> /// <param name="paperSize"></param>
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ICollection<ItemInfo> myItemInfoList, bool sortByProcedure, bool includeMissingROs, string paperSize) public DisplayReportsEventArgs(string reportTitle, string typesSelected, ICollection<ItemInfo> myItemInfoList, bool sortByProcedure, bool includeMissingROs, string paperSize)
{ {
_ReportTitle = reportTitle; ReportTitle = reportTitle;
_TypesSelected = typesSelected; TypesSelected = typesSelected;
_MyItemInfoList = myItemInfoList; MyItemInfoList = myItemInfoList;
_SortUsageByProcedure = sortByProcedure; SortUsageByProcedure = sortByProcedure;
_IncludeMissingROs = includeMissingROs; IncludeMissingROs = includeMissingROs;
_PaperSize = paperSize; // C2020-002 paper size is now set in the format files PaperSize = paperSize; // C2020-002 paper size is now set in the format files
} }
/// <summary> /// <summary>
@@ -1291,14 +1185,14 @@ namespace Volian.Controls.Library
/// <param name="paperSize"></param> /// <param name="paperSize"></param>
public DisplayReportsEventArgs(string reportTitle, string typesSelected, string roDataFile, ROFSTLookup rofstLookUp, bool completeROReport, bool convertCaretToDelta, bool includeEmptyROFields, string paperSize) public DisplayReportsEventArgs(string reportTitle, string typesSelected, string roDataFile, ROFSTLookup rofstLookUp, bool completeROReport, bool convertCaretToDelta, bool includeEmptyROFields, string paperSize)
{ {
_ReportTitle = reportTitle; ReportTitle = reportTitle;
_TypesSelected = typesSelected; TypesSelected = typesSelected;
_RODataFile = roDataFile; RODataFile = roDataFile;
_CompleteROReport = completeROReport; CompleteROReport = completeROReport;
_ConvertCaretToDelta = convertCaretToDelta; ConvertCaretToDelta = convertCaretToDelta;
_rofstLookup = rofstLookUp; RofstLookup = rofstLookUp;
_IncludeEmptyROFields = includeEmptyROFields; IncludeEmptyROFields = includeEmptyROFields;
_PaperSize = paperSize; // C2020-002 paper size is now set in the format files PaperSize = paperSize; // C2020-002 paper size is now set in the format files
} }
/// <summary> /// <summary>
@@ -1311,11 +1205,11 @@ namespace Volian.Controls.Library
/// <param name="paperSize"></param> /// <param name="paperSize"></param>
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ROFSTLookup rofstLookUp, List<string> roListForReport, string paperSize) public DisplayReportsEventArgs(string reportTitle, string typesSelected, ROFSTLookup rofstLookUp, List<string> roListForReport, string paperSize)
{ {
_ReportTitle = reportTitle; ReportTitle = reportTitle;
_TypesSelected = typesSelected; TypesSelected = typesSelected;
_rofstLookup = rofstLookUp; RofstLookup = rofstLookUp;
_ROListForReport = roListForReport; ROListForReport = roListForReport;
_PaperSize = paperSize; // C2020-002 paper size is now set in the format files PaperSize = paperSize; // C2020-002 paper size is now set in the format files
} }
#endregion #endregion
@@ -1334,13 +1228,13 @@ namespace Volian.Controls.Library
public List<string> GetList(string s1) public List<string> GetList(string s1)
{ {
List<string> SB1 = new List<string>(); List<string> SB1 = new List<string>();
string st1, st2, st3; string st1;
st1 = ""; st1 = "";
bool flag = char.IsDigit(s1[0]); bool flag = char.IsDigit(s1[0]);
foreach (char c in s1) foreach (char c in s1)
{ {
if (flag != char.IsDigit(c) || !(char.IsDigit(c) || char.IsLetter(c)))// || c == '\'') if (flag != char.IsDigit(c) || !(char.IsDigit(c) || char.IsLetter(c)))
{ {
if (st1 != "") if (st1 != "")
SB1.Add(st1); SB1.Add(st1);
@@ -1376,10 +1270,6 @@ namespace Volian.Controls.Library
{ {
return 0; return 0;
} }
int len1 = s1.Length;
int len2 = s2.Length;
int marker1 = 0;
int marker2 = 0;
// Walk through two the strings with two markers. // Walk through two the strings with two markers.
List<string> str1 = GetList(s1); List<string> str1 = GetList(s1);
@@ -1395,18 +1285,16 @@ namespace Volian.Controls.Library
str2.Add(""); str2.Add("");
} }
} }
int x1 = 0; int res = 0; int x2 = 0; string y2 = ""; int x1 = 0; int x2 = 0;
bool status = false; bool s1Status; bool s2Status;
string y1 = ""; bool s1Status = false; bool s2Status = false; //s1status ==false then string else int;
//s1status ==false then string ele int; //s2status ==false then string else int;
//s2status ==false then string ele int;
int result = 0; int result = 0;
for (int i = 0; i < str1.Count && i < str2.Count; i++) for (int i = 0; i < str1.Count && i < str2.Count; i++)
{ {
status = int.TryParse(str1[i].ToString(), out res); _ = int.TryParse(str1[i].ToString(), out int res);
if (res == 0) if (res == 0)
{ {
y1 = str1[i].ToString();
s1Status = false; s1Status = false;
} }
else else
@@ -1415,10 +1303,9 @@ namespace Volian.Controls.Library
s1Status = true; s1Status = true;
} }
status = int.TryParse(str2[i].ToString(), out res); _ = int.TryParse(str2[i].ToString(), out res);
if (res == 0) if (res == 0)
{ {
y2 = str2[i].ToString();
s2Status = false; s2Status = false;
} }
else else
@@ -1,12 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
using DevComponents.DotNetBar; using DevComponents.DotNetBar;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
using Volian.Base.Library; using Volian.Base.Library;
@@ -59,13 +56,7 @@ namespace Volian.Controls.Library
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion #endregion
private static bool _SyncronizeEnahnced = false; [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
public static bool SyncronizeEnhanced
{
get { return DisplayTabControl._SyncronizeEnahnced; }
set { DisplayTabControl._SyncronizeEnahnced = value; }
}
private static Dictionary<int, DisplayTabControl> _AllDTCs = new Dictionary<int, DisplayTabControl>(); private static Dictionary<int, DisplayTabControl> _AllDTCs = new Dictionary<int, DisplayTabControl>();
private int _VersionID = 0; private int _VersionID = 0;
// zero tells us to PROMS just opened and no procedure was selected yet so use the main proms window // zero tells us to PROMS just opened and no procedure was selected yet so use the main proms window
@@ -75,11 +66,11 @@ namespace Volian.Controls.Library
get { return _VersionID; } get { return _VersionID; }
set set
{ {
if ((int)value != 0) if (value != 0)
{ {
if (!_AllDTCs.ContainsKey((int)value)) if (!_AllDTCs.ContainsKey((int)value))
{ {
_AllDTCs.Add((int)value, this); _AllDTCs.Add(value, this);
if (_VersionID == 0) if (_VersionID == 0)
_VersionID = value; _VersionID = value;
else else
@@ -148,8 +139,7 @@ namespace Volian.Controls.Library
public event ItemSelectedChangedEvent OpenInSeparateWindow; public event ItemSelectedChangedEvent OpenInSeparateWindow;
public void OnOpenInSeparateWindow(ItemSelectedChangedEventArgs args) public void OnOpenInSeparateWindow(ItemSelectedChangedEventArgs args)
{ {
if (OpenInSeparateWindow != null) OpenInSeparateWindow?.Invoke(this, args);
OpenInSeparateWindow(this, args);
} }
// C2020-033: Provide way to expand/fill in Search/Incoming Transition panel // C2020-033: Provide way to expand/fill in Search/Incoming Transition panel
public event DisplayTabControlEditorSearchIncTransEvent SearchIncTrans; public event DisplayTabControlEditorSearchIncTransEvent SearchIncTrans;
@@ -161,31 +151,29 @@ namespace Volian.Controls.Library
public event ItemSelectedChangedEvent RefreshEnhancedDocument; public event ItemSelectedChangedEvent RefreshEnhancedDocument;
public void OnRefreshEnhancedDocument(ItemSelectedChangedEventArgs args) public void OnRefreshEnhancedDocument(ItemSelectedChangedEventArgs args)
{ {
if (RefreshEnhancedDocument != null) RefreshEnhancedDocument?.Invoke(this, args);
RefreshEnhancedDocument(this, args);
} }
public event DisplayTabControlStatusEvent StatusChanged; public event DisplayTabControlStatusEvent StatusChanged;
public void ONStatusChanged(object Sender, DisplayTabControlStatusEventArgs args) public void ONStatusChanged(object Sender, DisplayTabControlStatusEventArgs args)
{ {
if (StatusChanged != null) StatusChanged(Sender, args); StatusChanged?.Invoke(Sender, args);
} }
public event DisplayTabControlEvent ToggleRibbonExpanded; public event DisplayTabControlEvent ToggleRibbonExpanded;
public void OnToggleRibbonExpanded(object sender, EventArgs args) public void OnToggleRibbonExpanded(object sender, EventArgs args)
{ {
if (ToggleRibbonExpanded != null) ToggleRibbonExpanded(sender, args); ToggleRibbonExpanded?.Invoke(sender, args);
} }
public event DisplayTabControlEvent SelectedDisplayTabItemChanged; public event DisplayTabControlEvent SelectedDisplayTabItemChanged;
public void OnSelectedDisplayTabItemChanged(object sender, EventArgs args) public void OnSelectedDisplayTabItemChanged(object sender, EventArgs args)
{ {
if (SelectedDisplayTabItemChanged != null) SelectedDisplayTabItemChanged(sender, args); SelectedDisplayTabItemChanged?.Invoke(sender, args);
} }
// C2015-022 added copystep event to commuicate with child windows // C2015-022 added copystep event to commuicate with child windows
public event ItemChangedEventHandler CopyStepSelected; public event ItemChangedEventHandler CopyStepSelected;
public void OnCopyStepSelected(ItemChangedEventArgs args) public void OnCopyStepSelected(ItemChangedEventArgs args)
{ {
if (CopyStepSelected != null) CopyStepSelected?.Invoke(this, args);
CopyStepSelected(this, args);
} }
#region Private Fields #region Private Fields
@@ -228,6 +216,8 @@ namespace Volian.Controls.Library
} }
private StepRTB _MyStepRTB = null; private StepRTB _MyStepRTB = null;
private bool _RibbonExpanded = true; private bool _RibbonExpanded = true;
//Keeping for possible future references
public StepRTB MyStepRTB public StepRTB MyStepRTB
{ {
get { return _MyStepRTB; } get { return _MyStepRTB; }
@@ -302,7 +292,7 @@ namespace Volian.Controls.Library
/// <param name="args"></param> /// <param name="args"></param>
internal void OnItemClick(object sender, StepPanelEventArgs args) internal void OnItemClick(object sender, StepPanelEventArgs args)
{ {
if (ItemClick != null) ItemClick(sender, args); ItemClick?.Invoke(sender, args);
} }
/// <summary> /// <summary>
/// This occurs when the user moves onto or off of a link within a RichTextBox /// This occurs when the user moves onto or off of a link within a RichTextBox
@@ -408,7 +398,7 @@ namespace Volian.Controls.Library
_MyEditItem = null; _MyEditItem = null;
_MyStepRTB = null; _MyStepRTB = null;
} }
if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args); ItemSelectedChanged?.Invoke(sender, args);
} }
void _MyStepRTB_Disposed(object sender, EventArgs e) void _MyStepRTB_Disposed(object sender, EventArgs e)
@@ -476,8 +466,7 @@ namespace Volian.Controls.Library
void DisplayTabControl_Resize(object sender, EventArgs e) void DisplayTabControl_Resize(object sender, EventArgs e)
{ {
// If the currently selected Item is in a Step, then adjust the scroll as necessary to keep it visible // If the currently selected Item is in a Step, then adjust the scroll as necessary to keep it visible
if (_MyEditItem != null) _MyEditItem?.ItemShow();
_MyEditItem.ItemShow();
} }
private void SetupBar(Bar myBar) private void SetupBar(Bar myBar)
{ {
@@ -531,13 +520,9 @@ namespace Volian.Controls.Library
DisplayTabItem dti = e.DockContainerItem as DisplayTabItem; DisplayTabItem dti = e.DockContainerItem as DisplayTabItem;
if (dti != null && dti.MyStepTabPanel != null) if (dti != null && dti.MyStepTabPanel != null)
dti.MyStepTabPanel.MyStepPanel.Dispose(); dti.MyStepTabPanel.MyStepPanel.Dispose();
DisplayTabItem myTabItem = e.DockContainerItem as DisplayTabItem; if (e.DockContainerItem is DisplayTabItem myTabItem)
if (myTabItem != null)
{ {
if (myTabItem.MyDSOTabPanel != null) myTabItem.MyDSOTabPanel?.CloseDSO();
{
myTabItem.MyDSOTabPanel.CloseDSO();
}
} }
MySessionInfo.CheckInItem(dti.OwnerID); MySessionInfo.CheckInItem(dti.OwnerID);
if (((Bar)sender).Items == null) return; if (((Bar)sender).Items == null) return;
@@ -551,8 +536,7 @@ namespace Volian.Controls.Library
OnEnableDisableStepProperties(new StepTabRibbonEventArgs(MyEditItem.MyItemInfo, 0, E_ViewMode.Edit)); OnEnableDisableStepProperties(new StepTabRibbonEventArgs(MyEditItem.MyItemInfo, 0, E_ViewMode.Edit));
} }
Bar bar = sender as Bar; if (sender is Bar bar)
if (bar != null)
{ {
if (dotNetBarManager1.Bars.Contains(bar.Name)) if (dotNetBarManager1.Bars.Contains(bar.Name))
dotNetBarManager1.Bars.Remove(bar); dotNetBarManager1.Bars.Remove(bar);
@@ -574,15 +558,14 @@ namespace Volian.Controls.Library
public event StepTabRibbonEvent EnableDisableStepProperties; public event StepTabRibbonEvent EnableDisableStepProperties;
private void OnEnableDisableStepProperties(StepTabRibbonEventArgs args) private void OnEnableDisableStepProperties(StepTabRibbonEventArgs args)
{ {
if (EnableDisableStepProperties != null) EnableDisableStepProperties?.Invoke(this, args);
EnableDisableStepProperties(this, args);
} }
#endregion #endregion
#region Public Methods #region Public Methods
public void RefreshItem(ItemInfo myItemInfo) public void RefreshItem(ItemInfo myItemInfo)
{ {
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
string key = "Item - " + proc.ItemID.ToString(); string key = $"Item - {proc.ItemID}";
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
{ {
@@ -717,9 +700,8 @@ namespace Volian.Controls.Library
if (EDOfficeViewerX == null || EDWordCtrl == null) if (EDOfficeViewerX == null || EDWordCtrl == null)
{ {
MessageBox.Show("Edraw needs to be installed or reinstalled on this device. " + Environment.NewLine + "" + Environment.NewLine + MessageBox.Show($"Edraw needs to be installed or reinstalled on this device. {Environment.NewLine}{Environment.NewLine}Please contact your IT Administrator to install and register Edraw that was provided with the PROMS Installation media. If additional support is needed, please contact Volian.",
"Please contact your IT Administrator to install and register Edraw that was provided with the PROMS Installation media. If additional support is needed, please contact Volian.", "Error in Word section", "Error in Word section", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return null; return null;
} }
else else
@@ -730,19 +712,13 @@ namespace Volian.Controls.Library
} }
} }
public T GetValue<T>(string registryKeyPath, string value, T defaultValue = default(T)) public T GetValue<T>(string registryKeyPath, string value, T defaultValue = default) => (T)Registry.GetValue(registryKeyPath, value, defaultValue);
{ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping type for future usage")]
T retVal = default(T);
retVal = (T)Registry.GetValue(registryKeyPath, value, defaultValue);
return retVal;
}
public bool PasteRTBItem(ItemInfo myItemInfo, int copyStartID, ItemInfo.EAddpingPart pasteType, int type) public bool PasteRTBItem(ItemInfo myItemInfo, int copyStartID, ItemInfo.EAddpingPart pasteType, int type)
{ {
CleanUpClosedItems(); CleanUpClosedItems();
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
string key = "Item - " + proc.ItemID.ToString(); string key = $"Item - {proc.ItemID}";
if (_MyDisplayTabItems.ContainsKey(key) && pasteType != ItemInfo.EAddpingPart.Replace) // If procedure page open use it unless replace if (_MyDisplayTabItems.ContainsKey(key) && pasteType != ItemInfo.EAddpingPart.Replace) // If procedure page open use it unless replace
{ {
@@ -769,7 +745,7 @@ namespace Volian.Controls.Library
EditItem ei = edtitm.PasteReplace(copyStartID); EditItem ei = edtitm.PasteReplace(copyStartID);
if (ei == null) if (ei == null)
{ {
CloseTabItem(_MyDisplayTabItems["Item - " + myItemInfo.ItemID.ToString()]); //Grab itemID and set to close open tab. CloseTabItem(_MyDisplayTabItems[$"Item - {myItemInfo.ItemID}"]); //Grab itemID and set to close open tab.
return false; //B2017-179 PasteReplace will return null if was aborted return false; //B2017-179 PasteReplace will return null if was aborted
} }
@@ -788,7 +764,7 @@ namespace Volian.Controls.Library
else if (_MyDisplayTabItems.ContainsKey(key) && pasteType == ItemInfo.EAddpingPart.Replace) else if (_MyDisplayTabItems.ContainsKey(key) && pasteType == ItemInfo.EAddpingPart.Replace)
{ {
// B2024-038: changed tab key to procedure (was item, which caused crash if section) // B2024-038: changed tab key to procedure (was item, which caused crash if section)
CloseTabItem(_MyDisplayTabItems["Item - " + proc.ItemID.ToString()]); //Grab itemID and set to close open tab. CloseTabItem(_MyDisplayTabItems[$"Item - {proc.ItemID}"]); //Grab itemID and set to close open tab.
return false; //B2017-179 PasteReplace will return null if was aborted return false; //B2017-179 PasteReplace will return null if was aborted
} }
return false; return false;
@@ -800,7 +776,7 @@ namespace Volian.Controls.Library
//removeitem! //removeitem!
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
string key = "Item - " + proc.ItemID.ToString(); string key = $"Item - {proc.ItemID}";
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
{ {
@@ -826,7 +802,7 @@ namespace Volian.Controls.Library
{ {
CleanUpClosedItems(); CleanUpClosedItems();
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
string key = "Item - " + proc.ItemID.ToString(); string key = $"Item - {proc.ItemID}";
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
{ {
@@ -875,17 +851,16 @@ namespace Volian.Controls.Library
string key = "Doc - "; string key = "Doc - ";
// there is no entry if it is an auto table of contents: // there is no entry if it is an auto table of contents:
if (myItemInfo.MyContent.MyEntry != null) if (myItemInfo.MyContent.MyEntry != null)
key = key + myItemInfo.MyContent.MyEntry.MyDocument.DocID.ToString(); key += myItemInfo.MyContent.MyEntry.MyDocument.DocID.ToString();
else else
key = key + "0"; key += "0";
DisplayTabItem myTabItem = null;
if (_MyDisplayTabItems.ContainsKey(key)) // If page open, close it if (_MyDisplayTabItems.ContainsKey(key)) // If page open, close it
{ {
myTabItem = _MyDisplayTabItems[key]; _ = _MyDisplayTabItems[key];
if (myTabItem.MyDSOTabPanel != null) if (((DisplayTabItem)null).MyDSOTabPanel != null)
{ {
myTabItem.MyDSOTabPanel.IsBeingDeleted = isBeingDeleted; ((DisplayTabItem)null).MyDSOTabPanel.IsBeingDeleted = isBeingDeleted;
CloseTabItem(myTabItem); CloseTabItem(null);
} }
} }
} }
@@ -893,8 +868,7 @@ namespace Volian.Controls.Library
public void CloseTabItem(DisplayTabItem myTabItem) public void CloseTabItem(DisplayTabItem myTabItem)
{ {
if (myTabItem.ContainerControl == null) return; if (myTabItem.ContainerControl == null) return;
Bar b = myTabItem.ContainerControl as Bar; if (myTabItem.ContainerControl is Bar b)
if (b != null)
{ {
try try
{ {
@@ -948,8 +922,7 @@ namespace Volian.Controls.Library
if (_RemovedDisplayTabItems.Contains(myBar.SelectedDockContainerItem as DisplayTabItem)) if (_RemovedDisplayTabItems.Contains(myBar.SelectedDockContainerItem as DisplayTabItem))
myBar.SelectedDockContainerItem = FindRemainingTab(myBar); myBar.SelectedDockContainerItem = FindRemainingTab(myBar);
myBar.SelectedDockContainerItem.Selected = true; myBar.SelectedDockContainerItem.Selected = true;
StepTabPanel pnl = myBar.SelectedDockContainerItem.Control as StepTabPanel; if (myBar.SelectedDockContainerItem.Control is StepTabPanel pnl)
if (pnl != null)
pnl.MyStepPanel.ItemShow(); pnl.MyStepPanel.ItemShow();
} }
} }
@@ -1035,7 +1008,7 @@ namespace Volian.Controls.Library
PnlCaret.Visible = false; PnlCaret.Visible = false;
} }
// B2019-161 When tracking timing time this action // B2019-161 When tracking timing time this action
private static VolianTimer _TimeActivity = new VolianTimer("DisplayTabControl.cs tmrCaret_Tick", 881); private static readonly VolianTimer _TimeActivity = new VolianTimer("DisplayTabControl.cs tmrCaret_Tick", 881);
private void tmrCaret_Tick(object sender, EventArgs e) private void tmrCaret_Tick(object sender, EventArgs e)
{ {
@@ -1045,22 +1018,6 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Private Methods #region Private Methods
///// <summary>
///// Gets and sets the SelectedDisplayTabItem (Active Tab)
///// </summary>
//public DisplayTabItem SelectedDisplayTabItem1
//{
// get { return (DisplayTabItem)_MyBar.SelectedDockContainerItem; }
// set
// {
// //Volian.Base.Library.vlnStackTrace.ShowStackLocal("SelectedDisplayTabItem");
// if (value != null)
// {
// value.Focus();
// value.Selected = true;
// }
// }
//}
public void SelectDisplayTabItem(DisplayTabItem myDisplayTabItem) public void SelectDisplayTabItem(DisplayTabItem myDisplayTabItem)
{ {
if (myDisplayTabItem != null) if (myDisplayTabItem != null)
@@ -1112,8 +1069,7 @@ namespace Volian.Controls.Library
if (myBar == null) myBar = b;// Remember the first available bar if a specific bar cannot be found if (myBar == null) myBar = b;// Remember the first available bar if a specific bar cannot be found
foreach (object itm in b.Items) foreach (object itm in b.Items)
{ {
DisplayTabItem myTabItem = itm as DisplayTabItem; if (itm is DisplayTabItem myTabItem && myTabItem.MyStepTabPanel != null && myItemInfo != null)
if (myTabItem != null && myTabItem.MyStepTabPanel != null && myItemInfo != null)
if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID) if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID)
return b; return b;
} }
@@ -1125,7 +1081,7 @@ namespace Volian.Controls.Library
_UniqueBarCount++; _UniqueBarCount++;
myBar = BarUtilities.CreateDocumentBar(); myBar = BarUtilities.CreateDocumentBar();
myBar.DockTabClosing += new DockTabClosingEventHandler(myBar_DockTabClosing); myBar.DockTabClosing += new DockTabClosingEventHandler(myBar_DockTabClosing);
myBar.Name = "barDocuments" + _UniqueBarCount.ToString(); myBar.Name = $"barDocuments{_UniqueBarCount}";
fillDocDockSite.GetDocumentUIManager().Dock(myBar); fillDocDockSite.GetDocumentUIManager().Dock(myBar);
SetupBar(myBar); SetupBar(myBar);
} }
@@ -1141,8 +1097,7 @@ namespace Volian.Controls.Library
if (myBar == null) myBar = b;// Remember the first available bar if a specific bar cannot be found if (myBar == null) myBar = b;// Remember the first available bar if a specific bar cannot be found
foreach (object itm in b.Items) foreach (object itm in b.Items)
{ {
DisplayTabItem myTabItem = itm as DisplayTabItem; if (itm is DisplayTabItem myTabItem && myTabItem.MyStepTabPanel != null && myTabItem.MyStepTabPanel.MyProcedureItemInfo != null)
if (myTabItem != null && myTabItem.MyStepTabPanel != null && myTabItem.MyStepTabPanel.MyProcedureItemInfo != null)
if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID) if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID)
return myTabItem.MyStepTabPanel; return myTabItem.MyStepTabPanel;
} }
@@ -1173,8 +1128,7 @@ namespace Volian.Controls.Library
if (stp != null) if (stp != null)
{ {
EditItem ei = stp.SelectedEditItem; EditItem ei = stp.SelectedEditItem;
if (ei != null) ei?.SaveCurrentAndContents();
ei.SaveCurrentAndContents();
} }
} }
} }
@@ -1182,40 +1136,16 @@ namespace Volian.Controls.Library
public DisplayTabItem GetProcDisplayTabItem(ItemInfo myItemInfo) public DisplayTabItem GetProcDisplayTabItem(ItemInfo myItemInfo)
{ {
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
string key = "Item - " + proc.ItemID.ToString(); string key = $"Item - {proc.ItemID}";
DisplayTabItem pg = null;
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
return _MyDisplayTabItems[key]; return _MyDisplayTabItems[key];
return null; return null;
} }
/// <summary>
/// This opens a Step page based upon a ItemInfo.
///
/// </summary>
/// <param name="myItemInfo"></param>
/// <returns></returns>
//public bool IsItemInfoProcedureOpen(ItemInfo ii)
// if (ii == null) return false; //{
// ItemInfo proc = ii.MyProcedure; // Find procedure Item
// if (dicEnhancedDocuments.ContainsKey(ii.MyProcedure.MyDocVersion))
// {
// frmEnhanced frm = dicEnhancedDocuments[ii.MyProcedure.MyDocVersion];
// string key = "Item - " + proc.ItemID.ToString();
// if (frm.MyDisplayTabClntrol._MyDisplayTabItems.ContainsKey(key))
// return true;
// }
// // return true;
// //return false;
// return false;
//}
//public Dictionary<DocVersionInfo, frmEnhanced> dicEnhancedDocuments = new Dictionary<DocVersionInfo, frmEnhanced>();
private DisplayTabItem OpenStepTabPage(ItemInfo myItemInfo, bool setFocus, bool viewonlymode = false) private DisplayTabItem OpenStepTabPage(ItemInfo myItemInfo, bool setFocus, bool viewonlymode = false)
{ {
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
string key = "Item - " + proc.ItemID.ToString(); string key = $"Item - {proc.ItemID}";
DisplayTabItem pg = null; DisplayTabItem pg;
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
{ {
pg = _MyDisplayTabItems[key]; pg = _MyDisplayTabItems[key];
@@ -1237,9 +1167,6 @@ namespace Volian.Controls.Library
HandleChangeId(myItemInfo, pg); HandleChangeId(myItemInfo, pg);
SelectDisplayTabItem(pg); SelectDisplayTabItem(pg);
// If this is an enhanced document, check for refresh of text items:
//if (myItemInfo.IsProcedure)
//{
// make the myiteminfo into a procedureinfo (depending on where this is called from, just // make the myiteminfo into a procedureinfo (depending on where this is called from, just
// casting it crashed: // casting it crashed:
ProcedureInfo pi = ProcedureInfo.Get(myItemInfo.MyProcedure.ItemID); ProcedureInfo pi = ProcedureInfo.Get(myItemInfo.MyProcedure.ItemID);
@@ -1254,7 +1181,6 @@ namespace Volian.Controls.Library
pi.EnhancedProcedureRefreshTextDifferences(iil); pi.EnhancedProcedureRefreshTextDifferences(iil);
} }
} }
//}
} }
pg.MyStepTabPanel.MyProcedureItemInfo = proc; pg.MyStepTabPanel.MyProcedureItemInfo = proc;
@@ -1269,11 +1195,6 @@ namespace Volian.Controls.Library
} }
Application.DoEvents(); Application.DoEvents();
pg.SelectedItemInfo = myItemInfo; // Select the item pg.SelectedItemInfo = myItemInfo; // Select the item
//StepConfig sc = new StepConfig(myItemInfo.MyContent.Config);
//if (sc.Step_SourceToBackground != null || sc.Step_SourceToDeviation != null)
// pg.MyStepTabPanel.MyStepTabRibbon.btnEnhancedDocSync.Visible = true;
//else
// pg.MyStepTabPanel.MyStepTabRibbon.btnEnhancedDocSync.Visible = false;
return pg; return pg;
} }
private bool _SyncEnhancedDocuments; private bool _SyncEnhancedDocuments;
@@ -1294,7 +1215,7 @@ namespace Volian.Controls.Library
{ {
if (!Volian.Base.Library.VlnSettings.GetCommandFlag("NOCHGID")) if (!Volian.Base.Library.VlnSettings.GetCommandFlag("NOCHGID"))
{ {
dlgChgId dlgCI = new dlgChgId(this); //, null); dlgChgId dlgCI = new dlgChgId(this);
dlgCI.ShowDialog(this); dlgCI.ShowDialog(this);
} }
ItemsChangeIds.Add(myItemInfo.MyProcedure.ItemID, ChgId); ItemsChangeIds.Add(myItemInfo.MyProcedure.ItemID, ChgId);
@@ -1303,11 +1224,6 @@ namespace Volian.Controls.Library
private void SetChangeId(string chgid, DisplayTabItem pg, ItemInfo ii) private void SetChangeId(string chgid, DisplayTabItem pg, ItemInfo ii)
{ {
//if (pg == null || pg.MyStepTabPanel == null)
//{
// ChgId = null;
// return;
//}
if (pg != null && pg.MyStepTabPanel != null) pg.MyStepTabPanel.MyStepTabRibbon.SetChangeId(chgid, ii); if (pg != null && pg.MyStepTabPanel != null) pg.MyStepTabPanel.MyStepTabRibbon.SetChangeId(chgid, ii);
ChgId = chgid; ChgId = chgid;
} }
@@ -1315,7 +1231,7 @@ namespace Volian.Controls.Library
private bool LibDocAlreadyOpen(ItemInfo myItemInfo) private bool LibDocAlreadyOpen(ItemInfo myItemInfo)
{ {
EntryInfo myEntry = myItemInfo.MyContent.MyEntry; EntryInfo myEntry = myItemInfo.MyContent.MyEntry;
string key = "Doc - " + myEntry.DocID; string key = $"Doc - {myEntry.DocID}";
DisplayTabItem pg = null; DisplayTabItem pg = null;
return LibDocAlreadyOpen(myItemInfo, key, ref pg, false); return LibDocAlreadyOpen(myItemInfo, key, ref pg, false);
} }
@@ -1359,7 +1275,7 @@ namespace Volian.Controls.Library
{ {
DisplayTabItem pg = null; DisplayTabItem pg = null;
EntryInfo myEntry = myItemInfo.MyContent.MyEntry; EntryInfo myEntry = myItemInfo.MyContent.MyEntry;
string key = "Doc - " + myEntry.DocID; string key = $"Doc - {myEntry.DocID}";
bool libDocAlreadyOpen = LibDocAlreadyOpen(myItemInfo, key, ref pg, true); bool libDocAlreadyOpen = LibDocAlreadyOpen(myItemInfo, key, ref pg, true);
if (!libDocAlreadyOpen && pg == null) if (!libDocAlreadyOpen && pg == null)
{ {
@@ -1368,8 +1284,6 @@ namespace Volian.Controls.Library
FlexibleMessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another"); FlexibleMessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another");
return null; return null;
} }
//if ((myItemInfo.MyContent.MyEntry.MyDocument.LibTitle ?? "") != "")
// MessageBox.Show("WARNING: All edits made to this Library Document will be applied to all uses of the Document");
pg = new DisplayTabItem(this.components, this, myItemInfo, key); // Open a new document page pg = new DisplayTabItem(this.components, this, myItemInfo, key); // Open a new document page
// B2917-219 if MyEdWord is null that means we had trouble opening the word attachment and either a blank document was created or a previous version was recovered // B2917-219 if MyEdWord is null that means we had trouble opening the word attachment and either a blank document was created or a previous version was recovered
// so we now we want to open the now blank or recovered attachment // so we now we want to open the now blank or recovered attachment
@@ -1391,8 +1305,8 @@ namespace Volian.Controls.Library
{ {
_MyBar = GetParentBar(null); // B2016-131 - allow open of a non-referenced library document _MyBar = GetParentBar(null); // B2016-131 - allow open of a non-referenced library document
CleanUpClosedItems(); CleanUpClosedItems();
DisplayTabItem pg = null; string key = $"Doc - {myDocumentInfo.DocID}";
string key = "Doc - " + myDocumentInfo.DocID; DisplayTabItem pg;
if (_MyDisplayTabItems.ContainsKey(key)) // If document page open use it if (_MyDisplayTabItems.ContainsKey(key)) // If document page open use it
pg = _MyDisplayTabItems[key]; pg = _MyDisplayTabItems[key];
else else
@@ -1422,12 +1336,10 @@ namespace Volian.Controls.Library
_MyDisplayTabItems.Remove(myDisplayTabItem.MyKey); _MyDisplayTabItems.Remove(myDisplayTabItem.MyKey);
// Dispose of the procedure tab panel // Dispose of the procedure tab panel
if (myDisplayTabItem.MyStepTabPanel != null) myDisplayTabItem.MyStepTabPanel?.Dispose();
myDisplayTabItem.MyStepTabPanel.Dispose();
// Dispose of the MS Word Panel // Dispose of the MS Word Panel
if (myDisplayTabItem.MyDSOTabPanel != null) myDisplayTabItem.MyDSOTabPanel?.CloseDSO();
myDisplayTabItem.MyDSOTabPanel.CloseDSO();
components.Remove(myDisplayTabItem); components.Remove(myDisplayTabItem);
myDisplayTabItem.Dispose(); myDisplayTabItem.Dispose();
+40 -123
View File
@@ -1,9 +1,5 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Drawing;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
@@ -12,12 +8,10 @@ namespace Volian.Controls.Library
public partial class DisplayTabItem : DevComponents.DotNetBar.DockContainerItem public partial class DisplayTabItem : DevComponents.DotNetBar.DockContainerItem
{ {
#region Private Fields #region Private Fields
private DisplayTabControl _MyDisplayTabControl; private readonly DisplayTabControl _MyDisplayTabControl;
private ItemInfo _MyItemInfo; private readonly ItemInfo _MyItemInfo;
private StepTabPanel _MyStepTabPanel; private readonly string _MyKey;
private string _MyKey; private readonly DocumentInfo _MyDocumentInfo;
private DSOTabPanel _MyDSOTabPanel;
private DocumentInfo _MyDocumentInfo;
#endregion #endregion
@@ -25,16 +19,10 @@ namespace Volian.Controls.Library
/// <summary> /// <summary>
/// ItemInfo associated with this DisplayTabItem /// ItemInfo associated with this DisplayTabItem
/// </summary> /// </summary>
private int _OwnerID; public int OwnerID { get; set; }
public int OwnerID
{
get { return _OwnerID; }
set { _OwnerID = value; }
}
public ItemInfo MyItemInfo public ItemInfo MyItemInfo
{ {
get { return _MyItemInfo; } get { return _MyItemInfo; }
//set { _MyItemInfo = value; }
} }
/// <summary> /// <summary>
/// get Key Either: /// get Key Either:
@@ -48,31 +36,12 @@ namespace Volian.Controls.Library
/// <summary> /// <summary>
/// Related StepTabPanel for a Step page /// Related StepTabPanel for a Step page
/// </summary> /// </summary>
public StepTabPanel MyStepTabPanel public StepTabPanel MyStepTabPanel { get; set; }
{
get { return _MyStepTabPanel; }
set { _MyStepTabPanel = value; }
}
/// <summary> /// <summary>
/// Related DSOTabPanle for a Word page /// Related DSOTabPanle for a Word page
/// </summary> /// </summary>
public DSOTabPanel MyDSOTabPanel public DSOTabPanel MyDSOTabPanel { get; set; }
{ public string MyUserRole { get; set; }
get { return _MyDSOTabPanel; }
set { _MyDSOTabPanel = value; }
}
private string _MyUserRole;
public string MyUserRole
{
get { return _MyUserRole; }
set { _MyUserRole = value; }
}
private bool _Closed = false;
public bool Closed
{
get { return _Closed; }
set { _Closed = value; }
}
/// <summary> /// <summary>
/// Current SelectedItemInfo for this page /// Current SelectedItemInfo for this page
/// </summary> /// </summary>
@@ -80,13 +49,13 @@ namespace Volian.Controls.Library
{ {
get get
{ {
if (_MyStepTabPanel == null) return null; if (MyStepTabPanel == null) return null;
return _MyStepTabPanel.SelectedItemInfo; return MyStepTabPanel.SelectedItemInfo;
} }
set set
{// B2018-074 Don't crash if opening MSWord section from Tools window in Debug Mode {// B2018-074 Don't crash if opening MSWord section from Tools window in Debug Mode
if (_MyStepTabPanel != null) if (MyStepTabPanel != null)
_MyStepTabPanel.SelectedItemInfo = value; MyStepTabPanel.SelectedItemInfo = value;
} }
} }
/// <summary> /// <summary>
@@ -121,14 +90,6 @@ namespace Volian.Controls.Library
else else
SetupDSOTabPanel(); SetupDSOTabPanel();
SetupSecurity(myItemInfo); SetupSecurity(myItemInfo);
// B2022-055 assigning the Name caused a duplicate name error
// we found that the procedure tab control remained in the Control list after the procedure was closed
// later on we need to find out why it isn't removed when the procedure is closed
//if (MyDSOTabPanel == null || MyDSOTabPanel.MyEdWord != null) // B2017-219 check needed if we could not open a word attachment
//{
// //Name = string.Format("DisplayTabItem {0}", myItemInfo.ItemID);
//}
} }
private bool MesssageShown = false; private bool MesssageShown = false;
public void SetupSecurity(ItemInfo myItem) public void SetupSecurity(ItemInfo myItem)
@@ -172,43 +133,37 @@ namespace Volian.Controls.Library
FlexibleMessageBox.Show("Security has not been defined for PROMS. All functionality has been defaulted to the lowest level for all users until security is defined.", "no security defined", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); FlexibleMessageBox.Show("Security has not been defined for PROMS. All functionality has been defaulted to the lowest level for all users until security is defined.", "no security defined", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
MesssageShown = true; MesssageShown = true;
} }
_MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode(); MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
} }
else if (ui.IsAdministrator()) else if (ui.IsAdministrator())
{ {
if (_MyStepTabPanel != null) MyStepTabPanel?.MyStepTabRibbon.SetupAdminMode();
_MyStepTabPanel.MyStepTabRibbon.SetupAdminMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Administrator"; MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Administrator";
} }
else if (ui.IsSetAdministrator(myItem.MyDocVersion)) else if (ui.IsSetAdministrator(myItem.MyDocVersion))
{ {
if (_MyStepTabPanel != null) MyStepTabPanel?.MyStepTabRibbon.SetupSetAdminMode();
_MyStepTabPanel.MyStepTabRibbon.SetupSetAdminMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Set Administrator"; MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Set Administrator";
} }
else if (ui.IsROEditor(myItem.MyDocVersion) && !ui.IsWriter(myItem.MyDocVersion)) else if (ui.IsROEditor(myItem.MyDocVersion) && !ui.IsWriter(myItem.MyDocVersion))
{ {
if (_MyStepTabPanel != null) MyStepTabPanel?.MyStepTabRibbon.SetupROEditorMode();
_MyStepTabPanel.MyStepTabRibbon.SetupROEditorMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - RO Editor"; MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - RO Editor";
} }
else if (ui.IsWriter(myItem.MyDocVersion)) else if (ui.IsWriter(myItem.MyDocVersion))
{ {
if (_MyStepTabPanel != null) MyStepTabPanel?.MyStepTabRibbon.SetupWriterMode();
_MyStepTabPanel.MyStepTabRibbon.SetupWriterMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Writer"; MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Writer";
} }
else if (ui.IsReviewer(myItem.MyDocVersion)) else if (ui.IsReviewer(myItem.MyDocVersion))
{ {
if (_MyStepTabPanel != null) MyStepTabPanel?.MyStepTabRibbon.SetupReviewerMode();
_MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer"; MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer";
} }
else else
{ {
if (_MyStepTabPanel != null) MyStepTabPanel?.MyStepTabRibbon.SetupReviewerMode();
_MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer"; MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer";
} }
} }
@@ -222,42 +177,19 @@ namespace Volian.Controls.Library
InitializeComponent(); InitializeComponent();
this.Click += new EventHandler(DisplayTabItem_Click); this.Click += new EventHandler(DisplayTabItem_Click);
SetupLibraryDocumentDSOTabPanel(); SetupLibraryDocumentDSOTabPanel();
// B2022-055 assigning the Name caused a duplicate name error
// we found that the procedure tab control remained in the Control list after the procedure was closed
// later on we need to find out why it isn't removed when the procedure is closed
//Name = string.Format("DisplayTabLibraryDocument {0}", myDocumentInfo.DocID);
} }
protected override void OnDisplayedChanged() protected override void OnDisplayedChanged()
{ {
//Console.WriteLine("=>=>=>=> OnDisplayedChanged"); //Console.WriteLine("=>=>=>=> OnDisplayedChanged");
if (_MyStepTabPanel != null) if (MyStepTabPanel != null)
_MyStepTabPanel.MyStepPanel.DisplayItemChanging = true; MyStepTabPanel.MyStepPanel.DisplayItemChanging = true;
base.OnDisplayedChanged(); base.OnDisplayedChanged();
if (_MyStepTabPanel != null) if (MyStepTabPanel != null)
_MyStepTabPanel.MyStepPanel.DisplayItemChanging = false; MyStepTabPanel.MyStepPanel.DisplayItemChanging = false;
//Console.WriteLine("<=<=<=<= OnDisplayedChanged"); //Console.WriteLine("<=<=<=<= OnDisplayedChanged");
} }
//void DisplayTabItem_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
//{
// Console.WriteLine("DisplayTabItem_MouseUp");
//}
//void DisplayTabItem_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
//{
// Console.WriteLine("DisplayTabItem_MouseDown");
//}
//void DisplayTabItem_LostFocus(object sender, EventArgs e)
//{
// Console.WriteLine("DisplayTabItem_LostFocus");
//}
//void DisplayTabItem_GotFocus(object sender, EventArgs e)
//{
// Console.WriteLine("DisplayTabItem_GotFocus");
//}
#endregion #endregion
#region Event Handlers #region Event Handlers
/// <summary> /// <summary>
@@ -268,10 +200,8 @@ namespace Volian.Controls.Library
private void DisplayTabItem_Click(object sender, EventArgs e) private void DisplayTabItem_Click(object sender, EventArgs e)
{ {
// Tell the TabControl that the ItemSelected has changed // Tell the TabControl that the ItemSelected has changed
DisplayTabItem myTabItem = sender as DisplayTabItem; if (!(sender is DisplayTabItem myTabItem)) return;
if (myTabItem == null) return; if (!(myTabItem.MyStepTabPanel is StepTabPanel)) return;
StepTabPanel myTabPanel = myTabItem.MyStepTabPanel as StepTabPanel;
if (myTabPanel == null) return;
if (MyStepTabPanel.SelectedEditItem == null) return; if (MyStepTabPanel.SelectedEditItem == null) return;
MyStepTabPanel.MyDisplayTabControl.HandleChangeId(MyStepTabPanel.SelectedEditItem.MyItemInfo, myTabItem); MyStepTabPanel.MyDisplayTabControl.HandleChangeId(MyStepTabPanel.SelectedEditItem.MyItemInfo, myTabItem);
_MyDisplayTabControl.OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(MyStepTabPanel.SelectedEditItem)); _MyDisplayTabControl.OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(MyStepTabPanel.SelectedEditItem));
@@ -285,32 +215,27 @@ namespace Volian.Controls.Library
{ {
((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).BeginInit();
_MyDisplayTabControl.MyBar.SuspendLayout(); _MyDisplayTabControl.MyBar.SuspendLayout();
_MyStepTabPanel = new StepTabPanel(_MyDisplayTabControl); MyStepTabPanel = new StepTabPanel(_MyDisplayTabControl);
// //
// tabItem // tabItem
// //
Control = _MyStepTabPanel; Control = MyStepTabPanel;
// B2022-055 assigning the Name caused a duplicate name error
// we found that the procedure tab control remained in the Control list after the procedure was closed
// later on we need to find out why it isn't removed when the procedure is closed
//Name = "tabItem Item " + _MyItemInfo.ItemID;
Text = _MyItemInfo.TabTitle; Text = _MyItemInfo.TabTitle;
_MyItemInfo.Changed += new ItemInfoEvent(_MyItemInfo_Changed); _MyItemInfo.Changed += new ItemInfoEvent(_MyItemInfo_Changed);
Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\"); Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\");
MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove); MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove);
LostFocus += new EventHandler(DisplayTabItem_LostFocus); LostFocus += new EventHandler(DisplayTabItem_LostFocus);
//
_MyDisplayTabControl.Controls.Add(_MyStepTabPanel); _MyDisplayTabControl.Controls.Add(MyStepTabPanel);
_MyDisplayTabControl.MyBar.Items.Add(this); _MyDisplayTabControl.MyBar.Items.Add(this);
_MyDisplayTabControl.MyBar.Width = 300; // This triggers the bar to resize itself _MyDisplayTabControl.MyBar.Width = 300; // This triggers the bar to resize itself
// //
// tabPanel // tabPanel
// //
_MyStepTabPanel.MyDisplayTabItem = this; MyStepTabPanel.MyDisplayTabItem = this;
((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).EndInit(); ((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).EndInit();
_MyDisplayTabControl.MyBar.ResumeLayout(false); _MyDisplayTabControl.MyBar.ResumeLayout(false);
DocVersionInfo dvi = _MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; //MyRTBItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; if (!(_MyItemInfo.MyProcedure.ActiveParent is DocVersionInfo dvi)) return;
if (dvi == null) return;
if (dvi.VersionType > 127 || viewonlymode) if (dvi.VersionType > 127 || viewonlymode)
MyStepTabPanel.MyStepPanel.VwMode = E_ViewMode.View; MyStepTabPanel.MyStepPanel.VwMode = E_ViewMode.View;
// C2021 - 027: Procedure level PC/PC - add _MyIteminfo to argument list // C2021 - 027: Procedure level PC/PC - add _MyIteminfo to argument list
@@ -345,21 +270,17 @@ namespace Volian.Controls.Library
{ {
EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry; EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry;
UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID); UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID);
_MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl, _MyItemInfo, UserInfo.CanEdit(ui, MyItemInfo.MyDocVersion)); MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl, _MyItemInfo, UserInfo.CanEdit(ui, MyItemInfo.MyDocVersion));
if (_MyDSOTabPanel.MyEdWord == null) return; // B2017-219 if we could not open the word attachment just return if (MyDSOTabPanel.MyEdWord == null) return; // B2017-219 if we could not open the word attachment just return
// //
// tabItem // tabItem
// //
Control = _MyDSOTabPanel; Control = MyDSOTabPanel;
// B2022-055 assigning the Name caused a duplicate name error
// we found that the procedure tab control remained in the Control list after the procedure was closed
// later on we need to find out why it isn't removed when the procedure is closed
//Name = "tabItem Item " + _MyItemInfo.ItemID;
Text = _MyItemInfo.TabTitle; Text = _MyItemInfo.TabTitle;
Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\"); Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\");
MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove); MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove);
LostFocus += new EventHandler(DisplayTabItem_LostFocus); LostFocus += new EventHandler(DisplayTabItem_LostFocus);
_MyDisplayTabControl.Controls.Add(_MyDSOTabPanel); _MyDisplayTabControl.Controls.Add(MyDSOTabPanel);
DSOTabPanel.IgnoreEnter = true; DSOTabPanel.IgnoreEnter = true;
//Console.WriteLine("AddRange {0}", Name); //Console.WriteLine("AddRange {0}", Name);
_MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { _MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
@@ -368,7 +289,7 @@ namespace Volian.Controls.Library
// tabPanel // tabPanel
// //
_MyDisplayTabControl.SelectDisplayTabItem(this); _MyDisplayTabControl.SelectDisplayTabItem(this);
_MyDSOTabPanel.MyDisplayTabItem = this; MyDSOTabPanel.MyDisplayTabItem = this;
DSOTabPanel.IgnoreEnter = false; DSOTabPanel.IgnoreEnter = false;
} }
private void SetupLibraryDocumentDSOTabPanel() private void SetupLibraryDocumentDSOTabPanel()
@@ -377,21 +298,17 @@ namespace Volian.Controls.Library
// B2016-131 if myiteminfo is null, then the lib doc is not referenced. // B2016-131 if myiteminfo is null, then the lib doc is not referenced.
// - Allow editting only if you are an Administrator // - Allow editting only if you are an Administrator
// - Cannot check if you are a Writer or Set Aministrator because we don't have a Doc Verion // - Cannot check if you are a Writer or Set Aministrator because we don't have a Doc Verion
_MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl, _MyItemInfo, (MyItemInfo != null) ? UserInfo.CanEdit(ui, MyItemInfo.MyDocVersion) : ui.IsAdministrator()); MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl, _MyItemInfo, (MyItemInfo != null) ? UserInfo.CanEdit(ui, MyItemInfo.MyDocVersion) : ui.IsAdministrator());
// //
// tabItem // tabItem
// //
Control = _MyDSOTabPanel; Control = MyDSOTabPanel;
// B2022-055 assigning the Name caused a duplicate name error
// we found that the procedure tab control remained in the Control list after the procedure was closed
// later on we need to find out why it isn't removed when the procedure is closed
//Name = "tabLibraryDocument " + _MyDocumentInfo.DocID;
Text = _MyDocumentInfo.LibTitle; Text = _MyDocumentInfo.LibTitle;
DocumentConfig dc = new DocumentConfig(_MyDocumentInfo); DocumentConfig dc = new DocumentConfig(_MyDocumentInfo);
Tooltip = _Tooltip = dc.LibDoc_Comment; Tooltip = _Tooltip = dc.LibDoc_Comment;
MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove); MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove);
LostFocus += new EventHandler(DisplayTabItem_LostFocus); LostFocus += new EventHandler(DisplayTabItem_LostFocus);
_MyDisplayTabControl.Controls.Add(_MyDSOTabPanel); _MyDisplayTabControl.Controls.Add(MyDSOTabPanel);
DSOTabPanel.IgnoreEnter = true; DSOTabPanel.IgnoreEnter = true;
_MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { _MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
this}); this});
@@ -399,7 +316,7 @@ namespace Volian.Controls.Library
// tabPanel // tabPanel
// //
_MyDisplayTabControl.SelectDisplayTabItem(this); _MyDisplayTabControl.SelectDisplayTabItem(this);
_MyDSOTabPanel.MyDisplayTabItem = this; MyDSOTabPanel.MyDisplayTabItem = this;
DSOTabPanel.IgnoreEnter = false; DSOTabPanel.IgnoreEnter = false;
} }
#endregion #endregion
+24 -170
View File
@@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
@@ -14,16 +11,12 @@ namespace Volian.Controls.Library
public partial class DisplayTags : UserControl public partial class DisplayTags : UserControl
{ {
#region Properties #region Properties
private ItemInfo _CurItemInfo = null;
/// <summary> /// <summary>
/// Current ItemInfo /// Current ItemInfo
/// </summary> /// </summary>
public ItemInfo CurItemInfo public ItemInfo CurItemInfo { get; set; } = null;
{
get { return _CurItemInfo; }
set { _CurItemInfo = value; }
}
private bool _Initalizing = false; private bool _Initalizing = false;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private IList<int> _MyStepTypeInd = null; // use to keep track of step types put in step type menu private IList<int> _MyStepTypeInd = null; // use to keep track of step types put in step type menu
/// <summary> /// <summary>
/// This stores the last selected EditItem when the Panel was not visible /// This stores the last selected EditItem when the Panel was not visible
@@ -70,23 +63,6 @@ namespace Volian.Controls.Library
CurItemInfo = value.MyItemInfo; CurItemInfo = value.MyItemInfo;
_MyEditItem.MyStepPropertiesPanel = this; // this allows us to access the Step Property pannel and toggle check boxes with shortcut keystrokes _MyEditItem.MyStepPropertiesPanel = this; // this allows us to access the Step Property pannel and toggle check boxes with shortcut keystrokes
// originally the change all (for step type) checkbox was initialized based
// on whether all steps at level were same type, i.e. if same type, default
// it to checked. This may confuse the user, so we decided to always default
// to not checked. The code was left in here in case that decision is changed.
// MRC, JSJ & KBR were in on discussion on 2/27/12:
// only change all at level if all substeps are of same type
//bool allSameType = true;
//ItemInfo itmp = CurItemInfo.FirstSibling;
//while (itmp != null)
//{
// if (CurItemInfo.MyContent.Type != itmp.MyContent.Type)
// {
// allSameType = false;
// break;
// }
// itmp = itmp.NextItem;
//}
cbChgAll.Checked = false; cbChgAll.Checked = false;
TagsFillIn(); TagsFillIn();
} }
@@ -119,7 +95,6 @@ namespace Volian.Controls.Library
cbTCAS.Checked = false; cbTCAS.Checked = false;
cbCAS.Enabled = false; cbCAS.Enabled = false;
cbTCAS.Enabled = false; cbTCAS.Enabled = false;
//txbxAltConActSumText.Enabled = false;
rbChgBarOff.Enabled = false; rbChgBarOff.Enabled = false;
rbChgBarOn.Enabled = false; rbChgBarOn.Enabled = false;
listBoxStepTypes.Items.Clear(); listBoxStepTypes.Items.Clear();
@@ -134,22 +109,14 @@ namespace Volian.Controls.Library
} }
private bool StepOverRide() private bool StepOverRide()
{ {
ItemInfo myparent = CurItemInfo.MyActiveParent as ItemInfo; if (CurItemInfo.IsRNOPart && CurItemInfo.MyActiveParent is ItemInfo myparent && myparent.IsHigh)
if (CurItemInfo.IsRNOPart && myparent !=null && myparent.IsHigh)
{ {
// does the high level step of an RNO have a checkoff, if so it // does the high level step of an RNO have a checkoff, if so it
// can be overridden? // can be overridden?
StepConfig sc = myparent.MyConfig as StepConfig; if (myparent.MyConfig is StepConfig sc && sc.Step_CheckOffIndex != -1) return true;
if (sc != null && sc.Step_CheckOffIndex != -1) return true;
} }
return false; return false;
} }
public void HighlightChangeStep()
{
// As per MRC - don't bother to color it.
// left here in case we change our mind.
//groupPanelChgStepType.Style.BackColor = Color.PaleVioletRed;
}
public void FocusOnImageSize() public void FocusOnImageSize()
{ {
// B2016-237 added context menu item to change image size // B2016-237 added context menu item to change image size
@@ -246,6 +213,7 @@ namespace Volian.Controls.Library
} }
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private Dictionary<int, int> _CheckOffIndex = new Dictionary<int, int>(); // C2020-003 translate the sorted index number to the actual checkoff index private Dictionary<int, int> _CheckOffIndex = new Dictionary<int, int>(); // C2020-003 translate the sorted index number to the actual checkoff index
private void TagsFillIn() private void TagsFillIn()
{ {
@@ -289,7 +257,6 @@ namespace Volian.Controls.Library
{ {
cbPlaceKeeper.Enabled = cbPlaceKeeperCont.Enabled = false; cbPlaceKeeper.Enabled = cbPlaceKeeperCont.Enabled = false;
} }
//cbCAS.Enabled = true;
rbChgBarOff.Enabled = true; rbChgBarOff.Enabled = true;
rbChgBarOn.Enabled = true; rbChgBarOn.Enabled = true;
@@ -303,7 +270,6 @@ namespace Volian.Controls.Library
if (cmbShwRplWds.Visible) if (cmbShwRplWds.Visible)
{ {
cmbShwRplWds.SelectedIndex = 0; cmbShwRplWds.SelectedIndex = 0;
//StepConfig sc = CurItemInfo.MyConfig as StepConfig;
cmbShwRplWds.Enabled = true; cmbShwRplWds.Enabled = true;
cmbShwRplWds.SelectedIndex = sc.Step_ShwRplWdsIndex; cmbShwRplWds.SelectedIndex = sc.Step_ShwRplWdsIndex;
} }
@@ -350,12 +316,6 @@ namespace Volian.Controls.Library
cbCAS.Checked = (sc.Step_CAS != null) ? sc.Step_CAS == "True" : CurItemInfo.IncludeOnContActSum; cbCAS.Checked = (sc.Step_CAS != null) ? sc.Step_CAS == "True" : CurItemInfo.IncludeOnContActSum;
// Set the Time Critical Action Summary check box - if nothing in config set to false // Set the Time Critical Action Summary check box - if nothing in config set to false
cbTCAS.Checked = (sc.Step_TCAS != null) ? sc.Step_TCAS == "True" : CurItemInfo.IncludeOnTimeCriticalActionSum; cbTCAS.Checked = (sc.Step_TCAS != null) ? sc.Step_TCAS == "True" : CurItemInfo.IncludeOnTimeCriticalActionSum;
//// if alternative continuous action text is saved in the config, then show it and check the checkbox
//if (sc.Step_AlternateContActSumText != null && sc.Step_AlternateContActSumText != "")
//{
// txbxAltConActSumText.Text = sc.Step_AlternateContActSumText;
// cbCAS.Checked = true;
//}
} }
bool _checkoffsAllowed = true; bool _checkoffsAllowed = true;
if (fmtdata.ProcData.CheckOffData.CheckoffOnSubStepsOnly) if (fmtdata.ProcData.CheckOffData.CheckoffOnSubStepsOnly)
@@ -365,7 +325,7 @@ namespace Volian.Controls.Library
if (_checkoffsAllowed && !(fmtdata.ProcData.CheckOffData.CheckOffList == null) && !(maxindx == 0)) if (_checkoffsAllowed && !(fmtdata.ProcData.CheckOffData.CheckOffList == null) && !(maxindx == 0))
{ {
CheckOffList chkoffList = fmtdata.ProcData.CheckOffData.CheckOffList; CheckOffList chkoffList = fmtdata.ProcData.CheckOffData.CheckOffList;
if (chkoffList != null) chkoffList.Sort(CompareCheckoffUsingOrderBy); // C2020-003 sort the checkoff list via the Index and/or OrderBy elements chkoffList?.Sort(CompareCheckoffUsingOrderBy); // C2020-003 sort the checkoff list via the Index and/or OrderBy elements
cmbCheckoff.Items.Clear(); cmbCheckoff.Items.Clear();
_CheckOffIndex.Clear(); // C2020-003 clear the checkoff index dictionary _CheckOffIndex.Clear(); // C2020-003 clear the checkoff index dictionary
int sortedIndx = 0; int sortedIndx = 0;
@@ -423,15 +383,6 @@ namespace Volian.Controls.Library
tbFSWd.Text = wd.ToString(); tbFSWd.Text = wd.ToString();
tbFSHt.Text = ht.ToString(); tbFSHt.Text = ht.ToString();
//trBarFS.Maximum = Math.Max((int)wd2, trBarFS.Maximum);
//if (wd > trBarFS.Maximum) trBarFS.Maximum = wd + 1;
//trBarFS.Minimum = Math.Min(wd, 72);
//trBarFS.Value = (int)wd;
//ImageItem ii = MyEditItem as ImageItem;
//_origFigureSizeWidth = ii.MyPictureBox.Width;
//tbFSWd.Text = ii.MyPictureBox.Width.ToString();
//tbFSHt.Text = ii.MyPictureBox.Height.ToString();
} }
else else
{ {
@@ -458,11 +409,6 @@ namespace Volian.Controls.Library
// There is also an override flag in the config for the step, used to override the change bar to 'off' // There is also an override flag in the config for the step, used to override the change bar to 'off'
// if the date show it as having one, or allow a change bar to be 'on' if there the dates are // if the date show it as having one, or allow a change bar to be 'on' if there the dates are
// not different. Note also that a user may edit data after the change bar is set to 'on'. // not different. Note also that a user may edit data after the change bar is set to 'on'.
//DateTime curDts;
//using (Item itm = Item.Get(CurItemInfo.ItemID))
//{
// curDts = itm.DTS;
//}
// set change bar radio buttons for the default that there is no change // set change bar radio buttons for the default that there is no change
// bar & override sets it to On. // bar & override sets it to On.
@@ -486,24 +432,13 @@ namespace Volian.Controls.Library
} }
else else
{ {
rbChgBarOff.Checked = (sc.Step_CBOverride == "Off") ? true : false; rbChgBarOff.Checked = (sc.Step_CBOverride == "Off");
rbChgBarOn.Checked = (sc.Step_CBOverride == "On") ? true : false; rbChgBarOn.Checked = (sc.Step_CBOverride == "On");
// there is override settings in the config... If the date time stamp says that text was changed // there is override settings in the config... If the date time stamp says that text was changed
// so a change bar should exist - check override to see how change bar controls are set: // so a change bar should exist - check override to see how change bar controls are set:
// If the date of this is greater than the procedure, a change bar should be displayed - // If the date of this is greater than the procedure, a change bar should be displayed -
// see what the override says. The override states whether change bar is on/off (not // see what the override says. The override states whether change bar is on/off (not
// whether override is on/off) // whether override is on/off)
//if (curDts > CurItemInfo.MyProcedure.DTS)
//{
// rbChgBarOff.Text = "OFF (Override)";
// rbChgBarOn.Text = "ON";
//}
//else
//{
// // date time stamp says no change bar should be displayed:
// rbChgBarOff.Text = "OFF";
// rbChgBarOn.Text = "ON (Override)";
//}
} }
// see if the change id label & text box are visible, i.e. plant has multiple change ids. // see if the change id label & text box are visible, i.e. plant has multiple change ids.
@@ -576,8 +511,7 @@ namespace Volian.Controls.Library
public void SetFigure(double wd, double wd2) public void SetFigure(double wd, double wd2)
{ {
// Check MyEditItem type and cast if needed // Check MyEditItem type and cast if needed
ImageItem ii = MyEditItem as ImageItem; if (!(MyEditItem is ImageItem ii)) return;
if (ii == null) return;
// Set the values as needed // Set the values as needed
trBarFS.Maximum = Math.Max((int)wd2, trBarFS.Maximum); trBarFS.Maximum = Math.Max((int)wd2, trBarFS.Maximum);
@@ -585,8 +519,6 @@ namespace Volian.Controls.Library
trBarFS.Minimum = Math.Min((int)wd, 72); trBarFS.Minimum = Math.Min((int)wd, 72);
trBarFS.Value = (int)wd; trBarFS.Value = (int)wd;
_origFigureSizeWidth = ii.MyPictureBox.Width; _origFigureSizeWidth = ii.MyPictureBox.Width;
//tbFSWd.Text = ii.MyPictureBox.Width.ToString();
//tbFSHt.Text = ii.MyPictureBox.Height.ToString();
} }
private int DoListStepTypes(FormatData fmtdata, StepData topType, string curType) private int DoListStepTypes(FormatData fmtdata, StepData topType, string curType)
@@ -611,26 +543,13 @@ namespace Volian.Controls.Library
} }
return cursel; return cursel;
} }
//private void AddToGallery(StepData sd, string curType)
//{
// DevComponents.DotNetBar.ButtonItem bi = new DevComponents.DotNetBar.ButtonItem("btn" + sd.Type, sd.Type);
// bi.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
// bi.Image = this.imageListStepTypes.Images[0];
// bi.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;
// bi.Checked = (sd.Type == curType);
// galleryContainerStepTypes.SubItems.Add(bi);
// listBoxStepTypes.Items.Add(sd.Type);
//}
#endregion #endregion
#region Events #region Events
private void cbPageBreak_CheckedChanged(object sender, EventArgs e) private void cbPageBreak_CheckedChanged(object sender, EventArgs e)
{ {
if (_Initalizing) return; if (_Initalizing) return;
MyEditItem.SaveContents(); MyEditItem.SaveContents();
StepConfig sc = CurItemInfo.MyConfig as StepConfig; if (!(CurItemInfo.MyConfig is StepConfig sc)) return;
if (sc == null) return;
MyEditItem.ChangeBarForConfigItemChange = false; MyEditItem.ChangeBarForConfigItemChange = false;
if (CurItemInfo.IsHigh) if (CurItemInfo.IsHigh)
sc.Step_NewManualPagebreak = cbPageBreak.Checked; sc.Step_NewManualPagebreak = cbPageBreak.Checked;
@@ -642,8 +561,7 @@ namespace Volian.Controls.Library
{ {
if (_Initalizing) return; if (_Initalizing) return;
MyEditItem.SaveContents(); MyEditItem.SaveContents();
StepConfig sc = CurItemInfo.MyConfig as StepConfig; if (!(CurItemInfo.MyConfig is StepConfig sc)) return;
if (sc == null) return;
MyEditItem.ChangeBarForConfigItemChange = false; MyEditItem.ChangeBarForConfigItemChange = false;
sc.Step_CAS = (cbCAS.Checked) ? "True" : "False"; sc.Step_CAS = (cbCAS.Checked) ? "True" : "False";
MyEditItem.ChangeBarForConfigItemChange = true; MyEditItem.ChangeBarForConfigItemChange = true;
@@ -656,8 +574,7 @@ namespace Volian.Controls.Library
{ {
if (_Initalizing) return; if (_Initalizing) return;
MyEditItem.SaveContents(); MyEditItem.SaveContents();
StepConfig sc = CurItemInfo.MyConfig as StepConfig; if (!(CurItemInfo.MyConfig is StepConfig sc)) return;
if (sc == null) return;
MyEditItem.ChangeBarForConfigItemChange = false; MyEditItem.ChangeBarForConfigItemChange = false;
sc.Step_TCAS = (cbTCAS.Checked) ? "True" : "False"; sc.Step_TCAS = (cbTCAS.Checked) ? "True" : "False";
MyEditItem.ChangeBarForConfigItemChange = true; MyEditItem.ChangeBarForConfigItemChange = true;
@@ -666,8 +583,7 @@ namespace Volian.Controls.Library
{ {
if (_Initalizing) return; if (_Initalizing) return;
MyEditItem.SaveContents(); MyEditItem.SaveContents();
StepConfig sc = CurItemInfo.MyConfig as StepConfig; if (!(CurItemInfo.MyConfig is StepConfig sc)) return;
if (sc == null) return;
MyEditItem.ChangeBarForConfigItemChange = false; MyEditItem.ChangeBarForConfigItemChange = false;
sc.Step_Placekeeper = (cbPlaceKeeper.Checked) ? "Y" : "N"; sc.Step_Placekeeper = (cbPlaceKeeper.Checked) ? "Y" : "N";
MyEditItem.ChangeBarForConfigItemChange = true; MyEditItem.ChangeBarForConfigItemChange = true;
@@ -682,8 +598,7 @@ namespace Volian.Controls.Library
{ {
if (_Initalizing) return; if (_Initalizing) return;
MyEditItem.SaveContents(); MyEditItem.SaveContents();
StepConfig sc = CurItemInfo.MyConfig as StepConfig; if (!(CurItemInfo.MyConfig is StepConfig sc)) return;
if (sc == null) return;
MyEditItem.ChangeBarForConfigItemChange = false; MyEditItem.ChangeBarForConfigItemChange = false;
sc.Step_Placekeeper = (cbPlaceKeeperCont.Checked) ? "C" : "N"; sc.Step_Placekeeper = (cbPlaceKeeperCont.Checked) ? "C" : "N";
MyEditItem.ChangeBarForConfigItemChange = true; MyEditItem.ChangeBarForConfigItemChange = true;
@@ -698,8 +613,7 @@ namespace Volian.Controls.Library
{ {
if (_Initalizing) return; if (_Initalizing) return;
MyEditItem.SaveContents(); MyEditItem.SaveContents();
StepConfig sc = CurItemInfo.MyConfig as StepConfig; if (!(CurItemInfo.MyConfig is StepConfig sc)) return;
if (sc == null) return;
MyEditItem.ChangeBarForConfigItemChange = false; MyEditItem.ChangeBarForConfigItemChange = false;
sc.Step_IncludeInTOC = cbIncludeInTOC.Checked; sc.Step_IncludeInTOC = cbIncludeInTOC.Checked;
MyEditItem.ChangeBarForConfigItemChange = true; MyEditItem.ChangeBarForConfigItemChange = true;
@@ -716,7 +630,7 @@ namespace Volian.Controls.Library
EditItem topEditItem = MyEditItem; EditItem topEditItem = MyEditItem;
MyEditItem.SaveContents(); MyEditItem.SaveContents();
FormatData fmtdata = CurItemInfo.ActiveFormat.PlantFormat.FormatData; FormatData fmtdata = CurItemInfo.ActiveFormat.PlantFormat.FormatData;
string msgBox = null; string msgBox;
if (cbChgAll.Checked) if (cbChgAll.Checked)
{ {
ItemInfo startitm = CurItemInfo.FirstSibling; ItemInfo startitm = CurItemInfo.FirstSibling;
@@ -733,12 +647,6 @@ namespace Volian.Controls.Library
} }
// B2018-120: if caution/note steps have enhanced - change their type too // B2018-120: if caution/note steps have enhanced - change their type too
if (startitm.IsNote || startitm.IsCaution) chgEnh = ChangeTypesEnhanced(startitm); if (startitm.IsNote || startitm.IsCaution) chgEnh = ChangeTypesEnhanced(startitm);
//using (Item itm = Item.Get(startitm.ItemID))
//{
// itm.DTS = DateTime.Now;
// itm.UserID = Volian.Base.Library.VlnSettings.UserID;
// itm.Save();
//}
startitm = startitm.GetNext(); startitm = startitm.GetNext();
} }
msgBox = chgEnh ? string.Format("All Step Types at this level and associated enhanced steps were changed to {0}", listBoxStepTypes.Items[listBoxStepTypes.SelectedIndex]) : msgBox = chgEnh ? string.Format("All Step Types at this level and associated enhanced steps were changed to {0}", listBoxStepTypes.Items[listBoxStepTypes.SelectedIndex]) :
@@ -757,17 +665,9 @@ namespace Volian.Controls.Library
bool chgEnh = false; bool chgEnh = false;
// B2018-120: if caution/note steps have enhanced - change their type too // B2018-120: if caution/note steps have enhanced - change their type too
if (CurItemInfo.IsNote || CurItemInfo.IsCaution) chgEnh = ChangeTypesEnhanced(CurItemInfo); if (CurItemInfo.IsNote || CurItemInfo.IsCaution) chgEnh = ChangeTypesEnhanced(CurItemInfo);
//using (Item itm1 = Item.Get(CurItemInfo.ItemID))
//{
// itm1.DTS = DateTime.Now;
// itm1.UserID = Volian.Base.Library.VlnSettings.UserID;
// itm1.Save();
//}
msgBox = chgEnh ? string.Format("This Step Type and associated enhanced step were changed to {0}", listBoxStepTypes.Items[listBoxStepTypes.SelectedIndex]): msgBox = chgEnh ? string.Format("This Step Type and associated enhanced step were changed to {0}", listBoxStepTypes.Items[listBoxStepTypes.SelectedIndex]):
string.Format("This Step Type was changed to {0}", listBoxStepTypes.Items[listBoxStepTypes.SelectedIndex]); string.Format("This Step Type was changed to {0}", listBoxStepTypes.Items[listBoxStepTypes.SelectedIndex]);
} }
// the follow line was to try and fix a refresh problem when you change the type of a new substep
//topEditItem.MyStepPanel.Reset();
topEditItem.SetAllTabs(); topEditItem.SetAllTabs();
FlexibleMessageBox.Show(msgBox); FlexibleMessageBox.Show(msgBox);
@@ -821,12 +721,6 @@ namespace Volian.Controls.Library
{ {
StepConfig sc = CurItemInfo.MyConfig as StepConfig; StepConfig sc = CurItemInfo.MyConfig as StepConfig;
sc.Step_CBOverride = CurItemInfo.HasChanges ? null : "On"; sc.Step_CBOverride = CurItemInfo.HasChanges ? null : "On";
//using (Content cnt = Content.Get(CurItemInfo.MyContent.ContentID))
//{
// cnt.DTS = DateTime.Now;
// cnt.UserID = Volian.Base.Library.VlnSettings.UserID;
// cnt.Save();
//}
} }
} }
private void rbChgBarOvrRideOff_CheckedChanged(object sender, EventArgs e) private void rbChgBarOvrRideOff_CheckedChanged(object sender, EventArgs e)
@@ -840,12 +734,6 @@ namespace Volian.Controls.Library
{ {
StepConfig sc = CurItemInfo.MyConfig as StepConfig; StepConfig sc = CurItemInfo.MyConfig as StepConfig;
sc.Step_CBOverride = CurItemInfo.HasChanges ? "Off" :null; sc.Step_CBOverride = CurItemInfo.HasChanges ? "Off" :null;
//using (Content cnt = Content.Get(CurItemInfo.MyContent.ContentID))
//{
// cnt.DTS = CurItemInfo.MyProcedure.DTS;
// cnt.UserID = CurItemInfo.MyProcedure.UserID;
// cnt.Save();
//}
} }
} }
private void cmbCheckoff_SelectedIndexChanged(object sender, EventArgs e) private void cmbCheckoff_SelectedIndexChanged(object sender, EventArgs e)
@@ -856,25 +744,14 @@ namespace Volian.Controls.Library
int indx = _CheckOffIndex[cmbCheckoff.SelectedIndex]; // C2020-003 get the non-sorted index from the sorted index int indx = _CheckOffIndex[cmbCheckoff.SelectedIndex]; // C2020-003 get the non-sorted index from the sorted index
StepConfig sc = CurItemInfo.MyConfig as StepConfig; StepConfig sc = CurItemInfo.MyConfig as StepConfig;
sc.Step_CheckOffIndex = indx; sc.Step_CheckOffIndex = indx;
//using (Content cnt = Content.Get(CurItemInfo.MyContent.ContentID))
//{
// cnt.DTS = CurItemInfo.MyProcedure.DTS;
// cnt.UserID = CurItemInfo.MyProcedure.UserID;
// cnt.Save();
//}
} }
// C2029-025 Show or hide replace words. Can highlight replace words in editor. // C2029-025 Show or hide replace words. Can highlight replace words in editor.
private void cmbShwRplWds_SelectedIndexChanged(object sender, EventArgs e) // new show replace words private void cmbShwRplWds_SelectedIndexChanged(object sender, EventArgs e) // new show replace words
{ {
// --------
if (_Initalizing) return; if (_Initalizing) return;
MyEditItem.SaveContents(); MyEditItem.SaveContents();
StepConfig sc = CurItemInfo.MyConfig as StepConfig; if (!(CurItemInfo.MyConfig is StepConfig sc)) return;
if (sc == null) return;
MyEditItem.ChangeBarForConfigItemChange = false; MyEditItem.ChangeBarForConfigItemChange = false;
//sc.Step_DisableInitialLine = cbInitialLine.Checked;
sc.Step_ShwRplWdsIndex = cmbShwRplWds.SelectedIndex; sc.Step_ShwRplWdsIndex = cmbShwRplWds.SelectedIndex;
MyEditItem.ChangeBarForConfigItemChange = true; MyEditItem.ChangeBarForConfigItemChange = true;
@@ -892,8 +769,7 @@ namespace Volian.Controls.Library
{ {
// User left responsibilty field. If text changed, then prompt // User left responsibilty field. If text changed, then prompt
// to see if save should occur. // to see if save should occur.
StepConfig sc = CurItemInfo.MyConfig as StepConfig; if (!(CurItemInfo.MyConfig is StepConfig sc)) return;
if (sc == null) return;
bool bothEmpty = (sc.Step_Responsibility == null || sc.Step_Responsibility == "") && (tbRespons.Text == null || tbRespons.Text == ""); bool bothEmpty = (sc.Step_Responsibility == null || sc.Step_Responsibility == "") && (tbRespons.Text == null || tbRespons.Text == "");
if (!bothEmpty && sc.Step_Responsibility != tbRespons.Text) if (!bothEmpty && sc.Step_Responsibility != tbRespons.Text)
{ {
@@ -917,14 +793,14 @@ namespace Volian.Controls.Library
{ {
if (MyEditItem is ImageItem) if (MyEditItem is ImageItem)
{ {
int wd = 0; int wd;
int ht = 0; int ht;
try try
{ {
wd = int.Parse(tbFSWd.Text); wd = int.Parse(tbFSWd.Text);
ht = int.Parse(tbFSHt.Text); ht = int.Parse(tbFSHt.Text);
} }
catch (Exception ex) catch (Exception)
{ {
wd = 0; wd = 0;
ht = 0; ht = 0;
@@ -966,7 +842,7 @@ namespace Volian.Controls.Library
{ {
newHt = int.Parse(tbFSWd.Text); newHt = int.Parse(tbFSWd.Text);
} }
catch (Exception ex) catch (Exception)
{ {
invaliddata = true; invaliddata = true;
} }
@@ -984,8 +860,7 @@ namespace Volian.Controls.Library
{ {
if (_Initalizing) return; if (_Initalizing) return;
MyEditItem.SaveContents(); MyEditItem.SaveContents();
StepConfig sc = CurItemInfo.MyConfig as StepConfig; if (!(CurItemInfo.MyConfig is StepConfig sc)) return;
if (sc == null) return;
MyEditItem.ChangeBarForConfigItemChange = false; MyEditItem.ChangeBarForConfigItemChange = false;
sc.Step_PreferredPagebreak = cbPrefPageBreak.Checked; sc.Step_PreferredPagebreak = cbPrefPageBreak.Checked;
MyEditItem.ChangeBarForConfigItemChange = true; MyEditItem.ChangeBarForConfigItemChange = true;
@@ -995,8 +870,7 @@ namespace Volian.Controls.Library
{ {
if (_Initalizing) return; if (_Initalizing) return;
MyEditItem.SaveContents(); MyEditItem.SaveContents();
StepConfig sc = CurItemInfo.MyConfig as StepConfig; if (!(CurItemInfo.MyConfig is StepConfig sc)) return;
if (sc == null) return;
MyEditItem.ChangeBarForConfigItemChange = false; MyEditItem.ChangeBarForConfigItemChange = false;
sc.Step_DisableInitialLine = cbInitialLine.Checked; sc.Step_DisableInitialLine = cbInitialLine.Checked;
MyEditItem.ChangeBarForConfigItemChange = true; MyEditItem.ChangeBarForConfigItemChange = true;
@@ -1023,25 +897,5 @@ namespace Volian.Controls.Library
} }
} }
//private void txbxAltConActSumText_Leave(object sender, EventArgs e)
//{
// // User left Atlernate Continuous Action Text field. If text changed, then prompt
// // to see if save should occur.
// StepConfig sc = CurItemInfo.MyConfig as StepConfig;
// if (sc == null) return;
// bool bothEmpty = (sc.Step_AlternateContActSumText == null || sc.Step_AlternateContActSumText == "") && (txbxAltConActSumText.Text == null || txbxAltConActSumText.Text == "");
// if (!bothEmpty && sc.Step_AlternateContActSumText != txbxAltConActSumText.Text)
// {
// if (MessageBox.Show(this, "Do you want to save the Alternate Continuous Action Text?", "Confirm Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
// {
// MyEditItem.SaveContents();
// sc.Step_AlternateContActSumText = txbxAltConActSumText.Text; // this actually saves the config
// }
// else
// txbxAltConActSumText.Text = sc.Step_AlternateContActSumText;
// }
//}
} }
} }
@@ -1,16 +1,13 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Text.RegularExpressions;
using AT.STO.UI.Win; using AT.STO.UI.Win;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using Volian.Base.Library;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
using System.Linq;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
@@ -116,14 +113,8 @@ namespace Volian.Controls.Library
private bool _DoingRange = false; // flags if in 'range' transition mode private bool _DoingRange = false; // flags if in 'range' transition mode
private VETreeNode _RangeNode1; private VETreeNode _RangeNode1;
private VETreeNode _RangeNode2; private VETreeNode _RangeNode2;
// Use _RangeColor to show highlighting for steps selected in range. This is set from
// calling methods from application settings. If not default to aquamarine. public Color RangeColor { get; set; } = Color.LightGray;
private Color _RangeColor = Color.LightGray;
public Color RangeColor
{
get { return _RangeColor; }
set { _RangeColor = value; }
}
private StepRTB _MyRTB; // Current MyDisplayRTB, i.e. insert transition to it. private StepRTB _MyRTB; // Current MyDisplayRTB, i.e. insert transition to it.
public StepRTB MyRTB public StepRTB MyRTB
{ {
@@ -148,7 +139,6 @@ namespace Volian.Controls.Library
CurTrans = args.MyLinkText.MyTransitionInfo; CurTrans = args.MyLinkText.MyTransitionInfo;
} }
private ItemInfo _CurrentItemProcedure; // the selected item's procedure private ItemInfo _CurrentItemProcedure; // the selected item's procedure
private ItemInfo _CurrentToProcedure; // the 'to' location's procedure (may be same as _CurrentItemProcedure)
private ItemInfo _CurrentProcedure; // current procedure used to set all of the controls (may switch between above two) private ItemInfo _CurrentProcedure; // current procedure used to set all of the controls (may switch between above two)
private int _CurrentProcIndex; private int _CurrentProcIndex;
private bool _AlwaysDisableSets; // true if there is only 1 item in tree/combo for sets private bool _AlwaysDisableSets; // true if there is only 1 item in tree/combo for sets
@@ -219,7 +209,6 @@ namespace Volian.Controls.Library
} }
} }
_CurrentProcedure = tmpitm; _CurrentProcedure = tmpitm;
_CurrentToProcedure = _CurrentProcedure;
if (_CurTrans == null) if (_CurTrans == null)
_CurrentItemProcedure = _CurrentProcedure; _CurrentItemProcedure = _CurrentProcedure;
else else
@@ -271,7 +260,6 @@ namespace Volian.Controls.Library
else if (secitm != null && secitm.Steps != null && secitm.Steps.Count > 0) else if (secitm != null && secitm.Steps != null && secitm.Steps.Count > 0)
stpitm = selitm.Steps[0]; stpitm = selitm.Steps[0];
if (!_DoingRange) tvTranFillIn(stpitm); // range code fills in tree. if (!_DoingRange) tvTranFillIn(stpitm); // range code fills in tree.
//if (_DoingRange) tvInitHiliteRange(rangeSameLevel, stpitm, rngitm, (i1 < i2) ? i2 : i1);
} }
else else
{ {
@@ -283,16 +271,13 @@ namespace Volian.Controls.Library
} }
private void tvInitHiliteRange() //bool rangeSameLevel, ItemInfo stpitm, ItemInfo rngitm, int uplevel) private void tvInitHiliteRange() //bool rangeSameLevel, ItemInfo stpitm, ItemInfo rngitm, int uplevel)
{ {
ItemInfo toItm = _CurTrans.MyItemToID; _ = _CurTrans.MyItemToID;
ItemInfo rngItm = null;
// figure out whether at same level, have same parent and have same HLS: // figure out whether at same level, have same parent and have same HLS:
ItemInfo itm1 = _CurTrans.MyItemToID; ItemInfo itm1 = _CurTrans.MyItemToID;
ItemInfo itm2 = _CurTrans.MyItemRangeID; ItemInfo itm2 = _CurTrans.MyItemRangeID;
// Invalid existing transition // Invalid existing transition
if (itm2.ActiveParent == null || itm1.ActiveParent == null) if (itm2.ActiveParent == null || itm1.ActiveParent == null)
return; return;
//if (_CurTrans.TranType == 2 && itm1.ItemID == itm2.ItemID) itm2 = itm1.LastSibling;
bool samHLS = itm1.MyHLS.ItemID == itm2.MyHLS.ItemID;
int lev1 = 0; int lev1 = 0;
int lev2 = 0; int lev2 = 0;
while (!itm1.IsHigh) while (!itm1.IsHigh)
@@ -305,7 +290,6 @@ namespace Volian.Controls.Library
lev2++; lev2++;
itm2 = itm2.MyParent; itm2 = itm2.MyParent;
} }
bool samLevel = lev1 == lev2;
// For each range item, go to common level's parent. // For each range item, go to common level's parent.
int cnt = lev1+1; int cnt = lev1+1;
ItemInfo sameParent1 = _CurTrans.MyItemToID; ItemInfo sameParent1 = _CurTrans.MyItemToID;
@@ -327,7 +311,7 @@ namespace Volian.Controls.Library
// now add nodes for the subtrees so that highlighting can be done. Do 'to' item // now add nodes for the subtrees so that highlighting can be done. Do 'to' item
// first. If 'range' item is at same level, won't need to do anymore processing. // first. If 'range' item is at same level, won't need to do anymore processing.
ItemInfo toItem = sameParent1.Ordinal<=sameParent2.Ordinal?_CurTrans.MyItemToID:_CurTrans.MyItemRangeID; ItemInfo toItem = sameParent1.Ordinal<=sameParent2.Ordinal?_CurTrans.MyItemToID:_CurTrans.MyItemRangeID;
ItemInfo rngItem = null; ItemInfo rngItem;
if (_CurTrans.TranType == 2 && _CurTrans.MyItemToID == _CurTrans.MyItemRangeID) if (_CurTrans.TranType == 2 && _CurTrans.MyItemToID == _CurTrans.MyItemRangeID)
{ {
@@ -452,51 +436,6 @@ namespace Volian.Controls.Library
vlnTreeComboSets.DropDownControl.SelectedNode = topnode; vlnTreeComboSets.DropDownControl.SelectedNode = topnode;
vlnTreeComboSets.DropDownControl.BeforeExpand += new TreeViewCancelEventHandler(vlnTreeComboSets_BeforeExpand); vlnTreeComboSets.DropDownControl.BeforeExpand += new TreeViewCancelEventHandler(vlnTreeComboSets_BeforeExpand);
#region CheckIfNeeded Commented Out
//vlnTreeComboSets.DropDownControl. = vlnTreeComboSets.Width;
// The DropDownNode should be at a DocVersion now. The expanded DocVersion
// is the one that matches mydocversion
//tmpfi = mydocversion.ActiveParent as FolderInfo;
//DocVersionInfoList dvlist = tmpfi.FolderDocVersions;
//DropDownNode tnDV = null;
// Once at a docversions, only allow working
// draft sets. Use DocVersion that we're in, to expand it showing the active procedure.
// first count how many versions can be displayed, i.e. only workingdraft?
// if more than one, put out a tree node for them.
//int cntdocv = 0;
//foreach (DocVersionInfo dv in dvlist)
//{
// if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft) cntdocv++;
//}
//if (cntdocv>1)
//{
// foreach (DocVersionInfo dv in dvlist)
// {
// if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft)
// {
// DropDownNode tn = new DropDownNode(dv.VersionID, dv.ToString());
// tn.Tag = dv;
// if (topnode != null)
// topnode.Nodes.Add(tn);
// else
// vlnTreeComboSets.DropDownControl.Nodes.Add(tn);
// if (dv.VersionID == mydocversion.VersionID)
// {
// tnDV = tn;
// vlnTreeComboSets.Value = tnDV;
// vlnTreeComboSets.DropDownControl.SelectedNode = tnDV;
// }
// //else if (dv.HasChildren) // allow for '+' for tree expansion
// //{
// // DropDownNode tnt = new DropDownNode(0,"VLN_DUMMY");
// // tn.Nodes.Add(tnt);
// //}
// }
// }
//}
#endregion
} }
private void ListBoxTranFmtFillIn() private void ListBoxTranFmtFillIn()
{ {
@@ -504,7 +443,7 @@ namespace Volian.Controls.Library
listBoxTranFmt.Items.Clear(); listBoxTranFmt.Items.Clear();
for (int i = 0; i < ttl.MaxIndex; i++) for (int i = 0; i < ttl.MaxIndex; i++)
listBoxTranFmt.Items.Add(new TransItem(ttl[i].TransMenu.Replace("?.",""),ttl[i].TransFormat.Replace("?.",""))); listBoxTranFmt.Items.Add(new TransItem(ttl[i].TransMenu.Replace("?.",""),ttl[i].TransFormat.Replace("?.","")));
//listBoxTranFmt.Items.Add(ttl[i].TransFormat.Replace("?.",""));
listBoxTranFmt.SelectedIndex = _TranFmtIndx; listBoxTranFmt.SelectedIndex = _TranFmtIndx;
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
_DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast; _DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast;
@@ -532,18 +471,8 @@ namespace Volian.Controls.Library
if (startitm.MyContent.Type < 20000) return; if (startitm.MyContent.Type < 20000) return;
groupPanelTranstionSteps.Style.BackColor = Color.Cornsilk; groupPanelTranstionSteps.Style.BackColor = Color.Cornsilk;
// For the tree view, use parent, unless already at HLS. If at HLS, use this level. // For the tree view, use parent, unless already at HLS. If at HLS, use this level.
//ItemInfo selitm2 = startitm.MyHLS;
ItemInfo selSubSec = secitm.Sections[0]; ItemInfo selSubSec = secitm.Sections[0];
// The commented out code below is for displaying the steps from the first sub-section B2025-035
//ItemInfo subSelStep = selSubSec.Steps[0];
//E_TransUI etm2 = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
//if (subSelStep.IsInRNO)
// startitm = subSelStep.FirstSibling; // if in RNO tree, start out with HLS
//else
// startitm = subSelStep != null ? subSelStep.FirstSibling : startitm.FirstSibling;
// B2025-035
ItemInfo subSelStep = secitm.Sections[0]; ItemInfo subSelStep = secitm.Sections[0];
E_TransUI etm2 = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; E_TransUI etm2 = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
if (subSelStep.IsInRNO) if (subSelStep.IsInRNO)
@@ -551,12 +480,13 @@ namespace Volian.Controls.Library
else else
startitm = subSelStep != null ? subSelStep.FirstSibling : startitm.FirstSibling; startitm = subSelStep != null ? subSelStep.FirstSibling : startitm.FirstSibling;
// B2025-035
bool setsel2 = false; bool setsel2 = false;
while (startitm != null) while (startitm != null)
{ {
VETreeNode tvn = new VETreeNode(startitm, false); VETreeNode tvn = new VETreeNode(startitm, false)
tvn.Tag = startitm; {
Tag = startitm
};
int active = this.tvTran.Nodes.Add(tvn); int active = this.tvTran.Nodes.Add(tvn);
if (subSelStep != null && startitm.ItemID == subSelStep.ItemID) if (subSelStep != null && startitm.ItemID == subSelStep.ItemID)
{ {
@@ -580,7 +510,6 @@ namespace Volian.Controls.Library
groupPanelTranstionSteps.Style.BackColor = Color.Cornsilk; groupPanelTranstionSteps.Style.BackColor = Color.Cornsilk;
// For the tree view, use parent, unless already at HLS. If at HLS, use this level. // For the tree view, use parent, unless already at HLS. If at HLS, use this level.
ItemInfo selitm = startitm.MyHLS; ItemInfo selitm = startitm.MyHLS;
//if (_CurTrans == null)selitm = startitm.MyHLS;
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
if (startitm.IsInRNO) if (startitm.IsInRNO)
startitm = selitm.FirstSibling; // if in RNO tree, start out with HLS startitm = selitm.FirstSibling; // if in RNO tree, start out with HLS
@@ -589,8 +518,10 @@ namespace Volian.Controls.Library
bool setsel = false; bool setsel = false;
while (startitm != null) while (startitm != null)
{ {
VETreeNode tvn = new VETreeNode(startitm, false); VETreeNode tvn = new VETreeNode(startitm, false)
tvn.Tag = startitm; {
Tag = startitm
};
int active = this.tvTran.Nodes.Add(tvn); int active = this.tvTran.Nodes.Add(tvn);
if (selitm !=null && startitm.ItemID == selitm.ItemID) if (selitm !=null && startitm.ItemID == selitm.ItemID)
{ {
@@ -614,9 +545,7 @@ namespace Volian.Controls.Library
if (secitm == null || secitm.MyContent.Type < 10000) return; if (secitm == null || secitm.MyContent.Type < 10000) return;
// if sectstart is not -1, then use this as the section to select, otherwise // if sectstart is not -1, then use this as the section to select, otherwise
// use the id for the item passed in. // use the id for the item passed in.
int startitm = secstart;
if (clear && secstart < 0) secstart = secitm.ItemID; if (clear && secstart < 0) secstart = secitm.ItemID;
ItemInfo selitm = secitm; // this is the selected 'section'
secitm = secitm.FirstSibling; secitm = secitm.FirstSibling;
while (secitm != null) while (secitm != null)
{ {
@@ -793,19 +722,6 @@ namespace Volian.Controls.Library
} }
} }
} }
// B2018-009 Eliminate Working Draft (DocVersions) from the procedure tree for transitions
//else if (fi.FolderDocVersionCount > 0)
//{
// foreach (DocVersionInfo dv in fi.FolderDocVersions)
// {
// if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft)
// {
// DropDownNode newnode = new DropDownNode(dv.VersionID, dv.ToString());
// newnode.Tag = dv;
// par.Nodes.Add(newnode);
// }
// }
//}
} }
vlnTreeComboSets.Value = par; vlnTreeComboSets.Value = par;
vlnTreeComboSets.DropDownControl.SelectedNode = par; vlnTreeComboSets.DropDownControl.SelectedNode = par;
@@ -821,9 +737,9 @@ namespace Volian.Controls.Library
// selected the docversion itself.... // selected the docversion itself....
bool defines_set = false; bool defines_set = false;
FolderInfo fi = null; FolderInfo fi = null;
if (obj is FolderInfo) if (obj is FolderInfo finfo)
{ {
fi = (FolderInfo)obj; fi = finfo;
if (fi.ChildFolderCount == 0) if (fi.ChildFolderCount == 0)
{ {
// note that the folder may contain more than one docversion, check for // note that the folder may contain more than one docversion, check for
@@ -955,16 +871,6 @@ namespace Volian.Controls.Library
if (_DoingRange) tvTran.SelectedNode = null; if (_DoingRange) tvTran.SelectedNode = null;
SaveCancelEnabling(); SaveCancelEnabling();
} }
//private void btnUp1_Click(object sender, EventArgs e)
//{
// // if StepAllowNone, then use the second node in the tree view.
// int indx = 0;
// if (tvTran.Nodes[0].Tag == null) indx = 1;
// // if at HLS, don't do anything.
// ItemInfo curitm = (ItemInfo)((VETreeNode)tvTran.Nodes[indx]).VEObject;
// if (curitm.IsHigh) return;
// tvTranFillIn(curitm);
//}
private void tvTran_BeforeExpand(object sender, TreeViewCancelEventArgs e) private void tvTran_BeforeExpand(object sender, TreeViewCancelEventArgs e)
{ {
VETreeNode tn = ((VETreeNode)e.Node); VETreeNode tn = ((VETreeNode)e.Node);
@@ -985,11 +891,6 @@ namespace Volian.Controls.Library
// it & disable. // it & disable.
ItemInfo secitm = (ItemInfo)cbTranSects.SelectedItem; ItemInfo secitm = (ItemInfo)cbTranSects.SelectedItem;
//if (secitm.IsStepSection)
//{
// cbTranSects.SelectedItem.Sections[0];
//}
if (!secitm.IsStepSection) if (!secitm.IsStepSection)
{ {
tvTran.Nodes.Clear(); tvTran.Nodes.Clear();
@@ -997,7 +898,8 @@ namespace Volian.Controls.Library
cbIncStepNum.Enabled = false; // C2020-028: disable/uncheck 'Include Step Number' if on Word doc cbIncStepNum.Enabled = false; // C2020-028: disable/uncheck 'Include Step Number' if on Word doc
cbIncStepNum.Checked = false; cbIncStepNum.Checked = false;
// Set Save & Cancel enabling, depending on whether section can be an endpoint. // Set Save & Cancel enabling, depending on whether section can be an endpoint.
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; //Following line is for Debugging
//E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
SaveCancelEnabling(); SaveCancelEnabling();
} }
else else
@@ -1065,7 +967,7 @@ namespace Volian.Controls.Library
// 1) Look in ProcedureConfig/SectionStart // 1) Look in ProcedureConfig/SectionStart
ProcedureConfig pc = (ProcedureConfig)prcitm.MyConfig; ProcedureConfig pc = (ProcedureConfig)prcitm.MyConfig;
int sectstartid = -1; int sectstartid = -1;
string ss = pc == null ? null : pc.SectionStart; string ss = pc?.SectionStart;
SectionInfo si = null; SectionInfo si = null;
if (ss != null && ss != "") if (ss != null && ss != "")
{ {
@@ -1077,7 +979,7 @@ namespace Volian.Controls.Library
if (si.MyProcedure.ItemID == prcitm.ItemID) return sectstartid; if (si.MyProcedure.ItemID == prcitm.ItemID) return sectstartid;
// The following code fixes the sectionstart property for the Copy Procedure function. This code will correct // The following code fixes the sectionstart property for the Copy Procedure function. This code will correct
// any procedures that were copied prior to the implementation of this the copy procedure function fix. // any procedures that were copied prior to the implementation of this the copy procedure function fix.
foreach (SectionInfo si1 in prcitm.Sections) foreach (SectionInfo si1 in prcitm.Sections.OfType<SectionInfo>())
{ {
if (si.DisplayNumber == si1.DisplayNumber && si.DisplayText == si1.DisplayText) if (si.DisplayNumber == si1.DisplayNumber && si.DisplayText == si1.DisplayText)
{ {
@@ -1096,22 +998,21 @@ namespace Volian.Controls.Library
// 2) Look in SectionConfig/OriginalSteps = 'Y' // 2) Look in SectionConfig/OriginalSteps = 'Y'
if (prcitm.Sections != null) if (prcitm.Sections != null)
{ {
foreach (SectionInfo sio in prcitm.Sections) foreach (SectionInfo sio in prcitm.Sections.OfType<SectionInfo>())
{ {
SectionConfig sc = sio.MyConfig as SectionConfig; if (sio.MyConfig is SectionConfig sc && sc.Section_OriginalSteps == "Y")
if (sc != null && sc.Section_OriginalSteps == "Y")
{ {
return sio.ItemID; return sio.ItemID;
} }
} }
// 3) Find if any of the section titles contain 'PROCEDURES STEPS' // 3) Find if any of the section titles contain 'PROCEDURES STEPS'
foreach (SectionInfo sit in prcitm.Sections) foreach (SectionInfo sit in prcitm.Sections.OfType<SectionInfo>())
{ {
if (sit.DisplayText.ToUpper().Contains("PROCEDURE STEPS")) if (sit.DisplayText.ToUpper().Contains("PROCEDURE STEPS"))
return sit.ItemID; return sit.ItemID;
} }
foreach (SectionInfo sit in prcitm.Sections) foreach (SectionInfo sit in prcitm.Sections.OfType<SectionInfo>())
{ {
if (sit.DisplayText.ToUpper().Equals("PROCEDURE"))// bug fix: B2015-003 if (sit.DisplayText.ToUpper().Equals("PROCEDURE"))// bug fix: B2015-003
return sit.ItemID; return sit.ItemID;
@@ -1120,17 +1021,17 @@ namespace Volian.Controls.Library
// 4) Format has flag that a default section is not required so return 1st section. // 4) Format has flag that a default section is not required so return 1st section.
if (prcitm.Sections != null) if (prcitm.Sections != null)
{ {
foreach (SectionInfo sid in prcitm.Sections) foreach (SectionInfo sid in prcitm.Sections.OfType<SectionInfo>())
{ {
if (sid.IsStepSection && sid.ActiveFormat.PlantFormat.FormatData.TransData.NoDefaultSectReq) return sid.ItemID; if (sid.IsStepSection && sid.ActiveFormat.PlantFormat.FormatData.TransData.NoDefaultSectReq) return sid.ItemID;
} }
// 3) Find if any of the section titles contain 'PROCEDURES STEPS' // 3) Find if any of the section titles contain 'PROCEDURES STEPS'
foreach (SectionInfo sit in prcitm.Sections) foreach (SectionInfo sit in prcitm.Sections.OfType<SectionInfo>())
{ {
if (sit.DisplayText.ToUpper().Contains("PROCEDURE STEPS")) if (sit.DisplayText.ToUpper().Contains("PROCEDURE STEPS"))
return sit.ItemID; return sit.ItemID;
} }
foreach (SectionInfo sit in prcitm.Sections) foreach (SectionInfo sit in prcitm.Sections.OfType<SectionInfo>())
{ {
if (sit.DisplayText.ToUpper().Equals("PROCEDURE"))// bug fix: B2015-003 if (sit.DisplayText.ToUpper().Equals("PROCEDURE"))// bug fix: B2015-003
return sit.ItemID; return sit.ItemID;
@@ -1173,8 +1074,7 @@ namespace Volian.Controls.Library
// check if node is a true end-point, i.e. not a 'part' node. If part node, don't // check if node is a true end-point, i.e. not a 'part' node. If part node, don't
// allow selection. // allow selection.
VETreeNode vt = tvTran.SelectedNode as VETreeNode; VETreeNode vt = tvTran.SelectedNode as VETreeNode;
ItemInfo selii = vt.VEObject as ItemInfo; if (!(vt.VEObject is ItemInfo selii))
if (selii == null)
{ {
FlexibleMessageBox.Show("Must select a valid step, not a grouping part such as 'RNO', 'Steps', etc"); FlexibleMessageBox.Show("Must select a valid step, not a grouping part such as 'RNO', 'Steps', etc");
return; return;
@@ -1197,7 +1097,7 @@ namespace Volian.Controls.Library
if (_RangeNode1 == null || (_RangeNode1 != null && _RangeNode2 != null)) if (_RangeNode1 == null || (_RangeNode1 != null && _RangeNode2 != null))
{ {
if (_RangeNode1 != null) tvTranRangeHilites(false, _RangeNode1, _RangeNode2); if (_RangeNode1 != null) tvTranRangeHilites(false, _RangeNode1, _RangeNode2);
tvTran.SelectedNode.BackColor = _RangeColor; tvTran.SelectedNode.BackColor = RangeColor;
_RangeNode1 = (VETreeNode)tvTran.SelectedNode; _RangeNode1 = (VETreeNode)tvTran.SelectedNode;
_RangeNode2 = null; _RangeNode2 = null;
lblxTranRangeTip.Text = "Select Last Step \r\nfor Range"; lblxTranRangeTip.Text = "Select Last Step \r\nfor Range";
@@ -1208,7 +1108,7 @@ namespace Volian.Controls.Library
{ {
if (_RangeNode2 != null) tvTranRangeHilites(false, _RangeNode1, _RangeNode2); if (_RangeNode2 != null) tvTranRangeHilites(false, _RangeNode1, _RangeNode2);
_RangeNode2 = (VETreeNode)tvTran.SelectedNode; _RangeNode2 = (VETreeNode)tvTran.SelectedNode;
tvTran.SelectedNode.BackColor = _RangeColor; tvTran.SelectedNode.BackColor = RangeColor;
tvTranRangeHilites(true, _RangeNode1, _RangeNode2); tvTranRangeHilites(true, _RangeNode1, _RangeNode2);
lblxTranRangeTip.Text = "Select First Transition\r\nfor Range"; lblxTranRangeTip.Text = "Select First Transition\r\nfor Range";
lblxTranRangeTip.BackColor = Color.Yellow; lblxTranRangeTip.BackColor = Color.Yellow;
@@ -1219,8 +1119,6 @@ namespace Volian.Controls.Library
} }
private void SaveCancelEnabling() private void SaveCancelEnabling()
{ {
//bool hasChanged = _CurItemFrom != _SavCurItemFrom || _TranFmtIndx != _SavTranFmtIndx
// || ( selii != null && _CurTrans.ToID != selii.ItemID);
bool hasChanged = SettingsChanged; bool hasChanged = SettingsChanged;
bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep; bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep;
// B2018-002 - Invalid Transitions - Set button enabled if it has a default section or it doesn't need a default // B2018-002 - Invalid Transitions - Set button enabled if it has a default section or it doesn't need a default
@@ -1240,25 +1138,6 @@ namespace Volian.Controls.Library
null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
// B2024-007 color of transition panel was not toggling properly // B2024-007 color of transition panel was not toggling properly
groupPanelTranFmt.Style.BackColor = !HasDefault && NeedsDefault ? Color.Red : Color.Orange; groupPanelTranFmt.Style.BackColor = !HasDefault && NeedsDefault ? Color.Red : Color.Orange;
//btnTranSave.Enabled = allowSave;
//if (CurTrans != null && selii != null)
//{
// if (CurTrans.ToID == selii.ItemID)
// {
// // if the checkbox for including a page number (UseTransitionModifier flag is true)
// // then need to check if this has been changed, and allow a save/cancel if so.
// if (cbPageNum.Visible && _ModExistingPageNum != cbPageNum.Checked)
// btnTranCancel.Enabled = btnTranSave.Enabled = true;
// else
// btnTranCancel.Enabled = btnTranSave.Enabled = false;
// }
// else
// {
// btnTranCancel.Enabled = true;
// btnTranSave.Enabled = allowSave;
// }
//}
//else btnTranCancel.Enabled = btnTranSave.Enabled = allowSave;
} }
private void btnTranCancel_Click(object sender, EventArgs e) private void btnTranCancel_Click(object sender, EventArgs e)
{ {
@@ -1314,7 +1193,7 @@ namespace Volian.Controls.Library
} }
private void btnTranSave_Click(object sender, EventArgs e) private void btnTranSave_Click(object sender, EventArgs e)
{ {
string trantxt = "(Resolved Transition Text)"; string trantxt; //Resolved Transition Text
string linktxt = null; string linktxt = null;
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
// if must have a step, test for this first. // if must have a step, test for this first.
@@ -1370,14 +1249,11 @@ namespace Volian.Controls.Library
// be sure that the order is right, i.e. to is before range in list. // be sure that the order is right, i.e. to is before range in list.
if (toItem.ItemID != rangeItem.ItemID) if (toItem.ItemID != rangeItem.ItemID)
{ {
Boolean switchIds = false;
// check for order of hls first, then do within sibling list. // check for order of hls first, then do within sibling list.
switchIds = RangeItemAndToItemNeedsSwitched(toItem, rangeItem); // B2021-115 switchIds was being set to true when it should not have Boolean switchIds = RangeItemAndToItemNeedsSwitched(toItem, rangeItem); // B2021-115 switchIds was being set to true when it should not have
if (switchIds) if (switchIds)
{ {
ItemInfo switchItem = toItem; (rangeItem, toItem) = (toItem, rangeItem);
toItem = rangeItem;
rangeItem = switchItem;
} }
} }
linktxt = string.Format("#Link:TransitionRange:{0} <NewID> {1} {2}", listBoxTranFmt.SelectedIndex, toItem.ItemID, rangeItem.ItemID); linktxt = string.Format("#Link:TransitionRange:{0} <NewID> {1} {2}", listBoxTranFmt.SelectedIndex, toItem.ItemID, rangeItem.ItemID);
@@ -1496,7 +1372,7 @@ namespace Volian.Controls.Library
if (node1==null && node2==null) return; if (node1==null && node2==null) return;
if (node1 != null && node2 == null) if (node1 != null && node2 == null)
{ {
node1.BackColor = on ? _RangeColor : tvTran.BackColor; node1.BackColor = on ? RangeColor : tvTran.BackColor;
return; return;
} }
// If node2 is below node1 in the tree switch them... get to high level step & // If node2 is below node1 in the tree switch them... get to high level step &
@@ -1520,9 +1396,7 @@ namespace Volian.Controls.Library
} }
if (i1 > i2) if (i1 > i2)
{ {
VETreeNode t = node2; (node1, node2) = (node2, node1);
node2 = node1;
node1 = t;
} }
// Turn Hilighting on/off (depending on bool argument) between the two nodes // Turn Hilighting on/off (depending on bool argument) between the two nodes
@@ -1551,8 +1425,8 @@ namespace Volian.Controls.Library
VETreeNode cur = node1; VETreeNode cur = node1;
while (cur != null) while (cur != null)
{ {
cur.BackColor = on ? _RangeColor : tvTran.BackColor; cur.BackColor = on ? RangeColor : tvTran.BackColor;
cur = (VETreeNode)(cur.NextNode == null ? cur.Parent : cur.NextNode); cur = (VETreeNode)(cur.NextNode ?? cur.Parent);
// if these nodes were at the same level, then stop after the current node = range2 // if these nodes were at the same level, then stop after the current node = range2
if (cur == top1) cur = null; // stop at top if (cur == top1) cur = null; // stop at top
if (cur == top2) top1 = cur = null; if (cur == top2) top1 = cur = null;
@@ -1561,30 +1435,25 @@ namespace Volian.Controls.Library
cur = top1==null?null:(VETreeNode)top1.NextNode; cur = top1==null?null:(VETreeNode)top1.NextNode;
while (cur != null) while (cur != null)
{ {
cur.BackColor = on ? _RangeColor : tvTran.BackColor; cur.BackColor = on ? RangeColor : tvTran.BackColor;
cur = (cur == top2) ? null : (VETreeNode)cur.NextNode; cur = (cur == top2) ? null : (VETreeNode)cur.NextNode;
} }
// finish subtree of second node in range. // finish subtree of second node in range.
cur = top2==node2?null:node2; cur = top2==node2?null:node2;
while (cur != null) while (cur != null)
{ {
cur.BackColor = on ? _RangeColor : tvTran.BackColor; cur.BackColor = on ? RangeColor : tvTran.BackColor;
cur = (VETreeNode)(cur.PrevNode == null ? cur.Parent : cur.PrevNode); cur = (VETreeNode)(cur.PrevNode ?? cur.Parent);
if (cur == top2) cur = null; // stop at top if (cur == top2) cur = null; // stop at top
} }
// hilite last selection.. // hilite last selection..
top2.BackColor = on ? _RangeColor : tvTran.BackColor; top2.BackColor = on ? RangeColor : tvTran.BackColor;
} }
#endregion #endregion
public DocVersionInfo Mydvi = null; // this is initialized in vlnTreeComboSetsFillIn() public DocVersionInfo Mydvi = null; // this is initialized in vlnTreeComboSetsFillIn()
private static UserInfo _MyUserInfo = null; public static UserInfo MyUserInfo { get; set; } = null;
public static UserInfo MyUserInfo
{
get { return _MyUserInfo; }
set { _MyUserInfo = value; }
}
private void cbIncStepNum_CheckedChanged(object sender, EventArgs e) private void cbIncStepNum_CheckedChanged(object sender, EventArgs e)
{ {
@@ -1610,8 +1479,7 @@ namespace Volian.Controls.Library
if (cbHoldProcSet.Checked) if (cbHoldProcSet.Checked)
{ {
VETreeNode vt = tvTran.SelectedNode as VETreeNode; VETreeNode vt = tvTran.SelectedNode as VETreeNode;
ItemInfo selii = vt.VEObject as ItemInfo; if (vt.VEObject is ItemInfo selii)
if (selii != null)
{ {
HeldLinkText = string.Format("#Link:Transition:{0} <NewID> {1}", listBoxTranFmt.SelectedIndex, selii.ItemID); HeldLinkText = string.Format("#Link:Transition:{0} <NewID> {1}", listBoxTranFmt.SelectedIndex, selii.ItemID);
HeldLink_TranFmtIndx = listBoxTranFmt.SelectedIndex; HeldLink_TranFmtIndx = listBoxTranFmt.SelectedIndex;
@@ -1628,29 +1496,17 @@ namespace Volian.Controls.Library
} }
public class TransItem public class TransItem
{ {
private string _ItemDescription; public string ItemDescription { get; set; }
public string ItemDescription public string Format { get; set; }
{
get { return _ItemDescription; }
set { _ItemDescription = value; }
}
private string _Format;
public string Format
{
get { return _Format; }
set { _Format = value; }
}
public TransItem(string desc, string fmt) public TransItem(string desc, string fmt)
{ {
_ItemDescription = desc; ItemDescription = desc;
_Format = fmt; Format = fmt;
} }
public override string ToString() public override string ToString()
{ {
return _ItemDescription; return ItemDescription;
} }
} }
} }
+2 -25
View File
@@ -1,4 +1,3 @@
using System;
using System.Windows.Forms; using System.Windows.Forms;
using AT.STO.UI.Win; using AT.STO.UI.Win;
@@ -8,16 +7,9 @@ namespace Volian.Controls.Library
internal class DropDownNode : TreeNode, ILookupItem<long> internal class DropDownNode : TreeNode, ILookupItem<long>
{ {
#region Private Variable Declarations #region Private Variable Declarations
private long _id = 0; private readonly long _id = 0;
#endregion #endregion
#region Constructor / Destructor #region Constructor / Destructor
/// <summary>
/// Default constructor.
/// </summary>
public DropDownNode() : base()
{
}
/// <summary> /// <summary>
/// /// <summary> /// /// <summary>
/// Some constructors initializing the node with Id. /// Some constructors initializing the node with Id.
@@ -29,26 +21,11 @@ namespace Volian.Controls.Library
{ {
_id = Id; _id = Id;
} }
public DropDownNode(long Id, string Text, DropDownNode[] Children) : base(Text, Children)
{
_id = Id;
}
public DropDownNode(long Id, string Text, int ImageIndex, int SelectedImageIndex) : base(Text, ImageIndex, SelectedImageIndex)
{
_id = Id;
}
public DropDownNode(long Id, string Text, int ImageIndex, int SelectedImageIndex, DropDownNode[] Children) : base(Text, ImageIndex, SelectedImageIndex, Children)
{
_id = Id;
}
#endregion #endregion
#region Public Methods #region Public Methods
public override string ToString() public override string ToString()
{ {
return this.GetType().Name + " (Id=" + Id.ToString() + ", Name=" + Text + ")"; return $"{this.GetType().Name} (Id={Id}, Name={Text})";
} }
#endregion #endregion
#region ILookupItem<long> Implementation #region ILookupItem<long> Implementation
@@ -22,10 +22,7 @@ namespace Volian.Controls.Library
{ {
base.OnAfterSelect(e); base.OnAfterSelect(e);
if (ValueChanged != null) ValueChanged?.Invoke(this, new DropDownValueChangedEventArgs(e.Node));
{
ValueChanged(this, new DropDownValueChangedEventArgs(e.Node));
}
} }
/// <summary> /// <summary>
/// A double click on a node counts as finish editing. /// A double click on a node counts as finish editing.
File diff suppressed because it is too large Load Diff
+20 -50
View File
@@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
@@ -16,13 +12,8 @@ namespace Volian.Controls.Library
{ {
private bool doingfind = false; private bool doingfind = false;
private bool findingbookmarks = false; private bool findingbookmarks = false;
private bool _FoundIt = false;
private ItemInfo _StartingItemInfo = null;// C2023-016 used to remember where we started doing the Find/Replace private ItemInfo _StartingItemInfo = null;// C2023-016 used to remember where we started doing the Find/Replace
public bool FoundIt public bool FoundIt { get; set; } = false;
{
get { return _FoundIt; }
set { _FoundIt = value; }
}
private bool IsFound private bool IsFound
{ {
get get
@@ -43,31 +34,16 @@ namespace Volian.Controls.Library
{ {
_MyEditItem = value; _MyEditItem = value;
if (_MyEditItem == null) return; if (_MyEditItem == null) return;
_MyDocVersion = _MyEditItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; Mydocversion = _MyEditItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
SetupContextMenu(); SetupContextMenu();
} }
} }
private DocVersionInfo _MyDocVersion;
public DocVersionInfo Mydocversion
{
get { return _MyDocVersion; }
set {_MyDocVersion = value; }
}
private DisplayBookMarks _myDisplayBookMarks;
public DisplayBookMarks MyDisplayBookMarks public DocVersionInfo Mydocversion { get; set; }
{
get { return _myDisplayBookMarks; }
set { _myDisplayBookMarks = value; }
}
private bool _InApproved; public DisplayBookMarks MyDisplayBookMarks { get; set; }
public bool InApproved public bool InApproved { get; set; }
{
get { return _InApproved; }
set { _InApproved = value; }
}
public FindReplace() public FindReplace()
{ {
InitializeComponent(); InitializeComponent();
@@ -203,7 +179,7 @@ namespace Volian.Controls.Library
// C2023-016 Find the next element, but stay in the same procedure // C2023-016 Find the next element, but stay in the same procedure
private ItemInfo FindNextStepElement(ItemInfo curStepElem, string fndStr) private ItemInfo FindNextStepElement(ItemInfo curStepElem, string fndStr)
{ {
ItemInfo nxtStepElem = curStepElem; ItemInfo nxtStepElem;
if (_StartingItemInfo == null) if (_StartingItemInfo == null)
_StartingItemInfo = MyEditItem.MyItemInfo; _StartingItemInfo = MyEditItem.MyItemInfo;
if (cbxReverse.Checked) if (cbxReverse.Checked)
@@ -267,11 +243,6 @@ namespace Volian.Controls.Library
} }
FoundIt = true; FoundIt = true;
} }
private bool FindNextText(ItemInfo next)
{
if (next.MyContent.MyGrid!=null) return true;
return next.MyContent.Text.ToUpper().Contains(cmboFindText.Text.ToUpper());
}
private void AddToComboLists() private void AddToComboLists()
{ {
bool hastext = this.cmboFindText.Text.Length > 0; bool hastext = this.cmboFindText.Text.Length > 0;
@@ -304,11 +275,6 @@ namespace Volian.Controls.Library
_StartingItemInfo = null;//C2023-016 reset the starting position _StartingItemInfo = null;//C2023-016 reset the starting position
} }
public void PerformFindNext()
{
btnFindNext.PerformClick();
}
private void tabFind_Click(object sender, EventArgs e) private void tabFind_Click(object sender, EventArgs e)
{ {
lblRplTxt.Visible = false; lblRplTxt.Visible = false;
@@ -360,8 +326,10 @@ namespace Volian.Controls.Library
IDataObject myDO = Clipboard.GetDataObject(); IDataObject myDO = Clipboard.GetDataObject();
if (myDO.GetDataPresent(DataFormats.Rtf)) if (myDO.GetDataPresent(DataFormats.Rtf))
{ {
RichTextBox rtb = new RichTextBox(); RichTextBox rtb = new RichTextBox
rtb.SelectedRtf = ItemInfo.StripLinks(myDO.GetData(DataFormats.Rtf).ToString()); {
SelectedRtf = ItemInfo.StripLinks(myDO.GetData(DataFormats.Rtf).ToString())
};
if (cmboReplaceText.Focused) if (cmboReplaceText.Focused)
cmboReplaceText.SelectedText = rtb.Text; cmboReplaceText.SelectedText = rtb.Text;
else if (cmboFindText.Focused) else if (cmboFindText.Focused)
@@ -394,9 +362,9 @@ namespace Volian.Controls.Library
private void SetupContextMenu() private void SetupContextMenu()
{ {
galSymbols.SubItems.Clear(); galSymbols.SubItems.Clear();
if (_MyDocVersion != null) if (Mydocversion != null)
{ {
FormatData fmtdata = _MyDocVersion.ActiveFormat.PlantFormat.FormatData; FormatData fmtdata = Mydocversion.ActiveFormat.PlantFormat.FormatData;
SymbolList sl = fmtdata.SymbolList; SymbolList sl = fmtdata.SymbolList;
if (sl == null || sl.Count <= 0) if (sl == null || sl.Count <= 0)
{ {
@@ -405,13 +373,15 @@ namespace Volian.Controls.Library
} }
foreach (Symbol sym in sl) foreach (Symbol sym in sl)
{ {
DevComponents.DotNetBar.ButtonItem btnCM = new DevComponents.DotNetBar.ButtonItem(); DevComponents.DotNetBar.ButtonItem btnCM = new DevComponents.DotNetBar.ButtonItem
btnCM.Text = string.Format("{0}", (char)sym.Unicode); {
Text = string.Format("{0}", (char)sym.Unicode),
// to name button use unicode rather than desc, desc may have spaces or odd chars // to name button use unicode rather than desc, desc may have spaces or odd chars
btnCM.Name = "btnCM" + sym.Unicode.ToString(); Name = "btnCM" + sym.Unicode.ToString(),
btnCM.Tooltip = sym.Desc; Tooltip = sym.Desc,
btnCM.Tag = string.Format(@"{0}", sym.Unicode); Tag = string.Format(@"{0}", sym.Unicode),
btnCM.FontBold = true; FontBold = true
};
btnCM.Click += new System.EventHandler(btnSym_Click); btnCM.Click += new System.EventHandler(btnSym_Click);
galSymbols.SubItems.Add(btnCM); galSymbols.SubItems.Add(btnCM);
} }
@@ -1,8 +1,5 @@
using System; using System;
using System.Collections;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms; using System.Windows.Forms;
using System.Drawing.Design; using System.Drawing.Design;
using System.Windows.Forms.Design; using System.Windows.Forms.Design;
@@ -13,6 +10,7 @@ namespace Volian.Controls.Library
public class FlagCheckedListBox : CheckedListBox public class FlagCheckedListBox : CheckedListBox
{ {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private System.ComponentModel.Container components = null; private System.ComponentModel.Container components = null;
public FlagCheckedListBox() public FlagCheckedListBox()
@@ -28,8 +26,7 @@ namespace Volian.Controls.Library
{ {
if (disposing) if (disposing)
{ {
if (components != null) components?.Dispose();
components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
@@ -37,9 +34,6 @@ namespace Volian.Controls.Library
#region Component Designer generated code #region Component Designer generated code
private void InitializeComponent() private void InitializeComponent()
{ {
//
// FlaggedCheckedListBox
//
this.CheckOnClick = true; this.CheckOnClick = true;
} }
@@ -127,7 +121,7 @@ namespace Volian.Controls.Library
// If the item has been unchecked, remove its bits from the sum // If the item has been unchecked, remove its bits from the sum
if (cs == CheckState.Unchecked) if (cs == CheckState.Unchecked)
sum = sum & (~composite.value); sum &= (~composite.value);
// If the item has been checked, combine its bits with the sum // If the item has been checked, combine its bits with the sum
else else
sum |= composite.value; sum |= composite.value;
@@ -239,12 +233,14 @@ namespace Volian.Controls.Library
public class FlagEnumUIEditor : UITypeEditor public class FlagEnumUIEditor : UITypeEditor
{ {
// The checklistbox // The checklistbox
private FlagCheckedListBox flagEnumCB; private readonly FlagCheckedListBox flagEnumCB;
public FlagEnumUIEditor() public FlagEnumUIEditor()
{ {
flagEnumCB = new FlagCheckedListBox(); flagEnumCB = new FlagCheckedListBox
flagEnumCB.BorderStyle = BorderStyle.None; {
BorderStyle = BorderStyle.None
};
} }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
@@ -269,10 +265,7 @@ namespace Volian.Controls.Library
return null; return null;
} }
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) => UITypeEditorEditStyle.DropDown;
{
return UITypeEditorEditStyle.DropDown;
}
} }
@@ -1,9 +1,6 @@
using Csla; using Csla;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml; using System.Xml;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
@@ -0,0 +1,8 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
+19 -20
View File
@@ -34,9 +34,9 @@ namespace Volian.Controls.Library
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GridItem)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GridItem));
this.lblTab = new System.Windows.Forms.Label(); this.lblTab = new System.Windows.Forms.Label();
this._MyToolTip = new DevComponents.DotNetBar.SuperTooltip(); this._MyToolTip = new DevComponents.DotNetBar.SuperTooltip();
this._MyFlexGrid = new Volian.Controls.Library.VlnFlexGrid(this.components); this.MyFlexGrid = new Volian.Controls.Library.VlnFlexGrid(this.components);
this._MyDisablePanel = new vlnPanel(); this._MyDisablePanel = new vlnPanel();
((System.ComponentModel.ISupportInitialize)(this._MyFlexGrid)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.MyFlexGrid)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// lblTab // lblTab
@@ -55,21 +55,21 @@ namespace Volian.Controls.Library
// //
// _MyFlexGrid // _MyFlexGrid
// //
this._MyFlexGrid.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom; this.MyFlexGrid.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom;
this._MyFlexGrid.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Both; this.MyFlexGrid.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Both;
this._MyFlexGrid.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.MyFlexGrid.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this._MyFlexGrid.ColumnInfo = "3,0,0,0,0,40,Columns:"; this.MyFlexGrid.ColumnInfo = "3,0,0,0,0,40,Columns:";
this._MyFlexGrid.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw; this.MyFlexGrid.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw;
this._MyFlexGrid.FocusRect = C1.Win.C1FlexGrid.FocusRectEnum.Solid; this.MyFlexGrid.FocusRect = C1.Win.C1FlexGrid.FocusRectEnum.Solid;
this._MyFlexGrid.Location = new System.Drawing.Point(5, 5); this.MyFlexGrid.Location = new System.Drawing.Point(5, 5);
this._MyFlexGrid.Name = "_MyFlexGrid"; this.MyFlexGrid.Name = "_MyFlexGrid";
this._MyFlexGrid.Rows.Count = 4; this.MyFlexGrid.Rows.Count = 4;
this._MyFlexGrid.Rows.DefaultSize = 20; this.MyFlexGrid.Rows.DefaultSize = 20;
this._MyFlexGrid.Rows.Fixed = 0; this.MyFlexGrid.Rows.Fixed = 0;
this._MyFlexGrid.ScrollBars = System.Windows.Forms.ScrollBars.None; this.MyFlexGrid.ScrollBars = System.Windows.Forms.ScrollBars.None;
this._MyFlexGrid.Size = new System.Drawing.Size(314, 66); this.MyFlexGrid.Size = new System.Drawing.Size(314, 66);
this._MyFlexGrid.StyleInfo = resources.GetString("_MyFlexGrid.StyleInfo"); this.MyFlexGrid.StyleInfo = resources.GetString("_MyFlexGrid.StyleInfo");
this._MyFlexGrid.TabIndex = 4; this.MyFlexGrid.TabIndex = 4;
// //
// _MyDisablePanel // _MyDisablePanel
// //
@@ -81,13 +81,13 @@ namespace Volian.Controls.Library
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this._MyFlexGrid); this.Controls.Add(this.MyFlexGrid);
this.Controls.Add(this._MyDisablePanel); this.Controls.Add(this._MyDisablePanel);
this.Controls.Add(this.lblTab); this.Controls.Add(this.lblTab);
this.Margin = new System.Windows.Forms.Padding(2); this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "GridItem"; this.Name = "GridItem";
this.Size = new System.Drawing.Size(320, 72); this.Size = new System.Drawing.Size(320, 72);
((System.ComponentModel.ISupportInitialize)(this._MyFlexGrid)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.MyFlexGrid)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@@ -96,7 +96,6 @@ namespace Volian.Controls.Library
private System.Windows.Forms.Label lblTab; private System.Windows.Forms.Label lblTab;
private DevComponents.DotNetBar.SuperTooltip _MyToolTip; private DevComponents.DotNetBar.SuperTooltip _MyToolTip;
private VlnFlexGrid _MyFlexGrid;
private vlnPanel _MyDisablePanel; private vlnPanel _MyDisablePanel;
} }
} }
+43 -234
View File
@@ -1,13 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
//using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using Volian.Base.Library; using Volian.Base.Library;
using C1.Win.C1FlexGrid; using C1.Win.C1FlexGrid;
@@ -24,42 +19,23 @@ namespace Volian.Controls.Library
{ {
get get
{ {
ItemInfo procInfo = MyItemInfo.MyProcedure as ItemInfo; if (!(MyItemInfo.MyProcedure is ItemInfo procInfo))
if (procInfo == null)
_MyDVI = null; _MyDVI = null;
else else
_MyDVI = procInfo.ActiveParent as DocVersionInfo; _MyDVI = procInfo.ActiveParent as DocVersionInfo;
return _MyDVI; return _MyDVI;
} }
} }
private static UserInfo _MyUserInfo = null;
public static UserInfo MyUserInfo public static UserInfo MyUserInfo { get; set; } = null;
{ public bool IsSaving { get; set; }
get { return _MyUserInfo; } public VlnFlexGrid MyFlexGrid { get; set; }
set { _MyUserInfo = value; }
}
private bool _IsSaving;
public bool IsSaving
{
get { return _IsSaving; }
set { _IsSaving = value; }
}
public VlnFlexGrid MyFlexGrid
{
get { return _MyFlexGrid; }
set { _MyFlexGrid = value; }
}
private int _GridMargin = 11;
/// <summary> /// <summary>
/// Margin between the EditItem and the VlnFlexGrid. Appears on the Right. /// Margin between the EditItem and the VlnFlexGrid. Appears on the Right.
/// Will allow space to draw a Change Bar on the right side of the EditItem. /// Will allow space to draw a Change Bar on the right side of the EditItem.
/// </summary> /// </summary>
public int GridMargin public int GridMargin { get; set; } = 11;
{
get { return _GridMargin; }
set { _GridMargin = value; }
}
#endregion #endregion
#region Event Handlers #region Event Handlers
@@ -145,7 +121,6 @@ namespace Volian.Controls.Library
void MyStepRTB_AdjustTableWidth(object sender, StepRTBTableWidthEventArgs args) void MyStepRTB_AdjustTableWidth(object sender, StepRTBTableWidthEventArgs args)
{ {
//Console.WriteLine("MyStepRTB_AdjustTableWidth"); //Console.WriteLine("MyStepRTB_AdjustTableWidth");
//if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
if (args.EditMode) if (args.EditMode)
{ {
int colR = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); int colR = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode);
@@ -167,27 +142,12 @@ namespace Volian.Controls.Library
} }
} }
} }
bool MyStepRTB_IsNotCurrentSelection(object sender, EventArgs args) bool MyStepRTB_IsNotCurrentSelection(object sender, EventArgs args) => MyStepPanel.SelectedEditItem != this;
{
return MyStepPanel.SelectedEditItem != this;
}
void MyStepRTB_OpenAnnotations(object sender, EventArgs args) void MyStepRTB_OpenAnnotations(object sender, EventArgs args) => OpenAnnotations();
{ void MyFlexGrid_OpenAnnotations(object sender, EventArgs args) => OpenAnnotations();
OpenAnnotations(); void MyStepRTB_DoMouseWheel(object sender, MouseEventArgs args) => DoMouseWheel(args);
} void MyStepRTB_DoSaveContents(object sender, EventArgs args) => SaveCurrentAndContents();
void MyFlexGrid_OpenAnnotations(object sender, EventArgs args)
{
OpenAnnotations();
}
void MyStepRTB_DoMouseWheel(object sender, MouseEventArgs args)
{
DoMouseWheel(args);
}
void MyStepRTB_DoSaveContents(object sender, EventArgs args)
{
SaveCurrentAndContents();
}
void MyStepRTB_VisibleChanged(object sender, EventArgs e) void MyStepRTB_VisibleChanged(object sender, EventArgs e)
{ {
if (MyStepRTB == null) return; if (MyStepRTB == null) return;
@@ -204,7 +164,6 @@ namespace Volian.Controls.Library
void MyFlexGrid_Click(object sender, EventArgs e) void MyFlexGrid_Click(object sender, EventArgs e)
{ {
MyFlexGrid.Focus(); MyFlexGrid.Focus();
//MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ToggleTableDesignButtons(false);
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetRibbonForGrid(); MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetRibbonForGrid();
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetTableButtonsForMergeRangeSelection(); MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetTableButtonsForMergeRangeSelection();
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetGridContextMenu(); MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetGridContextMenu();
@@ -235,7 +194,6 @@ namespace Volian.Controls.Library
private string _OrigRtf; // used to store original rtf to allow for 'escape' key restore private string _OrigRtf; // used to store original rtf to allow for 'escape' key restore
void MyFlexGrid_SelChange(object sender, EventArgs e) void MyFlexGrid_SelChange(object sender, EventArgs e)
{ {
//if (Initializing) return;
//Volian.Base.Library.vlnStackTrace.ShowStackLocal("MyFlexGrid_SelChange {0}",MyFlexGrid.Selection); //Volian.Base.Library.vlnStackTrace.ShowStackLocal("MyFlexGrid_SelChange {0}",MyFlexGrid.Selection);
RTBLastFocus = false; RTBLastFocus = false;
MyStepRTB.Visible = false; // Hide the editor if the Selection Changes MyStepRTB.Visible = false; // Hide the editor if the Selection Changes
@@ -244,7 +202,7 @@ namespace Volian.Controls.Library
{ {
// B2020-088: get string using method in case of merged cells // B2020-088: get string using method in case of merged cells
string rtf = MyFlexGrid.GetCellRTFString(MyFlexGrid.Row, MyFlexGrid.Col); string rtf = MyFlexGrid.GetCellRTFString(MyFlexGrid.Row, MyFlexGrid.Col);
_OrigRtf = rtf == null ? string.Empty : rtf; _OrigRtf = rtf ?? string.Empty;
} }
} }
void MyStepRTB_KeyDown(object sender, KeyEventArgs e) void MyStepRTB_KeyDown(object sender, KeyEventArgs e)
@@ -310,7 +268,6 @@ namespace Volian.Controls.Library
this.MyStepRTB.SetMenu += new StepRTBMenuEvent(MyStepRTB_SetMenu); this.MyStepRTB.SetMenu += new StepRTBMenuEvent(MyStepRTB_SetMenu);
this.MyStepRTB.OpenContextMenu += new StepRTBLocationEvent(MyStepRTB_OpenContextMenu); this.MyStepRTB.OpenContextMenu += new StepRTBLocationEvent(MyStepRTB_OpenContextMenu);
this.MyFlexGrid.EnterKeyPressed += new VlnFlexGridkeyEvent(MyFlexGrid_EnterKeyPressed); this.MyFlexGrid.EnterKeyPressed += new VlnFlexGridkeyEvent(MyFlexGrid_EnterKeyPressed);
//this.MyStepRTB.EnterKeyPressed += new StepRTBCursorKeysEvent(MyStepRTB_EnterKeyPressed);
// This Resize event has been useful for debugging purposes numerous times // This Resize event has been useful for debugging purposes numerous times
// //
//this.MyStepRTB.Resize += new EventHandler(MyStepRTB_Resize); //this.MyStepRTB.Resize += new EventHandler(MyStepRTB_Resize);
@@ -330,12 +287,6 @@ namespace Volian.Controls.Library
cs.BackColor = MyFlexGrid.MyShading.GetColor(MyFlexGrid.Row, MyFlexGrid.Col); // C2021-004 reset the last active table cell's shading color when leaving cs.BackColor = MyFlexGrid.MyShading.GetColor(MyFlexGrid.Row, MyFlexGrid.Col); // C2021-004 reset the last active table cell's shading color when leaving
} }
//void MyStepRTB_EnterKeyPressed(object sender, KeyEventArgs args)
//{
// args.Handled = true;
// MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ProcessEnterKey();
//}
void MyFlexGrid_EnterKeyPressed(object sender, KeyEventArgs args) void MyFlexGrid_EnterKeyPressed(object sender, KeyEventArgs args)
{ {
args.Handled = true; args.Handled = true;
@@ -352,16 +303,6 @@ namespace Volian.Controls.Library
SetMenu(args.MenuGroup); SetMenu(args.MenuGroup);
} }
// This Resize event been useful for debugging purposes numerous times
//
//void MyStepRTB_Resize(object sender, EventArgs e)
//{
// if (MyStepRTB.Visible)
// {
// //Volian.Base.Library.vlnStackTrace.ShowStack("MyStepRTB_Resize");
// Console.WriteLine("MyStepRTB_Resize {0}", MyStepRTB.Width);
// }
//}
void MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args) void MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args)
{ {
//Console.WriteLine("GridItem - Enter MyStepRTB_RoInsert"); //Console.WriteLine("GridItem - Enter MyStepRTB_RoInsert");
@@ -372,12 +313,6 @@ namespace Volian.Controls.Library
MyFlexGrid.FixTableCellsHeightWidth(); MyFlexGrid.FixTableCellsHeightWidth();
MyFlexGrid.AdjustGridControlSize(); MyFlexGrid.AdjustGridControlSize();
MyFlexGrid.Visible = true; MyFlexGrid.Visible = true;
//MyFlexGrid.MergedRanges.Clear();
//MyFlexGrid.Clear();
//ConvertTableToGrid(args.RawValText, args.RODbID, args.ROID);
//MyFlexGrid.RODbId = args.RODbID;
//MyFlexGrid.ROID = args.ROID;
//SaveContents();
} }
else else
{ {
@@ -400,18 +335,7 @@ namespace Volian.Controls.Library
#endregion #endregion
#region Override Method and Properties #region Override Method and Properties
public override int BorderWidth { get { return (MyFlexGrid.Width - MyFlexGrid.ClientRectangle.Width); } } public override int BorderWidth { get { return (MyFlexGrid.Width - MyFlexGrid.ClientRectangle.Width); } }
//private bool _OnlyOnce = false;
//protected override void OnPaint(PaintEventArgs e)
//{
// base.OnPaint(e);
// if (!this.Enabled && !_OnlyOnce)
// {
// _OnlyOnce = true;
// _MyDisablePanel.SendToBack();
// _MyDisablePanel.BringToFront();
// _OnlyOnce = false;
// }
//}
protected override void OnEnabledChanged(EventArgs e) protected override void OnEnabledChanged(EventArgs e)
{ {
base.OnEnabledChanged(e); base.OnEnabledChanged(e);
@@ -430,7 +354,6 @@ namespace Volian.Controls.Library
{ {
gr.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; gr.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
gr.FillRectangle(new SolidBrush(Color.FromArgb(128, Color.FromKnownColor(KnownColor.ButtonFace))), rect); gr.FillRectangle(new SolidBrush(Color.FromArgb(128, Color.FromKnownColor(KnownColor.ButtonFace))), rect);
//gr.FillEllipse(Brushes.Red, 10, 10, 10, 10);
} }
_MyDisablePanel.Location = this.MyFlexGrid.Location; _MyDisablePanel.Location = this.MyFlexGrid.Location;
_MyDisablePanel.Size = this.MyFlexGrid.Size; _MyDisablePanel.Size = this.MyFlexGrid.Size;
@@ -446,10 +369,6 @@ namespace Volian.Controls.Library
public override string TabFormat { get { return _TabFormat; } set { _TabFormat = value; } } public override string TabFormat { get { return _TabFormat; } set { _TabFormat = value; } }
public override void AdjustTableWidthAndLocation() public override void AdjustTableWidthAndLocation()
{ {
//_MyStepRTB.Font = MyStepData.Font.WindowsFont;
//ItemWidth = (int)GetTableWidth(MyStepRTB.Font, MyItemInfo.MyContent.Text, true);
//ItemWidth = MyFlexGrid.Width;
//ItemLocation = new Point(50, _MyParentEditItem.Bottom);
// We had a table that was in a funky state. This allows it to appear in editor so // We had a table that was in a funky state. This allows it to appear in editor so
// that is could be deleted. // that is could be deleted.
@@ -586,11 +505,11 @@ namespace Volian.Controls.Library
} }
} }
} }
c = c + 1; c++;
if (c == w) if (c == w)
{ {
c = 0; c = 0;
r = r + 1; r++;
} }
} }
} }
@@ -651,35 +570,17 @@ namespace Volian.Controls.Library
// if no ro has been defined yet, just return null // if no ro has been defined yet, just return null
if (MyFlexGrid.ROID == null) return null; if (MyFlexGrid.ROID == null) return null;
ContentRoUsage rousg = null; ContentRoUsage rousg = null;
// using (Item itm = MyItemInfo.Get())
// {
using (RODb rodb = RODb.GetJustRoDb(MyFlexGrid.RODbId)) using (RODb rodb = RODb.GetJustRoDb(MyFlexGrid.RODbId))
{ {
string padroid = (MyFlexGrid.ROID.Length <= 12) ? MyFlexGrid.ROID + "0000" : MyFlexGrid.ROID; string padroid = (MyFlexGrid.ROID.Length <= 12) ? MyFlexGrid.ROID + "0000" : MyFlexGrid.ROID;
rousg = itm.MyContent.ContentRoUsages.Add(MyFlexGrid.ROID, rodb); rousg = itm.MyContent.ContentRoUsages.Add(MyFlexGrid.ROID, rodb);
} }
//itm.Save();
// }
MyItemInfo.MyContent.RefreshContentRoUsages(); MyItemInfo.MyContent.RefreshContentRoUsages();
return string.Format(@"#Link:ReferencedObject:{0} {1} {2}", rousg.ROUsageID, MyFlexGrid.ROID, MyFlexGrid.RODbId); return string.Format(@"#Link:ReferencedObject:{0} {1} {2}", rousg.ROUsageID, MyFlexGrid.ROID, MyFlexGrid.RODbId);
} }
//private void ConvertTableToGrid(string valtext, int rodbid, string roid)
//{
// VE_Font vefont = MyItemInfo.GetItemFont();
// MyFlexGrid.Font = vefont.WindowsFont;
// //Initializing = true;
// MyFlexGrid.MergedRanges.Clear();
// MyFlexGrid.Clear();
// MyFlexGrid.ParseTableFromText(valtext);
// MyFlexGrid.AutoSizeCols();
// MyFlexGrid.AutoSizeRows();
// MyFlexGrid.MakeRTFcells();
// MyFlexGrid.RODbId = rodbid;
// MyFlexGrid.ROID = roid;
// MyFlexGrid.IsRoTable = true;
// //Initializing = false;
// SaveContents();
//}
private bool FinishSave(string searchableText) private bool FinishSave(string searchableText)
{ {
// Just in case if the grid was in a mode to change sizes, clear out that setting // Just in case if the grid was in a mode to change sizes, clear out that setting
@@ -691,13 +592,9 @@ namespace Volian.Controls.Library
string xml = MyFlexGrid.GetXMLData(); string xml = MyFlexGrid.GetXMLData();
using (Item itm = MyItemInfo.Get()) using (Item itm = MyItemInfo.Get())
{ {
//if (!MatchingXML(itm.MyContent.MyGrid.Data, xml))
//{
// CompareXML(itm.MyContent.MyGrid.Data, xml);
itm.MyContent.MyGrid.Data = xml; itm.MyContent.MyGrid.Data = xml;
itm.MyContent.MyGrid.DTS = DateTime.Now; itm.MyContent.MyGrid.DTS = DateTime.Now;
itm.MyContent.MyGrid.UserID = Volian.Base.Library.VlnSettings.UserID; itm.MyContent.MyGrid.UserID = Volian.Base.Library.VlnSettings.UserID;
//}
// if this is the initial save of an ro table, then the 'DoLinkForRoTable' will // if this is the initial save of an ro table, then the 'DoLinkForRoTable' will
// create the usage for it. this code gets run on modify of the ro table and also // create the usage for it. this code gets run on modify of the ro table and also
// on exit of the griditem. We don't want to save the ro usage again, if it's already // on exit of the griditem. We don't want to save the ro usage again, if it's already
@@ -705,12 +602,9 @@ namespace Volian.Controls.Library
if (MyFlexGrid.IsRoTable && MyFlexGrid.ROID != null && itm.MyContent.ContentRoUsageCount < 1) if (MyFlexGrid.IsRoTable && MyFlexGrid.ROID != null && itm.MyContent.ContentRoUsageCount < 1)
{ {
searchableText = string.Format(@"\v<START]\v0 {0} \v {1}[END>\v0 ", searchableText, DoLinkForRoTable(itm)); searchableText = string.Format(@"\v<START]\v0 {0} \v {1}[END>\v0 ", searchableText, DoLinkForRoTable(itm));
//if (itm.MyContent.Text != searchableText)
//{
itm.MyContent.Text = searchableText; itm.MyContent.Text = searchableText;
itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
itm.MyContent.DTS = DateTime.Now; itm.MyContent.DTS = DateTime.Now;
//}
} }
else else
{ {
@@ -726,82 +620,30 @@ namespace Volian.Controls.Library
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds && if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds &&
!this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange) !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange)
{ {
StepConfig sc = itm.MyConfig as StepConfig; if (!(itm.MyConfig is StepConfig sc))
if (sc == null)
sc = new StepConfig(); sc = new StepConfig();
sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId; sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId;
if (itm.MyConfig == null) itm.MyContent.Config = sc.ToString(); if (itm.MyConfig == null) itm.MyContent.Config = sc.ToString();
} }
itm.Save(); itm.Save();
StepConfig myItmCfg =MyItemInfo.MyConfig as StepConfig;
// We saved changes made to some step text. Reset the change bar override. // We saved changes made to some step text. Reset the change bar override.
// IF there is a step config remove the change bar override by setting the CBOverride value to null // IF there is a step config remove the change bar override by setting the CBOverride value to null
// This fixes a problem reported by Farly where if the change bar or overridden to be off, the next // This fixes a problem reported by Farly where if the change bar or overridden to be off, the next
// time a change was made, the change bar remained turned off. // time a change was made, the change bar remained turned off.
if (myItmCfg != null) if (MyItemInfo.MyConfig is StepConfig myItmCfg)
myItmCfg.Step_CBOverride = null; // clear the change bar override myItmCfg.Step_CBOverride = null; // clear the change bar override
MyItemInfo.MyContent.MyGrid.ResetContent(itm.MyContent.MyGrid); MyItemInfo.MyContent.MyGrid.ResetContent(itm.MyContent.MyGrid);
} }
return true; return true;
} }
private void CompareXML(string v1, string v2)
{
v1 = Regex.Replace(v1, "\r\n *", "");
v1 = Regex.Replace(v1, "version *= *\"[^\"]*\"", "");
v2 = Regex.Replace(v2, "\r\n *", "");
v2 = Regex.Replace(v2, "version *= *\"[^\"]*\"", "");
int iStart = 0;
int l1 = v1.Length;
int l2 = v2.Length;
int l3 = Math.Min(l1, l2);
while (iStart < l3 && v1[iStart] == v2[iStart])
iStart++;
int iEnd1 = l1 - 1;
int iEnd2 = l2 - 1;
while (iStart < iEnd1 && iStart < iEnd2 && v1[iEnd1] == v2[iEnd2])
{
iEnd1--;
iEnd2--;
}
if (iStart < iEnd1) Console.WriteLine("v1 = {0}", v1.Substring(iStart, iEnd1 - iStart));
if (iStart < iEnd2) Console.WriteLine("v2 = {0}", v2.Substring(iStart, iEnd2 - iStart));
}
private bool MatchingXML(string v1, string v2)
{
v1 = Regex.Replace(v1, "\r\n *", "");
v1 = Regex.Replace(v1, "version *= *\"[^\"]*\"", "");
v2 = Regex.Replace(v2, "\r\n *", "");
v2 = Regex.Replace(v2, "version *= *\"[^\"]*\"", "");
int l1 = v1.Length;
int l2 = v2.Length;
if(l1 != l2 )return false;
//int l3 = Math.Min(l1, l2);
//int l4 = Math.Max(l1, l2);
for (int i = 0; i < l1; i++)
if (v1[i] != v2[i]) return false;
return true;
//Console.WriteLine("{0} - {1},{2}",i, showChar(v1[i]), showChar(v2[i]));
//if(l1 > l3)Console.WriteLine("v1 = {0}",v1.Substring(l3));
//if(l2 > l3)Console.WriteLine("v2 = {0}",v2.Substring(l3));
}
//private object showChar(char c)
//{
// int i = (int)c;
// if (i <= 32)
// return string.Format("<{0}>", i);
// else
// return c.ToString();
//}
public void BasicSave() public void BasicSave()
{ {
using (Item itm = MyItemInfo.Get()) using (Item itm = MyItemInfo.Get())
{ {
itm.MyContent.MyGrid.Data = MyFlexGrid.GetXMLData(); itm.MyContent.MyGrid.Data = MyFlexGrid.GetXMLData();
itm.Save(); itm.Save();
//MyItemInfo.MyContent.MyGrid.ResetContent(itm.MyContent.MyGrid);
} }
} }
public override bool CanExpand { get { return false; } set { ;} } public override bool CanExpand { get { return false; } set { ;} }
@@ -821,7 +663,7 @@ namespace Volian.Controls.Library
MyFlexGrid.Select(0, 0); MyFlexGrid.Select(0, 0);
MyFlexGrid.FirstEntry = true; // to fix a problem with initial mouse click into table MyFlexGrid.FirstEntry = true; // to fix a problem with initial mouse click into table
} }
catch (Exception ex) catch (Exception)
{ {
FlexibleMessageBox.Show("The content of this table is corrupted. You will either need to restore a previous version or delete it.", "Table Corrupted", MessageBoxButtons.OK, MessageBoxIcon.Information); FlexibleMessageBox.Show("The content of this table is corrupted. You will either need to restore a previous version or delete it.", "Table Corrupted", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
@@ -831,21 +673,13 @@ namespace Volian.Controls.Library
{ {
_MyLog.WarnFormat("Attempt to give Focus to Disposed Object {0}", MyID); _MyLog.WarnFormat("Attempt to give Focus to Disposed Object {0}", MyID);
} }
//ScrollToCenter();
} }
public override void ItemShow() public override void ItemShow()
{ {
MyFlexGrid.Focus(); MyFlexGrid.Focus();
//ScrollToCenter();
} }
public StepRTB DisplayRoStepRTB; public StepRTB DisplayRoStepRTB;
public override StepRTB MyStepRTB public override StepRTB MyStepRTB => MyFlexGrid.TableCellEditor;
{
get
{
return MyFlexGrid.TableCellEditor;
}
}
public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg) public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg)
{ {
int r = MyFlexGrid.Row; int r = MyFlexGrid.Row;
@@ -874,11 +708,11 @@ namespace Volian.Controls.Library
if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf; if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf;
if (dr == DialogResult.Yes || dr == DialogResult.Cancel) return dr; if (dr == DialogResult.Yes || dr == DialogResult.Cancel) return dr;
} }
c = c + 1; c++;
if (c == w) if (c == w)
{ {
c = 0; c = 0;
r = r + 1; r++;
} }
if (r < h) if (r < h)
{ {
@@ -908,11 +742,11 @@ namespace Volian.Controls.Library
if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf; if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf;
if (dr == DialogResult.Yes || dr == DialogResult.Cancel) return dr; if (dr == DialogResult.Yes || dr == DialogResult.Cancel) return dr;
} }
c = c - 1; c--;
if (c < 0) if (c < 0)
{ {
c = MyFlexGrid.Cols.Count - 1; c = MyFlexGrid.Cols.Count - 1;
r = r - 1; r--;
} }
cr = MyFlexGrid.GetMergedRange(r, c); cr = MyFlexGrid.GetMergedRange(r, c);
if (r >= 0 && cr.r1 == r && cr.c1 == c) if (r >= 0 && cr.r1 == r && cr.c1 == c)
@@ -946,11 +780,11 @@ namespace Volian.Controls.Library
bool scn = MyStepRTB.FindText(str, caseSensitive, matchWholeWord, reverse); bool scn = MyStepRTB.FindText(str, caseSensitive, matchWholeWord, reverse);
if (scn) return true; if (scn) return true;
} }
c = c + 1; c++;
if (c == w) if (c == w)
{ {
c = 0; c = 0;
r = r + 1; r++;
} }
if (r < h) if (r < h)
{ {
@@ -972,11 +806,11 @@ namespace Volian.Controls.Library
bool scn = MyStepRTB.FindText(str, caseSensitive, matchWholeWord, reverse); bool scn = MyStepRTB.FindText(str, caseSensitive, matchWholeWord, reverse);
if (scn) return true; if (scn) return true;
} }
c = c - 1; c--;
if (c < 0) if (c < 0)
{ {
c = MyFlexGrid.Cols.Count - 1; c = MyFlexGrid.Cols.Count - 1;
r = r - 1; r--;
} }
cr = MyFlexGrid.GetMergedRange(r, c); cr = MyFlexGrid.GetMergedRange(r, c);
if (r >= 0 && cr.r1 == r && cr.c1 == c) if (r >= 0 && cr.r1 == r && cr.c1 == c)
@@ -1002,11 +836,11 @@ namespace Volian.Controls.Library
MyFlexGrid.StartEditing(); MyFlexGrid.StartEditing();
return; return;
} }
c = c - 1; c--;
if (c < 0) if (c < 0)
{ {
c = MyFlexGrid.Cols.Count - 1; c = MyFlexGrid.Cols.Count - 1;
r = r - 1; r--;
} }
if (r >= 0) if (r >= 0)
{ {
@@ -1055,11 +889,11 @@ namespace Volian.Controls.Library
if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf; if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf;
if (!scn) return false; if (!scn) return false;
} }
c = c + 1; c++;
if (c == w) if (c == w)
{ {
c = 0; c = 0;
r = r + 1; r++;
} }
} }
return true; return true;
@@ -1092,29 +926,19 @@ namespace Volian.Controls.Library
MyFlexGrid.ShowTableCellShading(); MyFlexGrid.ShowTableCellShading();
} }
} }
public override void SetActive() public override void SetActive() => AdjustColorsForEditMode();
{
AdjustColorsForEditMode();
}
private bool _Empty = false; private bool _Empty = false;
public override bool Empty public override bool Empty
{ {
get { return _Empty; } get { return _Empty; }
set { _Empty = value; } set { _Empty = value; }
} }
private bool _Initializing = false;
public bool Initializing public bool Initializing { get; set; } = false;
{
get { return _Initializing; }
set { _Initializing = value; }
}
private bool _ActiveMode = false; private bool _ActiveMode = false;
public override void RefreshDisplay(bool activeMode) public override void RefreshDisplay(bool activeMode)
{ {
_ActiveMode = activeMode; _ActiveMode = activeMode;
//XmlDocument xd = new XmlDocument();
//xd.LoadXml(MyItemInfo.MyContent.MyGrid.Data);
//using (StringReader sr = new StringReader())
Initializing = true; Initializing = true;
MyFlexGrid.LoadGrid(MyItemInfo); MyFlexGrid.LoadGrid(MyItemInfo);
Initializing = false; Initializing = false;
@@ -1148,24 +972,10 @@ namespace Volian.Controls.Library
{ {
// if this is an RO Table, regenerate xml. This is done in the case that // if this is an RO Table, regenerate xml. This is done in the case that
// the rotable was updated by the ro editor. // the rotable was updated by the ro editor.
//if (MyFlexGrid.IsRoTable) RefreshGridData();
RefreshDisplay(false); RefreshDisplay(false);
IdentifyMe(false); IdentifyMe(false);
} }
//private void RefreshGridData()
//{
// string ROID = MyFlexGrid.ROID;
// int rodbid = MyFlexGrid.RODbId;
// //MyFlexGrid.Clear();
// ROFSTLookup MyROFSTLookup = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst.ROFSTLookup;
// MyFlexGrid.ConvertTableROToGrid(MyROFSTLookup.GetRoValue(ROID), rodbid, ROID);
// //ConvertTableToGrid(MyROFSTLookup.GetRoValue(ROID), rodbid, ROID);
// //MyFlexGrid.RODbId = rodbid;
// //MyFlexGrid.ROID = ROID;
// //MyFlexGrid.IsRoTable = true;
// //SaveContents();
//}
public override void SetExpandAndExpander(ItemInfo itemInfo) { CanExpand = false; } // can't expand a table public override void SetExpandAndExpander(ItemInfo itemInfo) { CanExpand = false; } // can't expand a table
public void SavePastedCellRoTran() public void SavePastedCellRoTran()
{ {
@@ -1176,7 +986,7 @@ namespace Volian.Controls.Library
int h = MyFlexGrid.Rows.Count; int h = MyFlexGrid.Rows.Count;
int r = 0; int r = 0;
int c = 0; int c = 0;
String Rtf = null; string Rtf;
while (r < h) while (r < h)
{ {
CellRange cr = MyFlexGrid.GetMergedRange(r, c); CellRange cr = MyFlexGrid.GetMergedRange(r, c);
@@ -1199,7 +1009,7 @@ namespace Volian.Controls.Library
string linkstr = mro.Groups[2].Value; string linkstr = mro.Groups[2].Value;
string[] roparts = linkstr.Split(" ".ToCharArray()); string[] roparts = linkstr.Split(" ".ToCharArray());
ContentRoUsage rousg = null; ContentRoUsage rousg = null;
int oldid = -1; int oldid;
using (Item itm = MyItemInfo.Get()) using (Item itm = MyItemInfo.Get())
{ {
using (RODb rodb = RODb.GetJustRoDb(Convert.ToInt32(roparts[2]))) using (RODb rodb = RODb.GetJustRoDb(Convert.ToInt32(roparts[2])))
@@ -1288,11 +1098,11 @@ namespace Volian.Controls.Library
SaveContents(); SaveContents();
} }
} }
c = c + 1; c++;
if (c == w) if (c == w)
{ {
c = 0; c = 0;
r = r + 1; r++;
} }
} }
} }
@@ -1304,7 +1114,6 @@ namespace Volian.Controls.Library
CellRange cr = MyFlexGrid.GetMergedRange(MyFlexGrid.Selection.r1, MyFlexGrid.Selection.c1); // B2018-127 get merged range CellRange cr = MyFlexGrid.GetMergedRange(MyFlexGrid.Selection.r1, MyFlexGrid.Selection.c1); // B2018-127 get merged range
int row = MyFlexGrid.Row; int row = MyFlexGrid.Row;
int col = MyFlexGrid.Col; int col = MyFlexGrid.Col;
//SaveContents();
DoNotRefresh = true; DoNotRefresh = true;
MyStepRTB.Rtf = MyStepRTB.DoNewLinkInGridCell(); MyStepRTB.Rtf = MyStepRTB.DoNewLinkInGridCell();
DoNotRefresh = false; DoNotRefresh = false;
@@ -1343,11 +1152,11 @@ namespace Volian.Controls.Library
return; return;
} }
} }
c = c + 1; c++;
if (c == w) if (c == w)
{ {
c = 0; c = 0;
r = r + 1; r++;
} }
} }
} }
+14 -94
View File
@@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@@ -18,17 +14,8 @@ namespace Volian.Controls.Library
{ {
#region IEditItem #region IEditItem
// set this for the imageitem so that other code (menuing/ribbons/treeview, etc) will continue to work. Include the MyItemInfo // set this for the imageitem so that other code (menuing/ribbons/treeview, etc) will continue to work. Include the MyItemInfo
public override StepRTB MyStepRTB public override StepRTB MyStepRTB => _MyStepRTB;
{ public override int TableWidth => (int)_MyPictureBox.Width + ImageMargin;
get { return _MyStepRTB; }
}
public override int TableWidth
{
get
{
return (int)_MyPictureBox.Width + ImageMargin;
}
}
/// <summary> /// <summary>
/// The left edge of the Tab /// The left edge of the Tab
/// </summary> /// </summary>
@@ -109,10 +96,7 @@ namespace Volian.Controls.Library
RefreshDisplay(false); RefreshDisplay(false);
SetExpandAndExpander(MyItemInfo); SetExpandAndExpander(MyItemInfo);
} }
public override void RefreshOrdinal() public override void RefreshOrdinal() => TabFormat = null;
{
TabFormat = null;
}
public override void HandleResize() {} public override void HandleResize() {}
public override void MatchExpanded() {} public override void MatchExpanded() {}
/// <summary> /// <summary>
@@ -176,7 +160,7 @@ namespace Volian.Controls.Library
SetWidthsAndHeights(img); SetWidthsAndHeights(img);
//need this to trigger update of steptabribbonbuttons: //need this to trigger update of steptabribbonbuttons:
// B2020-083: crash after approve of procedure when no edit window displayed - check for nulls // B2020-083: crash after approve of procedure when no edit window displayed - check for nulls
if (MyStepPanel != null && MyStepPanel.MyStepTabPanel != null) MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling(true); if (MyStepPanel != null && MyStepPanel.MyStepTabPanel != null) MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling();
} }
public override void ToggleEditView(E_ViewMode vwMode) {} public override void ToggleEditView(E_ViewMode vwMode) {}
public override string TabFormat public override string TabFormat
@@ -200,14 +184,8 @@ namespace Volian.Controls.Library
public override Point TabLocation { get { return lblTab.Location; } } public override Point TabLocation { get { return lblTab.Location; } }
public override Font ContentFont { get { return MyStepRTB.Font; } set { /*MyStepRTB.Font = value*/; } } public override Font ContentFont { get { return MyStepRTB.Font; } set { /*MyStepRTB.Font = value*/; } }
public override float ContentTop { get { return MyPictureBox.Top; } } public override float ContentTop { get { return MyPictureBox.Top; } }
public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg) public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg) => DialogResult.OK;
{ public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse) => false;
return DialogResult.OK;
}
public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse)
{
return false;
}
public override void PositionToEnd() public override void PositionToEnd()
{ {
return; return;
@@ -216,14 +194,8 @@ namespace Volian.Controls.Library
{ {
return; return;
} }
public override string SelectedTextForFind public override string SelectedTextForFind => null;
{ public override bool SpellCheckNext() => true;
get { return null; }
}
public override bool SpellCheckNext()
{
return true;
}
public override bool Empty public override bool Empty
{ {
get get
@@ -249,22 +221,17 @@ namespace Volian.Controls.Library
get { return _MyPictureBox; } get { return _MyPictureBox; }
} }
private string FileName = null; private string FileName = null;
private static int _ImageMargin = 18;
/// <summary> /// <summary>
/// Margin between the EditItem and the ImageItem. Appears on the Right. /// Margin between the EditItem and the ImageItem. Appears on the Right.
/// Will allow space to draw a Change Bar on the right side of the EditItem. /// Will allow space to draw a Change Bar on the right side of the EditItem.
/// </summary> /// </summary>
public static int ImageMargin public static int ImageMargin { get; set; } = 18;
{
get { return _ImageMargin; }
set { _ImageMargin = value; }
}
private bool _IsDirty = false; private bool _IsDirty = false;
private int _origCfgHt = 0; // keep track if original size was stored in cfg private int _origCfgHt = 0; // keep track if original size was stored in cfg
private int _origCfgWd = 0; private int _origCfgWd = 0;
private bool _pastedNew = false; // need this for flagging newly pasted image (may need to clear cfg) private bool _pastedNew = false; // need this for flagging newly pasted image (may need to clear cfg)
private DisplayTags _displayTags = new DisplayTags(); private DisplayTags _displayTags = new DisplayTags();
//House myhouse = new House();
#endregion #endregion
#region Constructors #region Constructors
@@ -390,10 +357,7 @@ namespace Volian.Controls.Library
{ {
InsType = insType; InsType = insType;
FileName = null; FileName = null;
//InitializeComponent();
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false); SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false);
//MyPictureBox.Width = 100;
//MyPictureBox.Height = 100;
this.Width = 100 + ImageMargin; this.Width = 100 + ImageMargin;
this.Height = 100; this.Height = 100;
if (insType == ImageItem.E_ImageSource.File) if (insType == ImageItem.E_ImageSource.File)
@@ -409,7 +373,7 @@ namespace Volian.Controls.Library
MyPictureBox.Image = img; MyPictureBox.Image = img;
SetWidthsAndHeights(img); SetWidthsAndHeights(img);
string ext = GetImageFormatExtension(img); string ext = GetImageFormatExtension(img);
FileName = "paste." + ext; FileName = $"paste.{ext}";
_IsDirty = true; _IsDirty = true;
} }
} }
@@ -455,51 +419,7 @@ namespace Volian.Controls.Library
} }
} }
} }
//public static System.Drawing.Imaging.ImageFormat GetImageFormat(this System.Drawing.Image img) private static string GetImageFormatExtension(System.Drawing.Image img) => ("jpg"); // seems that this is the only one that works.
//{
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg))
// return System.Drawing.Imaging.ImageFormat.Jpeg;
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Bmp))
// return System.Drawing.Imaging.ImageFormat.Bmp;
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Png))
// return System.Drawing.Imaging.ImageFormat.Png;
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Emf))
// return System.Drawing.Imaging.ImageFormat.Emf;
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Exif))
// return System.Drawing.Imaging.ImageFormat.Exif;
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif))
// return System.Drawing.Imaging.ImageFormat.Gif;
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Icon))
// return System.Drawing.Imaging.ImageFormat.Icon;
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.MemoryBmp))
// return System.Drawing.Imaging.ImageFormat.MemoryBmp;
// if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Tiff))
// return System.Drawing.Imaging.ImageFormat.Tiff;
// else
// return System.Drawing.Imaging.ImageFormat.Wmf;
//}
private static string GetImageFormatExtension(System.Drawing.Image img)
{
return ("jpg"); // seems that this is the only one that works.
/*
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg))
return "jpg";
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Bmp))
return "bmp";
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Png))
return "png";
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Emf))
return "emf";
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif))
return "gif";
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Icon))
return "ico";
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Tiff))
return "tif";
else
return "wmf";
*/
}
#endregion #endregion
#region RO_Images #region RO_Images
public void HandleRoImage() public void HandleRoImage()
@@ -750,7 +670,7 @@ namespace Volian.Controls.Library
MyPictureBox.Image = img; MyPictureBox.Image = img;
SetWidthsAndHeights(img); SetWidthsAndHeights(img);
string ext = GetImageFormatExtension(img); string ext = GetImageFormatExtension(img);
FileName = "paste." + ext; FileName = $"paste.{ext}";
} }
} }
void MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args) void MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args)
@@ -964,7 +884,7 @@ namespace Volian.Controls.Library
{ {
string ext = ImageItem.GetImageFormatExtension(img); string ext = ImageItem.GetImageFormatExtension(img);
filename = "paste." + ext; filename = $"paste.{ext}";
} }
else else
img = null; img = null;
+5 -40
View File
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library namespace Volian.Controls.Library
@@ -19,11 +17,11 @@ namespace Volian.Controls.Library
// First parse the string // First parse the string
if (_LinkInfoText.Contains(@"\v")) if (_LinkInfoText.Contains(@"\v"))
throw new Exception("LinkText.ParseLink found RTF token"); throw new Exception("LinkText.ParseLink found RTF token");
//_LinkInfoText = _LinkInfoText.Replace(@"\v ", ""); // this is not needed because this is selected Text does not contain RTF tokens
// for tran : "2, #, #, # and 4#Link:TransitionRange:2 10 173 166" // for tran : "2, #, #, # and 4#Link:TransitionRange:2 10 173 166"
Match m = Regex.Match(_LinkInfoText, @"(.*)[#]Link:([A-Za-z]*):(.*)"); Match m = Regex.Match(_LinkInfoText, @"(.*)[#]Link:([A-Za-z]*):(.*)");
_MyValue = m.Groups[1].Value; //for debugging
_MyLink = "#Link:" + m.Groups[2].Value + ":" + m.Groups[3].Value; //string _MyValue = m.Groups[1].Value;
//string _MyLink = $"#Link:{m.Groups[2].Value}:{m.Groups[3].Value}";
switch (m.Groups[2].Value) switch (m.Groups[2].Value)
{ {
case "ReferencedObject": case "ReferencedObject":
@@ -56,11 +54,8 @@ namespace Volian.Controls.Library
} }
} }
} }
private string _LinkInfoText; private readonly string _LinkInfoText;
public string LinkInfoText public string LinkInfoText => _LinkInfoText;
{
get { return _LinkInfoText; }
}
private TransitionInfo _MyTransitionInfo = null; private TransitionInfo _MyTransitionInfo = null;
public TransitionInfo MyTransitionInfo public TransitionInfo MyTransitionInfo
{ {
@@ -74,42 +69,12 @@ namespace Volian.Controls.Library
{ {
get { ParseLink(); return _MyTransitionInfo.MyItemRangeID; } get { ParseLink(); return _MyTransitionInfo.MyItemRangeID; }
} }
private string _MyValue = null;
//public string MyValue
//{
// get { ParseLink(); return _MyValue; }
//}
private string _MyLink = null;
//public string MyLink
//{
// get { ParseLink(); return _MyLink; }
//}
private RoUsageInfo _MyRoUsageInfo; private RoUsageInfo _MyRoUsageInfo;
public RoUsageInfo MyRoUsageInfo public RoUsageInfo MyRoUsageInfo
{ {
get { ParseLink(); return _MyRoUsageInfo; } get { ParseLink(); return _MyRoUsageInfo; }
} }
//private string _Roid = null; // TODO: need to return Referenced Object rather than just roid
//public string Roid
//{
// get { ParseLink(); return _Roid; }
//}
//private string _RoUsageid = null; // TODO: need to return Referenced Object rather than just roid
//public string RoUsageid
//{
// get { ParseLink(); return _RoUsageid; }
//}
//private string _RoDbid = null; // TODO: need to return Referenced Object rather than just roid
//public string RoDbid
//{
// get { ParseLink(); return _RoDbid; }
//}
private ParsedLinkType _MyParsedLinkType = ParsedLinkType.NotParsed; private ParsedLinkType _MyParsedLinkType = ParsedLinkType.NotParsed;
//public ParsedLinkType MyParsedLinkType
//{
// get { ParseLink(); return _MyParsedLinkType; }
//}
} }
#region enums #region enums
public enum ParsedLinkType : int public enum ParsedLinkType : int
@@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace Volian.Controls.Library namespace Volian.Controls.Library
+17 -34
View File
@@ -13,14 +13,10 @@ namespace Volian.Controls.Library
public event ItemInfoEvent AfterRemove; public event ItemInfoEvent AfterRemove;
internal void OnAfterRemove(object sender) internal void OnAfterRemove(object sender)
{ {
if (AfterRemove != null) AfterRemove(sender); AfterRemove?.Invoke(sender);
}
private int _MaxItems = 10;
public int MaxItems
{
get { return _MaxItems; }
set { _MaxItems = value; }
} }
public int MaxItems { get; set; } = 10;
public new MostRecentItem Add(MostRecentItem myMRI) public new MostRecentItem Add(MostRecentItem myMRI)
{ {
Refresh(); Refresh();
@@ -53,8 +49,7 @@ namespace Volian.Controls.Library
// when a delete item occurs. // when a delete item occurs.
void MyItemInfo_BeforeDelete(object sender) void MyItemInfo_BeforeDelete(object sender)
{ {
ItemInfo ii = sender as ItemInfo; if (sender is ItemInfo ii)
if (ii != null)
{ {
MostRecentItem tmp = null; MostRecentItem tmp = null;
// Look for the ItemID // Look for the ItemID
@@ -101,8 +96,10 @@ namespace Volian.Controls.Library
public static MostRecentItemList GetMRILst(System.Collections.Specialized.StringCollection list, int maxItems) public static MostRecentItemList GetMRILst(System.Collections.Specialized.StringCollection list, int maxItems)
{ {
MostRecentItemList mril = new MostRecentItemList(); MostRecentItemList mril = new MostRecentItemList
mril.MaxItems = maxItems; {
MaxItems = maxItems
};
if (list != null) if (list != null)
for (int i = list.Count - 1; i >= 0;i-- )// Add in reverse order so first is last and last is first for (int i = list.Count - 1; i >= 0;i-- )// Add in reverse order so first is last and last is first
mril.Add(list[i]); mril.Add(list[i]);
@@ -127,27 +124,20 @@ namespace Volian.Controls.Library
get get
{ {
if (_MyItemInfo == null) if (_MyItemInfo == null)
_MyItemInfo = ItemInfo.Get(_ItemID); _MyItemInfo = ItemInfo.Get(ItemID);
return _MyItemInfo; return _MyItemInfo;
} }
set set
{ {
_ItemID = value.ItemID; ItemID = value.ItemID;
_MyItemInfo = value; _MyItemInfo = value;
_MenuTitle = GetMenuTitle(); _MenuTitle = GetMenuTitle();
_ToolTip = GetToolTip(_MyItemInfo); _ToolTip = GetToolTip(_MyItemInfo);
} }
} }
internal void Refresh() internal void Refresh() => MyItemInfo = MyItemInfo;
{
MyItemInfo = MyItemInfo; public int ItemID { get; set; }
}
private int _ItemID;
public int ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
private string _MenuTitle; private string _MenuTitle;
public string MenuTitle public string MenuTitle
{ {
@@ -159,10 +149,7 @@ namespace Volian.Controls.Library
} }
set { _MenuTitle = value; } set { _MenuTitle = value; }
} }
private string GetMenuTitle() private string GetMenuTitle() => MyItemInfo.Path;
{
return MyItemInfo.Path;
}
private string _ToolTip; private string _ToolTip;
public string ToolTip public string ToolTip
{ {
@@ -177,10 +164,9 @@ namespace Volian.Controls.Library
private static string GetToolTip(ItemInfo item) private static string GetToolTip(ItemInfo item)
{ {
// reset active parent if null // reset active parent if null
// if (MyItemInfo.MyProcedure.ActiveParent == null) MyItemInfo.MyProcedure.ActiveParent = null;
DocVersionInfo tmp = (DocVersionInfo)(item.MyProcedure.ActiveParent); DocVersionInfo tmp = (DocVersionInfo)(item.MyProcedure.ActiveParent);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
int indent = BuildPath(tmp.MyFolder, ref sb); _ = BuildPath(tmp.MyFolder, ref sb); //indent
return sb.ToString(); return sb.ToString();
} }
private static int BuildPath(FolderInfo folderInfo, ref StringBuilder sb) private static int BuildPath(FolderInfo folderInfo, ref StringBuilder sb)
@@ -192,7 +178,7 @@ namespace Volian.Controls.Library
} }
public override string ToString() public override string ToString()
{ {
return string.Format("{0}~{1}~{2}", _ItemID, MenuTitle, ToolTip); return string.Format("{0}~{1}~{2}", ItemID, MenuTitle, ToolTip);
} }
private static ItemInfo GetCorrectItemInfoType(int itemId) private static ItemInfo GetCorrectItemInfoType(int itemId)
{ {
@@ -228,9 +214,6 @@ namespace Volian.Controls.Library
} }
return _RetainBadMRIs == 2; return _RetainBadMRIs == 2;
} }
public MostRecentItem(ItemInfo myItem) public MostRecentItem(ItemInfo myItem) => MyItemInfo = myItem;
{
MyItemInfo = myItem;
}
} }
} }
@@ -1,11 +1,3 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
public partial class PreviewMultiLineRO : DevComponents.DotNetBar.Office2007Form //Form public partial class PreviewMultiLineRO : DevComponents.DotNetBar.Office2007Form //Form
@@ -1,10 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO; using System.IO;
namespace Volian.Controls.Library namespace Volian.Controls.Library
@@ -30,9 +25,6 @@ namespace Volian.Controls.Library
this.roImage.Image = thmb; this.roImage.Image = thmb;
this.Text = title; this.Text = title;
} }
public bool ThumbnailCallback() public bool ThumbnailCallback() => false;
{
return false;
}
} }
} }
+4 -98
View File
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@@ -450,11 +448,6 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Structures #region Structures
//struct CharRange
//{
// public int cpMin;
// public int cpMax;
//}
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Auto)] [StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Auto)]
public struct CharFormat2 public struct CharFormat2
{ {
@@ -874,25 +867,6 @@ namespace Volian.Controls.Library
pft.dySpaceBefore = spaceBefore * 1440 / dpi; pft.dySpaceBefore = spaceBefore * 1440 / dpi;
SetParaFormat(richTextBox, pft); SetParaFormat(richTextBox, pft);
} }
//developed for equation editor interface work, but ended up not needing it. Kept it in
// case it is needed in the future.
//public static void SetSpaceAfter(RichTextBox richTextBox, int spaceAfter)
//{
// ParaFormatTwo pft = GetParaFormat(richTextBox);
// pft.dwMask = 0;
// pft.dwMask |= ParaFormatMasks.PFM_SPACEAFTER;
// // get the monitor's resolution in DPI and use it to set the linespacing value for
// // the richtextbox. Note that without this, the Arial Unicode font made the appearance of
// // almost double linespacing. Using PFS_Exact makes it appear as regular single spacing.
// Graphics g = richTextBox.CreateGraphics();
// int dpi = Convert.ToInt32((g.DpiX + g.DpiY) / 2);
// g.Dispose();
// // dyLineSpacing is Spacing between lines. the PFS_EXACT sets line spacing as the spacing from one
// //line to the next, in twips - thus the 1440.
// pft.dySpaceAfter = spaceAfter * 1440 / dpi;
// SetParaFormat(richTextBox, pft);
//}
public static void SetLineSpacing(RichTextBox richTextBox, ParaSpacing type) public static void SetLineSpacing(RichTextBox richTextBox, ParaSpacing type)
{ {
ParaFormatTwo pft = GetParaFormat(richTextBox); ParaFormatTwo pft = GetParaFormat(richTextBox);
@@ -955,14 +929,9 @@ namespace Volian.Controls.Library
} }
SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft); SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
} }
public static bool IsSuperScript(RichTextBox richTextBox) public static bool IsSuperScript(RichTextBox richTextBox) => (richTextBox.SelectionCharOffset > 0);
{ public static bool IsSubScript(RichTextBox richTextBox) => (richTextBox.SelectionCharOffset < 0);
return (richTextBox.SelectionCharOffset>0); [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping RTBSelection")]
}
public static bool IsSubScript(RichTextBox richTextBox)
{
return (richTextBox.SelectionCharOffset < 0);
}
public static void ToggleSubscript(bool bSet, RichTextBox richTextBox, RTBSelection selection) public static void ToggleSubscript(bool bSet, RichTextBox richTextBox, RTBSelection selection)
{ {
if (bSet) if (bSet)
@@ -970,6 +939,7 @@ namespace Volian.Controls.Library
else else
richTextBox.SelectionCharOffset = 0; richTextBox.SelectionCharOffset = 0;
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping RTBSelection")]
public static void ToggleSuperscript(bool bSet, RichTextBox richTextBox, RTBSelection selection) public static void ToggleSuperscript(bool bSet, RichTextBox richTextBox, RTBSelection selection)
{ {
if (bSet) if (bSet)
@@ -1040,70 +1010,6 @@ namespace Volian.Controls.Library
} }
SetCharFormat(richTextBox, selection, cft); SetCharFormat(richTextBox, selection, cft);
} }
//public static bool IsLink(RichTextBox richTextBox)
//{
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
// return ((cft.dwEffects & CharFormatEffects.CFE_PROTECTED) == CharFormatEffects.CFE_PROTECTED);
//}
//public static void ToggleLink(bool bSet, RichTextBox richTextBox, RTBSelection selection)
//{
// CharFormatTwo cft = GetCharFormat(richTextBox, selection);
// if (bSet)
// {
// cft.dwEffects |= CharFormatEffects.CFE_LINK;
// cft.dwMask |= CharFormatMasks.CFM_LINK;
// }
// else
// {
// cft.dwEffects &= ~RTBAPI.CharFormatEffects.CFE_LINK;
// }
// SetCharFormat(richTextBox, selection, cft);
//}
//public static void UnProtect(RichTextBox richTextBox) //, string type, string text, string link)
//{
// //richTextBox.DetectUrls = false;
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
// //int position = richTextBox.SelectionStart = richTextBox.TextLength;
// //richTextBox.SelectionLength = 0;
// //richTextBox.SelectedRtf = @"{\rtf1\ansi " + text + @"\v #" + link + @"\v0}";
// //richTextBox.SelectedRtf = "{" + string.Format(@"\rtf1\ansi\protect\v {0}\v0 {1}\v #{2}", type, text, link) + "}";
// //richTextBox.Select(position, type.Length + text.Length + link.Length + 1);
// cft.dwMask = RTBAPI.CharFormatMasks.CFM_PROTECTED;
// cft.dwEffects = 0;
// // The lines below can be used to allow link text to be edited
// //charFormat.dwMask = RTBAPI.CharFormatMasks.CFM_LINK;
// //charFormat.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK;
// SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
// //rtbRTF.SetSelectionLink(true);
// //richTextBox.SelectionStart = richTextBox.TextLength;
// //richTextBox.SelectionLength = 0;
//}
//public static void Protect(RichTextBox richTextBox) //, string type, string text, string link)
//{
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
// cft.dwMask = CharFormatMasks.CFM_PROTECTED;
// cft.dwEffects = CharFormatEffects.CFE_PROTECTED;
// SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
//}
//public static void SetLink(RichTextBox richTextBox, string type, string text, string link)
//{
// richTextBox.DetectUrls = false;
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
// int position = richTextBox.SelectionStart = richTextBox.TextLength;
// richTextBox.SelectionLength = 0;
// //richTextBox.SelectedRtf = @"{\rtf1\ansi " + text + @"\v #" + link + @"\v0}";
// richTextBox.SelectedRtf = "{" + string.Format(@"\rtf1\ansi\protect\v {0}\v0 {1}\v #{2}", type, text, link) + "}";
// richTextBox.Select(position, type.Length + text.Length + link.Length + 1);
// cft.dwMask = RTBAPI.CharFormatMasks.CFM_LINK | RTBAPI.CharFormatMasks.CFM_PROTECTED;
// cft.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK | RTBAPI.CharFormatEffects.CFE_PROTECTED;
// // The lines below can be used to allow link text to be edited
// //charFormat.dwMask = RTBAPI.CharFormatMasks.CFM_LINK;
// //charFormat.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK;
// SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
// //rtbRTF.SetSelectionLink(true);
// richTextBox.SelectionStart = richTextBox.TextLength;
// richTextBox.SelectionLength = 0;
//}
#endregion #endregion
} }
} }
+17 -214
View File
@@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
@@ -39,10 +35,7 @@ namespace Volian.Controls.Library
/// <summary> /// <summary>
/// Used to connect the RichTextBox with the menus and toolbars /// Used to connect the RichTextBox with the menus and toolbars
/// </summary> /// </summary>
public override StepRTB MyStepRTB public override StepRTB MyStepRTB => _MyStepRTB;
{
get { return _MyStepRTB; }
}
public override int TableWidth { get { return (int)GetTableWidth(_MyStepRTB.Font, MyItemInfo.MyContent.Text, true); } } public override int TableWidth { get { return (int)GetTableWidth(_MyStepRTB.Font, MyItemInfo.MyContent.Text, true); } }
/// <summary> /// <summary>
@@ -80,8 +73,6 @@ namespace Volian.Controls.Library
get { return _MyStepRTB.Width; } get { return _MyStepRTB.Width; }
set set
{ {
// This is wrong for single column (KBR) - RHM Debug:
//MyStepRTB.Width = value;
Width = value + lblTab.Left + lblTab.Width + (this.Width - MyStepRTB.Right); Width = value + lblTab.Left + lblTab.Width + (this.Width - MyStepRTB.Right);
} }
} }
@@ -167,7 +158,6 @@ namespace Volian.Controls.Library
{ {
ItemInfo.ResetTabString(MyID); ItemInfo.ResetTabString(MyID);
string tabString = MyItemInfo.IsSection ? MyItemInfo.DisplayNumber.PadRight(MyItemInfo.MyTab.CleanText.Length) : MyItemInfo.MyTab.CleanText; string tabString = MyItemInfo.IsSection ? MyItemInfo.DisplayNumber.PadRight(MyItemInfo.MyTab.CleanText.Length) : MyItemInfo.MyTab.CleanText;
//string tabString = /*MyItemInfo.IsSection ? MyItemInfo.DisplayNumber : */ MyItemInfo.MyTab.CleanText;
if (!MyItemInfo.IsProcedure) lblTab.Text = tabString; // B2021-068: don't reset if procedure (it is blank when initialized) if (!MyItemInfo.IsProcedure) lblTab.Text = tabString; // B2021-068: don't reset if procedure (it is blank when initialized)
// calculate the width based upon characters per inch considering user's DPI // calculate the width based upon characters per inch considering user's DPI
@@ -182,7 +172,6 @@ namespace Volian.Controls.Library
bool lastDigitSingle = Regex.IsMatch(tabString, "^.*[^0-9][0-9] *$"); bool lastDigitSingle = Regex.IsMatch(tabString, "^.*[^0-9][0-9] *$");
lblTab.Width = ((lastDigitSingle && MyItemInfo.IsStep ? 1 : 0) + tabString.Length) * MyStepPanel.DPI / cpi; lblTab.Width = ((lastDigitSingle && MyItemInfo.IsStep ? 1 : 0) + tabString.Length) * MyStepPanel.DPI / cpi;
Invalidate(); Invalidate();
//if (MyItemInfo.MyTab.Offset == 0) // commented out for Farley bug fix B2015-123 alignment of tabs on the edit screen (Farly is only one using tab offset)
{ {
// In the following if statement, the last part, 'IsHigh & PageBreakOnStep' (PageBreakOnStep // In the following if statement, the last part, 'IsHigh & PageBreakOnStep' (PageBreakOnStep
// flags background steps and IsHigh is for the HLS - Cautions/Notes were ok), was added // flags background steps and IsHigh is for the HLS - Cautions/Notes were ok), was added
@@ -201,16 +190,11 @@ namespace Volian.Controls.Library
#endregion #endregion
#region Properties #region Properties
private static int _RTBMargin = 3;
/// <summary> /// <summary>
/// Margin between the EditItem and the StepRTB. Appears on the Right. /// Margin between the EditItem and the StepRTB. Appears on the Right.
/// Will allow space to draw a Change Bar on the right side of the EditItem. /// Will allow space to draw a Change Bar on the right side of the EditItem.
/// </summary> /// </summary>
public static int RTBMargin public static int RTBMargin { get; set; } = 3;
{
get { return _RTBMargin; }
set { _RTBMargin = value; }
}
private int? _CheckOffMargin = null; private int? _CheckOffMargin = null;
/// <summary> /// <summary>
/// Margin between the EditItem and the StepRTB. Appears on the Right. /// Margin between the EditItem and the StepRTB. Appears on the Right.
@@ -238,24 +222,10 @@ namespace Volian.Controls.Library
} }
set { _CheckOffMargin = value; } set { _CheckOffMargin = value; }
} }
private EnhancedAddTypes _EnhAddType = EnhancedAddTypes.No;
public EnhancedAddTypes EnhAddType public EnhancedAddTypes EnhAddType { get; set; } = EnhancedAddTypes.No;
{ public ItemInfo EnhAddFromItemInfo { get; set; } = null;
get { return _EnhAddType; } public bool DoingPasteReplace { get; set; } = false;
set { _EnhAddType = value; }
}
private ItemInfo _EnhAddFromItemInfo = null;
public ItemInfo EnhAddFromItemInfo
{
get { return _EnhAddFromItemInfo; }
set { _EnhAddFromItemInfo = value; }
}
private bool _DoingPasteReplace = false;
public bool DoingPasteReplace
{
get { return _DoingPasteReplace; }
set { _DoingPasteReplace = value; }
}
#endregion #endregion
#region Constructors #region Constructors
public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand) public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand)
@@ -263,7 +233,6 @@ namespace Volian.Controls.Library
// B2016-179 If the parent is a section and the child is not a step then set expand to true. // B2016-179 If the parent is a section and the child is not a step then set expand to true.
// B2016-211 Added subsection check - don't expand all of the sub sections when you open a section (Farley) // B2016-211 Added subsection check - don't expand all of the sub sections when you open a section (Farley)
expand |= (!itemInfo.IsStepPart && itemInfo.ActiveParent.IsSection) && !itemInfo.IsSubsection; expand |= (!itemInfo.IsStepPart && itemInfo.ActiveParent.IsSection) && !itemInfo.IsSubsection;
//// TIMING: DisplayItem.TimeIt("CSLARTB Top");
InitializeComponent();// TODO: Performance 25% InitializeComponent();// TODO: Performance 25%
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, false); SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, false);
MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged); MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged);
@@ -273,7 +242,6 @@ namespace Volian.Controls.Library
// B2016-179 If the parent is a section and the child is not a step then set expand to true. // B2016-179 If the parent is a section and the child is not a step then set expand to true.
// B2016-211 Added subsection check - don't expand all of the sub sections when you open a section (Farley) // B2016-211 Added subsection check - don't expand all of the sub sections when you open a section (Farley)
expand |= (!itemInfo.IsStepPart && itemInfo.ActiveParent is SectionInfo) && !itemInfo.IsSubsection; expand |= (!itemInfo.IsStepPart && itemInfo.ActiveParent is SectionInfo) && !itemInfo.IsSubsection;
//// TIMING: DisplayItem.TimeIt("CSLARTB Top");
InitializeComponent();// TODO: Performance 25% InitializeComponent();// TODO: Performance 25%
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false); SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false);
MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged); MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged);
@@ -283,124 +251,10 @@ namespace Volian.Controls.Library
// B2016-179 If the parent is a section and the child is not a step then set expand to true. // B2016-179 If the parent is a section and the child is not a step then set expand to true.
// B2016-211 Added subsection check - don't expand all of the sub sections when you open a section (Farley) // B2016-211 Added subsection check - don't expand all of the sub sections when you open a section (Farley)
expand |= (!itemInfo.IsStepPart && itemInfo.ActiveParent is SectionInfo) && !itemInfo.IsSubsection; expand |= (!itemInfo.IsStepPart && itemInfo.ActiveParent is SectionInfo) && !itemInfo.IsSubsection;
//// TIMING: DisplayItem.TimeIt("CSLARTB Top");
InitializeComponent();// TODO: Performance 25% InitializeComponent();// TODO: Performance 25%
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, addFirstChld); SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, addFirstChld);
MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged); MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged);
} }
//private void SetupRTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem)
//{
// //if (itemInfo.ItemID == 225) _MyStepRTB.Resize += new EventHandler(_MyStepRTB_Resize);
// //_MyStepRTB.MyRTBItem = this;
// //// TIMING: DisplayItem.TimeIt("CSLARTB InitComp");
// BackColor = myStepPanel.PanelColor;
// //_MyStepRTB.BackColor = myStepPanel.InactiveColor;
// // TODO: Adjust top based upon format
// // TODO: Remove Label and just output ident on the paint event
// lblTab.Left = 20;
// SetupHeader(itemInfo);
// this.Paint += new PaintEventHandler(RTBItem_Paint);
// this.BackColorChanged += new EventHandler(RTBItem_BackColorChanged);
// if (itemInfo != null)
// {
// ContentType = (int)itemInfo.MyContent.Type;
// switch (ContentType / 10000)
// {
// case 0: // Procedure
// _MyStepRTB.Font = myStepPanel.ProcFont;// lblTab.Font = myStepPanel.ProcFont;
// lblTab.Font = itemInfo.MyTab.MyFont.WindowsFont;
// break;
// case 1: // Section
// _MyStepRTB.Font = myStepPanel.SectFont;// lblTab.Font = myStepPanel.SectFont;
// lblTab.Font = itemInfo.MyTab.MyFont.WindowsFont;
// break;
// case 2: // Steps
// _MyStepRTB.Font = myStepPanel.StepFont;//lblTab.Font = myStepPanel.StepFont;
// lblTab.Font = itemInfo.MyTab.MyFont.WindowsFont;
// MyStepData = itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[ContentType % 10000];
// break;
// }
// //this.Move += new EventHandler(DisplayItem_Move);
// }
// else
// {
// if (myStepPanel.MyFont != null) _MyStepRTB.Font = lblTab.Font = myStepPanel.MyFont;
// }
// if (expand) _MyvlnExpander.ShowExpanded();
// MyStepPanel = myStepPanel;
// if (itemInfo != null) myStepPanel._LookupEditItems.Add(itemInfo.ItemID, this);
// _MyChildRelation = myChildRelation;
// if (myParentEditItem != null) RNOLevel = myParentEditItem.RNOLevel;
// if (itemInfo != null)
// {
// //// TIMING: DisplayItem.TimeIt("CSLARTB before _Layout");
// MyStepSectionLayoutData = itemInfo.ActiveFormat.MyStepSectionLayoutData;
// //// TIMING: DisplayItem.TimeIt("CSLARTB _Layout");
// if (myParentEditItem != null)
// SeqLevel = myParentEditItem.SeqLevel + ((myChildRelation == ChildRelation.After || myChildRelation == ChildRelation.Before) && itemInfo.IsSequential ? 1 : 0);
// //// TIMING: DisplayItem.TimeIt("CSLARTB seqLevel");
// MyItemInfo = itemInfo;
// MyItemInfo.MyConfig.PropertyChanged += new PropertyChangedEventHandler(MyConfig_PropertyChanged);
// }
// //// TIMING: DisplayItem.TimeIt("CSLARTB MyItem");
// myStepPanel.Controls.Add(this);
// switch (myChildRelation)
// {
// case ChildRelation.After:
// AddItem(myParentEditItem, ref myParentEditItem._MyAfterEditItems, nextEditItem);
// break;
// case ChildRelation.Before:
// AddItem(myParentEditItem, ref myParentEditItem._MyBeforeEditItems, nextEditItem);
// break;
// case ChildRelation.RNO:
// RNOLevel = myParentEditItem.RNOLevel + 1;
// AddItem(myParentEditItem, ref myParentEditItem._MyRNOEditItems, nextEditItem);
// break;
// case ChildRelation.None:
// break;
// }
// if (itemInfo != null)
// {
// if (myChildRelation == ChildRelation.None)
// {
// if (ContentType == 0 && MyStepSectionLayoutData != null)
// {
// LastMethodsPush(string.Format("SetupRTBItem {0}", MyID));
// Width = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT);
// }
// }
// }
// //// TIMING: DisplayItem.TimeIt("CSLARTB Parent");
// SetText();
// //// TIMING: DisplayItem.TimeIt("CSLARTB SetText");
// if (itemInfo != null)
// {
// Name = string.Format("Item-{0}", itemInfo.ItemID);
// SetExpandAndExpander(itemInfo);
// if (expand && (itemInfo.MyContent.ContentPartCount != 0)) // If it should expand and it can expand
// Expand(true);
// else
// if (myParentEditItem == null)// If it is the top node
// if (ContentType >= 20000) // and it is a step - fully expand
// Expand(true);
// else // otherwise only expand one level
// Expand(false);
// }
// //// TIMING: DisplayItem.TimeIt("CSLARTB before Controls Add");
// //myStepPanel.Controls.Add(this);
// int top = FindTop(0);
// if (Top < top)
// {
// LastMethodsPush("SetupRTBItem");
// MyStepPanel.ItemMoving++;
// Top = top;
// MyStepPanel.ItemMoving--;
// LastMethodsPop();
// }
// _Loading = false;
// //// TIMING: DisplayItem.TimeIt("CSLARTB Controls Add");
//}
private void SetupHeader() private void SetupHeader()
{ {
SetupHeader(MyItemInfo); SetupHeader(MyItemInfo);
@@ -412,16 +266,13 @@ namespace Volian.Controls.Library
{ {
if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem) if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem)
ScrollToCenter(); ScrollToCenter();
//MyStepPanel.ScrollControlIntoView(this);
} }
void MyStepRTB_TextChanged(object sender, EventArgs e) void MyStepRTB_TextChanged(object sender, EventArgs e)
{ {
if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem) if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem)
ScrollToCenter(); ScrollToCenter();
//MyStepPanel.ScrollControlIntoView(this);
} }
private Label lblHeader = null; private Label lblHeader = null;
private Label lblFooter = null;
private void SetupHeaderFooter(ref Label lbl, string name, MetaTag mTag) private void SetupHeaderFooter(ref Label lbl, string name, MetaTag mTag)
{ {
if (lbl == null) lbl = new Label(); if (lbl == null) lbl = new Label();
@@ -479,11 +330,9 @@ namespace Volian.Controls.Library
if (ed.Type != 0) if (ed.Type != 0)
{ {
ItemInfo ii = ItemInfo.Get(ed.ItemID); ItemInfo ii = ItemInfo.Get(ed.ItemID);
//if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(ii))
if (ii != null) if (ii != null)
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnRefreshEnhancedDocument(new ItemSelectedChangedEventArgs(ii)); MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnRefreshEnhancedDocument(new ItemSelectedChangedEventArgs(ii));
if (dti != null) dti?.MyStepTabPanel.MyDisplayTabControl.OpenItem(this.MyItemInfo);
dti.MyStepTabPanel.MyDisplayTabControl.OpenItem(this.MyItemInfo);
} }
} }
} }
@@ -511,7 +360,6 @@ namespace Volian.Controls.Library
{ {
Cursor tmp = Cursor.Current; Cursor tmp = Cursor.Current;
Cursor.Current = Cursors.WaitCursor; Cursor.Current = Cursors.WaitCursor;
int top = TopMostEditItem.Top;// This doesn't work - this is since the last time it was expanded.
int topOffset = TopMostEditItem.Top + MyStepPanel.VerticalScroll.Value; int topOffset = TopMostEditItem.Top + MyStepPanel.VerticalScroll.Value;
Colapsing = true; Colapsing = true;
// Hide Children // Hide Children
@@ -519,7 +367,6 @@ namespace Volian.Controls.Library
// Adjust Positions // Adjust Positions
int topOffsetAfter = TopMostEditItem.Top + MyStepPanel.VerticalScroll.Value; int topOffsetAfter = TopMostEditItem.Top + MyStepPanel.VerticalScroll.Value;
ExpandPrefix = topOffset - topOffsetAfter; ExpandPrefix = topOffset - topOffsetAfter;
//ExpandSuffix = BottomMostEditItem.Bottom - Bottom;
if (topOffsetAfter != topOffset) if (topOffsetAfter != topOffset)
{ {
LastMethodsPush(string.Format("Colapse {0}", MyID)); LastMethodsPush(string.Format("Colapse {0}", MyID));
@@ -569,7 +416,7 @@ namespace Volian.Controls.Library
/// <param name="args"></param> /// <param name="args"></param>
private void _MyStepRTB_LinkGoTo(object sender, StepPanelLinkEventArgs args) private void _MyStepRTB_LinkGoTo(object sender, StepPanelLinkEventArgs args)
{ {
_MyLog.DebugFormat("_DisplayRTB_LinkGoTo " + args.LinkInfoText); _MyLog.DebugFormat($"_DisplayRTB_LinkGoTo {args.LinkInfoText}");
MyStepPanel.OnLinkClicked(sender, args); MyStepPanel.OnLinkClicked(sender, args);
} }
void _MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args) void _MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args)
@@ -603,10 +450,6 @@ namespace Volian.Controls.Library
{ {
MyStepPanel.CursorMovement(this, args.CursorLocation, args.Key); MyStepPanel.CursorMovement(this, args.CursorLocation, args.Key);
} }
//private void _MyStepRTB_ModeChange(object sender, StepRTBModeChangeEventArgs args)
//{
// MyStepPanel.OnModeChange(sender as StepRTB, args);
//}
void _MyStepRTB_SetMenu(object sender, StepRTBMenuEventArgs args) void _MyStepRTB_SetMenu(object sender, StepRTBMenuEventArgs args)
{ {
if (args.MenuGroup == null) if (args.MenuGroup == null)
@@ -663,7 +506,6 @@ namespace Volian.Controls.Library
foreach (string line in lines) foreach (string line in lines)
{ {
string lineAdj = Regex.Replace(line, @"\\u....\?", "X"); // Replace Special characters string lineAdj = Regex.Replace(line, @"\\u....\?", "X"); // Replace Special characters
//line2 = Regex.Replace(line2, @"\\.*? ", ""); // Remove RTF Commands - Really should not be any
lineAdj = StepRTB.RemoveLinkComments(lineAdj); lineAdj = StepRTB.RemoveLinkComments(lineAdj);
// MeasureString doesn't work properly if the line include graphics characters. // MeasureString doesn't work properly if the line include graphics characters.
// So, Measure a string of the same length with 'M's. // So, Measure a string of the same length with 'M's.
@@ -795,11 +637,10 @@ namespace Volian.Controls.Library
bool success = MyStepRTB.OrigDisplayText.Save((RichTextBox)MyStepRTB); bool success = MyStepRTB.OrigDisplayText.Save((RichTextBox)MyStepRTB);
if (success) if (success)
{ {
StepConfig sc = MyStepRTB.MyItemInfo.MyConfig as StepConfig;
// if the plant has the change id option, the change id was entered when the program started. // if the plant has the change id option, the change id was entered when the program started.
// this should be saved for every piece of edited data. Note that the set of config // this should be saved for every piece of edited data. Note that the set of config
// item Step_MultipleChangeID has the save built in to it. // item Step_MultipleChangeID has the save built in to it.
if (sc == null) sc = new StepConfig(); if (!(MyStepRTB.MyItemInfo.MyConfig is StepConfig sc)) sc = new StepConfig();
if (MyStepRTB.MyItemInfo.IsStep && if (MyStepRTB.MyItemInfo.IsStep &&
MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds
&& !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange) && !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange)
@@ -884,7 +725,6 @@ namespace Volian.Controls.Library
} }
public override void IdentifyMe(bool highlight) public override void IdentifyMe(bool highlight)
{ {
//this.BringToFront(); // B2017-187 when called all the time, slows down the display of step and confuses the scroll bar
if (highlight) if (highlight)
{ {
MyStepRTB.BringToFront(); // B2017-187 when called all the time, slows down the display of step and confuses the scroll bar MyStepRTB.BringToFront(); // B2017-187 when called all the time, slows down the display of step and confuses the scroll bar
@@ -931,7 +771,6 @@ namespace Volian.Controls.Library
{ {
_MyLog.WarnFormat("Attempt to give Focus to Disposed Object {0}", MyID); _MyLog.WarnFormat("Attempt to give Focus to Disposed Object {0}", MyID);
} }
// if (CanExpand) AutoExpand(); // Expand the item if you can
ScrollToCenter(); ScrollToCenter();
} }
/// <summary> /// <summary>
@@ -942,18 +781,9 @@ namespace Volian.Controls.Library
_MyStepRTB.Focus(); _MyStepRTB.Focus();
ScrollToCenter(); ScrollToCenter();
} }
public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg) public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg) => MyStepRTB.ReplaceText(rpltxt, fndstr, caseSensitive, matchWholeWord, reverse, prompt, fndrpldlg);
{ public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse) => MyStepRTB.FindText(str, caseSensitive, matchWholeWord, reverse);
return MyStepRTB.ReplaceText(rpltxt, fndstr, caseSensitive, matchWholeWord, reverse, prompt, fndrpldlg); public override void PositionToEnd() => MyStepRTB.SelectionStart = MyStepRTB.Text.Length;
}
public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse)
{
return MyStepRTB.FindText(str, caseSensitive, matchWholeWord, reverse);
}
public override void PositionToEnd()
{
MyStepRTB.SelectionStart = MyStepRTB.Text.Length;
}
public override void PositionToStart() public override void PositionToStart()
{ {
return; return;
@@ -973,41 +803,21 @@ namespace Volian.Controls.Library
return null; return null;
} }
} }
public override bool SpellCheckNext() public override bool SpellCheckNext() => MyStepRTB.SpellCheckNext();
{ public override void SetActive() => MyStepRTB.BackColor = MyStepPanel.ActiveColor;
return MyStepRTB.SpellCheckNext();
}
public override void SetActive()
{
MyStepRTB.BackColor = MyStepPanel.ActiveColor;
}
public override bool Empty public override bool Empty
{ {
get get
{ {
// Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf); // Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf);
// string txt = MyStepRTB.Text;
// Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf);
// return txt == "";
//return MyStepRTB.IsEmpty;
return MyStepRTB.Text == ""; return MyStepRTB.Text == "";
} }
set { MyStepRTB.Text = value ? "" : " "; } set { MyStepRTB.Text = value ? "" : " "; }
} }
//public override bool IsEmpty() // this becomes 'Empty' property, i.e. get/set.
//{ // for the set, emtpy is following line (= not ==).
// // for not empty - it's code that is in 'MakeNotEmpty'
// return MyStepRTB.Text == "";
//}
//public override void MakeNotEmpty()
//{
// MyStepRTB.Text = " ";
//}
public override void RefreshDisplay(bool activeMode) public override void RefreshDisplay(bool activeMode)
{ {
MyStepRTB.VwMode = MyStepPanel.VwMode; MyStepRTB.VwMode = MyStepPanel.VwMode;
MyStepRTB.RefreshDisplay(activeMode); MyStepRTB.RefreshDisplay(activeMode);
//MyStepRTB.ViewRTB = !activeMode;
} }
public override void ToggleEditView(E_ViewMode vwMode) public override void ToggleEditView(E_ViewMode vwMode)
{ {
@@ -1026,8 +836,7 @@ namespace Volian.Controls.Library
public override void SetupHeader(ItemInfo itemInfo) public override void SetupHeader(ItemInfo itemInfo)
{ {
lblTab.Top = 3 + ((itemInfo.HasHeader) ? 23 : 0); lblTab.Top = 3 + ((itemInfo.HasHeader) ? 23 : 0);
_MyStepRTB.Top = lblTab.Top; // 3 + ((itemInfo.HasHeader) ? 23 : 0); _MyStepRTB.Top = lblTab.Top;
//lblTab.Move += new EventHandler(lblTab_Move);
if (itemInfo.HasHeader) if (itemInfo.HasHeader)
SetupHeaderFooter(ref lblHeader, "Header", itemInfo.MyHeader); SetupHeaderFooter(ref lblHeader, "Header", itemInfo.MyHeader);
else else
@@ -1037,10 +846,7 @@ namespace Volian.Controls.Library
lblHeader = null; lblHeader = null;
} }
} }
public override void ShowExpanded() public override void ShowExpanded() => _MyvlnExpander.ShowExpanded();
{
_MyvlnExpander.ShowExpanded();
}
/// <summary> /// <summary>
/// Sets the Item and as a result the text for the RichTextBox /// Sets the Item and as a result the text for the RichTextBox
/// </summary> /// </summary>
@@ -1078,10 +884,7 @@ namespace Volian.Controls.Library
break; break;
} }
} }
public override void SaveCurrentAndContents() public override void SaveCurrentAndContents() => SaveContents();
{
SaveContents();
}
#endregion #endregion
} }
} }
@@ -1,13 +1,7 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Drawing;
using VEPROMS.CSLA.Library;
using System.Text.RegularExpressions;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
+1 -22
View File
@@ -1,19 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
public static class RomanNumeral public static class RomanNumeral
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private enum RomanOffset : int private enum RomanOffset : int
{ {
Hundreds = 2, Hundreds = 2,
Tens = 4, Tens = 4,
Units = 6 Units = 6
} }
private static string _Romans = "MDCLXVI"; private static readonly string _Romans = "MDCLXVI";
private static string RomanPart(RomanOffset offset, int value) private static string RomanPart(RomanOffset offset, int value)
{ {
int iFive = value / 5; int iFive = value / 5;
@@ -34,21 +29,5 @@ namespace Volian.Controls.Library
RomanPart(RomanOffset.Tens, tens) + RomanPart(RomanOffset.Tens, tens) +
RomanPart(RomanOffset.Units, units); RomanPart(RomanOffset.Units, units);
} }
// private static int[] _TestRomans = new int[] {
// 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,25,30,40,50,60,69,70,80,90,99,
// 100,200,400,500,600,666,700,800,900,1000,1444,1666,1945,1997,1999,2000,2007,3000
// };
// public static void ShowRomans()
// {
// for (int i = 0; i < _TestRomans.Length; i++)
// {
// if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", _TestRomans[i], Convert(_TestRomans[i]));
// }
// //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", 4, Convert(4));
// //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", 5, Convert(5));
// //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", 6, Convert(6));
// //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", 8, Convert(8));
// //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", 9, Convert(9));
// }
} }
} }
+28 -91
View File
@@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using Volian.Base.Library; using Volian.Base.Library;
@@ -13,17 +9,8 @@ namespace Volian.Controls.Library
public partial class RtfRawItem : EditItem public partial class RtfRawItem : EditItem
{ {
#region IEditItem #region IEditItem
public override StepRTB MyStepRTB public override StepRTB MyStepRTB => _MyStepRTB;
{ public override int TableWidth => (int)_MyStepRTB.Width + RtfRawMargin;
get { return _MyStepRTB; }
}
public override int TableWidth
{
get
{
return (int)_MyStepRTB.Width + RtfRawMargin;
}
}
/// <summary> /// <summary>
/// The left edge of the Tab (no visible tab, but use this for EditItem interfacing /// The left edge of the Tab (no visible tab, but use this for EditItem interfacing
/// </summary> /// </summary>
@@ -62,7 +49,7 @@ namespace Volian.Controls.Library
Width = value + lblTab.Left + lblTab.Width; Width = value + lblTab.Left + lblTab.Width;
} }
} }
public override int BorderWidth { get { return (_MyStepRTB.Width - _MyStepRTB.ClientRectangle.Width); } } public override int BorderWidth => (_MyStepRTB.Width - _MyStepRTB.ClientRectangle.Width);
/// <summary> /// <summary>
/// Location of the RichTextBox /// Location of the RichTextBox
/// </summary> /// </summary>
@@ -99,20 +86,14 @@ namespace Volian.Controls.Library
_MyToolTip.SetSuperTooltip(MyStepRTB, tpi); _MyToolTip.SetSuperTooltip(MyStepRTB, tpi);
ToolTipOnOff(); // B2025-050 Show the tooltip based on User Options Settings ToolTipOnOff(); // B2025-050 Show the tooltip based on User Options Settings
} }
public override void ToolTipOnOff() public override void ToolTipOnOff() => _MyToolTip.Enabled = VlnSettings.StepTypeToolTip; // B2025-XXX Show the tooltip based on User Options Settings
{
_MyToolTip.Enabled = VlnSettings.StepTypeToolTip; // B2025-XXX Show the tooltip based on User Options Settings
}
public override void RefreshContent() public override void RefreshContent()
{ {
IdentifyMe(false); IdentifyMe(false);
MyStepRTB.Rtf = MyItemInfo.MyContent.Text; MyStepRTB.Rtf = MyItemInfo.MyContent.Text;
RefreshDisplay(false); RefreshDisplay(false);
} }
public override void RefreshOrdinal() public override void RefreshOrdinal() => TabFormat = null;
{
TabFormat = null;
}
public override void HandleResize() {} public override void HandleResize() {}
public override void MatchExpanded() {} public override void MatchExpanded() {}
public override void ItemSelect() public override void ItemSelect()
@@ -136,10 +117,7 @@ namespace Volian.Controls.Library
_MyStepRTB.Focus(); _MyStepRTB.Focus();
ScrollToCenter(); ScrollToCenter();
} }
public override void SetActive() public override void SetActive() => this.BackColor = MyStepPanel.ActiveColor;
{
this.BackColor = MyStepPanel.ActiveColor;
}
public override void SetText() public override void SetText()
{ {
LastMethodsPush("SetText"); LastMethodsPush("SetText");
@@ -150,14 +128,8 @@ namespace Volian.Controls.Library
} }
LastMethodsPop(); LastMethodsPop();
} }
public override void SetExpandAndExpander(ItemInfo itemInfo) public override void SetExpandAndExpander(ItemInfo itemInfo) => CanExpand = false;
{ public override void SaveCurrentAndContents() => SaveContents();
CanExpand = false;
}
public override void SaveCurrentAndContents()
{
SaveContents();
}
public override void RefreshDisplay(bool activeMode) public override void RefreshDisplay(bool activeMode)
{ {
MyStepRTB.VwMode = MyStepPanel.VwMode; MyStepRTB.VwMode = MyStepPanel.VwMode;
@@ -177,12 +149,9 @@ namespace Volian.Controls.Library
Width = sz.Width; Width = sz.Width;
Height = _MyStepRTB.Height + _MyStepRTB.Top + 7; Height = _MyStepRTB.Height + _MyStepRTB.Top + 7;
ItemWidth = Width; ItemWidth = Width;
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling(true); MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling();
}
public override void ToggleEditView(E_ViewMode vwMode)
{
SaveContents();
} }
public override void ToggleEditView(E_ViewMode vwMode) => SaveContents();
public override string TabFormat public override string TabFormat
{ {
get { return null; } get { return null; }
@@ -204,14 +173,8 @@ namespace Volian.Controls.Library
public override Point TabLocation { get { return lblTab.Location; } } public override Point TabLocation { get { return lblTab.Location; } }
public override Font ContentFont { get { return MyStepRTB.Font; } set { /*MyStepRTB.Font = value*/; } } public override Font ContentFont { get { return MyStepRTB.Font; } set { /*MyStepRTB.Font = value*/; } }
public override float ContentTop { get { return MyStepRTB.Top; } } public override float ContentTop { get { return MyStepRTB.Top; } }
public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg) public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg) => DialogResult.OK;
{ public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse) => false;
return DialogResult.OK;
}
public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse)
{
return false;
}
public override void PositionToEnd() public override void PositionToEnd()
{ {
return; return;
@@ -220,14 +183,8 @@ namespace Volian.Controls.Library
{ {
return; return;
} }
public override string SelectedTextForFind public override string SelectedTextForFind => null;
{ public override bool SpellCheckNext() => false;
get {return null;}
}
public override bool SpellCheckNext()
{
return false;
}
public override bool Empty public override bool Empty
{ {
get get
@@ -236,10 +193,7 @@ namespace Volian.Controls.Library
} }
set { _MyStepRTB.Text = value ? "" : " "; } set { _MyStepRTB.Text = value ? "" : " "; }
} }
public override void RefreshTab() public override void RefreshTab() => TabFormat = null;
{
TabFormat = null;
}
public override void SetupHeader(ItemInfo itemInfo) public override void SetupHeader(ItemInfo itemInfo)
{ {
return; return;
@@ -247,16 +201,11 @@ namespace Volian.Controls.Library
public override void ShowExpanded() {} public override void ShowExpanded() {}
#endregion #endregion
#region Properties #region Properties
private static int _RtfRawMargin = 6; // make it a little bigger than rtbitems so it can be seen
/// <summary> /// <summary>
/// Margin between the EditItem and the RtfRawItem. Appears on the Right. /// Margin between the EditItem and the RtfRawItem. Appears on the Right.
/// Will allow space to draw a Change Bar on the right side of the EditItem. /// Will allow space to draw a Change Bar on the right side of the EditItem.
/// </summary> /// </summary>
public static int RtfRawMargin public static int RtfRawMargin { get; set; } = 6;
{
get { return _RtfRawMargin; }
set { _RtfRawMargin = value; }
}
#endregion #endregion
#region Constructors #region Constructors
public RtfRawItem() public RtfRawItem()
@@ -315,11 +264,7 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region EventHandlers #region EventHandlers
void RtfRawItem_Click(object sender, EventArgs e) void RtfRawItem_Click(object sender, EventArgs e) => MyStepPanel.SelectedEditItem = this;
{
//if (MyStepPanel.DisplayItemChanging) return;
MyStepPanel.SelectedEditItem = this;
}
private void _MyStepRTB_HeightChanged(object sender, EventArgs args) private void _MyStepRTB_HeightChanged(object sender, EventArgs args)
{ {
if (this.Height != _MyStepRTB.Height + _MyStepRTB.Top + 7) // add in 7 to make it look good // + 10) if (this.Height != _MyStepRTB.Height + _MyStepRTB.Top + 7) // add in 7 to make it look good // + 10)
@@ -351,10 +296,7 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Methods #region Methods
public override void SetFocus() public override void SetFocus() => MyStepRTB.Focus();
{
MyStepRTB.Focus();
}
public override void SaveContents() public override void SaveContents()
{ {
SaveText(); SaveText();
@@ -379,26 +321,27 @@ namespace Volian.Controls.Library
_origBitmap = GetBitmap(res); _origBitmap = GetBitmap(res);
MyStepRTB.ClearUndo(); MyStepRTB.ClearUndo();
} }
catch (Exception ex) catch (Exception)
{ {
//MessageBox.Show("The data could not be saved.", "Object Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
return; return;
} }
} }
public System.Drawing.Bitmap GetBitmap(string rtf) public System.Drawing.Bitmap GetBitmap(string rtf)
{ {
Bitmap bmap = null; Bitmap bmap;
try try
{ {
System.Drawing.Size sz = RtfRawItem.GetRtfRawSize(rtf); System.Drawing.Size sz = RtfRawItem.GetRtfRawSize(rtf);
Volian.Controls.Library.RTF myRtb = new RTF(); Volian.Controls.Library.RTF myRtb = new RTF
myRtb.Size = sz; {
myRtb.Rtf = rtf; Size = sz,
Rtf = rtf
};
bmap = new System.Drawing.Bitmap((int)sz.Width, (int)sz.Height); bmap = new System.Drawing.Bitmap((int)sz.Width, (int)sz.Height);
System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bmap); System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bmap);
myRtb.RenderClipped(gr, new System.Drawing.Rectangle(0, 0, (int)sz.Width, (int)sz.Height)); myRtb.RenderClipped(gr, new System.Drawing.Rectangle(0, 0, (int)sz.Width, (int)sz.Height));
} }
catch (Exception ex) catch (Exception)
{ {
return null; return null;
} }
@@ -478,14 +421,8 @@ namespace Volian.Controls.Library
if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem) if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem)
ScrollToCenter(); ScrollToCenter();
} }
private void MyStepRTB_CursorKeyPress(object sender, KeyEventArgs args) private void MyStepRTB_CursorKeyPress(object sender, KeyEventArgs args) => MyStepPanel.StepCursorKeys(this, args);
{ private void MyStepRTB_CursorMovement(object sender, StepRTBCursorMovementEventArgs args) => MyStepPanel.CursorMovement(this, args.CursorLocation, args.Key);
MyStepPanel.StepCursorKeys(this, args);
}
private void MyStepRTB_CursorMovement(object sender, StepRTBCursorMovementEventArgs args)
{
MyStepPanel.CursorMovement(this, args.CursorLocation, args.Key);
}
#endregion #endregion
} }
} }
+88 -340
View File
@@ -1,12 +1,9 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using System.Drawing; using System.Drawing;
using System.Text.RegularExpressions;
using Volian.Base.Library; using Volian.Base.Library;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
using System.Linq; using System.Linq;
@@ -16,29 +13,14 @@ namespace Volian.Controls.Library
public partial class StepPanel : Panel public partial class StepPanel : Panel
{ {
#region Fields #region Fields
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// Procedure Item Info - Top ItemInfo /// Procedure Item Info - Top ItemInfo
/// </summary> /// </summary>
private ItemInfo _MyProcedureItemInfo; private ItemInfo _MyProcedureItemInfo;
private E_ViewMode _VwMode = E_ViewMode.Edit;
public E_ViewMode VwMode public E_ViewMode VwMode { get; set; } = E_ViewMode.Edit;
{ public EditItem TopMostEditItem { get; set; } = null;
get { return _VwMode; } public ItemInfo ExpandingHLS { get; set; } = null;
set { _VwMode = value; }
}
private EditItem _TopMostEditItem = null;
public EditItem TopMostEditItem
{
get { return _TopMostEditItem; }
set { _TopMostEditItem = value; }
}
private ItemInfo _ExpandingHLS = null;
public ItemInfo ExpandingHLS
{
get { return _ExpandingHLS; }
set { _ExpandingHLS = value; }
}
// TODO: This is not correct. There should be a dictionary of Section Layouts // TODO: This is not correct. There should be a dictionary of Section Layouts
/// <summary> /// <summary>
/// Lookup Table to convert ItemInfo.ItemID to EditItem /// Lookup Table to convert ItemInfo.ItemID to EditItem
@@ -60,16 +42,9 @@ namespace Volian.Controls.Library
_ApplDisplayMode = value; _ApplDisplayMode = value;
foreach (Control c in Controls) foreach (Control c in Controls)
{ {
EditItem ei = c as EditItem; if (c is EditItem ei)
if (ei != null)
{ {
ei.Enabled = ei.MyItemInfo.IsApplicable(value); ei.Enabled = ei.MyItemInfo.IsApplicable(value);
//IItemConfig cfg = ei.MyItemInfo.MyConfig as IItemConfig;
//List<int> apples = cfg.MasterSlave_Applicability.GetFlags();
//if (value == -1 || apples.Count == 0)
// ei.Enabled = true;
//else
// ei.Enabled = apples.Contains(value);
} }
} }
} }
@@ -78,24 +53,14 @@ namespace Volian.Controls.Library
/// Currently selected ItemInfo /// Currently selected ItemInfo
/// </summary> /// </summary>
internal ItemInfo _SelectedItemInfo; internal ItemInfo _SelectedItemInfo;
private int _ItemMoving = 0;
private StepPanelSettings _MyStepPanelSettings; private StepPanelSettings _MyStepPanelSettings;
private int _MaxRNO = -1; // TODO: Need to calculate MaxRNO on a section basis rather than for a panel
private Font _MyFont = null; private Font _MyFont = null;
private Font _ProcFont = new Font("Arial", 12, FontStyle.Bold);
private Font _SectFont = new Font("Arial", 10, FontStyle.Bold);
private Font _StepFont = new Font("Arial", 10);
private Color _ActiveColor = Color.SkyBlue; private Color _ActiveColor = Color.SkyBlue;
private Color _InactiveColor = Color.Linen;
private Color _AnnotationColor = Color.FromArgb(255, 255, 128);
private Color _TabColor = Color.Beige;
private Color _PanelColor = Color.LightGray; private Color _PanelColor = Color.LightGray;
// Whether panel is in view or edit mode. Toggled from steprtb // Whether panel is in view or edit mode. Toggled from steprtb
// or set based on approval/multi-user (these two will be done // or set based on approval/multi-user (these two will be done
// later. // later.
//public E_ViewMode PanelViewEditMode = E_ViewMode.Edit;
internal string _LastAdjust=""; internal string _LastAdjust="";
private bool _ShowLines = true;
private Graphics _MyGraphics = null; private Graphics _MyGraphics = null;
private int _DPI = 0; private int _DPI = 0;
#endregion #endregion
@@ -111,7 +76,7 @@ namespace Volian.Controls.Library
/// <param name="args"></param> /// <param name="args"></param>
internal void OnItemClick(object sender, StepPanelEventArgs args) internal void OnItemClick(object sender, StepPanelEventArgs args)
{ {
if (ItemClick != null) ItemClick(sender, args); ItemClick?.Invoke(sender, args);
} }
public bool ItemSelectionChangeShown = false; // This keeps OnItemSelectedChanged from being called twice when an item is selected. public bool ItemSelectionChangeShown = false; // This keeps OnItemSelectedChanged from being called twice when an item is selected.
/// <summary> /// <summary>
@@ -127,7 +92,7 @@ namespace Volian.Controls.Library
{ {
ItemSelectionChangeShown = true;//Remember that you have run already ItemSelectionChangeShown = true;//Remember that you have run already
//vlnStackTrace.ShowStack(string.Format("OnItemSelectedChanged {0}",args.MyItemInfo.ItemID)); //vlnStackTrace.ShowStack(string.Format("OnItemSelectedChanged {0}",args.MyItemInfo.ItemID));
if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args); ItemSelectedChanged?.Invoke(sender, args);
} }
/// <summary> /// <summary>
/// Occurs when the user clicks on the Attachment Expander /// Occurs when the user clicks on the Attachment Expander
@@ -143,39 +108,17 @@ namespace Volian.Controls.Library
if (AttachmentClicked != null) AttachmentClicked(sender, args); if (AttachmentClicked != null) AttachmentClicked(sender, args);
else FlexibleMessageBox.Show(args.MyEditItem.MyItemInfo.MyContent.MyEntry.MyDocument.DocumentTitle, "Unhandled Attachment Click", MessageBoxButtons.OK, MessageBoxIcon.Information); else FlexibleMessageBox.Show(args.MyEditItem.MyItemInfo.MyContent.MyEntry.MyDocument.DocumentTitle, "Unhandled Attachment Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
// Edit/View mode change
//public event StepPanelModeChangeEvent ModeChange;
//internal void OnModeChange(object sender, StepRTBModeChangeEventArgs args)
//{
// PanelViewEditMode = args.ViewMode;
// ModeChange(sender, args);
//}
// various selections from steptabribbon that need to filter up to frmveproms
// such as 'global search', 'bookmarks'
public event StepPanelTabDisplayEvent TabDisplay; public event StepPanelTabDisplayEvent TabDisplay;
internal void OnTabDisplay(object sender, StepPanelTabDisplayEventArgs args) internal void OnTabDisplay(object sender, StepPanelTabDisplayEventArgs args) => TabDisplay(sender, args);
{
TabDisplay(sender, args);
}
// close section, if deleting word doc section // close section, if deleting word doc section
public event StepPanelWordSectionCloseEvent WordSectionClose; public event StepPanelWordSectionCloseEvent WordSectionClose;
internal void OnWordSectionClose(object sender, WordSectionEventArgs args) internal void OnWordSectionClose(object sender, WordSectionEventArgs args) => WordSectionClose(sender, args);
{
WordSectionClose(sender, args);
}
// if section deleted, have event to flag in other UI panels // if section deleted, have event to flag in other UI panels
public event StepPanelWordSectionDeletedEvent WordSectionDeleted; public event StepPanelWordSectionDeletedEvent WordSectionDeleted;
internal void OnWordSectionDeleted(object sender, WordSectionEventArgs args) internal void OnWordSectionDeleted(object sender, WordSectionEventArgs args) => WordSectionDeleted(sender, args);
{
WordSectionDeleted(sender, args);
}
// if item pasted, have event to flag in other UI panels // if item pasted, have event to flag in other UI panels
public event StepPanelItemPastedEvent ItemPasted; public event StepPanelItemPastedEvent ItemPasted;
internal void OnItemPasted(object sender, vlnTreeItemInfoPasteEventArgs args) internal void OnItemPasted(object sender, vlnTreeItemInfoPasteEventArgs args) => ItemPasted(sender, args);
{
ItemPasted(sender, args);
}
#endregion #endregion
#region Link Events #region Link Events
/// <summary> /// <summary>
@@ -274,16 +217,15 @@ namespace Volian.Controls.Library
this.BackColorChanged += new EventHandler(StepPanel_BackColorChanged); this.BackColorChanged += new EventHandler(StepPanel_BackColorChanged);
if (VlnSettings.DebugMode) if (VlnSettings.DebugMode)
{ {
_InactiveColor = Color.Linen; InactiveColor = Color.Linen;
_TabColor = Color.Beige; TabColor = Color.Beige;
_PanelColor = Color.LightGray; _PanelColor = Color.LightGray;
this.Paint += new PaintEventHandler(StepPanel_Paint);
this.DoubleClick += new EventHandler(StepPanel_DoubleClick); // Toggles Vertical lines on and off this.DoubleClick += new EventHandler(StepPanel_DoubleClick); // Toggles Vertical lines on and off
} }
else else
{ {
_InactiveColor = Color.White; InactiveColor = Color.White;
_TabColor = Color.White; TabColor = Color.White;
_PanelColor = Color.White; _PanelColor = Color.White;
this.BackColor = Color.White; this.BackColor = Color.White;
} }
@@ -301,9 +243,8 @@ namespace Volian.Controls.Library
InactiveColor = PanelColor = BackColor; InactiveColor = PanelColor = BackColor;
foreach (Control ctrl in Controls) foreach (Control ctrl in Controls)
{ {
if (ctrl is EditItem) if (ctrl is EditItem ei)
{ {
EditItem ei = (EditItem)ctrl;
ei.BackColor = BackColor; ei.BackColor = BackColor;
} }
} }
@@ -323,9 +264,8 @@ namespace Volian.Controls.Library
if (_LookupEditItems.ContainsKey(id)) // Expanding Parent should have added it to _LookupEditItems if (_LookupEditItems.ContainsKey(id)) // Expanding Parent should have added it to _LookupEditItems
{ {
EditItem itm = _LookupEditItems[id]; EditItem itm = _LookupEditItems[id];
ItemInfo ii = myItemInfo.ActiveParent as ItemInfo; if (!itm.Visible && myItemInfo.ActiveParent is ItemInfo ii)
if (itm.Visible == false && ii != null) ExpandAsNeeded(ii);
ExpandAsNeeded((ItemInfo)myItemInfo.ActiveParent);
itm.AutoExpand(); // Expand it if it should expand itm.AutoExpand(); // Expand it if it should expand
} }
} }
@@ -342,19 +282,10 @@ namespace Volian.Controls.Library
get { return _MyProcedureItemInfo; } get { return _MyProcedureItemInfo; }
set set
{ {
//// TIMING: DisplayItem.TimeIt("pMyItem Start");
_MyProcedureItemInfo = value; _MyProcedureItemInfo = value;
//// TIMING: DisplayItem.TimeIt("pMyItem Layout");
//this.Layout += new LayoutEventHandler(DisplayPanel_Layout);
//this.Scroll += new ScrollEventHandler(DisplayPanel_Scroll);
//// TIMING: DisplayItem.TimeIt("pMyItem Scroll");
Controls.Clear(); Controls.Clear();
_LookupEditItems = new Dictionary<int, EditItem>(); _LookupEditItems = new Dictionary<int, EditItem>();
//// TIMING: DisplayItem.TimeIt("pMyItem Clear");
//SuspendLayout();
new RTBItem(_MyProcedureItemInfo, this, null, ChildRelation.None, false); new RTBItem(_MyProcedureItemInfo, this, null, ChildRelation.None, false);
//ResumeLayout();
//// TIMING: DisplayItem.TimeIt("pMyItem End");
} }
} }
public bool AutoExpand public bool AutoExpand
@@ -369,8 +300,7 @@ namespace Volian.Controls.Library
} }
public void Reset() public void Reset()
{ {
ItemInfo parent = SelectedItemInfo.ActiveParent as ItemInfo; if (SelectedItemInfo.ActiveParent is ItemInfo parent) ItemInfo.ResetParts(parent.ItemID); // Force data to reload
if (parent != null) ItemInfo.ResetParts(parent.ItemID); // Force data to reload
else ItemInfo.ResetParts(SelectedItemInfo.ItemID); else ItemInfo.ResetParts(SelectedItemInfo.ItemID);
// The following line actually reloads the procedure item // The following line actually reloads the procedure item
MyProcedureItemInfo = MyProcedureItemInfo; // see get/set above. - Load Procedure and Sections MyProcedureItemInfo = MyProcedureItemInfo; // see get/set above. - Load Procedure and Sections
@@ -379,8 +309,7 @@ namespace Volian.Controls.Library
} }
public void Reset(ItemInfo myItemInfo) public void Reset(ItemInfo myItemInfo)
{ {
ItemInfo parent = myItemInfo.ActiveParent as ItemInfo; if (myItemInfo.ActiveParent is ItemInfo parent) ItemInfo.ResetParts(parent.ItemID); // Force data to reload
if (parent != null) ItemInfo.ResetParts(parent.ItemID); // Force data to reload
else ItemInfo.ResetParts(myItemInfo.ItemID); else ItemInfo.ResetParts(myItemInfo.ItemID);
// The following line actually reloads the procedure item // The following line actually reloads the procedure item
MyProcedureItemInfo = MyProcedureItemInfo; // see get/set above. - Load Procedure and Sections MyProcedureItemInfo = MyProcedureItemInfo; // see get/set above. - Load Procedure and Sections
@@ -406,16 +335,6 @@ namespace Volian.Controls.Library
// The following line expands the items needed to display SelectedItemInfo // The following line expands the items needed to display SelectedItemInfo
ExpandAsNeeded(SelectedItemInfo); ExpandAsNeeded(SelectedItemInfo);
} }
/// <summary>
/// Currently selected StepRTB
/// </summary>
//private StepRTB _SelectedStepRTB = null;
//public StepRTB SelectedStepRTB
//{
// get { return _SelectedStepRTB; }
// set { _SelectedStepRTB=value;}
//}
/// <summary> /// <summary>
/// Gets or Sets the SelectedItemInfo /// Gets or Sets the SelectedItemInfo
/// Activates and Expands as necessary /// Activates and Expands as necessary
@@ -435,7 +354,6 @@ namespace Volian.Controls.Library
{ {
ExpandAsNeeded(itemInfo); ExpandAsNeeded(itemInfo);
if (_SelectedItemInfo == null) _SelectedItemInfo = itemInfo; if (_SelectedItemInfo == null) _SelectedItemInfo = itemInfo;
//if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) Reset();
if (itemInfo.Moving) if (itemInfo.Moving)
{ {
Reset(itemInfo); Reset(itemInfo);
@@ -445,12 +363,8 @@ namespace Volian.Controls.Library
if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) return null; if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) return null;
return _LookupEditItems[itemInfo.ItemID]; return _LookupEditItems[itemInfo.ItemID];
} }
private bool _DisplayItemChanging = false;
public bool DisplayItemChanging public bool DisplayItemChanging { get; set; } = false;
{
get { return _DisplayItemChanging; }
set { _DisplayItemChanging = value; }
}
/// <summary> /// <summary>
/// Returns the SelectedEditItem /// Returns the SelectedEditItem
/// </summary> /// </summary>
@@ -460,14 +374,13 @@ namespace Volian.Controls.Library
get get
{ {
return _SelectedEditItem; return _SelectedEditItem;
//return (_SelectedItemInfo != null) ? _LookupEditItems[_SelectedItemInfo.ItemID] : null;
} }
set set
{ {
EditItem newFocus = null; // B2018-152 when empty step is deleted, will contain the new step element focus EditItem newFocus = null; // B2018-152 when empty step is deleted, will contain the new step element focus
bool deletingParent = false; // B2018-152 used to tell us user clicked on subtep of step element who's text was removed (special case) bool deletingParent = false; // B2018-152 used to tell us user clicked on subtep of step element who's text was removed (special case)
EditItem lastEI = _SelectedEditItem; EditItem lastEI = _SelectedEditItem;
if (value != null) value.SetActive(); // Set the active color value?.SetActive(); // Set the active color
if (lastEI == value) return; // Same - No Change if (lastEI == value) return; // Same - No Change
// B2018-002 - Invalid Transitions - If the current step contains an invalid transition convert it to text // B2018-002 - Invalid Transitions - If the current step contains an invalid transition convert it to text
if(value != null) ItemInfo.ConvertInvalidTransitionsToText(value.MyItemInfo); if(value != null) ItemInfo.ConvertInvalidTransitionsToText(value.MyItemInfo);
@@ -486,16 +399,16 @@ namespace Volian.Controls.Library
string msg3 = "Select NO to keep the empty step which can be restored via the History tab on the Step Properties panel."; string msg3 = "Select NO to keep the empty step which can be restored via the History tab on the Step Properties panel.";
if (value != null && value.MyItemInfo.HasAncestor(lastEI.MyItemInfo)) if (value != null && value.MyItemInfo.HasAncestor(lastEI.MyItemInfo))
{ {
msg1 = "This step does not have text but you had selected one of its substeps. " + msg1; msg1 = $"This step does not have text but you had selected one of its substeps. {msg1}";
msg2 = msg2 + " including the substep you had selected. You will be placed at the next location."; msg2 += " including the substep you had selected. You will be placed at the next location.";
deletingParent = true; // B2018-152 this will tell us that the user selected a substep of a parent being deleted deletingParent = true; // B2018-152 this will tell us that the user selected a substep of a parent being deleted
} }
else else
{ {
msg1 = "This step does not have text but has substeps. " + msg1; msg1 = $"This step does not have text but has substeps. {msg1}";
msg2 = msg2 + " and its substeps."; msg2 += " and its substeps.";
} }
DialogResult result = FlexibleMessageBox.Show(msg1 + "\n\n" + msg2 + "\n\n" + msg3, "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); DialogResult result = FlexibleMessageBox.Show($"{msg1}\n\n{msg2}\n\n{msg3}", "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No) shouldDelete = false; if (result == DialogResult.No) shouldDelete = false;
} }
} }
@@ -504,16 +417,14 @@ namespace Volian.Controls.Library
// if this item has enhanced edititems, remove them. Note that this code supports // if this item has enhanced edititems, remove them. Note that this code supports
// deleting text in an rtbitem that may be a step or section level. // deleting text in an rtbitem that may be a step or section level.
EnhancedDocuments eds = null; EnhancedDocuments eds = null;
StepConfig sc = lastEI.MyItemInfo.MyConfig as StepConfig; if (lastEI.MyItemInfo.MyConfig is StepConfig sc) eds = sc.MyEnhancedDocuments;
if (sc != null) eds = sc.MyEnhancedDocuments;
else else
{ {
// if a section, just the title or all contents may be linked. If just title, // if a section, just the title or all contents may be linked. If just title,
// don't delete enhanced, but clear links back from enhanced. // don't delete enhanced, but clear links back from enhanced.
if (lastEI.MyItemInfo.IsSection) if (lastEI.MyItemInfo.IsSection)
{ {
SectionConfig sec = lastEI.MyItemInfo.MyConfig as SectionConfig; if (lastEI.MyItemInfo.MyConfig is SectionConfig sec)
if (sec != null)
{ {
if (sec.Section_LnkEnh == "Y") eds = sec.MyEnhancedDocuments; if (sec.Section_LnkEnh == "Y") eds = sec.MyEnhancedDocuments;
else lastEI.MyItemInfo.ClearEnhancedSectionLink(); else lastEI.MyItemInfo.ClearEnhancedSectionLink();
@@ -593,8 +504,7 @@ namespace Volian.Controls.Library
SelectedItemInfo = value.MyItemInfo; SelectedItemInfo = value.MyItemInfo;
} }
} }
if (lastEI != null) lastEI?.IdentifyMe(false);
lastEI.IdentifyMe(false);
} }
} }
/// <summary> /// <summary>
@@ -608,20 +518,13 @@ namespace Volian.Controls.Library
OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(SelectedEditItem)); OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(SelectedEditItem));
} }
} }
public new void MouseWheel(MouseEventArgs e) public new void MouseWheel(MouseEventArgs e) => base.OnMouseWheel(e);
{
base.OnMouseWheel(e);
}
/// <summary> /// <summary>
/// Used to track movement other than scrolling /// Used to track movement other than scrolling
/// 0 - Indicates no other movement /// 0 - Indicates no other movement
/// > 0 - Indicates that other movement is happening /// > 0 - Indicates that other movement is happening
/// </summary> /// </summary>
public int ItemMoving public int ItemMoving { get; set; } = 0;
{
get { return _ItemMoving; }
set { _ItemMoving = value; }
}
/// <summary> /// <summary>
/// Lazy loaded StepPanelSettings /// Lazy loaded StepPanelSettings
/// </summary> /// </summary>
@@ -640,32 +543,20 @@ namespace Volian.Controls.Library
public Font MyFont public Font MyFont
{ {
get { return _MyFont; } get { return _MyFont; }
set { _ProcFont = _SectFont = _StepFont = _MyFont = value; } set { ProcFont = SectFont = StepFont = _MyFont = value; }
} }
/// <summary> /// <summary>
/// Gets or sets the font for the Procedure Text /// Gets or sets the font for the Procedure Text
/// </summary> /// </summary>
public Font ProcFont public Font ProcFont { get; set; } = new Font("Arial", 12, FontStyle.Bold);
{
get { return _ProcFont; }
set { _ProcFont = value; }
}
/// <summary> /// <summary>
/// Gets or sets the font for the Section Text /// Gets or sets the font for the Section Text
/// </summary> /// </summary>
public Font SectFont public Font SectFont { get; set; } = new Font("Arial", 10, FontStyle.Bold);
{
get { return _SectFont; }
set { _SectFont = value; }
}
/// <summary> /// <summary>
/// Gets or sets the Step Font /// Gets or sets the Step Font
/// </summary> /// </summary>
public Font StepFont public Font StepFont { get; set; } = new Font("Arial", 10);
{
get { return _StepFont; }
set { _StepFont = value; }
}
/// <summary> /// <summary>
/// Gets or Sets the Active Color for the Panel /// Gets or Sets the Active Color for the Panel
/// </summary> /// </summary>
@@ -682,27 +573,15 @@ namespace Volian.Controls.Library
/// <summary> /// <summary>
/// Gets or Sets the Annotation backcolor for StepRTBs in the Panel /// Gets or Sets the Annotation backcolor for StepRTBs in the Panel
/// </summary> /// </summary>
public Color AnnotationColor public Color AnnotationColor { get; set; } = Color.FromArgb(255, 255, 128);
{
get { return _AnnotationColor; }
set { _AnnotationColor = value; }
}
/// <summary> /// <summary>
/// Gets or sets the InActive Color for the Panel /// Gets or sets the InActive Color for the Panel
/// </summary> /// </summary>
public Color InactiveColor public Color InactiveColor { get; set; } = Color.Linen;
{
get { return _InactiveColor; }
set { _InactiveColor = value; }
}
/// <summary> /// <summary>
/// Gets or sets the Tab Color /// Gets or sets the Tab Color
/// </summary> /// </summary>
public Color TabColor public Color TabColor { get; set; } = Color.Beige;
{
get { return _TabColor; }
set { _TabColor = value; }
}
/// <summary> /// <summary>
/// Gets or sets the Panel Color /// Gets or sets the Panel Color
/// </summary> /// </summary>
@@ -744,34 +623,20 @@ namespace Volian.Controls.Library
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public int ToDisplay(int value) public int ToDisplay(int value) => (DPI * value) / 72;
{ public int ToDisplay(float? value) => (int)(DPI * (value ?? 0)) / 72;
//return (DPI * value) / 864;
return (DPI * value) / 72;
}
public int ToDisplay(float? value)
{
//return (DPI * value) / 864;
return (int)(DPI * (value??0)) / 72;
}
/// <summary> /// <summary>
/// Converts an integer? value from Twips to Pixels /// Converts an integer? value from Twips to Pixels
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public int ToDisplay(int? value) public int ToDisplay(int? value) => ToDisplay((int)value);
{
return ToDisplay((int)value);
}
/// <summary> /// <summary>
/// Converts an string value from Twips to Pixels /// Converts an string value from Twips to Pixels
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public int ToDisplay(string value) public int ToDisplay(string value) => ToDisplay(Convert.ToSingle(value));
{
return ToDisplay(Convert.ToSingle(value));
}
/// <summary> /// <summary>
/// Converts a value from a list in a string from Twips to Pixels /// Converts a value from a list in a string from Twips to Pixels
/// </summary> /// </summary>
@@ -788,21 +653,7 @@ namespace Volian.Controls.Library
/// <summary> /// <summary>
/// Gets or sets ShowLines so that vertical lines are shown for debugging purposes /// Gets or sets ShowLines so that vertical lines are shown for debugging purposes
/// </summary> /// </summary>
public bool ShowLines public bool ShowLines { get; set; } = true;
{
get { return _ShowLines; }
set { _ShowLines = value; }
}
/// <summary>
/// Draw a vertical line
/// </summary>
/// <param name="g"></param>
/// <param name="x"></param>
private void VerticalLine(Graphics g, int x)
{
Pen bluePen = new Pen(Color.CornflowerBlue,1);
g.DrawLine(bluePen, x, 0, x, this.Height);
}
/// <summary> /// <summary>
/// Toggle the vertical lines on and off /// Toggle the vertical lines on and off
/// </summary> /// </summary>
@@ -813,38 +664,6 @@ namespace Volian.Controls.Library
ShowLines = !ShowLines; ShowLines = !ShowLines;
Refresh(); Refresh();
} }
private void StepPanel_Paint(object sender, PaintEventArgs e)
{
if (ShowLines)
{
//int fifth = Height / 5;
//Rectangle r1 = new Rectangle(0, 0, Width, Height - fifth);
////Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(r1, Color.FromArgb(128, 0, 32), Color.FromArgb(96, 0, 16), 90);
//Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(r1, Color.FromArgb(255,128, 0, 32), Color.FromArgb(255,96, 0, 16),System.Drawing.Drawing2D.LinearGradientMode.Vertical);
//e.Graphics.FillRectangle(b, r1);
//r1 = new Rectangle(0, Height - fifth, Width, fifth);
//b = new System.Drawing.Drawing2D.LinearGradientBrush(r1, Color.FromArgb(255,96, 0, 16), Color.FromArgb(255,128, 0, 32), 90);
//e.Graphics.FillRectangle(b, r1);
//VerticalLine(e.Graphics, 60);
//VerticalLine(e.Graphics, 102);
//VerticalLine(e.Graphics, 415);
}
}
/// <summary>
/// Output all of the EditItem controls to the log
/// </summary>
private void ListControls()
{
// Walk through the controls and find the next control for each
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("'Item','Next'");
foreach (Control control in Controls)
if (control is EditItem)
{
EditItem ei = (EditItem)control;
EditItem nxt = ei.NextDownEditItem;
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", ei.MyID, nxt == null ? 0 : nxt.MyID);
}
}
#endregion #endregion
#region Cursor Movement Methods #region Cursor Movement Methods
/// <summary> /// <summary>
@@ -880,6 +699,8 @@ namespace Volian.Controls.Library
/// <param name="rtb">StepRTB</param> /// <param name="rtb">StepRTB</param>
/// <param name="position">Point</param> /// <param name="position">Point</param>
/// <param name="arrow">E_ArrowKeys</param> /// <param name="arrow">E_ArrowKeys</param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0059:Unnecessary assignment of a value", Justification = "Values assigned to ItemInfo ii for Debugging")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Point position kept for consistancy")]
public void CursorMovement(EditItem ei, Point position, E_ArrowKeys arrow) public void CursorMovement(EditItem ei, Point position, E_ArrowKeys arrow)
{ {
ItemInfo ii = null; ItemInfo ii = null;
@@ -907,11 +728,8 @@ namespace Volian.Controls.Library
ii = MoveDown(ei, ii); ii = MoveDown(ei, ii);
break; break;
case E_ArrowKeys.Left: case E_ArrowKeys.Left:
//case E_ArrowKeys.CtrlLeft:
if (!ei.MyItemInfo.IsProcedure) if (!ei.MyItemInfo.IsProcedure)
{ {
EditItem tmpEI = null;
//SelectedEditItem = _LookupEditItems[ei.MyItemInfo.MyParent.ItemID];
ii = ArrowUp(ei.MyItemInfo); ii = ArrowUp(ei.MyItemInfo);
if (ii != null) if (ii != null)
{ {
@@ -948,6 +766,7 @@ namespace Volian.Controls.Library
return tmpEI.MyItemInfo; return tmpEI.MyItemInfo;
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "ItemInfo ii Kept for Debugging")]
private ItemInfo MoveDown(EditItem ei, ItemInfo ii) private ItemInfo MoveDown(EditItem ei, ItemInfo ii)
{ {
ii = ArrowDown(ei.MyItemInfo); ii = ArrowDown(ei.MyItemInfo);
@@ -984,10 +803,7 @@ namespace Volian.Controls.Library
if (!ii.IsProcedure) return (ii.MyParent); if (!ii.IsProcedure) return (ii.MyParent);
return null; return null;
} }
private ItemInfo ArrowDown(ItemInfo ii) private ItemInfo ArrowDown(ItemInfo ii) => ArrowDown(ii, true, true);
{
return ArrowDown(ii, true, true);
}
private ItemInfo ArrowDown(ItemInfo ii, bool lookAtSub, bool lookAtRNO) private ItemInfo ArrowDown(ItemInfo ii, bool lookAtSub, bool lookAtRNO)
{ {
if (ii.IsSection || ii.IsProcedure) if (ii.IsSection || ii.IsProcedure)
@@ -1062,28 +878,20 @@ namespace Volian.Controls.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public partial class StepPanelSettings public partial class StepPanelSettings
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public StepPanelSettings(StepPanel panel) => MyStepPanel = panel;
public StepPanelSettings(StepPanel panel)
{
_MyStepPanel = panel;
}
public StepPanelSettings() public StepPanelSettings()
{ {
} }
private StepPanel _MyStepPanel;
[Browsable(false)] [Browsable(false)]
public StepPanel MyStepPanel public StepPanel MyStepPanel { get; set; }
{
get { return _MyStepPanel; }
set { _MyStepPanel = value; }
}
private float _CircleXOffset = -4; private float _CircleXOffset = -4;
[Category("Circle")] [Category("Circle")]
[DisplayName("Circle Horizontal Offset")] [DisplayName("Circle Horizontal Offset")]
public float CircleXOffset public float CircleXOffset
{ {
get { return _CircleXOffset; } get { return _CircleXOffset; }
set { _CircleXOffset = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _CircleXOffset = value; MyStepPanel?.Refresh(); }
} }
private float _CircleYOffset = -13; private float _CircleYOffset = -13;
[Category("Circle")] [Category("Circle")]
@@ -1091,24 +899,15 @@ namespace Volian.Controls.Library
public float CircleYOffset public float CircleYOffset
{ {
get { return _CircleYOffset; } get { return _CircleYOffset; }
set { _CircleYOffset = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _CircleYOffset = value; MyStepPanel?.Refresh(); }
} }
// Appears to not be used - JSJ - 11-13-2017
//private Font _CircleFont = new Font("Arial Unicode MS", 23);
//[Category("Circle")]
//[DisplayName("Circle Font")]
//public Font CircleFont
//{
// get { return _CircleFont; }
// set { _CircleFont = value; if(_MyStepPanel != null) _MyStepPanel.Refresh(); }
//}
private Color _CircleColor = Color.Black; private Color _CircleColor = Color.Black;
[Category("Circle")] [Category("Circle")]
[DisplayName("Circle Color")] [DisplayName("Circle Color")]
public Color CircleColor public Color CircleColor
{ {
get { return _CircleColor; } get { return _CircleColor; }
set { _CircleColor = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _CircleColor = value; MyStepPanel?.Refresh(); }
} }
private int _CircleDiameter = 25; private int _CircleDiameter = 25;
[Category("Circle")] [Category("Circle")]
@@ -1116,7 +915,7 @@ namespace Volian.Controls.Library
public int CircleDiameter public int CircleDiameter
{ {
get { return _CircleDiameter; } get { return _CircleDiameter; }
set { _CircleDiameter = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _CircleDiameter = value; MyStepPanel?.Refresh(); }
} }
private int _CircleWeight = 2; private int _CircleWeight = 2;
[Category("Circle")] [Category("Circle")]
@@ -1124,7 +923,7 @@ namespace Volian.Controls.Library
public int CircleWeight public int CircleWeight
{ {
get { return _CircleWeight; } get { return _CircleWeight; }
set { _CircleWeight = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _CircleWeight = value; MyStepPanel?.Refresh(); }
} }
private float _NumberLocationX = 20F; private float _NumberLocationX = 20F;
[Category("Number")] [Category("Number")]
@@ -1132,7 +931,7 @@ namespace Volian.Controls.Library
public float NumberLocationX public float NumberLocationX
{ {
get { return _NumberLocationX; } get { return _NumberLocationX; }
set { _NumberLocationX = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _NumberLocationX = value; MyStepPanel?.Refresh(); }
} }
private float _NumberLocationY = 4; private float _NumberLocationY = 4;
[Category("Number")] [Category("Number")]
@@ -1140,7 +939,7 @@ namespace Volian.Controls.Library
public float NumberLocationY public float NumberLocationY
{ {
get { return _NumberLocationY; } get { return _NumberLocationY; }
set { _NumberLocationY = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _NumberLocationY = value; MyStepPanel?.Refresh(); }
} }
private SizeF _NumberSize = new SizeF(200F, 23F); private SizeF _NumberSize = new SizeF(200F, 23F);
[Category("Number")] [Category("Number")]
@@ -1148,7 +947,7 @@ namespace Volian.Controls.Library
public SizeF NumberSize public SizeF NumberSize
{ {
get { return _NumberSize; } get { return _NumberSize; }
set { _NumberSize = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _NumberSize = value; MyStepPanel?.Refresh(); }
} }
private int _TableWidthAdjust = 4; private int _TableWidthAdjust = 4;
[Category("Table")] [Category("Table")]
@@ -1156,7 +955,7 @@ namespace Volian.Controls.Library
public int TableWidthAdjust public int TableWidthAdjust
{ {
get { return _TableWidthAdjust; } get { return _TableWidthAdjust; }
set { _TableWidthAdjust = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _TableWidthAdjust = value; MyStepPanel?.Refresh(); }
} }
private int _CheckOffWeight = 1; private int _CheckOffWeight = 1;
[Category("CheckOff")] [Category("CheckOff")]
@@ -1164,7 +963,7 @@ namespace Volian.Controls.Library
public int CheckOffWeight public int CheckOffWeight
{ {
get { return _CheckOffWeight; } get { return _CheckOffWeight; }
set { _CheckOffWeight = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _CheckOffWeight = value; MyStepPanel?.Refresh(); }
} }
private Color _CheckOffColor = Color.Black; private Color _CheckOffColor = Color.Black;
[Category("CheckOff")] [Category("CheckOff")]
@@ -1172,7 +971,7 @@ namespace Volian.Controls.Library
public Color CheckOffColor public Color CheckOffColor
{ {
get { return _CheckOffColor; } get { return _CheckOffColor; }
set { _CheckOffColor = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _CheckOffColor = value; MyStepPanel?.Refresh(); }
} }
private int _CheckOffSize =12; private int _CheckOffSize =12;
[Category("CheckOff")] [Category("CheckOff")]
@@ -1180,7 +979,7 @@ namespace Volian.Controls.Library
public int CheckOffSize public int CheckOffSize
{ {
get { return _CheckOffSize; } get { return _CheckOffSize; }
set { _CheckOffSize = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _CheckOffSize = value; MyStepPanel?.Refresh(); }
} }
private int _CheckOffX =0; private int _CheckOffX =0;
[Category("CheckOff")] [Category("CheckOff")]
@@ -1188,7 +987,7 @@ namespace Volian.Controls.Library
public int CheckOffX public int CheckOffX
{ {
get { return _CheckOffX; } get { return _CheckOffX; }
set { _CheckOffX = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _CheckOffX = value; MyStepPanel?.Refresh(); }
} }
private int _CheckOffY =5; private int _CheckOffY =5;
[Category("CheckOff")] [Category("CheckOff")]
@@ -1196,7 +995,7 @@ namespace Volian.Controls.Library
public int CheckOffY public int CheckOffY
{ {
get { return _CheckOffY; } get { return _CheckOffY; }
set { _CheckOffY = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _CheckOffY = value; MyStepPanel?.Refresh(); }
} }
private int _ChangeBarWeight = 1; private int _ChangeBarWeight = 1;
@@ -1205,7 +1004,7 @@ namespace Volian.Controls.Library
public int ChangeBarWeight public int ChangeBarWeight
{ {
get { return _ChangeBarWeight; } get { return _ChangeBarWeight; }
set { _ChangeBarWeight = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _ChangeBarWeight = value; MyStepPanel?.Refresh(); }
} }
private Color _ChangeBarColor = Color.Black; private Color _ChangeBarColor = Color.Black;
[Category("ChangeBar")] [Category("ChangeBar")]
@@ -1213,116 +1012,65 @@ namespace Volian.Controls.Library
public Color ChangeBarColor public Color ChangeBarColor
{ {
get { return _ChangeBarColor; } get { return _ChangeBarColor; }
set { _ChangeBarColor = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } set { _ChangeBarColor = value; MyStepPanel?.Refresh(); }
} }
} }
public partial class StepPanelEventArgs public partial class StepPanelEventArgs
{ {
private EditItem _MyEditItem; public EditItem MyEditItem { get; set; }
public EditItem MyEditItem public MouseEventArgs MyMouseEventArgs { get; set; }
{
get { return _MyEditItem; }
set { _MyEditItem = value; }
}
private MouseEventArgs _MyMouseEventArgs;
public MouseEventArgs MyMouseEventArgs
{
get { return _MyMouseEventArgs; }
set { _MyMouseEventArgs = value; }
}
public StepPanelEventArgs(EditItem myEditItem, MouseEventArgs myMouseEventArgs) public StepPanelEventArgs(EditItem myEditItem, MouseEventArgs myMouseEventArgs)
{ {
_MyEditItem = myEditItem; MyEditItem = myEditItem;
_MyMouseEventArgs = myMouseEventArgs; MyMouseEventArgs = myMouseEventArgs;
} }
} }
public partial class ItemSelectedChangedEventArgs public partial class ItemSelectedChangedEventArgs
{ {
private ItemInfo _MyItemInfo; public ItemInfo MyItemInfo { get; set; }
public ItemInfo MyItemInfo public EditItem MyEditItem { get; set; } = null;
{
get { return _MyItemInfo; }
set { _MyItemInfo = value; }
}
private EditItem _MyEditItem = null;
public EditItem MyEditItem
{
get { return _MyEditItem; }
set { _MyEditItem = value; }
}
public ItemSelectedChangedEventArgs(ItemInfo myItemInfo) public ItemSelectedChangedEventArgs(ItemInfo myItemInfo)
{ {
_MyItemInfo = myItemInfo; MyItemInfo = myItemInfo;
} }
public ItemSelectedChangedEventArgs(EditItem myEditItem) public ItemSelectedChangedEventArgs(EditItem myEditItem)
{ {
_MyItemInfo = myEditItem?.MyItemInfo; MyItemInfo = myEditItem?.MyItemInfo;
_MyEditItem = myEditItem; MyEditItem = myEditItem;
} }
} }
public partial class StepPanelAttachmentEventArgs public partial class StepPanelAttachmentEventArgs
{ {
private EditItem _MyEditItem; public EditItem MyEditItem { get; set; }
public EditItem MyEditItem
{
get { return _MyEditItem; }
set { _MyEditItem = value; }
}
public StepPanelAttachmentEventArgs(EditItem myEditItem) public StepPanelAttachmentEventArgs(EditItem myEditItem)
{ {
_MyEditItem = myEditItem; MyEditItem = myEditItem;
} }
} }
public partial class StepPanelLinkEventArgs : EventArgs public partial class StepPanelLinkEventArgs : EventArgs
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public string LinkInfoText { get; }
//private EditItem _LinkedEditItem; public LinkText MyLinkText { get; }
//public EditItem LinkedEditItem
//{
// get { return _LinkedEditItem; }
//}
private string _LinkInfoText;
public string LinkInfoText
{
get { return _LinkInfoText; }
}
private LinkText _MyLinkText;
public LinkText MyLinkText
{
get { return _MyLinkText;}
}
public StepPanelLinkEventArgs(string linkInfoText) public StepPanelLinkEventArgs(string linkInfoText)
{ {
//_LinkedEditItem = linkedEditItem; LinkInfoText = linkInfoText;
_LinkInfoText = linkInfoText; MyLinkText = new LinkText(LinkInfoText);
_MyLinkText = new LinkText(_LinkInfoText); //for Debugging: linkInfo.LinkText
//if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("\r\n LinkInfo '{0}'\r\n", linkInfo.LinkText);
} }
} }
public partial class StepPanelTabDisplayEventArgs : EventArgs public partial class StepPanelTabDisplayEventArgs : EventArgs
{ {
private string _PanelTabName; public string PanelTabName { get; }
public string PanelTabName public StepPanelTabDisplayEventArgs(string panelTabname) => PanelTabName = panelTabname;
{
get { return _PanelTabName; }
}
public StepPanelTabDisplayEventArgs(string panelTabname)
{
_PanelTabName = panelTabname;
}
} }
public partial class WordSectionEventArgs : EventArgs public partial class WordSectionEventArgs : EventArgs
{ {
private SectionInfo _MySectionInfo; public SectionInfo MySectionInfo { get; }
public SectionInfo MySectionInfo
{
get { return _MySectionInfo; }
}
public WordSectionEventArgs(SectionInfo mySectionInfo) public WordSectionEventArgs(SectionInfo mySectionInfo)
{ {
_MySectionInfo = mySectionInfo; MySectionInfo = mySectionInfo;
} }
} }
public delegate void StepPanelEvent(object sender, StepPanelEventArgs args); public delegate void StepPanelEvent(object sender, StepPanelEventArgs args);
File diff suppressed because it is too large Load Diff
-1
View File
@@ -15,7 +15,6 @@ namespace Volian.Controls.Library
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (_Disposed) return; if (_Disposed) return;
_CountDisposed++;
_Disposed = true; _Disposed = true;
if (disposing && (components != null)) if (disposing && (components != null))
{ {
+34 -103
View File
@@ -1,11 +1,5 @@
using System; using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Drawing;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
using System.Windows.Forms; using System.Windows.Forms;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
@@ -14,41 +8,24 @@ namespace Volian.Controls.Library
public partial class StepTabPanel : DevComponents.DotNetBar.PanelDockContainer public partial class StepTabPanel : DevComponents.DotNetBar.PanelDockContainer
{ {
#region Private Fields #region Private Fields
private DisplayTabControl _MyDisplayTabControl; private readonly DisplayTabControl _MyDisplayTabControl;
private StepTabRibbon _MyStepTabRibbon;
public StepTabRibbon MyStepTabRibbon public StepTabRibbon MyStepTabRibbon { get; set; }
{
get { return _MyStepTabRibbon; }
set { _MyStepTabRibbon = value; }
}
private StepPanel _MyStepPanel; private StepPanel _MyStepPanel;
private DisplayTabItem _MyDisplayTabItem;
#endregion #endregion
#region Properties #region Properties
/// <summary> /// <summary>
/// Container /// Container
/// </summary> /// </summary>
public DisplayTabControl MyDisplayTabControl public DisplayTabControl MyDisplayTabControl => _MyDisplayTabControl;
{
get { return _MyDisplayTabControl; }
//set { _MyDisplayTabControl = value; }
}
/// <summary> /// <summary>
/// StepPanel contained in this control. /// StepPanel contained in this control.
/// </summary> /// </summary>
public Volian.Controls.Library.StepPanel MyStepPanel public Volian.Controls.Library.StepPanel MyStepPanel => _MyStepPanel;
{
get { return _MyStepPanel; }
//set { _MyStepPanel = value; }
}
/// <summary> /// <summary>
/// related DisplayTabItem /// related DisplayTabItem
/// </summary> /// </summary>
public DisplayTabItem MyDisplayTabItem public DisplayTabItem MyDisplayTabItem { get; set; }
{
get { return _MyDisplayTabItem; }
set { _MyDisplayTabItem = value; }
}
/// <summary> /// <summary>
/// Currently Selected ItemInfo /// Currently Selected ItemInfo
/// </summary> /// </summary>
@@ -63,18 +40,14 @@ namespace Volian.Controls.Library
FlexibleMessageBox.Show("The selected item is not available in the editor. One possible cause is that the data is 'not editable', check the section properties 'Editable Data' checkbox.", "Inaccessible Data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); FlexibleMessageBox.Show("The selected item is not available in the editor. One possible cause is that the data is 'not editable', check the section properties 'Editable Data' checkbox.", "Inaccessible Data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return; return;
} }
if (_MyStepPanel.SelectedEditItem != null) _MyStepPanel.SelectedEditItem?.ItemSelect();
_MyStepPanel.SelectedEditItem.ItemSelect();
if (!_MyStepPanel.ItemSelectionChangeShown) _MyStepPanel.OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(_MyStepPanel.SelectedEditItem)); if (!_MyStepPanel.ItemSelectionChangeShown) _MyStepPanel.OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(_MyStepPanel.SelectedEditItem));
} }
} }
/// <summary> /// <summary>
/// Currently Selected EditItem /// Currently Selected EditItem
/// </summary> /// </summary>
public EditItem SelectedEditItem public EditItem SelectedEditItem => _MyStepPanel.SelectedEditItem;
{
get { return _MyStepPanel.SelectedEditItem; }
}
/// <summary> /// <summary>
/// Procedure ItemInfo /// Procedure ItemInfo
/// </summary> /// </summary>
@@ -120,14 +93,16 @@ namespace Volian.Controls.Library
/// </summary> /// </summary>
private void SetupStepTabRibbon() private void SetupStepTabRibbon()
{ {
_MyStepTabRibbon = new StepTabRibbon(_MyDisplayTabControl.IsInEditorialMode); MyStepTabRibbon = new StepTabRibbon(_MyDisplayTabControl.IsInEditorialMode)
_MyStepTabRibbon.Dock = System.Windows.Forms.DockStyle.Top; {
_MyStepTabRibbon.Location = new System.Drawing.Point(0, 0); Dock = System.Windows.Forms.DockStyle.Top,
_MyStepTabRibbon.Name = "displayTabRibbon1"; Location = new System.Drawing.Point(0, 0),
Name = "displayTabRibbon1",
//_MyTabRibbon.MyDisplayRTB = null; //_MyTabRibbon.MyDisplayRTB = null;
_MyStepTabRibbon.MyEditItem = null; MyEditItem = null
this.Controls.Add(_MyStepTabRibbon); };
_MyStepTabRibbon.Expanded = _MyDisplayTabControl.RibbonExpanded; this.Controls.Add(MyStepTabRibbon);
MyStepTabRibbon.Expanded = _MyDisplayTabControl.RibbonExpanded;
} }
/// <summary> /// <summary>
/// Setup this within control /// Setup this within control
@@ -142,7 +117,6 @@ namespace Volian.Controls.Library
/// </summary> /// </summary>
private void SetupStepPanel() private void SetupStepPanel()
{ {
//this.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
_MyStepPanel = new Volian.Controls.Library.StepPanel(this.components); _MyStepPanel = new Volian.Controls.Library.StepPanel(this.components);
this.Controls.Add(_MyStepPanel); this.Controls.Add(_MyStepPanel);
// //
@@ -159,7 +133,6 @@ namespace Volian.Controls.Library
_MyStepPanel.ItemClick +=new Volian.Controls.Library.StepPanelEvent(_MyStepPanel_ItemClick); _MyStepPanel.ItemClick +=new Volian.Controls.Library.StepPanelEvent(_MyStepPanel_ItemClick);
_MyStepPanel.AttachmentClicked += new Volian.Controls.Library.StepPanelAttachmentEvent(_MyStepPanel_AttachmentClicked); _MyStepPanel.AttachmentClicked += new Volian.Controls.Library.StepPanelAttachmentEvent(_MyStepPanel_AttachmentClicked);
_MyStepPanel.ItemSelectedChanged += new ItemSelectedChangedEvent(_MyStepPanel_ItemSelectedChanged); _MyStepPanel.ItemSelectedChanged += new ItemSelectedChangedEvent(_MyStepPanel_ItemSelectedChanged);
//_MyStepPanel.ModeChange += new Volian.Controls.Library.StepPanelModeChangeEvent(_MyStepPanel_ModeChange);
_MyStepPanel.TabDisplay += new Volian.Controls.Library.StepPanelTabDisplayEvent(_MyStepPanel_TabDisplay); _MyStepPanel.TabDisplay += new Volian.Controls.Library.StepPanelTabDisplayEvent(_MyStepPanel_TabDisplay);
_MyStepPanel.WordSectionClose += new StepPanelWordSectionCloseEvent(_MyStepPanel_WordSectionClose); _MyStepPanel.WordSectionClose += new StepPanelWordSectionCloseEvent(_MyStepPanel_WordSectionClose);
_MyStepPanel.WordSectionDeleted += new StepPanelWordSectionDeletedEvent(_MyStepPanel_WordSectionDeleted); _MyStepPanel.WordSectionDeleted += new StepPanelWordSectionDeletedEvent(_MyStepPanel_WordSectionDeleted);
@@ -169,12 +142,7 @@ namespace Volian.Controls.Library
#endregion #endregion
#region Event Handlers #region Event Handlers
private bool _ShowingItem = false; public bool ShowingItem { get; set; } = false;
public bool ShowingItem
{
get { return _ShowingItem; }
set { _ShowingItem = value; }
}
/// <summary> /// <summary>
/// Occurs when the user clicks on a StepTabPanel /// Occurs when the user clicks on a StepTabPanel
/// </summary> /// </summary>
@@ -182,15 +150,14 @@ namespace Volian.Controls.Library
/// <param name="e"></param> /// <param name="e"></param>
private void StepTabPanel_Enter(object sender, EventArgs e) private void StepTabPanel_Enter(object sender, EventArgs e)
{ {
if (_ShowingItem) return; if (ShowingItem) return;
// B2019-029: added to save a dirty annotation when the btnsave was not clicked (user just moves to another steprtb but had added annotationi text): // B2019-029: added to save a dirty annotation when the btnsave was not clicked (user just moves to another steprtb but had added annotationi text):
if (MyDisplayTabControl.MyAnnotationDetails.AnnotationDirty) MyDisplayTabControl.MyAnnotationDetails.SaveAnnotation(); if (MyDisplayTabControl.MyAnnotationDetails.AnnotationDirty) MyDisplayTabControl.MyAnnotationDetails.SaveAnnotation();
_ShowingItem = true; ShowingItem = true;
//if (ItemSelected != null)
_MyStepPanel.ItemShow(); _MyStepPanel.ItemShow();
if (_MyStepPanel.MyStepTabPanel != null) // B2014-024 if MyStepTabPanel is null then we are in the process of closing the procedure in that step panel // B2014-024 if MyStepTabPanel is null then we are in the process of closing the procedure in that step panel
_MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetUpdRoValBtn(_MyStepPanel.MyStepTabPanel.MyStepTabRibbon.NewerRoFst()); _MyStepPanel.MyStepTabPanel?.MyStepTabRibbon.SetUpdRoValBtn(_MyStepPanel.MyStepTabPanel.MyStepTabRibbon.NewerRoFst());
_ShowingItem = false; ShowingItem = false;
_MyDisplayTabControl.SelectedDisplayTabItem = MyDisplayTabItem; _MyDisplayTabControl.SelectedDisplayTabItem = MyDisplayTabItem;
} }
/// <summary> /// <summary>
@@ -198,46 +165,31 @@ namespace Volian.Controls.Library
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="args"></param> /// <param name="args"></param>
void _MyStepPanel_LinkActiveChanged(object sender, StepPanelLinkEventArgs args) void _MyStepPanel_LinkActiveChanged(object sender, StepPanelLinkEventArgs args) => _MyDisplayTabControl.OnLinkActiveChanged(sender, args);
{
_MyDisplayTabControl.OnLinkActiveChanged(sender, args);
}
/// <summary> /// <summary>
/// Occurs when the user chooses to add a transition /// Occurs when the user chooses to add a transition
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="args"></param> /// <param name="args"></param>
void _MyStepPanel_LinkInsertTran(object sender, StepPanelLinkEventArgs args) void _MyStepPanel_LinkInsertTran(object sender, StepPanelLinkEventArgs args) => _MyDisplayTabControl.OnLinkInsertTran(sender, args);
{
_MyDisplayTabControl.OnLinkInsertTran(sender, args);
}
/// <summary> /// <summary>
/// Occurs when the user chooses to add an RO /// Occurs when the user chooses to add an RO
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="args"></param> /// <param name="args"></param>
void _MyStepPanel_LinkInsertRO(object sender, StepPanelLinkEventArgs args) void _MyStepPanel_LinkInsertRO(object sender, StepPanelLinkEventArgs args) => _MyDisplayTabControl.OnLinkInsertRO(sender, args);
{
_MyDisplayTabControl.OnLinkInsertRO(sender, args);
}
/// <summary> /// <summary>
/// Occurs when the user chosses to modify a transition /// Occurs when the user chosses to modify a transition
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="args"></param> /// <param name="args"></param>
void _MyStepPanel_LinkModifyTran(object sender, StepPanelLinkEventArgs args) void _MyStepPanel_LinkModifyTran(object sender, StepPanelLinkEventArgs args) => _MyDisplayTabControl.OnLinkModifyTran(sender, args);
{
_MyDisplayTabControl.OnLinkModifyTran(sender, args);
}
/// <summary> /// <summary>
/// Occurs when the user chooses to Modify an RO /// Occurs when the user chooses to Modify an RO
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="args"></param> /// <param name="args"></param>
void _MyStepPanel_LinkModifyRO(object sender, StepPanelLinkEventArgs args) void _MyStepPanel_LinkModifyRO(object sender, StepPanelLinkEventArgs args) => _MyDisplayTabControl.OnLinkModifyRO(sender, args);
{
_MyDisplayTabControl.OnLinkModifyRO(sender, args);
}
/// <summary> /// <summary>
/// Occurs when the Selected Item changes /// Occurs when the Selected Item changes
/// </summary> /// </summary>
@@ -245,15 +197,9 @@ namespace Volian.Controls.Library
/// <param name="args"></param> /// <param name="args"></param>
void _MyStepPanel_ItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args) void _MyStepPanel_ItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args)
{ {
_MyStepTabRibbon.MyEditItem = args.MyEditItem; MyStepTabRibbon.MyEditItem = args.MyEditItem;
_MyDisplayTabControl.OnItemSelectedChanged(sender, args); _MyDisplayTabControl.OnItemSelectedChanged(sender, args);
} }
// Occurs when the Mode Changes
//void _MyStepPanel_ModeChange(object sender, StepRTBModeChangeEventArgs args)
//{
// _MyDisplayTabControl.OnModeChange(sender, args);
//}
/// <summary> /// <summary>
/// Occurs when the user clicks on the Attachment Expander /// Occurs when the user clicks on the Attachment Expander
/// </summary> /// </summary>
@@ -302,27 +248,12 @@ namespace Volian.Controls.Library
else else
Console.WriteLine("Bring Up roeditor"); //TODO: Need to bring up roeditor or infopanel Console.WriteLine("Bring Up roeditor"); //TODO: Need to bring up roeditor or infopanel
} }
void _MyStepPanel_TabDisplay(object sender, StepPanelTabDisplayEventArgs args) void _MyStepPanel_TabDisplay(object sender, StepPanelTabDisplayEventArgs args) => _MyDisplayTabControl.OnPanelTabDisplay(sender, args);
{ void _MyStepPanel_WordSectionClose(object sender, WordSectionEventArgs args) => _MyDisplayTabControl.OnWordSectionClose(sender, args);
_MyDisplayTabControl.OnPanelTabDisplay(sender, args); void _MyStepPanel_WordSectionDeleted(object sender, WordSectionEventArgs args) => _MyDisplayTabControl.OnWordSectionDeleted(sender, args);
} void _MyStepPanel_ItemPasted(object sender, vlnTreeItemInfoPasteEventArgs args) => _MyDisplayTabControl.OnItemPaste(sender, args);
void _MyStepPanel_WordSectionClose(object sender, WordSectionEventArgs args) public override string ToString() => string.Format("StepTabPanel Procedure Item {0} {1}",
{
_MyDisplayTabControl.OnWordSectionClose(sender, args);
}
void _MyStepPanel_WordSectionDeleted(object sender, WordSectionEventArgs args)
{
_MyDisplayTabControl.OnWordSectionDeleted(sender, args);
}
void _MyStepPanel_ItemPasted(object sender, vlnTreeItemInfoPasteEventArgs args)
{
_MyDisplayTabControl.OnItemPaste(sender, args);
}
public override string ToString()
{
return string.Format("StepTabPanel Procedure Item {0} {1}",
MyDisplayTabItem.MyItemInfo.ItemID, MyDisplayTabItem.MyItemInfo.DisplayNumber); MyDisplayTabItem.MyItemInfo.ItemID, MyDisplayTabItem.MyItemInfo.DisplayNumber);
}
#endregion #endregion
} }
} }
File diff suppressed because it is too large Load Diff
Binary file not shown.
@@ -24,6 +24,7 @@ namespace Volian.Controls.Library
}; };
private DataTable values; private DataTable values;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping bindingSource flexible")]
private BindingSource bindingSource = null; private BindingSource bindingSource = null;
private int totalrows = 1; private int totalrows = 1;
private int totalcols = 1; private int totalcols = 1;
@@ -104,8 +105,10 @@ namespace Volian.Controls.Library
void FormLoad_setDefaults(object sender, EventArgs e) void FormLoad_setDefaults(object sender, EventArgs e)
{ {
BindingSource bindingSourceDropDown = new BindingSource(); BindingSource bindingSourceDropDown = new BindingSource
bindingSourceDropDown.DataSource = Enum.GetNames(typeof(EPinputtype)); {
DataSource = Enum.GetNames(typeof(EPinputtype))
};
//in order to achieve a dropdown of possible values need //in order to achieve a dropdown of possible values need
//to remove the auto-inserted columns //to remove the auto-inserted columns
@@ -114,8 +117,10 @@ namespace Volian.Controls.Library
for (int c = 0; c < totalcols; c++) for (int c = 0; c < totalcols; c++)
{ {
dataview.Columns.RemoveAt(c); dataview.Columns.RemoveAt(c);
var cName = new DataGridViewComboBoxColumn(); var cName = new DataGridViewComboBoxColumn
cName.DataSource = bindingSourceDropDown; {
DataSource = bindingSourceDropDown
};
cName.DefaultCellStyle.NullValue = "none"; cName.DefaultCellStyle.NullValue = "none";
dataview.Columns.Insert(c, cName); dataview.Columns.Insert(c, cName);
} }
@@ -200,8 +205,10 @@ namespace Volian.Controls.Library
int endNumCols = (int)NumCols.Value; int endNumCols = (int)NumCols.Value;
int curNumCols = totalcols; int curNumCols = totalcols;
BindingSource bindingSourceDropDown = new BindingSource(); BindingSource bindingSourceDropDown = new BindingSource
bindingSourceDropDown.DataSource = Enum.GetNames(typeof(EPinputtype)); {
DataSource = Enum.GetNames(typeof(EPinputtype))
};
//remove cols till equal //remove cols till equal
while (curNumCols > endNumCols) while (curNumCols > endNumCols)
@@ -215,8 +222,10 @@ namespace Volian.Controls.Library
{ {
values.Columns.Add(new DataColumn($"Column{curNumCols + 1}") { DefaultValue = "none"}); values.Columns.Add(new DataColumn($"Column{curNumCols + 1}") { DefaultValue = "none"});
if (dataview.Columns.Count > curNumCols) dataview.Columns.RemoveAt(curNumCols); if (dataview.Columns.Count > curNumCols) dataview.Columns.RemoveAt(curNumCols);
var cName = new DataGridViewComboBoxColumn(); var cName = new DataGridViewComboBoxColumn
cName.DataSource = bindingSourceDropDown; {
DataSource = bindingSourceDropDown
};
cName.DefaultCellStyle.NullValue = "none"; cName.DefaultCellStyle.NullValue = "none";
dataview.Columns.Add(cName); dataview.Columns.Add(cName);
@@ -1,9 +1,5 @@
using System;
using System.Drawing; using System.Drawing;
//using System.Collections;
using System.ComponentModel;
using System.Windows.Forms; using System.Windows.Forms;
//using System.Data;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
@@ -52,8 +48,6 @@ namespace Volian.Controls.Library
{ {
SizeF txtSize = e.Graphics.MeasureString(_Caption, this.Font); SizeF txtSize = e.Graphics.MeasureString(_Caption, this.Font);
//Use a gray rectangle to show that the underlying control is inactive //Use a gray rectangle to show that the underlying control is inactive
//using (Brush b2 = new SolidBrush(Color.FromArgb(_Alpha, this.BackColor)))
// e.Graphics.FillRectangle(b2, this.ClientRectangle);
using (Brush b = new SolidBrush(Color.FromArgb(_Alpha, this.ForeColor))) using (Brush b = new SolidBrush(Color.FromArgb(_Alpha, this.ForeColor)))
e.Graphics.DrawString(_Caption, this.Font, b, this.Width - txtSize.Width, 2); e.Graphics.DrawString(_Caption, this.Font, b, this.Width - txtSize.Width, 2);
} }
+7 -32
View File
@@ -1,10 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
using System.Xml.Schema;
using System.Drawing; using System.Drawing;
using Volian.Base.Library; using Volian.Base.Library;
@@ -164,18 +160,9 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Serialize #region Serialize
public string ConvertToString() public string ConvertToString() => GenericSerializer<VlnBorders>.StringSerialize(this);
{ public override string ToString() => "Volian Custom Borders";
return GenericSerializer<VlnBorders>.StringSerialize(this); public static VlnBorders Get(string xml) => GenericSerializer<VlnBorders>.StringDeserialize(xml);
}
public override string ToString()
{
return "Volian Custom Borders";
}
public static VlnBorders Get(string xml)
{
return GenericSerializer<VlnBorders>.StringDeserialize(xml);
}
#endregion #endregion
#region Line Pattern Static Methods #region Line Pattern Static Methods
public static int LineWidth(GridLinePattern linePattern) public static int LineWidth(GridLinePattern linePattern)
@@ -322,10 +309,7 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Insert and Delete Rows and Columns #region Insert and Delete Rows and Columns
public void InsertRow(int row) public void InsertRow(int row) => InsertRows(row, 1);
{
InsertRows(row, 1);
}
public void InsertRows(int row, int count) public void InsertRows(int row, int count)
{ {
// Create a new Array of the correct size // Create a new Array of the correct size
@@ -343,10 +327,7 @@ namespace Volian.Controls.Library
Lines = newLines; Lines = newLines;
Rows = newRows; Rows = newRows;
} }
public void DeleteRow(int row) public void DeleteRow(int row) => DeleteRows(row, 1);
{
DeleteRows(row, 1);
}
public void DeleteRows(int row, int count) public void DeleteRows(int row, int count)
{ {
GridLinePattern[] newLines = new GridLinePattern[(Rows - count) * Columns]; GridLinePattern[] newLines = new GridLinePattern[(Rows - count) * Columns];
@@ -362,10 +343,7 @@ namespace Volian.Controls.Library
Lines = newLines; Lines = newLines;
Rows = newRows; Rows = newRows;
} }
public void InsertColumn(int column) public void InsertColumn(int column) => InsertColumns(column, 1);
{
InsertColumns(column, 1);
}
public void InsertColumns(int column, int count) public void InsertColumns(int column, int count)
{ {
// Create a new Array of the correct size // Create a new Array of the correct size
@@ -382,10 +360,7 @@ namespace Volian.Controls.Library
Lines = newLines; Lines = newLines;
Columns = newColumns; Columns = newColumns;
} }
public void DeleteColumn(int column) public void DeleteColumn(int column) => DeleteColumns(column, 1);
{
DeleteColumns(column, 1);
}
public void DeleteColumns(int column, int count) public void DeleteColumns(int column, int count)
{ {
GridLinePattern[] newLines = new GridLinePattern[Rows * (Columns - count)]; GridLinePattern[] newLines = new GridLinePattern[Rows * (Columns - count)];
+2 -3
View File
@@ -49,12 +49,11 @@ namespace Volian.Controls.Library
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (_Disposed) return; if (_Disposed) return;
_CountDisposed++;
_Disposed = true; _Disposed = true;
_MyBorders = null; _MyBorders = null;
_MyShading = null; _MyShading = null;
_SpellChecker = null; SpellChecker = null;
_tableCellEditor = null; TableCellEditor = null;
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
File diff suppressed because it is too large Load Diff
@@ -1,11 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
using System.Xml.Schema;
using System.Drawing; using System.Drawing;
using Volian.Base.Library; using Volian.Base.Library;
@@ -89,69 +84,26 @@ namespace Volian.Controls.Library
string strARGB = string.Format("[A={0}, R={1}, G={2}, B={3}]", clr.A, clr.R, clr.G, clr.B); string strARGB = string.Format("[A={0}, R={1}, G={2}, B={3}]", clr.A, clr.R, clr.G, clr.B);
return strARGB; return strARGB;
} }
public void SetColor(int row, int col, Color CellColor)
{
// Set the table cell to the ARGB representation of the passed in color
string cellShadeColor = GetARGBstring(CellColor);
TableShadingInfo[row, col] = cellShadeColor;
return;
}
#endregion #endregion
#region Insert and Remove Rows and Columns #region Insert and Remove Rows and Columns
public void InsertRow(int row) public void InsertRow(int row) => TableShadingInfo.InsertRow(row);
{ public void InsertRows(int row, int count) => TableShadingInfo.InsertRows(row, count);
TableShadingInfo.InsertRow(row); public void DeleteRow(int row) => TableShadingInfo.DeleteRow(row);
} public void DeleteRows(int row, int count) => TableShadingInfo.DeleteRows(row, count);
public void InsertRows(int row, int count) public void InsertColumn(int column) => TableShadingInfo.InsertColumn(column);
{ public void InsertColumns(int column, int count) => TableShadingInfo.InsertColumns(column, count);
TableShadingInfo.InsertRows(row, count); public void DeleteColumns(int column, int count) => TableShadingInfo.DeleteColumns(column, count);
}
public void DeleteRow(int row)
{
TableShadingInfo.DeleteRow(row);
}
public void DeleteRows(int row, int count)
{
TableShadingInfo.DeleteRows(row, count);
}
public void InsertColumn(int column)
{
TableShadingInfo.InsertColumn(column);
}
public void InsertColumns(int column, int count)
{
TableShadingInfo.InsertColumns(column, count);
}
public void DeleteColumn(int column)
{
TableShadingInfo.DeleteColumn(column);
}
public void DeleteColumns(int column, int count)
{
TableShadingInfo.DeleteColumns(column, count);
}
#endregion #endregion
#region Serialize #region Serialize
public string ConvertToString() public string ConvertToString()
{ {
return GenericSerializer<VlnGridCellShading>.StringSerialize(this); return GenericSerializer<VlnGridCellShading>.StringSerialize(this);
} }
public override string ToString()
{
return "Volian Custom Cell Shading";
}
public static VlnGridCellShading Get(string xml) public static VlnGridCellShading Get(string xml)
{ {
return GenericSerializer<VlnGridCellShading>.StringDeserialize(xml); return GenericSerializer<VlnGridCellShading>.StringDeserialize(xml);
} }
#endregion #endregion
// Adjust the cell shading array if needed
public void CheckAndFixShadingArraySize(int grdRows, int grdCols, Color defaultCellShading)
{
if (TableShadingInfo.Columns != grdCols || TableShadingInfo.Rows != grdRows)
TableShadingInfo = new CellShadingArray(defaultCellShading, grdRows, grdCols, TableShadingInfo.CellShadingColor);
}
} }
[Serializable] [Serializable]
public class CellShadingArray public class CellShadingArray
@@ -200,22 +152,6 @@ namespace Volian.Controls.Library
for (int c = 0; c < Columns; c++) for (int c = 0; c < Columns; c++)
CellShadingColor[r * Columns + c] = defaultShadingColorARGB; CellShadingColor[r * Columns + c] = defaultShadingColorARGB;
} }
// Used to automatically adjust the cell shading color array
public CellShadingArray(Color defaultShadingColor, int rows, int columns, string[] shadeAry)
{
Rows = rows;
Columns = columns;
CellShadingColor = new string[rows * columns];
for (int r = 0; r < Rows; r++)
for (int c = 0; c < Columns; c++)
{
int idx = r * Columns + c;
if (idx < shadeAry.Length)
CellShadingColor[idx] = shadeAry[idx];
else
CellShadingColor[idx] = defaultShadingColor.ToString();
}
}
#endregion #endregion
#region Array Access #region Array Access
public string this[int r, int c] public string this[int r, int c]
@@ -234,10 +170,7 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Insert and Delete Rows and Columns #region Insert and Delete Rows and Columns
public void InsertRow(int row) public void InsertRow(int row) => InsertRows(row, 1);
{
InsertRows(row, 1);
}
public void InsertRows(int row, int count) public void InsertRows(int row, int count)
{ {
// Create a new Array of the correct size // Create a new Array of the correct size
@@ -255,10 +188,7 @@ namespace Volian.Controls.Library
CellShadingColor = newLines; CellShadingColor = newLines;
Rows = newRows; Rows = newRows;
} }
public void DeleteRow(int row) public void DeleteRow(int row) => DeleteRows(row, 1);
{
DeleteRows(row, 1);
}
public void DeleteRows(int row, int count) public void DeleteRows(int row, int count)
{ {
string[] newLines = new string[(Rows - count) * Columns]; string[] newLines = new string[(Rows - count) * Columns];
@@ -274,10 +204,7 @@ namespace Volian.Controls.Library
CellShadingColor = newLines; CellShadingColor = newLines;
Rows = newRows; Rows = newRows;
} }
public void InsertColumn(int column) public void InsertColumn(int column) => InsertColumns(column, 1);
{
InsertColumns(column, 1);
}
public void InsertColumns(int column, int count) public void InsertColumns(int column, int count)
{ {
// Create a new Array of the correct size // Create a new Array of the correct size
@@ -294,10 +221,7 @@ namespace Volian.Controls.Library
CellShadingColor = newLines; CellShadingColor = newLines;
Columns = newColumns; Columns = newColumns;
} }
public void DeleteColumn(int column) public void DeleteColumn(int column) => DeleteColumns(column, 1);
{
DeleteColumns(column, 1);
}
public void DeleteColumns(int column, int count) public void DeleteColumns(int column, int count)
{ {
string[] newLines = new string[Rows * (Columns - count)]; string[] newLines = new string[Rows * (Columns - count)];
+1 -12
View File
@@ -1,21 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
public class VlnSpellCheck public class VlnSpellCheck
{ {
private EditItem _MyEditItem; public EditItem MyEditItem { get; set; }
public EditItem MyEditItem
{
get { return _MyEditItem; }
set
{
_MyEditItem = value;
}
}
public VlnSpellCheck() public VlnSpellCheck()
@@ -1,11 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using DevComponents.DotNetBar;
using C1.Win.C1SpellChecker; using C1.Win.C1SpellChecker;
namespace Volian.Controls.Library namespace Volian.Controls.Library
@@ -19,24 +14,19 @@ namespace Volian.Controls.Library
private int _ErrorCount; private int _ErrorCount;
private int _ErrorIndex = -1; // current error index private int _ErrorIndex = -1; // current error index
private bool _AutoSuggest = true; private bool _AutoSuggest = true;
private string _NoSuggestionsText = "(no suggestions)"; private readonly string _NoSuggestionsText = "(no suggestions)";
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
Dictionary<string, string> _changeAll = new Dictionary<string, string>(); Dictionary<string, string> _changeAll = new Dictionary<string, string>();
/// <summary> /// <summary>
/// Gets the <see cref="CharRange"/> object that represents the error currently /// Gets the <see cref="CharRange"/> object that represents the error currently
/// displayed in the dialog. /// displayed in the dialog.
/// </summary> /// </summary>
public CharRange CurrentError public CharRange CurrentError => _Errors[_ErrorIndex];
{
get { return _Errors[_ErrorIndex]; }
}
public bool DidCorrectSpelling = false; // B2015-024 have Spell Checker text changes be in editorial mode (not assign a change bar but keep existing change bar) public bool DidCorrectSpelling = false; // B2015-024 have Spell Checker text changes be in editorial mode (not assign a change bar but keep existing change bar)
public VlnSpellCheckDlg() public VlnSpellCheckDlg() => InitializeComponent();
{
InitializeComponent();
}
/// <summary> /// <summary>
/// Initializes the dialog to use the given parameters. /// Initializes the dialog to use the given parameters.
/// </summary> /// </summary>
@@ -58,10 +48,7 @@ namespace Volian.Controls.Library
/// <summary> /// <summary>
/// Gets the total number of errors detected in the control. /// Gets the total number of errors detected in the control.
/// </summary> /// </summary>
public int ErrorCount public int ErrorCount => _ErrorCount;
{
get { return _ErrorCount; }
}
/// <summary> /// <summary>
/// Gets or sets the index of the current error into the <see cref="Errors"/> list. /// Gets or sets the index of the current error into the <see cref="Errors"/> list.
@@ -105,7 +92,7 @@ namespace Volian.Controls.Library
{ {
// fire load event // fire load event
base.OnLoad(e); base.OnLoad(e);
//AddHandle(); //AddHandle(); //For Debugging
// show first error (after firing load event) // show first error (after firing load event)
ErrorIndex = 0; ErrorIndex = 0;
} }
@@ -204,8 +191,6 @@ namespace Volian.Controls.Library
// show 'Add' button only if user dictionary is enabled // show 'Add' button only if user dictionary is enabled
btnAddToDictionary.Visible = _Spell.UserDictionary.Enabled; btnAddToDictionary.Visible = _Spell.UserDictionary.Enabled;
// all ready, fire ErrorDisplayed event
//OnErrorDisplayed(EventArgs.Empty);
} }
private void SetupSuggestions(string badWord) private void SetupSuggestions(string badWord)
@@ -251,10 +236,7 @@ namespace Volian.Controls.Library
return false; return false;
} }
private void btnChange_Click(object sender, EventArgs e) private void btnChange_Click(object sender, EventArgs e) => UpdateEditor(txbBadWord.Text);
{
UpdateEditor(txbBadWord.Text);
}
private void btnChangeAll_Click(object sender, EventArgs e) private void btnChangeAll_Click(object sender, EventArgs e)
{ {
@@ -262,10 +244,7 @@ namespace Volian.Controls.Library
UpdateEditor(txbBadWord.Text); UpdateEditor(txbBadWord.Text);
} }
private void btnIgnore_Click(object sender, EventArgs e) private void btnIgnore_Click(object sender, EventArgs e) => ErrorIndex++;
{
ErrorIndex++;
}
private void btnIgnoreAll_Click(object sender, EventArgs e) private void btnIgnoreAll_Click(object sender, EventArgs e)
{ {
@@ -299,9 +278,6 @@ namespace Volian.Controls.Library
} }
} }
private void btnRemove_Click(object sender, EventArgs e) private void btnRemove_Click(object sender, EventArgs e) => UpdateEditor("");
{
UpdateEditor("");
}
} }
} }
@@ -126,7 +126,6 @@
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AlphabeticalNumbering.cs" />
<Compile Include="AnnotationDetails.cs"> <Compile Include="AnnotationDetails.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
@@ -238,6 +237,9 @@
<Compile Include="FindReplace.designer.cs"> <Compile Include="FindReplace.designer.cs">
<DependentUpon>FindReplace.cs</DependentUpon> <DependentUpon>FindReplace.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="FlagEnumEditor.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="FormatUtility.cs" /> <Compile Include="FormatUtility.cs" />
<Compile Include="frmEnhanced.cs"> <Compile Include="frmEnhanced.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
@@ -269,6 +271,7 @@
<Compile Include="frmViewTextFile.designer.cs"> <Compile Include="frmViewTextFile.designer.cs">
<DependentUpon>frmViewTextFile.cs</DependentUpon> <DependentUpon>frmViewTextFile.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="GridItem.cs"> <Compile Include="GridItem.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
@@ -368,9 +371,6 @@
<Compile Include="DSOTabPanel.designer.cs"> <Compile Include="DSOTabPanel.designer.cs">
<DependentUpon>DSOTabPanel.cs</DependentUpon> <DependentUpon>DSOTabPanel.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="FlagEnumEditor.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MostRecentItem.cs" /> <Compile Include="MostRecentItem.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
@@ -443,12 +443,6 @@
<Compile Include="vlnTreeView3.Designer.cs"> <Compile Include="vlnTreeView3.Designer.cs">
<DependentUpon>vlnTreeView3.cs</DependentUpon> <DependentUpon>vlnTreeView3.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="WebBrowser.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="WebBrowser.designer.cs">
<DependentUpon>WebBrowser.cs</DependentUpon>
</Compile>
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" /> <Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -557,10 +551,6 @@
<DependentUpon>VlnSpellCheckDlg.cs</DependentUpon> <DependentUpon>VlnSpellCheckDlg.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="WebBrowser.resx">
<DependentUpon>WebBrowser.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DropDownPanel\DropDownPanel.csproj"> <ProjectReference Include="..\DropDownPanel\DropDownPanel.csproj">
-63
View File
@@ -1,63 +0,0 @@
namespace Volian.Controls.Library
{
partial class WebBrowser
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.WebBrowserWindow = new System.Windows.Forms.WebBrowser();
this.SuspendLayout();
//
// WebBrowserWindow
//
this.WebBrowserWindow.Dock = System.Windows.Forms.DockStyle.Fill;
this.WebBrowserWindow.Location = new System.Drawing.Point(0, 0);
this.WebBrowserWindow.MinimumSize = new System.Drawing.Size(20, 20);
this.WebBrowserWindow.Name = "WebBrowserWindow";
this.WebBrowserWindow.Size = new System.Drawing.Size(1039, 723);
this.WebBrowserWindow.TabIndex = 0;
//this.WebBrowserWindow.Url = new System.Uri("http://www.volian.com", System.UriKind.Absolute);
//this.WebBrowserWindow.Url = new System.Uri(_currentURL, System.UriKind.Absolute);
//this.WebBrowserWindow.Navigate(_currentURL);
//
// WebBrowser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1039, 723);
this.Controls.Add(this.WebBrowserWindow);
this.Name = "WebBrowser";
this.ShowIcon = false;
this.Text = "WebBrowser";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.WebBrowser WebBrowserWindow;
}
}
@@ -1,38 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Volian.Controls.Library
{
public partial class WebBrowser : DevComponents.DotNetBar.Office2007Form //Form
{
private string _currentURL = @"http:/www.volian.com"; // default to volain web site
/// <summary>
/// Display an instance of the default internet web browser.
/// Note that besides a web site address, you can pass in a PDF file name (include the path).
/// This assumes that the user's web browser can display PDF files.
/// If nothing is passed in, then this will default to displaying the Volian Web Site.
/// </summary>
/// <param name="url">The URL of the web site you want to display</param>
public WebBrowser(string url)
{
_currentURL = url;
//this.Text = url;
InitializeComponent();
this.WebBrowserWindow.Navigate(_currentURL);
this.TitleText = _currentURL;
}
public WebBrowser()
{
InitializeComponent();
this.WebBrowserWindow.Navigate(_currentURL);
this.TitleText = _currentURL;
}
}
}
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+1 -6
View File
@@ -1,16 +1,11 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
public partial class dlgChgId : Form public partial class dlgChgId : Form
{ {
DisplayTabControl TabControl; readonly DisplayTabControl TabControl;
public dlgChgId(DisplayTabControl tc) public dlgChgId(DisplayTabControl tc)
{ {
InitializeComponent(); InitializeComponent();
@@ -1,9 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace Volian.Controls.Library namespace Volian.Controls.Library
@@ -12,11 +7,11 @@ namespace Volian.Controls.Library
// (a few users said that procedures 'disappeared' but this could not be reproduced) // (a few users said that procedures 'disappeared' but this could not be reproduced)
public partial class dlgDelProcReason : Form public partial class dlgDelProcReason : Form
{ {
vlnTreeView VTreeView; readonly vlnTreeView VTreeView;
public dlgDelProcReason(vlnTreeView tv) public dlgDelProcReason(vlnTreeView tv)
{ {
InitializeComponent(); InitializeComponent();
this.Text = "Verify Delete By " + Volian.Base.Library.VlnSettings.UserID; this.Text = $"Verify Delete By {Volian.Base.Library.VlnSettings.UserID}";
VTreeView = tv; VTreeView = tv;
tbDelProcReason.Focus(); tbDelProcReason.Focus();
} }
@@ -1,10 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
@@ -13,10 +7,10 @@ namespace Volian.Controls.Library
{ {
public partial class dlgEnhMissingItem : Form public partial class dlgEnhMissingItem : Form
{ {
StepTabRibbon STRibbon = null; readonly StepTabRibbon STRibbon = null;
private ItemInfo _SourceItem = null; private readonly ItemInfo _SourceItem = null;
private int _EnhType = -1; private readonly int _EnhType = -1;
private bool _Initializing = false; private readonly bool _Initializing = false;
public bool OKSelected = false; public bool OKSelected = false;
public dlgEnhMissingItem(StepTabRibbon strbn, ItemInfo srcItem, int enhType) public dlgEnhMissingItem(StepTabRibbon strbn, ItemInfo srcItem, int enhType)
{ {
@@ -40,7 +34,7 @@ namespace Volian.Controls.Library
cbUnlinkedEnhancedItems.SelectedIndex = -1; cbUnlinkedEnhancedItems.SelectedIndex = -1;
cbUnlinkedEnhancedItems.Enabled = false; cbUnlinkedEnhancedItems.Enabled = false;
} }
if (srcItem.IsProcedure) this.Text = "Create Missing Enhanced Item for " + srcItem.DisplayNumber; if (srcItem.IsProcedure) this.Text = $"Create Missing Enhanced Item for {srcItem.DisplayNumber}";
else this.Text = "Create Missing Enhanced Item"; else this.Text = "Create Missing Enhanced Item";
_Initializing = false; _Initializing = false;
} }
@@ -90,8 +84,7 @@ namespace Volian.Controls.Library
// convert the data. If so, convert all items within it that can be linked. If not, just link as before. // convert the data. If so, convert all items within it that can be linked. If not, just link as before.
if (_SourceItem.IsProcedure) if (_SourceItem.IsProcedure)
{ {
ItemInfo ii = cbUnlinkedEnhancedItems.SelectedItem as ItemInfo; if (!(cbUnlinkedEnhancedItems.SelectedItem is ItemInfo ii)) return;
if (ii == null) return;
ContentInfoList cil = ContentInfoList.Get16BitEnhancedContents(_SourceItem.ItemID, ii.ItemID, _EnhType); ContentInfoList cil = ContentInfoList.Get16BitEnhancedContents(_SourceItem.ItemID, ii.ItemID, _EnhType);
bool foundSubItem = false; // in returned list, see if there are any sections/steps. If none, don't prompt bool foundSubItem = false; // in returned list, see if there are any sections/steps. If none, don't prompt
foreach (ContentInfo ci in cil) foreach (ContentInfo ci in cil)
@@ -1,12 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
using System.Linq; using System.Linq;
namespace Volian.Controls.Library namespace Volian.Controls.Library
+8 -30
View File
@@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
@@ -16,34 +13,25 @@ namespace Volian.Controls.Library
get { return tc.MySessionInfo; } get { return tc.MySessionInfo; }
set { tc.MySessionInfo = value; } set { tc.MySessionInfo = value; }
} }
private ItemInfo _MyItemInfo;
public ItemInfo MyItemInfo public ItemInfo MyItemInfo { get; set; }
{
get { return _MyItemInfo; }
set { _MyItemInfo = value; }
}
public frmEnhanced(ItemInfo ii) public frmEnhanced(ItemInfo ii)
{ {
_MyItemInfo = ii; MyItemInfo = ii;
InitializeComponent(); InitializeComponent();
SetCaption(); SetCaption();
} }
public void OpenItem() public void OpenItem()
{ {
tc.OpenItem(_MyItemInfo); tc.OpenItem(MyItemInfo);
} }
private void frmEnhanced_Load(object sender, EventArgs e) private void frmEnhanced_Load(object sender, EventArgs e)
{ {
OpenItem(); OpenItem();
} }
public DisplayTabControl MyDisplayTabClntrol
{
get { return this.tc; }
}
private void SetCaption() private void SetCaption()
{ {
FolderInfo myfolder = _MyItemInfo.MyDocVersion.MyFolder; FolderInfo myfolder = MyItemInfo.MyDocVersion.MyFolder;
string sep = ""; string sep = "";
string fPath = ""; string fPath = "";
while (myfolder.FolderID != myfolder.ParentID) while (myfolder.FolderID != myfolder.ParentID)
@@ -57,18 +45,8 @@ namespace Volian.Controls.Library
} }
public class VersionWindow public class VersionWindow
{ {
private int _VersionID; public int VersionID { get; set; }
public int VersionID public int DBId { get; set; }
{
get { return _VersionID; }
set { _VersionID = value; }
}
private int _DBId;
public int DBId
{
get { return _DBId; }
set { _DBId = value; }
}
private Rectangle _MyRectangle; private Rectangle _MyRectangle;
public Rectangle MyRectangle public Rectangle MyRectangle
{ {
@@ -78,12 +56,12 @@ namespace Volian.Controls.Library
public override string ToString() public override string ToString()
{ {
RectangleConverter rc = new RectangleConverter(); RectangleConverter rc = new RectangleConverter();
return string.Format("{0}~{1}", _VersionID, rc.ConvertToString(_MyRectangle)); return string.Format("{0}~{1}", VersionID, rc.ConvertToString(_MyRectangle));
} }
public VersionWindow(string str) public VersionWindow(string str)
{ {
string[] parts = str.Split('~'); string[] parts = str.Split('~');
_VersionID = int.Parse(parts[0]); VersionID = int.Parse(parts[0]);
RectangleConverter rc = new RectangleConverter(); RectangleConverter rc = new RectangleConverter();
_MyRectangle = (Rectangle)rc.ConvertFromString(parts[1]); _MyRectangle = (Rectangle)rc.ConvertFromString(parts[1]);
} }
@@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
@@ -109,7 +107,6 @@ namespace Volian.Controls.Library
// C2019-021 RHM 5/15/2019 Added new methods and properties for Import Word Content // C2019-021 RHM 5/15/2019 Added new methods and properties for Import Word Content
_WordApp.Selection.MoveUp(LBWdUnits.wdParagraph, 1, 0); // Move to previous paragraph _WordApp.Selection.MoveUp(LBWdUnits.wdParagraph, 1, 0); // Move to previous paragraph
_WordApp.Selection.MoveUp(LBWdUnits.wdParagraph, 1, 1); // Select paragraph _WordApp.Selection.MoveUp(LBWdUnits.wdParagraph, 1, 1); // Select paragraph
//_WordApp.Selection.MoveEnd(LBWdUnits.wdCharacter, -1); // Move 1 Character Back
try try
{ {
// C2019-021 Use generic function CopyWordText // C2019-021 Use generic function CopyWordText
@@ -294,34 +291,6 @@ namespace Volian.Controls.Library
// incase user manually closed word // incase user manually closed word
} }
} }
//C2019-021 Remove old method.
//private void btnNextIns_Click(object sender, EventArgs e)
//{
// if (MyStepRTB != null)
// {
// if (MyStepRTB.MyItemInfo.IsSection)
// {
// MyStepRTB.RtbSendKeys("^{DOWN}"); // <Ctrl><down arrow> - next edit window
// MyStepRTB.RtbSendKeys("^+b"); // insert previous
// }
// else
// MyStepRTB.RtbSendKeys("^+i"); // insert next (same type and level)
// MyStepRTB.RtbSendKeys("^v"); // clipboard paste
// Application.DoEvents();
// }
// this.Focus(); // set focus back to this form
//}
//private void btnNextRpl_Click(object sender, EventArgs e)
//{
// if (MyStepRTB != null)
// {
// MyStepRTB.RtbSendKeys("^{DOWN}"); // <Ctrl><down arrow> - next edit window
// MyStepRTB.RtbSendKeys("^a"); // select all
// MyStepRTB.RtbSendKeys("^v"); // clipboard paste
// Application.DoEvents();
// }
// this.Focus(); // set focus back to this form
//}
// C2019-021 New function to replace the PROMS text with the word text and move to the next paragraph in word. // C2019-021 New function to replace the PROMS text with the word text and move to the next paragraph in word.
private void btnReplaceNext_Click(object sender, EventArgs e) private void btnReplaceNext_Click(object sender, EventArgs e)
{ {
@@ -382,7 +351,6 @@ namespace Volian.Controls.Library
if (MyStepRTB.Parent is VlnFlexGrid) if (MyStepRTB.Parent is VlnFlexGrid)
{ {
VlnFlexGrid vg = MyStepRTB.Parent as VlnFlexGrid; VlnFlexGrid vg = MyStepRTB.Parent as VlnFlexGrid;
//vg.FinishEditing(false);
vg.SelectNextCell(); vg.SelectNextCell();
} }
else else
@@ -498,9 +466,6 @@ namespace Volian.Controls.Library
private void btnCurrent_Click(object sender, EventArgs e) private void btnCurrent_Click(object sender, EventArgs e)
{ {
// B2019-108 Corrected curent button code // B2019-108 Corrected curent button code
//_WordApp.Selection.MoveUp(LBWdUnits.wdParagraph, 1, 0); // Select paragraph
//_WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 1, 1); // Select paragraph
//_WordApp.Selection.MoveEnd(LBWdUnits.wdCharacter, -1); // Exclude the last character
try try
{ {
_WordApp.Selection.Cells[1].Range.Select(); _WordApp.Selection.Cells[1].Range.Select();
@@ -514,9 +479,6 @@ namespace Volian.Controls.Library
// C2019-021 Use Generic CopyWordText // C2019-021 Use Generic CopyWordText
CopyWordText(); CopyWordText();
// C2019-021If the word text only contains whitespace skip to next // C2019-021If the word text only contains whitespace skip to next
//if (txbWrdText.Text.TrimEnd("\f\r\n\a".ToCharArray()) == "")
// btnNext_Click(sender, e);
//else
Clipboard.SetText(txbWrdText.Text); Clipboard.SetText(txbWrdText.Text);
} }
catch catch
@@ -524,16 +486,6 @@ namespace Volian.Controls.Library
// Ask RHM what to do here 2/28/2020 JBS // Ask RHM what to do here 2/28/2020 JBS
} }
} }
//private void btnTest_Click(object sender, EventArgs e)
//{
// if (!MoveToNextCell())
// {
// _WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 2, 0);
// _WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 1, 1);
// }
// _WordApp.Activate();
// //int cols = _WordApp.Selection.Tables[1].Columns.Count;
//}
// B2019-108 Show special Characters // B2019-108 Show special Characters
private void txbWrdText_TextChanged(object sender, EventArgs e) private void txbWrdText_TextChanged(object sender, EventArgs e)
@@ -562,9 +514,6 @@ namespace Volian.Controls.Library
private void frmImportWordContents_Activated(object sender, EventArgs e) private void frmImportWordContents_Activated(object sender, EventArgs e)
{ {
// B2019-108 Corrected curent button code // B2019-108 Corrected curent button code
//_WordApp.Selection.MoveUp(LBWdUnits.wdParagraph, 1, 0); // Select paragraph
//_WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 1, 1); // Select paragraph
//_WordApp.Selection.MoveEnd(LBWdUnits.wdCharacter, -1); // Exclude the last character
try try
{ {
if (_WordApp != null || _WordApp.WindowState == LBWdWindowState.wdWindowStateMinimize) if (_WordApp != null || _WordApp.WindowState == LBWdWindowState.wdWindowStateMinimize)
@@ -576,16 +525,6 @@ namespace Volian.Controls.Library
disableButtons(); disableButtons();
} }
} }
//private void btnTest_Click(object sender, EventArgs e)
//{
// if (!MoveToNextCell())
// {
// _WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 2, 0);
// _WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 1, 1);
// }
// _WordApp.Activate();
// //int cols = _WordApp.Selection.Tables[1].Columns.Count;
//}
private void btnTableConvert_Click(object sender, EventArgs e) private void btnTableConvert_Click(object sender, EventArgs e)
{ {
@@ -613,12 +552,11 @@ namespace Volian.Controls.Library
else else
sb.Append(c); sb.Append(c);
} }
MessageBox.Show(ex.Message + "\r\n" + sb.ToString(), ex.GetType().Name); MessageBox.Show($"{ex.Message}\r\n{sb}", ex.GetType().Name);
return; return;
} }
LoadTable2(xd.DocumentElement); LoadTable2(xd.DocumentElement);
int type = 20008; int type = 20008;
ItemInfo myTable;
if(MyStepRTB.MyItemInfo.IsTable) if(MyStepRTB.MyItemInfo.IsTable)
{ {
using( Item itm = MyStepRTB.MyItemInfo.Get()) using( Item itm = MyStepRTB.MyItemInfo.Get())
@@ -633,12 +571,6 @@ namespace Volian.Controls.Library
} }
else else
{ {
//using (Step stp = Step.MakeStep(MyStepRTB.MyItemInfo, null, null, TblFlexGrid.GetSearchableText() , 20008, E_FromType.Table))
//{
// myTable = ItemInfo.Get(stp.ItemID);
// Grid.MakeGrid(stp.MyContent, TblFlexGrid.GetXMLData(), "");
//}
//MyStepRTB.MyItemInfo.MyContent.RefreshContentParts();
EditItem ei = MyStepRTB.Parent as EditItem; EditItem ei = MyStepRTB.Parent as EditItem;
ei.AddChild(E_FromType.Table, 20008, TblFlexGrid); ei.AddChild(E_FromType.Table, 20008, TblFlexGrid);
if (ei != null) ei.SetAllTabs(); if (ei != null) ei.SetAllTabs();
@@ -671,7 +603,6 @@ namespace Volian.Controls.Library
// capture widths for valid cells // capture widths for valid cells
for (int i = 1; i <= tbl.Range.Cells.Count; i++) for (int i = 1; i <= tbl.Range.Cells.Count; i++)
{ {
//LBCell myCell = tbl.Range.Cells[i];
// convert points to pixels and save value // convert points to pixels and save value
int w = (int)(tbl.Range.Cells[i].Width * 8 / 6); int w = (int)(tbl.Range.Cells[i].Width * 8 / 6);
iC = tbl.Range.Cells[i].ColumnIndex - 1; iC = tbl.Range.Cells[i].ColumnIndex - 1;
@@ -774,16 +705,16 @@ namespace Volian.Controls.Library
iC = myCell.ColumnIndex - 1 + offset; iC = myCell.ColumnIndex - 1 + offset;
if (SpanR[iR, iC] > 1) if (SpanR[iR, iC] > 1)
{ {
sXML += " rowspan=\"" + SpanR[iR, iC] + "\""; sXML += $" rowspan=\"{SpanR[iR, iC]}\"";
} }
if (SpanC[iR, iC] > 1) if (SpanC[iR, iC] > 1)
{ {
sXML += " colspan=\"" + SpanC[iR, iC] + "\""; sXML += $" colspan=\"{SpanC[iR, iC]}\"";
offset += SpanC[iR, iC] - 1; offset += SpanC[iR, iC] - 1;
} }
else if (Wcol[iC] > 0) else if (Wcol[iC] > 0)
{ {
sXML += " width=\"" + Wcol[iC] + "\""; sXML += $" width=\"{Wcol[iC]}\"";
Wcol[iC] = Wcol[iC] * -1; Wcol[iC] = Wcol[iC] * -1;
} }
string textalign = ""; string textalign = "";
@@ -815,7 +746,7 @@ namespace Volian.Controls.Library
textalign += "Top"; textalign += "Top";
break; break;
} }
sXML += " textalign=\"" + textalign + "\""; sXML += $" textalign=\"{textalign}\"";
sXML += ">"; sXML += ">";
// select text from current cell // select text from current cell
_WordApp.Selection.Start = myCell.Range.Start; _WordApp.Selection.Start = myCell.Range.Start;
@@ -830,7 +761,6 @@ namespace Volian.Controls.Library
rtbStep.SelectAll(); rtbStep.SelectAll();
Console.WriteLine("RTF before {0}", rtbStep.Rtf); Console.WriteLine("RTF before {0}", rtbStep.Rtf);
Console.WriteLine("RTF after {0}", rtbStep.Rtf); Console.WriteLine("RTF after {0}", rtbStep.Rtf);
// rtbStep.Rtf.Replace("\\f1 P\\f0 ", "\\u10004?"); // check mark within parenthesis
string strp = rtbStep.Rtf.Replace("\\par\r\n", "!!!"); string strp = rtbStep.Rtf.Replace("\\par\r\n", "!!!");
strp = DisplayText.StaticStripRtfCommands(strp, true); strp = DisplayText.StaticStripRtfCommands(strp, true);
Console.WriteLine("RTF clean {0}", strp); Console.WriteLine("RTF clean {0}", strp);
@@ -849,11 +779,9 @@ namespace Volian.Controls.Library
sb.Replace("\x201D", "\"");// Space sb.Replace("\x201D", "\"");// Space
sb.Replace("\x09INITIAL", "");// Space sb.Replace("\x09INITIAL", "");// Space
sb.Replace("\x09_____", ""); // Tab Signoff sb.Replace("\x09_____", ""); // Tab Signoff
//sb.Replace("(P)", "(\\u10004?)"); // check mark within parenthesis
//sb.Replace("\\u9633?", "&#9633;"); //box
} }
// save resulting text in xml structure // save resulting text in xml structure
sXML += "<p>" + ha + sb + "</p></td>"; sXML += $"<p>{ha}{sb}</p></td>";
} }
else else
{ {
@@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using LBOutlookLibrary; using LBOutlookLibrary;
@@ -82,10 +78,8 @@ namespace Volian.Controls.Library
MailMessage mm = new MailMessage(); MailMessage mm = new MailMessage();
mm.From = new MailAddress(SMTPUser); mm.From = new MailAddress(SMTPUser);
mm.To.Add("support@volian.com"); mm.To.Add("support@volian.com");
//mm.To.Add("rmark@epix.net"); mm.Subject = $"PROMS Error Log {DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss")}";
//mm.To.Add("jcbodine@gmail.com"); mm.Body = $"{Header}\r\n\r\n{tbContent.Text}";
mm.Subject = "PROMS Error Log " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss");
mm.Body = Header + "\r\n\r\n" + tbContent.Text;
fs = File.Open(_ErrorLogPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); fs = File.Open(_ErrorLogPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
mm.Attachments.Add(new Attachment(fs, "ErrorLog.txt")); mm.Attachments.Add(new Attachment(fs, "ErrorLog.txt"));
SmtpClient sc = new SmtpClient(SMTPServer); SmtpClient sc = new SmtpClient(SMTPServer);
@@ -109,7 +103,6 @@ namespace Volian.Controls.Library
get get
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
//sb.Append("PROMS\t\tVersion: ");
sb.AppendLine("PROMS"); sb.AppendLine("PROMS");
sb.Append("Version: "); sb.Append("Version: ");
sb.Append(AssemblyVersion); sb.Append(AssemblyVersion);
@@ -118,10 +111,9 @@ namespace Volian.Controls.Library
string connectionString = Database.VEPROMS_Connection; string connectionString = Database.VEPROMS_Connection;
Match mServer = Regex.Match(connectionString, ".*Data Source=([^;]*).*"); Match mServer = Regex.Match(connectionString, ".*Data Source=([^;]*).*");
string server = (mServer.Success) ? mServer.Groups[1].Value : "unknown"; string server = (mServer.Success) ? mServer.Groups[1].Value : "unknown";
if (server.StartsWith(@".\")) server = @"Local \ " + server.Substring(2); if (server.StartsWith(@".\")) server = $@"Local \ {server.Substring(2)}";
string databaseName = string.Format("{0}[SQL:{1:yyMM.ddHH}]", Database.ActiveDatabase, Database.RevDate); string databaseName = string.Format("{0}[SQL:{1:yyMM.ddHH}]", Database.ActiveDatabase, Database.RevDate);
sb.Append(string.Format("SQL Server: {0}", server)); sb.Append(string.Format("SQL Server: {0}", server));
//if (databaseName == null) databaseName = Regex.Replace(connectionString, "^.*Initial Catalog=([^;]*);.*$", "$1", RegexOptions.IgnoreCase);
sb.AppendLine(string.Format("\t\tDatabase: {0}", databaseName)); sb.AppendLine(string.Format("\t\tDatabase: {0}", databaseName));
if (OutlookEmail) if (OutlookEmail)
sb.AppendLine("sent via outlook"); sb.AppendLine("sent via outlook");
@@ -137,13 +129,9 @@ namespace Volian.Controls.Library
LBApplicationClass app = new LBApplicationClass(); LBApplicationClass app = new LBApplicationClass();
LBMailItemClass msg = app.CreateMailItem(); LBMailItemClass msg = app.CreateMailItem();
msg.Recipients.Add("support@volian.com"); msg.Recipients.Add("support@volian.com");
//msg.Recipients.Add("rmark@epix.net"); msg.Subject = $"PROMS Error Log {DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss")}";
//msg.Recipients.Add("jcbodine@gmail.com");
//msg.To = "jcbodine@gmail.com";//"rmark@epix.net";
//msg.Recipients.Add("jcbodine@gmail.com");
msg.Subject = "PROMS Error Log " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss");
msg.BodyFormat = LBOlBodyFormat.olFormatPlain; msg.BodyFormat = LBOlBodyFormat.olFormatPlain;
msg.Body = Header + "\r\n\r\n" + tbContent.Text; msg.Body = $"{Header}\r\n\r\n{tbContent.Text}";
msg.AddAttachment(_ErrorLogPath); msg.AddAttachment(_ErrorLogPath);
msg.Send(); msg.Send();
return true; return true;
@@ -162,7 +150,6 @@ namespace Volian.Controls.Library
get get
{ {
return Application.ProductVersion; return Application.ProductVersion;
//return Assembly.GetExecutingAssembly().GetName().Version.ToString();
} }
} }
} }
@@ -1,9 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
@@ -13,11 +8,6 @@ namespace Volian.Controls.Library
{ {
string _FileName; string _FileName;
RichTextBoxStreamType _RTBType; RichTextBoxStreamType _RTBType;
//public string FileName
//{
// get { return _FileName; }
// set { _FileName = value; }
//}
public string ButtonText public string ButtonText
{ {
get { return buttonX1.Text; } get { return buttonX1.Text; }
@@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace Volian.Controls.Library namespace Volian.Controls.Library
@@ -137,7 +133,6 @@ namespace Volian.Controls.Library
Color c1 = Color.FromArgb(_Trans1, _Color1); Color c1 = Color.FromArgb(_Trans1, _Color1);
Color c2 = Color.FromArgb(_Trans2, _Color2); Color c2 = Color.FromArgb(_Trans2, _Color2);
Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, c1, c2, _GradientAngle); Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, c1, c2, _GradientAngle);
//Brush b2 = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, c2, c2, _GradientAngle);
Pen p = new Pen(ForeColor); Pen p = new Pen(ForeColor);
Brush b2 = p.Brush; Brush b2 = p.Brush;
float smallest = this.Width; float smallest = this.Width;
@@ -152,11 +147,6 @@ namespace Volian.Controls.Library
switch (_MyExpanderStyle) switch (_MyExpanderStyle)
{ {
case ExpanderStyle.Round: case ExpanderStyle.Round:
//e.Graphics.FillEllipse(Brushes.Gray, 0F, 0F, diameter, diameter);
//e.Graphics.DrawRectangle(p, new Rectangle(0, 0, leg * 2 + penWidth * 3, leg * 2 + penWidth * 3));
// Draw a white cross-hair
//e.Graphics.FillRectangle(Brushes.White, 2 * weight , radius - weight, diameter - 4 * weight, weight * 2);
//e.Graphics.FillRectangle(Brushes.White, radius - weight, 2 * weight, weight * 2, diameter - 4 * weight);
if(!Attachment) e.Graphics.FillEllipse(b, 0F, 0F, diameter, diameter); if(!Attachment) e.Graphics.FillEllipse(b, 0F, 0F, diameter, diameter);
DrawInterior(e, b, b2, weight, radius, diameter); DrawInterior(e, b, b2, weight, radius, diameter);
e.Graphics.DrawEllipse(p, 0, 0, diameter, diameter); e.Graphics.DrawEllipse(p, 0, 0, diameter, diameter);
@@ -165,21 +155,13 @@ namespace Volian.Controls.Library
b2.Dispose(); b2.Dispose();
break; break;
case ExpanderStyle.Square: case ExpanderStyle.Square:
//c1 = Color.FromArgb(_Trans1, _Color1);
//c2 = Color.FromArgb(_Trans2, _Color2);
//b = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, c1, c2, _GradientAngle);
int leg = ((ClientRectangle.Width - 3 * penWidth) / 2) - 1; int leg = ((ClientRectangle.Width - 3 * penWidth) / 2) - 1;
if (!Attachment) e.Graphics.FillRectangle(b, new Rectangle(0, 0, leg * 2 + penWidth * 3, leg * 2 + penWidth * 3)); if (!Attachment) e.Graphics.FillRectangle(b, new Rectangle(0, 0, leg * 2 + penWidth * 3, leg * 2 + penWidth * 3));
int center = leg + penWidth; int center = leg + penWidth;
int limit = 2 * (penWidth + leg); int limit = 2 * (penWidth + leg);
p = new Pen(_BorderColor, _PenWidth); p = new Pen(_BorderColor, _PenWidth);
e.Graphics.DrawRectangle(p, new Rectangle(0, 0, leg * 2 + penWidth * 3, leg * 2 + penWidth * 3)); e.Graphics.DrawRectangle(p, new Rectangle(0, 0, leg * 2 + penWidth * 3, leg * 2 + penWidth * 3));
//b = new SolidBrush(this.ForeColor);
DrawInterior(e, b, b2, weight, radius, diameter); DrawInterior(e, b, b2, weight, radius, diameter);
//e.Graphics.FillRectangle(b, new Rectangle(penWidth, center, leg * 2 + penWidth, penWidth));
//if (!_Expanded) e.Graphics.FillRectangle(b, new Rectangle(center, penWidth, penWidth, leg * 2 + penWidth));
////pe.Graphics.DrawLine(p, new Point(penWidth, center), new Point(limit, center));
////if (!Expanded) pe.Graphics.DrawLine(p, new Point(center, penWidth), new Point(center, limit));
p.Dispose(); p.Dispose();
b.Dispose(); b.Dispose();
break; break;
@@ -1,4 +1,3 @@
using System;
using System.ComponentModel; using System.ComponentModel;
using System.Windows.Forms; using System.Windows.Forms;
+1 -1
View File
@@ -11,7 +11,7 @@ namespace Volian.Controls.Library
/// Clean up any resources being used. /// Clean up any resources being used.
/// </summary> /// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
File diff suppressed because it is too large Load Diff
+2 -41
View File
@@ -1,26 +1,12 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
//public delegate void vlnTreeViewEvent(object sender, vlnTreeEventArgs args);
//public delegate bool vlnTreeViewBoolEvent(object sender, vlnTreeEventArgs args);
//public delegate TreeNode vlnTreeViewTreeNodeEvent(object sender, vlnTreeEventArgs args);
//public delegate void vlnTreeViewDDEvent(object sender, System.Windows.Forms.DragEventArgs args);
public partial class vlnTreeView3 : TreeView public partial class vlnTreeView3 : TreeView
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Events #region Events
public event vlnTreeViewEvent NodeSelectionChange; public event vlnTreeViewEvent NodeSelectionChange;
private void OnNodeSelectionChange(object sender, vlnTreeEventArgs args) private void OnNodeSelectionChange(object sender, vlnTreeEventArgs args) => NodeSelectionChange?.Invoke(sender, args);
{
if (NodeSelectionChange != null) NodeSelectionChange(sender, args);
}
#endregion #endregion
#region Business Methods #region Business Methods
#endregion #endregion
@@ -30,33 +16,8 @@ namespace Volian.Controls.Library
InitializeComponent(); InitializeComponent();
base.AfterSelect += new TreeViewEventHandler(tv_AfterSelect); base.AfterSelect += new TreeViewEventHandler(tv_AfterSelect);
} }
private void tv_AfterSelect(object sender, TreeViewEventArgs e) private void tv_AfterSelect(object sender, TreeViewEventArgs e) => OnNodeSelectionChange(sender, new vlnTreeEventArgs(e.Node));
{
OnNodeSelectionChange(sender, new vlnTreeEventArgs(e.Node));
}
#endregion #endregion
private static TreeNode GetTreeNodeFromData(IDataObject datobj)
{
foreach (string s in datobj.GetFormats())
{
try
{
return (TreeNode)datobj.GetData(s);
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("GetTreeNodeFromData", ex);
}
}
return null;
}
private TreeNode Clone(TreeNode tn)
{
TreeNode tmp = (TreeNode)tn.Clone();
ExpandMatch(tmp, tn);
return tmp;
}
private void ExpandMatch(TreeNode tn1, TreeNode tn2) private void ExpandMatch(TreeNode tn1, TreeNode tn2)
{ {
if (tn2.IsExpanded) tn1.Expand(); if (tn2.IsExpanded) tn1.Expand();
+4 -34
View File
@@ -1,22 +1,14 @@
using System; using System.Xml;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
namespace Volian.Print.Library namespace Volian.Print.Library
{ {
public class CPSGen public class CPSGen
{ {
private vlnParagraph _MyVlnParagraph; public vlnParagraph MyVlnParagraph { get; set; }
public vlnParagraph MyVlnParagraph
{
get { return _MyVlnParagraph; }
set { _MyVlnParagraph = value; }
}
public CPSGen(vlnParagraph myParagraph) public CPSGen(vlnParagraph myParagraph)
{ {
_MyVlnParagraph = myParagraph; MyVlnParagraph = myParagraph;
} }
public void Generate(string fileName) public void Generate(string fileName)
{ {
@@ -33,7 +25,6 @@ namespace Volian.Print.Library
AddAttribute(xe, "FromType", fromType); AddAttribute(xe, "FromType", fromType);
AddAttribute(xe, "Ordinal", itm.Ordinal); AddAttribute(xe, "Ordinal", itm.Ordinal);
AddAttribute(xe, "ParentID", (itm.ActiveParent as ItemInfo).ItemID); AddAttribute(xe, "ParentID", (itm.ActiveParent as ItemInfo).ItemID);
//AddAttribute(xe, "Xoffset", para.XOffset);
AddAttribute(xe, "ItemID", itm.ItemID); AddAttribute(xe, "ItemID", itm.ItemID);
AddAttribute(xe, "PreviousID", itm.PreviousID); AddAttribute(xe, "PreviousID", itm.PreviousID);
AddAttribute(xe, "ContentID", itm.ContentID); AddAttribute(xe, "ContentID", itm.ContentID);
@@ -45,41 +36,20 @@ namespace Volian.Print.Library
AddAttribute(xe, "FormatID", itm.MyContent.FormatID); AddAttribute(xe, "FormatID", itm.MyContent.FormatID);
AddAttribute(xe, "Config", itm.MyContent.Config); AddAttribute(xe, "Config", itm.MyContent.Config);
AddAttribute(xe, "Rtf", para.Rtf); AddAttribute(xe, "Rtf", para.Rtf);
//AddParts(xe, "PartsAbove", para.PartsAbove);
//AddParts(xe, "PartsLeft", para.PartsLeft);
//AddParts(xe, "PartsRight", para.PartsRight);
//AddParts(xe, "PartsBelow", para.PartsBelow);
AddChildren(level,0, parent, "ChildrenAbove", para.ChildrenAbove); AddChildren(level,0, parent, "ChildrenAbove", para.ChildrenAbove);
AddChildren(level,0, parent, "ChildrenLeft", para.ChildrenLeft); AddChildren(level,0, parent, "ChildrenLeft", para.ChildrenLeft);
AddChildren(level,0, parent, "ChildrenRight", para.ChildrenRight); AddChildren(level,0, parent, "ChildrenRight", para.ChildrenRight);
AddChildren(level,0, parent, "ChildrenBelow", para.ChildrenBelow); AddChildren(level,0, parent, "ChildrenBelow", para.ChildrenBelow);
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping fromType and name for Debugging")]
private void AddChildren(int level, int fromType, XmlElement parent, string name, vlnParagraphs children) private void AddChildren(int level, int fromType, XmlElement parent, string name, vlnParagraphs children)
{ {
if (children == null || children.Count == 0) return; if (children == null || children.Count == 0) return;
//XmlElement xchildren = xe.OwnerDocument.AppendChild(xe.OwnerDocument.CreateElement(name)) as XmlElement;
foreach(vlnParagraph child in children) foreach(vlnParagraph child in children)
{ {
//XmlElement xechild = xe.ParentNode.AppendChild(xe.OwnerDocument.CreateElement("Item")) as XmlElement;
Generate(level+1,0,parent,child); Generate(level+1,0,parent,child);
} }
} }
//private void AddParts(XmlElement xe, string name, vlnPrintObjects parts)
//{
// if (parts == null || parts.Count == 0) return;
// XmlElement xpart = xe.AppendChild(xe.OwnerDocument.CreateElement(name)) as XmlElement;
// foreach (vlnPrintObject part in parts)
// {
// XmlElement xechild = xpart.AppendChild(xe.OwnerDocument.CreateElement(part.GetType().Name)) as XmlElement;
// Generate(xechild, part);
// }
//}
//private void Generate(XmlElement xe, vlnPrintObject part)
//{
// AddAttribute(xe, "Xoffset", part.XOffset);
// AddAttribute(xe, "Width", part.Width);
// AddAttribute(xe, "Rtf", part.Rtf);
//}
private void AddAttribute(XmlElement xe, string attr, object val) private void AddAttribute(XmlElement xe, string attr, object val)
{ {
if (val == null) return; if (val == null) return;
+100 -199
View File
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@@ -16,92 +15,53 @@ namespace Volian.Print.Library
class CompleteROReport class CompleteROReport
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Dictionary<string, PdfDestination> _MyErrorBookMarks = new Dictionary<string, PdfDestination>(); readonly Headers Hdrs; // Header stack object.
Headers Hdrs; // Header stack object.
RODataFile RO_df = null; RODataFile RO_df = null;
int curheaderlen; int curheaderlen;
string RODataFileName; readonly string RODataFileName;
iTextSharp.text.Document _pdfReportDoc = null; readonly iTextSharp.text.Document _pdfReportDoc;
PdfPTable datatable = null; PdfPTable datatable = null;
private iTextSharp.text.Font _f14; // = pdf.GetFont("Arial Unicode MS", 14, 1, Color.BLACK); public iTextSharp.text.Font F14 { get; set; }
public iTextSharp.text.Font F14 public iTextSharp.text.Font F10 { get; set; }
{
get { return _f14; }
set { _f14 = value; }
}
private iTextSharp.text.Font _f10;
public iTextSharp.text.Font F10 public iTextSharp.text.Font F12 { get; set; }
{
get { return _f10; }
set { _f10 = value; }
}
private iTextSharp.text.Font _f12;
public iTextSharp.text.Font F12 public iTextSharp.text.Font F10Bold { get; set; }
{
get { return _f12; }
set { _f12 = value; }
}
private iTextSharp.text.Font _f10Bold;
public iTextSharp.text.Font F10Bold public iTextSharp.text.Font F12Bold { get; set; }
{
get { return _f10Bold; }
set { _f10Bold = value; }
}
private iTextSharp.text.Font _f12Bold;
public iTextSharp.text.Font F12Bold public bool ConvertCaretToDelta { get; set; } = true;
{
get { return _f12Bold; }
set { _f12Bold = value; }
}
private bool _ConvertCaretToDelta = true; public bool IncludeEmptyROFields { get; set; } = false;
public bool ConvertCaretToDelta public int ROFstID { get; set; }
{ private readonly string ReportTitle = "Complete Referenced Objects Report";
get { return _ConvertCaretToDelta; } private readonly PdfWriter _MyPDFWriter;
set { _ConvertCaretToDelta = value; }
}
private bool _IncludeEmptyROFields = false;
public bool IncludeEmptyROFields
{
get { return _IncludeEmptyROFields; }
set { _IncludeEmptyROFields = value; }
}
private int _ROFstID;
public int ROFstID
{
get { return _ROFstID; }
set { _ROFstID = value; }
}
private string ReportTitle = "Complete Referenced Objects Report";
private PdfWriter _MyPDFWriter;
public CompleteROReport(PdfWriter mypdfwriter, iTextSharp.text.Document document, string dataFileName, bool convertCaretToDelta, bool includeEmptyROFields) public CompleteROReport(PdfWriter mypdfwriter, iTextSharp.text.Document document, string dataFileName, bool convertCaretToDelta, bool includeEmptyROFields)
{ {
Hdrs = new Headers(); Hdrs = new Headers();
_pdfReportDoc = document; _pdfReportDoc = document;
RODataFileName = dataFileName; RODataFileName = dataFileName;
_ConvertCaretToDelta = convertCaretToDelta; ConvertCaretToDelta = convertCaretToDelta;
_MyPDFWriter = mypdfwriter; _MyPDFWriter = mypdfwriter;
_IncludeEmptyROFields = includeEmptyROFields; IncludeEmptyROFields = includeEmptyROFields;
} }
public void StartNewDataTable() public void StartNewDataTable()
{ {
datatable = new PdfPTable(1); datatable = new PdfPTable(1)
datatable.TotalWidth = _pdfReportDoc.PageSize.Width - _pdfReportDoc.LeftMargin - _pdfReportDoc.RightMargin; {
datatable.LockedWidth = true; TotalWidth = _pdfReportDoc.PageSize.Width - _pdfReportDoc.LeftMargin - _pdfReportDoc.RightMargin,
PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, F14)); LockedWidth = true
cell.HorizontalAlignment = Element.ALIGN_CENTER; };
cell.BackgroundColor = Color.WHITE; PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, F14))
cell.BorderColor = Color.WHITE; {
HorizontalAlignment = Element.ALIGN_CENTER,
BackgroundColor = Color.WHITE,
BorderColor = Color.WHITE
};
datatable.AddCell(cell); datatable.AddCell(cell);
datatable.HeaderRows = 3; datatable.HeaderRows = 3;
datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
@@ -113,33 +73,17 @@ namespace Volian.Print.Library
PrintReport(); PrintReport();
RO_df.close(); RO_df.close();
} }
private Dictionary<int, DocOutline> _MyDocOutline = new Dictionary<int, DocOutline>();
internal Dictionary<int, DocOutline> MyDocOutline internal Dictionary<int, DocOutline> MyDocOutline { get; set; } = new Dictionary<int, DocOutline>();
{
get { return _MyDocOutline; }
set { _MyDocOutline = value; }
}
public class DocOutline public class DocOutline
{ {
private PdfOutline _MyOutline; public PdfOutline MyOutline { get; set; }
public PdfOutline MyOutline public string MyHeader { get; set; }
{
get { return _MyOutline; }
set { _MyOutline = value; }
}
private string _MyHeader;
public string MyHeader
{
get { return _MyHeader; }
set { _MyHeader = value; }
}
public DocOutline(PdfOutline outline, string header) public DocOutline(PdfOutline outline, string header)
{ {
_MyHeader = header; MyHeader = header;
_MyOutline = outline; MyOutline = outline;
} }
} }
private string ReplaceLineDrawCharsWithUnicode(string text) private string ReplaceLineDrawCharsWithUnicode(string text)
@@ -167,7 +111,6 @@ namespace Volian.Print.Library
instr = instr.Replace("[RHO]", "\u03C1"); // C2016-018 rho symbol - is being read in as a line draw character, so users need to put "[RHO]" in their text for the rho symbol to print instr = instr.Replace("[RHO]", "\u03C1"); // C2016-018 rho symbol - is being read in as a line draw character, so users need to put "[RHO]" in their text for the rho symbol to print
if (ConvertCaretToDelta) if (ConvertCaretToDelta)
{ {
//char[] ca = instr.ToCharArray(); // for debug
instr = instr.Replace("^", "\u0394"); // delta instr = instr.Replace("^", "\u0394"); // delta
} }
//instr = instr.Replace("\x94", "\u0394"); // delta - the delta symbol is being read in as character x94 //instr = instr.Replace("\x94", "\u0394"); // delta - the delta symbol is being read in as character x94
@@ -188,7 +131,7 @@ namespace Volian.Print.Library
{ {
string tstr = (instr.Substring(idx+uidx, m1.Index - uidx)); string tstr = (instr.Substring(idx+uidx, m1.Index - uidx));
if (tstr.EndsWith(" ")) if (tstr.EndsWith(" "))
tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0"; tstr = $"{tstr.Substring(0, tstr.Length - 1)}\xA0";
chk = new Chunk(tstr, fnt); chk = new Chunk(tstr, fnt);
if (underlineChunk) if (underlineChunk)
chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND);
@@ -244,7 +187,7 @@ namespace Volian.Print.Library
{ {
string tstr = (strChk.Substring(uidx, m1.Index - uidx)); string tstr = (strChk.Substring(uidx, m1.Index - uidx));
if (tstr.EndsWith(" ")) if (tstr.EndsWith(" "))
tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0"; tstr = $"{tstr.Substring(0, tstr.Length - 1)}\xA0";
chk = new Chunk(tstr, fnt); chk = new Chunk(tstr, fnt);
if (underlineChunk) if (underlineChunk)
chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND);
@@ -264,7 +207,7 @@ namespace Volian.Print.Library
{ {
string tstr = strChk.Substring(uidx); string tstr = strChk.Substring(uidx);
if (tstr.EndsWith(" ")) if (tstr.EndsWith(" "))
tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0"; tstr = $"{tstr.Substring(0, tstr.Length - 1)}\xA0";
chk = new Chunk(tstr, fnt); chk = new Chunk(tstr, fnt);
if (underlineChunk) if (underlineChunk)
chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND);
@@ -276,10 +219,7 @@ namespace Volian.Print.Library
return p; return p;
} }
public void AddText(string txt, Font fnt) public void AddText(string txt, Font fnt) => AddText(txt, fnt, Color.BLACK);
{
AddText(txt, fnt, Color.BLACK);
}
public void AddText(string txt, Font fnt, Color txtcolor) public void AddText(string txt, Font fnt, Color txtcolor)
{ {
@@ -289,10 +229,14 @@ namespace Volian.Print.Library
string[] strlst = txt.Split(delim,StringSplitOptions.None); string[] strlst = txt.Split(delim,StringSplitOptions.None);
foreach (string str in strlst) foreach (string str in strlst)
{ {
Font f = new Font(fnt); Font f = new Font(fnt)
f.Color = txtcolor; {
PdfPCell cell = new PdfPCell(ConvertDOSSuperAndSubScripts(str, f)); Color = txtcolor
cell.BorderColor = Color.WHITE; };
PdfPCell cell = new PdfPCell(ConvertDOSSuperAndSubScripts(str, f))
{
BorderColor = Color.WHITE
};
if (strlst.Length > 1) if (strlst.Length > 1)
cell.PaddingBottom = 6; cell.PaddingBottom = 6;
datatable.AddCell(cell); datatable.AddCell(cell);
@@ -301,10 +245,11 @@ namespace Volian.Print.Library
public void AddImage(string filename) public void AddImage(string filename)
{ {
ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(_ROFstID, filename); ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(ROFstID, filename) ?? ROFstInfo.Get(ROFstID).GetROImageByFilename(filename, null);
if (roImage == null) roImage = ROFstInfo.Get(_ROFstID).GetROImageByFilename(filename, null); PdfPCell spaceCell = new PdfPCell
PdfPCell spaceCell = new PdfPCell(); {
spaceCell.BorderColor = Color.WHITE; BorderColor = Color.WHITE
};
datatable.AddCell(spaceCell); datatable.AddCell(spaceCell);
if (roImage != null) if (roImage != null)
{ {
@@ -318,7 +263,7 @@ namespace Volian.Print.Library
it_image = iTextSharp.text.Image.GetInstance(dcnt); it_image = iTextSharp.text.Image.GetInstance(dcnt);
//iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(ROImageInfo.Decompress(roImage.Content, size)); //iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(ROImageInfo.Decompress(roImage.Content, size));
} }
catch (Exception ex) catch (Exception)
{ {
try try
{ {
@@ -342,8 +287,10 @@ namespace Volian.Print.Library
} }
} }
it_image.ScaleToFit(_MyPDFWriter.DirectContent.PdfDocument.PageSize.Width - 144, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height - 216); it_image.ScaleToFit(_MyPDFWriter.DirectContent.PdfDocument.PageSize.Width - 144, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height - 216);
PdfPCell cell = new PdfPCell(it_image); PdfPCell cell = new PdfPCell(it_image)
cell.BorderColor = Color.WHITE; {
BorderColor = Color.WHITE
};
datatable.AddCell(cell); datatable.AddCell(cell);
roImage.Dispose(); roImage.Dispose();
} }
@@ -364,16 +311,20 @@ namespace Volian.Print.Library
if (ConvertCaretToDelta) if (ConvertCaretToDelta)
plotlang = plotlang.Replace("^", "\x394"); // delta plotlang = plotlang.Replace("^", "\x394"); // delta
plotlang = plotlang.Replace("\x7F", "\x394"); //delta plotlang = plotlang.Replace("\x7F", "\x394"); //delta
PdfPCell spaceCell = new PdfPCell(); PdfPCell spaceCell = new PdfPCell
spaceCell.BorderColor = Color.WHITE; {
BorderColor = Color.WHITE
};
datatable.AddCell(spaceCell); datatable.AddCell(spaceCell);
try try
{ {
System.Drawing.RectangleF plotRect = MSWordToPDF.CreatePlot(pngFile, plotlang, 600F, MSWordToPDF.FormForPlotGraphics); System.Drawing.RectangleF plotRect = MSWordToPDF.CreatePlot(pngFile, plotlang, 600F, MSWordToPDF.FormForPlotGraphics);
iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(pngFile); iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(pngFile);
it_image.ScaleToFit(_MyPDFWriter.DirectContent.PdfDocument.PageSize.Width - 144, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height - 216); it_image.ScaleToFit(_MyPDFWriter.DirectContent.PdfDocument.PageSize.Width - 144, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height - 216);
PdfPCell cell = new PdfPCell(it_image); PdfPCell cell = new PdfPCell(it_image)
cell.BorderColor = Color.WHITE; {
BorderColor = Color.WHITE
};
datatable.AddCell(cell); datatable.AddCell(cell);
} }
catch (Exception e) catch (Exception e)
@@ -386,18 +337,12 @@ namespace Volian.Print.Library
} }
private string processingRO = ""; private string processingRO = "";
private string _MyROID = null;
public string MyROID public string MyROID { get; set; } = null;
{
get { return _MyROID; }
set { _MyROID = value; }
}
public void PrintReport() public void PrintReport()
{ {
bool StopPrinting = false; bool StopPrinting = false;
bool UserTerminate = false;
Int16 iRecType = 0;
VlnStatusBar showStatBar = new VlnStatusBar("Complete RO Report"); VlnStatusBar showStatBar = new VlnStatusBar("Complete RO Report");
try try
{ {
@@ -405,6 +350,7 @@ namespace Volian.Print.Library
{ {
showStatBar.BarMax = (int)RO_df.GetFileLength(); showStatBar.BarMax = (int)RO_df.GetFileLength();
showStatBar.StatMsg = "Creating Report"; showStatBar.StatMsg = "Creating Report";
short iRecType;
// Loop until either printing is aborted or end of file. // Loop until either printing is aborted or end of file.
while (!StopPrinting && (iRecType = RO_df.ReadInteger16()) != -1) while (!StopPrinting && (iRecType = RO_df.ReadInteger16()) != -1)
{ {
@@ -454,7 +400,7 @@ namespace Volian.Print.Library
case 104: // Multi End case 104: // Multi End
break; break;
case 0: // nothing was entered in that field case 0: // nothing was entered in that field
if (_IncludeEmptyROFields) if (IncludeEmptyROFields)
NoInformatEntered(); NoInformatEntered();
break; break;
case 255: case 255:
@@ -466,12 +412,11 @@ namespace Volian.Print.Library
//Console.WriteLine("----------------------------------------------"); //Console.WriteLine("----------------------------------------------");
break; break;
default: // Problem default: // Problem
//Console.WriteLine("Record Type: {0} Unrecognized record type", iRecType);
StopPrinting = true; StopPrinting = true;
UserTerminate = true;
MessageBox.Show(string.Format("Unrecognized record type [{0}]", iRecType), "Error Creating Complete RO Report", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(string.Format("Unrecognized record type [{0}]", iRecType), "Error Creating Complete RO Report", MessageBoxButtons.OK, MessageBoxIcon.Error);
break; break;
}; }
;
} }
} }
else else
@@ -502,20 +447,22 @@ namespace Volian.Print.Library
// if there is lenght then we are in the mist of processing an RO // if there is lenght then we are in the mist of processing an RO
string headers = erMsg; string headers = erMsg;
for (int iLoop = 0; iLoop < Hdrs.HdrCnt; iLoop++) for (int iLoop = 0; iLoop < Hdrs.HdrCnt; iLoop++)
headers += Hdrs.strHdrs[iLoop] + "\n "; headers += $"{Hdrs.strHdrs[iLoop]}\n ";
if (processingRO.Length > 0) if (processingRO.Length > 0)
headers += processingRO; headers += processingRO;
if (erMsg2 != null && erMsg2.Length > 0) if (erMsg2 != null && erMsg2.Length > 0)
headers += "\n" + erMsg2; headers += "\n" + erMsg2;
//MessageBox.Show(headers, erMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
if (e != null) if (e != null)
_MyLog.Error(headers, e); _MyLog.Error(headers, e);
else else
_MyLog.Error(headers); _MyLog.Error(headers);
#pragma warning disable IDE0059 // Unnecessary assignment of a value - for debugging
PdfOutline outl = new PdfOutline(MyErrorOutline, MyPdfDestPage, processingRO.Length > 0 ? processingRO : "Problem Reading Header"); PdfOutline outl = new PdfOutline(MyErrorOutline, MyPdfDestPage, processingRO.Length > 0 ? processingRO : "Problem Reading Header");
#pragma warning restore IDE0059 // Unnecessary assignment of a value
//DestSample(outl); //DestSample(outl);
} }
//For Debugging/Testing
//private void DestSample(PdfOutline outl) //private void DestSample(PdfOutline outl)
//{ //{
// new PdfOutline(outl, new PdfDestination(PdfDestination.FIT), "FIT"); // new PdfOutline(outl, new PdfDestination(PdfDestination.FIT), "FIT");
@@ -531,27 +478,20 @@ namespace Volian.Print.Library
public void AddErrorBookmarks() public void AddErrorBookmarks()
{ {
if (_MyErrorOutline == null) return; if (_MyErrorOutline == null) return;
//if (_MyErrorBookMarks.Count == 0) return;
//PdfOutline outline = null;
//foreach (string key in _MyErrorBookMarks.Keys)
//{
// if (outline == null) outline = new PdfOutline(_MyPDFWriter.DirectContent.RootOutline, _MyErrorBookMarks[key], "Errors");
// new PdfOutline(outline, _MyErrorBookMarks[key], key);
//}
string emsg = "A Bookmark grouping named \"Errors\" was added to the PDF.\n\n Click on the RO in this grouping to jump to the report page which will contain an error message.\n\nThe error were also recorded in the PROMS error log."; string emsg = "A Bookmark grouping named \"Errors\" was added to the PDF.\n\n Click on the RO in this grouping to jump to the report page which will contain an error message.\n\nThe error were also recorded in the PROMS error log.";
MessageBox.Show(emsg, "Errors Found Creating Report", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(emsg, "Errors Found Creating Report", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
public void Multiple() public void Multiple()
{ {
Int16 typ, i, j, nw = 0; short typ, i, j;
string str, sep; string str, sep;
string buff = ""; string buff = "";
int[] width; int[] width;
LastHeader(); LastHeader();
sep = ""; sep = "";
// nw - number of fields // nw - number of fields
nw = RO_df.ReadInteger16(); short nw = RO_df.ReadInteger16();
// allocate space for widths // allocate space for widths
width = new int[nw]; width = new int[nw];
// loop through and load field widths and names // loop through and load field widths and names
@@ -645,7 +585,7 @@ namespace Volian.Print.Library
//Console.WriteLine("Set Header"); //Console.WriteLine("Set Header");
// Get the number of header records // Get the number of header records
Int16 iNewCnt = RO_df.ReadInteger16(); short iNewCnt = RO_df.ReadInteger16();
//Console.WriteLine("Num Header Records: {0}", iNewCnt); //Console.WriteLine("Num Header Records: {0}", iNewCnt);
@@ -676,16 +616,11 @@ namespace Volian.Print.Library
bool _LastWasName = false;//B2016-251 Don't change underscore to underline to Name value bool _LastWasName = false;//B2016-251 Don't change underscore to underline to Name value
public void PushHeader() public void PushHeader()
{ {
//if (m_pPrinterOut->Row() > 55)
//// m_pPrinterOut->newpage();
//pdfReportDoc.NewPage();
string pTmp = RO_df.ReadText(); string pTmp = RO_df.ReadText();
//Console.WriteLine("PH[{0}]", pTmp); //Console.WriteLine("PH[{0}]", pTmp);
curheaderlen = pTmp.Length; curheaderlen = pTmp.Length;
_LastWasName = (pTmp == "Name");//B2016-251 Don't change underscore to underline to Name value _LastWasName = (pTmp == "Name");//B2016-251 Don't change underscore to underline to Name value
//Hdrs.strHdrs[Hdrs.HdrCnt] = pTmp;
Hdrs.strHdrs.Add(pTmp); Hdrs.strHdrs.Add(pTmp);
//Hdrs.repeatCount[Hdrs.HdrCnt] = 2;
Hdrs.repeatCount.Add(2); Hdrs.repeatCount.Add(2);
Hdrs.HdrCnt++; Hdrs.HdrCnt++;
Hdrs.printedLastHeader = false; Hdrs.printedLastHeader = false;
@@ -704,15 +639,12 @@ namespace Volian.Print.Library
// if the last header was pushed on header list // if the last header was pushed on header list
// print eject the page if the page ran out, and // print eject the page if the page ran out, and
// print the header with "none". // print the header with "none".
//if (m_pPrinterOut->Row() > 55)
// m_pPrinterOut->NewPage();
LastHeader(); LastHeader();
//m_pPrinterOut->PutLine(0, "none"); //m_pPrinterOut->PutLine(0, "none");
//m_pPrinterOut->NewLine(1); //m_pPrinterOut->NewLine(1);
} }
// Remove the header // Remove the header
Hdrs.HdrCnt--; Hdrs.HdrCnt--;
//Hdrs.strHdrs[Hdrs.HdrCnt] = null;
Hdrs.strHdrs.RemoveAt(Hdrs.HdrCnt); Hdrs.strHdrs.RemoveAt(Hdrs.HdrCnt);
Hdrs.repeatCount.RemoveAt(Hdrs.HdrCnt); Hdrs.repeatCount.RemoveAt(Hdrs.HdrCnt);
@@ -722,7 +654,6 @@ namespace Volian.Print.Library
public void RROBegin() public void RROBegin()
{ {
//m_pPrinterOut->NewPage();
//Console.WriteLine("RRO Begin"); //Console.WriteLine("RRO Begin");
//Console.WriteLine("----------------------------------------------"); //Console.WriteLine("----------------------------------------------");
// Start of a new RO, print out the headers // Start of a new RO, print out the headers
@@ -730,12 +661,11 @@ namespace Volian.Print.Library
{ {
if (!MyDocOutline.ContainsKey(iLoop) || MyDocOutline[iLoop].MyHeader != Hdrs.strHdrs[iLoop]) if (!MyDocOutline.ContainsKey(iLoop) || MyDocOutline[iLoop].MyHeader != Hdrs.strHdrs[iLoop])
{ {
PdfOutline parentOutline = null; PdfOutline parentOutline;
if (iLoop == 0) if (iLoop == 0)
parentOutline = MyRootOutline;//_MyPDFWriter.DirectContent.RootOutline; parentOutline = MyRootOutline;//_MyPDFWriter.DirectContent.RootOutline;
else else
parentOutline = MyDocOutline[iLoop - 1].MyOutline; parentOutline = MyDocOutline[iLoop - 1].MyOutline;
//pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
AddOutlineLevel(parentOutline, iLoop, Hdrs.strHdrs[iLoop], MyPdfDestPage); AddOutlineLevel(parentOutline, iLoop, Hdrs.strHdrs[iLoop], MyPdfDestPage);
} }
// Change double underscore to spaces in header text // Change double underscore to spaces in header text
@@ -748,18 +678,11 @@ namespace Volian.Print.Library
{ {
// FITH was acting strange and shifting towards bottom of the page as the number of pages increased // FITH was acting strange and shifting towards bottom of the page as the number of pages increased
//Console.WriteLine("Top = {0}, {1}", _Top, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height); //Console.WriteLine("Top = {0}, {1}", _Top, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
//return new PdfDestination(PdfDestination.FITH, _Top);//_MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
return new PdfDestination(PdfDestination.XYZ, 0, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height, 1.5f); return new PdfDestination(PdfDestination.XYZ, 0, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height, 1.5f);
} }
} }
public PdfDestination MyPdfDestPage public PdfDestination MyPdfDestPage => new PdfDestination(PdfDestination.FITV, 0);
{
get
{
return new PdfDestination(PdfDestination.FITV,0);
}
}
private PdfOutline _MyErrorOutline = null; private PdfOutline _MyErrorOutline = null;
@@ -787,7 +710,6 @@ namespace Volian.Print.Library
return _MyRootOutline; return _MyRootOutline;
} }
} }
private PdfDestination pdfDest = null;
private void AddOutlineLevel(PdfOutline parentOutline, int iLoop, string hdr, PdfDestination pdfDest) private void AddOutlineLevel(PdfOutline parentOutline, int iLoop, string hdr, PdfDestination pdfDest)
{ {
if (MyDocOutline.ContainsKey(iLoop)) if (MyDocOutline.ContainsKey(iLoop))
@@ -798,7 +720,6 @@ namespace Volian.Print.Library
public void RROEnd() public void RROEnd()
{ {
//m_pPrinterOut->PageEnd();
// Remove any headers that are left over // Remove any headers that are left over
//Console.WriteLine("{0} headers cleaned up.", Hdrs.HdrCnt); //Console.WriteLine("{0} headers cleaned up.", Hdrs.HdrCnt);
//Console.WriteLine("RRO End"); //Console.WriteLine("RRO End");
@@ -843,7 +764,7 @@ namespace Volian.Print.Library
public void Text() public void Text()
{ {
// Get the lenght of the text string and read it in // Get the lenght of the text string and read it in
Int16 iValue = RO_df.ReadInteger16(); short iValue = RO_df.ReadInteger16();
string szStr = ""; string szStr = "";
// B2016-247 If size is zero it is an empty string. // B2016-247 If size is zero it is an empty string.
if (iValue > 0) if (iValue > 0)
@@ -867,11 +788,9 @@ namespace Volian.Print.Library
if (isXYPlot || (iValue + curheaderlen) > 72 || (szStr.IndexOf('\r') != -1)) if (isXYPlot || (iValue + curheaderlen) > 72 || (szStr.IndexOf('\r') != -1))
{ {
// If the lenght of the string plus the field title is greater // If the length of the string plus the field title is greater
// than 72 characters or has a carriage return character in it // than 72 characters or has a carriage return character in it
// then output the text on multiple lines // then output the text on multiple lines
//if (m_pPrinterOut->Row() > 55)
// m_pPrinterOut->newpage();
// the header goes on its own line // the header goes on its own line
cell.AddElement(p); cell.AddElement(p);
@@ -891,10 +810,6 @@ namespace Volian.Print.Library
datatable.AddCell(cell); datatable.AddCell(cell);
//m_pPrinterOut->SetNumberOfNewLines(0); //m_pPrinterOut->SetNumberOfNewLines(0);
//m_pPrinterOut->putline(0, temp); //m_pPrinterOut->putline(0, temp);
//if (m_pPrinterOut->Row() + 1 > 55)
// Hdrs.repeatCount[Hdrs.HdrCnt] = 1;
//else
// m_pPrinterOut->newline(1);
} }
//Console.WriteLine("Text"); //Console.WriteLine("Text");
//Console.WriteLine("Value: {0}", iValue); //Console.WriteLine("Value: {0}", iValue);
@@ -906,8 +821,9 @@ namespace Volian.Print.Library
{ {
// use the key field as the PDF bookbark // use the key field as the PDF bookbark
string szStr = RO_df.ReadText(); string szStr = RO_df.ReadText();
//PdfDestination pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height); #pragma warning disable IDE0059 // Unnecessary assignment of a value - For Debugging
PdfOutline outl = new PdfOutline(MyDocOutline[Hdrs.HdrCnt - 1].MyOutline, MyPdfDestTop, szStr); PdfOutline outl = new PdfOutline(MyDocOutline[Hdrs.HdrCnt - 1].MyOutline, MyPdfDestTop, szStr);
#pragma warning restore IDE0059 // Unnecessary assignment of a value
//DestSample(outl); //DestSample(outl);
return szStr; return szStr;
//Console.WriteLine("Key Field"); //Console.WriteLine("Key Field");
@@ -918,6 +834,7 @@ namespace Volian.Print.Library
{ {
// use the key field as the PDF bookbark // use the key field as the PDF bookbark
string szStr = RO_df.ReadText(); string szStr = RO_df.ReadText();
//For Dubugging
//PdfDestination pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height); //PdfDestination pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
//PdfOutline outl = new PdfOutline(MyDocOutline[Hdrs.HdrCnt - 1].MyOutline, MyPdfDestTop, szStr); //PdfOutline outl = new PdfOutline(MyDocOutline[Hdrs.HdrCnt - 1].MyOutline, MyPdfDestTop, szStr);
//DestSample(outl); //DestSample(outl);
@@ -931,8 +848,10 @@ namespace Volian.Print.Library
public void ImageFile() public void ImageFile()
{ {
string fn = RO_df.ReadText(); string fn = RO_df.ReadText();
Int16 ht = RO_df.ReadInteger16(); #pragma warning disable IDE0059 // Unnecessary assignment of a value - for Debugging
Int16 wd = RO_df.ReadInteger16(); short ht = RO_df.ReadInteger16();
short wd = RO_df.ReadInteger16();
#pragma warning restore IDE0059 // Unnecessary assignment of a value
//m_pPrinterOut->PrintImage(fn, wd, ht); //m_pPrinterOut->PrintImage(fn, wd, ht);
//Console.WriteLine("ImageFile"); //Console.WriteLine("ImageFile");
@@ -946,10 +865,9 @@ namespace Volian.Print.Library
public void XYPlot() public void XYPlot()
{ {
// Get the lenght of the text string and read it in // Get the lenght of the text string and read it in
Int16 iValue = RO_df.ReadInteger16(); short iValue = RO_df.ReadInteger16();
string szStr = RO_df.ReadText(iValue); string szStr = RO_df.ReadText(iValue);
string temp = szStr; Chunk chk = LastHeader();
Chunk chk = LastHeader(); // = new Chunk(m.Value, fnt);
Phrase p = new Phrase(); Phrase p = new Phrase();
PdfPCell cell = new PdfPCell(); PdfPCell cell = new PdfPCell();
p.Add(chk); // add the header chunk p.Add(chk); // add the header chunk
@@ -997,7 +915,6 @@ namespace Volian.Print.Library
chk = new Chunk(hdrtxt, F10Bold); chk = new Chunk(hdrtxt, F10Bold);
Hdrs.printedLastHeader = true; Hdrs.printedLastHeader = true;
return chk; return chk;
//m_pPrinterOut->LastHeader();
} }
}// end CompSumROReport }// end CompSumROReport
@@ -1005,9 +922,7 @@ namespace Volian.Print.Library
public class Headers public class Headers
{ {
//public string[] strHdrs;
public List<string> strHdrs; public List<string> strHdrs;
// public int[] repeatCount;
public int HdrCnt; public int HdrCnt;
public List<int> repeatCount; public List<int> repeatCount;
public bool printedLastHeader; public bool printedLastHeader;
@@ -1022,8 +937,8 @@ namespace Volian.Print.Library
public class RODataFile public class RODataFile
{ {
FileStream fs = null; readonly FileStream fs = null;
BinaryReader br = null; readonly BinaryReader br = null;
public RODataFile(string fname) public RODataFile(string fname)
{ {
fs = new FileStream(fname,FileMode.Open); fs = new FileStream(fname,FileMode.Open);
@@ -1034,14 +949,8 @@ namespace Volian.Print.Library
br.Close(); br.Close();
fs.Close(); fs.Close();
} }
public long GetFileLength() public long GetFileLength() => fs.Length;
{ public long GetFilePointerPosition() => fs.Position;
return fs.Length;
}
public long GetFilePointerPosition()
{
return fs.Position;
}
// Read an integer value from the data file // Read an integer value from the data file
public Int16 ReadInteger16() public Int16 ReadInteger16()
{ {
@@ -1059,14 +968,11 @@ namespace Volian.Print.Library
// The calling program is responsible for free it // The calling program is responsible for free it
// with the "delete" operator. // with the "delete" operator.
public string ReadText() public string ReadText() => ReadText(-1);
{
return ReadText(-1);
}
public string ReadText(Int16 i16CharCount) public string ReadText(Int16 i16CharCount)
{ {
Int16 i16DataSize; short i16DataSize;
if (i16CharCount == -1) if (i16CharCount == -1)
i16DataSize = ReadInteger16(); i16DataSize = ReadInteger16();
else else
@@ -1082,15 +988,14 @@ namespace Volian.Print.Library
for (int i = 0; i < i16DataSize; i++) for (int i = 0; i < i16DataSize; i++)
str += Convert.ToChar(charbuff[i]).ToString(); str += Convert.ToChar(charbuff[i]).ToString();
return (str); return (str);
//return (Encoding.ASCII.GetString(charbuff, 0, i16DataSize)); // this didn't handle line draw chars
} }
} }
// Search through the file to find the next record // Search through the file to find the next record
public long NextRecord() public long NextRecord()
{ {
Int16 iType; short iType;
Int16 RECORD_START = 255; short RECORD_START = 255;
// While not the next record and not end of file get the next meta item // While not the next record and not end of file get the next meta item
while ((iType = ReadInteger16()) != RECORD_START && iType != -1) while ((iType = ReadInteger16()) != RECORD_START && iType != -1)
{ {
@@ -1101,9 +1006,8 @@ namespace Volian.Print.Library
// Get the next meta item and discard the data // Get the next meta item and discard the data
public long NextItem() public long NextItem()
{ {
string pTmp; short iRecType = ReadInteger16();
Int16 iRecType = ReadInteger16(); short iNewCnt;
Int16 iNewCnt;
int iLoop; int iLoop;
switch (iRecType) switch (iRecType)
{ {
@@ -1112,8 +1016,7 @@ namespace Volian.Print.Library
for (iLoop = 0; iLoop < iNewCnt; iLoop++) for (iLoop = 0; iLoop < iNewCnt; iLoop++)
{ {
ReadInteger16(); ReadInteger16();
pTmp = ReadText(); _ = ReadText();
//delete pTmp;
} }
break; break;
case 2: // Push Header case 2: // Push Header
@@ -1121,8 +1024,7 @@ namespace Volian.Print.Library
case 7: // Key Field case 7: // Key Field
case 100: // Text Field case 100: // Text Field
case 101: // Plot Field case 101: // Plot Field
pTmp = ReadText(); _ = ReadText();
//delete pTmp;
break; break;
case 3: // Pop Header case 3: // Pop Header
case 4: // RRO Begin case 4: // RRO Begin
@@ -1133,8 +1035,7 @@ namespace Volian.Print.Library
// Do nothing // Do nothing
break; break;
case 102: // Image Field case 102: // Image Field
pTmp = ReadText(); _ = ReadText();
//delete pTmp;
ReadInteger16(); ReadInteger16();
ReadInteger16(); ReadInteger16();
break; break;
+15 -37
View File
@@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Text; using System.Text;
using System.Drawing;
using LBWordLibrary; using LBWordLibrary;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@@ -10,12 +8,12 @@ namespace Volian.Print.Library
{ {
public class ContinuousActionSummary : IDisposable public class ContinuousActionSummary : IDisposable
{ {
private LBApplicationClass _WordApp; private readonly LBApplicationClass _WordApp;
private LBDocumentClass _WordDoc; private readonly LBDocumentClass _WordDoc;
private LBSelection _WordSel; private readonly LBSelection _WordSel;
private LBTable _WordTbl; private LBTable _WordTbl;
private const string TheQuickBrownFox = "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog."; private const string TheQuickBrownFox = "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.";
private VE_Font _pkFont; private readonly VE_Font _pkFont;
public ContinuousActionSummary() public ContinuousActionSummary()
{ {
_WordApp = new LBApplicationClass(); _WordApp = new LBApplicationClass();
@@ -41,7 +39,6 @@ namespace Volian.Print.Library
_WordApp = new LBApplicationClass(); _WordApp = new LBApplicationClass();
_WordDoc = _WordApp.Documents.Add(); _WordDoc = _WordApp.Documents.Add();
_WordSel = _WordApp.Selection; _WordSel = _WordApp.Selection;
//_WordApp.Visible = true;
_pkFont = pkFont; _pkFont = pkFont;
AddTable(); AddTable();
AddHeader(doingTimeCriticalSummary); // F2022-024 pass flag when creating a Time Critical Action Summary report AddHeader(doingTimeCriticalSummary); // F2022-024 pass flag when creating a Time Critical Action Summary report
@@ -72,11 +69,11 @@ namespace Volian.Print.Library
if (txtPageNum == "") txtPageNum = (pghC.MyParagraph.MyItemInfo.PageNumber + 1).ToString(); if (txtPageNum == "") txtPageNum = (pghC.MyParagraph.MyItemInfo.PageNumber + 1).ToString();
AddContinuousAction(NoteCautionTab, GetContActStepText(pghC.MyParagraph.MyItemInfo), doneStr, txtPageNum, 0, 0); AddContinuousAction(NoteCautionTab, GetContActStepText(pghC.MyParagraph.MyItemInfo), doneStr, txtPageNum, 0, 0);
} }
string stpTab = pgh.MyParagraph.MyItemInfo.MyTab.CleanText.Trim() + " "; // this is either the High Level step tab or the sub-step tab string stpTab = $"{pgh.MyParagraph.MyItemInfo.MyTab.CleanText.Trim()} "; // this is either the High Level step tab or the sub-step tab
float preTabLen = 0; float preTabLen = 0;
if (pgh.MyParagraph.MyItemInfo.IsNote || pgh.MyParagraph.MyItemInfo.IsCaution) // only the caution and/or note is on the CAS - high level step not selected if (pgh.MyParagraph.MyItemInfo.IsNote || pgh.MyParagraph.MyItemInfo.IsCaution) // only the caution and/or note is on the CAS - high level step not selected
{ {
stpTab = string.Format("{0} ", hlsii.MyTab.Text.Trim()) + " " + stpTab; stpTab = $"{hlsii.MyTab.Text.Trim()} {stpTab}";
} }
else if (!pgh.MyParagraph.MyItemInfo.IsHigh) // if the high level step was not included, adjust the tab for a sub-step/RNO else if (!pgh.MyParagraph.MyItemInfo.IsHigh) // if the high level step was not included, adjust the tab for a sub-step/RNO
{ {
@@ -98,13 +95,13 @@ namespace Volian.Print.Library
prevItemInfo = prevItemInfo.MyParent; prevItemInfo = prevItemInfo.MyParent;
} }
if (_FirstLine) // the first of a CAS on the report include the High Level Step tab if (_FirstLine) // the first of a CAS on the report include the High Level Step tab
sbTabPre.Insert(0, (hlsii != null) ? hlsii.MyTab.Text.Trim() + " " : ""); sbTabPre.Insert(0, (hlsii != null) ? $"{hlsii.MyTab.Text.Trim()} " : "");
tabPre = sbTabPre.ToString(); tabPre = sbTabPre.ToString();
if (!_FirstLine) // if not the first line we indent the size of high level step tab if (!_FirstLine) // if not the first line we indent the size of high level step tab
preTabLen = GetTextWidth(hlsii.MyTab.Text.Trim() + " ") / 72f; preTabLen = GetTextWidth($"{hlsii.MyTab.Text.Trim()} ") / 72f;
if (pgh.MyParagraph.MyItemInfo.IsInRNO) if (pgh.MyParagraph.MyItemInfo.IsInRNO)
{ {
stpTab = stpTab.TrimEnd() + "[R] "; stpTab = $"{stpTab.TrimEnd()}[R] ";
} }
stpTab = tabPre + stpTab; stpTab = tabPre + stpTab;
} }
@@ -135,7 +132,7 @@ namespace Volian.Print.Library
string stpTab = cpgh.MyParagraph.MyItemInfo.MyTab.CleanText.Trim() + (cpgh.MyParagraph.MyItemInfo.IsInRNO ? "[R] ": " "); string stpTab = cpgh.MyParagraph.MyItemInfo.MyTab.CleanText.Trim() + (cpgh.MyParagraph.MyItemInfo.IsInRNO ? "[R] ": " ");
if (cpgh.MyParagraph.MyItemInfo.IsNote || cpgh.MyParagraph.MyItemInfo.IsCaution) if (cpgh.MyParagraph.MyItemInfo.IsNote || cpgh.MyParagraph.MyItemInfo.IsCaution)
{ {
stpTab = string.Format("{0} ", cpgh.MyParagraph.MyParent.MyTab.Text.Trim()) + " " + stpTab; stpTab = $"{string.Format("{0} ", cpgh.MyParagraph.MyParent.MyTab.Text.Trim())} {stpTab}";
} }
ItemInfo prevItmInfo = cpgh.MyParagraph.MyItemInfo.MyParent; ItemInfo prevItmInfo = cpgh.MyParagraph.MyItemInfo.MyParent;
// F2026-001 the while loop below will add the sub-step's parent tab if applicable // F2026-001 the while loop below will add the sub-step's parent tab if applicable
@@ -154,17 +151,7 @@ namespace Volian.Print.Library
} }
} }
private string GetContActStepText(ItemInfo myItemInfo) private string GetContActStepText(ItemInfo myItemInfo) => myItemInfo.FormattedDisplayText;
{
//string conActSumText = "";
//StepConfig sc = myItemInfo.MyConfig as StepConfig;
//if (sc != null && sc.Step_AlternateContActSumText != null)
// conActSumText = sc.Step_AlternateContActSumText;
//if (conActSumText == "")
// conActSumText = myItemInfo.FormattedDisplayText;
//return conActSumText;
return myItemInfo.FormattedDisplayText;
}
private void AddNotesOrCautions(pkParagraph pgh, int level) private void AddNotesOrCautions(pkParagraph pgh, int level)
{ {
@@ -305,7 +292,7 @@ namespace Volian.Print.Library
} }
_FirstLine = false; _FirstLine = false;
} }
static Regex rgx = new Regex(@"\\(b|ul|up[1-9]|dn0|up0|dn[1-9]|b0|ulnone)( |$|(?=\\))"); static readonly Regex rgx = new Regex(@"\\(b|ul|up[1-9]|dn0|up0|dn[1-9]|b0|ulnone)( |$|(?=\\))");
private void WriteRTF(string text) private void WriteRTF(string text)
{ {
Match m = rgx.Match(text); Match m = rgx.Match(text);
@@ -363,17 +350,8 @@ namespace Volian.Print.Library
_WordSel.ParagraphFormat.Alignment = hAlign; _WordSel.ParagraphFormat.Alignment = hAlign;
_WordSel.Cells.VerticalAlignment = vAlign; _WordSel.Cells.VerticalAlignment = vAlign;
} }
private void Advance(int count) private void Advance(int count) => _WordSel.MoveRight(LBWdUnits.wdCell, count, false);
{ private void Advance() => Advance(1);
_WordSel.MoveRight(LBWdUnits.wdCell, count, false); public void Dispose() => _WordApp.Quit(false);
}
private void Advance()
{
Advance(1);
}
public void Dispose()
{
_WordApp.Quit(false);
}
} }
} }
@@ -0,0 +1,8 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
+82 -515
View File
@@ -2,12 +2,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using C1.Win.C1FlexGrid; using C1.Win.C1FlexGrid;
using System.IO;
using Itenso.Rtf; using Itenso.Rtf;
using Itenso.Rtf.Parser;
using Itenso.Rtf.Interpreter;
using Itenso.Rtf.Support; using Itenso.Rtf.Support;
using Volian.Print.Library;
using Volian.Controls.Library; using Volian.Controls.Library;
using iTextSharp.text; using iTextSharp.text;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
@@ -19,137 +15,35 @@ namespace Volian.Print.Library
#region Settings // RHM20150429 - Table Scrunch #region Settings // RHM20150429 - Table Scrunch
public partial class vlnTable public partial class vlnTable
{ {
private string _DebugInfo = null; // RHM20150429 - Table Scrunch public string DebugInfo { get; set; } = null;
public string DebugInfo public int ItemID { get; set; } = 0;
{ public bool ShowDetails { get; set; } = false;
get { return _DebugInfo; } public bool IsTooBig { get; set; } = false;
set { _DebugInfo = value; }
}
private int _ItemID = 0;
public int ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
private bool _ShowDetails = false;
public bool ShowDetails
{
get { return _ShowDetails; }
set { _ShowDetails = value; }
}
private bool _IsTooBig = false;
public bool IsTooBig
{
get { return _IsTooBig; }
set { _IsTooBig = value; }
}
}
public partial class vlnCells
{
private static float YAdjust_HContent = 4; // 4
private float YAdjust_SpacingAfter
{
get
{
return 8-8*MyTable.Adjustment;//0; // 8
}
}
} }
public partial class vlnCell public partial class vlnCell
{ {
#region Log4Net #region Log4Net
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion #endregion
public bool ShowDetails public bool ShowDetails => MyTable.ShowDetails;
{ get { return MyTable.ShowDetails; } } private static readonly float YAdjust_h = 0;
private static float YAdjust_h = 0; // 0
private float YAdjust_TextLocation
{
get
{
return 4 - 4 * MyTable.Adjustment; ;//0; // 4
} }
}
}
//public partial class vlnTable
//{
// private static float YAdjust_RowTop = 0;//8; // 0
//}
//public partial class vlnCells
//{
// private static float YAdjust_HContent = 4; // 4
// private static float YAdjust_SpacingAfter = 8;//0; // 8
//}
//public partial class vlnCell
//{
// private static float YAdjust_h = 0; // 0
// private static float YAdjust_TextLocation = 4;//0; // 4
//}
#endregion #endregion
public partial class vlnTable public partial class vlnTable
{ {
#region Properties #region Properties
// HContents: For each row, contains the largest height for all columns in that row. // HContents: For each row, contains the largest height for all columns in that row.
// Merged cells are accounted for. This is done in vlnCells:SetupCells // Merged cells are accounted for. This is done in vlnCells:SetupCells
private float[] _HContents;// RHM20150525 - Table Scrunch public float[] HContents { get; set; }
public float[] HContents public float[] RowTop { get; set; }
{ public float[] ColLeft { get; set; }
get { return _HContents; } public VlnFlexGrid MyFlexGrid { get; set; }
set { _HContents = value; } public VlnBorders MyBorders { get; set; }
} public VlnGridCellShading MyShading { get; set; }
private float[] _RowTop; public iTextSharp.text.pdf.PdfContentByte MyContentByte { get; set; }
public float[] RowTop public vlnCells MyCells { get; set; }
{ public float Height => RowTop[RowTop.Length - 1];
get { return _RowTop; } public float Width => ColLeft[ColLeft.Length - 1];
set { _RowTop = value; }
}
private float[] _ColLeft;
public float[] ColLeft
{
get { return _ColLeft; }
set { _ColLeft = value; }
}
private VlnFlexGrid _MyFlexGrid;
public VlnFlexGrid MyFlexGrid
{
get { return _MyFlexGrid; }
set { _MyFlexGrid = value; }
}
private VlnBorders _MyBorders;
public VlnBorders MyBorders
{
get { return _MyBorders; }
set { _MyBorders = value; }
}
// C2021-004 Table cell shading
private VlnGridCellShading _MyShading;
public VlnGridCellShading MyShading
{
get { return _MyShading; }
set { _MyShading = value; }
}
private iTextSharp.text.pdf.PdfContentByte _MyContentByte;
public iTextSharp.text.pdf.PdfContentByte MyContentByte
{
get { return _MyContentByte; }
set { _MyContentByte = value; }
}
private vlnCells _MyCells;
public vlnCells MyCells
{
get { return _MyCells; }
set { _MyCells = value; }
}
public float Height
{ get
{
return RowTop[RowTop.Length - 1];
} }
public float Width
{ get
{
return ColLeft[ColLeft.Length - 1];
} }
private static float _XOffset = -1; // This moves the borders with respect to the text private static float _XOffset = -1; // This moves the borders with respect to the text
public static float XOffset public static float XOffset
@@ -186,7 +80,7 @@ namespace Volian.Print.Library
get { return (LineThicknessForThick - LineThicknessForDouble) / 2; }//LineThicknessForThick - 2 * LineThicknessForDouble; } get { return (LineThicknessForThick - LineThicknessForDouble) / 2; }//LineThicknessForThick - 2 * LineThicknessForDouble; }
} }
private float _TotalContentHeight = 0;// RHM20150525 - Table Scrunc private float _TotalContentHeight = 0;// RHM20150525 - Table Scrunc
// TotalContentHeight - height of just the content of all rows in the table.
public float TotalContentHeight public float TotalContentHeight
{ {
get get
@@ -199,20 +93,18 @@ namespace Volian.Print.Library
return _TotalContentHeight; return _TotalContentHeight;
} }
} }
public float SpaceAvailable// RHM20150525 - Table Scrunc
{ // RHM20150525 - Table Scrunc
// SpaceAvailable is the amount of white space there is to work with. It uses the bottom location // SpaceAvailable is the amount of white space there is to work with. It uses the bottom location
// of the table and subtracts how much height the actual contents take, TotalContentHeight. TotalContentHeight // of the table and subtracts how much height the actual contents take, TotalContentHeight. TotalContentHeight
// includes size/height (font size - assumes 12, 6LPI) of text & leading (space between lines) // includes size/height (font size - assumes 12, 6LPI) of text & leading (space between lines)
get { return TotalContentHeight ==0 ? 0 : RowTop[RowTop.Length - 1] - TotalContentHeight; } public float SpaceAvailable => TotalContentHeight == 0 ? 0 : RowTop[RowTop.Length - 1] - TotalContentHeight;
}
public float LeadingSpaceAvailable// B2018-085 - Table Scrunch Fix: // B2018-085 - Table Scrunch Fix:
{
// LeadingSpaceAvailable is the amount of 'blank' space between lines, this is included in TotalContentHeight. // LeadingSpaceAvailable is the amount of 'blank' space between lines, this is included in TotalContentHeight.
// 1.5 is difference between 12 and 13.5, 12 is the standard font size, i.e. 6LPI. 13.5 is line leading. // 1.5 is difference between 12 and 13.5, 12 is the standard font size, i.e. 6LPI. 13.5 is line leading.
// 1.5/13.5 is amount of space used by leading. // 1.5/13.5 is amount of space used by leading.
get { return TotalContentHeight == 0 ? 0 : TotalContentHeight * 1.5F/13.5F; } public float LeadingSpaceAvailable => TotalContentHeight == 0 ? 0 : TotalContentHeight * 1.5F / 13.5F;
}
// TooBig is the amount that the grid is over the amount of space on the page. To start (value in TooBig), it is set to // TooBig is the amount that the grid is over the amount of space on the page. To start (value in TooBig), it is set to
// (height of grid w/ compressed setting if needed + line) - (how much room on page), i.e. negative number if it can fit // (height of grid w/ compressed setting if needed + line) - (how much room on page), i.e. negative number if it can fit
private float _TooBig;// RHM20150525 - Table Scrunc private float _TooBig;// RHM20150525 - Table Scrunc
@@ -222,6 +114,7 @@ namespace Volian.Print.Library
set set
{ {
_TooBig = value; _TooBig = value;
//Debugging
//_Adjustment = Math.Min(1F, (_TooBig / (RowTop.Length - 1)) / 12); //_Adjustment = Math.Min(1F, (_TooBig / (RowTop.Length - 1)) / 12);
//if (ShowDetails) Console.WriteLine("TooBig\t{0}\t{1}", value, _Adjustment); //if (ShowDetails) Console.WriteLine("TooBig\t{0}\t{1}", value, _Adjustment);
//if(ShowDetails) Console.WriteLine("Before RowTop={0}", RowTop[RowTop.Length-1] ); //if(ShowDetails) Console.WriteLine("Before RowTop={0}", RowTop[RowTop.Length-1] );
@@ -252,20 +145,9 @@ namespace Volian.Print.Library
//if(ShowDetails) Console.WriteLine("After RowTop={0}", RowTop[RowTop.Length-1] ); //if(ShowDetails) Console.WriteLine("After RowTop={0}", RowTop[RowTop.Length-1] );
} }
} }
private float _Adjustment = 0;// RHM20150525 - Table Scrunc
public float Adjustment public float Adjustment { get; set; } = 0;
{ public float YAdjust_RowTop => Adjustment * 12;
get { return _Adjustment; }
set { _Adjustment = value; }
}
//private float _YAdjust_RowTop = 0;//8; // 0
public float YAdjust_RowTop
{
get
{
return _Adjustment * 12;
}
}
private void DrawRuler(PdfContentByte cb, float x, float yTop, float height)// RHM20150525 - Table Scrunc private void DrawRuler(PdfContentByte cb, float x, float yTop, float height)// RHM20150525 - Table Scrunc
{ {
VlnSvgPageHelper myPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; VlnSvgPageHelper myPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
@@ -290,7 +172,7 @@ namespace Volian.Print.Library
cb.LineTo(x, y); cb.LineTo(x, y);
cb.Stroke(); cb.Stroke();
} }
i = 0;
cb.Stroke(); cb.Stroke();
cb.RestoreState(); cb.RestoreState();
cb.EndLayer(); cb.EndLayer();
@@ -321,13 +203,8 @@ namespace Volian.Print.Library
myItemInfo.StepLevel, myItemInfo.ShortPath, Width, XOffset, YOffset); myItemInfo.StepLevel, myItemInfo.ShortPath, Width, XOffset, YOffset);
} }
#endregion #endregion
private string _Path;
public string Path public string Path { get; set; }
{
get { return _Path; }
set { _Path = value; }
}
#region Constructors #region Constructors
public vlnTable(VlnFlexGrid myFlexGrid, iTextSharp.text.pdf.PdfContentByte myContentByte) public vlnTable(VlnFlexGrid myFlexGrid, iTextSharp.text.pdf.PdfContentByte myContentByte)
@@ -374,7 +251,7 @@ public string Path
string myLPI = myPageHelper.YMultiplier == 1.0F ? ",6LPI" : ",7LPI"; string myLPI = myPageHelper.YMultiplier == 1.0F ? ",6LPI" : ",7LPI";
Rtf2Pdf.DrawPdfDebug(myColumnText.Canvas, left-2, top+1, left + Width, top-myPageHelper.YMultiplier *(Height+1), Rtf2Pdf.DrawPdfDebug(myColumnText.Canvas, left-2, top+1, left + Width, top-myPageHelper.YMultiplier *(Height+1),
DebugInfo+", Height= " + (myPageHelper.YMultiplier * Height).ToString() + myLPI, 0); DebugInfo+", Height= " + (myPageHelper.YMultiplier * Height).ToString() + myLPI, 0);
PdfLayer textLayer = myPageHelper == null ? null : myPageHelper.TextLayer; // RHM20150429 - Table Scrunch PdfLayer textLayer = myPageHelper?.TextLayer; // RHM20150429 - Table Scrunch
if (textLayer != null) cb.BeginLayer(textLayer); if (textLayer != null) cb.BeginLayer(textLayer);
myPageHelper.AddGap(top, top - Height, left, left + Width); myPageHelper.AddGap(top, top - Height, left, left + Width);
MyCells.ToPdf(myColumnText, left, top); MyCells.ToPdf(myColumnText, left, top);
@@ -383,6 +260,7 @@ public string Path
ShowRowTops("ToPDF2"); ShowRowTops("ToPDF2");
if (ShowDetails) Console.WriteLine("^^^^^^ToPdf============{0}===============", ItemID); if (ShowDetails) Console.WriteLine("^^^^^^ToPdf============{0}===============", ItemID);
} }
//For Debugging
private void ZoomGrid(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top) private void ZoomGrid(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
{ {
PdfDestination dest = new PdfDestination(PdfDestination.FITR, left - 4, top - Height - 4, left + Width, top + 4); PdfDestination dest = new PdfDestination(PdfDestination.FITR, left - 4, top - Height - 4, left + Width, top + 4);
@@ -396,26 +274,12 @@ public string Path
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion #endregion
#region Properties #region Properties
private VlnFlexGrid _MyFlexGrid; public VlnFlexGrid MyFlexGrid { get; set; }
public VlnFlexGrid MyFlexGrid public vlnTable MyTable { get; set; }
{
get { return _MyFlexGrid; }
set { _MyFlexGrid = value; }
}
private vlnTable _MyTable;
public vlnTable MyTable
{
get { return _MyTable; }
set { _MyTable = value; }
}
public bool ShowDetails// RHM20150525 - Table Scrunc public bool ShowDetails// RHM20150525 - Table Scrunc
{ get { return MyTable.ShowDetails; }} { get { return MyTable.ShowDetails; }}
private iTextSharp.text.pdf.PdfContentByte _MyContentByte;
public iTextSharp.text.pdf.PdfContentByte MyContentByte public iTextSharp.text.pdf.PdfContentByte MyContentByte { get; set; }
{
get { return _MyContentByte; }
set { _MyContentByte = value; }
}
#endregion #endregion
#region Constructors #region Constructors
public vlnCells(vlnTable myTable, VlnFlexGrid myFlexGrid, iTextSharp.text.pdf.PdfContentByte myContentByte) public vlnCells(vlnTable myTable, VlnFlexGrid myFlexGrid, iTextSharp.text.pdf.PdfContentByte myContentByte)
@@ -424,26 +288,11 @@ public string Path
MyFlexGrid = myFlexGrid; MyFlexGrid = myFlexGrid;
MyContentByte = myContentByte; MyContentByte = myContentByte;
SetupCells(); SetupCells();
foreach(vlnCell cell in this)
{
myTable.MyShading = VlnGridCellShading.Get(myFlexGrid.MyShading.ConvertToString()); // C2021-004 Table Cell Shading myTable.MyShading = VlnGridCellShading.Get(myFlexGrid.MyShading.ConvertToString()); // C2021-004 Table Cell Shading
myTable.MyBorders = VlnBorders.Get(myFlexGrid.MyBorders.ConvertToString()); myTable.MyBorders = VlnBorders.Get(myFlexGrid.MyBorders.ConvertToString());
GridLinePattern glp = cell.AboveLeftSide;
glp = cell.AboveRightSide;
glp = cell.BelowLeftSide;
glp = cell.BelowRightSide;
glp = cell.RightOfBottomSide;
glp = cell.RightOfTopSide;
object ta = cell.TextAlign;
}
} }
#endregion #endregion
private float _MyLeading = 13.5F; // B2018-085 AEP and APP worked with 13.5 public float MyLeading { get; set; } = 13.5F;
public float MyLeading
{
get { return _MyLeading; }
set { _MyLeading = value; }
}
#region Private Methods #region Private Methods
private void SetupCells() private void SetupCells()
{ {
@@ -527,7 +376,7 @@ public string Path
myColumnText1.AddElement(myPara); myColumnText1.AddElement(myPara);
float posBefore = myColumnText1.YLine; // position is y of top of paragraph since paragraph was just added float posBefore = myColumnText1.YLine; // position is y of top of paragraph since paragraph was just added
int status = myColumnText1.Go(true); // 'puts out' text for info only _ = myColumnText1.Go(true); // 'puts out' text for info only
float posAfter = myColumnText1.YLine; // posAfter is y of bottom of paragraph, really y top of line below this float posAfter = myColumnText1.YLine; // posAfter is y of bottom of paragraph, really y top of line below this
float hContent = 4 + posBefore - posAfter; float hContent = 4 + posBefore - posAfter;
@@ -566,6 +415,7 @@ public string Path
} }
} }
} }
//For Debugging:
// This summarizes the Content heights per row // This summarizes the Content heights per row
//int i=0; //int i=0;
//foreach (float h in MyTable.HContents) //foreach (float h in MyTable.HContents)
@@ -580,41 +430,6 @@ public string Path
return total; return total;
} }
// B2017-105 if a symbol character was set to a bigger font size, then the positioning of the larger symbol character was printing too high on the line
// found with Wolf Creek use of the empty box symbol
//private float BiggestFontSize(Paragraph myPara)
//{
// float fontSize = 12;
// foreach (Chunk ck in myPara.Chunks)
// {
// fontSize = Math.Max(fontSize, ck.Font.Size);
// if (ck.Font.Size > 12)
// {
// ck.SetTextRise(-2f);
// //_MyLog.WarnFormat("set text rise");
// }
// }
// return fontSize;
//}
// B2017-233, B2017-234 needed to get the smallest font size to help decide if a vertical adjustment of the text is needed in a table cell
//private float SmallestFontSize(Paragraph myPara)
//{
// float fontSize = 30;
// foreach (Chunk ck in myPara.Chunks)
// {
// fontSize = Math.Min(fontSize, ck.Font.Size);
// }
// return fontSize;
//}
//private void ShowChunks(System.Collections.ArrayList chunks) // RHM20150429 - Table Scrunch
//{
// StringBuilder sb = new StringBuilder();
// foreach (Chunk chk in chunks)
// {
// sb.Append(BuildChunks(chk.Content));
// }
// //if (ShowDetails) Console.WriteLine("Chunks = '{0}'", sb.ToString());
//}
private string BuildChunks(string str) private string BuildChunks(string str)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@@ -625,32 +440,14 @@ public string Path
else else
sb.Append(c); sb.Append(c);
} }
return "{" + sb.ToString() + "}"; return $"{{{sb}}}";
} }
private void TrimNewlines(Paragraph myPara) private void TrimNewlines(Paragraph myPara)
{ {
while (myPara.Count > 0 && ParaEndsWithNewLine(myPara)) while (myPara.Count > 0 && ParaEndsWithNewLine(myPara))
myPara.RemoveAt(myPara.Count - 1); myPara.RemoveAt(myPara.Count - 1);
} }
private bool ParaEndsWithNewLine(Paragraph myPara) private bool ParaEndsWithNewLine(Paragraph myPara) => myPara[myPara.Count - 1] is Chunk chk && chk.Content == "\n";
{
Chunk chk = myPara[myPara.Count - 1] as Chunk;
if (chk == null) return false;
if (chk.Content == "\n") return true;
return false;
}
public class VlnSplitCharacter : ISplitCharacter
{
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck)
{
return (cc[current] == ' ');
}
public bool IsSplitCharacter(char c)
{
return (c == ' ');
}
}
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
internal static void FixHyphens(Paragraph myPara, vlnTable myTable) internal static void FixHyphens(Paragraph myPara, vlnTable myTable)
{ {
// Find chunk with hardhyphen // Find chunk with hardhyphen
@@ -658,10 +455,9 @@ public string Path
// If a hard hyphen is found, the remove it and add a dash (keyboard minus sign) to the beginning // If a hard hyphen is found, the remove it and add a dash (keyboard minus sign) to the beginning
// of the text that follows it. // of the text that follows it.
int hype=-1; int hype=-1;
Font fnt = null;
while ((hype = GetHyphen(myPara)) > -1) while ((hype = GetHyphen(myPara)) > -1)
{ {
fnt = null; Font fnt = null;
if (hype > 0) if (hype > 0)
{ {
Chunk chk1 = (Chunk)myPara[hype - 1]; Chunk chk1 = (Chunk)myPara[hype - 1];
@@ -755,10 +551,9 @@ public string Path
// If a backslash symbold is found, the remove it and add a backslash (keyboard char) to the beginning // If a backslash symbold is found, the remove it and add a backslash (keyboard char) to the beginning
// of the text that follows it. // of the text that follows it.
int bckSlsh = -1; int bckSlsh = -1;
Font fnt = null;
while ((bckSlsh = GetBackslash(myPara)) > -1) while ((bckSlsh = GetBackslash(myPara)) > -1)
{ {
fnt = null; Font fnt = null;
if (bckSlsh > 0) if (bckSlsh > 0)
{ {
Chunk chk1 = (Chunk)myPara[bckSlsh - 1]; Chunk chk1 = (Chunk)myPara[bckSlsh - 1];
@@ -850,15 +645,9 @@ public string Path
// This piece of code checks for the existance of a font definition of \f1 which is need for the \u9999? indent character // This piece of code checks for the existance of a font definition of \f1 which is need for the \u9999? indent character
// If the a font definition of \f1 is not found then the indent character is removed. This will allow the procedure to print // If the a font definition of \f1 is not found then the indent character is removed. This will allow the procedure to print
// but the text in that table cell will not be indented. - jsj 10/10/2014 // but the text in that table cell will not be indented. - jsj 10/10/2014
// add the symbol font and then surround the indent.
//IRtfDocument rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace(@"\'05", @"\f1 \u9999? \f0 ")); //IRtfDocument rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace(@"\'05", @"\f1 \u9999? \f0 "));
IRtfDocument rtfDoc2 = null; IRtfDocument rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace(@"\'05", @"\par\u9999?\par"));
//if (rtf.Contains(@"\f1\fnil\fcharset0 "))
// rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace(@"\'05", @"\f1 \u9999? \f0 "));
//else
//{
// first add the symbol font and then surround the indent as above.
rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace(@"\'05", @"\par\u9999?\par"));
//}
Rtf2iTextSharp rtf2IText2 = new Rtf2iTextSharp(rtfDoc2); Rtf2iTextSharp rtf2IText2 = new Rtf2iTextSharp(rtfDoc2);
iTextSharp.text.Paragraph para2 = rtf2IText2.Convert(); iTextSharp.text.Paragraph para2 = rtf2IText2.Convert();
@@ -883,7 +672,7 @@ public string Path
return chkW; return chkW;
} }
private static StepRTB _StatRTB = new StepRTB(); private static readonly StepRTB _StatRTB = new StepRTB();
private string PreProcessRTF(float w, string str) private string PreProcessRTF(float w, string str)
{ {
_StatRTB.Text = string.Empty; _StatRTB.Text = string.Empty;
@@ -912,25 +701,7 @@ public string Path
_StatRTB.Text = str; _StatRTB.Text = str;
_StatRTB.SelectAll(); _StatRTB.SelectAll();
_StatRTB.SelectionColor = PrintOverride.OverrideTextColor(System.Drawing.Color.Black); _StatRTB.SelectionColor = PrintOverride.OverrideTextColor(System.Drawing.Color.Black);
str = _StatRTB.Rtf; return _StatRTB.Rtf;
// RHM 20180607 The following lines calculated line spacing but it did not give consistent values
//System.Drawing.Point location0 = _StatRTB.GetPositionFromCharIndex(0);
//int ii = 1;
//System.Drawing.Point locnext = location0;
//while (ii < 1000 && (locnext = _StatRTB.GetPositionFromCharIndex(ii)).Y == location0.Y)
// ii++;
//if (ii < 1000)
//{
// myLeading = (locnext.Y - location0.Y) * 72.0F / 96.0F;
// Console.WriteLine("{0} - {1}", _StatRTB.Font, myLeading);
//}
//else
// myLeading = 12.0F;
// myLeading = 13.5F; // RHM 20180607 This worked for AEP
// RHM 20180607 The following did not work
//RTBAPI.ParaFormatTwo pft = RTBAPI.GetParaFormat(_StatRTB);
//myLeading = Math.Max(12.0F, pft.dyLineSpacing);
return str;
} }
private iTextSharp.text.Paragraph RtfToParagraph(string rtf, iTextSharp.text.Font mySymFont,int r, int c) private iTextSharp.text.Paragraph RtfToParagraph(string rtf, iTextSharp.text.Font mySymFont,int r, int c)
{ {
@@ -940,10 +711,11 @@ public string Path
rtf = rtf.Replace(@"\_", "-").Replace(@"\u8209?", "-"); rtf = rtf.Replace(@"\_", "-").Replace(@"\u8209?", "-");
rtf = FixRTFToPrint(rtf, r, c); rtf = FixRTFToPrint(rtf, r, c);
IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf); IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf);
Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc); Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc)
rtf2IText.DefaultFont = mySymFont; {
DefaultFont = mySymFont
};
iTextSharp.text.Paragraph para = rtf2IText.Convert(); iTextSharp.text.Paragraph para = rtf2IText.Convert();
//para.SetLeading(MyLeading , 0);// RHM 20180607 Not Needed - performed in SetupCells
return para; return para;
} }
// The text font used in FixRTFToPrint for grid // The text font used in FixRTFToPrint for grid
@@ -1011,7 +783,6 @@ public string Path
// follow through in fixing an Out of Window Handles bug, use new function to see if // follow through in fixing an Out of Window Handles bug, use new function to see if
// we can retrieve the font from a dictionary instead a doing a New and using another // we can retrieve the font from a dictionary instead a doing a New and using another
// window handle B2017-117 // window handle B2017-117
//rtb.SelectionFont = new System.Drawing.Font(DefaultFont, fnt.Style);
rtb.SelectionFont = VE_Font.GetWinSysFont(DefaultFont, fnt.Style); rtb.SelectionFont = VE_Font.GetWinSysFont(DefaultFont, fnt.Style);
changed = true; changed = true;
} }
@@ -1027,8 +798,7 @@ public string Path
{ {
//use bolding underline italics from local font //use bolding underline italics from local font
System.Drawing.Font fnt = rtb.SelectionFont; System.Drawing.Font fnt = rtb.SelectionFont;
//System.Drawing.Font fntw = new System.Drawing.Font((rc.Family != null) ? rc.Family : fnt.FontFamily.Name, (rc.Size != null) ? (float)rc.Size : fnt.Size, (rc.Style != null) ? (System.Drawing.FontStyle)rc.Style : fnt.Style); System.Drawing.Font fntw = VE_Font.GetWinSysFont(rc.Family ?? fnt.FontFamily.Name, (rc.Size != null) ? (float)rc.Size : fnt.Size, (rc.Style != null) ? (System.Drawing.FontStyle)rc.Style : fnt.Style);
System.Drawing.Font fntw = VE_Font.GetWinSysFont((rc.Family != null) ? rc.Family : fnt.FontFamily.Name, (rc.Size != null) ? (float)rc.Size : fnt.Size, (rc.Style != null) ? (System.Drawing.FontStyle)rc.Style : fnt.Style);
rtb.SelectionFont = fntw; rtb.SelectionFont = fntw;
if (rc.Replace != null) if (rc.Replace != null)
{ {
@@ -1047,7 +817,6 @@ public string Path
} }
return rtf; return rtf;
} }
private static float _SixLinesPerInch = 12; // twips
#endregion #endregion
#region Public Methods #region Public Methods
// C2021-005 Get the largest font size being used. // C2021-005 Get the largest font size being used.
@@ -1117,56 +886,16 @@ public string Path
public partial class vlnCell // RHM20150429 - Table Scrunch public partial class vlnCell // RHM20150429 - Table Scrunch
{ {
#region Properties #region Properties
private vlnTable _MyTable; public vlnTable MyTable { get; set; }
public vlnTable MyTable public VlnBorders MyBorders => MyTable.MyBorders;
{
get { return _MyTable; } public int r1 { get; set; }
set { _MyTable = value; } public int c1 { get; set; }
} public int r2 { get; set; }
public VlnBorders MyBorders public int c2 { get; set; }
{ public iTextSharp.text.Paragraph MyPara { get; set; }
get { return _MyTable.MyBorders; } public float HContent { get; set; }
} public VlnGridCellShading MyShading => MyTable.MyShading;
private int _r1;
public int r1
{
get { return _r1; }
set { _r1 = value; }
}
private int _c1;
public int c1
{
get { return _c1; }
set { _c1 = value; }
}
private int _r2;
public int r2
{
get { return _r2; }
set { _r2 = value; }
}
private int _c2;
public int c2
{
get { return _c2; }
set { _c2 = value; }
}
private iTextSharp.text.Paragraph _MyPara;
public iTextSharp.text.Paragraph MyPara
{
get { return _MyPara; }
set { _MyPara = value; }
}
private float _HContent;
public float HContent
{
get { return _HContent; }
set { _HContent = value; }
}
public VlnGridCellShading MyShading
{
get { return _MyTable.MyShading; }
}
#endregion #endregion
#region Line Pattern Diagram #region Line Pattern Diagram
/* /*
@@ -1410,22 +1139,22 @@ public string Path
} }
#endregion #endregion
#region Static Properties #region Static Properties
private static float XOffset { get { return vlnTable.XOffset; } } private static float XOffset => vlnTable.XOffset;
private static float YOffset { get { return vlnTable.YOffset; } } private static float YOffset => vlnTable.YOffset;
private static float LineThicknessForThin { get { return vlnTable.LineThicknessForThin; } } private static float LineThicknessForThin => vlnTable.LineThicknessForThin;
private static float LineThicknessForThick { get { return vlnTable.LineThicknessForThick; } } private static float LineThicknessForThick => vlnTable.LineThicknessForThick;
private static float LineThicknessForDouble { get { return vlnTable.LineThicknessForDouble; } } private static float LineThicknessForDouble => vlnTable.LineThicknessForDouble;
private static float DoubleLineOffset { get { return vlnTable.DoubleLineOffset; } } private static float DoubleLineOffset => vlnTable.DoubleLineOffset;
// adjustments for line intersections: // adjustments for line intersections:
private static float ThickOverDouble { get { return ((2 * DoubleLineOffset) + LineThicknessForDouble - LineThicknessForThick) / 2; } } private static float ThickOverDouble => ((2 * DoubleLineOffset) + LineThicknessForDouble - LineThicknessForThick) / 2;
private static float ThickUnderDouble { get { return DoubleLineOffset + (LineThicknessForThick - LineThicknessForDouble) / 2; } } private static float ThickUnderDouble => DoubleLineOffset + (LineThicknessForThick - LineThicknessForDouble) / 2;
private static float ThickOverThin { get { return (LineThicknessForThin - LineThicknessForThick) / 2; } } private static float ThickOverThin => (LineThicknessForThin - LineThicknessForThick) / 2;
private static float ThinOverThick { get { return (LineThicknessForThick - LineThicknessForThin) / 2; } } private static float ThinOverThick => (LineThicknessForThick - LineThicknessForThin) / 2;
private static float ThinUnderDouble { get { return DoubleLineOffset + (LineThicknessForThin - LineThicknessForDouble) / 2; } } private static float ThinUnderDouble => DoubleLineOffset + (LineThicknessForThin - LineThicknessForDouble) / 2;
private static float ThinOverDouble { get { return (DoubleLineOffset + LineThicknessForThin - LineThicknessForDouble) / 2; } } private static float ThinOverDouble => (DoubleLineOffset + LineThicknessForThin - LineThicknessForDouble) / 2;
private static float DoubleUnderThin { get { return (LineThicknessForThin - LineThicknessForDouble) / 2; } } private static float DoubleUnderThin => (LineThicknessForThin - LineThicknessForDouble) / 2;
private static float DoubleUnderThick { get { return (LineThicknessForThick - LineThicknessForDouble) / 2; } } private static float DoubleUnderThick => (LineThicknessForThick - LineThicknessForDouble) / 2;
#endregion #endregion
#region Constructors #region Constructors
public vlnCell(int r1, int c1, int r2, int c2, vlnTable myTable, iTextSharp.text.Paragraph myPara, float hContent) public vlnCell(int r1, int c1, int r2, int c2, vlnTable myTable, iTextSharp.text.Paragraph myPara, float hContent)
@@ -1440,16 +1169,11 @@ public string Path
} }
#endregion #endregion
#region Public Methods #region Public Methods
public override string ToString() public override string ToString() => string.Format("{0}:{1}", r1, c1);
{
return string.Format("{0}:{1}", r1, c1);
}
// B2018-003 - RHM 20180319 Add
public void PdfDebug(iTextSharp.text.pdf.ColumnText myColumnText, float x, float bottom, float right, float y, string debugText, float yDescent) public void PdfDebug(iTextSharp.text.pdf.ColumnText myColumnText, float x, float bottom, float right, float y, string debugText, float yDescent)
{ {
PdfContentByte cb = myColumnText.Canvas; PdfContentByte cb = myColumnText.Canvas;
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; PdfLayer debugLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.DebugLayer;
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;
if (debugLayer == null) return; if (debugLayer == null) return;
System.Drawing.Color sysColor = PrintOverride.OverrideDebugColor(System.Drawing.Color.Gray); System.Drawing.Color sysColor = PrintOverride.OverrideDebugColor(System.Drawing.Color.Gray);
cb.SaveState(); cb.SaveState();
@@ -1481,7 +1205,6 @@ public string Path
cb.EndLayer(); cb.EndLayer();
cb.RestoreState(); cb.RestoreState();
} }
//RHM 20180319 End of Add
// B2021-137 Added doShading parameter // B2021-137 Added doShading parameter
// We call this twice. The first time to print the shading the second time to print the borders and text // We call this twice. The first time to print the shading the second time to print the borders and text
public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top, int topPlacementAdjust, bool doShading) public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top, int topPlacementAdjust, bool doShading)
@@ -1518,7 +1241,6 @@ public string Path
// B2019-093 missing table cell text when printing South Texas FSG-20 step 1 // B2019-093 missing table cell text when printing South Texas FSG-20 step 1
// Added two more to the last parameter of SetSimplColun (it's the ury value - upper y value) // Added two more to the last parameter of SetSimplColun (it's the ury value - upper y value)
// this will have the cell text print a little more toward the top of the cell // this will have the cell text print a little more toward the top of the cell
//myColumnText1.SetSimpleColumn(1 + left + x, top - y - h, left + x + w - 2, 3 + top - y - hAdjust - adjustTextLocation); // 2 == Default Padding
// B2019-109 Adjusted width of cell to match edit cell // B2019-109 Adjusted width of cell to match edit cell
// B2020-034 - use the passed in topPlacementAdjust value which is set based on the font size. // B2020-034 - use the passed in topPlacementAdjust value which is set based on the font size.
myColumnText1.SetSimpleColumn(.5F + left + x, top - y - h, left + x + w - 1.5F, topPlacementAdjust + top - y - hAdjust - adjustTextLocation); // 2 == Default Padding myColumnText1.SetSimpleColumn(.5F + left + x, top - y - h, left + x + w - 1.5F, topPlacementAdjust + top - y - hAdjust - adjustTextLocation); // 2 == Default Padding
@@ -1566,7 +1288,6 @@ public string Path
int cellStatus = myColumnText1.Go(); // B2019-109 Add to Error Log if cell too small int cellStatus = myColumnText1.Go(); // B2019-109 Add to Error Log if cell too small
if (cellStatus != 1) if (cellStatus != 1)
{ {
//System.Windows.Forms.MessageBox.Show("Cell width too narrow \r\n" + MyTable.Path, "Narrow Cell", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
_MyLog.WarnFormat("\r\n=-=-=-= Cell Width too narrow, text is wrapping ItemID={0} Location={1}, Row={2}, Col={3}, Status={4}",MyTable.ItemID, MyTable.Path, r1, c1, cellStatus); _MyLog.WarnFormat("\r\n=-=-=-= Cell Width too narrow, text is wrapping ItemID={0} Location={1}, Row={2}, Col={3}, Status={4}",MyTable.ItemID, MyTable.Path, r1, c1, cellStatus);
} }
float posAfter = myColumnText1.YLine; // RHM20150429 - Table Scrunch float posAfter = myColumnText1.YLine; // RHM20150429 - Table Scrunch
@@ -1606,7 +1327,6 @@ public string Path
} }
return sb.ToString(); return sb.ToString();
} }
private static float _SixLinesPerInch = 12; // twips
public bool IsRangeStyleNull = false; public bool IsRangeStyleNull = false;
private TextAlignEnum? _TextAlign = null; private TextAlignEnum? _TextAlign = null;
public TextAlignEnum? TextAlign public TextAlignEnum? TextAlign
@@ -1635,7 +1355,6 @@ public string Path
private float VeritcalTextAlignment(float h, float mult) private float VeritcalTextAlignment(float h, float mult)
{ {
float hAdjust = 0; float hAdjust = 0;
//CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2);
if (!IsRangeStyleNull) if (!IsRangeStyleNull)
{ {
switch (TextAlign) switch (TextAlign)
@@ -1913,28 +1632,10 @@ public string Path
else if (linePattern == GridLinePattern.Dashed) else if (linePattern == GridLinePattern.Dashed)
cb.SetLineDash(4, 4, 0); cb.SetLineDash(4, 4, 0);
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping row and col for Debugging")]
private static void SetLineColor(PdfContentByte cb, int row, int col, string side) private static void SetLineColor(PdfContentByte cb, int row, int col, string side)
{ {
iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black)); iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
//switch (side)
//{
// case "Top":
// if (col == 0) lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Blue));
// else lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Cyan));
// break;
// case "Left":
// if (row == 0) lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Red));
// else lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Magenta));
// break;
// case "Bottom":
// if (col == 0) lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Green));
// else lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Cyan));
// break;
// case "Right":
// if (row == 0) lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Orange));
// else lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Magenta));
// break;
//}
cb.SetColorStroke(lineColor); cb.SetColorStroke(lineColor);
} }
private static void InitializeLineStyle(PdfContentByte cb) private static void InitializeLineStyle(PdfContentByte cb)
@@ -1946,8 +1647,10 @@ public string Path
#region Debug Methods #region Debug Methods
private static void SetOpacity(PdfContentByte cb, float opacity) private static void SetOpacity(PdfContentByte cb, float opacity)
{ {
PdfGState gs = new PdfGState(); PdfGState gs = new PdfGState
gs.StrokeOpacity = opacity; {
StrokeOpacity = opacity
};
cb.SetGState(gs); cb.SetGState(gs);
} }
private static void ZoomToCell(iTextSharp.text.pdf.ColumnText myColumnText, float xLeft, float yTop, float xRight, float yBottom) private static void ZoomToCell(iTextSharp.text.pdf.ColumnText myColumnText, float xLeft, float yTop, float xRight, float yBottom)
@@ -1956,141 +1659,5 @@ public string Path
myColumnText.Canvas.SetAction(PdfAction.GotoLocalPage(myColumnText.Canvas.PdfWriter.CurrentPageNumber, dest, myColumnText.Canvas.PdfWriter), xLeft, yBottom, xRight, yTop); myColumnText.Canvas.SetAction(PdfAction.GotoLocalPage(myColumnText.Canvas.PdfWriter.CurrentPageNumber, dest, myColumnText.Canvas.PdfWriter), xLeft, yBottom, xRight, yTop);
} }
#endregion #endregion
#region Old Border Methods
//private void DrawLeftLine(PdfContentByte cb, float xLeft, float yTop, float yBottom)
//{
// if (c1 == 0 && LineLeft != GridLinePattern.None)
// {
// InitializeLineStyle(cb);
// SetLineColor(cb, r1, c1, "Left");
// if (LineLeft == GridLinePattern.Double)
// {
// //Left Line
// float dyTop = DoubleIntersectionLeft(LineTopLeft, LineTop, LineLeftAbove);
// float dyBottom = -DoubleIntersectionRight(LineBottom, LineBottomLeft, LineLeftBelow);
// DrawLine(cb, LineThicknessForDouble, xLeft - DoubleLineOffset, yTop + dyTop, xLeft - DoubleLineOffset, yBottom + dyBottom);
// //Right Line
// dyTop = DoubleIntersectionRight(LineTopLeft, LineTop, LineLeftAbove);
// dyBottom = -DoubleIntersectionLeft(LineBottom, LineBottomLeft, LineLeftBelow);
// DrawLine(cb, LineThicknessForDouble, xLeft + DoubleLineOffset, yTop + dyTop, xLeft + DoubleLineOffset, yBottom + dyBottom);
// }
// else if (LineLeft != GridLinePattern.Thick)
// {
// SetLinePattern(cb, LineLeft);
// float dyTop = ThinIntersection(LineTopLeft, LineTop, LineLeftAbove);
// float dyBottom = -ThinIntersection(LineBottom, LineBottomLeft, LineLeftBelow);
// DrawLine(cb, LineThicknessForThin, xLeft, yTop + dyTop, xLeft, yBottom + dyBottom);
// }
// else
// {
// float dyTop = ThickIntersection(LineTopLeft, LineTop, LineLeftAbove);
// float dyBottom = -ThickIntersection(LineBottom, LineBottomLeft, LineLeftBelow);
// DrawLine(cb, LineThicknessForThick, xLeft, yTop + dyTop, xLeft, yBottom + dyBottom);
// }
// cb.Stroke();
// }
//}
//private void DrawRightLine(PdfContentByte cb, float xRight, float yTop, float yBottom)
//{
// if (LineRight != GridLinePattern.None)
// {
// InitializeLineStyle(cb);
// SetLineColor(cb, r1, c1, "Right");
// if (LineRight == GridLinePattern.Double)
// {
// //Left Line
// float dyTop = DoubleIntersectionLeft(LineTop, LineTopRight, LineRightAbove);
// float dyBottom = -DoubleIntersectionRight(LineBottomRight, LineBottom, LineRightBelow);
// DrawLine(cb, LineThicknessForDouble, xRight - DoubleLineOffset, yTop + dyTop, xRight - DoubleLineOffset, yBottom + dyBottom);
// //Right Line
// dyTop = DoubleIntersectionRight(LineTop, LineTopRight, LineRightAbove);
// dyBottom = -DoubleIntersectionLeft(LineBottomRight, LineBottom, LineRightBelow);
// DrawLine(cb, LineThicknessForDouble, xRight + DoubleLineOffset, yTop + dyTop, xRight + DoubleLineOffset, yBottom + dyBottom);
// }
// else if (LineRight != GridLinePattern.Thick)
// {
// float dyTop = ThinIntersection(LineTop, LineTopRight, LineRightAbove);
// float dyBottom = -ThinIntersection(LineBottomRight, LineBottom, LineRightBelow);
// SetLinePattern(cb, LineRight);
// DrawLine(cb, LineThicknessForThin, xRight, yTop + dyTop, xRight, yBottom + dyBottom);
// }
// else
// {
// float dyTop = ThickIntersection(LineTop, LineTopRight, LineRightAbove);
// float dyBottom = -ThickIntersection(LineBottomRight, LineBottom, LineRightBelow);
// DrawLine(cb, LineThicknessForThick, xRight, yTop + dyTop, xRight, yBottom + dyBottom);
// }
// cb.Stroke();
// }
//}
//private void DrawTopLine(PdfContentByte cb, float xLeft, float xRight, float yTop)
//{
// if (r1 == 0 && TopSide != GridLinePattern.None)
// {
// InitializeLineStyle(cb);
// SetLineColor(cb, r1, c1, "Top");
// if (TopSide == GridLinePattern.Double)
// {
// // Top Line
// float dxLeft = -DoubleIntersectionRight(LeftSide, AboveLeftSide, LeftOfTopSide);
// float dxRight = DoubleIntersectionLeft(AboveRightSide, RightSide, RightOfTopSide);
// DrawLine(cb, LineThicknessForDouble, xLeft + dxLeft, yTop + DoubleLineOffset, xRight + dxRight, yTop + DoubleLineOffset);
// // Bottom Line
// dxLeft = -DoubleIntersectionLeft(LeftSide, AboveLeftSide, LeftOfTopSide);
// dxRight = DoubleIntersectionRight(AboveRightSide, RightSide, RightOfTopSide);
// DrawLine(cb, LineThicknessForDouble, xLeft + dxLeft, yTop - DoubleLineOffset, xRight + dxRight, yTop - DoubleLineOffset);
// }
// else if (TopSide != GridLinePattern.Thick)
// {
// SetLinePattern(cb, TopSide);
// float dxLeft = -ThinIntersection(LeftSide, AboveLeftSide, LeftOfTopSide);
// float dxRight = ThinIntersection(AboveRightSide, RightSide, RightOfTopSide);
// DrawLine(cb, LineThicknessForThin, xLeft + dxLeft, yTop, xRight + dxRight, yTop);
// }
// else
// {
// float dxLeft = -ThickIntersection(LeftSide, AboveLeftSide, LeftOfTopSide);
// float dxRight = ThickIntersection(AboveRightSide, RightSide, RightOfTopSide);
// if (c1 == 0)
// Console.WriteLine("'{0}','{1}','{2}',{3},{4}", LeftSide, AboveLeftSide, LeftOfTopSide, dxLeft, ThickOverThin);
// DrawLine(cb, LineThicknessForThick, xLeft + dxLeft, yTop, xRight + dxRight, yTop);
// }
// cb.Stroke();
// }
//}
//private void DrawBottomLine(PdfContentByte cb, float xLeft, float xRight, float yBottom)
//{
// if (BottomSide != GridLinePattern.None)
// {
// InitializeLineStyle(cb);
// SetLineColor(cb, r1, c1, "Bottom");
// if (BottomSide == GridLinePattern.Double)
// {
// // Top Line
// float dxLeft = -DoubleIntersectionRight(BelowLeftSide, LeftSide, LeftOfBottomSide);
// float dxRight = DoubleIntersectionLeft(RightSide, BelowRightSide, RightOfBottomSide);
// DrawLine(cb, LineThicknessForDouble, xLeft + dxLeft, yBottom + DoubleLineOffset, xRight + dxRight, yBottom + DoubleLineOffset);// Top Line
// // Bottom Line
// dxLeft = -DoubleIntersectionLeft(BelowLeftSide, LeftSide, LeftOfBottomSide);
// dxRight = DoubleIntersectionRight(RightSide, BelowRightSide, RightOfBottomSide);
// DrawLine(cb, LineThicknessForDouble, xLeft + dxLeft, yBottom - DoubleLineOffset, xRight + dxRight, yBottom - DoubleLineOffset);//Bottom Line
// }
// else if (BottomSide != GridLinePattern.Thick) // Bottom line is thin. Determine if intersecting with double:
// {
// SetLinePattern(cb, BottomSide);
// float dxLeft = -ThinIntersection(BelowLeftSide, LeftSide, LeftOfBottomSide);
// float dxRight = ThinIntersection(RightSide, BelowRightSide, RightOfBottomSide);
// DrawLine(cb, LineThicknessForThin, xLeft + dxLeft, yBottom, xRight + dxRight, yBottom);
// }
// else
// {
// float dxLeft = -ThickIntersection(BelowLeftSide, LeftSide, LeftOfBottomSide);
// float dxRight = ThickIntersection(RightSide, BelowRightSide, RightOfBottomSide);
// DrawLine(cb, LineThicknessForThick, xLeft + dxLeft, yBottom, xRight + dxRight, yBottom);
// }
// cb.Stroke();
// }
//}
#endregion
} }
} }
+22 -60
View File
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@@ -14,34 +13,15 @@ namespace Volian.Print.Library
{ {
public class MergedPdfProc public class MergedPdfProc
{ {
private string _Title; public string Title { get; // used for pdf outline
public string Title set; }
{ public int PageCount { get; set; }
get { return _Title; } // used for pdf outline public string PdfFileName { get; set; }
set { _Title = value; } public bool FirstPageNoPageNum { get; set; } = false;
}
private int _PageCount; // number of pages in the particular pdf, to aid in determining total page count for merged pdf
public int PageCount
{
get { return _PageCount; }
set { _PageCount = value; }
}
private string _PdfFileName; // used for finding the procedure's pdf file to merge
public string PdfFileName
{
get { return _PdfFileName; }
set { _PdfFileName = value; }
}
private bool _FirstPageNoPageNum = false;
public bool FirstPageNoPageNum
{
get { return _FirstPageNoPageNum; }
set { _FirstPageNoPageNum = value; }
}
public MergedPdfProc(string title, string pfname) public MergedPdfProc(string title, string pfname)
{ {
_Title = title; Title = title;
_PdfFileName = pfname; PdfFileName = pfname;
} }
} }
// this class will manage the data & do subsequent merging of pdf files. It is used if the user // this class will manage the data & do subsequent merging of pdf files. It is used if the user
@@ -49,25 +29,11 @@ namespace Volian.Print.Library
public class MergedPdf public class MergedPdf
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private List<MergedPdfProc> _mergedPdfs = null; // This list has all procedure pdfs that will be included in the merged file.
public List<MergedPdfProc> MergedPdfs public List<MergedPdfProc> MergedPdfs { get; set; } = null;
{ public string MergedFileName { get; set; } = null;
get { return _mergedPdfs; } public string Folder { get; set; }
set { _mergedPdfs = value; } private readonly DocVersionInfo _docVersionInfo;
}
string _mergedFileName = null; // this is the name to be given the merged file
public string MergedFileName
{
get { return _mergedFileName; }
set { _mergedFileName = value; }
}
private string _folder; // this is folder to create the merged file in
public string Folder
{
get { return _folder; }
set { _folder = value; }
}
private DocVersionInfo _docVersionInfo;
private string _pageof = null; private string _pageof = null;
private iTextSharp.text.Font _itextFont = null; private iTextSharp.text.Font _itextFont = null;
private MergedPdfsPageNumCorner _corner; private MergedPdfsPageNumCorner _corner;
@@ -80,11 +46,11 @@ namespace Volian.Print.Library
// the following constructs the class that contains data for merging a group of pdfs. // the following constructs the class that contains data for merging a group of pdfs.
public MergedPdf(string folder, DocVersionInfo dvi) public MergedPdf(string folder, DocVersionInfo dvi)
{ {
_folder = folder; Folder = folder;
_docVersionInfo = dvi; _docVersionInfo = dvi;
} }
// the following merges the procedure pdfs into a single pdf // the following merges the procedure pdfs into a single pdf
public bool DoTheMerge(Dictionary<string, List<int>> MergedLandscapPages, bool generatePointListFile) public bool DoTheMerge(bool generatePointListFile)
{ {
if (MergedPdfs == null) if (MergedPdfs == null)
{ {
@@ -93,7 +59,7 @@ namespace Volian.Print.Library
} }
iTextSharp.text.Document doc = new iTextSharp.text.Document(); iTextSharp.text.Document doc = new iTextSharp.text.Document();
string slashReplace = _docVersionInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SlashReplace ?? "_"; string slashReplace = _docVersionInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SlashReplace ?? "_";
MergedFileName = _folder + @"\" + _docVersionInfo.MyFolder.Name.Replace("/", slashReplace).Replace("\\", slashReplace) + ".pdf"; MergedFileName = Folder + @"\" + _docVersionInfo.MyFolder.Name.Replace("/", slashReplace).Replace("\\", slashReplace) + ".pdf";
MergedFileName = ItemInfo.StripRtfFormatting(MergedFileName); MergedFileName = ItemInfo.StripRtfFormatting(MergedFileName);
// C2021-063 file name of Alarm Point List file containing Serial Number, Title, and merged Page Number // C2021-063 file name of Alarm Point List file containing Serial Number, Title, and merged Page Number
StreamWriter sw = null; StreamWriter sw = null;
@@ -109,12 +75,12 @@ namespace Volian.Print.Library
{ {
writer = PdfWriter.GetInstance(doc, new FileStream(MergedFileName, FileMode.Create)); writer = PdfWriter.GetInstance(doc, new FileStream(MergedFileName, FileMode.Create));
} }
catch (Exception ex) catch (Exception)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.AppendLine("Could not create"); sb.AppendLine("Could not create");
sb.AppendLine(); sb.AppendLine();
sb.AppendLine(MergedFileName + "."); sb.AppendLine($"{MergedFileName}.");
sb.AppendLine(); sb.AppendLine();
sb.AppendLine("If it is open, close and retry."); sb.AppendLine("If it is open, close and retry.");
FlexibleMessageBox.Show(sb.ToString(), "Error on CreatePdf", MessageBoxButtons.OK, MessageBoxIcon.Warning); FlexibleMessageBox.Show(sb.ToString(), "Error on CreatePdf", MessageBoxButtons.OK, MessageBoxIcon.Warning);
@@ -136,7 +102,7 @@ namespace Volian.Print.Library
// write Serial Number, Title, and Page Number in the Point List file // write Serial Number, Title, and Page Number in the Point List file
sw.WriteLine("{0}\t{1}\t{2}", idxSerialNum++, mpp.Title, mergedPageNumber + 1); sw.WriteLine("{0}\t{1}\t{2}", idxSerialNum++, mpp.Title, mergedPageNumber + 1);
} }
string pdffilename = _folder + @"\" + mpp.PdfFileName; string pdffilename = $@"{Folder}\{mpp.PdfFileName}";
if (!File.Exists(pdffilename)) if (!File.Exists(pdffilename))
{ {
FlexibleMessageBox.Show("Error in finding pdf files to merge. Cannot print with date/time as part of pdf name. Or check that individual pdfs were generated.", "Error on CreatePdf", MessageBoxButtons.OK, MessageBoxIcon.Warning); FlexibleMessageBox.Show("Error in finding pdf files to merge. Cannot print with date/time as part of pdf name. Or check that individual pdfs were generated.", "Error on CreatePdf", MessageBoxButtons.OK, MessageBoxIcon.Warning);
@@ -154,7 +120,7 @@ namespace Volian.Print.Library
PdfReader reader = null; PdfReader reader = null;
try // B2019-041: added a try/catch for when a corrupt pdf was created for a procedure, just skip & add message to error log. try // B2019-041: added a try/catch for when a corrupt pdf was created for a procedure, just skip & add message to error log.
{ {
reader = new PdfReader(_folder + @"\" + mpp.PdfFileName); reader = new PdfReader($@"{Folder}\{mpp.PdfFileName}");
int numPages = reader.NumberOfPages; int numPages = reader.NumberOfPages;
int currentPageNumber = 0; int currentPageNumber = 0;
PdfOutline outline = null; PdfOutline outline = null;
@@ -178,7 +144,7 @@ namespace Volian.Print.Library
// if on the first page, add the pdfname & title as part of outline. If on remaining pages, just put out page number. // if on the first page, add the pdfname & title as part of outline. If on remaining pages, just put out page number.
// Later this may need expanded to put sections/steps/etc. // Later this may need expanded to put sections/steps/etc.
if (currentPageNumber == 1) if (currentPageNumber == 1)
outline = new PdfOutline(canvas.RootOutline, dest, mpp.PdfFileName.Replace(".pdf", "") + " - " + mpp.Title, false); outline = new PdfOutline(canvas.RootOutline, dest, $"{mpp.PdfFileName.Replace(".pdf", "")} - {mpp.Title}", false);
else else
new PdfOutline(outline, dest, "Page " + currentPageNumber.ToString(), false); new PdfOutline(outline, dest, "Page " + currentPageNumber.ToString(), false);
canvas.AddTemplate(page, 0, 0); // adds the page to the combined pdf canvas.AddTemplate(page, 0, 0); // adds the page to the combined pdf
@@ -204,17 +170,13 @@ namespace Volian.Print.Library
private void AddPageNumberToPage(PdfImportedPage page, PdfContentByte cb, string outputpage, bool landscape) private void AddPageNumberToPage(PdfImportedPage page, PdfContentByte cb, string outputpage, bool landscape)
{ {
float pgright = page.BoundingBox.Right; float pgright = page.BoundingBox.Right;
float pgleft = page.BoundingBox.Left;
float pgtop = page.BoundingBox.Top; float pgtop = page.BoundingBox.Top;
float pgbot = page.BoundingBox.Bottom;
MergedPdfsPageNumCorner cnr = _corner; // C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location MergedPdfsPageNumCorner cnr = _corner; // C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location
// B2019-152: Landscape page numbers when merging // B2019-152: Landscape page numbers when merging
if (landscape) if (landscape)
{ {
pgright = page.BoundingBox.Top; pgright = page.BoundingBox.Top;
pgleft = page.BoundingBox.Bottom;
pgtop = page.BoundingBox.Right; pgtop = page.BoundingBox.Right;
pgbot = page.BoundingBox.Left;
cnr = _landcorner; // C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location cnr = _landcorner; // C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location
} }
Phrase ph = new Phrase(); Phrase ph = new Phrase();
@@ -281,7 +243,7 @@ namespace Volian.Print.Library
private bool GetPageOfInfo() private bool GetPageOfInfo()
{ {
DocVersionConfig dvc = (DocVersionConfig) _docVersionInfo.MyConfig; DocVersionConfig dvc = (DocVersionConfig) _docVersionInfo.MyConfig;
MergedPdfsPageOf po = dvc.Print_MergedPdfsPageOf; _ = dvc.Print_MergedPdfsPageOf;
string tmp = EnumDescConverter.GetEnumDescription((Enum)dvc.Print_MergedPdfsPageOf); string tmp = EnumDescConverter.GetEnumDescription((Enum)dvc.Print_MergedPdfsPageOf);
if (tmp == "None") return false; // no page number, return false so no page number is put out. if (tmp == "None") return false; // no page number, return false so no page number is put out.
@@ -297,7 +259,7 @@ namespace Volian.Print.Library
famtmp = _docVersionInfo.ActiveFormat.PlantFormat.FormatData.Font.Family; famtmp = _docVersionInfo.ActiveFormat.PlantFormat.FormatData.Font.Family;
} }
tmp = dvc.Print_MergedPdfsPageNumFontSize; tmp = dvc.Print_MergedPdfsPageNumFontSize;
float? tmpi=0; float? tmpi;
if (tmp == null || tmp == "") if (tmp == null || tmp == "")
{ {
// use the default from the format from this working draft // use the default from the format from this working draft
File diff suppressed because it is too large Load Diff
@@ -6,35 +6,20 @@ using iTextSharp.text.pdf;
using iTextSharp.text; using iTextSharp.text;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Linq;
namespace Volian.Print.Library namespace Volian.Print.Library
{ {
public class PDFConsistencyCheckReport public class PDFConsistencyCheckReport
{ {
private DocVersionInfo _MyDocVersion; public DocVersionInfo MyDocVersion { get; set; }
public DocVersionInfo MyDocVersion public string FileName { get; set; }
{ public ItemInfoList MyItemInfoList { get; set; }
get { return _MyDocVersion; }
set { _MyDocVersion = value; }
}
private string _FileName;
public string FileName
{
get { return _FileName; }
set { _FileName = value; }
}
private ItemInfoList _MyItemInfoList;
public ItemInfoList MyItemInfoList
{
get { return _MyItemInfoList; }
set { _MyItemInfoList = value; }
}
public PDFConsistencyCheckReport(string fileName, ItemInfoList myItemInfoList, DocVersionInfo myDocVersion) public PDFConsistencyCheckReport(string fileName, ItemInfoList myItemInfoList, DocVersionInfo myDocVersion)
{ {
_FileName = fileName; FileName = fileName;
_MyItemInfoList = myItemInfoList; MyItemInfoList = myItemInfoList;
_MyDocVersion = myDocVersion; //B2020-020 needed to pass in DocVersion to get paper size from format MyDocVersion = myDocVersion; //B2020-020 needed to pass in DocVersion to get paper size from format
} }
public void BuildReport() public void BuildReport()
{ {
@@ -47,7 +32,6 @@ namespace Volian.Print.Library
} }
catch (Exception ex) catch (Exception ex)
{ {
StringBuilder msg = new StringBuilder();
document.Add(new Paragraph("Error:")); document.Add(new Paragraph("Error:"));
while (ex != null) while (ex != null)
{ {
@@ -61,7 +45,7 @@ namespace Volian.Print.Library
if (document.IsOpen()) if (document.IsOpen())
{ {
document.Close(); document.Close();
System.Diagnostics.Process.Start(_FileName); System.Diagnostics.Process.Start(FileName);
} }
} }
} }
@@ -73,13 +57,13 @@ namespace Volian.Print.Library
// Try to open a file for creating the PDF. // Try to open a file for creating the PDF.
while (result == false) while (result == false)
{ {
string fileName = _FileName.ToLower().Replace(".pdf", suffix + ".pdf"); string fileName = FileName.ToLower().Replace(".pdf", suffix + ".pdf");
try try
{ {
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create)); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create));
document.SetMargins(36, 36, 36, 36); document.SetMargins(36, 36, 36, 36);
document.Open(); document.Open();
_FileName = fileName; FileName = fileName;
result = true; result = true;
} }
catch (System.IO.IOException exIO) catch (System.IO.IOException exIO)
@@ -118,9 +102,11 @@ namespace Volian.Print.Library
} }
private PdfPCell BlankCell(int colSpan) private PdfPCell BlankCell(int colSpan)
{ {
PdfPCell c = new PdfPCell(); PdfPCell c = new PdfPCell
c.Colspan = colSpan; {
c.Border = 0; Colspan = colSpan,
Border = 0
};
return c; return c;
} }
private void BuildConsistencyReport(iTextSharp.text.Document doc) private void BuildConsistencyReport(iTextSharp.text.Document doc)
@@ -132,7 +118,6 @@ namespace Volian.Print.Library
iTextSharp.text.Font f3 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK); iTextSharp.text.Font f3 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK);
iTextSharp.text.Font f4 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 2, Color.BLACK); iTextSharp.text.Font f4 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 2, Color.BLACK);
int cols = 5; int cols = 5;
int borders = 0;
int paddingBottom = 6; int paddingBottom = 6;
// float[] widths; // float[] widths;
Csla.SortedBindingList<ItemInfo> sortedProcs = new Csla.SortedBindingList<ItemInfo>(MyItemInfoList); Csla.SortedBindingList<ItemInfo> sortedProcs = new Csla.SortedBindingList<ItemInfo>(MyItemInfoList);
@@ -141,7 +126,7 @@ namespace Volian.Print.Library
// B2019-024: First page of Report prints the title at the top and the remainder of the page is blank. // B2019-024: First page of Report prints the title at the top and the remainder of the page is blank.
// Check if procedure(s) are printed on that page and if not, change message to "No..." and don't do // Check if procedure(s) are printed on that page and if not, change message to "No..." and don't do
// pagebreak. // pagebreak.
foreach (ProcedureInfo pi in sortedProcs) foreach (ProcedureInfo pi in sortedProcs.OfType<ProcedureInfo>())
{ {
if (pi.IsSelected) if (pi.IsSelected)
{ {
@@ -160,16 +145,20 @@ namespace Volian.Print.Library
lbSrchResults.DataSource = sortedResults; lbSrchResults.DataSource = sortedResults;
*/ */
foreach (ProcedureInfo pi in sortedProcs) foreach (ProcedureInfo pi in sortedProcs.OfType<ProcedureInfo>())
{ {
if (pi.IsSelected) if (pi.IsSelected)
{ {
PdfPTable tt = new PdfPTable(cols); PdfPTable tt = new PdfPTable(cols)
tt.KeepTogether = true; {
KeepTogether = true
};
tt.AddCell(AddSubTableCell(pi.DisplayNumber, f2, cols, paddingBottom)); tt.AddCell(AddSubTableCell(pi.DisplayNumber, f2, cols, paddingBottom));
tt.AddCell(AddSubTableCell(pi.MyDifferencesText, f3, cols, paddingBottom)); tt.AddCell(AddSubTableCell(pi.MyDifferencesText, f3, cols, paddingBottom));
PdfPCell c = new PdfPCell(tt); PdfPCell c = new PdfPCell(tt)
c.Colspan = cols; {
Colspan = cols
};
t.AddCell(c); t.AddCell(c);
} }
} }
@@ -179,16 +168,20 @@ namespace Volian.Print.Library
if (didSome) doc.NewPage(); if (didSome) doc.NewPage();
t = CreatePdfPTable(cols); t = CreatePdfPTable(cols);
CreatePageHeader(t, f1, f4, cols, paddingBottom, "Approval Consistency Report", "Procedures that should be selected to be approved in order to maintain consistency"); CreatePageHeader(t, f1, f4, cols, paddingBottom, "Approval Consistency Report", "Procedures that should be selected to be approved in order to maintain consistency");
foreach (ProcedureInfo pi in MyItemInfoList) foreach (ProcedureInfo pi in MyItemInfoList.OfType<ProcedureInfo>())
{ {
if (!pi.IsSelected) if (!pi.IsSelected)
{ {
PdfPTable tt = new PdfPTable(cols); PdfPTable tt = new PdfPTable(cols)
tt.KeepTogether = true; {
KeepTogether = true
};
tt.AddCell(AddSubTableCell(pi.DisplayNumber, f2, cols, paddingBottom)); tt.AddCell(AddSubTableCell(pi.DisplayNumber, f2, cols, paddingBottom));
tt.AddCell(AddSubTableCell(pi.MyDifferencesText, f3, cols, paddingBottom)); tt.AddCell(AddSubTableCell(pi.MyDifferencesText, f3, cols, paddingBottom));
PdfPCell c = new PdfPCell(tt); PdfPCell c = new PdfPCell(tt)
c.Colspan = cols; {
Colspan = cols
};
t.AddCell(c); t.AddCell(c);
} }
} }
@@ -196,42 +189,54 @@ namespace Volian.Print.Library
} }
private PdfPCell AddSubTableCell(string text, iTextSharp.text.Font f, int cols, float pb) private PdfPCell AddSubTableCell(string text, iTextSharp.text.Font f, int cols, float pb)
{ {
Phrase h = new Phrase(); Phrase h = new Phrase
h.Font = f; {
Font = f
};
h.Add(text); h.Add(text);
PdfPCell c = new PdfPCell(h); PdfPCell c = new PdfPCell(h)
c.Colspan = cols; {
c.HorizontalAlignment = Element.ALIGN_LEFT; Colspan = cols,
c.PaddingBottom = pb; HorizontalAlignment = Element.ALIGN_LEFT,
PaddingBottom = pb
};
return c; return c;
} }
private void CreatePageHeader(PdfPTable t, iTextSharp.text.Font f1, iTextSharp.text.Font f2, int cols, float pb, string hdr1, string hdr2) private void CreatePageHeader(PdfPTable t, iTextSharp.text.Font f1, iTextSharp.text.Font f2, int cols, float pb, string hdr1, string hdr2)
{ {
//report title //report title
Phrase h = new Phrase(); Phrase h = new Phrase
h.Font = f1; {
Font = f1
};
h.Add(hdr1); h.Add(hdr1);
PdfPCell c = new PdfPCell(h); PdfPCell c = new PdfPCell(h)
c.Colspan = cols; {
c.HorizontalAlignment = Element.ALIGN_CENTER; Colspan = cols,
c.PaddingBottom = pb; HorizontalAlignment = Element.ALIGN_CENTER,
//c.Border = borders; PaddingBottom = pb
};
t.AddCell(c); t.AddCell(c);
h = new Phrase(); h = new Phrase
h.Font = f2; {
Font = f2
};
h.Add(hdr2); h.Add(hdr2);
c = new PdfPCell(h); c = new PdfPCell(h)
c.Colspan = cols; {
c.HorizontalAlignment = Element.ALIGN_CENTER; Colspan = cols,
c.PaddingBottom = pb; HorizontalAlignment = Element.ALIGN_CENTER,
//c.Border = borders; PaddingBottom = pb
};
t.AddCell(c); t.AddCell(c);
t.AddCell(BlankCell(cols)); t.AddCell(BlankCell(cols));
} }
private PdfPTable CreatePdfPTable(int cols) private PdfPTable CreatePdfPTable(int cols)
{ {
PdfPTable t = new PdfPTable(cols); PdfPTable t = new PdfPTable(cols)
t.HeaderRows = 3; {
HeaderRows = 3
};
t.DefaultCell.Padding = 4; t.DefaultCell.Padding = 4;
t.WidthPercentage = 100; t.WidthPercentage = 100;
float[] widths = new float[] { 1f, 1f, 1f, 1f, 4f }; float[] widths = new float[] { 1f, 1f, 1f, 1f, 4f };
@@ -251,7 +256,6 @@ namespace Volian.Print.Library
} }
catch (Exception ex) catch (Exception ex)
{ {
StringBuilder msg = new StringBuilder();
document.Add(new Paragraph("Error:")); document.Add(new Paragraph("Error:"));
while (ex != null) while (ex != null)
{ {
@@ -265,7 +269,7 @@ namespace Volian.Print.Library
if (document.IsOpen()) if (document.IsOpen())
{ {
document.Close(); document.Close();
System.Diagnostics.Process.Start(_FileName); System.Diagnostics.Process.Start(FileName);
} }
} }
} }
@@ -276,33 +280,40 @@ namespace Volian.Print.Library
iTextSharp.text.Font f1 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 12, 1, Color.BLACK); iTextSharp.text.Font f1 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 12, 1, Color.BLACK);
iTextSharp.text.Font f2 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 0, Color.BLACK); iTextSharp.text.Font f2 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 0, Color.BLACK);
iTextSharp.text.Font f3 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK); iTextSharp.text.Font f3 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK);
iTextSharp.text.Font f4 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 2, Color.BLACK);
int cols = 3; int cols = 3;
int borders = 0; PdfPTable t = new PdfPTable(cols)
int paddingBottom = 6; {
PdfPTable t = new PdfPTable(cols); HeaderRows = 1,
t.HeaderRows = 1; WidthPercentage = 100
t.WidthPercentage = 100; };
float[] widths = new float[] { 1f, 1f, 10f }; float[] widths = new float[] { 1f, 1f, 10f };
t.SetWidths(widths); t.SetWidths(widths);
Phrase h = new Phrase(); Phrase h = new Phrase
h.Font = f1; {
Font = f1
};
h.Add("Approved Procedures Inconsistencies Report"); h.Add("Approved Procedures Inconsistencies Report");
PdfPCell c = new PdfPCell(h); PdfPCell c = new PdfPCell(h)
c.Colspan = cols; {
c.HorizontalAlignment = 1; Colspan = cols,
HorizontalAlignment = 1
};
t.AddCell(c); t.AddCell(c);
// C2021-013: Include the Procedure set name & date // C2021-013: Include the Procedure set name & date
h = new Phrase(); h = new Phrase
h.Font = f1; {
Font = f1
};
string tmp = MyDocVersion.MyFolder.Name + " " + DateTime.Now.ToString("M/d/yyyy"); string tmp = MyDocVersion.MyFolder.Name + " " + DateTime.Now.ToString("M/d/yyyy");
h.Add(tmp); h.Add(tmp);
c = new PdfPCell(h); c = new PdfPCell(h)
c.Colspan = cols; {
c.HorizontalAlignment = 1; Colspan = cols,
HorizontalAlignment = 1
};
t.AddCell(c); t.AddCell(c);
Dictionary<int, string> types = new Dictionary<int, string>(); Dictionary<int, string> types = new Dictionary<int, string>();
foreach (ProcedureInfo pi in MyItemInfoList) foreach (ProcedureInfo pi in MyItemInfoList.OfType<ProcedureInfo>())
{ {
string type = pi.MyDifferences.ROConsistency.MyROChecks.Length > 0 ? "Reference Object Inconsistencies" : ""; string type = pi.MyDifferences.ROConsistency.MyROChecks.Length > 0 ? "Reference Object Inconsistencies" : "";
if (type != string.Empty && !types.ContainsKey(0)) if (type != string.Empty && !types.ContainsKey(0))
@@ -314,14 +325,17 @@ namespace Volian.Print.Library
if (type != string.Empty && !types.ContainsKey(2)) if (type != string.Empty && !types.ContainsKey(2))
types.Add(2, type); types.Add(2, type);
} }
// types.Clear();
if (types.Count == 0) if (types.Count == 0)
{ {
h = new Phrase(); h = new Phrase
h.Font = f2; {
Font = f2
};
h.Add("No Inconsistencies"); h.Add("No Inconsistencies");
c = new PdfPCell(h); c = new PdfPCell(h)
c.Colspan = cols; {
Colspan = cols
};
t.AddCell(c); t.AddCell(c);
} }
else else
@@ -335,7 +349,7 @@ namespace Volian.Print.Library
ROFSTLookup lu = rofst.GetROFSTLookup(dvi); ROFSTLookup lu = rofst.GetROFSTLookup(dvi);
if (types.ContainsKey(0)) if (types.ContainsKey(0))
{ {
foreach (ProcedureInfo pi in MyItemInfoList) foreach (ProcedureInfo pi in MyItemInfoList.OfType<ProcedureInfo>())
{ {
foreach (ROCheck roc in pi.MyDifferences.ROConsistency.MyROChecks) foreach (ROCheck roc in pi.MyDifferences.ROConsistency.MyROChecks)
{ {
@@ -364,7 +378,7 @@ namespace Volian.Print.Library
//Dictionary<string, List<string>> trs = new Dictionary<string, List<string>>(); //Dictionary<string, List<string>> trs = new Dictionary<string, List<string>>();
if (types.ContainsKey(1)) if (types.ContainsKey(1))
{ {
foreach (ProcedureInfo pi in MyItemInfoList) foreach (ProcedureInfo pi in MyItemInfoList.OfType<ProcedureInfo>())
{ {
foreach (TransitionCheck trc in pi.MyDifferences.TransitionConsistency.MyTransitionChecks) foreach (TransitionCheck trc in pi.MyDifferences.TransitionConsistency.MyTransitionChecks)
{ {
@@ -397,7 +411,7 @@ namespace Volian.Print.Library
//Dictionary<string, List<string>> lds = new Dictionary<string, List<string>>(); //Dictionary<string, List<string>> lds = new Dictionary<string, List<string>>();
if (types.ContainsKey(2)) if (types.ContainsKey(2))
{ {
foreach (ProcedureInfo pi in MyItemInfoList) foreach (ProcedureInfo pi in MyItemInfoList.OfType<ProcedureInfo>())
{ {
foreach (LibDocCheck ldc in pi.MyDifferences.LibDocConsistency.MyLibDocChecks) foreach (LibDocCheck ldc in pi.MyDifferences.LibDocConsistency.MyLibDocChecks)
{ {
@@ -420,27 +434,37 @@ namespace Volian.Print.Library
Color badColor = new Color(System.Drawing.Color.Khaki); Color badColor = new Color(System.Drawing.Color.Khaki);
if (types.ContainsKey(0)) if (types.ContainsKey(0))
{ {
h = new Phrase(); h = new Phrase
h.Font = f2; {
Font = f2
};
h.Add(types[0]); h.Add(types[0]);
c = new PdfPCell(h); c = new PdfPCell(h)
c.Colspan = cols; {
Colspan = cols
};
t.AddCell(c); t.AddCell(c);
foreach (string rotitle in ros.Keys) foreach (string rotitle in ros.Keys)
{ {
t.AddCell(BlankCell(1)); t.AddCell(BlankCell(1));
h = new Phrase(); h = new Phrase
h.Font = f3; {
Font = f3
};
h.Add(rotitle); h.Add(rotitle);
c = new PdfPCell(h); c = new PdfPCell(h)
c.Colspan = cols - 1; {
c.BackgroundColor = goodColor; Colspan = cols - 1,
BackgroundColor = goodColor
};
t.AddCell(c); t.AddCell(c);
foreach (KeyValuePair<string,bool> d in ros[rotitle]) foreach (KeyValuePair<string,bool> d in ros[rotitle])
{ {
t.AddCell(BlankCell(2)); t.AddCell(BlankCell(2));
h = new Phrase(); h = new Phrase
h.Font = f3; {
Font = f3
};
h.Add(d.Key); h.Add(d.Key);
c = new PdfPCell(h); c = new PdfPCell(h);
if (d.Value) if (d.Value)
@@ -451,30 +475,39 @@ namespace Volian.Print.Library
} }
} }
} }
//jcb
if (types.ContainsKey(1)) if (types.ContainsKey(1))
{ {
h = new Phrase(); h = new Phrase
h.Font = f2; {
Font = f2
};
h.Add(types[1]); h.Add(types[1]);
c = new PdfPCell(h); c = new PdfPCell(h)
c.Colspan = cols; {
Colspan = cols
};
t.AddCell(c); t.AddCell(c);
foreach (string trtitle in trs.Keys) foreach (string trtitle in trs.Keys)
{ {
t.AddCell(BlankCell(1)); t.AddCell(BlankCell(1));
h = new Phrase(); h = new Phrase
h.Font = f3; {
Font = f3
};
h.Add(trtitle); h.Add(trtitle);
c = new PdfPCell(h); c = new PdfPCell(h)
c.Colspan = cols - 1; {
c.BackgroundColor = goodColor; Colspan = cols - 1,
BackgroundColor = goodColor
};
t.AddCell(c); t.AddCell(c);
foreach (KeyValuePair<string, bool> d in trs[trtitle]) foreach (KeyValuePair<string, bool> d in trs[trtitle])
{ {
t.AddCell(BlankCell(2)); t.AddCell(BlankCell(2));
h = new Phrase(); h = new Phrase
h.Font = f3; {
Font = f3
};
h.Add(d.Key); h.Add(d.Key);
c = new PdfPCell(h); c = new PdfPCell(h);
if (d.Value) if (d.Value)
@@ -488,27 +521,37 @@ namespace Volian.Print.Library
//end jcb //end jcb
if (types.ContainsKey(2)) if (types.ContainsKey(2))
{ {
h = new Phrase(); h = new Phrase
h.Font = f2; {
Font = f2
};
h.Add(types[2]); h.Add(types[2]);
c = new PdfPCell(h); c = new PdfPCell(h)
c.Colspan = cols; {
Colspan = cols
};
t.AddCell(c); t.AddCell(c);
foreach (string ldtitle in lds.Keys) foreach (string ldtitle in lds.Keys)
{ {
t.AddCell(BlankCell(1)); t.AddCell(BlankCell(1));
h = new Phrase(); h = new Phrase
h.Font = f3; {
Font = f3
};
h.Add(ldtitle); h.Add(ldtitle);
c = new PdfPCell(h); c = new PdfPCell(h)
c.Colspan = cols - 1; {
c.BackgroundColor = goodColor; Colspan = cols - 1,
BackgroundColor = goodColor
};
t.AddCell(c); t.AddCell(c);
foreach (KeyValuePair<string, bool> d in lds[ldtitle]) foreach (KeyValuePair<string, bool> d in lds[ldtitle])
{ {
t.AddCell(BlankCell(2)); t.AddCell(BlankCell(2));
h = new Phrase(); h = new Phrase
h.Font = f3; {
Font = f3
};
h.Add(d.Key); h.Add(d.Key);
c = new PdfPCell(h); c = new PdfPCell(h);
if (d.Value) if (d.Value)
+3 -6
View File
@@ -1,9 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VEPROMS.CSLA.Library;
using iTextSharp.text; using iTextSharp.text;
@@ -12,7 +7,9 @@ namespace Volian.Print.Library
public class PDFPageSize public class PDFPageSize
{ {
// C2020-002 paper size is now set in the format files - this class is use to select the page size that PROMS should be using // C2020-002 paper size is now set in the format files - this class is use to select the page size that PROMS should be using
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static Dictionary<string, Rectangle> dicPDFPageSize = new Dictionary<string, Rectangle>(); private static Dictionary<string, Rectangle> dicPDFPageSize = new Dictionary<string, Rectangle>();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static Dictionary<string, int> dicPDFPageSizePnts = new Dictionary<string, int>(); private static Dictionary<string, int> dicPDFPageSizePnts = new Dictionary<string, int>();
private static void BuildPDFPageSizeDic() private static void BuildPDFPageSizeDic()
{ {
File diff suppressed because it is too large Load Diff
+171 -162
View File
@@ -5,7 +5,7 @@ using VEPROMS.CSLA.Library;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text; using iTextSharp.text;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Linq;
namespace Volian.Print.Library namespace Volian.Print.Library
{ {
@@ -13,26 +13,13 @@ namespace Volian.Print.Library
public class PDFTransitionReport public class PDFTransitionReport
{ {
public event TransitionReportEvent TransitionProcessed; public event TransitionReportEvent TransitionProcessed;
private void OnTransitionProcessed(object sender, EventArgs args) private void OnTransitionProcessed(object sender, EventArgs args) => TransitionProcessed?.Invoke(sender, args);
{
if (TransitionProcessed != null) TransitionProcessed(sender, args);
}
public event TransitionReportEvent ProcedureProcessed; public event TransitionReportEvent ProcedureProcessed;
private void OnProcedureProcessed(object sender, EventArgs args) private void OnProcedureProcessed(object sender, EventArgs args) => ProcedureProcessed?.Invoke(sender, args);
{
if (ProcedureProcessed != null) ProcedureProcessed(sender, args);
}
public event TransitionReportEvent DocVersionProcessed; public event TransitionReportEvent DocVersionProcessed;
private void OnDocVersionProcessed(object sender, EventArgs args) private void OnDocVersionProcessed(object sender, EventArgs args) => DocVersionProcessed?.Invoke(sender, args);
{
if (DocVersionProcessed != null) DocVersionProcessed(sender, args); public string FileName { get; set; }
}
private string _FileName;
public string FileName
{
get { return _FileName; }
set { _FileName = value; }
}
private PdfPCell _CurrentPageNumberCell = null; private PdfPCell _CurrentPageNumberCell = null;
private int _CurrentPageNumber = 1; private int _CurrentPageNumber = 1;
public int CurrentPageNumber public int CurrentPageNumber
@@ -51,41 +38,27 @@ namespace Volian.Print.Library
} }
} }
} }
private FolderInfo folderInfo; private readonly FolderInfo folderInfo;
private ProcedureInfo procedureInfo; private ProcedureInfo procedureInfo;
private TransitionInfoList transitionInfoList; private TransitionInfoList transitionInfoList;
private int _TransitionInfoCount;
public int TransitionInfoCount public int TransitionInfoCount { get; set; }
{ public List<DocVersionInfo> MyDocVersionList { get; set; }
get { return _TransitionInfoCount; } public int ProcedureCount { get; set; }
set { _TransitionInfoCount = value; } private readonly string _PaperSize = "Letter";
}
private List<DocVersionInfo> _MyDocVersionList;
public List<DocVersionInfo> MyDocVersionList
{
get { return _MyDocVersionList; }
set { _MyDocVersionList = value; }
}
private int _ProcedureCount;
public int ProcedureCount
{
get { return _ProcedureCount; }
set { _ProcedureCount = value; }
}
private string _PaperSize = "Letter";
public PDFTransitionReport(FolderInfo fi, string fileName) public PDFTransitionReport(FolderInfo fi, string fileName)
{ {
_FileName = fileName; FileName = fileName;
folderInfo = fi; folderInfo = fi;
if (fi.ActiveFormat != null) if (fi.ActiveFormat != null)
_PaperSize = fi.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files _PaperSize = fi.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files
} }
public PDFTransitionReport(ProcedureInfo pi, string fileName) public PDFTransitionReport(ProcedureInfo pi, string fileName)
{ {
_FileName = fileName; FileName = fileName;
procedureInfo = pi; procedureInfo = pi;
transitionInfoList = TransitionInfoList.GetTransitionReportData(procedureInfo.MyDocVersion.VersionID, procedureInfo.ItemID); transitionInfoList = TransitionInfoList.GetTransitionReportData(procedureInfo.MyDocVersion.VersionID, procedureInfo.ItemID);
_TransitionInfoCount = transitionInfoList.Count; TransitionInfoCount = transitionInfoList.Count;
_PaperSize = pi.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files _PaperSize = pi.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files
} }
public void BuildTransitionReport() public void BuildTransitionReport()
@@ -100,13 +73,13 @@ namespace Volian.Print.Library
if (MyDocVersionList.Count == 1) if (MyDocVersionList.Count == 1)
{ {
DocVersionInfo dvi = MyDocVersionList[0]; DocVersionInfo dvi = MyDocVersionList[0];
foreach (ProcedureInfo pi in dvi.Procedures) foreach (ProcedureInfo pi in dvi.Procedures.OfType<ProcedureInfo>())
{ {
procedureInfo = pi; procedureInfo = pi;
transitionInfoList = TransitionInfoList.GetTransitionReportData(dvi.VersionID, procedureInfo.ItemID); transitionInfoList = TransitionInfoList.GetTransitionReportData(dvi.VersionID, procedureInfo.ItemID);
if (transitionInfoList.Count > 0) if (transitionInfoList.Count > 0)
{ {
_TransitionInfoCount = transitionInfoList.Count; TransitionInfoCount = transitionInfoList.Count;
OnProcedureProcessed(this, new EventArgs()); OnProcedureProcessed(this, new EventArgs());
BuildProcedureReport(document); BuildProcedureReport(document);
} }
@@ -122,11 +95,11 @@ namespace Volian.Print.Library
{ {
ProcedureCount = dvi.Procedures.Count; ProcedureCount = dvi.Procedures.Count;
OnDocVersionProcessed(this, new EventArgs()); OnDocVersionProcessed(this, new EventArgs());
foreach (ProcedureInfo pi in dvi.Procedures) foreach (ProcedureInfo pi in dvi.Procedures.OfType<ProcedureInfo>())
{ {
procedureInfo = pi; procedureInfo = pi;
transitionInfoList = TransitionInfoList.GetTransitionReportData(dvi.VersionID, procedureInfo.ItemID); transitionInfoList = TransitionInfoList.GetTransitionReportData(dvi.VersionID, procedureInfo.ItemID);
_TransitionInfoCount = transitionInfoList.Count; TransitionInfoCount = transitionInfoList.Count;
OnProcedureProcessed(this, new EventArgs()); OnProcedureProcessed(this, new EventArgs());
BuildProcedureReport(document); BuildProcedureReport(document);
} }
@@ -140,7 +113,6 @@ namespace Volian.Print.Library
} }
catch (Exception ex) catch (Exception ex)
{ {
StringBuilder msg = new StringBuilder();
document.Add(new Paragraph("Error:")); document.Add(new Paragraph("Error:"));
while (ex != null) while (ex != null)
{ {
@@ -160,10 +132,12 @@ namespace Volian.Print.Library
} }
PdfOutline outline = null; PdfOutline outline = null;
ProcedureInfo lastProcedureInfo = null; ProcedureInfo lastProcedureInfo = null;
private PdfPTable BuildProcedurePDFTable(Dictionary<int, string> levels, Dictionary<int, iTextSharp.text.Font> fonts, int cols, int paddingBottom, int level, iTextSharp.text.Document doc) private PdfPTable BuildProcedurePDFTable(Dictionary<int, string> levels, Dictionary<int, iTextSharp.text.Font> fonts, int cols, int paddingBottom, int level)
{ {
PdfPTable t = new PdfPTable(cols); PdfPTable t = new PdfPTable(cols)
t.HeaderRows = 4; {
HeaderRows = 4
};
t.DefaultCell.Padding = 4; t.DefaultCell.Padding = 4;
t.WidthPercentage = 100; t.WidthPercentage = 100;
float[] widths; float[] widths;
@@ -173,30 +147,40 @@ namespace Volian.Print.Library
widths = new float[] { 33f, 47f, 20f }; widths = new float[] { 33f, 47f, 20f };
t.SetWidths(widths); t.SetWidths(widths);
//report title //report title
Phrase h = new Phrase(); Phrase h = new Phrase
h.Font = fonts[1]; {
Font = fonts[1]
};
if (folderInfo != null) if (folderInfo != null)
h.Add(string.Format("Procedure Set {0} Transition Report", folderInfo.Name)); h.Add(string.Format("Procedure Set {0} Transition Report", folderInfo.Name));
else else
h.Add("Transition Report"); h.Add("Transition Report");
PdfPCell c = new PdfPCell(h); PdfPCell c = new PdfPCell(h)
c.Colspan = cols-1; {
c.HorizontalAlignment = Element.ALIGN_LEFT; Colspan = cols - 1,
c.PaddingBottom = paddingBottom; HorizontalAlignment = Element.ALIGN_LEFT,
c.BackgroundColor = new Color(System.Drawing.Color.DarkGoldenrod); PaddingBottom = paddingBottom,
BackgroundColor = new Color(System.Drawing.Color.DarkGoldenrod)
};
t.AddCell(c); t.AddCell(c);
//date generated //date generated
h = new Phrase(); h = new Phrase
h.Font = fonts[4]; {
Font = fonts[4]
};
h.Add(DateTime.Now.ToString("dddd MMMM d, yyyy @ h:mm tt")); h.Add(DateTime.Now.ToString("dddd MMMM d, yyyy @ h:mm tt"));
c = new PdfPCell(h); c = new PdfPCell(h)
c.HorizontalAlignment = Element.ALIGN_RIGHT; {
c.PaddingBottom = paddingBottom; HorizontalAlignment = Element.ALIGN_RIGHT,
c.BackgroundColor = new Color(System.Drawing.Color.DarkGoldenrod); PaddingBottom = paddingBottom,
BackgroundColor = new Color(System.Drawing.Color.DarkGoldenrod)
};
t.AddCell(c); t.AddCell(c);
//procedure title //procedure title
h = new Phrase(); h = new Phrase
h.Font = fonts[2]; {
Font = fonts[2]
};
h.Add(string.Format("{0} - {1}", procedureInfo.DisplayNumber, procedureInfo.DisplayText)); h.Add(string.Format("{0} - {1}", procedureInfo.DisplayNumber, procedureInfo.DisplayText));
PdfDestination dest = new PdfDestination(PdfDestination.FITH, cb.PdfDocument.PageSize.Height); PdfDestination dest = new PdfDestination(PdfDestination.FITH, cb.PdfDocument.PageSize.Height);
if (lastProcedureInfo != procedureInfo) if (lastProcedureInfo != procedureInfo)
@@ -204,19 +188,23 @@ namespace Volian.Print.Library
outline = new PdfOutline(cb.RootOutline, dest, procedureInfo.DisplayNumber, false); outline = new PdfOutline(cb.RootOutline, dest, procedureInfo.DisplayNumber, false);
lastProcedureInfo = procedureInfo; lastProcedureInfo = procedureInfo;
} }
c = new PdfPCell(h); c = new PdfPCell(h)
c.Colspan = cols-1; {
c.HorizontalAlignment = Element.ALIGN_LEFT; Colspan = cols - 1,
c.PaddingBottom = paddingBottom; HorizontalAlignment = Element.ALIGN_LEFT,
c.BackgroundColor = new Color(System.Drawing.Color.Goldenrod); PaddingBottom = paddingBottom,
BackgroundColor = new Color(System.Drawing.Color.Goldenrod)
};
t.AddCell(c); t.AddCell(c);
//page number //page number
_CurrentPageNumberCell = BuildCell(1, string.Format("Page {0}",CurrentPageNumber), fonts[4], new Color(System.Drawing.Color.Goldenrod)); _CurrentPageNumberCell = BuildCell(1, string.Format("Page {0}",CurrentPageNumber), fonts[4], new Color(System.Drawing.Color.Goldenrod));
_CurrentPageNumberCell.PaddingBottom = paddingBottom; _CurrentPageNumberCell.PaddingBottom = paddingBottom;
t.AddCell(_CurrentPageNumberCell); t.AddCell(_CurrentPageNumberCell);
//transition category //transition category
h = new Phrase(); h = new Phrase
h.Font = fonts[3]; {
Font = fonts[3]
};
if (transitionInfoList.Count == 0) if (transitionInfoList.Count == 0)
h.Add("N/A"); h.Add("N/A");
else else
@@ -225,36 +213,50 @@ namespace Volian.Print.Library
dest = new PdfDestination(PdfDestination.FITH, cb.PdfDocument.PageSize.Height); dest = new PdfDestination(PdfDestination.FITH, cb.PdfDocument.PageSize.Height);
new PdfOutline(outline, dest, levels[level]); new PdfOutline(outline, dest, levels[level]);
} }
c = new PdfPCell(h); c = new PdfPCell(h)
c.Colspan = cols; {
c.HorizontalAlignment = Element.ALIGN_LEFT; Colspan = cols,
c.PaddingBottom = paddingBottom; HorizontalAlignment = Element.ALIGN_LEFT,
c.BackgroundColor = new Color(System.Drawing.Color.Khaki); PaddingBottom = paddingBottom,
BackgroundColor = new Color(System.Drawing.Color.Khaki)
};
t.AddCell(c); t.AddCell(c);
//add column headers //add column headers
h = new Phrase(); h = new Phrase
h.Font = fonts[4]; {
Font = fonts[4]
};
h.Add("From Procedure Location"); h.Add("From Procedure Location");
c = new PdfPCell(h); c = new PdfPCell(h)
c.HorizontalAlignment = Element.ALIGN_CENTER; {
c.PaddingBottom = paddingBottom; HorizontalAlignment = Element.ALIGN_CENTER,
c.BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod); PaddingBottom = paddingBottom,
BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod)
};
t.AddCell(c); t.AddCell(c);
h = new Phrase(); h = new Phrase
h.Font = fonts[4]; {
Font = fonts[4]
};
h.Add("From Procedure Text"); h.Add("From Procedure Text");
c = new PdfPCell(h); c = new PdfPCell(h)
c.HorizontalAlignment = Element.ALIGN_CENTER; {
c.PaddingBottom = paddingBottom; HorizontalAlignment = Element.ALIGN_CENTER,
c.BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod); PaddingBottom = paddingBottom,
BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod)
};
t.AddCell(c); t.AddCell(c);
h = new Phrase(); h = new Phrase
h.Font = fonts[4]; {
Font = fonts[4]
};
h.Add("To Procedure Location"); h.Add("To Procedure Location");
c = new PdfPCell(h); c = new PdfPCell(h)
c.HorizontalAlignment = Element.ALIGN_CENTER; {
c.PaddingBottom = paddingBottom; HorizontalAlignment = Element.ALIGN_CENTER,
c.BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod); PaddingBottom = paddingBottom,
BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod)
};
t.AddCell(c); t.AddCell(c);
return t; return t;
} }
@@ -262,37 +264,45 @@ namespace Volian.Print.Library
private void BuildProcedureReport(iTextSharp.text.Document doc) private void BuildProcedureReport(iTextSharp.text.Document doc)
{ {
Dictionary<int, string> tranTypes = FormatInfo.GetTransitionTypesByFormatID(procedureInfo.ActiveFormat.FormatID); Dictionary<int, string> tranTypes = FormatInfo.GetTransitionTypesByFormatID(procedureInfo.ActiveFormat.FormatID);
Dictionary<int, string> levels = new Dictionary<int, string>(); Dictionary<int, string> levels = new Dictionary<int, string>
levels.Add(1, "Internal Transitions"); {
levels.Add(2, "External From Transitions"); { 1, "Internal Transitions" },
levels.Add(3, "External To Transitions"); { 2, "External From Transitions" },
levels.Add(4, "Outside From Transitions"); { 3, "External To Transitions" },
levels.Add(5, "Outside To Transitions"); { 4, "Outside From Transitions" },
Dictionary<int, iTextSharp.text.Font> fonts = new Dictionary<int, Font>(); { 5, "Outside To Transitions" }
};
Dictionary<int, iTextSharp.text.Font> fonts = new Dictionary<int, Font>
{
// C2017-036 get best available proportional font for symbols that looks close to Arial // C2017-036 get best available proportional font for symbols that looks close to Arial
// Note that Microsoft no longer supplies Arial Unicode MS as of Word16 // Note that Microsoft no longer supplies Arial Unicode MS as of Word16
fonts.Add(1, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 12, 0, Color.BLACK)); { 1, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 12, 0, Color.BLACK) },
fonts.Add(2, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 0, Color.BLACK)); { 2, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 0, Color.BLACK) },
fonts.Add(3, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK)); { 3, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK) },
fonts.Add(4, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK)); { 4, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK) }
};
int lastLevel = transitionInfoList.Count > 0 ? transitionInfoList[0].Level : 0; //set level to first transition level int lastLevel = transitionInfoList.Count > 0 ? transitionInfoList[0].Level : 0; //set level to first transition level
#region buildtable #region buildtable
int cols = 3; int cols = 3;
int paddingBottom = 6; int paddingBottom = 6;
if (folderInfo != null) if (folderInfo != null)
doc.NewPage(); doc.NewPage();
PdfPTable t = BuildProcedurePDFTable(levels, fonts, cols, paddingBottom, lastLevel, doc); PdfPTable t = BuildProcedurePDFTable(levels, fonts, cols, paddingBottom, lastLevel);
#endregion #endregion
//gather data //gather data
if (transitionInfoList.Count == 0) if (transitionInfoList.Count == 0)
{ {
Phrase h = new Phrase(); Phrase h = new Phrase
h.Font = fonts[4]; {
Font = fonts[4]
};
h.Add("This procedure contains no transitions"); h.Add("This procedure contains no transitions");
PdfPCell c = new PdfPCell(h); PdfPCell c = new PdfPCell(h)
c.Colspan = cols; {
c.HorizontalAlignment = Element.ALIGN_LEFT; Colspan = cols,
c.PaddingBottom = paddingBottom; HorizontalAlignment = Element.ALIGN_LEFT,
PaddingBottom = paddingBottom
};
t.AddCell(c); t.AddCell(c);
} }
else else
@@ -308,36 +318,48 @@ namespace Volian.Print.Library
doc.Add(t); doc.Add(t);
doc.NewPage(); doc.NewPage();
lastLevel = ti.Level; lastLevel = ti.Level;
t = BuildProcedurePDFTable(levels, fonts, cols, paddingBottom, lastLevel, doc); t = BuildProcedurePDFTable(levels, fonts, cols, paddingBottom, lastLevel);
} }
} }
//add from path //add from path
Phrase h = new Phrase(); Phrase h = new Phrase
h.Font = fonts[4]; {
Font = fonts[4]
};
h.Add(StripProcInfo(ti.PathFrom, procedureInfo)); h.Add(StripProcInfo(ti.PathFrom, procedureInfo));
PdfPCell c = new PdfPCell(h); PdfPCell c = new PdfPCell(h)
c.HorizontalAlignment = Element.ALIGN_LEFT; {
c.PaddingBottom = paddingBottom; HorizontalAlignment = Element.ALIGN_LEFT,
PaddingBottom = paddingBottom
};
if (lastLevel > 1 && (!tranTypes[ti.TranType].Contains("{Proc") && !tranTypes[ti.TranType].Contains("other procedure"))) c.BackgroundColor = new Color(System.Drawing.Color.LightCoral); if (lastLevel > 1 && (!tranTypes[ti.TranType].Contains("{Proc") && !tranTypes[ti.TranType].Contains("other procedure"))) c.BackgroundColor = new Color(System.Drawing.Color.LightCoral);
t.AddCell(c); t.AddCell(c);
//add from text //add from text
h = new Phrase(); h = new Phrase
h.Font = fonts[4]; {
Font = fonts[4]
};
ItemInfo myItemInfo = ti.MyContent.ContentItems[0]; ItemInfo myItemInfo = ti.MyContent.ContentItems[0];
h.Add(GetTextPath(myItemInfo, 0)); h.Add(GetTextPath(myItemInfo, 0));
c = new PdfPCell(h); c = new PdfPCell(h)
c.HorizontalAlignment = Element.ALIGN_LEFT; {
c.PaddingBottom = paddingBottom; HorizontalAlignment = Element.ALIGN_LEFT,
PaddingBottom = paddingBottom
};
if (lastLevel > 1 && (!tranTypes[ti.TranType].Contains("{Proc") && !tranTypes[ti.TranType].Contains("other procedure"))) c.BackgroundColor = new Color(System.Drawing.Color.LightCoral); if (lastLevel > 1 && (!tranTypes[ti.TranType].Contains("{Proc") && !tranTypes[ti.TranType].Contains("other procedure"))) c.BackgroundColor = new Color(System.Drawing.Color.LightCoral);
t.AddCell(c); t.AddCell(c);
//add to text //add to text
h = new Phrase(); h = new Phrase
h.Font = fonts[4]; {
Font = fonts[4]
};
myItemInfo = ti.MyItemToID; myItemInfo = ti.MyItemToID;
h.Add(GetTextPath(myItemInfo, ti.Level)); h.Add(GetTextPath(myItemInfo, ti.Level));
c = new PdfPCell(h); c = new PdfPCell(h)
c.HorizontalAlignment = Element.ALIGN_LEFT; {
c.PaddingBottom = paddingBottom; HorizontalAlignment = Element.ALIGN_LEFT,
PaddingBottom = paddingBottom
};
if (lastLevel > 1 && (!tranTypes[ti.TranType].Contains("{Proc") && !tranTypes[ti.TranType].Contains("other procedure"))) c.BackgroundColor = new Color(System.Drawing.Color.LightCoral); if (lastLevel > 1 && (!tranTypes[ti.TranType].Contains("{Proc") && !tranTypes[ti.TranType].Contains("other procedure"))) c.BackgroundColor = new Color(System.Drawing.Color.LightCoral);
t.AddCell(c); t.AddCell(c);
} }
@@ -357,16 +379,16 @@ namespace Volian.Print.Library
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (myItemInfo.IsProcedure) if (myItemInfo.IsProcedure)
return myItemInfo.MyProcedure.DisplayNumber + " " + myItemInfo.MyProcedure.DisplayText; return $"{myItemInfo.MyProcedure.DisplayNumber} {myItemInfo.MyProcedure.DisplayText}";
if (myItemInfo.IsSection) if (myItemInfo.IsSection)
{ {
if (level > 1) if (level > 1)
return myItemInfo.MyProcedure.DisplayNumber + " " + myItemInfo.MyProcedure.DisplayText + "\r\n " + myItemInfo.DisplayText; return $"{myItemInfo.MyProcedure.DisplayNumber} {myItemInfo.MyProcedure.DisplayText}\r\n {myItemInfo.DisplayText}";
else else
return myItemInfo.DisplayText; return myItemInfo.DisplayText;
} }
if (myItemInfo.IsHigh) if (myItemInfo.IsHigh)
return myItemInfo.ActiveSection.DisplayText + "\r\n " + myItemInfo.DisplayText; return $"{myItemInfo.ActiveSection.DisplayText}\r\n {myItemInfo.DisplayText}";
else else
{ {
string tmp = ""; string tmp = "";
@@ -393,10 +415,6 @@ namespace Volian.Print.Library
} }
return sb.ToString(); return sb.ToString();
} }
public void BuildTransitionReport(FolderInfo fi)
{
System.Windows.Forms.MessageBox.Show("folder");
}
private bool CreateResultsPDF(iTextSharp.text.Document document) private bool CreateResultsPDF(iTextSharp.text.Document document)
{ {
bool result = false; bool result = false;
@@ -404,26 +422,20 @@ namespace Volian.Print.Library
int i = 0; int i = 0;
// just for safety, the while loop expects to find a file extension // just for safety, the while loop expects to find a file extension
// so make sure it has one before going into the loop // so make sure it has one before going into the loop
if (!_FileName.ToUpper().EndsWith(".PDF")) if (!FileName.ToUpper().EndsWith(".PDF"))
_FileName += ".pdf"; FileName += ".pdf";
// Try to open a file for creating the PDF. // Try to open a file for creating the PDF.
while (result == false) while (result == false)
{ {
string fileName = _FileName; string fileName = FileName;
// Bug fix: B2013-086
// the folder path part of _FileName contained a folder name with a period
// resulting is an invalid file location/file name.
// Changed the IndexOf call to the LastIndexOf
//int loc = fileName.IndexOf(".");
int loc = fileName.LastIndexOf("."); int loc = fileName.LastIndexOf(".");
if (loc > -1) if (loc > -1)
{ {
string fname = fileName.Substring(0, loc); string fname = fileName.Substring(0, loc);
fileName = fname + suffix + ".pdf"; fileName = $"{fname}{suffix}.pdf";
} }
else else
fileName = fileName + suffix + ".pdf"; fileName = $"{fileName}{suffix}.pdf";
// string fileName = _FileName.ToLower().Replace(".pdf", suffix + ".pdf");
try try
{ {
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create)); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create));
@@ -431,7 +443,7 @@ namespace Volian.Print.Library
document.SetMargins(36, 36, 36, 36); document.SetMargins(36, 36, 36, 36);
document.Open(); document.Open();
cb = writer.DirectContent; cb = writer.DirectContent;
_FileName = fileName; FileName = fileName;
result = true; result = true;
} }
catch (System.IO.IOException exIO) catch (System.IO.IOException exIO)
@@ -468,28 +480,25 @@ namespace Volian.Print.Library
} }
System.Windows.Forms.MessageBox.Show(msg.ToString(), "Error during PDF creation for search:", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); System.Windows.Forms.MessageBox.Show(msg.ToString(), "Error during PDF creation for search:", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
} }
private PdfPCell BlankCell(int colSpan)
{
PdfPCell c = new PdfPCell();
c.Colspan = colSpan;
c.Border = 0;
return c;
}
private PdfPCell BuildCell(int colspan, string txt, Font f, iTextSharp.text.Color clr) private PdfPCell BuildCell(int colspan, string txt, Font f, iTextSharp.text.Color clr)
{ {
Phrase h = new Phrase(); Phrase h = new Phrase
h.Font = f; {
Font = f
};
h.Add(txt); h.Add(txt);
PdfPCell c = new PdfPCell(h); PdfPCell c = new PdfPCell(h)
c.HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT; {
c.Colspan = colspan; HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT,
c.BackgroundColor = clr; Colspan = colspan,
BackgroundColor = clr
};
return c; return c;
} }
} }
public class MyPageEvent : PdfPageEventHelper public class MyPageEvent : PdfPageEventHelper
{ {
private PDFTransitionReport _rpt = null; private readonly PDFTransitionReport _rpt = null;
public MyPageEvent(PDFTransitionReport rpt) public MyPageEvent(PDFTransitionReport rpt)
{ {
_rpt = rpt; _rpt = rpt;
+16 -57
View File
@@ -1,39 +1,22 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using iTextSharp.text; using iTextSharp.text;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using Volian.Svg.Library;
namespace Volian.Print.Library namespace Volian.Print.Library
{ {
public class PageCount public class PageCount
{ {
private bool _CanIncrement = true; public bool CanIncrement { get; set; } = true;
public bool CanIncrement
{
get { return _CanIncrement; }
set { _CanIncrement = value; }
}
private int Increment() private int Increment()
{ {
if (CanIncrement) Total++; if (CanIncrement) Total++;
CanIncrement = false; CanIncrement = false;
return Total; return Total;
} }
private int _Total;
public int Total
{
get { return _Total; }
set { _Total = value; }
}
private string _FinalPageMessage;
public string FinalPageMessage public int Total { get; set; }
{
get { return _FinalPageMessage; } public string FinalPageMessage { get; set; }
set { _FinalPageMessage = value; }
}
private PageCountTemplates _MyTemplates; // (for each page that has this key) private PageCountTemplates _MyTemplates; // (for each page that has this key)
internal PageCountTemplates MyTemplates internal PageCountTemplates MyTemplates
{ {
@@ -53,10 +36,10 @@ namespace Volian.Print.Library
foreach (PageCountTemplate pct in MyTemplates) foreach (PageCountTemplate pct in MyTemplates)
{ {
cnt++; cnt++;
string fstr = pct.Text.Replace("{OF}", _Total.ToString()); string fstr = pct.Text.Replace("{OF}", Total.ToString());
if (pct.Text.Contains("{TOCPAGE}")) if (pct.Text.Contains("{TOCPAGE}"))
{ {
fstr = pct.Text.Replace("{TOCPAGE}", _Total.ToString()); fstr = pct.Text.Replace("{TOCPAGE}", Total.ToString());
} }
if (fstr.Contains("{FINALPAGE}")) if (fstr.Contains("{FINALPAGE}"))
{ {
@@ -140,45 +123,21 @@ namespace Volian.Print.Library
public class PageCountTemplate public class PageCountTemplate
{ {
private string _Text;
public string Text // "Page 1 of {OF}" public string Text // "Page 1 of {OF}"
{ { get; set; }
get { return _Text; } public System.Drawing.Font MyFont { get; set; }
set { _Text = value; } public int Alignment { get; set; }
} public System.Drawing.Color MyColor { get; set; }
private System.Drawing.Font _MyFont; public PdfTemplate MyTemplate { get; set; }
public System.Drawing.Font MyFont
{
get { return _MyFont; }
set { _MyFont = value; }
}
private int _Alignment; // iTextSharp Element.<XYZ>
public int Alignment
{
get { return _Alignment; }
set { _Alignment = value; }
}
private System.Drawing.Color _MyColor;
public System.Drawing.Color MyColor
{
get { return _MyColor; }
set { _MyColor = value; }
}
private PdfTemplate _MyTemplate;
public PdfTemplate MyTemplate
{
get { return _MyTemplate; }
set { _MyTemplate = value; }
}
public PageCountTemplate(PdfWriter pdfWriter, string text, System.Drawing.Font myFont, int alignment, System.Drawing.Color color) public PageCountTemplate(PdfWriter pdfWriter, string text, System.Drawing.Font myFont, int alignment, System.Drawing.Color color)
{ {
// Create Template can be called with a small, i.e. 1, width/height because when // Create Template can be called with a small, i.e. 1, width/height because when
// it is actually drawn, the bounding box overrides the CreateTemplate values. // it is actually drawn, the bounding box overrides the CreateTemplate values.
_MyTemplate = pdfWriter.DirectContent.CreateTemplate(1, 1); MyTemplate = pdfWriter.DirectContent.CreateTemplate(1, 1);
_Text = text; Text = text;
_MyFont = myFont; MyFont = myFont;
_MyColor = color; MyColor = color;
_Alignment = alignment; Alignment = alignment;
} }
} }
public class PageCountTemplates : List<PageCountTemplate> public class PageCountTemplates : List<PageCountTemplate>
+51 -204
View File
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using Volian.Base.Library; using Volian.Base.Library;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
@@ -10,40 +9,16 @@ namespace Volian.Print.Library
{ {
public partial class vlnParagraph public partial class vlnParagraph
{ {
private string _PageBreakReason = null; public string PageBreakReason { get; set; } = null;
public string PageBreakReason public bool CompressPartOfStep { get; set; } = false;
{ public bool CompressFirstPartOfStep { get; set; } = false;
get { return _PageBreakReason; } public bool BreakHighLevelStepWithSection { get; set; } = false;
set { _PageBreakReason = value; }
}
private bool _CompressPartOfStep = false;
public bool CompressPartOfStep
{
get { return _CompressPartOfStep; }
set { _CompressPartOfStep = value; }
}
private bool _CompressFirstPartOfStep = false;
public bool CompressFirstPartOfStep
{
get { return _CompressFirstPartOfStep; }
set { _CompressFirstPartOfStep = value; }
}
private bool _BreakHighLevelStepWithSection = false;
public bool BreakHighLevelStepWithSection
{
get { return _BreakHighLevelStepWithSection; }
set { _BreakHighLevelStepWithSection = value; }
}
/// <summary> /// <summary>
/// This variable is used to match 16 bit pagination /// This variable is used to match 16 bit pagination
/// </summary> /// </summary>
private bool _Match16BitPagination = false; private readonly bool _Match16BitPagination = false;
private bool _CompressFoldout = false;
public bool CompressFoldout public bool CompressFoldout { get; set; } = false;
{
get { return _CompressFoldout; }
set { _CompressFoldout = value; }
}
/// <summary> /// <summary>
/// Dtermines if the current step is preceded by a Page Break /// Dtermines if the current step is preceded by a Page Break
/// </summary> /// </summary>
@@ -85,8 +60,8 @@ namespace Volian.Print.Library
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.SupInfoPdfPrint) if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.SupInfoPdfPrint)
{ {
int retval = 0; int retval = 0;
SectionInfo supInfoSect = MyItemInfo.ActiveSection as SectionInfo; // C2018-003 fixed use of getting the active section // C2018-003 fixed use of getting the active section
if (supInfoSect != null && supInfoSect.StepSectPageBreaksForSupInfo != null && supInfoSect.StepSectPageBreaksForSupInfo.Contains(MyItemInfo.ItemID)) if (MyItemInfo.ActiveSection is SectionInfo supInfoSect && supInfoSect.StepSectPageBreaksForSupInfo != null && supInfoSect.StepSectPageBreaksForSupInfo.Contains(MyItemInfo.ItemID))
{ {
MyPromsPrinter.SupInfoPdfPageCount++; MyPromsPrinter.SupInfoPdfPageCount++;
retval = 1; retval = 1;
@@ -141,13 +116,12 @@ namespace Volian.Print.Library
if (MyItemInfo.MyParent.IsHigh && MyItemInfo.IsNote && (MyItemInfo.MyParent.Cautions == null || MyItemInfo.MyParent.Cautions.Count == 0) && MyItemInfo.MyPrevious == null) return 1; if (MyItemInfo.MyParent.IsHigh && MyItemInfo.IsNote && (MyItemInfo.MyParent.Cautions == null || MyItemInfo.MyParent.Cautions.Count == 0) && MyItemInfo.MyPrevious == null) return 1;
// if this is a substep that has a preferredpage break, and it has caution/note that is where the page break had to go // if this is a substep that has a preferredpage break, and it has caution/note that is where the page break had to go
if (MyItemInfo.IsSubStep && ChildrenAbove != null && ChildrenAbove.Count > 0) return 0; if (MyItemInfo.IsSubStep && ChildrenAbove != null && ChildrenAbove.Count > 0) return 0;
// B2017-228: The following flags a break within the step. Before returning a '2' (flags break within step), clear it out of the
// ParaBreaks. Without the 'RemoveAt', a page break will occur after this step also.
string reason = "Unknown";
if (MyPageHelper.ParaBreaks != null && MyPageHelper.ParaBreaks.Count > 0 && this == MyPageHelper.ParaBreaks[0]) if (MyPageHelper.ParaBreaks != null && MyPageHelper.ParaBreaks.Count > 0 && this == MyPageHelper.ParaBreaks[0])
{ {
MyPageHelper.ParaBreaks.RemoveAt(0); MyPageHelper.ParaBreaks.RemoveAt(0);
reason = AddReason("Partial Step - Case 1"); // B2017-228: The following flags a break within the step. Before returning a '2' (flags break within step), clear it out of the
// ParaBreaks. Without the 'RemoveAt', a page break will occur after this step also.
string reason = AddReason("Partial Step - Case 1");
ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
} }
return 2; return 2;
@@ -157,8 +131,8 @@ namespace Volian.Print.Library
// if the EndForSingle format flag is set to false, then we do not print an End message if the section // if the EndForSingle format flag is set to false, then we do not print an End message if the section
// is a single column section. // is a single column section.
//bool _skipEndMessage = MyPageHelper.MySection.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.EndForSingle; //bool _skipEndMessage = MyPageHelper.MySection.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.EndForSingle;
SectionInfo si = MyItemInfo.ActiveSection as SectionInfo; // C2018-003 fixed use of getting the active section // C2018-003 fixed use of getting the active section
bool _skipEndMessage = si != null && si.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.EndForSingle; bool _skipEndMessage = MyItemInfo.ActiveSection is SectionInfo si && 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 // 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 // that has an end message that needs to be accounted for in determining pagination. To do that the last
@@ -171,7 +145,7 @@ namespace Volian.Print.Library
// line above the end message, thus 2 not 3. This change was made on July 20, 2011 by RHM & KBR. The // line above the end message, thus 2 not 3. This change was made on July 20, 2011 by RHM & KBR. The
// procedure in questions was VEWCNEMG\EMGAPP.PRC, ES-01, Step 8. // procedure in questions was VEWCNEMG\EMGAPP.PRC, ES-01, Step 8.
//float yEndMsg = !_skipEndMessage && !MyItemInfo.IsSection && MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.NextItem == null && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0; //float yEndMsg = !_skipEndMessage && !MyItemInfo.IsSection && MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.NextItem == null && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0;
float yEndMsg = (!_skipEndMessage && !MyItemInfo.IsSection && MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.NextItem == null)? GetEndMessageHeight(MyItemInfo.MyDocStyle) : 0; // B2018-068 account for mult-line End Messages float yEndMsg = (!_skipEndMessage && !MyItemInfo.IsSection && MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.NextItem == null)? GetEndMessageHeight() : 0; // B2018-068 account for mult-line End Messages
// also consider if there is a phone list at the bottom of the page, add the amount of space the phone // also consider if there is a phone list at the bottom of the page, add the amount of space the phone
// list requires onto yEndMsg to make it easier to figure out pagination (include an extra line for the // list requires onto yEndMsg to make it easier to figure out pagination (include an extra line for the
@@ -196,7 +170,7 @@ namespace Volian.Print.Library
// location of a pagebreak. ParaBreaks contains the paragraphs that break within a step. // location of a pagebreak. ParaBreaks contains the paragraphs that break within a step.
if (MyPageHelper.ParaBreaks.Count > 0) if (MyPageHelper.ParaBreaks.Count > 0)
{ {
string reason = "Unknown"; string reason;
// if on current step and it is also the substep that will cause a pagebreak, i.e. the top substep in pagebreaks[[0]: // if on current step and it is also the substep that will cause a pagebreak, i.e. the top substep in pagebreaks[[0]:
if (this == MyPageHelper.ParaBreaks[0]) if (this == MyPageHelper.ParaBreaks[0])
{ {
@@ -230,14 +204,7 @@ namespace Volian.Print.Library
// B2018-065 Calvert's continue message was not including the substep number in AOP-1A Attachment 1, added AERandRNO check // B2018-065 Calvert's continue message was not including the substep number in AOP-1A Attachment 1, added AERandRNO check
else if (!MyPageHelper.ParaBreaks[0].PageBreakOnStep && this.YTopMost >= MyPageHelper.ParaBreaks[0].YTopMost && AERandRNO(this.MyItemInfo, MyPageHelper.ParaBreaks[0].MyItemInfo)) else if (!MyPageHelper.ParaBreaks[0].PageBreakOnStep && this.YTopMost >= MyPageHelper.ParaBreaks[0].YTopMost && AERandRNO(this.MyItemInfo, MyPageHelper.ParaBreaks[0].MyItemInfo))
{ {
//vlnParagraph removed = MyPageHelper.ParaBreaks[0];// 2018-081 Remember where the page break was going to be
MyPageHelper.ParaBreaks.RemoveAt(0); MyPageHelper.ParaBreaks.RemoveAt(0);
//if (MyParent == removed && MyItemInfo.IsRNOPart && MyParent.MyItemInfo.IsHigh)// B2018-081 If The High Level Step was going to break from the High Level RNO
//{
// reason = AddReason("Partial Step - Case 4B");
// ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
// return 0;
//}
reason = AddReason("Partial Step - Case 4"); reason = AddReason("Partial Step - Case 4");
ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
return 2; // break on this item within a step return 2; // break on this item within a step
@@ -276,9 +243,8 @@ namespace Volian.Print.Library
// flag SectionPageBreak is set to true to flag that a pagebreak should not be done // flag SectionPageBreak is set to true to flag that a pagebreak should not be done
// on that first step. // on that first step.
StepConfig sc = firstChild.MyItemInfo.MyConfig as StepConfig; StepConfig sc = firstChild.MyItemInfo.MyConfig as StepConfig;
ManualPageBreak = MyPageHelper.OriginalPageBreak ? (sc == null ? false : sc.Step_ManualPagebreak) : ManualPageBreak = MyPageHelper.OriginalPageBreak ? (sc != null && sc.Step_ManualPagebreak) :
sc == null ? false : sc != null && ((MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks == null) && sc.Step_NewManualPagebreak);
(MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks == null)? sc.Step_NewManualPagebreak : false;
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. // C2021-010: Remove trailing returns/spaces & manual page breaks & allow save.
if (sc != null && sc.Step_NewManualPagebreak && MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null && if (sc != null && sc.Step_NewManualPagebreak && MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null &&
!MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(firstChild.MyItemInfo.ItemID)) MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(firstChild.MyItemInfo.ItemID); !MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(firstChild.MyItemInfo.ItemID)) MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(firstChild.MyItemInfo.ItemID);
@@ -290,10 +256,7 @@ namespace Volian.Print.Library
} }
// can the title and the first step fit? // can the title and the first step fit?
// add the first child's size + (the section title's size) // add the first child's size + (the section title's size)
//if (ySizeIncludingFirst > (yLocation - yBottomMargin - SixLinesPerInch)) return 1;
//if (ySizeIncludingFirst > (yLocation - yBottomMargin) && ySizeIncludingFirst < yPageSize)
vlnParagraph firstStepChild = firstChild; vlnParagraph firstStepChild = firstChild;
//while (firstStepChild.MyItemInfo.IsSection && firstStepChild.ChildrenBelow.Count > 0) firstStepChild = firstStepChild.ChildrenBelow[0];
if (firstStepChild.MyItemInfo.IsNumbered) if (firstStepChild.MyItemInfo.IsNumbered)
while (firstStepChild.ChildrenBelow.Count > 0 && (firstStepChild.MyItemInfo.IsSection || firstStepChild.MyItemInfo.IsHigh)) while (firstStepChild.ChildrenBelow.Count > 0 && (firstStepChild.MyItemInfo.IsSection || firstStepChild.MyItemInfo.IsHigh))
{ {
@@ -308,13 +271,12 @@ namespace Volian.Print.Library
firstStepChild = firstStepChild.MyParent.ChildrenBelow[firstStepChild.MyParent.ChildrenBelow.Count - 1]; firstStepChild = firstStepChild.MyParent.ChildrenBelow[firstStepChild.MyParent.ChildrenBelow.Count - 1];
float ySizeIncludingFirstStep = firstStepChild.YSize + (firstStepChild.YTopMost - YTopMost); float ySizeIncludingFirstStep = firstStepChild.YSize + (firstStepChild.YTopMost - YTopMost);
float ySizeBtmCtnMess = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle); float ySizeBtmCtnMess = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle);
float ySizeBtmEndMess = GetBottomEndMessageSize(MyItemInfo.MyDocStyle); float ySizeBtmEndMess = GetBottomEndMessageSize();
bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > (yWithinMargins - ySizeBtmCtnMess -ySizeBtmEndMess); bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > (yWithinMargins - ySizeBtmCtnMess -ySizeBtmEndMess);
if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstChild) if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstChild)
KeepStepsOnPage = false; KeepStepsOnPage = false;
if (ySizeIncludingFirst == YSize) KeepStepsOnPage = false; if (ySizeIncludingFirst == YSize) KeepStepsOnPage = false;
//float ySectionEndMsg = !_skipEndMessage && MyItemInfo.IsSection && MyItemInfo.Steps != null && MyItemInfo.Steps.Count == 1 && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0; float ySectionEndMsg = (!_skipEndMessage && MyItemInfo.IsSection && MyItemInfo.Steps != null && MyItemInfo.Steps.Count == 1) ? GetEndMessageHeight() : 0; // B2018-068 account for mult-line End Messages
float ySectionEndMsg = (!_skipEndMessage && MyItemInfo.IsSection && MyItemInfo.Steps != null && MyItemInfo.Steps.Count == 1) ? GetEndMessageHeight(MyItemInfo.MyDocStyle) : 0; // B2018-068 account for mult-line End Messages
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0)
{ {
float vpHeight = SixLinesPerInch; float vpHeight = SixLinesPerInch;
@@ -401,11 +363,10 @@ namespace Volian.Print.Library
return 1; return 1;
} }
//MyPageHelper.HLSText = MyItemInfo.DisplayText; // save the High Level Step Text
//Console.WriteLine("{0} Paginate", MyPageHelper.HLSText); //Console.WriteLine("{0} Paginate", MyPageHelper.HLSText);
StepConfig sc1 = MyItemInfo.MyConfig as StepConfig; StepConfig sc1 = MyItemInfo.MyConfig as StepConfig;
ManualPageBreak = MyPageHelper.OriginalPageBreak ? (sc1 == null ? false : sc1.Step_ManualPagebreak) : ManualPageBreak = MyPageHelper.OriginalPageBreak ? (sc1 != null && sc1.Step_ManualPagebreak) :
sc1 == null ? false : (MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks == null) ? sc1.Step_NewManualPagebreak : false; sc1 != null && ((MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks == null) && sc1.Step_NewManualPagebreak);
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. // C2021-010: Remove trailing returns/spaces & manual page breaks & allow save.
if (sc1 != null && sc1.Step_NewManualPagebreak && if (sc1 != null && sc1.Step_NewManualPagebreak &&
MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null && !MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(MyItemInfo.ItemID)) MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(MyItemInfo.ItemID); MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null && !MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(MyItemInfo.ItemID)) MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(MyItemInfo.ItemID);
@@ -423,7 +384,6 @@ namespace Volian.Print.Library
string firstStep = "No"; string firstStep = "No";
if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null) if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null)
firstStep = "Yes"; firstStep = "Yes";
//if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins) // Don't Paginate if there is enough room, will fit on page
// Pagination Fix - Break1LineShort1 // Pagination Fix - Break1LineShort1
float yExtra = (yWithinMargins == yPageSize ? 0 : SixLinesPerInch - MyItemInfo.MyDocStyle.Layout.FooterLength) ?? 0; float yExtra = (yWithinMargins == yPageSize ? 0 : SixLinesPerInch - MyItemInfo.MyDocStyle.Layout.FooterLength) ?? 0;
// Adjust yExtra and mySize for Component List items. // Adjust yExtra and mySize for Component List items.
@@ -452,11 +412,10 @@ namespace Volian.Print.Library
// B2017-254 Fixed Pagination Logic when checking to see if the current item is the last high level step // B2017-254 Fixed Pagination Logic when checking to see if the current item is the last high level step
if (MyItemInfo.IsHigh && mySize >= (2 * SixLinesPerInch) && MyItemInfo.MyDocStyle.Layout.FooterLength > 0 && (MyItemInfo.MyDocStyle.End.Message == null || MyItemInfo.MyDocStyle.End.Message == "") && MyItemInfo.NextItem == null && (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0) && (MyItemInfo.RNOs == null || MyItemInfo.RNOs.Count == 0)) if (MyItemInfo.IsHigh && mySize >= (2 * SixLinesPerInch) && MyItemInfo.MyDocStyle.Layout.FooterLength > 0 && (MyItemInfo.MyDocStyle.End.Message == null || MyItemInfo.MyDocStyle.End.Message == "") && MyItemInfo.NextItem == null && (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0) && (MyItemInfo.RNOs == null || MyItemInfo.RNOs.Count == 0))
mySize -= SixLinesPerInch; mySize -= SixLinesPerInch;
//// Account for extra lines in the end message (flag < 0)
float adjMsgY = 0;
if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page. if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page.
{ {
adjMsgY = (float)-MyItemInfo.MyDocStyle.End.Flag * SixLinesPerInch; //// Account for extra lines in the end message (flag < 0)
float adjMsgY = (float)-MyItemInfo.MyDocStyle.End.Flag * SixLinesPerInch;
if (yEndMsg != 0) yEndMsg += adjMsgY; if (yEndMsg != 0) yEndMsg += adjMsgY;
} }
// F2023-015 check if on the first step of a sub-section that starts on its own page (separate pagination) // F2023-015 check if on the first step of a sub-section that starts on its own page (separate pagination)
@@ -489,7 +448,6 @@ namespace Volian.Print.Library
ShowPageBreak(-1, "HLS will fit on page", firstStep, YSize, yPageSize, yWithinMargins,ManualPageBreak); ShowPageBreak(-1, "HLS will fit on page", firstStep, YSize, yPageSize, yWithinMargins,ManualPageBreak);
return 0; return 0;
} }
// !MyItemInfo.IsHigh - if (MyItemInfo.IsRNOPart && MyParent.XOffset < XOffset) return 0; // Don't paginate on an RNO to the right
// YSize includes a blank line after the step which we don't want to include in the page break test, thus the // YSize includes a blank line after the step which we don't want to include in the page break test, thus the
// YSize - SixLinesPerInch: // YSize - SixLinesPerInch:
@@ -504,8 +462,6 @@ namespace Volian.Print.Library
if (MyItemInfo.IsStep && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex != null && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex >= 0 && if (MyItemInfo.IsStep && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex != null && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex >= 0 &&
(MyItemInfo.RNOs == null || MyItemInfo.RNOs.Count == 0)) (MyItemInfo.RNOs == null || MyItemInfo.RNOs.Count == 0))
mySize += (2 * SixLinesPerInch); mySize += (2 * SixLinesPerInch);
//if (firstStep == "No")
// ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
if (MyPageHelper.DidFirstPageDocStyle && MyItemInfo.ActiveSection != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnAllButFirstPage) > 0)// C2018-003 fixed use of getting the active section if (MyPageHelper.DidFirstPageDocStyle && MyItemInfo.ActiveSection != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnAllButFirstPage) > 0)// C2018-003 fixed use of getting the active section
yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage(); yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage();
@@ -532,33 +488,28 @@ namespace Volian.Print.Library
// Keep figure (the only figure, i.e. count==1) with its parent. // Keep figure (the only figure, i.e. count==1) with its parent.
if (ChildrenBelow.Count == 1 && ChildrenBelow[0].MyItemInfo.IsFigure) KeepStepsOnPage = false; if (ChildrenBelow.Count == 1 && ChildrenBelow[0].MyItemInfo.IsFigure) KeepStepsOnPage = false;
float sectionSpace = 0;
if (doSectionTitleContinued) if (doSectionTitleContinued)
{ {
if (SectionShowTitles) if (SectionShowTitles)
{ {
vlnParagraph paraSect = MyParent; vlnParagraph paraSect = MyParent;
while (!paraSect.MyItemInfo.IsSection) paraSect = paraSect.MyParent; while (!paraSect.MyItemInfo.IsSection) paraSect = paraSect.MyParent;
float sectionSpace;
if (paraSect.ContinueHeight > 24) if (paraSect.ContinueHeight > 24)
sectionSpace = paraSect.ContinueHeight; sectionSpace = paraSect.ContinueHeight;
else else
sectionSpace = 2 * SixLinesPerInch; sectionSpace = 2 * SixLinesPerInch;
// sectionSpace = 3 * SixLinesPerInch;// this should actuall use the physical size of the continue messsage. // this should actuall use the physical size of the continue messsage.
// Fixing this caused problems with pagination ex Calvert Unit 2 IO-1l section 6.1.B step 2 // Fixing this caused problems with pagination ex Calvert Unit 2 IO-1l section 6.1.B step 2
//if (MyItemInfo.ActiveSection.DisplayText.Length < 40) sectionSpace = SixLinesPerInch;
yPageSizeNextPage -= sectionSpace; yPageSizeNextPage -= sectionSpace;
yExtra -= sectionSpace; yExtra -= sectionSpace;
//yExtra2 -= sectionSpace; // This was removed for Calvert STP O-73H-2 Section 6.3.O.4 and 6.3.R.3
} }
} }
// Added for section that was breaking from steps this code was removed to fix B2020-112 float mySize7LPI = mySize;
//if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && yPageSizeNextPage < yWithinMargins + 3 * 72 && MyItemInfo.MyPrevious == null)
// KeepStepsOnPage = true;
float mySize7LPI = mySize; // +SixLinesPerInch;
if (_Match16BitPagination) mySize7LPI += SixLinesPerInch; if (_Match16BitPagination) mySize7LPI += SixLinesPerInch;
float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch
float ySizeBtmCtnMess1 = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle); float ySizeBtmCtnMess1 = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle);
float ySizeBtmEndMess1 = GetBottomEndMessageSize(MyItemInfo.MyDocStyle); float ySizeBtmEndMess1 = GetBottomEndMessageSize();
// B2017-154 Don't leave an orphan on the next page if the high level step and first sub-step will fit on the current page // B2017-154 Don't leave an orphan on the next page if the high level step and first sub-step will fit on the current page
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.NoOrphans1 && KeepStepsOnPage && ChildrenBelow.Count == 2)// Handle Orphans when there are two sub-steps and only one will fit. if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.NoOrphans1 && KeepStepsOnPage && ChildrenBelow.Count == 2)// Handle Orphans when there are two sub-steps and only one will fit.
{ {
@@ -604,7 +555,6 @@ namespace Volian.Print.Library
// ySize7LPI includes a blank line after the step which we don't want to include in the page break test. // ySize7LPI includes a blank line after the step which we don't want to include in the page break test.
else if (!KeepStepsOnPage && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps else if (!KeepStepsOnPage && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps
//&& (mySize7LPI - SixLinesPerInch + yEndMsg - tableSpaceAvailable) < (yPageSizeNextPage * SixLinesPerInch / _SevenLinesPerInch))// RHM20150525 - Table Scrunch
// if this is the first step, then the step has to fit in the space that remains on the page // if this is the first step, then the step has to fit in the space that remains on the page
// otherwise it needs to fit on a blank page // otherwise it needs to fit on a blank page
// This was originally (10/12/2015) added for Farley Shared AOP 79 but was found to be unnecessary // This was originally (10/12/2015) added for Farley Shared AOP 79 but was found to be unnecessary
@@ -631,24 +581,9 @@ namespace Volian.Print.Library
float myFirstPieceSize = GetFirstPieceSize(); //Case 0 float myFirstPieceSize = GetFirstPieceSize(); //Case 0
if (_Match16BitPagination) myFirstPieceSize += 2 * SixLinesPerInch; if (_Match16BitPagination) myFirstPieceSize += 2 * SixLinesPerInch;
// TODO: Put this line back to case 0, i.e. previous line. This fixes a 16-bit vs 32-bit pagination diff in EO30 Step 20. // TODO: Put this line back to case 0, i.e. previous line. This fixes a 16-bit vs 32-bit pagination diff in EO30 Step 20.
//float myFirstPieceSize = GetFirstPieceSize() + 2 * SixLinesPerInch; //Case 10 - this is to match 16bit //Case 10 - this is to match 16bit
//is the amount of space left (yWithinMargins) is greater than 1/2 of the current page (yPageSize / 2): //is the amount of space left (yWithinMargins) is greater than 1/2 of the current page (yPageSize / 2):
// VCS EOP-4.3 Step 15 // VCS EOP-4.3 Step 15
// ***** Adjust yWithinMargins for the bottom continue message
//DocStyle docstyle = MyItemInfo.MyDocStyle;
//string myBottomMsg = docstyle.Continue.Bottom.Message;
//float myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0;
//switch (docstyle.Continue.Bottom.Location)
//{
// case E_ContBottomLoc.BottomOfPage: // place continue message at bottom of page
// // The following format flag was added for FNP, without the flag (which stops the reset of BottomMsgSpace)
// // a number of FNP procedures had overwritten steps/bottom continue message. An example can be
// // found in FNP = SAMGS;FNP-1-SACRG-2, step 1.
// if (!docstyle.Continue.Bottom.NoOverrideSpace)
// myBottomMsgSpace = 0;
// break;
//}
//float yWithinMarginsCM = yWithinMargins - myBottomMsgSpace;
//// **** Adjust yWithinMargins for the bottom continue message //// **** Adjust yWithinMargins for the bottom continue message
// B2018-080 Don't break if HLS and High Level RNO each have one line of text and there are substeps (keep single line HSL and High Level RNO with their substeps) AEP AOP Unit 1 016-004 steps 36 & 74 // B2018-080 Don't break if HLS and High Level RNO each have one line of text and there are substeps (keep single line HSL and High Level RNO with their substeps) AEP AOP Unit 1 016-004 steps 36 & 74
// B2018-081 The previous fix caused a different issue // B2018-081 The previous fix caused a different issue
@@ -668,8 +603,6 @@ namespace Volian.Print.Library
ySpaceOnFirstPage = yWithinMargins; // Accounts for Section Title Line ySpaceOnFirstPage = yWithinMargins; // Accounts for Section Title Line
//ShowPageBreak(8, CheckForCompression("First HLS has to split on current page"), firstStep, YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); //ShowPageBreak(8, CheckForCompression("First HLS has to split on current page"), firstStep, YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
//} //}
//else
// ShowPageBreak(6, CheckForCompression("HLS will have to split on current page"), "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
//BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSizeNextPage + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur //BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSizeNextPage + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
// B2020-027: adjust for lines that may print on first page of section only, added MyPageHelper.PrintedSectionPage // B2020-027: adjust for lines that may print on first page of section only, added MyPageHelper.PrintedSectionPage
// B2020-108: The bug itself was related to keeping a table with its parent. However compression for some pages was // B2020-108: The bug itself was related to keeping a table with its parent. However compression for some pages was
@@ -695,7 +628,6 @@ namespace Volian.Print.Library
// o888o // o888o
if (firstStep == "Yes") if (firstStep == "Yes")
{ {
//ySpaceOnFirstPage = yWithinMargins; // Accounts for Section Title Line
ShowPageBreak(8, CheckForFirstCompression("First HLS has to split on current page"), firstStep, YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); ShowPageBreak(8, CheckForFirstCompression("First HLS has to split on current page"), firstStep, YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
} }
else else
@@ -754,6 +686,7 @@ namespace Volian.Print.Library
ShowPageBreak(3, CheckForFirstCompression("HLS will have to split on new page"), "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); ShowPageBreak(3, CheckForFirstCompression("HLS will have to split on new page"), "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
return 1; // Paginate on High Level Steps return 1; // Paginate on High Level Steps
} }
//For Debugging:
//if (yWithinMargins > yPageSize / 2) //if (yWithinMargins > yPageSize / 2)
//{ //{
// Console.WriteLine("'PageBreak',4,'No','Not Half way down the page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath); // Console.WriteLine("'PageBreak',4,'No','Not Half way down the page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
@@ -780,7 +713,7 @@ namespace Volian.Print.Library
return hasAER && hasRNO; return hasAER && hasRNO;
} }
// B2018-058 the the end message height accounting for multi-line end messages // B2018-058 the the end message height accounting for multi-line end messages
private float GetEndMessageHeight(DocStyle docstyle) private float GetEndMessageHeight()
{ {
float EndMsgHeight = 0; float EndMsgHeight = 0;
string endmsg = MyItemInfo.MyDocStyle.End.Message ?? ""; string endmsg = MyItemInfo.MyDocStyle.End.Message ?? "";
@@ -791,12 +724,12 @@ namespace Volian.Print.Library
} }
return EndMsgHeight; return EndMsgHeight;
} }
private float GetBottomEndMessageSize(DocStyle docstyle) private float GetBottomEndMessageSize()
{ {
float myBottomMsgSpace = 0; float myBottomMsgSpace = 0;
if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page. if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page.
{ {
docstyle = MyItemInfo.MyDocStyle; DocStyle docstyle = MyItemInfo.MyDocStyle;
string myBottomMsg = docstyle.End.Message; string myBottomMsg = docstyle.End.Message;
myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0; myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0;
if (myBottomMsg != null && docstyle.End.Flag < 0) myBottomMsgSpace += (-(float)docstyle.End.Flag * SixLinesPerInch); if (myBottomMsg != null && docstyle.End.Flag < 0) myBottomMsgSpace += (-(float)docstyle.End.Flag * SixLinesPerInch);
@@ -806,20 +739,20 @@ namespace Volian.Print.Library
private string CheckForFirstCompression(string reason) private string CheckForFirstCompression(string reason)
{ {
if (MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].CompressFirstPartOfStep) if (MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].CompressFirstPartOfStep)
return reason + " - 7 LPI"; return $"{reason} - 7 LPI";
return reason; return reason;
} }
private string CheckForCompression(string reason) private string CheckForCompression(string reason)
{ {
if (CompressPartOfStep) if (CompressPartOfStep)
return reason + " - 7 LPI"; return $"{reason} - 7 LPI";
return reason; return reason;
} }
private string AddReason(string prefix) private string AddReason(string prefix)
{ {
string retval = prefix; string retval = prefix;
if (PageBreakReason != null) if (PageBreakReason != null)
retval += " - " + PageBreakReason; retval += $" - {PageBreakReason}";
return retval; return retval;
} }
private bool SectionShowTitles private bool SectionShowTitles
@@ -864,8 +797,6 @@ namespace Volian.Print.Library
DebugText.WriteLine("*****PaginateError"); DebugText.WriteLine("*****PaginateError");
yPageStart = yTopMargin + YVeryTop; yPageStart = yTopMargin + YVeryTop;
yLocation = yPageStart - YOffset; yLocation = yPageStart - YOffset;
//MyItemInfo.ItemID, YSize, yPageSize, yLocation
//_MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination - ItemID = {0}\r\nLocation = '{1}'", MyItemInfo.ItemID, MyItemInfo.ShortPath);
_MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination\r\n==>'Forced Pagination',{0},'{1}','{2}'" _MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination\r\n==>'Forced Pagination',{0},'{1}','{2}'"
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath); , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath);
if (DebugPagination.IsOpen) DebugPagination.WriteLine("=====>,'Yes','Forced Pagination',{0},{1},,{3},'{4}'", MyItemInfo.ItemID, YSize, 0, yLocation, MyItemInfo.ShortPath); if (DebugPagination.IsOpen) DebugPagination.WriteLine("=====>,'Yes','Forced Pagination',{0},{1},,{3},'{4}'", MyItemInfo.ItemID, YSize, 0, yLocation, MyItemInfo.ShortPath);
@@ -927,10 +858,7 @@ namespace Volian.Print.Library
return _AlternateBreaks; return _AlternateBreaks;
} }
} }
private void AddAlternateBreak(vlnParagraph vp) private void AddAlternateBreak(vlnParagraph vp) => AlternateBreaks.Add(vp);
{
AlternateBreaks.Add(vp);
}
private bool CheckAlternates(vlnParagraph vpBrk) private bool CheckAlternates(vlnParagraph vpBrk)
{ {
if (_AlternateBreaks == null) return false; if (_AlternateBreaks == null) return false;
@@ -957,7 +885,7 @@ namespace Volian.Print.Library
public float yPageSizeForPagination = -1; public float yPageSizeForPagination = -1;
private void BuildPageBreakList(float ySpaceOnCurPage, float yPageSize, bool KeepStepsOnPage, float yEndMsg, bool doSectionTitleContinued, bool onNewPage) private void BuildPageBreakList(float ySpaceOnCurPage, float yPageSize, bool KeepStepsOnPage, float yEndMsg, bool doSectionTitleContinued, bool onNewPage)
{ {
float topContinueHeight = 2 * SixLinesPerInch; float topContinueHeight; //Defaults to: 2 * SixLinesPerInch;
int profileDepth = ProfileTimer.Push(">>>> BuildPageBreakList"); int profileDepth = ProfileTimer.Push(">>>> BuildPageBreakList");
// if this paragraph is flagged to pagebreakonstep (i.e. these are used by background documents // if this paragraph is flagged to pagebreakonstep (i.e. these are used by background documents
// to get each hls/caution/note to be on its own page), then any of the children above should // to get each hls/caution/note to be on its own page), then any of the children above should
@@ -997,8 +925,7 @@ namespace Volian.Print.Library
// the following logic was added to fix Pagination for VCS BDMG1 Step 4 // the following logic was added to fix Pagination for VCS BDMG1 Step 4
if (ChildrenRight.Count > 0 && ChildrenRight[0].YOffset == YOffset) if (ChildrenRight.Count > 0 && ChildrenRight[0].YOffset == YOffset)
{ {
float myFirstPieceRNOSize = 0; float myFirstPieceRNOSize = ChildrenRight[0].GetFirstPieceSize();
myFirstPieceRNOSize = ChildrenRight[0].GetFirstPieceSize();
if (myFirstPieceRNOSize < ySpaceOnCurPage) if (myFirstPieceRNOSize < ySpaceOnCurPage)
if (ChildrenBelow.Count > 0) if (ChildrenBelow.Count > 0)
{ {
@@ -1008,7 +935,6 @@ namespace Volian.Print.Library
} }
} }
if (myFirstPieceSize < ySpaceOnCurPage) yLowerLimit = Math.Max(myFirstPieceSize + yStart, yLowerLimit); if (myFirstPieceSize < ySpaceOnCurPage) yLowerLimit = Math.Max(myFirstPieceSize + yStart, yLowerLimit);
//while ((YSize - yTop) >= ySpaceOnCurPage)
// Pagination Fix Break1LineShort3b // Pagination Fix Break1LineShort3b
DocStyle docstyle = MyItemInfo.MyDocStyle; DocStyle docstyle = MyItemInfo.MyDocStyle;
float myBottomMsgSpace = GetBottomContinueMessageSize(docstyle); float myBottomMsgSpace = GetBottomContinueMessageSize(docstyle);
@@ -1052,21 +978,12 @@ namespace Volian.Print.Library
// The following code determines space required by the Checklist header (Wolf Creek) if a break occurs // The following code determines space required by the Checklist header (Wolf Creek) if a break occurs
// Their 2 HLS that define the checklists have 'UseSmartTemplate'. // Their 2 HLS that define the checklists have 'UseSmartTemplate'.
float accountForSmartTemplateHeader = 0; float accountForSmartTemplateHeader = 0;
//if (MyItemInfo.InList(878)) Console.WriteLine("Here");
if (MyItemInfo.FormatStepData.UseSmartTemplate) if (MyItemInfo.FormatStepData.UseSmartTemplate)
{ {
if (((MyItemInfo.MyDocStyle.End.Message ?? "") == "") || MyItemInfo.MyHLS.NextItem != null) if (((MyItemInfo.MyDocStyle.End.Message ?? "") == "") || MyItemInfo.MyHLS.NextItem != null)
ySpaceOnCurPage += SixLinesPerInch; ySpaceOnCurPage += SixLinesPerInch;
accountForSmartTemplateHeader = Height - (2 * SixLinesPerInch); accountForSmartTemplateHeader = Height - (2 * SixLinesPerInch);
} }
// This was added so that if a page break was immediately necessary the code would use the current step.
// However, a better solution was found and put in Paginate()
//if (YSize == Height + SixLinesPerInch && YSize + yEndMsg >= ySpaceOnCurPage)
//{
// _MyLog.WarnFormat("Would have been unable to break {0},{1}",MyItemInfo.ItemID, MyItemInfo.ShortPath);
// MyPageHelper.ParaBreaks.Add(this);
// return;
//}
// ooooo ooo . oooooooooo. oooo // ooooo ooo . oooooooooo. oooo
// `888b. `8' .o8 `888' `Y8b `888 // `888b. `8' .o8 `888' `Y8b `888
// 8 `88b. 8 .ooooo. oooo ooo .o888oo 888 888 oooo d8b .ooooo. .oooo. 888 oooo // 8 `88b. 8 .ooooo. oooo ooo .o888oo 888 888 oooo d8b .ooooo. .oooo. 888 oooo
@@ -1170,7 +1087,8 @@ namespace Volian.Print.Library
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop); myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop);
if (paraBreak2 != null && paraBreak != paraBreak2) if (paraBreak2 != null && paraBreak != paraBreak2)
{ {
yLoc = ySpaceOnCurPage - (paraBreak2.YOffset - (YTopMost + yTop - paraBreak2.Height)); //For Debugging:
//yLoc = ySpaceOnCurPage - (paraBreak2.YOffset - (YTopMost + yTop - paraBreak2.Height));
if (paraBreak.YOffset == paraBreak2.YOffset + paraBreak2.Height) if (paraBreak.YOffset == paraBreak2.YOffset + paraBreak2.Height)
{ {
//_MyLog.WarnFormat("Fix Break when no blank line {0},{1},{2}", paraBreak2.MyItemInfo.ShortPath, paraBreak2.MyItemInfo.ItemID,yLoc); //_MyLog.WarnFormat("Fix Break when no blank line {0},{1},{2}", paraBreak2.MyItemInfo.ShortPath, paraBreak2.MyItemInfo.ItemID,yLoc);
@@ -1211,10 +1129,7 @@ namespace Volian.Print.Library
} }
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) // only do the following for Calvert Alarms if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) // only do the following for Calvert Alarms
{ {
//if (lastBreak != null && lastBreak.MyItemInfo.InList(42656,42923)) Console.WriteLine("here");
// Or Step whose parent fits on a page should break at the parent step // Or Step whose parent fits on a page should break at the parent step
//if (MyItemInfo.InList(119826)) Console.WriteLine("here");
//if (paraBreak.MyItemInfo.InList(40339))
float ySpaceOnNextPage = yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace; float ySpaceOnNextPage = yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace;
if (paraBreak.MyItemInfo.IsOr && paraBreak.MyParent.YSize < ySpaceOnNextPage) if (paraBreak.MyItemInfo.IsOr && paraBreak.MyParent.YSize < ySpaceOnNextPage)
{ {
@@ -1307,7 +1222,8 @@ namespace Volian.Print.Library
if (firstLevel.MyParent.ChildrenBelow != null && firstLevel.MyParent.ChildrenBelow.Count > 0 && firstLevel.MyParent.ChildrenBelow[0] != firstLevel && if (firstLevel.MyParent.ChildrenBelow != null && firstLevel.MyParent.ChildrenBelow.Count > 0 && firstLevel.MyParent.ChildrenBelow[0] != firstLevel &&
firstLevel.YSize < yPageSize - (myTopMsgSpace + SixLinesPerInch)) firstLevel.YSize < yPageSize - (myTopMsgSpace + SixLinesPerInch))
{ {
vlnParagraph firstLevel1 = firstLevel; //For Debugging:
//vlnParagraph firstLevel1 = firstLevel;
if (firstLevel.ChildrenAbove != null && firstLevel.ChildrenAbove.Count > 0) // If the aerParent has caution or note if (firstLevel.ChildrenAbove != null && firstLevel.ChildrenAbove.Count > 0) // If the aerParent has caution or note
firstLevel = firstLevel.ChildrenAbove[0];//, break on the caution or note. firstLevel = firstLevel.ChildrenAbove[0];//, break on the caution or note.
if (firstLevel != lastBreak && paraBreak != firstLevel) if (firstLevel != lastBreak && paraBreak != firstLevel)
@@ -1320,14 +1236,10 @@ namespace Volian.Print.Library
} }
// If the break is going to happen on a table, and the tables parent would fit on a page with the table // If the break is going to happen on a table, and the tables parent would fit on a page with the table
// and the text in the parent includes the word table, then break on the parent // and the text in the parent includes the word table, then break on the parent
//if (lastBreak != paraBreak.MyParent && paraBreak.MyItemInfo.IsTable && paraBreak.YSize < ySpaceOnCurPage && paraBreak.MyParent.MyItemInfo.DisplayText.ToUpper().Contains("TABLE"))
// paraBreak = paraBreak.MyParent;
//paraBreak.ShowPageBreak(999, paraBreak.MyItemInfo.ShortPath, "Yes",paraBreak.YTop, paraBreak.YSize, paraBreak.Height, false); //paraBreak.ShowPageBreak(999, paraBreak.MyItemInfo.ShortPath, "Yes",paraBreak.YTop, paraBreak.YSize, paraBreak.Height, false);
//_MyLog.InfoFormat("Place to break\r\n==>'Place to Break',{0},'{1}','{2}'" //_MyLog.InfoFormat("Place to break\r\n==>'Place to Break',{0},'{1}','{2}'"
//, paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.MyDocVersion.MyFolder.Name, paraBreak.MyItemInfo.ShortPath); //, paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.MyDocVersion.MyFolder.Name, paraBreak.MyItemInfo.ShortPath);
// yTopNew is y Location of this page break. YTopMost is top of HLS, including any Cautions/Notes/Boxes/etc // yTopNew is y Location of this page break. YTopMost is top of HLS, including any Cautions/Notes/Boxes/etc
//float yTopNew = paraBreak.YVeryTop - YTopMost;
//float yTopNew = paraBreak.YTopMost - YTopMost;
if (JustATableThatWillFit(paraBreak, yPageSize - (myTopMsgSpace + yEndMsg))) if (JustATableThatWillFit(paraBreak, yPageSize - (myTopMsgSpace + yEndMsg)))
paraBreak = paraBreak.ChildrenBelow[0]; paraBreak = paraBreak.ChildrenBelow[0];
// B2020-112: complicated AER/RNO. yEndMsg was accounted for twice -> put endmsg part back in, it broke wcn and didn't affect bge // B2020-112: complicated AER/RNO. yEndMsg was accounted for twice -> put endmsg part back in, it broke wcn and didn't affect bge
@@ -1412,14 +1324,6 @@ namespace Volian.Print.Library
PageBreakOnStepList.RemoveAt(0); PageBreakOnStepList.RemoveAt(0);
yTopNew = paraBreak.YTop - YTopMost; yTopNew = paraBreak.YTop - YTopMost;
} }
// The following code caused forced pagination for Catawba EOP BG - EP/1/A/5000/FR-C.1.SC..S16..N2..S4..S1.
//else if(PageBreakOnStepList[0].YSize - yTop <= ySpaceOnCurPage)
//{
// DebugPagination.WriteLine("======>>>>> Other Condition");
// paraBreak = PageBreakOnStepList[0];
// PageBreakOnStepList.RemoveAt(0);
// yTopNew = paraBreak.YTop - YTopMost;
//}
} }
RemoveProcessedParagraphs(myList, yTopNew - yTop); RemoveProcessedParagraphs(myList, yTopNew - yTop);
yTop = yTopNew; yTop = yTopNew;
@@ -1440,13 +1344,6 @@ namespace Volian.Print.Library
// B2017-252 Pagination Fix - RNP was not paginating correctly. Added logic to set ySPaceOnCurPage if ySpaceOnNextPage was larger // B2017-252 Pagination Fix - RNP was not paginating correctly. Added logic to set ySPaceOnCurPage if ySpaceOnNextPage was larger
if (!usedPageBreakOnStepList || ySpaceOnNextPage1 > ySpaceOnCurPage) ySpaceOnCurPage = ySpaceOnNextPage1; if (!usedPageBreakOnStepList || ySpaceOnNextPage1 > ySpaceOnCurPage) ySpaceOnCurPage = ySpaceOnNextPage1;
//ySpaceOnCurPage = yPageSize - (myTopMsgSpace + SixLinesPerInch); // Allow for continue message and blank line.
//if (paraBreak.YTopMost != paraBreak.YVeryTop && MyPageHelper.TopMessage == null && MyPageHelper.BottomMessage == null)
// ySpaceOnCurPage = yPageSize;
//ySpaceOnCurPage = yPageSize; // Allow for continue message and blank line.
//DocStyle docstyle = MyItemInfo.MyDocStyle;
//string myMsg = docstyle.Continue.Bottom.Message;
//if ((myMsg ?? "") != "") ySpaceOnCurPage -= 2 * SixLinesPerInch; // Allow for continue message and blank line.
yLowerLimit = ySpaceOnCurPage / 2; yLowerLimit = ySpaceOnCurPage / 2;
if (_Match16BitPagination) yLowerLimit -= 1.5F * SixLinesPerInch; // 276 for HLP if (_Match16BitPagination) yLowerLimit -= 1.5F * SixLinesPerInch; // 276 for HLP
yStart = 0; yStart = 0;
@@ -1505,7 +1402,6 @@ namespace Volian.Print.Library
{ {
// C2023-015: Pagination on a sub-step added. Do the code if supplemental info or if format supports sub-step pagination // C2023-015: Pagination on a sub-step added. Do the code if supplemental info or if format supports sub-step pagination
// C2023-018: Remove the supplemental info & alarm check, doing the possible page breaks on sub-steps // C2023-018: Remove the supplemental info & alarm check, doing the possible page breaks on sub-steps
//if (!MyItemInfo.MyDocStyle.SupplementalInformation && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AlarmPagination) return null;
SortedList<float, vlnParagraph> sdpara = null; SortedList<float, vlnParagraph> sdpara = null;
foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest.
{ {
@@ -1534,8 +1430,7 @@ namespace Volian.Print.Library
private float GetBottomContinueMessageSize(DocStyle docstyle) private float GetBottomContinueMessageSize(DocStyle docstyle)
{ {
float myBottomMsgSpace = 0; float myBottomMsgSpace;
docstyle = MyItemInfo.MyDocStyle;
string myBottomMsg = docstyle.Continue.Bottom.Message; string myBottomMsg = docstyle.Continue.Bottom.Message;
myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0; myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0;
if (myBottomMsg != null && myBottomMsg.Contains("par")) myBottomMsgSpace += SixLinesPerInch; if (myBottomMsg != null && myBottomMsg.Contains("par")) myBottomMsgSpace += SixLinesPerInch;
@@ -1603,7 +1498,7 @@ namespace Volian.Print.Library
float? yLocationMin=null; float? yLocationMin=null;
vlnParagraph minPara2 = null; vlnParagraph minPara2 = null;
float? yLocationMin2=null; float? yLocationMin2=null;
float yAddForBtmMsg = 0; float yAddForBtmMsg;
// useful for debugging pagination issues, lastbreak gets the paragraph at the top of the previous page, shows all // useful for debugging pagination issues, lastbreak gets the paragraph at the top of the previous page, shows all
// of the locations within 'range' on the next page. // of the locations within 'range' on the next page.
//if (lastBreak != null && lastBreak.MyItemInfo.InList(72481)) //if (lastBreak != null && lastBreak.MyItemInfo.InList(72481))
@@ -1670,16 +1565,9 @@ namespace Volian.Print.Library
// Note that this bug fix for WCN was commented out. Harry Julian wanted this on 11/15/19. A new bug will be written for the WCN error. // Note that this bug fix for WCN was commented out. Harry Julian wanted this on 11/15/19. A new bug will be written for the WCN error.
// B2019-173 reintroduced the 'IsHigh' portion and added IsRNOPart, the HLS & RNOPart print at same location on page so code needs // B2019-173 reintroduced the 'IsHigh' portion and added IsRNOPart, the HLS & RNOPart print at same location on page so code needs
// to account for either. second iteration of this fix removed IsRNOPart (see code in Paginate) // to account for either. second iteration of this fix removed IsRNOPart (see code in Paginate)
&& !myParent.MyItemInfo.IsHigh) /*|| myPara.MyItemInfo.IsRNOPart)) */// B2018-104: don't return if my parent is a high level - a top continue message was printing && !myParent.MyItemInfo.IsHigh) // B2018-104: don't return if my parent is a high level - a top continue message was printing
{ {
//_MyLog.WarnFormat("\r\nMyParentBreak {0},{1},{2},{3},{4}", myParent, myParent.YSize, yUpperLimit, myParent.ChildrenRight[0].YSize, spaceOnPage); //_MyLog.WarnFormat("\r\nMyParentBreak {0},{1},{2},{3},{4}", myParent, myParent.YSize, yUpperLimit, myParent.ChildrenRight[0].YSize, spaceOnPage);
// Removed the following and moved logic to Paginate method for the second iteration of the bug fix. This code below AND the IsRNOPart above caused another
// pagination problem. The insert and subsequent removal of this code are both done under bug B22019-173.
// Initial code for B2019-173: make minPara2 the first step on next page
//if (minPara2 != null && minPara2.MyParent == myParent && minPara2 != lastBreak && minPara2.MyItemInfo.Ordinal == 1)
//{
// return minPara2;
//}
if (myParent != lastBreak) if (myParent != lastBreak)
return myParent; return myParent;
} }
@@ -1736,17 +1624,11 @@ namespace Volian.Print.Library
} }
} }
} }
//while (myPara.MyParent.YTop == myPara.YTop) myPara = myPara.MyParent;
while (myPara.MyParent != null && myPara.MyParent.YTop == myPara.YTop) myPara = myPara.MyParent; while (myPara.MyParent != null && myPara.MyParent.YTop == myPara.YTop) myPara = myPara.MyParent;
int everyNLines = myPara.MyItemInfo.MyPrevious != null && myPara.MyItemInfo.FormatStepData == null ? 1 : myPara.MyItemInfo.FormatStepData.StepLayoutData.EveryNLines ?? 1; int everyNLines = myPara.MyItemInfo.MyPrevious != null && myPara.MyItemInfo.FormatStepData == null ? 1 : myPara.MyItemInfo.FormatStepData.StepLayoutData.EveryNLines ?? 1;
bool inSameBox = InSameBox(myPara, minPara2); // if this note/caution is in same box as the break, don't break within the notes/cautions in the same box bool inSameBox = InSameBox(myPara, minPara2); // if this note/caution is in same box as the break, don't break within the notes/cautions in the same box
if (!inSameBox && myPara.ChildrenAbove.Count == 0 && wcnChkLstBorder - yLocation < yUpperLimit + yAddForBtmMsg || (everyNLines != 99 && (wcnChkLstBorder - yLocation == yUpperLimit + yAddForBtmMsg))) // Fix for OFN-RJ-23 if (!inSameBox && myPara.ChildrenAbove.Count == 0 && wcnChkLstBorder - yLocation < yUpperLimit + yAddForBtmMsg || (everyNLines != 99 && (wcnChkLstBorder - yLocation == yUpperLimit + yAddForBtmMsg))) // Fix for OFN-RJ-23
//if (-yLocation < yUpperLimit) // Before
//if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null)
{ {
//ItemInfo prev = myList[stepLevel][yLocation].MyItemInfo.MyPrevious;
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 5609) Console.WriteLine("aer");
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 4312) Console.WriteLine("rno");
// The top of this step is more than 1/2 way down the page // The top of this step is more than 1/2 way down the page
if ((-yLocation + yStart) >= yLowerLimit) if ((-yLocation + yStart) >= yLowerLimit)
if (myPara != lastBreak) if (myPara != lastBreak)
@@ -1825,6 +1707,7 @@ namespace Volian.Print.Library
// B2020-081 was breaking on an AER substep that has an long RNO - should keep AER substep and part of RNO on the page = D.C. Cook "Current (Post FLEX) U1 NOP NOT [EOPs]" set, ES-0.1 step 1. // B2020-081 was breaking on an AER substep that has an long RNO - should keep AER substep and part of RNO on the page = D.C. Cook "Current (Post FLEX) U1 NOP NOT [EOPs]" set, ES-0.1 step 1.
// B2020-085 was breaking first child of second RNO (third IF in RNO) - should break on second child of second RNO - D.C. Cook AOP Unit 1 002-020 Step 15 // B2020-085 was breaking first child of second RNO (third IF in RNO) - should break on second child of second RNO - D.C. Cook AOP Unit 1 002-020 Step 15
// B2020-099 was breaking on last sub-step of previous RNO - Calvert Approved Procedures; Abnormal Procedures Unit 2; AOP-2A; Section VII; Step 11.RNO.11.1.c // B2020-099 was breaking on last sub-step of previous RNO - Calvert Approved Procedures; Abnormal Procedures Unit 2; AOP-2A; Section VII; Step 11.RNO.11.1.c
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping myList and stepLevel for Debugging")]
private vlnParagraph HasSecondRNOThatWillFit(float yStart, float yLowerLimit, float yUpperLimit, StepLevelList myList, int stepLevel, float yTop) private vlnParagraph HasSecondRNOThatWillFit(float yStart, float yLowerLimit, float yUpperLimit, StepLevelList myList, int stepLevel, float yTop)
{ {
// B2020-120: for calvert alarms/condition response table, don't run code for second rno // B2020-120: for calvert alarms/condition response table, don't run code for second rno
@@ -1856,12 +1739,6 @@ namespace Volian.Print.Library
if ((chld.YTopMost + yStart + yTop - yTopParent) < yUpperLimit) if ((chld.YTopMost + yStart + yTop - yTopParent) < yUpperLimit)
return chld; // second RNO will fit, use this instead of myPara return chld; // second RNO will fit, use this instead of myPara
// check to see if there is AER substep children that would be split if we pagination on the RNO
// B2020-150 commented out below. Found it is not needed for B2020-085 fix but it was what cause B2020-150
//foreach (vlnParagraph chld in parent.ChildrenBelow)
// if (chld.YOffset < this.YOffset && YBottomMostExcludingRNO(chld) > this.YTopMost) // B2020-085 Does AER child start before myPara and length greater than myPara start
// return null; // the AER text positioning overlaps the RNO text positioning (caused AER sub-steps to be split onto next page (i.e. RO step) have pagination logic keep looking for place to break
return this; // current myPara is good return this; // current myPara is good
} }
@@ -1903,6 +1780,7 @@ namespace Volian.Print.Library
} }
return false; return false;
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping yLocation for Debugging")]
private static int MaxBreakLevel(float yLocation, StepLevelList myList, int maxLevel, vlnParagraph myParaBreak) private static int MaxBreakLevel(float yLocation, StepLevelList myList, int maxLevel, vlnParagraph myParaBreak)
{ {
foreach (int stepLevel in myList.Keys) foreach (int stepLevel in myList.Keys)
@@ -1935,27 +1813,7 @@ namespace Volian.Print.Library
if (MyParent == null || MyParent.MyItemInfo.IsHigh) return false; if (MyParent == null || MyParent.MyItemInfo.IsHigh) return false;
return MyParent.HasAncestor(myParaBreak); return MyParent.HasAncestor(myParaBreak);
} }
//private void WalkStepLevel(float yTopMost)
//{
// foreach (vlnParagraph child in ChildrenAbove)
// child.WalkStepLevel(yTopMost);
// foreach (vlnParagraph child in ChildrenLeft)
// child.WalkStepLevel(yTopMost);
// ShowStepLevel(yTopMost);
// foreach (vlnParagraph child in ChildrenRight)
// child.WalkStepLevel(yTopMost);
// foreach (vlnParagraph child in ChildrenBelow)
// child.WalkStepLevel(yTopMost);
//}
//private void ShowStepLevel(float yTopMost)
//{
// ItemInfo item = MyItemInfo;
// ItemInfo parent = item.ActiveParent as ItemInfo;
// //if (para.MyItemInfo.ItemID == 205)
// // Console.Write("");
// DebugPagination.WriteLine("'StepLevel',{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", YVeryTop - yTopMost, YSize, YBottomMost - yTopMost, item.ItemID, item.DBSequence, item.StepLevel, item.MyContent.Type % 10000,
// parent.MyContent.Type % 10000, item.HasCautionOrNote ? 1 : 0, parent.Cautions == null ? 0 : 1);
//}
public float TableSpaceAvailable// RHM20150525 - Table Scrunch public float TableSpaceAvailable// RHM20150525 - Table Scrunch
{ {
get // B2019-111 Keep AER Table with parent when RNO extends past the end of the page. get // B2019-111 Keep AER Table with parent when RNO extends past the end of the page.
@@ -1992,18 +1850,7 @@ namespace Volian.Print.Library
} }
public partial class VlnSvgPageHelper : SvgPageHelper public partial class VlnSvgPageHelper : SvgPageHelper
{ {
private bool _OriginalPageBreak; // use 16bit page breaks. public bool OriginalPageBreak { get; set; }
public bool OriginalPageBreak public List<vlnParagraph> ParaBreaks { get; set; } = new List<vlnParagraph>();
{
get { return _OriginalPageBreak; }
set { _OriginalPageBreak = value; }
}
// This handles Page Breaks within a Step
private List<vlnParagraph> _ParaBreaks = new List<vlnParagraph>();
public List<vlnParagraph> ParaBreaks
{
get { return _ParaBreaks; }
set { _ParaBreaks = value; }
}
} }
} }
+10 -59
View File
@@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using LBWordLibrary; using LBWordLibrary;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@@ -10,12 +7,12 @@ namespace Volian.Print.Library
{ {
public class Placekeeper : IDisposable public class Placekeeper : IDisposable
{ {
private LBApplicationClass _WordApp; private readonly LBApplicationClass _WordApp;
private LBDocumentClass _WordDoc; private readonly LBDocumentClass _WordDoc;
private LBSelection _WordSel; private readonly LBSelection _WordSel;
private LBTable _WordTbl; private LBTable _WordTbl;
private const string TheQuickBrownFox = "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog."; private const string TheQuickBrownFox = "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.";
private VE_Font _pkFont; private readonly VE_Font _pkFont;
public Placekeeper() public Placekeeper()
{ {
_WordApp = new LBApplicationClass(); _WordApp = new LBApplicationClass();
@@ -28,37 +25,11 @@ namespace Volian.Print.Library
_WordApp.Visible = true; _WordApp.Visible = true;
_WordApp.Activate(); _WordApp.Activate();
} }
//public Placekeeper(pkParagraph myPlacekeeper)
//{
// _WordApp = new LBApplicationClass();
// _WordDoc = _WordApp.Documents.Add();
// _WordSel = _WordApp.Selection;
// _WordApp.Visible = true;
// AddTable();
// AddHeader();
// AddSectionHeader(myPlacekeeper.MyParagraph.MyItemInfo.DisplayNumber, myPlacekeeper.MyParagraph.MyItemInfo.DisplayText);
// foreach (pkParagraph pgh in myPlacekeeper.MyChildren)
// {
// AddHighLevelStep(pgh.MyParagraph.MyItemInfo.MyTab.CleanText, pgh.MyParagraph.MyItemInfo.DisplayText, pgh.MyParagraph.MyItemInfo.FormatStepType==9 ? "C" : "", pgh.MyParagraph.MyItemInfo.PageNumber.ToString());
// if (pgh.MyChildren.Count > 0)
// {
// StartSubStep();
// foreach (pkParagraph cpgh in pgh.MyChildren)
// {
// ContinueSubStep(cpgh.MyParagraph.MyItemInfo.DisplayText, 1);
// foreach (pkParagraph ccpgh in cpgh.MyChildren)
// ContinueSubStep(ccpgh.MyParagraph.MyItemInfo.DisplayText, 2);
// }
// FinishSubstep("", "");
// }
// }
//}
public Placekeeper(pkParagraphs myPlacekeepers, VE_Font pkFont) public Placekeeper(pkParagraphs myPlacekeepers, VE_Font pkFont)
{ {
_WordApp = new LBApplicationClass(); _WordApp = new LBApplicationClass();
_WordDoc = _WordApp.Documents.Add(); _WordDoc = _WordApp.Documents.Add();
_WordSel = _WordApp.Selection; _WordSel = _WordApp.Selection;
//_WordApp.Visible = true;
_pkFont = pkFont; _pkFont = pkFont;
AddTable(); AddTable();
AddHeader(); AddHeader();
@@ -97,7 +68,7 @@ namespace Volian.Print.Library
if (cpgh.MyCautionsAndNotes.Count > 0) if (cpgh.MyCautionsAndNotes.Count > 0)
AddNotesOrCautions(cpgh,level, ref conAct); AddNotesOrCautions(cpgh,level, ref conAct);
if (!conAct) if (!conAct)
conAct = IsContinuousActionPlacekeeper(conAct, cpgh); conAct = IsContinuousActionPlacekeeper(cpgh);
ContinueSubStep(cpgh.MyParagraph.MyItemInfo.FormattedDisplayText, level); ContinueSubStep(cpgh.MyParagraph.MyItemInfo.FormattedDisplayText, level);
AddChildren(cpgh, level+1, ref conAct); AddChildren(cpgh, level+1, ref conAct);
} }
@@ -108,17 +79,12 @@ namespace Volian.Print.Library
foreach (pkParagraph cpgh in pgh.MyCautionsAndNotes) foreach (pkParagraph cpgh in pgh.MyCautionsAndNotes)
{ {
if (!conAct) if (!conAct)
conAct = IsContinuousActionPlacekeeper(conAct, cpgh); conAct = IsContinuousActionPlacekeeper(cpgh);
ContinueNoteOrCaution(cpgh.MyParagraph.MyItemInfo, level); ContinueNoteOrCaution(cpgh.MyParagraph.MyItemInfo, level);
} }
} }
private static bool IsContinuousActionPlacekeeper(bool conAct, pkParagraph pkPar) private static bool IsContinuousActionPlacekeeper(pkParagraph pkPar) => (pkPar.MyParagraph.MyItemInfo.MyConfig as StepConfig).Step_Placekeeper.ToUpper() == "C";
{
StepConfig sc = pkPar.MyParagraph.MyItemInfo.MyConfig as StepConfig;
conAct = (sc.Step_Placekeeper.ToUpper() == "C");
return conAct;
}
private void ContinueNoteOrCaution(ItemInfo ii, int level) private void ContinueNoteOrCaution(ItemInfo ii, int level)
{ {
@@ -176,22 +142,17 @@ namespace Volian.Print.Library
_WordTbl.TopPadding = 6F; _WordTbl.TopPadding = 6F;
_WordTbl.BottomPadding = 6F; _WordTbl.BottomPadding = 6F;
LBColumn col = _WordTbl.Columns.First; LBColumn col = _WordTbl.Columns.First;
//col.SetWidth(12F, LBWdRulerStyle.wdAdjustNone);
//col = col.Next;
col.SetWidth(72 * .91F, LBWdRulerStyle.wdAdjustNone); col.SetWidth(72 * .91F, LBWdRulerStyle.wdAdjustNone);
col = col.Next; col = col.Next;
col.SetWidth(72 * 4.1F, LBWdRulerStyle.wdAdjustNone); col.SetWidth(72 * 4.1F, LBWdRulerStyle.wdAdjustNone);
col = col.Next; col = col.Next;
//col.SetWidth(72 * .81F, LBWdRulerStyle.wdAdjustNone);
col.SetWidth(72 * .76F, LBWdRulerStyle.wdAdjustNone); col.SetWidth(72 * .76F, LBWdRulerStyle.wdAdjustNone);
col = col.Next; col = col.Next;
//col.SetWidth(72 * .81F, LBWdRulerStyle.wdAdjustNone);
col.SetWidth(72 * .76F, LBWdRulerStyle.wdAdjustNone); col.SetWidth(72 * .76F, LBWdRulerStyle.wdAdjustNone);
_WordTbl.Rows.AllowBreakAcrossPages = 0; _WordTbl.Rows.AllowBreakAcrossPages = 0;
} }
private void AddHeader() private void AddHeader()
{ {
//Advance();
WriteCell("START", true, true); WriteCell("START", true, true);
SetIndent(0.32F, -0F); SetIndent(0.32F, -0F);
WriteCell("FUNCTION", true, true); WriteCell("FUNCTION", true, true);
@@ -219,7 +180,6 @@ namespace Volian.Print.Library
// follow through in fixing an Out of Window Handles bug, use new function to see if // follow through in fixing an Out of Window Handles bug, use new function to see if
// we can retrieve the font from a dictionary instead a doing a New and using another // we can retrieve the font from a dictionary instead a doing a New and using another
// window handle B2017-117 // window handle B2017-117
//System.Drawing.Font font = new System.Drawing.Font(_pkFont.Family, (float)_pkFont.Size);
System.Drawing.Font font = VE_Font.GetWinSysFont(_pkFont.Family, (float)_pkFont.Size); System.Drawing.Font font = VE_Font.GetWinSysFont(_pkFont.Family, (float)_pkFont.Size);
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
float w = 0; float w = 0;
@@ -227,8 +187,6 @@ namespace Volian.Print.Library
{ {
w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)_pkFont.Size); w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)_pkFont.Size);
} }
// indented text didn't always line up doing it this way
//float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)_pkFont.Size);
return w; return w;
} }
private void AddHighLevelStep(string number, string text, string done, string page) private void AddHighLevelStep(string number, string text, string done, string page)
@@ -276,7 +234,6 @@ namespace Volian.Print.Library
{ {
Advance(2); Advance(2);
SetIndent(.64F, -.31F); SetIndent(.64F, -.31F);
//_WordSel.InsertSymbol(8226, _WordSel.Font, System.Reflection.Missing.Value, System.Reflection.Missing.Value);
WriteCell("\u2022" + "\t" + text, false, true); WriteCell("\u2022" + "\t" + text, false, true);
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom); SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
WriteCell(done, false, true); WriteCell(done, false, true);
@@ -316,7 +273,7 @@ namespace Volian.Print.Library
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom); SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
WriteCell(page, false, false); WriteCell(page, false, false);
} }
static Regex rgx = new Regex(@"\\(b|ul|up[1-9]|dn0|up0|dn[1-9]|b0|ulnone)( |$|(?=\\))"); static readonly Regex rgx = new Regex(@"\\(b|ul|up[1-9]|dn0|up0|dn[1-9]|b0|ulnone)( |$|(?=\\))");
private void WriteRTF(string text) private void WriteRTF(string text)
{ {
//if (text.Contains("\\")) //if (text.Contains("\\"))
@@ -381,13 +338,7 @@ namespace Volian.Print.Library
{ {
_WordSel.MoveRight(LBWdUnits.wdCell, count, false); _WordSel.MoveRight(LBWdUnits.wdCell, count, false);
} }
private void Advance() private void Advance() => Advance(1);
{ public void Dispose() => _WordApp.Quit(false);
Advance(1);
}
public void Dispose()
{
_WordApp.Quit(false);
}
} }
} }
File diff suppressed because it is too large Load Diff
+31 -97
View File
@@ -1,12 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using iTextSharp.text; using iTextSharp.text;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text.factories;
using Itenso.Rtf; using Itenso.Rtf;
using Itenso.Rtf.Parser;
using Itenso.Rtf.Interpreter;
using Itenso.Rtf.Support; using Itenso.Rtf.Support;
using System.IO; using System.IO;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
@@ -37,24 +32,14 @@ namespace Volian.Print.Library
#region Log4Net #region Log4Net
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion #endregion
private string _Rtf;
public string Rtf public string Rtf { get; set; }
{
get { return _Rtf; }
set { _Rtf = value; }
}
private string _FileName;
public string FileName public string FileName { get; set; }
{
get { return _FileName; }
set { _FileName = value; }
}
public Rtf2Pdf(string rtf, string fileName) public Rtf2Pdf(string rtf, string fileName)
{ {
_Rtf = rtf; Rtf = rtf;
_FileName = fileName; FileName = fileName;
} }
public void Process() public void Process()
{ {
@@ -83,66 +68,30 @@ namespace Volian.Print.Library
yTop = newYTop; yTop = newYTop;
} }
} }
private static string _PaperSize = "LETTER"; // default paper size
public static string PaperSize // C2020-002 paper size is now set in the format files public static string PaperSize // C2020-002 paper size is now set in the format files
{ { get; set; } = "LETTER";
get { return Rtf2Pdf._PaperSize; } public Rectangle PaperSizeRec => PDFPageSize.UsePaperSize(PaperSize); // default paper size = PageSize.LETTER
set { Rtf2Pdf._PaperSize = value; }
} public static bool PdfDebug { get; set; } = true;
private Rectangle _PaperSizeRec = PageSize.LETTER; // default paper size
public Rectangle PaperSizeRec
{
get { return PDFPageSize.UsePaperSize(PaperSize); }
}
private static bool _PdfDebug = true;
public static bool PdfDebug
{
get { return Rtf2Pdf._PdfDebug; }
set { Rtf2Pdf._PdfDebug = value; }
}
private static System.Drawing.PointF _Offset = new System.Drawing.PointF(0, 0); private static System.Drawing.PointF _Offset = new System.Drawing.PointF(0, 0);
public static System.Drawing.PointF Offset public static System.Drawing.PointF Offset
{ {
get { return Rtf2Pdf._Offset; } get { return _Offset; }
set { Rtf2Pdf._Offset = value; } set { _Offset = value; }
} }
public static float FillWidth = 0; // max text width (used in autoToc code) public static float FillWidth = 0; // max text width (used in autoToc code)
private static int _TextAtCounter = 0;
public static int TextAtCounter public static int TextAtCounter { get; set; } = 0;
{ private static int NextTextAtCounter => ++TextAtCounter;
get { return Rtf2Pdf._TextAtCounter; }
set { Rtf2Pdf._TextAtCounter = value; }
}
private static int NextTextAtCounter
{
get
{
int retval = ++TextAtCounter;
//if (InList(retval, 17)) Console.WriteLine("TextAt {0}", retval);
return retval;
}
}
public class VlnSplitCharacter : ISplitCharacter public class VlnSplitCharacter : ISplitCharacter
{ {
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) => (cc[current] == ' ');
{ public bool IsSplitCharacter(char c) => (c == ' ');
return (cc[current] == ' ');
}
public bool IsSplitCharacter(char c)
{
return (c == ' ');
}
}
private static TableScrunching _AllowTableScrunching = TableScrunching.AllPhases; // RHM20150507 Table Scrunch
public static TableScrunching AllowTableScrunching
{
get { return Rtf2Pdf._AllowTableScrunching; }
set { Rtf2Pdf._AllowTableScrunching = value; }
}
public static bool GetTableScrunchingStatus(TableScrunching val)
{
return (val & _AllowTableScrunching) == val;
} }
public static TableScrunching AllowTableScrunching { get; set; } = TableScrunching.AllPhases;
public static bool GetTableScrunchingStatus(TableScrunching val) => (val & AllowTableScrunching) == val;
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter(); public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
public static string ChunkTextAttributesInfo(Chunk chk1) // C2018-004 create meta file for baseline compares public static string ChunkTextAttributesInfo(Chunk chk1) // C2018-004 create meta file for baseline compares
{ {
@@ -180,10 +129,7 @@ namespace Volian.Print.Library
return rtnval; return rtnval;
} }
public static int _lastPageNum = 0; // C2018-004 create meta file for baseline compares public static int _lastPageNum = 0; // C2018-004 create meta file for baseline compares
public static float TextAt(PdfContentByte cb, Paragraph iParagraph, float x, float y, float width, float height, string debugText, float yBottomMargin) public static float TextAt(PdfContentByte cb, Paragraph iParagraph, float x, float y, float width, float height, string debugText, float yBottomMargin) => TextAt(cb, iParagraph, x, y, width, height, debugText, yBottomMargin, null);
{
return TextAt(cb, iParagraph, x, y, width, height, debugText, yBottomMargin, null);
}
public static float TextAt(PdfContentByte cb, Paragraph iParagraph, float x, float y, float width, float height, string debugText, float yBottomMargin, int? itmID) public static float TextAt(PdfContentByte cb, Paragraph iParagraph, float x, float y, float width, float height, string debugText, float yBottomMargin, int? itmID)
{ {
if (cb.PdfDocument.PageNumber != _lastPageNum) // C2018-004 create meta file for baseline compares if (cb.PdfDocument.PageNumber != _lastPageNum) // C2018-004 create meta file for baseline compares
@@ -192,7 +138,7 @@ namespace Volian.Print.Library
_lastPageNum = cb.PdfDocument.PageNumber; _lastPageNum = cb.PdfDocument.PageNumber;
} }
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; PdfLayer textLayer = _MyPageHelper?.TextLayer;
float left = x + Offset.X; float left = x + Offset.X;
float top = y + Offset.Y; float top = y + Offset.Y;
// B2020-059 - Barakah 1T4-OP-EOP-AC-0001 Instructions and Contingency Actions section step 6 last table in RNO is compressed - cause first bullet substep in AER to print on top HLS text // B2020-059 - Barakah 1T4-OP-EOP-AC-0001 Instructions and Contingency Actions section step 6 last table in RNO is compressed - cause first bullet substep in AER to print on top HLS text
@@ -224,8 +170,6 @@ namespace Volian.Print.Library
chk.Attributes.Add("NoSplit", false); chk.Attributes.Add("NoSplit", false);
} }
} }
float right = left + width;
float bottom = top - height;
ColumnText myColumnText = new ColumnText(cb); ColumnText myColumnText = new ColumnText(cb);
myColumnText.SetSimpleColumn(left, top, left + width, yBottomMargin); myColumnText.SetSimpleColumn(left, top, left + width, yBottomMargin);
myColumnText.AddElement(iParagraph); myColumnText.AddElement(iParagraph);
@@ -259,21 +203,21 @@ namespace Volian.Print.Library
} }
return myColumnText.YLine; return myColumnText.YLine;
} }
//For Debugging:
private static bool InList(int value, params int [] examples) private static bool InList(int value, params int [] examples)
{ {
foreach (int ex in examples) foreach (int ex in examples)
if (ex == value) return true; if (ex == value) return true;
return false; return false;
} }
public static float FigureAt(PdfContentByte cb, iTextSharp.text.Image image, float x, float y, float width, float height, string debugText, float yBottommargin, bool hasBorder, int itmID, float sixLinesPerInch) public static float FigureAt(PdfContentByte cb, iTextSharp.text.Image image, float x, float y, float width, float height, string debugText, bool hasBorder, int itmID, float sixLinesPerInch)
{ {
if (cb.PdfDocument.PageNumber != _lastPageNum) // C2018-004 create meta file for baseline compares if (cb.PdfDocument.PageNumber != _lastPageNum) // C2018-004 create meta file for baseline compares
{ {
Volian.Base.Library.BaselineMetaFile.WriteLine("Page Change from {0} to {1}", _lastPageNum, cb.PdfDocument.PageNumber); Volian.Base.Library.BaselineMetaFile.WriteLine("Page Change from {0} to {1}", _lastPageNum, cb.PdfDocument.PageNumber);
_lastPageNum = cb.PdfDocument.PageNumber; _lastPageNum = cb.PdfDocument.PageNumber;
} }
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; PdfLayer textLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.TextLayer;
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
float left = x + Offset.X; float left = x + Offset.X;
float top = y + Offset.Y + sixLinesPerInch; float top = y + Offset.Y + sixLinesPerInch;
float bottom = top - height; float bottom = top - height;
@@ -309,12 +253,9 @@ namespace Volian.Print.Library
return bottom; return bottom;
} }
private static float _GridTopAdjust = -10;
public static float GridTopAdjust public static float GridTopAdjust { get; set; } = -10;
{ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "debugText Kept For Debugging")]
get { return _GridTopAdjust; }
set { _GridTopAdjust = value; }
}
public static float GridAt(PdfContentByte cb, vlnTable myGrid, float x, float y, float width, float height, string debugText, float yBottomMargin, bool hasBorder) public static float GridAt(PdfContentByte cb, vlnTable myGrid, float x, float y, float width, float height, string debugText, float yBottomMargin, bool hasBorder)
{ {
if (cb.PdfDocument.PageNumber != _lastPageNum) // C2018-004 create meta file for baseline compares if (cb.PdfDocument.PageNumber != _lastPageNum) // C2018-004 create meta file for baseline compares
@@ -322,8 +263,6 @@ namespace Volian.Print.Library
Volian.Base.Library.BaselineMetaFile.WriteLine("Page Change from {0} to {1}", _lastPageNum, cb.PdfDocument.PageNumber); Volian.Base.Library.BaselineMetaFile.WriteLine("Page Change from {0} to {1}", _lastPageNum, cb.PdfDocument.PageNumber);
_lastPageNum = cb.PdfDocument.PageNumber; _lastPageNum = cb.PdfDocument.PageNumber;
} }
//VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; // RHM20150507 Table Scrunch
//PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; // RHM20150507 Table Scrunch
float left = x + Offset.X; float left = x + Offset.X;
float top = y + Offset.Y; float top = y + Offset.Y;
float right = left + width; float right = left + width;
@@ -331,7 +270,6 @@ namespace Volian.Print.Library
int paperSizePoints = PDFPageSize.PaperSizePoints(myGrid.MyFlexGrid.MyDVI.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files int paperSizePoints = PDFPageSize.PaperSizePoints(myGrid.MyFlexGrid.MyDVI.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
ColumnText myColumnText = new ColumnText(cb); ColumnText myColumnText = new ColumnText(cb);
myColumnText.SetSimpleColumn(left, top, left + width, yBottomMargin); myColumnText.SetSimpleColumn(left, top, left + width, yBottomMargin);
//if (textLayer != null) cb.BeginLayer(textLayer); // RHM20150507 Table Scrunch
// C2018-004 create meta file for baseline compares // C2018-004 create meta file for baseline compares
if (top + GridTopAdjust > paperSizePoints) // B2019-110 Table continued on the next page - off the top of page if (top + GridTopAdjust > paperSizePoints) // B2019-110 Table continued on the next page - off the top of page
{ {
@@ -340,13 +278,11 @@ namespace Volian.Print.Library
} }
Volian.Base.Library.BaselineMetaFile.WriteLine("GD left={0} top={1} right={2} bottom={3} Mygrid.ItmID={4}", left, top + GridTopAdjust, right, bottom, myGrid.ItemID); Volian.Base.Library.BaselineMetaFile.WriteLine("GD left={0} top={1} right={2} bottom={3} Mygrid.ItmID={4}", left, top + GridTopAdjust, right, bottom, myGrid.ItemID);
myGrid.ToPdf(myColumnText, left, top + GridTopAdjust); myGrid.ToPdf(myColumnText, left, top + GridTopAdjust);
//if (textLayer != null) cb.EndLayer(); // RHM20150507 Table Scrunch
return bottom; return bottom;
} }
internal static void DrawPdfDebug(PdfContentByte cb, float left, float top, float right, float bottom, string debugText, float yDescent) internal static void DrawPdfDebug(PdfContentByte cb, float left, float top, float right, float bottom, string debugText, float yDescent)
{ {
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; PdfLayer debugLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.DebugLayer;
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;
if (debugLayer == null) return; if (debugLayer == null) return;
System.Drawing.Color sysColor = PrintOverride.OverrideDebugColor(System.Drawing.Color.Gray); System.Drawing.Color sysColor = PrintOverride.OverrideDebugColor(System.Drawing.Color.Gray);
cb.SaveState(); cb.SaveState();
@@ -374,18 +310,16 @@ namespace Volian.Print.Library
cb.RestoreState(); cb.RestoreState();
} }
internal static float RtfRawAt(PdfContentByte cb, System.Drawing.Image image, float XOffset, float yLocation, float Width, float Height, string debug, float yBottomMargin, bool hasBorder) internal static float RtfRawAt(PdfContentByte cb, System.Drawing.Image image, float XOffset, float yLocation, float Width, float Height, string debug, bool hasBorder)
{ {
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; PdfLayer textLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.TextLayer;
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
float left = XOffset + Offset.X; float left = XOffset + Offset.X;
float top = yLocation + Offset.Y; float top = yLocation + Offset.Y;
float bottom = top - Height; float bottom = top - Height;
float scale = .6f; float scale = .6f;
iTextSharp.text.Image it_image=null;
try try
{ {
it_image = iTextSharp.text.Image.GetInstance(image,iTextSharp.text.Color.WHITE); iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(image, iTextSharp.text.Color.WHITE);
float itxtWid = scale * Width * 300 / 72; float itxtWid = scale * Width * 300 / 72;
float itxtHt = scale * Height * 300 / 72; float itxtHt = scale * Height * 300 / 72;
it_image.ScaleAbsoluteWidth(scale * Width); it_image.ScaleAbsoluteWidth(scale * Width);
+39 -96
View File
@@ -1,18 +1,13 @@
using System; using System;
using System.Collections.Generic;
using System.Text; using System.Text;
using iTextSharp.text; using iTextSharp.text;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text.factories;
using Itenso.Rtf; using Itenso.Rtf;
using Itenso.Rtf.Parser;
using Itenso.Rtf.Interpreter;
//using Itenso.Rtf.Model;
using Itenso.Rtf.Support; using Itenso.Rtf.Support;
using Microsoft.Win32;
using Volian.Base.Library; using Volian.Base.Library;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using System.Linq;
namespace Volian.Print.Library namespace Volian.Print.Library
{ {
@@ -21,17 +16,13 @@ namespace Volian.Print.Library
public static bool CompressSub = false; public static bool CompressSub = false;
public static bool CompressSuper = false; public static bool CompressSuper = false;
public static bool CompressPropSubSup = false; public static bool CompressPropSubSup = false;
private static System.Drawing.Color _TextColor = System.Drawing.Color.Empty;
public static System.Drawing.Color TextColor public static System.Drawing.Color TextColor { get; set; } = System.Drawing.Color.Empty;
{
get { return _TextColor; }
set { _TextColor = value; }
}
public static System.Drawing.Color OverrideTextColor(System.Drawing.Color color) public static System.Drawing.Color OverrideTextColor(System.Drawing.Color color)
{ {
if (_TextColor == System.Drawing.Color.Empty) if (TextColor == System.Drawing.Color.Empty)
return color; return color;
return _TextColor; return TextColor;
} }
private static System.Drawing.Color _SvgColor = System.Drawing.Color.Empty; private static System.Drawing.Color _SvgColor = System.Drawing.Color.Empty;
public static System.Drawing.Color SvgColor public static System.Drawing.Color SvgColor
@@ -45,29 +36,21 @@ namespace Volian.Print.Library
return color; return color;
return _SvgColor; return _SvgColor;
} }
private static System.Drawing.Color _BoxColor = System.Drawing.Color.Empty;
public static System.Drawing.Color BoxColor public static System.Drawing.Color BoxColor { get; set; } = System.Drawing.Color.Empty;
{
get { return _BoxColor; }
set { _BoxColor = value; }
}
public static System.Drawing.Color OverrideBoxColor(System.Drawing.Color color) public static System.Drawing.Color OverrideBoxColor(System.Drawing.Color color)
{ {
if (_BoxColor == System.Drawing.Color.Empty) if (BoxColor == System.Drawing.Color.Empty)
return color; return color;
return _BoxColor; return BoxColor;
}
private static System.Drawing.Color _ChangeBarColor = System.Drawing.Color.Empty;
public static System.Drawing.Color ChangeBarColor
{
get { return _ChangeBarColor; }
set { _ChangeBarColor = value; }
} }
public static System.Drawing.Color ChangeBarColor { get; set; } = System.Drawing.Color.Empty;
public static System.Drawing.Color OverrideChangeBarColor(System.Drawing.Color color) public static System.Drawing.Color OverrideChangeBarColor(System.Drawing.Color color)
{ {
if (_ChangeBarColor == System.Drawing.Color.Empty) if (ChangeBarColor == System.Drawing.Color.Empty)
return color; return color;
return _ChangeBarColor; return ChangeBarColor;
} }
private static System.Drawing.Color _DebugColor = System.Drawing.Color.Empty; private static System.Drawing.Color _DebugColor = System.Drawing.Color.Empty;
public static System.Drawing.Color DebugColor public static System.Drawing.Color DebugColor
@@ -93,42 +76,16 @@ namespace Volian.Print.Library
public class Rtf2iTextSharp : RtfVisualVisitorBase public class Rtf2iTextSharp : RtfVisualVisitorBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private bool _HasIndent = false;
public bool HasIndent public bool HasIndent { get; set; } = false;
{ private readonly IRtfDocument _RtfDoc;
get { return _HasIndent; } private readonly Paragraph _MyParagraph = new Paragraph();
set { _HasIndent = value; }
}
private IRtfDocument _RtfDoc;
private Paragraph _MyParagraph = new Paragraph();
private iTextSharp.text.Font _MyFont; private iTextSharp.text.Font _MyFont;
// Allow for definition of a default font: if the font is not proportional, this gets set. public iTextSharp.text.Font DefaultFont { get; set; }
// It is needed to set the chunk's font if the first character of a cell is a hardspace (or various public string MyDebugID { get; set; } = null;
// other special cases (see its use below). Without this, pdfs were using the Helvetica font,
// which is a default itextsharp font (this was causing a problem for HLP, their pdfs could not
// contain a Helvetica font when putting them in their production environment).
private iTextSharp.text.Font _DefaultFont;
public iTextSharp.text.Font DefaultFont
{
get { return _DefaultFont; }
set { _DefaultFont = value; }
}
private string _MyDebugID = null;
public string MyDebugID
{
get { return _MyDebugID; }
set { _MyDebugID = value; }
}
public bool DoPdfLinks = false; public bool DoPdfLinks = false;
// public Rtf2iTextSharp(IRtfDocument rtfDoc, Document doc, PdfWriter writer) public Rtf2iTextSharp(IRtfDocument rtfDoc) => _RtfDoc = rtfDoc ?? throw new ArgumentNullException("rtfDoc");
public Rtf2iTextSharp(IRtfDocument rtfDoc)
{
if (rtfDoc == null)
throw new ArgumentNullException("rtfDoc");
_RtfDoc = rtfDoc;
}
public Paragraph Convert() public Paragraph Convert()
{ {
int profileDepth = ProfileTimer.Push(">>>> Rtf2ITextSharp.Convert"); int profileDepth = ProfileTimer.Push(">>>> Rtf2ITextSharp.Convert");
@@ -138,7 +95,6 @@ namespace Volian.Print.Library
{ {
visual.Visit(this); visual.Visit(this);
} }
//_MyParagraph.SetLeading(0, 1);
ProfileTimer.Pop(profileDepth); ProfileTimer.Pop(profileDepth);
return _MyParagraph; return _MyParagraph;
} }
@@ -177,6 +133,7 @@ namespace Volian.Print.Library
_lastWasLineBreak = 0; // B2017-191 reset hard return count _lastWasLineBreak = 0; // B2017-191 reset hard return count
break; break;
} }
//For Debugging:
//_MyParagraph.Add(string.Format("<{0}>", visualBreak.BreakKind.ToString())); //_MyParagraph.Add(string.Format("<{0}>", visualBreak.BreakKind.ToString()));
} }
private void AddChunk(string str, iTextSharp.text.Font font) private void AddChunk(string str, iTextSharp.text.Font font)
@@ -188,6 +145,7 @@ namespace Volian.Print.Library
} }
protected override void DoVisitSpecial(IRtfVisualSpecialChar visualSpecialChar) protected override void DoVisitSpecial(IRtfVisualSpecialChar visualSpecialChar)
{ {
//For Debugging:
//_MyParagraph.Add(string.Format("<special {0}>", visualSpecialChar.CharKind.ToString())); //_MyParagraph.Add(string.Format("<special {0}>", visualSpecialChar.CharKind.ToString()));
iTextSharp.text.Font activeFont = _MyFont ?? DefaultFont; iTextSharp.text.Font activeFont = _MyFont ?? DefaultFont;
switch (visualSpecialChar.CharKind) switch (visualSpecialChar.CharKind)
@@ -248,23 +206,15 @@ namespace Volian.Print.Library
if (c <= '\x7F') return false; if (c <= '\x7F') return false;
return true; return true;
} }
//For Debugging:
private bool ContainsAnySymbols(string p) private bool ContainsAnySymbols(string p)
{ {
foreach (char c in p) foreach (char c in p)
if (c > '\x7F' && c != '\xA0' && c != '\xB0') return true; if (c > '\x7F' && c != '\xA0' && c != '\xB0') return true;
return false; return false;
} }
// The funcction below was used for the first few lines of DoVisitText which have been commented-out
//private object FixText(string str)
//{
// StringBuilder sb = new StringBuilder();
// foreach (char c in str)
// if (c < ' ' || c > '\xFF')
// sb.Append(string.Format("[{0}]", (int)c));
// else
// sb.Append(c);
// return sb.ToString();
//}
// ParseLink & GetDefaultItemInfo (which used to be in vlnParagraph) support coding that was added to DoVisitText for // ParseLink & GetDefaultItemInfo (which used to be in vlnParagraph) support coding that was added to DoVisitText for
// doing pdflink for each transition/ro in a step, see bug B2019-052 // doing pdflink for each transition/ro in a step, see bug B2019-052
private RoUsageInfo _Roui = null; private RoUsageInfo _Roui = null;
@@ -278,8 +228,9 @@ namespace Volian.Print.Library
if (_LinkInfoText.Contains(@"\v")) if (_LinkInfoText.Contains(@"\v"))
throw new Exception("LinkText.ParseLink found RTF token"); throw new Exception("LinkText.ParseLink found RTF token");
Match m = Regex.Match(_LinkInfoText, @"[#]Link:([A-Za-z]*):(.*)"); Match m = Regex.Match(_LinkInfoText, @"[#]Link:([A-Za-z]*):(.*)");
string _MyValue = m.Groups[1].Value; //For Debugging:
string _MyLink = "#Link:" + m.Groups[2].Value + ":" + m.Groups[3].Value; //string _MyValue = m.Groups[1].Value;
//string _MyLink = "#Link:" + m.Groups[2].Value + ":" + m.Groups[3].Value;
switch (m.Groups[1].Value) switch (m.Groups[1].Value)
{ {
case "ReferencedObject": case "ReferencedObject":
@@ -319,7 +270,7 @@ namespace Volian.Print.Library
if (myItemInfo.IsProcedure && myItemInfo.Sections != null) if (myItemInfo.IsProcedure && myItemInfo.Sections != null)
{ {
SectionInfo siProcedureSteps = null; SectionInfo siProcedureSteps = null;
foreach (SectionInfo si in myItemInfo.Sections) foreach (SectionInfo si in myItemInfo.Sections.OfType<SectionInfo>())
{ {
if (si.IsDefaultSection) if (si.IsDefaultSection)
{ {
@@ -347,7 +298,7 @@ namespace Volian.Print.Library
private static int chkStart = -1; private static int chkStart = -1;
protected override void DoVisitText(IRtfVisualText visualText) protected override void DoVisitText(IRtfVisualText visualText)
{ {
//Code to find text (non-symbol) being output with a symbol font //Debugging Code to find text (non-symbol) being output with a symbol font
//if(visualText.Format.Font.Name=="VESymbFix" && visualText.Text.Length > 1) //if(visualText.Format.Font.Name=="VESymbFix" && visualText.Text.Length > 1)
//{ //{
// string s = visualText.Text; // string s = visualText.Text;
@@ -375,8 +326,7 @@ namespace Volian.Print.Library
{ {
try try
{ {
Chunk chk = _MyParagraph.Chunks[i] as Chunk; if (_MyParagraph.Chunks[i] is Chunk chk)
if (chk != null)
{ {
if (_linkType == 2 && _Ti != null) // transition if (_linkType == 2 && _Ti != null) // transition
{ {
@@ -398,7 +348,7 @@ namespace Volian.Print.Library
{ {
// C2024-009 add PDF file prefix and suffix if available to the PDF file name in the transition reference. // C2024-009 add PDF file prefix and suffix if available to the PDF file name in the transition reference.
DocVersionConfig dvc = _Ti.MyItemToID.MyProcedure.MyDocVersion.DocVersionConfig; DocVersionConfig dvc = _Ti.MyItemToID.MyProcedure.MyDocVersion.DocVersionConfig;
string remotePDFName = dvc.Print_PDFFilePrefix + _Ti.MyItemToID.MyProcedure.DisplayNumber.Replace("/", "_") + dvc.Print_PDFFileSuffix + ".pdf"; string remotePDFName = $"{dvc.Print_PDFFilePrefix}{_Ti.MyItemToID.MyProcedure.DisplayNumber.Replace("/", "_")}{dvc.Print_PDFFileSuffix}.pdf";
chk.SetRemoteGoto(remotePDFName, string.Format("ItemID={0}", tiDefault.ItemID)); chk.SetRemoteGoto(remotePDFName, string.Format("ItemID={0}", tiDefault.ItemID));
chk.SetBackground(new Color(System.Drawing.Color.PeachPuff)); chk.SetBackground(new Color(System.Drawing.Color.PeachPuff));
} }
@@ -630,6 +580,7 @@ namespace Volian.Print.Library
} }
} }
//For Debugging:
private string ShowSpecialCharacters(string p) private string ShowSpecialCharacters(string p)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@@ -642,31 +593,23 @@ namespace Volian.Print.Library
sb.Append(c); sb.Append(c);
} }
return sb.ToString(); return sb.ToString();
}// DoVisitText }
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
protected override void DoVisitImage(IRtfVisualImage visualImage) protected override void DoVisitImage(IRtfVisualImage visualImage)
{ {
//_MyParagraph.Add(new Chunk("<Image>"));
//DateTime dt1 = DateTime.Now;
//System.Drawing.Image img2 = visualImage.ImageForDrawing;
//Console.WriteLine("1 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
//img2.Save(@"c:\datacvrt\x.png");
System.IO.MemoryStream ms = new System.IO.MemoryStream();
//Console.WriteLine("2 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds); using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
//Console.WriteLine("Size {0}", visualImage.ImageForDrawing.Size); {
visualImage.ImageForDrawing.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); visualImage.ImageForDrawing.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
//Console.WriteLine("3 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
ms.Seek(0, System.IO.SeekOrigin.Begin); ms.Seek(0, System.IO.SeekOrigin.Begin);
//Console.WriteLine("4 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(ms); iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(ms);
//Console.WriteLine("5 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
_MyParagraph.Add(img); _MyParagraph.Add(img);
//Console.WriteLine("6 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds); }
_lastWasLineBreak = 0; // B2017-191 reset hard return count _lastWasLineBreak = 0; // B2017-191 reset hard return count
} // DoVisitImage }
} }
} }
File diff suppressed because it is too large Load Diff
@@ -106,6 +106,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="CompleteRORpt.cs" /> <Compile Include="CompleteRORpt.cs" />
<Compile Include="CPSGen.cs" /> <Compile Include="CPSGen.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Grid2Pdf.cs" /> <Compile Include="Grid2Pdf.cs" />
<Compile Include="MergedPdf.cs" /> <Compile Include="MergedPdf.cs" />
<Compile Include="PageCount.cs" /> <Compile Include="PageCount.cs" />
+23 -42
View File
@@ -1,46 +1,26 @@
using System; using System;
using System.Collections.Generic;
using System.Text; using System.Text;
using iTextSharp.text; using iTextSharp.text;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using System.IO; using System.IO;
using Microsoft.Win32;
using Volian.Base.Library; using Volian.Base.Library;
namespace Volian.Print.Library namespace Volian.Print.Library
{ {
public class pdf public class pdf
{ {
private Document _MyDocument; public Document MyDocument { get; set; }
public Document MyDocument public PdfWriter MyWriter { get; set; }
{ public string MyFileName { get; set; }
get { return _MyDocument; } public PdfContentByte ContentByte => MyWriter.DirectContent;
set { _MyDocument = value; }
}
private PdfWriter _MyWriter;
public PdfWriter MyWriter
{
get { return _MyWriter; }
set { _MyWriter = value; }
}
private string _MyFileName;
public string MyFileName
{
get { return _MyFileName; }
set { _MyFileName = value; }
}
public PdfContentByte ContentByte
{
get { return _MyWriter.DirectContent; }
}
public pdf(string myFileName) public pdf(string myFileName)
{ {
_MyFileName = myFileName; MyFileName = myFileName;
_MyDocument = new Document(PageSize.LETTER); MyDocument = new Document(PageSize.LETTER);
try try
{ {
_MyWriter = PdfWriter.GetInstance(_MyDocument, new FileStream(myFileName, FileMode.Create)); MyWriter = PdfWriter.GetInstance(MyDocument, new FileStream(myFileName, FileMode.Create));
_MyWriter.SetAtLeastPdfVersion(PdfWriter.VERSION_1_7); MyWriter.SetAtLeastPdfVersion(PdfWriter.VERSION_1_7);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -49,24 +29,21 @@ namespace Volian.Print.Library
} }
public pdf(string myFileName, Rectangle mySize) public pdf(string myFileName, Rectangle mySize)
{ {
_MyFileName = myFileName; MyFileName = myFileName;
_MyDocument = new Document(mySize); MyDocument = new Document(mySize);
try try
{ {
_MyWriter = PdfWriter.GetInstance(_MyDocument, new FileStream(myFileName, FileMode.Create)); MyWriter = PdfWriter.GetInstance(MyDocument, new FileStream(myFileName, FileMode.Create));
_MyWriter.SetAtLeastPdfVersion(PdfWriter.VERSION_1_7); MyWriter.SetAtLeastPdfVersion(PdfWriter.VERSION_1_7);
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("{0} - {1}\r\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace); Console.WriteLine("{0} - {1}\r\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace);
} }
} }
public void Close() public void Close() => MyDocument.Close();
{ private readonly Color _WatermarkColor = Color.BLUE;
MyDocument.Close(); private readonly float _WatermarkOpacity = .10F;
}
private Color _WatermarkColor = Color.BLUE;
private float _WatermarkOpacity = .10F;
public void WatermarkPageNumber(int pageNumber) public void WatermarkPageNumber(int pageNumber)
{ {
Rectangle pageSize = ContentByte.PdfWriter.PageSize; // Get page size Rectangle pageSize = ContentByte.PdfWriter.PageSize; // Get page size
@@ -84,8 +61,10 @@ namespace Volian.Print.Library
ContentByte.SetLineWidth(.5F); ContentByte.SetLineWidth(.5F);
ContentByte.SetFontAndSize(myBasefont, myFontSize);// Set font and size ContentByte.SetFontAndSize(myBasefont, myFontSize);// Set font and size
ContentByte.SetColorStroke(_WatermarkColor); ContentByte.SetColorStroke(_WatermarkColor);
PdfGState gs2 = new PdfGState(); PdfGState gs2 = new PdfGState
gs2.StrokeOpacity = _WatermarkOpacity; {
StrokeOpacity = _WatermarkOpacity
};
ContentByte.SetGState(gs2); ContentByte.SetGState(gs2);
ContentByte.ShowTextAlignedKerned(PdfContentByte.ALIGN_CENTER, strPage, pageSize.Width / 2, 0, 0);// Draw the text ContentByte.ShowTextAlignedKerned(PdfContentByte.ALIGN_CENTER, strPage, pageSize.Width / 2, 0, 0);// Draw the text
ContentByte.EndText(); ContentByte.EndText();
@@ -108,8 +87,10 @@ namespace Volian.Print.Library
{ {
PdfPatternPainter myPatternPainter; PdfPatternPainter myPatternPainter;
myPatternPainter = ContentByte.CreatePattern(radius * 4, radius * 2, radius * 4, radius * 2); myPatternPainter = ContentByte.CreatePattern(radius * 4, radius * 2, radius * 4, radius * 2);
PdfGState gState = new PdfGState(); PdfGState gState = new PdfGState
gState.FillOpacity = _WatermarkOpacity; {
FillOpacity = _WatermarkOpacity
};
myPatternPainter.SetGState(gState); myPatternPainter.SetGState(gState);
myPatternPainter.SetColorFill(_WatermarkColor); myPatternPainter.SetColorFill(_WatermarkColor);
myPatternPainter.Rectangle(0, 0, radius, radius); myPatternPainter.Rectangle(0, 0, radius, radius);
+6 -17
View File
@@ -1,26 +1,15 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
namespace Volian.Print.Library namespace Volian.Print.Library
{ {
public class pkParagraph public class pkParagraph
{ {
private vlnParagraph _MyParagraph; private readonly vlnParagraph _MyParagraph;
public vlnParagraph MyParagraph public vlnParagraph MyParagraph => _MyParagraph;
{ private readonly pkParagraphs _MyChildren;
get { return _MyParagraph; } public pkParagraphs MyChildren => _MyChildren;
} private readonly pkParagraphs _MyCautionsAndNotes;
private pkParagraphs _MyChildren; public pkParagraphs MyCautionsAndNotes => _MyCautionsAndNotes;
public pkParagraphs MyChildren
{
get { return _MyChildren; }
}
private pkParagraphs _MyCautionsAndNotes;
public pkParagraphs MyCautionsAndNotes
{
get { return _MyCautionsAndNotes; }
}
public pkParagraph(vlnParagraph myParagraph) public pkParagraph(vlnParagraph myParagraph)
{ {
_MyParagraph = myParagraph; _MyParagraph = myParagraph;
+35 -69
View File
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Drawing; using System.Drawing;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
@@ -12,20 +11,8 @@ namespace Volian.Print.Library
public partial class vlnBox : vlnPrintObject public partial class vlnBox : vlnPrintObject
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private int _LineType; /* how to represent?? */
private System.Drawing.Color _Color;
public System.Drawing.Color Color
{
get { return _Color; }
set { _Color = value; }
}
private Box _MyBox;
public Box MyBox public Box MyBox { get; set; }
{
get { return _MyBox; }
set { _MyBox = value; }
}
// the following two fields are used if 'boxed' step, thus // the following two fields are used if 'boxed' step, thus
// no 'Box' was defined in format file. // no 'Box' was defined in format file.
public override float Height public override float Height
@@ -41,26 +28,13 @@ namespace Volian.Print.Library
public string DefBox = null; public string DefBox = null;
public float DefEnd = 0; public float DefEnd = 0;
private bool _ContainsPageBreak = false; public bool ContainsPageBreak { get; set; } = false;
public bool ContainsPageBreak public bool DoubleBoxHls { get; set; } = false;
{
get { return _ContainsPageBreak; }
set { _ContainsPageBreak = value; }
}
private bool _DoubleBoxHls = false; // BGE double lined box around HLS
public bool DoubleBoxHls
{
get { return _DoubleBoxHls; }
set { _DoubleBoxHls = value; }
}
public const string DOUBLEboxHLS = "DoubleBox"; public const string DOUBLEboxHLS = "DoubleBox";
//private bool _DoBottom = true; //private bool _DoBottom = true;
public vlnBox() public vlnBox()
{ {
} }
public vlnBox(vlnParagraph paragraph)
{
}
public const string BoxThin = "\x2510.\x2500.\x250c.\x2502. . .\x2518.\x2514. .\x2500. . "; public const string BoxThin = "\x2510.\x2500.\x250c.\x2502. . .\x2518.\x2514. .\x2500. . ";
const string BoxThick = "\x2584.\x2584.\x2584.\x2588. . .\x2580.\x2580. .\x2580. . "; const string BoxThick = "\x2584.\x2584.\x2584.\x2588. . .\x2580.\x2580. .\x2580. . ";
const string BoxDouble = "\x2557.\x2550.\x2554.\x2551. . .\x255D.\x255A. .\x2550. . "; const string BoxDouble = "\x2557.\x2550.\x2554.\x2551. . .\x255D.\x255A. .\x2550. . ";
@@ -95,10 +69,9 @@ namespace Volian.Print.Library
if (MyBox == null) return yPageStart; if (MyBox == null) return yPageStart;
cb.SaveState(); cb.SaveState();
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; PdfLayer textLayer = _MyPageHelper?.TextLayer;
if (textLayer != null) cb.BeginLayer(textLayer); if (textLayer != null) cb.BeginLayer(textLayer);
MyContentByte = cb; MyContentByte = cb;
//Console.WriteLine("'{0}','{1}'", CharToAsc(MyBox.BoxStyle), MyParent.MyItemInfo.ShortPath);
float top = CalculateYOffset(yPageStart, yTopMargin) - (7*MyPageHelper.YMultiplier); float top = CalculateYOffset(yPageStart, yTopMargin) - (7*MyPageHelper.YMultiplier);
float bottom = top - (Height * MyPageHelper.YMultiplier); float bottom = top - (Height * MyPageHelper.YMultiplier);
float left = (float)((MyBox.Start ?? 0) + MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin); float left = (float)((MyBox.Start ?? 0) + MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin);
@@ -157,7 +130,7 @@ namespace Volian.Print.Library
else else
{ {
const float llxOffset = 3; const float llxOffset = 3;
float lineThickness = 0; float lineThickness;
switch (MyBox.BoxStyle) switch (MyBox.BoxStyle)
{ {
case BoxThin: case BoxThin:
@@ -331,8 +304,6 @@ namespace Volian.Print.Library
// create a new font without any styles such as underline. // create a new font without any styles such as underline.
E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None; E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None;
// if the box has a font, use it - otherwise use this item info's font
VE_Font vf = null;
bool UseBoxFont = false; bool UseBoxFont = false;
try try
{ {
@@ -341,6 +312,8 @@ namespace Volian.Print.Library
catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false. catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false.
{ {
} }
// if the box has a font, use it - otherwise use this item info's font
VE_Font vf;
if (UseBoxFont) if (UseBoxFont)
vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
else else
@@ -355,21 +328,21 @@ namespace Volian.Print.Library
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append(MyBox.BXULC); sb.Append(MyBox.BXULC);
float size = GetTextWidth(vf, MyBox.BXULC); //(float)(MyBox.BXULC.Length * (72 / vf.CPI)); float size = GetTextWidth(vf, MyBox.BXULC); //(float)(MyBox.BXULC.Length * (72 / vf.CPI));
string bxstr = null; string bxstr;
if (!ContainsPageBreak) // Only do top line if there is no page break. if (!ContainsPageBreak) // Only do top line if there is no page break.
{ {
while (size < endHorz) while (size < endHorz)
{ {
sb.Append(MyBox.BXHorz); sb.Append(MyBox.BXHorz);
size = size + bxHorzTextWidth; //(float)(MyBox.BXHorz.Length * (72 / vf.CPI)); size += bxHorzTextWidth; //(float)(MyBox.BXHorz.Length * (72 / vf.CPI));
} }
// Tack on the right upper corner. For some formats, the upper right corner in the // Tack on the right upper corner. For some formats, the upper right corner in the
// had the first character as a space, this would put two spaces in a row at the // had the first character as a space, this would put two spaces in a row at the
// end of the string, so remove the space before tacking on the upper right corner: // end of the string, so remove the space before tacking on the upper right corner:
bxstr = sb.ToString(); bxstr = sb.ToString();
if (bxstr[bxstr.Length - 1] == ' ' && MyBox.BXURC[0] == ' ') bxstr = bxstr.TrimEnd(); if (bxstr[bxstr.Length - 1] == ' ' && MyBox.BXURC[0] == ' ') bxstr = bxstr.TrimEnd();
bxstr = bxstr + MyBox.BXURC; bxstr += MyBox.BXURC;
size = size + GetTextWidth(vf, MyBox.BXURC);//(float)((MyBox.BXURC.Length) * (72 / vf.CPI)); size += GetTextWidth(vf, MyBox.BXURC);//(float)((MyBox.BXURC.Length) * (72 / vf.CPI));
Rtf = GetRtf(bxstr, vf); Rtf = GetRtf(bxstr, vf);
IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. IParagraph = null; // set to null so that next access of IParagraph sets the Rtf.
Rtf2Pdf.TextAt(cb, IParagraph, left, top, size + 10, 100, "", yBottomMargin); Rtf2Pdf.TextAt(cb, IParagraph, left, top, size + 10, 100, "", yBottomMargin);
@@ -384,15 +357,15 @@ namespace Volian.Print.Library
while (size < endHorz) while (size < endHorz)
{ {
sb.Append(MyBox.BXHorz); sb.Append(MyBox.BXHorz);
size = size + bxHorzTextWidth;//(float)(MyBox.BXHorz.Length * (72 / vf.CPI)); size += bxHorzTextWidth;//(float)(MyBox.BXHorz.Length * (72 / vf.CPI));
} }
bxstr = sb.ToString().TrimEnd() + MyBox.BXLRC; bxstr = sb.ToString().TrimEnd() + MyBox.BXLRC;
size = size + GetTextWidth(vf, MyBox.BXLRC); //(float)((MyBox.BXLRC.Length) * (72 / vf.CPI)); size += GetTextWidth(vf, MyBox.BXLRC); //(float)((MyBox.BXLRC.Length) * (72 / vf.CPI));
Rtf = GetRtf(bxstr, vf); Rtf = GetRtf(bxstr, vf);
IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. IParagraph = null; // set to null so that next access of IParagraph sets the Rtf.
Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size + 10, 100, "", yBottomMargin); Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size + 10, 100, "", yBottomMargin);
} }
private string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab private readonly string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab
// add symbol characters as needed // add symbol characters as needed
// "\u25CF" - solid bullet // "\u25CF" - solid bullet
// \x0394 - delta // \x0394 - delta
@@ -409,8 +382,6 @@ namespace Volian.Print.Library
// follow through in fixing an Out of Window Handles bug, use new function to see if // follow through in fixing an Out of Window Handles bug, use new function to see if
// we can retrieve the font from a dictionary instead a doing a New and using another // we can retrieve the font from a dictionary instead a doing a New and using another
// window handle // window handle
//System.Drawing.Font font = new System.Drawing.Font(vefont.Family, (float)vefont.Size, GetSysFontStyle(vefont));
//System.Drawing.Font symbFont = new System.Drawing.Font(symblFontName, (float)vefont.Size);
System.Drawing.Font font = VE_Font.GetWinSysFont(vefont.Family, (float)vefont.Size, GetSysFontStyle(vefont)); System.Drawing.Font font = VE_Font.GetWinSysFont(vefont.Family, (float)vefont.Size, GetSysFontStyle(vefont));
System.Drawing.Font symbFont = VE_Font.GetWinSysFont(symblFontName, (float)vefont.Size); System.Drawing.Font symbFont = VE_Font.GetWinSysFont(symblFontName, (float)vefont.Size);
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
@@ -424,9 +395,9 @@ namespace Volian.Print.Library
else else
w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)vefont.Size); w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)vefont.Size);
} }
//float w = iFont.BaseFont.GetWidthPointKerned(Text.Replace("\u25CF","@"), (float)vefont.Size);
return w; return w;
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "top and bottom kept for debugging")]
private void DrawAsteriskSide(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, float top, float bottom, float left, float right, VE_Font vef) private void DrawAsteriskSide(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, float top, float bottom, float left, float right, VE_Font vef)
{ {
// set the top & bottom of sides. If there is a page break in the middle of box, adjust these. // set the top & bottom of sides. If there is a page break in the middle of box, adjust these.
@@ -453,8 +424,6 @@ namespace Volian.Print.Library
// create a new font without any styles such as underline. // create a new font without any styles such as underline.
E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None; E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None;
// if the box has a font, use it - otherwise use this item info's font
VE_Font vf = null;
bool UseBoxFont = false; bool UseBoxFont = false;
try try
{ {
@@ -463,6 +432,8 @@ namespace Volian.Print.Library
catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false. catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false.
{ {
} }
// if the box has a font, use it - otherwise use this item info's font
VE_Font vf;
if (UseBoxFont) if (UseBoxFont)
vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
else else
@@ -503,17 +474,8 @@ namespace Volian.Print.Library
} }
return sb.ToString(); return sb.ToString();
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static List<string> _UnimplementedBoxStyles = new List<string>(); private static List<string> _UnimplementedBoxStyles = new List<string>();
private string CharToAsc(string p)
{
StringBuilder sb = new StringBuilder();
foreach (char c in p)
{
if (c >= ' ' && c < 127) sb.Append(c);
else sb.Append(string.Format("\\x{0:x}", (int)c));
}
return sb.ToString();
}
private void DrawAsteriskTopBottomHLS(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, ref float top, ref float bottom, float left, VE_Font vef) private void DrawAsteriskTopBottomHLS(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, ref float top, ref float bottom, float left, VE_Font vef)
{ {
// this box is not drawn, it is a series of asterisks drawn above and below text. // this box is not drawn, it is a series of asterisks drawn above and below text.
@@ -527,8 +489,6 @@ namespace Volian.Print.Library
bottom = ytmpbottom1; bottom = ytmpbottom1;
// create a new font without any styles such as underline. // create a new font without any styles such as underline.
E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None; E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None;
// if the box has a font, use it - otherwise use this item info's font
VE_Font vf = null;
bool UseBoxFont = false; bool UseBoxFont = false;
try try
{ {
@@ -537,6 +497,8 @@ namespace Volian.Print.Library
catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false. catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false.
{ {
} }
// if the box has a font, use it - otherwise use this item info's font
VE_Font vf;
if (UseBoxFont) if (UseBoxFont)
vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
else else
@@ -550,22 +512,22 @@ namespace Volian.Print.Library
// Do the top line first: // Do the top line first:
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append(MyBox.BXULC); sb.Append(MyBox.BXULC);
float size = GetTextWidth(vf, MyBox.BXULC); //(float)(MyBox.BXULC.Length * (72 / vf.CPI)); float size = GetTextWidth(vf, MyBox.BXULC);
string bxstr = null; string bxstr;
if (!ContainsPageBreak) // Only do top line if there is no page break. if (!ContainsPageBreak) // Only do top line if there is no page break.
{ {
while (size < endHorz) while (size < endHorz)
{ {
sb.Append(MyBox.BXHorz); sb.Append(MyBox.BXHorz);
size = size + bxHorzTextWidth; //(float)(MyBox.BXHorz.Length * (72 / vf.CPI)); size += bxHorzTextWidth;
} }
// Tack on the right upper corner. For some formats, the upper right corner in the // Tack on the right upper corner. For some formats, the upper right corner in the
// had the first character as a space, this would put two spaces in a row at the // had the first character as a space, this would put two spaces in a row at the
// end of the string, so remove the space before tacking on the upper right corner: // end of the string, so remove the space before tacking on the upper right corner:
bxstr = sb.ToString(); bxstr = sb.ToString();
if (bxstr[bxstr.Length - 1] == ' ' && MyBox.BXURC[0] == ' ') bxstr = bxstr.TrimEnd(); if (bxstr[bxstr.Length - 1] == ' ' && MyBox.BXURC[0] == ' ') bxstr = bxstr.TrimEnd();
bxstr = bxstr + MyBox.BXURC; bxstr += MyBox.BXURC;
size = size + GetTextWidth(vf, MyBox.BXURC);//(float)((MyBox.BXURC.Length) * (72 / vf.CPI)); size += GetTextWidth(vf, MyBox.BXURC);//(float)((MyBox.BXURC.Length) * (72 / vf.CPI));
Rtf = GetRtf(bxstr, vf); Rtf = GetRtf(bxstr, vf);
IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. IParagraph = null; // set to null so that next access of IParagraph sets the Rtf.
Rtf2Pdf.TextAt(cb, IParagraph, left, top, size + 10, 100, "", yBottomMargin); Rtf2Pdf.TextAt(cb, IParagraph, left, top, size + 10, 100, "", yBottomMargin);
@@ -576,23 +538,24 @@ namespace Volian.Print.Library
sb.Remove(0, sb.Length); sb.Remove(0, sb.Length);
sb.Append(MyBox.BXLLC); sb.Append(MyBox.BXLLC);
size = GetTextWidth(vf, MyBox.BXLLC); //(float)(MyBox.BXLLC.Length * (72 / vf.CPI)); size = GetTextWidth(vf, MyBox.BXLLC);
while (size < endHorz) while (size < endHorz)
{ {
sb.Append(MyBox.BXHorz); sb.Append(MyBox.BXHorz);
size = size + bxHorzTextWidth;//(float)(MyBox.BXHorz.Length * (72 / vf.CPI)); size += bxHorzTextWidth;
} }
bxstr = sb.ToString().TrimEnd() + MyBox.BXLRC; bxstr = sb.ToString().TrimEnd() + MyBox.BXLRC;
size = size + GetTextWidth(vf, MyBox.BXLRC); //(float)((MyBox.BXLRC.Length) * (72 / vf.CPI)); size += GetTextWidth(vf, MyBox.BXLRC);
Rtf = GetRtf(bxstr, vf); Rtf = GetRtf(bxstr, vf);
IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. IParagraph = null; // set to null so that next access of IParagraph sets the Rtf.
Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size + 10, 100, "", yBottomMargin); Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size + 10, 100, "", yBottomMargin);
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "top and bottom kept for debugging")]
private void DrawAsteriskSideHLS(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, float top, float bottom, float left, float right, VE_Font vef) private void DrawAsteriskSideHLS(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, float top, float bottom, float left, float right, VE_Font vef)
{ {
// set the top & bottom of sides. If there is a page break in the middle of box, adjust these. // set the top & bottom of sides. If there is a page break in the middle of box, adjust these.
// The vlnBox property, ContainsPageBreak, flags that a break occurred. // The vlnBox property, ContainsPageBreak, flags that a break occurred.
float yOffBreak = 0; float yOffBreak;
if (!ContainsPageBreak) if (!ContainsPageBreak)
{ {
top = CalculateYOffset(yPageStart, yTopMargin); top = CalculateYOffset(yPageStart, yTopMargin);
@@ -613,7 +576,10 @@ namespace Volian.Print.Library
} }
else else
{ {
#pragma warning disable IDE0059 // Unnecessary assignment of a value - Keeping top for Debugging
top = CalculateYOffset(yPageStart, yTopMargin); top = CalculateYOffset(yPageStart, yTopMargin);
#pragma warning restore IDE0059 // Unnecessary assignment of a value
yOffBreak = MyPageHelper.ParaBreaks.Count > 0 ? MyPageHelper.ParaBreaks[0].YOffset : 0; yOffBreak = MyPageHelper.ParaBreaks.Count > 0 ? MyPageHelper.ParaBreaks[0].YOffset : 0;
if (yOffBreak > 0) if (yOffBreak > 0)
bottom = (yPageStart - yOffBreak) * MyPageHelper.YMultiplier; bottom = (yPageStart - yOffBreak) * MyPageHelper.YMultiplier;
@@ -636,8 +602,6 @@ namespace Volian.Print.Library
// create a new font without any styles such as underline. // create a new font without any styles such as underline.
E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None; E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None;
// if the box has a font, use it - otherwise use this item info's font
VE_Font vf = null;
bool UseBoxFont = false; bool UseBoxFont = false;
try try
{ {
@@ -646,6 +610,8 @@ namespace Volian.Print.Library
catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false. catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false.
{ {
} }
// if the box has a font, use it - otherwise use this item info's font
VE_Font vf;
if (UseBoxFont) if (UseBoxFont)
vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
else else
+22 -71
View File
@@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Drawing;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text; using iTextSharp.text;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
@@ -10,44 +8,25 @@ namespace Volian.Print.Library
{ {
public class vlnChangeBarMessage public class vlnChangeBarMessage
{ {
private float _ParentX; public float ParentX { get; set; }
public float ParentX public string Message { get; set; }
{
get { return _ParentX; }
set { _ParentX = value; }
}
private string _Message;
public string Message
{
get { return _Message; }
set { _Message = value; }
}
private static int _UniqueMessageId = 0; private static int _UniqueMessageId = 0;
public static int UniqueMessageId public static int UniqueMessageId
{ {
get { return vlnChangeBarMessage._UniqueMessageId++; } get { return _UniqueMessageId++; }
set { vlnChangeBarMessage._UniqueMessageId = value; } set { _UniqueMessageId = value; }
}
private int _MessageId = UniqueMessageId;
public int MessageId
{
get { return _MessageId; }
set { _MessageId = value; }
} }
public int MessageId { get; set; } = UniqueMessageId;
public vlnChangeBarMessage(float parentx, string msg) public vlnChangeBarMessage(float parentx, string msg)
{ {
_ParentX = parentx; ParentX = parentx;
_Message = msg; Message = msg;
} }
} }
public partial class vlnChangeBar : vlnPrintObject public partial class vlnChangeBar : vlnPrintObject
{ {
private bool _HasChangeBar; public bool HasChangeBar { get; set; }
public bool HasChangeBar
{
get { return _HasChangeBar; }
set { _HasChangeBar = value; }
}
protected float _YChangeBarBottom; protected float _YChangeBarBottom;
public float YChangeBarBottom public float YChangeBarBottom
{ {
@@ -62,36 +41,15 @@ namespace Volian.Print.Library
_Height = _YOffset - _YChangeBarBottom; _Height = _YOffset - _YChangeBarBottom;
} }
} }
private SortedDictionary<float, vlnChangeBarMessage> _Messages;
public SortedDictionary<float, vlnChangeBarMessage> Messages public SortedDictionary<float, vlnChangeBarMessage> Messages { get; set; }
{ public int MessageAlignment { get; set; }
get { return _Messages; } public float YExtendLine { get; set; } = 4.75F;
set { _Messages = value; } public float YChangeBarBottomExtend => YChangeBarBottom - YExtendLine;
}
private int _MessageAlignment; public bool BottomIsTable { get; set; } = false;
public int MessageAlignment private readonly bool _IsRev;
{ private readonly bool _MsgAtTop; // flags that message should be drawn at top of change bar
get { return _MessageAlignment; }
set { _MessageAlignment = value; }
}
private float _YExtendLine = 4.75F;
public float YExtendLine
{
get { return _YExtendLine; }
set {_YExtendLine = value; }
}
public float YChangeBarBottomExtend
{
get {return YChangeBarBottom - YExtendLine; }
}
private bool _BottomIsTable = false;
public bool BottomIsTable
{
get { return _BottomIsTable; }
set { _BottomIsTable = value; }
}
private bool _IsRev;
private bool _MsgAtTop; // flags that message should be drawn at top of change bar
public vlnChangeBar(PdfContentByte cb, vlnParagraph parent, float xoff, float yoff, int msgAlignment, bool isRev, bool msgAtTop) public vlnChangeBar(PdfContentByte cb, vlnParagraph parent, float xoff, float yoff, int msgAlignment, bool isRev, bool msgAtTop)
{ {
// for grids, a y adjustment is made to match 16bit output, see the variable 'GridTopAdjust'. Take this // for grids, a y adjustment is made to match 16bit output, see the variable 'GridTopAdjust'. Take this
@@ -113,7 +71,7 @@ namespace Volian.Print.Library
{ {
// see if any of children don't have changebar // see if any of children don't have changebar
if ((vpo as vlnRNOSeparator).ExtendChangeBar) if ((vpo as vlnRNOSeparator).ExtendChangeBar)
_YExtendLine = (vpo.Height + vpo.YOffset - ((scale * parent.Height) + parent.YOffset)) * MyPageHelper.YMultiplier; YExtendLine = (vpo.Height + vpo.YOffset - ((scale * parent.Height) + parent.YOffset)) * MyPageHelper.YMultiplier;
} }
} }
foreach (vlnPrintObject vph in parent.PartsAbove) foreach (vlnPrintObject vph in parent.PartsAbove)
@@ -152,12 +110,9 @@ namespace Volian.Print.Library
} }
} }
} }
_MessageAlignment = msgAlignment; MessageAlignment = msgAlignment;
}
public override string ToString()
{
return string.Format("vlnChangeBar: X={0} Y={1} H={2} B={3} ID={4}", XOffset, YOffset, Height, YChangeBarBottom, MyParent.MyItemInfo.ItemID);
} }
public override string ToString() => string.Format("vlnChangeBar: X={0} Y={1} H={2} B={3} ID={4}", XOffset, YOffset, Height, YChangeBarBottom, MyParent.MyItemInfo.ItemID);
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
{ {
float? topMost = null; float? topMost = null;
@@ -170,11 +125,9 @@ namespace Volian.Print.Library
// calculate a new starting position for the change bar // calculate a new starting position for the change bar
if (_MyParent is vlnParagraph) if (_MyParent is vlnParagraph)
{ {
vlnParagraph pgh = _MyParent as vlnParagraph;
topMost = cb.PdfWriter.PageSize.Height - yPageStart; topMost = cb.PdfWriter.PageSize.Height - yPageStart;
} }
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; PdfLayer textLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.TextLayer;
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
if (textLayer != null) cb.BeginLayer(textLayer); if (textLayer != null) cb.BeginLayer(textLayer);
float yAdj = -3.75F; //0.5F; float yAdj = -3.75F; //0.5F;
float xAdj = 3F; float xAdj = 3F;
@@ -226,8 +179,6 @@ namespace Volian.Print.Library
// follow through in fixing an Out of Window Handles bug, use new function to see if // follow through in fixing an Out of Window Handles bug, use new function to see if
// we can retrieve the font from a dictionary instead a doing a New and using another // we can retrieve the font from a dictionary instead a doing a New and using another
// window handle B21017-117 // window handle B21017-117
//iTextSharp.text.Font iFont = _IsRev? Volian.Svg.Library.VolianPdf.GetFont(new System.Drawing.Font("Letter Gothic", 10F)):
// Volian.Svg.Library.VolianPdf.GetFont(new System.Drawing.Font("Letter Gothic", 5.5F));
iTextSharp.text.Font iFont = _IsRev? Volian.Svg.Library.VolianPdf.GetFont(VE_Font.GetWinSysFont("Letter Gothic", 10F)): iTextSharp.text.Font iFont = _IsRev? Volian.Svg.Library.VolianPdf.GetFont(VE_Font.GetWinSysFont("Letter Gothic", 10F)):
Volian.Svg.Library.VolianPdf.GetFont(VE_Font.GetWinSysFont("Letter Gothic", 5.5F)); Volian.Svg.Library.VolianPdf.GetFont(VE_Font.GetWinSysFont("Letter Gothic", 5.5F));
+2 -10
View File
@@ -1,20 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
namespace Volian.Print.Library namespace Volian.Print.Library
{ {
public partial class vlnHeader: vlnText public partial class vlnHeader: vlnText
{ {
private string _OrigStr; private readonly string _OrigStr;
public float HeaderWidth public float HeaderWidth => _WidthAdjust + (MyFont.CharsToTwips * Text.Length);
{
get { return _WidthAdjust + (MyFont.CharsToTwips * Text.Length); }
}
public vlnHeader(vlnParagraph myParent, PdfContentByte cb, string origStr, string cleanStr, float xoffset, float yoffset, VE_Font vFont) public vlnHeader(vlnParagraph myParent, PdfContentByte cb, string origStr, string cleanStr, float xoffset, float yoffset, VE_Font vFont)
{ {
MyParent = myParent; MyParent = myParent;
+2 -14
View File
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text;
using VEPROMS.CSLA.Library;
namespace Volian.Print.Library namespace Volian.Print.Library
{ {
@@ -13,12 +7,7 @@ namespace Volian.Print.Library
private bool _UseInternalY = false; private bool _UseInternalY = false;
// B2020-121: Account for Header on Caution or Note // B2020-121: Account for Header on Caution or Note
public bool UseInternalY { get => _UseInternalY; set => _UseInternalY = value; } public bool UseInternalY { get => _UseInternalY; set => _UseInternalY = value; }
private string _MacroDef; public string MacroDef { get; set; }
public string MacroDef
{
get { return _MacroDef; }
set { _MacroDef = value; }
}
public vlnMacro(float xoffset, float yoffset, string macroDef) public vlnMacro(float xoffset, float yoffset, string macroDef)
{ {
YOffset = yoffset; YOffset = yoffset;
@@ -33,8 +22,7 @@ namespace Volian.Print.Library
if (UseInternalY) yLocation = YOffset; // B2020-121: Account for Header on Caution or Note if (UseInternalY) yLocation = YOffset; // B2020-121: Account for Header on Caution or Note
// Adjust the starting point for the Macro if the LPI is 7 // Adjust the starting point for the Macro if the LPI is 7
if (MyPageHelper.YMultiplier != 1) yLocation += SixLinesPerInch - _SevenLinesPerInch; if (MyPageHelper.YMultiplier != 1) yLocation += SixLinesPerInch - _SevenLinesPerInch;
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; PdfLayer textLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.TextLayer;
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
if (textLayer != null) cb.BeginLayer(textLayer); if (textLayer != null) cb.BeginLayer(textLayer);
MyContentByte = cb; MyContentByte = cb;
System.Drawing.Color push = PrintOverride.SvgColor; System.Drawing.Color push = PrintOverride.SvgColor;
File diff suppressed because it is too large Load Diff
+34 -138
View File
@@ -1,14 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Drawing;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text; using iTextSharp.text;
using Itenso.Rtf; using Itenso.Rtf;
using Itenso.Rtf.Parser;
using Itenso.Rtf.Interpreter;
using Itenso.Rtf.Support; using Itenso.Rtf.Support;
using Volian.Controls.Library;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using Volian.Base.Library; using Volian.Base.Library;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@@ -24,21 +20,13 @@ namespace Volian.Print.Library
get { return _UniqueDebugId++; } get { return _UniqueDebugId++; }
set { _UniqueDebugId = value; } set { _UniqueDebugId = value; }
} }
private int _DebugId = UniqueDebugId;
public int DebugId public int DebugId { get; set; } = UniqueDebugId;
{
get { return _DebugId; }
set { _DebugId = value; }
}
protected static float _WidthAdjust = 1; // 1 Point - adjusted to match 16-bit line wrapping. For editting it's 3. protected static float _WidthAdjust = 1; // 1 Point - adjusted to match 16-bit line wrapping. For editting it's 3.
protected static float _WidthAdjustBox = 6; protected static float _WidthAdjustBox = 6;
private static float _SixLinesPerInch = 12; // twips
public static float SixLinesPerInch public static float SixLinesPerInch { get; set; } = 12;
{
get { return vlnPrintObject._SixLinesPerInch; }
set { vlnPrintObject._SixLinesPerInch = value; }
}
protected static float _SevenLinesPerInch = 10.1F;//72F / 7F; protected static float _SevenLinesPerInch = 10.1F;//72F / 7F;
protected float _XOffset; protected float _XOffset;
@@ -64,30 +52,12 @@ namespace Volian.Print.Library
set set
{ {
_MyParent = value; _MyParent = value;
if (_MyParent != null) }
{ }
} public bool HasIndent { get; set; } = false;
} public bool IsCompressed { get; set; } = false;
} public string ImageText { get; set; }
private bool _HasIndent = false;
public bool HasIndent
{
get { return _HasIndent; }
set { _HasIndent = value; }
}
private bool _IsCompressed = false;
public bool IsCompressed
{
get { return _IsCompressed; }
set { _IsCompressed = value; }
}
private string _ImageText; // ro definition, value part of #Link in case of image/figure
public string ImageText
{
get { return _ImageText; }
set { _ImageText = value; }
}
protected string _Rtf; // may become iTextSharp paragraph protected string _Rtf; // may become iTextSharp paragraph
public virtual string Rtf public virtual string Rtf
{ {
@@ -96,14 +66,8 @@ namespace Volian.Print.Library
} }
public class VlnSplitCharacter : ISplitCharacter public class VlnSplitCharacter : ISplitCharacter
{ {
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) => (cc[current] == ' ');
{ public bool IsSplitCharacter(char c) => (c == ' ');
return (cc[current] == ' ');
}
public bool IsSplitCharacter(char c)
{
return (c == ' ');
}
} }
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter(); public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
// B2018-034 Attributes were being lost when the IsCompressed flag was true. // B2018-034 Attributes were being lost when the IsCompressed flag was true.
@@ -114,6 +78,7 @@ namespace Volian.Print.Library
{ {
get get
{ {
//For Debugging:
// If the paragraph iscompressed, it may have been created as not compressed since compression // If the paragraph iscompressed, it may have been created as not compressed since compression
// is not set when paragraph is initially created, it is set during pagination tests. // is not set when paragraph is initially created, it is set during pagination tests.
//if (_IParagraph == null || IsCompressed) //if (_IParagraph == null || IsCompressed)
@@ -186,48 +151,9 @@ namespace Volian.Print.Library
} }
set { _Height = value; } set { _Height = value; }
} }
public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width) public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width) => GetParagraphHeight(cb, iParagraph, suffix, width, true);
{ public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width, bool throwException) => (float)GetHeight(cb, iParagraph, suffix, width, throwException);
return GetParagraphHeight(cb, iParagraph, suffix, width, true);
}
public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width, bool throwException)
{
float heightAll = GetHeight(cb, iParagraph, suffix, width, throwException);
return heightAll;
}
private static void RestoreLastCharacter(Paragraph iParagraph, Chunk chk)
{
iParagraph.RemoveAt(iParagraph.Count - 1);
iParagraph.Add(chk);
}
private static Chunk RemoveLastCharacter(Paragraph iParagraph)
{
if (iParagraph.Count == 0)
return null;
object obj = iParagraph[iParagraph.Count-1];
Chunk chk = obj as Chunk;
if (chk == null)
return null;
string s = chk.Content;
if (s.Length > 1 || iParagraph.Count > 1) // don't remove last character if it's the only one
{
iParagraph.RemoveAt(iParagraph.Count - 1);
if (s.Length > 0)
{
if (s == "\xA0") // If this is a space at the end put it back
{
iParagraph.Add(chk);
return null;
}
else
{
s = s.Substring(0, s.Length - 1);
iParagraph.Add(new Chunk(s, chk.Font));
}
}
}
return chk;
}
public static float GetHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width, bool throwException) public static float GetHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width, bool throwException)
{ {
ColumnText myColumnText = new ColumnText(cb); ColumnText myColumnText = new ColumnText(cb);
@@ -243,7 +169,6 @@ namespace Volian.Print.Library
{ {
myColumnText.AddElement(iParagraph); myColumnText.AddElement(iParagraph);
} }
//myColumnText.UseAscender = true;// Adjusts to the top of the text box.
int status = myColumnText.Go(true); // Check to see if it will fit on the page. int status = myColumnText.Go(true); // Check to see if it will fit on the page.
if (ColumnText.HasMoreText(status) && throwException) if (ColumnText.HasMoreText(status) && throwException)
{ {
@@ -255,7 +180,6 @@ namespace Volian.Print.Library
iParagraph.IndentationLeft = 0; iParagraph.IndentationLeft = 0;
return GetHeight(cb, iParagraph, suffix, width, throwException); return GetHeight(cb, iParagraph, suffix, width, throwException);
} }
//throw (new Exception("Paragraph longer than a page"));
Console.WriteLine("Paragraph longer than a page"); Console.WriteLine("Paragraph longer than a page");
} }
return pgHeight - myColumnText.YLine; // This gives the height of the Paragraph // C2020-002 paper size is now set in the format files return pgHeight - myColumnText.YLine; // This gives the height of the Paragraph // C2020-002 paper size is now set in the format files
@@ -266,22 +190,18 @@ namespace Volian.Print.Library
float h = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth); float h = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth);
int iWidthMax = iWidth; // maximum width in Characters int iWidthMax = iWidth; // maximum width in Characters
int iDelta = iWidth / 2; int iDelta = iWidth / 2;
iWidth = iWidth / 2; iWidth /= 2;
while (iDelta > 0) while (iDelta > 0)
{ {
float h2 = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth,false); float h2 = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth,false);
iDelta = iDelta / 2; iDelta /= 2;
if (h2 == h) iWidthMax = iWidth; if (h2 == h) iWidthMax = iWidth;
iWidth += (h2>h ? 1: -1) * iDelta; iWidth += (h2>h ? 1: -1) * iDelta;
} }
return (float) iWidthMax; return (float) iWidthMax;
} }
private PdfContentByte _MyContentByte;
public PdfContentByte MyContentByte public PdfContentByte MyContentByte { get; set; }
{
get { return _MyContentByte; }
set { _MyContentByte = value; }
}
private VlnSvgPageHelper _MyPageHelper; private VlnSvgPageHelper _MyPageHelper;
public VlnSvgPageHelper MyPageHelper public VlnSvgPageHelper MyPageHelper
{ {
@@ -301,45 +221,29 @@ namespace Volian.Print.Library
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public static int ToInt(int value) public static int ToInt(int value) => value;
{
return value;
}
/// <summary> /// <summary>
/// No conversion necessary: int? twips -> int twips /// No conversion necessary: int? twips -> int twips
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public static int ToInt(int? value) public static int ToInt(int? value) => ToInt((int)value);
{
return ToInt((int)value);
}
/// <summary> /// <summary>
/// No conversion necessary: string twips -> int twips /// No conversion necessary: string twips -> int twips
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public static int ToInt(string value) public static int ToInt(string value) => ToInt((int)Convert.ToSingle(value));
{
return ToInt((int)Convert.ToSingle(value));
}
/// <summary> /// <summary>
/// No conversion necessary: value from a list in a string, twips -> int twips /// No conversion necessary: value from a list in a string, twips -> int twips
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public static int ToInt(string value, int i) public static int ToInt(string value, int i) => ToInt((value.Contains(",")) ? value.Split(",".ToCharArray())[i] : value);
{
string s = (value.Contains(",")) ? value.Split(",".ToCharArray())[i] : value;
return ToInt(s);
}
public static string GetRtf(string text, VE_Font vFont) public static string GetRtf(string text, VE_Font vFont)
{ {
StringBuilder rtfSB = new StringBuilder(); StringBuilder rtfSB = new StringBuilder();
//DisplayText vlntxt = new DisplayText(text.TrimStart(" ".ToCharArray()), vFont, false);
DisplayText vlntxt = new DisplayText(text, vFont, false); DisplayText vlntxt = new DisplayText(text, vFont, false);
//rtfSB.Append(AddFontTable(vlntxt.TextFont.WindowsFont));
//rtfSB.Append(AddFontTable(vFont.WindowsFont));
rtfSB.Append(AddFontTable(vFont)); rtfSB.Append(AddFontTable(vFont));
rtfSB.Append(vlntxt.StartText); rtfSB.Append(vlntxt.StartText);
rtfSB.Append("}"); rtfSB.Append("}");
@@ -413,10 +317,7 @@ namespace Volian.Print.Library
float fE = iFont.BaseFont.GetWidthPointKerned("!", 12); float fE = iFont.BaseFont.GetWidthPointKerned("!", 12);
return fW == fE; return fW == fE;
} }
public static iTextSharp.text.Paragraph RtfToParagraph(string rtf) public static iTextSharp.text.Paragraph RtfToParagraph(string rtf) => RtfToParagraph(rtf, false, false);
{
return RtfToParagraph(rtf, false, false);
}
public static iTextSharp.text.Paragraph RtfToParagraph(string rtf, bool hasIndent, bool doPdfLinks) public static iTextSharp.text.Paragraph RtfToParagraph(string rtf, bool hasIndent, bool doPdfLinks)
{ {
if (hasIndent) if (hasIndent)
@@ -427,11 +328,13 @@ namespace Volian.Print.Library
} }
IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf); IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf);
Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc); Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc)
rtf2IText.DoPdfLinks = doPdfLinks; {
rtf2IText.HasIndent = hasIndent; DoPdfLinks = doPdfLinks,
HasIndent = hasIndent
};
iTextSharp.text.Paragraph para = rtf2IText.Convert(); iTextSharp.text.Paragraph para = rtf2IText.Convert();
para.SetLeading(_SixLinesPerInch, 0); para.SetLeading(SixLinesPerInch, 0);
if (rtf.Contains("\x05")) // note that this is for existing customer data as of August 2015. if (rtf.Contains("\x05")) // note that this is for existing customer data as of August 2015.
{ {
// if there is a hanging indent, the iTextSharp paragraph properties must be set // if there is a hanging indent, the iTextSharp paragraph properties must be set
@@ -459,8 +362,7 @@ namespace Volian.Print.Library
// Change the chunks to only split on spaces rather than spaces and hyphens // Change the chunks to only split on spaces rather than spaces and hyphens
foreach (object obj in para)//Fix the code to check for chunks before assuming chunks foreach (object obj in para)//Fix the code to check for chunks before assuming chunks
{ {
Chunk chk = obj as Chunk; if (obj is Chunk chk && (chk.Attributes == null || !chk.Attributes.ContainsKey("NoSplit")))
if (chk != null && (chk.Attributes==null || !chk.Attributes.ContainsKey("NoSplit")))
{ {
if (chk.Attributes == null) chk.Attributes = new System.Collections.Hashtable(); if (chk.Attributes == null) chk.Attributes = new System.Collections.Hashtable();
chk.SetSplitCharacter(mySplitter); chk.SetSplitCharacter(mySplitter);
@@ -469,11 +371,7 @@ namespace Volian.Print.Library
} }
return para; return para;
} }
private static string FixNumber(string num) private static string FixNumber(string num) => num == "" ? "0" : num;
{
if (num == "") return ("0");
return num;
}
public static float CalculateHangingIndent(string rtf) public static float CalculateHangingIndent(string rtf)
{ {
float chkW=0; float chkW=0;
@@ -515,8 +413,7 @@ namespace Volian.Print.Library
} }
public void DebugPdf(PdfContentByte cb, float left, float top) public void DebugPdf(PdfContentByte cb, float left, float top)
{ {
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; PdfLayer debugLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.DebugLayer;
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;
if (debugLayer == null) return; if (debugLayer == null) return;
cb.SaveState(); cb.SaveState();
cb.BeginLayer(debugLayer); cb.BeginLayer(debugLayer);
@@ -531,8 +428,7 @@ namespace Volian.Print.Library
cb.EndLayer(); cb.EndLayer();
cb.RestoreState(); cb.RestoreState();
} }
public virtual float YBottom public virtual float YBottom => YOffset + Height;
{ get { return YOffset + Height;} }
} }
public partial class vlnPrintObjects : List<vlnPrintObject> public partial class vlnPrintObjects : List<vlnPrintObject>
{ {
+5 -26
View File
@@ -1,40 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
namespace Volian.Print.Library namespace Volian.Print.Library
{ {
public partial class vlnRNOSeparator : vlnPrintObject public partial class vlnRNOSeparator : vlnPrintObject
{ {
private VE_Font _MyFont; public VE_Font MyFont { get; set; }
public VE_Font MyFont public bool ExtendChangeBar { get; set; }
{ public float XLength { get; set; } = 0;
get { return _MyFont; }
set { _MyFont = value; }
}
private bool _ExtendChangeBar;
public bool ExtendChangeBar
{
get { return _ExtendChangeBar; }
set { _ExtendChangeBar = value; }
}
private float _XLength = 0;
public float XLength
{
get { return _XLength; }
set { _XLength = value; }
}
/* if flag set and separator defined then output separator */ /* if flag set and separator defined then output separator */
/*if separator is a control-A use RNOSepLine*/ /*if separator is a control-A use RNOSepLine*/
public vlnRNOSeparator(vlnParagraph parent, PdfContentByte cb, string sepStr, float xoffset, float yoffset, FormatInfo formatInfo, bool extendChangeBar) public vlnRNOSeparator(vlnParagraph parent, PdfContentByte cb, string sepStr, float xoffset, float yoffset, FormatInfo formatInfo, bool extendChangeBar)
{ {
MyContentByte = cb; // B2019-091: crash when printing (note moved from the 'ToPdf' method) MyContentByte = cb; // B2019-091: crash when printing (note moved from the 'ToPdf' method)
ExtendChangeBar = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeBarToRNOSep ? extendChangeBar : false; ExtendChangeBar = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeBarToRNOSep && extendChangeBar;
YOffset = yoffset; YOffset = yoffset;
XOffset = xoffset; XOffset = xoffset;
XLength = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.RNOSepLineLength??0; XLength = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.RNOSepLineLength??0;
@@ -60,8 +40,7 @@ namespace Volian.Print.Library
if (XLength != 0) if (XLength != 0)
{ {
cb.SaveState(); cb.SaveState();
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; PdfLayer textLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.TextLayer;
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
if (textLayer != null) cb.BeginLayer(textLayer); if (textLayer != null) cb.BeginLayer(textLayer);
iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideChangeBarColor(System.Drawing.Color.Black)); iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideChangeBarColor(System.Drawing.Color.Black));
cb.SetColorStroke(lineColor); cb.SetColorStroke(lineColor);
+11 -70
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing; using System.Drawing;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
namespace Volian.Print.Library namespace Volian.Print.Library
@@ -59,35 +55,21 @@ namespace Volian.Print.Library
return (float)_TabOffset * MyFont.CharsToTwips; return (float)_TabOffset * MyFont.CharsToTwips;
} }
} }
private vlnMacro _MyMacro;
public vlnMacro MyMacro
{
get { return _MyMacro; }
set { _MyMacro = value; }
}
private string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab public vlnMacro MyMacro { get; set; }
private readonly string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab
// add symbol characters as needed // add symbol characters as needed
// "\u25CF" - solid bullet // "\u25CF" - solid bullet
// \u0394 - delta // \u0394 - delta
private System.Drawing.FontStyle GetSysFontStyle(VE_Font f) private System.Drawing.FontStyle GetSysFontStyle(VE_Font f) => f.Style == E_Style.Italics ? System.Drawing.FontStyle.Italic : FontStyle.Regular;
{ public float GetTextWidth(VE_Font vefont, string txt) => GetTextWidth(vefont, txt, SymbolFontName);
if (f.Style == E_Style.Italics)
return System.Drawing.FontStyle.Italic;
return FontStyle.Regular;
}
public float GetTextWidth(VE_Font vefont, string txt)
{
return GetTextWidth(vefont, txt, SymbolFontName);
}
private float GetTextWidth(VE_Font vefont, string txt, string symblFontName) private float GetTextWidth(VE_Font vefont, string txt, string symblFontName)
{ {
// follow through in fixing an Out of Window Handles bug, use new function to see if // follow through in fixing an Out of Window Handles bug, use new function to see if
// we can retrieve the font from a dictionary instead a doing a New and using another // we can retrieve the font from a dictionary instead a doing a New and using another
// window handle B2017-117 // window handle B2017-117
//System.Drawing.Font font = new System.Drawing.Font(vefont.Family, (float)vefont.Size, GetSysFontStyle(vefont));
//System.Drawing.Font symbFont = new System.Drawing.Font(symblFontName, (float)vefont.Size);
System.Drawing.Font font = VE_Font.GetWinSysFont(vefont.Family, (float)vefont.Size, GetSysFontStyle(vefont)); System.Drawing.Font font = VE_Font.GetWinSysFont(vefont.Family, (float)vefont.Size, GetSysFontStyle(vefont));
System.Drawing.Font symbFont = VE_Font.GetWinSysFont(symblFontName, (float)vefont.Size); System.Drawing.Font symbFont = VE_Font.GetWinSysFont(symblFontName, (float)vefont.Size);
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
@@ -101,29 +83,13 @@ namespace Volian.Print.Library
else else
w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)vefont.Size); w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)vefont.Size);
} }
//float w = iFont.BaseFont.GetWidthPointKerned(Text.Replace("\u25CF","@"), (float)vefont.Size);
return w; return w;
} }
bool _ScriptCaution = false;
public bool ScriptCaution public bool ScriptCaution { get; set; } = false;
{
get { return _ScriptCaution; }
set { _ScriptCaution = value; }
}
bool _SeparateBullet = false;
public bool SeparateBullet public bool SeparateBullet { get; set; } = false;
{ public string SymbolFontName { get; set; }
get { return _SeparateBullet; }
set { _SeparateBullet = value; }
}
private string _SymbolFontName;
public string SymbolFontName
{
get { return _SymbolFontName; }
set { _SymbolFontName = value; }
}
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont, bool doSectTab, string symblFontName, bool removedUnderline) public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont, bool doSectTab, string symblFontName, bool removedUnderline)
{ {
SymbolFontName = symblFontName; SymbolFontName = symblFontName;
@@ -149,20 +115,14 @@ namespace Volian.Print.Library
Width = 90; Width = 90;
} }
else if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0) else if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
//if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth; Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth;
else if (CCCs != IIIs) else if (CCCs != IIIs)
{ {
float tPtPerChar = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar ?? 6; float tPtPerChar = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar ?? 6;
Width = (tPtPerChar == 0 ? 6 : tPtPerChar) * origTab.Length; Width = (tPtPerChar == 0 ? 6 : tPtPerChar) * origTab.Length;
// Check the following, it may be needed for FPL:
//origTab1 = origTab1.TrimStart(" ".ToCharArray());
// 6 = number of points per character. 4 characters between end of tab and beginning of text
// origTab1.Trim... is number of non-space characters of the tab string.
//Width = 6 * (4 + origTab1.Trim(" ".ToCharArray()).Length);
} }
else else
Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName); //MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length); Width = GetTextWidth(MyFont, (Text ?? origTab), symblFontName);
// Pairie Island (NSP) Caution and Note tabs use a larger font // Pairie Island (NSP) Caution and Note tabs use a larger font
// When using a bullet, we need to use the font size of the Caution/Note text instead of the tab. // When using a bullet, we need to use the font size of the Caution/Note text instead of the tab.
@@ -195,7 +155,7 @@ namespace Volian.Print.Library
Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth; Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth;
else else
{ {
origTab = origTab + " "; origTab += " ";
origTab = origTab.TrimStart(" ".ToCharArray()); origTab = origTab.TrimStart(" ".ToCharArray());
if (mindx > 2) // ouch! if (mindx > 2) // ouch!
Width = 6f * (origTab.Length - 1); // FPL (macro is after {numeric}) FPL is good with genmac output! Width = 6f * (origTab.Length - 1); // FPL (macro is after {numeric}) FPL is good with genmac output!
@@ -204,7 +164,7 @@ namespace Volian.Print.Library
} }
} }
else else
Width = GetTextWidth(MyFont, (cleanTab != null ? cleanTab : origTab), symblFontName);//MyFont.CharsToTwips * (cleanTab != null ? cleanTab.Length : origTab.Length); Width = GetTextWidth(MyFont, (cleanTab ?? origTab), symblFontName);//MyFont.CharsToTwips * (cleanTab != null ? cleanTab.Length : origTab.Length);
} }
else else
{ {
@@ -219,8 +179,6 @@ namespace Volian.Print.Library
int sep = origTab.IndexOfAny(". ".ToCharArray()); int sep = origTab.IndexOfAny(". ".ToCharArray());
string prefix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b\ul " : @"\ul "; string prefix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b\ul " : @"\ul ";
string suffix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b0\ulnone " : @"\ulnone "; string suffix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b0\ulnone " : @"\ulnone ";
//origTab = @"\ul " + origTab.Substring(0, sep-1) + @"\ulnone" + origTab.Substring(sep-1);
//origTab = @"\ul " + origTab.Substring(0, sep) + @"\ulnone" + origTab.Substring(sep);
origTab = prefix + origTab.Substring(0, sep) + suffix + origTab.Substring(sep); origTab = prefix + origTab.Substring(0, sep) + suffix + origTab.Substring(sep);
} }
@@ -238,7 +196,6 @@ namespace Volian.Print.Library
// follow through in fixing an Out of Window Handles bug, use new function to see if // follow through in fixing an Out of Window Handles bug, use new function to see if
// we can retrieve the font from a dictionary instead a doing a New and using another // we can retrieve the font from a dictionary instead a doing a New and using another
// window handle B2017-117 // window handle B2017-117
//vFont.WindowsFont = new System.Drawing.Font(vFont.Family, (float)vFont.Size, style);
vFont.WindowsFont = VE_Font.GetWinSysFont(vFont.Family, (float)vFont.Size, style); vFont.WindowsFont = VE_Font.GetWinSysFont(vFont.Family, (float)vFont.Size, style);
int indxC = origTab.IndexOf(":"); int indxC = origTab.IndexOf(":");
origTab = @"\ul " + origTab.Substring(0, indxC) + @"\ulnone" + origTab.Substring(indxC); origTab = @"\ul " + origTab.Substring(0, indxC) + @"\ulnone" + origTab.Substring(indxC);
@@ -255,7 +212,6 @@ namespace Volian.Print.Library
// follow through in fixing an Out of Window Handles bug, use new function to see if // follow through in fixing an Out of Window Handles bug, use new function to see if
// we can retrieve the font from a dictionary instead a doing a New and using another // we can retrieve the font from a dictionary instead a doing a New and using another
// window handle B2017-117 // window handle B2017-117
//vFont.WindowsFont = new System.Drawing.Font(vFont.Family, (float)vFont.Size, style);
vFont.WindowsFont = VE_Font.GetWinSysFont(vFont.Family, (float)vFont.Size, style); vFont.WindowsFont = VE_Font.GetWinSysFont(vFont.Family, (float)vFont.Size, style);
int indxC = origTab.IndexOf(ut.Text); int indxC = origTab.IndexOf(ut.Text);
string prefix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b\ul " : @"\ul "; string prefix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b\ul " : @"\ul ";
@@ -294,7 +250,6 @@ namespace Volian.Print.Library
(myparent.MyItemInfo.MyPrevious.MyContent.Type == myparent.MyItemInfo.MyContent.Type))) (myparent.MyItemInfo.MyPrevious.MyContent.Type == myparent.MyItemInfo.MyContent.Type)))
{ {
//if (scriptCaution) //if (scriptCaution)
// Rtf = Rtf.Replace("CAUTION ", @"\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?");
Rtf = Rtf.Replace("Caution:", " "); Rtf = Rtf.Replace("Caution:", " ");
Rtf = Rtf.Replace("Note:", " "); Rtf = Rtf.Replace("Note:", " ");
Rtf = Rtf.Replace("CAUTION:", " "); Rtf = Rtf.Replace("CAUTION:", " ");
@@ -305,19 +260,6 @@ namespace Volian.Print.Library
Rtf = Rtf.Replace("NOTE", " "); Rtf = Rtf.Replace("NOTE", " ");
} }
} }
//if (ScriptCaution && Rtf.Contains("Caution"))
//{
// // NSP script caution
// iTextSharp.text.Font myfont = pdf.GetFont(vFont.Family, 28, 0, iTextSharp.text.Color.BLACK);
// if (!myfont.BaseFont.CharExists(0x43)) // Capital 'C' exists as text
// {
// //VE_Font vf = new VE_Font("VolianScript", 28, E_Style.Italics, 12);
// // Capital 'C' exists as Symbol
// Rtf = Rtf.Replace("Caution ", @"\u61507?\u61537?\u61557?\u61556?\u61545?\u61551?\u61550?\u61472?\u61472?");
// }
//}
// do positioning based on whether format has locations for section 'header'. If it's not centered, treat // do positioning based on whether format has locations for section 'header'. If it's not centered, treat
// it's location more like a 'tab'. // it's location more like a 'tab'.
@@ -343,7 +285,6 @@ namespace Volian.Print.Library
// follow through in fixing an Out of Window Handles bug, use new function to see if // follow through in fixing an Out of Window Handles bug, use new function to see if
// we can retrieve the font from a dictionary instead a doing a New and using another // we can retrieve the font from a dictionary instead a doing a New and using another
// window handle B2017-117 // window handle B2017-117
//System.Drawing.Font font = new System.Drawing.Font(MyFont.Family, (float)MyFont.Size);
System.Drawing.Font font = VE_Font.GetWinSysFont(MyFont.Family, (float)MyFont.Size); System.Drawing.Font font = VE_Font.GetWinSysFont(MyFont.Family, (float)MyFont.Size);
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)MyFont.Size); float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)MyFont.Size);

Some files were not shown because too many files have changed in this diff Show More