diff --git a/PROMS/ReferencedObjects/LibSource/VlnStatus/AssemblyInfo.cs b/PROMS/ReferencedObjects/LibSource/VlnStatus/AssemblyInfo.cs deleted file mode 100644 index 7e3b35a5..00000000 --- a/PROMS/ReferencedObjects/LibSource/VlnStatus/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly: AssemblyVersion("1.1.*")] - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// diff --git a/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusBarFrm.cs b/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusBarFrm.cs deleted file mode 100644 index 6828458b..00000000 --- a/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusBarFrm.cs +++ /dev/null @@ -1,232 +0,0 @@ -/********************************************************************************************* - * Copyright 2002 - Volian Enterprises, Inc. All rights reserved. - * Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE - * ------------------------------------------------------------------------------ - * $Workfile: StatusBarFrm.cs $ $Revision: 3 $ - * $Author: Jsj $ $Date: 4/08/04 9:50a $ - * - * $History: StatusBarFrm.cs $ - * - * ***************** Version 3 ***************** - * User: Jsj Date: 4/08/04 Time: 9:50a - * Updated in $/LibSource/VlnStatus - * added profile code and try to optimize - * - * ***************** Version 2 ***************** - * User: Jsj Date: 11/26/02 Time: 3:38p - * Updated in $/LibSource/VlnStatus - * Added overbounds check - *********************************************************************************************/ - -using System; -using System.Drawing; -using System.Collections; -using System.ComponentModel; -using System.Windows.Forms; -//using ROProfiler; //don't forget to add VlnProfiler to the reference list - -namespace VlnStatus -{ - /// - /// Create a status window with a progress bar - /// - public class StatusBarFrm : System.Windows.Forms.Form - { - private System.Windows.Forms.ProgressBar progressBar1; - private System.Windows.Forms.Label lblBar; - private System.Windows.Forms.Label StatMsg; -// private string strLblLast=""; - /// - /// Required designer variable. - /// - private System.ComponentModel.Container components = null; - - public StatusBarFrm() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - Text = "Status"; - } - - public StatusBarFrm(string StatusBoxTitle) - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - Text = StatusBoxTitle; - } - - /// - /// Clean up any resources being used. - /// - protected override void Dispose( bool disposing ) - { - if( disposing ) - { - if(components != null) - { - components.Dispose(); - } - } - base.Dispose( disposing ); - } - - #region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.progressBar1 = new System.Windows.Forms.ProgressBar(); - this.lblBar = new System.Windows.Forms.Label(); - this.StatMsg = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // progressBar1 - // - this.progressBar1.Location = new System.Drawing.Point(29, 83); - this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(297, 27); - this.progressBar1.TabIndex = 0; - // - // lblBar - // - this.lblBar.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); - this.lblBar.Location = new System.Drawing.Point(29, 136); - this.lblBar.Name = "lblBar"; - this.lblBar.Size = new System.Drawing.Size(297, 16); - this.lblBar.TabIndex = 1; - this.lblBar.Text = "% Complete"; - this.lblBar.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // StatMsg - // - this.StatMsg.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); - this.StatMsg.Location = new System.Drawing.Point(29, 18); - this.StatMsg.Name = "StatMsg"; - this.StatMsg.Size = new System.Drawing.Size(307, 56); - this.StatMsg.TabIndex = 2; - this.StatMsg.Text = "Progress Bar"; - this.StatMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // StatusBarFrm - // - this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); - this.ClientSize = new System.Drawing.Size(350, 171); - this.ControlBox = false; - this.Controls.Add(this.StatMsg); - this.Controls.Add(this.lblBar); - this.Controls.Add(this.progressBar1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "StatusBarFrm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Status"; - this.TopMost = true; - this.Load += new System.EventHandler(this.StatusBarFrm_Load); - this.ResumeLayout(false); - - } - #endregion - - private void StatusBarFrm_Load(object sender, System.EventArgs e) - { - - } - - public int Value - { - get - { - return progressBar1.Value; - } - set - { - if (value >= progressBar1.Maximum) - progressBar1.Value = progressBar1.Maximum; - else - progressBar1.Value = value; - UpateLabel(); - } - } - - public int Maximum - { - get - { - return progressBar1.Maximum; - } - set - { - progressBar1.Maximum = value; - } - } - - public int Step - { - get - { - return progressBar1.Step; - } - set - { - progressBar1.Step = value; - } - } - - public void PerformStep() - { - progressBar1.PerformStep(); - } - - private void UpateLabel() - { - lblBar.Text = (Math.Round((decimal)(progressBar1.Value * 100) / progressBar1.Maximum)).ToString(); - lblBar.Text += "% Complete"; -// if( lblBar.Text != strLblLast) -// { -// Profiler.Start("UpdateLabel"); - lblBar.Refresh(); -// lblBar.Update(); -// Profiler.End("UpdateLabel"); -// } -// strLblLast = lblBar.Text; - } - - public string StatusMessage - { - get - { - return StatMsg.Text; - } - set - { - StatMsg.Text = value; -// Profiler.Start("StatusMessage"); - StatMsg.Refresh(); -// StatMsg.Update(); -// Profiler.End("StatusMessage"); - } - } - - public string StatusBoxTitle - { - get - { - return Text; - } - set - { - Text = value; - } - } - - } -} diff --git a/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusBarFrm.resx b/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusBarFrm.resx deleted file mode 100644 index 63f8de01..00000000 --- a/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusBarFrm.resx +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - - Private - - - Private - - - False - - - Private - - - Private - - - False - - - Private - - - Private - - - False - - - (Default) - - - False - - - False - - - 8, 8 - - - True - - - 80 - - - StatusBarFrm - - - True - - - Private - - \ No newline at end of file diff --git a/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusMessageFrm.cs b/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusMessageFrm.cs deleted file mode 100644 index 386d145c..00000000 --- a/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusMessageFrm.cs +++ /dev/null @@ -1,140 +0,0 @@ -/********************************************************************************************* - * Copyright 2002 - Volian Enterprises, Inc. All rights reserved. - * Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE - * ------------------------------------------------------------------------------ - * $Workfile: StatusMessageFrm.cs $ $Revision: 3 $ - * $Author: Jsj $ $Date: 5/11/04 9:30a $ - * - * $History: StatusMessageFrm.cs $ - * - * ***************** Version 3 ***************** - * User: Jsj Date: 5/11/04 Time: 9:30a - * Updated in $/LibSource/VlnStatus - * - * ***************** Version 2 ***************** - * User: Jsj Date: 11/26/02 Time: 3:38p - * Updated in $/LibSource/VlnStatus - * Added overbounds check - *********************************************************************************************/ - -using System; -using System.Drawing; -using System.Collections; -using System.ComponentModel; -using System.Windows.Forms; - -namespace VlnStatus -{ - /// - /// Create status message window. - /// - public class StatusMessageFrm : System.Windows.Forms.Form - { - private System.Windows.Forms.Label lblStatMsg; - /// - /// Required designer variable. - /// - private System.ComponentModel.Container components = null; - - public StatusMessageFrm() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - } - - public StatusMessageFrm(string StatTitle) - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - Text = StatTitle; - } - - /// - /// Clean up any resources being used. - /// - protected override void Dispose( bool disposing ) - { - if( disposing ) - { - if(components != null) - { - components.Dispose(); - } - } - base.Dispose( disposing ); - } - - #region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.lblStatMsg = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // lblStatMsg - // - this.lblStatMsg.Location = new System.Drawing.Point(19, 20); - this.lblStatMsg.Name = "lblStatMsg"; - this.lblStatMsg.Size = new System.Drawing.Size(420, 81); - this.lblStatMsg.TabIndex = 0; - this.lblStatMsg.Text = "Put Status Message Here"; - this.lblStatMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // StatusMessageFrm - // - this.AutoScaleBaseSize = new System.Drawing.Size(7, 19); - this.ClientSize = new System.Drawing.Size(457, 117); - this.ControlBox = false; - this.Controls.Add(this.lblStatMsg); - this.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "StatusMessageFrm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Status"; - this.TopMost = true; - this.Load += new System.EventHandler(this.StatusMessageFrm_Load); - this.ResumeLayout(false); - - } - #endregion - - private void StatusMessageFrm_Load(object sender, System.EventArgs e) - { - - } - - public string StatusMessage - { - get - { - return lblStatMsg.Text; - } - set - { - lblStatMsg.Text = value; - lblStatMsg.Refresh(); - } - } - - public string StatusBoxTitle - { - get - { - return Text; - } - set - { - Text = value; - } - } - } -} diff --git a/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusMessageFrm.resx b/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusMessageFrm.resx deleted file mode 100644 index 7edd5b3c..00000000 --- a/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusMessageFrm.resx +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - - Private - - - Private - - - False - - - (Default) - - - False - - - False - - - 8, 8 - - - StatusMessageFrm - - - True - - - 80 - - - True - - - Private - - \ No newline at end of file diff --git a/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatus.csproj b/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatus.csproj deleted file mode 100644 index 90978560..00000000 --- a/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatus.csproj +++ /dev/null @@ -1,162 +0,0 @@ - - - - Local - 8.0.50727 - 2.0 - {551CB7B3-00B1-11D7-8590-482B59000000} - Debug - AnyCPU - - - - - VlnStatus - - - JScript - Grid - IE50 - false - Library - VlnStatus - OnBuildSuccess - - - - - - - - - - - - - - - v4.8.1 - 2.0 - - - - bin\Debug\ - false - 285212672 - false - - - DEBUG;TRACE - - - true - 4096 - false - - - false - false - false - false - 4 - full - prompt - false - x64 - - - bin\Release\ - false - 285212672 - false - - - TRACE - - - false - 4096 - false - - - true - false - false - false - 4 - none - prompt - false - x64 - - - true - bin\Debug\ - DEBUG;TRACE - 285212672 - full - x64 - prompt - false - - - bin\x86\Release\ - TRACE - 285212672 - true - - - x64 - prompt - false - - - - System - - - System.Data - - - System.Drawing - - - System.Windows.Forms - - - System.XML - - - - - Code - - - Form - - - Form - - - Code - - - Code - - - StatusBarFrm.cs - Designer - - - StatusMessageFrm.cs - Designer - - - - - - - - - - \ No newline at end of file diff --git a/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusBar.cs b/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusBar.cs deleted file mode 100644 index a7a4e2cd..00000000 --- a/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusBar.cs +++ /dev/null @@ -1,148 +0,0 @@ -/********************************************************************************************* - * Copyright 2002 - Volian Enterprises, Inc. All rights reserved. - * Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE - * ------------------------------------------------------------------------------ - * $Workfile: VlnStatusBar.cs $ $Revision: 4 $ - * $Author: Jsj $ $Date: 11/26/02 4:25p $ - * - * $History: VlnStatusBar.cs $ - * - * ***************** Version 4 ***************** - * User: Jsj Date: 11/26/02 Time: 4:25p - * Updated in $/LibSource/VlnStatus - * fixed problem with counter - * - * ***************** Version 3 ***************** - * User: Jsj Date: 11/26/02 Time: 3:38p - * Updated in $/LibSource/VlnStatus - * Added overbounds check - *********************************************************************************************/ -using System; - -namespace VlnStatus -{ - /// - /// Creates a Status Window with a progression bar control. - /// - /// This class has two constructors. One allows you to pass in the title - /// of the Status Box. The Other provides a default title of "Status". - /// The Status Box Title can also be set/changed via the StatusBoxTitle - /// property. - /// - /// - /// - public class VlnStatusBar - { - StatusBarFrm StatBar; - private int Cnt; - - // Create a status window with the default title of "Status" - public VlnStatusBar() - { - StatBar = new StatusBarFrm(); - StatBar.Show(); - } - - // Create a status window with the passed in title - public VlnStatusBar(string Title) - { - StatBar = new StatusBarFrm(Title); - StatBar.Show(); - } - - // Increament the the status bar by the passed in value. - public void PerformStep(int val) - { -// StatBar.Value = val; -// Cnt = val; - BarValue = val; - StatBar.PerformStep(); - } - - // Increament the the status bar by one - public void PerformStep() - { -// StatBar.Value = StatBar.Value + 1; - Cnt++; - BarValue = Cnt; - StatBar.PerformStep(); - } - - // This property gets or sets the current status bar value. - public int BarValue - { - get - { - return StatBar.Value; - } - set - { - StatBar.Value = value; - Cnt = value; - } - } - - // This property sets or gets the maximum value that the - // BarValue property can be. i.e. when BarValue reaches this - // number, the status bar is completely displayed. - public int BarMax - { - get - { - return StatBar.Maximum; - } - set - { - StatBar.Maximum = value; - } - } - - // This property sets or gets the increamenting value used to - // move the status bar. For example, if set to 5, each tick of - // the status bar represents a value of 5. - public int BarStepValue - { - get - { - return StatBar.Step; - } - set - { - StatBar.Step = value; - } - } - - // This property sets or gets the message above the status bar. - public string StatMsg - { - get - { - return StatBar.StatusMessage; - } - set - { - StatBar.StatusMessage = value; - } - } - - // This property sets or gets the Status Window Title - public string StatusBoxTitle - { - get - { - return StatBar.StatusBoxTitle; - } - set - { - StatBar.StatusBoxTitle = value; - } - } - - public void Dispose() - { - StatBar.Dispose(); - } - - } -} - diff --git a/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusMessage.cs b/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusMessage.cs deleted file mode 100644 index e0221ee8..00000000 --- a/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusMessage.cs +++ /dev/null @@ -1,79 +0,0 @@ -/********************************************************************************************* - * Copyright 2002 - Volian Enterprises, Inc. All rights reserved. - * Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE - * ------------------------------------------------------------------------------ - * $Workfile: VlnStatusMessage.cs $ $Revision: 3 $ - * $Author: Jsj $ $Date: 11/26/02 3:38p $ - * - * $History: VlnStatusMessage.cs $ - * - * ***************** Version 3 ***************** - * User: Jsj Date: 11/26/02 Time: 3:38p - * Updated in $/LibSource/VlnStatus - * Added overbounds check - *********************************************************************************************/ - -using System; - -namespace VlnStatus -{ - /// - /// Creates a Status Window to display a status message. - /// - /// This class has two constructors. One allows you to pass in the title - /// of the Status Box. The Other provides a default title of "Status". - /// The Status Box Title can also be set/changed via the StatusBoxTitle - /// property. - /// - /// - public class VlnStatusMessage - { - StatusMessageFrm StatusMessageBox; - - // Create a status window with the default title of "Status" - public VlnStatusMessage() - { - StatusMessageBox = new StatusMessageFrm(); - StatusMessageBox.Show(); - } - - // Create a status window with the passed in title. - public VlnStatusMessage(string StatusBoxTitle) - { - StatusMessageBox = new StatusMessageFrm(StatusBoxTitle); - StatusMessageBox.Show(); - } - - // This property gets or sets the current status message - public string StatusMessage - { - get - { - return StatusMessageBox.StatusMessage; - } - set - { - StatusMessageBox.StatusMessage = value; - } - } - - // This property gets or sets the status box title - public string StatusBoxTitle - { - get - { - return StatusMessageBox.StatusBoxTitle; - } - set - { - StatusMessageBox.StatusBoxTitle = value; - } - } - - public void Dispose() - { - StatusMessageBox.Dispose(); - } - - } -} diff --git a/PROMS/VG/AssemblyInfo.cs b/PROMS/VG/AssemblyInfo.cs deleted file mode 100644 index 9f89a328..00000000 --- a/PROMS/VG/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly: AssemblyVersion("1.0.*")] - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyKeyName("")] diff --git a/PROMS/VG/IVGOutput.cs b/PROMS/VG/IVGOutput.cs deleted file mode 100644 index 2e5ec04a..00000000 --- a/PROMS/VG/IVGOutput.cs +++ /dev/null @@ -1,165 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using iTextSharp.text.pdf; -using iTextSharp.text.factories; -using Microsoft.Win32; -using Volian.Base.Library; - -namespace VG -{ - public interface IVGOutput - { - float Scale { get;} - int DebugStatus { get; set; } - void DrawLine(Pen pn, float startx, float starty, float endx, float endy); - void DrawRectangle(Pen pn, RectangleF rectf); - void DrawEllipse(Pen pn, float cx, float cy, float dx, float dy); - void DrawImage(Bitmap bm, RectangleF rectf); - void DrawString(string text, Font myFont, Brush brush, RectangleF rectf); - void DrawArc(Pen pn, RectangleF rectf, float startAngle, float sweepAngle); - SizeF MeasureString(string text, Font myFont); - void Save(string fileName); - float FontSizeAdjust { get;} - } - public partial class VGOut_Graphics: IVGOutput - { - private int _DebugStatus = 0; - public int DebugStatus - { - get { return _DebugStatus; } - set { _DebugStatus = value; } - } - private Graphics _VGOutput; - //public Graphics VGOutput - //{ get { return _VGOutput; } } - public VGOut_Graphics(Graphics vgOutput) - { _VGOutput = vgOutput; } - public float Scale - { get { return 1; } } - //{ get { return _VGOutput.Transform.Elements[0]; } } - public void DrawLine(Pen pn, float startx, float starty, float endx, float endy) - { _VGOutput.DrawLine(pn, startx, starty, endx, endy); } - public void DrawRectangle(Pen pn, RectangleF rectf) - { - _VGOutput.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; - _VGOutput.FillRectangle(DebugStatus == 1 ? Brushes.Transparent : Brushes.White, rectf.X, rectf.Y, rectf.Width, rectf.Height); - _VGOutput.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; - _VGOutput.DrawRectangle(pn, rectf.X, rectf.Y, rectf.Width, rectf.Height); - } - public void DrawEllipse(Pen pn, float cx, float cy, float dx, float dy) - { _VGOutput.DrawEllipse(pn, cx, cy, dx, dy); } - public void DrawImage(Bitmap bm, RectangleF rectf) - { _VGOutput.DrawImage(bm, rectf); } - public void DrawString(string text, Font myFont, Brush brush, RectangleF rectf) - { _VGOutput.DrawString(text, myFont, brush, rectf, StringFormat.GenericTypographic); } - public void DrawArc(Pen pn, RectangleF rectf, float startAngle, float sweepAngle) - { _VGOutput.DrawArc(pn, rectf, startAngle, sweepAngle); } - public SizeF MeasureString(string text, Font myFont) - { return _VGOutput.MeasureString(text, myFont, new PointF(0, 0), StringFormat.GenericTypographic); } - public void Save(string fileName) - { ;/* Don't do anything*/ } - public float FontSizeAdjust - { get { return .71f * 96f / _VGOutput.DpiX; } } // Changed to adjust for Screen DPI Setting - } - public partial class VGOut_ITextSharp : IVGOutput - { - private int _DebugStatus = 0; - public int DebugStatus - { - get { return _DebugStatus; } - set { _DebugStatus = value; } - } - private PdfContentByte _VGOutput; - //public Graphics VGOutput - //{ get { return _VGOutput; } } - public VGOut_ITextSharp(PdfContentByte vgOutput) - { _VGOutput = vgOutput; } - public float Scale - { get { return 1; } } - public void DrawLine(Pen pn, float startx, float starty, float endx, float endy) - { - _VGOutput.SaveState(); - SetStrokeData(pn); - _VGOutput.MoveTo(startx, ScaleY(starty)); - _VGOutput.LineTo(endx, ScaleY(endy)); - _VGOutput.Stroke(); - _VGOutput.RestoreState(); - } - private void SetStrokeData(Pen pn) - { - _VGOutput.SetLineWidth(pn.Width); - _VGOutput.SetColorStroke(new iTextSharp.text.Color(pn.Color.R, pn.Color.G, pn.Color.B, pn.Color.A)); - } - public void DrawRectangle(Pen pn, RectangleF rectf) - { - _VGOutput.SaveState(); - SetStrokeData(pn); - _VGOutput.Rectangle(rectf.X, ScaleY(rectf.Y), rectf.Width, -rectf.Height); - _VGOutput.Stroke(); - _VGOutput.RestoreState(); - } - public void DrawEllipse(Pen pn, float cx, float cy, float dx, float dy) - { - _VGOutput.SaveState(); - SetStrokeData(pn); - _VGOutput.Ellipse(cx, ScaleY(cy), dx, -dy); - _VGOutput.Stroke(); - _VGOutput.RestoreState(); - } - public void DrawImage(Bitmap bm, RectangleF rectf) - { - _VGOutput.SaveState(); - // TODO: Determine how I can create an iTextSharp.text.Image - //_VGOutput.AddImage(new iTextSharp.text.Image( - _VGOutput.RestoreState(); - } - public void DrawString(string text, Font myFont, Brush brush, RectangleF rectf) - { - _VGOutput.SaveState(); - _VGOutput.BeginText(); - iTextSharp.text.Font itFont = GetFont(myFont.Name); - iTextSharp.text.pdf.BaseFont baseFont = itFont.BaseFont; - // _VGOutput.DrawString(text, myFont, brush, rectf, StringFormat.GenericTypographic); - _VGOutput.MoveText(rectf.X, ScaleY(rectf.Y) - myFont.SizeInPoints); - _VGOutput.SetFontAndSize(baseFont, myFont.SizeInPoints); - _VGOutput.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL); - _VGOutput.ShowTextKerned(text); - _VGOutput.EndText(); - _VGOutput.RestoreState(); - } - public void DrawArc(Pen pn, RectangleF rectf, float startAngle, float sweepAngle) - { - _VGOutput.SaveState(); - SetStrokeData(pn); - _VGOutput.Arc(rectf.X, ScaleY(rectf.Y), rectf.X + rectf.Width, ScaleY(rectf.Y + rectf.Height), -startAngle, -sweepAngle); - _VGOutput.Stroke(); - _VGOutput.RestoreState(); - } - public SizeF MeasureString(string text, Font myFont) - { - iTextSharp.text.Font itFont = GetFont(myFont.Name); - iTextSharp.text.pdf.BaseFont baseFont = itFont.BaseFont; - return new SizeF(baseFont.GetWidthPoint(text,myFont.SizeInPoints) - , baseFont.GetAscentPoint(text, myFont.SizeInPoints) + baseFont.GetDescentPoint(text, myFont.SizeInPoints)); - } - public void Save(string fileName) - { ;/* Don't do anything*/ } - public float FontSizeAdjust - { get { return 1; } } // Changed to adjust for Screen DPI Setting - public static iTextSharp.text.Font GetFont(string fontName) - { - /// - /// B2019-116 Volian.Base.Library This is a generic class for dealing with iTextSharp Fonts - /// Code moved and consolidated from Volian.Print.Library Volian PDF.Library and VG - /// - VlnItextFont.RegisterFont(fontName); - return iTextSharp.text.FontFactory.GetFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); - } - private float ScaleY(float y) - { - return _VGOutput.PdfWriter.PageSize.Height - y; - } - } -} diff --git a/PROMS/VG/Properties/xlicenses.licx b/PROMS/VG/Properties/xlicenses.licx deleted file mode 100644 index 804d7209..00000000 --- a/PROMS/VG/Properties/xlicenses.licx +++ /dev/null @@ -1 +0,0 @@ -C1.C1Pdf.C1PdfDocument, C1.C1Pdf.2, Version=2.1.20082.76, Culture=neutral, PublicKeyToken=79882d576c6336da diff --git a/PROMS/VG/VG.cs b/PROMS/VG/VG.cs deleted file mode 100644 index 856efbd1..00000000 --- a/PROMS/VG/VG.cs +++ /dev/null @@ -1,414 +0,0 @@ -/********************************************************************************************* - * Copyright 2010 - Volian Enterprises, Inc. All rights reserved. - * Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE - *********************************************************************************************/ -using System; -using System.Xml; -using System.Drawing; -using System.Text; - -namespace VG -{ - /// - /// VG is the class representing vector graphics. It provides objects for: - /// Line, Rectangle, Text, Ellipse, Bitmaps, etc. - /// VG provides constructors for these objects from coordinate system locations - /// (such as starting x,y ending x,y, etc), xml and svg. - /// VG data is stored in TWIPS (1440 per inch) - /// - - // Temporary page class to store portrait/landscape, Left Margin, Vertical offset, etc - public class Page - { - private bool _Portrait = true; - public bool Portrait - { - get { return _Portrait; } - set { _Portrait = value; } - } - private float _LeftMargin = 0; - public float LeftMargin - { - get { return _LeftMargin; } - set { _LeftMargin = value; } - } - private float _TopMargin = 0; - public float TopMargin - { - get { return _TopMargin; } - set { _TopMargin = value; } - } - private float _RightMargin = 0; - public float RightMargin - { - get { return _RightMargin; } - set { _RightMargin = value; } - } - private float _BottomMargin = 0; - public float BottomMargin - { - get { return _BottomMargin; } - set { _BottomMargin = value; } - } - public Page(bool portrait, float leftMargin, float topMargin, float rightMargin, float bottomMargin) - { - _Portrait = portrait; - _LeftMargin = leftMargin; - _TopMargin = topMargin; - _RightMargin = rightMargin; - _BottomMargin = bottomMargin; - } - public Page(bool portrait, float leftMargin, float topMargin) - { - _Portrait = portrait; - _LeftMargin = leftMargin; - _TopMargin = topMargin; - } - } - public class VG - { - private static Brush _BlackBrush = Brushes.Black; - public static Brush BlackBrush - { - get { return _BlackBrush; } - set { _BlackBrush = value; } - } - private static Color _BlackColor = Color.Black; - public static Color BlackColor - { - get { return _BlackColor; } - set { _BlackColor = value; _BlackBrush = new SolidBrush(value); } - } - // Values of vector graphics items are stored as twips (1440 twips in an inch) - public int cx; - public int cy; - public int dx; - public int dy; - public float lnwid; - public Page pg; - public bool MoveAbsolute; // TODO: Not sure what to do with this. - public VG() - { - cx = 0; - cy = 0; - dx = 0; - dy = 0; - MoveAbsolute = false; - pg = null; - } - public VG(int sx, int sy, int ex, int ey, bool ima, Page ipg) - { - cx = sx; - cy = sy; - dx = ex; - dy = ey; - MoveAbsolute = ima; - pg = ipg; - } - public float ToPoints(float twip) - { - float r = ((float)twip) * 0.05f; - return r; - } - public void UpdatePageInfo(Page pa) - { - pg.LeftMargin = pa.LeftMargin; - pg.Portrait = pa.Portrait; // RHM 20081003 - This had been pg.portrait=pg.portrait - pg.TopMargin = pa.TopMargin; // RHM 20081003 - This had been pg.VertOffset=pg.VertOffset - } - public string AddRTFBUI(string origStr, string bold, string underline, string italics) - { - if (bold == "" && underline == "" && italics == "") return origStr; - StringBuilder sb = new StringBuilder(); - if (bold == "bold") sb.Append("{\\b"); - if (underline == "underline") sb.Append("{\\u"); - if (italics == "italics") sb.Append("{\\i"); - sb.Append(" "); - sb.Append(origStr); - if (bold == "bold") sb.Append("}"); - if (underline == "underline") sb.Append("}"); - if (italics == "italics") sb.Append("}"); - return sb.ToString(); - } - public static Pen CreatePen(Color color, float wid, float scale) - { - Pen pn; - float scaleWid = wid * scale; - float colorFraction = (float)Math.Sqrt(scaleWid); - if (scaleWid < .5F) - { - //Console.WriteLine("Width = {0}", wid); - int R1 = (int)(colorFraction * color.R); - int R2 = (int)((1 - colorFraction) * Color.White.R); - int G1 = (int)(colorFraction * color.G); - int G2 = (int)((1 - colorFraction) * Color.White.G); - int B1 = (int)(colorFraction * color.B); - int B2 = (int)((1 - colorFraction) * Color.White.B); - pn = new Pen(Color.FromArgb(R1 + R2, G1 + G2, B1 + B2), scaleWid); - //pn = new Pen(color, wid*wid); - } - else - pn = new Pen(color, scaleWid); - return pn; - } - } - public class VG_Line : VG - { - // Line is defined as starting & ending points. - public VG_Line(int sx, int sy, int ex, int ey, int w, Page ipg) - { - cx = sx; - cy = sy; - dx = ex; - dy = ey; - lnwid = w; - pg = ipg; - } - - public VG_Line(XmlElement svg, Page ipg) - { - cx = System.Convert.ToInt32(svg.GetAttribute("x1")); - cy = System.Convert.ToInt32(svg.GetAttribute("y1")); - dx = System.Convert.ToInt32(svg.GetAttribute("x2")); - dy = System.Convert.ToInt32(svg.GetAttribute("y2")); - lnwid = System.Convert.ToInt32(svg.GetAttribute("stroke-width")); - pg = ipg; - } - public void Draw(IVGOutput vgOutput) - { - float startx = pg.Portrait ? (cx + pg.LeftMargin) : (pg.TopMargin + cy); - float starty = pg.Portrait ? (cy + pg.TopMargin) : (pg.LeftMargin - cx); - float endx = pg.Portrait ? (dx + pg.LeftMargin) : (pg.TopMargin + dy); - float endy = pg.Portrait ? (dy + pg.TopMargin) : (pg.LeftMargin - dx); - Pen pn = VG.CreatePen(VG.BlackColor, ToPoints(lnwid), vgOutput.Scale); - vgOutput.DrawLine(pn, ToPoints(startx), ToPoints(starty), ToPoints(endx), ToPoints(endy)); - } - } - public class VG_Rect : VG - { - // Rectangle is defined as starting point & length/width - public VG_Rect(int sx, int sy, int ex, int ey, int w, Page ipg) - { - cx = sx; - cy = sy; - dx = ex; - dy = ey; - lnwid = w; - pg = ipg; - } - public VG_Rect(XmlElement svg, Page ipg) - { - cx = System.Convert.ToInt32(svg.GetAttribute("x")); - cy = System.Convert.ToInt32(svg.GetAttribute("y")); - dx = System.Convert.ToInt32(svg.GetAttribute("width")); - dy = System.Convert.ToInt32(svg.GetAttribute("height")); - lnwid = System.Convert.ToInt32(svg.GetAttribute("stroke-width")); - pg = ipg; - } - public void Draw(IVGOutput vgOutput) - { - Pen pn = new Pen(VG.BlackBrush, ToPoints(lnwid)); - - float startx = pg.Portrait ? (cx + pg.LeftMargin) : (pg.TopMargin + cy); - float starty = pg.Portrait ? (cy + pg.TopMargin) : (pg.LeftMargin - cx); - float endx = pg.Portrait ? dx : dy; - float endy = pg.Portrait ? dy : dx; - RectangleF rc = new RectangleF(ToPoints(startx), ToPoints(starty), ToPoints(endx), ToPoints(endy)); - vgOutput.DrawRectangle(pn, rc); - } - } - public class VG_Image : VG - { - private int Scale; - private string FileName; - // Image is defined as starting point, scale factor (defaults to 1) & image file name - public VG_Image(int sx, int sy, int iscale, string fname) - { - cx = sx; - cy = sy; - Scale = 1; - FileName = fname; - } - public VG_Image(XmlElement svg, Page ipg) - { - cx = System.Convert.ToInt32(svg.GetAttribute("x")); - cy = System.Convert.ToInt32(svg.GetAttribute("y")); - Scale = 1; - if (svg.HasAttribute("scale")) Scale = System.Convert.ToInt32(svg.GetAttribute("scale")); - FileName = svg.GetAttribute("bname"); - pg = ipg; - } - public void Draw(IVGOutput vgOutput) - { - Pen pn = new Pen(VG.BlackBrush, lnwid); - Bitmap bm = new Bitmap(FileName); - RectangleF rc = new RectangleF(); - rc.Height = ToPoints((bm.Height * Scale) * 4.8f); - rc.Width = ToPoints((bm.Width * Scale) * 4.8f); - rc.X = ToPoints(pg.LeftMargin + cx); - rc.Y = ToPoints(pg.TopMargin + cy); - // TODO: grfx.DrawImage(bm, rc, ContentAlignment.MiddleCenter, ImageSizeModeEnum.Scale); - } - } - public class VG_Ellipse : VG - { - // Ellipse (circle) is defined by a bounding rectangle specified by a coordinate pair, a width, and a height - public VG_Ellipse(int sx, int sy, int ex, int ey, int w, Page ipg) - { - cx = sx; - cy = sy; - dx = ex; - dy = ey; - lnwid = w; - pg = ipg; - } - public VG_Ellipse(XmlElement svg, Page ipg) - { - cx = System.Convert.ToInt32(svg.GetAttribute("cx")); - cy = System.Convert.ToInt32(svg.GetAttribute("cy")); - dx = System.Convert.ToInt32(svg.GetAttribute("rx")); - dy = System.Convert.ToInt32(svg.GetAttribute("ry")); - lnwid = System.Convert.ToInt32(svg.GetAttribute("stroke-width")); - pg = ipg; - } - public void Draw(IVGOutput vgOutput) - { - Pen pn = new Pen(VG.BlackBrush, ToPoints(lnwid)); - vgOutput.DrawEllipse(pn, ToPoints(pg.LeftMargin + cx), ToPoints(pg.TopMargin + cy), ToPoints(dx), ToPoints(dy)); - } - } - public class VG_Text : VG - { - private string FontName; - private int FontSize; - private string Bold; - private string Underline; - private string Italics; - private string Text; - // Text is defined by a starting location, attributes & the string - public VG_Text(int sx, int sy, int fs, string txt, string fn, string ibold, string iunder, string iitalics, Page ipg) - { - cx = sx; - cy = sy; - FontSize = fs; - FontName = fn; - Text = txt; - Bold = ibold; - Underline = iunder; - Italics = iitalics; - pg = ipg; - // TODO: The following were in the 16-bit code - we may need to use these, wait and see - // strokeWidth = stroke; - // strokeWidthBold = strokebold; - // ULOffset = UnderlineOffset; - // ULWidth = UnderlineWidth; - } - public VG_Text(XmlElement svg, Page ipg) - { - cx = System.Convert.ToInt32(svg.GetAttribute("x")); - cy = System.Convert.ToInt32(svg.GetAttribute("y")); - FontSize = System.Convert.ToInt32(svg.GetAttribute("font-size")); - Bold = svg.GetAttribute("font-weight"); - Underline = svg.GetAttribute("text-decoration"); - Italics = svg.GetAttribute("font-style"); - FontName = svg.GetAttribute("font-family"); - Text = svg.InnerText; - pg = ipg; - } - public void Draw(IVGOutput vgOutput) - { - // TODO: Font myfont = new Font(FontName, (FontSize*9)/10); - Font myfont = new Font(FontName, FontSize * vgOutput.FontSizeAdjust); // TODO: Trying 80% - RectangleF rc = new RectangleF(); - // the returned value from c1 grfx code is already in points, - // so need to convert the size. - rc.Size = vgOutput.MeasureString(Text, myfont); // TODO: 500 or pagewidth, or what - //rc.Size = grfx.MeasureString(Text, myfont, 500); // TODO: 500 or pagewidth, or what - rc.X = ToPoints(pg.LeftMargin + cx); - rc.Y = ToPoints(pg.TopMargin + cy) - FontSize; - rc.Height *= 1.0000001F; // Small factor to make text visible. - // add bold, underline & italics for entire object. - // TODO: string rtfout = AddRTFBUI(Text, Bold, Underline, Italics); - //using(Pen pn = new Pen(Color.DarkBlue, .1F)) - // grfx.DrawRectangle(pn, rc.X,rc.Y,rc.Width,rc.Height); - vgOutput.DrawString(Text, myfont, VG.BlackBrush, rc); - //grfx.DrawString(Text, myfont, VG.BlackBrush, rc); - } - } - public class VG_Arc : VG - { - public Single sweepAngle; - public Single startAngle; - public float stX, stY; - public float rWid, rHgt; - // Arc is defined by a bounding rectangle specified by a coordinate pair, a width, and a height - public VG_Arc(float sx, float sy, float width, float hight, float stAngle, float swpAngle, int w, Page ipg) - { - if (width > 0) - { - stX = sx; - rWid = width; - } - else - { - stX = sx + width; - rWid = -width; - } - if (hight > 0) - { - stY = sy; - rHgt = hight; - } - else - { - stY = sy + hight; - rHgt = -hight; - } - startAngle = stAngle; - // startAngle = 90; - sweepAngle = swpAngle; - // sweepAngle = -45; - lnwid = w; - pg = ipg; - } -//#if DEBUG - - //public static int iColor = 0; - //public Color[] myColors = { Color.Red, Color.Green, Color.OrangeRed, Color.Cyan, Color.Orange, Color.Blue, Color.Yellow, Color.Indigo, Color.YellowGreen, Color.Violet }; - ////public Color[] myColors ={ Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Blue, Color.BlueViolet, Color.Violet }; -//#endif - public void Draw(IVGOutput vgOutput) - { -//#if DEBUG -// Pen pn = new Pen(myColors[iColor % myColors.Length], ToPoints(lnwid)); - //iColor++; - //if (iColor >= myColors.Length) iColor = 0; -//#else - Pen pn = new Pen(VG.BlackBrush, ToPoints(lnwid)); -//#endif - - float startx = pg.Portrait ? (stX + pg.LeftMargin) : (pg.TopMargin + stY); - float starty = pg.Portrait ? (stY + pg.TopMargin) : (pg.LeftMargin - stX); - RectangleF rc = new RectangleF(ToPoints(startx), ToPoints(starty), ToPoints(rWid), ToPoints(rHgt)); - //Console.WriteLine("{0},'{1}',{2},{3},{4},{5},{6},{7}", iColor, pn.Color, rc.X, rc.Y, rc.Width, rc.Height, startAngle, sweepAngle); - //if (iColor == 7 || iColor == 8) return; - //if (iColor == 6) return; - //if (iColor == 4 || iColor == 6) - //{ - // using (Pen lightPen = new Pen(myColors[iColor % myColors.Length], .01F)) - //{ - // vgOutput.DrawEllipse(lightPen, rc.X, rc.Y, rc.Width, rc.Height); - // float xc = rc.X + (rc.Width / 2); - // float yc = rc.Y + (rc.Height / 2); - // vgOutput.DrawEllipse(lightPen, xc - .5F, yc - .5F, 1F, 1F); - //} - //} - if (sweepAngle > 0) - vgOutput.DrawArc(pn, rc, startAngle, sweepAngle); - else - vgOutput.DrawArc(pn, rc, startAngle + sweepAngle, -sweepAngle); - } - - } -} - diff --git a/PROMS/VG/VG.csproj b/PROMS/VG/VG.csproj deleted file mode 100644 index fbadc1d4..00000000 --- a/PROMS/VG/VG.csproj +++ /dev/null @@ -1,182 +0,0 @@ - - - - Local - 8.0.50727 - 2.0 - {52D74078-3822-410E-889B-464BD21AAB9E} - - - - - - - - - Debug - AnyCPU - - - - - VG - - - JScript - Grid - IE50 - false - Library - VG - OnBuildSuccess - - - - - - - v4.8.1 - 2.0 - - - - bin\Debug\ - false - 285212672 - false - - - DEBUG;TRACE - - - true - 4096 - false - - - false - false - false - false - 4 - full - prompt - x64 - false - - - bin\Release\ - false - 285212672 - false - - - TRACE - - - false - 4096 - false - - - true - false - false - false - 4 - none - prompt - false - x64 - - - true - bin\Demo\ - DEBUG;TRACE - 285212672 - full - x64 - prompt - false - - - true - bin\Debug\ - DEBUG;TRACE - 285212672 - full - x64 - prompt - false - - - bin\Release\ - TRACE - 285212672 - true - - - x64 - prompt - false - - - true - bin\Demo\ - TRACE;DEMO - 285212672 - full - x64 - prompt - false - - - - False - - - False - ..\..\..\..\3rdPartyLibraries\iTechSharp\itextsharp.dll - - - System - - - - System.Data - - - - System.Drawing - - - - System.XML - - - - - Code - - - - Code - - - - - - - - {aeee9fd1-6892-45e2-a67e-418c06d46ff9} - Volian.Base.Library - - - - - - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Base.Library/BaseLnSettings.cs b/PROMS/Volian.Base.Library/BaseLnSettings.cs deleted file mode 100644 index f6589524..00000000 --- a/PROMS/Volian.Base.Library/BaseLnSettings.cs +++ /dev/null @@ -1,8 +0,0 @@ - -namespace Volian.Base.Library -{ - public static class BaseLnSettings - { - public static bool blBaseLine { get; set; } = false; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Base.Library/BigNum.cs b/PROMS/Volian.Base.Library/BigNum.cs deleted file mode 100644 index 1567917a..00000000 --- a/PROMS/Volian.Base.Library/BigNum.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; - -namespace Volian.Base.Library -{ - [Serializable()] - //[XmlRoot("BigNum")] - public class BigNum - { - #region fields - private SortedDictionary _MyValue = new SortedDictionary(); - private const ulong one = 1; - private SortedDictionary MyValue - { - get { return _MyValue; } - set { _MyValue = value; } - } - #endregion - #region constructors - public BigNum() - { - } - public BigNum(int value) - { - SetFlag(value); - } - public BigNum(string values) - { - SetFlags(values); - } - public BigNum(ICollection values) - { - SetFlags(values); - } - public override string ToString() - { - return FlagList; - } - #endregion - #region operators - public static BigNum operator |(BigNum bn1, BigNum bn2) - { - BigNum bn = new BigNum(bn1.GetFlags()); - bn.SetFlags(bn2.GetFlags()); - return bn; - } - public static BigNum operator &(BigNum bn1, BigNum bn2) - { - BigNum bn = new BigNum(0); - foreach (uint k1 in bn1.MyValue.Keys) - { - if (bn2.MyValue.ContainsKey(k1) && (bn1.MyValue[k1] & bn2.MyValue[k1]) != 0) - bn.MyValue[k1] = (bn1.MyValue[k1] & bn2.MyValue[k1]); - } - return bn; - } - #endregion - #region methods - //public override string ToString() - //{ - // return GenericSerializer.StringSerialize(this); - //} - public bool Includes(BigNum other) - { - List mine = GetFlags(); - if (mine.Count == 0) return true; - List yours = other.GetFlags(); - if (yours.Count == 0) return false; - foreach (int y in yours) - if (mine.Contains(y)) return false; - return true; - } - public void SetFlags(string values) - { - if (values == string.Empty) return; - string[] myvalues = values.Split(','); - foreach (string v in myvalues) - SetFlag(int.Parse(v)); - } - public List GetFlags() - { - List myints = new List(); - //if (MyValue.Count == 0)//1 && MyValue.ContainsKey(0) && MyValue[0] == 0) - //{ - // myints.Add(-1); - //} - //else - //{ - foreach (uint key in MyValue.Keys) - { - ulong y = MyValue[key]; - for (int i = 0; i < 64; i++) - { - if (((y >> i) & one) == one) - myints.Add((int)(i + (key * 64))); - } - } - //} - return myints; - } - public void SetFlag(int flag) - { - //if (flag == -1) - //{ - // MyValue = new SortedDictionary(); - // //MyValue.Add(0, 0); - //} - //else - //{ - uint offset = (uint)(flag / 64); - ulong x = one << (flag % 64); - if (MyValue.ContainsKey(offset)) - MyValue[offset] |= x; - else - MyValue.Add(offset, x); - //} - } - public void SetFlags(ICollection flags) - { - foreach (int f in flags) - SetFlag(f); - } - public static BigNum MakeBigNum(string numbers) - { - if (numbers == "-1") - return null; - return new BigNum(numbers); - } - #endregion - #region properties - [XmlAttribute] - public string FlagList - { - get - { - StringBuilder sb = new StringBuilder(); - string sep = ""; - foreach (int i in GetFlags()) - { - sb.Append(sep + i.ToString()); - sep = ","; - } - return sb.ToString(); - } - set { SetFlags(value); } - } - #endregion - } -} diff --git a/PROMS/Volian.Base.Library/ByteArrayCompare.cs b/PROMS/Volian.Base.Library/ByteArrayCompare.cs deleted file mode 100644 index bd833e4a..00000000 --- a/PROMS/Volian.Base.Library/ByteArrayCompare.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Volian.Base.Library -{ - public static class ByteArrayCompare - { - // C2019-026 Took this from ROFSTExt.cs so that we can also use when importing procedures with library documents - public static bool DoCompare(byte[] ba1, byte[] ba2) - { - // we wrote our own byte array comparison because the system's 'equals' did not work! - if (ba1.Length != ba2.Length) return false; - for (int i = 0; i < ba1.Length; i++) - if (ba1[i] != ba2[i]) return false; - return true; - } - - } -} diff --git a/PROMS/Volian.Base.Library/DebugPrint.cs b/PROMS/Volian.Base.Library/DebugPrint.cs deleted file mode 100644 index bd0e4b44..00000000 --- a/PROMS/Volian.Base.Library/DebugPrint.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; - -namespace Volian.Base.Library -{ - public class DebugPrint:IDisposable - { - public void Dispose() - { - Close(); - } - private StreamWriter _MyStreamWriter = null; - public StreamWriter MyStreamWriter - { - get { return _MyStreamWriter; } - set - { - if (_MyStreamWriter != null) - { - _MyStreamWriter.Flush(); - _MyStreamWriter.Close(); - } - _MyStreamWriter = value; - } - } - public bool IsOpen - { - get { return MyStreamWriter != null; } - } - private string _FileName = null; - public string FileName - { - get { return _FileName; } - set - { - if (IsOpen) Close(); - _FileName = value; - MyFileInfo = new FileInfo(value); - } - } - private FileInfo _MyFileInfo; - public FileInfo MyFileInfo - { - get { return _MyFileInfo; } - set { _MyFileInfo = value; } - } - public void Open(string fileName) - { - FileName = fileName; - MyStreamWriter = MyFileInfo.CreateText(); - } - public void Close() - { - MyStreamWriter = null; - } - public void Write(string format, params object[] args) - { - if (IsOpen) MyStreamWriter.Write(format, args); - } - public void WriteLine(string format, params object[] args) - { - if (IsOpen) MyStreamWriter.WriteLine(format, args); - } - public void Show() - { - Close(); - if (FileName != null) - System.Diagnostics.Process.Start(FileName); - //System.Diagnostics.Process.Start("Explorer", "/select," + FileName); - } - } - public static class DebugPagination - { - private static int _TotalPages = 0; - public static int TotalPages - { - get { return _TotalPages; } - set { _TotalPages = value; } - } - private static DebugPrint _MyDebugPrint = new DebugPrint(); - public static void Open(string fileName) - { _MyDebugPrint.Open(fileName); } - public static void Close() - { - WriteLine("{0} Total Pages", TotalPages); - _MyDebugPrint.Close(); - } - public static void Write(string format, params object[] args) - { _MyDebugPrint.Write(format, args); } - public static void WriteLine(string format, params object[] args) - { _MyDebugPrint.WriteLine(format, args); } - public static void Show() - { _MyDebugPrint.Show(); } - public static bool IsOpen - { get { return _MyDebugPrint.IsOpen; } } - } - public static class DebugText - { - private static DebugPrint _MyDebugPrint = new DebugPrint(); - public static void Open(string fileName) - { _MyDebugPrint.Open(fileName); } - public static void Close() - { _MyDebugPrint.Close(); } - public static void Write(string format, params object[] args) - { _MyDebugPrint.Write(format, args); } - public static void WriteLine(string format, params object[] args) - { _MyDebugPrint.WriteLine(format, args); } - public static void Show() - { _MyDebugPrint.Show(); } - public static bool IsOpen - { get { return _MyDebugPrint.IsOpen; } } - } - public static class DebugProfile - { - private static DebugPrint _MyDebugPrint = new DebugPrint(); - public static void Open(string fileName) - { _MyDebugPrint.Open(fileName); } - public static void Close() - { _MyDebugPrint.Close(); _MyDebugPrint = null; } - public static void Write(string format, params object[] args) - { _MyDebugPrint.Write(format, args); } - public static void WriteLine(string format, params object[] args) - { _MyDebugPrint.WriteLine(format, args); } - public static void Show() - { _MyDebugPrint.Show(); } - public static bool IsOpen - { get { return _MyDebugPrint.IsOpen; } } - } - public static class DebugDBTrack - { - private static DebugPrint _MyDebugPrint = new DebugPrint(); - public static void Open(string fileName) - { _MyDebugPrint.Open(fileName); } - public static void Close() - { _MyDebugPrint.Close(); _MyDebugPrint = null; } - public static void Write(string format, params object[] args) - { _MyDebugPrint.Write(format, args); } - public static void WriteLine(string format, params object[] args) - { _MyDebugPrint.WriteLine(format, args); } - public static void Show() - { _MyDebugPrint.Show(); } - public static bool IsOpen - { get { return _MyDebugPrint.IsOpen; } } - } - // C2018-004 create meta file for baseline compares - public static class BaselineMetaFile - { - private static DebugPrint _MyDebugPrint = new DebugPrint(); - public static void Open(string fileName) - { _MyDebugPrint.Open(fileName); } - public static void Close() - { _MyDebugPrint.Close(); } - public static void Write(string format, params object[] args) - { _MyDebugPrint.Write(format, args); } - public static void WriteLine(string format, params object[] args) - { _MyDebugPrint.WriteLine(format, args); } - public static void Show() - { _MyDebugPrint.Show(); } - public static bool IsOpen - { get { return _MyDebugPrint.IsOpen; } } - private static bool _IncludeWordSecText = true; - public static bool IncludeWordSecText - { - get { return BaselineMetaFile._IncludeWordSecText; } - set { BaselineMetaFile._IncludeWordSecText = value; } - } - } -} diff --git a/PROMS/Volian.Base.Library/ExeInfo.cs b/PROMS/Volian.Base.Library/ExeInfo.cs deleted file mode 100644 index 5d0e6eeb..00000000 --- a/PROMS/Volian.Base.Library/ExeInfo.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Linq; - -namespace Volian.Base.Library -{ - public static class ExeInfo - { - #region Log4Net - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #endregion - public static string GetROEditorPath() - { - string roapp = PROMSExecutableFolderPath() + @"\ROEDITOR.EXE"; - return roapp; - } - - // returns the path to the executable folder - public static string PROMSExecutableFolderPath() - { - string pathPROMSexe = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); - if (pathPROMSexe[7] == ':') // either a local drive or a mapped network drive - pathPROMSexe = pathPROMSexe.Substring(6); - else - pathPROMSexe = @"\" + pathPROMSexe.Substring(5); // non-mapped network drive - need to add extra back slash in front - return pathPROMSexe; - } - - // C2022-030 get the version of PROMSFixes associated with this execuable - public static string GetAssocicatedPROMSFixesVersion() - { - try - { - // Build the path to the PROMSFixes.sql file located in the PROMS exe folder - string pathPROMSFixes = PROMSExecutableFolderPath() + @"\PROMSFixes.sql"; - - // open the PROMSFixes.sql file and grab the line of text containing the PROMSFixes RevDate - // using Linq to open and read the PROMSFixes file - // it returns a list of lines. we look at only the first one (should only be one of these in PROMSFixes) - var lines = from text in File.ReadLines(pathPROMSFixes) - where text.Contains("set @RevDate =") - select new - { - Text = text - }; - var txt = lines.First(); // get the first line of text where "set @RevDate =" was found - string dtstring = txt.Text; // this is the actual text line - // Parse out the date/time text that follows "set @RevDate =" - int idx = dtstring.IndexOf('=') + 3; - dtstring = dtstring.Substring(idx); - dtstring = dtstring.Substring(0, dtstring.IndexOf("'")); - // convert the parsed date/time text string to a DateTime and string format it to yyMM.ddHH like used in Help About - string rtnStr = string.Format("{0:yyMM.ddHH}", DateTime.Parse(dtstring)); - return rtnStr; // return the PROMSFixes version date stored in the PROMSFixes.sql file that's in the PROMS exe folder - } - catch (Exception ex) - { - _MyLog.ErrorFormat("GetAssociatedPROMSFixesVersion - {0}", ex.Message); - return null; // return null to signal that we could not find or parse the PROMSFixes version date - } - } - - } -} diff --git a/PROMS/Volian.Base.Library/FlagEnumEditor.cs b/PROMS/Volian.Base.Library/FlagEnumEditor.cs deleted file mode 100644 index 0caf5736..00000000 --- a/PROMS/Volian.Base.Library/FlagEnumEditor.cs +++ /dev/null @@ -1,277 +0,0 @@ -using System; -using System.Collections; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Windows.Forms; -using System.Drawing.Design; -using System.Windows.Forms.Design; - - -namespace Volian.Base.Library -{ - - public class FlagCheckedListBox : CheckedListBox - { - private System.ComponentModel.Container components = null; - - public FlagCheckedListBox() - { - // This call is required by the Windows.Forms Form Designer. - InitializeComponent(); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - if (components != null) - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - private void InitializeComponent() - { - // - // FlaggedCheckedListBox - // - this.CheckOnClick = true; - - } - #endregion - - // Adds an integer value and its associated description - public FlagCheckedListBoxItem Add(uint v, string c) - { - FlagCheckedListBoxItem item = new FlagCheckedListBoxItem(v, c); - Items.Add(item); - return item; - } - - public FlagCheckedListBoxItem Add(FlagCheckedListBoxItem item) - { - Items.Add(item); - return item; - } - - protected override void OnItemCheck(ItemCheckEventArgs e) - { - base.OnItemCheck(e); - - if (isUpdatingCheckStates) - return; - - // Get the checked/unchecked item - FlagCheckedListBoxItem item = Items[e.Index] as FlagCheckedListBoxItem; - // Update other items - UpdateCheckedItems(item, e.NewValue); - } - - // Checks/Unchecks items depending on the give bitvalue - protected void UpdateCheckedItems(uint value) - { - - isUpdatingCheckStates = true; - - // Iterate over all items - for (int i = 0; i < Items.Count; i++) - { - FlagCheckedListBoxItem item = Items[i] as FlagCheckedListBoxItem; - - if (item.value == 0) - { - SetItemChecked(i, value == 0); - } - else - { - - // If the bit for the current item is on in the bitvalue, check it - if ((item.value & value) == item.value && item.value != 0) - SetItemChecked(i, true); - // Otherwise uncheck it - else - SetItemChecked(i, false); - } - } - - isUpdatingCheckStates = false; - - } - - // Updates items in the checklistbox - // composite = The item that was checked/unchecked - // cs = The check state of that item - protected void UpdateCheckedItems(FlagCheckedListBoxItem composite, CheckState cs) - { - - // If the value of the item is 0, call directly. - if (composite.value == 0) - UpdateCheckedItems(0); - - - // Get the total value of all checked items - uint sum = 0; - for (int i = 0; i < Items.Count; i++) - { - FlagCheckedListBoxItem item = Items[i] as FlagCheckedListBoxItem; - - // If item is checked, add its value to the sum. - if (GetItemChecked(i)) - sum |= item.value; - } - - // If the item has been unchecked, remove its bits from the sum - if (cs == CheckState.Unchecked) - sum = sum & (~composite.value); - // If the item has been checked, combine its bits with the sum - else - sum |= composite.value; - - // Update all items in the checklistbox based on the final bit value - UpdateCheckedItems(sum); - - } - - private bool isUpdatingCheckStates = false; - - // Gets the current bit value corresponding to all checked items - public uint GetCurrentValue() - { - uint sum = 0; - - for (int i = 0; i < Items.Count; i++) - { - FlagCheckedListBoxItem item = Items[i] as FlagCheckedListBoxItem; - - if (GetItemChecked(i)) - sum |= item.value; - } - - return sum; - } - - Type enumType; - Enum enumValue; - - // Adds items to the checklistbox based on the members of the enum - private void FillEnumMembers() - { - foreach (string name in Enum.GetNames(enumType)) - { - object val = Enum.Parse(enumType, name); - uint intVal = (uint)Convert.ChangeType(val, typeof(uint)); - - Add(intVal, name); - } - } - - // Checks/unchecks items based on the current value of the enum variable - private void ApplyEnumValue() - { - uint intVal = (uint)Convert.ChangeType(enumValue, typeof(uint)); - UpdateCheckedItems(intVal); - - } - - [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)] - public Enum EnumValue - { - get - { - object e = Enum.ToObject(enumType, GetCurrentValue()); - return (Enum)e; - } - set - { - - Items.Clear(); - enumValue = value; // Store the current enum value - enumType = value.GetType(); // Store enum type - FillEnumMembers(); // Add items for enum members - ApplyEnumValue(); // Check/uncheck items depending on enum value - - } - } - - - } - - // Represents an item in the checklistbox - public class FlagCheckedListBoxItem - { - public FlagCheckedListBoxItem(uint v, string c) - { - value = v; - caption = c; - } - - public override string ToString() - { - return caption; - } - - // Returns true if the value corresponds to a single bit being set - public bool IsFlag - { - get - { - return ((value & (value - 1)) == 0); - } - } - - // Returns true if this value is a member of the composite bit value - public bool IsMemberFlag(FlagCheckedListBoxItem composite) - { - return (IsFlag && ((value & composite.value) == value)); - } - - public uint value; - public string caption; - } - - - // UITypeEditor for flag enums - public class FlagEnumUIEditor : UITypeEditor - { - // The checklistbox - private FlagCheckedListBox flagEnumCB; - - public FlagEnumUIEditor() - { - flagEnumCB = new FlagCheckedListBox(); - flagEnumCB.BorderStyle = BorderStyle.None; - } - - public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) - { - if (context != null - && context.Instance != null - && provider != null) - { - - IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); - - if (edSvc != null) - { - - Enum e = (Enum)Convert.ChangeType(value, context.PropertyDescriptor.PropertyType); - flagEnumCB.EnumValue = e; - edSvc.DropDownControl(flagEnumCB); - return flagEnumCB.EnumValue; - - } - } - return null; - } - - public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) - { - return UITypeEditorEditStyle.DropDown; - } - - - } - -} diff --git a/PROMS/Volian.Base.Library/FrmPopupStatusMessage.Designer.cs b/PROMS/Volian.Base.Library/FrmPopupStatusMessage.Designer.cs deleted file mode 100644 index eb355a93..00000000 --- a/PROMS/Volian.Base.Library/FrmPopupStatusMessage.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ - -namespace Volian.Base.Library -{ - partial class FrmPopupStatusMessage - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.popMsg = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // popMsg - // - this.popMsg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.popMsg.Location = new System.Drawing.Point(13, 13); - this.popMsg.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.popMsg.Name = "popMsg"; - this.popMsg.Size = new System.Drawing.Size(536, 16); - this.popMsg.TabIndex = 0; - this.popMsg.Text = "label1"; - this.popMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.popMsg.UseWaitCursor = true; - // - // FrmPopupStatusMessage - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.ClientSize = new System.Drawing.Size(562, 38); - this.ControlBox = false; - this.Controls.Add(this.popMsg); - this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FrmPopupStatusMessage"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "FrmPopupStatusMessage"; - this.TopMost = true; - this.UseWaitCursor = true; - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Label popMsg; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Base.Library/FrmPopupStatusMessage.cs b/PROMS/Volian.Base.Library/FrmPopupStatusMessage.cs deleted file mode 100644 index 4894102e..00000000 --- a/PROMS/Volian.Base.Library/FrmPopupStatusMessage.cs +++ /dev/null @@ -1,28 +0,0 @@ -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; - -namespace Volian.Base.Library -{ - public partial class FrmPopupStatusMessage : Form - { - // This creates a simple message box consisting of a title and the message - // The purpose is to allow the coder to pop up brief status message during the running of a method for a 3rd party. - // i.e. this is used when PROMS uses Word to convert to a DOCX file format for PROMS Word sections. - // The message is centered in the message box - we can expand on this class if needed - // The coder uses the Show method to display the message box and Close to remove it - // The user is not prompted for a response. - public FrmPopupStatusMessage(string title, string msg) - { - InitializeComponent(); - Text = title; - popMsg.Text = msg; - } - } -} diff --git a/PROMS/Volian.Base.Library/FrmPopupStatusMessage.resx b/PROMS/Volian.Base.Library/FrmPopupStatusMessage.resx deleted file mode 100644 index 1af7de15..00000000 --- a/PROMS/Volian.Base.Library/FrmPopupStatusMessage.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Base.Library/GenericSerializer.cs b/PROMS/Volian.Base.Library/GenericSerializer.cs deleted file mode 100644 index 107b293d..00000000 --- a/PROMS/Volian.Base.Library/GenericSerializer.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Xml; -using System.Xml.Serialization; -using System.Xml.Schema; - -namespace Volian.Base.Library -{ - public static class GenericSerializer where T : class - { - public static string StringSerialize(T t) - { - string strOutput = string.Empty; - XmlSerializer xs = new XmlSerializer(typeof(T)); - using (MemoryStream ms = new MemoryStream()) - { - xs.Serialize(new NonXsiTextWriter(ms, Encoding.Unicode), t); - //xs.Serialize(ms, t); - ms.Position = 0; - StreamReader sr = new StreamReader(ms); - strOutput = sr.ReadToEnd(); - ms.Close(); - } - return strOutput; - } - public static T StringDeserialize(string s) - { - T t; - string ss = s.Replace("encoding=\"utf-16\"", ""); - XmlSerializer xs = new XmlSerializer(typeof(T)); - UTF8Encoding enc = new UTF8Encoding(); - Byte[] arrBytData = enc.GetBytes(ss); - using (MemoryStream ms = new MemoryStream(arrBytData)) - { - t = (T)xs.Deserialize(ms); - } - return t; - } - //public static void WriteFile(T t, string fileName) - //{ - // string strOutput = string.Empty; - // XmlSerializer xs = new XmlSerializer(typeof(T)); - // using (FileStream fs = new FileStream(fileName, FileMode.Create)) - // { - // xs.Serialize(new NonXsiTextWriter(fs, Encoding.UTF8), t); - // fs.Close(); - // } - //} - //public static T ReadFile(string fileName) - //{ - // T t; - // XmlSerializer xs = new XmlSerializer(typeof(T)); - // using (FileStream fs = new FileStream(fileName, FileMode.Open)) - // { - // t = (T)xs.Deserialize(fs); - // } - // return t; - //} - } - public class NonXsiTextWriter : XmlTextWriter - { - public NonXsiTextWriter(TextWriter w) : base(w) { } - public NonXsiTextWriter(Stream w, Encoding encoding) - : base(w, encoding) - { - this.Formatting = Formatting.Indented; - } - public NonXsiTextWriter(string filename, Encoding encoding) : base(filename, encoding) { } - bool _skip = false; - public override void WriteStartAttribute(string prefix, string localName, string ns) - { - if ((prefix == "xmlns" && (localName == "xsd" || localName == "xsi")) || // Omits XSD and XSI declarations. - ns == XmlSchema.InstanceNamespace) // Omits all XSI attributes. - { - _skip = true; - return; - } - if (localName == "xlink_href") - base.WriteStartAttribute(prefix, "xlink:href", ns); - //else if (localName == "encoding") - // _skip = true; - else - base.WriteStartAttribute(prefix, localName, ns); - } - public override void WriteString(string text) - { - if (_skip) return; - base.WriteString(text); - } - public override void WriteEndAttribute() - { - if (_skip) - { // Reset the flag, so we keep writing. - _skip = false; - return; - } - base.WriteEndAttribute(); - } - } -} diff --git a/PROMS/Volian.Base.Library/PropGridCollEditor.cs b/PROMS/Volian.Base.Library/PropGridCollEditor.cs deleted file mode 100644 index d582b2a4..00000000 --- a/PROMS/Volian.Base.Library/PropGridCollEditor.cs +++ /dev/null @@ -1,301 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Text; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Windows.Forms; -using System.Reflection; - -namespace Volian.Base.Library -{ - // The PropGridCollEditor expands the functionality of the CollectionEditor (the collection editor comes up when in a - // property grid, and the current selected item is a collection, and the user selects the '...'. - public class PropGridCollEditor : CollectionEditor - { - // Define a static event to expose the inner PropertyGrid's - // PropertyValueChanged event args... - public delegate void MyPropertyValueChangedEventHandler(object sender, PropertyValueChangedEventArgs e); - public static event MyPropertyValueChangedEventHandler MyPropertyValueChanged; - private bool AllowAddDel = false; // flags whether the Add/Delete buttons should be displayed: - // Inherit the default constructor from the standard - // Collection Editor... - private Type _origType; - public PropGridCollEditor(Type type) - : base(type) - { - AllowAddDel = false; - _origType = type; - if (type.Name == "ReplaceStrData") AllowAddDel = true; // Defaults to not having the 'Add' & 'Remove' buttons. - } - - protected override Type CreateCollectionItemType() - { - return base.CreateCollectionItemType(); - } - private Button resetbtn = null; - // Override this method in order to access the containing user controls - // from the default Collection Editor form or to add new ones... - protected override CollectionForm CreateCollectionForm() - { - // Getting the default layout of the Collection Editor... - CollectionForm collectionForm = base.CreateCollectionForm(); - - Form frmCollectionEditorForm = collectionForm as Form; - - // The Add/Remove buttons are made invisible: - if (!AllowAddDel) HideAddRemoveButtons(0, frmCollectionEditorForm); - Button okbtn = FindOkButton(frmCollectionEditorForm); - - if (!AllowAddDel) - { - // add a reset button and put next to ok button: - resetbtn = new Button(); - resetbtn.Text = "Reset"; - resetbtn.Location = new System.Drawing.Point(okbtn.Location.X - 20, okbtn.Location.Y); - resetbtn.Width = 250; - resetbtn.Visible = true; - resetbtn.Enabled = false; // only enabled on data change - resetbtn.Click += resetbtn_Click; - okbtn.Parent.Controls.Add(resetbtn); - } - SetMembersLabel(collectionForm); - TableLayoutPanel tlpLayout = frmCollectionEditorForm.Controls[0] as TableLayoutPanel; - if (tlpLayout != null) - { - // Get a reference to the inner PropertyGrid and hook an event handler to it. - if (tlpLayout.Controls[5] is PropertyGrid) - { - propertyGrid = tlpLayout.Controls[5] as PropertyGrid; - propertyGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(propertyGrid_PropertyValueChanged); - propertyGrid.SelectedGridItemChanged += PG_SelectedGridItemChanged; - } - } - - return collectionForm; - } - - // when the reset button is clicked the data will be reset to the data from the original format file. Note that if - // data is added to the UCF that is part of a collection, code will need to be added here to reset the value. - void resetbtn_Click(object sender, EventArgs e) - { - resetbtn.Text = "Reset"; - resetbtn.Enabled = false; - if (SelectedGridField.Contains("Left Margin")) - ResetValue(propertyGrid.SelectedGridItem.Parent.Value, "LeftMargin"); - else if (SelectedGridField.Contains("Page Length")) - ResetValue(propertyGrid.SelectedGridItem.Parent.Value, "PageLength"); - else if (SelectedGridField.Contains("WindowsFont")) - ResetValue(propertyGrid.SelectedGridItem.Parent.Value, "WindowsFont"); - // B2019-100: for headers, use Parent's parent and also for both header & checkoffs the field name is 'Active' (not 'Inactive') - else if (SelectedGridField.Contains("Active CheckOff Header")) - ResetValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active"); - else if (SelectedGridField.Contains("Active CheckOff")) - ResetValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active"); - } - private void ShowReflection(Object data) - { - if (data == null) return; - //Object data = new A(); - FieldInfo[] fields = data.GetType().GetFields(BindingFlags.Public | - BindingFlags.NonPublic | - BindingFlags.Instance); - String str = ""; - foreach (FieldInfo f in fields) - { - str += f.Name + " = " + f.GetValue(data) + "\r\n"; - } - Console.WriteLine("reflection = {0}", str); - } - PropertyGrid propertyGrid = null; - private string SelectedGridField = ""; - // The following method is used to enable and set text on the 'Reset' button. When a grid item is selected, if it has - // UCF data, then put the original value as part of the button text & enable it: - void PG_SelectedGridItemChanged(object sender, SelectedGridItemChangedEventArgs e) - { - if (resetbtn == null) return; - if (propertyGrid != null) Console.WriteLine(LabelPath(propertyGrid.SelectedGridItem)); // PG.SelectedGridItem.Label + " : " + PG.SelectedGridItem.Value; - // see if data has changed, and if so, enable the Reset button. - bool enabled = false; - resetbtn.Text = "Reset"; - SelectedGridField = LabelPath(propertyGrid.SelectedGridItem); - if (SelectedGridField.Contains("WindowsFont")) - { - string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "WindowsFont"); - if (origForButton != null) - { - resetbtn.Text = "Reset to " + origForButton; - enabled = true; - } - } - else if (SelectedGridField.Contains("Left Margin")) - { - string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "LeftMargin"); - if (origForButton != null) - { - resetbtn.Text = "Reset to " + origForButton; - enabled = true; - } - } - else if (SelectedGridField.Contains("Page Length")) - { - string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "PageLength"); - if (origForButton != null) - { - resetbtn.Text = "Reset to " + origForButton; - enabled = true; - } - } - else if (SelectedGridField.Contains("Active CheckOff Header")) - { - string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active"); - if (origForButton != null) - { - resetbtn.Text = "Reset to " + origForButton; - enabled = true; - } - } - else if (SelectedGridField.Contains("Active CheckOff")) - { - string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active"); - if (origForButton != null) - { - resetbtn.Text = "Reset to " + origForButton; - enabled = true; - } - } - else enabled = false; - - resetbtn.Enabled = enabled; - } - // This code,using data reflection, will determine the if there is UCF (changed) data, and if so - // will return its value as a string for concatenation of Reset button text. - private string OrigValue(object data, string fieldName) - { - FieldInfo fldVal = null; - FieldInfo fldOrig = null; - if (data == null) return null; - FieldInfo[] fields = data.GetType().GetFields(BindingFlags.Public | - BindingFlags.NonPublic | - BindingFlags.Instance); - // Go through the fields in the data structure, looking to match that passed in. Also look for the original - // field to compare the 2 to see if a change was made, i.e. UCF data exists. - foreach (FieldInfo f in fields) - { - if (f.Name == "_" + fieldName) fldVal = f; - if (f.Name == "_Orig" + fieldName) fldOrig = f; - } - if (fldVal != null && fldOrig != null) - { - try - { - // see if values are different: - string orig = fldOrig.GetValue(data).ToString(); - string newv = fldVal.GetValue(data).ToString(); - string retval = fldOrig.GetValue(data).ToString(); - if (retval.StartsWith("[Font:")) - { - retval = retval.Replace("[Font: Name=", "").Replace(", Size=", ","); - } - if (orig != newv) return retval; - else return null; - } - catch (Exception ex) - { - return null; - } - } - return null; - } - // The following Resets the format variable's value from the original format (as stored in the 'OrigXXX' field in FormatConfig - private void ResetValue(object data, string fieldName) - { - FieldInfo fldVal = null; - FieldInfo fldOrig = null; - if (data == null) return; - FieldInfo[] fields = data.GetType().GetFields(BindingFlags.Public | - BindingFlags.NonPublic | - BindingFlags.Instance); - foreach (FieldInfo f in fields) - { - if (f.Name == "_" + fieldName) fldVal = f; - if (f.Name == "_Orig" + fieldName) fldOrig = f; - } - if (fldVal != null && fldOrig != null) - { - fldVal.SetValue(data, fldOrig.GetValue(data)); - propertyGrid.Refresh(); - } - } - // Remove this on release, and any uses of it. - private string LabelPath(GridItem gi) - { - return (gi.Parent == null ? "" : LabelPath(gi.Parent) + ":" + gi.Label); - } - - // set the 'members' label to better reflect what is displayed: - private bool SetMembersLabel(Control myControl) - { - if (myControl is Label && myControl.Text.ToUpper().Contains("MEMBER")) - { - string dt = myControl.TopLevelControl.Text; - if (dt.ToUpper().Contains("DOCSTYL")) myControl.Text = "Section Types"; - else if (dt.ToUpper().Contains("REPLACE")) myControl.Text = "Replace Words"; - else if (dt.ToUpper().Contains("CHECKOFFHEADER")) myControl.Text = "CheckOff Headers"; - else if (dt.ToUpper().Contains("CHECKOFF")) myControl.Text = "CheckOffs"; - else if (dt.ToUpper().Contains("STEP")) myControl.Text = "Steps"; - return true; - } - if (myControl.Controls != null && myControl.Controls.Count > 0) - { - foreach (Control con in myControl.Controls) - { - bool found = SetMembersLabel(con); - if (found == true) return true; - } - } - return false; - } - // This code looks for the 'OK' button, so that the 'Reset' button can be placed by it. - private Button FindOkButton(Control myControl) - { - if (myControl is Button && myControl.Text == "OK") - { - return myControl as Button; - } - if (myControl.Controls != null && myControl.Controls.Count > 0) - { - foreach (Control con in myControl.Controls) - { - Button found = FindOkButton(con); - if (found != null) return found; - } - } - return null; - } - - // Find the 'Add' & 'Remove' buttons based on their text, and then make invisible. - private void HideAddRemoveButtons(int level, Control myControl) - { - if (myControl.Text == "&Add" || myControl.Text == "&Remove") - { - myControl.Visible = false; - return; - } - if (myControl.Controls != null && myControl.Controls.Count > 0) - { - foreach (Control con in myControl.Controls) - HideAddRemoveButtons(level + 1, con); - } - } - - void propertyGrid_PropertyValueChanged(object sender, PropertyValueChangedEventArgs e) - { - // Fire our customized collection event... - if (PropGridCollEditor.MyPropertyValueChanged != null) - { - PropGridCollEditor.MyPropertyValueChanged(this, e); - } - } - } -} diff --git a/PROMS/Volian.Base.Library/Properties/AssemblyInfo.cs b/PROMS/Volian.Base.Library/Properties/AssemblyInfo.cs deleted file mode 100644 index c7bb2ad3..00000000 --- a/PROMS/Volian.Base.Library/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Volian.Base.Library")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Volian.Base.Library")] -[assembly: AssemblyCopyright("Copyright © 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("6de1141c-643a-40dd-b296-06eeff462603")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PROMS/Volian.Base.Library/RTBAPI.cs b/PROMS/Volian.Base.Library/RTBAPI.cs deleted file mode 100644 index c88aecf9..00000000 --- a/PROMS/Volian.Base.Library/RTBAPI.cs +++ /dev/null @@ -1,1110 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Drawing; -using System.Runtime.InteropServices; -using System.ComponentModel; -using Volian.Base.Library; - -namespace Volian.Base.Library -{ - public static class RTBAPI - { - #region SendMessage - [DllImport("user32.dll", SetLastError = true)] - private static extern int SendMessage(HandleRef hWndlock, Messages wMsg, Int32 wParam, ref Point pt); - [DllImport("user32.dll", SetLastError = true)] - private static extern int SendMessage(HandleRef hWndlock, Messages wMsg, Int32 wParam, int lParam); - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern int SendMessage(HandleRef hWndlock, Messages wMsg, RTBSelection wParam, ref CharFormat2 cf2); - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern int SendMessage(HandleRef hWndlock, Messages wMsg, int wParam, ref ParaFormat2 pf2); - [DllImport("user32.dll", SetLastError = true)] - private static extern int GetWindowLong (IntPtr hWin, int index); - #region RTB Messages - // EM_AUTOURLDETECT - An EM_AUTOURLDETECT message enables or disables automatic detection of URLs by a rich edit control. - // EM_CANPASTE - The EM_CANPASTE message determines whether a rich edit control can paste a specified clipboard format. - // EM_CANREDO - The EM_CANREDO message determines whether there are any actions in the control redo queue. - // EM_DISPLAYBAND - The EM_DISPLAYBAND message displays a portion of the contents of a rich edit control, as previously formatted for a device using the EM_FORMATRANGE message. - // EM_EXGETSEL - The EM_EXGETSEL message retrieves the starting and ending character positions of the selection in a rich edit control. - // EM_EXLIMITTEXT - The EM_EXLIMITTEXT message sets an upper limit to the amount of text the user can type or paste into a rich edit control. - // EM_EXLINEFROMCHAR - The EM_EXLINEFROMCHAR message determines which line contains the specified character in a rich edit control. - // EM_EXSETSEL - The EM_EXSETSEL message selects a range of characters or COM objects in a Rich Edit control. - // EM_FINDTEXT - The EM_FINDTEXT message finds text within a rich edit control. - // EM_FINDTEXTEX - The EM_FINDTEXTEX message finds text within a rich edit control. - // EM_FINDTEXTEXW - The EM_FINDTEXTEXW message finds Unicode text within a rich edit control. - // EM_FINDTEXTW - The EM_FINDTEXTW message finds Unicode text within a rich edit control. - // EM_FINDWORDBREAK - The EM_FINDWORDBREAK message finds the next word break before or after the specified character position or retrieves information about the character at that position. - // EM_FORMATRANGE - The EM_FORMATRANGE message formats a range of text in a rich edit control for a specific device. - // EM_GETAUTOURLDETECT - The EM_GETAUTOURLDETECT message indicates whether the auto URL detection is turned on in the rich edit control. - // EM_GETBIDIOPTIONS - The EM_GETBIDIOPTIONS message indicates the current state of the bidirectional options in the rich edit control. - // EM_GETCHARFORMAT - The EM_GETCHARFORMAT message determines the character formatting in a rich edit control. - // EM_GETCTFMODEBIAS - An application sends a EM_GETCTFMODEBIAS message to get the Text Services Framework mode bias values for a Rich Edit control. - // EM_GETCTFOPENSTATUS - An application sends an EM_GETCTFOPENSTATUS message to determine if the Text Services Framework (TSF) keyboard is open or closed. - // EM_GETEDITSTYLE - The EM_GETEDITSTYLE message retrieves the current edit style flags. - // EM_GETEVENTMASK - The EM_GETEVENTMASK message retrieves the event mask for a rich edit control. The event mask specifies which notification messages the control sends to its parent window. - // EM_GETHYPHENATEINFO - An application sends an EM_GETHYPHENATEINFO message to get information about hyphenation for a Rich Edit control. - // EM_GETIMECOLOR - The EM_GETIMECOLOR message retrieves the Input Method Editor (IME) composition color. This message is available only in Asian-language versions of the operating system. - // EM_GETIMECOMPMODE - An application sends an EM_GETIMECOMPMODE message to get the current IME mode for a rich edit control. - // EM_GETIMECOMPTEXT - An application sends an EM_GETIMECOMPTEXT message to get the IME composition text. - // EM_GETIMEMODEBIAS - An application sends an EM_GETIMEMODEBIAS message to get the IME mode bias for a Rich Edit control. - // EM_GETIMEOPTIONS - The EM_GETIMEOPTIONS message retrieves the current IME options. This message is available only in Asian-language versions of the operating system. - // EM_GETIMEPROPERTY - An application sends a EM_GETIMEPROPERTY message to get the property and capabilities of the IME associated with the current input locale. - // EM_GETLANGOPTIONS - An application sends an EM_GETLANGOPTIONS message to get a rich edit control's option settings for IME and Asian language support. - // EM_GETOLEINTERFACE - The EM_GETOLEINTERFACE message retrieves an IRichEditOle object that a client can use to access a rich edit control's COM functionality. - // EM_GETOPTIONS - The EM_GETOPTIONS message retrieves rich edit control options. - // EM_GETPAGEROTATE - Deprecated. An application sends an EM_GETPAGEROTATE message to get the text layout for a Rich Edit control. - // EM_GETPARAFORMAT - The EM_GETPARAFORMAT message retrieves the paragraph formatting of the current selection in a rich edit control. - // EM_GETPUNCTUATION - The EM_GETPUNCTUATION message gets the current punctuation characters for the rich edit control. This message is available only in Asian-language versions of the operating system. - // EM_GETREDONAME - An application sends an EM_GETREDONAME message to a rich edit control to retrieve the type of the next action, if any, in the control's redo queue. - // EM_GETSCROLLPOS - An application sends an EM_GETSCROLLPOS message to obtain the current scroll position of the edit control. - // EM_GETSELTEXT - The EM_GETSELTEXT message retrieves the currently selected text in a rich edit control. - // EM_GETTEXTEX - The EM_GETTEXTEX message allows you to get all of the text from the rich edit control in any particular code base you want. - // EM_GETTEXTLENGTHEX - The EM_GETTEXTLENGTHEX message calculates text length in various ways. It is usually called before creating a buffer to receive the text from the control. - // EM_GETTEXTMODE - An application sends an EM_GETTEXTMODE message to get the current text mode and undo level of a rich edit control. - // EM_GETTEXTRANGE - The EM_GETTEXTRANGE message retrieves a specified range of characters from a rich edit control. - // EM_GETTYPOGRAPHYOPTIONS - The EM_GETTYPOGRAPHYOPTIONS message returns the current state of the typography options of a rich edit control. - // EM_GETUNDONAME - Rich Edit 2.0 and later: An application sends an EM_GETUNDONAME message to a rich edit control to retrieve the type of the next undo action, if any. - // EM_GETWORDBREAKPROCEX - The EM_GETWORDBREAKPROCEX message retrieves the address of the currently registered extended word-break procedure. - // EM_GETWORDWRAPMODE - The EM_GETWORDWRAPMODE message gets the current word wrap and word-break options for the rich edit control. This message is available only in Asian-language versions of the operating system. - // EM_GETZOOM - The EM_GETZOOM message gets the current zoom ratio, which is always between 1/64 and 64. - // EM_HIDESELECTION - The EM_HIDESELECTION message hides or shows the selection in a rich edit control. - // EM_ISIME - An application sends a EM_ISIME message to determine if current input locale is an East Asian locale. - // EM_PASTESPECIAL - The EM_PASTESPECIAL message pastes a specific clipboard format in a rich edit control. - // EM_RECONVERSION - The EM_RECONVERSION message invokes the IME reconversion dialog box. - // EM_REDO - Send an EM_REDO message to a rich edit control to redo the next action in the control's redo queue. - // EM_REQUESTRESIZE - The EM_REQUESTRESIZE message forces a rich edit control to send an EN_REQUESTRESIZE notification message to its parent window. - // EM_SELECTIONTYPE - The EM_SELECTIONTYPE message determines the selection type for a rich edit control. - // EM_SETBIDIOPTIONS - The EM_SETBIDIOPTIONS message sets the current state of the bidirectional options in the rich edit control. - // EM_SETBKGNDCOLOR - The EM_SETBKGNDCOLOR message sets the background color for a rich edit control. - // EM_SETCHARFORMAT - The EM_SETCHARFORMAT message sets character formatting in a rich edit control. - // EM_SETCTFMODEBIAS - An application sends an EM_SETCTFMODEBIAS message to set the Text Services Framework (TSF) mode bias for a Rich Edit control. - // EM_SETCTFOPENSTATUS - An application sends an EM_SETCTFOPENSTATUS message to open or close the Text Services Framework (TSF) keyboard. - // EM_SETEDITSTYLE - The EM_SETEDITSTYLE message sets the current edit style flags. - // EM_SETEVENTMASK - The EM_SETEVENTMASK message sets the event mask for a rich edit control. The event mask specifies which notification messages the control sends to its parent window. - // EM_SETFONTSIZE - The EM_SETFONTSIZE message sets the font size for the selected text. - // EM_SETHYPHENATEINFO - An application sends an EM_SETHYPHENATEINFO message to set the way a Rich Edit control does hyphenation. - // EM_SETIMECOLOR - The EM_SETIMECOLOR message sets the IME composition color. This message is available only in Asian-language versions of the operating system. - // EM_SETIMEMODEBIAS - An application sends an EM_SETIMEMODEBIAS message to set the IME mode bias for a Rich Edit control. - // EM_SETIMEOPTIONS - The EM_SETIMEOPTIONS message sets the IME options. This message is available only in Asian-language versions of the operating system. - // EM_SETLANGOPTIONS - An application sends an EM_SETLANGOPTIONS message to set options for IME and Asian language support in a rich edit control. - // EM_SETOLECALLBACK - The EM_SETOLECALLBACK message gives a rich edit control an IRichEditOleCallback object that the control uses to get OLE-related resources and information from the client. - // EM_SETOPTIONS - The EM_SETOPTIONS message sets the options for a rich edit control. - // EM_SETPAGEROTATE - Deprecated. An application sends an EM_SETPAGEROTATE message to set the text layout for a Rich Edit control. - // EM_SETPALETTE - An application sends an EM_SETPALETTE message to change the palette that rich edit uses for its display window. - // EM_SETPARAFORMAT - The EM_SETPARAFORMAT message sets the paragraph formatting for the current selection in a rich edit control. - // EM_SETPUNCTUATION - The EM_SETPUNCTUATION message sets the punctuation characters for a rich edit control. This message is available only in Asian-language versions of the operating system. - // EM_SETSCROLLPOS - An application sends an EM_SETSCROLLPOS message to tell the rich edit control to scroll to a particular point. - // EM_SETTARGETDEVICE - The EM_SETTARGETDEVICE message sets the target device and line width used for "what you see is what you get" (WYSIWYG) formatting in a rich edit control. - // EM_SETTEXTEX - The EM_SETTEXTEX message combines the functionality of WM_SETTEXT and EM_REPLACESEL and adds the ability to set text using a code page and to use either rich text or plain text. - // EM_SETTEXTMODE - An application sends an EM_SETTEXTMODE message to set the text mode or undo level of a rich edit control. The message fails if the control contains any text. - // EM_SETTYPOGRAPHYOPTIONS - The EM_SETTYPOGRAPHYOPTIONS message sets the current state of the typography options of a rich edit control. - // EM_SETUNDOLIMIT - An application sends an EM_SETUNDOLIMIT message to a rich edit control to set the maximum number of actions that can stored in the undo queue. - // EM_SETWORDBREAKPROCEX - The EM_SETWORDBREAKPROCEX message sets the extended word-break procedure. - // EM_SETWORDWRAPMODE - The EM_SETWORDWRAPMODE message sets the word-wrapping and word-breaking options for the rich edit control. This message is available only in Asian-language versions of the operating system. - // EM_SETZOOM - The EM_SETZOOM message sets the zoom ratio anywhere between 1/64 and 64. - // EM_SHOWSCROLLBAR - The EM_SHOWSCROLLBAR message shows or hides one of the scroll bars in the Text Host window. - // EM_STOPGROUPTYPING - An application sends an EM_STOPGROUPTYPING message to a rich edit control to stop the control from collecting additional typing actions into the current undo action. The control stores the next typing action, if any, into a new action in the undo queue. - // EM_STREAMIN - The EM_STREAMIN message replaces the contents of a rich edit control with a stream of data provided by an application defined - // EM_STREAMOUT - The EM_STREAMOUT message causes a rich edit control to pass its contents to an application - #endregion - #endregion - #region Constants - //const int ECOOP_XOR = 0x0004; - - //const int ECO_AUTOWORDSELECTION = 0x00000001; - - - const int WM_USER = 0x0400; - const int GWL_STYLE = -16; - const int WS_HSCROLL = 0x100000; - const int WS_VSCROLL = 0x200000; - - #endregion - #region Enums - public enum Messages : int - { - EM_AUTOURLDETECT = WM_USER + 91, - EM_CANPASTE = WM_USER + 50, - EM_CANREDO = WM_USER + 85, - EM_DISPLAYBAND = WM_USER + 51, - EM_EXGETSEL = WM_USER + 52, - EM_EXLIMITTEXT = WM_USER + 53, - EM_EXLINEFROMCHAR = WM_USER + 54, - EM_EXSETSEL = WM_USER + 55, - EM_FINDTEXT = WM_USER + 56, - EM_FINDTEXTEX = WM_USER + 79, - EM_FINDTEXTEXW = WM_USER + 124, - EM_FINDTEXTW = WM_USER + 123, - EM_FINDWORDBREAK = WM_USER + 76, - EM_FORMATRANGE = WM_USER + 57, - EM_GETAUTOURLDETECT = WM_USER + 92, - EM_GETBIDIOPTIONS = WM_USER + 201, - EM_GETCHARFORMAT = WM_USER + 58, - EM_GETCTFMODEBIAS = WM_USER + 237, - EM_GETCTFOPENSTATUS = WM_USER + 240, - EM_GETEDITSTYLE = WM_USER + 205, - EM_GETEVENTMASK = WM_USER + 59, - EM_GETHYPHENATEINFO = WM_USER + 230, - EM_GETIMECOLOR = WM_USER + 105, - EM_GETIMECOMPMODE = WM_USER + 122, - EM_GETIMECOMPTEXT = WM_USER + 242, - EM_GETIMEMODEBIAS = WM_USER + 127, - EM_GETIMEOPTIONS = WM_USER + 107, - EM_GETIMEPROPERTY = WM_USER + 244, - EM_GETLANGOPTIONS = WM_USER + 121, - EM_GETOLEINTERFACE = WM_USER + 60, - EM_GETOPTIONS = WM_USER + 78, - EM_GETPAGEROTATE = WM_USER + 235, - EM_GETPARAFORMAT = WM_USER + 61, - EM_GETPUNCTUATION = WM_USER + 101, - EM_GETREDONAME = WM_USER + 87, - EM_GETSCROLLPOS = WM_USER + 221, - EM_GETSELTEXT = WM_USER + 62, - EM_GETTEXTEX = WM_USER + 94, - EM_GETTEXTLENGTHEX = WM_USER + 95, - EM_GETTEXTMODE = WM_USER + 90, - EM_GETTEXTRANGE = WM_USER + 75, - EM_GETTYPOGRAPHYOPTIONS = WM_USER + 203, - EM_GETUNDONAME = WM_USER + 86, - EM_GETWORDBREAKPROCEX = WM_USER + 80, - EM_GETWORDWRAPMODE = WM_USER + 103, - EM_GETZOOM = WM_USER + 224, - EM_HIDESELECTION = WM_USER + 63, - EM_ISIME = WM_USER + 243, - EM_PASTESPECIAL = WM_USER + 64, - EM_RECONVERSION = WM_USER + 125, - EM_REDO = WM_USER + 84, - EM_REQUESTRESIZE = WM_USER + 65, - EM_SELECTIONTYPE = WM_USER + 66, - EM_SETBIDIOPTIONS = WM_USER + 200, - EM_SETBKGNDCOLOR = WM_USER + 67, - EM_SETCHARFORMAT = WM_USER + 68, - EM_SETCTFMODEBIAS = WM_USER + 238, - EM_SETCTFOPENSTATUS = WM_USER + 241, - EM_SETEDITSTYLE = WM_USER + 204, - EM_SETEVENTMASK = WM_USER + 69, - EM_SETFONTSIZE = WM_USER + 223, - EM_SETHYPHENATEINFO = WM_USER + 231, - EM_SETIMECOLOR = WM_USER + 104, - EM_SETIMEMODEBIAS = WM_USER + 126, - EM_SETIMEOPTIONS = WM_USER + 106, - EM_SETLANGOPTIONS = WM_USER + 120, - EM_SETOLECALLBACK = WM_USER + 70, - EM_SETOPTIONS = WM_USER + 77, - EM_SETPAGEROTATE = WM_USER + 236, - EM_SETPALETTE = WM_USER + 93, - EM_SETPARAFORMAT = WM_USER + 71, - EM_SETPUNCTUATION = WM_USER + 100, - EM_SETSCROLLPOS = WM_USER + 222, - EM_SETTARGETDEVICE = WM_USER + 72, - EM_SETTEXTEX = WM_USER + 97, - EM_SETTEXTMODE = WM_USER + 89, - EM_SETTYPOGRAPHYOPTIONS = WM_USER + 202, - EM_SETUNDOLIMIT = WM_USER + 82, - EM_SETWORDBREAKPROCEX = WM_USER + 81, - EM_SETWORDWRAPMODE = WM_USER + 102, - EM_SETZOOM = WM_USER + 225, - EM_SHOWSCROLLBAR = WM_USER + 96, - EM_STOPGROUPTYPING = WM_USER + 88, - EM_STREAMIN = WM_USER + 73, - EM_STREAMOUT = WM_USER + 74 - }; - [Flags] - public enum LanguageOptions : int // Options for EM_SETLANGOPTIONS and EM_GETLANGOPTIONS - { - IMF_AUTOKEYBOARD = 0x0001, - IMF_AUTOFONT = 0x0002, - IMF_IMECANCELCOMPLETE = 0x0004, // high completes the comp string when aborting, low cancels. - IMF_IMEALWAYSSENDNOTIFY = 0x0008 - } - public enum TimeCompMode : int // Values for EM_GETIMECOMPMODE - { - ICM_NOTOPEN = 0x0000, - ICM_LEVEL3 = 0x0001, - ICM_LEVEL2 = 0x0002, - ICM_LEVEL2_5 = 0x0003, - ICM_LEVEL2_SUI = 0x0004 - } - [Flags] - public enum EditControlOptions : int // Edit control options - { - ECO_AUTOWORDSELECTION = 0x00000001, - ECO_AUTOVSCROLL = 0x00000040, - ECO_AUTOHSCROLL = 0x00000080, - ECO_NOHIDESEL = 0x00000100, - ECO_READONLY = 0x00000800, - ECO_WANTRETURN = 0x00001000, - ECO_SAVESEL = 0x00008000, - ECO_SELECTIONBAR = 0x01000000, - ECO_VERTICAL = 0x00400000, // FE specific - } - public enum EcoOperations : int // ECO operations - { - ECOOP_SET = 0x0001, - ECOOP_OR = 0x0002, - ECOOP_AND = 0x0003, - ECOOP_XOR = 0x0004 - } - public enum WordBreakFunctionActions : int // new word break function actions - { - WB_CLASSIFY = 3, - WB_MOVEWORDLEFT = 4, - WB_MOVEWORDRIGHT = 5, - WB_LEFTBREAK = 6, - WB_RIGHTBREAK = 7 - } - //#define PC_FOLLOWING 1 - //#define PC_LEADING 2 - //#define PC_OVERFLOW 3 - //#define PC_DELIMITER 4 - //#define WBF_WORDWRAP 0x010 - //#define WBF_WORDBREAK 0x020 - //#define WBF_OVERFLOW 0x040 - //#define WBF_LEVEL1 0x080 - //#define WBF_LEVEL2 0x100 - //#define WBF_CUSTOM 0x200 - /* Word break flags (used with WB_CLASSIFY) */ - //#define WBF_CLASS ((BYTE) 0x0F) - //#define WBF_ISWHITE ((BYTE) 0x10) - //#define WBF_BREAKLINE ((BYTE) 0x20) - //#define WBF_BREAKAFTER ((BYTE) 0x40) - ///* Far East specific flags */ - //#define IMF_FORCENONE 0x0001 - //#define IMF_FORCEENABLE 0x0002 - //#define IMF_FORCEDISABLE 0x0004 - //#define IMF_CLOSESTATUSWINDOW 0x0008 - //#define IMF_VERTICAL 0x0020 - //#define IMF_FORCEACTIVE 0x0040 - //#define IMF_FORCEINACTIVE 0x0080 - //#define IMF_FORCEREMEMBER 0x0100 - //#define IMF_MULTIPLEEDIT 0x0400 - public enum RTBSelection : int - { - SCF_DEFAULT = 0x0000, - SCF_SELECTION = 0x0001, - SCF_WORD = 0x0002, - SCF_ALL = 0x0004, - SCF_USEUIRULES = 0x0008 - } - [Flags] - public enum CharFormatMasks : uint - { - CFM_NONE = 0, - CFM_BOLD = 0x00000001, - CFM_ITALIC = 0x00000002, - CFM_UNDERLINE = 0x00000004, - CFM_STRIKEOUT = 0x00000008, - CFM_PROTECTED = 0x00000010, - CFM_LINK = 0x00000020, // Exchange hyperlink extension - CFM_SIZE = 0x80000000, - CFM_COLOR = 0x40000000, - CFM_FACE = 0x20000000, - CFM_OFFSET = 0x10000000, - CFM_CHARSET = 0x08000000, - CFM_SMALLCAPS = 0x0040, - CFM_ALLCAPS = 0x0080, - CFM_HIDDEN = 0x0100, - CFM_OUTLINE = 0x0200, - CFM_SHADOW = 0x0400, - CFM_EMBOSS = 0x0800, - CFM_IMPRINT = 0x1000, - CFM_DISABLED = 0x2000, - CFM_REVISED = 0x4000, - CFM_BACKCOLOR = 0x04000000, - CFM_LCID = 0x02000000, - CFM_UNDERLINETYPE = 0x00800000, - CFM_WEIGHT = 0x00400000, - CFM_SPACING = 0x00200000, - CFM_KERNING = 0x00100000, - CFM_STYLE = 0x00080000, - CFM_ANIMATION = 0x00040000, - CFM_REVAUTHOR = 0x00008000, - CFM_SUBSCRIPT = 0x00010000, - CFM_SUPERSCRIPT = 0x00020000 - // CFM_SUBorSUPERSCRIPT = 0x00030000 - } - [Flags] - public enum CharFormatEffects : uint - { - CFE_NONE = 0, - CFE_BOLD = 0x0001, - CFE_ITALIC = 0x0002, - CFE_UNDERLINE = 0x0004, - CFE_STRIKEOUT = 0x0008, - CFE_PROTECTED = 0x0010, - CFE_LINK = 0x0020, - CFE_AUTOBACKCOLOR = 0x04000000, // NOTE: this corresponds to CFM_BACKCOLOR, which controls it - CFE_AUTOCOLOR = 0x40000000, // NOTE: this corresponds to CFM_COLOR, which controls it - CFE_SUBSCRIPT = 0x00010000, // Superscript and subscript are - CFE_SUPERSCRIPT = 0x00020000, // mutually exclusive - CFE_SMALLCAPS = 0x0040, - CFE_ALLCAPS = 0x0080, - CFE_HIDDEN = 0x0100, - CFE_OUTLINE = 0x0200, - CFE_SHADOW = 0x0400, - CFE_EMBOSS = 0x0800, - CFE_IMPRINT = 0x1000, - CFE_DISABLED = 0x2000, - CFE_REVISED = 0x4000 - } - public enum CharUnderline : byte - { - CFU_UNDERLINENONE = 0, - CFU_UNDERLINE = 1, - CFU_UNDERLINEWORD = 2, // displayed as ordinary underline - CFU_UNDERLINEDOUBLE = 3, // displayed as ordinary underline - CFU_UNDERLINEDOTTED = 4, - CFU_UNDERLINEDASH = 5, - CFU_UNDERLINEDASHDOT = 6, - CFU_UNDERLINEDASHDOTDOT = 7, - CFU_UNDERLINEWAVE = 8, - CFU_UNDERLINETHICK = 9, - CFU_INVERT = 0xFE // For IME composition fake a selection. - } - [Flags] - public enum ParaFormatMasks : uint - { - PFM_NONE = 0, - PFM_STARTINDENT = 0x00000001, - PFM_RIGHTINDENT = 0x00000002, - PFM_OFFSET = 0x00000004, - PFM_ALIGNMENT = 0x00000008, - PFM_TABSTOPS = 0x00000010, - PFM_NUMBERING = 0x00000020, - PFM_SPACEBEFORE = 0x00000040, - PFM_SPACEAFTER = 0x00000080, - PFM_LINESPACING = 0x00000100, - PFM_RESERVED = 0x00000200, - PFM_STYLE = 0x00000400, - PFM_BORDER = 0x00000800, - PFM_SHADING = 0x00001000, - PFM_NUMBERINGSTYLE = 0x00002000, - PFM_NUMBERINGTAB = 0x00004000, - PFM_NUMBERINGSTART = 0x00008000, - // PFM_DIR = 0x00010000, - PFM_RTLPARA = 0x00010000, - PFM_KEEP = 0x00020000, - PFM_KEEPNEXT = 0x00040000, - PFM_PAGEBREAKBEFORE = 0x00080000, - PFM_NOLINENUMBER = 0x00100000, - PFM_NOWIDOWCONTROL = 0x00200000, - PFM_DONOTHYPHEN = 0x00400000, - PFM_SIDEBYSIDE = 0x00800000, - PFM_TABLEROWDELIMITER = 0x10000000, - PFM_TEXTWRAPPINGBREAK = 0x20000000, - PFM_TABLE = 0x40000000, - PFM_OFFSETINDENT = 0x80000000 - } - public enum ParaFormatEffects : ushort - { - PFE_RTLPARA = 0x0001, - PFE_KEEP = 0x0002, - PFE_KEEPNEXT = 0x0004, - PFE_PAGEBREAKBEFORE = 0x0008, - PFE_NOLINENUMBER = 0x0010, - PFE_NOWIDOWCONTROL = 0x0020, - PFE_DONOTHYPHEN = 0x0040, - PFE_SIDEBYSIDE = 0x0080, - PFE_TABLEROW = 0xc000, /* These 3 options are mutually */ - PFE_TABLECELLEND = 0x8000, /* exclusive and each imply */ - PFE_TABLECELL = 0x4000, /* that para is part of a table*/ - } - public enum ParaAlignment : ushort - { - PFA_LEFT = 1, - PFA_RIGHT = 2, - PFA_CENTER = 3, - PFA_JUSTIFY = 4, - PFA_FULL_INTERWORD = 5 - } - public enum ParaNumbering : ushort - { - PFN_NONE = 0, - PFN_BULLET = 1, - PFN_ARABIC = 2, - PFN_LOWER = 3, - PFN_UPPER = 4, - PFN_LOWERROMAN = 5, - PFN_UPPERROMAN = 6, - PFN_UNI = 7 - } - public enum ParaSpacing : byte - { - PFS_SINGLE = 0, - PFS_ONEANDONEHALF = 1, - PFS_DOUBLE = 2, - PFS_EXACTSINGLEMIN = 3, - PFS_EXACT = 4, - PFS_EXACT20 = 5 - } - [Flags] - public enum E_FontStyle : byte - { - FS_NONE = 0, - FS_BOLD = 0x01, - FS_UNDERLINE = 0x02, - FS_ITALIC = 0x04, - FS_SUPERSCRIPT = 0x08, - FS_SUBSCRIPT = 0x10 - } - #endregion - #region Structures - //struct CharRange - //{ - // public int cpMin; - // public int cpMax; - //} - [StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Auto)] - public struct CharFormat2 - { - public int cbSize; - public uint dwMask; - public uint dwEffects; - public int yHeight; - public int yOffset; - public int crTextColor; - public byte bCharSet; - public byte bPitchAndFamily; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] - public string szFaceName; - public short wWeight; - public short sSpacing; - public int crBackColor; - public int lcid; - public int dwReserved; - public short sStyle; - public short wKerning; - public byte bUnderlineType; - public byte bAnimation; - public byte bRevAuthor; - public byte bReserved1; - } - public class CharFormatTwo - { - public CharFormatTwo(CharFormat2 cf) - { - _CharFormat2 = cf; - } - private CharFormat2 _CharFormat2; - [Browsable(false)] - public CharFormat2 CharFormat2 - { - get { return _CharFormat2; } - } - [Browsable(false)] - public int cbSize - { - get { return _CharFormat2.cbSize; } - set { _CharFormat2.cbSize = value; } - } - [Editor(typeof(FlagEnumUIEditor), typeof(System.Drawing.Design.UITypeEditor))] - public CharFormatMasks dwMask - { - get { return (CharFormatMasks)_CharFormat2.dwMask; } - set { _CharFormat2.dwMask = (uint)value; } - } - [Editor(typeof(FlagEnumUIEditor), typeof(System.Drawing.Design.UITypeEditor))] - public CharFormatEffects dwEffects - { - get { return (CharFormatEffects)_CharFormat2.dwEffects; } - set { _CharFormat2.dwEffects = (uint)value; } - } - public int yHeight - { - get { return _CharFormat2.yHeight; } - set { _CharFormat2.yHeight = value; } - } - public int yOffset - { - get { return _CharFormat2.yOffset; } - set { _CharFormat2.yOffset = value; } - } - private Color Int2Color(int color) - { - return Color.FromArgb(color % 256, (color / 256) % 256, color / (256 * 256)); - } - private int Color2Int(Color color) - { - return color.R + (color.G * 256) + (color.B * 256 * 256); - } - public Color crTextColor - { - get { return Int2Color(_CharFormat2.crTextColor); } - set { _CharFormat2.crTextColor = Color2Int(value); } - } - public byte bCharSet - { - get { return _CharFormat2.bCharSet; } - set { _CharFormat2.bCharSet = value; } - } - public byte bPitchAndFamily - { - get { return _CharFormat2.bPitchAndFamily; } - set { _CharFormat2.bPitchAndFamily = value; } - } - public string szFaceName - { - get { return _CharFormat2.szFaceName; } - set { _CharFormat2.szFaceName = value; } - } - public short wWeight - { - get { return _CharFormat2.wWeight; } - set { _CharFormat2.wWeight = value; } - } - public short sSpacing - { - get { return _CharFormat2.sSpacing; } - set { _CharFormat2.sSpacing = value; } - } - public Color crBackColor - { - get { return Int2Color(_CharFormat2.crBackColor); } - set { _CharFormat2.crBackColor = Color2Int(value); } - } - public int lcid - { - get { return _CharFormat2.lcid; } - set { _CharFormat2.lcid = value; } - } - public int dwReserved - { - get { return _CharFormat2.dwReserved; } - set { _CharFormat2.dwReserved = value; } - } - public short sStyle - { - get { return _CharFormat2.sStyle; } - set { _CharFormat2.sStyle = value; } - } - public short wKerning - { - get { return _CharFormat2.wKerning; } - set { _CharFormat2.wKerning = value; } - } - public CharUnderline bUnderlineType - { - get { return (CharUnderline)_CharFormat2.bUnderlineType; } - set { _CharFormat2.bUnderlineType = (byte)value; } - } - public byte bAnimation - { - get { return _CharFormat2.bAnimation; } - set { _CharFormat2.bAnimation = value; } - } - public byte bRevAuthor - { - get { return _CharFormat2.bRevAuthor; } - set { _CharFormat2.bRevAuthor = value; } - } - public byte bReserved1 - { - get { return _CharFormat2.bReserved1; } - set { _CharFormat2.bReserved1 = value; } - } - } - [StructLayout(LayoutKind.Sequential, Pack = 4)] - public struct ParaFormat2 - { - public int cbSize; - public int dwMask; - public ushort wNumbering; - public short wEffects; - public int dxStartIndent; - public int dxRightIndent; - public int dxOffset; - public short wAlignment; - public short cTabCount; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public int[] rgxTabs; - public int dySpaceBefore; - public int dySpaceAfter; - public int dyLineSpacing; - public short sStyle; - public byte bLineSpacingRule; - public byte bOutlineLevel; - public short wShadingWeight; - public short wShadingStyle; - public short wNumberingStart; - public short wNumberingStyle; - public short wNumberingTab; - public short wBorderSpace; - public short wBorderWidth; - public short wBorders; - } - public class ParaFormatTwo - { - private ParaFormat2 _ParaFormat2; - public ParaFormatTwo(ParaFormat2 pf) - { - _ParaFormat2 = pf; - } - public ParaFormat2 ParaFormat2 - { - get { return _ParaFormat2; } - } - public int cbSize - { - get { return _ParaFormat2.cbSize; } - set { _ParaFormat2.cbSize = value; } - } - [Editor(typeof(FlagEnumUIEditor), typeof(System.Drawing.Design.UITypeEditor))] - public ParaFormatMasks dwMask - { - get { return (ParaFormatMasks)_ParaFormat2.dwMask; } - set { _ParaFormat2.dwMask = (int)value; } - } - public ParaNumbering wNumbering - { - get { return (ParaNumbering)_ParaFormat2.wNumbering; } - set { _ParaFormat2.wNumbering = (ushort)value; } - } - public ParaFormatEffects wEffects - { - get { return (ParaFormatEffects)_ParaFormat2.wEffects; } - set { _ParaFormat2.wEffects = (short)value; } - } - public int dxStartIndent - { - get { return _ParaFormat2.dxStartIndent; } - set { _ParaFormat2.dxStartIndent = value; } - } - public int dxRightIndent - { - get { return _ParaFormat2.dxRightIndent; } - set { _ParaFormat2.dxRightIndent = value; } - } - public int dxOffset - { - get { return _ParaFormat2.dxOffset; } - set { _ParaFormat2.dxOffset = value; } - } - public ParaAlignment wAlignment - { - get { return (ParaAlignment)_ParaFormat2.wAlignment; } - set { _ParaFormat2.wAlignment = (short)value; } - } - public short cTabCount - { - get { return _ParaFormat2.cTabCount; } - set { _ParaFormat2.cTabCount = value; } - } - public int[] rgxTabs - { - get { return _ParaFormat2.rgxTabs; } - set { _ParaFormat2.rgxTabs = value; } - } - public int dySpaceBefore - { - get { return _ParaFormat2.dySpaceBefore; } - set { _ParaFormat2.dySpaceBefore = value; } - } - public int dySpaceAfter - { - get { return _ParaFormat2.dySpaceAfter; } - set { _ParaFormat2.dySpaceAfter = value; } - } - public int dyLineSpacing - { - get { return _ParaFormat2.dyLineSpacing; } - set { _ParaFormat2.dyLineSpacing = value; } - } - public short sStyle - { - get { return _ParaFormat2.sStyle; } - set { _ParaFormat2.sStyle = value; } - } - public ParaSpacing bLineSpacingRule - { - get { return (ParaSpacing)_ParaFormat2.bLineSpacingRule; } - set { _ParaFormat2.bLineSpacingRule = (byte)value; } - } - public byte bOutlineLevel - { - get { return _ParaFormat2.bOutlineLevel; } - set { _ParaFormat2.bOutlineLevel = value; } - } - public short wShadingWeight - { - get { return _ParaFormat2.wShadingWeight; } - set { _ParaFormat2.wShadingWeight = value; } - } - public short wShadingStyle - { - get { return _ParaFormat2.wShadingStyle; } - set { _ParaFormat2.wShadingStyle = value; } - } - public short wNumberingStart - { - get { return _ParaFormat2.wNumberingStart; } - set { _ParaFormat2.wNumberingStart = value; } - } - public short wNumberingStyle - { - get { return _ParaFormat2.wNumberingStyle; } - set { _ParaFormat2.wNumberingStyle = value; } - } - public short wNumberingTab - { - get { return _ParaFormat2.wNumberingTab; } - set { _ParaFormat2.wNumberingTab = value; } - } - public short wBorderSpace - { - get { return _ParaFormat2.wBorderSpace; } - set { _ParaFormat2.wBorderSpace = value; } - } - public short wBorderWidth - { - get { return _ParaFormat2.wBorderWidth; } - set { _ParaFormat2.wBorderWidth = value; } - } - public short wBorders - { - get { return _ParaFormat2.wBorders; } - set { _ParaFormat2.wBorders = value; } - } - } - #endregion - #region Static Methods - public static bool HasVertScroll(Control ctl) - { - int dwstyle = GetWindowLong(ctl.Handle, GWL_STYLE); - return (dwstyle & WS_VSCROLL) != 0; - } - public static bool HasHorzScroll(Control ctl) - { - int dwstyle = GetWindowLong(ctl.Handle, GWL_STYLE); - return (dwstyle & WS_HSCROLL) != 0; - } - public static void SetScrollLocation(RichTextBox richTextBox, Point point) - { - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETSCROLLPOS, 0, ref point) == 0) - throw new Win32Exception(); - } - public static Point GetScrollLocation(RichTextBox richTextBox) - { - Point pt = new Point(); - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_GETSCROLLPOS, 0, ref pt) == 0) - throw new Win32Exception(); - return pt; - } - public static void SetBackgroundColor(RichTextBox richTextBox, Color color) - { - int clr = color.R + (color.G * 256) + (color.B * 256 * 256); - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETBKGNDCOLOR, 0, clr) == 0) - throw new Win32Exception(); - } - public static void SetAuto(RichTextBox richTextBox) - { - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETOPTIONS, (int)EcoOperations.ECOOP_XOR, (int)EditControlOptions.ECO_AUTOWORDSELECTION) == 0) - throw new Win32Exception(); - } - public static ParaFormatTwo GetParaFormat(RichTextBox richTextBox) - { - ParaFormat2 pf = new ParaFormat2(); - pf.cbSize = Marshal.SizeOf(pf); - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_GETPARAFORMAT, 0, ref pf) == 0) - throw new Win32Exception(); - return new ParaFormatTwo(pf); - } - public static void SetParaFormat(RichTextBox richTextBox, ParaFormatTwo pft) - { - ParaFormat2 pf2 = pft.ParaFormat2; - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETPARAFORMAT, 0, ref pf2) == 0) - { - //if(Marshal.GetLastWin32Error()!=0) - throw new Win32Exception(); - } - } - public static CharFormatTwo GetCharFormat(RichTextBox richTextBox, RTBSelection selection) - { - CharFormat2 cf = new CharFormat2(); - cf.cbSize = Marshal.SizeOf(cf); - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_GETCHARFORMAT, selection, ref cf) == 0) - throw new Win32Exception(); - return new CharFormatTwo(cf); - } - public static void SetCharFormat(RichTextBox richTextBox, RTBSelection selection, CharFormatTwo cft) - { - try - { - CharFormat2 cf2 = cft.CharFormat2; - try - { - HandleRef hr = new HandleRef(richTextBox, richTextBox.Handle); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - } - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETCHARFORMAT, selection, ref cf2) == 0) - throw new Win32Exception(); - } - catch (Exception ex) - { - Console.WriteLine("Error on SetCharFormat {0}", ex.Message); - } - - } - public static void SetHighlightColor(RichTextBox richTextBox, RTBSelection selection, Color color) - { - CharFormatTwo cft = GetCharFormat(richTextBox, selection); - cft.crBackColor = color; - cft.dwEffects = 0; - cft.dwMask = 0; - cft.dwMask |= CharFormatMasks.CFM_BACKCOLOR; - SetCharFormat(richTextBox, selection, cft); - } - public static void SetSpaceBefore(RichTextBox richTextBox, int spaceBefore) - { - ParaFormatTwo pft = GetParaFormat(richTextBox); - pft.dwMask = 0; - pft.dwMask |= ParaFormatMasks.PFM_SPACEBEFORE; - // 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.dySpaceBefore = spaceBefore * 1440 / dpi; - 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) - { - ParaFormatTwo pft = GetParaFormat(richTextBox); - pft.bLineSpacingRule = type; - pft.dwMask = 0; - pft.dwMask |= ParaFormatMasks.PFM_LINESPACING; - 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.dyLineSpacing = Convert.ToInt32(.5 + richTextBox.Font.GetHeight(dpi)) * 1440 / dpi; - SetParaFormat(richTextBox, pft); - } - public static E_FontStyle GetFontStyle(RichTextBox richTextBox) - { - E_FontStyle fs = E_FontStyle.FS_NONE; - CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION); - if (((cft.dwMask & CharFormatMasks.CFM_BOLD) == CharFormatMasks.CFM_BOLD) && - ((cft.dwEffects & CharFormatEffects.CFE_BOLD) == CharFormatEffects.CFE_BOLD)) fs |= E_FontStyle.FS_BOLD; - if (((cft.dwMask & CharFormatMasks.CFM_UNDERLINE) == CharFormatMasks.CFM_UNDERLINE) && - ((cft.dwEffects & CharFormatEffects.CFE_UNDERLINE) == CharFormatEffects.CFE_UNDERLINE)) fs |= E_FontStyle.FS_UNDERLINE; - if (((cft.dwMask & CharFormatMasks.CFM_ITALIC) == CharFormatMasks.CFM_ITALIC) && - ((cft.dwEffects & CharFormatEffects.CFE_ITALIC) == CharFormatEffects.CFE_ITALIC)) fs |= E_FontStyle.FS_ITALIC; - if (richTextBox.SelectionCharOffset == -2) fs |= E_FontStyle.FS_SUBSCRIPT; - if (richTextBox.SelectionCharOffset == 2) fs |= E_FontStyle.FS_SUPERSCRIPT; - return fs; - } - public static void SetFontStyle(RichTextBox richTextBox, E_FontStyle fs) - { - CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION); - if ((fs & E_FontStyle.FS_BOLD) == E_FontStyle.FS_BOLD) - { - cft.dwEffects |= CharFormatEffects.CFE_BOLD; - cft.dwMask |= CharFormatMasks.CFM_BOLD; - } - if ((fs & E_FontStyle.FS_UNDERLINE) == E_FontStyle.FS_UNDERLINE) - { - cft.dwEffects |= CharFormatEffects.CFE_UNDERLINE; - cft.dwMask |= CharFormatMasks.CFM_UNDERLINE; - } - if ((fs & E_FontStyle.FS_ITALIC) == E_FontStyle.FS_ITALIC) - { - cft.dwEffects |= CharFormatEffects.CFE_ITALIC; - cft.dwMask |= CharFormatMasks.CFM_ITALIC; - } - if ((fs & E_FontStyle.FS_SUBSCRIPT) == E_FontStyle.FS_SUBSCRIPT) - { - richTextBox.SelectionCharOffset = -2; - } - if ((fs & E_FontStyle.FS_SUPERSCRIPT) == E_FontStyle.FS_SUPERSCRIPT) - { - richTextBox.SelectionCharOffset = 2; - } - SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft); - } - public static bool IsSuperScript(RichTextBox richTextBox) - { - return (richTextBox.SelectionCharOffset>0); - } - public static bool IsSubScript(RichTextBox richTextBox) - { - return (richTextBox.SelectionCharOffset < 0); - } - public static void ToggleSubscript(bool bSet, RichTextBox richTextBox, RTBSelection selection) - { - if (bSet) - richTextBox.SelectionCharOffset = -2; - else - richTextBox.SelectionCharOffset = 0; - } - public static void ToggleSuperscript(bool bSet, RichTextBox richTextBox, RTBSelection selection) - { - if (bSet) - richTextBox.SelectionCharOffset = 2; - else - richTextBox.SelectionCharOffset = 0; - } - public static bool IsBold(RichTextBox richTextBox) - { - CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION); - return (((cft.dwMask & CharFormatMasks.CFM_BOLD) == CharFormatMasks.CFM_BOLD) && - ((cft.dwEffects & CharFormatEffects.CFE_BOLD) == CharFormatEffects.CFE_BOLD)); - } - public static void ToggleBold(bool bSet, RichTextBox richTextBox, RTBSelection selection) - { - CharFormatTwo cft = GetCharFormat(richTextBox, selection); - if (bSet) - { - cft.dwEffects = CharFormatEffects.CFE_BOLD; - cft.dwMask = CharFormatMasks.CFM_BOLD; - } - else - { - cft.dwEffects = CharFormatEffects.CFE_NONE; - cft.dwMask = CharFormatMasks.CFM_BOLD; - } - SetCharFormat(richTextBox, selection, cft); - } - public static bool IsUnderline(RichTextBox richTextBox) - { - CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION); - return (((cft.dwMask & CharFormatMasks.CFM_UNDERLINE) == CharFormatMasks.CFM_UNDERLINE) && - ((cft.dwEffects & CharFormatEffects.CFE_UNDERLINE) == CharFormatEffects.CFE_UNDERLINE)); - } - public static void ToggleUnderline(bool bSet, RichTextBox richTextBox, RTBSelection selection) - { - CharFormatTwo cft = GetCharFormat(richTextBox, selection); - if (bSet) - { - cft.dwEffects = CharFormatEffects.CFE_UNDERLINE; - cft.dwMask = CharFormatMasks.CFM_UNDERLINE; - } - else - { - cft.dwEffects = CharFormatEffects.CFE_NONE; - cft.dwMask = CharFormatMasks.CFM_UNDERLINE; - } - SetCharFormat(richTextBox, selection, cft); - } - public static bool IsItalic(RichTextBox richTextBox) - { - CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION); - return (((cft.dwMask & CharFormatMasks.CFM_ITALIC) == CharFormatMasks.CFM_ITALIC) && - ((cft.dwEffects & CharFormatEffects.CFE_ITALIC) == CharFormatEffects.CFE_ITALIC)); - } - public static void ToggleItalic(bool bSet, RichTextBox richTextBox, RTBSelection selection) - { - CharFormatTwo cft = GetCharFormat(richTextBox, selection); - if (bSet) - { - cft.dwEffects = CharFormatEffects.CFE_ITALIC; - cft.dwMask = CharFormatMasks.CFM_ITALIC; - } - else - { - cft.dwEffects = CharFormatEffects.CFE_NONE; - cft.dwMask = CharFormatMasks.CFM_ITALIC; - } - 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 - } -} diff --git a/PROMS/Volian.Base.Library/RtfTools.cs b/PROMS/Volian.Base.Library/RtfTools.cs deleted file mode 100644 index 5a2feeb9..00000000 --- a/PROMS/Volian.Base.Library/RtfTools.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace Volian.Base.Library -{ - public class RtfTools - { - public static List SplitText(string text, int len) - { - { - List results = new List(); - if (text.Contains("\\LINE ") || text.Contains("\r\n") || text.Contains("\\line ")) - { - string[] mySplit = { "\\LINE ", "\r\n", "\\line " }; - return new List(text.Split(mySplit, StringSplitOptions.None)); - - } - int width = 0; // width of text, non-rtf - int start = 0; // start of line (index into string 'text'), includes rtf - int lastspace = 0; // location of lastspace (index into string 'text'), includes rtf - int startNonRtf = 0; // start of line, non-rtf (used for determining starting position to determine width if there was a break) - string rtfprefix = ""; - string nextprefix = ""; - for (int indx = 0; indx < text.Length; indx++) - { - if (text[indx] == '\\') //rtf command - { - // look for three things at beginning of string: hex, unicode, rtfcommand. - Match m = Regex.Match(text.Substring(indx), @"^\\'[a-fA-F0-9][a-fA-F0-9]"); //hex - if (m.Success) - { - indx += m.Length - 1; - width++; - } - else - { - m = Regex.Match(text.Substring(indx), @"^\\[uU][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][?]"); // 3 char unicode, for example \u160? (hardspace) - if (m.Success) - { - indx += m.Length - 1; - width++; - } - else - { - m = Regex.Match(text.Substring(indx), @"^\\[uU][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][?]"); - if (m.Success) - { - indx += m.Length - 1; - width++; - } - else - { - m = Regex.Match(text.Substring(indx), @"^\\[^ ]*? "); - if (m.Success) - { - indx += m.Length - 1; - rtfprefix = AdjustRtfPrefix(rtfprefix, m.Value); - } - } - } - } - - } - else - { - if (text[indx] == ' ') - { - lastspace = indx; - startNonRtf = width; - } - width++; - if (width > len) - { - // what should be done if lastspace == 0 - // cannot find space char to split on, so break the word - // not ideal but PROMS was bombing otherwise - jsj 7/7/2014 - if (lastspace == 0) - { - lastspace = indx; - startNonRtf = width - 1; - } - results.Add(nextprefix + text.Substring(start, lastspace - start).Trim(" ".ToCharArray())); - nextprefix = rtfprefix; - if (nextprefix != "") nextprefix += " "; - start = lastspace + 1; - width = (width - startNonRtf - 1) > 0 ? width - startNonRtf - 1 : 0; - lastspace = 0; - } - } - - } - if (width > 0 || start < text.Length) results.Add(nextprefix + text.Substring(start).Trim(" ".ToCharArray())); - return results; - } - } - private static string AdjustRtfPrefix(string rtfprefix, string rtfcommand) - { - if (rtfcommand.Contains(@"\ulnone") || rtfcommand.Contains(@"\ul0")) // off - rtfprefix = rtfprefix.Replace(@"\ul", ""); - else if (rtfcommand.Contains(@"\ul")) - rtfprefix += @"\ul"; - if (rtfcommand.Contains(@"\up0") || rtfcommand.Contains(@"\dn0")) rtfprefix = rtfprefix.Replace(@"\up2", "").Replace(@"\dn2", ""); - else if (rtfcommand.Contains(@"\up")) rtfprefix += @"\up2"; - else if (rtfcommand.Contains(@"\dn")) rtfprefix += @"\dn2"; - if (rtfcommand.Contains(@"\b0")) - rtfprefix = rtfprefix.Replace(@"\b", ""); - else if (rtfcommand.Contains(@"\b")) - rtfprefix += @"\b"; - if (rtfcommand.Contains(@"\i0")) - rtfprefix = rtfprefix.Replace(@"\i", ""); - else if (rtfcommand.Contains(@"\i")) - rtfprefix += @"\i"; - return rtfprefix; - } - public static string RTFConvertedSymbolsToUnicode(string str) - { - string rtnStr = str; - // convert \~ to a hard spece. RTF is automatically converting \u160? to \~ but will then convert - // the \~ to a regular space! - rtnStr = rtnStr.Replace(@"\~", @"\u160?"); - rtnStr = rtnStr.Replace(@"\'a0", @"\u160?"); - // convert \'99 to \u8482? this is for the trade mark symbol. RTF is automatically - // converting the unicode \u8482? to \'99, but once this is done, PROMS StepRTB (edit windows) does not show it - rtnStr = rtnStr.Replace(@"\'99", @"\u8482?"); - // convert \'ae to \u174? this is for the registered symbol. RTF converts the unicode character to \'ae - rtnStr = rtnStr.Replace(@"\'ae", @"\u174?"); - // convert \'a9 to \u169? this is for the copyright symbol. RTF converts the unicode character to \'a9 - rtnStr = rtnStr.Replace(@"\'a9", @"\u169?"); - return rtnStr; - } - } -} diff --git a/PROMS/Volian.Base.Library/TmpFile.cs b/PROMS/Volian.Base.Library/TmpFile.cs deleted file mode 100644 index 821d75ce..00000000 --- a/PROMS/Volian.Base.Library/TmpFile.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Text.RegularExpressions; - -namespace Volian.Base.Library -{ - public static class TmpFile - { - public static string CreateFileName(string procNumber, string sectNumber, string sectTitle) - { - return FixFileName(procNumber + "_" + ((sectNumber ?? "") != "" ? sectNumber : sectTitle)); - } - public static string CreateFileName(string procNumber) - { - return FixFileName(procNumber); - } - public static string FixFileName(string name) - { - return Regex.Replace(name, "[ .,/]", "_") + ".pdf"; - } - public static void RemoveAllTmps() - { - RemoveTmpPDFs(); - RemoveTmpDocs(); - RemoveTmps("*.png"); - } - public static void RemoveTmpPDFs() - { - string tmpFolder = VlnSettings.TemporaryFolder; - DirectoryInfo di = new DirectoryInfo(tmpFolder); - if (!di.Exists) return; - foreach (FileInfo fi in di.GetFiles("*.pdf")) - { - try - { - // only delete pdfs if they are older than an hour - just to be - // safe. During creation of pdf's, separate pdfs are created for - // word sections and imported into the main resulting pdf. - if (fi.LastAccessTime.Ticks < (DateTime.Now.Ticks - TimeSpan.TicksPerHour)) - fi.Delete(); - } - catch (Exception ex) - { - continue; // if an error, go onto next file. - } - } - - } - public static void RemoveTmpDocs() - { - // B2017-249 Recover Temporary File And AutoSave support for MSWord - // Remove temporary Doc Files more than 2 days old so that files with changes can be recoered. - RemoveOldTmps("*.doc"); - RemoveOldTmps("*.docx"); - RemoveOldTmps("*.rtf"); - } - private static void RemoveOldTmps(string extension) - { - string tmpFolder = VlnSettings.TemporaryFolder; - DirectoryInfo di = new DirectoryInfo(tmpFolder); - if (!di.Exists) return; - foreach (FileInfo fi in di.GetFiles(extension)) - { - try - { - // delete any docs. If it fails, just go on to the next one because - // it may be open from another process. - if(fi.LastWriteTimeUtc < DateTime.Now.AddDays(-2.0)) - fi.Delete(); - } - catch (Exception ex) - { - continue; // if an error, go onto next file. - } - } - } - - private static void RemoveTmps(string extension) - { - string tmpFolder = VlnSettings.TemporaryFolder; - DirectoryInfo di = new DirectoryInfo(tmpFolder); - if (!di.Exists) return; - foreach (FileInfo fi in di.GetFiles(extension)) - { - try - { - // delete any docs. If it fails, just go on to the next one because - // it may be open from another process. - fi.Delete(); - } - catch (Exception ex) - { - continue; // if an error, go onto next file. - } - } - } - } -} diff --git a/PROMS/Volian.Base.Library/ValidFileName.cs b/PROMS/Volian.Base.Library/ValidFileName.cs deleted file mode 100644 index 62b25e99..00000000 --- a/PROMS/Volian.Base.Library/ValidFileName.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Volian.Base.Library -{ - // Part of fix for B2019-032 - will clean up the passed in file name. - public static class ValidFileName - { - /// - /// Replaces characters in orgTxt that are not allowed in file names with the specified replacement character. - /// - /// - /// Note that Forward Slash, Back Slash and Pipe (vertical bar) are replaced with a dash '-'. - /// The Double quote is replaced with a single quote. - /// Everything else is replaced with a '_' unless a different replace char is passed in. - /// A null (zero) replacement character will cause the invalid characters to be removed. - /// The list of invalid characters include Double Quote, Less Than, Greater Than, Pipe, Question Mark, Back and Forward Slashes, Colin. - /// Also invalid are characters less than Ascii 32 (space) and greater than Ascii 126 (tilde) - /// - /// Text to make into a valid filename. The same string is returned if it is valid already. - /// Replacement character ('_' is the default), or null to simply remove bad characters. - /// Character array of additional character to replace. - /// A string that can be used as a filename. If the output string would otherwise be empty, returns "_". - public static string FixFileName(string orgTxt, char? replacementChar = '_', char[] additionalInvalidChars = null) - { - StringBuilder sb = new StringBuilder(orgTxt.Length); - bool changed = false; - //var invalidChars = System.IO.Path.GetInvalidFileNameChars(); - char[] invalidChars = { '"', '<', '>', '|', '?', '\\', '/', ':' }; - if (additionalInvalidChars != null) invalidChars = invalidChars.Union(additionalInvalidChars).ToArray(); - for (int i = 0; i < orgTxt.Length; i++) - { - char c = orgTxt[i]; - if (invalidChars.Contains(c) || !(c >= ' ' && c <= '~')) - { - changed = true; - var repl = replacementChar ?? '\0'; - if (repl != '\0') - { - if (c == '\\' || c == '/' || c == '|') - sb.Append('-'); // replace forward slash, back slash, and vertical line (pipe) with a dash - else if (c == '"') - sb.Append('\''); // replace a double quote with a single quote - else - sb.Append(repl); // replace with '_' or passed in replacement character - } - } - else - sb.Append(c); // the character is OK just add it to the return string - } - if (sb.Length == 0) - return "_"; // return a '_' if return string is empty. - return changed ? sb.ToString() : orgTxt; // if we replaced a character return the corrected file name, else return the original file name - } - } -} diff --git a/PROMS/Volian.Base.Library/VlnItextSharpFont.cs b/PROMS/Volian.Base.Library/VlnItextSharpFont.cs deleted file mode 100644 index 9efcb2cb..00000000 --- a/PROMS/Volian.Base.Library/VlnItextSharpFont.cs +++ /dev/null @@ -1,181 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using iTextSharp.text.factories; -using Microsoft.Win32; -using System.Text.RegularExpressions; -using System.IO; -using iTextSharp.text; - -namespace Volian.Base.Library -{ - /// - /// B2019-116 Volian.Base.Library This is a generic class for dealing with iTextSharp Fonts - /// Code moved and consolidated from Volian.Print.Library Volian PDF.Library and VG - /// - public static class VlnItextFont - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private static string _PromsFontDir = null;//B2019-099 Consistent Font Retrieve - /// - /// Register fonts based upon PromsFonts command line parameter - /// - public static void RegisterPromsFonts() - { - _PromsFontDir = Volian.Base.Library.VlnSettings.GetCommand("PromsFonts", ""); - if (_PromsFontDir != "") - { - DirectoryInfo di = new DirectoryInfo(_PromsFontDir); - if (di.Exists) - { - _MyLog.WarnFormat("PROMS Font Folder = {0}", _PromsFontDir); // C2019-028 Add info in the error log - iTextSharp.text.FontFactory.RegisterDirectory(_PromsFontDir); - } - } - } - // B2019-174 created RegisterFontFolder so that we call at start of print() in PromsPrinter.cs - // this allows symbol characters to appear on the Auto Table Of Contents page - public static void RegisterFontFolder() - { - if (_PromsFontDir == null || _PromsFontDir =="")//B2019-099 Consistent Font Retrieve - { - _PromsFontDir = Volian.Base.Library.VlnSettings.GetCommand("PromsFonts", ""); - if (_PromsFontDir == "") - _PromsFontDir = FontFind.FontDir; - else - { - DirectoryInfo di = new DirectoryInfo(_PromsFontDir); - if (!di.Exists) - _PromsFontDir = FontFind.FontDir; - else - _MyLog.WarnFormat("PROMS Font Folder = {0}", _PromsFontDir); // C2019-028 Add info in the error log - } - } - int profileDepth1 = ProfileTimer.Push(">>>> RegisterDirectory " + _PromsFontDir); - //_MyLog.DebugFormat("Register this Font Folder = {0}", _PromsFontDir); // debug - iTextSharp.text.FontFactory.RegisterDirectory(_PromsFontDir); - ProfileTimer.Pop(profileDepth1); - } - public static void RegisterFontByFontFolders(string fontName) - { - int profileDepth = ProfileTimer.Push(string.Format(">>>> RegisterFont {0}", fontName)); - if (!iTextSharp.text.FontFactory.IsRegistered(fontName)) - { - RegisterFontFolder(); - if (!iTextSharp.text.FontFactory.IsRegistered(fontName)) - { - //B2019-099 Consistent Font Retrieve - _MyLog.WarnFormat("Problem with Font {0} in {1}", fontName, _PromsFontDir); - if (_PromsFontDir != FontFind.FontDir) - { - int profileDepth2 = ProfileTimer.Push(">>>> RegisterDirectory " + FontFind.FontDir); - //_MyLog.DebugFormat("Register this Font Folder = {0}", FontFind.FontDir); // debug - iTextSharp.text.FontFactory.RegisterDirectory(FontFind.FontDir); - ProfileTimer.Pop(profileDepth2); - if (!iTextSharp.text.FontFactory.IsRegistered(fontName)) - { - _MyLog.WarnFormat("Problem with Font {0} in {1}", fontName, FontFind.FontDir); - int profileDepth3 = ProfileTimer.Push(">>>> RegisterDirectories"); - iTextSharp.text.FontFactory.RegisterDirectories(); - ProfileTimer.Pop(profileDepth3); - } - //else - //{ - // _MyLog.DebugFormat("Registered Font {0} in {1}", fontName, FontFind.FontDir); // debug - //} - } - else - { - int profileDepth4 = ProfileTimer.Push(">>>> RegisterDirectories"); - //_MyLog.DebugFormat("RegistererDirectories {0}", FontFind.FontDir); // debug - iTextSharp.text.FontFactory.RegisterDirectories(); - ProfileTimer.Pop(profileDepth4); - } - } - if (!iTextSharp.text.FontFactory.IsRegistered(fontName)) - { - _MyLog.WarnFormat("Font {0} could not be found!", fontName); - } - else - { - iTextSharp.text.Font fnt = iTextSharp.text.FontFactory.GetFont(fontName, 10); - if (fnt.BaseFont == null) - { - _MyLog.WarnFormat("Font {0} is not installed properly!", fontName); - } - } - } - ProfileTimer.Pop(profileDepth); - } - private static RegistryKey _FontKey = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows NT").OpenSubKey("CurrentVersion").OpenSubKey("Fonts"); - public static RegistryKey FontKey - { get { return _FontKey; } } - /// - /// Try to register a particular font, if it fails register the entire font folder - /// - /// FontName - Used to find a font file. - public static void RegisterFont(string fontName) - { - if (!FontFactory.IsRegistered(fontName)) - { - foreach (string name in FontKey.GetValueNames()) - { - if (name.StartsWith(fontName)) - { - string fontFile = (string)FontKey.GetValue(name); - try // B2019-118 Add error handling for FontFacory.Register (Windows Registry contains a node that - // points to a file that no longer exists - { - FontFactory.Register(fontFile.Contains("\\") ? fontFile : FontFind.FontDir + "\\" + fontFile); - } - catch (Exception ex) // catch any exception and add the error to the error log. - { - _MyLog.WarnFormat("Font Error {0} - {1}", name, ex.Message); - } - } - } - if (!FontFactory.IsRegistered(fontName)) - RegisterFontByFontFolders(fontName); - } - } - } - public static class FontFind - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private static string _FontDir = null; - public static string FontDir - { - get - { - if (_FontDir == null) - { - // B2019-112 Error Log Font Dir - // C2019-028, B2019-099 Add call to .Net 4.6.1 method to get the system's windows font folder - _FontDir = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Fonts); - if (_FontDir != null) _MyLog.WarnFormat("Special Font Folder = {0}", _FontDir); // C2019-028 Add info in the error log - if (_FontDir == null) - { - RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"); - if (regKey != null) - { - object obj = regKey.GetValue("Fonts"); - // B2019-099 Add more debug - if (obj != null) _MyLog.WarnFormat("Font regkey.fonts = {0}", obj); // C2019-028 Add info in the error log - // C2019-028 Add Null check before attempt to convert to string - if (obj != null) - _FontDir = obj.ToString(); - } - if (_FontDir == null) // Not allowed or cannot find the fonts folder value in the registry. - { - _FontDir = @"C:\Windows\Fonts"; // default to C:\Windows\Fonts - _MyLog.WarnFormat("FontDir set to default = {0}", _FontDir); // C2019-028 Add info in the error log - } - } - } - return _FontDir; - } - } - } -} diff --git a/PROMS/Volian.Base.Library/VlnSettings.cs b/PROMS/Volian.Base.Library/VlnSettings.cs deleted file mode 100644 index 25d4aeaa..00000000 --- a/PROMS/Volian.Base.Library/VlnSettings.cs +++ /dev/null @@ -1,256 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Configuration; -using System.Reflection; - -namespace Volian.Base.Library -{ - public static class VlnSettings - { - // This is used to toggle the colored text during the Data Conversion - // and will set the font and background in PROMS 2010 for Demo/Release mode (white background black text) - // or for Debug mode (shaded background, and color text on PDF output - // For PROMS 2010, this is set via the App.config setting: - // - // - // For DataLoader, this is set via the Debug checkbox on the form. - private static bool WasLoaded = false; - private static bool _DoUpdateRO = true; - public static bool DoUpdateRO - { - get { return VlnSettings._DoUpdateRO; } - set { VlnSettings._DoUpdateRO = value; } - } - private static bool _DebugPagination = false; - public static bool DebugPagination - { - get { return VlnSettings._DebugPagination; } - set { VlnSettings._DebugPagination = value; } - } - private static bool _DebugText = false; - public static bool DebugText - { - get { return VlnSettings._DebugText; } - set { VlnSettings._DebugText = value; } - } - private static bool _DebugMode = false; - public static bool DebugMode - { - get - { - if (!WasLoaded) LoadOperatingMode(); - return _DebugMode; - } - set { _DebugMode = value; } - } - private static bool _DemoMode = false; - public static bool DemoMode - { - get - { - if (!WasLoaded) LoadOperatingMode(); - return _DemoMode; - } - set { _DemoMode = value; } - } - private static bool _ProductionMode = true; // default to OperatingMode to production - public static bool ProductionMode - { - get - { - if (!WasLoaded) LoadOperatingMode(); - return _ProductionMode; - } - set { _ProductionMode = value; } - } - private static bool _OriginalPageBreak = false; // default to not using 16bit pagebreaks - public static bool OriginalPageBreak - { - get - { - if (!WasLoaded) LoadOperatingMode(); - return _OriginalPageBreak; - } - set { _OriginalPageBreak = value; } - } - private static bool _ComparePROMStoPROMSPDF = false; // default to compare 16-bit generated PDFs - public static bool ComparePROMStoPROMSPDF - { - get - { - if (!WasLoaded) LoadOperatingMode(); - return _ComparePROMStoPROMSPDF; - } - set { _ComparePROMStoPROMSPDF = value; } - } - public static string GetDB() - { - string str = GetCommand("DB", null); - if (str == null) return null; - if(str.Contains( ":")) - { - string[] parts = str.Split(":".ToCharArray()); - if (parts.Length > 1) return parts[1]; - } - return str; - } - public static string GetServer() - { - string str = GetCommand("DB", null); - if (str != null && str.Contains(":")) - { - string[] parts = str.Split(":".ToCharArray()); - return parts[0].Replace("._",".\\"); - } - return GetCommand("Server",null); - } - public static string GetItemIDs() - { - string str = GetCommand("DB", null); - if (str != null && str.Contains(":")) - { - string[] parts = str.Split(":".ToCharArray()); - if(parts.Length > 2) return parts[2]; - } - return GetCommand("ItemIDs", ""); - } - public static string GetCommand(string commandName, string def) - { - string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray()); - foreach (string parameter in parameters) - { - if (parameter.ToUpper().StartsWith("/" + commandName.ToUpper() + "=")) - { - return parameter.Substring(commandName.Length + 2); - } - } - return def; - } - public static float GetCommandFloat(string commandName, float def) - { - string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray()); - foreach (string parameter in parameters) - { - if (parameter.ToUpper().StartsWith("/" + commandName.ToUpper() + "=")) - { - float result = def; - if (float.TryParse(parameter.Substring(commandName.Length + 2), out result)) - return result; - else - return def; - } - } - return def; - } - public static bool GetCommandFlag(string commandName) - { - string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray()); - foreach (string parameter in parameters) - { - if (parameter.ToUpper().Equals("/" + commandName.ToUpper())) - return true; - } - return false; - } - private static void LoadOperatingMode() - { - string opMode = ConfigurationManager.AppSettings["OperatingMode"]; - opMode = GetCommand("MODE",opMode); - if (opMode != null && opMode != "") - { - _DebugMode = opMode.ToUpper() == "DEBUG"; - _DemoMode = opMode.ToUpper() == "DEMO"; - _ProductionMode = opMode.ToUpper() == "PRODUCTION"; - _ComparePROMStoPROMSPDF = _DebugMode; - } - string pageBreak = ConfigurationManager.AppSettings["OriginalPageBreak"]; - if (pageBreak != null && pageBreak != "") - { - _OriginalPageBreak = pageBreak.ToUpper() == "TRUE"; - } - WasLoaded = true; - } - private static string _TemporaryFolder = null; - public static string TemporaryFolder - { - get - { - if (_TemporaryFolder == null) - { - // This will create a Temp\VE-PROMS folder in the LocalSettings Folder. - //XP - C:\Documents and Settings\{user}\Local Settings\Application Data\Temp\VEPROMS - //Vista - C:\Users\{user}\AppData\Local\Temp\VEPROMS - _TemporaryFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Temp"; - if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder); - _TemporaryFolder += @"\VEPROMS"; - if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder); - } - return _TemporaryFolder; - } - } - private static string _UserID=Environment.UserName.ToUpper(); - public static string UserID - { - get { return VlnSettings._UserID; } - set { VlnSettings._UserID = value; } - } - private static bool _StepTypeToolTip = false; - public static bool StepTypeToolTip - { - get { return VlnSettings._StepTypeToolTip; } - set { VlnSettings._StepTypeToolTip = value; } - } - // C2029-025 Show or hide replace words. Can highlight replace words in editor. - private static bool _cbShwRplWrdsColor = false; - public static bool cbShwRplWrdsColor - { - get { return VlnSettings._cbShwRplWrdsColor; } - set { VlnSettings._cbShwRplWrdsColor = value; } - } - private static string _ReleaseMode = null; - public static string ReleaseMode - { - get - { - if (_ReleaseMode == null) - { - string relType = "RELEASE"; // default to normal Release Mode setting - // Get the type of release: - // "Demo", "Westinghouse", "Release" - object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false); - if (attributes.Length > 0) - relType = ((AssemblyConfigurationAttribute)attributes[0]).Configuration.ToUpper(); - _ReleaseMode = relType; - } - return _ReleaseMode; - } - } - private static string _EULAfile = null; - public static string EULAfile - { - get { - if (_EULAfile == null) - { - switch (ReleaseMode) - { - case "DEMO": // Demo CD/DVD release - _EULAfile = "DemoEULA.txt"; - break; - case "WESTINGHOUSE": - _EULAfile = "WestinghouseEULA.txt"; - break; - case "BARAKAH": - _EULAfile = "BarakahEULA.txt"; // C2018-037 - break; - default: - _EULAfile = "EULA.txt"; - break; - } - } - return _EULAfile; - } - } - } -} diff --git a/PROMS/Volian.Base.Library/VlnTimer.cs b/PROMS/Volian.Base.Library/VlnTimer.cs deleted file mode 100644 index bfdd5e19..00000000 --- a/PROMS/Volian.Base.Library/VlnTimer.cs +++ /dev/null @@ -1,220 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Volian.Base.Library -{ - public class VlnTimer - { - private DateTime _LastTime = DateTime.Now; - public DateTime LastTime - { - get { return _LastTime; } - set { _LastTime = value; } - } - private string _LastProcess = "Initialize"; - public string LastProcess - { - get { return _LastProcess; } - set { _LastProcess = value; } - } - public string ActiveProcess - { - get { return _LastProcess; } - set - { - DateTime tNow = DateTime.Now; - TimeSpan ts = tNow - LastTime; - LastTime = tNow; - if (!ElapsedTimes.ContainsKey(LastProcess)) - ElapsedTimes.Add(LastProcess, ts); - else - ElapsedTimes[LastProcess] += ts; - LastProcess = value; - } - } - Dictionary _ElapsedTimes = new Dictionary(); - public Dictionary ElapsedTimes - { - get { return _ElapsedTimes; } - set { _ElapsedTimes = value; } - } - public void ShowElapsedTimes() - { - ActiveProcess = "fini"; - Console.WriteLine("'Process'\t'Elapsed'"); - foreach (string proc in ElapsedTimes.Keys) - Console.WriteLine("'{0}'\t{1}", proc, ElapsedTimes[proc].TotalSeconds); - } - public void ShowElapsedTimes(string title) - { - Console.WriteLine(title); - ShowElapsedTimes(); - } - } - public static class ProfileTimer - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private static Stack _MyStack = new Stack(); - - public static Stack MyStack - { - get { return _MyStack; } - set { _MyStack = value; } - } - private static DateTime _StartTime = DateTime.Now; - public static DateTime StartTime - { - get { return _StartTime; } - set { _StartTime = value; } - } - delegate int DoPushTrack(string start); - private static DoPushTrack myDoPush = new DoPushTrack(IgnorePush); - public static int Push(string start) - { - return DoPush(start); - } - private static int DoPush(string start) - { - MyStack.Push(Start); - Start = start; - return MyStack.Count; - } - private static int IgnorePush(string start) - { - Start = start; - return 1; - } - delegate int DoPopTrack(int depth); - private static DoPopTrack myDoPop = new DoPopTrack(IgnorePop); - public static int Pop(int depth) - { - return DoPop(depth); - } - private static int DoPop(int depth) - { - if (MyStack.Count != depth) - _MyLog.WarnFormat("Profile Stack Issues\r\n {0}, Depth is {1}, Depth should be {2}", Start,MyStack.Count,depth); - Start = MyStack.Pop(); - return MyStack.Count; - } - private static int IgnorePop(int depth) - { - return 0; - } - public static int Depth - { - get - { - return MyStack.Count; - } - } - private static Dictionary _TimerTable = new Dictionary(); - public static Dictionary TimerTable - { - get { return ProfileTimer._TimerTable; } - set { ProfileTimer._TimerTable = value; } - } - delegate void DoTrack(string module); - private static DoTrack myDoTrack = new DoTrack(IgnoreModule); - public static void TurnOnTracking(string filename) - { - DebugProfile.Open(VlnSettings.TemporaryFolder + "\\" + filename); - myDoTrack = new DoTrack(TrackModule); - myDoPush = new DoPushTrack(DoPush); - myDoPop = new DoPopTrack(DoPop); - } - public static void TurnOffTracking() - { - myDoTrack = new DoTrack(IgnoreModule); - myDoPush = new DoPushTrack(IgnorePush); - myDoPop = new DoPopTrack(IgnorePop); - } - private static string _Start = "Start"; - public static string Start - { - get { return _Start; } - set - { - myDoTrack(value); - } - } - private static void TrackModule(string module) - { - DateTime dtNext = DateTime.Now; - //Console.WriteLine("{0},'{1}'", TimeSpan.FromTicks(dtNext.Ticks - LastTime.Ticks).TotalSeconds, Description); - AddTimerInfo(_Start, dtNext.Ticks - LastTime.Ticks); - _Start = module; - _LastTime = dtNext; - } - private static void IgnoreModule(string module) - { - _Start = module; - } - private static void AddTimerInfo(string description, long ticks) - { - if (TimerTable.ContainsKey(description)) - TimerTable[description] += ticks; - else - TimerTable.Add(description, ticks); - } - public static void ShowTimerTable() - { - if (DebugProfile.IsOpen) - { - if (MyStack.Count > 0) - { - DebugProfile.WriteLine("{0} Items on Stack", MyStack.Count); - Dictionary stackCount = new Dictionary(); - foreach (string loc in MyStack) - { - if (!stackCount.ContainsKey(loc)) - stackCount.Add(loc, 1); - else - stackCount[loc]++; - } - foreach (string stkey in stackCount.Keys) - DebugProfile.WriteLine("\"{0}\"\t{1}", stkey, stackCount[stkey]); - DebugProfile.WriteLine("-----------------------------------"); - } - long total = 0; - foreach (long ticks in TimerTable.Values) - total += ticks; - SortedDictionary> sList = new SortedDictionary>(); - foreach (string str in TimerTable.Keys) - { - long key = -TimerTable[str]; - if (!sList.ContainsKey(key)) - sList.Add(key, new List()); - sList[key].Add(str); - } - long limit = (95 * total) / 100; - foreach (long lkey in sList.Keys) - { - foreach (string str1 in sList[lkey]) - { - TimeSpan secs = TimeSpan.FromTicks(-lkey); - if (limit > 0) - DebugProfile.WriteLine("\"{0}\"\t{1}\t{2}", str1, secs.TotalSeconds, (100 * secs.Ticks) / total); - limit += lkey; - } - } - DebugProfile.WriteLine("\"Total\"\t{0}", TimeSpan.FromTicks(total).TotalSeconds); - DebugProfile.Show(); - } - } - public static void Reset() - { - _TimerTable = new Dictionary(); - _Start = "Start"; - _LastTime = DateTime.Now; - _MyStack = new Stack(); - } - private static DateTime _LastTime = DateTime.Now; - public static DateTime LastTime - { - get { return _LastTime; } - set { _LastTime = value; } - } - } -} diff --git a/PROMS/Volian.Base.Library/Volian.Base.Library.csproj b/PROMS/Volian.Base.Library/Volian.Base.Library.csproj deleted file mode 100644 index 91c1a431..00000000 --- a/PROMS/Volian.Base.Library/Volian.Base.Library.csproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {AEEE9FD1-6892-45E2-A67E-418C06D46FF9} - Library - Properties - Volian.Base.Library - Volian.Base.Library - - - - - - - - - v4.8.1 - - - - - 2.0 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - x64 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - x64 - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - prompt - false - - - bin\x86\Release\ - TRACE - true - pdbonly - x64 - prompt - false - - - - False - ..\..\..\..\3rdPartyLibraries\DotNetBar\DotNetBar4.6Build\DevComponents.DotNetBar2.dll - - - - - False - ..\..\..\..\3rdPartyLibraries\iTechSharp\itextsharp.dll - - - False - ..\..\..\..\3rdPartyLibraries\Log4Net\log4net.dll - - - - - - - - - - - - - - - - - - Component - - - Form - - - FrmPopupStatusMessage.cs - - - - - - - - - - - - - - - - - - FrmPopupStatusMessage.cs - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Base.Library/VolianTimer.cs b/PROMS/Volian.Base.Library/VolianTimer.cs deleted file mode 100644 index 636aa63c..00000000 --- a/PROMS/Volian.Base.Library/VolianTimer.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Volian.Base.Library -{ - /// - /// VolianTimer Class - Times from Open to Close - /// Stores the results in a static list - /// - public class VolianTimer - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - static List _Timers = new List(); - /// - /// User defined name - should be as specific as possible - /// Include Method Name, File Name and Line Number - /// - private string _Name; - public string Name - { - get { return _Name; } - set { _Name = value; } - } - /// - /// Set on open - /// - private DateTime _Start; - public DateTime Start - { - get { return _Start; } - set { _Start = value; } - } - /// - /// Calculate on Close - /// - private long _Ticks; - public long Ticks - { - get { return _Ticks; } - set { _Ticks = value; } - } - /// - /// Number of times open/close has been run - /// - private int _Count; - public int Count - { - get { return _Count; } - set { _Count = value; } - } - /// - /// Constructor - /// - public VolianTimer() - { - Count = 0; - Ticks = 0; - } - /// - /// Command Line Parameter /Timing turns timing on - /// - private static bool? _TimingsOn = null; - public static bool TimingsOn - { - get - { - if (_TimingsOn == null) - _TimingsOn = Volian.Base.Library.VlnSettings.GetCommandFlag("Timing"); - return (bool) _TimingsOn; - } - } - /// - /// Constructor with Module and line number - /// - /// Method Name, File Name - /// Code Line Number - public VolianTimer(string module, int line) - { - Count = 0; - Ticks = 0; - Name = string.Format("{0}:{1}", module, line); - if(TimingsOn) _Timers.Add(this); - } - /// - /// Start Timer - /// - public void Open() - { - Start = DateTime.Now; - Count++; - } - /// - /// Stop Timer record statistics - /// - public void Close() - { - DateTime end = DateTime.Now; - TimeSpan ts = TimeSpan.FromTicks(end.Ticks - Start.Ticks); - Ticks += ts.Ticks; - } - /// - /// Show the results in the error log - /// - /// - public static string ShowTimers() - { - StringBuilder sb = new StringBuilder(); - if (TimingsOn) - { - sb.AppendLine( - "===============================================\r\n" + - "Count\tSeconds\tEvent\r\n" + - "----------------------------------------------- "); - foreach (VolianTimer tmr in _Timers) - sb.AppendLine(string.Format("{0}\t{1:N1}\t{2}", tmr.Count, TimeSpan.FromTicks(tmr.Ticks).TotalSeconds, tmr.Name)); - sb.AppendLine("===============================================\r\n"); - _MyLog.InfoFormat(sb.ToString()); - } - return sb.ToString(); - } - } -} diff --git a/PROMS/Volian.Base.Library/vlnFont.cs b/PROMS/Volian.Base.Library/vlnFont.cs deleted file mode 100644 index 4c97b6c6..00000000 --- a/PROMS/Volian.Base.Library/vlnFont.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Drawing.Text; -using System.Windows.Forms; - -namespace Volian.Base.Library -{ - public static class vlnFont - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private static InstalledFontCollection _MyFontCollection = new InstalledFontCollection(); - private static string _ProportionalSymbolFont = null; - // C2017-036 Look for suitable proportional font that will support the symbol characters used in PROMS - // Microsoft removed Arial Unicode MS starting with Word16 (office 365 containing that version of Word) - public static string ProportionalSymbolFont - { - get { - if (_ProportionalSymbolFont == null) - { - // C2019-022 Microsoft no longer supplies the Arial Unicode font. New computers more than likely do not have this font - // Since this font is no longer supported, we will now use FreeSerif or FreeMono for symbol characters - // when using a proportional font. - // We removed even checking if Arial Unicode was installed because we had a case (at Volian) where the font - // existed (was installed on a Windows 10 computer) but so some reason (unknown at time of writing) Windows say it was bad. - // PROMS would will try to use it when printing resulting in very slow print speed and often an un-readable PDF file. - if (FindFontFamily("FreeSerif")) - _ProportionalSymbolFont = "FreeSerif"; // volian supplied font but regular chars look like Times Roman - else if (FindFontFamily("FreeMono")) - _ProportionalSymbolFont = "FreeMono"; // volian suppllied font but regular chars are fixed spaced and look like Courier - else - { - MessageBox.Show("A suitable font for symbol characters could not be found.\n\n" - +"Please install Arial Unicode MS and/or the Volian supplied fonts", "Symbol Font"); - _MyLog.Error("Could Not File a Proportional Symbol Font to use."); - _ProportionalSymbolFont = "Arial"; // if volian fonts not installed, default to plain Arial (which does not have all of the symbols that we use) - } - } - return _ProportionalSymbolFont; - } - } - - - // C2017-036 Look for suitable proportional font that will support the symbol characters used in PROMS - // Microsoft removed Arial Unicode MS starting with Word16 (office 365 containing that version of Word) - // This font (below) is used only for the Reports - trying to find a font similar to Arial Unicode MS - private static string _ReportsFont = null; - - public static string ReportsFont - { - get { - if (_ReportsFont == null) - { - // C2019-022 Microsoft no longer supplies the Arial Unicode font. New computers more than likely do not have this font - // Since this font is no longer supported, we will now use FreeSerif or FreeMono for symbol characters - // when using a proportional font. - // Also the Meiryo font will not be used as it cannot be used along with the Arial font. - if (FindFontFamily("FreeSerif")) // volian supplied font but regular chars look like Times Roman - _ReportsFont = "FreeSerif"; - else if (FindFontFamily("FreeMono")) // volian suppllied font but regular chars are fixed spaced and look like Courier - _ReportsFont = "FreeMono"; - else - { - MessageBox.Show("A suitable font to use to generate Reports could not be found.\n\n" - +"Please install Arial Unicode MS and/or the Volian supplied fonts", "Report Font"); - _MyLog.Error("Could Not File a font to use for Report generation."); - _ReportsFont = "Arial"; - } - } - return _ReportsFont; - } - } - - // see if the given font exists on the computer running PROMS - private static bool FindFontFamily(string name) - { - foreach (FontFamily ff in _MyFontCollection.Families) - if (ff.Name == name) return true; - return false; - } - } -} diff --git a/PROMS/Volian.Base.Library/vlnStackTrace.cs b/PROMS/Volian.Base.Library/vlnStackTrace.cs deleted file mode 100644 index 84ce7a99..00000000 --- a/PROMS/Volian.Base.Library/vlnStackTrace.cs +++ /dev/null @@ -1,257 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Runtime.InteropServices; - -namespace Volian.Base.Library -{ - // This provides a more robust stack trace than what visual studio offers - public static class vlnStackTrace - { - public static string GetStack(string str, params object[] objects) - { - return string.Format(str, objects) + StackToString(); - } - public static void ShowStack(string str, params object[] objects) - { - Console.WriteLine(string.Format(str, objects) + StackToString()); - } - public static string GetStack() - { - return StackToString(); - } - public static string GetStack(bool showSame) - { - return StackToString(showSame); - } - public static void ShowStack() - { - Console.WriteLine(StackToString()); - } - public static string StackToString() - { - return StackToString(true); - } - private static string StackToString(bool showSame) - { - StringBuilder sb = new StringBuilder(); - StackTrace st = new StackTrace(true); - StackFrame[] sfs = st.GetFrames(); - int ii = 0; - string sLast = ""; - string sThis = ""; - int imax = MatchingStackFrame(sfs); - foreach (StackFrame sf in sfs) - { - if (showSame && imax == 0) - sb.Append(string.Format("\r\n{0}---------", "".PadLeft(ii++ * 2))); - imax--; - if (ii < 2) ii++; - else - { - string sMethod = sf.GetMethod().Name; - string sNamespace = sf.GetMethod().ReflectedType.Namespace; - string sType = sf.GetMethod().ReflectedType.Name; - if (sf.GetFileLineNumber() != 0) - { - sMethod += string.Format(" {0}[{1}]", sf.GetFileName(), sf.GetFileLineNumber()); - sThis = ""; - } - else - { - sThis = sNamespace; - } - if (sLast == sThis && sThis != "") - sb.Append(string.Format("\t*.{0}.{1}", sType, sMethod)); - else - sb.Append(string.Format("\r\n{0}{1}.{2}.{3}", "".PadLeft(ii++ * 2), sNamespace, sType, sMethod)); - } - sLast = sThis; - } - return sb.ToString(); - } - public static void ShowStackLocal(string str, params object[] objects) - { - Console.WriteLine(string.Format(str, objects) + StackToStringLocal(2,10)); - } - public static void ShowStackFirstLocal(string str) - { - Console.WriteLine(str + "\r\n" + StackToStringLocal(3, 0)); - } - public static void ShowStackLocal(string str,int start) - { - Console.WriteLine(str + "\r\n" + StackToStringLocal(start,1)); - } - public static void ShowStackLocal(int start, int limit, string str, params object[] objects) - { - Console.WriteLine(string.Format(str, objects) + StackToStringLocal(start, limit)); - } - public static string StackToStringLocal(int start, int limit) - { - StringBuilder sb = new StringBuilder(); - string sep = "\r\n"; - StackTrace st = new StackTrace(true); - StackFrame[] sfs = st.GetFrames(); - int count = 0; - int localCount = 0; - foreach (StackFrame sf in sfs) - { - count++; - if (count > start) - { - if (sf.GetFileLineNumber() != 0) - { - string sMethod = sf.GetMethod().Name; - string sNamespace = sf.GetMethod().ReflectedType.Namespace; - string sType = sf.GetMethod().ReflectedType.Name; - sMethod += string.Format(" {0}[{1}]", sf.GetFileName(), sf.GetFileLineNumber()); - sb.Append(sep + string.Format("{0}.{1}.{2}", sNamespace, sType, sMethod)); - localCount ++; - if (localCount >= limit) - return sb.ToString(); - sep = "\r\n" + "".PadRight(localCount *2); - } - } - } - if (localCount > 0) - return sb.ToString(); - return "No Local Method"; - } - public static string CalledFrom - { - get - { - StackTrace st = new StackTrace(true); - StackFrame[] sfs = st.GetFrames(); - int count = 0; - foreach (StackFrame sf in sfs) - { - if (sf.GetFileLineNumber() != 0) // Only look at Local Methods - { - count++; - if (count > 4) // The fourth entry should be the Calling Method - { - string sType = sf.GetMethod().ReflectedType.Name; - string sMethod = sf.GetMethod().Name; - return string.Format("{0}.{1}[{2}]", sType, sMethod, sf.GetFileLineNumber()); - } - } - } - return "No Local Method"; - } - } - public static string CalledFromCSLA - { - get - { - StackTrace st = new StackTrace(true); - StackFrame[] sfs = st.GetFrames(); - int count = 0; - string lastWasCSLA = null; - foreach (StackFrame sf in sfs) - { - string sType = sf.GetMethod().ReflectedType.FullName; - string sMethod = sf.GetMethod().Name; - if (sType.StartsWith("VEPROMS.CSLA.Library") && !sType.StartsWith("VEPROMS.CSLA.Library.Database") - && !sMethod.StartsWith("DataPortal") && !sMethod.StartsWith("SetParentSectionAndDocVersion"))// Only look at Local Methods - lastWasCSLA = string.Format("{0}.{1}[{2}]", sType, sMethod, sf.GetFileLineNumber()); - else - if (lastWasCSLA != null) return lastWasCSLA; - } - return "No CSLA Method"; - } - } - private static StackFrame[] _LastSFS; - private static int MatchingStackFrame(StackFrame[] sfs) - { - int iFound = -1; - if (_LastSFS != null) - { - // start at the far end and work backward - for (int i = 1; iFound < 0 && i <= sfs.Length && i <= _LastSFS.Length; i++) - { - if (!Match(sfs[sfs.Length - i],_LastSFS[_LastSFS.Length - i])) - iFound = 1+ sfs.Length - i; - } - } - if (iFound < 0) iFound = sfs.Length; - _LastSFS = (StackFrame[])sfs.Clone(); - return iFound; - } - - private static bool Match(StackFrame stackFrame1, StackFrame stackFrame2) - { - if (stackFrame1.GetMethod().Name != stackFrame2.GetMethod().Name) return false; - if (stackFrame1.GetMethod().DeclaringType.FullName != stackFrame2.GetMethod().DeclaringType.FullName) return false; - if (stackFrame1.GetILOffset() != stackFrame2.GetILOffset()) return false; - return true; - } - public static bool ScrollInStack() - { - StackTrace st = new StackTrace(true); - StackFrame[] sfs = st.GetFrames(); - bool retval = false; - foreach (StackFrame sf in sfs) - { - string sMethod = sf.GetMethod().Name; - string sNamespace = sf.GetMethod().ReflectedType.Namespace; - string sType = sf.GetMethod().ReflectedType.Name; - if (sMethod.ToUpper().Contains("SCROLL") || sType.ToUpper().Contains("SCROLL")) - { - retval = true; - Console.WriteLine("{0}.{1}.{2}", sNamespace, sType, sMethod); - } - } - return retval; - } - /// - /// This will clear the Output window when run in the Development Environment - /// Add EnvDTE and EnvDTE80 to references from .NET - /// - public static void ClearOutputWindow() - { -#if (DEBUG) - try - { - EnvDTE80.DTE2 dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.8.0"); - dte2.ToolWindows.OutputWindow.ActivePane.Clear(); - } - catch (Exception ex) - { - Console.WriteLine("ClearOutputWindow {0} - {1}\r\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace); - } -#endif - } - } - public static class HWndCounter - { - [DllImport("kernel32.dll")] - private static extern IntPtr GetCurrentProcess(); - - [DllImport("user32.dll")] - private static extern uint GetGuiResources(IntPtr hProcess, uint uiFlags); - - private enum ResourceType - { - Gdi = 0, - User = 1 - } - public static void GetWindowHandlesForCurrentProcess(IntPtr hWnd) - { - GetWindowHandlesForCurrentProcess(hWnd, ""); - } - private static uint lastUserObject = 0; - public static void GetWindowHandlesForCurrentProcess(IntPtr hWnd, string str, params object[] objects) - { - IntPtr processHandle = GetCurrentProcess(); - uint gdiObjects = GetGuiResources(processHandle, (uint)ResourceType.Gdi); - uint userObjects = GetGuiResources(processHandle, (uint)ResourceType.User); - if (lastUserObject != userObjects) - Console.WriteLine("winhandle count = {0} GDIObjs {1} UserObjs {2} dif {3} {4}", gdiObjects + userObjects, gdiObjects, userObjects,(int)userObjects - (int)lastUserObject, string.Format(str, objects)); - lastUserObject = userObjects; - //return Convert.ToInt32(gdiObjects + userObjects); - } - } - -} diff --git a/PROMS/Volian.Controls.Library/AlphabeticalNumbering.cs b/PROMS/Volian.Controls.Library/AlphabeticalNumbering.cs deleted file mode 100644 index c008ab32..00000000 --- a/PROMS/Volian.Controls.Library/AlphabeticalNumbering.cs +++ /dev/null @@ -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])); - // } - //} - } -} diff --git a/PROMS/Volian.Controls.Library/AnnotationDetails.Designer.cs b/PROMS/Volian.Controls.Library/AnnotationDetails.Designer.cs deleted file mode 100644 index 19adb53a..00000000 --- a/PROMS/Volian.Controls.Library/AnnotationDetails.Designer.cs +++ /dev/null @@ -1,391 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class AnnotationDetails - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip(); - this.rtxbComment = new System.Windows.Forms.RichTextBox(); - this.btnSaveAnnotation = new DevComponents.DotNetBar.ButtonX(); - this.btnCancelAnnoation = new DevComponents.DotNetBar.ButtonX(); - this.cbGridAnnoType = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.btnRemoveAnnotation = new DevComponents.DotNetBar.ButtonX(); - this.btnAddAnnotation = new DevComponents.DotNetBar.ButtonX(); - this.btnEPAnnotation = new DevComponents.DotNetBar.ButtonX(); - this.pannelAnnoEdit = new DevComponents.DotNetBar.PanelEx(); - this.labelX1 = new DevComponents.DotNetBar.LabelX(); - this.panelAnnoEditBtns = new DevComponents.DotNetBar.PanelEx(); - this.expandableSplitter4 = new DevComponents.DotNetBar.ExpandableSplitter(); - this.pannelAnnoGrid = new DevComponents.DotNetBar.PanelEx(); - this.dgAnnotations = new DevComponents.DotNetBar.Controls.DataGridViewX(); - this.myAnnotationTypeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dTSDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.userIDDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.searchTextDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.itemAnnotationsBindingSource = new System.Windows.Forms.BindingSource(this.components); - this.pannelAnnoEdit.SuspendLayout(); - this.panelAnnoEditBtns.SuspendLayout(); - this.pannelAnnoGrid.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dgAnnotations)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.itemAnnotationsBindingSource)).BeginInit(); - this.SuspendLayout(); - // - // superTooltip1 - // - this.superTooltip1.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray); - this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - // - // rtxbComment - // - this.rtxbComment.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.rtxbComment.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); - this.rtxbComment.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.rtxbComment.Location = new System.Drawing.Point(65, 27); - this.rtxbComment.Margin = new System.Windows.Forms.Padding(2); - this.rtxbComment.Name = "rtxbComment"; - this.rtxbComment.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; - this.rtxbComment.Size = new System.Drawing.Size(368, 237); - this.superTooltip1.SetSuperTooltip(this.rtxbComment, new DevComponents.DotNetBar.SuperTooltipInfo("Annotation", "", "Enter the annotation information here.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.rtxbComment.TabIndex = 1; - this.rtxbComment.Text = ""; - this.rtxbComment.TextChanged += new System.EventHandler(this.rtxbComment_TextChanged); - // - // btnSaveAnnotation - // - this.btnSaveAnnotation.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnSaveAnnotation.Enabled = false; - this.btnSaveAnnotation.Location = new System.Drawing.Point(368, 3); - this.btnSaveAnnotation.Margin = new System.Windows.Forms.Padding(2); - this.btnSaveAnnotation.Name = "btnSaveAnnotation"; - this.btnSaveAnnotation.Size = new System.Drawing.Size(53, 20); - this.superTooltip1.SetSuperTooltip(this.btnSaveAnnotation, new DevComponents.DotNetBar.SuperTooltipInfo("Save Changes", "", "This will save the new annotation or changes made to an existing annotation.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnSaveAnnotation.TabIndex = 9; - this.btnSaveAnnotation.Text = "Save"; - this.btnSaveAnnotation.Click += new System.EventHandler(this.btnSaveAnnotation_Click); - // - // btnCancelAnnoation - // - this.btnCancelAnnoation.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnCancelAnnoation.Enabled = false; - this.btnCancelAnnoation.Location = new System.Drawing.Point(301, 3); - this.btnCancelAnnoation.Margin = new System.Windows.Forms.Padding(2); - this.btnCancelAnnoation.Name = "btnCancelAnnoation"; - this.btnCancelAnnoation.Size = new System.Drawing.Size(52, 20); - this.superTooltip1.SetSuperTooltip(this.btnCancelAnnoation, new DevComponents.DotNetBar.SuperTooltipInfo("Cancel", "", "This will cancel the changes made to the annotation text and type selection", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(145, 100))); - this.btnCancelAnnoation.TabIndex = 8; - this.btnCancelAnnoation.Text = "Cancel"; - this.btnCancelAnnoation.Click += new System.EventHandler(this.btnCancelAnnoation_Click); - // - // cbGridAnnoType - // - this.cbGridAnnoType.DisplayMember = "Text"; - this.cbGridAnnoType.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.cbGridAnnoType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGridAnnoType.FlatStyle = System.Windows.Forms.FlatStyle.Standard; - this.cbGridAnnoType.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbGridAnnoType.ForeColor = System.Drawing.SystemColors.WindowText; - this.cbGridAnnoType.ItemHeight = 17; - this.cbGridAnnoType.Location = new System.Drawing.Point(100, 3); - this.cbGridAnnoType.Margin = new System.Windows.Forms.Padding(2); - this.cbGridAnnoType.Name = "cbGridAnnoType"; - this.cbGridAnnoType.PreventEnterBeep = true; - this.cbGridAnnoType.Size = new System.Drawing.Size(184, 23); - this.superTooltip1.SetSuperTooltip(this.cbGridAnnoType, new DevComponents.DotNetBar.SuperTooltipInfo("Select Annotation Type", "", "This drop down list contains the possible annotation types.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbGridAnnoType.TabIndex = 7; - this.cbGridAnnoType.WatermarkBehavior = DevComponents.DotNetBar.eWatermarkBehavior.HideNonEmpty; - this.cbGridAnnoType.WatermarkText = "Select Annotation Type"; - this.cbGridAnnoType.SelectedValueChanged += new System.EventHandler(this.cbGridAnnoType_SelectedValueChanged); - // - // btnRemoveAnnotation - // - this.btnRemoveAnnotation.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnRemoveAnnotation.Location = new System.Drawing.Point(4, 28); - this.btnRemoveAnnotation.Margin = new System.Windows.Forms.Padding(2); - this.btnRemoveAnnotation.Name = "btnRemoveAnnotation"; - this.btnRemoveAnnotation.Size = new System.Drawing.Size(53, 20); - this.superTooltip1.SetSuperTooltip(this.btnRemoveAnnotation, new DevComponents.DotNetBar.SuperTooltipInfo("Remove Annotation", "", "This will remove the currently selected annotation.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnRemoveAnnotation.TabIndex = 4; - this.btnRemoveAnnotation.Text = "Remove"; - this.btnRemoveAnnotation.Click += new System.EventHandler(this.btnRemoveAnnotation_Click); - // - // btnAddAnnotation - // - this.btnAddAnnotation.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnAddAnnotation.Location = new System.Drawing.Point(4, 3); - this.btnAddAnnotation.Margin = new System.Windows.Forms.Padding(2); - this.btnAddAnnotation.Name = "btnAddAnnotation"; - this.btnAddAnnotation.Size = new System.Drawing.Size(53, 20); - this.superTooltip1.SetSuperTooltip(this.btnAddAnnotation, new DevComponents.DotNetBar.SuperTooltipInfo("Add New Annotation", "", "This button will create a new annotation.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnAddAnnotation.TabIndex = 3; - this.btnAddAnnotation.Text = "Add"; - this.btnAddAnnotation.Click += new System.EventHandler(this.btnAddAnnotation_Click); - // - // btnEPAnnotation - // - this.btnEPAnnotation.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnEPAnnotation.Location = new System.Drawing.Point(4, 52); - this.btnEPAnnotation.Margin = new System.Windows.Forms.Padding(2); - this.btnEPAnnotation.Name = "btnEPAnnotation"; - this.btnEPAnnotation.Size = new System.Drawing.Size(53, 20); - this.superTooltip1.SetSuperTooltip(this.btnEPAnnotation, new DevComponents.DotNetBar.SuperTooltipInfo("Open Annotation", "", "This will open Electronic Procedure Details for this Annotation.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnEPAnnotation.TabIndex = 5; - this.btnEPAnnotation.Text = "Open"; - this.btnEPAnnotation.Visible = false; - this.btnEPAnnotation.Click += new System.EventHandler(this.btnEPAnnotation_Click); - // - // pannelAnnoEdit - // - this.pannelAnnoEdit.CanvasColor = System.Drawing.SystemColors.Control; - this.pannelAnnoEdit.Controls.Add(this.rtxbComment); - this.pannelAnnoEdit.Controls.Add(this.btnSaveAnnotation); - this.pannelAnnoEdit.Controls.Add(this.btnCancelAnnoation); - this.pannelAnnoEdit.Controls.Add(this.labelX1); - this.pannelAnnoEdit.Controls.Add(this.cbGridAnnoType); - this.pannelAnnoEdit.Controls.Add(this.panelAnnoEditBtns); - this.pannelAnnoEdit.DisabledBackColor = System.Drawing.Color.Empty; - this.pannelAnnoEdit.Dock = System.Windows.Forms.DockStyle.Fill; - this.pannelAnnoEdit.Location = new System.Drawing.Point(411, 0); - this.pannelAnnoEdit.Margin = new System.Windows.Forms.Padding(2); - this.pannelAnnoEdit.Name = "pannelAnnoEdit"; - this.pannelAnnoEdit.Size = new System.Drawing.Size(432, 264); - this.pannelAnnoEdit.Style.Alignment = System.Drawing.StringAlignment.Center; - this.pannelAnnoEdit.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.pannelAnnoEdit.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.pannelAnnoEdit.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.pannelAnnoEdit.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.pannelAnnoEdit.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.pannelAnnoEdit.Style.GradientAngle = 90; - this.pannelAnnoEdit.TabIndex = 16; - this.pannelAnnoEdit.Text = "panelEx2"; - this.pannelAnnoEdit.ThemeAware = true; - // - // labelX1 - // - this.labelX1.AutoSize = true; - // - // - // - this.labelX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.labelX1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelX1.Location = new System.Drawing.Point(70, 6); - this.labelX1.Margin = new System.Windows.Forms.Padding(2); - this.labelX1.Name = "labelX1"; - this.labelX1.Size = new System.Drawing.Size(29, 14); - this.labelX1.TabIndex = 10; - this.labelX1.Text = "Type:"; - // - // panelAnnoEditBtns - // - this.panelAnnoEditBtns.CanvasColor = System.Drawing.SystemColors.Control; - this.panelAnnoEditBtns.Controls.Add(this.btnEPAnnotation); - this.panelAnnoEditBtns.Controls.Add(this.btnRemoveAnnotation); - this.panelAnnoEditBtns.Controls.Add(this.btnAddAnnotation); - this.panelAnnoEditBtns.DisabledBackColor = System.Drawing.Color.Empty; - this.panelAnnoEditBtns.Dock = System.Windows.Forms.DockStyle.Left; - this.panelAnnoEditBtns.Location = new System.Drawing.Point(0, 0); - this.panelAnnoEditBtns.Margin = new System.Windows.Forms.Padding(2); - this.panelAnnoEditBtns.Name = "panelAnnoEditBtns"; - this.panelAnnoEditBtns.Size = new System.Drawing.Size(65, 264); - this.panelAnnoEditBtns.Style.Alignment = System.Drawing.StringAlignment.Center; - this.panelAnnoEditBtns.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.panelAnnoEditBtns.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.panelAnnoEditBtns.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.panelAnnoEditBtns.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.panelAnnoEditBtns.Style.GradientAngle = 90; - this.panelAnnoEditBtns.TabIndex = 11; - this.panelAnnoEditBtns.ThemeAware = true; - // - // expandableSplitter4 - // - this.expandableSplitter4.BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(101)))), ((int)(((byte)(147)))), ((int)(((byte)(207))))); - this.expandableSplitter4.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.expandableSplitter4.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.expandableSplitter4.ExpandFillColor = System.Drawing.Color.FromArgb(((int)(((byte)(101)))), ((int)(((byte)(147)))), ((int)(((byte)(207))))); - this.expandableSplitter4.ExpandFillColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.expandableSplitter4.ExpandLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.expandableSplitter4.ExpandLineColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; - this.expandableSplitter4.GripDarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.expandableSplitter4.GripDarkColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; - this.expandableSplitter4.GripLightColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255))))); - this.expandableSplitter4.GripLightColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.expandableSplitter4.HotBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(252)))), ((int)(((byte)(151)))), ((int)(((byte)(61))))); - this.expandableSplitter4.HotBackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(184)))), ((int)(((byte)(94))))); - this.expandableSplitter4.HotBackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemPressedBackground2; - this.expandableSplitter4.HotBackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemPressedBackground; - this.expandableSplitter4.HotExpandFillColor = System.Drawing.Color.FromArgb(((int)(((byte)(101)))), ((int)(((byte)(147)))), ((int)(((byte)(207))))); - this.expandableSplitter4.HotExpandFillColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.expandableSplitter4.HotExpandLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.expandableSplitter4.HotExpandLineColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; - this.expandableSplitter4.HotGripDarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(101)))), ((int)(((byte)(147)))), ((int)(((byte)(207))))); - this.expandableSplitter4.HotGripDarkColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.expandableSplitter4.HotGripLightColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255))))); - this.expandableSplitter4.HotGripLightColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.expandableSplitter4.Location = new System.Drawing.Point(409, 0); - this.expandableSplitter4.Margin = new System.Windows.Forms.Padding(2); - this.expandableSplitter4.Name = "expandableSplitter4"; - this.expandableSplitter4.Size = new System.Drawing.Size(2, 264); - this.expandableSplitter4.Style = DevComponents.DotNetBar.eSplitterStyle.Office2007; - this.expandableSplitter4.TabIndex = 15; - this.expandableSplitter4.TabStop = false; - // - // pannelAnnoGrid - // - this.pannelAnnoGrid.CanvasColor = System.Drawing.SystemColors.Control; - this.pannelAnnoGrid.Controls.Add(this.dgAnnotations); - this.pannelAnnoGrid.DisabledBackColor = System.Drawing.Color.Empty; - this.pannelAnnoGrid.Dock = System.Windows.Forms.DockStyle.Left; - this.pannelAnnoGrid.Location = new System.Drawing.Point(0, 0); - this.pannelAnnoGrid.Margin = new System.Windows.Forms.Padding(2); - this.pannelAnnoGrid.Name = "pannelAnnoGrid"; - this.pannelAnnoGrid.Size = new System.Drawing.Size(409, 264); - this.pannelAnnoGrid.Style.Alignment = System.Drawing.StringAlignment.Center; - this.pannelAnnoGrid.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.pannelAnnoGrid.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.pannelAnnoGrid.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.pannelAnnoGrid.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.pannelAnnoGrid.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.pannelAnnoGrid.Style.GradientAngle = 90; - this.pannelAnnoGrid.TabIndex = 14; - this.pannelAnnoGrid.Text = "panelEx2"; - this.pannelAnnoGrid.ThemeAware = true; - // - // dgAnnotations - // - this.dgAnnotations.AutoGenerateColumns = false; - this.dgAnnotations.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; - this.dgAnnotations.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; - this.dgAnnotations.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgAnnotations.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.myAnnotationTypeDataGridViewTextBoxColumn, - this.dTSDataGridViewTextBoxColumn, - this.userIDDataGridViewTextBoxColumn, - this.searchTextDataGridViewTextBoxColumn}); - this.dgAnnotations.DataSource = this.itemAnnotationsBindingSource; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgAnnotations.DefaultCellStyle = dataGridViewCellStyle1; - this.dgAnnotations.Dock = System.Windows.Forms.DockStyle.Fill; - this.dgAnnotations.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(215)))), ((int)(((byte)(229))))); - this.dgAnnotations.HighlightSelectedColumnHeaders = false; - this.dgAnnotations.Location = new System.Drawing.Point(0, 0); - this.dgAnnotations.Margin = new System.Windows.Forms.Padding(2); - this.dgAnnotations.MultiSelect = false; - this.dgAnnotations.Name = "dgAnnotations"; - this.dgAnnotations.RowHeadersVisible = false; - this.dgAnnotations.RowTemplate.Height = 24; - this.dgAnnotations.RowTemplate.ReadOnly = true; - this.dgAnnotations.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.dgAnnotations.SelectAllSignVisible = false; - this.dgAnnotations.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgAnnotations.Size = new System.Drawing.Size(409, 264); - this.dgAnnotations.TabIndex = 1; - this.dgAnnotations.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgAnnotations_CellClick); - // - // myAnnotationTypeDataGridViewTextBoxColumn - // - this.myAnnotationTypeDataGridViewTextBoxColumn.DataPropertyName = "MyAnnotationType"; - this.myAnnotationTypeDataGridViewTextBoxColumn.HeaderText = "Type"; - this.myAnnotationTypeDataGridViewTextBoxColumn.Name = "myAnnotationTypeDataGridViewTextBoxColumn"; - this.myAnnotationTypeDataGridViewTextBoxColumn.Width = 56; - // - // dTSDataGridViewTextBoxColumn - // - this.dTSDataGridViewTextBoxColumn.DataPropertyName = "DTS"; - this.dTSDataGridViewTextBoxColumn.HeaderText = "Date"; - this.dTSDataGridViewTextBoxColumn.Name = "dTSDataGridViewTextBoxColumn"; - this.dTSDataGridViewTextBoxColumn.Width = 55; - // - // userIDDataGridViewTextBoxColumn - // - this.userIDDataGridViewTextBoxColumn.DataPropertyName = "UserID"; - this.userIDDataGridViewTextBoxColumn.HeaderText = "User"; - this.userIDDataGridViewTextBoxColumn.Name = "userIDDataGridViewTextBoxColumn"; - this.userIDDataGridViewTextBoxColumn.Width = 54; - // - // searchTextDataGridViewTextBoxColumn - // - this.searchTextDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.searchTextDataGridViewTextBoxColumn.DataPropertyName = "SearchText"; - this.searchTextDataGridViewTextBoxColumn.HeaderText = "Description"; - this.searchTextDataGridViewTextBoxColumn.Name = "searchTextDataGridViewTextBoxColumn"; - // - // itemAnnotationsBindingSource - // - this.itemAnnotationsBindingSource.DataSource = typeof(VEPROMS.CSLA.Library.ItemAnnotation); - // - // AnnotationDetails - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.pannelAnnoEdit); - this.Controls.Add(this.expandableSplitter4); - this.Controls.Add(this.pannelAnnoGrid); - this.Margin = new System.Windows.Forms.Padding(2); - this.Name = "AnnotationDetails"; - this.Size = new System.Drawing.Size(843, 264); - this.pannelAnnoEdit.ResumeLayout(false); - this.pannelAnnoEdit.PerformLayout(); - this.panelAnnoEditBtns.ResumeLayout(false); - this.pannelAnnoGrid.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.dgAnnotations)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.itemAnnotationsBindingSource)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private DevComponents.DotNetBar.SuperTooltip superTooltip1; - private DevComponents.DotNetBar.PanelEx pannelAnnoEdit; - private System.Windows.Forms.RichTextBox rtxbComment; - private DevComponents.DotNetBar.ButtonX btnSaveAnnotation; - private DevComponents.DotNetBar.ButtonX btnCancelAnnoation; - private DevComponents.DotNetBar.LabelX labelX1; - private DevComponents.DotNetBar.Controls.ComboBoxEx cbGridAnnoType; - private DevComponents.DotNetBar.PanelEx panelAnnoEditBtns; - private DevComponents.DotNetBar.ButtonX btnRemoveAnnotation; - private DevComponents.DotNetBar.ButtonX btnAddAnnotation; - private DevComponents.DotNetBar.ExpandableSplitter expandableSplitter4; - private DevComponents.DotNetBar.PanelEx pannelAnnoGrid; - private System.Windows.Forms.BindingSource itemAnnotationsBindingSource; - private DevComponents.DotNetBar.Controls.DataGridViewX dgAnnotations; - private System.Windows.Forms.DataGridViewTextBoxColumn myAnnotationTypeDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn dTSDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn userIDDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn searchTextDataGridViewTextBoxColumn; - private DevComponents.DotNetBar.ButtonX btnEPAnnotation; - } -} diff --git a/PROMS/Volian.Controls.Library/AnnotationDetails.cs b/PROMS/Volian.Controls.Library/AnnotationDetails.cs deleted file mode 100644 index 45cbeb1d..00000000 --- a/PROMS/Volian.Controls.Library/AnnotationDetails.cs +++ /dev/null @@ -1,730 +0,0 @@ -using JR.Utils.GUI.Forms; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Drawing; -using System.Text; -using System.Text.RegularExpressions; -using System.Windows.Forms; -using System.Xml; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; -using Volian.Pipe.Library; - -namespace Volian.Controls.Library -{ - public delegate void NewMessageDelegate(string NewMessage); - public partial class AnnotationDetails : UserControl - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #region Properties - private bool _LoadingAnnotation = false; - private bool _LoadingGrid = false; - private XmlDocument _ProcList; - private ItemInfo _ProcItem = null; - public ItemInfo ProcItem - { - get { return _ProcItem; } - set - { - // B2019-054 needed to add a check for value being NULL else we would always get a list of PROMS database to choose from (prematurely) - if (!DesignMode && value != null) // B2019-043 need to check if we are just saving changes to the user interface - { - //if (_ProcItem == value) return; // Jeff (Westinghouse) requested list to be provided every time fixes both C2016-007 and B2016-097 - _ProcItem = value; - if (ExeType > 0) CreateProcList(); - } - } - } - - private void CreateProcList() - { - _ProcList = null; - if (_ProcItem == null) return; - _ProcList = new XmlDocument(); - _ProcList.LoadXml(""); - AddItem(0,ProcItem); - //Console.WriteLine(_ProcList.OuterXml); - } - private void AddItem(int parentID, ItemInfo myItemInfo) - { - if (myItemInfo.IsProcedure || myItemInfo.IsSection || myItemInfo.IsHigh || - myItemInfo.IsRNOPart || myItemInfo.IsSequential || myItemInfo.IsNote || - myItemInfo.IsCaution) - { - XmlElement xe = _ProcList.CreateElement(TypeName(myItemInfo)); - AddAttribute(xe, "ItemID", myItemInfo.ItemID); - AddAttribute(xe, "ParentID", parentID); - if (myItemInfo.IsProcedure || myItemInfo.IsSection) - AddAttribute(xe, "Number", myItemInfo.DisplayNumber); - else - AddAttribute(xe, "Number", myItemInfo.MyTab.CleanText); - AddAttribute(xe, "Text", myItemInfo.DisplayText); - _ProcList.DocumentElement.AppendChild(xe); - - if (myItemInfo.Cautions != null) foreach (StepInfo caui in myItemInfo.Cautions) AddItem(myItemInfo.ItemID, caui); - if (myItemInfo.Notes != null) foreach (StepInfo noti in myItemInfo.Notes) AddItem(myItemInfo.ItemID, noti); - if (myItemInfo.RNOs != null) foreach (StepInfo rnoi in myItemInfo.RNOs) AddItem(myItemInfo.ItemID, rnoi); - if (myItemInfo.Sections != null) foreach (SectionInfo seci in myItemInfo.Sections) AddItem(myItemInfo.ItemID, seci); - if (myItemInfo.Steps != null) - { - if(myItemInfo.IsSection || (myItemInfo.IsHigh && SubStepHasRNOs(myItemInfo.Steps))) - foreach (StepInfo stpi in myItemInfo.Steps) AddItem(myItemInfo.ItemID, stpi); - } - } - } - - private string TypeName(ItemInfo myItemInfo) - { - if (myItemInfo.IsProcedure) return "Procedure"; - if (myItemInfo.IsSection) return "Section"; - if (myItemInfo.IsHigh) return "Step"; - if (myItemInfo.IsRNOPart) return "RNO"; - if (myItemInfo.IsCaution) return "Caution"; - if (myItemInfo.IsNote) return "Note"; - return "Substep"; - } - private bool SubStepHasRNOs(ItemInfoList substeps) - { - foreach (ItemInfo ii in substeps) - if (ii.RNOs != null) return true; - return false; - } - private ItemInfo _CurrentItem = null; - public ItemInfo CurrentItem - { - get { return _CurrentItem; } - set - { - if (!DesignMode && value != null) // B2019-043 need to check if we are just saving changes to the user interface - { - _CurrentItem = value; - SetupCurrentItemValues(); - SetupConfigEdit(); - // 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. - if (ExeType > 0 && Volian.Base.Library.VlnSettings.GetCommandFlag("NamedPipe")) SendPromsAnnotationData(); - } - } - } - private int _FromType; - private string _ROPath; - private void SetupCurrentItemValues() - { - _FromType = 0; - if (CurrentItem.FirstSibling.ItemPartCount > 0) - _FromType = CurrentItem.FirstSibling.ItemParts[0].FromType; - _ROPath = ""; - if (CurrentItem.MyDocVersion != null) - if (CurrentItem.MyDocVersion.DocVersionAssociationCount > 0) - _ROPath = CurrentItem.MyDocVersion.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath; - - } - public AnnotationInfo FirstExeAnnotation(ItemInfo ii) - { - if (ii == null) return null; - if (ii.ItemAnnotationCount == 0) return null; - foreach (AnnotationInfo ai in ii.ItemAnnotations) - if (ai.TypeID == ExeType) return ai; - return null; - } - private void SetupConfigEdit() - { - //if (ExeType == 0) ; // initialize ExeType - } - private string _ExePath; - private string _PipeOut; - private string _PipeIn; - // Made _ExeType a lazy load to fix Jeff's (Westinghouse) request that ProcStep data be generated every time - fixes both C2016-007 and B2016-097 - private int _ExeType = 0; - public int ExeType - { - get - { - if (!DesignMode && _ExeType == 0) // B2019-043 need to check if we are just saving changes to the user interface - { - _ExeType = -1; - foreach (AnnotationTypeInfo ati in AnnotationTypeInfoList.Get()) - { - if ((ati.Config ?? "") != "") - { - _ExePath = ati.AnnotationTypeConfig.Integration_Executable; - _PipeIn = ati.AnnotationTypeConfig.Integration_PipeIn; - _PipeOut = ati.AnnotationTypeConfig.Integration_PipeOut; - if (_ExePath != "" && _PipeIn != "" && _PipeOut != "") - { - _ExeType = ati.TypeID; - break; - } - } - } - } - return _ExeType; - } - } - private DisplaySearch _AnnotationSearch; - - private AnnotationInfoList _Annotations; - public AnnotationInfoList Annotations - { - get { return _Annotations; } - set - { - if (!DesignMode) // B2019-043 need to check if we are just saving changes to the user interface - { - _Annotations = value; - itemAnnotationsBindingSource.DataSource = _Annotations; - } - } - } - - private AnnotationInfo _CurrentAnnotation = null; - public AnnotationInfo CurrentAnnotation - { - get { return _CurrentAnnotation; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - if (_CurrentAnnotation == null && value == null) return; // No Change - if (_CurrentAnnotation != null && value != null) - if (_CurrentAnnotation.AnnotationID == value.AnnotationID) return; // No Change - //vlnStackTrace.ShowStack("CurrentAnnotation = '{0}' Old = '{1}'", value, _CurrentAnnotation); - if (_CurrentAnnotation != null || _AddingAnnotation) - { - if (AnnotationDirty) - SaveAnnotation(); - } - _CurrentAnnotation = value; - InitializeAnnotation(); - } - } - - private bool _AnnotationDirty = false; - public bool AnnotationDirty - { - get { return _AnnotationDirty; } - set - { - btnRemoveAnnotation.Enabled = btnAddAnnotation.Enabled = !value; - btnSaveAnnotation.Enabled = btnCancelAnnoation.Enabled = value; - _AddingAnnotation = value && (CurrentAnnotation == null); - _AnnotationDirty = value; - } - } - - public string AnnotationText - { - get { return rtxbComment.Text; } - set - { - if (!DesignMode) // B2019-043 need to check if we are just saving changes to the user interface - { - if (value != null) - { - rtxbComment.Text = Regex.Replace(value, @"\\u([0-9]{1,4})\?", m => Convert.ToChar(int.Parse(m.Groups[1].Value)).ToString()); - } - if (rtxbComment.Text != string.Empty) - rtxbComment.SelectionStart = rtxbComment.TextLength; // position cursor to end of text - } - } - } - - public string AnnotationRTFText - { - get { return rtxbComment.Rtf; } - set - { - if (!DesignMode) // B2019-043 need to check if we are just saving changes to the user interface - { - rtxbComment.Rtf = value; - if (rtxbComment.Rtf != string.Empty) - rtxbComment.SelectionStart = rtxbComment.TextLength; // position cursor to end of text - } - } - } - private UserInfo _MyUserInfo; - public UserInfo MyUserInfo - { - get { return _MyUserInfo; } - set { _MyUserInfo = value; } - } - #endregion - - #region Constructors - public AnnotationDetails() - { - InitializeComponent(); -//#if(DEBUG) - //Resize+=new EventHandler(AnnotationDetails_Resize); // Debug the resize event -//#endif - Resize += AnnotationDetails_Resize; - } - - void AnnotationDetails_Resize(object sender, EventArgs e) - { - if(Height > 0) - rtxbComment.Height = Height - rtxbComment.Top; - } - #endregion - - #region Events - private bool _AddingAnnotation = false; - private void btnAddAnnotation_Click(object sender, EventArgs e) - { - dgAnnotations.ClearSelection(); - CurrentAnnotation = null; - _AddingAnnotation = true; - rtxbComment.Focus(); - } - - private void btnRemoveAnnotation_Click(object sender, EventArgs e) - { - // CSM B2024-068 / B2024-069 - check if current annotation is not selected before removal of annotation - if (CurrentAnnotation != null) - { - //using (Annotation annotation = CurrentAnnotation.Get()) - //{ - // annotation.Delete(); - _AnnotationSearch.LoadingList = true; - Annotation.DeleteAnnotation(CurrentAnnotation); - // annotation.Save(); - _AnnotationSearch.LoadingList = false; - CurrentAnnotation = null; - UpdateAnnotationGrid(); - _AnnotationSearch.UpdateAnnotationSearchResults(); // B2019-004: update search results list when an annotation is removed. - //} - } - else - { - FlexibleMessageBox.Show("You Must Select an Annotation To Remove", "Annotation Not Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - - } - - private void btnSaveAnnotation_Click(object sender, EventArgs e) - { - if (cbGridAnnoType.SelectedIndex == -1) - { - FlexibleMessageBox.Show("You Must Select an Annotation Type", "Annotation Type Not Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - cbGridAnnoType.Focus(); - return; - } - if (rtxbComment.Text == string.Empty) - { - FlexibleMessageBox.Show("You Must Enter Annotation Text", "Annotation Text Is Blank", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - rtxbComment.Focus(); - return; - } - SaveAnnotation(); - - } - - private void btnCancelAnnoation_Click(object sender, EventArgs e) - { - InitializeAnnotation(); - } - - private void cbGridAnnoType_SelectedValueChanged(object sender, EventArgs e) - { - if (!_LoadingAnnotation) - AnnotationDirty = true; - } - - //C2025-023 - Electronic Procedures - Modifications to PROMS - // Only show Open button if it is an EPAnnotationType - private void dgAnnotations_CellClick(object sender, DataGridViewCellEventArgs e) - { - btnEPAnnotation.Visible = false; - - if (!_LoadingGrid) // Only set the Current Annotation when not loading the grid - { - if ((_Annotations != null) && (dgAnnotations.Rows.Count > 0)) - { - CurrentAnnotation = _Annotations[dgAnnotations.CurrentRow.Index]; - if (CurrentAnnotation.MyAnnotationType.IsEPAnnotationType && CurrentItem.HasEPformat(CurrentAnnotation.MyAnnotationType.TypeID)) - btnEPAnnotation.Visible = true; - } - else - CurrentAnnotation = null; - } - } - - private void rtxbComment_TextChanged(object sender, EventArgs e) - { - if (!_LoadingAnnotation) - AnnotationDirty = true; - } - #endregion - - #region LoadControlData - - public void SetupAnnotations(DisplaySearch annosrch) - { - _LoadingAnnotation = true; - _AnnotationSearch = annosrch; // reference the Annotation Search to update its lists - - cbGridAnnoType.DisplayMember = "Name"; - cbGridAnnoType.ValueMember = "TypeId"; - - //C2025 - 027 Annotation Type Filtering - cbGridAnnoType.WatermarkText = "Select Annotation Type"; - cbGridAnnoType.DataSource = VEPROMS.CSLA.Library.AnnotationstypeSelections.Get(MyUserInfo.UserID); - - // If there are no annotatons, then selected index is -1 (not defined), otherwise select the first. - // This was done so that it could be saved if there was text entered but user moves to another steprtb without selecting save button - // so that annotation gets saved. - if (cbGridAnnoType.Items.Count == 0) - cbGridAnnoType.SelectedIndex = -1; - else - cbGridAnnoType.SelectedIndex = 0; - _LoadingAnnotation = false; - } - - private void InitializeAnnotation() - { - //vlnCSLAStackTrace.ShowStack("InitializeAnnotation - CurrentAnnotation = {0}", CurrentAnnotation); - _LoadingAnnotation = true; - if (CurrentAnnotation == null) - { - if (cbGridAnnoType.Items.Count == 0) // see comment for SetupAnnotations - cbGridAnnoType.SelectedIndex = -1; - else - cbGridAnnoType.SelectedIndex = 0; - AnnotationText = ""; - } - else - { - cbGridAnnoType.SelectedValue = CurrentAnnotation.TypeID; - if (CurrentAnnotation.RtfText != "") - AnnotationRTFText = CurrentAnnotation.RtfText; - else - AnnotationText = CurrentAnnotation.SearchText; - } - _LoadingAnnotation = false; - AnnotationDirty = false; - if (!rtxbComment.Visible) - rtxbComment.Visible = true; - if (!_LoadingGrid) - rtxbComment.Focus(); // Set the focus to the comment text - - // Bug Fix: B2016-274 if admin user also has reviewer set, allow admin user to modify existing annotations - if (CurrentAnnotation != null && (!(MyUserInfo.IsAdministrator() || MyUserInfo.IsSetAdministrator(CurrentAnnotation.MyItem.MyDocVersion)) && (MyUserInfo.IsReviewer(CurrentAnnotation.MyItem.MyDocVersion ) && CurrentAnnotation.UserID != MyUserInfo.UserID))) - { - btnRemoveAnnotation.Enabled = false; - cbGridAnnoType.Enabled = false; - rtxbComment.Enabled = false; - } - else - { - btnRemoveAnnotation.Enabled = true; - cbGridAnnoType.Enabled = true; - rtxbComment.Enabled = true; - } - } - - private void CheckClientProcess() - { - if (ClientProcess.HasExited) - { - ClientProcess = null; - StartClientProcess(); - } - } - void ClientProcess_Exited(object sender, EventArgs e) - { - ClientProcess = null; - } - private Process _ClientProcess; - - public Process ClientProcess - { - get { - if (_ClientProcess == null) - { - StartClientProcess(); - } - return _ClientProcess; - } - set { _ClientProcess = value; } - } - - private void StartClientProcess() - { - if (_ExePath != null) // B2019-043 if we are just saving changes to the user interface don't do anything - { - _ClientProcess = Process.Start(_ExePath); - _ClientProcess.WaitForInputIdle(); - _ClientProcess.Exited += ClientProcess_Exited; - } - } - private void SendPromsAnnotationData() - { - //Console.WriteLine("Send {0}", CurrentItem); - XmlDocument xdMessage = new XmlDocument(); - xdMessage.LoadXml(""); - // Add Steps Data - if(_ProcList != null) - { - xdMessage.DocumentElement.AppendChild(xdMessage.ImportNode(_ProcList.DocumentElement, true)); - _ProcList = null; - } - // Add Config Data - AnnotationInfo ai = FirstExeAnnotation(CurrentItem); - if (ai != null && ai.Config.Length > 0) - { - XmlDocument xdConfig = new XmlDocument(); - xdConfig.LoadXml(ai.Config); - ProcedureInfo currentProc = CurrentItem.MyProcedure; - XmlNode nd = xdMessage.DocumentElement.SelectSingleNode("//PromsAnnotationConfig"); - nd.AppendChild(xdMessage.ImportNode(xdConfig.DocumentElement, true)); - } - // Add Local Info - AddAttribute(xdMessage.DocumentElement, "ItemID", CurrentItem.ItemID); - AddAttribute(xdMessage.DocumentElement, "ROPath", _ROPath); - AddAttribute(xdMessage.DocumentElement, "FromType", _FromType); - AddAttribute(xdMessage.DocumentElement, "Type", CurrentItem.MyContent.Type); - PipeToClient.Send(xdMessage.OuterXml); - PipeFromClient.Listen(); - } - private void AddAttribute(XmlElement xe, string name, object value) - { - XmlAttribute xa = xe.OwnerDocument.CreateAttribute(name); - xa.Value= value.ToString(); - xe.Attributes.Append(xa); - } - private PipeClient _PipeToClient; - public PipeClient PipeToClient - { - get - { - if (_PipeToClient == null) - _PipeToClient = new PipeClient(_PipeOut); - return _PipeToClient; - } - } - private PipeServer _PipeFromClient; - public PipeServer PipeFromClient - { - get - { - if (_PipeFromClient == null) - { - _PipeFromClient = new PipeServer(_PipeIn); - _PipeFromClient.PipeMessage += PipesMessageHandler; - } - return _PipeFromClient; - } - } - void PipesMessageHandler(string message) - { - try - { - if (this.InvokeRequired) - { - this.Invoke(new NewMessageDelegate(PipesMessageHandler), message); - } - else - { - ProcessMessage(message); - } - } - catch (Exception ex) - { - PipesMessageHandler(string.Format("{0} - {1}", ex.GetType().FullName, ex.Message)); - } - } - - private void ProcessMessage(string message) - { - //Console.WriteLine(message); - XmlDocument xd = new XmlDocument(); - xd.LoadXml(message); - string Mode = GetAttribute(xd, "ClientToProms", "Mode"); - switch (Mode) - { - case "SaveAnnotationConfig": - // Get the AnnotationID - int itemID = GetAttributeInt(xd,"ClientToProms","ItemID"); - // Get the Config - string config = GetNode(xd,"PromsAnnotationConfig").InnerXml; - // Save updated Config Value - AnnotationInfo ai = FirstExeAnnotation(ItemInfo.Get(itemID)); - if(ai != null) // Update existing Annotation - using(Annotation aa = Annotation.Get(ai.AnnotationID)) - { - if (config == "") - { - Annotation.DeleteAnnotation(ai); - UpdateAnnotationGrid(); - } - else - { - aa.Config = config; - aa.DTS = DateTime.Now; - aa.UserID = Volian.Base.Library.VlnSettings.UserID; - aa.Save(); - AnnotationInfo.Refresh(aa); - UpdateAnnotationGrid(); - } - } - else // Add a new Annotation - { - if (config != "") - { - using (Item myItem = Item.Get(itemID)) - { - using (AnnotationType myType = AnnotationType.Get(ExeType)) - { - using (Annotation annotation = Annotation.MakeAnnotation(myItem, myType, null, "New", config)) - { - annotation.Save(); - UpdateAnnotationGrid(); - } - } - } - } - } - break; - default: - Console.WriteLine("Unknown Message Type {0}", Mode); - break; - } - } - private XmlNode GetNode(XmlDocument xd, string nodeName) - { - return xd.DocumentElement.SelectSingleNode("//" + nodeName); - } - private string GetAttribute(XmlDocument xd, string nodeName, string attrName) - { - return GetNode(xd,nodeName).Attributes[attrName].Value; - } - private int GetAttributeInt(XmlDocument xd, string nodeName, string attrName) - { - return int.Parse(GetAttribute(xd, nodeName, attrName)); - } - #endregion - #region VariousSupportMethods - - /// - /// Set up the Annotation Grid for the given item - /// This is called from frmVEPROMS - /// - /// - public void UpdateAnnotationGrid(ItemInfo currentitem) - { - CurrentItem = currentitem; - btnEPAnnotation.Visible = false; - UpdateAnnotationGrid(); - } - - private void UpdateAnnotationGrid() - { - _LoadingGrid = true; - - if (CurrentItem == null) - _Annotations= null; - else - { - CurrentItem.RefreshItemAnnotations(); - _Annotations = CurrentItem.ItemAnnotations; - } - itemAnnotationsBindingSource.DataSource = _Annotations; - dgAnnotations.Refresh(); - if ((CurrentAnnotation == null || (CurrentItem.ItemID != CurrentAnnotation.ItemID))) - { - if (_Annotations != null && _Annotations.Count > 0) - CurrentAnnotation = _Annotations[0]; - else - CurrentAnnotation = null; - } - FindCurrentAnnotation(); // position to the grid row of the current annotation - _LoadingGrid = false; - if (_Annotations == null || _Annotations.Count == 0) btnRemoveAnnotation.Enabled = false; - } - - /// - /// Find the Current Annotation in the Annotation Grid select the corresponding row - /// Note: this is also called from AnnotationSearch.cs when a search results is selected - /// - public void FindCurrentAnnotation() - { - int row = 0; - if (CurrentAnnotation != null) - { - if (_Annotations != null) - { - foreach (AnnotationInfo ai in _Annotations) - { - if (ai.AnnotationID == CurrentAnnotation.AnnotationID) - { - row = _Annotations.IndexOf(ai);// +1; - break; - } - } - try - { - dgAnnotations.Rows[row].Selected = true; - if (!_LoadingGrid && (dgAnnotations.FirstDisplayedScrollingRowIndex != -1)) - dgAnnotations.FirstDisplayedScrollingRowIndex = row; - } - catch (Exception ex) - { - _MyLog.InfoFormat("Trying to open an annotation which has been removed"); - } - } - } - } - - public void SaveAnnotation() - { - if (cbGridAnnoType.SelectedIndex == -1) return; - if (rtxbComment.Text == string.Empty) return; - using (AnnotationType annotationType = AnnotationType.Get((int)cbGridAnnoType.SelectedValue)) - { - if (_AddingAnnotation) - { - _AddingAnnotation = false; - using (Item myItem = CurrentItem.Get()) - { - using (Annotation annotation = Annotation.MakeAnnotation(myItem, annotationType, rtxbComment.Rtf, rtxbComment.Text, "")) - { - CurrentAnnotation = AnnotationInfo.Get(annotation.AnnotationID); - //annotation.DTS = DateTime.Now; - //annotation.Save(); - } - } - } - else - { - using (Annotation annotation = CurrentAnnotation.Get()) - { - if (annotation != null) // B2024-061 check for null reference - { - annotation.RtfText = rtxbComment.Rtf; - annotation.SearchText = rtxbComment.Text; - annotation.MyAnnotationType = annotationType; - annotation.DTS = DateTime.Now; - annotation.UserID = Volian.Base.Library.VlnSettings.UserID; - annotation.Save(); - } - } - } - } - AnnotationDirty = false; - UpdateAnnotationGrid(); - AnnotationTypeInfoList.Reset(); // B2018-135: refresh annotation type list to update when annotations are used. - } - #endregion - - //C2025-023 - Electronic Procedures - Modifications to PROMS - // Open new Dynamic Form if open button selected - private void btnEPAnnotation_Click(object sender, EventArgs e) - { - frmEPAnnotationDetails EPfrm = new frmEPAnnotationDetails(CurrentAnnotation); - DialogResult dr = EPfrm.ShowDialog(this); - } - } -} diff --git a/PROMS/Volian.Controls.Library/AnnotationDetails.resx b/PROMS/Volian.Controls.Library/AnnotationDetails.resx deleted file mode 100644 index f23589e8..00000000 --- a/PROMS/Volian.Controls.Library/AnnotationDetails.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 156, 17 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/AnnotationSearch.Designer.cs b/PROMS/Volian.Controls.Library/AnnotationSearch.Designer.cs deleted file mode 100644 index 30510392..00000000 --- a/PROMS/Volian.Controls.Library/AnnotationSearch.Designer.cs +++ /dev/null @@ -1,93 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class AnnotationSearch - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.cbAnnoType = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.lbResults = new System.Windows.Forms.ListBox(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip(); - this.SuspendLayout(); - // - // cbAnnoType - // - this.cbAnnoType.DisplayMember = "Text"; - this.cbAnnoType.Dock = System.Windows.Forms.DockStyle.Top; - this.cbAnnoType.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.cbAnnoType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbAnnoType.FormattingEnabled = true; - this.cbAnnoType.ItemHeight = 17; - this.cbAnnoType.Location = new System.Drawing.Point(0, 0); - this.cbAnnoType.Name = "cbAnnoType"; - this.cbAnnoType.Size = new System.Drawing.Size(239, 23); - this.superTooltip1.SetSuperTooltip(this.cbAnnoType, new DevComponents.DotNetBar.SuperTooltipInfo("Select Annotation Search Type", "", "This drop down list contains the posible annotation types. When selected, a list" + - " of the annotions of that type will be displayed below.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbAnnoType.TabIndex = 1; - this.cbAnnoType.WatermarkBehavior = DevComponents.DotNetBar.eWatermarkBehavior.HideNonEmpty; - this.cbAnnoType.WatermarkText = "Select Annotation Type"; - this.cbAnnoType.SelectedValueChanged += new System.EventHandler(this.cbAnnoType_SelectedValueChanged); - // - // lbResults - // - this.lbResults.Dock = System.Windows.Forms.DockStyle.Fill; - this.lbResults.FormattingEnabled = true; - this.lbResults.HorizontalScrollbar = true; - this.lbResults.ItemHeight = 16; - this.lbResults.Location = new System.Drawing.Point(0, 23); - this.lbResults.Name = "lbResults"; - this.lbResults.Size = new System.Drawing.Size(239, 372); - this.lbResults.TabIndex = 2; - this.lbResults.Visible = false; - this.lbResults.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lbResults_MouseMove); - this.lbResults.SelectedValueChanged += new System.EventHandler(this.lbResults_SelectedValueChanged); - // - // superTooltip1 - // - this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - // - // AnnotationSearch - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.lbResults); - this.Controls.Add(this.cbAnnoType); - this.Name = "AnnotationSearch"; - this.Size = new System.Drawing.Size(239, 397); - this.ResumeLayout(false); - - } - - #endregion - - private DevComponents.DotNetBar.Controls.ComboBoxEx cbAnnoType; - private System.Windows.Forms.ListBox lbResults; - private System.Windows.Forms.ToolTip toolTip1; - private DevComponents.DotNetBar.SuperTooltip superTooltip1; - } -} diff --git a/PROMS/Volian.Controls.Library/AnnotationSearch.cs b/PROMS/Volian.Controls.Library/AnnotationSearch.cs deleted file mode 100644 index 19218a76..00000000 --- a/PROMS/Volian.Controls.Library/AnnotationSearch.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; - -namespace Volian.Controls.Library -{ - public partial class AnnotationSearch : UserControl - { - #region Properties - private AnnotationDetails _AnnotationDetails = null; - - private bool _LoadingList = false; - public bool LoadingList - { - get { return _LoadingList; } - set { _LoadingList = value; } - } - - private DisplayTabControl _TabControl; - - #endregion - - #region Constructors - public AnnotationSearch() - { - InitializeComponent(); - } - #endregion - - #region Events - private void cbAnnoType_SelectedValueChanged(object sender, EventArgs e) - { - UpdateAnnotationSearchResults(); - } - - private void lbResults_SelectedValueChanged(object sender, EventArgs e) - { - if (!_LoadingList) - { - _AnnotationDetails.CurrentAnnotation = lbResults.SelectedValue as AnnotationInfo; - if (_AnnotationDetails.CurrentAnnotation != null) - _TabControl.OpenItem(_AnnotationDetails.CurrentAnnotation.MyItem); // open the corresponding procedure text - _AnnotationDetails.FindCurrentAnnotation(); // position to corresponding row in annotation grid - } - } - - private int LastResultsMouseOverIndex = -1; - private void lbResults_MouseMove(object sender, MouseEventArgs e) - { - int ResultsMouseOverIndex = lbResults.IndexFromPoint(e.Location); - if (ResultsMouseOverIndex != -1 && ResultsMouseOverIndex != LastResultsMouseOverIndex) - { - AnnotationInfo ai = lbResults.Items[ResultsMouseOverIndex] as AnnotationInfo; - toolTip1.SetToolTip(lbResults, ai.MyItem.Path); // display location of corresponding procedure text in a tooltip - LastResultsMouseOverIndex = ResultsMouseOverIndex; - } - - } - #endregion - - #region LoadControlData - public void SetupAnnotationSearch(AnnotationDetails annotationDetails, DisplayTabControl tc) - { - _AnnotationDetails = annotationDetails; - cbAnnoType.DisplayMember = "Name"; - cbAnnoType.DataSource = AnnotationTypeInfoList.Get(); - lbResults.MouseMove -= new MouseEventHandler(lbResults_MouseMove); - lbResults.MouseMove += new MouseEventHandler(lbResults_MouseMove); - _TabControl = tc; - } - #endregion - - #region VariousSupportMethods - public void UpdateAnnotationSearchResults() - { - AnnotationTypeInfo ati = cbAnnoType.SelectedValue as AnnotationTypeInfo; - _LoadingList = true; - lbResults.DisplayMember = "SearchText"; - lbResults.DataSource = ati.AnnotationTypeAnnotations; - lbResults.SelectedIndex = -1; - LastResultsMouseOverIndex = -1; - _LoadingList = false; - } - #endregion - - } -} diff --git a/PROMS/Volian.Controls.Library/AnnotationSearch.resx b/PROMS/Volian.Controls.Library/AnnotationSearch.resx deleted file mode 100644 index e8120083..00000000 --- a/PROMS/Volian.Controls.Library/AnnotationSearch.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 121, 17 - - - 17, 17 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/BorderListBox.Designer.cs b/PROMS/Volian.Controls.Library/BorderListBox.Designer.cs deleted file mode 100644 index 482b0277..00000000 --- a/PROMS/Volian.Controls.Library/BorderListBox.Designer.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class BorderListBox - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/BorderListBox.cs b/PROMS/Volian.Controls.Library/BorderListBox.cs deleted file mode 100644 index 72f0a1d6..00000000 --- a/PROMS/Volian.Controls.Library/BorderListBox.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.ComponentModel; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using System.Drawing; -using System.Windows.Forms; - -namespace Volian.Controls.Library -{ - public partial class BorderListBox : ListBox - { - #region Properties - public GridLinePattern SelectedLinePattern - { - get { return (Items[SelectedIndex] as GridLBItem).LinePattern; } - } - #endregion - #region ctor - public BorderListBox() - { - InitializeComponent(); - SetupOptions(); - } - public BorderListBox(IContainer container) - { - container.Add(this); - InitializeComponent(); - SetupOptions(); - } - private void SetupOptions() - { - this.DrawMode = DrawMode.OwnerDrawFixed; - //this.Font.Size; - DrawItem += new DrawItemEventHandler(BorderListBox_DrawItem); - //MeasureItem += new MeasureItemEventHandler(BorderListBox_MeasureItem); - Items.Add(new GridLBItem(GridLinePattern.None)); - Items.Add(new GridLBItem(GridLinePattern.Single)); - Items.Add(new GridLBItem(GridLinePattern.Double)); - Items.Add(new GridLBItem(GridLinePattern.Thick)); - Items.Add(new GridLBItem(GridLinePattern.Dashed)); - Items.Add(new GridLBItem(GridLinePattern.Dotted)); - SelectedIndex = 1; - } - public void SetupFontAndSize(int fontSize) - { - Font = new Font(Font.FontFamily, fontSize, Font.Style); - using (Graphics gr = CreateGraphics()) - { - SizeF mySize = gr.MeasureString("Almg", Font); - ItemHeight = (int)Math.Ceiling(mySize.Height); - } - int newHeight = Items.Count * ItemHeight + 4; - Size = new Size(newHeight, newHeight); - } - #endregion - #region Event Handlers - //void BorderListBox_MeasureItem(object sender, MeasureItemEventArgs e) - //{ - // e.ItemHeight = 22; - //} - private int _MaxLabelWidth = 0; - private int MaxLabelWidth(Graphics gr) - { - if(_MaxLabelWidth == 0) - { - for(int i=0;i - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/BorderSelectionPanel.cs b/PROMS/Volian.Controls.Library/BorderSelectionPanel.cs deleted file mode 100644 index 85378e83..00000000 --- a/PROMS/Volian.Controls.Library/BorderSelectionPanel.cs +++ /dev/null @@ -1,467 +0,0 @@ -using System; -using System.ComponentModel; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using System.Windows.Forms; -using System.Drawing; -using C1.Win.C1FlexGrid; - -namespace Volian.Controls.Library -{ - public delegate void BorderSelectionPanelEvent(object sender, EventArgs args); - public partial class BorderSelectionPanel : Panel - { - #region Events - public event BorderSelectionPanelEvent BordersChanged; - private void OnBordersChanged(object sender, EventArgs args) - { - if (BordersChanged != null) BordersChanged(sender, args); - } - #endregion - #region Properties - private bool _HasRows = true; - public bool HasRows - { - get { return _HasRows; } - set { _HasRows = value; if (!value) _InsideHorizontalBorder = GridLinePattern.None; } - } - private bool _HasColumns = true; - public bool HasColumns - { - get { return _HasColumns; } - set { _HasColumns = value; if (!value) _InsideVerticalBorder = GridLinePattern.None; } - } - private GridLinePattern _SelectedBorder = GridLinePattern.Single; - internal GridLinePattern SelectedBorder - { - get { return _SelectedBorder; } - set { _SelectedBorder = value; } - } - private GridLinePattern _TopBorder = GridLinePattern.Single; - internal GridLinePattern TopBorder - { - get { return _TopBorder; } - set - { - _TopBorder = _TopBorder == value ? GridLinePattern.None : value; - Redraw(); - } - } - private GridLinePattern _BottomBorder = GridLinePattern.Single; - internal GridLinePattern BottomBorder - { - get { return _BottomBorder; } - set - { - _BottomBorder = _BottomBorder == value ? GridLinePattern.None : value; - Redraw(); - } - } - private GridLinePattern _LeftBorder = GridLinePattern.Single; - internal GridLinePattern LeftBorder - { - get { return _LeftBorder; } - set - { - _LeftBorder = _LeftBorder == value ? GridLinePattern.None : value; ; - Redraw(); - } - } - private GridLinePattern _RightBorder = GridLinePattern.Single; - internal GridLinePattern RightBorder - { - get { return _RightBorder; } - set - { - _RightBorder = _RightBorder == value ? GridLinePattern.None : value; - Redraw(); - } - } - private GridLinePattern _InsideVerticalBorder = GridLinePattern.Single; - internal GridLinePattern InsideVerticalBorder - { - get { return _InsideVerticalBorder; } - set - { - _InsideVerticalBorder = _InsideVerticalBorder == value ? GridLinePattern.None : value; - Redraw(); - } - } - private GridLinePattern _InsideHorizontalBorder = GridLinePattern.Single; - internal GridLinePattern InsideHorizontalBorder - { - get { return _InsideHorizontalBorder; } - set - { - _InsideHorizontalBorder = _InsideHorizontalBorder == value ? GridLinePattern.None : value; - Redraw(); - } - } - public GridLinePattern OutlineBorder - { - set { _TopBorder = _BottomBorder = _LeftBorder = _RightBorder = value; Redraw(); } - } - public GridLinePattern InsideBorders - { - set { _InsideHorizontalBorder = _InsideVerticalBorder = value; Redraw(); } - } - public GridLinePattern AllBorders - { - set { _InsideHorizontalBorder = _InsideVerticalBorder = _TopBorder = _BottomBorder = _LeftBorder = _RightBorder = value; Redraw(); } - } - /// - /// Refresh Borders and raise an event - /// - private void Redraw() - { - Invalidate(); - OnBordersChanged(this, new EventArgs()); - } - #endregion - #region Initialize Borders - public void InitializeBorder(GridLinePattern linePattern) - { - _InsideHorizontalBorder = _InsideVerticalBorder = _TopBorder = _BottomBorder = _LeftBorder = _RightBorder = linePattern; - HasRows = true; - HasColumns = true; - Invalidate(); - } - public void InitializeBorder(GridLinePattern linePattern, bool hasRows, bool hasColumns) - { - _InsideHorizontalBorder = _InsideVerticalBorder = _TopBorder = _BottomBorder = _LeftBorder = _RightBorder = linePattern; - HasRows = hasRows; - HasColumns = hasColumns; - Invalidate(); - } - public void InitializeBorder(GridLinePattern linePattern, int rows, int columns) - { - _InsideHorizontalBorder = _InsideVerticalBorder = _TopBorder = _BottomBorder = _LeftBorder = _RightBorder = linePattern; - HasRows = rows > 0; - HasColumns = columns > 0; - Invalidate(); - } - public void InitializeBorder(VlnBorders myBorders, int r1, int c1, int r2, int c2) - { - _TopBorder = myBorders.RangeTopBorder(r1, c1, r2, c2); - _InsideHorizontalBorder = myBorders.RangeHorizontalBorder(r1, c1, r2, c2); - _BottomBorder = myBorders.RangeBottomBorder(r1, c1, r2, c2); - _LeftBorder = myBorders.RangeLeftBorder(r1, c1, r2, c2); - _InsideVerticalBorder = myBorders.RangeVerticalBorder(r1, c1, r2, c2); - _RightBorder = myBorders.RangeRightBorder(r1, c1, r2, c2); - HasRows = r2 > r1; - HasColumns = c2 > c1; - Invalidate(); - } - 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; - _InsideHorizontalBorder = GridLinePattern.Unknown; - _BottomBorder = GridLinePattern.Unknown; - _LeftBorder = GridLinePattern.Unknown; - _InsideVerticalBorder = GridLinePattern.Unknown; - _RightBorder = GridLinePattern.Unknown; - for (int r = myRange.r1; r <= myRange.r2; r++) - for (int c = myRange.c1; c <= myRange.c2; c++) - { - CellRange cr = myFlexGrid.GetMergedRange(r, c); - if (r == myRange.r1) // Top Border - _TopBorder = CombinePattern(_TopBorder, myFlexGrid.MyBorders.HorizontalLines[cr.r1, cr.c1]); - if (c == myRange.c1) // Left Border - _LeftBorder = CombinePattern(_LeftBorder, myFlexGrid.MyBorders.VerticalLines[cr.r1, cr.c1]); - if (r == myRange.r2) // Bottom Border - _BottomBorder = CombinePattern(_BottomBorder, myFlexGrid.MyBorders.HorizontalLines[cr.r2+1, cr.c2]); - if (c == myRange.c2) // Right Border - _RightBorder = CombinePattern(_RightBorder, myFlexGrid.MyBorders.VerticalLines[cr.r2, cr.c2+1]); - if (r == cr.r1 && c == cr.c1) // Look for inside lines - { - if (cr.r1 > myRange.r1 && cr.r1 < myRange.r2) // Inside Horizontal Top - _InsideHorizontalBorder = CombinePattern(_InsideHorizontalBorder, myFlexGrid.MyBorders.HorizontalLines[cr.r1, cr.c1]); - if (cr.r2+1 > myRange.r1 && cr.r2 < myRange.r2) // Inside Horizontal Bottom - _InsideHorizontalBorder = CombinePattern(_InsideHorizontalBorder, myFlexGrid.MyBorders.HorizontalLines[cr.r2 +1, cr.c2]); - if (cr.c1 > myRange.c1 && cr.c1 < myRange.c2) // Inside Vertical Left - _InsideVerticalBorder = CombinePattern(_InsideVerticalBorder, myFlexGrid.MyBorders.VerticalLines[cr.r1, cr.c1]); - if (cr.c2+1 > myRange.c1 && cr.c2 < myRange.c2) // Inside Vertical Right - _InsideVerticalBorder = CombinePattern(_InsideVerticalBorder, myFlexGrid.MyBorders.VerticalLines[cr.r2, cr.c2 + 1]); - } - c = cr.c2;//Skip to the end of the merged cells - } - HasRows = (_InsideHorizontalBorder != GridLinePattern.Unknown); - if (!HasRows) _InsideHorizontalBorder = GridLinePattern.None; - HasColumns = (_InsideVerticalBorder != GridLinePattern.Unknown); - if (!HasColumns) _InsideVerticalBorder = GridLinePattern.None; - Invalidate(); - } - private GridLinePattern CombinePattern(GridLinePattern oldPattern, GridLinePattern newPattern) - { - if (oldPattern == GridLinePattern.Unknown) return newPattern; - if (oldPattern == newPattern) return oldPattern; - return GridLinePattern.Mixed; - } - #endregion - #region ctor - public BorderSelectionPanel() - { - InitializeComponent(); - this.Paint += new PaintEventHandler(BorderSelectionPanel_Paint); - this.MouseDown += new MouseEventHandler(BorderSelectionPanel_MouseDown); - } - public BorderSelectionPanel(IContainer container) - { - container.Add(this); - InitializeComponent(); - this.Paint += new PaintEventHandler(BorderSelectionPanel_Paint); - this.MouseDown += new MouseEventHandler(BorderSelectionPanel_MouseDown); - } - #endregion - #region Event Handlers - private void BorderSelectionPanel_MouseDown(object sender, MouseEventArgs e) - { - if (e.X < 20) - LeftBorder = SelectedBorder; - else if (e.X > Width - 20) - RightBorder = SelectedBorder; - if (e.Y < 20) - TopBorder = SelectedBorder; - else if (e.Y > Height - 20) - BottomBorder = SelectedBorder; - int dx = Math.Abs(e.X - Width / 2); - int dy = Math.Abs(e.Y - Height / 2); - if (HasRows && dy < 10) - InsideHorizontalBorder = SelectedBorder; - if (HasColumns && dx < 10) - InsideVerticalBorder = SelectedBorder; - } - private void BorderSelectionPanel_Paint(object sender, PaintEventArgs e) - { - int margin = 10; - int x1 = margin; - int y1 = margin; - int x2 = Width - margin - 1; - int y2 = Height - margin - 1; - int w2 = Width - 1; - int h2 = Height - 1; - int w1 = Width - 2 * margin - 1; - int h1 = Height - 2 * margin - 1; - int offset = 4; - DrawBackground(e, x1, y1, x2, y2, w1, h1, w2, h2, offset, HasRows, HasColumns); - DrawBorder(e, x1, y1, x2, y2); - } - 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) - { - 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 - 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); - e.Graphics.DrawLine(Pens.LightBlue, offset, y2, w2 - offset, y2); - // Vertical Lines - e.Graphics.DrawLine(Pens.LightBlue, x1, offset, x1, h2 - offset); - if (hasColumns) e.Graphics.DrawLine(Pens.LightBlue, (x1 + x2) / 2, y1+offset, (x1 + x2) / 2, y2 - offset); - e.Graphics.DrawLine(Pens.LightBlue, x2, offset, x2, h2 - offset); - } - private void DrawBorder(PaintEventArgs e, int x1, int y1, int x2, int y2) - { - DrawLineDown(e.Graphics, LeftBorder, x1, y1, x1, y2, TopBorder, BottomBorder); - DrawLineRight(e.Graphics, BottomBorder, x1, y2, x2, y2, LeftBorder, RightBorder); - DrawLineUp(e.Graphics, RightBorder, x2, y2, x2, y1, BottomBorder, TopBorder); - DrawLineLeft(e.Graphics, TopBorder, x2, y1, x1, y1, RightBorder, LeftBorder); - DrawLineVertical(e.Graphics, InsideVerticalBorder, (x1 + x2) / 2, y1, (x1 + x2) / 2, y2, TopBorder, BottomBorder); - DrawLineHorizontal(e.Graphics, InsideHorizontalBorder, x1, (y1 + y2) / 2, x2, (y1 + y2) / 2, LeftBorder, RightBorder); - } - private void DrawLineDown(Graphics graphics, GridLinePattern linePattern, int x1, int y1, int x2, int y2, GridLinePattern startPattern, GridLinePattern endPattern) - { - if (linePattern == GridLinePattern.None) return; - int dyi1 = 0;int dyi2 = 0;int dxi1 = 0;int dxi2 = 0; - int dyo1 = 0;int dyo2 = 0;int dxo1 = 0;int dxo2 = 0; - if (LineWidth(linePattern) == 3) - { - dxo2 = dxo1 = -1; - dyi2 = dyo1 = LineWidth(startPattern) == 3 ? -1 : 0; - dyi1 =dyo2 = LineWidth(endPattern) == 3 ? 1 : 0; - 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. - } - GridSplitLine mySplit = InsideHorizontalBorder == GridLinePattern.Double ? GridSplitLine.Inside : GridSplitLine.None; - DrawTheLine(graphics, linePattern, mySplit, x1, y1, x2, y2, dxi1, dyi1, dxi2, dyi2, dxo1, dyo1, dxo2, dyo2); - } - private void DrawLineRight(Graphics graphics, GridLinePattern linePattern, int x1, int y1, int x2, int y2, GridLinePattern startPattern, GridLinePattern endPattern) - { - if (linePattern == GridLinePattern.None) return; - int dyi1 = 0; int dyi2 = 0; int dxi1 = 0; int dxi2 = 0; - int dyo1 = 0; int dyo2 = 0; int dxo1 = 0; int dxo2 = 0; - if (LineWidth(linePattern) == 3) - { - dyo2 = dyo1 = 1; - dxi2 = dxo1 = LineWidth(startPattern) == 3 ? -1 : 0; - dxi1 = dxo2 = LineWidth(endPattern) == 3 ? 1 : 0; - 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. - } - GridSplitLine mySplit = InsideVerticalBorder == GridLinePattern.Double ? GridSplitLine.Inside : GridSplitLine.None; - DrawTheLine(graphics, linePattern,mySplit, x1, y1, x2, y2, dxi1, dyi1, dxi2, dyi2, dxo1, dyo1, dxo2, dyo2); - } - private void DrawLineUp(Graphics graphics, GridLinePattern linePattern, int x1, int y1, int x2, int y2, GridLinePattern startPattern, GridLinePattern endPattern) - { - if (linePattern == GridLinePattern.None) return; - int dyi1 = 0; int dyi2 = 0; int dxi1 = 0; int dxi2 = 0; - int dyo1 = 0; int dyo2 = 0; int dxo1 = 0; int dxo2 = 0; - if (LineWidth(linePattern) == 3) - { - dxo2 = dxo1 = 1; - dyo1 = LineWidth(startPattern) == 3 ? 1 : 0; - dyo2 = LineWidth(endPattern) == 3 ? -1 : 0; - if (linePattern == GridLinePattern.Thick) dyo1++; // Fix for bug in Graphics. Seems to happen when line is thick. - dxi1 = -dxo1; dxi2 = -dxo2; dyi1 = -dyo1; dyi2 = -dyo2; - } - GridSplitLine mySplit = InsideHorizontalBorder == GridLinePattern.Double ? GridSplitLine.Inside : GridSplitLine.None; - DrawTheLine(graphics, linePattern, mySplit, x1, y1, x2, y2, dxi1, dyi1, dxi2, dyi2, dxo1, dyo1, dxo2, dyo2); - } - private void DrawLineLeft(Graphics graphics, GridLinePattern linePattern, int x1, int y1, int x2, int y2, GridLinePattern startPattern, GridLinePattern endPattern) - { - if (linePattern == GridLinePattern.None) return; - int dyi1 = 0; int dyi2 = 0; int dxi1 = 0; int dxi2 = 0; - int dyo1 = 0; int dyo2 = 0; int dxo1 = 0; int dxo2 = 0; - if (LineWidth(linePattern) == 3) - { - dyo2 = dyo1 = -1; - dxo1 = LineWidth(startPattern) == 3 ? 1 : 0; - dxo2 = LineWidth(endPattern) == 3 ? -1 : 0; - if (linePattern == GridLinePattern.Thick) dxo1++; // Fix for bug in Graphics. Seems to happen when line is thick. - dxi1 = -dxo1; dxi2 = -dxo2; dyi1 = -dyo1; dyi2 = -dyo2; - } - GridSplitLine mySplit = InsideVerticalBorder == GridLinePattern.Double ? GridSplitLine.Inside : GridSplitLine.None; - DrawTheLine(graphics, linePattern, mySplit, x1, y1, x2, y2, dxi1, dyi1, dxi2, dyi2, dxo1, dyo1, dxo2, dyo2); - } - private void DrawLineVertical(Graphics graphics, GridLinePattern linePattern, int x1, int y1, int x2, int y2, GridLinePattern startPattern, GridLinePattern endPattern) - { - if (linePattern == GridLinePattern.None) return; - int dyi1 = 0; int dyi2 = 0; int dxi1 = 0; int dxi2 = 0; - int dyo1 = 0; int dyo2 = 0; int dxo1 = 0; int dxo2 = 0; - if (LineWidth(linePattern) == 3) - { - dxo2 = dxo1 = 1; - dyo1 = LineWidth(startPattern) == 3 ? 1 : 0; - dyo2 = LineWidth(endPattern) == 3 ? -1 : 0; - if (linePattern == GridLinePattern.Thick) dyo1++; // Fix for bug in Graphics. Seems to happen when line is thick. - dxi1 = -dxo1;dyi1 = dyo1;dxi2 = -dxo2;dyi2 = dyo2; - } - else - { - dyo1 = LineWidth(startPattern) == 3 ? 1 : 0; - dyo2 = LineWidth(endPattern) == 3 ? -1 : 0; - } - GridSplitLine mySplit = InsideHorizontalBorder == GridLinePattern.Double ? GridSplitLine.Both : GridSplitLine.None; - DrawTheLine(graphics, linePattern, mySplit, x1, y1, x2, y2, dxi1, dyi1, dxi2, dyi2, dxo1, dyo1, dxo2, dyo2); - } - private void DrawLineHorizontal(Graphics graphics, GridLinePattern linePattern,int x1, int y1, int x2, int y2, GridLinePattern startPattern, GridLinePattern endPattern) - { - if (linePattern == GridLinePattern.None) return; - int dyi1 = 0; int dyi2 = 0; int dxi1 = 0; int dxi2 = 0; - int dyo1 = 0; int dyo2 = 0; int dxo1 = 0; int dxo2 = 0; - if (LineWidth(linePattern) == 3) - { - dyo2 = dyo1 = -1; - dxo1 = LineWidth(startPattern) == 3 ? 1 : 0; - dxo2 = LineWidth(endPattern) == 3 ? -1 : 0; - if (linePattern == GridLinePattern.Thick) dxo1++; // Fix for bug in Graphics. Seems to happen when line is thick. - dxi1 = dxo1;dyi1 = -dyo1;dxi2 = dxo2;dyi2 = -dyo2; - } - else - { - dxo1 = LineWidth(startPattern) == 3 ? 1 : 0; - dxo2 = LineWidth(endPattern) == 3 ? -1 : 0; - } - GridSplitLine mySplit = InsideVerticalBorder == GridLinePattern.Double ? GridSplitLine.Both:GridSplitLine.None; - DrawTheLine(graphics, linePattern,mySplit, x1, y1, x2, y2, dxi1, dyi1, dxi2, dyi2, dxo1, dyo1, dxo2, dyo2); - } - private int LineWidth(GridLinePattern linePattern) - { - return VlnBorders.LineWidth(linePattern); - } - [Flags] - private enum GridSplitLine:int - { - None=0,Inside=1,Outside=2,Both=3 - } - private static void DrawTheLine(Graphics graphics, GridLinePattern linePattern, GridSplitLine mySplit, int x1, int y1, int x2, int y2,int dxi1, int dyi1, int dxi2, int dyi2, int dxo1, int dyo1, int dxo2, int dyo2) - { - Pen pn = VlnBorders.LinePen(linePattern,Color.Black); - switch (linePattern) - { - case GridLinePattern.None: - break; - case GridLinePattern.Double: - DrawDoubleLines(graphics, pn, mySplit, x1, y1, x2, y2, dxi1, dyi1, dxi2, dyi2, dxo1, dyo1, dxo2, dyo2); - break; - case GridLinePattern.Thick: - pn.Width = 3; - if (x1 == x2) // Vertical - graphics.DrawLine(pn, x1, y1 + dyo1, x2, y2 + dyo2); - else // Horizontal - graphics.DrawLine(pn, x1 + dxo1, y1, x2 + dxo2, y2); - break; - case GridLinePattern.Single: - case GridLinePattern.Mixed: - case GridLinePattern.Dashed: - case GridLinePattern.Dotted: - default: - graphics.DrawLine(pn, x1 + dxo1, y1 + dyo1, x2 + dxo2, y2 + dyo2); - break; - } - } - - private static void DrawDoubleLines(Graphics graphics, Pen pn, GridSplitLine mySplit, int x1, int y1, int x2, int y2, int dxi1, int dyi1, int dxi2, int dyi2, int dxo1, int dyo1, int dxo2, int dyo2) - { - if ((mySplit & GridSplitLine.Inside) > 0) - { - if (x1 == x2) - { - int yh = (y1 + dyi1 + y2 + dyi2) / 2; - int dh = y2 > y1 ? 1 : -1; - graphics.DrawLine(pn, x1 + dxi1, y1 + dyi1, x2 + dxi2, yh - dh); // Inside Line - graphics.DrawLine(pn, x1 + dxi1, yh + dh, x2 + dxi2, y2 + dyi2); // Inside Line - } - else - { - int xh = (x1 + dxi1 + x2 + dxi2) / 2; - int dh = x2 > x1 ? 1 : -1; - graphics.DrawLine(pn, x1 + dxi1, y1 + dyi1, xh - dh, y2 + dyi2); // Inside Line - graphics.DrawLine(pn, xh + dh, y1 + dyi1, x2 + dxi2, y2 + dyi2); // Inside Line - } - } - else - graphics.DrawLine(pn, x1 + dxi1, y1 + dyi1, x2 + dxi2, y2 + dyi2); // Inside Line - if ((mySplit & GridSplitLine.Outside) > 0) - { - if (x1 == x2) - { - int yh = (y1 + dyo1 + y2 + dyo2) / 2; - int dh = y2 > y1 ? 1 : -1; - graphics.DrawLine(pn, x1 + dxo1, y1 + dyo1, x2 + dxo2, yh - dh); // Outside Line - graphics.DrawLine(pn, x1 + dxo1, yh + dh, x2 + dxo2, y2 + dyo2); // Outside Line - } - else - { - int xh = (x1 + dxo1 + x2 + dxo2) / 2; - int dh = x2 > x1 ? 1 : -1; - graphics.DrawLine(pn, x1 + dxo1, y1 + dyo1, xh - dh, y2 + dyo2); // Outside Line - graphics.DrawLine(pn, xh + dh, y1 + dyo1, x2 + dxo2, y2 + dyo2); // Outside Line - } - } - else - graphics.DrawLine(pn, x1 + dxo1, y1 + dyo1, x2 + dxo2, y2 + dyo2); // Outside Line - } - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/ClassDiagram1.cd b/PROMS/Volian.Controls.Library/ClassDiagram1.cd deleted file mode 100644 index 0519ecba..00000000 --- a/PROMS/Volian.Controls.Library/ClassDiagram1.cd +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/ConvertTable.cs b/PROMS/Volian.Controls.Library/ConvertTable.cs deleted file mode 100644 index c11a5530..00000000 --- a/PROMS/Volian.Controls.Library/ConvertTable.cs +++ /dev/null @@ -1,245 +0,0 @@ -using C1.Win.C1FlexGrid; -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using System.Windows.Forms; -using System.Xml; -using VEPROMS.CSLA.Library; -using Volian.Controls.Library; - -namespace Volian.Controls.Library -{ - public partial class frmImportWordContents : Form - { - private static string GetTableText() - { - return TblFlexGrid.GetSearchableText(); - } - private static VlnFlexGrid _TblFlexGrid = null; - - public static VlnFlexGrid TblFlexGrid - { - get { - if (_TblFlexGrid == null) _TblFlexGrid = new VlnFlexGrid(); - return frmImportWordContents._TblFlexGrid; - } - set { frmImportWordContents._TblFlexGrid = value; } - } - - private static void LoadTable2(XmlNode xn) - { - XmlNode xn2 = xn.SelectSingleNode("tr/td/table"); - if (xn2 != null) xn = xn2; - VlnFlexGrid fg = TblFlexGrid; - fg.Font = new Font("Arial", 12, FontStyle.Regular, GraphicsUnit.Point); - fg.Clear(); - fg.Rows.Count = 1; - fg.Cols.Count = 1; - int rows = 0; - fg.MergedRanges.Clear(); - foreach (XmlNode xr in xn.ChildNodes) - { - if (xr.Name == "tr") - { - ++rows; - AddTableRow(xr, fg, rows); - } - } - fg.MyBorders = new VlnBorders(GridLinePattern.Single, fg.Rows.Count, fg.Cols.Count); - fg.MyShading = new VlnGridCellShading(Color.White, fg.Rows.Count, fg.Cols.Count); // C2021-004 add table cell shading information - fg.BringToFront(); - fg.Invalidate(); - Application.DoEvents(); - //ShowColumnWidths(fg); - 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; - private static void AddTableRow(XmlNode xr, VlnFlexGrid fg, int rows) - { - if (rows > fg.Rows.Count) - fg.Rows.Count = rows; - int cols = 0; - foreach (XmlNode xc in xr.ChildNodes) - { - ++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); - //Console.WriteLine("Check {0}", cr2); - while (cr2.c1 != cols - 1 || cr2.r1 != rows - 1) - { - cols++; - cr2 = GetMyMergedRange(fg, rows - 1, cols - 1); - } - AddMergedCells(fg, rows, cols, xc); - // adjust text alignment - string align = GetAttribute(xc, "textalign"); - if (align != null) - { - - switch(align) - { - case "LeftTop": - fg.ChangeCellAlign(cr2, TextAlignEnum.LeftTop); - break; - case "LeftCenter": - fg.ChangeCellAlign(cr2, TextAlignEnum.LeftCenter); - break; - case "LeftBottom": - fg.ChangeCellAlign(cr2, TextAlignEnum.LeftBottom); - break; - case "CenterTop": - fg.ChangeCellAlign(cr2, TextAlignEnum.CenterTop); - break; - case "CenterCenter": - fg.ChangeCellAlign(cr2, TextAlignEnum.CenterCenter); - break; - case "CenterBottom": - fg.ChangeCellAlign(cr2, TextAlignEnum.CenterBottom); - break; - case "RightTop": - fg.ChangeCellAlign(cr2, TextAlignEnum.RightTop); - break; - case "RightCenter": - fg.ChangeCellAlign(cr2, TextAlignEnum.RightCenter); - break; - case "RightBottom": - fg.ChangeCellAlign(cr2, TextAlignEnum.RightBottom); - break; - } - } - //ShowMergedCells(fg); - if (xc.Name == "td") - { - AddTableColumn(xc, fg, rows, cols); - } - } - } - - //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) - { - int retval = int.Parse("0" + (span ?? "")); - if (retval == 0) return 0; - return retval - 1; - } - private static string GetAttribute(XmlNode xc, string attName) - { - string retval = null; - XmlAttribute xa = xc.Attributes[attName]; - if (xa != null) - retval = xa.Value; - return retval; - } - private static void AddMergedCells(VlnFlexGrid fg, int rows, int cols, XmlNode xc) - { - string colspan = GetAttribute(xc, "colspan"); - string rowspan = GetAttribute(xc, "rowspan"); - if (colspan != null || rowspan != null) - { - //AddMergedRanges - int r1 = rows; - int c1 = cols; - int r2 = r1 + GetSpan(rowspan); - if (r2 > fg.Rows.Count) fg.Rows.Count = r2; - int c2 = c1 + GetSpan(colspan); - if (c2 > fg.Cols.Count) fg.Cols.Count = c2; - CellRange cr = new CellRange(); - cr.r1 = r1 - 1; - cr.r2 = r2 - 1; - cr.c1 = c1 - 1; - cr.c2 = c2 - 1; - fg.MergedRanges.Add(cr); - //Console.WriteLine("Merged {0}", cr); - } - } - - private static CellRange GetMyMergedRange(VlnFlexGrid fg, int r, int c) - { - foreach (CellRange cr in fg.MergedRanges) - { - if (cr.r1 <= r && cr.r2 >= r && cr.c1 <= c && cr.c2 >= c) - return cr; - } - return fg.GetMergedRange(r, c); - } - private static Regex regNumber = new Regex("^[0-9]+$", RegexOptions.Compiled); - private static void AddTableColumn(XmlNode xc, VlnFlexGrid fg, int rows, int cols) - { - //Console.WriteLine("Rows {0}, Cols {1}", rows, cols); - if (cols > fg.Cols.Count) - fg.Cols.Count = cols; - string width = GetAttribute(xc, "width"); - if (width != null && width != "" && regNumber.IsMatch(width)) - { - if (width.EndsWith("%")) - fg.Cols[cols - 1].Width = (int)(int.Parse(width.Replace("%", "")) * 96 * 6.5F / 100); - else - { - int w = int.Parse(width)*96/72; - //Console.WriteLine("w[{0}]={1}", cols - 1, w); - fg.Cols[cols - 1].Width = w; - } - } - StringBuilder sb = new StringBuilder(); - string prefix = ""; - foreach (XmlNode xn in xc.ChildNodes) - { - if (xn.Name == "p") - { - sb.Append(prefix + xn.InnerText); - } - if (xn.Name == "ul") - { - foreach (XmlNode xn2 in xn.ChildNodes) - { - if (xn2.Name == "li") - { - sb.Append(prefix + "*" + xn.InnerText); - } - if (xn2.Name == "p") - { - sb.Append(prefix + xn.InnerText); - } - } - } - } - if (width != null && width != "" && !regNumber.IsMatch(width)) - { - Console.WriteLine("width is not a number {0}, rows {1}, cols {2}, Text='{3}'", width, rows, cols, xc.OuterXml); - } - fg[rows - 1, cols - 1] = sb.ToString(); - } - } -} diff --git a/PROMS/Volian.Controls.Library/CustomMessageBox.Designer.cs b/PROMS/Volian.Controls.Library/CustomMessageBox.Designer.cs deleted file mode 100644 index 0deb398b..00000000 --- a/PROMS/Volian.Controls.Library/CustomMessageBox.Designer.cs +++ /dev/null @@ -1,121 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class CustomMessageBox - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.btn1 = new System.Windows.Forms.Button(); - this.btn2 = new System.Windows.Forms.Button(); - this.lblMessage = new System.Windows.Forms.Label(); - this.tableLP1 = new System.Windows.Forms.TableLayoutPanel(); - this.tableLP1.SuspendLayout(); - this.SuspendLayout(); - // - // btn1 - // - this.btn1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btn1.AutoSize = true; - this.btn1.Location = new System.Drawing.Point(18, 102); - this.btn1.Margin = new System.Windows.Forms.Padding(10); - this.btn1.MinimumSize = new System.Drawing.Size(60, 20); - this.btn1.Name = "btn1"; - this.btn1.Size = new System.Drawing.Size(60, 20); - this.btn1.TabIndex = 0; - this.btn1.UseVisualStyleBackColor = true; - this.btn1.Click += new System.EventHandler(this.Btn1_Click); - // - // btn2 - // - this.btn2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btn2.AutoSize = true; - this.btn2.Location = new System.Drawing.Point(335, 102); - this.btn2.Margin = new System.Windows.Forms.Padding(10); - this.btn2.MinimumSize = new System.Drawing.Size(60, 20); - this.btn2.Name = "btn2"; - this.btn2.Size = new System.Drawing.Size(60, 20); - this.btn2.TabIndex = 1; - this.btn2.UseVisualStyleBackColor = true; - this.btn2.Click += new System.EventHandler(this.Btn2_Click); - // - // lblMessage - // - this.lblMessage.AutoSize = true; - this.tableLP1.SetColumnSpan(this.lblMessage, 2); - this.lblMessage.Dock = System.Windows.Forms.DockStyle.Fill; - this.lblMessage.Location = new System.Drawing.Point(11, 8); - this.lblMessage.MaximumSize = new System.Drawing.Size(413, 0); - this.lblMessage.Name = "lblMessage"; - this.lblMessage.Size = new System.Drawing.Size(391, 84); - this.lblMessage.TabIndex = 2; - this.lblMessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // tableLP1 - // - this.tableLP1.AutoSize = true; - this.tableLP1.ColumnCount = 2; - this.tableLP1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLP1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLP1.Controls.Add(this.lblMessage, 0, 0); - this.tableLP1.Controls.Add(this.btn1); - this.tableLP1.Controls.Add(this.btn2); - this.tableLP1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLP1.Location = new System.Drawing.Point(0, 0); - this.tableLP1.MaximumSize = new System.Drawing.Size(413, 0); - this.tableLP1.MinimumSize = new System.Drawing.Size(413, 130); - this.tableLP1.Name = "tableLP1"; - this.tableLP1.Padding = new System.Windows.Forms.Padding(8); - this.tableLP1.RowCount = 2; - this.tableLP1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLP1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLP1.Size = new System.Drawing.Size(413, 130); - this.tableLP1.TabIndex = 0; - // - // CustomMessageBox - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoSize = true; - this.ClientSize = new System.Drawing.Size(419, 130); - this.Controls.Add(this.tableLP1); - this.Name = "CustomMessageBox"; - this.ShowIcon = false; - this.Text = "CustomMessageBox"; - this.tableLP1.ResumeLayout(false); - this.tableLP1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button btn1; - private System.Windows.Forms.Button btn2; - private System.Windows.Forms.Label lblMessage; - private System.Windows.Forms.TableLayoutPanel tableLP1; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/CustomMessageBox.cs b/PROMS/Volian.Controls.Library/CustomMessageBox.cs deleted file mode 100644 index a16a59d1..00000000 --- a/PROMS/Volian.Controls.Library/CustomMessageBox.cs +++ /dev/null @@ -1,62 +0,0 @@ -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; - -namespace Volian.Controls.Library -{ - public partial class CustomMessageBox : Form - { - //Custome Message Box Class to allow renaming of buttons - // originally devleoped for use with - // C2025-062 When Search clicked - Load the Incoming transitions for the Active Procedure - // in order to allow the user to decide if they wanted to search on the selected step or the selected procedure - public CustomMessageBox(string message, string title, string button1Text = "OK", string button2Text = "") - { - InitializeComponent(); - this.Text = title; - lblMessage.Text = message; - btn1.Text = button1Text; - - if (!string.IsNullOrEmpty(button2Text)) - { - btn2.Text = button2Text; - btn2.Visible = true; - - //make buttons uniform - btn1.Height = btn2.Height = btn1.Height > btn2.Height ? btn1.Height : btn2.Height; - btn1.Width = btn2.Width = btn1.Width > btn2.Width ? btn1.Width : btn2.Width; - } - else - { - btn2.Visible = false; - } - } - - private void Btn1_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.Yes; - Close(); - } - - private void Btn2_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.No; - Close(); - } - - //static method for calling custommessagebox directly - public static DialogResult Show(string message, string title, string button1Text = "OK", string button2Text = "") - { - using (var messageBox = new CustomMessageBox(message, title, button1Text, button2Text)) - { - return messageBox.ShowDialog(); - } - } - } -} diff --git a/PROMS/Volian.Controls.Library/CustomMessageBox.resx b/PROMS/Volian.Controls.Library/CustomMessageBox.resx deleted file mode 100644 index 1af7de15..00000000 --- a/PROMS/Volian.Controls.Library/CustomMessageBox.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DSOTabPanel.Designer.cs b/PROMS/Volian.Controls.Library/DSOTabPanel.Designer.cs deleted file mode 100644 index 8d3455ab..00000000 --- a/PROMS/Volian.Controls.Library/DSOTabPanel.Designer.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class DSOTabPanel - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/DSOTabPanel.cs b/PROMS/Volian.Controls.Library/DSOTabPanel.cs deleted file mode 100644 index f428da3e..00000000 --- a/PROMS/Volian.Controls.Library/DSOTabPanel.cs +++ /dev/null @@ -1,722 +0,0 @@ -using System; -using System.ComponentModel; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using System.Drawing; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using Volian.Controls.Library; -using System.Reflection; -using LBWordLibrary; -using JR.Utils.GUI.Forms; -using Volian.Base.Library; - -namespace Volian.Controls.Library -{ - public partial class DSOTabPanel : DevComponents.DotNetBar.PanelDockContainer - { - #region Private Fields - private DisplayTabControl _MyDisplayTabControl; - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private AxEDWordLib.AxEDWord _MyEdWord; // B2017-133 Edraw DSO Framer Replacement - public AxEDWordLib.AxEDWord MyEdWord - { - get { return _MyEdWord; } - set { _MyEdWord = value; } - } - private TransparentPanel _MyTransparentPanel; - private static int _Count = 0; - private DocumentInfo _MyDocumentInfo; - private int _MyCount; - private DisplayTabItem _MyDisplayTabItem; - private DSOFile _DSOFile; - public static int MSWordLimit = 10; - #endregion - #region Public Properties - private String _SearchString; - public String SearchString - { - get { return _SearchString; } - set { _SearchString = value; FindSearchString(); } - } - /// - /// Count of DSO Pages open. Limited to 18 in DisplayTabControl - /// - public static int Count - { - get { return _Count; } - set { _Count = value; } - } - /// - /// Pointer to the related DisplayTabItem - /// - public DisplayTabItem MyDisplayTabItem - { - get { return _MyDisplayTabItem; } - set - { - _MyDisplayTabItem = value; - _MyDisplayTabItem.Visible = false; - _MyDisplayTabItem.Visible = true; - } - } - /// - /// DocumentInfo record for the Word document - /// - public DocumentInfo MyDocumentInfo - { - get { return _MyDocumentInfo; } - } - /// - /// Temporary Word file used for editing. - /// - internal DSOFile MyDSOFile - { - get - { - if (_DSOFile == null) - _DSOFile = new DSOFile(_MyDocumentInfo); - return _DSOFile; - } - } - /// - /// Dirty status. Only saved if dirty. - /// - public bool IsDirty - { - get - { - if (_MyEdWord == null) return false; // B2017-133 Edraw Is Dirty Property - // B2017-249 Recover Temporary File And AutoSave support for MSWord - return _MyEdWord.IsDirty() || MyDSOFile.ContentIsDirty; - //LBDocumentClass doc = new LBDocumentClass(_MyEdWord.ActiveDocument()); - //return !doc.Saved; - } - } - private bool _OverrideClose = false; - public bool OverrideClose - { - get { return _OverrideClose; } - set { _OverrideClose = value; } - } - public E_ViewMode PanelViewEditMode = E_ViewMode.Edit; - #endregion - //private frmPG _frm = null; - #region Constructors - private Timer _RefreshTimer; - private ItemInfo _ItemInfo; - private bool _AllowedToEdit; - public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myDisplayTabControl, ItemInfo itemInfo, bool allowedToEdit) - { - _MyDisplayTabControl = myDisplayTabControl; - _ItemInfo = itemInfo; - _AllowedToEdit = allowedToEdit; - InitializeComponent(); - SetupDSOTabPanel(); - _MyDocumentInfo = documentInfo; - SetupDSO(); - 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.Interval = 500;// B2017-133 Edraw - ClientSizeChanged += new EventHandler(DSOTabPanel_ClientSizeChanged); - _RefreshTimer.Tick += new EventHandler(_RefreshTimer_Tick); - // B2018-070 Activate MS Word Panel - _RefreshTimer.Enabled = true; - _MyEdWord.BeforeDocumentSaved += _MyEdWord_BeforeDocumentSaved;// B2017-133 Edraw - } - void _MyEdWord_BeforeDocumentSaved(object sender, EventArgs e)// B2017-133 Edraw - { - _MyEdWord.Save(); // B2017-135 Only open the Message Box once - } - void DisableWordCommands()// B2017-133 Edraw - { - _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableClose, true); - _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableNew, true); - _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrint, true); - _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintPreview, true); - _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintQuick, true); - _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSave, true); - _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSaveAs, true); - _MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeSave, true); - _MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeClose, true); - _MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypePrint, true); - _MyEdWord.DisableSaveHotKey(true); - _MyEdWord.DisablePrintHotKey(true); - } - // B2019-161 When tracking timing time this action - private static VolianTimer _TimeActivity = new VolianTimer("DSOTabPanel.cs _RefreshTimer_Tick", 148); - - void _RefreshTimer_Tick(object sender, EventArgs e) - { - _TimeActivity.Open(); - _RefreshTimer.Enabled = false; - if (_MyEdWord != null)// B2017-133 Edraw - { - // B2018-070 Activate MS Word Panel - _MyEdWord.GotoItem(EDWordLib.WdGoToItem.wdGoToObject, EDWordLib.WdGoToDirection.wdGoToNext, 0, null); - } - //else - //{ - // _MyDisplayTabControl.CloseTabItem(_MyDisplayTabItem); - //} - _TimeActivity.Close(); - } - - void DSOTabPanel_ClientSizeChanged(object sender, EventArgs e) - { - // B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel - if (_InDSOTabPanel) - { - _RefreshTimer.Enabled = false; // This assures that interval is used from last event. - _RefreshTimer.Enabled = true; - } - } - #endregion - #region Private Methods - private void SetupDSOTabPanel() - { - Dock = System.Windows.Forms.DockStyle.Fill; // Automatically Fill the panel - } - private void SetupDSO() - { - _Count++; // Increment the count of open Word documents (Limit = MSWordLimit) - _MyCount = _Count; - this._MyTransparentPanel = new TransparentPanel(); - this._MyEdWord = new AxEDWordLib.AxEDWord();// B2017-133 Edraw - _MyEdWord.BeginInit(); - this.Controls.Add(this._MyEdWord); - this.Controls.Add(this._MyTransparentPanel); // A transparent panel is added over top of the DSO Framer window so that - // the related tab can be activated when the user clicks on a Word Document. Since the Word document is actually running - // in a different thread, it does not behave properly with focus events. - this.components.Add(this._MyEdWord);// B2017-133 Edraw - this.components.Add(this._MyTransparentPanel); - this._MyTransparentPanel.Dock = System.Windows.Forms.DockStyle.Fill; - 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 - // 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._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(); - LBDocumentClass doc; - try - { - try - { - this._MyEdWord.LicenseName = "Volian7573291802";// B2017-133 Edraw - this._MyEdWord.LicenseCode = "EDW8-5527-1201-AB8A";// B2017-133 Edraw - DisableWordCommands(); - this._MyEdWord.Open(MyDSOFile.MyFile.FullName); - doc = new LBDocumentClass(_MyEdWord.ActiveDocument()); - } - catch (Exception ex) - { - // B2017-137 Restore Previous valid version if the current version cannot be opened, - using (DocumentAuditInfoList dail = DocumentAuditInfoList.Get(MyDocumentInfo.DocID)) - { - 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", - MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) - { - using (Document myDoc = Document.Get(MyDocumentInfo.DocID)) - { - myDoc.RestoreWordDoc(_ItemInfo); - } - using (Document myDoc = Document.Get(MyDocumentInfo.DocID)) - { - System.IO.FileStream fs = MyDSOFile.MyFile.Create(); - fs.Write(myDoc.DocContent, 0, myDoc.DocContent.Length); - fs.Close(); - 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 - 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); - } - } - - } - else - { - System.IO.FileStream fs = MyDSOFile.MyFile.Create(); - fs.Close(); - MyDSOFile.SaveFile(0, "", _ItemInfo, false, StatusChanged); // B2017-219 save the blank document to database - MessageBox.Show("Reverting to Blank Document", "Error in MS Word section", - MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - this._MyEdWord = null; // B2017-219 Set MyEdWord to null - we will check for this in the calling functions - return; - } - } - this._MyEdWord.Open(MyDSOFile.MyFile.FullName);// B2017-133 Edraw - } - doc = new LBDocumentClass(_MyEdWord.ActiveDocument()); - //Console.WriteLine("Version {0}", doc.Application.Version); - float ver; - if (!float.TryParse(doc.Application.Version, out ver)) - ver = 12.0F; - this.Enter += new EventHandler(DSOTabPanel_Enter); - // B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel - this.Leave += DSOTabPanel_Leave; - Application.DoEvents(); - // The following line corrects Symbol characters in MSWord Sections - // CheckForSymbolCharacters(doc); - InitializeWordDocument(doc); - FindSearchString(); - } - catch (Exception 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); - // TODO: Should output a message - // TODO: Should try to do a direct open using Word. - } - } - - void DSOTabPanel_Leave(object sender, EventArgs e) - { - // B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel - _InDSOTabPanel = false; - } - - private void InitializeWordDocument(LBDocumentClass doc) - { - if (MyDocumentInfo.Config == null || MyDocumentInfo.Config == "" && MyDocumentInfo.DocumentEntryCount > 0) - { - 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, - // 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.Size = (float)ds.Font.Size; - doc.Application.Selection.ParagraphFormat.SpaceBefore = 0; - doc.Application.Selection.ParagraphFormat.SpaceAfter = 0; - doc.Application.Selection.ParagraphFormat.LineSpacingRule = LBWdLineSpacing.wdLineSpaceExactly; - doc.Application.Selection.ParagraphFormat.LineSpacing = 72 / 6; // for 6 LPI - MSWordToPDF.AdjustMargins(ds, doc, false); - } - if (doc.ActiveWindow.ActivePane.View.Zoom.Percentage < 40) - doc.ActiveWindow.ActivePane.View.Zoom.Percentage = 100; - } - public void FindSearchString() - { - if (SearchString == null) return; - // Get the Document - LBDocumentClass wordDoc = new LBDocumentClass(_MyEdWord.ActiveDocument()); - //LBSelection sel = wordDoc.Application.Selection; - LBFind find = wordDoc.Application.Selection.Find; - find.ClearFormatting(); - bool wildCards = SearchString.Contains("?") || SearchString.Contains("*"); - bool found = find.Execute(SearchString, false, false, wildCards, false, false, true, LBWdFindWrap.wdFindContinue, null, null, null, false, false, false, false); - //Console.WriteLine("find = {0}", found); - } - /// - /// Text will either replace current selection or be inserted at the current cursor position if no selection - /// - /// - public void InsertText(string txt) - { - if (txt == null || txt.Length == 0) return; //nothing to insert - // Get the Document - LBDocumentClass wordDoc = new LBDocumentClass(_MyEdWord.ActiveDocument()); - //This will get the selected range or just the current cursor position - LBSelection sel = wordDoc.Application.Selection; - // This will replace the selection or insert at current position - sel.Text = txt; - } - - public string GetSelectedString() - { - LBDocumentClass wordDoc = new LBDocumentClass(_MyEdWord.ActiveDocument()); - //This will get the selected range or just the current cursor position - LBSelection sel = wordDoc.Application.Selection; - // if the start & end are the same, nothing is selected: - if (sel.Start == sel.End) return null; - 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() - { - 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 - #region Event Handlers - /// - /// Display MyTransparentPanel over the DSOPanel so that the Word "Inactive" appears in the upper right hand corner. - /// - public void InActive() - { - _MyTransparentPanel.BringToFront(); - } - /// - /// Force this item to be selected when the transparent window is clicked. - /// This will in-turn send the Transparent Panel to back and make the DSO Panel - /// editable. - /// - /// - /// - void _MyTransparentPanel_Click(object sender, EventArgs e) - { - this.Select(); - } - ///// - ///// If the user presses the save button, tell the file to save it's contents to the database - ///// - ///// - ///// - //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() - { - // Unfortunately, the only way to handle view mode for DSO Framer is to not save. - if (PanelViewEditMode == E_ViewMode.View) - { - MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip); - return; - } - LBDocumentClass doc = new LBDocumentClass(_MyEdWord.ActiveDocument()); - //while (doc.Saved = false) - // Application.DoEvents(); - string tmp = GetReflectiveProperty(_MyEdWord.ActiveDocument(), "FullName"); - if (System.IO.File.Exists(tmp)) - MyDSOFile.FullName = tmp; - else - _MyLog.FatalFormat("File does not exist {0}\r\nFile was {1}", tmp, MyDSOFile.FullName); - // if this was a library document, ask user if it should be saved for all usages. - bool cvtLibDoc = false; - if (MyDisplayTabItem.MyItemInfo != null) // B2016-131 if myiteminfo is null then the lib doc is not referenced, so just save the changes - don't generate a pdf - { - EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry; - 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 - 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; - DialogResult ans = FlexibleMessageBox.Show(msgstr, "Document Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (ans == DialogResult.No) cvtLibDoc = true; - } - } - MyDSOFile.SaveFile(doc.Length, doc.Ascii, MyDisplayTabItem.MyItemInfo, cvtLibDoc, StatusChanged); - if (cvtLibDoc) - { - MyDisplayTabItem.Text = MyDisplayTabItem.MyItemInfo.TabTitle; - MyDisplayTabItem.Tooltip = MyDisplayTabItem.MyItemInfo.TabToolTip; - MyDisplayTabItem.SetPrivateTooltip(MyDisplayTabItem.MyItemInfo.TabToolTip); - } - } - public void StatusChanged(VolianStatusType type, int count, string text) - { - if (Parent != null && Parent.Parent != null && Parent.Parent.Parent is DisplayTabControl) - { - DisplayTabControl tc = Parent.Parent.Parent as DisplayTabControl; - tc.ONStatusChanged(this, new DisplayTabControlStatusEventArgs(type, count, text)); - } - } - ///// - ///// Before a document closes check to see if it's contents should be saved. - ///// - ///// - ///// - //void _MyDSOFramer_BeforeDocumentClosed(object sender, AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEvent e) - //{ - // SaveDSOPhase1(); - //} - - private void SaveDSO_Phase1() - { - try - { - if (!IsBeingDeleted) - SaveDirty(); - this.Enter -= new EventHandler(DSOTabPanel_Enter); - // B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel - this.Leave -= DSOTabPanel_Leave; - // SaveDirty(); // SaveDirty happens in CloseDSO(bool) - } - catch (Exception ex) - { - _MyLog.Warn("Before Closing Document ", ex); - } - } - /// - /// Save the contents of the Word Document to a file - /// and save the file to the database - /// - /// - public bool SaveDSO() - { - bool result = true; - try - { - bool stat = _MyEdWord.Save();// B2017-133 Edraw - //Console.WriteLine("Save = {0}", stat); - 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) - { - if (_MyLog.IsErrorEnabled) _MyLog.Error("SaveDSO", ex); - MessageBox.Show(ex.Message, "Error Saving Document", MessageBoxButtons.OK, MessageBoxIcon.Error); - result = false; - } - return result; - } - /// - /// Check to see if a Word document should be saved. If it is dirty ask the user if the - /// changes should be changed. Save the changes if the user says "yes". - /// - /// - public bool SaveDirty() - { - if (OverrideClose) - return false; - // B2017-249 Recover Temporary File And AutoSave support for MSWord - if (IsDirty || MyDSOFile.MyDocument.ContentIsDirty) - { - // Unfortunately, the only way to handle view mode for DSO Framer is to not save. - if (PanelViewEditMode == E_ViewMode.View || !_AllowedToEdit) - { - MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip); - 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 - // 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; - if (FlexibleMessageBox.Show(msgstr, (IsDirty ? "Document has Changed" : "Previous Changes were not Saved"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) - return SaveDSO(); - //Console.WriteLine("Delete {0}", MyDSOFile.MyFile.Name); - DeleteOnClose = true; - return false; - } - return true; - } - // B2017-249 Recover Temporary File And AutoSave support for MSWord - private bool _DeleteOnClose = false; - - public bool DeleteOnClose - { - get { return _DeleteOnClose; } - set { _DeleteOnClose = value; } - } - public static bool IgnoreEnter = false; - private bool _In_DSOTabPanel_Enter=false; - // B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel - private bool _InDSOTabPanel = false; - /// - /// When a Word document is selected make sure it's tab is activated and - /// the SelectedItem for the DisplayTabControl is updated. - /// - /// - /// - private void DSOTabPanel_Enter(object sender, EventArgs e) - { - // B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel - _InDSOTabPanel = true; - if (IgnoreEnter) return; - _MyTransparentPanel.SendToBack(); - - // Set whether this worddoc is in view/edit mode by checking whether the - // procedure is in view/edit mode (based on the steppanel. This occurs on - // the enter event so that the mode is determined any time this panel becomes - // active. - // find steptabpanel and its view/edit. If it doesn't have a steptabpanel - // use default - edit. Later when we have ownership, need to use that. - PanelViewEditMode = E_ViewMode.Edit; // default to edit - if (MyDisplayTabItem.MyItemInfo != null) // lib doc with no associated active procedure defaults to edit - { - StepTabPanel stpanel = _MyDisplayTabControl.GetProcedureTabPanel(MyDisplayTabItem.MyItemInfo); - 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; - //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; - if (MyDisplayTabItem.MyItemInfo != null) - _MyDisplayTabControl.OnItemSelectedChanged(this,new ItemSelectedChangedEventArgs(MyDisplayTabItem.MyItemInfo)); - _MyEdWord.Focus(); - _In_DSOTabPanel_Enter = false; - _MyDisplayTabControl.SelectedDisplayTabItem = MyDisplayTabItem; - // B2018-070 Position the text cursor - Activate MS Word Panel - try - { - _MyEdWord.GotoItem(EDWordLib.WdGoToItem.wdGoToObject, EDWordLib.WdGoToDirection.wdGoToNext, 0, null); - } - catch - { - //B2026-067 - Do nothing if cannot Position cursor - } - - } - #endregion - #region Public Methods - private bool _IsBeingDeleted = false; - public bool IsBeingDeleted - { - get { return _IsBeingDeleted; } - set { _IsBeingDeleted = value; } - } - /// - /// Cleans-up the DSO Framer window - /// - /// - public bool CloseDSO() - { - return CloseDSO(false); - } - /// - /// Cleans-up the DSO Framer window - /// - /// - /// - public bool CloseDSO(bool force) - { - _MyLog.Debug("CloseDSO"); - bool result = true; - try - { - if (_MyEdWord != null) - { - SaveDSO_Phase1(); - _MyEdWord.CloseDoc(); - Controls.Remove(_MyEdWord); - components.Remove(_MyEdWord); - _MyEdWord.Dispose(); - _MyEdWord = null; - // B2017-249 Recover Temporary File And AutoSave support for MSWord - if (DeleteOnClose) MyDSOFile.MyFile.Delete(); - _Count--; - } - } - catch (Exception ex) - { - if (_MyLog.IsErrorEnabled) _MyLog.Error("SaveDSO - " + this.Name, ex); - result = false; - } - return result; - } - /// - /// Activates the current DSO Framer window (Word) - /// - 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 - #region DocumentProperties - - private string GetReflectiveProperty(object objectToInspect, string propertyName) - { - string returnString = ""; - //To use reflection on an object, you - // first need to get an instance - // of that object's type. - Type objectType = objectToInspect.GetType(); - //After you have the object's type, you can get - // information on that type. In this case, we're - // asking the type to tell us all the - // properties that it contains. - PropertyInfo[] properties = objectType.GetProperties(); - //You can then use the PropertyInfo array - // to loop through each property of the type. - foreach (PropertyInfo property in properties) - { - //The interest part of this code - // is the GetValue method. This method - // returns the value of the property. - if(property.Name == propertyName) - return property.GetValue(objectToInspect, null).ToString(); - } - return null; - } - #endregion - public override string ToString() - { - return string.Format("DSOTabPanel Document {0}", MyDocumentInfo.DocID); - } - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayApplicability.Designer.cs b/PROMS/Volian.Controls.Library/DisplayApplicability.Designer.cs deleted file mode 100644 index e51b1e5b..00000000 --- a/PROMS/Volian.Controls.Library/DisplayApplicability.Designer.cs +++ /dev/null @@ -1,174 +0,0 @@ -using System.Security.Cryptography; -using VEPROMS.CSLA.Library; - -namespace Volian.Controls.Library -{ - partial class DisplayApplicability - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.gpMode = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.gpItem = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.btnApplicabilitychg = new DevComponents.DotNetBar.ButtonX(); - this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip(); - this.gpItem.SuspendLayout(); - this.SuspendLayout(); - // - // btnApplicabilitychg - // - this.btnApplicabilitychg.Location = new System.Drawing.Point(90, 8); - this.btnApplicabilitychg.Margin = new System.Windows.Forms.Padding(4); - this.btnApplicabilitychg.BackColor = System.Drawing.SystemColors.Control; - this.btnApplicabilitychg.Name = "btnApplicabilitychg"; - this.btnApplicabilitychg.Size = new System.Drawing.Size(87, 22); - this.btnApplicabilitychg.Margin = new System.Windows.Forms.Padding(2); - this.btnApplicabilitychg.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.superTooltip1.SetSuperTooltip(this.btnApplicabilitychg, new DevComponents.DotNetBar.SuperTooltipInfo("Set All at Level", "", "When clicked, all steps at that level of the current step will be set to the selected applicability. Note that the Set All at Level button is disabled for RNO step types unless they are substeps off of a RNO step.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); // C2026-034 fix tool tip text. - this.btnApplicabilitychg.TabIndex = 0; - this.btnApplicabilitychg.Text = "Set All at Level"; - this.btnApplicabilitychg.ColorTable = DevComponents.DotNetBar.eButtonColor.BlueOrb; - this.btnApplicabilitychg.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnApplicabilitychg.Click += new System.EventHandler(this.BtnApplicabilitychg_Click); - // - // gpMode - // - this.gpMode.AutoSize = true; - this.gpMode.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.gpMode.CanvasColor = System.Drawing.SystemColors.Control; - this.gpMode.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.gpMode.DisabledBackColor = System.Drawing.Color.Empty; - this.gpMode.Dock = System.Windows.Forms.DockStyle.Top; - this.gpMode.Location = new System.Drawing.Point(0, 0); - this.gpMode.Margin = new System.Windows.Forms.Padding(4); - this.gpMode.Name = "gpMode"; - this.gpMode.Padding = new System.Windows.Forms.Padding(13, 12, 13, 37); - this.gpMode.Size = new System.Drawing.Size(432, 49); - // - // - // - this.gpMode.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.gpMode.Style.BackColorGradientAngle = 90; - this.gpMode.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.gpMode.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpMode.Style.BorderBottomWidth = 1; - this.gpMode.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.gpMode.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpMode.Style.BorderLeftWidth = 1; - this.gpMode.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpMode.Style.BorderRightWidth = 1; - this.gpMode.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpMode.Style.BorderTopWidth = 1; - this.gpMode.Style.CornerDiameter = 4; - this.gpMode.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.gpMode.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.gpMode.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.gpMode.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.gpMode.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.gpMode.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.gpMode.TabIndex = 0; - this.gpMode.Text = "Viewing Mode"; - // - // gpItem - // - this.gpItem.AutoSize = true; - this.gpItem.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.gpItem.CanvasColor = System.Drawing.SystemColors.Control; - this.gpItem.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.gpItem.DisabledBackColor = System.Drawing.Color.Empty; - this.gpItem.Dock = System.Windows.Forms.DockStyle.Top; - this.gpItem.Location = new System.Drawing.Point(0, 49); - this.gpItem.Margin = new System.Windows.Forms.Padding(4); - this.gpItem.Name = "gpItem"; - this.gpItem.Padding = new System.Windows.Forms.Padding(0, 20, 0, 0); - this.gpItem.Size = new System.Drawing.Size(432, 85); - // - // - // - this.gpItem.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.gpItem.Style.BackColorGradientAngle = 90; - this.gpItem.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.gpItem.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpItem.Style.BorderBottomWidth = 1; - this.gpItem.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.gpItem.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpItem.Style.BorderLeftWidth = 1; - this.gpItem.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpItem.Style.BorderRightWidth = 1; - this.gpItem.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpItem.Style.BorderTopWidth = 1; - this.gpItem.Style.CornerDiameter = 4; - this.gpItem.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.gpItem.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.gpItem.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.gpItem.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.gpItem.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.gpItem.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.gpItem.TabIndex = 1; - this.gpItem.Text = "Item Mode"; - // - // DisplayApplicability - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.gpItem); - this.Controls.Add(this.gpMode); - this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "DisplayApplicability"; - this.Size = new System.Drawing.Size(432, 807); - this.gpItem.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - // - // superTooltip1 - // - this.superTooltip1.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray); - this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - - } - - #endregion - - private DevComponents.DotNetBar.Controls.GroupPanel gpMode; - private DevComponents.DotNetBar.Controls.GroupPanel gpItem; - private DevComponents.DotNetBar.ButtonX btnApplicabilitychg; - private DevComponents.DotNetBar.SuperTooltip superTooltip1; - - } -} - diff --git a/PROMS/Volian.Controls.Library/DisplayApplicability.cs b/PROMS/Volian.Controls.Library/DisplayApplicability.cs deleted file mode 100644 index e9b68be0..00000000 --- a/PROMS/Volian.Controls.Library/DisplayApplicability.cs +++ /dev/null @@ -1,496 +0,0 @@ -using JR.Utils.GUI.Forms; -using log4net.Util; -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 VEPROMS.CSLA.Library; - -namespace Volian.Controls.Library -{ - public partial class DisplayApplicability : UserControl - { - public delegate void DisplayApplicabilityEvent(object sender, EventArgs args); - public event DisplayApplicabilityEvent ApplicabilityViewModeChanged; - private void OnApplicabilityViewModeChanged() - { - if (ApplicabilityViewModeChanged != null) - ApplicabilityViewModeChanged(this, new EventArgs()); - } - - private DisplayTabItem _MyDisplayTabItem = null; - public DisplayTabItem MyDisplayTabItem - { - get { return _MyDisplayTabItem; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - _MyDisplayTabItem = value; - gpMode.Controls.Clear(); - gpItem.Controls.Clear(); - MyCheckBoxes.Clear(); - if (_MyDisplayTabItem != null) - { - //B2026-043 Fix "Set All At Level" button. - DevComponents.DotNetBar.Controls.GroupPanel gpSubItem = InitializegpSubItem(); - - DocVersionConfig dcfg = _MyDisplayTabItem.MyItemInfo.MyDocVersion.MyConfig as DocVersionConfig; - List names = new List(); - for (int n = 1; n <= dcfg.Unit_Count; n++) - { - dcfg.SelectedSlave = n; - names.Add(dcfg.Unit_Name); - } - dcfg.SelectedSlave = 0; - int apple = -1; - if(_MyDisplayTabItem.MyStepTabPanel != null) - apple = _MyDisplayTabItem.MyStepTabPanel.MyStepPanel.ApplDisplayMode; - AddViewMode("Master", "-1", apple == -1); - int i = 0; - foreach (string name in names) - { - i++; - AddViewMode($"{name.Trim()} (View Only)", i.ToString(), apple == i); - } - - AddItemMode("All", "-1", ref gpSubItem); - i = 0; - foreach (string name in names) - AddItemMode(name.Trim(), (++i).ToString(), ref gpSubItem); - AddItemMode("None", "0", ref gpSubItem); - gpItem.Controls.Add(gpSubItem); - gpSubItem.BringToFront(); - gpItem.Controls.Add(btnApplicabilitychg); - btnApplicabilitychg.BringToFront(); - if (_MyDisplayTabItem.MyStepTabPanel != null) - { - MyItemInfo = _MyDisplayTabItem.MyStepTabPanel.MyStepPanel.SelectedItemInfo; - } - else - { - MyItemInfo = _MyDisplayTabItem.MyItemInfo; - } - } - } - } - public int ViewMode - { - get - { - foreach (Control c in gpMode.Controls) - { - RadioButton rb = c as RadioButton; - if (rb.Checked) - return int.Parse(rb.Tag.ToString()); - } - return 0; - } - } - private DevComponents.DotNetBar.Controls.GroupPanel InitializegpSubItem() //B2026-043 Fix "Set All At Level" button. - { - DevComponents.DotNetBar.Controls.GroupPanel gpSubItem; - gpSubItem = new DevComponents.DotNetBar.Controls.GroupPanel - { - AutoSize = true, - AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink, - CanvasColor = System.Drawing.SystemColors.Control, - ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007, - DisabledBackColor = System.Drawing.Color.Empty, - Dock = System.Windows.Forms.DockStyle.Top, - Location = new System.Drawing.Point(0, 49), - Margin = new System.Windows.Forms.Padding(4), - Name = "gpSubItem", - Padding = new System.Windows.Forms.Padding(13, 12, 13, 37) - }; - gpSubItem.BackColor = Color.Transparent; - gpSubItem.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - gpSubItem.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - gpSubItem.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - gpSubItem.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - gpSubItem.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - gpSubItem.TabIndex = 1; - gpSubItem.Text = ""; - gpSubItem.Location = new System.Drawing.Point(0, 49); - gpSubItem.Size = new System.Drawing.Size(400, 250); - return gpSubItem; - } - private Dictionary MyCheckBoxes = new Dictionary(); - private string _MyApplicability = string.Empty; - public string MyApplicability - { - get { return _MyApplicability; } - set { _MyApplicability = value; } - } - - //C2026-021 Expand Functionality of Viewing Mode - public bool ShowItemSelection = true; - public void SetEnableDisableItemSelection(bool value) => gpItem.Enabled = ShowItemSelection = value; - - private void AddItemMode(string name, string value, ref DevComponents.DotNetBar.Controls.GroupPanel gpSubItem) - { - CheckBox cb = new CheckBox(); - cb.BackColor = Color.Transparent; - cb.Height = 24; - cb.Width = 75; - cb.AutoSize = true; - cb.Text = name; - cb.Tag = value; - cb.Dock = DockStyle.Top; - gpSubItem.Controls.Add(cb); - cb.BringToFront(); - cb.CheckedChanged += new EventHandler(cb_CheckedChanged); - MyCheckBoxes.Add(value == null ? -1 : int.Parse(value), cb); - } - private void cb_CheckedChanged(object sender, EventArgs e) - { - EditItem ei = MyDisplayTabItem.MyStepTabPanel.SelectedEditItem; - ei.SaveCurrentAndContents(); // C2026-035 save unsaved step text. - UnwireCheckboxes(false); - CheckBox cb = sender as CheckBox; - CheckState cs = cb.CheckState; - switch (cb.Tag.ToString()) - { - case "-1": - if (cs == CheckState.Checked) - { - SetCheckboxes(CheckState.Checked); - MyCheckBoxes[0].CheckState = CheckState.Unchecked; - } - else - { - SetCheckboxes(CheckState.Unchecked); - MyCheckBoxes[0].CheckState = CheckState.Checked; - } - break; - case "0": - if (cs == CheckState.Unchecked) - SetCheckboxes(CheckState.Checked); - else - SetCheckboxes(CheckState.Unchecked); - cb.CheckState = cs; - break; - default: - if (AllNumbered(CheckState.Checked)) - { - MyCheckBoxes[-1].CheckState = CheckState.Checked; - MyCheckBoxes[0].CheckState = CheckState.Unchecked; - } - else if (AllNumbered(CheckState.Unchecked)) - { - MyCheckBoxes[-1].CheckState = CheckState.Unchecked; - MyCheckBoxes[0].CheckState = CheckState.Checked; - } - else - { - MyCheckBoxes[-1].CheckState = CheckState.Unchecked; - MyCheckBoxes[0].CheckState = CheckState.Unchecked; - } - break; - } - - WireCheckboxes(); - MyApplicability = string.Empty; - string sep = string.Empty; - foreach (int i in MyCheckBoxes.Keys) - { - if (i < 0 && MyCheckBoxes[i].CheckState == CheckState.Checked) - { - MyApplicability = i.ToString(); - break; - } - else if (i == 0 && MyCheckBoxes[i].CheckState == CheckState.Checked) - { - MyApplicability = i.ToString(); - break; - } - else - { - if (MyCheckBoxes[i].CheckState == CheckState.Checked) - { - MyApplicability += sep + i.ToString(); - sep = ","; - } - } - } - List invalidTrans = WillTransitionsBeValidCommand.Execute(MyItemInfo.ItemID, MyApplicability); - // 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) - if ((!MyItemInfo.IsProcedure && invalidTrans.Count == 0) || IsProcWithNoExternalTrans(MyItemInfo, invalidTrans)) - { - // C2021 - 027: Procedure level PC/PC - if (MyItemInfo.IsProcedure && MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ProcAppl) - { - ProcedureConfig sc = MyItemInfo.MyConfig as ProcedureConfig; - sc.MasterSlave_Applicability = Volian.Base.Library.BigNum.MakeBigNum(MyApplicability); - } - else if (MyItemInfo.IsSection) - { - SectionConfig sc = MyItemInfo.MyConfig as SectionConfig; - sc.MasterSlave_Applicability = Volian.Base.Library.BigNum.MakeBigNum(MyApplicability); - } - else - { - StepConfig sc = MyItemInfo.MyConfig as StepConfig; - sc.MasterSlave_Applicability = Volian.Base.Library.BigNum.MakeBigNum(MyApplicability); - } - } - else - { - StringBuilder sb = new StringBuilder(); - string tmpwrd = MyItemInfo.IsSection ? "section" : "step"; - sb.AppendLine($"The applicability for this {tmpwrd} cannot be changed due to transition links."); - sb.AppendLine("Applicability settings will return to original settings when OK is selected."); - sb.AppendLine($"Changing the applicability for this {tmpwrd} will invalidate a transition in the following steps..."); - - sb.AppendLine(); - // B2021-149: if step, put out line for every invalidTrans, if procedure only put out those that are external - // determine this by looking strings for source and target (to), if procedure level and internal the target starts - // with the src, i.e. procedure. - foreach (InvalidTransition inv in invalidTrans) - if (!MyItemInfo.IsProcedure || !inv.TgtStep.StartsWith(inv.SrcStep))sb.AppendLine(string.Format("From {0} to {1}",inv.TgtStep, inv.SrcStep)); - // MessageBox.Show(sb.ToString()); - // B2013-185 use FlexibleMessageBox to display a long list with a scroll bar - FlexibleMessageBox.Show(sb.ToString(), "Transitions Affected By Applicability Change"); - MyItemInfo = MyItemInfo; - } - // C2021 - 027: Procedure level PC/PC - checkbox for applicability changed, fix ribbon's menus - if (MyItemInfo.IsProcedure) _MyDisplayTabItem.MyStepTabPanel.MyStepTabRibbon.SetParentChildCreatePDFButton(MyItemInfo.MyDocVersion.UnitNames, MyItemInfo); - - } - private void BtnApplicabilitychg_Click(object sender, System.EventArgs e) - { - Volian.Base.Library.BigNum MasterSlave_ApplicabilityTmp; - StepConfig sc = MyItemInfo.MyConfig as StepConfig; - MasterSlave_ApplicabilityTmp = sc.MasterSlave_Applicability; - StringBuilder sb = new StringBuilder(); - - EditItem ei = MyDisplayTabItem.MyStepTabPanel.SelectedEditItem; - ei.SaveCurrentAndContents(); // C2026-035 save unsaved step text. - - - - ItemInfo startitm = MyItemInfo.FirstSibling; - while (startitm != null) - { - - // C2026-023: Check for Transitions when setting Applicability to all for a level - List invalidTrans = WillTransitionsBeValidCommand.Execute(startitm.ItemID, MasterSlave_ApplicabilityTmp.ToString()); - if (IsProcWithNoExternalTrans(startitm, invalidTrans)) - { - StepConfig sc2 = startitm.MyConfig as StepConfig; - using (Content cnt = Content.Get(startitm.MyContent.ContentID)) - { - sc2.MasterSlave_Applicability = (MasterSlave_ApplicabilityTmp); - cnt.Config = sc2.ToString(); - cnt.Save(); - } - } - else - { - if (sb.Length == 0) - { - sb.AppendLine("The applicability for some Step(s) cannot be changed due to transition links."); - sb.AppendLine("Applicability settings for these steps will return to original settings when OK is selected."); - sb.AppendLine("Changing the applicability for would invalidate a transition in the following steps:"); - sb.AppendLine(); - } - - foreach (InvalidTransition inv in invalidTrans.Where(x => !x.TgtStep.StartsWith(x.SrcStep))) - { - sb.AppendLine(string.Format("{0} : From {1} to {2}.", startitm.MyTab.CleanTextNoSymbols.Trim(), inv.TgtStep, inv.SrcStep)); - } - - invalidTrans.Clear(); - } - - startitm = startitm.GetNext(); - } - - _MyDisplayTabItem.MyStepTabPanel.MyStepTabRibbon.RefreshProcedure(); - - if (sb.Length > 0) - FlexibleMessageBox.Show(sb.ToString(), "Transitions Affected By Applicability Change"); - - - } - - // B2021-149: for procedure, only consider external transitions as invalid - private bool IsProcWithNoExternalTrans(ItemInfo ii, List invalidTrans) - { - if (invalidTrans.Count == 0) return true; - foreach (InvalidTransition iT in invalidTrans) - { - // if target (to location) does not start with source location (procedure) then this is external - // i.e. from a different procedure - if (!iT.TgtStep.StartsWith(iT.SrcStep)) return false; - } - return true; - } - private bool AllNumbered(CheckState checkState) - { - foreach (CheckBox cb in MyCheckBoxes.Values) - if (int.Parse(cb.Tag.ToString()) > 0 && cb.CheckState != checkState) - return false; - return true; - } - private void SetCheckboxes(CheckState cs) - { - foreach (CheckBox cb in MyCheckBoxes.Values) - cb.CheckState = cs; - } - private ItemInfo _MyItemInfo; - public ItemInfo MyItemInfo - { - get { return _MyItemInfo; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - if (_MyItemInfo != null) - { - MyApplicability = string.Empty; - string sep = string.Empty; - foreach (int i in MyCheckBoxes.Keys) - { - if (i < 0 && MyCheckBoxes[i].CheckState == CheckState.Checked) - { - MyApplicability = i.ToString(); - break; - } - else if (i == 0 && MyCheckBoxes[i].CheckState == CheckState.Checked) - { - MyApplicability = i.ToString(); - break; - } - else - { - if (MyCheckBoxes[i].CheckState == CheckState.Checked) - { - MyApplicability += sep + i.ToString(); - sep = ","; - } - } - } - } - _MyItemInfo = value; - if (_MyItemInfo != null) - { - if (this.Visible == false) return; - if (_MyItemInfo.IsRNOPart == true) // Check if step is an RNO disable "Set All To Level" button. - { - btnApplicabilitychg.Enabled = false; - } - else - { - btnApplicabilitychg.Enabled = true; - } - IItemConfig cfg = _MyItemInfo.MyConfig as IItemConfig; - List apples = cfg.MasterSlave_Applicability.GetFlags(); - UnwireCheckboxes(true); - if (apples.Count == 0) - { - SetCheckboxes(CheckState.Checked); - MyCheckBoxes[0].CheckState = CheckState.Unchecked; - } - else - { - foreach (int apple in apples) - { - if(apple < MyCheckBoxes.Count) - MyCheckBoxes[apple].CheckState = CheckState.Checked; - } - } - WireCheckboxes(); - } - } - } - private void WireCheckboxes() - { - foreach (CheckBox cb in MyCheckBoxes.Values) - { - cb.CheckedChanged -= new EventHandler(cb_CheckedChanged); - cb.CheckedChanged += new EventHandler(cb_CheckedChanged); - } - } - private void UnwireCheckboxes(bool reset) - { - foreach (CheckBox cb in MyCheckBoxes.Values) - { - cb.CheckedChanged -= new EventHandler(cb_CheckedChanged); - if(reset) - cb.CheckState = CheckState.Unchecked; - } - } - private void DisableCheckboxes() - { - foreach (CheckBox cb in MyCheckBoxes.Values) - cb.Enabled = false; - } - private void EnableCheckboxes() - { - foreach (CheckBox cb in MyCheckBoxes.Values) - cb.Enabled = true; - } - private void AddViewMode(string name, string value) - { - AddViewMode(name, value, false); - } - private void AddViewMode(string name, string value, bool selected) - { - RadioButton rb = new RadioButton(); - rb.BackColor = Color.Transparent; - rb.Text = name; - rb.Tag = value; - rb.Dock = DockStyle.Top; - gpMode.Controls.Add(rb); - rb.BringToFront(); - rb.Checked = selected; - rb.CheckedChanged += new EventHandler(rb_CheckedChanged); - } - private void rb_CheckedChanged(object sender, EventArgs e) - { - RadioButton rb = sender as RadioButton; - if (rb.Checked) - { - if (int.Parse(rb.Tag.ToString()) > 0) - { - DisableCheckboxes(); - MyCheckBoxes[int.Parse(rb.Tag.ToString())].Enabled = true; - } - else - EnableCheckboxes(); - OnApplicabilityViewModeChanged(); - EditItem ei = MyDisplayTabItem.MyStepTabPanel.SelectedEditItem; - while (ei!=null && ei.Enabled == false) - ei = ei.MyParentEditItem ?? ei.MyPreviousEditItem; - // C2021 - 027: Procedure level PC/PC - handle procedure level too for viewing in editor - if (MyDisplayTabItem.MyStepTabPanel.SelectedItemInfo != null && MyDisplayTabItem.MyStepTabPanel.SelectedItemInfo.IsProcedure) - ei = MyDisplayTabItem.MyStepTabPanel.SelectedEditItem; - if (ei != null) ei.MyStepRTB.Focus(); - } - } - - private static UserInfo _MyUserInfo = null; - public static UserInfo MyUserInfo - { - get { return _MyUserInfo; } - set { _MyUserInfo = value; } - } - - public DisplayApplicability() - { - InitializeComponent(); //B2026-043 Fix "Set All At Level" button. - this.VisibleChanged += new EventHandler(DisplayApplicability_VisibleChanged); - } - - void DisplayApplicability_VisibleChanged(object sender, EventArgs e) - { - MyItemInfo = MyItemInfo; - gpItem.Enabled = ShowItemSelection && UserInfo.CanEdit(MyUserInfo,(MyItemInfo == null) ? null : MyItemInfo.MyDocVersion); //Can Change Applicability - } - } -} - diff --git a/PROMS/Volian.Controls.Library/DisplayApplicability.resx b/PROMS/Volian.Controls.Library/DisplayApplicability.resx deleted file mode 100644 index 19dc0dd8..00000000 --- a/PROMS/Volian.Controls.Library/DisplayApplicability.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplayBookMarks.Designer.cs b/PROMS/Volian.Controls.Library/DisplayBookMarks.Designer.cs deleted file mode 100644 index 9acd993f..00000000 --- a/PROMS/Volian.Controls.Library/DisplayBookMarks.Designer.cs +++ /dev/null @@ -1,167 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class DisplayBookMarks - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.groupPanelBookMarks = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.lbxBookMarks = new System.Windows.Forms.ListBox(); - this.btnClrBookMrks = new DevComponents.DotNetBar.ButtonX(); - this.btnRmvCurBookMrk = new DevComponents.DotNetBar.ButtonX(); - this.btnSetBookMrk = new DevComponents.DotNetBar.ButtonX(); - this.superTooltipBookMark = new DevComponents.DotNetBar.SuperTooltip(); - this.groupPanelBookMarks.SuspendLayout(); - this.SuspendLayout(); - // - // groupPanelBookMarks - // - this.groupPanelBookMarks.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelBookMarks.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelBookMarks.Controls.Add(this.lbxBookMarks); - this.groupPanelBookMarks.Controls.Add(this.btnClrBookMrks); - this.groupPanelBookMarks.Controls.Add(this.btnRmvCurBookMrk); - this.groupPanelBookMarks.Controls.Add(this.btnSetBookMrk); - this.groupPanelBookMarks.Dock = System.Windows.Forms.DockStyle.Fill; - this.groupPanelBookMarks.Location = new System.Drawing.Point(0, 0); - this.groupPanelBookMarks.Name = "groupPanelBookMarks"; - this.groupPanelBookMarks.Size = new System.Drawing.Size(292, 607); - // - // - // - this.groupPanelBookMarks.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelBookMarks.Style.BackColorGradientAngle = 90; - this.groupPanelBookMarks.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelBookMarks.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelBookMarks.Style.BorderBottomWidth = 1; - this.groupPanelBookMarks.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelBookMarks.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelBookMarks.Style.BorderLeftWidth = 1; - this.groupPanelBookMarks.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelBookMarks.Style.BorderRightWidth = 1; - this.groupPanelBookMarks.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelBookMarks.Style.BorderTopWidth = 1; - this.groupPanelBookMarks.Style.Class = ""; - this.groupPanelBookMarks.Style.CornerDiameter = 4; - this.groupPanelBookMarks.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelBookMarks.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelBookMarks.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelBookMarks.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelBookMarks.StyleMouseDown.Class = ""; - this.groupPanelBookMarks.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelBookMarks.StyleMouseOver.Class = ""; - this.groupPanelBookMarks.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelBookMarks.TabIndex = 0; - this.groupPanelBookMarks.Text = "Bookmarks"; - // - // lbxBookMarks - // - this.lbxBookMarks.BackColor = System.Drawing.Color.Cornsilk; - this.lbxBookMarks.Dock = System.Windows.Forms.DockStyle.Fill; - this.lbxBookMarks.FormattingEnabled = true; - this.lbxBookMarks.HorizontalScrollbar = true; - this.lbxBookMarks.ItemHeight = 16; - this.lbxBookMarks.Location = new System.Drawing.Point(0, 87); - this.lbxBookMarks.Name = "lbxBookMarks"; - this.lbxBookMarks.Size = new System.Drawing.Size(286, 484); - this.superTooltipBookMark.SetSuperTooltip(this.lbxBookMarks, new DevComponents.DotNetBar.SuperTooltipInfo("List of Bookmarks", "", "Selecting bookmark will make that item the active item in the editor. Also, once" + - " selected, the bookmark can be removed.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.lbxBookMarks.TabIndex = 7; - this.lbxBookMarks.Click += new System.EventHandler(this.lbxBookMarks_Click); - // - // btnClrBookMrks - // - this.btnClrBookMrks.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnClrBookMrks.Dock = System.Windows.Forms.DockStyle.Top; - this.btnClrBookMrks.Location = new System.Drawing.Point(0, 58); - this.btnClrBookMrks.Name = "btnClrBookMrks"; - this.btnClrBookMrks.Size = new System.Drawing.Size(286, 29); - this.superTooltipBookMark.SetSuperTooltip(this.btnClrBookMrks, new DevComponents.DotNetBar.SuperTooltipInfo("Clear ALL Bookmarks", "", "Removes all bookmarks in the list.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnClrBookMrks.TabIndex = 6; - this.btnClrBookMrks.Text = "Clear ALL Bookmarks"; - this.btnClrBookMrks.ThemeAware = true; - this.btnClrBookMrks.Click += new System.EventHandler(this.btnClrBookMrks_Click); - // - // btnRmvCurBookMrk - // - this.btnRmvCurBookMrk.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnRmvCurBookMrk.Dock = System.Windows.Forms.DockStyle.Top; - this.btnRmvCurBookMrk.Location = new System.Drawing.Point(0, 29); - this.btnRmvCurBookMrk.Name = "btnRmvCurBookMrk"; - this.btnRmvCurBookMrk.Size = new System.Drawing.Size(286, 29); - this.superTooltipBookMark.SetSuperTooltip(this.btnRmvCurBookMrk, new DevComponents.DotNetBar.SuperTooltipInfo("Remove Bookmark", "", "Removes the selected bookmark from the list.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnRmvCurBookMrk.TabIndex = 5; - this.btnRmvCurBookMrk.Text = "Remove Bookmark"; - this.btnRmvCurBookMrk.ThemeAware = true; - this.btnRmvCurBookMrk.Click += new System.EventHandler(this.btnRmvCurBookMrk_Click); - // - // btnSetBookMrk - // - this.btnSetBookMrk.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnSetBookMrk.Dock = System.Windows.Forms.DockStyle.Top; - this.btnSetBookMrk.Location = new System.Drawing.Point(0, 0); - this.btnSetBookMrk.Name = "btnSetBookMrk"; - this.btnSetBookMrk.Size = new System.Drawing.Size(286, 29); - this.superTooltipBookMark.SetSuperTooltip(this.btnSetBookMrk, new DevComponents.DotNetBar.SuperTooltipInfo("Set Bookmark", "", "Include currently selected item in the Bookmark list. This list is retained afte" + - "r exiting program. Selecting an item from the list makes it the current edit it" + - "em.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnSetBookMrk.TabIndex = 4; - this.btnSetBookMrk.Text = "Set Bookmark"; - this.btnSetBookMrk.ThemeAware = true; - this.btnSetBookMrk.Click += new System.EventHandler(this.btnSetBookMrk_Click); - // - // superTooltipBookMark - // - this.superTooltipBookMark.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - // - // DisplayBookMarks - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.groupPanelBookMarks); - this.Name = "DisplayBookMarks"; - this.Size = new System.Drawing.Size(292, 607); - this.groupPanelBookMarks.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelBookMarks; - private System.Windows.Forms.ListBox lbxBookMarks; - private DevComponents.DotNetBar.ButtonX btnClrBookMrks; - private DevComponents.DotNetBar.ButtonX btnRmvCurBookMrk; - private DevComponents.DotNetBar.ButtonX btnSetBookMrk; - private DevComponents.DotNetBar.SuperTooltip superTooltipBookMark; - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayBookMarks.cs b/PROMS/Volian.Controls.Library/DisplayBookMarks.cs deleted file mode 100644 index 6e273885..00000000 --- a/PROMS/Volian.Controls.Library/DisplayBookMarks.cs +++ /dev/null @@ -1,157 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using JR.Utils.GUI.Forms; - -namespace Volian.Controls.Library -{ - public partial class DisplayBookMarks : UserControl - { - #region delegates and Events - // C2015-022 added event so that we can update child PROMS windows - public delegate void ResetBookMarksInPROMSWindowsEvent(object sender, EventArgs args); - public event ResetBookMarksInPROMSWindowsEvent ResetBookMarksInPROMSWindows; - private void OnResetBookMarksInPROMSWindows() - { - if (ResetBookMarksInPROMSWindows != null) - ResetBookMarksInPROMSWindows(this, new EventArgs()); - } - #endregion //delegates and Events - #region Properties - private MostRecentItemList _MyBookMarks; - public MostRecentItemList MyBookMarks - { - get { return _MyBookMarks; } - set { _MyBookMarks = value; } - } - private ItemInfo _CurItemInfo = null; - private bool _Initalizing = false; - private DisplayTabControl _MyDisplayTabControl; - public DisplayTabControl MyDisplayTabControl - { - get { return _MyDisplayTabControl; } - set - { - if (value == null) return; - _MyDisplayTabControl = value; - } - } - private EditItem _MyEditItem; - public EditItem MyEditItem - { - get { return _MyEditItem; } - set - { - if (value == null) return; - if (_CurItemInfo != null && _CurItemInfo.ItemID == value.MyItemInfo.ItemID) return; - _MyEditItem = value; - _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 - #region Constructors - public DisplayBookMarks() - { - InitializeComponent(); - //SetupBookMarks(); - } - public void SetupBookMarks() - { - if (_MyBookMarks == null) - { - _MyBookMarks = MostRecentItemList.GetMRILst((System.Collections.Specialized.StringCollection)(Properties.Settings.Default["BookMarks"]),0); - _MyBookMarks.AfterRemove += new ItemInfoEvent(_MyBookMarks_AfterRemove); - } - lbxBookMarks.SelectedValueChanged += new EventHandler(lbxBookMarks_SelectedValueChanged); - RefreshBookMarkData(); - //btnPrevPos.Enabled = false; - //lbxBookMarks.Enabled = false; - //_PrevBookMark = null; - } - - void _MyBookMarks_AfterRemove(object sender) - { - RefreshBookMarkData(); - } - private void RefreshBookMarkData() - { - ResetBookMarkList(); - OnResetBookMarksInPROMSWindows(); // C2015-022 trigger event to update child PROMS windows with current bookmark list - SaveBookMarks(); - } - - // Part of Separate Windows upgrade C2015-022 - // Call from FrmVEPROMS which spins through all of the child windows and updates the bookmark list in each - // - broke is code out of RefreshBookMarkData() - public void ResetBookMarkList() - { - lbxBookMarks.DataSource = null; - lbxBookMarks.DisplayMember = "MenuTitle"; - lbxBookMarks.DataSource = _MyBookMarks; - btnClrBookMrks.Enabled = (lbxBookMarks.Items.Count > 0); - btnRmvCurBookMrk.Enabled = lbxBookMarks.SelectedIndex > -1; - } - private void SaveBookMarks() - { - Properties.Settings.Default.BookMarks = _MyBookMarks.ToSettings(); - Properties.Settings.Default.Save(); - } - void lbxBookMarks_SelectedValueChanged(object sender, EventArgs e) - { - btnRmvCurBookMrk.Enabled = (lbxBookMarks.SelectedIndex >= 0); - } - public void AddBookMark(ItemInfo itm) - { - _MyBookMarks.Add(itm); - RefreshBookMarkData(); - } - #endregion - #region Events - private void btnSetBookMrk_Click(object sender, EventArgs e) - { - if (_CurItemInfo == null) - { - FlexibleMessageBox.Show("Cannot set a bookmark on this item."); - return; - } - _MyBookMarks.Add(_CurItemInfo); - RefreshBookMarkData(); - } - - private void btnRmvCurBookMrk_Click(object sender, EventArgs e) - { - _MyBookMarks.RemoveAt(lbxBookMarks.SelectedIndex); - RefreshBookMarkData(); - } - - private void btnClrBookMrks_Click(object sender, EventArgs e) - { - _MyBookMarks.Clear(); - RefreshBookMarkData(); - } - private void lbxBookMarks_Click(object sender, EventArgs e) - { - MostRecentItem itm = lbxBookMarks.SelectedValue as MostRecentItem; - if(itm != null) - MyDisplayTabControl.OpenItem(itm.MyItemInfo); - } - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayBookMarks.resx b/PROMS/Volian.Controls.Library/DisplayBookMarks.resx deleted file mode 100644 index 21317f5a..00000000 --- a/PROMS/Volian.Controls.Library/DisplayBookMarks.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplayFoldoutMaint.Designer.cs b/PROMS/Volian.Controls.Library/DisplayFoldoutMaint.Designer.cs deleted file mode 100644 index 71d0a4dc..00000000 --- a/PROMS/Volian.Controls.Library/DisplayFoldoutMaint.Designer.cs +++ /dev/null @@ -1,223 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class DisplayFoldoutMaint - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.groupFoldouts = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.listBoxFoldouts = new System.Windows.Forms.ListBox(); - this.groupSteps = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.lblStepSelect = new DevComponents.DotNetBar.LabelX(); - this.btnSave = new DevComponents.DotNetBar.ButtonX(); - this.pnlButtons = new DevComponents.DotNetBar.PanelEx(); - this.lstCBSteps = new System.Windows.Forms.CheckedListBox(); - this.groupFoldouts.SuspendLayout(); - this.groupSteps.SuspendLayout(); - this.pnlButtons.SuspendLayout(); - this.SuspendLayout(); - // - // groupFoldouts - // - this.groupFoldouts.CanvasColor = System.Drawing.SystemColors.Control; - this.groupFoldouts.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupFoldouts.Controls.Add(this.listBoxFoldouts); - this.groupFoldouts.Dock = System.Windows.Forms.DockStyle.Top; - this.groupFoldouts.Location = new System.Drawing.Point(0, 0); - this.groupFoldouts.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.groupFoldouts.Name = "groupFoldouts"; - this.groupFoldouts.Size = new System.Drawing.Size(340, 154); - // - // - // - this.groupFoldouts.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupFoldouts.Style.BackColorGradientAngle = 90; - this.groupFoldouts.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupFoldouts.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupFoldouts.Style.BorderBottomWidth = 1; - this.groupFoldouts.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupFoldouts.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupFoldouts.Style.BorderLeftWidth = 1; - this.groupFoldouts.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupFoldouts.Style.BorderRightWidth = 1; - this.groupFoldouts.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupFoldouts.Style.BorderTopWidth = 1; - this.groupFoldouts.Style.CornerDiameter = 4; - this.groupFoldouts.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupFoldouts.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupFoldouts.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupFoldouts.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupFoldouts.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupFoldouts.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupFoldouts.TabIndex = 0; - this.groupFoldouts.Text = "Foldouts"; - // - // listBoxFoldouts - // - this.listBoxFoldouts.Dock = System.Windows.Forms.DockStyle.Fill; - this.listBoxFoldouts.FormattingEnabled = true; - this.listBoxFoldouts.ItemHeight = 16; - this.listBoxFoldouts.Location = new System.Drawing.Point(0, 0); - this.listBoxFoldouts.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.listBoxFoldouts.Name = "listBoxFoldouts"; - this.listBoxFoldouts.Size = new System.Drawing.Size(334, 116); - this.listBoxFoldouts.TabIndex = 0; - this.listBoxFoldouts.SelectedIndexChanged += new System.EventHandler(this.listBoxFoldouts_SelectedIndexChanged); - // - // groupSteps - // - this.groupSteps.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupSteps.CanvasColor = System.Drawing.SystemColors.Control; - this.groupSteps.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupSteps.Controls.Add(this.lstCBSteps); - this.groupSteps.Controls.Add(this.lblStepSelect); - this.groupSteps.Location = new System.Drawing.Point(0, 217); - this.groupSteps.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.groupSteps.Name = "groupSteps"; - this.groupSteps.Size = new System.Drawing.Size(340, 487); - // - // - // - this.groupSteps.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupSteps.Style.BackColorGradientAngle = 90; - this.groupSteps.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupSteps.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupSteps.Style.BorderBottomWidth = 1; - this.groupSteps.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupSteps.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupSteps.Style.BorderLeftWidth = 1; - this.groupSteps.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupSteps.Style.BorderRightWidth = 1; - this.groupSteps.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupSteps.Style.BorderTopWidth = 1; - this.groupSteps.Style.CornerDiameter = 4; - this.groupSteps.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupSteps.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupSteps.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupSteps.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupSteps.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupSteps.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupSteps.TabIndex = 1; - this.groupSteps.Text = "Steps"; - // - // lblStepSelect - // - // - // - // - this.lblStepSelect.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.lblStepSelect.Location = new System.Drawing.Point(3, 2); - this.lblStepSelect.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.lblStepSelect.Name = "lblStepSelect"; - this.lblStepSelect.Size = new System.Drawing.Size(296, 23); - this.lblStepSelect.TabIndex = 1; - // - // btnSave - // - this.btnSave.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnSave.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnSave.Location = new System.Drawing.Point(21, 22); - this.btnSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.btnSave.Name = "btnSave"; - this.btnSave.Size = new System.Drawing.Size(101, 23); - this.btnSave.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnSave.TabIndex = 2; - this.btnSave.Text = "Save Selection"; - this.btnSave.Click += new System.EventHandler(this.btnSave_Click); - // - // pnlButtons - // - this.pnlButtons.CanvasColor = System.Drawing.SystemColors.Control; - this.pnlButtons.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.pnlButtons.Controls.Add(this.btnSave); - this.pnlButtons.Dock = System.Windows.Forms.DockStyle.Top; - this.pnlButtons.Location = new System.Drawing.Point(0, 154); - this.pnlButtons.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.pnlButtons.Name = "pnlButtons"; - this.pnlButtons.Size = new System.Drawing.Size(340, 63); - this.pnlButtons.Style.Alignment = System.Drawing.StringAlignment.Center; - this.pnlButtons.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.pnlButtons.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.pnlButtons.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.pnlButtons.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.pnlButtons.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.pnlButtons.Style.GradientAngle = 90; - this.pnlButtons.TabIndex = 2; - // - // lstCBSteps - // - this.lstCBSteps.CheckOnClick = true; - this.lstCBSteps.Dock = System.Windows.Forms.DockStyle.Fill; - this.lstCBSteps.FormattingEnabled = true; - this.lstCBSteps.Location = new System.Drawing.Point(0, 0); - this.lstCBSteps.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.lstCBSteps.Name = "lstCBSteps"; - this.lstCBSteps.ScrollAlwaysVisible = true; - this.lstCBSteps.Size = new System.Drawing.Size(334, 463); - this.lstCBSteps.TabIndex = 1; - // - // DisplayFoldoutMaint - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.groupSteps); - this.Controls.Add(this.pnlButtons); - this.Controls.Add(this.groupFoldouts); - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.Name = "DisplayFoldoutMaint"; - this.Size = new System.Drawing.Size(340, 706); - this.groupFoldouts.ResumeLayout(false); - this.groupSteps.ResumeLayout(false); - this.pnlButtons.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private DevComponents.DotNetBar.Controls.GroupPanel groupFoldouts; - private System.Windows.Forms.ListBox listBoxFoldouts; - private DevComponents.DotNetBar.Controls.GroupPanel groupSteps; - private DevComponents.DotNetBar.LabelX lblStepSelect; - private DevComponents.DotNetBar.ButtonX btnSave; - private DevComponents.DotNetBar.PanelEx pnlButtons; - private System.Windows.Forms.CheckedListBox lstCBSteps; - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayFoldoutMaint.cs b/PROMS/Volian.Controls.Library/DisplayFoldoutMaint.cs deleted file mode 100644 index 411e0208..00000000 --- a/PROMS/Volian.Controls.Library/DisplayFoldoutMaint.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; - -namespace Volian.Controls.Library -{ - public partial class DisplayFoldoutMaint : UserControl - { - private ItemInfo _MyItemInfo; - public ItemInfo MyItemInfo - { - get { return _MyItemInfo; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - _MyItemInfo = value; - _MainStepSection = null; - FillInControls(); - } - } - private SectionInfo _MainStepSection; - public SectionInfo MainStepSection - { - get - { - 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) - { - SectionConfig sc = (SectionConfig)si.MyConfig; - if (sc.Section_OriginalSteps == "Y") _MainStepSection = si; - } - } - return _MainStepSection; - } - } - //private ItemInfo _firstStep; - //private ItemInfo _lastStep; - private bool _Initializing; - - public DisplayFoldoutMaint() - { - InitializeComponent(); - FillInControls(); - } - - private void FillInControls() - { - // for this iteminfo, get the procedure and then the list of sections. For any section, starting with - // Foldout, add it to list: - if (MyItemInfo != null) - { - if (MyItemInfo.MyProcedure.Sections == null || MyItemInfo.MyProcedure.Sections.Count == 0) return; - _Initializing = true; - ProcedureInfo pi = MyItemInfo.MyProcedure; - listBoxFoldouts.Items.Clear(); - lstCBSteps.Items.Clear(); - foreach (SectionInfo si in pi.Sections) - if (si.DisplayText.ToUpper().StartsWith("FOLDOUT")) listBoxFoldouts.Items.Add(si); - if (listBoxFoldouts.Items.Count > 0) listBoxFoldouts.SelectedIndex = 0; - else - { - listBoxFoldouts.Items.Add("No Foldouts Exist"); - return; - } - - // find default step section & use its steps to fill in tree. - FillInSteps(); - _Initializing = false; - } - } - private void FillInSteps() - { - ItemInfo foldOutselected = listBoxFoldouts.SelectedItem as ItemInfo; - ItemInfo startitm = MainStepSection.Steps != null && MainStepSection.Steps.Count > 0 ? MainStepSection.Steps[0] : null; - while (startitm != null) - { - StepConfig sc = startitm.MyConfig as StepConfig; - if (sc != null) - { - if (sc.Step_FloatingFoldout == foldOutselected.ItemID) - { - lstCBSteps.Items.Add(startitm, CheckState.Checked); - } - else - lstCBSteps.Items.Add(startitm, CheckState.Unchecked); - } - else - lstCBSteps.Items.Add(startitm, CheckState.Unchecked); - startitm = startitm.GetNext(); - } - } - private void listBoxFoldouts_SelectedIndexChanged(object sender, EventArgs e) - { - ItemInfo foldOutselected = listBoxFoldouts.SelectedItem as ItemInfo; - int itemInList = 0; - for (int i = 0; i < lstCBSteps.Items.Count; i++) - { - ItemInfo startitm = lstCBSteps.Items[i] as ItemInfo; - StepConfig sc = startitm.MyConfig as StepConfig; - if (sc != null) - lstCBSteps.SetItemChecked(itemInList, sc.Step_FloatingFoldout == foldOutselected.ItemID); - else - lstCBSteps.SetItemChecked(itemInList, false); - itemInList++; - } - } - private void btnSave_Click(object sender, EventArgs e) - { - SectionInfo foldOutselected = listBoxFoldouts.SelectedItem as SectionInfo; - int itemInList = 0; - for (int i = 0; i < lstCBSteps.Items.Count; i++) - { - bool savit = false; - ItemInfo startitm = lstCBSteps.Items[i] as ItemInfo; - StepConfig sc = startitm.MyConfig as StepConfig; - if (lstCBSteps.GetItemChecked(itemInList)) // associate with foldout (if not already) - { - if (sc == null || sc != null && sc.Step_FloatingFoldout != foldOutselected.ItemID) - { - sc.Step_FloatingFoldout = foldOutselected.ItemID; - savit = true; - } - } - else // remove association if exists - { - if (sc != null && sc.Step_FloatingFoldout == foldOutselected.ItemID) - { - sc.Step_FloatingFoldout = 0; - savit = true; - } - } - itemInList++; - if (savit) - { - using (Item itm = startitm.Get()) - { - itm.MyContent.Config = sc.ToString(); - itm.MyContent.DTS = DateTime.Now; - itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; - itm.Save(); - } - } - } - } - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayFoldoutMaint.resx b/PROMS/Volian.Controls.Library/DisplayFoldoutMaint.resx deleted file mode 100644 index 19dc0dd8..00000000 --- a/PROMS/Volian.Controls.Library/DisplayFoldoutMaint.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplayHistory.cs b/PROMS/Volian.Controls.Library/DisplayHistory.cs deleted file mode 100644 index e00facf0..00000000 --- a/PROMS/Volian.Controls.Library/DisplayHistory.cs +++ /dev/null @@ -1,1191 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using System.IO; -using System.Text.RegularExpressions; -using JR.Utils.GUI.Forms; -using Volian.Base.Library; -using System.Linq; - -namespace Volian.Controls.Library -{ - public partial class DisplayHistory : UserControl - { - #region Events - public event DisplayHistoryReportEvent ChronologyPrintRequest; - public event DisplayHistoryReportEvent SummaryPrintRequest; - private void OnChronologyPrintRequest(DisplayHistoryReportEventArgs args) - { - if (ChronologyPrintRequest != null) - ChronologyPrintRequest(this, args); - } - private void OnSummaryPrintRequest(DisplayHistoryReportEventArgs args) - { - if (SummaryPrintRequest != null) - SummaryPrintRequest(this, args); - } - public event DisplayHistoryEvent HistorySelectionChanged; - private void OnHistorySelectionChanged(DisplayHistoryEventArgs args) - { - if (HistorySelectionChanged != null) - HistorySelectionChanged(this, args); - } - public event ItemRestoredHandler ItemRestored; - private void OnItemRestored(ItemInfo restoredItemInfo) - { - if (ItemRestored != null) ItemRestored(restoredItemInfo); - } - public event AnnotationRestoredHandler AnnotationRestored; - private void OnAnnotationRestored(AnnotationInfo restoredAnnotationInfo, ItemInfo currentItem) - { - if (AnnotationRestored != null) AnnotationRestored(restoredAnnotationInfo, currentItem); - } - #endregion - private ContentAuditInfoList _ChronologyAuditList; - private ContentAuditInfoList _SummaryAuditList; - private AnnotationAuditInfoList _AnnotationList; - private ProcedureInfo _MyProcedureInfo; - public ProcedureInfo MyProcedureInfo - { - get { return _MyProcedureInfo; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - - //CSM - C2026-010 - Set/Show Change Bar Audit History - if (value != null) - { - lbChangeBarHistory.DataSource = ChangeBarAuditHistory.GetChangeBarAuditHistory(value.ItemID); - lbChangeBarHistory.ValueMember = "AuditID"; - lbChangeBarHistory.DisplayMember = "Text"; - } - else - { - lbChangeBarHistory.DataSource = null; - } - - if (value is ProcedureInfo && _MyProcedureInfo is ProcedureInfo && value.ItemID == _MyProcedureInfo.ItemID) - return; - _MyProcedureInfo = value; - if (value == null) return; - SetRevDate(MyProcedureInfo.DTS); - if (_MyProcedureInfo != null && RefreshRequired && lbChanges.Visible) - WalkProcedure(); - } - } - private void SetRevDate(DateTime dts) - { - MyRevDate = dts; - RefreshRequired = true; - } - private ItemInfo _MyItemInfo; - public ItemInfo MyItemInfo - { - get { return _MyItemInfo; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - if (value is ItemInfo && _MyItemInfo is ItemInfo && value.ItemID == _MyItemInfo.ItemID) - return; - _MyItemInfo = value; - if (_MyItemInfo != null) - { - MyProcedureInfo = _MyItemInfo.MyProcedure; - this.Visible = true; - UpdateHistory(); - if (this.lbChanges.Visible && RefreshRequired) - WalkProcedure(); - } - else - this.Visible = false; - } - } - private EditItem _MyEditItem; - - public EditItem MyEditItem - { - get { return _MyEditItem; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - _MyEditItem = value; - if (value != null) - MyItemInfo = value.MyItemInfo; - else - MyItemInfo = null; - } - } - public void RefreshList() - { - if (MyEditItem == null) - this.Visible = false; - if (this.Visible) - { - if (RefreshRequired) - WalkProcedure(); - UpdateHistory(); - } - } - private int _ApplDisplayMode = -1; - public int ApplDisplayMode - { - get { return _ApplDisplayMode; } - set - { - if (MyProcedureInfo == null) return; - _ApplDisplayMode = value; - RefreshRequired = true; - if (_ApplDisplayMode > 0) - { - MyProcedureInfo.MyProcedure.MyContent.RefreshContentDetails(); - ProcedureConfig cfg = MyProcedureInfo.MyConfig as ProcedureConfig; - cfg.SelectedSlave = value; - if (cfg.Print_RevDate == null || cfg.Print_RevDate == string.Empty) - SetRevDate(MyProcedureInfo.DTS); - else - SetRevDate(DateTime.Parse(cfg.Print_RevDate)); - } - else - { - if (MyProcedureInfo.MyDocVersion.DocVersionConfig.Unit_Count > 1) - { - DateTime minDts = DateTime.MaxValue; - for (int j = 1; j <= MyProcedureInfo.MyDocVersion.DocVersionConfig.Unit_Count; j++) - { - ProcedureConfig cfg = MyProcedureInfo.MyConfig as ProcedureConfig; - cfg.SelectedSlave = j; - if (cfg.Print_RevDate != null && cfg.Print_RevDate != string.Empty) - { - if (DateTime.Parse(cfg.Print_RevDate) < minDts && DateTime.Parse(cfg.Print_RevDate) > MyProcedureInfo.DTS) - minDts = DateTime.Parse(cfg.Print_RevDate); - } - else - minDts = MyProcedureInfo.DTS; - } - SetRevDate(minDts); - } - else - { - ProcedureConfig cfg = MyProcedureInfo.MyConfig as ProcedureConfig; - if (cfg.Print_RevDate == null || cfg.Print_RevDate == string.Empty) - SetRevDate(MyProcedureInfo.DTS); - else - { - DateTime revDate; - if (!DateTime.TryParse(cfg.Print_RevDate, out revDate)) revDate = MyProcedureInfo.ChangeBarDate; // DateTime.Now; - SetRevDate(revDate); - //SetRevDate(DateTime.Parse(cfg.Print_RevDate)); - } - } - } - } - } - private DateTime _MyRevDate; - public DateTime MyRevDate - { - get { return _MyRevDate; } - set { _MyRevDate = value; } - } - private bool RefreshRequired = false; - public DisplayHistory() - { - InitializeComponent(); - myRTB.FormatFont = null; - RefreshRequired = true; - - if (MyProcedureInfo != null) - { - lbChangeBarHistory.DataSource = ChangeBarAuditHistory.GetChangeBarAuditHistory(MyProcedureInfo.ItemID); - } - else - { - lbChangeBarHistory.DataSource = null; - } - } - - private void lbChanges_VisibleChanged(object sender, System.EventArgs e) - { - if (ApplDisplayMode == -1) - { - ApplDisplayMode = 0; - } - if (lbChanges.Visible && RefreshRequired) - WalkProcedure(); - } - - private void lbChanges_SelectedIndexChanged(object sender, EventArgs e) - { - if (lbChanges.SelectedIndex > -1) - { - ContentAuditInfo cai = lbChanges.SelectedItem as ContentAuditInfo; - if (cai != null) - { - // 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) - FlexibleMessageBox.Show("This item has been deleted.", "Deleted Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - else - { - try - { - OnHistorySelectionChanged(new DisplayHistoryEventArgs(cai.ItemID)); - } - // If the selected item is deleted display a message rather than crashing - catch (Exception ex) - { - FlexibleMessageBox.Show("This item has been deleted.", "Deleted Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - } - } - } - else - { - AnnotationAuditInfo aai = lbChanges.SelectedItem as AnnotationAuditInfo; - OnHistorySelectionChanged(new DisplayHistoryEventArgs(aai.ItemID)); - } - } - } - private void UpdateHistory() - { - this.Cursor = Cursors.WaitCursor; - //DateTime start = DateTime.Now; - //Console.WriteLine(start); - #region setup - btnRestore.Enabled = false; - myRTB.Clear(); - //myRTB.LastRtf = string.Empty; - myVFG.Clear(); - 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 - tvAudits.Nodes.Clear(); - if (MyItemInfo == null) - { - this.Cursor = Cursors.Default; - return; - } - MyItemInfo.RefreshItemAnnotations(); - #endregion - //if (AnnotationOnly) - //{ - #region annotation deleted - //annotation deleted by itemid - TreeNode annotationDeleted = null; - AnnotationAuditInfoList aail = AnnotationAuditInfoList.GetByItemID(MyItemInfo.ItemID); - foreach (AnnotationAuditInfo aai in aail) - { - TreeNode tn = null; - if (aai.DeleteStatus > 0) - { - if (annotationDeleted == null) - annotationDeleted = tvAudits.Nodes.Add("Deleted Annotations"); - if (tn == null) - { - AnnotationTypeInfo ati = AnnotationTypeInfo.Get(aai.TypeID); - // B2023-066: Crash when trying to access a deleted annotation type (added the ati==null check) - tn = annotationDeleted.Nodes.Add(ati == null ? "Deleted Annotation Type" : ati.Name); - } - TreeNode cn = tn.Nodes.Add(aai.ListString()); - cn.Tag = aai; - } - } - //end annotation deleted - #endregion - #region annotation changes - //annotation change by annotationid - TreeNode annotationHistory = null; - if (MyItemInfo.ItemAnnotationCount > 0) - { - foreach (AnnotationInfo ai in MyItemInfo.ItemAnnotations) - { - TreeNode tn = null; - aail = AnnotationAuditInfoList.GetByAnnotationID(ai.AnnotationID); - foreach (AnnotationAuditInfo aai in aail) - { - if (aai.DTS != ai.DTS) - { - if (annotationHistory == null) - annotationHistory = tvAudits.Nodes.Add("Annotation History"); - if (tn == null) - tn = annotationHistory.Nodes.Add(string.Format("{0} - {1}", ai.MyAnnotationType.Name, ai.SearchText)); - TreeNode cn = tn.Nodes.Add(aai.ToString()); - cn.Tag = aai; - } - } - } - } - //end annotation change - #endregion - // return; - //} - #region content changes - //content changes - TreeNode contentHistory = null; - if (MyItemInfo == null) return; - 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); - foreach (ContentAuditInfo cai in cail) - { - if (cai.DeleteStatus == 0) - { - if (cai.Type == 20008) - { - GridAuditInfoList gail = GridAuditInfoList.Get(cai.ContentID); - foreach (GridAuditInfo gai in gail) - { - // B2022-038: Fix crash on restore of grid. If it doesn't have a ContentAuditID don't add to list (was causing a Null access - // when restoring the change) - if (gai.DeleteStatus == 0 && gai.ContentAuditID != 0) - { - if (contentHistory == null) - contentHistory = tvAudits.Nodes.Add("Content Changes"); //contentHistory = tvAudits.Nodes.Add("Content History"); - TreeNode tn = contentHistory.Nodes.Add(gai.ToString()); - tn.Tag = gai; - } - } - break; - } - // handle figures (images): - else if (cai.Type == 20036 || cai.Type == 20037 || cai.Type == 20038 || cai.Type == 20039) - { - ImageAuditInfoList imail = ImageAuditInfoList.Get(cai.ContentID); - foreach (ImageAuditInfo imai in imail) - { - if (imai.DeleteStatus == 0) - { - if (contentHistory == null) - contentHistory = tvAudits.Nodes.Add("Content Changes"); - TreeNode tn = contentHistory.Nodes.Add(imai.ToString()); - tn.Tag = imai; - } - } - break; - } - else if (cai.DTS != ci.DTS) - { - if (contentHistory == null) - contentHistory = tvAudits.Nodes.Add("Content Changes"); //contentHistory = tvAudits.Nodes.Add("Content History"); - TreeNode tn = contentHistory.Nodes.Add(cai.ListString()); - tn.Tag = cai; - } - } - } - //end content changes - #endregion - #region items - 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 - ItemAuditInfoList iail = ItemAuditInfoList.Get(MyItemInfo.ItemID); - 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 - // B2023-117 if DeleteStatus is zero,don't try to get Audit Info List - if (iai.DeleteStatus == 0) continue; - if (deletedItems == null) - deletedItems = tvAudits.Nodes.Add("Deleted Items"); - string strR = null; - // see if a deleted procedure, from itemaudit, get contentaudit - ContentAuditInfoList lDelC = ContentAuditInfoList.GetByDeleteStatus(iai.DeleteStatus); - foreach (ContentAuditInfo delC in lDelC) - { - if (delC.Type >= 0 && delC.Type < 1000) - { - int indx = delC.Config.IndexOf("DelProcReason"); - if (indx >= 0 && delC.Config.Length > indx + 15) // 15 accounts for 'DelProcReason = "' - { - string reason = delC.Config.Substring(indx + 15); - if (reason != null && reason.Length > 0) - { - indx = reason.IndexOf("\""); - if (indx > 0) strR = reason.Substring(0, reason.IndexOf("\"")); - } - break; - } - } - } - TreeNode tnn = deletedItems.Nodes.Add(iai.ToString() + "; Reason: " + strR); - tnn.Tag = iai; - #endregion - } - //Console.WriteLine("UpdateHistory: {0} seconds",TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds); - this.Cursor = Cursors.Default; - } - // B2020-156: If time is at midnight, only check date. - private bool CompareDateOrDateTime(DateTime dt1, DateTime dt2) - { - if (dt1.TimeOfDay == TimeSpan.Zero || dt2.TimeOfDay == TimeSpan.Zero) - { - if (dt1.Date > dt2.Date) return true; - return false; - } - if (dt1 > dt2) return true; - return false; - } - private void WalkProcedure() - { - //return; - this.ParentForm.Cursor = Cursors.WaitCursor; - Application.DoEvents(); - //DateTime start = DateTime.Now; - //Console.WriteLine(start); - lbChanges.Items.Clear(); - if (MyProcedureInfo == null) - { - this.ParentForm.Cursor = Cursors.Default; - btnViewSummaryReport.Enabled = btnViewChronologyReport.Enabled = cbSumExcludeAnn.Enabled = DT_SumAsOf.Enabled = lbChanges.Items.Count > 0; - return; - } - ContentAuditInfoList cail2; - ContentAuditInfoList cail3; - AnnotationAuditInfoList aail2; - if (ApplDisplayMode > 0) - { - cail2 = ContentAuditInfoList.GetChronologyByUnit(MyProcedureInfo.ItemID, MyProcedureInfo.ItemID, false, ApplDisplayMode, MyProcedureInfo.ChangeBarDate); - cail3 = ContentAuditInfoList.GetSummaryByUnit(MyProcedureInfo.ItemID, MyProcedureInfo.ItemID, false, ApplDisplayMode, MyProcedureInfo.ChangeBarDate); - aail2 = AnnotationAuditInfoList.GetChronologyByUnit(MyProcedureInfo.ItemID, MyProcedureInfo.ItemID, ApplDisplayMode, MyProcedureInfo.ChangeBarDate); - } - else - { - cail2 = ContentAuditInfoList.GetChronology(MyProcedureInfo.ItemID, MyProcedureInfo.ItemID, false, MyProcedureInfo.ChangeBarDate); - cail3 = ContentAuditInfoList.GetSummary(MyProcedureInfo.ItemID, MyProcedureInfo.ItemID, false, MyProcedureInfo.ChangeBarDate); - aail2 = AnnotationAuditInfoList.GetChronology(MyProcedureInfo.ItemID, MyProcedureInfo.ItemID, MyProcedureInfo.ChangeBarDate); - } - //Console.WriteLine("WalkProcedure cail2: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds); - _ChronologyAuditList = cail2; - _SummaryAuditList = cail3; - //Console.WriteLine("WalkProcedure aail2: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds); - _AnnotationList = aail2; - foreach (ContentAuditInfo cai in cail2) - { - // B2020-156: When procedure title is changed, it does not print in Summary/Chronolgy of changes. - // Need to only check the date (not the date/time) for some procedures, the original item was listed - // 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) - { - string itemTitle = FixPath(cai.Path); - lbChanges.Items.Add(cai); - } - } - foreach (AnnotationAuditInfo aai in aail2) - { - string stepnum = string.Empty; - foreach (ContentAuditInfo cai in cail2) - { - if (cai.ContentID == aai.IContentID) - { - stepnum = FixPath(cai.Path); - break; - } - } - if (stepnum == string.Empty) - { - ItemInfo iii = aai.MyItemInfo; - if (iii != null) - stepnum = FixPath(iii.SearchPath); - } - if (aai.DTS > MyRevDate) - lbChanges.Items.Add(aai); - } - //Console.WriteLine("WalkProcedure fini: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds); - this.ParentForm.Cursor = Cursors.Default; - btnViewSummaryReport.Enabled = btnViewChronologyReport.Enabled = cbSumExcludeAnn.Enabled = DT_SumAsOf.Enabled = lbChanges.Items.Count > 0; - RefreshRequired = false; - return; - } - private static string FixPath(string path) - { - string itemTitle = Regex.Replace(path, "^..+?\\u0007", ""); - itemTitle = itemTitle.Replace("\x11", itemTitle[0] == '\x11' ? "" : " - ").Replace(@"\u8209?", "-").Replace(@"\u9586?", @"\"); - return itemTitle; - } - private void btnViewChronologyReport_Click(object sender, EventArgs e) - { - 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 - 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)); - //} - } - private void btnViewSummaryReport_Click(object sender, EventArgs e) - { - 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 - MyItemInfo.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = ApplDisplayMode; - - var dhr = new DisplayHistoryReportEventArgs(string.Format(@"{0}\{1} Summary of Changes.pdf", Volian.Base.Library.VlnSettings.TemporaryFolder, MyItemInfo.MyProcedure.PDFNumber), MyItemInfo.MyProcedure, null, null); - - //C2024- 038 - Summary of Changes report generation enhancements - //check if need to modify - // _SummaryAuditList - if (DT_SumAsOf.Checked) - dhr.AuditList = FilterSummaryByDate(_SummaryAuditList, DT_SumAsOf.Value); - else - dhr.AuditList = _SummaryAuditList; - - //C2024- 038 - Summary of Changes report generation enhancements - // if Exclude Annotations Checked - // send an empty list instead of - //_AnnotationList - if (cbSumExcludeAnn.Checked) - dhr.AnnotationList = new AnnotationAuditInfoList(null); - else if (DT_SumAsOf.Checked) - dhr.AnnotationList = FilterSummaryByDate_Annotations(_AnnotationList, DT_SumAsOf.Value); - else - { dhr.AnnotationList = _AnnotationList; } - - OnSummaryPrintRequest(dhr); - } - - //C2024- 038 - Summary of Changes report generation enhancements - //modify _SummaryAuditList - //to limit to a specific date - private ContentAuditInfoList FilterSummaryByDate(ContentAuditInfoList summaryAuditList, DateTime value) - { - List slst = summaryAuditList.Clone().ToList(); - - //Grab the first change to each item before the date and set that to the AsOf date - foreach (ContentAuditInfo firstbeforedate in slst.GroupBy(x => x.ItemID).Select(x => x.OrderByDescending(y => y.DTS).FirstOrDefault(d => d.DTS < value))) - { - if (firstbeforedate != null && firstbeforedate.ActionWhat != "Deleted") - { - firstbeforedate.ActionWhat = $"As Of: {value.ToShortDateString()}"; - } - } - //remove all items before the date we are checking against - //note that for deleted - sometimes the DTS is not correct and - //need to use the ActionWhen - slst.RemoveAll(x => x.DTS < value && !x.ActionWhat.StartsWith("As Of:") && (x.ActionWhat != "Deleted" || (x.ActionWhen < x.DTS ? x.DTS : x.ActionWhen) < value)); - - //remove all items where first text matches the last text - //unless it was added after the date we are checking against - //or the last item is a deletion that occurred after - //the date we are checking against - var itms = slst.Select(x => x.ItemID).Distinct().ToList(); - foreach (int itmID in itms) - { - ContentAuditInfo first = slst.Where(i => i.ItemID == itmID).OrderBy(y => y.DTS).FirstOrDefault(); - ContentAuditInfo last = slst.Where(i => i.ItemID == itmID).OrderByDescending(y => y.DTS).FirstOrDefault(); - if (first != null && last != null && first.DTS < value && (last.ActionWhat != "Deleted" || (last.ActionWhen < last.DTS ? last.DTS : last.ActionWhen) < value) && ItemInfo.ConvertToDisplayText(first.Text) == ItemInfo.ConvertToDisplayText(last.Text)) - slst.RemoveAll(x => x.ItemID == itmID); - } - - return new ContentAuditInfoList(slst); - } - - //C2024- 038 - Summary of Changes report generation enhancements - //modify _SummaryAuditList - //to limit to a specific date - private AnnotationAuditInfoList FilterSummaryByDate_Annotations(AnnotationAuditInfoList annotationAuditList, DateTime value) - { - return new AnnotationAuditInfoList(annotationAuditList.Where(x => x.DTS >= value).ToList()); - } - private void btnRefresh_Click(object sender, EventArgs e) - { - RefreshList(); - } - private void btnRestore_Click(object sender, EventArgs e) - { - MyEditItem.SaveContents(); - TreeNode tn = tvAudits.SelectedNode; - if (tn.Tag is ContentAuditInfo) - { - ContentAuditInfo cai = tn.Tag as ContentAuditInfo; - // if original equation is restored, don't allow it because it is empty: - if ((cai.Type > 20999 && cai.Type < 21010) && cai.ActionWhat.ToUpper() == "ORIGINAL") - { - FlexibleMessageBox.Show(this, "Cannot restore original empty or new equation.", "Warning on restore", MessageBoxButtons.OK); - return; - } - if (FlexibleMessageBox.Show(this, "Do you want to restore this content change?", "Confirm Content Change Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) - { - ROFstInfo myRoFst = null; // B2017-118 If No ROFST don't crash - if (MyItemInfo.MyDocVersion.DocVersionAssociations != null) - myRoFst = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst; - if (myRoFst != null) myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate); - ContentInfo ci = ContentInfo.RestoreContent(cai, myRoFst); - if (myRoFst != null) myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate); - RefreshRequired = true; - UpdateHistory(); - MyItemInfo.RefreshConfig(); - // B2017-209: see if the restore has invalid enhanced data, i.e. the source step that it 'links to' does not exist. - // Note that this is only applicable when restoring an enhanced step if its linked source step is deleted because - // the enhanced (background/deviation/etc) cannot be deleted unless they are unlinked first. - if (MyItemInfo.IsEnhancedStep) - { - // get id for step that is linked & see if it exists - if not, clear the enhanced config data - StepConfig sc = MyItemInfo.MyConfig as StepConfig; - ItemInfo iexists = ItemInfo.Get(sc.MyEnhancedDocuments[0].ItemID); - if (iexists == null) MyItemInfo.RemoveEnhancedFromConfig(true); - } - myRTB.Clear(); - myVFG.Clear(); - MyEditItem.SetAllTabs(); - MyItemInfo.UpdateTransitionText(); - MyItemInfo.UpdateROText(); - } - } - if (tn.Tag is ItemAuditInfo) - { - ItemAuditInfo iai = tn.Tag as ItemAuditInfo; - if (FlexibleMessageBox.Show(this, string.Format("Do you want to restore this {0}?", iai.ItemType), string.Format("Confirm {0} Restore", iai.ItemType), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) - { - //Console.WriteLine("DisplayHistory.btnRestore_Click @ {0}", DateTime.Now); - ItemInfo ii = null; - if (iai.Level == 2) - { - ROFstInfo myRoFst = null; // B2017-118 If No ROFST don't crash - if (MyItemInfo.MyDocVersion.DocVersionAssociations != null) - myRoFst = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst; - if (myRoFst != null) myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate); - ii = MyItemInfo.RestoreItem(iai, myRoFst); - 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); - //MyEditItem.AddChild(ii.MyContent.Text, (E_FromType)ii.ItemParts[0].FromType, (int)ii.MyContent.Type, null); - if (ii.IsStep) - ii = StepInfo.Get(ii.ItemID); - else if (ii.IsSection) - ii = SectionInfo.Get(ii.ItemID); - else if (ii.IsProcedure) - ii = ProcedureInfo.Get(ii.ItemID); - if (nextItem != null) - { - switch (nextItem.MyChildRelation) - { - case ChildRelation.None: - break; - case ChildRelation.After: - MyEditItem.AddChildAfter(ii, nextItem); - break; - case ChildRelation.Before: - MyEditItem.AddChildBefore(ii, nextItem); - break; - case ChildRelation.RNO: - MyEditItem.AddChildRNO(ii, nextItem); - break; - default: - break; - } - } - else - { - switch ((E_FromType)ii.ItemParts[0].FromType) - { - case E_FromType.Caution: - MyEditItem.AddChildBefore(ii, nextItem); - break; - case E_FromType.Note: - MyEditItem.AddChildBefore(ii, nextItem); - break; - case E_FromType.Procedure: - MyEditItem.AddChildAfter(ii, nextItem); - break; - case E_FromType.RNO: - MyEditItem.AddChildRNO(ii, nextItem); - break; - case E_FromType.Section: - MyEditItem.AddChildAfter(ii, nextItem); - break; - case E_FromType.Step: - MyEditItem.AddChildAfter(ii, nextItem); - break; - case E_FromType.Table: - MyEditItem.AddChildAfter(ii, nextItem); - break; - case E_FromType.SupInfo: - MyEditItem.AddChildSupInfo(ii, nextItem); - break; - default: - MyEditItem.AddChildAfter(ii, nextItem); - break; - } - } - } - else - { - ROFstInfo myRoFst = null; // B2017-118 If No ROFST don't crash - if (MyItemInfo.MyDocVersion.DocVersionAssociations != null) - myRoFst = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst; - if (myRoFst != null) myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate); - ii = MyItemInfo.RestoreSibling(iai, myRoFst); - if (myRoFst != null) myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate); - if (ii.IsStep) - ii = StepInfo.Get(ii.ItemID); - else if (ii.IsSection) - ii = SectionInfo.Get(ii.ItemID); - else if (ii.IsProcedure) - ii = ProcedureInfo.Get(ii.ItemID); - EditItem nextItem = iai.Level == 0 ? MyEditItem : MyEditItem.MyNextEditItem; - switch (MyEditItem.MyChildRelation) - { - case ChildRelation.None: - break; - case ChildRelation.After: - MyEditItem.ActiveParent.AddChildAfter(ii, nextItem); - break; - case ChildRelation.Before: - MyEditItem.ActiveParent.AddChildBefore(ii, nextItem); - break; - case ChildRelation.RNO: - MyEditItem.ActiveParent.AddChildRNO(ii, nextItem); - break; - case ChildRelation.SupInfo: - MyEditItem.ActiveParent.AddChildSupInfo(ii, nextItem); - break; - default: - break; - } - ii.UpdateTransitionText(); - ii.UpdateROText(); - } - if (MyEditItem.MyPreviousEditItem != null) - MyEditItem.MyPreviousEditItem.SetAllTabs(); - else - MyEditItem.SetAllTabs(); - RefreshRequired = true; - UpdateHistory(); - myRTB.Clear(); - myVFG.Clear(); - } - } - if (tn.Tag is AnnotationAuditInfo) - { - AnnotationAuditInfo aai = tn.Tag as AnnotationAuditInfo; - if (FlexibleMessageBox.Show(this, "Do you want to restore this annotation?", "Confirm Annotation Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) - { - AnnotationInfo ai = AnnotationInfo.RestoreAnnotation(aai); - // B2023-072: Don't crash if annotation type was deleted for the restore annotation - if (ai == null) - { - FlexibleMessageBox.Show(this, "Annotation Type was deleted, cannot restore Annotation Type\r\nCopy text from window in Change Details and paste into new annotation to restore the text.", "Annotation Type Deleted", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return; - } - OnAnnotationRestored(ai, ai.MyItem); - RefreshRequired = true; - UpdateHistory(); - myRTB.Clear(); - myVFG.Clear(); - } - } - if (tn.Tag is GridAuditInfo) - { - GridAuditInfo gai = tn.Tag as GridAuditInfo; - if (FlexibleMessageBox.Show(this, "Do you want to restore this table?", "Confirm Table Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) - { - ContentAuditInfo cai = ContentAuditInfo.Get(gai.ContentAuditID); - ROFstInfo myRoFst = null; // B2017-118 If No ROFST don't crash - if (MyItemInfo.MyDocVersion.DocVersionAssociations != null) - myRoFst = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst; - if (myRoFst != null) myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate); - ContentInfo ci = ContentInfo.RestoreContent(cai, myRoFst); - if (myRoFst != null) myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate); - RefreshRequired = true; - UpdateHistory(); - myRTB.Clear(); - myVFG.Clear(); - } - } - if (tn.Tag is ImageAuditInfo) - { - ImageAuditInfo iai = tn.Tag as ImageAuditInfo; - if (FlexibleMessageBox.Show(this, "Do you want to restore this image?", "Confirm Image Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) - { - ContentInfo ci = ContentInfo.RestoreImage(iai); - RefreshRequired = true; - UpdateHistory(); - myRTB.Clear(); - myVFG.Clear(); - myPicBox.Image = null; // myPicBox is the PictureBox that shows the selected figure - } - } - } - - List myRoFst_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args) - { - return VlnFlexGrid.ROTableUpdate(sender, args); - } - - - private static UserInfo _MyUserInfo = null; - public static UserInfo MyUserInfo - { - get { return _MyUserInfo; } - set { _MyUserInfo = value; } - } - - private void DisplayTagRTF(TreeNode tn) - { - if (tn.Tag != null) - { - if (tn.Tag is GridAuditInfo) - { - btnRestore.Enabled = UserInfo.CanEdit(MyUserInfo, MyProcedureInfo.MyDocVersion);//CanRestore(); - GridAuditInfo gai = tn.Tag as GridAuditInfo; - myPicBox.Visible = false; - myVFG.Visible = true; - myVFG.BringToFront(); - panel1.Invalidate(new Rectangle(0, 0, myVFG.Width + 4, 4)); - panel1.Invalidate(new Rectangle(0, 0, 4, myVFG.Height + 4)); - myRTB.Visible = false; - panel1.Visible = false; - using (StringReader sr = new StringReader(gai.Data)) - { - myVFG.ReadXml(sr); - sr.Close(); - } - panel1.Visible = true; - return; - } - if (tn.Tag is ImageAuditInfo) - { - btnRestore.Enabled = UserInfo.CanEdit(MyUserInfo, MyProcedureInfo.MyDocVersion); - ImageAuditInfo iai = tn.Tag as ImageAuditInfo; - myVFG.Visible = false; - myRTB.Visible = false; - myPicBox.Visible = true; - myPicBox.BringToFront(); - panel1.Invalidate(new Rectangle(0, 0, myPicBox.Width + 4, 4)); - panel1.Invalidate(new Rectangle(0, 0, 4, myPicBox.Height + 4)); - panel1.Visible = false; - ImageInfo imgin = ImageInfo.Get(iai.ContentID); - - // check if image data was compressed, i.e. config stores original size: - ImageConfig imgCfg = new ImageConfig(imgin); - byte[] imgData = iai.Data; - if (imgCfg.Image_DataSize > 0) imgData = ROImageInfo.Decompress(imgData, imgCfg.Image_DataSize); - MemoryStream ms = new MemoryStream(imgData); - myPicBox.Image = System.Drawing.Image.FromStream(ms); - myPicBox.Width = Math.Max(myPicBox.Image.Width, panel1.Width); - myPicBox.Height = Math.Max(myPicBox.Image.Height, 200); - panel1.Visible = true; - return; - } - if (tn.Tag is ContentAuditInfo) - { - btnRestore.Enabled = UserInfo.CanEdit(MyUserInfo, MyProcedureInfo.MyDocVersion);//CanRestore(); - myVFG.Clear(); - ContentAuditInfo cai = tn.Tag as ContentAuditInfo; - GridAuditInfoList gail = GridAuditInfoList.Get(cai.ContentID); - if (gail.Count > 0) - { - foreach (GridAuditInfo gai in gail) - { - if (gai.DTS == cai.DTS) - { - myVFG.Visible = true; - myVFG.BringToFront(); - myRTB.Visible = false; - using (StringReader sr = new StringReader(gai.Data)) - { - myVFG.ReadXml(sr); - sr.Close(); - } - return; - } - } - } - else - { - myRTB.Visible = true; - myRTB.BringToFront(); - 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); - } - } - if (tn.Tag is ItemAuditInfo) - { - btnRestore.Enabled = UserInfo.CanEdit(MyUserInfo, MyProcedureInfo.MyDocVersion);//CanRestore(); - ItemAuditInfo iai = tn.Tag as ItemAuditInfo; - ContentAuditInfoList cail = ContentAuditInfoList.Get(iai.ContentID); - foreach (ContentAuditInfo cai in cail) - { - 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); - } - } - } - if (tn.Tag is AnnotationAuditInfo) - { - btnRestore.Enabled = UserInfo.CanEdit(MyUserInfo, MyProcedureInfo.MyDocVersion);//CanRestore(); - AnnotationAuditInfo iai = tn.Tag as AnnotationAuditInfo; - myRTB.Font = new Font("Arial", 12, FontStyle.Regular); - myRTB.Rtf = iai.RtfText; - //myRTB.Rtf = iai.RtfText; - } - } - else - { - btnRestore.Enabled = false; - myRTB.Clear(); - myVFG.Clear(); - } - } - private void tvAudits_AfterSelect(object sender, TreeViewEventArgs e) - { - DisplayTagRTF(e.Node); - } - private void DisplayHistory_Resize(object sender, EventArgs e) - { - tvAudits.Height = ((tcpDetail.Height - btnRestore.Height) / 4) * 3; - } - - //CSM - C2026-010 - Set/Show Change Bar Audit History - //Display a Tooltip for what was in the list - private void LbChangeBarHistory_MouseMove(object sender, MouseEventArgs e) - { - // Just use the item's value for the tooltip. - int index = lbChangeBarHistory.IndexFromPoint(e.Location); - - if (index != ListBox.NoMatches) - { - DataRow rw = (lbChangeBarHistory.Items[index] as DataRowView)?.Row; - - // Display the item's value as a tooltip. - if (tipCBHistory.GetToolTip(lbChangeBarHistory) != rw["Text"].ToString()) - tipCBHistory.SetToolTip(lbChangeBarHistory, rw["Text"].ToString()); - } - } - - public void RefreshChangeList() - { - myTimer.Enabled = false; - myTimer.Enabled = true; - } - // B2019-161 When tracking timing time this action - private static VolianTimer _TimeActivity = new VolianTimer("DisplayHistory myTimer_Tick", 974); - - private void myTimer_Tick(object sender, System.EventArgs e) - { - _TimeActivity.Open(); - myTimer.Enabled = false; - if (this.lbChanges.Visible) - this.tabControl1.SelectedTab = tabItem2; - UpdateHistory(); - RefreshRequired = true; - _TimeActivity.Close(); - } - - } - - public delegate void ItemRestoredHandler(ItemInfo restoredItemInfo); - public delegate void AnnotationRestoredHandler(AnnotationInfo restoredAnnotationInfo, ItemInfo currentItem); - public delegate void DisplayHistoryReportEvent(object sender, DisplayHistoryReportEventArgs args); - public delegate void DisplayHistoryEvent(object sender, DisplayHistoryEventArgs args); - public class DisplayHistoryReportEventArgs - { - private string _ReportName; - public string ReportTitle - { - get { return _ReportName; } - set { _ReportName = value; } - } - private ProcedureInfo _ProcedureInfo; - public ProcedureInfo ProcedureInfo - { - get { return _ProcedureInfo; } - set { _ProcedureInfo = value; } - } - private ContentAuditInfoList _AuditList; - public ContentAuditInfoList AuditList - { - get { return _AuditList; } - set { _AuditList = value; } - } - private AnnotationAuditInfoList _AnnotationList; - public AnnotationAuditInfoList AnnotationList - { - get { return _AnnotationList; } - set { _AnnotationList = value; } - } - - public DisplayHistoryReportEventArgs(string reportName, ProcedureInfo procedureInfo, ContentAuditInfoList auditList, AnnotationAuditInfoList annotationList) - { - _ReportName = reportName; - _ProcedureInfo = procedureInfo; - _AuditList = auditList; - _AnnotationList = annotationList; - } - } - public class DisplayHistoryEventArgs - { - private int _ItemID; - public int ItemID - { - get { return _ItemID; } - set { _ItemID = value; } - } - public DisplayHistoryEventArgs(int itemID) - { - _ItemID = itemID; - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplayHistory.designer.cs b/PROMS/Volian.Controls.Library/DisplayHistory.designer.cs deleted file mode 100644 index 5740460f..00000000 Binary files a/PROMS/Volian.Controls.Library/DisplayHistory.designer.cs and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/DisplayHistory.resx b/PROMS/Volian.Controls.Library/DisplayHistory.resx deleted file mode 100644 index f248cb6d..00000000 --- a/PROMS/Volian.Controls.Library/DisplayHistory.resx +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - <?xml version="1.0" encoding="utf-16"?> -<VlnBorders Rows="4" Columns="3"> - <VerticalLines Rows="4" Columns="4"> - <Lines> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - </Lines> - </VerticalLines> - <HorizontalLines Rows="5" Columns="3"> - <Lines> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - <GridLinePattern>Single</GridLinePattern> - </Lines> - </HorizontalLines> -</VlnBorders> - - - <?xml version="1.0" encoding="utf-16"?> -<VlnGridCellShading Rows="4" Columns="3"> - <TableShadingInfo Rows="4" Columns="3"> - <CellShadingColor> - <string>[A=255, R=255, G=255, B=255]</string> - <string>[A=255, R=255, G=255, B=255]</string> - <string>[A=255, R=255, G=255, B=255]</string> - <string>[A=255, R=255, G=255, B=255]</string> - <string>[A=255, R=255, G=255, B=255]</string> - <string>[A=255, R=255, G=255, B=255]</string> - <string>[A=255, R=255, G=255, B=255]</string> - <string>[A=255, R=255, G=255, B=255]</string> - <string>[A=255, R=255, G=255, B=255]</string> - <string>[A=255, R=255, G=255, B=255]</string> - <string>[A=255, R=255, G=255, B=255]</string> - <string>[A=255, R=255, G=255, B=255]</string> - </CellShadingColor> - </TableShadingInfo> -</VlnGridCellShading> - - - Normal{Font:Microsoft Sans Serif, 8.25pt;BackColor:White;TextAlign:LeftTop;Border:Flat,1,Black,Both;} Alternate{BackColor:White;} Fixed{BackColor:Control;ForeColor:ControlText;Border:Flat,1,ControlDark,Both;BackgroundImageLayout:Hide;} Highlight{BackColor:LightCyan;ForeColor:Black;} Focus{BackColor:LightCyan;} Editor{} Search{BackColor:Highlight;ForeColor:HighlightText;} Frozen{BackColor:Beige;} FrozenAlternate{} NewRow{ForeColor:GrayText;} EmptyArea{BackColor:Transparent;Border:None,1,Black,Both;} SelectedColumnHeader{} SelectedRowHeader{} GrandTotal{BackColor:Black;ForeColor:White;} Subtotal0{BackColor:ControlDarkDark;ForeColor:White;} Subtotal1{BackColor:ControlDarkDark;ForeColor:White;} Subtotal2{BackColor:ControlDarkDark;ForeColor:White;} Subtotal3{BackColor:ControlDarkDark;ForeColor:White;} Subtotal4{BackColor:ControlDarkDark;ForeColor:White;} Subtotal5{BackColor:ControlDarkDark;ForeColor:White;} FilterEditor{} FirstCustomStyle{} - - - 17, 17 - - - 119, 17 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplayLibDocs.Designer.cs b/PROMS/Volian.Controls.Library/DisplayLibDocs.Designer.cs deleted file mode 100644 index 76bba6a0..00000000 --- a/PROMS/Volian.Controls.Library/DisplayLibDocs.Designer.cs +++ /dev/null @@ -1,384 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class DisplayLibDocs - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DisplayLibDocs)); - this.groupPanelBtns = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.btnImpLibDoc = new System.Windows.Forms.Button(); - this.groupPanelLibDocs = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.listBoxLibDocs = new System.Windows.Forms.ListBox(); - this.pnlProp = new System.Windows.Forms.Panel(); - this.btnPrint = new System.Windows.Forms.Button(); - this.btnOpenLibDoc = new System.Windows.Forms.Button(); - this.btnDelLibDoc = new System.Windows.Forms.Button(); - this.btnCancel = new System.Windows.Forms.Button(); - this.btnSave = new System.Windows.Forms.Button(); - this.tbComment = new System.Windows.Forms.TextBox(); - this.tbName = new System.Windows.Forms.TextBox(); - this.lblComment = new System.Windows.Forms.Label(); - this.lblName = new System.Windows.Forms.Label(); - this.listBoxUsages = new System.Windows.Forms.ListBox(); - this.groupPanelUsages = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.superTooltipLibDocs = new DevComponents.DotNetBar.SuperTooltip(); - this.groupPanelBtns.SuspendLayout(); - this.groupPanelLibDocs.SuspendLayout(); - this.pnlProp.SuspendLayout(); - this.groupPanelUsages.SuspendLayout(); - this.SuspendLayout(); - // - // groupPanelBtns - // - this.groupPanelBtns.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelBtns.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelBtns.Controls.Add(this.btnImpLibDoc); - this.groupPanelBtns.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelBtns.Location = new System.Drawing.Point(0, 0); - this.groupPanelBtns.Margin = new System.Windows.Forms.Padding(4); - this.groupPanelBtns.Name = "groupPanelBtns"; - this.groupPanelBtns.Size = new System.Drawing.Size(501, 47); - // - // - // - this.groupPanelBtns.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelBtns.Style.BackColorGradientAngle = 90; - this.groupPanelBtns.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelBtns.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelBtns.Style.BorderBottomWidth = 1; - this.groupPanelBtns.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelBtns.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelBtns.Style.BorderLeftWidth = 1; - this.groupPanelBtns.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelBtns.Style.BorderRightWidth = 1; - this.groupPanelBtns.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelBtns.Style.BorderTopWidth = 1; - this.groupPanelBtns.Style.CornerDiameter = 4; - this.groupPanelBtns.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelBtns.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelBtns.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelBtns.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelBtns.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelBtns.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelBtns.TabIndex = 25; - // - // btnImpLibDoc - // - this.btnImpLibDoc.Dock = System.Windows.Forms.DockStyle.Top; - this.btnImpLibDoc.Location = new System.Drawing.Point(0, 0); - this.btnImpLibDoc.Name = "btnImpLibDoc"; - this.btnImpLibDoc.Size = new System.Drawing.Size(495, 38); - this.superTooltipLibDocs.SetSuperTooltip(this.btnImpLibDoc, new DevComponents.DotNetBar.SuperTooltipInfo("Import Existing Word Document", "", "Imports an existing Word Document into the Veproms data, allowing it to be used a" + - "s a library document", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnImpLibDoc.TabIndex = 1; - this.btnImpLibDoc.Text = "Import Existing Word Document"; - this.btnImpLibDoc.UseVisualStyleBackColor = true; - this.btnImpLibDoc.Click += new System.EventHandler(this.btnImpLibDoc_Click); - // - // groupPanelLibDocs - // - this.groupPanelLibDocs.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelLibDocs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelLibDocs.Controls.Add(this.listBoxLibDocs); - this.groupPanelLibDocs.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelLibDocs.Location = new System.Drawing.Point(0, 47); - this.groupPanelLibDocs.Margin = new System.Windows.Forms.Padding(4); - this.groupPanelLibDocs.Name = "groupPanelLibDocs"; - this.groupPanelLibDocs.Size = new System.Drawing.Size(501, 304); - // - // - // - this.groupPanelLibDocs.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelLibDocs.Style.BackColorGradientAngle = 90; - this.groupPanelLibDocs.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelLibDocs.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelLibDocs.Style.BorderBottomWidth = 1; - this.groupPanelLibDocs.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelLibDocs.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelLibDocs.Style.BorderLeftWidth = 1; - this.groupPanelLibDocs.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelLibDocs.Style.BorderRightWidth = 1; - this.groupPanelLibDocs.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelLibDocs.Style.BorderTopWidth = 1; - this.groupPanelLibDocs.Style.CornerDiameter = 4; - this.groupPanelLibDocs.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelLibDocs.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelLibDocs.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelLibDocs.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelLibDocs.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelLibDocs.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.superTooltipLibDocs.SetSuperTooltip(this.groupPanelLibDocs, new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.groupPanelLibDocs.TabIndex = 27; - this.groupPanelLibDocs.Text = "Library Documents"; - // - // listBoxLibDocs - // - this.listBoxLibDocs.Dock = System.Windows.Forms.DockStyle.Fill; - this.listBoxLibDocs.FormattingEnabled = true; - this.listBoxLibDocs.HorizontalScrollbar = true; - this.listBoxLibDocs.ItemHeight = 16; - this.listBoxLibDocs.Location = new System.Drawing.Point(0, 0); - this.listBoxLibDocs.Margin = new System.Windows.Forms.Padding(4); - this.listBoxLibDocs.Name = "listBoxLibDocs"; - this.listBoxLibDocs.Size = new System.Drawing.Size(495, 276); - this.superTooltipLibDocs.SetSuperTooltip(this.listBoxLibDocs, new DevComponents.DotNetBar.SuperTooltipInfo("Library Documents", "", resources.GetString("listBoxLibDocs.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.listBoxLibDocs.TabIndex = 13; - this.listBoxLibDocs.SelectedIndexChanged += new System.EventHandler(this.listBoxLibDocs_Click); - // - // pnlProp - // - this.pnlProp.BackColor = System.Drawing.Color.Beige; - this.pnlProp.Controls.Add(this.btnPrint); - this.pnlProp.Controls.Add(this.btnOpenLibDoc); - this.pnlProp.Controls.Add(this.btnDelLibDoc); - this.pnlProp.Controls.Add(this.btnCancel); - this.pnlProp.Controls.Add(this.btnSave); - this.pnlProp.Controls.Add(this.tbComment); - this.pnlProp.Controls.Add(this.tbName); - this.pnlProp.Controls.Add(this.lblComment); - this.pnlProp.Controls.Add(this.lblName); - this.pnlProp.Dock = System.Windows.Forms.DockStyle.Top; - this.pnlProp.Location = new System.Drawing.Point(0, 351); - this.pnlProp.Name = "pnlProp"; - this.pnlProp.Size = new System.Drawing.Size(501, 150); - this.pnlProp.TabIndex = 32; - // - // btnPrint - // - this.btnPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnPrint.Location = new System.Drawing.Point(401, 113); - this.btnPrint.Name = "btnPrint"; - this.btnPrint.Size = new System.Drawing.Size(75, 30); - this.btnPrint.TabIndex = 15; - this.btnPrint.Text = "Report"; - this.btnPrint.UseVisualStyleBackColor = true; - this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click); - // - // btnOpenLibDoc - // - this.btnOpenLibDoc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnOpenLibDoc.Location = new System.Drawing.Point(325, 113); - this.btnOpenLibDoc.Name = "btnOpenLibDoc"; - this.btnOpenLibDoc.Size = new System.Drawing.Size(70, 30); - this.superTooltipLibDocs.SetSuperTooltip(this.btnOpenLibDoc, new DevComponents.DotNetBar.SuperTooltipInfo("Open", "", "Opens, for edit, an unused library document.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnOpenLibDoc.TabIndex = 14; - this.btnOpenLibDoc.Text = "Open"; - this.btnOpenLibDoc.UseVisualStyleBackColor = true; - this.btnOpenLibDoc.Click += new System.EventHandler(this.btnOpenLibDoc_Click); - // - // btnDelLibDoc - // - this.btnDelLibDoc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnDelLibDoc.Location = new System.Drawing.Point(246, 113); - this.btnDelLibDoc.Name = "btnDelLibDoc"; - this.btnDelLibDoc.Size = new System.Drawing.Size(73, 30); - this.superTooltipLibDocs.SetSuperTooltip(this.btnDelLibDoc, new DevComponents.DotNetBar.SuperTooltipInfo("Delete", "", "Deletes an unused library document.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnDelLibDoc.TabIndex = 13; - this.btnDelLibDoc.Text = "Delete"; - this.btnDelLibDoc.UseVisualStyleBackColor = true; - this.btnDelLibDoc.Click += new System.EventHandler(this.btnDelLibDoc_Click); - // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(98, 80); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(75, 23); - this.superTooltipLibDocs.SetSuperTooltip(this.btnCancel, new DevComponents.DotNetBar.SuperTooltipInfo("Cancel", "", "Cancels change of Name or Comment. Restores to original.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnCancel.TabIndex = 12; - this.btnCancel.Text = "Cancel"; - this.btnCancel.UseVisualStyleBackColor = true; - this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); - // - // btnSave - // - this.btnSave.Location = new System.Drawing.Point(17, 80); - this.btnSave.Name = "btnSave"; - this.btnSave.Size = new System.Drawing.Size(75, 23); - this.superTooltipLibDocs.SetSuperTooltip(this.btnSave, new DevComponents.DotNetBar.SuperTooltipInfo("Save", "", "Saves change of Name or Comment.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnSave.TabIndex = 11; - this.btnSave.Text = "Save"; - this.btnSave.UseVisualStyleBackColor = true; - this.btnSave.Click += new System.EventHandler(this.btnSave_Click); - // - // tbComment - // - this.tbComment.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tbComment.Location = new System.Drawing.Point(70, 33); - this.tbComment.Multiline = true; - this.tbComment.Name = "tbComment"; - this.tbComment.Size = new System.Drawing.Size(413, 41); - this.superTooltipLibDocs.SetSuperTooltip(this.tbComment, new DevComponents.DotNetBar.SuperTooltipInfo("Comment", "", "Comment for this library document.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.tbComment.TabIndex = 10; - this.tbComment.TextChanged += new System.EventHandler(this.tbComment_TextChanged); - // - // tbName - // - this.tbName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tbName.Location = new System.Drawing.Point(70, 3); - this.tbName.Name = "tbName"; - this.tbName.Size = new System.Drawing.Size(413, 22); - this.superTooltipLibDocs.SetSuperTooltip(this.tbName, new DevComponents.DotNetBar.SuperTooltipInfo("Name", "", "Name of library document.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.tbName.TabIndex = 9; - this.tbName.TextChanged += new System.EventHandler(this.tbName_TextChanged); - // - // lblComment - // - this.lblComment.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.lblComment.AutoSize = true; - this.lblComment.Location = new System.Drawing.Point(4, 31); - this.lblComment.Name = "lblComment"; - this.lblComment.Size = new System.Drawing.Size(71, 17); - this.lblComment.TabIndex = 8; - this.lblComment.Text = "Comment:"; - // - // lblName - // - this.lblName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.lblName.AutoSize = true; - this.lblName.Location = new System.Drawing.Point(4, 6); - this.lblName.Name = "lblName"; - this.lblName.Size = new System.Drawing.Size(49, 17); - this.lblName.TabIndex = 7; - this.lblName.Text = "Name:"; - // - // listBoxUsages - // - this.listBoxUsages.Dock = System.Windows.Forms.DockStyle.Fill; - this.listBoxUsages.FormattingEnabled = true; - this.listBoxUsages.HorizontalScrollbar = true; - this.listBoxUsages.ItemHeight = 16; - this.listBoxUsages.Location = new System.Drawing.Point(0, 0); - this.listBoxUsages.Name = "listBoxUsages"; - this.listBoxUsages.Size = new System.Drawing.Size(495, 308); - this.superTooltipLibDocs.SetSuperTooltip(this.listBoxUsages, new DevComponents.DotNetBar.SuperTooltipInfo("Usages", "", "Shows where a selected library document is used. Clicking on use will bring up t" + - "he library document.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.listBoxUsages.TabIndex = 0; - this.listBoxUsages.SelectedValueChanged += new System.EventHandler(this.listBoxUsages_SelectedValueChanged); - // - // groupPanelUsages - // - this.groupPanelUsages.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelUsages.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelUsages.Controls.Add(this.listBoxUsages); - this.groupPanelUsages.Dock = System.Windows.Forms.DockStyle.Fill; - this.groupPanelUsages.Location = new System.Drawing.Point(0, 501); - this.groupPanelUsages.Margin = new System.Windows.Forms.Padding(4); - this.groupPanelUsages.Name = "groupPanelUsages"; - this.groupPanelUsages.Size = new System.Drawing.Size(501, 331); - // - // - // - this.groupPanelUsages.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelUsages.Style.BackColorGradientAngle = 90; - this.groupPanelUsages.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelUsages.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelUsages.Style.BorderBottomWidth = 1; - this.groupPanelUsages.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelUsages.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelUsages.Style.BorderLeftWidth = 1; - this.groupPanelUsages.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelUsages.Style.BorderRightWidth = 1; - this.groupPanelUsages.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelUsages.Style.BorderTopWidth = 1; - this.groupPanelUsages.Style.CornerDiameter = 4; - this.groupPanelUsages.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelUsages.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelUsages.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelUsages.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelUsages.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelUsages.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelUsages.TabIndex = 31; - this.groupPanelUsages.Text = "Usages"; - // - // superTooltipLibDocs - // - this.superTooltipLibDocs.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - // - // DisplayLibDocs - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoScroll = true; - this.Controls.Add(this.groupPanelUsages); - this.Controls.Add(this.pnlProp); - this.Controls.Add(this.groupPanelLibDocs); - this.Controls.Add(this.groupPanelBtns); - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.Name = "DisplayLibDocs"; - this.Size = new System.Drawing.Size(501, 832); - this.groupPanelBtns.ResumeLayout(false); - this.groupPanelLibDocs.ResumeLayout(false); - this.pnlProp.ResumeLayout(false); - this.pnlProp.PerformLayout(); - this.groupPanelUsages.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelBtns; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelLibDocs; - private System.Windows.Forms.ListBox listBoxLibDocs; - private System.Windows.Forms.Button btnImpLibDoc; - private System.Windows.Forms.Panel pnlProp; - private System.Windows.Forms.Button btnOpenLibDoc; - private System.Windows.Forms.Button btnDelLibDoc; - private System.Windows.Forms.Button btnCancel; - private System.Windows.Forms.Button btnSave; - private System.Windows.Forms.TextBox tbComment; - private System.Windows.Forms.TextBox tbName; - private System.Windows.Forms.Label lblComment; - private System.Windows.Forms.Label lblName; - private System.Windows.Forms.ListBox listBoxUsages; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelUsages; - private DevComponents.DotNetBar.SuperTooltip superTooltipLibDocs; - private System.Windows.Forms.Button btnPrint; - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayLibDocs.cs b/PROMS/Volian.Controls.Library/DisplayLibDocs.cs deleted file mode 100644 index 2bb90099..00000000 --- a/PROMS/Volian.Controls.Library/DisplayLibDocs.cs +++ /dev/null @@ -1,381 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using System.Text.RegularExpressions; -using System.IO; -using AT.STO.UI.Win; -using VEPROMS.CSLA.Library; - -namespace Volian.Controls.Library -{ - public partial class DisplayLibDocs : UserControl - { - #region Properties - private DocumentInfo _CurLibDoc; - public DocumentInfo CurLibDoc - { - get { return _CurLibDoc; } - set { _CurLibDoc = value; } - } - // selected index into listBoxLibDocs... - private int _SelectedLibDoc = -1; - private DocumentInfoList _LibDocList; - public DocumentInfoList LibDocList - { - get { return _LibDocList; } - set { _LibDocList = value; } - } - private Color saveGroupPanelUsages; - #endregion - #region Constructors - public DisplayLibDocs() - { - InitializeComponent(); - btnOpenLibDoc.Enabled = false; - btnDelLibDoc.Enabled = false; - btnPrint.Enabled = listBoxLibDocs.Items.Count > 0; - saveGroupPanelUsages = groupPanelUsages.Style.BackColor; - } - DisplayTabControl _DisplayTabControl; - #endregion - #region LoadControlData - private bool _InitializingLibDocList; // used? see if selectionchanged event (still coding) - public void LibDocListFillIn(DisplayTabControl tc) - { - _InitializingLibDocList = true; - listBoxLibDocs.Items.Clear(); - tbComment.Clear(); - tbName.Clear(); - groupPanelLibDocs.Style.BackColor = Color.Yellow; - btnSave.Enabled = false; - btnCancel.Enabled = false; - LibDocList = DocumentInfoList.GetLibraries(true); - for (int i = 0; i < LibDocList.Count; i++) - listBoxLibDocs.Items.Add(((LibDocList[i].DocumentEntries == null || LibDocList[i].DocumentEntries.Count == 0) ? "0 " : LibDocList[i].DocumentEntries.Count.ToString() + " ") + LibDocList[i].DocumentTitle); // + LibDocList[i].DocumentEntries.Count); - _DisplayTabControl = tc; - listBoxUsages.Items.Clear(); - _InitializingLibDocList = false; - btnPrint.Enabled = listBoxLibDocs.Items.Count > 0; - } - public void SetSelectedLibDoc() - { - if (_SelectedLibDoc >= 0) - { - if (listBoxLibDocs.Items.Count==0 || _SelectedLibDoc > listBoxLibDocs.Items.Count) return; // B2018-126: if no items in list return also (count==0) - if (_SelectedLibDoc > listBoxLibDocs.Items.Count) return; - listBoxLibDocs.SelectedIndex = _SelectedLibDoc; - } - } - #endregion - #region Events - public event DisplayLibDocEvent PrintRequest; - private void OnPrintRequest(DisplayLibDocEventArgs args) - { - if (PrintRequest != null) - PrintRequest(this, args); - } - - private void listBoxLibDocs_Click(object sender, EventArgs e) - { - UpdateUsageList(); - } - public void RefreshLibDocPanel(DisplayTabControl tc) - { - int cursel = listBoxLibDocs.SelectedIndex; - LibDocListFillIn(tc); - listBoxLibDocs.SelectedIndex = cursel; - UpdateUsageList(); - } - private void UpdateUsageList() - { - if (listBoxLibDocs.SelectedIndex == -1) return; - groupPanelLibDocs.Style.BackColor = Color.Orange; - _SelectedLibDoc = listBoxLibDocs.SelectedIndex; - listBoxUsages.Items.Clear(); - tbComment.Clear(); - tbName.Clear(); - btnSave.Enabled = false; - btnCancel.Enabled = false; - _InitializingLibDocList = true; // need this so textchanged code doesn't turn save/cancel buttons on. - tbName.Text = LibDocList[_SelectedLibDoc].LibTitle; - - DocumentConfig dc = new DocumentConfig(LibDocList[_SelectedLibDoc]); - tbComment.Text = dc.LibDoc_Comment; - _InitializingLibDocList = false; - - // If there are no usages, then enable delete & open button (open for docs with usages occurs - // from usage list), otherwise disable buttons & list usages - DocumentInfo dicnt = LibDocList[_SelectedLibDoc]; - ItemInfoList iil = dicnt.LibraryDocumentUsageList; - groupPanelUsages.Style.BackColor = dicnt.LibraryDocumentUsageList == null || dicnt.LibraryDocumentUsageList.Count == 0 ? this.saveGroupPanelUsages : Color.LightGreen; - if (iil == null) - { - btnDelLibDoc.Enabled = true; - btnOpenLibDoc.Enabled = true; - return; - } - // Put the usages in the usage list for the selected library document. - btnDelLibDoc.Enabled = false; - btnOpenLibDoc.Enabled = false; - foreach (ItemInfo ii in dicnt.LibraryDocumentUsageList) - { - if (ii.MyDocVersion != null) - listBoxUsages.Items.Add(ii.MyProcedure.ToString() + " - " + ii.DisplayNumber + " " + ii.DisplayText); - } - btnPrint.Enabled = listBoxLibDocs.Items.Count > 0 ? true : false; - } - private void btnDelLibDoc_Click(object sender, EventArgs e) - { - DocumentInfo di = LibDocList[_SelectedLibDoc]; - - try - { - Document.Delete(di.DocID); - } - catch (Exception ex) - { - Console.WriteLine("error deleting doc = " + ex.Message); - } - LibDocListFillIn(_DisplayTabControl); - } - private void btnSave_Click(object sender, EventArgs e) - { - bool chg = false; - DocumentInfo di = LibDocList[_SelectedLibDoc]; - Document doc = Document.Get(di.DocID); - if (tbName.Text != LibDocList[_SelectedLibDoc].LibTitle) - { - chg = true; - doc.LibTitle = tbName.Text; - } - DocumentConfig dc = new DocumentConfig(LibDocList[_SelectedLibDoc]); - if (tbComment.Text != dc.LibDoc_Comment) - { - chg = true; - dc.LibDoc_Comment = tbComment.Text; - doc.Config = dc.ToString(); - } - if (chg == true) - { - doc.Save(); - int cursel = _SelectedLibDoc; - LibDocListFillIn(_DisplayTabControl); - listBoxLibDocs.SelectedIndex = cursel; - UpdateUsageList(); - } - } - private void btnCancel_Click(object sender, EventArgs e) - { - DocumentInfo di = LibDocList[_SelectedLibDoc]; - Document doc = Document.Get(di.DocID); - tbName.Text = doc.LibTitle; - DocumentConfig dc = new DocumentConfig(LibDocList[_SelectedLibDoc]); - tbComment.Text = dc.LibDoc_Comment; - btnSave.Enabled = false; - btnCancel.Enabled = false; - } - - private void btnOpenLibDoc_Click(object sender, EventArgs e) - { - DocumentInfo di = LibDocList[_SelectedLibDoc]; - _DisplayTabControl.OpenDSOTabPage(di); - } - - private void tbName_TextChanged(object sender, EventArgs e) - { - if (_InitializingLibDocList) return; - btnSave.Enabled = true; - btnCancel.Enabled = true; - } - - private void tbComment_TextChanged(object sender, EventArgs e) - { - if (_InitializingLibDocList) return; - btnSave.Enabled = true; - btnCancel.Enabled = true; - } - - - private void btnImpLibDoc_Click(object sender, EventArgs e) - { - OpenFileDialog openFileDialog1 = new OpenFileDialog(); - - openFileDialog1.InitialDirectory = "c:\\"; - openFileDialog1.Filter = "Word files (*.doc;*.rtf;*.docx)|*.doc;*.rtf;*.docx|All files (*.*)|*.*"; - openFileDialog1.FilterIndex = 0; - openFileDialog1.RestoreDirectory = true; - - if (openFileDialog1.ShowDialog() == DialogResult.OK) - { - int done = 0; - int ntry = 0; - while (done == 0 && ntry < 4) - { - ntry++; - done = SaveTheDoc(openFileDialog1.FileName, openFileDialog1.SafeFileName.Substring(0, openFileDialog1.SafeFileName.LastIndexOf("."))); - } - if (done > 0) - { - LibDocListFillIn(_DisplayTabControl); - // set selectedindex to the imported doc... - int indx = 0; - DocumentInfoList dil = DocumentInfoList.GetLibraries(true); - for (int i = 0; i < listBoxLibDocs.Items.Count; i++) - { - if (dil[i].DocID == done) - { - indx = i; - break; - } - } - listBoxLibDocs.SelectedIndex = indx; - } - } - } - private int SaveTheDoc(string temppath, string title) - { - try - { - FileInfo fi = new FileInfo(temppath); - FileStream fs = File.Open(temppath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);// B2016-053 - long len = fs.Length; - byte[] ByteArray = new byte[len]; - int nBytesRead = fs.Read(ByteArray, 0, (int)len); - fs.Close(); - string t1 = (title == null || title == "") ? null : title; - Document doc = Document.MakeDocument(t1, ByteArray, null, null, fi.Extension); //, DateTime.Now, "Migration"); - return doc.DocID; - } - // for an io exception, keep trying - catch (IOException) - { - Wait(2); - return 0; - } - catch (Exception ex) - { - MessageBox.Show(string.Format("Could not save the document, {0}, {1}", ex.Message, ex.InnerException)); - return -1; - } - - } - private void Wait(int n) - { - DateTime dtw = DateTime.Now.AddSeconds(n); - while (DateTime.Now < dtw) - { - Application.DoEvents(); - } - } - private bool _ProcessingSelectedValueChanged = false; - private void listBoxUsages_SelectedValueChanged(object sender, EventArgs e) - { - if (!_InitializingLibDocList) - { - if (_ProcessingSelectedValueChanged) return; - _ProcessingSelectedValueChanged = true; - if (listBoxUsages.SelectedIndex == -1) return; - DocumentInfo di = LibDocList[listBoxLibDocs.SelectedIndex]; - // see if the library document actually has data - data migration may have created a 'null' content within the - // record for missing library documents. - if (di.DocContent == null) - { - MessageBox.Show("No Content in this document"); - return; - } - if (listBoxUsages.SelectedIndex < di.LibraryDocumentUsageList.Count && listBoxUsages.SelectedIndex >= 0) - { - ItemInfo ii = di.LibraryDocumentUsageList[listBoxUsages.SelectedIndex]; - if (ii.MyDocVersion == null) - MessageBox.Show("This usage is not connected properly", "Disconnected Data", MessageBoxButtons.OK, MessageBoxIcon.Warning); - else - _DisplayTabControl.OpenItem(ii); - } - _ProcessingSelectedValueChanged = false; - } - } - #endregion - - private void btnPrint_Click(object sender, EventArgs e) - { - string paperSize = "Letter"; - // B2020-045: Getting Library Document usage report when no documents are selected crashes with a null reference if the first - // in libdoc usage list is null (added code that finds a non-null usage list and uses first to get format. Otherwise - // uses the default "Letter" paper size). - ItemInfo ii = null; - int sel = listBoxLibDocs.SelectedIndex < 0 ? 0 : listBoxLibDocs.SelectedIndex; - if (LibDocList[sel].LibraryDocumentUsageList == null || LibDocList[sel].LibraryDocumentUsageList.Count == 0) - { - // selected lib doc doesn't have usages, loop through to find one. Need a usage to get the active format - for (int i = 0; i0) - { - ii = LibDocList[i].LibraryDocumentUsageList[0]; - break; - } - } - } - else - ii = LibDocList[sel].LibraryDocumentUsageList[0]; - - if (ii != null) - paperSize = ii.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files - OnPrintRequest(new DisplayLibDocEventArgs("Library Document Usage", LibDocList, paperSize)); - } - } - public class DisplayLibDocEventArgs - { - private string _ReportTitle; - public string ReportTitle - { - get { return _ReportTitle; } - set { _ReportTitle = value; } - } - private DocumentInfoList _libDocList; - - public DocumentInfoList LibDocList - { - get { return _libDocList; } - set { _libDocList = value; } - } - - private string _PaperSize; // C2020-002 paper size is now set in the format files - - public string PaperSize - { - get { return _PaperSize; } - 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 _MyItemInfoList; - //public ICollection MyItemInfoList - //{ - // get { return _MyItemInfoList; } - // set { _MyItemInfoList = value; } - //} - public DisplayLibDocEventArgs(string reportTitle, DocumentInfoList libDocList, string paperSize) - { - _ReportTitle = reportTitle; - _libDocList = libDocList; - _PaperSize = paperSize; // C2020-002 paper size is now set in the format files - } - } - public delegate void DisplayLibDocEvent(object sender, DisplayLibDocEventArgs args); -} diff --git a/PROMS/Volian.Controls.Library/DisplayLibDocs.resx b/PROMS/Volian.Controls.Library/DisplayLibDocs.resx deleted file mode 100644 index 8f04234b..00000000 --- a/PROMS/Volian.Controls.Library/DisplayLibDocs.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - Shows list of current library documents. The number preceding each document shows how many times it is used. By selecting one that has usages, ths list of usages will be shown below. By selecting one that has NO usages, it can be deleted or opened. - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplayRO.Designer.cs b/PROMS/Volian.Controls.Library/DisplayRO.Designer.cs deleted file mode 100644 index 77f45d7f..00000000 --- a/PROMS/Volian.Controls.Library/DisplayRO.Designer.cs +++ /dev/null @@ -1,294 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class DisplayRO - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.tvROFST = new System.Windows.Forms.TreeView(); - this.panelValue = new System.Windows.Forms.Panel(); - this.lbROId = new DevComponents.DotNetBar.LabelX(); - this.lblROID = new DevComponents.DotNetBar.LabelX(); - this.pnlROButtons = new System.Windows.Forms.Panel(); - this.btnFindDocRO = new DevComponents.DotNetBar.ButtonX(); - this.btnGoToRO = new DevComponents.DotNetBar.ButtonX(); - this.btnPreviewRO = new DevComponents.DotNetBar.ButtonX(); - this.btnCancelRO = new DevComponents.DotNetBar.ButtonX(); - this.btnSaveRO = new DevComponents.DotNetBar.ButtonX(); - this.panelRoValue = new System.Windows.Forms.Panel(); - this.tbROValue = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.lblROValue = new DevComponents.DotNetBar.LabelX(); - this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip(); - this.lbFound = new System.Windows.Forms.ListBox(); - this.panelValue.SuspendLayout(); - this.pnlROButtons.SuspendLayout(); - this.panelRoValue.SuspendLayout(); - this.SuspendLayout(); - // - // tvROFST - // - this.tvROFST.Dock = System.Windows.Forms.DockStyle.Fill; - this.tvROFST.HideSelection = false; - this.tvROFST.Location = new System.Drawing.Point(0, 202); - this.tvROFST.Name = "tvROFST"; - this.tvROFST.Size = new System.Drawing.Size(233, 305); - this.tvROFST.TabIndex = 5; - this.tvROFST.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvROFST_BeforeExpand); - this.tvROFST.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvROFST_AfterSelect); - this.tvROFST.DoubleClick += new System.EventHandler(this.tvROFST_DoubleClick); - // - // panelValue - // - this.panelValue.Controls.Add(this.lbROId); - this.panelValue.Controls.Add(this.lblROID); - this.panelValue.Controls.Add(this.pnlROButtons); - this.panelValue.Controls.Add(this.panelRoValue); - this.panelValue.Dock = System.Windows.Forms.DockStyle.Top; - this.panelValue.Location = new System.Drawing.Point(0, 0); - this.panelValue.Name = "panelValue"; - this.panelValue.Size = new System.Drawing.Size(233, 146); - this.panelValue.TabIndex = 7; - // - // lbROId - // - // - // - // - this.lbROId.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.lbROId.Dock = System.Windows.Forms.DockStyle.Left; - this.lbROId.ForeColor = System.Drawing.SystemColors.Highlight; - this.lbROId.Location = new System.Drawing.Point(48, 24); - this.lbROId.Margin = new System.Windows.Forms.Padding(2); - this.lbROId.Name = "lbROId"; - this.lbROId.Size = new System.Drawing.Size(183, 33); - this.superTooltip1.SetSuperTooltip(this.lbROId, new DevComponents.DotNetBar.SuperTooltipInfo("RO ID", "", "The RO ID for the selected RO Value will be displayed here. Double-Click to open" + - " the RO Editor.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(150, 80))); - this.lbROId.TabIndex = 11; - this.lbROId.DoubleClick += new System.EventHandler(this.lbROId_DoubleClick); - // - // lblROID - // - // - // - // - this.lblROID.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.lblROID.Dock = System.Windows.Forms.DockStyle.Left; - this.lblROID.Location = new System.Drawing.Point(0, 24); - this.lblROID.Margin = new System.Windows.Forms.Padding(2); - this.lblROID.Name = "lblROID"; - this.lblROID.Size = new System.Drawing.Size(48, 33); - this.superTooltip1.SetSuperTooltip(this.lblROID, new DevComponents.DotNetBar.SuperTooltipInfo("RO ID", "", "The RO ID for the selected RO Value will be displayed here.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(150, 80))); - this.lblROID.TabIndex = 10; - this.lblROID.Text = "RO ID:"; - // - // pnlROButtons - // - this.pnlROButtons.Controls.Add(this.btnFindDocRO); - this.pnlROButtons.Controls.Add(this.btnGoToRO); - this.pnlROButtons.Controls.Add(this.btnPreviewRO); - this.pnlROButtons.Controls.Add(this.btnCancelRO); - this.pnlROButtons.Controls.Add(this.btnSaveRO); - this.pnlROButtons.Dock = System.Windows.Forms.DockStyle.Bottom; - this.pnlROButtons.Location = new System.Drawing.Point(0, 57); - this.pnlROButtons.Name = "pnlROButtons"; - this.pnlROButtons.Size = new System.Drawing.Size(233, 89); - this.pnlROButtons.TabIndex = 9; - // - // btnFindDocRO - // - this.btnFindDocRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnFindDocRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnFindDocRO.Dock = System.Windows.Forms.DockStyle.Top; - this.btnFindDocRO.Enabled = false; - this.btnFindDocRO.Location = new System.Drawing.Point(0, 73); - this.btnFindDocRO.Name = "btnFindDocRO"; - this.btnFindDocRO.Size = new System.Drawing.Size(233, 18); - this.superTooltip1.SetSuperTooltip(this.btnFindDocRO, new DevComponents.DotNetBar.SuperTooltipInfo("Find Doc RO", "", "Determine if there are any ROs for the selected text in a Word Document. If found" + - ", the list of ROs is displayed.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnFindDocRO.TabIndex = 9; - this.btnFindDocRO.Text = "Find Doc RO"; - this.btnFindDocRO.Click += new System.EventHandler(this.btnFindDocRO_Click); - // - // btnGoToRO - // - this.btnGoToRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnGoToRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnGoToRO.Dock = System.Windows.Forms.DockStyle.Top; - this.btnGoToRO.Enabled = false; - this.btnGoToRO.Location = new System.Drawing.Point(0, 55); - this.btnGoToRO.Margin = new System.Windows.Forms.Padding(2); - this.btnGoToRO.Name = "btnGoToRO"; - this.btnGoToRO.Size = new System.Drawing.Size(233, 18); - this.btnGoToRO.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.superTooltip1.SetSuperTooltip(this.btnGoToRO, new DevComponents.DotNetBar.SuperTooltipInfo("Go To", "", "Opens the RO Editor and positions to the selected RO.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnGoToRO.TabIndex = 11; - this.btnGoToRO.Text = "Go To"; - this.btnGoToRO.Click += new System.EventHandler(this.btnGoToRO_Click); - // - // btnPreviewRO - // - this.btnPreviewRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnPreviewRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnPreviewRO.Dock = System.Windows.Forms.DockStyle.Top; - this.btnPreviewRO.Enabled = false; - this.btnPreviewRO.Location = new System.Drawing.Point(0, 37); - this.btnPreviewRO.Margin = new System.Windows.Forms.Padding(2); - this.btnPreviewRO.Name = "btnPreviewRO"; - this.btnPreviewRO.Size = new System.Drawing.Size(233, 18); - this.superTooltip1.SetSuperTooltip(this.btnPreviewRO, new DevComponents.DotNetBar.SuperTooltipInfo("Preview", "", "This will Preview the selected RO Table, X/Y Plot, or Image.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(150, 80))); - this.btnPreviewRO.TabIndex = 10; - this.btnPreviewRO.Text = "Preview"; - this.btnPreviewRO.Click += new System.EventHandler(this.btnPreviewRO_Click); - // - // btnCancelRO - // - this.btnCancelRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnCancelRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnCancelRO.Dock = System.Windows.Forms.DockStyle.Top; - this.btnCancelRO.Enabled = false; - this.btnCancelRO.Location = new System.Drawing.Point(0, 18); - this.btnCancelRO.Name = "btnCancelRO"; - this.btnCancelRO.Size = new System.Drawing.Size(233, 19); - this.superTooltip1.SetSuperTooltip(this.btnCancelRO, new DevComponents.DotNetBar.SuperTooltipInfo("Cancel", "", "This become active when you about to replace an existing RO link in you procedure" + - ".\r\n\r\nNOTE: This willL NOT un-do after you select the Save RO button.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(195, 145))); - this.btnCancelRO.TabIndex = 9; - this.btnCancelRO.Text = "Cancel"; - this.btnCancelRO.Click += new System.EventHandler(this.btnCancelRO_Click); - // - // btnSaveRO - // - this.btnSaveRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnSaveRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnSaveRO.Dock = System.Windows.Forms.DockStyle.Top; - this.btnSaveRO.Enabled = false; - this.btnSaveRO.Location = new System.Drawing.Point(0, 0); - this.btnSaveRO.Name = "btnSaveRO"; - this.btnSaveRO.Size = new System.Drawing.Size(233, 18); - this.superTooltip1.SetSuperTooltip(this.btnSaveRO, new DevComponents.DotNetBar.SuperTooltipInfo("Save RO", "", "Saves the RO at the cursor location in either a step or a Word document.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnSaveRO.TabIndex = 8; - this.btnSaveRO.Text = "Save RO"; - this.btnSaveRO.Click += new System.EventHandler(this.btnSaveRO_Click); - // - // panelRoValue - // - this.panelRoValue.Controls.Add(this.tbROValue); - this.panelRoValue.Controls.Add(this.lblROValue); - this.panelRoValue.Dock = System.Windows.Forms.DockStyle.Top; - this.panelRoValue.Location = new System.Drawing.Point(0, 0); - this.panelRoValue.Name = "panelRoValue"; - this.panelRoValue.Size = new System.Drawing.Size(233, 24); - this.panelRoValue.TabIndex = 8; - // - // tbROValue - // - this.tbROValue.BackColor = System.Drawing.SystemColors.ControlLightLight; - // - // - // - this.tbROValue.Border.Class = "TextBoxBorder"; - this.tbROValue.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.tbROValue.Dock = System.Windows.Forms.DockStyle.Top; - this.tbROValue.Location = new System.Drawing.Point(48, 0); - this.tbROValue.Name = "tbROValue"; - this.tbROValue.ReadOnly = true; - this.tbROValue.Size = new System.Drawing.Size(185, 20); - this.superTooltip1.SetSuperTooltip(this.tbROValue, new DevComponents.DotNetBar.SuperTooltipInfo("RO Value", "", "The value of selected RO will be displayed here.\r\n\r\nExceptions:\r\n- Tables, X/Y Pl" + - "ots, and Images will state what they are. The Preview button will display the va" + - "lue.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(230, 135))); - this.tbROValue.TabIndex = 7; - this.tbROValue.WatermarkText = "Select RO Below"; - this.tbROValue.WordWrap = false; - // - // lblROValue - // - // - // - // - this.lblROValue.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.lblROValue.Dock = System.Windows.Forms.DockStyle.Left; - this.lblROValue.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblROValue.Location = new System.Drawing.Point(0, 0); - this.lblROValue.Name = "lblROValue"; - this.lblROValue.Size = new System.Drawing.Size(48, 24); - this.superTooltip1.SetSuperTooltip(this.lblROValue, new DevComponents.DotNetBar.SuperTooltipInfo("RO Value", "", "The value of selected RO will be displayed here.\r\n\r\nExceptions:\r\n- Tables, X/Y Pl" + - "ots, and Images will state what they are. The Preview button will display the va" + - "lue.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(230, 135))); - this.lblROValue.TabIndex = 6; - this.lblROValue.Text = "RO Value:"; - // - // superTooltip1 - // - this.superTooltip1.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray); - this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - // - // lbFound - // - this.lbFound.Dock = System.Windows.Forms.DockStyle.Top; - this.lbFound.FormattingEnabled = true; - this.lbFound.Location = new System.Drawing.Point(0, 146); - this.lbFound.Name = "lbFound"; - this.lbFound.Size = new System.Drawing.Size(233, 56); - this.superTooltip1.SetSuperTooltip(this.lbFound, new DevComponents.DotNetBar.SuperTooltipInfo("Available ROs", "", "ROs that are available are displayed in a tree view. ", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.lbFound.TabIndex = 8; - this.lbFound.Visible = false; - this.lbFound.SelectedValueChanged += new System.EventHandler(this.lbFound_SelectedValueChanged); - // - // DisplayRO - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.tvROFST); - this.Controls.Add(this.lbFound); - this.Controls.Add(this.panelValue); - this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Name = "DisplayRO"; - this.Size = new System.Drawing.Size(233, 507); - this.panelValue.ResumeLayout(false); - this.pnlROButtons.ResumeLayout(false); - this.panelRoValue.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TreeView tvROFST; - private System.Windows.Forms.Panel panelValue; - private System.Windows.Forms.Panel panelRoValue; - private DevComponents.DotNetBar.Controls.TextBoxX tbROValue; - private DevComponents.DotNetBar.LabelX lblROValue; - private System.Windows.Forms.Panel pnlROButtons; - private DevComponents.DotNetBar.ButtonX btnCancelRO; - private DevComponents.DotNetBar.ButtonX btnSaveRO; - private DevComponents.DotNetBar.ButtonX btnPreviewRO; - private DevComponents.DotNetBar.LabelX lblROID; - private DevComponents.DotNetBar.LabelX lbROId; - private DevComponents.DotNetBar.SuperTooltip superTooltip1; - private System.Windows.Forms.ListBox lbFound; - private DevComponents.DotNetBar.ButtonX btnGoToRO; - private DevComponents.DotNetBar.ButtonX btnFindDocRO; - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs deleted file mode 100644 index d8b59abd..00000000 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ /dev/null @@ -1,1289 +0,0 @@ -using DevComponents.DotNetBar; -using JR.Utils.GUI.Forms; -using System; -using System.Collections.Generic; -using System.Data; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; -using XYPlots; - -namespace Volian.Controls.Library -{ - public partial class DisplayRO : UserControl - { - #region Log4Net - - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - #endregion - - #region Fields - - private const string DummyNodeText = "VLN_DUMMY_NODE"; - private const int MaxNumSearchRecords = 1000; - - // B2019-161 When tracking timing time this action - private static VolianTimer _timeActivity = new VolianTimer("DisplayRO MyRTB_SelectionChanged", 117); - private static Regex _regExGetNumber = new Regex(@"^ *[+-]?[.,0-9/]+(E[+-]?[0-9]+)?"); - private static UserInfo _myUserInfo = null; - - private Timer _searchTimer = null; - private string _lastSearchValue = string.Empty; - - private ProgressBarItem _progressBar; - private DisplayTabControl _tabControl; - private StepRTB _myRTB; - private string _selectedRoidBeforeRoEditor = null; - - private ROFstInfo _myROFST; - private DocVersionInfo _docVersionInfo; - private RoUsageInfo _savCurROLink; - private E_ROValueType _roTypeFilter = E_ROValueType.All; - - //private ROFstInfo _curROFST = null; - private int? _currRofstID = null; - private int? _currDocVersionID = null; - - private RoUsageInfo _curROLink; - private E_ROValueType _curROTypeFilter = E_ROValueType.All; - - private ROFSTLookup.rochild selectedChld; - - private DisplayTags displayTags; - - - #endregion - - #region Properties - - public ProgressBarItem ProgressBar - { - get { return _progressBar; } - set { _progressBar = value; } - } - - public DisplayTabControl TabControl - { - get { return _tabControl; } - set { _tabControl = value; } - } - - public bool IsRofstValid - { - get { return (_myROFST != null && _myROFST.ROFstAssociations != null && _myROFST.ROFstAssociationCount > 0); } - } - - public bool RoTreeNeedsReloaded - { - get { return (MyROFST != null && _currRofstID != null && MyROFST.ROFstID != (int)_currRofstID) || - (MyDvi != null && _currDocVersionID != null && MyDvi.VersionID != (int)_currDocVersionID) || - // B2022-142 check if we went from a RO Table or RO Figure step type to a regular step type - // or if we went from a regular step type to a RO Table or RO Figure step type - (_myRTB != null && (_myRTB.IsRoTable != lastRTBwasROTable || _myRTB.IsRoFigure != lastRTBwasROFigure)); } - } - - //This flag will be set when the docversion gets updated to let it know that the full tree needs a refresh - private bool changedDocVersion = false; - - //B2026-057 PROMS Crash when Closing Tabs - // this flag will prevent multiple asking in a row if should updste ROs - private static bool askedAboutchangedDocVersion = false; - - public ROFstInfo MyROFST - { - get { return _myROFST; } - set - { - // Define the tree nodes based on this rofst/docversion - // Rofst is required, DocVersion can be null. If Rofst is null then make DocVersion null - if (_myROFST != value) - { - if (value == null) - { - _myROFST = null; - MyDvi = null; - } - else - { - _myROFST = value; - - if (MyDvi == null) - { - MyDvi = (IsRofstValid) ? _myROFST.ROFstAssociations[0].MyDocVersion : null; - } - } - - // B2022-123: RO Tab Treeview not showing correct RO values when switching between procedures. - _currRofstID = (IsRofstValid) ? (int?)_myROFST.ROFstID : null; - } - } - } - - public DocVersionInfo MyDvi - { - // B2022-135 Submitted for Admin Tools (Check RO Links tool) - get { return (_myRTB != null) ? _myRTB.MyDVI : _docVersionInfo; } - set - { - // B2022-135 Submitted for Admin Tools (Check RO Links tool) - if (_docVersionInfo == null || _docVersionInfo != value || _docVersionInfo.VersionID != value.VersionID) - { - //Set flag for modified the docversion - should check for new ROs - if (_docVersionInfo?.VersionID != value?.VersionID) - { - changedDocVersion = true; - askedAboutchangedDocVersion = false; - } - - _docVersionInfo = value; - - if (_myRTB != null && (_docVersionInfo == null || _docVersionInfo.VersionID != _myRTB.MyDVI.VersionID)) - { - _docVersionInfo = _myRTB.MyDVI; - } - } - - // B2022-123: RO Tab Treeview not showing correct RO values when switching between procedures. - _currDocVersionID = (_docVersionInfo != null) ? (int?)_docVersionInfo.VersionID : null; - } - } - - public ROFSTLookup MyROFSTLookup - { - get { return (_myROFST != null) ? new ROFSTLookup(_myROFST.ROFstID, _docVersionInfo) : null;} - } - - public E_ROValueType ROTypeFilter - { - get { return _roTypeFilter; } - set {_roTypeFilter = value; } - } - - public RoUsageInfo CurROLink - { - get { return _curROLink; } - set - { - // Volian.Base.Library.vlnStackTrace.ShowStack("value={0} MyRTB={1}", value, ((MyRTB != null) ? MyRTB.SelectedText : "" )); - - // modify - set the controls to the current ro - if (value != null) - { - if (_curROLink != value) - { - _curROLink = value; - _savCurROLink = _curROLink; - - // B2022-088: [JPR] Find Doc Ro button not working in Word Sections - // B2022-098: [JPR] ROs not being resolved in Word Sections - string roid = ROFSTLookup.FormatRoidKey(_curROLink.ROID, true); - ExpandNode(roid); - } - } - else // if (_curROLink != null) // insert - clear out controls - { - _curROLink = value; - tvROFST.SelectedNode = null; - ResetSearch(); - - } - } - } - - // B2022-142 added this local variables to keep flag if the last step type was a RO Table or a RO Figure - // this is used to determin if we need to re-load the RO tree - private bool lastRTBwasROTable = false; - private bool lastRTBwasROFigure = false; - public StepRTB MyRTB - { - get { return _myRTB; } - set - { - if (value == null) - { - _myRTB = value; - MyROFST = null; - - // B2022-088: [JPR] Find Doc Ro button not working in Word Sections - // B2022-098: [JPR] ROs not being resolved in Word Sections - CurROLink = null; - _savCurROLink = null; - - //Clear flag for modified the docversion (if should check for new ROs) - //clearing this flag here prevents it from checking twice - changedDocVersion = false; - } - else if(_myRTB != value) - { - if (_myRTB != null) - { - lastRTBwasROTable = _myRTB.IsRoTable; // B2022-141 save whether last RTB was a RO Table - lastRTBwasROFigure = _myRTB.IsRoFigure; // B2022-141 save whether last RTB was a RO Figure - } - _myRTB = value; - - MyRTB.LinkChanged -= new StepRTBLinkEvent(MyRTB_LinkChanged); - MyRTB.LinkChanged += new StepRTBLinkEvent(MyRTB_LinkChanged); - MyRTB.SelectionChanged -= new EventHandler(MyRTB_SelectionChanged); - MyRTB.SelectionChanged += new EventHandler(MyRTB_SelectionChanged); - - if (string.IsNullOrEmpty(MyRTB.MyLinkText)) - { - CurROLink = null; - _savCurROLink = null; - } - // B2023-004 assign the doc version info associated with the current RTB (rich text box) - // this fixes an issue where unit designators could not be linked in the step edit (BNPP data) - MyDvi = _myRTB.MyItemInfo.MyDocVersion; - - MyROFST = (_myRTB.MyItemInfo.MyDocVersion.DocVersionAssociationCount > 0) ? _myRTB.MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst : null; - } - } - } - - public bool IsEnhancedStep - { - get { return (MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep); } - } - - public bool IsNotStep - { - get { return (MyRTB != null && MyRTB.MyItemInfo != null && (MyRTB.MyItemInfo.IsProcedure || MyRTB.MyItemInfo.IsSection)); } - } - - public bool IsInWordDoc - { - get { return (TabControl != null && TabControl.SelectedDisplayTabItem != null && TabControl.SelectedDisplayTabItem.MyDSOTabPanel != null); } - } - - public static UserInfo MyUserInfo - { - get { return _myUserInfo; } - set { _myUserInfo = value; } - } - - public SessionInfo MySessionInfo { get; set; } - - #endregion - - #region Constructors - - public DisplayRO() - { - InitializeComponent(); - - panelRoValue.BackColor = Color.Cornsilk; - panelValue.BackColor = Color.Cornsilk; - - _currRofstID = null; - _currDocVersionID = null; - - if (_searchTimer == null) - { - _searchTimer = new Timer(); - _searchTimer.Interval = 1000; - _searchTimer.Tick += new EventHandler(SelectionTimer_Tick); - _searchTimer.Stop(); - } - - - // Initialize the DisplayTags object - displayTags = new DisplayTags(); - - } - - #endregion - #region Event Handlers - #region (Progress Bar) - - private string InitialProgressBarMessage - { - set - { - if (ProgressBar == null) return; - ProgressBar.Value = 0; - ProgressBar.Maximum = 100; - ProgressBar.Text = value; - Application.DoEvents(); - } - } - private string FinalProgressBarMessage - { - set - { - if (ProgressBar == null) return; - ProgressBar.Text = value; - ProgressBar.Maximum = 100; - ProgressBar.Value = 100; - Application.DoEvents(); - } - } - private void DoProgressBarRefresh(int value, int max, string text) - { - if (ProgressBar == null) return; - ProgressBar.Maximum = max; - ProgressBar.Value = value; - ProgressBar.Text = text; - Application.DoEvents(); - } - - #endregion - - #region (RTB) - - //C2026-008 Re-Architect RO.FST to include RO Modification date/time - // DisplayTab was changed - // need to clear the RTB selected - // without resetting the DVI or FST - // (those will be set manually / individually) - // this will prevent DVI and FST from changing to null then back again - // which will trigger reloads - public void ClearRTB() - { - _myRTB = null; - CurROLink = null; - _savCurROLink = null; - } - - public void MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args) - { - CurROLink = null; - if (MyRTB.MyLinkText != null) CurROLink = args.MyLinkText.MyRoUsageInfo; - } - - public void MyRTB_SelectionChanged(object sender, EventArgs e) - { - _timeActivity.Open(); - - // B2022-088: [JPR] Find Doc Ro button not working in Word Sections - // B2022-098: [JPR] ROs not being resolved in Word Sections - // Need to call Stop then Start just in case the uses has changed their selection - // before the timer.Tick event fires. Calling Stop/Start is the same as Reset for the timer - _searchTimer.Stop(); - _searchTimer.Start(); - - _timeActivity.Close(); - } - - private void SelectionTimer_Tick(object sender, EventArgs e) - { - // Stop the timer - _searchTimer.Stop(); - - // Process RO Value Search - if (MyRTB != null && !MyRTB.IsDisposed) - { - ProcessSearch(MyRTB.SelectedText, (int)ROFSTLookup.SearchTypes.StartsWith); - } - } - - #endregion - - #region (Tree Node) - - private void tvROFST_DoubleClick(object sender, EventArgs e) - { - // B2016-132: don't process a double click on an RO if on an enhanced step: - if (!IsEnhancedStep) - { - SaveRO(); - } - } - - private void tvROFST_BeforeExpand(object sender, TreeViewCancelEventArgs e) - { - LoadChildren(e.Node); - } - - private void tvROFST_AfterSelect(object sender, TreeViewEventArgs e) - { - // B2022-088: [JPR] Find Doc Ro button not working in Word Sections - // B2022-098: [JPR] ROs not being resolved in Word Sections - if (e.Node.Tag is ROFSTLookup.rochild) - { - ROFSTLookup.rochild chld = (ROFSTLookup.rochild)e.Node.Tag; - selectedChld = chld; - - if (chld.value != null) - { - chld.value = Regex.Replace(chld.value, @"\\u([0-9]{1,4})\?", m => int.TryParse(m?.Groups[1]?.Value, out int result) ? Convert.ToChar(result).ToString() : ""); - RoUsageInfo SavROLink = null; - if (_savCurROLink != null) SavROLink = _savCurROLink; - - // Set the Display Text to the AccPageID - lbROId.Text = chld.appid; - - //B2017-245 Disable SaveRO button for Procedures and Sections - //B2020-049: Save button not enabled on Word docs, only if a procedure was opened first and immediately after the word document - // section is opened (added 'IsInWorDoc') - btnSaveRO.Enabled = (IsInWordDoc || (!IsNotStep && !IsEnhancedStep)) && UserInfo.CanEdit(MyUserInfo, MyDvi) && ((SavROLink == null) || !(chld.roid.Equals(SavROLink.ROID.ToUpper()))); //added security check (UserInfo.CanEdit) - btnCancelRO.Enabled = (_savCurROLink != null && (SavROLink != null && chld.roid != SavROLink.ROID.ToUpper())); - btnGoToRO.Enabled = UserInfo.CanEditROs(MyUserInfo, MyDvi); // Writers and Reviewers cannot edit ROs (run the RO Editor) - - switch (chld.type) - { - case 1: // standard (regular) text RO type - tbROValue.Text = chld.value; - btnPreviewRO.Enabled = false; - if (chld.roid.StartsWith("FFFF")) btnGoToRO.Enabled = false; - break; - - case 2: // Table RO type - case 3: // This is type 3 when part of a multiple return value - tbROValue.Text = "(Table)"; - btnPreviewRO.Enabled = true; - break; - - case 4: // X/Y Plot RO type - tbROValue.Text = "(Graph)"; - btnPreviewRO.Enabled = true; - break; - - case 8: // Integrated Graphics RO type - tbROValue.Text = "(Image)"; - btnPreviewRO.Enabled = true; - break; - } - } - } - else - { - // B2022-088: [JPR] Find Doc Ro button not working in Word Sections - // B2022-098: [JPR] ROs not being resolved in Word Sections - ResetSearch(); - } - } - - #endregion - - #region (Buttons) - - private void btnSaveRO_Click(object sender, EventArgs e) - { - SaveRO(); - } - - private void btnCancelRO_Click(object sender, EventArgs e) - { - _curROLink = _savCurROLink; - btnCancelRO.Enabled = false; - - ExpandNode(_curROLink.ROID); - } - - private void btnPreviewRO_Click(object sender, EventArgs e) - { - if (selectedChld.type == 8) // integrated graphic - { - string fname = selectedChld.value.Substring(0, selectedChld.value.IndexOf('\n')); - int thedot = fname.LastIndexOf('.'); - ROImageInfo tmp = null; - - if (thedot == -1 || (thedot != (fname.Length - 4))) - { - tmp = ROImageInfo.GetByROFstID_FileName(MyROFST.ROFstID, fname); - fname += string.Format(".{0}", MyROFST.MyRODb.RODbConfig.GetDefaultGraphicExtension()); - } - - if (tmp == null) tmp = ROImageInfo.GetByROFstID_FileName(MyROFST.ROFstID, fname); - if (tmp == null) tmp = MyROFST.GetROImageByFilename(fname, null); - - if (tmp != null) - { - ROImageConfig rc = new ROImageConfig(tmp); - int size = Convert.ToInt32(rc.Image_Size); - PreviewROImage pvROImg = new PreviewROImage(ROImageInfo.Decompress(tmp.Content, size), selectedChld.title); - pvROImg.ShowDialog(); - } - else - { - FlexibleMessageBox.Show(string.Format("Cannot Find Image Data: {0}, {1}", MyROFST.ROFstID, fname)); - } - } - else if (selectedChld.type == 2) // table - { - PreviewMultiLineRO pmlROTable = new PreviewMultiLineRO(selectedChld.value, selectedChld.title); - pmlROTable.ShowDialog(); - } - else if (selectedChld.type == 4) // x/y plot - { - frmXYPlot plot = new frmXYPlot(selectedChld.appid + " - " + selectedChld.title, selectedChld.value); - plot.Show(); - } - } - - private void btnGoToRO_Click(object sender, EventArgs e) - { - if (tvROFST.SelectedNode == null) return; - RunRoEditor(); - } - - private void btnFindDocRO_Click(object sender, EventArgs e) - { - // C2016-044: support click of the 'Find Doc RO' button: - DisplayTabItem dti = (_tabControl == null) ? null : _tabControl.SelectedDisplayTabItem; - - if (dti != null && dti.MyDSOTabPanel != null) - { - // the currently selected tab control is a word document - see if it has an - // active selection. If not, tell the user that text needs to be selected before the ro can be found. - string mytext = dti.MyDSOTabPanel.GetSelectedString(); - - if (string.IsNullOrEmpty(mytext)) - { - FlexibleMessageBox.Show(this, "Text must be selected in the document in order for an RO find to be performed.", "Select Text", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - - ProcessSearch(mytext, (int)ROFSTLookup.SearchTypes.StartsWith); - } - } - - #endregion - - #region (Labels) - - private void lbROId_DoubleClick(object sender, EventArgs e) - { - if (tvROFST.SelectedNode == null) - return; - - // do not allow writers and reviews to run the RO Editor - if (!UserInfo.CanEditROs(MyUserInfo, MyDvi)) - return; - - if (VlnSettings.ReleaseMode.Equals("DEMO")) - { - FlexibleMessageBox.Show("Referenced Object Editor not available in the Demo version.", "PROMS Demo Version"); - return; - } - - string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable - object obj = tvROFST.SelectedNode.Tag; - - if (obj is ROFSTLookup.rochild) - { - ROFSTLookup.rochild roch = (ROFSTLookup.rochild)obj; - - _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 - if (MyROFST.MyRODb.DBConnectionString != "cstring") args = args + " \"" + MyROFST.MyRODb.DBConnectionString + "\""; - - // C2021-026 pass in Parent/Child information (list of the children) - // B2022-019 look at all DocVersions to find ParentChild information - // to ensure we pass in Parent/Child even when not coming from a Parent/Child procedure set - // B2022-073 Break out of the foreach when we find a set with parent/child information - - DocVersionInfoList dvil = DocVersionInfoList.Get(); - - foreach (DocVersionInfo dvi in dvil) - { - 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 - { - args += " \"PC=" + dvc.Unit_Name + "\""; - break; - } - } - - System.Diagnostics.Process.Start(roapp, args); - } - } - - private void lbFound_SelectedValueChanged(object sender, EventArgs e) - { - if (lbFound.Visible && lbFound.SelectedIndex >= 0 && lbFound.SelectedValue != null) - { - ExpandNode(Convert.ToString(lbFound.SelectedValue)); - } - } - - #endregion - - #region (ROUpdate) - public List roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args) - { - return VlnFlexGrid.ROTableUpdate(sender, args); - } - - #endregion - - #endregion - - #region Public Methods - - //C2026-008 Re-Architect RO.FST to include RO Modification date/time - // changed to return true if the RO FST got updated - public bool LoadTree(bool forceReload = false) - { - bool updatedROs = false; - - if (MyROFST == null) - { - tvROFST.Nodes.Clear(); - lbFound.Visible = false; - return updatedROs; - } - - if (changedDocVersion || forceReload || RoTreeNeedsReloaded || tvROFST.Nodes == null || tvROFST.Nodes.Count <= 0) - { - //C2026-008 Re-Architect RO.FST to include RO Modification date/time - //check if newer data - if there is, check if user wants to update data - int fstid = MyROFSTLookup.GetNewerFSTID(); - int origfstid = MyROFSTLookup.RofstID; - - if (_docVersionInfo != null && fstid != -1 && fstid != MyROFSTLookup.RofstID) - { - string message = string.Empty; - if (_progressBar?.Text != "RO Check Paused - Other Users In Set" && !MySessionInfo.CanCheckOutItem(_docVersionInfo.VersionID, CheckOutType.DocVersion, ref message)) - { - FinalProgressBarMessage = "RO Check Paused - Other Users In Set"; - } - else if (!MySessionInfo.CanCheckOutItem(_docVersionInfo.VersionID, CheckOutType.DocVersion, ref message)) - { - //do nothing - is still checked out - } - else if (changedDocVersion && !askedAboutchangedDocVersion && !ROWorkingDraftAsk.ContainsWorkingDraft(_docVersionInfo.VersionID)) - { - if (MessageBox.Show($"There exists a newer ROFST for this RO database that was loaded for other sets.\r\n\r\nDo you want to update this set's ROs to be consistent/use the latest loaded ROFST?", "Load ROs", MessageBoxButtons.YesNo) == DialogResult.Yes) - { - InitialProgressBarMessage = "Updating ROs"; - - ROFstInfo roFstInfo = ROFstInfo.Get(fstid); - roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); - ROFstInfo.RefreshROFstAtItemLevel(_docVersionInfo, DoProgressBarRefresh, null, roFstInfo, origfstid, fstid); - roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); - - Application.DoEvents(); - - FinalProgressBarMessage = "ROs values updated"; - MyROFST = roFstInfo; - - updatedROs = true; - - askedAboutchangedDocVersion = false; - ROWorkingDraftAsk.ClearWorkingDrafts(); - } - else - { - askedAboutchangedDocVersion = true; - if (!ROWorkingDraftAsk.ContainsWorkingDraft(_docVersionInfo.VersionID)) - ROWorkingDraftAsk.AddWorkingDrafts(_docVersionInfo.VersionID); - } - - } - } - - //B2025-008 - //in cases where a RO table is clicked on - //it will refresh the list - //temp store what the ROID was before the list refreshes - //so can go to it after the refresh - string tmpROID = CurROLink?.ROID; - - ROFSTLookup.rodbi[] dbs = MyROFSTLookup?.GetRODatabaseList(true); - - // B2022-123: RO Tab Treeview not showing correct RO values when switching between procedures. - // Added optional parameter "forceReload" and cleared out any existing nodes before reloading the tree - // the clear nodes code below has to be after the GetRODatabaseList database call because of races conditions in the code - tvROFST.Nodes.Clear(); - ResetSearch(); //B2023-050 need to reset the SaveRO, and any RO info that was selected last time the tree was loaded - if (dbs != null) - { - for (int i = 0; i < dbs.Length; i++) - { - ROFSTLookup.rodbi db = dbs[i]; - - TreeNode tn = new TreeNode(db.dbiTitle); - tn.Tag = db; - tvROFST.Nodes.Add(tn); - - AddDummyGroup(db, tn); - } - } - - _currRofstID = (IsRofstValid) ? (int?)_myROFST.ROFstID : null; - _currDocVersionID = null; - - if(_docVersionInfo != null) _currDocVersionID = (int?)_docVersionInfo.VersionID; - - if (tmpROID != null) ExpandNode(ROFSTLookup.FormatRoidKey(tmpROID, true)); - - //doc version would have updated (if needed) so reset flag - if (_progressBar?.Text != "RO Check Paused - Other Users In Set") - { - changedDocVersion = false; - } - } - - var unitInfoNode = tvROFST.Nodes.Cast().Where(x => x.Text == "Unit Information").FirstOrDefault(); - - if ((ROTypeFilter == E_ROValueType.Text || ROTypeFilter == E_ROValueType.All) && this.MyDvi != null && this.MyDvi.MultiUnitCount > 1) - { - // Add Unit Information Database if it doesn't exist - if (unitInfoNode == null && MyROFSTLookup != null) - { - TreeNode tnn = tvROFST.Nodes.Add("Unit Information"); - TreeNode cn = null; - - ROFSTLookup.rochild roc = MyROFSTLookup.GetRoChild("FFFF00000001"); - cn = tnn.Nodes.Add(roc.title); - cn.Tag = roc; - - roc = MyROFSTLookup.GetRoChild("FFFF00000002"); - cn = tnn.Nodes.Add(roc.title); - cn.Tag = roc; - - roc = MyROFSTLookup.GetRoChild("FFFF00000003"); - cn = tnn.Nodes.Add(roc.title); - cn.Tag = roc; - - roc = MyROFSTLookup.GetRoChild("FFFF00000004"); - cn = tnn.Nodes.Add(roc.title); - cn.Tag = roc; - - roc = MyROFSTLookup.GetRoChild("FFFF00000005"); - cn = tnn.Nodes.Add(roc.title); - cn.Tag = roc; - - roc = MyROFSTLookup.GetRoChild("FFFF00000006"); - cn = tnn.Nodes.Add(roc.title); - cn.Tag = roc; - - roc = MyROFSTLookup.GetRoChild("FFFF00000007"); - cn = tnn.Nodes.Add(roc.title); - cn.Tag = roc; - - roc = MyROFSTLookup.GetRoChild("FFFF00000008"); - cn = tnn.Nodes.Add(roc.title); - cn.Tag = roc; - } - } - else if (unitInfoNode != null) // Add Unit Information Database if it doesn't exist [Not Multi-Unit DocVersion] - { - tvROFST.Nodes.Remove(unitInfoNode); - } - - _curROTypeFilter = _roTypeFilter; - - return updatedROs; - } - - public void SetFindDocROButton(bool enabled) - { - this.btnFindDocRO.Enabled = enabled; - } - - public static bool GreaterValue(string value1, string value2) - { - Match match1 = _regExGetNumber.Match(value1); - Match match2 = _regExGetNumber.Match(value2); - - 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? - if (double.TryParse(match1.ToString(), out dbl1) && double.TryParse(match2.ToString(), out dbl2)) - { - if (dbl1 != dbl2) //B2021-144 if the numerical is identical default to the string comparison? - return dbl1 > dbl2; - } - } - - return string.Compare(value1, value2, true) > 0; - } - - #endregion - - #region Private Methods - - private void LoadChildren(TreeNode tn) - { - //Check if node has already been loaded - if (tn.FirstNode != null && tn.FirstNode.Text != DummyNodeText) return; - if (tn.FirstNode != null && tn.FirstNode.Text == DummyNodeText) tn.FirstNode.Remove(); - - //object tag = tn.Tag; - ROFSTLookup.rochild[] children = null; - - if (tn.Tag is ROFSTLookup.rodbi) - { - ROFSTLookup.rodbi db = (ROFSTLookup.rodbi)tn.Tag; - MyROFSTLookup.LoadChildren(ref db); - children = db.children; - } - else if (tn.Tag is ROFSTLookup.rochild) - { - ROFSTLookup.rochild ch = (ROFSTLookup.rochild)tn.Tag; - MyROFSTLookup.LoadChildren(ref ch); - children = ch.children; - } - - - // if children, add dummy node - if (children != null && children.Length > 0) - { - for (int i = 0; i < children.Length; i++) - { - TreeNode tmp = null; - ROFSTLookup.rochild roc = children[i]; - - // if this is a group, i.e. type 0, add a dummy node - if (roc.type == 0 && !MyROFSTLookup.HasChildren(ref roc)) - { - continue; // Ignore: Junk Scenario - } - else if (ROTypeFilter != E_ROValueType.All && (roc.type & (uint)ROTypeFilter) == 0) - { - continue; // Ignore: Filter Doesn't Match - } - else if (!string.IsNullOrEmpty(roc.appid)) - { - MyROFSTLookup.LoadChildren(ref roc); - - if (roc.children.Length == 1 && roc.children.First().roid.Length == 16) - { - roc.appid = roc.children.First().appid; - roc.roid = roc.children.First().roid; - roc.value = roc.children.First().value; - - roc.children = new List().ToArray(); - } - } - - if (roc.value == null) - { - tmp = new TreeNode(roc.title); - tmp.Tag = roc; - - int index = FindIndex(tn.Nodes, tmp.Text); - tn.Nodes.Insert(index, tmp); - - TreeNode sub = new TreeNode(DummyNodeText); - tmp.Nodes.Add(sub); - } - else - { - - tmp = new TreeNode(roc.title); - tmp.Tag = roc; - - if (tmp.Text.IndexOf("\\u") > -1) // RO Editor add symbols C2022 - 003 - { - tmp.Text = Regex.Replace(tmp.Text, @"\\u([0-9]{1,4})\?", m => Convert.ToChar(int.Parse(m.Groups[1].Value)).ToString()); - } - - if (roc.roid.Length == 16) - { - tn.Nodes.Add(tmp); - } - else - { - int index = FindIndex(tn.Nodes, tmp.Text); - tn.Nodes.Insert(index, tmp); - } - } - } - } - } - - private void AddDummyGroup(ROFSTLookup.rodbi rodbi, TreeNode tn) - { - if (IsRofstValid && MyROFSTLookup.HasChildren(ref rodbi)) - { - TreeNode tmp = new TreeNode(DummyNodeText); - tn.Nodes.Add(tmp); - } - } - - private void ExpandNode(string roid) - { - // Clean-up Roid if necessary - roid = ROFSTLookup.FormatRoidKey(roid); - - bool multValSel = (roid.Length == 16) ? true : false; - string db = roid.Substring(0, 4); - int dbiID = MyROFSTLookup.GetRODatabaseTitleIndex(roid); - - ROFSTLookup.rochild rochld = MyROFSTLookup.GetRoChild(roid.Substring(0, 12).ToUpper()); - - // use this to walk up tree until database - this is used to expand tree. - List path = new List(); - int myid = rochld.ID; - - while (myid >= 0) - { - path.Insert(0, myid); - myid = rochld.ParentID; - string pROID = string.Format("{0:X04}{1:X08}", db, myid); - rochld = MyROFSTLookup.GetRoChild(pROID); - - if (rochld.ID == -1) myid = -1; - } - - TreeNode tnExpand = null; - - - //Find Database Node First - TreeNode dbNode = null; - - if (roid.StartsWith("FFFF")) - dbNode = tvROFST.Nodes.Cast().Where(x => (x.Tag.Equals(null)) && (x.Text.Equals("Unit Information"))).FirstOrDefault(); - else - dbNode = tvROFST.Nodes.Cast().Where(x => (x.Tag is ROFSTLookup.rodbi) && ((ROFSTLookup.rodbi)x.Tag).dbiID == dbiID).FirstOrDefault(); - - if (dbNode != null) - { - LoadChildren(dbNode); - tnExpand = dbNode; - } - - if (tnExpand != null) - { - // use the path id list to load/find the treeview's nodes. - foreach (int citm in path) - { - LoadChildren(tnExpand); - tnExpand.Expand(); - - TreeNode chldNode = tnExpand.Nodes.Cast().Where(x => (x.Tag is ROFSTLookup.rochild) && ((ROFSTLookup.rochild)x.Tag).ID == citm).FirstOrDefault(); - if (chldNode != null) - { - tnExpand = chldNode; - } - } - } - - if (tnExpand != null) - { - // If a multiple return value, try to select the proper node - if (multValSel) - { - LoadChildren(tnExpand); - tnExpand.Expand(); - - TreeNode chldNode = tnExpand.Nodes.Cast().Where(x => ((ROFSTLookup.rochild)x.Tag).roid.ToUpper() == roid.ToUpper()).FirstOrDefault(); - if (chldNode != null) - { - tnExpand = chldNode; - } - } - } - - tvROFST.SelectedNode = tnExpand; - } - - private int FindIndex(TreeNodeCollection nodes, string value) - { - int index = 0; - - foreach (TreeNode node in nodes) - { - if (GreaterValue(node.Text, value)) return index; - index++; - } - - return index; - } - - private void SaveRO() - { - //Check if an RO Node is selected from the TreeView - if (string.IsNullOrEmpty(tbROValue.Text)) - { - FlexibleMessageBox.Show("Must select an RO Value from the tree."); - return; - } - - - Object obj = tvROFST.SelectedNode.Tag; - - if (obj is ROFSTLookup.rochild) - { - ROFSTLookup.rochild roc = (ROFSTLookup.rochild)obj; - DisplayTabItem dti = TabControl.SelectedDisplayTabItem; //.OpenItem(_ItemInfo); // open the corresponding procedure text - - if (dti.MyDSOTabPanel != null) // A Word Document tab is the active tab - { - string accPageID = string.Format("<{0}>", roc.appid.ToUpper()); - - // 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 - if (dti.MyDSOTabPanel != null) - { - dti.MyDSOTabPanel.InsertText(accPageID); - } - } - else if (MyRTB != null) // a Procedure Steps section tab is active - { - if (CheckROSelection(roc)) // check for RO type is valid for this type of step/substep - { - // Pad to 16 to store in the RoUsage table. - string padroid = ROFSTLookup.FormatRoidKey(roc.roid, true); - string linktxt = string.Format(@"#Link:ReferencedObject: {0} {1}", padroid, MyROFST.RODbID); - - // Resolve symbols and scientific notation in the RO return value - string valtxt = MyROFSTLookup.GetTranslatedRoValue(padroid, MyRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, MyRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, false, MyRTB.MyItemInfo); - - MyRTB.OnRoInsert(this, new StepRTBRoEventArgs(valtxt, selectedChld.value, linktxt, padroid, MyROFST.RODbID)); - - } - } - - btnGoToRO.Enabled = false; - btnSaveRO.Enabled = false; - btnCancelRO.Enabled = false; - btnPreviewRO.Enabled = false; - - CurROLink = null; - _savCurROLink = null; - } - } - - private bool CheckROSelection(ROFSTLookup.rochild selectedRO) - { - bool goodToGo = true; - bool replacingRO = (_savCurROLink != null); - - string insrpl = (replacingRO) ? "Cannot Replace" : "Cannot Insert"; - string errormsg = string.Empty; - - switch (selectedRO.type) - { - case 1: // regular text RO - if (MyRTB.MyItemInfo.IsFigure) - { - errormsg = (replacingRO) ? "a Figure with a non-figure." : "a text RO in a Figure type."; - goodToGo = false; - } - break; - - case 2: // table RO - if (MyRTB.MyItemInfo.IsFigure) - { - errormsg = (replacingRO) ? "a Figure with a non-figure." : "a table into a Figure type."; - goodToGo = false; - } - else if (!MyRTB.MyItemInfo.IsTable) - { - errormsg = (replacingRO) ? "a non-table RO with a Table RO." : "a table into a non-table type."; - //TODO: Prompt user to insert a new Table substep type and place this RO into it - goodToGo = false; - } - break; - - case 4: // X/Y Plot RO type - if (!MyRTB.MyItemInfo.IsAccPages) - { - errormsg = (replacingRO) ? "a non-X/Y Plot RO with an X/Y Plot RO." : "an X/Y Plot RO in an non-Accessory Page type."; - //TODO: Prompt user to insert a new substep type that handles x/y Plots and place this RO into it - goodToGo = false; - } - break; - - case 8: // figure (intergrated graphics) - if (!MyRTB.MyItemInfo.IsFigure && !MyRTB.MyItemInfo.IsAccPages) - { - errormsg = (replacingRO) ? "a graphics RO with a non-graphcis RO." : "a Graphics RO in an non-Figure or a non-Accessory Page type."; - //TODO: Prompt user to insert a new substep type that handles x/y Plots and place this RO into it - goodToGo = false; - - - - } - break; - } - - if (!goodToGo) - { - FlexibleMessageBox.Show(string.Format("{0} {1}", insrpl, errormsg), (replacingRO) ? "Invalid RO Replacement" : "Invalid RO Insert"); - } - - return goodToGo; - } - - private void RunRoEditor() - { - if (VlnSettings.ReleaseMode.Equals("DEMO")) - { - FlexibleMessageBox.Show("Referenced Object Editor not available in the Demo version.", "PROMS Demo Version"); - return; - } - - - string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable - Object obj = tvROFST.SelectedNode.Tag; - - if (obj is ROFSTLookup.rochild) - { - ROFSTLookup.rochild roc = (ROFSTLookup.rochild)obj; - _selectedRoidBeforeRoEditor = roc.roid; - - string args = "\"" + _myROFST.MyRODb.FolderPath + "\" " + roc.roid.ToLower(); - - if (!Directory.Exists(_myROFST.MyRODb.FolderPath)) - { - FlexibleMessageBox.Show(string.Format("RO Database directory does not exist: {0}", _myROFST.MyRODb.FolderPath)); - return; - } - - // C2017-003: ro data in sql server, check for sql connection string - if (_myROFST.MyRODb.DBConnectionString != "cstring") args = args + " \"" + _myROFST.MyRODb.DBConnectionString + "\""; - - // C2021-026 pass in Parent/Child information (list of the children) - // B2022-019 look at all DocVersions to find ParentChild information - // to ensure we pass in Parent/Child even when not coming from a Parent/Child procedure set - // B2022-073 Break out of the foreach when we find a set with parent/child information - DocVersionInfoList dvil = DocVersionInfoList.Get(); - - foreach (DocVersionInfo dvi in dvil) - { - DocVersionConfig jdvc = dvi.DocVersionConfig; - - 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 + "\""; - break; - } - } - - System.Diagnostics.Process.Start(roapp, args); - } - } - - private void ProcessSearch(string searchValue, int searchTypeID) - { - // Jake [2022.05.11]: Added try catch to prevent unhandled exception when the timer ticks and - // tries to process a search while the main tab/procedure is closing - try - { - // B2022-124: [JPR] Blank RO Values (All Spaces) printing as "?" - if (!string.IsNullOrEmpty(searchValue)) - { - searchValue = searchValue.Replace('\u2011', '-'); - searchValue = searchValue.Replace(@"\u9586?", @"\\"); - - if (searchValue.Replace(" ", string.Empty).Length > 0) - searchValue = searchValue.Trim(); - } - - if (this.Enabled && !string.IsNullOrEmpty(searchValue) && searchValue.Length >= 2 && !searchValue.Contains("#Link:Transition")) - { - Dictionary dicRoVals = new Dictionary(); - - // B2022-088: [JPR] Find Doc Ro button not working in Word Sections - // B2022-098: [JPR] ROs not being resolved in Word Sections - if (searchValue.StartsWith("<") && searchValue.EndsWith(">")) // RO Link (accPageID) - { - ROFSTLookup.rochild roc = MyROFSTLookup.GetROChildByAccPageID(searchValue); - - // If RO is valid then select node in tree view - if (roc.ID >= 0 && !string.IsNullOrEmpty(roc.value)) - { - ExpandNode(roc.roid); - } - - lbFound.DataSource = null; - lbFound.Visible = false; - - _lastSearchValue = searchValue; - } - else if (searchValue.Contains("#Link:ReferencedObject")) // RO Link (roid) - { - // we where only removing the END if the searchValue ended in "1[END>" - // but sometimes it ended in "2[END>" and cause a null reference error - // - was seen only running via Visual Studio debugger - // I cleaned up the code to remove in ether case so that we get the expected roid value - jsj 11-18-2024 - string substr = searchValue.Substring(searchValue.LastIndexOf(" ")); - if (substr.Contains("[END>")) - searchValue = searchValue.Substring(0, searchValue.Length - substr.Length); - string roid = ROFSTLookup.FormatRoidKey(searchValue.Substring(searchValue.LastIndexOf(" ")), true); - - if (roid != selectedChld.roid) - { - ROFSTLookup.rochild roc = MyROFSTLookup.GetRoChild(roid); - ExpandNode(roc.roid); - } - - lbFound.DataSource = null; - lbFound.Visible = false; - - _lastSearchValue = searchValue; - } - else // if (searchValue != _lastSearchValue) - { - dicRoVals = MyROFSTLookup.Search(searchValue, searchTypeID, false, MaxNumSearchRecords); - - if (dicRoVals.Count > 0) - { - lbFound.SelectedValueChanged -= new EventHandler(lbFound_SelectedValueChanged); - - lbFound.DataSource = new BindingSource(dicRoVals, null); - lbFound.ValueMember = "Key"; // roid - lbFound.DisplayMember = "Value"; // default value - - lbFound.SelectionMode = SelectionMode.One; - lbFound.SelectedIndex = -1; - lbFound.Visible = true; - - lbFound.SelectedValueChanged += new EventHandler(lbFound_SelectedValueChanged); - - if (lbFound.Items != null && lbFound.Items.Count == 1) - lbFound.SelectedIndex = 0; - } - else - { - lbFound.DataSource = null; - lbFound.Visible = false; - } - - _lastSearchValue = searchValue; - } - } - else - { - _lastSearchValue = string.Empty; - lbFound.DataSource = null; - lbFound.Visible = false; - } - - } - catch { } - } - - private void ResetSearch() - { - // Clear the Display/Info for Prev Selected RO Child - tbROValue.Text = null; - lbROId.Text = string.Empty; - - // Disable all buttons by default - btnSaveRO.Enabled = false; - btnCancelRO.Enabled = false; - btnPreviewRO.Enabled = false; - - //B2026-030 GoTo sometimes requires being pressed twice - if (MyUserInfo != null && MyDvi != null && selectedChld.value != null) - { - btnGoToRO.Enabled = UserInfo.CanEditROs(MyUserInfo, MyDvi); // Writers and Reviewers cannot edit ROs (run the RO Editor) - } - else - { - btnGoToRO.Enabled = false; - } - } - - #endregion - } -} - diff --git a/PROMS/Volian.Controls.Library/DisplayRO.resx b/PROMS/Volian.Controls.Library/DisplayRO.resx deleted file mode 100644 index c838cbe9..00000000 --- a/PROMS/Volian.Controls.Library/DisplayRO.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplayReports.Designer.cs b/PROMS/Volian.Controls.Library/DisplayReports.Designer.cs deleted file mode 100644 index 3d8b7426..00000000 --- a/PROMS/Volian.Controls.Library/DisplayReports.Designer.cs +++ /dev/null @@ -1,568 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class DisplayReports - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.tctrlReports = new DevComponents.DotNetBar.TabControl(); - this.tabControlPanel1 = new DevComponents.DotNetBar.TabControlPanel(); - this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); - this.cbxTransToProcs = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxTransFromProcs = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.tabTransitionReports = new DevComponents.DotNetBar.TabItem(this.components); - this.tabControlPanel2 = new DevComponents.DotNetBar.TabControlPanel(); - this.panRORpts = new DevComponents.DotNetBar.PanelEx(); - this.cbxIncldMissingROs = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxSummary = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxROUsage = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxComplete = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.labelX1 = new DevComponents.DotNetBar.LabelX(); - this.cmbxROUsageSort = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.cbiRO = new DevComponents.Editors.ComboItem(); - this.cbiProc = new DevComponents.Editors.ComboItem(); - this.tabROReports = new DevComponents.DotNetBar.TabItem(this.components); - this.advTreeRO = new DevComponents.AdvTree.AdvTree(); - this.elementStyle2 = new DevComponents.DotNetBar.ElementStyle(); - this.node2 = new DevComponents.AdvTree.Node(); - this.nodeConnector2 = new DevComponents.AdvTree.NodeConnector(); - this.xpSetToReport = new DevComponents.DotNetBar.ExpandablePanel(); - this.advTreeProcSets = new DevComponents.AdvTree.AdvTree(); - this.elementStyle1 = new DevComponents.DotNetBar.ElementStyle(); - this.node1 = new DevComponents.AdvTree.Node(); - this.nodeConnector1 = new DevComponents.AdvTree.NodeConnector(); - this.btnPrintReport = new DevComponents.DotNetBar.ButtonX(); - this.xpSelROs = new DevComponents.DotNetBar.ExpandablePanel(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.cbxSortBySetpointID = new DevComponents.DotNetBar.Controls.CheckBoxX(); - ((System.ComponentModel.ISupportInitialize)(this.tctrlReports)).BeginInit(); - this.tctrlReports.SuspendLayout(); - this.tabControlPanel1.SuspendLayout(); - this.panelEx1.SuspendLayout(); - this.tabControlPanel2.SuspendLayout(); - this.panRORpts.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.advTreeRO)).BeginInit(); - this.xpSetToReport.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.advTreeProcSets)).BeginInit(); - this.xpSelROs.SuspendLayout(); - this.SuspendLayout(); - // - // tctrlReports - // - this.tctrlReports.CanReorderTabs = false; - this.tctrlReports.CloseButtonOnTabsAlwaysDisplayed = false; - this.tctrlReports.CloseButtonPosition = DevComponents.DotNetBar.eTabCloseButtonPosition.Right; - this.tctrlReports.Controls.Add(this.tabControlPanel2); - this.tctrlReports.Controls.Add(this.tabControlPanel1); - this.tctrlReports.Dock = System.Windows.Forms.DockStyle.Top; - this.tctrlReports.Location = new System.Drawing.Point(0, 0); - this.tctrlReports.Margin = new System.Windows.Forms.Padding(2); - this.tctrlReports.Name = "tctrlReports"; - this.tctrlReports.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.tctrlReports.SelectedTabFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold); - this.tctrlReports.SelectedTabIndex = 0; - this.tctrlReports.ShowFocusRectangle = false; - this.tctrlReports.Size = new System.Drawing.Size(261, 120); - this.tctrlReports.Style = DevComponents.DotNetBar.eTabStripStyle.Office2007Document; - this.tctrlReports.TabIndex = 0; - this.tctrlReports.TabLayoutType = DevComponents.DotNetBar.eTabLayoutType.FixedWithNavigationBox; - this.tctrlReports.Tabs.Add(this.tabTransitionReports); - this.tctrlReports.Tabs.Add(this.tabROReports); - this.tctrlReports.Text = "tabControl1"; - this.tctrlReports.ThemeAware = true; - // - // tabControlPanel1 - // - this.tabControlPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Windows7; - this.tabControlPanel1.Controls.Add(this.panelEx1); - this.tabControlPanel1.Location = new System.Drawing.Point(0, 22); - this.tabControlPanel1.Name = "tabControlPanel1"; - this.tabControlPanel1.Padding = new System.Windows.Forms.Padding(1); - this.tabControlPanel1.Size = new System.Drawing.Size(261, 82); - this.tabControlPanel1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))); - this.tabControlPanel1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227))))); - this.tabControlPanel1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.tabControlPanel1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199))))); - this.tabControlPanel1.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right) - | DevComponents.DotNetBar.eBorderSide.Bottom))); - this.tabControlPanel1.Style.GradientAngle = 90; - this.tabControlPanel1.TabIndex = 1; - this.tabControlPanel1.TabItem = this.tabTransitionReports; - // - // panelEx1 - // - this.panelEx1.CanvasColor = System.Drawing.SystemColors.Control; - this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.panelEx1.Controls.Add(this.cbxTransToProcs); - this.panelEx1.Controls.Add(this.cbxTransFromProcs); - this.panelEx1.Dock = System.Windows.Forms.DockStyle.Top; - this.panelEx1.Location = new System.Drawing.Point(1, 1); - this.panelEx1.Name = "panelEx1"; - this.panelEx1.Size = new System.Drawing.Size(259, 81); - this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center; - this.panelEx1.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.panelEx1.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.panelEx1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.panelEx1.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.panelEx1.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.panelEx1.Style.GradientAngle = 90; - this.panelEx1.TabIndex = 2; - this.panelEx1.ThemeAware = true; - // - // cbxTransToProcs - // - this.cbxTransToProcs.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxTransToProcs.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxTransToProcs.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton; - this.cbxTransToProcs.Checked = true; - this.cbxTransToProcs.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbxTransToProcs.CheckValue = "Y"; - this.cbxTransToProcs.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxTransToProcs.Location = new System.Drawing.Point(3, 3); - this.cbxTransToProcs.Name = "cbxTransToProcs"; - this.cbxTransToProcs.Size = new System.Drawing.Size(257, 23); - this.cbxTransToProcs.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.cbxTransToProcs.TabIndex = 0; - this.cbxTransToProcs.Text = "Transitions To Selected Procedure(s)"; - this.cbxTransToProcs.CheckedChanged += new System.EventHandler(this.cbxTransToProcs_CheckedChanged); - // - // cbxTransFromProcs - // - this.cbxTransFromProcs.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxTransFromProcs.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxTransFromProcs.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton; - this.cbxTransFromProcs.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxTransFromProcs.Location = new System.Drawing.Point(2, 32); - this.cbxTransFromProcs.Name = "cbxTransFromProcs"; - this.cbxTransFromProcs.Size = new System.Drawing.Size(257, 23); - this.cbxTransFromProcs.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.cbxTransFromProcs.TabIndex = 1; - this.cbxTransFromProcs.Text = "Transitions From Selected Procedure(s)"; - this.cbxTransFromProcs.CheckedChanged += new System.EventHandler(this.cbxTransFromProcs_CheckedChanged); - // - // tabTransitionReports - // - this.tabTransitionReports.AttachedControl = this.tabControlPanel1; - this.tabTransitionReports.Name = "tabTransitionReports"; - this.tabTransitionReports.Text = "Transitions"; - this.tabTransitionReports.Click += new System.EventHandler(this.tabTransitionReports_Click); - // - // tabControlPanel2 - // - this.tabControlPanel2.Controls.Add(this.panRORpts); - this.tabControlPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControlPanel2.Location = new System.Drawing.Point(0, 22); - this.tabControlPanel2.Name = "tabControlPanel2"; - this.tabControlPanel2.Padding = new System.Windows.Forms.Padding(1); - this.tabControlPanel2.Size = new System.Drawing.Size(261, 98); - this.tabControlPanel2.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))); - this.tabControlPanel2.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227))))); - this.tabControlPanel2.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.tabControlPanel2.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199))))); - this.tabControlPanel2.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right) - | DevComponents.DotNetBar.eBorderSide.Bottom))); - this.tabControlPanel2.Style.GradientAngle = 90; - this.tabControlPanel2.TabIndex = 2; - this.tabControlPanel2.TabItem = this.tabROReports; - // - // panRORpts - // - this.panRORpts.CanvasColor = System.Drawing.SystemColors.Control; - this.panRORpts.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.panRORpts.Controls.Add(this.cbxSortBySetpointID); - this.panRORpts.Controls.Add(this.cbxIncldMissingROs); - this.panRORpts.Controls.Add(this.cbxSummary); - this.panRORpts.Controls.Add(this.cbxROUsage); - this.panRORpts.Controls.Add(this.cbxComplete); - this.panRORpts.Controls.Add(this.labelX1); - this.panRORpts.Controls.Add(this.cmbxROUsageSort); - this.panRORpts.Dock = System.Windows.Forms.DockStyle.Top; - this.panRORpts.Location = new System.Drawing.Point(1, 1); - this.panRORpts.Name = "panRORpts"; - this.panRORpts.Size = new System.Drawing.Size(259, 97); - this.panRORpts.Style.Alignment = System.Drawing.StringAlignment.Center; - this.panRORpts.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.panRORpts.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.panRORpts.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.panRORpts.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.panRORpts.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.panRORpts.Style.GradientAngle = 90; - this.panRORpts.TabIndex = 10; - this.panRORpts.ThemeAware = true; - // - // cbxIncldMissingROs - // - // - // - // - this.cbxIncldMissingROs.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxIncldMissingROs.Location = new System.Drawing.Point(3, 68); - this.cbxIncldMissingROs.Name = "cbxIncldMissingROs"; - this.cbxIncldMissingROs.Size = new System.Drawing.Size(241, 23); - this.cbxIncldMissingROs.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.cbxIncldMissingROs.TabIndex = 10; - this.cbxIncldMissingROs.Text = "Include Missing ROs (a red ? in the editor)"; - // - // cbxSummary - // - this.cbxSummary.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxSummary.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxSummary.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton; - this.cbxSummary.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxSummary.Location = new System.Drawing.Point(151, 3); - this.cbxSummary.Name = "cbxSummary"; - this.cbxSummary.Size = new System.Drawing.Size(74, 23); - this.cbxSummary.TabIndex = 1; - this.cbxSummary.Text = "Summary"; - this.cbxSummary.CheckedChanged += new System.EventHandler(this.cbxSummary_CheckedChanged); - // - // cbxROUsage - // - this.cbxROUsage.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxROUsage.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxROUsage.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton; - this.cbxROUsage.Checked = true; - this.cbxROUsage.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbxROUsage.CheckValue = "Y"; - this.cbxROUsage.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxROUsage.Location = new System.Drawing.Point(7, 3); - this.cbxROUsage.Name = "cbxROUsage"; - this.cbxROUsage.Size = new System.Drawing.Size(60, 23); - this.cbxROUsage.TabIndex = 2; - this.cbxROUsage.Text = "Usage"; - this.cbxROUsage.CheckedChanged += new System.EventHandler(this.cbxROUsage_CheckedChanged); - // - // cbxComplete - // - this.cbxComplete.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxComplete.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxComplete.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton; - this.cbxComplete.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxComplete.Location = new System.Drawing.Point(66, 3); - this.cbxComplete.Name = "cbxComplete"; - this.cbxComplete.Size = new System.Drawing.Size(79, 23); - this.cbxComplete.TabIndex = 0; - this.cbxComplete.Text = "Complete"; - this.cbxComplete.CheckedChanged += new System.EventHandler(this.cbxComplete_CheckedChanged); - // - // labelX1 - // - // - // - // - this.labelX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.labelX1.Location = new System.Drawing.Point(7, 32); - this.labelX1.Name = "labelX1"; - this.labelX1.Size = new System.Drawing.Size(44, 23); - this.labelX1.TabIndex = 8; - this.labelX1.Text = "Sort By:"; - // - // cmbxROUsageSort - // - this.cmbxROUsageSort.DisplayMember = "Text"; - this.cmbxROUsageSort.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.cmbxROUsageSort.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cmbxROUsageSort.FormattingEnabled = true; - this.cmbxROUsageSort.ItemHeight = 14; - this.cmbxROUsageSort.Items.AddRange(new object[] { - this.cbiRO, - this.cbiProc}); - this.cmbxROUsageSort.Location = new System.Drawing.Point(57, 35); - this.cmbxROUsageSort.Name = "cmbxROUsageSort"; - this.cmbxROUsageSort.Size = new System.Drawing.Size(152, 20); - this.cmbxROUsageSort.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.cmbxROUsageSort.TabIndex = 9; - // - // cbiRO - // - this.cbiRO.Text = "Referenced Object"; - // - // cbiProc - // - this.cbiProc.Text = "Procedure"; - // - // tabROReports - // - this.tabROReports.AttachedControl = this.tabControlPanel2; - this.tabROReports.Name = "tabROReports"; - this.tabROReports.Text = "Referenced Objects"; - this.tabROReports.Click += new System.EventHandler(this.tabROReports_Click); - // - // advTreeRO - // - this.advTreeRO.AccessibleRole = System.Windows.Forms.AccessibleRole.Outline; - this.advTreeRO.AllowDrop = true; - this.advTreeRO.BackColor = System.Drawing.SystemColors.Window; - // - // - // - this.advTreeRO.BackgroundStyle.Class = "TreeBorderKey"; - this.advTreeRO.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.advTreeRO.CellStyleSelected = this.elementStyle2; - this.advTreeRO.Dock = System.Windows.Forms.DockStyle.Fill; - this.advTreeRO.DragDropEnabled = false; - this.advTreeRO.DragDropNodeCopyEnabled = false; - this.advTreeRO.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - this.advTreeRO.Location = new System.Drawing.Point(0, 26); - this.advTreeRO.MultiSelect = true; - this.advTreeRO.MultiSelectRule = DevComponents.AdvTree.eMultiSelectRule.AnyNode; - this.advTreeRO.Name = "advTreeRO"; - this.advTreeRO.Nodes.AddRange(new DevComponents.AdvTree.Node[] { - this.node2}); - this.advTreeRO.NodesConnector = this.nodeConnector2; - this.advTreeRO.NodeStyle = this.elementStyle2; - this.advTreeRO.NodeStyleSelected = this.elementStyle2; - this.advTreeRO.PathSeparator = ";"; - this.advTreeRO.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.advTreeRO.Size = new System.Drawing.Size(261, 303); - this.advTreeRO.Styles.Add(this.elementStyle2); - this.advTreeRO.TabIndex = 11; - this.advTreeRO.Text = "advTree1"; - this.advTreeRO.AfterCheck += new DevComponents.AdvTree.AdvTreeCellEventHandler(this.advTreeRO_AfterCheck); - // - // elementStyle2 - // - this.elementStyle2.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.elementStyle2.Name = "elementStyle2"; - this.elementStyle2.TextColor = System.Drawing.SystemColors.ControlText; - // - // node2 - // - this.node2.Expanded = true; - this.node2.Name = "node2"; - this.node2.Text = "node2"; - // - // nodeConnector2 - // - this.nodeConnector2.LineColor = System.Drawing.SystemColors.ControlText; - // - // xpSetToReport - // - this.xpSetToReport.CanvasColor = System.Drawing.SystemColors.Control; - this.xpSetToReport.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.xpSetToReport.Controls.Add(this.advTreeProcSets); - this.xpSetToReport.Dock = System.Windows.Forms.DockStyle.Top; - this.xpSetToReport.ExpandOnTitleClick = true; - this.xpSetToReport.Location = new System.Drawing.Point(0, 449); - this.xpSetToReport.Margin = new System.Windows.Forms.Padding(2); - this.xpSetToReport.Name = "xpSetToReport"; - this.xpSetToReport.Size = new System.Drawing.Size(261, 171); - this.xpSetToReport.Style.Alignment = System.Drawing.StringAlignment.Center; - this.xpSetToReport.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.xpSetToReport.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.xpSetToReport.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.xpSetToReport.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.xpSetToReport.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; - this.xpSetToReport.Style.GradientAngle = 90; - this.xpSetToReport.TabIndex = 8; - this.xpSetToReport.TitleHeight = 21; - this.xpSetToReport.TitleStyle.Alignment = System.Drawing.StringAlignment.Center; - this.xpSetToReport.TitleStyle.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.xpSetToReport.TitleStyle.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.xpSetToReport.TitleStyle.Border = DevComponents.DotNetBar.eBorderType.RaisedInner; - this.xpSetToReport.TitleStyle.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.xpSetToReport.TitleStyle.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.xpSetToReport.TitleStyle.GradientAngle = 90; - this.xpSetToReport.TitleText = "Select Procedure Set"; - // - // advTreeProcSets - // - this.advTreeProcSets.AccessibleRole = System.Windows.Forms.AccessibleRole.Outline; - this.advTreeProcSets.AllowDrop = true; - this.advTreeProcSets.BackColor = System.Drawing.SystemColors.Window; - // - // - // - this.advTreeProcSets.BackgroundStyle.Class = "TreeBorderKey"; - this.advTreeProcSets.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.advTreeProcSets.CellStyleSelected = this.elementStyle1; - this.advTreeProcSets.Dock = System.Windows.Forms.DockStyle.Fill; - this.advTreeProcSets.DragDropEnabled = false; - this.advTreeProcSets.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - this.advTreeProcSets.Location = new System.Drawing.Point(0, 21); - this.advTreeProcSets.Margin = new System.Windows.Forms.Padding(2); - this.advTreeProcSets.MultiSelect = true; - this.advTreeProcSets.MultiSelectRule = DevComponents.AdvTree.eMultiSelectRule.AnyNode; - this.advTreeProcSets.Name = "advTreeProcSets"; - this.advTreeProcSets.Nodes.AddRange(new DevComponents.AdvTree.Node[] { - this.node1}); - this.advTreeProcSets.NodesConnector = this.nodeConnector1; - this.advTreeProcSets.NodeStyle = this.elementStyle1; - this.advTreeProcSets.NodeStyleSelected = this.elementStyle1; - this.advTreeProcSets.PathSeparator = ";"; - this.advTreeProcSets.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.advTreeProcSets.Size = new System.Drawing.Size(261, 150); - this.advTreeProcSets.Styles.Add(this.elementStyle1); - this.advTreeProcSets.TabIndex = 0; - this.advTreeProcSets.Text = "advTree1"; - this.advTreeProcSets.AfterNodeSelect += new DevComponents.AdvTree.AdvTreeNodeEventHandler(this.advTreeProcSets_AfterNodeSelect); - this.advTreeProcSets.AfterCheck += new DevComponents.AdvTree.AdvTreeCellEventHandler(this.advTreeProcSets_AfterCheck); - // - // elementStyle1 - // - this.elementStyle1.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.elementStyle1.Name = "elementStyle1"; - this.elementStyle1.TextColor = System.Drawing.SystemColors.ControlText; - // - // node1 - // - this.node1.Name = "node1"; - this.node1.Text = "node1"; - // - // nodeConnector1 - // - this.nodeConnector1.LineColor = System.Drawing.SystemColors.ControlText; - // - // btnPrintReport - // - this.btnPrintReport.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnPrintReport.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnPrintReport.Dock = System.Windows.Forms.DockStyle.Top; - this.btnPrintReport.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnPrintReport.Location = new System.Drawing.Point(0, 620); - this.btnPrintReport.Name = "btnPrintReport"; - this.btnPrintReport.Size = new System.Drawing.Size(261, 35); - this.btnPrintReport.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnPrintReport.TabIndex = 9; - this.btnPrintReport.Text = "Create Report"; - this.btnPrintReport.Click += new System.EventHandler(this.btnPrintReport_Click); - // - // xpSelROs - // - this.xpSelROs.CanvasColor = System.Drawing.SystemColors.Control; - this.xpSelROs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.xpSelROs.Controls.Add(this.advTreeRO); - this.xpSelROs.Dock = System.Windows.Forms.DockStyle.Top; - this.xpSelROs.Location = new System.Drawing.Point(0, 120); - this.xpSelROs.Name = "xpSelROs"; - this.xpSelROs.Size = new System.Drawing.Size(261, 329); - this.xpSelROs.Style.Alignment = System.Drawing.StringAlignment.Center; - this.xpSelROs.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.xpSelROs.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.xpSelROs.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.xpSelROs.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.xpSelROs.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; - this.xpSelROs.Style.GradientAngle = 90; - this.xpSelROs.TabIndex = 10; - this.xpSelROs.TitleStyle.Alignment = System.Drawing.StringAlignment.Center; - this.xpSelROs.TitleStyle.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.xpSelROs.TitleStyle.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.xpSelROs.TitleStyle.Border = DevComponents.DotNetBar.eBorderType.RaisedInner; - this.xpSelROs.TitleStyle.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.xpSelROs.TitleStyle.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.xpSelROs.TitleStyle.GradientAngle = 90; - this.xpSelROs.TitleText = "Select Referenced Objects"; - // - // cbxSortBySetpointID - // - // - // - // - this.cbxSortBySetpointID.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxSortBySetpointID.Location = new System.Drawing.Point(3, 39); - this.cbxSortBySetpointID.Name = "cbxSortBySetpointID"; - this.cbxSortBySetpointID.Size = new System.Drawing.Size(121, 23); - this.cbxSortBySetpointID.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.cbxSortBySetpointID.TabIndex = 11; - this.cbxSortBySetpointID.Text = "Sort By Setpoint ID"; - this.cbxSortBySetpointID.Visible = false; - // - // DisplayReports - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.btnPrintReport); - this.Controls.Add(this.xpSelROs); - this.Controls.Add(this.xpSetToReport); - this.Controls.Add(this.tctrlReports); - this.Margin = new System.Windows.Forms.Padding(2); - this.Name = "DisplayReports"; - this.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - this.Size = new System.Drawing.Size(261, 676); - ((System.ComponentModel.ISupportInitialize)(this.tctrlReports)).EndInit(); - this.tctrlReports.ResumeLayout(false); - this.tabControlPanel1.ResumeLayout(false); - this.panelEx1.ResumeLayout(false); - this.tabControlPanel2.ResumeLayout(false); - this.panRORpts.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.advTreeRO)).EndInit(); - this.xpSetToReport.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.advTreeProcSets)).EndInit(); - this.xpSelROs.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private DevComponents.DotNetBar.TabControl tctrlReports; - private DevComponents.DotNetBar.TabControlPanel tabControlPanel1; - private DevComponents.DotNetBar.TabItem tabTransitionReports; - private DevComponents.DotNetBar.TabControlPanel tabControlPanel2; - private DevComponents.DotNetBar.TabItem tabROReports; - private DevComponents.DotNetBar.ExpandablePanel xpSetToReport; - private DevComponents.AdvTree.AdvTree advTreeProcSets; - private DevComponents.DotNetBar.ElementStyle elementStyle1; - private DevComponents.AdvTree.Node node1; - private DevComponents.AdvTree.NodeConnector nodeConnector1; - private DevComponents.DotNetBar.ButtonX btnPrintReport; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxROUsage; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxSummary; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxComplete; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxTransFromProcs; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxTransToProcs; - private DevComponents.DotNetBar.Controls.ComboBoxEx cmbxROUsageSort; - private DevComponents.Editors.ComboItem cbiProc; - private DevComponents.Editors.ComboItem cbiRO; - private DevComponents.DotNetBar.LabelX labelX1; - private DevComponents.DotNetBar.PanelEx panRORpts; - private DevComponents.AdvTree.AdvTree advTreeRO; - private DevComponents.AdvTree.Node node2; - private DevComponents.AdvTree.NodeConnector nodeConnector2; - private DevComponents.DotNetBar.ElementStyle elementStyle2; - private DevComponents.DotNetBar.ExpandablePanel xpSelROs; - private DevComponents.DotNetBar.PanelEx panelEx1; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxIncldMissingROs; - private System.Windows.Forms.ToolTip toolTip1; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxSortBySetpointID; - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayReports.cs b/PROMS/Volian.Controls.Library/DisplayReports.cs deleted file mode 100644 index a347edda..00000000 --- a/PROMS/Volian.Controls.Library/DisplayReports.cs +++ /dev/null @@ -1,1479 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using System.IO; -using VEPROMS.CSLA.Library; -using DevComponents.DotNetBar; -using DevComponents.AdvTree; -using System.Text.RegularExpressions; -using Volian.Base.Library; - - -namespace Volian.Controls.Library -{ - public partial class DisplayReports : UserControl - { - #region Public Events/Handlers - - public event DisplayReportsEvent PrintRequest; - - private void OnPrintRequest(DisplayReportsEventArgs args) - { - if (PrintRequest != null) - PrintRequest(this, args); - } - - #endregion - - #region Fields - - // B2022-026 RO Memeory reduction logic change - defined dummy node text variable to ensure consistancy - private const string DummyNodeText = "VLN_DUMMY_NODE"; - - private List lstCheckedDocVersions = new List(); - private List lstCheckedROs = new List(); - private List lstReportResults = new List(); - private List ROList = new List(); - private List lstROObj = new List(); - private int _MyRODbID; - - private DocVersionInfo _MyDocVersion; - private ROFSTLookup _MyROFSTLookup; - private ItemInfoList _ReportResult; - private Dictionary AccIDROIDdic = new Dictionary(); - static int blankKeyCnt = 0; - - #endregion - - #region Properties - - private string DocVersionList - { - get - { - // append list of document versions to search - if (lstCheckedDocVersions.Count > 0) - { - string strRtnStr = ""; - // get list of doc versions to search - foreach (DocVersionInfo dvi in lstCheckedDocVersions) - { - strRtnStr += string.Format(",{0}", dvi.VersionID.ToString()); - } - return strRtnStr.Substring(1); - } - return ""; - } - } - - public DocVersionInfo Mydocversion - { - get { return _MyDocVersion; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - - _MyDocVersion = value; - if (_MyDocVersion != null) - { - if (_MyDocVersion.DocVersionAssociationCount > 0) - { - // if the count variable is not consistent with the actual list count, - // do a refresh. There was a bug, B2012-040, that was not reproducable.. - // so this is an attempt to fix it. - if (_MyDocVersion.DocVersionAssociations.Count == 0) - { - _MyDocVersion.RefreshDocVersionAssociations(); - if (_MyDocVersion.DocVersionAssociations.Count == 0) return; - } - - MyROFSTLookup = _MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(_MyDocVersion); - _MyRODbID = _MyDocVersion.DocVersionAssociations[0].MyROFst.RODbID; - } - } - } - } - - public ROFSTLookup MyROFSTLookup - { - get { return _MyROFSTLookup; } - set - { - 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 - advTreeROFillIn(true); - //LoadROComboTree(); - } - } - - public ItemInfoList ReportResult - { - get { return _ReportResult; } - set - { - _ReportResult = value; - } - } - - #endregion - - #region Constructors - - public DisplayReports() - { - InitializeComponent(); - EnableOrDisablePrintButton(); - - cmbxROUsageSort.SelectedIndex = 0; - tabTransitionReports.Visible = false; - cbxComplete.Enabled = true; - cbxSummary.Enabled = true; - - if (cbxROUsage.Checked) - cbxIncldMissingROs.Text = "Include Missing ROs (red ? in the editor)"; - else if (cbxComplete.Checked) - cbxIncldMissingROs.Text = "Include Empty RO Fields"; - - cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked; - cbxIncldMissingROs.Visible = cbxROUsage.Checked || cbxComplete.Checked; - cbxSortBySetpointID.Checked = false; - cbxSortBySetpointID.Visible = cbxComplete.Checked || cbxSummary.Checked; - } - - #endregion - - #region Public Methods - - public void SelectReferencedObjectTab() - { - tabROReports.PerformClick(); - } - - public void advTreeROFillIn(bool blSeachTabClicked) - { - DevComponents.AdvTree.Node topnode = null; - advTreeRO.Nodes.Clear(); - - if (_MyROFSTLookup == null) return; - - advTreeRO.BeforeExpand -= new AdvTreeNodeCancelEventHandler(advTreeRO_BeforeExpand); - advTreeRO.BeforeExpand += new AdvTreeNodeCancelEventHandler(advTreeRO_BeforeExpand); - advTreeRO.AfterExpand -= new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse); - advTreeRO.AfterExpand += new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse); - advTreeRO.AfterCollapse -= new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse); - advTreeRO.AfterCollapse += new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse); - - topnode = new DevComponents.AdvTree.Node(); - topnode.Text = "All Referenced Objects"; - topnode.Tag = null; - topnode.CheckBoxVisible = true; - - advTreeRO.Nodes.Add(topnode); - - ROFSTLookup.rodbi[] dbs = _MyROFSTLookup.GetRODatabaseList(true); - - if (dbs != null && dbs.Length > 0) - { - for (int i = 0; i < dbs.Length; i++) - { - DevComponents.AdvTree.Node tn = new DevComponents.AdvTree.Node(); - ROFSTLookup.rodbi db = dbs[i]; - - tn.Text = db.dbiTitle; - tn.Tag = db; - tn.CheckBoxVisible = true; - topnode.Nodes.Add(tn); - - AddDummyGroup(db, tn); - } - } - } - - public void advTreeProcSetsFillIn(bool blSeachTabClicked) - { - DevComponents.AdvTree.Node topnode = null; - int cntnd = 0; - VETreeNode vtn = VETreeNode.GetFolder(1); - FolderInfo fi = vtn.VEObject as FolderInfo; - int fiCount = fi.ChildFolderCount; - advTreeProcSets.Nodes.Clear(); - lstCheckedDocVersions.Clear(); - topnode = new DevComponents.AdvTree.Node(); - topnode.Text = "Available Procedure Sets"; - topnode.Tag = fi; - advTreeProcSets.Nodes.Add(topnode); - //advTreeProcSets.AfterNodeInsert += new TreeNodeCollectionEventHandler(advTreeProcSets_AfterNodeInsert); - - - foreach (FolderInfo fic in fi.SortedChildFolders) - { - DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node(); - newnode.Text = fic.ToString(); - newnode.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++; - if (fic.ChildFolderCount > 0 || fic.FolderDocVersionCount > 0) // allow for '+' for tree expansion - { - DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node(); - tnt.Text = DummyNodeText; - newnode.Nodes.Add(tnt); - topnode.Nodes.Add(newnode); - } - } - - // if nothing was added to the tree, just put in the node above the docversions... - if (advTreeProcSets.Nodes.Count == 0) - { - cntnd++; - fi = Mydocversion.MyFolder; - topnode = new DevComponents.AdvTree.Node(); - topnode.Text = fi.ToString(); - advTreeProcSets.Nodes.Add(topnode); - topnode.Tag = fi; - } - - advTreeProcSets.BeforeExpand -= new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(advTreeProcSets_BeforeExpand); - advTreeProcSets.BeforeExpand += new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(advTreeProcSets_BeforeExpand); - - // position to the procedure set in the tree if we have a procedure open - if (Mydocversion != null) - advTreeProcSetsPreSelect(); - else - 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 - - #region Private Methods - - private void GenerateAccIDSortedROList() - { - //Dictionary AccIDROIDdic = new Dictionary(); - List AccPgIDsList = new List(); - AccIDROIDdic.Clear(); - - string rtnStr = ""; - ROFSTLookup.rochild[] chld = null; - ROFSTLookup.rochild ch; - ROList.Clear(); - - foreach (object rolkup in lstCheckedROs) - { - if (rolkup == null) // All Referenced Objects selected, return list of RO databases - { - foreach (ROFSTLookup.rodbi rodbi in _MyROFSTLookup.GetRODatabaseList(true)) - { - rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", rodbi.dbiID.ToString("X4")); - - if (rodbi.children != null) - { - foreach (ROFSTLookup.rochild roc in rodbi.children) - { - PutROChildrenInDictionary(_MyRODbID.ToString() + ":", roc); - } - } - else - { - ROList.Add(rtnStr); - } - } - - continue; - } - else if (rolkup is ROFSTLookup.rodbi) - { - ROFSTLookup.rodbi rodbi = (ROFSTLookup.rodbi)rolkup; - - //Try to lazy load the children - B2022-026 RO Memory Reduction code - if (rodbi.children == null || rodbi.children.Length <= 0) - rodbi.children = MyROFSTLookup.GetRoChildrenByID(rodbi.ID, rodbi.dbiID, true); - - if (rodbi.children != null) - { - foreach (ROFSTLookup.rochild roc in rodbi.children) - { - PutROChildrenInDictionary(_MyRODbID.ToString() + ":", roc); - } - } - else - { - ROList.Add(_MyRODbID.ToString() + ":" + string.Format("{0}", rodbi.dbiID.ToString("X4"))); - } - } - else if (rolkup is ROFSTLookup.rochild) - { - ch = (ROFSTLookup.rochild)rolkup; - chld = ch.children; - - //Try to lazy load the children - B2022-026 RO Memory Reduction code - if (ch.children == null || ch.children.Length <= 0) - ch.children = MyROFSTLookup.GetRoChildrenByRoid(ch.roid, true); - - PutROChildrenInDictionary(_MyRODbID.ToString() + ":", rolkup); - } - } - - foreach (string k in AccIDROIDdic.Keys) - { - AccPgIDsList.Add(k); - } - - string[] AccPgIdListArray = AccPgIDsList.ToArray(); - Array.Sort(AccPgIdListArray, new AlphanumComparatorFast()); - - foreach (string accid in AccPgIdListArray) - { - ROList.Add(AccIDROIDdic[accid]); - } - } - - private string GetNextBlankKey() - { - return string.Format(" _{0}", blankKeyCnt++); - } - - private void PutROChildrenInDictionary(string rodbidPrefix, object roObj) - { - ROFSTLookup.rochild chld = (ROFSTLookup.rochild)roObj; - string rtnstr = rodbidPrefix;// ""; - string keystr = ((chld.appid == "") ? GetNextBlankKey() : chld.appid) + chld.roid.Substring(0,4); - - //Try to lazy load the children - B2022-026 RO Memory Reduction - if (chld.children == null || chld.children.Length <= 0) - chld.children = MyROFSTLookup.GetRoChildrenByRoid(chld.roid, true); - - // 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 - { - rtnstr = rodbidPrefix + string.Format("{0}", chld.roid); - if (rtnstr.Length == 12) rtnstr += "0000"; // last four digits are used for multiple return values - // B2023-094: Don't crash when trying to add another ro if it has same key. Note that this is coming in as an RO but is really a group. - if (!AccIDROIDdic.ContainsKey(keystr))AccIDROIDdic.Add(keystr, rtnstr); - } - else if (!cbxROUsage.Checked && chld.children[0].ParentID == 0) - { - rtnstr = rodbidPrefix + string.Format("{0},", chld.roid); // doing a RO Summary or RO Complete report - don't want children that are multiple return values - AccIDROIDdic.Add(keystr, rtnstr); - } - else - { - // spin through the child list and get the ROIDs. - // if the child has children, then call this function recursively - for (int i = 0; i < chld.children.Length; i++) - { - ROFSTLookup.rochild roc = chld.children[i]; - - //Try to lazy load the children - B2022-026 RO Memory Reduction code - if (roc.children == null || roc.children.Length <= 0) - roc.children = MyROFSTLookup.GetRoChildrenByRoid(roc.roid, true); - - // Don't get the children if we are doing a RO Summary or RO Complete report & children are the multiple return values - if (roc.children != null && roc.children.Length > 0 && (cbxROUsage.Checked || roc.children[0].ParentID != 0)) - { - PutROChildrenInDictionary(rodbidPrefix, roc); - } - else if (roc.appid != null && roc.appid != "") - { - rtnstr = rodbidPrefix + string.Format("{0}", roc.roid); - keystr = ((roc.appid == "") ? GetNextBlankKey() : roc.appid) + chld.roid.Substring(0, 4); - - if (AccIDROIDdic.ContainsKey(keystr)) // For duplicates, append the parent title (B2017-011) so adding to dictionary doesn't crash. - { - keystr = keystr + "|" + chld.title; - } - - AccIDROIDdic.Add(keystr, rtnstr); - } - } - - } - } - - private void GenerateROList() - { - string rtnStr = ""; - ROFSTLookup.rochild[] chld = null; - ROFSTLookup.rochild ch; - ROList.Clear(); - - foreach (object rolkup in lstCheckedROs) - { - if (rolkup == null) // All Referenced Objects selected, return list of RO databases - { - // B2022-026 RO Memory Reduction code - added flag to load all children - foreach (ROFSTLookup.rodbi rodbi in _MyROFSTLookup.GetRODatabaseList(true)) - { - rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", rodbi.dbiID.ToString("X4")); - ROList.Add(rtnStr); - } - continue; - } - else if (rolkup is ROFSTLookup.rodbi) - { - rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", ((ROFSTLookup.rodbi)rolkup).dbiID.ToString("X4")); - } - else if (rolkup is ROFSTLookup.rochild) - { - ch = (ROFSTLookup.rochild)rolkup; - - //Try to lazy load the children - B2022-026 RO Memory Reduction code - if (ch.children == null || ch.children.Length <= 0) - ch.children = MyROFSTLookup.GetRoChildrenByRoid(ch.roid, true); - - chld = ch.children; - - rtnStr = _MyRODbID.ToString() + ":" + GetROChildren(rolkup).TrimEnd(','); // GetROChildren(rolkup).TrimEnd(',') grabs the children of the selected item - } - - ROList.Add(rtnStr); - } - } - - // same function as GetROsToSearch in DisplaySearch.cs - private string GetROChildren(object roObj) - { - ROFSTLookup.rochild chld = (ROFSTLookup.rochild)roObj; - string rtnstr = ""; - - //Try to lazy load the children - B2022-026 RO Memory Reduction code - if (chld.children == null || chld.children.Length <= 0) - chld.children = MyROFSTLookup.GetRoChildrenByRoid(chld.roid, true); - - // If still no children - if (chld.children == null || chld.children.Length <= 0) // get a single ROID - { - rtnstr += string.Format("{0}", chld.roid); - if (rtnstr.Length == 12) rtnstr += "0000"; // last four digits are used for multiple return values - } - else if (!cbxROUsage.Checked && chld.children[0].ParentID == 0) - { - rtnstr += string.Format("{0},", chld.roid); // doing a RO Summary or RO Complete report - don't want children that are multiple return values - } - else - { // spin through the child list and get the ROIDs. - // if the child has children, then call this function recursivly - foreach (ROFSTLookup.rochild roc in chld.children) - { - // Don't get the children if we are doing a RO Summary or RO Complete report & children are the multiple return values - // B2022-062: Proms crashes on Complete or Summary RO report without 'Sort by SetpointID'. With new ROfst logic, - // need to check for children length > 0 also. - if (roc.children != null && roc.children.Length > 0 && (cbxROUsage.Checked || roc.children[0].ParentID != 0)) - rtnstr += GetROChildren(roc); - else - rtnstr += string.Format("{0},", roc.roid); - } - } - return rtnstr; - } - - private string GetListOfROs(bool keepRODbID) - { - string rtnStr = ""; - string strRODbID = ""; - int cnt = 0; - foreach (string rostr in ROList) - { - int ndxOf = rostr.IndexOf(":"); - if (ndxOf > 0) - { - string tstr = rostr.Substring(0, ndxOf + 1); - if (tstr != strRODbID && keepRODbID) - { - strRODbID = tstr; - rtnStr += rostr; - } - else - rtnStr += rostr.Substring(ndxOf + 1); - } - else - rtnStr += rostr; - if (rtnStr.EndsWith(",")) rtnStr = rtnStr.Substring(0, rtnStr.Length - 1); - if (++cnt < ROList.Count) - rtnStr += ","; - } - return rtnStr; - } - - private void AddSelectedROChildren(DevComponents.AdvTree.NodeCollection chldrn) - { - if (chldrn.Count > 0) - { - foreach (DevComponents.AdvTree.Node n in chldrn) - { - if (n.Checked) - lstCheckedROs.Add(n.Tag); - else - AddSelectedROChildren(n.Nodes); - } - } - } - - private void BuildCheckedROsList() - { - lstCheckedROs.Clear(); - if (advTreeRO.Nodes.Count == 0) return; - - DevComponents.AdvTree.Node node = advTreeRO.Nodes[0]; - if (node.Checked) // top node (all Referenced Objects) selected - lstCheckedROs.Add(node.Tag); - else - AddSelectedROChildren(node.Nodes); - } - - private void EnableOrDisablePrintButton() - { - switch (tctrlReports.SelectedTabIndex) - { - case 0: // Transition Reports - btnPrintReport.Enabled = (lstCheckedDocVersions.Count > 0); - break; - - case 1: // Referenced Objects Reports - BuildCheckedROsList(); // this list is sent to the report generator - if (cbxROUsage.Checked) - btnPrintReport.Enabled = (lstCheckedDocVersions.Count > 0 && lstCheckedROs.Count > 0); - else - btnPrintReport.Enabled = ((cbxComplete.Checked || cbxSummary.Checked) && lstCheckedROs.Count > 0); - break; - } - - if (cbxROUsage.Checked) - cbxIncldMissingROs.Text = "Include Missing ROs (red ? in the editor)"; - else if (cbxComplete.Checked) - cbxIncldMissingROs.Text = "Include Empty RO Fields"; - - //cbxIncldMissingROs.Checked = cbxROUsage.Checked || cbxComplete.Checked; - cbxIncldMissingROs.Visible = cbxROUsage.Checked || cbxComplete.Checked; - cbxSortBySetpointID.Visible = cbxComplete.Checked || cbxSummary.Checked; - labelX1.Visible = cmbxROUsageSort.Visible = !cbxSortBySetpointID.Visible; - } - - private void tabTransitionReports_Click(object sender, EventArgs e) - { - xpSetToReport.Enabled = true; - xpSetToReport.Expanded = true; - xpSelROs.Expanded = false; - xpSelROs.Enabled = false; - - EnableOrDisablePrintButton(); - } - - private void tabROReports_Click(object sender, EventArgs e) - { - xpSetToReport.Enabled = cbxROUsage.Checked; - xpSetToReport.Expanded = cbxROUsage.Checked; - labelX1.Visible = cmbxROUsageSort.Visible = cbxROUsage.Checked; - xpSelROs.Enabled = true; - xpSelROs.Expanded = true; - cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked; - cbxSortBySetpointID.Checked = false; - cbxSortBySetpointID.Visible = !cbxROUsage.Checked; - - EnableOrDisablePrintButton(); - } - - private void cbxROUsage_CheckedChanged(object sender, EventArgs e) - { - xpSetToReport.Enabled = cbxROUsage.Checked; - xpSetToReport.Expanded = cbxROUsage.Checked; - labelX1.Visible = cmbxROUsageSort.Visible = cbxROUsage.Checked; - - // reset the RO tree and clear anything that was selected - advTreeROFillIn(true); - lstCheckedROs.Clear(); - - cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked; - cbxSortBySetpointID.Checked = false; - cbxSortBySetpointID.Visible = !cbxROUsage.Checked; - - EnableOrDisablePrintButton(); - } - - private void DisplayReports_Load(object sender, EventArgs e) - { - tabTransitionReports.PerformClick(); - } - - // when a node is checked (selected) then uncheck any of its children - private void UncheckChildren(DevComponents.AdvTree.NodeCollection chldrn) - { - if (chldrn.Count > 0) - { - foreach (DevComponents.AdvTree.Node n in chldrn) - { - if (n.Checked) - n.Checked = false; - else - UncheckChildren(n.Nodes); - } - } - } - - // when a node is checked (selected), uncheck the parents, grand parents, great grand parents, etc. - private void UncheckParents(DevComponents.AdvTree.Node pNode) - { - while (pNode != null) - { - if (pNode.Checked) pNode.Checked = false; - pNode = pNode.Parent; - } - } - - private void advTreeRO_AfterCheck(object sender, AdvTreeCellEventArgs e) - { - DevComponents.AdvTree.Node n = advTreeRO.SelectedNode; - - if (n.Checked) - { - UncheckChildren(n.Nodes); - UncheckParents(n.Parent); - } - - EnableOrDisablePrintButton(); - } - - private void cbxTransToProcs_CheckedChanged(object sender, EventArgs e) - { - EnableOrDisablePrintButton(); - } - - private void cbxTransFromProcs_CheckedChanged(object sender, EventArgs e) - { - EnableOrDisablePrintButton(); - } - - private void cbxComplete_CheckedChanged(object sender, EventArgs e) - { - cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked; - cbxSortBySetpointID.Checked = false; - EnableOrDisablePrintButton(); - } - - private void cbxSummary_CheckedChanged(object sender, EventArgs e) - { - EnableOrDisablePrintButton(); - } - - private string BuildRODataFile(string ROList) - { - DocVersionInfo MyDVI = Mydocversion; - string roDataFile = "PRINT.TMP"; - - if (VlnSettings.ReleaseMode.Equals("DEMO")) - { - MessageBox.Show("Referenced Object Reports not available in the Demo version.", "PROMS Demo Version"); - return ""; - } - - //string roapp = Environment.GetEnvironmentVariable("roapp"); - string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable - if (roapp == null) - { - MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable"); - return ""; - } - - if (MyDVI == null || MyDVI.DocVersionAssociationCount < 1) - { - MessageBox.Show("Could not find associated path for ro data.", "No RO Data", MessageBoxButtons.OK, MessageBoxIcon.Information); - return ""; - } - - //string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" " + "\"" + ROList + "\""; - 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)); - return ""; - } - - string cmpRptExePath = roapp.Substring(0, roapp.LastIndexOf("\\")) + "\\CmpRpt.exe "; - roDataFile = MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\\" + roDataFile; - - try - { - if (File.Exists(roDataFile)) File.Delete(roDataFile); - Application.DoEvents(); - - string fname = VlnSettings.TemporaryFolder + "\\ROCompleteRprt.txt"; - FileInfo fi = new FileInfo(fname); - using (StreamWriter sw = fi.CreateText()) - { - sw.Write(ROList); - sw.Close(); - } - - string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" \"/f=" + fname + "\""; - // 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 + "\""; - - // C2021-026 pass in Parent/Child information (list of the children) - // B2022-019 look at all DocVersions to find ParentChild information - // to ensure we pass in Parent/Child even when not coming from a Parent/Child procedure set - DocVersionInfoList dvil = DocVersionInfoList.Get(); - foreach (DocVersionInfo dvi in dvil) - { - DocVersionConfig dvc = dvi.DocVersionConfig as 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 - roloc += " \"/PC=" + dvc.Unit_Name + "\""; - break; - } - - System.Diagnostics.Process p = System.Diagnostics.Process.Start(cmpRptExePath, roloc); - // need to wait, sometimes the Print.tmp file that is generated is not available - p.WaitForExit(); // without arguments, this will wait indefinitely - Application.DoEvents(); - } - catch (Exception ex) - { - while (ex.InnerException != null) - ex = ex.InnerException; - string tmpmsg = ex.Message; - MessageBox.Show(tmpmsg, "RO Report Error: " + ex.GetType().Name); - } - return roDataFile; - } - - private void btnPrintReport_Click(object sender, EventArgs e) - { - string paperSize = "Letter"; - - if (Mydocversion != null && Mydocversion.ActiveFormat != null) - paperSize = Mydocversion.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files - - //B2019-144 Set the document text color to Red (overlay) or Black (normal) - Color lastColor = MSWordToPDF.OverrideColor;// B2019-144 Remember override color - if (MSWordToPDF.OverrideColor != Color.Black) - MSWordToPDF.OverrideColor = Color.Black; - - Cursor curcur = Cursor; - Cursor = Cursors.WaitCursor; - - if (cbxSummary.Checked) // RO Summary Report - { - if (cbxSortBySetpointID.Checked) - GenerateAccIDSortedROList(); - else - GenerateROList(); - - OnPrintRequest(new DisplayReportsEventArgs("RO Summary Report", "RO Summary Report", MyROFSTLookup, ROList, paperSize)); - } - else if (cbxComplete.Checked) // Complete RO Report - { - if (cbxSortBySetpointID.Checked) - GenerateAccIDSortedROList(); - else - GenerateROList(); - - string ROList = GetListOfROs(false);//don't include the RODbID in the RO list - string roDataFile = BuildRODataFile(ROList); - - // B2023-028: RO report generates report with error when RO path not set. Return if datafile is not set - // by BuildRODataFile - if (roDataFile == null || roDataFile == "") - { - Cursor = curcur; // B2023-094: restore cursor (was wait). Not part of bug, found during fix - return; - } - - if (Mydocversion != null) - OnPrintRequest(new DisplayReportsEventArgs("Complete RO Report", "Complete RO Report", roDataFile, MyROFSTLookup, cbxComplete.Checked, Mydocversion.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, cbxIncldMissingROs.Checked, paperSize)); - } - else if (cbxROUsage.Checked) - { - bool usageSortedByProcedure = (cmbxROUsageSort.SelectedIndex == 1); - GenerateROList(); - string SearchString = GetListOfROs(true);// Include the RODbID in the RO list - ItemInfoList SearchResults = ItemInfoList.GetListFromROReport(DocVersionList, "", SearchString, ""); - - List sortedResults = SearchResults.SortedList(!usageSortedByProcedure); - OnPrintRequest(new DisplayReportsEventArgs("Referenced Objects Usage By RO", "RO Usage", sortedResults, usageSortedByProcedure, cbxIncldMissingROs.Checked, paperSize)); - } - else if (cbxTransFromProcs.Checked) - { - } - else if (cbxTransToProcs.Checked) - { - } - - Cursor = curcur; - //B2019-144 Set the document text color to Red (overlay) or Black (normal) - if (MSWordToPDF.OverrideColor != lastColor)// B2019-144 Restore override color - MSWordToPDF.OverrideColor = lastColor; - } - - #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) - { - DevComponents.AdvTree.Node par = e.Node; - // get first child's text, if it has one & if the text is "VLN_DUMMY_NODE", load children - DevComponents.AdvTree.Node tn = null; - if (par.Nodes.Count > 0) tn = par.Nodes[0]; - if (tn.Text == DummyNodeText) // expand this - { - par.Nodes.Clear(); - Object obj = par.Tag; - if (!(obj is FolderInfo)) return; // should always be folderinfo on expand - FolderInfo fi = (FolderInfo)obj; - if (fi.ChildFolderCount > 0) - { - foreach (FolderInfo fic in fi.SortedChildFolders) - { - DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node(); - newnode.Text = fic.ToString(); - newnode.Tag = fic; - par.Nodes.Add(newnode); - if (fic.HasChildren) // allow for '+' for tree expansion - { - DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node(); - tnt.Text = DummyNodeText; - newnode.Nodes.Add(tnt); - } - } - } - else if (fi.FolderDocVersionCount > 0) - { - foreach (DocVersionInfo dv in fi.FolderDocVersions) - { - DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node(); - newnode.Text = dv.ToString(); - newnode.Tag = dv; - newnode.Selectable = true; - newnode.CheckBoxAlignment = DevComponents.AdvTree.eCellPartAlignment.NearCenter; - newnode.CheckBoxStyle = eCheckBoxStyle.CheckBox; - newnode.CheckBoxThreeState = false; - newnode.CheckBoxVisible = true; - par.Nodes.Add(newnode); - } - } - } - } - - private void advTreeProcSets_AfterCheck(object sender, DevComponents.AdvTree.AdvTreeCellEventArgs e) - { - DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode; - if (n.Checked) - { - n.Style = DevComponents.AdvTree.NodeStyles.Apple; - lstCheckedDocVersions.Add((DocVersionInfo)n.Tag); - if (lstCheckedDocVersions.Count == 1)//Mydocversion == null) - { - Mydocversion = (DocVersionInfo)n.Tag; - } - } - else - { - n.Style = null; - lstCheckedDocVersions.Remove((DocVersionInfo)n.Tag); - if (lstCheckedDocVersions.Count == 1) - { - if (Mydocversion != lstCheckedDocVersions[0]) - { - Mydocversion = lstCheckedDocVersions[0]; - } - } - else - { - if (lstCheckedDocVersions.Count == 0) - 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(); - } - - private void advTreeProcSets_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e) - { - DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode; - } - - private void advTreeProcSetsPreSelect() - { - bool keeplooking = true; - //build a stack (bread crumb trail) of where is procedure set came from within the tree. - Stack crumbs = new Stack(); - - crumbs.Push(Mydocversion.Name); // ex: "working draft" - crumbs.Push(Mydocversion.MyFolder.Name); // ex: "Emergency Procedures" - FolderInfo fi = Mydocversion.MyFolder.MyParent; - while (fi != null) - { - if (fi.MyParent != null) - crumbs.Push(fi.Name); - fi = fi.MyParent; - } - crumbs.Push(advTreeProcSets.Nodes[0].Text); //top node of my tree - - // now walk the tree, looking for the node names we saved in the stack. - NodeCollection monkeys = advTreeProcSets.Nodes; - while (keeplooking) - { - Node climber = LookInTree(monkeys, crumbs.Pop()); - keeplooking = (climber != null && crumbs.Count > 0); - if (keeplooking) - monkeys = climber.Nodes; - if (!keeplooking && climber != null) - { - climber.Checked = true; - } - } - } - - private Node LookInTree(NodeCollection monkeys, string bananna) - { - Node foundit = null; - foreach (Node chimp in monkeys) - { - if (chimp.Text.Equals(bananna)) - { - foundit = chimp; - // need to select the node (cell) for it to be checked - chimp.SelectedCell = chimp.Cells[0]; - if (chimp.Nodes.Count > 0) - chimp.Expand(); - break; - } - chimp.Collapse(); - } - return foundit; - } - - #endregion - - #region (RO Tree) - - private void AddDummyGroup(ROFSTLookup.rodbi rodbi, DevComponents.AdvTree.Node tn) - { - if (rodbi.children != null && rodbi.children.Length > 0) - { - DevComponents.AdvTree.Node tmp = new DevComponents.AdvTree.Node(); - tmp.Text = DummyNodeText; - tn.Nodes.Add(tmp); - } - } - - private void advTreeRO_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e) - { - LoadChildren(e.Node); - } - - private void LoadChildren(DevComponents.AdvTree.Node tn) - { - //Check if node has already been loaded - if (tn.HasChildNodes && tn.Nodes[0].Text != DummyNodeText) return; // already loaded. - if (tn.HasChildNodes && tn.Nodes[0].Text == DummyNodeText) tn.Nodes[0].Remove(); - - object tag = tn.Tag; - ROFSTLookup.rochild[] chld = null; - - 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 - if (db.children == null || db.children.Length <= 0) - db.children = MyROFSTLookup.GetRoChildrenByID(db.ID, db.dbiID, true); - - chld = db.children; - } - else if (tn.Tag is ROFSTLookup.rochild) - { - ROFSTLookup.rochild ch = (ROFSTLookup.rochild)tn.Tag; - - //Try to lazy load the children - B2022-026 RO Memory Reduction code - if (ch.children == null || ch.children.Length <= 0) - ch.children = MyROFSTLookup.GetRoChildrenByRoid(ch.roid, true); - - chld = ch.children; - } - else - { - Console.WriteLine("error - no type"); - return; - } - - // if children, add dummy node - // B2022-026 RO Memory Reduction code - check child length - if (chld != null && chld.Length > 0) - { - //ProgressBar_Initialize(chld.Length, tn.Text); - 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 - if (chld[i].children == null || chld[i].children.Length <= 0) - chld[i].children = MyROFSTLookup.GetRoChildrenByRoid(chld[i].roid, true); - - // if this is a group, i.e. type 0, add a dummy node - if (chld[i].type == 0 && chld[i].children == null) - { - // Ignore: Junk Scenario - continue; - } - // 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))) - { - tmp = new DevComponents.AdvTree.Node(); - tmp.Text = chld[i].title; - tmp.Tag = chld[i]; - tmp.CheckBoxVisible = true; - int index = FindIndex(tn.Nodes, tmp.Text); - tn.Nodes.Insert(index, tmp); - DevComponents.AdvTree.Node sub = new DevComponents.AdvTree.Node(); - sub.Text = DummyNodeText; - tmp.Nodes.Add(sub); - } - else - { - tmp = new DevComponents.AdvTree.Node(); - tmp.Text = chld[i].title; - tmp.Tag = chld[i]; - tmp.CheckBoxVisible = true; - int index = FindIndex(tn.Nodes, tmp.Text); - tn.Nodes.Insert(index, tmp); - } - } - } - } - - private void advTreeRO_AfterExpandorCollapse(object sender, AdvTreeNodeEventArgs e) - { - Node bottomNode = BottomTreeNode(advTreeRO.Nodes); - Node lastNode = advTreeRO.Nodes[advTreeRO.Nodes.Count - 1]; - - int top = advTreeRO.Nodes[0].Bounds.Top; - int bottom = bottomNode.Bounds.Bottom + 5; - int hScrollBarHeight = advTreeRO.HScrollBar != null ? advTreeRO.HScrollBar.Height : 0; - bottom = bottomNode.Bounds.Bottom + 5; - advTreeRO.Size = new Size(advTreeRO.Size.Width, Math.Min(525, bottom - top + hScrollBarHeight)); - - if (advTreeRO.VScrollBar != null && bottom < advTreeRO.Size.Height) - { - int yLookFor = (bottom - advTreeRO.Size.Height) + 2 * hScrollBarHeight; - Node topNode = FindTreeNodeAt(advTreeRO.Nodes, yLookFor); - - if (topNode != null) - topNode.EnsureVisible(); - } - } - - private Node FindTreeNodeAt(NodeCollection nodes, int y) - { - foreach (Node node in nodes) - { - if (node.Bounds.Top <= y && node.Bounds.Bottom >= y) - return node; - - if (node.Bounds.Top > y) - { - if (node.PrevNode != null && node.PrevNode.Expanded) - return FindTreeNodeAt(node.PrevNode.Nodes, y); - - return node; - } - } - return null; - } - - private Node BottomTreeNode(NodeCollection nodes) - { - Node bottomNode = nodes[nodes.Count - 1]; // Return bottom node in collection - - if (bottomNode.Expanded) // If expanded return bottom child - return BottomTreeNode(bottomNode.Nodes); - - return bottomNode; - } - - private int FindIndex(NodeCollection nodes, string value) - { - int index = 0; - foreach (Node node in nodes) - { - if (GreaterValue(node.Text, value)) return index; - index++; - } - return index; - } - - private bool GreaterValue(string value1, string value2) - { - return DisplayRO.GreaterValue(value1, value2); - } - - #endregion - - #endregion - } - - #region DisplayReportsEventArgs Class - - public class DisplayReportsEventArgs - { - #region Fields - - private string _ReportTitle; - private string _TypesSelected; - private ICollection _MyItemInfoList; - private bool _SortUsageByProcedure; - private string _RODataFile = ""; - private bool _CompleteROReport = true; - private ROFSTLookup _rofstLookup; - private List _ROListForReport; - private bool _IncludeMissingROs = true; - private bool _ConvertCaretToDelta = true; - private bool _IncludeEmptyROFields = true; - private string _PaperSize = "Letter"; - - #endregion - - #region Properties - - public string ReportTitle - { - get { return _ReportTitle; } - set { _ReportTitle = value; } - } - - public string TypesSelected - { - get { return _TypesSelected; } - set { _TypesSelected = value; } - } - - public ICollection MyItemInfoList - { - get { return _MyItemInfoList; } - set { _MyItemInfoList = value; } - } - - public bool SortUsageByProcedure - { - get { return _SortUsageByProcedure; } - set { _SortUsageByProcedure = value; } - } - - public string RODataFile - { - get { return _RODataFile; } - set { _RODataFile = value; } - } - - public bool CompleteROReport - { - get { return _CompleteROReport; } - set { _CompleteROReport = value; } - } - - public ROFSTLookup RofstLookup - { - get { return _rofstLookup; } - set { _rofstLookup = value; } - } - - public List ROListForReport - { - get { return _ROListForReport; } - set { _ROListForReport = value; } - } - - public bool IncludeMissingROs - { - get { return _IncludeMissingROs; } - set { _IncludeMissingROs = value; } - } - - public bool ConvertCaretToDelta - { - get { return _ConvertCaretToDelta; } - set { _ConvertCaretToDelta = value; } - } - - public bool IncludeEmptyROFields - { - get { return _IncludeEmptyROFields; } - set { _IncludeEmptyROFields = value; } - } - - public string PaperSize // C2020-002 paper size is now set in the format files - { - get { return _PaperSize; } - set { _PaperSize = value; } - } - - #endregion - - #region Constructors - - /// - /// RO Usage Report - /// - /// - /// - /// - /// - /// - /// - public DisplayReportsEventArgs(string reportTitle, string typesSelected, ICollection myItemInfoList, bool sortByProcedure, bool includeMissingROs, string paperSize) - { - _ReportTitle = reportTitle; - _TypesSelected = typesSelected; - _MyItemInfoList = myItemInfoList; - _SortUsageByProcedure = sortByProcedure; - _IncludeMissingROs = includeMissingROs; - _PaperSize = paperSize; // C2020-002 paper size is now set in the format files - } - - /// - /// RO Complete - /// - /// - /// - /// - /// - /// - /// - /// - /// - public DisplayReportsEventArgs(string reportTitle, string typesSelected, string roDataFile, ROFSTLookup rofstLookUp, bool completeROReport, bool convertCaretToDelta, bool includeEmptyROFields, string paperSize) - { - _ReportTitle = reportTitle; - _TypesSelected = typesSelected; - _RODataFile = roDataFile; - _CompleteROReport = completeROReport; - _ConvertCaretToDelta = convertCaretToDelta; - _rofstLookup = rofstLookUp; - _IncludeEmptyROFields = includeEmptyROFields; - _PaperSize = paperSize; // C2020-002 paper size is now set in the format files - } - - /// - /// RO Summary Report - /// - /// - /// - /// - /// - /// - public DisplayReportsEventArgs(string reportTitle, string typesSelected, ROFSTLookup rofstLookUp, List roListForReport, string paperSize) - { - _ReportTitle = reportTitle; - _TypesSelected = typesSelected; - _rofstLookup = rofstLookUp; - _ROListForReport = roListForReport; - _PaperSize = paperSize; // C2020-002 paper size is now set in the format files - } - - #endregion - } - - #endregion - - public delegate void DisplayReportsEvent(object sender, DisplayReportsEventArgs args); - - #region AlphanumComparatorFast Class - - public class AlphanumComparatorFast : IComparer - { - #region Public Methods - - public List GetList(string s1) - { - List SB1 = new List(); - string st1, st2, st3; - st1 = ""; - bool flag = char.IsDigit(s1[0]); - - foreach (char c in s1) - { - if (flag != char.IsDigit(c) || !(char.IsDigit(c) || char.IsLetter(c)))// || c == '\'') - { - if (st1 != "") - SB1.Add(st1); - st1 = ""; - flag = char.IsDigit(c); - } - if (char.IsDigit(c)) - { - st1 += c; - } - if (char.IsLetter(c)) - { - st1 += c; - } - } - SB1.Add(st1); - return SB1; - } - - public int Compare(string x, string y) - { - string s1 = x;// as string; - if (s1 == null) - { - return 0; - } - string s2 = y;// as string; - if (s2 == null) - { - return 0; - } - if (s1 == s2) - { - return 0; - } - int len1 = s1.Length; - int len2 = s2.Length; - int marker1 = 0; - int marker2 = 0; - - // Walk through two the strings with two markers. - List str1 = GetList(s1); - List str2 = GetList(s2); - while (str1.Count != str2.Count) - { - if (str1.Count < str2.Count) - { - str1.Add(""); - } - else - { - str2.Add(""); - } - } - int x1 = 0; int res = 0; int x2 = 0; string y2 = ""; - bool status = false; - string y1 = ""; bool s1Status = false; bool s2Status = false; - //s1status ==false then string ele int; - //s2status ==false then string ele int; - int result = 0; - for (int i = 0; i < str1.Count && i < str2.Count; i++) - { - status = int.TryParse(str1[i].ToString(), out res); - if (res == 0) - { - y1 = str1[i].ToString(); - s1Status = false; - } - else - { - x1 = Convert.ToInt32(str1[i].ToString()); - s1Status = true; - } - - status = int.TryParse(str2[i].ToString(), out res); - if (res == 0) - { - y2 = str2[i].ToString(); - s2Status = false; - } - else - { - x2 = Convert.ToInt32(str2[i].ToString()); - s2Status = true; - } - //checking --the data comparision - if (!s2Status && !s1Status) //both are strings - { - result = str1[i].CompareTo(str2[i]); - } - else if (s2Status && s1Status) //both are intergers - { - if (x1 == x2) - { - if (str1[i].ToString().Length < str2[i].ToString().Length) - { - result = 1; - } - else if (str1[i].ToString().Length > str2[i].ToString().Length) - result = -1; - else - result = 0; - } - else - { - int st1ZeroCount = str1[i].ToString().Trim().Length - str1[i].ToString().TrimStart(new char[] { '0' }).Length; - int st2ZeroCount = str2[i].ToString().Trim().Length - str2[i].ToString().TrimStart(new char[] { '0' }).Length; - if (st1ZeroCount > st2ZeroCount) - result = -1; - else if (st1ZeroCount < st2ZeroCount) - result = 1; - else - result = x1.CompareTo(x2); - - } - } - else - { - result = str1[i].CompareTo(str2[i]); - } - if (result == 0) - { - continue; - } - else - break; - - } - return result; - } - - #endregion - } - - #endregion -} diff --git a/PROMS/Volian.Controls.Library/DisplayReports.resx b/PROMS/Volian.Controls.Library/DisplayReports.resx deleted file mode 100644 index 9454f3d7..00000000 --- a/PROMS/Volian.Controls.Library/DisplayReports.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.Designer.cs b/PROMS/Volian.Controls.Library/DisplaySearch.Designer.cs deleted file mode 100644 index 5c2552de..00000000 --- a/PROMS/Volian.Controls.Library/DisplaySearch.Designer.cs +++ /dev/null @@ -1,1892 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class DisplaySearch - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (cbxTextSearchText.Items.Count == 0) - Properties.Settings.Default["SearchList"] = null; - else - { - System.Collections.Specialized.StringCollection lst = new System.Collections.Specialized.StringCollection(); - foreach (string str in cbxTextSearchText.Items) - lst.Add(str); - Properties.Settings.Default.SearchList = lst; - } - if (cbxTextSearchAnnotation.Items.Count == 0) - Properties.Settings.Default["SearchAList"] = null; - else - { - System.Collections.Specialized.StringCollection lstA = new System.Collections.Specialized.StringCollection(); - foreach (string str in cbxTextSearchAnnotation.Items) - lstA.Add(str); - Properties.Settings.Default.SearchAList = lstA; - } - Properties.Settings.Default.Save(); - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DisplaySearch)); - this.tabSearchTypes = new DevComponents.DotNetBar.TabControl(); - this.tabControlPanel4 = new DevComponents.DotNetBar.TabControlPanel(); - this.gpSrchText = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.panel1 = new System.Windows.Forms.Panel(); - this.cbxTextSearchText = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.label1 = new System.Windows.Forms.Label(); - this.panel3 = new System.Windows.Forms.Panel(); - this.cbxByWord = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxBooleanTxtSrch = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxIncROTextSrch = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxProcSectSrch = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxCaseSensitive = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxRnoOnly = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.rbtnSrchTxt = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxSrchTypeUsage = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.tabStepTypeSearch = new DevComponents.DotNetBar.TabItem(this.components); - this.tabControlPanel5 = new DevComponents.DotNetBar.TabControlPanel(); - this.cbxRnoOnlyTrans = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.pnlTranCategory = new System.Windows.Forms.Panel(); - this.cbxTranCategory = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.lblTranCategory = new System.Windows.Forms.Label(); - this.pnlTranFormat = new System.Windows.Forms.Panel(); - this.cbxTranFormat = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.lblTranFormat = new System.Windows.Forms.Label(); - this.pnlTranVersion = new System.Windows.Forms.Panel(); - this.cbxTranVersion = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.lblTranVersion = new System.Windows.Forms.Label(); - this.tabTranSearch = new DevComponents.DotNetBar.TabItem(this.components); - this.tabControlPanel2 = new DevComponents.DotNetBar.TabControlPanel(); - this.gpFindROs = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.cbxRnoOnlyRO = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.lblSrchRoMsg = new DevComponents.DotNetBar.LabelX(); - this.cbxFndUnLnkROVals = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cmboTreeROs = new DevComponents.DotNetBar.Controls.ComboTree(); - this.tabROSearch = new DevComponents.DotNetBar.TabItem(this.components); - this.tabControlPanel3 = new DevComponents.DotNetBar.TabControlPanel(); - this.gpSrchAnnoText = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.panel4 = new System.Windows.Forms.Panel(); - this.cbxRnoOnlyAnnot = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxBooleanAnoTxtSrch = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxCaseSensitiveAnnoText = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxTextSearchAnnotation = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.label2 = new System.Windows.Forms.Label(); - this.cbxAnnoTypes = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.tabAnnotationSearch = new DevComponents.DotNetBar.TabItem(this.components); - this.tabControlPanel1 = new DevComponents.DotNetBar.TabControlPanel(); - this.btnTranCvtSelToTxt = new System.Windows.Forms.Button(); - this.lblIncTran = new System.Windows.Forms.Label(); - this.btnTranCvtAllToTxt = new System.Windows.Forms.Button(); - this.lblSrchIncTran = new System.Windows.Forms.Label(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.rbFromEditor = new System.Windows.Forms.RadioButton(); - this.rbFromTree = new System.Windows.Forms.RadioButton(); - this.tabIncTrans = new DevComponents.DotNetBar.TabItem(this.components); - this.contextMenuBar1 = new DevComponents.DotNetBar.ContextMenuBar(); - this.btnCMIFindText = new DevComponents.DotNetBar.ButtonItem(); - this.btnCMEdit = new DevComponents.DotNetBar.ButtonItem(); - this.cmFndTxtCut = new DevComponents.DotNetBar.ButtonItem(); - this.cmFndTxtCopy = new DevComponents.DotNetBar.ButtonItem(); - this.cmFndTxtPaste = new DevComponents.DotNetBar.ButtonItem(); - this.btnCMInsert = new DevComponents.DotNetBar.ButtonItem(); - this.cmFndTxtInsHardSp = new DevComponents.DotNetBar.ButtonItem(); - this.cmFndTxtInsSymbol = new DevComponents.DotNetBar.ButtonItem(); - this.galSymbols = new DevComponents.DotNetBar.GalleryContainer(); - this.buttonItem1 = new DevComponents.DotNetBar.ButtonItem(); - this.buttonItem2 = new DevComponents.DotNetBar.ButtonItem(); - this.buttonItem3 = new DevComponents.DotNetBar.ButtonItem(); - this.buttonItem4 = new DevComponents.DotNetBar.ButtonItem(); - this.btnBooleanItems = new DevComponents.DotNetBar.ButtonItem(); - this.btnAND = new DevComponents.DotNetBar.ButtonItem(); - this.btnOR = new DevComponents.DotNetBar.ButtonItem(); - this.btnNOT = new DevComponents.DotNetBar.ButtonItem(); - this.advTreeProcSets = new DevComponents.AdvTree.AdvTree(); - this.elementStyle1 = new DevComponents.DotNetBar.ElementStyle(); - this.node1 = new DevComponents.AdvTree.Node(); - this.nodeConnector1 = new DevComponents.AdvTree.NodeConnector(); - this.advTreeStepTypes = new DevComponents.AdvTree.AdvTree(); - this.elementStyle2 = new DevComponents.DotNetBar.ElementStyle(); - this.node2 = new DevComponents.AdvTree.Node(); - this.nodeConnector2 = new DevComponents.AdvTree.NodeConnector(); - this.grpPanSearchResults = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.lbSrchResults = new System.Windows.Forms.ListBox(); - this.lbSrchResultsIncTrans = new DevComponents.DotNetBar.ListBoxAdv(); - this.panSearchButtons = new DevComponents.DotNetBar.PanelEx(); - this.btnClearSearchResults = new DevComponents.DotNetBar.ButtonX(); - this.btnCopySearchResults = new DevComponents.DotNetBar.ButtonX(); - this.btnSaveSearchResults = new DevComponents.DotNetBar.ButtonX(); - this.btnLoadSearchResults = new DevComponents.DotNetBar.ButtonX(); - this.labelX1 = new DevComponents.DotNetBar.LabelX(); - this.cmbResultsStyle = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.comboItem1 = new DevComponents.Editors.ComboItem(); - this.comboItem2 = new DevComponents.Editors.ComboItem(); - this.comboItem3 = new DevComponents.Editors.ComboItem(); - this.comboItem4 = new DevComponents.Editors.ComboItem(); - this.cbSorted = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.btnSearch = new DevComponents.DotNetBar.ButtonX(); - this.btnPrnSrchRslts = new DevComponents.DotNetBar.ButtonX(); - this.sfdSearchResults = new System.Windows.Forms.SaveFileDialog(); - this.ofdSearchResults = new System.Windows.Forms.OpenFileDialog(); - this.xpSetToSearch = new DevComponents.DotNetBar.ExpandablePanel(); - this.xpStepTypes = new DevComponents.DotNetBar.ExpandablePanel(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip(); - this.checkedListBox1 = new System.Windows.Forms.CheckedListBox(); - ((System.ComponentModel.ISupportInitialize)(this.tabSearchTypes)).BeginInit(); - this.tabSearchTypes.SuspendLayout(); - this.tabControlPanel4.SuspendLayout(); - this.gpSrchText.SuspendLayout(); - this.panel1.SuspendLayout(); - this.panel3.SuspendLayout(); - this.tabControlPanel5.SuspendLayout(); - this.pnlTranCategory.SuspendLayout(); - this.pnlTranFormat.SuspendLayout(); - this.pnlTranVersion.SuspendLayout(); - this.tabControlPanel2.SuspendLayout(); - this.gpFindROs.SuspendLayout(); - this.tabControlPanel3.SuspendLayout(); - this.gpSrchAnnoText.SuspendLayout(); - this.panel4.SuspendLayout(); - this.tabControlPanel1.SuspendLayout(); - this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.contextMenuBar1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.advTreeProcSets)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.advTreeStepTypes)).BeginInit(); - this.grpPanSearchResults.SuspendLayout(); - this.panSearchButtons.SuspendLayout(); - this.xpSetToSearch.SuspendLayout(); - this.xpStepTypes.SuspendLayout(); - this.SuspendLayout(); - // - // tabSearchTypes - // - this.tabSearchTypes.CanReorderTabs = false; - this.tabSearchTypes.CloseButtonOnTabsAlwaysDisplayed = false; - this.tabSearchTypes.CloseButtonPosition = DevComponents.DotNetBar.eTabCloseButtonPosition.Right; - this.tabSearchTypes.Controls.Add(this.tabControlPanel4); - this.tabSearchTypes.Controls.Add(this.tabControlPanel5); - this.tabSearchTypes.Controls.Add(this.tabControlPanel2); - this.tabSearchTypes.Controls.Add(this.tabControlPanel3); - this.tabSearchTypes.Controls.Add(this.contextMenuBar1); - this.tabSearchTypes.Dock = System.Windows.Forms.DockStyle.Top; - this.tabSearchTypes.Location = new System.Drawing.Point(0, 0); - this.tabSearchTypes.Margin = new System.Windows.Forms.Padding(2); - this.tabSearchTypes.Name = "tabSearchTypes"; - this.tabSearchTypes.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.tabSearchTypes.SelectedTabFont = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold); - this.tabSearchTypes.SelectedTabIndex = 0; - this.tabSearchTypes.ShowFocusRectangle = false; - this.tabSearchTypes.Size = new System.Drawing.Size(277, 147); - this.tabSearchTypes.Style = DevComponents.DotNetBar.eTabStripStyle.Office2007Document; - this.tabSearchTypes.TabIndex = 0; - this.tabSearchTypes.TabLayoutType = DevComponents.DotNetBar.eTabLayoutType.FixedWithNavigationBox; - this.tabSearchTypes.Tabs.Add(this.tabStepTypeSearch); - this.tabSearchTypes.Tabs.Add(this.tabAnnotationSearch); - this.tabSearchTypes.Tabs.Add(this.tabROSearch); - this.tabSearchTypes.Tabs.Add(this.tabTranSearch); - this.tabSearchTypes.Tabs.Add(this.tabIncTrans); - this.tabSearchTypes.Text = "tabControl1"; - this.tabSearchTypes.ThemeAware = true; - // - // tabControlPanel4 - // - this.tabControlPanel4.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.tabControlPanel4.Controls.Add(this.gpSrchText); - this.tabControlPanel4.Controls.Add(this.rbtnSrchTxt); - this.tabControlPanel4.Controls.Add(this.cbxSrchTypeUsage); - this.tabControlPanel4.DisabledBackColor = System.Drawing.Color.Empty; - this.tabControlPanel4.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControlPanel4.Location = new System.Drawing.Point(0, 34); - this.tabControlPanel4.Margin = new System.Windows.Forms.Padding(2); - this.tabControlPanel4.Name = "tabControlPanel4"; - this.tabControlPanel4.Padding = new System.Windows.Forms.Padding(1); - this.tabControlPanel4.Size = new System.Drawing.Size(277, 113); - this.tabControlPanel4.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))); - this.tabControlPanel4.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227))))); - this.tabControlPanel4.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.tabControlPanel4.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199))))); - this.tabControlPanel4.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right) - | DevComponents.DotNetBar.eBorderSide.Bottom))); - this.tabControlPanel4.Style.GradientAngle = 90; - this.superTooltip1.SetSuperTooltip(this.tabControlPanel4, new DevComponents.DotNetBar.SuperTooltipInfo("Text Search", "", "Enter the text you want to search, or select from the drop down list.\r\n\r\nLeave bl" + - "ank to search for the usage of the selected types in \"Filter By Types\".", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(175, 140))); - this.tabControlPanel4.TabIndex = 4; - this.tabControlPanel4.TabItem = this.tabStepTypeSearch; - // - // gpSrchText - // - this.gpSrchText.CanvasColor = System.Drawing.SystemColors.Control; - this.gpSrchText.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.gpSrchText.Controls.Add(this.panel1); - this.gpSrchText.Controls.Add(this.panel3); - this.gpSrchText.DisabledBackColor = System.Drawing.Color.Empty; - this.gpSrchText.Dock = System.Windows.Forms.DockStyle.Fill; - this.gpSrchText.Location = new System.Drawing.Point(23, 1); - this.gpSrchText.Margin = new System.Windows.Forms.Padding(2); - this.gpSrchText.Name = "gpSrchText"; - this.gpSrchText.Size = new System.Drawing.Size(253, 91); - // - // - // - this.gpSrchText.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.gpSrchText.Style.BackColorGradientAngle = 90; - this.gpSrchText.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.gpSrchText.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpSrchText.Style.BorderBottomWidth = 1; - this.gpSrchText.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.gpSrchText.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpSrchText.Style.BorderLeftWidth = 1; - this.gpSrchText.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpSrchText.Style.BorderRightWidth = 1; - this.gpSrchText.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpSrchText.Style.BorderTopWidth = 1; - this.gpSrchText.Style.CornerDiameter = 4; - this.gpSrchText.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.gpSrchText.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.gpSrchText.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.gpSrchText.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.gpSrchText.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.gpSrchText.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.gpSrchText.TabIndex = 5; - this.gpSrchText.EnabledChanged += new System.EventHandler(this.gpSrchText_EnabledChanged); - // - // panel1 - // - this.panel1.BackColor = System.Drawing.Color.Transparent; - this.panel1.Controls.Add(this.cbxTextSearchText); - this.panel1.Controls.Add(this.label1); - this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel1.Location = new System.Drawing.Point(0, -3); - this.panel1.Margin = new System.Windows.Forms.Padding(2); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(247, 23); - this.panel1.TabIndex = 5; - // - // cbxTextSearchText - // - this.contextMenuBar1.SetContextMenuEx(this.cbxTextSearchText, this.btnCMIFindText); - this.cbxTextSearchText.DisplayMember = "Text"; - this.cbxTextSearchText.Dock = System.Windows.Forms.DockStyle.Fill; - this.cbxTextSearchText.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.cbxTextSearchText.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxTextSearchText.FormattingEnabled = true; - this.cbxTextSearchText.ItemHeight = 16; - this.cbxTextSearchText.Location = new System.Drawing.Point(30, 0); - this.cbxTextSearchText.Margin = new System.Windows.Forms.Padding(2); - this.cbxTextSearchText.Name = "cbxTextSearchText"; - this.cbxTextSearchText.Size = new System.Drawing.Size(217, 22); - this.superTooltip1.SetSuperTooltip(this.cbxTextSearchText, new DevComponents.DotNetBar.SuperTooltipInfo("Search for Text", "", resources.GetString("cbxTextSearchText.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbxTextSearchText.TabIndex = 2; - this.cbxTextSearchText.WatermarkFont = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxTextSearchText.WatermarkText = "Enter Search Text Here"; - this.cbxTextSearchText.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ProcessEnterKey); - this.cbxTextSearchText.Leave += new System.EventHandler(this.cbxTextSearchText_Leave); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Dock = System.Windows.Forms.DockStyle.Left; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(0, 0); - this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.label1.Name = "label1"; - this.label1.Padding = new System.Windows.Forms.Padding(0, 5, 0, 0); - this.label1.Size = new System.Drawing.Size(30, 18); - this.superTooltip1.SetSuperTooltip(this.label1, new DevComponents.DotNetBar.SuperTooltipInfo("Search For Text", "", resources.GetString("label1.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.label1.TabIndex = 4; - this.label1.Text = "Find:"; - // - // panel3 - // - this.panel3.BackColor = System.Drawing.Color.Transparent; - this.panel3.Controls.Add(this.cbxByWord); - this.panel3.Controls.Add(this.cbxBooleanTxtSrch); - this.panel3.Controls.Add(this.cbxIncROTextSrch); - this.panel3.Controls.Add(this.cbxProcSectSrch); - this.panel3.Controls.Add(this.cbxCaseSensitive); - this.panel3.Controls.Add(this.cbxRnoOnly); - this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel3.Location = new System.Drawing.Point(0, 20); - this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(247, 65); - this.panel3.TabIndex = 6; - // - // cbxByWord - // - this.cbxByWord.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxByWord.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxByWord.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxByWord.Location = new System.Drawing.Point(106, 6); - this.cbxByWord.Margin = new System.Windows.Forms.Padding(2); - this.cbxByWord.Name = "cbxByWord"; - this.cbxByWord.Size = new System.Drawing.Size(56, 15); - this.superTooltip1.SetSuperTooltip(this.cbxByWord, new DevComponents.DotNetBar.SuperTooltipInfo("By Word", "", "When this box is checked, Search will find only matches of the search text as a w" + - "ord not as part of a word.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(180, 100))); - this.cbxByWord.TabIndex = 7; - this.cbxByWord.Text = "By Word"; - // - // cbxBooleanTxtSrch - // - // - // - // - this.cbxBooleanTxtSrch.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxBooleanTxtSrch.Location = new System.Drawing.Point(160, 23); - this.cbxBooleanTxtSrch.Name = "cbxBooleanTxtSrch"; - this.cbxBooleanTxtSrch.Size = new System.Drawing.Size(86, 15); - this.superTooltip1.SetSuperTooltip(this.cbxBooleanTxtSrch, new DevComponents.DotNetBar.SuperTooltipInfo("Boolean Search", "", resources.GetString("cbxBooleanTxtSrch.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbxBooleanTxtSrch.TabIndex = 6; - this.cbxBooleanTxtSrch.Text = "Boolean Search"; - this.cbxBooleanTxtSrch.Visible = false; - this.cbxBooleanTxtSrch.CheckedChanged += new System.EventHandler(this.cbxBooleanTxtSrch_CheckedChanged); - // - // cbxIncROTextSrch - // - // - // - // - this.cbxIncROTextSrch.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxIncROTextSrch.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxIncROTextSrch.Location = new System.Drawing.Point(9, 23); - this.cbxIncROTextSrch.Name = "cbxIncROTextSrch"; - this.cbxIncROTextSrch.Size = new System.Drawing.Size(169, 12); - this.superTooltip1.SetSuperTooltip(this.cbxIncROTextSrch, new DevComponents.DotNetBar.SuperTooltipInfo("Search RO and Transition Text", "", "When this box is checked, Search will include matches found in RO and Transition " + - "text as well as regular text.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbxIncROTextSrch.TabIndex = 5; - this.cbxIncROTextSrch.Text = "Search RO and Transition Text"; - // - // cbxProcSectSrch - // - // - // - // - this.cbxProcSectSrch.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxProcSectSrch.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxProcSectSrch.Location = new System.Drawing.Point(9, 40); - this.cbxProcSectSrch.Name = "cbxProcSectSrch"; - this.cbxProcSectSrch.Size = new System.Drawing.Size(180, 18); - this.superTooltip1.SetSuperTooltip(this.cbxProcSectSrch, new DevComponents.DotNetBar.SuperTooltipInfo("Search RO and Transition Text", "", "When this box is checked, Search will include matches found in RO and Transition " + - "text as well as regular text.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbxProcSectSrch.TabIndex = 5; - this.cbxProcSectSrch.Text = "Ignore Procedure and Section Titles"; - // - // cbxCaseSensitive - // - this.cbxCaseSensitive.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxCaseSensitive.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxCaseSensitive.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxCaseSensitive.Location = new System.Drawing.Point(9, 6); - this.cbxCaseSensitive.Margin = new System.Windows.Forms.Padding(2); - this.cbxCaseSensitive.Name = "cbxCaseSensitive"; - this.cbxCaseSensitive.Size = new System.Drawing.Size(104, 15); - this.superTooltip1.SetSuperTooltip(this.cbxCaseSensitive, new DevComponents.DotNetBar.SuperTooltipInfo("Case Sensitive", "", "When this box is checked, Search will find only exact matches of the search text " + - "you had entered.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(180, 100))); - this.cbxCaseSensitive.TabIndex = 3; - this.cbxCaseSensitive.Text = "Case Sensitive"; - // - // cbxRnoOnly - // - this.cbxRnoOnly.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxRnoOnly.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxRnoOnly.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxRnoOnly.Location = new System.Drawing.Point(172, 6); - this.cbxRnoOnly.Margin = new System.Windows.Forms.Padding(2); - this.cbxRnoOnly.Name = "cbxRnoOnly"; - this.cbxRnoOnly.Size = new System.Drawing.Size(71, 15); - this.superTooltip1.SetSuperTooltip(this.cbxRnoOnly, new DevComponents.DotNetBar.SuperTooltipInfo("RNO Only", "", "When this box is checked, Search will find only the matches that are in RNO steps" + - ".", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(180, 100))); - this.cbxRnoOnly.TabIndex = 7; - this.cbxRnoOnly.Text = "RNO Only"; - // - // rbtnSrchTxt - // - this.rbtnSrchTxt.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.rbtnSrchTxt.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.rbtnSrchTxt.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton; - this.rbtnSrchTxt.Checked = true; - this.rbtnSrchTxt.CheckState = System.Windows.Forms.CheckState.Checked; - this.rbtnSrchTxt.CheckValue = "Y"; - this.rbtnSrchTxt.Dock = System.Windows.Forms.DockStyle.Left; - this.rbtnSrchTxt.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.rbtnSrchTxt.Location = new System.Drawing.Point(1, 1); - this.rbtnSrchTxt.Margin = new System.Windows.Forms.Padding(2); - this.rbtnSrchTxt.Name = "rbtnSrchTxt"; - this.rbtnSrchTxt.Size = new System.Drawing.Size(22, 91); - this.rbtnSrchTxt.TabIndex = 6; - this.rbtnSrchTxt.CheckedChanged += new System.EventHandler(this.rbtnSrchTxt_CheckedChanged); - // - // cbxSrchTypeUsage - // - this.cbxSrchTypeUsage.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxSrchTypeUsage.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxSrchTypeUsage.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton; - this.cbxSrchTypeUsage.Dock = System.Windows.Forms.DockStyle.Bottom; - this.cbxSrchTypeUsage.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxSrchTypeUsage.Location = new System.Drawing.Point(1, 92); - this.cbxSrchTypeUsage.Margin = new System.Windows.Forms.Padding(2); - this.cbxSrchTypeUsage.Name = "cbxSrchTypeUsage"; - this.cbxSrchTypeUsage.Size = new System.Drawing.Size(275, 20); - this.superTooltip1.SetSuperTooltip(this.cbxSrchTypeUsage, new DevComponents.DotNetBar.SuperTooltipInfo("Find Selected Step Elements", "", "This option will have Search show you where the selected Step Elements are used.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbxSrchTypeUsage.TabIndex = 4; - this.cbxSrchTypeUsage.Text = " Find Selected Step Elements"; - this.cbxSrchTypeUsage.CheckedChanged += new System.EventHandler(this.cbxSrchTypeUsage_CheckedChanged); - // - // tabStepTypeSearch - // - this.tabStepTypeSearch.AttachedControl = this.tabControlPanel4; - this.tabStepTypeSearch.Name = "tabStepTypeSearch"; - this.superTooltip1.SetSuperTooltip(this.tabStepTypeSearch, new DevComponents.DotNetBar.SuperTooltipInfo("Search for Text", "", "Allows you to search for entered text in selected procedure sets and within selec" + - "ted procedure text types.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(170, 110))); - this.tabStepTypeSearch.Text = "Text"; - this.tabStepTypeSearch.Click += new System.EventHandler(this.tabStepTypeSearch_Click); - // - // tabControlPanel5 - // - this.tabControlPanel5.Controls.Add(this.cbxRnoOnlyTrans); - this.tabControlPanel5.Controls.Add(this.pnlTranCategory); - this.tabControlPanel5.Controls.Add(this.pnlTranFormat); - this.tabControlPanel5.Controls.Add(this.pnlTranVersion); - this.tabControlPanel5.DisabledBackColor = System.Drawing.Color.Empty; - this.tabControlPanel5.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControlPanel5.Location = new System.Drawing.Point(0, 34); - this.tabControlPanel5.Margin = new System.Windows.Forms.Padding(2); - this.tabControlPanel5.Name = "tabControlPanel5"; - this.tabControlPanel5.Padding = new System.Windows.Forms.Padding(1); - this.tabControlPanel5.Size = new System.Drawing.Size(277, 113); - this.tabControlPanel5.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))); - this.tabControlPanel5.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227))))); - this.tabControlPanel5.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.tabControlPanel5.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199))))); - this.tabControlPanel5.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right) - | DevComponents.DotNetBar.eBorderSide.Bottom))); - this.tabControlPanel5.Style.GradientAngle = 90; - this.tabControlPanel5.TabIndex = 5; - this.tabControlPanel5.TabItem = this.tabTranSearch; - // - // cbxRnoOnlyTrans - // - this.cbxRnoOnlyTrans.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxRnoOnlyTrans.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxRnoOnlyTrans.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxRnoOnlyTrans.Location = new System.Drawing.Point(4, 68); - this.cbxRnoOnlyTrans.Margin = new System.Windows.Forms.Padding(2); - this.cbxRnoOnlyTrans.Name = "cbxRnoOnlyTrans"; - this.cbxRnoOnlyTrans.Size = new System.Drawing.Size(71, 15); - this.superTooltip1.SetSuperTooltip(this.cbxRnoOnlyTrans, new DevComponents.DotNetBar.SuperTooltipInfo("RNO Only", "", "When this box is checked, Search will find only the matches that are in RNO steps" + - ".", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(180, 100))); - this.cbxRnoOnlyTrans.TabIndex = 8; - this.cbxRnoOnlyTrans.Text = "RNO Only"; - // - // pnlTranCategory - // - this.pnlTranCategory.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.pnlTranCategory.Controls.Add(this.cbxTranCategory); - this.pnlTranCategory.Controls.Add(this.lblTranCategory); - this.pnlTranCategory.Dock = System.Windows.Forms.DockStyle.Top; - this.pnlTranCategory.Location = new System.Drawing.Point(1, 43); - this.pnlTranCategory.Margin = new System.Windows.Forms.Padding(2); - this.pnlTranCategory.Name = "pnlTranCategory"; - this.pnlTranCategory.Padding = new System.Windows.Forms.Padding(1); - this.pnlTranCategory.Size = new System.Drawing.Size(275, 21); - this.pnlTranCategory.TabIndex = 2; - // - // cbxTranCategory - // - this.cbxTranCategory.Dock = System.Windows.Forms.DockStyle.Fill; - this.cbxTranCategory.Location = new System.Drawing.Point(57, 1); - this.cbxTranCategory.Margin = new System.Windows.Forms.Padding(2); - this.cbxTranCategory.Name = "cbxTranCategory"; - this.cbxTranCategory.Size = new System.Drawing.Size(215, 21); - this.cbxTranCategory.TabIndex = 1; - this.cbxTranCategory.WatermarkText = "Select Category of Transitions"; - // - // lblTranCategory - // - this.lblTranCategory.Dock = System.Windows.Forms.DockStyle.Left; - this.lblTranCategory.Location = new System.Drawing.Point(1, 1); - this.lblTranCategory.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.lblTranCategory.Name = "lblTranCategory"; - this.lblTranCategory.Size = new System.Drawing.Size(56, 17); - this.lblTranCategory.TabIndex = 0; - this.lblTranCategory.Text = "Category"; - this.lblTranCategory.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // pnlTranFormat - // - this.pnlTranFormat.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.pnlTranFormat.Controls.Add(this.cbxTranFormat); - this.pnlTranFormat.Controls.Add(this.lblTranFormat); - this.pnlTranFormat.Dock = System.Windows.Forms.DockStyle.Top; - this.pnlTranFormat.Location = new System.Drawing.Point(1, 22); - this.pnlTranFormat.Margin = new System.Windows.Forms.Padding(2); - this.pnlTranFormat.Name = "pnlTranFormat"; - this.pnlTranFormat.Padding = new System.Windows.Forms.Padding(1); - this.pnlTranFormat.Size = new System.Drawing.Size(275, 21); - this.pnlTranFormat.TabIndex = 1; - // - // cbxTranFormat - // - this.cbxTranFormat.Dock = System.Windows.Forms.DockStyle.Fill; - this.cbxTranFormat.Location = new System.Drawing.Point(57, 1); - this.cbxTranFormat.Margin = new System.Windows.Forms.Padding(2); - this.cbxTranFormat.Name = "cbxTranFormat"; - this.cbxTranFormat.Size = new System.Drawing.Size(215, 21); - this.cbxTranFormat.TabIndex = 1; - this.cbxTranFormat.WatermarkText = "Select Style of Transitions"; - // - // lblTranFormat - // - this.lblTranFormat.Dock = System.Windows.Forms.DockStyle.Left; - this.lblTranFormat.Location = new System.Drawing.Point(1, 1); - this.lblTranFormat.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.lblTranFormat.Name = "lblTranFormat"; - this.lblTranFormat.Size = new System.Drawing.Size(56, 17); - this.lblTranFormat.TabIndex = 0; - this.lblTranFormat.Text = "Style"; - this.lblTranFormat.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // pnlTranVersion - // - this.pnlTranVersion.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.pnlTranVersion.Controls.Add(this.cbxTranVersion); - this.pnlTranVersion.Controls.Add(this.lblTranVersion); - this.pnlTranVersion.Dock = System.Windows.Forms.DockStyle.Top; - this.pnlTranVersion.Location = new System.Drawing.Point(1, 1); - this.pnlTranVersion.Margin = new System.Windows.Forms.Padding(2); - this.pnlTranVersion.Name = "pnlTranVersion"; - this.pnlTranVersion.Padding = new System.Windows.Forms.Padding(1); - this.pnlTranVersion.Size = new System.Drawing.Size(275, 21); - this.pnlTranVersion.TabIndex = 0; - // - // cbxTranVersion - // - this.cbxTranVersion.Dock = System.Windows.Forms.DockStyle.Fill; - this.cbxTranVersion.Location = new System.Drawing.Point(52, 1); - this.cbxTranVersion.Margin = new System.Windows.Forms.Padding(2); - this.cbxTranVersion.Name = "cbxTranVersion"; - this.cbxTranVersion.Size = new System.Drawing.Size(220, 21); - this.cbxTranVersion.TabIndex = 1; - this.cbxTranVersion.WatermarkText = "Select Format for Transitions"; - // - // lblTranVersion - // - this.lblTranVersion.Dock = System.Windows.Forms.DockStyle.Left; - this.lblTranVersion.Location = new System.Drawing.Point(1, 1); - this.lblTranVersion.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.lblTranVersion.Name = "lblTranVersion"; - this.lblTranVersion.Size = new System.Drawing.Size(51, 17); - this.lblTranVersion.TabIndex = 0; - this.lblTranVersion.Text = "Formats"; - this.lblTranVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // tabTranSearch - // - this.tabTranSearch.AttachedControl = this.tabControlPanel5; - this.tabTranSearch.Name = "tabTranSearch"; - this.superTooltip1.SetSuperTooltip(this.tabTranSearch, new DevComponents.DotNetBar.SuperTooltipInfo("Search for Transition From", "", "Allows you to search for transitions of the selected type that point from selecte" + - "d procedure set(s).", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(170, 110))); - this.tabTranSearch.Text = "Transitions"; - // - // tabControlPanel2 - // - this.tabControlPanel2.Controls.Add(this.gpFindROs); - this.tabControlPanel2.Controls.Add(this.cmboTreeROs); - this.tabControlPanel2.DisabledBackColor = System.Drawing.Color.Empty; - this.tabControlPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControlPanel2.Location = new System.Drawing.Point(0, 34); - this.tabControlPanel2.Margin = new System.Windows.Forms.Padding(2); - this.tabControlPanel2.Name = "tabControlPanel2"; - this.tabControlPanel2.Padding = new System.Windows.Forms.Padding(1); - this.tabControlPanel2.Size = new System.Drawing.Size(277, 113); - this.tabControlPanel2.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))); - this.tabControlPanel2.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227))))); - this.tabControlPanel2.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.tabControlPanel2.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199))))); - this.tabControlPanel2.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right) - | DevComponents.DotNetBar.eBorderSide.Bottom))); - this.tabControlPanel2.Style.GradientAngle = 90; - this.tabControlPanel2.TabIndex = 2; - this.tabControlPanel2.TabItem = this.tabROSearch; - // - // gpFindROs - // - this.gpFindROs.CanvasColor = System.Drawing.SystemColors.Control; - this.gpFindROs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.gpFindROs.Controls.Add(this.cbxRnoOnlyRO); - this.gpFindROs.Controls.Add(this.lblSrchRoMsg); - this.gpFindROs.Controls.Add(this.cbxFndUnLnkROVals); - this.gpFindROs.DisabledBackColor = System.Drawing.Color.Empty; - this.gpFindROs.Dock = System.Windows.Forms.DockStyle.Fill; - this.gpFindROs.Location = new System.Drawing.Point(1, 21); - this.gpFindROs.Margin = new System.Windows.Forms.Padding(2); - this.gpFindROs.Name = "gpFindROs"; - this.gpFindROs.Size = new System.Drawing.Size(275, 91); - // - // - // - this.gpFindROs.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.gpFindROs.Style.BackColorGradientAngle = 90; - this.gpFindROs.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.gpFindROs.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpFindROs.Style.BorderBottomWidth = 1; - this.gpFindROs.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.gpFindROs.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpFindROs.Style.BorderLeftWidth = 1; - this.gpFindROs.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpFindROs.Style.BorderRightWidth = 1; - this.gpFindROs.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpFindROs.Style.BorderTopWidth = 1; - this.gpFindROs.Style.CornerDiameter = 4; - this.gpFindROs.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.gpFindROs.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.gpFindROs.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.gpFindROs.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.gpFindROs.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.gpFindROs.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.gpFindROs.TabIndex = 3; - this.gpFindROs.EnabledChanged += new System.EventHandler(this.gpFindROs_EnabledChanged); - // - // cbxRnoOnlyRO - // - this.cbxRnoOnlyRO.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxRnoOnlyRO.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxRnoOnlyRO.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxRnoOnlyRO.Location = new System.Drawing.Point(186, 4); - this.cbxRnoOnlyRO.Margin = new System.Windows.Forms.Padding(2); - this.cbxRnoOnlyRO.Name = "cbxRnoOnlyRO"; - this.cbxRnoOnlyRO.Size = new System.Drawing.Size(71, 15); - this.superTooltip1.SetSuperTooltip(this.cbxRnoOnlyRO, new DevComponents.DotNetBar.SuperTooltipInfo("RNO Only", "", "When this box is checked, Search will find only the matches that are in RNO steps" + - ".", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(180, 100))); - this.cbxRnoOnlyRO.TabIndex = 8; - this.cbxRnoOnlyRO.Text = "RNO Only"; - // - // lblSrchRoMsg - // - this.lblSrchRoMsg.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.lblSrchRoMsg.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.lblSrchRoMsg.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblSrchRoMsg.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.lblSrchRoMsg.Location = new System.Drawing.Point(7, 23); - this.lblSrchRoMsg.Margin = new System.Windows.Forms.Padding(2); - this.lblSrchRoMsg.Name = "lblSrchRoMsg"; - this.lblSrchRoMsg.Size = new System.Drawing.Size(262, 40); - this.lblSrchRoMsg.TabIndex = 3; - this.lblSrchRoMsg.Text = "This folder(s) ROs are incompatible with the currently selected folder(s). This " + - "may be due to the RO values needing to be updated."; - this.lblSrchRoMsg.Visible = false; - this.lblSrchRoMsg.WordWrap = true; - // - // cbxFndUnLnkROVals - // - this.cbxFndUnLnkROVals.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxFndUnLnkROVals.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxFndUnLnkROVals.Enabled = false; - this.cbxFndUnLnkROVals.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxFndUnLnkROVals.Location = new System.Drawing.Point(0, 3); - this.cbxFndUnLnkROVals.Margin = new System.Windows.Forms.Padding(2); - this.cbxFndUnLnkROVals.Name = "cbxFndUnLnkROVals"; - this.cbxFndUnLnkROVals.Size = new System.Drawing.Size(176, 19); - this.superTooltip1.SetSuperTooltip(this.cbxFndUnLnkROVals, new DevComponents.DotNetBar.SuperTooltipInfo("Find Linked Values", "", "Finding unlinked values does the search for a specific RO.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbxFndUnLnkROVals.TabIndex = 2; - this.cbxFndUnLnkROVals.Text = "Find Unlinked Values of Selected RO"; - // - // cmboTreeROs - // - this.cmboTreeROs.BackColor = System.Drawing.SystemColors.Window; - // - // - // - this.cmboTreeROs.BackgroundStyle.Class = "TextBoxBorder"; - this.cmboTreeROs.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cmboTreeROs.ButtonDropDown.Visible = true; - this.cmboTreeROs.Dock = System.Windows.Forms.DockStyle.Top; - this.cmboTreeROs.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cmboTreeROs.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - this.cmboTreeROs.Location = new System.Drawing.Point(1, 1); - this.cmboTreeROs.Margin = new System.Windows.Forms.Padding(2); - this.cmboTreeROs.Name = "cmboTreeROs"; - this.cmboTreeROs.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.cmboTreeROs.Size = new System.Drawing.Size(275, 20); - this.superTooltip1.SetSuperTooltip(this.cmboTreeROs, new DevComponents.DotNetBar.SuperTooltipInfo("Select the RO to Search", "", "Select the Referenced Object to search for.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cmboTreeROs.TabIndex = 1; - this.cmboTreeROs.ThemeAware = true; - this.cmboTreeROs.WatermarkText = "Select an RO to search"; - this.cmboTreeROs.SelectedIndexChanged += new System.EventHandler(this.cmboTreeROs_SelectedIndexChanged); - // - // tabROSearch - // - this.tabROSearch.AttachedControl = this.tabControlPanel2; - this.tabROSearch.Name = "tabROSearch"; - this.superTooltip1.SetSuperTooltip(this.tabROSearch, new DevComponents.DotNetBar.SuperTooltipInfo("Search for Referenced Objects", "", "Allows you to search for referenced objects used in selected procedure set(s).", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(170, 110))); - this.tabROSearch.Text = "Reference\nObjects"; - // - // tabControlPanel3 - // - this.tabControlPanel3.Controls.Add(this.gpSrchAnnoText); - this.tabControlPanel3.Controls.Add(this.cbxAnnoTypes); - this.tabControlPanel3.DisabledBackColor = System.Drawing.Color.Empty; - this.tabControlPanel3.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControlPanel3.Location = new System.Drawing.Point(0, 34); - this.tabControlPanel3.Margin = new System.Windows.Forms.Padding(2); - this.tabControlPanel3.Name = "tabControlPanel3"; - this.tabControlPanel3.Padding = new System.Windows.Forms.Padding(1); - this.tabControlPanel3.Size = new System.Drawing.Size(277, 113); - this.tabControlPanel3.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))); - this.tabControlPanel3.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227))))); - this.tabControlPanel3.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.tabControlPanel3.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199))))); - this.tabControlPanel3.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right) - | DevComponents.DotNetBar.eBorderSide.Bottom))); - this.tabControlPanel3.Style.GradientAngle = 90; - this.tabControlPanel3.TabIndex = 5; - this.tabControlPanel3.TabItem = this.tabAnnotationSearch; - // - // gpSrchAnnoText - // - this.gpSrchAnnoText.AutoSize = true; - this.gpSrchAnnoText.CanvasColor = System.Drawing.SystemColors.Control; - this.gpSrchAnnoText.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.gpSrchAnnoText.Controls.Add(this.panel4); - this.gpSrchAnnoText.DisabledBackColor = System.Drawing.Color.Empty; - this.gpSrchAnnoText.Dock = System.Windows.Forms.DockStyle.Fill; - this.gpSrchAnnoText.Enabled = false; - this.gpSrchAnnoText.Location = new System.Drawing.Point(1, 23); - this.gpSrchAnnoText.Margin = new System.Windows.Forms.Padding(2); - this.gpSrchAnnoText.Name = "gpSrchAnnoText"; - this.gpSrchAnnoText.Size = new System.Drawing.Size(275, 89); - // - // - // - this.gpSrchAnnoText.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.gpSrchAnnoText.Style.BackColorGradientAngle = 90; - this.gpSrchAnnoText.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.gpSrchAnnoText.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpSrchAnnoText.Style.BorderBottomWidth = 1; - this.gpSrchAnnoText.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.gpSrchAnnoText.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpSrchAnnoText.Style.BorderLeftWidth = 1; - this.gpSrchAnnoText.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpSrchAnnoText.Style.BorderRightWidth = 1; - this.gpSrchAnnoText.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpSrchAnnoText.Style.BorderTopWidth = 1; - this.gpSrchAnnoText.Style.CornerDiameter = 4; - this.gpSrchAnnoText.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.gpSrchAnnoText.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.gpSrchAnnoText.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.gpSrchAnnoText.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.gpSrchAnnoText.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.gpSrchAnnoText.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.gpSrchAnnoText.TabIndex = 6; - this.gpSrchAnnoText.EnabledChanged += new System.EventHandler(this.gpSrchAnnoText_EnabledChanged); - // - // panel4 - // - this.panel4.BackColor = System.Drawing.Color.Transparent; - this.panel4.Controls.Add(this.cbxRnoOnlyAnnot); - this.panel4.Controls.Add(this.cbxBooleanAnoTxtSrch); - this.panel4.Controls.Add(this.cbxCaseSensitiveAnnoText); - this.panel4.Controls.Add(this.cbxTextSearchAnnotation); - this.panel4.Controls.Add(this.label2); - this.panel4.Dock = System.Windows.Forms.DockStyle.Top; - this.panel4.Location = new System.Drawing.Point(0, 0); - this.panel4.Margin = new System.Windows.Forms.Padding(2); - this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(269, 62); - this.panel4.TabIndex = 9; - // - // cbxRnoOnlyAnnot - // - this.cbxRnoOnlyAnnot.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxRnoOnlyAnnot.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxRnoOnlyAnnot.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxRnoOnlyAnnot.Location = new System.Drawing.Point(105, 24); - this.cbxRnoOnlyAnnot.Margin = new System.Windows.Forms.Padding(2); - this.cbxRnoOnlyAnnot.Name = "cbxRnoOnlyAnnot"; - this.cbxRnoOnlyAnnot.Size = new System.Drawing.Size(71, 15); - this.superTooltip1.SetSuperTooltip(this.cbxRnoOnlyAnnot, new DevComponents.DotNetBar.SuperTooltipInfo("RNO Only", "", "When this box is checked, Search will find only the matches that are in RNO steps" + - ".", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(180, 100))); - this.cbxRnoOnlyAnnot.TabIndex = 9; - this.cbxRnoOnlyAnnot.Text = "RNO Only"; - // - // cbxBooleanAnoTxtSrch - // - // - // - // - this.cbxBooleanAnoTxtSrch.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxBooleanAnoTxtSrch.Location = new System.Drawing.Point(12, 41); - this.cbxBooleanAnoTxtSrch.Name = "cbxBooleanAnoTxtSrch"; - this.cbxBooleanAnoTxtSrch.Size = new System.Drawing.Size(111, 17); - this.cbxBooleanAnoTxtSrch.TabIndex = 8; - this.cbxBooleanAnoTxtSrch.Text = "Boolean Search"; - this.cbxBooleanAnoTxtSrch.Visible = false; - this.cbxBooleanAnoTxtSrch.CheckedChanged += new System.EventHandler(this.cbxBooleanAnoTxtSrch_CheckedChanged); - // - // cbxCaseSensitiveAnnoText - // - this.cbxCaseSensitiveAnnoText.AutoSize = true; - this.cbxCaseSensitiveAnnoText.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbxCaseSensitiveAnnoText.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxCaseSensitiveAnnoText.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxCaseSensitiveAnnoText.Location = new System.Drawing.Point(12, 25); - this.cbxCaseSensitiveAnnoText.Margin = new System.Windows.Forms.Padding(2); - this.cbxCaseSensitiveAnnoText.Name = "cbxCaseSensitiveAnnoText"; - this.cbxCaseSensitiveAnnoText.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.cbxCaseSensitiveAnnoText.Size = new System.Drawing.Size(92, 15); - this.superTooltip1.SetSuperTooltip(this.cbxCaseSensitiveAnnoText, new DevComponents.DotNetBar.SuperTooltipInfo("Case Sensitive", "", "When this box is checked, Search will find only exact mactches of the search text" + - " you had entered.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(180, 100))); - this.cbxCaseSensitiveAnnoText.TabIndex = 5; - this.cbxCaseSensitiveAnnoText.Text = "Case Sensitive"; - // - // cbxTextSearchAnnotation - // - this.contextMenuBar1.SetContextMenuEx(this.cbxTextSearchAnnotation, this.btnCMIFindText); - this.cbxTextSearchAnnotation.DisplayMember = "Text"; - this.cbxTextSearchAnnotation.Dock = System.Windows.Forms.DockStyle.Fill; - this.cbxTextSearchAnnotation.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.cbxTextSearchAnnotation.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxTextSearchAnnotation.FormattingEnabled = true; - this.cbxTextSearchAnnotation.ItemHeight = 16; - this.cbxTextSearchAnnotation.Location = new System.Drawing.Point(30, 0); - this.cbxTextSearchAnnotation.Margin = new System.Windows.Forms.Padding(2); - this.cbxTextSearchAnnotation.Name = "cbxTextSearchAnnotation"; - this.cbxTextSearchAnnotation.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.cbxTextSearchAnnotation.Size = new System.Drawing.Size(239, 22); - this.superTooltip1.SetSuperTooltip(this.cbxTextSearchAnnotation, new DevComponents.DotNetBar.SuperTooltipInfo("Search For Annotaion Text", "", "Enter Annotation text to search for or select from the dropdown list.\r\n\r\nLeave Bl" + - "ank to search for occurences of the selected annotation.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(180, 140))); - this.cbxTextSearchAnnotation.TabIndex = 6; - this.cbxTextSearchAnnotation.WatermarkFont = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxTextSearchAnnotation.WatermarkText = "Enter Search Text Here"; - this.cbxTextSearchAnnotation.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ProcessEnterKey); - this.cbxTextSearchAnnotation.Leave += new System.EventHandler(this.cbxTextSearchAnnotation_Leave); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.Transparent; - this.label2.Dock = System.Windows.Forms.DockStyle.Left; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.Location = new System.Drawing.Point(0, 0); - this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.label2.Name = "label2"; - this.label2.Padding = new System.Windows.Forms.Padding(0, 5, 0, 0); - this.label2.Size = new System.Drawing.Size(30, 18); - this.label2.TabIndex = 7; - this.label2.Text = "Find:"; - // - // cbxAnnoTypes - // - this.cbxAnnoTypes.DisplayMember = "Text"; - this.cbxAnnoTypes.Dock = System.Windows.Forms.DockStyle.Top; - this.cbxAnnoTypes.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.cbxAnnoTypes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbxAnnoTypes.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbxAnnoTypes.FormattingEnabled = true; - this.cbxAnnoTypes.ItemHeight = 16; - this.cbxAnnoTypes.Location = new System.Drawing.Point(1, 1); - this.cbxAnnoTypes.Margin = new System.Windows.Forms.Padding(2); - this.cbxAnnoTypes.Name = "cbxAnnoTypes"; - this.cbxAnnoTypes.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.cbxAnnoTypes.Size = new System.Drawing.Size(275, 22); - this.superTooltip1.SetSuperTooltip(this.cbxAnnoTypes, new DevComponents.DotNetBar.SuperTooltipInfo("Select Annotation Type", "", "Select the type of annotation to search for.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(192, 61))); - this.cbxAnnoTypes.TabIndex = 0; - this.cbxAnnoTypes.WatermarkText = "Select AnnotationType to Search"; - // - // tabAnnotationSearch - // - this.tabAnnotationSearch.AttachedControl = this.tabControlPanel3; - this.tabAnnotationSearch.Name = "tabAnnotationSearch"; - this.superTooltip1.SetSuperTooltip(this.tabAnnotationSearch, new DevComponents.DotNetBar.SuperTooltipInfo("Search for Annotations", "", "Allows you to search for types and text for annotations in the selected procedure" + - " set(s).", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(170, 110))); - this.tabAnnotationSearch.Text = "Annotations"; - this.tabAnnotationSearch.Click += new System.EventHandler(this.tabAnnotationSearch_Click); - // - // tabControlPanel1 - // - this.tabControlPanel1.Controls.Add(this.btnTranCvtSelToTxt); - this.tabControlPanel1.Controls.Add(this.lblIncTran); - this.tabControlPanel1.Controls.Add(this.btnTranCvtAllToTxt); - this.tabControlPanel1.Controls.Add(this.lblSrchIncTran); - this.tabControlPanel1.Controls.Add(this.groupBox1); - this.tabControlPanel1.DisabledBackColor = System.Drawing.Color.Empty; - this.tabControlPanel1.Location = new System.Drawing.Point(0, 34); - this.tabControlPanel1.Name = "tabControlPanel1"; - this.tabControlPanel1.Padding = new System.Windows.Forms.Padding(1); - this.tabControlPanel1.Size = new System.Drawing.Size(277, 113); - this.tabControlPanel1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))); - this.tabControlPanel1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227))))); - this.tabControlPanel1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.tabControlPanel1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199))))); - this.tabControlPanel1.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right) - | DevComponents.DotNetBar.eBorderSide.Bottom))); - this.tabControlPanel1.Style.GradientAngle = 90; - this.tabControlPanel1.TabIndex = 17; - this.tabControlPanel1.TabItem = this.tabIncTrans; - this.tabControlPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.tabControlPanel1.RightToLeft = System.Windows.Forms.RightToLeft.No; - // - // btnTranCvtSelToTxt - // - this.btnTranCvtSelToTxt.Enabled = false; - this.btnTranCvtSelToTxt.Location = new System.Drawing.Point(121, 63); - this.btnTranCvtSelToTxt.Name = "btnTranCvtSelToTxt"; - this.btnTranCvtSelToTxt.Size = new System.Drawing.Size(145, 22); - this.superTooltip1.SetSuperTooltip(this.btnTranCvtSelToTxt, new DevComponents.DotNetBar.SuperTooltipInfo("Convert Selected Incoming Transitions To Text", "", "Converts selected transitions in the results list to text unless the user does no" + - "t have permission to change text.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(170, 90))); - this.btnTranCvtSelToTxt.TabIndex = 3; - this.btnTranCvtSelToTxt.Text = "Convert Selected To Text"; - this.btnTranCvtSelToTxt.UseVisualStyleBackColor = true; - this.btnTranCvtSelToTxt.Click += new System.EventHandler(this.btnTranCvtSelToTxt_Click); - // - // lblIncTran - // - this.lblIncTran.AutoSize = true; - this.lblIncTran.Location = new System.Drawing.Point(4, 9); - this.lblIncTran.Name = "lblIncTran"; - this.lblIncTran.Size = new System.Drawing.Size(23, 13); - this.lblIncTran.TabIndex = 2; - this.lblIncTran.Text = "To:"; - // - // btnTranCvtAllToTxt - // - this.btnTranCvtAllToTxt.Enabled = false; - this.btnTranCvtAllToTxt.Location = new System.Drawing.Point(6, 63); - this.btnTranCvtAllToTxt.Name = "btnTranCvtAllToTxt"; - this.btnTranCvtAllToTxt.Size = new System.Drawing.Size(109, 22); - this.superTooltip1.SetSuperTooltip(this.btnTranCvtAllToTxt, new DevComponents.DotNetBar.SuperTooltipInfo("Convert All Incoming Transitions To Text", "", "Converts all of the transitions in the results list to text unless the user does " + - "not have permission to change text.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(170, 90))); - this.btnTranCvtAllToTxt.TabIndex = 1; - this.btnTranCvtAllToTxt.Text = "Convert All To Text"; - this.btnTranCvtAllToTxt.UseVisualStyleBackColor = true; - this.btnTranCvtAllToTxt.Click += new System.EventHandler(this.btnTranCvtAllToTxt_Click); - // - // lblSrchIncTran - // - this.lblSrchIncTran.BackColor = System.Drawing.Color.Transparent; - this.lblSrchIncTran.Location = new System.Drawing.Point(34, 9); - this.lblSrchIncTran.Name = "lblSrchIncTran"; - this.lblSrchIncTran.Size = new System.Drawing.Size(239, 40); - this.superTooltip1.SetSuperTooltip(this.lblSrchIncTran, new DevComponents.DotNetBar.SuperTooltipInfo("Incoming Transitions", "", "This is the step, section, or procedure for which incoming transitions to it are " + - "shown in the list.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(170, 80))); - this.lblSrchIncTran.TabIndex = 1; - // - // groupBox1 - // - this.groupBox1.BackColor = System.Drawing.Color.Transparent; - this.groupBox1.Controls.Add(this.rbFromEditor); - this.groupBox1.Controls.Add(this.rbFromTree); - this.groupBox1.Location = new System.Drawing.Point(147, 4); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(130, 57); - this.groupBox1.TabIndex = 0; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Search Selection"; - this.groupBox1.Visible = false; - // - // rbFromEditor - // - this.rbFromEditor.AutoSize = true; - this.rbFromEditor.Location = new System.Drawing.Point(22, 34); - this.rbFromEditor.Name = "rbFromEditor"; - this.rbFromEditor.Size = new System.Drawing.Size(78, 17); - this.rbFromEditor.TabIndex = 1; - this.rbFromEditor.TabStop = true; - this.rbFromEditor.Text = "From Editor"; - this.rbFromEditor.UseVisualStyleBackColor = true; - // - // rbFromTree - // - this.rbFromTree.AutoSize = true; - this.rbFromTree.Location = new System.Drawing.Point(22, 16); - this.rbFromTree.Name = "rbFromTree"; - this.rbFromTree.Size = new System.Drawing.Size(73, 17); - this.rbFromTree.TabIndex = 0; - this.rbFromTree.TabStop = true; - this.rbFromTree.Text = "From Tree"; - this.rbFromTree.UseVisualStyleBackColor = true; - // - // tabIncTrans - // - this.tabIncTrans.AttachedControl = this.tabControlPanel1; - this.tabIncTrans.Name = "tabIncTrans"; - this.superTooltip1.SetSuperTooltip(this.tabIncTrans, new DevComponents.DotNetBar.SuperTooltipInfo("Search for Incoming Transitions", "", "Finds the Incoming Transitions that point to the current item and convert the tra" + - "nsition(s) to text if desired and if have permissions.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(170, 120))); - this.tabIncTrans.Text = "Incoming\nTransitions"; - // - // contextMenuBar1 - // - this.contextMenuBar1.DockSide = DevComponents.DotNetBar.eDockSide.Top; - this.contextMenuBar1.Font = new System.Drawing.Font("Segoe UI", 9F); - this.contextMenuBar1.IsMaximized = false; - this.contextMenuBar1.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this.btnCMIFindText}); - this.contextMenuBar1.Location = new System.Drawing.Point(225, -3); - this.contextMenuBar1.Margin = new System.Windows.Forms.Padding(2); - this.contextMenuBar1.Name = "contextMenuBar1"; - this.contextMenuBar1.Size = new System.Drawing.Size(56, 25); - this.contextMenuBar1.Stretch = true; - this.contextMenuBar1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2003; - this.contextMenuBar1.TabIndex = 6; - this.contextMenuBar1.TabStop = false; - this.contextMenuBar1.Text = "contextMenuBar1"; - // - // btnCMIFindText - // - this.btnCMIFindText.AutoExpandOnClick = true; - this.btnCMIFindText.Name = "btnCMIFindText"; - this.btnCMIFindText.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this.btnCMEdit, - this.btnCMInsert}); - this.btnCMIFindText.Text = "cmFindText"; - this.btnCMIFindText.PopupOpen += new DevComponents.DotNetBar.DotNetBarManager.PopupOpenEventHandler(this.btnCMIFindText_PopupOpen); - // - // btnCMEdit - // - this.btnCMEdit.Name = "btnCMEdit"; - this.btnCMEdit.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this.cmFndTxtCut, - this.cmFndTxtCopy, - this.cmFndTxtPaste}); - this.btnCMEdit.Text = "Edit"; - // - // cmFndTxtCut - // - this.cmFndTxtCut.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; - this.cmFndTxtCut.Image = global::Volian.Controls.Library.Properties.Resources.Cut_Image; - this.cmFndTxtCut.Name = "cmFndTxtCut"; - this.cmFndTxtCut.Stretch = true; - this.cmFndTxtCut.Text = "Cut"; - this.cmFndTxtCut.Click += new System.EventHandler(this.cmFndTxtCut_Click); - // - // cmFndTxtCopy - // - this.cmFndTxtCopy.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; - this.cmFndTxtCopy.Image = global::Volian.Controls.Library.Properties.Resources.Copy_Image; - this.cmFndTxtCopy.Name = "cmFndTxtCopy"; - this.cmFndTxtCopy.Text = "Copy"; - this.cmFndTxtCopy.Click += new System.EventHandler(this.cmFndTxtCopy_Click); - // - // cmFndTxtPaste - // - this.cmFndTxtPaste.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; - this.cmFndTxtPaste.Image = global::Volian.Controls.Library.Properties.Resources.PasteSmall_Image; - this.cmFndTxtPaste.Name = "cmFndTxtPaste"; - this.cmFndTxtPaste.Text = "Paste"; - this.cmFndTxtPaste.Click += new System.EventHandler(this.cmFndTxtPaste_Click); - // - // btnCMInsert - // - this.btnCMInsert.Name = "btnCMInsert"; - this.btnCMInsert.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this.cmFndTxtInsHardSp, - this.cmFndTxtInsSymbol, - this.buttonItem1, - this.btnBooleanItems}); - this.btnCMInsert.Text = "Insert"; - // - // cmFndTxtInsHardSp - // - this.cmFndTxtInsHardSp.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; - this.cmFndTxtInsHardSp.Image = global::Volian.Controls.Library.Properties.Resources.HardSpace_Image; - this.cmFndTxtInsHardSp.Name = "cmFndTxtInsHardSp"; - this.cmFndTxtInsHardSp.Text = "Hard Space"; - this.cmFndTxtInsHardSp.Click += new System.EventHandler(this.cmFndTxtInsHardSp_Click); - // - // cmFndTxtInsSymbol - // - this.cmFndTxtInsSymbol.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; - this.cmFndTxtInsSymbol.Image = global::Volian.Controls.Library.Properties.Resources.Symbol_Image; - this.cmFndTxtInsSymbol.Name = "cmFndTxtInsSymbol"; - this.cmFndTxtInsSymbol.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this.galSymbols}); - this.cmFndTxtInsSymbol.Text = "Symbol"; - // - // galSymbols - // - // - // - // - this.galSymbols.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.galSymbols.EnableGalleryPopup = false; - this.galSymbols.MinimumSize = new System.Drawing.Size(150, 200); - this.galSymbols.Name = "galSymbols"; - this.galSymbols.Text = "galleryContainer1"; - // - // - // - this.galSymbols.TitleMouseOverStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.galSymbols.TitleStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // buttonItem1 - // - this.buttonItem1.Name = "buttonItem1"; - this.buttonItem1.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this.buttonItem2, - this.buttonItem3, - this.buttonItem4}); - this.buttonItem1.Text = "Wild Cards"; - // - // buttonItem2 - // - this.buttonItem2.Name = "buttonItem2"; - this.buttonItem2.Text = "* - Anything"; - this.buttonItem2.Click += new System.EventHandler(this.buttonItem2_Click); - // - // buttonItem3 - // - this.buttonItem3.Name = "buttonItem3"; - this.buttonItem3.Text = "? - One Character"; - this.buttonItem3.Click += new System.EventHandler(this.buttonItem3_Click); - // - // buttonItem4 - // - this.buttonItem4.Name = "buttonItem4"; - this.buttonItem4.Text = "?* - One or More"; - this.buttonItem4.Click += new System.EventHandler(this.buttonItem4_Click); - // - // btnBooleanItems - // - this.btnBooleanItems.Name = "btnBooleanItems"; - this.btnBooleanItems.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this.btnAND, - this.btnOR, - this.btnNOT}); - this.btnBooleanItems.Text = "Boolean"; - this.btnBooleanItems.Visible = false; - // - // btnAND - // - this.btnAND.Name = "btnAND"; - this.btnAND.Text = "AND"; - this.btnAND.Click += new System.EventHandler(this.btnAND_Click); - // - // btnOR - // - this.btnOR.Name = "btnOR"; - this.btnOR.Text = "OR"; - this.btnOR.Click += new System.EventHandler(this.btnOR_Click); - // - // btnNOT - // - this.btnNOT.Name = "btnNOT"; - this.btnNOT.Text = "NOT"; - this.btnNOT.Click += new System.EventHandler(this.btnNOT_Click); - // - // advTreeProcSets - // - this.advTreeProcSets.AccessibleRole = System.Windows.Forms.AccessibleRole.Outline; - this.advTreeProcSets.BackColor = System.Drawing.SystemColors.Window; - // - // - // - this.advTreeProcSets.BackgroundStyle.Class = "TreeBorderKey"; - this.advTreeProcSets.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.advTreeProcSets.CellStyleSelected = this.elementStyle1; - this.advTreeProcSets.Dock = System.Windows.Forms.DockStyle.Fill; - this.advTreeProcSets.DragDropEnabled = false; - this.advTreeProcSets.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - this.advTreeProcSets.Location = new System.Drawing.Point(0, 21); - this.advTreeProcSets.Margin = new System.Windows.Forms.Padding(2); - this.advTreeProcSets.MultiSelect = true; - this.advTreeProcSets.MultiSelectRule = DevComponents.AdvTree.eMultiSelectRule.AnyNode; - this.advTreeProcSets.Name = "advTreeProcSets"; - this.advTreeProcSets.Nodes.AddRange(new DevComponents.AdvTree.Node[] { - this.node1}); - this.advTreeProcSets.NodesConnector = this.nodeConnector1; - this.advTreeProcSets.NodeStyle = this.elementStyle1; - this.advTreeProcSets.NodeStyleSelected = this.elementStyle1; - this.advTreeProcSets.PathSeparator = ";"; - this.advTreeProcSets.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.advTreeProcSets.Size = new System.Drawing.Size(277, 103); - this.advTreeProcSets.Styles.Add(this.elementStyle1); - this.advTreeProcSets.TabIndex = 0; - this.advTreeProcSets.Text = "advTree1"; - this.advTreeProcSets.AfterCheck += new DevComponents.AdvTree.AdvTreeCellEventHandler(this.advTreeProcSets_AfterCheck); - this.advTreeProcSets.AfterNodeSelect += new DevComponents.AdvTree.AdvTreeNodeEventHandler(this.advTreeProcSets_AfterNodeSelect); - this.advTreeProcSets.Click += new System.EventHandler(this.pnode_selected); - // - // elementStyle1 - // - this.elementStyle1.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.elementStyle1.Name = "elementStyle1"; - this.elementStyle1.TextColor = System.Drawing.SystemColors.ControlText; - // - // node1 - // - this.node1.Name = "node1"; - this.node1.Text = "node1"; - // - // nodeConnector1 - // - this.nodeConnector1.LineColor = System.Drawing.SystemColors.ControlText; - // - // advTreeStepTypes - // - this.advTreeStepTypes.AccessibleRole = System.Windows.Forms.AccessibleRole.Outline; - this.advTreeStepTypes.BackColor = System.Drawing.SystemColors.Window; - // - // - // - this.advTreeStepTypes.BackgroundStyle.Class = "TreeBorderKey"; - this.advTreeStepTypes.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.advTreeStepTypes.CellStyleSelected = this.elementStyle2; - this.advTreeStepTypes.Dock = System.Windows.Forms.DockStyle.Fill; - this.advTreeStepTypes.DragDropEnabled = false; - this.advTreeStepTypes.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - this.advTreeStepTypes.Location = new System.Drawing.Point(0, 21); - this.advTreeStepTypes.Margin = new System.Windows.Forms.Padding(2); - this.advTreeStepTypes.MultiSelect = true; - this.advTreeStepTypes.MultiSelectRule = DevComponents.AdvTree.eMultiSelectRule.AnyNode; - this.advTreeStepTypes.Name = "advTreeStepTypes"; - this.advTreeStepTypes.Nodes.AddRange(new DevComponents.AdvTree.Node[] { - this.node2}); - this.advTreeStepTypes.NodesConnector = this.nodeConnector2; - this.advTreeStepTypes.NodeStyle = this.elementStyle2; - this.advTreeStepTypes.NodeStyleSelected = this.elementStyle2; - this.advTreeStepTypes.PathSeparator = ";"; - this.advTreeStepTypes.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.advTreeStepTypes.SelectionPerCell = true; - this.advTreeStepTypes.Size = new System.Drawing.Size(277, 110); - this.advTreeStepTypes.Styles.Add(this.elementStyle2); - this.advTreeStepTypes.TabIndex = 0; - this.advTreeStepTypes.Text = "advTree1"; - this.advTreeStepTypes.AfterCheck += new DevComponents.AdvTree.AdvTreeCellEventHandler(this.advTreeStepTypes_AfterCheck); - // - // elementStyle2 - // - this.elementStyle2.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.elementStyle2.Name = "elementStyle2"; - this.elementStyle2.TextColor = System.Drawing.SystemColors.ControlText; - // - // node2 - // - this.node2.Expanded = true; - this.node2.Name = "node2"; - this.node2.Text = "....select a procedure set for types to appear..."; - // - // nodeConnector2 - // - this.nodeConnector2.LineColor = System.Drawing.SystemColors.ControlText; - // - // grpPanSearchResults - // - this.grpPanSearchResults.CanvasColor = System.Drawing.SystemColors.Control; - this.grpPanSearchResults.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.grpPanSearchResults.Controls.Add(this.lbSrchResults); - this.grpPanSearchResults.Controls.Add(this.lbSrchResultsIncTrans); - this.grpPanSearchResults.DisabledBackColor = System.Drawing.Color.Empty; - this.grpPanSearchResults.Dock = System.Windows.Forms.DockStyle.Fill; - this.grpPanSearchResults.Location = new System.Drawing.Point(0, 461); - this.grpPanSearchResults.Margin = new System.Windows.Forms.Padding(2); - this.grpPanSearchResults.Name = "grpPanSearchResults"; - this.grpPanSearchResults.Size = new System.Drawing.Size(277, 215); - // - // - // - this.grpPanSearchResults.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.grpPanSearchResults.Style.BackColorGradientAngle = 90; - this.grpPanSearchResults.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.grpPanSearchResults.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.grpPanSearchResults.Style.BorderBottomWidth = 1; - this.grpPanSearchResults.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.grpPanSearchResults.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.grpPanSearchResults.Style.BorderLeftWidth = 1; - this.grpPanSearchResults.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.grpPanSearchResults.Style.BorderRightWidth = 1; - this.grpPanSearchResults.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.grpPanSearchResults.Style.BorderTopWidth = 1; - this.grpPanSearchResults.Style.CornerDiameter = 4; - this.grpPanSearchResults.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.grpPanSearchResults.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.grpPanSearchResults.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.grpPanSearchResults.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.grpPanSearchResults.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.grpPanSearchResults.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.grpPanSearchResults.TabIndex = 3; - this.grpPanSearchResults.Text = "Search Results"; - // - // lbSrchResults - // - this.lbSrchResults.Dock = System.Windows.Forms.DockStyle.Fill; - this.lbSrchResults.Location = new System.Drawing.Point(0, 0); - this.lbSrchResults.Margin = new System.Windows.Forms.Padding(2); - this.lbSrchResults.Name = "lbSrchResults"; - this.lbSrchResults.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.lbSrchResults.Size = new System.Drawing.Size(271, 194); - this.lbSrchResults.TabIndex = 0; - this.lbSrchResults.SelectedIndexChanged += new System.EventHandler(this.lbSrchResults_SelectedValueChanged); - this.lbSrchResults.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lbSrchResults_MouseMove); - // - // lbSrchResultsIncTrans - // - // - // - // - this.lbSrchResultsIncTrans.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.lbSrchResultsIncTrans.CheckBoxesVisible = true; - this.lbSrchResultsIncTrans.CheckStateMember = null; - this.lbSrchResultsIncTrans.ContainerControlProcessDialogKey = true; - this.lbSrchResultsIncTrans.Dock = System.Windows.Forms.DockStyle.Fill; - this.lbSrchResultsIncTrans.DragDropSupport = true; - this.lbSrchResultsIncTrans.ItemHeight = 16; - this.lbSrchResultsIncTrans.Location = new System.Drawing.Point(0, 0); - this.lbSrchResultsIncTrans.Margin = new System.Windows.Forms.Padding(2); - this.lbSrchResultsIncTrans.Name = "lbSrchResultsIncTrans"; - this.lbSrchResultsIncTrans.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.lbSrchResultsIncTrans.Size = new System.Drawing.Size(271, 194); - this.lbSrchResultsIncTrans.TabIndex = 0; - this.lbSrchResultsIncTrans.SelectedIndexChanged += new System.EventHandler(this.lbSrchResults_SelectedValueChanged); - this.lbSrchResultsIncTrans.ItemClick += new System.EventHandler(this.lbSrchResultsIncTrans_ItemClicked); - this.lbSrchResultsIncTrans.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lbSrchResults_MouseMove); - // - // panSearchButtons - // - this.panSearchButtons.CanvasColor = System.Drawing.SystemColors.Control; - this.panSearchButtons.Controls.Add(this.btnClearSearchResults); - this.panSearchButtons.Controls.Add(this.btnCopySearchResults); - this.panSearchButtons.Controls.Add(this.btnSaveSearchResults); - this.panSearchButtons.Controls.Add(this.btnLoadSearchResults); - this.panSearchButtons.Controls.Add(this.labelX1); - this.panSearchButtons.Controls.Add(this.cmbResultsStyle); - this.panSearchButtons.Controls.Add(this.cbSorted); - this.panSearchButtons.Controls.Add(this.btnSearch); - this.panSearchButtons.Controls.Add(this.btnPrnSrchRslts); - this.panSearchButtons.DisabledBackColor = System.Drawing.Color.Empty; - this.panSearchButtons.Dock = System.Windows.Forms.DockStyle.Top; - this.panSearchButtons.Location = new System.Drawing.Point(0, 402); - this.panSearchButtons.Margin = new System.Windows.Forms.Padding(2); - this.panSearchButtons.Name = "panSearchButtons"; - this.panSearchButtons.Size = new System.Drawing.Size(277, 59); - this.panSearchButtons.Style.Alignment = System.Drawing.StringAlignment.Center; - this.panSearchButtons.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.panSearchButtons.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.panSearchButtons.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.panSearchButtons.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.panSearchButtons.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.panSearchButtons.Style.GradientAngle = 90; - this.panSearchButtons.TabIndex = 6; - this.panSearchButtons.ThemeAware = true; - this.panSearchButtons.Resize += new System.EventHandler(this.panSearchButtons_Resize); - // - // btnClearSearchResults - // - this.btnClearSearchResults.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnClearSearchResults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnClearSearchResults.ColorTable = DevComponents.DotNetBar.eButtonColor.Office2007WithBackground; - this.btnClearSearchResults.Enabled = false; - this.btnClearSearchResults.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnClearSearchResults.Location = new System.Drawing.Point(237, 3); - this.btnClearSearchResults.Margin = new System.Windows.Forms.Padding(2); - this.btnClearSearchResults.Name = "btnClearSearchResults"; - this.btnClearSearchResults.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.btnClearSearchResults.Size = new System.Drawing.Size(37, 23); - this.superTooltip1.SetSuperTooltip(this.btnClearSearchResults, new DevComponents.DotNetBar.SuperTooltipInfo("Clear Search Results", "", "Clear Search Results just clears out the Search Results list.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnClearSearchResults.TabIndex = 11; - this.btnClearSearchResults.Text = "Clear"; - this.btnClearSearchResults.ThemeAware = true; - this.btnClearSearchResults.Click += new System.EventHandler(this.btnClearSearchResults_Click); - // - // btnCopySearchResults - // - this.btnCopySearchResults.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnCopySearchResults.ColorTable = DevComponents.DotNetBar.eButtonColor.Office2007WithBackground; - this.btnCopySearchResults.Enabled = false; - this.btnCopySearchResults.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnCopySearchResults.Location = new System.Drawing.Point(105, 29); - this.btnCopySearchResults.Margin = new System.Windows.Forms.Padding(2); - this.btnCopySearchResults.Name = "btnCopySearchResults"; - this.btnCopySearchResults.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.btnCopySearchResults.Size = new System.Drawing.Size(43, 23); - this.superTooltip1.SetSuperTooltip(this.btnCopySearchResults, new DevComponents.DotNetBar.SuperTooltipInfo("Copy Search Results", "", "This button copies the Search Results listed below into the copy/paste buffer. Th" + - "e copied data can then be pasted into another tool, such as a spreadsheet.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnCopySearchResults.TabIndex = 10; - this.btnCopySearchResults.Text = "Copy"; - this.btnCopySearchResults.ThemeAware = true; - this.btnCopySearchResults.Click += new System.EventHandler(this.btnCopySearchResults_Click); - // - // btnSaveSearchResults - // - this.btnSaveSearchResults.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnSaveSearchResults.ColorTable = DevComponents.DotNetBar.eButtonColor.Office2007WithBackground; - this.btnSaveSearchResults.Enabled = false; - this.btnSaveSearchResults.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnSaveSearchResults.Location = new System.Drawing.Point(218, 29); - this.btnSaveSearchResults.Margin = new System.Windows.Forms.Padding(2); - this.btnSaveSearchResults.Name = "btnSaveSearchResults"; - this.btnSaveSearchResults.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.btnSaveSearchResults.Size = new System.Drawing.Size(43, 23); - this.superTooltip1.SetSuperTooltip(this.btnSaveSearchResults, new DevComponents.DotNetBar.SuperTooltipInfo("Save Search Results", "", "This button saves the Search Results listed below into a named file in xml.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnSaveSearchResults.TabIndex = 10; - this.btnSaveSearchResults.Text = "Save"; - this.btnSaveSearchResults.ThemeAware = true; - this.btnSaveSearchResults.Click += new System.EventHandler(this.btnSaveSearchResults_Click); - // - // btnLoadSearchResults - // - this.btnLoadSearchResults.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnLoadSearchResults.ColorTable = DevComponents.DotNetBar.eButtonColor.Office2007WithBackground; - this.btnLoadSearchResults.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnLoadSearchResults.Location = new System.Drawing.Point(266, 29); - this.btnLoadSearchResults.Margin = new System.Windows.Forms.Padding(2); - this.btnLoadSearchResults.Name = "btnLoadSearchResults"; - this.btnLoadSearchResults.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.btnLoadSearchResults.Size = new System.Drawing.Size(43, 23); - this.superTooltip1.SetSuperTooltip(this.btnLoadSearchResults, new DevComponents.DotNetBar.SuperTooltipInfo("Load Search Results", "", "This button loads saved Search Results from a named file in xml.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnLoadSearchResults.TabIndex = 10; - this.btnLoadSearchResults.Text = "Load"; - this.btnLoadSearchResults.ThemeAware = true; - this.btnLoadSearchResults.Click += new System.EventHandler(this.btnLoadSearchResults_Click); - // - // labelX1 - // - this.labelX1.AutoSize = true; - // - // - // - this.labelX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.labelX1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelX1.Location = new System.Drawing.Point(3, 5); - this.labelX1.Margin = new System.Windows.Forms.Padding(2); - this.labelX1.Name = "labelX1"; - this.labelX1.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.labelX1.Size = new System.Drawing.Size(66, 14); - this.superTooltip1.SetSuperTooltip(this.labelX1, new DevComponents.DotNetBar.SuperTooltipInfo("Results Style", "", "The Search Results list can be formatted in one of four styles: Document Path, St" + - "ep Path, Annotation Text and Document Text.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.labelX1.TabIndex = 9; - this.labelX1.Text = "Results Style:"; - // - // cmbResultsStyle - // - this.cmbResultsStyle.DisplayMember = "Text"; - this.cmbResultsStyle.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.cmbResultsStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cmbResultsStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cmbResultsStyle.FormattingEnabled = true; - this.cmbResultsStyle.ItemHeight = 14; - this.cmbResultsStyle.Items.AddRange(new object[] { - this.comboItem1, - this.comboItem2, - this.comboItem3, - this.comboItem4}); - this.cmbResultsStyle.Location = new System.Drawing.Point(70, 5); - this.cmbResultsStyle.Margin = new System.Windows.Forms.Padding(2); - this.cmbResultsStyle.Name = "cmbResultsStyle"; - this.cmbResultsStyle.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.cmbResultsStyle.Size = new System.Drawing.Size(110, 20); - this.superTooltip1.SetSuperTooltip(this.cmbResultsStyle, new DevComponents.DotNetBar.SuperTooltipInfo("Results Style", "", "The Search Results list can be formatted in one of four styles: Document Path, St" + - "ep Path, Annotation Text and Document Text.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cmbResultsStyle.TabIndex = 8; - this.cmbResultsStyle.SelectedValueChanged += new System.EventHandler(this.cmbResultsStyle_SelectedValueChanged); - // - // comboItem1 - // - this.comboItem1.Text = "Document Path"; - // - // comboItem2 - // - this.comboItem2.Text = "Step Path"; - // - // comboItem3 - // - this.comboItem3.Text = "Annotation Text"; - // - // comboItem4 - // - this.comboItem4.Text = "Document Text"; - // - // cbSorted - // - this.cbSorted.AutoSize = true; - // - // - // - this.cbSorted.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbSorted.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbSorted.Location = new System.Drawing.Point(152, 33); - this.cbSorted.Margin = new System.Windows.Forms.Padding(2); - this.cbSorted.Name = "cbSorted"; - this.cbSorted.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.cbSorted.Size = new System.Drawing.Size(42, 15); - this.superTooltip1.SetSuperTooltip(this.cbSorted, new DevComponents.DotNetBar.SuperTooltipInfo("Sort Results", "", "Sorts results that are output into the Search Results list shown below.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbSorted.TabIndex = 7; - this.cbSorted.Text = "Sort"; - this.cbSorted.CheckedChanged += new System.EventHandler(this.cbSorted_CheckedChanged); - // - // btnSearch - // - this.btnSearch.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnSearch.BackColor = System.Drawing.SystemColors.Control; - this.btnSearch.ColorTable = DevComponents.DotNetBar.eButtonColor.BlueOrb; - this.btnSearch.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnSearch.Location = new System.Drawing.Point(4, 29); - this.btnSearch.Margin = new System.Windows.Forms.Padding(2); - this.btnSearch.Name = "btnSearch"; - this.btnSearch.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.btnSearch.Size = new System.Drawing.Size(50, 23); - this.superTooltip1.SetSuperTooltip(this.btnSearch, new DevComponents.DotNetBar.SuperTooltipInfo("Search Button", "", "This will perform the search and place the results below.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnSearch.TabIndex = 4; - this.btnSearch.Text = "Search"; - this.btnSearch.ThemeAware = true; - this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click); - // - // btnPrnSrchRslts - // - this.btnPrnSrchRslts.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnPrnSrchRslts.ColorTable = DevComponents.DotNetBar.eButtonColor.Office2007WithBackground; - this.btnPrnSrchRslts.Enabled = false; - this.btnPrnSrchRslts.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnPrnSrchRslts.Location = new System.Drawing.Point(58, 29); - this.btnPrnSrchRslts.Margin = new System.Windows.Forms.Padding(2); - this.btnPrnSrchRslts.Name = "btnPrnSrchRslts"; - this.btnPrnSrchRslts.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.btnPrnSrchRslts.Size = new System.Drawing.Size(43, 23); - this.superTooltip1.SetSuperTooltip(this.btnPrnSrchRslts, new DevComponents.DotNetBar.SuperTooltipInfo("Print Search Results", "", "This button generates a PDF of a standard formatted report regardless of what Res" + - "ults Style is selected.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnPrnSrchRslts.TabIndex = 5; - this.btnPrnSrchRslts.Text = "Print"; - this.btnPrnSrchRslts.ThemeAware = true; - this.btnPrnSrchRslts.Click += new System.EventHandler(this.btnPrnSrchRslts_Click); - // - // sfdSearchResults - // - this.sfdSearchResults.Filter = "XML File (*.xml)|*.xml"; - this.sfdSearchResults.InitialDirectory = "Personal"; - // - // ofdSearchResults - // - this.ofdSearchResults.Filter = "XML File (*.xml)|*.xml"; - this.ofdSearchResults.InitialDirectory = "Personal"; - // - // xpSetToSearch - // - this.xpSetToSearch.CanvasColor = System.Drawing.SystemColors.Control; - this.xpSetToSearch.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.xpSetToSearch.Controls.Add(this.advTreeProcSets); - this.xpSetToSearch.DisabledBackColor = System.Drawing.Color.Empty; - this.xpSetToSearch.Dock = System.Windows.Forms.DockStyle.Top; - this.xpSetToSearch.ExpandOnTitleClick = true; - this.xpSetToSearch.Location = new System.Drawing.Point(0, 147); - this.xpSetToSearch.Margin = new System.Windows.Forms.Padding(2); - this.xpSetToSearch.Name = "xpSetToSearch"; - this.xpSetToSearch.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.xpSetToSearch.Size = new System.Drawing.Size(277, 124); - this.xpSetToSearch.Style.Alignment = System.Drawing.StringAlignment.Center; - this.xpSetToSearch.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.xpSetToSearch.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.xpSetToSearch.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.xpSetToSearch.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.xpSetToSearch.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; - this.xpSetToSearch.Style.GradientAngle = 90; - this.superTooltip1.SetSuperTooltip(this.xpSetToSearch, new DevComponents.DotNetBar.SuperTooltipInfo("Select Procedure Sets to Search", "", "This allows you to select specific procedure sets in which to search.\r\n\r\nIf no p" + - "rocedure sets are selected in this list, then PROMS will search All of the proce" + - "dure sets.\r\n", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(196, 104))); - this.xpSetToSearch.TabIndex = 7; - this.xpSetToSearch.TitleHeight = 21; - this.xpSetToSearch.TitleStyle.Alignment = System.Drawing.StringAlignment.Center; - this.xpSetToSearch.TitleStyle.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.xpSetToSearch.TitleStyle.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.xpSetToSearch.TitleStyle.Border = DevComponents.DotNetBar.eBorderType.RaisedInner; - this.xpSetToSearch.TitleStyle.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.xpSetToSearch.TitleStyle.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.xpSetToSearch.TitleStyle.GradientAngle = 90; - this.xpSetToSearch.TitleText = "Select Procedure Sets"; - this.xpSetToSearch.ExpandedChanged += new DevComponents.DotNetBar.ExpandChangeEventHandler(this.xpSetToSearch_ExpandedChanged); - // - // xpStepTypes - // - this.xpStepTypes.CanvasColor = System.Drawing.SystemColors.Control; - this.xpStepTypes.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.xpStepTypes.Controls.Add(this.advTreeStepTypes); - this.xpStepTypes.DisabledBackColor = System.Drawing.Color.Empty; - this.xpStepTypes.Dock = System.Windows.Forms.DockStyle.Top; - this.xpStepTypes.ExpandOnTitleClick = true; - this.xpStepTypes.Location = new System.Drawing.Point(0, 271); - this.xpStepTypes.Margin = new System.Windows.Forms.Padding(2); - this.xpStepTypes.Name = "xpStepTypes"; - this.xpStepTypes.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.xpStepTypes.Size = new System.Drawing.Size(277, 131); - this.xpStepTypes.Style.Alignment = System.Drawing.StringAlignment.Center; - this.xpStepTypes.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.xpStepTypes.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.xpStepTypes.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.xpStepTypes.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.xpStepTypes.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; - this.xpStepTypes.Style.GradientAngle = 90; - this.superTooltip1.SetSuperTooltip(this.xpStepTypes, new DevComponents.DotNetBar.SuperTooltipInfo("Filter Search by Selected Step Elements", "", "This allows you to search in only the selected step elements.\r\n\r\nIf the Find Sele" + - "cted Step Elements option is selected, search will show you where the selected " + - "Step Elements are use.\r\n", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(240, 115))); - this.xpStepTypes.TabIndex = 8; - this.xpStepTypes.ThemeAware = true; - this.xpStepTypes.TitleHeight = 21; - this.xpStepTypes.TitleStyle.Alignment = System.Drawing.StringAlignment.Center; - this.xpStepTypes.TitleStyle.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.xpStepTypes.TitleStyle.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.xpStepTypes.TitleStyle.Border = DevComponents.DotNetBar.eBorderType.RaisedInner; - this.xpStepTypes.TitleStyle.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.xpStepTypes.TitleStyle.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.xpStepTypes.TitleStyle.GradientAngle = 90; - this.xpStepTypes.TitleText = "Search By Step Element"; - this.xpStepTypes.ExpandedChanged += new DevComponents.DotNetBar.ExpandChangeEventHandler(this.xpStepTypes_ExpandedChanged); - // - // superTooltip1 - // - this.superTooltip1.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray); - this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - // - // checkedListBox1 - // - this.checkedListBox1.FormattingEnabled = true; - this.checkedListBox1.Location = new System.Drawing.Point(110, 46); - this.checkedListBox1.Name = "checkedListBox1"; - this.checkedListBox1.Size = new System.Drawing.Size(120, 79); - this.checkedListBox1.TabIndex = 1; - // - // DisplaySearch - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.grpPanSearchResults); - this.Controls.Add(this.panSearchButtons); - this.Controls.Add(this.xpStepTypes); - this.Controls.Add(this.xpSetToSearch); - this.Controls.Add(this.tabSearchTypes); - this.Controls.Add(this.tabControlPanel1); - //B2025-056 Click on Incoming Transitions - // This needs to be part of overall control - // since if it is part of tabSearchTypes, - // then when that is disabled, buttons on - // this will be also - this.Margin = new System.Windows.Forms.Padding(2); - this.Name = "DisplaySearch"; - this.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - this.Size = new System.Drawing.Size(277, 676); - ((System.ComponentModel.ISupportInitialize)(this.tabSearchTypes)).EndInit(); - this.tabSearchTypes.ResumeLayout(false); - this.tabControlPanel4.ResumeLayout(false); - this.gpSrchText.ResumeLayout(false); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.panel3.ResumeLayout(false); - this.tabControlPanel5.ResumeLayout(false); - this.pnlTranCategory.ResumeLayout(false); - this.pnlTranFormat.ResumeLayout(false); - this.pnlTranVersion.ResumeLayout(false); - this.tabControlPanel2.ResumeLayout(false); - this.gpFindROs.ResumeLayout(false); - this.tabControlPanel3.ResumeLayout(false); - this.tabControlPanel3.PerformLayout(); - this.gpSrchAnnoText.ResumeLayout(false); - this.panel4.ResumeLayout(false); - this.panel4.PerformLayout(); - this.tabControlPanel1.ResumeLayout(false); - this.tabControlPanel1.PerformLayout(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.contextMenuBar1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.advTreeProcSets)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.advTreeStepTypes)).EndInit(); - this.grpPanSearchResults.ResumeLayout(false); - this.panSearchButtons.ResumeLayout(false); - this.panSearchButtons.PerformLayout(); - this.xpSetToSearch.ResumeLayout(false); - this.xpStepTypes.ResumeLayout(false); - this.ResumeLayout(false); - - } - - - - - #endregion - - private DevComponents.DotNetBar.TabControl tabSearchTypes; - private DevComponents.DotNetBar.TabControlPanel tabControlPanel2; - private DevComponents.DotNetBar.TabControlPanel tabControlPanel5; - private DevComponents.DotNetBar.TabItem tabROSearch; - private DevComponents.DotNetBar.TabItem tabTranSearch; - private DevComponents.AdvTree.AdvTree advTreeProcSets; - private DevComponents.AdvTree.Node node1; - private DevComponents.AdvTree.NodeConnector nodeConnector1; - private DevComponents.DotNetBar.ElementStyle elementStyle1; - private DevComponents.AdvTree.AdvTree advTreeStepTypes; - private DevComponents.AdvTree.Node node2; - private DevComponents.AdvTree.NodeConnector nodeConnector2; - private DevComponents.DotNetBar.ElementStyle elementStyle2; - private DevComponents.DotNetBar.Controls.GroupPanel grpPanSearchResults; - private DevComponents.DotNetBar.TabControlPanel tabControlPanel4; - private DevComponents.DotNetBar.TabItem tabStepTypeSearch; - private DevComponents.DotNetBar.Controls.ComboTree cmboTreeROs; - private DevComponents.DotNetBar.Controls.ComboBoxEx cbxAnnoTypes; - private DevComponents.DotNetBar.Controls.ComboBoxEx cbxTextSearchText; - private DevComponents.DotNetBar.PanelEx panSearchButtons; - private DevComponents.DotNetBar.ButtonX btnSearch; - private DevComponents.DotNetBar.ExpandablePanel xpSetToSearch; - private DevComponents.DotNetBar.ExpandablePanel xpStepTypes; - private System.Windows.Forms.ToolTip toolTip1; - private System.Windows.Forms.ListBox lbSrchResults; - private DevComponents.DotNetBar.ListBoxAdv lbSrchResultsIncTrans; - private DevComponents.DotNetBar.SuperTooltip superTooltip1; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxCaseSensitive; - private DevComponents.DotNetBar.Controls.CheckBoxX cbSorted; - private DevComponents.DotNetBar.LabelX labelX1; - private DevComponents.DotNetBar.Controls.ComboBoxEx cmbResultsStyle; - private DevComponents.Editors.ComboItem comboItem1; - private DevComponents.Editors.ComboItem comboItem2; - private DevComponents.Editors.ComboItem comboItem3; - private DevComponents.Editors.ComboItem comboItem4; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxCaseSensitiveAnnoText; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxSrchTypeUsage; - private DevComponents.DotNetBar.Controls.GroupPanel gpSrchAnnoText; - private DevComponents.DotNetBar.Controls.GroupPanel gpSrchText; - private DevComponents.DotNetBar.Controls.ComboBoxEx cbxTextSearchAnnotation; - private DevComponents.DotNetBar.TabControlPanel tabControlPanel3; - private DevComponents.DotNetBar.TabItem tabAnnotationSearch; - private DevComponents.DotNetBar.Controls.CheckBoxX rbtnSrchTxt; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Panel panel1; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxIncROTextSrch; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxProcSectSrch; - private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.Panel panel4; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxFndUnLnkROVals; - private DevComponents.DotNetBar.Controls.GroupPanel gpFindROs; - private DevComponents.DotNetBar.ContextMenuBar contextMenuBar1; - private DevComponents.DotNetBar.ButtonItem btnCMIFindText; - private DevComponents.DotNetBar.ButtonItem btnCMEdit; - private DevComponents.DotNetBar.ButtonItem cmFndTxtCut; - private DevComponents.DotNetBar.ButtonItem cmFndTxtCopy; - private DevComponents.DotNetBar.ButtonItem cmFndTxtPaste; - private DevComponents.DotNetBar.ButtonItem btnCMInsert; - private DevComponents.DotNetBar.ButtonItem cmFndTxtInsHardSp; - private DevComponents.DotNetBar.ButtonItem cmFndTxtInsSymbol; - private DevComponents.DotNetBar.GalleryContainer galSymbols; - private DevComponents.DotNetBar.ButtonItem buttonItem1; - private DevComponents.DotNetBar.ButtonItem buttonItem2; - private DevComponents.DotNetBar.ButtonItem buttonItem3; - private DevComponents.DotNetBar.ButtonItem buttonItem4; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxBooleanTxtSrch; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxBooleanAnoTxtSrch; - private DevComponents.DotNetBar.ButtonItem btnBooleanItems; - private DevComponents.DotNetBar.ButtonItem btnAND; - private DevComponents.DotNetBar.ButtonItem btnOR; - private DevComponents.DotNetBar.ButtonItem btnNOT; - private DevComponents.DotNetBar.ButtonX btnCopySearchResults; - private DevComponents.DotNetBar.ButtonX btnPrnSrchRslts; - private DevComponents.DotNetBar.ButtonX btnClearSearchResults; - private DevComponents.DotNetBar.ButtonX btnSaveSearchResults; - private DevComponents.DotNetBar.ButtonX btnLoadSearchResults; - private System.Windows.Forms.SaveFileDialog sfdSearchResults; - private System.Windows.Forms.OpenFileDialog ofdSearchResults; - //transition search controls - private System.Windows.Forms.Panel pnlTranVersion; - private System.Windows.Forms.Label lblTranVersion; - private DevComponents.DotNetBar.Controls.ComboBoxEx cbxTranVersion; - private System.Windows.Forms.Panel pnlTranFormat; - private System.Windows.Forms.Label lblTranFormat; - private DevComponents.DotNetBar.Controls.ComboBoxEx cbxTranFormat; - private System.Windows.Forms.Panel pnlTranCategory; - private System.Windows.Forms.Label lblTranCategory; - private DevComponents.DotNetBar.Controls.ComboBoxEx cbxTranCategory; - private DevComponents.DotNetBar.LabelX lblSrchRoMsg; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxRnoOnly; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxByWord; - private DevComponents.DotNetBar.TabControlPanel tabControlPanel1; - //private DevComponents.DotNetBar.TabItem tabIncTrans; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.RadioButton rbFromEditor; - private System.Windows.Forms.RadioButton rbFromTree; - private System.Windows.Forms.Button btnTranCvtAllToTxt; - private System.Windows.Forms.Label lblSrchIncTran; - private System.Windows.Forms.Label lblIncTran; - private System.Windows.Forms.CheckedListBox checkedListBox1; - private System.Windows.Forms.Button btnTranCvtSelToTxt; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxRnoOnlyTrans; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxRnoOnlyRO; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxRnoOnlyAnnot; - private DevComponents.DotNetBar.TabItem tabIncTrans; // B2021-061: incorrect variable name was used - rename from tabNISearch to tabIncTrans - //end transition search controls - } -} diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs deleted file mode 100644 index 3ddbe677..00000000 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ /dev/null @@ -1,3662 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using DevComponents.DotNetBar; -using DevComponents.AdvTree; -using Volian.Base.Library; -using System.Text.RegularExpressions; -using JR.Utils.GUI.Forms; -using System.Linq; - -namespace Volian.Controls.Library -{ -#pragma warning disable IDE1006 // Naming Styles -#pragma warning disable IDE0044 // Add readonly modifier - public partial class DisplaySearch : UserControl - { - #region Public Events/Handlers - - public event DisplaySearchEvent PrintRequest; - public event DisplaySearchEvent SearchComplete; - - private void OnPrintRequest(DisplaySearchEventArgs args) - { - PrintRequest?.Invoke(this, args); - } - - private void OnSearchComplete(DisplaySearchEventArgs args) - { - SearchComplete?.Invoke(this, args); - } - - #endregion - - #region Fields - // B2022-026 RO Memeory reduction logic change - defined dummy node text variable to ensure consistancy - private const string DummyNodeText = "VLN_DUMMY_NODE"; - - // B2023-076: Adding option to select all procedure sets - private const string SelectAllProcedureSetsText = "Select All Procedure Sets"; - - // B2019-161 When tracking timing time this action - private static VolianTimer _TimeActivity = new VolianTimer("DisplaySearch _TmrRefresh_Tick", 399); - private Timer _TmrRefresh = null; - - public FormatVersionList myFormatVersionList; - private ItemInfo _SearchIncTransII = null; - private static UserInfo _MyUserInfo = null; - private string _strSrchText = string.Empty; - private List lstCheckedDocVersions = new List(); - private List lstCheckedStepTypes = new List(); - private List lstCheckedStepTypesStr = new List(); - private AnnotationDetails _AnnotationDetails = null; - public ItemInfo _ItemInfo = null; - private DisplayTabControl _TabControl; - private DocVersionInfo _MyDocVersion; - private Color saveXpSetToSearchColor; - private Color saveXpStepTypeTitleColor; - private Color saveGpSrchAnnoTextColor; - private Color saveGpSrchTextColor; - private Color saveGpFindROsColor; - private Color saveGrpPanSearchResults; - private ItemInfoList _SearchResults; - - private string _DisplayMember = "SearchPath_clean"; - private bool _OpenDocFromSearch; - private ROFSTLookup _MyROFSTLookup; - private bool _LoadingList = false; - private int LastResultsMouseOverIndex = -1; - private ProgressBarItem _ProgressBar; - - DevComponents.AdvTree.Node wordSectionTreeNode = null; // C2020-010: Disable Word Section choice for Transition search - - private static int _lastRoFstId = -1; - private Dictionary dicSelectedFolderNodes = new Dictionary(); - private Dictionary dicExpandedFolderNodes = new Dictionary(); - private int _TopFolderID = 1; - private bool _ProcessingSelectedValueChanged = false; - - // Search Related Fields - private bool _LastSearchWasAnnotations = false; // B2019-119 only refresh annotation search results if an annotation search was done - - // ProcSetSelection Related Fields - private int _MyRODbID; - private static bool checkingChildren = false; - - // A timer updated the step type tree but if it was loaded from xml the timer update overwrite what - // was loaded in from the xml file. Added a flag that gets set on load and set to false on new Search - private bool _fromLoad = false; - private string _ReportTitle; - private string _SearchString = null; - private string _TypesSelected; - - private bool fromTranCvtBtn = false; - - #endregion - - #region Properties - - // C2020-033: SearchIncTransII represents the item that the transitions go to. It can be either the item the user - // tried to delete or that the user selected to get Incoming Transitions from tree view or ribbon. - public ItemInfo SearchIncTransII - { - get { return _SearchIncTransII; } - set - { - _SearchIncTransII = value; - - if (_SearchIncTransII != null) - lblSrchIncTran.Text = _SearchIncTransII.Path; - else - lblSrchIncTran.Text = string.Empty; - } - } - - public static UserInfo MyUserInfo - { - get { return _MyUserInfo; } - set { _MyUserInfo = value; } - } - - public ItemInfoList SearchResults - { - get { return _SearchResults; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - - _SearchResults = value; - - if (value != null) // Don't select an item from the list when it is updated - _SearchResults.ListChanged += new ListChangedEventHandler(_SearchResults_ListChanged); - - DisplayResults(); - - // B2022-044: don't set selection to top of list (commented out/changed if). Remove event that does this - // after results are displayed. Without this, the code in _SearchResults_ListChanged was run upon selections - if (value != null) - _SearchResults.ListChanged -= new ListChangedEventHandler(_SearchResults_ListChanged); - } - } - - public bool OpenDocFromSearch - { - get { return _OpenDocFromSearch; } - } - - public DocVersionInfo Mydocversion - { - get { return _MyDocVersion; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - - _MyDocVersion = value; - - if (_MyDocVersion != null) - { - if (_MyDocVersion.DocVersionAssociationCount > 0) - { - // if the count variable is not consistent with the actual list count, - // do a refresh. There was a bug, B2012-040, that was not reproducible.. - // so this is an attempt to fix it. - if (_MyDocVersion.DocVersionAssociations.Count == 0) - { - _MyDocVersion.RefreshDocVersionAssociations(); - if (_MyDocVersion.DocVersionAssociations.Count == 0) return; - } - MyROFSTLookup = _MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(_MyDocVersion); - _MyRODbID = _MyDocVersion.DocVersionAssociations[0].MyROFst.RODbID; - } - } - else - { - MyROFSTLookup = null; - } - } - } - - public ROFSTLookup MyROFSTLookup - { - get { return _MyROFSTLookup; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - - bool beforeIsNotNull = _MyROFSTLookup != null; - bool afterIsNotNull = value != null; - //if (!Visible) return; // don't reset anything if the form is invisible. - _MyROFSTLookup = value; // define the tree nodes based on this rofst - - if (beforeIsNotNull || afterIsNotNull) - { - LoadROComboTree();// B2017-215 Added logic so that database is not accessed during initialization. - } - } - } - - public bool LoadingList - { - get { return _LoadingList; } - set { _LoadingList = value; } - } - - public ProgressBarItem ProgressBar - { - get { return _ProgressBar; } - set { _ProgressBar = value; } - } - - public Timer TmrRefresh - { - get - { - if (_TmrRefresh == null) - { - _TmrRefresh = new Timer - { - Interval = 1000 - }; - _TmrRefresh.Tick += _TmrRefresh_Tick; - } - return _TmrRefresh; - } - } - - public int TopFolderID - { - get { return _TopFolderID; } - set { _TopFolderID = value; } - } - - public string ReportTitle - { - get { return _ReportTitle; } - set { _ReportTitle = value; } - } - - public string SearchString - { - get { return _SearchString; } - set { _SearchString = value; } - } - - public string TypesSelected - { - get { return _TypesSelected; } - set { _TypesSelected = value; } - } - - #region (Search) - - private string DVISearchList - { - get - { - // append list of document versions to search - if (lstCheckedDocVersions.Count > 0) - { - string strRtnStr = string.Empty; - // get list of doc versions to search - foreach (DocVersionInfo dvi in lstCheckedDocVersions) - { - strRtnStr += string.Format(",{0}", dvi.VersionID.ToString()); - } - return strRtnStr.Substring(1); - } - return string.Empty; - } - } - - private string TypeSearchList - { - get - { - // append list of step types to search - if (lstCheckedStepTypes.Count > 0) - { - string strRtnStr = string.Empty; - // get list of selected types - foreach (int typ in lstCheckedStepTypes) - { - int tmp = typ; - if (tmp == 0) - tmp = 10000; // this is the accessory page type - else - tmp += 20000; // step/substep types - strRtnStr += string.Format(",{0}", tmp); - } - return strRtnStr.Substring(1); - } - - return string.Empty; - } - } - - private string TextSearchString - { - get - { - if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[0]) - return ConvertSpecialChars(cbxTextSearchText.Text); - - return string.Empty; - } - } - - private string AnnotationSearchType - { - get - { - if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1]) - return ((AnnotationTypeSearch)cbxAnnoTypes.SelectedValue).ID; - - return string.Empty; - } - } - - private string ROSearchList - { - get - { - if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[2]) - { // RO Search - ROFSTLookup.rochild ch; - if (cmboTreeROs.SelectedNode != null) - { - if (cbxFndUnLnkROVals.Enabled && cbxFndUnLnkROVals.Checked) - { - ch = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag; - _strSrchText = string.Format("{0}", ch.value); - return _strSrchText; // append RO Value text to search - } - else - { - if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rodbi db) - { - return $"{_MyRODbID.ToString()}:{string.Format("{0}", db.dbiID.ToString("X4"))}"; - } - else if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rochild roch) - { - ROFSTLookup.rochild[] chld = roch.children; - // build a list of ROs to search - // B2022-118: remove the ending comma otherwise query will fail - string strRtnStr = $"{_MyRODbID.ToString()}:{GetROsToSearch(chld)}"; - if (strRtnStr.EndsWith(",")) - strRtnStr = strRtnStr.Substring(0, strRtnStr.Length - 1); - return strRtnStr; - } - } - } - } - return string.Empty; - } - } - - public bool LastSearchWasAnnotations - { - get { return _LastSearchWasAnnotations; } - set { _LastSearchWasAnnotations = value; } - } - - #endregion - - #endregion - - #region Constructor - - public DisplaySearch() - { - InitializeComponent(); - LoadSearchTextListBox(); - saveXpSetToSearchColor = xpSetToSearch.TitleStyle.BackColor1.Color; - saveXpStepTypeTitleColor = xpStepTypes.TitleStyle.BackColor1.Color; - saveGpSrchAnnoTextColor = gpSrchAnnoText.Style.BackColor; - saveGpSrchTextColor = gpSrchText.Style.BackColor; - saveGpFindROsColor = gpFindROs.Style.BackColor; - gpSrchText.Style.BackColor = Color.Yellow; - saveGrpPanSearchResults = grpPanSearchResults.Style.BackColor; - - // start out with the procedure and type selection windows colasped - xpSetToSearch.Expanded = false; - xpStepTypes.Expanded = false; - rbtnSrchTxt.Checked = true; - gpSrchAnnoText.Enabled = true; - cmbResultsStyle.Enabled = false; - tabSearchTypes.SelectedTabChanged += new TabStrip.SelectedTabChangedEventHandler(tabSearchTypes_SelectedTabChanged); - // Don't do this here. If you do then the /DB parameter has not yet been set, which will cause the database menu to be displayed - } - - #endregion - - #region Public Methods - - public void _SearchResults_ListChanged(object sender, ListChangedEventArgs e) - { - lbSrchResults.SelectedIndex = -1; // Don't select an item from the new list - lbSrchResultsIncTrans.SelectedIndex = -1; - } - - public void tabSearchTypes_SelectedTabChanged(object sender, TabStripTabChangedEventArgs e) - { - if (wordSectionTreeNode != null) //B2020-070 NULL reference check - wordSectionTreeNode.Enabled = true; - btnSearch.Enabled = true; - xpSetToSearch.Enabled = true; - xpStepTypes.Enabled = true; - lbSrchResults.Visible = true; - lbSrchResultsIncTrans.Visible = false; - cbxRnoOnly.Visible = true; - - // C2025-062 When Search clicked - Load the Incoming transitions for the Active Procedure - //don't allow changing the Style for Incoming Transitions - //but allow them to change it if there are search results and it is another tab - if (_SearchResults != null && _SearchResults.Count > 0) - { - cmbResultsStyle.Enabled = true; - } - - if (e.NewTab == tabIncTrans) // C2020-033: Incoming transitions - { - xpSetToSearch.Enabled = false; - xpStepTypes.Enabled = false; - lbSrchResults.Visible = false; - lbSrchResultsIncTrans.Visible = true; - lbSrchResultsIncTrans.CheckBoxesVisible = true; - lbSrchResultsIncTrans.AutoScroll = true; - cmbResultsStyle.Enabled = false; - cbxRnoOnly.Visible = false; - } - else if (e.NewTab == tabROSearch) - { - LoadROComboTree(); - } - else if (e.NewTab == tabTranSearch) - { - if (wordSectionTreeNode != null) //B2020-070 NULL reference check - { - wordSectionTreeNode.Enabled = false; // C2020-010: Disable Word Section choice for Transition search - wordSectionTreeNode.Checked = false; - } - btnSearch.Enabled = (cbxTranCategory.Items.Count > 0); // B2017-038 disable search button if no format selected - //enable-disable doc version nodes based on version type if selected - //setup transition format versions - this.Cursor = Cursors.WaitCursor; - if (myFormatVersionList == null) - { - this.Refresh(); - myFormatVersionList = FormatVersionList.GetFormatVersions(); - cbxTranVersion.DisplayMember = "Title"; - - List fvlst = myFormatVersionList.GroupBy(x => x.FormatID).Select(group => new - FormatVersion(title: group.Max(x => x.Title), - formatID: group.Key, - versionID: group.Max(x => x.VersionID) - )).OrderBy(y => y.Title).ToList(); - - //B2026-055 – Transition Search Improvements - //Added an All option to allow resetting of the enabling/disabling tree options - cbxTranVersion.Items.Add(new FormatVersion("All", -1, -1)); - - foreach (FormatVersion fv in fvlst) - { - cbxTranVersion.Items.Add(fv); - } - - cbxTranVersion.SelectedIndexChanged -= new EventHandler(cbxTranVersion_SelectedIndexChanged); - cbxTranVersion.SelectedIndexChanged += new EventHandler(cbxTranVersion_SelectedIndexChanged); - cbxTranFormat.SelectedIndexChanged -= new EventHandler(cbxTranFormat_SelectedIndexChanged); - cbxTranFormat.SelectedIndexChanged += new EventHandler(cbxTranFormat_SelectedIndexChanged); - } - this.Cursor = Cursors.Default; - } - else - { - foreach (DevComponents.AdvTree.Node n in dicExpandedFolderNodes.Keys) - n.Enabled = true; - if (dicSelectedFolderNodes.Count > 0) - { - foreach (DevComponents.AdvTree.Node n in dicSelectedFolderNodes.Keys) - { - n.Enabled = true; - } - dicSelectedFolderNodes.Clear(); - } - } - } - - public void cbxTranFormat_SelectedIndexChanged(object sender, EventArgs e) - { - #region 2nd cut - if (cbxTranFormat.SelectedItem.ToString().Contains("{Proc")) - { - cbxTranCategory.Items.Clear(); - cbxTranCategory.Items.Add("All"); - cbxTranCategory.Items.Add("External"); - cbxTranCategory.Items.Add("Outside"); - cbxTranCategory.SelectedIndex = 0; - } - else - { - cbxTranCategory.Items.Clear(); - cbxTranCategory.Items.Add("All"); - cbxTranCategory.Items.Add("Internal"); - cbxTranCategory.Items.Add("External"); - cbxTranCategory.Items.Add("Outside"); - cbxTranCategory.SelectedIndex = 0; - } - #endregion - - btnSearch.Enabled = true; // B2017-038 enable search button if when a format selected - } - - public void cbxTranVersion_SelectedIndexChanged(object sender, EventArgs e) - { - this.Cursor = Cursors.WaitCursor; - string versionList = string.Empty; - string sep = string.Empty; - FormatVersion sfv = cbxTranVersion.SelectedItem as FormatVersion; - - versionList = string.Join(",", myFormatVersionList.Where(x => x.FormatID == sfv?.FormatID).Select(y => y.VersionID)); - - cbxTranVersion.Tag = versionList; - cbxTranFormatFillIn(versionList); - - List uncheckNodes = new List(); - foreach (DevComponents.AdvTree.Node n in dicSelectedFolderNodes.Keys) - { - FolderInfo fi = n.Tag as FolderInfo; // this was crashing in old version of code - // if this folder has a docversion, use its id: - string svid = null; - if (fi?.FolderDocVersionCount > 0) - svid = fi.FolderDocVersions[0].VersionID.ToString(); - if (svid != null && !string.IsNullOrEmpty(versionList) && !versionList.Split(',').Contains(svid)) - uncheckNodes.Add(n); - else - n.Enabled = true; - } - while (uncheckNodes.Count > 0) - { - uncheckNodes[0].Checked = false; - uncheckNodes[0].Enabled = false; - uncheckNodes.Remove(uncheckNodes[0]); - } - if (lstCheckedDocVersions.Count > 0) - { - if (FlexibleMessageBox.Show(this, "Do you want to expand to all relevant procedure sets for the selected format?", "Expand Procedure Sets", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) - { - lstCheckedDocVersions.Clear(); - foreach (DevComponents.AdvTree.Node n in dicSelectedFolderNodes.Keys) - uncheckNodes.Add(n); - while (uncheckNodes.Count > 0) - { - uncheckNodes[0].Checked = false; - uncheckNodes.Remove(uncheckNodes[0]); - } - dicSelectedFolderNodes.Clear(); - } - } - - //B2026-055 – Transition Search Improvements - //Update Enabling/Disabling of Tree Elements - TraverseTree(advTreeProcSets.Nodes[0], cbxTranVersion.Tag?.ToString().Split(',')); - - this.Cursor = Cursors.Default; - } - - // C2020-033: Update the search panel for Incoming transitions. This gets called from the tree view & the ribbon - public void UpdateSearchIncTransResults() - { - tabSearchTypes.SelectedTab = tabSearchTypes.Tabs[4]; - - lbSrchResultsIncTrans.DataSource = null; - lbSrchResultsIncTrans.Items.Clear(); - // Get item to do search for, either from tree or from editor - if (SearchIncTransII != null) - { - // B2021-010: Use IncomingTranGetMergedTranList to get a complete list of incoming transitions (transitions to procedure - // were only included if there were NO transitions to items within procedure) - SearchResults = IncomingTranGetMergedTranList(); - ReportTitle = string.Format("Search For Incoming Transitions to {0}: ", SearchIncTransII.Path); - } - if (SearchResults != null && SearchResults.Count > 0) - { - AddMessageForEmptyAnnotations(); - cmbResultsStyle.SelectedIndex = 1; //display step locations in results - DisplayResults(); - //If any transitions are listed after the Convert, Admin Tools/Links/Refresh Transitions can be used to fix incorrect links. This will eliminate any in the list. - // B2023-103 if any items are left in search list, there may be bad transition link data - put out a message box - if (fromTranCvtBtn) - FlexibleMessageBox.Show(this, "If items remain in the list after performing Convert All to Text, running Admin Tools/Links/Refresh Transitions will clear the list.", - "Convert Transitions to Text", MessageBoxButtons.OK); - } - else - { - btnPrnSrchRslts.Enabled = false; - btnClearSearchResults.Enabled = false; - btnCopySearchResults.Enabled = false; - btnSaveSearchResults.Enabled = false; - cmbResultsStyle.Enabled = false; - if (!fromTranCvtBtn) FlexibleMessageBox.Show("No Matches Found.", "Search"); // B2021-009: Research after convert transitions to text - } - btnTranCvtAllToTxt.Enabled = IncTransCvtAllToTextPerm(); - btnTranCvtSelToTxt.Enabled = false; - } - - public bool IncTranCvtPerm() - { - FolderInfo topFolder = FolderInfo.Get(1); - FolderConfig fc = topFolder.MyConfig as FolderConfig; - return fc.General_IncTranCvtPerm; - } - - #region (ROFST Combo Tree) - - public void StartAdvTreeStepTypesFillIn()// B2016-258 Hang after selecting a procedure if the Step Type panel is open on the search panel - { - TmrRefresh.Enabled = true; - } - - public void AdvTreeStepTypesFillIn() - { - DevComponents.AdvTree.Node topnode = new DevComponents.AdvTree.Node(); - advTreeStepTypes.Nodes.Clear(); - lstCheckedStepTypes.Clear(); - lstCheckedStepTypesStr.Clear(); - topnode.Text = "Types"; - advTreeStepTypes.Nodes.Add(topnode); - FormatData fmtdata = null; - // B2017-181: selecting/deselecting, and no nodes are selected was causing null reference when trying - // to access the DocVersion (none are selected), use the format off of the top folder: - if (_MyDocVersion == null) - { - FolderInfo fi = FolderInfo.Get(TopFolderID); - fmtdata = fi.ActiveFormat.PlantFormat.FormatData; - } - else - { - fmtdata = _MyDocVersion.ActiveFormat.PlantFormat.FormatData; - } - List lstSrchStpTypes = fmtdata.GetSearchableSteps(); // list of searchable step types - if (lstSrchStpTypes != null && lstSrchStpTypes.Count > 0) - { - DevComponents.AdvTree.Node newnode; - advTreeStepTypes.Nodes.Clear(); - // Add a dummy node for searching Word Sections (MS Word sections) - newnode = NewAdvTreeNode("WORD Sections", true, true); // C2020-010: Change Accessory Sections to Word Sections - wordSectionTreeNode = newnode; - // C2021-028: RNO Only search, disable Word section tree node - wordSectionTreeNode.Enabled = !(tabSearchTypes.SelectedTab == tabTranSearch || cbxRnoOnly.Checked); - advTreeStepTypes.Nodes.Add(newnode); - - // C2023-010: Allow selecting all section types or none - newnode = NewAdvTreeNode("All Types", true, true); - newnode.NodeClick += new EventHandler(AllSectionTypes_clicked); - advTreeStepTypes.Nodes.Add(newnode); - - foreach (StepDataRetval sdr in lstSrchStpTypes) - { - StepDataList sdl = fmtdata.StepDataList; ; - StepData sd = sdl[sdr.Index]; // get the step type record - string parentName = sd.ParentType; // this gets the parent of the this step/substep type - - if (parentName.Equals("Base")) - { - newnode = NewAdvTreeNode(sdr.Name, true, true); - newnode.Tag = sd; - newnode.Name = sd.Type; - DevComponents.AdvTree.Node pnode = NewAdvTreeNode(sd.Type, true, true); //create parent node (non selectable) - pnode.Name = sd.Type; - if (!sd.Type.Equals("Title")) // only use Title as a tree grouping to put Title with Text Right/Below substep types - pnode.Nodes.Add(newnode); - pnode.Nodes.Sort(); - advTreeStepTypes.Nodes.Add(pnode); - - //C2030-010: - pnode.NodeClick += new EventHandler(pnode_selected); - } - else if (sd.Type.Equals("RNOType")) // B2019-016 Allow for search of RNO step types (when selecting types to search) - { - newnode = NewAdvTreeNode(sdr.Name, true, true); - newnode.Tag = sd; - newnode.Name = sd.Type; - advTreeStepTypes.Nodes.Add(newnode); - } - else if (sd.Type.Equals("RNOType")) // B2019-016 Allow for search of RNO step types (when selecting types to search) - { - newnode = NewAdvTreeNode(sdr.Name, true, true); - newnode.Tag = sd; - newnode.Name = sd.Type; - advTreeStepTypes.Nodes.Add(newnode); - } - else - { - // B2016-236: for global search – change ‘AER’ to ‘Left’ in list of step types for figures - string nameInTree = sdr.Name; - if (sdr.Name.Contains("AER") && sdr.Name.ToUpper().Contains("FIGURE")) nameInTree = nameInTree.Replace("AER", "Left"); - newnode = NewAdvTreeNode(nameInTree, true, true); - newnode.Name = sd.Type; // this needed for the FindNodeByName() function - newnode.Tag = sd; - - // if the parent node exists in the tree, then add the new node to that parent - // else, it is a parent node, so add it as a new parent - - DevComponents.AdvTree.Node parnode = advTreeStepTypes.FindNodeByName(parentName); - // Group by High Level Steps, Substeps, Cautions, Notes, Figures, Tables and Equations - while (!parentName.Equals("Base") && !parentName.Equals("Substep") && !parentName.Equals("High") && - !parentName.Equals("Caution") && !parentName.Equals("Note") && !parentName.Equals("Table") && - !parentName.Equals("Figure") && !parentName.Equals("Title") && - !parentName.Equals("And") && !parentName.Equals("Or") && !parentName.Equals("Paragraph") && !parentName.Equals("Equation")) - { - StepData tmpsd = (StepData)parnode.Tag; - parentName = tmpsd.ParentType; - parnode = advTreeStepTypes.FindNodeByName(parentName); - } - if (parnode != null) - { - parnode.Nodes.Add(newnode); - parnode.Nodes.Sort(); // sort the second level of the tree - } - else - advTreeStepTypes.Nodes.Add(newnode); - } - } - advTreeStepTypes.Nodes.Sort(); // sort the first level of the tree - } - buildStepTypePannelTitle(); - } - - private void AllProcedureSets_clicked(object sender, EventArgs e) - { - Node pNode = sender as Node; - foreach (Node node in advTreeProcSets.Nodes) - { - node.Checked = pNode.Checked; - CheckTreeNodeChildren(node.Nodes); - } - // B2023-112: Clear the docversion list - this flags 'All' when the 'All Proc Sets' tree node is checked and 'None' when it isn't. Then - // Use buildSetToSearchPanelTitle to set the text for how many sets are in search. - lstCheckedDocVersions.Clear(); - buildSetToSearchPanelTitle(); - } - - private void AllSectionTypes_clicked(object sender, EventArgs e) - { - Node pNode = sender as Node; - foreach (Node node in advTreeStepTypes.Nodes) - { - node.Checked = pNode.Checked; - CheckTreeNodeChildren(node.Nodes); - } - } - - //C2023-010: Select all child nodes when a subtype is selected - private void pnode_selected(object sender, EventArgs e) - { - if (sender is DevComponents.AdvTree.Node pnode && pnode.HasChildNodes) - { - CheckTreeNodeChildren(pnode.Nodes); - } - } - - public void advTreeProcSetsFillIn(bool blSeachTabClicked) - { - DevComponents.AdvTree.Node topnode = null; - int cntnd = 0; - VETreeNode vtn = VETreeNode.GetFolder(TopFolderID); - FolderInfo fi = vtn.VEObject as FolderInfo; - int fiCount = fi.ChildFolderCount; - advTreeProcSets.Nodes.Clear(); - lstCheckedDocVersions.Clear(); - topnode = new DevComponents.AdvTree.Node - { - Text = "Available Procedure Sets", - Tag = fi, - DataKey = fi.FolderID - }; - advTreeProcSets.Nodes.Add(topnode); - - //B2023-076: Adding option to select all procedure sets - DevComponents.AdvTree.Node selectAllNode = new Node - { - Text = SelectAllProcedureSetsText, - Tag = SelectAllProcedureSetsText, - CheckBoxVisible = true - }; - selectAllNode.NodeClick += new EventHandler(AllProcedureSets_clicked); - topnode.Nodes.Add(selectAllNode); - - if (fi.SortedChildFolders != null) - { - foreach (FolderInfo fic in fi.SortedChildFolders) - { - DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node - { - Text = fic.ToString(), - Tag = fic, - DataKey = fi.FolderID - }; - AddCheckBox(true, newnode);//C2016-045 Allow Folders to be selected. - cntnd++; - if (fic.ChildFolderCount > 0 || fic.FolderDocVersionCount > 0) // allow for '+' for tree expansion - { - if (fic.ChildFolderCount > 0) // B2017-176: Do not display the Working Draft node (don't create dummy for expander) - { - DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node - { - Text = DummyNodeText - }; - newnode.Nodes.Add(tnt); - } - topnode.Nodes.Add(newnode); - } - } - } - else - { - DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node - { - Text = fi.ToString(), - Tag = fi, - DataKey = fi.FolderID - }; - AddCheckBox(true, newnode);//C2016-045 Allow Folders to be selected. - topnode.Nodes.Add(newnode); - lstCheckedDocVersions.Add(Mydocversion); - buildSetToSearchPanelTitle(); - } - // if nothing was added to the tree, just put in the node above the docversions... - if (advTreeProcSets.Nodes.Count == 0) - { - cntnd++; - fi = Mydocversion.MyFolder; - topnode = new DevComponents.AdvTree.Node - { - Text = fi.ToString() - }; - advTreeProcSets.Nodes.Add(topnode); - topnode.Tag = fi; - topnode.DataKey = fi.FolderID; - } - - advTreeProcSets.BeforeExpand -= new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(advTreeProcSets_BeforeExpand); - advTreeProcSets.BeforeExpand += new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(advTreeProcSets_BeforeExpand); - - // position to the procedure set in the tree if we have a procedure open - if (Mydocversion != null) - advTreeProcSetsPreSelect(); - else - 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 - } - - public void advTreeProcSets_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e) - { - DevComponents.AdvTree.Node par = e.Node; - // get first child's text, if it has one & if the text is "VLN_DUMMY_NODE", load children - DevComponents.AdvTree.Node tn = null; - if (par.Nodes.Count > 0) tn = par.Nodes[0]; - if (tn.Text == DummyNodeText) // expand this - { - par.Nodes.Clear(); - Object obj = par.Tag; - if (!(obj is FolderInfo)) return; // should always be folderinfo on expand - FolderInfo fi = (FolderInfo)obj; - if (fi.ChildFolderCount > 0) - { - foreach (FolderInfo fic in fi.SortedChildFolders) - { - DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node - { - Text = fic.ToString(), - Tag = fic, - DataKey = fic.FolderID - }; - par.Nodes.Add(newnode); - AddCheckBox(true, newnode);//C2016-045 Allow Folders to be selected. - newnode.Enabled = true; - - if (fic.ChildFolderCount > 0) // B2017-176: Only expand if folder has folders (not working draft nodes) - { - DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node - { - Text = DummyNodeText - }; - newnode.Nodes.Add(tnt); - // B2017-176: Only expand if folder has folders (not working draft nodes): the following was moved from the code - // that would check if this should be enabled if seraching for transition types. The transition controls - // had a list of associated docversions, so needed to get the docversion in the folder: - if (tabSearchTypes.SelectedTab == tabTranSearch && !dicSelectedFolderNodes.ContainsKey(newnode)) - dicSelectedFolderNodes.Add(newnode, false); - } - - if (tabSearchTypes.SelectedTab == tabTranSearch) - { - //B2026-055 – Transition Search Improvements - //Update Enabling/Disabling of Tree Elements - TraverseTree(advTreeProcSets.Nodes[0], cbxTranVersion.Tag?.ToString().Split(',')); - } - } - } - } - } - - public void AdvTree_AfterExpandorCollapse(object sender, AdvTreeNodeEventArgs e) - { - Node bottomNode = BottomTreeNode(cmboTreeROs.AdvTree.Nodes); - _ = cmboTreeROs.AdvTree.Nodes[cmboTreeROs.AdvTree.Nodes.Count - 1]; //LastNode - - int top = cmboTreeROs.AdvTree.Nodes[0].Bounds.Top; - int bottom; - int hScrollBarHeight = cmboTreeROs.AdvTree.HScrollBar != null ? cmboTreeROs.AdvTree.HScrollBar.Height : 0; - bottom = bottomNode.Bounds.Bottom + 5; - cmboTreeROs.AdvTree.Size = new Size(cmboTreeROs.AdvTree.Size.Width, Math.Min(525, bottom - top + hScrollBarHeight)); - - if (cmboTreeROs.AdvTree.VScrollBar != null && bottom < cmboTreeROs.AdvTree.Size.Height) - { - int yLookFor = (bottom - cmboTreeROs.AdvTree.Size.Height) + 2 * hScrollBarHeight; - Node topNode = FindTreeNodeAt(cmboTreeROs.AdvTree.Nodes, yLookFor); - topNode?.EnsureVisible(); - } - } - - #endregion - - #region (Annotation Search) - - public void SetupAnnotationSearch(AnnotationDetails annotationDetails, DisplayTabControl tc) - { - _AnnotationDetails = annotationDetails; - List annoTypes = new List - { - new AnnotationTypeSearch("All Annotations", string.Empty) - }; - AnnotationTypeInfoList annoList = AnnotationTypeInfoList.Get(); - foreach (AnnotationTypeInfo ati in annoList) - annoTypes.Add(new AnnotationTypeSearch(ati.Name, ati.TypeID.ToString())); - cbxAnnoTypes.DisplayMember = "Name"; - cbxAnnoTypes.DataSource = annoTypes; - lbSrchResults.MouseMove -= new MouseEventHandler(lbSrchResults_MouseMove); - lbSrchResults.MouseMove += new MouseEventHandler(lbSrchResults_MouseMove); - _TabControl = tc; - } - - #endregion - - #region (Search Results) - - public void UpdateAnnotationSearchResults() - { - if (!LastSearchWasAnnotations) return; // B2019-119 only refresh annotation search results if an annotation search was done - // B2019-004: update search results list when an annotation is removed. (before bug fix, code method & code below was commented out) - string unitPrefix = string.Empty; - - if (Mydocversion != null) - unitPrefix = Mydocversion.DocVersionConfig.Unit_ProcedureNumber; - - if (unitPrefix.EndsWith("#")) - unitPrefix = unitPrefix.Replace("#", string.Empty); - - // C2023-005: Lose list position after delete. Save selected index to restore after & don't open the - // section after reset of index (UpdateAnnotationList setting below) - int curindx = lbSrchResults.SelectedIndex; - - SearchResults = ItemInfoList.GetListFromAnnotationSearch(DVISearchList, TypeSearchList, AnnotationSearchType, cbxTextSearchAnnotation.Text, cbxCaseSensitiveAnnoText.Checked, unitPrefix); - - DisplayResults(); - UpdatedAnnotationList = true; - // C2023-007: C2023-005 reset position after delete but positioned to item before deleted item, modified the - // list reset to position after deleted item - lbSrchResults.SelectedIndex = curindx < 0 ? -1 : curindx == lbSrchResults.Items.Count ? curindx - 1 : curindx; - UpdatedAnnotationList = false; - } - private bool UpdatedAnnotationList = false; - #endregion - - #region (ContextMenu) - - // Changed to a public so that it could be called after the /DB parameter has been processed - public void SetupContextMenu() - { - galSymbols.SubItems.Clear(); - // Bug fix B2014-057 - // if we are searching for a symbol character in all procedure sets MyDocVersion is null - // when MyDocVersion is null, get the symbol list directly from the PROMS base format (BaseAll.xml) - // this will populate the context menu of the Search text entry field so that a symbol can be selected without first selecting a procedure set - FormatData fmtdata = (_MyDocVersion != null) ? _MyDocVersion.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData; - - if (fmtdata != null && fmtdata.SymbolList != null) - { - SymbolList sl = fmtdata.SymbolList; - - if (sl == null || sl.Count <= 0) - { - FlexibleMessageBox.Show("No symbols are available, check with administrator"); - return; - } - - foreach (Symbol sym in sl) - { - DevComponents.DotNetBar.ButtonItem btnCM = new DevComponents.DotNetBar.ButtonItem - { - Text = string.Format("{0}", (char)sym.Unicode), - // to name button use unicode rather than desc, desc may have spaces or odd chars - Name = $"btnCM{sym.Unicode.ToString()}", - Tooltip = sym.Desc, - Tag = string.Format(@"{0}", sym.Unicode), - FontBold = true - }; - btnCM.Click += new System.EventHandler(btnSym_Click); - galSymbols.SubItems.Add(btnCM); - } - } - } - - #endregion - - #region (Refresh Timer) - - public void _TmrRefresh_Tick(object sender, EventArgs e) - { - // B2016-258 Hang after selecting a procedure if the Step Type panel is open on the search panel - _TimeActivity.Open(); - - TmrRefresh.Enabled = false; - if (!_fromLoad) AdvTreeStepTypesFillIn(); // Don't reload if coming from Load - this overwrites the load settings - - _TimeActivity.Close(); - } - - #endregion - - #endregion - - #region Private Methods - - private void LoadSearchTextListBox() - { - // Setup SearchText Combo - cbxTextSearchText.Items.Clear(); - if (Properties.Settings.Default["SearchList"] != null && Properties.Settings.Default.SearchList.Count > 0) - { - foreach (string str in Properties.Settings.Default.SearchList) - cbxTextSearchText.Items.Add(str); - } - // Setup SearchAnnotation Combo - cbxTextSearchAnnotation.Items.Clear(); - if (Properties.Settings.Default["SearchAList"] != null && Properties.Settings.Default.SearchAList.Count > 0) - { - foreach (string str in Properties.Settings.Default.SearchAList) - cbxTextSearchAnnotation.Items.Add(str); - } - } - - private DevComponents.AdvTree.Node NewAdvTreeNode(string nodetext, bool selectable, bool chxbxvisable) - { - DevComponents.AdvTree.Node newnode; - newnode = new DevComponents.AdvTree.Node - { - Text = nodetext, - Selectable = selectable - }; - AddCheckBox(chxbxvisable, newnode);//C2016-045 Allow Folders to be selected. - return newnode; - } - - private void AddCheckBox(bool chxbxvisable, DevComponents.AdvTree.Node newnode) - { - //C2016-045 Allow Folders to be selected. - newnode.CheckBoxAlignment = DevComponents.AdvTree.eCellPartAlignment.NearCenter; - newnode.CheckBoxStyle = eCheckBoxStyle.CheckBox; - newnode.CheckBoxThreeState = false; - newnode.CheckBoxVisible = chxbxvisable; - - // Set newnode.Checked = parent.Checked - if (newnode.Parent != null) - newnode.Checked = newnode.Parent.Checked; - } - - private Node LookInTree(NodeCollection monkeys, string bananna) - { - Node foundit = null; - foreach (Node chimp in monkeys) - { - if (chimp.Text.Equals(bananna)) - { - foundit = chimp; - // need to select the node (cell) for it to be checked - chimp.SelectedCell = chimp.Cells[0]; - if (chimp.Nodes.Count > 0) - chimp.Expand(); - break; - } - chimp.Collapse(); - } - return foundit; - } - - // C2020-033: Before allowing conversion of Incoming Transitions to text, get list of results that the user has permission edit. - private List TranCvtCheckPermission(bool all) - { - // B2023-102 Don't crash on converting incoming transitions to text if there are none (can happen if 2nd pass occurs) - if (_SearchResults == null) return null; - - // check if a non-reader can convert transitions to text even if a reader - this is set by an administrator on the top - // folder properties dialog - bool allowNonAdmin = IncTranCvtPerm(); - List itmsEditable = new List(); // return this list - int listCount; - if (all) // Check all in list - { - listCount = _SearchResults.Count; - foreach (ItemInfo ii in _SearchResults) - { - if (allowNonAdmin || UserInfo.CanEdit(MyUserInfo, ii.MyDocVersion)) itmsEditable.Add(ii.ContentID); - } - } - else // check only the items selected - { - listCount = lbSrchResultsIncTrans.CheckedItems.Count; - List lbis = lbSrchResultsIncTrans.CheckedItems; - foreach (ListBoxItem lbi in lbis) - { - ItemBindingData tmpii = lbi.Tag as ItemBindingData; - ItemInfo ii = tmpii.DataItem as ItemInfo; - if (allowNonAdmin || UserInfo.CanEdit(MyUserInfo, ii.MyDocVersion)) itmsEditable.Add(ii.ContentID); - } - } - // Prompt user if convert to text should continue. If some items cannot be edited, also state that - // not all can be converted to text. If count of itmsEditable & lbis are different some cannot be edited. - if (itmsEditable.Count == 0) - { - FlexibleMessageBox.Show($"You do not have permission to edit any of the procedures, sections, and/or steps{(all ? "." : " that are selected.")}", - "Convert Transition to Text", MessageBoxButtons.OK, MessageBoxIcon.Information); - return null; - } - else if (itmsEditable.Count != listCount) - { - DialogResult ans = FlexibleMessageBox.Show($"You only have permission to edit some of the procedures, sections, and/or steps that are selected.procedures, sections, and/or steps{(all ? "." : " that are selected.")}\r\n\r\n Should the conversion of the transitions to text continue?", - "Convert Transition to Text", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (ans == DialogResult.No) return null; - } - else - { - // B2023-103 add spinner (WaitCursor) and also, change FlexibleMessageBox to regular MessageBox since restore of cursor to - // wait cursor did not work after FlexibleMessageBox - Cursor savcursor = Cursor; - DialogResult ans = MessageBox.Show(this, "Are you sure you want to convert the transitions to text?", "Convert Transitions to Text", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - this.Cursor = savcursor; - if (ans == DialogResult.No) return null; - } - - return itmsEditable; - } - - // C2020-033: convert selected transitions to text - private void btnTranCvtSelToTxt_Click(object sender, EventArgs e) - { - // First see if all selected can be converted, i.e. user has permission to edit - _ = lbSrchResultsIncTrans.CheckedItems; - List itmsEditable = TranCvtCheckPermission(false); - if (itmsEditable == null || itmsEditable.Count == 0) return; - TranCvtToTxt(itmsEditable); - fromTranCvtBtn = true; - UpdateSearchIncTransResults(); // B2021-009: Research after convert transitions to text - fromTranCvtBtn = false; - } - - // B2021-010: IncomingTranGetMergedTranList gets a complete list of incoming transitions (before fix transitions to procedure - // were only included if there were NO transitions to items within procedure, the GetExternalTransitionsToChildren query - // did not get transitions 'incoming to' the item itself) - private ItemInfoList IncomingTranGetMergedTranList() - { - ItemInfoList iil = null; - bool first = true; - - using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(SearchIncTransII.ItemID)) - { - foreach (TransitionInfo ti in exTrans) - { - if (first) - { - ContentInfo ci = ContentInfo.Get(ti.FromID); - ItemInfo tmp = ci.ContentItems[0]; - iil = new ItemInfoList(tmp); - first = false; - } - else - { - ContentInfo ci = ContentInfo.Get(ti.FromID); - ItemInfo tmp = ci.ContentItems[0]; - iil.AddItem(tmp); - } - } - } - using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitions(SearchIncTransII.ItemID)) - { - foreach (TransitionInfo ti in exTrans) - { - if (first) - { - ContentInfo ci = ContentInfo.Get(ti.FromID); - ItemInfo tmp = ci.ContentItems[0]; - iil = new ItemInfoList(tmp); - first = false; - } - else - { - ContentInfo ci = ContentInfo.Get(ti.FromID); - ItemInfo tmp = ci.ContentItems[0]; - - // B2021-014: if in list, don't add another - if (!iil.Contains(tmp)) iil.AddItem(tmp); - } - } - } - - return iil; - } - - // C2020-033: For items in list, do the actual conversion of the Incoming Transition to text - private void TranCvtToTxt(List itmsEditable) - { - // B2023-103 Add wait cursor (and remove at end) - this.Cursor = Cursors.WaitCursor; - ItemInfo trII = SearchIncTransII; - - if (trII != null) - { - using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(trII.ItemID)) - { - foreach (TransitionInfo ti in exTrans) - { - // See if the 'item to' id is to be converted and if so do it. To figure this out, - // see if it is in the list itmsEditable. - if (itmsEditable.Contains(ti.FromID)) - { - ContentInfo ci = ContentInfo.Get(ti.FromID); - ItemInfo tmp = ci.ContentItems[0]; - - using (Content content = Content.Get(tmp.ContentID)) - { - content.FixTransitionText(ti, true); - content.Save(); - } - } - } - - } - - // B2021-010: Convert the text of transitions pointing (incoming) to the item itself - using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitions(trII.ItemID)) - { - foreach (TransitionInfo ti in exTrans) - { - // See if the 'item to' id is to be converted and if so do it. To figure this out, - // see if it is in the list itmsEditable. - if (itmsEditable.Contains(ti.FromID)) - { - ContentInfo ci = ContentInfo.Get(ti.FromID); - ItemInfo tmp = ci.ContentItems[0]; - - using (Content content = Content.Get(tmp.ContentID)) - { - content.FixTransitionText(ti, true); - content.Save(); - } - } - } - - } - } - this.Cursor = Cursors.Default; - } - - #region (ProgressBar) - - private void ProgressBar_Initialize(int max, string desc) - { - if (_ProgressBar != null) - { - _ProgressBar.Maximum = max; - _ProgressBar.Text = desc; - _ProgressBar.TextVisible = true; - } - } - - private void ProgressBar_SetValue(int curval) - { - if (_ProgressBar != null) - _ProgressBar.Value = curval; - } - - private void ProgressBar_Clear() - { - if (_ProgressBar != null) - { - _ProgressBar.Text = string.Empty; - _ProgressBar.Maximum = 0; - _ProgressBar.Value = 0; - } - } - - #endregion - - #region (ROFST Combo Tree) - - private void LoadROComboTree() - { - lblSrchRoMsg.Visible = false; // C2019-041: start out with no message about rofsts and folder(s) compatibility - // if only one docversion selected, this RoFst can be used. If more than one or none (none is all docversions), then check if they - // use the same RO fst. If not, put a message as the first tree node and return, otherwise, load the tree. - List dvilTmp = new List(); - - if (lstCheckedDocVersions == null || lstCheckedDocVersions.Count == 0) - { - DocVersionInfoList dvil = DocVersionInfoList.Get(); - foreach (DocVersionInfo dvi in dvil) dvilTmp.Add(dvi); - } - else - { - dvilTmp = lstCheckedDocVersions; - } - - bool same = true; - // get the first rofstId for comparing to the rest: - int rofstId = (dvilTmp.Count > 0) ? (dvilTmp[0].DocVersionAssociations != null && dvilTmp[0].DocVersionAssociations.Count > 0) ? dvilTmp[0].DocVersionAssociations[0].ROFstID : -1 : -1; - - // for remaining folder/docversions in the list, check if they have an associated rofst & if so, if it is the same as the first in list. - for (int i = 1; i < dvilTmp.Count; i++) - { - if (dvilTmp[i].DocVersionAssociations != null && dvilTmp[i].DocVersionAssociations.Count > 0) - { - if (rofstId != dvilTmp[i].DocVersionAssociations[0].ROFstID) - { - same = false; - break; - } - } - } - - // rofsts for selected folder/docversions are not the same, cannot do an ro search: - if (!same) - { - DevComponents.AdvTree.Node tn = new DevComponents.AdvTree.Node(); - // C2019-041: if selected folders do not have the same ro.fst then clear the ro list and let user know. - cmboTreeROs.Nodes.Clear(); - - if (lstCheckedDocVersions == null || lstCheckedDocVersions.Count == 0) - lblSrchRoMsg.Text = "RO values are incompatible between the folders. This may be due to the RO values needing to be updated."; - else - lblSrchRoMsg.Text = "This folder(s) RO values are incompatible with the currently selected folder(s). This may be due to the RO values needing to be updated."; - - lblSrchRoMsg.Visible = true; - _lastRoFstId = -1; - return; - } - - // C2019-041: if requested rofst is same as last one, just return; - if (_lastRoFstId == rofstId) return; - - lblSrchRoMsg.Refresh(); - cmboTreeROs.Nodes.Clear(); - this.cmboTreeROs.AdvTree.BeforeExpand += new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(this.cmboTreeROs_BeforeExpand); - cmboTreeROs.AdvTree.AfterExpand += new AdvTreeNodeEventHandler(AdvTree_AfterExpandorCollapse); - cmboTreeROs.AdvTree.AfterCollapse += new AdvTreeNodeEventHandler(AdvTree_AfterExpandorCollapse); - - // populate the tree - only 1 folder/docversion is selected or all selected use the same rofst: - // B2022-071 use the dvilTmp instead of lstCheckedDocVersions because if none are check then it's count will be zero - if (dvilTmp != null && dvilTmp.Count > 0) - { - // C2019-041: Save this rofstid in case a new one is processed. - // B2022-071: We were setting _lastRoFstId before checking if we were going to load the RO tree, - // So now set set it only if we actually load the RO tree - // Also, set _MydocVersion to dvilTmp[0] - _lastRoFstId = rofstId; - // B2022-143: Only reset _MyDocVersion if it is null, it a procedure is in editor, _MyDocVersion is the set for - // the procedure active in the editor: - if (_MyDocVersion == null) _MyDocVersion = dvilTmp[0]; - - if (_MyDocVersion.DocVersionAssociations != null && _MyDocVersion.DocVersionAssociations.Count > 0) - { - _MyROFSTLookup = _MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(_MyDocVersion); - - ROFSTLookup.rodbi[] dbs = _MyROFSTLookup.GetRODatabaseList(true); - - if (dbs != null && dbs.Length > 0) - { - for (int i = 0; i < dbs.Length; i++) - { - ROFSTLookup.rodbi db = dbs[i]; - - DevComponents.AdvTree.Node tn = new DevComponents.AdvTree.Node(db.dbiTitle) - { - Tag = db - }; - cmboTreeROs.Nodes.Add(tn); - - AddDummyGroup(db, tn); - } - } - } - } - } - - private Node FindTreeNodeAt(NodeCollection nodes, int y) - { - foreach (Node node in nodes) - { - if (node.Bounds.Top <= y && node.Bounds.Bottom >= y) - return node; - if (node.Bounds.Top > y) - { - if (node.PrevNode != null && node.PrevNode.Expanded) - return FindTreeNodeAt(node.PrevNode.Nodes, y); - return node; - } - } - return null; - } - - private Node BottomTreeNode(NodeCollection nodes) - { - Node bottomNode = nodes[nodes.Count - 1]; // Return bottom node in collection - if (bottomNode.Expanded) // If expanded return bottom child - return BottomTreeNode(bottomNode.Nodes); - return bottomNode; - } - - private void AddDummyGroup(ROFSTLookup.rodbi rodbi, DevComponents.AdvTree.Node tn) - { - if (MyROFSTLookup.HasChildren(ref rodbi)) - { - DevComponents.AdvTree.Node tmp = new DevComponents.AdvTree.Node(DummyNodeText); - tn.Nodes.Add(tmp); - } - } - - private void cmboTreeROs_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e) - { - LoadChildren(e.Node); - } - - private void LoadChildren(DevComponents.AdvTree.Node tn) - { - if (tn.HasChildNodes && tn.Nodes[0].Text != DummyNodeText) return; // already loaded. - if (tn.HasChildNodes && tn.Nodes[0].Text == DummyNodeText) tn.Nodes[0].Remove(); - - ROFSTLookup.rochild[] chld; - if (tn.Tag is ROFSTLookup.rodbi db) - { - MyROFSTLookup.LoadChildren(ref db); - chld = db.children; - } - else if (tn.Tag is ROFSTLookup.rochild ch) - { - MyROFSTLookup.LoadChildren(ref ch); - chld = ch.children; - } - else - { - Console.WriteLine("error - no type"); - return; - } - - // if children, add dummy node - // B2022-026 RO Memory Reduction code - need to check length - if (chld != null && chld.Length > 0) - { - ProgressBar_Initialize(chld.Length, tn.Text); - - for (int i = 0; i < chld.Length; i++) - { - ProgressBar_SetValue(i); - ROFSTLookup.rochild roc = chld[i]; - - // if this is a group, i.e. type 0, add a dummy node - // B2022-026 RO Memory Reduction code - check children length - if (roc.type == 0 && !MyROFSTLookup.HasChildren(ref roc)) - { - continue; // Ignore: Junk Scenario - } - else if (!string.IsNullOrEmpty(roc.appid)) - { - MyROFSTLookup.LoadChildren(ref roc); - - if (roc.children.Length == 1 && roc.children.First().roid.Length == 16) - { - roc.appid = roc.children.First().appid; - roc.roid = roc.children.First().roid; - roc.value = roc.children.First().value; - - roc.children = new List().ToArray(); - } - } - - - Node tmp; - if (roc.value == null) - { - tmp = new DevComponents.AdvTree.Node(roc.title) - { - Tag = roc - }; - - int index = FindIndex(tn.Nodes, tmp.Text); - tn.Nodes.Insert(index, tmp); - - DevComponents.AdvTree.Node sub = new DevComponents.AdvTree.Node(DummyNodeText); - tmp.Nodes.Add(sub); - } - else - { - tmp = new DevComponents.AdvTree.Node(roc.title) - { - Tag = roc - }; - - if (roc.roid.Length == 16) - { - tn.Nodes.Add(tmp); - } - else - { - int index = FindIndex(tn.Nodes, tmp.Text); - tn.Nodes.Insert(index, tmp); - } - } - } - } - - ProgressBar_Clear(); - } - - private int FindIndex(NodeCollection nodes, string value) - { - int index = 0; - foreach (Node node in nodes) - { - if (GreaterValue(node.Text, value)) return index; - index++; - } - return index; - } - - private bool GreaterValue(string value1, string value2) - { - return DisplayRO.GreaterValue(value1, value2); - } - - private void cmboTreeROs_SelectedIndexChanged(object sender, EventArgs e) - { - if (cmboTreeROs.SelectedIndex == -1 || cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rodbi) - { - cbxFndUnLnkROVals.Enabled = false; - } - else if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rochild ro) - { - // B2022-026 RO Memory Reduction code - check children length - cbxFndUnLnkROVals.Enabled = (ro.children == null || ro.children.Length <= 0); - } - - if (!cbxFndUnLnkROVals.Enabled) - cbxFndUnLnkROVals.Checked = false; - } - - private void gpFindROs_EnabledChanged(object sender, EventArgs e) - { - if (gpFindROs.Enabled) - gpFindROs.Style.BackColor = Color.Yellow; - else - gpFindROs.Style.BackColor = saveGpFindROsColor; - } - - private void advTreeProcSetsPreSelect() - { - bool keeplooking = true; - //build a stack (bread crumb trail) of where is procedure set came from within the tree. - Stack crumbs = new Stack(); - - crumbs.Push(Mydocversion.MyFolder.Name); // ex: "Emergency Procedures" - FolderInfo fi = Mydocversion.MyFolder.MyParent; - while (fi != null) - { - if (fi.MyParent != null) - crumbs.Push(fi.Name); - fi = fi.MyParent; - } - crumbs.Push(advTreeProcSets.Nodes[0].Text); //top node of my tree - - // now walk the tree, looking for the node names we saved in the stack. - NodeCollection monkeys = advTreeProcSets.Nodes; - while (keeplooking) - { - Node climber = LookInTree(monkeys, crumbs.Pop()); - keeplooking = (climber != null && crumbs.Count > 0); - if (keeplooking) - monkeys = climber.Nodes; - if (!keeplooking && climber != null) - { - climber.Checked = true; - } - } - } - - #endregion - - #region (Annotation Search) - - private void cbxTextSearchAnnotation_Leave(object sender, EventArgs e) - { - InsertAnnotationSearchCriteria(); - - } - - private void InsertAnnotationSearchCriteria() - { - if (!cbxTextSearchAnnotation.Text.Equals(string.Empty)) - { - string tstr = cbxTextSearchAnnotation.Text; - if (!cbxTextSearchAnnotation.Items.Contains(tstr)) - cbxTextSearchAnnotation.Items.Insert(0, tstr); - } - } - - private void gpSrchAnnoText_EnabledChanged(object sender, EventArgs e) - { - if (gpSrchAnnoText.Enabled) - { - gpSrchAnnoText.Style.BackColor = Color.Yellow; - cbxTextSearchAnnotation.Focus(); - } - else - gpSrchAnnoText.Style.BackColor = saveGpSrchAnnoTextColor; - } - - #endregion - - #region (Search Results) - - private void DisplayResults() - { - _LoadingList = true; - // C2020-033: Incoming Transition tab. Note that this tab uses a different control for the search - // results, it uses the dotnetbar list that has check boxes. Because of this, various places throughout - // the code will check for what tab is displayed and will work eith the associated list box, either - // lbSrchResults or lbSrchResultsIncTrans - if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4]) lbSrchResults.DisplayMember = _DisplayMember; - else lbSrchResultsIncTrans.DisplayMember = _DisplayMember; - if (_SearchResults != null) - { - // record count flag - bool reccnt = true; - // B2021-076: Proms search results are not presented in order when printed to PDF - // B2023-041 - backed out previous change as it was not needed and was preventing the sorting of search results text - if (cbSorted.Checked) - { - Csla.SortedBindingList sortedResults = new Csla.SortedBindingList(_SearchResults); - sortedResults.ApplySort(_DisplayMember, ListSortDirection.Ascending); - if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4]) lbSrchResults.DataSource = sortedResults; - else lbSrchResultsIncTrans.DataSource = sortedResults; - } - else - { - // B2021-076: Proms search results are not presented in order when printed to PDF - var sortedResults = _SearchResults.OrderBy(x => x.SearchDefaultSort).ToList(); - - // if searching for just a "?" remove all the special code matches and leaving only the true matches. - if (SearchString == "\\?") - { - string pat = @"\?"; - Regex r = new Regex(pat, RegexOptions.IgnoreCase); - for (int i = 0; i < sortedResults.Count; i++) - { - - Match m = r.Match(sortedResults[i].DisplayText); - if (m.Success) - { - continue; - } - else - { - sortedResults.Remove(sortedResults[i]); - - i--; - } - } - grpPanSearchResults.Text = string.Format("Search Results Found: {0}", sortedResults.Count); - reccnt = false; - } - - if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4]) lbSrchResults.DataSource = sortedResults; - else lbSrchResultsIncTrans.DataSource = sortedResults; - } - if (reccnt) - { - grpPanSearchResults.Text = string.Format("Search Results Found: {0}", _SearchResults.Count); - } - grpPanSearchResults.Style.BackColor = Color.LightGreen;// Color.YellowGreen; Color.DarkSeaGreen; - } - else - { - grpPanSearchResults.Text = "Search Results"; - grpPanSearchResults.Style.BackColor = saveGrpPanSearchResults; - } - - // Turn Print and Results display style on/off based on whether there are search results - if (_SearchResults != null && _SearchResults.Count > 0) - { - btnPrnSrchRslts.Enabled = true; - btnClearSearchResults.Enabled = true; - btnCopySearchResults.Enabled = true; - btnSaveSearchResults.Enabled = true; - if (tabSearchTypes.SelectedTab != tabIncTrans) - cmbResultsStyle.Enabled = true; - } - else - { - btnPrnSrchRslts.Enabled = false; - btnClearSearchResults.Enabled = false; - btnCopySearchResults.Enabled = false; - btnSaveSearchResults.Enabled = false; - cmbResultsStyle.Enabled = false; - } - - // B2021-076: Proms search results are not presented in order when printed to PDF - if (_DisplayMember == "SearchPath_clean" || _DisplayMember == "ShortSearchPath_clean") - { - cbSorted.Checked = false; - cbSorted.Enabled = false; - } - else - { - cbSorted.Enabled = true; - } - - lbSrchResults.SelectedIndex = -1; - lbSrchResultsIncTrans.SelectedIndex = -1; - LastResultsMouseOverIndex = -1; - _LoadingList = false; - - } - - private void lbSrchResults_MouseMove(object sender, MouseEventArgs e) - { - int ResultsMouseOverIndex = lbSrchResults.IndexFromPoint(e.Location); - if (ResultsMouseOverIndex != -1 && ResultsMouseOverIndex != LastResultsMouseOverIndex) - { - ItemInfo ii = lbSrchResults.Items[ResultsMouseOverIndex] as ItemInfo; - if (cmbResultsStyle.Text == "Step Path" && !ii.IsRtfRaw) - toolTip1.SetToolTip(lbSrchResults, ii.DisplayText); // display the text in a tooltip - else - toolTip1.SetToolTip(lbSrchResults, ii.Path); // display location of corresponding procedure text in a tooltip - LastResultsMouseOverIndex = ResultsMouseOverIndex; - } - } - - // B2021-018: Removed code that was tracking the number of items checked in the incoming transition - // listbox. Found that could just look at the CheckedItems.Count value. (Previous fixes - // that were removed are B2021-003 & part of C2020-033 (part was for permissions, which was not removed) - // C2020-033: lbSrchResultsIncTrans_ItemClicked is used to check permissions of a selection before allowing an - // item to be clicked and to turn on/off the btnTranCvtSelToTxt button for converting selected to test. - private void lbSrchResultsIncTrans_ItemClicked(object sender, EventArgs e) - { - if (sender is ListBoxItem lbi) - { - ItemBindingData ibd = lbi.Tag as ItemBindingData; - bool allowNonAdmin = IncTranCvtPerm(); - if (lbi.CheckState == CheckState.Checked && ibd.DataItem is ItemInfo ii) - { - if (!allowNonAdmin && !UserInfo.CanEdit(MyUserInfo, ii.MyDocVersion)) - { - FlexibleMessageBox.Show("You do not have permission to edit the procedure, section, or step.", - "Convert Transition to Text", MessageBoxButtons.OK, MessageBoxIcon.Information); - lbi.CheckState = CheckState.Unchecked; - } - } - // B2021-018: use the CheckedItems.Count on the list box for the search results for - // incoming transitions to determine whether to enable the convert selected to text: - btnTranCvtSelToTxt.Enabled = (lbSrchResultsIncTrans.CheckedItems.Count > 0); - } - } - - private void GrpPanSearchResults_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) - { - // B2021-004: If a multiple selection occurred in the results list for Incoming Transitions, tell user that - // processing is occurring - if (!lbSrchResultsIncTrans.Enabled) FlexibleMessageBox.Show("Processing a request to open a procedure. Try again when complete.", - "Try Again", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - - private void lbSrchResults_SelectedValueChanged(object sender, EventArgs e) - { - if (_LoadingList) return; - if (_ProcessingSelectedValueChanged) return; - if (UpdatedAnnotationList) return; - _ProcessingSelectedValueChanged = true; - // B2021-004: Prevent multiple selections on the Incoming Transitions listbox (disable selections - // for the listbox until all processing is done, listbox is enabled at end of method) - if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4]) - { - lbSrchResultsIncTrans.Enabled = false; - lbSrchResultsIncTrans.UseWaitCursor = true; - } - //B2025-056 Click on Incoming Transitions - // Clicking on Incoming Transitions - // will now open that item - ListBox mylb_lbSrchResults = sender as ListBox; - ListBoxAdv mylb_lbSrchResultsIncTrans = sender as ListBoxAdv; - - // If the list is being refreshed, then set the selection index to -1 (no selection) - // B2022-044: don't set selection to top of list (commented out/changed if) - if ((mylb_lbSrchResults != null || mylb_lbSrchResultsIncTrans != null) && !_SearchResults.RefreshingList) - { - _ItemInfo = (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4]) ? lbSrchResultsIncTrans.SelectedValue as ItemInfo : lbSrchResults.SelectedValue as ItemInfo; - if ((tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1]) && (_ItemInfo != null)) - { - // B2020-019: Don't set the CurrentAnnotation to an annotation in a procedure that cannot be opened. - AnnotationInfo tmpca = AnnotationInfo.Get(_ItemInfo.SearchAnnotationID); - DisplayTabItem dti = null; - if (tmpca != null) dti = _TabControl.OpenItem(tmpca.MyItem); // open the corresponding procedure text - if (dti != null) - { - _AnnotationDetails.CurrentAnnotation = tmpca; - _AnnotationDetails.FindCurrentAnnotation(); // position to corresponding row in annotation grid - } - } - else - { - if (_ItemInfo != null) - { - _OpenDocFromSearch = true; - // B2023-089: selecting a deleted item from search results shows deleted step in the editor when the StepTabItem for - // the deleted item was displayed but is not the active StepTabItem. Use its procedure if it was deleted - ItemInfo openItem = _ItemInfo.IsDeleted ? ItemInfo.Get(_ItemInfo.MyProcedure == null ? _ItemInfo.ItemID : _ItemInfo.MyProcedure.ItemID) : _ItemInfo; - DisplayTabItem dti = _TabControl.OpenItem(openItem); // open the corresponding procedure text - if (dti != null) - { - if (dti.MyDSOTabPanel != null) - dti.MyDSOTabPanel.SearchString = _strSrchText == null || _strSrchText == string.Empty ? this.cbxTextSearchText.Text : _strSrchText; - if (dti.MyStepTabPanel != null) - dti.MyStepTabPanel.SearchString = _strSrchText == null || _strSrchText == string.Empty ? this.cbxTextSearchText.Text : _strSrchText; - _OpenDocFromSearch = false; - } - } - } - } - _ProcessingSelectedValueChanged = false; - if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4]) - { - lbSrchResultsIncTrans.Enabled = true; - lbSrchResultsIncTrans.UseWaitCursor = false; - } - } - - private void cmbResultsStyle_SelectedValueChanged(object sender, EventArgs e) - { - switch (cmbResultsStyle.Text) - { - case "Document Path": - _DisplayMember = "SearchDVPath_clean"; - break; - case "Step Path": - _DisplayMember = "ShortSearchPath_clean"; - break; - case "Annotation Text": - _DisplayMember = "SearchAnnotationText"; - break; - case "Document Text": - _DisplayMember = "DisplayText"; - break; - default: - _DisplayMember = "SearchPath_clean"; - break; - } - DisplayResults(); - } - - private void cbSorted_CheckedChanged(object sender, EventArgs e) - { - Cursor savcursor = Cursor; - Application.DoEvents(); - Cursor = Cursors.WaitCursor; - //Console.WriteLine(string.Format("Checked = {0}", cbSorted.Checked)); - DisplayResults(); - Cursor = savcursor; - } - - #endregion - - #region (Search) - - private string ConvertSpecialChars(string str) - { - string rtnVal = str; - rtnVal = rtnVal.Replace("\u00A0", @"\u160?"); //convert \u00A0 to a hard space (\u00A0 shows as a blank in the search text field) - rtnVal = rtnVal.Replace("\n", @"\line "); //B2018-020 SQL content record has "\line " for the hard return - // Bug fix B2014-057 - // if we are searching for a symbol character in all procedure sets MyDocVersion is null - // when MyDocVersion is null, get the symbol list directly from the PROMS base format (BaseAll.xml) - FormatData fmtdata = (_MyDocVersion != null) ? _MyDocVersion.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData; - if (fmtdata != null && fmtdata.SymbolList != null) - { - SymbolList sl = fmtdata.SymbolList; - if (sl != null) - { - foreach (Symbol sym in sl) - { - string rplace = string.Format(sym.Unicode < 256 ? @"\'{0:X2}" : @"\u{0}?", sym.Unicode); // bug fix B2014-057 we were not including the ? in the replace - rtnVal = rtnVal.Replace(((char)sym.Unicode).ToString(), rplace); - } - } - } - return rtnVal; - } - - // Same funtion as GetROChildren in DisplayReport.cs - private string GetROsToSearch(ROFSTLookup.rochild[] chld) - { - string rtnstr = string.Empty; - // B2022-118: If the ro has child nodes in tree view but they aren't loaded, load them - if ((chld == null || chld.Length <= 0) && (cmboTreeROs.SelectedNode.Nodes != null || cmboTreeROs.SelectedNode.Nodes.Count >= 1)) - { - ROFSTLookup.rochild ro = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag; - MyROFSTLookup.LoadChildren(ref ro); - chld = ro.children; - } - - // B2022-026 RO Memory Reduction code - check children length - if (chld == null || chld.Length <= 0) // get a single ROID - { - ROFSTLookup.rochild ro = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag; - // B2022-107: Display Progress Bar Messages/Statuses when a new ROFST binary file is loaded into the database - rtnstr += ROFSTLookup.FormatRoidKey(ro.roid, false); - } - else - { // spin through the child list and get the ROIDs. - // if the child has children, then call this function recursively - foreach (ROFSTLookup.rochild roc in chld) - { - // B2022-026 RO Memory Reduction code - check children length - if (roc.children != null && roc.children.Length > 0) - rtnstr += GetROsToSearch(roc.children); - else - { - // B2022-118: If the ro has child nodes in tree view but they aren't loaded, load them - ROFSTLookup.rochild rot = roc; - MyROFSTLookup.LoadChildren(ref rot); - chld = rot.children; - - if (rot.children != null && rot.children.Length > 0) - rtnstr += GetROsToSearch(rot.children); - else - rtnstr += string.Format("{0},", ROFSTLookup.FormatRoidKey(roc.roid, false)); - } - } - } - - return rtnstr; - } - - private void btnSearch_Click(object sender, EventArgs e) - { - _fromLoad = false; - DateTime start = DateTime.Now; - Cursor savcursor = Cursor; - // keeps track of index into combo box for results style. This combo box may have 3 or 4 - // items depending on whether annotations exist. - int cmbResultsStyleIndex = -1; - try - { - LastSearchWasAnnotations = false; // B2019-119 only refresh annotation search results if an annotation search was done - ClearResults(); - Cursor = Cursors.WaitCursor; - SearchResults = null; - bool includeRTFformat = false; - bool includeSpecialChars = (TextSearchString != @"\?"); // true; - // Build list of selected types that were searched - string typstr = null; - foreach (string s in lstCheckedStepTypesStr) typstr = typstr == null ? s : $"{typstr}, {s}"; - TypesSelected = $"Filtered By: {typstr ?? "All Step Types"}"; - string unitPrefix = string.Empty; - if (Mydocversion != null) - unitPrefix = Mydocversion.DocVersionConfig.Unit_ProcedureNumber; - if (unitPrefix.EndsWith("#")) - unitPrefix = unitPrefix.Replace("#", string.Empty); - - if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[0]) // Text Search - { - if (cbxSrchTypeUsage.Checked) // find just the usage of the selected types - { - if (lstCheckedStepTypes.Count == 0) - { - FlexibleMessageBox.Show("Please select one or more types then press the Search button", "No Types Selected"); - xpStepTypes.Expanded = true; - advTreeStepTypes.Focus(); - xpStepTypes.TitleStyle.BackColor1.Color = Color.Crimson; - } - else - { - ReportTitle = "Step Element Report"; //"Proms - Search by Type: " + typstr; - TypesSelected = $"Filtered By: {typstr}"; - SearchString = null; - // B2022-031 - added a cbxProcSectSrch to filter out procedure and section titles from global search results. - SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, string.Empty, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxProcSectSrch.Checked ? 1 : 0, ItemSearchIncludeLinks.Value, includeRTFformat, includeSpecialChars, unitPrefix, string.Empty, string.Empty); - cmbResultsStyleIndex = 1; //display step locations in results - } - } - else - { - ReportTitle = string.Format("Search for '{0}'", TextSearchString); - - string byWordPrefix = string.Empty; - string byWordSuffix = string.Empty; - if (cbxByWord.Checked) - { - byWordPrefix = GetByWordSettings(TextSearchString, true); - byWordSuffix = GetByWordSettings(TextSearchString, false); - } - - SearchString = TextSearchString; - - SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, TextSearchString /*.Replace(@"\",@"\u9586?")*/, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxProcSectSrch.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, byWordPrefix, byWordSuffix); - - cmbResultsStyleIndex = 3; // display step text in results - //} - } - // C2019-001: Search in RNO steps only - if (cbxRnoOnly.Checked) GetInRNOResults(); - } - else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1]) // Annotation Search - { - LastSearchWasAnnotations = true; // B2019-119 only refresh annotation search results if an annotation search was done - SearchString = null; - if (cbxTextSearchAnnotation.Text == null || cbxTextSearchAnnotation.Text == string.Empty) - { - ReportTitle = string.Format("Find {0}{1}", cbxAnnoTypes.Text, (cbxAnnoTypes.SelectedIndex > 0) ? " Annotations" : string.Empty); - } - else - { - ReportTitle = string.Format("Search {0}{1} For '{2}'", cbxAnnoTypes.Text, (cbxAnnoTypes.SelectedIndex > 0) ? " Annotations" : string.Empty, cbxTextSearchAnnotation.Text); - } - - SearchResults = ItemInfoList.GetListFromAnnotationSearch(DVISearchList, TypeSearchList, AnnotationSearchType, cbxTextSearchAnnotation.Text, cbxCaseSensitiveAnnoText.Checked, unitPrefix); - cmbResultsStyleIndex = 2; // display annotation text in results - // C2019-001: Search in RNO steps only - if (cbxRnoOnlyAnnot.Checked) GetInRNOResults(); - } - else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[2]) // RO Search - { - SearchString = null; - ReportTitle = string.Format("Search For Referenced Object:\n{0}", cmboTreeROs.Text); - - if (cbxFndUnLnkROVals.Enabled && cbxFndUnLnkROVals.Checked) - { - - SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, ROSearchList, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxProcSectSrch.Checked ? 1 : 0, ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, GetByWordSettings(ROSearchList, true), GetByWordSettings(ROSearchList, false)); - cmbResultsStyleIndex = 3; // display step text in results - } - else - { - SearchResults = ItemInfoList.GetListFromROSearch(DVISearchList, TypeSearchList, ROSearchList, unitPrefix); - cmbResultsStyleIndex = 3; // display step text in results - } - // C2019-001: Search in RNO steps only - if (cbxRnoOnlyRO.Checked) GetInRNOResults(); - } - else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[3]) //Transition Search - { - ReportTitle = string.Format("Search For Transitions: Transition Type: {0}, Transition Category: {1}", cbxTranFormat.SelectedItem, cbxTranCategory.SelectedItem); - string docVersionList = string.Empty; - bool bypassSearch = false; - if (lstCheckedDocVersions.Count == 0) - docVersionList = cbxTranVersion.Tag.ToString(); - else - { - //B2026-055 – Transition Search Improvements - //Changed matching to take Filtered Formats into account if both tree - //Items selected and Format dropdown filtered - if (string.IsNullOrEmpty(cbxTranVersion.Tag?.ToString())) - { - docVersionList = string.Join(",", lstCheckedDocVersions.Select(y => y.VersionID.ToString())); - } - else - { - var fromatversionslst = cbxTranVersion.Tag.ToString().Split(',').Select(int.Parse); - var selectedversionlst = lstCheckedDocVersions.Select(y => y.VersionID); - docVersionList = string.Join(",", fromatversionslst.Intersect(selectedversionlst)); - - if (string.IsNullOrEmpty(docVersionList)) - { - bypassSearch = true; - FlexibleMessageBox.Show("No Matches Found.", "Search"); - } - } - } - // B2018-134 to search specifically for Outside Transitions, set docVeronList to empty string so that all procedure sets are considered - if (cbxTranCategory.SelectedItem?.ToString() == "Outside") - docVersionList = string.Empty; - // added TypeSearchList for bug fix B2015-055 - if (cbxTranFormat.SelectedIndex == -1) cbxTranFormatFillIn(docVersionList); - if (!bypassSearch) SearchResults = ItemInfoList.GetListFromTransitionSearch(docVersionList, cbxTranFormat.SelectedIndex - 1, cbxTranCategory.SelectedItem?.ToString() == "All" ? string.Empty : (cbxTranCategory.SelectedItem?.ToString() ?? string.Empty), TypeSearchList); - cmbResultsStyleIndex = 3; // display step text in results - // C2019-001: Search in RNO steps only - if (cbxRnoOnlyTrans.Checked) GetInRNOResults(); - } - else if (tabSearchTypes.SelectedTab == tabIncTrans) - { - // C2025-062 When Search clicked - Load the Incoming transitions for the Active Procedure - - if (_TabControl?.MyEditItem?.MyItemInfo?.MyProcedure != null) - { - - if (_TabControl?.MyEditItem?.MyItemInfo?.MyProcedure.ItemID == _TabControl?.MyEditItem?.MyItemInfo?.ItemID) - { - _ = _TabControl.OnSearchIncTrans(this, new vlnTreeItemInfoEventArgs(_TabControl?.MyEditItem?.MyItemInfo?.MyProcedure)); - } - else - { - //if on a step, check if the user wants to load incoming transitions for that step or the entire procedure - switch (CustomMessageBox.Show("Would you like to load incoming transitions for this procedure or this step?", "Load Incoming Transitions", "This Procedure", "This Step")) - { - case DialogResult.Yes: - _ = _TabControl.OnSearchIncTrans(this, new vlnTreeItemInfoEventArgs(_TabControl?.MyEditItem?.MyItemInfo?.MyProcedure)); - break; - case DialogResult.No: - _ = _TabControl.OnSearchIncTrans(this, new vlnTreeItemInfoEventArgs(_TabControl?.MyEditItem?.MyItemInfo)); - break; - default: //Cancel was pressed - break; - } - } - } - else - { - FlexibleMessageBox.Show("Please open a procedure before selecting this option to load incoming transitions for that procedure.", "Search"); - } - } - if (SearchResults != null && tabSearchTypes.SelectedTab != tabIncTrans) - { - AddMessageForEmptyAnnotations(); - if (cmbResultsStyleIndex == 3 && cmbResultsStyle.Items.Count == 3) cmbResultsStyleIndex--; - cmbResultsStyle.SelectedIndex = cmbResultsStyleIndex; - DisplayResults(); - if (SearchResults != null && SearchResults.Count == 0) - { - FlexibleMessageBox.Show("No Matches Found.", "Search"); - } - } - btnTranCvtAllToTxt.Enabled = IncTransCvtAllToTextPerm(); // C2020-033: does user have access to at least one item - } - catch (Exception ex) - { - while (ex.InnerException != null) - ex = ex.InnerException; - string tmpmsg = (cbxBooleanTxtSrch.Checked && ex.Message.Contains("Syntax error") && ex.Message.Contains("full-text search")) ? - "Place \"\" around words that you are searching for, so that parser can better understand what you are trying to find" : - ex.Message; - FlexibleMessageBox.Show(tmpmsg, $"Search Error: {ex.GetType().Name}"); - } - finally - { - Cursor = savcursor; - } - OnSearchComplete(new DisplaySearchEventArgs(TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks))); - } - private string GetByWordSettings(string ss, bool checkstart) - { - - // C2020-009: Search - Allow search 'By Word'. - - // // Generate a prefix & suffix to be used in the sql query around the search string. - // // If the search string starts (prefix)/ends(suffix) with a number, then use an expression that - // // does not allow the preceding/following text to have a number, '.', letter or other rtf - // // commands. If the search string starts/ends with a letter, then use an expression that does not - // // find the preceding/following text that is text, i.e. a letter. - - if (ss.Length > 0) - { - //checking start - if (checkstart) - { - // starts with a number or '.' decimal pt - if (char.IsNumber(ss, 0) || ss[0] == '.') - { - return @"[^0-9a-zA-Z.vbpi:\\-]"; - } - // starts with a letter - else if (char.IsLetter(ss, 0)) - { - return @"[^a-zA-Z]"; - } - } - //checking end - else - { - // ends with a number or '.' decimal pt - if (char.IsNumber(ss, ss.Length - 1) || ss[ss.Length - 1] == '.') - { - return @"[^0-9a-zA-Z.vbpi:\\-]"; - } - // ends with a letter - else if (char.IsLetter(ss, ss.Length - 1)) - { - return @"[^a-zA-Z]"; - } - } - } - - //default - return string.Empty; - } - private void ClearResults() // B2021-103 if no results when RNO only, clear results list. (moved from btnSearch_Click) - { - if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4]) - { - lbSrchResults.DataSource = null; - lbSrchResults.Items.Clear(); - toolTip1.SetToolTip(lbSrchResults, null); - } - else // C2020-033: Incoming Transiiotns - { - lbSrchResultsIncTrans.DataSource = null; - lbSrchResultsIncTrans.Items.Clear(); - toolTip1.SetToolTip(lbSrchResultsIncTrans, null); - } - } - - // C2019-001: Search in RNO steps only - private void GetInRNOResults() - { - bool first = true; - ItemInfoList iil = null; - - foreach (ItemInfo ii in SearchResults) - { - if (ii.SearchPath.Contains(".RNO.")) - { - if (first) - { - iil = new ItemInfoList(ii); - first = false; - } - else - { - iil.AddItem(ii); - } - } - } - SearchResults = iil; - // B2021-075 - put up none found message for RNO only - if (SearchResults == null || SearchResults.Count == 0) - { - FlexibleMessageBox.Show("No Matches Found.", "Search"); - ClearResults(); // B2021-103 Clear results list if none found. - } - } - - private void AddMessageForEmptyAnnotations() - { - bool hasAnnot = false; - - foreach (ItemInfo ii in SearchResults) - { - if (ii.ItemAnnotations != null && ii.ItemAnnotationCount > 0) - { - // RHM - can an iteminfo have an itemannotationcount>0 and not have searchannotationtext. - if (ii.SearchAnnotationText == null) ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText; - } - - if (ii.SearchAnnotationText == null) ii.SearchAnnotationText = $"None - [{ii.DisplayText}]"; - else - { - hasAnnot = true; - } - } - cmbResultsStyle.Items.Clear(); - cmbResultsStyle.Items.Add(comboItem1); - cmbResultsStyle.Items.Add(comboItem2); - if (hasAnnot) cmbResultsStyle.Items.Add(comboItem3); - cmbResultsStyle.Items.Add(comboItem4); - - // C2025-062 When Search clicked - Load the Incoming transitions for the Active Procedure - if (tabSearchTypes.SelectedTab == tabIncTrans) - { - cmbResultsStyle.SelectedIndex = -1; - cmbResultsStyle.Enabled = false; - } - else - { - cmbResultsStyle.Enabled = true; - } - } - - private void cbxTextSearchText_Leave(object sender, EventArgs e) - { - InsertSearchCriteria(); - } - - private void InsertSearchCriteria() - { - if (!cbxTextSearchText.Text.Equals(string.Empty)) - { - string tstr = cbxTextSearchText.Text; - // if its already exists in the list - remove it - if (cbxTextSearchText.Items.Contains(tstr)) - cbxTextSearchText.Items.Remove(tstr); - // Add the new criteria to the top of the list - cbxTextSearchText.Items.Insert(0, tstr); - // set the text to the new criteria - cbxTextSearchText.Text = tstr; - // If there are more than 10 remove the last one - if (cbxTextSearchText.Items.Count > 10) - cbxTextSearchText.Items.RemoveAt(10); - } - } - - private void cbxSrchTypeUsage_CheckedChanged(object sender, EventArgs e) - { - gpSrchText.Enabled = !cbxSrchTypeUsage.Checked; - if (!cbxSrchTypeUsage.Checked) - xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor; - else - { - xpStepTypes.Expanded = true; - if (lstCheckedStepTypes.Count == 0) - xpStepTypes.TitleStyle.BackColor1.Color = Color.Crimson; - advTreeStepTypes.Focus(); - - } - } - - private void rbtnSrchTxt_CheckedChanged(object sender, EventArgs e) - { - if (rbtnSrchTxt.Checked) - cbxTextSearchText.Focus(); - } - - private void gpSrchText_EnabledChanged(object sender, EventArgs e) - { - if (gpSrchText.Enabled) - gpSrchText.Style.BackColor = cbxBooleanTxtSrch.Checked ? Color.Orange : Color.Yellow; - else - gpSrchText.Style.BackColor = saveGpSrchTextColor; - } - - private void tabStepTypeSearch_Click(object sender, EventArgs e) - { - if (rbtnSrchTxt.Checked) - { - cbxTextSearchText.Focus(); - cbxBooleanTxtSrch_CheckedChanged(sender, e); - } - } - - private void ProcessEnterKey(object sender, KeyPressEventArgs e) - { - if (e.KeyChar == '\r') // enter key pressed - { - e.Handled = true; - btnSearch_Click(sender, e); - if (sender == cbxTextSearchText) - InsertSearchCriteria(); - else - InsertAnnotationSearchCriteria(); - } - } - - #endregion - - #region (ProcSetSelection) - - private void advTreeProcSets_AfterCheck(object sender, DevComponents.AdvTree.AdvTreeCellEventArgs e) - { - // this method gets called if child nodes get checked by the code, return if doing this process. - if (checkingChildren) - return; - - DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode; - dicSelectedFolderNodes[n] = n.Checked; - - // if this tree node is checked, and there are children, check the children too. - if (n.Checked) - { - checkingChildren = true; - if (n.Nodes != null && n.Nodes.Count > 0 && n.Nodes[0].Text != DummyNodeText) CheckTreeNodeChildren(n.Nodes); - checkingChildren = false; - } - else - { - //C2025-005 Find Step Elements - //uncheck the parents if there are any - DevComponents.AdvTree.Node tmp_n = n; - while (tmp_n.Parent != null) - { - tmp_n = tmp_n.Parent; - tmp_n.Checked = false; - } - } - - // if the selected folder has a docversion, handle it: - if (n.Tag != SelectAllProcedureSetsText) - { - FolderInfo fi = (FolderInfo)n.Tag; - RefreshLstCheckedDocVersions(); - RefreshStepTypes();// Refresh Step Types after Working Draft is checked. - - if (lstCheckedDocVersions.Count == 1 && fi.FolderDocVersions != null && fi.FolderDocVersions.Count > 0) - { - Mydocversion = fi.FolderDocVersions[0]; - StartAdvTreeStepTypesFillIn();// B2016-258 Hang after selecting a procedure if the Step Type panel is open on the search panel - } - } - - SetupContextMenu(); - buildSetToSearchPanelTitle(); - - //C2025-005 Find Step Elements - //Need to refresh the Doc List and Available Step Types - //if All Procedure Sets was selected - if (n.Tag is string txt && txt == SelectAllProcedureSetsText) - { - if (n.Checked) - { - checkingChildren = true; - foreach (Node node in advTreeProcSets.Nodes[0].Nodes) - { - node.Checked = true; - CheckTreeNodeChildren(node.Nodes); - } - checkingChildren = false; - } - RefreshLstCheckedDocVersions(); - RefreshStepTypes(); - } - - } - - // check all folder nodes below this - private void CheckTreeNodeChildren(NodeCollection nodeCollection) - { - foreach (Node tn in nodeCollection) - { - tn.Checked = tn.Parent.Checked; - - if (tn.Nodes != null && tn.Nodes.Count > 0 && tn.Nodes[0].Text != DummyNodeText) - CheckTreeNodeChildren(tn.Nodes); - } - } - - // The 'lstCheckedDocVersions' maintains a list of the docversions that are associated with folders that are checked - // on the search tree of folders, i.e. procedure sets that should be included in the search. - private void RefreshLstCheckedDocVersions() - { - lstCheckedDocVersions.Clear(); - AddFromTreeNodes(advTreeProcSets.Nodes); // add docversions to the list - LoadROComboTree(); // reset the ro tree based on docversion selections. - } - - private void AddFromTreeNodes(NodeCollection nodeCollection) - { - foreach (Node tn in nodeCollection) - { - AddFromTreeNode(tn); - } - } - - private void AddFromTreeNode(Node tn) - { - if (tn.Checked) - { - //B2023-112: Don't crash if on top 'All' node (did not have associated folder) - FolderInfo fi = tn.Tag as FolderInfo; - // if this folder has a docversion, use its id: - if (tn.Nodes != null && tn.Nodes.Count > 0 && tn.Nodes[0].Text != DummyNodeText) // Folder has been expanded, so add its docversion list - { - if (fi != null && fi.FolderDocVersionCount > 0) lstCheckedDocVersions.Add(fi.FolderDocVersions[0]); - } - else // it has not been expanded process all below. - { - //B2023-076: Do not process the "Select All" node - if (tn.Text != SelectAllProcedureSetsText && fi != null) - AddAllChildVersions(fi); - } - } - else // not checked, set style so no background color - { - tn.Style = null; - } - - if (tn.Nodes != null) - AddFromTreeNodes(tn.Nodes); - } - - private void RemoveAllVersions(FolderInfo child) - { - RemoveAllChildVersions(child); - RefreshStepTypes(); // Refresh the Step Type TreeView - } - - /// - /// RessetStepTypes - Clear Step Type Treeview - /// - private void ResetStepTypes() - { - ResetStepTypes("....select a procedure set for types to appear..."); - } - - //C2025-005 Find Step Elements - //improve messaging when multiple formats - private void ResetStepTypes(params string[] strs) - { - advTreeStepTypes.Nodes.Clear(); - lstCheckedStepTypes.Clear(); - lstCheckedStepTypesStr.Clear(); - foreach (string str in strs) - { - Node newnode = new DevComponents.AdvTree.Node - { - Text = str - }; - advTreeStepTypes.Nodes.Add(newnode); - } - buildStepTypePannelTitle(); - } - - private void AddAllVersions(FolderInfo child) - { - AddAllChildVersions(child); - RefreshStepTypes(); - } - - /// - /// RefreshStepTypes - Updates the StepType TreeView to allow step types to be specified. - /// - private void RefreshStepTypes() - { - if (lstCheckedDocVersions.Count == 0) - { - ResetStepTypes(); - return; - } - - string formatName = lstCheckedDocVersions[0].ActiveFormat.Name; - - foreach (DocVersionInfo dvi in lstCheckedDocVersions) - { - if (formatName != dvi.ActiveFormat.Name) - { - //C2025-005 Find Step Elements - //improve messaging when multiple formats - string frmt1 = $" Format is {formatName} before {dvi.MyFolder.Name}"; - string frmt2 = $" which begins format: {dvi.ActiveFormat.Name}"; - ResetStepTypes("...folders selected include multiple formats.", frmt1, frmt2); - return; - } - } - - _MyDocVersion = lstCheckedDocVersions[0]; - - // B2016-258 Hang after selecting a procedure if the Step Type panel is open on the search panel - StartAdvTreeStepTypesFillIn(); - } - - // remove all docversion children - private void RemoveAllChildVersions(FolderInfo myFolderInfo) - { - if (myFolderInfo.FolderDocVersionCount > 0) - { - foreach (DocVersionInfo dvi in myFolderInfo.FolderDocVersions) - { - if (lstCheckedDocVersions.Contains(dvi)) - lstCheckedDocVersions.Remove(dvi); - } - } - - if (myFolderInfo.ChildFolders != null) - { - foreach (FolderInfo folderChild in myFolderInfo.ChildFolders) - { - RemoveAllChildVersions(folderChild); - } - } - } - - // add all docversion children - private void AddAllChildVersions(FolderInfo myFolderInfo) - { - if (myFolderInfo.FolderDocVersionCount > 0) - { - foreach (DocVersionInfo dvi in myFolderInfo.FolderDocVersions) - { - if (!lstCheckedDocVersions.Contains(dvi)) - lstCheckedDocVersions.Add(dvi); - } - } - - if (myFolderInfo.ChildFolders != null) - { - foreach (FolderInfo folderChild in myFolderInfo.ChildFolders) - { - AddAllChildVersions(folderChild); - } - } - } - - private void cbxTranFormatFillIn(string vid) - { - vid = vid.IndexOf(",") < 0 ? vid : vid.Substring(0, cbxTranVersion.Tag.ToString().IndexOf(",")); - //B2026-055 – Transition Search Improvements - //Change the order of items happening - //previous order was causing an error when clicked downdownlist to - //show all items and then didn't select an item in the list - cbxTranFormat.Items.Clear(); - cbxTranFormat.Items.Add("All"); - - if (!string.IsNullOrEmpty(vid)) - { - DocVersionInfo dvi = DocVersionInfo.Get(int.Parse(vid)); - TransTypeList ttl = dvi.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList; - - - for (int i = 0; i < ttl.MaxIndex; i++) - { - cbxTranFormat.Items.Add(new TransItem(ttl[i].TransMenu.Replace("?.", string.Empty), ttl[i].TransFormat.Replace("?.", string.Empty))); - } - } - - cbxTranFormat.SelectedIndex = 0; - cbxTranCategory.Items.Clear(); - cbxTranCategory.Items.Add("All"); - cbxTranCategory.Items.Add("Internal"); - cbxTranCategory.Items.Add("External"); - cbxTranCategory.Items.Add("Outside"); - cbxTranCategory.SelectedIndex = 0; - } - - private void xpSetToSearch_ExpandedChanged(object sender, ExpandedChangeEventArgs e) - { - buildSetToSearchPanelTitle(); - } - - private void buildSetToSearchPanelTitle() - { - // B2023-112: lstCheckedDocVersions has list of sets, if 'all' it is empty. However, in order to get proc set tree to handle appropriate selections - // and work with this list, check both the list count and the whether the 'all' is checked. - if (lstCheckedDocVersions.Count == 0 && advTreeProcSets.Nodes != null && (advTreeProcSets.Nodes.Count <=1 || (advTreeProcSets.Nodes.Count > 1 && advTreeProcSets.Nodes[0].Nodes != null)) && (advTreeProcSets.Nodes[0].Nodes.Count == 0 || (advTreeProcSets.Nodes[0].Nodes.Count > 0 && !advTreeProcSets.Nodes[0].Nodes[0].Checked))) - { - xpSetToSearch.TitleText = string.Format("No Procedure Sets Selected"); - xpSetToSearch.TitleStyle.BackColor1.Color = Color.PapayaWhip; - btnSearch.Enabled = false; - tabSearchTypes.Enabled = false; // disable all the search tabs - } - else if (lstCheckedDocVersions.Count == 0) - { - xpSetToSearch.TitleText = string.Format("All Procedure Sets Selected"); - xpSetToSearch.TitleStyle.BackColor1.Color = Color.PapayaWhip; - btnSearch.Enabled = true; - tabSearchTypes.Enabled = true; // enable all the search tabs - } - else - { - // display the number of selected procedure sets whether panel is expanded or not - xpSetToSearch.TitleText = string.Format("{0} Procedure Sets Selected", lstCheckedDocVersions.Count); - xpSetToSearch.TitleStyle.BackColor1.Color = Color.PapayaWhip; - btnSearch.Enabled = true; - tabSearchTypes.Enabled = true; // enable all the search tabs - } - } - - private void advTreeProcSets_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e) - { - DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode; - - if (advTreeStepTypes.Nodes.Count == 1 && n.Checked) - { - if (n.Tag is DocVersionInfo info) // Only set MyDocVersion if it is a DocVersion - { - Mydocversion = info; - StartAdvTreeStepTypesFillIn();// B2016-258 Hang after selecting a procedure if the Step Type panel is open on the search panel - } - } - // B2023-112: If unchecking a procedure set, uncheck the 'All' node also - if (n.Checked) - advTreeProcSets.Nodes[0].Nodes[0].Checked = false; - } - - #endregion - - #region (StepTypeSelection) - - private void advTreeStepTypes_AfterCheck(object sender, DevComponents.AdvTree.AdvTreeCellEventArgs e) - { - xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor; - DevComponents.AdvTree.Node n = advTreeStepTypes.SelectedNode; - - if (n == null) - return; - - StepData sd = (StepData)n.Tag; - - if (n.Checked) - { - if (sd == null) - { - //C2023-010: Since the tag is null for Word Sections and HLS types, we need to determine which one has been selected. Word sections we need - //to process, but we need to ignore adding HLS types. - if (n.Text == "WORD Sections") - { - if (!lstCheckedStepTypesStr.Contains("WORD Sections")) - { - lstCheckedStepTypes.Add(0); //use zero to identify attachment search - lstCheckedStepTypesStr.Add("WORD Sections"); - } - } - } - else - { - if (!lstCheckedStepTypesStr.Contains(advTreeStepTypes.SelectedNode.Text)) - { - lstCheckedStepTypes.Add((int)sd.Index); - lstCheckedStepTypesStr.Add(advTreeStepTypes.SelectedNode.Text); - } - } - } - else - { - n.Style = null; - - if (sd == null) - { - //C2023-010: Since the tag is null for Word Sections and HLS types, we need to determine which one has been selected. Word sections we need - //to process, but we need to ignore removing HLS types since they were not added in the previous process. - if (n.Text == "WORD Sections") - { - lstCheckedStepTypesStr.Remove("WORD Sections"); - lstCheckedStepTypes.Remove(0); - } - } - else - { - lstCheckedStepTypes.Remove((int)sd.Index); - lstCheckedStepTypesStr.Remove(advTreeStepTypes.SelectedNode.Text); - } - - //B2025-012 Find Step Elements - //uncheck the parents if there are any - DevComponents.AdvTree.Node tmp_n = n; - while (tmp_n.Parent != null) - { - tmp_n = tmp_n.Parent; - tmp_n.Checked = false; - } - //uncheck All Types - advTreeStepTypes.Nodes[0].Checked = false; - } - - //C2023-010: Check if the node has children and if we need to process those children as well - if (n.HasChildNodes) - { - foreach (Node child in n.Nodes) - { - child.Checked = n.Checked; - advTreeStepTypes.SelectedNode = child; - advTreeStepTypes_AfterCheck(sender, null); - } - } - else if (n.Text == "All Types") - { - //B2025-012 Find Step Elements - //if checking / un-checking All Types - //Add Types to type list appropriately - if (n.Checked) - { - foreach (Node child in advTreeStepTypes.Nodes) - { - if (child.Text != "All Types") - { - child.Checked = true; - advTreeStepTypes.SelectedNode = child; - advTreeStepTypes_AfterCheck(sender, null); - } - } - } - else - { - foreach (Node child in advTreeStepTypes.Nodes) - { - if (child.Text != "All Types") - { - child.Checked = false; - advTreeStepTypes.SelectedNode = child; - advTreeStepTypes_AfterCheck(sender, null); - } - } - } - - } - - buildStepTypePannelTitle(); - - // B2021-100: Enable/disable the RNO Only checkbox & WORD Sections tree node in Step Elements to Search. - // The only time the RNO Only checkbox is disabled is if the only selection in Step Elements to Search is WORD Sections. - cbxRnoOnly.Enabled = true; - - if (OnlyWordSectTypeSel()) - cbxRnoOnly.Checked = cbxRnoOnly.Enabled = false; - } - - private void xpStepTypes_ExpandedChanged(object sender, ExpandedChangeEventArgs e) - { - buildStepTypePannelTitle(); - } - - private void buildStepTypePannelTitle() - { - if (lstCheckedStepTypes.Count == 0) - { - if (xpStepTypes.Expanded) - { - xpStepTypes.TitleText = "Select Step Elements To Search"; //"Select Types To Search"; - advTreeStepTypes.Focus(); - advTreeStepTypes.Nodes[0].SelectedCell = advTreeStepTypes.Nodes[0].Cells[0]; - } - else - { - xpStepTypes.TitleText = "Click Here To Search By Step Element"; //"Click Here To Search By Types"; - } - - xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor; - } - else - { - // show how many selected whether panel is expanded or not - xpStepTypes.TitleText = string.Format("{0} Step Element{1} Selected", lstCheckedStepTypes.Count, (lstCheckedStepTypes.Count > 1) ? "s" : string.Empty); // B2018-132 changed second {0} to {1} - xpStepTypes.TitleStyle.BackColor1.Color = Color.PapayaWhip; - } - } - - #endregion - - #region (ContextMenu) - - private void btnSym_Click(object sender, EventArgs e) - { - DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender; - - if (cbxTextSearchAnnotation.Focused) - { - cbxTextSearchAnnotation.SelectedText = (string)b.Text; - } - else if (cbxTextSearchText.Focused) - { - cbxTextSearchText.SelectedText = (string)b.Text; - } - } - - private void cmFndTxtInsHardSp_Click(object sender, EventArgs e) - { - // We use \u00A0 to represent a hard space because it show in the search text field as a blank - // It will get translated to a real hard space character prior to searching - if (cbxTextSearchAnnotation.Focused) - { - cbxTextSearchAnnotation.SelectedText = "\u00A0"; - } - else if (cbxTextSearchText.Focused) - { - cbxTextSearchText.SelectedText = "\u00A0"; - } - } - - private void cmFndTxtCut_Click(object sender, EventArgs e) - { - Clipboard.Clear(); - DataObject myDO = new DataObject(DataFormats.Text, cbxTextSearchAnnotation.Focused ? cbxTextSearchAnnotation.SelectedText : cbxTextSearchText.SelectedText); - Clipboard.SetDataObject(myDO); - - // Need to check which combo box activated the context menu so that we know where to take/put selected text - if (cbxTextSearchAnnotation.Focused) - { - cbxTextSearchAnnotation.SelectedText = string.Empty; - } - else if (cbxTextSearchText.Focused) - { - cbxTextSearchText.SelectedText = string.Empty; - } - } - - private void cmFndTxtCopy_Click(object sender, EventArgs e) - { - // Need to check which combo box activated the context menu so that we know where to take/put selected text - DataObject myDO = new DataObject(DataFormats.Text, cbxTextSearchAnnotation.Focused ? cbxTextSearchAnnotation.SelectedText : cbxTextSearchText.SelectedText); - - if (cbxTextSearchText.Focused || cbxTextSearchAnnotation.Focused) - { - Clipboard.Clear(); - Clipboard.SetDataObject(myDO); - } - } - - private bool OnlyWordSectTypeSel() - { - // B2021-100: Enable/disable the RNO Only checkbox & WORD Sections tree node in Step Elements to Search. - if (lstCheckedStepTypes != null && lstCheckedStepTypes.Count == 1 && lstCheckedStepTypes[0] == 0) - return true; - - return false; - } - - private void CbxRnoOnly_Click(object sender, System.EventArgs e) - { - // C2021-028: RNO Only search, disable Word section tree node: - // B2021 - 100: Enable / disable the RNO Only checkbox &WORD Sections tree node in Step Elements to Search. - if (tabSearchTypes.SelectedTab == tabTranSearch) return; - - // B2021-122: null reference crash if clicking RNOOnly before anything else, i.e. tree set up with types. - if (wordSectionTreeNode == null) return; - - wordSectionTreeNode.Enabled = true; - if (!cbxRnoOnly.Checked) // checked turning on - { - // Set enabling on WORD Sections tree node in Step Elements to Search. If either no items are selected in tree or - // just WORD Section is selected, then disable the WORD Section tree node. Otherwise, i.e. other step types are selected - // in tree, thus they must be searched using RNO Only so need to disable anything. - wordSectionTreeNode.Enabled = !(OnlyWordSectTypeSel() || (lstCheckedStepTypes != null && lstCheckedStepTypes.Count == 0)); - if (!wordSectionTreeNode.Enabled) wordSectionTreeNode.Checked = false; - } - else // turning off - WORD Sections tree node is enabled. - { - wordSectionTreeNode.Enabled = true; - } - } - - private void cmFndTxtPaste_Click(object sender, EventArgs e) - { - // Need to check which combo box activated the context menu so that we know where to take/put selected text - IDataObject myDO = Clipboard.GetDataObject(); - - if (myDO.GetDataPresent(DataFormats.Text)) - { - if (cbxTextSearchAnnotation.Focused) - { - cbxTextSearchAnnotation.SelectedText = Clipboard.GetText(); - } - else if (cbxTextSearchText.Focused) - { - cbxTextSearchText.SelectedText = Clipboard.GetText(); - } - } - } - - private void btnCMIFindText_PopupOpen(object sender, PopupOpenEventArgs e) - { - // the context menu is available with just a mouse hover, even if the combo box does not have focus - // ... set the focus to which ever combo box initiated the context menu - if (tabAnnotationSearch.IsSelected) - { - if (!cbxTextSearchAnnotation.Focused) - cbxTextSearchAnnotation.Focus(); - } - else if (tabStepTypeSearch.IsSelected) - { - if (!cbxTextSearchText.Focused) - cbxTextSearchText.Focus(); - } - } - - #endregion - - #region (Button/UI Event Handlers) - - private void buttonItem2_Click(object sender, EventArgs e) - { - if (cbxTextSearchAnnotation.Focused) - cbxTextSearchAnnotation.SelectedText = "*"; - else if (cbxTextSearchText.Focused) - cbxTextSearchText.SelectedText = "*"; - } - - private void buttonItem3_Click(object sender, EventArgs e) - { - if (cbxTextSearchAnnotation.Focused) - cbxTextSearchAnnotation.SelectedText = "?"; - else if (cbxTextSearchText.Focused) - cbxTextSearchText.SelectedText = "?"; - - } - - private void buttonItem4_Click(object sender, EventArgs e) - { - if (cbxTextSearchAnnotation.Focused) - cbxTextSearchAnnotation.SelectedText = "?*"; - else if (cbxTextSearchText.Focused) - cbxTextSearchText.SelectedText = "?*"; - } - - private void cbxBooleanTxtSrch_CheckedChanged(object sender, EventArgs e) - { - // If the Boolean search is not working - run the following two commands in SQL: - // use veproms - // ALTER FULLTEXT INDEX ON Contents START FULL POPULATION - // ALTER FULLTEXT INDEX ON Documents START FULL POPULATION - // use master - //Boolean search uses a list of noise, or STOP, words. This list can be found - // in file: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\noiseenu.txt. - // Another file exists in that directory, tsenu.xml, this is a thesaurus. RHM tried - // to use around 2010, but couldn't get it to work for words like 'dg' versus 'diesel generator', - // and 'sg' versus 'steam generator'. - - if (cbxBooleanTxtSrch.Checked) - { - gpSrchText.Style.BackColor = Color.Orange; - btnCMIFindText.SubItems[1].SubItems[2].Visible = false; - btnCMIFindText.SubItems[1].SubItems[3].Visible = true; - cbxCaseSensitive.Enabled = false; - cbxIncROTextSrch.Enabled = false; - } - else - { - gpSrchText.Style.BackColor = Color.Yellow; - btnCMIFindText.SubItems[1].SubItems[2].Visible = true; - btnCMIFindText.SubItems[1].SubItems[3].Visible = false; - cbxCaseSensitive.Enabled = true; - cbxIncROTextSrch.Enabled = true; - } - } - - private void cbxBooleanAnoTxtSrch_CheckedChanged(object sender, EventArgs e) - { - if (cbxBooleanAnoTxtSrch.Checked) - { - gpSrchAnnoText.Style.BackColor = Color.Orange; - btnCMIFindText.SubItems[1].SubItems[2].Visible = false; - btnCMIFindText.SubItems[1].SubItems[3].Visible = true; - } - else - { - gpSrchAnnoText.Style.BackColor = Color.Yellow; - btnCMIFindText.SubItems[1].SubItems[2].Visible = true; - btnCMIFindText.SubItems[1].SubItems[3].Visible = false; - } - } - - private void btnAND_Click(object sender, EventArgs e) - { - if (cbxTextSearchAnnotation.Focused) - cbxTextSearchAnnotation.SelectedText = " AND "; - else if (cbxTextSearchText.Focused) - cbxTextSearchText.SelectedText = " AND "; - } - - private void btnOR_Click(object sender, EventArgs e) - { - if (cbxTextSearchAnnotation.Focused) - cbxTextSearchAnnotation.SelectedText = " OR "; - else if (cbxTextSearchText.Focused) - cbxTextSearchText.SelectedText = " OR "; - } - - private void btnNOT_Click(object sender, EventArgs e) - { - if (cbxTextSearchAnnotation.Focused) - cbxTextSearchAnnotation.SelectedText = " NOT "; - else if (cbxTextSearchText.Focused) - cbxTextSearchText.SelectedText = " NOT "; - } - - private void tabAnnotationSearch_Click(object sender, EventArgs e) - { - cbxAnnoTypes.Focus(); - cbxBooleanAnoTxtSrch_CheckedChanged(sender, e); - } - - private void btnClearSearchResults_Click(object sender, EventArgs e) - { - if (tabSearchTypes.SelectedTab == tabIncTrans) // C2020-033: Clear the Incoming Transitions list box - { - lbSrchResultsIncTrans.DataSource = null; - lbSrchResultsIncTrans.Items.Clear(); - } - else - { - lbSrchResults.DataSource = null; - } - - _SearchResults = null; - DisplayResults(); - btnTranCvtAllToTxt.Enabled = false; - } - - private void btnLoadSearchResults_Click(object sender, System.EventArgs e) - { - _fromLoad = true; - _LoadingList = true; - ofdSearchResults.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS"; - - if (ofdSearchResults.ShowDialog(this) == DialogResult.OK) - { - lbSrchResults.DataSource = null; - lbSrchResults.Items.Clear(); - toolTip1.SetToolTip(lbSrchResults, null); - Cursor = Cursors.WaitCursor; - - try // B2021-045: don't crash if xml file cannot be loaded. - { - SearchResults = ItemInfoList.GetByContentID(0); - // C2021-006: removed all file type options except xml - System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); - xd.Load(ofdSearchResults.FileName); - // B2020-107: Add missing attributes/nodes for loading of search results, include procsets & steptypes: - System.Xml.XmlNodeList nlp = xd.SelectNodes("search/procsets/set"); - if (nlp != null) - { - DocVersionInfo tmpdvi = Mydocversion; - DocVersionInfo fromLoadFiledvi = null; - foreach (System.Xml.XmlNode nd in nlp) - { - int folderID = int.Parse(nd.Attributes.GetNamedItem("fid").InnerText); - FolderInfo fi = FolderInfo.Get(folderID); - _MyDocVersion = fi.FolderDocVersions[0]; - if (fromLoadFiledvi == null) fromLoadFiledvi = _MyDocVersion; - advTreeProcSetsPreSelect(); - } - foreach (System.Xml.XmlNode nd in nlp) - { - int folderID = int.Parse(nd.Attributes.GetNamedItem("fid").InnerText); - FolderInfo fi = FolderInfo.Get(folderID); - Node tnode = advTreeProcSets.FindNodeByDataKey(folderID); - if (tnode != null) tnode.Checked = true; - } - Mydocversion = tmpdvi ?? fromLoadFiledvi; - } - - AdvTreeStepTypesFillIn(); - System.Xml.XmlNodeList nl1 = xd.SelectNodes("search/StepType/type"); - - if (nl1 != null) - { - foreach (System.Xml.XmlNode nd in nl1) - { - string stptype = nd.Attributes.GetNamedItem("str").InnerText; - Node tnode = advTreeStepTypes.FindNodeByText(stptype); - if (tnode != null) - { - tnode.Checked = true; - xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor; - lstCheckedStepTypesStr.Add(stptype); - StepData sd = (StepData)tnode.Tag; - lstCheckedStepTypes.Add((int)sd.Index); - } - } - - string typstr = null; - foreach (string s in lstCheckedStepTypesStr) typstr = typstr == null ? s : $"{typstr}, {s}"; - TypesSelected = $"Filtered By: {typstr ?? "All Step Types"}"; - ReportTitle = "Step Element Report"; //"Proms - Search by Type: " + typstr; - TypesSelected = $"Filtered By: {typstr}"; - advTreeStepTypes.RefreshItems(); - buildStepTypePannelTitle(); - } - - cmbResultsStyle.Text = xd.SelectSingleNode("search/results/@style").InnerText; - int sti = int.Parse(xd.SelectSingleNode("search/criteria/@index").InnerText); - switch (sti) - { - case 0: //text or steptypes - { - System.Xml.XmlNode xn = xd.SelectSingleNode("search/criteria/@text"); - tabSearchTypes.SelectedTab = tabStepTypeSearch; - - if (xn != null) // text search - { - cbxTextSearchText.Text = xn.InnerText; - cbxCaseSensitive.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@case").InnerText); - cbxIncROTextSrch.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@ro").InnerText); - cbxByWord.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@byword").InnerText); - } - else // B2020-107: Add in step type search - { - cbxSrchTypeUsage.Checked = true; - } - - System.Xml.XmlNodeList nl = xd.SelectNodes("search/results/item"); - foreach (System.Xml.XmlNode nd in nl) - { - int itemID = int.Parse(nd.Attributes.GetNamedItem("id").InnerText); - ItemInfo ii = ItemInfo.Get(itemID); - if (ii.SearchAnnotationText == null && ii.ItemAnnotations != null) ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText; - SearchResults.AddItemInfo(ii); - } - lbSrchResults.DataSource = SearchResults; - DisplayResults(); - break; - } - - case 1: //annotation - { - cbxAnnoTypes.Text = xd.SelectSingleNode("search/criteria/@type").InnerText; - cbxTextSearchAnnotation.Text = xd.SelectSingleNode("search/criteria/@text").InnerText; - cbxCaseSensitiveAnnoText.Checked = bool.Parse(xd.SelectSingleNode("search/criteria/@case").InnerText); - tabSearchTypes.SelectedTab = tabAnnotationSearch; - cmbResultsStyle.Text = xd.SelectSingleNode("search/results/@style").InnerText; - System.Xml.XmlNodeList nl = xd.SelectNodes("search/results/item"); - - foreach (System.Xml.XmlNode nd in nl) - { - int itemID = int.Parse(nd.Attributes.GetNamedItem("id").InnerText); - ItemInfo ii = ItemInfo.Get(itemID); - // B2020-107: The following was needed to set the Step Path result type for annotations - if (ii.SearchAnnotationText == null && ii.ItemAnnotations != null) - { - ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText; - ii.SearchAnnotationID = ii.ItemAnnotations[0].AnnotationID; - } - SearchResults.AddItemInfo(ii); - } - - lbSrchResults.DataSource = SearchResults; - DisplayResults(); - break; - } - - case 2: //referenced object - case 3: // transitions - { - FlexibleMessageBox.Show(this, "Loading Referenced Objects and Transitions searches is under construction.", "Under Construction", MessageBoxButtons.OK); - break; - } - - case 4: // Incoming transitions - { - tabSearchTypes.SelectedTab = tabIncTrans; - cmbResultsStyle.Text = xd.SelectSingleNode("search/results/@style").InnerText; - string tmpi = xd.SelectSingleNode("search/results/@toid").InnerText; - SearchIncTransII = ItemInfo.Get(Convert.ToInt32(tmpi)); - System.Xml.XmlNodeList nl = xd.SelectNodes("search/results/item"); - foreach (System.Xml.XmlNode nd in nl) - { - int itemID = int.Parse(nd.Attributes.GetNamedItem("id").InnerText); - ItemInfo ii = ItemInfo.Get(itemID); - if (ii.SearchAnnotationText == null && ii.ItemAnnotations != null) ii.SearchAnnotationText = AnnotationInfo.Get(ii.ItemAnnotations[0].AnnotationID).SearchText; - SearchResults.AddItemInfo(ii); - } - lbSrchResultsIncTrans.DataSource = SearchResults; - DisplayResults(); - break; - } - } - } - catch (Exception) - { - FlexibleMessageBox.Show("An error occurred while reading the xml file.\r\n\r\nThis can happen when the file selected for the Load is not saved\r\n" + - "from a PROMS Search or if some of the steps no longer exist.", "Search Load Failed", MessageBoxButtons.OK); - } - - Cursor = Cursors.Default; - } - - btnTranCvtAllToTxt.Enabled = IncTransCvtAllToTextPerm(); // C2020-033: does user have access to at least one item - _LoadingList = false; - } - - private void btnSaveSearchResults_Click(object sender, System.EventArgs e) - { - ICollection myList = lbSrchResults.DataSource as ICollection; - - if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4]) - { - myList = lbSrchResultsIncTrans.DataSource as ICollection; // C2020-033: use Incoming transition list - } - - if (tabSearchTypes.SelectedTabIndex == 2 || tabSearchTypes.SelectedTabIndex == 3) // ROs & Transitions are not coded yet - { - FlexibleMessageBox.Show(this, "Saving Referenced Objects and Transitions searches is under construction.", "Under Construction", MessageBoxButtons.OK); - return; - } - - sfdSearchResults.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS"; - - if (sfdSearchResults.ShowDialog(this) == DialogResult.OK) - { - // C2021-006: removed all file type options except xml - System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); - System.Xml.XmlElement xe = xd.CreateElement("search"); - xd.AppendChild(xe); - xe = xd.CreateElement("criteria"); - xd.DocumentElement.AppendChild(xe); - System.Xml.XmlAttribute xa = xd.CreateAttribute("index"); - int sti = tabSearchTypes.SelectedTabIndex; - xa.InnerText = sti.ToString(); - xe.Attributes.SetNamedItem(xa); - // B2020-107: save procedures sets & step types - // do procsets selected - System.Xml.XmlElement xp = null; - System.Xml.XmlElement xst = null; - - if (sti != 4) // C2020-033: no procsets or step types for Incoming transitions - { - if (lstCheckedDocVersions != null && lstCheckedDocVersions.Count > 0) - { - xp = xd.CreateElement("procsets"); - - foreach (DocVersionInfo dvi in lstCheckedDocVersions) - { - System.Xml.XmlElement xee = xd.CreateElement("set"); - xa = xd.CreateAttribute("fid"); - xa.InnerText = dvi.MyFolder.FolderID.ToString(); - xee.Attributes.SetNamedItem(xa); - xp.AppendChild(xee); - } - } - - if (lstCheckedStepTypesStr != null && lstCheckedStepTypesStr.Count > 0) - { - xst = xd.CreateElement("StepType"); - - foreach (string str in lstCheckedStepTypesStr) // Limited by step types - { - System.Xml.XmlElement xee = xd.CreateElement("type"); - xa = xd.CreateAttribute("str"); - xa.InnerText = str; - xee.Attributes.SetNamedItem(xa); - xst.AppendChild(xee); - } - } - } - - switch (sti) - { - case 0: //text - if (!cbxSrchTypeUsage.Checked) // text search - { - xa = xd.CreateAttribute("text"); - xa.InnerText = cbxTextSearchText.Text; - xe.Attributes.SetNamedItem(xa); - xa = xd.CreateAttribute("case"); - xa.InnerText = cbxCaseSensitive.Checked.ToString(); - xe.Attributes.SetNamedItem(xa); - xa = xd.CreateAttribute("ro"); - xa.InnerText = cbxIncROTextSrch.Checked.ToString(); - xe.Attributes.SetNamedItem(xa); - xa = xd.CreateAttribute("byword"); - xa.InnerText = cbxByWord.Checked.ToString(); - xe.Attributes.SetNamedItem(xa); - xd.DocumentElement.AppendChild(xe); - } - - if (xp != null) xd.DocumentElement.AppendChild(xp); // want criteria as first xml node - if (xst != null) xd.DocumentElement.AppendChild(xst); // do procsets & steptypes after - // do results - xe = xd.CreateElement("results"); - xa = xd.CreateAttribute("style"); - xa.InnerText = cmbResultsStyle.Text; - xe.Attributes.SetNamedItem(xa); - - foreach (ItemInfo ii in myList) - { - System.Xml.XmlElement xee = xd.CreateElement("item"); - xa = xd.CreateAttribute("id"); - xa.InnerText = ii.ItemID.ToString(); - xee.Attributes.SetNamedItem(xa); - xe.AppendChild(xee); - } - - xd.DocumentElement.AppendChild(xe); - xd.Save(sfdSearchResults.FileName); - break; - - case 1: //annotation - xa = xd.CreateAttribute("type"); - xa.InnerText = cbxAnnoTypes.Text; - xe.Attributes.SetNamedItem(xa); - xa = xd.CreateAttribute("text"); - xa.InnerText = cbxTextSearchAnnotation.Text; - xe.Attributes.SetNamedItem(xa); - xa = xd.CreateAttribute("case"); - xa.InnerText = cbxCaseSensitiveAnnoText.Checked.ToString(); - xe.Attributes.SetNamedItem(xa); - xd.DocumentElement.AppendChild(xe); - if (xp != null) xd.DocumentElement.AppendChild(xp); // want criteria as first xml node - if (xst != null) xd.DocumentElement.AppendChild(xst); // do procsets & steptypes after - xe = xd.CreateElement("results"); - xa = xd.CreateAttribute("style"); - xa.InnerText = cmbResultsStyle.Text; - xe.Attributes.SetNamedItem(xa); - - foreach (ItemInfo ii in myList) - { - System.Xml.XmlElement xee = xd.CreateElement("item"); - xa = xd.CreateAttribute("id"); - xa.InnerText = ii.ItemID.ToString(); - xee.Attributes.SetNamedItem(xa); - xe.AppendChild(xee); - } - - xd.DocumentElement.AppendChild(xe); - xd.Save(sfdSearchResults.FileName); - break; - - case 2: // ro - case 3: // transitions - FlexibleMessageBox.Show(this, "Saving Search Results for this search type is under construction.", "Under Construction", MessageBoxButtons.OK); - break; - - case 4: // C2020-033: Incoming Transitions - xe = xd.CreateElement("results"); - xa = xd.CreateAttribute("style"); - xa.InnerText = cmbResultsStyle.Text; - xe.Attributes.SetNamedItem(xa); - xa = xd.CreateAttribute("toid"); - xa.InnerText = SearchIncTransII.ItemID.ToString(); - xe.Attributes.SetNamedItem(xa); - - foreach (ItemInfo ii in myList) - { - System.Xml.XmlElement xee = xd.CreateElement("item"); - xa = xd.CreateAttribute("id"); - xa.InnerText = ii.ItemID.ToString(); - xee.Attributes.SetNamedItem(xa); - xe.AppendChild(xee); - } - - xd.DocumentElement.AppendChild(xe); - xd.Save(sfdSearchResults.FileName); - break; - } - } - } - - //B2026-055 – Transition Search Improvements - //Update Enabling/Disabling of Tree Elements - public bool TraverseTree(DevComponents.AdvTree.Node node, string[] versions) - { - bool result = true; - int numhiddenchildnodes = 0; - - // Recursively call this method for each child node - foreach (DevComponents.AdvTree.Node childNode in node.Nodes) - { - if (!TraverseTree(childNode, versions)) - { - numhiddenchildnodes++; - } - } - - // Process the current node (e.g., enable it if it is contained) - - //Select all always shows - //also Enable Dummy Nodes by default - if (versions == null || (versions.Length == 1 && string.IsNullOrEmpty(versions[0])) || node.Tag == null || (node.Tag is string txt && txt == SelectAllProcedureSetsText)) - { - node.Enabled = true; - return true; - } - //if all child nodes are hidden, hide the parent - else if (numhiddenchildnodes == node.Nodes.Count) - { - result = false; - } - - FolderInfo fi = (FolderInfo)node.Tag; - if (fi.FolderDocVersionCount > 0) - { - result = versions.Contains(fi.FolderDocVersions[0].VersionID.ToString()); - } - - node.Enabled = result; - return result; - } - private void btnCopySearchResults_Click(object sender, EventArgs e) - { - ICollection myList = lbSrchResults.DataSource as ICollection; - if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4]) myList = lbSrchResultsIncTrans.DataSource as ICollection; - StringBuilder sb = new StringBuilder(); - sb.Append("\"Location\"\t\"Type\"\t\"Text\"\t\"High-Level\"\t\"Annotations\""); - List ItemsProcessed = new List(); - - foreach (ItemInfo myItem in myList) - { - if (!ItemsProcessed.Contains(myItem.ItemID)) - { - ItemsProcessed.Add(myItem.ItemID); - sb.Append(string.Format("\r\n\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"", myItem.ShortPath, myItem.ToolTip, - myItem.DisplayText, !myItem.IsSection && !myItem.IsHigh ? (myItem.MyHLS == null ? string.Empty : myItem.MyHLS.DisplayText) : string.Empty)); - if (myItem.ItemAnnotationCount > 0) - foreach (AnnotationInfo myAnnotation in myItem.ItemAnnotations) - sb.Append(string.Format("\t\"{0}\"", myAnnotation.SearchText)); - } - } - - Clipboard.Clear(); - Clipboard.SetText(sb.ToString()); - FlexibleMessageBox.Show("Results Copied to Clipboard", "Copy Results", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - - private void btnPrnSrchRslts_Click(object sender, EventArgs e) - { - string sortedBy = string.Empty; - if (cbSorted.Checked) - sortedBy = string.Format("Sorted By: {0}", cmbResultsStyle.Text); //C2019-013 pass in sorted by information - ICollection srchres = lbSrchResults.DataSource as ICollection; - // C2020-033: If on the Incoming Transitions tab, use that list. - if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4]) srchres = lbSrchResultsIncTrans.DataSource as ICollection; - OnPrintRequest(new DisplaySearchEventArgs(ReportTitle, TypesSelected, SearchString, srchres, sortedBy)); - } - - private void panSearchButtons_Resize(object sender, EventArgs e) - { - cmbResultsStyle.Left = labelX1.Right + 3; - cmbResultsStyle.Width = btnClearSearchResults.Left - cmbResultsStyle.Left - 3; - } - - // C2020-033: Convert All (that have permissions) Incoming Transitions to text - private void btnTranCvtAllToTxt_Click(object sender, EventArgs e) - { - Cursor = Cursors.WaitCursor; - List itmsEditable = TranCvtCheckPermission(true); // Get list based on permissions - if (itmsEditable == null || itmsEditable.Count == 0) - { - Cursor = Cursors.Default; - return; - } - TranCvtToTxt(itmsEditable); - Cursor = Cursors.Default; - fromTranCvtBtn = true; - UpdateSearchIncTransResults(); // B2021-009: Research after convert transitions to text - fromTranCvtBtn = false; - } - - // C22020-033: Use IncTransCvtAllToTextPerm to see if user has at least edit permissions to 1 in list. This - // is used to see if Convert All button is enabled. - private bool IncTransCvtAllToTextPerm() - { - if (_SearchResults == null) return false; - bool allowNonAdmin = IncTranCvtPerm(); - foreach (ItemInfo ii in _SearchResults) - { - if (allowNonAdmin || UserInfo.CanEdit(MyUserInfo, ii.MyDocVersion)) return true; - } - return false; - } - - #endregion - - #endregion - } - - #region AnnotationTypeSearch Class - - // this class is used to generate the list of annotations to search. - // this also allow us to add a dummy type which is used to search for all annotations - public class AnnotationTypeSearch - { - private string _Name; - public string Name - { - get { return _Name; } - set { _Name = value; } - } - private string _ID; - public string ID - { - get { return _ID; } - set { _ID = value; } - } - public AnnotationTypeSearch(string name, string id) - { - _Name = name; - _ID = id; - } - - } - - #endregion - - #region DisplaySearchEventArgs Class - - public class DisplaySearchEventArgs - { - private string _ReportTitle; - public string ReportTitle - { - get { return _ReportTitle; } - set { _ReportTitle = 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 string _SortedBy = null; - public string SortedBy // C2019-013 pass in sorted by information to print report - { - get { return _SortedBy; } - set { _SortedBy = value; } - } - - private ICollection _MyItemInfoList; - public ICollection MyItemInfoList - { - get { return _MyItemInfoList; } - set { _MyItemInfoList = value; } - } - - private TimeSpan _HowLong = TimeSpan.FromTicks(0); - public TimeSpan HowLong - { - get { return _HowLong; } - set { _HowLong = value; } - } - - private string _PaperSize; - public string PaperSize // C2020-002 paper size is now set in the format files - { - get { return _PaperSize; } - set { _PaperSize = value; } - } - - public DisplaySearchEventArgs(TimeSpan howLong) - { - HowLong = howLong; - } - - public DisplaySearchEventArgs(string reportTitle, string typesSelected, string searchString, ICollection myItemInfoList, string sortedBy) - { - _ReportTitle = reportTitle; - _TypesSelected = typesSelected; - _MyItemInfoList = myItemInfoList; - _SearchString = searchString; - _SortedBy = sortedBy; // C2019-013 pass in sorted by information - - foreach (ItemInfo tmpII in myItemInfoList) - if (tmpII != null && tmpII.ActiveFormat != null) - { - _PaperSize = tmpII.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files - break; - } - } - } -#pragma warning restore IDE1006 // Naming Styles -#pragma warning restore IDE0044 // Add readonly modifier - - #endregion - - public delegate void DisplaySearchEvent(object sender, DisplaySearchEventArgs args); -} diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.resx b/PROMS/Volian.Controls.Library/DisplaySearch.resx deleted file mode 100644 index 8ea3e35b..00000000 --- a/PROMS/Volian.Controls.Library/DisplaySearch.resx +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 402, 17 - - - Enter the text you want to search, or select from the drop down list for which the text is added once a search is done. - -For additional search text options, use the Right Mouse button to get a context menu. - - - - Enter the text you want to search, or select from the drop down list for which the text is added once a search is done. - -For additional search text options, use the Right Mouse button to get a context menu. - - - Using Boolean search allows you to specify text AND other text, text OR other text, and NOT text. To find options, use the Right Mouse button on the Find Box's context menu. - -Boolean searches are case insensitive and the search finds RO data as text or within ROs (selection of optons 'Case Sensitive' & 'Search RO Text' are not available during 'Boolean Search'). - - - 162, 17 - - - 17, 17 - - - 305, 17 - - - 25 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.Designer.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.Designer.cs deleted file mode 100644 index 20d34ff3..00000000 --- a/PROMS/Volian.Controls.Library/DisplayTabControl.Designer.cs +++ /dev/null @@ -1,272 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class DisplayTabControl - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - ShuttingDown = true; - // Cleanup Bars - if (dotNetBarManager1.Bars != null) - foreach (DevComponents.DotNetBar.Bar myBar in dotNetBarManager1.Bars) - MyBar.Dispose(); - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - // C2015-022 part of separate windows upgrade. Remove the tab from our dictionary of all tab controls - //if (_AllDTCs.Count > 0 && VersionID != null && _AllDTCs.ContainsKey((int)VersionID)) - if (_AllDTCs.Count > 0 && _AllDTCs.ContainsKey((int)VersionID)) - _AllDTCs.Remove((int)VersionID); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.dotNetBarManager1 = new DevComponents.DotNetBar.DotNetBarManager(this.components); - this.bottomDocDockSite = new DevComponents.DotNetBar.DockSite(); - this.fillDocDockSite = new DevComponents.DotNetBar.DockSite(); - this._MyBar = new DevComponents.DotNetBar.Bar(); - this._PnlCaret = new System.Windows.Forms.Panel(); - this.leftDocDockSite = new DevComponents.DotNetBar.DockSite(); - this.rightDocDockSite = new DevComponents.DotNetBar.DockSite(); - this.bottomBarDockSite = new DevComponents.DotNetBar.DockSite(); - this.leftBarDockSite = new DevComponents.DotNetBar.DockSite(); - this.rightBarDockSite = new DevComponents.DotNetBar.DockSite(); - this.topBarDockSite = new DevComponents.DotNetBar.DockSite(); - this.topDocDockSite = new DevComponents.DotNetBar.DockSite(); - this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip(); - this.tmrCaret = new System.Windows.Forms.Timer(this.components); - this.fillDocDockSite.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._MyBar)).BeginInit(); - this._MyBar.SuspendLayout(); - this.SuspendLayout(); - // - // dotNetBarManager1 - // - this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.F1); - this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlC); - this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlA); - this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlV); - this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlX); - this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlZ); - this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlY); - this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.Del); - this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.Ins); - this.dotNetBarManager1.BottomDockSite = this.bottomDocDockSite; - this.dotNetBarManager1.EnableFullSizeDock = false; - this.dotNetBarManager1.FillDockSite = this.fillDocDockSite; - this.dotNetBarManager1.LeftDockSite = this.leftDocDockSite; - this.dotNetBarManager1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - this.dotNetBarManager1.ParentForm = null; - this.dotNetBarManager1.ParentUserControl = this; - this.dotNetBarManager1.RightDockSite = this.rightDocDockSite; - this.dotNetBarManager1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.dotNetBarManager1.ToolbarBottomDockSite = this.bottomBarDockSite; - this.dotNetBarManager1.ToolbarLeftDockSite = this.leftBarDockSite; - this.dotNetBarManager1.ToolbarRightDockSite = this.rightBarDockSite; - this.dotNetBarManager1.ToolbarTopDockSite = this.topBarDockSite; - this.dotNetBarManager1.TopDockSite = this.topDocDockSite; - // - // bottomDocDockSite - // - this.bottomDocDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window; - this.bottomDocDockSite.Dock = System.Windows.Forms.DockStyle.Bottom; - this.bottomDocDockSite.DocumentDockContainer = new DevComponents.DotNetBar.DocumentDockContainer(); - this.bottomDocDockSite.Location = new System.Drawing.Point(0, 383); - this.bottomDocDockSite.Name = "bottomDocDockSite"; - this.bottomDocDockSite.Size = new System.Drawing.Size(673, 0); - this.bottomDocDockSite.TabIndex = 3; - this.bottomDocDockSite.TabStop = false; - // - // fillDocDockSite - // - this.fillDocDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window; - this.fillDocDockSite.Controls.Add(this._MyBar); - this.fillDocDockSite.Dock = System.Windows.Forms.DockStyle.Fill; - this.fillDocDockSite.DocumentDockContainer = new DevComponents.DotNetBar.DocumentDockContainer(new DevComponents.DotNetBar.DocumentBaseContainer[] { - ((DevComponents.DotNetBar.DocumentBaseContainer)(new DevComponents.DotNetBar.DocumentBarContainer(this._MyBar, 673, 383)))}, DevComponents.DotNetBar.eOrientation.Horizontal); - this.fillDocDockSite.Location = new System.Drawing.Point(0, 0); - this.fillDocDockSite.Name = "fillDocDockSite"; - this.fillDocDockSite.Size = new System.Drawing.Size(673, 383); - this.fillDocDockSite.TabIndex = 8; - this.fillDocDockSite.TabStop = false; - // - // _MyBar - // - this._MyBar.AccessibleDescription = "DotNetBar Bar (_MyBar)"; - this._MyBar.AccessibleName = "DotNetBar Bar"; - this._MyBar.AccessibleRole = System.Windows.Forms.AccessibleRole.ToolBar; - this._MyBar.AlwaysDisplayDockTab = true; - this._MyBar.CanCustomize = false; - this._MyBar.CanDockBottom = false; - this._MyBar.CanDockDocument = true; - this._MyBar.CanDockLeft = false; - this._MyBar.CanDockRight = false; - this._MyBar.CanDockTop = false; - this._MyBar.CanHide = true; - this._MyBar.CanUndock = false; - this._MyBar.CloseSingleTab = true; - this._MyBar.Controls.Add(this._PnlCaret); - this._MyBar.DockTabAlignment = DevComponents.DotNetBar.eTabStripAlignment.Top; - this._MyBar.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._MyBar.LayoutType = DevComponents.DotNetBar.eLayoutType.DockContainer; - this._MyBar.Location = new System.Drawing.Point(0, 0); - this._MyBar.Name = "_MyBar"; - this._MyBar.Size = new System.Drawing.Size(673, 383); - this._MyBar.Stretch = true; - this._MyBar.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this._MyBar.TabIndex = 0; - this._MyBar.TabNavigation = true; - this._MyBar.TabStop = false; - // - // _PnlCaret - // - this._PnlCaret.BackColor = System.Drawing.Color.Red; - this._PnlCaret.Location = new System.Drawing.Point(5, 5); - this._PnlCaret.Margin = new System.Windows.Forms.Padding(0); - this._PnlCaret.Name = "_PnlCaret"; - this._PnlCaret.Size = new System.Drawing.Size(142, 16); - this._PnlCaret.TabIndex = 1; - this._PnlCaret.Visible = false; - // - // leftDocDockSite - // - this.leftDocDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window; - this.leftDocDockSite.Dock = System.Windows.Forms.DockStyle.Left; - this.leftDocDockSite.DocumentDockContainer = new DevComponents.DotNetBar.DocumentDockContainer(); - this.leftDocDockSite.Location = new System.Drawing.Point(0, 0); - this.leftDocDockSite.Name = "leftDocDockSite"; - this.leftDocDockSite.Size = new System.Drawing.Size(0, 383); - this.leftDocDockSite.TabIndex = 0; - this.leftDocDockSite.TabStop = false; - // - // rightDocDockSite - // - this.rightDocDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window; - this.rightDocDockSite.Dock = System.Windows.Forms.DockStyle.Right; - this.rightDocDockSite.DocumentDockContainer = new DevComponents.DotNetBar.DocumentDockContainer(); - this.rightDocDockSite.Location = new System.Drawing.Point(673, 0); - this.rightDocDockSite.Name = "rightDocDockSite"; - this.rightDocDockSite.Size = new System.Drawing.Size(0, 383); - this.rightDocDockSite.TabIndex = 1; - this.rightDocDockSite.TabStop = false; - // - // bottomBarDockSite - // - this.bottomBarDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window; - this.bottomBarDockSite.Dock = System.Windows.Forms.DockStyle.Bottom; - this.bottomBarDockSite.Location = new System.Drawing.Point(0, 383); - this.bottomBarDockSite.Name = "bottomBarDockSite"; - this.bottomBarDockSite.Size = new System.Drawing.Size(673, 0); - this.bottomBarDockSite.TabIndex = 7; - this.bottomBarDockSite.TabStop = false; - // - // leftBarDockSite - // - this.leftBarDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window; - this.leftBarDockSite.Dock = System.Windows.Forms.DockStyle.Left; - this.leftBarDockSite.Location = new System.Drawing.Point(0, 0); - this.leftBarDockSite.Name = "leftBarDockSite"; - this.leftBarDockSite.Size = new System.Drawing.Size(0, 383); - this.leftBarDockSite.TabIndex = 4; - this.leftBarDockSite.TabStop = false; - // - // rightBarDockSite - // - this.rightBarDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window; - this.rightBarDockSite.Dock = System.Windows.Forms.DockStyle.Right; - this.rightBarDockSite.Location = new System.Drawing.Point(673, 0); - this.rightBarDockSite.Name = "rightBarDockSite"; - this.rightBarDockSite.Size = new System.Drawing.Size(0, 383); - this.rightBarDockSite.TabIndex = 5; - this.rightBarDockSite.TabStop = false; - // - // topBarDockSite - // - this.topBarDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window; - this.topBarDockSite.Dock = System.Windows.Forms.DockStyle.Top; - this.topBarDockSite.Location = new System.Drawing.Point(0, 0); - this.topBarDockSite.Name = "topBarDockSite"; - this.topBarDockSite.Size = new System.Drawing.Size(673, 0); - this.topBarDockSite.TabIndex = 6; - this.topBarDockSite.TabStop = false; - // - // topDocDockSite - // - this.topDocDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window; - this.topDocDockSite.Dock = System.Windows.Forms.DockStyle.Top; - this.topDocDockSite.DocumentDockContainer = new DevComponents.DotNetBar.DocumentDockContainer(); - this.topDocDockSite.Location = new System.Drawing.Point(0, 0); - this.topDocDockSite.Name = "topDocDockSite"; - this.topDocDockSite.Size = new System.Drawing.Size(673, 0); - this.topDocDockSite.TabIndex = 2; - this.topDocDockSite.TabStop = false; - // - // superTooltip1 - // - this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - // - // tmrCaret - // - this.tmrCaret.Interval = 500; - this.tmrCaret.Tick += new System.EventHandler(this.tmrCaret_Tick); - // - // DisplayTabControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.fillDocDockSite); - this.Controls.Add(this.rightDocDockSite); - this.Controls.Add(this.leftDocDockSite); - this.Controls.Add(this.topDocDockSite); - this.Controls.Add(this.bottomDocDockSite); - this.Controls.Add(this.leftBarDockSite); - this.Controls.Add(this.rightBarDockSite); - this.Controls.Add(this.topBarDockSite); - this.Controls.Add(this.bottomBarDockSite); - this.Name = "DisplayTabControl"; - this.Size = new System.Drawing.Size(673, 383); - this.fillDocDockSite.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._MyBar)).EndInit(); - this._MyBar.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private DevComponents.DotNetBar.DotNetBarManager dotNetBarManager1; - private DevComponents.DotNetBar.DockSite bottomDocDockSite; - private DevComponents.DotNetBar.DockSite fillDocDockSite; - private DevComponents.DotNetBar.Bar _MyBar; - //private DevComponents.DotNetBar.DockContainerItem dockContainerItem1; - private DevComponents.DotNetBar.DockSite leftDocDockSite; - private DevComponents.DotNetBar.DockSite rightDocDockSite; - private DevComponents.DotNetBar.DockSite topDocDockSite; - private DevComponents.DotNetBar.DockSite leftBarDockSite; - private DevComponents.DotNetBar.DockSite rightBarDockSite; - private DevComponents.DotNetBar.DockSite topBarDockSite; - private DevComponents.DotNetBar.DockSite bottomBarDockSite; - //private DevComponents.DotNetBar.DockContainerItem dockContainerItem2; - //private DevComponents.DotNetBar.DockContainerItem dockContainerItem3; - private DevComponents.DotNetBar.SuperTooltip superTooltip1; - private System.Windows.Forms.Panel _PnlCaret; - private System.Windows.Forms.Timer tmrCaret; - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.cs deleted file mode 100644 index c332a18a..00000000 --- a/PROMS/Volian.Controls.Library/DisplayTabControl.cs +++ /dev/null @@ -1,1440 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using Volian.Controls.Library; -using DevComponents.DotNetBar; -using JR.Utils.GUI.Forms; -using Volian.Base.Library; -using Microsoft.Win32; -using System.Linq; - -namespace Volian.Controls.Library -{ - public delegate ItemInfo DisplayTabControlEditorSearchIncTransEvent(object sender, vlnTreeItemInfoEventArgs args); - public delegate void DisplayTabControlEvent(object sender, EventArgs args); - public delegate void DisplayTabControlStatusEvent(object sender, DisplayTabControlStatusEventArgs args); - public partial class DisplayTabControlStatusEventArgs : EventArgs - { - private VolianStatusType _Type; - public VolianStatusType Type - { - get { return _Type; } - set { _Type = value; } - } - private int _Count; - public int Count - { - get { return _Count; } - set { _Count = value; } - } - private string _Text; - public string Text - { - get { return _Text; } - set { _Text = value; } - } - public DisplayTabControlStatusEventArgs() - { - _Type = VolianStatusType.Initialize; - _Count = 0; - _Text = "Default"; - } - public DisplayTabControlStatusEventArgs(VolianStatusType type, int count, string text) - { - _Type = type; - _Count = count; - _Text = text; - } - } - - - public partial class DisplayTabControl : UserControl - { - #region Log4Net - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #endregion - - private static bool _SyncronizeEnahnced = false; - public static bool SyncronizeEnhanced - { - get { return DisplayTabControl._SyncronizeEnahnced; } - set { DisplayTabControl._SyncronizeEnahnced = value; } - } - - private static Dictionary _AllDTCs = new Dictionary(); - private int _VersionID = 0; - // zero tells us to PROMS just opened and no procedure was selected yet so use the main proms window - // when the first procedure is opened, the VersionID is set and added to _AllDTCs - public int VersionID - { - get { return _VersionID; } - set - { - if ((int)value != 0) - { - if (!_AllDTCs.ContainsKey((int)value)) - { - _AllDTCs.Add((int)value, this); - if (_VersionID == 0) - _VersionID = value; - else - _MyLog.WarnFormat("VersionID tried to be Changed from {0} to {1}", _VersionID, value); - } - } - else - _VersionID = value; - } - } - - // This tells the display tab control whether or not the Separate Windows setting was set - private bool _SeparateWindows = false; - public bool SeparateWindows - { - get { return _SeparateWindows; } - set { _SeparateWindows = value; } - } - - // this gets called before displaying the PROMS Settings dialog (off of the V button) - // return true if at least one procedure is one in more than one procedure set - // Also cleanup the _AllDTCs dictionary by removing the VersionID's (procedure sets) that are not opened - public bool MoreThanOneProcedureSetIsOpen - { - get - { - List verIdList = new List(); // list of procedure sets being used - List rmvList = new List(); // list of procedure set no longer being used - if (_AllDTCs.Count > 0 && _AllDTCs.Keys.Count > 0) - { - foreach (int k in _AllDTCs.Keys) - { - DisplayTabControl dtc = _AllDTCs[k]; - if (_AllDTCs.Count > 1 && dtc._MyDisplayTabItems.Count == 0) - { - if (!rmvList.Contains(k)) - rmvList.Add(k); - } - else - { - int numKeysVersionID = 0; - foreach (string dtikey in dtc._MyDisplayTabItems.Keys) - { - DisplayTabItem dti = dtc._MyDisplayTabItems[dtikey]; - if (dti.MyItemInfo.MyDocVersion.VersionID == k) - { - numKeysVersionID++; - if (!verIdList.Contains(dti.MyItemInfo.MyDocVersion.VersionID)) - verIdList.Add(dti.MyItemInfo.MyDocVersion.VersionID); - } - } - if (numKeysVersionID == 0 && !rmvList.Contains(k)) - rmvList.Add(k); - } - } - } - // remove the VersionID's that no not being used from the AllDTCs list - if (rmvList.Count > 0) - foreach (int i in rmvList) - _AllDTCs.Remove(i); - if (_AllDTCs.Count == 0) - _VersionID = 0; - return (verIdList.Count > 1); - } - } - public event ItemSelectedChangedEvent OpenInSeparateWindow; - public void OnOpenInSeparateWindow(ItemSelectedChangedEventArgs args) - { - if (OpenInSeparateWindow != null) - OpenInSeparateWindow(this, args); - } - // C2020-033: Provide way to expand/fill in Search/Incoming Transition panel - public event DisplayTabControlEditorSearchIncTransEvent SearchIncTrans; - public ItemInfo OnSearchIncTrans(object sender, vlnTreeItemInfoEventArgs args) - { - if (SearchIncTrans != null) return SearchIncTrans(sender, args); - return args.MyItemInfo; - } - public event ItemSelectedChangedEvent RefreshEnhancedDocument; - public void OnRefreshEnhancedDocument(ItemSelectedChangedEventArgs args) - { - if (RefreshEnhancedDocument != null) - RefreshEnhancedDocument(this, args); - } - public event DisplayTabControlStatusEvent StatusChanged; - public void ONStatusChanged(object Sender, DisplayTabControlStatusEventArgs args) - { - if (StatusChanged != null) StatusChanged(Sender, args); - } - public event DisplayTabControlEvent ToggleRibbonExpanded; - public void OnToggleRibbonExpanded(object sender, EventArgs args) - { - if (ToggleRibbonExpanded != null) ToggleRibbonExpanded(sender, args); - } - public event DisplayTabControlEvent SelectedDisplayTabItemChanged; - public void OnSelectedDisplayTabItemChanged(object sender, EventArgs args) - { - if (SelectedDisplayTabItemChanged != null) SelectedDisplayTabItemChanged(sender, args); - } - // C2015-022 added copystep event to commuicate with child windows - public event ItemChangedEventHandler CopyStepSelected; - - public void OnCopyStepSelected(ItemChangedEventArgs args) - { - if (CopyStepSelected != null) - CopyStepSelected(this, args); - } - - #region Private Fields - - /// - /// This is a lookup table for all of the DisplayTabItems that are currently open - /// The key is: - /// "Item - " + Procedure ItemID for step pages - /// "Doc - " + DocumentID for Word Documents - /// - public Dictionary _MyDisplayTabItems; - - /// - /// When a Tab is closed it is added to this list. - /// When another Tab is opened, any Tabs in this list are closed - /// - private List _RemovedDisplayTabItems = null; - - /// - /// This stores a UniqueID for Bars as they are opened. - /// A bar is the docking location for the DisplayTabItems. - /// - private int _UniqueBarCount; - - /// - /// ItemsChangeIds is used to store a procedure's itemid and its associated (input from dialog) - /// Change Id. Any time a user enters a procedure for the first time in this program session, - /// the user gets prompted to enter a change id. Any time a modification is made to the procedure - /// this change id is used. The user can modify this change id from the step tab ribbon/change id - /// tab (only if the format uses change ids is this tab visible). - /// - public Dictionary ItemsChangeIds = null; - private ItemInfo _MyItemInfo = null; - private EditItem _MyEditItem = null; - - public EditItem MyEditItem - { - get { return _MyEditItem; } - set { _MyEditItem = value; } - } - private StepRTB _MyStepRTB = null; - private bool _RibbonExpanded = true; - public StepRTB MyStepRTB - { - get { return _MyStepRTB; } - } - public bool RibbonExpanded - { - get { return _RibbonExpanded; } - set - { - _RibbonExpanded = value; - foreach (DisplayTabItem tabItem in _MyDisplayTabItems.Values) - if (tabItem.MyStepTabPanel != null) - tabItem.MyStepTabPanel.MyStepTabRibbon.Expanded = _RibbonExpanded; - } - } - private ItemInfo _MyCopyStep; - - public ItemInfo MyCopyStep - { - get { return _MyCopyStep; } - set { _MyCopyStep = value; } - } - private string _ChgId; - public string ChgId - { - get { return _ChgId; } - set { _ChgId = value; } - } - - // C2015-028 Add Editorial Mode to PROMS Step Editor - public bool EditorialChange - { - get - { - if (_ChgId == null) return true; - if (_ChgId == "") return true; - if (_ChgId.ToUpper() == "EC") { return true;} - - return IsInEditorialMode; - } - } - - // C2015-028 Add Editorial Mode to PROMS Step Editor - // property to hold if button in ribbon is toggled on or off - public bool IsInEditorialMode { get; set; } = false; - - // C2015-028 Add Editorial Mode to PROMS Step Editor - // This is used when button in the ribbon is toggled on/off - // It iterates through all previously opened tabs - // and updates the "Editorial Mode" button - // and background color to match those of the current tab - public void SetEdititorialModeForAllTabs(bool mode) - { - foreach (DisplayTabItem tabItem in _MyDisplayTabItems.Values.Where(tabItem => tabItem.MyStepTabPanel != null)) - { - tabItem.MyStepTabPanel.MyStepTabRibbon.SetEditorialMode(mode); - } - } - - #endregion - #region Events - /// - /// This event is raised when a the "Tab" of a DisplayItem is clicked with a mouse. - /// So far this has just been used for demo purposes. It could be used to select a - /// step and it's children for the purpose of copying. - /// - public event StepPanelEvent ItemClick; - /// - /// Checks to see if the ItemClick event is handled and launches it - /// - /// - /// - internal void OnItemClick(object sender, StepPanelEventArgs args) - { - if (ItemClick != null) ItemClick(sender, args); - } - /// - /// This occurs when the user moves onto or off of a link within a RichTextBox - /// or moves between RichTextBoxes or Pages. - /// - public event StepPanelLinkEvent LinkActiveChanged; - /// - /// Checks to see if the LinkActiveChanged event is handled and launches it - /// - /// - /// - internal void OnLinkActiveChanged(object sender, StepPanelLinkEventArgs args) - { - if (LinkActiveChanged != null) LinkActiveChanged(sender, args); - else FlexibleMessageBox.Show(args.LinkInfoText, "Unhandled Link Active Changed", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - /// - /// This occurs when a Transition is inserted - /// - public event StepPanelLinkEvent LinkInsertTran; - /// - /// Checks to see if the 'LinkInsertTran' event is handled and launches it - /// - /// - /// - internal void OnLinkInsertTran(object sender, StepPanelLinkEventArgs args) - { - if (LinkInsertTran != null) LinkInsertTran(sender, args); - else FlexibleMessageBox.Show(args.LinkInfoText, "Unhandled Link Insert Tran", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - /// - /// This occurs when an RO is inserted - /// - public event StepPanelLinkEvent LinkInsertRO; - /// - /// Checks to see if the 'LinkInsertRO' event is handled and launches it - /// - /// - /// - internal void OnLinkInsertRO(object sender, StepPanelLinkEventArgs args) - { - if (LinkInsertRO != null) LinkInsertRO(sender, args); - else FlexibleMessageBox.Show(args.LinkInfoText, "Unhandled Link Insert RO", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - /// - /// This occurs when a Transition is modified - /// - public event StepPanelLinkEvent LinkModifyTran; - /// - /// Checks to see if the 'LinkModifyTran' event is handled and launches it - /// - /// - /// - internal void OnLinkModifyTran(object sender, StepPanelLinkEventArgs args) - { - if (LinkModifyTran != null) LinkModifyTran(sender, args); - else FlexibleMessageBox.Show(args.LinkInfoText, "Unhandled Link Modify Tran", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - /// - /// This occurs when an RO is modified - /// - public event StepPanelLinkEvent LinkModifyRO; - /// - /// Checks to see if the 'LinkModifyRO' event is handled and launches it - /// - /// - /// - internal void OnLinkModifyRO(object sender, StepPanelLinkEventArgs args) - { - if (LinkModifyRO != null) LinkModifyRO(sender, args); - else FlexibleMessageBox.Show(args.LinkInfoText, "Unhandled Link Modify RO", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - /// - /// Occurs when the user selects a different item or page - /// - public event ItemSelectedChangedEvent ItemSelectedChanged; - /// - /// Checks to see if the 'ItemSelectedChanged' event is handled and launches it - /// - /// - /// - internal void OnItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args) - { - if (args != null) - { - _MyItemInfo = args.MyItemInfo; - _MyEditItem = args.MyEditItem; - if (_MyEditItem != null) - { - _MyStepRTB = _MyEditItem.MyStepRTB; - if (_MyStepRTB != null) - { - _MyStepRTB.Disposed -= new EventHandler(_MyStepRTB_Disposed); - _MyStepRTB.Disposed += new EventHandler(_MyStepRTB_Disposed); - } - } - else - _MyStepRTB = null; - } - else - { - _MyItemInfo = null; - _MyEditItem = null; - _MyStepRTB = null; - } - if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args); - } - - void _MyStepRTB_Disposed(object sender, EventArgs e) - { - _MyStepRTB = null; - } - - public event StepPanelModeChangeEvent ModeChange; - - internal void OnModeChange(object sender, StepRTBModeChangeEventArgs args) - { - if (ModeChange != null) ModeChange(sender, args); - else FlexibleMessageBox.Show("Cannot change mode"); - } - - public event StepPanelTabDisplayEvent PanelTabDisplay; - internal void OnPanelTabDisplay(object sender, StepPanelTabDisplayEventArgs args) - { - if (PanelTabDisplay != null) PanelTabDisplay(sender, args); - else FlexibleMessageBox.Show("Cannot display information"); - } - - public event StepPanelWordSectionCloseEvent WordSectionClose; - internal void OnWordSectionClose(object sender, WordSectionEventArgs args) - { - if (WordSectionClose != null) WordSectionClose(sender, args); - else FlexibleMessageBox.Show("Cannot close associated Word section"); - } - - public event StepPanelWordSectionDeletedEvent WordSectionDeleted; - internal void OnWordSectionDeleted(object sender, WordSectionEventArgs args) - { - if (WordSectionDeleted != null) WordSectionDeleted(sender, args); - else FlexibleMessageBox.Show("Cannot delete associated Word section"); - } - - public event StepPanelItemPastedEvent ItemPaste; - internal void OnItemPaste(object sender, vlnTreeItemInfoPasteEventArgs args) - { - if (ItemPaste != null) ItemPaste(sender, args); - else FlexibleMessageBox.Show("Cannot adjust panels for pasted item"); - } - - #endregion - - #region Contructor & Setup - - public DisplayTabControl() - { - InitializeComponent(); - SetUp(); - } - - private void SetUp() - { - ItemsChangeIds = new Dictionary(); - _RemovedDisplayTabItems = new List(); - Dock = DockStyle.Fill; - dotNetBarManager1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - _MyDisplayTabItems = new Dictionary(); - SetupBar(_MyBar); - dotNetBarManager1.BarTearOff += new EventHandler(dotNetBarManager1_BarTearOff); - this.Resize += new EventHandler(DisplayTabControl_Resize); - } - 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 (_MyEditItem != null) - _MyEditItem.ItemShow(); - } - private void SetupBar(Bar myBar) - { - if (myBar.DockTabControl != null) - { - myBar.DockTabControl.CloseButtonOnTabsVisible = true; - myBar.DockTabControl.CloseButtonVisible = false; - myBar.DockTabControl.CloseButtonPosition = DevComponents.DotNetBar.eTabCloseButtonPosition.Right; - myBar.DockTabControl.Width = ClientRectangle.Width; - } - myBar.DockTabClosing -= new DockTabClosingEventHandler(myBar_DockTabClosing); - myBar.DockTabClosing += new DockTabClosingEventHandler(myBar_DockTabClosing); - if (!myBar.Visible) - myBar.Visible = true; - myBar.RecalcLayout(); - } - #endregion - #region Internal Event Handlers - /// - /// This is code recommended by DotNetBar - /// - /// - /// - void dotNetBarManager1_BarTearOff(object sender, EventArgs e) - { - Bar myBar = sender as Bar; - myBar.Enter += new EventHandler(myBar_Enter); - } - /// - /// This sets-up the bar after it is selected. - /// - /// - /// - void myBar_Enter(object sender, EventArgs e) - { - Bar myBar = sender as Bar; - myBar.Enter -= new EventHandler(myBar_Enter); - SetupBar(sender as Bar); - } - /// - /// This handles the closing of a document page - /// - /// - /// - void myBar_DockTabClosing(object sender, DockTabClosingEventArgs e) - { - e.RemoveDockTab = true; - _RemovedDisplayTabItems.Add((DisplayTabItem)e.DockContainerItem); - if (_MyDisplayTabItems.ContainsKey(((DisplayTabItem)e.DockContainerItem).MyKey)) - _MyDisplayTabItems.Remove(((DisplayTabItem)e.DockContainerItem).MyKey); // C2015-022 separate windows supporting logic - DisplayTabItem dti = e.DockContainerItem as DisplayTabItem; - if (dti != null && dti.MyStepTabPanel != null) - dti.MyStepTabPanel.MyStepPanel.Dispose(); - DisplayTabItem myTabItem = e.DockContainerItem as DisplayTabItem; - if (myTabItem != null) - { - if (myTabItem.MyDSOTabPanel != null) - { - myTabItem.MyDSOTabPanel.CloseDSO(); - } - } - MySessionInfo.CheckInItem(dti.OwnerID); - if (((Bar)sender).Items == null) return; - if (((Bar)sender).Items.Count == 1)// Remove bar if last item is closed... - { - //B2026 - 048 View Only Mode freezes PROMS if last tab closed - //if last item is closing, need to re-enable Step Properties - //so if closing in view only mode will not freeze when re-opening - if (MyEditItem != null && MyEditItem.MyStepPanel.VwMode == E_ViewMode.View) - { - OnEnableDisableStepProperties(new StepTabRibbonEventArgs(MyEditItem.MyItemInfo, 0, E_ViewMode.Edit)); - } - - Bar bar = sender as Bar; - if (bar != null) - { - if (dotNetBarManager1.Bars.Contains(bar.Name)) - dotNetBarManager1.Bars.Remove(bar); - ActivateRemainingTab(); - } - // B2018-123 the last tab in the main window was closed. - // remove the procedure version id from the _AllDTCs dictionary - // reset VersionID to zero so that we know the main window is available - _AllDTCs.Remove(VersionID); - VersionID = 0; - } - else - { - if (!ShuttingDown) // B2022-026 RO Memory Reduction code - don't activate if shutting down PROMS - ActivateRemainingTab((Bar)sender); - } - } - - public event StepTabRibbonEvent EnableDisableStepProperties; - private void OnEnableDisableStepProperties(StepTabRibbonEventArgs args) - { - if (EnableDisableStepProperties != null) - EnableDisableStepProperties(this, args); - } - #endregion - #region Public Methods - public void RefreshItem(ItemInfo myItemInfo) - { - ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item - string key = "Item - " + proc.ItemID.ToString(); - - if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it - { - DisplayTabItem pg = _MyDisplayTabItems[key]; - if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID)) - OpenItem(myItemInfo, false); - } - } - - public DisplayTabItem OpenItem(ItemInfo myItemInfo2) - { - //B2017-251 Added Error Log message for Open Step or MSWord section include time to do open - DateTime tStart = DateTime.Now; - DisplayTabItem dti = OpenItem(myItemInfo2, true); - _MyLog.InfoFormat("OpenItem {0} seconds {1} {2}", TimeSpan.FromTicks(DateTime.Now.Ticks - tStart.Ticks).TotalSeconds, myItemInfo2.ItemID, myItemInfo2.ShortPath); - return dti; - } - - /// - /// Open a Step Item or a Word Item - /// - /// - /// - // C2023-016 Added doingFindReplace where if true Word section will not be opened - used only when doing Find/Replace - // We are not opening and searching inside Word sections, instead we just stop on the section title in the procedure editor (if a match is found in the title) - public DisplayTabItem OpenItem(ItemInfo myItemInfo2, bool setFocus, bool doingFindReplace=false) - { - ItemInfo myItemInfo = myItemInfo2; - - bool viewonlymode = false; - - //B2025-046 Remember Tabs failing when swapping versions of PROMS - if (myItemInfo?.MyDocVersion == null) // bug fix: B2016-108 disconnected data will not have a MyDocVersion - { - FlexibleMessageBox.Show(this, "Possible disconnected item", "Item Not Found"); - return null; - } - - string message = string.Empty; - //if (!MySessionInfo.CanCheckOutItem(myItemInfo.MyDocVersion.VersionID, CheckOutType.DocVersion, ref message)) - //{ - // message = "The Working Draft is being processed.\n\n" + message; - // MessageBox.Show(this, message, "Cannot Check Out Procedure", MessageBoxButtons.OK, MessageBoxIcon.Warning); - //} - if (myItemInfo.MyContent.MyEntry == null) //not a document - { - if (!MySessionInfo.CanCheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message)) - { - DisplayTabItem dti = MyBar?.Items?.OfType().FirstOrDefault(x => x.MyItemInfo?.ItemID == myItemInfo.MyProcedure.ItemID); - - //C2019-036 View Only mode work with Checked Out Procedures - //shouldn't prompt - should just auto put in view only if already in open tab - //in view only - if ( - (dti != null && dti.MyStepTabPanel.MyStepPanel.VwMode == E_ViewMode.View) - || - (SeparateWindows && VersionID == myItemInfo.MyDocVersion.VersionID) - || //to handle special case where item will be opened in a separate window - MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) - viewonlymode = true; - else - return null; - } - } - else - { - if (!MySessionInfo.CanCheckOutItem(myItemInfo.MyContent.MyEntry.DocID, CheckOutType.Document, ref message)) - { - FlexibleMessageBox.Show(this, message, "Document Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return null; - } - } - - CleanUpClosedItems(); - if (myItemInfo == null) return null; - - // if this is an auto table of contents section, don't edit it: - if (myItemInfo.IsAutoTOCSection) - { - FlexibleMessageBox.Show("This is an automatically generated 'Table of Contents' section. It is not editable. It is generated during Print.", "Item not Editable", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return SelectedDisplayTabItem; - } - - bool libDocAlreadyOpen = false; - if (myItemInfo.MyContent.MyEntry != null) // Trying to open a Word document - see if it's a library document that is already opened. - libDocAlreadyOpen = LibDocAlreadyOpen(myItemInfo); - - // C2015-022 modified if statement logic to support separate windows - // if opening the first procedure in a set, and the main PROMS window has a procedure opened from a different set, - // then create a new child window. All other procedures from that same set will open in this child window. - // _AllDTCs is a dictionary of of all procedure sets opened along with their DisplayTabContol. The key to - // the dictioan is the set's VersionID - - // B2018-048 needed to add a check to see if we are in Separate Windows - // else we get stuck in a OpenItem loop when last DocVersion ID is not equal to the current DocVersion ID - // happened when you open a procedure then close the procedure tab, do a text search in a different procedure set - // then select one of search results. - if (SeparateWindows && VersionID != 0) - { - if (!libDocAlreadyOpen) - { - if (!_AllDTCs.ContainsKey(myItemInfo.MyDocVersion.VersionID)) - { - OnOpenInSeparateWindow(new ItemSelectedChangedEventArgs(myItemInfo2)); // create a child (separate) PROMS window - return _AllDTCs[myItemInfo.MyDocVersion.VersionID].OpenItem(myItemInfo); - } - } - - if (VersionID != myItemInfo.MyDocVersion.VersionID && _AllDTCs.ContainsKey(myItemInfo.MyDocVersion.VersionID)) - { - return _AllDTCs[myItemInfo.MyDocVersion.VersionID].OpenItem(myItemInfo); - } - } - - if (!libDocAlreadyOpen) - VersionID = myItemInfo.MyDocVersion.VersionID; // add it to _AllDTCs - - _MyBar = GetParentBar(myItemInfo); // Get the docking bar associated with this item. - - // C2023-016 if a Word section and doing Find/Replace don't open Word section, position to section title in step editor instead - if (myItemInfo.MyContent.MyEntry == null || doingFindReplace) // If it is not a Word document open in step editor - { - return OpenStepTabPage(myItemInfo, setFocus, viewonlymode); - } - else // Otherwise open it in the Word editor - { - // B2025-034 Check to make sure that EDWord is installed in PROMS. If not return NULL. - object EDOfficeViewerX = GetValue(@"HKEY_CLASSES_ROOT\EDOfficeViewerX.Connect\CLSID\", @"", null); - - object EDWordCtrl = GetValue(@"HKEY_CLASSES_ROOT\EDWORD.EDWordCtrl.1\CLSID\", @"", null); - - if (EDOfficeViewerX == null || EDWordCtrl == null) - { - - 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.", "Error in Word section", - MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return null; - } - else - { - Document.ConvertWordSectionToDOCX(myItemInfo); // B2023-093 Convert a Word section to the DOCX Word format if needed before opening it for edit - return OpenDSOTabPage(myItemInfo); - } - } - - } - public T GetValue(string registryKeyPath, string value, T defaultValue = default(T)) - { - 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) - { - CleanUpClosedItems(); - ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item - string key = "Item - " + proc.ItemID.ToString(); - - if (_MyDisplayTabItems.ContainsKey(key) && pasteType != ItemInfo.EAddpingPart.Replace) // If procedure page open use it unless replace - { - DisplayTabItem pg = _MyDisplayTabItems[key]; - // B2024-038: if section, refresh the editor even if the section is not expanded. - bool isSec = myItemInfo.IsSection; - if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID) && - (pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID].Expanded || isSec)) - { - EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID]; - switch (pasteType) - { - case ItemInfo.EAddpingPart.Child: - edtitm.PasteChild(copyStartID); - break; - case ItemInfo.EAddpingPart.Before: - edtitm.PasteSiblingBefore(copyStartID); - break; - case ItemInfo.EAddpingPart.After: - edtitm.PasteSiblingAfter(copyStartID); - break; - case ItemInfo.EAddpingPart.Replace: - - EditItem ei = edtitm.PasteReplace(copyStartID); - if (ei == null) - { - CloseTabItem(_MyDisplayTabItems["Item - " + myItemInfo.ItemID.ToString()]); //Grab itemID and set to close open tab. - return false; //B2017-179 PasteReplace will return null if was aborted - } - - if (ei.MyItemInfo.ItemID != edtitm.MyItemInfo.ItemID) - { - edtitm.Dispose(); - MyCopyStep = ei.MyItemInfo; - } - break; - default: - return false; - } - return true; - } - } - else if (_MyDisplayTabItems.ContainsKey(key) && pasteType == ItemInfo.EAddpingPart.Replace) - { - // 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. - return false; //B2017-179 PasteReplace will return null if was aborted - } - return false; - } - - public bool DeleteRTBItem(ItemInfo myItemInfo) - { - CleanUpClosedItems(); - - //removeitem! - ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item - string key = "Item - " + proc.ItemID.ToString(); - - if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it - { - DisplayTabItem pg = _MyDisplayTabItems[key]; - // if deleting a procedure, close the tab. - if (proc.ItemID == myItemInfo.ItemID) - { - // do we need to close open doc tabs associated with this proc. - CloseTabItem(pg); - return false; - } - if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID)) - { - EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID]; - edtitm.RemoveItem(); - return true; - } - } - return false; - } - - public bool InsertRTBItem(ItemInfo myItemInfo, string text, E_InsertType insertType, E_FromType fromType, int type, bool updateSelection) - { - CleanUpClosedItems(); - ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item - string key = "Item - " + proc.ItemID.ToString(); - - if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it - { - DisplayTabItem pg = _MyDisplayTabItems[key]; - if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID)) - { - EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID]; - switch (insertType) - { - case E_InsertType.Before: - edtitm.AddSiblingBefore(text, updateSelection); - break; - case E_InsertType.After: - edtitm.AddSiblingAfter(text, updateSelection); - break; - case E_InsertType.Child: - edtitm.AddChild(text, fromType, type, null); - break; - default: - return false; ; - } - return true; - } - } - return false; - } - - private void CleanUpClosedItems() - { - while (_RemovedDisplayTabItems.Count > 0) // Clean-up any items that have been closed. - { - DisplayTabItem myTabItem = _RemovedDisplayTabItems[0]; - _RemovedDisplayTabItems.RemoveAt(0); - RemoveItem(myTabItem); - } - } - - public void CloseWordItem(ItemInfo myItemInfo) - { - CloseWordItem(myItemInfo, false); - } - - public void CloseWordItem(ItemInfo myItemInfo, bool isBeingDeleted) - { - CleanUpClosedItems(); - string key = "Doc - "; - // there is no entry if it is an auto table of contents: - if (myItemInfo.MyContent.MyEntry != null) - key = key + myItemInfo.MyContent.MyEntry.MyDocument.DocID.ToString(); - else - key = key + "0"; - DisplayTabItem myTabItem = null; - if (_MyDisplayTabItems.ContainsKey(key)) // If page open, close it - { - myTabItem = _MyDisplayTabItems[key]; - if (myTabItem.MyDSOTabPanel != null) - { - myTabItem.MyDSOTabPanel.IsBeingDeleted = isBeingDeleted; - CloseTabItem(myTabItem); - } - } - } - - public void CloseTabItem(DisplayTabItem myTabItem) - { - if (myTabItem.ContainerControl == null) return; - Bar b = myTabItem.ContainerControl as Bar; - if (b != null) - { - try - { - b.CloseDockTab(myTabItem); - } - catch - { - //This is to work around a bug inside 3rd party DotNetBar - //The bug occurs when events happen out of order and it tries - //to remove a TabItem from the Collection the has already been removed - } - - RemoveItem(myTabItem); - } - } - /// - /// Look for a tab and set it to active. - /// - private void ActivateRemainingTab() - { - foreach (Bar myBar in dotNetBarManager1.Bars) - { - if (myBar.DockSide == eDockSide.Document && myBar.Visible) - { - ActivateRemainingTab(myBar); - return; - } - } - // No Document Tabs Remaining - need to raise OnItemSelectedChanged - OnItemSelectedChanged(this, null); - } - private DisplayTabItem FindRemainingTab(Bar myBar) - { - // C2023-004: Proms reverts to first tab rather than active tab/save last selected tab is and use to reset to it - // B2023-078 Added the check for LastSelectedDisplayTabItem is in myBar. This fixes a crash issue where user has as split screen - // each with procedure tabs and closes a procedure tab in the split screen that does not currently have focus. - // that other screen has its own myBar list which does not contain the LastSelectedDisplayTabItem references. - // In that case we want to run through the foreach loop to find a tab in the currently active split screen side - if (LastSelectedDisplayTabItem != null && myBar.Items.Contains(LastSelectedDisplayTabItem) && !_RemovedDisplayTabItems.Contains(LastSelectedDisplayTabItem)) - return LastSelectedDisplayTabItem; - foreach (DisplayTabItem itm in myBar.Items) - { - if (!_RemovedDisplayTabItems.Contains(itm)) return itm; - } - return null; - } - private void ActivateRemainingTab(Bar myBar) - { - if (myBar.SelectedDockContainerItem != null) - { - if (_RemovedDisplayTabItems.Contains(myBar.SelectedDockContainerItem as DisplayTabItem)) - myBar.SelectedDockContainerItem = FindRemainingTab(myBar); - myBar.SelectedDockContainerItem.Selected = true; - StepTabPanel pnl = myBar.SelectedDockContainerItem.Control as StepTabPanel; - if (pnl != null) - pnl.MyStepPanel.ItemShow(); - } - } - #endregion - #region Public Properties - private AnnotationDetails _MyAnnotationDetails; - public AnnotationDetails MyAnnotationDetails // B2019-029: added to find annotation details for saving w/o btnsave click - { - get { return _MyAnnotationDetails; } - set { _MyAnnotationDetails = value; } - } - private SessionInfo _MySessionInfo; - public SessionInfo MySessionInfo - { - get { return _MySessionInfo; } - set { _MySessionInfo = value; } - } - public DevComponents.DotNetBar.Bar MyBar - { - get { return _MyBar; } - } - public Panel PnlCaret - { - get { return _PnlCaret; } - } - private static int trackerSC = 0; - private bool _ShuttingDown = false; - - public bool ShuttingDown - { - get { return _ShuttingDown; } - set { _ShuttingDown = value; } - } - public void ShowCaret() - { - if (_ShuttingDown) return; - if (_MyStepRTB != null) - { - if (_MyEditItem.RTBLastFocus) - { - if (_MyStepRTB.MyItemInfo != null && _MyStepRTB.MyItemInfo.IsRtfRaw) return; - trackerSC++; - /*if (trackerSC>20) *///Console.WriteLine("ShowCaret: {0}", trackerSC); - //Volian.Base.Library.vlnStackTrace.ShowStack("ShowCaret: EI: {0} StepRTB: {1}", _MyEditItem.MyItemInfo.ItemID, _MyStepRTB.MyItemInfo.ItemID); - if (!_MyStepRTB.Visible) - _MyStepRTB.Visible = true; - if (_MyStepRTB.SelectionLength == 0) - { - Point pt = _MyStepRTB.GetPositionFromCharIndex(_MyStepRTB.SelectionStart); - pt = _MyStepRTB.PointToScreen(pt); - pt = this.PointToClient(pt); - PnlCaret.Location = pt; - PnlCaret.BackColor = _MyStepRTB.ForeColor; - using (Graphics gr = this.CreateGraphics()) - { - SizeF sf = gr.MeasureString("Mg", _MyStepRTB.SelectionFont); - sf.Width = 1; - PnlCaret.Size = sf.ToSize(); - } - tmrCaret.Enabled = true; - } - else - _MyStepRTB.HideSelection = false; // bug fix B215-147 we used to insert a highlight command - caused issues with IsDirty() where false dirtyness was reported - } - } - } - private static int trackerHC = 0; - public void HideCaret() - { - if (_MyStepRTB != null && !_MyStepRTB.Disposing && !_MyStepRTB.Closed) - { - trackerHC++; - /* if (trackerHC>20)*/ //Console.WriteLine("HideCaret {0}", trackerHC); - //Volian.Base.Library.vlnStackTrace.ShowStack("HideCaret: StepRTB: {0}", _MyStepRTB.MyItemInfo.ItemID); - HideTheCaret(); - if (_MyStepRTB.SelectionLength > 0) - _MyStepRTB.HideSelection = true; // bug fix B215-147 we used to insert a highlight command - caused issues with IsDirty() where false dirtyness was reported - } - } - public void HideTheCaret() - { - tmrCaret.Enabled = false; - PnlCaret.Visible = false; - } - // B2019-161 When tracking timing time this action - private static VolianTimer _TimeActivity = new VolianTimer("DisplayTabControl.cs tmrCaret_Tick", 881); - - private void tmrCaret_Tick(object sender, EventArgs e) - { - _TimeActivity.Open(); - PnlCaret.Visible = !PnlCaret.Visible; - _TimeActivity.Close(); - } - #endregion - #region Private Methods - ///// - ///// Gets and sets the SelectedDisplayTabItem (Active Tab) - ///// - //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) - { - if (myDisplayTabItem != null) - { - if (!myDisplayTabItem.Selected) - { - myDisplayTabItem.Focus(); - myDisplayTabItem.Selected = true; - } - } - } - // C2023-004: Proms reverts to first tab rather than active tab/save last selected tab is and use to reset to it - private DisplayTabItem _lastSelectedDisplayTabItem; - public DisplayTabItem LastSelectedDisplayTabItem - { - get { return _lastSelectedDisplayTabItem; } - set { _lastSelectedDisplayTabItem = value; } - } - private DisplayTabItem _SelectedDisplayTabItem = null; - public DisplayTabItem SelectedDisplayTabItem - { - get { return _SelectedDisplayTabItem; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - if (_SelectedDisplayTabItem != value) - { - if (_SelectedDisplayTabItem != null && _SelectedDisplayTabItem.MyDSOTabPanel != null) - _SelectedDisplayTabItem.MyDSOTabPanel.InActive(); - _lastSelectedDisplayTabItem = _SelectedDisplayTabItem; - _SelectedDisplayTabItem = value; - OnSelectedDisplayTabItemChanged(this, new EventArgs()); - } - } - } - /// - /// This returns the parent bar (current docking location) for an item. - /// It creates a bar if none exist - /// - /// - /// - private Bar GetParentBar(ItemInfo myItemInfo) - { - Bar myBar = null; - foreach (Bar b in dotNetBarManager1.Bars) - { - if (b.DockSide == eDockSide.Document && b.Visible) - { - if (myBar == null) myBar = b;// Remember the first available bar if a specific bar cannot be found - foreach (object itm in b.Items) - { - DisplayTabItem myTabItem = itm as DisplayTabItem; - if (myTabItem != null && myTabItem.MyStepTabPanel != null && myItemInfo != null) - if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID) - return b; - } - } - } - if (myBar == null) - { - // If no documents bars found, create new one - _UniqueBarCount++; - myBar = BarUtilities.CreateDocumentBar(); - myBar.DockTabClosing += new DockTabClosingEventHandler(myBar_DockTabClosing); - myBar.Name = "barDocuments" + _UniqueBarCount.ToString(); - fillDocDockSite.GetDocumentUIManager().Dock(myBar); - SetupBar(myBar); - } - return myBar; - } - public StepTabPanel GetProcedureTabPanel(ItemInfo myItemInfo) - { - Bar myBar = null; - foreach (Bar b in dotNetBarManager1.Bars) - { - if (b.DockSide == eDockSide.Document && b.Visible) - { - if (myBar == null) myBar = b;// Remember the first available bar if a specific bar cannot be found - foreach (object itm in b.Items) - { - DisplayTabItem myTabItem = itm as DisplayTabItem; - if (myTabItem != null && myTabItem.MyStepTabPanel != null && myTabItem.MyStepTabPanel.MyProcedureItemInfo != null) - if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID) - return myTabItem.MyStepTabPanel; - } - } - } - return null; - } - /// - /// Save the current EditItem if it is in Edit mode - /// - /// ProcedureInfo - public void SaveCurrentEditItem(ProcedureInfo pi) - { - DisplayTabItem dti = GetProcDisplayTabItem(pi); - if (dti == null) return; - EditItem ei = dti.MyStepTabPanel.SelectedEditItem; - if (ei == null) return; - ei.SaveCurrentAndContents(); - } - /// - /// Save the current EditItem if it is in Edit mode - /// - public void SaveCurrentEditItem() - { - foreach (DisplayTabItem dti in _MyDisplayTabItems.Values) - { - StepTabPanel stp = dti.MyStepTabPanel; - if (stp != null) - { - EditItem ei = stp.SelectedEditItem; - if (ei != null) - ei.SaveCurrentAndContents(); - } - } - } - - public DisplayTabItem GetProcDisplayTabItem(ItemInfo myItemInfo) - { - ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item - string key = "Item - " + proc.ItemID.ToString(); - DisplayTabItem pg = null; - if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it - return _MyDisplayTabItems[key]; - return null; - } - /// - /// This opens a Step page based upon a ItemInfo. - /// - /// - /// - /// - //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 dicEnhancedDocuments = new Dictionary(); - - private DisplayTabItem OpenStepTabPage(ItemInfo myItemInfo, bool setFocus, bool viewonlymode = false) - { - ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item - string key = "Item - " + proc.ItemID.ToString(); - DisplayTabItem pg = null; - - if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it - { - pg = _MyDisplayTabItems[key]; - if (setFocus) - { - pg.Selected = true; - HandleChangeId(myItemInfo, pg); - if (SelectedDisplayTabItem != pg) // If the selected page doesn't match - SelectDisplayTabItem(pg); // Set the selected page - } - } - else // If not already open, create a new Page - { - pg = new DisplayTabItem(this.components, this, proc, key, viewonlymode); // Open a new Procedure Tab - _MyDisplayTabItems.Add(key, pg); - if (setFocus) - { - pg.Selected = true; - HandleChangeId(myItemInfo, 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 - // casting it crashed: - ProcedureInfo pi = ProcedureInfo.Get(myItemInfo.MyProcedure.ItemID); - ItemInfoList iil = pi.FindEnhancedProcedureTextDifferences(); - if (iil != null) - { - // C2019-045: See if this is a procedure & modifications are allowed, if that case, don't prompt: - bool doMsg = true; - if (iil.Count == 1 && iil[0].EnhAllowMod()) doMsg = false; - if (doMsg && FlexibleMessageBox.Show(this, "Text differences were found between this enhanced procedure and its source procedure. Do you want to refresh the text in this procedure?", "Confirm Text Refresh", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) - { - pi.EnhancedProcedureRefreshTextDifferences(iil); - } - } - //} - } - pg.MyStepTabPanel.MyProcedureItemInfo = proc; - - // When more than one procedure is openned, the ribbon control cuts off the bottom of the buttons. - // This happened to all the procedure tabs after the first one. - // This is to kludge the logic into sizing the ribbon control properly. - // This is done by toggling "pg.MyStepTabPanel.MyStepTabRibbon.Expanded" - // Note that we are doing the NOT of its current setting. This takes care of when the - // ribbon bar is minimized and a new procedure tab is created - pg.MyStepTabPanel.MyStepTabRibbon.Expanded = !pg.MyStepTabPanel.MyStepTabRibbon.Expanded; - pg.MyStepTabPanel.MyStepTabRibbon.Expanded = !pg.MyStepTabPanel.MyStepTabRibbon.Expanded; - } - Application.DoEvents(); - 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; - } - private bool _SyncEnhancedDocuments; - public bool SyncEnhancedDocuments - { - get { return _SyncEnhancedDocuments; } - set { _SyncEnhancedDocuments = value; } - } - public void HandleChangeId(ItemInfo myItemInfo, DisplayTabItem pg) - { - if (myItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds) - { - if (ItemsChangeIds.ContainsKey(myItemInfo.MyProcedure.ItemID)) SetChangeId(ItemsChangeIds[myItemInfo.MyProcedure.ItemID], pg, myItemInfo); - else PromptForChangeId(myItemInfo, pg); - } - } - private void PromptForChangeId(ItemInfo myItemInfo, DisplayTabItem pg) - { - if (!Volian.Base.Library.VlnSettings.GetCommandFlag("NOCHGID")) - { - dlgChgId dlgCI = new dlgChgId(this); //, null); - dlgCI.ShowDialog(this); - } - ItemsChangeIds.Add(myItemInfo.MyProcedure.ItemID, ChgId); - SetChangeId(ChgId, pg, myItemInfo); - } - - 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); - ChgId = chgid; - } - - private bool LibDocAlreadyOpen(ItemInfo myItemInfo) - { - EntryInfo myEntry = myItemInfo.MyContent.MyEntry; - string key = "Doc - " + myEntry.DocID; - DisplayTabItem pg = null; - return LibDocAlreadyOpen(myItemInfo, key, ref pg, false); - } - - private bool LibDocAlreadyOpen(ItemInfo myItemInfo, string key, ref DisplayTabItem pg, bool displayMsg) - { - bool libDocAlreadyOpen = false; - - // C2015-022 part of separate windows logic, check all tabs in all windows to see if lib docs - if (_AllDTCs != null && _AllDTCs.Count > 0) - { - foreach (int k in _AllDTCs.Keys) - { - DisplayTabControl dtc = _AllDTCs[k]; - if (dtc._MyDisplayTabItems.ContainsKey(key)) - { - pg = dtc._MyDisplayTabItems[key]; - if (pg.MyItemInfo.ItemID != myItemInfo.ItemID) - { - if (displayMsg) - { - string msg = string.Format("{0} is already open", myItemInfo.MyContent.MyEntry.MyDocument.LibTitle); - FlexibleMessageBox.Show(msg, "Library Document is Already Open", MessageBoxButtons.OK); - } - libDocAlreadyOpen = true; - break; - } - } - } - } - - return libDocAlreadyOpen; - } - /// - /// This opens a Word page based upon an itemInfo. Since a word document may be a library - /// document, the related DocID is used for the Word document. - /// - /// - /// - private DisplayTabItem OpenDSOTabPage(ItemInfo myItemInfo) - { - DisplayTabItem pg = null; - EntryInfo myEntry = myItemInfo.MyContent.MyEntry; - string key = "Doc - " + myEntry.DocID; - bool libDocAlreadyOpen = LibDocAlreadyOpen(myItemInfo, key, ref pg, true); - if (!libDocAlreadyOpen && pg == null) - { - if (DSOTabPanel.Count >= DSOTabPanel.MSWordLimit) // Limit the number of open document pages to 18 - { - FlexibleMessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another"); - 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 - // 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 - if (pg.MyDSOTabPanel.MyEdWord == null) - { - pg = OpenDSOTabPage(myItemInfo); - if (pg.MyDSOTabPanel.MyEdWord == null) - return null; // even the blank or recovered attachment cannot be opened - else - return pg; - } - _MyDisplayTabItems.Add(key, pg); - } - SelectDisplayTabItem(pg); - pg.MyDSOTabPanel.EnterPanel(); - return pg; - } - public DisplayTabItem OpenDSOTabPage(DocumentInfo myDocumentInfo) - { - _MyBar = GetParentBar(null); // B2016-131 - allow open of a non-referenced library document - CleanUpClosedItems(); - DisplayTabItem pg = null; - string key = "Doc - " + myDocumentInfo.DocID; - if (_MyDisplayTabItems.ContainsKey(key)) // If document page open use it - pg = _MyDisplayTabItems[key]; - else - { - if (DSOTabPanel.Count > DSOTabPanel.MSWordLimit) //18) // Limit the number of open document pages to 18 - { - FlexibleMessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another"); - return null; - } - pg = new DisplayTabItem(this.components, this, myDocumentInfo, key); // Open a new document page - _MyDisplayTabItems.Add(key, pg); - } - SelectDisplayTabItem(pg); - pg.MyDSOTabPanel.EnterPanel(); - return pg; - } - /// - /// Clean-up after a page is closed - /// - /// - internal void RemoveItem(DisplayTabItem myDisplayTabItem) - { - if (_MyDisplayTabItems.ContainsKey(myDisplayTabItem.MyKey)) - { - try - { - _MyDisplayTabItems.Remove(myDisplayTabItem.MyKey); - - // Dispose of the procedure tab panel - if (myDisplayTabItem.MyStepTabPanel != null) - myDisplayTabItem.MyStepTabPanel.Dispose(); - - // Dispose of the MS Word Panel - if (myDisplayTabItem.MyDSOTabPanel != null) - myDisplayTabItem.MyDSOTabPanel.CloseDSO(); - - components.Remove(myDisplayTabItem); - myDisplayTabItem.Dispose(); - } - catch { } - } - } - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.resx b/PROMS/Volian.Controls.Library/DisplayTabControl.resx deleted file mode 100644 index 0e2e6930..00000000 --- a/PROMS/Volian.Controls.Library/DisplayTabControl.resx +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 168, 17 - - - 295, 17 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplayTabItem.Designer.cs b/PROMS/Volian.Controls.Library/DisplayTabItem.Designer.cs deleted file mode 100644 index b21848c5..00000000 --- a/PROMS/Volian.Controls.Library/DisplayTabItem.Designer.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class DisplayTabItem - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - //protected override void Dispose(bool disposing) - //{ - // if (disposing && (components != null)) - // { - // components.Dispose(); - // } - // base.Dispose(disposing); - //} - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayTabItem.cs b/PROMS/Volian.Controls.Library/DisplayTabItem.cs deleted file mode 100644 index 8206bf3c..00000000 --- a/PROMS/Volian.Controls.Library/DisplayTabItem.cs +++ /dev/null @@ -1,415 +0,0 @@ -using System; -using System.ComponentModel; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using System.Drawing; -using VEPROMS.CSLA.Library; -using JR.Utils.GUI.Forms; - -namespace Volian.Controls.Library -{ - public partial class DisplayTabItem : DevComponents.DotNetBar.DockContainerItem - { - #region Private Fields - private DisplayTabControl _MyDisplayTabControl; - private ItemInfo _MyItemInfo; - private StepTabPanel _MyStepTabPanel; - private string _MyKey; - private DSOTabPanel _MyDSOTabPanel; - private DocumentInfo _MyDocumentInfo; - - - #endregion - #region Properties - /// - /// ItemInfo associated with this DisplayTabItem - /// - private int _OwnerID; - public int OwnerID - { - get { return _OwnerID; } - set { _OwnerID = value; } - } - public ItemInfo MyItemInfo - { - get { return _MyItemInfo; } - //set { _MyItemInfo = value; } - } - /// - /// get Key Either: - /// "Item - " + Procedure ItemID for step pages - /// "Doc - " + DocumentID for Word Documents - /// - public string MyKey - { - get { return _MyKey; } - } - /// - /// Related StepTabPanel for a Step page - /// - public StepTabPanel MyStepTabPanel - { - get { return _MyStepTabPanel; } - set { _MyStepTabPanel = value; } - } - /// - /// Related DSOTabPanle for a Word page - /// - public DSOTabPanel MyDSOTabPanel - { - 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; } - } - /// - /// Current SelectedItemInfo for this page - /// - public ItemInfo SelectedItemInfo - { - get - { - if (_MyStepTabPanel == null) return null; - return _MyStepTabPanel.SelectedItemInfo; - } - set - {// B2018-074 Don't crash if opening MSWord section from Tools window in Debug Mode - if (_MyStepTabPanel != null) - _MyStepTabPanel.SelectedItemInfo = value; - } - } - /// - /// Current DocumentInfo for this page - only set if library document - /// - public DocumentInfo MyDocumentInfo - { - get { return _MyDocumentInfo; } - } - #endregion - #region Constructors - public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, ItemInfo myItemInfo, string myKey, bool viewonlymode = false) - { - _MyItemInfo = myItemInfo; - //C2019-036 View Only mode work with Checked Out Procedures - //don't want to check out if opening in View Only Mode Due to someone else having it checked out - if (!viewonlymode) - { - if (MyItemInfo.MyContent.MyEntry == null) - OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure); - else - OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyContent.MyEntry.DocID, CheckOutType.Document); - } - //Console.WriteLine("DisplayTabItem"); - _MyKey = myKey; - _MyDisplayTabControl = myDisplayTabControl; - container.Add(this); - InitializeComponent(); - this.Click += new EventHandler(DisplayTabItem_Click); - if (myItemInfo.MyContent.MyEntry == null) - SetupStepTabPanel(viewonlymode); - else - SetupDSOTabPanel(); - 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; - public void SetupSecurity(ItemInfo myItem) - { - //C2019-036 View Only mode work with Checked Out Procedures - //is in View Only Mode, so do not set up the Security - if (OwnerID == 0) - { - - UserInfo uiViewOnly = UserInfo.GetByUserID(Base.Library.VlnSettings.UserID); - if (uiViewOnly.IsAdministrator()) - { - MyUserRole = $"{Base.Library.VlnSettings.UserID} - Administrator"; - } - else if (uiViewOnly.IsSetAdministrator(myItem.MyDocVersion)) - { - MyUserRole = $"{Base.Library.VlnSettings.UserID} - Set Administrator"; - } - else if (uiViewOnly.IsWriter(myItem.MyDocVersion)) - { - MyUserRole = $"{Base.Library.VlnSettings.UserID} - Writer"; - } - else if (uiViewOnly.IsROEditor(myItem.MyDocVersion)) - { - MyUserRole = $"{Base.Library.VlnSettings.UserID} - RO Editor"; - } - else - { - MyUserRole = $"{Base.Library.VlnSettings.UserID} - Reviewer"; - } - - return; - } - - UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID); - - if (ui == null) - { - if (!MesssageShown) - { - 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; - } - _MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode(); - } - else if (ui.IsAdministrator()) - { - if (_MyStepTabPanel != null) - _MyStepTabPanel.MyStepTabRibbon.SetupAdminMode(); - - MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Administrator"; - } - else if (ui.IsSetAdministrator(myItem.MyDocVersion)) - { - if (_MyStepTabPanel != null) - _MyStepTabPanel.MyStepTabRibbon.SetupSetAdminMode(); - MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Set Administrator"; - } - else if (ui.IsROEditor(myItem.MyDocVersion) && !ui.IsWriter(myItem.MyDocVersion)) - { - if (_MyStepTabPanel != null) - _MyStepTabPanel.MyStepTabRibbon.SetupROEditorMode(); - MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - RO Editor"; - } - else if (ui.IsWriter(myItem.MyDocVersion)) - { - if (_MyStepTabPanel != null) - _MyStepTabPanel.MyStepTabRibbon.SetupWriterMode(); - MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Writer"; - } - else if (ui.IsReviewer(myItem.MyDocVersion)) - { - if (_MyStepTabPanel != null) - _MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode(); - MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer"; - } - else - { - if (_MyStepTabPanel != null) - _MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode(); - MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer"; - } - } - public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, DocumentInfo myDocumentInfo, string myKey) - { - OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myDocumentInfo.DocID, CheckOutType.Document); - _MyKey = myKey; - _MyDisplayTabControl = myDisplayTabControl; - _MyDocumentInfo = myDocumentInfo; - container.Add(this); - InitializeComponent(); - this.Click += new EventHandler(DisplayTabItem_Click); - 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() - { - //Console.WriteLine("=>=>=>=> OnDisplayedChanged"); - if (_MyStepTabPanel != null) - _MyStepTabPanel.MyStepPanel.DisplayItemChanging = true; - base.OnDisplayedChanged(); - if (_MyStepTabPanel != null) - _MyStepTabPanel.MyStepPanel.DisplayItemChanging = false; - //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 - #region Event Handlers - /// - /// Updates SelectedRTBItem when the user selects a DisplayTabItem - /// - /// - /// - private void DisplayTabItem_Click(object sender, EventArgs e) - { - // Tell the TabControl that the ItemSelected has changed - DisplayTabItem myTabItem = sender as DisplayTabItem; - if (myTabItem == null) return; - StepTabPanel myTabPanel = myTabItem.MyStepTabPanel as StepTabPanel; - if (myTabPanel == null) return; - if (MyStepTabPanel.SelectedEditItem == null) return; - MyStepTabPanel.MyDisplayTabControl.HandleChangeId(MyStepTabPanel.SelectedEditItem.MyItemInfo, myTabItem); - _MyDisplayTabControl.OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(MyStepTabPanel.SelectedEditItem)); - } - #endregion - #region private Methods - /// - /// Creates and sets-up a StepTabPanel - /// - private void SetupStepTabPanel(bool viewonlymode = false) - { - ((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).BeginInit(); - _MyDisplayTabControl.MyBar.SuspendLayout(); - _MyStepTabPanel = new StepTabPanel(_MyDisplayTabControl); - // - // tabItem - // - 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; - _MyItemInfo.Changed += new ItemInfoEvent(_MyItemInfo_Changed); - Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\"); - MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove); - LostFocus += new EventHandler(DisplayTabItem_LostFocus); - // - _MyDisplayTabControl.Controls.Add(_MyStepTabPanel); - _MyDisplayTabControl.MyBar.Items.Add(this); - _MyDisplayTabControl.MyBar.Width = 300; // This triggers the bar to resize itself - // - // tabPanel - // - _MyStepTabPanel.MyDisplayTabItem = this; - ((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).EndInit(); - _MyDisplayTabControl.MyBar.ResumeLayout(false); - DocVersionInfo dvi = _MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; //MyRTBItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; - if (dvi == null) return; - if (dvi.VersionType > 127 || viewonlymode) - MyStepTabPanel.MyStepPanel.VwMode = E_ViewMode.View; - // C2021 - 027: Procedure level PC/PC - add _MyIteminfo to argument list - if (dvi.MultiUnitCount > 1) - this.MyStepTabPanel.MyStepTabRibbon.SetParentChildCreatePDFButton(dvi.UnitNames, _MyItemInfo); //C2020-013 add parent/child sub menu items for printing specific children (units) - } - void _MyItemInfo_Changed(object sender) - { - Text = _MyItemInfo.TabTitle; - Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\"); - } - void DisplayTabItem_LostFocus(object sender, EventArgs e) - { - if (Tooltip != _Tooltip) - Tooltip = _Tooltip; - } - private string _Tooltip; - public void SetPrivateTooltip(string tt) - { - _Tooltip = tt; - } - void DisplayTabItem_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) - { - string newTooltip = e.Y > 30 ? null : _Tooltip; - if (Tooltip != newTooltip) - Tooltip = newTooltip; - } - /// - /// Creates and sets-up a DSOTabPanel - /// - private void SetupDSOTabPanel() - { - EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry; - UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID); - _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 - // - // tabItem - // - 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; - Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\"); - MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove); - LostFocus += new EventHandler(DisplayTabItem_LostFocus); - _MyDisplayTabControl.Controls.Add(_MyDSOTabPanel); - DSOTabPanel.IgnoreEnter = true; - //Console.WriteLine("AddRange {0}", Name); - _MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this}); - // - // tabPanel - // - _MyDisplayTabControl.SelectDisplayTabItem(this); - _MyDSOTabPanel.MyDisplayTabItem = this; - DSOTabPanel.IgnoreEnter = false; - } - private void SetupLibraryDocumentDSOTabPanel() - { - UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID); - // B2016-131 if myiteminfo is null, then the lib doc is not referenced. - // - 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 - _MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl, _MyItemInfo, (MyItemInfo != null) ? UserInfo.CanEdit(ui, MyItemInfo.MyDocVersion) : ui.IsAdministrator()); - // - // tabItem - // - 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; - DocumentConfig dc = new DocumentConfig(_MyDocumentInfo); - Tooltip = _Tooltip = dc.LibDoc_Comment; - MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove); - LostFocus += new EventHandler(DisplayTabItem_LostFocus); - _MyDisplayTabControl.Controls.Add(_MyDSOTabPanel); - DSOTabPanel.IgnoreEnter = true; - _MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this}); - // - // tabPanel - // - _MyDisplayTabControl.SelectDisplayTabItem(this); - _MyDSOTabPanel.MyDisplayTabItem = this; - DSOTabPanel.IgnoreEnter = false; - } - #endregion - public override string ToString() - { - if (MyDSOTabPanel != null) - return MyDSOTabPanel.ToString(); - if (MyStepTabPanel != null) - return MyStepTabPanel.ToString(); - return "NULL"; - } - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayTags.Designer.cs b/PROMS/Volian.Controls.Library/DisplayTags.Designer.cs deleted file mode 100644 index 6ff9ced5..00000000 --- a/PROMS/Volian.Controls.Library/DisplayTags.Designer.cs +++ /dev/null @@ -1,882 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class DisplayTags - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.groupPanelPaginate = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.cbPrefPageBreak = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbPageBreak = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbCAS = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cmbCheckoff = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.cmbShwRplWds = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.groupPanelCheckoff = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.cbInitialLine = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.groupPanelcmbShwRplWds = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.groupPanelChgBar = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.tbChgID = new System.Windows.Forms.TextBox(); - this.lblChgId = new System.Windows.Forms.Label(); - this.rbChgBarOff = new System.Windows.Forms.RadioButton(); - this.rbChgBarOn = new System.Windows.Forms.RadioButton(); - this.groupPanelChgStepType = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.lblNoTypeChgReason = new DevComponents.DotNetBar.LabelX(); - this.cbChgAll = new System.Windows.Forms.CheckBox(); - this.listBoxStepTypes = new System.Windows.Forms.ListBox(); - this.superTooltipTags = new DevComponents.DotNetBar.SuperTooltip(); - this.cbPlaceKeeperCont = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbPlaceKeeper = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbIncludeInTOC = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbTCAS = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.groupPanelIncludeOn = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.groupPanelWcnTrnResp = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.tbRespons = new System.Windows.Forms.TextBox(); - this.groupPanelFigSize = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.btnFSrestore = new System.Windows.Forms.Button(); - this.trBarFS = new System.Windows.Forms.TrackBar(); - this.btnFsSav = new System.Windows.Forms.Button(); - this.tbFSHt = new System.Windows.Forms.TextBox(); - this.tbFSWd = new System.Windows.Forms.TextBox(); - this.lblFSHt = new System.Windows.Forms.Label(); - this.lblFSWidth = new System.Windows.Forms.Label(); - this.btnSaveChangeID = new System.Windows.Forms.Button(); - this.groupPanelPaginate.SuspendLayout(); - this.groupPanelCheckoff.SuspendLayout(); - this.groupPanelcmbShwRplWds.SuspendLayout(); - this.groupPanelChgBar.SuspendLayout(); - this.groupPanelChgStepType.SuspendLayout(); - this.groupPanelIncludeOn.SuspendLayout(); - this.groupPanelWcnTrnResp.SuspendLayout(); - this.groupPanelFigSize.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.trBarFS)).BeginInit(); - this.SuspendLayout(); - // - // groupPanelPaginate - // - this.groupPanelPaginate.BackColor = System.Drawing.Color.Transparent; - this.groupPanelPaginate.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelPaginate.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelPaginate.Controls.Add(this.cbPrefPageBreak); - this.groupPanelPaginate.Controls.Add(this.cbPageBreak); - this.groupPanelPaginate.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelPaginate.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelPaginate.Location = new System.Drawing.Point(0, 425); - this.groupPanelPaginate.Margin = new System.Windows.Forms.Padding(2); - this.groupPanelPaginate.Name = "groupPanelPaginate"; - this.groupPanelPaginate.Size = new System.Drawing.Size(202, 58); - // - // - // - this.groupPanelPaginate.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelPaginate.Style.BackColorGradientAngle = 90; - this.groupPanelPaginate.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelPaginate.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelPaginate.Style.BorderBottomWidth = 1; - this.groupPanelPaginate.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelPaginate.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelPaginate.Style.BorderLeftWidth = 1; - this.groupPanelPaginate.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelPaginate.Style.BorderRightWidth = 1; - this.groupPanelPaginate.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelPaginate.Style.BorderTopWidth = 1; - this.groupPanelPaginate.Style.CornerDiameter = 4; - this.groupPanelPaginate.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelPaginate.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelPaginate.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelPaginate.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelPaginate.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelPaginate.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelPaginate.TabIndex = 11; - this.groupPanelPaginate.Text = "Pagination"; - // - // cbPrefPageBreak - // - this.cbPrefPageBreak.AutoSize = true; - // - // - // - this.cbPrefPageBreak.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbPrefPageBreak.Location = new System.Drawing.Point(3, 19); - this.cbPrefPageBreak.Margin = new System.Windows.Forms.Padding(2); - this.cbPrefPageBreak.Name = "cbPrefPageBreak"; - this.cbPrefPageBreak.Size = new System.Drawing.Size(195, 15); - this.superTooltipTags.SetSuperTooltip(this.cbPrefPageBreak, new DevComponents.DotNetBar.SuperTooltipInfo("Preferred Page Break for Supplemental Info", "", "When set, starts this step at the top of a page.\r\n\r\nkeyboard command: ", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbPrefPageBreak.TabIndex = 1; - this.cbPrefPageBreak.Text = "Preferred Page Break (for Sup Info)"; - this.cbPrefPageBreak.CheckedChanged += new System.EventHandler(this.cbPrefPageBreak_CheckedChanged); - // - // cbPageBreak - // - this.cbPageBreak.AutoSize = true; - // - // - // - this.cbPageBreak.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbPageBreak.Location = new System.Drawing.Point(3, 2); - this.cbPageBreak.Margin = new System.Windows.Forms.Padding(2); - this.cbPageBreak.Name = "cbPageBreak"; - this.cbPageBreak.Size = new System.Drawing.Size(122, 15); - this.superTooltipTags.SetSuperTooltip(this.cbPageBreak, new DevComponents.DotNetBar.SuperTooltipInfo("Manual Page Break", "", "When set, starts this step at the top of a page.\r\n\r\nkeyboard command: ", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbPageBreak.TabIndex = 0; - this.cbPageBreak.Text = "Manual Page Break"; - this.cbPageBreak.CheckedChanged += new System.EventHandler(this.cbPageBreak_CheckedChanged); - // - // cbCAS - // - this.cbCAS.AutoSize = true; - this.cbCAS.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbCAS.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbCAS.Location = new System.Drawing.Point(3, 1); - this.cbCAS.Margin = new System.Windows.Forms.Padding(2); - this.cbCAS.Name = "cbCAS"; - this.cbCAS.Size = new System.Drawing.Size(162, 15); - this.superTooltipTags.SetSuperTooltip(this.cbCAS, new DevComponents.DotNetBar.SuperTooltipInfo("Continuous Action Summary", "", "Include this in the Continuous Action Summary section\r\n\r\nkeyboard command: ", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbCAS.TabIndex = 1; - this.cbCAS.Text = "Continuous Action Summary"; - this.cbCAS.CheckedChanged += new System.EventHandler(this.cbCAS_CheckedChanged); - // - // cmbCheckoff - // - this.cmbCheckoff.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.cmbCheckoff.DisplayMember = "Text"; - this.cmbCheckoff.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.cmbCheckoff.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cmbCheckoff.FormattingEnabled = true; - this.cmbCheckoff.ItemHeight = 17; - this.cmbCheckoff.Location = new System.Drawing.Point(3, 17); - this.cmbCheckoff.Margin = new System.Windows.Forms.Padding(2); - this.cmbCheckoff.Name = "cmbCheckoff"; - this.cmbCheckoff.Size = new System.Drawing.Size(194, 23); - this.cmbCheckoff.TabIndex = 0; - this.cmbCheckoff.WatermarkFont = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cmbCheckoff.WatermarkText = "select signoff / checkoff"; - this.cmbCheckoff.SelectedIndexChanged += new System.EventHandler(this.cmbCheckoff_SelectedIndexChanged); - // - // cmbShwRplWds - // - this.cmbShwRplWds.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.cmbShwRplWds.DisplayMember = "Text"; - this.cmbShwRplWds.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.cmbShwRplWds.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cmbShwRplWds.FormattingEnabled = true; - this.cmbShwRplWds.ItemHeight = 17; - this.cmbShwRplWds.Items.AddRange(new object[] { - "Inherit from Section", - "Show replace words", - "Do not show replace words"}); - this.cmbShwRplWds.Location = new System.Drawing.Point(3, 17); - this.cmbShwRplWds.Margin = new System.Windows.Forms.Padding(2); - this.cmbShwRplWds.Name = "cmbShwRplWds"; - this.cmbShwRplWds.Size = new System.Drawing.Size(194, 23); - this.cmbShwRplWds.TabIndex = 0; - this.cmbShwRplWds.WatermarkFont = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cmbShwRplWds.WatermarkText = "Show Replace Words"; - this.cmbShwRplWds.SelectedIndexChanged += new System.EventHandler(this.cmbShwRplWds_SelectedIndexChanged); - // - // groupPanelCheckoff - // - this.groupPanelCheckoff.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelCheckoff.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelCheckoff.Controls.Add(this.cmbCheckoff); - this.groupPanelCheckoff.Controls.Add(this.cbInitialLine); - this.groupPanelCheckoff.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelCheckoff.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelCheckoff.Location = new System.Drawing.Point(0, 231); - this.groupPanelCheckoff.Margin = new System.Windows.Forms.Padding(2); - this.groupPanelCheckoff.Name = "groupPanelCheckoff"; - this.groupPanelCheckoff.Size = new System.Drawing.Size(202, 86); - // - // - // - this.groupPanelCheckoff.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelCheckoff.Style.BackColorGradientAngle = 90; - this.groupPanelCheckoff.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelCheckoff.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelCheckoff.Style.BorderBottomWidth = 1; - this.groupPanelCheckoff.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelCheckoff.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelCheckoff.Style.BorderLeftWidth = 1; - this.groupPanelCheckoff.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelCheckoff.Style.BorderRightWidth = 1; - this.groupPanelCheckoff.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelCheckoff.Style.BorderTopWidth = 1; - this.groupPanelCheckoff.Style.CornerDiameter = 4; - this.groupPanelCheckoff.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelCheckoff.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelCheckoff.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelCheckoff.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelCheckoff.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelCheckoff.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelCheckoff.TabIndex = 8; - this.groupPanelCheckoff.Text = "Signoff / Checkoff"; - this.groupPanelCheckoff.VisibleChanged += new System.EventHandler(this.groupPanelCheckoff_VisibleChanged); - // - // cbInitialLine - // - this.cbInitialLine.AutoSize = true; - this.cbInitialLine.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbInitialLine.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbInitialLine.Location = new System.Drawing.Point(3, 44); - this.cbInitialLine.Margin = new System.Windows.Forms.Padding(2); - this.cbInitialLine.Name = "cbInitialLine"; - this.cbInitialLine.Size = new System.Drawing.Size(112, 15); - this.superTooltipTags.SetSuperTooltip(this.cbInitialLine, new DevComponents.DotNetBar.SuperTooltipInfo("Disable Initial Line", "", "When set, The initial line will be removed from this step.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbInitialLine.TabIndex = 1; - this.cbInitialLine.Text = "Disable Initial Line"; - this.cbInitialLine.Visible = false; - this.cbInitialLine.CheckedChanged += new System.EventHandler(this.cbInitialLine_CheckedChanged); - // - // groupPanelcmbShwRplWds - // - this.groupPanelcmbShwRplWds.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelcmbShwRplWds.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelcmbShwRplWds.Controls.Add(this.cmbShwRplWds); - this.groupPanelcmbShwRplWds.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelcmbShwRplWds.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelcmbShwRplWds.Location = new System.Drawing.Point(0, 145); - this.groupPanelcmbShwRplWds.Margin = new System.Windows.Forms.Padding(2); - this.groupPanelcmbShwRplWds.Name = "groupPanelcmbShwRplWds"; - this.groupPanelcmbShwRplWds.Size = new System.Drawing.Size(202, 86); - // - // - // - this.groupPanelcmbShwRplWds.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelcmbShwRplWds.Style.BackColorGradientAngle = 90; - this.groupPanelcmbShwRplWds.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelcmbShwRplWds.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelcmbShwRplWds.Style.BorderBottomWidth = 1; - this.groupPanelcmbShwRplWds.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelcmbShwRplWds.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelcmbShwRplWds.Style.BorderLeftWidth = 1; - this.groupPanelcmbShwRplWds.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelcmbShwRplWds.Style.BorderRightWidth = 1; - this.groupPanelcmbShwRplWds.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelcmbShwRplWds.Style.BorderTopWidth = 1; - this.groupPanelcmbShwRplWds.Style.CornerDiameter = 4; - this.groupPanelcmbShwRplWds.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelcmbShwRplWds.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelcmbShwRplWds.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelcmbShwRplWds.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelcmbShwRplWds.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelcmbShwRplWds.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelcmbShwRplWds.TabIndex = 8; - this.groupPanelcmbShwRplWds.Text = "Show Replace Words"; - this.groupPanelcmbShwRplWds.VisibleChanged += new System.EventHandler(this.groupPanelcmbShwRplWds_VisibleChanged); - // - // groupPanelChgBar - // - this.groupPanelChgBar.BackColor = System.Drawing.Color.Transparent; - this.groupPanelChgBar.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelChgBar.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelChgBar.Controls.Add(this.btnSaveChangeID); - this.groupPanelChgBar.Controls.Add(this.tbChgID); - this.groupPanelChgBar.Controls.Add(this.lblChgId); - this.groupPanelChgBar.Controls.Add(this.rbChgBarOff); - this.groupPanelChgBar.Controls.Add(this.rbChgBarOn); - this.groupPanelChgBar.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelChgBar.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelChgBar.Location = new System.Drawing.Point(0, 317); - this.groupPanelChgBar.Margin = new System.Windows.Forms.Padding(2); - this.groupPanelChgBar.Name = "groupPanelChgBar"; - this.groupPanelChgBar.Size = new System.Drawing.Size(202, 108); - // - // - // - this.groupPanelChgBar.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelChgBar.Style.BackColorGradientAngle = 90; - this.groupPanelChgBar.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelChgBar.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelChgBar.Style.BorderBottomWidth = 1; - this.groupPanelChgBar.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelChgBar.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelChgBar.Style.BorderLeftWidth = 1; - this.groupPanelChgBar.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelChgBar.Style.BorderRightWidth = 1; - this.groupPanelChgBar.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelChgBar.Style.BorderTopWidth = 1; - this.groupPanelChgBar.Style.CornerDiameter = 4; - this.groupPanelChgBar.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelChgBar.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelChgBar.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelChgBar.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelChgBar.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelChgBar.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.superTooltipTags.SetSuperTooltip(this.groupPanelChgBar, new DevComponents.DotNetBar.SuperTooltipInfo("Change Bars", "", "This allows you to toggle the change bar on/off.\r\nkeyboard command: ", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.groupPanelChgBar.TabIndex = 18; - this.groupPanelChgBar.Text = "Change Bar"; - // - // tbChgID - // - this.tbChgID.Location = new System.Drawing.Point(0, 67); - this.tbChgID.Margin = new System.Windows.Forms.Padding(2); - this.tbChgID.Name = "tbChgID"; - this.tbChgID.Size = new System.Drawing.Size(81, 20); - this.tbChgID.TabIndex = 4; - // - // lblChgId - // - this.lblChgId.AutoSize = true; - this.lblChgId.Location = new System.Drawing.Point(0, 52); - this.lblChgId.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.lblChgId.Name = "lblChgId"; - this.lblChgId.Size = new System.Drawing.Size(58, 13); - this.lblChgId.TabIndex = 3; - this.lblChgId.Text = "Change ID"; - // - // rbChgBarOff - // - this.rbChgBarOff.AutoSize = true; - this.rbChgBarOff.Location = new System.Drawing.Point(0, 26); - this.rbChgBarOff.Margin = new System.Windows.Forms.Padding(2); - this.rbChgBarOff.Name = "rbChgBarOff"; - this.rbChgBarOff.Size = new System.Drawing.Size(45, 17); - this.superTooltipTags.SetSuperTooltip(this.rbChgBarOff, new DevComponents.DotNetBar.SuperTooltipInfo("Change Bar OFF", "", "Turn change bar off. Note that \'OVERRIDE\' will turn off a change bar even though" + - " text is changed.\r\n\r\nkeyboard command: ", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.rbChgBarOff.TabIndex = 2; - this.rbChgBarOff.TabStop = true; - this.rbChgBarOff.Text = "OFF"; - this.rbChgBarOff.UseVisualStyleBackColor = true; - this.rbChgBarOff.CheckedChanged += new System.EventHandler(this.rbChgBarOvrRideOff_CheckedChanged); - // - // rbChgBarOn - // - this.rbChgBarOn.AutoSize = true; - this.rbChgBarOn.Location = new System.Drawing.Point(0, 4); - this.rbChgBarOn.Margin = new System.Windows.Forms.Padding(2); - this.rbChgBarOn.Name = "rbChgBarOn"; - this.rbChgBarOn.Size = new System.Drawing.Size(41, 17); - this.superTooltipTags.SetSuperTooltip(this.rbChgBarOn, new DevComponents.DotNetBar.SuperTooltipInfo("Change Bar ON", "", "Add a change bar on this step\r\n\r\nkeyboard command: ", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.rbChgBarOn.TabIndex = 1; - this.rbChgBarOn.TabStop = true; - this.rbChgBarOn.Text = "ON"; - this.rbChgBarOn.UseVisualStyleBackColor = true; - this.rbChgBarOn.CheckedChanged += new System.EventHandler(this.rbChgBarOvrRideOn_CheckedChanged); - // - // groupPanelChgStepType - // - this.groupPanelChgStepType.BackColor = System.Drawing.SystemColors.Control; - this.groupPanelChgStepType.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelChgStepType.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelChgStepType.Controls.Add(this.lblNoTypeChgReason); - this.groupPanelChgStepType.Controls.Add(this.cbChgAll); - this.groupPanelChgStepType.Controls.Add(this.listBoxStepTypes); - this.groupPanelChgStepType.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelChgStepType.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelChgStepType.Location = new System.Drawing.Point(0, 0); - this.groupPanelChgStepType.Margin = new System.Windows.Forms.Padding(2); - this.groupPanelChgStepType.Name = "groupPanelChgStepType"; - this.groupPanelChgStepType.Size = new System.Drawing.Size(202, 145); - // - // - // - this.groupPanelChgStepType.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelChgStepType.Style.BackColorGradientAngle = 90; - this.groupPanelChgStepType.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelChgStepType.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelChgStepType.Style.BorderBottomWidth = 1; - this.groupPanelChgStepType.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelChgStepType.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelChgStepType.Style.BorderLeftWidth = 1; - this.groupPanelChgStepType.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelChgStepType.Style.BorderRightWidth = 1; - this.groupPanelChgStepType.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelChgStepType.Style.BorderTopWidth = 1; - this.groupPanelChgStepType.Style.CornerDiameter = 4; - this.groupPanelChgStepType.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelChgStepType.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelChgStepType.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelChgStepType.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelChgStepType.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelChgStepType.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelChgStepType.TabIndex = 19; - this.groupPanelChgStepType.Text = "Change Step Type"; - // - // lblNoTypeChgReason - // - this.lblNoTypeChgReason.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.lblNoTypeChgReason.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.lblNoTypeChgReason.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.lblNoTypeChgReason.ForeColor = System.Drawing.Color.Red; - this.lblNoTypeChgReason.Location = new System.Drawing.Point(2, 28); - this.lblNoTypeChgReason.Margin = new System.Windows.Forms.Padding(2); - this.lblNoTypeChgReason.Name = "lblNoTypeChgReason"; - this.lblNoTypeChgReason.Size = new System.Drawing.Size(194, 96); - this.lblNoTypeChgReason.TabIndex = 5; - // - // cbChgAll - // - this.cbChgAll.AutoSize = true; - this.cbChgAll.BackColor = System.Drawing.Color.Transparent; - this.cbChgAll.Location = new System.Drawing.Point(2, 6); - this.cbChgAll.Margin = new System.Windows.Forms.Padding(2); - this.cbChgAll.Name = "cbChgAll"; - this.cbChgAll.Size = new System.Drawing.Size(119, 17); - this.superTooltipTags.SetSuperTooltip(this.cbChgAll, new DevComponents.DotNetBar.SuperTooltipInfo("Change Step Type - All At Level", "", "When checked, all steps at the level of current step will have their step type ch" + - "anged to the selected type in list below...", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbChgAll.TabIndex = 4; - this.cbChgAll.Text = "Change All At Level"; - this.cbChgAll.UseVisualStyleBackColor = false; - // - // listBoxStepTypes - // - this.listBoxStepTypes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listBoxStepTypes.FormattingEnabled = true; - this.listBoxStepTypes.Location = new System.Drawing.Point(2, 28); - this.listBoxStepTypes.Margin = new System.Windows.Forms.Padding(2); - this.listBoxStepTypes.Name = "listBoxStepTypes"; - this.listBoxStepTypes.Size = new System.Drawing.Size(194, 95); - this.superTooltipTags.SetSuperTooltip(this.listBoxStepTypes, new DevComponents.DotNetBar.SuperTooltipInfo("Possible Step Types", "", "This list allows change of type showing all selections of any possible step type " + - "for the current step.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.listBoxStepTypes.TabIndex = 3; - this.listBoxStepTypes.SelectedIndexChanged += new System.EventHandler(this.listBoxStepTypes_SelectedIndexChanged); - // - // superTooltipTags - // - this.superTooltipTags.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray); - this.superTooltipTags.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - // - // cbPlaceKeeperCont - // - this.cbPlaceKeeperCont.AutoSize = true; - this.cbPlaceKeeperCont.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbPlaceKeeperCont.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbPlaceKeeperCont.Location = new System.Drawing.Point(3, 58); - this.cbPlaceKeeperCont.Margin = new System.Windows.Forms.Padding(2); - this.cbPlaceKeeperCont.Name = "cbPlaceKeeperCont"; - this.cbPlaceKeeperCont.Size = new System.Drawing.Size(158, 15); - this.superTooltipTags.SetSuperTooltip(this.cbPlaceKeeperCont, new DevComponents.DotNetBar.SuperTooltipInfo("Placekeeper Continuous Action", "", "Include this on the Placekeeper marked as a Continuous Action\r\n\r\nkeyboard command" + - ": ", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbPlaceKeeperCont.TabIndex = 1; - this.cbPlaceKeeperCont.Text = "Placekeeper as Cont Action"; - this.cbPlaceKeeperCont.CheckedChanged += new System.EventHandler(this.cbPlaceKeeperCont_CheckedChanged); - // - // cbPlaceKeeper - // - this.cbPlaceKeeper.AutoSize = true; - this.cbPlaceKeeper.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbPlaceKeeper.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbPlaceKeeper.Location = new System.Drawing.Point(3, 39); - this.cbPlaceKeeper.Margin = new System.Windows.Forms.Padding(2); - this.cbPlaceKeeper.Name = "cbPlaceKeeper"; - this.cbPlaceKeeper.Size = new System.Drawing.Size(84, 15); - this.superTooltipTags.SetSuperTooltip(this.cbPlaceKeeper, new DevComponents.DotNetBar.SuperTooltipInfo("Placekeeper", "", "Include this on the Placekeeper\r\n\r\nkeyboard command: ", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbPlaceKeeper.TabIndex = 1; - this.cbPlaceKeeper.Text = "Placekeeper"; - this.cbPlaceKeeper.CheckedChanged += new System.EventHandler(this.cbPlacekeeper_CheckedChanged); - // - // cbIncludeInTOC - // - this.cbIncludeInTOC.AutoSize = true; - this.cbIncludeInTOC.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbIncludeInTOC.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbIncludeInTOC.Location = new System.Drawing.Point(2, 78); - this.cbIncludeInTOC.Margin = new System.Windows.Forms.Padding(2); - this.cbIncludeInTOC.Name = "cbIncludeInTOC"; - this.cbIncludeInTOC.Size = new System.Drawing.Size(109, 15); - this.cbIncludeInTOC.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.superTooltipTags.SetSuperTooltip(this.cbIncludeInTOC, new DevComponents.DotNetBar.SuperTooltipInfo("High Level Step in TOC", "", "Include this in the auto generated Table of Contents.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbIncludeInTOC.TabIndex = 2; - this.cbIncludeInTOC.Text = "Table of Contents"; - this.cbIncludeInTOC.CheckedChanged += new System.EventHandler(this.cbIncludeInTOC_CheckedChanged); - // - // cbTCAS - // - this.cbTCAS.AutoSize = true; - this.cbTCAS.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbTCAS.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbTCAS.Location = new System.Drawing.Point(3, 20); - this.cbTCAS.Margin = new System.Windows.Forms.Padding(2); - this.cbTCAS.Name = "cbTCAS"; - this.cbTCAS.Size = new System.Drawing.Size(167, 15); - this.superTooltipTags.SetSuperTooltip(this.cbTCAS, new DevComponents.DotNetBar.SuperTooltipInfo("Time Critical Action Summary", "", "Include this in the Time Critical Action Summary section", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbTCAS.TabIndex = 3; - this.cbTCAS.Text = "Time Critical Action Summary"; - this.cbTCAS.CheckedChanged += new System.EventHandler(this.cbTCAS_CheckedChanged); - // - // groupPanelIncludeOn - // - this.groupPanelIncludeOn.BackColor = System.Drawing.Color.Transparent; - this.groupPanelIncludeOn.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelIncludeOn.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelIncludeOn.Controls.Add(this.cbTCAS); - this.groupPanelIncludeOn.Controls.Add(this.cbIncludeInTOC); - this.groupPanelIncludeOn.Controls.Add(this.cbPlaceKeeperCont); - this.groupPanelIncludeOn.Controls.Add(this.cbPlaceKeeper); - this.groupPanelIncludeOn.Controls.Add(this.cbCAS); - this.groupPanelIncludeOn.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelIncludeOn.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelIncludeOn.Location = new System.Drawing.Point(0, 483); - this.groupPanelIncludeOn.Margin = new System.Windows.Forms.Padding(2); - this.groupPanelIncludeOn.Name = "groupPanelIncludeOn"; - this.groupPanelIncludeOn.Size = new System.Drawing.Size(202, 121); - // - // - // - this.groupPanelIncludeOn.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelIncludeOn.Style.BackColorGradientAngle = 90; - this.groupPanelIncludeOn.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelIncludeOn.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelIncludeOn.Style.BorderBottomWidth = 1; - this.groupPanelIncludeOn.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelIncludeOn.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelIncludeOn.Style.BorderLeftWidth = 1; - this.groupPanelIncludeOn.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelIncludeOn.Style.BorderRightWidth = 1; - this.groupPanelIncludeOn.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelIncludeOn.Style.BorderTopWidth = 1; - this.groupPanelIncludeOn.Style.CornerDiameter = 4; - this.groupPanelIncludeOn.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelIncludeOn.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelIncludeOn.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelIncludeOn.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelIncludeOn.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelIncludeOn.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelIncludeOn.TabIndex = 17; - this.groupPanelIncludeOn.Text = "Include On"; - // - // groupPanelWcnTrnResp - // - this.groupPanelWcnTrnResp.BackColor = System.Drawing.Color.Transparent; - this.groupPanelWcnTrnResp.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelWcnTrnResp.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelWcnTrnResp.Controls.Add(this.tbRespons); - this.groupPanelWcnTrnResp.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelWcnTrnResp.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelWcnTrnResp.Location = new System.Drawing.Point(0, 604); - this.groupPanelWcnTrnResp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.groupPanelWcnTrnResp.Name = "groupPanelWcnTrnResp"; - this.groupPanelWcnTrnResp.Size = new System.Drawing.Size(202, 138); - // - // - // - this.groupPanelWcnTrnResp.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelWcnTrnResp.Style.BackColorGradientAngle = 90; - this.groupPanelWcnTrnResp.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelWcnTrnResp.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelWcnTrnResp.Style.BorderBottomWidth = 1; - this.groupPanelWcnTrnResp.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelWcnTrnResp.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelWcnTrnResp.Style.BorderLeftWidth = 1; - this.groupPanelWcnTrnResp.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelWcnTrnResp.Style.BorderRightWidth = 1; - this.groupPanelWcnTrnResp.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelWcnTrnResp.Style.BorderTopWidth = 1; - this.groupPanelWcnTrnResp.Style.CornerDiameter = 4; - this.groupPanelWcnTrnResp.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelWcnTrnResp.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelWcnTrnResp.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelWcnTrnResp.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelWcnTrnResp.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelWcnTrnResp.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelWcnTrnResp.TabIndex = 20; - this.groupPanelWcnTrnResp.Text = "Responsibilty"; - // - // tbRespons - // - this.tbRespons.Location = new System.Drawing.Point(27, 16); - this.tbRespons.Multiline = true; - this.tbRespons.Name = "tbRespons"; - this.tbRespons.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.tbRespons.Size = new System.Drawing.Size(164, 81); - this.tbRespons.TabIndex = 0; - this.tbRespons.Leave += new System.EventHandler(this.tbRespons_Leave); - // - // groupPanelFigSize - // - this.groupPanelFigSize.BackColor = System.Drawing.Color.Transparent; - this.groupPanelFigSize.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelFigSize.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelFigSize.Controls.Add(this.btnFSrestore); - this.groupPanelFigSize.Controls.Add(this.trBarFS); - this.groupPanelFigSize.Controls.Add(this.btnFsSav); - this.groupPanelFigSize.Controls.Add(this.tbFSHt); - this.groupPanelFigSize.Controls.Add(this.tbFSWd); - this.groupPanelFigSize.Controls.Add(this.lblFSHt); - this.groupPanelFigSize.Controls.Add(this.lblFSWidth); - this.groupPanelFigSize.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelFigSize.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelFigSize.Location = new System.Drawing.Point(0, 742); - this.groupPanelFigSize.Margin = new System.Windows.Forms.Padding(2); - this.groupPanelFigSize.Name = "groupPanelFigSize"; - this.groupPanelFigSize.Size = new System.Drawing.Size(202, 135); - // - // - // - this.groupPanelFigSize.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelFigSize.Style.BackColorGradientAngle = 90; - this.groupPanelFigSize.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelFigSize.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelFigSize.Style.BorderBottomWidth = 1; - this.groupPanelFigSize.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelFigSize.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelFigSize.Style.BorderLeftWidth = 1; - this.groupPanelFigSize.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelFigSize.Style.BorderRightWidth = 1; - this.groupPanelFigSize.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelFigSize.Style.BorderTopWidth = 1; - this.groupPanelFigSize.Style.CornerDiameter = 4; - this.groupPanelFigSize.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelFigSize.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelFigSize.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelFigSize.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelFigSize.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelFigSize.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelFigSize.TabIndex = 21; - this.groupPanelFigSize.Text = "Image Size"; - // - // btnFSrestore - // - this.btnFSrestore.Location = new System.Drawing.Point(112, 27); - this.btnFSrestore.Margin = new System.Windows.Forms.Padding(2); - this.btnFSrestore.Name = "btnFSrestore"; - this.btnFSrestore.Size = new System.Drawing.Size(54, 20); - this.btnFSrestore.TabIndex = 6; - this.btnFSrestore.Text = "Restore"; - this.btnFSrestore.UseVisualStyleBackColor = true; - this.btnFSrestore.Click += new System.EventHandler(this.btnFSrestore_Click); - // - // trBarFS - // - this.trBarFS.Location = new System.Drawing.Point(11, 58); - this.trBarFS.Margin = new System.Windows.Forms.Padding(2); - this.trBarFS.Maximum = 700; - this.trBarFS.Minimum = 50; - this.trBarFS.Name = "trBarFS"; - this.trBarFS.Size = new System.Drawing.Size(129, 45); - this.trBarFS.TabIndex = 5; - this.trBarFS.Value = 50; - this.trBarFS.Scroll += new System.EventHandler(this.trBarFS_Scroll); - // - // btnFsSav - // - this.btnFsSav.Location = new System.Drawing.Point(112, 2); - this.btnFsSav.Margin = new System.Windows.Forms.Padding(2); - this.btnFsSav.Name = "btnFsSav"; - this.btnFsSav.Size = new System.Drawing.Size(46, 20); - this.btnFsSav.TabIndex = 4; - this.btnFsSav.Text = "Set"; - this.btnFsSav.UseVisualStyleBackColor = true; - this.btnFsSav.Click += new System.EventHandler(this.btnFsSav_Click); - // - // tbFSHt - // - this.tbFSHt.Enabled = false; - this.tbFSHt.Location = new System.Drawing.Point(42, 27); - this.tbFSHt.Margin = new System.Windows.Forms.Padding(2); - this.tbFSHt.Name = "tbFSHt"; - this.tbFSHt.Size = new System.Drawing.Size(60, 20); - this.tbFSHt.TabIndex = 3; - // - // tbFSWd - // - this.tbFSWd.Location = new System.Drawing.Point(42, 4); - this.tbFSWd.Margin = new System.Windows.Forms.Padding(2); - this.tbFSWd.Name = "tbFSWd"; - this.tbFSWd.Size = new System.Drawing.Size(60, 20); - this.tbFSWd.TabIndex = 2; - this.tbFSWd.Leave += new System.EventHandler(this.tbFSWd_Leave); - // - // lblFSHt - // - this.lblFSHt.AutoSize = true; - this.lblFSHt.Location = new System.Drawing.Point(4, 28); - this.lblFSHt.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.lblFSHt.Name = "lblFSHt"; - this.lblFSHt.Size = new System.Drawing.Size(38, 13); - this.lblFSHt.TabIndex = 1; - this.lblFSHt.Text = "Height"; - // - // lblFSWidth - // - this.lblFSWidth.AutoSize = true; - this.lblFSWidth.Location = new System.Drawing.Point(4, 6); - this.lblFSWidth.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.lblFSWidth.Name = "lblFSWidth"; - this.lblFSWidth.Size = new System.Drawing.Size(35, 13); - this.lblFSWidth.TabIndex = 0; - this.lblFSWidth.Text = "Width"; - // - // btnSaveChangeID - // - this.btnSaveChangeID.Location = new System.Drawing.Point(86, 65); - this.btnSaveChangeID.Name = "btnSaveChangeID"; - this.btnSaveChangeID.Size = new System.Drawing.Size(75, 23); - this.btnSaveChangeID.TabIndex = 5; - this.btnSaveChangeID.Text = "Save"; - this.btnSaveChangeID.UseVisualStyleBackColor = true; - this.btnSaveChangeID.Click += new System.EventHandler(this.btnSaveChangeID_Click); - // - // DisplayTags - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.groupPanelFigSize); - this.Controls.Add(this.groupPanelWcnTrnResp); - this.Controls.Add(this.groupPanelIncludeOn); - this.Controls.Add(this.groupPanelPaginate); - this.Controls.Add(this.groupPanelChgBar); - this.Controls.Add(this.groupPanelCheckoff); - this.Controls.Add(this.groupPanelcmbShwRplWds); - this.Controls.Add(this.groupPanelChgStepType); - this.Margin = new System.Windows.Forms.Padding(2); - this.Name = "DisplayTags"; - this.Size = new System.Drawing.Size(202, 802); - this.groupPanelPaginate.ResumeLayout(false); - this.groupPanelPaginate.PerformLayout(); - this.groupPanelCheckoff.ResumeLayout(false); - this.groupPanelcmbShwRplWds.ResumeLayout(false); - this.groupPanelcmbShwRplWds.PerformLayout(); - this.groupPanelChgBar.ResumeLayout(false); - this.groupPanelChgBar.PerformLayout(); - this.groupPanelChgStepType.ResumeLayout(false); - this.groupPanelChgStepType.PerformLayout(); - this.groupPanelIncludeOn.ResumeLayout(false); - this.groupPanelIncludeOn.PerformLayout(); - this.groupPanelWcnTrnResp.ResumeLayout(false); - this.groupPanelWcnTrnResp.PerformLayout(); - this.groupPanelFigSize.ResumeLayout(false); - this.groupPanelFigSize.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.trBarFS)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelPaginate; - private DevComponents.DotNetBar.Controls.ComboBoxEx cmbCheckoff; - private DevComponents.DotNetBar.Controls.ComboBoxEx cmbShwRplWds; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelCheckoff; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelcmbShwRplWds; - private DevComponents.DotNetBar.Controls.CheckBoxX cbPageBreak; - private DevComponents.DotNetBar.Controls.CheckBoxX cbCAS; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelChgBar; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelChgStepType; - private DevComponents.DotNetBar.LabelX lblNoTypeChgReason; - private System.Windows.Forms.CheckBox cbChgAll; - private System.Windows.Forms.ListBox listBoxStepTypes; - private System.Windows.Forms.RadioButton rbChgBarOff; - private System.Windows.Forms.RadioButton rbChgBarOn; - private DevComponents.DotNetBar.SuperTooltip superTooltipTags; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelIncludeOn; - private DevComponents.DotNetBar.Controls.CheckBoxX cbPlaceKeeper; - private DevComponents.DotNetBar.Controls.CheckBoxX cbPlaceKeeperCont; - private System.Windows.Forms.TextBox tbChgID; - private System.Windows.Forms.Label lblChgId; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelWcnTrnResp; - private System.Windows.Forms.TextBox tbRespons; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelFigSize; - private System.Windows.Forms.TextBox tbFSHt; - private System.Windows.Forms.TextBox tbFSWd; - private System.Windows.Forms.Label lblFSHt; - private System.Windows.Forms.Label lblFSWidth; - private System.Windows.Forms.Button btnFsSav; - private System.Windows.Forms.TrackBar trBarFS; - private System.Windows.Forms.Button btnFSrestore; - private DevComponents.DotNetBar.Controls.CheckBoxX cbPrefPageBreak; - private DevComponents.DotNetBar.Controls.CheckBoxX cbIncludeInTOC; - private DevComponents.DotNetBar.Controls.CheckBoxX cbTCAS; - private DevComponents.DotNetBar.Controls.CheckBoxX cbInitialLine; - private System.Windows.Forms.Button btnSaveChangeID; - } -} - diff --git a/PROMS/Volian.Controls.Library/DisplayTags.cs b/PROMS/Volian.Controls.Library/DisplayTags.cs deleted file mode 100644 index 4d5c12b1..00000000 --- a/PROMS/Volian.Controls.Library/DisplayTags.cs +++ /dev/null @@ -1,1047 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using JR.Utils.GUI.Forms; - - -namespace Volian.Controls.Library -{ - public partial class DisplayTags : UserControl - { - #region Properties - private ItemInfo _CurItemInfo = null; - /// - /// Current ItemInfo - /// - public ItemInfo CurItemInfo - { - get { return _CurItemInfo; } - set { _CurItemInfo = value; } - } - private bool _Initalizing = false; - private IList _MyStepTypeInd = null; // use to keep track of step types put in step type menu - /// - /// This stores the last selected EditItem when the Panel was not visible - /// This allows the panel to be filled when the when it is made visible - /// - private EditItem _NotVisibleEditItem; - public EditItem NotVisibleEditItem - { - get { return _NotVisibleEditItem; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - _NotVisibleEditItem = null; - if (value != null && value.MyItemInfo != null && value.MyItemInfo.IsStep) - _NotVisibleEditItem = value; // Only visible for steps - } - } - private EditItem _MyEditItem; - public EditItem MyEditItem - { - get { return _MyEditItem; } - set - { - if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface - if (!Visible) - { - NotVisibleEditItem = value; - CurItemInfo = null; - return; - } - NotVisibleEditItem = null; - if (value == null) - { - ClearControls(); - return; - } - if (CurItemInfo != null && CurItemInfo.ItemID == value.MyItemInfo.ItemID) return; - if (!value.MyItemInfo.IsStep) - { - ClearControls(); - return; - } - _MyEditItem = value; - CurItemInfo = value.MyItemInfo; - _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; - TagsFillIn(); - } - } - public bool IsVisible - { - get { return Visible; } - set { if (Visible != value) Visible = value; } - } - - #endregion - #region Constructor - public DisplayTags() - { - InitializeComponent(); - _MyStepTypeInd = new List(); - } - #endregion - #region Initialize Controls - private void ClearControls() - { - cmbCheckoff.Enabled = false; - cmbShwRplWds.Enabled = false; - cbPageBreak.Enabled = false; - cbPrefPageBreak.Enabled = false; - cbPlaceKeeper.Enabled = false; - cbPlaceKeeperCont.Enabled = false; - cbIncludeInTOC.Enabled = false; - cbCAS.Checked = false; - cbTCAS.Checked = false; - cbCAS.Enabled = false; - cbTCAS.Enabled = false; - //txbxAltConActSumText.Enabled = false; - rbChgBarOff.Enabled = false; - rbChgBarOn.Enabled = false; - listBoxStepTypes.Items.Clear(); - _MyStepTypeInd.Clear(); - tbChgID.Text = ""; - tbChgID.Enabled = false; - lblChgId.Visible = tbChgID.Visible = false; - btnSaveChangeID.Enabled = btnSaveChangeID.Visible = false; - CurItemInfo = null; - cbInitialLine.Visible = cbInitialLine.Enabled = false; - - } - private bool StepOverRide() - { - ItemInfo myparent = CurItemInfo.MyActiveParent as ItemInfo; - if (CurItemInfo.IsRNOPart && myparent !=null && myparent.IsHigh) - { - // does the high level step of an RNO have a checkoff, if so it - // can be overridden? - StepConfig sc = myparent.MyConfig as StepConfig; - if (sc != null && sc.Step_CheckOffIndex != -1) return true; - } - 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() - { - // B2016-237 added context menu item to change image size - tbFSWd.Focus(); - tbFSWd.SelectionLength = 0; - tbFSWd.SelectionStart = tbFSWd.TextLength; // position to the end of the Width text box - } - /// - /// Update text properties for height and width for new RO Image Types. - /// - public void SetNewImageHeightAndWidth(int height, int width) - { - tbFSHt.Text = height.ToString(); - tbFSWd.Text = width.ToString(); - tbFSWd.Refresh(); - tbFSHt.Refresh(); - _origFigureSizeWidth = width; - _origFigureSizeRatio = (float)height / (float)width; - } - public void ToggleChangeBar() // for use with shortcut keystoke - { - if (rbChgBarOff.Checked) - rbChgBarOn.Checked = true; - else - rbChgBarOff.Checked = true; - } - - public void ToggleContActSummary() // for use with shortcut keystroke - { - if (cbCAS.Enabled) - cbCAS.Checked = !cbCAS.Checked; - } - public void TogglePlaceKeeper() // for use with shortcut keystroke - { - if (cbPlaceKeeper.Enabled) - cbPlaceKeeper.Checked = !cbPlaceKeeper.Checked; - } - public void TogglePlaceKeeperContAct() // for use with shortcut keystroke F7> - { - if (cbPlaceKeeperCont.Enabled) - cbPlaceKeeperCont.Checked = !cbPlaceKeeperCont.Checked; - } - public void UpdatePageBreakCheckBox() // for use with shortcut keystroke - { - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - // C2023-018: if high, check oringinal flag, otherwise check sub-step flag for setting checkbox - cbPageBreak.Checked = false; // Page Break is set to false - if (sc != null && CurItemInfo.IsHigh) // otherwise, get data from config - cbPageBreak.Checked = sc.Step_NewManualPagebreak; // High Level Step has a manual page break - else if (sc != null && !CurItemInfo.IsCautionOrNotePart) - cbPageBreak.Checked = sc.Step_SubStepPagebreak; - } - public DocVersionInfo Mydvi = null; // this is initialized in vlnTreeComboSetsFillIn() - - private static UserInfo _MyUserInfo = null; - public static UserInfo MyUserInfo - { - get { return _MyUserInfo; } - set { _MyUserInfo = value; } - } - // C2020-003 This is used to sort the checkoff list from the format file - // if the checkoff has an OrderBy element, then use it for the sorting, otherwise use th checkoff Index element - private static int CompareCheckoffUsingOrderBy(CheckOff ckf1, CheckOff ckf2) - { - if (ckf1.OrderBy == null) - { - if (ckf2.OrderBy == null) // neither ckf1 nor ckf2 uses OrderBy index - { - if (ckf1.Index > ckf2.Index) return 1; //ckf1 goes before ckf2 - if (ckf1.Index < ckf2.Index) return -1; // ckf1 goes after ckf2 - return 0; //ckf1 and ckf2 have the same index value - } - else // ckf1 does not have OrderBy index but ckf2 has OrderBy index - { - if (ckf1.Index > ckf2.OrderBy) return 1; //ckf1 goes before ckf2 - if (ckf1.Index < ckf2.OrderBy) return -1; // ckf1 goes after ckf2 - return 0; //ckf1 and ckf2 have the same index value - } - } - else //ckf1 has orderBy - { - if (ckf2.OrderBy == null) // ckf1 has OrderBy index but ckf2 does not - { - if (ckf1.OrderBy > ckf2.Index) return 1; //ckf1 goes before ckf2 - if (ckf1.OrderBy < ckf2.Index) return -1; // ckf1 goes after ckf2 - return 0; //ckf1 and ckf2 have the same index value - } - else // both ckf1 and ckf2 has OrderBy index - { - if (ckf1.OrderBy > ckf2.OrderBy) return 1; //ckf1 goes before ckf2 - if (ckf2.OrderBy > ckf1.OrderBy) return -1; // ckf1 goes after ckf2 - return 0; //ckf1 and ckf2 have the same index value - } - } - } - - private Dictionary _CheckOffIndex = new Dictionary(); // C2020-003 translate the sorted index number to the actual checkoff index - private void TagsFillIn() - { - _Initalizing = true; - - // do some coloring (didn't work when setting properties) - // don't like: Goldenrod, Gold - groupPanelChgBar.Style.BackColor = Color.Cornsilk; - groupPanelChgStepType.Style.BackColor = Color.Cornsilk; - groupPanelPaginate.Style.BackColor = Color.Cornsilk; - groupPanelCheckoff.Style.BackColor = Color.Cornsilk; - groupPanelcmbShwRplWds.Style.BackColor = Color.Cornsilk; - groupPanelIncludeOn.Style.BackColor = Color.Cornsilk; - groupPanelWcnTrnResp.Style.BackColor = Color.Cornsilk; - groupPanelFigSize.Style.BackColor = Color.Cornsilk; - cbPageBreak.Checked = false; // will be set below if HLS & config has it on - cbPrefPageBreak.Checked = false; - cbPlaceKeeper.Checked = false; // will be set below if HLS & config has this set - cbPlaceKeeperCont.Checked = false; // will be set below if substep & config has this set - - // C2023-018: upgrade for 2023, allow page break setting on non-HLS under certain conditions as listed here: - // - HLS only (original) - // - Upgrade for sub-steps: Not in supplemental info (original) - // - Upgrade for sub-steps: Not in Enhanced document - // - Upgrade for sub-steps: Only for single column procedure - // - Upgrade for sub-steps: Sequential sub-steps only - // - Upgrade for sub-steps: First level sub-steps only (CurItemInfo.MyParent.IsHigh) - SectionConfig secConfig = (SectionConfig)CurItemInfo.ActiveSection.MyConfig; - bool isSingleColumn = secConfig != null && secConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One; - bool allowPageBreak = CurItemInfo.IsHigh || (!CurItemInfo.MyDocStyle.SupplementalInformation && !CurItemInfo.IsEnhancedStep - && isSingleColumn && CurItemInfo.IsSequential && CurItemInfo.MyParent.IsHigh); - cbPageBreak.Enabled = allowPageBreak; - - cbPrefPageBreak.Visible = cbPrefPageBreak.Enabled = (!CurItemInfo.IsInSupInfo && CurItemInfo.MyDocStyle.SupplementalInformation); - if (!CurItemInfo.IsFigure && !CurItemInfo.IsRtfRaw) - { - cbPlaceKeeper.Enabled = (((SectionConfig)CurItemInfo.ActiveSection.MyConfig).Section_Placekeeper == "Y"); - cbPlaceKeeperCont.Enabled = (cbPlaceKeeper.Enabled && !CurItemInfo.IsInRNO && !CurItemInfo.IsHigh); - } - else - { - cbPlaceKeeper.Enabled = cbPlaceKeeperCont.Enabled = false; - } - //cbCAS.Enabled = true; - rbChgBarOff.Enabled = true; - rbChgBarOn.Enabled = true; - - FormatData fmtdata = CurItemInfo.ActiveFormat.PlantFormat.FormatData; - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - // in certain cases, the checkbox control should be disabled, check for this stuff now... - int formatSteptype = CurItemInfo.FormatStepType; - cmbCheckoff.Enabled = true; - // C2029-025 Show or hide replace words. Can highlight replace words in editor. - cmbShwRplWds.Enabled = true; // new show replace words - if (cmbShwRplWds.Visible) - { - cmbShwRplWds.SelectedIndex = 0; - //StepConfig sc = CurItemInfo.MyConfig as StepConfig; - cmbShwRplWds.Enabled = true; - cmbShwRplWds.SelectedIndex = sc.Step_ShwRplWdsIndex; - } - if ((CurItemInfo.IsCaution || CurItemInfo.IsNote) & !fmtdata.SectData.StepSectionData.StepSectionLayoutData.TieTabToLevel) - cmbCheckoff.Enabled = false; - - if (CurItemInfo.IsRNOPart && sc != null && sc.Step_CheckOffIndex != -1 && !fmtdata.StepDataList[formatSteptype].CheckOffSameAsParent) - cmbCheckoff.Enabled = false; // Checkoffs already assigned to RNO. - - if (StepOverRide()) cmbCheckoff.Enabled = false; // Checkoffs already assigned to AER - - cbCAS.Enabled = (!CurItemInfo.IsFigure && !CurItemInfo.IsRtfRaw); - cbTCAS.Enabled = (!CurItemInfo.IsFigure && !CurItemInfo.IsRtfRaw); //F2022-024 Time Critical Action Summary - if (((CurItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) || - ((CurItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations)) - { - cbCAS.Checked = false; - cbTCAS.Checked = false; // F2022-024 ensure the check box is not checked on a Time Critical Action Background step - cbCAS.Enabled = false; - cbTCAS.Enabled = false; - cbPageBreak.Enabled = false; - cbPlaceKeeper.Enabled = false; - cbPlaceKeeperCont.Enabled = false; - } - else if (sc == null) // if there is no config data ... - { - cbPageBreak.Checked = false; // Page Break is set to false - cbCAS.Checked = CurItemInfo.IncludeOnContActSum; // set based on step type format flag - cbTCAS.Checked = CurItemInfo.IncludeOnTimeCriticalActionSum; // set based on step type format flag - cbPlaceKeeper.Checked = false; - cbPlaceKeeperCont.Checked = false; - } - else // otherwise, get data from config - { - // C2023-018: if high, use original config setting for page break, otherwise you sub-step setting - if (CurItemInfo.IsHigh) - cbPageBreak.Checked = sc.Step_NewManualPagebreak; // High Level Step has a manual page break - else - cbPageBreak.Checked = sc.Step_SubStepPagebreak; - if (cbPrefPageBreak.Enabled) cbPrefPageBreak.Checked = sc.Step_PreferredPagebreak; - cbPlaceKeeper.Checked = (sc.Step_Placekeeper == "Y"); // step text to be included on PlaceKeeper (Calvert Cliffs) - cbPlaceKeeperCont.Checked = (sc.Step_Placekeeper == "C"); // step is included on Placekeeper and marked as continuous action (Calvert Cliffs) - // set the Continuous Action Summary check box to the saved setting in the config or, if nothing in config, set to format flag setting - 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 - 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; - if (fmtdata.ProcData.CheckOffData.CheckoffOnSubStepsOnly) - _checkoffsAllowed = cmbCheckoff.Enabled = CurItemInfo.IsType("Substep"); - - int maxindx = fmtdata.ProcData.CheckOffData.CheckOffList.MaxIndexNoInherit; - if (_checkoffsAllowed && !(fmtdata.ProcData.CheckOffData.CheckOffList == null) && !(maxindx == 0)) - { - 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 - cmbCheckoff.Items.Clear(); - _CheckOffIndex.Clear(); // C2020-003 clear the checkoff index dictionary - int sortedIndx = 0; - foreach (CheckOff co in chkoffList) - { - cmbCheckoff.Items.Add(co.MenuItem); - _CheckOffIndex.Add(sortedIndx, (int)co.Index); // C2020-003 add the real index number for each sorted index - sortedIndx++; - } - // bug fix B2015-186 - // the config had a really big number for the checkoff index. - // if that config number is greater than the number of items in the checkoff list, default to an index of zero - // for the ucf, add possibility of index >= 100 which flags a UCF index. - if (sc.Step_CheckOffIndex != -1) - { - int cntindx = 0; - // find matching string & use its index: - foreach (CheckOff co in fmtdata.ProcData.CheckOffData.CheckOffList) - { - if (co.Index == sc.Step_CheckOffIndex) - { - cmbCheckoff.SelectedIndex = cntindx; - break; - } - cntindx++; - } - } - } - // if there are no checkoffs OR - // if this is a sign-off, the checkoff list is not enabled either (matches 16bit functionality) At some point, we - // may want to allow them to turn off the checkoff - // Catawba and McGuire formats use this - if (_checkoffsAllowed && (fmtdata.ProcData.CheckOffData.CheckOffList == null || maxindx == 0) || - fmtdata.ProcData.CheckOffData.Menu == "Signoff") - { - SectionConfig secf = CurItemInfo.ActiveSection.MyConfig as SectionConfig; - if (secf.Section_CheckoffListSelection > 0 && cmbCheckoff.Items.Count > 0) cmbCheckoff.SelectedIndex = secf.Section_CheckoffListSelection - ((fmtdata.ProcData.CheckOffData.Menu == "Signoff") ? 0 : 1); - cmbCheckoff.Enabled = false; - } - - - - // show the part of panel for resizing a figure (if figure already exists: MyImage is set for non-RO existing images & content.text has a link in it) - if (MyEditItem.MyItemInfo.IsFigure && (MyEditItem.MyItemInfo.MyContent.MyImage != null || MyEditItem.MyItemInfo.MyContent.Text.ToUpper().Contains("#LINK"))) - { - groupPanelFigSize.Visible = true; - int ht = (MyEditItem as ImageItem).MyPictureBox.Height; - int wd = (MyEditItem as ImageItem).MyPictureBox.Width; - _origFigureSizeRatio = (float)ht / (float)wd; // use this to keep width/height ratio while changing size. - float wd1 = (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.PageWidth - (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.LeftMargin; - float ht1 = (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.PageLength - (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.TopMargin - 36; // 36 is to allow for end message - float wd2 = Math.Min(wd1, ht1 / _origFigureSizeRatio); // keep original ratio - - SetFigure(wd1, wd2); - - tbFSWd.Text = wd.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 - { - if (MyEditItem.MyItemInfo.IsFigure) - { - //No Current image, but still show groupPanelFigSize, will adjust when file is selected, but let's give it a default - //size on using the picturebox. - groupPanelFigSize.Visible = true; - int ht = (MyEditItem as ImageItem).MyPictureBox.Height; - int wd = (MyEditItem as ImageItem).MyPictureBox.Width; - _origFigureSizeRatio = (float)ht / (float)wd; // use this to keep width/height ratio while changing size. - float wd1 = (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.PageWidth - (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.LeftMargin; - float ht1 = (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.PageLength - (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.TopMargin - 36; // 36 is to allow for end message - float wd2 = Math.Min(wd1, ht1 / _origFigureSizeRatio); // keep original ratio - - SetFigure(wd1, wd2); - } - else - groupPanelFigSize.Visible = false; - } - - // change bar setting depends on whether step has changed (dts) as compared to date/time off the - // procedure that it's in. - // 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 - // 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 - // bar & override sets it to On. - if (CurItemInfo.HasChanges) - { - rbChgBarOff.Text = "OFF (Override)"; - rbChgBarOn.Text = "ON"; - } - else - { - rbChgBarOn.Text = "ON (Override)"; - rbChgBarOff.Text = "OFF"; - } - - // if there is no override & a change occurred to the text, there is a - // change bar & override sets it to Off. - if (sc.Step_CBOverride == null) - { - rbChgBarOn.Checked = CurItemInfo.HasChanges; - rbChgBarOff.Checked = ! rbChgBarOn.Checked; - } - else - { - rbChgBarOff.Checked = (sc.Step_CBOverride == "Off") ? true : false; - rbChgBarOn.Checked = (sc.Step_CBOverride == "On") ? true : false; - // 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: - // 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 - // 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. - if (CurItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds) - { - StepConfig sc1 = CurItemInfo.MyConfig as StepConfig; - tbChgID.Text = sc1.Step_ChangeID; - tbChgID.Enabled = true; - lblChgId.Visible = tbChgID.Visible = true; - btnSaveChangeID.Enabled = btnSaveChangeID.Visible = true; - } - else - lblChgId.Visible = tbChgID.Visible = btnSaveChangeID.Enabled = btnSaveChangeID.Visible = false; - - // Walk up tree until this step type's parentType is "Base". Start adding menuitems from this step type. - StepData top = fmtdata.StepDataList[formatSteptype]; - //int tmpi = formatSteptype; - // RNO is a special case in that it has a parent type of high, for formatting, but does not walk - // up tree to define types that it can be changed into.... - if (!CurItemInfo.IsRNOPart) top = fmtdata.StepTopUnderBase(top, formatSteptype); - listBoxStepTypes.Items.Clear(); - listBoxStepTypes.SelectedIndex = DoListStepTypes(fmtdata, top, fmtdata.StepDataList[formatSteptype].Type); - lblNoTypeChgReason.Visible = !(listBoxStepTypes.Items.Count>0); - cbChgAll.Enabled = (listBoxStepTypes.Items.Count > 0); - listBoxStepTypes.Visible = (listBoxStepTypes.Items.Count>0); - cbPlaceKeeper.Enabled = MyEditItem.MyItemInfo.CanSetPlacekeeper; - - groupPanelWcnTrnResp.Visible = fmtdata.PrintData.WCNTraining && MyEditItem.MyItemInfo.IsHigh; - if (groupPanelWcnTrnResp.Visible) - { - StepConfig sc2 = CurItemInfo.MyConfig as StepConfig; - tbRespons.Text = sc2.Step_Responsibility; - } - // diable fields if user is only a reviewer - groupPanelCheckoff.Enabled = groupPanelChgBar.Enabled = groupPanelChgStepType.Enabled = groupPanelIncludeOn.Enabled = groupPanelPaginate.Enabled = groupPanelWcnTrnResp.Enabled = groupPanelcmbShwRplWds.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi); // Can Change Tag Info - - // C2021-015: Barakah - High Level Steps in Table of Contents. Make the check box visible if format has TofCAllowHLS and - // if format allow this and on a HLS, get the database from step's config to see if included and set checkbox accordingly. - // Note that the section that the HLS is on must also be included in the TofC - cbIncludeInTOC.Visible = fmtdata.SectData.AccSectionData.TableOfContentsData.TofCAllowHLS; - if (cbIncludeInTOC.Visible) - { - cbIncludeInTOC.Checked = false; - cbIncludeInTOC.Enabled = false; - cbIncludeInTOC.Checked = false; - if (CurItemInfo.IsHigh) - { - SectionConfig stc = CurItemInfo.MyConfig as SectionConfig; - if ((CurItemInfo.MyDocStyle != null && CurItemInfo.MyDocStyle.IncludeInTOC && (stc == null || stc.Section_TOC != "Y")) - || ((CurItemInfo.MyDocStyle == null || !CurItemInfo.MyDocStyle.IncludeInTOC) && (stc != null && stc.Section_TOC == "Y"))) - { - cbIncludeInTOC.Enabled = true; - cbIncludeInTOC.Checked = sc.Step_IncludeInTOC; - - } - } - } - - //CSM F2024 - 080: For South Texas (HLP formats), enable the initial line checkbox if it is in the formats - //Also, they want disable being selected to impact substeps - so do not show toggle if selected on a parent step - cbInitialLine.Visible = cbInitialLine.Enabled = false; - if (CurItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ShowInitialLineDisable && !string.IsNullOrEmpty(CurItemInfo.FormatStepData?.TabData?.MacroEditTag) && CurItemInfo.FormatStepData.TabData.MacroEditTag == "_" && CurItemInfo.FormatStepData.TabData.MacroList != null && CurItemInfo.FormatStepData.TabData.MacroList.Count > 0 && !(CurItemInfo.IsRNOPart && CurItemInfo.FormatStepData.TabData.MacroList[0].NotInRNO)) - { - cbInitialLine.Visible = cbInitialLine.Enabled = true; - cbInitialLine.Checked = sc.Step_DisableInitialLine; - } - - _Initalizing = false; - } - public void SetFigure(double wd, double wd2) - { - // Check MyEditItem type and cast if needed - ImageItem ii = MyEditItem as ImageItem; - if (ii == null) return; - - // Set the values as needed - trBarFS.Maximum = Math.Max((int)wd2, trBarFS.Maximum); - if (wd > trBarFS.Maximum) trBarFS.Maximum = (int)wd + 1; - trBarFS.Minimum = Math.Min((int)wd, 72); - trBarFS.Value = (int)wd; - _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) - { - int cursel=-1; - List sdl = null; - if (!CurItemInfo.IsSupInfoPart) sdl = fmtdata.StepGetLevelTypes(false, topType, ref cursel, curType, CurItemInfo); - if (sdl==null || sdl.Count==0) - { - if (listBoxStepTypes.Items.Count==0)lblNoTypeChgReason.Text = topType.StepEditData.TypeMenu.NoChgReason; - } - else - { - _MyStepTypeInd.Clear(); - foreach (StepDataRetval sdr in sdl) - { - // Figure menu titles have been changed from using the 'AER' in titles to 'Left' - string menutext = CurItemInfo.IsFigure && sdr.Name.Contains("AER")?sdr.Name.Replace("AER", "Left"):sdr.Name; - listBoxStepTypes.Items.Add(menutext); - _MyStepTypeInd.Add(sdr.Index); - } - } - 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 - #region Events - private void cbPageBreak_CheckedChanged(object sender, EventArgs e) - { - if (_Initalizing) return; - MyEditItem.SaveContents(); - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - if (sc == null) return; - MyEditItem.ChangeBarForConfigItemChange = false; - if (CurItemInfo.IsHigh) - sc.Step_NewManualPagebreak = cbPageBreak.Checked; - else // C2023-018: allow for sub-step page breaks - sc.Step_SubStepPagebreak = cbPageBreak.Checked; - MyEditItem.ChangeBarForConfigItemChange = true; - } - private void cbCAS_CheckedChanged(object sender, EventArgs e) - { - if (_Initalizing) return; - MyEditItem.SaveContents(); - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - if (sc == null) return; - MyEditItem.ChangeBarForConfigItemChange = false; - sc.Step_CAS = (cbCAS.Checked) ? "True" : "False"; - MyEditItem.ChangeBarForConfigItemChange = true; - // C2026-003 (put in for Vogtle 3&4) refresh the RNO step tab if including it on the Continuous Action Summary - if (MyEditItem.MyItemInfo.ActiveFormat.MyStepSectionLayoutData.AddContActTagToHighLevelRNOWhenIncludedOnCAS && - MyEditItem.MyItemInfo.IsInRNO && !MyEditItem.MyItemInfo.MyParent.IsInRNO) - MyEditItem.RefreshTab(); - } - private void cbTCAS_CheckedChanged(object sender, EventArgs e) - { - if (_Initalizing) return; - MyEditItem.SaveContents(); - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - if (sc == null) return; - MyEditItem.ChangeBarForConfigItemChange = false; - sc.Step_TCAS = (cbTCAS.Checked) ? "True" : "False"; - MyEditItem.ChangeBarForConfigItemChange = true; - } - private void cbPlacekeeper_CheckedChanged(object sender, EventArgs e) - { - if (_Initalizing) return; - MyEditItem.SaveContents(); - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - if (sc == null) return; - MyEditItem.ChangeBarForConfigItemChange = false; - sc.Step_Placekeeper = (cbPlaceKeeper.Checked) ? "Y" : "N"; - MyEditItem.ChangeBarForConfigItemChange = true; - if (cbPlaceKeeper.Checked) - { - _Initalizing = true; - cbPlaceKeeperCont.Checked = false; - _Initalizing = false; - } - } - private void cbPlaceKeeperCont_CheckedChanged(object sender, EventArgs e) - { - if (_Initalizing) return; - MyEditItem.SaveContents(); - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - if (sc == null) return; - MyEditItem.ChangeBarForConfigItemChange = false; - sc.Step_Placekeeper = (cbPlaceKeeperCont.Checked) ? "C" : "N"; - MyEditItem.ChangeBarForConfigItemChange = true; - if (cbPlaceKeeperCont.Checked) - { - _Initalizing = true; - cbPlaceKeeper.Checked = false; - } - } - // C2021-015: Barakah - High Level Steps in Table of Contents. Set step config when checked is changed. Save occurs on move off of step. - private void cbIncludeInTOC_CheckedChanged(object sender, EventArgs e) - { - if (_Initalizing) return; - MyEditItem.SaveContents(); - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - if (sc == null) return; - MyEditItem.ChangeBarForConfigItemChange = false; - sc.Step_IncludeInTOC = cbIncludeInTOC.Checked; - MyEditItem.ChangeBarForConfigItemChange = true; - } - private void listBoxStepTypes_SelectedIndexChanged(object sender, EventArgs e) - { - if (_Initalizing) return; - // B2017-166 Verify before making step type change - if (FlexibleMessageBox.Show("Change Step Type?", "Verify Step Type Change", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - TagsFillIn(); - return; - } - EditItem topEditItem = MyEditItem; - MyEditItem.SaveContents(); - FormatData fmtdata = CurItemInfo.ActiveFormat.PlantFormat.FormatData; - string msgBox = null; - if (cbChgAll.Checked) - { - ItemInfo startitm = CurItemInfo.FirstSibling; - topEditItem = MyEditItem.MyStepPanel._LookupEditItems[startitm.ItemID]; - bool chgEnh = false; - while (startitm != null) - { - using (Content cnt = Content.Get(startitm.MyContent.ContentID)) - { - cnt.Type = 20000 + fmtdata.StepDataList[_MyStepTypeInd[listBoxStepTypes.SelectedIndex]].Index; - cnt.DTS = DateTime.Now; - cnt.UserID = Volian.Base.Library.VlnSettings.UserID; - cnt.Save(); - } - // B2018-120: if caution/note steps have enhanced - change their type too - 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(); - } - msgBox = chgEnh ? string.Format("All Step Types at this level and associated enhanced steps were changed to {0}", listBoxStepTypes.Items[listBoxStepTypes.SelectedIndex]) : - string.Format("All Step Types at this level were changed to {0}", listBoxStepTypes.Items[listBoxStepTypes.SelectedIndex]); - - } - else - { - using (Content cnt1 = Content.Get(CurItemInfo.MyContent.ContentID)) - { - cnt1.Type = 20000 + fmtdata.StepDataList[_MyStepTypeInd[listBoxStepTypes.SelectedIndex]].Index; - cnt1.DTS = DateTime.Now; - cnt1.UserID = Volian.Base.Library.VlnSettings.UserID; - cnt1.Save(); - } - bool chgEnh = false; - // B2018-120: if caution/note steps have enhanced - change their type too - 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]): - 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(); - FlexibleMessageBox.Show(msgBox); - - } - - private bool ChangeTypesEnhanced(ItemInfo startitm) - { - bool retval = false; - EnhancedDocuments eds = startitm.GetMyEnhancedDocuments(); - if (eds != null && eds.Count > 0) - { - foreach (EnhancedDocument ed in eds) - { - ItemInfo eii = ItemInfo.Get(ed.ItemID); - if (eii != null) - { - retval = true; - using (Content cnt = Content.Get(eii.MyContent.ContentID)) - { - cnt.Type = startitm.IsCaution ? 20006 : 20007; // use base types in the enhanced. - cnt.DTS = DateTime.Now; - cnt.UserID = Volian.Base.Library.VlnSettings.UserID; - cnt.Save(); - } - } - } - } - return retval; - } - private void groupPanelCheckoff_VisibleChanged(object sender, EventArgs e) - { - // If it becomes visible, update the panel - if (Visible == true && NotVisibleEditItem != null) - MyEditItem = NotVisibleEditItem; - } - private void groupPanelcmbShwRplWds_VisibleChanged(object sender, EventArgs e) - { - // If it becomes visible, update the panel - if (Visible == true && NotVisibleEditItem != null) - MyEditItem = NotVisibleEditItem; - } - private void rbChgBarOvrRideOn_CheckedChanged(object sender, EventArgs e) - { - if (_Initalizing) return; - MyEditItem.SaveContents(); - - // if checked, set the config data to 'On'. Otherwise, the 'check' event - // handler for the other control sets the data appropriately. - if (rbChgBarOn.Checked) - { - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - 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) - { - if (_Initalizing) return; - MyEditItem.SaveContents(); - - // if checked, set the config data to 'Off'. Otherwise, the 'check' event - // handler for the other control sets the data appropriately. - if (rbChgBarOff.Checked) - { - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - 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) - { - if (_Initalizing) return; - MyEditItem.SaveContents(); - // set selected index in the step's config. - int indx = _CheckOffIndex[cmbCheckoff.SelectedIndex]; // C2020-003 get the non-sorted index from the sorted index - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - 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. - private void cmbShwRplWds_SelectedIndexChanged(object sender, EventArgs e) // new show replace words - { - - // -------- - - if (_Initalizing) return; - MyEditItem.SaveContents(); - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - if (sc == null) return; - MyEditItem.ChangeBarForConfigItemChange = false; - //sc.Step_DisableInitialLine = cbInitialLine.Checked; - sc.Step_ShwRplWdsIndex = cmbShwRplWds.SelectedIndex; - MyEditItem.ChangeBarForConfigItemChange = true; - - - //needed to refresh display changing - MyEditItem.RefreshContent(); - MyEditItem.SetAllTabs(); - } - #endregion - - #region WCNTRN format - // The following supports the Wolf Creek Training format/Responsibility data - // off of the High Level Step - private void tbRespons_Leave(object sender, EventArgs e) - { - // User left responsibilty 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_Responsibility == null || sc.Step_Responsibility == "") && (tbRespons.Text == null || tbRespons.Text == ""); - if (!bothEmpty && sc.Step_Responsibility != tbRespons.Text) - { - if (FlexibleMessageBox.Show(this, "Do you want to save the Responsibility Text?", "Confirm Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) - { - MyEditItem.SaveContents(); - sc.Step_Responsibility = tbRespons.Text; // this actually saves the config - } - else - tbRespons.Text = sc.Step_Responsibility; - } - } - #endregion - - // The following supports the portion of displaytags that handles sizing of figures. there are 2 text - // boxes with width & height that are tied to the slider value: - - // save data back to the ImageItem. If user enters data in text boxes, this is used. Slider automatically - // saves data to ImageItem. - private void btnFsSav_Click(object sender, EventArgs e) - { - if (MyEditItem is ImageItem) - { - int wd = 0; - int ht = 0; - try - { - wd = int.Parse(tbFSWd.Text); - ht = int.Parse(tbFSHt.Text); - } - catch (Exception ex) - { - wd = 0; - ht = 0; - } - if (wd != 0 && ht != 0) (MyEditItem as ImageItem).SizeImage(wd, ht); - } - } - private float _origFigureSizeRatio = 0; // keep original ratio & width in case of 'restore' - public int _origFigureSizeWidth = 0; - // support user changing size using slider. This saves change back to ImageItem and sets - // width/height text boxes to slider values. - private void trBarFS_Scroll(object sender, EventArgs e) - { - int wd = trBarFS.Value; - int ht = (int)(_origFigureSizeRatio * wd); - (MyEditItem as ImageItem).SizeImage(wd, ht); - tbFSWd.Text = wd.ToString(); - tbFSHt.Text = ht.ToString(); - } - // restore the orignal image size - private void btnFSrestore_Click(object sender, EventArgs e) - { - if (_origFigureSizeWidth != 0) - { - tbFSWd.Text = _origFigureSizeWidth.ToString(); - int ht = (int)(_origFigureSizeRatio * _origFigureSizeWidth); - tbFSHt.Text = ht.ToString(); - (MyEditItem as ImageItem).SizeImage(_origFigureSizeWidth, ht); - trBarFS.Value = _origFigureSizeWidth; - } - } - // user entered width in text box, this event gets called on leave of text box. - private void tbFSWd_Leave(object sender, EventArgs e) - { - // check that value input is between the slider values: - bool invaliddata = false; - int newHt = 0; - try - { - newHt = int.Parse(tbFSWd.Text); - } - catch (Exception ex) - { - invaliddata = true; - } - if (invaliddata || newHt < trBarFS.Minimum || newHt > trBarFS.Maximum) - { - string errormsg = string.Format("Invalid width, must be integer and greater than 72 (inch) and less than {0}", trBarFS.Maximum); - FlexibleMessageBox.Show(errormsg, "Invalid Width data"); - return; - } - tbFSHt.Text = ((int)(int.Parse(tbFSWd.Text) * _origFigureSizeRatio)).ToString(); - trBarFS.Value = int.Parse(tbFSWd.Text); - } - - private void cbPrefPageBreak_CheckedChanged(object sender, EventArgs e) - { - if (_Initalizing) return; - MyEditItem.SaveContents(); - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - if (sc == null) return; - MyEditItem.ChangeBarForConfigItemChange = false; - sc.Step_PreferredPagebreak = cbPrefPageBreak.Checked; - MyEditItem.ChangeBarForConfigItemChange = true; - } - - private void cbInitialLine_CheckedChanged(object sender, EventArgs e) - { - if (_Initalizing) return; - MyEditItem.SaveContents(); - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - if (sc == null) return; - MyEditItem.ChangeBarForConfigItemChange = false; - sc.Step_DisableInitialLine = cbInitialLine.Checked; - MyEditItem.ChangeBarForConfigItemChange = true; - - //needed to refresh display changing - MyEditItem.RefreshContent(); - MyEditItem.SetAllTabs(); - - } - - //B2025-010 PROMS -Fixed issues updating Changeid - // Changed to a Save button instead of onTextChanged - // Also was issue where sometimes would lave last character / digit (not allowing the change id to be completely removed) - private void btnSaveChangeID_Click(object sender, EventArgs e) - { - MyEditItem.SaveContents(); - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - // if the changeID changed, then reset the change bar override - // B2021-029: don't change changeid if the config & text box are both empty - if (sc.Step_ChangeID != tbChgID.Text && (!string.IsNullOrEmpty(sc.Step_ChangeID) || !string.IsNullOrEmpty(tbChgID.Text))) - { - sc.Step_ChangeID = tbChgID.Text; - sc.Step_CBOverride = null; - } - } - - //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; - // } - - //} - - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayTags.resx b/PROMS/Volian.Controls.Library/DisplayTags.resx deleted file mode 100644 index 380727b0..00000000 --- a/PROMS/Volian.Controls.Library/DisplayTags.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 132 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.Designer.cs b/PROMS/Volian.Controls.Library/DisplayTransition.Designer.cs deleted file mode 100644 index b1f9d4b7..00000000 --- a/PROMS/Volian.Controls.Library/DisplayTransition.Designer.cs +++ /dev/null @@ -1,559 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class DisplayTransition - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DisplayTransition)); - this.groupPanelBtns = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.cbHoldProcSet = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbPageNum = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.btnTranCancel = new DevComponents.DotNetBar.ButtonX(); - this.btnTranSave = new DevComponents.DotNetBar.ButtonX(); - this.groupPanelTranFmt = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.listBoxTranFmt = new System.Windows.Forms.ListBox(); - this.groupPanelTransitionSets = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.vlnTreeComboSets = new Volian.Controls.Library.vlnTreeCombo(); - this.groupPanelTransitionProcs = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.cbTranProcs = new System.Windows.Forms.ComboBox(); - this.groupPanelTransitionSect = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.cbTranSects = new System.Windows.Forms.ComboBox(); - this.groupPanelTranstionSteps = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.tvTran = new Volian.Controls.Library.vlnTreeView3(); - this.pnlTranStepBtns = new System.Windows.Forms.Panel(); - this.cbIncStepNum = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.lblxTranRangeTip = new DevComponents.DotNetBar.LabelX(); - this.btnTranRangeClear = new DevComponents.DotNetBar.ButtonX(); - this.btnUp1 = new DevComponents.DotNetBar.ButtonX(); - this.superToolTipDispTran = new DevComponents.DotNetBar.SuperTooltip(); - this.groupPanelBtns.SuspendLayout(); - this.groupPanelTranFmt.SuspendLayout(); - this.groupPanelTransitionSets.SuspendLayout(); - this.groupPanelTransitionProcs.SuspendLayout(); - this.groupPanelTransitionSect.SuspendLayout(); - this.groupPanelTranstionSteps.SuspendLayout(); - this.pnlTranStepBtns.SuspendLayout(); - this.SuspendLayout(); - // - // groupPanelBtns - // - this.groupPanelBtns.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelBtns.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelBtns.Controls.Add(this.cbHoldProcSet); - this.groupPanelBtns.Controls.Add(this.cbPageNum); - this.groupPanelBtns.Controls.Add(this.btnTranCancel); - this.groupPanelBtns.Controls.Add(this.btnTranSave); - this.groupPanelBtns.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelBtns.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelBtns.Location = new System.Drawing.Point(0, 0); - this.groupPanelBtns.Name = "groupPanelBtns"; - this.groupPanelBtns.Size = new System.Drawing.Size(376, 82); - // - // - // - this.groupPanelBtns.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelBtns.Style.BackColorGradientAngle = 90; - this.groupPanelBtns.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelBtns.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelBtns.Style.BorderBottomWidth = 1; - this.groupPanelBtns.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelBtns.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelBtns.Style.BorderLeftWidth = 1; - this.groupPanelBtns.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelBtns.Style.BorderRightWidth = 1; - this.groupPanelBtns.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelBtns.Style.BorderTopWidth = 1; - this.groupPanelBtns.Style.CornerDiameter = 4; - this.groupPanelBtns.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelBtns.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelBtns.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelBtns.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelBtns.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelBtns.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelBtns.TabIndex = 25; - // - // cbHoldProcSet - // - this.cbHoldProcSet.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbHoldProcSet.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbHoldProcSet.Location = new System.Drawing.Point(0, 54); - this.cbHoldProcSet.Margin = new System.Windows.Forms.Padding(2); - this.cbHoldProcSet.Name = "cbHoldProcSet"; - this.cbHoldProcSet.Size = new System.Drawing.Size(214, 15); - this.cbHoldProcSet.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.superToolTipDispTran.SetSuperTooltip(this.cbHoldProcSet, new DevComponents.DotNetBar.SuperTooltipInfo("", "", resources.GetString("cbHoldProcSet.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbHoldProcSet.TabIndex = 27; - this.cbHoldProcSet.Text = "Hold Procedure Set / Procedure"; - this.cbHoldProcSet.CheckedChanged += new System.EventHandler(this.cbHoldProcSet_CheckedChanged); - // - // cbPageNum - // - this.cbPageNum.BackColor = System.Drawing.Color.Transparent; - // - // - // - this.cbPageNum.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbPageNum.Location = new System.Drawing.Point(0, 35); - this.cbPageNum.Margin = new System.Windows.Forms.Padding(2); - this.cbPageNum.Name = "cbPageNum"; - this.cbPageNum.Size = new System.Drawing.Size(126, 15); - this.cbPageNum.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.cbPageNum.TabIndex = 26; - this.cbPageNum.Text = "Include Page Number"; - this.cbPageNum.CheckedChanged += new System.EventHandler(this.cbPageNum_CheckedChanged); - // - // btnTranCancel - // - this.btnTranCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnTranCancel.AutoSize = true; - this.btnTranCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnTranCancel.Dock = System.Windows.Forms.DockStyle.Right; - this.btnTranCancel.Location = new System.Drawing.Point(282, 0); - this.btnTranCancel.Margin = new System.Windows.Forms.Padding(2); - this.btnTranCancel.Name = "btnTranCancel"; - this.btnTranCancel.Size = new System.Drawing.Size(88, 36); - this.superToolTipDispTran.SetSuperTooltip(this.btnTranCancel, new DevComponents.DotNetBar.SuperTooltipInfo("", "", "This restores transition selections to the default if a transition would be inser" + - "ted, or the original transition if one had been selected.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnTranCancel.TabIndex = 25; - this.btnTranCancel.Text = "Cancel"; - this.btnTranCancel.Click += new System.EventHandler(this.btnTranCancel_Click); - // - // btnTranSave - // - this.btnTranSave.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnTranSave.AutoSize = true; - this.btnTranSave.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnTranSave.Dock = System.Windows.Forms.DockStyle.Left; - this.btnTranSave.Location = new System.Drawing.Point(0, 0); - this.btnTranSave.Name = "btnTranSave"; - this.btnTranSave.Size = new System.Drawing.Size(103, 36); - this.superToolTipDispTran.SetSuperTooltip(this.btnTranSave, new DevComponents.DotNetBar.SuperTooltipInfo("Save Transition", "", "- This will place the selected Transition at the cursor position.\r\n- This will re" + - "place a Transition with the selected Transition.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnTranSave.TabIndex = 24; - this.btnTranSave.Text = "Save Transition"; - this.btnTranSave.Click += new System.EventHandler(this.btnTranSave_Click); - // - // groupPanelTranFmt - // - this.groupPanelTranFmt.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelTranFmt.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelTranFmt.Controls.Add(this.listBoxTranFmt); - this.groupPanelTranFmt.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelTranFmt.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelTranFmt.Location = new System.Drawing.Point(0, 82); - this.groupPanelTranFmt.Name = "groupPanelTranFmt"; - this.groupPanelTranFmt.Size = new System.Drawing.Size(376, 141); - // - // - // - this.groupPanelTranFmt.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelTranFmt.Style.BackColorGradientAngle = 90; - this.groupPanelTranFmt.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelTranFmt.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTranFmt.Style.BorderBottomWidth = 1; - this.groupPanelTranFmt.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelTranFmt.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTranFmt.Style.BorderLeftWidth = 1; - this.groupPanelTranFmt.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTranFmt.Style.BorderRightWidth = 1; - this.groupPanelTranFmt.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTranFmt.Style.BorderTopWidth = 1; - this.groupPanelTranFmt.Style.CornerDiameter = 4; - this.groupPanelTranFmt.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelTranFmt.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelTranFmt.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelTranFmt.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelTranFmt.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelTranFmt.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelTranFmt.TabIndex = 27; - this.groupPanelTranFmt.Text = "Select Format"; - // - // listBoxTranFmt - // - this.listBoxTranFmt.Dock = System.Windows.Forms.DockStyle.Fill; - this.listBoxTranFmt.FormattingEnabled = true; - this.listBoxTranFmt.HorizontalScrollbar = true; - this.listBoxTranFmt.Location = new System.Drawing.Point(0, 0); - this.listBoxTranFmt.Name = "listBoxTranFmt"; - this.listBoxTranFmt.Size = new System.Drawing.Size(370, 120); - this.superToolTipDispTran.SetSuperTooltip(this.listBoxTranFmt, new DevComponents.DotNetBar.SuperTooltipInfo("", "", "This is where transition types are selected. This also defines how the transitio" + - "n will look in the text.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.listBoxTranFmt.TabIndex = 13; - this.listBoxTranFmt.SelectedIndexChanged += new System.EventHandler(this.listBoxTranFmt_Click); - // - // groupPanelTransitionSets - // - this.groupPanelTransitionSets.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelTransitionSets.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelTransitionSets.Controls.Add(this.vlnTreeComboSets); - this.groupPanelTransitionSets.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelTransitionSets.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelTransitionSets.Location = new System.Drawing.Point(0, 223); - this.groupPanelTransitionSets.Name = "groupPanelTransitionSets"; - this.groupPanelTransitionSets.Size = new System.Drawing.Size(376, 48); - // - // - // - this.groupPanelTransitionSets.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelTransitionSets.Style.BackColorGradientAngle = 90; - this.groupPanelTransitionSets.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelTransitionSets.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTransitionSets.Style.BorderBottomWidth = 1; - this.groupPanelTransitionSets.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelTransitionSets.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTransitionSets.Style.BorderLeftWidth = 1; - this.groupPanelTransitionSets.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTransitionSets.Style.BorderRightWidth = 1; - this.groupPanelTransitionSets.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTransitionSets.Style.BorderTopWidth = 1; - this.groupPanelTransitionSets.Style.CornerDiameter = 4; - this.groupPanelTransitionSets.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelTransitionSets.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelTransitionSets.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelTransitionSets.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelTransitionSets.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelTransitionSets.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelTransitionSets.TabIndex = 31; - this.groupPanelTransitionSets.Text = "Select Procedure Set"; - // - // vlnTreeComboSets - // - this.vlnTreeComboSets.Dock = System.Windows.Forms.DockStyle.Fill; - this.vlnTreeComboSets.Location = new System.Drawing.Point(0, 0); - this.vlnTreeComboSets.Margin = new System.Windows.Forms.Padding(4); - this.vlnTreeComboSets.Name = "vlnTreeComboSets"; - this.vlnTreeComboSets.Size = new System.Drawing.Size(370, 21); - this.superToolTipDispTran.SetSuperTooltip(this.vlnTreeComboSets, new DevComponents.DotNetBar.SuperTooltipInfo("", "", resources.GetString("vlnTreeComboSets.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.vlnTreeComboSets.TabIndex = 33; - this.vlnTreeComboSets.Value = null; - this.vlnTreeComboSets.FinishEditing += new AT.STO.UI.Win.DropDownValueChangedEventHandler(this.DropDown_FinishEditing); - // - // groupPanelTransitionProcs - // - this.groupPanelTransitionProcs.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelTransitionProcs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelTransitionProcs.Controls.Add(this.cbTranProcs); - this.groupPanelTransitionProcs.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelTransitionProcs.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelTransitionProcs.Location = new System.Drawing.Point(0, 271); - this.groupPanelTransitionProcs.Name = "groupPanelTransitionProcs"; - this.groupPanelTransitionProcs.Size = new System.Drawing.Size(376, 46); - // - // - // - this.groupPanelTransitionProcs.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelTransitionProcs.Style.BackColorGradientAngle = 90; - this.groupPanelTransitionProcs.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelTransitionProcs.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTransitionProcs.Style.BorderBottomWidth = 1; - this.groupPanelTransitionProcs.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelTransitionProcs.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTransitionProcs.Style.BorderLeftWidth = 1; - this.groupPanelTransitionProcs.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTransitionProcs.Style.BorderRightWidth = 1; - this.groupPanelTransitionProcs.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTransitionProcs.Style.BorderTopWidth = 1; - this.groupPanelTransitionProcs.Style.CornerDiameter = 4; - this.groupPanelTransitionProcs.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelTransitionProcs.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelTransitionProcs.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelTransitionProcs.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelTransitionProcs.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelTransitionProcs.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelTransitionProcs.TabIndex = 32; - this.groupPanelTransitionProcs.Text = "Select Procedure"; - // - // cbTranProcs - // - this.cbTranProcs.Dock = System.Windows.Forms.DockStyle.Fill; - this.cbTranProcs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbTranProcs.FormattingEnabled = true; - this.cbTranProcs.Location = new System.Drawing.Point(0, 0); - this.cbTranProcs.Name = "cbTranProcs"; - this.cbTranProcs.Size = new System.Drawing.Size(370, 21); - this.superToolTipDispTran.SetSuperTooltip(this.cbTranProcs, new DevComponents.DotNetBar.SuperTooltipInfo("", "", resources.GetString("cbTranProcs.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbTranProcs.TabIndex = 14; - this.cbTranProcs.SelectedIndexChanged += new System.EventHandler(this.cbTranProcs_SelectedIndexChanged); - // - // groupPanelTransitionSect - // - this.groupPanelTransitionSect.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelTransitionSect.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelTransitionSect.Controls.Add(this.cbTranSects); - this.groupPanelTransitionSect.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelTransitionSect.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelTransitionSect.Location = new System.Drawing.Point(0, 317); - this.groupPanelTransitionSect.Name = "groupPanelTransitionSect"; - this.groupPanelTransitionSect.Size = new System.Drawing.Size(376, 49); - // - // - // - this.groupPanelTransitionSect.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelTransitionSect.Style.BackColorGradientAngle = 90; - this.groupPanelTransitionSect.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelTransitionSect.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTransitionSect.Style.BorderBottomWidth = 1; - this.groupPanelTransitionSect.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelTransitionSect.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTransitionSect.Style.BorderLeftWidth = 1; - this.groupPanelTransitionSect.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTransitionSect.Style.BorderRightWidth = 1; - this.groupPanelTransitionSect.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTransitionSect.Style.BorderTopWidth = 1; - this.groupPanelTransitionSect.Style.CornerDiameter = 4; - this.groupPanelTransitionSect.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelTransitionSect.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelTransitionSect.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelTransitionSect.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelTransitionSect.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelTransitionSect.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelTransitionSect.TabIndex = 33; - this.groupPanelTransitionSect.Text = "Select Section"; - // - // cbTranSects - // - this.cbTranSects.Dock = System.Windows.Forms.DockStyle.Fill; - this.cbTranSects.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbTranSects.FormattingEnabled = true; - this.cbTranSects.Location = new System.Drawing.Point(0, 0); - this.cbTranSects.Name = "cbTranSects"; - this.cbTranSects.Size = new System.Drawing.Size(370, 21); - this.superToolTipDispTran.SetSuperTooltip(this.cbTranSects, new DevComponents.DotNetBar.SuperTooltipInfo("", "", resources.GetString("cbTranSects.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbTranSects.TabIndex = 20; - this.cbTranSects.SelectedIndexChanged += new System.EventHandler(this.cbTranSects_SelectedIndexChanged); - this.cbTranSects.Click += new System.EventHandler(this.cbTranSects_SelectedIndexChanged); - // - // groupPanelTranstionSteps - // - this.groupPanelTranstionSteps.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelTranstionSteps.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelTranstionSteps.Controls.Add(this.tvTran); - this.groupPanelTranstionSteps.Controls.Add(this.pnlTranStepBtns); - this.groupPanelTranstionSteps.DisabledBackColor = System.Drawing.Color.Empty; - this.groupPanelTranstionSteps.Dock = System.Windows.Forms.DockStyle.Fill; - this.groupPanelTranstionSteps.Location = new System.Drawing.Point(0, 366); - this.groupPanelTranstionSteps.Name = "groupPanelTranstionSteps"; - this.groupPanelTranstionSteps.Size = new System.Drawing.Size(376, 310); - // - // - // - this.groupPanelTranstionSteps.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelTranstionSteps.Style.BackColorGradientAngle = 90; - this.groupPanelTranstionSteps.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelTranstionSteps.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTranstionSteps.Style.BorderBottomWidth = 1; - this.groupPanelTranstionSteps.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelTranstionSteps.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTranstionSteps.Style.BorderLeftWidth = 1; - this.groupPanelTranstionSteps.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTranstionSteps.Style.BorderRightWidth = 1; - this.groupPanelTranstionSteps.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTranstionSteps.Style.BorderTopWidth = 1; - this.groupPanelTranstionSteps.Style.CornerDiameter = 4; - this.groupPanelTranstionSteps.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelTranstionSteps.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelTranstionSteps.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelTranstionSteps.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.groupPanelTranstionSteps.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.groupPanelTranstionSteps.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.groupPanelTranstionSteps.TabIndex = 34; - this.groupPanelTranstionSteps.Text = "Select Step"; - // - // tvTran - // - this.tvTran.Dock = System.Windows.Forms.DockStyle.Fill; - this.tvTran.HideSelection = false; - this.tvTran.Location = new System.Drawing.Point(0, 46); - this.tvTran.Name = "tvTran"; - this.tvTran.Size = new System.Drawing.Size(370, 243); - this.superToolTipDispTran.SetSuperTooltip(this.tvTran, new DevComponents.DotNetBar.SuperTooltipInfo("", "", resources.GetString("tvTran.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.tvTran.TabIndex = 31; - this.tvTran.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvTran_AfterSelect); - // - // pnlTranStepBtns - // - this.pnlTranStepBtns.Controls.Add(this.cbIncStepNum); - this.pnlTranStepBtns.Controls.Add(this.lblxTranRangeTip); - this.pnlTranStepBtns.Controls.Add(this.btnTranRangeClear); - this.pnlTranStepBtns.Controls.Add(this.btnUp1); - this.pnlTranStepBtns.Dock = System.Windows.Forms.DockStyle.Top; - this.pnlTranStepBtns.Location = new System.Drawing.Point(0, 0); - this.pnlTranStepBtns.Name = "pnlTranStepBtns"; - this.pnlTranStepBtns.Size = new System.Drawing.Size(370, 46); - this.pnlTranStepBtns.TabIndex = 30; - // - // cbIncStepNum - // - // - // - // - this.cbIncStepNum.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbIncStepNum.Location = new System.Drawing.Point(8, 12); - this.cbIncStepNum.Margin = new System.Windows.Forms.Padding(2); - this.cbIncStepNum.Name = "cbIncStepNum"; - this.cbIncStepNum.Size = new System.Drawing.Size(126, 19); - this.cbIncStepNum.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.cbIncStepNum.TabIndex = 0; - this.cbIncStepNum.Text = "Include Step Number"; - this.cbIncStepNum.CheckedChanged += new System.EventHandler(this.cbIncStepNum_CheckedChanged); - // - // lblxTranRangeTip - // - // - // - // - this.lblxTranRangeTip.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.lblxTranRangeTip.Dock = System.Windows.Forms.DockStyle.Right; - this.lblxTranRangeTip.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblxTranRangeTip.Location = new System.Drawing.Point(265, 0); - this.lblxTranRangeTip.Name = "lblxTranRangeTip"; - this.lblxTranRangeTip.Size = new System.Drawing.Size(105, 46); - this.superToolTipDispTran.SetSuperTooltip(this.lblxTranRangeTip, new DevComponents.DotNetBar.SuperTooltipInfo("", "", "For range transitions, shows which selection, first or second, that the next sele" + - "ction will be.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.lblxTranRangeTip.TabIndex = 33; - this.lblxTranRangeTip.Text = "Select First \r\nTransition\r\nfor Range"; - // - // btnTranRangeClear - // - this.btnTranRangeClear.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnTranRangeClear.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnTranRangeClear.Dock = System.Windows.Forms.DockStyle.Left; - this.btnTranRangeClear.Location = new System.Drawing.Point(0, 0); - this.btnTranRangeClear.Name = "btnTranRangeClear"; - this.btnTranRangeClear.Size = new System.Drawing.Size(58, 46); - this.superToolTipDispTran.SetSuperTooltip(this.btnTranRangeClear, new DevComponents.DotNetBar.SuperTooltipInfo("", "", "This clears the Range selection in the tree view", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnTranRangeClear.TabIndex = 31; - this.btnTranRangeClear.Text = "Clear Range Selection"; - this.btnTranRangeClear.Click += new System.EventHandler(this.btnTranRangeClear_Click); - // - // btnUp1 - // - this.btnUp1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnUp1.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnUp1.Image = global::Volian.Controls.Library.Properties.Resources.GoToParentFolderHS; - this.btnUp1.Location = new System.Drawing.Point(210, 0); - this.btnUp1.Name = "btnUp1"; - this.btnUp1.Size = new System.Drawing.Size(43, 46); - this.superToolTipDispTran.SetSuperTooltip(this.btnUp1, new DevComponents.DotNetBar.SuperTooltipInfo("", "", "This will display the tree for selecting the transition one level higher than cur" + - "rently shown. If already showing High Level Steps, this button has no effect.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.btnUp1.TabIndex = 30; - this.btnUp1.Visible = false; - // - // superToolTipDispTran - // - this.superToolTipDispTran.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray); - this.superToolTipDispTran.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - // - // DisplayTransition - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.groupPanelTranstionSteps); - this.Controls.Add(this.groupPanelTransitionSect); - this.Controls.Add(this.groupPanelTransitionProcs); - this.Controls.Add(this.groupPanelTransitionSets); - this.Controls.Add(this.groupPanelTranFmt); - this.Controls.Add(this.groupPanelBtns); - this.Margin = new System.Windows.Forms.Padding(2); - this.Name = "DisplayTransition"; - this.Size = new System.Drawing.Size(376, 676); - this.groupPanelBtns.ResumeLayout(false); - this.groupPanelBtns.PerformLayout(); - this.groupPanelTranFmt.ResumeLayout(false); - this.groupPanelTransitionSets.ResumeLayout(false); - this.groupPanelTransitionProcs.ResumeLayout(false); - this.groupPanelTransitionSect.ResumeLayout(false); - this.groupPanelTranstionSteps.ResumeLayout(false); - this.pnlTranStepBtns.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelBtns; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelTranFmt; - private System.Windows.Forms.ListBox listBoxTranFmt; - private DevComponents.DotNetBar.ButtonX btnTranCancel; - private DevComponents.DotNetBar.ButtonX btnTranSave; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelTransitionSets; - private vlnTreeCombo vlnTreeComboSets; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelTransitionProcs; - private System.Windows.Forms.ComboBox cbTranProcs; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelTransitionSect; - private System.Windows.Forms.ComboBox cbTranSects; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelTranstionSteps; - private System.Windows.Forms.Panel pnlTranStepBtns; - private DevComponents.DotNetBar.ButtonX btnTranRangeClear; - private DevComponents.DotNetBar.ButtonX btnUp1; - private DevComponents.DotNetBar.LabelX lblxTranRangeTip; - private vlnTreeView3 tvTran; - private DevComponents.DotNetBar.SuperTooltip superToolTipDispTran; - private DevComponents.DotNetBar.Controls.CheckBoxX cbIncStepNum; - private DevComponents.DotNetBar.Controls.CheckBoxX cbPageNum; - private DevComponents.DotNetBar.Controls.CheckBoxX cbHoldProcSet; - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.cs b/PROMS/Volian.Controls.Library/DisplayTransition.cs deleted file mode 100644 index 5134ecbb..00000000 --- a/PROMS/Volian.Controls.Library/DisplayTransition.cs +++ /dev/null @@ -1,1656 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using System.Text.RegularExpressions; -using AT.STO.UI.Win; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; -using JR.Utils.GUI.Forms; - -namespace Volian.Controls.Library -{ - public partial class DisplayTransition : UserControl - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #region Properties - private int _TranFmtIndx = -1; // stores selected transition format - private ItemInfo _CurItemFrom; // stores what item transition is 'from' - private TransitionInfo _CurTrans; // if modify, this is transition to modify - public TransitionInfo CurTrans - { - get { return _CurTrans; } - set - { - if (DesignMode || !Visible) return; // B2019-043 need to check if we are just saving changes to the user interface - //CSM-C2024-026 Evaluate the transitions panel - //Create a way to keep it from reverting the transition display panel to the currently selected item/transition. - //HeldLinkText will store if a transition was manually selected - //to override defaulting the listboxes to the current step / selected transition - if (HeldLinkText != "" && value != null) - { - //handle case where is held text and click on an already existing transition so cannot save one on top of the other. - _CurTrans = value; - btnTranSave.Enabled = false; - btnTranCancel.Enabled = true; - return; - } - else if (HeldLinkText != "" && MyRTB.MyItemInfo.ActiveFormat.Name == HeldLink_CurItemFrom.ActiveFormat.Name) - { - //this else if will handle case of defaulting to held transition instead of what has been clicked on - //Note that if format is not the same, it will ignore the held item - //This is because if different format, then options / selections may be different so will need to refresh the lists - if (_CurTrans == value && _CurItemFrom == HeldLink_CurItemFrom) return; - _CurItemFrom = HeldLink_CurItemFrom; - _TranFmtIndx = HeldLink_TranFmtIndx; - bool isenh = MyRTB != null && HeldLink_CurItemFrom != null && HeldLink_CurItemFrom.IsEnhancedStep; - btnTranSave.Enabled = !isenh && UserInfo.CanEdit(MyUserInfo, Mydvi) && (value == null); //Can Insert Transitions - btnTranCancel.Enabled = true; - } - else if (value == null) // Insert a transition - { - if (MyRTB == null) return; - if (_CurTrans == value && _CurItemFrom == MyRTB.MyItemInfo) return; - _CurItemFrom = MyRTB.MyItemInfo; - _TranFmtIndx = 0; - bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep; - btnTranSave.Enabled = !isenh && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons - btnTranCancel.Enabled = true; - } - else // Modify a transition - { - if (_CurTrans == value) return; - _TranFmtIndx = value.TranType; - _CurItemFrom = MyRTB.MyItemInfo; - btnTranSave.Enabled = btnTranCancel.Enabled = false; - } - _CurTrans = value; - _SavCurItemFrom = _CurItemFrom; - _SavTranFmtIndx = _TranFmtIndx; - TransitionFillIn(); - SaveSettings(); - } - } - private int _II_Format; - private bool _II_PageNumber; - private bool _II_IncStepNumber; - private int _II_Procedure; - private int _II_Section; - private int _II_ItemID; - private void SaveSettings() - { - _II_Format=listBoxTranFmt.SelectedIndex; - _II_PageNumber=cbPageNum.Checked; - _II_IncStepNumber=cbIncStepNum.Checked; - _II_Procedure=cbTranProcs.SelectedIndex; - _II_Section=cbTranSects.SelectedIndex; - // Use VEObject - if (tvTran.SelectedNode != null && (tvTran.SelectedNode as VETreeNode).VEObject != null) - _II_ItemID = ((tvTran.SelectedNode as VETreeNode).VEObject as ItemInfo).ItemID; - } - private bool SettingsChanged - { - get - { - if (_CurTrans == null) return true; - if (_II_Format != listBoxTranFmt.SelectedIndex) return true; - if (_II_PageNumber != cbPageNum.Checked) return true; - if (_II_IncStepNumber != cbIncStepNum.Checked) return true; - if (_II_Procedure != cbTranProcs.SelectedIndex) return true; - if (_II_Section != cbTranSects.SelectedIndex) return true; - // Use VEObject - if(tvTran.Nodes.Count == 0) return true;//B2016-173 If no nodes then the transtion is to a MS Word Section - if (tvTran.SelectedNode != null) // B2016-253 - if(_II_ItemID != ((tvTran.SelectedNode as VETreeNode).VEObject as ItemInfo).ItemID) return true; - return false; - } - } - // use the following if user selects 'cancel' button - private ItemInfo _SavCurItemFrom; - private int _SavTranFmtIndx; - private bool _ModExistingPageNum = false; - private bool _DoingRange = false; // flags if in 'range' transition mode - private VETreeNode _RangeNode1; - 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. - 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. - public StepRTB MyRTB - { - get { return _MyRTB; } - set - { - if (DesignMode || !Visible) return; // B2019-043 need to check if we are just saving changes to the user interface - // add or remove events for - if (_MyRTB != null) - _MyRTB.LinkChanged -= new StepRTBLinkEvent(_MyRTB_LinkChanged); - if (value == null) return; - _MyRTB = value; - _MyRTB.LinkChanged += new StepRTBLinkEvent(_MyRTB_LinkChanged); - if (_MyRTB.MyLinkText == null) - { - CurTrans = null; - } - } - } - void _MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args) - { - CurTrans = args.MyLinkText.MyTransitionInfo; - } - 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 int _CurrentProcIndex; - private bool _AlwaysDisableSets; // true if there is only 1 item in tree/combo for sets - private Color _OrigGroupPanelSets; - private Color _OrigGroupPanelProcs; - private Color _OrigGroupPanelSects; - private Color _OrigGroupPanelSteps; - //CSM-C2024-026 Evaluate the transitions panel - //Create a way to keep it from reverting the transition display panel to the currently selected item/transition. - public string HeldLinkText { get; protected set; } = ""; //will hold link text to stay on - public int HeldLink_TranFmtIndx { get; protected set; } = 0; //this will hold transition format that was selected on held item - public ItemInfo HeldLink_CurItemFrom { get; protected set; } //this will hold item that transitioning from - - #endregion - #region Constructors - public DisplayTransition() - { - InitializeComponent(); - } - #endregion - #region LoadControlData - // TransitionFillIn uses other methods to fill in all controls on the transition tab. - private bool _InitializingTrans; - private void TransitionFillIn() - { - _InitializingTrans = true; - if (_RangeNode1 != null || _RangeNode2 != null) ClearRangeTransition(); - InitControls(); - btnTranCancel.Enabled = false; - - _InitializingTrans = false; - } - private void InitControls() - { - _OrigGroupPanelSets = groupPanelTransitionSets.Style.BackColor; - _OrigGroupPanelProcs = groupPanelTransitionProcs.Style.BackColor; - _OrigGroupPanelSects = groupPanelTransitionSect.Style.BackColor; - _OrigGroupPanelSteps = groupPanelTranstionSteps.Style.BackColor; - // B2018-002 - Invalid Transitions - Get default section - side effect sets HasDefault - if (_CurItemFrom != null) FindSectionStart(_CurItemFrom.MyProcedure); - ListBoxTranFmtFillIn(); - - // if new, use _CurItemFrom to setup the initial selections in the controls, - // if modify, use the first transition to, _CurTrans - // This item will be either a procedure, section or step, never a docversion - ItemInfo selitm = _CurTrans==null?_CurItemFrom:_CurTrans.MyItemToID; - // If this points to an invalid transtion, make it point to itself. - if (selitm.PreviousID == null && selitm.ItemPartCount == 0 && selitm.ItemDocVersionCount == 0) - { - selitm = _CurItemFrom; - } - ItemInfo tmpitm = selitm; - ItemInfo secitm = null; - - // Find the procedure level first. - if (tmpitm.MyContent.Type == 0) // If at the procedure level then need to set the default section - { - int scid = FindSectionStart(tmpitm); - if(scid > 0) secitm = SectionInfo.Get(scid); - } - else - { - while (tmpitm.MyContent.Type != 0) - { - if (tmpitm.MyContent.Type >= 10000 && tmpitm.MyContent.Type < 20000 && secitm == null) - secitm = tmpitm; - tmpitm = tmpitm.MyParent; - } - } - _CurrentProcedure = tmpitm; - _CurrentToProcedure = _CurrentProcedure; - if (_CurTrans == null) - _CurrentItemProcedure = _CurrentProcedure; - else - { - // use the transition from to get the procedure 'from'.... - ItemInfo curfrom = _CurItemFrom; - while (curfrom.MyContent.Type != 0) curfrom = curfrom.MyParent; - _CurrentItemProcedure = curfrom; - } - // set other procedure related private variables. - vlnTreeComboSetsFillIn(_CurrentProcedure); - cbTranProcsFillIn(_CurrentProcedure); - if (_CurrentProcedure.Sections != null && secitm != null) - { - // if the selected format is using section default, initialize with the section default (find it), - // otherwise use current section item. - int secStartId = secitm.ItemID; - E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; - if ((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault) - { - NeedsDefault = true; // B2018-002 - Invalid Transitions - if (SectDefault set in TransFormat set NeedsDefault to true - secStartId = FindSectionStart(_CurrentProcedure); - if (secStartId > -1) - { - secitm = ItemInfo.Get(secStartId); - selitm = (secitm.Steps != null && secitm.Steps.Count > 0) ? secitm.Steps[0] : null; - } - else - btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save. - } - else - { - NeedsDefault = false;// B2018-002 - Invalid Transitions - if (SectDefault not set in TransFormat set NeedsDefault to false - } - cbTranSectsFillIn(secitm, secitm == null ? -1 : secStartId, true); - // Fill step items, passing in the active step to the selected item, or the first - // step if the selection was not at the step level. - ItemInfo stpitm = null; - if (selitm != null && selitm.MyContent.Type >= 20000) - { - - if (_DoingRange && CurTrans != null) - { - tvInitHiliteRange(); //rangeSameLevel, stpitm, rngitm, (i1 < i2) ? i2 : i1); - } - else - stpitm = selitm; - } - else if (secitm != null && secitm.Steps != null && secitm.Steps.Count > 0) - stpitm = selitm.Steps[0]; - if (!_DoingRange) tvTranFillIn(stpitm); // range code fills in tree. - //if (_DoingRange) tvInitHiliteRange(rangeSameLevel, stpitm, rngitm, (i1 < i2) ? i2 : i1); - } - else - { - cbTranSects.Items.Clear(); - tvTran.Nodes.Clear(); - } - SetControlsEnabling(); - SaveCancelEnabling();// B2018-002 - Invalid Transitions - Set button enabled or disabled - } - private void tvInitHiliteRange() //bool rangeSameLevel, ItemInfo stpitm, ItemInfo rngitm, int uplevel) - { - ItemInfo toItm = _CurTrans.MyItemToID; - ItemInfo rngItm = null; - // figure out whether at same level, have same parent and have same HLS: - ItemInfo itm1 = _CurTrans.MyItemToID; - ItemInfo itm2 = _CurTrans.MyItemRangeID; - // Invalid existing transition - if (itm2.ActiveParent == null || itm1.ActiveParent == null) - return; - //if (_CurTrans.TranType == 2 && itm1.ItemID == itm2.ItemID) itm2 = itm1.LastSibling; - bool samHLS = itm1.MyHLS.ItemID == itm2.MyHLS.ItemID; - int lev1 = 0; - int lev2 = 0; - while (!itm1.IsHigh) - { - lev1++; - itm1 = itm1.MyParent; - } - while (!itm2.IsHigh) - { - lev2++; - itm2 = itm2.MyParent; - } - bool samLevel = lev1 == lev2; - // For each range item, go to common level's parent. - int cnt = lev1+1; - ItemInfo sameParent1 = _CurTrans.MyItemToID; - ItemInfo sameParent2 = _CurTrans.MyItemRangeID; - if (_CurTrans.TranType == 2 && sameParent1.ItemID == sameParent2.ItemID) sameParent2 = sameParent1.LastSibling; - while (cnt != 0) - { - if (sameParent1.IsHigh) break; - sameParent1 = sameParent1.MyParent; - } - cnt = lev2+1; - while (cnt != 0) - { - if (sameParent2.IsHigh) break; - sameParent2 = sameParent2.MyParent; - } - tvTranFillIn(sameParent1); // if HLS, fill in from there, or it will fill in from common parent - - // 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. - ItemInfo toItem = sameParent1.Ordinal<=sameParent2.Ordinal?_CurTrans.MyItemToID:_CurTrans.MyItemRangeID; - ItemInfo rngItem = null; - - if (_CurTrans.TranType == 2 && _CurTrans.MyItemToID == _CurTrans.MyItemRangeID) - { - rngItem = sameParent1.Ordinal <= sameParent2.Ordinal ? _CurTrans.MyItemToID.LastSibling : _CurTrans.MyItemToID; - } - else - rngItem = sameParent1.Ordinal <= sameParent2.Ordinal ? _CurTrans.MyItemRangeID : _CurTrans.MyItemToID; - List path = new List(); - ItemInfo parRng = toItem; - for (int i = 0; i < lev1+1; i++) - { - path.Insert(i, parRng); - parRng = (ItemInfo)parRng.ActiveParent; - } - - // Find sameParent1 in tree, expand down to toItem: - if (tvTran.Nodes.Count == 0) return; - tvFillInRangeNodes(path, (VETreeNode)tvTran.Nodes[0], lev1, true); - path.Clear(); - parRng = rngItem; - for (int i = 0; i < lev2 + 1; i++) - { - path.Insert(i, parRng); - parRng = (ItemInfo)parRng.ActiveParent; - } - tvFillInRangeNodes(path, (VETreeNode)tvTran.Nodes[0], lev2, false); - tvTranRangeHilites(true, _RangeNode1, _RangeNode2); - tvTran.SelectedNode = _RangeNode1; - } - private void tvFillInRangeNodes(List path, VETreeNode tn, int level, bool to) - { - VETreeNode tnExpand = null; - while (tnExpand == null && tn != null) - { - ItemInfo ii = (ItemInfo)tn.VEObject; - if (ii.ItemID == path[level].ItemID) tnExpand = tn; - tn = (VETreeNode)tn.NextNode; - } - tnExpand.LoadChildren(false); - if (level > 0) - { - tnExpand.Expand(); - tvFillInRangeNodes(path, (VETreeNode)tnExpand.Nodes[0], level - 1, to); - } - else - { - if (to) - _RangeNode1 = tnExpand; - else - _RangeNode2 = tnExpand; - } - } - private void vlnTreeComboSetsFillIn(ItemInfo prcitm) - { - // from this procedure, walk up the tree storing the FolderInfos. This is done - // so that the tree can be expanded highlighting (selecting) the current set. - List filist = new List(); - DocVersionInfo mydocversion = prcitm.ActiveParent as DocVersionInfo; - Mydvi = mydocversion; // used for security check - FolderInfo tmpfi = mydocversion.ActiveParent as FolderInfo; - while (tmpfi != null) - { - if (tmpfi.FolderID != 1) filist.Add(tmpfi); // don't add top folder - tmpfi = tmpfi.ActiveParent as FolderInfo; - } - - // Now start at the top folder. Continue to get children using the filist to determine - // the expanded part of the tree. Note that if there is only 1 item at a level, - // the level is not added to the tree, except if there are no sub-folders, i.e. - // right before the docversion. Also note that docversions are not displayed - // (at least for now - as of 2/14/08), this may change and if so uncomment (& fix/test) - // the next section of code where docversions are processed. - FolderInfo fi = FolderInfo.GetTop(); - DropDownNode topnode = null; - vlnTreeComboSets.DropDownControl.Nodes.Clear(); // Bug fix B2016-248 - fixed duplicated list of procedures - int cntnd = 0; - while (fi.ChildFolderCount > 0) - { - // if there is more than 1 child, add this level of children to the - // to the tree. The second part of the 'if' covers the last level of - // folder. - if ((fi.ChildFolders.Count > 1) || - (fi.ChildFolders.Count==1 && fi.ChildFolders[0].FolderDocVersionCount>0)) - { - int indx = -1; - int pathid = filist[filist.Count - 1].FolderID; - foreach (FolderInfo fic in fi.SortedChildFolders) - { - DropDownNode newnode = new DropDownNode(fic.FolderID, fic.ToString()); - int tmp = topnode==null?vlnTreeComboSets.DropDownControl.Nodes.Add(newnode):topnode.Nodes.Add(newnode); - cntnd++; - newnode.Tag = fic; - if (fic.FolderID == pathid) - indx = tmp; // flag the path to expand. - else if (fic.ChildFolderCount > 0) // allow for '+' for tree expansion - { - DropDownNode tnt = new DropDownNode(0, "VLN_DUMMY"); - newnode.Nodes.Add(tnt); - } - } - topnode = topnode==null?(DropDownNode)vlnTreeComboSets.DropDownControl.Nodes[indx]:(DropDownNode)topnode.Nodes[indx]; - } - fi = (filist.Count > 0) ? FolderInfo.Get(filist[filist.Count - 1].FolderID) : null; - if (filist.Count > 0) filist.RemoveAt(filist.Count - 1); - } - // if nothing was added to the tree, just put in the node above the docversions... - if (vlnTreeComboSets.DropDownControl.Nodes.Count == 0) - { - cntnd++; - fi = mydocversion.MyFolder; - topnode = new DropDownNode(fi.FolderID, fi.ToString()); - vlnTreeComboSets.DropDownControl.Nodes.Add(topnode); - topnode.Tag = fi; - } - // if there is only one node in entire tree, disable selection... - if (cntnd == 1) _AlwaysDisableSets = true; - else _AlwaysDisableSets = false; - - // the following selects the set & displays its value in the combo box portion - // of the tree combo control. - vlnTreeComboSets.Value = topnode; - vlnTreeComboSets.DropDownControl.SelectedNode = topnode; - 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() - { - TransTypeList ttl = _CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList; - listBoxTranFmt.Items.Clear(); - for (int i = 0; i < ttl.MaxIndex; i++) - listBoxTranFmt.Items.Add(new TransItem(ttl[i].TransMenu.Replace("?.",""),ttl[i].TransFormat.Replace("?.",""))); - //listBoxTranFmt.Items.Add(ttl[i].TransFormat.Replace("?.","")); - listBoxTranFmt.SelectedIndex = _TranFmtIndx; - E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; - _DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast; - // B2018-002 - Invalid Transitions - Determine if a default section is required for this format - NeedsDefault = ((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault); - // B2018-002 - Invalid Transitions - Set backcolor to red if it doesn't have a default section and it Needs a Default Section - groupPanelTranFmt.Style.BackColor = !HasDefault && NeedsDefault ? Color.Red : Color.Orange; - } - private void tvTranFillIn(ItemInfo startitm) - { - tvTran.Nodes.Clear(); - groupPanelTranstionSteps.Style.BackColor = _OrigGroupPanelSteps; - if (startitm == null) return; - - // if metasections, and the selected section's config item has noneditable data, then don't - // display any steps. - ItemInfo secitm = (ItemInfo)cbTranSects.SelectedItem; - bool hasMetaSubs = secitm.IsSection && secitm.Sections != null && secitm.Sections.Count > 0; - bool editSteps = !hasMetaSubs || (secitm.MyConfig is SectionConfig && (secitm.MyConfig as SectionConfig).SubSection_Edit == "Y"); - if (!editSteps) - { - if (secitm.Sections != null) - { - // if the transition to point is a section or procedure, just return - if (startitm.MyContent.Type < 20000) return; - groupPanelTranstionSteps.Style.BackColor = Color.Cornsilk; - // 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]; - - // 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]; - 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 - bool setsel2 = false; - while (startitm != null) - { - VETreeNode tvn = new VETreeNode(startitm, false); - tvn.Tag = startitm; - int active = this.tvTran.Nodes.Add(tvn); - if (subSelStep != null && startitm.ItemID == subSelStep.ItemID) - { - tvTran.SelectedNode = tvTran.Nodes[active]; - setsel2 = true; - } - startitm = startitm.GetNext(); - } - if (!setsel2) tvTran.SelectedNode = tvTran.Nodes[0]; - tvTran.BeforeExpand -= new TreeViewCancelEventHandler(tvTran_BeforeExpand); - tvTran.BeforeExpand += new TreeViewCancelEventHandler(tvTran_BeforeExpand); - // bug fix. TreeView needs the next two lines to properly display the bottom node. jsj 01/08/2010 - tvTran.ItemHeight++; - tvTran.ItemHeight--; - } - return; - } - - // if the transition to point is a section or procedure, just return - if (startitm.MyContent.Type < 20000) return; - groupPanelTranstionSteps.Style.BackColor = Color.Cornsilk; - // For the tree view, use parent, unless already at HLS. If at HLS, use this level. - ItemInfo selitm = startitm.MyHLS; - //if (_CurTrans == null)selitm = startitm.MyHLS; - E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; - if (startitm.IsInRNO) - startitm = selitm.FirstSibling; // if in RNO tree, start out with HLS - else - startitm = selitm!=null? selitm.FirstSibling:startitm.FirstSibling; - bool setsel = false; - while (startitm != null) - { - VETreeNode tvn = new VETreeNode(startitm, false); - tvn.Tag = startitm; - int active = this.tvTran.Nodes.Add(tvn); - if (selitm !=null && startitm.ItemID == selitm.ItemID) - { - tvTran.SelectedNode = tvTran.Nodes[active]; - setsel = true; - } - startitm = startitm.GetNext(); - } - if (!setsel) tvTran.SelectedNode = tvTran.Nodes[0]; - tvTran.BeforeExpand -= new TreeViewCancelEventHandler(tvTran_BeforeExpand); - tvTran.BeforeExpand += new TreeViewCancelEventHandler(tvTran_BeforeExpand); - // bug fix. TreeView needs the next two lines to properly display the bottom node. jsj 01/08/2010 - tvTran.ItemHeight++; - tvTran.ItemHeight--; - } - //private int savSecStart; - private void cbTranSectsFillIn(ItemInfo secitm, int secstart, bool clear) - { - if (clear) cbTranSects.Items.Clear(); - // if the transition points 'to' procedure, don't list the sections yet. - if (secitm == null || secitm.MyContent.Type < 10000) return; - // if sectstart is not -1, then use this as the section to select, otherwise - // use the id for the item passed in. - int startitm = secstart; - if (clear && secstart < 0) secstart = secitm.ItemID; - ItemInfo selitm = secitm; // this is the selected 'section' - secitm = secitm.FirstSibling; - while (secitm != null) - { - // if the selected transition format requires a step be selected (show only step sections), only add step sections - E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; - if (((!((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) && secitm.IsStepSection) || - ((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) - { - int active = cbTranSects.Items.Add(secitm); - if (secitm.ItemID == secstart) cbTranSects.SelectedIndex = active; - } - if (secitm.Sections != null && secitm.Sections.Count > 0) cbTranSectsFillIn(secitm.Sections[0], secstart, false); - secitm = secitm.GetNext(); - } - if (cbTranSects.SelectedIndex == -1) cbTranSects.SelectedIndex = 0; - cbTranSects.Refresh(); - } - private void cbTranProcsFillIn(ItemInfo prcitm) - { - // B2018-009 - disable the save button if a folder is selected that does not contain procedures - if (prcitm == null) - { - _TreeComboSetHasDV = false; - SaveCancelEnabling(); - return; - } - else - _TreeComboSetHasDV = true; - ItemInfo curSelProc = null; - if (cbTranProcs.Items.Count > 0) curSelProc = cbTranProcs.SelectedItem as ItemInfo; - if (curSelProc != null && prcitm.ItemID == curSelProc.ItemID) return; - cbTranProcs.Items.Clear(); - ItemInfo selitm = prcitm; // this is the selected 'procedure' - prcitm = prcitm.FirstSibling; - while (prcitm != null) - { - int active = cbTranProcs.Items.Add(prcitm); - if (_CurrentProcedure.ContentID == prcitm.MyContent.ContentID) _CurrentProcIndex = active; - if (prcitm.MyContent.ContentID == selitm.MyContent.ContentID) cbTranProcs.SelectedIndex = active; - prcitm = prcitm.GetNext(); - } - } - private void SetControlsEnabling() - { - groupPanelTransitionSets.Style.BackColor = _OrigGroupPanelSets; - groupPanelTransitionProcs.Style.BackColor = _OrigGroupPanelProcs; - groupPanelTransitionSect.Style.BackColor = _OrigGroupPanelSects; - // Based on selection & enum representing the transition format, determine the enabling of associated controls - if (_CurItemFrom == null) return; - int indx = listBoxTranFmt.SelectedIndex; - if (listBoxTranFmt.SelectedIndex < 0 || listBoxTranFmt.SelectedIndex > listBoxTranFmt.Items.Count) indx = 0; - E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].TransUI; - - // do the set tree/combo & procedure combo. in 16-bit system it was types 0, 3, 5 - vlnTreeComboSets.Enabled = false; - if ((etm & E_TransUI.ProcMenu) == E_TransUI.ProcMenu) - { - if (!_AlwaysDisableSets) - { - vlnTreeComboSets.Enabled = true; - groupPanelTransitionSets.Style.BackColor = Color.Cornsilk; - } - cbTranProcs.Enabled = true; - groupPanelTransitionProcs.Style.BackColor = Color.Cornsilk; - } - else - { - cbTranProcs.SelectedIndex = _CurrentProcIndex > 0 ? _CurrentProcIndex : 0; - cbTranProcs.Enabled = false; - } - - // Do section combo, in 16-bit system it was types 0, 3, 4, 5 - // B2018-002 - Invalid Transitions - Determine if a default section is required for this format - NeedsDefault = (etm & E_TransUI.SectDefault) == E_TransUI.SectDefault; - if (cbTranSects.Items.Count > 0 && - ( (((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault && - _CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.DoSectionTransitions) || - ((etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) || - ((etm & E_TransUI.SectMenuStep) == E_TransUI.SectMenuStep)))) - { - cbTranSects.Enabled = true; - groupPanelTransitionSect.Style.BackColor = Color.Cornsilk; - } - else - { - cbTranSects.Enabled = false; - } - - // check for range - if no range, then range button/label & step tree selections should be - // 'cleared/invisble'. - btnTranRangeClear.Visible = _DoingRange; - lblxTranRangeTip.Visible = _DoingRange; - if (_DoingRange) - { - lblxTranRangeTip.BackColor = Color.Yellow; - } - // if any previous nodes selected for range - clear them here - if (!_DoingRange && _RangeNode1 != null) ClearRangeTransition(); - // Always allow for step selection if there are items. - if (tvTran.Nodes.Count > 0) tvTran.Enabled = true; - - // if a step doesn't need to be specified, then show the cbIncStepNum which allows - // user to define whether a step number is to be included in transition. - if ((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone) - { - cbIncStepNum.Visible = true; - // may or may not allow steps to be selected, i.e. if this is checked then enable - // tree view for step selection: - cbIncStepNum.Checked = true; - if (_CurTrans != null && _CurTrans.MyItemToID.MyContent.Type < 20000) - { - cbIncStepNum.Checked = false; - tvTran.Enabled = false; - } - // the following test is for Section/Optional Step (type 4 and related). If is a step section and its - // the only step section in the procedure then a step number must be selected. - int cntsect = 0; - foreach (ItemInfo ii in _CurItemFrom.MyProcedure.Sections) if (ii.IsStepSection) cntsect++; - if (((etm & E_TransUI.ProcCur) == E_TransUI.ProcCur) && ((etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) && cntsect==1) - { - tvTran.Enabled = true; - cbIncStepNum.Visible = false; - } - } - else - cbIncStepNum.Visible = false; - - // if this format has the transition flag for UseTransitionModifier, i.e. page numbers included in transition text, - // then make visible the checkbox & set based on data. - // and transition type has to be (tranType==1||tranType==2||tranType==4)) - cbPageNum.Visible = _CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier && - (_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].Type == 1 || - _CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].Type == 2 || - _CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].Type == 4); - - cbPageNum.Checked = false; - if (cbPageNum.Visible) - { - if (CurTrans != null) - { - TransitionConfig tc = new TransitionConfig(CurTrans.Config); - cbPageNum.Checked = _ModExistingPageNum = tc != null && tc.Transition_Formatted.ToUpper() == "TRUE"; - } - } - // B2024-016 if transition format does not have {First Step} then don't show step list - HideStepTreeIfNeeded(); - } - #endregion - #region Events - private void vlnTreeComboSets_BeforeExpand(object sender, TreeViewCancelEventArgs e) - { - DropDownNode par = ((DropDownNode)e.Node); - // get first child's text, if it has one & if the text is VLN_DUMMY, load children - DropDownNode tn = null; - if (par.Nodes.Count > 0) tn = (DropDownNode)par.Nodes[0]; - if (tn.Text == "VLN_DUMMY") // expand this - { - par.Nodes.Clear(); - Object obj = par.Tag; - if (!(obj is FolderInfo)) return; // should always be folderinfo on expand - FolderInfo fi = (FolderInfo)obj; - if (fi.ChildFolderCount > 0) - { - foreach (FolderInfo fic in fi.SortedChildFolders) - { - DropDownNode newnode = new DropDownNode(fic.FolderID, fic.ToString()); - par.Nodes.Add(newnode); - newnode.Tag = fic; - // B2018-009 Eliminate Working Draft (DocVersions) from the procedure tree for transitions - if (fic.ChildFolderCount > 0) // allow for '+' for tree expansion - { - DropDownNode tnt = new DropDownNode(0, "VLN_DUMMY"); - newnode.Nodes.Add(tnt); - } - } - } - // 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.DropDownControl.SelectedNode = par; - } - // B2018-009 variable used to disable the save button if a folder is selected does not contain procedures - private bool _TreeComboSetHasDV = false; - private void DropDown_FinishEditing(object sender, DropDownValueChangedEventArgs e) - { - DropDownNode selnd = (DropDownNode)vlnTreeComboSets.DropDownControl.SelectedNode; - Object obj = selnd.Tag; - // only allow selections from proc, sect & step controls if the user has - // selected a folder with only 1 working draft docversion or has - // selected the docversion itself.... - bool defines_set = false; - FolderInfo fi = null; - if (obj is FolderInfo) - { - fi = (FolderInfo)obj; - if (fi.ChildFolderCount == 0) - { - // note that the folder may contain more than one docversion, check for - // only 1 working draft. - int cntwd = 0; - if (fi.FolderDocVersions != null) // B2018-009 Only look for DocVersions if some exist - { - foreach (DocVersionInfo dvt in fi.FolderDocVersions) - { - if ((VersionTypeEnum)dvt.VersionType == VersionTypeEnum.WorkingDraft) cntwd++; - } - } - else - { - FlexibleMessageBox.Show("Based on your selection, cannot get list of procedures, Select another folder."); - // disable ALL other controls - cbTranProcs.Enabled = false; - cbTranSects.Enabled = false; - tvTran.Enabled = false; - // B2018-009 - disable the save button if a folder is selected that does not contain procedures - cbTranProcsFillIn(null); - return; - } - if (cntwd == 1) defines_set = true; - } - } - else if (obj is DocVersionInfo) - defines_set = true; - if (!defines_set) - { - FlexibleMessageBox.Show("Based on your selection, cannot get list of procedures, narrow the procedure set selection."); - // disable ALL other controls - cbTranProcs.Enabled = false; - cbTranSects.Enabled = false; - tvTran.Enabled = false; - // B2018-009 - disable the save button if a folder is selected that does not contain procedures - cbTranProcsFillIn(null); - return; - } - - // get to DocVersion node, if at folder... If there are no procedures, notify - // the user and return (a transition must at least go to a procedure). - // Otherwise, enable/disable controls based on format type of transition. - DocVersionInfo dv = null; - if (fi != null) - { - foreach (DocVersionInfo dvt in fi.FolderDocVersions) - { - if ((VersionTypeEnum)dvt.VersionType == VersionTypeEnum.WorkingDraft) - { - dv = dvt; - break; - } - } - } - else - dv = (DocVersionInfo)obj; - if (dv.Procedures.Count < 1) - { - FlexibleMessageBox.Show("There are no procedures in this set. Cannot insert a transition within it."); - cbTranProcs.Enabled = false; - cbTranSects.Enabled = false; - tvTran.Enabled = false; - // B2018-009 - disable the save button if a folder is selected that does not contain procedures - cbTranProcsFillIn(null); - return; - } - cbTranProcsFillIn(dv.Procedures[0]); - cbTranProcs.SelectedIndex = 0; - SetControlsEnabling(); - } - private void listBoxTranFmt_Click(object sender, EventArgs e) - { - if (_InitializingTrans) return; - if (listBoxTranFmt.SelectedIndex == _TranFmtIndx) return; - if (_RangeNode1 != null) ClearRangeTransition(); - // if this selection needs a step, but not a procedure, use the current procedure & the section list may need to updated - // with step only section. List the step sections of the current procedure..... - E_TransUI etmprev = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; - E_TransUI etmnew = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; - if (((etmnew & E_TransUI.ProcCur) == E_TransUI.ProcCur) && ((etmprev & E_TransUI.ProcCur) == E_TransUI.ProcCur) != ((etmnew & E_TransUI.ProcCur) == E_TransUI.ProcCur)) - { - _CurrentProcedure = _CurrentItemProcedure; - cbTranProcsFillIn(_CurrentProcedure); - ItemInfo tmpitm = _CurItemFrom; - ItemInfo secitm = null; - while (tmpitm.MyContent.Type != 0) // find current section - { - if (tmpitm.MyContent.Type >= 10000 && tmpitm.MyContent.Type < 20000 && secitm == null) secitm = tmpitm; - tmpitm = tmpitm.MyParent; - } - int sectstartid = FindSectionStart(_CurrentProcedure); - if (sectstartid==-1) btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save. - IList chldrn = _CurrentProcedure.GetChildren(); - int secIdForCbSect = secitm == null ? sectstartid : secitm.ItemID; - // if this transition format requires the default section, use it: - if ((etmnew & E_TransUI.SectDefault) == E_TransUI.SectDefault) - secIdForCbSect = sectstartid; - if (chldrn != null && chldrn.Count > 0) cbTranSectsFillIn((ItemInfo)chldrn[0], secIdForCbSect, true); //sectstartid); - } - // B2018-002 - Invalid Transitions - Determine if Default Section is required - NeedsDefault = ((etmnew & E_TransUI.SectDefault) == E_TransUI.SectDefault); - _TranFmtIndx = listBoxTranFmt.SelectedIndex; - // B2018-002 - Invalid Transitions - Set the backcolor to red if it doesn't have a default section and it needs one - groupPanelTranFmt.Style.BackColor = !HasDefault && NeedsDefault ? Color.Red : Color.Orange; - E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; - _DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast; - // get section selected and if it's a step section, fill in the treeview of steps - if (cbTranSects.Items.Count > 0) - { - ItemInfo secitm = (ItemInfo)cbTranSects.SelectedItem; - if (secitm == null || !secitm.IsStepSection) - { - tvTran.Nodes.Clear(); - tvTran.Enabled = false; - } - else - { - _InitializingTrans = true; // just initializing now, don't set any ranges, etc. - tvTranFillIn((secitm.Steps==null||secitm.Steps.Count==0)?null:secitm.Steps[0]); - tvTran.Enabled = true; - _InitializingTrans = false; - } - } - SetControlsEnabling(); - // if doing a 'new' range, no node is selected in tree. Without this, the first node in the - // tree was the selected node which was throwing off the logic for defining the _RangeNode1 - // and _RangeNode2 - if (_DoingRange) tvTran.SelectedNode = null; - 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) - { - VETreeNode tn = ((VETreeNode)e.Node); - // true fixes empty expand, but allows for transitions 'way down' in RNO tree. HVJ & PAL wanted to - // allow this (12/2/09). Note that this was changed to not allow transitions - // to RNOs (10/2010), this 'feature' will be added at some later date. - tn.ChildrenLoaded = false; - // F2024-047 BNPP standard Text transition - pass True to LoadChildren to load all children. - E_TransUI etm = (E_TransUI) _CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; - bool loadAllChildren = ((etm & E_TransUI.StepAllChildren) == E_TransUI.StepAllChildren); - bool excludeTableFigEqu = loadAllChildren; // don't show Tables, Figures, or Equations in step list - tn.LoadChildren(loadAllChildren, excludeTableFigEqu); - } - private void cbTranSects_SelectedIndexChanged(object sender, EventArgs e) - { - if (_InitializingTrans) return; - // a different section was selected, if step section, update step list, otherwise, empty - // it & disable. - ItemInfo secitm = (ItemInfo)cbTranSects.SelectedItem; - - //if (secitm.IsStepSection) - //{ - // cbTranSects.SelectedItem.Sections[0]; - - //} - if (!secitm.IsStepSection) - { - tvTran.Nodes.Clear(); - tvTran.Enabled = false; - cbIncStepNum.Enabled = false; // C2020-028: disable/uncheck 'Include Step Number' if on Word doc - cbIncStepNum.Checked = false; - // 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; - SaveCancelEnabling(); - } - else - { - _InitializingTrans = true; // just initializing now, don't set any ranges, etc. - tvTranFillIn((secitm.Steps == null || secitm.Steps.Count == 0) ? null : secitm.Steps[0]); - // B2024-016 only show the list of steps if used by the select transition - HideStepTreeIfNeeded(); - // if doing a 'new' range, no node is selected in tree. Without this, the first node in the - // tree was the selected node which was throwing off the logic for defining the _RangeNode1 - // and _RangeNode2 - if (_DoingRange) - { - tvTran.SelectedNode = null; - // if there was an existing range clear the range because the section selection had changed - // and these range values are no longer valid. - if (_RangeNode1 != null || _RangeNode2 != null) _RangeNode1 = _RangeNode2 = null; - } - _InitializingTrans = false; - SaveCancelEnabling(); - - //CSM-C2024-026 Evaluate the transitions panel - //Create a way to keep it from reverting the transition display panel to the currently selected item/transition. - //If checkbox is checked to enable holding an item, - //then store the first step in the currently selected item - if (cbHoldProcSet.Checked && secitm.Steps != null && secitm.Steps.Count > 0) - { - HeldLinkText = string.Format("#Link:Transition:{0} {1}", listBoxTranFmt.SelectedIndex, secitm.Steps[0].ItemID); - HeldLink_TranFmtIndx = listBoxTranFmt.SelectedIndex; - HeldLink_CurItemFrom = secitm.Steps[0]; - } - } - } - // B2024-016 Hide the step tree when the transition definition does not include a step number {First Step} - private void HideStepTreeIfNeeded() - { - string trnFmt = _CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransFormat; - // F2024-047 Added check for {Step Text} so that the step tree is displayed - // Needed for BNPP transition to step text only for standard text - bool showStepList = trnFmt.Contains("{First Step}") || trnFmt.Contains("{Step Text}"); - if (!showStepList) - tvTran.Nodes.Clear(); // clear the tree view of steps if not needed for selected transition - tvTran.Enabled = showStepList; // show the tree view of steps? - cbIncStepNum.Enabled = showStepList; // display the Include Step checkbox? - cbIncStepNum.Checked = showStepList; // uncheck the Include Step? - } - - // B2018-002 - Invalid Transitions - Declare Default Section variables - private bool NeedsDefault; - private bool HasDefault; - private int FindSectionStart(ItemInfo prcitm) - { - HasDefault = true;// B2018-002 - Invalid Transitions - Initialize Has Default to true - // Steps to get the section start. continue down list until finding a valid id. If none is found - // put up a message dialog - and if returns a result of -1, caller should disable the 'ok' button - // so that a transition cannot be entered until the default section is defined: - // 1) Look in ProcedureConfig/SectionStart - // 2) Look in SectionConfig/OriginalSteps - // 3) Search through the procedure's sections for 'Procedure Steps' as the title - // 4) If plant has format flag that procedure doesn't require default sections to be set, and none - // have been, return first in list. - // 5) Display message box telling user to set the default section on section properties/format dialog - // (this returns a -1, i.e. error) - - // 1) Look in ProcedureConfig/SectionStart - ProcedureConfig pc = (ProcedureConfig)prcitm.MyConfig; - int sectstartid = -1; - string ss = pc == null ? null : pc.SectionStart; - SectionInfo si = null; - if (ss != null && ss != "") - { - sectstartid = System.Convert.ToInt32(ss); - si = SectionInfo.Get(sectstartid); - } - if (si != null) - { - if (si.MyProcedure.ItemID == prcitm.ItemID) return sectstartid; - // 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. - foreach (SectionInfo si1 in prcitm.Sections) - { - if (si.DisplayNumber == si1.DisplayNumber && si.DisplayText == si1.DisplayText) - { - using (Procedure p = Procedure.Get(prcitm.ItemID)) - { - if (p.ProcedureConfig.SectionStart != si1.ItemID.ToString()) - { - p.ProcedureConfig.SectionStart = si1.ItemID.ToString(); - p.Save(); - } - } - return si1.ItemID; - } - } - } - // 2) Look in SectionConfig/OriginalSteps = 'Y' - if (prcitm.Sections != null) - { - foreach (SectionInfo sio in prcitm.Sections) - - { - SectionConfig sc = sio.MyConfig as SectionConfig; - if (sc != null && sc.Section_OriginalSteps == "Y") - { - return sio.ItemID; - } - } - // 3) Find if any of the section titles contain 'PROCEDURES STEPS' - foreach (SectionInfo sit in prcitm.Sections) - { - if (sit.DisplayText.ToUpper().Contains("PROCEDURE STEPS")) - return sit.ItemID; - } - foreach (SectionInfo sit in prcitm.Sections) - { - if (sit.DisplayText.ToUpper().Equals("PROCEDURE"))// bug fix: B2015-003 - return sit.ItemID; - } - } - // 4) Format has flag that a default section is not required so return 1st section. - if (prcitm.Sections != null) - { - foreach (SectionInfo sid in prcitm.Sections) - { - if (sid.IsStepSection && sid.ActiveFormat.PlantFormat.FormatData.TransData.NoDefaultSectReq) return sid.ItemID; - } - // 3) Find if any of the section titles contain 'PROCEDURES STEPS' - foreach (SectionInfo sit in prcitm.Sections) - { - if (sit.DisplayText.ToUpper().Contains("PROCEDURE STEPS")) - return sit.ItemID; - } - foreach (SectionInfo sit in prcitm.Sections) - { - if (sit.DisplayText.ToUpper().Equals("PROCEDURE"))// bug fix: B2015-003 - return sit.ItemID; - } - } - // 5) Display messagebox to tell user to specify which section should be used as the 'default section'. - //MessageBox.Show("No default step section was found. Set the appropriate Step Section as the default by using the Section Property Page, Format Tab.", "Transition using Default Step Section in Format", MessageBoxButtons.OK,MessageBoxIcon.Error); - HasDefault = false;// B2018-002 - Invalid Transitions - Set Has default to false - return -1; - } - private void cbTranProcs_SelectedIndexChanged(object sender, EventArgs e) - { - if (_InitializingTrans) return; - ItemInfo prcitm = (ItemInfo)cbTranProcs.SelectedItem; - if (prcitm == null || prcitm.Sections == null || prcitm.Sections.Count < 1) - { - cbTranSects.Items.Clear(); - tvTran.Nodes.Clear(); - return; - } - int sectstartid = FindSectionStart(prcitm); - if (sectstartid == -1) btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save. - IList chldrn = prcitm.GetChildren(); - cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid, true); - bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep; - btnTranSave.Enabled = !isenh && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons - SaveCancelEnabling(); - } - private void tvTran_AfterSelect(object sender, TreeViewEventArgs e) - { - if (_InitializingTrans) return; - E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; - // Use VEObject - if ((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone && (tvTran.SelectedNode as VETreeNode).VEObject == null) - { - bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep; - btnTranSave.Enabled = !isenh && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons - return; - } - // check if node is a true end-point, i.e. not a 'part' node. If part node, don't - // allow selection. - VETreeNode vt = tvTran.SelectedNode as VETreeNode; - ItemInfo selii = vt.VEObject as ItemInfo; - if (selii == null) - { - FlexibleMessageBox.Show("Must select a valid step, not a grouping part such as 'RNO', 'Steps', etc"); - return; - } - SaveCancelEnabling(); - - //CSM-C2024-026 Evaluate the transitions panel - //Create a way to keep it from reverting the transition display panel to the currently selected item/transition. - //If checkbox is checked to enable holding an item, - //then store the currently selected item - if (cbHoldProcSet.Checked) - { - HeldLinkText = string.Format("#Link:Transition:{0} {1}", listBoxTranFmt.SelectedIndex, selii.ItemID); - HeldLink_TranFmtIndx = listBoxTranFmt.SelectedIndex; - HeldLink_CurItemFrom = selii; - } - - if (_DoingRange) - { - if (_RangeNode1 == null || (_RangeNode1 != null && _RangeNode2 != null)) - { - if (_RangeNode1 != null) tvTranRangeHilites(false, _RangeNode1, _RangeNode2); - tvTran.SelectedNode.BackColor = _RangeColor; - _RangeNode1 = (VETreeNode)tvTran.SelectedNode; - _RangeNode2 = null; - lblxTranRangeTip.Text = "Select Last Step \r\nfor Range"; - lblxTranRangeTip.BackColor = Color.LightPink; - btnTranSave.Enabled = false; - } - else - { - if (_RangeNode2 != null) tvTranRangeHilites(false, _RangeNode1, _RangeNode2); - _RangeNode2 = (VETreeNode)tvTran.SelectedNode; - tvTran.SelectedNode.BackColor = _RangeColor; - tvTranRangeHilites(true, _RangeNode1, _RangeNode2); - lblxTranRangeTip.Text = "Select First Transition\r\nfor Range"; - lblxTranRangeTip.BackColor = Color.Yellow; - bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep; - btnTranSave.Enabled = !isenh && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons - } - } - } - private void SaveCancelEnabling() - { - //bool hasChanged = _CurItemFrom != _SavCurItemFrom || _TranFmtIndx != _SavTranFmtIndx - // || ( selii != null && _CurTrans.ToID != selii.ItemID); - bool hasChanged = SettingsChanged; - 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-009 - Don't enable the save button if a folder is selected that does not contain procedures - btnTranSave.Enabled = _TreeComboSetHasDV && (HasDefault || !NeedsDefault) && !isenh && hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons - btnTranCancel.Enabled = _CurTrans != null && hasChanged; - groupPanelTranFmt.Text = (!HasDefault && NeedsDefault) ? "Requires Default" : "Select Format"; - // B2018-002 - Invalid Transitions - Set tool tip based upon HasDefault and NeedsDefault - if (!HasDefault && NeedsDefault)// B2018-010 Logic was incorrect to determine which tooltip to show - this.superToolTipDispTran.SetSuperTooltip(this.listBoxTranFmt, - new DevComponents.DotNetBar.SuperTooltipInfo("Requires Default", "", - "The selected Transition Format requires a Default Section.\r\n" + - "This can be set on the format tab of the section property window.", null, null, DevComponents.DotNetBar.eTooltipColor.Yellow)); - else - this.superToolTipDispTran.SetSuperTooltip(this.listBoxTranFmt, new DevComponents.DotNetBar.SuperTooltipInfo("", "", - "This is where transition types are selected. This also defines how the transition will look in the text.", - null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - // B2024-007 color of transition panel was not toggling properly - 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) - { - btnTranSave.Enabled = false; - btnTranCancel.Enabled = false; - _CurItemFrom = _SavCurItemFrom; - _TranFmtIndx = _SavTranFmtIndx; - TransitionFillIn(); - } - private void btnTranRangeClear_Click(object sender, EventArgs e) - { - ClearRangeTransition(); - } - // B2021-115 - the start and end step of range transition were sometimes being flipped when they should not have been - // RangeItemAndToItemNeedsSwitch() was written to compare each item's short search path to determine if - // the starting step and the ending step (rangeitem) should be switched. This could happen if the the user - // selected a starting step that was after the ending step when creating the transition. - private bool RangeItemAndToItemNeedsSwitched(ItemInfo startItem, ItemInfo endItem) - { - - // the ShortSearchPath is being used because each step level is represented as a number, even the the step tab is displayed as a letter - // i.e. if the step tab is "3.2.B", the ShortSearchPath would be "3.2.2" - // each step level in the ShortSearchPath is separated by '\a' - string[] startItemSearchPathList = startItem.ShortSearchPath.Split('\a'); - string[] endItemSearchPathList = endItem.ShortSearchPath.Split('\a'); - int ii = 0; - while (ii < startItemSearchPathList.Length && ii < endItemSearchPathList.Length) - { - if (startItemSearchPathList[ii] == endItemSearchPathList[ii]) ii++; // same at this level, check the next - else - { - // the tab strings are different, so check each "number" (level), split on the '.' that between each number in the tab string. - string[] ss = startItemSearchPathList[ii].Split('.'); - string[] ee = endItemSearchPathList[ii].Split('.'); - int iii = 0; - while (iii < ss.Length && iii < ee.Length) - { - int start = Convert.ToInt32(ss[iii]); - int end = Convert.ToInt32(ee[iii]); - if (start == end) - iii++; // The number is the same at this level - else if (start > end) - return true; // The starting transition step is after the ending transition step - else return false; // The starting transition step is before the ending transition step - no change needed - } - if (ss.Length > ee.Length) - return true; // The starting transition step is after (goes down one more level) the ending transition step - else - return false; // The ending transition step is after (goes down one more level) the starting transition step - no change needed - } - } - return false; // shouldn't hit this line because both the start and end steps are the same - } - private void btnTranSave_Click(object sender, EventArgs e) - { - string trantxt = "(Resolved Transition Text)"; - string linktxt = null; - E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; - // if must have a step, test for this first. - if (!((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) // _tranitem1 is set from step tree node. - { - if (tvTran.SelectedNode==null) - { - FlexibleMessageBox.Show("Must 'Select Step' for transition 'to'"); - return; - } - } - ItemInfo toItem = null; - ItemInfo rangeItem = null; - if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast) //range - { - if (_RangeNode1==null) - { - FlexibleMessageBox.Show("Must 'Select Step' for transition 'to'"); - return; - } - toItem = (ItemInfo)_RangeNode1.VEObject; - if (_RangeNode2 == null && tvTran.SelectedNode == null) - { - FlexibleMessageBox.Show("Must 'Select Step' for range transition 'to'"); - return; - } - if (_RangeNode2 == null) _RangeNode2 = (VETreeNode)tvTran.SelectedNode; - rangeItem = (ItemInfo)_RangeNode2.VEObject; - // The following code was commented out in June 2013 based on a discussion with - // HVJ & PAL stating that the range transition should be specific as to what they - // enter, not set to end of list. - // If this is Transition type 2, then make 'rangenode2' same as rangenode1 - // This will get resolved when transition text is resolved. This case represents - // range from rangenode1 to last sibling. Note that this is only done if within - // the same sibling group. Otherwise, get the second item in the - // range, based on current tree view selection. - //if (listBoxTranFmt.SelectedIndex == 2) - //{ - // // if type 2 and not a HLS and the range is within the same hls, then set - // // to and range to be equal. When text gets resolved, this case generates - // // a list represent the toid,,,lastsibling. - // if (!toItem.IsHigh && toItem.MyHLS.ItemID == rangeItem.MyHLS.ItemID) - // rangeItem = toItem; - // else - // rangeItem = rangeItem.MyHLS; - //} - // Check that the two items are of the below the section type. - if (toItem.MyContent.Type < 20000 || rangeItem.MyContent.Type < 20000) - { - FlexibleMessageBox.Show("Must select two items at the step level or below, i.e. no sections, procedures, etc."); - return; - } - // be sure that the order is right, i.e. to is before range in list. - if (toItem.ItemID != rangeItem.ItemID) - { - Boolean switchIds = false; - // 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 - if (switchIds) - { - ItemInfo switchItem = toItem; - toItem = rangeItem; - rangeItem = switchItem; - } - } - linktxt = string.Format("#Link:TransitionRange:{0} {1} {2}", listBoxTranFmt.SelectedIndex, toItem.ItemID, rangeItem.ItemID); - } - else if ((etm & E_TransUI.StepFirst) == E_TransUI.StepFirst) - { - if (tvTran.SelectedNode != null && (cbIncStepNum.Visible == false || cbIncStepNum.Checked)) - { - VETreeNode vtn = (VETreeNode)tvTran.SelectedNode; - toItem = (ItemInfo)vtn.VEObject; - } - else - { - toItem = (ItemInfo)cbTranSects.SelectedItem; // didn't select a step. - if (toItem == null) - toItem = (ItemInfo)cbTranProcs.SelectedItem; - } - if (toItem != null) // this will be null if transition is to a an empty procedure set (sections but no steps) - linktxt = string.Format("#Link:Transition:{0} {1}", listBoxTranFmt.SelectedIndex, toItem.ItemID); - } - // toItem may have been set in the 'Range' selection code above. - if (toItem == null && (etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) - { - if (tvTran.Enabled == false || (toItem!=null && toItem.IsAccPages)) - toItem = (ItemInfo)cbTranSects.SelectedItem; - else - { - VETreeNode vtn = (VETreeNode)tvTran.SelectedNode; - if (vtn == null || vtn.Tag == null) toItem = (ItemInfo)cbTranSects.SelectedItem; - else toItem = (ItemInfo)vtn.VEObject; - } - if (toItem==null) - { - FlexibleMessageBox.Show("Must 'Select Section' or 'Select Step' for transition 'to'"); - return; - } - linktxt = string.Format("#Link:Transition:{0} {1}", listBoxTranFmt.SelectedIndex, toItem.ItemID); - } - if (toItem == null && (((etm & E_TransUI.ProcCur) == E_TransUI.ProcCur) || ((etm & E_TransUI.ProcMenu) == E_TransUI.ProcMenu))) - { - toItem = (ItemInfo)cbTranProcs.SelectedItem; - if (toItem == null) - { - FlexibleMessageBox.Show("Must select an item for transition 'to'"); - return; - } - linktxt = string.Format("#Link:Transition:{0} {1}", listBoxTranFmt.SelectedIndex, toItem.ItemID); - } - // Can I build the text right now? - ProposedTransition pt = CanTransitionBeCreatedCommand.Execute(MyRTB.MyItemInfo.ItemID, toItem.ItemID); - if (pt.Status == 0) - { - StringBuilder sb = new StringBuilder(); - sb.AppendLine("Applicability of source and destination steps will not allow this transition to be created."); - sb.AppendLine(); - sb.AppendLine(string.Format("Source step {0} has applicability of {1}", pt.FromStep, pt.FromAppl)); - sb.AppendLine(string.Format("Destination step {0} has applicability of {1}", pt.ToStep, pt.ToAppl)); - FlexibleMessageBox.Show(sb.ToString()); - return; - } - if(listBoxTranFmt.Text.Contains("{Step Text}") && toItem.ItemID == MyRTB.MyItemInfo.ItemID) - { - FlexibleMessageBox.Show("You cannot add a transition to itself for a transition that includes Step Text", - "Cannot add recursive transition", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - // B2015-170 - don't allow a transition to step that is not sequential - // B2024-019 - but allow if TranFmt only contains {Step Text} - // - Calvert uses {Step Text} but also includes step number - // - Barakah (BNPP) uses just {Step Text} to link to standard text - bool onlyStepText = false; - if (listBoxTranFmt.Text.Contains("{Step Text}") && !listBoxTranFmt.Text.Contains("{First Step}")) - onlyStepText = true; - if (!onlyStepText && (toItem != null &&!toItem.IsNumbered) || (rangeItem != null && !rangeItem.IsNumbered)) - { - FlexibleMessageBox.Show("For transitions containing step references, the transition must be to a numbered or lettered step.", - "Cannot add transition to a non-sequential step", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - bool doTranmod = cbPageNum.Visible && cbPageNum.Checked; - trantxt = TransitionText.GetResolvedText(MyRTB.MyItemInfo, listBoxTranFmt.SelectedIndex, toItem, rangeItem ?? toItem, doTranmod); - int ss = MyRTB.SelectionStart;// Remember where the link is being added - int sl = MyRTB.SelectionLength; - MyRTB.OnReturnToEditor(this, new EventArgs()); - MyRTB.Select(ss, sl); - MyRTB.InsertTran(trantxt, linktxt);// Insert the LINK - MyRTB.OnDoSaveContents(this, new EventArgs()); //.SaveText();// Save the text with the LINK - This also moves the cursor to the end of the text - // By selecting a starting position within a link, StepRTB (HandleSelectionChange) will select the link - MyRTB.Select(ss + 7 + trantxt.Length, 0);// Try 7 for i2) - { - VETreeNode t = node2; - node2 = node1; - node1 = t; - } - - // Turn Hilighting on/off (depending on bool argument) between the two nodes - // they may be at different tree levels. - // find common parent level first and save the 'top parent' node for each selection. - VETreeNode top1 = node1; - VETreeNode top2 = node2; - // loop, walking up node2's tree checking against node1. If not found, go to node1 - // parent, etc. - bool foundcommon = false; - while (!foundcommon && top1 != null) - { - while (!foundcommon & top2 != null) - { - if (top1.Parent == top2.Parent) foundcommon = true; - else top2 = (VETreeNode)top2.Parent; - } - if (!foundcommon) - { - top2 = node2; - top1 = (VETreeNode)top1.Parent; - } - } - - // work down from node1. - VETreeNode cur = node1; - while (cur != null) - { - cur.BackColor = on ? _RangeColor : tvTran.BackColor; - cur = (VETreeNode)(cur.NextNode == null ? cur.Parent : cur.NextNode); - // 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 == top2) top1 = cur = null; - } - // set background for highest level between two nodes. - cur = top1==null?null:(VETreeNode)top1.NextNode; - while (cur != null) - { - cur.BackColor = on ? _RangeColor : tvTran.BackColor; - cur = (cur == top2) ? null : (VETreeNode)cur.NextNode; - } - // finish subtree of second node in range. - cur = top2==node2?null:node2; - while (cur != null) - { - cur.BackColor = on ? _RangeColor : tvTran.BackColor; - cur = (VETreeNode)(cur.PrevNode == null ? cur.Parent : cur.PrevNode); - if (cur == top2) cur = null; // stop at top - } - // hilite last selection.. - top2.BackColor = on ? _RangeColor : tvTran.BackColor; - } - #endregion - - public DocVersionInfo Mydvi = null; // this is initialized in vlnTreeComboSetsFillIn() - - private static UserInfo _MyUserInfo = null; - public static UserInfo MyUserInfo - { - get { return _MyUserInfo; } - set { _MyUserInfo = value; } - } - - private void cbIncStepNum_CheckedChanged(object sender, EventArgs e) - { - tvTran.Enabled=cbIncStepNum.Checked; - if (!_InitializingTrans) SaveCancelEnabling(); - } - private void cbPageNum_CheckedChanged(object sender, EventArgs e) - { - if (_ModExistingPageNum != cbPageNum.Checked) - { - btnTranCancel.Enabled = true; - btnTranSave.Enabled = UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons - } - } - - //CSM-C2024-026 Evaluate the transitions panel - //Create a way to keep it from reverting the transition display panel to the currently selected item/transition. - //If checkbox is checked to enable holding an item, - //then store the currently selected item - //if checkbox becomes unchecked then clear item. - private void cbHoldProcSet_CheckedChanged(object sender, EventArgs e) - { - if (cbHoldProcSet.Checked) - { - VETreeNode vt = tvTran.SelectedNode as VETreeNode; - ItemInfo selii = vt.VEObject as ItemInfo; - if (selii != null) - { - HeldLinkText = string.Format("#Link:Transition:{0} {1}", listBoxTranFmt.SelectedIndex, selii.ItemID); - HeldLink_TranFmtIndx = listBoxTranFmt.SelectedIndex; - HeldLink_CurItemFrom = selii; - } - } - else - { - HeldLinkText = ""; - HeldLink_CurItemFrom = null; - HeldLink_TranFmtIndx = 0; - } - } - } - public class TransItem - { - private string _ItemDescription; - - public string ItemDescription - { - get { return _ItemDescription; } - set { _ItemDescription = value; } - } - - private string _Format; - - public string Format - { - get { return _Format; } - set { _Format = value; } - } - public TransItem(string desc, string fmt) - { - _ItemDescription = desc; - _Format = fmt; - } - public override string ToString() - { - return _ItemDescription; - } - } -} diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.resx b/PROMS/Volian.Controls.Library/DisplayTransition.resx deleted file mode 100644 index 354eec95..00000000 --- a/PROMS/Volian.Controls.Library/DisplayTransition.resx +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - By default, PROMS will load the Procedure Set/Procedure in this window for the step (or transition link within a step) that is selected with the mouse. - -Selecting this checkbox temporarily disables that behavior so that clicking on various steps within the procedure will not move away from the Procedure Set/Procedure that has currently been selected in these windows. - -Note: One exception to this is if you navigate to a Procedure set that has a different format. In that case, it will refresh these options based on that new format. - - - This allows you to select the procedure set that the transition points to, if the selected transition format allows for the transition to point to another set. If the format does NOT allow for pointing to another set, a selection will not be available. - - - This allows you to select the procedure that the transition points to, if the selected transition format allows for the transition to point to another procedure. If the format does NOT allow for pointing to another procedure, a selection will not be available. - - - This allows you to select the section that the transition points to, if the selected transition format allows for the transition to point to a section. If the format does NOT allow for pointing to another section, a selection will not be available. - - - This allows you to select the step(s) that the transition points to, if the selected transition format allows for the transition to point to step(s). If the format does NOT allow for pointing to step(s), a selection will not be available. - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DropDownNode.cs b/PROMS/Volian.Controls.Library/DropDownNode.cs deleted file mode 100644 index 93aa4345..00000000 --- a/PROMS/Volian.Controls.Library/DropDownNode.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Windows.Forms; - -using AT.STO.UI.Win; - -namespace Volian.Controls.Library -{ - internal class DropDownNode : TreeNode, ILookupItem - { - #region Private Variable Declarations - private long _id = 0; - #endregion - #region Constructor / Destructor - /// - /// Default constructor. - /// - public DropDownNode() : base() - { - } - - /// - /// /// - /// Some constructors initializing the node with Id. - /// - /// - /// - /// - public DropDownNode(long Id, string Text) : base(Text) - { - _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 - #region Public Methods - public override string ToString() - { - return this.GetType().Name + " (Id=" + Id.ToString() + ", Name=" + Text + ")"; - } - #endregion - #region ILookupItem Implementation - public long Id - { - get { return _id; } - } - - public new string Text - { - get { return base.Text; } - } - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/DropDownTree.cs b/PROMS/Volian.Controls.Library/DropDownTree.cs deleted file mode 100644 index 30a66218..00000000 --- a/PROMS/Volian.Controls.Library/DropDownTree.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Windows.Forms; - -using AT.STO.UI.Win; - -namespace Volian.Controls.Library -{ - internal class DropDownTree : TreeView, IDropDownAware - { - #region DropDownTree - public DropDownTree() - { - this.Dock = DockStyle.Top; - } - #endregion - #region TreeView Events - /// - /// Allow keeping track of the editing process. - /// - /// - protected override void OnAfterSelect(TreeViewEventArgs e) - { - base.OnAfterSelect(e); - - if (ValueChanged != null) - { - ValueChanged(this, new DropDownValueChangedEventArgs(e.Node)); - } - } - /// - /// A double click on a node counts as finish editing. - /// - /// - protected override void OnDoubleClick(EventArgs e) - { - base.OnDoubleClick(e); - - TreeNode node = HitTest(PointToClient(Cursor.Position)).Node; - - if ((FinishEditing != null) && (node != null)) - { - FinishEditing(this, new DropDownValueChangedEventArgs(node)); - } - } - - /// - /// ENNTER counts as finish editing, ESC as cancel (null is returned). - /// - /// - protected override void OnKeyUp(KeyEventArgs e) - { - base.OnKeyUp(e); - - if (FinishEditing != null) - { - switch (e.KeyCode) - { - case Keys.Enter: - FinishEditing(this, new DropDownValueChangedEventArgs(Value)); - break; - case Keys.Escape: - FinishEditing(this, new DropDownValueChangedEventArgs(null)); - break; - } - } - } - #endregion - #region IDropDownAware Implementation - public event DropDownValueChangedEventHandler FinishEditing; - public event DropDownValueChangedEventHandler ValueChanged; - - public object Value - { - get { return base.SelectedNode; } - set - { - if (value is DropDownNode) - { - base.SelectedNode = value as DropDownNode; - } - } - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/EditItem.Designer.cs b/PROMS/Volian.Controls.Library/EditItem.Designer.cs deleted file mode 100644 index 4f44466c..00000000 --- a/PROMS/Volian.Controls.Library/EditItem.Designer.cs +++ /dev/null @@ -1,43 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class EditItem - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - protected bool _BeingDisposed = false; - - public bool BeingDisposed - { - get { return _BeingDisposed; } - set { _BeingDisposed = value; } - } - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - _BeingDisposed = true; - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs deleted file mode 100644 index b52a03cd..00000000 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ /dev/null @@ -1,4366 +0,0 @@ -using System; -using System.ComponentModel; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using System.Drawing; -using System.Windows.Forms; -using System.Text.RegularExpressions; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; -using JR.Utils.GUI.Forms; -using System.Linq; - -namespace Volian.Controls.Library -{ - #region Enums - public enum ChildRelation : int - { - None = 0, - After = 1, - Before = 2, - RNO = 3, - SupInfo = 4 - } - public enum E_ChangeBarPosition : int - { - Left = 0, - Right = 1 - } - #endregion - public abstract partial class EditItem : UserControl - { - #region EditItemUnique - //private static int _EditItemUnique = 0; - //private static int EditItemUnique - //{ - // get - // { - // if (_EditItemUnique == 3) - // Console.WriteLine("here"); - // return ++_EditItemUnique; - // } - //} - //private int _MyEditItemUnique = EditItemUnique; - - //public int MyEditItemUnique - //{ - // get {return _MyEditItemUnique; } - //} - #endregion - #region Constructor - public EditItem() - { - InitializeComponent(); - this.Enter += EditItem_Enter; - } - - // This event was added to better control enabling or disabling of the Insert and Copy Step buttons on the ribbon - void EditItem_Enter(object sender, EventArgs e) - { - bool allow = (MyStepPanel.VwMode == E_ViewMode.Edit); - StepTabRibbon str = MyStepPanel.MyStepTabPanel.MyStepTabRibbon; - str.SiblingsButtonsEnabled = allow; - str.InsertButtonsEnabled = allow && !(MyItemInfo.IsProcedure || MyItemInfo.IsSection || MyItemInfo.IsRNOPart || MyItemInfo.IsSupInfoPart); - // do special case for cpystep button: cannot copy an enhanced step and can copy a supinfo - if (MyItemInfo.IsEnhancedStep) str.SetCopyStepButton(false); - if (MyItemInfo.IsSupInfoPart) str.SetCopyStepButton(allow); - if (MyItemInfo.IsRNOPart) str.SetCopyStepButton(allow); //B2019-009 allow the selection of an RNO step type for CopyStep - } - - public EditItem(IContainer container) - { - container.Add(this); - InitializeComponent(); - this.Enter += EditItem_Enter; - } - #endregion - #region Properties - private bool _RTBLastFocus = true; - public bool RTBLastFocus - { - get { return _RTBLastFocus; } - set { _RTBLastFocus = value; } - } - protected static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - protected ChildRelation _MyChildRelation; - public ChildRelation MyChildRelation - { - get { return _MyChildRelation; } - set { _MyChildRelation = value; } - } - protected bool _Loading = true; - protected EditItem _MyParentEditItem = null; - protected EditItem _MySectionRTBItem; - protected EditItem _MyPreviousEditItem = null; - protected EditItem _MyNextEditItem = null; - private bool _ChildrenLoaded = false; - public bool HasChildren - { - get { return _MyBeforeEditItems != null || _MyRNOEditItems != null || _MyAfterEditItems != null; } - } - internal List _MyBeforeEditItems; - public List MyBeforeEditItems // MyBeforeEditItems are Cautions & Notes - { - get { return _MyBeforeEditItems; } - set { _MyBeforeEditItems = value; } - } - internal List _MyAfterEditItems; - public List MyAfterEditItems - { - get { return _MyAfterEditItems; } - set { _MyAfterEditItems = value; } - } - internal List _MyRNOEditItems; - public List MyRNOEditItems - { - get { return _MyRNOEditItems; } - set { _MyRNOEditItems = value; } - } - internal List _MySupInfoEditItems; - public List MySupInfoEditItems - { - get { return _MySupInfoEditItems; } - set { _MySupInfoEditItems = value; } - } - private StepSectionLayoutData _MyStepSectionLayoutData; - public StepSectionLayoutData MyStepSectionLayoutData - { - get { return _MyStepSectionLayoutData; } - set { _MyStepSectionLayoutData = value; } - } - private StepData _MyStepData; - public StepData MyStepData - { - get { return _MyStepData; } - set { _MyStepData = value; } - } - private ItemInfo _MyItemInfo; - private int _ExpandPrefix = 0; - public int ExpandPrefix - { - get { return _ExpandPrefix; } - set { _ExpandPrefix = value; } - } - private bool _Colapsing = false; - /// - /// Gets or sets colapsing - /// - public bool Colapsing - { - get { return _Colapsing; } - set { _Colapsing = value; } - } - private bool _Moving = false; - private int _RNOLevel = 0; - private int _SeqLevel = 0; - private int _ContentType; - public int ContentType - { - get { return _ContentType; } - set { _ContentType = value; } - } - private bool _Circle = false; - private bool _CheckOff = false; - private bool _UserCheckOff = false; - private bool _ChangeBar = false; - private StepPanel _MyStepPanel; - public StepPanel MyStepPanel - { - get { return _MyStepPanel; } - set { _MyStepPanel = value; } - } - - private DisplayTags _MyStepPropertiesPanel; - public DisplayTags MyStepPropertiesPanel // gives us access to the Step Properties panel - used with shortcut keystrokes - { - get { return _MyStepPropertiesPanel; } - set { _MyStepPropertiesPanel = value; } - } - - /// - /// This returns the section or procedure for the current item. - /// If the item is a step or section, it returns the section - /// If it is a procedure, it returns the procedure - /// - public EditItem MySectionRTBItem - { - get - { - if (_MySectionRTBItem == null) - { - if (MyItemInfo.IsSection || MyItemInfo.IsProcedure) _MySectionRTBItem = (RTBItem)this; - else _MySectionRTBItem = MyParent.MySectionRTBItem; - } - return _MySectionRTBItem; - } - set { _MySectionRTBItem = value; } - } - /// - /// Gets or Sets ItemInfo - /// - public ItemInfo MyItemInfo - { - get - { - ToolTipOnOff(); //B2025-050 Show the tooltip based on User Options Settings - return _MyItemInfo; - } - set - { - _MyItemInfo = value; - SetToolTip(_MyItemInfo.ToolTip); // B2025-050 always set tooltip text. This method will also show the tooltip based on User Options Settings - ChangeBar = _MyItemInfo.HasChangeBar; - CheckOff co = _MyItemInfo.GetCheckOffStep(); - if (co != null && co.UIMark != null) - { - UserCheckOff = true; - UserCheckOffChar = (char)co.UIMark; - } - // Deal with changes in content data - value.MyContent.Changed -= new ContentInfoEvent(MyContent_Changed); - value.MyContent.Changed += new ContentInfoEvent(MyContent_Changed); - value.MyProcedure.MyContent.Changed -= new ContentInfoEvent(MyContent_Changed); - value.MyProcedure.MyContent.Changed += new ContentInfoEvent(MyContent_Changed); - // Deal with change in item data - value.Changed -= new ItemInfoEvent(value_Changed); - value.Changed += new ItemInfoEvent(value_Changed); - value.OrdinalChanged -= new ItemInfoEvent(value_OrdinalChanged); - value.OrdinalChanged += new ItemInfoEvent(value_OrdinalChanged); - // do something like this to draw circle around step numbers - note got NULL reference error on NSP data - //if (value.FormatStepData != null && value.FormatStepData.TabData.IdentPrint.Contains("C0")) Circle = true; - } - } - private bool _ChangeBarForConfigItemChange = true; - - public bool ChangeBarForConfigItemChange - { - get { return _ChangeBarForConfigItemChange; } - set { _ChangeBarForConfigItemChange = value; } - } - - void value_Changed(object sender) - { - ChangeBar = _MyItemInfo.HasChangeBar; - } - protected void MyContent_Changed(object sender) - { - //C2026-021 Expand Functionality of Viewing Mode - if (MyStepPanel.ApplDisplayMode > 0) - { - MyItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave = MyStepPanel.ApplDisplayMode; - MyItemInfo.MyProcedure.ProcedureConfig.SelectedSlave = MyStepPanel.ApplDisplayMode; - } - else - { - MyItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave = 0; - MyItemInfo.MyProcedure.ProcedureConfig.SelectedSlave = 0; - } - - MyItemInfo.MyProcedure.ResetChangeBar(); - - // Update the text to reflect the content change - MyItemInfo.RefreshItemAnnotations(); - ChangeBar = MyItemInfo.HasChangeBar; - CheckOff co = _MyItemInfo.GetCheckOffStep(); - if (co != null && co.UIMark != null) - { - UserCheckOff = true; - UserCheckOffChar = (char)co.UIMark; - } - else - UserCheckOff = false; - RefreshContent(); - - // see if change in subsections to be displayed, i.e. if the user made a change to editable data - // on the section properties form, we may have to display steps or remove steps. By design, - // steps are the first children from a section. Also, this will only occur if the format has - // metasections AND there are subsections. - if (MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections - && MyItemInfo.Sections != null && MyItemInfo.Sections.Count > 0) - { - // find out what the editable flag is to determine if change. - bool showSteps = MyItemInfo.MyConfig is SectionConfig && (MyItemInfo.MyConfig as SectionConfig).SubSection_Edit == "Y"; - if (showSteps && _MyAfterEditItems != null && _MyAfterEditItems.Count > 0 && _MyAfterEditItems[0].MyItemInfo.IsSection) - { - // need to add steps in, i.e. they do not exist in step editor yet. - _MyAfterEditItems[0].AddSiblingBeforeNoDataSave(MyItemInfo.Steps, false); - } - else if (!showSteps && _MyAfterEditItems != null && _MyAfterEditItems.Count > 0 && _MyAfterEditItems[0].MyItemInfo.IsStep) - { - // Remove steps - only want sections. Put in a list for removal. - List remEIs = new List(); - foreach (EditItem ei in _MyAfterEditItems) - { - if (!ei.MyItemInfo.IsSection) remEIs.Add(ei); - } - foreach (EditItem ei1 in remEIs) - { - ei1.RemoveItemWithoutDelete(); - } - remEIs.Clear(); - } - } - } - void value_OrdinalChanged(object sender) - { - RefreshOrdinal(); - } - public EditItem ActiveParent - { - get { return _MyParentEditItem != null ? _MyParentEditItem : _MyPreviousEditItem?.ActiveParent; } - } - /// - /// Return the Parent EditItem - /// - private EditItem UpOneEditItem - { - get - { - EditItem tmp = this; - while (tmp != null && tmp.MyParentEditItem == null) tmp = tmp.MyPreviousEditItem; - if (tmp != null) return tmp.MyParentEditItem; - return null; - } - } - private Stack _LastMethods = new Stack(); - //private string _LastMethod = ""; - internal void LastMethodsPush(string str) - { - if (MyStepPanel != null) MyStepPanel._LastAdjust = str; - _LastMethods.Push(str); - } - internal string LastMethodsPop() - { - //MyStepPanel._LastAdjust = ""; - return _LastMethods.Pop(); - } - internal bool LastMethodsEmpty - { - get { return _LastMethods.Count == 0; } - } - // This should find the item that precedes the current item vertically in the supplemental information column - // and then return the Bottom of that item. - // It is used so that an edit item does not overlap in 'y-direction' any preceding items. - internal int? FindTopSupInfo(bool useSuppInfoColBottom) - { - if (MyParentEditItem == null) return null; - // on supplemental info item: parent is item in left column. - // return null if parent does not have previous siblings or parents that have supp info. FindPreviousOrParentSupInfo looks above to - // items that have supinfo. - EditItem prevOrParSupInfo = MyParentEditItem.FindPreviousOrParentSupInfo(); - if (prevOrParSupInfo == null || !prevOrParSupInfo.Visible) - { - // Account for Expanded or collapsed. note that BottomMostEditItem already accounts for - // whether it is expanded or collapsed. - if (MyParentEditItem.MyPreviousEditItem != null) return MyParentEditItem.MyPreviousEditItem.BottomMostEditItem.Bottom; - if (MyParentEditItem.MyBeforeEditItems != null) return MyParentEditItem.MyBeforeEditItems[MyParentEditItem.MyBeforeEditItems.Count - 1].BottomMostEditItem.Bottom; - return (MySectionRTBItem == null) ? 0 : MySectionRTBItem.Bottom; - } - int b1 = prevOrParSupInfo.BottomMostEditItem.Bottom; - int b2 = b1; - if (prevOrParSupInfo.MyParentEditItem.MyItemInfo.StepLevel > MyParentEditItem.MyItemInfo.StepLevel) - b2 = prevOrParSupInfo.MyParentEditItem.LastSiblingEditItem.BottomMostEditItem.Bottom; - - // if the current supinfo's parent (proc step) is same as the lastsibling bottom most, don't use its value - it puts the next step - // down too far: - if (this.MyParentEditItem.MyID == prevOrParSupInfo.MyParentEditItem.LastSiblingEditItem.BottomMostEditItem.MyID) b2 = b1; - // if not in the same HLS, don't use the lastsibling either: - if (this.MyParentEditItem.MyItemInfo.MyHLS.ItemID != prevOrParSupInfo.MyParentEditItem.LastSiblingEditItem.MyItemInfo.MyHLS.ItemID) b2 = b1; - if (useSuppInfoColBottom) - return b1; - else - return Math.Max(b1, b2); // look at both supinfo & parent column to determine bottom - } - // This goes up edititems, looking for the closest in 'y-direction' of any supplemental info items. - EditItem FindPreviousOrParentSupInfo() // current edit item is parent of supplmental info item - { - EditItem prev = this; - // First see if there are any Cautions or Notes before me that have supinfo: - EditItem lastBefore = prev.FindLastBeforeWithSupInfo(); - if (lastBefore != null) return lastBefore.MySupInfoEditItems[0]; - - // There were no Cautions/Notes before me with supinfo, now see if there are previous items with supinfo: - while (prev.MyPreviousEditItem != null) - { - prev = prev.MyPreviousEditItem; - EditItem eiTmp = prev.FindLastSubstepWithSupInfo(); - // check for MySupInfoEditItems as null because the FindLastSubstepWithSupInfo checks for data, but the supinfo step may - // not be displayed yet, i.e. the eiTmp.MySupInfoEditItems has an edititem defined only it if is displayed. - if (eiTmp != null && eiTmp.MySupInfoEditItems != null) return eiTmp.MySupInfoEditItems[0]; - } - // No previous items had supinfo, look up to the parent. But if on first before, i.e. first caution or note, there is nothing before (just the section) - if (prev.MyParentEditItem.MyBeforeEditItems != null && prev.MyParentEditItem.MyBeforeEditItems.Count > 0 && prev.MyParentEditItem.MyBeforeEditItems[0] == prev) - { - EditItem eitmp = null; - // if on a Note/Caution, need to be sure there isn't a step before me with supinfo (don't just assume going to Section) - if (prev.MyParentEditItem.MyPreviousEditItem != null) eitmp = prev.MyParentEditItem.MyPreviousEditItem.BottomMostEditItem.FindPreviousOrParentSupInfo(); - return eitmp; - } - if (prev.MyParentEditItem.MySupInfoEditItems != null) return prev.MyParentEditItem.MySupInfoEditItems[0]; - if (prev.MyItemInfo.IsSection) return null; - return prev.MyParentEditItem.FindPreviousOrParentSupInfo(); - } - private EditItem FindLastBeforeWithSupInfo() - { - if (MyBeforeEditItems == null || MyBeforeEditItems.Count == 0) return null; - - for (int i = MyBeforeEditItems.Count - 1; i > -1; i--) - { - // Need to look at caution/note (mybeforeedititems) if they have substeps that have supinfo - if (MyBeforeEditItems[i].MySupInfoEditItems != null && MyBeforeEditItems[i].MySupInfoEditItems.Count > 0) return MyBeforeEditItems[i]; - } - return null; - } - // The next 2 methods, FindLastSubstepWithSupInfo, FindLastItemWithSupInfo: - // for the current item, get to its bottommost supplemental info, if any steps/substeps have it. - // - private EditItem FindLastSubstepWithSupInfo() - { - ItemInfo ii = FindLastItemWithSupInfo(MyItemInfo); - if (ii == null) return null; - return GetEditItemFromItemID(ii.ItemID); - } - private ItemInfo FindLastItemWithSupInfo(ItemInfo stp) - { - // first check substeps (& their substeps) of item passed in. - if (stp.Steps != null && stp.Steps.Count > 0) - { - for (int i = stp.Steps.Count - 1; i > -1; i--) - { - ItemInfo tmp = FindLastItemWithSupInfo(stp.Steps[i]); - if (tmp != null) return tmp; - } - } - //now check the step that was passed in. - if (stp.SupInfos != null && stp.SupInfos.Count > 0) return stp; - if (stp.Notes != null && stp.Notes.Count > 0) - { - for (int j = stp.Notes.Count - 1; j > -1; j--) - { - if (stp.Notes[j].SupInfos != null && stp.Notes[j].SupInfos.Count > 0) return stp.Notes[j]; - } - } - if (stp.Cautions != null && stp.Cautions.Count > 0) - { - for (int j = stp.Cautions.Count - 1; j > -1; j--) - { - if (stp.Cautions[j].SupInfos != null && stp.Cautions[j].SupInfos.Count > 0) return stp.Cautions[j]; - } - } - return null; - } - /// - /// This should find the item that precedes the current item vertically - /// and then return the Bottom of that item. - /// - /// - internal int FindTop(int bottom, bool test1) - { - // if on a supplemental info, use special code to find what steps are above the supplemental info - if (MyItemInfo.MyDocStyle != null && MyItemInfo.MyDocStyle.SupplementalInformation) - { - if (MyItemInfo.IsSupInfoPart) - { - int? tmptop = FindTopSupInfo(test1); - return tmptop == null ? bottom : Math.Max(bottom, (int)tmptop); - } - } - int lastBottomPrev = bottom; // This is necessary if the value of bottom can be negative. - if (_MyPreviousEditItem != null) - lastBottomPrev = _MyPreviousEditItem.BottomMostEditItem.Bottom; - int? bottomRNO = BottomOfParentRNO(); - if (lastBottomPrev > bottom) bottom = (int)(lastBottomPrev); // RHM 20090615 ES02 Step8 - // Moving from Step 8 to the Note preceeding step 8 caused the step 9 to be positioned in the wrong place. - //if (lastBottomParent > bottom) bottom = lastBottomParent; - //if (bottomRNO == null) return bottom; - return (int)max(bottomRNO, bottom); - } - internal int FindTop(int bottom) - { - return FindTop(bottom, true); - } - /// - /// The Top of the EditItem - /// - public int ItemTop - { - get { return Top; } - set - { - MyStepPanel.ItemMoving++; - Top = value; - MyStepPanel.ItemMoving--; - } - } - private E_ChangeBarPosition _ChangeBarPosition = E_ChangeBarPosition.Right; - public E_ChangeBarPosition ChangeBarPosition - { - get { return _ChangeBarPosition; } - set { _ChangeBarPosition = value; } - } - /// - /// Sets the next item and adjusts the location, - /// This also sets the previous for the "next" item - /// which adjusts other locations. - /// - public EditItem MyNextEditItem - { - get { return _MyNextEditItem; } - set - { - _MyNextEditItem = value; - if (_MyNextEditItem != null) - { - if (_MyNextEditItem.MyPreviousEditItem != this) - { - _MyNextEditItem.MyPreviousEditItem = this; - MyNextEditItem.Location = new Point(Left, Bottom); - } - } - } - } - /// - /// returns the TopMostChild - /// - public EditItem TopMostEditItem - { - get - { - if (Expanded && _MyBeforeEditItems != null) return _MyBeforeEditItems[0].TopMostEditItem; - return this; - } - } - /// - /// Returns the bottom location (Top + Height) - /// - public new int Bottom - { - get - { - return Top + (Hidden ? 0 : Height); - } - } - private bool _Hidden = false; - public bool Hidden - { - get { return _Hidden; } - set { _Hidden = value; Visible = !value; } - } - /// - /// Bottom most child - /// - public EditItem BottomMostEditItem - { - get - { - EditItem tmpr = null; // BottomMost RNO - //int rnoOffset = 0; - if ((MyExpandingStatus != ExpandingStatus.No || Expanded) && _MyRNOEditItems != null) - { - //rnoOffset = this.Top - _MyRNOEditItems[0].Top; - tmpr = _MyRNOEditItems[_MyRNOEditItems.Count - 1].BottomMostEditItem; - } - EditItem tmpa = this; // BottomMost After - if ((MyExpandingStatus != ExpandingStatus.No || Expanded) & _MyAfterEditItems != null) - tmpa = _MyAfterEditItems[_MyAfterEditItems.Count - 1].BottomMostEditItem; - // return the bottom most of the two results - if (tmpr == null) - return tmpa; - //if (rnoOffset > 0) - //Console.WriteLine("RNO Bottom Offset {0}", rnoOffset); - //if (tmpa.Bottom >= (tmpr.Bottom + rnoOffset)) - if (tmpa.Bottom >= (tmpr.Bottom)) - return tmpa; - return tmpr; - } - } - /// - /// Bottom most child excluding RNOs - /// - public EditItem BottomMostEditItemNoRNOs - { - get - { - EditItem tmpa = this; // BottomMost After - if ((MyExpandingStatus != ExpandingStatus.No || Expanded) & _MyAfterEditItems != null) - tmpa = _MyAfterEditItems[_MyAfterEditItems.Count - 1].BottomMostEditItem; - // return the bottom most - return tmpa; - } - } - /// - /// First sibling - /// - private EditItem FirstSiblingEditItem - { - get - { - EditItem tmp = this; - while (tmp.MyPreviousEditItem != null) - tmp = tmp.MyPreviousEditItem; - return tmp; - } - } - /// - /// Last sibling - /// - private EditItem LastSiblingEditItem - { - get - { - EditItem tmp = this; - while (tmp.MyNextEditItem != null) - tmp = tmp.MyNextEditItem; - return tmp; - } - } - private ExpandingStatus _MyExpandingStatus = ExpandingStatus.No; - /// - /// Sets or Gets expanding status - /// - public ExpandingStatus MyExpandingStatus - { - get { return _MyExpandingStatus; } - set { _MyExpandingStatus = value; } - } - /// - /// Gets the ItemID from the ItemInfo - /// - public int MyID - { - get { return _MyItemInfo == null ? 0 : _MyItemInfo.ItemID; } - } - /// - /// Tracks when a EditItem is moving - /// - public bool Moving - { - get { return _Moving; } - set { _Moving = value; } - } - /// - /// The RNO (Contingency) Level - /// - public int RNOLevel - { - get { return _RNOLevel; } - set { _RNOLevel = value; } - } - /// - /// Sequential Level - Only counts levels of Sequential substeps - /// - public int SeqLevel - { - get { return _SeqLevel; } - set { _SeqLevel = value; } - } - // TODO: This should be changed to get the Circle format from the data - /// - /// Show a circle or not - /// - public bool Circle - { - get { return _Circle; } - set { _Circle = value; } - } - // TODO: This should be changed to get the Checkoff status from the data - /// - /// Has a check-off or not - /// - public bool CheckOff - { - get { return _CheckOff; } - set { _CheckOff = value; } - } - public bool UserCheckOff - { - get { return _UserCheckOff; } - set { _UserCheckOff = value; } - } - private char _UserCheckOffChar; - public char UserCheckOffChar - { - get { return _UserCheckOffChar; } - set { _UserCheckOffChar = value; } - } - // TODO: This should be changed to get the ChangeBar status from the data - /// - /// Has a changebar or not - /// - public bool ChangeBar - { - get { return _ChangeBar; } - set - { - _ChangeBar = value; - this.Invalidate(); - } - } - #endregion // Properties - #region AddItem - /// - /// Adds an item to a list - /// - /// Parent Container - /// EditItem List - public void AddItem(EditItem parentEditItem, ref List siblingEditItems, EditItem nextEditItem, bool addFirstChld) - { - if (siblingEditItems == null) // Create a list of siblings - { - siblingEditItems = new List(); - siblingEditItems.Add(this); - MyParentEditItem = parentEditItem; - } - else // Add to the existing list - { - // add first child, when there are other children already there. This is used - // for metasection editable data changed from off to on so that the first step is located - // in the editor correctly, i.e. right below the section & above the subsections. - if (addFirstChld) - { - EditItem parent = siblingEditItems[0].MyParentEditItem; - siblingEditItems.Insert(0, this); - MyStepPanel.ItemMoving++; - _MyNextEditItem = siblingEditItems[1]; - _MyNextEditItem._MyPreviousEditItem = this; - MyPreviousEditItem = null; - _MyNextEditItem.MyParentEditItem = null; - MyParentEditItem = parent; - MyStepPanel.ItemMoving--; - } - else if (nextEditItem == null) // Add to the end of the list - { - EditItem lastChild = LastChild(siblingEditItems); - siblingEditItems.Add(this); - MyPreviousEditItem = lastChild; - // RHM - The following line was remove for Facing Pages (Supplemental Information) - // ******************************************************************************* - // When MyPreviousEditItem is set, the location and size is set as a side-effect. - // When MyParentEditItem is set, the location and size is set as a side effect. - // Only Previous or Parent should be set, no both. - // ******************************************************************************* - //MyParentEditItem = MyPreviousEditItem.MyParentEditItem; // Farley - part of bug fix B2015-123 alignment of tabs on the edit screen - } - else // Add to the middle of the list before a particular item - { - EditItem prevChild = nextEditItem.MyPreviousEditItem; - EditItem parent = nextEditItem.MyParentEditItem; - if (siblingEditItems.Contains(nextEditItem)) - siblingEditItems.Insert(siblingEditItems.IndexOf(nextEditItem), this); - else - siblingEditItems.Insert(0, this); - MyStepPanel.ItemMoving++; - _MyNextEditItem = nextEditItem; - if (!MyItemInfo.IsNote || !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format || MyPreviousEditItem == null) - nextEditItem._MyPreviousEditItem = this; - MyPreviousEditItem = prevChild;// If a previous exists - this will adjust the location and width of the EditItem - if (MyItemInfo.IsNote && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && MyPreviousEditItem != null) - nextEditItem.MyPreviousEditItem = this;//Position First Note in Dev Doc Format - if (!MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format || !(nextEditItem.MyItemInfo.IsNote && MyItemInfo.IsCaution)) - { - // RHM 20170216 For Deviation Document don't set MyParentEditItem to null when Type Changes from Caution to Note - nextEditItem.MyParentEditItem = null; - MyParentEditItem = parent; // If a parent exists - this will adjust the location and width of the EditItem - AdjustForDevDocStepHeight(); - } - //nextEditItem.MyPreviousEditItem = this; - MyStepPanel.ItemMoving--; - } - } - if (MyItemInfo.IsCaution || MyItemInfo.IsNote) - { - EditItem prev = this; - while (prev.MyPreviousEditItem != null) prev = prev.MyPreviousEditItem; - prev.SetAllTabs(); - } - else - SetAllTabs(); - } - // clear tabs, clears then all so that next 'get' will calculate new. - public void SetAllTabs() - { - RefreshTab(); - - if (_MyAfterEditItems != null) _MyAfterEditItems[0].SetAllTabs(); // B2020-043: used to loop through all, but then recursion would redo. - if (_MyNextEditItem != null) _MyNextEditItem.SetAllTabs(); - // Update the RNO tab if it exists - RHM 20100106 - if (_MyRNOEditItems != null) foreach (EditItem chld in _MyRNOEditItems) chld.SetAllTabs(); - if (_MySupInfoEditItems != null) foreach (EditItem chld in _MySupInfoEditItems) chld.SetAllTabs(); - } - /// - /// Add the next item to a list - /// - /// - /// - /// - //public EditItem AddNext(ItemInfo myItemInfo, bool expand) - //{ - // EditItem tmp = new EditItem(myItemInfo, MyStepPanel, MyParentEditItem, ChildRelation.None, expand); - // MyNextEditItem = tmp; - // return tmp; - //} - #endregion - #region RemoveItem - protected void ShowTops(string title) - { - int TopMostY = TopMostEditItem.Top; - int? TopMostParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.TopMostEditItem.Top)); - int? ParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.Top)); - //Console.Write("{0}: TopMostY={1}, TopMostParentY={2}, ParentY = {3}",title, TopMostY, TopMostParentY, ParentY); - Console.Write("{0}{1},{2},{3}", title, TopMostY, TopMostParentY.ToString() ?? "null", ParentY.ToString() ?? "null"); - } - private bool _BeingRemoved = false; - public bool BeingRemoved - { - get { return _BeingRemoved; } - set { _BeingRemoved = value; } - } - public void RemoveItemWithoutDelete() - { - BeingRemoved = true; - int TopMostYBefore = TopMostEditItem.Top; - MyStepPanel._LookupEditItems.Remove(MyID); - EditItem newFocus = null; - int? TopMostParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.TopMostEditItem.Top)); - int? ParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.Top)); - RemoveFromParentsChildList(); - if (MyNextEditItem != null) - { - if (MyPreviousEditItem != null) - { - MyNextEditItem.MyPreviousEditItem = MyPreviousEditItem; - MyPreviousEditItem = null; - newFocus = MyNextEditItem; - } - else - { - MyNextEditItem.MyParentEditItem = MyParentEditItem; - MyParentEditItem = null; - MyNextEditItem.MyPreviousEditItem = null; - newFocus = MyNextEditItem; - } - // Adjust the vertical locations of all of the items below the item deleted - MyNextEditItem.TopMostEditItem.AdjustLocation(); - MyNextEditItem = null; - } - else if (MyPreviousEditItem != null) - { - MyPreviousEditItem.MyNextEditItem = null; - newFocus = MyPreviousEditItem.BottomMostEditItem; - MyPreviousEditItem = null; - } - else - { - newFocus = MyParentEditItem; - MyParentEditItem = null; - } - Dispose(); - if (newFocus != null) - { - newFocus.SetFocus(); - newFocus.SetAllTabs(); - newFocus.AdjustLocation(); - } - } - private static int xOffset = 0; - public void RemoveItem() - { - // if this item has enhanced edititems, remove them: - StepConfig sc = MyItemInfo.MyConfig as StepConfig; - List thisEnhs = null; - if (sc != null) - thisEnhs = sc.MyEnhancedDocuments; - else - { - if (MyItemInfo.IsSection) - { - SectionConfig secc = MyItemInfo.MyConfig as SectionConfig; - if (secc.Section_LnkEnh == "Y") thisEnhs = secc.MyEnhancedDocuments; - } - } - - List enhIds = new List(); - if (thisEnhs != null) - { - foreach (EnhancedDocument ed in thisEnhs) - { - if (ed.Type != 0) enhIds.Add(ed.ItemID); - } - } - BeingRemoved = true; - EditItem tmpSelEI = MyStepPanel.SelectedEditItem; // B2021-002: if can't remove, reset SelectedEditItem - MyStepPanel.SelectedEditItem = null; // Unselect the item to be deleted - //ShowTops("\r\n"); - int TopMostYBefore = TopMostEditItem.Top; - //_MyTimer.ActiveProcess = "DeleteItem"; - // Add a Panel temporarily so that AutoScroll will not happen during the delete. - Panel pnl = new Panel(); - pnl.Size = new Size(10, 10); - MyStepPanel.Controls.Add(pnl); - pnl.BackColor = Color.Red; - pnl.Location = new Point(xOffset += 15, MyStepPanel.ClientSize.Height + 10); - EditItem newFocus = DeleteItem(); - if (newFocus == null) - { - MyStepPanel.Controls.Remove(pnl); - MyStepPanel.SelectedEditItem = tmpSelEI; // B2021-002: if can't remove, reset SelectedEditItem - return; - } - //_MyTimer.ActiveProcess = "SetFocus"; - - int b4topadjust = newFocus.Top; - newFocus.SetFocus(); //shifts edititem to center it - // need to adjust the TopMostYBefore so that it accounts for any shifting that occurred when the - // SetFocus was called. This fixes B2016-040. - b4topadjust -= newFocus.Top; - TopMostYBefore -= b4topadjust; - - //B2024-075: If Deleting an item in a Source Document that is unlinked - //and the overall procedure has connected Background Documents - //and a window is open containing the background documents - //then need to force a refresh on that window as - //step numbering will shift - EnhancedDocuments ProcEnh = MyItemInfo.MyProcedure.GetMyEnhancedDocuments(); - if (ProcEnh.Count > 0) - { - DisplayTabItem wndowToRefresh = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyBar.Items.Cast().FirstOrDefault(x => x.MyKey == $"Item - {ProcEnh[0].ItemID}"); - wndowToRefresh?.MyStepTabPanel.MyStepPanel.Reset(wndowToRefresh.MyItemInfo); - } - - //_MyTimer.ActiveProcess = "Dispose"; - Dispose(); - //_MyTimer.ActiveProcess = "SetAllTabs"; - newFocus.SetAllTabs(); - //_MyTimer.ActiveProcess = "TopMostYAfter"; - int TopMostYAfter = newFocus.TopMostEditItem.Top; - if (TopMostYAfter > TopMostYBefore) - newFocus.TopMostEditItem.Top = TopMostYBefore; - //_MyTimer.ActiveProcess = "AdjustLocation"; - newFocus.AdjustLocation(); - //newFocus.ShowTops(""); - //_MyTimer.ShowElapsedTimes("RemoveItem"); - ForceEditItemRefresh(newFocus); - MyStepPanel.Controls.Remove(pnl); - foreach (int enhId in enhIds) - { - ItemInfo ii = ItemInfo.Get(enhId); - bool success = this._MyStepPanel.MyStepTabPanel.MyDisplayTabControl.DeleteRTBItem(ii); - if (!success) - Item.DeleteItemAndChildren(ii); - } - if (MyItemInfo.MyDocStyle != null && MyItemInfo.MyDocStyle.SupplementalInformation) - { - if (newFocus.MyItemInfo.IsInSupInfo) - newFocus.AdjustAllForSupInfoHeight(); - else - { - EditItem prvOrParSupInfo = newFocus.FindPreviousOrParentSupInfo(); - if (prvOrParSupInfo != null) prvOrParSupInfo.AdjustAllForSupInfoHeight(); - } - } - } - - private static void ForceEditItemRefresh(EditItem newFocus) - { - // bug fix - // need to force a refresh from the level above the step that was removed. - // this fixes a problem where the following step/substep wasn't shown on the screen (but was there) - // and fixes a problem where the sequence numbers were off by one - // and fixes a problem where an edit window would end up on top of the ones above it - EditItem ei = newFocus; - while (ei.MyPreviousEditItem != null) ei = ei.MyPreviousEditItem; - if (ei.MyParentEditItem != null && ei.MyParentEditItem.MyItemInfo.IsStep) - ei.MyParentEditItem.Expand(true); - } - public EditItem DeleteItem() - { - //Volian.Base.Library.VlnTimer _MyTimer = new VlnTimer(); - //_MyTimer.ActiveProcess = "_LookupEditItems.Remove"; - MyStepPanel._LookupEditItems.Remove(MyID); - EditItem newFocus = null; - int? TopMostParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.TopMostEditItem.Top)); - int? ParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.Top)); - try - { - //_MyTimer.ActiveProcess = "DeleteItemAndChildren"; - Item.DeleteItemAndChildren(MyItemInfo); - } - catch (System.Data.SqlClient.SqlException ex) - { - HandleSqlExceptionOnDelete(ex); - return null; - } - // B2017-159: Don't allow paste if this deleted item is in paste buffer: - if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyCopyStep != null && MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID) - { - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyCopyStep = null; - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetPasteButtons(false); - } - - // Remove EditItems - //_MyTimer.ActiveProcess = "RemoveFromParentsChildList"; - RemoveFromParentsChildList(); - //_MyTimer.ActiveProcess = "MyNextEditItem"; - if (MyNextEditItem != null) - { - if (MyPreviousEditItem != null) - { - MyNextEditItem.MyPreviousEditItem = MyPreviousEditItem; - MyPreviousEditItem = null; - newFocus = MyNextEditItem; - } - else - { - MyNextEditItem.MyParentEditItem = MyParentEditItem; - MyParentEditItem = null; - MyNextEditItem.MyPreviousEditItem = null; - newFocus = MyNextEditItem; - } - // Adjust the vertical locations of all of the items below the item deleted - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && MyNextEditItem.MyPreviousEditItem == null && - (MyNextEditItem.MyItemInfo.IsNote || MyNextEditItem.MyItemInfo.IsCaution)) - { - MyNextEditItem.MyParentEditItem.Top = (MyNextEditItem.MyParentEditItem.MyPreviousEditItem != null ? - MyNextEditItem.MyParentEditItem.MyPreviousEditItem.FindBottomDevDoc : MyNextEditItem.MyParentEditItem.MyParentEditItem.Bottom); - MyNextEditItem.Top = MyNextEditItem.MyParentEditItem.Top; - MyNextEditItem.AdjustLocation(); - } - else - { - MyNextEditItem.TopMostEditItem.AdjustLocation(); - } - MyNextEditItem = null; - } - else if (MyPreviousEditItem != null) - { - MyPreviousEditItem.MyNextEditItem = null; - //newFocus = MyPreviousEditItem.BottomMostEditItem; - // bug fix - when deleting an edit window in the AER, position to the bottom most in the AER - was jumping to RNO - newFocus = MyPreviousEditItem.BottomMostEditItemNoRNOs; - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && MyPreviousEditItem.MyNextEditItem == null && - (MyPreviousEditItem.MyItemInfo.IsNote || MyPreviousEditItem.MyItemInfo.IsCaution)) - { - MyPreviousEditItem.MyParent.Top = MyPreviousEditItem.MyParent.MyPreviousEditItem.FindBottomDevDoc; - MyPreviousEditItem.Top = MyPreviousEditItem.MyParent.Top; - MyPreviousEditItem.MyParent.AdjustLocation(); - } - MyPreviousEditItem = null; - //Console.Write(",\"Previous\","); - } - else - { - newFocus = MyParentEditItem; - MyParentEditItem = null; - //Console.Write(",\"Parent\","); - } - //_MyTimer.ShowElapsedTimes("DeleteItem"); - if (newFocus != null) // B2020-043: Fix transition text when previous text is deleted - { - newFocus.SetAllTabs(); - newFocus.MyItemInfo.UpdateTransitionText(); - } - return newFocus; - } - - //private void HandleSqlExceptionOnDelete(System.Data.SqlClient.SqlException ex) - private void HandleSqlExceptionOnDelete(Exception ex) - { - // C2020-018 made the messaging consistent in the message boxes - // C2020-033: Expand/fill in the Search/Incoming Transition panel. Also, the dialog message was changed - // to give message to view panel and eliminate list in the dialog. This is done for each of cases. - if (ex.Message.Contains("has External Transitions and has no next step")) - { - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnSearchIncTrans(this, new vlnTreeItemInfoEventArgs(MyStepRTB.MyItemInfo)); - using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(MyID)) // B2020-109: look at substeps too - { - DialogResult ans = FlexibleMessageBox.Show("Transitions exist to this step and cannot be adjusted automatically." + - "\r\n\r\nThe list of all locations are shown in the Tools/Search/Incoming Transitions tab.", - "Cannot Delete This Step", MessageBoxButtons.OK, MessageBoxIcon.Information); - SetFocus(); - } - } - else if (ex.Message.Contains("has External Transitions to Procedure")) - { - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnSearchIncTrans(this, new vlnTreeItemInfoEventArgs(MyStepRTB.MyItemInfo)); - using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(MyID)) - { - DialogResult ans = FlexibleMessageBox.Show("Transitions exist to this procedure." + - "\r\n\r\nThe list of all locations are shown in the Tools/Search/Incoming Transitions tab.", - "Cannot Delete This Procedure", MessageBoxButtons.OK, MessageBoxIcon.Information); - SetFocus(); - } - } - // B2020-097: If deleting a section that has transitions pointing to it, show list: - // B2020-098: If deleting a section that has transitions & select to remove 1st transition, crash on trying to delete section again - else if (ex.Message.Contains("has External Transitions to Section")) - { - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnSearchIncTrans(this, new vlnTreeItemInfoEventArgs(MyStepRTB.MyItemInfo)); - using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(MyID)) - { - DialogResult ans = FlexibleMessageBox.Show("Transitions exist to this section and cannot be adjusted automatically." + - "\r\n\r\nThe list of all locations are shown in the Tools/Search/Incoming Transitions tab.", - "Cannot Delete This Section", MessageBoxButtons.OK, MessageBoxIcon.Information); - MyStepPanel.SelectedEditItem = this; - } - } - else if (ex.Message.Contains("has External Transitions to it's children")) - { - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnSearchIncTrans(this, new vlnTreeItemInfoEventArgs(MyStepRTB.MyItemInfo)); - using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(MyID)) - { - DialogResult ans = FlexibleMessageBox.Show("Transitions exist to the substeps of this step and cannot be adjusted automatically." + - "\r\n\r\nThe list of all locations are shown in the Tools/Search/Incoming Transitions tab.", - "Cannot Delete This Step", MessageBoxButtons.OK, MessageBoxIcon.Information); - SetFocus(); - } - } - else - FlexibleMessageBox.Show(ex.Message, "SQL Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - } - private void RemoveFromParentsChildList() - { - EditItem top = this; - while (top.MyPreviousEditItem != null) top = top.MyPreviousEditItem; - EditItem parentEditItem = top.MyParentEditItem; - if (parentEditItem == null) return; // No parent, nothing to remove. - if (parentEditItem.MyAfterEditItems != null && parentEditItem.MyAfterEditItems.Contains(this)) - { - parentEditItem.MyAfterEditItems.Remove(this); - if (parentEditItem.MyAfterEditItems.Count == 0) - parentEditItem.MyAfterEditItems = null; - } - else if (parentEditItem.MyBeforeEditItems != null && parentEditItem.MyBeforeEditItems.Contains(this)) - { - parentEditItem.MyBeforeEditItems.Remove(this); - if (parentEditItem.MyBeforeEditItems.Count == 0) - parentEditItem.MyBeforeEditItems = null; - } - else if (parentEditItem.MyRNOEditItems != null && parentEditItem.MyRNOEditItems.Contains(this)) - { - parentEditItem.MyRNOEditItems.Remove(this); - if (parentEditItem.MyRNOEditItems.Count == 0) - parentEditItem.MyRNOEditItems = null; - } - else if (parentEditItem.MySupInfoEditItems != null && parentEditItem.MySupInfoEditItems.Contains(this)) - { - parentEditItem.MySupInfoEditItems.Remove(this); - if (parentEditItem.MySupInfoEditItems.Count == 0) - parentEditItem.MySupInfoEditItems = null; - } - if (parentEditItem.MyAfterEditItems == null && parentEditItem.MyBeforeEditItems == null && parentEditItem.MyRNOEditItems == null) - parentEditItem.CanExpand = false; - } - //private void ShowSiblings(string title) - //{ - // Console.WriteLine("---{0} {1}---",title,MyID); - // EditItem top = this; - // while (top.MyPreviousEditItem != null) top = top.MyPreviousEditItem; - // do - // { - // Console.WriteLine("{0} EditItem - {1} {2}", top.MyID == MyID ? "*" : " ", top.MyID, top.MyItemInfo.MyContent.Text); - // top = top.MyNextEditItem; - // } while (top != null); - //} - #endregion - #region Add Children - /// - /// Add a child before (Notes, Cautions, etc.) - /// - /// - /// - public void AddChildBefore(ItemInfo myItemInfo, bool expand) - { - EditItem child = new RTBItem(myItemInfo, MyStepPanel, this, ChildRelation.Before, expand); - } - /// - /// Add a list of children before - /// - /// - /// - public void AddChildBefore(ItemInfoList myItemInfoList, bool expand) - { - if (myItemInfoList != null) - foreach (ItemInfo item in myItemInfoList) - AddChildBefore(item, expand); - } - public EditItem AddChildBefore(ItemInfoList myItemInfoList, EditItem nextEditItem) - { - EditItem child = null; - if (myItemInfoList != null) - foreach (ItemInfo item in myItemInfoList) - child = AddChildBefore(item, nextEditItem); - return child; - } - /// - /// Add an RNO (Contingency) child - /// - /// - /// - public void AddChildRNO(ItemInfo myItemInfo, bool expand) - { - EditItem child = new RTBItem(myItemInfo, MyStepPanel, this, ChildRelation.RNO, expand); - } - public void AddChildSupInfo(ItemInfo myItemInfo, bool expand) - { - EditItem child = new RTBItem(myItemInfo, MyStepPanel, this, ChildRelation.SupInfo, expand); - } - /// - /// Add a list of RNO (Contingency) children - /// - /// - /// - public void AddChildRNO(ItemInfoList myItemInfoList, bool expand) - { - if (myItemInfoList != null) - foreach (ItemInfo item in myItemInfoList) - AddChildRNO(item, expand); - } - public void AddChildSupInfo(ItemInfoList myItemInfoList, bool expand) - { - if (myItemInfoList != null) - foreach (ItemInfo item in myItemInfoList) - AddChildSupInfo(item, expand); - } - /// - /// Add a child after - /// - /// - /// - public EditItem AddChildAfter(ItemInfo MyItemInfo, bool expand, bool addFirstChld) - { - EditItem child = null; - if (MyItemInfo.IsFigure) - child = new ImageItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, expand); - else if (MyItemInfo.IsRtfRaw) - child = new RtfRawItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, expand); - else if (MyItemInfo.MyContent.MyGrid != null) - child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, expand); - else - child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, expand, addFirstChld); - return child; - } - public EditItem AddChildAfter(ItemInfo MyItemInfo, EditItem nextEditItem) - { - EditItem child = null; - if (MyItemInfo.IsFigure) - child = new ImageItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem, FigInsType, _MyStepPropertiesPanel); - else if (MyItemInfo.IsRtfRaw) - child = new RtfRawItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem); - else if (MyItemInfo.MyContent.MyGrid != null) - child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem); - else - child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem); - return child; - } - public EditItem AddChildBefore(ItemInfo MyItemInfo, EditItem nextEditItem) - { - EditItem child = null; - if (MyItemInfo.IsFigure) - child = new ImageItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem, FigInsType, _MyStepPropertiesPanel); - else if (MyItemInfo.IsRtfRaw) - child = new RtfRawItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem); - if (MyItemInfo.MyContent.MyGrid != null) - child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem); - else - child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem); - return child; - } - public EditItem AddChildRNO(ItemInfo MyItemInfo, EditItem nextEditItem) - { - // not sure about this, i.e. whether a grid can be added here. - EditItem child = null; - //if (MyItemInfo.MyContent.ContentGridCount != 0) - if (MyItemInfo.MyContent.MyGrid != null) - child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.RNO, true, nextEditItem); - else - child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.RNO, true, nextEditItem); - return child; - } - public EditItem AddChildSupInfo(ItemInfo MyItemInfo, EditItem nextEditItem) - { - EditItem child = null; - if (MyItemInfo.MyContent.MyGrid != null) - child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.SupInfo, true, nextEditItem); - else - child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.SupInfo, true, nextEditItem); - return child; - } - /// - /// Adds a sibling after the current EditItem - /// - public void AddSiblingAfter() - { - AddSiblingAfter("", true); - } - public void AddSiblingAfter(string text, bool updateStatus) - { - SaveContents(); - ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter(text); - AddGridIfNeeded(newItemInfo); - AddImageIfNeeded(newItemInfo); - DoAddSiblingAfter(newItemInfo, updateStatus); - if (MyStepPanel.SelectedEditItem is RTBItem) - { - RTBItem rtbi = MyStepPanel.SelectedEditItem as RTBItem; - // see if this step has associated enhanced step(s). If it does, flag it so - // that the enhanced steps get inserted also. - StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config); - if (sc.MyEnhancedDocuments.Count > 0) - { - rtbi.EnhAddFromItemInfo = MyItemInfo; - rtbi.EnhAddType = EnhancedAddTypes.After; - } - } - } - // This logic allows us to do an Insert Before and Insert After while on a Table - // if allowed by the format - private void AddGridIfNeeded(ItemInfo newItemInfo) - { - if (this is GridItem) - { - GridItem gi = this as GridItem; - VlnFlexGrid fg = new VlnFlexGrid(gi.MyFlexGrid.Rows.Count, gi.MyFlexGrid.Cols.Count); - // bug fix B2015136 - // need to copy the font used in the table we are doing the Insert Previous/Next from. - VE_Font vefont = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Table.Font; - Font GridFont = new Font(vefont.Family, (float)vefont.Size); - fg.Font = GridFont; - using (Item itm = newItemInfo.Get()) - { - itm.MyContent.MyGrid.Data = fg.GetXMLData(); - itm.Save(); - } - } - } - // This logic allows us to do an Insert Before and Insert After while on a Figure - // if allowed by the format. Note that Before/After for figures is only Clipboard (if - // image data exists in clipboard), or file. Doing RO images will be added later if needed - - // this decision was made because of scope. - // C2019-008 - Check if sibling is a RO image. If so open the step properties panel and select the RO tab so that a RO Image (figure) can be selected. jsj 2019Feb20 - private void AddImageIfNeeded(ItemInfo newItemInfo) - { - if (this is ImageItem) - { - if (MyItemInfo.MyContent.MyImage != null) // C2019-008 this is null if it is a RO Image - ImageItem.AddImageIfNeeded(newItemInfo); // this will use image in windows clipboard or display a file select dialog for an image - else - { - if (MyStepPanel != null && MyStepPanel.MyStepTabPanel != null) - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(null)); // C2019-008 This will open the RO tab on the Step Properties panel - } - } - } - - public void AddSiblingAfter(int? type, bool updateStatus) - { - SaveContents(); - ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter("", "", type); - AddGridIfNeeded(newItemInfo); - AddImageIfNeeded(newItemInfo); - DoAddSiblingAfter(newItemInfo, updateStatus); - if (MyStepPanel.SelectedEditItem is RTBItem) - { - RTBItem rtbi = MyStepPanel.SelectedEditItem as RTBItem; - // see if this step has associated enhanced step(s). If it does, flag it so - // that the enhanced steps get inserted also. - StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config); - if (sc.MyEnhancedDocuments.Count > 0) - { - rtbi.EnhAddFromItemInfo = MyItemInfo; - rtbi.EnhAddType = EnhancedAddTypes.After; - } - } - } - private void DoAddSiblingAfter(ItemInfo newItemInfo, bool updateStatus) - { - EditItem newEditItem = null; - switch (_MyChildRelation) - { - case ChildRelation.After: - newEditItem = ActiveParent.AddChildAfter(newItemInfo, MyNextEditItem); - break; - case ChildRelation.Before: - newEditItem = ActiveParent.AddChildBefore(newItemInfo, MyNextEditItem); - break; - case ChildRelation.RNO: - newEditItem = ActiveParent.AddChildRNO(newItemInfo, MyNextEditItem); - break; - case ChildRelation.SupInfo: - newEditItem = ActiveParent.AddChildSupInfo(newItemInfo, MyNextEditItem); - break; - default: // Need debug - break; - } - //EditItem newEditItem = ActiveParent.AddChildAfter(newItemInfo, ); - if (updateStatus) - MyStepPanel.SelectedEditItem = newEditItem;//Update Screen - } - protected static int _WatchThis = 1; - public void AddSiblingBefore() - { - AddSiblingBefore("", true); - } - public void AddSiblingBefore(int? type, bool updateStatus) - { - SaveContents(); - ItemInfo newItemInfo = MyItemInfo.InsertSiblingBefore("", "", type); - AddGridIfNeeded(newItemInfo); - AddImageIfNeeded(newItemInfo); - DoAddSiblingBefore(newItemInfo, updateStatus); - } - public void AddSiblingBefore(string text, bool updateSelection) - { - // Save RTB text before creating a new item because the process of creating - // a new item will save a change to iteminfo excluding text changes. This - // shouldn't be necessary for adding sibling after because the current step - // doesn't get saved during the insert after because of the MyPrevious field - // is only set on an insert before, which is what saves the item without - // any updates from the richtextbox text. - SaveContents(); - ItemInfo newItemInfo = MyItemInfo.InsertSiblingBefore(text); - AddGridIfNeeded(newItemInfo); - AddImageIfNeeded(newItemInfo); - DoAddSiblingBefore(newItemInfo, updateSelection); - newItemInfo.UpdateTransitionText(); // B2020-043: fix transition text when a step is inserted before - if (MyStepPanel.SelectedEditItem is RTBItem) - { - RTBItem rtbi = MyStepPanel.SelectedEditItem as RTBItem; - // see if this step has associated enhanced step(s). If it does, flag it so - // that the enhanced steps get inserted also. - StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config); - if (sc.MyEnhancedDocuments.Count > 0) - { - rtbi.EnhAddFromItemInfo = MyItemInfo; - rtbi.EnhAddType = EnhancedAddTypes.Before; - } - } - } - public void DoAddSiblingBefore(ItemInfo newItemInfo, bool updateSelection) - { - EditItem newEditItem = null; - switch (_MyChildRelation) - { - case ChildRelation.After: - newEditItem = ActiveParent.AddChildAfter(newItemInfo, this); - break; - case ChildRelation.Before: - newEditItem = ActiveParent.AddChildBefore(newItemInfo, this); - break; - case ChildRelation.RNO: - newEditItem = ActiveParent.AddChildRNO(newItemInfo, this); - break; - case ChildRelation.SupInfo: - newEditItem = ActiveParent.AddChildSupInfo(newItemInfo, this); - break; - default: // Need debug - break; - } - if (updateSelection) - MyStepPanel.SelectedEditItem = newEditItem;//Update Screen - } - public void AddSiblingBeforeNoDataSave(ItemInfo newItemInfo, bool updateSelection, EditItem tt) - { - EditItem newEditItem = null; - newEditItem = ActiveParent.AddChildBefore(newItemInfo, this); - //switch (_MyChildRelation) - //{ - // case ChildRelation.After: - // newEditItem = ActiveParent.AddChildAfter(newItemInfo, this); - // break; - // case ChildRelation.Before: - // newEditItem = ActiveParent.AddChildBefore(newItemInfo, this); - // break; - // case ChildRelation.RNO: - // newEditItem = ActiveParent.AddChildRNO(newItemInfo, this); - // break; - // default: // Need debug - // break; - //} - if (updateSelection) - MyStepPanel.SelectedEditItem = newEditItem;//Update Screen - } - private bool specialAdd = false; - public void AddSiblingBeforeNoDataSave(ItemInfoList newItemInfos, bool updateSelection) - { - specialAdd = true; - EditItem newEditItem = null; - newEditItem = ActiveParent.AddChildAfter(newItemInfos, false, true); - if (updateSelection) - MyStepPanel.SelectedEditItem = newEditItem;//Update Screen - specialAdd = false; - } - private ImageItem.E_ImageSource FigInsType = ImageItem.E_ImageSource.None; - public void AddChild(E_FromType fromType, int type, ImageItem.E_ImageSource newSource) - { - FigInsType = newSource; - AddChild("", fromType, type, null); - FigInsType = ImageItem.E_ImageSource.None; - } - public void AddChild(E_FromType fromType, int type) - { - AddChild("", fromType, type, null); - } - public void AddChild(E_FromType fromType, int type, VlnFlexGrid vfGrid) - { - AddChild("", fromType, type, vfGrid); - } - public void AddChild(string text, E_FromType fromType, int type, VlnFlexGrid vfGrid) - { - if ((_MyItemInfo.IsHigh && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) || _MyItemInfo.IsSection) - CanExpand = true; - this.Expanded = true; - _WatchThis = 1; - ItemInfo newItemInfo = MyItemInfo.InsertChild(fromType, type, text); - if (vfGrid != null) - { - string xml = vfGrid.GetXMLData(); - using (Item itm = newItemInfo.Get()) - { - itm.MyContent.MyGrid.Data = xml; - itm.Save(); - // newItemInfo.MyContent.MyGrid.ResetContent(itm.MyContent.MyGrid); // Do I need this? - } - } - // TODO: We need to determine where this will go in the stack of children - EditItem nextItem = GetNextItem(fromType, newItemInfo); - // TODO: May need similar logic if a Table is being added to a step that has substeps - // else if (fromType == E_FromType.Table && ((ItemInfo)newItemInfo.ActiveParent).Steps != null - //&& ((ItemInfo)newItemInfo.ActiveParent).Steps.Count > 0) - // nextItem = MyStepPanel.FindItem(((ItemInfo)newItemInfo.ActiveParent).Steps[0]); - EditItem newEditItem; - switch (fromType) - { - case E_FromType.Caution: - newEditItem = this.AddChildBefore(newItemInfo, nextItem); - break; - case E_FromType.Note: - newEditItem = this.AddChildBefore(newItemInfo, nextItem); - break; - case E_FromType.Procedure: - newEditItem = this.AddChildAfter(newItemInfo, nextItem); - break; - case E_FromType.RNO: - newEditItem = this.AddChildRNO(newItemInfo, nextItem); - break; - case E_FromType.Section: - newEditItem = this.AddChildAfter(newItemInfo, nextItem); - break; - case E_FromType.Step: - newEditItem = this.AddChildAfter(newItemInfo, nextItem); - break; - case E_FromType.Table: - newEditItem = this.AddChildAfter(newItemInfo, nextItem); - break; - case E_FromType.SupInfo: - newEditItem = this.AddChildSupInfo(newItemInfo, nextItem); - break; - default: - newEditItem = this.AddChildAfter(newItemInfo, nextItem); - break; - } - MyStepPanel.SelectedEditItem = newEditItem;//Update Screen - if (MyStepPanel.SelectedEditItem is RTBItem) - { - RTBItem rtbi = MyStepPanel.SelectedEditItem as RTBItem; - // see if this step has associated enhanced step(s). If it does, flag it so - // that the enhanced steps get inserted also. - EnhancedDocuments cfgeds = null; - if (MyItemInfo.IsStepSection) - { - SectionConfig scfg = MyItemInfo.MyConfig as SectionConfig; - if (scfg.Section_LnkEnh != "Y") return; - cfgeds = scfg.MyEnhancedDocuments; - } - // B2019-017: Add check for caution & note, only add enahnced step for those types. Note that procedure is done from tree and section - // is done from code above. HLS are not added as children, so are not added here. - else if (fromType == E_FromType.Caution || fromType == E_FromType.Note) - { - StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config); - cfgeds = sc.MyEnhancedDocuments; - } - if (cfgeds != null && cfgeds.Count > 0) - { - rtbi.EnhAddFromItemInfo = MyItemInfo; - rtbi.EnhAddType = EnhancedAddTypes.Child; - } - } - } - public EditItem GetNextItem(E_FromType fromType, ItemInfo newItemInfo) - { - EditItem nextItem = null; - if (newItemInfo.NextItem != null) - nextItem = MyStepPanel.FindItem(newItemInfo.NextItem); - else if (fromType == E_FromType.Table && MyAfterEditItems != null) - nextItem = MyAfterEditItems[0]; - // Cautions come before notes, so if this is a Caution and there are Notes, put this first - else if (fromType == E_FromType.Caution && ((ItemInfo)newItemInfo.ActiveParent).Notes != null - && ((ItemInfo)newItemInfo.ActiveParent).Notes.Count > 0) - nextItem = MyStepPanel.FindItem(((ItemInfo)newItemInfo.ActiveParent).Notes[0]); - return nextItem; - } - /// - /// Add a list of children after - /// - /// - /// - public EditItem AddChildAfter(ItemInfoList myItemInfoList, bool expand, bool addFirstChld) - { - EditItem child = null; - int indx = 0; - if (myItemInfoList != null) - foreach (ItemInfo item in myItemInfoList) - { - if (addFirstChld) - { - // the first time add it as first child, the rest should be done in between. - child = AddChildAfter(item, expand, addFirstChld); - addFirstChld = false; - } - else - child = AddChildAfter(item, this._MyAfterEditItems[indx]); - indx++; - } - return child; - } - public EditItem AddChildAfter(ItemInfoList myItemInfoList, bool expand) - { - EditItem child = null; - if (myItemInfoList != null) - foreach (ItemInfo item in myItemInfoList) - child = AddChildAfter(item, expand, false); - return child; - } - public EditItem AddChildAfter(ItemInfoList myItemInfoList, EditItem nextEditItem) - { - EditItem child = null; - if (myItemInfoList != null) - foreach (ItemInfo item in myItemInfoList) - child = AddChildAfter(item, nextEditItem); - return child; - } - #endregion - #region CopyPaste - public void PasteSiblingBefore(int copyStartID) - { - ItemInfo newItemInfo = MyItemInfo.PasteSiblingBefore(copyStartID, GetChangeId(MyItemInfo)); - - if (newItemInfo.ItemID == MyItemInfo.ItemID) return; - - EditItem newEditItem = null; - switch (_MyChildRelation) - { - case ChildRelation.After: - newEditItem = ActiveParent.AddChildAfter(newItemInfo, this); - break; - case ChildRelation.Before: - newEditItem = ActiveParent.AddChildBefore(newItemInfo, this); - break; - case ChildRelation.RNO: - newEditItem = ActiveParent.AddChildRNO(newItemInfo, this); - break; - case ChildRelation.SupInfo: - newEditItem = ActiveParent.AddChildSupInfo(newItemInfo, this); - break; - default: // Need debug - break; - } - if (newEditItem != null) MyStepPanel.SelectedEditItem = newEditItem;//Update Screen - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Before, newItemInfo.MyContent.Type)); - - // MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced. - //if doing a paste before/after and item being copied is unlinked, item pasted should also be unlinked. - ItemInfo tmpCopyStartSourceItem = ItemInfo.Get(copyStartID); - ItemInfo newEnh = null; - if (tmpCopyStartSourceItem.GetMyEnhancedDocuments().Count > 0) - { - newEnh = newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Before, GetChangeId(MyItemInfo)); - } - - //B2024-075: When doing Paste Before / After with Enhanced Documents only link from Background document to source was created - //since source is done first - //this is so that after the steps are created in the enhanced, go back and update the link in the source to point to the correct item - if (newEditItem != null && newEnh != null) - { - FixEnhanceLinkOnSource(newEditItem.MyItemInfo, newEnh, MyItemInfo.GetMyEnhancedDocuments()); - } - else if (newEnh == null && newEditItem != null && newEditItem.MyItemInfo.IsEnhancedStep) - { - UnlinkEnhanced(newEditItem); - } - else if (newEnh == null && newEditItem != null) - { - //if did a paste before/after in a source document that contains enhanced steps - //but step being pasted was non-enhanced (unlinked) - //then look to see if the background page is open - //and if it is, do a refresh so that step numbers update appropriately - //without having to close and re-open the background steps - foreach (EnhancedDocument edSource in MyItemInfo.GetMyEnhancedDocuments()) - { - ItemInfo exEnh = ItemInfo.Get(edSource.ItemID); - DisplayTabItem wndowToRefresh = newEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyBar.Items.Cast().FirstOrDefault(x => x.MyKey == $"Item - {exEnh.MyProcedure.ItemID}"); - wndowToRefresh?.MyStepTabPanel.MyStepPanel.Reset(wndowToRefresh.MyItemInfo); - } - } - - // if enhanced items were created, then see if they need displayed: - if (newEnh != null) AddAllEnhancedItemsToDisplay(newItemInfo); - } - - //B2024-075: When doing Paste Before / After with Enhanced Documents only link from Background document to source was created - //since source is done first - //this is so that after the steps are created in the enhanced, go back and update the link in the source to point to the correct item - //if enhanced document wasn't created then paste happened inside a enhanced Step/background step - so remove any links that shouldn't be there - //and don't have a corresponding spot in the Source - private void FixEnhanceLinkOnSource(ItemInfo SourceItem, ItemInfo newEnhItem, EnhancedDocuments enhancedDocuments) - { - if (enhancedDocuments.Count > 0) - CreateLinksEnhancedSingleItem(SourceItem, newEnhItem, enhancedDocuments[0].Type); - } - private void AddAllEnhancedItemsToDisplay(ItemInfo newItemInfo) - { - EnhancedDocuments eds = newItemInfo.GetMyEnhancedDocuments(); - if (eds != null && eds.Count > 0) - { - foreach (EnhancedDocument ed in eds) - AddEnhancedItemToDisplayTabItem(ItemInfo.Get(ed.ItemID)); - } - } - public void AddEnhancedItemToDisplayTabItem(ItemInfo newEnh) - { - // if tabcontrol was open for enhanced, display the steps: - ItemInfo proc = newEnh.MyProcedure; // Find procedure Item - string key = "Item - " + proc.ItemID.ToString(); - if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl._MyDisplayTabItems.ContainsKey(key)) - { - DisplayTabItem pg = MyStepPanel.MyStepTabPanel.MyDisplayTabControl._MyDisplayTabItems[key]; - // _MyDisplayTabItems (in line above) had tabs that were closed, so use the next line - // to validate that the tab is still open. - foreach (DisplayTabItem ti in MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyBar.Items) - { - if (ti == pg) pg.MyStepTabPanel.MyStepPanel.GetEditItem(newEnh); - } - } - } - public void CreateLinksEnhancedSingleItem(ItemInfo srcII, ItemInfo enhII, int enhtype) - { - srcII.DoCreateLinksEnhancedSingleItem(enhII, enhtype); - SetFocus(); - } - public void CreateLinksEnhancedAllInProcedure(ItemInfo srcII, ItemInfo enhII, int enhtype) - { - using (ContentInfoList cil = ContentInfoList.Convert16To32EnhancedContents(srcII.ItemID, enhII.ItemID, enhtype)) - { - foreach (ContentInfo ci in cil) - { - using (Content c = ci.Get()) - { - // first refresh configs because the ContentInfo.Refresh causes events to occur that refresh screen - // and if configs aren't done first, the screen refresh, if based on config data, will not be correct. - foreach (ItemInfo ii in ci.ContentItems) ii.RefreshConfig(); - ContentInfo.Refresh(c); - } - } - } - } - public void UnlinkEnhanced(EditItem enhII) - { - // B2022-049: Copy/paste of enhanced procedure and bad links between source and enhanced - // Pass in to unlink as before this change - // B2024 - 075: Change made to pass in an EditTem instead of a ItemInfo - //so can refresh the UI - enhII.MyItemInfo.DoUnlinkEnhanced(enhII.MyItemInfo, 0, false); - SetFocus(); - enhII.MyStepPanel.Reset(enhII.MyItemInfo); //need to reset parts so refreshes display to show as unlinked - } - public ItemInfo AddMissingEnhancedStep(ItemInfo ii, int EnhType) - { - // if the missing enhanced step is a caution or note, check that parent HLS has the needed - // enhanced step to insert the caution/note from. If not, do a message. - if (ii.IsCaution || ii.IsNote) - { - bool canMakeMissingStep = false; - StepConfig sc = ii.MyHLS.MyConfig as StepConfig; - foreach (EnhancedDocument ed in sc.MyEnhancedDocuments) - { - if (EnhType == ed.Type) // the hls has an enhanced linked step of this type, the caution/note can be made: - { - canMakeMissingStep = true; - break; - } - } - if (!canMakeMissingStep) - { - FlexibleMessageBox.Show("Cannot create the missing enhanced step, the Enhanced Step for the High Level step must be created first."); - return null; - } - } - ItemInfo newEnh = ii.DoAddMissingEnhancedItems(EnhType); - // if enhanced items were created, then see if they need displayed: - if (newEnh != null) AddAllEnhancedItemsToDisplay(MyItemInfo); - SetFocus(); - return newEnh; - } - private string GetChangeId(ItemInfo iiDest) - { - // get the change id for the destination's procedure's change id. - string chgid = null; - if (iiDest.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds) - chgid = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ItemsChangeIds[iiDest.MyProcedure.ItemID]; - return chgid; - } - public void PasteSiblingAfter(int copyStartID) - { - ItemInfo newItemInfo = MyItemInfo.PasteSiblingAfter(copyStartID, GetChangeId(MyItemInfo)); - if (newItemInfo.ItemID == MyItemInfo.ItemID) return; - EditItem newEditItem = null; - switch (_MyChildRelation) - { - case ChildRelation.After: - newEditItem = ActiveParent.AddChildAfter(newItemInfo, MyNextEditItem); - break; - case ChildRelation.Before: - newEditItem = ActiveParent.AddChildBefore(newItemInfo, MyNextEditItem); - break; - case ChildRelation.RNO: - newEditItem = ActiveParent.AddChildRNO(newItemInfo, MyNextEditItem); - break; - case ChildRelation.SupInfo: - newEditItem = ActiveParent.AddChildSupInfo(newItemInfo, MyNextEditItem); - break; - default: // Need debug - break; - } - MyStepPanel.SelectedEditItem = newEditItem;//Update Screen - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.After, newItemInfo.MyContent.Type)); - - // MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced. - //if doing a paste before/after and item being copied is unlinked, item pasted should also be unlinked. - ItemInfo tmpCopyStartSourceItem = ItemInfo.Get(copyStartID); - ItemInfo newEnh = null; - if (tmpCopyStartSourceItem.GetMyEnhancedDocuments().Count > 0) - { - newEnh = newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.After, GetChangeId(MyItemInfo)); - } - - //B2024-075: When doing Paste Before / After with Enhanced Documents only link from Background document to source was created - //since source is done first - //this is so that after the steps are created in the enhanced, go back and update the link in the source to point to the correct item - //if enhanced document wasn't created then paste happened inside a enhanced Step/background step - so remove any links that shouldn't be there - //and don't have a cooresponding spot in the Source - if (newEditItem != null && newEnh != null) - { - FixEnhanceLinkOnSource(newEditItem.MyItemInfo, newEnh, MyItemInfo.GetMyEnhancedDocuments()); - } - else if (newEnh == null && newEditItem != null && newEditItem.MyItemInfo.IsEnhancedStep) - { - UnlinkEnhanced(newEditItem); - } - else if (newEnh == null && newEditItem != null) - { - //if did a paste before/after in a source document that contains enhanced steps - //but step being pasted was non-enhanced (unlinked) - //then look to see if the background page is open - //and if it is, do a refresh so that step numbers update appropriately - //without having to close and re-open the background steps - foreach (EnhancedDocument edSource in MyItemInfo.GetMyEnhancedDocuments()) - { - ItemInfo exEnh = ItemInfo.Get(edSource.ItemID); - DisplayTabItem wndowToRefresh = newEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyBar.Items.Cast().FirstOrDefault(x => x.MyKey == $"Item - {exEnh.MyProcedure.ItemID}"); - wndowToRefresh?.MyStepTabPanel.MyStepPanel.Reset(wndowToRefresh.MyItemInfo); - } - } - - if (newEnh != null) AddAllEnhancedItemsToDisplay(newItemInfo); - } - public void PasteChild(int copyStartID) - { - ItemInfo newItemInfo = MyItemInfo.PasteChild(copyStartID, GetChangeId(MyItemInfo)); - - E_FromType fromType = E_FromType.Step; - if (MyItemInfo.MyContent.Type < 10000) - fromType = E_FromType.Procedure; - else if (MyItemInfo.MyContent.Type < 20000) - fromType = E_FromType.Section; - else if (MyItemInfo.MyContent.Type > 19999) - { - int tmptype = (int)MyItemInfo.MyContent.Type - 20000; - if (MyItemInfo.IsCaution) fromType = E_FromType.Caution; - else if (MyItemInfo.IsNote) fromType = E_FromType.Note; - else if (MyItemInfo.IsTable) fromType = E_FromType.Table; - else if (MyItemInfo.IsRNOPart) fromType = E_FromType.RNO; - else if (MyItemInfo.IsSupInfoPart) fromType = E_FromType.SupInfo; - } - EditItem nextItem = GetNextItem(fromType, newItemInfo); - EditItem newEditItem; - - switch (fromType) - { - case E_FromType.Caution: - newEditItem = this.AddChildBefore(newItemInfo, nextItem); - break; - case E_FromType.Note: - newEditItem = this.AddChildBefore(newItemInfo, nextItem); - break; - case E_FromType.Procedure: - newEditItem = this.AddChildAfter(newItemInfo, nextItem); - break; - case E_FromType.RNO: - newEditItem = this.AddChildRNO(newItemInfo, nextItem); - break; - case E_FromType.Section: - newEditItem = this.AddChildAfter(newItemInfo, nextItem); - break; - case E_FromType.Step: - newEditItem = this.AddChildAfter(newItemInfo, nextItem); - break; - case E_FromType.Table: - newEditItem = this.AddChildAfter(newItemInfo, nextItem); - break; - case E_FromType.SupInfo: - newEditItem = this.AddChildSupInfo(newItemInfo, nextItem); - break; - default: - newEditItem = this.AddChildAfter(newItemInfo, nextItem); - break; - } - MyStepPanel.SelectedEditItem = newEditItem;//Update Screen - - // MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced. - ItemInfo newEnh = newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Child, GetChangeId(MyItemInfo)); - if (newEnh != null) AddAllEnhancedItemsToDisplay(newItemInfo); - } - public EditItem PasteReplace(int copyStartID) - { - if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true; - // To allow a Paste Step into an empty (new) step/substep, we need to add a character to the the Text field - // to simulate replacing an existing step - otherwise we will get null references. - if (MyStepPanel.SelectedEditItem != null && MyStepPanel.SelectedEditItem.Empty) - MyStepPanel.SelectedEditItem.Empty = false; - MyStepPanel.SelectedEditItem = null; // Unselect the item to be deleted - ChildRelation childRelation = _MyChildRelation; - EditItem newFocus = null; - EditItem nextEditItem = MyNextEditItem; - EditItem prevEditItem = MyPreviousEditItem; - EditItem parentEditItem = null; // ActiveParent; - try - { - parentEditItem = ActiveParent ?? MyStepPanel?.SelectedEditItem?.ActiveParent; - } - catch (NullReferenceException) - { - // KL 7/11/2024 - Handle the case where ActiveParent throws a Null Reference Exception - parentEditItem = MyStepPanel?.SelectedEditItem?.ActiveParent; - } - - StepConfig savOrigPasteConfig = MyItemInfo.MyConfig as StepConfig; - int TopMostYBefore = TopMostEditItem.Top; - int? TopMostParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.TopMostEditItem.Top)); - int? ParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.Top)); - ItemInfo newItemInfo = null; - bool gotoFirstTrans = false; - try - { - // B2024-045, 049 and 050: do not pass in a tree node to Item.PasteReplace - newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo), ref gotoFirstTrans); - if (gotoFirstTrans) //B2017-179 could not replace step, we are positioning onto the first transition that needs resolved - { - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(newItemInfo); - if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true; - return null; - } - if (newItemInfo == null) - { - if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true; - return this; // aborted the replace so just return to the step we were trying to replace - } - } - //catch (System.Data.SqlClient.SqlException ex) - catch (Exception ex) - { - if (HandleSqlExceptionOnCopy(ex)) return this; - HandleSqlExceptionOnDelete(ex); - if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true; - return this; - } - // Remove the EditItem that was the replaced item. - RemoveFromParentsChildList(); - if (MyNextEditItem != null) - { - if (MyPreviousEditItem != null) - { - MyNextEditItem.MyPreviousEditItem = MyPreviousEditItem; - MyPreviousEditItem = null; - } - else - { - MyNextEditItem.MyParentEditItem = MyParentEditItem; - MyParentEditItem = null; - MyNextEditItem.MyPreviousEditItem = null; - } - MyNextEditItem = null; - } - else if (MyPreviousEditItem != null) - { - MyPreviousEditItem.MyNextEditItem = null; - newFocus = MyPreviousEditItem; - MyPreviousEditItem = null; - } - else - { - newFocus = MyParentEditItem; - MyParentEditItem = null; - } - - // add copied item to ui where the replaced item was. - EditItem newEditItem = null; - switch (childRelation) - { - case ChildRelation.After: - newEditItem = parentEditItem.AddChildAfter(newItemInfo, nextEditItem); - break; - case ChildRelation.Before: - newEditItem = parentEditItem.AddChildBefore(newItemInfo, nextEditItem); - break; - case ChildRelation.RNO: - newEditItem = parentEditItem.AddChildRNO(newItemInfo, nextEditItem); - break; - case ChildRelation.SupInfo: - newEditItem = parentEditItem.AddChildSupInfo(newItemInfo, nextEditItem); - break; - default: // Need debug - break; - } - MyStepPanel.SelectedEditItem = newEditItem; //Update Screen - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Replace, newItemInfo.MyContent.Type)); - if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true; - return newEditItem; - } - private bool HandleSqlExceptionOnCopy(Exception ex) - { - if (ex.Message.Contains("This step has been deleted")) - { - FlexibleMessageBox.Show("The step being pasted has been deleted", "Cannot Paste Step", MessageBoxButtons.OK, MessageBoxIcon.Hand); - return true; - } - if (ex.Message.Contains("This current step has been deleted in another session")) - { - FlexibleMessageBox.Show("The highlighted step has been deleted by another user.", "Cannot Paste Step", MessageBoxButtons.OK, MessageBoxIcon.Hand); - return true; - } - return false; - } - public void IdentifyChildren(bool highlight) - { - // Highlight children of EditItem: - if (MyAfterEditItems != null) - { - foreach (EditItem sia in MyAfterEditItems) - { - sia.IdentifyMe(highlight); - sia.IdentifyChildren(highlight); - } - } - // C2017-031: Support for paste/replace an enhanced step: don't identify/copy before items, i.e. notes/cautions - if (MyBeforeEditItems != null && !MyItemInfo.IsEnhancedStep) - { - foreach (EditItem sib in MyBeforeEditItems) - { - sib.IdentifyMe(highlight); - sib.IdentifyChildren(highlight); - } - } - if (MyRNOEditItems != null) - { - foreach (EditItem sir in MyRNOEditItems) - { - sir.IdentifyMe(highlight); - sir.IdentifyChildren(highlight); - } - } - if (MySupInfoEditItems != null) - { - foreach (EditItem sis in MySupInfoEditItems) - { - sis.IdentifyMe(highlight); - sis.IdentifyChildren(highlight); - } - } - } - #endregion - #region Event Handlers - private string WatchThisIndent - { - get { return "".PadLeft(_WatchThis, '\t'); } - } - protected bool RNOBelow - { - get - { - if (_MyRNOEditItems != null) - { - return _MyRNOEditItems[0].RNOLevel > _MyItemInfo.ColumnMode; - //return _MyRNOEditItems[0].Left == Left; - } - return false; - } - } - protected bool RNORight - { - get - { - if (_MyRNOEditItems != null) - { - return _MyRNOEditItems[0].RNOLevel <= _MyItemInfo.ColumnMode; - //return _MyRNOEditItems[0].Left != Left; - } - return false; - } - } - protected void MoveRNO() - { - if (_MyRNOEditItems != null) - { - if (_MyRNOEditItems[0].TopMostEditItem.Top != Top) - { - //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("\r\n'Adjust RNO',{0},'Move',{1}", MyID, _RNO[0].MyID); - EditItem rnoTop = _MyRNOEditItems[0].TopMostEditItem; - if (rnoTop.RNOLevel <= _MyItemInfo.ColumnMode) - { - //EditItem tmpBottom = this; - //if (_MyAfterEditItems != null) tmpBottom = _MyAfterEditItems[_MyAfterEditItems.Count - 1].BottomMostEditItem; - MyStepPanel.ItemMoving++; - rnoTop.LastMethodsPush(string.Format("EditItem_Move RNO Right {0}", rnoTop.MyID)); - //rnoTop.Top = tmpBottom.Bottom; - if (rnoTop.Top != Top) - rnoTop.Top = Top; - rnoTop.LastMethodsPop(); - MyStepPanel.ItemMoving--; - } - else - { - MyStepPanel.ItemMoving++; - rnoTop.LastMethodsPush(string.Format("EditItem_Move RNO Below {0} {1} {2}", rnoTop.MyID, BottomMostEditItemNoRNOs.MyID, BottomMostEditItemNoRNOs.Bottom)); - if (rnoTop.Top != BottomMostEditItemNoRNOs.Bottom) - rnoTop.Top = BottomMostEditItemNoRNOs.Bottom; - rnoTop.LastMethodsPop(); - MyStepPanel.ItemMoving--; - } - } - } - } - protected void MoveSupInfo() // If the current item has supplemental information, be sure its top location is that of the current item. - { - if (_MySupInfoEditItems != null && _MySupInfoEditItems.Count > 0) - { - EditItem supInfoTop = _MySupInfoEditItems[0].TopMostEditItem; - if (supInfoTop.Top != Top + supInfoTop.SupInfoTopOffset) - { - MyStepPanel.ItemMoving++; - supInfoTop.LastMethodsPush(string.Format("EditItem_Move SupInfo Right {0}", supInfoTop.MyID)); - supInfoTop.Top = Top + supInfoTop.SupInfoTopOffset; - supInfoTop.LastMethodsPop(); - MyStepPanel.ItemMoving--; - } - } - } - private bool _TryAgainLater = false; - public bool TryAgainLater - { - get { return _TryAgainLater; } - set { _TryAgainLater = value; } - } - //static bool _ShowChanges=false; - int _LastTop = 0; - - // Bug Fix: B2017-059 only turn on the spellchecking if the RTB is visible. This controls the number of windows handles created durning spellchecking - private void TurnOnSpellCheckIfVisible() - { - if (MyStepRTB != null) - { - if (this.Top + this.Height > 0 && this.Top < MyStepPanel.Height) - MyStepRTB.SpellCheckStatus = true; - else - MyStepRTB.SpellCheckStatus = false; - } - } - /// - /// Handles movement of the EditItems - /// - /// - /// - // use the following to debug if two steps are to be displayed one right after the other vertically, but they are getting separated, overwritten, - // gaps. See code below at the beginning of EditItem_Move that uses these. - //static EditItem ei_below; - //static EditItem ei_above; - private void EditItem_Move(object sender, EventArgs e) - { - //if (MyID == 205300) ei_above = this; - //if (MyID == 205306) ei_below = this; - //if (ei_below != null && ei_above != null && MyID == ei_below.MyID && ei_below.Top != ei_above.Bottom) Console.WriteLine("here"); - TurnOnSpellCheckIfVisible(); - int newTop = Top - MyStepPanel.TopMostEditItem.Top; - //if(_ShowChanges && _LastTop != newTop && MyItemInfo.InList(134786)) - //Volian.Base.Library.vlnStackTrace.ShowStackLocal(2,10,"\"EditItem_Move\"\t\"\"\t\"{0}\"\t{1}\t{2}\t{3}",MyItemInfo.ShortPath, MyID, Top, _LastTop); - if (_LastTop == newTop) return; - _LastTop = newTop; - int watchThis = _WatchThis; - if (MyStepPanel.ItemMoving == 0 && !TryAgainLater) - { - //vlnStackTrace.ScrollInStack(); - return; // If 0 - Indicates scrolling which requires no action. - } - TryAgainLater = false; - //ShowMe("Move"); - if (MyItemInfo == null) - return; - //if (_WatchThis > 0 && MyID > _StartingID) - //{ - - // Console.WriteLine("{0}Start Move {1},{2}", WatchThisIndent, MyID, this); - // if (MyID == _LookForID) - // Console.WriteLine("{0}---------------", WatchThisIndent,MyID, this); - // _WatchThis++; - //} - if (MyExpandingStatus == ExpandingStatus.Expanding) - { - _WatchThis = watchThis; - return; - } - Moving = true; - EditItem tmp = (EditItem)sender; - if (tmp.MyPreviousEditItem == null && tmp.MyParentEditItem == null) - { - _WatchThis = watchThis; - return; - } - if (RNOBelow) // Adjust substeps first - { - //Console.WriteLine("RNOBelow"); - AdjustLocation(); - MoveRNO(); - } - else // Adjust RNO First - { - if (RNORight) - { - //Console.WriteLine("RNORight"); - MoveRNO(); - } - AdjustLocation(); - } - Moving = false; - EditItem btm = BottomMostEditItem; - EditItem supinfo = null; - if (MySupInfoEditItems != null && MySupInfoEditItems.Count > 0) supinfo = MySupInfoEditItems[0].BottomMostEditItem; - if (supinfo != null && supinfo.Bottom > btm.Bottom) btm = supinfo; - if (this != btm) - btm.AdjustLocation(); - //if (_WatchThis > 0 && MyID > _StartingID) - //{ - // Console.WriteLine("{0}Finish Move {1},{2}",WatchThisIndent, MyID, this); - //} - _WatchThis = watchThis; - } - /// - /// Adjust the locations when the EditItem is resized - /// - /// - /// - private void EditItem_Resize(object sender, EventArgs e) - { - if (MyItemInfo == null) return; - if (_IgnoreResize) return; - AdjustLocation(); - HandleResize(); - AdjustAllForSupInfoHeight(); - } - #endregion // Event Handlers - #region Private and Protected Methods - /// - /// Calculates the table location - /// - /// - /// - /// - /// - protected Point TableLocation(StepSectionLayoutData myStepSectionLayoutData, int width) - { - // bug fix: B2016-111 - myParentEditItem was getting a null reference error when inserting a figure before/after a figure - EditItem myParentEditItem = MyParent; - // Should center on parent unless it is a centered table type in the AER column or parent is another table type, then - // walk up until finding a non-table type step'. (B2016-264: insert of centered eq off centered eq was not locating child equation correctly) - EditItem aboveForLocation = myParentEditItem; - while (aboveForLocation.MyItemInfo.IsFigure || aboveForLocation.MyItemInfo.IsRtfRaw || aboveForLocation.MyItemInfo.IsTable) aboveForLocation = aboveForLocation.MyParent;// B2017-248 - - int center = aboveForLocation.ContentLeft + aboveForLocation.ContentWidth / 2; - int rightLimit = aboveForLocation.Right; - // Then should center on the wid Limit - // B2019-049 added check for the table being in a Caution or Note - if ((MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0) && !MyItemInfo.IsInSupInfo && !MyItemInfo.IsInCautionOrNote) - { - // B2017-043 COLR is used as a Width - int colR = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); - rightLimit += colR * MyItemInfo.ColumnMode; - center += (colR * MyItemInfo.ColumnMode) / 2; - center -= (aboveForLocation.ContentLeft - (int)MyItemInfo.MyDocStyle.Layout.LeftMargin) / 2; - } - - // Calulate the x location - //int x = myParentEditItem.TextLeft; - int x = center - width / 2; - if (x + width > rightLimit) x = rightLimit - width; - // B2017-043 account for Horizontal Scroll - int colT = MyStepPanel.DisplayRectangle.X + MyStepPanel.ToDisplay((int)myStepSectionLayoutData.ColT); - if (x < colT) x = colT; - // B2023-025: if x is <= 0, add 20 to it so that left column of table isn't cut-off. 20 was used because lesser numbers - // still cut-off the left column (by trial and error). - if (x <= 0) x = 20; - int y = FindTop(myParentEditItem.Bottom); - return new Point(x, y); - } - protected void DoMouseWheel(MouseEventArgs e) - { - MyStepPanel.MouseWheel(e); - } - protected void InsertPgBrk() - { - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnInsPgBrk_Click(this, new EventArgs()); - MyStepPropertiesPanel.UpdatePageBreakCheckBox(); // update the checkbox on the Step Properties panel - if (!MyStepRTB.ContainsFocus) - MyStepRTB.Focus(); - } - protected void ToggleChangeBar() - { - MyStepPropertiesPanel.ToggleChangeBar(); // update the checkbox on the Step Properties panel - if (!MyStepRTB.ContainsFocus) - MyStepRTB.Focus(); - } - protected void ToggleContinuousActionSummary() - { - if (MyStepPropertiesPanel != null) // bug fix B2016-256 check for a null reference incase we are not on a step element - MyStepPropertiesPanel.ToggleContActSummary(); // update the checkbox on the Step Properties panel - if (!MyStepRTB.ContainsFocus) - MyStepRTB.Focus(); - } - protected void TogglePlaceKeeper() - { - MyStepPropertiesPanel.TogglePlaceKeeper(); // update the checkbox on the Step Properties panel - if (!MyStepRTB.ContainsFocus) - MyStepRTB.Focus(); - } - protected void TogglePlaceKeeperContAct() - { - MyStepPropertiesPanel.TogglePlaceKeeperContAct(); // update the checkbox on the Step Properties panel - if (!MyStepRTB.ContainsFocus) - MyStepRTB.Focus(); - } - protected void ToggleSuperScript() - { - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnSuperscript_Click(this, new EventArgs()); // click the Superscrpt button on the ribbon - if (!MyStepRTB.ContainsFocus) - MyStepRTB.Focus(); - } - protected void ToggleSubScript() - { - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnSubscript_Click(this, new EventArgs()); // click the Subscrpt button on the ribbon - if (!MyStepRTB.ContainsFocus) - MyStepRTB.Focus(); - } - protected void OpenAnnotations() - { - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnAnnots_Click(this, new EventArgs()); - } - protected bool CheckClipboard() - { - return (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyCopyStep != null); - } - protected void CopyStep() - { - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.DoCopyStep(); - } - /// - /// Finds the last child in a list - /// - /// - /// - private static EditItem LastChild(List childEditItems) - { - return childEditItems[childEditItems.Count - 1]; - } - /// - /// If the selected EditItem is within the window leave it as it is. - /// If not, scroll so that the selected window is centered. - /// - protected void ScrollToCenter() - { - //vlnStackTrace.ShowStack("CenterScroll {0} Current {1} Top {2} Bottom {3} Limit {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, Top, Bottom, _Panel.Height);// Show StackTrace - //Console.WriteLine("CenterScroll {0} Current {1} Top {2} Bottom {3} Limit {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, Top, Bottom, _Panel.Height); - if (Top >= 0 && Bottom <= MyStepPanel.Height) return;// Don't move if within screen. - // C2023-008: if step is larger than the current step panel height, don't center. This was shifting step so that - // if text was changed closer to bottom of step, the change was no longer visible. - if ((Bottom - Top) > _MyStepPanel.Height) return; - int scrollValue = MyStepPanel.VerticalScroll.Value + (Top - (MyStepPanel.Height / 2)); // calculate scroll center for the item - // Limit scroll location within allowable values - scrollValue = Math.Max(MyStepPanel.VerticalScroll.Minimum, Math.Min(MyStepPanel.VerticalScroll.Maximum, scrollValue)); - //Console.WriteLine("CenterScroll {0} Current {1} New {2} Min {3} Max {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, scrollValue, _Panel.VerticalScroll.Minimum, _Panel.VerticalScroll.Maximum); - //if (scrollValue >= MyStepPanel.VerticalScroll.Minimum && scrollValue <= MyStepPanel.VerticalScroll.Maximum) // If it is within range - MyStepPanel.VerticalScroll.Value = scrollValue; // Center the item - } - - /// - /// Hide a Items Children - Part of colapsing - /// - protected void HideChildren() - { - HideChildren(_MyBeforeEditItems); - HideChildren(_MyRNOEditItems); - HideChildren(_MySupInfoEditItems); - HideChildren(_MyAfterEditItems); - } - /// - /// Hide a list of children - Part of colapsing - /// - /// - private void HideChildren(List childEditItems) - { - if (childEditItems != null) - { - foreach (EditItem child in childEditItems) - { - if (child.Expanded) child.HideChildren(); - child.Hidden = true; - } - } - } - /// - /// Unhide an items Children - Part of expanding - /// - /// - protected void UnhideChildren(bool expand) - { - UnhideChildren(_MyBeforeEditItems, expand); - UnhideChildren(_MyRNOEditItems, expand); - UnhideChildren(_MySupInfoEditItems, expand); - UnhideChildren(_MyAfterEditItems, expand); - MatchExpanded(); - - } - /// - /// Unhide a list of children - part of expanding - /// - /// - /// - private void UnhideChildren(List childEditItems, bool expand) - { - if (childEditItems != null) - { - foreach (EditItem child in childEditItems) - { - if (child.Expanded) - child.UnhideChildren(expand); - else if (expand) - child.Expand(expand); - child.Hidden = false; - } - } - } - /// - /// Move children as necessary - /// - protected void AdjustChildren() - { - AdjustChildren(_MyBeforeEditItems); - AdjustChildren(_MyRNOEditItems); - AdjustChildren(_MySupInfoEditItems); - AdjustChildren(_MyAfterEditItems); - } - /// - /// Move a list of children - /// - /// - private void AdjustChildren(List childEditItems) - { - if (childEditItems != null) - { - foreach (EditItem child in childEditItems) - { - child.AdjustLocation(); - if (child.Expanded) child.AdjustChildren(); - } - } - } - /// - /// Expand a list of children - /// - /// - private void ExpandChildren(List childEditItems) - { - if (childEditItems != null) - { - foreach (EditItem child in childEditItems) - { - if (child.CanExpand) - { - child.Expand(true); - } - child.Hidden = false; - } - } - } - /// - /// Expand children - /// - private void ExpandChildren() - { - // Walk though Children performing Expand - ExpandChildren(_MyBeforeEditItems); - ExpandChildren(_MyRNOEditItems); - ExpandChildren(_MySupInfoEditItems); - ExpandChildren(_MyAfterEditItems); - } - private string MyPath - { - get - { - if (MyItemInfo.MyContent.Type >= 20000) - return MyItemInfo.Path.Substring(MyItemInfo.ActiveSection.Path.Length); - return MyItemInfo.MyContent.ToString(); - } - } - private EditItem AEREditItem - { - get - { - if (RNOLevel == 0) return null; - if (MyParentEditItem != null) - { - if (MyParentEditItem.RNOLevel < RNOLevel) - return MyParentEditItem; - else - return MyParentEditItem.AEREditItem; - } - else if (MyPreviousEditItem != null) - { - return MyPreviousEditItem.AEREditItem; - } - //Volian.Base.Library.vlnStackTrace.ShowStackLocal("'AEREditItem',{0},{1}", MyID, MyItemInfo.DBSequence); - return null; - } - } - /// - /// Adjust the Location of all items below the current item. - /// - internal void AdjustLocation() - { - if (MyStepPanel.ShuttingDown) return; - if (RNORight) MoveRNO(); // This is needed when an AER is Deleted that has an RNO. - MoveSupInfo(); // If the current item has supplemental information, be sure its top location is that of the current item. - if (RNOLevel > 0 && AEREditItem != null) - AEREditItem.AdjustLocation(); - EditItem nextEditItem = NextDownEditItem; - //if(_LookForID.Contains(MyID)) - // Console.WriteLine("{0}AdjustLocation {1},{2},{3} -> {4},{5} ({6}) {7}", WatchThisIndent, MyID, MyItemInfo.Ordinal, MyPath, - // nextEditItem == null ? 0 : nextEditItem.MyID, nextEditItem == null ? 0 : nextEditItem.MyItemInfo.Ordinal, nextEditItem == null ? "Null" : nextEditItem.MyPath, - // _NextDownEditItemPath); - if (nextEditItem != null) - { - if (MyStepPanel.ExpandingHLS != null && nextEditItem.MyItemInfo.IsSection) - { - AddAdjustItem(this);// B2017-175 Adjust Location after Expanding - return; // without this, if next item is section, it crashes on null reference - } - if (MyStepPanel.ExpandingHLS != null && nextEditItem.MyItemInfo.MyHLS.ItemID != MyStepPanel.ExpandingHLS.ItemID) - { - AddAdjustItem(this);// B2017-175 Adjust Location after Expanding - return; - } - if (AdjustItems.Contains(this)) AdjustItems.Remove(this);//B2017-175 If processed remove from list to do later - int bottom = nextEditItem.FindTop(Bottom); - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) - { - if (MyItemInfo.IsCaution || MyItemInfo.IsNote) - { - if (nextEditItem.MyItemInfo.IsHigh || (nextEditItem.MyItemInfo.IsNote && MyItemInfo.IsCaution)) - { - bottom = FirstSiblingEditItem.Top; - } - // RHM 20170216 - // MyParent will walk back MyPrevious to find Parent - // NextDevDocStep will find the first part of a Dev Doc HLS - AdjustForDevDocStepHeight(); - } - } - // SameRowAsParent - Comanche Peak Step Designator - //FormatData fmtdata = MyItemInfo.ActiveFormat.PlantFormat.FormatData; - //int formatSteptype = MyItemInfo.FormatStepType; - //if (fmtdata.StepDataList[formatSteptype].SameRowAsParent) - //if (MyItemInfo.SameRowAsParent && MyItemInfo.IsCaution2) - // bottom = Top; - - // If this is a "TitleWithTextRight", don't move down on the screen but only if it has a - // child, i.e. want the child to be positioned on line, but if no child, move down on screen: - int newTop = bottom; - if (MyItemInfo.IsSupInfoPart) newTop = Math.Max(bottom, nextEditItem.BottomOfStepImmediatelyAbove()); - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) // Deviation Document Format - if (MyItemInfo.IsStep && nextEditItem.MyItemInfo.IsStep && nextEditItem.MyItemInfo.MyHLS.ItemID != MyItemInfo.MyHLS.ItemID)// Move from one step to another - newTop = FindBottomDevDoc;// Use the bottom most caution or note - - if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.Type == "TitleWithTextRight" && MyItemInfo.HasChildren) newTop = Top; - //This was useful to find the code that was positioning the Deviationn Document steps - //if (MyItemInfo.InList(134782, 134783) || nextEditItem.MyItemInfo.InList(134782, 134783)) - // Console.WriteLine("\"AdjustLocation\"\t\"{0}\"\t\"{1}\"\t{2}\t{3}\t{4}\t{5}", MyItemInfo.ShortPath, nextEditItem.MyItemInfo.ShortPath, nextEditItem.MyID, newTop, FindBottom, FindBottom - Top); - if (nextEditItem.Top != newTop) - { - MyStepPanel.ItemMoving++; - nextEditItem.LastMethodsPush(string.Format("AdjustLocation {0}", MyID)); - nextEditItem._NextDownEditItemPath = _NextDownEditItemPath; - float oldTop = nextEditItem.Top; - nextEditItem.ExpandPrefix = 0;// If I move then I have to move my children when I expand - // it appears that setting the top doesn't always work. The logic below checks to see if it does - // not work and trys some other things so that the EditItem will be moved to the correct place. - // As a last attempt, the EditItem is added to a list to be refreshed from a timer on MyStepPanel. - if (nextEditItem.MySupInfoEditItems != null && nextEditItem.MySupInfoEditItems.Count > 0) newTop = nextEditItem.MySupInfoEditItems[0].FindTop(newTop); - nextEditItem.Top = newTop; - if (nextEditItem.Top != newTop) - { - _MyLog.InfoFormat("'TryAgainLater',{0},{1},{2},{3},{4},'{5}'", - oldTop, nextEditItem.Top, newTop, MyStepPanel.Height, nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath); - nextEditItem.TryAgainLater = true; - } - nextEditItem.LastMethodsPop(); - MyStepPanel.ItemMoving--; - } - } - else // B2018-072 nextEditItem is null, remove "this" from AdjustItems list, otherwise get infinate loop in ProcessAdjustItems() on last HSL with RNO but no AER substeps - if (AdjustItems.Contains(this)) AdjustItems.Remove(this); - } - private static List _AdjustItems=new List();// B2017-175 Keep a list of EditItems to adjust after expanding - public static List AdjustItems - { - get { return _AdjustItems; } - set { _AdjustItems = value; } - } - private static void AddAdjustItem(EditItem ei)// B2017-175 Add edit item to adjust after expanding - { - if(!AdjustItems.Contains(ei)) AdjustItems.Add(ei); - } - private static void ProcessAdjustItems() // B2017-175 adjust after expanding - { - while (AdjustItems.Count > 0) - AdjustItems[0].AdjustLocation(); - } - private int _DevDocHeight = 0; // Deviation Document Step Height B2016-123, B2017-020, B2017-021 - public int DevDocHeight - { - get { return _DevDocHeight; } - set { _DevDocHeight = value; } - } - public void TryAgainNow(int bottom) - { - TryToSetTop(bottom - 10); - //TryToSetTop(bottom+10); - TryToSetTop(bottom); - } - private void TryToSetTop(int offset) - { - Top = offset; - if (Top != offset) - _MyLog.InfoFormat("Didn't work - Top {0} != offset {1} {2}", Top, offset, MyStepPanel.VerticalScroll.Value); - } - /// - /// Automatically expands Steps if not currently expanded - /// - internal void AutoExpand() - { - if (CanExpand && Expanded == false)// TODO: May need to do some additional checking for subsections - { - if (MyStepPanel.AutoExpand) - Expand((_ContentType >= 20000) || MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format); - else - Expand(false); - //Console.WriteLine(" - /// Expand an item and it's children - /// If the children have been loaded then just expand them - /// If not, load the children and expand their children etc. - /// - /// normally equal to _Type > = 20000 (Step) - public void Expand(bool expand) - { - //// TIMING: DisplayItem.TimeIt("Expand Start"); - if (_ChildrenLoaded) - { - // Unhide Children - MyExpandingStatus = ExpandingStatus.Showing; - UnhideChildren(expand); - if (ExpandPrefix != 0) - { - MyStepPanel.ItemMoving++; - if (TopMostEditItem.Top != Top) - TopMostEditItem.Top = Top; - MyStepPanel.ItemMoving--; - } - else - TopMostEditItem.AdjustLocation(); - //_ShowChanges = true; - AdjustChildren(); - //_ShowChanges = false; - //if(_Before != null ) - // Top = _Before[_Before.Count - 1].BottomMost.Bottom; - } - else - { - if (MyItemInfo.IsHigh) MyStepPanel.ExpandingHLS = MyItemInfo; - MyExpandingStatus = ExpandingStatus.Expanding; - _ChildrenLoaded = true; - //_Panel.SuspendLayout(); - AddChildBefore(MyItemInfo.Cautions, expand); - AddChildBefore(MyItemInfo.Notes, expand); - AddChildAfter(MyItemInfo.Procedures, expand); - if (MyItemInfo.RNOs != null && MyItemInfo.RNOLevel < MyItemInfo.ColumnMode) - AddChildRNO(MyItemInfo.RNOs, expand); - if (MyItemInfo.RNOs != null && ((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds)) - AddChildAfter(MyItemInfo.RNOs, expand); - AddChildSupInfo(MyItemInfo.SupInfos, expand); - AddChildAfter(MyItemInfo.Tables, expand); - // get the config item for the steps section. there is an 'editable' - // flag used in metasections to define whether the steps should print. - // this flag can be toggle on the section's properties dialog. - // Only check the flag if the section has subsections because the - // default for the flag is not editable, and this would make non-metasections - // not editable. - bool hasMetaSubs = MyItemInfo.IsSection && MyItemInfo.Sections != null && MyItemInfo.Sections.Count > 0; - bool EditSteps = !hasMetaSubs || (MyItemInfo.MyConfig is SectionConfig && (MyItemInfo.MyConfig as SectionConfig).SubSection_Edit == "Y"); - if (EditSteps) AddChildAfter(MyItemInfo.Steps, expand); - - if (MyItemInfo.RNOs != null && MyItemInfo.RNOLevel >= MyItemInfo.ColumnMode && - !((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds)) - AddChildRNO(MyItemInfo.RNOs, expand); - AddChildAfter(MyItemInfo.Sections, expand); - MatchExpanded(); - if (MyItemInfo.IsHigh) MyStepPanel.ExpandingHLS = null; - } - MyExpandingStatus = ExpandingStatus.Done; - BottomMostEditItem.AdjustLocation(); - if (MyItemInfo.IsHigh) - ProcessAdjustItems(); // B2017-175 Adjust after expanding - MyExpandingStatus = ExpandingStatus.No; - //// TIMING: DisplayItem.TimeIt("Expand End"); - } - public EditItem BeforeItem - { - get - { - if (_MyAfterEditItems != null) - { - foreach (EditItem EditItem in _MyAfterEditItems) - { - if (EditItem._MyBeforeEditItems != null) - return EditItem.TopMostEditItem; - EditItem beforeItem = EditItem.BeforeItem; - if (beforeItem != null) return beforeItem; - } - } - return null; - } - } - public EditItem ItemAbove - { - get - { - if (_MyChildRelation == ChildRelation.Before) return _MyParentEditItem.ItemAbove; - if (_MyPreviousEditItem != null) return _MyPreviousEditItem.BottomMostEditItem; - if (_MyChildRelation == ChildRelation.After) return _MyParentEditItem; - if (_MyChildRelation == ChildRelation.RNO) return _MyParentEditItem; - if (_MyChildRelation == ChildRelation.SupInfo) return _MyParentEditItem; - return null; - } - } - private static int? max(int? value1, int value2) - { - if (value1 == null || value2 > value1) return value2; - return value1; - } - private static int min(int value1, int value2) - { - if (value2 < value1) return value2; - return value1; - } - public int FindRight() - { - if (!RNORight) return Right; - return _MyRNOEditItems[0].FindRight(); - } - public int? BottomOfParentRNO() - { - int? bottom = null; - EditItem EditItem = this; - if (!MyItemInfo.IsTablePart) - { - if (EditItem._MyChildRelation == ChildRelation.None) - return null; - if (EditItem._MyChildRelation == ChildRelation.After && !RNORight) - return null; - } - while (EditItem != null && EditItem._MyChildRelation != ChildRelation.None && EditItem._MyChildRelation != ChildRelation.After) - EditItem = EditItem.UpOneEditItem; - if (EditItem == null || EditItem._MyChildRelation == ChildRelation.None) - return null; - EditItem parent = EditItem.UpOneEditItem; - int right = FindRight(); - bool centeredTable = (MyItemInfo.IsTablePart && MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0); - while (parent != null && parent.MyItemInfo.IsSection == false && parent._MyChildRelation != ChildRelation.Before) - { - if (parent._MyRNOEditItems != null) - { - if (centeredTable || right > parent._MyRNOEditItems[0].Left) - { - if (parent._MyRNOEditItems[0].BottomMostEditItem.RNOLevel > RNOLevel && RNOLevel < _MyItemInfo.ColumnMode) - bottom = max(bottom, parent._MyRNOEditItems[0].BottomMostEditItem.Bottom); - } - } - parent = parent.UpOneEditItem; - } - return bottom; - } - public int? BottomOfParentSupInfo() - { - int? bottom = null; - if (Colapsing) return null; - EditItem parent = this; - while (parent != null && parent.MyItemInfo.IsSection == false && parent._MyChildRelation != ChildRelation.Before) - { - if (parent._MySupInfoEditItems != null) return parent._MySupInfoEditItems[0].BottomMostEditItem.Bottom; - parent = parent.UpOneEditItem; - } - return bottom; - } - private string _NextDownEditItemPath = "None"; - public string NextDownEditItemPath - { - get { return _NextDownEditItemPath; } - } - /// - /// This finds the next EditItem down. - /// - public EditItem NextDownEditItem - { - get - { - EditItem EditItem = this; - _NextDownEditItemPath = "Path 1"; - // If this item appears before it's parent, and it doesn't have anything below it, return the parent - if (MyNextEditItem == null && MyAfterEditItems == null && FirstSiblingEditItem._MyChildRelation == ChildRelation.Before) - return UpOneEditItem; - _NextDownEditItemPath = "Path 2"; - if (Expanded && _MyAfterEditItems != null)// check to see if there is a _After - return MyAfterEditItems[0].TopMostEditItem;// if there is, go that way - _NextDownEditItemPath = "Path 3"; - if (Expanded && MyRNOEditItems != null && MyItemInfo.RNOLevel >= MyItemInfo.ColumnMode)// check to see if there is a _After - return MyRNOEditItems[0].TopMostEditItem;// if there is, go that way - while (EditItem != null && EditItem.MyNextEditItem == null) // if no Next walk up the parent path - { - bool lastWasRNO = (EditItem._MyChildRelation == ChildRelation.RNO); - EditItem = EditItem.UpOneEditItem; - _NextDownEditItemPath = "Path 4"; - if (EditItem == null) // No Parent - return null; - _NextDownEditItemPath = string.Format("Path 5 {0}, {1}", EditItem.MyExpandingStatus, EditItem.Moving); - if (EditItem.MyExpandingStatus == ExpandingStatus.Expanding || EditItem.Moving) // Parent Expanding or Moving - Wait - return null; - _NextDownEditItemPath = "Path 5 RNO"; - if (EditItem.RNOBelow && !Ancestor(EditItem.MyRNOEditItems[0])) - return EditItem.MyRNOEditItems[0]; - _NextDownEditItemPath = "Path 6"; - if (EditItem.MyNextEditItem == null && EditItem.FirstSiblingEditItem._MyChildRelation == ChildRelation.Before) - return EditItem.UpOneEditItem; - EditItem btm = EditItem.BottomMostEditItem; // Find the Bottom EditItem of this ancestor - EditItem beforeItem = EditItem.BeforeItem; - if (lastWasRNO && beforeItem != null) - { - _NextDownEditItemPath = "Path 7"; - if (beforeItem.ItemAbove.Bottom > this.Bottom) return null; - _NextDownEditItemPath = "Path 8"; - return beforeItem; - } - if (this != btm) // If this is not the bottom, then just adjust things with respect to the bottom - { - EditItem btmNext = btm.NextDownEditItem; - //if (EditItem.MyNextEditItem != null && EditItem.MyNextEditItem.TopMostEditItem.Top != btm.Bottom) - if (btmNext != null) - { - int bottom = btmNext.FindTop(btm.Bottom); - if (btmNext.MySupInfoEditItems != null && btmNext.MySupInfoEditItems.Count > 0) - { - int btmSupInfo = btmNext.MySupInfoEditItems[0].FindTop(btm.Bottom); - if (btmSupInfo > bottom) bottom = btmSupInfo; - } - if (btmNext.Top != bottom) - { - MyStepPanel.ItemMoving++; - //EditItem.MyNextEditItem.TopMostEditItem.Top = btm.Bottom; - //Console.WriteLine("{0}***Move in NextDownEditItem {1},{2} From {3} To {4}",WatchThisIndent, btmNext.MyID, btmNext, btmNext.Top, btm.Bottom); - btmNext.LastMethodsPush(string.Format("NextDownEditItem {0} {1}", MyID, EditItem.MyID)); - //ShowMe(string.Format("FindTop = {0}", btmNext.FindTop(btm.Bottom))); - if (btmNext.Top != bottom) - btmNext.Top = bottom; - btmNext.LastMethodsPop(); - MyStepPanel.ItemMoving--; - } - } - _NextDownEditItemPath = string.Format("Path 9 {0}", btm); - return null; // Not the bottom - don't adjust anything else - } - //else - //{ - //} - } - if (EditItem != null) - { - // Need to verify that the bottom of the parents RNO does not excede the bottom of this item. - EditItem next = EditItem.MyNextEditItem.TopMostEditItem; - _NextDownEditItemPath = "Path A"; - //if (Bottom >= (BottomOfParentRNO(next) ?? Bottom)) - return next;// if no _After - check to see if there is a Next - //_NextDownEditItemPath = "Path B"; - //return null; - } - _NextDownEditItemPath = "Path C"; - return null; - } - } - - private bool Ancestor(EditItem EditItem) - { - if (MyID == EditItem.MyID) return true; - if (MyItemInfo.IsHigh) return false; - return UpOneEditItem.Ancestor(EditItem); - } - public override string ToString() - { - return _MyItemInfo == null ? base.ToString() : string.Format("{0},'{1}',{2},{3}", MyID, MyPath, Top, Bottom); // + "-" + MyItemInfo.MyContent.Text; - } - #endregion - #region Abstract Methods and Properties - public abstract int TableWidth { get; } - public abstract int BorderWidth { get; } - public abstract Point ContentLocation { get; set; } - public abstract string TabFormat { get; set; } - public abstract void AdjustTableWidthAndLocation(); - public abstract void SetToolTip(string tip); - public abstract void RefreshContent(); - //public abstract EditItem MyPreviousEditItem { get; set; } - public abstract int ItemLeft { get; set; } - public abstract int ContentLeft { get; } - public abstract int ContentWidth { get; set; } - public abstract Point ItemLocation { get; set; } - public abstract int ItemWidth { get; set; } - public abstract void RefreshOrdinal(); - public abstract bool Expanded { get; set; } - public abstract void RefreshTab(); - public abstract void SetFocus(); - public abstract void SaveContents(); - public abstract bool CanExpand { get; set; } - public abstract void HandleResize(); - public abstract void MatchExpanded(); - public abstract void ItemSelect(); - public abstract void ItemShow(); - public abstract StepRTB MyStepRTB { get; } - public abstract DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg); - public abstract bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse); - public abstract void PositionToEnd(); - public abstract void PositionToStart(); - public abstract string SelectedTextForFind { get; } - public abstract bool SpellCheckNext(); - public abstract void IdentifyMe(bool highlight); - public abstract void SetActive(); - public abstract bool Empty { get; set; } - //public abstract bool IsEmpty(); - //public abstract void MakeNotEmpty(); - public abstract void RefreshDisplay(bool activeMode); - public abstract void ToggleEditView(E_ViewMode vwMode); - public abstract int TabLeft { get; set; } - public abstract Font TabFont { get; set; } - public abstract string TabText { get; } - public abstract Point TabLocation { get; } - public abstract Font ContentFont { get; set; } - public abstract float ContentTop { get; } - public abstract void SetupHeader(ItemInfo itemInfo); - public abstract void ShowExpanded(); - public abstract void SetText(); - public abstract void SetExpandAndExpander(ItemInfo itemInfo); - public abstract void SaveCurrentAndContents(); - public abstract void ToolTipOnOff(); - - #endregion - private int SupInfoTopOffset - { - get - { - return _MyParentEditItem.MyStepRTB.Location.Y - MyStepRTB.Location.Y; - } - } - protected string _TabFormat; - private static int _WidthAdjust = 5; - protected bool _IgnoreResize = false; - private int FindBottomDevDoc // Find Bottom of a Deviation Document Step - { - get - { - int y = BottomMostEditItem.Bottom;// RHM 20170216 Get the bottom most step of a High Level step (RNOs and Substeps) - if (MyParentEditItem == null || MyParentEditItem.MyItemInfo.IsSection) - { - EditItem eitm2 = this; - if (eitm2 != null && eitm2.MyBeforeEditItems != null) - foreach (EditItem eitm2Tmp in eitm2.MyBeforeEditItems) - y = Math.Max(y, eitm2Tmp.Bottom); - return y; - } - y = Math.Max(y, MyParentEditItem.Bottom); - EditItem eitm = MyParentEditItem; - while (eitm != null && !eitm.MyItemInfo.IsHigh) eitm = eitm.MyParent; - if (eitm != null && eitm.MyBeforeEditItems != null) - foreach (EditItem eitmTmp in eitm.MyBeforeEditItems) - y = Math.Max(y, eitmTmp.Bottom); - return y; - } - } - /// - /// Sets the parent and postions the item with respect to the parent - /// - public EditItem MyParentEditItem - { - get { return _MyParentEditItem; } - set - { - LastMethodsPush("set_MyParentRTBItem"); - _MyParentEditItem = value; - if (_MyParentEditItem != null) - { - switch (_MyChildRelation) - { - case ChildRelation.None: // Same as after - case ChildRelation.After: // Procedures, sections, substeps, and tables/figures - // The size depends upon the parent type - int iType = (int)_MyParentEditItem.ContentType; - - switch (iType / 10000) - { - case 0: // Procedure - ItemLocation = new Point(_MyParentEditItem.ItemLocation.X + 20, _MyParentEditItem.Bottom); - int widt = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT); - int wids = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0); - int width = Math.Max(widt, wids); - ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + width; - break; - case 1: // Section - if (this == TopMostEditItem) - { - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) - { - if (MyPreviousEditItem != null) - { - EditItem ei = MyPreviousEditItem.BottomMostEditItem; - if (ei.MyItemInfo.IsHigh && (ei.MyItemInfo.Cautions != null || ei.MyItemInfo.Notes != null)) - { - if (ei.MyItemInfo.Cautions != null)// Look at cautions - { - EditItem eic = MyStepPanel._LookupEditItems[ei.MyItemInfo.Cautions[0].ItemID].BottomMostEditItem; - if (eic.Bottom > ei.Bottom) ei = eic; - } - if (ei.MyItemInfo.Notes != null)//Look at notes - { - EditItem ein = MyStepPanel._LookupEditItems[ei.MyItemInfo.Notes[0].ItemID].BottomMostEditItem; - if (ein.Bottom > ei.Bottom) ei = ein; - } - } - // B2017-043 Account for the Horizonal Scroll position when locating the step - ItemLocation = new Point(MyStepPanel.DisplayRectangle.X + MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColS) + 50, ei.Bottom); - } - else - // B2017-043 Account for the Horizonal Scroll position when locating the step - ItemLocation = new Point(MyStepPanel.DisplayRectangle.X + MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColS) + 50, _MyParentEditItem.Bottom); - } - else - ItemLocation = new Point(_MyParentEditItem.ItemLocation.X + 20, _MyParentEditItem.Bottom); - } - else - TopMostEditItem.ItemLocation = new Point(TopMostEditItem.ItemLocation.X, _MyParentEditItem.Bottom); - //TextWidth = _WidthAdjust + borderWidth + MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidSTableEdit, Convert.ToInt32(_MyStepSectionLayoutData.PMode) - 1); - ContentWidth = _WidthAdjust + BorderWidth + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode); - break; - case 2: // Step - // if Table then determine width and location based upon it's parent's location - if (MyStepData.Type == "Table" || MyStepData.ParentType == "Table") - { - AdjustTableWidthAndLocation(); - } - else if (MyStepData.Type.Contains("Figure")) - { - AdjustTableWidthAndLocation(); - } - else if (MyItemInfo.IsRtfRaw) - { - AdjustTableWidthAndLocation(); - } - else - { - if (MyItemInfo.FormatStepData.StepLayoutData.AlignWithParentTab || (MyItemInfo.IsFirstSubStep && MyItemInfo.MyParent.IsHigh && MyItemInfo.MyParent.FormatStepData.AppendDotZero)) - // Paul Linn made the request on 6/4/12 to align the Component Description & - // Required Position under the Component Number. - // F2018-025 added check for high level step being used as a section number/title (tab ends with ".0") for Westinghouse wst1 format step type 50 - ItemLocation = new Point(_MyParentEditItem.ItemLocation.X, _MyParentEditItem.Bottom); - // part of F2017-011, for enhanced backgrounds, always align the TitleWithTextRight and TitleWithTextBelow with the parent tab (on the screen) - else if ((MyItemInfo.FormatStepData.Type == "TitleWithTextRight" || MyItemInfo.FormatStepData.Type == "TitleWithTextBelow") && ((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds)) // align with parent tab if in background document - ItemLocation = new Point(_MyParentEditItem.ItemLocation.X, _MyParentEditItem.Bottom); - else if (MyItemInfo.FormatStepData.Type == "TitleWithTextRight" && (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0)) // this code is run for siblings within a HLS (but not last sibling). - ItemLocation = new Point(_MyParentEditItem.ItemLocation.X, _MyParentEditItem.Bottom); - else if (MyItemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight") - ItemLocation = new Point(_MyParentEditItem.ItemLocation.X + _MyParentEditItem.ItemWidth + 10, _MyParentEditItem.ItemLocation.Y); // F2017-011 added 10 to fix positoning of Purpose text on sceen (enhanced backgrounds) - else if (MyItemInfo.MyTab.Offset != 0) - ContentLocation = new Point(_MyParentEditItem.ContentLocation.X + 10, _MyParentEditItem.Bottom); - //ItemLocation = new Point(_MyParentEditItem.ItemLocation.X+10, _MyParentEditItem.Bottom); - else - { - // B2016-134 Fix - If a previous step exists, use it to locate the current step - if (_MyPreviousEditItem != null) - ItemLocation = new Point(_MyParentEditItem.ContentLeft, _MyPreviousEditItem.BottomMostEditItem.Bottom); - else - { - ItemLocation = new Point(_MyParentEditItem.ContentLeft, _MyParentEditItem.Bottom); - // if inserting a substep within supplemental information, then may have to adjust steps too: - if (MyItemInfo.IsInSupInfo) - { - AdjustLocation(); - // find parent of supinfo & adjust its location: - ItemInfo supInfoPart = MyItemInfo; - while (!supInfoPart.IsSupInfoPart) supInfoPart = supInfoPart.MyParent; - EditItem eitmp = MyStepPanel._LookupEditItems[supInfoPart.ItemID]; - eitmp.MyParentEditItem.AdjustLocation(); - } - } - } - bool specialTplSupport = ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd) || - (MyItemInfo.MyDocStyle.LandscapePageList && MyItemInfo.MyDocStyle.ComponentList); - bool wecTplSupport = ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_ChklstEditSize) == E_DocStructStyle.DSS_ChklstEditSize); - if (MyItemInfo.FormatStepData.ReadOnly) - { - Graphics g = CreateGraphics(); - SizeF sz = g.MeasureString(MyItemInfo.MyContent.Text, MyItemInfo.FormatStepData.Font.WindowsFont); - ItemWidth = (int)sz.Width; - } - else if (MyItemInfo.FormatStepData.Type == "TitleWithTextRight" && specialTplSupport) - { - Graphics g = CreateGraphics(); - SizeF sz = g.MeasureString(MyItemInfo.MyContent.Text, MyItemInfo.FormatStepData.Font.WindowsFont); - ItemWidth = (int)sz.Width + 5; - } - else if (MyItemInfo.FormatStepData.Type == "TitleWithTextBelow" && specialTplSupport) - { - ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0); - } - else if (wecTplSupport || (MyItemInfo.MyParent.FormatStepData.Type == "TitleWithTextBelow" && specialTplSupport)) - { - ItemWidth = MyParentEditItem.ItemWidth - RTBItem.RTBMargin; - } - else if (MyItemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight" && - ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd)) - { - ItemWidth = MyParentEditItem.MyParentEditItem.ContentWidth - MyParentEditItem.ItemWidth; - } - else if (MyItemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight") - { - ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0); - ItemWidth = ItemWidth - ItemLocation.X; - } - else if (MyParentEditItem != null && MyParentEditItem.MyItemInfo.FormatStepData.ReadOnly) - ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0); - else if (MyItemInfo.MyTab != null && MyItemInfo.MyTab.Offset != 0) - { - // Farley - part of bug fix B2015-123 alignment of tabs on the edit screen (Farly is only one using tab offset) - ContentWidth = _MyParentEditItem.ContentWidth; - int xOffTabNew = (MyItemInfo.MyParent.MyTab != null ? MyItemInfo.MyParent.MyTab.Offset : MyItemInfo.MyParent.OffsetTab) + MyItemInfo.MyTab.Offset; - xOffTabNew += MyItemInfo.MyParent.MyTab == null ? 0 : MyItemInfo.MyParent.MyTab.Offset; - int xIncrement = xOffTabNew - MyItemInfo.MyTab.Offset; - MyStepRTB.Location = new Point(MyStepRTB.Location.X + xIncrement, MyStepRTB.Location.Y); - } - else - ItemWidth = _MyParentEditItem.ContentWidth; - } - break; - } - break; - case ChildRelation.SupInfo: // on a supplemental info item - EditItem high = MyStepPanel._LookupEditItems[MyItemInfo.MyHLS.ItemID]; - if (_MyParentEditItem.MyItemInfo.IsNote || _MyParentEditItem.MyItemInfo.IsCaution) - { - ContentWidth = high.ContentWidth - high.ContentLocation.X; - } - else - ContentWidth = _MyParentEditItem.ContentWidth; - // Currently on the supinfo, so MyParentEditItem is the step the supinfo is related to. - // From this MyParentEditItem, need to find what is the bottom of the 'previous step' on the screen where 'previous step' can be: - // 1) The bottom most EditItem from a caution/note, i.e. MyBeforeEditItems. This must be checked first. - // 2) If there is a MyParentEditItem, use it (only MyParentEditItem or MyPreviousEditItem can be set), if going to parent don't use - // BottomMostEditItem because that will take it onto this step or subsequent substeps. So just use its bottom. Note that there - // are special cases if on a Note/Caution (see below for comments) - // 3) If there is no MyBeforeEditItems & no MyParentEditItems, there must be a MyPreviousEditItems. Use its MyBottomMostEditItem's bottom - // since this previous may have substeps. - int btm = MyParentEditItem.BottomOfStepImmediatelyAbove(); - int topp = FindTop(btm, false); - if (topp != 0) - { - MyStepPanel.ItemMoving++; - _MyParentEditItem.Top = (int)topp; - if (_MyParentEditItem.MyItemInfo.Steps != null && _MyParentEditItem.MyItemInfo.Steps.Count > 0) - { - EditItem chtmp = GetEditItemFromItemID(_MyParentEditItem.MyItemInfo.Steps[0].ItemID); - if (chtmp != null && chtmp._MyParentEditItem != null) - { - chtmp.Top = chtmp._MyParentEditItem.Bottom; - chtmp.AdjustLocation(); - } - } - _MyParentEditItem.AdjustLocation(); - MyStepPanel.ItemMoving--; - } - ContentLocation = new Point(high.ContentLeft + high.Width + 36, (int)_MyParentEditItem.Top + SupInfoTopOffset); // account for Caution/Note tab above caution/note - break; - case ChildRelation.RNO: - // this is set so that TextWidth command below will be correct. TextWidth uses - // the tab start & tab width to calculate the overall width. - TabFormat = ""; // this is set so that TextWidth command below will be correct - _IgnoreResize = true; - // Use the RNOWidthAlt value if it exists instead of the default RNO width - // Note that I needed to add 1 to the ToDisplay() value to be closer to the needed - // width for the screen (this does not affect the printout) - // If in single column, don't make this adjustment: - string[] splitRNOWidthAlt = MyStepSectionLayoutData.RNOWidthAlt.Split(','); - int ovrRNOWidth = (RNOLevel < splitRNOWidthAlt.Length) ? MyStepPanel.ToDisplay(float.Parse(splitRNOWidthAlt[RNOLevel]) + 1) : 0; - if (MyStepSectionLayoutData.RNOWidthAlt != null && ovrRNOWidth > 1 && MyItemInfo.ColumnMode != 0) - ContentWidth = ovrRNOWidth; - else - ContentWidth = _MyParentEditItem.ContentWidth; - _IgnoreResize = false; - if (RNOLevel <= MyItemInfo.ColumnMode) - { - //int colR = MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColRTable, Convert.ToInt32(_MyStepSectionLayoutData.PMode) - 1); - int colR = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); - if (colR - _MyParentEditItem.Width < 0) colR = _MyParentEditItem.Width + 0; - MyStepPanel.ItemMoving++; - //Left = _MyParentRTBItem.ItemLeft + RNOLevel * colR; - //ItemLocation = new Point(_MyParentRTBItem.ItemLeft + RNOLevel * colR, _MyParentRTBItem.Top); - LastMethodsPush(string.Format("set_MyParentRTBItem RNO Right {0}", MyID)); - ItemLocation = new Point(_MyParentEditItem.ItemLeft + RNOLevel * colR, _MyParentEditItem.Top); - int top = _MyParentEditItem.FindTop(_MyParentEditItem.Top); - if (top != _MyParentEditItem.Top) - { - _MyParentEditItem.LastMethodsPush(string.Format("set_MyParentRTBItem RNO Right {0}", MyID)); - if (_MyParentEditItem.Top != top) - _MyParentEditItem.Top = top; - _MyParentEditItem.LastMethodsPop(); - Top = top; - } - LastMethodsPop(); - MyStepPanel.ItemMoving--; - } - else - { - MyStepPanel.ItemMoving++; - LastMethodsPush(string.Format("set_MyParentRTBItem RNO Below {0} {1} {2}", MyID, _MyParentEditItem.BottomMostEditItem.MyID, _MyParentEditItem.BottomMostEditItem.Bottom)); - ContentLocation = new Point(_MyParentEditItem.ContentLeft, _MyParentEditItem.BottomMostEditItem.Bottom); - LastMethodsPop(); - //TextLocation = new Point(_MyParentRTBItem.TextLeft, FindTop(_MyParentRTBItem.Top)); - MyStepPanel.ItemMoving--; - } - // Same size as the Parent - break; - case ChildRelation.Before: // Cautions and Notes - //if(_WatchThis > 0 && MyID > 2111) - // Console.WriteLine("Setting MyParent: \r\n\tParent {0},{1} \r\n\tTopMostItem {2},{3} \r\n\tNext {4}, {5}", _MyParentRTBItem.MyID, _MyParentRTBItem - // ,_MyParentRTBItem.TopMostRTBItem.MyID,_MyParentRTBItem.TopMostRTBItem - // , _MyNextRTBItem == null ? 0 : _MyNextRTBItem.MyID, _MyNextRTBItem == null ? "None" : _MyNextRTBItem.ToString()); - - //Location = new Point(_MyParentRTBItem.Left + 20, max(_MyParentRTBItem.Top, (_MyNextRTBItem == null ? 0 : _MyNextRTBItem.Top )) ?? 0); - _IgnoreResize = true; - int spaceToRTB = 23; - _IgnoreResize = false; - MyStepPanel.ItemMoving++; - //Location = new Point(_MyParentRTBItem.Left + 20, FindTop(_MyParentRTBItem.Top)); - int myTop = 0; - if (MyNextEditItem == null) - myTop = _MyParentEditItem.Top; - else - myTop = MyNextEditItem.Top; - - //if (MyItemInfo.SameRowAsParent && MyItemInfo.IsCaution2) - //{ - // if (MyItemInfo.WidthOverride > 0) - // Width = MyStepPanel.ToDisplay(MyItemInfo.WidthOverride) + spaceToRTB; - //} - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && (MyItemInfo.IsCaution || MyItemInfo.IsNote)) - { - // B2017-043 account for Horizontal Scroll - int x = MyStepPanel.DisplayRectangle.X + MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColT); - int y = Top; - if (MyPreviousEditItem == null || !MyPreviousEditItem.MyItemInfo.IsCaution || !MyItemInfo.IsNote) - y = FindTop(myTop); - // Get the "bottom" number of the longest Caution/Note on the step/substep above so that - // we can position properly on the screen. - // EX. Catawba Deviations E-1 step deviation for step 10 - EditItem eitm = (MyParentEditItem.MyPreviousEditItem != null) ? MyParentEditItem.MyPreviousEditItem : MyParentEditItem.MyParentEditItem; - if (eitm != null && eitm.MyBeforeEditItems != null) - foreach (EditItem eitmTmp in eitm.MyBeforeEditItems) - y = Math.Max(y, eitmTmp.Bottom); - if (MyItemInfo.IsNote) // Move to the right based upon the Width of the Caution which is the same as the width of the note. - { // AdjustChildren width BeforeItem setting Left offset - int width = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT) + spaceToRTB; - x += width + 6;//Account for the width of the Caution in the Deviation Document - } - Location = new Point(x, y); - } - else - Location = new Point(_MyParentEditItem.Left + 20, FindTop(myTop)); - // ip2bck's needed the width to be set slightly differently to get the correct width. - int widthtpl = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT) + spaceToRTB; - if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.UseOldTemplate && - ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd)) - widthtpl = MyParentEditItem.Width + MyParentEditItem.Left - Left; - Width = widthtpl; // MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT) + spaceToRTB; - MyStepPanel.ItemMoving--; - //_MyParentRTBItem.Top = Bottom; - // Could be a Caution or Note - Need to get WidT - break; - } - } - LastMethodsPop(); - } - } - private int BottomOfStepImmediatelyAbove() - { - int btm = 0; - if (MyBeforeEditItems != null && MyBeforeEditItems.Count > 0) // Notes & Cautions before - btm = MyBeforeEditItems[MyBeforeEditItems.Count - 1].BottomMostEditItem.Bottom; - else - { - // if on a caution or note, (the first one), need to go up to either previous step or the section to find its bottom - // _MyParentEditItem is a way to find that the structure supports this, i.e. there can be a caution or note: - if (_MyParentEditItem != null - && _MyParentEditItem.MyBeforeEditItems != null && _MyParentEditItem.MyBeforeEditItems.Count > 0 // this part checks that there are cautions/notes - && _MyParentEditItem.MyBeforeEditItems[0].MyID == MyID) // first caution or note, i.e. index of MyBeforeItems == 0 - { - if (_MyParentEditItem._MyPreviousEditItem == null) // this part checks for first HLS - btm = _MyParentEditItem._MyParentEditItem.Bottom; // bottom of the section - else - btm = _MyParentEditItem._MyPreviousEditItem.BottomMostEditItem.Bottom; // bottom of previous step - } - else - { - btm = MyParentEditItem != null ? MyParentEditItem.Bottom : MyPreviousEditItem.BottomMostEditItem.Bottom; - } - } - return btm; - } - /// - /// Sets the previous item and adjusts locations - /// - public /*override*/ EditItem MyPreviousEditItem - { - get { return _MyPreviousEditItem; } - set - { - LastMethodsPush("set_MyPreviousRTBItem"); - _MyPreviousEditItem = value; - if (_MyPreviousEditItem != null) - { - _IgnoreResize = true; - // the table code goes through the following, rather than 'istablepart' - if (MyStepData != null && ((MyStepData.Type.ToLower().Contains("table") || MyStepData.ParentType.ToLower().Contains("table")) || - (MyStepData.Type.ToLower().Contains("figure") || MyStepData.ParentType.ToLower().Contains("figure")) || - (MyStepData.Type.ToLower().Contains("equation") || MyStepData.ParentType.ToLower().Contains("equation")))) - { - ItemWidth = TableWidth; - Location = new Point(_MyPreviousEditItem.Left, FindTop(_MyPreviousEditItem.BottomMostEditItem.Bottom)); - } - else if (value.MyItemInfo.IsTablePart) - { - // B2019-179: if more than 1 table, get to the first that has the parent: - EditItem cur = (EditItem)value; - while (cur.MyPreviousEditItem != null) cur = cur.MyPreviousEditItem; - ItemLocation = new Point(cur.MyParentEditItem.ContentLeft, cur.Bottom); - ItemWidth = cur.MyParentEditItem.ContentWidth; - } - else - { - if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.ReadOnly) - { - Graphics g = CreateGraphics(); - SizeF sz = g.MeasureString(MyItemInfo.MyContent.Text, MyItemInfo.FormatStepData.Font.WindowsFont); - ItemWidth = (int)sz.Width; - } - else if (MyPreviousEditItem != null && MyPreviousEditItem.MyItemInfo.FormatStepData != null && MyPreviousEditItem.MyItemInfo.FormatStepData.ReadOnly) - ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0); - // RHM The following lines were commented-out for Facing Pages (Supplemental Information) to test follow the instructions - //else if (MyItemInfo.MyTab.Offset != 0) // Farley - part of bug fix B2015-123 alignment of tabs on the edit screen (Farly is only one using tab offset) - // ContentWidth = (MyPreviousEditItem.MyItemInfo.MyTab.Offset != 0) ? MyPreviousEditItem.ContentWidth : MyPreviousEditItem.ContentWidth + 10; - else - Width = MyPreviousEditItem.Width; - - if (TopMostEditItem == this) - { - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && - (MyItemInfo.IsNote || MyItemInfo.IsCaution) && - (MyPreviousEditItem == null || (MyPreviousEditItem.MyItemInfo.IsCaution && MyItemInfo.IsNote))) - //if ((MyItemInfo.SameRowAsParent && MyItemInfo.IsCaution2) || (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && (MyItemInfo.IsNote || MyItemInfo.IsCaution))) - { - // B2017-043 account for Horizontal Scroll - int x = MyStepPanel.DisplayRectangle.X + MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColT); - if (MyItemInfo.IsNote) - x += Width + 6; - //Find first sibling - EditItem prev = _MyPreviousEditItem; - while (prev._MyPreviousEditItem != null) - prev = prev._MyPreviousEditItem; - Location = new Point(x, prev.Top);// Use the top of the first sibling - } - else - { - int top = FindTop(_MyPreviousEditItem.BottomMostEditItem.Bottom); - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && _MyPreviousEditItem.MyItemInfo.IsHigh) - //if (MyItemInfo.SameRowAsParent || (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && _MyPreviousEditItem.MyItemInfo.IsHigh)) - { - if (_MyPreviousEditItem.MyBeforeEditItems != null) - foreach (EditItem ei in _MyPreviousEditItem.MyBeforeEditItems) - top = Math.Max(top, ei.Bottom); - } - Location = new Point(_MyPreviousEditItem.Left, top); - // B2017-029 only do this if this is a the deviation document - AdjustForDevDocStepHeight(); - AdjustAllForSupInfoHeight(); - } - } - else - TopMostEditItem.Location = new Point(TopMostEditItem.Left, FindTop(_MyPreviousEditItem.BottomMostEditItem.Bottom)); - } - _IgnoreResize = false; - //ShowMe(""); - //if (MyID > _StartingID) - // Console.WriteLine("{0}-->Setting MyPreviousRTBItem {1},{2},{3},{4},{5},{6},{7}", WatchThisIndent, MyID, this - // , _MyPreviousRTBItem - // ,Top - // , _MyPreviousRTBItem.BottomMostRTBItem.Bottom - // , FindTop(_MyPreviousRTBItem.BottomMostRTBItem.Bottom) - // , _MyPreviousRTBItem.Bottom); - //Location = new Point(_MyPreviousRTBItem.Left, _MyPreviousRTBItem.BottomMostRTBItem.Bottom); - switch (_MyChildRelation) - { - case ChildRelation.None: - break; - case ChildRelation.After: - break; - case ChildRelation.RNO: - break; - case ChildRelation.SupInfo: - break; - case ChildRelation.Before: - //MyStepPanel.ItemMoving++; - //UpOneRTBItem.Top = BottomMostRTBItem.Bottom; - //MyStepPanel.ItemMoving--; - break; - } - if (_MyPreviousEditItem.MyNextEditItem != this) _MyPreviousEditItem.MyNextEditItem = this; - } - LastMethodsPop(); - } - } - // AdjustAllForSupInfoHeight & AdjustFOrSupInfoHeight go from current edit item down, adjusting any of the edit items' top - // location to account for any supplemental informations that items may have so that either the step or its supplemental information - // does not overwrite other steps on screen. - private void AdjustAllForSupInfoHeight() - { - EditItem ei = this; - while (ei != null) - { - ei = ei.AdjustForSupInfoHeight(); - } - } - private EditItem AdjustForSupInfoHeight() - { - if (MyStepPanel._LookupEditItems.ContainsKey(MyID) && MyItemInfo.IsInSupInfo) // only do this if it is displayed (in LookupEditItems and in sup info column - { - ItemInfo supInfoPart = MyItemInfo; - while (!supInfoPart.IsSupInfoPart) supInfoPart = supInfoPart.MyParent; - EditItem EIsupInfoPartAbove = MyStepPanel._LookupEditItems[supInfoPart.ItemID]; - - // find first edititem below this (EIWsupInfoBelow) or a sibling or child child that have sup info - // if found, adjust top of this item to the bottommost edititem above this - EditItem EIWsupInfoBelow = null; - EIWsupInfoBelow = EIsupInfoPartAbove.MyParentEditItem.FindFirstChildWithSupInfo(EIsupInfoPartAbove.MyParentEditItem.MyItemInfo); - if (EIWsupInfoBelow == null) - EIWsupInfoBelow = EIsupInfoPartAbove.MyParentEditItem.FindSiblingOrParentSiblingWithSupInfo(EIsupInfoPartAbove.MyParentEditItem.MyItemInfo); - - if (EIWsupInfoBelow != null) // for editiem below, find bottom of step & subinfo column and take the max of these: - { - int bottomOfAboveSupInfoColumn = EIsupInfoPartAbove.BottomMostEditItem.Bottom; - int bottomOfImmediatelyAbove = EIWsupInfoBelow.BottomOfStepImmediatelyAbove(); - MyStepPanel.ItemMoving++; - EIWsupInfoBelow.Top = Math.Max(bottomOfAboveSupInfoColumn, bottomOfImmediatelyAbove); - EIWsupInfoBelow.AdjustLocation(); - MyStepPanel.ItemMoving--; - return EIWsupInfoBelow.MySupInfoEditItems == null ? null : EIWsupInfoBelow.MySupInfoEditItems[0]; - } - } - return null; - } - private EditItem CheckForExpanded(EditItem ei) - { - ItemInfo hls = ei.MyItemInfo.MyHLS; - EditItem hlsEI = GetEditItemFromItemID(hls.ItemID); - if (hlsEI == null) return null; - return ei; - } - // FindSiblingOrParentSiblingWithSupInfo will find the next edititem below me on the screen that has a supinfo - private EditItem FindSiblingOrParentSiblingWithSupInfo(ItemInfo itm) - { - if (itm == null || itm.IsProcedure) return null; - if (itm.NextItem == null) - { - return FindSiblingOrParentSiblingWithSupInfo(itm.ActiveParent as ItemInfo); - } - EditItem chldOfNext = null; - // if section, handle notes/cautions on section and if none, look for hls (children of section) - if (itm.NextItem.IsSection) - { - if (itm.NextItem.Steps == null || itm.NextItem.Steps.Count == 0) return null; - chldOfNext = FindFirstCautionOrNoteWithSupInfo(itm.NextItem); - if (chldOfNext != null) return CheckForExpanded(chldOfNext); - chldOfNext = FindFirstChildWithSupInfo(itm.NextItem); - if (chldOfNext != null) return CheckForExpanded(chldOfNext); - return null; - } - // Handle caution/note off of itm.nextitem. See if any of those have supinfos. - chldOfNext = FindFirstCautionOrNoteWithSupInfo(itm.NextItem); - if (chldOfNext != null) return CheckForExpanded(chldOfNext); - - // this is step side (parent) of supinfo part. This step does not have any children with supinfo. - // See if any of my next siblings have supinfo - if (itm.NextItem.SupInfos != null && itm.NextItem.SupInfos.Count > 0) - { - return GetEditItemFromItemID(itm.NextItem.ItemID); - } - // no longer looking at next, go to children. - chldOfNext = FindFirstChildWithSupInfo(itm.NextItem); - if (chldOfNext != null) return CheckForExpanded(chldOfNext); - return FindSiblingOrParentSiblingWithSupInfo(itm.NextItem); - } - // FindFirstChildWithSupinfo finds the first child going down the screen that has a supinfo. It checks for cautions and - // notes first. - private EditItem FindFirstChildWithSupInfo(ItemInfo itm) - { - // If on a caution, see if there are any notes below me on the screen that have supinfo. - // B2017-237 Should use isCautionPart rather than IsCaution for BGE Mixed Cautions and Notes - if (itm.IsCautionPart && (itm.ActiveParent as ItemInfo).Notes != null && (itm.ActiveParent as ItemInfo).Notes.Count > 0) - { - foreach (ItemInfo inote in (itm.ActiveParent as ItemInfo).Notes) - { - if (inote.SupInfos != null && inote.SupInfos.Count > 0) - return GetEditItemFromItemID(inote.ItemID); - EditItem chld = FindFirstChildWithSupInfo(inote); - if (chld != null) return CheckForExpanded(chld); - } - } - // if on a caution or note check the step below me, which is really my activeparent (cautions/notes are above their respective parent) - if ((itm.IsCaution || itm.IsNote) && itm.NextItem == null && (itm.ActiveParent as ItemInfo).SupInfos != null && (itm.ActiveParent as ItemInfo).SupInfos.Count > 0) - return GetEditItemFromItemID((itm.ActiveParent as ItemInfo).ItemID); - - // Finally check substeps: - if (itm.Steps == null || itm.Steps.Count == 0) return null; - foreach (ItemInfo ii in itm.Steps) - { - if (ii.SupInfos != null && ii.SupInfos.Count > 0) - return GetEditItemFromItemID(ii.ItemID); - EditItem chld = FindFirstChildWithSupInfo(ii); - if (chld != null) return CheckForExpanded(chld); - } - return null; - } - // FindFirstCautionOrNoteWithSupInfo looks for first caution or note going down the screen that has supInfo - private EditItem FindFirstCautionOrNoteWithSupInfo(ItemInfo itm) - { - if (itm.Cautions != null && itm.Cautions.Count > 0) - { - foreach (ItemInfo ii in itm.Cautions) - { - if (ii.SupInfos != null && ii.SupInfos.Count > 0) - return GetEditItemFromItemID(ii.ItemID); - EditItem chld = FindFirstChildWithSupInfo(ii); - if (chld != null) return CheckForExpanded(chld); - } - } - if (itm.Notes != null && itm.Notes.Count > 0) - { - foreach (ItemInfo ii in itm.Notes) - { - if (ii.SupInfos != null && ii.SupInfos.Count > 0) - return GetEditItemFromItemID(ii.ItemID); - EditItem chld = FindFirstChildWithSupInfo(ii); - if (chld != null) return CheckForExpanded(chld); - } - } - return null; - } - private EditItem GetEditItemFromItemID(int itemid) - { - if (!MyStepPanel._LookupEditItems.ContainsKey(itemid)) return null; - return MyStepPanel._LookupEditItems[itemid]; - } - /// - /// Adjust the height of a Deviation Document Step Including the Cautions and Notes B2016-123, B2017-020, B2017-021 - /// - private void AdjustForDevDocStepHeight() - { - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && MyParent.MyItemInfo.IsHigh) - { - int bot = MyParent.FindBottomDevDoc; - int DDHeight = bot - FirstSiblingEditItem.Top;//Determine the height of the step including cautions and notes - if (MyParent.DevDocHeight != DDHeight) - { - MyParent.DevDocHeight = DDHeight;// If the height has changed adjust the top of the next item down - EditItem ei = NextDevDocStep;// RHM 20170216 Locate Next Dev Doc Step - if (ei != null) - { - ei.Top = bot; - ei.AdjustLocation(); - } - } - } - } - // RHM 20170216 - Find Next Dev Doc High Level Step - // If caution Exists return caution - // If note exists return note - private EditItem NextDevDocStep - { - get - { - EditItem ei = this; - while (ei != null && !ei.MyItemInfo.IsHigh) ei = ei.MyParent;// Get High Level Step - if (ei != null) ei = ei.MyNextEditItem;// Get Next High Level Step - if (ei != null) - { - if (ei.MyItemInfo.IsHigh && (ei.MyItemInfo.Cautions != null || ei.MyItemInfo.Notes != null)) - { - if (ei.MyItemInfo.Cautions != null)// Look at cautions - { - EditItem eic = MyStepPanel._LookupEditItems[ei.MyItemInfo.Cautions[0].ItemID].BottomMostEditItem; - ei = eic; - } - else if (ei.MyItemInfo.Notes != null)//Look at notes - { - EditItem ein = MyStepPanel._LookupEditItems[ei.MyItemInfo.Notes[0].ItemID].BottomMostEditItem; - ei = ein; - } - } - } - return ei; - } - } - // RHM 20170216 Find Parent by walking up MyPrevious - private EditItem MyParent - { - get - { - if (MyParentEditItem != null) return MyParentEditItem; - return MyPreviousEditItem.MyParent; - } - } - // C2021-018 used to display Alarm Point Table RO values in the editor - // Get the RO value for the given RO AccPageID and multiple Return Value option - private string ROLookupForEditorView(SectionInfo MySection, string accpageid, string multiid, string deflt) - { - ROFSTLookup myLookup = MySection.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MySection.MyDocVersion, null); - - //B2022-083: Support Conditional RO Values - //C2026-047 first try the RO Lookup with the ascii dash character in the accpageid. If not found, try again with the unicode dash - ROFSTLookup.rochild roc = myLookup.GetROChildByAccPageID(string.Format("<{0}.{1}>", accpageid.Replace(@"\u8209?", "-"), multiid), MySection.MyDocVersion.DocVersionConfig.RODefaults_setpointprefix, MySection.MyDocVersion.DocVersionConfig.RODefaults_graphicsprefix); - - if (roc.value == null) - { - // try again but this time with the unicode dash - roc = myLookup.GetROChildByAccPageID(string.Format("<{0}.{1}>", accpageid, multiid), MySection.MyDocVersion.DocVersionConfig.RODefaults_setpointprefix, MySection.MyDocVersion.DocVersionConfig.RODefaults_graphicsprefix); - } - - if (!deflt.StartsWith("[") && !string.IsNullOrEmpty(roc.value) && roc.value.Trim().Length > 0) // don't return val if it's an empty or blank string - jsj 01-28-2019 - { - roc.value = roc.value.Replace("[xB3]", "\xB3"); - roc.value = roc.value.Replace("[xB2]", "\xB2"); - return roc.value; - } - - return deflt; - } - // C2021-018 used to display Alarm Point Table RO values in the editor - private string ResolveUnitApp(DocVersionInfo dvi, string str) - { - if (dvi == null) return str; - // B2024-025 - process all of the applicability token (, , ) - str = VEPROMS.CSLA.Library.DisplayText.ResolveUnitSpecific(dvi, str); - // look for un-resolved tokens and replace less/greater than chars with "*?" and "?*" respectively - string tmp = str.ToUpper(); - int sindx = tmp.IndexOf("", sindx + 1); - string reptmp; - while (sindx > -1 && eindx > -1) // B2022-007 added while loop to process more than one ", "?*")); // unresolved token - tmp = str.ToUpper(); - sindx = tmp.IndexOf("", sindx + 1); - } - //string tmp = str.ToUpper(); - //int sindx = tmp.IndexOf("", sindx + 1); - //string reptmp; - //while (sindx > -1 && eindx > -1) // B2022-007 added while loop to process more than one ") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Number); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Text); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Number); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Name); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_ID); - // // B2021-145: For applicability, the tree view & pdf file name are not getting resolved when using any of the ‘OTHER’ tokens - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Text); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Number); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Name); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_ID); - // else str = str.Replace(reptmp, tmp.Replace("<", "*?").Replace(">", "?*")); - // tmp = str.ToUpper(); - // sindx = tmp.IndexOf("", sindx + 1); - //} - return str; - } - // C2021-018 used to display Alarm Point Table RO values in the editor - // translate pagelist tokens that are used in the parameters for the RO Lookup calls - private bool ProcessROLookupCfgParams(VEPROMS.CSLA.Library.SectionInfo section, ref string plstr, string token) - { - bool retval = true; - - // Paglist token inside a PS= conditional are surrounded by square brackets instead of curley - // ex. [BOX3] instead of {BOX3}, thus the redunant looking cases - switch (token) - { - case "{EOPNUM}": - case "[EOPNUM]": - case "{PREDELIMEOPNUM}": - case "[PREDELIMEOPNUM]": - case "{EOPNUMROLU}": - case "[EOPNUMROLU]": - string eopnum = section.MyProcedure.MyContent.Number; - if (eopnum.ToUpper().Contains(@", , , , , , , , - // F2023-078 - for Vogtle Units 3 & 4 Alarms - also remove dash after unit number - eopnum = Regex.Replace(eopnum, @"\(-|\\u8209\?)", "", RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\", "", RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)ID)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)NAME)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)TEXT)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)NUMBER)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); - // B2021-148 remove space character after "OTHER" - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)OTHERID)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)OTHERNAME)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)OTHERTEXT)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)OTHERNUMBER)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); - } - else - eopnum = section.MyProcedure.DisplayNumber;// B2021-066: found and fixed during proc pc/pc work - } - // B2022-066 the "{PREDELIMEOPNUM}" token was not being processed because there was a space after the "{" - if (token.Equals("{PREDELIMEOPNUM}")) - { - // only use up to the first non-alphanumeric character of the procedur number - // Prairie Island (NSP) Alarms use this token - int idx = 0; - while (idx < eopnum.Length && char.IsLetterOrDigit(eopnum[idx])) idx++; - if (idx < eopnum.Length) - eopnum = eopnum.Substring(0, idx); - } - plstr = plstr.Replace(token, eopnum); - break; - default: - if (token.Contains(@"SI-")) // procedure set specific information. (at folder or working draft levels) - { - DocVersionConfig dvConfig = new DocVersionConfig(section.MyProcedure.MyDocVersion.Config); - FolderConfig folderConfig = new FolderConfig(section.MyProcedure.MyDocVersion.MyFolder.Config); - if (dvConfig != null || folderConfig != null) - { - int indx = token.IndexOf("-"); - int qindx = token.IndexOf("?", indx); - string val = null; - if (qindx == -1) - { - val = DocVersionInfo.GetInheritedSIValue(section.MyProcedure, token.Substring(4, token.Length - 5)); - // C2021-051: Applicability tokens in Procedure Set and Folder Specific Information - if (val.ToUpper().Contains("") || val.ToUpper().Contains("") || val.ToUpper().Contains("') - if (val.ToUpper().Contains("") || val.ToUpper().Contains(" 3 && section.MyProcedure.DisplayNumber.IndexOf(",") > 0)// If extra commas combine first part to account for it - { - int n = parts.Length - 3; - string part0 = parts[0]; - for (int i = 0; i < n; i++) // append parts based upon the number of parts (commas) - part0 += "," + parts[i + 1]; - parts[0] = part0; - parts[1] = parts[n + 1];// Get the last 2 parts - parts[2] = parts[n + 2]; - } - string ROLookupVal = ""; - // parts[0] - the RO to look up - for Alarms, is usually the EOP number thus uses the "{EOPNUM}" token - // parts[1] - Which of the multiple return value from the RO to return - // parts[2] - the value to use if not found in ROs - usually defined in a PSI field for that Alarm procedure - - // C2021-065 Barakah Alarms - check if child RO alarm ID matches the resolved procedure number - // if not, then use the values stored in the PSI instead of the value returned for ROLookup() - // for all of the Alarm Point window items (ROLookup() items) in the pagelist for this section (BNPP Alarms format) - // Note only one pagelist item has this flag and this special pagelist item needs to be listed before any other ROLoopUP items - if (pageItem.ROLkUpMatch) // check for paglist flag - { - string rawPrcNum = section.MyProcedure.MyContent.Number; - // C2021-065 see if we need to get the Other child info from ROLookUp - if (rawPrcNum.ToUpper().StartsWith(" in its definiation (procedure property page) - { - string procnum = section.MyProcedure.DisplayNumber; // get the cooked (resolved) procedure number - int idx = procnum.IndexOf('-'); - otherChildUnit = procnum.Substring(0, idx); // we need to get RO info for the Other child applicability - this gets child's number - } - ROLookupVal = ROLookupForEditorView(section, parts[0], parts[1], ""); // will return empty string if alarm point is not found in RO database - usePSIvalue = (ROLookupVal == null || ROLookupVal.Length == 0);//!= section.MyProcedure.DisplayNumber); // use PSI value if child alarm ID not found or does not match resolved procedure number (alarm point) - } - // C2021-065 if usePSIvalue is true, then we know alarm point info is not in the RO database, so just use the default (PSI) value - if (usePSIvalue) - ROLookupVal = parts[2]; // C2021-065 use the value defined in the PSI - else - ROLookupVal = ROLookupForEditorView(section, parts[0], parts[1], parts[2]); - - // F2021-053: Do replace words for Page List items. This uses a DisplayText constructor that flags this case - // and gets the resulting replaced words - if (pageItem.RepWords) - { - DisplayText dt1 = new DisplayText(itmInfo, ROLookupVal, false, true); - ROLookupVal = dt1.StartText; - } - // replace the pagelist token with ROLookupVal - pltok = pltok.Substring(0, idxstart) + ROLookupVal + ((idxstart + idxend < pltok.Length) ? pltok.Substring(idxstart + idxend + 1) : ""); - } - // C2021-065 (BNPP Alarms format) we are processing a paglist flag (ROLkUpMatch) to determine how to get Alarm Point information - // Nothing else is on this page list item, so use "continue" to jump to the next pagelist item as nothing gets printed for this item - if (!pageItem.ROLkUpMatch && pageItem.ROLkUpInEditor) - { - // F2023-078 (displaying Alarm Point Table RO information on the edit screen) - // New logic is simplified to support both BNPP and Vogtle Units 3 & 4 alarms - if (bDoUnderline) - { - if (lastRow != -1) - strAlrmPtTableInfo.Append("\r\n"); - pltok = pltok.TrimEnd(':'); - strAlrmPtTableInfo.Append(string.Format("\\ul {0}\\ulnone : ", pltok)); - lastRow = (int)pageItem.Row; - } - else - strAlrmPtTableInfo.Append(pltok); - } - } - return strAlrmPtTableInfo.ToString(); - } - // C2021-018 used to display Alarm Point Table RO values in the editor - // we use a read-only note type, off of step section, to display the Alarm Point table RO information - // create the note if it does not exist, update if it does - // The docstyle for the step section must have the ShowAlarmPointWindowInfo flag - protected void SetupAlarmTableView(ItemInfo iteminfo) - { - if (iteminfo.IsStepSection && iteminfo.MyDocStyle.ShowAlarmPointWindowInfo) - { - string alrPtTblInfo = GetAlarmPointTableInfo(iteminfo); - if (!iteminfo.HasCautionOrNote) // BNPP Alarm format does not allow notes/cautions off of sections - { - ItemInfo tmpinfo = iteminfo.InsertChild(E_FromType.Note, 20028, alrPtTblInfo); - (tmpinfo.MyConfig as StepConfig).MasterSlave_Applicability = Volian.Base.Library.BigNum.MakeBigNum("0"); // set applicability to none - (tmpinfo.MyConfig as StepConfig).Step_CBOverride = "Off"; // turn of the change bar - MyItemInfo = tmpinfo; // SaveConfig() uses MyItemInfo which is null at this point, so set it to our new step item - SaveConfig(); - } - else - { - if (iteminfo.Notes != null && iteminfo.Notes[0] != null) - { - ContentInfo cntinfo = iteminfo.Notes[0].MyContent; - if (!cntinfo.Text.Equals(alrPtTblInfo)) - cntinfo.UpdateAlarmTableInfoView(alrPtTblInfo); // update with the new alarm point table information - } - } - } - } - protected void SetupEditItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem, bool addFirstChld) - { - if (myStepPanel.TopMostEditItem == null) myStepPanel.TopMostEditItem = this; - //if (itemInfo.ItemID == 10366) Console.WriteLine("Here"); - //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 - TabLeft = 20; - if (!itemInfo.IsStep) // C2025-036 reduce un-needed processing - this will prevent duplicat calls that generate step tabs when loading a procedure - SetupHeader(itemInfo); - SetupAlarmTableView(itemInfo); // C2021-018 display alarm point table information in the step editor (if the format flag is set) - this.Paint -= new PaintEventHandler(EditItem_Paint); - this.Paint += new PaintEventHandler(EditItem_Paint); - this.BackColorChanged -= new EventHandler(EditItem_BackColorChanged); - this.BackColorChanged += new EventHandler(EditItem_BackColorChanged); - this.Move -= new EventHandler(EditItem_Move); - this.Move += new EventHandler(EditItem_Move); - this.Resize -= new EventHandler(EditItem_Resize); - this.Resize += new EventHandler(EditItem_Resize); - if (itemInfo != null) - { - ContentType = (int)itemInfo.MyContent.Type; - switch (ContentType / 10000) - { - case 0: // Procedure - ContentFont = myStepPanel.ProcFont;// lblTab.Font = myStepPanel.ProcFont; - TabFont = itemInfo.MyTab.MyFont.WindowsFont; - break; - case 1: // Section - ContentFont = myStepPanel.SectFont;// lblTab.Font = myStepPanel.SectFont; - TabFont = itemInfo.MyTab.MyFont.WindowsFont; - break; - case 2: // Steps - // Fix for B2016-037: there were ''s in saved content text. This was caused by a bug in code that - // did not resolve these correctly if there was more than 1 in the text. So if, when loading the text, this - // is found, resolve them: - if (itemInfo.MyContent.Text.Contains("")) - { - DisplayText vlntxt = new DisplayText(itemInfo, E_EditPrintMode.Edit, E_ViewMode.Edit, false, E_FieldToEdit.StepText, true, null, null, false); - vlntxt.SetDTS = false; - vlntxt.CleanUpNewIDs(); - vlntxt = null; - } - ContentFont = myStepPanel.StepFont;//lblTab.Font = myStepPanel.StepFont; - if (itemInfo.MyTab != null) TabFont = itemInfo.MyTab.MyFont.WindowsFont; - MyStepData = itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[ContentType % 10000]; - break; - } - //this.Move += new EventHandler(DisplayItem_Move); - } - else - { - if (myStepPanel.MyFont != null) ContentFont = TabFont = myStepPanel.MyFont; - } - if (expand) ShowExpanded(); - MyStepPanel = myStepPanel; - if (itemInfo != null && !myStepPanel._LookupEditItems.ContainsKey(itemInfo.ItemID)) 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); - 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, addFirstChld); - break; - case ChildRelation.Before: - AddItem(myParentEditItem, ref myParentEditItem._MyBeforeEditItems, nextEditItem, addFirstChld); - break; - case ChildRelation.RNO: - RNOLevel = myParentEditItem.RNOLevel + 1; - AddItem(myParentEditItem, ref myParentEditItem._MyRNOEditItems, nextEditItem, addFirstChld); - break; - case ChildRelation.SupInfo: - AddItem(myParentEditItem, ref myParentEditItem._MySupInfoEditItems, nextEditItem, addFirstChld); - break; - case ChildRelation.None: - break; - } - if (itemInfo != null) - { - // ip2bck's needed the ContentWidth set to get the edit windows to size correctly. - if (itemInfo.IsStep && itemInfo.FormatStepData.Type == "TitleWithTextBelow" && - ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd)) - ContentWidth = myParentEditItem.ContentWidth; - if (itemInfo.IsStep && itemInfo.MyParent.IsFigure) - { - // B2018-076 _ Handle Multiple Tables or Figure where Parent is null and Previous is not null - EditItem mypar = myParentEditItem; - while (mypar.MyParentEditItem == null && mypar.MyPreviousEditItem != null) - mypar = mypar.MyPreviousEditItem; - ContentWidth = mypar.MyParentEditItem.ContentWidth; - Left = mypar.MyParentEditItem.Left + mypar.MyParentEditItem.TabLeft; // B2017-129 fixed null reference - } - - if (myChildRelation == ChildRelation.None) - { - if (ContentType == 0 && MyStepSectionLayoutData != null) - { - LastMethodsPush(string.Format("SetupRTBItem {0}", MyID)); - int widt = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT); - int wids = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0); - ItemWidth = Math.Max(widt, wids); - } - } - } - //// TIMING: DisplayItem.TimeIt("CSLARTB Parent"); - - //C2026-021 Expand Functionality of Viewing Mode - if (MyStepPanel.ApplDisplayMode > 0) - MyItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave = MyStepPanel.ApplDisplayMode; - else - MyItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave = 0; - - SetText(); - if (itemInfo.IsSupInfoPart) - { - EditItem high = MyStepPanel._LookupEditItems[itemInfo.MyHLS.ItemID]; - ContentLocation = new Point(high.ContentLeft + high.Width + 36, (int)_MyParentEditItem.Top + SupInfoTopOffset); - } - // B2020-012: table location for sibling table is not correct, and possible first table. - if (itemInfo.IsTable) ItemLocation = TableLocation(MyStepSectionLayoutData, this.Width); - //// 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); - // If on the first Caution/Note and the parent has a previous, for example a caution off of 5th HLS, go to the - // bottom on the previous parent. In the example, the bottom of the 4th HLS. - int btm = myStepPanel.DisplayRectangle.Y; - int top = FindTop(btm); - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) - if (MyItemInfo.IsCaution || MyItemInfo.IsNote) - top = myParentEditItem.TopMostEditItem.Top; - //if ((MyItemInfo.SameRowAsParent && MyItemInfo.IsCaution2) || (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && (MyItemInfo.IsCaution || MyItemInfo.IsNote))) - // top = myParentEditItem.TopMostEditItem.Top; - if (Top < top) - { - LastMethodsPush("SetupRTBItem"); - MyStepPanel.ItemMoving++; - Top = top; - MyStepPanel.ItemMoving--; - LastMethodsPop(); - } - this.Enabled = this.MyItemInfo.IsApplicable(MyStepPanel.ApplDisplayMode); - _Loading = false; - //// TIMING: DisplayItem.TimeIt("CSLARTB Controls Add"); - } - void MyConfig_PropertyChanged(object sender, PropertyChangedEventArgs e) - { - //B2026-024 Change bars should not show when updating Applicability. - if (e.PropertyName == "MasterSlave_Applicability") ChangeBarForConfigItemChange = false; - SaveConfig(); - if (e.PropertyName == "MasterSlave_Applicability") ChangeBarForConfigItemChange = true; - } - public void SaveConfig() - { - if (!MyItemInfo.MyConfig.IsDirty) return; - using (Item itm = MyItemInfo.Get()) - { - itm.MyContent.Config = MyItemInfo.MyConfig.ToString(); - if (ChangeBarForConfigItemChange) - itm.MyContent.DTS = DateTime.Now; - itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; - itm.Save(); - } - MyItemInfo.MyConfig.IsDirty = false; - } - /// - /// If the background changes, change the background of the RichTextBox - /// - /// - /// - void EditItem_BackColorChanged(object sender, EventArgs e) - { - //IdentifyMe(false); - } - // TODO: the format of the circles, Checkoffs and Changebars should come from the format file - /// - /// This adds drawing items to the RTBItem as needed including - /// Circle around the Tab Number - /// Check-Offs - /// Change Bars - /// - /// - /// - private void EditItem_Paint(object sender, PaintEventArgs e) - { - Graphics g = e.Graphics; - g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; - //g.DrawString(lblTab.Text, MyItemInfo.MyTab.MyFont.WindowsFont, Brushes.Red, new RectangleF(new PointF(MyStepPanel.MyStepPanelSettings.NumberLocationX, MyStepPanel.MyStepPanelSettings.NumberLocationY), MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault); - // adjust x location of label by 7, to position correctly. - //g.DrawString(lblTab.Text, MyItemInfo.MyTab.MyFont.WindowsFont, Brushes.Blue, new RectangleF(new PointF(Convert.ToSingle(lblTab.Location.X-7), Convert.ToSingle(lblTab.Location.Y)), MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault); - //g.DrawLine(Pens.DarkGreen, lblTab.Location.X-7, 0, lblTab.Location.X-7, this.Height); - // Show a small E to indicate Enhanced Steps - DVEnhancedDocuments dveds = MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments; - float x = 0; - float y = 0; - foreach (EnhancedDocument ed in MyItemInfo.GetMyEnhancedDocuments()) - { - DVEnhancedDocument dved = dveds.GetByType(ed.Type); - // 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 - // window handle B2017-117 - Font fnt = VE_Font.GetWinSysFont("Arial", 5); - //g.DrawLine(Pens.DarkGreen, 18, 1, 18, 6); - //g.DrawLine(Pens.DarkGreen, 18, 1, 21, 1); - //g.DrawLine(Pens.DarkGreen, 18, 3, 21, 3); - //g.DrawLine(Pens.DarkGreen, 18, 6, 21, 6); - //g.DrawString("B", fnt, Brushes.Green, new RectangleF(new PointF(0,0), this.Size), StringFormat.GenericDefault); - g.DrawString(dved.PdfToken, fnt, Brushes.Green, new RectangleF(new PointF(x, y), this.Size), StringFormat.GenericDefault); - if (y > 0) - { - x += 18; - y = 0; - } - else - y = 14; - } - //g.DrawLine(Pens.DarkGreen, MyStepRTB.Location.X - 7, 0, MyStepRTB.Location.X - 7, this.Height); - //g.DrawString(TabText, MyItemInfo.MyTab.MyFont.WindowsFont, Brushes.Black, new RectangleF(new PointF(Convert.ToSingle(TabLocation.X), Convert.ToSingle(TabLocation.Y)), MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault); - Font myWFont = (MyItemInfo.MyTab != null) ? MyItemInfo.MyTab.MyFont.WindowsFont : MyItemInfo.FormatStepData.Font.WindowsFont; - - // added Try/Catch when working on B2017-143, kept in to prevent PROMS from crashing after printing a procedure that has a seq tab with a different font style - try - { - g.DrawString(TabText, myWFont, Brushes.Black, new RectangleF(new PointF(Convert.ToSingle(TabLocation.X), Convert.ToSingle(TabLocation.Y)), this.Size), StringFormat.GenericDefault); - } - catch (Exception ex) - { - _MyLog.Warn("EditItem DrawString", ex); - } - - //g.DrawLine(Pens.DarkGreen, lblTab.Location.X, 0, lblTab.Location.X, this.Height); - //g.DrawLine(Pens.DarkGreen, MyStepRTB.Location.X, 0, MyStepRTB.Location.X, this.Height); - if (Circle) - { - Pen penC = new Pen(MyStepPanel.MyStepPanelSettings.CircleColor, MyStepPanel.MyStepPanelSettings.CircleWeight); - g.DrawArc(penC, TabLeft + 1, 0, MyStepPanel.MyStepPanelSettings.CircleDiameter, MyStepPanel.MyStepPanelSettings.CircleDiameter, 0F, 360F); - } - if (CheckOff) - { - Pen penCO = new Pen(MyStepPanel.MyStepPanelSettings.CheckOffColor, MyStepPanel.MyStepPanelSettings.CheckOffWeight); - g.DrawRectangle(penCO, MyStepPanel.MyStepPanelSettings.CheckOffX, MyStepPanel.MyStepPanelSettings.CheckOffY, MyStepPanel.MyStepPanelSettings.CheckOffSize, MyStepPanel.MyStepPanelSettings.CheckOffSize); - } - if (ChangeBar) - { - Pen penCB = new Pen(MyStepPanel.MyStepPanelSettings.ChangeBarColor, MyStepPanel.MyStepPanelSettings.ChangeBarWeight); - if (ChangeBarPosition == E_ChangeBarPosition.Left) - g.DrawLine(penCB, 0, ContentTop, 0, Height); // left, top, right, bottom. - else - { - float X; - float H; - if (this is GridItem) - { - GridItem gi = this as GridItem; - X = gi.MyFlexGrid.Right + 2; - H = gi.MyFlexGrid.Height; - } - else if (this is RtfRawItem) - { - RtfRawItem ri = this as RtfRawItem; - X = ri.MyStepRTB.Right + 4; - H = ri.MyStepRTB.Height; - } - else if (this is ImageItem) - { - ImageItem ii = this as ImageItem; - X = ii.MyPictureBox.Right + 4; - H = ii.MyPictureBox.Height; - } - else - { - RTBItem ri = this as RTBItem; - X = ri.MyStepRTB.Right + 2; - H = ri.MyStepRTB.Height; - } - g.DrawLine(penCB, X, ContentTop, X, ContentTop + H); //Height); - } - } - if (UserCheckOff) - { - PointF location; - if (this is GridItem) - { - GridItem gi = this as GridItem; - location = new PointF(gi.MyFlexGrid.Left + gi.MyFlexGrid.Width + 2, gi.MyFlexGrid.Top); - } - else if (this is RtfRawItem) - { - RtfRawItem rr = this as RtfRawItem; - // SkipSpaces puts the checkoff macro (if specified in the format) next to the step tab - // this is used for Bryon and Braidwood - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.SkipSpaces) - location = new PointF(rr.MyStepRTB.Left - 50, rr.MyStepRTB.Top); - else - location = new PointF(rr.MyStepRTB.Left + rr.MyStepRTB.Width + 2, rr.MyStepRTB.Top); - } - else if (this is ImageItem) - { - ImageItem ii = this as ImageItem; - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.SkipSpaces) - location = new PointF(ii.MyPictureBox.Left - 50, ii.MyPictureBox.Top); - else - location = new PointF(ii.MyPictureBox.Left + ii.MyPictureBox.Width + 2, ii.MyPictureBox.Top); - } - else - { - RTBItem ri = this as RTBItem; - // SkipSpaces puts the checkoff macro (if specified in the format) next to the step tab - // this is used for Bryon and Braidwood - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.SkipSpaces) - location = new PointF(ri.MyStepRTB.Left - 50, ri.MyStepRTB.Top); - else - location = new PointF(ri.MyStepRTB.Left + ri.MyStepRTB.Width + 2, ri.MyStepRTB.Top); - } - CheckOff co = MyItemInfo.GetCheckOffStep(); - // There may have been a data change in the setting of which checkoff to use (property - // change in the config data), or whether a checkoff is used at all. Need to set the - // 'UserCheckOff' or 'UserCheckOffChar' properties to reflect that. - if (co != null && co.UIMark != null) - { - UserCheckOffChar = (char)co.UIMark; - Font myFont = new Font("VolianDraw", MyItemInfo.MyTab.MyFont.WindowsFont.Size); - g.DrawString(UserCheckOffChar.ToString(), myFont, Brushes.DarkGreen, new RectangleF(location, MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault); - } - else if (co == null) UserCheckOff = false; - } - } - } -} diff --git a/PROMS/Volian.Controls.Library/FindReplace.Designer.cs b/PROMS/Volian.Controls.Library/FindReplace.Designer.cs deleted file mode 100644 index f564744f..00000000 --- a/PROMS/Volian.Controls.Library/FindReplace.Designer.cs +++ /dev/null @@ -1,616 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class FindReplace - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (cmboFindText.Items.Count == 0) - Properties.Settings.Default["FindTextList"] = null; - else - { - System.Collections.Specialized.StringCollection lstfnd = new System.Collections.Specialized.StringCollection(); - foreach (string str in cmboFindText.Items) - lstfnd.Add(str); - Properties.Settings.Default.FindTextList = lstfnd; - } - if (cmboReplaceText.Items.Count == 0) - Properties.Settings.Default["ReplaceTextList"] = null; - else - { - System.Collections.Specialized.StringCollection lstrpl = new System.Collections.Specialized.StringCollection(); - foreach (string str in cmboReplaceText.Items) - lstrpl.Add(str); - Properties.Settings.Default.ReplaceTextList = lstrpl; - } - Properties.Settings.Default.Save(); - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FindReplace)); - this.btnReplace = new DevComponents.DotNetBar.ButtonX(); - this.btnFndRplDone = new DevComponents.DotNetBar.ButtonX(); - this.btnFindNext = new DevComponents.DotNetBar.ButtonX(); - this.cmboReplaceText = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.lblRplTxt = new DevComponents.DotNetBar.LabelX(); - this.cmboFindText = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.labelX3 = new DevComponents.DotNetBar.LabelX(); - this.btnRplAll = new DevComponents.DotNetBar.ButtonX(); - this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); - this.contextMenuBar1 = new DevComponents.DotNetBar.ContextMenuBar(); - this.btnCmFndRpl = new DevComponents.DotNetBar.ButtonItem(); - this.btnCmEdit = new DevComponents.DotNetBar.ButtonItem(); - this.btnCmCut = new DevComponents.DotNetBar.ButtonItem(); - this.btnCmCopy = new DevComponents.DotNetBar.ButtonItem(); - this.btnCmPaste = new DevComponents.DotNetBar.ButtonItem(); - this.btnCmInsert = new DevComponents.DotNetBar.ButtonItem(); - this.btnCmHardSp = new DevComponents.DotNetBar.ButtonItem(); - this.btnCmSymbol = new DevComponents.DotNetBar.ButtonItem(); - this.galSymbols = new DevComponents.DotNetBar.GalleryContainer(); - this.cbxReverse = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxWholeWord = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbxCaseSensitive = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cmbScope = new DevComponents.DotNetBar.Controls.ComboBoxEx(); - this.comboItem1 = new DevComponents.Editors.ComboItem(); - this.comboItem2 = new DevComponents.Editors.ComboItem(); - this.comboItem3 = new DevComponents.Editors.ComboItem(); - this.comboItem4 = new DevComponents.Editors.ComboItem(); - this.labelX1 = new DevComponents.DotNetBar.LabelX(); - this.btnBookMrkAll = new DevComponents.DotNetBar.ButtonX(); - this.tabControl1 = new DevComponents.DotNetBar.TabControl(); - this.tabControlPanel1 = new DevComponents.DotNetBar.TabControlPanel(); - this.tabFind = new DevComponents.DotNetBar.TabItem(this.components); - this.tabControlPanel2 = new DevComponents.DotNetBar.TabControlPanel(); - this.tabReplace = new DevComponents.DotNetBar.TabItem(this.components); - this.panelEx1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.contextMenuBar1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.tabControl1)).BeginInit(); - this.tabControl1.SuspendLayout(); - this.SuspendLayout(); - // - // btnReplace - // - this.btnReplace.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnReplace.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnReplace.Location = new System.Drawing.Point(200, 149); - this.btnReplace.Margin = new System.Windows.Forms.Padding(2); - this.btnReplace.Name = "btnReplace"; - this.btnReplace.Size = new System.Drawing.Size(56, 28); - this.btnReplace.TabIndex = 9; - this.btnReplace.Text = "Replace"; - this.btnReplace.Tooltip = "Replace Text and\r\nStay where you are"; - this.btnReplace.Visible = false; - this.btnReplace.Click += new System.EventHandler(this.btnReplace_Click); - // - // btnFndRplDone - // - this.btnFndRplDone.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnFndRplDone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnFndRplDone.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnFndRplDone.Location = new System.Drawing.Point(368, 149); - this.btnFndRplDone.Margin = new System.Windows.Forms.Padding(2); - this.btnFndRplDone.Name = "btnFndRplDone"; - this.btnFndRplDone.Size = new System.Drawing.Size(56, 27); - this.btnFndRplDone.TabIndex = 11; - this.btnFndRplDone.Text = "Done"; - this.btnFndRplDone.Tooltip = "Close this dialog"; - this.btnFndRplDone.Click += new System.EventHandler(this.btnFndRplDone_Click); - // - // btnFindNext - // - this.btnFindNext.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnFindNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnFindNext.Location = new System.Drawing.Point(8, 149); - this.btnFindNext.Margin = new System.Windows.Forms.Padding(2); - this.btnFindNext.Name = "btnFindNext"; - this.btnFindNext.Size = new System.Drawing.Size(56, 27); - this.btnFindNext.TabIndex = 7; - this.btnFindNext.Text = "Find Next"; - this.btnFindNext.Tooltip = "Go To the Next\r\nFound Location"; - this.btnFindNext.Click += new System.EventHandler(this.btnFindNext_Click); - // - // cmboReplaceText - // - this.cmboReplaceText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.contextMenuBar1.SetContextMenuEx(this.cmboReplaceText, this.btnCmFndRpl); - this.cmboReplaceText.DisplayMember = "Text"; - this.cmboReplaceText.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.cmboReplaceText.FormattingEnabled = true; - this.cmboReplaceText.ItemHeight = 15; - this.cmboReplaceText.Location = new System.Drawing.Point(83, 41); - this.cmboReplaceText.Margin = new System.Windows.Forms.Padding(2); - this.cmboReplaceText.MaxDropDownItems = 10; - this.cmboReplaceText.Name = "cmboReplaceText"; - this.cmboReplaceText.Size = new System.Drawing.Size(345, 21); - this.cmboReplaceText.TabIndex = 2; - this.cmboReplaceText.Visible = false; - this.cmboReplaceText.WatermarkFont = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cmboReplaceText.WatermarkText = "Enter replace text"; - this.cmboReplaceText.TextChanged += new System.EventHandler(this.cmboReplaceText_TextChanged); - // - // lblRplTxt - // - // - // - // - this.lblRplTxt.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.lblRplTxt.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblRplTxt.Location = new System.Drawing.Point(4, 40); - this.lblRplTxt.Margin = new System.Windows.Forms.Padding(2); - this.lblRplTxt.Name = "lblRplTxt"; - this.lblRplTxt.Size = new System.Drawing.Size(79, 23); - this.lblRplTxt.TabIndex = 6; - this.lblRplTxt.Text = "Replace Text:"; - this.lblRplTxt.Visible = false; - // - // cmboFindText - // - this.cmboFindText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.contextMenuBar1.SetContextMenuEx(this.cmboFindText, this.btnCmFndRpl); - this.cmboFindText.DisplayMember = "Text"; - this.cmboFindText.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.cmboFindText.FormattingEnabled = true; - this.cmboFindText.ItemHeight = 15; - this.cmboFindText.Location = new System.Drawing.Point(83, 8); - this.cmboFindText.Margin = new System.Windows.Forms.Padding(2); - this.cmboFindText.MaxDropDownItems = 10; - this.cmboFindText.Name = "cmboFindText"; - this.cmboFindText.Size = new System.Drawing.Size(345, 21); - this.cmboFindText.TabIndex = 1; - this.cmboFindText.WatermarkFont = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cmboFindText.WatermarkText = "Enter text to find"; - this.cmboFindText.TextChanged += new System.EventHandler(this.cmboFindText_TextChanged); - // - // labelX3 - // - // - // - // - this.labelX3.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.labelX3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelX3.Location = new System.Drawing.Point(22, 8); - this.labelX3.Margin = new System.Windows.Forms.Padding(2); - this.labelX3.Name = "labelX3"; - this.labelX3.Size = new System.Drawing.Size(56, 21); - this.labelX3.TabIndex = 8; - this.labelX3.Text = "Find Text: "; - // - // btnRplAll - // - this.btnRplAll.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnRplAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnRplAll.Location = new System.Drawing.Point(261, 149); - this.btnRplAll.Margin = new System.Windows.Forms.Padding(2); - this.btnRplAll.Name = "btnRplAll"; - this.btnRplAll.Size = new System.Drawing.Size(80, 28); - this.btnRplAll.TabIndex = 10; - this.btnRplAll.Text = "Replace ..."; - this.btnRplAll.Tooltip = "Replace Text Then \r\nGo To Next Location"; - this.btnRplAll.Visible = false; - this.btnRplAll.Click += new System.EventHandler(this.btnRplAll_Click); - // - // panelEx1 - // - this.panelEx1.CanvasColor = System.Drawing.Color.Transparent; - this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.panelEx1.Controls.Add(this.contextMenuBar1); - this.panelEx1.Controls.Add(this.cbxReverse); - this.panelEx1.Controls.Add(this.cbxWholeWord); - this.panelEx1.Controls.Add(this.cbxCaseSensitive); - this.panelEx1.Controls.Add(this.cmbScope); - this.panelEx1.Controls.Add(this.labelX1); - this.panelEx1.Controls.Add(this.labelX3); - this.panelEx1.Controls.Add(this.lblRplTxt); - this.panelEx1.Controls.Add(this.cmboReplaceText); - this.panelEx1.Controls.Add(this.cmboFindText); - this.panelEx1.DisabledBackColor = System.Drawing.Color.Empty; - this.panelEx1.Dock = System.Windows.Forms.DockStyle.Top; - this.panelEx1.Location = new System.Drawing.Point(0, 19); - this.panelEx1.Margin = new System.Windows.Forms.Padding(2); - this.panelEx1.Name = "panelEx1"; - this.panelEx1.Size = new System.Drawing.Size(437, 124); - this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center; - this.panelEx1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(237)))), ((int)(((byte)(254))))); - this.panelEx1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(142)))), ((int)(((byte)(179)))), ((int)(((byte)(231))))); - this.panelEx1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.panelEx1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(97)))), ((int)(((byte)(156))))); - this.panelEx1.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.panelEx1.Style.GradientAngle = 90; - this.panelEx1.TabIndex = 15; - // - // contextMenuBar1 - // - this.contextMenuBar1.AntiAlias = true; - this.contextMenuBar1.DockSide = DevComponents.DotNetBar.eDockSide.Top; - this.contextMenuBar1.Font = new System.Drawing.Font("Segoe UI", 9F); - this.contextMenuBar1.IsMaximized = false; - this.contextMenuBar1.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this.btnCmFndRpl}); - this.contextMenuBar1.Location = new System.Drawing.Point(115, 68); - this.contextMenuBar1.Margin = new System.Windows.Forms.Padding(2); - this.contextMenuBar1.Name = "contextMenuBar1"; - this.contextMenuBar1.Size = new System.Drawing.Size(56, 25); - this.contextMenuBar1.Stretch = true; - this.contextMenuBar1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.contextMenuBar1.TabIndex = 13; - this.contextMenuBar1.TabStop = false; - this.contextMenuBar1.Text = "contextMenuBar1"; - // - // btnCmFndRpl - // - this.btnCmFndRpl.AutoExpandOnClick = true; - this.btnCmFndRpl.Name = "btnCmFndRpl"; - this.btnCmFndRpl.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this.btnCmEdit, - this.btnCmInsert}); - this.btnCmFndRpl.Text = "cmFndRpl"; - // - // btnCmEdit - // - this.btnCmEdit.Name = "btnCmEdit"; - this.btnCmEdit.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this.btnCmCut, - this.btnCmCopy, - this.btnCmPaste}); - this.btnCmEdit.Text = "Edit"; - // - // btnCmCut - // - this.btnCmCut.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; - this.btnCmCut.Image = global::Volian.Controls.Library.Properties.Resources.Cut_Image; - this.btnCmCut.Name = "btnCmCut"; - this.btnCmCut.Text = "Cut"; - this.btnCmCut.Click += new System.EventHandler(this.btnCmCut_Click); - // - // btnCmCopy - // - this.btnCmCopy.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; - this.btnCmCopy.Image = global::Volian.Controls.Library.Properties.Resources.Copy_Image; - this.btnCmCopy.Name = "btnCmCopy"; - this.btnCmCopy.Text = "Copy"; - this.btnCmCopy.Click += new System.EventHandler(this.btnCmCopy_Click); - // - // btnCmPaste - // - this.btnCmPaste.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; - this.btnCmPaste.Image = global::Volian.Controls.Library.Properties.Resources.PasteSmall_Image; - this.btnCmPaste.Name = "btnCmPaste"; - this.btnCmPaste.Text = "Paste"; - this.btnCmPaste.Click += new System.EventHandler(this.btnCmPaste_Click); - // - // btnCmInsert - // - this.btnCmInsert.Name = "btnCmInsert"; - this.btnCmInsert.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this.btnCmHardSp, - this.btnCmSymbol}); - this.btnCmInsert.Text = "Insert"; - // - // btnCmHardSp - // - this.btnCmHardSp.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; - this.btnCmHardSp.Image = global::Volian.Controls.Library.Properties.Resources.HardSpace_Image; - this.btnCmHardSp.Name = "btnCmHardSp"; - this.btnCmHardSp.Text = "Hard Space"; - this.btnCmHardSp.Click += new System.EventHandler(this.btnCmHardSp_Click); - // - // btnCmSymbol - // - this.btnCmSymbol.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; - this.btnCmSymbol.Image = global::Volian.Controls.Library.Properties.Resources.Symbol_Image; - this.btnCmSymbol.Name = "btnCmSymbol"; - this.btnCmSymbol.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { - this.galSymbols}); - this.btnCmSymbol.Text = "Symbol"; - // - // galSymbols - // - // - // - // - this.galSymbols.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.galSymbols.EnableGalleryPopup = false; - this.galSymbols.MinimumSize = new System.Drawing.Size(150, 200); - this.galSymbols.Name = "galSymbols"; - this.galSymbols.Text = "galleryContainer1"; - // - // - // - this.galSymbols.TitleMouseOverStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.galSymbols.TitleStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // cbxReverse - // - // - // - // - this.cbxReverse.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxReverse.Location = new System.Drawing.Point(8, 103); - this.cbxReverse.Margin = new System.Windows.Forms.Padding(2); - this.cbxReverse.Name = "cbxReverse"; - this.cbxReverse.Size = new System.Drawing.Size(103, 19); - this.cbxReverse.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.cbxReverse.TabIndex = 5; - this.cbxReverse.Text = "Reverse Find"; - this.cbxReverse.CheckedChanged += new System.EventHandler(this.cbxReverse_CheckedChanged); - // - // cbxWholeWord - // - // - // - // - this.cbxWholeWord.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxWholeWord.Location = new System.Drawing.Point(8, 84); - this.cbxWholeWord.Margin = new System.Windows.Forms.Padding(2); - this.cbxWholeWord.Name = "cbxWholeWord"; - this.cbxWholeWord.Size = new System.Drawing.Size(94, 22); - this.cbxWholeWord.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.cbxWholeWord.TabIndex = 4; - this.cbxWholeWord.Text = "Whole Word"; - this.cbxWholeWord.CheckedChanged += new System.EventHandler(this.cbxWholeWord_CheckedChanged); - // - // cbxCaseSensitive - // - // - // - // - this.cbxCaseSensitive.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxCaseSensitive.Location = new System.Drawing.Point(8, 68); - this.cbxCaseSensitive.Margin = new System.Windows.Forms.Padding(2); - this.cbxCaseSensitive.Name = "cbxCaseSensitive"; - this.cbxCaseSensitive.Size = new System.Drawing.Size(103, 19); - this.cbxCaseSensitive.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.cbxCaseSensitive.TabIndex = 3; - this.cbxCaseSensitive.Text = "Case Sensitive"; - this.cbxCaseSensitive.CheckedChanged += new System.EventHandler(this.cbxCaseSensitive_CheckedChanged); - // - // cmbScope - // - this.cmbScope.DisplayMember = "Text"; - this.cmbScope.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.cmbScope.FormattingEnabled = true; - this.cmbScope.ItemHeight = 16; - this.cmbScope.Items.AddRange(new object[] { - this.comboItem1, - this.comboItem2, - this.comboItem3, - this.comboItem4}); - this.cmbScope.Location = new System.Drawing.Point(236, 84); - this.cmbScope.Margin = new System.Windows.Forms.Padding(2); - this.cmbScope.Name = "cmbScope"; - this.cmbScope.Size = new System.Drawing.Size(187, 22); - this.cmbScope.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.cmbScope.TabIndex = 6; - this.cmbScope.Visible = false; - // - // comboItem1 - // - this.comboItem1.Text = "Current Section"; - // - // comboItem2 - // - this.comboItem2.Text = "Current Procedure"; - // - // comboItem3 - // - this.comboItem3.Text = "Current Tabs"; - // - // comboItem4 - // - this.comboItem4.Text = "Current Set"; - // - // labelX1 - // - // - // - // - this.labelX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.labelX1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelX1.Location = new System.Drawing.Point(190, 84); - this.labelX1.Margin = new System.Windows.Forms.Padding(2); - this.labelX1.Name = "labelX1"; - this.labelX1.Size = new System.Drawing.Size(42, 19); - this.labelX1.TabIndex = 12; - this.labelX1.Text = "Scope:"; - this.labelX1.Visible = false; - // - // btnBookMrkAll - // - this.btnBookMrkAll.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnBookMrkAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnBookMrkAll.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnBookMrkAll.Location = new System.Drawing.Point(100, 149); - this.btnBookMrkAll.Margin = new System.Windows.Forms.Padding(2); - this.btnBookMrkAll.Name = "btnBookMrkAll"; - this.btnBookMrkAll.Size = new System.Drawing.Size(70, 27); - this.btnBookMrkAll.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnBookMrkAll.TabIndex = 8; - this.btnBookMrkAll.Text = "Bookmark All"; - this.btnBookMrkAll.Tooltip = "Add a PROMS Bookmark\r\nFor Each Found Location"; - this.btnBookMrkAll.Click += new System.EventHandler(this.btnBookMrkAll_Click); - // - // tabControl1 - // - this.tabControl1.BackColor = System.Drawing.Color.White; - this.tabControl1.CanReorderTabs = true; - this.tabControl1.ColorScheme.TabItemBackgroundColorBlend.AddRange(new DevComponents.DotNetBar.BackgroundColorBlend[] { - new DevComponents.DotNetBar.BackgroundColorBlend(System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(230)))), ((int)(((byte)(249))))), 0F), - new DevComponents.DotNetBar.BackgroundColorBlend(System.Drawing.Color.FromArgb(((int)(((byte)(199)))), ((int)(((byte)(220)))), ((int)(((byte)(248))))), 0.45F), - new DevComponents.DotNetBar.BackgroundColorBlend(System.Drawing.Color.FromArgb(((int)(((byte)(179)))), ((int)(((byte)(208)))), ((int)(((byte)(245))))), 0.45F), - new DevComponents.DotNetBar.BackgroundColorBlend(System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(229)))), ((int)(((byte)(247))))), 1F)}); - this.tabControl1.ColorScheme.TabItemHotBackgroundColorBlend.AddRange(new DevComponents.DotNetBar.BackgroundColorBlend[] { - new DevComponents.DotNetBar.BackgroundColorBlend(System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(253)))), ((int)(((byte)(235))))), 0F), - new DevComponents.DotNetBar.BackgroundColorBlend(System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(236)))), ((int)(((byte)(168))))), 0.45F), - new DevComponents.DotNetBar.BackgroundColorBlend(System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(218)))), ((int)(((byte)(89))))), 0.45F), - new DevComponents.DotNetBar.BackgroundColorBlend(System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(230)))), ((int)(((byte)(141))))), 1F)}); - this.tabControl1.ColorScheme.TabItemSelectedBackground2 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); - this.tabControl1.ColorScheme.TabItemSelectedBackgroundColorBlend.AddRange(new DevComponents.DotNetBar.BackgroundColorBlend[] { - new DevComponents.DotNetBar.BackgroundColorBlend(System.Drawing.Color.White, 0F), - new DevComponents.DotNetBar.BackgroundColorBlend(System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))), 0.45F), - new DevComponents.DotNetBar.BackgroundColorBlend(System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))), 0.45F), - new DevComponents.DotNetBar.BackgroundColorBlend(System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))), 1F)}); - this.tabControl1.Controls.Add(this.tabControlPanel2); - this.tabControl1.Controls.Add(this.tabControlPanel1); - this.tabControl1.Dock = System.Windows.Forms.DockStyle.Top; - this.tabControl1.Location = new System.Drawing.Point(0, 0); - this.tabControl1.Margin = new System.Windows.Forms.Padding(2); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedTabFont = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.tabControl1.SelectedTabIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(437, 19); - this.tabControl1.Style = DevComponents.DotNetBar.eTabStripStyle.Office2007Document; - this.tabControl1.TabIndex = 14; - this.tabControl1.TabLayoutType = DevComponents.DotNetBar.eTabLayoutType.FixedWithNavigationBox; - this.tabControl1.Tabs.Add(this.tabFind); - this.tabControl1.Tabs.Add(this.tabReplace); - this.tabControl1.Text = "tabControl1"; - // - // tabControlPanel1 - // - this.tabControlPanel1.DisabledBackColor = System.Drawing.Color.Empty; - this.tabControlPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControlPanel1.Location = new System.Drawing.Point(0, 22); - this.tabControlPanel1.Margin = new System.Windows.Forms.Padding(2); - this.tabControlPanel1.Name = "tabControlPanel1"; - this.tabControlPanel1.Padding = new System.Windows.Forms.Padding(1); - this.tabControlPanel1.Size = new System.Drawing.Size(437, 0); - this.tabControlPanel1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))); - this.tabControlPanel1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227))))); - this.tabControlPanel1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.tabControlPanel1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199))))); - this.tabControlPanel1.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right) - | DevComponents.DotNetBar.eBorderSide.Bottom))); - this.tabControlPanel1.Style.GradientAngle = 90; - this.tabControlPanel1.TabIndex = 1; - this.tabControlPanel1.TabItem = this.tabFind; - // - // tabFind - // - this.tabFind.AttachedControl = this.tabControlPanel1; - this.tabFind.Name = "tabFind"; - this.tabFind.Text = "Find"; - this.tabFind.Click += new System.EventHandler(this.tabFind_Click); - // - // tabControlPanel2 - // - this.tabControlPanel2.DisabledBackColor = System.Drawing.Color.Empty; - this.tabControlPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControlPanel2.Location = new System.Drawing.Point(0, 22); - this.tabControlPanel2.Margin = new System.Windows.Forms.Padding(2); - this.tabControlPanel2.Name = "tabControlPanel2"; - this.tabControlPanel2.Padding = new System.Windows.Forms.Padding(1); - this.tabControlPanel2.Size = new System.Drawing.Size(437, 0); - this.tabControlPanel2.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))); - this.tabControlPanel2.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227))))); - this.tabControlPanel2.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.tabControlPanel2.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199))))); - this.tabControlPanel2.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right) - | DevComponents.DotNetBar.eBorderSide.Bottom))); - this.tabControlPanel2.Style.GradientAngle = 90; - this.tabControlPanel2.TabIndex = 2; - this.tabControlPanel2.TabItem = this.tabReplace; - // - // tabReplace - // - this.tabReplace.AttachedControl = this.tabControlPanel2; - this.tabReplace.Name = "tabReplace"; - this.tabReplace.Text = "Replace"; - this.tabReplace.Click += new System.EventHandler(this.tabReplace_Click); - // - // FindReplace - // - this.AcceptButton = this.btnFindNext; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; - this.CancelButton = this.btnFndRplDone; - this.ClientSize = new System.Drawing.Size(437, 180); - this.Controls.Add(this.panelEx1); - this.Controls.Add(this.tabControl1); - this.Controls.Add(this.btnBookMrkAll); - this.Controls.Add(this.btnRplAll); - this.Controls.Add(this.btnFindNext); - this.Controls.Add(this.btnFndRplDone); - this.Controls.Add(this.btnReplace); - this.DoubleBuffered = true; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(2); - this.Name = "FindReplace"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Find and Replace"; - this.TopMost = true; - this.Activated += new System.EventHandler(this.FindReplace_Activated); - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindReplace_FormClosing); - this.panelEx1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.contextMenuBar1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.tabControl1)).EndInit(); - this.tabControl1.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private DevComponents.DotNetBar.ButtonX btnReplace; - private DevComponents.DotNetBar.ButtonX btnFndRplDone; - private DevComponents.DotNetBar.ButtonX btnFindNext; - private DevComponents.DotNetBar.Controls.ComboBoxEx cmboReplaceText; - private DevComponents.DotNetBar.LabelX lblRplTxt; - private DevComponents.DotNetBar.Controls.ComboBoxEx cmboFindText; - private DevComponents.DotNetBar.LabelX labelX3; - private DevComponents.DotNetBar.ButtonX btnRplAll; - private DevComponents.DotNetBar.PanelEx panelEx1; - private DevComponents.DotNetBar.Controls.ComboBoxEx cmbScope; - private DevComponents.Editors.ComboItem comboItem1; - private DevComponents.Editors.ComboItem comboItem2; - private DevComponents.Editors.ComboItem comboItem3; - private DevComponents.Editors.ComboItem comboItem4; - private DevComponents.DotNetBar.LabelX labelX1; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxCaseSensitive; - private DevComponents.DotNetBar.ButtonX btnBookMrkAll; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxWholeWord; - private DevComponents.DotNetBar.Controls.CheckBoxX cbxReverse; - private DevComponents.DotNetBar.TabControl tabControl1; - private DevComponents.DotNetBar.TabControlPanel tabControlPanel1; - private DevComponents.DotNetBar.TabItem tabFind; - private DevComponents.DotNetBar.TabControlPanel tabControlPanel2; - private DevComponents.DotNetBar.TabItem tabReplace; - private DevComponents.DotNetBar.ContextMenuBar contextMenuBar1; - private DevComponents.DotNetBar.ButtonItem btnCmFndRpl; - private DevComponents.DotNetBar.ButtonItem btnCmEdit; - private DevComponents.DotNetBar.ButtonItem btnCmInsert; - private DevComponents.DotNetBar.ButtonItem btnCmCut; - private DevComponents.DotNetBar.ButtonItem btnCmCopy; - private DevComponents.DotNetBar.ButtonItem btnCmPaste; - private DevComponents.DotNetBar.ButtonItem btnCmHardSp; - private DevComponents.DotNetBar.ButtonItem btnCmSymbol; - private DevComponents.DotNetBar.GalleryContainer galSymbols; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/FindReplace.cs b/PROMS/Volian.Controls.Library/FindReplace.cs deleted file mode 100644 index 8a03c091..00000000 --- a/PROMS/Volian.Controls.Library/FindReplace.cs +++ /dev/null @@ -1,461 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; -using JR.Utils.GUI.Forms; - -namespace Volian.Controls.Library -{ - // C2023-016 - Upgrade - have Find/Replace spin through all of the Step Editor sections within the current procedure - public partial class FindReplace : DevComponents.DotNetBar.Office2007Form - { - private bool doingfind = 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 - public bool FoundIt - { - get { return _FoundIt; } - set { _FoundIt = value; } - } - private bool IsFound - { - get - { - // B2022-067 get display text version to convert 8209 dash to normal (keyboard) dash - string selStr = ItemInfo.ConvertToDisplayText(MyEditItem.MyStepRTB.SelectedText); - if (!cbxCaseSensitive.Checked) - return selStr.ToUpper() == cmboFindText.Text.ToUpper(); - else - return selStr == cmboFindText.Text; - } - } - private EditItem _MyEditItem; - public EditItem MyEditItem - { - get { return _MyEditItem; } - set - { - _MyEditItem = value; - if (_MyEditItem == null) return; - _MyDocVersion = _MyEditItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; - SetupContextMenu(); - } - } - private DocVersionInfo _MyDocVersion; - public DocVersionInfo Mydocversion - { - get { return _MyDocVersion; } - set {_MyDocVersion = value; } - } - private DisplayBookMarks _myDisplayBookMarks; - - public DisplayBookMarks MyDisplayBookMarks - { - get { return _myDisplayBookMarks; } - set { _myDisplayBookMarks = value; } - } - - private bool _InApproved; - - public bool InApproved - { - get { return _InApproved; } - set { _InApproved = value; } - } - public FindReplace() - { - InitializeComponent(); - LoadFindReplaceTextListBox(); - cmbScope.SelectedIndex = 0; - btnBookMrkAll.Enabled = false; - btnFindNext.Enabled = false; - btnReplace.Enabled = false; - btnRplAll.Enabled = false; - cmboFindText.Focus(); - } - private void LoadFindReplaceTextListBox() - { - // Setup cmboFindText Combo box - cmboFindText.Items.Clear(); - if (Properties.Settings.Default["FindTextList"] != null && Properties.Settings.Default.FindTextList.Count > 0) - { - foreach (string str in Properties.Settings.Default.FindTextList) - cmboFindText.Items.Add(str); - } - // Setup cmboReplaceText Combo box - cmboReplaceText.Items.Clear(); - if (Properties.Settings.Default["ReplaceTextList"] != null && Properties.Settings.Default.ReplaceTextList.Count > 0) - { - foreach (string str in Properties.Settings.Default.ReplaceTextList) - cmboReplaceText.Items.Add(str); - } - } - - // bug fix: B2016-107, when Find/Replace is initially opened, set the cursor focus to the Find Text box (called from frmVEPROMS.cs) - public void SetFocusToTextBox() - { - cmboFindText.Focus(); - } - - private bool DoingClick = false; // Don't allow a button to be clicked until processing is complete for the last button - - private void btnReplace_Click(object sender, EventArgs e) - { - if (DoingClick) return;// Don't allow a button to be clicked until processing is complete for the last button - DoingClick = true;// We started processing a click - DoReplace(); - DoingClick = false;// we're done processing the click - } - private void DoReplace() - { - if (!IsFound) - DoFindNext(); - else - MyEditItem.ReplaceText(cmboReplaceText.Text, cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked, false, null); - } - private void btnRplAll_Click(object sender, EventArgs e) - { - if (DoingClick) return;// Don't allow a button to be clicked until processing is complete for the last button - DoingClick = true; // We started processing a click - DoRplAll(); - DoingClick = false; // we're done processing the click - } - private void DoRplAll() - { - if (!IsFound) - DoFindNext(); - else - { - DoReplace(); - DoFindNext(); - } - } - private void btnBookMrkAll_Click(object sender, EventArgs e) - { - if (DoingClick) return;// Don't allow a button to be clicked until processing is complete for the last button - DoingClick = true; // We started processing a click - DoBookMrkAll(); - DoingClick = false; // we're done processing the click - } - private void DoBookMrkAll() - { - findingbookmarks = true; - if (!IsFound) DoFindNext(); - FoundIt = true; - while (FoundIt && this.Visible) // found is set in btnFindNext_Click() - Don't continue if the form is invisible (Done button pressed). - { - MyDisplayBookMarks.AddBookMark(MyEditItem.MyItemInfo); - Application.DoEvents(); - DoFindNext(); - } - StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("Bookmarks"); - MyEditItem.MyStepPanel.OnTabDisplay(btnBookMrkAll, args); - findingbookmarks = false; - } - private void btnFndRplDone_Click(object sender, EventArgs e) - { - doingfind = false; - this.Visible = false; - } - - private string FixSymbol(string str) - { - StringBuilder sb = new StringBuilder(); - foreach (char c in str) - { - if (c > 0xff || c == 0xA9 || c == 0xAE) // xA9 is Copyright, xAE is Registered - sb.Append(string.Format(@"\u{0}?", (int)c)); - else - sb.Append(c); - } - return sb.ToString(); - } - // B2015-131 Break up the find string on the spaces - // look for each word in the text string - // this is used only to see if the next item should be looked at, the real Find function (i.e MyEditItem.FindText()) - // will do the actual evaluation - private bool ContainsFndStr(string text, string fndStr) - { - char [] sep ={' '}; // break string up on spaces - string [] fndStrAry = fndStr.Split(sep, StringSplitOptions.None); - int pos = 0; - foreach (string fStr in fndStrAry) - { - pos = text.IndexOf(fStr, pos); - if (pos == -1) break; - } - return pos != -1; - } - private void btnFindNext_Click(object sender, EventArgs e) - { - if (DoingClick) return;// Don't allow a button to be clicked until processing is complete for the last button - DoingClick = true;// We started processing a click - DoFindNext(); - DoingClick = false;// we're done processing the click - } - - // C2023-016 Find the next element, but stay in the same procedure - private ItemInfo FindNextStepElement(ItemInfo curStepElem, string fndStr) - { - ItemInfo nxtStepElem = curStepElem; - if (_StartingItemInfo == null) - _StartingItemInfo = MyEditItem.MyItemInfo; - if (cbxReverse.Checked) - { - if (curStepElem.IsProcedure) - nxtStepElem = curStepElem.MyProcedure.SearchBottom; // at the top of the procedure, so next step would be the last step of the last section (or the section title if the last section is a Word section) - else - nxtStepElem = curStepElem.SearchPrev; - } - else if (curStepElem.SearchNext.IsProcedure) // searching(finding) forward but next is the next procedure, so jump to the top of the procedure (the procedure title in the step editor) - nxtStepElem = curStepElem.MyProcedure; - else - nxtStepElem = curStepElem.SearchNext; - // B2015-131 Find was not finding series of words when one or more of the words were bolded or underlined (ex finding "Any SG" where Any was bolded) - while (nxtStepElem != null && nxtStepElem.ItemID != _StartingItemInfo.ItemID) - { - if (nxtStepElem.MyContent != null && ContainsFndStr(RtfTools.RTFConvertedSymbolsToUnicode(nxtStepElem.MyContent.Text).ToUpper(), fndStr.ToUpper())) - break; - if (cbxReverse.Checked) - { - if (nxtStepElem.IsProcedure) - nxtStepElem = nxtStepElem.MyProcedure.SearchBottom;// at the top of the procedure, so next step would be the last step of the last section (or the section title if the last section is a Word section) - else - nxtStepElem = nxtStepElem.SearchPrev; - } - else if (nxtStepElem.SearchNext.IsProcedure) - nxtStepElem = nxtStepElem.MyProcedure;// searching(finding) forward but next is the next procedure, so jump to the top of the procedure(the procedure title in the step editor) - else - nxtStepElem = nxtStepElem.SearchNext; - } - return nxtStepElem; - } - - private void DoFindNext() - { - AddToComboLists(); - doingfind = true; - string fndStr = FixSymbol(cmboFindText.Text.Replace(@"\", @"\u9586?").Replace("-", @"\u8209?").Replace("\xa0", @"\u160?")); - while (!MyEditItem.FindText(cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked)) - { - ItemInfo next = FindNextStepElement(MyEditItem.MyItemInfo, fndStr); - - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(next,true,true);// C2023-016 open item (next), set focus (true), doing Find/Replace so don't open Word section (true) - if (cbxReverse.Checked) - MyEditItem.PositionToEnd(); - if (next.IsTable && !cbxReverse.Checked) MyEditItem.PositionToStart(); - //C2023-016 if we spun through all of the step editor sections, stop and display a message - if (MyEditItem.MyItemInfo.ItemID == _StartingItemInfo.ItemID) - { - FoundIt = false; - string msg = string.Format("Back to the starting point of the Find/Replace.{0}",(findingbookmarks)?"\n\n The Tools Panel will display showing the locations.":""); - FlexibleMessageBox.Show(this, msg, "Find/Replace Completed"); - _StartingItemInfo = null; - return; - } - } - if (MyEditItem.MyStepRTB != null && !MyEditItem.MyStepRTB.Visible) - { - MyEditItem.MyStepRTB.Visible = true; - MyEditItem.MyStepRTB.Focus(); - } - 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() - { - bool hastext = this.cmboFindText.Text.Length > 0; - if (hastext && !cmboFindText.Items.Contains(cmboFindText.Text)) - { - if (cmboFindText.Items.Count >= 10) - cmboFindText.Items.RemoveAt(9); - cmboFindText.Items.Insert(0, cmboFindText.Text); - } - hastext = this.cmboReplaceText.Text.Length > 0; - if (hastext && btnReplace.Enabled && !cmboReplaceText.Items.Contains(cmboReplaceText.Text)) - { - if (cmboReplaceText.Items.Count >= 10) - cmboReplaceText.Items.RemoveAt(9); - cmboReplaceText.Items.Insert(0, cmboReplaceText.Text); - } - } - private void cmboFindText_TextChanged(object sender, EventArgs e) - { - bool hastext = this.cmboFindText.Text.Length > 0; - btnFindNext.Enabled = hastext; - btnBookMrkAll.Enabled = hastext; - btnReplace.Enabled = btnRplAll.Enabled = hastext && !InApproved; - _StartingItemInfo = null; //C2023-016 reset the starting position - } - - private void cmboReplaceText_TextChanged(object sender, EventArgs e) - { - btnReplace.Enabled = btnRplAll.Enabled = !InApproved && cmboFindText.Text.Length > 0; - _StartingItemInfo = null;//C2023-016 reset the starting position - } - - public void PerformFindNext() - { - btnFindNext.PerformClick(); - } - - private void tabFind_Click(object sender, EventArgs e) - { - lblRplTxt.Visible = false; - cmboReplaceText.Visible = false; - btnReplace.Visible = false; - btnRplAll.Visible = false; - } - - private void tabReplace_Click(object sender, EventArgs e) - { - lblRplTxt.Visible = true; - cmboReplaceText.Visible = true; - btnReplace.Visible = true; - btnRplAll.Visible = true; - } - - private void FindReplace_FormClosing(object sender, FormClosingEventArgs e) - { - btnFndRplDone_Click(sender, e); - e.Cancel = true; // cancel the form close event - the Done_Click() will hide it instead - } - - private void btnCmCut_Click(object sender, EventArgs e) - { - Clipboard.Clear(); - DataObject myDO = new DataObject(DataFormats.Text, cmboReplaceText.Focused ? cmboReplaceText.SelectedText : cmboFindText.SelectedText); - Clipboard.SetDataObject(myDO); - // Need to check which combo box activated the context menu so that we know where to take/put selected text - if (cmboFindText.Focused) - cmboFindText.SelectedText = ""; - else if (cmboReplaceText.Focused) - cmboReplaceText.SelectedText = ""; - } - - private void btnCmCopy_Click(object sender, EventArgs e) - { - // Need to check which combo box activated the context menu so that we know where to take/put selected text - DataObject myDO = new DataObject(DataFormats.Text, cmboReplaceText.Focused ? cmboReplaceText.SelectedText : cmboFindText.SelectedText); - if (cmboFindText.Focused || cmboReplaceText.Focused) - { - Clipboard.Clear(); - Clipboard.SetDataObject(myDO); - } - } - - private void btnCmPaste_Click(object sender, EventArgs e) - { - // Need to check which combo box activated the context menu so that we know where to take/put selected text - IDataObject myDO = Clipboard.GetDataObject(); - if (myDO.GetDataPresent(DataFormats.Rtf)) - { - RichTextBox rtb = new RichTextBox(); - rtb.SelectedRtf = ItemInfo.StripLinks(myDO.GetData(DataFormats.Rtf).ToString()); - if (cmboReplaceText.Focused) - cmboReplaceText.SelectedText = rtb.Text; - else if (cmboFindText.Focused) - cmboFindText.SelectedText = rtb.Text; - } - else if (myDO.GetDataPresent(DataFormats.Text)) - if (cmboReplaceText.Focused) - cmboReplaceText.SelectedText = Clipboard.GetText(); - else if (cmboFindText.Focused) - cmboFindText.SelectedText = Clipboard.GetText(); - } - - private void btnCmHardSp_Click(object sender, EventArgs e) - { - // We use \u00A0 to represent a hard space because it show in the search text field as a blank - // It will get translated to a real hard space character prior to searching - if (cmboReplaceText.Focused) - cmboReplaceText.SelectedText = "\u00A0"; - else if (cmboFindText.Focused) - cmboFindText.SelectedText = "\u00A0"; - } - private void btnSym_Click(object sender, EventArgs e) - { - DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender; - if (cmboReplaceText.Focused) - cmboReplaceText.SelectedText = (string)b.Text; - else if (cmboFindText.Focused) - cmboFindText.SelectedText = (string)b.Text; - } - private void SetupContextMenu() - { - galSymbols.SubItems.Clear(); - if (_MyDocVersion != null) - { - FormatData fmtdata = _MyDocVersion.ActiveFormat.PlantFormat.FormatData; - SymbolList sl = fmtdata.SymbolList; - if (sl == null || sl.Count <= 0) - { - FlexibleMessageBox.Show(this, "No symbols are available, check with administrator"); - return; - } - foreach (Symbol sym in sl) - { - DevComponents.DotNetBar.ButtonItem btnCM = new DevComponents.DotNetBar.ButtonItem(); - btnCM.Text = string.Format("{0}", (char)sym.Unicode); - // to name button use unicode rather than desc, desc may have spaces or odd chars - btnCM.Name = "btnCM" + sym.Unicode.ToString(); - btnCM.Tooltip = sym.Desc; - btnCM.Tag = string.Format(@"{0}", sym.Unicode); - btnCM.FontBold = true; - btnCM.Click += new System.EventHandler(btnSym_Click); - galSymbols.SubItems.Add(btnCM); - } - } - } - - private void FindReplace_Activated(object sender, EventArgs e) - { - if (!doingfind) - { - string find = MyEditItem.SelectedTextForFind; - if (find != null) cmboFindText.Text = find; - } - } - public void ToggleReplaceTab(E_ViewMode vm) - { - if (vm == E_ViewMode.View) - { - if (tabReplace.IsSelected) - tabFind.PerformClick(); - tabReplace.Visible = false; - Text = "Find"; //C2021-021 change the dialog title - } - else - { - tabReplace.Visible = true; - Text = "Find and Replace";//C2021-021 change the dialog title - } - _StartingItemInfo = null;//C2023-016 reset the starting position - } - - private void cbxCaseSensitive_CheckedChanged(object sender, EventArgs e) - { - _StartingItemInfo = null;//C2023-016 reset the starting position - } - - private void cbxWholeWord_CheckedChanged(object sender, EventArgs e) - { - _StartingItemInfo = null;//C2023-016 reset the starting position - } - - private void cbxReverse_CheckedChanged(object sender, EventArgs e) - { - _StartingItemInfo = null;//C2023-016 reset the starting position - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/FindReplace.resx b/PROMS/Volian.Controls.Library/FindReplace.resx deleted file mode 100644 index d813951f..00000000 --- a/PROMS/Volian.Controls.Library/FindReplace.resx +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - AAABAAIAICAQAAAAAADoAgAAJgAAABAQEAAAAAAAKAEAAA4DAAAoAAAAIAAAAEAAAAABAAQAAAAAAIAC - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/ - AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIhwAAAAAAAAAACIcAAAAACI - cAAAAAAAAAAAiHAAAAAAiHAAAAAAAAAAAIhwAAAAAIhwAAAAAAAAAACIcAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAIgAAAAAAAAACIAAAAAAAACIBwAAAAAAAAiAcAAAAAAAiAcAAAAIAAAI - gHAAAAAAAIgHAAAACAAACIBwAAAAAACIBwAAAAgAAAiAcAAAAAAAiAcAAAAIAAAIgHAAAAAAAAAHAAAA - AAAAAABwAAAAAAAABwAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiIcAAAAAiIcAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdwAAAAAAdwAAAA - AAAAAAAHcAAAAAAHcAAAAAAAAAAAB3AAAAAAB3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////// - /////////////4A/+AOAP/gDgD/4A4A/+AOAP/gDgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAADgAAAA4AA - AAPAAAAHwAAAB8AAAAf4A4A/+AOAP/gDgD/4A4A//AfAf/wHwH/8B8B//AfAf/////////////////// - //8oAAAAEAAAACAAAAABAAQAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAA - AACAAIAAgIAAAICAgADAwMAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAACAAAAAAIAAAIAAAAAAgAAAAAAAAAAAAACHAAAACHAAAIcAAAAIcAAAhwAAAAhwAAAA - AAAAAAAAAAiAAACIAAAAAAAAAAAAAAAAcAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAP// - AACH4QAAh+EAAIfhAACBgQAAgAEAAIABAACAAQAAgAEAAMGDAADhhwAA4YcAAOGHAAD//wAA//8AAA== - - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/FlagEnumEditor.cs b/PROMS/Volian.Controls.Library/FlagEnumEditor.cs deleted file mode 100644 index 17f3e65d..00000000 --- a/PROMS/Volian.Controls.Library/FlagEnumEditor.cs +++ /dev/null @@ -1,280 +0,0 @@ -using System; -using System.Collections; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Windows.Forms; -using System.Drawing.Design; -using System.Windows.Forms.Design; - - -namespace Volian.Controls.Library -{ - - public class FlagCheckedListBox : CheckedListBox - { - private System.ComponentModel.Container components = null; - - public FlagCheckedListBox() - { - // This call is required by the Windows.Forms Form Designer. - InitializeComponent(); - - // TODO: Add any initialization after the InitForm call - - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - if (components != null) - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - private void InitializeComponent() - { - // - // FlaggedCheckedListBox - // - this.CheckOnClick = true; - - } - #endregion - - // Adds an integer value and its associated description - public FlagCheckedListBoxItem Add(uint v, string c) - { - FlagCheckedListBoxItem item = new FlagCheckedListBoxItem(v, c); - Items.Add(item); - return item; - } - - public FlagCheckedListBoxItem Add(FlagCheckedListBoxItem item) - { - Items.Add(item); - return item; - } - - protected override void OnItemCheck(ItemCheckEventArgs e) - { - base.OnItemCheck(e); - - if (isUpdatingCheckStates) - return; - - // Get the checked/unchecked item - FlagCheckedListBoxItem item = Items[e.Index] as FlagCheckedListBoxItem; - // Update other items - UpdateCheckedItems(item, e.NewValue); - } - - // Checks/Unchecks items depending on the give bitvalue - protected void UpdateCheckedItems(uint value) - { - - isUpdatingCheckStates = true; - - // Iterate over all items - for (int i = 0; i < Items.Count; i++) - { - FlagCheckedListBoxItem item = Items[i] as FlagCheckedListBoxItem; - - if (item.value == 0) - { - SetItemChecked(i, value == 0); - } - else - { - - // If the bit for the current item is on in the bitvalue, check it - if ((item.value & value) == item.value && item.value != 0) - SetItemChecked(i, true); - // Otherwise uncheck it - else - SetItemChecked(i, false); - } - } - - isUpdatingCheckStates = false; - - } - - // Updates items in the checklistbox - // composite = The item that was checked/unchecked - // cs = The check state of that item - protected void UpdateCheckedItems(FlagCheckedListBoxItem composite, CheckState cs) - { - - // If the value of the item is 0, call directly. - if (composite.value == 0) - UpdateCheckedItems(0); - - - // Get the total value of all checked items - uint sum = 0; - for (int i = 0; i < Items.Count; i++) - { - FlagCheckedListBoxItem item = Items[i] as FlagCheckedListBoxItem; - - // If item is checked, add its value to the sum. - if (GetItemChecked(i)) - sum |= item.value; - } - - // If the item has been unchecked, remove its bits from the sum - if (cs == CheckState.Unchecked) - sum = sum & (~composite.value); - // If the item has been checked, combine its bits with the sum - else - sum |= composite.value; - - // Update all items in the checklistbox based on the final bit value - UpdateCheckedItems(sum); - - } - - private bool isUpdatingCheckStates = false; - - // Gets the current bit value corresponding to all checked items - public uint GetCurrentValue() - { - uint sum = 0; - - for (int i = 0; i < Items.Count; i++) - { - FlagCheckedListBoxItem item = Items[i] as FlagCheckedListBoxItem; - - if (GetItemChecked(i)) - sum |= item.value; - } - - return sum; - } - - Type enumType; - Enum enumValue; - - // Adds items to the checklistbox based on the members of the enum - private void FillEnumMembers() - { - foreach (string name in Enum.GetNames(enumType)) - { - object val = Enum.Parse(enumType, name); - uint intVal = (uint)Convert.ChangeType(val, typeof(uint)); - - Add(intVal, name); - } - } - - // Checks/unchecks items based on the current value of the enum variable - private void ApplyEnumValue() - { - uint intVal = (uint)Convert.ChangeType(enumValue, typeof(uint)); - UpdateCheckedItems(intVal); - - } - - [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)] - public Enum EnumValue - { - get - { - object e = Enum.ToObject(enumType, GetCurrentValue()); - return (Enum)e; - } - set - { - - Items.Clear(); - enumValue = value; // Store the current enum value - enumType = value.GetType(); // Store enum type - FillEnumMembers(); // Add items for enum members - ApplyEnumValue(); // Check/uncheck items depending on enum value - - } - } - - - } - - // Represents an item in the checklistbox - public class FlagCheckedListBoxItem - { - public FlagCheckedListBoxItem(uint v, string c) - { - value = v; - caption = c; - } - - public override string ToString() - { - return caption; - } - - // Returns true if the value corresponds to a single bit being set - public bool IsFlag - { - get - { - return ((value & (value - 1)) == 0); - } - } - - // Returns true if this value is a member of the composite bit value - public bool IsMemberFlag(FlagCheckedListBoxItem composite) - { - return (IsFlag && ((value & composite.value) == value)); - } - - public uint value; - public string caption; - } - - - // UITypeEditor for flag enums - public class FlagEnumUIEditor : UITypeEditor - { - // The checklistbox - private FlagCheckedListBox flagEnumCB; - - public FlagEnumUIEditor() - { - flagEnumCB = new FlagCheckedListBox(); - flagEnumCB.BorderStyle = BorderStyle.None; - } - - public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) - { - if (context != null - && context.Instance != null - && provider != null) - { - - IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); - - if (edSvc != null) - { - - Enum e = (Enum)Convert.ChangeType(value, context.PropertyDescriptor.PropertyType); - flagEnumCB.EnumValue = e; - edSvc.DropDownControl(flagEnumCB); - return flagEnumCB.EnumValue; - - } - } - return null; - } - - public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) - { - return UITypeEditorEditStyle.DropDown; - } - - - } - -} diff --git a/PROMS/Volian.Controls.Library/FormatUtility.cs b/PROMS/Volian.Controls.Library/FormatUtility.cs deleted file mode 100644 index 59e34d61..00000000 --- a/PROMS/Volian.Controls.Library/FormatUtility.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Csla; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml; -using VEPROMS.CSLA.Library; - -namespace Volian.Controls.Library -{ - public static class FormatUtility - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - //C2023-017: Remove any formats that are not applicable to the current plant - public static IList GetFilteredFormatList(SortedBindingList RawList) - { - List result = new List(); - - try - { - //Get the top folder configuration XML of the PROMS treeview and load - //the Formats node to retrieve the available formats for this plant - FolderInfo fi = FolderInfo.GetTop(); - System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument(); - xDoc.LoadXml(fi.Config); - XmlNodeList fList = xDoc.GetElementsByTagName("Formats"); - - //We need to check to see if the current database has been updated with the necessary changes - //to the folder configuration value. If so then build the list of available to be returned - //to the calling code - // added check for a list count of zero. Was getting null error from data gotten from customer - if (fList == null || fList.Count == 0) - { - _MyLog.InfoFormat("Filtered format list not available: Database update needed for config value of top folder record"); - return RawList; - } - else - { - //Create a string array that we can use to filter the raw list and add the format to the return value - string[] availableFormats = fList[0].Attributes["Active"].Value.Split(','); - foreach (FormatInfo item in RawList) - { - if (Array.IndexOf(availableFormats, item.ApplicablePlant.ToString()) > -1) - { - result.Add(item); - } - } - } - } - catch (Exception ex) - { - //On any exception simply return the original list that was passed in - _MyLog.ErrorFormat("Error loading filtered format list - PopulateFormatList(): {0}", ex.Message); - return RawList; - } - - return result; - } - } -} diff --git a/PROMS/Volian.Controls.Library/GridItem.Designer.cs b/PROMS/Volian.Controls.Library/GridItem.Designer.cs deleted file mode 100644 index 58198bd8..00000000 --- a/PROMS/Volian.Controls.Library/GridItem.Designer.cs +++ /dev/null @@ -1,102 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class GridItem - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - MyItemInfo.MyContent.Changed -= new VEPROMS.CSLA.Library.ContentInfoEvent(MyContent_Changed); - MyItemInfo.MyProcedure.MyContent.Changed -= new VEPROMS.CSLA.Library.ContentInfoEvent(MyContent_Changed); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GridItem)); - this.lblTab = new System.Windows.Forms.Label(); - this._MyToolTip = new DevComponents.DotNetBar.SuperTooltip(); - this._MyFlexGrid = new Volian.Controls.Library.VlnFlexGrid(this.components); - this._MyDisablePanel = new vlnPanel(); - ((System.ComponentModel.ISupportInitialize)(this._MyFlexGrid)).BeginInit(); - this.SuspendLayout(); - // - // lblTab - // - this.lblTab.BackColor = System.Drawing.Color.Transparent; - this.lblTab.Location = new System.Drawing.Point(0, 0); - this.lblTab.Name = "lblTab"; - this.lblTab.Size = new System.Drawing.Size(61, 23); - this.lblTab.TabIndex = 3; - this.lblTab.Visible = false; - this.lblTab.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblTab_MouseDown); - // - // _MyToolTip - // - this._MyToolTip.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; - // - // _MyFlexGrid - // - this._MyFlexGrid.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom; - 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.ColumnInfo = "3,0,0,0,0,40,Columns:"; - this._MyFlexGrid.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw; - this._MyFlexGrid.FocusRect = C1.Win.C1FlexGrid.FocusRectEnum.Solid; - this._MyFlexGrid.Location = new System.Drawing.Point(5, 5); - this._MyFlexGrid.Name = "_MyFlexGrid"; - this._MyFlexGrid.Rows.Count = 4; - this._MyFlexGrid.Rows.DefaultSize = 20; - this._MyFlexGrid.Rows.Fixed = 0; - this._MyFlexGrid.ScrollBars = System.Windows.Forms.ScrollBars.None; - this._MyFlexGrid.Size = new System.Drawing.Size(314, 66); - this._MyFlexGrid.StyleInfo = resources.GetString("_MyFlexGrid.StyleInfo"); - this._MyFlexGrid.TabIndex = 4; - // - // _MyDisablePanel - // - _MyDisablePanel.BackColor = System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.ButtonFace); - _MyDisablePanel.SendToBack(); - _MyDisablePanel.Visible = false; - // - // GridItem - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._MyFlexGrid); - this.Controls.Add(this._MyDisablePanel); - this.Controls.Add(this.lblTab); - this.Margin = new System.Windows.Forms.Padding(2); - this.Name = "GridItem"; - this.Size = new System.Drawing.Size(320, 72); - ((System.ComponentModel.ISupportInitialize)(this._MyFlexGrid)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Label lblTab; - private DevComponents.DotNetBar.SuperTooltip _MyToolTip; - private VlnFlexGrid _MyFlexGrid; - private vlnPanel _MyDisablePanel; - } -} diff --git a/PROMS/Volian.Controls.Library/GridItem.cs b/PROMS/Volian.Controls.Library/GridItem.cs deleted file mode 100644 index 4b794d91..00000000 --- a/PROMS/Volian.Controls.Library/GridItem.cs +++ /dev/null @@ -1,1357 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Text.RegularExpressions; -//using System.IO; -using System.Windows.Forms; -using System.Xml; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; -using C1.Win.C1FlexGrid; -using JR.Utils.GUI.Forms; - -namespace Volian.Controls.Library -{ - public partial class GridItem : EditItem - { - #region Fields - private DocVersionInfo _MyDVI = null; - - public DocVersionInfo MyDVI - { - get - { - ItemInfo procInfo = MyItemInfo.MyProcedure as ItemInfo; - if (procInfo == null) - _MyDVI = null; - else - _MyDVI = procInfo.ActiveParent as DocVersionInfo; - return _MyDVI; - } - } - private static UserInfo _MyUserInfo = null; - - public static UserInfo MyUserInfo - { - get { return _MyUserInfo; } - 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; - /// - /// 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. - /// - public int GridMargin - { - get { return _GridMargin; } - set { _GridMargin = value; } - } - #endregion - - #region Event Handlers - /// - /// Raises an ItemClick event when the user clicks on the Tab - /// - /// - /// - private void lblTab_MouseDown(object sender, MouseEventArgs e) - { - MyStepPanel.OnItemClick(this, new StepPanelEventArgs(this, e)); - } - void MyFlexGrid_Resize(object sender, EventArgs e) - { - if (MyFlexGrid.ReadingXml) return; - this.Size = new Size(MyFlexGrid.Width + GridMargin, MyFlexGrid.Height + GridMargin); - AdjustTableWidthAndLocation(); - AdjustLocation(); - } - void MyFlexGrid_Enter(object sender, EventArgs e) - { - if (MyStepPanel.DisplayItemChanging) return; - MyStepRTB.MyItemInfo = MyItemInfo; // should be in vlnFlexGrid - MyStepPanel.SelectedEditItem = this; - if (!UserInfo.CanEdit(MyUserInfo,MyDVI)) - { - MyFlexGrid.Cols.Fixed = MyFlexGrid.Cols.Count; - MyFlexGrid.Rows.Fixed = MyFlexGrid.Rows.Count; - } - } - void MyFlexGrid_KeyDown(object sender, KeyEventArgs e) - { - switch (e.KeyCode) - { - case Keys.F5: - if (e.Shift) - { - e.Handled = true; - if (!CheckClipboard()) return; // check if 'clipboard' contains a step. - SetMenu("StepPaste"); - } - else if (!e.Control && !e.Alt) - { - e.Handled = true; - CopyStep(); - } - break; - case Keys.Delete: - if (!MyFlexGrid.IsRoTable) - MyFlexGrid.ClearSelectedCellText(); - break; - } - } - void SetMenu(string contentMenu) - { - if (contentMenu == null) - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu(); - else if (contentMenu == "OpenContextMenu") - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetGridCellContextMenu(); //.SetContextMenu(); - else - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetShortCutContextMenu(contentMenu); - } - void MyFlexGrid_CursorMovement(object sender, VlnFlexGridCursorMovementEventArgs args) - { - MyStepPanel.CursorMovement(this,new Point(0,0), args.Key); - } - void MyStepRTB_LinkModifyTran(object sender, StepPanelLinkEventArgs args) - { - MyStepPanel.OnLinkModifyTran(sender, args); - } - void MyStepRTB_LinkModifyRO(object sender, StepPanelLinkEventArgs args) - { - MyStepPanel.OnLinkModifyRO(sender, args); - } - void MyStepRTB_LinkGoTo(object sender, StepPanelLinkEventArgs args) - { - MyStepPanel.OnLinkClicked(sender, args); - } - void MyStepRTB_CursorKeyPress(object sender, KeyEventArgs args) - { - MyStepPanel.StepCursorKeys(this, args); - } - void MyStepRTB_AdjustTableWidth(object sender, StepRTBTableWidthEventArgs args) - { - //Console.WriteLine("MyStepRTB_AdjustTableWidth"); - //if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) - if (args.EditMode) - { - int colR = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); - int widS = /* _WidthAdjust + borderWidth + */ MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode); - int wNew = 70 + widS + colR * MyItemInfo.ColumnMode; - if (wNew > ItemWidth) - { - ItemWidth = wNew; - ItemLocation = TableLocation(MyStepSectionLayoutData, wNew); - } - } - else - { - int newwidth = MyFlexGrid.Width; - if (ItemWidth != newwidth) - { - ItemWidth = newwidth; - ItemLocation = TableLocation( MyStepSectionLayoutData, newwidth); - } - } - } - bool MyStepRTB_IsNotCurrentSelection(object sender, EventArgs args) - { - return MyStepPanel.SelectedEditItem != this; - } - - void MyStepRTB_OpenAnnotations(object sender, EventArgs args) - { - OpenAnnotations(); - } - 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) - { - if (MyStepRTB == null) return; - MyStepRTB.EditMode = MyStepRTB.Visible; - //Console.WriteLine("MyStepRTB_VisibleChanged {0}", MyStepRTB.Width); - //Console.WriteLine("GridItem: EditMode = {0}", MyStepRTB.EditMode); - } - void MyStepRTB_ReturnToEditor(object sender, EventArgs args) - { - //Console.WriteLine("MyStepRTB_ReturnToEditor"); - MyFlexGrid.Focus(); - MyFlexGrid.StartEditing(); - } - void MyFlexGrid_Click(object sender, EventArgs e) - { - MyFlexGrid.Focus(); - //MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ToggleTableDesignButtons(false); - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetRibbonForGrid(); - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetTableButtonsForMergeRangeSelection(); - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetGridContextMenu(); - } - void MyStepRTB_EditModeChanged(object sender, EventArgs args) - { - //Console.WriteLine("MyStepRTB_EditModeChanged"); - AdjustColorsForEditMode(); - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetRibbonForGrid(); - } - - private void AdjustColorsForEditMode() - { - MyFlexGrid.StyleBackColor = Color.White; - if (MyStepRTB.EditMode) - { - MyFlexGrid.Styles["Focus"].ForeColor = MyFlexGrid.Styles["Focus"].BackColor = - MyFlexGrid.Styles["Highlight"].ForeColor = MyFlexGrid.Styles["Highlight"].BackColor = Color.SkyBlue; - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetRibbonForGridCellIndent(); - } - else - { - MyFlexGrid.Styles["Focus"].ForeColor = MyFlexGrid.Styles["Highlight"].ForeColor = Color.Black; - MyFlexGrid.Styles["Focus"].BackColor = MyFlexGrid.Styles["Highlight"].BackColor = Color.LightCyan; - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetRibbonForGridCellIndentClear(); - } - } - private string _OrigRtf; // used to store original rtf to allow for 'escape' key restore - void MyFlexGrid_SelChange(object sender, EventArgs e) - { - //if (Initializing) return; - //Volian.Base.Library.vlnStackTrace.ShowStackLocal("MyFlexGrid_SelChange {0}",MyFlexGrid.Selection); - RTBLastFocus = false; - MyStepRTB.Visible = false; // Hide the editor if the Selection Changes - if (Initializing) return; - if (MyFlexGrid.Selection.IsSingleCell && MyFlexGrid.Row >= 0 && MyFlexGrid.Col >= 0) - { - // B2020-088: get string using method in case of merged cells - string rtf = MyFlexGrid.GetCellRTFString(MyFlexGrid.Row, MyFlexGrid.Col); - _OrigRtf = rtf == null ? string.Empty : rtf; - } - } - void MyStepRTB_KeyDown(object sender, KeyEventArgs e) - { - if (!e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Escape && MyStepRTB.EditMode) - { - MyStepRTB.Rtf = _OrigRtf; - MyFlexGrid.Select(MyFlexGrid.Selection); - } - } - private string MyFlexGrid_AdjustPastedText(object sender, VlnFlexGridPasteEventArgs args) - { - string tmpForLink = args.Text; - tmpForLink = Regex.Replace(tmpForLink, @"#Link:ReferencedObject:[0-9]+ ", @"#Link:ReferencedObject: "); - tmpForLink = Regex.Replace(tmpForLink, @"#Link:Transition:([0-9]+) [0-9]+ ", @"#Link:Transition:$1 "); - tmpForLink = Regex.Replace(tmpForLink, @"#Link:TransitionRange:([0-9]+) [0-9]+ ", @"#Link:TransitionRange:$1 "); - return tmpForLink; - } - #endregion // Event Handlers - #region Constructors - public GridItem() - { - InitializeComponent(); - } - public GridItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand) - { - InitializeComponent(); - SetupEventHandlers(); - SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, false); - } - public GridItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem) - { - InitializeComponent(); - SetupEventHandlers(); - SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false); - } - private void SetupEventHandlers() - { - this.MyFlexGrid.Resize += new EventHandler(MyFlexGrid_Resize); - this.MyFlexGrid.Enter += new EventHandler(MyFlexGrid_Enter); - this.MyFlexGrid.Leave += MyFlexGrid_Leave; - this.MyFlexGrid.CursorMovement += new VlnFlexGridCursorMovementEvent(MyFlexGrid_CursorMovement); - this.MyFlexGrid.OpenAnnotations += new VlnFlexGridEvent(MyFlexGrid_OpenAnnotations); - this.MyFlexGrid.KeyDown +=new KeyEventHandler(MyFlexGrid_KeyDown); - this.MyStepRTB.LinkGoTo += new StepRTBLinkEvent(MyStepRTB_LinkGoTo); - this.MyStepRTB.LinkModifyRO += new StepRTBLinkEvent(MyStepRTB_LinkModifyRO); - this.MyStepRTB.LinkModifyTran += new StepRTBLinkEvent(MyStepRTB_LinkModifyTran); - this.MyStepRTB.CursorKeyPress += new StepRTBCursorKeysEvent(MyStepRTB_CursorKeyPress); - this.MyStepRTB.AdjustTableWidth += new StepRTBTableWidthEvent(MyStepRTB_AdjustTableWidth); - this.MyStepRTB.IsNotCurrentSelection += new StepRTBBooleanEvent(MyStepRTB_IsNotCurrentSelection); - this.MyStepRTB.OpenAnnotations += new StepRTBEvent(MyStepRTB_OpenAnnotations); - this.MyStepRTB.DoMouseWheel += new StepRTBMouseEvent(MyStepRTB_DoMouseWheel); - this.MyStepRTB.DoSaveContents += new StepRTBEvent(MyStepRTB_DoSaveContents); - this.MyStepRTB.VisibleChanged += new EventHandler(MyStepRTB_VisibleChanged); - this.MyStepRTB.ReturnToEditor += new StepRTBEvent(MyStepRTB_ReturnToEditor); - this.MyFlexGrid.Click += new EventHandler(MyFlexGrid_Click); - this.MyStepRTB.EditModeChanged += new StepRTBEvent(MyStepRTB_EditModeChanged); - this.MyStepRTB.KeyDown += new KeyEventHandler(MyStepRTB_KeyDown); - this.MyFlexGrid.SelChange += new EventHandler(MyFlexGrid_SelChange); - this.MyStepRTB.GotFocus += new EventHandler(MyStepRTB_GotFocus); - this.MyStepRTB.RoInsert += new StepRTBRoEvent(MyStepRTB_RoInsert); - this.MyFlexGrid.AdjustPastedText += new VlnFlexGridPasteEvent(MyFlexGrid_AdjustPastedText); - this.MyStepRTB.SetMenu += new StepRTBMenuEvent(MyStepRTB_SetMenu); - this.MyStepRTB.OpenContextMenu += new StepRTBLocationEvent(MyStepRTB_OpenContextMenu); - 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.MyStepRTB.Resize += new EventHandler(MyStepRTB_Resize); - } - void MyFlexGrid_Leave(object sender, EventArgs e) - { - // MyFlexGrid_Leave appears to be a consistent event that occurs when leaving - // flex grid whether if last cell was in edit or view mode. - - // if ContainsFocus is true, then flexgrid still contains focus, so don't change - // any cell colors - otherwise set back to inactive. - if (this.ContainsFocus) return; - CellStyle cs = MyFlexGrid.Styles["Focus"]; - cs.ForeColor = Color.Black; - cs = MyFlexGrid.Styles["Highlight"]; - cs.ForeColor = Color.Black; - 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) - { - args.Handled = true; - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ProcessEnterKey(); - } - - void MyStepRTB_OpenContextMenu(object sender, StepRTBLocationEventArgs args) - { - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.OpenContextMenu(args.Location, sender); - } - - void MyStepRTB_SetMenu(object sender, StepRTBMenuEventArgs args) - { - 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) - { - //Console.WriteLine("GridItem - Enter MyStepRTB_RoInsert"); - if (MyFlexGrid.IsRoTable) - { - MyFlexGrid.Visible = false; - MyFlexGrid.ConvertTableROToGrid(args.ValText, args.RODbID, args.ROID); - MyFlexGrid.FixTableCellsHeightWidth(); - MyFlexGrid.AdjustGridControlSize(); - 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 - { - int sel = MyStepRTB.SelectionStart + args.ValText.Length;// +args.LinkText.Length;//MyStepRTB.SelectionLength; // Remember where the link is being added - //Console.WriteLine("ValText {0} LinkText {1}", args.ValText, args.LinkText); - //Console.WriteLine("selstart {0} len {1}", MyStepRTB.SelectionStart, args.LinkText.Length); - CellRange cr = MyFlexGrid.Selection; - MyStepRTB.UpdateStepRtb(args.LinkText, args.ValText); - MyFlexGrid.StartEditing(cr.r1, cr.c1); // get back to edit mode - MyStepRTB.Select(sel, 0);// Move cursor to end of LINK - SendKeys.Send("{RIGHT}"); // this will un-select the RO - SendKeys.Flush(); - } - //Console.WriteLine("GridItem - Exit MyStepRTB_RoInsert"); - } - void MyStepRTB_GotFocus(object sender, EventArgs e) - { - RTBLastFocus = true; - } - #endregion - #region Override Method and Properties - 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) - { - base.OnEnabledChanged(e); - if (this.Enabled) - { - _MyDisablePanel.SendToBack(); - _MyDisablePanel.Visible = false; - } - else - { - _MyDisablePanel.Visible = true; - Rectangle rect = new Rectangle(0, 0, this.MyFlexGrid.Width, this.MyFlexGrid.Height); - Bitmap bmp = new Bitmap(this.MyFlexGrid.Width, this.MyFlexGrid.Height); - this.MyFlexGrid.DrawToBitmap(bmp, rect); - using (Graphics gr = Graphics.FromImage(bmp)) - { - gr.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; - 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.Size = this.MyFlexGrid.Size; - _MyDisablePanel.BackgroundImage = bmp; - _MyDisablePanel.BringToFront(); - } - } - public override Point ContentLocation - { - get { return new Point(Location.X + MyFlexGrid.Left, Location.Y); } - set { Location = new Point(value.X - MyFlexGrid.Left, value.Y); } - } - public override string TabFormat { get { return _TabFormat; } set { _TabFormat = value; } } - 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 - // that is could be deleted. - if (_MyParentEditItem == null) return; - Point newLocation = TableLocation(MyStepSectionLayoutData, ItemWidth); - if (!newLocation.Equals(ItemLocation)) ItemLocation = newLocation; - } - public override void SetToolTip(string tip) - { - DevComponents.DotNetBar.SuperTooltipInfo tpi = new DevComponents.DotNetBar.SuperTooltipInfo("", "", tip, null, null, DevComponents.DotNetBar.eTooltipColor.Lemon); - _MyToolTip.MinimumTooltipSize = new Size(0, 24); - _MyToolTip.TooltipDuration = 3; - _MyToolTip.SetSuperTooltip(MyFlexGrid, tpi); - ToolTipOnOff(); // B2025-050 Show the tooltip based on User Options Settings - } - public override void ToolTipOnOff() - { - _MyToolTip.Enabled = VlnSettings.StepTypeToolTip; // B2025-XXX Show the tooltip based on User Options Settings - } - private bool DoNotRefresh = false; - public override void RefreshContent() - { - if (DoNotRefresh) return; - _ActiveMode = MyFlexGrid.ContainsFocus; - using (Grid myGrid = MyItemInfo.MyContent.MyGrid.Get()) - { - MyItemInfo.MyContent.MyGrid.ResetContent(myGrid); - } - RefreshDisplay(_ActiveMode); - IdentifyMe(false); - } - public override int TableWidth { get { return 0; } } // DONE - public override int ItemLeft - { - get { return Left + lblTab.Left; } - set { Left = value - lblTab.Left; } - } - public override int ContentLeft { get { return Left + MyFlexGrid.Left; } } - public override int ContentWidth - { - get { return MyFlexGrid.Width; } - set - { - Width = value + lblTab.Left + lblTab.Width; - } - } - public override Point ItemLocation - { - get { return new Point(Location.X + lblTab.Left, Location.Y); } - set { Location = new Point(value.X - lblTab.Left, value.Y); } - } - public override int ItemWidth - { - get { return Width - lblTab.Left; } - set - { - Width = GridMargin + value + lblTab.Left; - } - } - public override void RefreshOrdinal() - { - TabFormat = null; // Reset Tab - } - public override bool Expanded - { - get {return !Colapsing;} - set {;} // Tables are always expanded. - } - public override void RefreshTab() { TabFormat = null;} - public override void SetFocus() { MyFlexGrid.Focus();} - public override void SaveContents() - { - if (!MyFlexGrid.IsDirty && !IsSaving) return; - List RtfRoUsageList = new List(); - List RtfTransList = new List(); - List RtfTransPageNumList = new List(); - - int r = 0; - int c = 0; - int w = MyFlexGrid.Cols.Count; - int h = MyFlexGrid.Rows.Count; - - string srchtxt = MyFlexGrid.GetSearchableText(); - // find the rousages within the grid cell. If this is an ro table, there will only be one usage - // if it is a modify and there will be no usages if it is new (the usage gets created on the save) - if (!MyFlexGrid.IsRoTable) - { - // B2026-003 we where using a string.format on this inside the while loop - allocating memory each time - // so I move it outside the while loop and did a simple assigment of text - string lookForLinks = @""; - - while (r < h) - { - CellRange cr = MyFlexGrid.GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) - { - if (MyFlexGrid[r, c] != null) - { - // see if there are any links and save these so that any deleted ROs or transitions in the - // steprtb can have associated usages/transitions records removed from the database. - MatchCollection matches = Regex.Matches((string)MyFlexGrid[r, c], lookForLinks); - for (int i = matches.Count - 1; i >= 0; i--) - { - Match m = matches[i]; - if (m != null && m.Groups.Count > 7 && m.Groups[7].ToString() == "ReferencedObject") - { - Regex regRefObj = new Regex(@"\#Link\:ReferencedObject\:([0-9]*) ([0-9a-zA-Z]*) ([0-9]*)", RegexOptions.Singleline); - Match myMatch = regRefObj.Match(m.Value); - if (myMatch.Success) - { - int usgid = int.Parse(myMatch.Groups[1].Value); - RtfRoUsageList.Add(usgid); - } - } - if (m != null && m.Groups.Count > 7 && m.Groups[7].ToString().StartsWith("Transition")) - { - Regex regRefObj = new Regex(@"\#Link\:Transition[a-zA-Z]*\:([0-9]*) ([0-9]*) ([0-9]*)", RegexOptions.Singleline); - Match myMatch = regRefObj.Match(m.Value); - if (myMatch.Success) - { - int tid = int.Parse(myMatch.Groups[2].Value); - RtfTransList.Add(tid); - int myIndex = m.Groups[4].Index; - int myLength = m.Groups[4].Length; - if (m.Groups[3].Value != " ") - { - myIndex = m.Groups[3].Index; - myLength += m.Groups[3].Length; - } - string gg = ((string)MyFlexGrid[r, c]).Substring(myIndex, myLength); - if (gg.ToUpper().Contains("(PAGE ~)")) RtfTransPageNumList.Add(tid); // B2020-089, check for upper case Page ~ in case step was upper cased - } - } - } - } - } - c = c + 1; - if (c == w) - { - c = 0; - r = r + 1; - } - } - } - else - { - // new roid is in flexgrid.roid. Compare to previous, if there was a previous. If there - // is a modify RO, then need to delete the existing rousage record because a new usage - // record will get created that contains the selected ROID. - Regex regRefObj = new Regex(@"\#Link\:ReferencedObject\:([0-9]*) ([0-9a-zA-Z]*) ([0-9]*)", RegexOptions.Singleline); - Match myMatch = regRefObj.Match(MyItemInfo.MyContent.Text); - if (myMatch.Success) - { - int usgid = int.Parse(myMatch.Groups[1].Value); - RoUsageInfo rui = RoUsageInfo.Get(usgid); - if (rui.ROID == MyFlexGrid.ROID)RtfRoUsageList.Add(usgid); - } - } - // compare ro usages & transitions from database and list from grid contents - // if in both lists, don't do anything - // if only in database list, delete usage. - // never will have condition where it is not in database list, but is in steprtb text list (this - // case is handled when ro is inserted. - if (MyItemInfo.MyContent.ContentRoUsages != null) - { - List delRoUsgs = new List(); - foreach (RoUsageInfo ru in MyItemInfo.MyContent.ContentRoUsages) - if (!RtfRoUsageList.Contains(ru.ROUsageID)) delRoUsgs.Add(ru.ROUsageID); - foreach (int dRU in delRoUsgs) RoUsage.Delete(dRU); - } - if (MyItemInfo.MyContent.ContentTransitions != null) - { - List delTrans = new List(); - foreach (TransitionInfo ti in MyItemInfo.MyContent.ContentTransitions) - { - if (!RtfTransList.Contains(ti.TransitionID)) delTrans.Add(ti.TransitionID); - else if (RtfTransPageNumList.Contains(ti.TransitionID)) - { - using (Transition t = ti.Get()) - { - t.Config = ""; - t.Save(); - } - } - } - foreach (int dt in delTrans) Transition.Delete(dt); - } - - bool success = FinishSave(srchtxt); - if (success && !MyFlexGrid.IsRoTable) - { - MyStepRTB.FindAllLinks(); - MyStepRTB.OrigRTF = MyStepRTB.Rtf; - MyStepRTB.ClearUndo(); - } - } - private string DoLinkForRoTable(Item itm) - { - // if no ro has been defined yet, just return null - if (MyFlexGrid.ROID == null) return null; - ContentRoUsage rousg = null; -// using (Item itm = MyItemInfo.Get()) -// { - using (RODb rodb = RODb.GetJustRoDb(MyFlexGrid.RODbId)) - { - string padroid = (MyFlexGrid.ROID.Length <= 12) ? MyFlexGrid.ROID + "0000" : MyFlexGrid.ROID; - rousg = itm.MyContent.ContentRoUsages.Add(MyFlexGrid.ROID, rodb); - } - //itm.Save(); -// } - MyItemInfo.MyContent.RefreshContentRoUsages(); - 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) - { - // Just in case if the grid was in a mode to change sizes, clear out that setting - // in the grid: - MyFlexGrid.Cols.Fixed = 0; - MyFlexGrid.Rows.Fixed = 0; - MyFlexGrid.ShowTableCellShading(); // C2021-004 if the grid was in Fixed Mode, then also re-show the table cell shading - - string xml = MyFlexGrid.GetXMLData(); - 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.DTS = DateTime.Now; - itm.MyContent.MyGrid.UserID = Volian.Base.Library.VlnSettings.UserID; - //} - // 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 - // on exit of the griditem. We don't want to save the ro usage again, if it's already - // been saved. - if (MyFlexGrid.IsRoTable && MyFlexGrid.ROID != null && itm.MyContent.ContentRoUsageCount < 1) - { - searchableText = string.Format(@"\v\v0 ", searchableText, DoLinkForRoTable(itm)); - //if (itm.MyContent.Text != searchableText) - //{ - itm.MyContent.Text = searchableText; - itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; - itm.MyContent.DTS = DateTime.Now; - //} - } - else - { - itm.MyContent.Text = searchableText; - itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; - itm.MyContent.DTS = DateTime.Now; - } - if (!MyFlexGrid.IsRoTable) itm.MyContent.Text = searchableText; - - // 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 - // item Step_MultipleChangeID has the save built in to it. - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds && - !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange) - { - StepConfig sc = itm.MyConfig as StepConfig; - if (sc == null) - sc = new StepConfig(); - sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId; - if (itm.MyConfig == null) itm.MyContent.Config = sc.ToString(); - } - itm.Save(); - - StepConfig myItmCfg =MyItemInfo.MyConfig as StepConfig; - // 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 - // 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. - if (myItmCfg != null) - myItmCfg.Step_CBOverride = null; // clear the change bar override - - MyItemInfo.MyContent.MyGrid.ResetContent(itm.MyContent.MyGrid); - } - 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() - { - using (Item itm = MyItemInfo.Get()) - { - itm.MyContent.MyGrid.Data = MyFlexGrid.GetXMLData(); - itm.Save(); - //MyItemInfo.MyContent.MyGrid.ResetContent(itm.MyContent.MyGrid); - } - } - public override bool CanExpand { get { return false; } set { ;} } - public override void HandleResize() { ;} // DONE - public override void MatchExpanded() { ;} // DONE - public override void ItemSelect() - { - // Was getting an Error that _MyStepRTB was Disposed RHM 20101217 - if (!MyFlexGrid.Disposing) - { - Focus(); - MyFlexGrid.Focus(); - if (!MyFlexGrid.IsRoTable) // Table ROs are not editable - don't select a table cell - { - try - { - MyFlexGrid.Select(0, 0); - MyFlexGrid.FirstEntry = true; // to fix a problem with initial mouse click into table - } - catch (Exception ex) - { - 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); - } - } - } - else - { - _MyLog.WarnFormat("Attempt to give Focus to Disposed Object {0}", MyID); - } - //ScrollToCenter(); - } - public override void ItemShow() - { - MyFlexGrid.Focus(); - //ScrollToCenter(); - } - public StepRTB DisplayRoStepRTB; - public override StepRTB MyStepRTB - { - get - { - return MyFlexGrid.TableCellEditor; - } - } - public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg) - { - int r = MyFlexGrid.Row; - int c = MyFlexGrid.Col; - - if (!reverse) - { - int w = MyFlexGrid.Cols.Count; - int h = MyFlexGrid.Rows.Count; - while (r < h) - { - CellRange cr = MyFlexGrid.GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) - { - int ss = MyStepRTB.SelectionStart; - int sl = MyStepRTB.SelectionLength; - MyFlexGrid.StartEditing(); - MyStepRTB.Select(ss, sl); // need to reset selection because startediting positions to end. - if (MyStepRTB.ReadOnly) - { - FlexibleMessageBox.Show("Cannot replace linked text!", "Find/Replace", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); - return DialogResult.Yes; - } - string oldRtf = MyStepRTB.Rtf; - DialogResult dr = MyStepRTB.ReplaceText(rpltxt, fndstr, caseSensitive, matchWholeWord, reverse, prompt, fndrpldlg); - if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf; - if (dr == DialogResult.Yes || dr == DialogResult.Cancel) return dr; - } - c = c + 1; - if (c == w) - { - c = 0; - r = r + 1; - } - if (r < h) - { - MyFlexGrid.Select(r, c); - MyStepRTB.Select(0, 0); - } - } - } - else // reverse - { - while (r >= 0) - { - CellRange cr = MyFlexGrid.GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) - { - int ss = MyStepRTB.SelectionStart; - int sl = MyStepRTB.SelectionLength; - MyFlexGrid.StartEditing(); - MyStepRTB.Select(ss, sl); - if (MyStepRTB.ReadOnly) - { - FlexibleMessageBox.Show("Cannot replace linked text!", "Find/Replace", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); - return DialogResult.Yes; - } - string oldRtf = MyStepRTB.Rtf; - DialogResult dr = MyStepRTB.ReplaceText(rpltxt, fndstr, caseSensitive, matchWholeWord, reverse, prompt, fndrpldlg); - if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf; - if (dr == DialogResult.Yes || dr == DialogResult.Cancel) return dr; - } - c = c - 1; - if (c < 0) - { - c = MyFlexGrid.Cols.Count - 1; - r = r - 1; - } - cr = MyFlexGrid.GetMergedRange(r, c); - if (r >= 0 && cr.r1 == r && cr.c1 == c) - { - MyFlexGrid.Select(r, c); - MyFlexGrid.StartEditing(); - MyStepRTB.Select(MyStepRTB.Text.Length, 0); - } - } - } - return DialogResult.No; - } - public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse) - { - if (MyFlexGrid.Row < 0) MyFlexGrid.Row = (reverse) ? MyFlexGrid.Rows.Count - 1 : 0; - if (MyFlexGrid.Col < 0) MyFlexGrid.Col = (reverse) ? MyFlexGrid.Cols.Count - 1 : 0; - int r = MyFlexGrid.Row; - int c = MyFlexGrid.Col; - if (!reverse) - { - int w = MyFlexGrid.Cols.Count; - int h = MyFlexGrid.Rows.Count; - while (r < h) - { - CellRange cr = MyFlexGrid.GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) - { - int ss = MyStepRTB.SelectionStart + MyStepRTB.SelectionLength; - MyFlexGrid.StartEditing(); - MyStepRTB.Select(ss, 0); // need to reset selection because startediting positions to end. - bool scn = MyStepRTB.FindText(str, caseSensitive, matchWholeWord, reverse); - if (scn) return true; - } - c = c + 1; - if (c == w) - { - c = 0; - r = r + 1; - } - if (r < h) - { - MyFlexGrid.Select(r, c); - MyStepRTB.Select(0, 0); - } - } - } - else - { - while (r >= 0) - { - CellRange cr = MyFlexGrid.GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) - { - int ss = MyStepRTB.SelectionStart; - MyFlexGrid.StartEditing(); - MyStepRTB.Select(ss, 0); - bool scn = MyStepRTB.FindText(str, caseSensitive, matchWholeWord, reverse); - if (scn) return true; - } - c = c - 1; - if (c < 0) - { - c = MyFlexGrid.Cols.Count - 1; - r = r - 1; - } - cr = MyFlexGrid.GetMergedRange(r, c); - if (r >= 0 && cr.r1 == r && cr.c1 == c) - { - MyFlexGrid.Select(r, c); - MyFlexGrid.StartEditing(); - MyStepRTB.Select(MyStepRTB.Text.Length, 0); - } - } - } - return false; - } - public override void PositionToEnd() - { - int r = MyFlexGrid.Rows.Count - 1; - int c = MyFlexGrid.Cols.Count - 1; - MyFlexGrid.Select(r, c); - while (r >= 0) - { - CellRange cr = MyFlexGrid.GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) - { - MyFlexGrid.StartEditing(); - return; - } - c = c - 1; - if (c < 0) - { - c = MyFlexGrid.Cols.Count - 1; - r = r - 1; - } - if (r >= 0) - { - MyFlexGrid.Select(r, c); - MyStepRTB.Select(MyStepRTB.Text.Length, 0); - } - } - } - public override void PositionToStart() - { - MyFlexGrid.Select(0,0); - MyFlexGrid.StartEditing(); - MyStepRTB.Select(0, 0); - } - public override string SelectedTextForFind - { - get - { - StepRTB srtb = MyStepRTB; - if (srtb.SelectionLength > 0) - { - if (srtb.IsSelectionLinked(srtb.SelectionStart, srtb.SelectionLength)) - return srtb.SelectedText.Substring(0, srtb.SelectedText.IndexOf("#Link")); - else - return srtb.SelectedText; - } - return null; - } - } - public override bool SpellCheckNext() - { - if (MyFlexGrid.IsRoTable) return true; // skip RO Tables - int r = MyFlexGrid.Row; - int c = MyFlexGrid.Col; - int w = MyFlexGrid.Cols.Count; - int h = MyFlexGrid.Rows.Count; - while (r < h) - { - CellRange cr = MyFlexGrid.GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) - { - MyFlexGrid.Select(r, c); - MyFlexGrid.StartEditing(); - string oldRtf = MyStepRTB.Rtf; - bool scn = MyStepRTB.SpellCheckNext(); - if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf; - if (!scn) return false; - } - c = c + 1; - if (c == w) - { - c = 0; - r = r + 1; - } - } - return true; - } - public override void IdentifyMe(bool highlight) - { - if (highlight) - { - MyFlexGrid.StyleBackColor = Color.Gray; - MyFlexGrid.Styles.Fixed.BackColor = Color.Gray; - } - else - { - MyFlexGrid.Styles.Fixed.BackColor = MyFlexGrid.DefaultFixedBackgroundColor; - MyFlexGrid.StyleBackColor = MyFlexGrid.DefaultCellBackgroundcolor; - if (MyFlexGrid.Focused) // If active Set BackColor to the active color - SetActive(); - else // Otherwise Set the BackColor to either the InactiveColor or the AnnotationColor - { - MyFlexGrid.StyleBackColor = - MyItemInfo.ItemAnnotationCount == 0 ? MyStepPanel.InactiveColor : MyStepPanel.AnnotationColor; - // Turn-off Size adjustment - MyFlexGrid.Cols.Fixed = 0; - MyFlexGrid.Rows.Fixed = 0; - } - // C2021-004 Table Cell Shading. - // If the table has annotations, then show the yellow annoation background (table is not active control when in here) - // otherwise show the table shading assigned by the user - if (MyFlexGrid.GetMyItemInfo().ItemAnnotationCount == 0) - MyFlexGrid.ShowTableCellShading(); - } - } - public override void SetActive() - { - AdjustColorsForEditMode(); - } - private bool _Empty = false; - public override bool Empty - { - get { return _Empty; } - set { _Empty = value; } - } - private bool _Initializing = false; - public bool Initializing - { - get { return _Initializing; } - set { _Initializing = value; } - } - private bool _ActiveMode = false; - public override void RefreshDisplay(bool activeMode) - { - _ActiveMode = activeMode; - //XmlDocument xd = new XmlDocument(); - //xd.LoadXml(MyItemInfo.MyContent.MyGrid.Data); - //using (StringReader sr = new StringReader()) - Initializing = true; - MyFlexGrid.LoadGrid(MyItemInfo); - Initializing = false; - MyFlexGrid.KeyActionTab = KeyActionEnum.MoveAcross; - MyFlexGrid.AdjustGridControlSize(); - // When a grid is read from XML, all of the styles are updated to the values in the XML. - // Thus any specific settings need to be set after the grid is read. - MyFlexGrid.Styles["Highlight"].BackColor = Color.LightCyan; - MyFlexGrid.Styles["Focus"].BackColor = Color.LightCyan; - MyFlexGrid.HighLight = activeMode ? C1.Win.C1FlexGrid.HighLightEnum.Always : C1.Win.C1FlexGrid.HighLightEnum.WithFocus; - MyFlexGrid.VwMode = MyStepPanel.VwMode; - } - public override void ToggleEditView(E_ViewMode vwMode) - { - /* - * TODO: - * 1) SaveContents - */ - RefreshDisplay(false); - MyFlexGrid.VwMode = vwMode; - } - public override int TabLeft { get { return lblTab.Left; } set { lblTab.Left = value; } } - public override Font TabFont { get { return lblTab.Font; } set { lblTab.Font = value; } } - public override string TabText { get { return lblTab.Text; } } - public override Point TabLocation { get { return lblTab.Location; } } - public override Font ContentFont { get { return MyFlexGrid.Font; } set { MyFlexGrid.Font = value; } } // TODO how do we know what font tables are in? - public override float ContentTop { get { return MyFlexGrid.Top; } } - public override void SetupHeader(ItemInfo itemInfo) { ;} // tables do not have headers - public override void ShowExpanded() {;} - public override void SetText() - { - // if this is an RO Table, regenerate xml. This is done in the case that - // the rotable was updated by the ro editor. - //if (MyFlexGrid.IsRoTable) RefreshGridData(); - RefreshDisplay(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 void SavePastedCellRoTran() - { - if (!MyFlexGrid.GetXMLData().Contains("<NewID>")) return; - BasicSave(); - // need to loop thru all pasted cells: for now do all cells. - int w = MyFlexGrid.Cols.Count; - int h = MyFlexGrid.Rows.Count; - int r = 0; - int c = 0; - String Rtf = null; - while (r < h) - { - CellRange cr = MyFlexGrid.GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) - { - Rtf = (string)MyFlexGrid[r, c]; - if (Rtf != null) - { - int startIndx = 0; - while (Rtf.IndexOf("") > -1) - { - // first find the new link and determine whether it's RO or transition. - int indx = Rtf.IndexOf(@"#Link:ReferencedObject:", startIndx); - if (indx > 0) - { - // only look in the substring limited by the first occurrance of [END>. If there is more - // than one, don't get multiple links in the string. - int endindx = Rtf.IndexOf(@"END>", indx) + 4; - Match mro = Regex.Match(Rtf.Substring(indx, endindx - indx), @"([A-Za-z]*):(.*)\[END>"); - string linkstr = mro.Groups[2].Value; - string[] roparts = linkstr.Split(" ".ToCharArray()); - ContentRoUsage rousg = null; - int oldid = -1; - using (Item itm = MyItemInfo.Get()) - { - using (RODb rodb = RODb.GetJustRoDb(Convert.ToInt32(roparts[2]))) - { - rousg = itm.MyContent.ContentRoUsages.Add(roparts[1], rodb); - } - oldid = rousg.ROUsageID; - int newid = Rtf.IndexOf("", indx); - Rtf = Rtf.Remove(newid, 7); - Rtf = Rtf.Insert(newid, string.Format("", rousg.ROUsageID)); - itm.Save(); // this will generate a new ROUsageID that we grab and put in the RO link in the RTF - Rtf = Rtf.Replace(string.Format("", oldid), rousg.ROUsageID.ToString()); - itm.Save(); - MyItemInfo.MyContent.RefreshContentRoUsages(); - } - startIndx = endindx; - } - else - { - Match mt = Regex.Match(Rtf, @"#Link:Transition:([0-9]+) "); - if (mt.Length <= 0) mt = Regex.Match(Rtf, @"#Link:TransitionRange:([0-9]+) "); - if (mt.Length > 0) - { - int endtindx = Rtf.IndexOf("END>", mt.Index) + 4; - indx = mt.Index + 6; // get past '#Link:" - Match m = Regex.Match(Rtf.Substring(indx, endtindx - indx), @"([A-Za-z]*):(.*)\[END>"); - bool isSingleTran = true; - if (Rtf.Substring(indx, 16).IndexOf("TransitionRange") >= 0) isSingleTran = false; - string linkstr = m.Groups[2].Value; - string[] tparts = linkstr.Split(" ".ToCharArray()); - int type = System.Convert.ToInt32(tparts[0]); - int tr1 = System.Convert.ToInt32(tparts[2]); // tparts[2] is token for tranid - int tr2 = tr1; - if (tparts.Length > 3) - tr2 = System.Convert.ToInt32(tparts[3]); // tparts[3] is token for rangeid - bool dispose1 = false; - Item itm1 = null; - bool dispose2 = false; - Item itm2 = null; - using (Item itm = MyItemInfo.Get()) - { - if (itm.ItemID == tr1) - itm1 = itm; // a transition that points to itself should not dispose - else - { - dispose1 = true; - itm1 = Item.Get(tr1); - } - if (itm.ItemID == tr2) - itm2 = itm; // a transition that points to itself should not dispose - else if (tr1 == tr2) - itm2 = itm1; // if both destinations are the same only dispose the first one - else - { - dispose2 = true; - itm2 = Item.Get(tr2); - } - ContentTransition ct = itm.MyContent.ContentTransitions.Add(itm1, itm2); - //Console.WriteLine("CT {0},{1},{2},{3}", ct.TransitionID, itm.ItemID, itm.MyContent.MyContentUnique, itm.MyContent.ContentTransitions.Count); - ct.TranType = type; - - if (isSingleTran) - ct.IsRange = 0; - else if (tr1 != tr2) - ct.IsRange = 1; - else - ct.IsRange = 2; - - int oldidt = ct.TransitionID; - int newidt = Rtf.IndexOf("", indx); - Rtf = Rtf.Remove(newidt, 7); - Rtf = Rtf.Insert(newidt, string.Format("", ct.TransitionID)); - itm.Save(); // this will generate a new TransitionID that we grab and put in the Transition link in the RTF - Rtf = Rtf.Replace(string.Format("", oldidt), ct.TransitionID.ToString()); - itm.Save(); - MyItemInfo.MyContent.RefreshContentTransitions(); - } - if (dispose2) itm2.Dispose(); - if (dispose1) itm1.Dispose(); - } - } - } - MyFlexGrid[r, c] = Rtf; - // B2022-046 need to save context of each cell in the table after fixing RO and Transition links - // otherwise the RTF for that cell will revert back to previous data then the itm.Save() is called above - SaveContents(); - } - } - c = c + 1; - if (c == w) - { - c = 0; - r = r + 1; - } - } - } - public override void SaveCurrentAndContents() - { - IsSaving = true; - if (MyFlexGrid.Row >= 0 && MyFlexGrid.Col >= 0 && MyStepRTB.EditMode) // Only if a Cell is Selected - { - CellRange cr = MyFlexGrid.GetMergedRange(MyFlexGrid.Selection.r1, MyFlexGrid.Selection.c1); // B2018-127 get merged range - int row = MyFlexGrid.Row; - int col = MyFlexGrid.Col; - //SaveContents(); - DoNotRefresh = true; - MyStepRTB.Rtf = MyStepRTB.DoNewLinkInGridCell(); - DoNotRefresh = false; - MyFlexGrid.Row = row; - MyFlexGrid.Col = col; - MyFlexGrid[cr.r1, cr.c1] = MyStepRTB.Rtf; // B2018-127 this saves to the first cell in a merged range - } - if (!MyFlexGrid.IsDirty) return; - SaveContents(); - IsSaving = false; - } - #endregion - #region Miscellaneous Support - internal void SetSearchCell(string SearchString) - { - // Walk thru grid to find first occurance of SearchString and set that cell for - // edit. - int r = 0; - int c = 0; - int w = MyFlexGrid.Cols.Count; - int h = MyFlexGrid.Rows.Count; - while (r < h) - { - CellRange cr = MyFlexGrid.GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) - { - if (MyFlexGrid[r, c] != null) - { - MyFlexGrid.StartEditing(r, c); - TableCellEditor tce = MyFlexGrid.TableCellEditor; - // note that this method is only used from Search Results. - // The search query will handle the case sensitivity, so - // we can just see if contains the string without considering - // case sensitivity. - if (tce.Text.ToUpper().Contains(SearchString.ToUpper())) - return; - } - } - c = c + 1; - if (c == w) - { - c = 0; - r = r + 1; - } - } - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/GridItem.resx b/PROMS/Volian.Controls.Library/GridItem.resx deleted file mode 100644 index f979290c..00000000 --- a/PROMS/Volian.Controls.Library/GridItem.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Normal{Font:Microsoft Sans Serif, 7.8pt;BackColor:255, 255, 255;TextAlign:LeftCenter;Border:Flat,1,Black,Both;} Alternate{BackColor:255, 255, 255;} Fixed{BackColor:Control;ForeColor:ControlText;Border:Flat,1,ControlDark,Both;BackgroundImageLayout:Hide;} Highlight{BackColor:LightCyan;ForeColor:Black;} Focus{BackColor:LightCyan;} Editor{} Search{BackColor:Highlight;ForeColor:HighlightText;} Frozen{BackColor:Beige;} NewRow{ForeColor:GrayText;} EmptyArea{BackColor:Transparent;Border:None,1,Black,Both;} SelectedColumnHeader{} SelectedRowHeader{} GrandTotal{BackColor:Black;ForeColor:White;} Subtotal0{BackColor:ControlDarkDark;ForeColor:White;} Subtotal1{BackColor:ControlDarkDark;ForeColor:White;} Subtotal2{BackColor:ControlDarkDark;ForeColor:White;} Subtotal3{BackColor:ControlDarkDark;ForeColor:White;} Subtotal4{BackColor:ControlDarkDark;ForeColor:White;} Subtotal5{BackColor:ControlDarkDark;ForeColor:White;} - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/ImageItem.cs b/PROMS/Volian.Controls.Library/ImageItem.cs deleted file mode 100644 index 879ded63..00000000 --- a/PROMS/Volian.Controls.Library/ImageItem.cs +++ /dev/null @@ -1,1050 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using System.IO; -using System.Text.RegularExpressions; -using VEPROMS.CSLA.Library; -using JR.Utils.GUI.Forms; -using Volian.Base.Library; - -namespace Volian.Controls.Library -{ - - public partial class ImageItem : EditItem - { - #region IEditItem - // set this for the imageitem so that other code (menuing/ribbons/treeview, etc) will continue to work. Include the MyItemInfo - public override StepRTB MyStepRTB - { - get { return _MyStepRTB; } - } - public override int TableWidth - { - get - { - return (int)_MyPictureBox.Width + ImageMargin; - } - } - /// - /// The left edge of the Tab - /// - public override int ItemLeft - { - get { return Left + lblTab.Left; } - set { Left = value - lblTab.Left; } - } - /// - /// The Location of the Tab - /// - public override Point ItemLocation - { - get { return new Point(Location.X + lblTab.Left, Location.Y); } - set { Location = new Point(value.X - lblTab.Left, value.Y); } - } - /// - /// Width of the Tab and Image - /// - public override int ItemWidth - { - get { return Width - lblTab.Left; } - set - { - Width = ImageMargin + value + lblTab.Left; - } - } - /// - /// Width of the PictureBox - /// - public override int ContentWidth - { - get { return _MyPictureBox.Width; } - set - { - Width = value + lblTab.Left + lblTab.Width; - } - } - public override int BorderWidth { get { return (_MyPictureBox.Width - _MyPictureBox.ClientRectangle.Width); } } - /// - /// Location of the PictureBox - /// - public override Point ContentLocation - { - get { return new Point(Location.X + _MyPictureBox.Left, Location.Y); } - set { Location = new Point(value.X - _MyPictureBox.Left, value.Y); } - } - /// - /// Left edge of the PictureBox - /// - override public int ContentLeft - { - get { return Left + _MyPictureBox.Left; } - } - - override public void AdjustTableWidthAndLocation() - { - Width = Width; - Height = Height; - ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth); - } - override public void SetToolTip(string tip) - { - DevComponents.DotNetBar.SuperTooltipInfo tpi = new DevComponents.DotNetBar.SuperTooltipInfo("", "", tip, null, null, DevComponents.DotNetBar.eTooltipColor.Lemon); - _MyToolTip.MinimumTooltipSize = new Size(0, 24); - _MyToolTip.TooltipDuration = 3; - _MyToolTip.SetSuperTooltip(MyPictureBox, tpi); - ToolTipOnOff(); // B2025-050 Show the tooltip based on User Options Settings - } - public override void ToolTipOnOff() - { - _MyToolTip.Enabled = VlnSettings.StepTypeToolTip; // B2025-XXX Show the tooltip based on User Options Settings - } - - override public void RefreshContent() - { - IdentifyMe(false); - RefreshDisplay(false); - SetExpandAndExpander(MyItemInfo); - } - public override void RefreshOrdinal() - { - TabFormat = null; - } - public override void HandleResize() {} - public override void MatchExpanded() {} - /// - /// Sets the focus to this ImageItem - /// - public override void ItemSelect() - { - if (!_MyPictureBox.Disposing) - { - _MyPictureBox.Focus(); - } - else - { - _MyLog.WarnFormat("Attempt to give Focus to Disposed Object {0}", MyID); - } - ScrollToCenter(); - } - /// - /// Sets the focus to this ImageItem - /// - public override void ItemShow() - { - _MyPictureBox.Focus(); - ScrollToCenter(); - } - public override void SetActive() - { - this.BackColor = MyStepPanel.ActiveColor; - } - public override void SetText() - { - LastMethodsPush("SetText"); - if (MyItemInfo != null) - { - IdentifyMe(false); - } - LastMethodsPop(); - } - public override void SetExpandAndExpander(ItemInfo itemInfo) - { - CanExpand = false; - } - public override void SaveCurrentAndContents() - { - SaveContents(); - } - public override void RefreshDisplay(bool activeMode) - { - if (MyItemInfo.MyContent.MyImage == null) return; // new figure - FileName = MyItemInfo.MyContent.MyImage.FileName; - InsType = FileName.ToUpper() == "PASTE.JPG" ? E_ImageSource.Clipboard : E_ImageSource.File; - System.Drawing.Image img = byteArrayToImage(MyItemInfo.MyContent.MyImage.Data); - MyPictureBox.Image = img; - MyPictureBox.Visible = true; - ImageConfig ic = new ImageConfig(MyItemInfo.MyContent.MyImage); - if (ic != null && ic.Image_Height != 0) - { - _origCfgWd = ic.Image_Width * MyStepPanel.DPI / 72; - _origCfgHt = ic.Image_Height * MyStepPanel.DPI / 72; - } - SetWidthsAndHeights(img); - //need this to trigger update of steptabribbonbuttons: - // 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); - } - public override void ToggleEditView(E_ViewMode vwMode) {} - public override string TabFormat - { - get { return null; } - set { ;} - } - public override bool Expanded - { - get { return true; } - set { ; } - } - public override bool CanExpand - { - get { return false; } - set { ; } - } - public override int TabLeft { get { return lblTab.Left; } set { lblTab.Left = value; } } //taken from griditem - public override Font TabFont { get { return MyStepRTB.Font; } set { ; } } - public override string TabText { get { return lblTab.Text; } } - public override Point TabLocation { get { return lblTab.Location; } } - public override Font ContentFont { get { return MyStepRTB.Font; } set { /*MyStepRTB.Font = value*/; } } - 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) - { - return DialogResult.OK; - } - public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse) - { - return false; - } - public override void PositionToEnd() - { - return; - } - public override void PositionToStart() - { - return; - } - public override string SelectedTextForFind - { - get { return null; } - } - public override bool SpellCheckNext() - { - return true; - } - public override bool Empty - { - get - { - return _MyPictureBox.Image == null; - } - set { _MyPictureBox.Image = null; } - } - public override void RefreshTab() - { - TabFormat = null; - } - public override void SetupHeader(ItemInfo itemInfo) { } - public override void ShowExpanded() { } - #endregion - #region Properties - public enum E_ImageSource : int - { - None = 0, Clipboard = 1, File = 2, RoFigure = 3 - } - public System.Windows.Forms.PictureBox MyPictureBox - { - get { return _MyPictureBox; } - } - private string FileName = null; - private static int _ImageMargin = 18; - /// - /// 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. - /// - public static int ImageMargin - { - get { return _ImageMargin; } - set { _ImageMargin = value; } - } - private bool _IsDirty = false; - private int _origCfgHt = 0; // keep track if original size was stored in cfg - private int _origCfgWd = 0; - private bool _pastedNew = false; // need this for flagging newly pasted image (may need to clear cfg) - private DisplayTags _displayTags = new DisplayTags(); - //House myhouse = new House(); - - #endregion - #region Constructors - public ImageItem() - { - InitializeComponent(); - } - // the following displays for existing images - public ImageItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand) - { - InitializeComponent(); - - MyItemInfo = itemInfo; - SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, false); - if (MyItemInfo.MyContent.MyImage != null && MyItemInfo.MyContent.MyImage.Data != null) // this is figure/image (not RO) - { - FileName = MyItemInfo.MyContent.MyImage.FileName; - InsType = FileName.ToUpper() == "PASTE.JPG" ? E_ImageSource.Clipboard : E_ImageSource.File; - System.Drawing.Image img = byteArrayToImage(MyItemInfo.MyContent.MyImage.Data); - MyPictureBox.Image = img; - MyPictureBox.Visible = true; - ImageConfig ic = new ImageConfig(MyItemInfo.MyContent.MyImage); - if (ic != null && ic.Image_Height != 0) // embedded image (not RO) - { - _origCfgWd = ic.Image_Width * MyStepPanel.DPI / 72; - _origCfgHt = ic.Image_Height * MyStepPanel.DPI / 72; - } - SetWidthsAndHeights(img); - } - else - { - // get ro image data from link within the steprtb: - HandleRoImage(); - DisplayText vlntxt = new DisplayText(MyItemInfo, E_EditPrintMode.Edit, E_ViewMode.View, false, E_FieldToEdit.Text, true, null, null, false); - MyStepRTB.OrigDisplayText = vlntxt; - InsType = E_ImageSource.RoFigure; - } - AdjustTableWidthAndLocation(); - AddEventHandlers(); - MyStepRTB.RemoveEventHandlers(); - MyStepRTB.Visible = false; - } - private int _newSizeWd = 0; - private int _newSizeHt = 0; - public void SizeImage(int wd, int ht) - { - MyPictureBox.Width = wd; - MyPictureBox.Height = ht; - MyPictureBox.SizeMode = PictureBoxSizeMode.Zoom; - this.Width = MyPictureBox.Width + ImageMargin; - this.Height = MyPictureBox.Height + 10; - _newSizeWd = wd / (MyStepPanel.DPI / 72); - _newSizeHt = ht / (MyStepPanel.DPI / 72); - - if (!MyItemInfo.FormatStepData.StepEditData.TypeMenu.MenuItem.ToUpper().Contains("AER")) ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth); - _IsDirty = true; - } - private void SetWidthsAndHeights(System.Drawing.Image img) - { - - int wd = img.Width * MyStepPanel.DPI / 72; // converts from screen resolution's DPI to image's points (72/inch) - int ht = img.Height * MyStepPanel.DPI / 72; - - - if (MyItemInfo.MyContent.MyImage != null) // image is null if creating new. - { - ImageConfig ic = new ImageConfig(MyItemInfo.MyContent.MyImage); - if (!_pastedNew && ic != null && ic.Image_Height != 0) - { - wd = ic.Image_Width * MyStepPanel.DPI / 72; - ht = ic.Image_Height * MyStepPanel.DPI / 72; - } - } - - MyPictureBox.Visible = true; - MyPictureBox.Width = wd; - MyPictureBox.Height = ht; - MyPictureBox.SizeMode = PictureBoxSizeMode.Zoom; // as resize matches width/height. - this.Width = MyPictureBox.Width + ImageMargin; - this.Height = MyPictureBox.Height + 10; - if (_displayTags != null) - { - // Set the Height and Width on the step properties page for the new image - _displayTags.SetNewImageHeightAndWidth(ht, wd); - } - } - - - // the following gets called for 'NEW' images - private E_ImageSource InsType = E_ImageSource.None; - public ImageItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem, ImageItem.E_ImageSource insType, DisplayTags displayTags) - { - InitializeComponent(); - MyItemInfo = itemInfo; - _displayTags = displayTags; - - if (MyItemInfo.MyContent.MyImage != null && MyItemInfo.MyContent.MyImage.Data != null) // this is figure/image (not RO) - { - SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false); - FileName = MyItemInfo.MyContent.MyImage.FileName; - InsType = FileName.ToUpper() == "PASTE.JPG" ? E_ImageSource.Clipboard : E_ImageSource.File; - System.Drawing.Image img = byteArrayToImage(MyItemInfo.MyContent.MyImage.Data); - MyPictureBox.Image = img; - MyPictureBox.Visible = true; - ImageConfig ic = new ImageConfig(MyItemInfo.MyContent.MyImage); - if (ic != null && ic.Image_Height != 0) // embedded image (not RO) - { - _origCfgWd = ic.Image_Width * MyStepPanel.DPI / 72; - _origCfgHt = ic.Image_Height * MyStepPanel.DPI / 72; - } - SetWidthsAndHeights(img); - } - else if (MyItemInfo.MyContent.Text != null && MyItemInfo.MyContent.Text.ToUpper().Contains("RO")) - { - SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false); - // get ro image data from link within the steprtb: - HandleRoImage(); - DisplayText vlntxt = new DisplayText(MyItemInfo, E_EditPrintMode.Edit, E_ViewMode.View, false, E_FieldToEdit.Text, true, null, null, false); - MyStepRTB.OrigDisplayText = vlntxt; - InsType = E_ImageSource.RoFigure; - } - else - { - InsType = insType; - FileName = null; - //InitializeComponent(); - SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false); - //MyPictureBox.Width = 100; - //MyPictureBox.Height = 100; - this.Width = 100 + ImageMargin; - this.Height = 100; - if (insType == ImageItem.E_ImageSource.File) - { - ImageFileDialog(); - } - else if (insType == ImageItem.E_ImageSource.Clipboard) - { - // see if there is an image in clipboard and if so, insert it: - System.Drawing.Image img = Clipboard.GetImage(); - if (img != null) - { - MyPictureBox.Image = img; - SetWidthsAndHeights(img); - string ext = GetImageFormatExtension(img); - FileName = "paste." + ext; - _IsDirty = true; - } - } - else // this is an Ro image - use displaytext and steprtb to get image data - { - DisplayText vlntxt = new DisplayText(MyItemInfo, E_EditPrintMode.Edit, E_ViewMode.View, false, E_FieldToEdit.Text, true, null, null, false); - MyStepRTB.OrigDisplayText = vlntxt; - } - } - AdjustTableWidthAndLocation(); - this.Controls.Add(this._MyPictureBox); - AddEventHandlers(); - MyStepRTB.RemoveEventHandlers(); - MyStepRTB.Visible = false; - } - private void ImageFileDialog() - { - OpenFileDialog openFileDialog1 = new OpenFileDialog(); - - openFileDialog1.InitialDirectory = "c:\\"; - openFileDialog1.Filter = "Image files (*.jpg;*.tif;*.bmp;*.png)|*.jpg;*.tif;*.bmp;*.png|All files (*.*)|*.*"; - openFileDialog1.FilterIndex = 0; - openFileDialog1.RestoreDirectory = true; - - if (openFileDialog1.ShowDialog() == DialogResult.OK) - { - try - { - // check that it is an image - System.Drawing.Image img = System.Drawing.Image.FromFile(openFileDialog1.FileName); - if (img != null) - { - FileName = openFileDialog1.FileName; - MyPictureBox.Image = img; - SetWidthsAndHeights(img); - _IsDirty = true; - } - } - catch (Exception ex) - { - FlexibleMessageBox.Show("Could not create image, check file type.", "Error on Image File Selection"); - return; - } - } - } - //public static System.Drawing.Imaging.ImageFormat GetImageFormat(this System.Drawing.Image img) - //{ - // 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 - #region RO_Images - public void HandleRoImage() - { - string imageText = null; - ProcedureInfo proc = MyItemInfo.MyProcedure; - DocVersionInfo dvi = proc.MyDocVersion; - ROFstInfo rofst = dvi.DocVersionAssociations[0].MyROFst; - ROFSTLookup lookup = rofst.GetROFSTLookup(dvi); - string linkInfoText = MyItemInfo.MyContent.Text.Replace(@"\u8209?", "-"); - int ind = linkInfoText.IndexOf("[END>"); // found cases where the ro figure had 2 links stored within content->text (BGE data) - if (ind > 0) - { - int indx = linkInfoText.IndexOf("[END>", ind + 3); - if (indx > -1) - { - // link is duplicated (bad data), but handle it: - linkInfoText = linkInfoText.Substring(0, linkInfoText.IndexOf(@"\v ", ind + 3)); - } - } - linkInfoText = linkInfoText.Replace(@"\v ", ""); - Match m = Regex.Match(linkInfoText, @"(.*)[#]Link:([A-Za-z]*):(.*)"); - string val = null; - if (m.Length > 0) // if m.lengh is zero, then no match was found - no RO was entered in the figure substep - { - if (m.Groups.Count < 4) - { - val = string.Format("{0}\n{1}\n{2}n{3}", - linkInfoText.Substring(0, linkInfoText.Length - 16), - linkInfoText.Substring(linkInfoText.Length - 16, 8), - linkInfoText.Substring(linkInfoText.Length - 8, 4), - linkInfoText.Substring(linkInfoText.Length - 4, 4)); - val = val.Replace(@"\u8209?", "-").Replace(@"\u9586?", @"\"); // replace dash and backslash symbols with dash and backslash characters - } - else - { - string[] subs = m.Groups[3].Value.Split(" ".ToCharArray()); - // B2022-088: Find Doc Ro button not working in Word Sections - val = lookup.GetRoChild(subs[1]).value; - if (val == null || val == "?") val = lookup.GetRoChild(subs[1].Substring(0, 12)).value; - if (val == "?") - { - // Do 'empty' image box. - //_MyLog.WarnFormat("\r\nMissing Referenced Object {0} in {1}", subs[1], itemInfo.ShortPath); - } - } - } - GC.Collect(); // memory garbage collection (Regex memory bug) - if (val != null && val != "?") - { - string imgname = null; - int W = 0; - int H = 0; - string[] vals = val.Split("\n".ToCharArray()); - W = (int)(Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips); - int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier); - H = lines * 12; - try - { - imgname = vals[0]; - ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]); - if (roImage != null) - imageText = val; - else - { - roImage = rofst.GetROImageByFilename(vals[0], MyItemInfo);// need code to go and get an ROImaage if it exists - if (roImage != null) - imageText = val; - } - AddROImageToScreen(W, H, imageText); - - } - catch (Exception ex) - { - string msg = string.Format("Could not display image {0}.", imgname); - FlexibleMessageBox.Show(msg); - } - } - } - - - public bool ThumbnailCallback() - { - return false; - } - public void AddROImageToScreen(int w, int h, string imageText) - { - string[] vals = imageText.Split("\n".ToCharArray()); - ProcedureInfo proc = MyItemInfo.MyProcedure; - DocVersionInfo dvi = proc.ActiveParent as DocVersionInfo; - ROFstInfo rofst = dvi.DocVersionAssociations[0].MyROFst; - ROImageInfo roImageInfo = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]); - if (roImageInfo == null) roImageInfo = rofst.GetROImageByFilename(vals[0], MyItemInfo); - if (roImageInfo != null) - { - System.Drawing.Image.GetThumbnailImageAbort myCallback = - new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback); - ROImageConfig rc = new ROImageConfig(roImageInfo); - int size = Convert.ToInt32(rc.Image_Size); - byte[] cnt = roImageInfo.Content; - byte[] dcnt = ROImageInfo.Decompress(cnt, size); - MemoryStream ms = new MemoryStream(dcnt); - System.Drawing.Image img2 = System.Drawing.Image.FromStream(ms); - // if there is config data that saves the resize of the image, use it, otherwise use what was passed in: - StepConfig sc = new StepConfig(MyItemInfo as StepInfo); - SizeF sizef = new Size(1, 1); - if (sc.Step_ImageHeight == null || sc.Step_ImageHeight == 0) - { - sizef = new SizeF((img2.Width / img2.HorizontalResolution), - (img2.Height / img2.VerticalResolution)); - float fscale = Math.Min(w / sizef.Width, h / sizef.Height); - sizef.Width *= fscale; - sizef.Height *= fscale; - } - else - { - sizef = new Size(sc.Step_ImageWidth, sc.Step_ImageHeight); - } - System.Drawing.Image img = img2.GetThumbnailImage((int)sizef.Width, (int)sizef.Height, myCallback, IntPtr.Zero); - MyPictureBox.Image = img; - SetWidthsAndHeights(img); - } - } - #endregion - #region EventHandlers - private void ImageItem_Enter(object sender, EventArgs e) - { - if (MyStepPanel.DisplayItemChanging) return; - SetMenu("OpenContextMenu"); - MyStepPanel.SelectedEditItem = this; - } - private void AddEventHandlers() - { - // Always be sure to add the same event handlers to RemoveEventHandlers - MyItemInfo.MyContent.Changed += new VEPROMS.CSLA.Library.ContentInfoEvent(MyContent_Changed); - this.Enter += new System.EventHandler(ImageItem_Enter); - this.MyPictureBox.Enter += new System.EventHandler(ImageItem_Enter); - this.Click += new EventHandler(ImageItem_Click); - this.MyPictureBox.Click += new EventHandler(ImageItem_Click); - this.MyPictureBox.PreviewKeyDown += new PreviewKeyDownEventHandler(ImageItem_PreviewKeyDown); //note that PictureBox does not have cursorkey events - this.MyPictureBox.KeyDown += new KeyEventHandler(ImageItem_KeyDown); - this.MyStepRTB.RoInsert += new StepRTBRoEvent(MyStepRTB_RoInsert); - this.MyStepRTB.DoSaveContents += new StepRTBEvent(MyStepRTB_DoSaveContents); // for storing RO data - this.MyPictureBox.Resize += MyPictureBox_Resize; - this.MyPictureBox.MouseDown += MyPictureBox_MouseDown; - } - - void MyPictureBox_MouseDown(object sender, MouseEventArgs e) - { - SetMenu("OpenContextMenu"); - } - - void MyPictureBox_Resize(object sender, EventArgs e) - { - if (this.Height != _MyPictureBox.Height + _MyPictureBox.Top + 7) // add in 7 to make it look good // + 10) - { - LastMethodsPush(string.Format("MyPictureBox_Resize {0}", _MyPictureBox.Height)); - this.Height = _MyPictureBox.Height + _MyPictureBox.Top + 7; - LastMethodsPop(); - } - } - private void RemoveEventHandlers() - { - // Always be sure to add the same event handlers to RemoveEventHandlers - MyItemInfo.MyContent.Changed -= new VEPROMS.CSLA.Library.ContentInfoEvent(MyContent_Changed); - this.Enter -= new System.EventHandler(ImageItem_Enter); - this.MyPictureBox.Enter -= new System.EventHandler(ImageItem_Enter); - this.Click -= new EventHandler(ImageItem_Click); - this.MyPictureBox.Click -= new EventHandler(ImageItem_Click); - this.MyPictureBox.PreviewKeyDown -= new PreviewKeyDownEventHandler(ImageItem_PreviewKeyDown); - this.MyPictureBox.KeyDown -= new KeyEventHandler(ImageItem_KeyDown); - this.MyStepRTB.RoInsert -= new StepRTBRoEvent(MyStepRTB_RoInsert); - this.MyStepRTB.DoSaveContents -= new StepRTBEvent(MyStepRTB_DoSaveContents); - this.MyPictureBox.Resize -= MyPictureBox_Resize; - this.MyPictureBox.MouseDown -= MyPictureBox_MouseDown; - } - void ImageItem_Click(object sender, EventArgs e) - { - if (MyStepPanel.DisplayItemChanging) return; - MyStepPanel.SelectedEditItem = this; - } - // the PictureBox does not have cursor key event support - did this by previewing keydowns and - // if the key is arrow up/down, do associated cursormovement through the StepPanel - void ImageItem_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) - { - switch (e.KeyCode) - { - case Keys.Up: - MyStepPanel.CursorMovement(this, new Point(0, 0), E_ArrowKeys.Up); - break; - case Keys.Down: - MyStepPanel.CursorMovement(this, new Point(0, 0), E_ArrowKeys.Down); - break; - } - } - - void ImageItem_KeyDown(object sender, KeyEventArgs e) - { - if (e.Control) - { - switch (e.KeyCode) - { - case Keys.V: // handle paste of an image - if (MyStepPanel.VwMode == E_ViewMode.View) - { - e.Handled = true; - return; - } - if (InsType == E_ImageSource.RoFigure && MyItemInfo.MyContent.MyImage == null) // on an RO image - { - FlexibleMessageBox.Show("Cannot replace an existing RO figure/image. Use the Step Properties panel/RO tab.", "Warning, no paste/replace for RO images."); - e.Handled = true; - return; - } - PasteImage(); - e.Handled = true; - return; - } - } - } - public void PasteImage() - { - bool setdata = false; - System.Drawing.Image img = Clipboard.GetImage(); - if (img == null) // let user know there is no valid data in clipboard: - { - FlexibleMessageBox.Show(this, "The clipboard does not contain image data.", "Cannot paste.", MessageBoxButtons.OK); - return; - } - if (MyItemInfo.MyContent.MyImage != null && img != null) // see if there already is an image and if so - ask if user wants to replace. - { - if (FlexibleMessageBox.Show(this, "Do you want to replace the existing image?", "Confirm Image Replace", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) - { - setdata = true; - } - } - else if (MyItemInfo.MyContent.ContentRoUsageCount > 0 && img != null) - { - FlexibleMessageBox.Show("Cannot replace an existing RO figure/image. Use the Step Properties panel/RO tab.", "Warning, no paste/replace for RO images."); - return; - } - else if (img != null) // no existing image, be sure there is valid data in clipboard - setdata = true; - if (setdata) - { - _IsDirty = true; - _pastedNew = true; - MyPictureBox.Image = img; - SetWidthsAndHeights(img); - string ext = GetImageFormatExtension(img); - FileName = "paste." + ext; - } - } - void MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args) - { - int sel = MyStepRTB.SelectionStart + args.ValText.Length; - _IsDirty = true; - InsType = E_ImageSource.RoFigure; - MyStepRTB.UpdateStepRtb(args.LinkText, args.ValText); - HandleRoImage(); - } - void MyStepRTB_DoSaveContents(object sender, EventArgs args) - { - _IsDirty = true; - InsType = E_ImageSource.RoFigure; - SaveCurrentAndContents(); - HandleRoImage(); - } - #endregion - #region ContextMenu - void SetMenu(string contentMenu) - { - if (contentMenu == null) - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu(); - else if (contentMenu == "OpenContextMenu") - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetContextMenuImage(this); - } - #endregion - #region Methods - public override void SetFocus() - { - MyPictureBox.Focus(); - } - public override void SaveContents() - { - MyStepRTB.Visible = false; - if (!_IsDirty) return; - if (InsType != E_ImageSource.None && InsType != E_ImageSource.RoFigure) - { - SaveImage(); - } - else if (InsType == E_ImageSource.RoFigure) - { - DisplayText vlntxt = new DisplayText(MyItemInfo, E_EditPrintMode.Edit, E_ViewMode.View, false, E_FieldToEdit.Text, true, null, null, false); - if (MyStepRTB.OrigDisplayText == null) - { - MyStepRTB.OrigDisplayText = vlntxt; - } - if (MyStepRTB.Text == "") - { - MyStepRTB.AddRtfText(vlntxt.StartText); - } - bool success = MyStepRTB.OrigDisplayText.Save((RichTextBox)MyStepRTB); - if (success && _newSizeHt != 0) - { - StepConfig sc = new StepConfig(MyItemInfo as StepInfo); - sc.Step_ImageWidth = (int)(_newSizeWd / (MyStepPanel.DPI / 72f)); - sc.Step_ImageHeight = (int)(_newSizeHt / (MyStepPanel.DPI / 72f)); - using (Item item = MyItemInfo.Get()) - { - item.MyContent.Config = sc.ToString(); - item.Save(); - } - } - } - _IsDirty = false; - } - public void SaveImage() - { - try - { - using (Item _MyItem = MyItemInfo.Get()) - { - byte[] imgToByte = imageToByteArray(MyPictureBox.Image, FileName); - if (imgToByte == null) return; - int origLen = imgToByte.Length; - bool compressed = false; - // if file is a tif or bmp see if compressing it saves space and if so, save the - // compressed data with a flag in config, the size needed to decompress, to show it is compressed. - if (FileName.ToUpper().EndsWith(".TIFF") || FileName.ToUpper().EndsWith(".TIF") || FileName.ToUpper().EndsWith(".BMP")) - { - byte[] cmp = ROImageInfo.Compress(imgToByte); - if (origLen > cmp.Length) - { - imgToByte = cmp; - compressed = true; - } - } - ImageConfig imgCfg = null; - if (_pastedNew && compressed) - { - imgCfg = new ImageConfig(); - imgCfg.Image_DataSize = origLen; - _MyItem.MyContent.MyImage.Config = imgCfg.ToString(); - } - else if (_newSizeHt != 0) - { - if (MyItemInfo.MyContent.MyImage == null && imgCfg == null) - imgCfg = new ImageConfig(); - else if (imgCfg == null) - imgCfg = new ImageConfig(MyItemInfo.MyContent.MyImage); - // B2017-155 Round the value by adding .51F - imgCfg.Image_Width = (int)(.51F + _newSizeWd / (MyStepPanel.DPI / 72f)); - imgCfg.Image_Height = (int)(.51F + _newSizeHt / (MyStepPanel.DPI / 72f)); - if (compressed) imgCfg.Image_DataSize = origLen; - _MyItem.MyContent.MyImage.Config = imgCfg.ToString(); - } - else if (compressed) - { - if (MyItemInfo.MyContent.MyImage == null && imgCfg == null) - imgCfg = new ImageConfig(); - else if (imgCfg == null) - imgCfg = new ImageConfig(MyItemInfo.MyContent.MyImage); - imgCfg.Image_DataSize = origLen; - _MyItem.MyContent.MyImage.Config = imgCfg.ToString(); - } - _MyItem.MyContent.MyImage.Data = imgToByte; - _MyItem.MyContent.MyImage.FileName = FileName; - _MyItem.MyContent.MyImage.ImageType = 1; - _MyItem.MyContent.MyImage.DTS = DateTime.Now; - _MyItem.MyContent.MyImage.UserID = Volian.Base.Library.VlnSettings.UserID; - _MyItem.MyContent.DTS = DateTime.Now; - _MyItem.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; - _MyItem.Save(); - } - StepConfig sc = MyItemInfo.MyConfig as StepConfig; - // 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 - // item Step_MultipleChangeID has the save built in to it. - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds - && !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange) - { - if (sc == null) sc = new StepConfig(); - sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId; - } - // We saved changes. Reset the change bar override. - // 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 - // time a change was made, the change bar remained turned off. - if (sc != null) - sc.Step_CBOverride = null; // clear the change bar override - MyStepRTB.ClearUndo(); - } - catch (Exception ex) - { - FlexibleMessageBox.Show("The image could not be saved.", "Image Save", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - _newSizeHt = 0; - _newSizeWd = 0; - } - public static byte[] imageToByteArray(System.Drawing.Image imageIn, string fname) - { - // get filename's extension to map to imageformat: - string ext = fname.Substring(fname.LastIndexOf(".") + 1).ToUpper(); - System.Drawing.Imaging.ImageFormat ifmt = System.Drawing.Imaging.ImageFormat.Gif; - switch (ext) - { - case ("JPG"): - ifmt = System.Drawing.Imaging.ImageFormat.Jpeg; - break; - case ("TIF"): - case ("TIFF"): - ifmt = System.Drawing.Imaging.ImageFormat.Tiff; - break; - case ("WMF"): - ifmt = System.Drawing.Imaging.ImageFormat.Wmf; - break; - case ("BMP"): - ifmt = System.Drawing.Imaging.ImageFormat.Bmp; - break; - case ("EMF"): - ifmt = System.Drawing.Imaging.ImageFormat.Emf; - break; - case ("GIF"): - ifmt = System.Drawing.Imaging.ImageFormat.Gif; - break; - case ("ICO"): - ifmt = System.Drawing.Imaging.ImageFormat.Icon; - break; - case ("PNG"): - ifmt = System.Drawing.Imaging.ImageFormat.Png; - break; - default: - FlexibleMessageBox.Show("Invalid File Type"); - return null; - } - MemoryStream ms = new MemoryStream(); - imageIn.Save(ms, ifmt); - return ms.ToArray(); - } - - public System.Drawing.Image byteArrayToImage(byte[] byteArrayIn) - { - // if there is config data, DataSize, then decompress the data: - ImageConfig imgCfg = new ImageConfig(MyItemInfo.MyContent.MyImage); - if (imgCfg.Image_DataSize > 0) byteArrayIn = ROImageInfo.Decompress(byteArrayIn, imgCfg.Image_DataSize); - MemoryStream ms = new MemoryStream(byteArrayIn); - System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms); - return returnImage; - } - // the following is used if an image is being inserted using Before/after from steptabribbon: - public static void AddImageIfNeeded(ItemInfo newItemInfo) - { - string filename = null; - System.Drawing.Image img = Clipboard.GetImage(); - if (img != null) - { - // Ask user if they want to use the clipboard image. - DialogResult dr = FlexibleMessageBox.Show("Clipboard has an image, use this (select Yes) or select a file (select No)?", "Insert Image Before/After", MessageBoxButtons.YesNo); - if (dr == DialogResult.Yes) - { - - string ext = ImageItem.GetImageFormatExtension(img); - filename = "paste." + ext; - } - else - img = null; - } - if (img == null) - { - OpenFileDialog openFileDialog1 = new OpenFileDialog(); - openFileDialog1.InitialDirectory = "c:\\"; - openFileDialog1.Filter = "Image files (*.jpg;*.tif;*.bmp;*.png)|*.jpg;*.tif;*.bmp;*.png|All files (*.*)|*.*"; - openFileDialog1.FilterIndex = 0; - openFileDialog1.RestoreDirectory = true; - DialogResult dr = openFileDialog1.ShowDialog(); - if (dr == DialogResult.OK) - { - // check that it is an image - try - { - img = System.Drawing.Image.FromFile(openFileDialog1.FileName); - } - catch (Exception ex) - { - img = null; - } - if (img != null) filename = openFileDialog1.FileName; - } - if (filename == null) - { - if (dr != DialogResult.Cancel) - { - string msg = string.Format("Could not display image {0}.", openFileDialog1.FileName); - FlexibleMessageBox.Show(msg); - } - return; // user must have exited out or entered a bad filename. - } - } - byte[] imgToByte = imageToByteArray(img, filename); - int origLen = imgToByte.Length; - bool compressed = false; - // if file is a tif or bmp see if compressing it saves space and if so, save the - // compressed data with a flag in config, the size needed to decompress, to show it is compressed. - if (filename.ToUpper().EndsWith(".TIFF") || filename.ToUpper().EndsWith(".TIF") || filename.ToUpper().EndsWith(".BMP")) - { - byte[] cmp = ROImageInfo.Compress(imgToByte); - if (origLen > cmp.Length) - { - imgToByte = cmp; - compressed = true; - } - } - using (Item _MyItem = newItemInfo.Get()) - { - ImageConfig imgCfg = null; - if (compressed) - { - imgCfg = new ImageConfig(); - imgCfg.Image_DataSize = origLen; - _MyItem.MyContent.MyImage.Config = imgCfg.ToString(); - } - _MyItem.MyContent.MyImage.Data = imgToByte; - _MyItem.MyContent.MyImage.FileName = filename; - _MyItem.MyContent.MyImage.ImageType = 1; - _MyItem.MyContent.MyImage.DTS = DateTime.Now; - _MyItem.MyContent.MyImage.UserID = Volian.Base.Library.VlnSettings.UserID; - _MyItem.MyContent.DTS = DateTime.Now; - _MyItem.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; - _MyItem.Save(); - } - } - public override void IdentifyMe(bool highlight) - { - if (highlight) - this.BackColor = Color.Gray; - else - { - if (MyPictureBox.Focused || this.Focused) // If active Set BackColor to the active color - this.BackColor = MyStepPanel.ActiveColor; - else // note that the 'inactive' color is actually MyStepPanel.PanelColor - this.BackColor = MyItemInfo.ItemAnnotationCount == 0 ? MyStepPanel.PanelColor : MyStepPanel.AnnotationColor; - } - } - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/ImageItem.designer.cs b/PROMS/Volian.Controls.Library/ImageItem.designer.cs deleted file mode 100644 index 502e548e..00000000 --- a/PROMS/Volian.Controls.Library/ImageItem.designer.cs +++ /dev/null @@ -1,163 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class ImageItem - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - _BeingDisposed = true; - DisposeOfChildren(MyAfterEditItems); - DisposeOfChildren(MyBeforeEditItems); - DisposeOfChildren(MyRNOEditItems); - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - MyItemInfo.MyContent.Changed -= new VEPROMS.CSLA.Library.ContentInfoEvent(MyContent_Changed); - MyItemInfo.MyProcedure.MyContent.Changed -= new VEPROMS.CSLA.Library.ContentInfoEvent(MyContent_Changed); - } - private void DisposeOfChildren(System.Collections.Generic.List children) - { - if (children == null) return; - foreach (EditItem child in children) - child.Dispose(); - children = null; - } - - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - this._MyPictureBox = new System.Windows.Forms.PictureBox(); - this._MyStepRTB = new Volian.Controls.Library.StepRTB(this.components); - this._MyStepRTB.Location = new System.Drawing.Point(0, -20); // position richtextbox outside visible range - this.lblTab = new System.Windows.Forms.Label(); - this._MyToolTip = new DevComponents.DotNetBar.SuperTooltip(); - //this._MyvlnExpander = new Volian.Controls.Library.vlnExpander(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.SuspendLayout(); - // - // _MyPictureBox - // - this._MyToolTip.SetSuperTooltip(this._MyPictureBox, new DevComponents.DotNetBar.SuperTooltipInfo("Figure", "", "The image size can be adjusted from the Tags tab on the Step Properties panel", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(150, 80))); - this._MyPictureBox.Location = new System.Drawing.Point(7, 5); - this._MyPictureBox.Name = "_MyPictureBox"; - // - // lblTab - // - this.lblTab.BackColor = System.Drawing.Color.Transparent; - this.lblTab.Location = new System.Drawing.Point(0, 0); - this.lblTab.Name = "lblTab"; - this.lblTab.Size = new System.Drawing.Size(61, 23); - this.lblTab.TabIndex = 3; - this.lblTab.Visible = false; - //this.lblTab.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblTab_MouseDown); - // - // _MyStepRTB - // - this._MyStepRTB.Visible = false; - //this._MyStepRTB.AdjustSize = new System.Drawing.Size(0, 0); - //this._MyStepRTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - // | System.Windows.Forms.AnchorStyles.Right))); - //this._MyStepRTB.BackColor = System.Drawing.Color.Linen; - //this._MyStepRTB.BorderStyle = System.Windows.Forms.BorderStyle.None; - ////KBR this._MyStepRTB.CheckAbove = "|│└┬┼├┌┴┐┤"; - ////KBR this._MyStepRTB.CheckBelow = "|│"; - ////KBR this._MyStepRTB.CheckLeft = "-─┤┬├┼┌┐└‑"; - ////KBR this._MyStepRTB.CheckRight = "-─‑"; - this._MyStepRTB.FieldToEdit = VEPROMS.CSLA.Library.E_FieldToEdit.Text; // was text, but would not process steptabribbon button enabling. .Text; - //this._MyStepRTB.Font = new System.Drawing.Font("Prestige Elite Tall", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); - //this._MyStepRTB.Location = new System.Drawing.Point(107, 0); - //this._MyStepRTB.Margin = new System.Windows.Forms.Padding(4); - //this._MyStepRTB.MyClassName = "RichEdit20W"; - //this._MyStepRTB.MyItemInfo = null; - //this._MyStepRTB.MyLinkText = null; - //this._MyStepRTB.Name = "_MyStepRTB"; - //this._MyStepRTB.ProcessKeystrokes = true; - //this._MyStepRTB.RTBRangeStatus = Volian.Controls.Library.StepRTB.RangeStatus.NoContainedLinks; - //this._MyStepRTB.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; - //this._MyStepRTB.ShowDebug = false; - //this._MyStepRTB.Size = new System.Drawing.Size(312, 25); - //this._MyStepRTB.TabIndex = 2; - //this._MyStepRTB.Text = ""; - //this._MyStepRTB.VwMode = VEPROMS.CSLA.Library.E_ViewMode.Edit; - //KBR this._MyStepRTB.LinkGoTo += new Volian.Controls.Library.StepRTBLinkEvent(this._MyStepRTB_LinkGoTo); - //this._MyStepRTB.Enter += new System.EventHandler(this._StepRTB_Enter); - //this._MyStepRTB.HeightChanged += new Volian.Controls.Library.StepRTBEvent(this._MyStepRTB_HeightChanged); - //this._MyStepRTB.ModeChange += new Volian.Controls.Library.StepRTBModeChangeEvent(this._MyStepRTB_ModeChange); - //KBR this._MyStepRTB.LinkModifyTran += new Volian.Controls.Library.StepRTBLinkEvent(this._MyStepRTB_LinkModifyTran); - //this._MyPictureBox..CursorKeyPress += new Volian.Controls.Library.StepRTBCursorKeysEvent(this._MyStepRTB_CursorKeyPress); - //this._MyPictureBox.CursorMovement += new Volian.Controls.Library.StepRTBCursorMovementEvent(this._MyStepRTB_CursorMovement); - //KBR this._MyStepRTB.LinkModifyRO += new Volian.Controls.Library.StepRTBLinkEvent(this._MyStepRTB_LinkModifyRO); - //KBR this._MyStepRTB.SetMenu += new StepRTBMenuEvent(_MyStepRTB_SetMenu); - //this._MyStepRTB.AdjustTableWidth += new StepRTBTableWidthEvent(_MyStepRTB_AdjustTableWidth); - //KBR this._MyStepRTB.IsNotCurrentSelection += new StepRTBBooleanEvent(_MyStepRTB_IsNotCurrentSelection); - //KBR this._MyStepRTB.OpenAnnotations += new StepRTBEvent(_MyStepRTB_OpenAnnotations); - //KBR this._MyStepRTB.InsertPgBrk += new StepRTBEvent(_MyStepRTB_InsertPgBrk); - //KBR this._MyStepRTB.EnterKeyPressed += new StepRTBCursorKeysEvent(_MyStepRTB_EnterKeyPressed); - //KBR this._MyStepRTB.CheckClipboard += new StepRTBBooleanEvent(_MyStepRTB_CheckClipboard); - //KBR this._MyStepRTB.CopyStep += new StepRTBEvent(_MyStepRTB_CopyStep); - //KBR this._MyStepRTB.OpenContextMenu += new StepRTBLocationEvent(_MyStepRTB_OpenContextMenu); - //KBR this._MyStepRTB.DoMouseWheel += new StepRTBMouseEvent(_MyStepRTB_DoMouseWheel); - //this._MyStepRTB.DoSaveContents += new StepRTBEvent(_MyStepRTB_DoSaveContents); - //KBR this._MyStepRTB.RoInsert += new StepRTBRoEvent(_MyStepRTB_RoInsert); - //this._MyStepRTB.Resize += new System.EventHandler(_MyStepRTB_Resize); - - //this._MyvlnExpander.Attachment = false; - //this._MyvlnExpander.BackColor = System.Drawing.Color.Transparent; - //this._MyvlnExpander.BorderColor = System.Drawing.Color.Silver; - //this._MyvlnExpander.Color1 = System.Drawing.Color.Aquamarine; - //this._MyvlnExpander.Color2 = System.Drawing.Color.Violet; - //this._MyvlnExpander.Expanded = false; - //this._MyvlnExpander.ForeColor = System.Drawing.SystemColors.ButtonHighlight; - //this._MyvlnExpander.GradientAngle = 45; - //this._MyvlnExpander.Location = new System.Drawing.Point(4, 4); - //this._MyvlnExpander.Margin = new System.Windows.Forms.Padding(5); - //this._MyvlnExpander.MyExpanderStyle = Volian.Controls.Library.ExpanderStyle.Round; - //this._MyvlnExpander.Name = "_MyvlnExpander"; - //this._MyvlnExpander.PenWidth = 0; - //this._MyvlnExpander.Size = new System.Drawing.Size(17, 17); - //this._MyvlnExpander.TabIndex = 0; - //this._MyvlnExpander.Trans1 = 128; - //this._MyvlnExpander.Trans2 = 128; - //this._MyvlnExpander.WidthFactor = 7; - //this._MyvlnExpander.BeforeColapse += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_BeforeColapse); - //this._MyvlnExpander.BeforeExpand += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_BeforeExpand); - // - // ImageItem - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.SystemColors.ButtonFace; - this.Controls.Add(this._MyStepRTB); - //this.Controls.Add(this._MyvlnExpander); - this.Controls.Add(this._MyPictureBox); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - - this.Name = "ImageItem"; - this.Size = new System.Drawing.Size(419, 25); - //this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblTab_MouseDown); - this.ResumeLayout(false); - } - private StepRTB _MyStepRTB; - private System.Windows.Forms.PictureBox _MyPictureBox; - private System.Windows.Forms.Label lblTab; - private DevComponents.DotNetBar.SuperTooltip _MyToolTip; - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/LinkText.cs b/PROMS/Volian.Controls.Library/LinkText.cs deleted file mode 100644 index 51c50f7b..00000000 --- a/PROMS/Volian.Controls.Library/LinkText.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using VEPROMS.CSLA.Library; -namespace Volian.Controls.Library -{ - public partial class LinkText - { - public LinkText(string linkInfoText) - { - _LinkInfoText = linkInfoText; - } - public void ParseLink() - { - if (_MyParsedLinkType == ParsedLinkType.NotParsed) - { - if (_LinkInfoText == null) return; - // First parse the string - if (_LinkInfoText.Contains(@"\v")) - 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" - Match m = Regex.Match(_LinkInfoText, @"(.*)[#]Link:([A-Za-z]*):(.*)"); - _MyValue = m.Groups[1].Value; - _MyLink = "#Link:" + m.Groups[2].Value + ":" + m.Groups[3].Value; - switch (m.Groups[2].Value) - { - case "ReferencedObject": - _MyParsedLinkType = ParsedLinkType.ReferencedObject; - string[] subs = m.Groups[3].Value.Split(" ".ToCharArray()); - if (subs[0].IndexOf("CROUSGID")>-1) - _MyRoUsageInfo = null; - else if (subs[0].IndexOf("NewID") > -1) - _MyRoUsageInfo = null; - else - { - int roUsageid = Convert.ToInt32(subs[0]); - _MyRoUsageInfo = RoUsageInfo.Get(roUsageid); - } - break; - case "Transition": - case "TransitionRange": - _MyParsedLinkType = (ParsedLinkType)Enum.Parse(_MyParsedLinkType.GetType(), m.Groups[2].Value); - string[] subst = m.Groups[3].Value.Split(" ".ToCharArray()); - if (subst[1].IndexOf("CTID") > -1) - _MyTransitionInfo = null; - else if (subst[1].IndexOf("NewID") > -1) - _MyTransitionInfo = null; - else - { - int transitionID = Convert.ToInt32(m.Groups[3].Value.Split(" ".ToCharArray())[1]); - _MyTransitionInfo = TransitionInfo.Get(transitionID); - } - break; - } - } - } - private string _LinkInfoText; - public string LinkInfoText - { - get { return _LinkInfoText; } - } - private TransitionInfo _MyTransitionInfo = null; - public TransitionInfo MyTransitionInfo - { - get { ParseLink(); return _MyTransitionInfo; } - } - public ItemInfo MyTranToItemInfo - { - get { ParseLink(); return _MyTransitionInfo.MyItemToID; } - } - public ItemInfo MyTranRangeItemInfo - { - 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; - public RoUsageInfo 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; - //public ParsedLinkType MyParsedLinkType - //{ - // get { ParseLink(); return _MyParsedLinkType; } - //} - - } - #region enums - public enum ParsedLinkType : int - { - NotParsed = 0, - Transition = 1, - TransitionRange = 2, - ReferencedObject = 3 - } - #endregion -} diff --git a/PROMS/Volian.Controls.Library/ListBoxMulti.cs b/PROMS/Volian.Controls.Library/ListBoxMulti.cs deleted file mode 100644 index 74acaa54..00000000 --- a/PROMS/Volian.Controls.Library/ListBoxMulti.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Volian.Controls.Library -{ - //Class to handle bug in Windows WinForms ListBox - // that autoselects first item when no items are selected - public partial class ListBoxMulti : ListBox - { - public ListBoxMulti() - { - Visible = true; - SelectionMode = SelectionMode.MultiSimple; - - SelectedIndexChanged += lb_SelectedIndexChanged; - - Disposed += ListBoxMulti_Disposed; - } - - //singleselectedindex - // will help to fix bug in Winforms ListBox - // that autoselects first item when no items are selected - // -1 = multi or set to this after 1st initialization - // if this = 0 and only 1 item selected, - // that means item was autoselected, so clear all items. - public int singleselectedindex { get; set; } - private void lb_SelectedIndexChanged(object sender, EventArgs e) - { - ListBoxMulti tmp = (ListBoxMulti)sender; - - if (tmp.SelectedItems.Count == 1 && tmp.singleselectedindex == 0) - { - tmp.ClearSelected(); - } - else if (tmp.SelectedItems.Count == 1) - tmp.singleselectedindex = tmp.SelectedIndex; - else - tmp.singleselectedindex = -1; - - } - - //remove event when get rid of object - private void ListBoxMulti_Disposed(object sender, EventArgs e) - { - SelectedIndexChanged -= lb_SelectedIndexChanged; - } - } -} diff --git a/PROMS/Volian.Controls.Library/MostRecentItem.cs b/PROMS/Volian.Controls.Library/MostRecentItem.cs deleted file mode 100644 index 1380e6ef..00000000 --- a/PROMS/Volian.Controls.Library/MostRecentItem.cs +++ /dev/null @@ -1,236 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using VEPROMS.CSLA.Library; -using System.Windows.Forms; - -namespace Volian.Controls.Library -{ - public delegate void MostRecentItemEvent(); - - public class MostRecentItemList : List - { - public event ItemInfoEvent AfterRemove; - internal void OnAfterRemove(object sender) - { - if (AfterRemove != null) AfterRemove(sender); - } - private int _MaxItems = 10; - public int MaxItems - { - get { return _MaxItems; } - set { _MaxItems = value; } - } - public new MostRecentItem Add(MostRecentItem myMRI) - { - Refresh(); - MostRecentItem tmp = null; - // Look for the ItemID - foreach (MostRecentItem mri in this) - if (mri.ItemID == myMRI.ItemID) - tmp = mri; - // If it exists - remove it - if (tmp != null) - { - tmp.MyItemInfo.BeforeDelete -= new ItemInfoEvent(MyItemInfo_BeforeDelete); - Remove(tmp); - } - // Insert it in the first place in the list - Insert(0, myMRI); - // If more than MaxItems exist remove the items beyond MaxItems - if (MaxItems > 0) - while (Count > MaxItems) RemoveAt(MaxItems); - myMRI.MyItemInfo.BeforeDelete += new ItemInfoEvent(MyItemInfo_BeforeDelete); - return myMRI; - } - public void Refresh() - { - foreach (MostRecentItem mri in this) - mri.Refresh(); - } - - // delete the item from the most recently used list. This event gets handled - // when a delete item occurs. - void MyItemInfo_BeforeDelete(object sender) - { - ItemInfo ii = sender as ItemInfo; - if (ii != null) - { - MostRecentItem tmp = null; - // Look for the ItemID - foreach (MostRecentItem mri in this) - if (mri.ItemID == ii.ItemID) - tmp = mri; - // If it exists - remove it - if (tmp != null) - Remove(tmp); - OnAfterRemove(null); - } - } - public MostRecentItem Add(int itemID) - { - ItemInfo tmp = ItemInfo.Get(itemID); - if (tmp == null) - { - MessageBox.Show("This step no longer exists", "Invalid Most Recent Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return null; - } - return Add(new MostRecentItem(tmp)); - } - public MostRecentItem Add(ItemInfo myItem) - { - return Add(new MostRecentItem(myItem)); - } - public MostRecentItem Add(string s) - { - MostRecentItem mri = MostRecentItem.ParseString(s); - if(mri != null) - Add(mri); - return mri; - } - public MostRecentItem Add(IVEDrillDownReadOnly myDrillDown) - { - if (typeof(ItemInfo).IsAssignableFrom(myDrillDown.GetType())) - return Add(new MostRecentItem((ItemInfo)myDrillDown)); - return null; - } - public static MostRecentItemList GetMRILst(System.Collections.Specialized.StringCollection list) - { - return GetMRILst(list, 10); - } - - public static MostRecentItemList GetMRILst(System.Collections.Specialized.StringCollection list, int maxItems) - { - MostRecentItemList mril = new MostRecentItemList(); - mril.MaxItems = maxItems; - if (list != null) - 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]); - return mril; - } - public System.Collections.Specialized.StringCollection ToSettings() - { - if (Count == 0) return null; - Refresh(); - System.Collections.Specialized.StringCollection retval = new System.Collections.Specialized.StringCollection(); - foreach (MostRecentItem mri in this) - retval.Add(mri.ToString()); - return retval; - } - } // Class - public class MostRecentItem - { - [NonSerialized] - private ItemInfo _MyItemInfo; - public ItemInfo MyItemInfo - { - get - { - if (_MyItemInfo == null) - _MyItemInfo = ItemInfo.Get(_ItemID); - return _MyItemInfo; - } - set - { - _ItemID = value.ItemID; - _MyItemInfo = value; - _MenuTitle = GetMenuTitle(); - _ToolTip = GetToolTip(_MyItemInfo); - } - } - internal void Refresh() - { - MyItemInfo = MyItemInfo; - } - private int _ItemID; - public int ItemID - { - get { return _ItemID; } - set { _ItemID = value; } - } - private string _MenuTitle; - public string MenuTitle - { - get - { - if (_MenuTitle == null) - _MenuTitle = GetMenuTitle(); - return _MenuTitle; - } - set { _MenuTitle = value; } - } - private string GetMenuTitle() - { - return MyItemInfo.Path; - } - private string _ToolTip; - public string ToolTip - { - get - { - if (_ToolTip == null) - _ToolTip = GetToolTip(MyItemInfo); - return _ToolTip; - } - set { _ToolTip = value; } - } - private static string GetToolTip(ItemInfo item) - { - // reset active parent if null - // if (MyItemInfo.MyProcedure.ActiveParent == null) MyItemInfo.MyProcedure.ActiveParent = null; - DocVersionInfo tmp = (DocVersionInfo)(item.MyProcedure.ActiveParent); - StringBuilder sb = new StringBuilder(); - int indent = BuildPath(tmp.MyFolder, ref sb); - return sb.ToString(); - } - private static int BuildPath(FolderInfo folderInfo, ref StringBuilder sb) - { - if (folderInfo.MyParent == null) return 0; - int indent = BuildPath(folderInfo.MyParent, ref sb); - sb.Append(string.Format("{0}{1}\n", "".PadLeft(indent * 2), folderInfo.Name)); - return indent; - } - public override string ToString() - { - return string.Format("{0}~{1}~{2}", _ItemID, MenuTitle, ToolTip); - } - private static ItemInfo GetCorrectItemInfoType(int itemId) - { - using (ItemInfo itm = ItemInfo.Get(itemId)) - { - if (itm == null) return null; - if (itm.IsProcedure) return ProcedureInfo.Get(itemId); - if (itm.IsSection) return SectionInfo.Get(itemId); - if (itm.IsStep) return StepInfo.Get(itemId); - } - return ItemInfo.Get(itemId); - } - public static MostRecentItem ParseString(string str) - { - string[] parts = str.Split("~".ToCharArray()); - int itemID = int.Parse(parts[0]); - ItemInfo item = GetCorrectItemInfoType(itemID); - if (item == null) return null; - if (parts.Length > 1 && parts[1] != item.Path && !RetainBadMRIs()) - return null; // Path doesn't match - if (parts.Length > 2 && parts[2] != GetToolTip(item) && !RetainBadMRIs()) - return null;// Tooltip doesn't match - //Console.WriteLine("{0},'{1}'", parts[0], parts[1]); - return new MostRecentItem(item); - } - private static int _RetainBadMRIs = 0; - private static bool RetainBadMRIs() - { - if (_RetainBadMRIs == 0) - { - System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show("Do you want to retain old Recently Used Entries?", "Retain Recent Locations", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question); - _RetainBadMRIs = result == System.Windows.Forms.DialogResult.Yes ? 2 : 1; - } - return _RetainBadMRIs == 2; - } - public MostRecentItem(ItemInfo myItem) - { - MyItemInfo = myItem; - } - } -} diff --git a/PROMS/Volian.Controls.Library/PreviewMultiLineRO.Designer.cs b/PROMS/Volian.Controls.Library/PreviewMultiLineRO.Designer.cs deleted file mode 100644 index 0c36b366..00000000 --- a/PROMS/Volian.Controls.Library/PreviewMultiLineRO.Designer.cs +++ /dev/null @@ -1,82 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class PreviewMultiLineRO - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.btnCancel = new DevComponents.DotNetBar.ButtonX(); - this.rtbPreviewMlRO = new System.Windows.Forms.RichTextBox(); - this.SuspendLayout(); - // - // btnCancel - // - this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnCancel.Location = new System.Drawing.Point(391, 531); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(80, 33); - this.btnCancel.TabIndex = 1; - this.btnCancel.Text = "Close"; - this.btnCancel.ThemeAware = true; - // - // rtbPreviewMlRO - // - this.rtbPreviewMlRO.Font = new System.Drawing.Font("Courier New", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.rtbPreviewMlRO.Location = new System.Drawing.Point(12, 12); - this.rtbPreviewMlRO.Name = "rtbPreviewMlRO"; - this.rtbPreviewMlRO.ReadOnly = true; - this.rtbPreviewMlRO.Size = new System.Drawing.Size(804, 513); - this.rtbPreviewMlRO.TabIndex = 2; - this.rtbPreviewMlRO.Text = ""; - // - // PreviewMultiLineRO - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoScroll = true; - this.CancelButton = this.btnCancel; - this.ClientSize = new System.Drawing.Size(828, 576); - this.Controls.Add(this.rtbPreviewMlRO); - this.Controls.Add(this.btnCancel); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "PreviewMultiLineRO"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "PreviewMultiLineRO"; - this.ResumeLayout(false); - - } - - #endregion - - private DevComponents.DotNetBar.ButtonX btnCancel; - private System.Windows.Forms.RichTextBox rtbPreviewMlRO; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/PreviewMultiLineRO.cs b/PROMS/Volian.Controls.Library/PreviewMultiLineRO.cs deleted file mode 100644 index 02ae1c4d..00000000 --- a/PROMS/Volian.Controls.Library/PreviewMultiLineRO.cs +++ /dev/null @@ -1,20 +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 PreviewMultiLineRO : DevComponents.DotNetBar.Office2007Form //Form - { - public PreviewMultiLineRO(string thetext, string title) - { - InitializeComponent(); - this.rtbPreviewMlRO.Text = thetext; - this.Text = title; - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/PreviewMultiLineRO.resx b/PROMS/Volian.Controls.Library/PreviewMultiLineRO.resx deleted file mode 100644 index 19dc0dd8..00000000 --- a/PROMS/Volian.Controls.Library/PreviewMultiLineRO.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/PreviewROImage.Designer.cs b/PROMS/Volian.Controls.Library/PreviewROImage.Designer.cs deleted file mode 100644 index 45cb60e9..00000000 --- a/PROMS/Volian.Controls.Library/PreviewROImage.Designer.cs +++ /dev/null @@ -1,84 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class PreviewROImage - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.roImage = new System.Windows.Forms.PictureBox(); - this.btnClose = new DevComponents.DotNetBar.ButtonX(); - ((System.ComponentModel.ISupportInitialize)(this.roImage)).BeginInit(); - this.SuspendLayout(); - // - // roImage - // - this.roImage.Location = new System.Drawing.Point(12, 12); - this.roImage.Name = "roImage"; - this.roImage.Size = new System.Drawing.Size(747, 535); - this.roImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.roImage.TabIndex = 0; - this.roImage.TabStop = false; - // - // btnClose - // - this.btnClose.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnClose.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnClose.Location = new System.Drawing.Point(341, 553); - this.btnClose.Name = "btnClose"; - this.btnClose.Size = new System.Drawing.Size(75, 35); - this.btnClose.TabIndex = 1; - this.btnClose.Text = "Close"; - this.btnClose.ThemeAware = true; - // - // PreviewROImage - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.btnClose; - this.ClientSize = new System.Drawing.Size(776, 600); - this.Controls.Add(this.btnClose); - this.Controls.Add(this.roImage); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "PreviewROImage"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "PreviewROImage"; - this.TopMost = true; - ((System.ComponentModel.ISupportInitialize)(this.roImage)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.PictureBox roImage; - private DevComponents.DotNetBar.ButtonX btnClose; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/PreviewROImage.cs b/PROMS/Volian.Controls.Library/PreviewROImage.cs deleted file mode 100644 index a3d1f9fb..00000000 --- a/PROMS/Volian.Controls.Library/PreviewROImage.cs +++ /dev/null @@ -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; -using System.IO; - -namespace Volian.Controls.Library -{ - public partial class PreviewROImage : DevComponents.DotNetBar.Office2007Form //Form - { - public PreviewROImage(byte [] image, string title) - { - InitializeComponent(); - Image.GetThumbnailImageAbort myCallback = - new Image.GetThumbnailImageAbort(ThumbnailCallback); - - MemoryStream ms = new MemoryStream(image); - Bitmap bm = new Bitmap(ms); //Bitmap(filename); - SizeF sizef = new SizeF(bm.Width / bm.HorizontalResolution, - bm.Height / bm.VerticalResolution); - // 747 & 535 is the size of the image window (roImage). - float fscale = Math.Min(747 / sizef.Width, 535 / sizef.Height); - sizef.Width *= fscale; - sizef.Height *= fscale; - Image thmb = bm.GetThumbnailImage((int)sizef.Width, (int)sizef.Height, myCallback, IntPtr.Zero); - - this.roImage.Image = thmb; - this.Text = title; - } - public bool ThumbnailCallback() - { - return false; - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/PreviewROImage.resx b/PROMS/Volian.Controls.Library/PreviewROImage.resx deleted file mode 100644 index 19dc0dd8..00000000 --- a/PROMS/Volian.Controls.Library/PreviewROImage.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/Properties/AssemblyInfo.cs b/PROMS/Volian.Controls.Library/Properties/AssemblyInfo.cs deleted file mode 100644 index 6ba4d978..00000000 --- a/PROMS/Volian.Controls.Library/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Volian.Controls.Library")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Volian Enterprises, Inc.")] -[assembly: AssemblyProduct("Volian.Controls.Library")] -[assembly: AssemblyCopyright("Copyright © Volian Enterprises, Inc. 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("92d604d4-a2f9-49e6-af01-c77673f24954")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PROMS/Volian.Controls.Library/Properties/DataSources/VEPROMS.CSLA.Library.StepConfig.datasource b/PROMS/Volian.Controls.Library/Properties/DataSources/VEPROMS.CSLA.Library.StepConfig.datasource deleted file mode 100644 index c08d8032..00000000 --- a/PROMS/Volian.Controls.Library/Properties/DataSources/VEPROMS.CSLA.Library.StepConfig.datasource +++ /dev/null @@ -1,10 +0,0 @@ - - - - VEPROMS.CSLA.Library.StepConfig, VEPROMS.CSLA.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/Properties/Resources.Designer.cs b/PROMS/Volian.Controls.Library/Properties/Resources.Designer.cs deleted file mode 100644 index 97bc527d..00000000 --- a/PROMS/Volian.Controls.Library/Properties/Resources.Designer.cs +++ /dev/null @@ -1,1223 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Volian.Controls.Library.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Volian.Controls.Library.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignCenter_Image { - get { - object obj = ResourceManager.GetObject("AlignCenter_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignGridCellBottomCenter { - get { - object obj = ResourceManager.GetObject("AlignGridCellBottomCenter", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignGridCellBottomLeftJust { - get { - object obj = ResourceManager.GetObject("AlignGridCellBottomLeftJust", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignGridCellBottomRight { - get { - object obj = ResourceManager.GetObject("AlignGridCellBottomRight", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignGridCellCenterCenter { - get { - object obj = ResourceManager.GetObject("AlignGridCellCenterCenter", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignGridCellCenterLeftJust { - get { - object obj = ResourceManager.GetObject("AlignGridCellCenterLeftJust", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignGridCellCenterRight { - get { - object obj = ResourceManager.GetObject("AlignGridCellCenterRight", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignGridCellTopCenter { - get { - object obj = ResourceManager.GetObject("AlignGridCellTopCenter", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignGridCellTopLeftJust { - get { - object obj = ResourceManager.GetObject("AlignGridCellTopLeftJust", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignGridCellTopRight { - get { - object obj = ResourceManager.GetObject("AlignGridCellTopRight", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignJustify_Image { - get { - object obj = ResourceManager.GetObject("AlignJustify_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignLeft_Image { - get { - object obj = ResourceManager.GetObject("AlignLeft_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignRight_Image { - get { - object obj = ResourceManager.GetObject("AlignRight_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlignToGridHS { - get { - object obj = ResourceManager.GetObject("AlignToGridHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Bookmark { - get { - object obj = ResourceManager.GetObject("Bookmark", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Borders_Image { - get { - object obj = ResourceManager.GetObject("Borders_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Bullets_Image { - get { - object obj = ResourceManager.GetObject("Bullets_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap CenterAcrossHS { - get { - object obj = ResourceManager.GetObject("CenterAcrossHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ChangeStep_Image { - get { - object obj = ResourceManager.GetObject("ChangeStep_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Check_Image { - get { - object obj = ResourceManager.GetObject("Check_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap CheckSpellingHS_Image { - get { - object obj = ResourceManager.GetObject("CheckSpellingHS_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ChkRef { - get { - object obj = ResourceManager.GetObject("ChkRef", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ColorHS { - get { - object obj = ResourceManager.GetObject("ColorHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap CommentHS { - get { - object obj = ResourceManager.GetObject("CommentHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Copy_Image { - get { - object obj = ResourceManager.GetObject("Copy_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap CopyStep_Image { - get { - object obj = ResourceManager.GetObject("CopyStep_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Cut_Image { - get { - object obj = ResourceManager.GetObject("Cut_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap DecreaseFontSize_16x { - get { - object obj = ResourceManager.GetObject("DecreaseFontSize_16x", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap DeleteHS { - get { - object obj = ResourceManager.GetObject("DeleteHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Erase { - get { - object obj = ResourceManager.GetObject("Erase", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Exit_Image { - get { - object obj = ResourceManager.GetObject("Exit_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap File_Image { - get { - object obj = ResourceManager.GetObject("File_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap FileSaveAs_Image { - get { - object obj = ResourceManager.GetObject("FileSaveAs_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Find_Image { - get { - object obj = ResourceManager.GetObject("Find_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Folder_Image { - get { - object obj = ResourceManager.GetObject("Folder_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap FontBold_Image { - get { - object obj = ResourceManager.GetObject("FontBold_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap FontItalic_Image { - get { - object obj = ResourceManager.GetObject("FontItalic_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap FontStrike_Image { - get { - object obj = ResourceManager.GetObject("FontStrike_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap FontStyle_Image { - get { - object obj = ResourceManager.GetObject("FontStyle_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap FontUnderline_Image { - get { - object obj = ResourceManager.GetObject("FontUnderline_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap FormulaEvaluatorHS { - get { - object obj = ResourceManager.GetObject("FormulaEvaluatorHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap glasses { - get { - object obj = ResourceManager.GetObject("glasses", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Goto_Image { - get { - object obj = ResourceManager.GetObject("Goto_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap GoToParentFolderHS { - get { - object obj = ResourceManager.GetObject("GoToParentFolderHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap HardSpace_Image { - get { - object obj = ResourceManager.GetObject("HardSpace_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap HighlightHS { - get { - object obj = ResourceManager.GetObject("HighlightHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap IncreaseFontSize_16x { - get { - object obj = ResourceManager.GetObject("IncreaseFontSize_16x", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Indent_Image { - get { - object obj = ResourceManager.GetObject("Indent_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap InsertAfter_Image { - get { - object obj = ResourceManager.GetObject("InsertAfter_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap InsertBefore_Image { - get { - object obj = ResourceManager.GetObject("InsertBefore_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap InsertRO_Image { - get { - object obj = ResourceManager.GetObject("InsertRO_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Key_Image { - get { - object obj = ResourceManager.GetObject("Key_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap LayoutDraft_Image { - get { - object obj = ResourceManager.GetObject("LayoutDraft_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap LayoutOutline_Image { - get { - object obj = ResourceManager.GetObject("LayoutOutline_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap LayoutPage_Image { - get { - object obj = ResourceManager.GetObject("LayoutPage_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap LayoutPrint_Image { - get { - object obj = ResourceManager.GetObject("LayoutPrint_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap LayoutReading_Image { - get { - object obj = ResourceManager.GetObject("LayoutReading_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap LayoutWeb_Image { - get { - object obj = ResourceManager.GetObject("LayoutWeb_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap libdoc { - get { - object obj = ResourceManager.GetObject("libdoc", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Lock_Image { - get { - object obj = ResourceManager.GetObject("Lock_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Margins_Image { - get { - object obj = ResourceManager.GetObject("Margins_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap MultiplePagesHS { - get { - object obj = ResourceManager.GetObject("MultiplePagesHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap New_Image { - get { - object obj = ResourceManager.GetObject("New_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Options_Image { - get { - object obj = ResourceManager.GetObject("Options_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Orientation_Image { - get { - object obj = ResourceManager.GetObject("Orientation_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Outdent_Image { - get { - object obj = ResourceManager.GetObject("Outdent_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Page_Image { - get { - object obj = ResourceManager.GetObject("Page_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap PageBreak_Image { - get { - object obj = ResourceManager.GetObject("PageBreak_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Paste_Image { - get { - object obj = ResourceManager.GetObject("Paste_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap PasteSmall_Image { - get { - object obj = ResourceManager.GetObject("PasteSmall_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap PauseHS { - get { - object obj = ResourceManager.GetObject("PauseHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap pdf_32x32 { - get { - object obj = ResourceManager.GetObject("pdf_32x32", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Preview_Image { - get { - object obj = ResourceManager.GetObject("Preview_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Print1_Image { - get { - object obj = ResourceManager.GetObject("Print1_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Redo_Image { - get { - object obj = ResourceManager.GetObject("Redo_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Replace_Image { - get { - object obj = ResourceManager.GetObject("Replace_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Review_Image { - get { - object obj = ResourceManager.GetObject("Review_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ROEditor { - get { - object obj = ResourceManager.GetObject("ROEditor", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Save_Image { - get { - object obj = ResourceManager.GetObject("Save_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SaveSmall_Image { - get { - object obj = ResourceManager.GetObject("SaveSmall_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SearchWebHS { - get { - object obj = ResourceManager.GetObject("SearchWebHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Sequential_Image { - get { - object obj = ResourceManager.GetObject("Sequential_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ShowGridlines2HS { - get { - object obj = ResourceManager.GetObject("ShowGridlines2HS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap StepBullet_Image { - get { - object obj = ResourceManager.GetObject("StepBullet_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap StepCaution_Image { - get { - object obj = ResourceManager.GetObject("StepCaution_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap StepFigure_Image { - get { - object obj = ResourceManager.GetObject("StepFigure_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap StepHigh_Image { - get { - object obj = ResourceManager.GetObject("StepHigh_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap StepNote_Image { - get { - object obj = ResourceManager.GetObject("StepNote_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap StepParts_Image { - get { - object obj = ResourceManager.GetObject("StepParts_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap StepRNO_Image { - get { - object obj = ResourceManager.GetObject("StepRNO_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap StepTable_Image { - get { - object obj = ResourceManager.GetObject("StepTable_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap StepWarning_Image { - get { - object obj = ResourceManager.GetObject("StepWarning_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SubScript { - get { - object obj = ResourceManager.GetObject("SubScript", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SumChg_Image { - get { - object obj = ResourceManager.GetObject("SumChg_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SuperScript { - get { - object obj = ResourceManager.GetObject("SuperScript", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SupInfo { - get { - object obj = ResourceManager.GetObject("SupInfo", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Symbol_Image { - get { - object obj = ResourceManager.GetObject("Symbol_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap TableBorderInside { - get { - object obj = ResourceManager.GetObject("TableBorderInside", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap TableBorderNone { - get { - object obj = ResourceManager.GetObject("TableBorderNone", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap TableBorderOutline { - get { - object obj = ResourceManager.GetObject("TableBorderOutline", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap TextColor_Image { - get { - object obj = ResourceManager.GetObject("TextColor_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ThumbnailViewHS { - get { - object obj = ResourceManager.GetObject("ThumbnailViewHS", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Transition_Image { - get { - object obj = ResourceManager.GetObject("Transition_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Undo_Image { - get { - object obj = ResourceManager.GetObject("Undo_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap UpdRoVal { - get { - object obj = ResourceManager.GetObject("UpdRoVal", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Users_Image { - get { - object obj = ResourceManager.GetObject("Users_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap WindowsHS_Image { - get { - object obj = ResourceManager.GetObject("WindowsHS_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap zbuttonItem25_Image { - get { - object obj = ResourceManager.GetObject("zbuttonItem25_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap zbuttonItem47_Image { - get { - object obj = ResourceManager.GetObject("zbuttonItem47_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap zbuttonItem48_Image { - get { - object obj = ResourceManager.GetObject("zbuttonItem48_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap zbuttonItem54_Image { - get { - object obj = ResourceManager.GetObject("zbuttonItem54_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap zbuttonItem56_Image { - get { - object obj = ResourceManager.GetObject("zbuttonItem56_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap zbuttonItem57_Image { - get { - object obj = ResourceManager.GetObject("zbuttonItem57_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap zbuttonItem58_Image { - get { - object obj = ResourceManager.GetObject("zbuttonItem58_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap zbuttonItem59_Image { - get { - object obj = ResourceManager.GetObject("zbuttonItem59_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap zbuttonItem8_Image { - get { - object obj = ResourceManager.GetObject("zbuttonItem8_Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/PROMS/Volian.Controls.Library/Properties/Resources.resx b/PROMS/Volian.Controls.Library/Properties/Resources.resx deleted file mode 100644 index 9a5467df..00000000 --- a/PROMS/Volian.Controls.Library/Properties/Resources.resx +++ /dev/null @@ -1,2078 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsOAAALDgFAvuFBAAABbElE - QVQ4T6WSTStEcRTG5/NIE6IZkSZNmoUFmsXNjG4m83ojs5iFxSwkiaSEKCvJS2SKmiZJEpqkKFGk+CjH - fc51zv3fjZLF78zvLs45z/80ISL6F4GPqe0v98fz0uaHur3yrJ6cvVcHKsAckFt7V08vPqkPVe/UARc0 - Amfrkwru5vz6G02svtK4u3ls6ZGs+QfCZjQPzlxTonJJ8XKDB+kkUNrwY6NZPDnXVE9ULtSBCsBmcTP2 - cPVWPV4+VwdcELtgxEaztYDYTTf2DcceQOzpBvVN1qm3eErduRoP0kkgENttFjdjo1kcqAAcTBybxfuN - 2NH8iTrgYi+/eLH52n5sbMabY06deopnFMnWqCtzRO32IbWl9niQTgLmtfFmcTM2msWBChgxYpvXloOB - cNrbLHDxY1/xnwRvjv1cO+I2d2aOOXY4tU+to7vUYu0wOkAIXNvxY3fYB+rSKKgAM3Y061/bjP3rgL9D - oW/ngc/S9iFrhAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACX0lE - QVQ4T6WSa0hTYRjHD/TBvhRdqE99Koi+RFFB9SGjUAsvLYzEjMxFTKVkk6XpSC1N0eVtadqMvAw1b5Uo - KUUiJI7uGs7oIpEauZa1s3nP4tc5RwZNBgW98OPA+77/3/O8D0cA/gufmz3tOXTdzqS1KhVtTMh2X3c8 - CC21RXoJPFQVHMdpr2PSfoORwXySNUEUZeu5ZjRgyk6SCVwsYEZsZs7VxIyzHku5nqnxGpJjVbbXvSlc - OBtKinoH9p6TjHesRxt9SMotEsjhOVcDZTkn6LPmI34qYWzQwAfrKdoqVMRG+VOXto4XRQLxx0K8BU01 - BQsC8RbGtGgy9JEYEiI4Hx+OXqNCpw4lLiqAYu0GRRAZ7O8tqK80Mis2MuswMzWai+NVAraa1QoD1avo - K1/GU5OfEpYJ2L3VW2Ax5zDtqGJ6OIupN2eYfHkEsX05hdUd5JpbuXi1kRSjBV1mBbGpJqIT87wFlaWZ - TIyYmBzUMPEsFPejbXy5u0YJe9bc/E+crhmGx5xExF0iLMYgby8IKgrTEd9m4X4ShLt7M67OtYxUC0pl - eVXe6VEwN3QxMGRXwg96bRwIV8vHglCal8q3/nO4ujYh3luJo9mPoZuC0vaP+V98d0uVPzsZeG/H2v+R - 4CgdQVJ4/8HD+O/Zi1B8OQnH4zgpvIKvLUsZrV2CrUxAK71ZbtvTwXWpgxJLJ23dNuUrs2vLRoQrGYnK - D+KZsgeNNLA/Kz+0vlPCzff7aOh47iUILEw/Lf1hKtThgYTt26kcyNOW3+yp5gtFIA/CF0elacsX/obP - 8L+D8Bsb4cocWY3wtQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADsUlEQVRYR+3We0xTVwDHcf5QhkhbETCQ - ZZb5RxeXmGXzD+MyH9mUhwLVhTmNbDMTH0BiRXk4LL1ViEYeRklBEBmKZiNKmAgLEVfBEF/JkDVBowZB - g4boXIwMnC/y83d7L7aXNqQL12V/eJLPP4TT8+19nB6/t+N/MTIWGYwkZC5WyhJFSbLdRRuEbRKd/BHj - G1wcLUfM3tVIzoxSY00CA6rljxjfyGQAhq9geKgWwwOHfNJ90SIGtMofMb7By82Ai3j6u7/Prp/Q4ocY - QyctEOWIYl22j1giMS8xfCQv5zmcAS/b8ORygM96GjSoMM3FwcxEp8ospUOibJeiNfPACJO8pHJIAS0Y - vDDpX3nWGwv8U+AT+5GVMC81CPKSysGnHXjRiIH2yW9M8+5w5I4dUIdHbZrXTuVFwJash22dpHSUshHr - lQ6INriUy/asmgE+C728Da1OSw2/yMszIIoBz3/CX3ad09XjGhQm6dFeb0P3H6dxy53Ddz1jYADk5eWA - Z9X4syUYXbU6HN8VBGuinos3ALj9RvB2uAK4uzGgHPebp+JCpQ4/moNgWa7nN67lP3fx6hwGhtJU5Rnw - tAT9TaE4XxGMqhytHFDNgEvAYDJw309VyoBoMaAQ9xqmob0sBJXbdMhdHsmAMgb8Bjz+FrjLiSqyxLkF - cEvlu5qPvvpwnLOFciOZIgU4ihlwEni0EujlRBV5CbDgzokItO4PQ0VGMCzLxIB8BhwDHn4J3OREFXkG - PMlG78/hsBeH4kA6r4BRDNjOgHLgQRxwlRNVJHgEDKWjuyYMZwqmomyTVg7YwoAioD8K6OREFSkC+GvG - gFTcrArB6V1TYEvTIDeBb4EjhQFWoG8hXwZOVJEQPzpgcC2u8xVs3qlFycbJcsAaBmRw3/gUOMeJKvIS - 8A2ulerwqyUI+9cFIjd+OgO+ZsAGoHs20MKJKrJ6BPy9Al37NGjKCcS+7wNgdgYkMGA1cGMW0MiJKlIE - 8DTDACMcRYE4lT0Je797B+Y4MWAxA4x8aj8A6jhRRdYE94BYBgzEoHN3AE5u9Udx0kQGvMeAzxjwBeB4 - n9sBJ6poh0fA48/RkeePetNEFK6awJ9LMYD3HnOAjneBSk5UkUeAvepjHE0OQ8FXwTAt0iIrSo+64pmw - H/sQ9j3TYd8U4mIKwdkxtIo2e9cmUwTw9GokgScWIWV+pJD4SYSQuiBSGPmbiKcYFx6txOPVCG6rr3GD - kcRL+LBJEgwCF3Xn/YD6dvy3w8/vFQhxcUYUmNoOAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABL0lEQVQ4T7WPuUoDURhG8xxaCHY2Yh+w - ECREVCRxHBOymMlMZrKYZYxLOhVBCAiCNr5AxFJfwd5C0catEsUmhYiFxXFCCEq4TmJu5OMU93A58HuA - viKUMnw/ftn90zs7tVeuHt5cfjnrJtiK1c4/SVZv3KOdgj9j+6d1zMMX1O1bHp8/xNFOwUZsTD3Bq52x - WaszuXLBSOCYId9Rb8HWJsrXGHt3DI7vuvxy1m1wNHXJsO+AAe/W34KZUgWrUMHMb6Dn1tCyqySsMjHT - JqKXCGkF1KU887EcgUiWuXCamUWLadXErxhOoi0ovX8PWsXmucbyOsnGuekyccsmatiEk0UWEjZKPE8w - 2jg3w2yoee6UksIf1J1EW7BfCKUMQimDUMoglDIIpQxCKYNQ9g6eL18OKkyOPi51AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAAB+ElE - QVQ4T2P4//8/RRirIAxP3vItZvLmrzvm7f76aPnBr0dWHvw6ZdWhr1LIalA0IOO+DV93APGf7nVfnzeu - +PK4fsmXO3N3fn0MNOATsiFwDd2rXv1fduKrAZi97uuy/o3ffqdOevfGpeDEb+vU7X/ME7Z8d6+4+3Hm - 9q9vgAbcRDEAKMDZuOTl/3kHvl6tX/G1YcKmb3/iep7/cy04/t8uY/cv09g1x13ytz60jF/+J6zj3c+l - B77eRzEAhItnPv+fNevz/8I5X/5H9nx8YZW85a9F4oYfprEr80HyAbXbVQwjFr9wLb/9vmHplz0YBiT1 - Pfvv3fTmf3Tv5/9lc9781/CetNokZoUjTF7BoY7ZLuvQb9eyO68bVn45BBOHGxDU/PS/WfH9/55Nr8Au - Sex59L9u8VtLmDzQAFa7zEN/veqefWte+WULTBxugFPF4/8ORdf+W2Ue/28Sv+2/YdTa/xo+U4FSEHmz - uPVKtpkH/wW0vP5bMP1xKUwcbgA6BgUsMl/da5K7a9ntP2mT3//r3fCVDSYOV0AIW6TsuxjS8eFfWN35 - XGRxFEXYcFzfeyWH/Asx/i0f/vlVXvmmFTCbEVkeRTE27FH92Nm/5dMvj5KLP42jVnmhy6NwsOGo3s+R - ziXXGk1j1olik8cQIBVjFSQe/2cAAG4MzKZBtgOMAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAAK0lE - QVQoU2PABDwoACIAkQEBqAASgArCAXYVUBoMcKuAA1oJoAMOFMDBAQDBXQehic/cxgAAAABJRU5ErkJg - gg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACTUlE - QVQ4T2M49vgx54mLt6RycnJuX7r9VNPV1dXew8PjExBfSUpK2h4QEKDg7u4eZmlpeVFbW/uqnp7eXQ4O - DsX///8zgDBDaGgoc3h4uE9MTMwlEC0vL2/Eysq6DCQZFRXVBxSfp6qquo6BgSEcrIGBoRqIs+AGgIjg - sCiQjJCymhaINgbiTwICAufzi8r+a2ho+AL5U4FYF6YJhLvXfCqNbL5xFijOEA3ET4H4ChSXAfEqkCJR - UdFyIHsGEG8D4hiQGNCFvQ6BxadD6y9/1wueN5FB28AUZGs0SBIIgoH4LhC/BOLLQLwViNWBOBKITwLx - XW5+sR/O6Zv+mUavvKjq1qUGdxIh7F15lblg+tOt/tWXfxtHLDsI1KwBEseqGB0DNbNVzHt+P6ju6n+T - yOX7gJpVYXJwRTPP/Gdt2fBZAsaHYaBmzvI5z29Gt978bxK96gxQsyGyPJjoW/Wfc+a2b2lzd33+17D4 - zemkua95oZr5axa8eJE75cF/89h1n4CarZE1gzCYqFnwUrlz5ct/tYte/a1d9Pp35qTHz/1qrxtnTXp8 - pH7Rq39WSVv+GYXNj0PXDMJgIqHzvoVJ9NqPFglb/kU2X/1Xu/D1/+zJj3/nTnnyxz5r/3+z2NX7gbYz - omsGYTjDLH4zj0Xi1kN6wXP/excd/Ad0/n/H7EN/TaJW/NKInCmGrAkZYwjYJG9L1fCa8N8qedsf0+hV - v6zi19egq0HGWAWtkjZP0PCe+M84asUsbPLIGKsgCJtHr5XGJo6OsQoSj/8zAAD8NlCVtuizVgAAAABJ - RU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAfUlEQVQ4T+2UQQqAMAwEC/3/myMNTYjj - omA8ehjozi5SQRxm9ilSdpCyg5QdpOwgZYcx56zYhp7Ejrx+4IJbz3WQcsOOcOeZgyz2+Y7YVU6vfCkf - 4M5zDXHOEo5w47mGOGcJR7jxXIsoaw5HuAkun00bKYG6yUJt/79NGxsH7EeiiVdcqusAAAAASUVORK5C - YII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAr0lEQVQ4T2MYBbiBoHEHv4R5w38wtmyW - hwoTD8TMG/JhBoibN/RDhYkHQE3ngXg91ID3UGHigKhZkz7M6SCDwGzThnioNGEgYdYwH2QrkK4H4v1g - A4A0VJowAGkG2wzSDMRgw6AugirBDWCBB+WCAdCQ+SAxoEH4AxOosB5sE5KTUcRA2KLRHqwYGwA5EaQA - hEEBiS4GwqD0AVYMAz85efb/5ub5Tw4G6R1oA3j2AwAiLa9uLJQnlQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAABu0lE - QVQ4T52R2S9DQRTG+6d4ImKLNR5IELG/4IEHEgn/jb6IiAe1pLZY0saeltoJtTTllttGW9RapJZK0eUz - c5rbNHrviy/58p3MnPObzIwKAHl2U8Rf61YFTBgsGJnb5+6UeuMdK/iAkjRT6yio6ZCFxAr9mo2FvHpG - DDDuCBJEzZYSAVPLVhbyGphepWHJTImA8cVDRFgRr0gkQmuhUBj9kyZ0a5eQX93OtxIBY/NmhMNhnJw7 - KR0uD4Js0HrmROD7B5azS+gMe8oAtWYWrus7tqKC4LikFJ0eygOrnXJYt6IM+K9jxZzpkE5xex4pHe5b - SpvjinLLLFDmlTWydhnA6MwWBJHdnz2c99lHDyiILvgD3zg4ceHm4R3qPj1S8qtYuwxAw145GAqxMir+ - gK8fX7j1fkB0v+D4/AFdQwvIKm3m24mA3lEji6j46Z+BHzy+fOLC44PV7sW25Ya+Mb1Y4Qp8UxL/9zf/ - F+6f/ATYP72DyXxFgNTCOt6iDNg9smNx/Rha/QYGp9fQO2akQcnJeZW8TR7A/zi3og055a3ILm9BZkkT - Ob2oAWlF9ez0WiRlFLN2GcD/DNUvFQAPI9EcSZQAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsOAAALDgFAvuFBAAABmUlE - QVQ4T7WSSyiEURiG/w32UpRiIYUm18Qgl5QsWJAkInaSSLk00zBTFv5RioUoC6SEkJCIwkLjNoqFzMal - KbdcakJIvc75dP7O0WwsLJ6+3nO+9z1/3/drAAyaRi5YgZZSNgROdEEvaUFt34miOYoQAZzfZs6fAvxR - pR+xop6RSWC167A5nISF0dGpo7HdifikVFTpbpR376HUvoNi6zZBAXKazaHj6eULD74v3D5/4ur+A0ub - p0hNz6Hmkq4dqjI0MCH4y9x8/fiJi7t3nHlfMTp/gFhTMvUUWbaMXgEFiIHxz755YubbH/Px+QuGp3YR - HhFF9wWt61RllGm3dzpxyV72eN/IfOjxYWDCheCQMOrJa14xegWK4AObXTvGyNw+BtnL/czcN+ZCQGAQ - u4aW1bBIVUYRaeZsZOYWIiHZjMioGISEhpNZozb2g9XNUJVRBF+TrH+TWDPJinqmVfa4weFmvqYi6xYK - 2zaQ37KKnMZlZNQvIKV2GgnVkzBVTiCuYtyAAuQ0f2uSESYZRfhbk8z/B/wdaN/UwtLmFVaBLwAAAABJ - RU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAFn0lEQVRYR+2XW0xURxjH57Xpiw9tmrTp - QxWDBLVIwAuIIBUKWqTcFFhgQe6XFQUqXoLTRDSwUBGiWG29ALo10mqMAomXHAoEggoIVCxUwaUIiAgI - yh3+nW9dUHPSdtny2C/5ZfdMzvef386ZbOaw/+tfy0vizKccbGsVmN9dMP96sID7YEHNYMpHYCFasG0d - YKFdYOE9YBHPwSIHwKIGJX3CfyyfCr5L046+YWBgFBgaA16NA8OCkQlg9C3omsZL7k8KgZfzJLC1midp - nuDZK6Bv5LXEoJB4qReZkZn5ToLFJBA9PE8CfjU8UdOF7pfQSTwXK9EvRF6QiF6GJqVPuqbxq79NgcWM - zpOAooHv1DzFk0GgewjoERK9ehFaEZKZga5p/EqjEIgdnyeBwCa+Q/MM7QNAh5DoEhK0Gj36FSFIaOY7 - jV+qJ4GJeRIIauHbNc/R2gc8FhJ/vngt0qmXeZtOQowX3psGi5ucm8DChQuVAmkGExMTafHixdKCL7Pa - YjX9aO4FHgqJ1v7XIlpBu5AhoRnomsYv1E3j/W1N/TY2NpKtra20du1aad26dZK9vb3k4OAgrV+/Xqmf - 9k2JSXlSUhKqqqp0VFZWIijoR6x0PI+vFKWIjKvQEUWoKhD9DyjCy2HtWgIHhxyEhuahpqYGtbW1qKur - Q1paGhwdHbl+2jdFAkeOHAHV1NQURkZGkLyrGunpjaiq7DUK6qUMyqJMqry8PGzYsEEusGjRIp6dna27 - aWJiAgMDA+ApdTj1gxbaNrG0RkC9lEFZlElFAk5OTnIB8cx5Tk6O7qaxsTF0dz/FodQmnMjtQs1tGAX1 - UgZlUSZVfn4+nJ2d5QJiw80K0JJpte34LuMh1Ic6cb0YRkG9lEFZlElVUFAAFxcXuYCpqSnPysrS3UhL - 1tLyEJnqJqTseSKCepGbMzQnqId6szJbdFmUSdlnz56Fq6urXGDJkiU8PV2Nnp5n6OjoRENjE3KPlYLv - 00J9cMAoqJcyKIsyKfvkyZPYuHGjXMDMzIynpqaitbUNzc1/4M6dOpRX3IVKdRmx0WVI3FEzJ6iHeinD - Sm2KNXkMubcycfToMWzatEkuYG5uzvfv56ivb0RN7T1UVFTruHmrEhkZ1xAfXzgnqId6KcMmnyFzkCH0 - ihUOH86Cm5ubXGDp0qV89+69oqEKZWWVorls3kjKj4PyFwv8dCNP/DeosXnzZrnAsmXLeEJCEkpKbqBY - UFR8U0da+mEoApRzZmfCrtkMgjIp+8CBg3B3d5cLLF++nKtU8SgsvCy4gkuXinRsDQgHe+/DOWNuaTeb - QVAmZaekcHh4eMgFLCwseGRkDE6fLsCZM+dx7tzPOjwD4mHingJXdbXBrIwrgNmar2czCMqk7OTkvfD0 - 9JQLrFixgoeEhCE7+/g7uPglwGGnBt/+CoMJPtEAE7tgWRaRkPANvLy85AKWlpZcoQhCaqr6HRz99sGd - F+HMPRhM8oUWfPZFoiyLiIuLh7e3t1zAysqKOzu7wNdXAT+/APj7ByI6ejts/Q4gMLMc1x+Jv1cDybym - xaeuB5GYuAfh4VGIiIgGPV4iKCgYPj4+cgFra2t7AV+1ahVfvXo1p8OEl9cWWPtmIOp4Peq7YTCnSrvx - sfv3CAuLoQ3XRs+clp1+OU0usNdP+/clTjLczc0Dn/seRUL+Y90xzFAKb/fjI5+LUChCaMMZdza0s7Pj - Tk6uMN1yArsL+3THbUMpahjGBwG3xGbzpQ1nnIA4wynpDPeJ78W2lKuTGBcHGkO5+WAMC0Lu9NPkYtmz - 9JFGlgpcWTANqUXQTEwJJgUTkH4fF4xBejAqGIbU9ArS/SFkFXWCeZfO07FcBSVTTUssbkpiseKoHTMm - 6V676OUzok9iYU8l8XIqseBHEgt8IDH/Okm8yEpCwIBfzthfThDYnm6QPx0AAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAiklEQVQ4T6WQ0Q2AIAxE2cCRGMVRHMFR - HMFRGIERsAUuJFxNqF7yPny5ltRQSvmFKT2Y0oMpPbAQ9cIlbNQnEULsA8rRyf37oj6JFixATuHTgrtT - h4WlEzRYgBOSoGfs1CfRggUI/kumPokWLNBBBWck6pMYwzN6QqQ+ifHqTA31Z+HFlB5MuU4JD0dnUwrg - CrV/AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACh0lE - QVQ4T4WSyU9TURjF+5+4YOPKYOLGlYmucAEoMSExxoVAwCKCIhEEFYMEtSBCJDRImawgDaARlASVSUFG - FXBoAZmnFspUW9rX937e9jUxkZe4OLn5bu7vnJMvVwf8V7aWg8NbQ8ffY8+yTTaHKaymTv2eONki7hs0 - gX/ls0aZZ9sPw7aBhZ5YcRYz8/oQrrGIF5rAPolkdstA6md3qUmcvQTmDWu2xmMNWRsPKHOdMbhWW5DZ - wu1oJTAvdhzRBvbJnnWD7VILe50WYWIRTSxiRnbkazzWkGSLjp55E26R13IsTtMx6IhTdzB9GV1VwwSV - z8apePoFY80oj01DlBgHeFjWx4NHPRQUdmIuz6W7JQflaz6bjZGsN8WyO5XM8sBZdKb6cRRFQZIVvJKM - e09mxy3jdPmxb0ksOSVm7T6oMsLNLDgfBafDMJw6Ksqh01Wax5AFnFa+iL5kgbjCec4VzOLYkVjZ9DO/ - rg2nXn2uGjwR1SW/wpm8GaJuTRORNcmJDBtrgfQNSYVzMgUcCTEqPGDzcCm1XjUw1n7GJyl4fDIuj8ym - qO7Y8bMsqmslD0156LN60KeYVYPy6hH2BHy3boS8miHuVA9w29QP68MhWCSH4CtFbaQaXvHhp4ckfZ1q - UGYaxu0Vi/P4g+n27VB6wCAg0SIAj87sMTjp4aOAe767SUyqVQ1KKwZxic0HG9SKBlVqg+Fw8QVCcEZp - B+nF7aEGrXR9cxOfWKMalBg/BdOdu/7g4padPmYdPiZXvPxY9DI252X019/0bpH+btxNXEKVahD4MIaS - Xu4VdZF3/y25+e3k5LaRmf2Sa9ebSUu3kCI2rk82k3ixlviEai7EmYICdH8AxXsU+dXRvF8AAAAASUVO - RK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAFS0lEQVRYR82Xa1BUZRyH/e40Nn3JZvrU - B2uqsRl1pj4UZlNeGkrMRCGQwGsMCIouFwERVOTOhhIXcUlldSsvXAJRV1ZRNJ1p1DYxtU0r0EQF8b6V - T//3HFbdPRilO9Y785s9Z/ec93nOez076H9QCoZIuiU85gjzngBle3is0SXulgKeNEFALozOkwsc0HIC - dkt2HYed30OzE7Z/B43HoEmijtV3O+S3nXKNvV2/Xt3n+AH2nITWU7DvNOyV47X7YJoFQiWKZRB4YhGM - jHEwKtbBbqm094aenmtw+SpcvAIXeuD8Zei8BOck57v179Rvl3qhW667Iter+67dhOu34OZt+ZTjNpGZ - kObg3XSHxjIIPJUEL8XZtSiBq32V+ENCfSqBUSa7FsUyCDy9GN4pcjO22E2LCKibbvTd/KgS6mGUQGSN - mxlWt8YyCDy7BALN8F6J9K/08VW58ZbbPxI912VcyNiI2wzxW9BYBoHnMnX4xFXw5WH9Jvfv/pHokvP6 - ozp8wVY0lkHg+eU6PGi1PmIvys1//OkfiU753XpIhydsQ2MZBF7O0eEflIJ5l1QkFdy54x+JM11Q3qrD - F9WisQwCI/J1+OTPYNnX8KtUooo/JE6dh/ydOtxUh8YyCLxapMOnlEGS9NWZi7qAKo8qcbwDMuShFDyx - AY1lEHhdBqCCB5dD9EaxvtBH7yuPInH0Z+l/mQEKniwiimUQGCPNr+BTKyC8GtrP9ZHvKw8rcfgnmGXV - 4SmNaCyDwLg+eMgamCTHx6TZ+isPI9Em+0GI7AEKntqExjIIBApYwUOr4O1P4VtptgeVfyuhNqNA6V4F - T9sux8IxCEySZlfwsLUySGRHrD4IB6XpHpQDkjYX7P9RdjxJq9r1ZLlVu6BD0iI7otod7ZJKWVdGyyqr - 4EuapYWFZRAIXq/Dw6WpXlwGQ2W99mdGyFav4Bk7ZKwJyyAQJoNEwSPE7uPPIWodzNggg6cGZstvc2Rm - fLJJZogNYr6A2K/ure2eFc4zzz2j3dPnnidX8ExZDxTLIBAplfYHj6r4jamJNqapJNkIkYQm6/koxUbY - YhvhKqk2pkuCUxt5I9lFgGR0iouJuZ1e8Cy77IrCMgjMlqfp78kjipyEhc2lqqpmwGRnF/PauHgGj21l - 8Dg9L8w85gVfvlvqFZZBIEaasL9mjzIfJzo6GYfjyIBZv76eN99PZOiHh7Q8M+UQI+e1e8FXtEgXCssg - MF/6rb8+n7nqBLGx6TQ3H6a2dh82m53Nm/do576xWGoZP3UJwyKPMCxKT0DyaS/4SnnfVCxfge4JC5zE - i5nvgJtTepL585fR1PSNPGETRUVWysu3aOe+sVjqCIrI1p56VJwkvp3xWWe94DnyRmySgekr8IqSCFzo - ZGG992iPLj+NyZRLQ8MBKiu3sHRpKYWF67Rz31gs9YTMLWZMqosxaS7eSncxubDTC567FxbLmPARUEWX - CDI5SZLp45lqsZUuUlKKqatro6TESkLCCrKySrVz31gsDUTGl8nI72BiXgdB+R1ElHd5wfPlvSBDWqQf - AVV0iclJTtJk6mjzfO1Z0tNXS7/vJSdnDbNmJZKYmKOd+6aqqp7o5GrCy7qYLuCIii6iN/R4wQv2S3cY - /5jcX3SJ4BQnmfJmtKD6F2n2Cun/ZszmGpExy3Sr1M59U1a2lYTMTcRYe4nd2Mu8Tb2Ytl73ghe1QZ4s - zX8joIouEZrqJK+hg4yMSgoKrANm5cp1pOdvY7n99t1kt7gpPoAhAwiooksMGVJIQEDJP87w4WapON8n - CmaI58/pf1kGDfoL9ceeHYLsepYAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAAJ0lE - QVQoU2PABDwoACQAEYcAsAAKgArCAX4VcAEUQDcBdMCBAjg4AKnhB4mvwOZ1AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAIEElEQVRYR82Xe1BU5x2GT9KoJYkhEcG7 - eCuYmzasERMlJ5Dp1EZncs80TmMn2hxrgNYQQBHdVTTYRK2IGkWQ5So3gQo4oohMbONdAQNyvCIxawwa - URRFhX37ft/uyqrHTPpfz8w7XM7ZfZ7v/jvK/901T1FUkfkPKar5YUW1iPxKURc8oqgLmbhuirqou6Iu - 7uHI579W1HgPRV3yqKL+4zFF/YL58nGmp6IufUJRlzHLPRX1n08q6grGibn/InQ005KiqtjwqiOpwSqs - IiEq0pjQQb2RFT4WZ3aa706VGU1M1icvYob340gIGInkIBNyX1eRx+RPcqRgsoqEXkrLSi9ltBPbdRHe - eMiaAuD2AzNSexPLN/0Rx+3HDWNe/TaUMQHIzEzDwYN7Db+jfmMKEr2URie266IAYL9qmNZrzYhYs1IK - fJn9BjKvZBomdvlEKRDw3rsoLM5Fy6Xv7/sukVW9FTixXZcU6LwIXDgMWAYB4fybaQ3rjsnaB3glbBqW - bZiMyu0TEdEUYZgtRb/DnMVB8Awag96BzyN7igdssR7A8seA1KeByzWSscrbQICTjjdpvCVCgqvDR8MS - boE2MwwmTUNOeQgm1QQjuCbkZyOeSS0aB8VkQgDnzfQ/TUV1/AvA6ieA/TGSsdpIgDMe6DgFJARKAQFf - UQXEpJXgD7M+xMJtz2NAmekXRTwrBIKmfoLpn5cgInwm2hI9gdLXJGONj4EAlxpv1lPgxTsCVceBpJIS - 2QOL8oaiR5rpF0U8KwTeCg3F4qQyaNrHsC2lwBYhUI+v+hgILBACtzn+Caa7BA7ouhT4zByM+ak+CEz2 - +9mIZ96ZOkwKxMQvoUAptBkUWPEkwGEUjLV9DQS4yfDmbgpwvO4I2GG3c05arQjQ/gLTzEmYHPU0QqJ8 - 8FJkNwSGeiBwWi8ETumPwPd8EfjWcLkKBHzclA9hTc/EqtxdnEd/hS3xKWB7sGQYC3SjwC0OesLo+wQ6 - mX/X1uLPcdGYEPU2TFEqnokcBf/QF+D/0Xj4T3kNfu9OhN+bkxEybTo+XbQEa1IyUb59B5KK9kOLiIFt - jRdQ+apkrOtnIBDXXQiUU2CUQyDMfEegQ6QTON3YhJLSMuRtKkRuQSFyRPILkZ1XiKzcQmQy6Tn8X1EZ - Nm/7Gnv2HcSmb85Bi5wH27reQJUqGUn9DQS4vwM3/0WB5+4TuE24yK0O4Or1dpxs/A5H6nXUMjV1Og5/ - q+PQER0HmH21OvbU8P8nbGhta0eV3g4tKha2ZG9g1yuSsX6AgQAPFt7Mo8AzdwmI7hfgm860c0e9wVy/ - BbQxV28CV9q5x9wALl0HLrYBP14DznHTE89WNVAgei5sVh/gmyDJSDYS4KnGT6QDK0Y6BeZjp1Og3Q3s - Dr9GeKuAM5cocJECzRQ4T7it1fHszoYb0GZTIKMPsGeCZKQMNBDgkcpPrKeAn3MSminQKcdfQu8Bi5a7 - 4C2E/0T4BQF3tv77K24CczgJs/tyJxwvGRsGPVAgkUMwApj1ECx/p8CxTjn2AirBbnDZ7ffARdf/IOBs - /XcUEMI7j16HFkOB3H7AwZclI3WwgQALCn5iKZA4HIh8GJZZZlRSQE48V4udrRZwARbdfi9cdP1Zws9c - dkhXHm2DNncObJsGANUUIMNQgNUMby7ioTEMmP0ILBFm7NA75cQTQPcWu1otxtwI3kT46RaH9I56CsTO - hq14IFD7kmRYfQ0EWEpReR6wlgKx3WCJNKOioUOOowsqZrk7WE64B8BPXnJIV9RdgzaPAiU84uvGSUba - EAMB1nG8GcnTZyhg7g5LlBnbjnbIcXdBxRJzgV2tlhPOAH78J4f0tm8pMD8ati2DgQaetGSkDzUQWNqT - AtfCgZQhQFwPWGabsbW+Q7aimTARAXW1WIBdrRYTToy5O7zhgkN665Gr0MxRsJX7AsfGSkaGkQCrV978 - mJULH4z3gGWOGdGlt5FQacfCQjtisuxYWWaXUHewaHUjwacIPkHwMRZVAl7f7JAtrWmFZomEbQd79iSP - ejIyhhkJeFLg6lQgnV31xaOsYsbCN9qGkLV2PDvXDu+P7FD5U4IJdYFdrXbBjxJeR/iRHx1DU3yYAgs+ - g62Kc+v0GMnIHG4gwNqdN98HsjhZRA2X0BPVS8dR4iwlOqXE6/F2nCFQggl1Bze4wWvPc8X9wF7hc/kH - rlAgArZdXN5NQuB9ZI0wEOCLAxf5G8BGLhfCZQ231hPVK1+Gb9QZKfHBejtOOMdY5JgTrrsJ1Lt6gBH3 - s/ZehraQAru5wZ1lsUNGtpHAiqeEwO+BPG4YTjiSWURYe6H6q/HwjTyFGYWdqGHX/i9J+U8LtLhPYdvH - Lf5cgGRs/I2BAN9YuHBZMBT0vwuODBYSG71RnTIBY/9WDFNYIVPA5DO5TA6TzWQyGUwakwpTaAqznlmH - ZWvege0gBc6z2iIjx09Brr/i6UQ7rpVC4DI3iiIK3ANHHo/Swj5oy+8LPckHekof6Fb+ntEPenZ/6LkD - oBcMhF40GPpmX+hlQ6BvHQq9Yhj0yuHQvx6BFp3vBRd+Kxk5/gYCfF0qrtC80J5JmAEcm3mYlFGunENU - wXlSxdWyi0t2N/eN/ZzhhzjJajnOdWyp7s8ZymO9kbXF2WfZ9SxymkfhZtNz2BvhJeDFTmzXxdclT8Yq - XhpE3S5KZ1E8iogaTpRRopIRxYQ4z8WRKg4VEbG3i+1V7HBikxHrXCw1MdvFhBNjLrqdLW8h3NrVekX5 - L/EgqUieO34/AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAV0lEQVQ4T2P4//8/RRjO6F50cVtBx4H/ - DdNPnUdWQAjDGSDNAR0P/itYNAC5UEmgNEEMUwxyAUhzWd+RVzAxYjBWQVIwVkFSMJwxGojkYzhjNBDJ - xf8ZABtwun1jwpxbAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABk0lEQVQ4T2P4//8/RRirICkYqyApGM6o - 73+R0DT5ZVrjxBdptX0v0iq6nqcVtjxLy6h5khZb/DjNN/VBmk3YnTRN15tp8lbn06TNjrOhGABU+CO1 - 6sn/hNLH/6ML7v0Pybr+3zf58n/nqPP/LfxP/ddyPvhfzmz7f3GDtf/FdBf/FNNdxIliALkYzgjMeJAA - xGl+QKd6JNxPc4i6m2YeeCdN2/1WmpzN9TRp85NpyBphGM4AavrhFnfvP1Djf6uQO/8NfW//13C5+V/W - +tp/afPj/yWNdgCV4TGAXAxnmPjfTtD3upUGtDVN3vZ6mozFuTQp0wNpEoab08R0l6aJas1ME9GYlCas - MQFIT0wT0ZyOGgvqzjd/ADX+B2r8L2V68L+E4Zb/YnrL/gM1/hdW7/0vpNLyX1C5DojrQeyfwmo9VI4F - KbMjCZJG29LE9VaAnSus1p0GtC1NQKE0jV8uD2sMgDCcIWG09QfIyUC//RdW6/wvqFT3X0Ch5D+/XM5/ - Ppl0oBJMzSCMVZAUjFWQePyfAQAgSZrIUu20NwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACX0lEQVQ4T6WQWU9TURRGeeY38OBANFXA - IFMZpVhURKyGkCDSqAQHHEAGacVQAkWoSFBpFQhFhAphkFRABgVFVGIhBlIplIL6xpM/YnnPFaxFn/Qm - O/dkZ6/17XP8gP+qXwePx4Pdbmdgrk6uZ3Mm+mdr6PlopHumgs73ZbS9LaJp8goPxnMkZItArVaLpgwa - R/RUvdBRMVzCrecFlA7kUdCbw4Wnp9A+Pk56s5pMfagY9wrcbjf9/f30Oqpl8MPKG3qmn9A11UbHZAut - 42YeDtfTOGYirTGe9OIQX4FSqRQNumYM6O1XmV6eYO3bCqtfl1lZc7Hs+cyie4G7g5UcqY9Bkx8kxr0C - l8uFzWaj452ewr5cXi+O4fmyhFuClzbgT04Hxr4y1DWRpF5W+AoUCrmBdaqQvO5sXjqHaB65h3mojgZ7 - NaZeA5WdOsptJagqwzh8cbcY9wqcTidWq1V+5ZyOdLTtGjJbUzjZpCLNHE9KQwzJpihUVeEklIeizt3l - KwgICBANzK/Ok9WWSkZLMppHBzgmPZiAD91RkmSUYMN+Ysv2kXQuUIx7BfPz81gsFhpGtZwQqZYEUu/H - SQ8WLSf/Dkfrgkk8s9NX4O/vLxrUDmZsgD9TD96OIFG6s1g79qYElwYTVRxEgnaHGPcKHLMOak21GHo0 - f4BxUmqMLgRlSRCRRXuJKNxDfPYWgfSx/n2dG+1HfROldQUYVfwTDC8QpSDu9HZfwejECPpyHdea1HKi - AMWqcuJ1LxiWr/i7QGywsDrPpUYVqrOB8h3FmmIwNmuztsn/TdhH8G+F3w933pMKDGyMQwAAAABJRU5E - rkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACC0lE - QVQ4T2P4//8/RRirICkYznAqu8PpWn1X0bX9VZZz79ta6+lft5jP+nXRbOrXfSad77uNK55mGebfsNKK - OyuGYYBP7QMu14bnRXbtbzd5J1246Bd+YI1P+OF8r8ij6S7RpydbFN45qdnz6bli9bM7ysHHKtWs9vCg - GOBSddfetuX1o6CAfbdjQrf4wySRsXnW5YmqqdevSDvtu6dlvjwSJg4mbJpe7DTNv//dz3ldB0wCG1ZN - ubBNxm3vZx3zhWthYmDCtPrpct2Yq9+cLVdnwySwYeX08+vlvHZ/NbScvwQmBiYsim/5a/iduaFmuO0y - TAIbViq5+kbFYeNrK5s5MTAxMGEWd1lZ1f3EAXnrA1/V7bd4wCSRsW722UTl8it/TKwXXbOyXqAJE4cr - 0PQ7YiEecem1tMfBXTAxZKyTf+myWsi+z9a2C9yQxVEUySZfmS2ZcPapht1me2Rxo8xTTprFlz5o+25b - jywOwmBCvP/zR7Xkc84qIQdVpV12vteyXLkRWZFBzukjOtmnv+v7bzPW9FyfJOez+idMDmJA/fP34tmX - v8harn+iYzbvjYH1vHswBSBskHPqhV743s/aLqvfqzst/anqNP8bTA5MyAcdOaFovPq2rvn8T5rWc35o - OC38C1MAwoZJB34be2/4YeS94oeO66L3Og7zHsLk4IrIxVgFicf/GQDTEJf4sarC9QAAAABJRU5ErkJg - gg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACkklE - QVQ4T6WSXUiTURjHvelOIohNpWkz55vu851Ni7wpo8SUSDK80QoEiz7UlGWJqanZmh8ra0PNnM6ZvpuY - hdOIUO+86oOoJLLEj3TalPXBtL2Df2fvG4ZmFHTxPxfnPL/fOc/DCQDw10gbpRt2DGgOrXf228Z6UXYq - E+UWOeheumDtWcAzxym622rA2vQzugP+gkhd5MmoW1HQDMZCyShBP1DnrBL4i13TD7G82M/F42LwdaIe - trZaZNQedERciQAnGNJA8zgO8jY5VN2q3BWB3VKHlRCIaa1Bl7kanXf1EKQIEJwejPCL4ZC1yKB2qBFt - iobingKGSm0GJ+hqrcZ39+CqLH/pA7tgBzvXCt9HI0TZIqh6VFDalLg/nIbPw5koyssiPBF0NOt46GcL - S247vC4L2Jnb8E3o4BsrhlgrJr3T8A9y8lEinjeG/BK0N1WtCLyLvfB+soKdNcE3eZ3AJfC8ygWlpxAz - EMM9fZaJxYghEGey0nmB2VjBCfw3s64OAjcQuBrs+1J4X59HiWUPyD8AVUsh3yDHlFWOIX0gMo4k8YLm - m2VYXhggMAPWeQe+KQOBywhcgJqO/QjLCYOkUoJdVRRGLTQmWyToK9+E5H3xvKCh7jI8871kYGb4puvB - fiiH940WyVoZhKlCBB0NwvFLFJw2DWbapRgzhYIpFiBeo+AFRn0RPE4bN212vBLe0QtYenEa30aOwT14 - GK6+BMzZ4zBjlWG8SYzRG0KYC7dAsV3MC+qvFcI9bsH80zwy4SS869mJt4wCL9sojDSE40mdGD0VYbCX - hnA3+2FT/laIRQJeQD4ErhadReG5E8jOTEVaSgL27laDlkZgW2gQgjdv/GM4gX/5n6y7+e9BwA8yvrCL - fKMdXwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACpUlE - QVQ4T32Se0hTURzH71/91Z/9XZT0sP7QHkqg9CDTlTWDiKyQFEtFA5HIFohlmr0U81Gr+cD5mM7Mx3TO - 5pptPuZypqEiIYKS6cQHpuac895v5xzaxWj1x/fCvZzv53fO5x4OAFfVYoNK24tyjQWl9V0orjVBoW6H - XNWGgopWsgRsXZJiWkIivtOIAAG8GF7gseYSsOQQ4HcmmhXc5csZI+zdHfag02lRYxzE29YBVGp6UVJr - wdDoFAO4yxXmNcTnjiIiZw7Rr9d3iICKZqs4fX2Dx0+ngPkVAX0jUwi8eJsC8Eq3DFWnC08aXYjKW0BI - 8gCNPwOUaSw2Wi5r+ISimm5ybjOyi43oGZx27+DwadkYbhU7cTLBiP1hCgTEGuAf2ZjJAMr6rrgNcm7H - Oo/FVR4zPwRMzAKb5d4v/Jzhc6Mfe869QfzDmiRvqZw/GF5l445eU+4+HqefcLh45Co/4lmhARkvW5H6 - QssA7qPRjNsd8Lk5yOQeuiTXe0sV4HZdaHgsTaxPn19yYW5ZwPcFAWMzAkYmBTadFj3JPRByN3ZnUBa4 - bZKm6jvPNfELRFppnRVFaguSnzYg6VEd/id3X3CqiQCs3FZJt+p6mqlzYnYDUpkVVYZvaOu1Q9djB5HL - yp7k0ukkR7gtoV/T91758MU3VHb1fMoQ/KO0OBb+IJrYtxG58CS3o99O/04cuweRWZO27KZVRGQOQ9m+ - Clmlk0HO3huOKXnXAU9y220MUM4AvuHVgUGJZuRrV5CqdiJSziMsbZxBcsmWlx38X3L1VgYg/d83kUBO - +US8R0CMnpW9gnNwIrHPT6E2gspNK9AhJbtZlEv9/AGgIUK2e4XkueUE0m9ylQH2RYFIm4K5f1qU22Lx - AKDZXKbJL9Oxhf8KAO4XJ//kwGbkeloAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAAKElE - QVQoU2PABDwogI4CQAIKcKgAy0EBdhUIQ+ACSAAigwI4UAAHBwBPpAehnH1vQQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAAAeElE - QVQ4T2P4//8/RRhMFHQfKgDi/yAaXQEhDCZAmkNbnvyXta4CciESLEws//FhmDqYAQUgzUBMngsowVgF - ScFgYjQQsUsQi8FEYsXyAiD+D6LRFRDCYAKk2bPo6H9J40wgFyKBLeCQMUwdzIACkGYgHnKB+J8BAD5Q - tqhi4tzWAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsOAAALDgFAvuFBAAABWklE - QVQ4T2N4+Sn3PzpWVOLHEAMCBmyYJAPaZu+3BOL/Ff3b/ue3b/ifWLUilGH+Ui+wBhAGsWEGoIvBNGfX - z/80b/35/10LTv93j2v8z/DoVRbcFpAGZBpm+K0nuf/7Fu0AueL/kTO3/tsG5vyOLZr239Qz+T/Dms0B - cNvQDYCxT19tBmr98//F22//j1969b+qd/1fkGYgtmFAV4xMg1zg4aP//8vPA/9fvf8O1twz7zBcMyhc - wGGgpSPy39hUHKxx16FwMA3CIM0nTs8Can6LVTPYAJjtyPjeo5L/B/eU/N92ZM3/05euAjW/xKoZqwH3 - nxT/Xz6z+P/PT6v/Hzq28L9rROb/mv714ABD1ww2AF1gyfRCsGYQfne3+f/cuRX/xYT4sGoGYQyBnrrE - /311Kf/LMoL/B3lY/tfTkMepGYSxCpKCsQqSgrEKkoKxCpKCsQoSj/8zAACXlsTbzwuKggAAAABJRU5E - rkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAQ0lEQVQ4T+3QMQoAIAxD0WJ7/ytHEBQp - 6RDdxOF1+GSqAbhCo2Icd0e2j6IFsrlZo1M0KmhU0KigkflPrNFYefKJsA4bINYHMvlwBwAAAABJRU5E - rkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABJklEQVQ4T6WSvZHCMBCFtwVaoBZKEAEB - 6RGQXOAZRgGJAw+hAyfbAi3QwrVAC9eC71vJDFpLcwnBs/Xe/kj7I/M8fwRPJDzAptRKYNNKc0QCn+FW - aoXty+yV7khKoCBuS32x/Yp8c1zpjki45QR6X+mXnHz6v4QkSHzmJP0+87DJwR3Qqj+OJEHCTmQ05+fC - edXB+GXtm+xNUU5LKSN/uz3+tPwMTdFAEE1LDQVaNfWFpmjgZho3WXBzrC80RQMJeEFqHIhWiqEeryMS - 9oujbSTCBFfOSrLI38o5ukmsgzmcNTsO6elwxjhwmLb8sanbhTIBN5+pW3G8Irxnzhix6d1ux+YmUiYg - 2JaoA8eqcdnWk+TwcLoj0pFkbC9M2kjbi3731mf5A6lCUicKFTV6AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAiElEQVQ4T6WR0QmAMAxEu4EjOIIjOIKj - OJIjdARHcKSYSyiCvA+DBw+8x7UUbGb2C5QVUFZAWYFlZnNUBh23KDOz0504rI5blE9OR0Kv4S3KJypi - ikJblJnFUbmieXCLMrM7Kkc0D25RZnRQRRdFcIsyn62Pgf4Ib1G2tr6I4JZkBZQVUH7H2g1WeXFvwrwK - SQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADR0lEQVRYR+2XWUiUURzFhwgrtI2KyGSs - tCkr8KEwaFO01NRKbBGSElNGSGoUXNIsR4kKk4oYQU2Z3FBECrUpUulLFDVyKUV70GGKJItKQUVtPf2v - 35VxqwSv1EMHfm9zvnPmP99dRvFf/4Qi96ociYQoxj4z0Qx3mZixeKgSzskc4o+YmShcKkxWozw7fjI5 - MhVTQAV6+SNmJlagszkPP4YN+N6XOW2oAPgjZiYaNxXQ42uXGsMNFtMm1lPFcGbEMfbLnB/FS4bH/Foj - BZrS8eVNCAafzp82aWFbkBF1BLcZ0WYyGTEyujBPxHupJB41teQCqfj8OggDtQumzWCrAzCU/EeowO9/ - Knrbpc7Gmxg2BaKv2lI4fy7gzgpcw5DxBIylVqjTWyE7XImsMFshaA+okHhQJU1Aw+NHC1zGYMdx1GRa - oUi7HHfi/GFqeTQr1JXoRgrxeLmAsSERH1v9UZm6EBlnVtOHrgN4BQxHCEfK9WZTucHjFQra3ahAPEz1 - h1F+axGuHLVDt7EM+KIHPimEo4+yQcKBMctTLhCDlgpvlF5dhiv+jvTt64GBEOA9mQQyZJqDBJ8JLyXt - 7ZLxWQSqilyQE7UKd2+cpAKVwAcq0kVGgbTft8RFnwn7Am2p0vPHalQV7sGtYCWaKuKBb/mAiUyCeZCy - Ahe8x6wAJlagujQATwp2QXvQHj3vdEA/vTAdZBJMqlrJCjjyaFmsgCHPF4aM3UgJ2krjTwO63YA2Mgmk - p2Yu25Qmn6DR7uulkhxvFCQ7w5DuRwVSgJfWQDMZBdKYtQh0ON3jsWZpXNdJJdke0Gm2oa02mPbvcFoE - ZBJMcexK0CkZyGPNCt29hgq4gY5SDPafpfF7AlVkEkySrx3LsOWxZgXtUEqZSU50lDrR+EOB1g1AOZkE - 8jZ/Hrs7mHjkeJ2iAkkBDqjMdaECAcBDC6CMjAKpubSEFdDzyPFiBSL32sP4Yh/QSyWKySSYnFBrdoWb - +hIbvFMpaf1o7KCl164CcskkGHZ/JBbzyPE67bxWytZupgLbAcNSQEcmgRi1C0DnTTOPmyyNq52UFrmR - rt+bUB66TDhpx2zA/lvwuMmiK5njyJ+Q2cT9F+P/r78rheIntwDgSPIX+0MAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAACTklE - QVQ4T2P4//8/RRirID6clTVDqbs7/dLs2Zn/a2sT2rAqwoXLyrqlmptrTj9+bA3kCv/v7GTYglUhNlxd - 3SbT3l588OVLxf8/fqz5v3Spx9v0dAZ3rIrRcUbGDBmgzbufPzf4/+sX0/+ZM9W+zJ8f3wCSQ1FYUlIq - VljYK19Y2C8LwgUFE2Sys6eqNjWlHXj8WAZo887/ixa5f6+uVk9atcpDBMWAmpo6/ba2rv0dHWU3uroq - rnV0lABxxdX29rJbT59q/f/7l+H/tGlqr5ua0ktOn3YQgukDE+XlFUpdXXMuP3t24//nz6r/P3zg/P/1 - q8D/jx+5gHzl/z9/7v0/Z07y302bPDJgGlEM6O2d9eDRo2NAZhAQb/m/fr3B/2fPZv3fsMH6/6dPG/4v - Wxb4Oi/PJP34cSe4zTAMJqZOzQTa6AHEG/+/fRv3/+7dPcCAiv9/4cJOoO0h//v6GF6kpAgZoGsGYTCx - YMHk/0+f7v3v6xv4X1WV4f+UKX7/793b9H/FiuD/795t+D9rlsGr7GwGS3TNIAwmli6t/n/tmtF/SUl+ - oF93/dfVFf1/6ZLb//fvdwJdFQwMPJ53eXkMoNSD3YAZM2Z+/PJl8+sjR+T+W1qa/peSUvx/5sxqoFQk - MN43/J8wQeFeaioeAxoaOkP37Lm+9f//A0927+Z+d/785rf//6cD8UIgTny/fn3ukg0b4sXRNYMwnFFV - VeK+ZMmyB5s3p37dsKHt67JlEV+XLm37umBB8IeVK7vjXr1ay4isEYYxBEjD/xkAmMvAJtry8/MAAAAA - SUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAAChElE - QVQ4T52Q3U/SYRiG+Qs6aKutddDcWs220jKwuepArebUFtPFbKCJmYQfkxmakbRyIZFTHJrprCimZWGa - X0hqMHEwTFMLxLIpg+w7NXWkC7zj/f02W5MO7OA+et/rep7nZgBYV/qkgpimrGSQ9BSmhwb89K8037kQ - ScCp8lyM5NOSgB8DhcDdLUXQdg1g9FoeBSuZTPrRYVbBZqrAsKEM1mcKmNplsOgVsPYoMGS4gbEXFdBr - 8zDjLMWb/izIZEWQH2D6UTBWBSs+O3ze5/Au6/HL04blBS1+ztbD7VBB15BOwQ4DH621Mdi8cQNuyk+j - uuQcnxKQ6T6vJSDcoeasgYcMYlRc4SI5NsJFCUaN5fAuGbC8+ARLcw/g+aaGy65EW138GthuysFrswSF - mWwioDsY7C71T+2EZ+Y+Fr/UYv6DCrdua2DRyeF6eX4VHjMJMT0igrlTgAxOFJKOhdMCi+66H36EhY9V - +OEuw6yzhBKsrPjQqGJTsM0ogGswG+/MZ9Fx7wTiD4ciITKMFvS1yrD4+S4e1xegXM6HKCMOOSIx2Ikc - f80MDHalYdIiwLgxFa/0p6CtOoIoVjBiD4bQgl7tVcxP12BmshjfJ6T4Ol6ITzYx3g/nYsoqxNu+NNi6 - uaR1yAq4yE6JQeJRFiWhBF0PL2POXfkX7BzIxER/Ouy9PAx3nIS16TgFkzOiw4NRnBOGiJDttKBNc8l/ - txL97WkwNqegpzEJOk0CntbFUes2lB2CuoRFTSZwpYSFGulu7N25jRa0qC9CnLoPIl4YhJz9OMNmghfL - olomRZFbybpkbalgD6olu6DK34HgoC20YD0SsjaZTOCgrZv+CP4vYPwGutu4vmPLy7gAAAAASUVORK5C - YII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsOAAALDgFAvuFBAAAAyUlE - QVQ4T6WRMQtBYRhGLZTJZrTZ3DIZjUabvyGDwWK4ioEsSoqSWKREGfkBbEpStktSFkUpLj0+i+F9vsGX - 4Qzn9LzT6wHwF9pogjaaoI0mUKhOXiiPH0jXdxedSyh8xmvnCSs1UMouoVAa3rA9uAgnu0rZJRTs/hUr - x0Uo0VTKLqGQ750x37gIxmtK2SUUcu0Tpss7ArGKUnYJhWzriNHiDn+0qJRdQiHT2KMzu8IbsZWySyh8 - /u2zCt8D6RIKpmijCdr4O/C8AZF98ic9bkEXAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAAJklE - QVQoU2PABDwogJ4CQBIKsKsAS0EBdhVQGgywqkAHHCiAgwMAUNwHobQK+3wAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAHbklEQVRYR62XDVCU5RbH37Qol2zFIs1q - Jk3r2mhbalNJun1qTVMw4VfdcbymG6CsaIkmX6uUmZqTmTVlriCIUH5wQfNOV2m73pqmTJawQKgWF1h2 - WZZdBeRj2X3/nfO874JM2ExuZ+Y/zuzr+/x/zznnOe+DNOX1chjMdSQ7DHvqYchpJDlgyHWSXDDsbSa1 - wJDnIbXCkO/FwhwftMkOq7TEoZXCjaScOlS68Ze09X/AumN+jFjRbJWWNocHsSLPjl+9QLUHONMM/EQG - P7cAVST+7SyphlTbqugXUnapjBnvysj6wo+olR6r9ErrlUO8uq8ejW2KUbkT+NGlQDAA/1ZLYtPfCNJG - qvPR7gtljFupQGQf70XUKp9VSjh/ZRCphY1o6SQDWviHAhPKC9ej4tMN+JFVtB7Vpyyw0bNzJPt5oJ6U - uleG9qV+iI0nAohe3VasLvnX4vUiB853K4ufSoqAdUUkKlYNFyo3alB1KFs8a7gANJIclK3vbTKKv5dx - xCrjy7MyvrUDj64/4JP0N1r6NdJ01eNRKUNmRelUq8Ej7TMnOvzKwmfWRKE6YxRqTGOEqtJvxi9H34YU - X/YHTU8/DXcH0Ebw/P5jGw76blg4Cvdvm4zZ/3kIMfvvQ/RbWmiWaxARP9waEXdDrGo5MDIOuNDdC7ja - qd4bbkPd5jtRv+0u2Em2t8fi3H+3wUnPXGTGhi0XAQ+LytZKukjm/P4Lu7p551pSrPTYyOKZW/XY2Z6N - hLo43F0SiZHZERg2LzJHte2PzIPN8AdocVrUvnUCnB9MhvuTqXDvmoKmnZPQ+NUONIeMVVMvydelqIvM - +f34XT0WdUkRQ58eodMuGF23qTkdGy8mYto3wzFmx9WIXKgxqf9FicxDLegNKrtyvD8JrbkPor1Ij7bC - mfCYH4Dr6w8GLUFIPWTO78d/4h8AwEFp103KnIyPsA0vO6dC952EkSnX+tTHSmQd9iAoK7tqqD0Fp60c - 7voKeFjnTsPjdvTt+ALVm2ve3qOog8S75/fn7O79AwDHsPmRlj34EKsvxOLRGg0m5GqgTbhWrz5mgFax - ABtwp3Mzcj9wSTjlXvr9vGoeMuW6szpJvPs/A9C8pLHswx4s9kzFM42RmFgwFFHLIvoBTMVe0PviKA6W - 4sspvdAm6h+gl/n9ObsDfQDXzb1eN2xBpD7ynxr9qKToOnPvdrzonoznvRroDg/BjSlXp9y0eqj+5rVD - dJLp3z6xAO+wiXevNhw3WyjtvPPQjtmUu76bUs/1590LAHM/wB3Lx2HpwZex5PBirP3/arzVkYIXXHdj - QecIGGoex/yjz2HCriG4fdNVIACaMhRcWz5ufNQ49Zea8znvM1eNufZ+Nf0cc83BPgBKe47pZAbMXVuw - yheHBe778KxzLGk8ZSIG8ZUTMf2oFqMzpWICoG1TtJHR4VPeQdN9OXH95UEAOG41jrIW1RdgpTdOmD/p - GIMZjTchtnY85n47Ebe/MdR6i0nSSqYSBYB3yuedjyM33oDUq2kXOydTNg6wOP19APIAAK3hOu09GWN9 - X3WUYZ5rijCPs/8DKdWzcM/24T4yV0a0qYRcKdiM0z9Y7Tn1obSHzDn1ov6XAeCISr5GN+v9GJz0H0d8 - 073Y7FqMJwrGg8z7x7KptB8gdZ8Na0hrC2xYR0rbb0M6izo+g5RZpChLlYmk+mNRXgCmknZwSbmvTMU+ - UivWHPgYr5UmobjjXSRYZmO+ORWvFTTAuNeOaeus1ISllHMK3pVoLHWXl6b50t0OkHhTiazPlQYVJ4TE - WePScQYTiv6FOQcfwov5saLRz1Hf8+UmMcfOAJTzvyHSjig9dIgauYlMln5Ug3oabA0nNsO+fyE+2xCN - yveexQ97VomLD194EnMbINFNplhKuGCREttIHRYp6SKp0yIto6/bMvrALKcZL0STLpnOejJ1O8tINU8O - Wuk33LtJxtoS5fjy6eBe4s81zxXvF0a07J4K+zsTUJUWjfItT6GSrn583UvMdRBAOLGsWy8ldeF4dUBM - Uh7ZDMCNHEMAnJGOk6nw5U9H4/aJOJs5GhXvzMbPdOUTAHudYQIs79ETBE6cDYomZjEAg8Rk0IeMTxRn - gD7voQxUbH1K3DVZiXmucAH8ehLKCIAnJTccAzDIIwTAx7mlsgTOkztxzJyN2tJNqDqeKxqwhpswzx0m - QHIvAfSirCbY1/kMwCAzCIBnCZeCvy0P0798++YTwH8GCIB8T7gAAT034Zc1sji+PKwYgEEYgDPBpeCe - EE1Jp4NPBt+yxTHc1xouQJAAggKAZwbPDgbgbMzIPC3uDqFSMADfM/hmzX9bKAC+MAGMsgJQK4tBxRAM - wJmYSQBcCgbgpmQAPhXXxMqIXixj2psy7t/4dwAYZVgIgCcjQ5Sd8YpycBa4MQUA9QKXgQFC5vHmTkhL - mhapK11hGNEPQNMwNKJDo5vH+Onf2kRGeCzzJ5/N5+V0QzK0hGnOYYSOhEX5gOmYDNPnIQVVBZB1lHSk - FxmlfqSV9OCBLV2QEnyquST9DgSf0DcKsi05AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAAA7ElE - QVQ4T2P4//8/RRhMhDc80vEpPQVkYleED4OJkKb7/z3yDwCZSBJAKUIYrA5EBJZd1nRIXv3fMWmVH8wA - YjGYcM3e8d8ifPp/Y/8OIBe7QlwYqyApGEwE1d/4H1B95b9L9vYudAWEMJwRVHc93SZ2AZAJlQBKEcJg - dSAipOGhj2vW9v+2iUv9YQYQi8GEZ8GB/5YRM/4b+bYAudgV4sJYBUnBYMK/6uJ/3/Jz/x1SVgO52BXi - wnCGX8W5/47pm9LgEkApQhisDqbBo+jIbLPgCWBBUjCY8Cg8CA5Em+iFgegKCGGsgsTj/wwAYWiux7Jg - lFIAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABaElEQVQ4T6WQz0sCQRiG/XO02vof+kH0 - iw4WleRm0SGig6cigtworUsgblEQgV26lUERUUZSggZJQSsqGrgnQfC0K7govjkDWbuMaPjBM4eZ+Z7v - nTEBaAvTVSgLFs7j7DWrwQgVGIvsOQR/S5KGglD0Aw6nt6mkLvBHf6EJ9moCA7wnhhUxpRMyE5AiDT9V - rVZRLpdh334FZz3H0v57XcJMQPgr0DQNqqrC5nrBWSCGzvFTLLjDVNI0QS0ylr0SQpEvTG0E0TF2Asvo - ESwjh+S4cQLyXjK1UCggl8tBlmVkMhkkk0l4DgIwD/n0gkqlglKphGKxCEVRYBPCyOfzWNyNYH7nGXNb - T+CFIHjXA9y+C72gZ5BH98AsuH4buL4ZdPVO07hkajqdRiKRQDwehyRJFJ2ALCwm1+9oZF54hH3zXkdL - gom1W7x9puARL2mDkaYC6+oN/WnzsEgvsyD3mM3/gbnZOjB9AytcDAdFhtjSAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAPUlEQVQoU2P4//8/QcxQUFAApP+DaXQM - VwRj4MNwBkwnNtNQdODCGALoJoLYGIqwYZxugYmDFcEYuPF/BgC64OR2AcPYGAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACgUlEQVQ4T6VST0iacRj2kBASeenSITrU - QciDVIcuER0KIqI/SAT2D/tDZDRptUpDI7cwqLa2DmOwwRijy2CMsTaGQ3Bz+CdERUUDRURFBQ1xozEG - z973W+uj63Z4vvfj/b7ned7f+3skAP4LwmN+HpiZ+YWpqR/QaL5hdPQCw8MF9Pen0dOTQFdXFB0dAbS2 - etHS8gXNzZ/Q0HBK1CsBJh8f/8Tk5CUqlQpKpRLy+TzS6TQSiQSi0SgCgQA8Hg8xHsBms1HdEQXY+ejo - EuPj31Eul1EsFpHL5ZBKpRCPxxGJROD3++F2u4lxn7B3U4DHPjioYGysLLgXCgVkMhkkk0mcn58jFArB - 5/PB5XIR4xBq9Ueq26IAn9lqLdGHokDOZrPX7jx+MBjE2dkZnE4nMfYxMvKBqkkU4IVZLHkMDuYEZybz - 2WOx2LU7j+9wOIixh6GhU6pbogBv22RKo68vJYzNzkwOh8PC2b1er+But9uJsYuBgbdUN0UBvqqNjQTW - 1+OorT1BTc1LVFc/R1XVU/rjMeER4ZBgpSnfkdFrer8jCvA9r6xEoddHsLwcwtJSEAsLPszNeTE9/ZVu - x0HZsFE23lM23qC39xUxb4sCHBKdLoDFRT8RF9DW1gaVSgWlUgmFQoGmpiY0Njaivr4edXV16O4+IeYt - UYATNjvroTS6odVqqfuQwPe9T7AS7sJsNsNoNEIul6Oz8wX1dKIAx3Ni4rMwqkajuSJyWHYJOwQTDAYD - 1tbWIJPJKNbPqEf5/yvA2eYzMtRqNXXvESyEbcIWYROrq6u0Iz2kUina259QTysKCC+CE4NJJsIfIm+b - F8Zn5rHZmckSycRNgX8DJL8Bw72K4H8g8YAAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAm0lEQVQ4T62NUQ7DIAxDe/9LMyclyGau - ygZ6eh8xtXu11o5qwx1tuKMeOENcA5cJ1M8NOU4PBm6Q7y+4DzUAMTB7vzzAfahBZ3ks4D7UAPBYeb88 - wH2oAZgH3F1mUt2uHvxhhzP3xv3ckIPKhcuKzKmfGxL8wPgJ96EGi4yxgPtQgwVkLOA+1OCFGJuVPpTj - hDbc0YY72vB/2/UB43bUVn8JuhoAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsOAAALDgFAvuFBAAAAtklE - QVQ4T2P4//8/RRjOqKrv+F/T0AnGlUCcU9b5X8/QFCiFXw5uQE1DB0jg/6/ff/9//v4HjE0t7EFCeOWQ - DOgEKvj3P6Dp63/D1LP/7775/V9TxwisCJ8c3ACQ00AmWxY9+q+fdOL/ietP/0vLKYMV4ZODGwDyF0gR - yHSQgm1HL/8XEpEAK8InBzfA3NLuv7WDx399I8v/8soa/0XEpYGyICn8cnADyMVwxmg0DotoJA//ZwAA - qy/GB3Ky9SEAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAC6UlEQVQ4T32S209UVxSH9x9gjCbVF1JN - Gk1MNIGkvGitPPhgYzSxXkpUKjXYgg44Fi+ooAeDLcVbjEKaQFtIyygqihduUQgmilfGmSnCMDAOhhMJ - 12OhOBBmOJ9rmNNiX7qSL3s/7N+31t7Zaro2NSaozfc19VWzphKfamqrU1PbPZpKatPUjg5NJfs19U23 - pnb22KOBaAHWTsLufvg/KlshsXySed8PlFqpDwTSufsvaB0Ajxx+KWv7IPiGoHMYugwRtJjE5Zpsc4SY - v9+YlswIZOz+dyJ42oTzUi6uihO4K3LxPm8i8BZei/zaE5O5X0clSZfDqNQR+4xA7jwyAd7rebj3zeLP - A3PwZM7Ge+Mk+gi8GYWOPpOqZyZ1HpPmbkmm/a3NCOTBgiEI1J2iK+9jun/6BP8PC6ku1liR7ZzmMyG1 - 2IcxDpGzave7qOBxirK3XFhDa0M5XTX59BYuY/CXePp+jqW99hxVLQa3nAa3hTsvDJp9o0yGI4KgJdil - NIIn6K1ez81D8XQ6tjPalIlRn46zsYIsR4DDwpEIlwIUN/QSnpLknglL8K0IzACMFzHc9Cn3Ctbyx902 - bkrnSNdq6VrrMqhzG7S/CTIu40+ZkrRNWoLvRIAXzEcw6WDMtYLK7DiWJpWw/MgzPs9xRjnmpES6R8aX - vAhCliA1KhjrKWPYnQXhekL+DbjOLOLs+UKOOrrIvhwgx8LfF5ScJNPD/xWM+AqpObmOnrtbZcZS6E+n - tSiGtF3J7CvxcKwiwHHh1b+CKUuQNiOwZWSyMulHHpR9QWh0L7w9zMCV+VzM3siqg/dIkGvYf/NZAtMS - 7LYEnYWUH1hJUc4OKk+n4Cn4iImhRJHYGLu/hDL7MqofdvAiIL8qksz4R7BHBPrvsn8gVAklQr6wX0iW - F/sSjC2EvAn4L8YyMSzfUEplYAlsStNrbOg1O9FrE4X16HWrheXo9bHCYiEG/epC9BsL+DVnlSsSFhIA - 9R7YS8m5vNQLXQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsOAAALDgFAvuFBAAACMklE - QVQ4T6VT30tTcRT//gm+9OBbL/Xai3vooR9oUVbYjOnmdVyxTalFGxuJa+FljbVCy5WrLTOTvIgNM3Fk - rpb9kCyHrVoMNAqJkRgi9BSBL5885zIf7mW9dOG8fPh+zvmcz/lcEZ+J7N4sxDJhRJ9eRM8TBZFUAMGJ - DgTGvOgYPQuPegqnh5xw3G2BfLsZ0i0bGmMNVPuoAd4X3+HL+iIKa5/xYTWH+R9zeLk8g+mvjzG5OI5k - YQTDn+7hTi6O+EIfet92Q0kHIHltEDSZyPmfH5GaXcLD53moqXn0J19grDAKNT9kwJXMeThVGfWO4xDR - dJAnL6xk+RF9fzYAuzvC5IFcwoB3TvkgDzTjgKUGonuqi2W/Kb7mCb9+A9/XgKNyJ5Nj2agB9z1yw56w - wlRdBRGe9PPOz76lWV5xHcgtA6ZaB5Ovzl0x4O6kC9Y+C3bu2gGhjJ9jw1JLE4gNT7NEmkIPiRyZDW3h - hFG51HY0XDOjcnslhD/pYbdLhpVkl8hkGO1MsmkykdsHT8J8uQ4V2yogvCMuPlU5t4msx1sTMo6FjmgN - ztxv4zuXc5sm63H7DQm1XYe0Bm2DrRyScm6TbD1u62nEQX+N1qCl384JK+c27azHLZdOoNq3X2sgxZtw - M3sd4VdBwxVKhulxc7AOez17tAb0U4QyClwPnBxPShiFhO5MpyK3yTDamWTTZCKb5KqtBoebLlghuW2c - bYonJYxCQnemR/+oerFp7n8UxF+CFapvsjm7iAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAWklEQVQ4T72PSwoAIAgFO2rLlh2hm1sQ - Bn2EsaDF+OAtRg0i8sSx9NBHCy+bQAsCFsRcWuw9Flhgwf8LdOPIlOeMPU0BBQt08woWWGCB/ryCBRZH - gZdJcI+ECrVHltkgbNtXAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABwElEQVQ4T2P4//8/RRirICkYqyApGM5o - mPgioXXqq7TWqS/Tmqe8TKvrf5FW0fU8rajlWVpGzdO0qMJHaZ6J99NM/G+naThfTJO3PsWGYkBW/ZMf - WbVP/qdVP/mfUvHgf3zxrf9Redf+B6Vf+u8Re+6/ddCx/wZue/8rWW35L26w7qe4/mpOFAPIxXBGSduz - hLKO52lAOi2/CeTsJ2nxpY/TwnIepnkl3U+zCL4DdPrlNGmzQ2kSBuvTMAwIzXn4IyD9wX+PxPv/naJu - /rcKvvjfyPvsf3Wn4/9lzQ//lzDc9F9MZ/5/EY0J/4VU235iGEAuhjNiCh8lRBc8SgvNfpjmnXw/zTHq - bppV8OU0U99jafquO9PUbFalyRrNSRPRmJgmpNKG6QXzoNs/tN1v/pezuf5f2uzYfwmjrf/F9Zb/F9Ga - +V9Yve+/oHL9fwH5ov98sln/+WTSaOAFx4jzCfYhR9IsfbemGbkuT9Oxm5mmbtGbpmzUmCavW5UmpVGU - JqKUk8Yvl5XGJ5uJ6QUV210/ZE3WAEN67n8hta7/AooV//nlcv7zSif/55GM+c8tEfafWywQgsVDaOAF - 8vB/BgBJ6pL9Rq3ZyAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABk0lE - QVQ4T2P4//8/VTFWQUowVkFKMFZBSjBWQUoww90bB107GlP/T+vM+j+nN/f/ucOb/j9++DgIJHnv6WPv - 169e+3z48EEYXSMuzPDv+zvGjStn1O1Z2/H//tme/5ObXf5uW9yYj00xMRjOaC0JrXt1vv//5qm2/6ui - pf5vn934/9fbVyrIionBKJzZVd51t9aE/N830eB/Tyz//3ndFe8P7NlDtHdBGENgTbv7+rvbE/8fm2X+ - vzND9v/c1pTd29ZOY0RXhwtjCGQHq7P1lru2Hloc8//aWvf/Wxo0/neW+66rbvAXRVeLDWMVBOG+ytjq - 7fPi/99fF/R/fYvB/6oSk8/p0c6O2NQiY6yCMFyQqCOxboLXu2srM/6fW5r3f0GM8/8oI4U4bGphGKsg - Ms6L19c8vmHJ/29bFv2/H+z0f4KB5Ats6mAYqyA6rq/pr7s4f8n//13N/w8E2nzCpgaGsQpiw/Mm91af - qi1/PD3UYx42eRjGKkgJxipIDAYCIIVgw/hwBfgwsgZCfLAA9fB/BgAkVXO0YNpDnAAAAABJRU5ErkJg - gg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAACcUlE - QVQ4T83R3U/SURgHcP+k5oW6mUsjUWgCsTBMxnzBXL6LKfXDHz9elEwFkRfRREjzBRIrypzpmuWsOanU - zXGRXrQumjd10U06PH470toSnb+WXbSz78V59jyfnWcnBcA/zbHF0+Ro8YSTn5eHg/xeS54/Ujjp/B+g - 2/2OOBwrpLtriTwIbZLR0Q0yPLxOAoH3xOeLkoGBZeL2vMLs7CrZ3v5KkucPXQ7S2blABvrX0GaZRSTy - HYO+z3C5P6LL9gGW9hj03Boqq17SVkCt7ucHrdZ54nQuw8g9weTkNzg9FLNvou32BlqNa7ihW0GJZo62 - AsVXPfyg2TRDbN2L0DNTGB37Ql+2BYs1hlZuFc23oqhtWIJS9Yy2AkXKXn7QwD4m1vY5tLQEMeTfRhvF - WPqyBKZ9DU3VAmSKh7QVKFTY+EGWnSIm0zS0DSPw9H1KrNnMrCSwCoqpyp9DJAnSVkB+6Q4/yHFhCkZQ - X+dHd88WWpi3qNO+wTX6EeryOSiKn0Iguo94PA6ZtONPVg4RozEMbaMf7R0x1DdRrPonVqiahkTxCJkC - P3Z3dyEpsPKDemaMsK0TFByCwbSOyhqK0V/9heVLQ0jLupsAxWIzP3hTN0J0umHU1njBGNZRUvECSvUM - ZFciFAtDcDGIM+l92NnZQb7QEE+eP3Q5iKbMES8vdUAht0B+OQCh+B5ycgeRec6L9EwXUtN7kZrmxf4+ - Qa6A4QfNphApK+2BqXccnG0MrH0crC0p9gksRjdwPkfHv/LeHiHaRheKixxQKm2QyiwoKOAgEukhzNPh - gqAJ2dkNyDpbjYyM6/zgaXNs8e+DlB+yFFTq/JCt8QAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAAI0lE - QVQoU2PgQQMMPAwoACQAlQKDISaAAlDlQYCBAwVwcAAADI8JaX0nfcEAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAHwklEQVRYR7WWC1CU1xXH70ynxqaiQAgU - qDoY5aERH4k28QFGcIIkSlKjCaCSyEMjVtIxpJGQkDE1xtZobayBRGNHJIkKxCb1gQZQg4jKuoCwAUGQ - 90PYXRFQd9nv33O+/T4eSrad2p6ZHzr6cf//e8859x4BQIgl2QbxUi7E0rNEHsSyfIiXCyBeuQgRWggR - dpkogggvgVheCrFCR5RDrLwKEVFJXIN4tQbitetEnUGsaogQ/0HI2vIPEte04IHJ0AFvH7sLu9gmiMim - f2ui3wDtvOwGHpjMEmBBMpB4wgS7da0QUa02TQwwkIcqA2R+bAeutAGlBC+qI/jfmHKiosPKVYVKfT+Z - WglTkiTZRNJJMvG7dojo9p800W+Acl7fCRkW0jQB2magmI71SqvVjGyEqKD/l4WJKuIaCTPVZD79koQx - sf0mNp0yY+R6PUSMfkgT/Qao4Fq6IMMLa0m4RBEvU8Tl3ROy8ADRGuK6EaglDl+QYB8+2MQfs8lEnBFi - tfE+E/0GqNrbeyDDi17aG4eLm+ehcMt8aD4KwOWtBP2p+fAZFO+Lu0+47iadHpFeIOGhF+838WFOLxm4 - SUKDo98AtZrxDmR4QRbVxA6HNu6XKHrDTkYbNwKadb9A0Z8CZeE6gkWZBkpdI6evRUImncIRSsW3lyWc - LJNwtgo4X0ciazptGKA+v3UXMrxY8Y6FKIl3QNnbTtAlOEP3jjPKNjrhyluOKPtrsFWUYFGm6RbQTLQw - lMZWBf1t65qMWNNly0ARekyQ4cV0u0NQ/p4rKjf9GlWbxxBjUfnBaFQkuaEi+QUcvkiFtST7J4k/UI0b - 3dYTVdcVr3fbMEA33B0zZHgXV/e8hOotHqjdNgH1271Rv8Ob/u6J6o/GoXrfUlyo6cGbqdUyLMa8NYBv - NXp0UD110s7VdW0boOv1bi9k2ujoqveHyqLNf5uM1uSpaE2ZhubdvmjY6YO6tLC+Y+ZdtjMkxoIMHztj - ILrIgLqueL3HhgG6280WyPCitV+ukAXbv5gBw/6nYUidhY59M2UzjYciUNlmwpFCPf5BO+XdMt9dtvLP - ATQbTX3rirW3bRkoRy99xPBu6g+9iht7noAxbTa60+ejO2M+Or+aKxtqyVglCw+V+3s5WazvW1esvWPD - AL1qFgkyejJQW/MjGqsK0VKjRVtdEdrri9FUcgafPuyG3aM8cSrrDPamfo3T+YXo6DLjJhVbJ6FWPMPH - z7lX1xVr79owQE+q+iHnTu1xbjFuL853Y6MRO8WvcHikBzI370TKF6k4mpWL+lbDINEuqvhuBc59n4FY - mwauQaKPGDZw4kqn3GoZl/TIJL5R8s0GNCvWIGVxJDZ8kIxNuw7iQFYpjhfpZU4o9NDOGRMZUNcVsSYb - BmiYoG9kuHefStAMmVM2YPjkUyQN94KYsRFiZiJE4Of3fZezeCVyidIz55CTm4syHQ0wNi8immRUA5zP - k6Wd8u55533VTlXNBiyffY7MuSFIDIlB/OZkbEk5goOnq5BFBcdFx6SJR1H+wnKkjxiLtIQkpKWlkTGa - tu6JAQboslaCDTRR7vlC4juB+5z7m1OT6huAlohoNBz7HslO3ti7+zOkfvk1Lmi06KaKU3v+K+EE/Pkv - MKyOw3cPueFgeBTEgv02DKxqkMU5uJqjUyow6x2NzGwmUYM5RPz4EJR5ToXU1Iz8mA3Y6vYkpj3/Lh5f - tg1PxWbAL/ES/N7V4BAb2LodUmg4TDHrccbxMfzeNQjHheMoRVsOklMNNMriHHx9qgZk8QEG4ha9j2wX - T1gyM+mIWvDDklX4eNg4PDt6EXx8IjFxWjyW+qxBOhvYsg2WifStnz+kl1eiZPTjyBKO2u+F41hFf4CB - SBqBlOB24qu2Tbli+V4w0vFzapqv1uHvP3OFOSAAUm4OTSbX0LL3AM4Hv4JsXz/kTpqNspDlaIxaDynh - PVgmPAaLx1hIXl6Q5gejcfw05AgHw2nh4D/YQBSNP0qwgWxdZ1/xqdfrUa0ex4hdPkEo95kO87MLYNn+ - MaTzBUBePnD8FKQ9+yC9GQ9L8EJYJvlYxUe7Q3J1geTiDGnyTBjcfZA/zBl5wj6C5FQDNHspwQb4+O9t - LRUvv0+QPtwd3QGBZCIQvXN+A8vM6bBM94XFd6L12NWdq+KPPgLJfhQkRweYwpbh1mvLkS/sWU4xEE2D - nxJsIIdOQH1o+ATU3fddNpF/wGnnCegOCoL5xcUwB5GZeXPQ+/QMmAP9YV4YAIvX+EHiFnc3mMKXoYfE - deMm4bywzyU51QBNm0pwG/GVylcpDxK3lfdcbTG+3fh1K4hYh6yRY9Ds9wxMoUthigiFKWolTGsjYXpj - NSxhYX3ivd6e8jfGxYtQ9MgYFt8xuAZiaNT9L6Lxm6PInuKPoz93wTmX8ch3nYACN0/kO3kAG9+3ij/5 - BMy/DUHrXH9cHOZkIPG+6ZiWUA3QjP0A0V1Ti/bcPOIHdBCnhAOkDQkwz5oF83PBuO49BRl2k3nnUxRt - OehXlR+rDQaa262jM0+vfG/zCCVDkwwPE/ye85PKrxo/LLFmK+to5JaxKEjcalQT83Hbfx50Lh7Y5f4c - 7KJJ457oN/A/DupzGKfOgHaEK1e7nO+h4v9m4KywN1CfG84NyPdQAUD8C6QsF0A1x+GuAAAAAElFTkSu - QmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAECklEQVRIS63WbUwbdRwH8H/2wmVmpCYa - 5YUJbyTRmK2vnIlvID5k+oI0ITJa2hVGKLRcu+NabnB9bunWjUC7ydOATYIMeei2zumcYw5ENrLhsGZz - KkxtkA0Xt1jNdJnG5Ov/6LWlXmaY8ku+L5pev5/799r/HXmY0WrNSp3OopRert2UlTEKWh4OGTiEq+qg - 19eFKypsCunt/ze0XFlTzsY+c/oAtxvgOMwaamHeYYtXVu4qkA77b6PR1HqazAJ+6+gEWloAjwewWoGa - GvxuqEF7lRUGgxCWDl/9aDSmvPJyPtYWOIb7gxGgpwdobQW8XsBmWwZQXY0/LSyGO6Ng2D0xk8m9umuj - VptYExNMdB1eRP8AMNJzF0sH3wdCoQxgNCKxuwXjs7cx9CXQ/snPqPf3gWH8HqlGPmq1UUETDbR+gMgZ - 4N3jQP8R4HA30NsBzB6YBnz0OtTX4+bJc7iwCHz4LTB8jS5wliIzgL//Ejg+FGPZoHw1anXdROfgdZw4 - jyQQBd4RAfrtiICY9zqX8MPcTVy9A1y4AZymwAgFeiVAjPf0L7AI3XGpNjMatR/6shnsPXADkTFgSAQG - M0B/dwJLlwpwb74Acz/GMU2Bj74DRkXg82Q5fxYoPQYw3iFItZnRlgWg2zYLdfE0ak1f4NDAvSTQC4xF - o7j/vQK4ToArBH9dVmD+674k8BWw/yJQeTJZLsbsG5ED23VB7Ci7mkY0b05h375rWJhTAXdo8SKNBGCG - ZpLg1nkVDk3FoaWrTZWLsfhH5UC5vhkG/XwWYirdj8lOgj/E8n8C4zQRgsioJ6tczM6miBxoKKpE7xZX - FsJqO3CUIxi1ESx8vAKYoBmmGZIDZi0g6I7KAd/WEiwQgnO5L4JRX15G6it6cKqBLCNHGILJEC09lSxO - JQXo6d9EeJb+kh8F7LrjciDweil+ooCIXHkkB8HCDtir+jDuJGnkrD27PAWYDHSbeiJZLsaxPSoH9r6h - xl1ankK+oQm9mo8x37o08qknuzwxQGBRedLFqTj1J+SAUFIdv/W4IguxFD6Jja7nEHTnLCMXmzLl0TYC - hYWg8KVswJt3G05bX0yqzQzdFfOsei52ZtOWNMK98hSIfxOI83mUOHMxFVy3fNYqFwGpTWYl4H55Bk5n - 14TLdfDB9wqj0e1pVVVgIecx7HqNAsHNaeRpRz7y7BvS5SnAm/srnFWRhMPRxUo1/z4M41M2VAmxbcat - IC3KLITwG7OAonIODuvbMVqeJ3189cOyezxFdgvWN7+QQSRgfe0GaHkWdnvHg7fo1QzHNRcw/O74M4Gi - JEKB/J2bUdfYHKfla/MAwPMhBc+Hw8UuK4obGAhCe5iWr81Nf+U0Nr6lFIS2hzhrQv4GrS5q9AXVAXkA - AAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAqElEQVQ4T6WR0Q2DMAxE+e4PI3SEjsAM - TMAIHSGzdJKO1BHMHXWiOE6CAic9jIjubIdJRG5R/TjC/9HWotVoJCBoNeoFvMBX2bJ3QzPgsX5mQGMU - V3BUA2gEP8AuUTx0uACYApAC7l92n0EypwAKhjc4m4Ah9QAK5rM7aE+gKv8CDx29AHaI3Z5aGWrUC6CJ - lxcvkDVf6VAvoFTaO9dIACfgVEYu4Doy7fjZZfMGl2qxAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAEFUlE - QVQ4T62Ta0xTZxjHHUvcB7/PL8s23cW5xIyQaOIHs2wJmxbG3IY1AREQmFMhWFoFVzYECqTIbRIuQSC4 - egFrNy5d0DkdM4xyK4KFnp7znkvbc9pqKZHKbQHCf4dMbtPs0z78kzdvnueX5/9cNgH43/TCz/+SIDq3 - r7zdorTdI4q7OYYJcRAS8lzwighLqgjlSKWYsaOM0/HSAx/fafPyX/pF93H4AljiBPhH+kE1XMaIvqrK - NjAw9AIIa2IIMfEcCfKSCLfHjQkXj1m/B7OPvZgZHIO34ir6VZmwlGQjWF6N6Ys/NtPdPRtBy2JG7a0C - YdH1pwV9Hgl/DNtwp94AsaER3SV63M/Mh/dkEWbP6jApw5BTiLmsInCWvvE1CCFanmM7HdZhw8MhG252 - WRBbVom40jq0F9UhEJuC4SPR8BfqsKgqAtJzMZ+ZhqW0dMykasBah9ZVxDBa0cljbGAgx/rQjh7PBPaX - VCC85jL6GzrheTcMwZhISNpUBE6ogaQzmDmZjPkTKRhPV5XRFBVchVEOR+TEuLd5eKAX5rtd+IXz4W1N - LrZkFqOlsg3BrTswuS8U0ikl6Nh4+KITEFAq4Yk6gAdJCWU0IWuVUQ76da8kuiUnDdOtdrSO8tj9XSW2 - aKqQV26E79Wd8O/ZhSeKcNAR0SBRhzH96WeYjlSg/1hSo+xsDUbTTJjMgpMbRVtnB24zLnyUU42Q+AKk - 669D2voBXLvew1PFJ3BFHIYQpcS0Igp/7T+AkcRkPc2sq0weQJiTFyQnS0nGNiO6WCeS61vxcnwxjpcY - 4X5tD5zv78DsVwcxcSgB/i9i8VR5CIufR0M4lXFhg81lydNsYmzDaLlxBVaXB1rjXWxOrMDR8p/AvrEX - 1JvbsBAXg/lkFWZjv0bwWAwQlwinSnuaJs9sEsJaBIGvGewb8v5+ywxD0yXQkoQqcw82K3VQ1ndACA2X - bYZi6axahpzGYsoZ+L/XIKDJAqmsS7U7qH9gHMea7BSFn03taGu5gmtN9aB4Dm1WFq8cKUJEXQvc+yJh - f+sdzGlUWMjSYyk1H2zBt7BkZ+Nmvh5ym57B5BNyMGSqpbkVNaXFqJY3necFUOMz2HnOgA9rm8DtDYdt - m2yz8DyeZOgx900BfivNR3dvLySPd4LneGm1X7LVa6L0CEMWi3S18RJu3/kVI7xbkWfloaiox3xWAfh9 - H2NJV4iAugB9ah3sbteUU5JqGZY1LDNWYfKe1NI0XStXNCdKHrCEGK6bTDio1SEhIxcd5y/Cps6DJ+0c - 7lfXgExOgDiFrpX8DbAVLUOILI7jzF5RnHssHzvDCb21F8rwQ4Yag2ZzgzDuXyAcZ1yOXZ+7AfRvydB7 - DEPfk5d5yv3IB5rnwbndkP+p5+Ox6W+GqiqkGDTJEQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAEAElEQVRYR82W226TRxSF9x1XVH2CvkKf - ggeoeuTQ0nImJvSWi0pIVdVn6DsUoqoXCFHRSqhqaTkEAklDSICmwSRgYifkfPhX1xrPNuPf9jgIIbGl - 78b+tdfaa2b+f+ztqg8v1+2j32AfXyG/wz75A/bpVdhnf8P2Xoftu0luwfaPwA7chX0+RsZhX0zADt4n - U7AvH8K+ekSm63Zo5mDsvMOi+I1ZvDbnx4AzF9axu1KFHa6+gglOPvoMr83QCLDnB+CbixvYfWoOdmRu - hyYY+2QdgX9qwJ2nwF2ipmNEv4lxcu95k4nI/fmXDA0XeP9sEUycvUQTgzXY0doOTHDN/1tEQEI3qsDw - E+A2Y70z1zQTjJB7/D8Ik0kyRWHxgObPXSvwXuWliW9/2cQ7p+dhx+b7mOCGm11CQI2HKTwSxUejeJie - BOFE9CF51AD+JT/+VeDd/e0mvrtME183YMcbGRPc7bUVBNR0JE6tJUin7iU8vcD0yLmrBXZ90Gni+1+3 - aGABUa1L8ag11hBQQ488nbosPE0kKma4dI+1fLMFhpjCT1yKn28WuDRa4Mok8Oc0YCcWMwZ4zl+sI6Bm - Lj5REveJgyiRqKi+AJ6QWcFlnIvMrzZ7CjuxlDNwCysbCKhZEE8i19Rp1DJZJWXRp2IZeBZRot7XTi5n - DPANt7aJgBq6+IOSuE/tE5dFa4L76HlkkZN737wBvl7XtxBQQz9eLt4xNZ+ReDdRxS7qZIkGvK+dXMkY - 4Lt9cxsBNc2Jh6n5TBB3USJB0RBxQyt672sDqzkD49jiQ0JN+4lr6lTYRRcii4LTrzJ672sDaxkD/Kpt - FwioaThmXcQ9co86iCeivuOF4tfae18bWM8Y4CfVH1RTP+PacF0nj1OXhSW6xNiXI1r7loFK1sAUCj4k - ZCAV14brJy5hFw3HjpOLDRrwvlbZyBjgZYLPBBSpjpui15HUqVD0HeI+dUlY6y4Uvzaf97XKZsYAbzL+ - oJqn0ftu9w3XVTwV5tRC8Wvz7dAAX9axJJBO79H7hmvFXhLXxH7mFb3YknIsO8UPUs86NBMfawqk05ej - T9e8JR6FgzinFopfm8+rj4HH8bFmvDJQnt6jb4mTdPIwdRQWir/dwHbGwGFegWJpwtbOj2vfNn0SfU9x - Cgvtfq+8gSO8/sSSSEf8mj4a6BZ9WdzPfruBImeAV6BYZQNd4+8xfSreYWAwZ+Aor0CxZMDXPz16afzd - pg/v/EQ4EHuq+hjgDSSWmvbaaD5xK+5EtE1YxH5eNkh61jFeAN5w9THAC8AbrryB4/U67+3Nq7Nur7pA - 6goV4E1Glwl9z/VJ1VdNHxa9WoVeMAEeswDXWusdiMJN6lHtbSiz/wHzStEFcdgTgAAAAABJRU5ErkJg - gg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACgUlEQVQ4T6VST0iacRj2kBASeenSITrU - QciDVIcuER0KIqI/SAT2D/tDZDRptUpDI7cwqLa2DmOwwRijy2CMsTaGQ3Bz+CdERUUDRURFBQ1xozEG - z973W+uj63Z4vvfj/b7ned7f+3skAP4LwmN+HpiZ+YWpqR/QaL5hdPQCw8MF9Pen0dOTQFdXFB0dAbS2 - etHS8gXNzZ/Q0HBK1CsBJh8f/8Tk5CUqlQpKpRLy+TzS6TQSiQSi0SgCgQA8Hg8xHsBms1HdEQXY+ejo - EuPj31Eul1EsFpHL5ZBKpRCPxxGJROD3++F2u4lxn7B3U4DHPjioYGysLLgXCgVkMhkkk0mcn58jFArB - 5/PB5XIR4xBq9Ueq26IAn9lqLdGHokDOZrPX7jx+MBjE2dkZnE4nMfYxMvKBqkkU4IVZLHkMDuYEZybz - 2WOx2LU7j+9wOIixh6GhU6pbogBv22RKo68vJYzNzkwOh8PC2b1er+But9uJsYuBgbdUN0UBvqqNjQTW - 1+OorT1BTc1LVFc/R1XVU/rjMeER4ZBgpSnfkdFrer8jCvA9r6xEoddHsLwcwtJSEAsLPszNeTE9/ZVu - x0HZsFE23lM23qC39xUxb4sCHBKdLoDFRT8RF9DW1gaVSgWlUgmFQoGmpiY0Njaivr4edXV16O4+IeYt - UYATNjvroTS6odVqqfuQwPe9T7AS7sJsNsNoNEIul6Oz8wX1dKIAx3Ni4rMwqkajuSJyWHYJOwQTDAYD - 1tbWIJPJKNbPqEf5/yvA2eYzMtRqNXXvESyEbcIWYROrq6u0Iz2kUina259QTysKCC+CE4NJJsIfIm+b - F8Zn5rHZmckSycRNgX8DJL8Bw72K4H8g8YAAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAAIUlE - QVQoU2PABDwogEwBIIYDSlXABVAAeQLogAMFcHAAAPZhB4mui1CYAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAAIElE - QVQoU2PABDwogH4CQAwHlKqAC6AAiBwK4EABHBwAQvAHiaASmaIAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAAKElE - QVQoU2PABDwogFwBIAEFOFSA5aAAuwqEIXABJECeADrgQAEcHAAH7AehbZbjPQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACLklE - QVQ4T82TX0hTURzHV2B/QCGksIegArEMCveQMmbYQ1gucoTZZD2MGvjiHqa0ae1218Pc5W5Luy4NiuaY - FZWWNlg2UUQcFcZABkUFtlxlw4VOKmva+nbONZfKHoReevie8/t9z+/3OYcfHAmAf9KyxNY+FK7lvZOF - lU1jK/zBdD7VskSudnbOfE0gU2qIbJExa6lH96X+0nqqVEBvOS/0QllzAwVKO/YorDHqC7cCSOcvKhWY - 2/rwIzGPh8NvYRCGsfNQIzbsM65Z9L2BMDjPKHJLraR8BaCh2ZdtbvVDy3ahrPo69iodkKuvoLCq7Y3W - dAd63gtVXQd2KzgCtkB74V52CkCensG0+DEZ/474bBKBF3FozD7kHeGwab9pxHjJS+qAL7PzGApN4aTx - PnIPc9RKAUx1fA818DT0CXbPcxzT3UZOMQvS3EABodcTCL76DN49gkpjF7bKGZx1+FgRYHcNTOsae1Be - 0w5phYD8Mg55pRbkyBj6grCee7BwdoKcHbVh2wEGm4vqUaS6nBAB1msDSCZ/YTz6DY+ffYDFFcSOgxT+ - d1Bn2E58jM4gHImhe3AMOr4f+YqFYUpMwiPMzf0kze/h6AhCc9H/nwFI80YKiExMo+/JOzjvjqLC0I1d - ZFYi4PQ590t1/U2UaFohq2qGTNWE7SVslEAy/wDWEcUU1VfHy3UuFJ9qgfS4DVkFtVMigC6rkdPTK/4N - smeo9O71RFk0T1u8ekHyG2jrt2s5yYVVAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAa0lE - QVQ4T82OUQ7AIAhDuf+l2UA7O4OIH0v2Gj+EtipqSBeD2UbvkIEVMAtmgdav+t3C1YLQWC1Ijb8oSJgK - uIRmCW3L5rlgQ3M8IVMtCChI6shdlB33hDqAY0NE9DKO70MdwLGhgI9+oHoBzyqxa4rWeaEAAAAASUVO - RK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsOAAALDgFAvuFBAAACLUlE - QVQ4T52TvY/ScBjHuVIRKHA9JAgnL+VoC7TX0kLLS6EvFBTa0uj5J7gYF+PsfpOTMrg4ORgHY+LCYJwc - TYyJiYuDLu7GxHgxd/Hnr5fA8TZcrsmnzfN9nufTNPnVBwDw2ZYljGzr3ciyTNu2EC87L75eb+DvD67f - hU9g9vt/HNs5cMaOf9Owohro7YNbe8PhjfuzzBOgkDuabk6bbRXoxuBkNLIeus6yhKyIwY5umo5tHxmG - +Wwu8G5QkIa0jN5gqnR1oOkGuOk6b1x3jHl9uaWGhpb1UtXNY1luPmJ4KbIkmAElAcgD3egfa5oJxq77 - oq3ovKJoE7XbBbwoTWhG2F7cWRJ4dFR1S9fNCvykT41mB9TqjSOxXvtJM9zrYokLrc4vFYtUBcngq9Lf - tqICvlr7RhQr8U1za4FHXZIIurT/mePFf1AEJLkFGJb7uml2LRBrcp4us1+g4KRcYV8lkmkplyenglgH - VIm9tzq/VJRZLpUlih9yBQrAt79Pp3bjkVgM244nsPwe/VQQ6r8pRsgu7pwtC61grkA/T10r/NrnxB8s - V2VmvQiOB0MhLMZVxY/pDPEkU6DnZ2Qu2M0STjJFAIpmAUmXD0NY9PQMzEBRPwJzkiSp71F8J1/ipNMj - f9rE8XggkUgexq9cBXmi+DYYjtCRGL72T+D4jr/RaE+waFgu8c0zgUcmT9UuBS4/9m0hmh9Fo7N8FXih - CIKE5/Vi8yJsDM8P8P0HLGwR4Wl3ICYAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACbElEQVQ4T6WR7UuTYRTGp9ucxdTpU629 - OG3T6TYTtRautPJDSKSWiZSNGL04tSi2MN+yRiYyRi1soCgWiUVhYPYtW28QlB8qSqII0cr1qplBf8DV - uZ85mGNfogt+g/vc57qec+4JAPwXUYv/QvAnQp7+WXuL5xtsJwMosU71LZajK1qA9/KcnwVYnTMorJpc - SFDa9FROIIR8Q7giA3qvz2tpAjg7v2Jn3fRvY+l7cFndXrrKIRL5pnBFBvgGf7o7fD9Q2/rxlaXi7rXU - Te+wKnf0A11tI1TE0ikiAy5emft16vx3VNU+c6sNdcfUG99Anv8Ay7gKJ12zKZbzjSGFB/TdmLfT/mD7 - KzRFW6m0S7nh6aQ8/xGSM7rH6LyZWEnEEEGFB9D+fra/49yn1wVbOprS1ja5FOvujawueIwVppE/onjt - HmrTEXG8gSkUQLtrLwzMgY1/sDmAUts02AOqCl9CnnefAm5Dqj7RS61mIok3MYUCunpmm5nZ3hZYyC12 - O5TZzk5ZeuNpmdbVwBlvjnHGW0jS+SaodeljhgJo76kjZ76g/MDzHjpuJ2qIMqIkMa3VxRmGkawfglhq - rqOaiQg+Jgug/7y6vv0z9h6fgcZwiJkqiR1EHpHJSMkaCsgyr0KqahmhcxHBETF8QNlbO4on9iH7RSlS - xtcj/qEJkjsGxA3qIb6UAXGXFqK2NRA50iBs0EBYr2FjpxNiPoAZuXEzJH4jJMPZiBsgo5eMZ8nYmA7R - UTIdToVwvxrCGhWhZgEWQsEHxD/JgWSUvsiMHh1E7YtfYyYrmapViK1UIraCKCd2K1lAtUAgsPwFMwp2 - 60jAq7gAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAjklEQVQ4T92RUQ2AMAxE6wApSJgUJCAB - SUhAChKQUHrbGjgYH4U/Lnlhd+G6ZRNV/UQzjNAMIzTDCGxEkoGFszSyRB0yIp0x1h9Xo79kEzx1yBT5 - jtjd5Rm+3CFT9IMBuLTNQOCXONcMa+6QOTQYPgRgjSyLOmTuwpHzsc+iDpki7IT3foI7ZIreD4ijsgOj - Td7+jqoH+QAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAAByElE - QVQ4T6WQ3y+CURzG/UfmwoUbc2XjwqW5ztyY2bhgY2a2xoXNbFSThaLIbyYppaRIJSwNw+bHGzK5kKTe - 6nHOy5vOsLEunvc95+x8nuf5ngIAeUn49E4/IFfdugd0qsNoGb5Hw+AdJH23qOkJoaqLQ3k7h9KWG5Q0 - XxM0x0DjAEbtGSitachNKfQbePQuJiGdSaBj8g2tmlc0qWKoH4qhThZFUd0eayBKqg2jbTSMRsVHcnV3 - CJUdNyj7TBVVKHF/GUyu+pDJZLJy+S+Y/ZrzSPgn+TSi8TSmDG4UV9R+GYwvuxlg03fG7Ffsh0gQ+IXA - kWgK2mUXazAyv4WDE05I3vSdw7Z7CsvOsZBM4SWrH7MmL/QkmcJj8w7WQKnfYBLXCSyuaW0KR6I8QpEk - zu+SUM3YWAO51swYmJzBLPwST0G/6gb3xAtw4DoB5ZSVNRjQGOEJXMKyTWpvHcGQW5vAtLZ6wQHVrA1K - vRUKnfm7QW6DRYtfeO3H5xSpzUNNZg5cJeA5i8MejEE2YfrdgNaeozMTmCOwOPMH/Arjfgz0/jcDh/dU - qE1h8bVp8gitTWZW6NaFZHr3RwN68F9lDfLRj4d/FwreAXS1HIGEVowqAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAALElE - QVQoU2NgYODhQSAGEEIGQAE4CwqopAIdQiWgNI3cARJBIKAABwrg4AAAT1sJ4eJBRmkAAAAASUVORK5C - YII= - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAFM0lEQVRYR+2UC0xTVxzGrwgCEtpFqMOh - wMAHWgSk0w00g+E2FeTZ1uGDIVN8bVYnxicKk6nbzEBBFNRZR5bFPSJBUTZBEDczddqqs1CetUB5tVKR - ikDRb/ee3DRxilo3zJLtS365vef8/993bu89h/rvKHq4DyXklVJih2R25AUqejiXDpcnFkzH2HXuoOZy - 86j5HC47+wJEP/m8w9MgxypCWLYfqFg7ObXQ1pWtGEAJeemvJU/ENaxHac9KcmVYnvcWqHjrPLZqgCR0 - jPNc64nfDBvxe98mhCgmYUldEPkdnOkFapFVOls5ABI5+nAWOuvzVGtQgc8QXxuAdxXjCe4HnZhwOVs5 - ABI5cimRg37fpeWowm6kNIUhRDmO4P2DM6jFVioqwaqfj1AgiKPJowR+PuyI+RI7yCXfz0EtciBtT0BE - 1RhC4C+usPrIWk8lWPbjTYdzAgOwOmcFqCm+euoNb/MXIXaQirJmQoWvUdyVAmGNOyH8hhuGJtqADo9j - K/8iNvwnZSbq8R2+LEgCFeClp6ZNePZFiIfFTVjnjRuGI7hmzEa82hMxKjcCL9WODh/czyEkEERwAqfi - tPIANDiOmvtHyTX9VDKsgrwwQzgfMTHLnkjwe9HgxI/EhbbDpH9dkz9i1S4E90wOE/6ELScQrOLPC0Xl - nXycNGzBCs0YyHsOogWnsacwFdyISZDXKPDgwYPHUteqBjfeDccUu0nPLt1sxDc4E6YVOIBaMlhOLR38 - lJNviq/UY34g4qpewRLNCEiaPXC9NxdtOIeMn3fAPpKPH08Xobz8Jioq6lFZ2YCqqkbIbigxfrU/Ms6m - kNqjd1aSfoboKzxYJdiCWmrxjK8xwEs6LskDH7a8TEhsfRWK3qO4hUvYW/QF7EWeyDtTbAqvqdHgnU+E - mLt/Dqn59d4eU+9iFQ9DJJYIov9Z1v0Z9aandHyKK1a18QjrtW5QGo/hNv7AvuI02MeMRn7ZGRIuObAZ - EzdMJnNMDVPL9CxTO8IxeQhSjm2DWPyBmQtgNN1Dyk8dibW6YYSkWy6oNp5EJ6qRXZIB+1g3Es5dNBIN - Bhm092X4tJ1vqudn2yAsLRJKZTVEooXPsQBGM1ylXjudsEH/EiHl9ijU9RWhC43IOZtFh4/ChZvF5D67 - 821T3fQTQzF641gUlZXi4sUrEArff84F0HIJF8B7Fw9bOjiE7R3OUPeVoRs6VLZdJdcT9ySm+ViZHexW - 2iO/sAAlJeegUFQhOnrB8y8gKmoegtZEwTdtGLZ12hE+N4xAY98FGGGArPeQaXx5pS1sPh6E3d9koqio - BGq1Bi0t7WA8WDvzFRkZg9zcb+EvmQm/DA523LUlpHU50SfdEdP9Vp0NRqRaYGn6CpSWnoNWq0dHx11o - NDowHqyd+YqIEEMuL8ehQ7mYIgmGIMsOu7qtH4GfZQH/pKm4fFkOvb6ThHd2dqG+vhWMB2tnvsLDhair - a4ZK1YLCwjPwTwzG5BxrpPdampiRbwGfZF/U1qofCjcY7pFexoO1M19hYVGortbQ77OVfpo2XC2vAH+T - H17/yhJ7+yyw4PwgjNrkAlVTwyPhXV3dpJfxYO3M1+zZEfRerifhjY1aNDXRX79KBf5WH/jsHwSnzVyU - Kc4/Nry7u4f0Mh6snfkKDQ2jt9JNU3hzcztaW/WoqVdj+4mdOH7lVL/hPT1G0st4sHbmKyQkFNev1z0U - rtXehk7Xgfb2O08MNxr7SC/jwdqZr1mzZkEmq/5bMB6snflimv8JWLv/9W8URf0J47GMerb9rPYAAAAA - SUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAjklEQVQ4T82M2w7AIAxC/f+fdrVqAwvN - Lt3DRljCqdB6759awoolrFjCihnckH3j53aCfTODC8UIZuybKTzV5eB44I+iotlQsNWNDQqinLFIqxsb - FJIysvMd+75BwLQH0POS3LBvprBFhcVSYd/MwIRj2/OSCPtmDmJAMRL0fYPC7we/sIQVS1ixhO/d2wE0 - YN1NDoBJDwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADpklEQVRYR82WyU8TYRjG5x8w8ezNq2sy - Mcado0dPnowXUXFPjCaKCyLuy8m/wsTthAsqJN6MMVbWUhFFai2LtIDsdB6f55v5cFpKzZAGfZMnUOh8 - v9/7zjdf6wD4p8l7UVlZyb+Ur0qtt6BAuRPw5tWCAsH/y1KRBZay/k+BZXvfZNyzMbjVzXDPtcI93w73 - QpxJwL3YBbemm/kC91IP3NpeJgn3cgqra9JYcSqVcfYl1wfrF63w3rDMPIEN1THE+hA5j1qBk/U5rKoZ - yDj703+V0M+iAhvPNyMxBHT+BNoGgHamY9BPXOHfFf3fJsE8jnnYfNvD6ac5rKkdyjgHBhaUKCmw6WIr - vg0DXZR4nwI+/AA+ssPWfl+og+mkiKBdzGe+r5t5+M7DyhO+xJlnOayty2acg0NFJUoKbLnUjr4xGIlY - GmgO4JqEJmDABBpwBvjK9GSBB289LN/zR6L6hYd1V0YzzqHheRIlBbbWxjE0AfwYBVoIbyPcdv3Jdiww - oQL3UlRpaPGwo9rDzjoPu+95OHyfk6ifgXNo5ImhhqqkwLbLCYxMAf2cgh257TrcsaDJEeA7k6KshNPK - L6CP0Rr1bbMUGG0y1FCVFNhe14WxaeDneP7IBRdYtybJWLCgAvYrlB4IojWet1Pg8Fg0gR1XujE5C2Qn - 58Nt13ngADhIYUnbaI2GDgmMRxS4+gXTOX+EhXB1bUYdAlug9k0mSJbRGi/jFDgyEVHgWg9mePEvChSD - q+twxxasiQ0zI0G0xqt4jgKT0QQqrvci5/n3UDtd97wQbsCMBRsohUcZiSta43UnBY5ORRVImovHKfCN - Avae58GDMZuOQ2BJK7pWazQagemIAjdS4LWYmPFHn6KAvecaexgeBgs6zmt0naI1GhMSmIkocDM9JxAe - /SAF7NjnwQPopMLdP8X4Ah6cY1EFbvH4Y2kx270dfTF4IXha4QZUNRmB2agCPPpYWrSwe41eGy7cud4X - Bmv3KypfIBdR4DaPP5Y60mGje1/Yvb3n6t7CLXhW0fxZixTg8cfSwuGdX9i9GT3fYwQsnOBcEJUv4EUU - uMPjj2UF5sZPuB45CRTrXp1buBcWOB5ZgA8/a06AcD16eeMP3/uC7gUP+IsUuMuHv0zVlOCCxxFVgM9e - mWpRAk5V9olTNdzEbzIMv0zo81wfqfpU0weLznYdrzrhdMjoOddON+G4NXITgv3sMtSgBLeZY9pfzIsl - KMIr9LOowNIHzm/YldOIIzfhowAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAHEUlEQVRYR61WeVCUdRj+zTjN1KiB4lEO - iUfmWUxaGSBuNdjpXVoZzdiBlGhm2aQgfkanpZmpjU4eCElaxi14oJs5moEIlnJIAq64yAK7XK6yx+/p - fb/9vm2tqEZ4Z5/5/tnf9zzPe/zeT4xdegpR26oJJkRtr0FUoplQi6gddYhKshAaEJXciNlf2zAmocEm - XrkULLoy5idW42w9/hN7TktM2w5MWNNsE1GW4HXitkUEowaFsUH0N3wl+vtpr/5/8WayCReagZNmoKgW - +LWOCC1AKZGWNwAVjcB5KwkokLjrHYnpicDEta22FT3G4vgdo3Bm7nyY3o5FxeRZODFwFL7vPhBbRL+0 - 7aKfQaP493gnpQaWK0DhcSMKU1aiaNdKFDO+VVTiKhtwoQn4/oSE3xyPiBkkImThQUz1H7s+VvTJ2zro - vrbSTTsgz1XAtWYNbKHhOBR0D74RfddqNB3H0l1mNF0j97sTcOqN7jj91q0oXtwThTE3q8QXKTs1LZSR - yxJp+RJZRRI/npNYtnEfxJDpCfSKyP6i27x3Ra/cI7Oj6M81cK1cAecTj+N44AjsFn0WeZg6iNjvanHF - QWnPWIVy5XZUvH8HKhICURLXD69sKkdIbCFC4goRqqGestXaDqTmN0A8vCmSXjGe8CQhcoHwSy6OeRey - 4CScD4fDOWMqcrsH2tJFQMd9sXxPHdpdVOv9a2H6fDjMG+/GpfWjUbVqKPLOtiDtpBUZhVZkarDaATsJ - PlDqgnjdrtc5gHAf4ZmknoMsOH4C7uefhWPGFJwdMw4ZImCa+q9/ivgfLHC6gWrjBli2jENzygTYkkJQ - S0LmbS5HGLlWsdyDCQQWnFfmhph/zbfRuhHu3Sh6lyBnP9xPPAbHtKdw+bHHkS0CFM9f/iFWpDbAJUkA - 1c58vhAWUzEaTEWoryzAkbIWZJ+yYm+RFTkacoutcJCAQ+UkIKb9r53eLUkElMltSXCPGQHH01NRN2UK - ckXvjgUoqY2QJODYeTv25FuRWmBFOqWd0+1LzsQ/V7So6XdRxg6rAhyGZNE3iLrd+K3oY/yOcGTY/ZAL - F8E9fCgcL8zChYhHcUD0rjosehl/JBwV/teXQ0mzgfjxeY7Z22icck41I5wR78GCLeW45iQBdOAwTYKI - cRp2ir7BP90dDqxeB7mEGnDxErgjIuAePBDuscGQL70K+XI0nA89gouDR+KY8L9+KpR0mjWKXyrtSNUa - LktznkvYR873n7biAOEgoaLWDjcJMLKABS4uwS2rhf8P5ybNgJwTqTpnchk4ALJ/X8he/nCGhaFx3Hgm - N3pYfUJJp0Gn+CLXkwHdvepccz/RB1sPmdWSeQS4WQCP2PNbRK+S+smzIR8MuY7cNf5+tEVMwi839an6 - Wfj/fRyVjFZVQEGVHem+7sk5u1ed/2pFHuHQbx5Y2xyaAGkQ0/fOFKEfJvoNey43uccw2COmQgYN8pCP - GoGrM6fhaL+ReGDSzjQxt0oRL5uCNGpPKBltqoB1lAF93Hxrrzs3+KCossUjYKE03LUoH5uPNGJzXjXS - Un7CiQGj4QgOhTtoIBwvRaJ86Ggc/iQZm4/ZsTj9KgYvq6ONav5zoyqZdLVRtNHtxh1+lZqM55xHje8H - 7niuOYNTTz81jOdAAmB4IO40ymhhnaHldYaWWMGXO1HaIxCOeXNxMWwiTkUvRSktNcaHuRLPJLkxJK6R - Nmq9R4SSSVfbDYQu4MH4MzDRruAtqm/TgnlLUULOC8KeUrfp77TUKgmxuyVGLZOYTSLujG+yiWgbiYhu - UkR0syJea1XE61cIdoVuOEXEtBMcBKdC3U5wE6RCaSdAh1+oUqLuB17fvxF5CT3LyG1J5lHvNq2mQTMR - liRK9H7RI+LZZIlhSqtNzUJnYsJ75WimbcpOmZy/IVTHOjFvU8IlylJ+pUQ6fVdkF0sc/V3i1ZR2aK+5 - 8QhPqFC3KRPq5OyaHevEtTRoddTrFgZlizPGZ2IzHJ0XMPH9SrVp+dvBS659Q3iJibCB0EjtxtuUwWeW - Z3aFgA+q1Wlhtzq57pode4mvAk0MKheXjM/EZzk7L8DwkUndDWYi5LR7ydm15paJmbSFwB8zPPJ8ZkU2 - fVN0Ngwf16h3xGVyy1nwOtdda8RMynVn8H3DZ7pIAO0GuheY1Ezuueacdi+55lglpkuOLzreqHxG2Usr - vbNh+ISGn4I7m93zk2vOadfJ9RuWifVblqNrBKyi+5eCXavuidym1byj653B0TUCPqXhp2DX3Hi6e242 - Trvq3Iecdws3IIeylxZaZ8PwKQ0/BXc7p5+f7J4F+LrXyfXFxqHkdIWAz2j2KLjpuAx/TT/X3eteI+et - ytE1AlbT7N1gKDm0UTsbQ+KabUrWNShZ7VCyHRqcBBfVmOH2gVRdewAY1gF/AFq0VsLCAPNKAAAAAElF - TkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAAIklE - QVQoU2PgQQMwAbgEjQQYUABRWlBpSgTggIEDBXBwAACu1wqJ0sr/ugAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABMElEQVQ4T6WQvUsCARjG7y9pa4i2hlpz - y0iN7PIUT/Pj8k5NvcM+bOtjqqWxKBCDIhpqLAhqcAoiaBGXw5YWsS1o/NXhcgdndMmPBx6e4eF5XwEY - Sq6hF7mGXuQaepFr6EWuoRcJeb2GWq6RK22SLa6TLqyRUqskcgbxrE40XSayXGIxUWQhXmA+phGQVOYi - Ofyi8tMyJDb7PwS10p+vrG6QseZrVZKqgawYxDIVllIGYrJEWLbm5wlG+/NnxRX84ay9y0nt5A1pq0nI - uLfeNRCbdbJ30aXx8IVPufFWMJ2+Qjt4xSo4vv0koN8xJV8yOnPoWmSzfVpmj7HQKbsNk+3zLtJOmwmx - zkvr/W8FFu3OB5OxM/xGk/HgEY9P5sAzbNZJu9NjxLdP/fr5lx8gfAPOtXjW7jTlPgAAAABJRU5ErkJg - gg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAAB3ElE - QVQ4T6XSX0hTURzA8UXP0lsP9WCPkqv0QaKQKKK0DEmol6IwbDmR1TbDJVo2V9NCDTKICMoigtaIbCTD - JBvOBTaG89+tzD9NFwqaKM6E2f12kuHdTYhLPXzO73c48H06OuC/rBxSoIk/9ftvE+5spOddI6G3DXS/ - qcfncdLmcuB9Zl+hChD/LNag4NekylQgZiIw2NVEPPZerC7NKk1HxUwEAq9rWZp9JdZ7mlWU5ouZCHS2 - XONH9CHEbmlmKzmiBHwvHcyN1LM861zF97q/shnzlEDHCzvT4XKYrNHMVnxYCbQ9t/O1vYDF8QqYqFZE - hW9J9yTlhkNKwCsCXzzZRH17GPHuYsiznVDzRhb6DMjjVyByeY2LhtykgMvOVNdxBpvXMx/UM+1PI3RX - R6Q9B3msEoYvrWEtylEHYiEjQ+6tSE83IIezWAqkEX6wmfinMpAsglXFXHggKSC+pdxvkheDhYy1ZPDh - TgqR+zqGhVF3OrJkhr4LMCBmwvlT+9WB5d6Sn78f4j1Goq27+fh4CwNPNtHdsA7pUSoT7mxmWvOY7zjG - nFB6Yp86UGPJxWE5SK11LzfNO7lhysRZrOf6uXQcZ/VcLdJTdWYbttM7KDuZgUVYDfw7dL8ANy8V6Hlx - kDwAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAIElEQVQoU2P4//8/QcxQUFDwHx8GK0LW - gQsPZ5P+MwAAVKncTluNXg0AAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAD1klE - QVQ4T2WPf0zUdRjHP8cdk7uD434KUqAQUUwGRgFDLa0DzkPvF8ehMMCEQStEfgsVRBPIIeCBeCA7QMAD - 5JAKkR9HkLsEYzmMoZwBJrZRGpbMk4wbwrvvbOufnu3Z8897r+f1Jp9Lt5EGlYiMJtgH1MhdG9ujOQvt - audlvZJ/T3dAVFoQ7s08pxCSTrUT0SsEpE4mIiX7PEiO2Ifkhb1KyGdST3JG4fpKXxxz7ryah+F4e1yO - ZaI92hnaA66gQrp6hZBDAVwogMv/AFSI6OSiQoOGgzYVE0YVDR1qJhpUAlTJ3FAi9VjXKwXmLo3jZJOS - P3lOLqwvkXh4/gdoljnSW2TsprNSDhpTd6M7Rwz9IU9QVuiIcUYzZXXpEBtX4hxwkXrSqOCjWLLNlBfm - LcgP9yKkIZJD10WwdOURIlh6ymBbMONPyyhudpah8yAPhigHdEfZoSeajvNKNqoiRSgUu+H4u+5Zn0i8 - CTHF04lBwUhuSQnZWDZXwzZvAlYWMNdbAb2EgdMqLxiO7qastqJ2PxfVkc6oUnqgXLNjtEIT4kjGjxDS - e5DuPlQsu2MdOQHreB3W7g5hujUPX+xi4KuiKDy7M4DF742YH6rH/MBZLE50Yapb+4cufs92cipiKynZ - 60H0ie+cfGjMgtX0Kf6+XoOfO3OglbvDciEbz+f7sfZwChuP57GxfBdYtuDBVf1ae4o4gnDj7AgvhkEP - 2MdO12WKbb+2pWH5y6N4YEzDwMdKPPo6H9Zr1bBOd+OvWdOLtVl6sNB7csWQvDeQcGMJi5tqVxFkZK9q - jDzUlqkwUpGJ71pKcan1I8y1JeLZcCEeXy3Hk3EdBavB+o91+KHhmLkpcSeH8BNoyYGdLyF26XXEPhKh - YFYGy+x9LFlXkD2ajswjwfitNRkrV6h6fblYMeXjZvNxmzo0Qf6mZzIhLlks446JQLw98wbeu/0apAs+ - +HZjAP3Dv8BPbUBYaj9KszMwWBoNszYJYx2V+CC39zmNr71ASLErEX646YTbRT94XQuF7/Vg+E35YeeA - BP6RlyErWkVKC5DR+ATfmG9g9qcZDE3bcLgR2JOzCObmylYiSCBCfjqrkFfmNiKs9Zp0aXr5lkOS+Hff - 6PuQVQHKSkBO3bYJvJjaEUBcCkhPAVtCB58Swfs0IkhhEF4s2eR8jM3nFjm4Md5Salz8Z9f9k4CQDCAo - GwgvBgZvAQmnge0pgG/MKpy8uu79C0i1J7zDdoSb60S4+a6E5lhAaCxtGsu9b4zvd2Npc9Dtp6LgGWvA - fot1S9C0leMzNmcvbGsnzOJd/wDgshVOQ4R9KQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAADwklE - QVRIS5WWS0hUURjHx+f4xJFw8rHKrFDRgRYW4jMfBbooeyyEjAq0cCu4UZMWKYSSKFEjPkqSMfMBIQxk - akyUUJvsZa1bBO3aSeK//3fnzu3OnXPVDvxmzv3Od77/nO9859xxsCGE0+mEy+VCWloakpKSDLsQExOD - 9PR0pKamRiB2s68NwU5ycjK6urowNzeHqakpNDc3Iy4uThsrKChAR0cHVlZWsLCwgMXFxTCWl5eRn5+P - 6upqJCQkmIObcSAzMxPDw8Pwer2YmZlBUVER+vv7UVhYiLq6OqyurmJpaQnz8/OakODz+TA+Po7JyUmN - 2dlZ+P1+DAwMqESEYCc+Pl77zs3NRV9fH7q7u1FTU6OlMzY21jxBo76+HoFAQMuACE1MTGjC8mPGxsYi - /B1ZWVkwNzGOjIwYDltbW/pIeJOVh3xkNdPT00ExWd3TpxhlhkLjGm63W58abGLs7OzUn/bXiouLMTg4 - iNlnz/CYqxoeGsLrqiqsSSZSUtRCvb29eu//WlNTE2739MD75An8LApGx3emvuzwYbWQqnk8Hm2/hMrK - SrS0tOgj/9r29jYu3LiB+ywgEVk/cQLvz5zBSZb/nkKNjY2Ijo4OOiqQKjW330xZHu1D169rqXtdXg5f - WxsSJX12Qq2trcrgVh48fBicwEqlQUPsn3gs1ii2WVuLdNkrq9DOzo4m0sXyLikpMQLuxui9e4aIILa3 - V6/iVUUFPvIYuOTgq1Ykjgss32OhjdwH/DDwkbLjx/H+1Cl7IffBg+jharyPHiHr6FEj0F60EHYMongV - bVDEVkgmPWeJfqXITfatAe2oIuwYxLMAPnCfPnGPbIX8vFBfML/Iy0MKn61BVdQSdsKFmLp3ly7BlZio - FvpMB6mYjYYGOHYpbzNWISffBl8Zp620FA5V1cmkTV1omSd8k8/WoCo8hB0DXqL4wXN4RfqCSmisvR1v - eQOskXWKBc6dw8XTpxETmmQhmrBjsE6OkFvE8FMJVfDa6L98GW945YhYgLyR++vQIZzl29fDt3ABf3EZ - ++LfSEQghNja9W8Dq1AsjeJcTruIbfC+eiGrYypfsoJkhV+Y2m9klGJndX8zSSRMRFCtiB/4RTw8Uwf4 - f+AXA0phfGT6ZIOHeHkmcvw8+an7h+gjESKCnZCwTQLiJEj1CVFRcPNcyPgfEvIV7pKw4GZ2E/of7pCI - 4GZUQrIKdvaNbbrM5OTk6BLBJsYEIvVfT2hQ8pk0kGskIqgaB7Kzs5GRkQERtQzCrZNhIpMoK8sWB/4C - O706Ewj1hikAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA7ElEQVQoU2Oora39X1VV9b+0tPR/QUHB - /6ysrP/Jycn/Y2Nj/wMBAwgzgBT8+v0XA4eFhSEUgUwACf789ef/1OVr/9csa/9funjV/6C6Kf+3Hj4N - VsgAsgKkaOGa3f+jFjn9bz8w73/zyXv/a66/+Z81dxFEEcgN1+6+/u+elvPfrbniv9+8c/9Lbr79n378 - +f/8lfMhimCOlDVI/68XV/nfrm7Ff9epJ//bdB3971bRDVEEIkC4qXvDfwWfxP9OU03/u3bG/lfybPov - b1iHqgiEy5sX/bcpifxvXuDz3yWs5f+0eTsxFWHH/xkAzy3fX10qf9AAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAB3UlE - QVQ4T5WSS0sbYRSGx0uURLG/INtoF1XEVdS6VcSNTU3UhrS1BEUcdyqushDrRnChdFSoRRRaBNOSKCJI - Q42lKa2gGzUtulATIzFJSRNzldfzpaaMcbwtnmHO+7xn5oMZDoAkji/DWVJ5JleC3OzcIBEjqjNyloXE - GePSQIUwkchcFvlTIiDOxPLwYrlUXBBDro6IEsF0lhYRIk7MEw/SUgry1UTqpGxOh+zNT8TFm6Cuhoiz - ezaEMwt3hXZD7BLNy5HtKeSKqE5v8D43tnuKVapteb78Mzkn8UOWI/MplUqXuupxsLa+wV9RUf6T8iUi - xhk7eAjvZrCyuoYj7wn2PV7Mmi3o7ulnpbC6sgbTc+Yrvq2ja7OwoKibs63ZsWxbpRMBiSTwN3IGtz+J - 0ak5FCgK/U+btNf6lpftQ9ybqWm4jr3/pedPAk5XHFb7Dh6VlvnoyNf6Zr1+lxsRJnF47PsnA0mSMTic - EUzMO1Bc8jBgeGXE1u89Sa/Rane5j1YrLMs2HAXoye44vv2KYHE9BL7PBLW60jIw+BrvzVZJ39zaKnBu - 1wFGRsfw9sMCPtm3MW52gO81QdfSlCrd5lPf8+v3DQiTAjp5HoYXbXima0xJ5m7zl36M+wPuHCV2n+NK - KEULAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAB60lEQVQ4T2P4//8/A7Egzdg4P93EqD7L - 3JAfxAfrJdaAUieD+fc2aPw/srzw/9SCyPdF9rryRBtQ7aWf/2ibwv+SdL3/gd72/+dMKPnfm+C2nigD - gM6OPzpL7X9LmcF/W1vb/8lx1v+fnjX/35dkeJ+gAUDN+kfnaPxfPUP/v6Oj4/8Af+f/F/fp/F/eqvK+ - 1ktDH68BIM2LK3Tf71xm8N/Nze1/SLD7/4uH9P+v7lP5X+et7g9Sg9MAoGb+5XW69+8e1/0fFuLx38/P - 7/+mFRb/N8wEa46HKsNuAEhzZ6zh+SsHDP9HRfr+DwwM/L95qcX/TdMV/jcFq/ZDlYEBVgN6Eg33v7qm - /78wz+u/p6fn/4ZCk/+7p0n8bwpUnQ9VAgcYBpS5Gc1/c1Xvf3qKw38LC4v/pfGq/7e2Cf5vCVE4D1WC - AlAMAKaw+EeHXf7XFGj/V1VV/e9oJP5/SxXn/5Yg+fONfmrglIcOUAyYlJu5ftWcwv9CQkL/jRTZ/69M - Z/7f7Cf+HpdmEIAbkGtlwL9vxZL/P99d+Z8aavl/ZgTD/0YfEZBmfaharABuQL6NXn5afOz/m6dX/V/S - nf6/MVTvPiHNIAA3INPN8ry3vcX/bFed+8jxTAjADShz1s6vdNMiWiMM/P//nwEAu7kjYWz+cKoAAAAA - SUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAAB5ElE - QVQ4T2P4//8/RRjOWHXoq9TKg1+nLD/49ci83V8f9az/klK58AsnsmJsGEyANAPxp7k7vz6uX/LlTuOK - L49bV325U7Hoy+fKRV9S0TUhYzAB1Hxz5vavb9wrH7w3T9jy3Spl2x+H3ONfUyZ/flE458uLwrlfwkDq - lp34auBQdA3IRDNg6YGv98M63v00i57/2yVv/U3T2DXHgPiLWfzm38mTP/9Nn/n5WfbcL5HzDny9ap15 - /D/QQrjXwETD0i97XMvvvFf36rkVULtdBSRmGrsy3zh6+VedgNm/Qjs/Pge65H/WrM//TeK3AqXRXNCw - 8ssh1/J7r9Q8+w4rONQxwyRNYlY4anhPWl02583/6N7P/72b3vzXC10MlEIzoHnlly3e9S++anhPvgk0 - gBUmOWXrV10gBtvs2fTqv1nx/f8aPlOBUmgGFEx/XBrY+uavUeSaX0ADuGGSoACzAvrZJH7bf72QJWDN - qm5dQCk0A3o3fGVLm/z+n2vZ7T/qXpPckRUgBxg2DGeE1Z3PDen48M8iZd9FZAWEMJyhFTCb0b/62kv/ - lg9/HfIvxMT1vVdCVogLo3CAhvD5VN48FdD6+atH9WNnZDlcGKugd8Or0Kjez5HY5NAxVkFSMFZB4vF/ - BgCu1sRwcCvT7QAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAoElEQVQ4T6WS0Q2DMAxE+e5PR2AERugI - FRMwSmdhEkbpKMYPTIXjYhQ46TAk8ssZaETklv8u1ni9HOtl1akG8LHqlAE69WQedvfOh4BHP77VT3tE - jBCcASb1F5AtsRkcANYohRmhPH1JFwCbtOksAZAUcPYO8gSq8iuwGZwBOGE7rbUK1CkD0MTPg2mmksQp - A5T6zb1XDYAEpHIKgOuWZgYwUWWjtqpGsgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsOAAALDgFAvuFBAAACMElE - QVQ4T6WS30uTURjHdx/+AeE/MBR2M3aZV90IXSx0Gl0YkRdFQoFdOMYu6iJsIghpKXNmmzPz53I618YY - U5zODMyKsjZ1plPX+5Y5WsrmPvm+rz9KEiEf+HIe+J7z4TnnfFWOwUmcQ1N0Dr+S1w53BMfgBE9dYZ70 - j2HrDWHtDtLSFeBxp5+mjpc0Orw8tI/IkgGZXIbU1o6slY0sc2tZuoNx7jZ7/vKO+rria6icQxHZGJ3+ - LGs4HJNNSdV1rgMvOBXFPxnDE57nxdgCfaFFBSBNUNPgOVB1nZtb913cuNdHpfk5V4xOLt+xU3a7jYs3 - W7lwvYXiykecv9qoANoHxjmpcjnI7uTY2s6SSmf4vrnN+rdfCqC1J7S37bBEUaS+vp6KigoMBgOODidf - xU2EjS2+rP/k09IPfONzCqD5WYB4PI7FYiGVSsmAaDRKMplEEATyz+ZTXn6JWHyVlaRy2Gw20+9/owCk - bzEajej1ejQaDQUFBaTTaXw+H7W1D8g7k0dpqYEP0QQmk4mqqiq0Wi2FhYUKQPrL5eVl+WAsFpMnsNls - lJSUsJYUFYChjI8LAu/nN4i8W0OtVu9mZuYQcLSsVitFRUXUGE3odDrO7fYNTW28nhMZn00SmF7FPrh3 - hX1AIpGQJQgii4tL9PQO4HJ78QfDuL2jjAQiTMzE6fK+xeGexeb6Y4JT5UACHBdlKYknRlkCSMa/oixN - sO8dG2UJIDX/K9Xu+51CqH4DsLwA5JN+awcAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACfElEQVQ4T6WTX0hTURzHz3M99Bq9FBh7 - GWj01kv3pcQk8iFbe1JJ1PIPEvVQLbtgidGIstJAS5MohmJbRgmrdiOTtrulFOruXercpi7/3Dk3nZrb - vp1zN/tDqx76wQcunPP9cM7v/C4B8F9kLu1YQVX9lPe80YcK3oOjRQMC2dKRk179R+39wt3ujmJ2GYiu - p/gQBPJ0Ni/Jc3CkxPt3UbY+ZLbIgLQAeMMphueAxudLyC15Bm1DBKR0pji9/fcqPBcRbonAWz8wQiXD - lDc+oMUFHC7shPZCEnuMqyDlSmbJwaqwuW0QeDkBOGYA+zRgpd/80yXoix9i67GkKtFeXQM5Gfn1OmcP - aGrzjxiF061R3BsC+sZStFIhpxfQ0toNz6SCqYUYXozEQU6tcOkoIXV5uzv6L2aj61EvispM0NcFcKYz - jNKmIHKL3oG/8hiOQTcm/ApmQzFY3VRQuZoSsLDr5n4o/ZVw917CA4MOJssrXL5uw7WmPvRYrHAOyWrY - G1AwvxjDaylBBesc4fOzeBYOi9UYbszCHd0umNrvwjXqx2d63HGfogYnadBH8U8pCIVjsMlUULXBkfs1 - +4TNcLt++2JWrsHs8/sxHQHm6CxEPopY62nG+pNmfKVsmCmjImyeJEh1nCOGQ5qCrlrtYtvxHd76Ak0O - ORHg6YgiGAUWVoDlT6IaZsE4JWGhuEUIqiDxo4nfqzSoCkbG59FvlzDgkPBelOCgiE4JTook+VKCmmQG - QdmcKvBMzsPOgjSwGXS6JLgosswE9E+qQQZBeYgX5A0IcjxNgm5mJH8CuCH8SVAR3kkqIpw6JOyd2VOx - brOGsTuzY7OgCrZ9A65yR46fY0uJAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAC40lEQVQ4T32TXUjTURjGj5KSmmCBFwZd - JJmkF0ZYF134RRcRfVFhmtpSMnXiRYYgRRr4kQszwmCmtUxzijYnw21qa2up+RWN5Zo4l8zmX6f5sa0m - qdXT+W9qLqQXfrycj+fhPe85hwBw49/gcPoiEhN77vB4hn1rU+7xP4OMjKEEkWjaPD6+tNzYyJizsgYS - 6LSHa3Ut1oUaswOtOhsKuhdRMWCFctQOufzrQm/vIvr7rWBzR8fs99LSEWlsrCRiTe4ySK1UqDr0VjDW - FUzZVpxZP72EIhmDtrYZN8Riy2penkZBpdsotBruUHRNzwxGLD9gXfqFYcYBtcG+QU6zCVVVJvD5Jjx6 - NA6Nxo7iYp2Bine5TNLV4iK5Fowd6B6z4Wn35AbXnn+Cb7YauikHysuNkEpnacFAWdmwkYqDKb6EpL1C - IFeMu10zeKC04BivD3uvy7D9SitI0ksnzYOTqK+fhMWyjMFBG1JSVJ+p+ADFn5DLkkVyQYDQGzIIdYDg - wzLYMUtYvgL+VyUQ9k1CoZhDTc0EurrmkJ8/xBqEuQwutYi9z/ORI7GD9w643w8EJAtwolKPwNQXIPF1 - UOpnnT1oaGAwOupAVlbPJgPaRD9OE5LagPR2IFPqyuz4KH8eF6u0KCzUo7p6Amr1Anu14HDe/DVgr/FM - Wacq+LYGIbkyHCrRIvKeAaE8BtHlWqfw1i0dhELG2USDwYGioo+Mm8FjUadK88WOgqb34FapkMlXQfB2 - AkrFPJqapmjXDc4jDA9/g822irg4oZKKwzcMNhMd3ZItEplN48YlSNpnUCswo7BAj+aWKYyNOX5GRdW/ - 9vQ8mOZWwWZo+MXHP+PySrUj/EETKmqNKCkdhUw2+zMmpk5GSMA5uucIhX0HPlsZeFOCwsNyk0/dbOt7 - KP2Mikrj78ORT+SE7DhL11jxforrJW5h4EnxoQTt2X067vjJZnlISHkrIV7rYvZb76R4EUI8/gC/sjoq - XodZvwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAsElEQVQ4T6WRUQ0CMRBEzwESkIAEJCAB - CUhAAhKQgAQkIAEJJ6HM23YvJZkPNkzysnOz3fZ6t7TW/sKGFWxYwYYVbFhh1k6cug3hz+Ii6CHqUZBT - v0Tw6jbE81WwEZXhh0iRhfYiF7OAE3mm3gecSB9PD9iY2Why8nPUdfLv4bns3EuYDW1GYijvehMHkVdj - KN9w+165mNdJzxDgYVb2utyvqWDDCjasYMMKNvydtnwAhcr9x8xz4o0AAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAtklEQVQoU32OwQqCUBBF5+NcuFBxIehG - EEEEFyKKIIjgp/kxQQuhggqhklt34j1o08Bl4M55hyfTNGEcRwzDgMdztynLEnmeI01TCAHO9trRNI0F - jqcrDusZSZJAaFiWBfM843TbdK+Xu272URRB+r63Jh5MODSFYQhp2/avyfM8SF3X+oomQl3XKWT+5Lou - pKoqFEWBLMt+IN/3FXAcB/KRCLVMHMcKETAd7wqZsAyCwB6/gbwBsXzsYuIJ71QAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABlElEQVQ4T2P4//8/RRirICkYqyApGM6o - 6n6eUD/hZVr9hBdptX0v0iq7nqcVtz1Ly2l4mpZU/jgtJPthmlP03TQ9r1tpynYX0mQsTrKhGJBY/vhH - Qunj/3HFj/5HF9z7H55z439Q+pX/nvEX/tuHnvlv7H3kv7rdrv9Sxpv+i+mt+Cmmt5QTxQByMYaAX+qD - BK+k+2mucffSbMPvppn4307TdLuZJmt9PU3a/EQaunoUDgi7xN77YR9x979F8J3/Bt63/qs53/wva331 - v7T58f+SRtuBSlDVo3DIwXCGWeDtBGO/22n6wFBWd76ZJm97HRjS59KkTA+lSRhtSRPXW54mqj07TURj - ChBPTBPRnIIaCxouN38oO9wAOvf6fxmLM/+lTA/8B2r8L6638r+o9tz/QE3/hVQ7/gupNANxy09htS4a - xYKE4ZYEMb1laaJaM9OE1XvTgDamCShVpQkolKTxy+cTjgWg5h8iWjP+C6t1/xdUrv8voFj+n1++4D+/ - XM5/PtksoBJU9SgccjBWQeLxfwYA7nCdCEkSeMkAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAD/ElEQVRYR8WWy25URxCG6wHyBtnlBfIQ - eYEkXMx9uBgb27GSBWKTRUuIjVcIRVmwiryJhEQSlF2kgMVNCEScgOMYG2xswDBgGI8vM+Prqfx/ne7D - zDkdSxNFk5Y+9fQ/qvqruvvMGVHV/5Wo2EmiYieJi7uulmT3iJM9N5zsve2k646Tffec7L/v5MDvTg4+ - cHJoDIw7OfzIyZEpJ6UnTo7OgFknx559KZER9YqKu67pxRuLoKoXb5IlsJxya8WzmnK75qmDhp79paGf - XFhUOT7/nffNRtQrKu6+rn8uaMbQ0FDLeid+GFP9dFh18HJNpbvcUkTUKyruuaXTi2qMvkoLePBadewN - TMBfMJp4q/oITIKpd6qPSQUFjCb6sUv0MxTx1Y8NlZMLWRFRr6i4946+WFbjt5e+gHJawDiYQAHB+AmY - hvEMQcGX7yX6Ye/7Ik5fWVPpqVgRUa+o2HXXTP8N3/40px90vS/icxRx5ud1ld6l81GvqLjvvi421HiI - rWfi0DW32jpGt7Ngrqr6bEn1OeCO3Z1O9Mxwol9/n+i5K4l+M5LopYdIegpf5nxIQTBx/6iurKvBLWcB - zeZPc8bzyP0SvFpJKQPGvF5NcxA5hUXOhxQEEw/8ofUNNdg5k/Gsec6h69BxMC4jPw3fgIVaGsM55JE+ - LHI+pCCYeHBM17bUYOdMZlvOrsEL33WLMfK/JXXVd4AxFcwhj/RhkfMhBcHEQ+O6sa0Gt53JzJxdg9B1 - szFNScXfHcZUMYc80o9FzocUBBMPT+gmggjPnMlC5zTnGdOcW8yO2Wm4tNU11SXAmGXMIY/0Y5HzIQXB - xCOTup2owQvHZDHz5o6D8bK/dIxZxRzySD8WOR9SEEwsPc4CeeGYLJx53pzbbMaAxjSt4dIxhnNWwAAW - OR9SEEwsTWuCIMJzZ7KdzJuNSX0zjWlgDnnaK+DoU0WMwceNyXjb7cLtYM7HjaaEMbz9IY8MQMz5kIJg - 4rE5TOngs85k7D7cdp55wdwb03QdMGYDcxjyhS2KXlHx+HNM6eDFYzJ2n229P/N/MqcxY3j7w2izgHlM - 6eDZM1k4++bum7c9M/ePHWO2WgqwRdErKp7AO9iPUEB29uy+aetj5jRmDG9/GO0V0F22BP8lH52eReqI - V1TsxivQD95+JohuP7sHLd2ja3bOGD5+YcigLYpeUfEkXoF+8GeWycIPTTj3zBiEbQ/mNLYCfA6O9gro - wRuoaTBZuyMfI4PplKcgmNhT0ZHJTc+WDv86Y3PKdspUIIkyfHXOf1ajvQJ6qyX8h3P4GwVWnPStgpqT - /jpogDUnA+tgA2w6POOebU/isOUeDZSiXjGxk0TFThIVO4fK35ugnHM+1fdaAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABiElEQVQ4T2P4//8/RRirICkYqyApGEwE - pF5lC8+5nRZX8igtq/ZJWmHLs7SStudA/AzMzmt8mpZZ+zQtqfxxWnTho7TA9AcJKAZ4xBzk9E04+DM4 - 7ej/sMyT/yNyzv0Pz770Pzjj8n//lCv/3eOu/LcLv/HfLPD2fwPvW/91PG7+QDGAEoxV0CvpfppHwv00 - p+h7adahd9IMfW+nabjcTJO1vp4mbX4iTdJ4N6oX0LFD5N3/QI3/TQNu/9f1vPVf2eHGfxmry/+lzI78 - lzTa9l9cfzWVvWDke5sNiNMMfG6l6XndStN0vZmm5HAjTdbqCtDJJ9MkTfamSRhuTBPTXZImqjUrTURj - MqoX1J1vcqo43vipaH/jv6z1tf8yluf/S5sd/S9pvOu/hMH6/2K6S/+Las/+L6Ix8b+wWud/IdVWGscC - CIvqzE8T0ZyaJqzWnSak0pwmqFSTJqBYniagUALC+GMBhEU0pwCd2vlfULnuP1Djf375ov/8cnlAnAtk - F9DBC8Th/wwAKVac2Su+H1MAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACYUlEQVQ4T6WTSUxTQRjHOb73ujxaSi20 - tCylWllqQMEUq+KCURT0IlE5KAc1Xjh6MLEeLDW4k6iJETfQqKDFSEBKsNUqikvwoLGS4lPURFO1MRGi - qPk7MxXSFg9GJ/leJt+87zff8p8kAP9l0Q9Z23nOROzgboHzTZhLxvsaiLlifDt47hT5bwGNmQQQh+gU - uEizgsNpJY9zagUup6fgmkmHzkwdOjK0uKhNxllRYOcNAgcKiQXUHyfBZ8hhu06NHksGAjYLBubk4X5J - PvqLrfDlZTNgq1rOIDt5zhMLcFJnm06FPmsWpP1uBKuWILTcgeEV8zFUUYbXhxpxzzEbnVlpaEmWgZYT - B2hVyXE914BnWzcSF/DtRQjhuhqE11Vh1OdlvjeH9+JWYS4rbwrg0jQVbhaY8aS8BB+bGlnAj1cSxm/7 - 2X7M34sQyeZBaQG6stPhlgvxAI8hFf1FM/C8wo53aysxduIIC6Tr+x0/PtWuwUj1YgzOK0LvdCP2KGXx - gA4GsGJoWRne11RiPEDPo+vnyEtENtcywGMHBZimAtpI92l9TxeV4ktfDwuk6X89eSy6l4Yhkcwezi1E - t1kPtyKhBDp7r8VImriJBYze8CK8vhofNqzG56MHmO9t0z4EZlngMWjgkiU0kY6Rdtefn4PgtjoEl9oh - rVwIaVV5dJz1W3C3eCa6cvRMC4lTiAqJKO2KXkO0kMnEQ9N9ZLdhgIiJlke7f16j/KOQxF0CNzihxgup - Iq4atey2brOBiac9LQUtRCvNCh5uGRchMbZJwO/HJNJMiDn/wkxxj+nfDUm/ANUSPxfO1ir7AAAAAElF - TkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAwklEQVQ4T2P4//8/RRjOmL797YSAigtA - JqYifBjOCGh48D+g4ACQiSQJlCaIkTU4JGz4Xzr3+TZkMUIYznDIOPDfIWLCf4OACUAupkJcGKsgKRjO - iO16dB8UiNGNpAUkCid14pPzDgkLgEyoJCiQCGEUzRkb/oNcAhMjBsMZoCh0iFgADMQGIBdTIS6MVZAU - DGeAAhCEQd6AiRGDUTggA5DDACPAsGGYYlBeKJxwkfyEBAvEiLaHr5AVEMJYBYnH/xkAN8i32m/jOaAA - AAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACZUlE - QVQ4T6WQS0wTURiF2bpjYWKiGxcu1GhMfAQlSASNxUek4oIQGjQ2YqOhKqXWgRbaDmUKSmm10KaDfSBG - qhjBKD4xdmMEDS9TbEGjRSVQVKAqRJQ5zq0ZQ203xsU3yf/POd+9M0kA/ouES0L3k4drXKxB0swaQSnl - K+923EhOlItbEGorVdu9LgZ8mfv2lubcDfQbr5tBu5el/s7GDAKXHAw3E6KJAAib4bHTmA0ZonNfV2fq - wmxMUcBl1X3lxuv4AvNbUK8HmZvsVbDXquFhTdlCNq5MaLSU8wUTmmw6YNwMp0UDjhe56nXgPwm2WqpT - yMaVCWZ9UfRE53kK3JgZ9poSzPNCW7UScyNGGFSHg0I2+uDNGqdVB8Kdm56zjPIgXzTBUXcKc+9q0GCQ - Ye59Nc6VHsFMqBLF0n2DfwT8j1nUZDdg6hXNv6Rx1amFWibGz9Ea3G85iUhQA19rEb68rkDLhUJEAmU4 - nr9zIOYGvERfnL8NE4NaTA+rYdOKMTvCYHJYj6khNSYDFD4HlJgKUhjtOQZpTtqzGAHhMlutjEoGFAj3 - yjH5UovIkB7TgQp89JdhrF+FsZ4TCN7LhWRPii9OQGAtmitE8qFLhtFuOcJ86ZO/FBMvzmDkaSH6rovw - +GI6l7d746OEglavOVl1SEQTSf+tA+htE3P+jhxuoG0vnnsz0dWcBqM87buiQGRLKCC4q3SLNbL9FURy - zbSDe+DI4HzOdNy2bp6npBt+7Nq6GqcLspYK+TgBofyoaEW5PFchyU5t37J22eymVUuQmbJ8UJK1vrEk - L2PdwmxM8d9B0i+k/s5JFmy4DAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACRElE - QVQ4T6WTXUiTcRSHdxkRRBdB0IUREV1ETSKIwoyQAsmV5IUhfaBUoJSUWJbLxAVZWixBRUcrNT8qM1PL - hpmoKGkf2pzOpLlAi9QtndKHzfm084a9uzCKujjv1Z7n/M85v2mA/yrlk3eng8DKKWsn62YLFwob0ec8 - JimrhnhDJbGp5cQkFxOVaGZPgsmPBgi8M/y2Pn8D99Qsw+5ZBj746HL6WLMz/e8ELpsd+6FgbAe1WNts - ClxSP8jqHef/LJDOAjNsYfrpSZ7vXUGr3ceN2jesCgsQyMzzwfJs2wHtTzg7jPbIICzdMxTes7Jye5oq - kIXNB8vM8mzpLPD9B6+p7pwht7yToG3nVIFsew7uHxzhRIZJqY6+T8rM8mzpLHBFmxdjUQvLQ/SqQE4l - sGPIrYCO4XGsA2NsjYjDVPWK0N2HlSqo7qe42Uu2qYFlW1JVgdx5Dn4/6mHo4xee9biosPQSHh1PzZMu - 6pt7/L/WUPDIxcW8OpZuOqsKJCQCj7gm8UxNY3VMYK55y+0GJ/n+eXUxxyi624Txeq0iMVyrYsnGM6pA - Evbd62PMM02fc5KShw6ulvaSaX5JlrmdREM52tAoEvU5xKdcUSSLN6SoAonn6PhXXvS5qGx89wtOz20m - +XItCWmlRMYaFEn4vuOE6uJYFHxaFUi27c4Jyuq6ychvRW9sIDmz2g/eIjYpn+ijl9Dt1xOy6whrN0co - tXB9gED+GJJtiackTEIid5ZTybZlYTKzPFs6C7xg3SlV8O+F5gdwpvLxKZ4mxAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA9UlEQVQ4T63TsWrCQBzH8UBp6NwlJHuG - vkFfoGCF6tSl0KES0G55BFc38QGcUuxgae1YWigFpYpP4OITdMru+f0FDoJoMNqDzxH+/O9H7i5xjDFH - 0Uihp7JSGzDACK8lqH9gAxpooVmC+hs2oIMeuiWov2MDDh67Ak5wuo8swHXdpe/7fxQU94gHLDAtMMd3 - FhCGYZokiRZLG+eooVLgGld2C0/Q1XyhinvM8FFAvaN/P8RLDNGH3srDGV6gD+ct5x3PmwF3cRybKIpU - lYus6jg30Jnk1VHdDLgNgsB4nqd/Y4UQLn4wwTjnF59ZgKZjbC3uzzhrTMwVGGxFoqkAAAAASUVORK5C - YII= - - - - - iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAjklEQVQoU4WNoQrDMBRF82eBmJiYqKiY - qJiYmEAgX1k3amo2mBiDMbFN3PXymCmlO/CeOpyrAPw9NcZA7x2tNdRaUUpBzhkpJcQYV2eVKJDX+4P7 - 44nz9YZ5uWA6LQghiMQC2RYoee9F4gTZKznnRGKB/AqcYIGStVYkTpC9kjFGpG2BEyxQ0FqLxHd8UF8P - Z+WKIBJR8gAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAAK0lE - QVQoU2PABDwoACwAkQABqAAyAAmA5aAAuwqEIXABJEA3AXTAgQI4OADAJQehw2n+2AAAAABJRU5ErkJg - gg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACbklE - QVQ4T42QSU9TYRSG+y/cunRhYuJCV4proysTY6IxUYIDUUAiBhQUQY2hKggKEgZRGWIFhYIiDaUUEERk - aBCUSRAKWihgoe2dSh+/exsWxmpcPDmb8w7nmIA/cHaPSALsnS6a2/ppaOnFYu2i6qWD8hobRU9eU1DW - KOm7UQ06e0cVMXF9dtM3PMO7/kkcPV942/GJxtZBmuwuCiua/m4g0jWjQVekgdX2IdKgzkFZTYvRIL/U - qodEN7A02AmFNgw0LYSqagaSrBCUZH76/KRn5YpVYfDKPiEJeGEbo7JphJLaQQqqP3LncQ/ZjzpJv+/g - cl4b/oBkCL3LPhY8yySn3owYNDimjHudQ15sfR6sXfNY7LM8bf5KSf0EZdZJrj10suhdxb2wxMzcDyan - 54k7ezFiINK13xsMGQ1yK95zu7SLG8UdZOS1Ep+Qyqn4FEO4iWFQVNWOpt8qUMW9ihpCVjSCsipqK6z4 - JC5llRrL0TCZi61CKMRCqKOL1/wy92oXyXm+SPaz76SVukl4MMNJ8xSHs8bYnzpKTKKL3WcHJVN2vsVI - DkqqeJLEsi/I0oqf3DqvCIAKZ5hCW4icepWMapkL5QFOF60LAuxJHJZMsUm3OBqXxqFjycSey+RKVgF5 - hVWYLZ5Ig8rNBt8iDa6LBmkjxCS52HVmQIl6l855c7f4CwaqFiaoCOQN1oIhVtc15hZlth+4G12sc+Lq - GyFEPDUs/hLGL23g9akseGWm5oMMT6+zdV9mdLHOkZRaFJG8FgjhWVGY9UiMuwMMjPvoGVmlfWiZLTuO - Rxfr7DyYwba98cbSv4gq/n8w/QLUGh0VPWo3NgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAFM0lEQVRYR+2UC0xTVxzGrwgCEtpFqMOh - wMAHWgSk0w00g+E2FeTZ1uGDIVN8bVYnxicKk6nbzEBBFNRZR5bFPSJBUTZBEDczddqqs1CetUB5tVKR - ikDRb/ee3DRxilo3zJLtS365vef8/993bu89h/rvKHq4DyXklVJih2R25AUqejiXDpcnFkzH2HXuoOZy - 86j5HC47+wJEP/m8w9MgxypCWLYfqFg7ObXQ1pWtGEAJeemvJU/ENaxHac9KcmVYnvcWqHjrPLZqgCR0 - jPNc64nfDBvxe98mhCgmYUldEPkdnOkFapFVOls5ABI5+nAWOuvzVGtQgc8QXxuAdxXjCe4HnZhwOVs5 - ABI5cimRg37fpeWowm6kNIUhRDmO4P2DM6jFVioqwaqfj1AgiKPJowR+PuyI+RI7yCXfz0EtciBtT0BE - 1RhC4C+usPrIWk8lWPbjTYdzAgOwOmcFqCm+euoNb/MXIXaQirJmQoWvUdyVAmGNOyH8hhuGJtqADo9j - K/8iNvwnZSbq8R2+LEgCFeClp6ZNePZFiIfFTVjnjRuGI7hmzEa82hMxKjcCL9WODh/czyEkEERwAqfi - tPIANDiOmvtHyTX9VDKsgrwwQzgfMTHLnkjwe9HgxI/EhbbDpH9dkz9i1S4E90wOE/6ELScQrOLPC0Xl - nXycNGzBCs0YyHsOogWnsacwFdyISZDXKPDgwYPHUteqBjfeDccUu0nPLt1sxDc4E6YVOIBaMlhOLR38 - lJNviq/UY34g4qpewRLNCEiaPXC9NxdtOIeMn3fAPpKPH08Xobz8Jioq6lFZ2YCqqkbIbigxfrU/Ms6m - kNqjd1aSfoboKzxYJdiCWmrxjK8xwEs6LskDH7a8TEhsfRWK3qO4hUvYW/QF7EWeyDtTbAqvqdHgnU+E - mLt/Dqn59d4eU+9iFQ9DJJYIov9Z1v0Z9aandHyKK1a18QjrtW5QGo/hNv7AvuI02MeMRn7ZGRIuObAZ - EzdMJnNMDVPL9CxTO8IxeQhSjm2DWPyBmQtgNN1Dyk8dibW6YYSkWy6oNp5EJ6qRXZIB+1g3Es5dNBIN - Bhm092X4tJ1vqudn2yAsLRJKZTVEooXPsQBGM1ylXjudsEH/EiHl9ijU9RWhC43IOZtFh4/ChZvF5D67 - 821T3fQTQzF641gUlZXi4sUrEArff84F0HIJF8B7Fw9bOjiE7R3OUPeVoRs6VLZdJdcT9ySm+ViZHexW - 2iO/sAAlJeegUFQhOnrB8y8gKmoegtZEwTdtGLZ12hE+N4xAY98FGGGArPeQaXx5pS1sPh6E3d9koqio - BGq1Bi0t7WA8WDvzFRkZg9zcb+EvmQm/DA523LUlpHU50SfdEdP9Vp0NRqRaYGn6CpSWnoNWq0dHx11o - NDowHqyd+YqIEEMuL8ehQ7mYIgmGIMsOu7qtH4GfZQH/pKm4fFkOvb6ThHd2dqG+vhWMB2tnvsLDhair - a4ZK1YLCwjPwTwzG5BxrpPdampiRbwGfZF/U1qofCjcY7pFexoO1M19hYVGortbQ77OVfpo2XC2vAH+T - H17/yhJ7+yyw4PwgjNrkAlVTwyPhXV3dpJfxYO3M1+zZEfRerifhjY1aNDXRX79KBf5WH/jsHwSnzVyU - Kc4/Nry7u4f0Mh6snfkKDQ2jt9JNU3hzcztaW/WoqVdj+4mdOH7lVL/hPT1G0st4sHbmKyQkFNev1z0U - rtXehk7Xgfb2O08MNxr7SC/jwdqZr1mzZkEmq/5bMB6snflimv8JWLv/9W8URf0J47GMerb9rPYAAAAA - SUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsOAAALDgFAvuFBAAAI0UlE - QVRYR53XSWwb1xkH8JElS+i50KUIempB9FyguQRoiya2gSyHOEWQADnkFtRxmwRBENcIigZx0sDNVsCJ - d1mSZcv0EluS7aS2JFv7QslaSIkUd3KG+zILZx/y3++RVBzvTgf4YzhDit/vfe89YsSx41/79nN79/yj - 9ejBEz/vOtLb2XWkp7PrKOVYIydYjnffThdds/z43vGezu4TvZ09J04209d5svtUZy+d93/62c8unh+s - 17rvMdh3k+s/fPmXKyPpq4GJ4mJwpugJe0qe6FLJE/eWPIn1socPlD1CqOxJRURPOip6MjE6s9DrVIS9 - V/LwwaIn4S94Yms5T2Q16wkupT1+D+8ZuTL951K8yrW0tDQr3nVc7p3k3Ie+dwVuyKnYjIXkgoXUio3s - uo180EEx6qCcqEISapDTNShZoJID1HzjrGTZ/SrElINS0kI+qiMTUiH4ZcS9ZUwNL+2ChAcDhnonuDOH - vnP5RyUhOmUiMW9CWLaQ8VnIBQgRtlGMESLpEKJaL8aKVhIaKhnnNiLDEDYhTORjDFEBH5Awc2N5FzQ0 - q93nGOwZ5/oPfudaHxEJYCA+b4BfMpH2Wsj6aUQhBmBf7EAUCJGhkS/zMD/8DMapoUYnCpQ8IbLUqbSN - smCikCBERMHc+Mou2I8EXHWtDYtCZJIAcwaStwykvCYBaDQhC4UoARLsiwlAI9aOnYVxqA/64E1oORta - ie5R1CJNUZ66RPfEDCF4DZ4pAuBhgO6xJqBMAB2xOb0JMJAhQC5IXxS1mgC7DjA+/gr6ue+hzaxBK9jQ - RUCXGtHEGtQyTU2REFkdi7OrDwcMMMA3DUB4UiOARgAdwioDGMiFGMCsL7AyzbFErTY+ovYfPQXzP0eg - FwwYSg1mBTDVZio16EoVFdHE0sJjAE5/c8XlGy7dCfDSHNYBBgoxAvAWxLQFqUSArw7D2vtPWJ9+AUO2 - YWo1WHoNjgk4ViO2RZ/TLKwsex8OuNR9swkoEkBFbF5FYkmD4NOQCejIhQ0U4wZKtLDErAmZWqyfG4Kz - bQfs/V/ANGuwzSocu4ZqtYZajcrRwc62bcPr/QmA0GSlDkgu0z5eI8CGVt/XxaSBctqg9ptQJAf6og+1 - X/0aztFjoLpwHIeKV6koAzQFdLD7jwQM9BDgIAMUhNAUATyVOiC1rtJeJkBMo9HrEHMG5JIBVTah58uo - PvscnCtXaIc1Cm0iNiE/HTBSEMJTCmILCpKrFaT8KrIRFYWkhnJGg1TUUZEMaJoJM51B7ckn4XzyCWwq - yFp9PwS79vl8jwLcIMBll2+UADMK4osKeF8F6WAFuZiKYkqFmNegiDrUig6dilk08urTT6P64ouwBQE2 - FbobsQl4dAd6CXCIADfyQmSOfr+XZAjrCjJhBflkBaWsSitfRUXRaPQE0DQ4b70Fu6sLzjvvwPn6a1jN - LtyNeLxFuNkBBpiXkViVkdqQkY0pKKQUlAsVKLIKVVWhGbTnV1Zo/p+FGYnAXFhA9YUXYPl890U8FuBi - zyh36uCQyzuaE8JzEgEkpIIycgkZxawCqazQ6Ct1gEoAa98+2O++C51hTBM2daD66quwksl7EJZlPUYH - To5ypw8PuXw3c0LEIyHpJUBIQp6XUSrIkCUCVCqoUOu1cBjOjh0wJiagUfE6QpbhfPABqq+8Asvvh0Vz - b7NQVZMQPr//Lw9fA30jXP+RIdfaRFaI3hLBr4vIRCUU0hLEEgGogKIoUAhgfvkl7DfegEbXmq43EDRa - o1SCs3cvak89BbuvD/boKJyBAdi9vSi+/HJvjeN2EuE3lC33UAZOE+DYkGt9KivEVkQIGyKySRHFnARJ - lOoAmXWARm8//zy08XGorDitftYJ68gR2NQBZ/duVHfuRHXbNtSeeAK1Z56B8/77ELdvP09F/075N+UP - DHAHYrB/hDtzfNDln80I7AkmFS4jJ4goFUVIEiEoDGB8/jksKqLOz0Pv74d54ADM48dhXL0KY3kZBs/X - p8PI5WBfuFAvblMKO3ceog78lor+rpmWOwHuYe7MiUFXYD4j0PMf0tEy8pkyymURIgNQcYVWvvXSS9Au - XoQ6PQ01GESF2s46odI0sN3BpkSnsIVp0NybNGUGfS69Z88BAjxHRX9P+dM9iKGzw5y7e9C1sZAWkoES - MokSCjkCsOI0KimRgPHee9Bp/lknZNoNCpuSZuq7g21RKsgAdURzh7BF6l1fry/CZtE/UnZQbq+FoXME - 6CHArZTABwnAl1AslCGPjUEZHITa0wPztdcg0zaT2Hpopr4wKT+GMMQmhCHY69XVxvNAnmpR0TbKVlb8 - B8Dl89e5s70DruBSShDCRWSFAuTePqg0x9LMDCxaWMp/r0GUFYgiTQubms3QdX2himy7Eoo+U//NqDQw - DLUJeOBx+QIB+giwIghCvITyyTPQ3n4bZfp1M15/Her+/SgWWVeKKOaLND2FO1LM0X1KKU9/S50T2eIt - 30YtL9FT8cMAVy5e586dGnCFvIKQCmWgvvk3SN9+C233X6HSqs/Hk8hmcsimssgIGZqie5Pls9S5LHKp - HPLpPP2CNkAsiwuLjwE4TQAfL6SiWZSPd6OyZw+kDz+iR7IgUnwaQlwAH+PBR5uJ3BW6J0QFpGIppONp - ZJIZ2sq5ejyznkcALm0CkkIymqEvSdLDSAB8nEcimkQinEA8FEcsGENsgxK4N/FAHPGNOBLBBJKhJPjw - bdDs5OyjANe48/0MkEglQikkIknEI4l6wWggiog/gvB6GOE1ii+MkDf0Q8JeusdC9yO+CKJrUUTXo4j7 - CbORqIOmx6ffhPMAQEdHB3e69xx39GD3L6bHPAfnpxfPzk7NuWcmZtzTY9PuqZtT7snRSffkyKR7Ynii - kesT7vHr443ztfH6681r9v7k8KR7amTKPX1j2j0zNuO+dOHS9hyfa1a862hra+O2tm/l2tvbW9raW9u3 - drR1tLa1dmxp3dLR0trS0bKlEa6F66CP/79ppdznn1OO+x8FMcZP/Ws5zwAAAABJRU5ErkJggg== - - - - - Qk02BAAAAAAAADYAAAAoAAAAEAAAABAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADRNaP8nMTz/KjlJbwAA - AAAAAAAAAAAAAC8tLxIoJShQIR8hfxsZG6IVExW0EA4QmAsJC3IIBgdCAAAAADRNaP81f9D/PY7a3Dle - d/8AAAAAAAAAAD07PTw2MzaWemFJ/6J7Vf/BjmD/1Jln/8SGYf+mZk7/gEAy/wgFB3A1f9D/P5Hc4WHG - /f9zjqH/AAAAAExJSz97bGH7oYdv/+C2if/luor/57qL/+q9kP/sv5f/6rWT/+OXfv+lWEb/gzEn/mHG - /f9qhZn/AAAAAFpXWhVSUFOmq5eH/+zLqf/uyqT47seg+O7IoP/xzKH/9NGl//TSqv/yw6T/66OK/6lW - Rf8IBgdsAAAAAAAAAABhXmBgj4aC/evSwPVYUEjtqZuL+PPVvvjz0Lb/89Cx//XWsP/22bH/9tax//LE - pf/nmoD/h0Q1/wcFBz8AAAAAZ2Rno8CzrP745c/lvrGlyi8uLf+yp5z/99nF/+7Rvf83My//wK2T/y4o - If/0zqn/7LOS/61pU/8MCQttAAAAAG1rbdrk18//+ura//Lo3v9saWf/NzQz/+DNv//r18n/2ce5/ycl - I/+2n4L/882l/+u5k//Ki2z/EA4QlgAAAABzcXP5+fDq//vu4P/99u7/+vTy/xgXFv/NxL//9efd/2Zi - X//Wvan/UEQ7//HKpv/svZb/3KJ6/xUTFbIAAAAAeHZ42+fh3P/88uP//vny/2xsa/8tLCz/OTg3/25q - Zv/w3c//99vI//LSuv/yzan/67+Z/8qYdP8bGRulAAAAAHx7fabKx8X+/fXr//769P/19fL/cXFx/15d - W//r5OD/3dHK//Pj1v/3383/8tKy/+vDm/+og2X/IR8hhgAAAACBf4BjpaOj+fz48v/++/j///78/6en - p/9mZmb/1tPR/zQyMv/16+b/+eXW//DTt//mwJv/fWRS/SgmKFMAAAAAhIKEFYB/gbDDwsL9//7+///9 - /f///fv/uri2/2trav+5s6//+u3j//Xez//t0bX/oot2/jUzNZovLC8TAAAAAAAAAACEgoRDm5mb58PC - wv39/Pv//vr4//z38P/68uf/+e7h//bl1f/v2sX/qJeJ/nRnYPQ8Oz0+AAAAAAAAAAAAAAAAAAAAAISC - hEOBf4Cwo6Kj98vJx/7n4tz/+O7l/+LWzP+/s6r+jYWB+1NRU6lLSktAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAhIKEFYB+gWN8e3yneHZ423Nxc/lta23aZ2VmpGBfYWFZWFoVAAAAAAAAAAAAAAAAAAAAAA== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAALlJREFUOE9j+P//P0UYqyApGKsgKZghoePCf3Qc13YWjDU8J/0/feM9Tnzgwtv/ - YAMePnyIFcMM+PTpE1aMYkBiyyEUjG4ASDEyJtkAbBhsAMivIMXYMFEuiGo4AtcAsjm+cf//uIY9GAZg - w2ADwqshirFholwQWrkDriG2bhccoxuADYMNCCnfBlb8/PlzDEyUAcFlW/5rek/9r+E1GawBHYMMAGGY - 09Ex1uRJCsYqSArGKkg8/s8AAPQ/LvnHxuzLAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAABNklE - QVQ4T6WQu06EQBSG9w1EfQNfAeQSCBTIJVwCIVDRUFmQWK+d7VZaW9vJG/gIxtZGo4XWbrnteM7A2Z3d - jLdYfJPD/8//zzAzxti/kIsgI7uzDKlIfBckpCLxp4K2bc+KorhL0/Q6iiKFm0KBaZpzgE3MSedLnudX - WZa9x3F8HwQBs237jZtTAQROMYjz9I0lJzhzAU68IBNKPizLgnGr4EFSsMCZC0hVVZfAY5IkK9pMBV3X - 0dXX9H0/7oHQQdM0rK7rV5gVz/OeDMMYzc0NXqYgv7YI/v95WZYsDMMb3/f3ILzSdR28rQJ6wFtgHzga - hmHcA1dWHMdhGAKeNU1bqqo6mlMBAqEFsETwQNL54rruITzcMYlrUyj4CqmIYJjY9USkIvFTGJGLwsni - LEMq/h42+wTylm2njslBVgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAq0lE - QVQ4T72Q0RECIQxEacFKoKxryfHDIizJGu7XNRtnbyCI5sPxZt6RhM0SKAAm7ONvIGrEXLDSYz8Dt4L7 - 5YTrVpyVyZgwtUbCWHwyGRNLeWoUMv+fwTvhqu57R2BhFvV4n5r58kIPGeH14hVfP1taaz5mrdVhzYVd - I4lXOQwoXJ2eMugnYMyajFMGFP5kAq5E75A2oFAT9A2RpQE32UzBNyYDmWRRD4DyBBMVP/GDmZlcAAAA - AElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAFPUlEQVRYR+2We1CUVRjG/duUtcvkmDJU - XlJyXB2RghxxyKasHHRMS7uspaZURmPGmKmrzdhMTOOO08Usbb2kibdFUVBAllUUENlvuawICN9ySRHR - D8FQWODpfc/HB0t84dr0J+/Mb1j2vOd53nPbcwb0R3/4E9OeO2KICLWZpk85ao0MSZRmTD6BlyYl4+WJ - pzDTmIrXJqRj1vgMRD17VpoTfM46d2yWad7YC4bO7v89poYdDJr6/CErFYDli7KxJa4K+/c0ICMNuhzc - dQdbN11H7PxSvGuUsGC007pwlCuoU87/CA+PN7wQdsA6a2YSvt1UhrSTrcjMwANxOtmLn9bWITr0Mt57 - ym1d9GSxfzNC5sbwsHj5y1gJ9rQWZJ9DF+mpwOF4Yr9KSjJw3KZ+3vOb2sY5vn0cqW3YvLwWHwSVyEsC - y4ydNvrB5jNetCk7d9Qg7wK6SE4Edv2qGp0/CyQelbFtqx0fLjFjw3or9v0uie8P7AV++VHN5T6+God+ - aMInYz3KsuEe/SLIPIhGrhw/psDlhODcGdCaA7t3qPB3Y8YYQem9mDw5AmcdChIOdedzX9bQ9E4fbkH0 - sCrl42E1vfcFrbl9i6UURQUQZDqAeBqRLzlZQFSUCZGRUfgo2iyYTf9Td0FISAQu5vTux1qa7r6NTVgx - 9JpdmGpB5hFRryeh2A1BznmIkfyTlCS13ZmrijI8sjmzu4vgdr2+rKnpr51Qj88euxEhzDnoqNl2bveg - rAS4XAycPAEk0Rr6g5QHmEwxXQWwhl4ea7I2tyda7mHlozdtwpxjWugRpaigFRVXaMPQ6NJO+Uc2jer4 - MQmDBxuE+fuLYlCYr5/LsDZ7FLvaseqRBkV1p5g+JQEeGQJeZ4f9/rBYQb6C4HHqpgwONsIlKcjio6eT - z7C25hM7pJH7qREZcgzVVRA4LwJZmX1zIRs0UjInU+ou/roLFeRL+vkarK35rDb81V0A/7b/WQNBvgvI - pZ3cF2WlwMqVZmEeEGBAdrZMBejn+sLams+agLvdBdDFIhdKzbh2ldaonDYW7ey+qPQAYWERooClS2P8 - 6sNwHnuU5HZg7eAWWXWneGViimXbd+W4XksJ1wB3EU0xndl/o7oaCA9XC1i1yiyE9fJ8YU3WZxLXtGHd - IK9Vdad41ZgWNC/sDDwVXtTVAVepyuJLwCU6s3rU0BSmp0tISLAjL08WBejlabAWa7J29ZUObBrWBvND - bT1/DWeNd5jjPi9B/Q0IaqnSUjqzJZd7w227d9sQ+4UZTqcsdrVeHsManK/p/mFqJ/N2S6dtz6DHhJS4 - pw43b0Jwgyr20HrzptOQySwjQxLTzwQGBqG+vmeORlUlmVKbppf5cwc2DGyXNg6E/tU8d1yW4Y1ncqRt - 66pw6xa64CLKaZqZShJ1OHoWwOJae0WFuke4eF8N26ftfZtr8eaYi4a3Rjtt5vllUBQIeP3YmKeS17Gx - ka7l8xLi4ixwu2UxSt683Kb10SjJ7MD3obzm7bb7mnMsHCUZF450KQ5bQ5cIj8BXlOEimpqA27d7tzG5 - 8W3YOdeL9YO8MpmbOuX7jgWjJNOSSYWKI6EBDQ3ohez24rT1DqSUe5BOtcAlaIXrpBf5ROrmFuxd3IKv - R9zlcy7RUfPPmIPMjYsnFqIop7nLsMLdirzUZhz85hbiZtdqjwnLiqFX7TGPX7fTlWqnW81OF4s99uFG - ++ohdyxrAppNXwXce/CH6Nsj843vPF3AD0jQA5LfcFgcWCYvHVFuXzZcNkc/Udl9f/dHf/xvMWDA38Kg - Xl6tAJ/VAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACbklE - QVQ4T42QSU9TYRSG+y/cunRhYuJCV4proysTY6IxUYIDUUAiBhQUQY2hKggKEgZRGWIFhYIiDaUUEERk - aBCUSRAKWihgoe2dSh+/exsWxmpcPDmb8w7nmIA/cHaPSALsnS6a2/ppaOnFYu2i6qWD8hobRU9eU1DW - KOm7UQ06e0cVMXF9dtM3PMO7/kkcPV942/GJxtZBmuwuCiua/m4g0jWjQVekgdX2IdKgzkFZTYvRIL/U - qodEN7A02AmFNgw0LYSqagaSrBCUZH76/KRn5YpVYfDKPiEJeGEbo7JphJLaQQqqP3LncQ/ZjzpJv+/g - cl4b/oBkCL3LPhY8yySn3owYNDimjHudQ15sfR6sXfNY7LM8bf5KSf0EZdZJrj10suhdxb2wxMzcDyan - 54k7ezFiINK13xsMGQ1yK95zu7SLG8UdZOS1Ep+Qyqn4FEO4iWFQVNWOpt8qUMW9ihpCVjSCsipqK6z4 - JC5llRrL0TCZi61CKMRCqKOL1/wy92oXyXm+SPaz76SVukl4MMNJ8xSHs8bYnzpKTKKL3WcHJVN2vsVI - DkqqeJLEsi/I0oqf3DqvCIAKZ5hCW4icepWMapkL5QFOF60LAuxJHJZMsUm3OBqXxqFjycSey+RKVgF5 - hVWYLZ5Ig8rNBt8iDa6LBmkjxCS52HVmQIl6l855c7f4CwaqFiaoCOQN1oIhVtc15hZlth+4G12sc+Lq - GyFEPDUs/hLGL23g9akseGWm5oMMT6+zdV9mdLHOkZRaFJG8FgjhWVGY9UiMuwMMjPvoGVmlfWiZLTuO - Rxfr7DyYwba98cbSv4gq/n8w/QLUGh0VPWo3NgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAiElE - QVQ4T+2PUQ6AIAxDuf+lkTbWNIOpmH3al5nB3DO2kd5bEcPEpkwqIXDp5w+4EEhUJgSQlQglKhNOIPEc - 43PwSvgU/g2K7z4IY3wOFEm3hD4TvD9lW0IuZOwI2Wnhjl+45LVQc66MZ8YkREXCjF3GUogSizueMi6h - cIGXwZuMSQhchAr03g5eEHK4HOEqIAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABtElEQVQ4T6VSSS9DURQ+P0D8AWvxLyys - TRFDzBIiNmwkYsHODiUlYghBJGIIiZAYgmppmw6aqsQUYh6qniqlxs89T97T5rUL8SVfzrn3vu8759x3 - CcC/qCYdKzfQLV2jae4StRNnKOo/QopuD0mN2+JYK1SoJnphEA0JdW5QZQ+nEUKFasLVoyG+xgWTxQYq - 7eJlhJipJtx6NFClA4trVkwumEH5enkrnGpSP3UughZULqqXWEAF66BcIyi7Xd5WqCZVIyciROLzC7h6 - eIPn4hnG/UfMbvlBWW18pDXI7j4UIRL3wQ8c3IRgPXrC/PYDJpwSKFPHR1qD5OZdEX7xGPrEse8VzpMg - lncCmHbdY8R6B8po5WOtQWKDR4QfBF4+cCq9wn32DMNeADNuP0ZtdxjY8IHSYxjEVW/iXQwtiba5MouV - ucfsEgbNPvQYb0FpLeLzKAZUYYc38I7D2xBcp0FZPOfxY9whYcjiQ68Qdxm8oNRYBmVW+cJ4Zm5bEQ8L - cZ/pR8zPPbZBsVkVc9tKZUXcueoFP/fYBoUdoDw9KKdd/tf8u/jCeGYWhVPRyLrwxd8J+gZIFxsVaqEN - EgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAAC+klE - QVQ4T42S+0+TZxiG+V/MYkycidHpNP7gIaTooAbQDwsC4qilHMqhYC1yKNKPOhmjtANKELSVTSbBMVo/ - goeI4AFD0GWZAw8YNZxMLZiJqQf0sq/LPlyyLPvhfvIm73tfb57nuaMAVaX1yvqIZGtdYKjcpczbm/uf - H6rzX805csZmtHWu/fTt31IPZQ19eRVu5YFvcIgLD0ZRJvvwTVRRoBiQ5BNklvrG9WWnDJ+ahT6Ww04l - V/YqL7vvnOPWn78z9mqakp4anPfLyf5Fy1ZHLSnyMMnW9oUMS9s/IFGWusC6cndgomXERd+sl4G5EUYX - 7jAWDtI15cfgcaDx/MEGdw8bm/RIhfXje4ua1XYEoLrap+C5XUvThAXvEze+SQfNv/nI+bELY0uIlLpH - rDqdyIofYtlsz2dPXoNNBRQf6x1sCTxGVpzk3txJ4UgcZq+Vkg4F+fjPyK52rLX1pLuyWdmoYeWxBBKN - tQMqoMDRE2o9/wpbayva0xq+UpLRN7toPOXn4uBVZoLPeDIbpONsL2llJpbVxKDNlEMqwGTvDrkCYQ53 - BEm36olt/RpzRzX9lwcj9/B2EV6E3zE9t4i7/QybTInsSK9cAuQe6RoobHqI6fhrjK4JEkpNVLi/Zepp - UDXPPn/L3ak3+IfGSUxLJTrZutRCdtVPtpyjV8j8/iUZzjmS7dc4dFRm8mnoL/P8YsT8muG7YVq6h4mX - ktgimZeGKBImQrK/5ha6b2bRVI0g2c309l9mZj7y8/QbbtwLc250gTxLJXHSvvnq8uI2FSCKSFiaxbew - p+Iaq4odrDankmUuoq0zQM/QGJ6zw+QdrCRJt5tOZyq9nvz3DXKJXQUIiYTp8hvHtxe4iNbnoDU6kLJs - SHv3kyDpSEmKx23exsxJDe+uZ+D9rkhAtCpASCRMhETsWaxKTFsMTPScoo22ZMWt5dfKL5j0bCHkT+Kg - YeeS+f8oAthliF3DJcuXHIj5HF3s+vh/ffhfEpBNq5cTs/GzXUDUB9hlsqaYQE4mAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAAKklE - QVQoU2PABDwogGwBIAkF2FWApaAAuwooDQa4VcABUQLogAMFcHAAAAkkB6HP3b+GAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAGaklEQVRYR62Xa0yTVxjH3+zDEj/sy/Zl - yUy24fwws2hWQxi3dSyLmdOEyEWlDIZCvQ8Ggo5yqYji3cmcmYsa3bygOB1TFEEcKCjEG0ItqAyscleg - XCwFgf73PIf3JS0BW3VP8kvzNn3P//8855znnEpvhV0xq36sgCqxEiqdgTBClVQDVfI94gFUKbVQpdYR - 9VDpTcQjqNY1EI1QpTVDtb4FU3UtkBY3HJReJWYmVuB2K16LtfmAx5ZOSJHNL2/CXVeJmna8FhF/2BB8 - DPhsWxekqLaXM+GRbEB9FwTXm4CbzZRVC3CHMqtqA+4+AYxE9VPgHondJx50ALXEv51AHRGQaYN7xogJ - r+09kLTtrpvwTDWiqReCWyReQeKVJG4g8bHCQpRg0XrioXmEWek2fBgzYmI+mfDe8QzSErNrJrz0NXhi - gWCseA2JKxmPCsuiJqrYI+IxodbZ8HaYowmfnRZIS7udm/Bedw+dVgiUko/N2l5YEW3oBhqZHmDJHhu+ - SLLh6w00DT/bsOSoDWn/ANIymg5n4ZP2AD0DEERGRr4WGzZtxVOqpDKetKzXuQHf9bWwPIeAB+HMRcnl - rE1y1krGTZRxM62XFiIzrwXxRx8j/lgTovbcxZdxOViT3QHdKTN0p7tpHdDW1LbraT3oaTrUsqRj+KbX - wToIARtwELcrtxAmWLj1GdBGeKVU4e/b3ci904Pzlb24YLAg/24fCoxWop8YQL7xObYWDHA19LKkY3y+ - oR4DQxCwAQdxu6zthbnM7YQ3L2B67ugDumgNcdmfEUpFGX4+bxyCtLxvIgMmDA5DwAZeJM5iQpwEWdQ7 - rVZUhb/n78xkoqsf6LaDjZ01DENa0T++AfXGRxiyQcAGeM657PbinDVvU86ahTtlMZ/0h+K3/Dth0O43 - CvycU0UGVj6fwEBGA4ZJnGEDyoKzF1dKLsQ5S4Kz89nYILYoV8z+nVa5YvzJz3/esUFaNTSRgUYHAw4D - 2WUVtCAEbm5ugilTpmDq1KmYFJAjdg33CmXqRJ+gMXgc/uTn4xU2TA7YBy8vL/j4+MDX1xdqtRp+fn6Q - 1JuaQdoCNsCl53lV5lzJPJgMlJWV0a9ouoaGEBd3FdqoYvwQU+oy/v55uH2rDTYbq4HGiCMDm1scDIwt - vVJ2NlBeXi5etFgsSNLdRMllM1qpfbtK4toK3LjejMFB2vMUq1evZgPU/OVgA9xkOHtltfOC4zlfEKIZ - NdBpNmNjuhHnzvTgzi06OV0klS445WUNGBigvUkRHx9PBrZQ85eDDSjZK6Xn1c4LbqEmVBjg8rW2tmHn - tjrs39uFC7lwidycYSQnmnC11ASr1SrGSUhIYAN08sjBBkYXnlx60WDIgCY0DMXFxejt7UV9vQm7M6ux - PrUNWzM6sWOz2Skb1z2BPqkRl4sNaG/vEOOMTMFWWsZysAH7uVey5w4XGhaO3NxzaGhohMFQjaysK4iN - voG0FJNLpCTWIiE+H8cLT2LuPk9crChAbGwsG6A9JIdigMuvNBs20EsGwsK/w4kT2SRupKm4idKr13Ho - 90LExJx0iZSUHFy6VAbN/jlY3yphV+kKREdHswHqJHKwgfHKzwbCv4vAgQMHUVJyjQYqwcXCK6/Eb6cO - IO18BA7nHcLKlavIwDbqIHKwgYnw9vZGZuYvOHv2PM6czScK8Mn0mZDeeNMlQjQR4p0R8sQ4y5YtZwPU - quTgTPkE6yP4eO4nlJNy8eJIZGRsweHDWcg6/hdOZJ/BNI9vMD18p1Pc5sQjKGyVeIc5ciRbjKPVLiUD - 26n1uRBRUVHQ6VKxe/feUT7yCUdyEZwS9msVZofEOrzLREZGQZqR3o2i+4MyQ2MYHiX4Wy0tptVIT98y - ygdfJeBIFZySlF0Lv5Bkh3eZiIhFdGVb2nWQrktFdIEkeouk5c8IC9FXJK2wEv3EQNHH6lCzu7s7PDw8 - 4OnpifnzNZg8dwdKH8Mpu/Mb4RmSgUWLtJg3bx4CAwMRFBSE4OBg53fG8YIWpN7fPxDvBh4Rp6Azjl3r - wKcLM6HRhCMgIGD8u+HLBB2p+lmzZuMdTYG4ATkjt7IP00L2UeYLOPPXN0DnOR3nav0kremhcp17EYXV - fXgv9HQRieup7O/Lw/wP8T2K1PS/UL1rCOqfnkO90wo1/S3j3sKHnHpTI9Qb6jBjjQFS0OVxbkSS9B+I - ynnEQdOslwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACaklE - QVQ4T6WRX0hTYRjGdxMkikcqmeWURbeamAg60pVK82KgppIzCh3WNvwzRtjCuahhCYabyzRrFcQyVEbQ - hSj+YaKrkCBnDpuSTsu55lEXG1mG29PZuRiunau6+MH3PTzPw/u9HwvAf8EoBlmcKOa+GTi7p68ndrsV - xGEmTxBGMcjbgfz5JfvN3/MzSn9HLTHI5AnCKFr68oTzU5f9vp9PsbnWCNsID50NxEkmb4QQ5P3rQvLz - chdUzTUQiYpgGZOht4XjYvJGCGYjX2mflvibVFdgMpmg0WiQyEmAdTADulpC8rc/7EItLurjkHA3OLqo - shw6nQ5SqRRsNgFyqRovNfG/qIUe2J8JKxh/ntO3sqCm3v4MzepqKBQK5PLPQFGfg+2vcixbTge0MsK4 - PxM6WPrzkuyTInpxvh0DzGY1Ss+XIj0tBeahKnhWrmJroQyjj7gB6mu5EQVmY67V/U27Rxd49XA7WyAQ - nIKoPBO2dxXY/FRCUYTVMY5fX0fYwgqGDDy+Y0YWoMO+Tni3W7G6qIThQTG62gVYmy3DxgceNqx8uKa4 - GNTGBNqlscJQgaU/3+3beUKN/pgOf3erqLEluFhZguzsLOg1KSDnCkDOFsA1mYQvw1HoUhBeuuBVR4bS - 6bgN7w9DKOxZk2PVVgVhYTrSUo9hcSIL7ulUuCzHsT7BhnM0GuaH0YG74thelrYhOeDx9mCLbAuFtx1i - emHk3Dlq9Oyw8Po4AefIQQzrY3BPGk+yeho5U93XT8BwIxnd1xJp7suPQleXQNNaE09zR3wEty4domm6 - EAdVRRzaJOwXoV/4N8D6AwpMvVRjyTFwAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAFeElEQVRYR8WWW2xUVRSG95saxaghJBrF - aKLBB28xGgXxgvqgL2oAFRGLQLm0xfogBAFtgnLRGIkmEkhAEhCNQAuiIhZbE2IUaKfT69DSMqXTdtpp - pzPDQAstZX7/tc/Z07PboWAIupMv0316sv5/rbX3PlsB+F+xJ1NL4mraH1DTD5E/oV77C+r1w1BvHIWa - UQ71ZgWphJpZDfVWLdSsAKmHevs4VFYjOQE1uxnqnZMkFFdz2rJUhmFpWhOK+zpxxRQGgGX7+zEmNww1 - NzzChKVpTZh5XTeumKJq4IWNwMoDAxiTF4GaF7FMWJrWhGVvikNzLArUdAG1RIIGiDwT6klDj8Nxl8bY - EEX+FB4sSGkTBcU0sTgKlR1Nm7A0rQl73pqERoR8YcDfAVSxrDURx4w2Qhr4fy1MmsgJCgtBmt9dlsL4 - 3CETqw6ex43vxqDmx7QJS9OacMF1noFGAvspXO2K17niOnuihT2izeRkAmghu46kcNNM28QnJTSRn4Ba - kMiyNK0JV3u0DxoJWrYlH0dXP4PytVPgW/ccKj4l/PWteRZVW/NHCIdOsXpk9+EUrnl1pIk1pYM0wBe8 - mtaEWy1xDhoJKKK+3Gvhz78ele+N0fjzb4Av7zpUfva8Fg4RERXa2Lp2aV9nCkWswl62Yl9FCsV1KRxq - Av4OUWQhX/BqWhPu89P90EiwqvUvonrJzahbNhaB5eMQWDEOdR+MRc3SW1D31UuOKBFRIXwa6CCdAtsY - cYmddWIKaiEfeDWtCQ+ZvgFoJFhgw8uo/+hWNK66HU2rx5M70fjxHWgouA0NG1/BrqNcWFNLLsqSb4Po - 7nUqauKqRXzg1bQmPOHOnYdGsji+eRqCa+9Cy+f3oPWLCWhdP4F/34vgursR3DodR5r78P72oEbEhKUe - 9vli6OF6SjJzE3d0Azxe+weh6WKlgttmaNGOr+9HZONDiGx6GB0bHkDbl/chtGNmusySZVSgmAgKUnYh - Ts7QgImrFvGfXk1rwrP9/AVoJGjLd7O0YPSbRxHf9gTi2yeiZ+tj2kz7ziw0dg1gb3kMPzJTyVb4qcLh - Zw8diYF0XJVDR15Na8IPyyBfEiSb1p2z0b35ESR2TELv7inoLZyC5PeTtaHOwjlaOFPvh1NcFUvHVTlc - EF5Na8Kv2oUUNDEaaGk+hvamcnQ2+9EVqkS0tQrRkB/dJ33obqtPl1rKLAvtFEkSs+IFKb/03sRVOXzg - 1bQm/KSaFyWo2eOyxWR7Sb+73H4b8QQZLiyiZ7jie12k92kDuaMaOIEUXxLEwIGapN5qhWUxFJE9nn57 - +/yLP4b95NdKhwMufcxcGKABE1fl0pFX05rwMsF3NFLSx5f7Mvb0cjnrbj1ZfCauyuUDr6Y14U3GvChl - La5N6uwl8/RqZ8aSvcnaZK6z5mL7jciiE865W08W32Ua4GHtDjEQZu/lQJIzwfTdLDjTc9NrKbXJ2Ox5 - Kb0wKMruUHl84NW0JnPa+OMMEcje1ICJK3yaScJKH570MNnwocNTGdhcEtaLz4xLGGjnjzPk+DQGtPgw - A5cj/jTZMsIA++HVtCZzw/xxhpRXjlq97WTLEbPlhpfelF2XnPHNqSelF2T1mzG6gXm8/rhDREoCyfTi - M9vOu+W8i+6gUB3D7y4lNUMEI3TvDpWn3VzMAO9e7hADUv5M2+vfUvBD0I1KkcWjGcjmxc8dYqCUFfAe - PFb2JFP23sxLhdphFRjdAG+b7pCeypGq+0wybbF0r91+m+PWnHoaN54ZarHzY7ANzOdV9yqPSxjgHfsq - j9ENLIjHeW/XV2e5vcoFUq5QDn36MiHfc/mkKn7V5MMiR6uGB4zDBZeU7rcDgw/Bi/xFDPz3QP0DfSej - GhqGBFEAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACG0lEQVQ4T51TbUhTYRQ+WVgw29h25801 - 2txsLXSOiAJd8UIZSBFkVhAYBUWIYqZhhQ4ug8JWmR+Ykj9CEkaNpB+lDGQMspDAoqDCws21K0T5Y8To - y5Sn17rIiH54feD8OAfe55znOeelJaHd5aEbm3RKph4l4XVwBC1RJVWP8lEBdXENtF0WSSmpg/uRDedn - tNgVEUD+PKaUFdzaquPBqHcLo+5iRl2FjGtm1OZkdNXBqNXG3A+tOBKz4dSkAdbbYop8xgw/+OPKlyJO - vtfj8CsTysfy4I1YsNDVGiqAod8F2wMXDk3aUTGRj7InZuQEhAw/eOd6eS1a09m4+EmD6oQeR9/mYu/4 - epQ+zkdh2Imikb8E+yecKHtuhyNkQ1aLTvGDj90g56BjdhUC39fAn9agOaVD44wRtR/5ZNNmVCU2LBLs - ebMZ26MuVI5wP+qzPbSguSGpUUXQk/aiKmoA1a3kBNywUPIm3s0H8WK+E6NzLQj/Oo3B2QO489OL3h8b - 4f9iWiS4/HkfuuUdMEmrFQnc7bbxPgx9GMT9RA8GpiT0TVWjM16BK7ESSDE7mmTjH4Kzyd2IfG1EcYeY - YeK1Ah0F7HxdVkaXLIz8ZkaSyMgnMGrWM7qgZe6QCcfiRXg914+DwW0pqs1Sd9buuwKefbuH62NnQDUr - /jmkJaBp6ByeysOw+MTlnfLxgRPY2V66/M9ENeTh8R/dRL8BDkAXagnC/hIAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsPAAALDwGS+QOlAAACX0lE - QVQ4T6WSa0hTYRjHD/TBvhRdqE99Koi+RFFB9SGjUAsvLYzEjMxFTKVkk6XpSC1N0eVtadqMvAw1b5Uo - KUUiJI7uGs7oIpEauZa1s3nP4tc5RwZNBgW98OPA+77/3/O8D0cA/gufmz3tOXTdzqS1KhVtTMh2X3c8 - CC21RXoJPFQVHMdpr2PSfoORwXySNUEUZeu5ZjRgyk6SCVwsYEZsZs7VxIyzHku5nqnxGpJjVbbXvSlc - OBtKinoH9p6TjHesRxt9SMotEsjhOVcDZTkn6LPmI34qYWzQwAfrKdoqVMRG+VOXto4XRQLxx0K8BU01 - BQsC8RbGtGgy9JEYEiI4Hx+OXqNCpw4lLiqAYu0GRRAZ7O8tqK80Mis2MuswMzWai+NVAraa1QoD1avo - K1/GU5OfEpYJ2L3VW2Ax5zDtqGJ6OIupN2eYfHkEsX05hdUd5JpbuXi1kRSjBV1mBbGpJqIT87wFlaWZ - TIyYmBzUMPEsFPejbXy5u0YJe9bc/E+crhmGx5xExF0iLMYgby8IKgrTEd9m4X4ShLt7M67OtYxUC0pl - eVXe6VEwN3QxMGRXwg96bRwIV8vHglCal8q3/nO4ujYh3luJo9mPoZuC0vaP+V98d0uVPzsZeG/H2v+R - 4CgdQVJ4/8HD+O/Zi1B8OQnH4zgpvIKvLUsZrV2CrUxAK71ZbtvTwXWpgxJLJ23dNuUrs2vLRoQrGYnK - D+KZsgeNNLA/Kz+0vlPCzff7aOh47iUILEw/Lf1hKtThgYTt26kcyNOW3+yp5gtFIA/CF0elacsX/obP - 8L+D8Bsb4cocWY3wtQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAPJJREFUOE/VUasOgzAU7SfsD8a34FFTOATJzMQ0P0GwS30lAjU1MT2HXz2iggCy - 62kuUMi6YSZ2kpOc3hfnctlP0fd9aaiJJYWXcAoWVErtmqbRYRhaQiNGbTNMsdofhWYHbgmN2DAMSVVV - 0wBoxKhtRtd15+tDTgOgETNDyizLpgHQiFHbEqbhdrrcNQjt2k/TVMdxbLV3DWMtgG2yHrj2hRC6KAqr - vWus4dqXUuq6rq3+uMYI134URZpzbok36F1jhGv/Hb+usbZv3pab1oA1FMM6/n7btk9KMWhcAznU+K6R - jF8k5pSCs9zNbbrGP4CxF/VIZUt4e+oNAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAO9JREFUOE+1UTEOgkAQvCf4BF/gI+hJTPyATzCW2PMKW0tjQY+tvsAXWFFcBZTn - zbF7LOtBYeIkkwyzsMzcmb/CWrvqus5JwqPxiL7v135oQWiy4e/runZZlgVCw6PxiLZt76fL04HQZBu/ - 8FaWZVwADY/GA/wHh8fr7czuHAgNj+PneR4XQMOb1EDszfEaF0DD0/GZXzWwcYYxflEUgdDJGhq+whZL - OH5VVYHQyRoaOn7TNIH8PHsbDBk/xcUaqdPXXKyh4+NFSfZna/iXJqePZxqF2eJt6Pg4efkXaH0bNBqA - F2BKyp78A0ka/QpjPuRAtoD1VSrCAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACASURBVDhPtY9LDoAgDAU5kmfgcOw5oUdgAWGLvqSNoJRv - nKQxKDOp6ldCCEeM0d2TakPX6rBsjEla6880Az0ZIwakta21Y4EcxLz3J2+Sb9QNvH8DT0hDAUnmAJ0d - XS8RZEfvizMpDy0Z3xFYlsGWDLZkkTwwLTMcWZIZiPOyUhdBN2onEKujgwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6 - JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsTAAALEwEAmpwYAAACtUlE - QVQ4T6WRXUhTYRjHT94EdRF1ZdZyzEJC6qowDCT67qJouUDFvvzIMqWVJWIaWUqJKy0dmmIJabYmOZyO - PuhCBWsaDudhOrc0tnQfzn143nPOPtp5Ome0teFVdPGD93nf5//jed8XA4D/IqagXbJSSl+JSF2Zn8Rv - Bknd7QDSnPeQi41N0X3RRBa0620Docn2UdbWH16PCsJQlmc/EV7sR9oCmxWvuRUd5vgTlpUj/FqAsnc4 - aU8fihE4X/soe6drWSs2L4+KvKRFmrlKQM5UeCn7i0UuAH0lAI1nARQlIQHt6GZoRw9DWlo9esVJ8vun - c3I0X3MgVoCLgXb3LoUEjSLQCzDIZI+87n5oUQ1A/mMlSOQqcEyVW9Vtex0GlbBhlYBa7gpNQGTthAp2 - 25CIAWVrgnyJArA0FuwSoLlSZB7JmXtXnexamcpPjwiIcZGPND/RcAIO9joMF6aszZCUpQRsA0uKnBME - XNN5zoEanneiI7k5IkDGsqvGgf00MtUP0pY2K7UoZSirlCHNEkDmWjYoBmS8AshQBC48B32o59PqFoH8 - r8BUx2cf5uDwc15Q3ZUKS8NHwY0XBIjZy4zEkA6nP2JQKMeA0OfB0riQFWzzfpXyekICNH8/Dhkr13IF - B4EXFfdXbwxax84wxGwu3NAnQcpTDLCLnCAXFkZOuBT3NjET7VtKIxMQM+K4sMCiFDDqlq0W25gQVqYv - QKFyHWDXMdjxCAPnZIb/28vdzt6qeObzw/WhTCi0os1bExbYBvlgUOyZcGuz2GvksBIWXXbQoREGpt+l - Itmd+KC6OSH2G6MxqdKODUkEHvvwIbCMHAeH+hSYhg6TX17tC8grE3yT7ZsfRPdHFu7RI5EpdN27RL13 - ty+8r0sMvqlK/NVXm+TXdvA752W8jHBPmJji3wHsN7OS3a71kl/7AAAAAElFTkSuQmCC - - - diff --git a/PROMS/Volian.Controls.Library/Properties/Settings.Designer.cs b/PROMS/Volian.Controls.Library/Properties/Settings.Designer.cs deleted file mode 100644 index 3c9e111d..00000000 --- a/PROMS/Volian.Controls.Library/Properties/Settings.Designer.cs +++ /dev/null @@ -1,93 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Volian.Controls.Library.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public global::System.Collections.Specialized.StringCollection BookMarks { - get { - return ((global::System.Collections.Specialized.StringCollection)(this["BookMarks"])); - } - set { - this["BookMarks"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public global::System.Collections.Specialized.StringCollection SearchList { - get { - return ((global::System.Collections.Specialized.StringCollection)(this["SearchList"])); - } - set { - this["SearchList"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public global::System.Collections.Specialized.StringCollection SearchAList { - get { - return ((global::System.Collections.Specialized.StringCollection)(this["SearchAList"])); - } - set { - this["SearchAList"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public global::System.Collections.Specialized.StringCollection FindTextList { - get { - return ((global::System.Collections.Specialized.StringCollection)(this["FindTextList"])); - } - set { - this["FindTextList"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public global::System.Collections.Specialized.StringCollection ReplaceTextList { - get { - return ((global::System.Collections.Specialized.StringCollection)(this["ReplaceTextList"])); - } - set { - this["ReplaceTextList"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string ImportWordFilePath { - get { - return ((string)(this["ImportWordFilePath"])); - } - set { - this["ImportWordFilePath"] = value; - } - } - } -} diff --git a/PROMS/Volian.Controls.Library/Properties/Settings.settings b/PROMS/Volian.Controls.Library/Properties/Settings.settings deleted file mode 100644 index 9f93a2c9..00000000 --- a/PROMS/Volian.Controls.Library/Properties/Settings.settings +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/Properties/licenses.licx b/PROMS/Volian.Controls.Library/Properties/licenses.licx deleted file mode 100644 index 7606ef69..00000000 --- a/PROMS/Volian.Controls.Library/Properties/licenses.licx +++ /dev/null @@ -1,2 +0,0 @@ -C1.Win.C1FlexGrid.C1FlexGrid, C1.Win.C1FlexGrid.2 -C1.Win.C1SpellChecker.C1SpellChecker, C1.Win.C1SpellChecker.2 diff --git a/PROMS/Volian.Controls.Library/RTBAPI.cs b/PROMS/Volian.Controls.Library/RTBAPI.cs deleted file mode 100644 index 9d7ed96b..00000000 --- a/PROMS/Volian.Controls.Library/RTBAPI.cs +++ /dev/null @@ -1,1109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Drawing; -using System.Runtime.InteropServices; -using System.ComponentModel; - -namespace Volian.Controls.Library -{ - public static class RTBAPI - { - #region SendMessage - [DllImport("user32.dll", SetLastError = true)] - private static extern int SendMessage(HandleRef hWndlock, Messages wMsg, Int32 wParam, ref Point pt); - [DllImport("user32.dll", SetLastError = true)] - private static extern int SendMessage(HandleRef hWndlock, Messages wMsg, Int32 wParam, int lParam); - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern int SendMessage(HandleRef hWndlock, Messages wMsg, RTBSelection wParam, ref CharFormat2 cf2); - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern int SendMessage(HandleRef hWndlock, Messages wMsg, int wParam, ref ParaFormat2 pf2); - [DllImport("user32.dll", SetLastError = true)] - private static extern int GetWindowLong (IntPtr hWin, int index); - #region RTB Messages - // EM_AUTOURLDETECT - An EM_AUTOURLDETECT message enables or disables automatic detection of URLs by a rich edit control. - // EM_CANPASTE - The EM_CANPASTE message determines whether a rich edit control can paste a specified clipboard format. - // EM_CANREDO - The EM_CANREDO message determines whether there are any actions in the control redo queue. - // EM_DISPLAYBAND - The EM_DISPLAYBAND message displays a portion of the contents of a rich edit control, as previously formatted for a device using the EM_FORMATRANGE message. - // EM_EXGETSEL - The EM_EXGETSEL message retrieves the starting and ending character positions of the selection in a rich edit control. - // EM_EXLIMITTEXT - The EM_EXLIMITTEXT message sets an upper limit to the amount of text the user can type or paste into a rich edit control. - // EM_EXLINEFROMCHAR - The EM_EXLINEFROMCHAR message determines which line contains the specified character in a rich edit control. - // EM_EXSETSEL - The EM_EXSETSEL message selects a range of characters or COM objects in a Rich Edit control. - // EM_FINDTEXT - The EM_FINDTEXT message finds text within a rich edit control. - // EM_FINDTEXTEX - The EM_FINDTEXTEX message finds text within a rich edit control. - // EM_FINDTEXTEXW - The EM_FINDTEXTEXW message finds Unicode text within a rich edit control. - // EM_FINDTEXTW - The EM_FINDTEXTW message finds Unicode text within a rich edit control. - // EM_FINDWORDBREAK - The EM_FINDWORDBREAK message finds the next word break before or after the specified character position or retrieves information about the character at that position. - // EM_FORMATRANGE - The EM_FORMATRANGE message formats a range of text in a rich edit control for a specific device. - // EM_GETAUTOURLDETECT - The EM_GETAUTOURLDETECT message indicates whether the auto URL detection is turned on in the rich edit control. - // EM_GETBIDIOPTIONS - The EM_GETBIDIOPTIONS message indicates the current state of the bidirectional options in the rich edit control. - // EM_GETCHARFORMAT - The EM_GETCHARFORMAT message determines the character formatting in a rich edit control. - // EM_GETCTFMODEBIAS - An application sends a EM_GETCTFMODEBIAS message to get the Text Services Framework mode bias values for a Rich Edit control. - // EM_GETCTFOPENSTATUS - An application sends an EM_GETCTFOPENSTATUS message to determine if the Text Services Framework (TSF) keyboard is open or closed. - // EM_GETEDITSTYLE - The EM_GETEDITSTYLE message retrieves the current edit style flags. - // EM_GETEVENTMASK - The EM_GETEVENTMASK message retrieves the event mask for a rich edit control. The event mask specifies which notification messages the control sends to its parent window. - // EM_GETHYPHENATEINFO - An application sends an EM_GETHYPHENATEINFO message to get information about hyphenation for a Rich Edit control. - // EM_GETIMECOLOR - The EM_GETIMECOLOR message retrieves the Input Method Editor (IME) composition color. This message is available only in Asian-language versions of the operating system. - // EM_GETIMECOMPMODE - An application sends an EM_GETIMECOMPMODE message to get the current IME mode for a rich edit control. - // EM_GETIMECOMPTEXT - An application sends an EM_GETIMECOMPTEXT message to get the IME composition text. - // EM_GETIMEMODEBIAS - An application sends an EM_GETIMEMODEBIAS message to get the IME mode bias for a Rich Edit control. - // EM_GETIMEOPTIONS - The EM_GETIMEOPTIONS message retrieves the current IME options. This message is available only in Asian-language versions of the operating system. - // EM_GETIMEPROPERTY - An application sends a EM_GETIMEPROPERTY message to get the property and capabilities of the IME associated with the current input locale. - // EM_GETLANGOPTIONS - An application sends an EM_GETLANGOPTIONS message to get a rich edit control's option settings for IME and Asian language support. - // EM_GETOLEINTERFACE - The EM_GETOLEINTERFACE message retrieves an IRichEditOle object that a client can use to access a rich edit control's COM functionality. - // EM_GETOPTIONS - The EM_GETOPTIONS message retrieves rich edit control options. - // EM_GETPAGEROTATE - Deprecated. An application sends an EM_GETPAGEROTATE message to get the text layout for a Rich Edit control. - // EM_GETPARAFORMAT - The EM_GETPARAFORMAT message retrieves the paragraph formatting of the current selection in a rich edit control. - // EM_GETPUNCTUATION - The EM_GETPUNCTUATION message gets the current punctuation characters for the rich edit control. This message is available only in Asian-language versions of the operating system. - // EM_GETREDONAME - An application sends an EM_GETREDONAME message to a rich edit control to retrieve the type of the next action, if any, in the control's redo queue. - // EM_GETSCROLLPOS - An application sends an EM_GETSCROLLPOS message to obtain the current scroll position of the edit control. - // EM_GETSELTEXT - The EM_GETSELTEXT message retrieves the currently selected text in a rich edit control. - // EM_GETTEXTEX - The EM_GETTEXTEX message allows you to get all of the text from the rich edit control in any particular code base you want. - // EM_GETTEXTLENGTHEX - The EM_GETTEXTLENGTHEX message calculates text length in various ways. It is usually called before creating a buffer to receive the text from the control. - // EM_GETTEXTMODE - An application sends an EM_GETTEXTMODE message to get the current text mode and undo level of a rich edit control. - // EM_GETTEXTRANGE - The EM_GETTEXTRANGE message retrieves a specified range of characters from a rich edit control. - // EM_GETTYPOGRAPHYOPTIONS - The EM_GETTYPOGRAPHYOPTIONS message returns the current state of the typography options of a rich edit control. - // EM_GETUNDONAME - Rich Edit 2.0 and later: An application sends an EM_GETUNDONAME message to a rich edit control to retrieve the type of the next undo action, if any. - // EM_GETWORDBREAKPROCEX - The EM_GETWORDBREAKPROCEX message retrieves the address of the currently registered extended word-break procedure. - // EM_GETWORDWRAPMODE - The EM_GETWORDWRAPMODE message gets the current word wrap and word-break options for the rich edit control. This message is available only in Asian-language versions of the operating system. - // EM_GETZOOM - The EM_GETZOOM message gets the current zoom ratio, which is always between 1/64 and 64. - // EM_HIDESELECTION - The EM_HIDESELECTION message hides or shows the selection in a rich edit control. - // EM_ISIME - An application sends a EM_ISIME message to determine if current input locale is an East Asian locale. - // EM_PASTESPECIAL - The EM_PASTESPECIAL message pastes a specific clipboard format in a rich edit control. - // EM_RECONVERSION - The EM_RECONVERSION message invokes the IME reconversion dialog box. - // EM_REDO - Send an EM_REDO message to a rich edit control to redo the next action in the control's redo queue. - // EM_REQUESTRESIZE - The EM_REQUESTRESIZE message forces a rich edit control to send an EN_REQUESTRESIZE notification message to its parent window. - // EM_SELECTIONTYPE - The EM_SELECTIONTYPE message determines the selection type for a rich edit control. - // EM_SETBIDIOPTIONS - The EM_SETBIDIOPTIONS message sets the current state of the bidirectional options in the rich edit control. - // EM_SETBKGNDCOLOR - The EM_SETBKGNDCOLOR message sets the background color for a rich edit control. - // EM_SETCHARFORMAT - The EM_SETCHARFORMAT message sets character formatting in a rich edit control. - // EM_SETCTFMODEBIAS - An application sends an EM_SETCTFMODEBIAS message to set the Text Services Framework (TSF) mode bias for a Rich Edit control. - // EM_SETCTFOPENSTATUS - An application sends an EM_SETCTFOPENSTATUS message to open or close the Text Services Framework (TSF) keyboard. - // EM_SETEDITSTYLE - The EM_SETEDITSTYLE message sets the current edit style flags. - // EM_SETEVENTMASK - The EM_SETEVENTMASK message sets the event mask for a rich edit control. The event mask specifies which notification messages the control sends to its parent window. - // EM_SETFONTSIZE - The EM_SETFONTSIZE message sets the font size for the selected text. - // EM_SETHYPHENATEINFO - An application sends an EM_SETHYPHENATEINFO message to set the way a Rich Edit control does hyphenation. - // EM_SETIMECOLOR - The EM_SETIMECOLOR message sets the IME composition color. This message is available only in Asian-language versions of the operating system. - // EM_SETIMEMODEBIAS - An application sends an EM_SETIMEMODEBIAS message to set the IME mode bias for a Rich Edit control. - // EM_SETIMEOPTIONS - The EM_SETIMEOPTIONS message sets the IME options. This message is available only in Asian-language versions of the operating system. - // EM_SETLANGOPTIONS - An application sends an EM_SETLANGOPTIONS message to set options for IME and Asian language support in a rich edit control. - // EM_SETOLECALLBACK - The EM_SETOLECALLBACK message gives a rich edit control an IRichEditOleCallback object that the control uses to get OLE-related resources and information from the client. - // EM_SETOPTIONS - The EM_SETOPTIONS message sets the options for a rich edit control. - // EM_SETPAGEROTATE - Deprecated. An application sends an EM_SETPAGEROTATE message to set the text layout for a Rich Edit control. - // EM_SETPALETTE - An application sends an EM_SETPALETTE message to change the palette that rich edit uses for its display window. - // EM_SETPARAFORMAT - The EM_SETPARAFORMAT message sets the paragraph formatting for the current selection in a rich edit control. - // EM_SETPUNCTUATION - The EM_SETPUNCTUATION message sets the punctuation characters for a rich edit control. This message is available only in Asian-language versions of the operating system. - // EM_SETSCROLLPOS - An application sends an EM_SETSCROLLPOS message to tell the rich edit control to scroll to a particular point. - // EM_SETTARGETDEVICE - The EM_SETTARGETDEVICE message sets the target device and line width used for "what you see is what you get" (WYSIWYG) formatting in a rich edit control. - // EM_SETTEXTEX - The EM_SETTEXTEX message combines the functionality of WM_SETTEXT and EM_REPLACESEL and adds the ability to set text using a code page and to use either rich text or plain text. - // EM_SETTEXTMODE - An application sends an EM_SETTEXTMODE message to set the text mode or undo level of a rich edit control. The message fails if the control contains any text. - // EM_SETTYPOGRAPHYOPTIONS - The EM_SETTYPOGRAPHYOPTIONS message sets the current state of the typography options of a rich edit control. - // EM_SETUNDOLIMIT - An application sends an EM_SETUNDOLIMIT message to a rich edit control to set the maximum number of actions that can stored in the undo queue. - // EM_SETWORDBREAKPROCEX - The EM_SETWORDBREAKPROCEX message sets the extended word-break procedure. - // EM_SETWORDWRAPMODE - The EM_SETWORDWRAPMODE message sets the word-wrapping and word-breaking options for the rich edit control. This message is available only in Asian-language versions of the operating system. - // EM_SETZOOM - The EM_SETZOOM message sets the zoom ratio anywhere between 1/64 and 64. - // EM_SHOWSCROLLBAR - The EM_SHOWSCROLLBAR message shows or hides one of the scroll bars in the Text Host window. - // EM_STOPGROUPTYPING - An application sends an EM_STOPGROUPTYPING message to a rich edit control to stop the control from collecting additional typing actions into the current undo action. The control stores the next typing action, if any, into a new action in the undo queue. - // EM_STREAMIN - The EM_STREAMIN message replaces the contents of a rich edit control with a stream of data provided by an application defined - // EM_STREAMOUT - The EM_STREAMOUT message causes a rich edit control to pass its contents to an application - #endregion - #endregion - #region Constants - //const int ECOOP_XOR = 0x0004; - - //const int ECO_AUTOWORDSELECTION = 0x00000001; - - - const int WM_USER = 0x0400; - const int GWL_STYLE = -16; - const int WS_HSCROLL = 0x100000; - const int WS_VSCROLL = 0x200000; - - #endregion - #region Enums - public enum Messages : int - { - EM_AUTOURLDETECT = WM_USER + 91, - EM_CANPASTE = WM_USER + 50, - EM_CANREDO = WM_USER + 85, - EM_DISPLAYBAND = WM_USER + 51, - EM_EXGETSEL = WM_USER + 52, - EM_EXLIMITTEXT = WM_USER + 53, - EM_EXLINEFROMCHAR = WM_USER + 54, - EM_EXSETSEL = WM_USER + 55, - EM_FINDTEXT = WM_USER + 56, - EM_FINDTEXTEX = WM_USER + 79, - EM_FINDTEXTEXW = WM_USER + 124, - EM_FINDTEXTW = WM_USER + 123, - EM_FINDWORDBREAK = WM_USER + 76, - EM_FORMATRANGE = WM_USER + 57, - EM_GETAUTOURLDETECT = WM_USER + 92, - EM_GETBIDIOPTIONS = WM_USER + 201, - EM_GETCHARFORMAT = WM_USER + 58, - EM_GETCTFMODEBIAS = WM_USER + 237, - EM_GETCTFOPENSTATUS = WM_USER + 240, - EM_GETEDITSTYLE = WM_USER + 205, - EM_GETEVENTMASK = WM_USER + 59, - EM_GETHYPHENATEINFO = WM_USER + 230, - EM_GETIMECOLOR = WM_USER + 105, - EM_GETIMECOMPMODE = WM_USER + 122, - EM_GETIMECOMPTEXT = WM_USER + 242, - EM_GETIMEMODEBIAS = WM_USER + 127, - EM_GETIMEOPTIONS = WM_USER + 107, - EM_GETIMEPROPERTY = WM_USER + 244, - EM_GETLANGOPTIONS = WM_USER + 121, - EM_GETOLEINTERFACE = WM_USER + 60, - EM_GETOPTIONS = WM_USER + 78, - EM_GETPAGEROTATE = WM_USER + 235, - EM_GETPARAFORMAT = WM_USER + 61, - EM_GETPUNCTUATION = WM_USER + 101, - EM_GETREDONAME = WM_USER + 87, - EM_GETSCROLLPOS = WM_USER + 221, - EM_GETSELTEXT = WM_USER + 62, - EM_GETTEXTEX = WM_USER + 94, - EM_GETTEXTLENGTHEX = WM_USER + 95, - EM_GETTEXTMODE = WM_USER + 90, - EM_GETTEXTRANGE = WM_USER + 75, - EM_GETTYPOGRAPHYOPTIONS = WM_USER + 203, - EM_GETUNDONAME = WM_USER + 86, - EM_GETWORDBREAKPROCEX = WM_USER + 80, - EM_GETWORDWRAPMODE = WM_USER + 103, - EM_GETZOOM = WM_USER + 224, - EM_HIDESELECTION = WM_USER + 63, - EM_ISIME = WM_USER + 243, - EM_PASTESPECIAL = WM_USER + 64, - EM_RECONVERSION = WM_USER + 125, - EM_REDO = WM_USER + 84, - EM_REQUESTRESIZE = WM_USER + 65, - EM_SELECTIONTYPE = WM_USER + 66, - EM_SETBIDIOPTIONS = WM_USER + 200, - EM_SETBKGNDCOLOR = WM_USER + 67, - EM_SETCHARFORMAT = WM_USER + 68, - EM_SETCTFMODEBIAS = WM_USER + 238, - EM_SETCTFOPENSTATUS = WM_USER + 241, - EM_SETEDITSTYLE = WM_USER + 204, - EM_SETEVENTMASK = WM_USER + 69, - EM_SETFONTSIZE = WM_USER + 223, - EM_SETHYPHENATEINFO = WM_USER + 231, - EM_SETIMECOLOR = WM_USER + 104, - EM_SETIMEMODEBIAS = WM_USER + 126, - EM_SETIMEOPTIONS = WM_USER + 106, - EM_SETLANGOPTIONS = WM_USER + 120, - EM_SETOLECALLBACK = WM_USER + 70, - EM_SETOPTIONS = WM_USER + 77, - EM_SETPAGEROTATE = WM_USER + 236, - EM_SETPALETTE = WM_USER + 93, - EM_SETPARAFORMAT = WM_USER + 71, - EM_SETPUNCTUATION = WM_USER + 100, - EM_SETSCROLLPOS = WM_USER + 222, - EM_SETTARGETDEVICE = WM_USER + 72, - EM_SETTEXTEX = WM_USER + 97, - EM_SETTEXTMODE = WM_USER + 89, - EM_SETTYPOGRAPHYOPTIONS = WM_USER + 202, - EM_SETUNDOLIMIT = WM_USER + 82, - EM_SETWORDBREAKPROCEX = WM_USER + 81, - EM_SETWORDWRAPMODE = WM_USER + 102, - EM_SETZOOM = WM_USER + 225, - EM_SHOWSCROLLBAR = WM_USER + 96, - EM_STOPGROUPTYPING = WM_USER + 88, - EM_STREAMIN = WM_USER + 73, - EM_STREAMOUT = WM_USER + 74 - }; - [Flags] - public enum LanguageOptions : int // Options for EM_SETLANGOPTIONS and EM_GETLANGOPTIONS - { - IMF_AUTOKEYBOARD = 0x0001, - IMF_AUTOFONT = 0x0002, - IMF_IMECANCELCOMPLETE = 0x0004, // high completes the comp string when aborting, low cancels. - IMF_IMEALWAYSSENDNOTIFY = 0x0008 - } - public enum TimeCompMode : int // Values for EM_GETIMECOMPMODE - { - ICM_NOTOPEN = 0x0000, - ICM_LEVEL3 = 0x0001, - ICM_LEVEL2 = 0x0002, - ICM_LEVEL2_5 = 0x0003, - ICM_LEVEL2_SUI = 0x0004 - } - [Flags] - public enum EditControlOptions : int // Edit control options - { - ECO_AUTOWORDSELECTION = 0x00000001, - ECO_AUTOVSCROLL = 0x00000040, - ECO_AUTOHSCROLL = 0x00000080, - ECO_NOHIDESEL = 0x00000100, - ECO_READONLY = 0x00000800, - ECO_WANTRETURN = 0x00001000, - ECO_SAVESEL = 0x00008000, - ECO_SELECTIONBAR = 0x01000000, - ECO_VERTICAL = 0x00400000, // FE specific - } - public enum EcoOperations : int // ECO operations - { - ECOOP_SET = 0x0001, - ECOOP_OR = 0x0002, - ECOOP_AND = 0x0003, - ECOOP_XOR = 0x0004 - } - public enum WordBreakFunctionActions : int // new word break function actions - { - WB_CLASSIFY = 3, - WB_MOVEWORDLEFT = 4, - WB_MOVEWORDRIGHT = 5, - WB_LEFTBREAK = 6, - WB_RIGHTBREAK = 7 - } - //#define PC_FOLLOWING 1 - //#define PC_LEADING 2 - //#define PC_OVERFLOW 3 - //#define PC_DELIMITER 4 - //#define WBF_WORDWRAP 0x010 - //#define WBF_WORDBREAK 0x020 - //#define WBF_OVERFLOW 0x040 - //#define WBF_LEVEL1 0x080 - //#define WBF_LEVEL2 0x100 - //#define WBF_CUSTOM 0x200 - /* Word break flags (used with WB_CLASSIFY) */ - //#define WBF_CLASS ((BYTE) 0x0F) - //#define WBF_ISWHITE ((BYTE) 0x10) - //#define WBF_BREAKLINE ((BYTE) 0x20) - //#define WBF_BREAKAFTER ((BYTE) 0x40) - ///* Far East specific flags */ - //#define IMF_FORCENONE 0x0001 - //#define IMF_FORCEENABLE 0x0002 - //#define IMF_FORCEDISABLE 0x0004 - //#define IMF_CLOSESTATUSWINDOW 0x0008 - //#define IMF_VERTICAL 0x0020 - //#define IMF_FORCEACTIVE 0x0040 - //#define IMF_FORCEINACTIVE 0x0080 - //#define IMF_FORCEREMEMBER 0x0100 - //#define IMF_MULTIPLEEDIT 0x0400 - public enum RTBSelection : int - { - SCF_DEFAULT = 0x0000, - SCF_SELECTION = 0x0001, - SCF_WORD = 0x0002, - SCF_ALL = 0x0004, - SCF_USEUIRULES = 0x0008 - } - [Flags] - public enum CharFormatMasks : uint - { - CFM_NONE = 0, - CFM_BOLD = 0x00000001, - CFM_ITALIC = 0x00000002, - CFM_UNDERLINE = 0x00000004, - CFM_STRIKEOUT = 0x00000008, - CFM_PROTECTED = 0x00000010, - CFM_LINK = 0x00000020, // Exchange hyperlink extension - CFM_SIZE = 0x80000000, - CFM_COLOR = 0x40000000, - CFM_FACE = 0x20000000, - CFM_OFFSET = 0x10000000, - CFM_CHARSET = 0x08000000, - CFM_SMALLCAPS = 0x0040, - CFM_ALLCAPS = 0x0080, - CFM_HIDDEN = 0x0100, - CFM_OUTLINE = 0x0200, - CFM_SHADOW = 0x0400, - CFM_EMBOSS = 0x0800, - CFM_IMPRINT = 0x1000, - CFM_DISABLED = 0x2000, - CFM_REVISED = 0x4000, - CFM_BACKCOLOR = 0x04000000, - CFM_LCID = 0x02000000, - CFM_UNDERLINETYPE = 0x00800000, - CFM_WEIGHT = 0x00400000, - CFM_SPACING = 0x00200000, - CFM_KERNING = 0x00100000, - CFM_STYLE = 0x00080000, - CFM_ANIMATION = 0x00040000, - CFM_REVAUTHOR = 0x00008000, - CFM_SUBSCRIPT = 0x00010000, - CFM_SUPERSCRIPT = 0x00020000 - // CFM_SUBorSUPERSCRIPT = 0x00030000 - } - [Flags] - public enum CharFormatEffects : uint - { - CFE_NONE = 0, - CFE_BOLD = 0x0001, - CFE_ITALIC = 0x0002, - CFE_UNDERLINE = 0x0004, - CFE_STRIKEOUT = 0x0008, - CFE_PROTECTED = 0x0010, - CFE_LINK = 0x0020, - CFE_AUTOBACKCOLOR = 0x04000000, // NOTE: this corresponds to CFM_BACKCOLOR, which controls it - CFE_AUTOCOLOR = 0x40000000, // NOTE: this corresponds to CFM_COLOR, which controls it - CFE_SUBSCRIPT = 0x00010000, // Superscript and subscript are - CFE_SUPERSCRIPT = 0x00020000, // mutually exclusive - CFE_SMALLCAPS = 0x0040, - CFE_ALLCAPS = 0x0080, - CFE_HIDDEN = 0x0100, - CFE_OUTLINE = 0x0200, - CFE_SHADOW = 0x0400, - CFE_EMBOSS = 0x0800, - CFE_IMPRINT = 0x1000, - CFE_DISABLED = 0x2000, - CFE_REVISED = 0x4000 - } - public enum CharUnderline : byte - { - CFU_UNDERLINENONE = 0, - CFU_UNDERLINE = 1, - CFU_UNDERLINEWORD = 2, // displayed as ordinary underline - CFU_UNDERLINEDOUBLE = 3, // displayed as ordinary underline - CFU_UNDERLINEDOTTED = 4, - CFU_UNDERLINEDASH = 5, - CFU_UNDERLINEDASHDOT = 6, - CFU_UNDERLINEDASHDOTDOT = 7, - CFU_UNDERLINEWAVE = 8, - CFU_UNDERLINETHICK = 9, - CFU_INVERT = 0xFE // For IME composition fake a selection. - } - [Flags] - public enum ParaFormatMasks : uint - { - PFM_NONE = 0, - PFM_STARTINDENT = 0x00000001, - PFM_RIGHTINDENT = 0x00000002, - PFM_OFFSET = 0x00000004, - PFM_ALIGNMENT = 0x00000008, - PFM_TABSTOPS = 0x00000010, - PFM_NUMBERING = 0x00000020, - PFM_SPACEBEFORE = 0x00000040, - PFM_SPACEAFTER = 0x00000080, - PFM_LINESPACING = 0x00000100, - PFM_RESERVED = 0x00000200, - PFM_STYLE = 0x00000400, - PFM_BORDER = 0x00000800, - PFM_SHADING = 0x00001000, - PFM_NUMBERINGSTYLE = 0x00002000, - PFM_NUMBERINGTAB = 0x00004000, - PFM_NUMBERINGSTART = 0x00008000, - // PFM_DIR = 0x00010000, - PFM_RTLPARA = 0x00010000, - PFM_KEEP = 0x00020000, - PFM_KEEPNEXT = 0x00040000, - PFM_PAGEBREAKBEFORE = 0x00080000, - PFM_NOLINENUMBER = 0x00100000, - PFM_NOWIDOWCONTROL = 0x00200000, - PFM_DONOTHYPHEN = 0x00400000, - PFM_SIDEBYSIDE = 0x00800000, - PFM_TABLEROWDELIMITER = 0x10000000, - PFM_TEXTWRAPPINGBREAK = 0x20000000, - PFM_TABLE = 0x40000000, - PFM_OFFSETINDENT = 0x80000000 - } - public enum ParaFormatEffects : ushort - { - PFE_RTLPARA = 0x0001, - PFE_KEEP = 0x0002, - PFE_KEEPNEXT = 0x0004, - PFE_PAGEBREAKBEFORE = 0x0008, - PFE_NOLINENUMBER = 0x0010, - PFE_NOWIDOWCONTROL = 0x0020, - PFE_DONOTHYPHEN = 0x0040, - PFE_SIDEBYSIDE = 0x0080, - PFE_TABLEROW = 0xc000, /* These 3 options are mutually */ - PFE_TABLECELLEND = 0x8000, /* exclusive and each imply */ - PFE_TABLECELL = 0x4000, /* that para is part of a table*/ - } - public enum ParaAlignment : ushort - { - PFA_LEFT = 1, - PFA_RIGHT = 2, - PFA_CENTER = 3, - PFA_JUSTIFY = 4, - PFA_FULL_INTERWORD = 5 - } - public enum ParaNumbering : ushort - { - PFN_NONE = 0, - PFN_BULLET = 1, - PFN_ARABIC = 2, - PFN_LOWER = 3, - PFN_UPPER = 4, - PFN_LOWERROMAN = 5, - PFN_UPPERROMAN = 6, - PFN_UNI = 7 - } - public enum ParaSpacing : byte - { - PFS_SINGLE = 0, - PFS_ONEANDONEHALF = 1, - PFS_DOUBLE = 2, - PFS_EXACTSINGLEMIN = 3, - PFS_EXACT = 4, - PFS_EXACT20 = 5 - } - [Flags] - public enum E_FontStyle : byte - { - FS_NONE = 0, - FS_BOLD = 0x01, - FS_UNDERLINE = 0x02, - FS_ITALIC = 0x04, - FS_SUPERSCRIPT = 0x08, - FS_SUBSCRIPT = 0x10 - } - #endregion - #region Structures - //struct CharRange - //{ - // public int cpMin; - // public int cpMax; - //} - [StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Auto)] - public struct CharFormat2 - { - public int cbSize; - public uint dwMask; - public uint dwEffects; - public int yHeight; - public int yOffset; - public int crTextColor; - public byte bCharSet; - public byte bPitchAndFamily; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] - public string szFaceName; - public short wWeight; - public short sSpacing; - public int crBackColor; - public int lcid; - public int dwReserved; - public short sStyle; - public short wKerning; - public byte bUnderlineType; - public byte bAnimation; - public byte bRevAuthor; - public byte bReserved1; - } - public class CharFormatTwo - { - public CharFormatTwo(CharFormat2 cf) - { - _CharFormat2 = cf; - } - private CharFormat2 _CharFormat2; - [Browsable(false)] - public CharFormat2 CharFormat2 - { - get { return _CharFormat2; } - } - [Browsable(false)] - public int cbSize - { - get { return _CharFormat2.cbSize; } - set { _CharFormat2.cbSize = value; } - } - [Editor(typeof(FlagEnumUIEditor), typeof(System.Drawing.Design.UITypeEditor))] - public CharFormatMasks dwMask - { - get { return (CharFormatMasks)_CharFormat2.dwMask; } - set { _CharFormat2.dwMask = (uint)value; } - } - [Editor(typeof(FlagEnumUIEditor), typeof(System.Drawing.Design.UITypeEditor))] - public CharFormatEffects dwEffects - { - get { return (CharFormatEffects)_CharFormat2.dwEffects; } - set { _CharFormat2.dwEffects = (uint)value; } - } - public int yHeight - { - get { return _CharFormat2.yHeight; } - set { _CharFormat2.yHeight = value; } - } - public int yOffset - { - get { return _CharFormat2.yOffset; } - set { _CharFormat2.yOffset = value; } - } - private Color Int2Color(int color) - { - return Color.FromArgb(color % 256, (color / 256) % 256, color / (256 * 256)); - } - private int Color2Int(Color color) - { - return color.R + (color.G * 256) + (color.B * 256 * 256); - } - public Color crTextColor - { - get { return Int2Color(_CharFormat2.crTextColor); } - set { _CharFormat2.crTextColor = Color2Int(value); } - } - public byte bCharSet - { - get { return _CharFormat2.bCharSet; } - set { _CharFormat2.bCharSet = value; } - } - public byte bPitchAndFamily - { - get { return _CharFormat2.bPitchAndFamily; } - set { _CharFormat2.bPitchAndFamily = value; } - } - public string szFaceName - { - get { return _CharFormat2.szFaceName; } - set { _CharFormat2.szFaceName = value; } - } - public short wWeight - { - get { return _CharFormat2.wWeight; } - set { _CharFormat2.wWeight = value; } - } - public short sSpacing - { - get { return _CharFormat2.sSpacing; } - set { _CharFormat2.sSpacing = value; } - } - public Color crBackColor - { - get { return Int2Color(_CharFormat2.crBackColor); } - set { _CharFormat2.crBackColor = Color2Int(value); } - } - public int lcid - { - get { return _CharFormat2.lcid; } - set { _CharFormat2.lcid = value; } - } - public int dwReserved - { - get { return _CharFormat2.dwReserved; } - set { _CharFormat2.dwReserved = value; } - } - public short sStyle - { - get { return _CharFormat2.sStyle; } - set { _CharFormat2.sStyle = value; } - } - public short wKerning - { - get { return _CharFormat2.wKerning; } - set { _CharFormat2.wKerning = value; } - } - public CharUnderline bUnderlineType - { - get { return (CharUnderline)_CharFormat2.bUnderlineType; } - set { _CharFormat2.bUnderlineType = (byte)value; } - } - public byte bAnimation - { - get { return _CharFormat2.bAnimation; } - set { _CharFormat2.bAnimation = value; } - } - public byte bRevAuthor - { - get { return _CharFormat2.bRevAuthor; } - set { _CharFormat2.bRevAuthor = value; } - } - public byte bReserved1 - { - get { return _CharFormat2.bReserved1; } - set { _CharFormat2.bReserved1 = value; } - } - } - [StructLayout(LayoutKind.Sequential, Pack = 4)] - public struct ParaFormat2 - { - public int cbSize; - public int dwMask; - public ushort wNumbering; - public short wEffects; - public int dxStartIndent; - public int dxRightIndent; - public int dxOffset; - public short wAlignment; - public short cTabCount; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public int[] rgxTabs; - public int dySpaceBefore; - public int dySpaceAfter; - public int dyLineSpacing; - public short sStyle; - public byte bLineSpacingRule; - public byte bOutlineLevel; - public short wShadingWeight; - public short wShadingStyle; - public short wNumberingStart; - public short wNumberingStyle; - public short wNumberingTab; - public short wBorderSpace; - public short wBorderWidth; - public short wBorders; - } - public class ParaFormatTwo - { - private ParaFormat2 _ParaFormat2; - public ParaFormatTwo(ParaFormat2 pf) - { - _ParaFormat2 = pf; - } - public ParaFormat2 ParaFormat2 - { - get { return _ParaFormat2; } - } - public int cbSize - { - get { return _ParaFormat2.cbSize; } - set { _ParaFormat2.cbSize = value; } - } - [Editor(typeof(FlagEnumUIEditor), typeof(System.Drawing.Design.UITypeEditor))] - public ParaFormatMasks dwMask - { - get { return (ParaFormatMasks)_ParaFormat2.dwMask; } - set { _ParaFormat2.dwMask = (int)value; } - } - public ParaNumbering wNumbering - { - get { return (ParaNumbering)_ParaFormat2.wNumbering; } - set { _ParaFormat2.wNumbering = (ushort)value; } - } - public ParaFormatEffects wEffects - { - get { return (ParaFormatEffects)_ParaFormat2.wEffects; } - set { _ParaFormat2.wEffects = (short)value; } - } - public int dxStartIndent - { - get { return _ParaFormat2.dxStartIndent; } - set { _ParaFormat2.dxStartIndent = value; } - } - public int dxRightIndent - { - get { return _ParaFormat2.dxRightIndent; } - set { _ParaFormat2.dxRightIndent = value; } - } - public int dxOffset - { - get { return _ParaFormat2.dxOffset; } - set { _ParaFormat2.dxOffset = value; } - } - public ParaAlignment wAlignment - { - get { return (ParaAlignment)_ParaFormat2.wAlignment; } - set { _ParaFormat2.wAlignment = (short)value; } - } - public short cTabCount - { - get { return _ParaFormat2.cTabCount; } - set { _ParaFormat2.cTabCount = value; } - } - public int[] rgxTabs - { - get { return _ParaFormat2.rgxTabs; } - set { _ParaFormat2.rgxTabs = value; } - } - public int dySpaceBefore - { - get { return _ParaFormat2.dySpaceBefore; } - set { _ParaFormat2.dySpaceBefore = value; } - } - public int dySpaceAfter - { - get { return _ParaFormat2.dySpaceAfter; } - set { _ParaFormat2.dySpaceAfter = value; } - } - public int dyLineSpacing - { - get { return _ParaFormat2.dyLineSpacing; } - set { _ParaFormat2.dyLineSpacing = value; } - } - public short sStyle - { - get { return _ParaFormat2.sStyle; } - set { _ParaFormat2.sStyle = value; } - } - public ParaSpacing bLineSpacingRule - { - get { return (ParaSpacing)_ParaFormat2.bLineSpacingRule; } - set { _ParaFormat2.bLineSpacingRule = (byte)value; } - } - public byte bOutlineLevel - { - get { return _ParaFormat2.bOutlineLevel; } - set { _ParaFormat2.bOutlineLevel = value; } - } - public short wShadingWeight - { - get { return _ParaFormat2.wShadingWeight; } - set { _ParaFormat2.wShadingWeight = value; } - } - public short wShadingStyle - { - get { return _ParaFormat2.wShadingStyle; } - set { _ParaFormat2.wShadingStyle = value; } - } - public short wNumberingStart - { - get { return _ParaFormat2.wNumberingStart; } - set { _ParaFormat2.wNumberingStart = value; } - } - public short wNumberingStyle - { - get { return _ParaFormat2.wNumberingStyle; } - set { _ParaFormat2.wNumberingStyle = value; } - } - public short wNumberingTab - { - get { return _ParaFormat2.wNumberingTab; } - set { _ParaFormat2.wNumberingTab = value; } - } - public short wBorderSpace - { - get { return _ParaFormat2.wBorderSpace; } - set { _ParaFormat2.wBorderSpace = value; } - } - public short wBorderWidth - { - get { return _ParaFormat2.wBorderWidth; } - set { _ParaFormat2.wBorderWidth = value; } - } - public short wBorders - { - get { return _ParaFormat2.wBorders; } - set { _ParaFormat2.wBorders = value; } - } - } - #endregion - #region Static Methods - public static bool HasVertScroll(Control ctl) - { - int dwstyle = GetWindowLong(ctl.Handle, GWL_STYLE); - return (dwstyle & WS_VSCROLL) != 0; - } - public static bool HasHorzScroll(Control ctl) - { - int dwstyle = GetWindowLong(ctl.Handle, GWL_STYLE); - return (dwstyle & WS_HSCROLL) != 0; - } - public static void SetScrollLocation(RichTextBox richTextBox, Point point) - { - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETSCROLLPOS, 0, ref point) == 0) - throw new Win32Exception(); - } - public static Point GetScrollLocation(RichTextBox richTextBox) - { - Point pt = new Point(); - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_GETSCROLLPOS, 0, ref pt) == 0) - throw new Win32Exception(); - return pt; - } - public static void SetBackgroundColor(RichTextBox richTextBox, Color color) - { - int clr = color.R + (color.G * 256) + (color.B * 256 * 256); - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETBKGNDCOLOR, 0, clr) == 0) - throw new Win32Exception(); - } - public static void SetAuto(RichTextBox richTextBox) - { - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETOPTIONS, (int)EcoOperations.ECOOP_XOR, (int)EditControlOptions.ECO_AUTOWORDSELECTION) == 0) - throw new Win32Exception(); - } - public static ParaFormatTwo GetParaFormat(RichTextBox richTextBox) - { - ParaFormat2 pf = new ParaFormat2(); - pf.cbSize = Marshal.SizeOf(pf); - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_GETPARAFORMAT, 0, ref pf) == 0) - throw new Win32Exception(); - return new ParaFormatTwo(pf); - } - public static void SetParaFormat(RichTextBox richTextBox, ParaFormatTwo pft) - { - ParaFormat2 pf2 = pft.ParaFormat2; - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETPARAFORMAT, 0, ref pf2) == 0) - { - //if(Marshal.GetLastWin32Error()!=0) - throw new Win32Exception(); - } - } - public static CharFormatTwo GetCharFormat(RichTextBox richTextBox, RTBSelection selection) - { - CharFormat2 cf = new CharFormat2(); - cf.cbSize = Marshal.SizeOf(cf); - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_GETCHARFORMAT, selection, ref cf) == 0) - throw new Win32Exception(); - return new CharFormatTwo(cf); - } - public static void SetCharFormat(RichTextBox richTextBox, RTBSelection selection, CharFormatTwo cft) - { - try - { - CharFormat2 cf2 = cft.CharFormat2; - try - { - HandleRef hr = new HandleRef(richTextBox, richTextBox.Handle); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - } - if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETCHARFORMAT, selection, ref cf2) == 0) - throw new Win32Exception(); - } - catch (Exception ex) - { - Console.WriteLine("Error on SetCharFormat {0}", ex.Message); - } - - } - public static void SetHighlightColor(RichTextBox richTextBox, RTBSelection selection, Color color) - { - CharFormatTwo cft = GetCharFormat(richTextBox, selection); - cft.crBackColor = color; - cft.dwEffects = 0; - cft.dwMask = 0; - cft.dwMask |= CharFormatMasks.CFM_BACKCOLOR; - SetCharFormat(richTextBox, selection, cft); - } - public static void SetSpaceBefore(RichTextBox richTextBox, int spaceBefore) - { - ParaFormatTwo pft = GetParaFormat(richTextBox); - pft.dwMask = 0; - pft.dwMask |= ParaFormatMasks.PFM_SPACEBEFORE; - // 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.dySpaceBefore = spaceBefore * 1440 / dpi; - 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) - { - ParaFormatTwo pft = GetParaFormat(richTextBox); - pft.bLineSpacingRule = type; - pft.dwMask = 0; - pft.dwMask |= ParaFormatMasks.PFM_LINESPACING; - 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.dyLineSpacing = Convert.ToInt32(.5 + richTextBox.Font.GetHeight(dpi)) * 1440 / dpi; - SetParaFormat(richTextBox, pft); - } - public static E_FontStyle GetFontStyle(RichTextBox richTextBox) - { - E_FontStyle fs = E_FontStyle.FS_NONE; - CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION); - if (((cft.dwMask & CharFormatMasks.CFM_BOLD) == CharFormatMasks.CFM_BOLD) && - ((cft.dwEffects & CharFormatEffects.CFE_BOLD) == CharFormatEffects.CFE_BOLD)) fs |= E_FontStyle.FS_BOLD; - if (((cft.dwMask & CharFormatMasks.CFM_UNDERLINE) == CharFormatMasks.CFM_UNDERLINE) && - ((cft.dwEffects & CharFormatEffects.CFE_UNDERLINE) == CharFormatEffects.CFE_UNDERLINE)) fs |= E_FontStyle.FS_UNDERLINE; - if (((cft.dwMask & CharFormatMasks.CFM_ITALIC) == CharFormatMasks.CFM_ITALIC) && - ((cft.dwEffects & CharFormatEffects.CFE_ITALIC) == CharFormatEffects.CFE_ITALIC)) fs |= E_FontStyle.FS_ITALIC; - if (richTextBox.SelectionCharOffset == -2) fs |= E_FontStyle.FS_SUBSCRIPT; - if (richTextBox.SelectionCharOffset == 2) fs |= E_FontStyle.FS_SUPERSCRIPT; - return fs; - } - public static void SetFontStyle(RichTextBox richTextBox, E_FontStyle fs) - { - CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION); - if ((fs & E_FontStyle.FS_BOLD) == E_FontStyle.FS_BOLD) - { - cft.dwEffects |= CharFormatEffects.CFE_BOLD; - cft.dwMask |= CharFormatMasks.CFM_BOLD; - } - if ((fs & E_FontStyle.FS_UNDERLINE) == E_FontStyle.FS_UNDERLINE) - { - cft.dwEffects |= CharFormatEffects.CFE_UNDERLINE; - cft.dwMask |= CharFormatMasks.CFM_UNDERLINE; - } - if ((fs & E_FontStyle.FS_ITALIC) == E_FontStyle.FS_ITALIC) - { - cft.dwEffects |= CharFormatEffects.CFE_ITALIC; - cft.dwMask |= CharFormatMasks.CFM_ITALIC; - } - if ((fs & E_FontStyle.FS_SUBSCRIPT) == E_FontStyle.FS_SUBSCRIPT) - { - richTextBox.SelectionCharOffset = -2; - } - if ((fs & E_FontStyle.FS_SUPERSCRIPT) == E_FontStyle.FS_SUPERSCRIPT) - { - richTextBox.SelectionCharOffset = 2; - } - SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft); - } - public static bool IsSuperScript(RichTextBox richTextBox) - { - return (richTextBox.SelectionCharOffset>0); - } - public static bool IsSubScript(RichTextBox richTextBox) - { - return (richTextBox.SelectionCharOffset < 0); - } - public static void ToggleSubscript(bool bSet, RichTextBox richTextBox, RTBSelection selection) - { - if (bSet) - richTextBox.SelectionCharOffset = -2; - else - richTextBox.SelectionCharOffset = 0; - } - public static void ToggleSuperscript(bool bSet, RichTextBox richTextBox, RTBSelection selection) - { - if (bSet) - richTextBox.SelectionCharOffset = 2; - else - richTextBox.SelectionCharOffset = 0; - } - public static bool IsBold(RichTextBox richTextBox) - { - CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION); - return (((cft.dwMask & CharFormatMasks.CFM_BOLD) == CharFormatMasks.CFM_BOLD) && - ((cft.dwEffects & CharFormatEffects.CFE_BOLD) == CharFormatEffects.CFE_BOLD)); - } - public static void ToggleBold(bool bSet, RichTextBox richTextBox, RTBSelection selection) - { - CharFormatTwo cft = GetCharFormat(richTextBox, selection); - if (bSet) - { - cft.dwEffects = CharFormatEffects.CFE_BOLD; - cft.dwMask = CharFormatMasks.CFM_BOLD; - } - else - { - cft.dwEffects = CharFormatEffects.CFE_NONE; - cft.dwMask = CharFormatMasks.CFM_BOLD; - } - SetCharFormat(richTextBox, selection, cft); - } - public static bool IsUnderline(RichTextBox richTextBox) - { - CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION); - return (((cft.dwMask & CharFormatMasks.CFM_UNDERLINE) == CharFormatMasks.CFM_UNDERLINE) && - ((cft.dwEffects & CharFormatEffects.CFE_UNDERLINE) == CharFormatEffects.CFE_UNDERLINE)); - } - public static void ToggleUnderline(bool bSet, RichTextBox richTextBox, RTBSelection selection) - { - CharFormatTwo cft = GetCharFormat(richTextBox, selection); - if (bSet) - { - cft.dwEffects = CharFormatEffects.CFE_UNDERLINE; - cft.dwMask = CharFormatMasks.CFM_UNDERLINE; - } - else - { - cft.dwEffects = CharFormatEffects.CFE_NONE; - cft.dwMask = CharFormatMasks.CFM_UNDERLINE; - } - SetCharFormat(richTextBox, selection, cft); - } - public static bool IsItalic(RichTextBox richTextBox) - { - CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION); - return (((cft.dwMask & CharFormatMasks.CFM_ITALIC) == CharFormatMasks.CFM_ITALIC) && - ((cft.dwEffects & CharFormatEffects.CFE_ITALIC) == CharFormatEffects.CFE_ITALIC)); - } - public static void ToggleItalic(bool bSet, RichTextBox richTextBox, RTBSelection selection) - { - CharFormatTwo cft = GetCharFormat(richTextBox, selection); - if (bSet) - { - cft.dwEffects = CharFormatEffects.CFE_ITALIC; - cft.dwMask = CharFormatMasks.CFM_ITALIC; - } - else - { - cft.dwEffects = CharFormatEffects.CFE_NONE; - cft.dwMask = CharFormatMasks.CFM_ITALIC; - } - 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 - } -} diff --git a/PROMS/Volian.Controls.Library/RTBItem.cs b/PROMS/Volian.Controls.Library/RTBItem.cs deleted file mode 100644 index cb52e865..00000000 --- a/PROMS/Volian.Controls.Library/RTBItem.cs +++ /dev/null @@ -1,1087 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Text.RegularExpressions; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; - -namespace Volian.Controls.Library -{ - #region Enums - public enum ExpandingStatus : int - { - No = 0, - Expanding = 1, - Colapsing = 2, - Hiding = 4, - Showing = 8, - Done = 16 - } - public enum EnhancedAddTypes : int - { - No = 0, - Before = 1, - After = 2, - Child = 3, - Replace = 4 - } - #endregion - public partial class RTBItem : EditItem - { - #region Private Fields - - public Label MyLabel - { get { return lblTab; } } - /// - /// Used to connect the RichTextBox with the menus and toolbars - /// - public override StepRTB MyStepRTB - { - get { return _MyStepRTB; } - } - public override int TableWidth { get { return (int)GetTableWidth(_MyStepRTB.Font, MyItemInfo.MyContent.Text, true); } } - - /// - /// The left edge of the Tab - /// - public override int ItemLeft - { - get { return Left + lblTab.Left; } - set { Left = value - lblTab.Left; } - } - /// - /// The Location of the Tab - /// - public override Point ItemLocation - { - get { return new Point(Location.X + lblTab.Left, Location.Y); } - set { Location = new Point(value.X - lblTab.Left, value.Y); } - } - /// - /// Width of the Tab and RTB - /// - public override int ItemWidth - { - get { return Width - lblTab.Left; } - set - { - Width = CheckOffMargin + RTBMargin + value + lblTab.Left; - } - } - /// - /// Width of the RichTextBox - /// - public override int ContentWidth - { - get { return _MyStepRTB.Width; } - set - { - // This is wrong for single column (KBR) - RHM Debug: - //MyStepRTB.Width = value; - Width = value + lblTab.Left + lblTab.Width + (this.Width - MyStepRTB.Right); - } - } - public override int BorderWidth { get { return (_MyStepRTB.Width - _MyStepRTB.ClientRectangle.Width); } } - /// - /// Location of the RichTextBox - /// - public override Point ContentLocation - { - get { return new Point(Location.X + _MyStepRTB.Left, Location.Y); } - set { Location = new Point(value.X - _MyStepRTB.Left, value.Y); } - } - /// - /// Left edge of the RichTextBox - /// - public override int ContentLeft - { - get { return Left + _MyStepRTB.Left; } - } - /// - /// Returns the status of the vlnExpander unless it is in the process of expanding or collapsing - /// If it is colapsing it returns false - /// If it is expanding it returns true - /// - public override bool Expanded - { - get - { - return !Colapsing && (MyExpandingStatus != ExpandingStatus.No || _MyvlnExpander.Expanded); - } - set - { - _MyvlnExpander.Expanded = value; - } - } - - #endregion - #region IEditItem - override public void AdjustTableWidthAndLocation() - { - _MyStepRTB.Font = MyStepData.Font.WindowsFont; - ItemWidth = (int)GetTableWidth(_MyStepRTB.Font, MyItemInfo.MyContent.Text, true); - ItemLocation = new Point(50, _MyParentEditItem.Bottom); - ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth); - } - - override public void SetToolTip(string tip) - { - DevComponents.DotNetBar.SuperTooltipInfo tpi = new DevComponents.DotNetBar.SuperTooltipInfo("", "", tip, null, null, DevComponents.DotNetBar.eTooltipColor.Lemon); - _MyToolTip.MinimumTooltipSize = new Size(0, 24); - _MyToolTip.TooltipDuration = 3; - _MyToolTip.SetSuperTooltip(MyStepRTB, tpi); - ToolTipOnOff(); // B2025-050 Show the tooltip based on User Options Settings - } - public override void ToolTipOnOff() - { - _MyToolTip.Enabled = VlnSettings.StepTypeToolTip; // B2025-XXX Show the tooltip based on User Options Settings - } - public override void RefreshContent() - { - MyStepRTB.RefreshDisplay(); - IdentifyMe(false); - SetExpandAndExpander(MyItemInfo); - } - public override void RefreshOrdinal() - { - TabFormat = null; // Reset Tab - } - /// - /// Tab Format used for outputing the Tab - /// - - public override string TabFormat - { - get - { - if (_TabFormat == null) TabFormat = null; // execute 'set' code. - return _TabFormat; - } - set - { - if (MyItemInfo != null) - { - ItemInfo.ResetTabString(MyID); - 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) - // calculate the width based upon characters per inch considering user's DPI - // F2023-048: Attachment text overwriting Attachment number. (Changed to 11 from 12) - note this - // was reported for Beaver Valley but could happen for any long section numbers - int cpi = MyItemInfo.IsStep ? (int)MyItemInfo.FormatStepData.TabData.Font.CPI : 11; - - // if the tab ends with a single digit & has a '.' before it, add space for the possibility - // that the number can be two digits, for example... 8.1.9 goes to 8.1.10. We want - // the step windows to line up, so the 8.1.9 has one character more space (lastDigitSingle) - // F2023-048: Attachment text overwriting Attachment number, only add 1 to label width if is a step tab - bool lastDigitSingle = Regex.IsMatch(tabString, "^.*[^0-9][0-9] *$"); - lblTab.Width = ((lastDigitSingle && MyItemInfo.IsStep ? 1 : 0) + tabString.Length) * MyStepPanel.DPI / cpi; - 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 - // flags background steps and IsHigh is for the HLS - Cautions/Notes were ok), was added - // for hls in background documents - without this, the tab gets overwritten by the rtb. - // B2017-184: in the following if statement, added the SpecialCaseCalvertAlarm flag & 20002 so that, in the default text size setting of the windows display - // the last 'W' of 'WINDOW' tab (for the Device window step type, 20002) would not get cut off. - if (MyItemInfo.FormatStepData == null || MyItemInfo.FormatStepData.TabData.IdentEdit.Contains("{Section Prefix}") || !MyItemInfo.IsHigh || - (MyItemInfo.IsHigh && MyItemInfo.FormatStepData.PageBreakOnStep) || (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && MyItemInfo.MyContent.Type == 20002)) - _MyStepRTB.Left = lblTab.Left + lblTab.Width; - _MyStepRTB.Width = Width - _MyStepRTB.Left - RTBMargin - CheckOffMargin; - } - _TabFormat = value; - } - } - } - - #endregion - #region Properties - private static int _RTBMargin = 3; - /// - /// 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. - /// - public static int RTBMargin - { - get { return _RTBMargin; } - set { _RTBMargin = value; } - } - private int? _CheckOffMargin = null; - /// - /// Margin between the EditItem and the StepRTB. Appears on the Right. - /// Will allow space to draw a CheckOff on the right side of the EditItem. - /// - public int CheckOffMargin - { - get - { - if (_CheckOffMargin == null) - { - if (MyItemInfo == null) _CheckOffMargin = 0; - else - { - if (!MyItemInfo.IsStep || !MyItemInfo.SectionHasCheckOffs()) _CheckOffMargin = 0; - else - { - Graphics g = CreateGraphics(); - SizeF sz = g.MeasureString("M", MyItemInfo.FormatStepData.Font.WindowsFont); - _CheckOffMargin = (int)sz.Width; - } - } - } - return (int)_CheckOffMargin; - } - set { _CheckOffMargin = value; } - } - private EnhancedAddTypes _EnhAddType = EnhancedAddTypes.No; - public EnhancedAddTypes EnhAddType - { - get { return _EnhAddType; } - 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 - #region Constructors - public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand) - { - // 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) - expand |= (!itemInfo.IsStepPart && itemInfo.ActiveParent.IsSection) && !itemInfo.IsSubsection; - //// TIMING: DisplayItem.TimeIt("CSLARTB Top"); - InitializeComponent();// TODO: Performance 25% - SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, false); - MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged); - } - public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem) - { - // 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) - expand |= (!itemInfo.IsStepPart && itemInfo.ActiveParent is SectionInfo) && !itemInfo.IsSubsection; - //// TIMING: DisplayItem.TimeIt("CSLARTB Top"); - InitializeComponent();// TODO: Performance 25% - SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false); - MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged); - } - public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, bool addFirstChld) - { - // 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) - expand |= (!itemInfo.IsStepPart && itemInfo.ActiveParent is SectionInfo) && !itemInfo.IsSubsection; - //// TIMING: DisplayItem.TimeIt("CSLARTB Top"); - InitializeComponent();// TODO: Performance 25% - SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, addFirstChld); - 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() - { - SetupHeader(MyItemInfo); - LastMethodsPush("SetupHeader"); - Height = _MyStepRTB.Height + _MyStepRTB.Top + 7; - LastMethodsPop(); - } - void _MyStepRTB_Resize(object sender, EventArgs e) - { - if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem) - ScrollToCenter(); - //MyStepPanel.ScrollControlIntoView(this); - } - void MyStepRTB_TextChanged(object sender, EventArgs e) - { - if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem) - ScrollToCenter(); - //MyStepPanel.ScrollControlIntoView(this); - } - private Label lblHeader = null; - private Label lblFooter = null; - private void SetupHeaderFooter(ref Label lbl, string name, MetaTag mTag) - { - if (lbl == null) lbl = new Label(); - lbl.BackColor = System.Drawing.Color.Transparent; - lbl.Location = new System.Drawing.Point(0, 0); - lbl.Name = name; - lbl.Size = new System.Drawing.Size(this.Width, 23); - lbl.Visible = true; - lbl.Font = mTag.MyFont.WindowsFont; - lbl.Text = mTag.CleanText; - lbl.TextAlign = mTag.Justify; - this.Controls.Add(lbl); - } - #endregion - #region EventHandlers - /// - /// When the RichTextBox height changes, change the height of the control to match - /// - /// - /// - 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) - { - LastMethodsPush(string.Format("_StepRTB_HeightChanged {0}", _MyStepRTB.Height)); - this.Height = _MyStepRTB.Height + _MyStepRTB.Top + 7; - LastMethodsPop(); - } - } - /// - /// When a RichTextBox is entered, the selected StepRTB is set - /// - /// - /// - private bool _ProcessingEnter = false; - private void _StepRTB_Enter(object sender, EventArgs e) - { - // B2018-006 If a step is expanding, don't handle the enter event - if (MyStepPanel.ExpandingHLS != null) return; - if (MyStepPanel.DisplayItemChanging) return; - //vlnStackTrace.ShowStack("_StepRTB_Enter {0}",this.MyID); - MyStepPanel.SelectedEditItem = this; - if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.SyncEnhancedDocuments) - { - if (!_ProcessingEnter) - { - _ProcessingEnter = true; - DisplayTabItem dti = null; - // Syncronize any open Enhanced Documents - if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.SyncEnhancedDocuments) - { - StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config); - foreach (EnhancedDocument ed in sc.MyEnhancedDocuments) - { - if (ed.Type != 0) - { - ItemInfo ii = ItemInfo.Get(ed.ItemID); - //if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(ii)) - if (ii != null) - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnRefreshEnhancedDocument(new ItemSelectedChangedEventArgs(ii)); - if (dti != null) - dti.MyStepTabPanel.MyDisplayTabControl.OpenItem(this.MyItemInfo); - } - } - } - _ProcessingEnter = false; - } - } - } - /// - /// Pass the AttachmentClick event to the StepPanel control. - /// - /// - /// - private void vlnExp_AttachmentClick(object sender, vlnExpanderEventArgs args) - { - if (_MyvlnExpander.AutoTOC) return; - - MyStepPanel.OnAttachmentClicked(sender, new StepPanelAttachmentEventArgs(this)); - } - /// - /// Handle the colape event - /// - /// - /// - private void vlnExp_BeforeColapse(object sender, vlnExpanderEventArgs args) - { - Cursor tmp = Cursor.Current; - 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; - Colapsing = true; - // Hide Children - HideChildren(); - // Adjust Positions - int topOffsetAfter = TopMostEditItem.Top + MyStepPanel.VerticalScroll.Value; - ExpandPrefix = topOffset - topOffsetAfter; - //ExpandSuffix = BottomMostEditItem.Bottom - Bottom; - if (topOffsetAfter != topOffset) - { - LastMethodsPush(string.Format("Colapse {0}", MyID)); - MyStepPanel.ItemMoving++; - Top += (topOffset - topOffsetAfter); - MyStepPanel.ItemMoving--; - LastMethodsPop(); - } - else - AdjustLocation(); - BottomMostEditItem.AdjustLocation(); - Colapsing = false; - Cursor.Current = tmp; - } - /// - /// Handle the expand event - /// - /// - /// - private void vlnExp_BeforeExpand(object sender, vlnExpanderEventArgs args) - { - Cursor tmp = Cursor.Current; - Cursor.Current = Cursors.WaitCursor; - if (!_Loading && MyExpandingStatus == ExpandingStatus.No) - { - if (MyStepPanel.AutoExpand) - Expand((ContentType >= 20000) || MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format); - else - Expand(false); - } - Cursor.Current = tmp; - } - - /// - /// Raises an ItemClick event when the user clicks on the Tab - /// - /// - /// - private void lblTab_MouseDown(object sender, MouseEventArgs e) - { - MyStepPanel.OnItemClick(this, new StepPanelEventArgs(this, e)); - } - /// - /// Handle the LinkGoTO event - /// - /// - /// - private void _MyStepRTB_LinkGoTo(object sender, StepPanelLinkEventArgs args) - { - _MyLog.DebugFormat("_DisplayRTB_LinkGoTo " + args.LinkInfoText); - MyStepPanel.OnLinkClicked(sender, args); - } - void _MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args) - { - MyStepRTB.UpdateStepRtb(args.LinkText, args.ValText); - } - - /// - /// Raise a OnLinkModifyTran event, when the user chooses to Modify a transition - /// - /// - /// - private void _MyStepRTB_LinkModifyTran(object sender, StepPanelLinkEventArgs args) - { - MyStepPanel.OnLinkModifyTran(sender, args); - } - /// - /// Raise a OnLinkModifyRO event, when the user chooses to modify an RO - /// - /// - /// - private void _MyStepRTB_LinkModifyRO(object sender, StepPanelLinkEventArgs args) - { - MyStepPanel.OnLinkModifyRO(sender, 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); - } - //private void _MyStepRTB_ModeChange(object sender, StepRTBModeChangeEventArgs args) - //{ - // MyStepPanel.OnModeChange(sender as StepRTB, args); - //} - void _MyStepRTB_SetMenu(object sender, StepRTBMenuEventArgs args) - { - if (args.MenuGroup == null) - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu(); - else if (args.MenuGroup == "OpenContextMenu") - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetContextMenu(sender); - else - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetShortCutContextMenu(args.MenuGroup); - } - void _MyStepRTB_AdjustTableWidth(object sender, StepRTBTableWidthEventArgs args) - { - //if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) - if (MyItemInfo.IsTable || MyItemInfo.IsFigure) - { - if (args.EditMode) - { - // First get ColR - int colR = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); - // Second get WidS - int widS = /* _WidthAdjust + borderWidth + */ MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode); - //int wNew = MyRTBItem.MyStepPanel.ToDisplay(MyRTBItem.MyStepSectionLayoutData.WidT); - int wNew = 70 + widS + colR * MyItemInfo.ColumnMode; - if (wNew > ItemWidth) - { - ItemWidth = wNew; - ItemLocation = TableLocation(MyStepSectionLayoutData, wNew); - } - } - else - { - int newwidth = (int)GetTableWidth(MyStepRTB.Font, MyStepRTB.Text, false); - if (ItemWidth != newwidth) - { - ItemWidth = newwidth; - ItemLocation = TableLocation(MyStepSectionLayoutData, newwidth); - } - } - } - } - /// - /// Calculate TableWidth based upon the the contents - /// - /// - /// - /// - /// - private float GetTableWidth(Font myFont, string txt, bool addBorder) - { - string[] lines = txt.Split("\n".ToCharArray()); - float max = 0; - using (Graphics g = this.CreateGraphics()) - { - PointF pnt = new PointF(0, 0); - foreach (string line in lines) - { - 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); - // MeasureString doesn't work properly if the line include graphics characters. - // So, Measure a string of the same length with 'M's. - SizeF siz = g.MeasureString("".PadLeft(lineAdj.Length + (addBorder ? 2 : 0), 'M'), myFont, pnt, StringFormat.GenericTypographic); - float wid = siz.Width; - if (wid > max) - { - max = wid; - } - } - } - float widLimit = (float)MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode); - widLimit += (float)MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColS); - widLimit += (float)MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); - max += MyStepPanel.MyStepPanelSettings.TableWidthAdjust; - return Math.Min(max, widLimit); - } - bool _MyStepRTB_IsNotCurrentSelection(object sender, System.EventArgs args) - { - return MyStepPanel.SelectedEditItem != this; - } - void _MyStepRTB_OpenAnnotations(object sender, System.EventArgs args) - { - OpenAnnotations(); - } - void _MyStepRTB_ToggleChangeBar(object sender, System.EventArgs args) // used with shortcut key - { - ToggleChangeBar(); - } - void _MyStepRTB_ToggleContinuousActionSummary(object sender, System.EventArgs args) // used with shortcut key - { - ToggleContinuousActionSummary(); - } - void _MyStepRTB_TogglePlaceKeeper(object sender, System.EventArgs args) // used with shortcut key - { - TogglePlaceKeeper(); - } - void _MyStepRTB_TogglePlaceKeeperContAct(object sender, System.EventArgs args) // used with shortcut key - { - TogglePlaceKeeperContAct(); - } - void _MyStepRTB_ToggleSuperScript(object sender, System.EventArgs args) // used with shortcut key <=> - { - ToggleSuperScript(); - } - void _MyStepRTB_ToggleSubScript(object sender, System.EventArgs args) // used with shortcut key <=> - { - ToggleSubScript(); - } - - void _MyStepRTB_InsertPgBrk(object sender, System.EventArgs args) // used with shortcut key - { - InsertPgBrk(); - } - void _MyStepRTB_EnterKeyPressed(object sender, System.Windows.Forms.KeyEventArgs args) - { - if (!MyItemInfo.IsTablePart) - { - args.Handled = true; - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ProcessEnterKey(); - } - } - bool _MyStepRTB_CheckClipboard(object sender, System.EventArgs args) - { - return CheckClipboard(); - } - void _MyStepRTB_CopyStep(object sender, System.EventArgs args) - { - CopyStep(); - } - void _MyStepRTB_OpenContextMenu(object sender, StepRTBLocationEventArgs args) - { - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.OpenContextMenu(args.Location, sender); - } - void _MyStepRTB_DoMouseWheel(object sender, System.Windows.Forms.MouseEventArgs args) - { - DoMouseWheel(args); - } - void _MyStepRTB_DoSaveContents(object sender, System.EventArgs args) - { - SaveContents(); - } - #endregion - #region override methods - public override void RefreshTab() - { - TabFormat = null; - SetupHeader(); - } - public override void SetFocus() - { - MyStepRTB.Focus(); - } - public override void SaveContents() - { - if (MyStepRTB.Text.Contains("\\")) - { - MyStepRTB.Visible = false; - while (MyStepRTB.Text.Contains("\\")) - { - int loc = MyStepRTB.Text.IndexOf("\\"); - MyStepRTB.SelectionStart = loc; - MyStepRTB.SelectionLength = 1; - MyStepRTB.SelectedText = ""; - } - SaveText(); - - MyStepRTB.Visible = true; - } - else - SaveText(); - SaveConfig(); // This may be redundant - StepRTB.DidEditorialSpellCheck = false; - if (StepRTB.MySpellCheckDlg != null) - StepRTB.MySpellCheckDlg.DidCorrectSpelling = false; - } - public void SaveText() - { - bool existingChangeBar = MyStepRTB.MyItemInfo.HasChangeBar; - if (MyStepRTB.ReadOnly) return; - if (!MyStepRTB.ActiveMode) return; - if (MyStepRTB.IsExperimenting) return; - - // F2019 - 069: Hold Point designator for Barakah, allow for using Default Text from format - if (MyStepRTB.MyItemInfo.MyContent.Number != null && (!MyStepRTB.IsDirty && !MyStepRTB.OrigDisplayText.AddedDefaultTextFromFmt) && MyStepRTB.Text.Contains("(Resolved Transition Text)") == false) return; - MyStepRTB.OrigDisplayText.AddedDefaultTextFromFmt = false; - - bool hasChangeBar = MyStepRTB.MyItemInfo.HasChangeBar; - bool success = MyStepRTB.OrigDisplayText.Save((RichTextBox)MyStepRTB); - 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. - // 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. - if (sc == null) sc = new StepConfig(); - if (MyStepRTB.MyItemInfo.IsStep && - MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds - && !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange) - { - sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId; - } - // C2015-028 Add Editorial Mode to PROMS Step Editor - // if in Editorial Mode, treat it the same as if the ChangeIds are set in the Format file - if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsInEditorialMode && !existingChangeBar) - { - sc.Step_ChangeIDEditorialMode = Volian.Base.Library.VlnSettings.UserID; - } - else - { - sc.Step_ChangeIDEditorialMode = null; - } - // B2020-017: If making an editorial change, clear the Change id. Having the change id on - // was adding/printing a change bar. - // C2015-028 Add Editorial Mode to PROMS Step Editor - // if in Editorial Mode, treat it the same as if the ChangeIds are set in the Format file - if (MyStepRTB.MyItemInfo.IsStep && - (MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds - || MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsInEditorialMode - ) - && MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange - && !hasChangeBar) - { - if (sc == null) sc = new StepConfig(); - sc.Step_ChangeID = null; - } - // B2015-024 Have Spell Checker text changes be an editorial change (not assign a change bar but keep existing change bar) - // C2015-028 Add Editorial Mode to PROMS Step Editor - // if in Editorial Mode, treat it the same as if the Rditorial SprllCheck flag is set in the Format file - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck || this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsInEditorialMode) - { - if (StepRTB.DidEditorialSpellCheck) - { - if (sc == null) sc = new StepConfig(); - sc.Step_SpellCheckerChangedText = (existingChangeBar) ? "KeepChangeBar" : "NoChangeBar"; - } - else if (sc != null) - sc.Step_SpellCheckerChangedText = null; // clear spell checker changed text flag B2015-024 - } - - // 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 - // 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. - // B2017-056 there were duplicate audit records for each step text change, - // only clear the change bar override if it is being used - if (sc != null && sc.Step_CBOverride != null) - sc.Step_CBOverride = null; // clear the change bar override - MyStepRTB.FindAllLinks(); - MyStepRTB.OrigRTF = MyStepRTB.Rtf; - MyStepRTB.ClearUndo(); - - // see if enhanced document related steps need to be created. - if (EnhAddType != EnhancedAddTypes.No) - { - // get the list of enhanced, may be coming from a section or a step: - EnhancedDocuments eds = EnhAddFromItemInfo.GetMyEnhancedDocuments(); - foreach (EnhancedDocument ed in eds) - { - // create a new enhanced step and link it to this new source step. - // the new source step's item is used to know what type & what to link to. - // The ed.Type & ed.itemid show what type of enhanced document (use to create new - // config Type). - ItemInfo.EAddpingPart addpart = ItemInfo.EAddpingPart.After; - if (EnhAddType == EnhancedAddTypes.Before) addpart = ItemInfo.EAddpingPart.Before; - else if (EnhAddType == EnhancedAddTypes.Child) addpart = ItemInfo.EAddpingPart.Child; - // B2017-222: if replacing, don't do the enhanced links. The past replace button isn't active for enhanced, - // however, paste replace was accessed when creating a new HLS/Caution/Note and then replacing into it. - if (MyItemInfo.MyContent.Text != "" && !DoingPasteReplace) - { - ItemInfo newEnh = MyItemInfo.DoAddEnhancedSteps(ed.Type, ed.ItemID, addpart); - if (newEnh != null) AddEnhancedItemToDisplayTabItem(newEnh); - } - } - EnhAddType = EnhancedAddTypes.No; - } - } - } - 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) - { - MyStepRTB.BringToFront(); // B2017-187 when called all the time, slows down the display of step and confuses the scroll bar - MyStepRTB.BackColor = Color.Gray; - } - else - { - if (MyStepPanel == null) return; // C2021-018 check for null reference (display alarm point table info in editor) - if (MyStepRTB.Focused) // If active Set BackColor to the active color - MyStepRTB.BackColor = MyStepPanel.ActiveColor; - else // Otherwise Set the BackColor to either the InactiveColor or the AnnotationColor - MyStepRTB.BackColor = MyItemInfo.ItemAnnotationCount == 0 ? MyStepPanel.InactiveColor : MyStepPanel.AnnotationColor; - } - } - /// - /// Gets or Sets the ability to expand - /// - public override bool CanExpand - { - get { return _MyvlnExpander.Visible; } - set { _MyvlnExpander.Visible = value; } - } - public override void HandleResize() - { - if (lblHeader != null) lblHeader.Width = this.Width; - } - public override void MatchExpanded() - { - if (!_MyvlnExpander.Expanded) - _MyvlnExpander.ShowExpanded(); - } - /// - /// Sets the focus to this RTBItem and positions the cursor to the begining of the string - /// - public override void ItemSelect() - { - // Was getting an Error that _MyStepRTB was Disposed RHM 20101217 - if (!_MyStepRTB.Disposing && !MyStepRTB.Closed) - { - _MyStepRTB.Focus(); - _MyStepRTB.Select(0, 0); - } - else - { - _MyLog.WarnFormat("Attempt to give Focus to Disposed Object {0}", MyID); - } - // if (CanExpand) AutoExpand(); // Expand the item if you can - ScrollToCenter(); - } - /// - /// Sets the focus to this RTBItem - /// - public override void ItemShow() - { - _MyStepRTB.Focus(); - ScrollToCenter(); - } - public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg) - { - return MyStepRTB.ReplaceText(rpltxt, fndstr, caseSensitive, matchWholeWord, reverse, prompt, fndrpldlg); - } - 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() - { - return; - } - public override string SelectedTextForFind - { - get - { - StepRTB srtb = MyStepRTB; - if (srtb.SelectionLength > 0) - { - if (srtb.IsSelectionLinked(srtb.SelectionStart, srtb.SelectionLength)) - return srtb.SelectedText.Substring(0, srtb.SelectedText.IndexOf("#Link")); - else - return srtb.SelectedText; - } - return null; - } - } - public override bool SpellCheckNext() - { - return MyStepRTB.SpellCheckNext(); - } - public override void SetActive() - { - MyStepRTB.BackColor = MyStepPanel.ActiveColor; - } - public override bool Empty - { - get - { - // 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 == ""; - } - 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) - { - MyStepRTB.VwMode = MyStepPanel.VwMode; - MyStepRTB.RefreshDisplay(activeMode); - //MyStepRTB.ViewRTB = !activeMode; - } - public override void ToggleEditView(E_ViewMode vwMode) - { - SaveContents(); - MyStepRTB.VwMode = vwMode; - MyStepRTB.RefreshDisplay(); - MyStepRTB.SelectionStart = 0; - MyStepRTB.SelectionLength = 0; - } - public override int TabLeft { get { return lblTab.Left; } set { lblTab.Left = value; } } - public override Font TabFont { get { return lblTab.Font; } set { lblTab.Font = value; } } - public override string TabText { get { return lblTab.Text; } } - public override Point TabLocation { get { return lblTab.Location; } } - public override Font ContentFont { get { return MyStepRTB.Font; } set { MyStepRTB.Font = value; } } - public override float ContentTop { get { return MyStepRTB.Top; } } - public override void SetupHeader(ItemInfo itemInfo) - { - lblTab.Top = 3 + ((itemInfo.HasHeader) ? 23 : 0); - _MyStepRTB.Top = lblTab.Top; // 3 + ((itemInfo.HasHeader) ? 23 : 0); - //lblTab.Move += new EventHandler(lblTab_Move); - if (itemInfo.HasHeader) - SetupHeaderFooter(ref lblHeader, "Header", itemInfo.MyHeader); - else - { - // remove header from screen if it exists: - this.Controls.Remove(lblHeader); - lblHeader = null; - } - } - public override void ShowExpanded() - { - _MyvlnExpander.ShowExpanded(); - } - /// - /// Sets the Item and as a result the text for the RichTextBox - /// - public override void SetText() - { - LastMethodsPush("SetText"); - if (MyItemInfo != null) - { - MyStepRTB.MyItemInfo = MyItemInfo; - MyStepRTB.RefreshDisplay(); - IdentifyMe(false); - } - LastMethodsPop(); - } - public override void SetExpandAndExpander(ItemInfo itemInfo) - { - // Don't allow substeps to expand - switch (ContentType / 10000) - { - case 1: // Section can expand - CanExpand = true; - // If a word document set the expander to attachment - _MyvlnExpander.Attachment = !(itemInfo.IsStepSection); - _MyvlnExpander.AutoTOC = itemInfo.IsAutoTOCSection; - //OLD: _MyvlnExpander.Attachment = (itemInfo.MyContent.ContentPartCount == 0); - break; - case 2: // High level steps with children can expand - if(MyStepPanel.AutoExpand) - CanExpand = itemInfo.IsHigh && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && itemInfo.HasChildren; // TemporaryFormat.IsHigh(item); ; - else - CanExpand = itemInfo.HasChildren; - break; - default://Procedures cannot expand, because they automatically expand - CanExpand = false; - break; - } - } - public override void SaveCurrentAndContents() - { - SaveContents(); - } - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/RTBItem.designer.cs b/PROMS/Volian.Controls.Library/RTBItem.designer.cs deleted file mode 100644 index 89321bc6..00000000 Binary files a/PROMS/Volian.Controls.Library/RTBItem.designer.cs and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/RTBItem.resx b/PROMS/Volian.Controls.Library/RTBItem.resx deleted file mode 100644 index 93e3f68d..00000000 --- a/PROMS/Volian.Controls.Library/RTBItem.resx +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - - - 148, 17 - - - True - - - True - - - True - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/Resources/Bookmark.png b/PROMS/Volian.Controls.Library/Resources/Bookmark.png deleted file mode 100644 index bf7e8a56..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/Bookmark.png and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/DeleteHS.png b/PROMS/Volian.Controls.Library/Resources/DeleteHS.png deleted file mode 100644 index 7f830593..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/DeleteHS.png and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/Find_Image.bmp b/PROMS/Volian.Controls.Library/Resources/Find_Image.bmp deleted file mode 100644 index 55516c7a..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/Find_Image.bmp and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/LibDoc.png b/PROMS/Volian.Controls.Library/Resources/LibDoc.png deleted file mode 100644 index 74532f4a..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/LibDoc.png and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/ROEditor.ico b/PROMS/Volian.Controls.Library/Resources/ROEditor.ico deleted file mode 100644 index 50c18a46..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/ROEditor.ico and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/ROEditor.png b/PROMS/Volian.Controls.Library/Resources/ROEditor.png deleted file mode 100644 index c1c78a3b..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/ROEditor.png and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/ROEditor1.png b/PROMS/Volian.Controls.Library/Resources/ROEditor1.png deleted file mode 100644 index 4d3f96fe..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/ROEditor1.png and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/SRCHRES.png b/PROMS/Volian.Controls.Library/Resources/SRCHRES.png deleted file mode 100644 index b2932509..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/SRCHRES.png and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/SRCHRES1.png b/PROMS/Volian.Controls.Library/Resources/SRCHRES1.png deleted file mode 100644 index 4a7aa4bd..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/SRCHRES1.png and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/Thumbs.db b/PROMS/Volian.Controls.Library/Resources/Thumbs.db deleted file mode 100644 index 5202aa6d..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/Thumbs.db and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/UpdRoVal.png b/PROMS/Volian.Controls.Library/Resources/UpdRoVal.png deleted file mode 100644 index cf9d6550..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/UpdRoVal.png and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/lib.png b/PROMS/Volian.Controls.Library/Resources/lib.png deleted file mode 100644 index 74532f4a..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/lib.png and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/libdoc1.png b/PROMS/Volian.Controls.Library/Resources/libdoc1.png deleted file mode 100644 index 62d04883..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/libdoc1.png and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/libdoc2.png b/PROMS/Volian.Controls.Library/Resources/libdoc2.png deleted file mode 100644 index 62d04883..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/libdoc2.png and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/Resources/libdoc3.png b/PROMS/Volian.Controls.Library/Resources/libdoc3.png deleted file mode 100644 index bd218360..00000000 Binary files a/PROMS/Volian.Controls.Library/Resources/libdoc3.png and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/RichTextBox41.Designer.cs b/PROMS/Volian.Controls.Library/RichTextBox41.Designer.cs deleted file mode 100644 index 31dfc608..00000000 --- a/PROMS/Volian.Controls.Library/RichTextBox41.Designer.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class RichTextBox41 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/RichTextBox41.cs b/PROMS/Volian.Controls.Library/RichTextBox41.cs deleted file mode 100644 index 027ec6ce..00000000 --- a/PROMS/Volian.Controls.Library/RichTextBox41.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.ComponentModel; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.Drawing; -using VEPROMS.CSLA.Library; -using System.Text.RegularExpressions; - -namespace Volian.Controls.Library -{ - public partial class RichTextBox41 : RichTextBox - { - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - static extern IntPtr LoadLibrary(string lpFileName); - - protected override CreateParams CreateParams - { - get - { - CreateParams prams = base.CreateParams; - if (LoadLibrary("msftedit.dll") != IntPtr.Zero) - { - //prams.ExStyle |= 0x020; // transparent - prams.ClassName = "RICHEDIT50W"; - } - return prams; - } - } - - public RichTextBox41() - { - InitializeComponent(); - } - - public RichTextBox41(IContainer container) - { - container.Add(this); - - InitializeComponent(); - } - } -} diff --git a/PROMS/Volian.Controls.Library/RomanNumeral.cs b/PROMS/Volian.Controls.Library/RomanNumeral.cs deleted file mode 100644 index e687686a..00000000 --- a/PROMS/Volian.Controls.Library/RomanNumeral.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Volian.Controls.Library -{ - public static class RomanNumeral - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private enum RomanOffset : int - { - Hundreds = 2, - Tens = 4, - Units = 6 - } - private static string _Romans = "MDCLXVI"; - private static string RomanPart(RomanOffset offset, int value) - { - int iFive = value / 5; - int iUnits = value % 5; - int iFour = iUnits / 4; - return _Romans.Substring(((int)offset), iFour) + - _Romans.Substring(((int)offset) - iFive - iFour, iFive | iFour) + - "".PadRight(iUnits % 4, _Romans[((int)offset)]); - } - public static string Convert(int number) - { - int thousands = number / 1000; - int hundreds = (number % 1000) / 100; - int tens = (number % 100) / 10; - int units = number % 10; - return "".PadRight(thousands, _Romans[0]) + - RomanPart(RomanOffset.Hundreds, hundreds) + - RomanPart(RomanOffset.Tens, tens) + - 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)); - // } - } -} diff --git a/PROMS/Volian.Controls.Library/RtfRawItem.cs b/PROMS/Volian.Controls.Library/RtfRawItem.cs deleted file mode 100644 index f7664f98..00000000 --- a/PROMS/Volian.Controls.Library/RtfRawItem.cs +++ /dev/null @@ -1,491 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; - -namespace Volian.Controls.Library -{ - public partial class RtfRawItem : EditItem - { - #region IEditItem - public override StepRTB MyStepRTB - { - get { return _MyStepRTB; } - } - public override int TableWidth - { - get - { - return (int)_MyStepRTB.Width + RtfRawMargin; - } - } - /// - /// The left edge of the Tab (no visible tab, but use this for EditItem interfacing - /// - public override int ItemLeft - { - get { return Left + lblTab.Left; } - set { Left = value - lblTab.Left; } - } - /// - /// The Location of the Tab - /// - public override Point ItemLocation - { - get { return new Point(Location.X + lblTab.Left, Location.Y); } - set { Location = new Point(value.X - lblTab.Left, value.Y); } - } - /// - /// Width of the Tab and RichTextBox - /// - public override int ItemWidth - { - get { return Width - lblTab.Left; } - set - { - Width = RtfRawMargin + value + lblTab.Left; - } - } - /// - /// Width of the RichTextBox - /// - public override int ContentWidth - { - get { return _MyStepRTB.Width; } - set - { - Width = value + lblTab.Left + lblTab.Width; - } - } - public override int BorderWidth { get { return (_MyStepRTB.Width - _MyStepRTB.ClientRectangle.Width); } } - /// - /// Location of the RichTextBox - /// - public override Point ContentLocation - { - get { return new Point(Location.X + _MyStepRTB.Left, Location.Y); } - set { Location = new Point(value.X - _MyStepRTB.Left, value.Y); } - } - /// - /// Left edge of the RichTextBox - /// - public override int ContentLeft - { - get { return Left + _MyStepRTB.Left; } - } - override public void AdjustTableWidthAndLocation() - { - Size sz = GetRtfRawSize(MyItemInfo.MyContent.Text); - string tmp = MyItemInfo.MyContent.Text; - if (MyItemInfo.MyContent.Text == "New Step") tmp = ""; // if coming from the tree view/insert before or after - rtf is 'New Step' - MyStepRTB.Rtf = tmp; - MyStepRTB.Width = sz.Width; - MyStepRTB.Height = sz.Height; - ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth); - Width = sz.Width; - Height = _MyStepRTB.Height + _MyStepRTB.Top + 7; - ItemWidth = Width; - } - override public void SetToolTip(string tip) - { - DevComponents.DotNetBar.SuperTooltipInfo tpi = new DevComponents.DotNetBar.SuperTooltipInfo("", "", tip, null, null, DevComponents.DotNetBar.eTooltipColor.Lemon); - _MyToolTip.MinimumTooltipSize = new Size(0, 24); - _MyToolTip.TooltipDuration = 3; - _MyToolTip.SetSuperTooltip(MyStepRTB, tpi); - ToolTipOnOff(); // B2025-050 Show the tooltip based on User Options Settings - } - public override void ToolTipOnOff() - { - _MyToolTip.Enabled = VlnSettings.StepTypeToolTip; // B2025-XXX Show the tooltip based on User Options Settings - } - public override void RefreshContent() - { - IdentifyMe(false); - MyStepRTB.Rtf = MyItemInfo.MyContent.Text; - RefreshDisplay(false); - } - public override void RefreshOrdinal() - { - TabFormat = null; - } - public override void HandleResize() {} - public override void MatchExpanded() {} - public override void ItemSelect() - { - // Was getting an Error that _MyStepRTB was Disposed RHM 20101217 - if (!_MyStepRTB.Disposing && !_MyStepRTB.Closed) - { - _MyStepRTB.Focus(); - } - else - { - _MyLog.WarnFormat("Attempt to give Focus to Disposed Object {0}", MyID); - } - ScrollToCenter(); - } - /// - /// Sets the focus to this RTBItem - /// - public override void ItemShow() - { - _MyStepRTB.Focus(); - ScrollToCenter(); - } - public override void SetActive() - { - this.BackColor = MyStepPanel.ActiveColor; - } - public override void SetText() - { - LastMethodsPush("SetText"); - if (MyItemInfo != null) - { - MyStepRTB.MyItemInfo = MyItemInfo; - IdentifyMe(false); - } - LastMethodsPop(); - } - public override void SetExpandAndExpander(ItemInfo itemInfo) - { - CanExpand = false; - } - public override void SaveCurrentAndContents() - { - SaveContents(); - } - public override void RefreshDisplay(bool activeMode) - { - MyStepRTB.VwMode = MyStepPanel.VwMode; - Size sz = GetRtfRawSize(MyStepRTB.Rtf); - if (MyStepRTB.Rtf == null || MyStepRTB.Rtf == "" - || !(MyStepRTB.Rtf.ToUpper().Contains("OBJCLASS EQU") - || MyStepRTB.Rtf.ToUpper().Contains("OBJCLASS VIS")) //Support Visio - ) // this is a new insert - { - sz.Width = 50; - sz.Height = 50; - } - MyStepRTB.Width = sz.Width; - MyStepRTB.Height = sz.Height; - if (_MyParentEditItem != null) ItemLocation = new Point(300, _MyParentEditItem.Bottom); - ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth); - Width = sz.Width; - Height = _MyStepRTB.Height + _MyStepRTB.Top + 7; - ItemWidth = Width; - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling(true); - } - public override void ToggleEditView(E_ViewMode vwMode) - { - SaveContents(); - } - public override string TabFormat - { - get { return null; } - set { ;} - } - public override bool Expanded - { - get { return true; } - set { ; } - } - public override bool CanExpand - { - get { return false; } - set { ; } - } - public override int TabLeft { get { return lblTab.Left; } set { lblTab.Left = value; } } //taken from griditem - public override Font TabFont { get { return MyStepRTB.Font; } set { ; } } - public override string TabText { get { return lblTab.Text; } } - public override Point TabLocation { get { return lblTab.Location; } } - public override Font ContentFont { get { return MyStepRTB.Font; } set { /*MyStepRTB.Font = value*/; } } - 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) - { - return DialogResult.OK; - } - public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse) - { - return false; - } - public override void PositionToEnd() - { - return; - } - public override void PositionToStart() - { - return; - } - public override string SelectedTextForFind - { - get {return null;} - } - public override bool SpellCheckNext() - { - return false; - } - public override bool Empty - { - get - { - return _MyStepRTB.Text == ""; - } - set { _MyStepRTB.Text = value ? "" : " "; } - } - public override void RefreshTab() - { - TabFormat = null; - } - public override void SetupHeader(ItemInfo itemInfo) - { - return; - } - public override void ShowExpanded() {} - #endregion - #region Properties - private static int _RtfRawMargin = 6; // make it a little bigger than rtbitems so it can be seen - /// - /// 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. - /// - public static int RtfRawMargin - { - get { return _RtfRawMargin; } - set { _RtfRawMargin = value; } - } - #endregion - #region Constructors - public RtfRawItem() - { - InitializeComponent(); - } - //existing objects: - public RtfRawItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand) - { - InitializeComponent(); - MyItemInfo = itemInfo; - SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, false); - AdjustTableWidthAndLocation(); - SetupEventHandlers(); - MyStepRTB.ReadOnly = !UserInfo.CanEdit(StepRTB.MyUserInfo, MyItemInfo.MyDocVersion); // reviewer cannot make changes to a table - MyStepRTB.Enabled = UserInfo.CanEdit(StepRTB.MyUserInfo, MyItemInfo.MyDocVersion); - MyStepRTB.OrigRTF = MyStepRTB.Rtf; - this.Controls.Add(this._MyStepRTB); - _origBitmap = GetBitmap(MyStepRTB.Rtf); //kbr - } - // the following is for inserted equations: - public RtfRawItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem) - { - InitializeComponent(); - MyItemInfo = itemInfo; - SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false); - SetupEventHandlers(); - if (MyItemInfo.MyContent.Text != null && MyItemInfo.MyContent.Text != "") - { - AdjustTableWidthAndLocation(); - MyStepRTB.OrigRTF = MyStepRTB.Rtf; - } - else - { - MyStepRTB.OrigRTF = ""; - MyStepRTB.Size = new Size(200, 200); - Width = 200; - Height = 200; - ItemWidth = Width; - ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth); - } - this.Controls.Add(this._MyStepRTB); - } - private void SetupEventHandlers() - { - MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged); - MyStepRTB.Resize += new System.EventHandler(MyStepRTB_Resize); - MyStepRTB.Enter += new System.EventHandler(_StepRTB_Enter); - MyStepRTB.HeightChanged += new Volian.Controls.Library.StepRTBEvent(_MyStepRTB_HeightChanged); - MyStepRTB.ContentsResized += new ContentsResizedEventHandler(MyStepRTB_ContentsResized); - MyStepRTB.SetMenu += new StepRTBMenuEvent(MyStepRTB_SetMenu); - MyStepRTB.CursorKeyPress += new Volian.Controls.Library.StepRTBCursorKeysEvent(MyStepRTB_CursorKeyPress); - MyStepRTB.CursorMovement += new Volian.Controls.Library.StepRTBCursorMovementEvent(MyStepRTB_CursorMovement); - Click += new EventHandler(RtfRawItem_Click); - MyStepRTB.Click += new EventHandler(RtfRawItem_Click); - } - #endregion - #region EventHandlers - void RtfRawItem_Click(object sender, EventArgs e) - { - //if (MyStepPanel.DisplayItemChanging) return; - MyStepPanel.SelectedEditItem = this; - } - 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) - { - LastMethodsPush(string.Format("_StepRTB_HeightChanged {0}", _MyStepRTB.Height)); - this.Height = _MyStepRTB.Height + _MyStepRTB.Top + 7; - LastMethodsPop(); - } - } - public void MyStepRTB_ContentsResized(object sender, ContentsResizedEventArgs e) - { - // need duplicate call for this because for modifies & restores, a single call was not setting size correctly: - RefreshDisplay(false); - RefreshDisplay(false); - } - void MyStepRTB_SetMenu(object sender, StepRTBMenuEventArgs args) - { - if (args.MenuGroup == null) - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu(); - else if (args.MenuGroup == "OpenContextMenu") - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetContextMenu(sender); - else - MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetShortCutContextMenu(args.MenuGroup); - } - private void _StepRTB_Enter(object sender, EventArgs e) - { - if (MyStepPanel.DisplayItemChanging) return; - MyStepPanel.SelectedEditItem = this; - } - #endregion - #region Methods - public override void SetFocus() - { - MyStepRTB.Focus(); - } - public override void SaveContents() - { - SaveText(); - SaveConfig(); - } - public void SaveText() - { - if (MyStepRTB.ReadOnly) return; - if (!IsDirty()) return; - try - { - string res = MyStepRTB.Rtf.Replace("\\par\r\n}", "}"); - using (Item _MyItem = MyItemInfo.Get()) - { - _MyItem.MyContent.Text = res; - _MyItem.MyContent.DTS = DateTime.Now; - _MyItem.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; - _MyItem.DTS = DateTime.Now; - _MyItem.UserID = Volian.Base.Library.VlnSettings.UserID; - _MyItem.Save(); - } - _origBitmap = GetBitmap(res); - MyStepRTB.ClearUndo(); - } - catch (Exception ex) - { - //MessageBox.Show("The data could not be saved.", "Object Save", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - } - public System.Drawing.Bitmap GetBitmap(string rtf) - { - Bitmap bmap = null; - try - { - System.Drawing.Size sz = RtfRawItem.GetRtfRawSize(rtf); - Volian.Controls.Library.RTF myRtb = new RTF(); - myRtb.Size = sz; - myRtb.Rtf = rtf; - bmap = new System.Drawing.Bitmap((int)sz.Width, (int)sz.Height); - System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bmap); - myRtb.RenderClipped(gr, new System.Drawing.Rectangle(0, 0, (int)sz.Width, (int)sz.Height)); - } - catch (Exception ex) - { - return null; - } - return bmap; - } - private System.Drawing.Bitmap _origBitmap = null; - private bool IsDirty() - { - System.Drawing.Bitmap curBitmap = GetBitmap(MyStepRTB.Rtf); - if (_origBitmap == null) return true; - return (!compare(_origBitmap, curBitmap)); - } - // compares 2 bitmaps by comparing pixels between the 2. - private bool compare(Bitmap bmp1, Bitmap bmp2) - { - bool equals = true; - bool flag = true; //Inner loop isn't broken - - //Test to see if we have the same size of image - if (bmp1.Size == bmp2.Size) - { - for (int x = 0; x < bmp1.Width; ++x) - { - for (int y = 0; y < bmp1.Height; ++y) - { - if (bmp1.GetPixel(x, y) != bmp2.GetPixel(x, y)) - { - equals = false; - flag = false; - break; - } - } - if (!flag) - { - break; - } - } - } - else - { - equals = false; - } - return equals; - } - public override void IdentifyMe(bool highlight) - { - if (highlight) - this.BackColor = Color.Gray; - else - { - if (MyStepPanel.SelectedEditItem != null && MyStepPanel.SelectedEditItem.MyItemInfo == this.MyItemInfo) - this.BackColor = MyStepPanel.ActiveColor; - else - this.BackColor = MyItemInfo.ItemAnnotationCount == 0 ? MyStepPanel.PanelColor : MyStepPanel.AnnotationColor; - } - } - public static Size GetRtfRawSize(string rtf) - { - RichTextBox rtb = new RichTextBox(); - if (rtf == "New Step") rtf = ""; // if coming from the tree view/insert before or after - rtf is 'New Step' - rtb.BorderStyle = BorderStyle.None;//Eliminate the border width - rtb.Rtf = rtf; // myRtf.Rtf;// set the contents - rtb.AppendText(" ");// Add a space after the equation - rtb.Width = 10000;// Start with a very wide richtextbox - int w = rtb.GetPositionFromCharIndex(1).X;// Get the width of the equation - rtb.Width = w;// Adjust the width - int h = rtb.GetPositionFromCharIndex(2).Y;// Get the height of the equation - return new Size(w, h);// Return the size of the Equation - } - void MyStepRTB_Resize(object sender, EventArgs e) - { - if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem) - ScrollToCenter(); - } - void MyStepRTB_TextChanged(object sender, EventArgs e) - { - if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem) - ScrollToCenter(); - } - 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); - } - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/RtfRawItem.designer.cs b/PROMS/Volian.Controls.Library/RtfRawItem.designer.cs deleted file mode 100644 index c19953c3..00000000 --- a/PROMS/Volian.Controls.Library/RtfRawItem.designer.cs +++ /dev/null @@ -1,121 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class RtfRawItem - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - _BeingDisposed = true; - DisposeOfChildren(MyAfterEditItems); - DisposeOfChildren(MyBeforeEditItems); - DisposeOfChildren(MyRNOEditItems); - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - MyItemInfo.MyContent.Changed -= new VEPROMS.CSLA.Library.ContentInfoEvent(MyContent_Changed); - MyItemInfo.MyProcedure.MyContent.Changed -= new VEPROMS.CSLA.Library.ContentInfoEvent(MyContent_Changed); - } - private void DisposeOfChildren(System.Collections.Generic.List children) - { - if (children == null) return; - foreach (EditItem child in children) - child.Dispose(); - children = null; - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - this._MyStepRTB = new Volian.Controls.Library.StepRTB(this.components); - this.lblTab = new System.Windows.Forms.Label(); - this._MyToolTip = new DevComponents.DotNetBar.SuperTooltip(); - //this._MyvlnExpander = new Volian.Controls.Library.vlnExpander(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this._MyStepRTB.Location = new System.Drawing.Point(5, 5); // moves mysteprtb down so that rtfrawitem selection borders can be seen - //this._MyStepRTB.SelectAll(); - //RTBAPI.SetLineSpacing(this._MyStepRTB, RTBAPI.ParaSpacing.PFS_DOUBLE); - - // RTBAPI.SetSpaceAfter(this._MyStepRTB, 200); - Volian.Base.Library.RTBAPI.SetSpaceBefore(this._MyStepRTB, 20); - // - // _MyStepRTB - // - // this._MyStepRTB.AdjustSize = new System.Drawing.Size(0, 0); - this._MyStepRTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._MyStepRTB.BackColor = System.Drawing.Color.Linen; - this._MyStepRTB.BorderStyle = System.Windows.Forms.BorderStyle.None; - //KBR this._MyStepRTB.CheckAbove = "|│└┬┼├┌┴┐┤"; - //KBR this._MyStepRTB.CheckBelow = "|│"; - //KBR this._MyStepRTB.CheckLeft = "-─┤┬├┼┌┐└‑"; - //KBR this._MyStepRTB.CheckRight = "-─‑"; - this._MyStepRTB.FieldToEdit = VEPROMS.CSLA.Library.E_FieldToEdit.Text; - //this._MyStepRTB.Font = new System.Drawing.Font("Prestige Elite Tall", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); - //this._MyStepRTB.Location = new System.Drawing.Point(107, 0); - this._MyStepRTB.Margin = new System.Windows.Forms.Padding(4); - this._MyStepRTB.MyClassName = "RichEdit20W"; - this._MyStepRTB.MyItemInfo = null; - this._MyStepRTB.MyLinkText = null; - this._MyStepRTB.Name = "_MyStepRTB"; - this._MyStepRTB.ProcessKeystrokes = true; - this._MyStepRTB.RTBRangeStatus = Volian.Controls.Library.StepRTB.RangeStatus.NoContainedLinks; - this._MyStepRTB.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; - this._MyStepRTB.ShowDebug = false; - //this._MyStepRTB.Size = new System.Drawing.Size(312, 25); - this._MyStepRTB.TabIndex = 2; - this._MyStepRTB.Text = ""; - this._MyStepRTB.VwMode = VEPROMS.CSLA.Library.E_ViewMode.Edit; - //KBR this._MyStepRTB.LinkGoTo += new Volian.Controls.Library.StepRTBLinkEvent(this._MyStepRTB_LinkGoTo); - //this._MyStepRTB.Enter += new System.EventHandler(this._StepRTB_Enter); - this._MyStepRTB.HeightChanged += new Volian.Controls.Library.StepRTBEvent(this._MyStepRTB_HeightChanged); - //this._MyStepRTB.ModeChange += new Volian.Controls.Library.StepRTBModeChangeEvent(this._MyStepRTB_ModeChange); - //KBR this._MyStepRTB.LinkModifyTran += new Volian.Controls.Library.StepRTBLinkEvent(this._MyStepRTB_LinkModifyTran); - //KBR this._MyStepRTB.CursorKeyPress += new Volian.Controls.Library.StepRTBCursorKeysEvent(this._MyStepRTB_CursorKeyPress); - //KBR this._MyStepRTB.CursorMovement += new Volian.Controls.Library.StepRTBCursorMovementEvent(this._MyStepRTB_CursorMovement); - //KBR this._MyStepRTB.LinkModifyRO += new Volian.Controls.Library.StepRTBLinkEvent(this._MyStepRTB_LinkModifyRO); - //KBR this._MyStepRTB.SetMenu += new StepRTBMenuEvent(_MyStepRTB_SetMenu); - //KBR this._MyStepRTB.AdjustTableWidth += new StepRTBTableWidthEvent(_MyStepRTB_AdjustTableWidth); - //KBR this._MyStepRTB.IsNotCurrentSelection += new StepRTBBooleanEvent(_MyStepRTB_IsNotCurrentSelection); - //KBR this._MyStepRTB.OpenAnnotations += new StepRTBEvent(_MyStepRTB_OpenAnnotations); - //KBR this._MyStepRTB.InsertPgBrk += new StepRTBEvent(_MyStepRTB_InsertPgBrk); - //KBR this._MyStepRTB.EnterKeyPressed += new StepRTBCursorKeysEvent(_MyStepRTB_EnterKeyPressed); - //KBR this._MyStepRTB.CheckClipboard += new StepRTBBooleanEvent(_MyStepRTB_CheckClipboard); - //KBR this._MyStepRTB.CopyStep += new StepRTBEvent(_MyStepRTB_CopyStep); - //KBR this._MyStepRTB.OpenContextMenu += new StepRTBLocationEvent(_MyStepRTB_OpenContextMenu); - //KBR this._MyStepRTB.DoMouseWheel += new StepRTBMouseEvent(_MyStepRTB_DoMouseWheel); - //KBR this._MyStepRTB.DoSaveContents += new StepRTBEvent(_MyStepRTB_DoSaveContents); - //KBR this._MyStepRTB.RoInsert += new StepRTBRoEvent(_MyStepRTB_RoInsert); - this._MyStepRTB.Resize += new System.EventHandler(MyStepRTB_Resize); - - // - // lblTab - // - this.lblTab.BackColor = System.Drawing.Color.Transparent; - this.lblTab.Location = new System.Drawing.Point(0, 0); - this.lblTab.Name = "lblTab"; - this.lblTab.Size = new System.Drawing.Size(61, 23); - this.lblTab.TabIndex = 3; - this.lblTab.Visible = false; - } - private StepRTB _MyStepRTB; - private System.Windows.Forms.Label lblTab; - private DevComponents.DotNetBar.SuperTooltip _MyToolTip; - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/Settings.cs b/PROMS/Volian.Controls.Library/Settings.cs deleted file mode 100644 index 23811ad5..00000000 --- a/PROMS/Volian.Controls.Library/Settings.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace Volian.Controls.Library.Properties { - - - // This class allows you to handle specific events on the settings class: - // The SettingChanging event is raised before a setting's value is changed. - // The PropertyChanged event is raised after a setting's value is changed. - // The SettingsLoaded event is raised after the setting values are loaded. - // The SettingsSaving event is raised before the setting values are saved. - internal sealed partial class Settings { - - public Settings() { - // // To add event handlers for saving and changing settings, uncomment the lines below: - // - // this.SettingChanging += this.SettingChangingEventHandler; - // - // this.SettingsSaving += this.SettingsSavingEventHandler; - // - } - - private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { - // Add code to handle the SettingChangingEvent event here. - } - - private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { - // Add code to handle the SettingsSaving event here. - } - } -} diff --git a/PROMS/Volian.Controls.Library/StepItem.cs b/PROMS/Volian.Controls.Library/StepItem.cs deleted file mode 100644 index 02827cea..00000000 --- a/PROMS/Volian.Controls.Library/StepItem.cs +++ /dev/null @@ -1,2427 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using System.Text.RegularExpressions; -using Volian.Base.Library; - -namespace Volian.Controls.Library -{ - #region Enums - public enum ChildRelation : int - { - None = 0, - After = 1, - Before = 2, - RNO = 3 - } - public enum ExpandingStatus : int - { - No = 0, - Expanding = 1, - Colapsing = 2, - Hiding = 4, - Showing = 8, - Done = 16 - } - public enum E_ChangeBarPosition : int - { - Left = 0, - Right = 1 - } - #endregion - public partial class StepItem : UserControl - { - //private static int _StepItemUnique = 0; - //private static int StepItemUnique - //{ - // get - // { - // if (_StepItemUnique == 3) - // Console.WriteLine("here"); - // return ++_StepItemUnique; - // } - //} - //private int _MyStepItemUnique = StepItemUnique; - - //public int MyStepItemUnique - //{ - // get {return _MyStepItemUnique; } - //} - - #region Private Fields - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private StepPanel _MyStepPanel; - - public StepPanel MyStepPanel - { - get { return _MyStepPanel; } - set { _MyStepPanel = value; } - } - private ChildRelation _MyChildRelation; - private StepItem _MyParentStepItem = null; - private StepItem _MySectionStepItem; - private StepItem _MyPreviousStepItem = null; - private StepItem _MyNextStepItem = null; - private bool _ChildrenLoaded = false; - public bool HasChildren - { - get {return _MyBeforeStepItems != null || _MyRNOStepItems != null || _MyAfterStepItems != null;} - } - private List _MyBeforeStepItems; - - public List MyBeforeStepItems - { - get { return _MyBeforeStepItems; } - set { _MyBeforeStepItems = value; } - } - private List _MyAfterStepItems; - - public List MyAfterStepItems - { - get { return _MyAfterStepItems; } - set { _MyAfterStepItems = value; } - } - private List _MyRNOStepItems; - - public List MyRNOStepItems - { - get { return _MyRNOStepItems; } - set { _MyRNOStepItems = value; } - } - public Label MyLabel - { get { return lblTab; } } - private StepSectionLayoutData _MyStepSectionLayoutData; - public StepSectionLayoutData MyStepSectionLayoutData - { - get { return _MyStepSectionLayoutData; } - set { _MyStepSectionLayoutData = value; } - } - private bool _Loading = true; - private StepData _MyStepData; - public StepData MyStepData - { - get { return _MyStepData; } - set { _MyStepData = value; } - } - private ItemInfo _MyItemInfo; - private static int _WidthAdjust = 3; - - private int _ExpandPrefix = 0; - private int _ExpandSuffix = 0; - private ExpandingStatus _MyExpandingStatus = ExpandingStatus.No; - private bool _Colapsing = false; - private bool _Moving = false; - private int _RNOLevel = 0; - private int _SeqLevel = 0; - private int _Type; - private bool _Circle = false; - private bool _CheckOff = false; - private bool _ChangeBar = false; - - #endregion - #region Properties - /// - /// This returns the section or procedure for the current item. - /// If the item is a step or section, it returns the section - /// If it is a procedure, it returns the procedure - /// - public StepItem MySectionStepItem - { - get - { - if (_MySectionStepItem == null) - { - if (MyItemInfo.IsSection || MyItemInfo.IsProcedure) _MySectionStepItem = this; - else _MySectionStepItem = _MyParentStepItem.MySectionStepItem; - } - return _MySectionStepItem; - } - set { _MySectionStepItem = value; } - } - /// - /// Gets or Sets ItemInfo - /// - public ItemInfo MyItemInfo - { - get { return _MyItemInfo; } - set - { - _MyItemInfo = value; - if (VlnSettings.StepTypeToolType)SetToolTip(_MyItemInfo.ToolTip); - ChangeBar = _MyItemInfo.HasChangeBar; - value.MyContent.Changed += new ContentInfoEvent(MyContent_Changed); - value.OrdinalChanged += new ItemInfoEvent(value_OrdinalChanged); - } - } - void value_OrdinalChanged(object sender) - { - TabFormat = null; // Reset Tab - } - private void SetToolTip(string tip) - { - DevComponents.DotNetBar.SuperTooltipInfo tpi = new DevComponents.DotNetBar.SuperTooltipInfo("", "", tip, null, null, DevComponents.DotNetBar.eTooltipColor.Lemon); - _MyToolTip.MinimumTooltipSize = new Size(0, 24); - _MyToolTip.TooltipDuration = 3; - _MyToolTip.SetSuperTooltip(MyStepRTB, tpi); - } - - public StepItem ActiveParent - { - get { return _MyParentStepItem!=null ? _MyParentStepItem : _MyPreviousStepItem.ActiveParent; } - } - void MyContent_Changed(object sender) - { - // Update the text to reflect the content change - MyStepRTB.MyItemInfo.RefreshItemAnnotations(); - MyStepRTB.MyItemInfo=MyStepRTB.MyItemInfo; // Reset Text - SetExpandAndExpander(MyItemInfo); - // TODO: Need code to update tabs ? not sure what this is - maybe for - // transitions? - } - /// - /// Used to connect the RichTextBox with the menus and toolbars - /// - public StepRTB MyStepRTB - { - get { return _MyStepRTB; } - } - /// - /// Return the Parent StepItem - /// - private StepItem UpOneStepItem - { - get - { - StepItem tmp = this; - while (tmp != null && tmp.MyParentStepItem == null) tmp = tmp.MyPreviousStepItem; - if (tmp != null) return tmp.MyParentStepItem; - return null; - } - } - /// - /// Sets the parent and postions the item with respect to the parent - /// - public StepItem MyParentStepItem - { - get { return _MyParentStepItem; } - set - { - LastMethodsPush("set_MyParentStepItem"); - _MyParentStepItem = value; - if (_MyParentStepItem != null) - { - switch (_MyChildRelation) - { - case ChildRelation.None: // Same as after - case ChildRelation.After: // Procedures, sections, substeps, and tables/figures - // The size depends upon the parent type - int iType = (int)_MyParentStepItem._Type; - - switch (iType / 10000) - { - case 0: // Procedure - ItemLocation = new Point(_MyParentStepItem.ItemLocation.X + 20, _MyParentStepItem.Bottom); - ItemWidth = _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColT) + _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidT); - break; - case 1: // Section - if(this == TopMostStepItem) - ItemLocation = new Point(_MyParentStepItem.ItemLocation.X + 20, _MyParentStepItem.Bottom); - else - TopMostStepItem.ItemLocation = new Point(TopMostStepItem.ItemLocation.X, _MyParentStepItem.Bottom); - int borderWidth = _MyStepRTB.Width - _MyStepRTB.ClientRectangle.Width; - //TextWidth = _WidthAdjust + borderWidth + _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidSTableEdit, Convert.ToInt32(_MyStepSectionLayoutData.PMode) - 1); - TextWidth = _WidthAdjust + borderWidth + _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode); - break; - case 2: // Step - // if Table then determine width and location based upon it's parent's location - if (_MyStepData.Type == "Table" || _MyStepData.ParentType == "Table") - { - _MyStepRTB.Font = _MyStepData.Font.WindowsFont; - ItemWidth = (int)TableWidth(_MyStepRTB.Font, _MyItemInfo.MyContent.Text, true); - ItemLocation = new Point(50, _MyParentStepItem.Bottom); - ItemLocation = TableLocation(_MyParentStepItem, _MyStepSectionLayoutData, ItemWidth); - } - else - { - ItemLocation = new Point(_MyParentStepItem.TextLeft, _MyParentStepItem.Bottom); - ItemWidth = _MyParentStepItem.TextWidth; - } - break; - } - break; - case ChildRelation.RNO: - // this is set so that TextWidth command below will be correct. TextWidth uses - // the tab start & tab width to calculate the overall width. - TabFormat = ""; // this is set so that TextWidth command below will be correct - _IgnoreResize = true; - TextWidth = _MyParentStepItem.TextWidth; - _IgnoreResize = false; - if (RNOLevel <= _MyItemInfo.ColumnMode) - { - //int colR = _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColRTable, Convert.ToInt32(_MyStepSectionLayoutData.PMode) - 1); - int colR = _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); - if (colR - _MyParentStepItem.Width < 0) colR = _MyParentStepItem.Width + 0; - _MyStepPanel.ItemMoving++; - //Left = _MyParentStepItem.ItemLeft + RNOLevel * colR; - //ItemLocation = new Point(_MyParentStepItem.ItemLeft + RNOLevel * colR, _MyParentStepItem.Top); - LastMethodsPush(string.Format("set_MyParentStepItem RNO Right {0}", MyID)); - ItemLocation = new Point(_MyParentStepItem.ItemLeft + RNOLevel * colR, _MyParentStepItem.Top); - int top = _MyParentStepItem.FindTop(_MyParentStepItem.Top); - if (top != _MyParentStepItem.Top) - { - _MyParentStepItem.LastMethodsPush(string.Format("set_MyParentStepItem RNO Right {0}", MyID)); - _MyParentStepItem.Top = top; - _MyParentStepItem.LastMethodsPop(); - Top = top; - } - LastMethodsPop(); - _MyStepPanel.ItemMoving--; - } - else - { - _MyStepPanel.ItemMoving++; - LastMethodsPush(string.Format("set_MyParentStepItem RNO Below {0} {1} {2}", MyID, _MyParentStepItem.BottomMostStepItem.MyID, _MyParentStepItem.BottomMostStepItem.Bottom)); - TextLocation = new Point(_MyParentStepItem.TextLeft, _MyParentStepItem.BottomMostStepItem.Bottom); - LastMethodsPop(); - //TextLocation = new Point(_MyParentStepItem.TextLeft, FindTop(_MyParentStepItem.Top)); - _MyStepPanel.ItemMoving--; - } - // Same size as the Parent - break; - case ChildRelation.Before: // Cautions and Notes - //if(_WatchThis > 0 && MyID > 2111) - // Console.WriteLine("Setting MyParent: \r\n\tParent {0},{1} \r\n\tTopMostItem {2},{3} \r\n\tNext {4}, {5}", _MyParentStepItem.MyID, _MyParentStepItem - // ,_MyParentStepItem.TopMostStepItem.MyID,_MyParentStepItem.TopMostStepItem - // , _MyNextStepItem == null ? 0 : _MyNextStepItem.MyID, _MyNextStepItem == null ? "None" : _MyNextStepItem.ToString()); - - //Location = new Point(_MyParentStepItem.Left + 20, max(_MyParentStepItem.Top, (_MyNextStepItem == null ? 0 : _MyNextStepItem.Top )) ?? 0); - _IgnoreResize = true; - Width = _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidT); - _IgnoreResize = false; - _MyStepPanel.ItemMoving++; - //Location = new Point(_MyParentStepItem.Left + 20, FindTop(_MyParentStepItem.Top)); - int myTop = MyNextStepItem == null ? _MyParentStepItem.Top : MyNextStepItem.Top; - Location = new Point(_MyParentStepItem.Left + 20, FindTop(myTop)); - _MyStepPanel.ItemMoving--; - //_MyParentStepItem.Top = Bottom; - // Could be a Caution or Note - Need to get WidT - break; - } - } - LastMethodsPop(); - } - } - private Stack _LastMethods= new Stack(); - //private string _LastMethod = ""; - private void LastMethodsPush(string str) - { - _MyStepPanel._LastAdjust = str; - _LastMethods.Push(str); - } - private string LastMethodsPop() - { - //_MyStepPanel._LastAdjust = ""; - return _LastMethods.Pop(); - } - private bool LastMethodsEmpty - { - get { return _LastMethods.Count == 0; } - } - /// - /// This should find the item that precedes the current item vertically - /// and then return the Bottom of that item. - /// - /// - private int FindTop(int bottom) - { - int lastBottomPrev = bottom; // This is necessary if the value of bottom can be negative. - if (_MyPreviousStepItem != null) - lastBottomPrev = _MyPreviousStepItem.BottomMostStepItem.Bottom; - int? bottomRNO = BottomOfParentRNO(); - if (lastBottomPrev > bottom) bottom = (int)(lastBottomPrev); // RHM 20090615 ES02 Step8 - // Moving from Step 8 to the Note preceeding step 8 caused the step 9 to be positioned in the wrong place. - //if (lastBottomParent > bottom) bottom = lastBottomParent; - //if (bottomRNO == null) return bottom; - return (int) max(bottomRNO, bottom); - } - /// - /// The left edge of the Tab - /// - public int ItemLeft - { - get { return Left + lblTab.Left; } - set { Left = value - lblTab.Left; } - } - /// - /// The Top of the StepItem - /// - public int ItemTop - { - get { return Top; } - set - { - _MyStepPanel.ItemMoving++; - Top = value; - _MyStepPanel.ItemMoving--; - } - } - /// - /// The Location of the Tab - /// - public Point ItemLocation - { - get { return new Point(Location.X + lblTab.Left, Location.Y); } - set { Location = new Point(value.X - lblTab.Left, value.Y); } - } - private int _RTBMargin = 3; - /// - /// Margin between the StepItem and the StepRTB. Appears on the Right. - /// Will allow space to draw a Change Bar on the right side of the StepItem. - /// - public int RTBMargin - { - get { return _RTBMargin; } - set { _RTBMargin = value; } - } - /// - /// Width of the Tab and RTB - /// - public int ItemWidth - { - get { return Width - lblTab.Left; } - set - { - Width = RTBMargin + value + lblTab.Left; - } - } - /// - /// Width of the RichTextBox - /// - public int TextWidth - { - get { return _MyStepRTB.Width; } - set - { - Width = value + lblTab.Left + lblTab.Width; - } - } - /// - /// Location of the RichTextBox - /// - public Point TextLocation - { - get { return new Point(Location.X + _MyStepRTB.Left, Location.Y); } - set { Location = new Point(value.X - _MyStepRTB.Left, value.Y); } - } - /// - /// Left edge of the RichTextBox - /// - public int TextLeft - { - get { return Left + _MyStepRTB.Left; } - } - /// - /// Tab Format used for outputing the Tab - /// - private string _TabFormat; - public string TabFormat - { - get - { - if (_TabFormat == null) TabFormat = null; // execute 'set' code. - return _TabFormat; - } - set - { - if (_MyItemInfo != null) - { - ItemInfo.ResetTabString(MyID); - string tabString = _MyItemInfo.MyTab.CleanText; - lblTab.Text = tabString; - lblTab.Width = tabString.Length * 8 * MyStepPanel.DPI / 96;// Adjust width for DPI - Invalidate(); - _MyStepRTB.Left = lblTab.Left + lblTab.Width;// +2; - _MyStepRTB.Width = Width - _MyStepRTB.Left - RTBMargin; - _TabFormat = value; // tabString; - } - } - } - /// - /// This is the "number" of the item (1, 2, 3 etc.) for Substeps - /// - public int Ordinal - { - get - { - int count = 1; - for (StepItem tmp = this; tmp.MyPreviousStepItem != null; tmp = tmp.MyPreviousStepItem) count++; - return count; - } - } - // hardcode to right for HLP. The change bar location from the format will need to be used to set this. - private E_ChangeBarPosition _ChangeBarPosition = E_ChangeBarPosition.Right; - public E_ChangeBarPosition ChangeBarPosition - { - get { return _ChangeBarPosition; } - set { _ChangeBarPosition = value; } - } - /// - /// Sets the previous item and adjusts locations - /// - public StepItem MyPreviousStepItem - { - get { return _MyPreviousStepItem; } - set - { - LastMethodsPush("set_MyPreviousStepItem"); - _MyPreviousStepItem = value; - if (_MyPreviousStepItem != null) - { - _IgnoreResize=true; - if (_MyStepData != null && (_MyStepData.Type.ToLower().Contains("table") || _MyStepData.ParentType.ToLower().Contains("table"))) - { - ItemWidth = (int)TableWidth(_MyStepRTB.Font, _MyItemInfo.MyContent.Text, true); - Location = new Point(_MyPreviousStepItem.Left, FindTop(_MyPreviousStepItem.BottomMostStepItem.Bottom)); - } - else if (value.MyItemInfo.IsTablePart) - { - ItemLocation = new Point(value.MyParentStepItem.TextLeft, value.MyParentStepItem.Bottom); - ItemWidth = value.MyParentStepItem.TextWidth; - } - else - { - Width = MyPreviousStepItem.Width; - if (TopMostStepItem == this) - Location = new Point(_MyPreviousStepItem.Left, FindTop(_MyPreviousStepItem.BottomMostStepItem.Bottom)); - else - TopMostStepItem.Location = new Point(TopMostStepItem.Left, FindTop(_MyPreviousStepItem.BottomMostStepItem.Bottom)); - } - _IgnoreResize=false; - //ShowMe(""); - //if (MyID > _StartingID) - // Console.WriteLine("{0}-->Setting MyPreviousStepItem {1},{2},{3},{4},{5},{6},{7}", WatchThisIndent, MyID, this - // , _MyPreviousStepItem - // ,Top - // , _MyPreviousStepItem.BottomMostStepItem.Bottom - // , FindTop(_MyPreviousStepItem.BottomMostStepItem.Bottom) - // , _MyPreviousStepItem.Bottom); - //Location = new Point(_MyPreviousStepItem.Left, _MyPreviousStepItem.BottomMostStepItem.Bottom); - switch (_MyChildRelation) - { - case ChildRelation.None: - break; - case ChildRelation.After: - break; - case ChildRelation.RNO: - break; - case ChildRelation.Before: - //_MyStepPanel.ItemMoving++; - //UpOneStepItem.Top = BottomMostStepItem.Bottom; - //_MyStepPanel.ItemMoving--; - break; - } - if (_MyPreviousStepItem.MyNextStepItem != this) _MyPreviousStepItem.MyNextStepItem = this; - } - LastMethodsPop(); - } - } - /// - /// Sets the next item and adjusts the location, - /// This also sets the previous for the "next" item - /// which adjusts other locations. - /// - public StepItem MyNextStepItem - { - get { return _MyNextStepItem; } - set - { - _MyNextStepItem = value; - if (_MyNextStepItem != null) - { - if (_MyNextStepItem.MyPreviousStepItem != this) - { - _MyNextStepItem.MyPreviousStepItem = this; - MyNextStepItem.Location = new Point(Left, Bottom); - } - } - } - } - /// - /// returns the TopMostChild - /// - public StepItem TopMostStepItem - { - get - { - if (Expanded && _MyBeforeStepItems != null) return _MyBeforeStepItems[0].TopMostStepItem; - return this; - } - } - /// - /// Returns the bottom location (Top + Height) - /// - public new int Bottom - { - get - { - return Top + (Hidden ? 0 : Height); - } - } - private bool _Hidden = false; - public bool Hidden - { - get { return _Hidden; } - set { _Hidden = value; Visible = !value; } - } - /// - /// Bottom most child - /// - public StepItem BottomMostStepItem - { - get - { - StepItem tmpr = null; // BottomMost RNO - //int rnoOffset = 0; - if ((MyExpandingStatus != ExpandingStatus.No || Expanded) && _MyRNOStepItems != null) - { - //rnoOffset = this.Top - _MyRNOStepItems[0].Top; - tmpr = _MyRNOStepItems[_MyRNOStepItems.Count - 1].BottomMostStepItem; - } - StepItem tmpa = this; // BottomMost After - if ((MyExpandingStatus != ExpandingStatus.No || Expanded) & _MyAfterStepItems != null) - tmpa = _MyAfterStepItems[_MyAfterStepItems.Count - 1].BottomMostStepItem; - // return the bottom most of the two results - if (tmpr == null) - return tmpa; - //if (rnoOffset > 0) - //Console.WriteLine("RNO Bottom Offset {0}", rnoOffset); - //if (tmpa.Bottom >= (tmpr.Bottom + rnoOffset)) - if (tmpa.Bottom >= (tmpr.Bottom)) - return tmpa; - return tmpr; - } - } - /// - /// Bottom most child excluding RNOs - /// - public StepItem BottomMostStepItemNoRNOs - { - get - { - StepItem tmpa = this; // BottomMost After - if ((MyExpandingStatus != ExpandingStatus.No || Expanded) & _MyAfterStepItems != null) - tmpa = _MyAfterStepItems[_MyAfterStepItems.Count - 1].BottomMostStepItem; - // return the bottom most - return tmpa; - } - } - /// - /// First sibling - /// - private StepItem FirstSiblingStepItem - { - get - { - StepItem tmp = this; - while (tmp.MyPreviousStepItem != null) - tmp = tmp.MyPreviousStepItem; - return tmp; - } - } - /// - /// Last sibling - /// - private StepItem LastSiblingStepItem - { - get - { - StepItem tmp = this; - while (tmp.MyNextStepItem != null) - tmp = tmp.MyNextStepItem; - return tmp; - } - } - /// - /// Returns the status of the vlnExpander unless it is in the process of expanding or collapsing - /// If it is colapsing it returns false - /// If it is expanding it returns true - /// - public bool Expanded - { - get - { - return !_Colapsing && (MyExpandingStatus != ExpandingStatus.No || _MyvlnExpander.Expanded); - } - set - { - _MyvlnExpander.Expanded = value; - } - } - /// - /// Sets or Gets expanding status - /// - public ExpandingStatus MyExpandingStatus - { - get { return _MyExpandingStatus; } - set { _MyExpandingStatus = value; } - } - /// - /// Gets or sets colapsing - /// - public bool Colapsing - { - get { return _Colapsing; } - set { _Colapsing = value; } - } - /// - /// Gets or Sets the ability to expand - /// - public bool CanExpand - { - get { return _MyvlnExpander.Visible; } - set { _MyvlnExpander.Visible = value; } - } - /// - /// Gets the text from the content - /// - public string MyText - { - get { return _MyItemInfo == null ? null : _MyItemInfo.MyContent.Text; } - } - /// - /// Gets the ItemID from the ItemInfo - /// - public int MyID - { - get { return _MyItemInfo == null ? 0 : _MyItemInfo.ItemID; } - } - /// - /// Tracks when a StepItem is moving - /// - public bool Moving - { - get { return _Moving; } - set { _Moving = value; } - } - /// - /// The RNO (Contingency) Level - /// - public int RNOLevel - { - get { return _RNOLevel; } - set { _RNOLevel = value; } - } - /// - /// Sequential Level - Only counts levels of Sequential substeps - /// - public int SeqLevel - { - get { return _SeqLevel; } - set { _SeqLevel = value; } - } - // TODO: This should be changed to get the Circle format from the data - /// - /// Show a circle or not - /// - public bool Circle - { - get { return _Circle; } - set { _Circle = value; } - } - // TODO: This should be changed to get the Checkoff status from the data - /// - /// Has a check-off or not - /// - public bool CheckOff - { - get { return _CheckOff; } - set { _CheckOff = value; } - } - // TODO: This should be changed to get the ChangeBar status from the data - /// - /// Has a changebar or not - /// - public bool ChangeBar - { - get { return _ChangeBar; } - set - { - _ChangeBar = value; - this.Invalidate(); - } - } - #endregion // Properties - #region Constructors - public StepItem(ItemInfo itemInfo, StepPanel myStepPanel, StepItem myParentStepItem, ChildRelation myChildRelation, bool expand) - { - //// TIMING: DisplayItem.TimeIt("CSLARTB Top"); - InitializeComponent();// TODO: Performance 25% - SetupStepItem(itemInfo, myStepPanel, myParentStepItem, myChildRelation, expand, null); - } - public StepItem(ItemInfo itemInfo, StepPanel myStepPanel, StepItem myParentStepItem, ChildRelation myChildRelation, bool expand, StepItem nextStepItem) - { - //// TIMING: DisplayItem.TimeIt("CSLARTB Top"); - InitializeComponent();// TODO: Performance 25% - SetupStepItem(itemInfo, myStepPanel, myParentStepItem, myChildRelation, expand, nextStepItem); - } - private void SetupStepItem(ItemInfo itemInfo, StepPanel myStepPanel, StepItem myParentStepItem, ChildRelation myChildRelation, bool expand, StepItem nextStepItem) - { - //if (itemInfo.ItemID == 225) _MyStepRTB.Resize += new EventHandler(_MyStepRTB_Resize); - _MyStepRTB.MyStepItem = 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(StepItem_Paint); - this.BackColorChanged += new EventHandler(StepItem_BackColorChanged); - if (itemInfo != null) - { - _Type = (int)itemInfo.MyContent.Type; - switch (_Type / 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[_Type % 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._LookupStepItems.Add(itemInfo.ItemID, this); - _MyChildRelation = myChildRelation; - if (myParentStepItem != null) RNOLevel = myParentStepItem.RNOLevel; - if (itemInfo != null) - { - //// TIMING: DisplayItem.TimeIt("CSLARTB before _Layout"); - _MyStepSectionLayoutData = itemInfo.ActiveFormat.MyStepSectionLayoutData; - //// TIMING: DisplayItem.TimeIt("CSLARTB _Layout"); - if (myParentStepItem != null) - SeqLevel = myParentStepItem.SeqLevel + ((myChildRelation == ChildRelation.After || myChildRelation == ChildRelation.Before) && itemInfo.IsSequential ? 1 : 0); - //// TIMING: DisplayItem.TimeIt("CSLARTB seqLevel"); - MyItemInfo = itemInfo; - } - //// TIMING: DisplayItem.TimeIt("CSLARTB MyItem"); - myStepPanel.Controls.Add(this); - - switch (myChildRelation) - { - case ChildRelation.After: - AddItem(myParentStepItem, ref myParentStepItem._MyAfterStepItems,nextStepItem); - break; - case ChildRelation.Before: - AddItem(myParentStepItem, ref myParentStepItem._MyBeforeStepItems, nextStepItem); - break; - case ChildRelation.RNO: - RNOLevel = myParentStepItem.RNOLevel + 1; - AddItem(myParentStepItem, ref myParentStepItem._MyRNOStepItems, nextStepItem); - break; - case ChildRelation.None: - break; - } - if (itemInfo != null) - { - if (myChildRelation == ChildRelation.None) - { - if (_Type == 0 && _MyStepSectionLayoutData != null) - { - LastMethodsPush(string.Format("SetupStepItem {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 (myParentStepItem == null)// If it is the top node - if (_Type >= 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("SetupStepItem"); - _MyStepPanel.ItemMoving++; - Top = top; - _MyStepPanel.ItemMoving--; - LastMethodsPop(); - } - _Loading = false; - //// TIMING: DisplayItem.TimeIt("CSLARTB Controls Add"); - } - private void SetExpandAndExpander(ItemInfo itemInfo) - { - // Don't allow substeps to expand - switch (_Type / 10000) - { - case 1: // Section can expand - CanExpand = true; - // If a word document set the expander to attachment - _MyvlnExpander.Attachment = !(itemInfo.IsStepSection); - //OLD: _MyvlnExpander.Attachment = (itemInfo.MyContent.ContentPartCount == 0); - break; - case 2: // High level steps with children can expand - CanExpand = itemInfo.IsHigh && itemInfo.HasChildren; // TemporaryFormat.IsHigh(item); ; - break; - default://Procedures cannot expand, because they automatically expand - CanExpand = false; - break; - } - } - private void SetupHeader(ItemInfo itemInfo) - { - lblTab.Top = 3 + ((itemInfo.HasHeader) ? 23 : 0); - _MyStepRTB.Top = lblTab.Top; // 3 + ((itemInfo.HasHeader) ? 23 : 0); - //lblTab.Move += new EventHandler(lblTab_Move); - if (itemInfo.HasHeader) - SetupHeaderFooter(ref lblHeader, "Header", itemInfo.MyHeader); - else - { - // remove header from screen if it exists: - this.Controls.Remove(lblHeader); - lblHeader = null; - } - } - private void SetupHeader() - { - SetupHeader(MyItemInfo); - LastMethodsPush("SetupHeader"); - Height = _MyStepRTB.Height + _MyStepRTB.Top + 7; - LastMethodsPop(); - } - void _MyStepRTB_Resize(object sender, EventArgs e) - { - // Console.WriteLine("Left {0} Width {1}", Left, Width); - } - - private Label lblHeader = null; - private Label lblFooter = null; - private void SetupHeaderFooter(ref Label lbl, string name, MetaTag mTag) - { - if (lbl==null)lbl = new Label(); - lbl.BackColor = System.Drawing.Color.Transparent; - lbl.Location = new System.Drawing.Point(0, 0); - lbl.Name = name; - lbl.Size = new System.Drawing.Size(this.Width, 23); - lbl.Visible = true; - lbl.Font = mTag.MyFont.WindowsFont; - lbl.Text = mTag.CleanText; - lbl.TextAlign = mTag.Justify; - this.Controls.Add(lbl); - } - #endregion - #region AddItem - /// - /// Adds an item to a list - /// - /// Parent Container - /// StepItem List - public void AddItem(StepItem parentStepItem, ref List siblingStepItems, StepItem nextStepItem) - { - if (siblingStepItems == null) // Create a list of siblings - { - siblingStepItems = new List(); - siblingStepItems.Add(this); - MyParentStepItem = parentStepItem; - } - else // Add to the existing list - { - if (nextStepItem == null) // Add to the end of the list - { - StepItem lastChild = LastChild(siblingStepItems); - siblingStepItems.Add(this); - MyPreviousStepItem = lastChild; - } - else // Add to the middle of the list before a particular item - { - StepItem prevChild = nextStepItem.MyPreviousStepItem; - StepItem parent = nextStepItem.MyParentStepItem; - siblingStepItems.Insert(siblingStepItems.IndexOf(nextStepItem), this); - MyStepPanel.ItemMoving++; - _MyNextStepItem = nextStepItem; - nextStepItem._MyPreviousStepItem = this; - MyPreviousStepItem = prevChild;// If a previous exists - this will adjust the location and width of the StepItem - nextStepItem.MyParentStepItem = null; - MyParentStepItem = parent; // If a parent exists - this will adjust the location and width of the StepItem - //nextStepItem.MyPreviousStepItem = this; - MyStepPanel.ItemMoving--; - } - } - if (MyItemInfo.IsCaution || MyItemInfo.IsNote) - { - StepItem prev = this; - while (prev.MyPreviousStepItem != null) prev = prev.MyPreviousStepItem; - prev.SetAllTabs(); - } - else - SetAllTabs(); - } - // clear tabs, clears then all so that next 'get' will calculate new. - public void SetAllTabs() - { - TabFormat = null; // reset TabFormat - SetupHeader(); - if (_MyAfterStepItems != null) foreach (StepItem chld in _MyAfterStepItems) chld.SetAllTabs(); - if (_MyNextStepItem != null) _MyNextStepItem.SetAllTabs(); - // Update the RNO tab if it exists - RHM 20100106 - if (_MyRNOStepItems != null) foreach (StepItem chld in _MyRNOStepItems) chld.SetAllTabs(); - } - /// - /// Add the next item to a list - /// - /// - /// - /// - //public StepItem AddNext(ItemInfo myItemInfo, bool expand) - //{ - // StepItem tmp = new StepItem(myItemInfo, _MyStepPanel, MyParentStepItem, ChildRelation.None, expand); - // MyNextStepItem = tmp; - // return tmp; - //} - #endregion - #region RemoveItem - protected void ShowTops(string title) - { - int TopMostY = TopMostStepItem.Top; - int? TopMostParentY = (MyParentStepItem == null ? null : (int?)(MyParentStepItem.TopMostStepItem.Top)); - int? ParentY = (MyParentStepItem == null ? null : (int?)(MyParentStepItem.Top)); - //Console.Write("{0}: TopMostY={1}, TopMostParentY={2}, ParentY = {3}",title, TopMostY, TopMostParentY, ParentY); - Console.Write("{0}{1},{2},{3}", title, TopMostY, TopMostParentY.ToString() ?? "null", ParentY.ToString() ?? "null"); - } - private bool _BeingRemoved = false; - public bool BeingRemoved - { - get { return _BeingRemoved; } - set { _BeingRemoved = value; } - } - public void RemoveItem() - { - BeingRemoved = true; - MyStepPanel.SelectedStepRTB = null; // Unselect the item to be deleted - //ShowTops("\r\n"); - int TopMostYBefore = TopMostStepItem.Top; - StepItem newFocus = DeleteItem(); - if (newFocus == null) return; - newFocus.MyStepRTB.Focus(); - Dispose(); - newFocus.SetAllTabs(); - int TopMostYAfter = newFocus.TopMostStepItem.Top; - if (TopMostYAfter > TopMostYBefore) - newFocus.TopMostStepItem.Top = TopMostYBefore; - newFocus.AdjustLocation(); - //newFocus.ShowTops(""); - } - public StepItem DeleteItem() - { - StepItem newFocus = null; - int? TopMostParentY = (MyParentStepItem == null ? null : (int?)(MyParentStepItem.TopMostStepItem.Top)); - int? ParentY = (MyParentStepItem == null ? null : (int?)(MyParentStepItem.Top)); - try - { - Item.DeleteItemAndChildren(MyItemInfo); - } - catch (System.Data.SqlClient.SqlException ex) - { - HandleSqlExceptionOnDelete(ex); - return null; - } - // Remove StepItems - RemoveFromParentsChildList(); - if (MyNextStepItem != null) - { - if (MyPreviousStepItem != null) - { - MyNextStepItem.MyPreviousStepItem = MyPreviousStepItem; - MyPreviousStepItem = null; - newFocus = MyNextStepItem; - } - else - { - MyNextStepItem.MyParentStepItem = MyParentStepItem; - MyParentStepItem = null; - MyNextStepItem.MyPreviousStepItem = null; - newFocus = MyNextStepItem; - } - // Adjust the vertical locations of all of the items below the item deleted - MyNextStepItem.TopMostStepItem.AdjustLocation(); - MyNextStepItem = null; - } - else if (MyPreviousStepItem != null) - { - MyPreviousStepItem.MyNextStepItem = null; - newFocus = MyPreviousStepItem; - MyPreviousStepItem = null; - //Console.Write(",\"Previous\","); - } - else - { - newFocus = MyParentStepItem; - MyParentStepItem = null; - //Console.Write(",\"Parent\","); - } - return newFocus; - } - - private void HandleSqlExceptionOnDelete(System.Data.SqlClient.SqlException ex) - { - if (ex.Message.Contains("has External Transitions and has no next step")) - { - using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitions(MyID)) - { - DialogResult ans = MessageBox.Show("Transitions exist to this step and cannot be adjusted automatically." + - "\r\n\r\nDo you want to be placed on the " + (exTrans.Count > 1 ? "first " : "") + "substep with the problem Transition?" + - "\r\n\r\nSubsteps with Problem Transitions" + - exTrans.Summarize(), - "Cannot Delete This Step", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (ans == DialogResult.Yes) - { - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(exTrans[0].MyContent.ContentItems[0]); - - } - else - this.MyStepRTB.Focus(); - } - } - else if (ex.Message.Contains("has External Transitions to it's children")) - { - using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(MyID)) - { - DialogResult ans = MessageBox.Show("Transitions exist to substeps of this step and cannot be adjusted automatically." + - "\r\n\r\nDo you want to be placed on the " + (exTrans.Count > 1 ? "first " : "") + "substep with the problem Transition?" + - "\r\n\r\nSubsteps with Problem Transitions:" + - exTrans.Summarize(), - "Cannot Delete This Step", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (ans == DialogResult.Yes) - { - MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(exTrans[0].MyContent.ContentItems[0]); - } - } - } - else - MessageBox.Show(ex.Message, "SQL Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - } - private void RemoveFromParentsChildList() - { - StepItem top = this; - while (top.MyPreviousStepItem != null) top = top.MyPreviousStepItem; - StepItem parentStepItem = top.MyParentStepItem; - if (parentStepItem == null) return; // No parent, nothing to remove. - if (parentStepItem.MyAfterStepItems != null && parentStepItem.MyAfterStepItems.Contains(this)) - { - parentStepItem.MyAfterStepItems.Remove(this); - if (parentStepItem.MyAfterStepItems.Count == 0) - parentStepItem.MyAfterStepItems = null; - } - else if (parentStepItem.MyBeforeStepItems != null && parentStepItem.MyBeforeStepItems.Contains(this)) - { - parentStepItem.MyBeforeStepItems.Remove(this); - if(parentStepItem.MyBeforeStepItems.Count == 0) - parentStepItem.MyBeforeStepItems = null; - } - else if (parentStepItem.MyRNOStepItems != null && parentStepItem.MyRNOStepItems.Contains(this)) - { - parentStepItem.MyRNOStepItems.Remove(this); - if(parentStepItem.MyRNOStepItems.Count == 0) - parentStepItem.MyRNOStepItems = null; - } - if (parentStepItem.MyAfterStepItems == null && parentStepItem.MyBeforeStepItems == null && parentStepItem.MyRNOStepItems == null) - parentStepItem.CanExpand = false; - } - //private void ShowSiblings(string title) - //{ - // Console.WriteLine("---{0} {1}---",title,MyID); - // StepItem top = this; - // while (top.MyPreviousStepItem != null) top = top.MyPreviousStepItem; - // do - // { - // Console.WriteLine("{0} StepItem - {1} {2}", top.MyID == MyID ? "*" : " ", top.MyID, top.MyItemInfo.MyContent.Text); - // top = top.MyNextStepItem; - // } while (top != null); - //} - #endregion - #region Add Children - /// - /// Add a child before (Notes, Cautions, etc.) - /// - /// - /// - public void AddChildBefore(ItemInfo myItemInfo, bool expand) - { - StepItem child = new StepItem(myItemInfo, _MyStepPanel, this, ChildRelation.Before, expand); - } - /// - /// Add a list of children before - /// - /// - /// - public void AddChildBefore(ItemInfoList myItemInfoList, bool expand) - { - if (myItemInfoList != null) - foreach (ItemInfo item in myItemInfoList) - AddChildBefore(item, expand); - } - /// - /// Add an RNO (Contingency) child - /// - /// - /// - public void AddChildRNO(ItemInfo myItemInfo, bool expand) - { - StepItem child = new StepItem(myItemInfo, _MyStepPanel, this, ChildRelation.RNO, expand); - } - /// - /// Add a list of RNO (Contingency) children - /// - /// - /// - public void AddChildRNO(ItemInfoList myItemInfoList, bool expand) - { - if (myItemInfoList != null) - foreach (ItemInfo item in myItemInfoList) - AddChildRNO(item, expand); - } - /// - /// Add a child after - /// - /// - /// - public StepItem AddChildAfter(ItemInfo MyItemInfo, bool expand) - { - StepItem child = new StepItem(MyItemInfo, _MyStepPanel, this, ChildRelation.After, expand); - return child; - } - public StepItem AddChildAfter(ItemInfo MyItemInfo, StepItem nextStepItem) - { - StepItem child = new StepItem(MyItemInfo, _MyStepPanel, this, ChildRelation.After, true, nextStepItem); - return child; - } - public StepItem AddChildBefore(ItemInfo MyItemInfo, StepItem nextStepItem) - { - StepItem child = new StepItem(MyItemInfo, _MyStepPanel, this, ChildRelation.Before, true, nextStepItem); - return child; - } - public StepItem AddChildRNO(ItemInfo MyItemInfo, StepItem nextStepItem) - { - StepItem child = new StepItem(MyItemInfo, _MyStepPanel, this, ChildRelation.RNO, true, nextStepItem); - return child; - } - /// - /// Adds a sibling after the current StepItem - /// - public void AddSiblingAfter() - { - AddSiblingAfter("",true); - } - public void AddSiblingAfter(string text,bool updateStatus) - { - MyStepRTB.SaveText(); - ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter(text); - DoAddSiblingAfter(newItemInfo, updateStatus); - } - public void AddSiblingAfter(int? type, bool updateStatus) - { - MyStepRTB.SaveText(); - ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter("","",type); - DoAddSiblingAfter(newItemInfo,updateStatus); - } - private void DoAddSiblingAfter(ItemInfo newItemInfo, bool updateStatus) - { - StepItem newStepItem = null; - switch (_MyChildRelation) - { - case ChildRelation.After: - newStepItem = ActiveParent.AddChildAfter(newItemInfo, MyNextStepItem); - break; - case ChildRelation.Before: - newStepItem = ActiveParent.AddChildBefore(newItemInfo, MyNextStepItem); - break; - case ChildRelation.RNO: - newStepItem = ActiveParent.AddChildRNO(newItemInfo, MyNextStepItem); - break; - default: // Need debug - break; - } - //StepItem newStepItem = ActiveParent.AddChildAfter(newItemInfo, ); - if(updateStatus) - _MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen - } - private static int _WatchThis = 1; - public void AddSiblingBefore() - { - AddSiblingBefore("",true); - } - public void AddSiblingBefore(string text, bool updateSelection) - { - // Save RTB text before creating a new item because the process of creating - // a new item will save a change to iteminfo excluding text changes. This - // shouldn't be necessary for adding sibling after because the current step - // doesn't get saved during the insert after because of the MyPrevious field - // is only set on an insert before, which is what saves the item without - // any updates from the richtextbox text. - _MyStepRTB.SaveText(); - ItemInfo newItemInfo = MyItemInfo.InsertSiblingBefore(text); - StepItem newStepItem=null; - switch (_MyChildRelation) - { - case ChildRelation.After: - newStepItem = ActiveParent.AddChildAfter(newItemInfo, this); - break; - case ChildRelation.Before: - newStepItem = ActiveParent.AddChildBefore(newItemInfo, this); - break; - case ChildRelation.RNO: - newStepItem = ActiveParent.AddChildRNO(newItemInfo, this); - break; - default: // Need debug - break; - } - if(updateSelection) - _MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen - } - public void AddChild(E_FromType fromType, int type) - { - AddChild("",fromType, type); - } - public void AddChild(string text, E_FromType fromType, int type) - { - if (_MyItemInfo.IsHigh || _MyItemInfo.IsSection) - this.CanExpand = true; - this.Expanded = true; - _WatchThis = 1; - ItemInfo newItemInfo = MyItemInfo.InsertChild(fromType, type, text); - // TODO: We need to determine where this will go in the stack of children - StepItem nextItem = null; - if (newItemInfo.NextItem != null) - nextItem = MyStepPanel.FindItem(newItemInfo.NextItem); - else if (fromType == E_FromType.Table && MyAfterStepItems != null) - nextItem = MyAfterStepItems[0]; - // Cautions come before notes, so if this is a Caution and there are Notes, put this first - else if (fromType == E_FromType.Caution && ((ItemInfo)newItemInfo.ActiveParent).Notes != null - && ((ItemInfo)newItemInfo.ActiveParent).Notes.Count > 0) - nextItem = MyStepPanel.FindItem(((ItemInfo)newItemInfo.ActiveParent).Notes[0]); - // TODO: May need similar logic if a Table is being added to a step that has substeps - // else if (fromType == E_FromType.Table && ((ItemInfo)newItemInfo.ActiveParent).Steps != null - //&& ((ItemInfo)newItemInfo.ActiveParent).Steps.Count > 0) - // nextItem = MyStepPanel.FindItem(((ItemInfo)newItemInfo.ActiveParent).Steps[0]); - StepItem newStepItem; - switch (fromType) - { - case E_FromType.Caution: - newStepItem = this.AddChildBefore(newItemInfo, nextItem); - break; - case E_FromType.Note: - newStepItem = this.AddChildBefore(newItemInfo, nextItem); - break; - case E_FromType.Procedure: - newStepItem = this.AddChildAfter(newItemInfo, nextItem); - break; - case E_FromType.RNO: - newStepItem = this.AddChildRNO(newItemInfo, nextItem); - break; - case E_FromType.Section: - newStepItem = this.AddChildAfter(newItemInfo, nextItem); - break; - case E_FromType.Step: - newStepItem = this.AddChildAfter(newItemInfo, nextItem); - break; - case E_FromType.Table: - newStepItem = this.AddChildAfter(newItemInfo, nextItem); - break; - default: - newStepItem = this.AddChildAfter(newItemInfo, nextItem); - break; - } - _MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen - } - /// - /// Add a list of children after - /// - /// - /// - public StepItem AddChildAfter(ItemInfoList myItemInfoList, bool expand) - { - StepItem child = null; - if (myItemInfoList != null) - foreach (ItemInfo item in myItemInfoList) - child = AddChildAfter(item, expand); - return child; - } - #endregion - #region CopyPaste - public void PasteSiblingBefore(int copyStartID) - { - ItemInfo newItemInfo = MyItemInfo.PasteSiblingBefore(copyStartID); - StepItem newStepItem = null; - switch (_MyChildRelation) - { - case ChildRelation.After: - newStepItem = ActiveParent.AddChildAfter(newItemInfo, this); - break; - case ChildRelation.Before: - newStepItem = ActiveParent.AddChildBefore(newItemInfo, this); - break; - case ChildRelation.RNO: - newStepItem = ActiveParent.AddChildRNO(newItemInfo, this); - break; - default: // Need debug - break; - } - if (newStepItem != null) _MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen - _MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Before, newItemInfo.MyContent.Type)); - - } - public void PasteSiblingAfter(int copyStartID) - { - ItemInfo newItemInfo = MyItemInfo.PasteSiblingAfter(copyStartID); - StepItem newStepItem = null; - switch (_MyChildRelation) - { - case ChildRelation.After: - newStepItem = ActiveParent.AddChildAfter(newItemInfo, MyNextStepItem); - break; - case ChildRelation.Before: - newStepItem = ActiveParent.AddChildBefore(newItemInfo, MyNextStepItem); - break; - case ChildRelation.RNO: - newStepItem = ActiveParent.AddChildRNO(newItemInfo, MyNextStepItem); - break; - default: // Need debug - break; - } - _MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen - _MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.After, newItemInfo.MyContent.Type)); - - } - public StepItem PasteReplace(int copyStartID) - { - // To allow a Paste Step into an empty (new) step/substep, we need to add a character to the the Text field - // to simulate replacing an existing step - otherwise we will get null references. - if (MyStepPanel.SelectedStepRTB.Text == "") - MyStepPanel.SelectedStepRTB.Text = " "; - MyStepPanel.SelectedStepRTB = null; // Unselect the item to be deleted - ChildRelation childRelation = _MyChildRelation; - StepItem newFocus = null; - StepItem nextStepItem = MyNextStepItem; - StepItem prevStepItem = MyPreviousStepItem; - StepItem parentStepItem = ActiveParent; - - int TopMostYBefore = TopMostStepItem.Top; - int? TopMostParentY = (MyParentStepItem == null ? null : (int?)(MyParentStepItem.TopMostStepItem.Top)); - int? ParentY = (MyParentStepItem == null ? null : (int?)(MyParentStepItem.Top)); - ItemInfo newItemInfo = null; - try - { - newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID); - } - catch (System.Data.SqlClient.SqlException ex) - { - HandleSqlExceptionOnDelete(ex); - return this; - } - // Remove the StepItem that was the replaced item. - RemoveFromParentsChildList(); - - if (MyNextStepItem != null) - { - if (MyPreviousStepItem != null) - { - MyNextStepItem.MyPreviousStepItem = MyPreviousStepItem; - MyPreviousStepItem = null; - } - else - { - MyNextStepItem.MyParentStepItem = MyParentStepItem; - MyParentStepItem = null; - MyNextStepItem.MyPreviousStepItem = null; - } - MyNextStepItem = null; - } - else if (MyPreviousStepItem != null) - { - MyPreviousStepItem.MyNextStepItem = null; - newFocus = MyPreviousStepItem; - MyPreviousStepItem = null; - } - else - { - newFocus = MyParentStepItem; - MyParentStepItem = null; - } - - // add copied item to ui where the replaced item was. - StepItem newStepItem = null; - switch (childRelation) - { - case ChildRelation.After: - newStepItem = parentStepItem.AddChildAfter(newItemInfo, nextStepItem); - break; - case ChildRelation.Before: - newStepItem = parentStepItem.AddChildBefore(newItemInfo, nextStepItem); - break; - case ChildRelation.RNO: - newStepItem = parentStepItem.AddChildRNO(newItemInfo, nextStepItem); - break; - default: // Need debug - break; - } - _MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen - _MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Replace, newItemInfo.MyContent.Type)); - return newStepItem; - } - public void HighlightBackColor() - { - // Highlight all of the rtb's within this stepitem: - if (MyAfterStepItems != null) - { - foreach (StepItem sia in MyAfterStepItems) - { - sia.MyStepRTB.HighlightBackColor(); - sia.HighlightBackColor(); - } - } - if (MyBeforeStepItems != null) - { - foreach (StepItem sib in MyBeforeStepItems) - { - sib.MyStepRTB.HighlightBackColor(); - sib.HighlightBackColor(); - } - } - if (MyRNOStepItems != null) - { - foreach (StepItem sir in MyRNOStepItems) - { - sir.MyStepRTB.HighlightBackColor(); - sir.HighlightBackColor(); - } - } - } - public void SetBackColor() - { - // Set (removing highlighting) all of the rtb's within this stepitem: - if (MyAfterStepItems != null) - { - foreach (StepItem sia in MyAfterStepItems) - { - sia.MyStepRTB.SetBackColor(); - sia.SetBackColor(); - } - } - if (MyBeforeStepItems != null) - { - foreach (StepItem sib in MyBeforeStepItems) - { - sib.MyStepRTB.SetBackColor(); - sib.SetBackColor(); - } - } - if (MyRNOStepItems != null) - { - foreach (StepItem sir in MyRNOStepItems) - { - sir.MyStepRTB.SetBackColor(); - sir.SetBackColor(); - } - } - } - #endregion - #region Event Handlers - /// - /// If the background changes, change the background of the RichTextBox - /// - /// - /// - void StepItem_BackColorChanged(object sender, EventArgs e) - { - //_MyStepRTB.BackColor = BackColor; - _MyStepRTB.SetBackColor(); - } - /// - /// When the RichTextBox height changes, change the height of the control to match - /// - /// - /// - private void _StepRTB_HeightChanged(object sender, EventArgs args) - { - if (this.Height != _MyStepRTB.Height+_MyStepRTB.Top+7) // add in 7 to make it look good // + 10) - { - //if (MyID == 2131 || MyID == 2132) - // Console.WriteLine("oops!"); - LastMethodsPush(string.Format("_StepRTB_HeightChanged {0}", _MyStepRTB.Height)); - this.Height = _MyStepRTB.Height + _MyStepRTB.Top + 7; - LastMethodsPop(); - } - } - /// - /// Handle the colape event - /// - /// - /// - private void vlnExp_BeforeColapse(object sender, vlnExpanderEventArgs args) - { - Cursor tmp = Cursor.Current; - Cursor.Current = Cursors.WaitCursor; - int top = TopMostStepItem.Top;// This does'nt work - this is since the last time it was expanded. - _Colapsing = true; - // Hide Children - HideChildren(); - // Adjust Positions - _ExpandPrefix = Top - top; - _ExpandSuffix = BottomMostStepItem.Bottom - Bottom; - if (Top != top) - { - LastMethodsPush(string.Format("Colapse {0}", MyID)); - _MyStepPanel.ItemMoving++; - Top = top; - _MyStepPanel.ItemMoving--; - LastMethodsPop(); - } - else - AdjustLocation(); - BottomMostStepItem.AdjustLocation(); - _Colapsing = false; - Cursor.Current = tmp; - } - /// - /// Handle the expand event - /// - /// - /// - private void vlnExp_BeforeExpand(object sender, vlnExpanderEventArgs args) - { - Cursor tmp = Cursor.Current; - Cursor.Current = Cursors.WaitCursor; - if (!_Loading && MyExpandingStatus == ExpandingStatus.No) - Expand(_Type >= 20000); - Cursor.Current = tmp; - } - bool _IgnoreResize = false; - /// - /// Adjust the locations when the StepItem is resized - /// - /// - /// - private void StepItem_Resize(object sender, EventArgs e) - { - if (_MyItemInfo == null) return; - if (_IgnoreResize) return; - AdjustLocation(); - if (lblHeader != null) lblHeader.Width = this.Width; - } - private string WatchThisIndent - { - get { return "".PadLeft(_WatchThis, '\t'); } - } - /// - /// Handles movement of the StepItems - /// - /// - /// - private void StepItem_Move(object sender, EventArgs e) - { - int watchThis = _WatchThis; - //if (MyID == _lookForID || MyID == 2111) - //{ - // //vlnStackTrace.ShowStack("{0} Move TO {1} - {2}, BottomMost {3}", MyID, Top, MyPath, BottomMostStepItem.MyPath); - // Console.WriteLine("{0} Move TO {1} - {2}, BottomMost {3}", MyID, Top, MyPath, BottomMostStepItem.MyPath); - //} - //if (MyID > _StartingID) - // Console.WriteLine("{0}--------------- {1} Top = {2} Bottom {3}", WatchThisIndent, MyID, Top, Bottom); - if (_MyStepPanel.ItemMoving == 0) - { - //vlnStackTrace.ScrollInStack(); - return; // If 0 - Indicates scrolling which requires no action. - } - //ShowMe("Move"); - if (_MyItemInfo == null) - return; - //if (_WatchThis > 0 && MyID > _StartingID) - //{ - - // Console.WriteLine("{0}Start Move {1},{2}", WatchThisIndent, MyID, this); - // if (MyID == _LookForID) - // Console.WriteLine("{0}---------------", WatchThisIndent,MyID, this); - // _WatchThis++; - //} - if (MyExpandingStatus == ExpandingStatus.Expanding) - { - _WatchThis=watchThis; - return; - } - Moving = true; - StepItem tmp = (StepItem)sender; - if (tmp._MyPreviousStepItem == null && tmp._MyParentStepItem == null) - { - _WatchThis=watchThis; - return; - } - if (Visible) // Only Adjust Location if StepItem is visible - { - if (RNOBelow) // Adjust substeps first - { - //Console.WriteLine("RNOBelow"); - AdjustLocation(); - MoveRNO(); - } - else // Adjust RNO First - { - if (RNORight) - { - //Console.WriteLine("RNORight"); - MoveRNO(); - } - AdjustLocation(); - } - } - Moving = false; - StepItem btm = BottomMostStepItem; - if(this != btm) - btm.AdjustLocation(); - //if (_WatchThis > 0 && MyID > _StartingID) - //{ - // Console.WriteLine("{0}Finish Move {1},{2}",WatchThisIndent, MyID, this); - //} - _WatchThis=watchThis; - } - private bool RNOBelow - { - get - { - if (_MyRNOStepItems != null) - { - return _MyRNOStepItems[0].RNOLevel > _MyItemInfo.ColumnMode; - //return _MyRNOStepItems[0].Left == Left; - } - return false; - } - } - private bool RNORight - { - get - { - if (_MyRNOStepItems != null) - { - return _MyRNOStepItems[0].RNOLevel <= _MyItemInfo.ColumnMode; - //return _MyRNOStepItems[0].Left != Left; - } - return false; - } - } - private void MoveRNO() - { - if (_MyRNOStepItems != null) - { - if (_MyRNOStepItems[0].TopMostStepItem.Top != Top) - { - //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("\r\n'Adjust RNO',{0},'Move',{1}", MyID, _RNO[0].MyID); - StepItem rnoTop = _MyRNOStepItems[0].TopMostStepItem; - if (rnoTop.RNOLevel <= _MyItemInfo.ColumnMode) - { - //StepItem tmpBottom = this; - //if (_MyAfterStepItems != null) tmpBottom = _MyAfterStepItems[_MyAfterStepItems.Count - 1].BottomMostStepItem; - _MyStepPanel.ItemMoving++; - rnoTop.LastMethodsPush(string.Format("StepItem_Move RNO Right {0}", rnoTop.MyID)); - //rnoTop.Top = tmpBottom.Bottom; - rnoTop.Top = Top; - rnoTop.LastMethodsPop(); - _MyStepPanel.ItemMoving--; - } - else - { - _MyStepPanel.ItemMoving++; - rnoTop.LastMethodsPush(string.Format("StepItem_Move RNO Below {0} {1} {2}", rnoTop.MyID, BottomMostStepItemNoRNOs.MyID, BottomMostStepItemNoRNOs.Bottom)); - rnoTop.Top = BottomMostStepItemNoRNOs.Bottom; - rnoTop.LastMethodsPop(); - _MyStepPanel.ItemMoving--; - } - } - } - } - /// - /// Handle the LinkGoTO event - /// - /// - /// - private void _StepRTB_LinkGoTo(object sender, StepPanelLinkEventArgs args) - { - _MyLog.DebugFormat("_DisplayRTB_LinkGoTo " + args.LinkInfoText); - _MyStepPanel.OnLinkClicked(sender, args); - } - /// - /// Raises an ItemClick event when the user clicks on the Tab - /// - /// - /// - private void lblTab_MouseDown(object sender, MouseEventArgs e) - { - _MyStepPanel.OnItemClick(this, new StepPanelEventArgs(this, e)); - } - /// - /// When a RichTextBox is entered, the selected StepRTB is set - /// - /// - /// - private void _StepRTB_Enter(object sender, EventArgs e) - { - if (_MyStepPanel.DisplayItemChanging) return; - //vlnStackTrace.ShowStack("_StepRTB_Enter {0}",this.MyID); - _MyStepPanel.SelectedStepRTB = _MyStepRTB; - } - /// - /// Raise a OnLinkModifyTran event, when the user chooses to Modify a transition - /// - /// - /// - private void _StepRTB_LinkModifyTran(object sender, StepPanelLinkEventArgs args) - { - _MyStepPanel.OnLinkModifyTran(sender, args); - } - /// - /// Raise a OnLinkModifyRO event, when the user chooses to modify an RO - /// - /// - /// - private void _StepRTB_LinkModifyRO(object sender, StepPanelLinkEventArgs args) - { - _MyStepPanel.OnLinkModifyRO(sender, args); - } - /// - /// Pass the AttachmentClick event to the StepPanel control. - /// - /// - /// - private void vlnExp_AttachmentClick(object sender, vlnExpanderEventArgs args) - { - _MyStepPanel.OnAttachmentClicked(sender, new StepPanelAttachmentEventArgs(this)); - } - private void _MyStepRTB_CursorKeyPress(object sender, KeyEventArgs args) - { - _MyStepPanel.StepCursorKeys(sender as StepRTB, args); - } - private void _MyStepRTB_CursorMovement(object sender, StepRTBCursorMovementEventArgs args) - { - _MyStepPanel.CursorMovement(sender as StepRTB, args.CursorLocation, args.Key); - } - private void _MyStepRTB_ModeChange(object sender, StepRTBModeChangeEventArgs args) - { - _MyStepPanel.OnModeChange(sender as StepRTB, args); - } - #endregion // Event Handlers - #region Private Methods - /// - /// Finds the last child in a list - /// - /// - /// - private static StepItem LastChild(List childStepItems) - { - return childStepItems[childStepItems.Count - 1]; - } - /// - /// Calculate TableWidth based upon the the contents - /// - /// - /// - /// - /// - public float TableWidth(Font myFont, string txt, bool addBorder) - { - string[] lines = txt.Split("\n".ToCharArray()); - float max = 0; - using (Graphics g = this.CreateGraphics()) - { - PointF pnt = new PointF(0, 0); - foreach (string line in lines) - { - 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); - // MeasureString doesn't work properly if the line include graphics characters. - // So, Measure a string of the same length with 'M's. - SizeF siz = g.MeasureString("".PadLeft(lineAdj.Length + (addBorder ? 2 : 0), 'M'), myFont, pnt, StringFormat.GenericTypographic); - float wid = siz.Width; - if (wid > max) - { - max = wid; - } - } - } - float widLimit = (float) _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode); - widLimit += (float)_MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColS); - widLimit += (float) _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); - max += _MyStepPanel.MyStepPanelSettings.TableWidthAdjust; - return Math.Min(max,widLimit); - } - /// - /// Calculates the table location - /// - /// - /// - /// - /// - public Point TableLocation(StepItem myParentStepItem, StepSectionLayoutData myStepSectionLayoutData, int width) - { - // Should center on parent unless it is a centered table in the AER column - int center = myParentStepItem.TextLeft + myParentStepItem.TextWidth / 2; - int rightLimit = myParentStepItem.Right; - // Then should center on the wid Limit - if (MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0) - { - int colR = _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode); - rightLimit += colR * MyItemInfo.ColumnMode; - center += (colR * MyItemInfo.ColumnMode) / 2; - center -= (myParentStepItem.TextLeft - (int)MyItemInfo.MyDocStyle.Layout.LeftMargin) / 2; - } - - // Calulate the x location - //int x = myParentStepItem.TextLeft; - int x = center - width / 2; - if (x + width > rightLimit) x = rightLimit - width; - int colT = _MyStepPanel.ToDisplay(myStepSectionLayoutData.ColT); - if (x < colT) x = colT; - int y = FindTop(myParentStepItem.Bottom); - return new Point(x, y); - } - /// - /// Sets the Item and as a result the text for the RichTextBox - /// - private void SetText() - { - LastMethodsPush("SetText"); - if (_MyItemInfo != null) - this._MyStepRTB.MyItemInfo = _MyItemInfo; - LastMethodsPop(); - } - /// - /// If the selected StepItem is within the window leave it as it is. - /// If not, scroll so that the selected window is centered. - /// - private void ScrollToCenter() - { - //vlnStackTrace.ShowStack("CenterScroll {0} Current {1} Top {2} Bottom {3} Limit {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, Top, Bottom, _Panel.Height);// Show StackTrace - //Console.WriteLine("CenterScroll {0} Current {1} Top {2} Bottom {3} Limit {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, Top, Bottom, _Panel.Height); - if (Top >= 0 && Bottom <= _MyStepPanel.Height) return;// Don't move if within screen. - int scrollValue = _MyStepPanel.VerticalScroll.Value + (Top - (_MyStepPanel.Height / 2)); // calculate scroll center for the item - //Console.WriteLine("CenterScroll {0} Current {1} New {2} Min {3} Max {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, scrollValue, _Panel.VerticalScroll.Minimum, _Panel.VerticalScroll.Maximum); - if (scrollValue >= _MyStepPanel.VerticalScroll.Minimum && scrollValue <= _MyStepPanel.VerticalScroll.Maximum) // If it is within range - _MyStepPanel.VerticalScroll.Value = scrollValue; // Center the item - } - // TODO: the format of the circles, Checkoffs and Changebars should come from the format file - /// - /// This adds drawing items to the StepItem as needed including - /// Circle around the Tab Number - /// Check-Offs - /// Change Bars - /// - /// - /// - private void StepItem_Paint(object sender, PaintEventArgs e) - { - Graphics g = e.Graphics; - g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; - //g.DrawString(lblTab.Text, MyItemInfo.MyTab.MyFont.WindowsFont, Brushes.Red, new RectangleF(new PointF(_MyStepPanel.MyStepPanelSettings.NumberLocationX, _MyStepPanel.MyStepPanelSettings.NumberLocationY), _MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault); - // adjust x location of label by 7, to position correctly. - //g.DrawString(lblTab.Text, MyItemInfo.MyTab.MyFont.WindowsFont, Brushes.Blue, new RectangleF(new PointF(Convert.ToSingle(lblTab.Location.X-7), Convert.ToSingle(lblTab.Location.Y)), _MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault); - //g.DrawLine(Pens.DarkGreen, lblTab.Location.X-7, 0, lblTab.Location.X-7, this.Height); - //g.DrawLine(Pens.DarkGreen, MyStepRTB.Location.X - 7, 0, MyStepRTB.Location.X - 7, this.Height); - g.DrawString(lblTab.Text, MyItemInfo.MyTab.MyFont.WindowsFont, Brushes.Black, new RectangleF(new PointF(Convert.ToSingle(lblTab.Location.X), Convert.ToSingle(lblTab.Location.Y)), _MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault); - //g.DrawLine(Pens.DarkGreen, lblTab.Location.X, 0, lblTab.Location.X, this.Height); - //g.DrawLine(Pens.DarkGreen, MyStepRTB.Location.X, 0, MyStepRTB.Location.X, this.Height); - if (Circle) - { - Pen penC = new Pen(_MyStepPanel.MyStepPanelSettings.CircleColor, _MyStepPanel.MyStepPanelSettings.CircleWeight); - g.DrawArc(penC, lblTab.Left + 1, 0, _MyStepPanel.MyStepPanelSettings.CircleDiameter, _MyStepPanel.MyStepPanelSettings.CircleDiameter, 0F, 360F); - } - if (CheckOff) - { - Pen penCO = new Pen(_MyStepPanel.MyStepPanelSettings.CheckOffColor, _MyStepPanel.MyStepPanelSettings.CheckOffWeight); - g.DrawRectangle(penCO, _MyStepPanel.MyStepPanelSettings.CheckOffX, _MyStepPanel.MyStepPanelSettings.CheckOffY, _MyStepPanel.MyStepPanelSettings.CheckOffSize, _MyStepPanel.MyStepPanelSettings.CheckOffSize); - } - if (ChangeBar) - { - Pen penCB = new Pen(_MyStepPanel.MyStepPanelSettings.ChangeBarColor, _MyStepPanel.MyStepPanelSettings.ChangeBarWeight); - if (ChangeBarPosition == E_ChangeBarPosition.Left) - g.DrawLine(penCB, 0, _MyStepRTB.Top, 0, Height); // left, top, right, bottom. - else - { - g.DrawLine(penCB, Width-2, _MyStepRTB.Top, Width-2, Height); - } - } - } - /// - /// Hide a Items Children - Part of colapsing - /// - protected void HideChildren() - { - HideChildren(_MyBeforeStepItems); - HideChildren(_MyRNOStepItems); - HideChildren(_MyAfterStepItems); - } - /// - /// Hide a list of children - Part of colapsing - /// - /// - private void HideChildren(List childStepItems) - { - if (childStepItems != null) - { - foreach (StepItem child in childStepItems) - { - if (child.Expanded) child.HideChildren(); - child.Hidden = true; - } - } - } - /// - /// Unhide an items Children - Part of expanding - /// - /// - protected void UnhideChildren(bool expand) - { - UnhideChildren(_MyBeforeStepItems, expand); - UnhideChildren(_MyRNOStepItems, expand); - UnhideChildren(_MyAfterStepItems, expand); - if (!_MyvlnExpander.Expanded) - _MyvlnExpander.ShowExpanded(); - } - /// - /// Unhide a list of children - part of expanding - /// - /// - /// - private void UnhideChildren(List childStepItems, bool expand) - { - if (childStepItems != null) - { - foreach (StepItem child in childStepItems) - { - if (child.Expanded) - child.UnhideChildren(expand); - else if (expand) - child.Expand(expand); - child.Hidden = false; - } - } - } - /// - /// Move children as necessary - /// - protected void AdjustChildren() - { - AdjustChildren(_MyBeforeStepItems); - AdjustChildren(_MyRNOStepItems); - AdjustChildren(_MyAfterStepItems); - } - /// - /// Move a list of children - /// - /// - private void AdjustChildren(List childStepItems) - { - if (childStepItems != null) - { - foreach (StepItem child in childStepItems) - { - child.AdjustLocation(); - if (child.Expanded) child.AdjustChildren(); - } - } - } - /// - /// Expand a list of children - /// - /// - private void ExpandChildren(List childStepItems) - { - if (childStepItems != null) - { - foreach (StepItem child in childStepItems) - { - if (child.CanExpand) - { - child.Expand(true); - } - child.Hidden = false; - } - } - } - /// - /// Expand children - /// - private void ExpandChildren() - { - // Walk though Children performing Expand - ExpandChildren(_MyBeforeStepItems); - ExpandChildren(_MyRNOStepItems); - ExpandChildren(_MyAfterStepItems); - } - private string MyPath - { - get - { - if (MyItemInfo.MyContent.Type >= 20000) - return MyItemInfo.Path.Substring(MyItemInfo.ActiveSection.Path.Length); - return MyItemInfo.MyContent.ToString(); - } - } - private StepItem AERStepItem - { - get - { - if(RNOLevel == 0)return null; - if (MyParentStepItem != null) - { - if (MyParentStepItem.RNOLevel < RNOLevel) - return MyParentStepItem; - else - return MyParentStepItem.AERStepItem; - } - else if (MyPreviousStepItem != null) - { - return MyPreviousStepItem.AERStepItem; - } - //Volian.Base.Library.vlnStackTrace.ShowStackLocal("'AERStepItem',{0},{1}", MyID, MyItemInfo.DBSequence); - return null; - } - } - /// - /// Adjust the Location of all items below the current item. - /// - internal void AdjustLocation() - { - //Console.WriteLine("'AdjustLocation',{0},{1},'{2}'", MyID, MyItemInfo.DBSequence, Volian.Base.Library.vlnStackTrace.CalledFrom4); - if (RNORight) MoveRNO(); // This is needed when an AER is Deleted that has an RNO. - if (RNOLevel > 0 && AERStepItem != null) - AERStepItem.AdjustLocation(); - StepItem nextStepItem = NextDownStepItem; - //if (MyID == 2138) - // Console.WriteLine("2138"); - //if (_WatchThis > 0 && MyID > _StartingID) - //if((nextStepItem == null ? 0 : nextStepItem.MyID) == MyID) - //if(_LookForID.Contains(MyID)) - // Console.WriteLine("{0}AdjustLocation {1},{2},{3} -> {4},{5} ({6}) {7}", WatchThisIndent, MyID, MyItemInfo.Ordinal, MyPath, - // nextStepItem == null ? 0 : nextStepItem.MyID, nextStepItem == null ? 0 : nextStepItem.MyItemInfo.Ordinal, nextStepItem == null ? "Null" : nextStepItem.MyPath, - // _NextDownStepItemPath); - //if (_WatchThis && MyID == 2119) - // Console.WriteLine("I'm here"); - //if (MyID > 2120) - // Console.WriteLine("{0}\t{1}", MyID, nextStepItem == null ? 0 : nextStepItem.MyID); - if (nextStepItem != null) - { - //int bottom = BottomMostStepItem.Bottom; - if (nextStepItem != null) - { - //if (MyID == 2123) - // _LookForID = 2123; - int bottom = nextStepItem.FindTop(Bottom); - if (nextStepItem.Top != bottom) - // if (nextStepItem != null && !nextStepItem.Moving && nextStepItem.Top != bottom) - { - _MyStepPanel.ItemMoving++; - nextStepItem.LastMethodsPush(string.Format("AdjustLocation {0}",MyID)); - nextStepItem._NextDownStepItemPath = _NextDownStepItemPath; - nextStepItem.Top = bottom; - nextStepItem.LastMethodsPop(); - _MyStepPanel.ItemMoving--; - } - } - else - { - Console.WriteLine("{0}** No Adjustment next = {1}, moving = {2}", WatchThisIndent, nextStepItem, nextStepItem == null ? false : nextStepItem.Moving); - } - } - } - /// - /// Automatically expands Steps if not currently expanded - /// - internal void AutoExpand() - { - if (CanExpand && Expanded == false)// TODO: May need to do some additional checking for subsections - { - //vlnStackTrace.ShowStack(">AutoExpand ID {0} - Can {1} Expanded {2}", _MyItem.ItemID, CanExpand, Expanded); - Expand(_Type >= 20000); - //Console.WriteLine(" - /// Sets the focus to this StepItem and positions the cursor to the begining of the string - /// - public void ItemSelect() - { - // Was getting an Error that _MyStepRTB was Disposed RHM 20101217 - if (!_MyStepRTB.Disposing) - { - _MyStepRTB.Focus(); - _MyStepRTB.Select(0, 0); - } - else - { - _MyLog.WarnFormat("Attempt to give Focus to Disposed Object {0}", MyID); - } - // if (CanExpand) AutoExpand(); // Expand the item if you can - ScrollToCenter(); - } - /// - /// Sets the focus to this StepItem - /// - public void ItemShow() - { - _MyStepRTB.Focus(); - ScrollToCenter(); - } - /// - /// Expand an item and it's children - /// If the children have been loaded then just expand them - /// If not, load the children and expand their children etc. - /// - /// normally equal to _Type > = 20000 (Step) - public void Expand(bool expand) - { - //// TIMING: DisplayItem.TimeIt("Expand Start"); - if (_ChildrenLoaded) - { - // Unhide Children - MyExpandingStatus = ExpandingStatus.Showing; - UnhideChildren(expand); - if (_ExpandPrefix != 0) - { - _MyStepPanel.ItemMoving++; - TopMostStepItem.Top = Top; - _MyStepPanel.ItemMoving--; - } - else - TopMostStepItem.AdjustLocation(); - AdjustChildren(); - //if(_Before != null ) - // Top = _Before[_Before.Count - 1].BottomMost.Bottom; - } - else - { - MyExpandingStatus = ExpandingStatus.Expanding; - _ChildrenLoaded = true; - //_Panel.SuspendLayout(); - AddChildBefore(MyItemInfo.Cautions, expand); - AddChildBefore(MyItemInfo.Notes, expand); - AddChildAfter(MyItemInfo.Procedures, expand); - AddChildAfter(MyItemInfo.Sections, expand); - if (MyItemInfo.RNOs != null && MyItemInfo.RNOLevel < MyItemInfo.ColumnMode) - AddChildRNO(MyItemInfo.RNOs, expand); - AddChildAfter(MyItemInfo.Tables, expand); - AddChildAfter(MyItemInfo.Steps, expand); - if (MyItemInfo.RNOs != null && MyItemInfo.RNOLevel >= MyItemInfo.ColumnMode) - AddChildRNO(MyItemInfo.RNOs, expand); - if (!_MyvlnExpander.Expanded) - _MyvlnExpander.ShowExpanded(); - } - MyExpandingStatus = ExpandingStatus.Done; - BottomMostStepItem.AdjustLocation(); - MyExpandingStatus = ExpandingStatus.No; - //// TIMING: DisplayItem.TimeIt("Expand End"); - } - public StepItem BeforeItem - { - get - { - if (_MyAfterStepItems != null) - { - foreach (StepItem stepItem in _MyAfterStepItems) - { - if (stepItem._MyBeforeStepItems != null) - return stepItem.TopMostStepItem; - StepItem beforeItem = stepItem.BeforeItem; - if (beforeItem != null) return beforeItem; - } - } - return null; - } - } - public StepItem ItemAbove - { - get - { - if (_MyChildRelation == ChildRelation.Before) return _MyParentStepItem.ItemAbove; - if (_MyPreviousStepItem != null) return _MyPreviousStepItem.BottomMostStepItem; - if (_MyChildRelation == ChildRelation.After) return _MyParentStepItem; - if (_MyChildRelation == ChildRelation.RNO) return _MyParentStepItem; - return null; - } - } - private static int? max(int? value1, int value2) - { - if (value1 == null || value2 > value1) return value2; - return value1; - } - private static int min(int value1, int value2) - { - if (value2 < value1) return value2; - return value1; - } - public int FindRight() - { - if (!RNORight) return Right; - return _MyRNOStepItems[0].FindRight(); - } - public int? BottomOfParentRNO() - { - int? bottom = null; - StepItem stepItem = this; - if (!MyItemInfo.IsTablePart) - { - if (stepItem._MyChildRelation == ChildRelation.None) - return null; - if (stepItem._MyChildRelation == ChildRelation.After && !RNORight) - return null; - } - while (stepItem != null && stepItem._MyChildRelation != ChildRelation.None && stepItem._MyChildRelation != ChildRelation.After) - stepItem = stepItem.UpOneStepItem; - if (stepItem == null || stepItem._MyChildRelation == ChildRelation.None) - return null; - StepItem parent = stepItem.UpOneStepItem; - int right = FindRight(); - bool centeredTable = (MyItemInfo.IsTablePart && MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0); - while (parent != null && parent.MyItemInfo.IsSection == false) - { - if (parent._MyRNOStepItems != null) - { - if (centeredTable || right > parent._MyRNOStepItems[0].Left) - { - if(parent._MyRNOStepItems[0].BottomMostStepItem.RNOLevel > RNOLevel && RNOLevel < _MyItemInfo.ColumnMode) - bottom = max(bottom, parent._MyRNOStepItems[0].BottomMostStepItem.Bottom); - } - } - parent = parent.UpOneStepItem; - } - return bottom; - } - private string _NextDownStepItemPath = "None"; - /// - /// This finds the next StepItem down. - /// - public StepItem NextDownStepItem - { - get - { - StepItem stepItem = this; - _NextDownStepItemPath = "Path 1"; - // If this item appears before it's parent, and it doesn't have anything below it, return the parent - if (MyNextStepItem == null && MyAfterStepItems == null && FirstSiblingStepItem._MyChildRelation == ChildRelation.Before) - return UpOneStepItem; - _NextDownStepItemPath = "Path 2"; - if (Expanded && _MyAfterStepItems != null)// check to see if there is a _After - return MyAfterStepItems[0].TopMostStepItem;// if there is, go that way - _NextDownStepItemPath = "Path 3"; - if (Expanded && MyRNOStepItems != null && MyItemInfo.RNOLevel >= MyItemInfo.ColumnMode)// check to see if there is a _After - return MyRNOStepItems[0].TopMostStepItem;// if there is, go that way - while (stepItem != null && stepItem.MyNextStepItem == null) // if no Next walk up the parent path - { - bool lastWasRNO = (stepItem._MyChildRelation == ChildRelation.RNO); - stepItem = stepItem.UpOneStepItem; - _NextDownStepItemPath = "Path 4"; - if (stepItem == null) // No Parent - return null; - _NextDownStepItemPath = string.Format("Path 5 {0}, {1}",stepItem.MyExpandingStatus,stepItem.Moving); - if (stepItem.MyExpandingStatus == ExpandingStatus.Expanding || stepItem.Moving) // Parent Expanding or Moving - Wait - return null; - _NextDownStepItemPath = "Path 5 RNO"; - if (stepItem.RNOBelow && !Ancestor(stepItem.MyRNOStepItems[0])) - return stepItem.MyRNOStepItems[0]; - _NextDownStepItemPath = "Path 6"; - if (stepItem.MyNextStepItem == null && stepItem.FirstSiblingStepItem._MyChildRelation == ChildRelation.Before) - return stepItem.UpOneStepItem; - StepItem btm = stepItem.BottomMostStepItem; // Find the Bottom StepItem of this ancestor - StepItem beforeItem = stepItem.BeforeItem; - if (lastWasRNO && beforeItem != null) - { - _NextDownStepItemPath = "Path 7"; - if (beforeItem.ItemAbove.Bottom > this.Bottom) return null; - _NextDownStepItemPath = "Path 8"; - return beforeItem; - } - if (this != btm) // If this is not the bottom, then just adjust things with respect to the bottom - { - StepItem btmNext = btm.NextDownStepItem; - //if (stepItem.MyNextStepItem != null && stepItem.MyNextStepItem.TopMostStepItem.Top != btm.Bottom) - if (btmNext != null) - { - int bottom = btmNext.FindTop(btm.Bottom); - if(btmNext.Top != bottom) - { - _MyStepPanel.ItemMoving++; - //stepItem.MyNextStepItem.TopMostStepItem.Top = btm.Bottom; - //Console.WriteLine("{0}***Move in NextDownStepItem {1},{2} From {3} To {4}",WatchThisIndent, btmNext.MyID, btmNext, btmNext.Top, btm.Bottom); - btmNext.LastMethodsPush(string.Format("NextDownStepItem {0} {1}", MyID, stepItem.MyID)); - //ShowMe(string.Format("FindTop = {0}", btmNext.FindTop(btm.Bottom))); - btmNext.Top = bottom; - btmNext.LastMethodsPop(); - _MyStepPanel.ItemMoving--; - } - } - _NextDownStepItemPath = string.Format("Path 9 {0}",btm); - return null; // Not the bottom - don't adjust anything else - } - //else - //{ - //} - } - if (stepItem != null) - { - // Need to verify that the bottom of the parents RNO does not excede the bottom of this item. - StepItem next = stepItem.MyNextStepItem.TopMostStepItem; - _NextDownStepItemPath = "Path A"; - //if (Bottom >= (BottomOfParentRNO(next) ?? Bottom)) - return next;// if no _After - check to see if there is a Next - //_NextDownStepItemPath = "Path B"; - //return null; - } - _NextDownStepItemPath = "Path C"; - return null; - } - } - - private bool Ancestor(StepItem stepItem) - { - if (MyID == stepItem.MyID) return true; - if (MyItemInfo.IsHigh) return false; - return UpOneStepItem.Ancestor(stepItem); - } - public override string ToString() - { - return _MyItemInfo == null ? base.ToString() : string.Format("{0},'{1}'", MyID, MyPath); // + "-" + MyItemInfo.MyContent.Text; - } - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/StepItem.designer.cs b/PROMS/Volian.Controls.Library/StepItem.designer.cs deleted file mode 100644 index b6b24edc..00000000 Binary files a/PROMS/Volian.Controls.Library/StepItem.designer.cs and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/StepItem.resx b/PROMS/Volian.Controls.Library/StepItem.resx deleted file mode 100644 index 93e3f68d..00000000 --- a/PROMS/Volian.Controls.Library/StepItem.resx +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - - - 148, 17 - - - True - - - True - - - True - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/StepPanel.cs b/PROMS/Volian.Controls.Library/StepPanel.cs deleted file mode 100644 index 9b47a403..00000000 --- a/PROMS/Volian.Controls.Library/StepPanel.cs +++ /dev/null @@ -1,1338 +0,0 @@ -using System; -using System.ComponentModel; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using System.Drawing; -using System.Text.RegularExpressions; -using Volian.Base.Library; -using JR.Utils.GUI.Forms; -using System.Linq; - -namespace Volian.Controls.Library -{ - public partial class StepPanel : Panel - { - #region Fields - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - /// - /// Procedure Item Info - Top ItemInfo - /// - private ItemInfo _MyProcedureItemInfo; - private E_ViewMode _VwMode = E_ViewMode.Edit; - public E_ViewMode VwMode - { - get { return _VwMode; } - 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 - /// - /// Lookup Table to convert ItemInfo.ItemID to EditItem - /// - internal Dictionary _LookupEditItems; - public EditItem FindItem(ItemInfo itemInfo) - { - if (itemInfo == null) return null; - if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) return null; - return _LookupEditItems[itemInfo.ItemID]; - } - private int _ApplDisplayMode = -1; - public int ApplDisplayMode - { - get { return _ApplDisplayMode; } - set - { - if(_ApplDisplayMode == value) return; - _ApplDisplayMode = value; - foreach (Control c in Controls) - { - EditItem ei = c as EditItem; - if (ei != null) - { - ei.Enabled = ei.MyItemInfo.IsApplicable(value); - //IItemConfig cfg = ei.MyItemInfo.MyConfig as IItemConfig; - //List apples = cfg.MasterSlave_Applicability.GetFlags(); - //if (value == -1 || apples.Count == 0) - // ei.Enabled = true; - //else - // ei.Enabled = apples.Contains(value); - } - } - } - } - /// - /// Currently selected ItemInfo - /// - internal ItemInfo _SelectedItemInfo; - private int _ItemMoving = 0; - 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 _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 _InactiveColor = Color.Linen; - private Color _AnnotationColor = Color.FromArgb(255, 255, 128); - private Color _TabColor = Color.Beige; - private Color _PanelColor = Color.LightGray; - // Whether panel is in view or edit mode. Toggled from steprtb - // or set based on approval/multi-user (these two will be done - // later. - //public E_ViewMode PanelViewEditMode = E_ViewMode.Edit; - internal string _LastAdjust=""; - private bool _ShowLines = true; - private Graphics _MyGraphics = null; - private int _DPI = 0; - #endregion - #region Item Events - /// - /// Occurs when the user clicks tab of a EditItem - /// - public event StepPanelEvent ItemClick; - /// - /// Checks to see if the 'ItemClick' event is handled and launches it - /// - /// - /// - internal void OnItemClick(object sender, StepPanelEventArgs args) - { - if (ItemClick != null) ItemClick(sender, args); - } - public bool ItemSelectionChangeShown = false; // This keeps OnItemSelectedChanged from being called twice when an item is selected. - /// - /// Occurs when the selected EditItem changes - /// - public event ItemSelectedChangedEvent ItemSelectedChanged; - /// - /// Checks to see if the 'ItemSelectedChanged' event is handled and launches it - /// - /// - /// - internal void OnItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args) - { - ItemSelectionChangeShown = true;//Remember that you have run already - //vlnStackTrace.ShowStack(string.Format("OnItemSelectedChanged {0}",args.MyItemInfo.ItemID)); - if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args); - } - /// - /// Occurs when the user clicks on the Attachment Expander - /// - public event StepPanelAttachmentEvent AttachmentClicked; - /// - /// Checks to see if the 'AttachmentClicked' event is handled and launches it - /// - /// - /// - internal void OnAttachmentClicked(object sender, StepPanelAttachmentEventArgs args) - { - if (AttachmentClicked != null) AttachmentClicked(sender, args); - 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; - internal void OnTabDisplay(object sender, StepPanelTabDisplayEventArgs args) - { - TabDisplay(sender, args); - } - // close section, if deleting word doc section - public event StepPanelWordSectionCloseEvent WordSectionClose; - internal void OnWordSectionClose(object sender, WordSectionEventArgs args) - { - WordSectionClose(sender, args); - } - // if section deleted, have event to flag in other UI panels - public event StepPanelWordSectionDeletedEvent WordSectionDeleted; - internal void OnWordSectionDeleted(object sender, WordSectionEventArgs args) - { - WordSectionDeleted(sender, args); - } - // if item pasted, have event to flag in other UI panels - public event StepPanelItemPastedEvent ItemPasted; - internal void OnItemPasted(object sender, vlnTreeItemInfoPasteEventArgs args) - { - ItemPasted(sender, args); - } - #endregion - #region Link Events - /// - /// Occurs when the user moves onto or off of a Link - /// - public event StepPanelLinkEvent LinkActiveChanged; - /// - /// Checks to see if the 'LinkActiveChanged' event is handled and launches it - /// - /// - /// - internal void OnLinkActiveChanged(object sender, StepPanelLinkEventArgs args) - { - if (LinkActiveChanged != null) LinkActiveChanged(sender, args); - else FlexibleMessageBox.Show(args.LinkInfoText, "Unhandled Link Active Changed", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - /// - /// Occurs when the user chooses to Insert a Transition - /// - public event StepPanelLinkEvent LinkInsertTran; - /// - /// Checks to see if the 'LinkInsertTran' event is handled and launches it - /// - /// - /// - internal void OnLinkInsertTran(object sender, StepPanelLinkEventArgs args) - { - if (LinkInsertTran != null) LinkInsertTran(sender, args); - else FlexibleMessageBox.Show(args.LinkInfoText, "Unhandled Link Insert Tran", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - /// - /// Occurs when the user chooses to Insert an RO - /// - public event StepPanelLinkEvent LinkInsertRO; - /// - /// Checks to see if the 'LinkInsertRO' event is handled and launches it - /// - /// - /// - internal void OnLinkInsertRO(object sender, StepPanelLinkEventArgs args) - { - if (LinkInsertRO != null) LinkInsertRO(sender, args); - else FlexibleMessageBox.Show(args.LinkInfoText, "Unhandled Link Insert RO", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - /// - /// Occurs when the user clicks a Link - /// - public event StepPanelLinkEvent LinkClicked; - /// - /// Checks to see if the 'LinkClicked' event is handled and launches it - /// - /// - /// - internal void OnLinkClicked(object sender, StepPanelLinkEventArgs args) - { - if (LinkClicked != null) LinkClicked(sender, args); - else FlexibleMessageBox.Show(args.LinkInfoText, "Unhandled Link Click", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - /// - /// Occurs when the user chooses to modify a Transition - /// - public event StepPanelLinkEvent LinkModifyTran; - /// - /// Checks to see if the 'LinkModifyTran' event is handled and launches it - /// - /// - /// - internal void OnLinkModifyTran(object sender, StepPanelLinkEventArgs args) - { - if (LinkModifyTran != null) LinkModifyTran(sender, args); - else FlexibleMessageBox.Show(args.LinkInfoText, "Unhandled Link Modify Tran", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - /// - /// Occurs when the user chooses to modify an RO - /// - public event StepPanelLinkEvent LinkModifyRO; - /// - /// Checks to see if the 'LinkModifyRO' event is handled and launches it - /// - /// - /// - internal void OnLinkModifyRO(object sender, StepPanelLinkEventArgs args) - { - if (LinkModifyRO != null) LinkModifyRO(sender, args); - else FlexibleMessageBox.Show(args.LinkInfoText, "Unhandled Link Modify RO", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - #endregion - #region Constructors - public StepPanel() - { - InitializeComponent(); - SetupStepPanel(); - } - private void SetupStepPanel() - { - this.BackColorChanged += new EventHandler(StepPanel_BackColorChanged); - if (VlnSettings.DebugMode) - { - _InactiveColor = Color.Linen; - _TabColor = Color.Beige; - _PanelColor = Color.LightGray; - this.Paint += new PaintEventHandler(StepPanel_Paint); - this.DoubleClick += new EventHandler(StepPanel_DoubleClick); // Toggles Vertical lines on and off - } - else - { - _InactiveColor = Color.White; - _TabColor = Color.White; - _PanelColor = Color.White; - this.BackColor = Color.White; - } - this.AutoScroll = true; - } - public StepPanel(IContainer container) - { - container.Add(this); - InitializeComponent(); - SetupStepPanel(); - } - void StepPanel_BackColorChanged(object sender, EventArgs e) - { - // Walk through controls & set colors - InactiveColor = PanelColor = BackColor; - foreach (Control ctrl in Controls) - { - if (ctrl is EditItem) - { - EditItem ei = (EditItem)ctrl; - ei.BackColor = BackColor; - } - } - } - #endregion - #region Private Methods - /// - /// Expands an Item and It's Parents as need to display an item - /// - /// Item to Expand - private void ExpandAsNeeded(ItemInfo myItemInfo) - { - - int id = myItemInfo.ItemID; - if (!_LookupEditItems.ContainsKey(id)) // If the item is not currently displayed - ExpandAsNeeded((ItemInfo)myItemInfo.ActiveParent); // Expand it's parent - if (_LookupEditItems.ContainsKey(id)) // Expanding Parent should have added it to _LookupEditItems - { - EditItem itm = _LookupEditItems[id]; - ItemInfo ii = myItemInfo.ActiveParent as ItemInfo; - if (itm.Visible == false && ii != null) - ExpandAsNeeded((ItemInfo)myItemInfo.ActiveParent); - itm.AutoExpand(); // Expand it if it should expand - } - } - #endregion - #region Properties - public StepTabPanel MyStepTabPanel - { get { return Parent as StepTabPanel; } } - /// - /// Procedure Item Info - Top ItemInfo - /// Get and Set - Set stes-up all of the - /// - public ItemInfo MyProcedureItemInfo - { - get { return _MyProcedureItemInfo; } - set - { - //// TIMING: DisplayItem.TimeIt("pMyItem Start"); - _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(); - _LookupEditItems = new Dictionary(); - //// TIMING: DisplayItem.TimeIt("pMyItem Clear"); - //SuspendLayout(); - new RTBItem(_MyProcedureItemInfo, this, null, ChildRelation.None, false); - //ResumeLayout(); - //// TIMING: DisplayItem.TimeIt("pMyItem End"); - } - } - public bool AutoExpand - { - get - { - // This is temporary to get the code working for this particular procedure - if (MyProcedureItemInfo.DisplayNumber == "PMS-810") return false; - if (MyProcedureItemInfo.DisplayNumber == "PMS-809") return false; - return true; - } - } - public void Reset() - { - ItemInfo parent = SelectedItemInfo.ActiveParent as ItemInfo; - if (parent != null) ItemInfo.ResetParts(parent.ItemID); // Force data to reload - else ItemInfo.ResetParts(SelectedItemInfo.ItemID); - // The following line actually reloads the procedure item - MyProcedureItemInfo = MyProcedureItemInfo; // see get/set above. - Load Procedure and Sections - // The following line expands the items needed to display SelectedItemInfo - ExpandAsNeeded(SelectedItemInfo); - } - public void Reset(ItemInfo myItemInfo) - { - ItemInfo parent = myItemInfo.ActiveParent as ItemInfo; - if (parent != null) ItemInfo.ResetParts(parent.ItemID); // Force data to reload - else ItemInfo.ResetParts(myItemInfo.ItemID); - // The following line actually reloads the procedure item - MyProcedureItemInfo = MyProcedureItemInfo; // see get/set above. - Load Procedure and Sections - // The following line expands the items needed to display SelectedItemInfo - ExpandAsNeeded(myItemInfo); - } - - //C2019-036 View Only mode work with Checked Out Procedures - public void ResetAll() - { - List itemIDs = Controls.OfType().Where(t => t?.MyItemInfo?.ActiveParent != null && t.MyItemInfo.ActiveParent.GetType() == typeof(ItemInfo)).Select(x => (x.MyItemInfo.ActiveParent as ItemInfo).ItemID).Distinct().ToList(); - - foreach (int itemID in itemIDs) - { - ItemInfo.ResetParts(itemID); - } - - // The following line actually reloads the procedure item - MyProcedureItemInfo = ItemInfo.Get(MyProcedureItemInfo.ItemID, true); - MyProcedureItemInfo.RefreshConfig(); - ContentInfo.Refresh(Content.Get(MyProcedureItemInfo.MyContent.ContentID, true)); - - // The following line expands the items needed to display SelectedItemInfo - ExpandAsNeeded(SelectedItemInfo); - } - - /// - /// Currently selected StepRTB - /// - //private StepRTB _SelectedStepRTB = null; - //public StepRTB SelectedStepRTB - //{ - // get { return _SelectedStepRTB; } - // set { _SelectedStepRTB=value;} - //} - /// - /// Gets or Sets the SelectedItemInfo - /// Activates and Expands as necessary - /// - public ItemInfo SelectedItemInfo - { - get { return _SelectedItemInfo; } - set - { - _SelectedItemInfo = value; - ItemSelectionChangeShown = false; //OnItemSelectedChanged has not run yet. - SelectedEditItem.ItemSelect(); - if (!ItemSelectionChangeShown) OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(SelectedEditItem)); - } - } - public EditItem GetEditItem(ItemInfo itemInfo) - { - ExpandAsNeeded(itemInfo); - if (_SelectedItemInfo == null) _SelectedItemInfo = itemInfo; - //if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) Reset(); - if (itemInfo.Moving) - { - Reset(itemInfo); - itemInfo.Moving = false; - } - else if ( !_LookupEditItems.ContainsKey(itemInfo.ItemID)) Reset(itemInfo); - if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) return null; - return _LookupEditItems[itemInfo.ItemID]; - } - private bool _DisplayItemChanging = false; - public bool DisplayItemChanging - { - get { return _DisplayItemChanging; } - set { _DisplayItemChanging = value; } - } - /// - /// Returns the SelectedEditItem - /// - private EditItem _SelectedEditItem; - public EditItem SelectedEditItem - { - get - { - return _SelectedEditItem; - //return (_SelectedItemInfo != null) ? _LookupEditItems[_SelectedItemInfo.ItemID] : null; - } - set - { - 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) - EditItem lastEI = _SelectedEditItem; - if (value != null) value.SetActive(); // Set the active color - if (lastEI == value) return; // Same - No Change - // B2018-002 - Invalid Transitions - If the current step contains an invalid transition convert it to text - if(value != null) ItemInfo.ConvertInvalidTransitionsToText(value.MyItemInfo); - if (lastEI != null && lastEI.BeingDisposed == false) - { - // B2019-139 if a procedure with out a title, or a section without a title, don't try to delete when you are moving off of the title while in the step editor - bool shouldDelete = !lastEI.BeingRemoved && lastEI.Empty && (lastEI.MyItemInfo.MyContent.ContentEntryCount <= 0) && !_SelectedItemInfo.IsProcedure && !_SelectedItemInfo.IsSection; - if (shouldDelete) - { - if (lastEI.HasChildren) - { - // B2018-152 Added a messagebox for when user clicks on a substep of a step element who's text was just deleted - // Also made the message for when we ask about removing a step and its substeps more descriptive - string msg1 = "Do you want to delete it and its substeps?"; - string msg2 = "Select YES to remove the empty step"; - 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)) - { - 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."; - deletingParent = true; // B2018-152 this will tell us that the user selected a substep of a parent being deleted - } - else - { - msg1 = "This step does not have text but has substeps. " + msg1; - msg2 = msg2 + " and its substeps."; - } - DialogResult result = FlexibleMessageBox.Show(msg1 + "\n\n" + msg2 + "\n\n" + msg3, "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (result == DialogResult.No) shouldDelete = false; - } - } - if (shouldDelete) - { - // 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. - EnhancedDocuments eds = null; - StepConfig sc = lastEI.MyItemInfo.MyConfig as StepConfig; - if (sc != null) eds = sc.MyEnhancedDocuments; - else - { - // 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. - if (lastEI.MyItemInfo.IsSection) - { - SectionConfig sec = lastEI.MyItemInfo.MyConfig as SectionConfig; - if (sec != null) - { - if (sec.Section_LnkEnh == "Y") eds = sec.MyEnhancedDocuments; - else lastEI.MyItemInfo.ClearEnhancedSectionLink(); - } - } - } - List enhIds = new List(); - if (eds != null) - { - foreach (EnhancedDocument ed in eds) - { - if (ed.Type != 0) enhIds.Add(ed.ItemID); - } - } - float oldTop = lastEI.Top; - newFocus = lastEI.DeleteItem(); //B2018-152 made "newFocus" available outside this IF statement - if (newFocus == null) - { - lastEI.RefreshContent(); - return; - } - float newTop = newFocus.Top; - lastEI.Dispose(); - newFocus.SetAllTabs(); - // If the step being deleted appears above the step to recieve focus, find another step - // to use so that the steps are positioned properly (vertically) - if (oldTop < newTop) - { - if (newFocus.MyParentEditItem != null) - { - if (newFocus.Top > newFocus.MyParentEditItem.Top) - newFocus.MyParentEditItem.AdjustLocation(); - else if (newFocus.MyParentEditItem.MyPreviousEditItem != null && - newFocus.Top > newFocus.MyParentEditItem.MyPreviousEditItem.Top) - newFocus.MyParentEditItem.MyPreviousEditItem.AdjustLocation(); - else if (newFocus.MyParentEditItem.MyParentEditItem != null && - newFocus.Top > newFocus.MyParentEditItem.MyParentEditItem.Top) - newFocus.MyParentEditItem.MyParentEditItem.AdjustLocation(); - else - newFocus.AdjustLocation(); - } - else if (newFocus.MyPreviousEditItem != null) - newFocus.MyPreviousEditItem.AdjustLocation(); - else - newFocus.AdjustLocation(); - } - else - newFocus.AdjustLocation(); - foreach (int enhId in enhIds) - { - ItemInfo ii = ItemInfo.Get(enhId); - bool success = MyStepTabPanel.MyDisplayTabControl.DeleteRTBItem(ii); - if (!success) // item was not displayed in editor, just delete from database (add tree if necessarY) - Item.DeleteItemAndChildren(ii); - } - } - else - { - lastEI.SaveContents(); - if (!(lastEI.MyItemInfo.IsTable)) - lastEI.RefreshDisplay(false); - } - } - //B2018-152 if we are deleteing a step element that has substeps and the user click on one of those substep, - // use resulting focus position returned from lastEI.DeleteItem() instead of current "value" - if (deletingParent && newFocus != null) - value = newFocus; - _SelectedEditItem = value; - if (MyStepTabPanel != null) - MyStepTabPanel.MyStepTabRibbon.MyEditItem = value;// Update StepTabRibbon.MyEditItem to match - if (value != null) - { - _SelectedEditItem.RefreshDisplay(true); - if (_SelectedItemInfo.ItemID != value.MyItemInfo.ItemID) - { - ExpandAsNeeded(value.MyItemInfo); - SelectedItemInfo = value.MyItemInfo; - } - } - if (lastEI != null) - lastEI.IdentifyMe(false); - } - } - /// - /// Displays the selected EditItem - /// - public void ItemShow() - { - if (_SelectedEditItem != null && SelectedEditItem.BeingDisposed == false) - { - SelectedEditItem.ItemShow(); - OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(SelectedEditItem)); - } - } - public new void MouseWheel(MouseEventArgs e) - { - base.OnMouseWheel(e); - } - /// - /// Used to track movement other than scrolling - /// 0 - Indicates no other movement - /// > 0 - Indicates that other movement is happening - /// - public int ItemMoving - { - get { return _ItemMoving; } - set { _ItemMoving = value; } - } - /// - /// Lazy loaded StepPanelSettings - /// - public StepPanelSettings MyStepPanelSettings - { - get - { - if (_MyStepPanelSettings == null) _MyStepPanelSettings = new StepPanelSettings(this); - return _MyStepPanelSettings; - } - set { _MyStepPanelSettings = value;} - } - /// - /// Gets or Sets the font for the Panel - /// - public Font MyFont - { - get { return _MyFont; } - set { _ProcFont = _SectFont = _StepFont = _MyFont = value; } - } - /// - /// Gets or sets the font for the Procedure Text - /// - public Font ProcFont - { - get { return _ProcFont; } - set { _ProcFont = value; } - } - /// - /// Gets or sets the font for the Section Text - /// - public Font SectFont - { - get { return _SectFont; } - set { _SectFont = value; } - } - /// - /// Gets or sets the Step Font - /// - public Font StepFont - { - get { return _StepFont; } - set { _StepFont = value; } - } - /// - /// Gets or Sets the Active Color for the Panel - /// - public Color ActiveColor - { - get { - // C2015-028 Add Editorial Mode to PROMS Step Editor - // if in Editorial Mode, use LightGreen background - _ActiveColor = MyStepTabPanel != null && MyStepTabPanel.MyDisplayTabControl.IsInEditorialMode ? Color.LightGreen : Color.SkyBlue; - return _ActiveColor; - } - set { _ActiveColor = value; } - } - /// - /// Gets or Sets the Annotation backcolor for StepRTBs in the Panel - /// - public Color AnnotationColor - { - get { return _AnnotationColor; } - set { _AnnotationColor = value; } - } - /// - /// Gets or sets the InActive Color for the Panel - /// - public Color InactiveColor - { - get { return _InactiveColor; } - set { _InactiveColor = value; } - } - /// - /// Gets or sets the Tab Color - /// - public Color TabColor - { - get { return _TabColor; } - set { _TabColor = value; } - } - /// - /// Gets or sets the Panel Color - /// - public Color PanelColor - { - get { return _PanelColor; } - set { _PanelColor = value; - BackColor = value; - } - } - #endregion - #region DisplayConversions - /// - /// gets a Graphic object for the panel - /// - public Graphics MyGraphics - { - get - { - if (_MyGraphics == null) - _MyGraphics = CreateGraphics(); - return _MyGraphics; - } - } - /// - /// Gets the DPI setting for the current graphics setting - /// - internal int DPI - { - get - { - if (_DPI == 0) - _DPI = Convert.ToInt32(MyGraphics.DpiX); - return _DPI; - } - } - /// - /// Converts an integer value from Twips to Pixels - /// - /// - /// - public int ToDisplay(int value) - { - //return (DPI * value) / 864; - return (DPI * value) / 72; - } - public int ToDisplay(float? value) - { - //return (DPI * value) / 864; - return (int)(DPI * (value??0)) / 72; - } - /// - /// Converts an integer? value from Twips to Pixels - /// - /// - /// - public int ToDisplay(int? value) - { - return ToDisplay((int)value); - } - /// - /// Converts an string value from Twips to Pixels - /// - /// - /// - public int ToDisplay(string value) - { - return ToDisplay(Convert.ToSingle(value)); - } - /// - /// Converts a value from a list in a string from Twips to Pixels - /// - /// - /// - public int ToDisplay(string value,int i) - { - if (i < 0) return 0; - string s = value.Split(",".ToCharArray())[i]; - return ToDisplay(s); - } - #endregion - #region Debug Methods - /// - /// Gets or sets ShowLines so that vertical lines are shown for debugging purposes - /// - public bool ShowLines - { - get { return _ShowLines; } - set { _ShowLines = value; } - } - /// - /// Draw a vertical line - /// - /// - /// - private void VerticalLine(Graphics g, int x) - { - Pen bluePen = new Pen(Color.CornflowerBlue,1); - g.DrawLine(bluePen, x, 0, x, this.Height); - } - /// - /// Toggle the vertical lines on and off - /// - /// - /// - private void StepPanel_DoubleClick(object sender, EventArgs e) - { - ShowLines = !ShowLines; - 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); - } - } - /// - /// Output all of the EditItem controls to the log - /// - 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 - #region Cursor Movement Methods - /// - /// Finds the Displayed 'top' child for a given item. Used for down arrow. - /// - /// ItemInfo - /// - private ItemInfo TopPart(ItemInfo ii) - { - ExpandAsNeeded(ii); - if (ii.Cautions != null && ii.Cautions.Count > 0) return TopPart(ii.Cautions[0]); - if (ii.Notes != null && ii.Notes.Count > 0) return TopPart(ii.Notes[0]); - return (ii); - } - /// - /// Finds the Displayed 'bottom' child for a given item. Used for up arrow. - /// - /// ItemInfo - /// - private ItemInfo BottomPart(ItemInfo ii) - { - ExpandAsNeeded(ii); - if (ii.RNOs != null && ii.RNOs.Count > 0 && ii.RNOLevel >= ii.ColumnMode) return BottomPart(ii.RNOs[0]); - if (ii.Sections != null && ii.Sections.Count > 0) return BottomPart(ii.Sections[0].LastSibling); - if (ii.Steps != null && ii.Steps.Count > 0) return BottomPart(ii.Steps[0].LastSibling); - if (ii.Tables != null && ii.Tables.Count > 0) return BottomPart(ii.Tables[0].LastSibling); - return ii; - } - /// - /// Supports cursor movement between richtext boxes, including arrow keys/page up,down/ - /// ctrl Home,End - /// - /// StepRTB - /// Point - /// E_ArrowKeys - public void CursorMovement(EditItem ei, Point position, E_ArrowKeys arrow) - { - ItemInfo ii = null; - // The following lines are debug to check that the results of moving down and moving up are the same - //ItemInfo ix = null; - switch (arrow) - { - case E_ArrowKeys.Up: - case E_ArrowKeys.CtrlUp: - ii = ArrowUp(ei.MyItemInfo); - // The following lines are debug to check that the results of moving down and moving up are the same - //ix = ArrowDown(ii); - //Console.WriteLine("'Up',{0},{1},{2},{3}", rtb.MyItemInfo.ItemID, rtb.MyItemInfo.DBSequence, ii.DBSequence, ix.DBSequence); - if (ii != null) SelectedEditItem = _LookupEditItems[ii.ItemID]; - break; - case E_ArrowKeys.Down: - case E_ArrowKeys.CtrlDown: - ii = MoveDown(ei, ii); - break; - case E_ArrowKeys.Right: - case E_ArrowKeys.CtrlRight: - if (!ei.MyItemInfo.IsInRNO && ei.MyItemInfo.RNOs != null) - SelectedEditItem = _LookupEditItems[ei.MyItemInfo.RNOs[0].ItemID]; - else - ii = MoveDown(ei, ii); - break; - case E_ArrowKeys.Left: - //case E_ArrowKeys.CtrlLeft: - if (!ei.MyItemInfo.IsProcedure) - { - EditItem tmpEI = null; - //SelectedEditItem = _LookupEditItems[ei.MyItemInfo.MyParent.ItemID]; - ii = ArrowUp(ei.MyItemInfo); - if (ii != null) - { - ItemInfo tmpII = ii; - while (!ei.MyItemInfo.IsInRNO && tmpII.RNOs != null) - tmpII = GetLowestRNOEditItem(tmpII, ei.MyItemInfo); - if (tmpII != ei.MyItemInfo) - ii = tmpII; - SelectedEditItem = _LookupEditItems[ii.ItemID]; - } - } - break; - case E_ArrowKeys.CtrlLeft: // this logic is same as in 16-bit VE-PROMS - if (!ei.MyItemInfo.IsProcedure) - SelectedEditItem = _LookupEditItems[ei.MyItemInfo.MyParent.ItemID]; - break; - default: - break; - } - } - - // This is used for the Left Arrow key when we move off the current edit window - private ItemInfo GetLowestRNOEditItem(ItemInfo newII, ItemInfo startII) - { - EditItem tmpEI = _LookupEditItems[newII.RNOs[newII.RNOs.Count - 1].ItemID]; - ItemInfo tmpII = tmpEI.MyItemInfo; - while (tmpII != startII && tmpII.RNOs != null) - { - tmpEI = _LookupEditItems[tmpII.RNOs[tmpII.RNOs.Count - 1].ItemID]; - tmpII = tmpEI.MyItemInfo; - } - if (tmpII != startII && tmpEI.MyAfterEditItems != null) - tmpEI = tmpEI.MyAfterEditItems[tmpEI.MyAfterEditItems.Count - 1]; - return tmpEI.MyItemInfo; - } - - private ItemInfo MoveDown(EditItem ei, ItemInfo ii) - { - ii = ArrowDown(ei.MyItemInfo); - // The following lines are debug to check that the results of moving down and moving up are the same - //ix = ArrowUp(ii); - //Console.WriteLine("'Down',{0},{1},{2},{3}", rtb.MyItemInfo.ItemID, rtb.MyItemInfo.DBSequence, ii.DBSequence, ix.DBSequence); - if (ii != null) SelectedEditItem = _LookupEditItems[ii.ItemID]; - return ii; - } - private ItemInfo ArrowUp(ItemInfo ii) - { - // Arrow-Up from a Substep should look for a Table. - if (ii.IsStepPart && (ii.MyPrevious == null) && (ii.ActiveParent as ItemInfo).Tables != null) - return BottomPart((ii.ActiveParent as ItemInfo).Tables[0]); - // if on RNO, check display mode (1 column/2 column, etc) and how deep RNO is before going to - // parents substeps. - if (ii.IsRNOPart && ii.MyParent.Steps != null && ii.RNOLevel >= ii.ColumnMode) return BottomPart(ii.MyParent.Steps[0].LastSibling); - - // If on top note and parent has cautions - go to bottom caution - if (ii.IsFirstNotePart && ii.MyParent != null && ii.MyParent.Cautions != null) return BottomPart(ii.MyParent.Cautions[0].LastSibling); - if (ii.IsFirstCautionPart || ii.IsFirstNotePart) - { - if (ii.MyParent.MyPrevious != null) return BottomPart(ii.MyParent.MyPrevious); - return ii.MyParent.MyParent; - } - - // If has note, BottomPart of last sibling of the note - if (ii.Notes != null) return BottomPart(ii.Notes[0].LastSibling); - // If has caution, BottomPart of last sibling of the caution - if (ii.Cautions != null) return BottomPart(ii.Cautions[0].LastSibling); - // If previous sibling, BottomPart of previous sibling - if (ii.MyPrevious != null && ii.IsProcedure == false) return BottomPart(ii.MyPrevious); - // Go to parent until at procedure - if (!ii.IsProcedure) return (ii.MyParent); - return null; - } - private ItemInfo ArrowDown(ItemInfo ii) - { - return ArrowDown(ii, true, true); - } - private ItemInfo ArrowDown(ItemInfo ii, bool lookAtSub, bool lookAtRNO) - { - if (ii.IsSection || ii.IsProcedure) - { - if (lookAtSub && ii.Sections != null) return TopPart(ii.Sections[0]); - if (lookAtSub && ii.Steps != null) return TopPart(ii.Steps[0]); - ItemInfo nxt = ii.GetNext(); - if (nxt != null) return TopPart(nxt); - } - else - { - // Subitems - go to top part of subitem - // (the lookAtSub prevented looping within a substep group at same level) - // Arrow down from a Table should look for a Substep - if(ii.IsTablePart && (ii.ActiveParent as ItemInfo).Steps != null) - return TopPart((ii.ActiveParent as ItemInfo).Steps[0]); - - // if this is enhanced background, the RNO is displayed after the HLS, so check - // for this, arrow down should go to the RNO. If on the RNO, then go to substeps if they exist. - if (((ii.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds)) - { - if (lookAtRNO && ii.RNOs != null) return TopPart(ii.RNOs[0]); - if (ii.IsRNOPart && ii.MyHLS.Steps != null) return TopPart(ii.MyHLS.Steps[0]); - } - if (lookAtSub && ii.Tables != null) return TopPart(ii.Tables[0]); - if (lookAtSub && ii.Steps != null) return TopPart(ii.Steps[0]); - // RNOs: Use PMode (column) - if (lookAtRNO && ii.RNOs != null && ii.RNOLevel >= ii.ColumnMode) return TopPart(ii.RNOs[0]); - // Nextsibling - go to top part of sibling - // TODO: RHM - NextItems was not null when it should have been after delete of a note below a caution - ItemInfo nxt = ii.GetNext(); - if (nxt != null) return TopPart(nxt); - // If on caution, if parent has note - go to note - if (ii.IsCautionPart && ii.MyParent.Notes != null) return ii.MyParent.Notes[0]; - // If on caution, if parent !has note or if on note go to parent - if ((ii.IsCautionPart && ii.MyParent.Notes == null) || ii.IsNotePart) return ii.MyParent; - // Recursively call with parent until at procedure - if (!ii.IsProcedure) return (ArrowDown(ii.MyParent, false, ii.MyParent.RNOLevel==ii.RNOLevel)); - } - return null; - } - internal void StepCursorKeys(EditItem ei, KeyEventArgs keyargs) - { - ItemInfo ii = ei.MyItemInfo; - if (ii.IsSection || ii.IsProcedure) return; - while (!ii.IsHigh) - { - ii = ii.MyParent; - } - switch (keyargs.KeyCode) - { - // for home/end, control key must be pressed too, but this is checked - // before here. - case Keys.Home: - ii = ii.FirstSibling; - break; - case Keys.End: - ii = ii.LastSibling; - break; - case Keys.PageDown: - ii = ii.GetNext(); - break; - case Keys.PageUp: - ii = ii.MyPrevious; - break; - } - if (ii == null) return; - SelectedEditItem = _LookupEditItems[ii.ItemID]; - } - #endregion - } - [TypeConverter(typeof(ExpandableObjectConverter))] - 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() - { - } - private StepPanel _MyStepPanel; - [Browsable(false)] - public StepPanel MyStepPanel - { - get { return _MyStepPanel; } - set { _MyStepPanel = value; } - } - private float _CircleXOffset = -4; - [Category("Circle")] - [DisplayName("Circle Horizontal Offset")] - public float CircleXOffset - { - get { return _CircleXOffset; } - set { _CircleXOffset = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private float _CircleYOffset = -13; - [Category("Circle")] - [DisplayName("Circle Vertical Offset")] - public float CircleYOffset - { - get { return _CircleYOffset; } - set { _CircleYOffset = value; if (_MyStepPanel != null) _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; - [Category("Circle")] - [DisplayName("Circle Color")] - public Color CircleColor - { - get { return _CircleColor; } - set { _CircleColor = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private int _CircleDiameter = 25; - [Category("Circle")] - [DisplayName("Circle Diameter")] - public int CircleDiameter - { - get { return _CircleDiameter; } - set { _CircleDiameter = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private int _CircleWeight = 2; - [Category("Circle")] - [DisplayName("Circle Pen Weight")] - public int CircleWeight - { - get { return _CircleWeight; } - set { _CircleWeight = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private float _NumberLocationX = 20F; - [Category("Number")] - [DisplayName("Number Location X")] - public float NumberLocationX - { - get { return _NumberLocationX; } - set { _NumberLocationX = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private float _NumberLocationY = 4; - [Category("Number")] - [DisplayName("Number Location Y")] - public float NumberLocationY - { - get { return _NumberLocationY; } - set { _NumberLocationY = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private SizeF _NumberSize = new SizeF(200F, 23F); - [Category("Number")] - [DisplayName("Number Size")] - public SizeF NumberSize - { - get { return _NumberSize; } - set { _NumberSize = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private int _TableWidthAdjust = 4; - [Category("Table")] - [DisplayName("Table Width Adjust")] - public int TableWidthAdjust - { - get { return _TableWidthAdjust; } - set { _TableWidthAdjust = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private int _CheckOffWeight = 1; - [Category("CheckOff")] - [DisplayName("CheckOff Pen Weight")] - public int CheckOffWeight - { - get { return _CheckOffWeight; } - set { _CheckOffWeight = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private Color _CheckOffColor = Color.Black; - [Category("CheckOff")] - [DisplayName("CheckOff Color")] - public Color CheckOffColor - { - get { return _CheckOffColor; } - set { _CheckOffColor = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private int _CheckOffSize =12; - [Category("CheckOff")] - [DisplayName("CheckOff Size")] - public int CheckOffSize - { - get { return _CheckOffSize; } - set { _CheckOffSize = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private int _CheckOffX =0; - [Category("CheckOff")] - [DisplayName("CheckOff X")] - public int CheckOffX - { - get { return _CheckOffX; } - set { _CheckOffX = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private int _CheckOffY =5; - [Category("CheckOff")] - [DisplayName("CheckOff Y")] - public int CheckOffY - { - get { return _CheckOffY; } - set { _CheckOffY = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - - private int _ChangeBarWeight = 1; - [Category("ChangeBar")] - [DisplayName("ChangeBar Pen Weight")] - public int ChangeBarWeight - { - get { return _ChangeBarWeight; } - set { _ChangeBarWeight = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - private Color _ChangeBarColor = Color.Black; - [Category("ChangeBar")] - [DisplayName("ChangeBar Color")] - public Color ChangeBarColor - { - get { return _ChangeBarColor; } - set { _ChangeBarColor = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); } - } - } - public partial class StepPanelEventArgs - { - private EditItem _MyEditItem; - public EditItem MyEditItem - { - get { return _MyEditItem; } - set { _MyEditItem = value; } - } - private MouseEventArgs _MyMouseEventArgs; - public MouseEventArgs MyMouseEventArgs - { - get { return _MyMouseEventArgs; } - set { _MyMouseEventArgs = value; } - } - - public StepPanelEventArgs(EditItem myEditItem, MouseEventArgs myMouseEventArgs) - { - _MyEditItem = myEditItem; - _MyMouseEventArgs = myMouseEventArgs; - } - } - public partial class ItemSelectedChangedEventArgs - { - private ItemInfo _MyItemInfo; - public ItemInfo MyItemInfo - { - get { return _MyItemInfo; } - set { _MyItemInfo = value; } - } - private EditItem _MyEditItem = null; - public EditItem MyEditItem - { - get { return _MyEditItem; } - set { _MyEditItem = value; } - } - public ItemSelectedChangedEventArgs(ItemInfo myItemInfo) - { - _MyItemInfo = myItemInfo; - } - public ItemSelectedChangedEventArgs(EditItem myEditItem) - { - _MyItemInfo = myEditItem?.MyItemInfo; - _MyEditItem = myEditItem; - } - } - public partial class StepPanelAttachmentEventArgs - { - private EditItem _MyEditItem; - public EditItem MyEditItem - { - get { return _MyEditItem; } - set { _MyEditItem = value; } - } - public StepPanelAttachmentEventArgs(EditItem myEditItem) - { - _MyEditItem = myEditItem; - } - } - - public partial class StepPanelLinkEventArgs : EventArgs - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - //private EditItem _LinkedEditItem; - //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) - { - //_LinkedEditItem = linkedEditItem; - _LinkInfoText = linkInfoText; - _MyLinkText = new LinkText(_LinkInfoText); - //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("\r\n LinkInfo '{0}'\r\n", linkInfo.LinkText); - } - } - public partial class StepPanelTabDisplayEventArgs : EventArgs - { - private string _PanelTabName; - public string PanelTabName - { - get { return _PanelTabName; } - } - public StepPanelTabDisplayEventArgs(string panelTabname) - { - _PanelTabName = panelTabname; - } - } - public partial class WordSectionEventArgs : EventArgs - { - private SectionInfo _MySectionInfo; - public SectionInfo MySectionInfo - { - get { return _MySectionInfo; } - } - public WordSectionEventArgs(SectionInfo mySectionInfo) - { - _MySectionInfo = mySectionInfo; - } - } - public delegate void StepPanelEvent(object sender, StepPanelEventArgs args); - public delegate void ItemSelectedChangedEvent(object sender, ItemSelectedChangedEventArgs args); - public delegate void StepPanelLinkEvent(object sender, StepPanelLinkEventArgs args); - public delegate void StepPanelAttachmentEvent(object sender, StepPanelAttachmentEventArgs args); - public delegate void StepRTBLinkEvent(object sender, StepPanelLinkEventArgs args); - public delegate void StepPanelModeChangeEvent(object sender, StepRTBModeChangeEventArgs args); - public delegate void StepPanelTabDisplayEvent(object sender, StepPanelTabDisplayEventArgs args); - public delegate void StepPanelWordSectionCloseEvent(object sender, WordSectionEventArgs args); - public delegate void StepPanelWordSectionDeletedEvent(object sender, WordSectionEventArgs args); - public delegate void StepPanelItemPastedEvent(object sender, vlnTreeItemInfoPasteEventArgs args); -} diff --git a/PROMS/Volian.Controls.Library/StepPanel.designer.cs b/PROMS/Volian.Controls.Library/StepPanel.designer.cs deleted file mode 100644 index 10cab5a9..00000000 --- a/PROMS/Volian.Controls.Library/StepPanel.designer.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class StepPanel - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - private bool _ShuttingDown = false; - - public bool ShuttingDown - { - get { return _ShuttingDown; } - set { _ShuttingDown = value; } - } - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - ShuttingDown = disposing; - if (disposing && (components != null)) - { - SelectedEditItem = null; // Save Changes - foreach (EditItem EditItem in _LookupEditItems.Values) - { - EditItem.MyItemInfo.ResetParts(); - EditItem.MyItemInfo.MyContent.RefreshContentParts(); - } - _LookupEditItems.Clear(); - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/StepPanel.resx b/PROMS/Volian.Controls.Library/StepPanel.resx deleted file mode 100644 index 19dc0dd8..00000000 --- a/PROMS/Volian.Controls.Library/StepPanel.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs deleted file mode 100644 index 5728cf6e..00000000 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ /dev/null @@ -1,3911 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.IO; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.Text.RegularExpressions; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; -using JR.Utils.GUI.Forms; -using System.Linq; - -namespace Volian.Controls.Library -{ - public delegate void StepRTBEvent(object sender, EventArgs args); - public delegate void StepRTBCursorKeysEvent(object sender, KeyEventArgs args); - public delegate void StepRTBCursorMovementEvent(object sender, StepRTBCursorMovementEventArgs args); - public delegate void StepRTBModeChangeEvent(object sender, StepRTBModeChangeEventArgs args); - public delegate void StepRTBMenuEvent(object sender, StepRTBMenuEventArgs args); - public delegate void StepRTBTableWidthEvent(object sender, StepRTBTableWidthEventArgs args); - public delegate bool StepRTBBooleanEvent(object sender, EventArgs args); - public delegate void StepRTBLocationEvent(object sender, StepRTBLocationEventArgs args); - public delegate void StepRTBMouseEvent(object sender, MouseEventArgs args); - public delegate void StepRTBRoEvent(object sender, StepRTBRoEventArgs args); - public partial class StepRTB : RichTextBox // , IStepRTB - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - private bool _Disposed = false; - private static int _CountCreated = 0; - private static int _CountDisposed = 0; - private static int _CountFinalized = 0; - private static int IncrementCountCreated - { get { return ++_CountCreated; } } - private int _CountWhenCreated = IncrementCountCreated; - public static int CountCreated - { get { return _CountCreated; } } - public static int CountNotDisposed - { get { return _CountCreated - _CountDisposed; } } - public static int CountNotFinalized - { get { return _CountCreated - _CountFinalized; } } - private bool _Finalized = false; - ~StepRTB() - { - if (!_Finalized) _CountFinalized++; - _Finalized = true; - } - #region Events - public event StepRTBRoEvent RoInsert; - public void OnRoInsert(object sender, StepRTBRoEventArgs args) - { - if (RoInsert != null) RoInsert(sender, args); - } - public event StepRTBEvent ReturnToEditor; - public void OnReturnToEditor(object sender, EventArgs args) - { - if (ReturnToEditor != null) ReturnToEditor(sender, args); - } - public event StepRTBEvent EditModeChanged; - public void OnEditModeChanged(object sender, EventArgs args) - { - if (EditModeChanged != null) EditModeChanged(sender, args); - } - public event StepRTBEvent DoSaveContents; - public void OnDoSaveContents(object sender, EventArgs args) - { - if (DoSaveContents != null) DoSaveContents(sender, args); - } - public event StepRTBMouseEvent DoMouseWheel; - public void OnDoMouseWheel(object sender, MouseEventArgs args) - { - if (DoMouseWheel != null) DoMouseWheel(sender, args); - } - public event StepRTBLocationEvent OpenContextMenu; - public void OnOpenContextMenu(object sender, StepRTBLocationEventArgs args) - { - if (OpenContextMenu != null) OpenContextMenu(sender, args); - } - public event StepRTBEvent CopyStep; - public void OnCopyStep(object sender, EventArgs args) - { - if (CopyStep != null) CopyStep(sender, args); - } - public event StepRTBBooleanEvent CheckClipboard; - public bool OnCheckClipboard(object sender, EventArgs args) - { - if (CheckClipboard != null) return CheckClipboard(sender, args); - return false; - } - public event StepRTBCursorKeysEvent EnterKeyPressed; - public void OnEnterKeyPressed(object sender, KeyEventArgs args) - { - if (EnterKeyPressed != null) EnterKeyPressed(sender, args); - } - public event StepRTBEvent ToggleChangeBar; // shortcut key - public void OnToggleChangeBar(object sender, EventArgs args) - { - if (ToggleChangeBar != null) ToggleChangeBar(sender, args); - } - public event StepRTBEvent ToggleContinuousActionSummary; // shortcut key - public void OnToggleContinuousActionSummary(object sender, EventArgs args) - { - if (ToggleContinuousActionSummary != null) ToggleContinuousActionSummary(sender, args); - } - public event StepRTBEvent TogglePlaceKeeper; // shortcut key - public void OnTogglePlaceKeeper(object sender, EventArgs args) - { - if (TogglePlaceKeeper != null) TogglePlaceKeeper(sender, args); - } - public event StepRTBEvent TogglePlaceKeeperContAct; // shortcut key - public void OnTogglePlaceKeeperContAct(object sender, EventArgs args) - { - if (TogglePlaceKeeperContAct != null) TogglePlaceKeeperContAct(sender, args); - } - public event StepRTBEvent ToggleSuperScript; // shortcut key <=> - public void OnToggleSuperScript(object sender, EventArgs args) - { - if (ToggleSuperScript != null) ToggleSuperScript(sender, args); - } - public event StepRTBEvent ToggleSubScript; // shortcut key <=> - public void OnToggleSubScript(object sender, EventArgs args) - { - if (ToggleSubScript != null) ToggleSubScript(sender, args); - } - public event StepRTBEvent InsertPgBrk; // short key - public void OnInsertPgBrk(object sender, EventArgs args) - { - if (InsertPgBrk != null) InsertPgBrk(sender, args); - } - public event StepRTBEvent OpenAnnotations; - public void OnOpenAnnotations(object sender, EventArgs args) - { - if (OpenAnnotations != null) OpenAnnotations(sender, args); - } - public event StepRTBBooleanEvent IsNotCurrentSelection; - public bool OnIsNotCurrentSelection(object sender, EventArgs args) - { - if (IsNotCurrentSelection != null) return IsNotCurrentSelection(sender, args); - return false; - } - public event StepRTBTableWidthEvent AdjustTableWidth; - public void OnAdjustTableWidth(object sender, StepRTBTableWidthEventArgs args) - { - if (AdjustTableWidth != null) AdjustTableWidth(sender, args); - } - public event StepRTBMenuEvent SetMenu; - private void OnSetMenu(object sender, StepRTBMenuEventArgs args) - { - if (SetMenu != null) SetMenu(sender, args); - } - public event StepRTBEvent RTBSelectionChanged; - private void OnRTBSelectionChanged(object sender, EventArgs args) - { - if (RTBSelectionChanged != null) RTBSelectionChanged(sender, args); - } - public event StepRTBEvent LinkLocationsChanged; - private void OnLinkLocationChanged(object sender, EventArgs args) - { - if (LinkLocationsChanged != null) LinkLocationsChanged(sender, args); - } - public event StepRTBEvent RTBRangeStatusChanged; - private void OnRTBRangeStatusChanged(object sender, EventArgs args) - { - if (RTBRangeStatusChanged != null) RTBRangeStatusChanged(sender, args); - } - public event StepRTBCursorKeysEvent CursorKeyPress; - private void OnCursorKeyPress(object sender, KeyEventArgs args) - { - if (CursorKeyPress != null) CursorKeyPress(sender, args); - } - public event StepRTBCursorMovementEvent CursorMovement; - private void OnCursorMovement(object sender, StepRTBCursorMovementEventArgs args) - { - if (CursorMovement != null) CursorMovement(sender, args); - } - - /// - /// This event is not raised during all the in-between changes for link deletions - /// - public event StepRTBEvent RTBTextChanged; - private void OnRTBTextChanged(object sender, EventArgs args) - { - if (RTBTextChanged != null) RTBTextChanged(sender, args); - } - #endregion - #region Properties and Variables - public bool IsRoFigure - { - get { return (MyItemInfo.IsFigure && MyItemInfo.MyContent.MyImage == null); } - } - public bool IsRoTable - { - get { return (Parent is VlnFlexGrid && (Parent as VlnFlexGrid).IsRoTable); } - } - public bool HasVScroll - { - get - { - return RTBAPI.HasVertScroll(this); - } - - } - public bool HasHScroll - { - get - { - return RTBAPI.HasHorzScroll(this); - } - - } - private bool _EditMode = true; - /// - /// Allows insert of links. If false, don't allow selection of links. - /// - public bool EditMode - { - get { return _EditMode; } - set - { - _EditMode = value; - OnEditModeChanged(this, new EventArgs()); - } - } - private DocVersionInfo _MyDVI = null; - - public DocVersionInfo MyDVI - { - get - { - ItemInfo procInfo = _MyItemInfo.MyProcedure as ItemInfo; - if (procInfo == null) - _MyDVI = null; - else - _MyDVI = procInfo.ActiveParent as DocVersionInfo; - return _MyDVI; - } - } - private static UserInfo _MyUserInfo = null; - - public static UserInfo MyUserInfo - { - get { return _MyUserInfo; } - set { _MyUserInfo = value; } - } - private static string _MySymbolFontName; - public static string MySymbolFontName - { - get { return StepRTB._MySymbolFontName; } - set { StepRTB._MySymbolFontName = value; } - } - private static FontFamily _MyFontFamily = null; - public static FontFamily MyFontFamily - { - get { return StepRTB._MyFontFamily; } - set - { - _MyFontFamily = value; - if (value != null) - { - Font font; - if (value.IsStyleAvailable(FontStyle.Regular)) - font = new Font(value, 10); - else if (value.IsStyleAvailable(FontStyle.Bold)) - font = new Font(value, 10, FontStyle.Bold); - else // (value.IsStyleAvailable(FontStyle.Italic)) - font = new Font(value, 10, FontStyle.Italic); - using (StepRTB srtb = new StepRTB()) - { - if (srtb.FontIsFixed(font)) MySymbolFontName = "FreeMono"; // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing - else MySymbolFontName = Volian.Base.Library.vlnFont.ProportionalSymbolFont; // C2017-036 get best available proportional font for symbols - } - } - else - { - MySymbolFontName = null; - } - } - } - private E_FieldToEdit _FieldToEdit = E_FieldToEdit.StepText; - public E_FieldToEdit FieldToEdit - { - get { return _FieldToEdit; } - set { _FieldToEdit = value; } - } - private string _RtfPrefix; // contains Font table and styles (bold/underline/italics) for rtb from step style - public string RtfPrefixForSymbols - { - get - { - //B2020-100 RHM Use SelectionFont rather than the font from the format file. - StringBuilder selectedRtfSB = new StringBuilder(); - - // B2021-100: if SelectionFont is null, use the FormatFont - AddFontTable(selectedRtfSB, SelectionFont==null?FormatFont:SelectionFont, FontIsFixed(FormatFont)); - _RtfPrefix = selectedRtfSB.ToString(); - - return _RtfPrefix + @"\f1\fs" + FormatFont.SizeInPoints * 2 + " "; - } - } - public string RtfPrefix - { - get - { - if (_RtfPrefix == null) - { - StringBuilder selectedRtfSB = new StringBuilder(); - AddFontTable(selectedRtfSB, FormatFont, FontIsFixed(FormatFont)); - _RtfPrefix = selectedRtfSB.ToString(); - } - return _RtfPrefix;// +@"{\colortbl ;\red255\green0\blue0;}"; - } - } - // August 5, 2009 - KBR & RHM: - // Insert/Overwrite will be developed later if needed. various issues - // were found during initial development that made its scope larger than - // expected. Problems were related to having overstrike on in the following - // cases: - // 1) left arrow when on link - positions after link - // 2) left arrow and after link - does not move - // 3) shift left arrow does not move past links correctly and also, first - // shift left arrow looks more like insert mode. - // private bool _OverWrite; - // _IsDirty compares the original rtf to the current rtf from the - // richtextbox to see if a change was made. - public bool IsDirty - { - get { return OrigRTF != Rtf; } - } - private bool _InitializingRTB; - private bool _IsExperimenting = false; - public bool IsExperimenting - { - get { return _IsExperimenting; } - set { _IsExperimenting = value; } - } - private IContainer _Container = null; - private string _MyClassName=string.Empty; - public string MyClassName - { - get { if (_MyClassName == string.Empty)_MyClassName = CreateParams.ClassName; return _MyClassName; } - set { _MyClassName = value; } - } - private E_ViewMode _vwMode = E_ViewMode.Edit; - public E_ViewMode VwMode - { - get { return _vwMode; } - set { _vwMode = value; } - } - private VE_Font _MyStyleFont; - public VE_Font MyStyleFont - { - get - { - if (_MyStyleFont == null && MyItemInfo != null) _MyStyleFont = MyItemInfo.GetItemFont(); // B2017-023 null reference check for empty workdraft set information dialog - return _MyStyleFont; - } - } - private bool _ActiveMode = false; - public bool ActiveMode - { - get { return _ActiveMode; } - set { _ActiveMode = value; } - } - private ItemInfo _MyItemInfo; - public ItemInfo MyItemInfo - { - get - { - if (_MyItemInfo == null && Parent is EditItem) - _MyItemInfo = (Parent as EditItem).MyItemInfo; - else if (_MyItemInfo == null && Parent != null && Parent.Parent is EditItem) - _MyItemInfo = (Parent.Parent as EditItem).MyItemInfo; - return _MyItemInfo; - } - set { _MyItemInfo = value; } - } - private string _OrigRTF; - public string OrigRTF - { - get { return _OrigRTF; } - set { _OrigRTF = value; } - } - private Font _FormatFont; - public Font FormatFont - { - get - { - if (_FormatFont == null) - { - Font formatFont; - if (MyItemInfo != null) - formatFont = MyItemInfo.GetItemFont().WindowsFont; // OrigDisplayText.TextFont.WindowsFont; - else - formatFont = Font; - if (MyItemInfo != null && (MyItemInfo.IsTable || MyItemInfo.IsFigure)) - _FormatFont = formatFont; - else - { - //if (VlnSettings.DebugMode || VlnSettings.ProductionMode) - _FormatFont = new Font(MyFontFamily == null ? formatFont.FontFamily : MyFontFamily, formatFont.Size, formatFont.Style); - //else - // _FormatFont = new Font("Bookman Old Style", formatFont.Size, formatFont.Style); - // TODO: Release Mode - //Font = _origDisplayText.TextFont.WindowsFont; // font defined in plant's format - } - } - // We found that the characters in the Letter Gothic font do not all use the same spacing. - // Also, the character spacing is even more different between screen resolutions. - // But the Letter Gothic font will print just fine. - // We also found that the Letter Gothic Tall font works just fine on the screen, the only difference - // is that the characters are a little bit taller. - // So we decided to use the Letter Gothic Tall font for the screen display any time that Letter Gothic is used. - if (_FormatFont.Name.ToUpper().Equals("LETTER GOTHIC")) - _FormatFont = new Font("Letter Gothic Tall", _FormatFont.Size, _FormatFont.Style); - return _FormatFont; - } - set { _FormatFont = value; } - } - public void SetupRichText(string rtf, VE_Font vFont) - { - //FormatFont = vFont.WindowsFont; - DisplayText vlnText = new DisplayText(rtf, vFont, true); - AddRtfText(vlnText.StartText); - ReadOnly = true; - } - public void RefreshDisplay() - { - if (Closed) return; - try - { - RefreshDisplay(ActiveMode); - } - catch (Exception ex) - { - _MyLog.Error(string.Format("MyItemInfo: {0} - {1} Problem doing RefreshDisplay",MyItemInfo.ItemID,MyItemInfo.ShortPath), ex); - } - } - private static string FontKey(System.Drawing.Font font) - { - return string.Format("{0}_{1}_{2}", font.FontFamily.Name, font.Size, font.Style); - } - // RefreshDisplay is used to update the rtb for an entire Item as defined by MyItemInfo. - public void RefreshDisplay(bool activeMode) - { - if (IsExperimenting) return; - if (IsDisposed) return; - - ActiveMode = activeMode; - OnAdjustTableWidth(this, new StepRTBTableWidthEventArgs(true)); - _InitializingRTB = true; - - //C2026-021 Expand Functionality of Viewing Mode - StepPanel pnl = (Parent as RTBItem)?.MyStepPanel; - if (pnl?.ApplDisplayMode > 0) - { - MyItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave = pnl.ApplDisplayMode; - } - else - { - MyItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave = 0; - } - - DisplayText vlntxt = new DisplayText(MyItemInfo, E_EditPrintMode.Edit, VwMode, !ActiveMode, FieldToEdit, true,null, null,false); - if (pnl?.ApplDisplayMode > 0 && MyItemInfo.MyContent.ContentRoUsageCount > 0) - { - vlntxt.StartText = RefreshROsWithUnitStartText(vlntxt.StartText, pnl.ApplDisplayMode); - } - - OrigDisplayText = vlntxt; - //Volian.Base.Library.HWndCounter.GetWindowHandlesForCurrentProcess(this.Handle, "RefreshDisplay 4"); - - // RHM 20101201 - Don't reset the text. Calculate the text and compare it with the existing text in AddRTFText - //Text = ""; // Initialize text before add text - // IMPORTANT: SetLineSpacing must be set before Links, otherwise it - // was confusing the 'handle' of the rtf box. - if (FieldToEdit == E_FieldToEdit.StepText) - { - if (MyItemInfo != null) - { - if (MyItemInfo.IsStep) - { - if (MyFontFamily == null) - { - System.Drawing.Font fnt = MyItemInfo.FormatStepData.Font.WindowsFont; - Application.DoEvents(); - if (FontKey(Font) != FontKey(fnt)) - Font = fnt; - } - else - Font = VE_Font.GetWinSysFont(MyFontFamily, MyItemInfo.FormatStepData.Font.WindowsFont.Size, MyItemInfo.FormatStepData.Font.WindowsFont.Style); - } - else - { - if (MyFontFamily == null) - { - Font = MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font.WindowsFont; - } - else - Font = VE_Font.GetWinSysFont(MyFontFamily, MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font.WindowsFont.Size, MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font.WindowsFont.Style); - - } - LastRtf = Rtf; - } - } - - RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT); - bool readOnlyStep = MyItemInfo == null || MyItemInfo.FormatStepData == null ? false : MyItemInfo.FormatStepData.ReadOnly; - if (!readOnlyStep) - { - StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config); - if (IsDerived(sc) && !MyItemInfo.EnhAllowMod()) readOnlyStep = true; - } - ReadOnly = readOnlyStep || VwMode == E_ViewMode.View || ActiveMode == false; - AddRtfText(vlntxt.StartText); - - - // set readonly based on initial modes, however, these may change if - // user selected view mode. - ClearUndo(); - // RHM: 20101122 - Not sure why the RightMargin is set. The following line was added in Rev 23 - // in May of 2008. - // - // RightMargin = Width; - // - // Normally a the Right Margin is handled by the RichTextBox it defaults to a value of 0. - // - // If the RightMargin is equal to the width of the RichTextBox the word-wrap occurs just beyond - // the visible extent (right edge) of the RichTextBox when it is in view mode. In edit mode it - // wraps within the visible extent. An example of this is Step 24 of ES02 in HLP EOPs. - // - // If the RightMargin is greater than the width of the RichTextBox, the word-wrap occurs beyond - // the visible extent of the RichTextBox for both view and edit modes. - // - // Setting the RightMargin to the Width minus one, accounts for the slight indent (1 pixel) of - // the text within the RichTextBox. - //RightMargin = Width > 0 ? Width - 1 : 0; - RightMargin = ActiveMode ? Width : Width > 0 ? Width - 1 : 0; // > 0 ? Width - 1 : 0; - // figure out if needs outlined, depends on table/figure type - if (!ActiveMode) - { - RemoveEventHandlers(); - OnAdjustTableWidth(this, new StepRTBTableWidthEventArgs(false));// View Mode - SelectAll(); - int indchar = 0; - string indentToken = MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IndentToken; - if (indentToken == null || indentToken == "0") indentToken = "\x5"; - - // this line of code was moved before the find for the indent so that - // the window gets resized if the indent changes the height, i.e. more line(s) in window. - AddEventHandlers(); - if ((indchar = Find(indentToken, indchar, RichTextBoxFinds.None)) >= 0) - { - int nindents = 0; - while ((indchar = Find(indentToken, indchar, RichTextBoxFinds.None)) >= 0) - { - nindents++; - Point indent = GetPositionFromCharIndex(indchar); - SelectionHangingIndent = indent.X; - - // RHM 02/20/2013 - // The following line attempts to remove the indent character for display purposes. - // However, if the indent is followed immediately by an RO or Transition the - // RichTextBox will not allow the character to be removed this way and the RichTextBox - // will beep. So, to keep from going in an infintie loop, the value of indchar is incremented. - SelectedRtf = SelectedRtf.Replace(@"\'05", ""); - indchar++;// Don't do the same one twice. - } - if (MyItemInfo != null && MyItemInfo.ActiveFormat != null - && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.DontResetIndentOnNewline) - { - if (nindents == 1) Rtf = Rtf.Replace("\\par\r\n", @"\line "); - Rtf = Rtf.Replace(@"\line\pard", @"\line"); - } - } - HideSelection = true; // fix for B2016-093: this is needed so an rtb that is not focused is not highlighted. - } - // This is to fix an issue with Hard Spaces. To Summarize: - // The Microsoft RichTextBox has a problem with hardspaces, that they don't work between numbers and lettters - // This is the majority of cases for PROMS including ROs (Sepoint Number and Units) and transtions (Step ###) - // As I investigated this further I found that if you pass a rtf unicode value for a hard space (\u160?) to - // the RichTextBox, the RichTextBox will return an ASCII representation (\'A0). If you pass an ASCII representation - // the RichTextBox will return a space. - // Alternatively, If you pass a unicode representation of zero (\u0?) it acts like a hard space and returns an ASCII - // representation (\'00). If you pass in the ASCII representation, it truncates the text. - // The following two lines replace hard spaces (ASCII) with the UNICODE represntation of Zero. - // Lastly, If you pass a unicode representation of one (\u1?) it acts like a hard space and returns an ASCII - // representation (\'01). If you pass in the ASCII representation, it keeps the ASCII representation. - // The following two lines replace hard spaces (ASCII) with the UNICODE represntation of Zero. - // Other characters which behave like hard spaces are 28-31 and 128-159. - if (!activeMode && Rtf.Contains(@"\'a0")) - { - // The following 3 lines were added to fix B2016-069. The issue was in the RichTextBox for the Arial - // (Proportional) font, the hardspace appeared to be 2 spaces (really it was showing the space as the widest - // width character). So instead of a hard space, a single quote "'" was used to designate where the hardspace - // would be. This is only used for display, printing works. - //B2019-155 Hard spaces were displace as a square box for non-proportional fonts. - // To fix this, we removed the check for a proportional font and now replace the hard space with a "'" mark for all fonts - Rtf = Rtf.Replace(@"\'a0", "'"); - } - OrigRTF = Rtf; - _InitializingRTB = false; - - AdjustSizeForContents(!ActiveMode); - Application.DoEvents(); - } - - //C2026-021 Expand Functionality of Viewing Mode - //regex for finding Referenced object links - private static Regex regRefObj = new Regex(@"\#Link\:ReferencedObject:([0-9]*) ([0-9a-zA-Z]*) ([0-9]*)", RegexOptions.Singleline); - - //Replace the Default RO text with Unit Specific RO text - private string RefreshROsWithUnitStartText(string startText, int unitID) - { - ROFSTLookup lookup = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyItemInfo.MyDocVersion); - - MatchCollection mc = regRefObj.Matches(startText); - - if (mc.Count == 0) - return startText; - - StringBuilder sb = new StringBuilder(); - int lastindex = 0; - - foreach (Match match in mc) - { - //get where ther default text for the RO starts - int indx = startText.LastIndexOf(@"\v 0) return; - // Always be sure to add the same event handlers to RemoveEventHandlers - BorderStyle = System.Windows.Forms.BorderStyle.None; - this.DetectUrls = false; - ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized); - this.Click +=new EventHandler(StepRTB_Click); - this.KeyPress += new KeyPressEventHandler(StepRTB_KeyPress); - this.KeyDown += new KeyEventHandler(StepRTB_KeyDown); - this.KeyUp += new KeyEventHandler(StepRTB_KeyUp); - this.TextChanged += new EventHandler(StepRTB_TextChanged); - this.MouseUp += new MouseEventHandler(StepRTB_MouseUp); - this.MouseDown += new MouseEventHandler(StepRTB_MouseDown); - this.MouseLeave += new EventHandler(StepRTB_MouseLeave); - this.SelectionChanged +=new EventHandler(StepRTB_SelectionChanged); - this.ContextMenuStripChanged += new EventHandler(StepRTB_ContextMenuStripChanged); - this.RTBSelectionChanged += new StepRTBEvent(StepRTB_RTBSelectionChanged); - this.HandleCreated += new EventHandler(StepRTB_HandleCreated); - this.HandleDestroyed += new EventHandler(StepRTB_HandleDestroyed); - _EventHandlersForKeyPress = _EventHandlersForKeyPress+1; - } - private int _HandleCount = 0; - void StepRTB_HandleCreated(object sender, EventArgs e) - { - _HandleCount++; - } - // When a border style is changed, the richtextbox's handle is 'destroyed', so that the handleDestroyed - // event is done. This was causing the event handlers to be removed (RemoveEventHandler) so that the - // keypress event handler was not run. The following was added so that the keypress event is restored - // after the border style was changed. This is specifically for the steprtb's on property pages. - void StepRTB_BorderStyleChanged(object sender, EventArgs e) - { - if (_EventHandlersForKeyPress==0) - this.KeyPress += new KeyPressEventHandler(StepRTB_KeyPress); - _EventHandlersForKeyPress++; - } - private bool _Closed = false; - public bool Closed - { - get { return _Closed; } - set { _Closed = value; } - } - void StepRTB_HandleDestroyed(object sender, EventArgs e) - { - if (_HandleCount == 0) - { - Closed = true; - RemoveEventHandlers(); - } - _HandleCount--; - } - void StepRTB_RTBSelectionChanged(object sender, EventArgs args) - { - //Console.WriteLine("RTBSelectionChanged id= {0}", MyItemInfo.ItemID); - if (!Focused) Focus(); - } - void StepRTB_ContextMenuStripChanged(object sender, EventArgs e) - { - //Console.WriteLine("********** StepRTB_ContextMenuStripChanged"); - int sublocation = 0; - try - { - //Console.WriteLine("{0}", ContextMenuStrip.GetType().FullName); - OnSetMenu(this, new StepRTBMenuEventArgs(null)); - sublocation = 1; - _ContextMenuStripChanged = true; - sublocation = 2; - _ContextMenuStepRTB = this; - sublocation = 3; - _ContextMenuStrip = ContextMenuStrip; - sublocation = 4; - } - catch(Exception ex) - { - Console.WriteLine("StepRTB_ContextMenuStripChanged {0} - {1} [{2}]", ex.GetType().Name, ex.Message, sublocation); - } - } - - // Bug fix B2017-059, toggle the spellchecking status on only when being used - to control how many window handles are created by the spellchecker - // This fixed the issue of the spell checker closing PROMS - Callaway SAMG Background TSG-1, also reproduced on long procedure in calvert EOPs - - private bool _SpellCheckStatus = false; - - public bool SpellCheckStatus - { - get { return _SpellCheckStatus; } - set - { - if (_SpellCheckStatus != value) - { - _SpellCheckStatus = value; - if (DoSpellCheck) - C1SpellChecker2.SetActiveSpellChecking(this, value); - } - } - } - - private void SetUpStepRTB() - { - DetectUrls = false; - SpellCheckStatus = false; - this.Height = 10; // initialize the height to 10, the default height was too big for the cells in grid tables - BorderStyle = System.Windows.Forms.BorderStyle.None; - this.ScrollBars = RichTextBoxScrollBars.None; - this.DetectUrls = false; - } - // An event is needed to set MouseDown to false on mouse leave, because additional rtb's may - // have been exposed based on entering a step, which causes the underlying item/rtb for which - // the mouse event occurs to not be the current rtb. RTB gets selected on MouseDown, MouseEnter - // and MouseUp are - void StepRTB_MouseLeave(object sender, EventArgs e) - { - _MouseDown = false; - } - private void StepRTB_Click(object sender, EventArgs e) - { - if (ReadOnly) return; - } - // B2019-161 When tracking timing time this action - private static VolianTimer _TimeActivity = new VolianTimer("StepRTB CloseWordApp_Tick", 902); - - void StepRTB_SelectionChanged(object sender, EventArgs e) - { - _TimeActivity.Open(); - if (_InitializingRTB || _IsExperimenting || (MyItemInfo!=null && MyItemInfo.IsRtfRaw)) return; - HandleSelectionChange(); - _TimeActivity.Close(); - } - private bool _MouseDown = false; - private bool _ContextMenuStripChanged = false; - private void StepRTB_MouseDown(object sender, MouseEventArgs e) - { - //The following line fixes bugs B2016-121 and B2016-146 - if(!Focused)this.Focus();// If it doesn't have focus, set focus to the selected item - //Console.WriteLine("vvvvvvvvvv StepRTB Mouse Down id= {0}",MyItemInfo.ItemID); - bool inPsi = this.Parent.FindForm().Name.Contains("frmPSI") || this.Parent.FindForm().Name.Contains("frmSI"); - if (!_ContextMenuStripChanged) - OnSetMenu(this, new StepRTBMenuEventArgs(inPsi?"PSI":"OpenContextMenu")); - _ContextMenuStripChanged = false; - CorrectSelectionAtEndOfLine(); - // B2017-023 null reference check for empty workdraft set information dialog - if (e.Button == System.Windows.Forms.MouseButtons.Right && (MyItemInfo == null || MyItemInfo.IsRtfRaw)) OnSetMenu(this, new StepRTBMenuEventArgs((MyItemInfo != null && MyItemInfo.IsRtfRaw)?"OpenRtfRawContextMenu":"PSI")); - _MouseDown = true; - } - void StepRTB_MouseUp(object sender, MouseEventArgs e) - { - _MouseDown = false; - //Console.WriteLine("^^^^^^^^^^ StepRTB Mouse Up id= {0}", MyItemInfo.ItemID); - - if(this.Focused) // Only HandleSelectionChange if this control has focus. - { - HandleSelectionChange(); - // save our context menu to add to the spell checker's context menu - ThisContextMenuStrip = this.ContextMenuStrip; - // B2017-231 force the right mouse click to bring up word list if on a mis-spelled word - if (e.Button == System.Windows.Forms.MouseButtons.Right && Parent is RTBItem) // right mouse click and we are not on a table cell - { - if (ThisContextMenuStrip != null) - { - (Parent as RTBItem).MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu(); - this.ContextMenuStrip.Show(this, e.X, e.Y); - } - else - { - (Parent as RTBItem).MyStepPanel.MyStepTabPanel.MyStepTabRibbon.OpenContextMenu(this.PointToScreen(e.Location), this); - } - } - } - } - #endregion - #region ApplicationSupport - public void InsertRO(string value, string link) - { - // B2023-037: Remove code that saves the unicode characters for <=, >=, +-, <- and -> into the link text. The characters - // now get resolved when used. InsertSymbolInRo was commented out also - AddRtfLink(value, link); - } - public void InsertTran(string value, string link) - { - AddRtfLink(value, link); - } - public void InsertSymbol(int symbcode) - { - string sym = string.Format(symbcode < 256 ? "\'{0:X2}" : @"\u{0}", symbcode); - if (symbcode < 256) - AddText(((char)symbcode).ToString()); - else - AddSymbol(sym); // Adds font commands around symbol, needed for higher codes - } - public void InsertSymbol(string symbol) - { - AddSymbol(symbol); - } - public void InsertIndent(string indentToken) - { - if (indentToken == null || indentToken == "0") indentToken = "\x5"; - AddText(indentToken); - } - public void InsertText(string txt) - { - AddText(txt); - } - - private void ToggleCase() - { - char type = 'l'; - // do not change case on linked text - RangeStatus rs = FindRangeStatus(); - string tmp = null; - if (rs != RangeStatus.NoContainedLinks) - { - int start = SelectionStart; - int ostart = SelectionStart; - int end = SelectionStart + SelectionLength; - bool processed = false; - while (!processed && start <= end) - { - foreach (LinkLocation ll in LinkLocations) - { - if (ll.Start >= start && ll.End <= end) - { - processed = true; - if (start < ll.Start) - { - SelectionStart = start; - SelectionLength = ll.Start - start; - } - start = ll.End + 1; - break; - } - } - } - } - string ostring = SelectedText; - if (ostring.Length == 0) return; // nothing selected - if (ostring.Length == 1) - type = char.IsUpper(ostring, 0) ? 'l' : 'U'; - else if ((char.IsUpper(ostring, 0) && char.IsUpper(ostring, 1)) || - (char.IsLower(ostring, 0) && char.IsUpper(ostring, 1))) type = 'l'; // lower case - else if ((char.IsUpper(ostring, 0) && char.IsLower(ostring, 1))) type = 'U'; // upper case - else type = 'T'; // Title case - SetSelectedCase(type); - } - - public void SetSelectedCase(char type) - { - // do not change case on linked text - RangeStatus rs = FindRangeStatus(); - string tmp = null; - if (rs == RangeStatus.NoContainedLinks) - SetCase(type); - else - { - int start = SelectionStart; - int ostart = SelectionStart; - int end = SelectionStart + SelectionLength; - StringBuilder sb = new StringBuilder(); - while (start <= end) - { - bool processed = false; - foreach (LinkLocation ll in LinkLocations) - { - if (ll.Start >= start && ll.End <= end) - { - processed = true; - if (start < ll.Start) - { - SelectionStart = start; - SelectionLength = ll.Start - start; - SetCase(type); - } - start = ll.End + 1; - break; - } - } - // if none were processed, no more links, copy over any remaining text. - if (!processed) - { - SelectionStart = start; - SelectionLength = end-start; - SetCase(type); - start = end + 1; - } - } - SelectionStart = ostart; - SelectionLength = end - ostart; - } - } - - private void SetCase(char type) - { - int ostart = SelectionStart; - int olen = SelectionLength; - string ostring = SelectedText; - string tmp = null; - bool docap = true; - // go character by character. Because of symbols, setting entire - // to upper or lower set symbols incorrectly some of time (depending - // on symbol) . - for (int i = 0; i < olen; i++) - { - SelectionStart = ostart + i; - SelectionLength = 1; - switch (type) - { - case 'l': - if (SelectedText[0] >= 'A' && SelectedText[0] <= 'Z') - SelectedText = SelectedText.ToLower(); - break; - case 'U': - if (SelectedText[0] >= 'a' && SelectedText[0] <= 'z') - SelectedText = SelectedText.ToUpper(); - break; - case 'T': - if (docap && SelectedText[0] >= 'a' && SelectedText[0] <= 'z') - SelectedText = SelectedText.ToUpper(); - else if (!docap && SelectedText[0] >= 'A' && SelectedText[0] <= 'Z') - SelectedText = SelectedText.ToLower(); - docap = ostring[i] == ' '; - break; - } - } - SelectionStart = ostart; - SelectionLength = olen; - } - #endregion - #region AddRtfTextAndStyles - private string _LastRtf = ""; - public string LastRtf - { - get { return _LastRtf; } - set { _LastRtf = value; } - } - private bool _lastReadOnly = false; - public override string ToString() - { - return string.Format("[StepRTB {0},{1},{2}]", MyItemInfo.ItemID, MyItemInfo.DisplayNumber, MyItemInfo.DisplayText); - } - public void AddRtfText(string txt) - { - if (MyItemInfo != null && MyItemInfo.IsRtfRaw) - { - if (txt != null && txt != "") SelectedRtf = _LastRtf = txt; - _lastReadOnly = ReadOnly; - OrigRTF = txt; - return; - } - //Console.WriteLine("ItemID:{0}", MyItemInfo.ItemID); - StringBuilder selectedRtfSB = new StringBuilder(); - AddFontTable(selectedRtfSB, FormatFont, FontIsFixed(FormatFont)); - _RtfPrefix = selectedRtfSB.ToString(); - selectedRtfSB.Append(txt); - string newRtf = selectedRtfSB.ToString() + "}"; - if(newRtf != _LastRtf || ReadOnly != _lastReadOnly) - { - //Console.WriteLine("ItemID:{0}\r\nOld:'{1}'\r\nNew:'{2}'\r\n", MyItemInfo.ItemID, Rtf, newRtf); - this.ContentsResized -= new ContentsResizedEventHandler(StepRTB_ContentsResized); - Text = ""; - this.ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized); - // indents went from being handled by code support of an indent character (usually \05) to - // using rtf commands to fix various indent bugs including B2015-103). The following code - // puts the rtf indent characters that are stored at beginning of string into correct location - // of rtf header (have to be after the \pard). Otherwise the indents did not show up. - Match match = Regex.Match(txt,@"\\fi([-0-9]+) ?\\li([0-9]+)"); - if (match.Success) - { - string indentStr = @"\fi" + match.Groups[1].Value + @"\li" + match.Groups[2].Value; - Rtf = Rtf.Replace(@"\pard", @"\pard" + indentStr); - } - // B2017-048, B2017-052, B2017-055 ROs sometimes have two start tokens which make them uneditable. - newRtf = newRtf.Replace(" 0 || SelectionIndent > 0) && (ActiveMode || MyItemInfo.IsTable)) - { - using (Graphics g = Graphics.FromHwnd(this.Handle)) - { - int size = 2; - g.DrawLine(Pens.DarkBlue, SelectionIndent, 0, SelectionIndent + size, 0); - g.DrawLine(Pens.DarkBlue, SelectionIndent, 2 * size, SelectionIndent, 0); - g.DrawLine(Pens.DarkBlue, SelectionHangingIndent, Height - 1, SelectionHangingIndent + size, Height - 1); - g.DrawLine(Pens.DarkBlue, SelectionHangingIndent, Height - 1 - 2 * size, SelectionHangingIndent, Height - 1); - } - } - } - else - { - try - { - base.WndProc(ref m); - } - catch (Exception ex) - { - } - } - } - private static void AddFontTable(StringBuilder selectedRtfSB, Font myFont, bool isFixed) - { - StringBuilder sbbeg = new StringBuilder(); - StringBuilder sbend = new StringBuilder(); - if (myFont.Bold) - { - sbbeg.Append(@"\b"); - sbend.Append(@"\b0"); - } - if (myFont.Underline) - { - sbbeg.Append(@"\ul"); - sbend.Insert(0, @"\ulnone"); - } - if (myFont.Italic) - { - sbbeg.Append(@"\i"); - sbend.Insert(0, @"\i0"); - } - selectedRtfSB.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 " + myFont.FontFamily.Name + @";}"); - if (!isFixed) - selectedRtfSB.Append(@"{\f1\fnil\fcharset0 " + Volian.Base.Library.vlnFont.ProportionalSymbolFont + @";}}{\colortbl ;\red255\green0\blue0;\red0\green0\blue255;}"); // C2017-036 get best available proportional font for symbols - B2025-039 add Blue for Colored Replace Words - else - selectedRtfSB.Append(@"{\f1\fnil\fcharset0 FreeMono;}}{\colortbl ;\red255\green0\blue0;\red0\green0\blue255;}"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing - selectedRtfSB.Append("\r\n"); - // use styles to construct rtf commands to insert into next line (where \b, etc is) - // B2015-134 Hanging Indent with Hard Returns was not being saved- removed \sl-240\slmult0 - selectedRtfSB.Append(@"\viewkind4\uc1\pard" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(myFont.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}"; - - } - - private bool FontIsFixed(Font myFont) - { - Graphics grph = Graphics.FromHwnd(this.Handle); - SizeF sfW = grph.MeasureString("W", myFont); - SizeF sfE = grph.MeasureString("!", myFont); - if (sfW.Width == sfE.Width) return true; - return false; - } - private void AddRtf(string str) - { - // Because we're inserting rtf with { }, the surrounding styles are not included. Get the font - // style of current position & use it after the insert to set the style. - RTBAPI.E_FontStyle fs = RTBAPI.GetFontStyle(this); - int positionStart = SelectionStart; - SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset2 " + this.Font.FontFamily.Name + @";}}\f0\fs" + this.Font.SizeInPoints * 2 + @" " + str + @"}}"; - // Note that SelectedRtf does not contain the inserted text after the previous line. We need - // to determine how long the inserted string is in order to set its style. SelectionStart contains - // the location after the insertion. - int positionAfter = SelectionStart; - Select(positionStart, positionAfter - positionStart); - RTBAPI.SetFontStyle(this, fs); - Select(positionAfter, 0); - } - private void AddText(string str) - { - // See comments in AddRtf(string str) to explain the font style setting - RTBAPI.E_FontStyle fs = RTBAPI.GetFontStyle(this); - int positionStart = SelectionStart; - SelectedText = str; - int positionAfter = SelectionStart; - Select(positionStart, positionAfter - positionStart); - RTBAPI.SetFontStyle(this, fs); - Select(positionAfter, 0); - } - private void AddSymbol(string str) - { - // See comments in AddRtf(string str) to explain the font style setting - RTBAPI.E_FontStyle fs = RTBAPI.GetFontStyle(this); - Font locfont = this.Font; - int position = SelectionStart; - // B2021-100: if SelectionFont is null set it, it is used in RtfPrefixForSymbols - if (SelectionFont == null) - { - if (FieldToEdit == E_FieldToEdit.StepText && MyItemInfo!=null) - SelectionFont = MyItemInfo.GetItemFont().WindowsFont; - else - SelectionFont = locfont; - } - SelectedRtf = RtfPrefixForSymbols + str + @"}"; - Select(position, 1); - Select(position + 1, 0); - if (FieldToEdit == E_FieldToEdit.StepText) - { - SelectionFont = MyItemInfo.GetItemFont().WindowsFont; - RTBAPI.SetFontStyle(this, fs);// B2020-100 Keep the font style - } - else - // if doing properties for folder, docversion, proc or sect, don't get item's font. - SelectionFont = locfont; - } - private string GetAddSymbolText(string symtxt) - { - return (@"{\f1\fs" + this.Font.SizeInPoints * 2 + @" " + symtxt + @"}"); // B2016-281 fixed font selection when inserting a symbol character - } - private string GetAddSymbolTextForROs(string symtxt) - { - return (@"\f1\fs" + this.Font.SizeInPoints * 2 + @" " + symtxt); //C2019-043 Don't need curly braces when used in RO return value - } - public void AddRtfLink(string linkUrl, string linkValue) - { - if (CreateParams.ClassName == "RICHEDIT50W") - - AddLink50(linkUrl, linkValue); - else - AddLink20(linkUrl, linkValue); - } - public string FontTable - { - get - { - StringBuilder sb = new StringBuilder(); - sb.Append(@"{\fonttbl{\f0\fnil\fcharset2 " + this.Font.FontFamily.Name + @";}"); - if (!FontIsFixed(this.Font)) - sb.Append(@"{\f1\fnil\fcharset0 " + Volian.Base.Library.vlnFont.ProportionalSymbolFont + @";}}"); // C2017-036 get best available proportional font for symbols - else - sb.Append(@"{\f1\fnil\fcharset0 FreeMono;}}"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing - return sb.ToString(); - } - } - private string FontSize - { - get - { - Match match = Regex.Match(Rtf, @"\\fs[0-9]+"); // B2018-012 Make sure that there is at least 1 digit - return match.Value; - } - } - - private void AddLink20(string linkValue, string linkUrl) - { - string fonttab = FontTable; - string fontsize = FontSize; - if (SelectionLength > 0)HandleDeleteKeyWithSelectedText(new KeyEventArgs(Keys.None), null); - int position = SelectionStart; - SelectionLength = 0; - // B2026-036 fixed issue where numbers after a dash character (in an RO return value) were trucated - // Needed to add a space after the \f0 in the string replace below. RTF was getting confused - // when there are number right after the \f0. Note also remove the space charcter after - // the \f1 command, as it is not needed since the \u commdn follows it. - // Here is the old code prior to when the foreach loop was added to handle symbols in RO value: - // - // linkValue = linkValue.Replace("\\u8209?", "\\f1\\u8209?\\f0 "); // dash character - // linkValue = linkValue.Replace("\\u9586?", "\\f1\\u9586?\\f0 "); // backslash symbol - // linkValue = linkValue.Replace("\\u916?", "\\f1\\u916?\\f0 "); // delta symbol - - var pattern = @"\\u([0-9]{1,4})\?"; // RO Editor add symbols C2022 - 003 - foreach (Match match in Regex.Matches(linkValue, pattern, RegexOptions.IgnoreCase)) - { - linkValue = linkValue.Replace(match.Value, "\\f1" + match.Value + "\\f0 "); - } - - linkValue = linkValue.Replace(@"{", @"\{"); - linkValue = linkValue.Replace(@"}", @"\}"); - - SelectedRtf = @"{\rtf1\ansi" + FontTable + @"{\colortbl ;\red255\green0\blue0;\red0\green0\blue255;}\v" + FontSize + @" \v0 }"; - this.SelectionLength = 0; - this.SelectionStart = position; - FindAllLinks(); - } - private void AddLink50(string linkValue, string linkUrl) - { - int position = SelectionStart; - SelectionLength = 0; - SelectedRtf = string.Format(@"{{\rtf\field{{\*\fldinst{{HYPERLINK ""www.volian.com #{0}"" }}}}{{\fldrslt{{\cf2\ul {1}}}}}}}", linkUrl, linkValue); - this.SelectionStart = this.TextLength; - this.SelectionLength = 0; - } - private void AddRtfStyles() - { - if ((OrigDisplayText.TextFont.Style & E_Style.Bold) > 0) - { - this.SelectAll(); - RTBAPI.ToggleBold(true, this, RTBAPI.RTBSelection.SCF_SELECTION); - this.Select(0, 0); - } - // Bug Fix - // The code below was changed to select all of the text and then - // apply the underlining to the selected text, because if the - // the underlining was applied to RTBAPI.RTBSelection.SCF_ALL - // the Links were changed so that they were no longer hidden. - if ((OrigDisplayText.TextFont.Style & E_Style.Underline) > 0) - // RTBAPI.ToggleUnderline(true, this, RTBAPI.RTBSelection.SCF_ALL); - { - this.SelectAll(); - RTBAPI.ToggleUnderline(true, this, RTBAPI.RTBSelection.SCF_SELECTION); - this.Select(0, 0); - } - // Bug Fix - // The code below was changed to select all of the text and then - // apply the italics to the selected text, because if the - // the italics was applied to RTBAPI.RTBSelection.SCF_ALL - // the Links were changed so that they were no longer hidden. - if ((OrigDisplayText.TextFont.Style & E_Style.Italics) > 0) - // RTBAPI.ToggleItalic(true, this, RTBAPI.RTBSelection.SCF_ALL); - { - this.SelectAll(); - RTBAPI.ToggleItalic(true, this, RTBAPI.RTBSelection.SCF_SELECTION); - this.Select(0, 0); - } - } - #endregion - #region HeightSupport - public event StepRTBEvent HeightChanged; - private void OnHeightChanged(object sender, EventArgs args) - { - if (HeightChanged != null) HeightChanged(sender, args); - } - private void AdjustSizeForContents(bool adjustWidth) - { - if (!_InitializingRTB) - { - Size offset = Size - ClientSize; - int widthNew = (this is TableCellEditor) ? Width : (ContentsSize.Width + offset.Width + AdjustSize.Width); - int heightNew = ContentsSize.Height + offset.Height + AdjustSize.Height; - // Don't make the window narrower unless it has text - RHM - 20100107 - Size szNew = new Size(((Text != "" && adjustWidth) ? widthNew : (widthNew > Width ? widthNew : Width)), heightNew); - if (this.Size != szNew) - { - int heightOld = Height; - //Console.WriteLine("before {0}, {1}, {2}, {3}, {4}", Size, szNew, widthNew, Width, this.GetType().Name); - this.Size = szNew; - //Console.WriteLine("after {0}, {1}, {2}, {3}", Size, szNew, widthNew, Width); - if (heightOld != Height) - { - OnHeightChanged(this, new EventArgs()); - if (ScrollPos.Y != 0) // Adjust ScrollPosition if it isn't Zero - ScrollPos = new Point(0, 0); - } - } - } - } - private float GetStringWidth(string strMeasureString) - { - using (Graphics g = Graphics.FromHwnd(Handle)) - { - return g.MeasureString(strMeasureString, Font).Width; - } - } - private int Ceiling(float f) - { - return (int)(Math.Ceiling(f)); - } - public int MaxTextWidth - { - get - { - int maxWidth = 0; - for (int i = 0; i < TextLength; i++) - { - int w = GetPositionFromCharIndex(i).X; - maxWidth = Math.Max(maxWidth, w); - } - return maxWidth+10; // add 10 to account for the last character - } - } - public void AdjustWidthForContent() - { - AdjustWidthForContent(0); - } - public void AdjustWidthForContent(int count) - { - int widthNL = Ceiling(GetStringWidth("\n")); - int widthMax = 0; - int widthMaxWW = 0; - int indexStart = 0; - int lineCountFromLines = Lines.Length; - int lineCountFromGet = GetLineFromCharIndex(TextLength)+1; - for (int i = 0; i < Lines.Length; i++) - { - int lineStart = GetLineFromCharIndex(indexStart); - int indexEnd = indexStart + Lines[i].Length; - int lineEnd = GetLineFromCharIndex(indexEnd); - Point pointStart = GetPositionFromCharIndex(indexStart); - Point pointEnd = GetPositionFromCharIndex(indexEnd); - int indexEndPos = GetCharIndexFromPosition(pointEnd); - if (indexEndPos + 1 < indexEnd) // This indicates that the text is wider than the Rich Text Box - { - int w = pointEnd.X + (indexEnd - indexEndPos) * widthNL; - if (w > widthMaxWW) - widthMaxWW = w; - } - if (lineEnd > lineStart)// this indicates that there was word-wrap on this line. - { - int w = pointEnd.X + Width * (lineEnd - lineStart); - if (w > widthMaxWW) - widthMaxWW = w; - } - else - { - if (pointEnd.X > widthMax) - widthMax = pointEnd.X; - } - indexStart = indexEnd + 1; - } - if (widthMaxWW == 0) - { - int widthBorder = Width - ClientSize.Width; - int w = widthMax + widthNL + widthBorder; - if (Width != w) - { - if (count < 5 || Width < w) - { - Width = w; - AdjustWidthForContent(count + 1);// Try one more time - } - } - } - else - { - if (count < 5 || Width < widthMaxWW) - { - Width = widthMaxWW; - AdjustWidthForContent(count + 1); - } - } - } - public int CalculateHeight() - { - if (this.CreateParams.ClassName == "RICHEDIT50W") - return CalculateHeight50(); - else - return CalculateHeight20(); - } - private int CalculateHeight20() - { - Application.DoEvents(); - int yBottom = GetPositionFromCharIndex(TextLength).Y; - int yTop = GetPositionFromCharIndex(0).Y; - int heightFont = SelectionFont.Height; - int borderSize = this.Height - this.ClientSize.Height; - int heightNext = (yBottom - yTop) + heightFont + borderSize + 2;// 2 pixels - 1 at the top and 1 at the bottom - if (heightNext != Height) - { - Height = heightNext; - - OnHeightChanged(this, new EventArgs()); - ScrollPos = new Point(0, 0); // Scroll to make sure that the first line is displayed as the first line - } - return heightNext; - } - private int CalculateHeight50() - { - Application.DoEvents(); - int heightFont = SelectionFont.Height; - int borderSize = this.Height - this.ClientSize.Height; - int heightNext = (1 + GetLineFromCharIndex(TextLength)) * heightFont + borderSize + 2;// 2 pixels - 1 at the top and 1 at the bottom - return heightNext; - } - #endregion - #region ColorSupport - Not currently used. - #endregion - #region EventSupport - #region LinkEvents - private StepPanelLinkEventArgs _MyLinkClickedEventArgs; - public event StepRTBLinkEvent LinkChanged; - private void OnLinkChanged(object sender, StepPanelLinkEventArgs args) - { - _MyLinkClickedEventArgs = args; - if (LinkChanged != null) LinkChanged(sender, args); - } - public event StepRTBLinkEvent LinkGoTo; - private void OnLinkGoTo(object sender, StepPanelLinkEventArgs args) - { - _MyLinkClickedEventArgs = args; - if (LinkGoTo != null) LinkGoTo(sender, args); - } - public event StepRTBLinkEvent LinkModifyTran; - private void OnLinkModifyTran(object sender, StepPanelLinkEventArgs args) - { - _MyLinkClickedEventArgs = args; - if (LinkModifyTran != null) LinkModifyTran(sender, args); - } - public event StepRTBLinkEvent LinkModifyRO; - private void OnLinkModifyRO(object sender, StepPanelLinkEventArgs args) - { - _MyLinkClickedEventArgs = args; - if (LinkModifyRO != null) LinkModifyRO(sender, args); - } - #endregion - #region TextAndContentsEvents - void StepRTB_TextChanged(object sender, EventArgs e) - { - if (_InitializingRTB || _IsExperimenting) return; - // Was setting _IsDirty to true here, but this was getting called from - // 'dotnetbar' when text was NOT Changed. So _IsDirty was made into - // a property and compared original rtf versus current richtextbox's - // rtf. - // the below 2 lines were added to solve the problem with the change manager detail not showing the text of an audit when the same audit - //was selected twice - if (Text == string.Empty) - LastRtf = string.Empty; - FindAllLinks(); - } - private void ShowMyParentsFonts() - { - Console.WriteLine("\r\n--- Parents Fonts ---- For ----{0}", Text); - ShowMyParentsFonts(this); - Console.WriteLine("Selection Font".PadRight(31) + SelectionFont); - } - private void ShowMyParentsFonts(Control ctrl) - { - if (ctrl.Parent is Control) - ShowMyParentsFonts(ctrl.Parent); - Console.WriteLine("{0} {1}", ctrl.GetType().Name.PadRight(30), ctrl.Font); - } - public void StepRTB_ContentsResized(object sender, ContentsResizedEventArgs e) - { - ContentsRectangle = e.NewRectangle; - } - #endregion - #region Selection Handlers - bool _AdjustingSelection = false; - private bool _ProcessingDelete; - private bool _HandlingCtrlA = false; - private void HandleLocalSelectionChange() - { - if (this.MyItemInfo != null && this.MyItemInfo.IsRtfRaw) return; // B2017-023 null reference check for empty workdraft set information dialog - if (OnIsNotCurrentSelection(this, new EventArgs())) - return; - - HandleSelectionChange(); - } - private void HandleSelectionChange() - { - if (_MouseDown) return; - if (_HandlingCtrlA) return; - if (!_HandlingCtrlA && this.TextLength == this.SelectionLength && this.SelectedRtf.EndsWith("\\par\r\n}\r\n")) - { - _HandlingCtrlA = true; - SelectAll(); - _HandlingCtrlA = false; - } - bool startingValue = _AdjustingSelection; - if (_IdentifyingLinks || _ProcessingDelete) return; - // If the cursor is beyond the end of the line then move the cursor back one character - if (CorrectSelectionAtEndOfLine()) - return; - if (ProcessKeystrokes) - { - if (!_MouseDown && !_AdjustingSelection) - { - if (_LinkLocations != null) - { - DebugPrint("HSC===================>Beginning: SelectionStart {0}, SelectionLength {1}", SelectionStart, SelectionLength); - _AdjustingSelection = true; - LinkLocation ll = FindLinkLocation(); - LinkLocation llend = null; - if (SelectionLength != 0) - llend = FindLinkLocation(SelectionStart + SelectionLength - 1); - if (ll != null) - { - if (SelectionStart == ll.Start && SelectionLength == 0) - { - if (SelectionStart >= 7) - { - // If the cursor is at the beginning of the line and a link is at the beginning of the line - // then select the link rather than postitioning the cursor at the end of the previous line - if (!_LastWasLeftArrow && GetFirstCharIndexOfCurrentLine() == SelectionStart) - SetSelection(ll); - else - { - DebugPrint("HSC===================>ll Insert: Sel {0}, Length {1}, Link Start {2}, Link Length {3}", SelectionStart, SelectionLength, ll.Start, ll.Length); - SelectionStart = ll.Start - 7; - } - } - } - else if (SelectionStart + SelectionLength > ll.End) // Beyond the end of the starting link - { - int end = SelectionStart + SelectionLength; - if (llend != null) end = llend.End; // If it extends into another link extend the end to the end of that link - DebugPrint("HSC===================>ll After: Sel {0}, Length {1}, Link Start {2}, Link Length {3}", SelectionStart, SelectionLength, ll.Start, ll.Length); - SetSelection(ll.Start, end - ll.Start); - } - else if (SelectionStart >= ll.Start || SelectionLength > 0)// Within the starting link - { - DebugPrint("HSC===================>ll: Sel {0}, Length {1}, Link Start {2}, Link Length {3}", SelectionStart, SelectionLength, ll.Start, ll.Length); - SetSelection(ll); - } - } - else if (llend != null) - { - DebugPrint("HSC===================>llend: Sel {0}, Length {1}, Link Start {2}, Link Length {3}", SelectionStart, SelectionLength, llend.Start, llend.Length); - // Check to see if the beginning starts before the Removing ending Removing starting _AdjustingSelection problem"); - DebugPrint("RS------ SelectionChange > {0}", FindRangeStatus()); - if (SelectionLength > 0 && IsSelectionLinked(SelectionStart, SelectionLength)) - { - if (SelectedText.IndexOf(@"[END>") > 0) - { - MyLinkText = SelectedText.Substring(0, SelectedText.IndexOf(@"[END>")); - } - else - { - MyLinkText = SelectedText; - } - } - else - { - MyLinkText = null; - } - - OnRTBSelectionChanged(this, new EventArgs()); - _LastWasLeftArrow = false; - } - /// - /// If the Selection is beyond the end of the line, move the selection back one character - /// - /// - private bool CorrectSelectionAtEndOfLine() - { - if (SelectionStart > 0 && SelectionLength == 0 && - GetFirstCharIndexFromLine(GetLineFromCharIndex(SelectionStart)) > - GetFirstCharIndexOfCurrentLine()) - { - SelectionStart--; // Move the cursor back one character - return true; - } - return false; - } - - private bool _CheckSelection = false; - #endregion - #region Delete Handlers - private void HandleDeleteKeyWithSelectedText(KeyEventArgs e, string keychars) - { - _ProcessingDelete = true; - FindRangeStatus(); - //DebugPrint("RS---------------- Delete > {0}", _RTBRangeStatus); - switch (_RTBRangeStatus) - { - case RangeStatus.NoContainedLinks: - case RangeStatus.Before_After: - case RangeStatus.Before_EndLink: - case RangeStatus.Before_EndBox: - default: - DeleteCurrentSelection(keychars); - e.SuppressKeyPress = true; - break; - case RangeStatus.Before_Between: - DeleteEndBetweenLinks(keychars); - e.SuppressKeyPress = true; - break; - case RangeStatus.Between_EndBox: - case RangeStatus.Between_EndLink: - case RangeStatus.Between_After: - DeleteStartBetweenLinks(keychars); - e.SuppressKeyPress = true; - break; - case RangeStatus.Between_Between: - DeleteBetweenBetweenLinks(keychars); - e.SuppressKeyPress = true; - break; - case RangeStatus.StartLink_EndBox: - case RangeStatus.StartLink_EndLink: - case RangeStatus.StartLink_After: - ExpandSelectionToIncludeStart(); - DeleteCurrentSelection(keychars); - e.SuppressKeyPress = true; - break; - case RangeStatus.StartLink_Between: - ExpandSelectionToIncludeStart(); - DeleteEndBetweenLinks(keychars); - e.SuppressKeyPress = true; - break; - case RangeStatus.StartBox_EndLink: - case RangeStatus.StartBox_EndBox: - case RangeStatus.StartBox_After: - DeleteFromStartOfBox(keychars); - e.SuppressKeyPress = true; - break; - case RangeStatus.StartBox_Between: - DeleteFromStartOfBoxEndBetweenLinks(keychars); - e.SuppressKeyPress = true; - break; - // REMOVE THESE CASES OR PUT A MESSAGE OUT SAYING ERROR IN CODE - CASE - // NOT HANDLED - case RangeStatus.Before_StartLink: - case RangeStatus.Between_StartLink: - case RangeStatus.StartLink_StartLink: - case RangeStatus.StartBox_StartLink: - break; - } - _ProcessingDelete = false; - StepRTB_TextChanged(this, new EventArgs()); - } - private void InsertCharBetweenLinks(LinkLocation ll) - { - InsertCharBetweenLinks(ll, ' ', false); - } - private void InsertCharBetweenLinks(LinkLocation ll, string strToAdd) - { - InsertCharBetweenLinks(ll, strToAdd, true); - } - private void InsertCharBetweenLinks(LinkLocation ll, string strToAdd, bool setSelect) - { - Rtf = Rtf.Substring(0, ll.StartRtf) + @"\v0 " + strToAdd + @"\v " + Rtf.Substring(ll.StartRtf); - if (setSelect) - SelectionStart = ll.Start - 6; // account for - /// This inserts a space in between two links. - /// It actually inserts "\v0 {space}\v " between the END tag and the START tag - /// - /// - /// - /// - private void InsertCharBetweenLinks(LinkLocation ll, char charToAdd, bool setSelect) - { - DebugPrint("ICBLvvvvvvvvvvvvvvv>>>"); - Rtf = Rtf.Substring(0, ll.StartRtf) + @"\v0 " + charToAdd.ToString() + @"\v " + Rtf.Substring(ll.StartRtf); - if (setSelect) - SelectionStart = ll.Start - 6; // account for >>"); - } - private void ExpandSelectionToIncludeStart() - { - SetSelection(SelectionStart - 7, SelectionLength + 7); // Expand selection to include start - } - public string GetSelectionForClipBoard() - { - string selTxtRTF = SelectedRtf; - LinkLocation llstart = FindLinkLocation(); - if (llstart != null) - { - selTxtRTF = Rtf.Substring(llstart.StartRtf, llstart.EndRtf - llstart.StartRtf); - string lookfor = selTxtRTF.Substring(selTxtRTF.IndexOf(' ')); - return SelectedRtf.Replace(lookfor, @"\v " + selTxtRTF); - } - return (selTxtRTF); - } - - private void DeleteBetweenBetweenLinks(string keychars) - { - - DebugSelection("DeleteBetweenBetweenLinks"); - int selStart = SelectionStart - 7; - int selLength = SelectionLength + 2; // Include the two added spaces - InsertCharBetweenLinks(_RangeEndLink.NextLink); // Add a space at the end link - InsertCharBetweenLinks(_RangeStartLink); // Add a space a the start link - SetSelection(selStart, selLength);// Select everything including the spaces - DeleteCurrentSelection(keychars);// Delete Selection - } - /// - /// This is added to handle a glitch in richtextbox. Depending on - /// which direction that selection is made (left -> right or right -> left) - /// a replacement or delete may not work, you'll just get a 'beep'. - /// This approach consistently works. - /// - public bool WasXDelete = false; - private void DeleteCurrentSelection(string keys) - { - - DebugPrint("vvvvvvvvvvvvxxxxxxxxxxxx>"); - DebugSelection("Before X"); - DebugPrint(keys == null ? "NULL" : "NOT NULL"); - SelectedText = keys==null?"X":keys; // replace text with X - WasXDelete = (keys == null); - DebugSelection("After X"); - DebugPrint("------------xxxxxxxxxxxx>"); - if (keys == null) - { - _SendBackSpace = true; - RtbSendKeys("{BS}"); // remove X - Application.DoEvents(); - DebugSelection("After BS"); - } - DebugPrint("^^^^^^^^^^^^xxxxxxxxxxxx>"); - } - private void DeleteSelection(int start, int length, string keychars) - { - SetSelection(start, length); - DeleteCurrentSelection(keychars); - } - private void DeleteEndBetweenLinks(string keychars) - { - _ProcessingKeys++; - DebugSelection("DeleteEndBetweenLinks"); - int sstart = SelectionStart; - int slen = SelectionLength + 1 - 7; - // This puts a space at the link that starts at the end of the selection - InsertCharBetweenLinks(_RangeEndLink.NextLink); - DeleteSelection(sstart, slen, keychars); - _ProcessingKeys--; - } - private void DeleteStartBetweenLinks(string keychars) - { - _ProcessingKeys++; - DebugSelection("DeleteStartBetweenLinks"); - int slen = SelectionLength + 8; - int sstart = SelectionStart - 7; - InsertCharBetweenLinks(_RangeStartLink); - DeleteSelection(sstart, slen, keychars); - _ProcessingKeys--; - } - private void DeleteFromStartOfBox(string keychars) - { - _ProcessingKeys++; - DebugSelection("DeleteFromStartOfBox"); - int slen = SelectionLength; - SetSelection(0, 0); - SelectedText = " "; - DeleteSelection(0, slen + 8, keychars); - _ProcessingKeys--; - } - private void DeleteFromStartOfBoxEndBetweenLinks(string keychars) - { - _ProcessingKeys++; - DebugSelection("DeleteFromStartOfBoxEndBetweenLinks"); - // This puts a space at the link that starts at the end of the selection - int sLen = SelectionStart + SelectionLength - 7 + 2;// -7 for 0) SetSelection(SelectionStart, newend - SelectionStart); - break; - case Keys.Space: - if (e.Control && MyDVI != null && UserInfo.CanEdit(MyUserInfo, MyDVI)) // Hardspace - Ctrl+Shift+Space - { - InsertSymbol(@"\u160?"); - e.Handled = true; - } - break; - case Keys.F3: // shift F3 - e.Handled = true; - ToggleCase(); // toggle through Upper, Lower, and Title case - break; - default: - break; - } - } - - private string GetSelectedDisplayableText() - { - using (StepRTB srtb = new StepRTB()) - { - srtb.Rtf = this.SelectedRtf.Replace(@"\u8209?", "-"); - srtb.Rtf = srtb.Rtf.Replace(@"\u9586?", @"\\"); - string rtnstr = ""; - string ctxt = srtb.Text; - if (ctxt.EndsWith(""); - if ((strtidx == -1 || strtidx > lnkidx) && lnkidx > -1 && endidx > -1) - { - rtnstr += ctxt.Substring(idx, lnkidx); - idx = endidx + 5; - strtidx = ctxt.IndexOf("", idx); - } - while (strtidx > -1) - { - rtnstr += ctxt.Substring(idx, strtidx - idx); - idx = strtidx + 7; - rtnstr += ctxt.Substring(idx, lnkidx - idx); - idx = endidx + 5; - strtidx = ctxt.IndexOf("", idx); - } - if (idx < ctxt.Length) - rtnstr += ctxt.Substring(idx); - return rtnstr; - } - } - - private bool IsControlChar = false; - private bool _SendBackSpace = false; - private int _ImageWidth = 0; - public int ImageWidth - { - get { return _ImageWidth; } - set { _ImageWidth = value; } - } - void StepRTB_KeyDown(object sender, KeyEventArgs e) - { - // added jcb 20130103 to support set ro from word doc with annotation when right click menu is opened by keyboard - if (e.KeyCode == Keys.Apps) - OnSetMenu(this, new StepRTBMenuEventArgs("OpenContextMenu")); - - // the following code only allows arrow keys & pageup/down for rtf raw items: - if (!e.Control && !e.Shift && MyItemInfo != null && MyItemInfo.IsRtfRaw) // error message is displayed in keypress for this. - { - if (e.KeyCode != Keys.Up && e.KeyCode != Keys.Down && e.KeyCode != Keys.Right && e.KeyCode != Keys.Left && e.KeyCode != Keys.PageDown && e.KeyCode != Keys.PageUp) - { - e.Handled = true; - return; - } - } - if (e.Control) - { - IsControlChar = true; - if (e.Shift) - { - //Console.WriteLine("keycode = {0} key value = {1}",e.KeyCode,e.KeyValue); - switch (e.KeyCode) - { - // The following keys are supported in underlying RTB (with ctrl+shift key), - // but PROMS should not do anything for that functionality: - case Keys.Add: // the plus on the key pad - case Keys.Subtract: - case Keys.L: - case Keys.Oemplus: // the plus on the keyboard (not the key pad) - e.Handled = true; - break; - } - } - else - { - switch (e.KeyCode) - { - case Keys.X: //ctrl-X - case Keys.C: //ctrl-C - // handle the clipboard copy and cut when a Transition or RO is selected - // For now, we are coping/cutting just the displayed text to the clipboard (like 16-bit VE-PROMS) - string ts = GetSelectedDisplayableText(); - if (ts != null && ts != "") Clipboard.SetText(GetSelectedDisplayableText()); - e.Handled = true; - e.SuppressKeyPress = true; - if (ts != null && ts != "" && e.KeyCode == Keys.X) // cut to clipboard - delete the selected text - HandleDeleteKeyWithSelectedText(e, null); - break; - case Keys.V: - // NOTE that if in a Properties Dialog StepRTB (for numbers and titles) or in a Procedure Specific - // Information (PSI) Dialog, i.e. any non-EditItem/Step editor field, the following code is run - // for the ctrl-V. For EditItems & Grid cells, the code in StepTabRibbon's btnPaste_Click is - // run. The way this occurs is that in the designer for StepTabRibbon (StepTabRibbon.designer.cs), - // the line of code: - // this.btnPaste.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlV); - // maps the Ctrl-V to btnPaste for those StepRTB's that are associated with the StepTabRibbon, i.e. - // EditItems & Grid cells. - IDataObject iData = Clipboard.GetDataObject(); - - // verify that data in clipboard is valid for this type. If inserting an equation, need to verify that - // input data has an 'equation', and if not inserting into an equation step type, it must not have - // equation data. - //DataFormats.Format frm = DataFormats.GetFormat("Embed Source"); - //System.Windows.Forms.RichTextBox richTextBox1; - using (System.Windows.Forms.RichTextBox richTextBox1 = new System.Windows.Forms.RichTextBox()) - { - richTextBox1.Location = new System.Drawing.Point(35, 32); - richTextBox1.Name = "richTextBox1"; - richTextBox1.Size = new System.Drawing.Size(67, 58); - richTextBox1.TabIndex = 0; - richTextBox1.Text = ""; - richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; - bool hasEquation = false; - try - { - DataFormats.Format frm = DataFormats.GetFormat("Embed Source"); - richTextBox1.Paste(frm); - if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS EQU")) hasEquation = true; - if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS VIS")) hasEquation = true; // Support Visio - } - catch (Exception ex) - { - hasEquation = true; - } - /// B2020-051: Don't allow pasting of a mathtype equation into an item that isn't the correct type - if (iData.GetDataPresent("Embed Source")) hasEquation = true; // mathtype - - if (MyItemInfo != null && MyItemInfo.IsRtfRaw && MyItemInfo.FormatStepData.Type.ToUpper().Contains("EQUATION") && !hasEquation) - { - FlexibleMessageBox.Show("Cannot paste non-equation data into an equation step type.", "Invalid data", MessageBoxButtons.OK); - e.Handled = true; - return; - } - // if inserting anything other than equation, be sure that an equation is not in the buffer: - else if (hasEquation && (MyItemInfo == null || (MyItemInfo != null && !MyItemInfo.IsRtfRaw && !MyItemInfo.FormatStepData.Type.ToUpper().Contains("EQUATION")))) - { - FlexibleMessageBox.Show("Cannot paste equation data into an non-equation step type.", "Invalid data", MessageBoxButtons.OK); - e.Handled = true; - return; - } - - // only allow the paste of a screen shot image if using the shortcut switch "/EmbedImages" - if (Volian.Base.Library.VlnSettings.GetCommandFlag("EmbedImages") && iData.GetDataPresent(DataFormats.Dib)) // Device Independent Bitmap - { - System.Drawing.Image img = Clipboard.GetImage(); - ImageWidth = img.Width; - Width = ImageWidth + 2; - Paste(); - e.Handled = true; - return; - } - else if (iData.GetDataPresent("Embed Source")) //DS Equation") || iData.GetDataPresent("MathType EF")) - { - Size sz = RtfRawItem.GetRtfRawSize(richTextBox1.Rtf); - this.Rtf = richTextBox1.Rtf; - Width = sz.Width; - Height = sz.Height; - e.Handled = true; - return; - } - else if (iData.GetDataPresent(DataFormats.Dib)) - { - System.Drawing.Image img = Clipboard.GetImage(); - ImageWidth = img.Width; - Width = ImageWidth + 2; - Paste(); - e.Handled = true; - return; - } - else - { - if (!iData.GetDataPresent(DataFormats.Text) && !iData.GetDataPresent(DataFormats.Rtf)) - { - FlexibleMessageBox.Show("Cannot paste, text has special characters or symbols that will not paste correctly."); - } - else - { - // if contains bad rtf (from Word), paste as text, otherwise, do the paste here. - if (!PasteRtfAsText(true)) Paste(); - if (SelectionLength == 0 && MyStyleFont != null) SelectionFont = MyStyleFont.WindowsFont; // B2017-023 null reference check for empty workdraft set information dialog - } - } - } // end using - e.Handled = true; - return; - - case Keys.Home: - StepRTB_HomeEndPressed(e); - e.Handled = true; - break; - case Keys.End: - StepRTB_HomeEndPressed(e); - e.Handled = true; - break; - // 16bit Proms used 'ctrl-enter' for Hard returns. 32bit Proms uses 'shift-enter' - // because the richtextbox does this by default. Also Word uses 'shift-enter' - // for Hard return. And Word uses 'ctrl-enter' for inserting of page break. So - // 'ctrl-enter' for 32bit will insert page break - case Keys.Enter: - OnInsertPgBrk(this, new EventArgs()); - e.Handled = true; - break; - // The following keys are supported in underlying RTB (with ctrl key), but PROMS should not - // do anything for that functionality: - case Keys.R: // Right Align text - case Keys.L: // Left Align text - case Keys.E: // Center Align text - case Keys.D1: // Single space text (D1 is the '1' key) - case Keys.D2: // Double space text - case Keys.D5: // 1.5 space text - case Keys.H: // Find (proms uses Ctrl+F for find) - case Keys.Oemplus: // plus on the keyboard (not the key pad) - e.Handled = true; - break; - } - } - } - if (((int)e.KeyCode) == 220) e.Handled = true; - switch (e.KeyCode) - { - case Keys.Left: - if (e.Shift) - { - int linkWidth = FindlinkWidth(false,e.Control); - - if (linkWidth == 0)// if not link, don't do special processing - { - if (e.Control) - { - this.AutoWordSelection = true; // this will select a word at a time - } - return; - } - else - linkWidth++; - int len = SelectionLength - linkWidth; - SetSelection(SelectionStart, len); // adjust the selcection around the linked text - e.Handled = true; - return; - } - if (e.Control || SelectionStart == 0) - { - StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlLeft : E_ArrowKeys.Left); - e.Handled = true; - } - HandleLocalSelectionChange(); - break; - case Keys.Up: - int ln = GetLineFromCharIndex(SelectionStart); - if (e.Control || ln == 0) - { - StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlUp : E_ArrowKeys.Up); - e.Handled = true; - } - // if shift-up & at selection had a link, handle this as special case. - if (e.Shift && SelectionLength > 0) - { - RangeStatus rs = FindRangeStatus(); - if (rs != RangeStatus.NoContainedLinks) - { - int curend = SelectionStart + SelectionLength; - SelectionLength = 0; - RtbSendKeys("{Up}"); - Application.DoEvents(); - Select(SelectionStart, curend - SelectionStart); - e.Handled = true; - } - } - else - { - HandleLocalSelectionChange(); - } - break; - case Keys.Right: - // If at beginning of box that starts with a link, don't worry about shift or not, - // because selection is first character or link without any other selection. Don't - // need to write code to handle link at beginning of box in Shift Right code because - // it's handled in HandleSelectionChange. - if (e.Shift && ((SelectionStart > 0) || (SelectionStart == 0 && _LinkLocations.Count > 0 && _LinkLocations[0].Start != 7))) - { - int newlen = FindlinkWidth(true,e.Control); - if (newlen == 0) // not on linked text - { - if (e.Shift && e.Control) - this.AutoWordSelection = true; - return; - } - else if (e.Shift && e.Control) - newlen++; - int len = SelectionLength + newlen; - SetSelection(SelectionStart, len); // adjust the selection around the linked text - e.Handled = true; - return; - } - if(e.Control && e.Shift && SelectionStart == 0)//b2016-246 Ctrl-Shift-Right Arrow extend select * from ITEMS IIon a word at a time - { - SelectionLength++; - this.AutoWordSelection = true; - return; - } - if (e.Control || SelectionStart == this.Text.Length) - { - StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlRight : E_ArrowKeys.Right); - e.Handled = true; - } - HandleLocalSelectionChange(); - break; - case Keys.Down: - int l = GetLineFromCharIndex(SelectionStart); - Point pos = new Point(); - pos.X = ClientRectangle.Width; - pos.Y = ClientRectangle.Height; - int lastIndex = this.GetCharIndexFromPosition(pos); - int lastLine = this.GetLineFromCharIndex(lastIndex); - if (e.Control || l >= lastLine) - { - StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlDown : E_ArrowKeys.Down); - HandleLocalSelectionChange(); - e.Handled = true; - return; - } - if (!e.Shift) HandleLocalSelectionChange(); - // if shift-down & on link at beginning of box - do special processing (regular processing - // didn't handle it correctly. - if (e.Shift && lastLine > 0 && SelectionStart == 0 && _LinkLocations.Count > 0 && _LinkLocations[0].Start == 7) - { - Point cpos = GetPositionFromCharIndex(SelectionStart); - int addon = ClientRectangle.Height / (lastLine + 1); - cpos.Y = cpos.Y + addon; - int selend = GetCharIndexFromPosition(cpos); - Select(7, selend - 7); - e.Handled = true; - } - break; - case Keys.PageUp: - StepRTB_PageKeyPressed(e); - e.Handled = true; - break; - case Keys.PageDown: - StepRTB_PageKeyPressed(e); - e.Handled = true; - break; - case Keys.Delete: - if (SelectionLength == 0) - { - foreach (LinkLocation lls in _LinkLocations) - { - if (SelectionStart >= lls.Start - 7 && SelectionStart < lls.End) - { - SetSelection(lls);// Select the link to the right - HandleDeleteKeyWithSelectedText(e, null); - e.SuppressKeyPress = true; - return; - } - } - if (SelectionStart != TextLength) - { - if (e.Control) - { - // B2016-245 [ctrl][delete] deletes rest of word to the right of the cursor - RtbSendKeys("+^{RIGHT}{BS}"); //[shift][ctrl][right arrow] (selects rest of word to the right) folowed by a backspace (delete) - e.SuppressKeyPress = true; - } - else - { - SelectionStart++;// A Delete can be accomplished with a right arrow followed by a backspace. - RtbSendKeys("{BS}"); // This is done due to a glitch in the RichTextBox that sometimes causes a beep rather than a delete - e.SuppressKeyPress = true; - } - } - } - else - HandleDeleteKeyWithSelectedText(e, null); - break; - case Keys.Back: - if (_SendBackSpace) - { - _SendBackSpace = false; - return; - } - _CheckSelection = true; - if (SelectionLength == 0) - { - foreach (LinkLocation lls in _LinkLocations) - { - if (SelectionStart > lls.Start - 7 && SelectionStart <= lls.End) - { - SetSelection(lls); - break; - } - } - } - if (SelectionLength > 0) HandleDeleteKeyWithSelectedText(e, null); - break; - case Keys.Insert: - // For now, don't allow for toggling between insert/overwrite mode - see - // comment on _OverWrite - e.Handled = true; - break; - case Keys.F5: - if (!UserInfo.CanEdit(MyUserInfo, MyItemInfo.MyDocVersion)) - { - e.Handled = true; - break; - } - if (e.Shift) - { - e.Handled = true; - ItemInfo myCopyStep = (this.Parent.Parent.Parent as StepTabPanel).MyDisplayTabControl.MyCopyStep; - if (myCopyStep != null) - { - OnSetMenu(this, new StepRTBMenuEventArgs("StepPaste")); - } - } - else if (!e.Control && !e.Alt) - { - e.Handled = true; - OnCopyStep(this, new EventArgs()); - } - break; - case Keys.F6: - e.Handled = true; - SendKeys.Send("%H{ESC}"); - break; - case Keys.Tab: - VlnFlexGrid myGrid = Parent as VlnFlexGrid; - if (myGrid == null) - { - e.SuppressKeyPress = true; - e.Handled = true; - Form frm = ParentForm(this); - if (frm != null) - frm.SelectNextControl(this, true, true, true, true); - else - StepRTB_ArrowPressed(e.Shift ? E_ArrowKeys.CtrlUp : E_ArrowKeys.CtrlRight); - } - else - { - if (e.Shift) - { - e.SuppressKeyPress = true; - e.Handled = true; - if (!myGrid.SelectPrevCell()) - { - // don't do anything if at top (for now) - } - } - else - { - e.SuppressKeyPress = true; - e.Handled = true; - if (!myGrid.SelectNextCell()) - { - myGrid.MyBorders.InsertRow(myGrid.Rows.Count - 1); - myGrid.MyShading.InsertRow(myGrid.Rows.Count - 1); // C2021-004 Table Cell Shading information - myGrid.Rows.Add(1); - myGrid.SelectNextCell(); - } - } - } - break; - case Keys.Enter: - if (!e.Control && !e.Shift && !e.Alt) - { - if (UserInfo.CanEdit(MyUserInfo,MyItemInfo.MyDocVersion)) - OnEnterKeyPressed(sender, e); - else - { - // user cannot change data so just move to the next step element - StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown); // perform a - HandleLocalSelectionChange(); - e.Handled = true; - } - } - break; - case Keys.F2: - if (e.Alt && !e.Control && !e.Shift) // toggle change bar - { - if (MyUserInfo.IsAdministrator() || MyUserInfo.IsSetAdministrator(MyDVI) || MyUserInfo.IsWriter(MyDVI)) - OnToggleChangeBar(this, new EventArgs()); - e.Handled = true; - } - break; - case Keys.F7: - if (!e.Alt) // for the Include On check boxes on the step properties page - { - if (e.Control && e.Shift) // Toggle include on Placekeeper as Continuous Action - OnTogglePlaceKeeperContAct(this, new EventArgs()); - else if (e.Control) // Toggle include on Placekeeper - OnTogglePlaceKeeper(this, new EventArgs()); - else if (e.Shift) // toggle include on Continuous Action Summary - OnToggleContinuousActionSummary(this, new EventArgs()); - e.Handled = true; - } - break; - } - if (e.KeyValue == 187 && e.Control) // equal key pressed - { - if (e.Shift) // superscript - { - OnToggleSuperScript(this, new EventArgs()); - } - else // subscript - { - OnToggleSubScript(this, new EventArgs()); - } - e.Handled = true; - } - - } - // C2021-005 set the selected cell(s) or cell text to the passed in font size - public void SetFontSize(float newSize) - { - if (SelectedText == null || SelectedText == "") // empty table cell selected - Rtf = SetFontSizeReplace(Rtf, newSize); - else - { - // table cell text selected - int selst = SelectionStart; - int selln = SelectionLength; - string newrtf = SelectedRtf; //B2021-052 use a temporary variable to allow easy debugging - newrtf = SetFontSizeReplace(newrtf, newSize); // changes the /fs## command in the rtf string - SelectedRtf = newrtf;// replace the selected portion with the updated font size version of the rtf - Select(selst, selln); // re-select the cell text - } - } - // C2021-005 set the font size of the passed in RTF text - private string SetFontSizeReplace(string rtf, float newSize) - { - MatchCollection mc = Regex.Matches(rtf, @"\\fs([0-9]+)"); - foreach (Match match in mc) - { - float sz = float.Parse(match.Groups[1].Value); - float repwith = newSize * 2; // RTF font size is double the selected point size - string repsz = match.Value; // use \fs## rather than number in replace in case text contains the number - string repwithsz = match.Value.Replace(sz.ToString(), ((int)repwith).ToString()); - rtf = rtf.Replace(repsz, repwithsz); - } - return rtf; - } - // C2021-005 parse the rtf for the font sizes. - // if there are different font sizes, then return 0 - public float GetRTFFontSize() - { - string rtf; - if (SelectedText == null || SelectedText == "") - rtf = Rtf; - else - rtf = SelectedRtf; - MatchCollection mc = Regex.Matches(rtf, @"\\fs([0-9]+)"); - bool differentFonts = false; - float lastSZ = 0; - foreach (Match match in mc) - { - float sz = float.Parse(match.Groups[1].Value); - if (lastSZ == 0) - lastSZ = sz; - else if (lastSZ != sz) - differentFonts = true; - } - return (differentFonts || lastSZ == 0) ? 0 : lastSZ/2; // divide the RTF font size by two to get the font point size - } - // F2022-137 Table performance improvements - public static float GetRTFFontSize(string rtf) - { - MatchCollection mc = Regex.Matches(rtf, @"\\fs([0-9]+)"); - bool differentFonts = false; - float lastSZ = 0; - foreach (Match match in mc) - { - float sz = float.Parse(match.Groups[1].Value); - if (lastSZ == 0) - lastSZ = sz; - else if (lastSZ != sz) - differentFonts = true; - } - return (differentFonts || lastSZ == 0) ? 0 : lastSZ / 2; // divide the RTF font size by two to get the font point size - } - private static Form ParentForm(Control ctrl) - { - while (!(ctrl.Parent is Form || ctrl.Parent is EditItem)) - ctrl = ctrl.Parent; - return ctrl.Parent as Form; - } - private void StepRTB_HomeEndPressed(KeyEventArgs keyargs) - { - if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return; - // Cursor moves out of box only if control is pressed too - otherwise key is - // handled in rtb. - //if (keyargs.Control)MyRTBItem.MyStepPanel.StepCursorKeys(this, keyargs); // Replaced with an event - if (keyargs.Control) OnCursorKeyPress(this, keyargs); - } - private void StepRTB_PageKeyPressed(KeyEventArgs keyargs) - { - if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return; - //MyRTBItem.MyStepPanel.StepCursorKeys(this, keyargs); Replaced with an event - OnCursorKeyPress(this, keyargs); - } - public void StepRTB_ArrowPressed(E_ArrowKeys key) - { - Point cp = PointToClient(Cursor.Position); - //MyRTBItem.MyStepPanel.CursorMovement(this, cp, key); Replaced with an event - OnCursorMovement(this, new StepRTBCursorMovementEventArgs(cp, key)); - } - private void StepRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) - { - if (!ReadOnly) - { - if (!IsControlChar && MyItemInfo != null && MyItemInfo.IsRtfRaw) - { - string err = string.Format("Cannot enter text into an equation or incorrect keystroke entered for equation"); - FlexibleMessageBox.Show(err, "Invalid text.", MessageBoxButtons.OK); - e.Handled = true; - return; - } - if (Text == "" && Parent != null && Parent is VlnFlexGrid) - { - SelectionFont = Parent.Font; - } - // add the character with its font depending on the char.... - if (!IsControlChar) - { - if (e.KeyChar >= ' ') - { - // B2016-281 if entered keystroke is a character that converted to a symbol (i.e. dash or backslash) - // or if it's a RFT special character (i.e. open and close curly brackets) - // then flag it and replace selected text with a null string (removing selected text) - // and then insert the symbol or RTF escape codes for those characters - bool isSymbolOrRTF = e.KeyChar == '-' || e.KeyChar == '\\' || e.KeyChar == '{' || e.KeyChar == '}'; - LinkLocation ll = FindBetweenLinks(); - if (ll != null && SelectionLength == 0) // SelectionLength = 0 means insert - { - // replacing between links, this is a special case - string strpressed = null; - if (e.KeyChar == '-') - strpressed = GetAddSymbolText(@"\u8209?"); - else if (e.KeyChar == '\\') - strpressed = GetAddSymbolText(@"\u9586?"); - else if (e.KeyChar == '}') - strpressed = @"\}"; - else if (e.KeyChar == '{') - strpressed = @"\{"; - else - strpressed = e.KeyChar.ToString(); - InsertCharBetweenLinks(ll, strpressed); - e.Handled = true; - } - else if (SelectionLength != 0) - { - // B2016-281 if replacing with a dash, backslash, or curly brackets, first replace with nother (to delete selection) - // and set the e.Handled to false so that AddSybol or AddRTF is used to insert that character. - HandleDeleteKeyWithSelectedText(new KeyEventArgs(Keys.None), isSymbolOrRTF ? "" : e.KeyChar.ToString()); - e.Handled = !isSymbolOrRTF; - } - } - if (!e.Handled) - { - if (e.KeyChar == '-') - AddSymbol(@"\u8209?"); - else if (e.KeyChar == '{') - AddRtf(@"\{"); - else if (e.KeyChar == '}') - AddRtf(@"\}"); - else if (e.KeyChar == '\\') - AddSymbol(@"\u9586?"); // unicode hex 2572 - else - return; - e.Handled = true; // flag that it's been handled, otherwise, will get 2 chars. - } - if (e.Handled && SelectionLength != 0) SelectionFont = MyStyleFont.WindowsFont; - } - IsControlChar = false; - } - } - public void RtbSendKeys(string keys) - { - Focus(); - SendKeys.Send(keys); // list of keys https://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send%28v=vs.80%29.aspx - // With .Net Framework 3.0 this can be replaced with EditingCommands http://msdn.microsoft.com/en-us/library/ms771634.aspx - } - public bool PasteRtfAsText(bool PasteNoReturnsSetting) - { - // check if rtf is coming from Word, i.e. if it has 'SCHEMAS.MICROSOFT.COM/OFFICE/WORD'. - // If it is coming from Word, it will be pasted as text so as not to get any rtf commands - // that PROMS does not support such as odd Fonts, other symbols, etc. This isn't a complete - // solution, clipboard data may come from other 3rd-party tools and unsupported Rtf may get - // pasted in. But the hope is that this will happen less often than getting it from MS Word. - IDataObject myDO = Clipboard.GetDataObject(); - if (myDO.GetDataPresent(DataFormats.Text)) return false; - string tmpForLink = myDO.GetData(DataFormats.Rtf).ToString(); - if (tmpForLink.ToUpper().Contains(@"SCHEMAS.MICROSOFT.COM/OFFICE/WORD")) - { - SelectedText = GetPasteText(PasteNoReturnsSetting, myDO); - return true; - } - return false; - } - - //CSM B2023-095/U2022-004 When Copy/Pasting Symbols, some of the symbols paste in an incorrect font - // Changed this to put in the unicode code for any symbols outside the normal ascii range - // if supplied convertunicode flag is true - public string GetPasteText(bool PasteNoReturnsSetting, IDataObject myDO, bool convertunicode = false) - { - // B2021-0039: symbols not pasting correctly from ctrl-v: - // get base list of valid symbols, use base format if MyItemInfo is null. Use symbols from - // the format file versus a list in code - FormatData fmtd = MyItemInfo != null ? MyItemInfo.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData; - SymbolList sl = fmtd.SymbolList; - string[] allowableSymbols = new string[sl.Count]; - for (int i = 0; i < sl.Count; i++) allowableSymbols[i] = string.Format(@"{0}", sl[i].Unicode); - - // allowable symbols are those symbols in the format file that the proms editor supports that - // can be pasted from word as is. - string ptext = (string)myDO.GetData(DataFormats.UnicodeText); - ptext = ptext.TrimEnd("\r\n\t ".ToCharArray()); - if (PasteNoReturnsSetting) ptext = ptext.Replace("\r\n", " "); - - StringBuilder sb = new StringBuilder(); - bool hasBadChar = false; - foreach (char c in ptext) - { - if ((c > 0x7e)) - { - // is this an allowable symbol/character: - if (allowableSymbols.Any(x => x == $@"{(short)c}")) - { - if (convertunicode) - sb.Append($"\\u{(short) c}?"); - else - sb.Append(c); - } - else - { - hasBadChar = true; - sb.Append("?"); - } - } - else - sb.Append(c); - } - ptext = sb.ToString(); - ptext = ptext.Replace("\u2013", "-"); // Replace EN Dash with hyphen - ptext = ptext.Replace("\u2014", "-"); // Replace EM Dash with hyphen - ptext = ptext.Replace("\u2011", "-"); // Replace non-breaking hyphen with hyphen - ptext = ptext.Replace("\u2572", "\\"); // Replace backslash symbol with backslash character - if (hasBadChar) - FlexibleMessageBox.Show("Replacing pasted characters that are not supported by Proms with a '?'."); - return ptext; - } - private void DoDeleteEndBetweenLinks() - { - DebugSelection("Beginning"); - int sstart = SelectionStart; - RtbSendKeys("{RIGHT} "); // open for space between links which separates END/START tokens - SetSelection(sstart, SelectionStart - sstart - 1); // 1 is accounting for typed space - DebugSelection("SetSelection"); - RtbSendKeys("{DELETE}"); // deletes text including link - RtbSendKeys("{RIGHT}{BS}"); // deletes space that was added - } - private void DoDeleteStartBetweenLinks() - { - int slen = SelectionLength; - RtbSendKeys("{LEFT} "); - SetSelection(SelectionStart, slen + 7); - RtbSendKeys("{DELETE}"); - RtbSendKeys("{BS}"); - } - #endregion - #region LinkSelectionAndHandling - public bool IsSelectionLinked(int index, int len) - { - if (_LinkLocations == null)return false; - int sel = index; - int selLength = len; - foreach (LinkLocation ll in _LinkLocations) - { - // When the selector moved to the right of a link, the GOTO button was still lit. - // Removing the "+7" seems to have fixed this. - jsj 1/08/2010 - //if (sel >= ll.Start && sel < ll.Start + ll.Length + 7) return true; - if (sel >= ll.Start && sel < ll.Start + ll.Length) return true; - } - return false; - } - /// - /// For use in Find/Replace. - /// If text is found is part of the link information and not the link value, - /// then we want to continue searching. - /// - /// - /// - /// - public bool SkipLinkInfo(int index, int len) - { - if (_LinkLocations == null)return false; - int sel = index; - int selLength = len; - foreach (LinkLocation ll in _LinkLocations) - { - if (sel >= ll.Start - 7 && sel < ll.Start + ll.Length) - { - int pos = ll.Text.IndexOf("#Link:"); - if (sel < ll.Start || sel >= ll.Start-7+pos) - return (true); - } - } - return false; - } - #endregion - #endregion - #region SelectionStack - Stack _SelectionStack = null; - public Stack SelectionStack - { - get - { - if (_SelectionStack == null) - _SelectionStack = new Stack(); - return _SelectionStack; - } - } - public void PushSelection() - { - SelectionStack.Push(new SelectionData(this)); - } - public void PopSelection() - { - SelectionData selection = SelectionStack.Pop(); - if (SelectionStack.Count == 0) - _SelectionStack = null; - Select(selection.SelectionStart, selection.SelectionLength); - selection = null; - } - public class SelectionData - { - int _SelectionStart; - public int SelectionStart - { - get { return _SelectionStart; } - set { _SelectionStart = value; } - } - int _SelectionLength; - public int SelectionLength - { - get { return _SelectionLength; } - set { _SelectionLength = value; } - } - public SelectionData(RichTextBox richTextBox) - { - _SelectionStart = richTextBox.SelectionStart; - _SelectionLength = richTextBox.SelectionLength; - } - } - #endregion - #region Link Support - int _ProcessingKeys = 0; - - List _LinkLocations; - public List LinkLocations - { - get { return _LinkLocations; } - } - private int _FALLevel = 0; - private bool _IdentifyingLinks = false; - public void FindAllLinks() - { - if (_IdentifyingLinks || _ProcessingDelete) return; - //DebugPrint("FAL{0}vvvvvvvvvvvvvvvvvvvvvvvvv>>", ++_FALLevel); - _AdjustingSelection = true; - PushSelection(); - FindLinks(); - PopSelection(); - LinkLocation llx = FindLinkLocation(); - if (_CheckSelection) - { - if (llx != null) SetSelection(llx.End, 0); - _CheckSelection = false; - } - _AdjustingSelection = false; - if (!_ProcessingDelete) - OnLinkLocationChanged(this, new EventArgs()); - //DebugPrint("FAL{0}^^^^^^^^^^^^^^^^^^^^^^^^^>>", _FALLevel--); - - } - private void FindLinks() - { - string str = Text; - _LinkLocations = new List(); - MatchCollection matches = Regex.Matches(str, @"", RegexOptions.Singleline); - MatchCollection matchesRtf = Regex.Matches(Rtf, "", RegexOptions.Singleline); - LinkLocation thisLink = null; - for (int i = 0; i < matches.Count; i++) //each (Match match in matches) - { - Match match = matches[i]; - Match matchrtf = matchesRtf[i]; - thisLink = new LinkLocation(match.Index + 7, // If the [END> is immediately followed by "); - if (_LinkLocations == null) return null; - foreach (LinkLocation ll in _LinkLocations) - if (ll.Start == start && ll.StartsBetween) - return ll; - return null; - } - private LinkLocation FindLinkLocation() - { - return FindLinkLocation(SelectionStart); - } - private LinkLocation FindLinkLocation(int sel) - { - //DebugPrint("FL----------------Location>"); - if (_LinkLocations == null) return null; - foreach (LinkLocation ll in _LinkLocations) - { - // Moving right: - // if less than, allows stopping between two links - if (ll.Start < sel && ll.End > sel) - { - DebugPrint("Greater Than {0} {1} {2}", sel, ll.Start, ll.End); - return ll; - } - // if less than or equal, does not stop between two links - if ((!ll.StartsBetween) && ll.Start <= sel && ll.End > sel) - { - DebugPrint("Greater Than or Equal {0} {1} {2}", sel, ll.Start, ll.End); - return ll; - } - } - return null; - } - public DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg) - { - DialogResult dlgrslt = DialogResult.Yes; - if (SelectionLength > 0) - { - if (IsSelectionLinked(SelectionStart, SelectionLength)) - { - FlexibleMessageBox.Show(fndrpldlg, "Cannot replace linked text!", "Find/Replace"); - dlgrslt = DialogResult.No; - } - else - { - if (prompt) - dlgrslt = FlexibleMessageBox.Show(fndrpldlg, "Replace This Occurrence?", "Replace Text", MessageBoxButtons.YesNoCancel); - if (dlgrslt == DialogResult.Yes) - SelectedText = rpltxt; - } - } - return dlgrslt; - } - private RichTextBoxFinds _FindOptions = RichTextBoxFinds.None; - public bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse) - { - using (StepRTB savRTF = new StepRTB()) - { - int startpos = SelectionStart + SelectionLength; - savRTF.Text = this.Text; - - _FindOptions = RichTextBoxFinds.None; - if (caseSensitive) - _FindOptions |= RichTextBoxFinds.MatchCase; - if (matchWholeWord) - _FindOptions |= RichTextBoxFinds.WholeWord; - if (reverse) - { - _FindOptions |= RichTextBoxFinds.Reverse; - savRTF.Text = this.Text.Substring(0, SelectionStart); - startpos = savRTF.Text.Length; - if (startpos == 0) - return false; // at beginning of rtfbox during a reverse find - } - else - { - if (startpos >= savRTF.Text.Length) - return false; // at end of rtfbox during a forward find - } - // look for the find string in the temporary rtfbox - // then set the cursor selection in the real rtfbox - bool keepgoing = true; - while (keepgoing) - { - str = str.Replace("\\", "\u2572").Replace("-","\u2011"); - int pos = savRTF.Find(str, startpos, _FindOptions); - keepgoing = false; - if (pos >= 0) - { - if (this.SkipLinkInfo(pos, str.Length)) - { - if (reverse) - { - startpos--; - savRTF.Text = savRTF.Text.Substring(0, startpos); - } - else - startpos++; - if (startpos > 0 && startpos < savRTF.Text.Length) - keepgoing = true; - } - else - { - SelectionStart = pos; - SelectionLength = str.Length; - } - } - else - return false; - } - return true; - } - } - private int FindStart() - { - foreach (LinkLocation ll in _LinkLocations) - { - if (SelectionStart == ll.End) return ll.Start; - if (SelectionStart == ll.Start) - { - if (ll.Start == 7) return 7; - return ll.Start - 8; - } - } - if (SelectionStart > 0) return SelectionStart - 1; - return 0; - } - private int FindEnd() - { - foreach (LinkLocation ll in _LinkLocations) - { - if (SelectionStart + SelectionLength + 7 == ll.Start) return ll.Length + 7; - // this is for in-between links - if (SelectionStart + SelectionLength == ll.Start) return ll.Length; - } - if (SelectionStart + SelectionLength < TextLength) return 1; - return 0; - } - private int FindEndDown() - { - foreach (LinkLocation ll in _LinkLocations) - { - if (SelectionStart + SelectionLength >= ll.Start && SelectionStart + SelectionLength <= ll.End) return ll.End; - } - return 0; - } - // if the selection is on linked text, then return the length of that linked text (the rtf length) - private int FindlinkWidth(bool movingRight, bool ctrlKey) - { - foreach (LinkLocation ll in _LinkLocations) - { - int selLen = SelectionLength + ((movingRight) ? 7 : 0); - if (SelectionStart + selLen >= ll.Start && SelectionStart + selLen - ((!movingRight && ctrlKey)?1:0) <= ll.End) return ll.End - ll.Start + 7; - } - return 0; - } - private int FindStartUp() - { - foreach (LinkLocation ll in _LinkLocations) - { - if ((SelectionStart >= ll.Start) && (SelectionStart <= ll.End)) return ll.Start; - } - return -1; - } - public void SetSelection(LinkLocation ll) - { - SetSelection(ll.Start, ll.Length); - } - public void SetSelection(int locStart, int locLength) - { - //Application.DoEvents(); // Not needed since SendKeys is always done last. - if (_IdentifyingLinks) - DebugPrint("SS------------------------> {0} {1}", locStart, locLength); - else - DebugPrint("SS========================> {0} {1}", locStart, locLength); - Select(locStart, locLength); - } - #endregion - #region EnumsSelectionRange - private enum StartStatus : int - { - Before = 100, - Between = 200, - StartLink = 300, - StartBox = 400 - }; - private enum EndStatus : int - { - After = 1, - Between = 2, - EndLink = 3, - EndBox = 4, - StartLink = 5 - }; - public enum RangeStatus : int - { - NoContainedLinks = 0, - Before_After = StartStatus.Before + EndStatus.After, - Before_Between = StartStatus.Before + EndStatus.Between, - Before_EndLink = StartStatus.Before + EndStatus.EndLink, - Before_EndBox = StartStatus.Before + EndStatus.EndBox, - Before_StartLink = StartStatus.Before + EndStatus.StartLink, - Between_After = StartStatus.Between + EndStatus.After, - Between_Between = StartStatus.Between + EndStatus.Between, - Between_EndLink = StartStatus.Between + EndStatus.EndLink, - Between_EndBox = StartStatus.Between + EndStatus.EndBox, - Between_StartLink = StartStatus.Between + EndStatus.StartLink, - StartLink_After = StartStatus.StartLink + EndStatus.After, - StartLink_Between = StartStatus.StartLink + EndStatus.Between, - StartLink_EndLink = StartStatus.StartLink + EndStatus.EndLink, - StartLink_EndBox = StartStatus.StartLink + EndStatus.EndBox, - StartLink_StartLink = StartStatus.StartLink + EndStatus.StartLink, - StartBox_After = StartStatus.StartBox + EndStatus.After, - StartBox_Between = StartStatus.StartBox + EndStatus.Between, - StartBox_EndLink = StartStatus.StartBox + EndStatus.EndLink, - StartBox_EndBox = StartStatus.StartBox + EndStatus.EndBox, - StartBox_StartLink = StartStatus.StartBox + EndStatus.StartLink - }; - private RangeStatus _RTBRangeStatus; - public RangeStatus RTBRangeStatus - { - get { return _RTBRangeStatus; } - set - { - _RTBRangeStatus = value; - if (!_ProcessingDelete) OnRTBRangeStatusChanged(this, new EventArgs()); - } - } - private LinkLocation _RangeStartLink = null; - private LinkLocation _RangeEndLink = null; - public RangeStatus FindRangeStatus() - { - _RangeStartLink = null; - _RangeEndLink = null; - if (_LinkLocations == null || _LinkLocations.Count == 0) - { - return RTBRangeStatus = RangeStatus.NoContainedLinks; - } - LinkLocation foundLink = null; - int start = SelectionStart; - int end = start + SelectionLength; - - foreach (LinkLocation ll in _LinkLocations) - { - if (foundLink == null && ((ll.Start >= start && ll.Start < end) || (ll.End >= start && ll.End < end))) - foundLink = ll; - if (_RangeStartLink == null && start >= ll.Start - 7 && start < ll.End) - _RangeStartLink = ll; - if (_RangeEndLink == null && end >= ll.Start && end <= ll.End) - _RangeEndLink = ll; - } - DebugPrint("SelectionStart {0}, SelectionEnd {1}, TextLength {2}", - SelectionStart, SelectionStart + SelectionLength, - TextLength); - - if (foundLink == null) - return RTBRangeStatus = RangeStatus.NoContainedLinks; - - StartStatus myStartStatus = StartStatus.Before; - EndStatus myEndStatus = EndStatus.After; - if (_RangeStartLink != null) - { - if (_RangeStartLink.Start == 7) - myStartStatus = StartStatus.StartBox; - else if (_RangeStartLink.StartsBetween) - myStartStatus = StartStatus.Between; - else - myStartStatus = StartStatus.StartLink; - } - if (_RangeEndLink != null) - { - if (_RangeEndLink.End == TextLength) - myEndStatus = EndStatus.EndBox; - else if (_RangeEndLink.NextStart == _RangeEndLink.End) - myEndStatus = EndStatus.Between; - else if (end == _RangeEndLink.Start) - myEndStatus = EndStatus.StartLink; // Should not happen because of code in HandleSelectionChange - else //if (end == endLink.End) - myEndStatus = EndStatus.EndLink; - } - return RTBRangeStatus = (RangeStatus)((int)myStartStatus + (int)myEndStatus); - } - #endregion - #region OutlineTable - private string _CheckRight = "-\u2500\u2011"; - public string CheckRight - { - get { return _CheckRight; } - set { _CheckRight = value; } - } - private string _CheckAbove = "|\u2502\u2514\u252c\u253c\u251c\u250c\u2534\u2510\u2524"; - public string CheckAbove - { - get { return _CheckAbove; } - set { _CheckAbove = value; } - } - private string _CheckLeft = "-\u2500\u2524\u252c\u251c\u253c\u250c\u2510\u2514\u2011"; - public string CheckLeft - { - get { return _CheckLeft; } - set { _CheckLeft = value; } - } - private string _CheckBelow = "|\u2502"; - public string CheckBelow - { - get { return _CheckBelow; } - set { _CheckBelow = value; } - } - // This is a table of graphics characters - // The index into this table (0-15) is a bitmask with each bit representing - // a different direction from the current character. - // Right is Bit 0 (0 or 1) - // Above is Bit 1 (0 or 2) - // Left is Bit 2 (0 or 4) - // Below is Bit 3 (0 or 8) - // The index is contolled in the following way: - // If there is a graphics character to the right, then you add 1 - // If there is a graphics character above, then you add 2 - // If there is a graphics character left, then you add 4 - // If there is a graphics character below, then you add 8 - // The total results in an index into this array and gives the appropriate character - // combining horizontal and vertical lines. - - static private string [] TableCharsU = { - "\x0", // HEX"\x0", // No character - @"\u9472", // HEX@"\u2500",// - Horizontal line - 16-bit char: '\xC4' - @"\u9474", // HEX@"\u2502",// | Vertical line - 16-bit char: '\xB3' - @"\u9492", // HEX@"\u2514",// L Bottom Left corner - 16-bit char: '\xC0' - @"\u9472", // HEX@"\u2500",// - Horizontal line - 16-bit char: '\xC4' - @"\u9472", // HEX@"\u2500",// - Horizontal line - 16-bit char: '\xC4' - @"\u9496", // HEX@"\u2518",// Bottom Right Corner - 16-bit char: '\xD9' - @"\u9524", // HEX@"\u2534",// Bottom Tee - 16-bit char: '\xC1' - @"\u9474", // HEX@"\u2502",// | Vertical Bar - 16-bit char: '\xB3' - @"\u9484", // HEX@"\u250c",// Upper Left corner - 16-bit char: '\xDA' - @"\u9474", // HEX@"\u2502",// | Vertical Bar - 16-bit char: '\xB3' - @"\u9500", // HEX@"\u251c",// Left Tee - 16-bit char: '\xC3' - @"\u9488", // HEX@"\u2510",// Upper Right corner - 16-bit char: '\xBF' - @"\u9516", // HEX@"\u252c",// T Top Tee - 16-bit char: '\xC2' - @"\u9508", // HEX@"\u2524",// Right Tee - 16-bit char: '\xB4' - @"\u9532", // HEX@"\u253c" // + Plus - 16-bit char: '\xC5' - }; - - private int MaxCharacterWidth() - { - // loop through lines and get the width in characters - int w = 0; - foreach (string line in Lines) - { - string cleanLine = RemoveLinkComments(line); - if (w < cleanLine.Length) - w = cleanLine.Length; - } - return w; - } - internal static string RemoveLinkComments(string line) - { - StringBuilder sb = new StringBuilder(); - int lastIndex = 0; - MatchCollection mc = Regex.Matches(line, @"", RegexOptions.Singleline); - foreach (Match m in mc) - { - sb.Append(line.Substring(lastIndex, m.Index - lastIndex)); // Append text before the link - sb.Append(m.Groups[1].Value); // Append the text portion of the link - lastIndex = m.Index + m.Length; // Calculate the beginning of the remaining text - } - sb.Append(line.Substring(lastIndex)); // Append the text following the last link - string result = sb.ToString(); - result = result.Replace(@""); - if (mcEnd.Count > 0) - { - result = result.Substring(0, mcEnd[0].Index) + result.Substring(mcEnd[0].Index + mcEnd[0].Length); - } - return result; - } - private void ReplaceLinesInTable(bool withBorder) - { - int rowWidth = Lines[0].Length; - for (int row=1;row", RegexOptions.Singleline);// this last parameter was commented out in 7/24/09 but it appears to be valid - if (matchCollection.Count == 0) matchCollection = Regex.Matches(line, @""); - Match match = matchCollection.Count > 0 ? matchCollection[0] : null; - int matchOffset = 0; - for (int col = 1; col < rowWidth - 1; col++) - { - if (match != null && match.Index == matchOffset + col) - { - matchOffset += match.Length - match.Groups[1].Length; // Increment the offset by the link comment length - col += match.Groups[1].Length; // increment the column by the link value length - if (col >= rowWidth - 1) break;// Don't continue if beyond the contents - match = match.NextMatch(); // Watch for the next match - } - int coll = matchOffset + col; - char chr = line[coll]; - char chrLast = line[coll - 1]; - char chrNext = line[coll + 1]; - char chrAbove = lineAbove[col]; - char chrBelow = lineBelow[col]; - // The following is all using symbol font (either unicode for proportional or - // VeSymbFix for fixed font): - // if this character is a table line draw character, i.e. a dash or vertical bar, or - // graphics characters for those, look around it to see what table character it is - // replaced with - - // Look for -||-- (last three are graphics chars or unicode dash) - if ("-|\u2500\u2502\u2011".IndexOf(chr) > -1) - { - bool horizontalCharacter = "-\u2500\u2011".IndexOf(chr) > -1; - int lineDrawRight = (CheckRight.IndexOf(chrNext) > -1 || (horizontalCharacter && "\u2502".IndexOf(chrNext) > -1)) ? 1 : 0; - int lineDrawAbove = (CheckAbove.IndexOf(chrAbove) > -1 || (!horizontalCharacter && "\u2500\u2011".IndexOf(chrAbove) > -1)) ? 2 : 0; - int lineDrawLeft = (CheckLeft.IndexOf(chrLast) > -1 || (horizontalCharacter && "\u2502".IndexOf(chrLast) > -1)) ? 4 : 0; - int lineDrawBelow = (CheckBelow.IndexOf(chrBelow) > -1 || (!horizontalCharacter && "-\u2500\u2011".IndexOf(chrBelow) > -1)) ? 8 : 0; - int tableCharIndx = lineDrawRight + lineDrawAbove + lineDrawLeft + lineDrawBelow; - if (tableCharIndx > 0) - { - SetTableChar(row, coll, tableCharIndx); - if (withBorder) // Adjust the border as it intersects with lines within the box - { - if (row == 1 && !horizontalCharacter ) SetTableChar(row - 1, col, 13); // Top Row - if (row == Lines.Length - 2 && !horizontalCharacter) SetTableChar(row + 1, col, 7); // Bottom Row - if (col == 1 && horizontalCharacter && ((tableCharIndx & 4)==4)) SetTableChar(row, col - 1, 11); // First Column - if (col == rowWidth - 2 && horizontalCharacter && ((tableCharIndx & 1) == 1)) SetTableChar(row, coll + 1, 14); // Last Column - } - } - } - } - } - } - private void SetTableChar(int row, int col, int tableCharIndx) - { - int rowOffset = GetFirstCharIndexFromLine(row); - Select(rowOffset + col, 1); - string charToBeReplaced = SelectedText; - if (Text.Length > (rowOffset + col + 7) && Text.Substring(rowOffset + col + 1, 6) != "#Link:") - SelectedRtf = RtfPrefixForSymbols + TableCharsU[tableCharIndx] + "?}"; - else - { - SelectionStart++; - int lenComment = 1 + SelectionStart - (rowOffset + col); - //Console.WriteLine("{0},{1},{2}", rowOffset + col, SelectionStart, SelectionLength); - Select(rowOffset + col, 0); - SelectedRtf = RtfPrefixForSymbols + TableCharsU[tableCharIndx] + "?}"; - Select(rowOffset + col, lenComment); - //Console.WriteLine("'{0}',{1},{2},{3}", SelectedText, lenComment, SelectionLength, SelectionStart); - //Console.WriteLine("'{0}'", SelectedRtf); - SelectedRtf = SelectedRtf.Replace(" " + charToBeReplaced, ""); - } - } - #endregion - #region SpellChecker - private static bool _DoSpellCheck = true; - public static bool DoSpellCheck - { - get { return StepRTB._DoSpellCheck; } - set { StepRTB._DoSpellCheck = value; } - } - // We made the Spell Checker method a static so that all of the StepRTB boxes will share the same instance of the dictionary. - // This allow all the StepRTB's to automatically update when a new word is added. - private static C1.Win.C1SpellChecker.C1SpellChecker _C1SpellChecker2; - - private static C1.Win.C1SpellChecker.C1SpellChecker C1SpellChecker2 - { - get - { - if (_C1SpellChecker2 == null) - { - _C1SpellChecker2 = new C1.Win.C1SpellChecker.C1SpellChecker(); - _C1SpellChecker2.ContextMenuCreated += new C1.Win.C1SpellChecker.ContextMenuEventHandler(_C1SpellChecker2_ContextMenuCreated); - // The veproms.dct file is the main spell checker dictionary. - // We edited the C1 dictionary (C:\Program Files\ComponentOne\Dictionaries\C1Spell_en-US.dct) using ComponentOne's - // dictionary editor (C:\Program Files\ComponentOne\Studio for WinForms\C1SpellChecker\C1DictionaryEditor.exe) - // and added the veproms.words list as another word list in the dictionary. We saved the resulting file as veproms.dct. - string dictpath = string.Format(@"{0}\veproms.dct", Application.StartupPath); - - // Only use the veproms.dct if it is found in the BIN folder. Otherwise, let it default to use the standard dictionary. - if (File.Exists(dictpath)) - _C1SpellChecker2.MainDictionary.FileName = dictpath; // looks in the bin folder by default - - // NOTE: By default, a "Custom.dct" file (UserDictionary) will be created in the BIN folder when a user adds words to the - // spell checker dictionary. The words that the user adds are not placed in the Volian.dct file. - //_C1SpellChecker2.UserDictionary.FileName = @"C:\Development\proms\VEPROMS User Interface\bin\Debug\MYDictionary.dct"; - } - return StepRTB._C1SpellChecker2; - } - } - - - // the grid uses this to reference the same instance of the spell checker - public C1.Win.C1SpellChecker.C1SpellChecker SpellCheckerInstance - { - get { return C1SpellChecker2; } - } - - // Get or Save our context menu - // This is added to the the spell checker's context menu for a mis-spelled word - private static ContextMenuStrip _ThisContextMenuStrip; - public ContextMenuStrip ThisContextMenuStrip - { - get { return _ThisContextMenuStrip; } - set { _ThisContextMenuStrip = value; } - } - - private static StepRTB _ContextMenuStepRTB; - private static object _ContextMenuStrip; - - static void _C1SpellChecker2_ContextMenuCreated(object sender, C1.Win.C1SpellChecker.ContextMenuEventArgs e) - { - // Adjust their bad word context menu - //Console.WriteLine("==========> spell check context menu {0}",e.Menu.Items[0].Text); - if (e.Menu.Equals(_ContextMenuStrip)) - { - // Add an item for our "Edit Menu" context menu on their spell check context menu - // This gives the user access to our regular context menu when on a mis-spelled word - ToolStripItem tsi = e.Menu.Items.Add("Edit Menu"); - tsi.Click += new EventHandler(tsi_Click); - //Now replace their "Spell" item with ours, so that we can display our custom spell check dialog - bool onword = true; - for (int i = 0; i < e.Menu.Items.Count; i++) - { - ToolStripItem tsi1 = e.Menu.Items[i]; - if (tsi1 is ToolStripMenuItem && tsi1.Text == "Spell") - { - e.Menu.Items.RemoveAt(i); // remove their spell check dialog item - ToolStripMenuItem tsi2 = new ToolStripMenuItem("Spell"); - tsi2.Click += new EventHandler(tsi2_Click); - e.Menu.Items.Insert(i, tsi2); // add our spell check dialog item - } - else if (tsi1 is ToolStripMenuItem && tsi1.Text == "Clip Board") // B2017-024 added the Clip Board context menu in FrmSi design - { - e.Menu.Items.RemoveAt(i + 1); // if Clip Board menu item is there, then remove o ur Edit Menu - } - else - { - // B2016-242: check for editorial change on spell check word click. - // Add an event to any context menu items that have a corrected word. - // Note that a line separates corrected words from menu item selections - // and the line does not have any text. So once we hit the line, don't add - // event handler to flag the user selected to use the correction. - if (onword) e.Menu.Items[i].Click += new EventHandler(spellcheckWord_Click); - if (e.Menu.Items[i].Text == null || e.Menu.Items[i].Text == "") onword = false; - } - } - } - } - - static void spellcheckWord_Click(object sender, EventArgs e) - { - ToolStripMenuItem tsmi = sender as ToolStripMenuItem; - if (tsmi != null) - { - // B2016-242: because this is a static method, the format flag for EditorialSpellCheck cannot be checked - // before setting 'DidEditorialSpellCheck'. But the format flag is checked before the 'DidEditorialSpellCheck' - // is actually used in rtbitem. - DidEditorialSpellCheck = true; - } - } - - static void tsi2_Click(object sender, EventArgs e) - { - C1SpellChecker2.CheckControl(_ContextMenuStepRTB, true, MySpellCheckDlg); - } - - // Click event to display our "Edit Menu" (StepRTB context menu) - static void tsi_Click(object sender, EventArgs e) - { - ToolStripMenuItem tsmi = sender as ToolStripMenuItem; - _ContextMenuStepRTB.OnOpenContextMenu(sender, new StepRTBLocationEventArgs(tsmi.Owner.Location)); - } - // This is our customized Spell Check dialog - // This is display when the use clicks the Spell button from the Ribbon - // or when the "Spell" item is selected from the context menu when on a mis-spelled word - static VlnSpellCheckDlg _MySpellCheckDlg; - public static VlnSpellCheckDlg MySpellCheckDlg - { - get - { - if (_MySpellCheckDlg == null) - _MySpellCheckDlg = new VlnSpellCheckDlg(); - return _MySpellCheckDlg; - } - } - - // B2015-024 have Spell Checker text changes be in editorial mode (not assign a change bar but keep existing change bar) - public static bool DidEditorialSpellCheck = false; - - // This is used when walking through the section doing a spell check - // (from the Spell button on the ribbon) - public bool SpellCheckNext() - { - int nBad = C1SpellChecker2.CheckControl(this, false, MySpellCheckDlg); - - // C2015-028 Add Editorial Mode to PROMS Step Editor - // if in Editorial Mode, treat it the same as if the EditorialSpellCheck flag is set in the Format file - bool editorialmode = (this.Parent.Parent.Parent as StepTabPanel).MyDisplayTabControl.IsInEditorialMode; - - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck || editorialmode) - DidEditorialSpellCheck = MySpellCheckDlg.DidCorrectSpelling; // B2015-024 spell checker in editoral mode - return (nBad >= 0); // nBad = -1 means user pressed Cancel button - } - - // This allows us to turn off/on the spell check context menu when we toggle in and out of View Mode. - // see btnToggleEditView_Click() in StepTabRibbon.cs - public void SpellCheckContextMenuOn(bool turnOnMenu) - { - C1SpellChecker2.Options.ShowSuggestionsInContextMenu = turnOnMenu; - } - #endregion - #region - public string DoNewLinkInGridCell() - { - // first find the new link and determine whether it's RO or transition. - int indx = Rtf.IndexOf(@"#Link:ReferencedObject:"); - if (indx > 0) - { - Match mro = Regex.Match(Rtf.Substring(indx, Rtf.Length - indx), @"([A-Za-z]*):(.*?)\[END>"); - string linkstr = mro.Groups[2].Value; - string[] roparts = linkstr.Split(" ".ToCharArray()); - ContentRoUsage rousg = null; - int oldid = -1; - using (Item itm = MyItemInfo.Get()) - { - using (RODb rodb = RODb.GetJustRoDb(Convert.ToInt32(roparts[2]))) - { - rousg = itm.MyContent.ContentRoUsages.Add(roparts[1], rodb); - } - //get temporary rousageid - oldid = rousg.ROUsageID; - Rtf = Rtf.Replace("", string.Format("", rousg.ROUsageID)); - //save temporary rousageid to get real rousageid - itm.Save(); - //replace temprorary rousageid with real rousageid - Rtf = Rtf.Replace(string.Format("", oldid), rousg.ROUsageID.ToString()); - //save real rousageid - itm.Save(); - MyItemInfo.MyContent.RefreshContentRoUsages(); - } - } - // Need to look for any 'New' transitions, don't include existing ones. - Match mt = Regex.Match(Rtf, @"#Link:Transition:([0-9]+) "); - if (mt.Length <= 0) mt = Regex.Match(Rtf, @"#Link:TransitionRange:([0-9]+) "); - if (mt.Length > 0) - { - indx = mt.Index+6; // get past '#Link:" - Match m = Regex.Match(Rtf.Substring(indx, Rtf.Length - indx), @"([A-Za-z]*):(.*?)\[END>"); - bool isSingleTran = true; - if (Rtf.Substring(indx, 16).IndexOf("TransitionRange") >= 0) isSingleTran = false; - string linkstr = m.Groups[2].Value; - string[] tparts = linkstr.Split(" ".ToCharArray()); - int type = System.Convert.ToInt32(tparts[0]); - int tr1 = System.Convert.ToInt32(tparts[2]); // tparts[2] is token for tranid - int tr2 = tr1; - if (tparts.Length > 3) - tr2 = System.Convert.ToInt32(tparts[3]); // tparts[3] is token for rangeid - bool dispose1 = false; - Item itm1 = null; - bool dispose2 = false; - Item itm2 = null; - using (Item itm = MyItemInfo.Get()) - { - if (itm.ItemID == tr1) - itm1 = itm; // a transition that points to itself should not dispose - else - { - dispose1 = true; - itm1 = Item.Get(tr1); - } - if (itm.ItemID == tr2) - itm2 = itm; // a transition that points to itself should not dispose - else if (tr1 == tr2) - itm2 = itm1; // if both destinations are the same only dispose the first one - else - { - dispose2 = true; - itm2 = Item.Get(tr2); - } - ContentTransition ct = itm.MyContent.ContentTransitions.Add(itm1, itm2); - //Console.WriteLine("CT {0},{1},{2},{3}", ct.TransitionID, itm.ItemID, itm.MyContent.MyContentUnique, itm.MyContent.ContentTransitions.Count); - ct.TranType = type; - if (isSingleTran) - ct.IsRange = 0; - else if (tr1 != tr2) - ct.IsRange = 1; - else - ct.IsRange = 2; - - int oldidt = ct.TransitionID; - Rtf = Rtf.Replace("", string.Format("", ct.TransitionID)); - itm.Save(); - Rtf = Rtf.Replace(string.Format("", oldidt), ct.TransitionID.ToString()); - itm.Save(); - MyItemInfo.MyContent.RefreshContentTransitions(); - } - - if (dispose2) itm2.Dispose(); - if (dispose1) itm1.Dispose(); - } - return Rtf; - } - #endregion - #region RoInsertInterface - public void UpdateStepRtb(string linktxt, string valtxt) - { - int ss = SelectionStart; // Remember where the link is being added - int sl = SelectionLength; - OnReturnToEditor(this, new EventArgs()); - Select(ss, sl); - InsertRO(valtxt, linktxt); // Insert the LINK - OnDoSaveContents(this, new EventArgs()); // .SaveText(); // Save the text with the LINK - This also moves the cursor to the end of the text - // By selecting a starting position within a link, StepRTB (HandleSelectionChange) will select the link - Select(ss + 7 + valtxt.Length, 0);// Select the link, Try 7 for " - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (_Disposed) return; - _CountDisposed++; - _Disposed = true; - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - if(!_Finalized) - GC.ReRegisterForFinalize(this); // Make sure that StepRTB is finalized - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // StepRTB - // - this.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.StepRTB_PreviewKeyDown); - this.ResumeLayout(false); - - } - - #endregion - - } -} diff --git a/PROMS/Volian.Controls.Library/StepRTB.resx b/PROMS/Volian.Controls.Library/StepRTB.resx deleted file mode 100644 index 52a9ad3e..00000000 --- a/PROMS/Volian.Controls.Library/StepRTB.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/StepTabPanel.cs b/PROMS/Volian.Controls.Library/StepTabPanel.cs deleted file mode 100644 index a6d501d0..00000000 --- a/PROMS/Volian.Controls.Library/StepTabPanel.cs +++ /dev/null @@ -1,328 +0,0 @@ -using System; -using System.ComponentModel; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using System.Drawing; -using VEPROMS.CSLA.Library; -using Volian.Controls.Library; -using System.Windows.Forms; -using JR.Utils.GUI.Forms; - -namespace Volian.Controls.Library -{ - public partial class StepTabPanel : DevComponents.DotNetBar.PanelDockContainer - { - #region Private Fields - private DisplayTabControl _MyDisplayTabControl; - private StepTabRibbon _MyStepTabRibbon; - public StepTabRibbon MyStepTabRibbon - { - get { return _MyStepTabRibbon; } - set { _MyStepTabRibbon = value; } - } - private StepPanel _MyStepPanel; - private DisplayTabItem _MyDisplayTabItem; - #endregion - #region Properties - /// - /// Container - /// - public DisplayTabControl MyDisplayTabControl - { - get { return _MyDisplayTabControl; } - //set { _MyDisplayTabControl = value; } - } - /// - /// StepPanel contained in this control. - /// - public Volian.Controls.Library.StepPanel MyStepPanel - { - get { return _MyStepPanel; } - //set { _MyStepPanel = value; } - } - /// - /// related DisplayTabItem - /// - public DisplayTabItem MyDisplayTabItem - { - get { return _MyDisplayTabItem; } - set { _MyDisplayTabItem = value; } - } - /// - /// Currently Selected ItemInfo - /// - public ItemInfo SelectedItemInfo - { - get { return _MyStepPanel.SelectedItemInfo; } - set - { - _MyStepPanel.SelectedEditItem = _MyStepPanel.GetEditItem(value); - if (_MyStepPanel.SelectedEditItem == null) - { - 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; - } - if (_MyStepPanel.SelectedEditItem != null) - _MyStepPanel.SelectedEditItem.ItemSelect(); - if (!_MyStepPanel.ItemSelectionChangeShown) _MyStepPanel.OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(_MyStepPanel.SelectedEditItem)); - } - } - /// - /// Currently Selected EditItem - /// - public EditItem SelectedEditItem - { - get { return _MyStepPanel.SelectedEditItem; } - } - /// - /// Procedure ItemInfo - /// - public ItemInfo MyProcedureItemInfo - { - get { return _MyStepPanel.MyProcedureItemInfo; } - set { _MyStepPanel.MyProcedureItemInfo = value; } - } - private String _SearchString; - public String SearchString - { - get { return _SearchString; } - set { _SearchString = value; FindSearchString(); } - } - public void FindSearchString() - { - if (SelectedEditItem == null) return;// Uneditable Data - if (SelectedEditItem.MyItemInfo.IsTable) - { - // if not ro table, just make the mysteprtb active. - GridItem grd = SelectedEditItem as GridItem; - grd.SetSearchCell(SearchString); - } - // convert the '-' to the unicode non-breaking dash (\u8209? or \u2011 hex) - // and the '\' to the unicode backslash sybol (\u9586? or \u2572 hex) - if (!SelectedEditItem.MyStepRTB.IsRoTable) - SelectedEditItem.MyStepRTB.Find(SearchString.Replace('-', '\u2011').Replace('\\','\u2572')); - } - #endregion - #region Contructors - public StepTabPanel(DisplayTabControl myDisplayTabControl) - { - _MyDisplayTabControl = myDisplayTabControl; - InitializeComponent(); - SetupStepTabPanel(); - SetupStepPanel(); - SetupStepTabRibbon(); - } - #endregion - #region Private Methods - Setup - /// - /// Setup StepTabRibbon - /// - private void SetupStepTabRibbon() - { - _MyStepTabRibbon = new StepTabRibbon(_MyDisplayTabControl.IsInEditorialMode); - _MyStepTabRibbon.Dock = System.Windows.Forms.DockStyle.Top; - _MyStepTabRibbon.Location = new System.Drawing.Point(0, 0); - _MyStepTabRibbon.Name = "displayTabRibbon1"; - //_MyTabRibbon.MyDisplayRTB = null; - _MyStepTabRibbon.MyEditItem = null; - this.Controls.Add(_MyStepTabRibbon); - _MyStepTabRibbon.Expanded = _MyDisplayTabControl.RibbonExpanded; - } - /// - /// Setup this within control - /// - private void SetupStepTabPanel() - { - Dock = System.Windows.Forms.DockStyle.Fill; - this.Enter += new EventHandler(StepTabPanel_Enter); - } - /// - /// Setup StepPanel - /// - 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); - this.Controls.Add(_MyStepPanel); - // - // _MyPanel - // - _MyStepPanel.AutoScroll = true; - _MyStepPanel.Dock = System.Windows.Forms.DockStyle.Fill; - _MyStepPanel.LinkClicked +=new Volian.Controls.Library.StepPanelLinkEvent(_MyStepPanel_LinkClicked); - _MyStepPanel.LinkActiveChanged += new Volian.Controls.Library.StepPanelLinkEvent(_MyStepPanel_LinkActiveChanged); - _MyStepPanel.LinkInsertTran += new StepPanelLinkEvent(_MyStepPanel_LinkInsertTran); - _MyStepPanel.LinkInsertRO += new StepPanelLinkEvent(_MyStepPanel_LinkInsertRO); - _MyStepPanel.LinkModifyTran += new StepPanelLinkEvent(_MyStepPanel_LinkModifyTran); - _MyStepPanel.LinkModifyRO += new StepPanelLinkEvent(_MyStepPanel_LinkModifyRO); - _MyStepPanel.ItemClick +=new Volian.Controls.Library.StepPanelEvent(_MyStepPanel_ItemClick); - _MyStepPanel.AttachmentClicked += new Volian.Controls.Library.StepPanelAttachmentEvent(_MyStepPanel_AttachmentClicked); - _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.WordSectionClose += new StepPanelWordSectionCloseEvent(_MyStepPanel_WordSectionClose); - _MyStepPanel.WordSectionDeleted += new StepPanelWordSectionDeletedEvent(_MyStepPanel_WordSectionDeleted); - _MyStepPanel.ItemPasted += new StepPanelItemPastedEvent(_MyStepPanel_ItemPasted); - } - - - #endregion - #region Event Handlers - private bool _ShowingItem = false; - public bool ShowingItem - { - get { return _ShowingItem; } - set { _ShowingItem = value; } - } - /// - /// Occurs when the user clicks on a StepTabPanel - /// - /// - /// - private void StepTabPanel_Enter(object sender, EventArgs e) - { - 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): - if (MyDisplayTabControl.MyAnnotationDetails.AnnotationDirty) MyDisplayTabControl.MyAnnotationDetails.SaveAnnotation(); - _ShowingItem = true; - //if (ItemSelected != null) - _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 - _MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetUpdRoValBtn(_MyStepPanel.MyStepTabPanel.MyStepTabRibbon.NewerRoFst()); - _ShowingItem = false; - _MyDisplayTabControl.SelectedDisplayTabItem = MyDisplayTabItem; - } - /// - /// Occurs when the cursor moves onto or off of a link - /// - /// - /// - void _MyStepPanel_LinkActiveChanged(object sender, StepPanelLinkEventArgs args) - { - _MyDisplayTabControl.OnLinkActiveChanged(sender, args); - } - /// - /// Occurs when the user chooses to add a transition - /// - /// - /// - void _MyStepPanel_LinkInsertTran(object sender, StepPanelLinkEventArgs args) - { - _MyDisplayTabControl.OnLinkInsertTran(sender, args); - } - /// - /// Occurs when the user chooses to add an RO - /// - /// - /// - void _MyStepPanel_LinkInsertRO(object sender, StepPanelLinkEventArgs args) - { - _MyDisplayTabControl.OnLinkInsertRO(sender, args); - } - /// - /// Occurs when the user chosses to modify a transition - /// - /// - /// - void _MyStepPanel_LinkModifyTran(object sender, StepPanelLinkEventArgs args) - { - _MyDisplayTabControl.OnLinkModifyTran(sender, args); - } - /// - /// Occurs when the user chooses to Modify an RO - /// - /// - /// - void _MyStepPanel_LinkModifyRO(object sender, StepPanelLinkEventArgs args) - { - _MyDisplayTabControl.OnLinkModifyRO(sender, args); - } - /// - /// Occurs when the Selected Item changes - /// - /// - /// - void _MyStepPanel_ItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args) - { - _MyStepTabRibbon.MyEditItem = args.MyEditItem; - _MyDisplayTabControl.OnItemSelectedChanged(sender, args); - } - // Occurs when the Mode Changes - //void _MyStepPanel_ModeChange(object sender, StepRTBModeChangeEventArgs args) - //{ - // _MyDisplayTabControl.OnModeChange(sender, args); - //} - - /// - /// Occurs when the user clicks on the Attachment Expander - /// - /// - /// - private ItemInfo curDSOItem = null; - void _MyStepPanel_AttachmentClicked(object sender, StepPanelAttachmentEventArgs args) - { - if (curDSOItem != null) return; - curDSOItem = args.MyEditItem.MyItemInfo; - _MyDisplayTabControl.OpenItem(args.MyEditItem.MyItemInfo); - curDSOItem = null; - } - /// - /// Occurs when the user clicks on the tab next to an item - /// - /// - /// - void _MyStepPanel_ItemClick(object sender, StepPanelEventArgs args) - { - _MyDisplayTabControl.OnItemClick(sender, args); - } - /// - /// Occurs when the user clicks on an item - /// - /// - /// - void _MyStepPanel_LinkClicked(object sender, StepPanelLinkEventArgs args) - { - if (args.MyLinkText.LinkInfoText.IndexOf("Transition") > -1) - { - // B2018-002 - Invalid Transitions - Don't fail on invalid transition - if (args.MyLinkText.MyTransitionInfo == null) - { - FlexibleMessageBox.Show("This transition is invalid\r\n\r\nDelete it and replace it with \r\na valid transition", "Invalid Transition", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; // Not a valid transition - } - ItemInfo item = args.MyLinkText.MyTranToItemInfo; - if (item == null || item.MyDocVersion == null || (item.PreviousID == null && item.ItemPartCount == 0 && item.ItemDocVersionCount == 0)) - { - FlexibleMessageBox.Show("This transition is invalid", "Invalid Transition", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; // Not a valid transition - } - _MyDisplayTabControl.OpenItem(item); - } - else - Console.WriteLine("Bring Up roeditor"); //TODO: Need to bring up roeditor or infopanel - } - void _MyStepPanel_TabDisplay(object sender, StepPanelTabDisplayEventArgs args) - { - _MyDisplayTabControl.OnPanelTabDisplay(sender, args); - } - void _MyStepPanel_WordSectionClose(object sender, WordSectionEventArgs args) - { - _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); - } - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/StepTabPanel.designer.cs b/PROMS/Volian.Controls.Library/StepTabPanel.designer.cs deleted file mode 100644 index 682995a0..00000000 --- a/PROMS/Volian.Controls.Library/StepTabPanel.designer.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class StepTabPanel - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - // when a StepTabPanel is Disposed, if it was associated with the SelectedDisplayTabItem, set the SelectedDisplayTabItem to null - // this was causing an error where a deleted Procedure was being referenced, since it was the last SelectedDisplayTabItem - if (MyDisplayTabControl.SelectedDisplayTabItem != null && MyDisplayTabControl.SelectedDisplayTabItem.MyStepTabPanel == this) - MyDisplayTabControl.SelectedDisplayTabItem = null; - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/StepTabPanel.resx b/PROMS/Volian.Controls.Library/StepTabPanel.resx deleted file mode 100644 index 52a9ad3e..00000000 --- a/PROMS/Volian.Controls.Library/StepTabPanel.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs deleted file mode 100644 index 7baebb44..00000000 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ /dev/null @@ -1,5021 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Drawing.Text; -using System.Data; -using System.Text; -using System.Windows.Forms; -using System.IO; -using System.Text.RegularExpressions; -using VEPROMS.CSLA.Library; -using Accentra.Controls; -using Volian.Base.Library; -using DevComponents.DotNetBar; -using Microsoft.Win32; -using System.Diagnostics; -using JR.Utils.GUI.Forms; -using System.Collections.Concurrent; -using System.Threading.Tasks; - -namespace Volian.Controls.Library -{ - public delegate void CellRangeApplyStyle(); - - public partial class StepTabRibbon : UserControl - { - private static string _SpecifiedVisioPath = null; - public static string SpecifiedVisioPath - { - get { return StepTabRibbon._SpecifiedVisioPath; } - set { StepTabRibbon._SpecifiedVisioPath = value; } - } - private static bool _PastePlainTextSetting = false; - public static bool PastePlainTextSetting - { - get { return _PastePlainTextSetting; } - set { _PastePlainTextSetting = value; } - } - private static bool _PasteNoReturnsSetting = false; - public static bool PasteNoReturnsSetting - { - get { return _PasteNoReturnsSetting; } - set { _PasteNoReturnsSetting = value; } - } - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #region Properties - private bool EnableROEdit; - private VlnFlexGrid MyFlexGrid - { - get - { - if (MyEditItem is GridItem) return (MyEditItem as GridItem).MyFlexGrid; - return null; - } - } - private EditItem _MyEditItem; - public EditItem MyEditItem - { - get { return _MyEditItem; } - set - { - if (_MyEditItem == value) return; // Don't do this if the value is not different - _MyEditItem = value; - SetBtnInsSupInfoVisible(); - ToggleTableFontSize(value is GridItem); - - if (value != null) - { - (this.Parent as StepTabPanel).MyDisplayTabItem.SetupSecurity(MyItemInfo); - MyStepRTB = value.MyStepRTB; - if (btnInsSupInfo.Visible && btnInsSupInfo.Enabled) btnInsSupInfo.Tag = string.Format("{0} {1}", (int)E_FromTypes.SupInfos, 1040); // use 1040 to flag RNO (40) and special case handling (1000) - if (value is GridItem) - { - ToggleTableDesignButtons(true); - MyFlexGrid_SelChange(this, new EventArgs()); - } - - } - else - MyStepRTB = null; - //if (rtabChgId.Visible) - // txtBxChgId.Text = (this.Parent as StepTabPanel).MyDisplayTabControl.ChgId; - - } - } - public void SetChangeId(string chgid, ItemInfo ii) - { - txtBxChgId.Text = chgid; - rtabChgId.Visible = (ii != null) ? ii.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds : false; - } - // added jcb 20121221 to support set ro from word doc - private ROFSTLookup MyLookup; - private DocVersionInfo _Mydvi; - public DocVersionInfo Mydvi - { - get - { - if (_Mydvi != null) return _Mydvi; - if (_MyEditItem != null) - { - ItemInfo procInfo = _MyEditItem.MyItemInfo.MyProcedure as ItemInfo; - if (procInfo == null) return null; - _Mydvi = procInfo.ActiveParent as DocVersionInfo; - // added jcb 20121221 to support set ro from word doc - if (_Mydvi.DocVersionAssociations != null && _Mydvi.DocVersionAssociations.Count > 0) - MyLookup = _Mydvi.DocVersionAssociations[0].MyROFst.GetROFSTLookup(_Mydvi); - else - MyLookup = null; - return _Mydvi; - } - return null; - } - } - private ItemInfo MyItemInfo - { - get - { - if(_MyStepRTB != null && _MyStepRTB.MyItemInfo != null) return _MyStepRTB.MyItemInfo; - if(_MyEditItem != null && _MyEditItem.MyItemInfo != null) return _MyEditItem.MyItemInfo; - return null; - } - } - private static UserInfo _MyUserInfo = null; - - public static UserInfo MyUserInfo - { - get { return _MyUserInfo; } - set { _MyUserInfo = value; } - } - private static SessionInfo _MySessionInfo; - public static SessionInfo MySessionInfo - { - get { return _MySessionInfo; } - set { _MySessionInfo = value; } - } - private DevComponents.DotNetBar.ButtonItem _DefaultContextMenu; - - public void ClearContextMenu() - { - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, null); - } - - #region Save ROs from Word Document jcb 20121221 - private string MyLookupData; - private Dictionary MyAvailableROs; - public void SetContextMenu(object sender) - { - AddEnhancedDocumentMenu(btnCMRtfEdit, sender); - AddWROContext(btnCMRtfEdit); - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit); - } - public void SetContextMenuImage(ImageItem imgItem) - { - btnCMCut.Enabled = false; - btnCMCopy.Enabled = false; - btnCMPaste.Enabled = false; - btnCMPasteText.Enabled = false; - btnCMRO.Enabled = false; - bool isInBuff = false; - try // image in clipboard - for 'paste' - { - System.Drawing.Image img = Clipboard.GetImage(); - isInBuff = img != null; - } - catch (Exception ex) - { - isInBuff = false; - } - btnCMPasteImage.Enabled = isInBuff; - btnCMEditMode1.Enabled = false; //View mode (irrelevant for images) - btnCMGoTo.Enabled = MyItemInfo!=null && MyItemInfo.MyContent != null && MyItemInfo.MyContent.ContentRoUsageCount > 0; - // B2016-237 added context menu item to change image size - // B2017-124 - added a check for null references - btnCMImgSz.Enabled = MyEditItem != null && MyEditItem.MyItemInfo != null && MyEditItem.MyItemInfo.IsFigure && (MyEditItem.MyItemInfo.MyContent.MyImage != null || MyEditItem.MyItemInfo.MyContent.Text.ToUpper().Contains("#LINK")); - _ContextMenuBar.SetContextMenuEx(imgItem, btnCMRtfEdit); - } - private void AddEnhancedDocumentMenu(DevComponents.DotNetBar.ButtonItem myButtonItem, object sender) - { - DVEnhancedDocuments dveds = MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments; - if (dveds == null || dveds.Count == 0) return; // No enhanced! - - // for all enhanced documents, create the list of buttons as they should be for items in the docversion - // using the list of enhanced documents that are on the docversion. Note that later, some may be - // made invisible or menu text changed. - // first, get correct number of enhanced buttons. This is needed in case the selected item doesn't - // have links to enhanced, but should. - List existingEnhancedButtons = new List(); - foreach (DevComponents.DotNetBar.ButtonItem bi in myButtonItem.SubItems) - if (bi.Name.StartsWith("btnEnhanced")) - existingEnhancedButtons.Add(bi.Name); - bool inSource = dveds[0].Type != 0; - int buttonsNeeded = inSource ? dveds.Count : (dveds.Count * 2); // enhanced items need unlink button also. - // if in view only mode, don't do unlink - if (!inSource && MyEditItem != null && MyEditItem.MyStepPanel.VwMode == E_ViewMode.View) buttonsNeeded--; - if (MyItemInfo.IsSection && !MyItemInfo.IsStepSection) buttonsNeeded = 0; // no buttons for word sections - if (buttonsNeeded > existingEnhancedButtons.Count) // add buttons - { - // may need to change the following to add more buttons if a new working draft level was made - foreach (DVEnhancedDocument dved in dveds) - { - string buttonName = string.Format("btnEnhancedTo{0}", dved.Type); - DevComponents.DotNetBar.ButtonItem biEnhanced = new DevComponents.DotNetBar.ButtonItem(buttonName, "Go To " + dved.Name + " Document"); - biEnhanced.Click += btnEnhancedGoTo_Click; - myButtonItem.SubItems.Add(biEnhanced); - existingEnhancedButtons.Add(biEnhanced.Name); - // if in view only mode, don't do unlink - if (!inSource && MyEditItem != null && MyEditItem.MyStepPanel.VwMode != E_ViewMode.View) - { - // add unlink buttons: - buttonName = string.Format("btnEnhancedUnlink{0}", dved.Type); - biEnhanced = new DevComponents.DotNetBar.ButtonItem(buttonName, "Unlink " + dved.Name + " Document"); - biEnhanced.Click += btnEnhancedGoTo_Click; - biEnhanced.BeginGroup = true; // C2019=003: add separator between go to & unlink - myButtonItem.SubItems.Add(biEnhanced); - existingEnhancedButtons.Add(biEnhanced.Name); - } - } - } - - // Now handle specific cases for the Item that user is positioned on. - // If a link exists, the menu item should be 'go to' and 'Unlink' if on an enhanced item. - // If link doesn't exist - // if in source & on procedure, section, high, note or caution, the menu item should be 'create missing' - // else the menu item should be made invisible. - StepRTB myStepRTB = sender as StepRTB ?? _MyStepRTB; - EnhancedDocuments eds = myStepRTB.MyItemInfo.GetMyEnhancedDocuments(); - foreach (string btnenh in existingEnhancedButtons) - { - DevComponents.DotNetBar.ButtonItem biEnhanced = myButtonItem.SubItems[btnenh] as DevComponents.DotNetBar.ButtonItem; - int edtypebtn = System.Convert.ToInt32(biEnhanced.Name.Substring(biEnhanced.Name.Length - 1)); - bool itemHasLink = false; - if (myStepRTB.MyItemInfo.MyContent.Text == "") // empty text represents a newly inserted step - don't do any enhanced buttons until saved (moved off) - biEnhanced.Visible = false; - else - { - foreach (EnhancedDocument ed in eds) - { - if (edtypebtn == ed.Type) // this button is for this document: - { - if (biEnhanced.Name.StartsWith("btnEnhancedTo")) - { - biEnhanced.Visible = true; - biEnhanced.Text = "Go To " + dveds.GetByType(ed.Type).Name + " Document"; - biEnhanced.Tag = ed.ItemID; - itemHasLink = true; - break; - } - else // this is for 'unlink' - { - biEnhanced.Visible = true; - biEnhanced.Tag = ed.ItemID; - itemHasLink = true; - break; - - } - } - } - // if there is no link & item is in the 'source document', allow the user to create missing - // enhanced items - if (!itemHasLink && inSource) - { - // need to handle procedures, sections and steps differently: - if (MyItemInfo.IsProcedure) - { - biEnhanced.Visible = true; - biEnhanced.Text = string.Format("Create Missing Enhanced {0} Document Procedure", dveds.GetByType(edtypebtn).Name); - biEnhanced.Tag = MyItemInfo.ItemID; - } - else if (MyItemInfo.IsSection) - { - // verify that procedure has enhanced procedure for this type - EnhancedDocuments peds = MyItemInfo.MyProcedure.GetMyEnhancedDocuments(); - bool didMenuItem = false; - foreach (EnhancedDocument ped in peds) - { - if (edtypebtn == ped.Type && MyItemInfo.IsStepSection) // this button is for this document: - { - biEnhanced.Visible = true; - biEnhanced.Text = string.Format("Create Missing Enhanced {0} Document Section", dveds.GetByType(edtypebtn).Name); - biEnhanced.Tag = MyItemInfo.ItemID; - didMenuItem = true; - break; - } - } - if (!didMenuItem) biEnhanced.Visible = false; - } - else if (MyItemInfo.IsHigh || MyItemInfo.IsCaution || MyItemInfo.IsNote) - { - // for HLS there could be multiple level of sections, so need to walk up tree until a procedure to see if one exists on section/subsections. - ItemInfo sect = MyItemInfo.ActiveSection; - bool didMenuItem = false; - while (!didMenuItem && sect.IsSection) - { - EnhancedDocuments seds = sect.GetMyEnhancedDocuments(); - foreach (EnhancedDocument sed in seds) - { - if (sed.Type == edtypebtn) - { - // B2018-111: In the following line of code, added that if item is caution/note its parent must be a high level step. - if (MyItemInfo.IsHigh || ((MyItemInfo.IsCaution || MyItemInfo.IsNote) && MyItemInfo.MyParent.IsHigh && MyItemInfo.MyHLS.GetMyEnhancedDocuments().Count > 0)) - { - biEnhanced.Visible = true; - biEnhanced.Text = string.Format("Create Missing Enhanced {0} Document Step", dveds.GetByType(edtypebtn).Name); - biEnhanced.Tag = MyItemInfo.ItemID; - didMenuItem = true; - break; - } - } - } - sect = sect.MyParent; - } - if (!didMenuItem) biEnhanced.Visible = false; - } - else - biEnhanced.Visible = false; - } - else if (!itemHasLink && !inSource) - biEnhanced.Visible = false; - } - } - #endregion - } - public ItemInfo enhUseExist = null; - public bool enhDoConv = false; - void btnEnhancedGoTo_Click(object sender, EventArgs e) - { - DevComponents.DotNetBar.BaseItem btn = sender as DevComponents.DotNetBar.BaseItem; - ItemInfo ii = ItemInfo.Get(int.Parse(btn.Tag.ToString())); - if (ii == null || ii.ItemID != MyItemInfo.ItemID) //B2018-116 null reference check - allow user to unlink a background step that has invalid ItemId - { - // if button name starts with btnEnhancedTo... open it, otherwise, unlink: - if (btn.Name.StartsWith("btnEnhancedTo")) - { - MyEditItem.SaveContents(); - if(ii!=null) // B2018-142 to allow for the deletion of an un-linked background procedure - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(ii); - } - else if (btn.Name.Contains("Unlink")) - { - // C2019=003: add a confirmation dialog before unlinking a step: - // B2024 - 075: Change made to pass in an EditTem instead of a ItemInfo - //so can refresh the UI - if (FlexibleMessageBox.Show(this, "Do you want to unlink this step?", "Confirm Enhanced Step Unlink", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) - MyEditItem.UnlinkEnhanced(MyEditItem); - } - } - else - { - // have to create it. This will bring up a dialog to either create a new step or - // link to an existing step: - enhUseExist = null; - int enhtype = System.Convert.ToInt32(btn.Name.Replace("btnEnhancedTo", "")); - dlgEnhMissingItem enhMissDlg = new dlgEnhMissingItem(this, ii, enhtype); - DialogResult dr = enhMissDlg.ShowDialog(this.Parent); - if (enhMissDlg.OKSelected || dr == DialogResult.OK) - { - if (enhUseExist == null) - { - ItemInfo newEnh = MyEditItem.AddMissingEnhancedStep(ii, enhtype); - if (ii.IsProcedure && newEnh != null) OnAddProcToDVInTree(new StepTabRibbonEventArgs(newEnh)); - } - else if (!enhDoConv) - MyEditItem.CreateLinksEnhancedSingleItem(ii, enhUseExist, enhtype); - else - MyEditItem.CreateLinksEnhancedAllInProcedure(ii, enhUseExist, enhtype); - MyEditItem.SetFocus(); - } - } - } - - #region set up save ro menu jcb 20121221 - private void AddWROContext(DevComponents.DotNetBar.ButtonItem myButtonItem) - { - MyAvailableROs = new Dictionary(); - DevComponents.DotNetBar.BaseItem btnSaveRO = null; - if (!myButtonItem.SubItems.Contains("btnSaveRO")) - { - btnSaveRO = new DevComponents.DotNetBar.ButtonItem("btnSaveRO", "Save RO"); - btnSaveRO.Visible = false; - myButtonItem.SubItems.Add(btnSaveRO); - } - else - btnSaveRO = myButtonItem.SubItems["btnSaveRO"]; - if (Clipboard.ContainsData(System.Windows.Forms.DataFormats.Text)) - { - MyLookupData = Clipboard.GetData(System.Windows.Forms.DataFormats.Text).ToString(); - if (MyLookupData.StartsWith(" 0 && MyStepRTB.SelectedText.ToLower() != MyAvailableROs[k].ToLower()) - { - btn = new DevComponents.DotNetBar.ButtonItem("_" + k, MyAvailableROs[k] + " with Annotation"); - btn.Tag = MyAvailableROs[k]; - btn.Click += new EventHandler(SaveROWithAnnotation_Click); - btnSaveRO.SubItems.Add(btn); - } - } - btnSaveRO.Visible = true; - } - else - { - btnSaveRO.SubItems.Clear(); - btnSaveRO.Text = "No RO Found"; - DevComponents.DotNetBar.BaseItem btn = new DevComponents.DotNetBar.ButtonItem("btnRONotFound", "Create Annotation"); - btn.Tag = string.Format("Text '{0}' has no corresponding RO", MyStepRTB.SelectedText); - btn.Click += new EventHandler(NoROFound_Click); - btnSaveRO.SubItems.Add(btn); - btnSaveRO.Visible = true; - } - } - } - } - #endregion - private bool IsValidRO(string data) - { - bool rv = false; - MyAvailableROs = new Dictionary(); - if (Mydvi != null) - { - #region force arp without hi or lo jcb 20121221 - //if (data == "") - //{ - // data = data.Replace("-LO1", ""); - // Console.WriteLine("force null roc"); - //} - #endregion - string accPageID = GetAccPageID(data); - ROFSTLookup.rochild? roc = MyLookup.GetROChildByAccPageID(accPageID, Mydvi.DocVersionConfig.RODefaults_setpointprefix, Mydvi.DocVersionConfig.RODefaults_graphicsprefix); - - if (roc != null) - { - int index = GetROValueIndex(data); - if (index > -1) - { - MyAvailableROs.Add(((ROFSTLookup.rochild)roc).children[index].roid, ((ROFSTLookup.rochild)roc).children[index].value.Replace(@"\u160?", " ")); - if (accPageID.StartsWith("MEL") && index == 0) // If equipment and 1st return value, then add option to add 4th Return Value - { - MyAvailableROs.Add(((ROFSTLookup.rochild)roc).children[3].roid, ((ROFSTLookup.rochild)roc).children[3].value.Replace(@"\u160?", " ")); - MyAvailableROs.Add(((ROFSTLookup.rochild)roc).children[4].roid, ((ROFSTLookup.rochild)roc).children[4].value.Replace(@"\u160?", " ")); - } - rv = true; - } - } - else - { - //see if arp then try HI 1,2,3 and LO 1,2,3 - if (accPageID.StartsWith("ARP")) - { - string tmpAccPageID = string.Empty; - //try HI1,2,3 - string suffix = "-HI"; - for (int i = 1; i < 4; i++) - { - tmpAccPageID = accPageID + suffix + i.ToString(); - roc = MyLookup.GetROChildByAccPageID(tmpAccPageID, Mydvi.DocVersionConfig.RODefaults_setpointprefix, Mydvi.DocVersionConfig.RODefaults_graphicsprefix); - if (roc != null) - { - int index = GetROValueIndex(data); - if (index > -1) - { - MyAvailableROs.Add(((ROFSTLookup.rochild)roc).children[index].roid, ((ROFSTLookup.rochild)roc).children[index].value.Replace(@"\u160?", " ")); - rv = true; - } - } - } - - //try LO1,2,3 - suffix = "-LO"; - for (int i = 1; i < 4; i++) - { - tmpAccPageID = accPageID + suffix + i.ToString(); - roc = MyLookup.GetROChildByAccPageID(tmpAccPageID, Mydvi.DocVersionConfig.RODefaults_setpointprefix, Mydvi.DocVersionConfig.RODefaults_graphicsprefix); - if (roc != null) - { - int index = GetROValueIndex(data); - if (index > -1) - { - MyAvailableROs.Add(((ROFSTLookup.rochild)roc).children[index].roid, ((ROFSTLookup.rochild)roc).children[index].value.Replace(@"\u160?", " ")); - rv = true; - } - } - } - } - } - } - return rv; - } - - private string GetAccPageID(string txt) - { - // - // - // - txt = txt.Replace(" 0) - rv = 0; - else if (data.IndexOf(@"\s") > 0) - rv = 1; - else if (data.IndexOf(@"\t") > 0) - rv = 2; - else if (data.IndexOf(@"\d") > 0) - rv = 3; - else - rv = -1; - } - else if (data.StartsWith(" 0) - rv = 0; - else if (data.IndexOf(@"\d") > 0) - rv = 1; - else if (data.IndexOf(@"\r") > 0) - rv = 2; - else - rv = -1; - } - else if (data.StartsWith(" 0) - rv = 0; - else if (data.IndexOf(@"\d") > 0) - rv = 1; - else if (data.IndexOf(@"\n") > 0) - rv = 2; - else - rv = -1; - } - - return rv; - } - - private void SaveRO_Click(object sender, EventArgs e) - { - DevComponents.DotNetBar.BaseItem btn = sender as DevComponents.DotNetBar.BaseItem; - string myroid = btn.Name; - string myvalue = btn.Tag.ToString(); - // the roid may be 12 or 16 chars long, with the last 4 set if there is unit specific - // menuing. Pad to 12 to store in the rousage table. - string padroid = (myroid.Length <= 12) ? myroid + "0000" : myroid; - string linktxt = string.Format(@"#Link:ReferencedObject: {0} {1}", padroid, MyLookup.MyDocVersionInfo.DocVersionAssociations[0].MyROFst.MyRODb.RODbID); - // Resolve symbols and scientific notation in the RO return value - string valtxt = MyLookup.GetTranslatedRoValue(padroid, MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, - false, MyStepRTB.MyItemInfo); //ConvertSymbolsAndStuff(selectedChld.value); - MyStepRTB.OnRoInsert(this, new StepRTBRoEventArgs(valtxt, myvalue, linktxt, padroid, MyLookup.MyDocVersionInfo.DocVersionAssociations[0].MyROFst.MyRODb.RODbID)); - } - private void SaveROWithAnnotation_Click(object sender, EventArgs e) - { - DevComponents.DotNetBar.BaseItem btn = sender as DevComponents.DotNetBar.BaseItem; - string myroid = btn.Name.Replace("_", ""); - string myvalue = btn.Tag.ToString(); - using (Item itm = MyStepRTB.MyItemInfo.Get()) - { - Annotation x = Annotation.MakeAnnotation(itm, AnnotationType.GetByName("RO Value Changed"), null, string.Format("RO Value '{0}' replaces text '{1}'", myvalue, MyStepRTB.SelectedText), null); - } - // the roid may be 12 or 16 chars long, with the last 4 set if there is unit specific - // menuing. Pad to 12 to store in the rousage table. - string padroid = (myroid.Length <= 12) ? myroid + "0000" : myroid; - string linktxt = string.Format(@"#Link:ReferencedObject: {0} {1}", padroid, MyLookup.MyDocVersionInfo.DocVersionAssociations[0].MyROFst.MyRODb.RODbID); - // Resolve symbols and scientific notation in the RO return value - string valtxt = MyLookup.GetTranslatedRoValue(padroid, MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, false, MyStepRTB.MyItemInfo); //ConvertSymbolsAndStuff(selectedChld.value); - MyStepRTB.OnRoInsert(this, new StepRTBRoEventArgs(valtxt, myvalue, linktxt, padroid, MyLookup.MyDocVersionInfo.DocVersionAssociations[0].MyROFst.MyRODb.RODbID)); - } - private void NoROFound_Click(object sender, EventArgs e) - { - DevComponents.DotNetBar.BaseItem btn = sender as DevComponents.DotNetBar.BaseItem; - string myvalue = btn.Tag.ToString(); - using (Item itm = MyStepRTB.MyItemInfo.Get()) - { - Annotation x = Annotation.MakeAnnotation(itm, AnnotationType.GetByName("RO Missing"), null, myvalue, null); - } - } - #endregion - - public void SetGridCellContextMenu() - { - AddWROContext(btnCMRtfCellEdit); - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfCellEdit); - } - public void SetGridContextMenu() - { - if (rtabTableGridTools.Visible) - _ContextMenuBar.SetContextMenuEx(MyFlexGrid, btnCMGrid); - } - public void OpenContextMenu(Point loc, object sender) - { - if (rtabTableGridTools != null && !rtabTableGridTools.Visible) - { - AddEnhancedDocumentMenu(btnCMRtfEdit, sender); - btnCMRtfEdit.Popup(loc); - } - else // in a table cell, use the table cell's context menu: - btnCMRtfCellEdit.Popup(loc); - } - private int _MyLastFormatID = -1; - private StepRTB _MyStepRTB; - private static int _OringFlg; - public static int OringFlg - { - get { return _OringFlg; } - set - { - _OringFlg = value; - } - } - public StepRTB MyStepRTB - { - get { return _MyStepRTB; } - set - { - _MyStepRTB = value; - SetBtnInsSupInfoVisible(); - if (fiwc != null) fiwc.MyStepRTB = value; - if (value != null) - { - //Console.WriteLine(string.Format("StepTabRibbon: In set of MyStepRTB, Selected Text = {0}", MyStepRTB.SelectedText)); - switch (_MyStepRTB.FieldToEdit) - { - case E_FieldToEdit.PSI: - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMPSI); - _DefaultContextMenu = btnCMPSI; - break; - case E_FieldToEdit.StepText: - if (MyFlexGrid != null) - { - // This happends when the FlexGrid (table) is selected (not when you edit a table cell) - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfCellEdit); - _DefaultContextMenu = btnCMRtfCellEdit; - } - else - { - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit); - _DefaultContextMenu = btnCMRtfEdit; - } - break; - case E_FieldToEdit.Text: - case E_FieldToEdit.Number: - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit3); - _DefaultContextMenu = btnCMRtfEdit3; - break; - default: - break; - } - // The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly. - // ex. Positon on a substep, press , to list the substep types - //_MyStepRTB.MouseUp += new MouseEventHandler(_MyStepRTB_MouseUp); //+= new MouseEventHandler(MyStepRTB_SelectionChanged); - //_MyStepRTB.KeyUp += new KeyEventHandler(_MyStepRTB_KeyUp); //+= new KeyEventHandler(MyStepRTB_SelectionChanged); - _MyStepRTB.SelectionChanged += new EventHandler(_MyStepRTB_SelectionChanged); - //_MyStepRTB.ModeChange += new StepRTBModeChangeEvent(_MyStepRTB_ModeChange); - if (_MyEditItem != null) _MyEditItem.Leave += new EventHandler(_MyEditItem_Leave); - //_MyStepRTB.Leave += new EventHandler(_MyStepRTB_Leave); - _MyStepRTB.LinkChanged += new StepRTBLinkEvent(_MyStepRTB_LinkChanged); - _MyStepRTB.TextChanged += new EventHandler(_MyStepRTB_TextChanged); - if (MyFlexGrid != null) - { - MyFlexGrid.CopyOptionChanged += new VlnFlexGridEvent(MyFlexGrid_CopyOptionChanged); - MyFlexGrid.SelChange+=new EventHandler(MyFlexGrid_SelChange); - } - // C2021-043: have Proms specific context menu, i.e. with Hard space, styles and symbols rather than Windows clipboard - // The frmSI dialog uses a StepRTB that ends up in this code to work with the symbol list. This occurs when the - // MyItemInfo is null. - if (MyItemInfo == null) - { - // get base symbol list & add. - FormatInfo fmt = FormatInfo.Get(1); - SymbolList sl = fmt.PlantFormat.FormatData.SymbolList; - if (sl == null || sl.Count <= 0) - { - FlexibleMessageBox.Show("No symbols are available, check with administrator"); - return; - } - BuildSymbolGallery(sl, galleryContainerSymbolsCM, galleryContainerSymbolsCM3, galleryContainerSymbolsGrid, galleryContainerSymbolsCM4); - return; - } - if (MyItemInfo.ActiveFormat.FormatID != _MyLastFormatID && _MyLastFormatID == -1) - { - // Add symbols to the tabribbon & also to the context menu getting info from the format file... - // Note that the ButtonItems must be used in order to place the buttons on a gallery (cannot - // use buttonx or dotnet/windows/button). However, you cannot change the font on ButtonItems so - // the ribbon MUST use the Arial Unicode MS Font for this to work!!!! - FormatInfo fmt = MyItemInfo.ActiveFormat; - SymbolList sl = fmt.PlantFormat.FormatData.SymbolList; - if (sl == null || sl.Count <= 0) - { - FlexibleMessageBox.Show("No symbols are available, check with administrator"); - return; - } - BuildSymbolGallery(sl, galleryContainerSymbolsCM, galleryContainerSymbolsCM3, galleryContainerSymbolsGrid, galleryContainerSymbolsCM4); - //BuildSymbolGallery(sl, galleryContainerSymbolsCM); - //BuildSymbolGallery(sl, galleryContainerSymbolsCM3); - //BuildSymbolGallery(sl, galleryContainerSymbolsGrid); - } - SetButtonAndMenuEnabling(true); - SetStepButtonAndMenuEnabling(true); - SetMenuEnablingForObjectsWOText(); - _MyLastFormatID = MyItemInfo.ActiveFormat.FormatID; - } - } - } - private void SetBtnInsSupInfoVisible() - { - if (MyItemInfo == null) return; - if (!MyItemInfo.SupplementalInformation) - { - btnInsSupInfo.Visible = false; - return; - } - btnInsSupInfo.Visible = true; - // Any step type can insert supplemental information, unless within supplemental information: - if (MyItemInfo.IsSection || MyItemInfo.IsProcedure || MyItemInfo.IsInSupInfo || (MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0)) // || ParentHasSupInfo(MyItemInfo)) - btnInsSupInfo.Enabled = false; - else - btnInsSupInfo.Enabled = true; - } - void _MyStepRTB_TextChanged(object sender, EventArgs e) - { - if (_MyStepRTB == null) return; - // if we are in view mode or the edit window is empty, then don't allow inserting steps/substeps, - // page breaks, copy step, nor creating a pdf - // B2021-083: Create PDF button on ribbon was disabled for reviewer (removed code). Note that this allow - // is only used for the Create Pdf button now - code has changed for any other use. - bool allow = (_MyStepRTB.TextLength > 0); - - //// turn ribbon items on/off base on whether there is text in the edit window - //rbnSiblings.Enabled = rbnParagraph.Enabled = rbnStepParts.Enabled = allow; - //// only turn on the Insert Before/After and the CopyStep buttons if on a step part - ////btnInsAftH.Enabled = btnInsBefH.Enabled = btnInsAfter.Enabled = btnInsBefore.Enabled = btnCpyStp.Enabled = - //// allow && !(MyItemInfo.IsProcedure || MyItemInfo.IsSection || MyItemInfo.IsFigure || MyItemInfo.IsTable || MyItemInfo.IsRNOPart); - btnPdfCreate.Enabled = allow || (MyFlexGrid != null); // allways allow if on a table even if table cell is empty - - //// toggle context menus used with the shortcut key - //btnCMInsHLS.Enabled = btnCMInsRNO.Enabled = btnCMInsSubStps.Enabled = btnCMInsCaution.Enabled = - // btnCMInsNote.Enabled = btnCMInsTable.Enabled = btnCMInsFigure.Enabled = allow; - // C2014-009 Commented out to allow for inserting Note/Caution - // if in Calvert Alarms Condition/Response, disable insert of Cautions and Notes - //if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - //btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = allow && !MyItemInfo.IsInCalvertConditionResponse; - // C2021 - 027: Procedure level PC/PC - if text changed, i.e. applicability may have changed, redo the print menus - if (MyItemInfo != null && MyItemInfo.MyDocVersion.MultiUnitCount > 1) - SetParentChildCreatePDFButton(MyItemInfo.MyDocVersion.UnitNames, MyItemInfo); - } - - void MyFlexGrid_SelChange(object sender, EventArgs e) - { - if (MyFlexGrid == null) - return; - //B2017-156 Don't allow alignment or borders if the selection is not valid - // Alternatively allow alignment or borders if the selection is valid - rbTblBorder.Enabled = btnTblDgnAlignText.Enabled = MyFlexGrid.Selection.IsValid; - if (MyFlexGrid.Selection.c1 < 0 || MyFlexGrid.Selection.r1 < 0) - return; - if (MyFlexGrid.Selection.c1 >= MyFlexGrid.Cols.Count || MyFlexGrid.Selection.r1 >= MyFlexGrid.Rows.Count) - return; - if ((MyEditItem as GridItem).Initializing) return; - //C1.Win.C1FlexGrid.CellRange cr = MyFlexGrid.GetEvenSelection(); - //rbnBorderSelectionPanel.InitializeBorder(MyFlexGrid.MyBorders, cr.r1, cr.c1, cr.r2, cr.c2); - rbnBorderSelectionPanel.InitializeBorder(MyFlexGrid, MyFlexGrid.Selection); - } - void _MyEditItem_Leave(object sender, EventArgs e) - { - // The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly. - // ex. Positon on a substep, press , to list the substep types - //_MyStepRTB.KeyUp -=new KeyEventHandler(_MyStepRTB_KeyUp); - //_MyStepRTB.MouseUp -= new MouseEventHandler(_MyStepRTB_MouseUp); - if (_MyEditItem != null) - { - _MyEditItem.Leave -= new EventHandler(_MyEditItem_Leave); - _MyEditItem.Enter += new EventHandler(_MyEditItem_Enter); - } - //_MyStepRTB.Leave -= new EventHandler(_MyStepRTB_Leave); - if (_MyStepRTB != null) - { - _MyStepRTB.SelectionChanged -= new EventHandler(_MyStepRTB_SelectionChanged); - _MyStepRTB.LinkChanged -= new StepRTBLinkEvent(_MyStepRTB_LinkChanged); - } - if (MyFlexGrid != null) - { - MyFlexGrid.CopyOptionChanged -= new VlnFlexGridEvent(MyFlexGrid_CopyOptionChanged); - MyFlexGrid.SelChange -= new EventHandler(MyFlexGrid_SelChange); - } - } - public bool SiblingsButtonsEnabled - { - set - { - // turn ribbon items on/off base on whether there is text in the edit window - rbnSiblings.Enabled = rbnParagraph.Enabled = rbnStepParts.Enabled =value; - } - } - public bool InsertButtonsEnabled - { - set - { - // only turn on the Insert Before/After and the CopyStep buttons if on a step part - btnInsAftH.Enabled = btnInsBefH.Enabled = btnInsAfter.Enabled = btnInsBefore.Enabled = btnCpyStp.Enabled = value; - } - } - public void SetCopyStepButton(bool val) - { - btnCpyStp.Enabled = val; - } - void _MyEditItem_Enter(object sender, EventArgs e) - { - // The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly. - // ex. Positon on a substep, press , to list the substep types - //_MyStepRTB.KeyUp -=new KeyEventHandler(_MyStepRTB_KeyUp); - //_MyStepRTB.MouseUp -= new MouseEventHandler(_MyStepRTB_MouseUp); - if (_MyEditItem != null) - { - _MyEditItem.Leave += new EventHandler(_MyEditItem_Leave); - _MyEditItem.Enter -= new EventHandler(_MyEditItem_Enter); - } - //_MyStepRTB.Leave -= new EventHandler(_MyStepRTB_Leave); - if (_MyStepRTB != null) - { - _MyStepRTB.LinkChanged += new StepRTBLinkEvent(_MyStepRTB_LinkChanged); - _MyStepRTB.SelectionChanged += new EventHandler(_MyStepRTB_SelectionChanged); - } - if (MyFlexGrid != null) - { - MyFlexGrid.CopyOptionChanged += new VlnFlexGridEvent(MyFlexGrid_CopyOptionChanged); - MyFlexGrid.SelChange += new EventHandler(MyFlexGrid_SelChange); - //Console.WriteLine("Turn on SelChange"); - } -} - void MyFlexGrid_CopyOptionChanged(object sender, EventArgs args) - { - btnTblDgnPaste.Enabled = true; - btnCmGridPaste.Enabled = true; - switch (VlnFlexGrid.MyCopyInfo.MyCopyOption) - { - case GridCopyOption.Row: - btnTblDgnPasteRow.Visible = true; - btnCmGridPasteRow.Visible = true; - btnTblDgnPasteColumn.Visible = false; - btnCmGridPasteCol.Visible = false; - break; - case GridCopyOption.Column: - btnTblDgnPasteRow.Visible = false; - btnCmGridPasteRow.Visible = false; - btnTblDgnPasteColumn.Visible = true; - btnCmGridPasteCol.Visible = true; - break; - case GridCopyOption.Selection: - btnTblDgnPasteRow.Visible = false; - btnCmGridPasteRow.Visible = false; - btnTblDgnPasteColumn.Visible = false; - btnCmGridPasteCol.Visible = false; - break; - default: - break; - } - } - private ItemInfo lastItem = null; - private int lastStart = -1; - private int lastLength = -1; - private string lastText = null; - // B2019-161 When tracking timing time this action - private static VolianTimer _TimeActivity = new VolianTimer("StepTabRibbon.cs _MyStepRTB_SelectionChanged",837); - - void _MyStepRTB_SelectionChanged(object sender, EventArgs e) - { - if (_MyStepRTB == null) return; - _TimeActivity.Open(); - //B2019-154 This will prevent duplicate processing of the ribbon menu and refresh of step items, speeding up the editing experience - if (_MyStepRTB != null && _MyStepRTB.MyItemInfo == lastItem && _MyStepRTB.SelectionStart == lastStart && _MyStepRTB.SelectionLength == lastLength && _MyStepRTB.SelectedText == lastText) - return; - lastItem = _MyStepRTB.MyItemInfo; - lastStart = _MyStepRTB.SelectionStart; - lastLength = _MyStepRTB.SelectionLength; - lastText = _MyStepRTB.SelectedText; - SetButtonAndMenuEnabling(false); - _TimeActivity.Close(); - } - //void _MyStepRTB_MouseUp(object sender, MouseEventArgs e) - //{ - // //SetButtonAndMenuEnabling(false); - //} - - //void _MyStepRTB_KeyUp(object sender, KeyEventArgs e) - //{ - // //SetButtonAndMenuEnabling(false); - //} - private Bitmap createTextBitmap(char ch) - { - return createTextBitmap(ch, new Font("FreeMono", 18, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)); - } - - private Bitmap createTextBitmap(char ch, Font objFont) - { - string txt = string.Format("{0}", ch); - Bitmap objBmpImage = new Bitmap(1, 1); - - int intWidth = 0; - int intHeight = 0; - - // Create the Font object for the image text drawing. - // later on, we could add logic to use either FreeMono or Arial Unicode MS based on the format being used - // but for now, we are going to use FreeMono to create the symbol list - - // Create a graphics object to measure the text's width and height. - Graphics objGraphics = Graphics.FromImage(objBmpImage); - - // This is where the bitmap size is determined. - intWidth = (int)objGraphics.MeasureString(txt, objFont).Width; - intHeight = (int)objGraphics.MeasureString(txt, objFont).Height; - - // Create the bmpImage again with the correct size for the text and font. - objBmpImage = new Bitmap(objBmpImage, new Size(intWidth, intHeight)); - - // Add the colors to the new bitmap. - objGraphics = Graphics.FromImage(objBmpImage); - - // Set Background color - objGraphics.Clear(Color.Transparent); //.White); - objGraphics.SmoothingMode = SmoothingMode.AntiAlias; - objGraphics.TextContrast = 0; - objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias; - objGraphics.DrawString(txt, objFont, new SolidBrush(Color.Black),0,0); - objGraphics.Flush(); - return (objBmpImage); - } - private void BuildSymbolGallery(SymbolList sl, DevComponents.DotNetBar.GalleryContainer gc1, DevComponents.DotNetBar.GalleryContainer gc2, DevComponents.DotNetBar.GalleryContainer gc3, DevComponents.DotNetBar.GalleryContainer gc4) - { - foreach (Symbol sym in sl) - { - // get an image of the symbol character - // found the we cannot change the font being used for the button text - Bitmap symCharBtmp = createTextBitmap((char)sym.Unicode); - DevComponents.DotNetBar.ButtonItem btn = new DevComponents.DotNetBar.ButtonItem(); - btn.Image = symCharBtmp; - //btn.Text = string.Format("{0}", (char)sym.Unicode); - - // to name button use unicode rather than desc, desc may have spaces or odd chars - btn.Name = "btn" + sym.Unicode.ToString(); - btn.Tooltip = sym.Desc; - btn.Tag = string.Format(@"{0}", sym.Unicode); - //btn.FontBold = true; - btn.Click += new System.EventHandler(btnSym_Click); - galleryContainerSymbols.SubItems.Add(btn); - DevComponents.DotNetBar.ButtonItem btnCM1 = GetCMButton(sym); - btnCM1.Image = symCharBtmp; - btnCM1.Click += new System.EventHandler(btnSym_Click); - gc1.SubItems.Add(btnCM1); - DevComponents.DotNetBar.ButtonItem btnCM2 = GetCMButton(sym); - btnCM2.Image = symCharBtmp; - btnCM2.Click += new System.EventHandler(btnSym_Click); - gc2.SubItems.Add(btnCM2); - DevComponents.DotNetBar.ButtonItem btnCM3 = GetCMButton(sym); - btnCM3.Image = symCharBtmp; - btnCM3.Click += new System.EventHandler(btnSym_Click); - gc3.SubItems.Add(btnCM3); - DevComponents.DotNetBar.ButtonItem btnCM4 = GetCMButton(sym); - btnCM4.Image = symCharBtmp; - btnCM4.Click += new System.EventHandler(btnSym_Click); - gc4.SubItems.Add(btnCM4); - } - } - - private static DevComponents.DotNetBar.ButtonItem GetCMButton(Symbol sym) - { - DevComponents.DotNetBar.ButtonItem btnCM3 = new DevComponents.DotNetBar.ButtonItem(); - //btnCM3.Text = string.Format("{0}", (char)sym.Unicode); - // to name button use unicode rather than desc, desc may have spaces or odd chars - btnCM3.Name = "btnCM" + sym.Unicode.ToString(); - btnCM3.Tooltip = sym.Desc; - btnCM3.Tag = string.Format(@"{0}", sym.Unicode); - //btnCM3.FontBold = true; - return btnCM3; - } - //void _MyStepRTB_ModeChange(object sender, StepRTBModeChangeEventArgs args) - //{ - // SetButtonAndMenuEnabling(true); - //} - #region Constructor - public StepTabRibbon(bool? IsInEditorialMode = false) - { - InitializeComponent(); - this.btnInsSupInfo.Tag = string.Format("{0} {1}", (int)E_FromTypes.SupInfos, 1040); // Make type of rno (40) & special case 1000 - SetChangeIdRibbon(); - - EnableROEdit = true; - _RibbonControl.AutoSize = true; - _RibbonControl.SizeChanged += new EventHandler(_RibbonControl_SizeChanged); - // When AutoExpand is set to true, [CTRL][F1] and double click will hide/expand the ribbon bar - // causing its state to be out of sync with that of the QAT menu option to - // expand/hide the ribbon. - // We now set AutoExpand to false and issue an event to expand/collapse the ribbon - // in a generic event method (ribbonTab_DoubleClick) - // and assigned it to the DoubleClick event of each tab in the ribbon. - // (see ribbonTab_DoubleClick() for more information) -jsj 07-APR-2011 - // Note: the QAT menu is to the right of the V start button in the upper left - _RibbonControl.AutoExpand = false; - _RibbonControl.Items[0].RaiseClick(); // initially default to HOME tab - rbnBorderlistBox.Resize += new EventHandler(rbnBorderlistBox_Resize); - rbnBorderlistBox.SetupFontAndSize(6); // 6 Point Font - // added per Harry to hide refresh buttons - btnRefObjRefresh.Visible = btnTranRefresh.Visible = false; - // hide the import from Word file if not running in Debug mode - if (!VlnSettings.DebugMode) - rbnImpWrd.Visible = false; - - // C2015-028 Add Editorial Mode to PROMS Step Editor - // default Editorial Mode to what is set in the DisplayTabControl - SetEditorialMode(IsInEditorialMode != null && (bool) IsInEditorialMode); - - } - - public void SetEditorialMode(bool mode) => btnEditorialMode.Checked = btnCMEditorialMode.Checked = mode; - - void _RibbonControl_SizeChanged(object sender, EventArgs e) - { - this.Size = _RibbonControl.Size; - } - public bool Expanded - { - get { return _RibbonControl.Expanded; } - set { _RibbonControl.Expanded = value; } - } - #endregion - #region Events - //public event StepTabRibbonEvent OpenEnhancedDocument; - //private void OnOpenEnhancedDocument(StepTabRibbonEventArgs args) - //{ - // if (OpenEnhancedDocument != null) - // OpenEnhancedDocument(this, args); - //} - public event StepTabRibbonEvent PrintRequest; - public event StepTabRibbonEvent QPrintRequest; - private void OnPrintRequest(StepTabRibbonEventArgs args, int prttyp = 0) - { - if (PrintRequest != null) { - if (prttyp == 0) - { - PrintRequest(this, args); - } - } - - if (QPrintRequest != null) - { - if (prttyp == 1) - { - QPrintRequest(this, args); - } - } - } - public event StepTabRibbonEvent ContActionSummaryRequest; - private void OnContActionSummaryRequest(StepTabRibbonEventArgs args) - { - if (ContActionSummaryRequest != null) - ContActionSummaryRequest(this, args); - } - // F2022-024 Time Critical Action Summary - public event StepTabRibbonEvent TimeCriticalActionSummaryRequest; - private void OnTimeCriticalActionSummaryRequest(StepTabRibbonEventArgs args) - { - if (TimeCriticalActionSummaryRequest != null) - TimeCriticalActionSummaryRequest(this, args); - } - public event StepTabRibbonEvent AddProcToDVInTree; - private void OnAddProcToDVInTree(StepTabRibbonEventArgs args) - { - if (AddProcToDVInTree != null) - AddProcToDVInTree(this, args); - } - void _MyStepRTB_LinkChanged(object sender, StepPanelLinkEventArgs args) - { - // do all Transition and ReferencedObject menu items/buttons based on whether a 'link is selected' and the link type. - SetupGoToButton(); - if (btnCMGoTo.Enabled == true && _MyStepRTB.MyLinkText != null) // must have some link test, use it to set edit of transition or ro... - { - btnCMEditTran.Enabled = _MyStepRTB.MyLinkText.IndexOf("Transition") > -1; // selected link must be a transition - btnCMEditRO.Enabled = _MyStepRTB.MyLinkText.IndexOf("ReferencedObject") > -1; // selected link must be ro - } - else - { - btnCMEditTran.Enabled = false; - btnCMEditRO.Enabled = false; - } - } - private void SetupGoToButton() - { - if (MyEditItem is GridItem && (MyEditItem as GridItem).MyFlexGrid.IsRoTable) - // B2016-127 - disable if is an RO table type but no RO was selected. - btnCMGoTo.Enabled = btnGoTo.Enabled = UserInfo.CanEditROs(MyUserInfo, Mydvi) && (MyEditItem as GridItem).MyFlexGrid.ROID != null;//Don't allow Writers and Reviews run the RO Editor - else - { - if (_MyStepRTB == null) return; - if (_MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength)) - { - // if selected text = ?, i.e. a missing/undefined destination, don't allow go to - // if the selected link is an RO then check to see if the user is allowed to run the RO Editor (writers and reviewers cannot run the RO Editor) - btnCMGoTo.Enabled = btnGoTo.Enabled = !_MyStepRTB.SelectedText.StartsWith("?") && (_MyStepRTB.SelectedText.Contains("Transition") || (_MyStepRTB.SelectedText.Contains("ReferencedObject") && UserInfo.CanEditROs(MyUserInfo, Mydvi))); - } - else - btnCMGoTo.Enabled = btnGoTo.Enabled = false; - } - } - void _MyStepRTB_Leave(object sender, EventArgs e) - { - // The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly. - // ex. Positon on a substep, press , to list the substep types - //_MyStepRTB.KeyUp -=new KeyEventHandler(_MyStepRTB_KeyUp); - //_MyStepRTB.MouseUp -= new MouseEventHandler(_MyStepRTB_MouseUp); - _MyStepRTB.SelectionChanged -= new EventHandler(_MyStepRTB_SelectionChanged); - _MyStepRTB.Leave -= new EventHandler(_MyStepRTB_Leave); - _MyStepRTB.LinkChanged -= new StepRTBLinkEvent(_MyStepRTB_LinkChanged); - } - - void btnInsStep_Click(object sender, EventArgs e) - { - // Fix B2016-238 Fix B2017-139 account for image sub-steps - // C2017-028 don't display message if on a table (allow sup info off of a table) - if (_MyEditItem.MyStepRTB.Text == "" && !(_MyEditItem is ImageItem) && !(_MyEditItem is GridItem)) - { - FlexibleMessageBox.Show(this, "Cannot insert step from empty step.", "Insert step", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - string cautNoteOrder = _MyEditItem.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.CautionNoteOrder; - DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender; - if (b.Tag == null) return; - char[] sep = { ' ' }; - string[] insdata = b.Tag.ToString().Split(sep); - if (insdata.Length < 2) return; - int fromtype = Convert.ToInt32(insdata[0]); - int contenttype = Convert.ToInt32(insdata[1]) + 20000; - string tabOrFigType = (insdata.Length == 3) ? insdata[2] : null; - // if CautionNoteOrder format variable is set then use it to determine the placement of the - // Caution, Note, Warning, or Message (calvert format) - if (cautNoteOrder != null && ("," + cautNoteOrder + ",").Contains("," + (contenttype % 10000).ToString() + ",") && (_MyEditItem.MyItemInfo.Cautions != null || _MyEditItem.MyItemInfo.Notes != null)) - { - EditItem stepBefore = FindStepBefore(cautNoteOrder, contenttype); - if (stepBefore != null) - stepBefore.AddSiblingAfter((int?)contenttype, true); - else - { - EditItem stepAfter = FindStepAfter(cautNoteOrder, contenttype); - if (stepAfter != null) - stepAfter.AddSiblingBefore((int?)contenttype, true); - } - } - // if from type == 0, we've inserted a hls. - // if inserting from section, insert first child - // else do a after from current HLS - if not at HLS, go up parents until find it. - else if (fromtype == 0 && !_MyEditItem.MyItemInfo.IsStepSection) - { - SaveTableChanges(); // B2018-055 Save Current Changes to the table - EditItem hlsEditItem = _MyEditItem; - while (!hlsEditItem.MyItemInfo.IsHigh) - hlsEditItem = hlsEditItem.ActiveParent; - hlsEditItem.AddSiblingAfter((int?)contenttype, true); - } - else if (contenttype == 21040) - { - SaveTableChanges(); // B2018-055 Save Current Changes to the table - _MyEditItem.AddChild((E_FromType)fromtype, 20040); - } - else if (InsertingTable(contenttype)) - { - if (tabOrFigType.Contains("RO")) - { - VlnFlexGrid grd = new VlnFlexGrid(); - grd.Rows.Count = 1; - grd.Cols.Count = 1; - grd.IsRoTable = true; - _MyEditItem.AddChild((E_FromType)fromtype, contenttype, grd); - StepTabPanel tmp = Parent as StepTabPanel; - tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(null)); - } - else - { - VlnFlexGrid grd = CreateNewTable(); - if (grd != null) _MyEditItem.AddChild((E_FromType)fromtype, contenttype, grd); - } - } - else if (InsertingFigure(contenttype)) - { - if (tabOrFigType.Contains("RO")) - { - _MyEditItem.AddChild((E_FromType)fromtype, contenttype, ImageItem.E_ImageSource.RoFigure); - StepTabPanel tmp = Parent as StepTabPanel; - tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(null)); - } - else - { - System.Drawing.Image img = Clipboard.GetImage(); - if (img == null && tabOrFigType.Contains("CL")) - { - FlexibleMessageBox.Show("Clipboard does not contain image data. Cannot create figure.", "Clipboard Error"); - return; - } - _MyEditItem.AddChild((E_FromType)fromtype, contenttype, tabOrFigType.Contains("CL") ? ImageItem.E_ImageSource.Clipboard : ImageItem.E_ImageSource.File); - } - if (_MyEditItem.MyItemInfo.IsFigure && tabOrFigType.Contains("RO")) - btnInsRO_Click(sender, e); - } - else if (InsertingEquation(contenttype)) - { - // launch Ole Object Editor - added support for Visio - switch (OleObjectEditors) - { - case 0: // None - FlexibleMessageBox.Show("The Equation Editor needs to be started.", "Reminder", MessageBoxButtons.OK); - break; - case 1: // Equation Editor - Process.Start(EqnEdtPath); - break; - case 2: // Visio - Process.Start(VisioPath); - break; - case 3: // Both - string editor = (sender as ButtonItem).Tag.ToString(); - if (editor.EndsWith("Visio")) - Process.Start(VisioPath); - else - Process.Start(EqnEdtPath); - break; - } - _MyEditItem.AddChild((E_FromType)fromtype, contenttype); - } - else - { - _MyEditItem.AddChild((E_FromType)fromtype, contenttype); - } - } - // the following launches the equation editor based on registry setting: - private static string GetEqnEdt() - { - string retval = null; - try - { - RegistryKey key = Registry.ClassesRoot; - string rootName = key.Name; - string curVer = GetDefaultKeyValue(key.Name + "\\Equation\\CurVer"); - string clsid = GetDefaultKeyValue(key.Name + "\\" + curVer + "\\CLSID"); - retval = GetDefaultKeyValue(key.Name + "\\CLSID\\" + clsid + "\\LocalServer32"); - } - catch (Exception ex) - { - _MyLog.WarnFormat("Equation Editor is not correctly configured in the registry."); - string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); - folderPath += @"\Common Files\Microsoft Shared\EQUATION\EQNEDT32.EXE"; - System.IO.FileInfo fi = new System.IO.FileInfo(folderPath); - if (fi.Exists) return fi.FullName; - folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles).Replace(" (x86)", ""); - folderPath += @"\Common Files\Microsoft Shared\EQUATION\EQNEDT32.EXE"; - fi = new System.IO.FileInfo(folderPath); - if (fi.Exists) return fi.FullName; - folderPath = @"C:\Program Files\Common Files\Microsoft Shared\EQUATION\EQNEDT32.EXE"; - fi = new System.IO.FileInfo(folderPath); - if (fi.Exists) return fi.FullName; - return null; - } - if (retval == null) - _MyLog.WarnFormat("Equation Editor executable could not be found."); - return retval; - } - // B2018-038 MathType Replacement for EQNEDT32.EXE - private static string GetMathType() - { - string retval = null; - try - { - RegistryKey key = Registry.ClassesRoot; - string rootName = key.Name; - string clsid = GetDefaultKeyValue(key.Name + "\\DSEquations\\CLSID"); - retval = GetDefaultKeyValue(key.Name + "\\CLSID\\" + clsid + "\\LocalServer32"); - } - catch (Exception ex) - { - _MyLog.WarnFormat("MathType Equation Editor is not correctly configured in the registry."); - string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); - folderPath += @"\MathType\MathType.EXE"; - System.IO.FileInfo fi = new System.IO.FileInfo(folderPath); - if (fi.Exists) return fi.FullName; - folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles).Replace(" (x86)", ""); - folderPath += @"\MathType\MathType.EXE"; - fi = new System.IO.FileInfo(folderPath); - if (fi.Exists) return fi.FullName; - folderPath = @"C:\Program Files\\MathType\MathType.EXE"; - fi = new System.IO.FileInfo(folderPath); - if (fi.Exists) return fi.FullName; - return null; - } - if (retval == null) - _MyLog.WarnFormat("Equation Editor executable could not be found."); - return retval; - } - - private static string GetVisio() // Added support for Visio - { - string retval = _SpecifiedVisioPath; // use the Visio path specified by the user - - if (!string.IsNullOrEmpty(retval)) - { - if (!retval.ToUpper().EndsWith(".EXE")) - retval += (retval.EndsWith("\\")) ? "visio.exe" : "\\visio.exe"; - if (!File.Exists(retval)) // visio path was invalid, so try the registry next - { - _MyLog.WarnFormat("Specified Visio Path is Invalid: {0}",retval); - retval = null; // look in the registry - } - } - - if (!string.IsNullOrEmpty(retval)) - { - try - { - RegistryKey regVersionString = Registry.ClassesRoot.OpenSubKey("Visio.Drawing\\CurVer"); - RegistryKey regClassId = Registry.ClassesRoot.OpenSubKey(regVersionString.GetValue("") + "\\CLSID"); - RegistryKey regInstallPath = Registry.ClassesRoot.OpenSubKey("CLSID\\" + regClassId.GetValue("") + "\\LocalServer32"); - retval = Path.GetFullPath(regInstallPath.GetValue("").ToString()); // this will convert a short file/folder names to long file/folder names - } - catch - { - _MyLog.WarnFormat("Visio was not found in the registry."); - } - } - - return retval; - } - private static string _EqnEdtPath = null; - public static string EqnEdtPath - { - get { return StepTabRibbon._EqnEdtPath; } - } - private static string _VisioPath = null; - public static string VisioPath - { - get { return StepTabRibbon._VisioPath; } - } - private int _OleObjectEditors = -1; - public int OleObjectEditors - { - get - { - if (_OleObjectEditors == -1) - { - _OleObjectEditors = 0;// no OLE Object Editors - _EqnEdtPath = GetEqnEdt(); - if (_EqnEdtPath == null) _EqnEdtPath = GetMathType();// B2018-038 MathType Replacement for EQNEDT32.EXE - // B2017-067 check for empty string as well as a null for paths to the Equation Editor and Visio - if (_EqnEdtPath != null && _EqnEdtPath != "") _OleObjectEditors += 1; - _VisioPath = GetVisio(); - if (_VisioPath != null && _VisioPath != "") _OleObjectEditors += 2; - } - return _OleObjectEditors; - } - } - - private static string FindFile(DirectoryInfo di, string fileName) - { - try - { - - foreach (FileInfo fi in di.GetFiles(fileName)) - return fi.FullName; - foreach (DirectoryInfo sub in di.GetDirectories()) - { - string path = FindFile(sub, fileName); - if (path != null) - return path; - } - } - catch (Exception) - { - ; - } - return null; - } - public static String GetDefaultKeyValue(String key) - { - object xxx = null; - // fixed null reference error - appeared only while debugged - for user was handled via Try/Catch and ignored - object gtval = Registry.GetValue(key, "", xxx); - return (string)((gtval != null) ? gtval.ToString() : gtval); - } - private EditItem FindStepAfter(string types, int contenttype) - { - string[] order = types.Split(",".ToCharArray()); //"29,7,6,22" - bool found = false; - List lOrder = new List(); - foreach (string type in order) - { - if (found) - lOrder.Add(int.Parse(type)); - if (int.Parse(type) == contenttype % 10000) found = true; - } - //_MyEditItem.MyItemInfo.RefreshItemParts(); - _MyEditItem.MyItemInfo.ResetParts(); - if (_MyEditItem.MyItemInfo.Cautions != null) - foreach (ItemInfo ii in _MyEditItem.MyItemInfo.Cautions) - { - if (lOrder.Contains((int)ii.MyContent.Type % 10000)) - return _MyEditItem.MyStepPanel.FindItem(ii); - } - if (_MyEditItem.MyItemInfo.Notes != null) - foreach (ItemInfo ii in _MyEditItem.MyItemInfo.Notes) - { - if (lOrder.Contains((int)ii.MyContent.Type % 10000)) - return _MyEditItem.MyStepPanel.FindItem(ii); - } - return null; - } - - private EditItem FindStepBefore(string types, int contenttype) - { - string[] order = types.Split(",".ToCharArray()); //"29,7,6,22" - List lOrder = new List(); - foreach (string type in order) - { - lOrder.Add(int.Parse(type)); - if (lOrder.Contains(contenttype % 10000)) - break; - } - ItemInfo itemBefore = null; - //_MyEditItem.MyItemInfo.RefreshItemParts(); - _MyEditItem.MyItemInfo.ResetParts(); - if (_MyEditItem.MyItemInfo.Cautions != null) - foreach (ItemInfo ii in _MyEditItem.MyItemInfo.Cautions) - { - if (lOrder.Contains((int)ii.MyContent.Type % 10000)) - itemBefore = ii; - } - if (_MyEditItem.MyItemInfo.Notes != null) - foreach (ItemInfo ii in _MyEditItem.MyItemInfo.Notes) - { - if (lOrder.Contains((int)ii.MyContent.Type % 10000)) - itemBefore = ii; - } - if (itemBefore != null) - { - //Console.WriteLine("findStepBefore {0}", itemBefore.DisplayText); - return _MyEditItem.MyStepPanel.FindItem(itemBefore); - } - return null; - } - // Table Grid - private bool InsertingTable(int contenttype) - { - bool rtnval = false; - switch (contenttype) - { - case 20008: // Centered table - case 20010: // AER table - case 20033: // AER table without boarder - case 20034: // Centered table without boarder - rtnval = true; - break; - } - return rtnval; - } - // Figure (embedded images) - private bool InsertingFigure(int contenttype) - { - bool rtnval = false; - switch (contenttype) - { - case 20036: // Centered - case 20037: // AER (left) - case 20038: // AER (left) without boarder - case 20039: // Centered without boarder - rtnval = true; - break; - } - return rtnval; - } - // Equation - private bool InsertingEquation(int contenttype) - { - bool rtnval = false; - switch (contenttype) - { - case 21000: - case 21001: - case 21002: - case 21003: - rtnval = true; - break; - } - return rtnval; - } - private void btnInsBefore_Click(object sender, EventArgs e) - { - SaveTableChanges(); // B2018-055 Save Current Changes to the table - _MyEditItem.AddSiblingBefore(); - } - - private void btnInsAfter_Click(object sender, EventArgs e) - { - SaveTableChanges(); // B2018-055 Save Current Changes to the table - _MyEditItem.AddSiblingAfter(); - } - - private void SaveTableChanges() - { - if (_MyEditItem.MyItemInfo.IsTable) // B2018-005 Save Current Changes to the table - if (_MyEditItem.MyParentEditItem != null)// B2018-055 Move to Parent if it exists - _MyEditItem.MyParentEditItem.Select(); // Next - else if (_MyEditItem.MyPreviousEditItem != null)// B2018-055 Move to Previous if it exists - _MyEditItem.MyPreviousEditItem.Select(); - } - /// - /// Using style for step type, enable/disable formatting buttons - /// - private void SetButtonForStyle() - { - btnBold.Enabled = btnCMBold.Enabled = (!((_MyStepRTB.MyStyleFont.Style & E_Style.Bold) == E_Style.Bold || (_MyStepRTB.MyStyleFont.Style & E_Style.MmBold) == E_Style.MmBold)); - btnUnderline.Enabled = btnCMUnderline.Enabled = (!((_MyStepRTB.MyStyleFont.Style & E_Style.Underline) == E_Style.Underline)); - btnItalics.Enabled = btnCMItalics.Enabled = (!((_MyStepRTB.MyStyleFont.Style & E_Style.Italics) == E_Style.Italics)); - } - public void SetTableButtonsForMergeRangeSelection() - { - if (MyFlexGrid != null ) - { - // B2017-128 added check for only one cell selected (should not be alowed to merge just a single cell) - btnTblDgnMergeCells.Enabled = btnCmGridMergeCells.Enabled = !MyFlexGrid.IsRoTable && !MyFlexGrid.IsInMergeRange() && !MyFlexGrid.Selection.IsSingleCell; - } - } - private void SetButtonMenuEnabledDisabledOnSelection(bool setting) - { - btnCMBold.Enabled = btnBold.Enabled = setting; - btnCMItalics.Enabled = btnItalics.Enabled = setting; - btnCMUnderline.Enabled = btnUnderline.Enabled = setting; - btnCMSubscript.Enabled = btnSubscript.Enabled = setting; - btnCMSuperscript.Enabled = btnSuperscript.Enabled = setting; - btnCMCut.Enabled = btnCut.Enabled = setting; - btnCMUndo.Enabled = btnUndo.Enabled = setting; - btnCMRedo.Enabled = btnRedo.Enabled = setting; - //btnEdit3CMPaste.Enabled = btnPasteText.Enabled = btnCMPasteText.Enabled = btnCMPaste.Enabled = btnPaste.Enabled = setting; - btnCMPaste.Enabled = btnCMPasteText.Enabled = btnPasteText.Enabled = btnPasteStepText.Enabled = btnPaste.Enabled = setting; - btnCMCopy.Enabled = btnCopy.Enabled = setting; - btnPasteAfter.Enabled = btnPasteBefore.Enabled = btnStepPaste.Enabled = btnPasteReplace.Enabled = setting; - btnCMGrid.Enabled = setting; - btnCMPasteImage.Enabled = setting; - } - private void SetButtonMenuEnabledDisabledOnStepType(bool setting) - { - btnPageBreak.Enabled = btnInsPgBrk.Enabled = setting; - btnCMChgStep.Enabled = btnChgTyp.Enabled = setting; - btnInsHLS.Enabled = btnInsCaut.Enabled = btnInsNote.Enabled = btnInsRNO.Enabled = btnInsFig.Enabled = - btnInsTable.Enabled = btnInsSubstep.Enabled = btnInsBefore.Enabled = btnInsAfter.Enabled = setting; - btnInsTrans.Enabled = btnCMTransition.Enabled = setting; - btnInsRO.Enabled = btnCMRO.Enabled = setting && Mydvi.DocVersionAssociationCount > 0; // 2016-128 don't enable if RO Path was not selected at the Working Draft node - btnInsAftH.Enabled = btnInsBefH.Enabled = setting; - btnCMChgCase.Enabled = btnChgCase.Enabled = setting; - btnCMHardSpace.Enabled = btnInsHrdSpc.Enabled = setting; - btnCMSymbol.Enabled = btnSymbols.Enabled = setting; - btnIndent.Enabled = setting; - btnDelelete.Enabled = btnDelStep.Enabled = setting; - btnSpell.Enabled = setting; - rtabTableGridTools.Visible = setting; - btnCMGrid.Enabled = setting; - if (MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AllowNoteCautionAdd) - { - btnInsNote.Enabled = true; - btnInsCaut.Enabled = true; - } - // C2014-009 Commented out to allow for inserting Note/Caution - // if in Calvert Alarms Condition/Response, disable insert of Cautions and Notes - //if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - //btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = setting && !MyItemInfo.IsInCalvertConditionResponse; - // B2016-237 added context menu item to change image size - btnCMImgSz.Enabled = MyEditItem.MyItemInfo.IsFigure && (MyEditItem.MyItemInfo.MyContent.MyImage != null || MyEditItem.MyItemInfo.MyContent.Text.ToUpper().Contains("#LINK")); - if (MyItemInfo.IsSupInfoPart) btnInsAfter.Enabled = btnInsAftH.Enabled = btnInsBefore.Enabled = btnInsBefH.Enabled = false; - // C2018-005: disable the change step type button when on procedure or section: - if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) btnCMChgStep.Enabled = btnChgTyp.Enabled = false; - } - public void SetButtonAndMenuEnabling(bool docontextmenus) - { - if (_MyStepRTB == null) return; - // B2020-052: context menu items for setting text styles, fix for properties: - if ((_MyStepRTB.FieldToEdit != E_FieldToEdit.Number && _MyStepRTB.FieldToEdit != E_FieldToEdit.Text && _MyStepRTB.FieldToEdit != E_FieldToEdit.PSI) && _MyStepRTB.FieldToEdit != E_FieldToEdit.StepText && !MyItemInfo.IsFigure && !MyItemInfo.IsRtfRaw) // want menu enabling for figures & aations - return; // No need to change menu that does not get used - DocVersionInfo dvi = MyEditItem != null ? MyEditItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo : MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; - if (dvi == null) return; - // enable the following in case they were disabled for enhanced steps - only do for formats that have enhanced: - if (!MyItemInfo.IsEnhancedStep && !MyItemInfo.IsEnhancedSection && - (((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) || - ((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations))) - SetButtonEnablingForEnhanced(MyUserInfo.IsAllowedToEdit(dvi)); // B2018-112 - set context menu and ribbon buttons based on user's PROMS Security setting - - if (dvi.VersionType > 127 || (MyEditItem != null && MyEditItem.MyStepPanel.VwMode == E_ViewMode.View)) - { - SetButtonMenuEnabledDisabledOnSelection(false); - } - else if (MyItemInfo != null && MyItemInfo.IsEnhancedStep || MyItemInfo.IsEnhancedSection) - { - SetButtonEnablingForEnhanced(false); - } - else - { - SetButtonMenuEnabledDisabledOnSelection(true); - - if (_MyStepRTB.SelectionFont != null) - { - // B2017-208 added (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode) - // toggle on/off attributes button checks when you edit table cells, going from one cell to another - // Also don't keep the attributes buttons checked after setting a group of table cells all at one time - btnCMBold.Checked = btnBold.Checked = RTBAPI.IsBold(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - btnCMItalics.Checked = btnItalics.Checked = RTBAPI.IsItalic(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - btnCMUnderline.Checked = btnUnderline.Checked = RTBAPI.IsUnderline(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - } - SetButtonForStyle(); - - btnCMCut.Enabled = btnCut.Enabled = _MyStepRTB.SelectionLength > 0; - btnCMUndo.Enabled = btnUndo.Enabled = _MyStepRTB.CanUndo; - btnCMRedo.Enabled = btnRedo.Enabled = _MyStepRTB.CanRedo; - - // for paste, see if there is clipboard data, & if so, of a type we can use. - btnCMPasteImage.Enabled = false; - try // RHM20150506 Multiline ItemID TextBox - { - IDataObject iData = Clipboard.GetDataObject(); - // B2019-154 clean up the Windows Clipboard - Word on Windows 10 computers seems to have placed extra information (not needed by PROMS) on the clipboard - if (iData.GetFormats().Length > 1) - { - DataObject myDO = new DataObject(); - foreach (string objname in iData.GetFormats()) - { - switch (objname) - { - //case "Object Descriptor": - //case "HTML Format": - case "EnhancedMetafile": - //case "MetaFilePict": - //case "Embed Source": - //case "Link Source": - //case "Link Source Descriptor": - //case "ObjectLink": - //case "HyperlinkWordBkmk": - //case "Hyperlink": - break; - default: - //case "Text": - //case "Rich Text Format": - myDO.SetData(objname, iData.GetData(objname)); - break; - } - } - Clipboard.Clear(); - - Clipboard.SetDataObject(myDO); // this saves the cleaned up information to the Windows clipboard - } - iData = Clipboard.GetDataObject(); - bool noEquationData = true; - // part of bug B2017-117 we were running out of window handles when printing, found this similar use of - // creating a new richtextbox just for some processing. Put a Using around this to ensure the window handle - // is free'd - using (System.Windows.Forms.RichTextBox richTextBox1 = new System.Windows.Forms.RichTextBox()) - { - DataFormats.Format frm = DataFormats.GetFormat("Embed Source"); - //System.Windows.Forms.RichTextBox richTextBox1; - //richTextBox1 = new System.Windows.Forms.RichTextBox(); - richTextBox1.Location = new System.Drawing.Point(35, 32); - richTextBox1.Name = "richTextBox1"; - richTextBox1.Size = new System.Drawing.Size(67, 58); - richTextBox1.TabIndex = 0; - richTextBox1.Text = ""; - richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; - //bool noEquationData = true; - try - { - richTextBox1.Paste(frm); - if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS EQU")) noEquationData = false; - if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS VIS")) noEquationData = false; - } - catch (Exception ex) - { - noEquationData = false; - } - } // end using - //btnEdit3CMPaste.Enabled = btnPasteText.Enabled = btnCMPasteText.Enabled = btnCMPaste.Enabled = btnPaste.Enabled = (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf)); - //btnPasteText.Enabled = btnPasteStepText.Enabled = btnPaste.Enabled = (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf)); - btnPaste.Enabled = noEquationData && (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf)); - btnCMPasteText.Enabled = btnPasteText.Enabled = noEquationData && iData.GetDataPresent(DataFormats.Text); - btnCMPaste.Enabled = btnPasteStepText.Enabled = noEquationData && iData.GetDataPresent(DataFormats.Rtf); - } - catch (Exception) // Error while trying to access the clipboard - { // This happens when the ItemID Text Box at the bottom of the screen is used to paste - // a list of IDs using the context menu (Right-Click, Paste) - btnPaste.Enabled = false; - btnCMPasteText.Enabled = btnPasteText.Enabled = false; - btnCMPaste.Enabled = btnPasteStepText.Enabled = false; - } - } - // all selected copy while in either Edit or View mode - btnCMCopy.Enabled = btnCopy.Enabled = _MyStepRTB.SelectionLength > 0 && !MyItemInfo.IsRtfRaw; - - // paste step only available if a step was copied. Also, check for valid types: - SetPasteButtonEnabled(); - - // do all Transition and ReferencedObject menu items/buttons based on whether a 'link is selected' and the link type. - //btnCMGoTo.Enabled = btnGoTo.Enabled = _MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength); //(_MyStepRTB.MyLinkText != null); - SetupGoToButton(); - if (btnCMGoTo.Enabled == true && _MyStepRTB.MyLinkText != null) // must have some link test, use it to set edit of transition or ro... - { - btnCMEditTran.Enabled = _MyStepRTB.MyLinkText.IndexOf("Transition") > -1; // selected link must be a transition - btnCMEditRO.Enabled = _MyStepRTB.MyLinkText.IndexOf("ReferencedObject") > -1; // selected link must be ro - } - else - { - btnCMEditTran.Enabled = false; - btnCMEditRO.Enabled = false; - } - // OLD: SetStepButtonAndMenuEnabling(docontextmenus); - SetMenuEnablingForObjectsWOText(); - } - - private void SetMenuEnablingForObjectsWOText() - { - if (MyItemInfo.IsFigure || MyItemInfo.IsRtfRaw) - { - btnInsTrans.Enabled = btnCMTransition.Enabled = false; - btnInsRO.Enabled = btnCMRO.Enabled = false; - btnCMSymbol.Enabled = btnSymbols.Enabled = false; - btnCMHardSpace.Enabled = btnInsHrdSpc.Enabled = false; - btnIndent.Enabled = false; - btnCMBold.Enabled = btnBold.Enabled = false; - btnCMItalics.Enabled = btnItalics.Enabled = false; - btnCMUnderline.Enabled = btnUnderline.Enabled = false; - btnCMSubscript.Enabled = btnSubscript.Enabled = false; - btnCMSuperscript.Enabled = btnSuperscript.Enabled = false; - btnCMCut.Enabled = btnCut.Enabled = false; - btnCMUndo.Enabled = btnUndo.Enabled = false; - btnCMRedo.Enabled = btnRedo.Enabled = false; - btnChgCase.Enabled = false; - btnPaste.Enabled = false; - btnCMPaste.Enabled = false; - btnCMPasteText.Enabled = false; - if (MyItemInfo.IsRtfRaw) - { - btnCopy.Enabled = false; - btnCMCopy.Enabled = false; - } - } - } - - private void SetButtonEnablingForEnhanced(bool setting) - { - btnPaste.Enabled = btnCut.Enabled = setting; - btnUndo.Enabled = btnRedo.Enabled = setting; - rbFont.Enabled = rbStepType.Enabled = setting; - // if disabling the step buttons, first check if the step has 'linked' config data. If it does not, - // it can be deleted: - bool allowDel = false; - EnhancedDocuments eds = MyItemInfo.GetMyEnhancedDocuments(); - // note in follow if statements, 'setting' == false when in enhanced document: - if (setting && MyItemInfo.IsStep && (eds == null || eds.Count == 0)) // this step is in enhanced, but not linked // B2018-112 and is allowed to edit - allowDel = true; // allow delete if not linked - btnCpyStp.Enabled = MyUserInfo.IsAllowedToEdit(Mydvi); // C2017-031: Support for paste/replace an enhanced step - //B20170-158 Allow a Unlinked Step to be pasted before or after a linked step. - StepTabPanel tmp = Parent as StepTabPanel; - //B2020-058: crash on null reference - if (tmp != null && tmp.MyDisplayTabControl != null && tmp.MyDisplayTabControl.MyCopyStep != null) - { - //B2017-180: The fix for B2017-158 also needed the 'HasEnhancedLinkedStep' to check if the copied step is a source step - if (!tmp.MyDisplayTabControl.MyCopyStep.IsEnhancedStep && !tmp.MyDisplayTabControl.MyCopyStep.HasEnhancedLinkedStep) - { - if (MyItemInfo.IsEnhancedStep) btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false; - } - } - else - btnStepPaste.Enabled = setting; - rbnCharacters.Enabled = rbnParagraph.Enabled = rbnLinks.Enabled = setting; - btnCMEdit.Enabled = setting; - btnDelStep.Enabled = setting; // context menu item - btnDelelete.Enabled = setting; - if (allowDel) - { - btnDelStep.Enabled = true; - btnDelelete.Enabled = true; - } - btnPageBreak.Enabled = setting; // context menu item - btnCMHardSpace.Enabled = btnCMTransition.Enabled = btnCMRO.Enabled = btnCMSymbol.Enabled = setting; - btnFindRplDlg.Enabled = setting; // no find replace button is available when in an enhanced document - btnEditMode.Enabled = btnCMEditMode1.Enabled = setting; - if (((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) || - ((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations)) - { - btnCASCreate.Enabled = false; - btnTCASCreate.Enabled = false; // F2022-024 Time Critical Action Summary button - } - else - { - btnCASCreate.Enabled = (MyEditItem != null) ? (MyEditItem.MyStepPanel.ApplDisplayMode > 0) : false; - btnTCASCreate.Enabled = btnCASCreate.Enabled; // F2022-024 Time Critical Action Summary button - } - // B2016-237 added context menu item to change image size - // B2020-058 added check for null MyEditItem - btnCMImgSz.Enabled = MyEditItem!=null && MyEditItem.MyItemInfo.IsFigure && (MyEditItem.MyItemInfo.MyContent.MyImage != null || MyEditItem.MyItemInfo.MyContent.Text.ToUpper().Contains("#LINK")); - } - - // Made a public method so that it can be called when a step is deleted from the tree view. - // part of bug fix for B2016-005 - jsj 4-19-2016 - public void SetPasteButtons(bool enable) - { - btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = enable; - btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = enable; - //B20170-158 Don't allow a step to replace a linked step - //B2017-180: The fix for B2017-158 also needed the 'HasEnhancedLinkedStep' to check if the copied step is a source step - // C2017-031: Support for paste/replace an enhanced step, enable button - btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = enable; - } - private void SetPasteButtonEnabled() - { - #region new code - StepTabPanel tmp = Parent as StepTabPanel; - if (tmp == null) return; - //turn all on - SetPasteButtons(true); - //copy item is null, turn all off and return - if (tmp.MyDisplayTabControl.MyCopyStep == null) - { - SetPasteButtons(false); - return; - } - //if copy item is equation, can only paste if from an equation - if ((tmp.MyDisplayTabControl.MyCopyStep.IsRtfRaw && !MyItemInfo.IsRtfRaw) || (!tmp.MyDisplayTabControl.MyCopyStep.IsRtfRaw && MyItemInfo.IsRtfRaw)) - { - SetPasteButtons(false); - return; - } - //copy item is procedure, turn all off and return must be done from tree - if(tmp.MyDisplayTabControl.MyCopyStep.IsProcedure) - { - SetPasteButtons(false); - return; - } - //copy item is section - if (tmp.MyDisplayTabControl.MyCopyStep.IsSection && !MyItemInfo.IsSection) - { - SetPasteButtons(false); - return; - } - if (tmp.MyDisplayTabControl.MyCopyStep.IsSection && MyItemInfo.IsSection && tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID) - { - btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false; // don't replace itself - return; - } - // B2019-010 also don't allow paste step before/after if on an RNO step type (20040) - if (MyItemInfo.IsSupInfoPart || ((int)MyItemInfo.MyContent.Type) == 20040) // before and after are always false: - { - btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false; - btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false; - } - // for now (Jan 2016 - initial implementation of enhanced document support) do NOT paste any step (MyCopyStep) that has enhanced data associated - // with it unless pasting within a enhanced source document. The reason is that code would need to handle clearing the pasted enhanced config - // data if it is pasted into a non-enhanced location. - StepConfig stepToCfg = null; - bool fromSourceHasEnhancedLinks = false; - bool toSourceHasEnhancedLinks = false; - if (tmp.MyDisplayTabControl.MyCopyStep.IsHigh) - { - stepToCfg = tmp.MyDisplayTabControl.MyCopyStep.MyConfig as StepConfig; - if (stepToCfg.MyEnhancedDocuments != null && stepToCfg.MyEnhancedDocuments.Count > 0 && stepToCfg.MyEnhancedDocuments[0].Type != 0) fromSourceHasEnhancedLinks = true; - if (MyItemInfo.IsHigh) - { - stepToCfg = MyItemInfo.MyConfig as StepConfig; - if (stepToCfg.MyEnhancedDocuments != null && stepToCfg.MyEnhancedDocuments.Count > 0 && stepToCfg.MyEnhancedDocuments[0].Type != 0) toSourceHasEnhancedLinks = true; - } - } - //copy item is high level step - // Allow a High Level step to be pasted to a sub-step, but not to a table, figure, section or procedure type - if (tmp.MyDisplayTabControl.MyCopyStep.IsHigh && (MyItemInfo.IsTable || MyItemInfo.IsFigure || MyItemInfo.IsSection || MyItemInfo.IsProcedure)) - { - // commenting these lines out allows us to use Copy Step to copy a High Level Step - // to a sub-step level. - 05/18/2015 jsj - // changed above if so the the high level step cannot be paste to a Table, Figure, Section (on the editor panel), Procedure (on the editor panel) - jsj 09/17/2015 - SetPasteButtons(false); - return; - } - // don't allow a paste of a substep into a table, figure, sectino,or procedure type - // this also allows a substep (text) to be copyed to a high level step type C2015-011 - if (tmp.MyDisplayTabControl.MyCopyStep.IsSubStep && (MyItemInfo.IsTable || MyItemInfo.IsFigure || MyItemInfo.IsSection || MyItemInfo.IsProcedure)) - { - SetPasteButtons(false); - return; - } - // copy item is a table of figure - don't allow pasting at High Level Step, Caution or Note level, as well as not at a section or procedure level) - // Bug fix B2015-152 - if (tmp.MyDisplayTabControl.MyCopyStep.IsTable && !MyItemInfo.IsTable || tmp.MyDisplayTabControl.MyCopyStep.IsFigure && !MyItemInfo.IsFigure) - { - SetPasteButtons(false); - return; - } - //otherwise everything is ok except for same item prevent replace - if (tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID) - { - btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false; // don't replace itself - return; - } - #endregion - #region original code - //// if there is no 'copied' step, or if a procedure is copied, just turn all buttons off, this can only - //// be done from the tree. - //StepTabPanel tmp = Parent as StepTabPanel; - //if (tmp.MyDisplayTabControl.MyCopyStep == null || tmp.MyDisplayTabControl.MyCopyStep.IsProcedurePart) - //{ - // btnPasteReplace.Enabled = btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnStepPaste.Enabled = false; - // return; - //} - //// If a section is copied, it can be pasted as a section (before/after/replace). If can also - //// be pasted as a subsection if the format allows it. - //if (tmp.MyDisplayTabControl.MyCopyStep.IsSectionPart) - //{ - // btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = MyItemInfo.IsSectionPart; - // // when doing 'substep' part of paste, need to check if format allows subsection. - //} - //else if (tmp.MyDisplayTabControl.MyCopyStep.IsCautionPart || tmp.MyDisplayTabControl.MyCopyStep.IsNotePart) - // // Part type of copied step must be same as Part type of destination, with exceptions of caution/note and step/rno - // // can be pasted into each other. - // // Part types are procedure - 1, section = 2, step = 6, caution = 3, note = 4, RNO (IsRNO), = 5 table/figure = 7. - // btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = (MyItemInfo.IsCautionPart || MyItemInfo.IsNotePart); - //else if (tmp.MyDisplayTabControl.MyCopyStep.IsRNOPart || tmp.MyDisplayTabControl.MyCopyStep.IsStepPart) - // btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = (MyItemInfo.IsRNOPart || MyItemInfo.IsStepPart); - //else if (tmp.MyDisplayTabControl.MyCopyStep.IsTable && MyItemInfo.IsTable) - //{ - // btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnCMPasteBefore.Enabled = btnCMPasteAfter.Enabled = false; - // btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = true; - //} - //else if (tmp.MyDisplayTabControl.MyCopyStep.IsTable && !MyItemInfo.IsTable) - //{ - // btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnCMPasteBefore.Enabled = btnCMPasteAfter.Enabled = false; - // btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false; - //} - //// Can't replace step with same step - //if (tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID) btnPasteReplace.Enabled = false; - #endregion - } - private void SetChangeIdRibbon() - { - if (MyItemInfo == null) - { - FolderInfo fi = FolderInfo.Get(1); - FormatInfo frmI = FormatInfo.Get(fi.FormatID ?? 1); - rtabChgId.Visible = frmI.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds; - } - else - rtabChgId.Visible = MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds; - } - - #region submenu for printing child procedures - // C2020-013 add unit (child) submenu to create PDF and create CAS buttons - private void miMultiUnit_Click(object sender, EventArgs e) - { - if (MyItemInfo == null) return; // if creating a pdf before rtb exists, return; - DevComponents.DotNetBar.ButtonItem mi = sender as DevComponents.DotNetBar.ButtonItem; - DevComponents.DotNetBar.ButtonItem mip = mi.Parent as DevComponents.DotNetBar.ButtonItem; - int selectedChild = (int)mi.Tag; - if (selectedChild == 0) return; // unit (child) not selected - - MyItemInfo.MyProcedure.ProcedureConfig.SelectedSlave = (int) mi.Tag; - switch (mip.Text) - { - case "Create": - btnPdfCreate_Click(sender, e); - break; - case "Quick\r\nPrint": - btnPdfQuickCreate_Click(sender, e); - break; - case "Cont. Act\r\nSummary": - btnCASCreate_Click(sender, e); - break; - case "Time Crit\r\nSummary": - btnTCASCreate_Click(sender, e); - break; - } - MyItemInfo.MyProcedure.ProcedureConfig.SelectedSlave = 0; // unselect the unit (child) - } - public void SetParentChildCreatePDFButton(string[] unitNames, ItemInfo ii) - { - btnPdfCreate.SubItems.Clear(); - btnPdfCreate.Tag = null; - btnPdfCreate.Click -= new System.EventHandler(btnPdfCreate_Click); - btnPdfQuickCreate.SubItems.Clear(); - btnPdfQuickCreate.Tag = null; - btnPdfQuickCreate.Click -= new System.EventHandler(btnPdfQuickCreate_Click); - btnCASCreate.SubItems.Clear(); - btnCASCreate.Tag = null; - btnCASCreate.Click -= new System.EventHandler(btnCASCreate_Click); - btnTCASCreate.SubItems.Clear(); - btnTCASCreate.Tag = null; - btnTCASCreate.Click -= new System.EventHandler(btnTCASCreate_Click); - btnReviewCreatePDF.SubItems.Clear(); - btnReviewCreatePDF.Tag = null; - btnReviewCreatePDF.Click -= new System.EventHandler(btnPdfCreate_Click); - btnReviewPdfQuickCreate.SubItems.Clear(); - btnReviewPdfQuickCreate.Tag = null; - btnReviewPdfQuickCreate.Click -= new System.EventHandler(btnPdfQuickCreate_Click); - int k = 0; - foreach (string s in unitNames) - { - // C2021-027: Procedure level PC/PC - see if menu items for unit should be enabled - bool procAppl = ii.MyProcedure.ApplIncludeFromStr(s); - k++; - ButtonItem btn = MakeSubMenuButton(s, k, miMultiUnit_Click); - btn.Enabled = procAppl; - btnPdfCreate.SubItems.Add(btn); - btn = MakeSubMenuButton(s, k, miMultiUnit_Click); - btn.Enabled = procAppl; - btnPdfQuickCreate.SubItems.Add(btn); - btn = MakeSubMenuButton(s, k, miMultiUnit_Click); - btn.Enabled = procAppl; - btnReviewCreatePDF.SubItems.Add(btn); - btn = MakeSubMenuButton(s, k, miMultiUnit_Click); - btn.Enabled = procAppl; - btnCASCreate.SubItems.Add(btn); - btn = MakeSubMenuButton(s, k, miMultiUnit_Click); - btn.Enabled = procAppl; - btnTCASCreate.SubItems.Add(btn); - btn = MakeSubMenuButton(s, k, miMultiUnit_Click); - btn.Enabled = procAppl; - btnReviewPdfQuickCreate.SubItems.Add(btn); - } - btnPdfCreate.AutoExpandOnClick = true; - btnPdfQuickCreate.AutoExpandOnClick = true; - btnReviewCreatePDF.AutoExpandOnClick = true; - btnReviewPdfQuickCreate.AutoExpandOnClick = true; - btnCASCreate.AutoExpandOnClick = true; - btnTCASCreate.AutoExpandOnClick = true; - } - private DevComponents.DotNetBar.ButtonItem MakeSubMenuButton(string s, object tag, EventHandler ehandler) - { - DevComponents.DotNetBar.ButtonItem bi = new DevComponents.DotNetBar.ButtonItem(); - bi.Text = s; - bi.Tag = tag; - bi.Click += new System.EventHandler(ehandler); - return bi; - } - -#endregion // add submenu items to print child procedure - - private void SetStepButtonAndMenuEnabling(bool docontextmenus) - { - if (MyEditItem == null) return; - DocVersionInfo dvi = MyEditItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; - if (dvi == null) return; - if (dvi.VersionType > 127) - btnCMEditMode1.Enabled = btnEditMode.Enabled = false; // in approved - if (dvi.VersionType > 127 || MyEditItem.MyStepPanel.VwMode == E_ViewMode.View) - { - if (rtabTableGridTools.Checked) - rtabHome.Select(); - rtabTableGridTools.Visible = false; - SetButtonMenuEnabledDisabledOnStepType(false); - //C2019-036 View Only mode work with Checked Out Procedures - //Is in View Only Mode so show button as selected - btnEditMode.Checked = btnCMEditMode1.Checked = true; - this.Refresh(); - return; - } - else - SetButtonMenuEnabledDisabledOnStepType(true); - - btnInsPgBrk.Checked = false; - // see if manual page break - only available on HLS - if (MyItemInfo.IsHigh) - { - StepConfig cfg = MyItemInfo.MyConfig as StepConfig; - btnInsPgBrk.Checked = cfg == null ? false : cfg.Step_NewManualPagebreak; - } - btnInsPgBrk.Enabled = MyItemInfo.IsHigh; - btnPageBreak.Enabled = MyItemInfo.IsHigh; // edit context menu - - btnIndent.Checked = (_MyStepRTB.EditMode && _MyStepRTB.SelectionHangingIndent != 0); - btnEditMode.Checked = btnCMEditMode1.Checked = MyEditItem.MyStepPanel.VwMode == E_ViewMode.View; - // if on procedure, 'Delete' buttons should be disabled. - btnDelelete.Enabled = btnDelStep.Enabled = !MyItemInfo.IsProcedure; - // Only display the table edit tools if in a grid (table) and that grid (table) is not an RO Table. - GridItem tmpGridItm = MyEditItem as GridItem; - if (btnTblDgnAdjustSize.Checked) - { - btnTblDgnAdjustSize.Checked = false; - ToggleTableDesignButtons(true); - } - rtabTableGridTools.Visible = tmpGridItm != null; - // If no longer on a table (grid) or the newly selectd table is an RO table - // then select the Home tab (since the Table tab is not visable) - if ((!(MyEditItem is GridItem) && rtabTableGridTools.Checked)) // || ((MyEditItem is GridItem) && !rtabTableGridTools.Visible)) - { - rtabHome.Select(); - } - - // if on procedure or section, 'change type' & 'insert' buttons should be disabled. - if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) - { - btnInsCaut.Enabled = btnInsNote.Enabled = btnInsRNO.Enabled = btnInsFig.Enabled = - btnInsTable.Enabled = btnInsSubstep.Enabled = btnInsBefore.Enabled = btnInsAfter.Enabled = btnInsEquation.Enabled = false; - // if on a section, allow note/caution. May want to add condition that this is a subsection? - if (MyItemInfo.IsSection && MyItemInfo.IsStepSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AllowNoteCautionAdd) - { - btnInsNote.Enabled = true; - btnInsCaut.Enabled = true; - btnInsCaut.SubItems.Clear(); - btnInsNote.SubItems.Clear(); - if (docontextmenus) - { - btnCMInsCaution.SubItems.Clear(); - btnCMInsNote.SubItems.Clear(); - } - GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Caution, MyItemInfo.FormatStepData, btnInsCaut, (int)E_FromType.Caution, btnCMInsCaution, docontextmenus); - GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Note, MyItemInfo.FormatStepData, btnInsNote, (int)E_FromType.Note, btnCMInsNote, docontextmenus); - } - // if on a procedure or section title, don't allow for insert of ROs or Transitions: - // disable buttons. Info panels for ROs and Transitions are made invisible in frmVEPROMS.cs - btnInsTrans.Enabled = btnCMTransition.Enabled = btnInsRO.Enabled = btnCMRO.Enabled = false; - btnInsAftH.Enabled = btnInsBefH.Enabled = false; - //btnInsHLS.Enabled = (!MyItemInfo.IsStepSection || (MyItemInfo.IsStepSection && MyItemInfo.IsEnhancedSection)) ? false : true; // allow hls from step section - btnInsHLS.Enabled = !MyItemInfo.IsStepSection ? false : true; // allow hls from step section - // if active item is a section and format has metasections, check that a hls can be added. - if (MyItemInfo.IsStepSection) - { - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) - // The 'editable' data config must be set to allow new steps to be created. - { - SectionConfig sc = MyItemInfo.MyConfig as SectionConfig; - if (sc != null && MyItemInfo.Sections != null && MyItemInfo.Sections.Count > 0 && sc.SubSection_Edit != "Y") - btnInsHLS.Enabled = false; - } - } - if (btnInsHLS.Enabled) - { - btnInsHLS.SubItems.Clear(); - GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.HLS, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.HLS, btnInsHLS, (int)E_FromType.Step, btnCMInsHLS, docontextmenus); - } - // B2016-237 added context menu item to change image size - btnCMImgSz.Enabled = MyEditItem.MyItemInfo.IsFigure && (MyEditItem.MyItemInfo.MyContent.MyImage != null || MyEditItem.MyItemInfo.MyContent.Text.ToUpper().Contains("#LINK")); - if (MyItemInfo.IsSupInfoPart) btnInsAfter.Enabled = btnInsAftH.Enabled = btnInsBefore.Enabled = btnInsBefH.Enabled = false; - this.Refresh(); - return; - } - - btnChgTyp.Enabled = true; - - // set up insert buttons based on format - E_AccStep? actable = 0; - StepData sd = MyItemInfo.FormatStepData; - actable = sd.StepEditData.AcTable; - if (actable == null) actable = 0; - btnInsHLS.Enabled = MyItemInfo.MyHLS != null; - btnInsCaut.Enabled = ((actable & E_AccStep.AddingCaution) > 0) && !MyItemInfo.IsEnhancedStep; - btnInsNote.Enabled = ((actable & E_AccStep.AddingNote) > 0) && !MyItemInfo.IsEnhancedStep; - btnInsRNO.Enabled = (actable & E_AccStep.AddingRNO) > 0; - btnInsFig.Enabled = (actable & E_AccStep.AddingTable) > 0; - btnInsTable.Enabled = (actable & E_AccStep.AddingTable) > 0; - btnInsSubstep.Enabled = (actable & E_AccStep.AddingSub) > 0; - btnInsBefore.Enabled = btnInsBefH.Enabled = !MyItemInfo.IsRNOPart && !MyItemInfo.IsSupInfoPart && (actable & E_AccStep.AddingPrev) > 0; - btnInsAfter.Enabled = btnInsAftH.Enabled = !MyItemInfo.IsRNOPart && !MyItemInfo.IsSupInfoPart && (actable & E_AccStep.AddingNext) > 0; - btnInsEquation.Enabled = (actable & E_AccStep.AddingTable) > 0; - - // if this step has a table, figure or equation, disable both of those buttons. - if (MyItemInfo.Tables != null && MyItemInfo.Tables.Count > 0) - btnInsTable.Enabled = btnInsFig.Enabled = btnInsEquation.Enabled = btnCMInsFigure.Enabled = btnCMInsTable.Enabled = btnCMInsEquation.Enabled = false; - - btnInsHLS.SubItems.Clear(); - btnInsCaut.SubItems.Clear(); - btnInsNote.SubItems.Clear(); - btnInsRNO.SubItems.Clear(); - btnInsFig.SubItems.Clear(); - btnInsEquation.SubItems.Clear(); - btnInsTable.SubItems.Clear(); - btnInsSubstep.SubItems.Clear(); - - if (docontextmenus) - { - btnCMInsHLS.SubItems.Clear(); - btnCMInsCaution.SubItems.Clear(); - btnCMInsNote.SubItems.Clear(); - btnCMInsFigure.SubItems.Clear(); - btnCMInsEquation.SubItems.Clear(); - btnCMInsTable.SubItems.Clear(); - btnCMInsSubStps.SubItems.Clear(); - btnCMInsRNO.SubItems.Clear(); - btnCMInsEquation.Enabled = btnInsEquation.Enabled; - btnCMInsFigure.Enabled = btnInsFig.Enabled; - } - - btnInsRNO.Enabled = btnCMInsRNO.Enabled = btnInsRNO.Enabled && (MyItemInfo.RNOs == null || MyItemInfo.RNOs.Count == 0); // don't insert an RNO if has an RNO - - // if (rno is enabled, set the tag: - if (btnInsRNO.Enabled) - btnInsRNO.Tag = string.Format("{0} {1}", (int)E_FromTypes.RNOs, MyEditItem.MyItemInfo.ActiveFormat.PlantFormat.FormatData.GetIndexFromType("RNOType")); - // Proms Express/Message when substep level > 4 may have reset tooltip, so reset: - if (btnInsSubstep.Enabled) this.superTooltipRibbon.SetSuperTooltip(this.btnInsSubstep, new DevComponents.DotNetBar.SuperTooltipInfo("Insert Substep [Ctrl] [Shift] [S]", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - // add subitems depending on whether parent type is enabled: - if (btnInsHLS.Enabled) GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.HLS, sd, btnInsHLS, 0, btnCMInsHLS, docontextmenus); - if (btnInsCaut.Enabled) GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Caution, sd, btnInsCaut, (int)E_FromType.Caution, btnCMInsCaution, docontextmenus); - if (btnInsNote.Enabled) GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Note, sd, btnInsNote, (int)E_FromType.Note, btnCMInsNote, docontextmenus); - if (btnInsFig.Enabled) GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Fig, sd, btnInsFig, (int)E_FromType.Table, btnCMInsFigure, docontextmenus); - if (btnInsTable.Enabled) GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Table, sd, btnInsTable, (int)E_FromType.Table, btnCMInsTable, docontextmenus); - if (btnInsSubstep.Enabled) GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Substep, sd, btnInsSubstep, (int)E_FromType.Step, btnCMInsSubStps, docontextmenus); - if (btnInsRNO.Enabled) GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.RNO, sd, btnInsRNO, 0, btnCMInsRNO, docontextmenus); - if (btnInsEquation.Enabled) GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Equation, sd, btnInsEquation, (int)E_FromType.Table, btnCMInsEquation, docontextmenus); - btnInsTrans.Enabled = btnCMTransition.Enabled = !MyItemInfo.IsFigure && !MyItemInfo.IsRtfRaw; - btnInsRO.Enabled = btnCMRO.Enabled = Mydvi.DocVersionAssociationCount > 0; // 2016-128 don't enable if RO Path was not selected at the Working Draft node - - // C2014-009 Commented out to allow for inserting Note/Caution - //if in Calvert Alarms Condition/Response, disable insert of Cautions and Notes - //if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - //btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = !MyItemInfo.IsInCalvertConditionResponse; - - _RibbonControl.Refresh(); // jsj- added this because Table Design ribbon tab grouping was not going away when not on a table step type - } - /// - /// set up a gallery of step types whose parent are defined by input StepData. Can be below - /// more than one level, for example. Substep, EquipmentList, EquipmentWBlank - both equipment - /// lists would be put in gallery - /// - /// StepData: find subtypes related to this - /// StepData: this should be selected button - /// DevComponents.DotNetBar.ButtonItem: if items in the gallery, add gallery to this button - /// DevComponents.DotNetBar.ButtonItem: if items in the gallery, add btns to context menu - private void GalleryForSubTypes(StepData sdc, StepData selType, DevComponents.DotNetBar.ButtonItem btn, int fromtype, DevComponents.DotNetBar.ButtonItem cmbtn, bool docontextmenus) - { - int cursel = -1; - // The first argument (boolean) in StepGetLevelTypes provides the option to get a complete list of step types - // regardless of whether in the AER or RNO column (set to true). For all types, get both except for figures - // and tables. - bool getall = !(btn.Name == "btnInsFig" || btn.Name == "btnInsTable" || btn.Name == "btnInsEquation"); - List sdl = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepGetLevelTypes(getall, sdc, ref cursel, selType==null?"Section":selType.Type, MyItemInfo); - if (sdl != null && sdl.Count > 0) - { - Char kt = 'A'; // start with letter A for KeyTips - // if doing the insert substep button, check for substeps already there and if so must match type. - if (btn.Name == "btnInsSubstep") - { - if (MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0) - { - ItemInfo ichld = MyItemInfo.Steps[0]; - btn.Click -= new System.EventHandler(btnInsStep_Click); - btn.Click += new System.EventHandler(btnInsStep_Click); - btn.Tag = string.Format("{0} {1}", fromtype, ichld.MyContent.Type - 20000); - - // B2013-175: add the single substep type to the context menu too - int cmtype = (int)ichld.MyContent.Type - 20000; // content type is the index into the stepdatalist - StepData sdcm = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[cmtype]; - DevComponents.DotNetBar.ButtonItem cmbix = new DevComponents.DotNetBar.ButtonItem("cmbtn" + sdcm.Type, sdcm.Type); - cmbix.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbix.Text = sdcm.StepEditData.TypeMenu.MenuItem; - cmbix.Tag = string.Format("{0} {1}", fromtype, sdcm.Index); // index of type to insert it when button is clicked - cmbix.Click += new System.EventHandler(btnInsStep_Click); - cmbtn.SubItems.Add(cmbix); - return; - } - else - { - btn.Tag = null; - btn.Click -= new System.EventHandler(btnInsStep_Click); - } - } - foreach (StepDataRetval sdr in sdl) - { - bool addit = true; - StepData sd = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[sdr.Index]; - int hlsSubType = -1; // if on hls, use this to set default on substep menu to first child - if (MyItemInfo.IsHigh && MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0) - { - hlsSubType = (int)MyItemInfo.Steps[0].MyContent.Type - 20000; - } - // unfortunately, there are some special cases to be handled. - // if high level step, don't put the rno button on - // if caution don't add note button (the StepGetLevelTypes method returns cautions/notes together - if (btn.Name == "btnInsHLS" && sd.Type == "RNOType") addit = false; - if (btn.Name == "btnInsCaut" && sd.Type.Length >= 4 && sd.Type.Substring(0, 4) == "Note") addit = false; - if (btn.Name == "btnInsNote" && sd.Type.Length >= 7 && sd.Type.Substring(0, 7) == "Caution") addit = false; - if (btn.Name == "btnInsSubstep" && MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0) addit = false; - if (addit) - { - DevComponents.DotNetBar.ButtonItem bi = new DevComponents.DotNetBar.ButtonItem("btn" + sd.Type, sd.Type); - bi.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - bi.Text = sdr.Name; - bi.Tag = string.Format("{0} {1}", fromtype, sdr.Index); // index of type to insert it when button is clicked - bi.Checked = (selType == null || (sd.Type == selType.Type)); - if (docontextmenus) - { - DevComponents.DotNetBar.ButtonItem cmbi = new DevComponents.DotNetBar.ButtonItem("cmbtn" + sd.Type, sd.Type); - cmbi.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbi.Text = sdr.Name; - cmbi.Tag = string.Format("{0} {1}", fromtype, sdr.Index); // index of type to insert it when button is clicked - cmbi.Checked = (selType == null || (sd.Type == selType.Type)); - if(!AddVisioOrEqnEdt(cmbi)) // Added support for Visio - cmbi.Click += new System.EventHandler(btnInsStep_Click); - cmbtn.SubItems.Add(cmbi); - } - if (MyItemInfo.IsHigh && hlsSubType != -1 && sdr.Index == hlsSubType) bi.Checked = true; - if(!AddVisioOrEqnEdt(bi)) // Added support for Visio - bi.Click += new System.EventHandler(btnInsStep_Click); - // Assign only A-Z to the KeyTips in the list (i.e. assign only the first 24 in the list) - // Note that KeyTips logic support only single characters at this level (can't have 'AA' for example) - if (kt != '0') - { - bi.KeyTips = kt.ToString(); - if (kt == 'Z') - kt = '0'; - else - kt++; - } - btn.SubItems.Add(bi); - } - } - //handle various cases for figures: - if (btn.Name == "btnInsFig" && docontextmenus) DoFigureMenuing(btn, cmbtn, sdl); - - // if this is a table, then need to add RO/Text table options - if (btn.Name == "btnInsTable" && docontextmenus) - { - // If there is only one 'table' type from format under the ribbon's table item, - // eliminate that button and move up the RO & Text Table buttons. - // This is done for single column mode, or if in the calvertconditionresponse table (dual column) and in the rno column. Note - // the '&&' in if check because when in the calvertconditionresponse table, the section is in 'single column' mode even though - // the condition response table is dual column. This fixes B2014-105. - SectionConfig sc = (SectionConfig)MyItemInfo.ActiveSection.MyConfig; - // One Column Mode or Two Column Mode in the RNO Column or Caution or Note - if ((sc.Section_ColumnMode == SectionConfig.SectionColumnMode.One && (!MyItemInfo.IsInCalvertConditionResponse || MyItemInfo.IsInRNO)) - || (sc.Section_ColumnMode == SectionConfig.SectionColumnMode.Two && MyItemInfo.IsInRNO) - || ( MyItemInfo.IsCautionOrNotePart)) // single column step editor - { - // setup the sub menus for the insert table ribbon button - btn.Tag = btn.SubItems[0].Tag; - btn.SubItems.Clear(); - DoTableSubMenu(btn); - // setup the sub menus for the context menu used with the keyborad shortcut - cmbtn.Tag = cmbtn.SubItems[0].Tag; - cmbtn.SubItems.Clear(); - DoTableSubMenu(cmbtn); - } - else - { - // setup the sub menus for the insert table ribbon button - foreach (DevComponents.DotNetBar.ButtonItem tabbtn in btn.SubItems) - DoTableSubMenu(tabbtn); - // setup the sub menus for the context menu used with the keyborad shortcut - foreach (DevComponents.DotNetBar.ButtonItem cmtabbtn in cmbtn.SubItems) - DoTableSubMenu(cmtabbtn); - } - } - // if only 1, be sure event exists on button to insert item & if more than 1 remove event because - // we want the drop down to appear. - if (btn.Name != "btnInsRNO") - btn.Click -= new System.EventHandler(btnInsStep_Click); - if (docontextmenus) - cmbtn.Click -= new System.EventHandler(btnInsStep_Click); - if (btn.SubItems.Count == 1) - { - btn.SubItems.Clear(); - if (btn.Name != "btnInsRNO") - { - btn.Tag = string.Format("{0} {1}", fromtype, sdc.Index); - btn.Click += new System.EventHandler(btnInsStep_Click); - } - if (docontextmenus) - { - cmbtn.SubItems.Clear(); - DevComponents.DotNetBar.ButtonItem cmbi = new DevComponents.DotNetBar.ButtonItem("cmbtn" + sdc.Type, sdc.Type); - cmbi.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbi.Text = btn.Text; - if (btn.Name == "btnInsRNO") - cmbi.Tag = btn.Tag; - else - cmbi.Tag = string.Format("{0} {1}", fromtype, sdc.Index); // index of type to insert it when button is clicked - cmbi.Click += new System.EventHandler(btnInsStep_Click); - cmbtn.SubItems.Add(cmbi); - } - } - - } - // F2021-009 If in Proms Express, let user know if they are going to create a new substep deeper than the defined number of sub-step. - // This uses the tool tip to display the message. - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.Express && btn.Name == "btnInsSubstep" && (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0)) - { - if (MyItemInfo.GetStepLevel() >= MyItemInfo.GetDefinedSubStepCount()) - { - string tpMsg = "Steps with excessive sub-step levels can be difficult to follow." + - "\nConsider rewriting the step using less sub-steps levels."; - this.superTooltipRibbon.SetSuperTooltip(this.btnInsSubstep, new DevComponents.DotNetBar.SuperTooltipInfo(tpMsg, "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Red)); - } - } - rbnStepParts.Refresh(); - } - // Added Support for Visio - private bool AddVisioOrEqnEdt(DevComponents.DotNetBar.ButtonItem cmbi) - { - if (cmbi.Text.Contains("Equation") && OleObjectEditors == 3) - { - DevComponents.DotNetBar.ButtonItem btn1 = new DevComponents.DotNetBar.ButtonItem("btnEquation", "Equation Editor"); - btn1.Click += new System.EventHandler(btnInsStep_Click); - btn1.Tag = cmbi.Tag + " EqnEdt"; - btn1.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - //btn1.Tag = string.Format("Equation"); // index of type to insert it when button is clicked - cmbi.SubItems.Add(btn1); - DevComponents.DotNetBar.ButtonItem btn2 = new DevComponents.DotNetBar.ButtonItem("btnVisio", "Visio"); - btn2.Click += new System.EventHandler(btnInsStep_Click); - btn2.Tag = cmbi.Tag + " Visio"; - btn2.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbi.SubItems.Add(btn2); - return true; - } - return false; - } - // From Figure menuing, need to map those strings to the index in the StepdataList for setting item's content type: - // - // - // - // - private int Centered = 36; // will always be top level. - private void DoFigureMenuing(ButtonItem btn, ButtonItem cmbtn, List sdl) - { - // Figure menuing: - // Figure (from ribbon) - // If in AER Column: - // Centered - // Left - // From both Centered & Left: - // With Border - // Without Border - // From both w/wo Border: - // RO Figure - // Figure from Clipboard - // Figure From File - // If in RNO column or single column mode (see comment below for this menu): - // With Border - // Without Border - // From both w/wo Border: - // RO Figure - // Figure from Clipboard - // Figure From File - - // This is done for single column mode, or if in the calvertconditionresponse table (dual column) and in the rno column. Note - // the '&&' in if check because when in the calvertconditionresponse table, the section is in 'single column' mode even though - // the condition response table is dual column. - SectionConfig sc = (SectionConfig)MyItemInfo.ActiveSection.MyConfig; - // One Column Mode or Two Column Mode in the RNO Column or Caution or Note - if ((sc.Section_ColumnMode == SectionConfig.SectionColumnMode.One && (!MyItemInfo.IsInCalvertConditionResponse || MyItemInfo.IsInRNO)) - || (sc.Section_ColumnMode == SectionConfig.SectionColumnMode.Two && MyItemInfo.IsInRNO) - || (MyItemInfo.IsCautionOrNotePart)) // single column step editor - { - // setup the sub menus for the insert table ribbon button - btn.Tag = btn.SubItems[0].Tag; - btn.SubItems.Clear(); - DoFigureW_WOborderSubMenu(btn); - // setup the sub menus for the context menu used with the keyborad shortcut - cmbtn.Tag = cmbtn.SubItems[0].Tag; - cmbtn.SubItems.Clear(); - DoFigureW_WOborderSubMenu(cmbtn); - } - else - { - // this is AER column in dual column-need to add 'Centered' & 'Left' - char[] sp = { ' ' }; - btn.Tag = btn.SubItems[0].Tag; - btn.SubItems.Clear(); - string[] insdata = btn.Tag.ToString().Split(sp); - int ftype = Convert.ToInt32(insdata[0]); - int sdtype = Convert.ToInt32(insdata[1]); - DevComponents.DotNetBar.ButtonItem cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "CENT", "Centered"); - cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbt.Text = "Centered"; - cmbt.Tag = string.Format("{0} {1} {2}", ftype, 36, "CENT"); - cmbt.Click += new System.EventHandler(btnInsStep_Click); - btn.SubItems.Add(cmbt); - cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "LT", "Left"); - cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbt.Text = "Left"; - cmbt.Tag = string.Format("{0} {1} {2}", ftype, 37, "LT"); // Text table - cmbt.Click += new System.EventHandler(btnInsStep_Click); - btn.SubItems.Add(cmbt); - btn.Tag = null; - btn.Click -= new System.EventHandler(btnInsStep_Click); - // setup the sub menus for the insert figure ribbon button - foreach (DevComponents.DotNetBar.ButtonItem tabbtn in btn.SubItems) - DoFigureW_WOborderSubMenu(tabbtn); - // setup the sub menus for the context menu used with the keyborad shortcut - foreach (DevComponents.DotNetBar.ButtonItem cmtabbtn in cmbtn.SubItems) - DoFigureW_WOborderSubMenu(cmtabbtn); - } - } - private void DoFigureW_WOborderSubMenu(DevComponents.DotNetBar.ButtonItem tabbtn) - { - char[] sp = { ' ' }; - string[] insdata = tabbtn.Tag.ToString().Split(sp); - int ftype = Convert.ToInt32(insdata[0]); - int sdtype = Convert.ToInt32(insdata[1]); - int with = sdtype == Centered ? 36 : 37; - DevComponents.DotNetBar.ButtonItem cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "BD", "With Border"); - cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbt.Text = "With Border"; - cmbt.Tag = string.Format("{0} {1} {2}", ftype, sdtype, "BD"); - cmbt.Click += new System.EventHandler(btnInsStep_Click); - tabbtn.SubItems.Add(cmbt); - DoFigureFromSubMenu(cmbt); - int wo = sdtype == Centered ? 38 : 39; - cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + wo + "NB", "Without Border"); - cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbt.Text = "Without Border"; - cmbt.Tag = string.Format("{0} {1} {2}", ftype, wo, "NB"); - cmbt.Click += new System.EventHandler(btnInsStep_Click); - tabbtn.SubItems.Add(cmbt); - DoFigureFromSubMenu(cmbt); - tabbtn.Tag = null; - tabbtn.Click -= new System.EventHandler(btnInsStep_Click); - } - private void DoFigureFromSubMenu(DevComponents.DotNetBar.ButtonItem tabbtn) - { - char[] sp = { ' ' }; - string[] insdata = tabbtn.Tag.ToString().Split(sp); - int ftype = Convert.ToInt32(insdata[0]); - int sdtype = Convert.ToInt32(insdata[1]); - DevComponents.DotNetBar.ButtonItem cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "RO", "RO Figure"); - cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbt.Text = "RO Figure"; - cmbt.Tag = string.Format("{0} {1} {2}", ftype, sdtype, "RO"); - cmbt.Click += new System.EventHandler(btnInsStep_Click); - tabbtn.SubItems.Add(cmbt); - cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "CL", "From Clipboard"); - cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbt.Text = "From Clipboard"; - cmbt.Tag = string.Format("{0} {1} {2}", ftype, sdtype, "CL"); - cmbt.Click += new System.EventHandler(btnInsStep_Click); - tabbtn.SubItems.Add(cmbt); - cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "FL", "From File"); - cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbt.Text = "From File"; - cmbt.Tag = string.Format("{0} {1} {2}", ftype, sdtype, "FL"); // Text table - cmbt.Click += new System.EventHandler(btnInsStep_Click); - tabbtn.SubItems.Add(cmbt); - tabbtn.Tag = null; - tabbtn.Click -= new System.EventHandler(btnInsStep_Click); - } - private void DoTableSubMenu(DevComponents.DotNetBar.ButtonItem tabbtn) - { - char[] sp = { ' ' }; - string[] insdata = tabbtn.Tag.ToString().Split(sp); - int ftype = Convert.ToInt32(insdata[0]); - int sdtype = Convert.ToInt32(insdata[1]); - DevComponents.DotNetBar.ButtonItem cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "RO", "RO Table"); - cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbt.Text = "RO Table"; - cmbt.Tag = string.Format("{0} {1} {2}", ftype, sdtype, "RO"); - //cmbt.Checked = (sd.Type == selType.Type); - cmbt.Click += new System.EventHandler(btnInsStep_Click); - tabbtn.SubItems.Add(cmbt); - cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "TX", "Text Table"); - cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; - cmbt.Text = "Text Table"; - cmbt.Tag = string.Format("{0} {1} {2}", ftype, sdtype, "TX"); // Text table - //cmbt.Checked = (sd.Type == selType.Type); - cmbt.Click += new System.EventHandler(btnInsStep_Click); - tabbtn.SubItems.Add(cmbt); - tabbtn.Tag = null; - tabbtn.Click -= new System.EventHandler(btnInsStep_Click); - } - #endregion - #region Insert Tab - private void btnSym_Click(object sender, EventArgs e) - { - DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender; - StartGridEditing(SelectionOption.Start); // If in a FlexGrid, start the editor for a cell - _MyStepRTB.InsertSymbol(Convert.ToInt32(b.Tag)); - } - private enum SelectionOption - { - Start, - All, - End - } - /// - /// If in a FlexGrid, start the editor for a cell - /// - /// If false cursor will be placed at the begining - private void StartGridEditing(SelectionOption selOpt) - { - // Bug fix: B2012-203, B2012-204 - // Need to check if the selected table cell is in edit mode already. - // if already in edit mode, we don't want to do the StartEditing code below, because it - // will override the current cursor positioning and selection range. - Control ctrl = FindActiveControl(); - if (ctrl == null) return; // B2018-008 If a null is returned, don't do anything - if (ctrl is VlnFlexGrid) - { - // Selected table cell is not in edit mode. Go into edit mode and position acording - // to the pass in selOpt. - if (MyFlexGrid != null && MyFlexGrid.Editor == null) - { - MyFlexGrid.StartEditing(); - switch (selOpt) - { - case SelectionOption.Start: - MyStepRTB.Select(0, 0); - break; - case SelectionOption.All: - MyStepRTB.SelectAll(); - break; - case SelectionOption.End: - MyStepRTB.Select(MyStepRTB.TextLength, 0); - break; - default: - MyStepRTB.Select(0, 0); - break; - } - } - } - } - // C2016-029 apply a style (bold,italics,underline,text case) to the selected grid cells - // This method will apply the past in style to either the selected grid cells or to the currently selected step type - private void ApplyStyleToCurrentStepOrGridSelection(SelectionOption selOpt, CellRangeApplyStyle applyStyle) - { - // Need to check if the selected table cell is in edit mode already. - // if already in edit mode, we don't want to do the StartEditing code below, because it - // will override the current cursor positioning and selection range. - Control ctrl = FindActiveControl(); - if (ctrl == null) return; // B2018-008 if a null is returned don't do anything - if (ctrl is VlnFlexGrid) - { - // Selected table cell is not in edit mode. Go into edit mode and position according - // to the pass in selOpt. - if (MyFlexGrid != null && MyFlexGrid.Editor == null) - { - C1.Win.C1FlexGrid.CellRange cr = MyFlexGrid.Selection; // get the selected grid cell range - for (int r = cr.r1; r <= cr.r2; r++) - for (int c = cr.c1; c <= cr.c2; c++) - { - MyFlexGrid.Select(r, c); - MyFlexGrid.StartEditing(); - switch (selOpt) - { - case SelectionOption.Start: - MyStepRTB.Select(0, 0); - break; - case SelectionOption.All: - MyStepRTB.SelectAll(); - break; - case SelectionOption.End: - MyStepRTB.Select(MyStepRTB.TextLength, 0); - break; - default: - MyStepRTB.Select(0, 0); - break; - } - applyStyle(); - } - MyFlexGrid.Select(cr); - } - } - else - applyStyle(); // not in a grid, apply style to current step type - } - //C2021-005 the font size for the selected table cell(s) - private float GetTableCellFontSize(SelectionOption selOpt) - { - // return 0 if there are multiple font sizes or just an invalid selection - float rtnFontSize = -1; - // Need to check if the selected table cell is already in edit mode. - // if already in edit mode, we don't want to do the StartEditing code below, because it - // will override the current cursor positioning and selection range. - Control ctrl = FindActiveControl(); - if (ctrl == null) return rtnFontSize; // B2018-008 if a null is returned don't do anything - if (ctrl is VlnFlexGrid) - { - // Selected table cell is not in edit mode. Go into edit mode and position according - // to the pass in selOpt. - // B2021-090 don't try to get the font size on an RO table - // B2022-137 Table performance improvements - if (MyFlexGrid != null && MyFlexGrid.Editor == null && !MyFlexGrid.IsRoTable) - { - rtnFontSize = StepRTB.GetRTFFontSize(MyFlexGrid.Selection.Clip); - } - else - rtnFontSize = MyStepRTB.GetRTFFontSize(); // returns 0 when there are mulitiple font sizes - } - return rtnFontSize; - } - // C2021-005 change the font size of the selected table cell(s) or cell text - private void ChangeFontSize(SelectionOption selOpt, float newSize) - { - // ChangeFontSize: similar to code that sets styles (above) except do the font size instead. - // Need to check if the selected table cell is already in edit mode. - // if already in edit mode, we don't want to do the StartEditing code below, because it - // will override the current cursor positioning and selection range. - Control ctrl = FindActiveControl(); - if (ctrl == null) return; // B2018-008 if a null is returned don't do anything - if (ctrl is VlnFlexGrid) - { - // Selected table cell is not in edit mode. Go into edit mode and position according - // to the pass in selOpt. - if (MyFlexGrid != null && MyFlexGrid.Editor == null) - { - C1.Win.C1FlexGrid.CellRange cr = MyFlexGrid.Selection; // get the selected grid cell range - for (int r = cr.r1; r <= cr.r2; r++) - for (int c = cr.c1; c <= cr.c2; c++) - { - MyFlexGrid.Select(r, c); - MyFlexGrid.StartEditing(); - switch (selOpt) - { - case SelectionOption.Start: - MyStepRTB.Select(0, 0); - break; - case SelectionOption.All: - MyStepRTB.SelectAll(); - break; - case SelectionOption.End: - MyStepRTB.Select(MyStepRTB.TextLength, 0); - break; - default: - MyStepRTB.Select(0, 0); - break; - } - ChangeTableTextFontSize(newSize); // Apply font size to selected cells - } - MyFlexGrid.Select(cr); - } - else - { - int ss = MyStepRTB.SelectionStart; - int sl = MyStepRTB.SelectionLength; - MyStepRTB.OnReturnToEditor(this, new EventArgs()); - MyStepRTB.Select(ss, sl); - ChangeTableTextFontSize(newSize); - } - } - else - { - if (MyStepRTB != null) - { - // the table cell editor lost focus when the font size dropdown is active - // Save the text selection information because when we re-activate it the selection - // will be lost. - // the logic below was copied from the Save Transition button function - int ss = MyStepRTB.SelectionStart; - int sl = MyStepRTB.SelectionLength; - MyStepRTB.OnReturnToEditor(this, new EventArgs()); - MyStepRTB.Select(ss, sl); - ChangeTableTextFontSize(newSize); - - } - } - } - - // B2021-052 table cell text that ends with a link (RO or Transition) was not accepting a change in font size - private void ChangeTableTextFontSize(float newSize) - { - int ss = MyStepRTB.SelectionStart; - int sl = MyStepRTB.SelectionLength; - bool addedSpace = false; - // B2021-052 if the table cell text end with a link, then append a space to the end and reselect the text - if ((sl == MyStepRTB.TextLength || MyStepRTB.SelectedText.EndsWith("[END>")) && MyStepRTB.Text.EndsWith("[END>")) - { - addedSpace = true; - MyStepRTB.OnReturnToEditor(this, new EventArgs()); //reset and refocus to the table cell rtf edtior - MyStepRTB.AppendText(" "); - MyStepRTB.Select(ss, sl); - } - MyStepRTB.SetFontSize(newSize); // change the font size of the selection - // B2021-052 if a space as added, remove the space - if (addedSpace) - { - MyStepRTB.OnReturnToEditor(this, new EventArgs()); - MyStepRTB.Select(MyStepRTB.TextLength - 1, 1); // select the space at the end of the text - MyStepRTB.SelectedText = ""; // remove the space - MyStepRTB.Select(ss, sl); - } - } - - private void ToggleBold() - { - RTBAPI.ToggleBold(!RTBAPI.IsBold(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION); - } - - public void btnInsPgBrk_Click(object sender, EventArgs e) - { - //rtabInsert.Select(); // insert page break is no longer visible on the ribbon - if (MyItemInfo.IsProcedure || MyItemInfo.IsSection || !MyItemInfo.IsHigh) return; - MyEditItem.SaveContents(); - // toggle manual page break - StepConfig cfg = MyItemInfo.MyConfig as StepConfig; - cfg.Step_NewManualPagebreak = !cfg.Step_NewManualPagebreak; - btnPageBreak.Checked = btnInsPgBrk.Checked = cfg.Step_NewManualPagebreak; - } - private void btnIndent_Click(object sender, EventArgs e) - { - if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return; - // Use the button as a toggle, i.e. if indent is on - turn it off. If indent is off, use the current cursor - // location to turn it on. - // The print tool (iTextSharp) only supports 1 indent per paragraph, i.e. steprtb (that is also a table cell) - // so the user interface only allows for 1 indent. Note that soft returns maintain the hanging indent & hard - // returns do not maintain it for the FIRST line after the hard return, but any wrapping lines will indent to - // the hanging indent location. - - // The following code sets the hanging indent for the entire rtb by selecting all. Without - // this multiple hanging indents could be done - but it didn't appear that way in the user - // interface since the button just toggled on/off. - int savIndent = _MyStepRTB.GetPositionFromCharIndex(_MyStepRTB.SelectionStart).X; - int selStart = _MyStepRTB.SelectionStart; - int selLength = _MyStepRTB.SelectionLength; - _MyStepRTB.SelectAll(); - if (_MyStepRTB.SelectionHangingIndent != 0) // this is what does the 'toggle' indent off - _MyStepRTB.SelectionHangingIndent = 0; - else - _MyStepRTB.SelectionHangingIndent = savIndent; - btnIndent.Checked = _MyStepRTB.SelectionHangingIndent != 0; - _MyStepRTB.SelectionStart = selStart; - _MyStepRTB.SelectionLength = selLength; - } - private void btnCMIndent_Click(object sender, EventArgs e) - { - if (_MyStepRTB.SelectionHangingIndent != 0) - _MyStepRTB.SelectionHangingIndent = 0; - else - _MyStepRTB.SelectionHangingIndent = _MyStepRTB.GetPositionFromCharIndex(_MyStepRTB.SelectionStart).X; - btnIndent.Checked = _MyStepRTB.SelectionHangingIndent != 0; - } - #endregion - #region Home Tab - private bool _PastePlainTextOvrRide = false; - private bool _PasteStepTextOvrRide = false; - private void btnPaste_Click(object sender, EventArgs e) - { - StartGridEditing(SelectionOption.End); - IDataObject myDO = Clipboard.GetDataObject(); - RichTextBox myRtb = _MyStepRTB; - Control ctrl = FindActiveControl(); // null if on property page for procedure & section number/title - - if (ctrl != null && !_MyStepRTB.Focused) - { - if (ctrl is RichTextBox) - { - myRtb = ctrl as RichTextBox; - } - else if (ctrl is ComboBox) - { - ComboBox cmb = ctrl as ComboBox; - if (myDO.GetDataPresent(DataFormats.UnicodeText)) - cmb.SelectedText = myDO.GetData(DataFormats.UnicodeText).ToString(); - else if (myDO.GetDataPresent(DataFormats.Text)) - cmb.SelectedText = myDO.GetData(DataFormats.Text).ToString(); - _PastePlainTextOvrRide = false; - _PasteStepTextOvrRide = false; - return; - } - else - { - SaveErrorInLogProblemWithType(ctrl); - _PastePlainTextOvrRide = false; - _PasteStepTextOvrRide = false; - return; - } - } - // check if rtf is coming from Word, i.e. if it has 'SCHEMAS.MICROSOFT.COM/OFFICE/WORD'. - // If it is coming from Word, it will be pasted as text so as not to get any rtf commands - // that PROMS does not support such as odd Fonts, other symbols, etc. This isn't a complete - // solution, clipboard data may come from other 3rd-party tools and unsupported Rtf may get - // pasted in. But the hope is that this will happen less often than getting it from MS Word. - if (myDO.GetDataPresent(DataFormats.Rtf) && (_PasteStepTextOvrRide || (!_PastePlainTextOvrRide && !PastePlainTextSetting))) - { - string tmpForLink = myDO.GetData(DataFormats.Rtf).ToString().Replace("\r\n", ""); - if (tmpForLink.ToUpper().Contains(@"SCHEMAS.MICROSOFT.COM/OFFICE/WORD")) - myRtb.SelectedText = _MyStepRTB.GetPasteText(PasteNoReturnsSetting, myDO); - else - { - tmpForLink = ItemInfo.ReplaceLinkWithNewID(tmpForLink); - myRtb.SelectedRtf = tmpForLink; - // Fix for B2014-071: if link, save after paste so that goto's don't crash (grid & step run through this code) - if (tmpForLink.Contains("")) _MyStepRTB.OnDoSaveContents(this, new EventArgs()); - } - - } - else if (myDO.GetDataPresent(DataFormats.Text)) - { - //CSM B2023-095/U2022-004 When Copy/Pasting Symbols, some of the symbols paste in an incorrect font - // Changed this to put in the unicode code for any symbols outside the normal ascii range - // Also need to input as an RTF so that correct font is used with these - // and unicode is converted to actual text - string clipboardtext = _MyStepRTB.GetPasteText(PasteNoReturnsSetting, myDO, true); - myRtb.SelectedRtf = _MyStepRTB.RtfPrefixForSymbols + clipboardtext + @"}"; - } - if (myRtb.SelectionLength == 0 && myRtb is StepRTB) myRtb.SelectionFont = (myRtb as StepRTB).MyStyleFont.WindowsFont; - _PastePlainTextOvrRide = false; - _PasteStepTextOvrRide = false; - } - private void SaveErrorInLogProblemWithType(Control ctrl) - { - StringBuilder errormsg = new StringBuilder(string.Format("Failed clipboard action with control {0} a {1} ", ctrl.Name, ctrl.GetType().Name)); - Type typ = ctrl.GetType(); - while (typ.Name != "Control") - { - errormsg.Append(string.Format(", dervied from {0}", typ.BaseType.Name)); - typ = typ.BaseType; - } - _MyLog.Error(errormsg); - } - private Control FindActiveControl() - { - // added the flag below because a table (grid) could have a cell selected (a control) - // but it might not have focus (in edit mode) - bool beenThereDoneThat = false; // flag to prevent infinate loop - Control tmp = this; - while (!(tmp.Parent is Form)) - { - tmp = tmp.Parent; - // if coming from property page (properties of procedure & section number/title), - // B2018-008 tmp becomes _MyStepRTB rather than from flexgrid or steptext. - if (tmp == null) return _MyStepRTB; - } - Form frm = tmp.Parent as Form; - tmp = frm.ActiveControl; - while (!beenThereDoneThat && tmp.Controls.Count > 0) - { - beenThereDoneThat = true; - foreach (Control ctrl in tmp.Controls) - if (ctrl.ContainsFocus) - { - tmp = ctrl; - beenThereDoneThat = false; - break; - } - } - return tmp; - } - private void btnCut_Click(object sender, EventArgs e) - { - StartGridEditing(SelectionOption.All); - MoveSelectedToClipboard(true); - } - private void MoveSelectedToClipboard(bool isCut) - { - Control ctrl = FindActiveControl(); - if (ctrl == null) return; // B2018-008 If a null is returned, don't do anything - Clipboard.Clear(); - //if (_MyStepRTB == null) return; - if (_MyStepRTB.SelectedText == null || _MyStepRTB.SelectedText == "") - return; // nothing to copy onto clipboard, just return - DataObject myDO = new DataObject(); ; - if (ctrl is RichTextBox) - { - //myDO = new DataObject("Rich Text Format", (ctrl as RichTextBox).SelectedRtf); - string tmp2 = _MyStepRTB.SelectedText; - string tmp = _MyStepRTB.GetSelectionForClipBoard(); - tmp2 = Regex.Replace(tmp2, @"#Link:ReferencedObject:[0-9]+ +[0-9a-zA-Z]+ [0-9]+", @""); - tmp2 = Regex.Replace(tmp2, @"#Link:Transition:([0-9]+) [0-9]+ [1-9]+", @""); - tmp2 = Regex.Replace(tmp2, @"#Link:TransitionRange:([0-9]+) [0-9]+ [0-9]+ [0-9]+", ""); - tmp2 = tmp2.Replace("", ""); - myDO.SetText(tmp2, TextDataFormat.Text); - //myDO.SetText(_MyStepRTB.SelectedRtf, TextDataFormat.Rtf); - myDO.SetText(tmp, TextDataFormat.Rtf); - if (isCut) (ctrl as RichTextBox).SelectedText = ""; - } - else if (ctrl is ComboBox) - { - //myDO = new DataObject("Text Format", (ctrl as ComboBox).SelectedText); - myDO.SetText((ctrl as ComboBox).SelectedText, TextDataFormat.Text); - if (isCut) (ctrl as ComboBox).SelectedText = ""; - } - else if (ctrl is TextBox) - { - //myDO = new DataObject("Text Format", (ctrl as TextBox).SelectedText); - myDO.SetText((ctrl as TextBox).SelectedText, TextDataFormat.Text); - if (isCut) (ctrl as TextBox).SelectedText = ""; - } - else - { - SaveErrorInLogProblemWithType(ctrl); - return; - } - //DataObject myDO; - //if (ctrl is RichTextBox) - //{ - // myDO = new DataObject("Rich Text Format", (ctrl as RichTextBox).SelectedRtf); - // myDO.SetText(_MyStepRTB.SelectedText); - // if(isCut) (ctrl as RichTextBox).SelectedText = ""; - //} - //else if (ctrl is ComboBox) - //{ - // myDO = new DataObject("Text Format", (ctrl as ComboBox).SelectedText); - // if (isCut) (ctrl as ComboBox).SelectedText = ""; - //} - //else if (ctrl is TextBox) - //{ - // myDO = new DataObject("Text Format", (ctrl as TextBox).SelectedText); - // if (isCut) (ctrl as TextBox).SelectedText = ""; - //} - //else - //{ - // SaveErrorInLogProblemWithType(ctrl); - // return; - //} - Clipboard.SetDataObject(myDO); - } - private void btnCopy_Click(object sender, EventArgs e) - { - StartGridEditing(SelectionOption.All); - MoveSelectedToClipboard(false); - } - private void btnBold_Click(object sender, EventArgs e) - { - ApplyStyleToCurrentStepOrGridSelection(SelectionOption.All,ToggleBold); - // B2017-208 toggle on/off attributes button checks when you edit table cells, going from one cell to another - // Also don't keep the attributes buttons checked after setting a group of table cells all at one time - btnCMBold.Checked = btnBold.Checked = RTBAPI.IsBold(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - } - private void btnItalics_Click(object sender, EventArgs e) - { - ApplyStyleToCurrentStepOrGridSelection(SelectionOption.All,ToggleItalic); - // B2017-208 toggle on/off attributes button checks when you edit table cells, going from one cell to another - // Also don't keep the attributes buttons checked after setting a group of table cells all at one time - btnCMItalics.Checked = btnItalics.Checked = RTBAPI.IsItalic(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - } - - private void ToggleItalic() - { - RTBAPI.ToggleItalic(!RTBAPI.IsItalic(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION); - } - private void btnUnderline_Click(object sender, EventArgs e) - { - ApplyStyleToCurrentStepOrGridSelection(SelectionOption.All, ToggleUnderline); - // B2017-208 toggle on/off attributes button checks when you edit table cells, going from one cell to another - // Also don't keep the attributes buttons checked after setting a group of table cells all at one time - btnCMUnderline.Checked = btnUnderline.Checked = RTBAPI.IsUnderline(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - } - - private void ToggleUnderline() - { - RTBAPI.ToggleUnderline(!RTBAPI.IsUnderline(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION); - } - - public void btnSuperscript_Click(object sender, EventArgs e) - { - StartGridEditing(SelectionOption.All); - RTBAPI.ToggleSuperscript(!RTBAPI.IsSuperScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION); - btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB); - } - - public void btnSubscript_Click(object sender, EventArgs e) - { - StartGridEditing(SelectionOption.All); - RTBAPI.ToggleSubscript(!RTBAPI.IsSubScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION); - btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyStepRTB); - } - - private void btnUppercase_Click(object sender, EventArgs e) - { - ApplyStyleToCurrentStepOrGridSelection(SelectionOption.All, SetUpperCase); - } - - private void SetUpperCase() - { - _MyStepRTB.SetSelectedCase('U'); - } - - private void btnLowercase_Click(object sender, EventArgs e) - { - ApplyStyleToCurrentStepOrGridSelection(SelectionOption.All, SetLowerCase); - } - - private void SetLowerCase() - { - _MyStepRTB.SetSelectedCase('l'); - } - - private void btnTitleCase_Click(object sender, EventArgs e) - { - ApplyStyleToCurrentStepOrGridSelection(SelectionOption.All, SetTitleCase); - } - - private void SetTitleCase() - { - _MyStepRTB.SetSelectedCase('T'); - } - private void btnInsTrans_Click(object sender, EventArgs e) - { - StartGridEditing(SelectionOption.Start); - // see if user is positioned 'on' a transition within the rtb, if so do a modify, otherwise, - // insert transition. - StepTabPanel tmp = Parent as StepTabPanel; - tmp.MyDisplayTabControl.OnLinkModifyTran(this, new StepPanelLinkEventArgs(MyStepRTB.MyLinkText)); - } - - private void btnInsHrdSpc_Click(object sender, EventArgs e) - { - StartGridEditing(SelectionOption.Start); - _MyStepRTB.InsertSymbol(@"\u160?"); - } - - private void btnInsRO_Click(object sender, EventArgs e) - { - StartGridEditing(SelectionOption.Start); - // see if user is positioned 'on' an ReferencedObject within the rtb, if so do a modify, otherwise, - // insert referenced object. - StepTabPanel tmp = Parent as StepTabPanel; - tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(MyStepRTB.MyLinkText)); - } - - private void btnRedo_Click(object sender, EventArgs e) - { - _MyStepRTB.Redo(); - btnCMUndo.Enabled = btnUndo.Enabled = _MyStepRTB.CanUndo; - btnCMRedo.Enabled = btnRedo.Enabled = _MyStepRTB.CanRedo; - } - - private void btnUndo_Click(object sender, EventArgs e) - { - _MyStepRTB.Undo(); - if (_MyStepRTB.WasXDelete && _MyStepRTB.SelectionStart > 0 && _MyStepRTB.TextLength > 0 && (_MyStepRTB.Text[_MyStepRTB.SelectionStart - 1] == 'X')) - { - _MyStepRTB.Undo(); - _MyStepRTB.WasXDelete = false; - - // only allow one of these - not best case, but at least can get - // one undo - _MyStepRTB.ClearUndo(); - } - btnCMRedo.Enabled = btnRedo.Enabled = _MyStepRTB.CanRedo; - btnCMUndo.Enabled = btnUndo.Enabled = _MyStepRTB.CanUndo; - } - private void btnGoTo_Click(object sender, EventArgs e) - { - // if on a transition, go to the selected transition 'to'. If on - // a referenced object, bring up ReferencedObject Editor (for now, just put up a message box. - if (_MyStepRTB.MyLinkText != null && _MyStepRTB.MyLinkText.IndexOf("Transition") > -1) - { - // B2021-094 fix for key stroke for GoTo Transition or RO link - // Needed to clear the selection of the link or it will be used the next time - // is used - string lnkText = _MyStepRTB.MyLinkText; // save the transition link information - _MyStepRTB.SetSelection(0, 0); // Clear the selection of the transition link - // note _MyStepRTB.DeselectAll() did not work all the time - _MyEditItem.MyStepPanel.OnLinkClicked(sender, new StepPanelLinkEventArgs(lnkText)); - } - else - { - if (VlnSettings.ReleaseMode.Equals("DEMO")) - { - FlexibleMessageBox.Show("Referenced Object Editor not available in the Demo version.", "PROMS Demo Version"); - return; - } - string myROID; - RODbInfo myRODB; - if (MyFlexGrid != null && MyFlexGrid.IsRoTable) - { - myROID = MyFlexGrid.ROID.ToLower(); - myRODB = RODbInfo.Get(MyFlexGrid.RODbId); - } - else if (MyItemInfo.IsFigure && MyItemInfo.MyContent.ContentRoUsages != null && MyItemInfo.MyContent.ContentRoUsages.Count > 0) - { - myROID = MyItemInfo.MyContent.ContentRoUsages[0].ROID; - myRODB = MyItemInfo.MyContent.ContentRoUsages[0].MyRODb; - } - else - { - LinkText lt = new LinkText(_MyStepRTB.MyLinkText); // save the RO link information - // B2021-094 fix for key stroke for GoTo Transition or RO link - // Needed to clear the selection of the link or it will be used the next time - // is used - _MyStepRTB.SetSelection(0, 0); // clear the selection of the RO link - // note _MyStepRTB.DeselectAll() did not work all the time - //B2023-104 If we could not get the MyRoUsageInfo then we have a bad RO Link. Tell user to re-link the RO - if (lt.MyRoUsageInfo != null) - { - myROID = lt.MyRoUsageInfo.ROID.ToLower(); - myRODB = lt.MyRoUsageInfo.MyRODb; - } - else - { - FlexibleMessageBox.Show("Invalid RO link information.\n\n Please re-link this RO value.", "Invalid RO Reference", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - } - if (myROID == null) return; - if (myROID.StartsWith("ffff")) - { - FlexibleMessageBox.Show("Unit Information RO's cannot be edited", "Unit Information RO", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - //string roapp = Environment.GetEnvironmentVariable("roapp"); - string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable - string args = "\"" + myRODB.FolderPath + "\" " + myROID; - if (!Directory.Exists(myRODB.FolderPath)) - { - FlexibleMessageBox.Show(string.Format("RO Database directory does not exist: {0}", myRODB.FolderPath)); - return; - } - // C2017-003: ro data in sql server, check for sql connection string - if (myRODB.DBConnectionString != "cstring") args = args + " \"" + myRODB.DBConnectionString + "\""; - // C2021-026 pass in Parent/Child information (list of the children) - // B2022-019 look at all DocVersions to find ParentChild information - // to ensure we pass in Parent/Child even when not coming from a Parent/Child procedure set - // B2022-073 Break out of the foreach when we find a set with parent/child information - DocVersionInfoList dvil = DocVersionInfoList.Get(); - foreach (DocVersionInfo dvi in dvil) - { - DocVersionConfig dvc = dvi.DocVersionConfig as 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 - { - args += " \"PC=" + dvc.Unit_Name + "\""; - break; - } - } - System.Diagnostics.Process.Start(roapp, args); - } - } - - // C2015-028 Add Editorial Mode to PROMS Step Editor - private void btnEditorialMode_Click(object sender, EventArgs e) - { - //toggle button is selected - SetEditorialMode(!btnEditorialMode.Checked); - - //set the overall flag in the displaytabcontrol - StepTabPanel tmp = Parent as StepTabPanel; - tmp.MyDisplayTabControl.IsInEditorialMode = btnEditorialMode.Checked; - - //refresh the current item so the background color changes (LightGreen=Editorial Mode, SkyBlue=Normal Selected) - if (MyEditItem != null) - { - _MyEditItem.RefreshContent(); - Application.DoEvents(); - } - - //set other preciously opened tabs to match the state of Editorial Mode in the current tab - tmp.MyDisplayTabControl.SetEdititorialModeForAllTabs(btnEditorialMode.Checked); - } - - private void btnChgTyp_Click(object sender, EventArgs e) - { - StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("Change Step Type"); - MyEditItem.MyStepPanel.OnTabDisplay(sender, args); - } - #endregion - #region RHM debug - //#if DEBUG - // // The following code generates an XML output for the selected item for print testing. - // private void btnPageBreak_Click(object sender, EventArgs e) - // { - // // This is here temporarily to get a node and all of it's children for print testing. - // OutputAllChildren(MyRTBItem); - // } - // private void OutputAllChildren(RTBItem myRTBItem) - // { - // OutputAllChildren(myRTBItem.MyBeforeRTBItems); - // OutputStepInfo(myRTBItem); - // OutputAllChildren(myRTBItem.MyAfterRTBItems); - // OutputAllChildren(myRTBItem.MyRNORTBItems); - // } - // private void OutputStepInfo(RTBItem myRTBItem) - // { - // Label lbl = myRTBItem.MyLabel; - // if (lbl.Text.Trim() != "") - // Console.WriteLine("{4}", - // ToInches(myRTBItem.Left + lbl.Left), ToInches(myRTBItem.Top + lbl.Top), - // lbl.Font.FontFamily.Name,lbl.Font.SizeInPoints,lbl.Text); - // StepRTB rtb = myRTBItem.MyStepRTB; - // Console.WriteLine("{3}", - // ToInches(myRTBItem.Left + rtb.Left), ToInches(myRTBItem.Top + rtb.Top), ToInches(rtb.Width), myRTBItem.MyItemInfo.MyContent.Text); - //// ToInches(myRTBItem.Left + rtb.Left), ToInches(myRTBItem.Top + rtb.Top), ToInches(rtb.Width), rtb.Rtf); - // } - // private float ToInches(int val) - // { - // return Convert.ToSingle(val)/96F; - // } - - // private void OutputAllChildren(List list) - // { - // if(list != null) - // foreach (RTBItem itm in list) - // OutputAllChildren(itm); - // } - - - //#endif - #endregion - // C2021-021 change the tool tip for the Find and Find/Replace button based on the user's accessibility to the procedure. - // also change the text on the buttons to read either Find or Find/Replace - public void ToggleFindReplaceToolTip(bool isReviewer) - { - string tipMsg = string.Format("Find {0} [Ctrl] [F]", isReviewer ? "" : "/ Replace"); - superTooltipRibbon.SetSuperTooltip(btnReviewFind, new DevComponents.DotNetBar.SuperTooltipInfo(tipMsg, "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - superTooltipRibbon.SetSuperTooltip(btnFindRplDlg, new DevComponents.DotNetBar.SuperTooltipInfo(tipMsg, "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - btnFindRplDlg.Text = btnReviewFind.Text = (isReviewer)?"Find": "Find /\r\nReplace"; - } - public void SetupReviewerMode() - { - if (MyEditItem != null && MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit) - { - btnToggleEditView_Click(null, new EventArgs()); - rtabView.Visible = false; - rtabHome.Visible = false; - rtabInsert.Visible = false; - rtabAdmin.Visible = false; - rtabReview.Select(); - btnCMEditMode1.Enabled = btnEditMode.Enabled = btnCMEditorialMode.Enabled = false; // don't allow reviewer toggle out of view mode - btnCMEditorialMode.Visible = false; - } - } - public void SetupROEditorMode() - { - if (MyEditItem != null && MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit) - { - // bug fix B2015-188 - // user with ROEditor only security also has Review privledges - btnToggleEditView_Click(null, new EventArgs()); - rtabView.Visible = false; - rtabHome.Visible = false; - rtabInsert.Visible = false; - rtabAdmin.Select(); - btnCMEditMode1.Enabled = btnEditMode.Enabled = false; - } - } - public void SetupWriterMode() - { - EnableROEdit = false; - rtabAdmin.Visible = false; - } - public void SetupSetAdminMode() - { - } - public void SetupAdminMode() - { - } - - //C2019-036 View Only mode work with Checked Out Procedures - public event StepTabRibbonEvent EnableDisableStepProperties; - private void OnEnableDisableStepProperties(StepTabRibbonEventArgs args) - { - if (EnableDisableStepProperties != null) - EnableDisableStepProperties(this, args); - } - private void btnToggleEditView_Click(object sender, EventArgs e) - { - if (MyEditItem == null) return; - - //C2019-036 View Only mode work with Checked Out Procedures - string message = string.Empty; - if (MyEditItem.MyStepPanel.VwMode == E_ViewMode.View && !MySessionInfo.CanCheckOutItem(MyEditItem.MyItemInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message)) - { - //someone else has the procedure checked out so cannot swap out of view only mode - message = message.Replace("\r\nWould You like to open the procedure in View Only Mode?", "\r\n\r\nYou will be unable to turn off View Only Mode for this procedure until it is checked in by the user specified above."); - MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return; - } - //C2026-021 Expand Functionality of Viewing Mode - if (MyEditItem.MyStepPanel.VwMode == E_ViewMode.View && MyEditItem.MyStepPanel.ApplDisplayMode > 0) - { - //Procedure Viewing Mode is set to a specific Unit - so cannot exit vie only mode - MessageBox.Show(this, "Procedures with multiple units are only editable when the Viewing Mode is set to Master. To change out of View Only Mode, first open the Step Propeties panel->Applicability tab and change the Viewing Mode to be Master. Then you can disable View Only Mode.", "Procedure Viewing Mode Incompatiple with Edits", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return; - } - else if (MyEditItem.MyStepPanel.VwMode == E_ViewMode.View) - { - //swapping into edit mode, so check out procedure and Setup Security - (this.Parent as StepTabPanel).MyDisplayTabItem.OwnerID = MySessionInfo.CheckOutItem(MyEditItem.MyItemInfo.MyProcedure.ItemID, 0); - (this.Parent as StepTabPanel).MyDisplayTabItem.SetupSecurity(MyItemInfo); - } - else - { - //swapping into View Only mode, so check in procedure - OwnerInfo oi = OwnerInfo.GetByItemID(MyEditItem.MyItemInfo.MyProcedure.ItemID, CheckOutType.Procedure); - MySessionInfo.CheckInItem(oi.OwnerID); - } - - MyEditItem.MyStepPanel.VwMode = MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit ? E_ViewMode.View : E_ViewMode.Edit; - //enable / disable the Step Properties Panel based on the ViewMode - OnEnableDisableStepProperties(new StepTabRibbonEventArgs(MyEditItem.MyItemInfo, 0, MyEditItem.MyStepPanel.VwMode)); - MyEditItem.ToggleEditView(MyEditItem.MyStepPanel.VwMode); - SetButtonAndMenuEnabling(true); - SetStepButtonAndMenuEnabling(true); - SetMenuEnablingForObjectsWOText(); - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnModeChange(this, new StepRTBModeChangeEventArgs(MyEditItem.MyStepPanel.VwMode)); - btnEditMode.Checked = btnCMEditMode1.Checked = MyEditItem.MyStepPanel.VwMode == E_ViewMode.View; - MyEditItem.MyStepRTB.SpellCheckContextMenuOn(MyEditItem.MyStepPanel.VwMode != E_ViewMode.View); - } - //private void btnEnhancedDocSync_Click(object sender, System.EventArgs e) - //{ - // btnEnhancedDocSync.Checked = !btnEnhancedDocSync.Checked; - //} - - //C2019-036 View Only mode work with Checked Out Procedures - // using a blocking collection to make it thread safe in case someone - // spams hitting the refresh button - private BlockingCollection blockingRefreshProcedure = new BlockingCollection(); - - //C2019-036 View Only mode work with Checked Out Procedures - private void btnRefreshProcedure_Click(object sender, EventArgs e) - { - //Consumer - Task.Run(() => - { - //Blocks until a newRefresh Procedure Run is available - while (!blockingRefreshProcedure.IsCompleted) - { - _ = blockingRefreshProcedure.Take(); - RefreshProcedure(); - } - }); - - //Producer - Task.Run(() => { blockingRefreshProcedure.Add(true); }); - } - - public void RefreshProcedure() - { - StepTabPanel stab_Panel = Parent as StepTabPanel; - - if (MyEditItem != null) - { - if (!MyEditItem.MyStepPanel.ContainsFocus) - this.Invoke((Action)(() => { MyEditItem.MyStepPanel.Focus(); })); - - E_ViewMode mode = MyEditItem.MyStepPanel.VwMode; - Application.DoEvents(); - this.Invoke((Action)(() => {MyEditItem.MyStepPanel.ResetAll();})); - Application.DoEvents(); - this.Invoke((Action)(() => {MyEditItem.MyStepPanel.Refresh();})); - Application.DoEvents(); - MyEditItem.MyStepPanel.VwMode = mode; - Application.DoEvents(); - } - else if (stab_Panel != null) - { - if (!stab_Panel.MyStepPanel.ContainsFocus) - this.Invoke((Action)(() => {stab_Panel.MyStepPanel.Focus();})); - - E_ViewMode mode = stab_Panel.MyStepPanel.VwMode; - Application.DoEvents(); - this.Invoke((Action)(() => {stab_Panel.MyStepPanel.ResetAll();})); - Application.DoEvents(); - this.Invoke((Action)(() => {stab_Panel.MyStepPanel.Refresh();})); - Application.DoEvents(); - stab_Panel.MyStepPanel.VwMode = mode; - Application.DoEvents(); - } - } - private void btnROEdit_Click(object sender, EventArgs e) - { - if (VlnSettings.ReleaseMode.Equals("DEMO")) - { - FlexibleMessageBox.Show("Referenced Object Editor not available in the Demo version.", "PROMS Demo Version"); - return; - } - //string roapp = Environment.GetEnvironmentVariable("roapp"); - string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable - if (roapp == null || roapp == string.Empty) - { - FlexibleMessageBox.Show("The 'roapp' environment variable needs to be set to the path of the RO Editor\n\n Ex: C:\\VE-PROMS.NET\\Bin\\roeditor.exe", "Environment Variable Error"); - return; - } - if (!File.Exists(roapp)) - { - string errtxt = string.Format("Could not find path to Referenced Objects Editor:\n\n roapp = {0}\n\n Verify the path assigned to the 'roapp' environment variable", roapp); - FlexibleMessageBox.Show(errtxt, "Environment Variable Error"); - //MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable","Environment Variable Error"); - return; - } - //if (roapp == null) - //{ - // MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable"); - // return; - //} - if (Mydvi == null || Mydvi.DocVersionAssociationCount < 1) - { - FlexibleMessageBox.Show("Could not find associated path for ro data.", "No RO Data", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - string roloc = "\"" + Mydvi.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\""; - if (!Directory.Exists(Mydvi.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath)) - { - FlexibleMessageBox.Show(string.Format("RO Database directory does not exist: {0}", Mydvi.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath)); - return; - } - // C2017-003: ro data in sql server, check for sql connection string - if (Mydvi.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString != "cstring") roloc = roloc + " \"" + Mydvi.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString + "\""; - // C2021-026 pass in Parent/Child information (list of the children) - // B2022-019 look at all DocVersions to find ParentChild information - // to ensure we pass in Parent/Child even when not coming from a Parent/Child procedure set - // B2022-073 Break out of the foreach when we find a set with parent/child information - DocVersionInfoList dvil = DocVersionInfoList.Get(); - foreach (DocVersionInfo dvi in dvil) - { - DocVersionConfig dvc = dvi.DocVersionConfig as 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 - { - roloc += " \"PC=" + dvc.Unit_Name + "\""; - break; - } - } - System.Diagnostics.Process.Start(roapp, roloc); - } - - private void btnUpdROVal_Click(object sender, EventArgs e) - { - InitialProgressBarMessage = "Updating ROs"; - // use rodb directory path of the first rofst for the this document version. Later, will need - // to modify code to get which one (when there is more than one) - if (Mydvi.DocVersionAssociations.Count < 1) - { - FinalProgressBarMessage = "No ROs associated"; - FlexibleMessageBox.Show("Error Updating ro.fst", "No associated ro.fst"); //B2017-125 added title to messagebox - return; - } - ROFstInfo roFstInfo = Mydvi.DocVersionAssociations[0].MyROFst; - - string rofstPath = roFstInfo.MyRODb.FolderPath + @"\ro.fst"; - if (!File.Exists(rofstPath)) - { - FinalProgressBarMessage = "No existing RO.FST"; - FlexibleMessageBox.Show("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path", "No existing RO.FST"); //B2017-125 added title to messagebox - return; - } - // B2017-130 code no longer needed. Was checking the DTS but always was different by miliseconds - //FileInfo fiRofst = new FileInfo(rofstPath); - //if (roFstInfo.DTS == fiRofst.LastWriteTimeUtc) - //{ - // FinalProgressBarMessage = "RO.FST up to date"; - // MessageBox.Show("ro.fst files are same for path " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done", "RO.FST up to date"); //B2017-125 added title to messagebox - // return; - //} - //if (roFstInfo.DTS > fiRofst.LastWriteTimeUtc) - //{ - // FinalProgressBarMessage = "RO.FST is older"; - // MessageBox.Show("Cannot copy older ro.fst from " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done", "RO.FST is older"); //B2017-125 added title to messagebox - // return; - //} - Cursor = Cursors.WaitCursor; - // C2023-001: Check whether docversion can be checked out before continuing with update of ro.fst - string message = string.Empty; - if (!MySessionInfo.CanCheckOutItem(Mydvi.VersionID, CheckOutType.DocVersion, ref message)) - { - FlexibleMessageBox.Show(this, message, "Working Draft Has Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - FinalProgressBarMessage = "Cannot check-out Working Draft"; - Cursor = Cursors.Default; - return; - } - // B2024-002: Save any changes to the database so that updating of ROs has current data: - MyEditItem.SaveContents(); - using (DocVersion dv = DocVersion.Get(Mydvi.VersionID)) - { - //must get id before ROFST gets updated so know what to refresh later - int origfstid = roFstInfo.ROFstID; - - swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(Mydvi)); - // B2022-026 RO Memory Reduction code - first load the new ro.fst so that we can assign the ROTableUpdate event to the correct roFstInfo - if (dv.ROfstLoadingFigures || dv.NewerRoFst) // B2017-125 see if loading figures was completed - { - // only load the RO.fst - ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh); - roFstInfo = Mydvi.DocVersionAssociations[0].MyROFst; - } - else if (!dv.ROfstLastCompleted && origfstid == roFstInfo.ROFstID) - { - //Handle issue where load failed without completing update - //previous RO FST did not load, get last loaded ID - //if none, use -1 which will check all ROs in the Working Draft - string cfg = dv.DocVersionAssociations[0].Config; - AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "" : cfg); - if (dv.DocVersionAssociations[0]?.MyROFst != null) - { - if (!int.TryParse(ac.ROUpdate_PrevROFSTID, out origfstid)) - { - origfstid = -1; - } - } - else - { - origfstid = -1; - } - } - - roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); - ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file - ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, null, roFstInfo, origfstid, roFstInfo.ROFstID); - swROUpdate.Close(); - ContentInfo.StaticContentInfoChange -= ContentInfo_StaticContentInfoChange; - roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); - StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST"); - MyEditItem.MyStepPanel.OnTabDisplay(sender, args); - } - Cursor = Cursors.Default; - FinalProgressBarMessage = "ROs values updated"; - } - private System.IO.StreamWriter swROUpdate; - // write the RO reference changes to a text file, include the old/new text, location, and the itemid of the step element - void ContentInfo_StaticContentInfoChange(object sender, StaticContentInfoEventArgs args) - { - if (args.Type == "RO") - swROUpdate.Write(string.Format("Fixed Referenced Object for {1}({4}){0}Old Text: {2}{0}New Text: {3}{0}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue, (sender as ItemInfo).ItemID)); - } - - private ProgressBarItem _ProgressBar = null; - public ProgressBarItem ProgressBar - { - get { return _ProgressBar; } - set { _ProgressBar = value; } - } - private void DoProgressBarRefresh(int value, int max, string text) - { - if (ProgressBar == null) return; - ProgressBar.Maximum = max; - ProgressBar.Value = value; - ProgressBar.Text = text; - ProgressBar.TextVisible = true; //B2017-125 text was not always visible - Application.DoEvents(); - } - private string InitialProgressBarMessage - { - set - { - if (ProgressBar == null) return; - ProgressBar.Value = 0; - ProgressBar.Maximum = 100; - ProgressBar.Text = value; - Application.DoEvents(); - } - } - private string FinalProgressBarMessage - { - set - { - if (ProgressBar == null) return; - - ProgressBar.Text = value; - ProgressBar.Maximum = 100; - ProgressBar.Value = 100; - Application.DoEvents(); - } - } - - public List roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args) - { - return VlnFlexGrid.ROTableUpdate(sender, args); - //string xml = null; - //string srchtxt = null; - //Content content = (Content)sender; - //using (VlnFlexGrid myGrid = new VlnFlexGrid(content.ContentItems[0])) - //{ - // using (StringReader sr = new StringReader(args.OldGridXml)) - // { - // myGrid.ReadXml(sr); - // sr.Close(); - // } - // string roid = content.ContentRoUsages[0].ROID; //myGrid.ROID; - // int rodbid = content.ContentRoUsages[0].RODbID; //myGrid.RODbId; - // ////Font GridFont = myGrid.Font; - // //myGrid.MergedRanges.Clear(); - // //myGrid.Clear(); - // //myGrid.ParseTableFromText(args.ROText); - // //myGrid.AutoSizeCols(); - // //myGrid.AutoSizeRows(); - // //myGrid.MakeRTFcells(); - // //myGrid.RODbId = rodbid; - // //myGrid.ROID = roid; - // //myGrid.IsRoTable = true; - // myGrid.Visible = false; - // myGrid.ConvertTableROToGrid(args.ROText, rodbid, roid); - // myGrid.FixTableCellsHeightWidth(); - // myGrid.AdjustGridControlSize(); - // myGrid.Visible = true; - // using (StringWriter sw = new StringWriter()) - // { - // myGrid.WriteXml(sw); - // xml = sw.GetStringBuilder().ToString(); - // sw.Close(); - // } - // srchtxt = myGrid.GetSearchableText(); - //} - //List retlist = new List(); - //retlist.Add(srchtxt); - //retlist.Add(xml); - //return retlist; - } - - private void rtabAdmin_Click(object sender, EventArgs e) - { - ribbonTab_SingleClick(sender, e); - btnUpdROVal.Enabled = false; - if (Mydvi.DocVersionAssociations == null || Mydvi.DocVersionAssociations.Count < 1) - { - btnROEdit.Enabled = false; - return; - } - btnROEdit.Enabled = EnableROEdit; - if (!NewerRoFst()) return; - btnUpdROVal.Enabled = true; - } - public bool NewerRoFst() - { - if (_Mydvi == null)return false; - // only allow update if association, and the RO update was not done and/or not completed - return !_Mydvi.ROfstLastCompleted || _Mydvi.NewerRoFst; - } - public void SetUpdRoValBtn(bool en) - { - btnUpdROVal.Enabled = en; - } - private void btnBookmarks_Click(object sender, EventArgs e) - { - StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("Bookmarks"); - MyEditItem.MyStepPanel.OnTabDisplay(sender, args); - } - - private void btnSearch_Click(object sender, EventArgs e) - { - StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("Global Search"); - MyEditItem.MyStepPanel.OnTabDisplay(sender, args); - } - - private void btnLibDocs_Click(object sender, EventArgs e) - { - StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("LibDocs"); - MyEditItem.MyStepPanel.OnTabDisplay(sender, args); - } - // C2020-033: Support the Review/Incoming Transition button to bring up Search/Incoming Transitions panel - private void btnSearchIncTrans_Click(object sender, EventArgs e) - { - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnSearchIncTrans(this, new vlnTreeItemInfoEventArgs(MyStepRTB.MyItemInfo)); - } - public void btnAnnots_Click(object sender, EventArgs e) - { - StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("Annots"); - MyEditItem.MyStepPanel.OnTabDisplay(sender, args); - } - - public void btnDelStep_Click(object sender, EventArgs e) - { - bool clearCopyStep = false; - StepTabPanel tmp = Parent as StepTabPanel; - if (tmp.MyDisplayTabControl.MyCopyStep != null && - tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyEditItem.MyItemInfo.ItemID) - { - //B2025-031 - Improve wording for if attempting to delete copied section - string stype = MyEditItem.MyItemInfo.IsSection ? "section" : "step"; - if (FlexibleMessageBox.Show($"Are you sure?\n\nIf you delete this {stype} you will not able to paste it.\nYou should paste it before you delete it.", $"Attempting to delete copied {stype}.", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return; - clearCopyStep = true; - } - - bool surpressMessageBox = (e == null); - SectionInfo si = MyEditItem.MyItemInfo as SectionInfo; - if (si != null) - { - //C2020-026 specific description of what user is trying to delete - string msg = "Are you sure you want to delete this Section" + (si.HasChildren ? " and its steps?" : "?"); - DialogResult result = FlexibleMessageBox.Show(msg, "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (result == DialogResult.Yes) - { - - if (!si.IsStepSection) - { - WordSectionEventArgs args = new WordSectionEventArgs(si); - MyEditItem.MyStepPanel.OnWordSectionClose(sender, args); - } - MyEditItem.RemoveItem(); - } - return; - } - StepInfo stpi = MyEditItem.MyItemInfo as StepInfo; - if (stpi == null) // not sure that it will every get here! - { - FlexibleMessageBox.Show("Unknown type {0}, cannot delete!", MyEditItem.MyItemInfo.GetType().Name); - return; - } - if (!surpressMessageBox) - { - string typeDescription = MyEditItem.MyStepData.StepEditData.TypeMenu.MenuItem; - string msgs = ""; - if (MyFlexGrid != null) MyEditItem.IdentifyMe(true); - MyEditItem.IdentifyChildren(true); - //C2020-026 specific description of what user is trying to delete - if (stpi.HasChildren) - msgs = string.Format("Are you sure you want to delete this \"{0}\" and its substeps?", typeDescription); - else - msgs = string.Format("Are you sure you want to delete this \"{0}\"?", typeDescription); - if (stpi.HasEnhancedLinkedStep) - msgs = msgs + "\n\n The linked Enhanced step will also be deleted!"; - DialogResult results = FlexibleMessageBox.Show(msgs, "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (MyFlexGrid != null) - { - MyFlexGrid.Styles.Fixed.BackColor = MyFlexGrid.DefaultFixedBackgroundColor; - MyFlexGrid.StyleBackColor = MyFlexGrid.DefaultCellBackgroundcolor; - } - MyEditItem.IdentifyChildren(false); - if (results == DialogResult.Yes) - { - MyEditItem.RemoveItem(); - if (clearCopyStep) - { - tmp.MyDisplayTabControl.MyCopyStep = null; - tmp.MyDisplayTabControl.OnCopyStepSelected(null); // C2015-022 event to save copystep info in all of the separate windows - SetPasteButtonEnabled(); - } - } - } - else - { - MyEditItem.RemoveItem(); - if (clearCopyStep) - { - tmp.MyDisplayTabControl.MyCopyStep = null; - tmp.MyDisplayTabControl.OnCopyStepSelected(null); // C2015-022 event to save copystep info in all of the separate windows - SetPasteButtonEnabled(); - } - } - } - - private void btnCMIns_PopupClose(object sender, EventArgs e) - { - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, _DefaultContextMenu); - } - - public void SetShortCutContextMenu(string menuName) - { - bool displayMenu = false; - int moveDown = 0; - int cnt = 0; - E_AccStep? actable = 0; - if (menuName.Contains("PSI")) Console.WriteLine("menu = {0}", menuName); - - StepData sd = MyItemInfo==null?null:MyItemInfo.FormatStepData; - if (sd != null) // will be null if section - { - actable = sd.StepEditData.AcTable; - if (actable == null) actable = 0; - } - //btnInsCaut.Enabled = (actable & E_AccStep.AddingCaution) > 0; - switch (menuName) - { - case "OpenRtfRawContextMenu": - ClearContextMenu(); - FlexibleMessageBox.Show("No context menu for equations."); - break; - case "PSI": - displayMenu = true; - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMPSI); - break; - case "InsHLS": - displayMenu = btnCMInsHLS.Enabled; - Cursor.Position = new Point(0, 0); // Enter Key hit, move mouse pointer out of way of context menu - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsHLS); - string lookfor = "XXX"; - if(_MyStepRTB.MyItemInfo.MyHLS != null) - lookfor = " " + (_MyStepRTB.MyItemInfo.MyHLS.MyContent.Type - 20000).ToString(); - foreach (DevComponents.DotNetBar.ButtonItem bi in btnCMInsHLS.SubItems) - { - if (bi.Checked) - moveDown = cnt; - if(((string) bi.Tag).EndsWith(lookfor)) - moveDown = cnt; - cnt++; - } - break; - case "InsRNO": - displayMenu = ((actable & E_AccStep.AddingRNO) > 0) && btnCMInsRNO.Enabled; - LetUserKnowIfTheyCannotAdd(actable, E_AccStep.AddingRNO,"RNO"); // B2018-014 Inform user that they cannot add the specified step type - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsRNO); - break; - case "InsSubStps": - displayMenu = ((actable & E_AccStep.AddingSub) > 0) && btnCMInsSubStps.Enabled; - LetUserKnowIfTheyCannotAdd(actable, E_AccStep.AddingSub,"Sub-step"); // B2018-014 Inform user that they cannot add the specified step type - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsSubStps); - if (displayMenu) Cursor.Position = new Point(0, 0); // Enter Key hit, move mouse pointer out of way of context menu - foreach (DevComponents.DotNetBar.ButtonItem bi in btnCMInsSubStps.SubItems) - { - if (bi.Checked) - moveDown = cnt; - cnt++; - } - // F2021-009 If in Proms Express, let user know if they are going to create a new substep deeper than the defined sub-step levels - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.Express && MyItemInfo.GetStepLevel() >= MyItemInfo.GetDefinedSubStepCount()) - { - string msg = "Professional procedure writing standards (PPA) discourages\n" + - "excessive sub-step levels. With each sub-step level, there\n" + - "is less room for text, which could lead to steps that are\n" + - "difficult to follow."; - FlexibleMessageBox.Show(msg, "PPA Writing Standards", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - } - break; - case "InsCaution": - displayMenu = ((actable & E_AccStep.AddingCaution) > 0) && btnCMInsCaution.Enabled; - LetUserKnowIfTheyCannotAdd(actable, E_AccStep.AddingCaution,"Caution"); // B2018-014 Inform user that they cannot add the specified step type - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsCaution); - break; - case "InsNote": - displayMenu = ((actable & E_AccStep.AddingNote) > 0) && btnCMInsNote.Enabled; - LetUserKnowIfTheyCannotAdd(actable, E_AccStep.AddingNote,"Note"); // B2018-014 Inform user that they cannot add the specified step type - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsNote); - break; - case "InsTable": - displayMenu = ((actable & E_AccStep.AddingTable) > 0) && btnCMInsTable.Enabled; - LetUserKnowIfTheyCannotAdd(actable, E_AccStep.AddingTable,"Table"); // B2018-014 Inform user that they cannot add the specified step type - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsTable); - break; - case "InsFigure": - displayMenu = ((actable & E_AccStep.AddingTable) > 0) && btnCMInsFigure.Enabled; - LetUserKnowIfTheyCannotAdd(actable, E_AccStep.AddingTable,"Figure"); // B2018-014 Inform user that they cannot add the specified step type - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsFigure); - break; - case "InsEquation": - displayMenu = ((actable & E_AccStep.AddingTable) > 0) && btnCMInsEquation.Enabled; - LetUserKnowIfTheyCannotAdd(actable, E_AccStep.AddingTable,"Equation"); // B2018-014 Inform user that they cannot add the specified step type - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsEquation); - break; - case "StepPaste": - displayMenu = true; - if (MyFlexGrid != null) - _ContextMenuBar.SetContextMenuEx(MyFlexGrid, btnCMStepPaste); - else - _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMStepPaste); - break; - } - if (displayMenu && UserInfo.CanEdit(MyUserInfo, Mydvi)) - { - SendKeys.Send("+{F10}{DOWN}"); // Display Context menu - while (moveDown > 0) // position to current type - { - SendKeys.Send("{DOWN}"); - moveDown--; - } - } - } - private void LetUserKnowIfTheyCannotAdd(E_AccStep? actable, E_AccStep e_AccStep, string stepType) // B2018-014 Inform user that they cannot add the specified step type - { - if ((actable & e_AccStep) > 0) return; - string msg = string.Format("Cannot add a {0} to this step type. If this is desired please contact Volian to change your format", stepType); - string cpt = string.Format("Cannot add {0}", stepType); - FlexibleMessageBox.Show(msg, cpt, MessageBoxButtons.OK, MessageBoxIcon.Information); - } - private void btnSpell_Click(object sender, EventArgs e) - { - //MessageBox.Show("Functionality not available.", "Spell Check"); - MyEditItem.SaveContents(); - StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("SpellChecker"); - MyEditItem.MyStepPanel.OnTabDisplay(sender, args); - } - private void btnTranRefresh_Click(object sender, System.EventArgs e) - { - // This code is disabled - Button is not visible - this.Cursor = Cursors.WaitCursor; - ProcedureInfo.RefreshTransitions(MyItemInfo.MyProcedure as ProcedureInfo); - this.Cursor = Cursors.Default; - // B2018-002 - Invalid Transitions - Display Transition Refresh Statistics - FlexibleMessageBox.Show(this, string.Format("Checked {0} transitions, modified {1} transitions, converted to text {2} transitions, {3} transitions unable to be fixed (Annotation: Bad Transition Link)", ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount, ProcedureInfo.TranConvertCount, ProcedureInfo.TranCantFixCount), "Results of Refresh Transitions", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - private void btnRefObjRefresh_Click(object sender, System.EventArgs e) - { - //// This code is disabled - Button is not visible - //this.Cursor = Cursors.WaitCursor; - // ProcedureInfo.ResetROCounters(); - // ProcedureInfo.RefreshReferenceObjects(MyItemInfo.MyProcedure as ProcedureInfo); - // this.Cursor = Cursors.Default; - //FlexibleMessageBox.Show(this, string.Format("Checked {0} referenced objects, fixed {1} referenced objects", ProcedureInfo.ROCheckCount, ProcedureInfo.ROFixCount), "Results of Refresh Referenced Objects", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - //private FindReplace dlgFindReplace = null; - private void btnFindRplDlg_Click(object sender, EventArgs e) - { - if (MyEditItem == null || MyEditItem.MyStepPanel == null) return; - StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("FndRpl"); - MyEditItem.MyStepPanel.OnTabDisplay(sender, args); - } - - private void InsertSiblingBeforeOrAfter(string b4aftr) - { - E_AccStep? actable = 0; - StepData sd = MyItemInfo.FormatStepData; - actable = sd.StepEditData.AcTable; - if (actable == null) actable = 0; - switch (b4aftr) - { - case "after": - if ((actable & E_AccStep.AddingNext) > 0) - MyEditItem.AddSiblingAfter(); - break; - case "before": - if ((actable & E_AccStep.AddingPrev) > 0) - MyEditItem.AddSiblingBefore(); - break; - } - } - public void ProcessEnterKey() - { - bool deletedEmpty = false; - bool deletedHLS = false; - bool deletedSubStep = false; - bool deletedRNO = false; - bool deletedNote = false; - bool deletedCaution = false; - ItemInfo parentOfDeleted = null; - if (!MyItemInfo.IsTable && MyStepRTB.Text.Length < 1) //empty step text - { - deletedEmpty = true; - deletedHLS = MyItemInfo.IsHigh; - deletedSubStep = MyItemInfo.IsStepPart; - deletedRNO = MyItemInfo.IsRNOPart; - deletedNote = MyItemInfo.IsNote; - deletedCaution = MyItemInfo.IsCaution; - parentOfDeleted = MyItemInfo.MyParent; // B2020-015 save the parent of the empty step part that was deleted - - btnDelStep_Click(MyStepRTB, null); // delete the empty step piece - } - - if (MyItemInfo.IsHigh) - { - bool processed = true; - if (!deletedHLS) - { - if (deletedSubStep) - { - // B2019-136 if only one high level step type, don't display a pop up menu of high level step types - if (btnCMInsHLS.SubItems.Count > 1) - SetShortCutContextMenu("InsHLS"); - else - InsertSiblingBeforeOrAfter("after"); - } - else if (MyEditItem.MyRNOEditItems != null && MyEditItem.MyRNOEditItems.Count > 0) - MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlRight); // jump to RNO - else if (deletedRNO) - { - processed = AddSubStep(); // B2020-015 see comment below - } - else if (!deletedHLS) - { - if (MyItemInfo.ColumnMode > 0) - CreateNewRNO(); - else - processed = AddSubStep(); // B2020-015 see comment below - } - } - if (processed) return; - } - // B2020-015 Replaced the "else if" with just an "if". The code above processes pressing the Enter Key when starting on a high level step. - // We needed to have a special case when, during the processing of the enter key, we ended up on a table or figure. In those cases - // it was inserting a new table or figure before the existing one. Instead, we want it to process it as if we starting pressing - // the enter key while on the table or figure. By returning a "false" from AddSubStep(), we can let it fall through so that - // it is processed properly. - - if (MyItemInfo.IsRNOPart) - { - // B2013-154: if in single column mode, enter key from an RNO part should insert an RNO part: - if (MyItemInfo.ColumnMode == 0) - { - CreateNewRNO(); - return; - } - // B2020-015 We are on an RNO step type. Spin up the first non-RNO parent then decide what step part to add. - // Prior to this fix, an un-typed step part was created when you pressed Enter from a second RNO - ItemInfo ii = MyItemInfo; - while (ii.IsRNOPart) ii = ii.MyParent; - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(ii); - if (MyItemInfo.IsHigh) - { - if (MyEditItem != null && MyEditItem.NextDownEditItem != null && - !MyEditItem.NextDownEditItem.MyItemInfo.IsTable && !MyEditItem.NextDownEditItem.MyItemInfo.IsFigure && - MyEditItem.NextDownEditItem.MyItemInfo.MyParent.ItemID == MyEditItem.MyItemInfo.ItemID) - { - MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown); - InsertSiblingBeforeOrAfter("before"); - } - else - SetShortCutContextMenu("InsSubStps"); - } - else - InsertSiblingBeforeOrAfter("after"); - } - else if (MyItemInfo.IsInRNO && MyItemInfo.IsStepPart) - { - if (deletedEmpty) - { - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(parentOfDeleted); - if (parentOfDeleted.IsHigh) - { - if (!AddSubStep()) - SetShortCutContextMenu("InsSubStps"); - } - else if (!MyItemInfo.IsRNOPart) - InsertSiblingBeforeOrAfter("after"); - } - else - InsertSiblingBeforeOrAfter("after"); - } - else if (MyItemInfo.IsInRNO &&( MyItemInfo.IsTable || MyItemInfo.IsFigure)) - { - if (deletedEmpty) - { - while (parentOfDeleted.IsRNOPart) - parentOfDeleted = parentOfDeleted.MyParent; - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(parentOfDeleted); - if (parentOfDeleted.IsHigh) - { - if (!AddSubStep()) - SetShortCutContextMenu("InsSubStps"); - } - else - InsertSiblingBeforeOrAfter("after"); - } - else - { - ItemInfo tItemInfo = MyItemInfo.MyParent; - while (tItemInfo.IsRNOPart) tItemInfo = tItemInfo.MyParent; - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(tItemInfo); - if (MyItemInfo.IsHigh) - { - if (!AddSubStep()) - SetShortCutContextMenu("InsSubStps"); - } - else - InsertSiblingBeforeOrAfter("after"); - } - } - else if (MyItemInfo.IsStepPart) - { - if (deletedSubStep) - { - // B2020-015 jump to the parent of the empty step part that was deleted - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(parentOfDeleted); - if (MyItemInfo.IsHigh) - SetShortCutContextMenu("InsHLS"); // prompt for new HLS - else - InsertSiblingBeforeOrAfter("after"); - } - else if (!MyItemInfo.IsSequential) // only add a sibling if substep type does not have sequential tabs - InsertSiblingBeforeOrAfter("after"); - else if (deletedRNO) - { - InsertSiblingBeforeOrAfter("after"); - } - else if (MyEditItem.MyRNOEditItems != null && MyEditItem.MyRNOEditItems.Count > 0) - MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlRight); // jump to RNO - else - if (MyItemInfo.ColumnMode > 0) - CreateNewRNO(); - else - InsertSiblingBeforeOrAfter("after"); - } - else if (MyItemInfo.IsCaution) - { - if (deletedEmpty) - { - MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown); - if (deletedCaution) - CreateNewNote(); - } - else - InsertSiblingBeforeOrAfter("after"); - } - else if (MyItemInfo.IsNote) - { - if (!deletedEmpty) - InsertSiblingBeforeOrAfter("after"); - else if (!deletedCaution) - MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown); - } - else if (MyItemInfo.IsTable || MyItemInfo.IsFigure || MyItemInfo.IsRtfRaw) //is Table, Figure, or Equation - { - ItemInfo next = (deletedEmpty && !deletedHLS)? parentOfDeleted : MyItemInfo.MyParent; - while (next.IsTable || next.IsFigure || next.IsRtfRaw) next = next.MyParent; - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(next); - if (MyItemInfo.IsHigh) - { - if (!deletedHLS) - { - if (deletedSubStep) - SetShortCutContextMenu("InsHLS"); - else if (!deletedNote && !deletedCaution) - SetShortCutContextMenu("InsSubStps"); - } - } - else if (!deletedNote && !deletedCaution) - InsertSiblingBeforeOrAfter("after"); - } - } - - private bool AddSubStep() - { - EditItem nextDownEditItem = MyEditItem.NextDownEditItem; - if (nextDownEditItem != null && nextDownEditItem.MyItemInfo.MyParent.ItemID == MyEditItem.MyID) - { - MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown); - // B2020-015 when nextDownEditItem is a table or figure, we want to treat it as if we started pressing the Enter Key while on that table or figure. - // Return "false' in this case so it can be processed properly - if (nextDownEditItem.MyItemInfo.IsTable || nextDownEditItem.MyItemInfo.IsFigure) - return false; - InsertSiblingBeforeOrAfter("before"); - } - else - SetShortCutContextMenu("InsSubStps"); - return true; - } - - private void CreateNewRNO() - { - if (btnInsRNO.SubItems.Count > 1) - SetShortCutContextMenu("InsRNO"); - else - btnInsRNO.RaiseClick(); - } - - private void CreateNewNote() - { - if (btnInsNote.SubItems.Count > 1) - SetShortCutContextMenu("InsNote"); - else - btnInsNote.RaiseClick(); - } - private void btnPasteAfter_Click(object sender, EventArgs e) - { - StepTabPanel tmp = Parent as StepTabPanel; - if (tmp.MyDisplayTabControl.MyCopyStep == null) return; - // B2016-009 check source and desintation types and display message box if needed - // C2022-017 check for user canceling the paste step - if (!ItemInfo.CheckSourceDestinationType(tmp.MyDisplayTabControl.MyCopyStep.ItemID, MyItemInfo)) return; - SaveTableChanges(); // B2018-055 Save Current Changes to the table - // F2021-009 display a message if pasting step will results in more sub-step levels than are defined in the format - ItemInfo.PasteStepIsWithinDefinedSubStepLevels(tmp.MyDisplayTabControl.MyCopyStep.ItemID, MyItemInfo, false); - MyEditItem.PasteSiblingAfter(tmp.MyDisplayTabControl.MyCopyStep.ItemID); - } - private void btnPasteBefore_Click(object sender, EventArgs e) - { - StepTabPanel tmp = Parent as StepTabPanel; - if (tmp.MyDisplayTabControl.MyCopyStep == null) return; - // B2016-009 check source and desintation types and display message box if needed - // C2022-017 check for user canceling the paste step - if (!ItemInfo.CheckSourceDestinationType(tmp.MyDisplayTabControl.MyCopyStep.ItemID, MyItemInfo)) return; - SaveTableChanges(); // B2018-055 Save Current Changes to the table - // F2021-009 display a message if pasting step will results in more sub-step levels than are defined in the format - ItemInfo.PasteStepIsWithinDefinedSubStepLevels(tmp.MyDisplayTabControl.MyCopyStep.ItemID, MyItemInfo, false); - MyEditItem.PasteSiblingBefore(tmp.MyDisplayTabControl.MyCopyStep.ItemID); - } - private void btnStepPaste_Click(object sender, EventArgs e) - { - // just return - } - - private void btnCpyStp_Click(object sender, EventArgs e) - { - DoCopyStep(); - } - - public void DoCopyStep() - { - MyEditItem.SaveCurrentAndContents(); // B2025-038 copy step and text to another procedure in another screen. - // highlight selected step(s) and prompt to see if selection is what user wants: - if (MyFlexGrid != null) MyEditItem.IdentifyMe(true); - MyEditItem.IdentifyChildren(true); - DialogResult dr = FlexibleMessageBox.Show("Step as Marked?", "Identify Step To Be Copied", MessageBoxButtons.YesNo); - if (dr == DialogResult.Yes) - { - StepTabPanel tmp = Parent as StepTabPanel; - tmp.MyDisplayTabControl.MyCopyStep = MyItemInfo; - tmp.MyDisplayTabControl.OnCopyStepSelected(null); // C2015-022 event to save copystep info in all of the separate windows - btnStepPaste.Enabled = true; - SetPasteButtonEnabled(); - } - if (MyFlexGrid != null) - { - MyFlexGrid.Styles.Fixed.BackColor = MyFlexGrid.DefaultFixedBackgroundColor; - MyFlexGrid.StyleBackColor = MyFlexGrid.DefaultCellBackgroundcolor; - } - MyEditItem.IdentifyChildren(false); - } - - private void btnPasteReplace_Click(object sender, EventArgs e) - { - StepTabPanel tmp = Parent as StepTabPanel; - if (tmp.MyDisplayTabControl.MyCopyStep == null) return; - // B2016-009 check source and desintation types and display message box if needed - // C2022-017 check for user canceling the paste step - if (!ItemInfo.CheckSourceDestinationType(tmp.MyDisplayTabControl.MyCopyStep.ItemID, MyItemInfo)) return; - // F2021-009 display a message if pasting step will results in more sub-step levels than are defined in the format - ItemInfo.PasteStepIsWithinDefinedSubStepLevels(tmp.MyDisplayTabControl.MyCopyStep.ItemID, MyItemInfo, true); - EditItem oldEditItem = MyEditItem; - // C2017-031: Support for paste/replace an enhanced step, if pasting an enhanced, remove its EditItem from the 'cache'. A new EditItem gets created during paste. - if (MyEditItem != null && MyEditItem.MyItemInfo.IsEnhancedStep) MyEditItem.MyStepPanel._LookupEditItems.Remove(MyEditItem.MyItemInfo.ItemID); - MyEditItem = MyEditItem.PasteReplace(tmp.MyDisplayTabControl.MyCopyStep.ItemID); - if (MyEditItem == null) oldEditItem.IdentifyMe(false); // B2017-179 if null then we didn't do the replace but did position to the first transition that needs resolved - // C2017-031: Support for paste/replace an enhanced step, add Dispose of old EditItem if enhanced - if (MyEditItem != null && ((MyEditItem.MyItemInfo.ItemID != oldEditItem.MyItemInfo.ItemID) || MyEditItem.MyItemInfo.IsEnhancedStep)) - oldEditItem.Dispose(); - // C2017-031: Support for paste/replace an enhanced step, refresh ItemInfo's in user interface caches. - if (MyEditItem.MyItemInfo.IsEnhancedStep) - { - MyEditItem.MyItemInfo = ItemInfo.Get(MyEditItem.MyItemInfo.ItemID); - tmp.MyStepPanel.SelectedItemInfo = ItemInfo.Get(MyEditItem.MyItemInfo.ItemID); - } - } - - private void btnPdfCreate_Click(object sender, EventArgs e) - { - // B2025-036 split screen print issue. if oringFlg == 1 the ctrl-p keys was pressed. - _OringFlg = 0; - DevComponents.DotNetBar.eEventSource oring = ((DevComponents.DotNetBar.Events.EventSourceArgs)e).Source; - if (oring == eEventSource.Keyboard) - _OringFlg = 1; - - int selectedSlave = MyItemInfo.MyProcedure.ProcedureConfig.SelectedSlave; - if (MyItemInfo == null) return; // if creating a pdf before rtb exists, return; - if (MyEditItem != null) MyEditItem.SaveCurrentAndContents(); - MyItemInfo.MyProcedure.ProcedureConfig.SelectedSlave = selectedSlave; - OnPrintRequest(new StepTabRibbonEventArgs(MyItemInfo.MyProcedure, _OringFlg), 0); - } - - private void btnPdfQuickCreate_Click(object sender, EventArgs e) - { - int selectedSlave = MyItemInfo.MyProcedure.ProcedureConfig.SelectedSlave; - if (MyItemInfo == null) return; // if creating a pdf before rtb exists, return; - if (MyEditItem != null) MyEditItem.SaveCurrentAndContents(); - MyItemInfo.MyProcedure.ProcedureConfig.SelectedSlave = selectedSlave; - OnPrintRequest(new StepTabRibbonEventArgs(MyItemInfo.MyProcedure, _OringFlg), 1); - } - - private void btnCASCreate_Click(object sender, EventArgs e) - { - if (MyItemInfo == null) return; // if creating a Continuous Action Summary before rtb exists, return; - if (MyEditItem != null) MyEditItem.SaveCurrentAndContents(); - OnContActionSummaryRequest(new StepTabRibbonEventArgs(MyItemInfo.MyProcedure)); - } - #region Table Grid - #region TablePicker code - // TODO: for tables - //private void btnInsTable_Click(object sender, EventArgs e) - //{ - // Point loc = btnInsTable.DisplayRectangle.Location; - // loc.X += 300; - // int top = this.Top + (btnInsTable.Size.Height * 2); - // TablePickerDlg(sender, e, loc, top); - //} - - private VlnFlexGrid CreateNewTable() - { - Point pt = Cursor.Position; - int left = pt.X; - VlnFlexGrid grd = null; - TablePicker tpdlg = new TablePicker(); - tpdlg.Location = pt; - tpdlg.Left = left; - tpdlg.MaxCols = 20; - tpdlg.MaxRows = 30; - DialogResult dr = tpdlg.ShowDialog(); - while (tpdlg.Visible) - { - Application.DoEvents(); - } - if (dr != DialogResult.Cancel) //!tpdlg.Cancel) - { - // Create a new grid to store the selected size - grd = new VlnFlexGrid(); - grd.Rows.Count = tpdlg.SelectedRows; - grd.Cols.Count = tpdlg.SelectedColumns; - VE_Font vefont = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Table.Font; - Font GridFont = new Font(vefont.Family, (float)vefont.Size); - grd.Font = GridFont; - grd.FitTableToPageWidth((int)(MyItemInfo.MyDocStyle.Layout.PageWidth - MyItemInfo.MyDocStyle.Layout.LeftMargin)); - } - return grd; - } - //private void InitializeNewGrid(C1FlexGrid grd) - //{ - // int numCols = grd.Cols.Count - 1; - // int numRows = grd.Rows.Count - 1; - - // string defText = ""; - // if (textBoxX1.Text.Length > 0) - // defText = textBoxX1.Text; - // else - // defText = textBoxX1.WatermarkText; - // grd.SetData(grd.GetCellRange(0, 0, numRows, numCols), defText); - //} - #endregion - #region Table Grid Copy/Paste - private void btnTblDgnCopyRow_Click(object sender, EventArgs e) - { - MyFlexGrid.CopyRow(); - } - - private void btnTblDgnCopyColumn_Click(object sender, EventArgs e) - { - MyFlexGrid.CopyColumn(); - } - - private void btnTblDgnCopySelection_Click(object sender, EventArgs e) - { - MyFlexGrid.CopyCellSelection(); - } - - private void btnTblDgnPasteRowAbove_Click(object sender, EventArgs e) - { - // create new rows before current position and copy clipboard data - MyFlexGrid.PasteRows(VlnFlexGrid.enmPastePos.Before); - GridItem tmp = MyEditItem as GridItem; - if (tmp!=null) tmp.SavePastedCellRoTran(); - } - - private void btnTblDgnPasteRowBelow_Click(object sender, EventArgs e) - { - // create new rows after current position and copy clipboard data - MyFlexGrid.PasteRows(VlnFlexGrid.enmPastePos.After); - GridItem tmp = MyEditItem as GridItem; - if (tmp != null) tmp.SavePastedCellRoTran(); - } - - private void btnTblDgnPasteReplaceRow_Click(object sender, EventArgs e) - { - // replace rows with current clipboard data starting as current row - MyFlexGrid.PasteRows(VlnFlexGrid.enmPastePos.Replace); - GridItem tmp = MyEditItem as GridItem; - if (tmp != null) tmp.SavePastedCellRoTran(); - } - - private void btnTblDgnPasteColumnLeft_Click(object sender, EventArgs e) - { - MyFlexGrid.PasteColumns(VlnFlexGrid.enmPastePos.Before); - GridItem tmp = MyEditItem as GridItem; - if (tmp != null) tmp.SavePastedCellRoTran(); - } - - private void btnTblDgnPasteColumnRight_Click(object sender, EventArgs e) - { - MyFlexGrid.PasteColumns(VlnFlexGrid.enmPastePos.After); - GridItem tmp = MyEditItem as GridItem; - if (tmp != null) tmp.SavePastedCellRoTran(); - } - - private void btnTblDgnPasteColumnReplace_Click(object sender, EventArgs e) - { - MyFlexGrid.PasteColumns(VlnFlexGrid.enmPastePos.Replace); - GridItem tmp = MyEditItem as GridItem; - if (tmp != null) tmp.SavePastedCellRoTran(); - } - - private void btnTblDgnPasteIntoSelection_Click(object sender, EventArgs e) - { - MyFlexGrid.PasteCopiedCells(); - GridItem tmp = MyEditItem as GridItem; - if (tmp != null) tmp.SavePastedCellRoTran(); - } - - #endregion - #region Table Grid Delete - private void btnTblDgnRemoveRow_Click(object sender, EventArgs e) - { - if (MyFlexGrid.AllRowsSelected()) - btnDelStep_Click(sender, e); - else - MyFlexGrid.RemoveSelectedRow(); - } - - private void btnTblDgnRemoveColumn_Click(object sender, EventArgs e) - { - if (MyFlexGrid.AllColumnsSelected()) - btnDelStep_Click(sender, e); - else - MyFlexGrid.RemoveSelectedColumn(); - } - - #endregion - #region Table Grid Cell Style - - //private void cpHighlight_SelectedColorChanged(object sender, EventArgs e) - //{ - // string strColor = string.Format("{0}, {1}, {2};", cpTblDgnHighlight.SelectedColor.R, cpTblDgnHighlight.SelectedColor.G, cpTblDgnHighlight.SelectedColor.B); - // MyFlexGrid.ChangeBackgroundColor(strColor); - //} - - private void btnTblDgnAlgnTxTopLeft_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.LeftTop); - MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left); - } - - private void btnTblDgnAlgnTxTopCenter_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.CenterTop); - MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center); - } - - private void btnTblDgnAlgnTxTopRight_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.RightTop); - MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right); - } - - private void btnTblDgnAlgnTxCenterLeft_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.LeftCenter); - MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left); - } - - private void btnTblDgnAlgnTxCenterCenter_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.CenterCenter); - MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center); - } - - private void btnTblDgnAlgnTxCenterRight_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.RightCenter); - MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right); - } - - private void btnTblDgnAlgnTxBottomLeft_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.LeftBottom); - MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left); - } - - private void btnTblDgnAlgnTxBottomCenter_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.CenterBottom); - MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center); - } - - private void btnTblDgnAlgnTxBottomRight_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.RightBottom); - MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right); - } - - #endregion - #region Table Grid Merge/Split - private void btnTblDgnSplitCells_ToRows_Click(object sender, EventArgs e) - { - // without the BeginUpdate/EndUpdate, you will see the table jump around while - // it is being adjusted - MyFlexGrid.BeginUpdate(); - MyFlexGrid.SplitSelection(false); - MyFlexGrid.EndUpdate(); - } - #endregion - - private void btnTblDgnSplitCellsToCols_Click(object sender, EventArgs e) - { - // without the BeginUpdate/EndUpdate, you will see the table jump around while - // it is being adjusted - MyFlexGrid.BeginUpdate(); - MyFlexGrid.SplitSelection(true); - MyFlexGrid.EndUpdate(); - } - - private void btnTblDgnMergeCells_Click(object sender, EventArgs e) - { - MyFlexGrid.MergeSelection(); - } - #endregion - #region Table Grid Design - private void btnTblDgnInsertRowAbove_Click(object sender, EventArgs e) - { - MyFlexGrid.InsertRowBefore(); - } - - private void btnTblDgnInsertRowBelow_Click(object sender, EventArgs e) - { - MyFlexGrid.InsertRowAfter(); - } - - private void btnTblDgnInsertColumnBefore_Click(object sender, EventArgs e) - { - MyFlexGrid.InsertColumnBefore(); - } - - private void btnTblDgnInsertColumnAfter_Click(object sender, EventArgs e) - { - MyFlexGrid.InsertColumnAfter(); - } - public void ToggleTableFontSize(bool visible) - { - bool visl = visible; - if (MyFlexGrid != null) - { - if (MyFlexGrid.IsRoTable) visl = false; - } - btnCMChgFontSize.Visible = visl; - // C2021-005 - setup the font size dropdowns for the table ribbon and context menu - // A list of font sizes is set in the base format file and can be overidden in a plant's format file - string tfntszs = MyItemInfo.ActiveFormat.PlantFormat.FormatData.FontSizes.TableFontSizes; - // B2021-090 If the current formats were not updated then there will be no list of table font sizes - // so in this case we want to disable the font size dropdown list in the table ribbon and in the context menu - if (tfntszs == null) - { - btnCMChgFontSize.Enabled = false; - rbTblFont.Enabled = false; - rbTblFntSz.Enabled = false; - cmFontSizeList.Enabled = false; - return; - } - rbTblFntSz.Items.Clear(); - cmFontSizeList.Items.Clear(); - rbTblFntSz.Items.AddRange(tfntszs.Replace(" ", "").Split(",".ToCharArray())); // dropdown on table ribbon - cmFontSizeList.Items.AddRange(tfntszs.Replace(" ", "").Split(",".ToCharArray())); // dropdown on context menu - } - public void ToggleTableDesignButtons(bool enable) - { - bool enableContent = enable; - if (MyFlexGrid != null) - { - if (MyFlexGrid.IsRoTable) enableContent = false; - //B2017-156 Don't allow alignment or borders if the selection is not valid - rbTblBorder.Enabled = btnTblDgnAlignText.Enabled = MyFlexGrid.Selection.IsValid && enable; // B2017-194 moved to inside the test for a null MyFlexGrid - } - btnTblDgnCopy.Enabled = enableContent; - btnTblDgnRemove.Enabled = enableContent; - btnCmGridInsert.Enabled = enableContent; - btnCmGridCopy.Enabled = enableContent; - btnCmGridRemove.Enabled = enableContent; - //btnTblDgnGridStyle.Enabled = enable; - //rbTblBorder.Enabled = enable; - rbnBorderlistBox.Enabled = enable; - rbnBorderSelectionPanel.Enabled = enable; - btnTblNoBorder.Enabled = enable; - btnTblOutline.Enabled = enable; - btnTblInside.Enabled = enable; - btnTblDgnInsertColumn.Enabled = enableContent; - btnTblDgnInsertRow.Enabled = enableContent; - btnTblDgnMergeCells.Enabled = enableContent; - btnCmGridMergeCells.Enabled = enableContent; - btnCmGridPaste.Enabled = - btnTblDgnPaste.Enabled = ((VlnFlexGrid.MyCopyInfo.MyCopiedFlexGrid != null) && enableContent); - btnTblDgnSplitCells.Enabled = enableContent; - btnCmGridSplitCell.Enabled = enableContent; - //B2021-090 don't enable the font size selection on RO tables - was crashing trying to read font sizes on an RO table - // enableContent is set to false (above) when on an RO table - rbTblFont.Enabled = enableContent; - } - public void SetRibbonForGridCellIndent() - { - if (_MyStepRTB != null) - btnIndent.Checked = _MyStepRTB.SelectionHangingIndent != 0; - } - public void SetRibbonForGridCellIndentClear() - { - btnIndent.Checked = false; - } - public void SetRibbonForGrid() - { - // for paste, see if there is clipboard data, & if so, of a type we can use. - IDataObject iData = Clipboard.GetDataObject(); - // set to true if editing cell, otherwise false for grids - //bool enable = (MyFlexGrid != null && MyFlexGrid.Editor != null); - - // B2017-208 toggle on/off attributes button checks when you edit table cells, going from one cell to another - // Also don't keep the attributes buttons checked after setting a group of table cells all at one time - btnCMBold.Checked = btnBold.Checked = RTBAPI.IsBold(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - btnCMItalics.Checked = btnItalics.Checked = RTBAPI.IsItalic(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - btnCMUnderline.Checked = btnUnderline.Checked = RTBAPI.IsUnderline(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB) && (MyFlexGrid == null || MyFlexGrid.TableCellEditor.EditMode); - - bool enable = (MyFlexGrid != null && MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit); - //btnPasteText.Enabled = btnPasteStepText.Enabled = btnPaste.Enabled = enable; - btnPaste.Enabled = (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf)) && enable; - btnCMPasteText.Enabled = btnPasteText.Enabled = iData.GetDataPresent(DataFormats.Text) && enable; - btnCMPaste.Enabled = btnPasteStepText.Enabled = iData.GetDataPresent(DataFormats.Rtf ) && enable; - btnCopy.Enabled = enable; - btnCut.Enabled = enable; - btnBold.Enabled = enable && !MyFlexGrid.IsRoTable;// ; - btnItalics.Enabled = enable && !MyFlexGrid.IsRoTable;// ; - btnUnderline.Enabled = enable && !MyFlexGrid.IsRoTable;// ; - btnSubscript.Enabled = enable && !MyFlexGrid.IsRoTable;// ; - btnSuperscript.Enabled = enable && !MyFlexGrid.IsRoTable;// ; - btnChgCase.Enabled = enable && !MyFlexGrid.IsRoTable;// ; - btnInsHrdSpc.Enabled = enable && !MyFlexGrid.IsRoTable;// enable; - btnSymbols.Enabled = enable && !MyFlexGrid.IsRoTable;// enable; - btnIndent.Enabled = enable && !MyFlexGrid.IsRoTable;// ;enable; - btnInsTrans.Enabled = enable && !MyFlexGrid.IsRoTable;// ; - btnInsRO.Enabled = enable && Mydvi.DocVersionAssociationCount > 0; // 2016-128 don't enable if RO Path was not selected at the Working Draft node - btnCMRtfCellEdit.Enabled = enable && !MyFlexGrid.IsRoTable; - } - private bool _initTblFontSizeDropdown = true; // C2021-005 flag to allow setting font size in dropdown without triggering the dropdown item select - // C2021-005 get the font size being used in the selected table cell(s) then ititialize the font dropdown - public void SetFontSizeDropDown() - { - float sz = GetTableCellFontSize(SelectionOption.All); - SetFontSizeDropDownText(sz); - } - // C2021-005 Initialize the font size dropdown - public void SetFontSizeDropDownText(float fsz) - { - _initTblFontSizeDropdown = true; - rbTblFntSz.SelectedIndex = -1; - rbTblFntSz.Text = fsz.ToString(); - cmFontSizeList.SelectedIndex = -1; - cmFontSizeList.Text = fsz.ToString(); - _initTblFontSizeDropdown = false; - } - private void btnTblDgnAdjustSize_Click(object sender, EventArgs e) - { - if (MyFlexGrid.Cols.Fixed == 0) // allow change of size. - { - // set all the rows and columns to Fixed so that user can adjust the row/column size - if (MyFlexGrid.Cols[0].Width == -1) MyFlexGrid.Cols[0].Width = MyFlexGrid.Cols.DefaultSize; - MyFlexGrid.Cols.Fixed = MyFlexGrid.Cols.Count; - MyFlexGrid.Rows.Fixed = MyFlexGrid.Rows.Count; - MyFlexGrid.StyleBackColor = MyFlexGrid.DefaultFixedBackgroundColor; // C2021-004 force the fixed background color - ToggleTableDesignButtons(false); - //MyFlexGrid.ListStyles(); - } - else - { - // set grid back to "normal" mode - MyFlexGrid.Cols.Fixed = 0; - MyFlexGrid.Rows.Fixed = 0; - MyFlexGrid.ShowTableCellShading(); // C2021-004 show the table cell colors - ToggleTableDesignButtons(true); - //MyFlexGrid.ListStyles(); - } - } - #endregion - #region Table Grid Border - private void btnTblDgnTableBorderNone_Click(object sender, EventArgs e) - { - MyFlexGrid.SetTableBorder(C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None); - } - - private void btnTblDgnTableBorderFixedSingle_Click(object sender, EventArgs e) - { - MyFlexGrid.SetTableBorder(C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.FixedSingle); - } - - private void btnTblDgnTableBorderFixed3D_Click(object sender, EventArgs e) - { - MyFlexGrid.SetTableBorder(C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Fixed3D); - } - - private void btnTblDgnTableBorderLight3D_Click(object sender, EventArgs e) - { - MyFlexGrid.SetTableBorder(C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D); - } - - private void btnTblDgnTableBorderXPThemes_Click(object sender, EventArgs e) - { - MyFlexGrid.SetTableBorder(C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.XpThemes); - } - #endregion - #region Table Grid Grid Style - private void btnTblDgnGridStyleNone_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellBorder(MyFlexGrid.Selection, C1.Win.C1FlexGrid.BorderStyleEnum.None); - } - - private void btnTblDgnGridStyleFlat_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellBorder(MyFlexGrid.Selection, C1.Win.C1FlexGrid.BorderStyleEnum.Flat); - } - - private void btnTblDgnGridStyleDouble_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellBorder(MyFlexGrid.Selection, C1.Win.C1FlexGrid.BorderStyleEnum.Double); - } - - private void btnTblDgnGridStyleRaised_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellBorder(MyFlexGrid.Selection, C1.Win.C1FlexGrid.BorderStyleEnum.Raised); - } - - private void btnTblDgnGridStyleInset_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellBorder(MyFlexGrid.Selection, C1.Win.C1FlexGrid.BorderStyleEnum.Inset); - } - - private void btnTblDgnGridStyleGroove_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellBorder(MyFlexGrid.Selection, C1.Win.C1FlexGrid.BorderStyleEnum.Groove); - } - - private void btnTblDgnGridStyleFillet_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellBorder(MyFlexGrid.Selection, C1.Win.C1FlexGrid.BorderStyleEnum.Fillet); - } - - private void btnTblDgnGridStyleDotted_Click(object sender, EventArgs e) - { - MyFlexGrid.ChangeCellBorder(MyFlexGrid.Selection, C1.Win.C1FlexGrid.BorderStyleEnum.Dotted); - } - #endregion - - private void rbnBorderlistBox_SelectedIndexChanged(object sender, EventArgs e) - { - rbnBorderSelectionPanel.SelectedBorder = rbnBorderlistBox.SelectedLinePattern; - } - - private void rbnBorderSelectionPanel_BordersChanged(object sender, EventArgs args) - { - //C1.Win.C1FlexGrid.CellRange cr = MyFlexGrid.GetEvenSelection(); - MyFlexGrid.SetBorders(MyFlexGrid.Selection, rbnBorderSelectionPanel.TopBorder, rbnBorderSelectionPanel.InsideHorizontalBorder, - rbnBorderSelectionPanel.BottomBorder, rbnBorderSelectionPanel.LeftBorder, rbnBorderSelectionPanel.InsideVerticalBorder, rbnBorderSelectionPanel.RightBorder); - MyEditItem.Invalidate(); - MyFlexGrid.Invalidate(); - } - private void btnTblNoBorder_Click(object sender, EventArgs e) - { - rbnBorderSelectionPanel.AllBorders = GridLinePattern.None; - } - private void btnTblOutline_Click(object sender, EventArgs e) - { - rbnBorderSelectionPanel.OutlineBorder = rbnBorderlistBox.SelectedLinePattern; - } - private void btnTblInside_Click(object sender, EventArgs e) - { - rbnBorderSelectionPanel.InsideBorders = rbnBorderlistBox.SelectedLinePattern; - } - private void rbnBorderlistBox_Resize(object sender, EventArgs e) - { - rbnBorderSelectionPanel.Size = rbnBorderlistBox.Size; - _RibbonControl.Height = rbnBorderlistBox.Height + _RibbonControl.Height - _RibbonControl.ClientSize.Height; - //_RibbonControl.Height = rbnBorderlistBox.Height + _RibbonControl.Height - _RibbonControl.ClientSize.Height; - } - #region Expand/Collaspe Ribbon - // In MS Word, a Double Click of a ribbon tab will toggle (Expand/Collapse) the ribbon. - // Once collapsed, a Single Click of a ribbon tab will temporarily expand the ribbon but does not push the text window - // down to make room. Thus your edit cursor could end up behind the ribbon. - - // In our implementation of the ribbon interface, when we double click to collapse/expand the - // ribbon, the QAT menu on the main form gets out of sync, so we need to handle this manually, turning off AutoExpand - // on the ribbon control. (see StepTabRibbon() constructor) and issue an event to expand/collapse the ribbon. - - // As a result of turning off the AutoExpand, a single click is not recongized internally. - // To get around this, we handle the single click event. - // Our single click event will expand the ribbon tabs if needed but not temporarily. - // Instead, it acts like a double click which is not the same a MS Word, but on the plus side, - // it elimates the risk of the ribbon expanding on top of the current edit window. - - //----------------------------- - - // This is assigned the DoubleClick event on all of the ribbon tabs - // Note that a single mouse click will expand the tabs if collapsed - // Note too that a double click also fires the single click event - // the "didSingleClick" variable handle this case - private void ribbonTab_DoubleClick(object sender, EventArgs e) - { - if (TimeSpan.FromTicks(DateTime.Now.Ticks - _LastClick.Ticks).TotalMilliseconds > 500) - { - //SendKeys.Send("^{F1}"); // toggle expand/collapse ribbon tabs - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnToggleRibbonExpanded(this, new EventArgs()); - _LastDoubleClick = DateTime.Now; - } - } - - private DateTime _LastClick = DateTime.Now; - private DateTime _LastDoubleClick = DateTime.Now; - - // This is assigned the Click event on all of the ribbon tabs - // If the tabs are collapsed, then expand them on a single click of the tab - private void ribbonTab_SingleClick(object sender, EventArgs e) - { - if ((!_RibbonControl.Expanded) && TimeSpan.FromTicks(DateTime.Now.Ticks - _LastDoubleClick.Ticks).TotalMilliseconds > 500) - { - //SendKeys.Send("^{F1}"); // Expand the ribbon tabs - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnToggleRibbonExpanded(this, new EventArgs()); - _LastClick = DateTime.Now; - } - } - #endregion // Expand/Collapse Ribbon - - private void btnPasteText_Click(object sender, EventArgs e) - { - StartGridEditing(SelectionOption.End); - _PastePlainTextOvrRide = true; - btnPaste_Click(sender, e); - } - private void btnPasteImage_Click(object sender, EventArgs e) - { - if (MyEditItem is ImageItem) (MyEditItem as ImageItem).PasteImage(); - } - private void btnPasteStepText_Click(object sender, EventArgs e) - { - StartGridEditing(SelectionOption.End); - _PasteStepTextOvrRide = true; - btnPaste_Click(sender, e); - } - private void btnSaveChgId_Click(object sender, EventArgs e) - { - (this.Parent as StepTabPanel).MyDisplayTabControl.ChgId = txtBxChgId.Text; - (this.Parent as StepTabPanel).MyDisplayTabControl.ItemsChangeIds.Remove(_MyEditItem.MyStepRTB.MyItemInfo.MyProcedure.ItemID); - (this.Parent as StepTabPanel).MyDisplayTabControl.ItemsChangeIds.Add(_MyEditItem.MyStepRTB.MyItemInfo.MyProcedure.ItemID, txtBxChgId.Text); - } - private frmImportWordContents fiwc = null; - // open the Import Word Text dialog - private void rbnImpWrd_ItemClick(object sender, EventArgs e) - { - if (fiwc == null) fiwc = new frmImportWordContents(); - fiwc.MyStepRTB = this.MyStepRTB; - // B2019-108 When closed set value to null - fiwc.FormClosed += fiwc_FormClosed; - fiwc.Show(); - } - void fiwc_FormClosed(object sender, FormClosedEventArgs e) - { - fiwc = null; - } - private void btnCMImgSz_Click(object sender, EventArgs e) - { - StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("Change Image Size"); - MyEditItem.MyStepPanel.OnTabDisplay(sender, args); - } - - // C2021-005 user selected a font size from the dropdown (table ribbon) - private void rbTblFntSz_SelectedIndexChanged(object sender, EventArgs e) - { - if (!_initTblFontSizeDropdown) - { - float newSize = Convert.ToSingle(rbTblFntSz.SelectedItem); // font size selction from dropdown - ChangeFontSize(SelectionOption.All, newSize); // newSize is the font pt size not the RFT font size (which is twice the pt size) - } - } - - // C2021-005 user selected a font size from the dropdown (context menu) - private void cmFontSizeList_SelectedIndexChanged(object sender, EventArgs e) - { - if (!_initTblFontSizeDropdown) - { - float newSize = Convert.ToSingle(cmFontSizeList.SelectedItem); - ChangeFontSize(SelectionOption.All, newSize); - } - } - #region Table Cell Shading - // C2021-004 Table Cell Shading - private void btnTblDgnCellShading_SelectedColorChanged(object sender, EventArgs e) - { - Color newshading = btnCellShading.SelectedColor; - MyFlexGrid.SetShading(MyFlexGrid.Selection, newshading); // assign the selected color the selected cell(s) - MyEditItem.Invalidate(); - MyFlexGrid.Invalidate(); - } - // This adds a button named "More Shading Options..." to the DotNetBar defined Color Selector button - private bool _CustomButtonAdded = false; - private void btnCellShading_PopupShowing(object sender, EventArgs e) - { - if (MyItemInfo == null || MyItemInfo.ActiveFormat.PlantFormat.FormatData.ShadingOptionList == null) return; //not shading options defined in format - if (!_CustomButtonAdded) - { - ButtonItem button = new ButtonItem(); - button.Text = "More Shading Options..."; - button.BeginGroup = true; - foreach (ShadingOption ShadeOpt in MyItemInfo.ActiveFormat.PlantFormat.FormatData.ShadingOptionList) - { - ButtonItem btn = new ButtonItem(); - btn.Tag = ShadeOpt; - btn.Text = ShadeOpt.ToString(); - btn.Click += new EventHandler(MoreShadingOptionsClick); - button.SubItems.Add(btn); - } - btnCellShading.SubItems.Add(button); - ((MenuPanel)((PopupItem)button.Parent).PopupControl).RecalcLayout(); - _CustomButtonAdded = true; - } - } - private void MoreShadingOptionsClick(object sender, EventArgs e) - { - ShadingOption sopt = (ShadingOption)((BaseItem)sender).Tag; - /* debug information - //string str = string.Format("Alpha {0}\n Red {1}\nBlue {2}\nGreen{3}", sopt.Alpha, sopt.Red, sopt.Blue, sopt.Green); - //MessageBox.Show(str,"more shading click"); - */ - MyFlexGrid.SetShading(MyFlexGrid.Selection, sopt); - MyEditItem.Invalidate(); - MyFlexGrid.Invalidate(); - } - #endregion - - // F2022-024 Time Critical Action Summary - private void btnTCASCreate_Click(object sender, EventArgs e) - { - if (MyItemInfo == null) return; // if creating a Time Critical Action Summary before rtb exists, return; - if (MyEditItem != null) MyEditItem.SaveCurrentAndContents(); - OnTimeCriticalActionSummaryRequest(new StepTabRibbonEventArgs(MyItemInfo.MyProcedure)); - } - } - public class StepTabRibbonEventArgs : EventArgs - { - public StepTabRibbonEventArgs() { ; } - public StepTabRibbonEventArgs(ItemInfo proc, int oringFlg = 0, E_ViewMode viewMode = E_ViewMode.Edit) - { - _Proc = proc; - OringFlg = oringFlg; - ViewMode = viewMode; - } - private ItemInfo _Proc; - - public ItemInfo Proc - { - get { return _Proc; } - set { _Proc = value; } - } - // B2025-036 split screen print issue. if oringFlg == 1 the ctrl-p keys was pressed. - private int _OringFlg; - public int OringFlg - { - get { return _OringFlg; } - set { _OringFlg = value; } - } - - //C2019-036 View Only mode work with Checked Out Procedures - public E_ViewMode ViewMode { get; set; } - } - public delegate void StepTabRibbonEvent(object sender, StepTabRibbonEventArgs args); - -} diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs deleted file mode 100644 index a7dc72ad..00000000 Binary files a/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs and /dev/null differ diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.resx b/PROMS/Volian.Controls.Library/StepTabRibbon.resx deleted file mode 100644 index cf608a76..00000000 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.resx +++ /dev/null @@ -1,1603 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAI0UlE - QVRYR53XSWwb1xkH8JElS+i50KUIempB9FyguQRoiya2gSyHOEWQADnkFtRxmwRBENcIigZx0sDNVsCJ - d1mSZcv0EluS7aS2JFv7QslaSIkUd3KG+zILZx/y3++RVBzvTgf4YzhDit/vfe89YsSx41/79nN79/yj - 9ejBEz/vOtLb2XWkp7PrKOVYIydYjnffThdds/z43vGezu4TvZ09J04209d5svtUZy+d93/62c8unh+s - 17rvMdh3k+s/fPmXKyPpq4GJ4mJwpugJe0qe6FLJE/eWPIn1socPlD1CqOxJRURPOip6MjE6s9DrVIS9 - V/LwwaIn4S94Yms5T2Q16wkupT1+D+8ZuTL951K8yrW0tDQr3nVc7p3k3Ie+dwVuyKnYjIXkgoXUio3s - uo180EEx6qCcqEISapDTNShZoJID1HzjrGTZ/SrElINS0kI+qiMTUiH4ZcS9ZUwNL+2ChAcDhnonuDOH - vnP5RyUhOmUiMW9CWLaQ8VnIBQgRtlGMESLpEKJaL8aKVhIaKhnnNiLDEDYhTORjDFEBH5Awc2N5FzQ0 - q93nGOwZ5/oPfudaHxEJYCA+b4BfMpH2Wsj6aUQhBmBf7EAUCJGhkS/zMD/8DMapoUYnCpQ8IbLUqbSN - smCikCBERMHc+Mou2I8EXHWtDYtCZJIAcwaStwykvCYBaDQhC4UoARLsiwlAI9aOnYVxqA/64E1oORta - ie5R1CJNUZ66RPfEDCF4DZ4pAuBhgO6xJqBMAB2xOb0JMJAhQC5IXxS1mgC7DjA+/gr6ue+hzaxBK9jQ - RUCXGtHEGtQyTU2REFkdi7OrDwcMMMA3DUB4UiOARgAdwioDGMiFGMCsL7AyzbFErTY+ovYfPQXzP0eg - FwwYSg1mBTDVZio16EoVFdHE0sJjAE5/c8XlGy7dCfDSHNYBBgoxAvAWxLQFqUSArw7D2vtPWJ9+AUO2 - YWo1WHoNjgk4ViO2RZ/TLKwsex8OuNR9swkoEkBFbF5FYkmD4NOQCejIhQ0U4wZKtLDErAmZWqyfG4Kz - bQfs/V/ANGuwzSocu4ZqtYZajcrRwc62bcPr/QmA0GSlDkgu0z5eI8CGVt/XxaSBctqg9ptQJAf6og+1 - X/0aztFjoLpwHIeKV6koAzQFdLD7jwQM9BDgIAMUhNAUATyVOiC1rtJeJkBMo9HrEHMG5JIBVTah58uo - PvscnCtXaIc1Cm0iNiE/HTBSEMJTCmILCpKrFaT8KrIRFYWkhnJGg1TUUZEMaJoJM51B7ckn4XzyCWwq - yFp9PwS79vl8jwLcIMBll2+UADMK4osKeF8F6WAFuZiKYkqFmNegiDrUig6dilk08urTT6P64ouwBQE2 - FbobsQl4dAd6CXCIADfyQmSOfr+XZAjrCjJhBflkBaWsSitfRUXRaPQE0DQ4b70Fu6sLzjvvwPn6a1jN - LtyNeLxFuNkBBpiXkViVkdqQkY0pKKQUlAsVKLIKVVWhGbTnV1Zo/p+FGYnAXFhA9YUXYPl890U8FuBi - zyh36uCQyzuaE8JzEgEkpIIycgkZxawCqazQ6Ct1gEoAa98+2O++C51hTBM2daD66quwksl7EJZlPUYH - To5ypw8PuXw3c0LEIyHpJUBIQp6XUSrIkCUCVCqoUOu1cBjOjh0wJiagUfE6QpbhfPABqq+8Asvvh0Vz - b7NQVZMQPr//Lw9fA30jXP+RIdfaRFaI3hLBr4vIRCUU0hLEEgGogKIoUAhgfvkl7DfegEbXmq43EDRa - o1SCs3cvak89BbuvD/boKJyBAdi9vSi+/HJvjeN2EuE3lC33UAZOE+DYkGt9KivEVkQIGyKySRHFnARJ - lOoAmXWARm8//zy08XGorDitftYJ68gR2NQBZ/duVHfuRHXbNtSeeAK1Z56B8/77ELdvP09F/075N+UP - DHAHYrB/hDtzfNDln80I7AkmFS4jJ4goFUVIEiEoDGB8/jksKqLOz0Pv74d54ADM48dhXL0KY3kZBs/X - p8PI5WBfuFAvblMKO3ceog78lor+rpmWOwHuYe7MiUFXYD4j0PMf0tEy8pkyymURIgNQcYVWvvXSS9Au - XoQ6PQ01GESF2s46odI0sN3BpkSnsIVp0NybNGUGfS69Z88BAjxHRX9P+dM9iKGzw5y7e9C1sZAWkoES - MokSCjkCsOI0KimRgPHee9Bp/lknZNoNCpuSZuq7g21RKsgAdURzh7BF6l1fry/CZtE/UnZQbq+FoXME - 6CHArZTABwnAl1AslCGPjUEZHITa0wPztdcg0zaT2Hpopr4wKT+GMMQmhCHY69XVxvNAnmpR0TbKVlb8 - B8Dl89e5s70DruBSShDCRWSFAuTePqg0x9LMDCxaWMp/r0GUFYgiTQubms3QdX2himy7Eoo+U//NqDQw - DLUJeOBx+QIB+giwIghCvITyyTPQ3n4bZfp1M15/Her+/SgWWVeKKOaLND2FO1LM0X1KKU9/S50T2eIt - 30YtL9FT8cMAVy5e586dGnCFvIKQCmWgvvk3SN9+C233X6HSqs/Hk8hmcsimssgIGZqie5Pls9S5LHKp - HPLpPP2CNkAsiwuLjwE4TQAfL6SiWZSPd6OyZw+kDz+iR7IgUnwaQlwAH+PBR5uJ3BW6J0QFpGIppONp - ZJIZ2sq5ejyznkcALm0CkkIymqEvSdLDSAB8nEcimkQinEA8FEcsGENsgxK4N/FAHPGNOBLBBJKhJPjw - bdDs5OyjANe48/0MkEglQikkIknEI4l6wWggiog/gvB6GOE1ii+MkDf0Q8JeusdC9yO+CKJrUUTXo4j7 - CbORqIOmx6ffhPMAQEdHB3e69xx39GD3L6bHPAfnpxfPzk7NuWcmZtzTY9PuqZtT7snRSffkyKR7Ynii - kesT7vHr443ztfH6681r9v7k8KR7amTKPX1j2j0zNuO+dOHS9hyfa1a862hra+O2tm/l2tvbW9raW9u3 - drR1tLa1dmxp3dLR0trS0bKlEa6F66CP/79ppdznn1OO+x8FMcZP/Ws5zwAAAABJRU5ErkJggg== - - - - 17, 17 - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAI0UlE - QVRYR53XSWwb1xkH8JElS+i50KUIempB9FyguQRoiya2gSyHOEWQADnkFtRxmwRBENcIigZx0sDNVsCJ - d1mSZcv0EluS7aS2JFv7QslaSIkUd3KG+zILZx/y3++RVBzvTgf4YzhDit/vfe89YsSx41/79nN79/yj - 9ejBEz/vOtLb2XWkp7PrKOVYIydYjnffThdds/z43vGezu4TvZ09J04209d5svtUZy+d93/62c8unh+s - 17rvMdh3k+s/fPmXKyPpq4GJ4mJwpugJe0qe6FLJE/eWPIn1socPlD1CqOxJRURPOip6MjE6s9DrVIS9 - V/LwwaIn4S94Yms5T2Q16wkupT1+D+8ZuTL951K8yrW0tDQr3nVc7p3k3Ie+dwVuyKnYjIXkgoXUio3s - uo180EEx6qCcqEISapDTNShZoJID1HzjrGTZ/SrElINS0kI+qiMTUiH4ZcS9ZUwNL+2ChAcDhnonuDOH - vnP5RyUhOmUiMW9CWLaQ8VnIBQgRtlGMESLpEKJaL8aKVhIaKhnnNiLDEDYhTORjDFEBH5Awc2N5FzQ0 - q93nGOwZ5/oPfudaHxEJYCA+b4BfMpH2Wsj6aUQhBmBf7EAUCJGhkS/zMD/8DMapoUYnCpQ8IbLUqbSN - smCikCBERMHc+Mou2I8EXHWtDYtCZJIAcwaStwykvCYBaDQhC4UoARLsiwlAI9aOnYVxqA/64E1oORta - ie5R1CJNUZ66RPfEDCF4DZ4pAuBhgO6xJqBMAB2xOb0JMJAhQC5IXxS1mgC7DjA+/gr6ue+hzaxBK9jQ - RUCXGtHEGtQyTU2REFkdi7OrDwcMMMA3DUB4UiOARgAdwioDGMiFGMCsL7AyzbFErTY+ovYfPQXzP0eg - FwwYSg1mBTDVZio16EoVFdHE0sJjAE5/c8XlGy7dCfDSHNYBBgoxAvAWxLQFqUSArw7D2vtPWJ9+AUO2 - YWo1WHoNjgk4ViO2RZ/TLKwsex8OuNR9swkoEkBFbF5FYkmD4NOQCejIhQ0U4wZKtLDErAmZWqyfG4Kz - bQfs/V/ANGuwzSocu4ZqtYZajcrRwc62bcPr/QmA0GSlDkgu0z5eI8CGVt/XxaSBctqg9ptQJAf6og+1 - X/0aztFjoLpwHIeKV6koAzQFdLD7jwQM9BDgIAMUhNAUATyVOiC1rtJeJkBMo9HrEHMG5JIBVTah58uo - PvscnCtXaIc1Cm0iNiE/HTBSEMJTCmILCpKrFaT8KrIRFYWkhnJGg1TUUZEMaJoJM51B7ckn4XzyCWwq - yFp9PwS79vl8jwLcIMBll2+UADMK4osKeF8F6WAFuZiKYkqFmNegiDrUig6dilk08urTT6P64ouwBQE2 - FbobsQl4dAd6CXCIADfyQmSOfr+XZAjrCjJhBflkBaWsSitfRUXRaPQE0DQ4b70Fu6sLzjvvwPn6a1jN - LtyNeLxFuNkBBpiXkViVkdqQkY0pKKQUlAsVKLIKVVWhGbTnV1Zo/p+FGYnAXFhA9YUXYPl890U8FuBi - zyh36uCQyzuaE8JzEgEkpIIycgkZxawCqazQ6Ct1gEoAa98+2O++C51hTBM2daD66quwksl7EJZlPUYH - To5ypw8PuXw3c0LEIyHpJUBIQp6XUSrIkCUCVCqoUOu1cBjOjh0wJiagUfE6QpbhfPABqq+8Asvvh0Vz - b7NQVZMQPr//Lw9fA30jXP+RIdfaRFaI3hLBr4vIRCUU0hLEEgGogKIoUAhgfvkl7DfegEbXmq43EDRa - o1SCs3cvak89BbuvD/boKJyBAdi9vSi+/HJvjeN2EuE3lC33UAZOE+DYkGt9KivEVkQIGyKySRHFnARJ - lOoAmXWARm8//zy08XGorDitftYJ68gR2NQBZ/duVHfuRHXbNtSeeAK1Z56B8/77ELdvP09F/075N+UP - DHAHYrB/hDtzfNDln80I7AkmFS4jJ4goFUVIEiEoDGB8/jksKqLOz0Pv74d54ADM48dhXL0KY3kZBs/X - p8PI5WBfuFAvblMKO3ceog78lor+rpmWOwHuYe7MiUFXYD4j0PMf0tEy8pkyymURIgNQcYVWvvXSS9Au - XoQ6PQ01GESF2s46odI0sN3BpkSnsIVp0NybNGUGfS69Z88BAjxHRX9P+dM9iKGzw5y7e9C1sZAWkoES - MokSCjkCsOI0KimRgPHee9Bp/lknZNoNCpuSZuq7g21RKsgAdURzh7BF6l1fry/CZtE/UnZQbq+FoXME - 6CHArZTABwnAl1AslCGPjUEZHITa0wPztdcg0zaT2Hpopr4wKT+GMMQmhCHY69XVxvNAnmpR0TbKVlb8 - B8Dl89e5s70DruBSShDCRWSFAuTePqg0x9LMDCxaWMp/r0GUFYgiTQubms3QdX2himy7Eoo+U//NqDQw - DLUJeOBx+QIB+giwIghCvITyyTPQ3n4bZfp1M15/Her+/SgWWVeKKOaLND2FO1LM0X1KKU9/S50T2eIt - 30YtL9FT8cMAVy5e586dGnCFvIKQCmWgvvk3SN9+C233X6HSqs/Hk8hmcsimssgIGZqie5Pls9S5LHKp - HPLpPP2CNkAsiwuLjwE4TQAfL6SiWZSPd6OyZw+kDz+iR7IgUnwaQlwAH+PBR5uJ3BW6J0QFpGIppONp - ZJIZ2sq5ejyznkcALm0CkkIymqEvSdLDSAB8nEcimkQinEA8FEcsGENsgxK4N/FAHPGNOBLBBJKhJPjw - bdDs5OyjANe48/0MkEglQikkIknEI4l6wWggiog/gvB6GOE1ii+MkDf0Q8JeusdC9yO+CKJrUUTXo4j7 - CbORqIOmx6ffhPMAQEdHB3e69xx39GD3L6bHPAfnpxfPzk7NuWcmZtzTY9PuqZtT7snRSffkyKR7Ynii - kesT7vHr443ztfH6681r9v7k8KR7amTKPX1j2j0zNuO+dOHS9hyfa1a862hra+O2tm/l2tvbW9raW9u3 - drR1tLa1dmxp3dLR0trS0bKlEa6F66CP/79ppdznn1OO+x8FMcZP/Ws5zwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACLUlE - QVQ4T52TvY/ScBjHuVIRKHA9JAgnL+VoC7TX0kLLS6EvFBTa0uj5J7gYF+PsfpOTMrg4ORgHY+LCYJwc - TYyJiYuDLu7GxHgxd/Hnr5fA8TZcrsmnzfN9nufTNPnVBwDw2ZYljGzr3ciyTNu2EC87L75eb+DvD67f - hU9g9vt/HNs5cMaOf9Owohro7YNbe8PhjfuzzBOgkDuabk6bbRXoxuBkNLIeus6yhKyIwY5umo5tHxmG - +Wwu8G5QkIa0jN5gqnR1oOkGuOk6b1x3jHl9uaWGhpb1UtXNY1luPmJ4KbIkmAElAcgD3egfa5oJxq77 - oq3ovKJoE7XbBbwoTWhG2F7cWRJ4dFR1S9fNCvykT41mB9TqjSOxXvtJM9zrYokLrc4vFYtUBcngq9Lf - tqICvlr7RhQr8U1za4FHXZIIurT/mePFf1AEJLkFGJb7uml2LRBrcp4us1+g4KRcYV8lkmkplyenglgH - VIm9tzq/VJRZLpUlih9yBQrAt79Pp3bjkVgM244nsPwe/VQQ6r8pRsgu7pwtC61grkA/T10r/NrnxB8s - V2VmvQiOB0MhLMZVxY/pDPEkU6DnZ2Qu2M0STjJFAIpmAUmXD0NY9PQMzEBRPwJzkiSp71F8J1/ipNMj - f9rE8XggkUgexq9cBXmi+DYYjtCRGL72T+D4jr/RaE+waFgu8c0zgUcmT9UuBS4/9m0hmh9Fo7N8FXih - CIKE5/Vi8yJsDM8P8P0HLGwR4Wl3ICYAAAAASUVORK5CYII= - - - - Will delete the current item and any of its subitems, RNOs, etc. Checks whether any transitions are pointing to this item from outside the item and if found, does not allow delete, but prompts user with list of transitions. - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABL0lE - QVQ4T7WPuUoDURhG8xxaCHY2Yh+wECREVCRxHBOymMlMZrKYZYxLOhVBCAiCNr5AxFJfwd5C0catEsUm - hYiFxXFCCEq4TmJu5OMU93A58HuAviKUMnw/ftn90zs7tVeuHt5cfjnrJtiK1c4/SVZv3KOdgj9j+6d1 - zMMX1O1bHp8/xNFOwUZsTD3Bq52xWaszuXLBSOCYId9Rb8HWJsrXGHt3DI7vuvxy1m1wNHXJsO+AAe/W - 34KZUgWrUMHMb6Dn1tCyqySsMjHTJqKXCGkF1KU887EcgUiWuXCamUWLadXErxhOoi0ovX8PWsXmucby - OsnGuekyccsmatiEk0UWEjZKPE8w2jg3w2yoee6UksIf1J1EW7BfCKUMQimDUMoglDIIpQxCKYNQ9g6e - L18OKkyOPi51AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABMElE - QVQ4T6WQvUsCARjG7y9pa4i2hlpzy0iN7PIUT/Pj8k5NvcM+bOtjqqWxKBCDIhpqLAhqcAoiaBGXw5YW - sS1o/NXhcgdndMmPBx6e4eF5XwEYSq6hF7mGXuQaepFr6EWuoRcJeb2GWq6RK22SLa6TLqyRUqskcgbx - rE40XSayXGIxUWQhXmA+phGQVOYiOfyi8tMyJDb7PwS10p+vrG6QseZrVZKqgawYxDIVllIGYrJEWLbm - 5wlG+/NnxRX84ay9y0nt5A1pq0nIuLfeNRCbdbJ30aXx8IVPufFWMJ2+Qjt4xSo4vv0koN8xJV8yOnPo - WmSzfVpmj7HQKbsNk+3zLtJOmwmxzkvr/W8FFu3OB5OxM/xGk/HgEY9P5sAzbNZJu9NjxLdP/fr5lx8g - fAPOtXjW7jTlPgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACbklE - QVQ4T42QSU9TYRSG+y/cunRhYuJCV4proysTY6IxUYIDUUAiBhQUQY2hKggKEgZRGWIFhYIiDaUUEERk - aBCUSRAKWihgoe2dSh+/exsWxmpcPDmb8w7nmIA/cHaPSALsnS6a2/ppaOnFYu2i6qWD8hobRU9eU1DW - KOm7UQ06e0cVMXF9dtM3PMO7/kkcPV942/GJxtZBmuwuCiua/m4g0jWjQVekgdX2IdKgzkFZTYvRIL/U - qodEN7A02AmFNgw0LYSqagaSrBCUZH76/KRn5YpVYfDKPiEJeGEbo7JphJLaQQqqP3LncQ/ZjzpJv+/g - cl4b/oBkCL3LPhY8yySn3owYNDimjHudQ15sfR6sXfNY7LM8bf5KSf0EZdZJrj10suhdxb2wxMzcDyan - 54k7ezFiINK13xsMGQ1yK95zu7SLG8UdZOS1Ep+Qyqn4FEO4iWFQVNWOpt8qUMW9ihpCVjSCsipqK6z4 - JC5llRrL0TCZi61CKMRCqKOL1/wy92oXyXm+SPaz76SVukl4MMNJ8xSHs8bYnzpKTKKL3WcHJVN2vsVI - DkqqeJLEsi/I0oqf3DqvCIAKZ5hCW4icepWMapkL5QFOF60LAuxJHJZMsUm3OBqXxqFjycSey+RKVgF5 - hVWYLZ5Ig8rNBt8iDa6LBmkjxCS52HVmQIl6l855c7f4CwaqFiaoCOQN1oIhVtc15hZlth+4G12sc+Lq - GyFEPDUs/hLGL23g9akseGWm5oMMT6+zdV9mdLHOkZRaFJG8FgjhWVGY9UiMuwMMjPvoGVmlfWiZLTuO - Rxfr7DyYwba98cbSv4gq/n8w/QLUGh0VPWo3NgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACX0lE - QVQ4T6WSa0hTYRjHD/TBvhRdqE99Koi+RFFB9SGjUAsvLYzEjMxFTKVkk6XpSC1N0eVtadqMvAw1b5Uo - KUUiJI7uGs7oIpEauZa1s3nP4tc5RwZNBgW98OPA+77/3/O8D0cA/gufmz3tOXTdzqS1KhVtTMh2X3c8 - CC21RXoJPFQVHMdpr2PSfoORwXySNUEUZeu5ZjRgyk6SCVwsYEZsZs7VxIyzHku5nqnxGpJjVbbXvSlc - OBtKinoH9p6TjHesRxt9SMotEsjhOVcDZTkn6LPmI34qYWzQwAfrKdoqVMRG+VOXto4XRQLxx0K8BU01 - BQsC8RbGtGgy9JEYEiI4Hx+OXqNCpw4lLiqAYu0GRRAZ7O8tqK80Mis2MuswMzWai+NVAraa1QoD1avo - K1/GU5OfEpYJ2L3VW2Ax5zDtqGJ6OIupN2eYfHkEsX05hdUd5JpbuXi1kRSjBV1mBbGpJqIT87wFlaWZ - TIyYmBzUMPEsFPejbXy5u0YJe9bc/E+crhmGx5xExF0iLMYgby8IKgrTEd9m4X4ShLt7M67OtYxUC0pl - eVXe6VEwN3QxMGRXwg96bRwIV8vHglCal8q3/nO4ujYh3luJo9mPoZuC0vaP+V98d0uVPzsZeG/H2v+R - 4CgdQVJ4/8HD+O/Zi1B8OQnH4zgpvIKvLUsZrV2CrUxAK71ZbtvTwXWpgxJLJ23dNuUrs2vLRoQrGYnK - D+KZsgeNNLA/Kz+0vlPCzff7aOh47iUILEw/Lf1hKtThgYTt26kcyNOW3+yp5gtFIA/CF0elacsX/obP - 8L+D8Bsb4cocWY3wtQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACLklE - QVQ4T82TX0hTURzHV2B/QCGksIegArEMCveQMmbYQ1gucoTZZD2MGvjiHqa0ae1218Pc5W5Luy4NiuaY - FZWWNlg2UUQcFcZABkUFtlxlw4VOKmva+nbONZfKHoReevie8/t9z+/3OYcfHAmAf9KyxNY+FK7lvZOF - lU1jK/zBdD7VskSudnbOfE0gU2qIbJExa6lH96X+0nqqVEBvOS/0QllzAwVKO/YorDHqC7cCSOcvKhWY - 2/rwIzGPh8NvYRCGsfNQIzbsM65Z9L2BMDjPKHJLraR8BaCh2ZdtbvVDy3ahrPo69iodkKuvoLCq7Y3W - dAd63gtVXQd2KzgCtkB74V52CkCensG0+DEZ/474bBKBF3FozD7kHeGwab9pxHjJS+qAL7PzGApN4aTx - PnIPc9RKAUx1fA818DT0CXbPcxzT3UZOMQvS3EABodcTCL76DN49gkpjF7bKGZx1+FgRYHcNTOsae1Be - 0w5phYD8Mg55pRbkyBj6grCee7BwdoKcHbVh2wEGm4vqUaS6nBAB1msDSCZ/YTz6DY+ffYDFFcSOgxT+ - d1Bn2E58jM4gHImhe3AMOr4f+YqFYUpMwiPMzf0kze/h6AhCc9H/nwFI80YKiExMo+/JOzjvjqLC0I1d - ZFYi4PQ590t1/U2UaFohq2qGTNWE7SVslEAy/wDWEcUU1VfHy3UuFJ9qgfS4DVkFtVMigC6rkdPTK/4N - smeo9O71RFk0T1u8ekHyG2jrt2s5yYVVAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAB+ElE - QVQ4T2P4//8/RRirIAxP3vItZvLmrzvm7f76aPnBr0dWHvw6ZdWhr1LIalA0IOO+DV93APGf7nVfnzeu - +PK4fsmXO3N3fn0MNOATsiFwDd2rXv1fduKrAZi97uuy/o3ffqdOevfGpeDEb+vU7X/ME7Z8d6+4+3Hm - 9q9vgAbcRDEAKMDZuOTl/3kHvl6tX/G1YcKmb3/iep7/cy04/t8uY/cv09g1x13ytz60jF/+J6zj3c+l - B77eRzEAhItnPv+fNevz/8I5X/5H9nx8YZW85a9F4oYfprEr80HyAbXbVQwjFr9wLb/9vmHplz0YBiT1 - Pfvv3fTmf3Tv5/9lc9781/CetNokZoUjTF7BoY7ZLuvQb9eyO68bVn45BBOHGxDU/PS/WfH9/55Nr8Au - Sex59L9u8VtLmDzQAFa7zEN/veqefWte+WULTBxugFPF4/8ORdf+W2Ue/28Sv+2/YdTa/xo+U4FSEHmz - uPVKtpkH/wW0vP5bMP1xKUwcbgA6BgUsMl/da5K7a9ntP2mT3//r3fCVDSYOV0AIW6TsuxjS8eFfWN35 - XGRxFEXYcFzfeyWH/Asx/i0f/vlVXvmmFTCbEVkeRTE27FH92Nm/5dMvj5KLP42jVnmhy6NwsOGo3s+R - ziXXGk1j1olik8cQIBVjFSQe/2cAAG4MzKZBtgOMAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAB5ElE - QVQ4T2P4//8/RRjOWHXoq9TKg1+nLD/49ci83V8f9az/klK58AsnsmJsGEyANAPxp7k7vz6uX/LlTuOK - L49bV325U7Hoy+fKRV9S0TUhYzAB1Hxz5vavb9wrH7w3T9jy3Spl2x+H3ONfUyZ/flE458uLwrlfwkDq - lp34auBQdA3IRDNg6YGv98M63v00i57/2yVv/U3T2DXHgPiLWfzm38mTP/9Nn/n5WfbcL5HzDny9ap15 - /D/QQrjXwETD0i97XMvvvFf36rkVULtdBSRmGrsy3zh6+VedgNm/Qjs/Pge65H/WrM//TeK3AqXRXNCw - 8ssh1/J7r9Q8+w4rONQxwyRNYlY4anhPWl02583/6N7P/72b3vzXC10MlEIzoHnlly3e9S++anhPvgk0 - gBUmOWXrV10gBtvs2fTqv1nx/f8aPlOBUmgGFEx/XBrY+uavUeSaX0ADuGGSoACzAvrZJH7bf72QJWDN - qm5dQCk0A3o3fGVLm/z+n2vZ7T/qXpPckRUgBxg2DGeE1Z3PDen48M8iZd9FZAWEMJyhFTCb0b/62kv/ - lg9/HfIvxMT1vVdCVogLo3CAhvD5VN48FdD6+atH9WNnZDlcGKugd8Or0Kjez5HY5NAxVkFSMFZB4vF/ - BgCu1sRwcCvT7QAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAACG0lE - QVQ4T51TbUhTYRQ+WVgw29h258012txsLXSOiAJd8UIZSBFkVhAYBUWIYqZhhQ4ug8JWmR+Ykj9CEkaN - pB+lDGQMspDAoqDCws21K0T5Y8Toy5Sn17rIiH54feD8OAfe55znOeelJaHd5aEbm3RKph4l4XVwBC1R - JVWP8lEBdXENtF0WSSmpg/uRDedntNgVEUD+PKaUFdzaquPBqHcLo+5iRl2FjGtm1OZkdNXBqNXG3A+t - OBKz4dSkAdbbYop8xgw/+OPKlyJOvtfj8CsTysfy4I1YsNDVGiqAod8F2wMXDk3aUTGRj7InZuQEhAw/ - eOd6eS1a09m4+EmD6oQeR9/mYu/4epQ+zkdh2Imikb8E+yecKHtuhyNkQ1aLTvGDj90g56BjdhUC39fA - n9agOaVD44wRtR/5ZNNmVCU2LBLsebMZ26MuVI5wP+qzPbSguSGpUUXQk/aiKmoA1a3kBNywUPIm3s0H - 8WK+E6NzLQj/Oo3B2QO489OL3h8b4f9iWiS4/HkfuuUdMEmrFQnc7bbxPgx9GMT9RA8GpiT0TVWjM16B - K7ESSDE7mmTjH4Kzyd2IfG1EcYeYYeK1Ah0F7HxdVkaXLIz8ZkaSyMgnMGrWM7qgZe6QCcfiRXg914+D - wW0pqs1Sd9buuwKefbuH62NnQDUr/jmkJaBp6ByeysOw+MTlnfLxgRPY2V66/M9ENeTh8R/dRL8BDkAX - agnC/hIAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACh0lE - QVQ4T4WSyU9TURjF+5+4YOPKYOLGlYmucAEoMSExxoVAwCKCIhEEFYMEtSBCJDRImawgDaARlASVSUFG - FXBoAZmnFspUW9rX937e9jUxkZe4OLn5bu7vnJMvVwf8V7aWg8NbQ8ffY8+yTTaHKaymTv2eONki7hs0 - gX/ls0aZZ9sPw7aBhZ5YcRYz8/oQrrGIF5rAPolkdstA6md3qUmcvQTmDWu2xmMNWRsPKHOdMbhWW5DZ - wu1oJTAvdhzRBvbJnnWD7VILe50WYWIRTSxiRnbkazzWkGSLjp55E26R13IsTtMx6IhTdzB9GV1VwwSV - z8apePoFY80oj01DlBgHeFjWx4NHPRQUdmIuz6W7JQflaz6bjZGsN8WyO5XM8sBZdKb6cRRFQZIVvJKM - e09mxy3jdPmxb0ksOSVm7T6oMsLNLDgfBafDMJw6Ksqh01Wax5AFnFa+iL5kgbjCec4VzOLYkVjZ9DO/ - rg2nXn2uGjwR1SW/wpm8GaJuTRORNcmJDBtrgfQNSYVzMgUcCTEqPGDzcCm1XjUw1n7GJyl4fDIuj8ym - qO7Y8bMsqmslD0156LN60KeYVYPy6hH2BHy3boS8miHuVA9w29QP68MhWCSH4CtFbaQaXvHhp4ckfZ1q - UGYaxu0Vi/P4g+n27VB6wCAg0SIAj87sMTjp4aOAe767SUyqVQ1KKwZxic0HG9SKBlVqg+Fw8QVCcEZp - B+nF7aEGrXR9cxOfWKMalBg/BdOdu/7g4padPmYdPiZXvPxY9DI252X019/0bpH+btxNXEKVahD4MIaS - Xu4VdZF3/y25+e3k5LaRmf2Sa9ebSUu3kCI2rk82k3ixlviEai7EmYICdH8AxXsU+dXRvF8AAAAASUVO - RK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAiklE - QVQ4T6WQ0Q2AIAxE2cCRGMVRHMFRHMFRGIERsAUuJFxNqF7yPny5ltRQSvmFKT2Y0oMpPbAQ9cIlbNQn - EULsA8rRyf37oj6JFixATuHTgrtTh4WlEzRYgBOSoGfs1CfRggUI/kumPokWLNBBBWck6pMYwzN6QqQ+ - ifHqTA31Z+HFlB5MuU4JD0dnUwrgCrV/AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAiElE - QVQ4T6WR0QmAMAxEu4EjOIIjOIKjOJIjdARHcKSYSyiCvA+DBw+8x7UUbGb2C5QVUFZAWYFlZnNUBh23 - KDOz0504rI5blE9OR0Kv4S3KJypiikJblJnFUbmieXCLMrM7Kkc0D25RZnRQRRdFcIsyn62Pgf4Ib1G2 - tr6I4JZkBZQVUH7H2g1WeXFvwrwKSQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAjklE - QVQ4T92RUQ2AMAxE6wApSJgUJCABSUhAChKQUHrbGjgYH4U/Lnlhd+G6ZRNV/UQzjNAMIzTDCGxEkoGF - szSyRB0yIp0x1h9Xo79kEzx1yBT5jtjd5Rm+3CFT9IMBuLTNQOCXONcMa+6QOTQYPgRgjSyLOmTuwpHz - sc+iDpki7IT3foI7ZIreD4ijsgOjTd7+jqoH+QAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAm0lE - QVQ4T62NUQ7DIAxDe/9LMyclyGauygZ6eh8xtXu11o5qwx1tuKMeOENcA5cJ1M8NOU4PBm6Q7y+4DzUA - MTB7vzzAfahBZ3ks4D7UAPBYeb88wH2oAZgH3F1mUt2uHvxhhzP3xv3ckIPKhcuKzKmfGxL8wPgJ96EG - i4yxgPtQgwVkLOA+1OCFGJuVPpTjhDbc0YY72vB/2/UB43bUVn8JuhoAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAjklE - QVQ4T82M2w7AIAxC/f+fdrVqAwvNLt3DRljCqdB6759awoolrFjCihnckH3j53aCfTODC8UIZuybKTzV - 5eB44I+iotlQsNWNDQqinLFIqxsbFJIysvMd+75BwLQH0POS3LBvprBFhcVSYd/MwIRj2/OSCPtmDmJA - MRL0fYPC7we/sIQVS1ixhO/d2wE0YN1NDoBJDwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAIEElE - QVRYR82Xe1BU5x2GT9KoJYkhEcG7eCuYmzasERMlJ5Dp1EZncs80TmMn2hxrgNYQQBHdVTTYRK2IGkWQ - 5So3gQo4oohMbONdAQNyvCIxawwaURRFhX37ft/uyqrHTPpfz8w7XM7ZfZ7v/jvK/901T1FUkfkPKar5 - YUW1iPxKURc8oqgLmbhuirqou6Iu7uHI579W1HgPRV3yqKL+4zFF/YL58nGmp6IufUJRlzHLPRX1n08q - 6grGibn/InQ005KiqtjwqiOpwSqsIiEq0pjQQb2RFT4WZ3aa706VGU1M1icvYob340gIGInkIBNyX1eR - x+RPcqRgsoqEXkrLSi9ltBPbdRHeeMiaAuD2AzNSexPLN/0Rx+3HDWNe/TaUMQHIzEzDwYN7Db+jfmMK - Er2URie266IAYL9qmNZrzYhYs1IKfJn9BjKvZBomdvlEKRDw3rsoLM5Fy6Xv7/sukVW9FTixXZcU6LwI - XDgMWAYB4fybaQ3rjsnaB3glbBqWbZiMyu0TEdEUYZgtRb/DnMVB8Awag96BzyN7igdssR7A8seA1KeB - yzWSscrbQICTjjdpvCVCgqvDR8MSboE2MwwmTUNOeQgm1QQjuCbkZyOeSS0aB8VkQgDnzfQ/TUV1/AvA - 6ieA/TGSsdpIgDMe6DgFJARKAQFfUQXEpJXgD7M+xMJtz2NAmekXRTwrBIKmfoLpn5cgInwm2hI9gdLX - JGONj4EAlxpv1lPgxTsCVceBpJIS2QOL8oaiR5rpF0U8KwTeCg3F4qQyaNrHsC2lwBYhUI+v+hgILBAC - tzn+Caa7BA7ouhT4zByM+ak+CEz2+9mIZ96ZOkwKxMQvoUAptBkUWPEkwGEUjLV9DQS4yfDmbgpwvO4I - 2GG3c05arQjQ/gLTzEmYHPU0QqJ88FJkNwSGeiBwWi8ETumPwPd8EfjWcLkKBHzclA9hTc/EqtxdnEd/ - hS3xKWB7sGQYC3SjwC0OesLo+wQ6mX/X1uLPcdGYEPU2TFEqnokcBf/QF+D/0Xj4T3kNfu9OhN+bkxEy - bTo+XbQEa1IyUb59B5KK9kOLiIFtjRdQ+apkrOtnIBDXXQiUU2CUQyDMfEegQ6QTON3YhJLSMuRtKkRu - QSFyRPILkZ1XiKzcQmQy6Tn8X1EZNm/7Gnv2HcSmb85Bi5wH27reQJUqGUn9DQS4vwM3/0WB5+4TuE24 - yK0O4Or1dpxs/A5H6nXUMjV1Og5/q+PQER0HmH21OvbU8P8nbGhta0eV3g4tKha2ZG9g1yuSsX6AgQAP - Ft7Mo8AzdwmI7hfgm860c0e9wVy/BbQxV28CV9q5x9wALl0HLrYBP14DznHTE89WNVAgei5sVh/gmyDJ - SDYS4KnGT6QDK0Y6BeZjp1Og3Q3sDr9GeKuAM5cocJECzRQ4T7it1fHszoYb0GZTIKMPsGeCZKQMNBDg - kcpPrKeAn3MSminQKcdfQu8Bi5a74C2E/0T4BQF3tv77K24CczgJs/tyJxwvGRsGPVAgkUMwApj1ECx/ - p8CxTjn2AirBbnDZ7ffARdf/IOBs/XcUEMI7j16HFkOB3H7AwZclI3WwgQALCn5iKZA4HIh8GJZZZlRS - QE48V4udrRZwARbdfi9cdP1Zws9cdkhXHm2DNncObJsGANUUIMNQgNUMby7ioTEMmP0ILBFm7NA75cQT - QPcWu1otxtwI3kT46RaH9I56CsTOhq14IFD7kmRYfQ0EWEpReR6wlgKx3WCJNKOioUOOowsqZrk7WE64 - B8BPXnJIV9RdgzaPAiU84uvGSUbaEAMB1nG8GcnTZyhg7g5LlBnbjnbIcXdBxRJzgV2tlhPOAH78J4f0 - tm8pMD8ati2DgQaetGSkDzUQWNqTAtfCgZQhQFwPWGabsbW+Q7aimTARAXW1WIBdrRYTToy5O7zhgkN6 - 65Gr0MxRsJX7AsfGSkaGkQCrV978mJULH4z3gGWOGdGlt5FQacfCQjtisuxYWWaXUHewaHUjwacIPkHw - MRZVAl7f7JAtrWmFZomEbQd79iSPejIyhhkJeFLg6lQgnV31xaOsYsbCN9qGkLV2PDvXDu+P7FD5U4IJ - dYFdrXbBjxJeR/iRHx1DU3yYAgs+g62Kc+v0GMnIHG4gwNqdN98HsjhZRA2X0BPVS8dR4iwlOqXE6/F2 - nCFQggl1Bze4wWvPc8X9wF7hc/kHrlAgArZdXN5NQuB9ZI0wEOCLAxf5G8BGLhfCZQ231hPVK1+Gb9QZ - KfHBejtOOMdY5JgTrrsJ1Lt6gBH3s/ZehraQAru5wZ1lsUNGtpHAiqeEwO+BPG4YTjiSWURYe6H6q/Hw - jTyFGYWdqGHX/i9J+U8LtLhPYdvHLf5cgGRs/I2BAN9YuHBZMBT0vwuODBYSG71RnTIBY/9WDFNYIVPA - 5DO5TA6TzWQyGUwakwpTaAqznlmHZWvege0gBc6z2iIjx09Brr/i6UQ7rpVC4DI3iiIK3ANHHo/Swj5o - y+8LPckHekof6Fb+ntEPenZ/6LkDoBcMhF40GPpmX+hlQ6BvHQq9Yhj0yuHQvx6BFp3vBRd+Kxk5/gYC - fF0qrtC80J5JmAEcm3mYlFGunENUwXlSxdWyi0t2N/eN/ZzhhzjJajnOdWyp7s8ZymO9kbXF2WfZ9Sxy - mkfhZtNz2BvhJeDFTmzXxdclT8YqXhpE3S5KZ1E8iogaTpRRopIRxYQ4z8WRKg4VEbG3i+1V7HBikxHr - XCw1MdvFhBNjLrqdLW8h3NrVekX5L/EgqUieO34/AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABJklE - QVQ4T6WSvZHCMBCFtwVaoBZKEAEB6RGQXOAZRgGJAw+hAyfbAi3QwrVAC9eC71vJDFpLcwnBs/Xe/kj7 - I/M8fwRPJDzAptRKYNNKc0QCn+FWaoXty+yV7khKoCBuS32x/Yp8c1zpjki45QR6X+mXnHz6v4QkSHzm - JP0+87DJwR3Qqj+OJEHCTmQ05+fCedXB+GXtm+xNUU5LKSN/uz3+tPwMTdFAEE1LDQVaNfWFpmjgZho3 - WXBzrC80RQMJeEFqHIhWiqEeryMS9oujbSTCBFfOSrLI38o5ukmsgzmcNTsO6elwxjhwmLb8sanbhTIB - N5+pW3G8Irxnzhix6d1ux+YmUiYg2JaoA8eqcdnWk+TwcLoj0pFkbC9M2kjbi3731mf5A6lCUicKFTV6 - AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABaElE - QVQ4T6WQz0sCQRiG/XO02vof+kH0iw4WleRm0SGig6cigtworUsgblEQgV26lUERUUZSggZJQSsqGrgn - QfC0K7govjkDWbuMaPjBM4eZ+Z7vnTEBaAvTVSgLFs7j7DWrwQgVGIvsOQR/S5KGglD0Aw6nt6mkLvBH - f6EJ9moCA7wnhhUxpRMyE5AiDT9VrVZRLpdh334FZz3H0v57XcJMQPgr0DQNqqrC5nrBWSCGzvFTLLjD - VNI0QS0ylr0SQpEvTG0E0TF2AsvoESwjh+S4cQLyXjK1UCggl8tBlmVkMhkkk0l4DgIwD/n0gkqlglKp - hGKxCEVRYBPCyOfzWNyNYH7nGXNbT+CFIHjXA9y+C72gZ5BH98AsuH4buL4ZdPVO07hkajqdRiKRQDwe - hyRJFJ2ALCwm1+9oZF54hH3zXkdLgom1W7x9puARL2mDkaYC6+oN/WnzsEgvsyD3mM3/gbnZOjB9Aytc - DAdFhtjSAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACLklE - QVQ4T82TX0hTURzHV2B/QCGksIegArEMCveQMmbYQ1gucoTZZD2MGvjiHqa0ae1218Pc5W5Luy4NiuaY - FZWWNlg2UUQcFcZABkUFtlxlw4VOKmva+nbONZfKHoReevie8/t9z+/3OYcfHAmAf9KyxNY+FK7lvZOF - lU1jK/zBdD7VskSudnbOfE0gU2qIbJExa6lH96X+0nqqVEBvOS/0QllzAwVKO/YorDHqC7cCSOcvKhWY - 2/rwIzGPh8NvYRCGsfNQIzbsM65Z9L2BMDjPKHJLraR8BaCh2ZdtbvVDy3ahrPo69iodkKuvoLCq7Y3W - dAd63gtVXQd2KzgCtkB74V52CkCensG0+DEZ/474bBKBF3FozD7kHeGwab9pxHjJS+qAL7PzGApN4aTx - PnIPc9RKAUx1fA818DT0CXbPcxzT3UZOMQvS3EABodcTCL76DN49gkpjF7bKGZx1+FgRYHcNTOsae1Be - 0w5phYD8Mg55pRbkyBj6grCee7BwdoKcHbVh2wEGm4vqUaS6nBAB1msDSCZ/YTz6DY+ffYDFFcSOgxT+ - d1Bn2E58jM4gHImhe3AMOr4f+YqFYUpMwiPMzf0kze/h6AhCc9H/nwFI80YKiExMo+/JOzjvjqLC0I1d - ZFYi4PQ590t1/U2UaFohq2qGTNWE7SVslEAy/wDWEcUU1VfHy3UuFJ9qgfS4DVkFtVMigC6rkdPTK/4N - smeo9O71RFk0T1u8ekHyG2jrt2s5yYVVAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAACG0lE - QVQ4T51TbUhTYRQ+WVgw29h258012txsLXSOiAJd8UIZSBFkVhAYBUWIYqZhhQ4ug8JWmR+Ykj9CEkaN - pB+lDGQMspDAoqDCws21K0T5Y8Toy5Sn17rIiH54feD8OAfe55znOeelJaHd5aEbm3RKph4l4XVwBC1R - JVWP8lEBdXENtF0WSSmpg/uRDedntNgVEUD+PKaUFdzaquPBqHcLo+5iRl2FjGtm1OZkdNXBqNXG3A+t - OBKz4dSkAdbbYop8xgw/+OPKlyJOvtfj8CsTysfy4I1YsNDVGiqAod8F2wMXDk3aUTGRj7InZuQEhAw/ - eOd6eS1a09m4+EmD6oQeR9/mYu/4epQ+zkdh2Imikb8E+yecKHtuhyNkQ1aLTvGDj90g56BjdhUC39fA - n9agOaVD44wRtR/5ZNNmVCU2LBLsebMZ26MuVI5wP+qzPbSguSGpUUXQk/aiKmoA1a3kBNywUPIm3s0H - 8WK+E6NzLQj/Oo3B2QO489OL3h8b4f9iWiS4/HkfuuUdMEmrFQnc7bbxPgx9GMT9RA8GpiT0TVWjM16B - K7ESSDE7mmTjH4Kzyd2IfG1EcYeYYeK1Ah0F7HxdVkaXLIz8ZkaSyMgnMGrWM7qgZe6QCcfiRXg914+D - wW0pqs1Sd9buuwKefbuH62NnQDUr/jmkJaBp6ByeysOw+MTlnfLxgRPY2V66/M9ENeTh8R/dRL8BDkAX - agnC/hIAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAI0UlE - QVRYR53XSWwb1xkH8JElS+i50KUIempB9FyguQRoiya2gSyHOEWQADnkFtRxmwRBENcIigZx0sDNVsCJ - d1mSZcv0EluS7aS2JFv7QslaSIkUd3KG+zILZx/y3++RVBzvTgf4YzhDit/vfe89YsSx41/79nN79/yj - 9ejBEz/vOtLb2XWkp7PrKOVYIydYjnffThdds/z43vGezu4TvZ09J04209d5svtUZy+d93/62c8unh+s - 17rvMdh3k+s/fPmXKyPpq4GJ4mJwpugJe0qe6FLJE/eWPIn1socPlD1CqOxJRURPOip6MjE6s9DrVIS9 - V/LwwaIn4S94Yms5T2Q16wkupT1+D+8ZuTL951K8yrW0tDQr3nVc7p3k3Ie+dwVuyKnYjIXkgoXUio3s - uo180EEx6qCcqEISapDTNShZoJID1HzjrGTZ/SrElINS0kI+qiMTUiH4ZcS9ZUwNL+2ChAcDhnonuDOH - vnP5RyUhOmUiMW9CWLaQ8VnIBQgRtlGMESLpEKJaL8aKVhIaKhnnNiLDEDYhTORjDFEBH5Awc2N5FzQ0 - q93nGOwZ5/oPfudaHxEJYCA+b4BfMpH2Wsj6aUQhBmBf7EAUCJGhkS/zMD/8DMapoUYnCpQ8IbLUqbSN - smCikCBERMHc+Mou2I8EXHWtDYtCZJIAcwaStwykvCYBaDQhC4UoARLsiwlAI9aOnYVxqA/64E1oORta - ie5R1CJNUZ66RPfEDCF4DZ4pAuBhgO6xJqBMAB2xOb0JMJAhQC5IXxS1mgC7DjA+/gr6ue+hzaxBK9jQ - RUCXGtHEGtQyTU2REFkdi7OrDwcMMMA3DUB4UiOARgAdwioDGMiFGMCsL7AyzbFErTY+ovYfPQXzP0eg - FwwYSg1mBTDVZio16EoVFdHE0sJjAE5/c8XlGy7dCfDSHNYBBgoxAvAWxLQFqUSArw7D2vtPWJ9+AUO2 - YWo1WHoNjgk4ViO2RZ/TLKwsex8OuNR9swkoEkBFbF5FYkmD4NOQCejIhQ0U4wZKtLDErAmZWqyfG4Kz - bQfs/V/ANGuwzSocu4ZqtYZajcrRwc62bcPr/QmA0GSlDkgu0z5eI8CGVt/XxaSBctqg9ptQJAf6og+1 - X/0aztFjoLpwHIeKV6koAzQFdLD7jwQM9BDgIAMUhNAUATyVOiC1rtJeJkBMo9HrEHMG5JIBVTah58uo - PvscnCtXaIc1Cm0iNiE/HTBSEMJTCmILCpKrFaT8KrIRFYWkhnJGg1TUUZEMaJoJM51B7ckn4XzyCWwq - yFp9PwS79vl8jwLcIMBll2+UADMK4osKeF8F6WAFuZiKYkqFmNegiDrUig6dilk08urTT6P64ouwBQE2 - FbobsQl4dAd6CXCIADfyQmSOfr+XZAjrCjJhBflkBaWsSitfRUXRaPQE0DQ4b70Fu6sLzjvvwPn6a1jN - LtyNeLxFuNkBBpiXkViVkdqQkY0pKKQUlAsVKLIKVVWhGbTnV1Zo/p+FGYnAXFhA9YUXYPl890U8FuBi - zyh36uCQyzuaE8JzEgEkpIIycgkZxawCqazQ6Ct1gEoAa98+2O++C51hTBM2daD66quwksl7EJZlPUYH - To5ypw8PuXw3c0LEIyHpJUBIQp6XUSrIkCUCVCqoUOu1cBjOjh0wJiagUfE6QpbhfPABqq+8Asvvh0Vz - b7NQVZMQPr//Lw9fA30jXP+RIdfaRFaI3hLBr4vIRCUU0hLEEgGogKIoUAhgfvkl7DfegEbXmq43EDRa - o1SCs3cvak89BbuvD/boKJyBAdi9vSi+/HJvjeN2EuE3lC33UAZOE+DYkGt9KivEVkQIGyKySRHFnARJ - lOoAmXWARm8//zy08XGorDitftYJ68gR2NQBZ/duVHfuRHXbNtSeeAK1Z56B8/77ELdvP09F/075N+UP - DHAHYrB/hDtzfNDln80I7AkmFS4jJ4goFUVIEiEoDGB8/jksKqLOz0Pv74d54ADM48dhXL0KY3kZBs/X - p8PI5WBfuFAvblMKO3ceog78lor+rpmWOwHuYe7MiUFXYD4j0PMf0tEy8pkyymURIgNQcYVWvvXSS9Au - XoQ6PQ01GESF2s46odI0sN3BpkSnsIVp0NybNGUGfS69Z88BAjxHRX9P+dM9iKGzw5y7e9C1sZAWkoES - MokSCjkCsOI0KimRgPHee9Bp/lknZNoNCpuSZuq7g21RKsgAdURzh7BF6l1fry/CZtE/UnZQbq+FoXME - 6CHArZTABwnAl1AslCGPjUEZHITa0wPztdcg0zaT2Hpopr4wKT+GMMQmhCHY69XVxvNAnmpR0TbKVlb8 - B8Dl89e5s70DruBSShDCRWSFAuTePqg0x9LMDCxaWMp/r0GUFYgiTQubms3QdX2himy7Eoo+U//NqDQw - DLUJeOBx+QIB+giwIghCvITyyTPQ3n4bZfp1M15/Her+/SgWWVeKKOaLND2FO1LM0X1KKU9/S50T2eIt - 30YtL9FT8cMAVy5e586dGnCFvIKQCmWgvvk3SN9+C233X6HSqs/Hk8hmcsimssgIGZqie5Pls9S5LHKp - HPLpPP2CNkAsiwuLjwE4TQAfL6SiWZSPd6OyZw+kDz+iR7IgUnwaQlwAH+PBR5uJ3BW6J0QFpGIppONp - ZJIZ2sq5ejyznkcALm0CkkIymqEvSdLDSAB8nEcimkQinEA8FEcsGENsgxK4N/FAHPGNOBLBBJKhJPjw - bdDs5OyjANe48/0MkEglQikkIknEI4l6wWggiog/gvB6GOE1ii+MkDf0Q8JeusdC9yO+CKJrUUTXo4j7 - CbORqIOmx6ffhPMAQEdHB3e69xx39GD3L6bHPAfnpxfPzk7NuWcmZtzTY9PuqZtT7snRSffkyKR7Ynii - kesT7vHr443ztfH6681r9v7k8KR7amTKPX1j2j0zNuO+dOHS9hyfa1a862hra+O2tm/l2tvbW9raW9u3 - drR1tLa1dmxp3dLR0trS0bKlEa6F66CP/79ppdznn1OO+x8FMcZP/Ws5zwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAI0UlE - QVRYR53XSWwb1xkH8JElS+i50KUIempB9FyguQRoiya2gSyHOEWQADnkFtRxmwRBENcIigZx0sDNVsCJ - d1mSZcv0EluS7aS2JFv7QslaSIkUd3KG+zILZx/y3++RVBzvTgf4YzhDit/vfe89YsSx41/79nN79/yj - 9ejBEz/vOtLb2XWkp7PrKOVYIydYjnffThdds/z43vGezu4TvZ09J04209d5svtUZy+d93/62c8unh+s - 17rvMdh3k+s/fPmXKyPpq4GJ4mJwpugJe0qe6FLJE/eWPIn1socPlD1CqOxJRURPOip6MjE6s9DrVIS9 - V/LwwaIn4S94Yms5T2Q16wkupT1+D+8ZuTL951K8yrW0tDQr3nVc7p3k3Ie+dwVuyKnYjIXkgoXUio3s - uo180EEx6qCcqEISapDTNShZoJID1HzjrGTZ/SrElINS0kI+qiMTUiH4ZcS9ZUwNL+2ChAcDhnonuDOH - vnP5RyUhOmUiMW9CWLaQ8VnIBQgRtlGMESLpEKJaL8aKVhIaKhnnNiLDEDYhTORjDFEBH5Awc2N5FzQ0 - q93nGOwZ5/oPfudaHxEJYCA+b4BfMpH2Wsj6aUQhBmBf7EAUCJGhkS/zMD/8DMapoUYnCpQ8IbLUqbSN - smCikCBERMHc+Mou2I8EXHWtDYtCZJIAcwaStwykvCYBaDQhC4UoARLsiwlAI9aOnYVxqA/64E1oORta - ie5R1CJNUZ66RPfEDCF4DZ4pAuBhgO6xJqBMAB2xOb0JMJAhQC5IXxS1mgC7DjA+/gr6ue+hzaxBK9jQ - RUCXGtHEGtQyTU2REFkdi7OrDwcMMMA3DUB4UiOARgAdwioDGMiFGMCsL7AyzbFErTY+ovYfPQXzP0eg - FwwYSg1mBTDVZio16EoVFdHE0sJjAE5/c8XlGy7dCfDSHNYBBgoxAvAWxLQFqUSArw7D2vtPWJ9+AUO2 - YWo1WHoNjgk4ViO2RZ/TLKwsex8OuNR9swkoEkBFbF5FYkmD4NOQCejIhQ0U4wZKtLDErAmZWqyfG4Kz - bQfs/V/ANGuwzSocu4ZqtYZajcrRwc62bcPr/QmA0GSlDkgu0z5eI8CGVt/XxaSBctqg9ptQJAf6og+1 - X/0aztFjoLpwHIeKV6koAzQFdLD7jwQM9BDgIAMUhNAUATyVOiC1rtJeJkBMo9HrEHMG5JIBVTah58uo - PvscnCtXaIc1Cm0iNiE/HTBSEMJTCmILCpKrFaT8KrIRFYWkhnJGg1TUUZEMaJoJM51B7ckn4XzyCWwq - yFp9PwS79vl8jwLcIMBll2+UADMK4osKeF8F6WAFuZiKYkqFmNegiDrUig6dilk08urTT6P64ouwBQE2 - FbobsQl4dAd6CXCIADfyQmSOfr+XZAjrCjJhBflkBaWsSitfRUXRaPQE0DQ4b70Fu6sLzjvvwPn6a1jN - LtyNeLxFuNkBBpiXkViVkdqQkY0pKKQUlAsVKLIKVVWhGbTnV1Zo/p+FGYnAXFhA9YUXYPl890U8FuBi - zyh36uCQyzuaE8JzEgEkpIIycgkZxawCqazQ6Ct1gEoAa98+2O++C51hTBM2daD66quwksl7EJZlPUYH - To5ypw8PuXw3c0LEIyHpJUBIQp6XUSrIkCUCVCqoUOu1cBjOjh0wJiagUfE6QpbhfPABqq+8Asvvh0Vz - b7NQVZMQPr//Lw9fA30jXP+RIdfaRFaI3hLBr4vIRCUU0hLEEgGogKIoUAhgfvkl7DfegEbXmq43EDRa - o1SCs3cvak89BbuvD/boKJyBAdi9vSi+/HJvjeN2EuE3lC33UAZOE+DYkGt9KivEVkQIGyKySRHFnARJ - lOoAmXWARm8//zy08XGorDitftYJ68gR2NQBZ/duVHfuRHXbNtSeeAK1Z56B8/77ELdvP09F/075N+UP - DHAHYrB/hDtzfNDln80I7AkmFS4jJ4goFUVIEiEoDGB8/jksKqLOz0Pv74d54ADM48dhXL0KY3kZBs/X - p8PI5WBfuFAvblMKO3ceog78lor+rpmWOwHuYe7MiUFXYD4j0PMf0tEy8pkyymURIgNQcYVWvvXSS9Au - XoQ6PQ01GESF2s46odI0sN3BpkSnsIVp0NybNGUGfS69Z88BAjxHRX9P+dM9iKGzw5y7e9C1sZAWkoES - MokSCjkCsOI0KimRgPHee9Bp/lknZNoNCpuSZuq7g21RKsgAdURzh7BF6l1fry/CZtE/UnZQbq+FoXME - 6CHArZTABwnAl1AslCGPjUEZHITa0wPztdcg0zaT2Hpopr4wKT+GMMQmhCHY69XVxvNAnmpR0TbKVlb8 - B8Dl89e5s70DruBSShDCRWSFAuTePqg0x9LMDCxaWMp/r0GUFYgiTQubms3QdX2himy7Eoo+U//NqDQw - DLUJeOBx+QIB+giwIghCvITyyTPQ3n4bZfp1M15/Her+/SgWWVeKKOaLND2FO1LM0X1KKU9/S50T2eIt - 30YtL9FT8cMAVy5e586dGnCFvIKQCmWgvvk3SN9+C233X6HSqs/Hk8hmcsimssgIGZqie5Pls9S5LHKp - HPLpPP2CNkAsiwuLjwE4TQAfL6SiWZSPd6OyZw+kDz+iR7IgUnwaQlwAH+PBR5uJ3BW6J0QFpGIppONp - ZJIZ2sq5ejyznkcALm0CkkIymqEvSdLDSAB8nEcimkQinEA8FEcsGENsgxK4N/FAHPGNOBLBBJKhJPjw - bdDs5OyjANe48/0MkEglQikkIknEI4l6wWggiog/gvB6GOE1ii+MkDf0Q8JeusdC9yO+CKJrUUTXo4j7 - CbORqIOmx6ffhPMAQEdHB3e69xx39GD3L6bHPAfnpxfPzk7NuWcmZtzTY9PuqZtT7snRSffkyKR7Ynii - kesT7vHr443ztfH6681r9v7k8KR7amTKPX1j2j0zNuO+dOHS9hyfa1a862hra+O2tm/l2tvbW9raW9u3 - drR1tLa1dmxp3dLR0trS0bKlEa6F66CP/79ppdznn1OO+x8FMcZP/Ws5zwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAD1klE - QVQ4T2WPf0zUdRjHP8cdk7uD434KUqAQUUwGRgFDLa0DzkPvF8ehMMCEQStEfgsVRBPIIeCBeCA7QMAD - 5JAKkR9HkLsEYzmMoZwBJrZRGpbMk4wbwrvvbOufnu3Z8897r+f1Jp9Lt5EGlYiMJtgH1MhdG9ujOQvt - audlvZJ/T3dAVFoQ7s08pxCSTrUT0SsEpE4mIiX7PEiO2Ifkhb1KyGdST3JG4fpKXxxz7ryah+F4e1yO - ZaI92hnaA66gQrp6hZBDAVwogMv/AFSI6OSiQoOGgzYVE0YVDR1qJhpUAlTJ3FAi9VjXKwXmLo3jZJOS - P3lOLqwvkXh4/gdoljnSW2TsprNSDhpTd6M7Rwz9IU9QVuiIcUYzZXXpEBtX4hxwkXrSqOCjWLLNlBfm - LcgP9yKkIZJD10WwdOURIlh6ymBbMONPyyhudpah8yAPhigHdEfZoSeajvNKNqoiRSgUu+H4u+5Zn0i8 - CTHF04lBwUhuSQnZWDZXwzZvAlYWMNdbAb2EgdMqLxiO7qastqJ2PxfVkc6oUnqgXLNjtEIT4kjGjxDS - e5DuPlQsu2MdOQHreB3W7g5hujUPX+xi4KuiKDy7M4DF742YH6rH/MBZLE50Yapb+4cufs92cipiKynZ - 60H0ie+cfGjMgtX0Kf6+XoOfO3OglbvDciEbz+f7sfZwChuP57GxfBdYtuDBVf1ae4o4gnDj7AgvhkEP - 2MdO12WKbb+2pWH5y6N4YEzDwMdKPPo6H9Zr1bBOd+OvWdOLtVl6sNB7csWQvDeQcGMJi5tqVxFkZK9q - jDzUlqkwUpGJ71pKcan1I8y1JeLZcCEeXy3Hk3EdBavB+o91+KHhmLkpcSeH8BNoyYGdLyF26XXEPhKh - YFYGy+x9LFlXkD2ajswjwfitNRkrV6h6fblYMeXjZvNxmzo0Qf6mZzIhLlks446JQLw98wbeu/0apAs+ - +HZjAP3Dv8BPbUBYaj9KszMwWBoNszYJYx2V+CC39zmNr71ASLErEX646YTbRT94XQuF7/Vg+E35YeeA - BP6RlyErWkVKC5DR+ATfmG9g9qcZDE3bcLgR2JOzCObmylYiSCBCfjqrkFfmNiKs9Zp0aXr5lkOS+Hff - 6PuQVQHKSkBO3bYJvJjaEUBcCkhPAVtCB58Swfs0IkhhEF4s2eR8jM3nFjm4Md5Salz8Z9f9k4CQDCAo - GwgvBgZvAQmnge0pgG/MKpy8uu79C0i1J7zDdoSb60S4+a6E5lhAaCxtGsu9b4zvd2Npc9Dtp6LgGWvA - fot1S9C0leMzNmcvbGsnzOJd/wDgshVOQ4R9KQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAq0lE - QVQ4T72Q0RECIQxEacFKoKxryfHDIizJGu7XNRtnbyCI5sPxZt6RhM0SKAAm7ONvIGrEXLDSYz8Dt4L7 - 5YTrVpyVyZgwtUbCWHwyGRNLeWoUMv+fwTvhqu57R2BhFvV4n5r58kIPGeH14hVfP1taaz5mrdVhzYVd - I4lXOQwoXJ2eMugnYMyajFMGFP5kAq5E75A2oFAT9A2RpQE32UzBNyYDmWRRD4DyBBMVP/GDmZlcAAAA - AElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAACTklE - QVQ4T2P4//8/RRirID6clTVDqbs7/dLs2Zn/a2sT2rAqwoXLyrqlmptrTj9+bA3kCv/v7GTYglUhNlxd - 3SbT3l588OVLxf8/fqz5v3Spx9v0dAZ3rIrRcUbGDBmgzbufPzf4/+sX0/+ZM9W+zJ8f3wCSQ1FYUlIq - VljYK19Y2C8LwgUFE2Sys6eqNjWlHXj8WAZo887/ixa5f6+uVk9atcpDBMWAmpo6/ba2rv0dHWU3uroq - rnV0lABxxdX29rJbT59q/f/7l+H/tGlqr5ua0ktOn3YQgukDE+XlFUpdXXMuP3t24//nz6r/P3zg/P/1 - q8D/jx+5gHzl/z9/7v0/Z07y302bPDJgGlEM6O2d9eDRo2NAZhAQb/m/fr3B/2fPZv3fsMH6/6dPG/4v - Wxb4Oi/PJP34cSe4zTAMJqZOzQTa6AHEG/+/fRv3/+7dPcCAiv9/4cJOoO0h//v6GF6kpAgZoGsGYTCx - YMHk/0+f7v3v6xv4X1WV4f+UKX7/793b9H/FiuD/795t+D9rlsGr7GwGS3TNIAwmli6t/n/tmtF/SUl+ - oF93/dfVFf1/6ZLb//fvdwJdFQwMPJ53eXkMoNSD3YAZM2Z+/PJl8+sjR+T+W1qa/peSUvx/5sxqoFQk - MN43/J8wQeFeaioeAxoaOkP37Lm+9f//A0927+Z+d/785rf//6cD8UIgTny/fn3ukg0b4sXRNYMwnFFV - VeK+ZMmyB5s3p37dsKHt67JlEV+XLm37umBB8IeVK7vjXr1ay4isEYYxBEjD/xkAmMvAJtry8/MAAAAA - SUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACbklE - QVQ4T42QSU9TYRSG+y/cunRhYuJCV4proysTY6IxUYIDUUAiBhQUQY2hKggKEgZRGWIFhYIiDaUUEERk - aBCUSRAKWihgoe2dSh+/exsWxmpcPDmb8w7nmIA/cHaPSALsnS6a2/ppaOnFYu2i6qWD8hobRU9eU1DW - KOm7UQ06e0cVMXF9dtM3PMO7/kkcPV942/GJxtZBmuwuCiua/m4g0jWjQVekgdX2IdKgzkFZTYvRIL/U - qodEN7A02AmFNgw0LYSqagaSrBCUZH76/KRn5YpVYfDKPiEJeGEbo7JphJLaQQqqP3LncQ/ZjzpJv+/g - cl4b/oBkCL3LPhY8yySn3owYNDimjHudQ15sfR6sXfNY7LM8bf5KSf0EZdZJrj10suhdxb2wxMzcDyan - 54k7ezFiINK13xsMGQ1yK95zu7SLG8UdZOS1Ep+Qyqn4FEO4iWFQVNWOpt8qUMW9ihpCVjSCsipqK6z4 - JC5llRrL0TCZi61CKMRCqKOL1/wy92oXyXm+SPaz76SVukl4MMNJ8xSHs8bYnzpKTKKL3WcHJVN2vsVI - DkqqeJLEsi/I0oqf3DqvCIAKZ5hCW4icepWMapkL5QFOF60LAuxJHJZMsUm3OBqXxqFjycSey+RKVgF5 - hVWYLZ5Ig8rNBt8iDa6LBmkjxCS52HVmQIl6l855c7f4CwaqFiaoCOQN1oIhVtc15hZlth+4G12sc+Lq - GyFEPDUs/hLGL23g9akseGWm5oMMT6+zdV9mdLHOkZRaFJG8FgjhWVGY9UiMuwMMjPvoGVmlfWiZLTuO - Rxfr7DyYwba98cbSv4gq/n8w/QLUGh0VPWo3NgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAABNklE - QVQ4T6WQu06EQBSG9w1EfQNfAeQSCBTIJVwCIVDRUFmQWK+d7VZaW9vJG/gIxtZGo4XWbrnteM7A2Z3d - jLdYfJPD/8//zzAzxti/kIsgI7uzDKlIfBckpCLxp4K2bc+KorhL0/Q6iiKFm0KBaZpzgE3MSedLnudX - WZa9x3F8HwQBs237jZtTAQROMYjz9I0lJzhzAU68IBNKPizLgnGr4EFSsMCZC0hVVZfAY5IkK9pMBV3X - 0dXX9H0/7oHQQdM0rK7rV5gVz/OeDMMYzc0NXqYgv7YI/v95WZYsDMMb3/f3ILzSdR28rQJ6wFtgHzga - hmHcA1dWHMdhGAKeNU1bqqo6mlMBAqEFsETwQNL54rruITzcMYlrUyj4CqmIYJjY9USkIvFTGJGLwsni - LEMq/h42+wTylm2njslBVgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAa0lE - QVQ4T82OUQ7AIAhDuf+l2UA7O4OIH0v2Gj+EtipqSBeD2UbvkIEVMAtmgdav+t3C1YLQWC1Ijb8oSJgK - uIRmCW3L5rlgQ3M8IVMtCChI6shdlB33hDqAY0NE9DKO70MdwLGhgI9+oHoBzyqxa4rWeaEAAAAASUVO - RK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACpUlE - QVQ4T32Se0hTURzH71/91Z/9XZT0sP7QHkqg9CDTlTWDiKyQFEtFA5HIFohlmr0U81Gr+cD5mM7Mx3TO - 5pptPuZypqEiIYKS6cQHpuac895v5xzaxWj1x/fCvZzv53fO5x4OAFfVYoNK24tyjQWl9V0orjVBoW6H - XNWGgopWsgRsXZJiWkIivtOIAAG8GF7gseYSsOQQ4HcmmhXc5csZI+zdHfag02lRYxzE29YBVGp6UVJr - wdDoFAO4yxXmNcTnjiIiZw7Rr9d3iICKZqs4fX2Dx0+ngPkVAX0jUwi8eJsC8Eq3DFWnC08aXYjKW0BI - 8gCNPwOUaSw2Wi5r+ISimm5ybjOyi43oGZx27+DwadkYbhU7cTLBiP1hCgTEGuAf2ZjJAMr6rrgNcm7H - Oo/FVR4zPwRMzAKb5d4v/Jzhc6Mfe869QfzDmiRvqZw/GF5l445eU+4+HqefcLh45Co/4lmhARkvW5H6 - QssA7qPRjNsd8Lk5yOQeuiTXe0sV4HZdaHgsTaxPn19yYW5ZwPcFAWMzAkYmBTadFj3JPRByN3ZnUBa4 - bZKm6jvPNfELRFppnRVFaguSnzYg6VEd/id3X3CqiQCs3FZJt+p6mqlzYnYDUpkVVYZvaOu1Q9djB5HL - yp7k0ukkR7gtoV/T91758MU3VHb1fMoQ/KO0OBb+IJrYtxG58CS3o99O/04cuweRWZO27KZVRGQOQ9m+ - Clmlk0HO3huOKXnXAU9y220MUM4AvuHVgUGJZuRrV5CqdiJSziMsbZxBcsmWlx38X3L1VgYg/d83kUBO - +US8R0CMnpW9gnNwIrHPT6E2gspNK9AhJbtZlEv9/AGgIUK2e4XkueUE0m9ylQH2RYFIm4K5f1qU22Lx - AKDZXKbJL9Oxhf8KAO4XJ//kwGbkeloAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAC+klE - QVQ4T42S+0+TZxiG+V/MYkycidHpNP7gIaTooAbQDwsC4qilHMqhYC1yKNKPOhmjtANKELSVTSbBMVo/ - goeI4AFD0GWZAw8YNZxMLZiJqQf0sq/LPlyyLPvhfvIm73tfb57nuaMAVaX1yvqIZGtdYKjcpczbm/uf - H6rzX805csZmtHWu/fTt31IPZQ19eRVu5YFvcIgLD0ZRJvvwTVRRoBiQ5BNklvrG9WWnDJ+ahT6Ww04l - V/YqL7vvnOPWn78z9mqakp4anPfLyf5Fy1ZHLSnyMMnW9oUMS9s/IFGWusC6cndgomXERd+sl4G5EUYX - 7jAWDtI15cfgcaDx/MEGdw8bm/RIhfXje4ua1XYEoLrap+C5XUvThAXvEze+SQfNv/nI+bELY0uIlLpH - rDqdyIofYtlsz2dPXoNNBRQf6x1sCTxGVpzk3txJ4UgcZq+Vkg4F+fjPyK52rLX1pLuyWdmoYeWxBBKN - tQMqoMDRE2o9/wpbayva0xq+UpLRN7toPOXn4uBVZoLPeDIbpONsL2llJpbVxKDNlEMqwGTvDrkCYQ53 - BEm36olt/RpzRzX9lwcj9/B2EV6E3zE9t4i7/QybTInsSK9cAuQe6RoobHqI6fhrjK4JEkpNVLi/Zepp - UDXPPn/L3ak3+IfGSUxLJTrZutRCdtVPtpyjV8j8/iUZzjmS7dc4dFRm8mnoL/P8YsT8muG7YVq6h4mX - ktgimZeGKBImQrK/5ha6b2bRVI0g2c309l9mZj7y8/QbbtwLc250gTxLJXHSvvnq8uI2FSCKSFiaxbew - p+Iaq4odrDankmUuoq0zQM/QGJ6zw+QdrCRJt5tOZyq9nvz3DXKJXQUIiYTp8hvHtxe4iNbnoDU6kLJs - SHv3kyDpSEmKx23exsxJDe+uZ+D9rkhAtCpASCRMhETsWaxKTFsMTPScoo22ZMWt5dfKL5j0bCHkT+Kg - YeeS+f8oAthliF3DJcuXHIj5HF3s+vh/ffhfEpBNq5cTs/GzXUDUB9hlsqaYQE4mAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAChElE - QVQ4T52Q3U/SYRiG+Qs6aKutddDcWs220jKwuepArebUFtPFbKCJmYQfkxmakbRyIZFTHJrprCimZWGa - X0hqMHEwTFMLxLIpg+w7NXWkC7zj/f02W5MO7OA+et/rep7nZgBYV/qkgpimrGSQ9BSmhwb89K8037kQ - ScCp8lyM5NOSgB8DhcDdLUXQdg1g9FoeBSuZTPrRYVbBZqrAsKEM1mcKmNplsOgVsPYoMGS4gbEXFdBr - 8zDjLMWb/izIZEWQH2D6UTBWBSs+O3ze5/Au6/HL04blBS1+ztbD7VBB15BOwQ4DH621Mdi8cQNuyk+j - uuQcnxKQ6T6vJSDcoeasgYcMYlRc4SI5NsJFCUaN5fAuGbC8+ARLcw/g+aaGy65EW138GthuysFrswSF - mWwioDsY7C71T+2EZ+Y+Fr/UYv6DCrdua2DRyeF6eX4VHjMJMT0igrlTgAxOFJKOhdMCi+66H36EhY9V - +OEuw6yzhBKsrPjQqGJTsM0ogGswG+/MZ9Fx7wTiD4ciITKMFvS1yrD4+S4e1xegXM6HKCMOOSIx2Ikc - f80MDHalYdIiwLgxFa/0p6CtOoIoVjBiD4bQgl7tVcxP12BmshjfJ6T4Ol6ITzYx3g/nYsoqxNu+NNi6 - uaR1yAq4yE6JQeJRFiWhBF0PL2POXfkX7BzIxER/Ouy9PAx3nIS16TgFkzOiw4NRnBOGiJDttKBNc8l/ - txL97WkwNqegpzEJOk0CntbFUes2lB2CuoRFTSZwpYSFGulu7N25jRa0qC9CnLoPIl4YhJz9OMNmghfL - olomRZFbybpkbalgD6olu6DK34HgoC20YD0SsjaZTOCgrZv+CP4vYPwGutu4vmPLy7gAAAAASUVORK5C - YII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAACcUlE - QVQ4T83R3U/SURgHcP+k5oW6mUsjUWgCsTBMxnzBXL6LKfXDHz9elEwFkRfRREjzBRIrypzpmuWsOanU - zXGRXrQumjd10U06PH470toSnb+WXbSz78V59jyfnWcnBcA/zbHF0+Ro8YSTn5eHg/xeS54/Ujjp/B+g - 2/2OOBwrpLtriTwIbZLR0Q0yPLxOAoH3xOeLkoGBZeL2vMLs7CrZ3v5KkucPXQ7S2blABvrX0GaZRSTy - HYO+z3C5P6LL9gGW9hj03Boqq17SVkCt7ucHrdZ54nQuw8g9weTkNzg9FLNvou32BlqNa7ihW0GJZo62 - AsVXPfyg2TRDbN2L0DNTGB37Ql+2BYs1hlZuFc23oqhtWIJS9Yy2AkXKXn7QwD4m1vY5tLQEMeTfRhvF - WPqyBKZ9DU3VAmSKh7QVKFTY+EGWnSIm0zS0DSPw9H1KrNnMrCSwCoqpyp9DJAnSVkB+6Q4/yHFhCkZQ - X+dHd88WWpi3qNO+wTX6EeryOSiKn0Iguo94PA6ZtONPVg4RozEMbaMf7R0x1DdRrPonVqiahkTxCJkC - P3Z3dyEpsPKDemaMsK0TFByCwbSOyhqK0V/9heVLQ0jLupsAxWIzP3hTN0J0umHU1njBGNZRUvECSvUM - ZFciFAtDcDGIM+l92NnZQb7QEE+eP3Q5iKbMES8vdUAht0B+OQCh+B5ycgeRec6L9EwXUtN7kZrmxf4+ - Qa6A4QfNphApK+2BqXccnG0MrH0crC0p9gksRjdwPkfHv/LeHiHaRheKixxQKm2QyiwoKOAgEukhzNPh - gqAJ2dkNyDpbjYyM6/zgaXNs8e+DlB+yFFTq/JCt8QAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAEFUlE - QVQ4T62Ta0xTZxjHHUvcB7/PL8s23cW5xIyQaOIHs2wJmxbG3IY1AREQmFMhWFoFVzYECqTIbRIuQSC4 - egFrNy5d0DkdM4xyK4KFnp7znkvbc9pqKZHKbQHCf4dMbtPs0z78kzdvnueX5/9cNgH43/TCz/+SIDq3 - r7zdorTdI4q7OYYJcRAS8lzwighLqgjlSKWYsaOM0/HSAx/fafPyX/pF93H4AljiBPhH+kE1XMaIvqrK - NjAw9AIIa2IIMfEcCfKSCLfHjQkXj1m/B7OPvZgZHIO34ir6VZmwlGQjWF6N6Ys/NtPdPRtBy2JG7a0C - YdH1pwV9Hgl/DNtwp94AsaER3SV63M/Mh/dkEWbP6jApw5BTiLmsInCWvvE1CCFanmM7HdZhw8MhG252 - WRBbVom40jq0F9UhEJuC4SPR8BfqsKgqAtJzMZ+ZhqW0dMykasBah9ZVxDBa0cljbGAgx/rQjh7PBPaX - VCC85jL6GzrheTcMwZhISNpUBE6ogaQzmDmZjPkTKRhPV5XRFBVchVEOR+TEuLd5eKAX5rtd+IXz4W1N - LrZkFqOlsg3BrTswuS8U0ikl6Nh4+KITEFAq4Yk6gAdJCWU0IWuVUQ76da8kuiUnDdOtdrSO8tj9XSW2 - aKqQV26E79Wd8O/ZhSeKcNAR0SBRhzH96WeYjlSg/1hSo+xsDUbTTJjMgpMbRVtnB24zLnyUU42Q+AKk - 669D2voBXLvew1PFJ3BFHIYQpcS0Igp/7T+AkcRkPc2sq0weQJiTFyQnS0nGNiO6WCeS61vxcnwxjpcY - 4X5tD5zv78DsVwcxcSgB/i9i8VR5CIufR0M4lXFhg81lydNsYmzDaLlxBVaXB1rjXWxOrMDR8p/AvrEX - 1JvbsBAXg/lkFWZjv0bwWAwQlwinSnuaJs9sEsJaBIGvGewb8v5+ywxD0yXQkoQqcw82K3VQ1ndACA2X - bYZi6axahpzGYsoZ+L/XIKDJAqmsS7U7qH9gHMea7BSFn03taGu5gmtN9aB4Dm1WFq8cKUJEXQvc+yJh - f+sdzGlUWMjSYyk1H2zBt7BkZ+Nmvh5ym57B5BNyMGSqpbkVNaXFqJY3necFUOMz2HnOgA9rm8DtDYdt - m2yz8DyeZOgx900BfivNR3dvLySPd4LneGm1X7LVa6L0CEMWi3S18RJu3/kVI7xbkWfloaiox3xWAfh9 - H2NJV4iAugB9ah3sbteUU5JqGZY1LDNWYfKe1NI0XStXNCdKHrCEGK6bTDio1SEhIxcd5y/Cps6DJ+0c - 7lfXgExOgDiFrpX8DbAVLUOILI7jzF5RnHssHzvDCb21F8rwQ4Yag2ZzgzDuXyAcZ1yOXZ+7AfRvydB7 - DEPfk5d5yv3IB5rnwbndkP+p5+Ox6W+GqiqkGDTJEQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEUEAgQEggQEgoQEAoQE/vwE/gSE - AoSEAgTEwsT8Avz8/gQEAvz8/vyEggSEgoT8AgT///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////9NzlhFAAAACXBIWXMAABJxAAAScQHz3HqOAAAAI0lE - QVQoU2PgQQMMPAwoACQAlQKDISaAAlDlQYCBAwVwcAAADI8JaX0nfcEAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAIElE - QVQoU2P4//8/QcxQUFDwHx8GK0LWgQsPZ5P+MwAAVKncTluNXg0AAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAAyUlE - QVQ4T6WRMQtBYRhGLZTJZrTZ3DIZjUabvyGDwWK4ioEsSoqSWKREGfkBbEpStktSFkUpLj0+i+F9vsGX - 4Qzn9LzT6wHwF9pogjaaoI0mUKhOXiiPH0jXdxedSyh8xmvnCSs1UMouoVAa3rA9uAgnu0rZJRTs/hUr - x0Uo0VTKLqGQ750x37gIxmtK2SUUcu0Tpss7ArGKUnYJhWzriNHiDn+0qJRdQiHT2KMzu8IbsZWySyh8 - /u2zCt8D6RIKpmijCdr4O/C8AZF98ic9bkEXAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACLUlE - QVQ4T52TvY/ScBjHuVIRKHA9JAgnL+VoC7TX0kLLS6EvFBTa0uj5J7gYF+PsfpOTMrg4ORgHY+LCYJwc - TYyJiYuDLu7GxHgxd/Hnr5fA8TZcrsmnzfN9nufTNPnVBwDw2ZYljGzr3ciyTNu2EC87L75eb+DvD67f - hU9g9vt/HNs5cMaOf9Owohro7YNbe8PhjfuzzBOgkDuabk6bbRXoxuBkNLIeus6yhKyIwY5umo5tHxmG - +Wwu8G5QkIa0jN5gqnR1oOkGuOk6b1x3jHl9uaWGhpb1UtXNY1luPmJ4KbIkmAElAcgD3egfa5oJxq77 - oq3ovKJoE7XbBbwoTWhG2F7cWRJ4dFR1S9fNCvykT41mB9TqjSOxXvtJM9zrYokLrc4vFYtUBcngq9Lf - tqICvlr7RhQr8U1za4FHXZIIurT/mePFf1AEJLkFGJb7uml2LRBrcp4us1+g4KRcYV8lkmkplyenglgH - VIm9tzq/VJRZLpUlih9yBQrAt79Pp3bjkVgM244nsPwe/VQQ6r8pRsgu7pwtC61grkA/T10r/NrnxB8s - V2VmvQiOB0MhLMZVxY/pDPEkU6DnZ2Qu2M0STjJFAIpmAUmXD0NY9PQMzEBRPwJzkiSp71F8J1/ipNMj - f9rE8XggkUgexq9cBXmi+DYYjtCRGL72T+D4jr/RaE+waFgu8c0zgUcmT9UuBS4/9m0hmh9Fo7N8FXih - CIKE5/Vi8yJsDM8P8P0HLGwR4Wl3ICYAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAABmUlE - QVQ4T7WSSyiEURiG/w32UpRiIYUm18Qgl5QsWJAkInaSSLk00zBTFv5RioUoC6SEkJCIwkLjNoqFzMal - KbdcakJIvc75dP7O0WwsLJ6+3nO+9z1/3/drAAyaRi5YgZZSNgROdEEvaUFt34miOYoQAZzfZs6fAvxR - pR+xop6RSWC167A5nISF0dGpo7HdifikVFTpbpR376HUvoNi6zZBAXKazaHj6eULD74v3D5/4ur+A0ub - p0hNz6Hmkq4dqjI0MCH4y9x8/fiJi7t3nHlfMTp/gFhTMvUUWbaMXgEFiIHxz755YubbH/Px+QuGp3YR - HhFF9wWt61RllGm3dzpxyV72eN/IfOjxYWDCheCQMOrJa14xegWK4AObXTvGyNw+BtnL/czcN+ZCQGAQ - u4aW1bBIVUYRaeZsZOYWIiHZjMioGISEhpNZozb2g9XNUJVRBF+TrH+TWDPJinqmVfa4weFmvqYi6xYK - 2zaQ37KKnMZlZNQvIKV2GgnVkzBVTiCuYtyAAuQ0f2uSESYZRfhbk8z/B/wdaN/UwtLmFVaBLwAAAABJ - RU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAAtklE - QVQ4T2P4//8/RRjOqKrv+F/T0AnGlUCcU9b5X8/QFCiFXw5uQE1DB0jg/6/ff/9//v4HjE0t7EFCeOWQ - DOgEKvj3P6Dp63/D1LP/7775/V9TxwisCJ8c3ACQ00AmWxY9+q+fdOL/ietP/0vLKYMV4ZODGwDyF0gR - yHSQgm1HL/8XEpEAK8InBzfA3NLuv7WDx399I8v/8soa/0XEpYGyICn8cnADyMVwxmg0DotoJA//ZwAA - qy/GB3Ky9SEAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACMklE - QVQ4T6VT30tTcRT//gm+9OBbL/Xai3vooR9oUVbYjOnmdVyxTalFGxuJa+FljbVCy5WrLTOTvIgNM3Fk - rpb9kCyHrVoMNAqJkRgi9BSBL5885zIf7mW9dOG8fPh+zvmcz/lcEZ+J7N4sxDJhRJ9eRM8TBZFUAMGJ - DgTGvOgYPQuPegqnh5xw3G2BfLsZ0i0bGmMNVPuoAd4X3+HL+iIKa5/xYTWH+R9zeLk8g+mvjzG5OI5k - YQTDn+7hTi6O+EIfet92Q0kHIHltEDSZyPmfH5GaXcLD53moqXn0J19grDAKNT9kwJXMeThVGfWO4xDR - dJAnL6xk+RF9fzYAuzvC5IFcwoB3TvkgDzTjgKUGonuqi2W/Kb7mCb9+A9/XgKNyJ5Nj2agB9z1yw56w - wlRdBRGe9PPOz76lWV5xHcgtA6ZaB5Ovzl0x4O6kC9Y+C3bu2gGhjJ9jw1JLE4gNT7NEmkIPiRyZDW3h - hFG51HY0XDOjcnslhD/pYbdLhpVkl8hkGO1MsmkykdsHT8J8uQ4V2yogvCMuPlU5t4msx1sTMo6FjmgN - ztxv4zuXc5sm63H7DQm1XYe0Bm2DrRyScm6TbD1u62nEQX+N1qCl384JK+c27azHLZdOoNq3X2sgxZtw - M3sd4VdBwxVKhulxc7AOez17tAb0U4QyClwPnBxPShiFhO5MpyK3yTDamWTTZCKb5KqtBoebLlghuW2c - bYonJYxCQnemR/+oerFp7n8UxF+CFapvsjm7iAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACMElE - QVQ4T6WS30uTURjHdx/+AeE/MBR2M3aZV90IXSx0Gl0YkRdFQoFdOMYu6iJsIghpKXNmmzPz53I618YY - U5zODMyKsjZ1plPX+5Y5WsrmPvm+rz9KEiEf+HIe+J7z4TnnfFWOwUmcQ1N0Dr+S1w53BMfgBE9dYZ70 - j2HrDWHtDtLSFeBxp5+mjpc0Orw8tI/IkgGZXIbU1o6slY0sc2tZuoNx7jZ7/vKO+rria6icQxHZGJ3+ - LGs4HJNNSdV1rgMvOBXFPxnDE57nxdgCfaFFBSBNUNPgOVB1nZtb913cuNdHpfk5V4xOLt+xU3a7jYs3 - W7lwvYXiykecv9qoANoHxjmpcjnI7uTY2s6SSmf4vrnN+rdfCqC1J7S37bBEUaS+vp6KigoMBgOODidf - xU2EjS2+rP/k09IPfONzCqD5WYB4PI7FYiGVSsmAaDRKMplEEATyz+ZTXn6JWHyVlaRy2Gw20+9/owCk - bzEajej1ejQaDQUFBaTTaXw+H7W1D8g7k0dpqYEP0QQmk4mqqiq0Wi2FhYUKQPrL5eVl+WAsFpMnsNls - lJSUsJYUFYChjI8LAu/nN4i8W0OtVu9mZuYQcLSsVitFRUXUGE3odDrO7fYNTW28nhMZn00SmF7FPrh3 - hX1AIpGQJQgii4tL9PQO4HJ78QfDuL2jjAQiTMzE6fK+xeGexeb6Y4JT5UACHBdlKYknRlkCSMa/oixN - sO8dG2UJIDX/K9Xu+51CqH4DsLwA5JN+awcAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABaElE - QVQ4T6WQz0sCQRiG/XO02vof+kH0iw4WleRm0SGig6cigtworUsgblEQgV26lUERUUZSggZJQSsqGrgn - QfC0K7govjkDWbuMaPjBM4eZ+Z7vnTEBaAvTVSgLFs7j7DWrwQgVGIvsOQR/S5KGglD0Aw6nt6mkLvBH - f6EJ9moCA7wnhhUxpRMyE5AiDT9VrVZRLpdh334FZz3H0v57XcJMQPgr0DQNqqrC5nrBWSCGzvFTLLjD - VNI0QS0ylr0SQpEvTG0E0TF2AsvoESwjh+S4cQLyXjK1UCggl8tBlmVkMhkkk0l4DgIwD/n0gkqlglKp - hGKxCEVRYBPCyOfzWNyNYH7nGXNbT+CFIHjXA9y+C72gZ5BH98AsuH4buL4ZdPVO07hkajqdRiKRQDwe - hyRJFJ2ALCwm1+9oZF54hH3zXkdLgom1W7x9puARL2mDkaYC6+oN/WnzsEgvsyD3mM3/gbnZOjB9Aytc - DAdFhtjSAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACX0lE - QVQ4T6WSa0hTYRjHD/TBvhRdqE99Koi+RFFB9SGjUAsvLYzEjMxFTKVkk6XpSC1N0eVtadqMvAw1b5Uo - KUUiJI7uGs7oIpEauZa1s3nP4tc5RwZNBgW98OPA+77/3/O8D0cA/gufmz3tOXTdzqS1KhVtTMh2X3c8 - CC21RXoJPFQVHMdpr2PSfoORwXySNUEUZeu5ZjRgyk6SCVwsYEZsZs7VxIyzHku5nqnxGpJjVbbXvSlc - OBtKinoH9p6TjHesRxt9SMotEsjhOVcDZTkn6LPmI34qYWzQwAfrKdoqVMRG+VOXto4XRQLxx0K8BU01 - BQsC8RbGtGgy9JEYEiI4Hx+OXqNCpw4lLiqAYu0GRRAZ7O8tqK80Mis2MuswMzWai+NVAraa1QoD1avo - K1/GU5OfEpYJ2L3VW2Ax5zDtqGJ6OIupN2eYfHkEsX05hdUd5JpbuXi1kRSjBV1mBbGpJqIT87wFlaWZ - TIyYmBzUMPEsFPejbXy5u0YJe9bc/E+crhmGx5xExF0iLMYgby8IKgrTEd9m4X4ShLt7M67OtYxUC0pl - eVXe6VEwN3QxMGRXwg96bRwIV8vHglCal8q3/nO4ujYh3luJo9mPoZuC0vaP+V98d0uVPzsZeG/H2v+R - 4CgdQVJ4/8HD+O/Zi1B8OQnH4zgpvIKvLUsZrV2CrUxAK71ZbtvTwXWpgxJLJ23dNuUrs2vLRoQrGYnK - D+KZsgeNNLA/Kz+0vlPCzff7aOh47iUILEw/Lf1hKtThgYTt26kcyNOW3+yp5gtFIA/CF0elacsX/obP - 8L+D8Bsb4cocWY3wtQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACpUlE - QVQ4T32Se0hTURzH71/91Z/9XZT0sP7QHkqg9CDTlTWDiKyQFEtFA5HIFohlmr0U81Gr+cD5mM7Mx3TO - 5pptPuZypqEiIYKS6cQHpuac895v5xzaxWj1x/fCvZzv53fO5x4OAFfVYoNK24tyjQWl9V0orjVBoW6H - XNWGgopWsgRsXZJiWkIivtOIAAG8GF7gseYSsOQQ4HcmmhXc5csZI+zdHfag02lRYxzE29YBVGp6UVJr - wdDoFAO4yxXmNcTnjiIiZw7Rr9d3iICKZqs4fX2Dx0+ngPkVAX0jUwi8eJsC8Eq3DFWnC08aXYjKW0BI - 8gCNPwOUaSw2Wi5r+ISimm5ybjOyi43oGZx27+DwadkYbhU7cTLBiP1hCgTEGuAf2ZjJAMr6rrgNcm7H - Oo/FVR4zPwRMzAKb5d4v/Jzhc6Mfe869QfzDmiRvqZw/GF5l445eU+4+HqefcLh45Co/4lmhARkvW5H6 - QssA7qPRjNsd8Lk5yOQeuiTXe0sV4HZdaHgsTaxPn19yYW5ZwPcFAWMzAkYmBTadFj3JPRByN3ZnUBa4 - bZKm6jvPNfELRFppnRVFaguSnzYg6VEd/id3X3CqiQCs3FZJt+p6mqlzYnYDUpkVVYZvaOu1Q9djB5HL - yp7k0ukkR7gtoV/T91758MU3VHb1fMoQ/KO0OBb+IJrYtxG58CS3o99O/04cuweRWZO27KZVRGQOQ9m+ - Clmlk0HO3huOKXnXAU9y220MUM4AvuHVgUGJZuRrV5CqdiJSziMsbZxBcsmWlx38X3L1VgYg/d83kUBO - +US8R0CMnpW9gnNwIrHPT6E2gspNK9AhJbtZlEv9/AGgIUK2e4XkueUE0m9ylQH2RYFIm4K5f1qU22Lx - AKDZXKbJL9Oxhf8KAO4XJ//kwGbkeloAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAa0lE - QVQ4T82OUQ7AIAhDuf+l2UA7O4OIH0v2Gj+EtipqSBeD2UbvkIEVMAtmgdav+t3C1YLQWC1Ijb8oSJgK - uIRmCW3L5rlgQ3M8IVMtCChI6shdlB33hDqAY0NE9DKO70MdwLGhgI9+oHoBzyqxa4rWeaEAAAAASUVO - RK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABL0lE - QVQ4T7WPuUoDURhG8xxaCHY2Yh+wECREVCRxHBOymMlMZrKYZYxLOhVBCAiCNr5AxFJfwd5C0catEsUm - hYiFxXFCCEq4TmJu5OMU93A58HuAviKUMnw/ftn90zs7tVeuHt5cfjnrJtiK1c4/SVZv3KOdgj9j+6d1 - zMMX1O1bHp8/xNFOwUZsTD3Bq52xWaszuXLBSOCYId9Rb8HWJsrXGHt3DI7vuvxy1m1wNHXJsO+AAe/W - 34KZUgWrUMHMb6Dn1tCyqySsMjHTJqKXCGkF1KU887EcgUiWuXCamUWLadXErxhOoi0ovX8PWsXmucby - OsnGuekyccsmatiEk0UWEjZKPE8w2jg3w2yoee6UksIf1J1EW7BfCKUMQimDUMoglDIIpQxCKYNQ9g6e - L18OKkyOPi51AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABMElE - QVQ4T6WQvUsCARjG7y9pa4i2hlpzy0iN7PIUT/Pj8k5NvcM+bOtjqqWxKBCDIhpqLAhqcAoiaBGXw5YW - sS1o/NXhcgdndMmPBx6e4eF5XwEYSq6hF7mGXuQaepFr6EWuoRcJeb2GWq6RK22SLa6TLqyRUqskcgbx - rE40XSayXGIxUWQhXmA+phGQVOYiOfyi8tMyJDb7PwS10p+vrG6QseZrVZKqgawYxDIVllIGYrJEWLbm - 5wlG+/NnxRX84ay9y0nt5A1pq0nIuLfeNRCbdbJ30aXx8IVPufFWMJ2+Qjt4xSo4vv0koN8xJV8yOnPo - WmSzfVpmj7HQKbsNk+3zLtJOmwmxzkvr/W8FFu3OB5OxM/xGk/HgEY9P5sAzbNZJu9NjxLdP/fr5lx8g - fAPOtXjW7jTlPgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAA7ElE - QVQ4T2P4//8/RRhMhDc80vEpPQVkYleED4OJkKb7/z3yDwCZSBJAKUIYrA5EBJZd1nRIXv3fMWmVH8wA - YjGYcM3e8d8ifPp/Y/8OIBe7QlwYqyApGEwE1d/4H1B95b9L9vYudAWEMJwRVHc93SZ2AZAJlQBKEcJg - dSAipOGhj2vW9v+2iUv9YQYQi8GEZ8GB/5YRM/4b+bYAudgV4sJYBUnBYMK/6uJ/3/Jz/x1SVgO52BXi - wnCGX8W5/47pm9LgEkApQhisDqbBo+jIbLPgCWBBUjCY8Cg8CA5Em+iFgegKCGGsgsTj/wwAYWiux7Jg - lFIAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAAeElE - QVQ4T2P4//8/RRhMFHQfKgDi/yAaXQEhDCZAmkNbnvyXta4CciESLEws//FhmDqYAQUgzUBMngsowVgF - ScFgYjQQsUsQi8FEYsXyAiD+D6LRFRDCYAKk2bPo6H9J40wgFyKBLeCQMUwdzIACkGYgHnKB+J8BAD5Q - tqhi4tzWAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAQ0lE - QVQ4T+3QMQoAIAxD0WJ7/ytHEBQp6RDdxOF1+GSqAbhCo2Icd0e2j6IFsrlZo1M0KmhU0KigkflPrNFY - efKJsA4bINYHMvlwBwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACZUlE - QVQ4T6WQS0wTURiF2bpjYWKiGxcu1GhMfAQlSASNxUek4oIQGjQ2YqOhKqXWgRbaDmUKSmm10KaDfSBG - qhjBKD4xdmMEDS9TbEGjRSVQVKAqRJQ5zq0ZQ203xsU3yf/POd+9M0kA/ouES0L3k4drXKxB0swaQSnl - K+923EhOlItbEGorVdu9LgZ8mfv2lubcDfQbr5tBu5el/s7GDAKXHAw3E6KJAAib4bHTmA0ZonNfV2fq - wmxMUcBl1X3lxuv4AvNbUK8HmZvsVbDXquFhTdlCNq5MaLSU8wUTmmw6YNwMp0UDjhe56nXgPwm2WqpT - yMaVCWZ9UfRE53kK3JgZ9poSzPNCW7UScyNGGFSHg0I2+uDNGqdVB8Kdm56zjPIgXzTBUXcKc+9q0GCQ - Ye59Nc6VHsFMqBLF0n2DfwT8j1nUZDdg6hXNv6Rx1amFWibGz9Ea3G85iUhQA19rEb68rkDLhUJEAmU4 - nr9zIOYGvERfnL8NE4NaTA+rYdOKMTvCYHJYj6khNSYDFD4HlJgKUhjtOQZpTtqzGAHhMlutjEoGFAj3 - yjH5UovIkB7TgQp89JdhrF+FsZ4TCN7LhWRPii9OQGAtmitE8qFLhtFuOcJ86ZO/FBMvzmDkaSH6rovw - +GI6l7d746OEglavOVl1SEQTSf+tA+htE3P+jhxuoG0vnnsz0dWcBqM87buiQGRLKCC4q3SLNbL9FURy - zbSDe+DI4HzOdNy2bp6npBt+7Nq6GqcLspYK+TgBofyoaEW5PFchyU5t37J22eymVUuQmbJ8UJK1vrEk - L2PdwmxM8d9B0i+k/s5JFmy4DAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAB3ElE - QVQ4T6XSX0hTURzA8UXP0lsP9WCPkqv0QaKQKKK0DEmol6IwbDmR1TbDJVo2V9NCDTKICMoigtaIbCTD - JBvOBTaG89+tzD9NFwqaKM6E2f12kuHdTYhLPXzO73c48H06OuC/rBxSoIk/9ftvE+5spOddI6G3DXS/ - qcfncdLmcuB9Zl+hChD/LNag4NekylQgZiIw2NVEPPZerC7NKk1HxUwEAq9rWZp9JdZ7mlWU5ouZCHS2 - XONH9CHEbmlmKzmiBHwvHcyN1LM861zF97q/shnzlEDHCzvT4XKYrNHMVnxYCbQ9t/O1vYDF8QqYqFZE - hW9J9yTlhkNKwCsCXzzZRH17GPHuYsiznVDzRhb6DMjjVyByeY2LhtykgMvOVNdxBpvXMx/UM+1PI3RX - R6Q9B3msEoYvrWEtylEHYiEjQ+6tSE83IIezWAqkEX6wmfinMpAsglXFXHggKSC+pdxvkheDhYy1ZPDh - TgqR+zqGhVF3OrJkhr4LMCBmwvlT+9WB5d6Sn78f4j1Goq27+fh4CwNPNtHdsA7pUSoT7mxmWvOY7zjG - nFB6Yp86UGPJxWE5SK11LzfNO7lhysRZrOf6uXQcZ/VcLdJTdWYbttM7KDuZgUVYDfw7dL8ANy8V6Hlx - kDwAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAByElE - QVQ4T6WQ3y+CURzG/UfmwoUbc2XjwqW5ztyY2bhgY2a2xoXNbFSThaLIbyYppaRIJSwNw+bHGzK5kKTe - 6nHOy5vOsLEunvc95+x8nuf5ngIAeUn49E4/IFfdugd0qsNoGb5Hw+AdJH23qOkJoaqLQ3k7h9KWG5Q0 - XxM0x0DjAEbtGSitachNKfQbePQuJiGdSaBj8g2tmlc0qWKoH4qhThZFUd0eayBKqg2jbTSMRsVHcnV3 - CJUdNyj7TBVVKHF/GUyu+pDJZLJy+S+Y/ZrzSPgn+TSi8TSmDG4UV9R+GYwvuxlg03fG7Ffsh0gQ+IXA - kWgK2mUXazAyv4WDE05I3vSdw7Z7CsvOsZBM4SWrH7MmL/QkmcJj8w7WQKnfYBLXCSyuaW0KR6I8QpEk - zu+SUM3YWAO51swYmJzBLPwST0G/6gb3xAtw4DoB5ZSVNRjQGOEJXMKyTWpvHcGQW5vAtLZ6wQHVrA1K - vRUKnfm7QW6DRYtfeO3H5xSpzUNNZg5cJeA5i8MejEE2YfrdgNaeozMTmCOwOPMH/Arjfgz0/jcDh/dU - qE1h8bVp8gitTWZW6NaFZHr3RwN68F9lDfLRj4d/FwreAXS1HIGEVowqAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACRElE - QVQ4T6WTXUiTcRSHdxkRRBdB0IUREV1ETSKIwoyQAsmV5IUhfaBUoJSUWJbLxAVZWixBRUcrNT8qM1PL - hpmoKGkf2pzOpLlAi9QtndKHzfm084a9uzCKujjv1Z7n/M85v2mA/yrlk3eng8DKKWsn62YLFwob0ec8 - JimrhnhDJbGp5cQkFxOVaGZPgsmPBgi8M/y2Pn8D99Qsw+5ZBj746HL6WLMz/e8ELpsd+6FgbAe1WNts - ClxSP8jqHef/LJDOAjNsYfrpSZ7vXUGr3ceN2jesCgsQyMzzwfJs2wHtTzg7jPbIICzdMxTes7Jye5oq - kIXNB8vM8mzpLPD9B6+p7pwht7yToG3nVIFsew7uHxzhRIZJqY6+T8rM8mzpLHBFmxdjUQvLQ/SqQE4l - sGPIrYCO4XGsA2NsjYjDVPWK0N2HlSqo7qe42Uu2qYFlW1JVgdx5Dn4/6mHo4xee9biosPQSHh1PzZMu - 6pt7/L/WUPDIxcW8OpZuOqsKJCQCj7gm8UxNY3VMYK55y+0GJ/n+eXUxxyi624Txeq0iMVyrYsnGM6pA - Evbd62PMM02fc5KShw6ulvaSaX5JlrmdREM52tAoEvU5xKdcUSSLN6SoAonn6PhXXvS5qGx89wtOz20m - +XItCWmlRMYaFEn4vuOE6uJYFHxaFUi27c4Jyuq6ychvRW9sIDmz2g/eIjYpn+ijl9Dt1xOy6whrN0co - tXB9gED+GJJtiackTEIid5ZTybZlYTKzPFs6C7xg3SlV8O+F5gdwpvLxKZ4mxAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAABu0lE - QVQ4T52R2S9DQRTG+6d4ImKLNR5IELG/4IEHEgn/jb6IiAe1pLZY0saeltoJtTTllttGW9RapJZK0eUz - c5rbNHrviy/58p3MnPObzIwKAHl2U8Rf61YFTBgsGJnb5+6UeuMdK/iAkjRT6yio6ZCFxAr9mo2FvHpG - DDDuCBJEzZYSAVPLVhbyGphepWHJTImA8cVDRFgRr0gkQmuhUBj9kyZ0a5eQX93OtxIBY/NmhMNhnJw7 - KR0uD4Js0HrmROD7B5azS+gMe8oAtWYWrus7tqKC4LikFJ0eygOrnXJYt6IM+K9jxZzpkE5xex4pHe5b - SpvjinLLLFDmlTWydhnA6MwWBJHdnz2c99lHDyiILvgD3zg4ceHm4R3qPj1S8qtYuwxAw145GAqxMir+ - gK8fX7j1fkB0v+D4/AFdQwvIKm3m24mA3lEji6j46Z+BHzy+fOLC44PV7sW25Ya+Mb1Y4Qp8UxL/9zf/ - F+6f/ATYP72DyXxFgNTCOt6iDNg9smNx/Rha/QYGp9fQO2akQcnJeZW8TR7A/zi3og055a3ILm9BZkkT - Ob2oAWlF9ez0WiRlFLN2GcD/DNUvFQAPI9EcSZQAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAoElE - QVQ4T6WS0Q2DMAxE+e5PR2AERugIFRMwSmdhEkbpKMYPTIXjYhQ46TAk8ssZaETklv8u1ni9HOtl1akG - 8LHqlAE69WQedvfOh4BHP77VT3tEjBCcASb1F5AtsRkcANYohRmhPH1JFwCbtOksAZAUcPYO8gSq8iuw - GZwBOGE7rbUK1CkD0MTPg2mmksQpA5T6zb1XDYAEpHIKgOuWZgYwUWWjtqpGsgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAfUlE - QVQ4T+2UQQqAMAwEC/3/myMNTYjjomA8ehjozi5SQRxm9ilSdpCyg5QdpOwgZYcx56zYhp7Ejrx+4IJb - z3WQcsOOcOeZgyz2+Y7YVU6vfCkf4M5zDXHOEo5w47mGOGcJR7jxXIsoaw5HuAkun00bKYG6yUJt/79N - GxsH7EeiiVdcqusAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACC0lE - QVQ4T2P4//8/RRirICkYznAqu8PpWn1X0bX9VZZz79ta6+lft5jP+nXRbOrXfSad77uNK55mGebfsNKK - OyuGYYBP7QMu14bnRXbtbzd5J1246Bd+YI1P+OF8r8ij6S7RpydbFN45qdnz6bli9bM7ysHHKtWs9vCg - GOBSddfetuX1o6CAfbdjQrf4wySRsXnW5YmqqdevSDvtu6dlvjwSJg4mbJpe7DTNv//dz3ldB0wCG1ZN - ubBNxm3vZx3zhWthYmDCtPrpct2Yq9+cLVdnwySwYeX08+vlvHZ/NbScvwQmBiYsim/5a/iduaFmuO0y - TAIbViq5+kbFYeNrK5s5MTAxMGEWd1lZ1f3EAXnrA1/V7bd4wCSRsW722UTl8it/TKwXXbOyXqAJE4cr - 0PQ7YiEecem1tMfBXTAxZKyTf+myWsi+z9a2C9yQxVEUySZfmS2ZcPapht1me2Rxo8xTTprFlz5o+25b - jywOwmBCvP/zR7Xkc84qIQdVpV12vteyXLkRWZFBzukjOtmnv+v7bzPW9FyfJOez+idMDmJA/fP34tmX - v8harn+iYzbvjYH1vHswBSBskHPqhV743s/aLqvfqzst/anqNP8bTA5MyAcdOaFovPq2rvn8T5rWc35o - OC38C1MAwoZJB34be2/4YeS94oeO66L3Og7zHsLk4IrIxVgFicf/GQDTEJf4sarC9QAAAABJRU5ErkJg - gg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAiElE - QVQ4T+2PUQ6AIAxDuf+lkTbWNIOpmH3al5nB3DO2kd5bEcPEpkwqIXDp5w+4EEhUJgSQlQglKhNOIPEc - 43PwSvgU/g2K7z4IY3wOFEm3hD4TvD9lW0IuZOwI2Wnhjl+45LVQc66MZ8YkREXCjF3GUogSizueMi6h - cIGXwZuMSQhchAr03g5eEHK4HOEqIAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAADwklE - QVRIS5WWS0hUURjHx+f4xJFw8rHKrFDRgRYW4jMfBbooeyyEjAq0cCu4UZMWKYSSKFEjPkqSMfMBIQxk - akyUUJvsZa1bBO3aSeK//3fnzu3OnXPVDvxmzv3Od77/nO9859xxsCGE0+mEy+VCWloakpKSDLsQExOD - 9PR0pKamRiB2s68NwU5ycjK6urowNzeHqakpNDc3Iy4uThsrKChAR0cHVlZWsLCwgMXFxTCWl5eRn5+P - 6upqJCQkmIObcSAzMxPDw8Pwer2YmZlBUVER+vv7UVhYiLq6OqyurmJpaQnz8/OakODz+TA+Po7JyUmN - 2dlZ+P1+DAwMqESEYCc+Pl77zs3NRV9fH7q7u1FTU6OlMzY21jxBo76+HoFAQMuACE1MTGjC8mPGxsYi - /B1ZWVkwNzGOjIwYDltbW/pIeJOVh3xkNdPT00ExWd3TpxhlhkLjGm63W58abGLs7OzUn/bXiouLMTg4 - iNlnz/CYqxoeGsLrqiqsSSZSUtRCvb29eu//WlNTE2739MD75An8LApGx3emvuzwYbWQqnk8Hm2/hMrK - SrS0tOgj/9r29jYu3LiB+ywgEVk/cQLvz5zBSZb/nkKNjY2Ijo4OOiqQKjW330xZHu1D169rqXtdXg5f - WxsSJX12Qq2trcrgVh48fBicwEqlQUPsn3gs1ii2WVuLdNkrq9DOzo4m0sXyLikpMQLuxui9e4aIILa3 - V6/iVUUFPvIYuOTgq1Ykjgss32OhjdwH/DDwkbLjx/H+1Cl7IffBg+jharyPHiHr6FEj0F60EHYMongV - bVDEVkgmPWeJfqXITfatAe2oIuwYxLMAPnCfPnGPbIX8vFBfML/Iy0MKn61BVdQSdsKFmLp3ly7BlZio - FvpMB6mYjYYGOHYpbzNWISffBl8Zp620FA5V1cmkTV1omSd8k8/WoCo8hB0DXqL4wXN4RfqCSmisvR1v - eQOskXWKBc6dw8XTpxETmmQhmrBjsE6OkFvE8FMJVfDa6L98GW945YhYgLyR++vQIZzl29fDt3ABf3EZ - ++LfSEQghNja9W8Dq1AsjeJcTruIbfC+eiGrYypfsoJkhV+Y2m9klGJndX8zSSRMRFCtiB/4RTw8Uwf4 - f+AXA0phfGT6ZIOHeHkmcvw8+an7h+gjESKCnZCwTQLiJEj1CVFRcPNcyPgfEvIV7pKw4GZ2E/of7pCI - 4GZUQrIKdvaNbbrM5OTk6BLBJsYEIvVfT2hQ8pk0kGskIqgaB7Kzs5GRkQERtQzCrZNhIpMoK8sWB/4C - O706Ewj1hikAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABJklE - QVQ4T6WSvZHCMBCFtwVaoBZKEAEB6RGQXOAZRgGJAw+hAyfbAi3QwrVAC9eC71vJDFpLcwnBs/Xe/kj7 - I/M8fwRPJDzAptRKYNNKc0QCn+FWaoXty+yV7khKoCBuS32x/Yp8c1zpjki45QR6X+mXnHz6v4QkSHzm - JP0+87DJwR3Qqj+OJEHCTmQ05+fCedXB+GXtm+xNUU5LKSN/uz3+tPwMTdFAEE1LDQVaNfWFpmjgZho3 - WXBzrC80RQMJeEFqHIhWiqEeryMS9oujbSTCBFfOSrLI38o5ukmsgzmcNTsO6elwxjhwmLb8sanbhTIB - N5+pW3G8Irxnzhix6d1ux+YmUiYg2JaoA8eqcdnWk+TwcLoj0pFkbC9M2kjbi3731mf5A6lCUicKFTV6 - AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABaElE - QVQ4T6WQz0sCQRiG/XO02vof+kH0iw4WleRm0SGig6cigtworUsgblEQgV26lUERUUZSggZJQSsqGrgn - QfC0K7govjkDWbuMaPjBM4eZ+Z7vnTEBaAvTVSgLFs7j7DWrwQgVGIvsOQR/S5KGglD0Aw6nt6mkLvBH - f6EJ9moCA7wnhhUxpRMyE5AiDT9VrVZRLpdh334FZz3H0v57XcJMQPgr0DQNqqrC5nrBWSCGzvFTLLjD - VNI0QS0ylr0SQpEvTG0E0TF2AsvoESwjh+S4cQLyXjK1UCggl8tBlmVkMhkkk0l4DgIwD/n0gkqlglKp - hGKxCEVRYBPCyOfzWNyNYH7nGXNbT+CFIHjXA9y+C72gZ5BH98AsuH4buL4ZdPVO07hkajqdRiKRQDwe - hyRJFJ2ALCwm1+9oZF54hH3zXkdLgom1W7x9puARL2mDkaYC6+oN/WnzsEgvsyD3mM3/gbnZOjB9Aytc - DAdFhtjSAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAB+ElE - QVQ4T2P4//8/RRirIAxP3vItZvLmrzvm7f76aPnBr0dWHvw6ZdWhr1LIalA0IOO+DV93APGf7nVfnzeu - +PK4fsmXO3N3fn0MNOATsiFwDd2rXv1fduKrAZi97uuy/o3ffqdOevfGpeDEb+vU7X/ME7Z8d6+4+3Hm - 9q9vgAbcRDEAKMDZuOTl/3kHvl6tX/G1YcKmb3/iep7/cy04/t8uY/cv09g1x13ytz60jF/+J6zj3c+l - B77eRzEAhItnPv+fNevz/8I5X/5H9nx8YZW85a9F4oYfprEr80HyAbXbVQwjFr9wLb/9vmHplz0YBiT1 - Pfvv3fTmf3Tv5/9lc9781/CetNokZoUjTF7BoY7ZLuvQb9eyO68bVn45BBOHGxDU/PS/WfH9/55Nr8Au - Sex59L9u8VtLmDzQAFa7zEN/veqefWte+WULTBxugFPF4/8ORdf+W2Ue/28Sv+2/YdTa/xo+U4FSEHmz - uPVKtpkH/wW0vP5bMP1xKUwcbgA6BgUsMl/da5K7a9ntP2mT3//r3fCVDSYOV0AIW6TsuxjS8eFfWN35 - XGRxFEXYcFzfeyWH/Asx/i0f/vlVXvmmFTCbEVkeRTE27FH92Nm/5dMvj5KLP42jVnmhy6NwsOGo3s+R - ziXXGk1j1olik8cQIBVjFSQe/2cAAG4MzKZBtgOMAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAB5ElE - QVQ4T2P4//8/RRjOWHXoq9TKg1+nLD/49ci83V8f9az/klK58AsnsmJsGEyANAPxp7k7vz6uX/LlTuOK - L49bV325U7Hoy+fKRV9S0TUhYzAB1Hxz5vavb9wrH7w3T9jy3Spl2x+H3ONfUyZ/flE458uLwrlfwkDq - lp34auBQdA3IRDNg6YGv98M63v00i57/2yVv/U3T2DXHgPiLWfzm38mTP/9Nn/n5WfbcL5HzDny9ap15 - /D/QQrjXwETD0i97XMvvvFf36rkVULtdBSRmGrsy3zh6+VedgNm/Qjs/Pge65H/WrM//TeK3AqXRXNCw - 8ssh1/J7r9Q8+w4rONQxwyRNYlY4anhPWl02583/6N7P/72b3vzXC10MlEIzoHnlly3e9S++anhPvgk0 - gBUmOWXrV10gBtvs2fTqv1nx/f8aPlOBUmgGFEx/XBrY+uavUeSaX0ADuGGSoACzAvrZJH7bf72QJWDN - qm5dQCk0A3o3fGVLm/z+n2vZ7T/qXpPckRUgBxg2DGeE1Z3PDen48M8iZd9FZAWEMJyhFTCb0b/62kv/ - lg9/HfIvxMT1vVdCVogLo3CAhvD5VN48FdD6+atH9WNnZDlcGKugd8Or0Kjez5HY5NAxVkFSMFZB4vF/ - BgCu1sRwcCvT7QAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACpUlE - QVQ4T32Se0hTURzH71/91Z/9XZT0sP7QHkqg9CDTlTWDiKyQFEtFA5HIFohlmr0U81Gr+cD5mM7Mx3TO - 5pptPuZypqEiIYKS6cQHpuac895v5xzaxWj1x/fCvZzv53fO5x4OAFfVYoNK24tyjQWl9V0orjVBoW6H - XNWGgopWsgRsXZJiWkIivtOIAAG8GF7gseYSsOQQ4HcmmhXc5csZI+zdHfag02lRYxzE29YBVGp6UVJr - wdDoFAO4yxXmNcTnjiIiZw7Rr9d3iICKZqs4fX2Dx0+ngPkVAX0jUwi8eJsC8Eq3DFWnC08aXYjKW0BI - 8gCNPwOUaSw2Wi5r+ISimm5ybjOyi43oGZx27+DwadkYbhU7cTLBiP1hCgTEGuAf2ZjJAMr6rrgNcm7H - Oo/FVR4zPwRMzAKb5d4v/Jzhc6Mfe869QfzDmiRvqZw/GF5l445eU+4+HqefcLh45Co/4lmhARkvW5H6 - QssA7qPRjNsd8Lk5yOQeuiTXe0sV4HZdaHgsTaxPn19yYW5ZwPcFAWMzAkYmBTadFj3JPRByN3ZnUBa4 - bZKm6jvPNfELRFppnRVFaguSnzYg6VEd/id3X3CqiQCs3FZJt+p6mqlzYnYDUpkVVYZvaOu1Q9djB5HL - yp7k0ukkR7gtoV/T91758MU3VHb1fMoQ/KO0OBb+IJrYtxG58CS3o99O/04cuweRWZO27KZVRGQOQ9m+ - Clmlk0HO3huOKXnXAU9y220MUM4AvuHVgUGJZuRrV5CqdiJSziMsbZxBcsmWlx38X3L1VgYg/d83kUBO - +US8R0CMnpW9gnNwIrHPT6E2gspNK9AhJbtZlEv9/AGgIUK2e4XkueUE0m9ylQH2RYFIm4K5f1qU22Lx - AKDZXKbJL9Oxhf8KAO4XJ//kwGbkeloAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAa0lE - QVQ4T82OUQ7AIAhDuf+l2UA7O4OIH0v2Gj+EtipqSBeD2UbvkIEVMAtmgdav+t3C1YLQWC1Ijb8oSJgK - uIRmCW3L5rlgQ3M8IVMtCChI6shdlB33hDqAY0NE9DKO70MdwLGhgI9+oHoBzyqxa4rWeaEAAAAASUVO - RK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACh0lE - QVQ4T4WSyU9TURjF+5+4YOPKYOLGlYmucAEoMSExxoVAwCKCIhEEFYMEtSBCJDRImawgDaARlASVSUFG - FXBoAZmnFspUW9rX937e9jUxkZe4OLn5bu7vnJMvVwf8V7aWg8NbQ8ffY8+yTTaHKaymTv2eONki7hs0 - gX/ls0aZZ9sPw7aBhZ5YcRYz8/oQrrGIF5rAPolkdstA6md3qUmcvQTmDWu2xmMNWRsPKHOdMbhWW5DZ - wu1oJTAvdhzRBvbJnnWD7VILe50WYWIRTSxiRnbkazzWkGSLjp55E26R13IsTtMx6IhTdzB9GV1VwwSV - z8apePoFY80oj01DlBgHeFjWx4NHPRQUdmIuz6W7JQflaz6bjZGsN8WyO5XM8sBZdKb6cRRFQZIVvJKM - e09mxy3jdPmxb0ksOSVm7T6oMsLNLDgfBafDMJw6Ksqh01Wax5AFnFa+iL5kgbjCec4VzOLYkVjZ9DO/ - rg2nXn2uGjwR1SW/wpm8GaJuTRORNcmJDBtrgfQNSYVzMgUcCTEqPGDzcCm1XjUw1n7GJyl4fDIuj8ym - qO7Y8bMsqmslD0156LN60KeYVYPy6hH2BHy3boS8miHuVA9w29QP68MhWCSH4CtFbaQaXvHhp4ckfZ1q - UGYaxu0Vi/P4g+n27VB6wCAg0SIAj87sMTjp4aOAe767SUyqVQ1KKwZxic0HG9SKBlVqg+Fw8QVCcEZp - B+nF7aEGrXR9cxOfWKMalBg/BdOdu/7g4padPmYdPiZXvPxY9DI252X019/0bpH+btxNXEKVahD4MIaS - Xu4VdZF3/y25+e3k5LaRmf2Sa9ebSUu3kCI2rk82k3ixlviEai7EmYICdH8AxXsU+dXRvF8AAAAASUVO - RK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAfUlE - QVQ4T+2UQQqAMAwEC/3/myMNTYjjomA8ehjozi5SQRxm9ilSdpCyg5QdpOwgZYcx56zYhp7Ejrx+4IJb - z3WQcsOOcOeZgyz2+Y7YVU6vfCkf4M5zDXHOEo5w47mGOGcJR7jxXIsoaw5HuAkun00bKYG6yUJt/79N - GxsH7EeiiVdcqusAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAa0lE - QVQ4T82OUQ7AIAhDuf+l2UA7O4OIH0v2Gj+EtipqSBeD2UbvkIEVMAtmgdav+t3C1YLQWC1Ijb8oSJgK - uIRmCW3L5rlgQ3M8IVMtCChI6shdlB33hDqAY0NE9DKO70MdwLGhgI9+oHoBzyqxa4rWeaEAAAAASUVO - RK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACpUlE - QVQ4T32Se0hTURzH71/91Z/9XZT0sP7QHkqg9CDTlTWDiKyQFEtFA5HIFohlmr0U81Gr+cD5mM7Mx3TO - 5pptPuZypqEiIYKS6cQHpuac895v5xzaxWj1x/fCvZzv53fO5x4OAFfVYoNK24tyjQWl9V0orjVBoW6H - XNWGgopWsgRsXZJiWkIivtOIAAG8GF7gseYSsOQQ4HcmmhXc5csZI+zdHfag02lRYxzE29YBVGp6UVJr - wdDoFAO4yxXmNcTnjiIiZw7Rr9d3iICKZqs4fX2Dx0+ngPkVAX0jUwi8eJsC8Eq3DFWnC08aXYjKW0BI - 8gCNPwOUaSw2Wi5r+ISimm5ybjOyi43oGZx27+DwadkYbhU7cTLBiP1hCgTEGuAf2ZjJAMr6rrgNcm7H - Oo/FVR4zPwRMzAKb5d4v/Jzhc6Mfe869QfzDmiRvqZw/GF5l445eU+4+HqefcLh45Co/4lmhARkvW5H6 - QssA7qPRjNsd8Lk5yOQeuiTXe0sV4HZdaHgsTaxPn19yYW5ZwPcFAWMzAkYmBTadFj3JPRByN3ZnUBa4 - bZKm6jvPNfELRFppnRVFaguSnzYg6VEd/id3X3CqiQCs3FZJt+p6mqlzYnYDUpkVVYZvaOu1Q9djB5HL - yp7k0ukkR7gtoV/T91758MU3VHb1fMoQ/KO0OBb+IJrYtxG58CS3o99O/04cuweRWZO27KZVRGQOQ9m+ - Clmlk0HO3huOKXnXAU9y220MUM4AvuHVgUGJZuRrV5CqdiJSziMsbZxBcsmWlx38X3L1VgYg/d83kUBO - +US8R0CMnpW9gnNwIrHPT6E2gspNK9AhJbtZlEv9/AGgIUK2e4XkueUE0m9ylQH2RYFIm4K5f1qU22Lx - AKDZXKbJL9Oxhf8KAO4XJ//kwGbkeloAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACC0lE - QVQ4T2P4//8/RRirICkYznAqu8PpWn1X0bX9VZZz79ta6+lft5jP+nXRbOrXfSad77uNK55mGebfsNKK - OyuGYYBP7QMu14bnRXbtbzd5J1246Bd+YI1P+OF8r8ij6S7RpydbFN45qdnz6bli9bM7ysHHKtWs9vCg - GOBSddfetuX1o6CAfbdjQrf4wySRsXnW5YmqqdevSDvtu6dlvjwSJg4mbJpe7DTNv//dz3ldB0wCG1ZN - ubBNxm3vZx3zhWthYmDCtPrpct2Yq9+cLVdnwySwYeX08+vlvHZ/NbScvwQmBiYsim/5a/iduaFmuO0y - TAIbViq5+kbFYeNrK5s5MTAxMGEWd1lZ1f3EAXnrA1/V7bd4wCSRsW722UTl8it/TKwXXbOyXqAJE4cr - 0PQ7YiEecem1tMfBXTAxZKyTf+myWsi+z9a2C9yQxVEUySZfmS2ZcPapht1me2Rxo8xTTprFlz5o+25b - jywOwmBCvP/zR7Xkc84qIQdVpV12vteyXLkRWZFBzukjOtmnv+v7bzPW9FyfJOez+idMDmJA/fP34tmX - v8harn+iYzbvjYH1vHswBSBskHPqhV743s/aLqvfqzst/anqNP8bTA5MyAcdOaFovPq2rvn8T5rWc35o - OC38C1MAwoZJB34be2/4YeS94oeO66L3Og7zHsLk4IrIxVgFicf/GQDTEJf4sarC9QAAAABJRU5ErkJg - gg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAABu0lE - QVQ4T52R2S9DQRTG+6d4ImKLNR5IELG/4IEHEgn/jb6IiAe1pLZY0saeltoJtTTllttGW9RapJZK0eUz - c5rbNHrviy/58p3MnPObzIwKAHl2U8Rf61YFTBgsGJnb5+6UeuMdK/iAkjRT6yio6ZCFxAr9mo2FvHpG - DDDuCBJEzZYSAVPLVhbyGphepWHJTImA8cVDRFgRr0gkQmuhUBj9kyZ0a5eQX93OtxIBY/NmhMNhnJw7 - KR0uD4Js0HrmROD7B5azS+gMe8oAtWYWrus7tqKC4LikFJ0eygOrnXJYt6IM+K9jxZzpkE5xex4pHe5b - SpvjinLLLFDmlTWydhnA6MwWBJHdnz2c99lHDyiILvgD3zg4ceHm4R3qPj1S8qtYuwxAw145GAqxMir+ - gK8fX7j1fkB0v+D4/AFdQwvIKm3m24mA3lEji6j46Z+BHzy+fOLC44PV7sW25Ya+Mb1Y4Qp8UxL/9zf/ - F+6f/ATYP72DyXxFgNTCOt6iDNg9smNx/Rha/QYGp9fQO2akQcnJeZW8TR7A/zi3og055a3ILm9BZkkT - Ob2oAWlF9ez0WiRlFLN2GcD/DNUvFQAPI9EcSZQAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAChElE - QVQ4T52Q3U/SYRiG+Qs6aKutddDcWs220jKwuepArebUFtPFbKCJmYQfkxmakbRyIZFTHJrprCimZWGa - X0hqMHEwTFMLxLIpg+w7NXWkC7zj/f02W5MO7OA+et/rep7nZgBYV/qkgpimrGSQ9BSmhwb89K8037kQ - ScCp8lyM5NOSgB8DhcDdLUXQdg1g9FoeBSuZTPrRYVbBZqrAsKEM1mcKmNplsOgVsPYoMGS4gbEXFdBr - 8zDjLMWb/izIZEWQH2D6UTBWBSs+O3ze5/Au6/HL04blBS1+ztbD7VBB15BOwQ4DH621Mdi8cQNuyk+j - uuQcnxKQ6T6vJSDcoeasgYcMYlRc4SI5NsJFCUaN5fAuGbC8+ARLcw/g+aaGy65EW138GthuysFrswSF - mWwioDsY7C71T+2EZ+Y+Fr/UYv6DCrdua2DRyeF6eX4VHjMJMT0igrlTgAxOFJKOhdMCi+66H36EhY9V - +OEuw6yzhBKsrPjQqGJTsM0ogGswG+/MZ9Fx7wTiD4ciITKMFvS1yrD4+S4e1xegXM6HKCMOOSIx2Ikc - f80MDHalYdIiwLgxFa/0p6CtOoIoVjBiD4bQgl7tVcxP12BmshjfJ6T4Ol6ITzYx3g/nYsoqxNu+NNi6 - uaR1yAq4yE6JQeJRFiWhBF0PL2POXfkX7BzIxER/Ouy9PAx3nIS16TgFkzOiw4NRnBOGiJDttKBNc8l/ - txL97WkwNqegpzEJOk0CntbFUes2lB2CuoRFTSZwpYSFGulu7N25jRa0qC9CnLoPIl4YhJz9OMNmghfL - olomRZFbybpkbalgD6olu6DK34HgoC20YD0SsjaZTOCgrZv+CP4vYPwGutu4vmPLy7gAAAAASUVORK5C - YII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAACcUlE - QVQ4T83R3U/SURgHcP+k5oW6mUsjUWgCsTBMxnzBXL6LKfXDHz9elEwFkRfRREjzBRIrypzpmuWsOanU - zXGRXrQumjd10U06PH470toSnb+WXbSz78V59jyfnWcnBcA/zbHF0+Ro8YSTn5eHg/xeS54/Ujjp/B+g - 2/2OOBwrpLtriTwIbZLR0Q0yPLxOAoH3xOeLkoGBZeL2vMLs7CrZ3v5KkucPXQ7S2blABvrX0GaZRSTy - HYO+z3C5P6LL9gGW9hj03Boqq17SVkCt7ucHrdZ54nQuw8g9weTkNzg9FLNvou32BlqNa7ihW0GJZo62 - AsVXPfyg2TRDbN2L0DNTGB37Ql+2BYs1hlZuFc23oqhtWIJS9Yy2AkXKXn7QwD4m1vY5tLQEMeTfRhvF - WPqyBKZ9DU3VAmSKh7QVKFTY+EGWnSIm0zS0DSPw9H1KrNnMrCSwCoqpyp9DJAnSVkB+6Q4/yHFhCkZQ - X+dHd88WWpi3qNO+wTX6EeryOSiKn0Iguo94PA6ZtONPVg4RozEMbaMf7R0x1DdRrPonVqiahkTxCJkC - P3Z3dyEpsPKDemaMsK0TFByCwbSOyhqK0V/9heVLQ0jLupsAxWIzP3hTN0J0umHU1njBGNZRUvECSvUM - ZFciFAtDcDGIM+l92NnZQb7QEE+eP3Q5iKbMES8vdUAht0B+OQCh+B5ycgeRec6L9EwXUtN7kZrmxf4+ - Qa6A4QfNphApK+2BqXccnG0MrH0crC0p9gksRjdwPkfHv/LeHiHaRheKixxQKm2QyiwoKOAgEukhzNPh - gqAJ2dkNyDpbjYyM6/zgaXNs8e+DlB+yFFTq/JCt8QAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAACG0lE - QVQ4T51TbUhTYRQ+WVgw29h258012txsLXSOiAJd8UIZSBFkVhAYBUWIYqZhhQ4ug8JWmR+Ykj9CEkaN - pB+lDGQMspDAoqDCws21K0T5Y8Toy5Sn17rIiH54feD8OAfe55znOeelJaHd5aEbm3RKph4l4XVwBC1R - JVWP8lEBdXENtF0WSSmpg/uRDedntNgVEUD+PKaUFdzaquPBqHcLo+5iRl2FjGtm1OZkdNXBqNXG3A+t - OBKz4dSkAdbbYop8xgw/+OPKlyJOvtfj8CsTysfy4I1YsNDVGiqAod8F2wMXDk3aUTGRj7InZuQEhAw/ - eOd6eS1a09m4+EmD6oQeR9/mYu/4epQ+zkdh2Imikb8E+yecKHtuhyNkQ1aLTvGDj90g56BjdhUC39fA - n9agOaVD44wRtR/5ZNNmVCU2LBLsebMZ26MuVI5wP+qzPbSguSGpUUXQk/aiKmoA1a3kBNywUPIm3s0H - 8WK+E6NzLQj/Oo3B2QO489OL3h8b4f9iWiS4/HkfuuUdMEmrFQnc7bbxPgx9GMT9RA8GpiT0TVWjM16B - K7ESSDE7mmTjH4Kzyd2IfG1EcYeYYeK1Ah0F7HxdVkaXLIz8ZkaSyMgnMGrWM7qgZe6QCcfiRXg914+D - wW0pqs1Sd9buuwKefbuH62NnQDUr/jmkJaBp6ByeysOw+MTlnfLxgRPY2V66/M9ENeTh8R/dRL8BDkAX - agnC/hIAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABJklE - QVQ4T6WSvZHCMBCFtwVaoBZKEAEB6RGQXOAZRgGJAw+hAyfbAi3QwrVAC9eC71vJDFpLcwnBs/Xe/kj7 - I/M8fwRPJDzAptRKYNNKc0QCn+FWaoXty+yV7khKoCBuS32x/Yp8c1zpjki45QR6X+mXnHz6v4QkSHzm - JP0+87DJwR3Qqj+OJEHCTmQ05+fCedXB+GXtm+xNUU5LKSN/uz3+tPwMTdFAEE1LDQVaNfWFpmjgZho3 - WXBzrC80RQMJeEFqHIhWiqEeryMS9oujbSTCBFfOSrLI38o5ukmsgzmcNTsO6elwxjhwmLb8sanbhTIB - N5+pW3G8Irxnzhix6d1ux+YmUiYg2JaoA8eqcdnWk+TwcLoj0pFkbC9M2kjbi3731mf5A6lCUicKFTV6 - AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABaElE - QVQ4T6WQz0sCQRiG/XO02vof+kH0iw4WleRm0SGig6cigtworUsgblEQgV26lUERUUZSggZJQSsqGrgn - QfC0K7govjkDWbuMaPjBM4eZ+Z7vnTEBaAvTVSgLFs7j7DWrwQgVGIvsOQR/S5KGglD0Aw6nt6mkLvBH - f6EJ9moCA7wnhhUxpRMyE5AiDT9VrVZRLpdh334FZz3H0v57XcJMQPgr0DQNqqrC5nrBWSCGzvFTLLjD - VNI0QS0ylr0SQpEvTG0E0TF2AsvoESwjh+S4cQLyXjK1UCggl8tBlmVkMhkkk0l4DgIwD/n0gkqlglKp - hGKxCEVRYBPCyOfzWNyNYH7nGXNbT+CFIHjXA9y+C72gZ5BH98AsuH4buL4ZdPVO07hkajqdRiKRQDwe - hyRJFJ2ALCwm1+9oZF54hH3zXkdLgom1W7x9puARL2mDkaYC6+oN/WnzsEgvsyD3mM3/gbnZOjB9Aytc - DAdFhtjSAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAB+ElE - QVQ4T2P4//8/RRirIAxP3vItZvLmrzvm7f76aPnBr0dWHvw6ZdWhr1LIalA0IOO+DV93APGf7nVfnzeu - +PK4fsmXO3N3fn0MNOATsiFwDd2rXv1fduKrAZi97uuy/o3ffqdOevfGpeDEb+vU7X/ME7Z8d6+4+3Hm - 9q9vgAbcRDEAKMDZuOTl/3kHvl6tX/G1YcKmb3/iep7/cy04/t8uY/cv09g1x13ytz60jF/+J6zj3c+l - B77eRzEAhItnPv+fNevz/8I5X/5H9nx8YZW85a9F4oYfprEr80HyAbXbVQwjFr9wLb/9vmHplz0YBiT1 - Pfvv3fTmf3Tv5/9lc9781/CetNokZoUjTF7BoY7ZLuvQb9eyO68bVn45BBOHGxDU/PS/WfH9/55Nr8Au - Sex59L9u8VtLmDzQAFa7zEN/veqefWte+WULTBxugFPF4/8ORdf+W2Ue/28Sv+2/YdTa/xo+U4FSEHmz - uPVKtpkH/wW0vP5bMP1xKUwcbgA6BgUsMl/da5K7a9ntP2mT3//r3fCVDSYOV0AIW6TsuxjS8eFfWN35 - XGRxFEXYcFzfeyWH/Asx/i0f/vlVXvmmFTCbEVkeRTE27FH92Nm/5dMvj5KLP42jVnmhy6NwsOGo3s+R - ziXXGk1j1olik8cQIBVjFSQe/2cAAG4MzKZBtgOMAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAB5ElE - QVQ4T2P4//8/RRjOWHXoq9TKg1+nLD/49ci83V8f9az/klK58AsnsmJsGEyANAPxp7k7vz6uX/LlTuOK - L49bV325U7Hoy+fKRV9S0TUhYzAB1Hxz5vavb9wrH7w3T9jy3Spl2x+H3ONfUyZ/flE458uLwrlfwkDq - lp34auBQdA3IRDNg6YGv98M63v00i57/2yVv/U3T2DXHgPiLWfzm38mTP/9Nn/n5WfbcL5HzDny9ap15 - /D/QQrjXwETD0i97XMvvvFf36rkVULtdBSRmGrsy3zh6+VedgNm/Qjs/Pge65H/WrM//TeK3AqXRXNCw - 8ssh1/J7r9Q8+w4rONQxwyRNYlY4anhPWl02583/6N7P/72b3vzXC10MlEIzoHnlly3e9S++anhPvgk0 - gBUmOWXrV10gBtvs2fTqv1nx/f8aPlOBUmgGFEx/XBrY+uavUeSaX0ADuGGSoACzAvrZJH7bf72QJWDN - qm5dQCk0A3o3fGVLm/z+n2vZ7T/qXpPckRUgBxg2DGeE1Z3PDen48M8iZd9FZAWEMJyhFTCb0b/62kv/ - lg9/HfIvxMT1vVdCVogLo3CAhvD5VN48FdD6+atH9WNnZDlcGKugd8Or0Kjez5HY5NAxVkFSMFZB4vF/ - BgCu1sRwcCvT7QAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAiklE - QVQ4T6WQ0Q2AIAxE2cCRGMVRHMFRHMFRGIERsAUuJFxNqF7yPny5ltRQSvmFKT2Y0oMpPbAQ9cIlbNQn - EULsA8rRyf37oj6JFixATuHTgrtTh4WlEzRYgBOSoGfs1CfRggUI/kumPokWLNBBBWck6pMYwzN6QqQ+ - ifHqTA31Z+HFlB5MuU4JD0dnUwrgCrV/AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAiElE - QVQ4T6WR0QmAMAxEu4EjOIIjOIKjOJIjdARHcKSYSyiCvA+DBw+8x7UUbGb2C5QVUFZAWYFlZnNUBh23 - KDOz0504rI5blE9OR0Kv4S3KJypiikJblJnFUbmieXCLMrM7Kkc0D25RZnRQRRdFcIsyn62Pgf4Ib1G2 - tr6I4JZkBZQVUH7H2g1WeXFvwrwKSQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAjklE - QVQ4T92RUQ2AMAxE6wApSJgUJCABSUhAChKQUHrbGjgYH4U/Lnlhd+G6ZRNV/UQzjNAMIzTDCGxEkoGF - szSyRB0yIp0x1h9Xo79kEzx1yBT5jtjd5Rm+3CFT9IMBuLTNQOCXONcMa+6QOTQYPgRgjSyLOmTuwpHz - sc+iDpki7IT3foI7ZIreD4ijsgOjTd7+jqoH+QAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAjklE - QVQ4T82M2w7AIAxC/f+fdrVqAwvNLt3DRljCqdB6759awoolrFjCihnckH3j53aCfTODC8UIZuybKTzV - 5eB44I+iotlQsNWNDQqinLFIqxsbFJIysvMd+75BwLQH0POS3LBvprBFhcVSYd/MwIRj2/OSCPtmDmJA - MRL0fYPC7we/sIQVS1ixhO/d2wE0YN1NDoBJDwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAm0lE - QVQ4T62NUQ7DIAxDe/9LMyclyGauygZ6eh8xtXu11o5qwx1tuKMeOENcA5cJ1M8NOU4PBm6Q7y+4DzUA - MTB7vzzAfahBZ3ks4D7UAPBYeb88wH2oAZgH3F1mUt2uHvxhhzP3xv3ckIPKhcuKzKmfGxL8wPgJ96EG - i4yxgPtQgwVkLOA+1OCFGJuVPpTjhDbc0YY72vB/2/UB43bUVn8JuhoAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAfUlE - QVQ4T+2UQQqAMAwEC/3/myMNTYjjomA8ehjozi5SQRxm9ilSdpCyg5QdpOwgZYcx56zYhp7Ejrx+4IJb - z3WQcsOOcOeZgyz2+Y7YVU6vfCkf4M5zDXHOEo5w47mGOGcJR7jxXIsoaw5HuAkun00bKYG6yUJt/79N - GxsH7EeiiVdcqusAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACC0lE - QVQ4T2P4//8/RRirICkYznAqu8PpWn1X0bX9VZZz79ta6+lft5jP+nXRbOrXfSad77uNK55mGebfsNKK - OyuGYYBP7QMu14bnRXbtbzd5J1246Bd+YI1P+OF8r8ij6S7RpydbFN45qdnz6bli9bM7ysHHKtWs9vCg - GOBSddfetuX1o6CAfbdjQrf4wySRsXnW5YmqqdevSDvtu6dlvjwSJg4mbJpe7DTNv//dz3ldB0wCG1ZN - ubBNxm3vZx3zhWthYmDCtPrpct2Yq9+cLVdnwySwYeX08+vlvHZ/NbScvwQmBiYsim/5a/iduaFmuO0y - TAIbViq5+kbFYeNrK5s5MTAxMGEWd1lZ1f3EAXnrA1/V7bd4wCSRsW722UTl8it/TKwXXbOyXqAJE4cr - 0PQ7YiEecem1tMfBXTAxZKyTf+myWsi+z9a2C9yQxVEUySZfmS2ZcPapht1me2Rxo8xTTprFlz5o+25b - jywOwmBCvP/zR7Xkc84qIQdVpV12vteyXLkRWZFBzukjOtmnv+v7bzPW9FyfJOez+idMDmJA/fP34tmX - v8harn+iYzbvjYH1vHswBSBskHPqhV743s/aLqvfqzst/anqNP8bTA5MyAcdOaFovPq2rvn8T5rWc35o - OC38C1MAwoZJB34be2/4YeS94oeO66L3Og7zHsLk4IrIxVgFicf/GQDTEJf4sarC9QAAAABJRU5ErkJg - gg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACMElE - QVQ4T6WS30uTURjHdx/+AeE/MBR2M3aZV90IXSx0Gl0YkRdFQoFdOMYu6iJsIghpKXNmmzPz53I618YY - U5zODMyKsjZ1plPX+5Y5WsrmPvm+rz9KEiEf+HIe+J7z4TnnfFWOwUmcQ1N0Dr+S1w53BMfgBE9dYZ70 - j2HrDWHtDtLSFeBxp5+mjpc0Orw8tI/IkgGZXIbU1o6slY0sc2tZuoNx7jZ7/vKO+rria6icQxHZGJ3+ - LGs4HJNNSdV1rgMvOBXFPxnDE57nxdgCfaFFBSBNUNPgOVB1nZtb913cuNdHpfk5V4xOLt+xU3a7jYs3 - W7lwvYXiykecv9qoANoHxjmpcjnI7uTY2s6SSmf4vrnN+rdfCqC1J7S37bBEUaS+vp6KigoMBgOODidf - xU2EjS2+rP/k09IPfONzCqD5WYB4PI7FYiGVSsmAaDRKMplEEATyz+ZTXn6JWHyVlaRy2Gw20+9/owCk - bzEajej1ejQaDQUFBaTTaXw+H7W1D8g7k0dpqYEP0QQmk4mqqiq0Wi2FhYUKQPrL5eVl+WAsFpMnsNls - lJSUsJYUFYChjI8LAu/nN4i8W0OtVu9mZuYQcLSsVitFRUXUGE3odDrO7fYNTW28nhMZn00SmF7FPrh3 - hX1AIpGQJQgii4tL9PQO4HJ78QfDuL2jjAQiTMzE6fK+xeGexeb6Y4JT5UACHBdlKYknRlkCSMa/oixN - sO8dG2UJIDX/K9Xu+51CqH4DsLwA5JN+awcAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAAAtklE - QVQ4T2P4//8/RRjOqKrv+F/T0AnGlUCcU9b5X8/QFCiFXw5uQE1DB0jg/6/ff/9//v4HjE0t7EFCeOWQ - DOgEKvj3P6Dp63/D1LP/7775/V9TxwisCJ8c3ACQ00AmWxY9+q+fdOL/ietP/0vLKYMV4ZODGwDyF0gR - yHSQgm1HL/8XEpEAK8InBzfA3NLuv7WDx399I8v/8soa/0XEpYGyICn8cnADyMVwxmg0DotoJA//ZwAA - qy/GB3Ky9SEAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACMklE - QVQ4T6VT30tTcRT//gm+9OBbL/Xai3vooR9oUVbYjOnmdVyxTalFGxuJa+FljbVCy5WrLTOTvIgNM3Fk - rpb9kCyHrVoMNAqJkRgi9BSBL5885zIf7mW9dOG8fPh+zvmcz/lcEZ+J7N4sxDJhRJ9eRM8TBZFUAMGJ - DgTGvOgYPQuPegqnh5xw3G2BfLsZ0i0bGmMNVPuoAd4X3+HL+iIKa5/xYTWH+R9zeLk8g+mvjzG5OI5k - YQTDn+7hTi6O+EIfet92Q0kHIHltEDSZyPmfH5GaXcLD53moqXn0J19grDAKNT9kwJXMeThVGfWO4xDR - dJAnL6xk+RF9fzYAuzvC5IFcwoB3TvkgDzTjgKUGonuqi2W/Kb7mCb9+A9/XgKNyJ5Nj2agB9z1yw56w - wlRdBRGe9PPOz76lWV5xHcgtA6ZaB5Ovzl0x4O6kC9Y+C3bu2gGhjJ9jw1JLE4gNT7NEmkIPiRyZDW3h - hFG51HY0XDOjcnslhD/pYbdLhpVkl8hkGO1MsmkykdsHT8J8uQ4V2yogvCMuPlU5t4msx1sTMo6FjmgN - ztxv4zuXc5sm63H7DQm1XYe0Bm2DrRyScm6TbD1u62nEQX+N1qCl384JK+c27azHLZdOoNq3X2sgxZtw - M3sd4VdBwxVKhulxc7AOez17tAb0U4QyClwPnBxPShiFhO5MpyK3yTDamWTTZCKb5KqtBoebLlghuW2c - bYonJYxCQnemR/+oerFp7n8UxF+CFapvsjm7iAAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAiklE - QVQ4T6WQ0Q2AIAxE2cCRGMVRHMFRHMFRGIERsAUuJFxNqF7yPny5ltRQSvmFKT2Y0oMpPbAQ9cIlbNQn - EULsA8rRyf37oj6JFixATuHTgrtTh4WlEzRYgBOSoGfs1CfRggUI/kumPokWLNBBBWck6pMYwzN6QqQ+ - ifHqTA31Z+HFlB5MuU4JD0dnUwrgCrV/AAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAiElE - QVQ4T6WR0QmAMAxEu4EjOIIjOIKjOJIjdARHcKSYSyiCvA+DBw+8x7UUbGb2C5QVUFZAWYFlZnNUBh23 - KDOz0504rI5blE9OR0Kv4S3KJypiikJblJnFUbmieXCLMrM7Kkc0D25RZnRQRRdFcIsyn62Pgf4Ib1G2 - tr6I4JZkBZQVUH7H2g1WeXFvwrwKSQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAjklE - QVQ4T92RUQ2AMAxE6wApSJgUJCABSUhAChKQUHrbGjgYH4U/Lnlhd+G6ZRNV/UQzjNAMIzTDCGxEkoGF - szSyRB0yIp0x1h9Xo79kEzx1yBT5jtjd5Rm+3CFT9IMBuLTNQOCXONcMa+6QOTQYPgRgjSyLOmTuwpHz - sc+iDpki7IT3foI7ZIreD4ijsgOjTd7+jqoH+QAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAjklE - QVQ4T82M2w7AIAxC/f+fdrVqAwvNLt3DRljCqdB6759awoolrFjCihnckH3j53aCfTODC8UIZuybKTzV - 5eB44I+iotlQsNWNDQqinLFIqxsbFJIysvMd+75BwLQH0POS3LBvprBFhcVSYd/MwIRj2/OSCPtmDmJA - MRL0fYPC7we/sIQVS1ixhO/d2wE0YN1NDoBJDwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAAAm0lE - QVQ4T62NUQ7DIAxDe/9LMyclyGauygZ6eh8xtXu11o5qwx1tuKMeOENcA5cJ1M8NOU4PBm6Q7y+4DzUA - MTB7vzzAfahBZ3ks4D7UAPBYeb88wH2oAZgH3F1mUt2uHvxhhzP3xv3ckIPKhcuKzKmfGxL8wPgJ96EG - i4yxgPtQgwVkLOA+1OCFGJuVPpTjhDbc0YY72vB/2/UB43bUVn8JuhoAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABJxAAAScQHz3HqOAAABaElE - QVQ4T6WQz0sCQRiG/XO02vof+kH0iw4WleRm0SGig6cigtworUsgblEQgV26lUERUUZSggZJQSsqGrgn - QfC0K7govjkDWbuMaPjBM4eZ+Z7vnTEBaAvTVSgLFs7j7DWrwQgVGIvsOQR/S5KGglD0Aw6nt6mkLvBH - f6EJ9moCA7wnhhUxpRMyE5AiDT9VrVZRLpdh334FZz3H0v57XcJMQPgr0DQNqqrC5nrBWSCGzvFTLLjD - VNI0QS0ylr0SQpEvTG0E0TF2AsvoESwjh+S4cQLyXjK1UCggl8tBlmVkMhkkk0l4DgIwD/n0gkqlglKp - hGKxCEVRYBPCyOfzWNyNYH7nGXNbT+CFIHjXA9y+C72gZ5BH98AsuH4buL4ZdPVO07hkajqdRiKRQDwe - hyRJFJ2ALCwm1+9oZF54hH3zXkdLgom1W7x9puARL2mDkaYC6+oN/WnzsEgvsyD3mM3/gbnZOjB9Aytc - DAdFhtjSAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACX0lE - QVQ4T6WSa0hTYRjHD/TBvhRdqE99Koi+RFFB9SGjUAsvLYzEjMxFTKVkk6XpSC1N0eVtadqMvAw1b5Uo - KUUiJI7uGs7oIpEauZa1s3nP4tc5RwZNBgW98OPA+77/3/O8D0cA/gufmz3tOXTdzqS1KhVtTMh2X3c8 - CC21RXoJPFQVHMdpr2PSfoORwXySNUEUZeu5ZjRgyk6SCVwsYEZsZs7VxIyzHku5nqnxGpJjVbbXvSlc - OBtKinoH9p6TjHesRxt9SMotEsjhOVcDZTkn6LPmI34qYWzQwAfrKdoqVMRG+VOXto4XRQLxx0K8BU01 - BQsC8RbGtGgy9JEYEiI4Hx+OXqNCpw4lLiqAYu0GRRAZ7O8tqK80Mis2MuswMzWai+NVAraa1QoD1avo - K1/GU5OfEpYJ2L3VW2Ax5zDtqGJ6OIupN2eYfHkEsX05hdUd5JpbuXi1kRSjBV1mBbGpJqIT87wFlaWZ - TIyYmBzUMPEsFPejbXy5u0YJe9bc/E+crhmGx5xExF0iLMYgby8IKgrTEd9m4X4ShLt7M67OtYxUC0pl - eVXe6VEwN3QxMGRXwg96bRwIV8vHglCal8q3/nO4ujYh3luJo9mPoZuC0vaP+V98d0uVPzsZeG/H2v+R - 4CgdQVJ4/8HD+O/Zi1B8OQnH4zgpvIKvLUsZrV2CrUxAK71ZbtvTwXWpgxJLJ23dNuUrs2vLRoQrGYnK - D+KZsgeNNLA/Kz+0vlPCzff7aOh47iUILEw/Lf1hKtThgYTt26kcyNOW3+yp5gtFIA/CF0elacsX/obP - 8L+D8Bsb4cocWY3wtQAAAABJRU5ErkJggg== - - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/TablePropertiesControl.Designer.cs b/PROMS/Volian.Controls.Library/TablePropertiesControl.Designer.cs deleted file mode 100644 index b0d7d2c8..00000000 --- a/PROMS/Volian.Controls.Library/TablePropertiesControl.Designer.cs +++ /dev/null @@ -1,149 +0,0 @@ - -namespace Volian.Controls.Library -{ - partial class TablePropertiesControl - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.lbl_Rows = new System.Windows.Forms.Label(); - this.lbl_Cols = new System.Windows.Forms.Label(); - this.NumRows = new System.Windows.Forms.NumericUpDown(); - this.NumCols = new System.Windows.Forms.NumericUpDown(); - this.dataview = new System.Windows.Forms.DataGridView(); - this.lbltitle = new System.Windows.Forms.Label(); - ((System.ComponentModel.ISupportInitialize)(this.NumRows)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NumCols)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.dataview)).BeginInit(); - this.SuspendLayout(); - // - // lbl_Rows - // - this.lbl_Rows.AutoSize = true; - this.lbl_Rows.Location = new System.Drawing.Point(0, 34); - this.lbl_Rows.Name = "lbl_Rows"; - this.lbl_Rows.Size = new System.Drawing.Size(89, 13); - this.lbl_Rows.TabIndex = 0; - this.lbl_Rows.Text = "Number of Rows:"; - // - // lbl_Cols - // - this.lbl_Cols.AutoSize = true; - this.lbl_Cols.Location = new System.Drawing.Point(0, 56); - this.lbl_Cols.Name = "lbl_Cols"; - this.lbl_Cols.Size = new System.Drawing.Size(102, 13); - this.lbl_Cols.TabIndex = 1; - this.lbl_Cols.Text = "Number of Columns:"; - // - // NumRows - // - this.NumRows.Location = new System.Drawing.Point(114, 32); - this.NumRows.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.NumRows.Name = "NumRows"; - this.NumRows.Size = new System.Drawing.Size(47, 20); - this.NumRows.TabIndex = 3; - this.NumRows.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.NumRows.ValueChanged += new System.EventHandler(this.NumRows_ValueChanged); - // - // NumCols - // - this.NumCols.Location = new System.Drawing.Point(114, 54); - this.NumCols.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.NumCols.Name = "NumCols"; - this.NumCols.Size = new System.Drawing.Size(47, 20); - this.NumCols.TabIndex = 4; - this.NumCols.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.NumCols.ValueChanged += new System.EventHandler(this.NumCols_ValueChanged); - // - // dataview - // - this.dataview.AllowUserToAddRows = false; - this.dataview.AllowUserToDeleteRows = false; - this.dataview.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.dataview.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataview.ColumnHeadersVisible = false; - this.dataview.Location = new System.Drawing.Point(3, 73); - this.dataview.Name = "dataview"; - this.dataview.Size = new System.Drawing.Size(316, 150); - this.dataview.TabIndex = 5; - this.dataview.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataview_CellEndEdit); - // - // lbltitle - // - this.lbltitle.AutoSize = true; - this.lbltitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbltitle.Location = new System.Drawing.Point(3, 4); - this.lbltitle.Name = "lbltitle"; - this.lbltitle.Size = new System.Drawing.Size(0, 17); - this.lbltitle.TabIndex = 6; - // - // TablePropertiesControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.lbltitle); - this.Controls.Add(this.dataview); - this.Controls.Add(this.NumCols); - this.Controls.Add(this.NumRows); - this.Controls.Add(this.lbl_Cols); - this.Controls.Add(this.lbl_Rows); - this.Name = "TablePropertiesControl"; - this.Size = new System.Drawing.Size(319, 252); - ((System.ComponentModel.ISupportInitialize)(this.NumRows)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NumCols)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.dataview)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label lbl_Rows; - private System.Windows.Forms.Label lbl_Cols; - private System.Windows.Forms.NumericUpDown NumRows; - private System.Windows.Forms.NumericUpDown NumCols; - private System.Windows.Forms.DataGridView dataview; - private System.Windows.Forms.Label lbltitle; - } -} diff --git a/PROMS/Volian.Controls.Library/TablePropertiesControl.cs b/PROMS/Volian.Controls.Library/TablePropertiesControl.cs deleted file mode 100644 index 42afccfd..00000000 --- a/PROMS/Volian.Controls.Library/TablePropertiesControl.cs +++ /dev/null @@ -1,240 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Volian.Controls.Library -{ - //C2025-023 Electronic Procedures - //Control for designating which cells in a table require EP input - public partial class TablePropertiesControl : UserControl - { - //defines the type of possible inputs from an EP viewer - public enum EPinputtype - { - none, - textbox, - checkbox - }; - - private DataTable values; - private BindingSource bindingSource = null; - private int totalrows = 1; - private int totalcols = 1; - public readonly string epname; - private bool IsInitializing; - - //initialization / data will be in the format: - // totalnumrows,totalnumcols;(row,col):value|(row,col):value... - public TablePropertiesControl(string name, string title, string initialvalues) - { - InitializeComponent(); - - IsInitializing = true; - - epname = name; - lbltitle.Text = title; - initializevalues(initialvalues); - bindingSource = new BindingSource(values, ""); - dataview.DataSource = bindingSource; - dataview.AutoGenerateColumns = false; - - Load += new EventHandler(FormLoad_setDefaults); - } - - //initialization / data will be in the format: - // totalnumrows,totalnumcols;(row,col):value|(row,col):value... - private void initializevalues(string initialvalues) - { - values = new DataTable("values"); - - if (!string.IsNullOrEmpty(initialvalues)) - { - string[] grp = initialvalues.Split(';'); - string[] total = grp[0].Split(','); - initializedt(int.Parse(total[0]), int.Parse(total[1])); - - string[] ivs = grp[1].Split('|'); - //pair will be of format: - //(row,col):value - foreach (string pair in ivs) - { - Match m = Regex.Match(pair, @"\(([\d]),([\d])\):([\w]+)"); - if (m.Success) - { - int row = int.Parse(m.Groups[1].Value); - int col = int.Parse(m.Groups[2].Value); - string v = m.Groups[3].Value; - values.Rows[row][col] = v; - } - - } - - values.AcceptChanges(); - } - else - { - initializedt(1, 1); - } - } - - //initialize the blank datatable - private void initializedt(int numrows, int numcols) - { - totalrows = numrows; - totalcols = numcols; - - for (int c = 0; c < totalcols; c++) - { - values.Columns.Add(new DataColumn($"Column{c}") { DefaultValue = "none" }); - } - - for (int rw = 0; rw < totalrows; rw++) - { - values.Rows.Add(); - } - - } - - void FormLoad_setDefaults(object sender, EventArgs e) - { - BindingSource bindingSourceDropDown = new BindingSource(); - bindingSourceDropDown.DataSource = Enum.GetNames(typeof(EPinputtype)); - - //in order to achieve a dropdown of possible values need - //to remove the auto-inserted columns - //that were auto-generated of type type text - //when values was bound to the datagrid - for (int c = 0; c < totalcols; c++) - { - dataview.Columns.RemoveAt(c); - var cName = new DataGridViewComboBoxColumn(); - cName.DataSource = bindingSourceDropDown; - cName.DefaultCellStyle.NullValue = "none"; - dataview.Columns.Insert(c, cName); - } - - NumRows.Value = totalrows; - NumCols.Value = totalcols; - IsInitializing = false; - setDataViewtoValues(); - - } - - //set the display cells to match the values in the datatable for initialization - //and resize of the dataviewgrid - void setDataViewtoValues() - { - if (!IsInitializing) - { - for (int c = 0; c < totalcols; c++) - { - for (int rw = 0; rw < totalrows; rw++) - { - dataview.Rows[rw].Cells[c].Value = values.Rows[rw][c]; - } - } - } - } - - //Get storage string for storing table values in db - // data will be returned in the format: - // totalnumrows,totalnumcols;(row,col):value|(row,col):value... - public string GetStorageValue() - { - //force any in progress editing to commit. - ((BindingSource)dataview.DataSource).EndEdit(); - - StringBuilder bldr = new StringBuilder(); - bldr.Append($"{totalrows},{totalcols}"); - List points = new List(); - for (int rw = 0; rw < values.Rows.Count; rw++) - { - for (int col = 0; col < values.Columns.Count; col++) - { - if ((string) values.Rows[rw][col] != "none") - points.Add($"({rw},{col}):{values.Rows[rw][col]}"); - } - } - - - if (points.Count > 0) - { - bldr.Append(";"); - bldr.Append(string.Join("|", points)); - } - - return bldr.ToString(); - } - - private void NumRows_ValueChanged(object sender, EventArgs e) - { - int endNumRows = (int)NumRows.Value; - int curNumRows = totalrows; - - //remove rows till equal - while (curNumRows > endNumRows) - { - values.Rows.RemoveAt(curNumRows - 1); - curNumRows--; - } - //add rows till equal - while (curNumRows < endNumRows) - { - values.Rows.Add(); - curNumRows++; - } - - totalrows = endNumRows; - setDataViewtoValues(); - } - - private void NumCols_ValueChanged(object sender, EventArgs e) - { - int endNumCols = (int)NumCols.Value; - int curNumCols = totalcols; - - BindingSource bindingSourceDropDown = new BindingSource(); - bindingSourceDropDown.DataSource = Enum.GetNames(typeof(EPinputtype)); - - //remove cols till equal - while (curNumCols > endNumCols) - { - values.Columns.RemoveAt(curNumCols - 1); - dataview.Columns.RemoveAt(curNumCols - 1); - curNumCols--; - } - //add cols till equal - while (curNumCols < endNumCols) - { - values.Columns.Add(new DataColumn($"Column{curNumCols + 1}") { DefaultValue = "none"}); - if (dataview.Columns.Count > curNumCols) dataview.Columns.RemoveAt(curNumCols); - var cName = new DataGridViewComboBoxColumn(); - cName.DataSource = bindingSourceDropDown; - cName.DefaultCellStyle.NullValue = "none"; - dataview.Columns.Add(cName); - - curNumCols++; - } - - totalcols = endNumCols; - setDataViewtoValues(); - } - - //set the datatable value to match the changed datagridview value - //for some reason despite being bound, does not automatically update - // (it may be that datatable as a bindingsource does not implement INotifyProperty - // and thus needs manually set like this) - private void dataview_CellEndEdit(object sender, DataGridViewCellEventArgs e) - { - values.Rows[e.RowIndex][e.ColumnIndex] = (string) dataview.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; - } - } - -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/TablePropertiesControl.resx b/PROMS/Volian.Controls.Library/TablePropertiesControl.resx deleted file mode 100644 index 1af7de15..00000000 --- a/PROMS/Volian.Controls.Library/TablePropertiesControl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/ToolStripMenuItemwithValue.cs b/PROMS/Volian.Controls.Library/ToolStripMenuItemwithValue.cs deleted file mode 100644 index 16f35ab1..00000000 --- a/PROMS/Volian.Controls.Library/ToolStripMenuItemwithValue.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Windows.Forms; - -namespace Volian.Controls.Library -{ - //ToolStripMenuItem with Added Value Property - public class ToolStripMenuItemwithValue : ToolStripMenuItem - { - public readonly object Value; - - public ToolStripMenuItemwithValue(string text, object value) - { - Value = value; - Text = text; - } - } -} diff --git a/PROMS/Volian.Controls.Library/TransPanel.Designer.cs b/PROMS/Volian.Controls.Library/TransPanel.Designer.cs deleted file mode 100644 index b6495219..00000000 --- a/PROMS/Volian.Controls.Library/TransPanel.Designer.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class TransparentPanel - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/TransPanel.cs b/PROMS/Volian.Controls.Library/TransPanel.cs deleted file mode 100644 index fa59f0c1..00000000 --- a/PROMS/Volian.Controls.Library/TransPanel.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Drawing; -//using System.Collections; -using System.ComponentModel; -using System.Windows.Forms; -//using System.Data; - -namespace Volian.Controls.Library -{ - /// - /// Summary description for TransPanel. - /// - public partial class TransparentPanel : Panel - { - private string _Caption = "Inactive"; - public string Caption - { - get { return _Caption; } - set { _Caption = value; InvalidateEx(); } - } - private int _Alpha = 128; - public int Alpha - { - get { return _Alpha; } - set { _Alpha = value; InvalidateEx(); } - } - public TransparentPanel() - { - InitializeComponent(); - } - protected override CreateParams CreateParams - { - get - { - CreateParams cp = base.CreateParams; - cp.ExStyle |= 0x00000020; //WS_EX_TRANSPARENT - return cp; - } - } - protected void InvalidateEx() - { - if (Parent == null) - return; - Rectangle rc = new Rectangle(this.Location, this.Size); - Parent.Invalidate(rc, true); - } - protected override void OnPaintBackground(PaintEventArgs pevent) - { - //do not allow the background to be painted - } - protected override void OnPaint(PaintEventArgs e) - { - SizeF txtSize = e.Graphics.MeasureString(_Caption, this.Font); - //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))) - e.Graphics.DrawString(_Caption, this.Font, b, this.Width - txtSize.Width, 2); - } - } -} diff --git a/PROMS/Volian.Controls.Library/TreeViewExtensions.cs b/PROMS/Volian.Controls.Library/TreeViewExtensions.cs deleted file mode 100644 index bd2e6112..00000000 --- a/PROMS/Volian.Controls.Library/TreeViewExtensions.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Drawing; -using System.Windows.Forms; -using System.Data; - -namespace Volian.Controls.Library -{ - //CSM - C2025-043 report RO's that are not used in any of the PROMS data. - // extend the TreeView class with a couple added functions - // to allow support for what is needed for ROs - public static class TreeViewExtensions - { - #region public functions - //Returns a ROTreeView based on the data in the datatable dt - // builds tree based on the following: - // ParentID = 0 is top level - // links (defined parent) based on same dbID and ID = ParentID - // nodes will have the text of the title - public static TreeView GetROTree(DataTable dt, bool isExpanded = false) - { - TreeView tv = new TreeView(); - - var tempnodes = GetTreeNodes( - dt.AsEnumerable(), - (r) => r.Field("ParentID") == 0, //top level of tree - (r, s) => s.Where(x => r["ID"].Equals(x["ParentID"]) && r["dbID"].Equals(x["dbID"])), //how to match parents and children - (r) => new TreeNode { Text = r.Field("title") } //what to display in the tree - ); - tv.Nodes.AddRange(tempnodes.ToArray()); - - //if set to expand, sets the height to the combined height of all nodes + 20 - //so will show whole tree - if (isExpanded) - { - tv.ExpandAll(); - tv.SetTreeViewHeighttoFull(); - tv.Width = 1200; - } - - //sorts the tree in alphabetical order to match the way the tree is sorted in the RO Editor - tv.Sorted = true; - - return tv; - } - - //Saves the Tree to an Image at the specified path - public static void SaveTreeViewAsImage(this TreeView tv, string filePath) - { - // Create a Bitmap with the size of the TreeView - Bitmap bitmap = new Bitmap(tv.Width, tv.Height); - // Draw the TreeView onto the Bitmap - tv.DrawToBitmap(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height)); - // Save the Bitmap as an image file - bitmap.Save(filePath, System.Drawing.Imaging.ImageFormat.Png); - } - #endregion - - #region height functions - //This is a function to calculate and set the TreeView Height based - //on the height of all sub nodes + 20 - public static void SetTreeViewHeighttoFull(this TreeView tv) - { - int totalHeight = 0; - foreach (TreeNode node in tv.Nodes) - { - totalHeight += GetNodeHeight(node); - } - tv.Height = totalHeight + 20; - } - - //This function recursively adds the height of sub nodes to the running total - private static int GetNodeHeight(TreeNode node) - { - int curheight = node.Bounds.Height; - foreach (TreeNode child in node.Nodes) - { - curheight += GetNodeHeight(child); - } - return curheight; - } - #endregion - - #region generic private tree structure functions - //This is a Generic Function to help build the Tree Structure - private static IEnumerable GetTreeNodes( - IEnumerable source, - Func isRoot, - Func, IEnumerable> getChilds, - Func getItem) - { - IEnumerable roots = source.Where(x => isRoot(x)); - foreach (T root in roots) - yield return ConvertEntityToTreeNode(root, source, getChilds, getItem); ; - } - - //This is a Generic Function to help build the Tree Structure - private static TreeNode ConvertEntityToTreeNode( - T entity, - IEnumerable source, - Func, IEnumerable> getChilds, - Func getItem) - { - TreeNode node = getItem(entity); - var childs = getChilds(entity, source); - foreach (T child in childs) - node.Nodes.Add(ConvertEntityToTreeNode(child, source, getChilds, getItem)); - return node; - } - #endregion - - } - -} diff --git a/PROMS/Volian.Controls.Library/UCFDiffDetails.xsl b/PROMS/Volian.Controls.Library/UCFDiffDetails.xsl deleted file mode 100644 index 654713b0..00000000 --- a/PROMS/Volian.Controls.Library/UCFDiffDetails.xsl +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - - - -

User Control of Format Differences

- - - - - - - - - -
- - - - - - - - - - - - - - - - -
FlagModeValue
-

- - - - - - - - - - - - - - - - - -
Check Off Header TypeActiveMode
-

- - - - - - - - - - - - - - - -
Check Off TypeActiveMode
-

- - - - - - - - - - - - - -
Check Off X Offset Adjust (In)Mode
- - - -
-

- - - - - - - - - - - - - - - - - - -
Replace WordReplace WithStateFlag
- - - Add - - - Modify - - - Delete - -
-

- - - - - - - - - - - - - - - - -
Step TypeFont
-

- - - - - - - - - - - - - - - - - - - - -
Document StyleOriginal Page LengthNew Page LengthOriginal Left MarginNew Left Margin
-
- - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/UCFImpDetails.xsl b/PROMS/Volian.Controls.Library/UCFImpDetails.xsl deleted file mode 100644 index e3568414..00000000 --- a/PROMS/Volian.Controls.Library/UCFImpDetails.xsl +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - - - - - -

- - - - - - - - - -
- - - - - - - - - - - - - - -
FlagValue
-

- - - - - - - - - - - - - - - -
Check Off HeadingActive
- - - -
-

- - - - - - - - - - - - - - -
Check Off TypeActive
-

- - - - - - - - - - - -
Check Off X Offset Adjust (Inches)
- -
-

- - - - - - - - - - - - - - - - - - -
Replace WordReplace WithStateFlag
- - - Add - - - Modify - - - Delete - -
-

- - - - - - - - - - - - - - - - -
Step TypeFont
-

- - - - - - - - - - - - - - - - -
Document StylePage LengthLeft Margin
-
- - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/VlnBorders.cs b/PROMS/Volian.Controls.Library/VlnBorders.cs deleted file mode 100644 index 41582d62..00000000 --- a/PROMS/Volian.Controls.Library/VlnBorders.cs +++ /dev/null @@ -1,418 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Xml; -using System.Xml.Serialization; -using System.Xml.Schema; -using System.Drawing; -using Volian.Base.Library; - -namespace Volian.Controls.Library -{ - [Serializable] - [XmlRoot("VlnBorders")] - public class VlnBorders - { - #region Properties - private int _Rows; - [XmlAttribute("Rows")] - public int Rows - { - get { return _Rows; } - set { _Rows = value; } - } - private int _Columns; - [XmlAttribute("Columns")] - public int Columns - { - get { return _Columns; } - set { _Columns = value; } - } - private LinePatternArray _VerticalLines; - public LinePatternArray VerticalLines - { - get { return _VerticalLines; } - set { _VerticalLines = value; } - } - private LinePatternArray _HorizontalLines; - public LinePatternArray HorizontalLines - { - get { return _HorizontalLines; } - set { _HorizontalLines = value; } - } - #endregion - #region ctor - public VlnBorders() { ;} - public VlnBorders(GridLinePattern defaultLinePattern, int rows, int columns) - { - Rows = rows; - Columns = columns; - HorizontalLines = new LinePatternArray(defaultLinePattern, Rows + 1, Columns); - VerticalLines = new LinePatternArray(defaultLinePattern, Rows, Columns + 1); - } - #endregion - #region SetRange - Set the border styles over a range of cells - public void SetRange(int r1, int c1, int r2, int c2, - GridLinePattern top, GridLinePattern middle, GridLinePattern bottom, - GridLinePattern left, GridLinePattern center, GridLinePattern right) - { - for (int c = c1; c <= c2; c++) - { - if (top != GridLinePattern.Mixed) HorizontalLines[r1, c] = top; - for (int r = r1 + 1; r <= r2; r++) - if (middle != GridLinePattern.Mixed) HorizontalLines[r, c] = middle; - if (bottom != GridLinePattern.Mixed) HorizontalLines[r2 + 1, c] = bottom; - } - for (int r = r1; r <= r2; r++) - { - if (left != GridLinePattern.Mixed) VerticalLines[r, c1] = left; - for (int c = c1 + 1; c <= c2; c++) - if (center != GridLinePattern.Mixed) VerticalLines[r, c] = center; - if (right != GridLinePattern.Mixed) VerticalLines[r, c2 + 1] = right; - } - } - #endregion - #region Get Borders over a Range - Return Mixed if multiple values are found. - public GridLinePattern RangeTopBorder(int r1, int c1, int r2, int c2) - { - GridLinePattern linePattern = HorizontalLines[r1, c1]; - for (int c = c1; c <= c2; c++) - if (linePattern != HorizontalLines[r1, c]) return GridLinePattern.Mixed; - return linePattern; - } - public GridLinePattern RangeHorizontalBorder(int r1, int c1, int r2, int c2) - { - if (r1 == r2) return GridLinePattern.None; - GridLinePattern linePattern = HorizontalLines[r1 + 1, c1]; - for (int r = r1 + 1; r <= r2; r++) - for (int c = c1; c <= c2; c++) - if (linePattern != HorizontalLines[r, c]) return GridLinePattern.Mixed; - return linePattern; - } - public GridLinePattern RangeBottomBorder(int r1, int c1, int r2, int c2) - { - GridLinePattern linePattern = HorizontalLines[r2 + 1, c1]; - for (int c = c1; c <= c2; c++) - if (linePattern != HorizontalLines[r2 + 1, c]) return GridLinePattern.Mixed; - return linePattern; - } - public GridLinePattern RangeLeftBorder(int r1, int c1, int r2, int c2) - { - GridLinePattern linePattern = VerticalLines[r1, c1]; - for (int r = r1; r <= r2; r++) - if (linePattern != VerticalLines[r, c1]) return GridLinePattern.Mixed; - return linePattern; - } - public GridLinePattern RangeVerticalBorder(int r1, int c1, int r2, int c2) - { - if (c1 == c2) return GridLinePattern.None; - GridLinePattern linePattern = VerticalLines[r1, c1 + 1]; - for (int c = c1 + 1; c <= c2; c++) - for (int r = r1 + 1; r <= r2; r++) - if (linePattern != VerticalLines[r, c]) return GridLinePattern.Mixed; - return linePattern; - } - public GridLinePattern RangeRightBorder(int r1, int c1, int r2, int c2) - { - GridLinePattern linePattern = VerticalLines[r1, c2 + 1]; - for (int r = r1; r <= r2; r++) - if (linePattern != VerticalLines[r, c2 + 1]) return GridLinePattern.Mixed; - return linePattern; - } - #endregion - #region Insert and Remove Rows and Columns - public void InsertRow(int row) - { - HorizontalLines.InsertRow(row); - VerticalLines.InsertRow(row); - } - public void InsertRows(int row, int count) - { - HorizontalLines.InsertRows(row, count); - VerticalLines.InsertRows(row, count); - } - public void DeleteRow(int row) - { - HorizontalLines.DeleteRow(row); - VerticalLines.DeleteRow(row); - } - public void DeleteRows(int row, int count) - { - HorizontalLines.DeleteRows(row, count); - VerticalLines.DeleteRows(row, count); - } - public void InsertColumn(int column) - { - HorizontalLines.InsertColumn(column); - VerticalLines.InsertColumn(column); - } - public void InsertColumns(int column, int count) - { - HorizontalLines.InsertColumns(column, count); - VerticalLines.InsertColumns(column, count); - } - public void DeleteColumn(int column) - { - HorizontalLines.DeleteColumn(column); - VerticalLines.DeleteColumn(column); - } - public void DeleteColumns(int column, int count) - { - HorizontalLines.DeleteColumns(column, count); - VerticalLines.DeleteColumns(column, count); - } - #endregion - #region Serialize - public string ConvertToString() - { - return GenericSerializer.StringSerialize(this); - } - public override string ToString() - { - return "Volian Custom Borders"; - } - public static VlnBorders Get(string xml) - { - return GenericSerializer.StringDeserialize(xml); - } - #endregion - #region Line Pattern Static Methods - public static int LineWidth(GridLinePattern linePattern) - { - switch (linePattern) - { - case GridLinePattern.Double: - case GridLinePattern.Thick: - return 3; - case GridLinePattern.None: - case GridLinePattern.Single: - case GridLinePattern.Dotted: - case GridLinePattern.Dashed: - case GridLinePattern.Mixed: - default: - return 1; - } - } - public static int LineWidth0(GridLinePattern linePattern) - { - switch (linePattern) - { - case GridLinePattern.None: - return 0; - case GridLinePattern.Double: - case GridLinePattern.Thick: - return 3; - case GridLinePattern.Single: - case GridLinePattern.Dotted: - case GridLinePattern.Dashed: - case GridLinePattern.Mixed: - default: - return 1; - } - } - public static Pen LinePen(GridLinePattern linePattern, Color foreColor) - { - Pen pn = new Pen(foreColor, 1); - switch (linePattern) - { - case GridLinePattern.None: - pn.Width = 0; - break; - case GridLinePattern.Thick: - pn.Width = 3; - break; - case GridLinePattern.Dotted: - pn.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom; - float[] patternDot = { 1, 2 }; - pn.DashPattern = patternDot; - break; - case GridLinePattern.Dashed: - pn.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom; - float[] patternDash = { 6, 6 }; - pn.DashPattern = patternDash; - break; - case GridLinePattern.Mixed: - pn.Color = Color.LightGray; - break; - case GridLinePattern.Double: - case GridLinePattern.Single: - default: - break; - } - return pn; - } - #endregion -#region checkborderarrays - // C2018-031 Adjust the Horizontal and Vertical cell border arrays if needed - public void CheckAndFixBorderArraySize(int grdRows, int grdCols, GridLinePattern defaultLinePattern) - { - if (HorizontalLines.Columns != grdCols || HorizontalLines.Rows != grdRows + 1) - HorizontalLines = new LinePatternArray(defaultLinePattern, grdRows + 1, grdCols, HorizontalLines.Lines); - if (VerticalLines.Columns != grdCols + 1 || VerticalLines.Rows != grdRows) - VerticalLines = new LinePatternArray(defaultLinePattern, grdRows, grdCols + 1, VerticalLines.Lines); - } -#endregion - } - [Serializable] - public class LinePatternArray - { - #region Properties - protected static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private int _Rows; - [XmlAttribute("Rows")] - public int Rows - { - get { return _Rows; } - set { _Rows = value; } - } - private int _Columns; - [XmlAttribute("Columns")] - public int Columns - { - get { return _Columns; } - set { _Columns = value; } - } - private GridLinePattern[] _Lines; - public GridLinePattern[] Lines - { - get { return _Lines; } - set { _Lines = value; } - } - #endregion - #region ctor - public LinePatternArray() { ;} - public LinePatternArray(GridLinePattern defaultLinePattern, int rows, int columns) - { - Rows = rows; - Columns = columns; - Lines = new GridLinePattern[rows * columns]; - for (int r = 0; r < Rows; r++) - for (int c = 0; c < Columns; c++) - Lines[r * Columns + c] = defaultLinePattern; - } - // C2018-031 used to automatically adjust the cell border arrays - public LinePatternArray(GridLinePattern defaultLinePattern, int rows, int columns, GridLinePattern[] lnsAry) - { - Rows = rows; - Columns = columns; - Lines = new GridLinePattern[rows * columns]; - for (int r = 0; r < Rows; r++) - for (int c = 0; c < Columns; c++) - { - int idx = r * Columns + c; - if (idx < lnsAry.Length) - Lines[idx] = lnsAry[idx]; - else - Lines[idx] = defaultLinePattern; - } - } - #endregion - #region Array Access - public GridLinePattern this[int r, int c] - { - get - { - int indx = r * Columns + c; - if (indx < Lines.Length) return Lines[r * Columns + c]; - _MyLog.WarnFormat("GridLinePattern: Lines Array Access out-of-bounds ({0}, {1}) within ({2}, {3})", r, c, Rows, Columns); - return GridLinePattern.Single; - } - set { Lines[r * Columns + c] = value; } - } - #endregion - #region Insert and Delete Rows and Columns - public void InsertRow(int row) - { - InsertRows(row, 1); - } - public void InsertRows(int row, int count) - { - // Create a new Array of the correct size - GridLinePattern[] newLines = new GridLinePattern[(Rows + count) * Columns]; - int newRows = Rows + count; - for (int r = 0; r < newRows; r++) - { - int rSrc = r < row ? r : r > row + count ? r - count : row; - if (rSrc > Rows - 1) rSrc = Rows - 1; - for (int c = 0; c < Columns; c++) - { - newLines[r * Columns + c] = Lines[rSrc * Columns + c]; - } - } - Lines = newLines; - Rows = newRows; - } - public void DeleteRow(int row) - { - DeleteRows(row, 1); - } - public void DeleteRows(int row, int count) - { - GridLinePattern[] newLines = new GridLinePattern[(Rows - count) * Columns]; - int newRows = Rows - count; - for (int r = 0; r < newRows; r++) - { - int rSrc = r < row ? r : r + count; - for (int c = 0; c < Columns; c++) - { - newLines[r * Columns + c] = Lines[rSrc * Columns + c]; - } - } - Lines = newLines; - Rows = newRows; - } - public void InsertColumn(int column) - { - InsertColumns(column, 1); - } - public void InsertColumns(int column, int count) - { - // Create a new Array of the correct size - GridLinePattern[] newLines = new GridLinePattern[Rows * (Columns + count)]; - int newColumns = Columns + count; - for (int r = 0; r < Rows; r++) - { - for (int c = 0; c < newColumns; c++) - { - int cSrc = c < column ? c : c > column + count ? c - count : column; - newLines[r * newColumns + c] = Lines[r * Columns + cSrc]; - } - } - Lines = newLines; - Columns = newColumns; - } - public void DeleteColumn(int column) - { - DeleteColumns(column, 1); - } - public void DeleteColumns(int column, int count) - { - GridLinePattern[] newLines = new GridLinePattern[Rows * (Columns - count)]; - int newColumns = Columns - count; - for (int r = 0; r < Rows; r++) - { - for (int c = 0; c < newColumns; c++) - { - int cSrc = c < column ? c : c + count; - newLines[r * newColumns + c] = Lines[r * Columns + cSrc]; - } - } - Lines = newLines; - Columns = newColumns; - } - #endregion - - } - public enum GridLinePattern : int - { - Unknown = -1, - None = 0, - Single = 1, - Double = 2, - Thick = 3, - Dotted = 4, - Dashed = 5, - Mixed = 6 - } -} diff --git a/PROMS/Volian.Controls.Library/VlnFlexGrid.Designer.cs b/PROMS/Volian.Controls.Library/VlnFlexGrid.Designer.cs deleted file mode 100644 index 95fa1523..00000000 --- a/PROMS/Volian.Controls.Library/VlnFlexGrid.Designer.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; - -namespace Volian.Controls.Library -{ - partial class vlnPanel - { - ///

- /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - } - - #endregion - } - partial class VlnFlexGrid - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (_Disposed) return; - _CountDisposed++; - _Disposed = true; - _MyBorders = null; - _MyShading = null; - _SpellChecker = null; - _tableCellEditor = null; - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - if(!_Finalized) - GC.ReRegisterForFinalize(this); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); - this.SuspendLayout(); - // - // VlnFlexGrid - // - this.Rows.DefaultSize = 19; - - ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs deleted file mode 100644 index f7f2310f..00000000 --- a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs +++ /dev/null @@ -1,5308 +0,0 @@ -using System; -using System.ComponentModel; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using System.Windows.Forms; -using System.Drawing; -using System.Runtime.InteropServices; -using System.Xml; -using System.IO; -using Volian.Controls.Library; -using VEPROMS.CSLA.Library; -using C1.Win.C1FlexGrid; -using C1.Win.C1SpellChecker; -using System.Text.RegularExpressions; -using System.Xml.Serialization; -using Volian.Base.Library; -using JR.Utils.GUI.Forms; - -namespace Volian.Controls.Library -{ - public delegate void VlnFlexGridEvent(object sender, EventArgs args); - public delegate void VlnFlexGridCursorMovementEvent(object sender, VlnFlexGridCursorMovementEventArgs args); - public delegate string VlnFlexGridPasteEvent(object sender, VlnFlexGridPasteEventArgs args); - public delegate void VlnFlexGridkeyEvent(object sender, KeyEventArgs args); - public partial class vlnPanel : Panel - { - private int _Opacity = 128; - //public int Opacity - //{ - // get { return _Opacity; } - // set { _Opacity = value; } - //} - - public vlnPanel() - { - InitializeComponent(); - } - - public vlnPanel(IContainer container) - { - container.Add(this); - InitializeComponent(); - } - //protected override CreateParams CreateParams - //{ - // get - // { - // CreateParams prams = base.CreateParams; - // prams.ExStyle |= 0x020; // transparent - // return prams; - // } - //} - //protected override void OnPaint(PaintEventArgs pe) - //{ - // pe.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(_Opacity, this.BackColor)), this.ClientRectangle); - //} - } - - public partial class VlnFlexGrid : C1.Win.C1FlexGrid.C1FlexGrid - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private bool _Disposed = false; - private static int _CountCreated = 0; - private static int _CountDisposed = 0; - private static int _CountFinalized = 0; - private static int IncrementCountCreated - { get { return ++_CountCreated; } } - private int _CountWhenCreated = IncrementCountCreated; - public static int CountCreated - { get { return _CountCreated; } } - public static int CountNotDisposed - { get { return _CountCreated - _CountDisposed; } } - public static int CountNotFinalized - { get { return _CountCreated - _CountFinalized; } } - private bool _Finalized = false; - ~VlnFlexGrid() - { - if(!_Finalized) _CountFinalized++; - _Finalized = true; - } - private C1SpellChecker _SpellChecker; - public C1SpellChecker SpellChecker - { - get { return _SpellChecker; } - set { _SpellChecker = value; } - } - //public string GridStackTrace - //{ - // get - // { - // string st = Volian.Base.Library.vlnStackTrace.GetStack(); - // st = StripFunnyCharacters(st); - // return st; - // Console.WriteLine(st); - // return st.Replace(@"\","|"); - // } - // set - // { - // ; - // } - //} - //private string StripFunnyCharacters(string st) - //{ - // StringBuilder sb = new StringBuilder(); - // foreach (char c in st) - // { - // if ((c < ' ' || c > 255) && !"\r\n\t".Contains(c.ToString())) - // sb.Append(string.Format("x{0:X4}", (int)c)); - // else - // sb.Append(c); - // } - // return sb.ToString(); - //} - private DocVersionInfo _MyDVI = null; - - public DocVersionInfo MyDVI - { - get - { - ItemInfo procInfo = _MyItemInfo.MyProcedure as ItemInfo; //_MyEditItem.MyItemInfo.MyProcedure as ItemInfo; - if (procInfo == null) - _MyDVI = null; - else - _MyDVI = procInfo.ActiveParent as DocVersionInfo; - return _MyDVI; - } - } - private static UserInfo _MyUserInfo = null; - public static UserInfo MyUserInfo - { - get { return _MyUserInfo; } - set - { - _MyUserInfo = value; - GridItem.MyUserInfo = value; - } - } - - // C2021-005 used by the table cell editor to pass font size information - private float _SelectedFontSize; - public float SelectedFontSize - { - get { return _SelectedFontSize; } - set - { - if (Parent is GridItem) - { - _SelectedFontSize = (float)value; - // initialize the font size dropdown - (Parent as GridItem).MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetFontSizeDropDownText(value); - _DoubleClickedCell = false; - } - } - } - - public bool IsDirty - { - get - { - return IsGridChanged(this._MyItemInfo.MyContent.MyGrid.Data, this.GetXMLData(), true); - } - } - private bool IsGridChanged(string oldXml, string newXml, bool checkFormat) - { - if (this.TableCellEditor.Text.Contains("")) - return false; - XmlDocument XdOld = new XmlDocument(); - oldXml = _ReplaceTextFont.Replace(oldXml, "$1" + FontChangeFmt + "$4"); // B2021-032: use original font - XdOld.LoadXml(AdjustHeightAndWidthForDPI(oldXml)); - XmlDocument XdNew = new XmlDocument(); - XdNew.LoadXml(AdjustHeightAndWidthForDPI(newXml)); - //check volian borders 1st - if (checkFormat && XdNew.SelectSingleNode("C1FlexGrid/Control/MyBorderDetailString").InnerText != XdOld.SelectSingleNode("C1FlexGrid/Control/MyBorderDetailString").InnerText) - return true; - //check row/col sizes 2nd - if (checkFormat && ( GetRowColSizeString(XdNew) != GetRowColSizeString(XdOld))) - return true; - //check for cell data changes 3rd - if (GetCellDataString(XdNew) != GetCellDataString(XdOld)) - return true; - //check for cell format changes 4th - if (checkFormat && GetCellFormatString(XdNew) != GetCellFormatString(XdOld)) - return true; - //check for text alignment changes 5th - // put check in for bug fix B2014-106 - if (checkFormat && GetCellTextAlignString(XdNew) != GetCellTextAlignString(XdOld)) - return true; - //check for merged cells 6th - if (GetCellMergeString(XdNew) != GetCellMergeString(XdOld)) - return true; - // C2021-004 check volian shading 7th - XmlNode oldNode = XdOld.SelectSingleNode("C1FlexGrid/Control/MyShadingDetailString"); // old shading information - XmlNode newNode = XdNew.SelectSingleNode("C1FlexGrid/Control/MyShadingDetailString"); // new shading information - if ((oldNode == null || oldNode.InnerText == null) || - checkFormat && newNode.InnerText != oldNode.InnerText) - return true; - return false; - } - private string GetRowColSizeString(XmlDocument xd) - { - string defCW = xd.SelectSingleNode("C1FlexGrid/ColumnInfo/DefaultSize").InnerText; - string defRH = xd.SelectSingleNode("C1FlexGrid/RowInfo/DefaultSize").InnerText; - int cols = ColumnCount(xd); - int rows = RowCount(xd); - List rh = new List(); - for (int i = 0; i < rows; i++) - rh.Add(defRH); - List cw = new List(); - for (int i = 0; i < cols; i++) - cw.Add(defCW); - XmlNodeList nlr = xd.SelectNodes("C1FlexGrid/Rows/Row"); - foreach (XmlNode nr in nlr) - { - int idx = int.Parse(nr.Attributes.GetNamedItem("index").InnerText); - rh[idx] = nr.SelectSingleNode("Height").InnerText; - } - XmlNodeList nlc = xd.SelectNodes("C1FlexGrid/Columns/Column"); - foreach (XmlNode nc in nlc) - { - int idx = int.Parse(nc.Attributes.GetNamedItem("index").InnerText); - cw[idx] = nc.SelectSingleNode("Width").InnerText; - } - string rhcw = "RowHeights: "; - string sep = string.Empty; - foreach (string s in rh) - { - rhcw += sep + s; - sep = ","; - } - rhcw += " - ColWidths: "; - sep = string.Empty; - foreach (string s in cw) - { - rhcw += sep + s; - sep = ","; - } - return rhcw; - } - private int ColumnCount(XmlDocument xd) - { - XmlNode xn = xd.SelectSingleNode("C1FlexGrid/ColumnInfo/Count"); - int cols = 0; - if (xn != null) - cols = int.Parse(xn.InnerText); - else - { - XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Columns/Column"); - cols = nl.Count; - } - return cols; - } - private int RowCount(XmlDocument xd) - { - XmlNode xn = xd.SelectSingleNode("C1FlexGrid/RowInfo/Count"); - int rows = 0; - if (xn != null) - rows = int.Parse(xn.InnerText); - else - { - XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Rows/Row"); - rows = nl.Count; - } - return rows; - } - private string GetCellDataString(XmlDocument xd) - { - int cols = ColumnCount(xd); - int rows = RowCount(xd); - List datum = new List(); - for (int i = 0; i < rows * cols; i++) - datum.Add("|"); - XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Cells/Cell/Data"); - // B2026-003 use StringBuilder a "using" statement around the RichTextBox for better mememory management - StringBuilder data = new StringBuilder(); - foreach (XmlNode xn in nl) - { - using (RichTextBox rtb = new RichTextBox()) - { - rtb.Rtf = xn.InnerText; - XmlAttribute xa = xn.ParentNode.Attributes.GetNamedItem("index") as XmlAttribute; - string[] rc = xa.InnerText.Split(','); - int r = int.Parse(rc[0]); - int c = int.Parse(rc[1]); - int index = r * cols + c; - datum[index] = "|" + (rtb.Text == "" ? "" : rtb.Text); - } - } - foreach (string s in datum) - data.Append(s); - return data.ToString(); - } - private string GetCellFormatString(XmlDocument xd) - { - int cols = ColumnCount(xd); - int rows = RowCount(xd); - List datum = new List(); - for (int i = 0; i < rows * cols; i++) - datum.Add("|"); - XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Cells/Cell/Data"); - string data = string.Empty; - foreach (XmlNode xn in nl) - { - RichTextBox rtb = new RichTextBox(); - rtb.Rtf = xn.InnerText; - XmlAttribute xa = xn.ParentNode.Attributes.GetNamedItem("index") as XmlAttribute; - string[] rc = xa.InnerText.Split(','); - int r = int.Parse(rc[0]); - int c = int.Parse(rc[1]); - int index = r * cols + c; - datum[index] = "|" + (rtb.Text == "" ? "" : rtb.Rtf); - } - foreach (string s in datum) - data += s; - return data; - } - private string GetCellMergeString(XmlDocument xd) - { - if(xd.SelectSingleNode("C1FlexGrid/MergedRanges") == null) - return string.Empty; - return xd.SelectSingleNode("C1FlexGrid/MergedRanges").InnerXml; - } - private string GetCellTextAlignString(XmlDocument xd) - { - // Note that I could not save (and later compare) the entire Definition string - // because the xml for the old and new table was always different. - // The old xml table data would have, for example "white" for the background color, while - // the new xml table data would have "255,255,255" for the background color. - // Therefore this check is specific for only the TextAlign setting - jsj 9-30-2014 - XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Styles/Style/Definition"); - string data = string.Empty; - foreach (XmlNode xn in nl) - { - string str = xn.InnerText; - string[] splStr = str.Split(';'); - foreach (string s in splStr) - if (s.StartsWith("TextAlign:")) - data += "|" + s; // only save the TextAlign setting - } - return data; - } - private static GridCopyInfo _MyCopyInfo; - public static GridCopyInfo MyCopyInfo - { - get - { - if (_MyCopyInfo == null) - _MyCopyInfo = new GridCopyInfo(); - return _MyCopyInfo; - } - } - private Color _DefaultCellBackgroundcolor; - - public Color DefaultCellBackgroundcolor - { - get { return _DefaultCellBackgroundcolor; } - } - private Color _DefaultFixedBackgroundColor; - - public Color DefaultFixedBackgroundColor - { - get { return _DefaultFixedBackgroundColor; } - } - public void CopyToCopiedFlexGrid(GridCopyOption myCopyOption) - { - MyCopyInfo.MyCopiedFlexGrid = new VlnFlexGrid(); //make a copy of the grid being copied - using (StringReader sr = new StringReader(this.GetXMLData())) - { - MyCopyInfo.MyCopiedFlexGrid.ReadXml(sr); - this.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None; - sr.Close(); - } - MyCopyInfo.MyCopyOption = myCopyOption; - OnCopyOptionChanged(this, new EventArgs()); - switch (MyCopyInfo.MyCopyOption) - { - case GridCopyOption.Row: - MyCopyInfo.MyCopiedCellRange = MyCopyInfo.MyCopiedFlexGrid.GetCellRange(Selection.r1, 0, Selection.r2, Cols.Count - 1); - break; - case GridCopyOption.Column: - MyCopyInfo.MyCopiedCellRange = MyCopyInfo.MyCopiedFlexGrid.GetCellRange(0, Selection.c1, Rows.Count - 1, Selection.c2); - break; - case GridCopyOption.Selection: - MyCopyInfo.MyCopiedCellRange = MyCopyInfo.MyCopiedFlexGrid.GetCellRange(Selection.r1, Selection.c1, Selection.r2, Selection.c2); - break; - default: - break; - } - } - public event VlnFlexGridEvent CopyOptionChanged; - public void OnCopyOptionChanged(object sender, EventArgs args) - { - if (CopyOptionChanged != null) CopyOptionChanged(sender, args); - } - - [XmlElement("MyBorders")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string MyBorderDetailString - { - get - { - return MyBorders.ConvertToString(); - } - set - { - if (value != null) - _MyBorders = VlnBorders.Get(value); - else - _MyBorders = null; - } - } - private VlnBorders _MyBorders; - [XmlIgnore] - public VlnBorders MyBorders - { - get - { - if (_MyBorders == null) - _MyBorders = new VlnBorders(GridLinePattern.Single, Rows.Count, Cols.Count); - return _MyBorders; - } - set { _MyBorders = value; } - } - private ItemInfo _MyItemInfo; - public ItemInfo GetMyItemInfo() - { - return _MyItemInfo; - } - //public ItemInfo MyItemInfo - //{ - // get { return _MyItemInfo; } - // set { _MyItemInfo = value; } - //} - public bool TopRowHasBorder() - { - for (int c = 0; c < Cols.Count; c++) - if (MyBorders.HorizontalLines[0, c] != GridLinePattern.None) return true; - return false; - } - public void SetBorders(CellRange myRange, - GridLinePattern top, GridLinePattern middle, GridLinePattern bottom, - GridLinePattern left, GridLinePattern center, GridLinePattern right) - { - for (int r = myRange.r1; r <= myRange.r2; r++) - for (int c = myRange.c1; c <= myRange.c2; c++) - { - CellRange cr = GetMergedRange(r, c); - if (r == myRange.r1) // Top Border - if(top != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r1, cr.c1]=top; - if (c == myRange.c1) // Left Border - if(left != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r1, cr.c1]=left; - if (r == myRange.r2) // Bottom Border - if(bottom != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r2 + 1, cr.c2]=bottom; - if (c == myRange.c2) // Right Border - if(right != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r2, cr.c2 + 1] = right; - if (r == cr.r1 && c == cr.c1) // Look for inside lines - { - if (cr.r1 > myRange.r1 && cr.r1 <= myRange.r2) // Inside Horizontal Top - if (middle != GridLinePattern.Mixed) - { - MyBorders.HorizontalLines[cr.r1, cr.c1] = middle; - MyBorders.HorizontalLines[cr.r1, cr.c2] = middle; - } - if (cr.r2 > myRange.r1 && cr.r2 < myRange.r2) // Inside Horizontal Bottom - if(middle != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r2 + 1, cr.c2]=middle; - if (cr.c1 > myRange.c1 && cr.c1 <= myRange.c2) // Inside Vertical Left - if (center != GridLinePattern.Mixed) - { - MyBorders.VerticalLines[cr.r1, cr.c1] = center; - MyBorders.VerticalLines[cr.r2, cr.c1] = center; - } - if (cr.c2 > myRange.c1 && cr.c2 < myRange.c2) // Inside Vertical Right - if(center != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r2, cr.c2 + 1]=center; - } - c = cr.c2;//Skip to the end of the merged cells - } - - } - public void PasteBorders(int r, int c, int br, int bc) - { - MyBorders.HorizontalLines[r, c] = MyCopyInfo.MyCopiedFlexGrid.MyBorders.HorizontalLines[br,bc]; - MyBorders.VerticalLines[r, c] = MyCopyInfo.MyCopiedFlexGrid.MyBorders.VerticalLines[br, bc]; - MyBorders.HorizontalLines[r+1, c] = MyCopyInfo.MyCopiedFlexGrid.MyBorders.HorizontalLines[br+1, bc]; - MyBorders.VerticalLines[r, c+1] = MyCopyInfo.MyCopiedFlexGrid.MyBorders.VerticalLines[br, bc+1]; - } - #region Table Cell Shading - [XmlElement("MyShading")] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string MyShadingDetailString - { - get - { - return MyShading.ConvertToString(); - } - set - { - if (value != null) - _MyShading = VlnGridCellShading.Get(value); - else - _MyShading = null; - } - } - private VlnGridCellShading _MyShading = null; - [XmlIgnore] - public VlnGridCellShading MyShading - { - get - { - if (_MyShading == null || _MyShading.TableShadingInfo.CellShadingColor.Length == 0) - _MyShading = new VlnGridCellShading(Color.White, Rows.Count, Cols.Count); - return _MyShading; - } - set { _MyShading = value; } - } - public void SetShading(CellRange myRange, Color shading) - { - Console.WriteLine("SetShading toString {0}", shading.ToString()); - //Console.WriteLine("SetShading toArgb {0}", shading.ToArgb()); - //Console.WriteLine("SetShading Name {0}", shading.Name); - for (int r = myRange.r1; r <= myRange.r2; r++) - for (int c = myRange.c1; c <= myRange.c2; c++) - { - CellRange cr = GetMergedRange(r, c); - MyShading.TableShadingInfo[cr.r1, cr.c1] = MyShading.GetARGBstring(shading); - c = cr.c2; //Skip to the end of the merged cells - } - } - public void SetShading(CellRange myRange, ShadingOption fmtShadingOpt) - { - Console.WriteLine("SetShading toString {0}", fmtShadingOpt.ToString()); - for (int r = myRange.r1; r <= myRange.r2; r++) - for (int c = myRange.c1; c <= myRange.c2; c++) - { - CellRange cr = GetMergedRange(r, c); - MyShading.TableShadingInfo[cr.r1, cr.c1] = fmtShadingOpt.GetARBGstringForTableCells(); - c = cr.c2; //Skip to the end of the merged cells - } - } - public void ShowTableCellShading() - { - for (int r = 0; r < Rows.Count; r++) - for (int c = 0; c < Cols.Count; c++) - { - CellRange cr = GetMergedRange(r, c); - Color clr = MyShading.GetColor(cr.r1, cr.c1); - cr.StyleNew.BackColor = clr; - } - } - public void PasteShading(int r, int c, int sr, int sc) - { - MyShading.TableShadingInfo[r, c] = MyCopyInfo.MyCopiedFlexGrid.MyShading.TableShadingInfo[sr, sc]; - } - #endregion[XmlIgnore] - public bool HasVScroll - { - get - { - return RTBAPI.HasVertScroll(this); - } - } - [XmlIgnore] - public bool HasHScroll - { - get - { - return RTBAPI.HasHorzScroll(this); - } - } - public event VlnFlexGridEvent OpenAnnotations; - public void OnOpenAnnotations(object sender, EventArgs args) - { - if (OpenAnnotations != null) OpenAnnotations(sender, args); - } - public event VlnFlexGridCursorMovementEvent CursorMovement; - internal void OnCursorMovement(object sender, VlnFlexGridCursorMovementEventArgs args) - { - if (CursorMovement != null) CursorMovement(sender, args); - } - public event VlnFlexGridPasteEvent AdjustPastedText; - internal string OnAdjustPastedText(object sender, VlnFlexGridPasteEventArgs args) - { - if (AdjustPastedText != null) return AdjustPastedText(sender, args); - return args.Text; - } - public event VlnFlexGridkeyEvent EnterKeyPressed; - public void OnEnterKeyPressed(object sender, KeyEventArgs args) - { - if (EnterKeyPressed != null) EnterKeyPressed(sender, args); - } - - private TableCellEditor _tableCellEditor; - - public TableCellEditor TableCellEditor - { - get { return _tableCellEditor; } - set { _tableCellEditor = value; } - } - private TableClipBoardFuncts _clpbrdCpyPste; - private int _minColSplitWidth = 10; - //private int _minRowSplitHeight = 23; - - //private int _minSplitColWidth = 10; - //private int _minSplitRowHeight = 20; - private E_ViewMode _vwMode = E_ViewMode.Edit; - [XmlIgnore] - internal E_ViewMode VwMode - { - get { return _vwMode; } - set - { - _vwMode = value; - AllowEditing = _vwMode == E_ViewMode.Edit; - } - } - private bool _IsRoTable = false; - public bool IsRoTable - { - get { return _IsRoTable; } - set { _IsRoTable = value; } - } - private int _RODbId; - public int RODbId - { - get { return _RODbId; } - set { _RODbId = value; } - } - private string _ROID; - - public string ROID - { - get { return _ROID; } - set { _ROID = value; } - } - private float? _DPI = null; - public float? DPI - { - get - { - if (_DPI == null) - _DPI = 120; - return _DPI; - } - set - { - if (DPI != value) - { - _DPI = value; - } - } - } - #region Grid Initialize - - public VlnFlexGrid() - { - InitializeComponent(); - SetupGrid(4, 3); // use a default row and column count - } - - public VlnFlexGrid(int rows, int cols) - { - InitializeComponent(); - SetupGrid(rows, cols); - } - - public VlnFlexGrid(IContainer container) - { - container.Add(this); - InitializeComponent(); - SetupGrid(1, 1); - } - public VlnFlexGrid(ContentItem ci) - { - InitializeComponent(); - SetupGrid(4, 3); // use a default row and column count - _MyItemInfo = ci.MyItem.MyItemInfo; - } - //public VlnFlexGrid(IContainer container) - //{ - // container.Add(this); - - // InitializeComponent(); - // _tableCellEditor = new TableCellEditor(this); - // _tableCellEditor.ContentsResized += new ContentsResizedEventHandler(_tableCellEditor_ContentsResized); - //} - - //void _tableCellEditor_ContentsResized(object sender, ContentsResizedEventArgs e) - //{ - // if (_tableCellEditor._initializingEdit) return; - // CellRange cr = GetMergedRange(Row, Col); - // int oH = cr.UserData == null? 0 : (int)cr.UserData; - // int nH = _tableCellEditor.ContentsRectangle.Height; - // int Hadj = (nH - oH); - // cr.UserData = _tableCellEditor.ContentsRectangle.Height; - // int cellHeight = GetCellHeight(Row,Col); - // int cellheightNLines = cellHeight / (Rows.DefaultSize - 3); - // int nHNLines = nH / (Rows.DefaultSize - 3); - // if (Hadj != 0) - // { - // int curHeight = (Rows[Row].Height == -1) ? Rows.DefaultSize : Rows[Row].Height; - // //if (Hadj > 0 && cellHeight <= oH) - // if (Hadj > 0 && cellheightNLines < nHNLines) - // curHeight += (Rows.DefaultSize - 3); - // if (Hadj < 0 && CanReduceRow()) - // curHeight -= (Rows.DefaultSize-3); - // Rows[Row].Height = curHeight; - // AdjustGridControlSize(); - // } - // //cr.UserData = _tableCellEditor.ContentsRectangle.Height; - // //int mh = GetMaxRowHeight(); - // ////Rows[Row].Height = mh + 2; - // //int h = 0; - // //if (cr.r1 == cr.r2 && cr.c1 == cr.c2) - // // h = Rows[Row].Height - 2; - // //else - // //{ - // // for (int r = cr.r1; r <= cr.r2; r++) - // // h += Rows[r].Height - 2; - // //} - // //Rows[Row].Height += (mh - h); - // ////AdjustGridControlSize(); - //} - private int GetCellHeight(int row, int col) - { - return GetRangeHeight(GetMergedRange(row, col))-3; - } - - public int GetRangeHeight(CellRange cr) - { - int height = 0; - for (int r = cr.r1; r <= cr.r2; r++) - height += (Rows[r].Height == -1) ? Rows.DefaultSize : Rows[r].Height; - return height; - } - - public int GetRangeTop(CellRange cr) - { - int top = 0; - for (int r = 0; r < cr.r1; r++) - top += (Rows[r].Height == -1) ? Rows.DefaultSize : Rows[r].Height; - return top; - } - - public int GetRangeWidth(CellRange cr) - { - int width = 0; - for (int c = cr.c1; c <= cr.c2; c++) - width += (Cols[c].Width == -1) ? Cols.DefaultSize : Cols[c].Width; - return width; - } - - public int GetRangeLeft(CellRange cr) - { - int left = 0; - for (int c = 0; c < cr.c1; c++) - left += (Cols[c].Width == -1) ? Cols.DefaultSize : Cols[c].Width; - return left; - } - - public int GetRangeRowsMin(CellRange cr) - { - int rowsMin = 1 + cr.r2 - cr.r1; - for (int c = cr.c1; c <= cr.c2; c++) - { - int rows = 0; - for (int r = cr.r1; r <= cr.r2; r++) - { - CellRange chk = GetMergedRange(r, c); - if (chk.r1 == r && chk.c1 == c) - rows++; - } - rowsMin = Math.Min(rowsMin, rows); - } - return rowsMin; - } - - public int GetRangeRowsMax(CellRange cr) - { - int rowsMax = 0; - for (int c = cr.c1; c <= cr.c2; c++) - { - int rows = 0; - for (int r = cr.r1; r <= cr.r2; r++) - { - CellRange chk = GetMergedRange(r, c); - if (chk.r1 == r && chk.c1 == c) - rows++; - } - rowsMax = Math.Max(rowsMax, rows); - } - return rowsMax; - } - - public int GetRangeColsMin(CellRange cr) - { - int colsMin = 1 + cr.c2 - cr.c1; - for (int r = cr.r1; r <= cr.r2; r++) - { - int cols = 0; - for (int c = cr.c1; c <= cr.c2; c++) - { - CellRange chk = GetMergedRange(r, c); - if (chk.r1 == r && chk.c1 == c) - cols++; - } - colsMin = Math.Min(colsMin, cols); - } - return colsMin; - } - - public int GetRangeColsMax(CellRange cr) - { - int colsMax = 0; - for (int c = cr.c1; c <= cr.c2; c++) - { - int cols = 0; - for (int r = cr.r1; r <= cr.r2; r++) - { - CellRange chk = GetMergedRange(r, c); - if (chk.r1 == r && chk.c1 == c) - cols++; - } - colsMax = Math.Max(colsMax, cols); - } - return colsMax; - } - - public string GetRangeRowList(CellRange cr) - { - StringBuilder sb = new StringBuilder(); - string sep = ""; - for (int r = cr.r1; r <= cr.r2; r++) - { - CellRange crm = GetMergedRange(r, cr.c1); - if (crm.r1 == r) - { - sb.Append(sep + r.ToString()); - sep = "."; - } - r = crm.r2; - } - return sb.ToString(); - } - - private int BlankRowSpace() - { - int curRowHeight = (Rows[Row].Height == -1) ? Rows.DefaultSize - 3 : Rows[Row].Height - 3; - if (curRowHeight <= (Rows.DefaultSize - 3)) return 0; // never have row less than default height - int blankRowSpace = curRowHeight; - for (int c = 0; c < Cols.Count; c++) - { - CellRange cr = GetMergedRange(Row, c); - if (Row >= cr.r1 && Row <= cr.r2) - { - int cellHeight = GetCellHeight(Row, c); - int dataHeight = (cr.UserData == null) ? cellHeight : (int)cr.UserData; - int ud = dataHeight / (Rows.DefaultSize - 3); - //if (cellHeight < dataHeight) - // Console.WriteLine("r {0}, c {1}, cell{2}, data{3}", Row, c, cellHeight, dataHeight); - blankRowSpace = Math.Min(blankRowSpace, Math.Max(0,cellHeight - dataHeight)); - } - } - //Console.WriteLine("BlankRowSpace {0}", blankRowSpace); - return blankRowSpace; - } - - private int GetCellWidth(int row, int col) - { - int width = 0; - CellRange cr = GetMergedRange(row, col); - for (int c = cr.c1; c <= cr.c2; c++) - { - width += (Cols[c].Width == -1) ? Cols.DefaultSize - 3 : Cols[c].Width -3; - } - return width; - } - - private int BlankColSpace() - { - int curColWidth = (Cols[Col].Width == -1) ? Cols.DefaultSize - 3 : Cols[Col].Width-3; - //int curRowHeightNLines = curRowHeight / (Rows.DefaultSize - 3); - if (curColWidth <= Cols.DefaultSize - 3) return 0; // never have col less than default width - int blankColSpace = curColWidth; - for (int r = 0; r < Rows.Count; r++) - { - using (StepRTB srtb = new StepRTB()) - { - CellRange cr = GetMergedRange(r, Col); - srtb.Rtf = GetCellRTFString(cr.r1, cr.c1); - if (Col >= cr.c1 && Col <= cr.c2) - { - int cellWidth = GetCellWidth(r, Col); - //srtb.Width = cellWidth; - srtb.AdjustWidthForContent(); - //Application.DoEvents(); - //int mergeCellHeightNLines = cellHeight / (Rows.DefaultSize - 3); - //int dataHeight = (cr.UserData == null) ? cellHeight : (int)cr.UserData; - //int ud = dataHeight / (Rows.DefaultSize - 3); - //if (cellHeight < dataHeight) - // Console.WriteLine("r {0}, c {1}, cell{2}, data{3}", Row, c, cellHeight, dataHeight); - //blankColSpace = Math.Min(blankColSpace, Math.Max(0, cellWidth - srtb.MaxTextWidth)); - blankColSpace = Math.Min(blankColSpace, Math.Max(0, cellWidth - srtb.Width)); - } - } - } - //Console.WriteLine("BlankRowSpace {0}", blankRowSpace); - return blankColSpace; - } - //private bool CanReduceRow() - //{ - // int curRowHeight = (Rows[Row].Height == -1) ? Rows.DefaultSize - 3 : Rows[Row].Height - 3; - // int curRowHeightNLines = curRowHeight / (Rows.DefaultSize - 3); - // bool bReduce = (curRowHeight > (Rows.DefaultSize - 3)); - // if (bReduce) - // { - // for (int c = 0; c < Cols.Count; c++) - // { - // CellRange cr = GetMergedRange(Row, c); - // if (Row >= cr.r1 && Row <= cr.r2) - // { - // int mergeCellHeightNLines = GetCellHeight(Row, c) / (Rows.DefaultSize - 3); - // //int ud = (cr.UserData == null) ? 0 : (int)cr.UserData; - // //if ((c != Col) && curRowHeight <= ud && ud >= mergeCellHeight) - // // bReduce = false; - // int ud = ((cr.UserData == null) ? 0 : (int)cr.UserData) / (Rows.DefaultSize - 3); - // if ((c != Col) && curRowHeightNLines <= ud && ud >= mergeCellHeightNLines) - // bReduce = false; - // } - // } - // } - // //Console.WriteLine("canreduce {0}, {1}", Row, bReduce); - // return bReduce; - //} - //private int GetMaxRowHeight() - //{ - // int maxRTFHeight = _minRowSplitHeight; //Rows.DefaultSize;// the smallest a row can be - // Console.WriteLine("================================================================="); - // for (int c = 0; c < Cols.Count; c++) - // { - // CellRange cr = GetMergedRange(Row, c);//GetCellRange(Row, c); - // maxRTFHeight = Math.Max(maxRTFHeight, (int)cr.UserData); - // if (c == 0) - // Console.WriteLine("Height in Row[{0}] = {1}", Row, Rows[Row].Height); - // Console.WriteLine("UserData Cell[{0},{1}] = {2}", Row, c, cr.UserData); - // } - // return maxRTFHeight; - //} - - private bool IsInMergeRange(int row, int col) - { - //foreach (CellRange cr in this.MergedRanges) - //{ - // if (cr.Contains(row, col)) - // return true; // in a merged range - //} - CellRange cr = GetMergedRange(row, col); - return (cr.r1 == row && cr.c1 == col); - } - private bool _ReadingXml = false; - - public bool ReadingXml - { - get { return _ReadingXml; } - } - private static Regex _ReplaceVESymbFix = new Regex(@"({\\f[0-9]+[^ ]* )(FreeMono)(;})"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing - private static Regex _ReplaceArialUnicodeMS = new Regex(@"({\\f[0-9]+[^ ]* )(" + Volian.Base.Library.vlnFont.ProportionalSymbolFont + @")(;})"); // C2017-036 get best available proportional font for symbols - // B2017-173 VESymFix font was being replaced by the table's default font, causing empty squares for the symbols (pre FreeMono font) in tables - //C2017-036 Added FreeSerif which may be used if Arial Unicode MS is not available - private static Regex _ReplaceTextFont = new Regex(@"({\\f[0-9]+[^ ]* )(?((?!FreeMono)(?!FreeSerif)(?!Arial Unicode MS)(?!VESymbFix))([^;]*)|(!!!!))(;})"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing - private bool FontIsFixed(Font myFont) - { - Graphics grph = Graphics.FromHwnd(this.Handle); - SizeF sfW = grph.MeasureString("W", myFont); - SizeF sfE = grph.MeasureString("!", myFont); - if (sfW.Width == sfE.Width) return true; - return false; - } - // B2021-032: Changes (summary of changes after approval) occur when table does not change. This occurs if the font - // of the table changed in the format so that when the font was used the first time, the save code saw it - // as a difference. Save the new font, so that it can be used when doing the comparison before saving data. - private string _fontChangeFmt = null; - public string FontChangeFmt { get => _fontChangeFmt; set => _fontChangeFmt = value; } - public void LoadGrid(ItemInfo itemInfo) - { - int profileDepth = ProfileTimer.Push(">>>> VlnFlexGrid.LoadGrid"); - // B2021-140 reset the shading information before loading in the next table - // Need to do this because we use static for the tables when we print - MyShading = null; - MyShadingDetailString = null; - _MyItemInfo = itemInfo; - string str = itemInfo.MyContent.MyGrid.Data; - VE_Font vefont = _MyItemInfo.GetItemFont(); - - // the following code is used to be sure that the font used for symbols is the correct font - // based on whether the font for non-symbol text is fixed or proportional. Each steprtb has - // a font for the non-symbol AND the symbol text, and these must be the correct association, i.e. - // for fixed fonts, the symbol font is 'VESymbFix', for proportional fonts, the symbol font is - // 'Arial Unicode MS'. The underlying flexgrid stores the fonts, and if the table font was - // reset for some reason (for example from the drop-down font selection in the user interface), - // this code 'cleans' up if there is a mismatch. - FontFamily ff = null; - if (StepRTB.MyFontFamily != null) - { - ff = StepRTB.MyFontFamily; - if (StepRTB.MySymbolFontName != "FreeMono") // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing - str = _ReplaceVESymbFix.Replace(str, "$1" + StepRTB.MySymbolFontName + "$3"); - if (StepRTB.MySymbolFontName != Volian.Base.Library.vlnFont.ProportionalSymbolFont) // C2017-036 get best available proportional font for symbols - str = _ReplaceArialUnicodeMS.Replace(str, "$1" + StepRTB.MySymbolFontName + "$3"); - str = _ReplaceTextFont.Replace(str, "$1" + ff.Name + "$4"); - } - else - { - ff = vefont.WindowsFont.FontFamily; - if (FontIsFixed(vefont.WindowsFont)) - str = _ReplaceArialUnicodeMS.Replace(str, "$1" + "FreeMono" + "$3"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing - else - str = _ReplaceVESymbFix.Replace(str, "$1" + Volian.Base.Library.vlnFont.ProportionalSymbolFont + "$3"); // C2017-036 get best available proportional font for symbols - str = _ReplaceTextFont.Replace(str, "$1" + ff.Name + "$4"); - } - FontChangeFmt = ff.Name; // B2021-032 - - // To prevent scroll bars from being flashed on/off - // - save an image of the current grid - // - set Visible to false - // - draw the saved grid image - // - do the the load/reload of the grid - // - set Visible back to true. - Visible = false; - if (Parent is GridItem) - { - try - { - System.Drawing.Image img = this.CreateImage(); - using (Graphics gr = (Parent as GridItem).CreateGraphics()) - { - gr.DrawImage(img, Left, Top); - } - } - catch (Exception ex) - { - _MyLog.WarnFormat("Table Content Corrupted"); - } - } - Clear(); - MergedRanges.Clear(); - _ReadingXml = true; - //Console.WriteLine("LoadGrid - Before ReadXML"); - ReadXml(str); - //Console.WriteLine("LoadGrid - After ReadXML"); - _ReadingXml = false; - Select(-1, -1); // this keeps the cell from being selected when the grid is first displayed - Visible = true; - ProfileTimer.Pop(profileDepth); - } - - private void ReadXml(string str) - { - // Get the height/width adjusted for the DPI. Depending on if the DPI setting for the current user's - // monitor is different than the DPI setting saved in the grid record, table height/width of rows/columns - // will be incorrect, i.e. lots of extra white space. The reason behind this is that the height/width - // of table cells are stored as dots (from the monitor) in the underlying component one flexgrid. - try - { - str = AdjustHeightAndWidthForDPI(str); - str = Regex.Replace(str, "&(?![a-z])", "&"); //B2021-142 fix &'s in text screen - so they are considered text instead of xml - using (StringReader sr = new StringReader(str)) - { - ReadXml(sr); - this.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None; - sr.Close(); - } - } - catch - { - ; - } - } - - private string AdjustHeightAndWidthForDPI(string str) - { - // create a graphics to get the DPI and then compare it to the DPI that is stored in the grid. - // if they are the same, we don't need to do anything. - int DPIscreen = 0; - using (Graphics gr = this.CreateGraphics()) - { - DPIscreen = (int)gr.DpiX; - } - XmlDocument xd = new XmlDocument(); - str = Regex.Replace(str, "&(?![a-z])", "&"); //B2021-142 fix &'s in text screen - so they are considered text instead of xml - xd.LoadXml(str); - XmlNode xn = xd.SelectSingleNode("//DPI"); - if (xn != null && xn.InnerText != DPIscreen.ToString()) - { - int DPIgrid = int.Parse(xn.InnerText); - xn.InnerText = DPIscreen.ToString(); - // adjust heights and widths based on the difference in DPIs between that what was saved - // in the database(grid) and the current DPI from the screen. Without doing this the - // heights/widths will be 'off', i.e. lots of white space. - XmlNodeList xnl = xd.SelectNodes("//Height"); - foreach (XmlNode xni in xnl) - { - int measurement = int.Parse(xni.InnerText); - if (measurement != -1) - xni.InnerText = ((measurement * DPIscreen) / DPIgrid).ToString(); - } - xnl = xd.SelectNodes("//Width"); - foreach (XmlNode xni in xnl) - { - int measurement = int.Parse(xni.InnerText); - if (measurement != -1) - xni.InnerText = ((measurement * DPIscreen) / DPIgrid).ToString(); - } - xnl = xd.SelectNodes("//DefaultSize"); - foreach (XmlNode xni in xnl) - { - int measurement = int.Parse(xni.InnerText); - if (measurement != -1) - xni.InnerText = ((measurement * DPIscreen) / DPIgrid).ToString(); - } - str = xd.OuterXml; - } - return str; - } - private void SetupGrid(int numrows, int numcols) //C1FlexGrid NewGrid() - { - // setup the default size of each cell in the table/grid - this.Cols.DefaultSize = (int) DPI; - this.Rows.DefaultSize = 20; - - // setup the number of rows and columns - this.Rows.Count = numrows; - this.Cols.Count = numcols; - - // make all the cell editable - this.Rows.Fixed = 0; - this.Cols.Fixed = 0; - - this.DrawMode = DrawModeEnum.OwnerDraw; - this.ScrollBars = ScrollBars.None; - - // grid styles - this.Styles.EmptyArea.BackColor = Color.Transparent; - this.Styles.EmptyArea.Border.Style = BorderStyleEnum.None; - this.Styles.Normal.Border.Color = Color.Black; - this.Styles.Normal.TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.LeftTop; - - //SetupCellStyles(); - - this.FocusRect = FocusRectEnum.Solid; - this.Styles.Highlight.BackColor = Color.LightCyan; - this.Styles.Highlight.ForeColor = Color.Black; - this.Styles.Focus.BackColor = Color.LightCyan; - this.HighLight = HighLightEnum.WithFocus; - - _DefaultCellBackgroundcolor = this.StyleBackColor; - _DefaultFixedBackgroundColor = this.Styles.Fixed.BackColor; - this.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom; - - this.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Both; - - - _tableCellEditor = new TableCellEditor(this); - _tableCellEditor.HeightChanged += new StepRTBEvent(_tableCellEditor_HeightChanged); - _clpbrdCpyPste = new TableClipBoardFuncts(); - _SpellChecker = _tableCellEditor.SpellCheckerInstance; - - this.AfterResizeRow += new C1.Win.C1FlexGrid.RowColEventHandler(this.Grid_AfterResize); - this.StartEdit += new C1.Win.C1FlexGrid.RowColEventHandler(this._StartEdit); - this.AfterEdit += new C1.Win.C1FlexGrid.RowColEventHandler(this._AfterEdit); - this.AfterScroll += new C1.Win.C1FlexGrid.RangeEventHandler(this._AfterScroll); - this.AfterResizeColumn += new C1.Win.C1FlexGrid.RowColEventHandler(this.Grid_AfterResize); - this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this._KeyPress); - this.OwnerDrawCell += new OwnerDrawCellEventHandler(this.Grid_OwnerDrawCell); - - this.KeyDown += new KeyEventHandler(VlnFlexGrid_KeyDown); - this.KeyUp +=new KeyEventHandler(VlnFlexGrid_KeyUp); - TableCellEditor.EditMode = TableCellEditor.Visible; // need to comment out for compile for only jsj - 07FEB2011 - this.MouseDown += new MouseEventHandler(VlnFlexGrid_MouseDown); - this.MouseUp += VlnFlexGrid_MouseUp; - this.DoubleClick += VlnFlexGrid_DoubleClick; - } - private bool _DoubleClickedCell = false; // C2021-005 need to know if user double-clicked on a cell - private void VlnFlexGrid_DoubleClick(object sender, EventArgs e) - { - // if user did a double click then don't try to get the font size - go directly to editing the table cell text - _DoubleClickedCell = true; - } - - // C2021-005 needed the mouseup event to control the table cell selecting and grabbing of the font size - public bool _GettingFontSize = false; - private void VlnFlexGrid_MouseUp(object sender, MouseEventArgs e) - { - // C2021-005 Get the font size if user didn't double click and on a table - if (!_DoubleClickedCell && Parent != null && Parent is GridItem && Cols.Fixed == 0 && Rows.Fixed == 0) - (Parent as GridItem).MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetFontSizeDropDown(); - } - - private bool _FirstEntry = false; - - public bool FirstEntry - { - get { return _FirstEntry; } - set { _FirstEntry = value; } - } - - void VlnFlexGrid_MouseDown(object sender, MouseEventArgs e) - { - int left = 0; - int top = 0; - int col = 0; - int row = 0; - int strow = Selection.r1; - int stcol = Selection.c1; - int erow = Selection.r2; - int ecol = Selection.c2; - while (e.X > left && col < Cols.Count) - { - left += Cols[col].Width > 0 ? Cols[col].Width : Cols.DefaultSize; - col++; - } - while (e.Y > top && row < Rows.Count) - { - top += Rows[row].Height > 0 ? Rows[row].Height : Rows.DefaultSize; - row++; - } - col--; - row--; - //Console.WriteLine("Mousedown Selection {0}", Selection); - //Console.WriteLine("Mousedown Row, Col [{0},{1}]", row, col); - erow = Math.Max(erow, row); - ecol = Math.Max(ecol, col); - if (_FirstEntry) - Select(row, col); - else - Select(strow, stcol, erow, ecol); - _FirstEntry = false; - } - - void _tableCellEditor_HeightChanged(object sender, EventArgs args) - { - // B2022-028: images in table cells - don't come into this code if it is an image in a table cell: - if (_tableCellEditor is StepRTB && (_tableCellEditor as StepRTB).ImageWidth > 0) return; - - if (_tableCellEditor._initializingEdit || !_tableCellEditor.Visible) return; - int curHeight = GetCellHeight(Row, Col);//(Rows[Row].Height == -1) ? Rows.DefaultSize : Rows[Row].Height; - CellRange cr = GetMergedRange(Row, Col); - int oH = cr.UserData == null ? curHeight : (int)cr.UserData; - int nH = _tableCellEditor.Height; //.ContentsRectangle.Height; - int nW = _tableCellEditor.Width; // Width - int Hadj = (nH - curHeight);//oH); - cr.UserData = _tableCellEditor.Height; //.ContentsRectangle.Height; - //int cellHeight = GetCellHeight(Row, Col); - //int cellheightNLines = cellHeight / (Rows.DefaultSize - 3); - //int nHNLines = nH / (Rows.DefaultSize - 3); - if (Hadj != 0) - { - //if (Hadj > 0 && cellHeight <= oH) - //if (Hadj > 0 && cellheightNLines < nHNLines) - // curHeight += (Rows.DefaultSize - 3); - //if (Hadj < 0 && CanReduceRow()) - // curHeight -= (Rows.DefaultSize - 3); - int blankRowSpace = BlankRowSpace(); - if (Hadj < 0) - Hadj = -Math.Min(-Hadj, blankRowSpace); - //if (Hadj > 0) - // Console.WriteLine("r {0}, nh {1}, curh{2}", Row, nH, curHeight); - if (Hadj != 0) - { - int newHeight = Hadj + ((Rows[Row].Height < 0) ? Rows.DefaultSize : Rows[Row].Height); - //Rows[Row].Height += Hadj;//= curHeight; - Rows[Row].Height = newHeight; - AdjustGridControlSize(); - } - } - } - void VlnFlexGrid_KeyUp(object sender, KeyEventArgs e) - { - if (e.Control) - { - if (e.Alt) - { - switch (e.KeyCode) - { - case Keys.M: - OnOpenAnnotations(this, new EventArgs()); - e.Handled = true; - break; - default: - break; - } - } - } - } - void VlnFlexGrid_KeyDown(object sender, KeyEventArgs e) - { - switch (e.KeyCode) - { - case Keys.Left: - if (e.Shift) return; - _tableCellEditor.StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlLeft : E_ArrowKeys.Left); - e.Handled = true; - break; - case Keys.Up: - if (e.Shift) return; - _tableCellEditor.StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlUp : E_ArrowKeys.Up); - e.Handled = true; - break; - case Keys.Right: - if (e.Shift) return; - if (IsRoTable) Select(Rows.Count - 1, Cols.Count - 1); - _tableCellEditor.StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlRight : E_ArrowKeys.Right); - e.Handled = true; - break; - case Keys.Down: - if (e.Shift) return; - if (IsRoTable) Select(Rows.Count - 1, 0); - _tableCellEditor.StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlDown : E_ArrowKeys.Down); - e.Handled = true; - break; - case Keys.Enter: - if (!e.Control && !e.Shift && !e.Alt) - { - if (MyDVI != null && UserInfo.CanEdit(MyUserInfo,MyDVI)) - OnEnterKeyPressed(sender, e); - else - { - // if a Reviewer, then do a . Don't allow changes to a table - if (IsRoTable) Select(Rows.Count - 1, 0); - _tableCellEditor.StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlDown : E_ArrowKeys.Down); - e.Handled = true; - } - } - break; - } - } - //void VlnFlexGrid_LeaveEdit(object sender, RowColEventArgs e) - //{ - // //Console.WriteLine("LeaveEdit Style = {0}", this.GetCellRange(e.Row, e.Col).Style.Name); - // this.GetCellRange(e.Row, e.Col).Style.ForeColor = Color.Black; - //} - private void Grid_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e) - { - using (RTF _rtf = new RTF()) - { - // use nearest solid color - // (the RTF control doesn't dither, and doesn't support transparent backgrounds) - Color solid = e.Graphics.GetNearestColor(e.Style.BackColor); - DPI = e.Graphics.DpiX; - if (e.Style.BackColor != solid) - e.Style.BackColor = solid; - - // check whether the cell contains RTF - // convert \'99 to \u8482? this is for the trade mark symbol. For some reason RTF is automatically - // converting the unicode \u8482? to \'99, but once this is done, PROMS StepRTB (edit windows) do not show it - // Also convert \~ to a hard spece. Again RTF is automatically converting \u160? to \~ but will then convert - // the \~ to a regular space! - string rtfText = RtfTools.RTFConvertedSymbolsToUnicode(this.GetDataDisplay(e.Row, e.Col));//.Replace(@"\~", @"\u160?").Replace(@"\'99", @"\u8482?"); - GridItem gi = Parent as GridItem; - if (gi != null) - { - DisplayText dt = new DisplayText(gi.MyItemInfo, rtfText, true); - rtfText = dt.StartText; - } - // it does, so draw background - e.DrawCell(DrawCellFlags.Background); - if (rtfText.StartsWith(@"{\rtf")) - { - // Please add a comment if this value needs to be changed - _rtf.Rtf = rtfText; - // draw the RTF text - if (e.Bounds.Width > 0 && e.Bounds.Height > 0) - { - _rtf.Width = e.Bounds.Width - 1; // This has also been -3 which matchs the rener command - CellRange cr = GetMergedRange(e.Row, e.Col); - cr.UserData = _rtf.Height; - int hAdjust = 0; - int hDiff = e.Bounds.Height - _rtf.Height; - if (hDiff < 0) - { - Rows[e.Row].Height = _rtf.Height + 4; - AdjustGridControlSize(); - hDiff = 0; - } - if (e.Style != null) - { - switch (e.Style.TextAlign) - { - case TextAlignEnum.CenterBottom: - case TextAlignEnum.GeneralBottom: - case TextAlignEnum.LeftBottom: - case TextAlignEnum.RightBottom: - hAdjust = hDiff; - break; - case TextAlignEnum.CenterCenter: - case TextAlignEnum.GeneralCenter: - case TextAlignEnum.LeftCenter: - case TextAlignEnum.RightCenter: - hAdjust = hDiff / 2; //0; // hDiff / 2; - break; - default: - break; - } - } - if (IsRoTable) - { - _rtf.ForeColor = Color.Red; - } - else - { - _rtf.ForeColor = e.Style.ForeColor; - } - _rtf.BackColor = e.Style.BackColor; - _rtf.Render(e.Graphics, new Rectangle(e.Bounds.X + 1, e.Bounds.Y + hAdjust, e.Bounds.Width - 3, e.Bounds.Height)); - } - } - else - _rtf.Text = rtfText; - - // spell check unless (we're just measuring) - if (!e.Measuring) - { - CharRangeList errors = SpellChecker.CheckText(_rtf.Text);//(text); - // underline errors - if (errors.Count > 0) - { - CharacterRange[] ranges = new CharacterRange[1]; - ranges[0] = new CharacterRange(0, 1); - Pen pn = new Pen(Color.Green, 2); - StringFormat sf = new StringFormat(e.Style.StringFormat); - sf.SetMeasurableCharacterRanges(ranges); - Rectangle rc = e.Style.GetTextRectangle(e.Bounds, null); - Region[] rgns = e.Graphics.MeasureCharacterRanges(_rtf.Text, e.Style.Font, rc, sf);//(text, e.Style.Font, rc, sf); - float btm = rgns[0].GetBounds(e.Graphics).Bottom; - float top = rgns[0].GetBounds(e.Graphics).Top; - int adj = (int)(btm - top); - for (int i = 0; i < errors.Count; i++) - { - // The positioning of the the squigle line does not account for mixed font sizes - // should we support having mixed fonts in the table cells, we will need to add - // logic to support it. - Point ptStart = _rtf.GetPositionFromCharIndex(errors[i].Start); - Point ptEnd = _rtf.GetPositionFromCharIndex(errors[i].Start + errors[i].Length); - SquigleLine(e.Graphics, e.Bounds.Left + ptStart.X, e.Bounds.Top + ptStart.Y + adj, e.Bounds.Left + ptEnd.X); - } - } - } - // and draw border last - //e.DrawCell(DrawCellFlags.Border); - // This can be used to draw more specific borders - DrawCellBorder(e); - // we're done with this cell - e.Handled = true; - } - } - - private void SquigleLine(Graphics graphics, int x1, int y1, int x2) - { - for (Point pt = new Point(x1, y1); pt.X + 2 < x2; pt.X += 4) - { - //Console.WriteLine("squiggle point {0}", pt); - graphics.DrawLines(Pens.Red, new Point[] - { - new Point(pt.X, pt.Y), - new Point(pt.X + 2, pt.Y - 2), - new Point(pt.X + 4, pt.Y) - }); - } - } - private static Color _BorderColor = Color.Black; - public static Color BorderColor - { - get { return VlnFlexGrid._BorderColor; } - set { VlnFlexGrid._BorderColor = value; } - } - private void DrawCellBorder(C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e) - { - Graphics grGrid =e.Graphics; - Rectangle bounds = e.Bounds; - int row = e.Row; - int col = e.Col; - MyBorders.CheckAndFixBorderArraySize(this.Rows.Count, this.Cols.Count, GridLinePattern.Single); // C2018-031 check the cell border arrays - CellRange cr = GetMergedRange(row, col); - GridLinePattern topSide = MyBorders.HorizontalLines[cr.r1,cr.c1]; - GridLinePattern rightOfTopSide = cr.c2 == Cols.Count - 1 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r1, cr.c2 + 1]; - GridLinePattern leftOfTopSide = cr.c1 == 0? GridLinePattern.None : MyBorders.HorizontalLines[cr.r1, cr.c1 - 1]; - GridLinePattern leftSide = MyBorders.VerticalLines[cr.r1, cr.c1]; - GridLinePattern aboveLeftSide = cr.r1 == 0 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r1 - 1, cr.c1]; - GridLinePattern belowLeftSide = cr.r2 == Rows.Count - 1 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r2 + 1, cr.c1]; - GridLinePattern bottomSide = MyBorders.HorizontalLines[cr.r2+1, cr.c2]; - GridLinePattern rightOfBottomSide = cr.c2 == Cols.Count - 1 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r2 + 1, cr.c2 + 1]; - GridLinePattern rightSide = MyBorders.VerticalLines[cr.r2, cr.c2+1]; - GridLinePattern belowRightSide = cr.r2 == Rows.Count - 1 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r2 + 1, cr.c2 + 1]; - GridLinePattern none = GridLinePattern.None; - int x1 = bounds.Left; - int y1 = bounds.Top; - int x2 = bounds.Right - 1; - int y2 = bounds.Bottom - 1; - GridItem myGridItem = Parent as GridItem; - Panel myPanel = Parent as Panel; - if (myGridItem == null && myPanel == null) return; - if (row == 0 || col == 0) // Top or Left Edge - Draw on parent - { - using (Graphics grParent = myGridItem != null ? myGridItem.CreateGraphics() : myPanel.CreateGraphics()) - { - if (row == 0) - { - if (col == 0) - { - // Draw the top left intersection - DrawIntersection(grParent, Left - 3, Top-1, none, topSide,leftSide, none); - } - // Draw the top right intersection - DrawIntersection(grParent, Left +x2 - 2, Top-1, none, rightOfTopSide,rightSide,topSide); - // Draw the top side on the parent - DrawLine(grParent, topSide, Left + x1, Top + y1 - 1, Left + x2-3, Top + y1 -1); - } - if (col == 0) - { - // Draw the bottom left intersection - DrawIntersection(grParent, Left -3, Top + y2, leftSide,bottomSide,belowLeftSide,none); - // Draw the left side - DrawLine(grParent, leftSide, Left + x1 - 1, Top + y1, Left + x1 - 1, Top + y2-3); - } - } - } - // Draw the bottom right intersection - DrawIntersection(grGrid, x2 - 2, y2, rightSide, rightOfBottomSide, belowRightSide, bottomSide); - // Draw the bottom side - DrawLine(grGrid, bottomSide, x1, y2, x2-3, y2); - // Draw the right side - DrawLine(grGrid, rightSide, x2, y1, x2, y2-3); - } - private static void DrawLine(Graphics gr, GridLinePattern pattern, int x1, int y1, int x2, int y2) - { - if (pattern == GridLinePattern.None) return; - Pen pn = VlnBorders.LinePen(pattern, BorderColor); - DrawLine(gr, pn, pattern, x1, y1, x2, y2); - } - private static void DrawLine(Graphics gr, Pen pn, int x1, int y1, int x2, int y2) - { - DrawLine(gr, pn, GridLinePattern.Single, x1, y1, x2, y2); - } - private static void DrawLine(Graphics gr, Pen pn, GridLinePattern pattern, int x1, int y1, int x2, int y2) - { - int dx = 0; - int dy = 0; - int dblx = 0; - int dbly = 0; - int xThick = 0; - int yThick = 0; - if (x1 == x2) // Vertical Line - { - dx = (int) (-pn.Width / 2); - dblx = -2; - if (pn.Width > 2) - yThick = 1; - } - else // Horizontal Line - { - dy = (int) (-pn.Width / 2); - dbly = -2; - if (pn.Width > 2) - xThick = 1; - } - gr.DrawLine(pn, x1 + dx, y1 + dy, x2 + dx + xThick, y2 + dy + yThick); - if(pattern == GridLinePattern.Double) - gr.DrawLine(pn, x1 + dx +dblx, y1 + dy + dbly, x2 + dx+dblx, y2 + dy+dbly); - } - private static void DrawIntersection(Graphics gr, int x, int y, GridLinePattern up, GridLinePattern right, GridLinePattern down, GridLinePattern left) - { - if (up == GridLinePattern.Double) - if (right == GridLinePattern.Double) - if (down == GridLinePattern.Double) - if (left == GridLinePattern.Double) DrawIntersectionAllDoubles(gr, x, y); - else DrawDrawIntersection3Doubles_URD(gr, x, y); - else // Down is not double - if (left == GridLinePattern.Double) DrawDrawIntersection3Doubles_URL(gr, x, y); - else DrawDrawIntersection2Doubles_UR(gr, x, y, down, left); - else // right is not double - if (down == GridLinePattern.Double) - if (left == GridLinePattern.Double) DrawDrawIntersection3Doubles_UDL(gr, x, y); - else DrawDrawIntersection2Doubles_UD(gr, x, y, right, left); - else // Down is not double - if (left == GridLinePattern.Double) DrawIntersection2Doubles_UL(gr, x, y, right, down); - else DrawIntersectionOneDoubleOrLess(gr, x, y, up, right, down, left); - else - if (right == GridLinePattern.Double) - if (down == GridLinePattern.Double) - if (left == GridLinePattern.Double) DrawDrawIntersection3Doubles_RDL(gr, x, y); - else DrawDrawIntersection2Doubles_RD(gr, x, y, up, left); - else // Down is not double - if (left == GridLinePattern.Double) DrawDrawIntersection2Doubles_RL(gr, x, y, up, down); - else DrawIntersectionOneDoubleOrLess(gr, x, y, up, right, down, left); - else - if (down == GridLinePattern.Double) - if (left == GridLinePattern.Double) DrawDrawIntersection2Doubles_DL(gr, x, y, up, right); - else DrawIntersectionOneDoubleOrLess(gr, x, y, up, right, down, left); - else // These both use the same function with the same parameters - if (left == GridLinePattern.Double) DrawIntersectionOneDoubleOrLess(gr, x, y, up, right, down, left); - else DrawIntersectionOneDoubleOrLess(gr, x, y, up, right, down, left); - } - private static Pen pnDouble = VlnBorders.LinePen(GridLinePattern.Double, BorderColor); - private static Pen pnThick = VlnBorders.LinePen(GridLinePattern.Thick, BorderColor); - private static void DrawIntersectionAllDoubles(Graphics gr, int x, int y) - { - DrawLine(gr, pnDouble, x-1, y, x, y); - DrawLine(gr, pnDouble, x, y - 2, x, y - 3); - DrawLine(gr, pnDouble, x + 2, y - 2, x + 3, y - 2); - DrawLine(gr, pnDouble, x + 2, y, x + 2, y + 1); - } - private static void DrawDrawIntersection3Doubles_URD(Graphics gr, int x, int y) - { - DrawLine(gr, pnDouble, x , y, x, y - 3); - DrawLine(gr, pnDouble, x + 2, y - 2, x + 3, y - 2); - DrawLine(gr, pnDouble, x + 2, y, x + 2, y + 1); - } - private static void DrawDrawIntersection3Doubles_URL(Graphics gr, int x, int y) - { - DrawLine(gr, pnDouble, x, y, x + 2, y); - DrawLine(gr, pnDouble, x -1, y - 2, x , y - 2); - DrawLine(gr, pnDouble, x + 2, y - 2, x + 3, y - 2); - } - private static void DrawDrawIntersection3Doubles_UDL(Graphics gr, int x, int y) - { - DrawLine(gr, pnDouble, x-1, y, x, y); - DrawLine(gr, pnDouble, x , y - 2, x , y - 3); - DrawLine(gr, pnDouble, x + 2, y-3, x + 2, y); - } - private static void DrawDrawIntersection3Doubles_RDL(Graphics gr, int x, int y) - { - DrawLine(gr, pnDouble, x-1, y, x, y); - DrawLine(gr, pnDouble, x, y - 2, x + 2, y - 2); - DrawLine(gr, pnDouble, x + 2, y, x + 2, y + 1); - } - private static void DrawDrawIntersection2Doubles_UR(Graphics gr, int x, int y, GridLinePattern lp1, GridLinePattern lp2) - { - if (lp1 == GridLinePattern.Thick && lp2 == GridLinePattern.Thick) - DrawLine(gr, pnThick, x, y, x + 3, y); - else - { - DrawLine(gr, pnDouble, x, y, x + 2, y); - DrawLine(gr, pnDouble, x , y, x , y - 2); - DrawLine(gr, pnDouble, x + 2, y - 2, x + 3, y - 2); - } - } - private static void DrawDrawIntersection2Doubles_UD(Graphics gr, int x, int y, GridLinePattern lp1, GridLinePattern lp2) - { - if (lp1 == GridLinePattern.Thick && lp2 == GridLinePattern.Thick) - DrawLine(gr, pnThick, x, y, x + 3, y); - else - { - DrawLine(gr, pnDouble, x, y, x, y - 2); - DrawLine(gr, pnDouble, x + 2, y, x + 2, y - 2); - } - } - private static void DrawIntersection2Doubles_UL(Graphics gr, int x, int y, GridLinePattern lp1, GridLinePattern lp2) - { - if (lp1 == GridLinePattern.Thick && lp2 == GridLinePattern.Thick) - DrawLine(gr, pnThick, x, y, x + 3, y); - else - { - DrawLine(gr, pnDouble, x, y, x + 2, y); - DrawLine(gr, pnDouble, x , y - 2, x, y - 3); - DrawLine(gr, pnDouble, x + 2, y, x + 2, y - 2); - } - } - private static void DrawDrawIntersection2Doubles_RD(Graphics gr, int x, int y, GridLinePattern lp1, GridLinePattern lp2) - { - if (lp1 == GridLinePattern.Thick && lp2 == GridLinePattern.Thick) - DrawLine(gr, pnThick, x, y, x + 3, y); - else - { - DrawLine(gr, pnDouble, x, y, x, y - 2); - DrawLine(gr, pnDouble, x, y - 2, x + 2, y - 2); - DrawLine(gr, pnDouble, x + 2, y, x + 2, y + 1); - } - } - private static void DrawDrawIntersection2Doubles_RL(Graphics gr, int x, int y, GridLinePattern lp1, GridLinePattern lp2) - { - if (lp1 == GridLinePattern.Thick && lp2 == GridLinePattern.Thick) - DrawLine(gr, pnThick, x, y, x + 2, y); - else - { - DrawLine(gr, pnDouble, x, y, x + 2, y); - DrawLine(gr, pnDouble, x, y - 2, x + 2, y - 2); - } - } - private static void DrawDrawIntersection2Doubles_DL(Graphics gr, int x, int y, GridLinePattern lp1, GridLinePattern lp2) - { - if (lp1 == GridLinePattern.Thick && lp2 == GridLinePattern.Thick) - DrawLine(gr, pnThick, x, y, x + 2, y); - else - { - DrawLine(gr, pnDouble, x-1, y, x, y); - DrawLine(gr, pnDouble, x, y - 2, x + 2, y - 2); - DrawLine(gr, pnDouble, x + 2, y, x + 2, y - 2); - } - } - private static void DrawIntersectionOneDoubleOrLess(Graphics gr, int x, int y, - GridLinePattern up, GridLinePattern right, GridLinePattern down, GridLinePattern left) - { - Pen pnUp = VlnBorders.LinePen(up, BorderColor); - Pen pnLeft = VlnBorders.LinePen(left, BorderColor); - int widthUpDown = Math.Max(VlnBorders.LineWidth0(up), VlnBorders.LineWidth0(down)); - int heightLeftRight = Math.Max(VlnBorders.LineWidth0(left), VlnBorders.LineWidth0(right)); - if (heightLeftRight > 0 && widthUpDown > 0) - { - Pen pn = new Pen(BorderColor, widthUpDown); - if(heightLeftRight > 1) - DrawLine(gr, pn, x + 2, y + 1 - heightLeftRight, x + 2, y); - else if(up == GridLinePattern.None) // Work around to set a pixel (actually set two) - DrawLine(gr, pn, x + 2, y, x + 2, y + 1); - } - if (left != GridLinePattern.None) - { - DrawLine(gr, pnLeft, x, y, x + 2 - widthUpDown, y); - if (left == GridLinePattern.Double) - DrawLine(gr, pnLeft, x, y - 2, x + 2 - widthUpDown, y - 2); - } - if (up != GridLinePattern.None) - { - DrawLine(gr, pnUp, x + 2, y - 3 , x + 2, y +1 - heightLeftRight); - if (up == GridLinePattern.Double) - DrawLine(gr, pnUp, x, y - 3, x, y +1 - heightLeftRight); - } - } - #endregion //Grid Initialize - #region Grid and Cell Styles - public void ChangeBackgroundColor(string bckgndColor) - { - CellRange cr = this.Selection; - if (!bckgndColor.EndsWith(";")) - bckgndColor+=";"; - string strBckgndColor = string.Format("BackColor:{0}", bckgndColor); - - for (int rw = cr.r1; rw <= cr.r2; rw++) - for (int cl = cr.c1; cl <= cr.c2; cl++) - { - CellRange tmp = this.GetCellRange(rw, cl, rw, cl); - string StyleName = string.Format("R{0}C{1}Style", rw, cl); - CellStyle cs = this.Styles.Add(StyleName, tmp.Style); - cs.ParseString(strBckgndColor); - tmp.Style = cs; - } - } - - public void ToggleCellTextAlignment() - { - // only used in test program - CellRange cr = this.Selection; - using (StepRTB srtb = new StepRTB()) - { - srtb.Rtf = this.GetCellRTFString(cr.r1, cr.c1); - - srtb.SelectAll(); - int align = (int)srtb.SelectionAlignment; - align = (align + 1) % 3; - - srtb.SelectionAlignment = (HorizontalAlignment)align; - this.PutCellRTFString(cr.r1, cr.c1, srtb.Rtf); - } - } - - public void RTFTextAlignment(CellRange cr, HorizontalAlignment ha) - { - using ( StepRTB srtb = new StepRTB()) - { - for (int rw = cr.r1; rw <= cr.r2; rw++) - for (int cl = cr.c1; cl <= cr.c2; cl++) - { - srtb.Rtf = this.GetCellRTFString(rw, cl); - srtb.SelectAll(); - srtb.SelectionAlignment = ha; - this.PutCellRTFString(rw, cl, srtb.Rtf); - } - } - } - - - public void SetTableBorder(C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum border) - { - this.BorderStyle = border; - this.AdjustGridControlSize(); - } - public void ChangeCellAlign(CellRange cr, TextAlignEnum newAlign) - { - //Console.WriteLine("CellRange = {0}, align={1}", cr, newAlign); - for (int rw = cr.r1; rw <= cr.r2; rw++) - for (int col = cr.c1; col <= cr.c2; col++) - { - CellRange tmp = this.GetCellRange(rw, col, rw, col); - string StyleName = string.Format("R{0}C{1}Style", rw, col); - CellStyle cs = null; - if (Styles.Contains(StyleName)) - cs = Styles[StyleName]; - else - cs = this.Styles.Add(StyleName, tmp.Style); - cs.TextAlign = newAlign; - tmp.Style = cs; - } - // If one column and one row, then go into edit mode. - if (cr.r1 == cr.r2 && cr.c1 == cr.c2) - SendKeys.Send("{F2}"); // Toggle Edit Mode with F2 - } - public void ChangeCellBorder(CellRange cr, BorderStyleEnum newBorder) - { - for (int rw = cr.r1; rw <= cr.r2; rw++) - for (int col = cr.c1; col <= cr.c2; col++) - { - CellRange tmp = this.GetCellRange(rw, col, rw, col); - string StyleName = string.Format("R{0}C{1}Style", rw, col); - CellStyle cs = null; - if (Styles.Contains(StyleName)) - cs = Styles[StyleName]; - else - cs = this.Styles.Add(StyleName, tmp.Style); - cs.Border.Style = newBorder; - tmp.Style = cs; - } - } - public void ListStyles() - { - for (int r = 0; r < Rows.Count; r++) - for (int c = 0; c < Cols.Count; c++) - { - CellRange cr = GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) - { - if (cr.Style != null) Console.WriteLine("{0}, {1}, {2}, {3}", r, c, cr.Style.Name, cr.Style.BackColor); - } - } - } - //public void VerticalCenterText() - //{ - // StepRTB myStepRTB = new StepRTB(); - // CellRange selRange = this.Selection; - // for (int r = selRange.r1; r <= selRange.r2; r++) - // for (int c = selRange.c1; c <= selRange.c2; c++) - // { - // CellRange mr = this.GetMergedRange(r, c); - // if (mr.r1 == r) - // { - // int editHeight = (int)mr.UserData; - // int cellHeight = GetCellHeight(mr.r1, mr.c1); - // if (editHeight < cellHeight) - // { - // myStepRTB.Rtf = (string)mr.Data; - // RTBAPI.SetSpaceBefore(myStepRTB, (cellHeight - editHeight) / 2); - // PutCellRTFString(mr.r1, mr.c1, myStepRTB.Rtf); - // } - // } - // } - //} - //public void VerticalTopText() - //{ - // StepRTB myStepRTB = new StepRTB(); - // CellRange selRange = this.Selection; - // for (int r = selRange.r1; r <= selRange.r2; r++) - // for (int c = selRange.c1; c <= selRange.c2; c++) - // { - // CellRange mr = this.GetMergedRange(r, c); - // if (mr.r1 == r) - // { - // myStepRTB.Rtf = (string)mr.Data; - // RTBAPI.SetSpaceBefore(myStepRTB, 0); - // PutCellRTFString(mr.r1, mr.c1, myStepRTB.Rtf); - // } - // } - //} - //public void VerticalBottomText() - //{ - // StepRTB myStepRTB = new StepRTB(); - // CellRange selRange = this.Selection; - // for (int r = selRange.r1; r <= selRange.r2; r++) - // for (int c = selRange.c1; c <= selRange.c2; c++) - // { - // CellRange mr = this.GetMergedRange(r, c); - // if (mr.r1 == r) - // { - // int editHeight = (int)mr.UserData; - // int cellHeight = GetCellHeight(mr.r1, mr.c1); - // if (editHeight < cellHeight) - // { - // myStepRTB.Rtf = (string)mr.Data; - // RTBAPI.SetSpaceBefore(myStepRTB, (cellHeight - editHeight)); - // PutCellRTFString(mr.r1, mr.c1, myStepRTB.Rtf); - // } - // } - // } - //} - - //public void SetupCellStyles() - //{ - // //CellStyle cs; - - // //cs = this.Styles.Add("Dotted"); - // //cs.Border.Style = BorderStyleEnum.Dotted; - // //cs = this.Styles.Add("Double"); - // //cs.Border.Style = BorderStyleEnum.Double; - // //cs = this.Styles.Add("Fillet"); - // //cs.Border.Style = BorderStyleEnum.Fillet; - // //cs = this.Styles.Add("Flat"); - // //cs.Border.Style = BorderStyleEnum.Flat; - // //cs = this.Styles.Add("Groove"); - // //cs.Border.Style = BorderStyleEnum.Groove; - // //cs = this.Styles.Add("Inset"); - // //cs.Border.Style = BorderStyleEnum.Inset; - // //cs = this.Styles.Add("None"); - // //cs.Border.Style = BorderStyleEnum.None; - // //cs = this.Styles.Add("Raised"); - // //cs.Border.Style = BorderStyleEnum.Raised; - // //cs = this.Styles.Add("CenterRight"); - // //cs.TextAlign = TextAlignEnum.RightCenter; //.LeftCenter; // this is being ignored - probably due to RTF conversion - // //cs = this.Styles.Add("Yellow"); - // //cs.BackColor = Color.Yellow; - // //cs = this.Styles.Add("Margins"); - // //cs.Margins.Bottom = 5; - // //cs.Margins.Top = 10; - // //cs.Margins.Left = 15; - // //cs.Margins.Right = 20; - //} - #endregion //Grid and Cell Styles - - #region Grid Size Adjustments - - /// - /// Adjust the grid control size based on the cell sizes. - /// - public void AdjustGridControlSize() - { - if (Parent is GridItem ? (Parent as GridItem).Initializing : false ) return; - int difW = this.Width - this.ClientSize.Width; - int difH = this.Height - this.ClientSize.Height; - int wid = 0; - if (this != null) - { - foreach (C1.Win.C1FlexGrid.Column col in this.Cols) - wid += (col.Width >= 0) ? col.Width : this.Cols.DefaultSize; - - int height = 0; - foreach (C1.Win.C1FlexGrid.Row row in this.Rows) - //height += (row.Height >= 0) ? row.Height : this.Rows.DefaultSize + 2; - height += (row.Height >= 0) ? row.Height : this.Rows.DefaultSize; - - this.Size = new Size(wid + difW, height + difH); - } - } - // B2019-162 Allow grids to not automatically adjust the cell widths - public void ConvertTextCellToRTF(int r, int c, bool adjustWidth) - { - using (StepRTB trtb = new StepRTB()) - { - string tstr = null; - bool dummyCharWidth = false; - bool AllowWidthShrink = false; - trtb.SetTableGridCellRTFPrefix(this.Font); - trtb.Clear(); - tstr = (string)this[r, c]; - trtb.Font = this.Font; - if (tstr != null && tstr.Length > 0) - { - string tsave = tstr; - // regular text has special characters to toggle Bold, Underline, and Italics - // we need to subtract the width of these characters (allow column/row to shrink) - //AllowWidthShrink = RemoveBoldUlineItalicChars(trtb.Rtf); - AllowWidthShrink = tstr.Contains("#Link:"); - // this will convert the special characters for Bold, Underline, and Italics - // into RTF commands - //trtb.Rtf = trtb.RtfPrefix + ConvertTableText(trtb.Rtf) + "}"; - //string fromRTF = trtb.Rtf; - //string prefix = trtb.RtfPrefix; - //if (tstr.Contains("#Link:")) prefix += @"{\colortbl ;\red255\green0\blue0;}"; - //if (tstr.Contains("#Link:")) - // Console.WriteLine("here"); - //string jText = trtb.RtfPrefix + ConvertTableText(tstr) + @"\par}"; - //trtb.Rtf = jText; - trtb.Rtf = trtb.RtfPrefix + ConvertTableText(tstr) + @"\par}"; - //string fromStr = trtb.Rtf; - //if (fromRTF.Contains("SimSun")) - // Console.WriteLine("SimSun"); - //else - // Compare(fromRTF, fromStr, tsave); - } - else - { - trtb.Text = "X"; // this is to trick steprtf in giving a char width to fit one character - // note that a space character was too small. - dummyCharWidth = true; - } - // find the needed cell width - trtb.AdjustWidthForContent(); - - // B2019-162 Allow grids to not automatically adjust the cell widths - if(adjustWidth)trtb.AdjustWidthForContent(); - if (dummyCharWidth) - { - trtb.Text = ""; // clear out the dummy character before saving - dummyCharWidth = false; - } - - this[r, c] = trtb.Rtf; // save the cleaned up and processed cell text as RTF - this.Select(r, c, false); - CellRange sel = this.Selection; - //sel.UserData = trtb.ContentsRectangle.Height; - - // Now adjust the Height and Width in the defined merge ranges - // B2019-162 Allow grids to not automatically adjust the cell widths - AdjustMergeRangeHeightWidth(r, c, trtb, tstr, AllowWidthShrink,adjustWidth); - //// Now see the the selected row,col is in the defined merge ranges - //bool mrgrows = false; - //bool mrgcols = false; - //foreach (CellRange cr in this.MergedRanges) - //{ - // if (cr.Contains(r, c)) - // { - // if (cr.c1 != cr.c2) - // mrgcols = true; // in a range of merged columns - // if (cr.r1 != cr.r2) - // mrgrows = true; // in a range of merged rows - // continue; - // } - //} - //if (!mrgcols || !mrgrows) - //{ - // // IF the row of the selected cell is NOT in merged range - // // then go ahead and adjust the row height (if needed) - // if (!mrgrows) - // { - // // add adjustment for grid and cell borders - // int newheight = trtb.Height + 3; - - // //Console.WriteLine("{0} {1} {2} '{3}'", r, c, newheight,trtb.Text); - // if (newheight > this.Rows[r].Height) - // { - // //Console.WriteLine("1 Row {0} Old Height = {1}, New Height = {2}", r, Rows[r].Height, newheight); - // this.Rows[r].Height = newheight; - // } - // } - // // IF the column of the selected cell is NOT in merged range - // // then go ahead and adjust the column width (if needed) - // if (!mrgcols) - // { - // // add adjustment for grid and cell borders - // int newwidth = trtb.Width + 2; - - // if (newwidth > this.Cols[c].Width || AllowWidthShrink || r == 0) - // this.Cols[c].Width = newwidth; - // } - //} - //if (mrgrows && tstr != null) - //{ - // CellRange cr = GetMergedRange(r, c); - // //Console.WriteLine("grid[{0},{1}] merge = {2}", r, c,cr); - // if (cr.r1 == r && cr.c1 == c) - // { - // // if in merged rows, then make sure the cell's height is large enough - // string[] strary = tstr.Split("\n".ToCharArray()); - // // count number of lines of text - // int nlines = strary.Length; - // // count number of rows in merge range - // int nrows = (cr.r2 - cr.r1) + 1; - // //Console.WriteLine("2 Row {0} Height = {1}", cr.r1, Rows[cr.r1].Height); - // while (nlines > nrows) - // { - // // add length to first row in merged range - // int h = this.Rows[cr.r1].Height; - // int defH = Rows.DefaultSize - 3; - // //h = (h == -1) ? _minRowHeight * 2 : h + _minRowHeight; - // h = (h == -1) ? (defH * 2) + 3 : h + defH; - // //h = (h == -1) ? (Rows.DefaultSize + 2) * 2 : h + Rows.DefaultSize + 2; - // //Console.WriteLine("3 Row {0} Old Height = {1}, New Height = {2}", cr.r1, Rows[cr.r1].Height, h); - // this.Rows[cr.r1].Height = h; - // nrows++; - // } - // } - //} - } - } - //private void AdjustCellHeightWidth(int r, int c) - //{ - // using (StepRTB trtb = new StepRTB()) - // { - // string tstr = null; - // bool dummyCharWidth = false; - // bool AllowWidthShrink = false; - // trtb.SetTableGridCellRTFPrefix(this.Font); - // trtb.Clear(); - // trtb.Font = this.Font; - // trtb.Rtf = (string)this[r, c]; - // tstr = trtb.Text; - // if (tstr != null && tstr.Length > 0) - // AllowWidthShrink = tstr.Contains("#Link:"); - // else - // { - // trtb.Text = "X"; // this is to trick steprtf in giving a char width to fit one character - // // note that a space character was too small. - // dummyCharWidth = true; - // } - // // find the needed cell width - // trtb.AdjustWidthForContent(); - // if (dummyCharWidth) - // { - // trtb.Text = ""; // clear out the dummy character before saving - // dummyCharWidth = false; - // } - - - // // Now adjust the Height and Width in the defined merge ranges - // AdjustMergeRangeHeightWidth(r, c, trtb, tstr, AllowWidthShrink,true); - // } - //} - - // B2019-162 Allow grids to not automatically adjust the cell widths - private void AdjustMergeRangeHeightWidth(int r, int c, StepRTB trtb, string tstr, bool AllowWidthShrink, bool adjustWidth) - { - bool mrgrows = false; - bool mrgcols = false; - foreach (CellRange cr in this.MergedRanges) - { - if (cr.Contains(r, c)) - { - if (cr.c1 != cr.c2) - mrgcols = true; // in a range of merged columns - if (cr.r1 != cr.r2) - mrgrows = true; // in a range of merged rows - continue; - } - } - if (!mrgcols || !mrgrows) - { - // IF the row of the selected cell is NOT in merged range - // then go ahead and adjust the row height (if needed) - if (!mrgrows) - { - // add adjustment for grid and cell borders - int newheight = trtb.Height + 3; - - //Console.WriteLine("{0} {1} {2} '{3}'", r, c, newheight,trtb.Text); - if (newheight > this.Rows[r].Height) - { - //Console.WriteLine("1 Row {0} Old Height = {1}, New Height = {2}", r, Rows[r].Height, newheight); - this.Rows[r].Height = newheight; - } - } - // IF the column of the selected cell is NOT in merged range - // then go ahead and adjust the column width (if needed) - if (!mrgcols) - { - // add adjustment for grid and cell borders - // B2019-162 Allow grids to not automatically adjust the cell widths - if (adjustWidth) - { - int newwidth = trtb.Width + 3; // 2; - if (newwidth > (this.Cols[c].Width == -1 ? this.Cols.DefaultSize : this.Cols[c].Width) || AllowWidthShrink || r == 0) - this.Cols[c].Width = newwidth; - } - } - } - if (mrgrows && tstr != null) - { - CellRange cr = GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) - { - // if in merged rows, then make sure the cell's height is large enough - string[] strary = tstr.Split("\n".ToCharArray()); - // count number of lines of text - int nlines = strary.Length; - // count number of rows in merge range - int nrows = (cr.r2 - cr.r1) + 1; - //Console.WriteLine("2 Row {0} Height = {1}", cr.r1, Rows[cr.r1].Height); - while (nlines > nrows) - { - // add length to first row in merged range - int h = this.Rows[cr.r1].Height; - int defH = Rows.DefaultSize - 3; - h = (h == -1) ? (defH * 2) + 3 : h + defH; - this.Rows[cr.r1].Height = h; - nrows++; - } - } - } - } - private int TotalColWidths() - { - int cwid = 0; - foreach (Column c in Cols) - { - cwid += ((c.Width > 0) ? c.Width : Cols.DefaultSize); - } - return cwid; - } - /// - /// This will adjust the column widths of the current table based upon the page width - /// Note: This is for use in creating a new table - not to process an existing table. - /// - /// - public void FitTableToPageWidth(int pgWidthPoints) - { - int grdWidth = TotalColWidths(); - int pgwidth = (int)((pgWidthPoints / 72) * this._DPI); - - if (grdWidth > pgwidth) - { - int difWid = grdWidth - pgwidth; - int colAdj = (difWid / Cols.Count) +(((difWid % Cols.Count) > 0) ? 1 : 0); - foreach (Column c in Cols) - { - int cwid = (c.Width > 0) ? c.Width : Cols.DefaultSize; - if ((cwid - colAdj) > 0) - c.Width = cwid - colAdj; - } - } - } - //private void AdjustCellHeightWidth(int r, int c) - //{ - // StepRTB trtb = new StepRTB(); - // string tstr = null; - // bool dummyCharWidth = false; - // bool AllowWidthShrink = false; - // trtb.SetTableGridCellRTFPrefix(this.Font); - // trtb.Clear(); - // trtb.Font = this.Font; - // trtb.Rtf = (string)this[r, c]; - // tstr = trtb.Text; - // if (tstr != null && tstr.Length > 0) - // AllowWidthShrink = tstr.Contains("#Link:"); - // else - // { - // trtb.Text = "X"; // this is to trick steprtf in giving a char width to fit one character - // // note that a space character was too small. - // dummyCharWidth = true; - // } - // // find the needed cell width - // trtb.AdjustWidthForContent(); - - // if (dummyCharWidth) - // { - // trtb.Text = ""; // clear out the dummy character before saving - // dummyCharWidth = false; - // } - - // this.Select(r, c, false); - // CellRange sel = this.Selection; - - // // Now see the the selected row,col is in the defined merge ranges - // bool mrgrows = false; - // bool mrgcols = false; - // foreach (CellRange cr in this.MergedRanges) - // { - // if (cr.Contains(r, c)) - // { - // if (cr.c1 != cr.c2) - // mrgcols = true; // in a range of merged columns - // if (cr.r1 != cr.r2) - // mrgrows = true; // in a range of merged rows - // continue; - // } - // } - // if (!mrgcols || !mrgrows) - // { - // // IF the row of the selected cell is NOT in merged range - // // then go ahead and adjust the row height (if needed) - // if (!mrgrows) - // { - // // add adjustment for grid and cell borders - // int newheight = trtb.Height + 3; - - // //Console.WriteLine("{0} {1} {2} '{3}'", r, c, newheight,trtb.Text); - // if (newheight > this.Rows[r].Height) - // { - // //Console.WriteLine("1 Row {0} Old Height = {1}, New Height = {2}", r, Rows[r].Height, newheight); - // this.Rows[r].Height = newheight; - // } - // } - // // IF the column of the selected cell is NOT in merged range - // // then go ahead and adjust the column width (if needed) - // if (!mrgcols) - // { - // // add adjustment for grid and cell borders - // int newwidth = trtb.Width + 2; - - // if (newwidth > this.Cols[c].Width || AllowWidthShrink || r == 0) - // this.Cols[c].Width = newwidth; - // } - // } - // if (mrgrows && tstr != null) - // { - // CellRange cr = GetMergedRange(r, c); - // if (cr.r1 == r && cr.c1 == c) - // { - // // if in merged rows, then make sure the cell's height is large enough - // string[] strary = tstr.Split("\n".ToCharArray()); - // // count number of lines of text - // int nlines = strary.Length; - // // count number of rows in merge range - // int nrows = (cr.r2 - cr.r1) + 1; - // //Console.WriteLine("2 Row {0} Height = {1}", cr.r1, Rows[cr.r1].Height); - // while (nlines > nrows) - // { - // // add length to first row in merged range - // int h = this.Rows[cr.r1].Height; - // int defH = Rows.DefaultSize - 3; - // h = (h == -1) ? (defH * 2) + 3 : h + defH; - // this.Rows[cr.r1].Height = h; - // nrows++; - // } - // } - // } - //} - - //private void Compare(string fromRTF, string fromStr, string rawstr) - //{ - // int istart = fromRTF.IndexOf(" ",fromRTF.IndexOf("viewkind")); - // int jstart = fromStr.IndexOf(" ",fromStr.IndexOf("viewkind")); - // for (int i = istart; i < fromRTF.Length; i++) - // { - // int j = i - istart + jstart; - // //else if (fromRTF[i] != fromStr[j]) - // if (fromRTF[i] != fromStr[j]) - // { - // if (fromRTF.Substring(i, 1) == @"~" && fromStr.Substring(j, 3) == @"'a0") - // { - // //i++; - // jstart += 2; - // } - // else - // { - // Console.WriteLine("fromStr:\r\n'{0}'\r\nfromRTF:\r\n'{1}'", fromStr, fromRTF); - // ShowRawString(rawstr, "rawstr"); - // Console.WriteLine("Str:'{0}' , RTF:'{1}'", fromStr.Substring(j, Math.Min(10,fromStr.Length-j-1)), fromRTF.Substring(i, Math.Min(10,fromRTF.Length-i-1))); - // return; - // } - // } - // } - //} - - #region DEBUG - //private void ShowRawString(string str, string title) - //{ - // Console.WriteLine("Raw Start --{0}:\n", title); - // foreach (char c in str) - // { - // int ic= (int)c; - // if (c!='\n'&&( ic > 126 || ic < 32)) - // Console.Write("<<{0:x4}>>", ic); - // else - // Console.Write(c); - // } - // Console.WriteLine("\n-- Raw End:{0}", title); - //} - #endregion - - private void Grid_AfterResize(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) - { - this.AdjustGridControlSize(); - } - - #endregion // Grid Size Adjustments - - #region Cell Text - // B2019-162 Allow grids to not automatically adjust the cell widths - public void MakeRTFcells() - { - MakeRTFcells(true); - } - // B2019-162 Allow grids to not automatically adjust the cell widths - public void MakeRTFcells(bool adjustwidth) - { - // This will spin through all the cells in the grid: - // - convert the text to RTF if needed - // - adjust the grid dimensions based on the cell info. - for (int r = 0; r < this.Rows.Count; r++) - { - this.Rows[r].Height = Rows.DefaultSize;//_minRowHeight;//20;//10; - for (int c = 0; c < this.Cols.Count; c++) - { - // B2019-162 Allow grids to not automatically adjust the cell widths - this.ConvertTextCellToRTF(r, c, adjustwidth); - } - } - // B2019-162 Allow grids to not automatically adjust the cell widths - if(adjustwidth) TrimColumnWidths(); - RemoveBlankSpaceFromRows(); - SetupCellUserData(); - this.AdjustGridControlSize(); - } - - public void FixTableCellsHeightWidth() - { - RemoveBlankSpaceFromColumns(); - RemoveBlankSpaceFromRows(); - } - - private void RemoveBlankSpaceFromRows() - { - for (int r = 0; r < Rows.Count; r++) - { - Select(r, 0); - int blankRowSpace = BlankRowSpace(); - if (blankRowSpace > 0) - Rows[r].Height -= blankRowSpace; - } - } - - private void RemoveBlankSpaceFromColumns() - { - for (int c = 0; c < Cols.Count; c++) - { - Select(0, c); - int blankColSpace = BlankColSpace(); - if (blankColSpace > 0) - Cols[c].Width -= blankColSpace; - } - } - - private void TrimColumnWidths() - { - for (int c = 0; c < Cols.Count; c++) - { - Select(0, c); - int newColWidth = MinColWidth(); - Cols[c].Width = newColWidth; - } - } - - private int MinColWidth() - { - int curColWidth = 0; - for (int r = 0; r < Rows.Count; r++) - { - CellRange cr = GetMergedRange(r, Col); - // find the needed cell width - if (Col == cr.c1) - { - using (StepRTB srtb = new StepRTB()) - { - srtb.Rtf = GetCellRTFString(cr.r1, cr.c1); - srtb.AdjustWidthForContent(); - curColWidth = Math.Max(curColWidth, srtb.Width + 3); - } - } - } - return curColWidth; - } - - //private bool RemoveBoldUlineItalicChars(string str) - //{ - // int rtn = 0; - - // // Underline next word - // rtn += str.IndexOf(@"\'17"); - - // // Bold next word - // rtn += str.IndexOf(@"\'13"); - - // // Italics On - // rtn += str.IndexOf(@"\'1B4"); - - // // Italics Off - // rtn += str.IndexOf(@"\'1B5"); - - // // underline On - // rtn += str.IndexOf(@"\'ab"); - // // underline Off - // rtn += str.IndexOf(@"\'bb"); - - // return rtn > 0; - - //} - - private string ConvertTableText(string str) - { - string rtn = str; - string pattern = @"\\u([0-9]{1,4})\?"; - - string mValue, mValue2 = ""; - foreach (Match match in Regex.Matches(rtn, pattern, RegexOptions.IgnoreCase)) - { - mValue = match.Value; - mValue2 = $"\\f1 {mValue}\\f0"; - rtn = rtn.Replace(match.Value, mValue2); - } - - - //ShowRawString(str, "ConvertTableText IN"); - rtn = rtn.Replace(@"START]\v0", @"START]\cf1\v0"); - rtn = rtn.Replace(@"\v #Link:", @"\cf0\v #Link:"); - rtn = rtn.Replace("\n", "\\par\r\n"); - rtn = rtn.Replace("\xB3", @"\f1\u9474?\f0"); // Vert Bar - rtn = rtn.Replace("\xF2", @"\f1\u8805?\f0 "); // greater than or equal - rtn = rtn.Replace("\x7F", @"\f1\u916?\f0 "); // delta - rtn = rtn.Replace("\xF3", @"\f1\u8804?\f0 "); // less than or equal - rtn = rtn.Replace("\xE4", @"\f1\u931?\f0 "); // sigma - rtn = rtn.Replace("\xE7", @"\f1\u947?\f0 "); // gamma - rtn = rtn.Replace("\xFE", @"\f1\u9604?\f0 "); // accum 2584 - rtn = rtn.Replace("\x7", @"\f1\u9679?\f0 "); // bullet 25CF - rtn = rtn.Replace("\xF7", @"\f1\u8776?\f0 "); // approx eq - rtn = rtn.Replace("\xF0", @"\f1\u8773?\f0 "); // similar eq 2245 - rtn = rtn.Replace("\xFB", @"\f1\u8730?\f0 "); // square root - rtn = rtn.Replace("\xE2", @"\f1\u961?\f0 "); // rho 3C1 - rtn = rtn.Replace("\xE3", @"\f1\u960?\f0 "); // pi - rtn = rtn.Replace("\xE6", @"\f1\u956?\f0 "); // micro - rtn = rtn.Replace("\xEB", @"\f1\u948?\f0 "); // lower case delta - rtn = rtn.Replace("\xE5", @"\f1\u963?\f0 "); // lower case sigma - rtn = rtn.Replace("\x90", @"\f1\u274?\f0 "); // energy, 112 - rtn = rtn.Replace("\xEE", @"\f1\u949?\f0 "); // epsilon - rtn = rtn.Replace("\xE9", @"\f1\u952?\f0 "); // theta, 3B8 - rtn = rtn.Replace("\xEC", @"\f1\u8857?\f0 "); // dot in oval, 2299 - rtn = rtn.Replace("\xA8", @"\f1\u964?\f0 "); // tau, 3C4 - rtn = rtn.Replace("\xA9", @"\f1\u9830?\f0 "); // diamond, 2666 - rtn = rtn.Replace("\x18", @"\f1\u8593?\f0 "); // Up Arrow - rtn = rtn.Replace("\x19", @"\f1\u8595?\f0 "); // Down Arrow - rtn = rtn.Replace("\xFF", @"\u160?"); // hardspace - //rtn = rtn.Replace(@"\'a0", @"\u160?"); - //rtn = rtn.Replace("\xff", @"\u160?"); - //rtn = rtn.Replace("\xA0", @"\u160?"); - // underline On - rtn = rtn.Replace("\xab", @"\ul"); - // underline Off - rtn = rtn.Replace("\xbb", @"\ulnone"); - //rtn = rtn.Replace("\xef\xe6", @"\up2 "); - //rtn = rtn.Replace("\xef\xe7", @"\up0 "); - rtn = rtn.Replace("\x9566", @"\up2 "); - rtn = rtn.Replace("\x9567", @"\up0 "); - rtn = rtn.Replace("{", @"\{"); - rtn = rtn.Replace("}", @"\}"); - rtn = rtn.Replace("\xd5", @"\b"); - rtn = rtn.Replace("\xd6", @"\b0"); - - //ShowRawString(rtn, "ConvertTableText OUT"); - return rtn; - } - - private static string SomethingNextWord(string str, string nxtwordcmd, string cmdOn, string cmdOff) - { - string rtn = ""; - int bidx = 0; - int fidx = str.IndexOf(nxtwordcmd, bidx); - char[] term = " \r\n\x02".ToCharArray(); - while (fidx > 0) - { - rtn += str.Substring(bidx, fidx - bidx) + cmdOn; - bidx = fidx + 4; - - if (bidx < str.Length) - { - fidx = str.IndexOfAny(term, bidx); - if (fidx > 0) - { - rtn += str.Substring(bidx, fidx - bidx) + cmdOff + str.Substring(fidx, 1); - bidx = fidx + 1; - } - } - - if (bidx < str.Length) - fidx = str.IndexOf(nxtwordcmd, bidx); - else - fidx = -1; - } - if (bidx < str.Length) - rtn += str.Substring(bidx); - - return rtn; - } - - private void _StartEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) - { - // start editing the cell with the custom editor - if(!IsRoTable ) - _tableCellEditor.StartEditing(e.Row, e.Col, _GettingFontSize); // C2021-005 added _GettingFontSize to prevent showing the editor - e.Cancel = true; - } - - // after edit handler (built-in editors) - private void _AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) - { - this.GetCellRange(e.Row, e.Col).Style.ForeColor = Color.Black; - this.AdjustGridControlSize(); - GC.Collect(GC.GetGeneration(this)); // there is a memory leak in Regex this fixes it. (called in StepRTB.cs FindLinks) - } - - // if the custom editor is visible, make it follow the cell being edited - private void _AfterScroll(object sender, C1.Win.C1FlexGrid.RangeEventArgs e) - { - this._tableCellEditor.UpdatePosition(); - } - - // save last key pressed for the custom editor - private void _KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) - { - this._tableCellEditor.SetPendingKey(e.KeyChar); - } - - public string GetCellRTFString(int row, int col) - { - string rtnstr = ""; - foreach (CellRange r in this.MergedRanges) - { - if (r.ContainsRow(row) && r.ContainsCol(col)) - { - rtnstr = (string)this[r.r1, r.c1]; - return rtnstr; - } - } - rtnstr = (string)this[row, col]; - return rtnstr; - } - - public void PutCellRTFString(int row, int col, string str) - { - foreach (CellRange r in this.MergedRanges) - { - if (r.ContainsRow(row) && r.ContainsCol(col)) - { - this[r.r1, r.c1] = str; - return; - } - } - this[row, col] = str; - return; - } - public void ClearSelectedCellText() - { - CellRange cr = this.Selection; - cr.Clear(ClearFlags.Content); - } - public void SetupCellUserData() - { - for (int r = 0; r < Rows.Count; r++) - for (int c = 0; c < Cols.Count; c++) - { - string rtfText = GetDataDisplay(r, c); - if (rtfText.StartsWith(@"{\rtf")) - { - using (StepRTB _rtf = new StepRTB()) - { - _rtf.Width = Cols[c].Width; - _rtf.Rtf = rtfText; - CellRange cr = GetCellRange(r, c); - cr.UserData = _rtf.ContentsRectangle.Height; - } - } - } - } - - #endregion //Cell Text - - #region Merged / Split Range - - public void MergeSelection() - { - this.MergedRanges.Add(this.Selection,true); - this.Invalidate(); - this.Select(Selection.r1, Selection.c1); - } - public bool IsInMergeRange() - { - C1.Win.C1FlexGrid.CellRange sel = GetMergedRange(this.Selection.r1, this.Selection.c1); - return MergedRanges.Contains(sel); - } - public void SplitSelection(bool bSplitCols) - { - //Console.WriteLine("SplitSelection this.selection {0}", this.Selection); - //Debug_WritelineMySelection(); - //C1.Win.C1FlexGrid.CellRange sel = this.GetMergedRange(this.Selection.r1, this.Selection.c1); - //Console.WriteLine("SplitSelection myselection {0}", MySelection); - //foreach (CellRange sel in MySelection) - //{ - // //Console.WriteLine("SplitSelection foreach sel {0}", sel); - // if (sel.IsSingleCell) - // this.MergedRanges.Remove(sel); - // if (!(this.MergedRanges.Contains(sel)) && !didit) - // if (bSplitCols) - // SplitSelectionColumns(); - // else - // SplitSelectionRows(); - // didit = true; - //} - if (bSplitCols) - SplitSelectionColumns(); - else - SplitSelectionRows(); - //Debug_WritelineMySelection(); - //foreach (CellRange sel in MySelection) - //{ - // //Console.WriteLine("SplitSelection foreach sel {0}", sel); - // if (this.MergedRanges.Contains(sel)) - // SplitMergedRange(sel, bSplitCols); - //} - //this.Refresh(); - //RefreshMergeRangeCollection(); - this.AdjustGridControlSize(); - } - - private void SplitMergedRange(CellRange sel, bool bSplitCols) - { - int sR = sel.r1; - int eR = sel.r2; - int sC = sel.c1; - int eC = sel.c2; - if (bSplitCols && (IsMergedCols(sel) && !IsMergedRows(sel)) || - (!bSplitCols && (IsMergedRows(sel) && !IsMergedCols(sel)))) - MergedRanges.Remove(sel); - else - { - CellRange saveSelection = Selection; - if (bSplitCols && IsMergedRows(sel)) - { - MergedRanges.Remove(sel); - for (int c = sC; c <= eC; c++) - { - Select(sR, c, eR, c); - MergeSelection(); - } - } - else if (!bSplitCols && IsMergedCols(sel)) - { - MergedRanges.Remove(sel); - for (int r = sR; r <= eR; r++) - { - Select(r, sC, r, eC); - MergeSelection(); - } - } - Select(saveSelection); - } - } - private bool IsMergedRows(CellRange sel) - { - return (sel.r1 != sel.r2); - } - private bool IsMergedCols(CellRange sel) - { - return (sel.c1 != sel.c2); - } - private void SplitSelectionColumns() - { - bool hasNonMergedColumn = false; - //Console.WriteLine("SplitSelectionColumns this.selection {0}", this.Selection); - //Debug_WritelineMySelection(); - CellRange cr = this.Selection; - int numSelCols = (cr.c2 - cr.c1) + 1; - foreach (CellRange sel in MySelection) - { - if (!this.MergedRanges.Contains(sel)) - hasNonMergedColumn = true; - else - { - CellRange mr = GetMergedRange(sel.r1, sel.c1); - if (mr.c1 == mr.c2) - hasNonMergedColumn = true; - } - } - // for each column in the selection, add a new column - if (hasNonMergedColumn) - { - for (int c = cr.c2; c >= cr.c1; c--) - { - Select(cr.r1, c, cr.r2, c); - InsertColumnAfter(); - } - } - // include new columns in selection - this.Select(cr.r1, cr.c1, cr.r2, cr.c2 + ((hasNonMergedColumn) ? numSelCols : 0)); - //if a merged range is part of the selectin, try to split it - foreach (CellRange sel in MySelection) - { - //Console.WriteLine("SplitSelection foreach sel {0}", sel); - if (this.MergedRanges.Contains(sel)) - SplitMergedRange(sel, true); - } - cr = this.Selection; - if (hasNonMergedColumn) - { - for (int r = 0; r < this.Rows.Count; r++) - for (int c = cr.c1; c <= cr.c2; c += 2) - { - if (!this.IsCellSelected(r, c)) - { - CellRange crTmp = GetMergedRange(r, c); - if (crTmp.IsSingleCell) - { - CellRange tcr = this.GetCellRange(r, c, r, c + 1); - this.MergedRanges.Add(tcr); - this.Invalidate(); - } - //CellRange tcr = this.GetCellRange(r, c, r, c + 1); - //this.MergedRanges.Add(tcr); - } - } - // Adjust selected column widths - for (int c = cr.c1; c <= cr.c2; c++) - { - int recWidth = (Cols[c].Width < 0) ? Cols.DefaultSize : Cols[c].Width; // this.GetCellRect(cr.r1, c).Width; - int newWidth = Math.Max(recWidth / 2, _minColSplitWidth); - this.Cols[c].Width = newWidth; - //Console.WriteLine("Cell[{0},{1}].Width = {2}", cr.r1, c, recWidth); - //Console.WriteLine("Cell[{0},{1}].NewWidth = {2}", cr.r1, c, newWidth); - } - } - } - - private void SplitSelectionRows() - { - bool hasNonMergedRow = false; - CellRange cr = this.Selection; - int numSelRows = (cr.r2 - cr.r1) + 1; - //Console.WriteLine("numSelRows = {0}", numSelRows); - //Console.WriteLine("Inital Selection [{0},{1}] - [{2},{3}]", cr.r1, cr.c1, cr.r2, cr.c2); - foreach (CellRange sel in MySelection) - { - if (!this.MergedRanges.Contains(sel)) - hasNonMergedRow = true; - else - { - CellRange mr = GetMergedRange(sel.r1, sel.c1); - if (mr.r1 == mr.r2) - hasNonMergedRow = true; - } - } - // for each row in the selection, add a new row - if (hasNonMergedRow) - { - for (int r = cr.r2; r >= cr.r1; r--) - { - //Console.WriteLine("Inserted new Row at [{0},{1}]", r, cr.c1); - Select(r, cr.c1, r, cr.c2); - InsertRowAfter(); - } - // B2017-197 move the Select inside if (hasNonMergedRow) - // was getting a selection out of range error when spliting rows that contained mergered rows - // only need to do this if we inserted rows - // include new rows in selection - this.Select(cr.r1, cr.c1, cr.r2 + numSelRows, cr.c2); - } - //if a merged range is part of the selectin, try to split it - foreach (CellRange sel in MySelection) - { - //Console.WriteLine("SplitSelection foreach sel {0}", sel); - if (this.MergedRanges.Contains(sel)) - SplitMergedRange(sel, false); - } - cr = this.Selection; - //Console.WriteLine(" After Insert [{0},{1}] - [{2},{3}]", cr.r1, cr.c1, cr.r2, cr.c2); - if (hasNonMergedRow) - { - for (int c = 0; c < this.Cols.Count; c++) - for (int r = cr.r1; r <= cr.r2; r += 2) - { - if (!this.IsCellSelected(r, c)) - { - CellRange crTmp = GetMergedRange(r, c); - if (crTmp.IsSingleCell) - { - CellRange tcr = this.GetCellRange(r, c, r + 1, c); - this.MergedRanges.Add(tcr); - this.Invalidate(); - } - } - } - // Adjust selected Row Heights - for (int r = cr.r1; r <= cr.r2; r++) - { - int recHeight = this.GetCellRect(r, cr.c1).Height; - this.Rows[r].Height = Math.Max(recHeight / 2, Rows.DefaultSize); - //this.Rows[r].Height = Math.Max(recHeight / 2, _minRowSplitHeight); - //Console.WriteLine("Cell[{0},{1}].Height = {2}", r, cr.c1, recHeight); - } - } - //foreach (CellRange crng in this.MergedRanges) - // Console.WriteLine("merge ranges [{0},{1}] - [{2},{3}]", crng.r1, crng.c1, crng.r2, crng.c2); - } - private void AdjustMergedRows(int row, bool above, bool removing) - { - AdjustMergedRows(row, 1, above, removing); - } - - private void AdjustMergedRows(int row, int cnt, bool above, bool removing) - { - CellRangeCollection crc = new CellRangeCollection(this); - if (removing) - { - foreach (CellRange r in this.MergedRanges) - { - CellRange cr = r; - if (r.ContainsRow(row)) - { - if (r.TopRow != r.BottomRow) - { - cr.r2 -= cnt; - crc.Add(cr); - } - } - else - { - if (row <= r.r1) - { - if (row < r.r1) - cr.r1 -= cnt; - cr.r2 -= cnt; - } - crc.Add(cr); - } - } - } - else // adding - foreach (CellRange r in this.MergedRanges) - { - CellRange cr = r; - int inspos = (above) ? row : row - 1; - if (r.ContainsRow(inspos)) - { - bool adjustMergeValues = true; - if (cr.r1 == row && cr.r2 == row + cnt -1) - adjustMergeValues = false; // don't add to existing merge range - we will add a new merge range for this copy - for (int insCnt = 0; insCnt < cnt; insCnt++) - { - if ((above && cr.r1 == inspos) || (!above && cr.r2 == inspos)) - { - string tstr = ""; - int newrow = 0; - if (above) - { - if (this[cr.r1 + cnt, cr.c1] != null) - tstr = this[cr.r1 + cnt, cr.c1].ToString(); - newrow = cr.r1; - } - else - { - if (this[cr.r2, cr.c1] != null) - tstr = this[cr.r2, cr.c1].ToString(); - newrow = cr.r2 + cnt; - } - if (tstr != null && tstr.Length > 0) - for (int x = cr.c1; x <= cr.c2; x++) - this[newrow, x] = tstr; - } - if (adjustMergeValues) cr.r2++; - } - } - else - { - if (inspos < cr.r1) - { - cr.r1 += cnt; - cr.r2 += cnt; - } - } - crc.Add(cr); - } - this.MergedRanges.Clear(); - foreach (CellRange r in crc) - { - if ((r.r1 != r.r2) || (r.c1 != r.c2)) - this.MergedRanges.Add(r); - } - } - - private void AdjustMergedColumns(int col, bool left, bool removing) - { - AdjustMergedColumns(col, 1, left, removing); //adjusting for just one column - } - - private void AdjustMergedColumns(int col, int cnt, bool left, bool removing) - { - CellRangeCollection crc = new CellRangeCollection(this); - if (removing) - { - foreach (CellRange r in this.MergedRanges) - { - CellRange cr = r; - if (r.ContainsCol(col)) - { - if (r.LeftCol != r.RightCol) - { - cr.c2 -= cnt; - crc.Add(cr); - } - } - else - { - if (col < cr.c1) - { - cr.c1-=cnt; - cr.c2-=cnt; } - crc.Add(cr); - } - } - } - else // adding - foreach (CellRange r in this.MergedRanges) - { - CellRange cr = r; - int inspos = (left) ? col : col - 1; - if (r.ContainsCol(inspos)) - { - for (int insCnt = 0; insCnt < cnt; insCnt++) - { - string tstr = ""; - int newcol = 0; - if (left) - { - if (inspos == cr.c1) - tstr = (this[cr.r1, cr.c1 + 1] == null) ? "" : this[cr.r1, cr.c1 + 1].ToString(); - else - tstr = (this[cr.r1, cr.c1] == null) ? "" : this[cr.r1, cr.c1].ToString(); - newcol = cr.c1; - } - else - { - if (this[cr.r1, cr.c2] != null) - tstr = this[cr.r1, cr.c2].ToString(); - newcol = cr.c2 + 1; - } - for (int x = cr.r1; x <= cr.r2; x++) - this[x, newcol] = tstr; - - cr.c2++; - } - } - else if (col <= r.c1) - { - cr.c1+=cnt; - cr.c2+=cnt; - } - crc.Add(cr); - } - this.MergedRanges.Clear(); - foreach (CellRange r in crc) - { - if ((r.r1 != r.r2) || (r.c1 != r.c2)) - this.MergedRanges.Add(r); - } - } - - private bool RowIsInMergeRange(int row) - { - bool rtn = false; - if (row >= 0) - { - CellRange cr = this.Selection; - //rtn = true; // KBR: is this wrong, i.e. should it be like ColIsInMergeRange - int c = cr.c1; - while (!rtn && (c <= cr.c2)) - { - int idx = this.MergedRanges.IndexOf(row, c); - rtn = (idx > -1); - c++; - } - } - return rtn; - } - - private bool ColIsInMergeRange(int col) - { - bool rtn = false; - if (col >= 0) - { - CellRange cr = this.Selection; - //rtn = true; - int r = cr.r1; - while (!rtn && (r <= cr.r2)) - { - int idx = this.MergedRanges.IndexOf(r, col); - rtn = (idx > -1); - r++; - } - } - return rtn; - } - - #endregion //Merged / Split Range - - #region Grid Add and Remove Row / Column - - private int GetRowInsertPosition(Boolean before) - { - int rtnrow; - CellRange selcr = this.Selection; - CellRange cr = selcr; - int idx = this.MergedRanges.IndexOf(cr.r1, cr.c2); - if (idx > -1) - cr = this.MergedRanges[idx]; // we want first or last row in merge range - rtnrow = (before) ? cr.r1 : cr.r2; - // The following is an adjustment needed when we are copying an entire row that includes some merged cells - if (selcr.c1 != selcr.c2) - { - while (!before && rtnrow > selcr.r2) rtnrow--; - while (before && rtnrow < selcr.r2) rtnrow++; - } - - return rtnrow; - } - - private int GetColInsertPosition(Boolean before) - { - int rtncol; - CellRange selcr = this.Selection; - CellRange cr = selcr; - int idx = this.MergedRanges.IndexOf(cr.r1, cr.c2); - if (idx > -1) - cr = this.MergedRanges[idx]; // we want the first of last col in merge range - rtncol = (before) ? cr.c1 : cr.c2; - // The following is an adjustment needed when we are copying an entire column that includes some merged cells - if (selcr.r1 != selcr.r2) - { - while (!before && rtncol > selcr.c2) rtncol--; - while (before && rtncol < selcr.c2) rtncol++; - } - return rtncol; - } - - public void InsertColumnBefore() - { - int newcol = this.GetColInsertPosition(true); - this.Cols.Insert(newcol); - // set new column width to same width as column from where it was inserted - this.Cols[newcol].Width = this.Cols[newcol + 1].Width; - MyBorders.InsertColumn(newcol); - MyShading.InsertColumn(newcol); // C2021-004 table cell shading - this.AdjustMergedColumns(newcol, true, false); - this.AdjustGridControlSize(); - } - - public void InsertColumnAfter() - { - int colidx = this.GetColInsertPosition(false); - if (colidx == this.Cols.Count - 1) // last column - this.Cols.Add(1); - else - this.Cols.Insert(colidx + 1); - MyBorders.InsertColumn(colidx); - MyShading.InsertColumn(colidx); // C2021-004 table cell shading - // set new column width to same width as column from where it was inserted - this.Cols[colidx + 1].Width = this.Cols[colidx].Width; - this.AdjustMergedColumns(colidx + 1, false, false); - this.AdjustGridControlSize(); - } - - public void InsertRowBefore() - { - int newrow = this.GetRowInsertPosition(true); - this.Rows.Insert(newrow); - // set new row Height to same heidht as row from where it was inserted - this.Rows[newrow].Height = (Rows[newrow + 1].Height == -1) ? Rows.DefaultSize : Rows[newrow + 1].Height; - //this.Rows[newrow].Height = this.Rows[newrow + 1].Height; - MyBorders.InsertRow(newrow); - MyShading.InsertRow(newrow); // C2021-004 table cell shading - this.AdjustMergedRows(newrow, true, false); - this.AdjustGridControlSize(); - } - - public void InsertRowAfter() - { - int rowidx = this.GetRowInsertPosition(false); - if (rowidx == this.Rows.Count - 1) // last row - this.Rows.Add(1); - else - this.Rows.Insert(rowidx + 1); - // set new row Height to same heidht as row from where it was inserted - this.Rows[rowidx + 1].Height = (Rows[rowidx].Height == -1) ? Rows.DefaultSize : Rows[rowidx].Height; - //this.Rows[rowidx + 1].Height = this.Rows[rowidx].Height; - MyBorders.InsertRow(rowidx + 1); - MyShading.InsertRow(rowidx + 1); // C2021-004 table cell shading - this.AdjustMergedRows(rowidx + 1, false, false); - this.AdjustGridControlSize(); - } - - public bool AllRowsSelected() - { - int maxrow = Selection.r2; - foreach (CellRange cr in MySelection) - maxrow = Math.Max(maxrow, cr.r2); - return (Selection.r1 == 0 && maxrow == Rows.Count - 1); - } - - public bool AllColumnsSelected() - { - int maxcol = Selection.c2; - foreach (CellRange cr in MySelection) - maxcol = Math.Max(maxcol, cr.c2); - return (Selection.c1 == 0 && maxcol == Cols.Count - 1); - } - - public void RemoveSelectedColumn() - { - string msg = ""; - string title = ""; - CellRange saveCR = Selection; - this.SelectionMode = SelectionModeEnum.ColumnRange; - //this.Select(this.Selection.r1, this.Selection.c1); - this.Select(0, Selection.c1, Rows.Count - 1, Selection.c2); - this.SelectionMode = SelectionModeEnum.Default; - if (Selection.c1 != Selection.c2) - { - msg = "Remove selected columns?"; - title = "Delete Columns"; - } - else - { - msg = "Remove this column?"; - title = "Delete Column"; - } - DialogResult dr = FlexibleMessageBox.Show(msg, title, MessageBoxButtons.YesNo); - if (dr == DialogResult.Yes) - RemoveColumns(this.Selection.r1, this.Selection.c1, 1+this.Selection.c2-this.Selection.c1); - else - Select(saveCR); - } - - public void RemoveSelectedRow() - { - string msg = ""; - string title = ""; - CellRange saveCR = Selection; - this.SelectionMode = SelectionModeEnum.RowRange; - this.Select(Selection.r1, 0, Selection.r2, Cols.Count - 1); - this.SelectionMode = SelectionModeEnum.Default; - if (Selection.r1 != Selection.r2) - { - msg = "Remove selected rows?"; - title = "Delete Rows"; - } - else - { - msg = "Remove this row?"; - title = "Delete Row"; - } - DialogResult dr = FlexibleMessageBox.Show(msg, title, MessageBoxButtons.YesNo); - if (dr == DialogResult.Yes) - this.RemoveRows(this.Selection.r1, this.Selection.c1, 1 + this.Selection.r2 - this.Selection.r1); - else - Select(saveCR); - } - - private void RemoveRows(int strow, int stcol, int cnt) - { - bool mergedRow = false; - for (int i = 0; i < cnt; i++) - { - for (int cl = 0; cl < this.Cols.Count && !mergedRow; cl++) - { - int idx = this.MergedRanges.IndexOf(strow, cl); - if (idx > -1) - { - CellRange cr = this.MergedRanges[idx]; - if (cr.r1 < cr.r2) - mergedRow = true; - } - cl++; - } - this.Rows.Remove(strow); - this.AdjustMergedRows(strow, false, true); - mergedRow = false; - } - MyBorders.DeleteRows(strow, cnt); - MyShading.DeleteRows(strow, cnt); // C2021-004 table cell shading - this.AdjustGridControlSize(); - } - - private void RemoveColumns(int strow, int stcol, int cnt) - { - bool mergedCol = false; - for (int i = 0; i < cnt; i++) - { - for (int rw = 0; rw < this.Rows.Count && !mergedCol; rw++) - { - int idx = this.MergedRanges.IndexOf(rw, stcol); - if (idx > -1) - { - CellRange cr = this.MergedRanges[idx]; - if (cr.c1 < cr.c2) - mergedCol = true; - } - } - this.Cols.Remove(stcol); - this.AdjustMergedColumns(stcol, false, true); - mergedCol = false; - } - MyBorders.DeleteColumns(stcol, cnt); - MyShading.DeleteColumns(stcol, cnt); // C2021-004 table cell shading - this.AdjustGridControlSize(); - } - #endregion //Grid Add and Remove Row / Column - - #region Copy/Paste - - public void CopyRow() - { - _tableCellEditor.Hide(); // B2017-200 force save of changes from active edit session - DialogResult dr = DialogResult.Yes; - SelectRow(); - if (Selection.r1 != Selection.r2) - { - //dr = MessageBox.Show("You selected a row that includes merged cells.\n\nThese additional rows must be included.\n\nCopy these rows?", "Copy Rows", MessageBoxButtons.YesNo); - dr = FlexibleMessageBox.Show("Your selection was expanded due to merged cell regions.\n\nContinue with the copy?", "Copy Rows", MessageBoxButtons.YesNo); - } - if (dr == DialogResult.Yes) - CopyToCopiedFlexGrid(GridCopyOption.Row); - //TestSetBackgroundColor(); - } - //public void TestSetBackgroundColor() - //{ - // for (int r = Selection.r1; r <= Selection.r2; r++) - // for (int c = Selection.c1; c <= Selection.c2; c++) - // { - // CellRange cr = GetMergedRange(r, c); - // if (cr.Style == null) cr.Style = this.Styles.Add("Shading"); - // if (cr.Style != null && cr.Style.BackColor != Color.DarkGreen && cr.Style.Name != "Fixed") - // { - // { - // cr.Style.BackColor = Color.DarkGreen; - // } - // } - // } - //} - public void CopyColumn() - { - _tableCellEditor.Hide(); // B2017-200 force save of changes from active edit session - SelectCol(); - DialogResult dr = DialogResult.Yes; - if (Selection.c1 != Selection.c2) - { - //dr = MessageBox.Show("You selected a column that includes merged cells.\n\nThese additional columns must be included.\n\nCopy these columns?", "Copy Columns", MessageBoxButtons.YesNo); - dr = FlexibleMessageBox.Show("Your selection was expanded due to merged cell regions.\n\nContinue with the copy?", "Copy Columns", MessageBoxButtons.YesNo); - } - if (dr == DialogResult.Yes) - CopyToCopiedFlexGrid(GridCopyOption.Column); - } - - public void CopyCellSelection() - { - _tableCellEditor.Hide(); // B2017-200 force save of changes from active edit session - DialogResult dr = DialogResult.Yes; - CellRange cr = Selection; - MakeSelectionEven(); - if (!cr.Equals(Selection)) - { - dr = FlexibleMessageBox.Show("Your selection was expanded due to merged cell regions.\n\nContinue with the copy?", "Copy Selection", MessageBoxButtons.YesNo); - } - if (dr == DialogResult.Yes) - CopyToCopiedFlexGrid(GridCopyOption.Selection); - } - - public enum enmPastePos : int - { - Before = 1, Replace = 0, After = -1 - } - - public void PasteRows(enmPastePos pp) - { - if (MyCopyInfo.MyCopiedFlexGrid == null || MyCopyInfo.MyCopyOption != GridCopyOption.Row) return; - int rowsToAdd = MyCopyInfo.MyCopiedCellRange.r2 - MyCopyInfo.MyCopiedCellRange.r1 + 1; - int colsToAdd = Math.Max((MyCopyInfo.MyCopiedCellRange.c2 - MyCopyInfo.MyCopiedCellRange.c1 + 1) - Cols.Count, 0); - int selR1 = Selection.r1; - int selR2 = Selection.r2; - int rowOffset = selR1 + (pp == enmPastePos.After ?(selR2-selR1)+1 : 0) - MyCopyInfo.MyCopiedCellRange.r1; - - // If the rows we are copying has more columns than the current table, then append then needed columns to the grid - if (colsToAdd > 0) - { - Cols.Add(colsToAdd); - AdjustMergedColumns(Cols.Count - 1, colsToAdd, false, false); - MyBorders.InsertColumns(Cols.Count - colsToAdd - 1, colsToAdd); - MyShading.InsertColumns(Cols.Count - colsToAdd - 1, colsToAdd); // C2021-004 table cell shading - } - - switch (pp) - { - case enmPastePos.Before: - this.Rows.InsertRange(selR1, rowsToAdd); - AdjustMergedRows(selR1, rowsToAdd, true, false); - MyBorders.InsertRows(Rows.Count - rowsToAdd - 1, rowsToAdd); - MyShading.InsertRows(Rows.Count - rowsToAdd - 1, rowsToAdd); // C2021-004 table cell shading - break; - case enmPastePos.After: - if (selR2+1 < Rows.Count - 1) - { - this.Rows.InsertRange(selR2 + 1, rowsToAdd); - AdjustMergedRows(selR1+1, rowsToAdd, false, false); - } - else - this.Rows.Add(rowsToAdd); - MyBorders.InsertRows(Rows.Count - rowsToAdd - 1, rowsToAdd); - MyShading.InsertRows(Rows.Count - rowsToAdd - 1, rowsToAdd); // C2021-004 table cell shading - break; - case enmPastePos.Replace: - if (rowsToAdd > Rows.Count - Selection.r1) - { - int numToAdd = rowsToAdd - (Rows.Count = selR1); - this.Rows.Add(numToAdd); - AdjustMergedRows(selR1, numToAdd, false, false); - } - break; - } - - RemoveMergedRanges(MyCopyInfo.MyCopiedCellRange.r1 + rowOffset, MyCopyInfo.MyCopiedCellRange.c1, MyCopyInfo.MyCopiedCellRange.r2 + rowOffset, MyCopyInfo.MyCopiedCellRange.c2); - for (int r = MyCopyInfo.MyCopiedCellRange.r1; r <= MyCopyInfo.MyCopiedCellRange.r2; r++) - { - Rows[r + rowOffset].Height = MyCopyInfo.MyCopiedFlexGrid.Rows[r].Height; - for (int c = MyCopyInfo.MyCopiedCellRange.c1; c <= Math.Min(MyCopyInfo.MyCopiedCellRange.c2 + colsToAdd, Cols.Count - 1); c++) - { - CellRange crm = MyCopyInfo.MyCopiedFlexGrid.GetMergedRange(r, c); - if (r == crm.r1 && c == crm.c1) - { - Cols[c].Width = Math.Max(Cols[c].Width, MyCopyInfo.MyCopiedFlexGrid.Cols[c].Width); - CellRange cr = GetCellRange(crm.r1 + rowOffset, crm.c1, crm.r2 + rowOffset, crm.c2); - // if the paste is above - copy merge range for the destination - // if the paste is below - put back the range for the source location - if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1)) - MergedRanges.Add(cr); - // B2022-046 if the cell contains an RO or Transition then replace the usage id with to force a new usage id in the link - if (MyCopyInfo.MyCopiedFlexGrid[r, c] != null) - this[r + rowOffset, c] = ItemInfo.ReplaceLinkWithNewID(MyCopyInfo.MyCopiedFlexGrid[r, c].ToString().Replace("\r\n", "")); - else - this[r + rowOffset, c] = MyCopyInfo.MyCopiedFlexGrid[r, c]; - MatchStyle(crm, cr); - PasteBorders(r + rowOffset, c, r, c); - PasteShading(r + rowOffset, c, r, c); // C2021-004 paste the shading information - // if the paste is above - put back the range for the source location - // if the paste is below - copy merge range for the destination - int r1 = crm.r1 + rowsToAdd - rowOffset; - int r2 = crm.r2 + rowsToAdd - rowOffset; - CellRange ncr = GetCellRange(r1, crm.c1, r2, crm.c2); - if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1)) - MergedRanges.Add(ncr); - } - } - } - - this.AdjustGridControlSize(); - CopyToCopiedFlexGrid(MyCopyInfo.MyCopyOption); - } - - private void MatchStyle(CellRange crm, CellRange cr) - { - if (crm.Style != null) - { - ChangeCellAlign(cr, crm.Style.TextAlign); - ChangeCellBorder(cr, crm.Style.Border.Style); - } - //else - //{ - // cr.Style = null; // - didn't like the null - //} - } - - private void RemoveMergedRanges(int r1, int c1, int r2, int c2) - { - for (int r = r1; r <= r2; r++) - for (int c = c1; c <= c2; c++) - { - CellRange cr = GetMergedRange(r, c); - if (cr.r1 < cr.r2 || cr.c1 < cr.c2) - MergedRanges.Remove(cr); - } - } - - public void PasteColumns(enmPastePos pp) - { - if (MyCopyInfo.MyCopiedFlexGrid == null || MyCopyInfo.MyCopyOption != GridCopyOption.Column) return; - - int colsToAdd = MyCopyInfo.MyCopiedCellRange.c2 - MyCopyInfo.MyCopiedCellRange.c1 + 1; - int rowsToAdd = Math.Max((MyCopyInfo.MyCopiedCellRange.r2 - MyCopyInfo.MyCopiedCellRange.r1 + 1) - Rows.Count, 0); - int selC1 = Selection.c1; - int selC2 = Selection.c2; - int colOffset = selC1 + (pp == enmPastePos.After ? (selC2-selC1)+1 : 0) - MyCopyInfo.MyCopiedCellRange.c1; - - // If the columns we are copying has more rows than the current table, then append the needed rows to the grid - if (rowsToAdd > 0) - { - Rows.Add(rowsToAdd); - AdjustMergedRows(Rows.Count, false, false); - MyBorders.InsertRows(Rows.Count - rowsToAdd - 1,rowsToAdd); - MyShading.InsertRows(Rows.Count - rowsToAdd - 1, rowsToAdd); // C2021-004 table cell shading - } - - switch (pp) - { - case enmPastePos.Before: - this.Cols.InsertRange(selC1, colsToAdd); - AdjustMergedColumns(selC1, colsToAdd, true, false); - MyBorders.InsertColumns(Cols.Count - colsToAdd - 1, colsToAdd); - MyShading.InsertColumns(Cols.Count - colsToAdd - 1, colsToAdd); // C2021-004 table cell shading - break; - case enmPastePos.After: - if (selC2+1 < Cols.Count - 1) - { - this.Cols.InsertRange(selC2+1, colsToAdd); - AdjustMergedColumns(selC1+1, colsToAdd, false, false); - } - else - this.Cols.Add(colsToAdd); - MyBorders.InsertColumns(Cols.Count - colsToAdd - 1, colsToAdd); - MyShading.InsertColumns(Cols.Count - colsToAdd - 1, colsToAdd); // C2021-004 table cell shading - break; - case enmPastePos.Replace: - if (colsToAdd > Cols.Count - selC1) - { - int numToAdd = colsToAdd - (Cols.Count - selC1); - this.Cols.Add(numToAdd); - AdjustMergedColumns(selC1, numToAdd, true, false); - } - break; - } - - RemoveMergedRanges(MyCopyInfo.MyCopiedCellRange.r1, MyCopyInfo.MyCopiedCellRange.c1 + colOffset, MyCopyInfo.MyCopiedCellRange.r2, MyCopyInfo.MyCopiedCellRange.c2 + colOffset); - - // Fix the merge ranges - for (int c = MyCopyInfo.MyCopiedCellRange.c1; c <= MyCopyInfo.MyCopiedCellRange.c2; c++) - { - Cols[c + colOffset].Width = MyCopyInfo.MyCopiedFlexGrid.Cols[c].Width; - for (int r = MyCopyInfo.MyCopiedCellRange.r1; r <= Math.Min(MyCopyInfo.MyCopiedCellRange.r2 + rowsToAdd, Rows.Count - 1); r++) - { - CellRange crm = MyCopyInfo.MyCopiedFlexGrid.GetMergedRange(r, c); - if (r == crm.r1 && c == crm.c1) - { - Rows[r].Height = Math.Max(Rows[r].Height, MyCopyInfo.MyCopiedFlexGrid.Rows[r].Height); - CellRange cr = GetCellRange(crm.r1, crm.c1 + colOffset, crm.r2, crm.c2 + colOffset); - // if the paste is to the left - copy merge range for the destination - // if the paste is to the right - put back the range for the source location - if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1)) - MergedRanges.Add(cr); - // copy cell text to the destination, copy the style, copy the cell borders - // B2022-046 if the cell contains an RO or Transition then replace the usage id with to force a new usage id in the link - if (MyCopyInfo.MyCopiedFlexGrid[r, c] != null) - this[r, c + colOffset] = ItemInfo.ReplaceLinkWithNewID(MyCopyInfo.MyCopiedFlexGrid[r, c].ToString().Replace("\r\n", "")); - else - this[r, c + colOffset] = MyCopyInfo.MyCopiedFlexGrid[r, c]; - MatchStyle(crm, cr); - PasteBorders(r, c + colOffset, r, c); - PasteShading(r, c + colOffset, r, c); // C2021-004 paste the shading information - // if the paste is to the left - put back the range for the source location - // if the paste is to the right - copy merge range for the destination - int c1 = crm.c1 + colsToAdd - colOffset; - int c2 = crm.c2 + colsToAdd - colOffset; - CellRange ncr = GetCellRange(crm.r1, c1, crm.r2, c2); - if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1)) - MergedRanges.Add(ncr); - } - } - } - - this.AdjustGridControlSize(); - CopyToCopiedFlexGrid(MyCopyInfo.MyCopyOption); - - } - - public void PasteCopiedCells() - { - // Warn the user that this type of paste will replace the currently selected (highlighted) table cells and give the option to abort. - DialogResult dr = FlexibleMessageBox.Show("This will replace the cells that are currently selected (highlighted). \n\nContinue with the paste?", "Paste Table Cells", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (dr == DialogResult.No) return; - - int nSelRows = Selection.r2 - Selection.r1 + 1; - int nSelCols = Selection.c2 - Selection.c1 + 1; - int nCpyRows = MyCopyInfo.MyCopiedCellRange.r2 - MyCopyInfo.MyCopiedCellRange.r1 + 1; - int nCpyCols = MyCopyInfo.MyCopiedCellRange.c2 - MyCopyInfo.MyCopiedCellRange.c1 + 1; - int colsToAdd = Math.Max(nCpyCols - nSelCols, 0); - int rowsToAdd = Math.Max(nCpyRows - nSelRows, 0); - int rowOffset = Selection.r1 - MyCopyInfo.MyCopiedCellRange.r1; - int colOffset = Selection.c1 - MyCopyInfo.MyCopiedCellRange.c1; - int selR2 = Selection.r2; - int selC2 = Selection.c2; - // If there are more cells to copy than what is seleceted in the target table - // Add extra rows and columns as needed - if (rowsToAdd > 0) - { - if (selR2 < Rows.Count - 1) - { - this.Rows.InsertRange(selR2 + 1, rowsToAdd); - AdjustMergedRows(selR2 + 1, false, false); - } - else - this.Rows.Add(rowsToAdd); - MyBorders.InsertRows(selR2,rowsToAdd); - MyShading.InsertRows(selR2, rowsToAdd); // C2021-004 table cell shading - } - - if (colsToAdd > 0) - { - if (selC2 < Cols.Count - 1) - { - this.Cols.InsertRange(selC2 + 1, colsToAdd); - AdjustMergedColumns(selC2 + 1, false, false); - } - else - this.Cols.Add(colsToAdd); - MyBorders.InsertColumns(selC2,colsToAdd); - MyShading.InsertColumns(selC2, colsToAdd); // C2021-004 table cell shading - } - - RemoveMergedRanges(MyCopyInfo.MyCopiedCellRange.r1 + rowOffset, MyCopyInfo.MyCopiedCellRange.c1 + colOffset, MyCopyInfo.MyCopiedCellRange.r2 + rowOffset, MyCopyInfo.MyCopiedCellRange.c2 + colOffset); - - for (int c = MyCopyInfo.MyCopiedCellRange.c1; c <= Math.Min(MyCopyInfo.MyCopiedCellRange.c2, Cols.Count - 1 - colOffset); c++) - Cols[c + colOffset].Width = Math.Max(MyCopyInfo.MyCopiedFlexGrid.Cols[c].Width, Cols[c + colOffset].Width); - - for (int r = MyCopyInfo.MyCopiedCellRange.r1; r <= Math.Min(MyCopyInfo.MyCopiedCellRange.r2, Rows.Count - 1 - rowOffset); r++) - { - Rows[r + rowOffset].Height = Math.Max(MyCopyInfo.MyCopiedFlexGrid.Rows[r].Height, Rows[r + rowOffset].Height); - for (int c = MyCopyInfo.MyCopiedCellRange.c1; c <= Math.Min(MyCopyInfo.MyCopiedCellRange.c2, Cols.Count - 1 - colOffset); c++) - { - CellRange crm = MyCopyInfo.MyCopiedFlexGrid.GetMergedRange(r, c); - if (r == crm.r1 && c == crm.c1) - { - CellRange cr = GetCellRange(crm.r1 + rowOffset, crm.c1 + colOffset, crm.r2 + rowOffset, crm.c2 + colOffset); - if ((crm.r2 > crm.r1) || (crm.c2 > crm.c1)) - MergedRanges.Add(cr); - // B2022-046 if the cell contains an RO or Transition then replace the usage id with to force a new usage id in the link - if (MyCopyInfo.MyCopiedFlexGrid[r, c] != null) - this[r + rowOffset, c + colOffset] = ItemInfo.ReplaceLinkWithNewID(MyCopyInfo.MyCopiedFlexGrid[r, c].ToString().Replace("\r\n", "")); - else - this[r + rowOffset, c + colOffset] = MyCopyInfo.MyCopiedFlexGrid[r, c]; - MatchStyle(crm, cr); - PasteBorders(r + rowOffset, c + colOffset, r, c); - PasteShading(r + rowOffset, c + colOffset, r, c); // C2021-004 paste the shading information - } - } - } - this.AdjustGridControlSize(); - CopyToCopiedFlexGrid(MyCopyInfo.MyCopyOption); - } - - #endregion // Copy/Paste - #region Selection - public bool SelectNextCell() - { - int r = this.Row; - int c = this.Col; - CellRange cr = GetMergedRange(r, c); - do - { - c = cr.c2 + 1; - if (c >= this.Cols.Count) - { - r = r + 1; - c = 0; - if (r >= this.Rows.Count) return false; - } - cr = GetMergedRange(r, c); - } while (r != cr.r1 || c != cr.c1); - Select(r, c); - return true; - } - public bool SelectPrevCell() - { - int r = this.Row; - int c = this.Col; - CellRange cr = GetMergedRange(r, c); - do - { - c = cr.c1 - 1; - if (c < 0) - { - r = r - 1; - c = this.Cols.Count-1; - if (r < 0) return false; - } - cr = GetMergedRange(r, c); - c = cr.c1; - } while (r != cr.r1); - Select(r, c); - return true; - } - #endregion - #region SearchableText - public string GetSearchableText() - { - StringBuilder sb = new StringBuilder(); - int r = 0; - int c = 0; - int w = Cols.Count; - int h = Rows.Count; - - while (r < h) - { - CellRange cr = GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) - { - if (this[r, c] != null) - { - string strp = DisplayText.StaticStripRtfCommands((string)this[r, c], true); // C2020-001: added 'true', in a table - sb.Append(strp.Replace("\r\n", " ")); - } - sb.Append("\r\n"); - } - c = c + 1; - if (c == w) - { - c = 0; - r = r + 1; - } - } - return sb.ToString(); - } - #endregion - #region Import / Export Grid - - /// - /// Prompts user with Save File dialog. - /// Grid will be saved to an XML file. - /// - /// - public void ExportToXML(string initDir) - { - SaveFileDialog sfd = new SaveFileDialog(); - sfd.DefaultExt = ".xml"; - sfd.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.* "; - //sfd.InitialDirectory = @"C:\Development\SampleTableData"; - sfd.InitialDirectory = initDir; - sfd.Title = "Save XML File"; - sfd.ShowDialog(); - this.WriteXml(sfd.FileName); - } - public string GetXMLData() - { - string retstr = null; - using (StringWriter sw = new StringWriter()) - { - this.WriteXml(sw); - retstr = sw.GetStringBuilder().ToString(); - sw.Close(); - } - return retstr; - } - /// - /// Prompts user with Save File dialog. - /// Grid will be saved to an Excel file. - /// - /// - //public void ExportToExcel(string initDir) - //{ - // SaveFileDialog sfd = new SaveFileDialog(); - // sfd.DefaultExt = ".xls"; - // sfd.Filter = "Excel files (*.xls)|*.xls|All files (*.*)|*.* "; - // //sfd.InitialDirectory = @"C:\Development\SampleTableData"; - // sfd.InitialDirectory = initDir; - // sfd.Title = "Save Excel File"; - // sfd.ShowDialog(); - // this.SaveExcel(sfd.FileName); - //} - - /// - /// Prompts user with Open File dialog. - /// XML file will be imported to a table grid. - /// - /// - /// - public string ImportXML(string initDir) - { - string rtn = ""; - OpenFileDialog ofd = new OpenFileDialog(); - ofd.DefaultExt = ".xml"; - ofd.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.* "; - //ofd.InitialDirectory = @"C:\Development\SampleTableData"; - ofd.InitialDirectory = initDir; - ofd.Multiselect = false; - ofd.Title = "Select XML File"; - ofd.ShowDialog(); - this.Clear(); - this.MergedRanges.Clear(); - this.ReadXml(ofd.FileName); - this.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None; - this.KeyActionTab = KeyActionEnum.MoveAcross; - this.AdjustGridControlSize(); - rtn = ofd.SafeFileName; - return rtn; - } - - /// - /// Prompts user with Open File dialog. - /// Excel file will be imported to a table grid. - /// - /// - /// - //public string ImportExcel(string initDir) - //{ - // string rtn = ""; - // //VlnFlexGrid grd = rbtDefaultTable.Checked ? vlnFlexGrid2 : vlnFlexGrid3; //GetActiveGrid(); - // OpenFileDialog ofd = new OpenFileDialog(); - // ofd.DefaultExt = ".xls"; - // ofd.Filter = "Excel files (*.xls)|*.xls|All files (*.*)|*.*"; - // //ofd.InitialDirectory = @"C:\Development\SampleTableData"; - // ofd.InitialDirectory = initDir; - // ofd.Multiselect = false; - // ofd.Title = "Select Excel File"; - // ofd.ShowDialog(); - // this.Clear(); - // this.MergedRanges.Clear(); - // this.LoadExcel(ofd.FileName); - // this.AdjustGridControlSize(); - // rtn = ofd.SafeFileName; - // return rtn; - //} - public static List ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args) - { - string xml = null; - string srchtxt = null; - Content content = (Content)sender; - bool isdirty = false; - using (VlnFlexGrid myGrid = new VlnFlexGrid(content.ContentItems[0])) - { - using (StringReader sr = new StringReader(args.OldGridXml)) - { - myGrid.ReadXml(sr); - sr.Close(); - } - string roid = content.ContentRoUsages[0].ROID; //myGrid.ROID; - int rodbid = content.ContentRoUsages[0].RODbID; //myGrid.RODbId; - myGrid.Visible = false; - myGrid.ConvertTableROToGrid(args.ROText, rodbid, roid); - myGrid.FixTableCellsHeightWidth(); - myGrid.AdjustGridControlSize(); - myGrid.Visible = true; - using (StringWriter sw = new StringWriter()) - { - myGrid.WriteXml(sw); - xml = sw.GetStringBuilder().ToString(); - sw.Close(); - } - srchtxt = myGrid.GetSearchableText(); - isdirty = myGrid.IsGridChanged(args.OldGridXml, xml, false); - } - List retlist = new List(); - retlist.Add(srchtxt); - if(isdirty) - retlist.Add(xml); - else - retlist.Add(args.OldGridXml); - return retlist; - } - public void ConvertTableROToGrid(string valtext, int rodbid, string roid) - { - VE_Font vefont = _MyItemInfo.GetItemFont(); - this.Font = vefont.WindowsFont; - this.MergedRanges.Clear(); - this.Clear(); - this.IsRoTable = true; - this.ParseTableFromText(valtext, GridLinePattern.Single); - this.AutoSizeCols(); - this.AutoSizeRows(); - this.MakeRTFcells(); - this.RODbId = rodbid; - this.ROID = roid; - } - - private Regex _ReplaceSpaceNewLine = new Regex(@"(?<=\\[^' \\?\r\n\t]*) (?=\r\n)"); - private Regex _ReplaceTokenSpaceToken = new Regex(@"(?<=\\[^' \\?\r\n\t]*) (?=\\)"); - private Regex _RemoveComments = new Regex(@"\\v .*?\\v0( |$)"); - - private string PrepROTableText(string stepText) - { - // we need to convert some RTF command to DOS so that we can - // figure out the table size - stepText = stepText.Replace("\r", ""); - stepText = stepText.Replace("\xF8", @"\'f8"); - stepText = stepText.Replace(@"\par ", "\r\n"); - stepText = _ReplaceTokenSpaceToken.Replace(stepText, ""); - - //Change Token Order to match RTB output - stepText = stepText.Replace(@"\v0\b0", @"\b0\v0"); - stepText = stepText.Replace(@"\b0\ulnone", @"\ulnone\b0"); - stepText = _ReplaceSpaceNewLine.Replace(stepText, ""); - - // Now change the Unicode symbols to DOS symbols - stepText = stepText.Replace(@"\u8209?", "-"); - stepText = stepText.Replace(@"\u9586?", "\\"); - stepText = stepText.Replace(@"\u9474?", "\xB3"); // Vert Line graphic character - stepText = stepText.Replace(@"\'b0", "\xB0"); - stepText = stepText.Replace(@"\up2 ", "\x9566"); - stepText = stepText.Replace(@"\up0 ", "\x9567"); - stepText = stepText.Replace(@"\ulnone", "\xBB"); - stepText = stepText.Replace(@"\ul", "\xAB"); - stepText = stepText.Replace(@"\{", "{"); - stepText = stepText.Replace(@"\}", "}"); - stepText = stepText.Replace(@"\b0", "\xD6"); - stepText = stepText.Replace(@"\b", "\xD5"); - stepText = stepText.Replace(@"\u160?", "\xA0"); //hard space - stepText = stepText.Replace(@"\u916?", "\x7F"); // delta - stepText = stepText.Replace(@"\u8805?", "\xF2"); //greater than or equal - stepText = stepText.Replace(@"\u8804?", "\xF3"); // less than or equal - stepText = stepText.Replace(@"\u931?", "\xE4"); // sigma - stepText = stepText.Replace(@"\u947?", "\xE7"); // gamma - stepText = stepText.Replace(@"\u9604?", "\xFE"); // accum 2584 - stepText = stepText.Replace(@"\u9679?", "\x7"); // bullet 25CF - stepText = stepText.Replace(@"\u8776?", "\xF7"); // approx eq - stepText = stepText.Replace(@"\u8773?", "\xF0"); // similar eq 2245 - stepText = stepText.Replace(@"\u8730?", "\xFB"); // square root - stepText = stepText.Replace(@"\u961?", "\xE2"); // rho 3C1 - stepText = stepText.Replace(@"\u960?", "\xE3"); // pi - stepText = stepText.Replace(@"\u956?", "\xE6"); // micro - stepText = stepText.Replace(@"\u948?", "\xEB"); // lower case delta - stepText = stepText.Replace(@"\u963?", "\xE5"); // lower case sigma - stepText = stepText.Replace(@"\u274?", "\x90"); // energy, 112 - stepText = stepText.Replace(@"\u949?", "\xEE"); // epsilon - stepText = stepText.Replace(@"\u952?", "\xE9"); // theta, 3B8 - stepText = stepText.Replace(@"\u8857?", "\xEC"); // dot in oval, 2299 - stepText = stepText.Replace(@"\u964?", "\xA8"); // tau, 3C4 - stepText = stepText.Replace(@"\u9830?", "\xA9"); // diamond, 2666 - stepText = stepText.Replace(@"\u8593?", "\x18"); // Up Arrow - changes to \xff - stepText = stepText.Replace(@"\u8595?", "\x19"); // Down Arrow - changes to \xd6 - // Fix "|" followed by a newline - this confuses the table converter - stepText = stepText.Replace(@"|\r\n", @"| \r\n"); - stepText = stepText.Replace(@"|\n\r", @"| \n\r"); - stepText = stepText.Replace(@"|\n", @"| \n"); - - // if the entire row is underlined, then remove the underline and insert a row of dashes - stepText = ConvertUnderlineToRow(stepText); - - return stepText; - } - private bool IsPrintableTableChar(char c) - { - string printablSymbols = "\xB3\xA0\x7F\xF2\xF3\xE4\xE7\xFE\x07\xF7\xF0\xFB\xE2\xE3\xE6\xEB\xE5\x90\xEE\xE9\xEC\xA8\xA9\x18\x19"; - return (((c > '\x1F') && (c < '\x80')) || (printablSymbols.IndexOf(c) >= 0)); - } - private string ConvertUnderlineToRow(string stepText) - { - string rtnStr = ""; - char[] sep = { '\n' }; - string[] lines = stepText.Split(sep); - foreach (string line in lines) - { - int idx = 0; - int chrCnt = 0; - int uOnPos = -1; - int uOffPos = -1; - bool ulineOn = false; - //char curChar = line[idx]; - string dashRow = ""; - while (idx < line.Length && !IsPrintableTableChar(line[idx])) - { - if (line[idx] == '\xAB') //underline ON - { - ulineOn = true; - uOnPos = idx; - } - idx++; - } - while (ulineOn && idx < line.Length) - { - if (IsPrintableTableChar(line[idx])) - { - if (line[idx] == '|' || line[idx] == '\xB3') - { - dashRow += new string('-', chrCnt); - dashRow += "|"; - chrCnt = 0; - } - else - chrCnt++; - idx++; - } - else - { - if (line[idx] == '\xBB') //underline OFF - { - uOffPos = idx; - ulineOn = false; - while ((idx < line.Length) && !IsPrintableTableChar(line[idx])) - { - if (line[idx] == '\xAB') - ulineOn = true; - idx++; - } - if (idx == line.Length) - ulineOn = true; - if (!ulineOn) - dashRow = ""; - } - else - idx++; - } - } - string curLine = line; - curLine = curLine.Replace('\xB3', '|'); // replace graphic vert bar with DOS vert bar - if (ulineOn && idx == line.Length) // entire line is underlined, remove underline, insert row of dashes - { - curLine = curLine.Replace("\xAB", ""); // remove Underline ON - curLine = curLine.Replace("\xBB", ""); // remove Underline OFF - dashRow += new string('-', chrCnt); - dashRow = "\n" + dashRow; - } - if (rtnStr.Length > 0) rtnStr += "\n"; - rtnStr += curLine; - rtnStr += dashRow; - } - return rtnStr; - } - - /// - /// This will parse a string containing the ascii text of the old style VE-PROMS (16-bit) tables. - /// It will find the number of rows and columns base on newlines, vertical bars, and dashes. - /// Then it will parse the the text, place them in cells, and attempt to merge cells were needed. - /// - /// - public void ParseTableFromText(string buff,GridLinePattern border) - { - string txtbuff = PrepROTableText(buff); - if (IsRoTable) txtbuff = _RemoveComments.Replace(txtbuff, ""); - int curRow = 0; - int curCol = 0; - int maxRow = 0; - int maxCol = 0; - // Get Max Rows and Max Cols - char[] test = "|\n\x02".ToCharArray(); - int idx = 0; - int idxst = 0; - int colPos = 0; - int strow = 0; - Dictionary dicCols = new Dictionary(); - do - { - idx = txtbuff.IndexOfAny(test, idxst); - if (idx > -1) - { - switch (txtbuff[idx]) - { - case '|': // end of a column - colPos = idxst - strow; - if (!dicCols.ContainsKey(colPos)) - dicCols.Add(colPos, curCol); - else if (curCol > dicCols[colPos]) - { - dicCols.Remove(colPos); - dicCols.Add(colPos, curCol); - } - curCol++; - break; - case '\x02': - case '\n': // end of a row - colPos = idxst - strow; - if (!dicCols.ContainsKey(colPos)) - dicCols.Add(colPos, curCol); - else if (curCol > dicCols[colPos]) - { - dicCols.Remove(colPos); - dicCols.Add(colPos, curCol); - } - curRow++; - strow = idx + 1; - if (curCol > maxCol) - maxCol = curCol; - curCol = 0; - break; - } - idxst = idx + 1; - if (idxst >= txtbuff.Length) - idx = -1; - } - } while (idx != -1); - if (idxst < txtbuff.Length) - { - colPos = idxst - strow; - if (!dicCols.ContainsKey(colPos)) - dicCols.Add(colPos, curCol); - else if (curCol > dicCols[colPos]) - { - dicCols.Remove(colPos); - dicCols.Add(colPos, curCol); - } - } - maxRow = curRow; // +1; - curRow = 0; - curCol = 0; - if (maxCol == 0) maxCol = dicCols.Count; - // The resulting Table Grid size in rows and columns - this.Cols.Count = maxCol + 1; - this.Rows.Count = maxRow + 1; - - // make all rows and columns editable - this.Rows.Fixed = 0; - this.Cols.Fixed = 0; - - // TableCellInfo is used to assign merge ranges - // Make a two dimensional array of TableCellinfo the same size as the table grid - TableCellInfo[,] tci = new TableCellInfo[maxRow + 1, maxCol + 1]; - for (int r = 0; r <= maxRow; r++) - for (int c = 0; c <= maxCol; c++) - tci[r, c] = new TableCellInfo(); - // Read in each cell of the grid - idx = 0; - idxst = 0; - colPos = 0; - strow = 0; - int prevCol = 0; - int tstidx = 0; - string tstr = ""; - bool incRow = false; - do - { - idx = txtbuff.IndexOfAny(test, idxst); - if (idx > -1) - { - switch (txtbuff[idx]) - { - case '|': // end of column - colPos = idxst - strow; - // based on the position of the | char, find what column we are in. - // note that this will tell us if any columns to the left were merged - // the while loop will flag cell that need to be merged - curCol = dicCols[colPos]; - while (curCol > prevCol + 1) - { - tci[curRow, prevCol].MergeColRight = true; - prevCol++; - } - prevCol = curCol; - - // parse out the text to be placed in the table cell - tstr = txtbuff.Substring(idxst, idx - idxst); - if (tstr.Length == 0) - tstr += " "; - // test for a string of '-' characters - for (tstidx = 0; (tstidx < tstr.Length) && (tstr[tstidx] == '-'); tstidx++) ; - if (tstidx < tstr.Length) // not a full line (row) of '-' chars - { - // take a peek at the start of the next piece of table text to parse - // if it starts with a '-' char, then flag to merge the columns up to - // this point with the same columns in the next row - if (idx < txtbuff.Length - 1 && txtbuff[idx + 1] == '-') - { - for (int c = curCol; c >= 0; c--) - if (!tci[curRow, c].ColEnd) - tci[curRow, c].MergeRowBellow = true; - } - // if this column is in a merged grouping of rows, - // get the cell text in the first cell of the merged grouping of cells - // we will append the newly parsed text to this cell's text. - int rw = curRow; - while (rw - 1 >= 0 && tci[rw - 1, curCol].MergeRowBellow) rw--; - int cl = curCol; - while (cl - 1 >= 0 && tci[rw, cl-1].MergeColRight) cl--; - //string jstr = (string)this[rw, curCol]; - string jstr = (string)this[rw, cl]; - if (jstr == null) - jstr = tstr; - else - jstr += ((cl==curCol)? "\n" : "") + tstr; // multi line cell - //jstr += "\n" + tstr; // multi line cell - //this[rw, curCol] = jstr; - this[rw, cl] = jstr; - //// take a peek at the start of the next piece of table text to parse - //// if it starts with a '-' char, then flag to merge the columns up to - //// this point with the same columns in the next row - //if (idx < txtbuff.Length - 1 && txtbuff[idx + 1] == '-') - //{ - // for (int c = curCol; c >= 0; c--) - // if (!tci[curRow, c].ColEnd) - // tci[curRow, c].MergeRowBellow = true; - //} - //int tcol = dicCols[idx]; - //// if were are that the end of the 16-bit text line, but not in the last column, - //// merge the remaining columns to the right - //if (curCol < tcol) - //{ - // for (int i = curCol; i <= tcol; i++) - // tci[curRow, i].MergeColRight = true; - //} - } - else // parsed text contains all dashes - { - // take a peek at the start of the next piece of table text to parse - // if it starts with a space, return, newline, or EndOfFile char, - // then flag to merge the columns up to - // this point with the same columns in the next row - if (idx < txtbuff.Length - 1 && " \r\n\x02".IndexOf(txtbuff[idx + 1]) > 0) - { - int nextCol = (curCol + 1 > this.Cols.Count) ? curCol : curCol + 1; - if (!tci[curRow, nextCol].ColEnd) - tci[curRow, nextCol].MergeRowBellow = true; - //for (int c = nextCol; c >= 0; c--) - // if (!tci[curRow, c].ColEnd) - // tci[curRow, c].MergeRowBellow = true; - } - tci[curRow, curCol].ColEnd = true; - incRow = true; - } - break; - case '\x02': // end of file - case '\n': // new line of 16-bit table text - colPos = idxst - strow; - curCol = dicCols[colPos]; - // see what column we are in - new line might occure before last grid column - strow = idx + 1; - // parse out the cell text - tstr = txtbuff.Substring(idxst, idx - idxst); - if (tstr.EndsWith("\r")) // strip off carrage return - tstr = tstr.Substring(0, tstr.Length - 1); - //tstr = tstr.TrimEnd(" ".ToCharArray()); - if (tstr.Length == 0) - tstr += " "; - // test for a string of '-' characters - for (tstidx = 0; (tstidx < tstr.Length) && (tstr[tstidx] == '-'); tstidx++) ; - if (tstidx < tstr.Length) // not a full line (row) of '-' chars - { - //curCol = dicCols[colPos]; - while (curCol > prevCol + 1) - { - tci[curRow, prevCol].MergeColRight = true; - prevCol++; - } - // if this column is in a merged grouping of rows, - // get the cell text in the first cell of the merged grouping of cells - // we will append the newly parsed text to this cell's text. - int rw = curRow; - while (rw - 1 >= 0 && tci[rw - 1, curCol].MergeRowBellow) rw--; - int cl = curCol; - while (cl - 1 >= 0 && tci[rw, cl-1].MergeColRight) cl--; - //string jstr = (string)this[rw, curCol]; - string jstr = (string)this[rw, cl]; - if (jstr == null) - jstr = tstr; - else - jstr += ((cl == curCol) ? "\n" : "") + tstr; // multi line cell - //jstr += "\n" + tstr; // multi line cell - - //this[rw, curCol] = jstr; - this[rw, cl] = jstr; - } - else if (tstr.Length > 0) // parsed text is all dash characters - { - incRow = true; - if (curRow > 0 && curCol > 0) // merge the column in the previous row with this one - tci[curRow - 1, curCol].MergeRowBellow = false; - } - // if were are that the end of the 16-bit text line, but not in the last column, - // merge the remaining columns to the right - if ((curCol < maxCol) && (tstidx < tstr.Length)) - { - for (int i = curCol; i < maxCol; i++) - tci[curRow, i].MergeColRight = true; - } - if (incRow) - curRow++; - curCol = 0; - incRow = false; - break; - } - idxst = idx + 1; - if (idxst >= txtbuff.Length) - idx = -1; - } - else if (idxst < txtbuff.Length - 1) // handle any remaining text not yet parsed - { - // find the curent column and merge remaining columns to the right - colPos = idxst - strow; - curCol = dicCols.Count==0?0:dicCols[colPos]; - while (curCol > prevCol + 1) - { - tci[curRow, prevCol].MergeColRight = true; - prevCol++; - } - // parse out the remaining text - tstr = txtbuff.Substring(idxst); - //tstr = tstr.TrimEnd(" ".ToCharArray()); - if (tstr.Length == 0) - tstr += " "; - // test for a string of '-' characters - for (tstidx = 0; (tstidx < tstr.Length) && (tstr[tstidx] == '-'); tstidx++) ; - if (tstidx < tstr.Length) - { - // if this column is in a merged grouping of rows, - // get the cell text in the first cell of the merged grouping of cells - // we will append the newly parsed text to this cell's text. - int rw = curRow; - while (rw - 1 >= 0 && tci[rw - 1, curCol].MergeRowBellow) rw--; - int cl = curCol; - while (cl - 1 >= 0 && tci[rw, cl-1].MergeColRight) cl--; - //string jstr = (string)this[rw, curCol]; - string jstr = (string)this[rw, cl]; - if (jstr == null) - jstr = tstr; - else - jstr += ((cl == curCol) ? "\n" : "") + tstr; // multi line cell - //jstr += "\n" + tstr; // multi line cell - //this[rw, curCol] = jstr; - this[rw, cl] = jstr; - } - } - } while (idx != -1); - - // we are done parsing the 16-bit text. - // now set the merge ranges in the table grid, based on the - // information saved in that two dimensional array of TableCellinfo - this.Rows.Count = curRow + 1; - this.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom; - maxRow = curRow; - int rR = 0; - int rC = 0; - for (int r = 0; r <= maxRow; r++) - for (int c = 0; c <= maxCol; c++) - { - if (tci[r, c].MergeColRight) - { - rC = c; - while ((rC < maxCol) && (tci[r, rC].MergeColRight)) rC++; - if (rC > c) - { - this.MergedRanges.Add(this.GetCellRange(r, c, r, rC)); - string cellstr = (this[r,c]==null)? " ": this[r, c].ToString(); - for (int x = c + 1; x <= rC; x++) - this[r, x] = cellstr; - c = rC; - } - } - } - for (int c = 0; c <= maxCol; c++) - for (int r = 0; r <= maxRow; r++) - { - if (tci[r, c].MergeRowBellow) - { - rR = r; - while ((rR < maxRow) && (tci[rR, c].MergeRowBellow)) rR++; - if (rR > r) - { - this.MergedRanges.Add(this.GetCellRange(r, c, rR, c)); - string cellstr = this[r, c].ToString(); - for (int x = r + 1; x <= rR; x++) - this[x, c] = cellstr; - r = rR; - } - } - } - for (int c = 0; c <= maxCol; c++) - for (int r = 0; r <= maxRow; r++) - { - if (this[r, c] != null) - { - string cellstr = this[r, c].ToString(); - this[r, c] = cellstr.TrimEnd("\r\n\t".ToCharArray()); - //this[r, c] = cellstr.TrimEnd(" \r\n\t".ToCharArray()); - CellRange cr = this.GetMergedRange(r, c); - if (cr.r1 != cr.r2) - TrimMergedRangeCellText(cr); - } - } - MyBorders = new VlnBorders(border, Rows.Count, Cols.Count); - MyShading = new VlnGridCellShading(Color.White, Rows.Count, Cols.Count); // C2021-004 setup shading information - } - - private void TrimMergedRangeCellText(CellRange cr) - { - // count number of newlines - string cellstr = this[cr.r1, cr.c1].ToString(); - string[] strary = cellstr.Split("\n".ToCharArray()); - int nlines = strary.Length; - // count number of rows in merge range - int nrows = (cr.r2 - cr.r1) + 1; - int neededLines = (nlines - (nrows - 1)); - bool bNeedToTrim = (nlines > neededLines); - string jstr = ""; - int LinesToGo = neededLines; - if (bNeedToTrim) - { - int numBlanksEnd = 0; - // find the number of blank lines at the end of this table cell - for (int i = nlines-1; i >= 0; i--) - { - if (strary[i].Trim().Length == 0) - numBlanksEnd++; - else - break; - } - int preBlanksLines = 0; - //foreach (string tmpstr in strary) - // we ignore the ending blank lines - // this allows us to include any blank lines that are between text lines - for (int i = 0; i < nlines - numBlanksEnd; i++) - { - string tmpstr = strary[i]; - int tlen = tmpstr.Trim().Length; - if (tlen > 0 || (LinesToGo < neededLines)) - { - if (jstr.Length > 0) jstr += "\n"; - jstr += tmpstr; - LinesToGo--; - } - else if (LinesToGo == (nlines - (nrows - 1))) - preBlanksLines++; - } - while (LinesToGo > 0) - { - // need to put this type of hard space (not \xA0) to hold the newline position - if (preBlanksLines > 0) - { - jstr = "\\~\n" + jstr; - LinesToGo--; - } - if (numBlanksEnd > 0) - { - jstr += "\n\\~"; - LinesToGo--; - } - } - this[cr.r1, cr.c1] = jstr; - } - } - - #endregion //Import / Export Grid - - #region Bug Work Around - protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e) - { - - // Note: this fixes a bug that happens when the grid has more rows than columns - // notified ComponentOne of the problem 6/25/09 via Email - try - { - base.OnMouseDown(e); - } - catch (Exception ex) - { - while (ex != null) - { - Console.WriteLine("{0} {1} {2}", ex.GetType().Name, ex.Message, ex.StackTrace); - ex = ex.InnerException; - } - } - - } - #endregion //Bug Work Around - - //public void CenterTheCellText() - //{ - // // Cannot use this type of text allignment with RTF text cells - // CellRange cr = this.Selection; - // for (int rw = cr.r1; rw <= cr.r2; rw++) - // for (int col = cr.c1; col <= cr.c2; col++) - // { - // CellRange tmp = this.GetCellRange(rw, col, rw, col); - // string StyleName = string.Format("R{0}C{1}Style", rw, col); - // CellStyle cs = this.Styles.Add(StyleName, tmp.Style); - // cs.TextAlign = TextAlignEnum.CenterCenter; - // tmp.Style = cs; - // } - - //} - #region Uneven Selections - /// - /// True if the top and bottom row of the selection is the same for every column - /// - public bool EvenSelection - { - get - { - if (Selection.c1 < 0 || Selection.c2 < 0 || Selection.r1 < 0 || Selection.r2 < 0) return true; // Even if there is no selection - if (Selection.IsSingleCell) return true; // One cell by definition is Even - int cMin = MinimumColumn(Selection.r1, Selection.c1); // Get the left column of the top row - int cMax = MaximumColumn(Selection.r1, Selection.c2); // Get the right column of the top row - for (int r = Selection.r1 + 1; r <= Selection.r2; r++) - { - // Uneven if the top row in this column doesn't match the first column - if (MinimumColumn(r, Selection.c1) != cMin) - return false; - // Uneven if the bottom row in this column doesn't match the first column - if (MaximumColumn(r, Selection.c2) != cMax) - return false; - } - int rMin = MinimumRow(Selection.r1, Selection.c1); // Get the top row of the left column - int rMax = MaximumRow(Selection.r2, Selection.c1); // Get the bottom row of the left column - for (int c = Selection.c1 + 1; c <= Selection.c2; c++) - { - // Uneven if the top row in this column doesn't match the first column - if (MinimumRow(Selection.r1, c) != rMin) - return false; - // Uneven if the bottom row in this column doesn't match the first column - if (MaximumRow(Selection.r2, c) != rMax) - return false; - } - return true; - } - } - public void MakeSelectionEven() - { - if (Selection.IsSingleCell) return; // One cell by definition is Even - MakeSelectionEven(Selection.r1, Selection.c1, Selection.r2, Selection.c2); - } - public void SelectRow() - { - MakeSelectionEven(Selection.r1, 0, Selection.r2, Cols.Count - 1); - } - public void SelectCol() - { - MakeSelectionEven(0, Selection.c1, Rows.Count - 1, Selection.c2); - } - public void MakeSelectionEven(int r1,int c1, int r2, int c2) - { - if (c1 < 0 || c2 < 0 || r1 < 0 || r2 < 0) return; // if there is no selection don't bother - CellRange cr = GetEvenSelection(r1, c1, r2, c2); - Select(cr); - } - - public CellRange GetEvenSelection() - { - return GetEvenSelection(Selection.r1, Selection.c1, Selection.r2, Selection.c2); - } - - public CellRange GetEvenSelection(int r1, int c1, int r2, int c2) - { - int cMinNew = MinimumColumn(r1, c1); // Get the left column of the top row - int cMaxNew = MaximumColumn(r1, c2); // Get the right column of the top row - int rMinNew = MinimumRow(r1, c1); // Get the top row of the left column - int rMaxNew = MaximumRow(r2, c1); // Get the bottom row of the left column - int cMin = cMinNew; - int cMax = cMaxNew; - int rMin = rMinNew; - int rMax = rMaxNew; - do - { - cMin = cMinNew; - cMax = cMaxNew; - rMin = rMinNew; - rMax = rMaxNew; - for (int r = rMin; r <= rMax; r++) - { - // Uneven if the top row in this column doesn't match the first column - int myMin = MinimumColumn(r, cMin); - if (myMin < cMinNew) - cMinNew = myMin; - // Uneven if the bottom row in this column doesn't match the first column - int myMax = MaximumColumn(r, cMax); - if (myMax > cMaxNew) - cMaxNew = myMax; - } - for (int c = cMinNew; c <= cMaxNew; c++) - { - // if the top row in this column is less than the minimum save it - int myMin = MinimumRow(rMin, c); - if (myMin < rMinNew) - rMinNew = myMin; - // Uneven if the bottom row in this column doesn't match the first column - int myMax = MaximumRow(rMax, c); - if (myMax > rMax) - rMaxNew = myMax; - } - } - while (cMinNew < cMin || cMaxNew > cMax || rMinNew < rMin || rMaxNew > rMax); - CellRange cr = GetCellRange(rMinNew, cMinNew, rMaxNew, cMaxNew); - return cr; - } - private int MinimumColumn(int r, int c) - { - return GetMergedRange(r, c).c1; - } - private int MaximumColumn(int r, int c) - { - return GetMergedRange(r, c).c2; - } - private int MinimumRow(int r, int c) - { - return GetMergedRange(r, c).r1; - } - private int MaximumRow(int r, int c) - { - return GetMergedRange(r, c).r2; - } - public Color StyleBackColor - { - get {return Styles.Normal.BackColor;} - set - { - Styles.Normal.BackColor = value; - Styles.Alternate.BackColor = value; - for (int c = 0; c < Cols.Count; c++) - for (int r = 0; r < Rows.Count; r++) - { - CellRange cr = GetMergedRange(r, c); - if (cr.Style != null && cr.Style.BackColor != value && cr.Style.Name != "Fixed") - { - cr.Style.BackColor = value; - } - } - } - } - /// - /// Returns a list of cells or merged cells within the selection - /// - public List MySelection - { - get - { - List ranges = new List(); - for (int c = Selection.c1; c <= Selection.c2; c++) - for (int r = Selection.r1; r <= Selection.r2; r++) - { - CellRange cr = GetMergedRange(r, c); - if (!ranges.Contains(cr)) - ranges.Add(cr); - } - //} - return ranges; - } - } - /// - /// This is a test to see if MySelection works. - /// - public void BoldMySelection() - { - foreach (CellRange cr in MySelection) - { - using (StepRTB rtb = new StepRTB()) - { - rtb.Rtf = GetCellRTFString(cr.r1, cr.c1); - rtb.SelectAll(); - rtb.SelectionFont = new Font(rtb.SelectionFont, FontStyle.Bold); - this[cr.r1, cr.c1] = rtb.Rtf; - } - } - } - - public void ShowMySelection() - { - int r1 = MySelection[0].r1; - int r2 = MySelection[0].r2; - int c1 = MySelection[0].c1; - int c2 = MySelection[0].c2; - foreach (CellRange cr in MySelection) - { - r1 = Math.Min(r1, cr.r1); - c1 = Math.Min(c1, cr.c1); - r2 = Math.Max(r2, cr.r2); - c2 = Math.Max(c2, cr.c2); - } - Select(r1,c1,r2,c2); - } - - public void Debug_WritelineMySelection() - { - int r1 = MySelection[0].r1; - int r2 = MySelection[0].r2; - int c1 = MySelection[0].c1; - int c2 = MySelection[0].c2; - Console.WriteLine("Initial MySelection[0] {0}", MySelection[0]); - foreach (CellRange cr in MySelection) - { - r1 = Math.Min(r1, cr.r1); - c1 = Math.Min(c1, cr.c1); - r2 = Math.Max(r2, cr.r2); - c2 = Math.Max(c2, cr.c2); - Console.WriteLine("Foreach range ({0},{1}) - ({2},{3})", r1, c1, r2, c2); - } - } - - #endregion - } - /// - /// This is used for storing the grid selection for copy/past Row/Column - /// - public enum GridCopyOption { Row, Column, Selection }; - - #region RTF Class for Cell rendering - /// - /// RTF Should only be used if the contents of the richtextbox are to be converted to an image. - /// - public class RTF : StepRTB - { - // messages used by RichEd20.dll - internal const int - WM_USER = 0x0400, - EM_FORMATRANGE = WM_USER + 57; - - // FORMATRANGE is used by RichEd20.dll to render RTF - internal struct FORMATRANGE - { - internal IntPtr hdc, hdcTarget; - internal Rectangle rc, rcPage; - internal int cpMin, cpMax; - } - - // render the control directly into a given Graphics object - // (this does not honor clipping set in the target Graphics object; it that is - // a problem, use the RenderClipped method instead). - public void Render(Graphics g, Rectangle rc) - { - // convert rect from pixels to twips - rc.X = (int)(rc.X * 1440 / g.DpiX); - rc.Y = (int)(rc.Y * 1440 / g.DpiY); - rc.Width = rc.X + (int)((rc.Width) * 1440 / g.DpiX); - rc.Height = rc.Y + (int)((rc.Height) * 1440 / g.DpiY); - - // get dc - IntPtr hdc = g.GetHdc(); - - // set up FORMATRANGE struct - FORMATRANGE fmt = new FORMATRANGE(); - fmt.hdc = fmt.hdcTarget = hdc; - fmt.rc = fmt.rcPage = rc; - fmt.cpMin = 0; - fmt.cpMax = -1; - - // render RTF - int render = 1; - SendMessageFormatRange(Handle, EM_FORMATRANGE, render, ref fmt); - - // clean up - SendMessage(Handle, EM_FORMATRANGE, render, 0); - - // done with dc - g.ReleaseHdc(hdc); - } - - // render RTF into a Graphics object using a temporary bitmap to ensure - // clipping works correctly. - public void RenderClipped(Graphics g, Rectangle rc) - { - // create temp bitmap - Rectangle rcSrc = new Rectangle(0, 0, rc.Width, rc.Height); - using (Bitmap bmp = new Bitmap(rc.Width, rc.Height)) - { - // render RTF into bitmap - using (Graphics gBmp = Graphics.FromImage(bmp)) - { - Render(gBmp, rcSrc); - // transfer bitmap to original Graphics object - // (this honors clipping set in the target Graphics object) - g.DrawImage(bmp, rc, rcSrc, GraphicsUnit.Pixel); - } - } - } - - // SendMessage - [DllImport("USER32.DLL", CharSet = CharSet.Auto)] - static private extern int SendMessage( - IntPtr hWnd, - uint wMsg, - int wParam, - int lParam); - [DllImport("USER32.DLL", CharSet = CharSet.Auto, EntryPoint = "SendMessage")] - static private extern int SendMessageFormatRange( - IntPtr hWnd, - uint wMsg, - int wParam, - ref FORMATRANGE lParam); - } - - #endregion //RTF Class for Cell rendering - # region TableCellInfo for text parse - class TableCellInfo - { - private bool _MergeRowBellow; - - public bool MergeRowBellow - { - get { return _MergeRowBellow; } - set { _MergeRowBellow = value; } - } - private bool _MergeColRight; - - public bool MergeColRight - { - get { return _MergeColRight; } - set { _MergeColRight = value; } - } - private bool _ColEnd; - - public bool ColEnd - { - get { return _ColEnd; } - set { _ColEnd = value; } - } - private string _Text; - - public string Text - { - get { return _Text; } - set { _Text = value; } - } - } - #endregion //TableCellInfo for text parse - #region TableCellEditor - /// - /// TableCellEditor inherits from a StepRTB and is used as a custom cell editor - /// for the C1FlexGrid control. - /// - public class TableCellEditor : StepRTB //System.Windows.Forms.RichTextBox //System.Windows.Forms.TextBox // System.Windows.Forms.ComboBox - { - private VlnFlexGrid _owner; - private int _row, _col; - private char _pendingKey; - private bool _cancel; - public bool _initializingEdit; - - // constructor: attach to owner grid - public TableCellEditor(VlnFlexGrid owner) - { - Visible = false; - AutoSize = false; - BackColor = Color.SkyBlue; - BorderStyle = BorderStyle.None; - ScrollBars = RichTextBoxScrollBars.None; - _initializingEdit = false; - _pendingKey = (char)0; - _cancel = false; - _owner = owner; - _owner.Controls.Add(this); - this.CursorMovement += new StepRTBCursorMovementEvent(TableCellEditor_CursorMovement); - this.CursorKeyPress += new StepRTBCursorKeysEvent(TableCellEditor_CursorKeyPress); - this.Leave += new EventHandler(_editor_Leave); - this.SelectionChanged += TableCellEditor_SelectionChanged; - //this.HeightChanged += new StepRTBEvent(_HeightChanged); - } - - // C2021-005 selecting characters in the cell text editor - private void TableCellEditor_SelectionChanged(object sender, EventArgs e) - { - if (!_initializingEdit) - { - float fnSz = GetRTFFontSize(); // returns the font size in pts from the text's RTF - _owner.SelectedFontSize = fnSz; // will trigger the changing of the font size from VlnFlexGrid class - // B2022-137 Table performance improvements - moved ShowTableCellShading to the onLeave call - //_owner.ShowTableCellShading(); //C2021-004 display any background color change when you move off a cell - } - } - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - } - // start editing: move to cell and activate - // C2021-005 added the showEditor - set to true when we are getting the font size of the text - public void StartEditing(int row, int col, bool showEditor) - { - ItemInfo pinfo = MyItemInfo.MyProcedure as ItemInfo; - DocVersionInfo dvi = (pinfo == null) ? null : pinfo.ActiveParent as DocVersionInfo; - _initializingEdit = true; - ReadOnly = IsRoTable || !UserInfo.CanEdit(MyUserInfo, dvi); // reviewer cannot make changes to a table - // save coordinates of cell being edited - _row = row; - _col = col; - //this.Clear(); //jsj - // assume we'll save the edits - _cancel = false; - // move editor over the current cell - Rectangle rc = _owner.GetCellRect(row, col, true); - rc.Width--; - rc.Height--; - Bounds = rc; - // initialize control content - Text = ""; - FindAllLinks(); // jsj 1-5-2011 - if (_pendingKey > ' ' && !ReadOnly) - { - if(_pendingKey == '\\') - SendKeys.Send("\\"); // B2016-162 Send a backslash which will be converted to "\u9586?" - else - Text = _pendingKey.ToString(); - } - else if (_owner[row, col] != null) - { - string tmp = _owner[row, col].ToString(); - // convert \'99 to \u8482? this is for the trade mark symbol. For some reason RTF is automatically - // converting the unicode \u8482? to \'99, but once this is done, PROMS StepRTB (edit windows) do not show it - // Also convert \~ to a hard spece. Again RTF is automatically converting \u160? to \~ but will then convert - // the \~ to a regular space! - if (tmp.StartsWith(@"{\rtf")) - Rtf = RtfTools.RTFConvertedSymbolsToUnicode(tmp);//.Replace(@"\~", @"\u160?").Replace(@"\'99", @"\u8482?"); - else - Text = tmp; - } - Select(Text.Length, 0); - - Size sz = new Size(rc.Width, rc.Height); - - //this.Size = sz; - this.Width = rc.Width; - - if (!showEditor) // C2021-005 if we are getting the font size don't show the editor - { - // make editor visible - Visible = true; - } - - // and get the focus - //Select(); - Focus(); - _initializingEdit = false; - } - - void TableCellEditor_CursorKeyPress(object sender, KeyEventArgs args) - { - //throw new Exception("The method or operation is not implemented."); - } - - void TableCellEditor_CursorMovement(object sender, StepRTBCursorMovementEventArgs args) - { - int row = _owner.Selection.r1; - int col = _owner.Selection.c1; - CellRange cr = _owner.GetMergedRange(row, col); - //Console.WriteLine("keystroke {0} selection {1},{2}", args.Key, row, col); - //vlnStackTrace.ShowStack("keystroke {0} selection {1},{2}", args.Key, row, col); - _owner.Select(); - // See if we are in a merged range of cells. - // if so, use the merged range instead of the selected range - // so that we can jump to the top/bottom/left/right of the range - // before attempting the move to the next grid cell. - //int idx = _owner.MergedRanges.IndexOf(row, col); - //if (idx > -1) cr = _owner.MergedRanges[idx]; - - switch (args.Key) - { - case VEPROMS.CSLA.Library.E_ArrowKeys.CtrlDown: - case VEPROMS.CSLA.Library.E_ArrowKeys.Down: - row = cr.r2; - if (row < _owner.Rows.Count - 1) - _owner.Select(_owner.GetMergedRange(row + 1, col)); - else - _owner.OnCursorMovement(this, new VlnFlexGridCursorMovementEventArgs(args.Key)); - break; - case VEPROMS.CSLA.Library.E_ArrowKeys.CtrlLeft: - case VEPROMS.CSLA.Library.E_ArrowKeys.Left: - col = cr.c1; - if (col > 0) - _owner.Select(_owner.GetMergedRange(row, col - 1)); - else if(row > 0) - _owner.Select(_owner.GetMergedRange(row - 1, _owner.Cols.Count - 1)); - else - _owner.OnCursorMovement(this, new VlnFlexGridCursorMovementEventArgs(args.Key)); - break; - case VEPROMS.CSLA.Library.E_ArrowKeys.CtrlRight: - case VEPROMS.CSLA.Library.E_ArrowKeys.Right: - col = cr.c2; - if (col < _owner.Cols.Count - 1) - _owner.Select(_owner.GetMergedRange(row, col + 1)); - else if (cr.r2 < _owner.Rows.Count - 1) - { - CellRange crDest = _owner.GetMergedRange(cr.r2 + 1, 0); - if (cr.r2 < crDest.r1) // It will move to the correct place - _owner.Select(crDest); - else if (crDest.r2 < _owner.Rows.Count -1) //B2017066 check against count -1 to avoid index out of range error - _owner.Select(_owner.GetMergedRange(crDest.r2 + 1, 0)); - else - _owner.OnCursorMovement(this, new VlnFlexGridCursorMovementEventArgs(args.Key)); - } - else - _owner.OnCursorMovement(this, new VlnFlexGridCursorMovementEventArgs(args.Key)); - break; - case VEPROMS.CSLA.Library.E_ArrowKeys.CtrlUp: - case VEPROMS.CSLA.Library.E_ArrowKeys.Up: - row = cr.r1; - if (row > 0) - _owner.Select(_owner.GetMergedRange(row - 1, col)); - else - _owner.OnCursorMovement(this, new VlnFlexGridCursorMovementEventArgs(args.Key)); - break; - default: - break; - } - //Console.WriteLine("selection {0}", _owner.Selection); - //_owner.Focus(); // focus was jumping out of the grid this keeps it in. - } - - // after edit handler (custom editor) - void _editor_Leave(object sender, EventArgs e) - { - _owner.Invalidate(); - _owner.AdjustGridControlSize(); - } - //void _HeightChanged(object sender, EventArgs args) - //{ - // _owner.Invalidate(); - //} - - // save key that started the editing mode - public void SetPendingKey(char chr) - { - _pendingKey = chr; - } - - // expose internal variables - public bool Cancel { get { return _cancel; } } - public int Row { get { return _row; } } - public int Col { get { return _col; } } - - // move editor after the grid has scrolled - public void UpdatePosition() - { - // get cell rect now - Rectangle rcCell = _owner.GetCellRect(_row, _col, false); - - // intersect with scrollable part of the grid - Rectangle rcScroll = _owner.ClientRectangle; - rcScroll.X = _owner.Cols[_owner.Cols.Fixed].Left; - rcScroll.Y = _owner.Rows[_owner.Rows.Fixed].Top; - rcScroll.Width -= rcScroll.X; - rcScroll.Height -= rcScroll.Y; - rcCell = Rectangle.Intersect(rcCell, rcScroll); - - // and move the control - if (rcCell.Width > 0) rcCell.Width--; - if (rcCell.Height > 0) rcCell.Height--; - Bounds = rcCell; - - Size sz = new Size(_owner.GetCellRect(_row, _col).Width, _owner.GetCellRect(_row, _col).Height); - this.Size = sz; - } - - // lost focus: hide the editor - override protected void OnLeave(System.EventArgs e) - { - // base processing - base.OnLeave(e); - - // copy text to owner grid - if (!_cancel) - { - _owner[_row, _col] = Rtf; //Text; - } - // no more pending keys - _pendingKey = (char)0; - - // done for now, hide editor - Visible = false; - _owner.ShowTableCellShading(); // B2022-137 restore shading if table after editing a cell - } - - // we will handle the Tab key ourselves - override protected bool IsInputKey(Keys keyData) - { - if (keyData == Keys.Tab) return true; - return base.IsInputKey(keyData); - } - - //// some keys end the editing - //override protected void OnKeyDown(System.Windows.Forms.KeyEventArgs e) - //{ - // switch (e.KeyCode) - // { - // case Keys.Escape: // cancel edits - // _cancel = true; - // _owner.Select(); - // e.Handled = true; - // return; - - // case Keys.Enter: // finish editing - // case Keys.Tab: - // case Keys.Up: - // case Keys.Down: - // case Keys.PageUp: - // case Keys.PageDown: - // _owner.Select(); - // e.Handled = true; - // MoveCursor(e.KeyCode); - // return; - - // default: // default processing - // base.OnKeyDown(e); - // return; - // } - //} - - //// move cursor after done editing - //protected void MoveCursor(Keys key) - //{ - // int row = _owner.Row; - // int col = _owner.Col; - // switch (key) - // { - // case Keys.Tab: col++; break; - // case Keys.Up: row--; break; - // //case Keys.Return: row++; break; - // case Keys.Down: row++; break; - // //case Keys.PageUp: row -= 10; break; - // //case Keys.PageDown: row += 10; break; - // } - - // // validate new selection - // if (row < _owner.Rows.Fixed) row = _owner.Rows.Fixed; - // if (col < _owner.Cols.Fixed) col = _owner.Cols.Fixed; - // if (row > _owner.Rows.Count - 1) row = _owner.Rows.Count - 1; - // if (col > _owner.Cols.Count - 1) col = _owner.Cols.Count - 1; - - // // apply new selection - // _owner.Select(row, col); - //} - - //// suppress some keys to avoid annoying beep - //override protected void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e) - //{ - // switch (e.KeyChar) - // { - // case (char)27: // Keys.Escape: - // case (char)13: // Keys.Enter: - // case (char)9: // Keys.Tab: - // e.Handled = true; - // return; - // } - // base.OnKeyPress(e); - //} - } - #endregion // TableCellEditor - #region TableClipBoardFuncts Class - class TableClipBoardFuncts - { - DataFormats.Format dfmtTableCellRange = DataFormats.GetFormat("TableCellRange"); - private SelectedTableCells mySeldTableCellsObject; - private DataObject myDataObject; - public TableClipBoardFuncts() - { - //mySeldTableCellsObject = new DataObject(dfmtTableCellRange.Name, seldTableCells); - } - - public void Put(CellRange cr) - { - // Copies myObject into the clipboard. - // Clip get the value (text) of all the cells in the selected range - // This is saved as one RTF string. - Clipboard.SetDataObject(cr.Clip, true); // the "true" make the copy persistent - //Console.WriteLine("\nClip: '{0}' \n'{1}'", cr.Clip,cr.DataDisplay); - //mySeldTableCellsObject = new SelectedTableCells(); - //mySeldTableCellsObject.CpbrdCellRange = cr; - // myDataObject = new DataObject(dfmtTableCellRange.Name, mySeldTableCellsObject); - // try - // { - // Clipboard.SetDataObject(myDataObject); //,true); - // } - // catch (Exception ex) - // { - // Console.WriteLine(ex.Message); - // } - - } - - public ArrayList Get() - { - // Retrieves the data from the clipboard. - IDataObject myRetrievedObject = Clipboard.GetDataObject(); - string jj = (string)myRetrievedObject.GetData(DataFormats.Text); - return GetCellStrings(jj); - } - - //public CellRange get_cr_Paste() - //{ - // mySeldTableCellsObject = new SelectedTableCells(); - // CellRange cr = new CellRange(); - // SelectedTableCells sc; - // IDataObject myRetrievedObject = Clipboard.GetDataObject(); - // try - // { - // //object obj = myRetrievedObject.GetData(dfmtTableCellRange.Name); - // object obj = myRetrievedObject.GetData("TableCellRange"); - // //sc = (SelectedTableCells)myRetrievedObject.GetData(dfmtTableCellRange.Name); - // sc = (SelectedTableCells)obj; - // cr = sc.CpbrdCellRange; - // } - // catch (Exception ex) - // { - // Console.WriteLine(ex.Message); - // } - // return cr; - //} - - private ArrayList GetCellStrings(string instr) - { - // The table cells placed on the clipboard is saved as one long RTF string. - // "\r\n\t" defines a cell border - // "\r\n\r" defines beginning of next line (row) - // This function will separate each cell text and place them in an array. - // This allow the clipboard information to be pasted independently from - // how it was selected. - - // Bug fix: the CellRange.Clip (see cr.clip in the Put() function above) is replacing - // new lines with spaces. We need to put them back. - instr = instr.Replace(@"}} \", "}}\r\n\\"); - string tstr = ""; // this will contain the parsed out cell text - ArrayList arylstCellStrings = new ArrayList(); - int sidx = 0; // start index - int tidx = 0; - if (instr != null) - { - int idx = instr.IndexOf(@"{\rtf",sidx+1); // cell boarder - while (idx > 0) - { - tstr = instr.Substring(sidx, idx - sidx); - tstr = tstr.Substring(0, tstr.LastIndexOf('}') + 1); - //Console.WriteLine("\ntstr: '{0}'", tstr); - arylstCellStrings.Add(tstr); - sidx = idx; - idx = instr.IndexOf(@"{\rtf",sidx+1); - } - if (sidx < instr.Length) - { - tstr = instr.Substring(sidx); - arylstCellStrings.Add(tstr); - } - } - return arylstCellStrings; - } - - //private ArrayList GetCellStrings(string instr) - //{ - // // The table cells placed on the clipboard is saved as one long RTF string. - // // "\r\n\t" defines a cell border - // // "\r\n\r" defines beginning of next line (row) - // // This function will separate each cell text and place them in an array. - // // This allow the clipboard information to be pasted independently from - // // how it was selected. - - // string tstr = ""; // this will contain the parsed out cell text - // ArrayList arylstCellStrings = new ArrayList(); - // int sidx = 0; // start index - // int tidx = 0; - // if (instr != null) - // { - // int idx = instr.IndexOf("\r\n\t"); // cell boarder - // if (idx < 0) idx = instr.IndexOf("\r\n\r"); // new line (needed for multiple lines in one cell) - // while (idx > 0) - // { - // tstr = instr.Substring(sidx, idx - sidx); - // tidx = tstr.IndexOf("\r\n\r"); - // if (tidx > 0) - // { - // idx = instr.IndexOf("\r\n\r", sidx); - // tstr = instr.Substring(sidx, idx - sidx); - // } - // arylstCellStrings.Add(tstr.Substring(tstr.IndexOf("{\\rtf"))); - // sidx = idx + 3; - // if (sidx < instr.Length) - // { - // idx = instr.IndexOf("\r\n\t", sidx); - // if (idx < 0) idx = instr.IndexOf("\r\n\r", sidx); - // } - // } - // if (sidx < instr.Length) - // { - // tstr = instr.Substring(sidx); - // arylstCellStrings.Add(tstr.Substring(tstr.IndexOf("{\\rtf"))); - // } - // } - // return arylstCellStrings; - //} - } - - [Serializable] - public class SelectedTableCells : Object - { - private CellRange _cpbrdCellRange; - - public CellRange CpbrdCellRange - { - get { return _cpbrdCellRange; } - set { _cpbrdCellRange = value; } - } - public SelectedTableCells() - { - } - } - #endregion // TableClipBoardFuncts Class - public class VlnFlexGridCursorMovementEventArgs - { - private E_ArrowKeys _Key; - public E_ArrowKeys Key - { - get { return _Key; } - set { _Key = value; } - } - public VlnFlexGridCursorMovementEventArgs(E_ArrowKeys key) - { - _Key = key; - } - } - public class VlnFlexGridPasteEventArgs - { - private string _Text; - public string Text - { - get { return _Text; } - set { _Text = value; } - } - public VlnFlexGridPasteEventArgs(string text) - { - _Text = text; - } - } - public class GridCopyInfo - { - private GridCopyOption _MyCopyOption = GridCopyOption.Selection; - - public GridCopyOption MyCopyOption - { - get { return _MyCopyOption; } - set - { - //Console.WriteLine("MyCopyOption = {0}", _MyCopyOption); - //if (_MyCopyOption != value) - // Console.WriteLine("Changed Option to {0}", value); - _MyCopyOption = value; - } - } - private VlnFlexGrid _MyCopiedFlexGrid = null; - - public VlnFlexGrid MyCopiedFlexGrid - { - get { return _MyCopiedFlexGrid; } - set { _MyCopiedFlexGrid = value; } - } - private CellRange _MyCopiedCellRange; - - public CellRange MyCopiedCellRange - { - get { return _MyCopiedCellRange; } - set { _MyCopiedCellRange = value; } - } - - } -} diff --git a/PROMS/Volian.Controls.Library/VlnFlexGrid.resx b/PROMS/Volian.Controls.Library/VlnFlexGrid.resx deleted file mode 100644 index 52a9ad3e..00000000 --- a/PROMS/Volian.Controls.Library/VlnFlexGrid.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/VlnGridCellShading.cs b/PROMS/Volian.Controls.Library/VlnGridCellShading.cs deleted file mode 100644 index f172aecf..00000000 --- a/PROMS/Volian.Controls.Library/VlnGridCellShading.cs +++ /dev/null @@ -1,319 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml; -using System.Xml.Serialization; -using System.Xml.Schema; -using System.Drawing; -using Volian.Base.Library; - -namespace Volian.Controls.Library -{ - [Serializable] - [XmlRoot("VlnGridCellShading")] -// C2021-004 Table Cell Shading - public class VlnGridCellShading - { - #region Properties - private int _Rows; - [XmlAttribute("Rows")] - public int Rows - { - get { return _Rows; } - set { _Rows = value; } - } - private int _Columns; - [XmlAttribute("Columns")] - public int Columns - { - get { return _Columns; } - set { _Columns = value; } - } - private CellShadingArray _TableShadingInfo; - public CellShadingArray TableShadingInfo - { - get { return _TableShadingInfo; } - set { _TableShadingInfo = value; } - } - #endregion - #region ctor - public VlnGridCellShading() {; } - public VlnGridCellShading(Color defaultCellshading, int rows, int columns) - { - Rows = rows; - Columns = columns; - string defCellColorARGB = GetARGBstring(defaultCellshading); - TableShadingInfo = new CellShadingArray(defCellColorARGB, Rows, Columns); - } - #endregion - #region SetRange - Set the shading color over a range of cells - public Color GetColor(int row, int col) - { - Color cellColor; - // initialize the ARGB value to white - int Alpha = 255; - int Red = 255; - int Green = 255; - int Blue = 255; - // if the given row or column is within the table range, get the stored cell color - // otherwise default to white. - // This also catches when row and col are -1 when exiting PROMS while on a table - if (row > -1 && col > -1 && row < TableShadingInfo.Rows && col < TableShadingInfo.Columns) - { - string cellShadeColor = TableShadingInfo[row, col]; - // The color is saved as ARGB in a string (i.e. "[A=255, R=157, G=187, B-97]") in the table xlm definition (SQL record) - cellShadeColor = cellShadeColor.Replace("[", "").Replace("]", "").Replace(" ", ""); // remove starting and ending square brackets - // split the string on the commas and find each ARGB value - string[] argbSplit = cellShadeColor.Split(','); - foreach (string s in argbSplit) - { - if (s[0] == 'A') - Alpha = Convert.ToInt32(s.Substring(2)); - else if (s[0] == 'R') - Red = Convert.ToInt32(s.Substring(2)); - else if (s[0] == 'G') - Green = Convert.ToInt32(s.Substring(2)); - else if (s[0] == 'B') - Blue = Convert.ToInt32(s.Substring(2)); - } - } - cellColor = Color.FromArgb(Alpha, Red, Green, Blue); - return cellColor; - } - public string GetARGBstring(Color clr) - { - // return an ARGB string representation of the color ( i.e "[A=255, R=255, G=255, B=255]") - // The format is same as using the ToString() of a color that does not have a name - string strARGB = string.Format("[A={0}, R={1}, G={2}, B={3}]", clr.A, clr.R, clr.G, clr.B); - 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 - #region Insert and Remove Rows and Columns - public void InsertRow(int row) - { - TableShadingInfo.InsertRow(row); - } - public void InsertRows(int row, int count) - { - TableShadingInfo.InsertRows(row, 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 - #region Serialize - public string ConvertToString() - { - return GenericSerializer.StringSerialize(this); - } - public override string ToString() - { - return "Volian Custom Cell Shading"; - } - public static VlnGridCellShading Get(string xml) - { - return GenericSerializer.StringDeserialize(xml); - } - #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] - public class CellShadingArray - { - #region Properties - protected static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private int _Rows; - [XmlAttribute("Rows")] - public int Rows - { - get { return _Rows; } - set { _Rows = value; } - } - private int _Columns; - [XmlAttribute("Columns")] - public int Columns - { - get { return _Columns; } - set { _Columns = value; } - } - private string [] _CellShadingColor; // RGB info in a string - public string [] CellShadingColor - { - get { return _CellShadingColor; } - set { _CellShadingColor = value; } - } - private string _WhiteARGB; - public string WhiteARGB - { - get - { - if (_WhiteARGB == null) - _WhiteARGB = string.Format("[A={0}, R={1}, G={2}, B={3}]", Color.White.A, Color.White.R, Color.White.G, Color.White.B); - return _WhiteARGB; - } - } - #endregion - #region ctor - public CellShadingArray() {; } - public CellShadingArray(string defaultShadingColorARGB, int rows, int columns) - { - Rows = rows; - Columns = columns; - CellShadingColor = new string[rows * columns]; - for (int r = 0; r < Rows; r++) - for (int c = 0; c < Columns; c++) - 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 - #region Array Access - public string this[int r, int c] - { - get - { - int indx = r * Columns + c; - if (indx < CellShadingColor.Length) return CellShadingColor[r * Columns + c]; - _MyLog.WarnFormat("TableCellShading: CellShadingColor Array Access out-of-bounds ({0}, {1}) within ({2}, {3})", r, c, Rows, Columns); - return WhiteARGB; - } - set - { - CellShadingColor[r * Columns + c] = value; - } - } - #endregion - #region Insert and Delete Rows and Columns - public void InsertRow(int row) - { - InsertRows(row, 1); - } - public void InsertRows(int row, int count) - { - // Create a new Array of the correct size - string[] newLines = new string[(Rows + count) * Columns]; - int newRows = Rows + count; - for (int r = 0; r < newRows; r++) - { - int rSrc = r < row ? r : r > row + count ? r - count : row; - if (rSrc > Rows - 1) rSrc = Rows - 1; - for (int c = 0; c < Columns; c++) - { - newLines[r * Columns + c] = CellShadingColor[rSrc * Columns + c]; - } - } - CellShadingColor = newLines; - Rows = newRows; - } - public void DeleteRow(int row) - { - DeleteRows(row, 1); - } - public void DeleteRows(int row, int count) - { - string[] newLines = new string[(Rows - count) * Columns]; - int newRows = Rows - count; - for (int r = 0; r < newRows; r++) - { - int rSrc = r < row ? r : r + count; - for (int c = 0; c < Columns; c++) - { - newLines[r * Columns + c] = CellShadingColor[rSrc * Columns + c]; - } - } - CellShadingColor = newLines; - Rows = newRows; - } - public void InsertColumn(int column) - { - InsertColumns(column, 1); - } - public void InsertColumns(int column, int count) - { - // Create a new Array of the correct size - string[] newLines = new string[Rows * (Columns + count)]; - int newColumns = Columns + count; - for (int r = 0; r < Rows; r++) - { - for (int c = 0; c < newColumns; c++) - { - int cSrc = c < column ? c : c > column + count ? c - count : column; - newLines[r * newColumns + c] = CellShadingColor[r * Columns + cSrc]; - } - } - CellShadingColor = newLines; - Columns = newColumns; - } - public void DeleteColumn(int column) - { - DeleteColumns(column, 1); - } - public void DeleteColumns(int column, int count) - { - string[] newLines = new string[Rows * (Columns - count)]; - int newColumns = Columns - count; - for (int r = 0; r < Rows; r++) - { - for (int c = 0; c < newColumns; c++) - { - int cSrc = c < column ? c : c + count; - newLines[r * newColumns + c] = CellShadingColor[r * Columns + cSrc]; - } - } - CellShadingColor = newLines; - Columns = newColumns; - } - #endregion - - } -} diff --git a/PROMS/Volian.Controls.Library/VlnSpellCheck.cs b/PROMS/Volian.Controls.Library/VlnSpellCheck.cs deleted file mode 100644 index e9a71054..00000000 --- a/PROMS/Volian.Controls.Library/VlnSpellCheck.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using VEPROMS.CSLA.Library; - -namespace Volian.Controls.Library -{ - public class VlnSpellCheck - { - private EditItem _MyEditItem; - public EditItem MyEditItem - { - get { return _MyEditItem; } - set - { - _MyEditItem = value; - } - } - - - public VlnSpellCheck() - { - } - - public void DoSpellCheck() - { - while (MyEditItem.SpellCheckNext()) - { - ItemInfo next = MyEditItem.MyItemInfo.SearchNext; - //C2025-037 Evaluate the way that Spell Check (in step editor sections) is currently closing after one section. - - if (next == null || next.IsProcedure) // B2016-063 check if next is not a step type instead of specifically a section - { - return; // spell check only current procedure - } - - //If it is a word document, find the next non-word document - while (next.HasWordContent) - { - next = next.SearchNext; - - if (next == null || next.IsProcedure) // B2016-063 check if next is not a step type instead of specifically a section - { - return; // spell check only current procedure - } - } - - MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(next); - } - MyEditItem.SetFocus(); - } - - } -} diff --git a/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.Designer.cs b/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.Designer.cs deleted file mode 100644 index 7ad29424..00000000 --- a/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.Designer.cs +++ /dev/null @@ -1,214 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class VlnSpellCheckDlg - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VlnSpellCheckDlg)); - this.lblNotInDictionary = new DevComponents.DotNetBar.LabelX(); - this.txbBadWord = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.lbSuggestList = new System.Windows.Forms.ListBox(); - this.btnIgnore = new DevComponents.DotNetBar.ButtonX(); - this.btnIgnoreAll = new DevComponents.DotNetBar.ButtonX(); - this.btnChange = new DevComponents.DotNetBar.ButtonX(); - this.btnChangeAll = new DevComponents.DotNetBar.ButtonX(); - this.btnAddToDictionary = new DevComponents.DotNetBar.ButtonX(); - this.btnCancel = new DevComponents.DotNetBar.ButtonX(); - this.btnRemove = new DevComponents.DotNetBar.ButtonX(); - this.SuspendLayout(); - // - // lblNotInDictionary - // - // - // - // - this.lblNotInDictionary.BackgroundStyle.Class = ""; - this.lblNotInDictionary.Location = new System.Drawing.Point(12, 1); - this.lblNotInDictionary.Name = "lblNotInDictionary"; - this.lblNotInDictionary.Size = new System.Drawing.Size(108, 23); - this.lblNotInDictionary.TabIndex = 0; - this.lblNotInDictionary.Text = "Not In Dictionary:"; - // - // txbBadWord - // - this.txbBadWord.AcceptsReturn = true; - this.txbBadWord.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - // - // - // - this.txbBadWord.Border.Class = "TextBoxBorder"; - this.txbBadWord.Location = new System.Drawing.Point(12, 30); - this.txbBadWord.Name = "txbBadWord"; - this.txbBadWord.Size = new System.Drawing.Size(185, 22); - this.txbBadWord.TabIndex = 1; - this.txbBadWord.TextChanged += new System.EventHandler(this.txbBadWord_TextChanged); - // - // lbSuggestList - // - this.lbSuggestList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.lbSuggestList.FormattingEnabled = true; - this.lbSuggestList.ItemHeight = 16; - this.lbSuggestList.Location = new System.Drawing.Point(12, 58); - this.lbSuggestList.Name = "lbSuggestList"; - this.lbSuggestList.Size = new System.Drawing.Size(185, 148); - this.lbSuggestList.TabIndex = 2; - this.lbSuggestList.SelectedIndexChanged += new System.EventHandler(this.lbSuggestList_SelectedIndexChanged); - this.lbSuggestList.DoubleClick += new System.EventHandler(this.lbSuggestList_DoubleClick); - // - // btnIgnore - // - this.btnIgnore.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnIgnore.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnIgnore.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnIgnore.Location = new System.Drawing.Point(208, 29); - this.btnIgnore.Name = "btnIgnore"; - this.btnIgnore.Size = new System.Drawing.Size(75, 23); - this.btnIgnore.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnIgnore.TabIndex = 3; - this.btnIgnore.Text = "Ignore"; - this.btnIgnore.Click += new System.EventHandler(this.btnIgnore_Click); - // - // btnIgnoreAll - // - this.btnIgnoreAll.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnIgnoreAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnIgnoreAll.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnIgnoreAll.Location = new System.Drawing.Point(289, 29); - this.btnIgnoreAll.Name = "btnIgnoreAll"; - this.btnIgnoreAll.Size = new System.Drawing.Size(75, 23); - this.btnIgnoreAll.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnIgnoreAll.TabIndex = 4; - this.btnIgnoreAll.Text = "Ignore All"; - this.btnIgnoreAll.Click += new System.EventHandler(this.btnIgnoreAll_Click); - // - // btnChange - // - this.btnChange.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnChange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnChange.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnChange.Location = new System.Drawing.Point(208, 58); - this.btnChange.Name = "btnChange"; - this.btnChange.Size = new System.Drawing.Size(75, 23); - this.btnChange.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnChange.TabIndex = 5; - this.btnChange.Text = "Change"; - this.btnChange.Click += new System.EventHandler(this.btnChange_Click); - // - // btnChangeAll - // - this.btnChangeAll.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnChangeAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnChangeAll.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnChangeAll.Location = new System.Drawing.Point(289, 58); - this.btnChangeAll.Name = "btnChangeAll"; - this.btnChangeAll.Size = new System.Drawing.Size(75, 23); - this.btnChangeAll.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnChangeAll.TabIndex = 6; - this.btnChangeAll.Text = "Change All"; - this.btnChangeAll.Click += new System.EventHandler(this.btnChangeAll_Click); - // - // btnAddToDictionary - // - this.btnAddToDictionary.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnAddToDictionary.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnAddToDictionary.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnAddToDictionary.Location = new System.Drawing.Point(208, 1); - this.btnAddToDictionary.Name = "btnAddToDictionary"; - this.btnAddToDictionary.Size = new System.Drawing.Size(156, 23); - this.btnAddToDictionary.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnAddToDictionary.TabIndex = 7; - this.btnAddToDictionary.Text = "Add To Dictionary"; - this.btnAddToDictionary.Click += new System.EventHandler(this.btnAddToDictionary_Click); - // - // btnCancel - // - this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(287, 188); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(75, 23); - this.btnCancel.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnCancel.TabIndex = 8; - this.btnCancel.Text = "Cancel"; - // - // btnRemove - // - this.btnRemove.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnRemove.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnRemove.Location = new System.Drawing.Point(208, 87); - this.btnRemove.Name = "btnRemove"; - this.btnRemove.Size = new System.Drawing.Size(75, 23); - this.btnRemove.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnRemove.TabIndex = 9; - this.btnRemove.Text = "Remove"; - this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click); - // - // VlnSpellCheckDlg - // - this.CancelButton = this.btnCancel; - this.ClientSize = new System.Drawing.Size(374, 223); - this.Controls.Add(this.btnRemove); - this.Controls.Add(this.btnCancel); - this.Controls.Add(this.btnAddToDictionary); - this.Controls.Add(this.btnChangeAll); - this.Controls.Add(this.btnChange); - this.Controls.Add(this.btnIgnoreAll); - this.Controls.Add(this.btnIgnore); - this.Controls.Add(this.lbSuggestList); - this.Controls.Add(this.txbBadWord); - this.Controls.Add(this.lblNotInDictionary); - this.DoubleBuffered = true; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(392, 266); - this.Name = "VlnSpellCheckDlg"; - this.Text = "Spell Check"; - this.ResumeLayout(false); - - } - - #endregion - - private DevComponents.DotNetBar.LabelX lblNotInDictionary; - private DevComponents.DotNetBar.Controls.TextBoxX txbBadWord; - private System.Windows.Forms.ListBox lbSuggestList; - private DevComponents.DotNetBar.ButtonX btnIgnore; - private DevComponents.DotNetBar.ButtonX btnIgnoreAll; - private DevComponents.DotNetBar.ButtonX btnChange; - private DevComponents.DotNetBar.ButtonX btnChangeAll; - private DevComponents.DotNetBar.ButtonX btnAddToDictionary; - private DevComponents.DotNetBar.ButtonX btnCancel; - private DevComponents.DotNetBar.ButtonX btnRemove; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.cs b/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.cs deleted file mode 100644 index b02f9476..00000000 --- a/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.cs +++ /dev/null @@ -1,307 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using DevComponents.DotNetBar; -using C1.Win.C1SpellChecker; - -namespace Volian.Controls.Library -{ - // Our custom Spell Checker dialog - public partial class VlnSpellCheckDlg : DevComponents.DotNetBar.Office2007Form, ISpellDialog - { - private C1SpellChecker _Spell; - private ISpellCheckableEditor _Editor; - private CharRangeList _Errors; - private int _ErrorCount; - private int _ErrorIndex = -1; // current error index - private bool _AutoSuggest = true; - private string _NoSuggestionsText = "(no suggestions)"; - - Dictionary _changeAll = new Dictionary(); - - /// - /// Gets the object that represents the error currently - /// displayed in the dialog. - /// - public CharRange CurrentError - { - 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 VlnSpellCheckDlg() - { - InitializeComponent(); - } - /// - /// Initializes the dialog to use the given parameters. - /// - /// to use for spelling. - /// that contains the text to spell-check. - /// that contains the initial error list. - public void Initialize(C1SpellChecker spell, ISpellCheckableEditor editor, CharRangeList errors) - { - _Spell = spell; - _Editor = editor; - _Errors = errors; - if (_Errors == null) - { - _Errors = _Spell.CheckText(_Editor.Text); - } - _ErrorCount += _Errors.Count; - btnAddToDictionary.Visible = _Spell.UserDictionary.Enabled; - } - /// - /// Gets the total number of errors detected in the control. - /// - public int ErrorCount - { - get { return _ErrorCount; } - } - - /// - /// Gets or sets the index of the current error into the list. - /// - public int ErrorIndex - { - get { return _ErrorIndex; } - set - { - _ErrorIndex = value; - UpdateCurrentError(); - } - } - - private void UpdateEditor(string replacement) - { - DidCorrectSpelling = true; - // save starting point to continue checking from here - int start = CurrentError.Start; - - if (replacement.Length == 0) - { - // if replacement is empty, expand over spaces and commas - CharRange delete = CharRange.ExpandOverWhitespace(_Editor.Text, CurrentError); - _Editor.Select(delete.Start, delete.Text.Length); - } - - // replace word in text and re-check - _Editor.SelectedText = replacement; - _Errors = _Spell.CheckText(_Editor.Text, start); - - // update index - ErrorIndex = ErrorIndex; // originally 0; - } - - /// - /// Raises the event. - /// - /// that contains the event data. - protected override void OnLoad(EventArgs e) - { - // fire load event - base.OnLoad(e); - //AddHandle(); - // show first error (after firing load event) - ErrorIndex = 0; - } - // added for debugging - comment out when not using - //public void AddHandle() - //{ - // if (!Handles.Contains(this.Handle)) - // { - // GC.Collect(); - // Handles.Add(this.Handle); - // Console.WriteLine("Handles {0}, RTB Count Created {1}, RTB Count Not Disposed = {2} ", Handles.Count,StepRTB.CountCreated,StepRTB.CountNotDisposed); - - // } - //} - //private static List Handles = new List(); - - private bool _Initializing = false; - private string _OrgWord; - - // update dialog to show current error - private void UpdateCurrentError() - { - // design time - if (DesignMode || _Errors == null) - { - return; - } - // finished with this batch of errors - if (ErrorIndex >= _Errors.Count) - { - // check whether the editor has more text to check - while (_Editor.HasMoreText()) - { - _Errors = _Spell.CheckText(_Editor.Text); - if (_Errors.Count > 0) - { - _ErrorCount += _Errors.Count; - ErrorIndex = 0; - return; - } - } - - // editor has no more text... - DialogResult = DialogResult.OK; - return; - } - - // update current error - CharRange err = CurrentError; - - // select word in editor - _Editor.Select(err.Start, err.Text.Length); - - // honor 'change all' list - if (_changeAll.ContainsKey(err.Text)) - { - txbBadWord.Text = _changeAll[err.Text]; - btnChange_Click(this, EventArgs.Empty); - return; - } - - _Initializing = true; - // show bad word, new text - txbBadWord.Text = _OrgWord = err.Text; - - // repeated word? - if (err.Duplicate) - { - // adjust dialog - lblNotInDictionary.Text = "Duplicate Word"; - btnIgnoreAll.Enabled = false; - btnAddToDictionary.Enabled = false; - btnRemove.Enabled = true; - - // no suggestions - lbSuggestList.Items.Clear(); - } - else - { - // adjust dialog - lblNotInDictionary.Text = "Not In Dictionary"; - btnIgnoreAll.Enabled = true; - btnAddToDictionary.Enabled = true; - btnRemove.Enabled = false; - - SetupSuggestions(err.Text); - } - - // focus to new word - _AutoSuggest = false; - txbBadWord.SelectAll(); - txbBadWord.Focus(); - _AutoSuggest = true; - AcceptButton = btnIgnore; - - // show 'Add' button only if user dictionary is enabled - btnAddToDictionary.Visible = _Spell.UserDictionary.Enabled; - - // all ready, fire ErrorDisplayed event - //OnErrorDisplayed(EventArgs.Empty); - } - - private void SetupSuggestions(string badWord) - { - // show suggestions - _Initializing = true; - string[] suggestions = _Spell.GetSuggestions(badWord); - lbSuggestList.Items.Clear(); - if (suggestions.Length > 0) - { - lbSuggestList.Items.AddRange(suggestions); - lbSuggestList.SelectedIndex = -1; - lbSuggestList.Enabled = true; - } - else - { - lbSuggestList.Items.Add(_NoSuggestionsText); - lbSuggestList.SelectedIndex = -1; - lbSuggestList.Enabled = false; - } - _Initializing = false; - } - - private void txbBadWord_TextChanged(object sender, EventArgs e) - { - btnChange.Enabled = (_OrgWord != txbBadWord.Text); - btnChangeAll.Enabled = btnChange.Enabled && lblNotInDictionary.Text == "Not In Dictionary"; - btnAddToDictionary.Enabled = _Spell.UserDictionary.Enabled && !InDictionary(txbBadWord.Text); - if (_AutoSuggest && !_Initializing) - { - SetupSuggestions(txbBadWord.Text); - } - } - - private bool InDictionary(string word) - { - if (_Spell.MainDictionary.Contains(word)) - return true; - if (_Spell.CustomDictionary != null && _Spell.CustomDictionary.Contains(word)) - return true; - if (_Spell.UserDictionary != null && _Spell.UserDictionary.Contains(word)) - return true; - return false; - } - - private void btnChange_Click(object sender, EventArgs e) - { - UpdateEditor(txbBadWord.Text); - } - - private void btnChangeAll_Click(object sender, EventArgs e) - { - _changeAll[CurrentError.Text] = txbBadWord.Text; - UpdateEditor(txbBadWord.Text); - } - - private void btnIgnore_Click(object sender, EventArgs e) - { - ErrorIndex++; - } - - private void btnIgnoreAll_Click(object sender, EventArgs e) - { - //Console.WriteLine("handle: {0}", this.Handle); - _Spell.IgnoreList.Add(CurrentError.Text); - _Errors = _Spell.CheckText(_Editor.Text, CurrentError.Start); - UpdateCurrentError(); - } - - private void btnAddToDictionary_Click(object sender, EventArgs e) - { - _Spell.UserDictionary.AddWord(CurrentError.Text); - _Errors = _Spell.CheckText(_Editor.Text, CurrentError.Start); - ErrorIndex = 0; - } - - private void lbSuggestList_SelectedIndexChanged(object sender, EventArgs e) - { - _AutoSuggest = false; - if (!_Initializing && lbSuggestList.Text != _NoSuggestionsText) - txbBadWord.Text = lbSuggestList.Text; - _AutoSuggest = true; - } - - // double-click selects word for suggestion list and changes mis-spelled word - private void lbSuggestList_DoubleClick(object sender, EventArgs e) - { - if (txbBadWord.Text == lbSuggestList.Text) - { - UpdateEditor(txbBadWord.Text); - } - } - - private void btnRemove_Click(object sender, EventArgs e) - { - UpdateEditor(""); - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.resx b/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.resx deleted file mode 100644 index a39e1315..00000000 --- a/PROMS/Volian.Controls.Library/VlnSpellCheckDlg.resx +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - AAABAAIAEBAQAAAABAAoAQAAJgAAACAgEAAAAAQA6AIAAE4BAAAoAAAAEAAAACAAAAABAAQAAAAAAIAA - AAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/ - AAAA//8A/wAAAP8A/wD//wAA////AAAAAAwAAAAAAAAAzMAAAAAAAAzAzAAAAAAAzAAMwAAAAAzAAADM - AAAADAAAAAzAAAAAAAAAAMwAAAAAAAAADMAAAAAAAAAAzAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/v8AAPx/AAD5PwAA858AAOfPAADv5wAA//MAAP/5 - AAD//AAAtHIAAIWtAAC0bwAAza0AAMxzAAD//wAA//8AACgAAAAgAAAAQAAAAAEABAAAAAAAgAIAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD/ - /wD/AAAA/wD/AP//AAD///8AAAAAAAAAAAAAAAAAAAAAAAAHiIiIiIiIiIiIiIiIAAAAB/////j///j/ - //j/+AAAAAf////4///4///4//gAAAAH////+P//+P//+P/4AAAAB/////j///j///j/+AAAAAf////4 - ///4///4//gAAAAHiIiIiIiIiIiIiIiIAAAAB/94eHh4eHh4eHj/+AAAAAf/h4eIh4eIh4eI//gAAAAH - /3h4eHh4eHh4eP/4AAAAB/+Hh4iHh4iHh4j/+AAAAAf/eHh4eHh4eHh4//gAAAAHiIiIiIiIiIiIiIiI - AAAAB/94eHh4eHh4eHj/+AAAAAf/h4eIh4eIh4eI//gAAAAH/3h4eHh4eHh4eP/4AAAAB/+Hh4iHh4iH - h4j/+AAAAAf/eHh4eHh4eHh4//gAAAAHiIiIiIiIiIiIiIiIAAAAB/94eHh4eHh4eHj/+AAAAAf/h4eI - h4eIh4eI//gAAAAH/3h4eHh4eHh4eP/4AAAAB/+Hh4iHh4iHh4j/+AAAAAf/eHh4eHh4eHh4//gAAAAH - iIiIiIiIiIiIcAAAAAAAB/////j///j//3/4cAAAAAf////4///4//9/hwAAAAAH////+P//+P//eHAA - AAAAB/////j///j//3cAAAAAAAf////4///4//9wAAAAAAAHd3d3d3d3d3d3cAAAAADgAAAH4AAAB+AA - AAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AA - AAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AAAAfgAAAH4AAAB+AAAA/gAAAf4AAAP+AAAH/gAAD/4AAB/w== - - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/Volian.Controls.Library.csproj b/PROMS/Volian.Controls.Library/Volian.Controls.Library.csproj deleted file mode 100644 index c840ed21..00000000 --- a/PROMS/Volian.Controls.Library/Volian.Controls.Library.csproj +++ /dev/null @@ -1,669 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {8556527C-6615-487F-8AF7-22EBC3EF0268} - Library - Properties - Volian.Controls.Library - Volian.Controls.Library - - - - - - - - - v4.8.1 - - - - - 2.0 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - x64 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - x64 - - - true - bin\Demo\ - DEBUG;TRACE - full - x64 - prompt - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - prompt - false - - - bin\Debug\ - TRACE - true - pdbonly - x64 - prompt - false - - - true - bin\Demo\ - TRACE;DEMO - full - x64 - prompt - false - - - - False - ..\..\..\..\3rdPartyLibraries\Edraw\AxInterop.EDWordLib.dll - - - - - False - ..\..\..\..\3rdPartyLibraries\CSLA\CSLA20cs_DLL_Net_4.8.1_Build\Csla.dll - - - False - ..\..\..\..\3rdPartyLibraries\DotNetBar\DotNetBar4.6Build\DevComponents.DotNetBar2.dll - - - False - ..\..\..\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies\EnvDTE.dll - - - - False - False - ..\..\..\..\3rdPartyLibraries\Edraw\Interop.EDWordLib.dll - - - False - ..\..\..\..\3rdPartyLibraries\Log4Net\log4net.dll - - - - - ..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll - - - - - - - - - - - - - UserControl - - - AnnotationDetails.cs - - - UserControl - - - AnnotationSearch.cs - - - Component - - - BorderListBox.cs - - - Component - - - BorderSelectionPanel.cs - - - Form - - - Form - - - CustomMessageBox.cs - - - UserControl - - - DisplayApplicability.cs - - - UserControl - - - DisplayBookMarks.cs - - - UserControl - - - DisplayFoldoutMaint.cs - - - UserControl - - - DisplayHistory.cs - - - UserControl - - - DisplayLibDocs.cs - - - UserControl - - - DisplayReports.cs - - - UserControl - - - DisplaySearch.cs - - - UserControl - - - DisplayTags.cs - - - Form - - - dlgChgId.cs - - - Form - - - dlgDelProcReason.cs - - - Form - - - dlgEnhMissingItem.cs - - - UserControl - - - EditItem.cs - - - Form - - - FindReplace.cs - - - - Form - - - frmEnhanced.cs - - - Form - - - frmEPAnnotationDetails.cs - - - Form - - - frmImportWordContents.cs - - - Form - - - frmSendErrorLog.cs - - - Form - - - frmViewTextFile.cs - - - UserControl - - - GridItem.cs - - - UserControl - - - ImageItem.cs - - - - Component - - - Form - - - PreviewMultiLineRO.cs - - - Form - - - PreviewROImage.cs - - - True - True - Settings.settings - - - - UserControl - - - RTBItem.cs - - - UserControl - - - RtfRawItem.cs - - - - Component - - - StepPanel.cs - - - UserControl - - - DisplayRO.cs - - - UserControl - - - DisplayTabControl.cs - - - Component - - - DisplayTabItem.cs - - - Component - - - StepTabPanel.cs - - - UserControl - - - StepTabRibbon.cs - - - UserControl - - - DisplayTransition.cs - - - - Component - - - Component - - - DSOTabPanel.cs - - - Component - - - - - True - True - Resources.resx - - - Component - - - RichTextBox41.cs - - - - - UserControl - - - TablePropertiesControl.cs - - - Component - - - Component - - - TransPanel.cs - - - - UserControl - - - vlnExpander.cs - - - Component - - - StepRTB.cs - - - Component - - - VlnFlexGrid.cs - - - - - Form - - - VlnSpellCheckDlg.cs - - - UserControl - - - Component - - - vlnTreeView.cs - - - Component - - - vlnTreeView3.cs - - - Form - - - WebBrowser.cs - - - - - - AnnotationDetails.cs - Designer - - - AnnotationSearch.cs - Designer - - - CustomMessageBox.cs - Designer - - - DisplayBookMarks.cs - Designer - - - DisplayHistory.cs - Designer - - - DisplayLibDocs.cs - Designer - - - DisplaySearch.cs - Designer - - - DisplayTags.cs - Designer - - - dlgDelProcReason.cs - - - dlgEnhMissingItem.cs - - - FindReplace.cs - Designer - - - frmEnhanced.cs - - - frmEPAnnotationDetails.cs - Designer - - - frmImportWordContents.cs - - - PreviewMultiLineRO.cs - Designer - - - PreviewROImage.cs - Designer - - - - RTBItem.cs - Designer - - - Designer - StepPanel.cs - - - Designer - DisplayRO.cs - - - DisplayTabControl.cs - Designer - - - StepTabRibbon.cs - Designer - - - Designer - DisplayTransition.cs - - - Designer - ResXFileCodeGenerator - Resources.Designer.cs - - - TablePropertiesControl.cs - - - vlnExpander.cs - Designer - - - StepRTB.cs - Designer - - - VlnSpellCheckDlg.cs - Designer - - - WebBrowser.cs - Designer - - - - - {34ADDF19-CBBA-4A11-BC99-D141BA2D29EC} - DropDownPanel - - - {b22ce5ad-288c-44cd-8a22-b3bcf77b7161} - FlexableMessageBox - - - {70F23722-19A3-4AC1-A900-55831C945786} - LBWordLibrary - - - {23DECB23-7CEA-433E-88BD-67DA7689B89E} - TablePicker - - - {41B2D786-1C03-4C1A-9247-DA9F0D6B06D5} - VEPROMS.CSLA.Library - - - {52D74078-3822-410E-889B-464BD21AAB9E} - VG - - - {AEEE9FD1-6892-45E2-A67E-418C06D46FF9} - Volian.Base.Library - - - {2bd7d42a-a8f6-4dea-bdca-5f4d58c6140f} - Volian.Pipe.Library - - - {04E168D0-9CC7-43D9-A9F1-93E481EA86A3} - XYPlots - - - - - {00020430-0000-0000-C000-000000000046} - 2 - 0 - 0 - primary - False - - - - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - DisplayApplicability.cs - Designer - - - Designer - DisplayFoldoutMaint.cs - - - DisplayReports.cs - Designer - - - dlgChgId.cs - Designer - - - frmSendErrorLog.cs - Designer - - - frmViewTextFile.cs - Designer - - - Designer - GridItem.cs - - - VlnFlexGrid.cs - Designer - - - - - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/Volian.Controls.Library.gclicx b/PROMS/Volian.Controls.Library/Volian.Controls.Library.gclicx deleted file mode 100644 index 2eb2425c..00000000 --- a/PROMS/Volian.Controls.Library/Volian.Controls.Library.gclicx +++ /dev/null @@ -1,2 +0,0 @@ -da3d5d14-691f-4908-aa3c-fd3239734232;-8584914772854775808;Vm9saWFuLkNvbnRyb2xzLkxpYnJhcnkuZGxs;ZGEzZDVkMTQtNjkxZi00OTA4LWFhM2MtZmQzMjM5NzM0MjMy,MDEwODE5MjdYWFhYWFhYWDA1Mg,Sk9ITi1XSU4xMA,RmFsc2U,ODQzNA,RmFsc2U,MA,MA,djIwMjIuMw,,;c7VmK7aSALscK1Nd/lI1cS3mms+p4j4Fsa2LgKQ1JmeSkNKq5X8LWx2NLOHITkvv+3IbbTQcVPnGa7hKiEDHlfH3thfwEvtzoqprZSXMOYfNPiXTPIIYPNb6L31Qq7AGiogvw+dMD9o/AiUWt4Q7a5SRmYU+PbrlNAXVISIzndw -da3d5d14-691f-4908-aa3c-fd3239734232;-8584865524854775808;Vm9saWFuLkNvbnRyb2xzLkxpYnJhcnkuZGxs;ZGEzZDVkMTQtNjkxZi00OTA4LWFhM2MtZmQzMjM5NzM0MjMy,NjE5MDczODdYWFhYWFhYWDA1Mw,Q0hSSVM,RmFsc2U,ODg5NA,RmFsc2U,MA,MA,djIwMjQuMQ,,;luo/kWHt4XRAYR+3s8m8QoRagBcvXLv0mHvCYU2VCIeACFord4tdtTGmSUvmGhEmUiAd7YvaTlDlFrlni6CWaVlxa1mdbWuWsNVUkRnyJZ8kOAt1A+3SGfHecCsqotTW7apXjwW5qXLZ/fcgutioe7xaXgniFQysshTdUWt26T8 diff --git a/PROMS/Volian.Controls.Library/WebBrowser.Designer.cs b/PROMS/Volian.Controls.Library/WebBrowser.Designer.cs deleted file mode 100644 index 71620404..00000000 --- a/PROMS/Volian.Controls.Library/WebBrowser.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class WebBrowser - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/WebBrowser.cs b/PROMS/Volian.Controls.Library/WebBrowser.cs deleted file mode 100644 index 6f9ccf67..00000000 --- a/PROMS/Volian.Controls.Library/WebBrowser.cs +++ /dev/null @@ -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 - - /// - /// 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. - /// - /// The URL of the web site you want to display - 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; - } - - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/WebBrowser.resx b/PROMS/Volian.Controls.Library/WebBrowser.resx deleted file mode 100644 index 19dc0dd8..00000000 --- a/PROMS/Volian.Controls.Library/WebBrowser.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/app.config b/PROMS/Volian.Controls.Library/app.config deleted file mode 100644 index 1d945e2f..00000000 --- a/PROMS/Volian.Controls.Library/app.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - -
- - - - - - - - - - diff --git a/PROMS/Volian.Controls.Library/dlgChgId.cs b/PROMS/Volian.Controls.Library/dlgChgId.cs deleted file mode 100644 index 74bdb7c2..00000000 --- a/PROMS/Volian.Controls.Library/dlgChgId.cs +++ /dev/null @@ -1,31 +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 dlgChgId : Form - { - DisplayTabControl TabControl; - public dlgChgId(DisplayTabControl tc) - { - InitializeComponent(); - TabControl = tc; - tbChgId.Focus(); - } - - private void btnOk_Click(object sender, EventArgs e) - { - TabControl.ChgId = tbChgId.Text; - } - - private void btnCancel_Click(object sender, EventArgs e) - { - TabControl.ChgId = null; - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/dlgChgId.designer.cs b/PROMS/Volian.Controls.Library/dlgChgId.designer.cs deleted file mode 100644 index 62e704cd..00000000 --- a/PROMS/Volian.Controls.Library/dlgChgId.designer.cs +++ /dev/null @@ -1,113 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class dlgChgId - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label1 = new System.Windows.Forms.Label(); - this.tbChgId = new System.Windows.Forms.TextBox(); - this.btnOk = new System.Windows.Forms.Button(); - this.btnCancel = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(17, 12); - this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(160, 13); - this.label1.TabIndex = 0; - this.label1.Text = "Please enter your change bar ID"; - // - // tbChgId - // - this.tbChgId.Location = new System.Drawing.Point(41, 41); - this.tbChgId.Margin = new System.Windows.Forms.Padding(2); - this.tbChgId.Name = "tbChgId"; - this.tbChgId.Size = new System.Drawing.Size(97, 20); - this.tbChgId.TabIndex = 1; - // - // btnOk - // - this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; - this.btnOk.Location = new System.Drawing.Point(25, 74); - this.btnOk.Margin = new System.Windows.Forms.Padding(2); - this.btnOk.Name = "btnOk"; - this.btnOk.Size = new System.Drawing.Size(46, 24); - this.btnOk.TabIndex = 2; - this.btnOk.Text = "OK"; - this.btnOk.UseVisualStyleBackColor = true; - this.btnOk.Click += new System.EventHandler(this.btnOk_Click); - // - // btnCancel - // - this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(103, 74); - this.btnCancel.Margin = new System.Windows.Forms.Padding(2); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(49, 24); - this.btnCancel.TabIndex = 3; - this.btnCancel.Text = "Cancel"; - this.btnCancel.UseVisualStyleBackColor = true; - this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); - // - // dlgChgId - // - this.AcceptButton = this.btnOk; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.btnCancel; - this.ClientSize = new System.Drawing.Size(186, 113); - this.ControlBox = false; - this.Controls.Add(this.btnCancel); - this.Controls.Add(this.btnOk); - this.Controls.Add(this.tbChgId); - this.Controls.Add(this.label1); - this.Margin = new System.Windows.Forms.Padding(2); - this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(202, 152); - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(202, 152); - this.Name = "dlgChgId"; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "PROMS Change Bar ID"; - this.TopMost = true; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox tbChgId; - private System.Windows.Forms.Button btnOk; - private System.Windows.Forms.Button btnCancel; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/dlgChgId.resx b/PROMS/Volian.Controls.Library/dlgChgId.resx deleted file mode 100644 index 19dc0dd8..00000000 --- a/PROMS/Volian.Controls.Library/dlgChgId.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/dlgDelProcReason.cs b/PROMS/Volian.Controls.Library/dlgDelProcReason.cs deleted file mode 100644 index e616b2bd..00000000 --- a/PROMS/Volian.Controls.Library/dlgDelProcReason.cs +++ /dev/null @@ -1,39 +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 -{ - // C2020-038: request reason for delete procedure so this can be saved in database - // (a few users said that procedures 'disappeared' but this could not be reproduced) - public partial class dlgDelProcReason : Form - { - vlnTreeView VTreeView; - public dlgDelProcReason(vlnTreeView tv) - { - InitializeComponent(); - this.Text = "Verify Delete By " + Volian.Base.Library.VlnSettings.UserID; - VTreeView = tv; - tbDelProcReason.Focus(); - } - - private void btnOk_Click(object sender, EventArgs e) - { - VTreeView.DelProcReason = tbDelProcReason.Text; - } - - private void btnCancel_Click(object sender, EventArgs e) - { - VTreeView.DelProcReason = null; - } - - private void tbDelProcReason_TextChanged(object sender, EventArgs e) - { - btnYes.Enabled = (tbDelProcReason.Text != null && tbDelProcReason.Text.Length > 0) ; - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/dlgDelProcReason.designer.cs b/PROMS/Volian.Controls.Library/dlgDelProcReason.designer.cs deleted file mode 100644 index 0085bb3f..00000000 --- a/PROMS/Volian.Controls.Library/dlgDelProcReason.designer.cs +++ /dev/null @@ -1,115 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class dlgDelProcReason - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label1 = new System.Windows.Forms.Label(); - this.tbDelProcReason = new System.Windows.Forms.TextBox(); - this.btnYes = new System.Windows.Forms.Button(); - this.btnNo = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(23, 15); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(379, 34); - this.label1.TabIndex = 0; - this.label1.Text = "Are you sure you want to delete this procedure?\r\n A reason must be entered befor" + - "e the delete can be done."; - // - // tbDelProcAnnot - // - this.tbDelProcReason.Location = new System.Drawing.Point(33, 58); - this.tbDelProcReason.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tbDelProcReason.Name = "tbDelProcAnnot"; - this.tbDelProcReason.Size = new System.Drawing.Size(319, 22); - this.tbDelProcReason.TabIndex = 1; - this.tbDelProcReason.TextChanged += new System.EventHandler(this.tbDelProcReason_TextChanged); - // - // btnYes - // - this.btnYes.DialogResult = System.Windows.Forms.DialogResult.OK; - this.btnYes.Enabled = false; - this.btnYes.Location = new System.Drawing.Point(191, 88); - this.btnYes.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.btnYes.Name = "btnYes"; - this.btnYes.Size = new System.Drawing.Size(61, 30); - this.btnYes.TabIndex = 2; - this.btnYes.Text = "Yes"; - this.btnYes.UseVisualStyleBackColor = true; - this.btnYes.Click += new System.EventHandler(this.btnOk_Click); - // - // btnNo - // - this.btnNo.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnNo.Location = new System.Drawing.Point(287, 88); - this.btnNo.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.btnNo.Name = "btnNo"; - this.btnNo.Size = new System.Drawing.Size(65, 30); - this.btnNo.TabIndex = 3; - this.btnNo.Text = "No"; - this.btnNo.UseVisualStyleBackColor = true; - this.btnNo.Click += new System.EventHandler(this.btnCancel_Click); - // - // dlgDelProcAnnot - // - this.AcceptButton = this.btnYes; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.btnNo; - this.ClientSize = new System.Drawing.Size(405, 129); - this.ControlBox = false; - this.Controls.Add(this.btnNo); - this.Controls.Add(this.btnYes); - this.Controls.Add(this.tbDelProcReason); - this.Controls.Add(this.label1); - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(423, 176); - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(423, 176); - this.Name = "dlgDelProcAnnot"; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Verify Delete"; - this.TopMost = true; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox tbDelProcReason; - private System.Windows.Forms.Button btnYes; - private System.Windows.Forms.Button btnNo; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/dlgDelProcReason.resx b/PROMS/Volian.Controls.Library/dlgDelProcReason.resx deleted file mode 100644 index d58980a3..00000000 --- a/PROMS/Volian.Controls.Library/dlgDelProcReason.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/dlgEnhMissingItem.Designer.cs b/PROMS/Volian.Controls.Library/dlgEnhMissingItem.Designer.cs deleted file mode 100644 index 1d390595..00000000 --- a/PROMS/Volian.Controls.Library/dlgEnhMissingItem.Designer.cs +++ /dev/null @@ -1,117 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class dlgEnhMissingItem - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.rbCreateNew = new System.Windows.Forms.RadioButton(); - this.rbLinkToExisting = new System.Windows.Forms.RadioButton(); - this.cbUnlinkedEnhancedItems = new System.Windows.Forms.ComboBox(); - this.btnOK = new System.Windows.Forms.Button(); - this.btnCancel = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // rbCreateNew - // - this.rbCreateNew.AutoSize = true; - this.rbCreateNew.Location = new System.Drawing.Point(54, 26); - this.rbCreateNew.Name = "rbCreateNew"; - this.rbCreateNew.Size = new System.Drawing.Size(102, 21); - this.rbCreateNew.TabIndex = 0; - this.rbCreateNew.TabStop = true; - this.rbCreateNew.Text = "Create New"; - this.rbCreateNew.UseVisualStyleBackColor = true; - this.rbCreateNew.CheckedChanged += new System.EventHandler(this.rbCreateNew_CheckedChanged); - // - // rbLinkToExisting - // - this.rbLinkToExisting.AutoSize = true; - this.rbLinkToExisting.Location = new System.Drawing.Point(54, 65); - this.rbLinkToExisting.Name = "rbLinkToExisting"; - this.rbLinkToExisting.Size = new System.Drawing.Size(128, 21); - this.rbLinkToExisting.TabIndex = 1; - this.rbLinkToExisting.TabStop = true; - this.rbLinkToExisting.Text = "Link To Existing"; - this.rbLinkToExisting.UseVisualStyleBackColor = true; - this.rbLinkToExisting.CheckedChanged += new System.EventHandler(this.rbLinkToExisting_CheckedChanged); - // - // cbUnlinkedEnhancedItems - // - this.cbUnlinkedEnhancedItems.FormattingEnabled = true; - this.cbUnlinkedEnhancedItems.Location = new System.Drawing.Point(57, 102); - this.cbUnlinkedEnhancedItems.Name = "cbUnlinkedEnhancedItems"; - this.cbUnlinkedEnhancedItems.Size = new System.Drawing.Size(506, 24); - this.cbUnlinkedEnhancedItems.TabIndex = 2; - this.cbUnlinkedEnhancedItems.SelectedIndexChanged += new System.EventHandler(this.cbUnlinkedEnhancedItems_SelectedIndexChanged); - // - // btnOK - // - this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.btnOK.Location = new System.Drawing.Point(368, 176); - this.btnOK.Name = "btnOK"; - this.btnOK.Size = new System.Drawing.Size(75, 26); - this.btnOK.TabIndex = 3; - this.btnOK.Text = "OK"; - this.btnOK.UseVisualStyleBackColor = true; - this.btnOK.Click += new System.EventHandler(this.btnOK_Click); - // - // btnCancel - // - this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(489, 176); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(75, 23); - this.btnCancel.TabIndex = 4; - this.btnCancel.Text = "Cancel"; - this.btnCancel.UseVisualStyleBackColor = true; - // - // dlgEnhMissingItem - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(612, 242); - this.Controls.Add(this.btnCancel); - this.Controls.Add(this.btnOK); - this.Controls.Add(this.cbUnlinkedEnhancedItems); - this.Controls.Add(this.rbLinkToExisting); - this.Controls.Add(this.rbCreateNew); - this.Name = "dlgEnhMissingItem"; - this.Text = "Create Missing Enhanced Item"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.RadioButton rbCreateNew; - private System.Windows.Forms.RadioButton rbLinkToExisting; - private System.Windows.Forms.ComboBox cbUnlinkedEnhancedItems; - private System.Windows.Forms.Button btnOK; - private System.Windows.Forms.Button btnCancel; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/dlgEnhMissingItem.cs b/PROMS/Volian.Controls.Library/dlgEnhMissingItem.cs deleted file mode 100644 index 26a5568f..00000000 --- a/PROMS/Volian.Controls.Library/dlgEnhMissingItem.cs +++ /dev/null @@ -1,118 +0,0 @@ -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 VEPROMS.CSLA.Library; -using JR.Utils.GUI.Forms; - -namespace Volian.Controls.Library -{ - public partial class dlgEnhMissingItem : Form - { - StepTabRibbon STRibbon = null; - private ItemInfo _SourceItem = null; - private int _EnhType = -1; - private bool _Initializing = false; - public bool OKSelected = false; - public dlgEnhMissingItem(StepTabRibbon strbn, ItemInfo srcItem, int enhType) - { - _Initializing = true; - _SourceItem = srcItem; - _EnhType = enhType; - InitializeComponent(); - STRibbon = strbn; - btnOK.Enabled = true; - ItemInfoList iil = ItemInfoList.GetListEnhancedForMissing(srcItem, enhType); - // if none found, only can do 'create' - if (iil == null || iil.Count == 0) - { - rbLinkToExisting.Enabled = false; - cbUnlinkedEnhancedItems.Enabled = false; - } - else - { - rbLinkToExisting.Enabled = true; - cbUnlinkedEnhancedItems.DataSource = iil; - cbUnlinkedEnhancedItems.SelectedIndex = -1; - cbUnlinkedEnhancedItems.Enabled = false; - } - if (srcItem.IsProcedure) this.Text = "Create Missing Enhanced Item for " + srcItem.DisplayNumber; - else this.Text = "Create Missing Enhanced Item"; - _Initializing = false; - } - - private void btnOK_Click(object sender, EventArgs e) - { - if (rbCreateNew.Checked) - { - STRibbon.enhUseExist = null; - STRibbon.enhDoConv = false; - } - else - { - ItemInfo ii = cbUnlinkedEnhancedItems.SelectedItem as ItemInfo; - STRibbon.enhUseExist = ii; - } - OKSelected = true; - this.Close(); - } - - private void rbLinkToExisting_CheckedChanged(object sender, EventArgs e) - { - if (rbLinkToExisting.Checked) - { - cbUnlinkedEnhancedItems.Enabled = true; - cbUnlinkedEnhancedItems.SelectedIndex = -1; - btnOK.Enabled = false; // disable until user selects an item from combobox - } - else - cbUnlinkedEnhancedItems.Enabled = false; - } - - private void rbCreateNew_CheckedChanged(object sender, EventArgs e) - { - if (rbCreateNew.Checked) btnOK.Enabled = true; - } - private void cbUnlinkedEnhancedItems_SelectedIndexChanged(object sender, EventArgs e) - { - if (_Initializing) return; - // cbUnlinkedEnhancedItems combo box has a list of all items in the enhanced document - // that can be linked to from this item. - btnOK.Enabled = true; - STRibbon.enhDoConv = false; - // if on a procedure, take the selected enhanced procedure & see if there are non-procedure items - // within it that can be linked based on old 16 bit data. If no sections/steps are returned, only the - // procedure can be linked so it really isn't a match. Otherwise, prompt user to see if they want to - // convert the data. If so, convert all items within it that can be linked. If not, just link as before. - if (_SourceItem.IsProcedure) - { - ItemInfo ii = cbUnlinkedEnhancedItems.SelectedItem as ItemInfo; - if (ii == null) return; - 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 - foreach (ContentInfo ci in cil) - { - if (ci.Type >= 10000) - { - foundSubItem = true; - break; - } - } - if (foundSubItem) - { - DialogResult dr = FlexibleMessageBox.Show("The procedure that is selected has enhanced data. Do you want to convert it (this will link any section/steps that can be linked)?", "Enhanced Links", MessageBoxButtons.YesNo); - if (dr == DialogResult.Yes) - { - STRibbon.enhUseExist = ii; - STRibbon.enhDoConv = true; - btnOK_Click(sender, e); - } - } - } - } - } -} diff --git a/PROMS/Volian.Controls.Library/dlgEnhMissingItem.resx b/PROMS/Volian.Controls.Library/dlgEnhMissingItem.resx deleted file mode 100644 index 7080a7d1..00000000 --- a/PROMS/Volian.Controls.Library/dlgEnhMissingItem.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.Designer.cs b/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.Designer.cs deleted file mode 100644 index 6628fe2c..00000000 --- a/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.Designer.cs +++ /dev/null @@ -1,111 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class frmEPAnnotationDetails - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.btnOk = new System.Windows.Forms.Button(); - this.btnCancel = new System.Windows.Forms.Button(); - this.panel_btns = new System.Windows.Forms.Panel(); - this.panelEP = new System.Windows.Forms.TableLayoutPanel(); - this.panel_btns.SuspendLayout(); - this.SuspendLayout(); - // - // btnOk - // - this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; - this.btnOk.Location = new System.Drawing.Point(9, 7); - this.btnOk.Margin = new System.Windows.Forms.Padding(2); - this.btnOk.Name = "btnOk"; - this.btnOk.Size = new System.Drawing.Size(56, 19); - this.btnOk.TabIndex = 0; - this.btnOk.Text = "OK"; - this.btnOk.UseVisualStyleBackColor = true; - this.btnOk.Click += new System.EventHandler(this.btnOk_Click); - // - // btnCancel - // - this.btnCancel.Location = new System.Drawing.Point(82, 7); - this.btnCancel.Margin = new System.Windows.Forms.Padding(2); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(56, 19); - this.btnCancel.TabIndex = 1; - this.btnCancel.Text = "Cancel"; - this.btnCancel.UseVisualStyleBackColor = true; - this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); - // - // panel_btns - // - this.panel_btns.Controls.Add(this.btnCancel); - this.panel_btns.Controls.Add(this.btnOk); - this.panel_btns.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel_btns.Location = new System.Drawing.Point(0, 512); - this.panel_btns.Name = "panel_btns"; - this.panel_btns.Size = new System.Drawing.Size(762, 30); - this.panel_btns.TabIndex = 2; - // - // panelEP - // - this.panelEP.AutoScroll = true; - this.panelEP.ColumnCount = 2; - this.panelEP.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.panelEP.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.panelEP.Dock = System.Windows.Forms.DockStyle.Fill; - this.panelEP.Location = new System.Drawing.Point(0, 0); - this.panelEP.Name = "panelEP"; - this.panelEP.RowCount = 1; - this.panelEP.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.panelEP.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 512F)); - this.panelEP.Size = new System.Drawing.Size(762, 512); - this.panelEP.TabIndex = 3; - // - // frmEPAnnotationDetails - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoSize = true; - this.ClientSize = new System.Drawing.Size(762, 542); - this.Controls.Add(this.panelEP); - this.Controls.Add(this.panel_btns); - this.Margin = new System.Windows.Forms.Padding(2); - this.Name = "frmEPAnnotationDetails"; - this.Text = "Electronic Procedure Details"; - this.TopMost = true; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmEPAnnotationDetails_FormClosing); - this.panel_btns.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button btnOk; - private System.Windows.Forms.Button btnCancel; - private System.Windows.Forms.Panel panel_btns; - private System.Windows.Forms.TableLayoutPanel panelEP; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.cs b/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.cs deleted file mode 100644 index 518e63c7..00000000 --- a/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.cs +++ /dev/null @@ -1,320 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using Volian.Controls.Library; -using System.Linq; - -namespace Volian.Controls.Library -{ - //C2025-023 - Electronic Procedures - Modifications to PROMS - //Form for Dynamic Showing of EP detail controls and entry - public partial class frmEPAnnotationDetails : Form - { - private AnnotationInfo _CurrentAnnotation; - private EPFields myEPFields; - private AnnotationConfig MyConfig; - - private StepTabRibbon _MyStepTabRibbon; - private Dictionary _DicTB; - private Dictionary _DicCheckBox; - private Dictionary _DicComboBox; - private Dictionary _DicSingleRO; - private Dictionary _DicMultiRO; - private TablePropertiesControl _TablePropControl; - - private string multiseparator = ","; - - public frmEPAnnotationDetails(AnnotationInfo currAnn) - { - InitializeComponent(); - _DicTB = new Dictionary(); - _DicCheckBox = new Dictionary(); - _DicComboBox = new Dictionary(); - _DicSingleRO = new Dictionary(); - _DicMultiRO = new Dictionary(); - InitializeSpecificControls(currAnn); - _MyStepTabRibbon = new StepTabRibbon(); - } - - private void InitializeSpecificControls(AnnotationInfo currAnn) - { - _CurrentAnnotation = currAnn; - myEPFields = _CurrentAnnotation.MyItem.GetValidEPFields(_CurrentAnnotation.TypeID); - MyConfig = new AnnotationConfig(currAnn.Config); - - int MaxCharsInLabel = myEPFields.Where(y => y.type.ToLower() != "tableinput").Max(x => x.label.Length); - //font size 8 - make labels slightly bigger than largest label - panelEP.ColumnStyles[0].SizeType = SizeType.Absolute; - panelEP.ColumnStyles[0].Width = (8 * MaxCharsInLabel) + 5; - - int RowCount = 0; - foreach (EPField EP in myEPFields) - { - RowCount += 1; - panelEP.RowCount = RowCount; - panelEP.Top = 20; - - if (EP.type.ToLower() != "tableinput") - { - Label wlbl = new Label(); - wlbl.Text = EP.label; - wlbl.Visible = true; - wlbl.TextAlign = ContentAlignment.MiddleLeft; - wlbl.Anchor = AnchorStyles.Left | AnchorStyles.Top; - wlbl.Width = (8 * MaxCharsInLabel) + 5; - panelEP.Controls.Add(wlbl, 0, panelEP.RowCount - 1); - } - - if (EP.type.ToLower() == "text") - { - TextBox tb = new TextBox(); - tb.Font = tb.Font = new Font("Arial", 8); - tb.BorderStyle = BorderStyle.FixedSingle; - //aligning to both left and right stretches the textbox to the width of the form - tb.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; - string val = MyConfig.GetValue("EP", EP.name).Replace("\\u8209?", "-").Replace(@"\u9586?", @"\"); - tb.Text = val; - tb.Visible = true; - tb.Height = EP.numlines * tb.Font.Height + 1 + tb.Margin.Vertical; - tb.MinimumSize = new Size(0, EP.numlines * tb.Font.Height + 1 + tb.Margin.Vertical); - if (EP.numlines > 1) - { - tb.Multiline = true; - tb.ScrollBars = ScrollBars.Both; - panelEP.RowStyles.Insert(panelEP.RowCount - 1, new RowStyle(SizeType.Absolute, 50)); - } - else - { - panelEP.RowStyles.Insert(panelEP.RowCount - 1, new RowStyle(SizeType.AutoSize)); - } - - _DicTB.Add(EP.name, tb); - panelEP.Controls.Add(tb, 1, panelEP.RowCount - 1); - } - else - { - panelEP.RowStyles.Insert(panelEP.RowCount - 1, new RowStyle(SizeType.AutoSize)); - } - if (EP.type.ToLower() == "logical") - { - CheckBox cb = new CheckBox(); - cb.Text = EP.text; - cb.Visible = true; - string val = MyConfig.GetValue("EP", EP.name); - cb.Checked = val != null && val != "" && val.ToUpper()[0] == 'Y'; - _DicCheckBox.Add(EP.name, cb); - cb.AutoSize = true; - panelEP.Controls.Add(cb, 1, panelEP.RowCount - 1); - } - if (EP.type.ToLower() == "combo") - { - ComboBox cmb = new ComboBox(); - cmb.Visible = true; - string tmp = EP.text; - string[] tmps = tmp.Split(",".ToCharArray()); - foreach (string t in tmps) cmb.Items.Add(t.Trim()); - string val = MyConfig.GetValue("EP", EP.name); - if (val != null && val != "") cmb.SelectedItem = val; - cmb.DropDownWidth = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Length).FirstOrDefault(), cmb.Font).Width + SystemInformation.VerticalScrollBarWidth; - cmb.Width = cmb.DropDownWidth; - _DicComboBox.Add(EP.name, cmb); - panelEP.Controls.Add(cmb, 1, panelEP.RowCount - 1); - } - if (EP.type.ToLower() == "rosingle") - { - ComboBox cmb = new ComboBox(); - cmb.Visible = true; - - List tmps = EP.getROList(currAnn, true); - cmb.DisplayMember = "Text"; - cmb.ValueMember = "Value"; - cmb.DataSource = tmps; - cmb.DropDownStyle = ComboBoxStyle.DropDownList; - cmb.DropDownWidth = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Text.Length).FirstOrDefault()?.Text, cmb.Font).Width + SystemInformation.VerticalScrollBarWidth; - cmb.Width = cmb.DropDownWidth; - - _DicSingleRO.Add(EP.name, cmb); - panelEP.Controls.Add(cmb, 1, panelEP.RowCount - 1); - } - if (EP.type.ToLower() == "romulti") - { - ListBoxMulti lb = new ListBoxMulti(); - - List tmps = EP.getROList(currAnn, false); - lb.DisplayMember = "Text"; - lb.ValueMember = "Value"; - lb.Width = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Text.Length).FirstOrDefault()?.Text, lb.Font).Width + SystemInformation.VerticalScrollBarWidth; - - lb.DataSource = tmps; - _DicMultiRO.Add(EP.name, lb); - panelEP.Controls.Add(lb, 1, panelEP.RowCount - 1); - - } - //note will allow only 1 tableproperties control since it is a 1:1 match with the table that is in the step - if (EP.type.ToLower() == "tableinput" && _TablePropControl == null) - { - string val = MyConfig.GetValue("EP", EP.name); - _TablePropControl = new TablePropertiesControl(EP.name, EP.label, val); - _TablePropControl.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; - panelEP.Controls.Add(_TablePropControl, 1, panelEP.RowCount - 1); - - } - - } - - Load += new EventHandler(Form1Load_setDefaults); - } - - void Form1Load_setDefaults(object sender, EventArgs e) - { - foreach (KeyValuePair pair in _DicSingleRO) - { - string val = MyConfig.GetValue("EP", pair.Key); - if (!string.IsNullOrEmpty(val) && pair.Value.Items.OfType().Any(x=> x.Value == val)) - pair.Value.SelectedValue = val; - else - pair.Value.SelectedValue = ""; - } - - foreach (KeyValuePair pair in _DicMultiRO) - { - //clear all items at start in case items were autoselected - bug in Winforms ListBox - pair.Value.ClearSelected(); - string val = MyConfig.GetValue("EP", pair.Key); - if (val != null && val != "") - { - var selectedvalues = val.Split(multiseparator.ToCharArray()); - foreach (string item in selectedvalues) - { - string text = ((List)pair.Value.DataSource).Find(x => x.Value == item)?.Text; - if (!string.IsNullOrEmpty(text)) pair.Value.SetSelected(pair.Value.FindString(text), true); - } - } - - //set this to -1 after initial setting of values - //this will help to fix bug in Winforms ListBox - //that autoselects first item when no items are selected - pair.Value.singleselectedindex = -1; - } - - - } - - private void FieldStepRTB_Enter(object sender, EventArgs e) - { - _MyStepTabRibbon.MyStepRTB = (StepRTB)sender; - } - private void btnOk_Click(object sender, EventArgs e) - { - - // loop through all of the fields - bool isDirty = false; - foreach (EPField EP in myEPFields) - { - if (EP.type.ToLower() == "text") - { - TextBox cur = _DicTB[EP.name]; - string newval = cur.Text; - string oldval = MyConfig.GetValue("EP", EP.name); - if (oldval != newval) - { - isDirty = true; - MyConfig.SetValue("EP", EP.name, newval.Replace("\\u8209?","-")); - } - } - else if (EP.type.ToLower() == "logical") - { - CheckBox cur = _DicCheckBox[EP.name]; - string newval = cur.Checked ? "Y" : "N"; - string oldval = MyConfig.GetValue("EP", EP.name); - if (newval != oldval) - { - isDirty = true; - MyConfig.SetValue("EP", EP.name, newval); - } - } - else if (EP.type.ToLower() == "combo") - { - ComboBox cmbcur = _DicComboBox[EP.name]; - string newval = cmbcur.Text; - string oldval = MyConfig.GetValue("EP", EP.name); - if (newval != oldval) - { - isDirty = true; - MyConfig.SetValue("EP", EP.name, newval); - } - } - else if (EP.type.ToLower() == "rosingle") - { - ComboBox cmbcur = _DicSingleRO[EP.name]; - string newval = cmbcur.SelectedValue.ToString(); - string oldval = MyConfig.GetValue("EP", EP.name); - if (newval == "-1") newval = ""; - if (newval != oldval) - { - isDirty = true; - MyConfig.SetValue("EP", EP.name, newval); - } - } - else if (EP.type.ToLower() == "romulti") - { - ListBoxMulti lbcur = _DicMultiRO[EP.name]; - string newvalues = String.Join(multiseparator, lbcur.SelectedItems.OfType().Select(item => item.Value)); - string oldvalues = MyConfig.GetValue("EP", EP.name); - if (newvalues != oldvalues) - { - isDirty = true; - MyConfig.SetValue("EP", EP.name, newvalues); - } - } - else if (EP.type.ToLower() == "tableinput" && EP.name == _TablePropControl.epname) - { - string newvalues = _TablePropControl.GetStorageValue(); - string oldvalues = MyConfig.GetValue("EP", EP.name); - if (newvalues != oldvalues) - { - isDirty = true; - MyConfig.SetValue("EP", EP.name, newvalues); - } - } - } - if (isDirty) - { - using (Annotation annotation = _CurrentAnnotation.Get()) - { - if (annotation != null) - { - annotation.Config = MyConfig.ToString(); - annotation.DTS = DateTime.Now; - annotation.UserID = Volian.Base.Library.VlnSettings.UserID; - annotation.Save(); - } - } - } - DialogResult = DialogResult.OK; - Close(); - } - - private void btnCancel_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.Cancel; - Close(); - } - - //remove events so no memory loss - private void frmEPAnnotationDetails_FormClosing(object sender, FormClosingEventArgs e) - { - foreach (ListBoxMulti lb in _DicMultiRO.Values) - { - lb.Dispose(); - } - - Load -= Form1Load_setDefaults; - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.resx b/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.resx deleted file mode 100644 index d58980a3..00000000 --- a/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/frmEnhanced.Designer.cs b/PROMS/Volian.Controls.Library/frmEnhanced.Designer.cs deleted file mode 100644 index 4e381596..00000000 --- a/PROMS/Volian.Controls.Library/frmEnhanced.Designer.cs +++ /dev/null @@ -1,64 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class frmEnhanced - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.tc = new Volian.Controls.Library.DisplayTabControl(); - this.SuspendLayout(); - // - // tc - // - this.tc.ChgId = null; - this.tc.Dock = System.Windows.Forms.DockStyle.Fill; - this.tc.Location = new System.Drawing.Point(0, 0); - this.tc.MyCopyStep = null; - this.tc.MyEditItem = null; - this.tc.MySessionInfo = null; - this.tc.Name = "tc"; - this.tc.RibbonExpanded = true; - this.tc.SelectedDisplayTabItem = null; - this.tc.Size = new System.Drawing.Size(284, 262); - this.tc.SyncEnhancedDocuments = false; - this.tc.TabIndex = 0; - // - // frmEnhanced - // - this.ClientSize = new System.Drawing.Size(284, 262); - this.Controls.Add(this.tc); - this.Name = "frmEnhanced"; - this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - this.Load += new System.EventHandler(this.frmEnhanced_Load); - this.ResumeLayout(false); - - } - - #endregion - - private Volian.Controls.Library.DisplayTabControl tc; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/frmEnhanced.cs b/PROMS/Volian.Controls.Library/frmEnhanced.cs deleted file mode 100644 index 0cf70801..00000000 --- a/PROMS/Volian.Controls.Library/frmEnhanced.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; - -namespace Volian.Controls.Library -{ - public partial class frmEnhanced : Form - { - public SessionInfo MySessionInfo - { - get { return tc.MySessionInfo; } - set { tc.MySessionInfo = value; } - } - private ItemInfo _MyItemInfo; - - public ItemInfo MyItemInfo - { - get { return _MyItemInfo; } - set { _MyItemInfo = value; } - } - public frmEnhanced(ItemInfo ii) - { - _MyItemInfo = ii; - InitializeComponent(); - SetCaption(); - } - public void OpenItem() - { - tc.OpenItem(_MyItemInfo); - } - private void frmEnhanced_Load(object sender, EventArgs e) - { - OpenItem(); - } - public DisplayTabControl MyDisplayTabClntrol - { - get { return this.tc; } - } - private void SetCaption() - { - FolderInfo myfolder = _MyItemInfo.MyDocVersion.MyFolder; - string sep = ""; - string fPath = ""; - while (myfolder.FolderID != myfolder.ParentID) - { - fPath = myfolder.Name + sep + fPath; - sep = "/"; - myfolder = myfolder.MyParent; - } - this.Text = fPath; - } - } - public class VersionWindow - { - private int _VersionID; - public int VersionID - { - get { return _VersionID; } - set { _VersionID = value; } - } - private int _DBId; - public int DBId - { - get { return _DBId; } - set { _DBId = value; } - } - private Rectangle _MyRectangle; - public Rectangle MyRectangle - { - get { return _MyRectangle; } - set { _MyRectangle = value; } - } - public override string ToString() - { - RectangleConverter rc = new RectangleConverter(); - return string.Format("{0}~{1}", _VersionID, rc.ConvertToString(_MyRectangle)); - } - public VersionWindow(string str) - { - string[] parts = str.Split('~'); - _VersionID = int.Parse(parts[0]); - RectangleConverter rc = new RectangleConverter(); - _MyRectangle = (Rectangle)rc.ConvertFromString(parts[1]); - } - } - public class VersionWindowList : List - { - public static VersionWindowList GetVersionWindowList(System.Collections.Specialized.StringCollection list) - { - VersionWindowList vwl = new VersionWindowList(); - if (list != null) - { - foreach (string str in list) - vwl.Add(new VersionWindow(str)); - } - return vwl; - } - public System.Collections.Specialized.StringCollection ToSettings() - { - if (Count == 0) return null; - System.Collections.Specialized.StringCollection retval = new System.Collections.Specialized.StringCollection(); - foreach (VersionWindow vw in this) - retval.Add(vw.ToString()); - return retval; - } - public new void Add(VersionWindow versionWindow) - { - foreach (VersionWindow vw in this) - { - if (vw.VersionID == versionWindow.VersionID) - { - this.Remove(vw); - break; - } - } - base.Add(versionWindow); - } - } -} diff --git a/PROMS/Volian.Controls.Library/frmEnhanced.resx b/PROMS/Volian.Controls.Library/frmEnhanced.resx deleted file mode 100644 index 7080a7d1..00000000 --- a/PROMS/Volian.Controls.Library/frmEnhanced.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/frmImportWordContents.Designer.cs b/PROMS/Volian.Controls.Library/frmImportWordContents.Designer.cs deleted file mode 100644 index 0e7f482d..00000000 --- a/PROMS/Volian.Controls.Library/frmImportWordContents.Designer.cs +++ /dev/null @@ -1,561 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class frmImportWordContents - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.txbWordFile = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.labelX1 = new DevComponents.DotNetBar.LabelX(); - this.btnBrowse = new DevComponents.DotNetBar.ButtonX(); - this.labelX2 = new DevComponents.DotNetBar.LabelX(); - this.txvStyle = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.txbLevel = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.labelX3 = new DevComponents.DotNetBar.LabelX(); - this.txbWrdText = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.btnOpen = new DevComponents.DotNetBar.ButtonX(); - this.btnPage = new DevComponents.DotNetBar.ButtonX(); - this.btnPrev = new DevComponents.DotNetBar.ButtonX(); - this.btnNext = new DevComponents.DotNetBar.ButtonX(); - this.ofd = new System.Windows.Forms.OpenFileDialog(); - this.btnNextIns = new DevComponents.DotNetBar.ButtonX(); - this.btnNextRpl = new DevComponents.DotNetBar.ButtonX(); - this.btnReplaceNext = new DevComponents.DotNetBar.ButtonX(); - this.btnInsertNext = new DevComponents.DotNetBar.ButtonX(); - this.btnAfter = new DevComponents.DotNetBar.ButtonX(); - this.btnSect = new DevComponents.DotNetBar.ButtonX(); - this.btnHigh = new DevComponents.DotNetBar.ButtonX(); - this.btnSEQ = new DevComponents.DotNetBar.ButtonX(); - this.btnParentAfter = new DevComponents.DotNetBar.ButtonX(); - this.btnSplit = new DevComponents.DotNetBar.ButtonX(); - this.btnPaste = new DevComponents.DotNetBar.ButtonX(); - this.tbxNumber = new DevComponents.DotNetBar.Controls.TextBoxX(); - this.labelX4 = new DevComponents.DotNetBar.LabelX(); - this.lblTable = new DevComponents.DotNetBar.LabelX(); - this.btnCurrent = new DevComponents.DotNetBar.ButtonX(); - this.btnTest = new DevComponents.DotNetBar.ButtonX(); - this.txbImport = new System.Windows.Forms.TextBox(); - this.lblFS = new DevComponents.DotNetBar.LabelX(); - this.btnTableConvert = new DevComponents.DotNetBar.ButtonX(); - this.pbTable = new System.Windows.Forms.ProgressBar(); - this.SuspendLayout(); - // - // txbWordFile - // - // - // - // - this.txbWordFile.Border.Class = "TextBoxBorder"; - this.txbWordFile.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.txbWordFile.Location = new System.Drawing.Point(3, 29); - this.txbWordFile.Name = "txbWordFile"; - this.txbWordFile.PreventEnterBeep = true; - this.txbWordFile.Size = new System.Drawing.Size(626, 20); - this.txbWordFile.TabIndex = 0; - this.txbWordFile.TextChanged += new System.EventHandler(this.txbWordFile_TextChanged); - // - // labelX1 - // - // - // - // - this.labelX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.labelX1.Location = new System.Drawing.Point(2, 0); - this.labelX1.Name = "labelX1"; - this.labelX1.Size = new System.Drawing.Size(75, 23); - this.labelX1.TabIndex = 1; - this.labelX1.Text = "Word File:"; - // - // btnBrowse - // - this.btnBrowse.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnBrowse.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnBrowse.Location = new System.Drawing.Point(644, 12); - this.btnBrowse.Name = "btnBrowse"; - this.btnBrowse.Size = new System.Drawing.Size(75, 23); - this.btnBrowse.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnBrowse.TabIndex = 2; - this.btnBrowse.Text = "Browse"; - this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click); - // - // labelX2 - // - // - // - // - this.labelX2.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.labelX2.Location = new System.Drawing.Point(13, 58); - this.labelX2.Name = "labelX2"; - this.labelX2.Size = new System.Drawing.Size(35, 23); - this.labelX2.TabIndex = 3; - this.labelX2.Text = "Style:"; - // - // txvStyle - // - this.txvStyle.BackColor = System.Drawing.SystemColors.Control; - // - // - // - this.txvStyle.Border.Class = "TextBoxBorder"; - this.txvStyle.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.txvStyle.Location = new System.Drawing.Point(54, 58); - this.txvStyle.Name = "txvStyle"; - this.txvStyle.PreventEnterBeep = true; - this.txvStyle.ReadOnly = true; - this.txvStyle.Size = new System.Drawing.Size(226, 20); - this.txvStyle.TabIndex = 4; - // - // txbLevel - // - // - // - // - this.txbLevel.Border.Class = "TextBoxBorder"; - this.txbLevel.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.txbLevel.Location = new System.Drawing.Point(323, 58); - this.txbLevel.Name = "txbLevel"; - this.txbLevel.PreventEnterBeep = true; - this.txbLevel.ReadOnly = true; - this.txbLevel.Size = new System.Drawing.Size(36, 20); - this.txbLevel.TabIndex = 6; - // - // labelX3 - // - // - // - // - this.labelX3.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.labelX3.Location = new System.Drawing.Point(282, 58); - this.labelX3.Name = "labelX3"; - this.labelX3.Size = new System.Drawing.Size(35, 23); - this.labelX3.TabIndex = 5; - this.labelX3.Text = "Level:"; - // - // txbWrdText - // - // - // - // - this.txbWrdText.Border.Class = "TextBoxBorder"; - this.txbWrdText.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.txbWrdText.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txbWrdText.Location = new System.Drawing.Point(13, 84); - this.txbWrdText.Multiline = true; - this.txbWrdText.Name = "txbWrdText"; - this.txbWrdText.PreventEnterBeep = true; - this.txbWrdText.Size = new System.Drawing.Size(611, 81); - this.txbWrdText.TabIndex = 7; - this.txbWrdText.TextChanged += new System.EventHandler(this.txbWrdText_TextChanged); - // - // btnOpen - // - this.btnOpen.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnOpen.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnOpen.Location = new System.Drawing.Point(644, 41); - this.btnOpen.Name = "btnOpen"; - this.btnOpen.Size = new System.Drawing.Size(75, 23); - this.btnOpen.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnOpen.TabIndex = 8; - this.btnOpen.Text = "Open"; - this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click); - // - // btnPage - // - this.btnPage.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnPage.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnPage.Location = new System.Drawing.Point(635, 84); - this.btnPage.Name = "btnPage"; - this.btnPage.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F10); - this.btnPage.Size = new System.Drawing.Size(84, 23); - this.btnPage.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnPage.TabIndex = 9; - this.btnPage.Text = "Page (F10)"; - this.btnPage.Click += new System.EventHandler(this.btnPage_Click); - // - // btnPrev - // - this.btnPrev.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnPrev.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnPrev.Location = new System.Drawing.Point(636, 113); - this.btnPrev.Name = "btnPrev"; - this.btnPrev.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F11); - this.btnPrev.Size = new System.Drawing.Size(84, 23); - this.btnPrev.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnPrev.TabIndex = 10; - this.btnPrev.Text = "Previous (F11)"; - this.btnPrev.Click += new System.EventHandler(this.btnPrev_Click); - // - // btnNext - // - this.btnNext.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnNext.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnNext.Location = new System.Drawing.Point(636, 142); - this.btnNext.Name = "btnNext"; - this.btnNext.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F12); - this.btnNext.Size = new System.Drawing.Size(84, 23); - this.btnNext.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnNext.TabIndex = 11; - this.btnNext.Text = "Next (F12)"; - this.btnNext.Click += new System.EventHandler(this.btnNext_Click); - // - // ofd - // - this.ofd.Filter = "Docx Files|*.docx|Doc Files|*.doc|All Files|*.*"; - this.ofd.FileOk += new System.ComponentModel.CancelEventHandler(this.ofd_FileOk); - // - // btnNextIns - // - this.btnNextIns.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnNextIns.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnNextIns.Location = new System.Drawing.Point(319, 3); - this.btnNextIns.Name = "btnNextIns"; - this.btnNextIns.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F4); - this.btnNextIns.Size = new System.Drawing.Size(102, 20); - this.btnNextIns.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnNextIns.TabIndex = 12; - this.btnNextIns.Text = "Insert After (F4)"; - this.btnNextIns.Visible = false; - // - // btnNextRpl - // - this.btnNextRpl.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnNextRpl.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnNextRpl.Location = new System.Drawing.Point(211, 3); - this.btnNextRpl.Name = "btnNextRpl"; - this.btnNextRpl.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F3); - this.btnNextRpl.Size = new System.Drawing.Size(102, 20); - this.btnNextRpl.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnNextRpl.TabIndex = 13; - this.btnNextRpl.Text = "Replace After (F3)"; - this.btnNextRpl.Visible = false; - // - // btnReplaceNext - // - this.btnReplaceNext.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnReplaceNext.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnReplaceNext.Location = new System.Drawing.Point(637, 200); - this.btnReplaceNext.Name = "btnReplaceNext"; - this.btnReplaceNext.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F3); - this.btnReplaceNext.Size = new System.Drawing.Size(82, 20); - this.btnReplaceNext.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnReplaceNext.TabIndex = 15; - this.btnReplaceNext.Text = "Replace Next"; - this.btnReplaceNext.Click += new System.EventHandler(this.btnReplaceNext_Click); - // - // btnInsertNext - // - this.btnInsertNext.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnInsertNext.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnInsertNext.Location = new System.Drawing.Point(637, 226); - this.btnInsertNext.Name = "btnInsertNext"; - this.btnInsertNext.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F4); - this.btnInsertNext.Size = new System.Drawing.Size(82, 20); - this.btnInsertNext.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnInsertNext.TabIndex = 14; - this.btnInsertNext.Text = "Insert Next"; - this.btnInsertNext.Click += new System.EventHandler(this.btnInsertNext_Click); - // - // btnAfter - // - this.btnAfter.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnAfter.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnAfter.Location = new System.Drawing.Point(600, 200); - this.btnAfter.Name = "btnAfter"; - this.btnAfter.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F3); - this.btnAfter.Size = new System.Drawing.Size(31, 20); - this.btnAfter.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnAfter.TabIndex = 17; - this.btnAfter.Text = "After"; - this.btnAfter.Click += new System.EventHandler(this.btnAfter_Click); - // - // btnSect - // - this.btnSect.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnSect.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnSect.Location = new System.Drawing.Point(405, 200); - this.btnSect.Name = "btnSect"; - this.btnSect.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F3); - this.btnSect.Size = new System.Drawing.Size(31, 20); - this.btnSect.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnSect.TabIndex = 18; - this.btnSect.Text = "Sect"; - this.btnSect.Click += new System.EventHandler(this.btnSect_Click); - // - // btnHigh - // - this.btnHigh.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnHigh.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnHigh.Location = new System.Drawing.Point(526, 200); - this.btnHigh.Name = "btnHigh"; - this.btnHigh.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F3); - this.btnHigh.Size = new System.Drawing.Size(31, 20); - this.btnHigh.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnHigh.TabIndex = 19; - this.btnHigh.Text = "High"; - this.btnHigh.Click += new System.EventHandler(this.btnHigh_Click); - // - // btnSEQ - // - this.btnSEQ.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnSEQ.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnSEQ.Location = new System.Drawing.Point(563, 200); - this.btnSEQ.Name = "btnSEQ"; - this.btnSEQ.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F3); - this.btnSEQ.Size = new System.Drawing.Size(31, 20); - this.btnSEQ.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnSEQ.TabIndex = 20; - this.btnSEQ.Text = "Seq"; - this.btnSEQ.Click += new System.EventHandler(this.btnSEQ_Click); - // - // btnParentAfter - // - this.btnParentAfter.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnParentAfter.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnParentAfter.Location = new System.Drawing.Point(563, 226); - this.btnParentAfter.Name = "btnParentAfter"; - this.btnParentAfter.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F3); - this.btnParentAfter.Size = new System.Drawing.Size(68, 20); - this.btnParentAfter.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnParentAfter.TabIndex = 21; - this.btnParentAfter.Text = "Parent After"; - this.btnParentAfter.Click += new System.EventHandler(this.btnParentAfter_Click); - // - // btnSplit - // - this.btnSplit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnSplit.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnSplit.Location = new System.Drawing.Point(526, 226); - this.btnSplit.Name = "btnSplit"; - this.btnSplit.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F3); - this.btnSplit.Size = new System.Drawing.Size(31, 20); - this.btnSplit.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnSplit.TabIndex = 22; - this.btnSplit.Text = "Split"; - this.btnSplit.Click += new System.EventHandler(this.btnSplit_Click); - // - // btnPaste - // - this.btnPaste.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnPaste.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnPaste.Location = new System.Drawing.Point(636, 252); - this.btnPaste.Name = "btnPaste"; - this.btnPaste.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F3); - this.btnPaste.Size = new System.Drawing.Size(83, 20); - this.btnPaste.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnPaste.TabIndex = 23; - this.btnPaste.Text = "Paste"; - this.btnPaste.Click += new System.EventHandler(this.btnPaste_Click); - // - // tbxNumber - // - // - // - // - this.tbxNumber.Border.Class = "TextBoxBorder"; - this.tbxNumber.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.tbxNumber.Location = new System.Drawing.Point(434, 58); - this.tbxNumber.Name = "tbxNumber"; - this.tbxNumber.PreventEnterBeep = true; - this.tbxNumber.Size = new System.Drawing.Size(56, 20); - this.tbxNumber.TabIndex = 25; - // - // labelX4 - // - // - // - // - this.labelX4.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.labelX4.Location = new System.Drawing.Point(377, 58); - this.labelX4.Name = "labelX4"; - this.labelX4.Size = new System.Drawing.Size(51, 23); - this.labelX4.TabIndex = 24; - this.labelX4.Text = "Number:"; - // - // lblTable - // - // - // - // - this.lblTable.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.lblTable.Location = new System.Drawing.Point(496, 58); - this.lblTable.Name = "lblTable"; - this.lblTable.Size = new System.Drawing.Size(52, 23); - this.lblTable.TabIndex = 26; - this.lblTable.Text = "Not Table"; - // - // btnCurrent - // - this.btnCurrent.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnCurrent.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnCurrent.Location = new System.Drawing.Point(637, 171); - this.btnCurrent.Name = "btnCurrent"; - this.btnCurrent.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F12); - this.btnCurrent.Size = new System.Drawing.Size(84, 23); - this.btnCurrent.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnCurrent.TabIndex = 27; - this.btnCurrent.Text = "Current"; - this.btnCurrent.Click += new System.EventHandler(this.btnCurrent_Click); - // - // btnTest - // - this.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnTest.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnTest.Location = new System.Drawing.Point(122, 3); - this.btnTest.Name = "btnTest"; - this.btnTest.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F3); - this.btnTest.Size = new System.Drawing.Size(31, 20); - this.btnTest.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnTest.TabIndex = 28; - this.btnTest.Text = "Test"; - this.btnTest.Visible = false; - // - // txbImport - // - this.txbImport.Font = new System.Drawing.Font("Times New Roman", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txbImport.Location = new System.Drawing.Point(16, 178); - this.txbImport.Multiline = true; - this.txbImport.Name = "txbImport"; - this.txbImport.Size = new System.Drawing.Size(360, 93); - this.txbImport.TabIndex = 29; - // - // lblFS - // - // - // - // - this.lblFS.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.lblFS.Location = new System.Drawing.Point(563, 58); - this.lblFS.Name = "lblFS"; - this.lblFS.Size = new System.Drawing.Size(52, 23); - this.lblFS.TabIndex = 30; - this.lblFS.Text = "FS"; - // - // btnTableConvert - // - this.btnTableConvert.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnTableConvert.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnTableConvert.Location = new System.Drawing.Point(405, 226); - this.btnTableConvert.Name = "btnTableConvert"; - this.btnTableConvert.Shortcuts.Add(DevComponents.DotNetBar.eShortcut.F3); - this.btnTableConvert.Size = new System.Drawing.Size(31, 20); - this.btnTableConvert.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnTableConvert.TabIndex = 31; - this.btnTableConvert.Text = "Table"; - this.btnTableConvert.Click += new System.EventHandler(this.btnTableConvert_Click); - // - // pbTable - // - this.pbTable.Location = new System.Drawing.Point(405, 252); - this.pbTable.Name = "pbTable"; - this.pbTable.Size = new System.Drawing.Size(225, 20); - this.pbTable.TabIndex = 32; - // - // frmImportWordContents - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(731, 280); - this.Controls.Add(this.pbTable); - this.Controls.Add(this.btnTableConvert); - this.Controls.Add(this.lblFS); - this.Controls.Add(this.txbImport); - this.Controls.Add(this.btnTest); - this.Controls.Add(this.btnCurrent); - this.Controls.Add(this.lblTable); - this.Controls.Add(this.tbxNumber); - this.Controls.Add(this.labelX4); - this.Controls.Add(this.btnPaste); - this.Controls.Add(this.btnSplit); - this.Controls.Add(this.btnParentAfter); - this.Controls.Add(this.btnSEQ); - this.Controls.Add(this.btnHigh); - this.Controls.Add(this.btnSect); - this.Controls.Add(this.btnAfter); - this.Controls.Add(this.btnReplaceNext); - this.Controls.Add(this.btnInsertNext); - this.Controls.Add(this.btnNextRpl); - this.Controls.Add(this.btnNextIns); - this.Controls.Add(this.btnNext); - this.Controls.Add(this.btnPrev); - this.Controls.Add(this.btnPage); - this.Controls.Add(this.btnOpen); - this.Controls.Add(this.txbWrdText); - this.Controls.Add(this.txbLevel); - this.Controls.Add(this.labelX3); - this.Controls.Add(this.txvStyle); - this.Controls.Add(this.labelX2); - this.Controls.Add(this.btnBrowse); - this.Controls.Add(this.labelX1); - this.Controls.Add(this.txbWordFile); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "frmImportWordContents"; - this.ShowIcon = false; - this.Text = "Import Word Contents"; - this.Activated += new System.EventHandler(this.frmImportWordContents_Activated); - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmImportWordContents_FormClosing); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private DevComponents.DotNetBar.Controls.TextBoxX txbWordFile; - private DevComponents.DotNetBar.LabelX labelX1; - private DevComponents.DotNetBar.ButtonX btnBrowse; - private DevComponents.DotNetBar.LabelX labelX2; - private DevComponents.DotNetBar.Controls.TextBoxX txvStyle; - private DevComponents.DotNetBar.Controls.TextBoxX txbLevel; - private DevComponents.DotNetBar.LabelX labelX3; - private DevComponents.DotNetBar.Controls.TextBoxX txbWrdText; - private DevComponents.DotNetBar.ButtonX btnOpen; - private DevComponents.DotNetBar.ButtonX btnPage; - private DevComponents.DotNetBar.ButtonX btnPrev; - private DevComponents.DotNetBar.ButtonX btnNext; - private System.Windows.Forms.OpenFileDialog ofd; - private DevComponents.DotNetBar.ButtonX btnNextIns; - private DevComponents.DotNetBar.ButtonX btnNextRpl; - private DevComponents.DotNetBar.ButtonX btnReplaceNext; - private DevComponents.DotNetBar.ButtonX btnInsertNext; - private DevComponents.DotNetBar.ButtonX btnAfter; - private DevComponents.DotNetBar.ButtonX btnSect; - private DevComponents.DotNetBar.ButtonX btnHigh; - private DevComponents.DotNetBar.ButtonX btnSEQ; - private DevComponents.DotNetBar.ButtonX btnParentAfter; - private DevComponents.DotNetBar.ButtonX btnSplit; - private DevComponents.DotNetBar.ButtonX btnPaste; - private DevComponents.DotNetBar.Controls.TextBoxX tbxNumber; - private DevComponents.DotNetBar.LabelX labelX4; - private DevComponents.DotNetBar.LabelX lblTable; - private DevComponents.DotNetBar.ButtonX btnCurrent; - private DevComponents.DotNetBar.ButtonX btnTest; - private System.Windows.Forms.TextBox txbImport; - private DevComponents.DotNetBar.LabelX lblFS; - private DevComponents.DotNetBar.ButtonX btnTableConvert; - private System.Windows.Forms.ProgressBar pbTable; - } -} diff --git a/PROMS/Volian.Controls.Library/frmImportWordContents.cs b/PROMS/Volian.Controls.Library/frmImportWordContents.cs deleted file mode 100644 index 4669154a..00000000 --- a/PROMS/Volian.Controls.Library/frmImportWordContents.cs +++ /dev/null @@ -1,885 +0,0 @@ - using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using System.IO; -using LBWordLibrary; -using System.Xml; -using VEPROMS.CSLA.Library; - -namespace Volian.Controls.Library -{ - public partial class frmImportWordContents : Form - { - LBApplicationClass _WordApp; - bool _initializing = false; - private StepRTB _MyStepRTB = null; - - public StepRTB MyStepRTB - { - get { return _MyStepRTB; } - set { _MyStepRTB = value; } - } - public frmImportWordContents() - { - _initializing = true; - InitializeComponent(); - // C2019-021 Allow the Number field to be edited. - txbWordFile.Text = Properties.Settings.Default.ImportWordFilePath; - disableButtons(); - _initializing = false; - // B2019-108 Enable/disable buttons - btnOpen.Enabled = File.Exists(txbWordFile.Text) && _WordApp == null; - } - - private void disableButtons() - { - // B2019-108 Enable/disable buttons - btnOpen.Enabled = File.Exists(txbWordFile.Text) && _WordApp == null; ; - btnNext.Enabled = false; - btnPage.Enabled = false; - btnPrev.Enabled = false; - btnCurrent.Enabled = false; - btnInsertNext.Enabled = false; - btnReplaceNext.Enabled = false; - } - private void ofd_FileOk(object sender, CancelEventArgs e) - { - _initializing = true; - txbWordFile.Text = ofd.FileName; - _initializing = false; - } - - private void btnBrowse_Click(object sender, EventArgs e) - { - // if we have a word doc open, then close it and reset WordApp - if (_WordApp != null) - { - try - { - _WordApp.Quit(); - } - catch - { - // will error if user already closed Word - } - _WordApp = null; - disableButtons(); - } - if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) - { - btnOpen_Click(sender, e); - } - } - private void btnOpen_Click(object sender, EventArgs e) - { - if (!File.Exists(txbWordFile.Text)) - { - MessageBox.Show(string.Format("{0}", txbWordFile.Text), "File Does Not Exist", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - disableButtons(); - return; - } - _WordApp = new LBApplicationClass(); - _WordApp.Documents.Open(txbWordFile.Text); - _WordApp.Visible = true; - // B2019-108 Enable/disable buttons - EnableButtons(); - Properties.Settings.Default.ImportWordFilePath = txbWordFile.Text; - Properties.Settings.Default.Save(); - } - private void EnableButtons() - { - btnOpen.Enabled = File.Exists(txbWordFile.Text) && _WordApp == null; ; - btnNext.Enabled = true; - btnPage.Enabled = true; - btnPrev.Enabled = true; - btnCurrent.Enabled = true; - btnInsertNext.Enabled = true; - btnReplaceNext.Enabled = true; - } - private void btnPage_Click(object sender, EventArgs e) - { - _WordApp.Selection.MoveDown(LBWdUnits.wdScreen, 1, 0); - } - private void btnPrev_Click(object sender, EventArgs e) - { - // 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, 1); // Select paragraph - //_WordApp.Selection.MoveEnd(LBWdUnits.wdCharacter, -1); // Move 1 Character Back - try - { - // C2019-021 Use generic function CopyWordText - CopyWordText(); - if (txbWrdText.Text.TrimEnd("\r\n\f".ToCharArray()) == "") - btnPrev_Click(sender, e); - else - Clipboard.SetText(txbWrdText.Text); - } - catch - { } - } - // C2019-021 RHM 5/15/2019 Added new methods and properties for Import Word Content - /// - /// MoveToNextCell - /// Find the next Cell including merged cells - /// Loop through columns then rows - /// - /// - /// Yes - if Processed as a cell - /// No - Not Processed - /// - private bool MoveToNextCell() - { - // Get the row and column for the current selection within the table. - int rowIndex = _WordApp.Selection.Cells[1].RowIndex; - int columnIndex = _WordApp.Selection.Cells[1].ColumnIndex; - // Only do this for tables - if (_WordApp.Selection.Tables != null && _WordApp.Selection.Tables.Count > 0) - { - LBTable tbl = _WordApp.Selection.Tables[1]; - if (tbl.Range.Cells != null && tbl.Range.Cells.Count > 0) - { - // Make sure the entire cell is selected - _WordApp.Selection.SelectCell(); - // Loop through the cells of the table - for (int i = 1; i < tbl.Range.Cells.Count; i++) - { - LBCell myCell = tbl.Range.Cells[i]; - // if this cell has matching indices, then move to the next cell - if (myCell.RowIndex == rowIndex && myCell.ColumnIndex == columnIndex) - { - // Move the Start to the start of the next cell - _WordApp.Selection.Start = tbl.Range.Cells[i + 1].Range.Start; - // Select the entire cell_WordApp.Selection.Start = - _WordApp.Selection.SelectCell(); - return true; // Cell Found and moved - } - } - } - } - return false; // Cell not found - } - private void btnNext_Click(object sender, EventArgs e) - { - // C2019-021 Either move by cells or paragraphs - if (_WordApp.Selection.Cells != null && _WordApp.Selection.Cells.Count > 0) - { - if (!MoveToNextCell()) - { - _WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 2, 0);// Move beyond the table - _WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 1, 1);// Select a Paragraph - } - } - else // not a table - { - _WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 1, 0); // Move to the next paragraph - _WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 1, 1); // Select a Paragraph - } - try - { - // C2019-021 Use Generic CopyWordText - CopyWordText(); - if (_WordApp.Selection.Cells != null && _WordApp.Selection.Cells.Count > 0) - { - Clipboard.SetText(txbWrdText.Text); - } - else - { - // C2019-021 If the word text only contains whitespace skip to next - if (txbWrdText.Text.TrimEnd("\f\r\n".ToCharArray()) == "") - btnNext_Click(sender, e); - else - Clipboard.SetText(txbWrdText.Text); - } - } - catch - { } - } - // C2019-021 Generic CopyWordText (Copy Text, Style and Number to fields on form) - private void CopyWordText() - { - // B2019-108 Display Font Size - // B2019-153 Get Font size from the beginning of the selection if the font size - // for the entire selection is invalid (999999) (Mixed font sizes) - - lblFS.Text = GetFontSize() + " Pts"; - txvStyle.Text = _WordApp.Selection.Style.NameLocal; - txbLevel.Text = _WordApp.Selection.Style.ListLevelNumber.ToString(); - tbxNumber.Text = _WordApp.Selection.Range.ListFormat.ListString; - // C2019-021 RHM 5/15/2019 Added new methods and properties for Import Word Content - try - { - //Console.WriteLine("Cell Count = {0}", _WordApp.Selection.Cells.Count); - lblTable.Text = "Table"; - lblTable.FontBold = true; - } - catch - { - lblTable.Text = "Not Table"; - lblTable.FontBold = false; - } - // B2019-108 Replace Special Characters - string txt = ShowText(_WordApp.Selection.Text.TrimEnd("\r\a".ToCharArray()) - .Replace("\x1D", "-")// Hyphen - .Replace("\x1E", "-")// Hyphen - .Replace("\x2013", "-")// Hyphen - .Replace("\xa0", " ")// Space - .Replace("\x0b", " ")// Space Soft Return - .Replace("\x201C", "\"")// Space - .Replace("\x201D", "\"")// Space - .Replace("\x09INITIAL", "")// Space - ); - if (txt.Contains("\x09_____")) // Tab Signoff - txt = txt.Substring(0, txt.IndexOf("\x09_____")).TrimEnd(" \x09".ToCharArray());// Trim spaces and Tabs - txbWrdText.Text = txt; - - _WordApp.Activate(); - } - // B2019-153 Get Font size from the beginning of the selection if the font size - // for the entire selection is invalid (999999) (Mixed font sizes) - - private string GetFontSize() - { - try - { - float retval = _WordApp.Selection.Font.Size; - if (retval > 14) - { - LBRange rng = _WordApp.Selection.Range; - rng.End = rng.Start; - retval = rng.Font.Size; - if (retval > 14) - retval = 12; - } - return retval.ToString(); - } - catch (Exception ex) - { - return "12"; - } - } - // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content - private string ShowText(string txt) - { - // This was for debugging - //StringBuilder sb = new StringBuilder(); - //foreach (char c in txt) - // if (((int)c) >= ' ' && ((int)c) < '\x7F') - // sb.Append(c); - // else - // sb.Append(string.Format("\\u{0:X4} ", ((int)c))); - //return sb.ToString(); - return txt; - } - private void txbWordFile_TextChanged(object sender, EventArgs e) - { - // B2019-108 Enable/disable buttons - btnOpen.Enabled = File.Exists(txbWordFile.Text) && _WordApp == null; - } - private void frmImportWordContents_FormClosing(object sender, FormClosingEventArgs e) - { - try - { - if (_WordApp != null) - _WordApp.Quit(); - // B2019-108 Reset WordApp when closed. - _WordApp = null; - } - catch - { - // 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}"); // - 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}"); // - 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. - private void btnReplaceNext_Click(object sender, EventArgs e) - { - if (MyStepRTB != null) - { - if (MyStepRTB.Parent is VlnFlexGrid)//Replace text in a Grid (Table cell) - { - VlnFlexGrid vg = MyStepRTB.Parent as VlnFlexGrid; - vg.StartEditing(); - MyStepRTB.Text = txbWrdText.Text; - // B2019-108 Set font for table cell - if (MyStepRTB.Parent is VlnFlexGrid && lblFS.Text != "FS") - { - Font fs = MyStepRTB.Font; - fs = new Font(fs.FontFamily, float.Parse(lblFS.Text.Replace("Pts", "")), fs.Style); - MyStepRTB.Font = fs; - } - vg[vg.Row, vg.Col] = MyStepRTB.Rtf; - vg.FinishEditing(false); - } - else if (MyStepRTB.MyItemInfo.IsSection && tbxNumber.Text != "") - { - using (VEPROMS.CSLA.Library.Item ii = MyStepRTB.MyItemInfo.Get()) - { - ii.MyContent.Text = txbWrdText.Text.Trim("\r\n\f".ToCharArray()); - ii.MyContent.Number = tbxNumber.Text; - ii.MyContent.Save(); - } - EditItem ei = MyStepRTB.Parent as EditItem; - ei.RefreshTab(); - } - else - { - MyStepRTB.Text = txbWrdText.Text.Trim("\r\n".ToCharArray()); - MyStepRTB.Select(MyStepRTB.TextLength, 0); - } - btnNext_Click(sender, e); - } - } - - // C2019-021 New function to insert the Word text into PROMS and move to the next paragraph in Word - private void btnInsertNext_Click(object sender, EventArgs e) - { - if (MyStepRTB != null) - { - MyStepRTB.SelectedText = txbWrdText.Text.Trim("\r\n\f".ToCharArray()); - MyStepRTB.Select(MyStepRTB.TextLength, 0); - btnNext_Click(sender, e); - } - - } - - // C2019-021 New Function to create a after node in PROMS - private void btnAfter_Click(object sender, EventArgs e) - { - if (MyStepRTB != null) - { - if (MyStepRTB.Parent is VlnFlexGrid) - { - VlnFlexGrid vg = MyStepRTB.Parent as VlnFlexGrid; - //vg.FinishEditing(false); - vg.SelectNextCell(); - } - else - { - EditItem ei = MyStepRTB.Parent as EditItem; - if (ei != null) - { - ei.AddSiblingAfter(); - } - } - } - } - - // C2019-021 Add a New Section in PROMS (Default Type = 10000) - private void btnSect_Click(object sender, EventArgs e) - { - if (MyStepRTB != null) - { - EditItem ei = MyStepRTB.Parent as EditItem; - if (ei.MyItemInfo.IsProcedure) - { - ei.AddChild(VEPROMS.CSLA.Library.E_FromType.Section, 10000);// TODO: Need Type for Procedure Steps - return; - } - while (ei != null && !ei.MyItemInfo.IsSection) - if (ei.MyParentEditItem != null) - ei = ei.MyParentEditItem; - else - ei = ei.MyPreviousEditItem; - if (ei != null) - { - ei.AddSiblingAfter(); - } - } - } - // C201-021 New Function Add a new High level step - private void btnHigh_Click(object sender, EventArgs e) - { - if (MyStepRTB != null) - { - EditItem ei = GetEditItem(MyStepRTB); - if (ei != null && ei.MyItemInfo.IsSection) - { - ei.AddChild(VEPROMS.CSLA.Library.E_FromType.Step, 20002); - return; - } - while (ei != null && !ei.MyItemInfo.IsHigh) - if (ei.MyParentEditItem != null) - ei = ei.MyParentEditItem; - else - ei = ei.MyPreviousEditItem; - if (ei != null) - { - ei.AddSiblingAfter(); - } - } - } - private EditItem GetEditItem(Control Ctrl) - { - while (Ctrl != null) - { - Ctrl = Ctrl.Parent; - if (Ctrl is EditItem) return Ctrl as EditItem; - } - return null; - } - // C2019-021 New Function Add a new sequential substep - private void btnSEQ_Click(object sender, EventArgs e) - { - if (MyStepRTB != null) - { - EditItem ei = MyStepRTB.Parent as EditItem; - ei.AddChild(VEPROMS.CSLA.Library.E_FromType.Step, 20001); - } - } - // C2019-021 New Function Add a new parent step after - private void btnParentAfter_Click(object sender, EventArgs e) - { - if (MyStepRTB != null) - { - EditItem ei = MyStepRTB.Parent as EditItem; - while (ei.MyPreviousEditItem != null) - ei = ei.MyPreviousEditItem; - if (ei != null && ei.MyParentEditItem != null) - { - ei.MyParentEditItem.AddSiblingAfter(); - } - } - } - // C2019-021 New Function Split the text in the current proms window into two - // The text before the selection is kept in the current PROMS window - // The selected text is deleted - // the text after the selection is cut to the clipboard - private void btnSplit_Click(object sender, EventArgs e) - { - if (MyStepRTB != null) - { - MyStepRTB.SelectedText = ""; - MyStepRTB.Select(MyStepRTB.SelectionStart, MyStepRTB.TextLength - MyStepRTB.SelectionStart); - Clipboard.SetText(MyStepRTB.SelectedText); - MyStepRTB.SelectedText = ""; - } - } - // C2019-021 New Function - Performs a paste in the current window - private void btnPaste_Click(object sender, EventArgs e) - { - if (MyStepRTB != null) - { - MyStepRTB.SelectedText = Clipboard.GetText(); - } - } - // C2019-021 RHM 5/15/2019 Added new methods and properties for Import Word Content - private void btnCurrent_Click(object sender, EventArgs e) - { - // 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 - { - _WordApp.Selection.Cells[1].Range.Select(); - } - catch - { - _WordApp.Selection.Paragraphs[1].Range.Select(); - } - try - { - // C2019-021 Use Generic CopyWordText - CopyWordText(); - // 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); - } - catch - { - // 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 - private void txbWrdText_TextChanged(object sender, EventArgs e) - { - txbImport.Text = fixText(txbWrdText.Text); - } - - private string fixText(string txt) - { - StringBuilder sb = new StringBuilder(); - foreach (char c in txt) - { - int ic = (int)c; - if (ic < 32 || ic > '\x7F') - { - sb.Append(string.Format("[x{0:x2}]", ic)); - //MessageBox.Show(string.Format("[x{0:x2} - {1}]", ic, txt), "Special Character"); - } - else - sb.Append(c); - } - return sb.ToString(); - } - - // B2019-108 Handle WordApp status - private void frmImportWordContents_Activated(object sender, EventArgs e) - { - // 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 - { - if (_WordApp != null || _WordApp.WindowState == LBWdWindowState.wdWindowStateMinimize) - _WordApp.WindowState = LBWdWindowState.wdWindowStateNormal; - } - catch - { - _WordApp = null; - 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) - { - string xml = ConvertWordToXML(); - if (xml == null) - { - MessageBox.Show("Make sure that the Selection is within a table in Word"); - return; - } - XmlDocument xd = new XmlDocument(); - xml = xml.Replace("\x0B", "\r\n"); - try - { - xd.LoadXml(xml); - } - catch (Exception ex) - { - Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); - StringBuilder sb = new StringBuilder(); - foreach (char c in xml) - { - int ic = c; - if (ic < 32 || ic > 128) - sb.Append(string.Format("<<<<{0:X4}>>>>", ic)); - else - sb.Append(c); - } - MessageBox.Show(ex.Message + "\r\n" + sb.ToString(), ex.GetType().Name); - return; - } - LoadTable2(xd.DocumentElement); - int type = 20008; - ItemInfo myTable; - if(MyStepRTB.MyItemInfo.IsTable) - { - using( Item itm = MyStepRTB.MyItemInfo.Get()) - { - itm.MyContent.MyGrid.Data = TblFlexGrid.GetXMLData(); - itm.MyContent.Text= TblFlexGrid.GetSearchableText(); - itm.Save(); - ItemInfo.Refresh(itm); - ContentInfo.Refresh(itm.MyContent); - GridInfo.Refresh(itm.MyContent.MyGrid); - } - } - 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; - ei.AddChild(E_FromType.Table, 20008, TblFlexGrid); - if (ei != null) ei.SetAllTabs(); - } - } - - private string ConvertWordToXML() - { - string sXML = null; - try - { - DateTime tstart = DateTime.Now; - if (_WordApp.Selection.Tables != null && _WordApp.Selection.Tables.Count > 0) - { - LBTable tbl = _WordApp.Selection.Tables[1]; - if (tbl.Range.Cells != null && tbl.Range.Cells.Count > 0) - { - // size variables to match table row and column dimensions - int[] Wcol = new int[tbl.Columns.Count]; - int[,] Wcell = new int[tbl.Rows.Count, tbl.Columns.Count]; - int[,] Hcell = new int[tbl.Rows.Count, tbl.Columns.Count]; - int[,] SpanC = new int[tbl.Rows.Count, tbl.Columns.Count]; - int[,] SpanR = new int[tbl.Rows.Count, tbl.Columns.Count]; - - DateTime tend = DateTime.Now; Console.WriteLine("{0} before Loop", TimeSpan.FromTicks(tend.Ticks - tstart.Ticks).TotalMilliseconds); tstart = tend; - pbTable.Maximum = tbl.Columns.Count * tbl.Rows.Count * tbl.Range.Cells.Count; - pbTable.Value = 0; - int iR = 0; - int iC = 0; - // capture widths for valid cells - for (int i = 1; i <= tbl.Range.Cells.Count; i++) - { - //LBCell myCell = tbl.Range.Cells[i]; - // convert points to pixels and save value - int w = (int)(tbl.Range.Cells[i].Width * 8 / 6); - iC = tbl.Range.Cells[i].ColumnIndex - 1; - Wcell[tbl.Range.Cells[i].RowIndex - 1, iC] = w; - Hcell[tbl.Range.Cells[i].RowIndex - 1, iC] = (int)(tbl.Range.Cells[i].Height * 8 / 6); - if (Wcol[iC] == 0) - { - Wcol[iC] = w; - } - else - { - if (Wcol[iC] > w) - { - Wcol[iC] = w; - } - } - } - tend = DateTime.Now; Console.WriteLine("{0} before table width", TimeSpan.FromTicks(tend.Ticks - tstart.Ticks).TotalMilliseconds); tstart = tend; - int TableWidth = 0; - for (iC = 0; iC < tbl.Columns.Count; iC++) - { - TableWidth = TableWidth + Wcol[iC]; - } - tend = DateTime.Now; Console.WriteLine("{0} before Rollup columns", TimeSpan.FromTicks(tend.Ticks - tstart.Ticks).TotalMilliseconds); tstart = tend; - // roll up columns - for (iR = 0; iR < tbl.Rows.Count; iR++) - { - int tmp = 0; - for (iC = 0; iC < tbl.Columns.Count; iC++) - { - if (Wcell[iR, iC] > TableWidth) - { - Wcell[iR, iC] = Wcol[iC]; - SpanC[iR, iC] = 1; - } - else if (Wcell[iR, iC] > 0) - { - SpanC[iR, iC] = 1; - tmp = Wcell[iR, iC] - Wcol[iC]; - while (tmp > 0) - { - for (int i = tbl.Columns.Count - 1; i > iC + 1; i--) - { - Wcell[iR, i] = Wcell[iR, i - 1]; - Wcell[iR, i - 1] = 0; - } - tmp = tmp - Wcol[iC + SpanC[iR, iC]]; - SpanC[iR, iC]++; - } - iC = iC + SpanC[iR, iC] - 1; - } - } - } - tend = DateTime.Now; Console.WriteLine("{0} before Rollup rows", TimeSpan.FromTicks(tend.Ticks - tstart.Ticks).TotalMilliseconds); tstart = tend; - //roll up row spans - for (iC = 0; iC < tbl.Columns.Count; iC++) - { - int LastGood = 0; - for (iR = 0; iR < tbl.Rows.Count; iR++) - { - if (Wcell[iR, iC] > 0) - { - // valid cell - LastGood = iR; - SpanR[LastGood, iC] = 1; - } - else - { - // invalid cell - SpanR[LastGood, iC]++; - } - } - } - tend = DateTime.Now; Console.WriteLine("{0} before Build", TimeSpan.FromTicks(tend.Ticks - tstart.Ticks).TotalMilliseconds); tstart = tend; - - // build xml for this table - - iR = -1; - int offset = 0; - sXML = ""; - for (int i = 1; i <= tbl.Range.Cells.Count; i++) - { - - LBCell myCell = tbl.Range.Cells[i]; - // if this cell has matching indices save its text - if (iR != myCell.RowIndex - 1) - { - // this is a new row - if (myCell.RowIndex > 1) - { - // close previous row - sXML += ""; - } - // start new row - sXML += ""; - iR = myCell.RowIndex - 1; - offset = 0; - } - sXML += " 1) - { - sXML += " rowspan=\"" + SpanR[iR, iC] + "\""; - } - if (SpanC[iR, iC] > 1) - { - sXML += " colspan=\"" + SpanC[iR, iC] + "\""; - offset += SpanC[iR, iC] - 1; - } - else if (Wcol[iC] > 0) - { - sXML += " width=\"" + Wcol[iC] + "\""; - Wcol[iC] = Wcol[iC] * -1; - } - string textalign = ""; - string ha; - switch (myCell.Range.ParagraphFormat.Alignment) - { - case LBWdParagraphAlignment.wdAlignParagraphCenter: - textalign += "Center"; - ha = "\\qc"; - break; - case LBWdParagraphAlignment.wdAlignParagraphRight: - textalign += "Right"; - ha = "\\qr"; - break; - default: - textalign += "Left"; - ha = "\\ql"; - break; - } - switch (myCell.VerticalAlignment) - { - case LBWdCellVerticalAlignment.wdCellAlignVerticalBottom: - textalign += "Bottom"; - break; - case LBWdCellVerticalAlignment.wdCellAlignVerticalCenter: - textalign += "Center"; - break; - case default(LBWdCellVerticalAlignment): - textalign += "Top"; - break; - } - sXML += " textalign=\"" + textalign + "\""; - sXML += ">"; - // select text from current cell - _WordApp.Selection.Start = myCell.Range.Start; - _WordApp.Selection.SelectCell(); - _WordApp.Selection.End = _WordApp.Selection.End - 1; - if (_WordApp.Selection.End > _WordApp.Selection.Start) - { - // capture formatted text - StepRTB rtbStep = new StepRTB(); - _WordApp.Selection.Copy(); - rtbStep.Paste(); - rtbStep.SelectAll(); - Console.WriteLine("RTF before {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", "!!!"); - strp = DisplayText.StaticStripRtfCommands(strp, true); - Console.WriteLine("RTF clean {0}", strp); - strp = strp.Remove(strp.LastIndexOf("!!!")); - StringBuilder sb = new StringBuilder(); - sb.Append(strp); - sb.Replace("!!!", "\\par"); - // clean up special characters - { - sb.Replace("\x1D", "-");// Hyphen - sb.Replace("\x1E", "-");// Hyphen - sb.Replace("\x2013", "-");// Hyphen - sb.Replace("\xa0", " ");// Space - sb.Replace("\x0b", " ");// Space Soft Return - sb.Replace("\x201C", "\"");// Space - sb.Replace("\x201D", "\"");// Space - sb.Replace("\x09INITIAL", "");// Space - sb.Replace("\x09_____", ""); // Tab Signoff - //sb.Replace("(P)", "(\\u10004?)"); // check mark within parenthesis - //sb.Replace("\\u9633?", "□"); //box - } - // save resulting text in xml structure - sXML += "

" + ha + sb + "

"; - } - else - { - sXML += "

"; - } - } - if (iR >= 0) - { - // at least one row hase been written so close the last row - sXML += "
"; - } - sXML += "
"; - tend = DateTime.Now; Console.WriteLine("{0} After Build", TimeSpan.FromTicks(tend.Ticks - tstart.Ticks).TotalMilliseconds); tstart = tend; - } - } - } - catch (Exception ex) - { - while (ex != null) - { - Console.WriteLine("Column{0} - {1}", ex.GetType().Name, ex.Message); - ex = ex.InnerException; - } - } - return sXML; - } - } -} - diff --git a/PROMS/Volian.Controls.Library/frmImportWordContents.resx b/PROMS/Volian.Controls.Library/frmImportWordContents.resx deleted file mode 100644 index 9b30d6cd..00000000 --- a/PROMS/Volian.Controls.Library/frmImportWordContents.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/frmSendErrorLog.Designer.cs b/PROMS/Volian.Controls.Library/frmSendErrorLog.Designer.cs deleted file mode 100644 index d3a8b780..00000000 --- a/PROMS/Volian.Controls.Library/frmSendErrorLog.Designer.cs +++ /dev/null @@ -1,266 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class frmSendErrorLog - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.btnSend = new DevComponents.DotNetBar.ButtonX(); - this.btnCancel = new DevComponents.DotNetBar.ButtonX(); - this.gpEmailSettings = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.rbOutlook = new System.Windows.Forms.RadioButton(); - this.rbManual = new System.Windows.Forms.RadioButton(); - this.tbServer = new System.Windows.Forms.TextBox(); - this.tbUsername = new System.Windows.Forms.TextBox(); - this.tbPassword = new System.Windows.Forms.TextBox(); - this.lblServer = new System.Windows.Forms.Label(); - this.lblUsername = new System.Windows.Forms.Label(); - this.lblPassword = new System.Windows.Forms.Label(); - this.panel1 = new System.Windows.Forms.Panel(); - this.tbContent = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.gpEmailSettings.SuspendLayout(); - this.SuspendLayout(); - // - // btnSend - // - this.btnSend.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnSend.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnSend.Location = new System.Drawing.Point(306, 299); - this.btnSend.Name = "btnSend"; - this.btnSend.Size = new System.Drawing.Size(75, 23); - this.btnSend.TabIndex = 0; - this.btnSend.Text = "Send"; - this.btnSend.Click += new System.EventHandler(this.btnSend_Click); - // - // btnCancel - // - this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(387, 299); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(75, 23); - this.btnCancel.TabIndex = 1; - this.btnCancel.Text = "Cancel"; - // - // gpEmailSettings - // - this.gpEmailSettings.CanvasColor = System.Drawing.SystemColors.Control; - this.gpEmailSettings.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.gpEmailSettings.Controls.Add(this.panel1); - this.gpEmailSettings.Controls.Add(this.lblPassword); - this.gpEmailSettings.Controls.Add(this.lblUsername); - this.gpEmailSettings.Controls.Add(this.lblServer); - this.gpEmailSettings.Controls.Add(this.tbPassword); - this.gpEmailSettings.Controls.Add(this.tbUsername); - this.gpEmailSettings.Controls.Add(this.tbServer); - this.gpEmailSettings.Controls.Add(this.rbManual); - this.gpEmailSettings.Controls.Add(this.rbOutlook); - this.gpEmailSettings.Location = new System.Drawing.Point(12, 169); - this.gpEmailSettings.Name = "gpEmailSettings"; - this.gpEmailSettings.Size = new System.Drawing.Size(450, 124); - // - // - // - this.gpEmailSettings.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.gpEmailSettings.Style.BackColorGradientAngle = 90; - this.gpEmailSettings.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.gpEmailSettings.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpEmailSettings.Style.BorderBottomWidth = 1; - this.gpEmailSettings.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.gpEmailSettings.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpEmailSettings.Style.BorderLeftWidth = 1; - this.gpEmailSettings.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpEmailSettings.Style.BorderRightWidth = 1; - this.gpEmailSettings.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.gpEmailSettings.Style.BorderTopWidth = 1; - this.gpEmailSettings.Style.CornerDiameter = 4; - this.gpEmailSettings.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.gpEmailSettings.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.gpEmailSettings.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.gpEmailSettings.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - // - // - // - this.gpEmailSettings.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; - // - // - // - this.gpEmailSettings.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.gpEmailSettings.TabIndex = 2; - this.gpEmailSettings.Text = "Email Settings"; - // - // rbOutlook - // - this.rbOutlook.AutoSize = true; - this.rbOutlook.BackColor = System.Drawing.Color.Transparent; - this.rbOutlook.Checked = true; - this.rbOutlook.Location = new System.Drawing.Point(4, 4); - this.rbOutlook.Name = "rbOutlook"; - this.rbOutlook.Size = new System.Drawing.Size(62, 17); - this.rbOutlook.TabIndex = 0; - this.rbOutlook.TabStop = true; - this.rbOutlook.Text = "Outlook"; - this.rbOutlook.UseVisualStyleBackColor = false; - this.rbOutlook.CheckedChanged += new System.EventHandler(this.emailSettingChanged); - // - // rbManual - // - this.rbManual.AutoSize = true; - this.rbManual.BackColor = System.Drawing.Color.Transparent; - this.rbManual.Location = new System.Drawing.Point(4, 27); - this.rbManual.Name = "rbManual"; - this.rbManual.Size = new System.Drawing.Size(101, 17); - this.rbManual.TabIndex = 1; - this.rbManual.Text = "Manual Settings"; - this.rbManual.UseVisualStyleBackColor = false; - // - // tbServer - // - this.tbServer.Enabled = false; - this.tbServer.Location = new System.Drawing.Point(201, 26); - this.tbServer.Name = "tbServer"; - this.tbServer.Size = new System.Drawing.Size(240, 20); - this.tbServer.TabIndex = 2; - // - // tbUsername - // - this.tbUsername.Enabled = false; - this.tbUsername.Location = new System.Drawing.Point(201, 53); - this.tbUsername.Name = "tbUsername"; - this.tbUsername.Size = new System.Drawing.Size(240, 20); - this.tbUsername.TabIndex = 3; - // - // tbPassword - // - this.tbPassword.Enabled = false; - this.tbPassword.Location = new System.Drawing.Point(201, 80); - this.tbPassword.Name = "tbPassword"; - this.tbPassword.PasswordChar = '*'; - this.tbPassword.Size = new System.Drawing.Size(240, 20); - this.tbPassword.TabIndex = 4; - // - // lblServer - // - this.lblServer.AutoSize = true; - this.lblServer.BackColor = System.Drawing.Color.Transparent; - this.lblServer.Enabled = false; - this.lblServer.Location = new System.Drawing.Point(111, 29); - this.lblServer.Name = "lblServer"; - this.lblServer.Size = new System.Drawing.Size(84, 13); - this.lblServer.TabIndex = 5; - this.lblServer.Text = "Outgoing Server"; - // - // lblUsername - // - this.lblUsername.AutoSize = true; - this.lblUsername.BackColor = System.Drawing.Color.Transparent; - this.lblUsername.Enabled = false; - this.lblUsername.Location = new System.Drawing.Point(138, 56); - this.lblUsername.Name = "lblUsername"; - this.lblUsername.Size = new System.Drawing.Size(55, 13); - this.lblUsername.TabIndex = 6; - this.lblUsername.Text = "Username"; - // - // lblPassword - // - this.lblPassword.AutoSize = true; - this.lblPassword.BackColor = System.Drawing.Color.Transparent; - this.lblPassword.Enabled = false; - this.lblPassword.Location = new System.Drawing.Point(142, 83); - this.lblPassword.Name = "lblPassword"; - this.lblPassword.Size = new System.Drawing.Size(53, 13); - this.lblPassword.TabIndex = 7; - this.lblPassword.Text = "Password"; - // - // panel1 - // - this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel1.Location = new System.Drawing.Point(0, 23); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(447, 1); - this.panel1.TabIndex = 3; - // - // tbContent - // - this.tbContent.Location = new System.Drawing.Point(12, 38); - this.tbContent.Multiline = true; - this.tbContent.Name = "tbContent"; - this.tbContent.Size = new System.Drawing.Size(450, 115); - this.tbContent.TabIndex = 3; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 13); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(165, 13); - this.label1.TabIndex = 4; - this.label1.Text = "Add additional comments below..."; - // - // frmSendErrorLog - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.btnCancel; - this.ClientSize = new System.Drawing.Size(474, 334); - this.Controls.Add(this.label1); - this.Controls.Add(this.tbContent); - this.Controls.Add(this.gpEmailSettings); - this.Controls.Add(this.btnCancel); - this.Controls.Add(this.btnSend); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "frmSendErrorLog"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Send Error Log to Volian Support"; - this.gpEmailSettings.ResumeLayout(false); - this.gpEmailSettings.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private DevComponents.DotNetBar.ButtonX btnSend; - private DevComponents.DotNetBar.ButtonX btnCancel; - private DevComponents.DotNetBar.Controls.GroupPanel gpEmailSettings; - private System.Windows.Forms.RadioButton rbManual; - private System.Windows.Forms.RadioButton rbOutlook; - private System.Windows.Forms.Label lblPassword; - private System.Windows.Forms.Label lblUsername; - private System.Windows.Forms.Label lblServer; - private System.Windows.Forms.TextBox tbPassword; - private System.Windows.Forms.TextBox tbUsername; - private System.Windows.Forms.TextBox tbServer; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.TextBox tbContent; - private System.Windows.Forms.Label label1; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/frmSendErrorLog.cs b/PROMS/Volian.Controls.Library/frmSendErrorLog.cs deleted file mode 100644 index ee687638..00000000 --- a/PROMS/Volian.Controls.Library/frmSendErrorLog.cs +++ /dev/null @@ -1,169 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using LBOutlookLibrary; -using System.Reflection; -using VEPROMS.CSLA.Library; -using System.Text.RegularExpressions; -using System.Net.Mail; -using System.Net; -using System.IO; - -namespace Volian.Controls.Library -{ - public partial class frmSendErrorLog : Form - { - private string _ErrorLogPath; - public bool OutlookEmail - { - get { return rbOutlook.Checked; } - set - { - if (value) - rbOutlook.Checked = true; - else - rbManual.Checked = true; - } - } - public string SMTPServer - { - get { return tbServer.Text; } - set { tbServer.Text = value; } - } - public string SMTPUser - { - get { return tbUsername.Text; } - set { tbUsername.Text = value; } - } - public frmSendErrorLog(bool outlookEmail, string smtpServer, string smtpUser, string errorlogpath) - { - InitializeComponent(); - tbPassword.PasswordChar = '\u25CF'; - OutlookEmail = outlookEmail; - SMTPServer = smtpServer; - SMTPUser = smtpUser; - _ErrorLogPath = errorlogpath; - } - - private void emailSettingChanged(object sender, EventArgs e) - { - tbServer.Enabled = tbUsername.Enabled = tbPassword.Enabled = - lblServer.Enabled = lblUsername.Enabled = lblPassword.Enabled = rbManual.Checked; - } - - private void btnSend_Click(object sender, EventArgs e) - { - if (OutlookEmail) - { - if (SendOutlookEmail()) - { - this.DialogResult = DialogResult.OK; - this.Close(); - } - } - else - { - if (SendSMTPEmail()) - { - this.DialogResult = DialogResult.OK; - this.Close(); - } - } - } - private bool SendSMTPEmail() - { - FileStream fs = null; - try - { - MailMessage mm = new MailMessage(); - mm.From = new MailAddress(SMTPUser); - mm.To.Add("support@volian.com"); - //mm.To.Add("rmark@epix.net"); - //mm.To.Add("jcbodine@gmail.com"); - 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); - mm.Attachments.Add(new Attachment(fs, "ErrorLog.txt")); - SmtpClient sc = new SmtpClient(SMTPServer); - sc.EnableSsl = true; - sc.Credentials = new NetworkCredential(SMTPUser, tbPassword.Text); - sc.Send(mm); - return true; - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - return false; - } - finally - { - fs.Close(); - } - } - public string Header - { - get - { - StringBuilder sb = new StringBuilder(); - //sb.Append("PROMS\t\tVersion: "); - sb.AppendLine("PROMS"); - sb.Append("Version: "); - sb.Append(AssemblyVersion); - DateTime buildDateTime = new System.IO.FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime; - sb.AppendLine(String.Format("\t\tBuild Date: {0}", buildDateTime.ToString())); - string connectionString = Database.VEPROMS_Connection; - Match mServer = Regex.Match(connectionString, ".*Data Source=([^;]*).*"); - string server = (mServer.Success) ? mServer.Groups[1].Value : "unknown"; - if (server.StartsWith(@".\")) server = @"Local \ " + server.Substring(2); - string databaseName = string.Format("{0}[SQL:{1:yyMM.ddHH}]", Database.ActiveDatabase, Database.RevDate); - 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)); - if (OutlookEmail) - sb.AppendLine("sent via outlook"); - else - sb.AppendLine("sent via manual settings"); - return sb.ToString(); - } - } - private bool SendOutlookEmail() - { - try - { - LBApplicationClass app = new LBApplicationClass(); - LBMailItemClass msg = app.CreateMailItem(); - msg.Recipients.Add("support@volian.com"); - //msg.Recipients.Add("rmark@epix.net"); - //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.Body = Header + "\r\n\r\n" + tbContent.Text; - msg.AddAttachment(_ErrorLogPath); - msg.Send(); - return true; - } - catch (Exception ex) - { - if (ex.Message.ToLower().Contains("failed due to the following error: 80080005")) - MessageBox.Show("You cannot send email via a running instance of Outlook from VE PROMS running from within Visual Studio."); - else - MessageBox.Show(string.Format("{0} - {1}", ex.GetType().Name, ex.Message)); - return false; - } - } - public string AssemblyVersion - { - get - { - return Application.ProductVersion; - //return Assembly.GetExecutingAssembly().GetName().Version.ToString(); - } - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/frmSendErrorLog.resx b/PROMS/Volian.Controls.Library/frmSendErrorLog.resx deleted file mode 100644 index 19dc0dd8..00000000 --- a/PROMS/Volian.Controls.Library/frmSendErrorLog.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/frmViewTextFile.Designer.cs b/PROMS/Volian.Controls.Library/frmViewTextFile.Designer.cs deleted file mode 100644 index e92561aa..00000000 --- a/PROMS/Volian.Controls.Library/frmViewTextFile.Designer.cs +++ /dev/null @@ -1,86 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class frmViewTextFile - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.rtbViewFile = new System.Windows.Forms.RichTextBox(); - this.buttonX1 = new DevComponents.DotNetBar.ButtonX(); - this.SuspendLayout(); - // - // rtbViewFile - // - this.rtbViewFile.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.rtbViewFile.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.rtbViewFile.Location = new System.Drawing.Point(0, 0); - this.rtbViewFile.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); - this.rtbViewFile.Name = "rtbViewFile"; - this.rtbViewFile.ReadOnly = true; - this.rtbViewFile.Size = new System.Drawing.Size(476, 552); - this.rtbViewFile.TabIndex = 0; - this.rtbViewFile.Text = ""; - // - // buttonX1 - // - this.buttonX1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.buttonX1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonX1.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.buttonX1.DialogResult = System.Windows.Forms.DialogResult.OK; - this.buttonX1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonX1.Location = new System.Drawing.Point(419, 560); - this.buttonX1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); - this.buttonX1.Name = "buttonX1"; - this.buttonX1.Size = new System.Drawing.Size(56, 19); - this.buttonX1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.buttonX1.TabIndex = 1; - this.buttonX1.Text = "OK"; - // - // frmViewTextFile - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(476, 580); - this.Controls.Add(this.rtbViewFile); - this.Controls.Add(this.buttonX1); - this.DoubleBuffered = true; - this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); - this.Name = "frmViewTextFile"; - this.ShowIcon = false; - this.Text = "frmViewTextFile"; - this.Load += new System.EventHandler(this.frmViewTextFile_Load); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.RichTextBox rtbViewFile; - private DevComponents.DotNetBar.ButtonX buttonX1; - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/frmViewTextFile.cs b/PROMS/Volian.Controls.Library/frmViewTextFile.cs deleted file mode 100644 index 6460a802..00000000 --- a/PROMS/Volian.Controls.Library/frmViewTextFile.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using System.IO; - -namespace Volian.Controls.Library -{ - public partial class frmViewTextFile : DevComponents.DotNetBar.Office2007Form //Form - { - string _FileName; - RichTextBoxStreamType _RTBType; - //public string FileName - //{ - // get { return _FileName; } - // set { _FileName = value; } - //} - public string ButtonText - { - get { return buttonX1.Text; } - set { buttonX1.Text = value; } - } - public frmViewTextFile(string filename, RichTextBoxStreamType rtbtype) - { - _FileName = filename; - _RTBType = rtbtype; - InitializeComponent(); - } - private void frmViewTextFile_Load(object sender, EventArgs e) - { - if (File.Exists(_FileName)) - rtbViewFile.LoadFile(_FileName,_RTBType); - else - MessageBox.Show(string.Format("File Not found: {0}", _FileName), "Error Displaying File", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/frmViewTextFile.resx b/PROMS/Volian.Controls.Library/frmViewTextFile.resx deleted file mode 100644 index 19dc0dd8..00000000 --- a/PROMS/Volian.Controls.Library/frmViewTextFile.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/packages.config b/PROMS/Volian.Controls.Library/packages.config deleted file mode 100644 index 423ea33e..00000000 --- a/PROMS/Volian.Controls.Library/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/vlnExpander.cs b/PROMS/Volian.Controls.Library/vlnExpander.cs deleted file mode 100644 index d5beef86..00000000 --- a/PROMS/Volian.Controls.Library/vlnExpander.cs +++ /dev/null @@ -1,230 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; - -namespace Volian.Controls.Library -{ - public enum ExpanderStyle : int - { - Square, Round - } - public delegate void vlnExpanderEvent(object sender, vlnExpanderEventArgs args); - public partial class vlnExpander : UserControl - { - #region Events - public event vlnExpanderEvent BeforeExpand; - private void OnBeforeExpand(object sender, vlnExpanderEventArgs args) - { - if (BeforeExpand != null) BeforeExpand(sender, args); - } - public event vlnExpanderEvent BeforeColapse; - private void OnBeforeColapse(object sender, vlnExpanderEventArgs args) - { - if (BeforeColapse != null) BeforeColapse(sender, args); - } - public event vlnExpanderEvent AttachmentClick; - private void OnAttachmentClick(object sender, vlnExpanderEventArgs args) - { - if (AttachmentClick != null) AttachmentClick(sender, args); - } - #endregion - public vlnExpander() - { - InitializeComponent(); - } - private bool _Expanded; - public bool Expanded - { - get { return _Expanded; } - set - { - if (value) OnBeforeExpand(this, new vlnExpanderEventArgs()); - else OnBeforeColapse(this, new vlnExpanderEventArgs()); - _Expanded = value; - this.Refresh(); - } - } - public void ShowExpanded() - { - _Expanded = true; - this.Refresh(); - } - private int _Trans1 = 128; - public int Trans1 - { - get { return _Trans1; } - set - { - _Trans1 = value; - this.Refresh(); - } - } - private int _Trans2 = 128; - public int Trans2 - { - get { return _Trans2; } - set - { - _Trans2 = value; this.Refresh(); - } - } - private Color _Color1 = Color.Aquamarine; - public Color Color1 - { - get { return _Color1; } - set - { - _Color1 = value; this.Refresh(); - } - } - private Color _Color2 = Color.Violet; - public Color Color2 - { - get { return _Color2; } - set - { - _Color2 = value; this.Refresh(); - } - } - private int _PenWidth = 0; - public int PenWidth - { - get { return _PenWidth; } - set { _PenWidth = value; this.Refresh(); } - } - private int _WidthFactor=7; - public int WidthFactor - { - get { return _WidthFactor; } - set { _WidthFactor = value; this.Refresh(); } - } - private Color _BorderColor=Color.Silver; - public Color BorderColor - { - get { return _BorderColor; } - set { _BorderColor = value; this.Refresh(); } - } - private int _GradientAngle=45; - public int GradientAngle - { - get { return _GradientAngle; } - set { _GradientAngle = value; this.Refresh(); } - } - private bool _Attachment = false; - public bool Attachment - { - get { return _Attachment; } - set { _Attachment = value; this.Refresh(); } - } - private bool _AutoTOC = false; - public bool AutoTOC - { - get { return _AutoTOC; } - set { _AutoTOC = value; this.Refresh(); } - } - private ExpanderStyle _MyExpanderStyle = ExpanderStyle.Square; - public ExpanderStyle MyExpanderStyle - { - get { return _MyExpanderStyle; } - set { _MyExpanderStyle = value; this.Refresh(); } - } - private void vlnExpander_Paint(object sender, PaintEventArgs e) - { - Color c1 = Color.FromArgb(_Trans1, _Color1); - Color c2 = Color.FromArgb(_Trans2, _Color2); - 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); - Brush b2 = p.Brush; - float smallest = this.Width; - if (this.Height < this.Width) smallest = this.Height; - float weight = (smallest - 1) / 12; - float radius = (smallest - 1) / 2; - float diameter = 2 * radius; - if (this.Height <= diameter) diameter = this.Height - 1; - e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; - p = new Pen(_BorderColor, _PenWidth); - int penWidth = ClientRectangle.Width / _WidthFactor; - switch (_MyExpanderStyle) - { - 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); - DrawInterior(e, b, b2, weight, radius, diameter); - e.Graphics.DrawEllipse(p, 0, 0, diameter, diameter); - p.Dispose(); - b.Dispose(); - b2.Dispose(); - break; - 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; - if (!Attachment) e.Graphics.FillRectangle(b, new Rectangle(0, 0, leg * 2 + penWidth * 3, leg * 2 + penWidth * 3)); - int center = leg + penWidth; - int limit = 2 * (penWidth + leg); - p = new Pen(_BorderColor, _PenWidth); - 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); - //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(); - b.Dispose(); - break; - } - } - - private void DrawInterior(PaintEventArgs e, Brush bBackground, Brush bForeground, float weight, float radius, float diameter) - { - if (Attachment) - { - if (!AutoTOC) - { - PointF[] myArrow = new PointF[7]; - myArrow[0] = new PointF(7 * weight, 3 * weight); - myArrow[1] = new PointF(11 * weight, 6 * weight); - myArrow[2] = new PointF(7 * weight, 9 * weight); - myArrow[3] = new PointF(7 * weight, 7 * weight); - myArrow[4] = new PointF(2 * weight, 7 * weight); - myArrow[5] = new PointF(2 * weight, 5 * weight); - myArrow[6] = new PointF(7 * weight, 5 * weight); - e.Graphics.FillPolygon(bBackground, myArrow); - } - } - else - { - e.Graphics.FillRectangle(bForeground, 2 * weight, radius - weight, diameter - 4 * weight, weight * 2); - if (!_Expanded) e.Graphics.FillRectangle(bForeground, radius - weight, 2 * weight, weight * 2, diameter - 4 * weight); - } - } - private void vlnExpander_Resize(object sender, EventArgs e) - { - this.Width = this.Height; - this.Refresh(); - } - private void vlnExpander_MouseDown(object sender, MouseEventArgs e) - { - if (Attachment) - OnAttachmentClick(sender, new vlnExpanderEventArgs()); - else - Expanded = !Expanded; - } - } - public partial class vlnExpanderEventArgs : EventArgs - { - public vlnExpanderEventArgs() - { ;} - } -} diff --git a/PROMS/Volian.Controls.Library/vlnExpander.designer.cs b/PROMS/Volian.Controls.Library/vlnExpander.designer.cs deleted file mode 100644 index d3e417b5..00000000 --- a/PROMS/Volian.Controls.Library/vlnExpander.designer.cs +++ /dev/null @@ -1,78 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class vlnExpander - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.expandToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.expandAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.contextMenuStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.expandToolStripMenuItem, - this.expandAllToolStripMenuItem}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(136, 48); - // - // expandToolStripMenuItem - // - this.expandToolStripMenuItem.Name = "expandToolStripMenuItem"; - this.expandToolStripMenuItem.Size = new System.Drawing.Size(135, 22); - this.expandToolStripMenuItem.Text = "Expand"; - // - // expandAllToolStripMenuItem - // - this.expandAllToolStripMenuItem.Name = "expandAllToolStripMenuItem"; - this.expandAllToolStripMenuItem.Size = new System.Drawing.Size(135, 22); - this.expandAllToolStripMenuItem.Text = "Expand All"; - // - // vlnExpander - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Name = "vlnExpander"; - this.Size = new System.Drawing.Size(85, 77); - this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.vlnExpander_MouseDown); - this.Resize += new System.EventHandler(this.vlnExpander_Resize); - this.Paint += new System.Windows.Forms.PaintEventHandler(this.vlnExpander_Paint); - this.contextMenuStrip1.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem expandToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem expandAllToolStripMenuItem; - } -} diff --git a/PROMS/Volian.Controls.Library/vlnExpander.resx b/PROMS/Volian.Controls.Library/vlnExpander.resx deleted file mode 100644 index 6fab8861..00000000 --- a/PROMS/Volian.Controls.Library/vlnExpander.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/vlnTreeCombo.cs b/PROMS/Volian.Controls.Library/vlnTreeCombo.cs deleted file mode 100644 index 11e2abc9..00000000 --- a/PROMS/Volian.Controls.Library/vlnTreeCombo.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; - -using AT.STO.UI.Win; - -namespace Volian.Controls.Library -{ - internal class vlnTreeCombo : DropDownPanel - { - #region Constructor / Destructor - public vlnTreeCombo(): base() - { - // The base class's property must be set because - // this derived implementation hides the setter. - base.DropDownControl = new DropDownTree(); - this.DropDownControl.BorderStyle = BorderStyle.None; - } - #endregion - #region Public Properties - /// - /// Returns the tree control, that is displayed in the dropdown. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public new DropDownTree DropDownControl // new is on purpose to change the property's data type and to hide the setter. - { - get - { - if (base.DropDownControl != null) - { - return base.DropDownControl as DropDownTree; - } - - return null; - } - } - - public new DropDownNode Value - { - get - { - if (this.DropDownControl != null) - { - return this.DropDownControl.Value as DropDownNode; - } - - return null; - } - set { base.Value = value; } - } - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.Designer.cs b/PROMS/Volian.Controls.Library/vlnTreeView.Designer.cs deleted file mode 100644 index 98e486b8..00000000 --- a/PROMS/Volian.Controls.Library/vlnTreeView.Designer.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class vlnTreeView - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs deleted file mode 100644 index 97f03838..00000000 --- a/PROMS/Volian.Controls.Library/vlnTreeView.cs +++ /dev/null @@ -1,4756 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Text.RegularExpressions; -using System.Windows.Forms; -using System.Runtime.InteropServices; // For DragHelper -using System.Reflection; -using Csla; -using Csla.Validation; -using VEPROMS.CSLA.Library; -using System.IO; -using Volian.Base.Library; -using DevComponents.DotNetBar; -using JR.Utils.GUI.Forms; //C2018-026 show notes entered during approval or workflow stage - -namespace Volian.Controls.Library -{ - #region DelegatesAndEventArgs - public delegate void vlnTreeViewEvent(object sender, vlnTreeEventArgs args); - public delegate void vlnTreeViewTimeEvent(object sender, vlnTreeTimeEventArgs args); - public delegate void vlnTreeViewStatusEvent(object sender, vlnTreeStatusEventArgs args); - public delegate ItemInfo vlnTreeViewClipboardStatusEvent(object sender, vlnTreeEventArgs args); - public delegate void vlnTreeViewItemInfoEvent(object sender, vlnTreeItemInfoEventArgs args); - public delegate bool vlnTreeViewBoolEvent(object sender, vlnTreeEventArgs args); - public delegate bool vlnTreeViewItemInfoDeleteEvent(object sender, vlnTreeItemInfoEventArgs args); - - public delegate bool vlnTreeViewItemInfoInsertEvent(object sender, vlnTreeItemInfoInsertEventArgs args); - public delegate bool vlnTreeViewItemInfoDeleteFolderEvent(object sender, vlnTreeFolderDeleteEventArgs args); - public delegate bool vlnTreeViewItemInfoPasteEvent(object sender, vlnTreeItemInfoPasteEventArgs args); - public delegate TreeNode vlnTreeViewTreeNodeEvent(object sender, vlnTreeEventArgs args); - public delegate DialogResult vlnTreeViewPropertyEvent(object sender, vlnTreePropertyEventArgs args); - public delegate DialogResult vlnTreeViewPSIEvent(object sender, vlnTreeEventArgs args); - public delegate DialogResult vlnTreeViewSIEvent(object sender, vlnTreeEventArgs args); - public delegate void vlnTreeViewSectionInfoEvent(object sender, vlnTreeSectionInfoEventArgs args); - public delegate void WordSectionDeletedEvent(object sender, WordSectionEventArgs args); - public delegate void vlnTreeViewPdfEvent(object sender, vlnTreeViewPdfArgs args); - public delegate string vlnTreeViewGetChangeIdEvent(object sender, vlnTreeItemInfoEventArgs args); - public delegate ItemInfo vlnTreeViewSearchIncTransEvent(object sender, vlnTreeItemInfoEventArgs args); - public partial class vlnTreeSectionInfoEventArgs - { - private bool _IsDeleting = false; - public bool IsDeleting - { - get { return _IsDeleting; } - set { _IsDeleting = value; } - } - private SectionInfo _MySectionInfo; - public SectionInfo MySectionInfo - { - get { return _MySectionInfo; } - set { _MySectionInfo = value; } - } - public vlnTreeSectionInfoEventArgs(SectionInfo mySectionInfo) - { - _MySectionInfo = mySectionInfo; - } - public vlnTreeSectionInfoEventArgs(SectionInfo mySectionInfo, bool isDeleting) - { - _MySectionInfo = mySectionInfo; - _IsDeleting = isDeleting; - } - } - public partial class vlnTreeViewPdfArgs - { - private string _MyFilename; - public string MyFilename - { - get { return _MyFilename; } - set { _MyFilename = value; } - } - private byte[] _MyBuffer; - public byte[] MyBuffer - { - get { return _MyBuffer; } - set { _MyBuffer = value; } - } - private string _MyWatermark; - public string MyWatermark - { - get { return _MyWatermark; } - set { _MyWatermark = value; } - } - public vlnTreeViewPdfArgs(string filename, byte[] buffer, string watermark) - { - _MyFilename = filename; - _MyBuffer = buffer; - _MyWatermark = watermark; - } - } - public partial class vlnTreeTimeEventArgs - { - private TimeSpan _myTimeSpan; - public TimeSpan MyTimeSpan - { - get { return _myTimeSpan; } - set { _myTimeSpan = value; } - } - private string _MyMessage; - public string MyMessage - { - get { return _MyMessage; } - set { _MyMessage = value; } - } - public vlnTreeTimeEventArgs(DateTime dtStart, string message) - { - MyTimeSpan = TimeSpan.FromTicks(DateTime.Now.Ticks - dtStart.Ticks); - MyMessage = message; - } - } - public partial class vlnTreeStatusEventArgs - { - private bool _MyStatus; - public bool MyStatus - { - get { return _MyStatus; } - set { _MyStatus = value; } - } - private string _MyMessage; - public string MyMessage - { - get { return _MyMessage; } - set { _MyMessage = value; } - } - - public vlnTreeStatusEventArgs(bool status, string message) - { - MyStatus = status; - MyMessage = message; - } - } - public partial class vlnTreeEventArgs - { - #region Business Methods - private TreeNode _Node; - public TreeNode Node - { - get { return _Node; } - set { _Node = value; } - } - private TreeNode _Destination = null; - public TreeNode Destination - { - get { return _Destination; } - set { _Destination = value; } - } - private int _Index; - public int Index - { - get { return _Index; } - set { _Index = value; } - } - - //C2025-024 Electronic Procedures - Phase 2 (PROMS XML output) - //AnnotationType that would be doing an export for - private int _AnnotationTypeId = -1; - public int AnnotationTypeId - { - get { return _AnnotationTypeId; } - set { _AnnotationTypeId = value; } - } - //jcb multiunit - private string _Unit; - public string Unit - { - get { return _Unit; } - set { _Unit = value; } - } - private int _UnitIndex = -1; - public int UnitIndex - { - get { return _UnitIndex; } - set { _UnitIndex = value; } - } - //end jcb multiunit - #endregion - #region Factory Methods - private vlnTreeEventArgs() {; } - public vlnTreeEventArgs(TreeNode node) - { - _Node = node; - } - public vlnTreeEventArgs(TreeNode node, TreeNode destination, int index) - { - _Node = node; - _Destination = destination; - _Index = index; - } - public vlnTreeEventArgs(TreeNode node, TreeNode destination, int index, int annTypeId) - { - _Node = node; - _Destination = destination; - _Index = index; - _AnnotationTypeId = annTypeId; - } - //jcb multiunit - public vlnTreeEventArgs(TreeNode node, TreeNode destination, int index, string unit, int unitIndex) - { - _Node = node; - _Destination = destination; - _Index = index; - _Unit = unit; - _UnitIndex = unitIndex; - } - public vlnTreeEventArgs(TreeNode node, TreeNode destination, int index, string unit, int unitIndex, int annTypeId) - { - _Node = node; - _Destination = destination; - _Index = index; - _Unit = unit; - _UnitIndex = unitIndex; - _AnnotationTypeId = annTypeId; - } - //end jcb multiunit - #endregion - public override string ToString() - { - return string.Format("Node={0},Destination={1},Index={2},Unit={3},UnitIndex={4}", NodePath(this.Node), this.Destination, this.Index, this.Unit, this.UnitIndex); - } - - private string NodePath(TreeNode node) - { - string retval = ""; - if (node.Parent != null) - retval = NodePath(node.Parent) + ":"; - retval += node.Text; - return retval; - } - } - public partial class vlnTreeItemInfoEventArgs - { - #region Business Methods - private ItemInfo _MyItemInfo; - public ItemInfo MyItemInfo - { - get { return _MyItemInfo; } - set { _MyItemInfo = value; } - } - #endregion - #region Factory Methods - private vlnTreeItemInfoEventArgs() {; } - public vlnTreeItemInfoEventArgs(ItemInfo myItemInfo) - { - _MyItemInfo = myItemInfo; - } - #endregion - } - public class vlnTreeFolderDeleteEventArgs : EventArgs - { - public int FolderId { get; } - - public vlnTreeFolderDeleteEventArgs(int folderId) - { - FolderId = folderId; - } - } - public enum E_InsertType { Before, After, Child }; - public partial class vlnTreeItemInfoInsertEventArgs - { - #region Business Methods - private ItemInfo _MyItemInfo; - public ItemInfo MyItemInfo - { - get { return _MyItemInfo; } - set { _MyItemInfo = value; } - } - private E_InsertType _InsertType; - public E_InsertType InsertType - { - get { return _InsertType; } - set { _InsertType = value; } - } - private int _Type; - public int Type - { - get { return _Type; } - set { _Type = value; } - } - private E_FromType _FromType; - public E_FromType FromType - { - get { return _FromType; } - set { _FromType = value; } - } - private string _StepText; - public string StepText - { - get { return _StepText; } - set { _StepText = value; } - } - #endregion - #region Factory Methods - private vlnTreeItemInfoInsertEventArgs() {; } - public vlnTreeItemInfoInsertEventArgs(ItemInfo myItemInfo, E_InsertType insertType, string stepText) - { - _MyItemInfo = myItemInfo; - _InsertType = insertType; - _StepText = stepText; - } - public vlnTreeItemInfoInsertEventArgs(ItemInfo myItemInfo, E_InsertType insertType, string stepText, int type, E_FromType fromType) - { - _MyItemInfo = myItemInfo; - _InsertType = insertType; - _StepText = stepText; - _Type = type; - _FromType = fromType; - } - #endregion - } - #region PasteEventArgs - public partial class vlnTreeItemInfoPasteEventArgs - { - #region Business Methods - private ItemInfo _MyItemInfo; - public ItemInfo MyItemInfo - { - get { return _MyItemInfo; } - set { _MyItemInfo = value; } - } - private int _CopyStartID; - public int CopyStartID - { - get { return _CopyStartID; } - set { _CopyStartID = value; } - } - private ItemInfo.EAddpingPart _PasteType; - public ItemInfo.EAddpingPart PasteType - { - get { return _PasteType; } - set { _PasteType = value; } - } - private int? _Type; - public int? Type - { - get { return _Type; } - set { _Type = value; } - } - #endregion - #region Factory Methods - private vlnTreeItemInfoPasteEventArgs() {; } - public vlnTreeItemInfoPasteEventArgs(ItemInfo myItemInfo, int copyStartId, ItemInfo.EAddpingPart pasteType, int? type) - { - _MyItemInfo = myItemInfo; - _CopyStartID = copyStartId; - _PasteType = pasteType; - _Type = type; - } - - #endregion - } - #endregion - public partial class vlnTreePropertyEventArgs : EventArgs - { - private string _Title; - public string Title - { - get { return _Title; } - set { _Title = value; } - } - private object _ConfigObject; - public object ConfigObject - { - get { return _ConfigObject; } - set { _ConfigObject = value; } - } - private FolderConfig _FolderConfig; - public FolderConfig FolderConfig - { - get { return _FolderConfig; } - set { _ConfigObject = _FolderConfig = value; } - } - private DocVersionConfig _DocVersionConfig; - public DocVersionConfig DocVersionConfig - { - get { return _DocVersionConfig; } - set { _ConfigObject = _DocVersionConfig = value; } - } - private ProcedureConfig _ProcedureConfig; - public ProcedureConfig ProcedureConfig - { - get { return _ProcedureConfig; } - set { _ConfigObject = _ProcedureConfig = value; } - } - private SectionConfig _SectionConfig; - public SectionConfig SectionConfig - { - get { return _SectionConfig; } - set { _ConfigObject = _SectionConfig = value; } - } - private vlnTreePropertyEventArgs() {; } - public vlnTreePropertyEventArgs(string title, FolderConfig folderConfig) - { - _Title = title; - FolderConfig = folderConfig; - } - public vlnTreePropertyEventArgs(string title, DocVersionConfig docVersionConfig) - { - _Title = title; - DocVersionConfig = docVersionConfig; - } - public vlnTreePropertyEventArgs(string title, ProcedureConfig procedureConfig) - { - _Title = title; - ProcedureConfig = procedureConfig; - } - public vlnTreePropertyEventArgs(string title, SectionConfig sectionConfig) - { - _Title = title; - DocStyleListConverter.MySection = sectionConfig.MySection; - SectionConfig = sectionConfig; - } - } - #endregion - public partial class vlnTreeView : TreeView - { - private ProcedureInfo _currentPri = null; // used to get child name to append to approved export filename -AddApprovedRevisionsMultiUnit() & ImportProcedure_Click() - private SessionInfo _MySessionInfo; - public SessionInfo MySessionInfo - { - get { return _MySessionInfo; } - set { _MySessionInfo = value; } - } - private UserInfo _MyUserInfo; - public UserInfo MyUserInfo - { - get { return _MyUserInfo; } - set { _MyUserInfo = value; } - } - private string _DelProcReason; // C2020-038: request reason for delete procedure so this can be saved in database - public string DelProcReason - { - get { return _DelProcReason; } - set { _DelProcReason = value; } - } - #region Local Vars - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - FolderInfo _LastFolderInfo = null; - ProcedureInfo _LastProcedureInfo = null; - DocVersionInfo _LastDocVersionInfo = null; - SectionInfo _LastSectionInfo = null; - VETreeNode _LastTreeNode = null; - StepInfo _LastStepInfo = null; - ItemInfo _LastItemInfo = null; - #endregion - #region Events - public event vlnTreeViewGetChangeIdEvent GetChangeId; - private string OnGetChangeId(object sender, vlnTreeItemInfoEventArgs args) - { - if (GetChangeId != null) return GetChangeId(sender, args); - return null; - } - public event vlnTreeViewPdfEvent ViewPDF; - private void OnViewPDF(object sender, vlnTreeViewPdfArgs args) - { - if (ViewPDF != null) ViewPDF(sender, args); - } - public event vlnTreeViewItemInfoDeleteEvent DeleteItemInfo; - private bool OnDeleteItemInfo(object sender, vlnTreeItemInfoEventArgs args) - { - if (DeleteItemInfo != null) return DeleteItemInfo(sender, args); - return false; - } - public event vlnTreeViewItemInfoDeleteFolderEvent DeleteFolder; - private bool OnDeleteFolder(object sender, vlnTreeFolderDeleteEventArgs args) - { - if (DeleteItemInfo != null) return DeleteFolder(sender, args); - return false; - } - public event vlnTreeViewItemInfoInsertEvent InsertItemInfo; - private bool OnInsertItemInfo(object sender, vlnTreeItemInfoInsertEventArgs args) - { - if (InsertItemInfo != null) return InsertItemInfo(sender, args); - return false; - } - public event vlnTreeViewItemInfoPasteEvent PasteItemInfo; - private bool OnPasteItemInfo(object sender, vlnTreeItemInfoPasteEventArgs args) - { - if (PasteItemInfo != null) return PasteItemInfo(sender, args); - return false; - } - public event vlnTreeViewEvent NodeMove; - private void OnNodeMove(object sender, vlnTreeEventArgs args) - { - if (NodeMove != null) NodeMove(sender, args); - } - public event vlnTreeViewClipboardStatusEvent ClipboardStatus; - private ItemInfo OnClipboardStatus(object sender, vlnTreeEventArgs args) - { - ItemInfo rv = null; - if (ClipboardStatus != null) rv = ClipboardStatus(sender, args); - return rv; - } - public event vlnTreeViewEvent NodeCopy; - private void OnNodeCopy(object sender, vlnTreeEventArgs args) - { - if (NodeCopy != null) NodeCopy(sender, args); - } - public event vlnTreeViewPropertyEvent NodeOpenProperty; - private DialogResult OnNodeOpenProperty(object sender, vlnTreePropertyEventArgs args) - { - if (NodeOpenProperty != null) return NodeOpenProperty(sender, args); - return DialogResult.Cancel; - } - public event vlnTreeViewPSIEvent NodePSI; - private DialogResult OnNodePSI(object sender, vlnTreeEventArgs args) - { - if (NodePSI != null) return NodePSI(sender, args); - return DialogResult.Cancel; - } - // C2020-033: Support the menu item to bring up Search/Incoming Transitions panel - public event vlnTreeViewSearchIncTransEvent SearchIncTrans; - private ItemInfo OnSearchIncTransIn(object sender, vlnTreeItemInfoEventArgs args) - { - if (SearchIncTrans != null) return SearchIncTrans(sender, args); - return args.MyItemInfo; - } - public event vlnTreeViewSIEvent NodeSI; - private DialogResult OnNodeSI(object sender, vlnTreeEventArgs args) - { - if (NodeSI != null) return NodeSI(sender, args); - return DialogResult.Cancel; - } - public event vlnTreeViewEvent NodeSelect; - private void OnNodeSelect(object sender, vlnTreeEventArgs args) - { - if (NodeSelect != null) NodeSelect(sender, args); - } - public event vlnTreeViewEvent CreateContinuousActionSummary; - private void OnCreateContinuousActionSummary(object sender, vlnTreeEventArgs args) - { - if (CreateContinuousActionSummary != null) CreateContinuousActionSummary(sender, args); - } - public event vlnTreeViewEvent CreateTimeCriticalActionSummary; - private void OnCreateTimeCriticalActionSummary(object sender, vlnTreeEventArgs args) - { - if (CreateTimeCriticalActionSummary != null) CreateTimeCriticalActionSummary(sender, args); - } - public event vlnTreeViewEvent PrintProcedure; - private void OnPrintProcedure(object sender, vlnTreeEventArgs args) - { - if (PrintProcedure != null) PrintProcedure(sender, args); - } - public event vlnTreeViewEvent QPrintProcedure; - private void OnQPrintProcedure(object sender, vlnTreeEventArgs args) - { - if (QPrintProcedure != null) QPrintProcedure(sender, args); - } - public event vlnTreeViewEvent PrintSection; - private void OnPrintSection(object sender, vlnTreeEventArgs args) - { - if (PrintSection != null) PrintSection(sender, args); - } - public event vlnTreeViewEvent QPrintSection; - private void OnQPrintSection(object sender, vlnTreeEventArgs args) - { - if (QPrintSection != null) QPrintSection(sender, args); - } - public event vlnTreeViewEvent PrintAllProcedures; - private void OnPrintAllProcedures(object sender, vlnTreeEventArgs args) - { - if (PrintAllProcedures != null) PrintAllProcedures(sender, args); - } - public event vlnTreeViewEvent PrintAllApprovedProcedures; //C2025-017 print all approved procedures - private void OnPrintAllApprovedProcedures(object sender, vlnTreeEventArgs args) - { - if (PrintAllApprovedProcedures != null) PrintAllApprovedProcedures(sender, args); - } - public event vlnTreeViewEvent SelectDateToStartChangeBars; - private void OnSelectDateToStartChangeBars(object sender, vlnTreeEventArgs args) - { - if (SelectDateToStartChangeBars != null) SelectDateToStartChangeBars(sender, args); - } - public event vlnTreeViewEvent ApproveProcedure; - private void OnApproveProcedure(object sender, vlnTreeEventArgs args) - { - if (ApproveProcedure != null) ApproveProcedure(sender, args); - } - public event vlnTreeViewEvent ApproveAllProcedures; - private void OnApproveAllProcedures(object sender, vlnTreeEventArgs args) - { - if (ApproveAllProcedures != null) ApproveAllProcedures(sender, args); - } - public event vlnTreeViewEvent ApproveSomeProcedures; - private void OnApproveSomeProcedures(object sender, vlnTreeEventArgs args) - { - if (ApproveSomeProcedures != null) ApproveSomeProcedures(sender, args); - } - public event vlnTreeViewEvent ReportAllProceduresInconsistencies; - private void OnReportAllProceduresInconsistencies(object sender, vlnTreeEventArgs args) - { - if (ReportAllProceduresInconsistencies != null) ReportAllProceduresInconsistencies(sender, args); - } - public event vlnTreeViewEvent RefreshCheckedOutProcedures; - private void OnRefreshCheckedOutProcedures(object sender, vlnTreeEventArgs args) - { - if (RefreshCheckedOutProcedures != null) RefreshCheckedOutProcedures(sender, args); - } - public event vlnTreeViewEvent ProcedureCheckedOutTo; - private void OnProcedureCheckedOutTo(object sender, vlnTreeEventArgs args) - { - if (ProcedureCheckedOutTo != null) ProcedureCheckedOutTo(sender, args); - } - public event vlnTreeViewEvent ExportImportProcedureSets; - private void OnExportImportProcedureSets(object sender, vlnTreeEventArgs args) - { - if (ExportImportProcedureSets != null) ExportImportProcedureSets(sender, args); - } - public event vlnTreeViewEvent PrintTransitionReport; - private void OnPrintTransitionReport(object sender, vlnTreeEventArgs args) - { - if (PrintTransitionReport != null) PrintTransitionReport(sender, args); - } - public event vlnTreeViewEvent NodeNew; - private void OnNodeNew(object sender, vlnTreeEventArgs args) - { - if (NodeNew != null) NodeNew(sender, args); - } - /// - /// Raised after a new step is added. - /// - public event vlnTreeViewEvent NodeInsert; - private void OnNodeInsert(object sender, vlnTreeEventArgs args) - { - if (NodeInsert != null) NodeInsert(sender, args); - } - public event vlnTreeViewEvent NodeSelectionChange; - private void OnNodeSelectionChange(object sender, vlnTreeEventArgs args) - { - if (NodeSelectionChange != null) NodeSelectionChange(sender, args); - } - public event vlnTreeViewSectionInfoEvent SectionShouldClose; - private void OnSectionShouldClose(object sender, vlnTreeSectionInfoEventArgs args) - { - if (SectionShouldClose != null) SectionShouldClose(sender, args); - } - public event vlnTreeViewSectionInfoEvent PauseRefresh; - private void OnPauseRefresh(object sender, vlnTreeSectionInfoEventArgs args) - { - if (PauseRefresh != null) PauseRefresh(sender, args); - } - public event vlnTreeViewSectionInfoEvent UnPauseRefresh; - private void OnUnPauseRefresh(object sender, vlnTreeSectionInfoEventArgs args) - { - if (UnPauseRefresh != null) UnPauseRefresh(sender, args); - } - public event WordSectionDeletedEvent WordSectionDeleted; - internal void OnWordSectionDeleted(object sender, WordSectionEventArgs args) - { - WordSectionDeleted(sender, args); - } - public event vlnTreeViewItemInfoEvent OpenItem; - private void OnOpenItem(object sender, vlnTreeItemInfoEventArgs args) - { - if (OpenItem != null) OpenItem(sender, args); - } - // This event was added to update the Step Properties/RO & Tools/Search RO & Reports - // when an update of ro.fst is done & the ro trees on those panels needs refreshed. - // (bug fix B2015-226) - public event StepPanelTabDisplayEvent TabDisplay; - private void OnTabDisplay(object sender, StepPanelTabDisplayEventArgs args) - { - if (TabDisplay != null) TabDisplay(sender, args); - } - #endregion - #region Constructors - public vlnTreeView() - { - InitializeComponent(); - this.AllowDrop = true; - DragHelper.InitCommonControls(); - this.ItemDrag += new ItemDragEventHandler(tv_ItemDrag); - this.DragDrop += new DragEventHandler(tv_DragDrop); - this.DragEnter += new DragEventHandler(tv_DragEnter); - this.DragLeave += new EventHandler(tv_DragLeave); - this.DragOver += new DragEventHandler(tv_DragOver); - this.MouseDown += new MouseEventHandler(tv_MouseDown); - this.KeyPress += new KeyPressEventHandler(tv_KeyPress); - base.AfterSelect += new TreeViewEventHandler(tv_AfterSelect); - } - #endregion - #region MenuSupport - private void tv_AfterSelect(object sender, TreeViewEventArgs e) - { - if (!_AdjustingTree) - OnNodeSelectionChange(sender, new vlnTreeEventArgs(e.Node)); - } - // use to determine which menu items have been selected for those tree nodes - - // that allow more than one type of operation associated with their selection. - public enum MenuSelections : int - { - Folder = 1, FolderBefore = 2, FolderAfter = 3, DocVersion = 4, Procedure = 5, ProcedureBefore = 6, ProcedureAfter = 7, Section = 8, SectionBefore = 9, SectionAfter = 10, Step = 11, StepBefore = 12, StepAfter = 13, StepReplace = 14 - } - void tv_MouseDown(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - OwnerInfoList oil = null; - OwnerInfo oi = null; - FolderInfo fi = null; - // B2016-058 so we can customize the "collapse" menu item text - bool isProcNode = false; - bool isSectNode = false; - bool isFolderNode = false; - bool isWrkDftNode = false; - VETreeNode tn = this.GetNodeAt(new Point(e.X, e.Y)) as VETreeNode; - if (tn != null) - { - this.SelectedNode = tn as TreeNode; - Application.DoEvents(); - // Display Menu - ToolStripMenuItem mi = new ToolStripMenuItem(); - ContextMenu cm = new ContextMenu(); - //_MyLog.WarnFormat("Context Menu 1 - {0}",GC.GetTotalMemory(true)); - UserInfo ui = UserInfo.GetByUserID(VlnSettings.UserID); - //_MyLog.WarnFormat("Context Menu 1a - {0}", GC.GetTotalMemory(true)); - - if (ui == null) - { - 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", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return; - } - this.Cursor = Cursors.WaitCursor; - #region Menu_New - if (tn.VEObject as FolderInfo != null) - { - isFolderNode = true; - // For Folders, if no children, can add either docversion or folder. If children are - // folders then can only add another folder, and if children are docversions can only - // add docversion. - fi = tn.VEObject as FolderInfo; - bool DoSpecificInfo = fi.ActiveFormat.PlantFormat.FormatData.SpecificInfo; - if (ui.IsAdministrator() || ui.IsSetAdministrator(fi))// && fi.MyParent == null) //VEPROMS level - { - if (fi.HasWorkingDraft) - { - cm.MenuItems.Add("Export Procedure Set", new EventHandler(mi_Click)); - //AddEPExport(cm.MenuItems, 0, null); - } - else - cm.MenuItems.Add("Import Procedure Set", new EventHandler(mi_Click)); - if (DoSpecificInfo) - cm.MenuItems.Add("Folder Specific Information", new EventHandler(mi_Click)); // C2020-008: change to 'Folder' - } - //_MyLog.WarnFormat("Context Menu 1b - {0}", GC.GetTotalMemory(true)); - if (ui.IsAdministrator() || ui.IsSetAdministrator(fi)) - { - if (fi.MyParent != null) // don't allow insert before/after if at top node - { - if (!ui.IsAdministrator() && DoSpecificInfo) cm.MenuItems.Add("Procedure Set Specific Information", new EventHandler(mi_Click)); - // B2020-111 only allow Set Administrator to add new folders inside folders they admininstrate - if (ui.IsAdministrator() || ui.IsSetAdministrator(fi.MyParent)) - { - cm.MenuItems.Add("Insert Folder Before", new EventHandler(mi_Click)); - cm.MenuItems.Add("Insert Folder After", new EventHandler(mi_Click)); - } - } - // B2020-111 only allow Set Administrator to add new folders inside folders they admininstrate - if ((ui.IsAdministrator() || ui.IsSetAdministrator(fi.MyParent)) && fi.FolderDocVersionCount == 0) - cm.MenuItems.Add("New Folder", new EventHandler(mi_Click)); - if (fi.ChildFolderCount == 0 && !fi.HasWorkingDraft) - cm.MenuItems.Add("Create Working Draft", new EventHandler(mi_Click)); - } - if (fi.HasWorkingDraft) - cm.MenuItems.Add("Print Transition Report", new EventHandler(mi_Click)); - } - else if (tn.VEObject as DocVersionInfo != null) // DocVersions can only contain procs - { - isWrkDftNode = true; - //_MyLog.WarnFormat("Context Menu 1c - {0}", GC.GetTotalMemory(true)); - DocVersionInfo dvi = tn.VEObject as DocVersionInfo; - if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi)) - { - cm.MenuItems.Add("Import Procedure", mi_Click); - } - if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi) || ui.IsWriter(dvi)) - { - OwnerInfoList.Reset(); - oil = OwnerInfoList.GetByVersionID(dvi.VersionID); - if (dvi.ActiveFormat.PlantFormat.FormatData.SpecificInfo) - cm.MenuItems.Add("Procedure Set Specific Information", new EventHandler(mi_Click)); - cm.MenuItems.Add("Refresh Checked Out Procedures", new EventHandler(mi_Click)); - cm.MenuItems.Add("New Procedure", new EventHandler(mi_Click)); - if (dvi.MultiUnitCount > 1) - { - MenuItem mip = new MenuItem("Print All Procedures for"); - MenuItem mia = new MenuItem("Approve All Procedures for"); - MenuItem mis = new MenuItem("Approve Some Procedures for"); - MenuItem mir = new MenuItem("Print All Approved Procedures for"); // C2025-017 print all approved procedures - int k = 0; - foreach (string s in dvi.UnitNames) - { - k++; - MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mp.Tag = k; - MenuItem ma = mia.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - ma.Tag = k; - MenuItem ms = mis.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - ms.Tag = k; - MenuItem mr = mir.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); // C2025-017 print all approved procedures - mr.Tag = k; - } - //MenuItem mmp = mip.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click)); - //mmp.Tag = 0; - //MenuItem mma = mia.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click)); - //mma.Tag = 0; - //MenuItem mms = mis.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click)); - //mms.Tag = 0; - cm.MenuItems.Add(mip); - cm.MenuItems.Add(mia); - cm.MenuItems.Add(mis); - cm.MenuItems.Add(mir); // C2025-017 print all approved procedures - } - else - { - //_MyLog.WarnFormat("Context Menu 1d - {0}", GC.GetTotalMemory(true)); - cm.MenuItems.Add("Print All Procedures", new EventHandler(mi_Click)); - cm.MenuItems.Add("Approve All Procedures", new EventHandler(mi_Click)); - cm.MenuItems.Add("Approve Some Procedures", new EventHandler(mi_Click)); - cm.MenuItems.Add("Print All Approved Procedures", new EventHandler(mi_Click)); - } - cm.MenuItems.Add("Report All Procedures Inconsistencies", new EventHandler(mi_Click)); - } - else - { - //_MyLog.WarnFormat("Context Menu 1e - {0}", GC.GetTotalMemory(true)); - OwnerInfoList.Reset(); - oil = OwnerInfoList.GetByVersionID(dvi.VersionID); - cm.MenuItems.Add("Refresh Checked Out Procedures", new EventHandler(mi_Click)); - if (dvi.MultiUnitCount > 1) - { - MenuItem mip = new MenuItem("Print All Procedures for"); - int k = 0; - foreach (string s in dvi.UnitNames) - { - k++; - MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mp.Tag = k; - } - //MenuItem mmp = mip.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click)); - //mmp.Tag = 0; - //MenuItem mma = mia.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click)); - //mma.Tag = 0; - //MenuItem mms = mis.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click)); - //mms.Tag = 0; - cm.MenuItems.Add(mip); - } - else - { - //_MyLog.WarnFormat("Context Menu 1f - {0}", GC.GetTotalMemory(true)); - cm.MenuItems.Add("Print All Procedures", new EventHandler(mi_Click)); - } - } - //if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi)) - //{ - // cm.MenuItems.Add("Check Out Procedure Set", new EventHandler(mi_Click)); - // cm.MenuItems.Add("Check In Procedure Set", new EventHandler(mi_Click)); - //} - if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi) || ui.IsROEditor(dvi)) - { - //_MyLog.WarnFormat("Context Menu 1g - {0}", GC.GetTotalMemory(true)); - cm.MenuItems.Add("Run RO Editor", new EventHandler(mi_Click)); - } - if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi)) - { - //_MyLog.WarnFormat("Context Menu 1h - {0}", GC.GetTotalMemory(true)); - MenuItem urv = cm.MenuItems.Add("Update RO Values", new EventHandler(mi_Click)); - // only allow update if association, and the RO update was not done and/or not completed - urv.Enabled = !dvi.ROfstLastCompleted || dvi.NewerRoFst; - } - } - else if (tn.VEObject as ProcedureInfo != null) // Procs can only contain sections - { - isProcNode = true; - ProcedureInfo pri = tn.VEObject as ProcedureInfo; - oi = OwnerInfo.GetByItemID(pri.ItemID, CheckOutType.Procedure); - if (ui.IsAdministrator() || ui.IsSetAdministrator(pri.MyDocVersion)) - { - cm.MenuItems.Add("Export Procedure", mi_Click); - //C2025-024 Proms XML Output - if have any EP Format files, add dropdown menu for exporting EP formats - if (pri.ActiveFormat.PlantFormat.EPFormatFiles.Count > 0) - AddEPExport(cm.MenuItems, pri.MyDocVersion.MultiUnitCount, pri.MyDocVersion.UnitNames, pri.ActiveFormat.PlantFormat.EPFormatFiles); - } - if (ui.IsAdministrator() || ui.IsSetAdministrator(pri.MyDocVersion) || ui.IsWriter(pri.MyDocVersion)) - { - if (oi != null && oi.SessionID != MySessionInfo.SessionID) - cm.MenuItems.Add(string.Format("Procedure Checked Out to {0}", oi.SessionUserID), new EventHandler(mi_Click)); - if (pri.ActiveFormat.PlantFormat.FormatData.ProcData.PSI.Caption != null) cm.MenuItems.Add("Procedure Specific Information", new EventHandler(mi_Click)); - cm.MenuItems.Add("Insert Procedure Before", new EventHandler(mi_Click)); - cm.MenuItems.Add("Insert Procedure After", new EventHandler(mi_Click)); - - // if this format has change ids that were added from edit, allow removal of - // change ids for this procedure: - //FolderInfo fi = FolderInfo.Get(1); - //FormatInfo frmI = FormatInfo.Get(fi.FormatID ?? 1); - //if (frmI.PlantFormat.FormatData.ProcData.ChangeBarData.ChgBarMessageFromEdit) - // cm.MenuItems.Add("Remove Change Ids", new EventHandler(mi_Click)); - cm.MenuItems.Add("New Section", new EventHandler(mi_Click)); - if (pri.MyDocVersion.MultiUnitCount > 1) - { - MenuItem micas = new MenuItem("Create Continuous Action Summary"); - MenuItem mitcas = new MenuItem("Create Time Critical Action Summary"); //F2022-024 added menu option - MenuItem mip = new MenuItem("Print"); - MenuItem miqp = new MenuItem("Quick Print"); - //MenuItem mips = new MenuItem("Print Section"); - MenuItem mia = new MenuItem("Approve"); - - int k = 0; - foreach (string s in pri.MyDocVersion.UnitNames) - { - // C2021-027: Procedure level PC/PC - see if menu items for unit should be enabled - bool procAppl = pri.ApplIncludeFromStr(s); - k++; - MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mp.Enabled = procAppl; - mp.Tag = k; - MenuItem mqp = miqp.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mqp.Enabled = procAppl; - mqp.Tag = k; - //MenuItem mps = mips.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - //mps.Enabled = procAppl; - //mps.Tag = k; - MenuItem ma = mia.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - ma.Enabled = procAppl; - ma.Tag = k; - MenuItem mc = micas.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mc.Enabled = procAppl; - mc.Tag = k; - MenuItem mtc = mitcas.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mtc.Enabled = procAppl; - mtc.Tag = k; - } - cm.MenuItems.Add(micas); - cm.MenuItems.Add(mitcas); - cm.MenuItems.Add(mip); - cm.MenuItems.Add(miqp); - //cm.MenuItems.Add(mips); - AddShowChangeBarsAfterMenuItem(cm.MenuItems, pri); - cm.MenuItems.Add(mia); - AddApprovedRevisionsMultiUnit(cm.MenuItems, pri); - } - else - { - cm.MenuItems.Add("Create Continuous Action Summary", new EventHandler(mi_Click)); - cm.MenuItems.Add("Create Time Critical Action Summary", new EventHandler(mi_Click)); - cm.MenuItems.Add("Print", new EventHandler(mi_Click)); - cm.MenuItems.Add("Quick Print", new EventHandler(mi_Click)); - //cm.MenuItems.Add("Print Section", new EventHandler(mi_Click)); - //MenuItem miqp = new MenuItem("Print"); - AddShowChangeBarsAfterMenuItem(cm.MenuItems, pri); - cm.MenuItems.Add("Approve", new EventHandler(mi_Click)); - //_MyLog.WarnFormat("Context Menu 1 before - {0}", GC.GetTotalMemory(true)); - AddApprovedRevisions(cm.MenuItems, pri); - //_MyLog.WarnFormat("Context Menu 1 after - {0}", GC.GetTotalMemory(true)); - } - } - else - { - if (oi != null && oi.SessionID != MySessionInfo.SessionID) - cm.MenuItems.Add(string.Format("Procedure Checked Out to {0}", oi.SessionUserID), new EventHandler(mi_Click)); - if (pri.MyDocVersion.MultiUnitCount > 1) - { - MenuItem mip = new MenuItem("Print"); - MenuItem miqp = new MenuItem("Quick Print"); - int k = 0; - foreach (string s in pri.MyDocVersion.UnitNames) - { - k++; - MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mp.Tag = k; - MenuItem mqp = miqp.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mqp.Tag = k; - } - cm.MenuItems.Add(mip); - cm.MenuItems.Add(miqp); - AddApprovedRevisionsMultiUnit(cm.MenuItems, pri); - } - else - { - cm.MenuItems.Add("Print", new EventHandler(mi_Click)); - cm.MenuItems.Add("Quick Print", new EventHandler(mi_Click)); - AddApprovedRevisions(cm.MenuItems, pri); - } - } - cm.MenuItems.Add("Print Transition Report", new EventHandler(mi_Click)); - } - else if (tn.VEObject as SectionInfo != null) - { - isSectNode = true; - // A step Section can contain other steps or can contain subsections (either step section - // or word doc section). Also note that there can be a mix. - // A word doc section can contain another subsection (either step section or word doc section), - // but cannot contain steps. - SectionInfo si = tn.VEObject as SectionInfo; - // if this is an enhanced section, don't do 'New Step' - if (ui.IsAdministrator() || ui.IsSetAdministrator(si.MyProcedure.MyDocVersion) || ui.IsWriter(si.MyProcedure.MyDocVersion)) - { - if (si.HasWordContent) - { - oi = OwnerInfo.GetByItemID(si.MyContent.MyEntry.DocID, CheckOutType.Document); - } - si.MyConfig = null; - // Do not need step versus Word doc options, user enters this in property page during - // insert process. - if (oi != null && oi.SessionID != MySessionInfo.SessionID) - cm.MenuItems.Add(string.Format("Document Checked Out to {0}", oi.SessionUserID), new EventHandler(mi_Click)); - cm.MenuItems.Add("Insert Section Before", new EventHandler(mi_Click)); - cm.MenuItems.Add("Insert Section After", new EventHandler(mi_Click)); - if (!si.IsAutoTOCSection && si.IsStepSection) // B2016-282: Don't allow insert of subsections off Word Section. - { - bool meta = si.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections; - if (meta) cm.MenuItems.Add("New Subsection", new EventHandler(mi_Click)); - // if this section has subsections, then be sure that the 'editable' data config - // is set to allow new step creation. - if (si.IsStepSection) - { - SectionConfig sc = si.MyConfig as SectionConfig; - if (!si.IsEnhancedSection && (si.Sections == null || si.Sections.Count == 0 || (meta && sc != null && si.Sections != null && si.Sections.Count > 0 && sc.SubSection_Edit == "Y"))) - cm.MenuItems.Add("New Step", new EventHandler(mi_Click)); - - //ProcedureInfo pri = tn as SectionInfo; - SectionInfo si2 = (tn as VETreeNode).VEObject as SectionInfo; - if (si2.MyDocVersion.MultiUnitCount > 1) - { - if (!si2.IsSubsection) - { - MenuItem mps = new MenuItem("Print Section"); - int k = 0; - foreach (string s in si2.MyDocVersion.UnitNames) - { - k++; - MenuItem mp = mps.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mp.Tag = k; - } - cm.MenuItems.Add(mps); - - //C2025-028 Add a Quick Print Section option - MenuItem mps_qp = new MenuItem("Quick Print Section"); - int k_qp = 0; - foreach (string s in si2.MyDocVersion.UnitNames) - { - k_qp++; - MenuItem mp_qp = mps_qp.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mp_qp.Tag = k_qp; - } - cm.MenuItems.Add(mps_qp); - } - } - else - { - if (!si2.IsSubsection) - { - cm.MenuItems.Add("Print Section", new EventHandler(mi_Click)); - cm.MenuItems.Add("Quick Print Section", new EventHandler(mi_Click)); - } - } - } - } - } - } - else if (tn.VEObject as StepInfo != null) - { - // check the format for allowable inserts, and also, - ItemInfo i = tn.VEObject as ItemInfo; - if (ui.IsAdministrator() || ui.IsSetAdministrator(i.MyProcedure.MyDocVersion) || ui.IsWriter(i.MyProcedure.MyDocVersion)) - { - //oi = OwnerInfo.GetByItemID(i.MyProcedure.ItemID); - if (AddToInsertMenu(i, 0)) cm.MenuItems.Add("Insert Step Before", new EventHandler(mi_Click)); - if (AddToInsertMenu(i, 1)) cm.MenuItems.Add("Insert Step After", new EventHandler(mi_Click)); - } - } - #endregion - //_MyLog.WarnFormat("Context Menu 2 - {0}", GC.GetTotalMemory(true)); - //#region Print_Section - //if (!tn.IsExpanded && tn.VEObject as SectionInfo != null) - //{ - // SectionInfo si = tn.VEObject as SectionInfo; - // if (si.IsStepSection) cm.MenuItems.Add("Print Section", new EventHandler(mi_Click)); - //} - //#endregion - #region Menu_Open - if (!tn.IsExpanded && tn.VEObject as SectionInfo != null) - { - SectionInfo si = tn.VEObject as SectionInfo; - if (si.IsStepSection) cm.MenuItems.Add("Open", new EventHandler(mi_Click)); - } - else if (!tn.IsExpanded && tn.VEObject as StepInfo != null) - { - StepInfo stpi = tn.VEObject as StepInfo; - if (stpi.HasChildren) cm.MenuItems.Add("Open", new EventHandler(mi_Click)); - } - else if (!tn.IsExpanded) - cm.MenuItems.Add("Open", new EventHandler(mi_Click)); - else - { // B2016-058 customize the "Collapse" menu text based on tree node type - string mtext = "Collapse"; // only the step or substep (RNOs, Cautions, Notes as well) will be collapsed - if (isFolderNode || isWrkDftNode) - mtext += " All Procedures"; // all expanded procedure nodes in all procedure sets are collapsed (folder and working draft nodes remain expanded) - else if (isProcNode) - mtext += " Procedure"; // only the current procedure node is collapsed - else if (isSectNode) - mtext += " Section"; // only the current section node is collapsed - cm.MenuItems.Add(mtext, new EventHandler(mi_Click)); - } - #endregion - //_MyLog.WarnFormat("Context Menu 3 - {0}", GC.GetTotalMemory(true)); - - #region Menu_CutCopy - // For initial release, copy is not available for folders or docversions - if (tn.VEObject as ItemInfo != null) - { - ItemInfo i = tn.VEObject as ItemInfo; - // in the following, 'Copy' is not allowed for any procedure/section/step that is enhanced. Note that this may be - // changed later, but for the initial enhanced development it was decided to not allow copy of enhanced since paste would - // require clearing of all enhanced config data or mapping it to existing data (quite complicated) - if ((ui.IsAdministrator() || ui.IsSetAdministrator(i.MyProcedure.MyDocVersion) || ui.IsWriter(i.MyProcedure.MyDocVersion)) && (!i.IsEnhancedStep && !i.IsEnhancedProcedure && !i.IsEnhancedSection && !i.IsRtfRaw && !i.IsFigure)) - cm.MenuItems.Add("Copy", new EventHandler(mi_Click)); - //if (i.HasWordContent) - //{ - // cm.MenuItems.Add("Print Section", new EventHandler(mi_Click)); - // cm.MenuItems.Add("Quick Print Section", new EventHandler(mi_Click)); - //} - if (i.HasWordContent) - { - if (i.MyDocVersion.MultiUnitCount > 1) - { - if (!i.IsSubsection) - { - MenuItem mps = new MenuItem("Print Section"); - MenuItem mqps = new MenuItem("Quick Print Section"); - int k = 0; - foreach (string s in i.MyDocVersion.UnitNames) - { - k++; - MenuItem mp = mps.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mp.Tag = k; - MenuItem mqp = mqps.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); - mqp.Tag = k; - } - cm.MenuItems.Add(mps); - cm.MenuItems.Add(mqps); - } - } - else - { - cm.MenuItems.Add("Print Section", new EventHandler(mi_Click)); - cm.MenuItems.Add("Quick Print Section", new EventHandler(mi_Click)); - } - } - } - #endregion - //_MyLog.WarnFormat("Context Menu 4 - {0}", GC.GetTotalMemory(true)); - - #region Menu_Paste - bool ok = false; - if (tn.VEObject is FolderInfo && (ui.IsAdministrator() || ui.IsSetAdministrator(tn.VEObject as FolderInfo))) - ok = true; - else if (tn.VEObject is DocVersionInfo && (ui.IsAdministrator() || ui.IsSetAdministrator(tn.VEObject as DocVersionInfo))) - ok = true; - else if (tn.VEObject is ItemInfo && (ui.IsAdministrator() || ui.IsSetAdministrator((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion) || ui.IsWriter((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion))) - ok = true; - if (ok) - Menu_Paste(tn, cm); - #endregion - //_MyLog.WarnFormat("Context Menu 5 - {0}", GC.GetTotalMemory(true)); - - #region Menu_Delete - if (ok) - - - - - - { - // Add delete to the menu unless at the very 'top' node, on a grouping (partinfo) - // node (RNOs, Steps, Cautions, Notes) or Folder/DocVersion that contains any items. - PartInfo pi = tn.VEObject as PartInfo; - if (pi == null && tn.Parent != null) // it's not a part and it's not the top.... - { - fi = tn.VEObject as FolderInfo; - if (fi == null || tn.Nodes.Count == 0) // it's not a folder or it has no children - { - DocVersionInfo di = tn.VEObject as DocVersionInfo; - if (di == null || tn.Nodes.Count == 0) // it's not a docversion or it has no children - { - // if it's an enhanced step that was linked from a source, don't allow delete - bool canDoDel = true; - ItemInfo iienh = tn.VEObject as ItemInfo; - if (iienh != null && iienh.IsProcedure && iienh.IsEnhancedProcedure) canDoDel = false; - if (iienh != null && iienh.IsSection && iienh.IsEnhancedSection && !iienh.IsEnhancedSectionTitleOnly) canDoDel = false; - if (iienh != null && iienh.IsEnhancedStep) canDoDel = false; - if (canDoDel) cm.MenuItems.Add("Delete", new EventHandler(mi_Click)); - } - } - } - } - - #endregion - //_MyLog.WarnFormat("Context Menu 6 - {0}", GC.GetTotalMemory(true)); - #region Menu_ExternalTransitions - // C2020-033: Support the menu item to bring up Search/Incoming Transitions panel - ItemInfo iix = tn.VEObject as ItemInfo; - if (iix != null) - { - cm.MenuItems.Add("Incoming Transitions", new EventHandler(mi_Click)); - } - #endregion - #region Menu_UnLinkEnhanced - // B2022-049: provide for way to unlink a procedure from the tree view. Also unlinks procedure if no - // connected (linked) procedure. - if (tn.VEObject is ProcedureInfo) - { - ItemInfo prc = (ItemInfo)tn.VEObject; - if (ui.IsAdministrator() || ui.IsSetAdministrator(prc.MyDocVersion) || ui.IsWriter(prc.MyDocVersion)) - { - DVEnhancedDocuments dveds = prc.MyDocVersion.DocVersionConfig.MyEnhancedDocuments; - EnhancedDocuments eds = prc.GetMyEnhancedDocuments(); - - // if just one link, add single menu item to unlink. If more than one, need a list with all. - if (eds != null && eds.Count == 1) - { - // Get menu string, must start with 'Unlink Source ' - string doclink = null; - doclink = dveds.GetByType(eds[0].Type).Name; // need background/dev if on source - if (eds[0].Type == 0) - { - ItemInfo prl = ItemInfo.Get(eds[0].ItemID); - DVEnhancedDocuments dvedsl = prl.MyDocVersion.DocVersionConfig.MyEnhancedDocuments; - foreach (DVEnhancedDocument dvel in dvedsl) if (dvel.VersionID == prc.MyDocVersion.VersionID) doclink = dvel.Name; - } - doclink = string.Format("Unlink Source and {0} Procedure", doclink); - MenuItem mix = cm.MenuItems.Add(doclink, new EventHandler(miEnhanced_Click)); - mix.Tag = -1; // NOTE this is what flags what gets processed on menu click, i.e. -1 - } - // if this is a source procedure that has enhanced, for example Background and/or deviation, ask which should be unlinked including all - else if (eds != null && eds.Count > 1) - { - MenuItem miu = new MenuItem("Unlink Enhanced Procedure(s) from Source"); - miu.Tag = -2; // this menu item doesn't get used. - int k = 0; - foreach (EnhancedDocument ed in eds) - { - // add submenu item for it - k++; - MenuItem mp = miu.MenuItems.Add(dveds.GetByType(ed.Type).Name, new EventHandler(miEnhanced_Click)); - mp.Tag = k; - } - // add all submenu item - MenuItem mp1 = miu.MenuItems.Add("All", new EventHandler(miEnhanced_Click)); - mp1.Tag = 0; // Tag of 0 flags All - cm.MenuItems.Add(miu); - } - } - } - #endregion - #region Menu_Properties - // Add Properties to the menu unless at the very 'top' node or on a grouping (partinfo) - // node (RNOs, Steps, Cautions, Notes) or at the step level. - // B2020-105 Allow Set Administrators to rename folder's (sets of procedures) to which they have been given access. - if (tn.VEObject is FolderInfo) ok = (ui.IsAdministrator() || ui.IsSetAdministrator(tn.VEObject as FolderInfo)); - else ok = (tn.VEObject is DocVersionInfo) ? (ui.IsAdministrator() || ui.IsSetAdministrator(tn.VEObject as DocVersionInfo)) - : (ui.IsAdministrator() || (tn.VEObject is ItemInfo) && (ui.IsSetAdministrator((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion) - || ui.IsWriter((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion))); - PartInfo pia = tn.VEObject as PartInfo; - ItemInfo ii = tn.VEObject as ItemInfo; - if (ok) - if (pia == null && tn.VEObject as StepInfo == null) cm.MenuItems.Add("Properties...", new EventHandler(mi_Click)); - #endregion - #region Refresh_Tree - //C2021-035 Add Refresh Tree Option at highest level - if (tn == (VETreeNode)Nodes[0]) - cm.MenuItems.Add("Refresh Tree", new EventHandler(mi_Click)); - #endregion - //_MyLog.WarnFormat("Context Menu 7 - {0}", GC.GetTotalMemory(true)); - - if (fi != null && fi.HasWorkingDraft) - { - /* - --Folder level - see if we need to disable "Export Procedure Set" or "Folder Specific Information" - */ - if (tn.MovedToSeparateWindow) - { - foreach (MenuItem itm in cm.MenuItems) - { - if (!itm.Text.StartsWith("Insert")) // C2015-022 only enable insert folder before/after if in the main window and the procedures of this folder are in a child window - itm.Enabled = false; - } - } - else if (tn.InChildWindow) - { - foreach (MenuItem itm in cm.MenuItems) - { - if (itm.Text.StartsWith("Insert")) // C2015-022 disable insert folder before/after if doing a properties on a folder in a child window - itm.Enabled = false; - } - } - else - { - if (!tn.ChildrenLoaded) tn.LoadChildren(); - VETreeNode wrkdrft = (VETreeNode)tn.LastNode; - DocVersionInfo docver = wrkdrft.VEObject as DocVersionInfo; - OwnerInfoList.Reset(); - oil = OwnerInfoList.GetByVersionID(docver.VersionID); - bool greyOut = false; - foreach (OwnerInfo own in oil) - { - if (own.SessionID != MySessionInfo.SessionID) - { - greyOut = true; - break; - } - } - if (greyOut) - { - foreach (MenuItem itm in cm.MenuItems) - { - if (itm.Text == "Export Procedure Set" || itm.Text == "Folder Specific Information") // C2020-008: change to 'Folder' - itm.Enabled = false; - } - } - } - } - if (oil != null && oil.Count > 0 && tn.VEObject as DocVersionInfo != null) - { - /* - --docversion level - Approve All Procedures - Report All Procedures Inconsistencies - */ - bool greyOut = false; - foreach (OwnerInfo own in oil) - { - if (own.SessionID != MySessionInfo.SessionID) - { - greyOut = true; - break; - } - } - if (greyOut) - { - foreach (MenuItem itm in cm.MenuItems) - { - if (itm.Text == "Approve All Procedures" || itm.Text == "Report All Procedures Inconsistencies" || - itm.Text == "Procedure Set Specific Information" || itm.Text == "Approve All Procedures for" || - itm.Text == "Approve Some Procedures" || itm.Text == "Approve Some Procedures for") - itm.Enabled = false; - - } - } - } - if (oi != null && oi.SessionID != MySessionInfo.SessionID) - { - /* - --procedure level - Procedure Specific Information - New Section - Approve - Open - Copy - Delete - Properties... - - --section level - all of them - - --step level - all of them - */ - //_MyLog.WarnFormat("Context Menu 8 - {0}", GC.GetTotalMemory(true)); - - if (tn.VEObject as ProcedureInfo != null) - { - // F2022-024 added Time Critical Action Summary option - foreach (MenuItem itm in cm.MenuItems) - { - if (itm.Text == "Procedure Specific Information" || itm.Text == "New Section" || itm.Text == "Approve" || itm.Text == "Open" || - itm.Text == "Copy" || itm.Text == "Delete" || itm.Text == "Properties..." || itm.Text == "Replace Existing Procedure" || - itm.Text.StartsWith("Showing Change Bars Starting") || itm.Text == "Create Continuous Action Summary" || - itm.Text == "Create Time Critical Action Summary" || itm.Text == "Export Procedure") - itm.Enabled = false; - } - } - if (tn.VEObject as SectionInfo != null || tn.VEObject as StepInfo != null) - { - foreach (MenuItem itm in cm.MenuItems) - { - if (!itm.Text.StartsWith("Document Checked Out")) - itm.Enabled = false; - } - } - } - this.Cursor = Cursors.Default; - //_MyLog.WarnFormat("Context Menu 9 - {0}", GC.GetTotalMemory(true)); - - cm.Show(this, new Point(e.X, e.Y)); - } - } - } - - //C2025-024 Electronic Procedures - Phase 2 (PROMS XML output) - // Add context menu for exporting Electronic Procedures - // if has an Electronic procedure - // then loop through and add an Export for each EP Viewer - private void AddEPExport(Menu.MenuItemCollection menuItems, int MultiUnitCount, string[] UnitNames, EPFormatFiles EPFiles) - { - //add outer menu - MenuItem mi = menuItems.Add("Electronic Procedure Viewer Export"); - foreach (EPFormatFile epAnnType in EPFiles) - { - - //Add item for each individual EP Viewer - MenuItem mv = mi.MenuItems.Add(epAnnType.AnnotationName()); - - //tag will be of format: - //{EP Annotation Type ID},{Unit} - //if not multi-unit, unit will be zero. - if (MultiUnitCount > 1) - { - //if multi-unit, add menu item for each unit - int k = 0; - foreach (string s in UnitNames) - { - k++; - MenuItem multiunit_mv = mv.MenuItems.Add(s); - multiunit_mv.Tag = $"{epAnnType.AnnotationTypeID},{k}"; - multiunit_mv.Click += new EventHandler(miEP_Click); - } - } - else - { - mv.Tag = $"{epAnnType.AnnotationTypeID},0"; - mv.Click += new EventHandler(miEP_Click); - } - } - } - - private void AddApprovedRevisionsMultiUnit(Menu.MenuItemCollection menuItemCollection, ProcedureInfo pri) - { - _currentPri = pri; - RevisionInfoList ril = RevisionInfoList.GetByItemID(pri.ItemID); - if (ril.Count == 0) return; // no versions to list - MenuItem mi = menuItemCollection.Add("Versions"); - int k = 0; - int lastApprovedRevisionID = 0; - foreach (string s in pri.MyDocVersion.UnitNames) - { - k++; - MenuItem mv = mi.MenuItems.Add(s); - mv.Tag = k; - ril = RevisionInfoList.GetByItemIDandUnitID(pri.ItemID, k); - foreach (RevisionInfo ri in ril) - { - MenuItem mir = mv.MenuItems.Add(ri.ToString()); - mir.Tag = ri; - if (ri.LatestVersion.MyStage.IsApproved > 0 && (ri.RevisionID > lastApprovedRevisionID)) - lastApprovedRevisionID = ri.RevisionID; - if (ri.Notes.Length > 0) //C2018-026 add the ability to show notes entered during approval or workflow stage in the sub-menu - { - MenuItem mirp = mir.MenuItems.Add("View Revision Stage Notes"); - mirp.Tag = ri; - mirp.Click += new EventHandler(ViewRevisonStageNotes_Click); - } - if (ri.LatestVersion.PDF != null) - { - MenuItem mirp = mir.MenuItems.Add("View Procedure"); - mirp.Tag = ri.RevisionID; - mirp.Click += new EventHandler(MultiUnitApprovedRevision_Click); - } - if (ri.LatestVersion.SummaryPDF != null) - { - MenuItem mirs = mir.MenuItems.Add("View Summary of Changes"); - mirs.Tag = ri.RevisionID; - mirs.Click += new EventHandler(MultiUnitSummaryOfChanges_Click); - } - if (ri.LatestVersion.ApprovedXML != null && ri.LatestVersion.ApprovedXML != "") - { - MenuItem miri = mir.MenuItems.Add("Create Procedure to Import"); - miri.Tag = ri.RevisionID; - miri.Click += new EventHandler(MultiUnitImportProcedure_Click); //B2024-024 Parent Child Create Approved Import file - } - - //end added jcb 20111031 - mv.Tag = lastApprovedRevisionID; - } - ril = null; - } - } - public void AddNewNode(IVEDrillDownReadOnly o) - { - VETreeNode tn = new VETreeNode(o); - SelectedNode.Nodes.Add(tn); - } - private void AddApprovedRevisions(Menu.MenuItemCollection menuItemCollection, ProcedureInfo pri) - { - try - { - //_MyLog.WarnFormat("Context Menu 1 before GET - {0}", GC.GetTotalMemory(true)); - _currentPri = pri; - using (RevisionInfoList ril = RevisionInfoList.GetByItemID(pri.ItemID)) - { - //_MyLog.WarnFormat("Context Menu 1 After GET - {0}", GC.GetTotalMemory(true)); - if (ril.Count == 0) return; // no versions to list - MenuItem mi = menuItemCollection.Add("Versions"); - int lastApprovedRevisionID = 0; - foreach (RevisionInfo ri in ril) - { - MenuItem mir = mi.MenuItems.Add(ri.ToString()); - mir.Tag = ri; - bool addImportMI = false; - if (ri.LatestVersion.MyStage.IsApproved > 0 && (ri.RevisionID > lastApprovedRevisionID)) - { - lastApprovedRevisionID = ri.RevisionID; - addImportMI = true; - } - //mir.Click += new EventHandler(ApprovedRevision_Click); - //added jcb 20111031 - //_MyLog.WarnFormat("Context Menu 1 b4ViewProc- {0}", GC.GetTotalMemory(true)); - if (ri.Notes.Length > 0) //C2018-026 add the ability to show notes entered during approval or workflow stage in the sub-menu - { - MenuItem mirp = mir.MenuItems.Add("View Revision Stage Notes"); - mirp.Tag = ri; - mirp.Click += new EventHandler(ViewRevisonStageNotes_Click); - } - if (ri.LatestVersion.PDF != null) - { - MenuItem mirp = mir.MenuItems.Add("View Procedure"); - mirp.Tag = ri; - mirp.Click += new EventHandler(ApprovedRevision_Click); - } - //_MyLog.WarnFormat("Context Menu 1 b4viewSum- {0}", GC.GetTotalMemory(true)); - if (ri.LatestVersion.SummaryPDF != null) - { - MenuItem mirs = mir.MenuItems.Add("View Summary of Changes"); - mirs.Tag = ri; - mirs.Click += new EventHandler(SummaryOfChanges_Click); - } - //_MyLog.WarnFormat("Context Menu 1 b4 import - {0}", GC.GetTotalMemory(true)); - if (addImportMI && ri.LatestVersion.ApprovedXML != null && ri.LatestVersion.ApprovedXML != "") - { - MenuItem miri = mir.MenuItems.Add("Create Procedure to Import"); - miri.Tag = ri; - miri.Click += new EventHandler(ImportProcedure_Click); - } - //_MyLog.WarnFormat("Context Menu 1 after import- {0}", GC.GetTotalMemory(true)); - //end added jcb 20111031 - mi.Tag = lastApprovedRevisionID; - } - } - } - catch - { - return; - } - } - - private void AddShowChangeBarsAfterMenuItem(Menu.MenuItemCollection menuItemCollection, ProcedureInfo pri) - { - using (RevisionInfoList ril = RevisionInfoList.GetByItemID(pri.ItemID)) - { - if (ril.Count == 0 || MyUserInfo.IsAdministrator() || MyUserInfo.IsSetAdministrator(pri.MyDocVersion)) - { - ProcedureConfig pc = pri.MyConfig as ProcedureConfig; - string currentChgBarDateTime = ""; - if (pc != null) - currentChgBarDateTime = pc.Print_ChangeBarDate; // Current change bar date time before - if (currentChgBarDateTime == "") - currentChgBarDateTime = "(date not set)"; - else - currentChgBarDateTime = currentChgBarDateTime.Split(' ')[0]; // only show the date not the time - menuItemCollection.Add(string.Format("Showing Change Bars Starting {0}", currentChgBarDateTime), new EventHandler(mi_Click)); - } - } - } - - void ImportProcedure_Click(object sender, EventArgs e) - { - //B2024-024 restored the line below from prior change - didn't work for non parent/childs sets - created a new click event method (below) for parent/child sets. - RevisionInfo ri = (sender as MenuItem).Tag as RevisionInfo; - RevisionConfig rc = ri.MyConfig as RevisionConfig; - // bug fix: B2016-183 - add the child's name (ex Unit 1) to the export file name for Parent/Child procedures. - int applIdx = rc.Applicability_Index; - string str = (applIdx > 0) ? _currentPri.MyDocVersion.UnitNames[applIdx - 1] + "_" : ""; // if parent/child get the defined child name to inlcude the export filename - System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); - xd.LoadXml(ri.LatestVersion.ApprovedXML); - string PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database; - DirectoryInfo di = new DirectoryInfo(PEIPath); - if (!di.Exists) di.Create(); - // B2022-048: Crash when creating Procedure to Import from versions. Couldn't handle '/' in proc number. - string fNametmp = xd.SelectSingleNode("procedure/content/@number").InnerText.Replace(" ", "_").Replace(@"\u8209?", "-").Replace(@"\u9586?", "_").Replace("/", "-") + ".pxml"; - // B2022-112: If applicability, need to resolve the '<' and '>' characters. Just use the UnitNames, i.e. str, from above. - if (applIdx > 0) fNametmp = Regex.Replace(fNametmp, @"\", str, RegexOptions.IgnoreCase); - string fileName = PEIPath + "\\" + str + "Approved_Rev_" + ri.RevisionNumber.Replace(" ", "_").Replace("\\", "-").Replace("/", "-") + "_" + fNametmp; - xd.Save(fileName); - FlexibleMessageBox.Show("Approved procedure saved to import file " + fileName, "Creating Export of Approved Procedure", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - - //B2024-024 create import file for parent/child procedure set - void MultiUnitImportProcedure_Click(object sender, EventArgs e) - { - RevisionInfo ri = RevisionInfo.Get(int.Parse((sender as MenuItem).Tag.ToString())); - RevisionConfig rc = ri.MyConfig as RevisionConfig; - // bug fix: B2016-183 - add the child's name (ex Unit 1) to the export file name for Parent/Child procedures. - int applIdx = rc.Applicability_Index; - string str = (applIdx > 0) ? _currentPri.MyDocVersion.UnitNames[applIdx - 1] + "_" : ""; // if parent/child get the defined child name to include the export filename - System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); - xd.LoadXml(ri.LatestVersion.ApprovedXML); - string PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database; - DirectoryInfo di = new DirectoryInfo(PEIPath); - if (!di.Exists) di.Create(); - // B2022-048: Crash when creating Procedure to Import from versions. Couldn't handle '/' in proc number. - string fNametmp = xd.SelectSingleNode("procedure/content/@number").InnerText.Replace(" ", "_").Replace(@"\u8209?", "-").Replace(@"\u9586?", "_").Replace("/", "-") + ".pxml"; - // B2022-112: If applicability, need to resolve the '<' and '>' characters. Just use the UnitNames, i.e. str, from above. - if (applIdx > 0) - { - fNametmp = Regex.Replace(fNametmp, @"\", str, RegexOptions.IgnoreCase); - fNametmp = Regex.Replace(fNametmp, @"\", str, RegexOptions.IgnoreCase); - } - - string fileName = PEIPath + "\\" + str + "Approved_Rev_" + ri.RevisionNumber.Replace(" ", "_").Replace("\\", "-").Replace("/", "-") + "_" + fNametmp; - xd.Save(fileName); - FlexibleMessageBox.Show("Approved procedure saved to import file " + fileName, "Creating Export of Approved Procedure", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - - //C2025-015 Get a partial folder path. This will be used in building the PDF file name when viewing Approved procedures - string ProcFolderPathforApprovedPDF(string fullPath) - { - string rtnStr = ""; - try - { - // the fullPath string that is passed in ends with the Working Draft node. We want to trim that off - string[] strParts = fullPath.Substring(0, fullPath.LastIndexOf("\\")).Split('\\'); //fullPath.Replace("\\Working Draft","").Split('\\'); - int lastPart = Math.Max(strParts.Length - 1, 0); - rtnStr = strParts[lastPart]; - if (rtnStr.ToUpper().StartsWith("UNIT")) - { - rtnStr = strParts[lastPart - 1] + "_" + rtnStr; - } - } - catch - { - rtnStr = fullPath.Replace("\\", "_"); // just return the full path with _ intead of backslashes - } - return rtnStr; - } - - void ApprovedRevision_Click(object sender, EventArgs e) - { - bool superceded = false; - MenuItem mi = sender as MenuItem; - if (mi == null) return; - RevisionInfo ri = mi.Tag as RevisionInfo; - { - MenuItem mip = mi.Parent as MenuItem; - //B2021-086 Added the check for the last revision stage is an Approved stage - if ((ri.RevisionID < int.Parse(mip.Parent.Tag.ToString())) && ri.LatestVersion.MyStage.IsApproved != 0) - superceded = true; - } - ProcedureInfo prcInfo = ProcedureInfo.Get(ri.ItemID); - // C2025-015 build a file name that includes a partial folder path and approved revision number - string approvedPDFName = string.Format("{0}_{1} Revision {2}", ProcFolderPathforApprovedPDF(prcInfo.SearchDVPath_clean), prcInfo.PDFNumber,ri.RevisionNumber); - vlnTreeViewPdfArgs args = new vlnTreeViewPdfArgs(Volian.Base.Library.TmpFile.CreateFileName(approvedPDFName), ri.LatestVersion.PDF, superceded ? "Superceded" : ""); - OnViewPDF(sender, args); - // System.Diagnostics.Process pp = System.Diagnostics.Process.Start(GetDocPdf(ri, superceded)); - } - void MultiUnitApprovedRevision_Click(object sender, EventArgs e) - { - bool superceded = false; - MenuItem mi = sender as MenuItem; - if (mi == null) return; - string childName = ""; - //RevisionInfo ri = mi.Tag as RevisionInfo; - RevisionInfo ri = RevisionInfo.Get(int.Parse(mi.Tag.ToString())); - { - MenuItem mip = mi.Parent as MenuItem; - //B2021-086 Added the check for the last revision stage is an Approved stage - if ((ri.RevisionID < int.Parse(mip.Parent.Tag.ToString())) && ri.LatestVersion.MyStage.IsApproved != 0) - superceded = true; - // C2025_015 get the child's name to append to file name - mip = mip.Parent as MenuItem; - if (mip != null) - { - childName = "_" + mip.Text; - } - } - ItemInfo ii = ItemInfo.Get(ri.ItemID); - ii.MyDocVersion.DocVersionConfig.SelectedSlave = ri.MyConfig.Applicability_Index; - ProcedureInfo prcInfo = ProcedureInfo.Get(ri.ItemID); - if (prcInfo.MyContent.Number.ToUpper().Contains(" 0 : - !ii.IsRNOPart && (actable & E_AccStep.AddingNext) > 0; - } - private void Menu_Paste(VETreeNode tn, ContextMenu cm) - { - #region Menu_Paste method - // Find what's in paste buffer & determine whether the paste can occur for the selected node. - ItemInfo iiClipboard = OnClipboardStatus(this, new vlnTreeEventArgs(tn)); - if (iiClipboard != null) - { - // can it be pasted at current node. - - // for now (Jan 2016 - initial implementation of enhanced document support) do NOT paste - // any items that have enhanced data associated with it unless pasting within an enhanced source item. - // The reason is that code would need to handle clearing/setting the pasted enhanced config which - // becomes very complicated. - - // For all enhanced comments in code use the following: - // 'source' is Procedures, for example EOP procedures (that has config's myenhanceddocuments pointing to enhanced, i.e. not source) - // 'enhanced' is enhanced procedures, for example Background/deviation (that has config's myenhanceddocuments pointing back to source) - // 'non' or 'not enhanced', anything other than 'source' or 'enhanced' (has no myenhanceddocuments on config) - // 'from' is object copied - // 'to' is object where paste was selected from - #region Menu_Paste_ToDocVersion - if (tn.VEObject as DocVersionInfo != null) // paste item must be a proc - { - if (iiClipboard.IsProcedure) - { - // In order to paste a procedure into a docVersion: NOTE that an 'enhanced' procedure cannot be in paste buffer! - // 1) 'to' & 'from' both 'non', i.e. Neither can have enhanced config data (be source or enhanced) - // 2) 'to' docVersion is 'source' and 'from' procedure is 'non' (has no MyEnhancedDocuments) - // 3) 'to' docversion is 'source' and 'from' procedure is within this docversion - // 4) 'to' docVersion is 'enhanced' and 'from' procedure is not - bool canPaste = false; - - DocVersionInfo dvi = tn.VEObject as DocVersionInfo; - DocVersionConfig dvc = dvi.DocVersionConfig; - bool docVersionIsEnhanced = dvc.MyEnhancedDocuments != null && dvc.MyEnhancedDocuments.Count > 0 && dvc.MyEnhancedDocuments[0].Type == 0; - bool docVersionIsSource = dvc.MyEnhancedDocuments != null && dvc.MyEnhancedDocuments.Count > 0 && dvc.MyEnhancedDocuments[0].Type != 0; - ProcedureInfo pi = iiClipboard as ProcedureInfo; - ProcedureConfig pcfg = pi.MyConfig as ProcedureConfig; - bool procIsSource = pcfg.MyEnhancedDocuments != null && pcfg.MyEnhancedDocuments.Count > 0 && pcfg.MyEnhancedDocuments[0].Type != 0; - if (!docVersionIsEnhanced && !docVersionIsSource && !procIsSource) canPaste = true; - else if (docVersionIsSource && !procIsSource) canPaste = true; - else if (docVersionIsSource) canPaste = (!procIsSource || (iiClipboard.MyDocVersion.ItemID == dvi.ItemID)); - else if (docVersionIsEnhanced) - { - // B2024-028 Do not allow paste of non-enhanced into enhanced set - // (consistent with paste before/after, i.e. don't allow) - canPaste = false; - cm.MenuItems.Add("CANNOT PASTE HERE, Click for more information...", new EventHandler(mi_Click)); - } - if (iiClipboard.IsRtfRaw) canPaste = false; // never paste an equation. - if (canPaste) cm.MenuItems.Add("Paste Procedure", new EventHandler(mi_Click)); - } - #endregion - } - else - { - ItemInfo iiPasteHere = tn.VEObject as ItemInfo; - if (iiPasteHere == null) return; - bool okToReplace = iiClipboard.ItemID != iiPasteHere.ItemID; - if (iiPasteHere != null) - { - SectionInfo si = (tn.VEObject as SectionInfo != null) ? tn.VEObject as SectionInfo : null; - #region Menu_Paste_ToFromProcedure - if (iiPasteHere.IsProcedure && iiClipboard.IsProcedure) // procedure can be pasted before/replace/after - { - // Enhanced considerations, in order to paste a procedure around another procedure: NOTE that an 'enhanced' procedure cannot be in paste buffer! - // 1) 'to' & 'from' both 'non', i.e. Neither can have enhanced config data (be source or enhanced) - // can do Before/After/Replace - // 2) 'to' is 'non', 'from' is 'source' - // cannot do any - // 3) 'to' procedure is 'source' and 'from' procedure is 'non' (has no MyEnhancedDocuments) - // can do Before/After - no links exist in pasted procedure. - // cannot do Replace - // 4) 'to' procedure is 'source' and 'from' procedure is same docversion 'source' - // can do Before/After/Replace - // 5) 'to' procedure is 'source' and 'from' procedure is different docversion 'source' - // cannot do any - // 6) 'to' procedure is 'enhanced' and 'from' procedure is 'source' - // cannot do any - ProcedureConfig pcToCfg = iiPasteHere.MyConfig as ProcedureConfig; - ProcedureConfig pcFromCfg = iiClipboard.MyConfig as ProcedureConfig; - - bool prToIsEnhanced = iiPasteHere.IsEnhancedProcedure; - bool prToIsSource = pcToCfg.MyEnhancedDocuments != null && pcToCfg.MyEnhancedDocuments.Count > 0 && pcToCfg.MyEnhancedDocuments[0].Type != 0; - bool prFromIsEnhanced = iiClipboard.IsEnhancedProcedure; - bool prFromIsSource = pcFromCfg.MyEnhancedDocuments != null && pcFromCfg.MyEnhancedDocuments.Count > 0 && pcFromCfg.MyEnhancedDocuments[0].Type != 0; - bool prCanPaste = false; - if (!prToIsEnhanced && !prToIsSource && !prFromIsEnhanced && !prFromIsSource) prCanPaste = true; // 1) - // else if ((!prToIsEnhanced && !prToIsSource) && prFromIsSource) prCanPaste = false; // 2) commented out because already set to false - else if (prToIsSource && !prFromIsEnhanced && !prFromIsSource) // 3) - { - prCanPaste = true; - okToReplace = false; - } - else if (prToIsSource && iiPasteHere.MyDocVersion.VersionID == iiClipboard.MyDocVersion.VersionID) prCanPaste = true; // 4) - //else if (prToIsSource && iiPasteHere.MyDocVersion.VersionID != iiClipboard.MyDocVersion.VersionID) prCanPaste = false; // 5) commented out because already set to false - //else if (prToIsEnhanced && prFromIsSource) prCanPaste = false; // 6)commented out because already set to false - if (iiClipboard.IsRtfRaw) prCanPaste = okToReplace = prCanPaste = false; // never paste an equation. - if (prCanPaste) cm.MenuItems.Add("Paste Procedure Before", new EventHandler(mi_Click)); - if (okToReplace && prCanPaste) cm.MenuItems.Add("Replace Existing Procedure", new EventHandler(mi_Click)); - if (prCanPaste) cm.MenuItems.Add("Paste Procedure After", new EventHandler(mi_Click)); - // B2017-243 added the following two Cannot Paste menu items when dealing with enhanced documents - // when then user selects these menu items a message box will appear giving more information as to why it cannot be pasted - if (!prCanPaste) - { - if (prToIsEnhanced) - cm.MenuItems.Add("CANNOT PASTE HERE, Click for more information...", new EventHandler(mi_Click)); - else - cm.MenuItems.Add("CANNOT PASTE HERE. Click for more information...", new EventHandler(mi_Click)); - } - } - #endregion - #region Menu_Paste_ToProcedureFromSection - else if (iiPasteHere.IsProcedure && iiClipboard.IsSection) // procedure must have sections only - { - // In order to paste a section into a procedure: NOTE that an 'enhanced' section cannot be in paste buffer! - // 1) 'to' & 'from' both 'non', i.e. Neither can have enhanced config data (be source or enhanced) - // can do - // 2) 'to' procedure is 'source' and 'from' section is 'non' (has no MyEnhancedDocuments) - // can do - // 3) 'to' procedure is 'source' and 'from' section is same source - ProcedureConfig pccToCfg = iiPasteHere.MyConfig as ProcedureConfig; - SectionConfig scFromCfg = iiClipboard.MyConfig as SectionConfig; - bool prToIsEnhanced = iiPasteHere.IsEnhancedProcedure; - bool prToIsSource = pccToCfg.MyEnhancedDocuments != null && pccToCfg.MyEnhancedDocuments.Count > 0 && pccToCfg.MyEnhancedDocuments[0].Type != 0; - bool scFromIsEnhanced = iiClipboard.IsEnhancedSection; - bool scFromIsSource = scFromCfg.MyEnhancedDocuments != null && scFromCfg.MyEnhancedDocuments.Count > 0 && scFromCfg.MyEnhancedDocuments[0].Type != 0; - bool scCanPaste = false; - if (!prToIsEnhanced && !prToIsSource && !scFromIsEnhanced && !scFromIsSource) scCanPaste = true; // 1) - else if (prToIsSource && !scFromIsEnhanced && !scFromIsSource) scCanPaste = true; - else if (prToIsSource && iiPasteHere.MyDocVersion.VersionID == iiClipboard.MyDocVersion.VersionID) scCanPaste = true; // 3) - if (iiClipboard.IsRtfRaw) scCanPaste = false; // never paste an equation. - if (scCanPaste) cm.MenuItems.Add("Paste Section", new EventHandler(mi_Click)); - } - #endregion - #region Menu_Paste_ToSectionFromSection - else if (iiPasteHere.IsSection && iiClipboard.IsSection) - { - // Enhanced considerations, in order to paste a section around another section: NOTE that an 'enhanced' section cannot be in paste buffer! - // 1) 'to' & 'from' both 'non', i.e. Neither can have enhanced config data (be source or enhanced) - // can do Before/After/Replace - // 2) 'to' section is 'source' and 'from' section is 'non' (has no MyEnhancedDocuments) - // can do Before/After - no links exist in pasted section so cannot do Replace - // 3) 'to' section is 'source' and 'from' section is same docversion 'source' - // can do Before/After (B2024-038 removes replace) - // 4) 'to' section is not 'source' and 'from' section is source - // can do Before/After but not replace - would have to manage - // links for 'from' section (B2024-038 added this case) - - SectionConfig secToCfg = iiPasteHere.MyConfig as SectionConfig; - SectionConfig secFromCfg = iiClipboard.MyConfig as SectionConfig; - - bool secToIsEnhanced = iiPasteHere.IsEnhancedSection; - bool secToIsSource = secToCfg.MyEnhancedDocuments != null && secToCfg.MyEnhancedDocuments.Count > 0 && secToCfg.MyEnhancedDocuments[0].Type != 0; - bool secFromIsEnhanced = iiClipboard.IsEnhancedSection; - bool secFromIsSource = secFromCfg.MyEnhancedDocuments != null && secFromCfg.MyEnhancedDocuments.Count > 0 && secFromCfg.MyEnhancedDocuments[0].Type != 0; - bool secCanPaste = false; - if (!secToIsEnhanced && !secToIsSource && !secFromIsEnhanced && !secFromIsSource) secCanPaste = true; // 1) - else if (secToIsSource && !secFromIsEnhanced && !secFromIsSource) // 2) - { - secCanPaste = true; - okToReplace = false; - } - else if (secToIsSource && iiPasteHere.MyDocVersion.VersionID == iiClipboard.MyDocVersion.VersionID) - { - secCanPaste = true; // 3) - okToReplace = false; - } - else if (!secToIsSource && secFromIsSource) - { - secCanPaste = true; // 4 - okToReplace = false; - } - if (iiClipboard.IsRtfRaw) secCanPaste = okToReplace = false; // never paste an equation. - if (secCanPaste) cm.MenuItems.Add("Paste Section Before", new EventHandler(mi_Click)); - if (okToReplace && secCanPaste) cm.MenuItems.Add("Replace Existing Section", new EventHandler(mi_Click)); - if (secCanPaste) cm.MenuItems.Add("Paste Section After", new EventHandler(mi_Click)); - if (si.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections && iiPasteHere.IsStepSection && iiClipboard.IsStepSection) - { - // only paste a subsection if the paste here is an empty section or has - // subsections. - if (!iiClipboard.IsRtfRaw && (iiPasteHere.Sections == null || iiPasteHere.Sections.Count > 0)) - cm.MenuItems.Add("Paste Subsection", new EventHandler(mi_Click)); - } - } - #endregion - #region Menu_Paste_ToSectionFromStep - else if (iiPasteHere.IsStepSection && iiClipboard.IsStep) - { - // In order to paste a step into a section: NOTE that an 'enhanced' step cannot be in paste buffer! - // 1) 'to' & 'from' both 'non', i.e. Neither can have enhanced config data (be source or enhanced) - // can do - // 2) 'to' section is 'source' and 'from' step is 'non' (has no MyEnhancedDocuments) - // can do - // 3) 'to' section is 'source' and 'from' section is same source - SectionConfig secToCfg = iiPasteHere.MyConfig as SectionConfig; - StepConfig stpFromCfg = iiClipboard.MyConfig as StepConfig; - bool secToIsEnhanced = iiPasteHere.IsEnhancedSection; - bool secToIsSource = secToCfg.MyEnhancedDocuments != null && secToCfg.MyEnhancedDocuments.Count > 0 && secToCfg.MyEnhancedDocuments[0].Type != 0; - bool stpFromIsEnhanced = iiClipboard.IsEnhancedStep; - bool stpFromIsSource = stpFromCfg.MyEnhancedDocuments != null && stpFromCfg.MyEnhancedDocuments.Count > 0 && stpFromCfg.MyEnhancedDocuments[0].Type != 0; - bool stpCanPaste = false; - if (!secToIsEnhanced && !secToIsSource && !stpFromIsEnhanced && !stpFromIsSource) stpCanPaste = true; // 1) - else if (secToIsSource && !stpFromIsEnhanced && !stpFromIsSource) stpCanPaste = true; // 2) - else if (secToIsSource && iiPasteHere.MyDocVersion.VersionID == iiClipboard.MyDocVersion.VersionID) stpCanPaste = true; // 3) - if (iiClipboard.IsRtfRaw) stpCanPaste = false; // never paste an equation. - if (stpCanPaste) cm.MenuItems.Add("Paste Step", new EventHandler(mi_Click)); - } - #endregion - #region Menu_Paste_ToStepFromStep - else if (iiPasteHere.IsStep && iiClipboard.IsStep) - { - // Enhanced considerations, in order to paste a step around another step: NOTE that an 'enhanced' section cannot be in paste buffer! - // 1) 'to' & 'from' both 'non', i.e. Neither can have enhanced config data (be source or enhanced) - // can do Before/After/Replace - // 2) 'to' step is 'source' and 'from' step is 'non' (has no MyEnhancedDocuments) - // can do Before/After - no links exist in pasted step, treat like an insert.. - // cannot do Replace - // 3) 'to' step is 'source' and 'from' step is same docversion 'source' - // can do Before/After/Replace (Note that replace is not allowed per B2017-183) - StepConfig stpToCfg = iiPasteHere.MyConfig as StepConfig; - StepConfig stpFromCfg = iiClipboard.MyConfig as StepConfig; - - bool stpToIsEnhanced = iiPasteHere.IsEnhancedStep; - bool stpToIsSource = stpToCfg.MyEnhancedDocuments != null && stpToCfg.MyEnhancedDocuments.Count > 0 && stpToCfg.MyEnhancedDocuments[0].Type != 0; - bool stpFromIsEnhanced = iiClipboard.IsEnhancedStep; - bool stpFromIsSource = stpFromCfg.MyEnhancedDocuments != null && stpFromCfg.MyEnhancedDocuments.Count > 0 && stpFromCfg.MyEnhancedDocuments[0].Type != 0; - bool stpCanPaste = false; - if (!stpToIsEnhanced && !stpToIsSource && !stpFromIsEnhanced && !stpFromIsSource) stpCanPaste = true; // 1) - else if (stpToIsSource && !stpFromIsEnhanced && !stpFromIsSource) // 2) - { - stpCanPaste = true; - okToReplace = false; - } - else if (stpToIsSource && iiPasteHere.MyDocVersion.VersionID == iiClipboard.MyDocVersion.VersionID) // 3 - { - stpCanPaste = true; - if (stpFromIsSource) okToReplace = false; // B2017-183: don't allow a replace to source steps - } - if (iiClipboard.IsRtfRaw) stpCanPaste = false; // never paste an equation. - if (stpCanPaste && AddToInsertMenu(iiPasteHere, 0)) cm.MenuItems.Add("Paste Step Before", new EventHandler(mi_Click)); - if (stpCanPaste && okToReplace) cm.MenuItems.Add("Replace Existing Step", new EventHandler(mi_Click)); - if (stpCanPaste && AddToInsertMenu(iiPasteHere, 1)) cm.MenuItems.Add("Paste Step After", new EventHandler(mi_Click)); - } - #endregion - } - } - } - #endregion menupaste - } - //jcb multiunit - void miMultiUnit_Click(object sender, EventArgs e) - { - MenuItem mi = sender as MenuItem; - MenuItem mip = mi.Parent as MenuItem; - switch (mip.Text) - { - case "Print": - OnPrintProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); - break; - case "Quick Print": - OnQPrintProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); - break; - case "Print Section": - OnPrintSection(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); - break; - case "Quick Print Section": - OnQPrintSection(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); - break; - case "Print All Procedures for": - OnPrintAllProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); - break; - case "Approve": - OnApproveProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); - break; - case "Approve All Procedures for": - OnApproveAllProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); - break; - case "Approve Some Procedures for": - OnApproveSomeProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); - break; - case "Create Continuous Action Summary": - OnCreateContinuousActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); - break; - case "Create Time Critical Action Summary": - OnCreateTimeCriticalActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); - break; - case "Print All Approved Procedures for": //C2025-017 print all approved procedures - OnPrintAllApprovedProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); - break; - default: - if (mip.Text.StartsWith("Showing Change Bars Starting")) - OnSelectDateToStartChangeBars(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - else - FlexibleMessageBox.Show(string.Format("Unrecognized Menu Item '{0}'", mip.Text)); - break; - } - } - //end jcb multiunit - private bool CheckForValidEnhLink(ItemInfo prc) // Check if this procedure has valid link - { - EnhancedDocuments eds = prc.GetMyEnhancedDocuments(); - foreach (EnhancedDocument ed in eds) // only unlink those that are selected - { - ItemInfo lprc = ItemInfo.Get(ed.ItemID); - EnhancedDocuments edsl = lprc.GetMyEnhancedDocuments(); - foreach (EnhancedDocument edl in edsl) if (edl.ItemID == prc.ItemID) return true; - } - return false; - } - // B2022-049: Copy/paste of enhanced procedure and bad links between source and enhanced - // Handle menu selection for unlinking the source/enhanced OR if not valid links, just the procedure selected - void miEnhanced_Click(object sender, EventArgs e) - { - MenuItem mi = sender as MenuItem; - VETreeNode tnprc = SelectedNode as VETreeNode; - ItemInfo selprc = tnprc.VEObject as ItemInfo; - EnhancedDocuments seleds = selprc.GetMyEnhancedDocuments(); - // if tag on menu = -1, it is a single document, no need to loop. This can be from either the source or enhanced. - if ((int)mi.Tag == -1) - { - bool hasValidConnectingProc = CheckForValidEnhLink(selprc); - if (FlexibleMessageBox.Show(this, "Do you want to unlink the Enhanced procedure from its Source?", "Confirm Procedure Unlink", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) - { - if (selprc.IsEnhancedProcedure) - { - selprc.DoUnlinkEnhanced(selprc, 0, !hasValidConnectingProc); // if no valid linked: enhtype = 0 since this an enhanced doc is getting unlinked - } - else // from source - { - // if valid connection, make call from the linked enhanced, otherwise just unlink the source only - if (hasValidConnectingProc) - { - ItemInfo lprc = ItemInfo.Get(seleds[0].ItemID); - lprc.DoUnlinkEnhanced(lprc, 0, !hasValidConnectingProc); - } - else - selprc.DoUnlinkEnhanced(selprc, seleds[0].Type, !hasValidConnectingProc); - } - } - } - else - { - // The following code is run if selection made from source. There may be moore than one enhanced, for example background - // and deviation - if (FlexibleMessageBox.Show(this, "Do you want to unlink the selected Enhanced procedure(s) from the Source procedure?", "Confirm Procedure Unlink", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) - { - int k = 1; - foreach (EnhancedDocument ed in seleds) // only unlink those that are selected - { - if (k == (int)mi.Tag || (int)mi.Tag == 0) - { - ItemInfo lprc = ItemInfo.Get(ed.ItemID); - bool hasValidConnectingProc = CheckForValidEnhLink(lprc); - // if there is a valid connection, unlink both. Otherwise, just unlink this selected procedure. - if (hasValidConnectingProc) - lprc.DoUnlinkEnhanced(lprc, ed.Type, !hasValidConnectingProc); - else - selprc.DoUnlinkEnhanced(selprc, ed.Type, !hasValidConnectingProc); - } - k++; - } - } - - } - } - void mi_Click(object sender, EventArgs e) - { - MenuItem mi = sender as MenuItem; - if (mi == null) - return; - // B2019-076: make folder/working draft level proc set specific info consistent (various places in this file were changed from Folder Specific & Working Draft Specific) - if (mi.Text == "Procedure Set Specific Information" || mi.Text == "Folder Specific Information") // C2020-008: change to 'Folder' - { - VETreeNode tn = SelectedNode as VETreeNode; - OnNodeSI(this, new vlnTreeEventArgs(tn, null, 0)); - return; - } - if (mi.Text.StartsWith("Collapse")) - { - CollapseProcedures(); - return; - } - if (mi.Text == "Print Transition Report") - { - OnPrintTransitionReport(this, new vlnTreeEventArgs(SelectedNode as VETreeNode)); - return; - } - if (mi.Text == "Export Procedure Set" || mi.Text == "Export Procedure") - { - OnExportImportProcedureSets(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - return; - } - if (mi.Text == "Import Procedure Set" || mi.Text == "Import Procedure") - { - OnExportImportProcedureSets(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 1)); - return; - } - if (mi.Text.StartsWith("Procedure Checked Out to") || mi.Text.StartsWith("Document Checked Out to")) - { - OnProcedureCheckedOutTo(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - return; - } - switch (mi.Text) - { - case "Print Section": - VETreeNode tn2 = SelectedNode as VETreeNode; - OnPrintSection(this, new vlnTreeEventArgs(tn2 as VETreeNode, null, 0)); - break; - case "Quick Print Section": - VETreeNode tn2qp = SelectedNode as VETreeNode; - OnQPrintSection(this, new vlnTreeEventArgs(tn2qp as VETreeNode, null, 0)); - break; - case "Open": - OpenNode(); - break; - case "Insert Folder Before": - tv_NodeNew(MenuSelections.FolderBefore); - break; - case "Insert Folder After": - tv_NodeNew(MenuSelections.FolderAfter); - break; - case "New Folder": - SelectedNode.Expand(); - tv_NodeNew(MenuSelections.Folder); - break; - case "Create Working Draft": - SelectedNode.Expand(); - tv_NodeNew(MenuSelections.DocVersion); - break; - case "New Procedure": - SelectedNode.Expand(); - tv_NodeNew(MenuSelections.Procedure); - break; - case "Insert Procedure Before": - tv_NodeNew(MenuSelections.ProcedureBefore); - break; - case "Insert Procedure After": - tv_NodeNew(MenuSelections.ProcedureAfter); - break; - case "Remove Change Ids": - tv_RemoveChgIds(); - break; - case "New Section": - case "New Subsection": - SelectedNode.Expand(); - tv_NodeNew(MenuSelections.Section); - break; - case "Insert Section Before": - tv_NodeNew(MenuSelections.SectionBefore); - break; - case "Insert Section After": - tv_NodeNew(MenuSelections.SectionAfter); - break; - case "Insert Step Before": - tv_NodeNew(MenuSelections.StepBefore); - break; - case "Insert Step After": - tv_NodeNew(MenuSelections.StepAfter); - break; - case "New Step": - SelectedNode.Expand(); - tv_NodeNew(MenuSelections.Step); - break; - case "Copy"://Copy the selected node - tv_NodeCopy(); - break; - // lots of paste options: - case "Paste Procedure": - case "Paste Procedure Before": - case "Paste Procedure After": - case "Paste Section": - case "Paste Section Before": - case "Paste Section After": - case "Paste Step": - case "Paste Step Before": - case "Replace Existing Step": - case "Paste Step After": - case "Paste Subsection": - tv_NodePaste(mi.Text); - break; - case "Replace Existing Section": - //C2025-032 - Add check if user is sure want to paste replace section - DialogResult ovewriteExPS = FlexibleMessageBox.Show("This will overwrite the selected section with the one you copied, would you like to overwrite it?\r\n\r\nSelecting 'Cancel' will cancel the paste action.", "Overwrite the section?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); - - if (ovewriteExPS == DialogResult.Cancel) break; - else - { - tv_NodePaste(mi.Text); - break; - } - case "Replace Existing Procedure": - DialogResult ovewriteEx = FlexibleMessageBox.Show("This will overwrite the selected procedure with the one you copied, would you like to overwrite it?\r\n\r\nSelecting 'Cancel' will cancel the paste action.", "Overwrite the procedure?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);// == DialogResult.Yes; - - if (ovewriteEx == DialogResult.Cancel) break; - else - { - TreeNode treenodeDirectory = SelectedNode.Parent; - tv_NodePaste(mi.Text); - break; - } - - - case "Delete": - if (tv_NodeDelete()) - { - TreeNode myParent = SelectedNode.Parent; - SelectedNode.Remove(); - SelectedNode = myParent; - OnNodeSelect(this, new vlnTreeEventArgs(SelectedNode)); - } - break; - case "Incoming Transitions": // C2020-033: Support the menu item to bring up Search/Incoming Transitions panel - VETreeNode tnx = SelectedNode as VETreeNode; - ItemInfo iii = tnx.VEObject as ItemInfo; - if (iii != null) - { - this.Cursor = Cursors.WaitCursor; // B2023-103 add spinner when searching for incoming transitions - OnSearchIncTransIn(this, new vlnTreeItemInfoEventArgs(iii)); - this.Cursor = Cursors.Default; - } - break; - case "Properties..."://Show the properties for the selected node - SetLastValues((VETreeNode)SelectedNode); - SetupNodeProperties(); - break; - case "Procedure Specific Information": - VETreeNode tn = SelectedNode as VETreeNode; - ProcedureInfo pi = tn.VEObject as ProcedureInfo; - if (pi != null) - { - using (Procedure proc = pi.Get()) - { - OnNodePSI(this, new vlnTreeEventArgs(tn, null, 0)); - } - } - break; - case "Print": - OnPrintProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - break; - case "Quick Print": - OnQPrintProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - break; - case "Print All Procedures": - OnPrintAllProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - break; - case "Approve": - OnApproveProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - break; - case "Approve All Procedures": - OnApproveAllProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - break; - case "Approve Some Procedures": - OnApproveSomeProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - break; - case "Report All Procedures Inconsistencies": - OnReportAllProceduresInconsistencies(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - break; - case "Refresh Checked Out Procedures": - OnRefreshCheckedOutProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - break; - case "Run RO Editor": - RunROEditor(SelectedNode as VETreeNode); - break; - case "Update RO Values": - UpdateROValues(SelectedNode as VETreeNode); - break; - case "Create Continuous Action Summary": - OnCreateContinuousActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - break; - // F2022-024 Time Critical Action Summary - case "Create Time Critical Action Summary": - OnCreateTimeCriticalActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - break; - // B2017-243 added the following two Cannot Paste items when dealing with enhanced documents - // when then user selects these menu items a message box will appear giving more information as to why it cannot be pasted - case "CANNOT PASTE HERE. Click for more information...": - FlexibleMessageBox.Show("You have copied a document that is linked to an Enhanced Document.\n\n" + - "It can only be pasted before or after another document, within the set, that is linked to an Enhanced Document.", "Cannot Paste Here"); - break; - case "CANNOT PASTE HERE, Click for more information...": - // B2024-028 clarify message - FlexibleMessageBox.Show("You have copied a document that is NOT linked to an Enhanced Document.\n\n" + - "You cannot paste a Non-Enhanced Procedure into an Enhanced Procedure Set.", "Cannot Paste Here"); - break; - //case "Check Out Procedure Set": - // CheckOutDocVersion(SelectedNode as VETreeNode); - // break; - //case "Check In Procedure Set": - // CheckInDocVersion(SelectedNode as VETreeNode); - // break; - case "Print All Approved Procedures": //C2025-017 print all approved procedures - OnPrintAllApprovedProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - break; - //C2021-035 Add Refresh Tree Option at highest level - case "Refresh Tree": - RefreshTree(); - break; - default: - if (mi.Text.StartsWith("Showing Change Bars Starting")) - OnSelectDateToStartChangeBars(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); - else - FlexibleMessageBox.Show(string.Format("Unrecognized Menu Item '{0}'", mi.Text)); - break; - } - } - - //C2025-024 Electronic Procedures - Phase 2 (PROMS XML output) - // Handles clicking of items in the context menu - // for exporting Electronic Procedures - // tag will be of format: - // {EP Annotation Type ID},{Unit} - // if not multi-unit, unit will be zero. - void miEP_Click(object sender, EventArgs e) - { - MenuItem mi = sender as MenuItem; - int annTypeid = int.Parse(((string)mi.Tag).Split(',')[0]); - int unit = int.Parse(((string)mi.Tag).Split(',')[1]); - if (unit == 0) - OnExportImportProcedureSets(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, annTypeid)); - else - OnExportImportProcedureSets(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, "", unit, annTypeid)); - } - private bool _doingCollapseNode = false; // B2016-058 when collapse is done, it always calls the drag node event which doesn't appear to be needed - private void CollapseProcedures() - { - CollapseProcedures(SelectedNode as VETreeNode); - } - private void CollapseProcedures(VETreeNode tn) - { - if (tn == null) return; - if (!tn.IsExpanded) return; - if (tn.VEObject.GetType() == typeof(ProcedureInfo)) - { - tn.Collapse(); - _doingCollapseNode = true; // B2016-058 this will prevent a Drag Node error when collapsing an RNOs, Cautions, or Notes tree node - return; - } - foreach (VETreeNode tnc in tn.Nodes) - CollapseProcedures(tnc); - if (tn.VEObject as DocVersionInfo == null && tn.VEObject as FolderInfo == null) - tn.Collapse(); - _doingCollapseNode = true; // B2016-058 this will prevent a Drag Node error when collapsing an RNOs, Cautions, or Notes tree node - } - private void tv_RemoveChgIds() - { - //Console.WriteLine("HERE"); // add code/query to clear change ids in config. - } - private Dictionary MyCheckedOutDocVersions; - private void CheckInDocVersion(VETreeNode tn) - { - DocVersionInfo MyDVI = tn.VEObject as DocVersionInfo; - MySessionInfo.CheckInItem(MyCheckedOutDocVersions[MyDVI.VersionID]); - MyCheckedOutDocVersions.Remove(MyDVI.VersionID); - } - - private void UpdateROValues(VETreeNode tn) - { - InitialProgressBarMessage = "Updating ROs"; - DocVersionInfo MyDVI = tn.VEObject as DocVersionInfo; - // use rodb directory path of the first rofst for the this document version. Later, will need - // to modify code to get which one (when there is more than one) - if (MyDVI.DocVersionAssociations.Count < 1) - { - FlexibleMessageBox.Show("Error Updating ro.fst. No associated ro.fst", "No ROs associated"); //B2017-125 added title to messagebox - FinalProgressBarMessage = "No ROs associated"; - return; - } - ROFstInfo roFstInfo = MyDVI.DocVersionAssociations[0].MyROFst; - string rofstPath = roFstInfo.MyRODb.FolderPath + @"\ro.fst"; - if (!File.Exists(rofstPath)) - { - FlexibleMessageBox.Show("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path", "No existing RO.FST"); //B2017-125 added title to messagebox - FinalProgressBarMessage = "No existing RO.FST"; - return; - } - FileInfo fiRofst = new FileInfo(rofstPath); - if (roFstInfo.DTS == fiRofst.LastWriteTimeUtc) - { - FlexibleMessageBox.Show("ro.fst files are same for path " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done", "RO.FST up to date"); //B2017-125 added title to messagebox - FinalProgressBarMessage = "RO.FST up to date"; - return; - } - if (roFstInfo.DTS > fiRofst.LastWriteTimeUtc) - { - FlexibleMessageBox.Show("Cannot copy older ro.fst from " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done", "Older RO.FST"); //B2017-125 added title to messagebox - FinalProgressBarMessage = "Older RO.FST"; - return; - } - string message = string.Empty; - if (!MySessionInfo.CanCheckOutItem(MyDVI.VersionID, CheckOutType.DocVersion, ref message)) - { - FlexibleMessageBox.Show(this, message, "Working Draft Has Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - FinalProgressBarMessage = "Cannot check-out Working Draft"; - return; - } - Cursor = Cursors.WaitCursor; // C2023-002: move wait cursor after check out error - int ownerid = MySessionInfo.CheckOutItem(MyDVI.VersionID, CheckOutType.DocVersion); - - //must get id before ROFST gets updated so know what to refresh later - int origfstid = roFstInfo.ROFstID; - - using (DocVersion dv = DocVersion.Get(MyDVI.VersionID)) - { - swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(MyDVI)); // RO changes placed in file in the Documents\VEPROMS folder - // B2022-026 RO Memory Reduction code - first load the new ro.fst so that we can assign the ROTableUpdate event to the correct roFstInfo - if (dv.ROfstLoadingFigures || dv.NewerRoFst) // B2017-125 see if loading figures was completed - { - // only load the RO.fst - ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh); - roFstInfo = MyDVI.DocVersionAssociations[0].MyROFst; - } - else if (!dv.ROfstLastCompleted && origfstid == roFstInfo.ROFstID) - { - //Handle issue where load failed without completing update - //previous RO FST did not load, get last loaded ID - //if none, use -1 which will check all ROs in the Working Draft - string cfg = dv.DocVersionAssociations[0].Config; - AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "" : cfg); - if (dv.DocVersionAssociations[0]?.MyROFst != null) - { - if (!int.TryParse(ac.ROUpdate_PrevROFSTID, out origfstid)) - { - origfstid = -1; - } - } - else - { - origfstid = -1; - } - } - - roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); - ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file - ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, null, roFstInfo, origfstid, roFstInfo.ROFstID); - swROUpdate.Close(); - ContentInfo.StaticContentInfoChange -= ContentInfo_StaticContentInfoChange; - roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); - OnTabDisplay(this, new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST")); - } - MySessionInfo.CheckInItem(ownerid); - Cursor = Cursors.Default; - FinalProgressBarMessage = "ROs values updated"; - } - - private System.IO.StreamWriter swROUpdate; - // write the RO reference changes to a text file, include the old/new text, location, and the itemid of the step element - void ContentInfo_StaticContentInfoChange(object sender, StaticContentInfoEventArgs args) - { - if (args.Type == "RO") - swROUpdate.Write(string.Format("Fixed Referenced Object for {1}({4}){0}Old Text: {2}{0}New Text: {3}{0}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue, (sender as ItemInfo).ItemID)); - } - - private ProgressBarItem _ProgressBar = null; - public ProgressBarItem ProgressBar - { - get { return _ProgressBar; } - set { _ProgressBar = value; } - } - private void DoProgressBarRefresh(int value, int max, string text) - { - if (ProgressBar == null) return; - ProgressBar.Maximum = max; - ProgressBar.Value = value; - ProgressBar.Text = text; - Application.DoEvents(); - } - private string InitialProgressBarMessage - { - set - { - if (ProgressBar == null) return; - ProgressBar.Value = 0; - ProgressBar.Maximum = 100; - ProgressBar.Text = value; - Application.DoEvents(); - } - } - private string FinalProgressBarMessage - { - set - { - if (ProgressBar == null) return; - ProgressBar.Text = value; - ProgressBar.Maximum = 100; - ProgressBar.Value = 100; - Application.DoEvents(); - } - } - public List roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args) - { - return VlnFlexGrid.ROTableUpdate(sender, args); - //string xml = null; - //string srchtxt = null; - //using (VlnFlexGrid myGrid = new VlnFlexGrid()) - //{ - // using (StringReader sr = new StringReader(args.OldGridXml)) - // { - // myGrid.ReadXml(sr); - // myGrid.KeyActionTab = C1.Win.C1FlexGrid.KeyActionEnum.MoveAcross; - // sr.Close(); - // } - // string roid = myGrid.ROID; - // int rodbid = myGrid.RODbId; - // Font GridFont = myGrid.Font; - // myGrid.Clear(); - // myGrid.ParseTableFromText(args.ROText, GridLinePattern.Single); - // myGrid.AutoSizeCols(); - // myGrid.AutoSizeRows(); - // myGrid.MakeRTFcells(); - // myGrid.RODbId = rodbid; - // myGrid.ROID = roid; - // myGrid.IsRoTable = true; - // using (StringWriter sw = new StringWriter()) - // { - // myGrid.WriteXml(sw); - // xml = sw.GetStringBuilder().ToString(); - // sw.Close(); - // } - // srchtxt = myGrid.GetSearchableText(); - //} - //List retlist = new List(); - //retlist.Add(srchtxt); - //retlist.Add(xml); - //return retlist; - } - - private void RunROEditor(VETreeNode tn) - { - DocVersionInfo MyDVI = tn.VEObject as DocVersionInfo; - if (VlnSettings.ReleaseMode.Equals("DEMO")) - { - FlexibleMessageBox.Show("Referenced Object Editor not available in the Demo version.", "PROMS Demo Version"); - return; - } - //string roapp = Environment.GetEnvironmentVariable("roapp"); - string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable - if (roapp == null || roapp == string.Empty) - { - FlexibleMessageBox.Show("The 'roapp' environment variable needs to be set to the path of the RO Editor\n\n Ex: C:\\VE-PROMS.NET\\Bin\\roeditor.exe", "Environment Variable Error"); - return; - } - if (!File.Exists(roapp)) - { - string errtxt = string.Format("Could not find path to Referenced Objects Editor:\n\n roapp = {0}\n\n Verify the path assigned to the 'roapp' environment variable", roapp); - FlexibleMessageBox.Show(errtxt, "Environment Variable Error"); - //MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable","Environment Variable Error"); - return; - } - //if (roapp == null) - //{ - // MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable"); - // return; - //} - if (MyDVI == null || MyDVI.DocVersionAssociationCount < 1) - { - FlexibleMessageBox.Show("Could not find associated path for ro data.", "No RO Data", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\""; - if (!Directory.Exists(MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath)) - { - FlexibleMessageBox.Show(string.Format("RO Database directory does not exist: {0}", MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath)); - return; - } - // C2017-003: ro data in sql server, check for sql connection string - if (MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString != "cstring") - roloc = roloc + " \"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.DBConnectionString + "\""; - // C2021-026 pass in Parent/Child information (list of the children) - // B2022-019 look at all DocVersions to find ParentChild information - // to ensure we pass in Parent/Child even when not coming from a Parent/Child procedure set - // B2022-073 Break out of the foreach when we find a set with parent/child information - DocVersionInfoList dvil = DocVersionInfoList.Get(); - foreach (DocVersionInfo dvi in dvil) - { - DocVersionConfig dvc = dvi.DocVersionConfig as 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 - { - roloc += " \"PC=" + dvc.Unit_Name + "\""; - break; - } - } - System.Diagnostics.Process.Start(roapp, roloc); - } - - [Serializable] - public struct PromsClipboard - { - public int cType; - public int itemId; - } - public enum PromsClipboardType : int - { - Copy = 1, Cut = 2 - } - private void tv_NodePaste(string p) - { - ItemInfo iiClipboard = OnClipboardStatus(this, null); - if (iiClipboard == null) return; - string message = string.Empty; - if (iiClipboard.MyContent.MyEntry == null) - { - if (!MySessionInfo.CanCheckOutItem(iiClipboard.MyProcedure.ItemID, CheckOutType.Procedure, ref message)) - { - FlexibleMessageBox.Show(this, message, "Copied Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return; - } - } - else - { - if (!MySessionInfo.CanCheckOutItem(iiClipboard.MyContent.MyEntry.DocID, CheckOutType.Document, ref message)) - { - FlexibleMessageBox.Show(this, message, "Copied Document Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return; - } - } - VETreeNode tn = SelectedNode as VETreeNode; - - DocVersionInfo dvi = tn.VEObject as DocVersionInfo; - // Check for paste into a docversion - queries/code is different than paste related to an item (into a proc or section) - if (dvi != null) - { - // If the docversion has procedures (children), change to a 'paste-after the last procedure'. - if (tn.Nodes.Count > 0) - { - // if the node count is 1, children may not have been loaded yet - load if necessary: - if (tn.Nodes.Count == 1 && tn.Nodes[0].Text.ToUpper().Contains("DUMMY VETREENODE")) - tn.LoadChildren(); - - // assume that item to paste is a procedure, otherwise the menuing would not have - // included the paste options - tn = (VETreeNode)tn.Nodes[tn.Nodes.Count - 1]; - p = "After"; - } - else // this is an empty docversion: - { - // First check if the doc version has RO's - // Paste as a child to the doc version: - this.Cursor = Cursors.WaitCursor; - PasteAsDocVersionChild(tn, iiClipboard.ItemID); - this.Cursor = Cursors.Default; - return; - } - } - - ItemInfo iiPaste = tn.VEObject as ItemInfo; - if (iiPaste == null) return; - this.Cursor = Cursors.WaitCursor; - if (p.IndexOf("Before") > -1) - PasteBeforeOrAfter(MenuSelections.StepBefore, tn, iiClipboard.ItemID); - else if (p.IndexOf("After") > -1) - PasteBeforeOrAfter(MenuSelections.StepAfter, tn, iiClipboard.ItemID); - else if (p.IndexOf("Replace") > -1) - { - bool OnlyProc = iiPaste.IsProcedure && iiPaste.MyPrevious == null && (iiPaste.NextItems == null || iiPaste.NextItems.Count == 0); - VETreeNode tmp = null; - if (OnlyProc) - { - VETreeNode tnp = SelectedNode as VETreeNode; - tmp = tnp == null ? null : tnp.Parent as VETreeNode; - } - ItemInfo repitem = PasteReplace(tn, iiClipboard.ItemID); - // B2024-045, 049 and 050: The treenode was passed into the business object's replace but sometimes it was null. And this - // wasn't working if it was a single procedure in a working Draft. Adjust the tree here if single procedure in working draft. - if (OnlyProc && repitem != null && tmp != null) - { - VETreeNode tn1 = new VETreeNode(repitem); - tmp.Nodes.Add(tn1); - SelectedNode = tn1; - } - } - else // paste as child - PasteAsChild(tn, iiClipboard.ItemID); - - - //if (p.IndexOf("Replace") <= -1) - this.Cursor = Cursors.Default; - } - - public void PasteAsDocVersionChild(VETreeNode tn, int copyStartID) - { - // Only need to handle paste in tree since this will create a new procedure. - DocVersionInfo dvi = tn.VEObject as DocVersionInfo; - if (dvi.DocVersionAssociationCount == 0) - { - // Set docversionassociation to the copied docversion association - // so that the rofst for ro's can be found. (if there is no association set) - ROFstInfo rfi = GetAssociationRofstId(copyStartID); - Association myAs = Association.MakeAssociation(dvi.Get(), rfi.GetJustROFst(), ""); - dvi.RefreshDocVersionAssociations(); - } - ItemInfo newProc = dvi.PasteChild(copyStartID); - VETreeNode tn1 = new VETreeNode(newProc); - SelectedNode.Nodes.Add(tn1); // add tree node to end of list. - SelectedNode = tn1; - } - - private ROFstInfo GetAssociationRofstId(int copyStartID) - { - ItemInfo ii = ItemInfo.Get(copyStartID); - return ii.MyDocVersion.DocVersionAssociations[0].MyROFst; - } - private void PasteAsChild(VETreeNode tn, int copyStartID) - { - bool pasteSectIntoEmptySect = false; - ItemInfo ii = tn.VEObject as ItemInfo; - if (ii.IsStepSection) // is pasting a subsection, need to force a reload of the treeview - { - ItemInfo tmpcopy = ItemInfo.Get(copyStartID); - if (tmpcopy.IsStepSection) pasteSectIntoEmptySect = true; - } - ItemInfo.EAddpingPart pasteOpt = ItemInfo.EAddpingPart.Child; - // If parent step is open in step editor, the 'OnPasteItemInfo' event will cause - // the item to be pasted in the step editor and the tree. - if (!OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, pasteOpt, ii.MyContent.Type))) - { - // The parent step was not open in the step editor, just paste step (in data) and add treenode. - // first, check if a changeid is required. - string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii)); - ItemInfo newItemInfo = null; - newItemInfo = ii.PasteChild(copyStartID, chgId); - if (newItemInfo != null) - { - // paste enhanced steps if applicable (this code is only run if a step is pasted, not for a section). - ItemInfo.EAddpingPart addpart = ItemInfo.EAddpingPart.Child; - ItemInfo newEnhStep = newItemInfo.PasteEnhancedItems(copyStartID, ii, addpart, chgId); - } - } - if (pasteSectIntoEmptySect) - { - tn.ChildrenLoaded = false; // force a reload of treenode - tn.LoadChildren(true); - } - SelectedNode = tn; - } - private void PasteBeforeOrAfter(MenuSelections newtype, VETreeNode tn, int copyStartID) - { - // If paste-from step is open in the editor, use the OnPasteItemInfo to paste the step and add RTBItems - // to the step editor panel. - ItemInfo ii = tn.VEObject as ItemInfo; - ItemInfo.EAddpingPart pasteOpt = newtype == MenuSelections.StepBefore ? ItemInfo.EAddpingPart.Before : ItemInfo.EAddpingPart.After; - // If parent step is open in step editor, the 'OnPasteItemInfo' event will cause - // the item to be pasted in the step editor and the tree. - ItemInfo newItemInfo = null; - // F2021-009 display a message if pasting step will results in more sub-step levels than are defined in the format - if (!ii.IsProcedure) - ItemInfo.PasteStepIsWithinDefinedSubStepLevels(copyStartID, ii, false); - if (ii.IsProcedure || !OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, pasteOpt, ii.MyContent.Type))) - { - // The parent step was not open in the step editor, just paste step (in data) and add treenode. - // first, check if a changeid is required. - string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii)); - if (newtype == MenuSelections.StepBefore) - newItemInfo = ii.PasteSiblingBefore(copyStartID, chgId); - else - newItemInfo = ii.PasteSiblingAfter(copyStartID, chgId); - if (newItemInfo != null) - { - // paste enhanced steps if applicable (this code is only run if a step is pasted, not for a section). - ItemInfo.EAddpingPart addpart = ItemInfo.EAddpingPart.After; - if (newtype == MenuSelections.StepBefore) addpart = ItemInfo.EAddpingPart.Before; - ItemInfo newEnhStep = newItemInfo.PasteEnhancedItems(copyStartID, ii, addpart, chgId); - } - } - SelectedNode = (VETreeNode)((newtype == MenuSelections.StepAfter) ? tn.NextNode : tn.PrevNode); - } - private ItemInfo PasteReplace(VETreeNode tn, int copyStartID) - { - VETreeNode prevtn = (VETreeNode)tn.PrevNode; - VETreeNode partn = (VETreeNode)tn.Parent; - ItemInfo ii = tn.VEObject as ItemInfo; - // F2021-009 display a message if pasting step will results in more sub-step levels than are defined in the format - ItemInfo.PasteStepIsWithinDefinedSubStepLevels(copyStartID, ii, true); - ItemInfo replItemInfo = null; - if (!OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, ItemInfo.EAddpingPart.Replace, ii.MyContent.Type))) - { - // first, check if a changeid is required. - string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii)); - replItemInfo = Item.PasteReplace(ii, copyStartID, chgId); - - StepConfig replItemConfig = ii.MyConfig as StepConfig; - if (replItemInfo != null) - { - ItemInfo newEnhStep = replItemInfo.PasteEnhancedItems(copyStartID, ii, ItemInfo.EAddpingPart.Replace, chgId); - } - } - // B2018-047: was crashing on the following line (before change it was casting the result to a VETreeNote when the partn.FirstNode was just a TreeNode) - SelectedNode = prevtn != null ? prevtn.NextNode : partn.FirstNode; - return replItemInfo; - - } - public void PasteRepalceEmpty(VETreeNode tn, int copyStartID) - { - // Only need to handle paste in tree since this will create a new procedure. - DocVersionInfo dvi = tn.VEObject as DocVersionInfo; - if (dvi.DocVersionAssociationCount == 0) - { - // Set docversionassociation to the copied docversion association - // so that the rofst for ro's can be found. (if there is no association set) - ROFstInfo rfi = GetAssociationRofstId(copyStartID); - Association myAs = Association.MakeAssociation(dvi.Get(), rfi.GetJustROFst(), ""); - dvi.RefreshDocVersionAssociations(); - } - ItemInfo newProc = dvi.PasteChild(copyStartID); - VETreeNode tn1 = new VETreeNode(newProc); - SelectedNode.Nodes.Add(tn1); // add tree node to end of list. - SelectedNode = tn1; - } - private void tv_NodeCopy() - { - if (SelectedNode == null) return; - VETreeNode tn = SelectedNode as VETreeNode; - OnNodeCopy(this, new vlnTreeEventArgs(tn)); - } - - #endregion - #region PropertyPagesInterface - private void SetupNodeProperties() - { - VETreeNode tn = SelectedNode as VETreeNode; - if (tn == null) return; - - if ((tn.VEObject as FolderInfo) != null) - OpenProperties(tn.VEObject as FolderInfo); - else if ((tn.VEObject as DocVersionInfo) != null) - { - // see if rofst is changed, if so, need to refresh any step panel values. - int rofstid = 0; - DocVersionInfo dvi = tn.VEObject as DocVersionInfo; - if (dvi != null && dvi.DocVersionAssociations != null && dvi.DocVersionAssociations.Count > 0) rofstid = dvi.DocVersionAssociations[0].MyROFst.ROFstID; - OpenProperties(tn.VEObject as DocVersionInfo); - if (dvi != null && dvi.DocVersionAssociations != null && dvi.DocVersionAssociations.Count > 0 && rofstid != dvi.DocVersionAssociations[0].MyROFst.ROFstID) - OnTabDisplay(this, new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST")); - } - else if ((tn.VEObject as ProcedureInfo) != null) - OpenProperties(tn.VEObject as ProcedureInfo); - else if ((tn.VEObject as SectionInfo) != null) - OpenProperties(tn.VEObject as SectionInfo); - else if ((tn.VEObject as StepInfo) != null) - FlexibleMessageBox.Show("Open up info tab or whatever is associated with step"); - if (!tn.MovedToSeparateWindow) tn.RefreshNode(); // C2015-022 don't want to rebuild tree node in the main window if it is currently in a child window - } - private void OpenProperties(FolderInfo folderInfo) - { - using (Folder folder = folderInfo.Get()) - { - OnNodeOpenProperty(this, new vlnTreePropertyEventArgs(string.Format("{0} Properties", folder.FolderConfig.Name), folder.FolderConfig)); - } - } - private void OpenProperties(DocVersionInfo dvInfo) - { - using (DocVersion dv = dvInfo.Get()) - { - OnNodeOpenProperty(this, new vlnTreePropertyEventArgs(string.Format("{0} Properties", dv.DocVersionConfig.Name), dv.DocVersionConfig)); - } - } - private void OpenProperties(ProcedureInfo procInfo) - { - using (Procedure proc = procInfo.Get()) - { - OnNodeOpenProperty(this, new vlnTreePropertyEventArgs(string.Format("{0} {1} Properties", proc.ProcedureConfig.Number, proc.ProcedureConfig.Title), proc.ProcedureConfig)); - } - } - private void OpenProperties(SectionInfo sectInfo) - { - OnSectionShouldClose(this, new vlnTreeSectionInfoEventArgs(sectInfo)); - using (Section sect = sectInfo.Get()) - { - string title = null; - if (sectInfo.SectionConfig.Number.Length > 0) - title = string.Format("{0} {1} Properties", sectInfo.SectionConfig.Number, sectInfo.SectionConfig.Title); - else - title = string.Format("{0} Properties", sectInfo.SectionConfig.Title); - OnNodeOpenProperty(this, new vlnTreePropertyEventArgs(title, sect.SectionConfig)); - } - } - private void OpenProperties(StepInfo stpinfo) - { - using (Step stp = stpinfo.Get()) - { - } - } - - #endregion - #region OpenNode - private void tv_KeyPress(object sender, KeyPressEventArgs e) - { - if (e.KeyChar == '\r') - { - OpenNode(); - e.Handled = true; - } - } - public void OpenNode() - { - VETreeNode tn = SelectedNode as VETreeNode; - if (tn != null) - { - if (tn.VEObject.GetType() == typeof(FolderInfo) || tn.VEObject.GetType() == typeof(DocVersionInfo) || tn.VEObject.GetType() == typeof(PartInfo)) - { - if (tn.Nodes.Count > 0) - { - tn.Expand(); - SelectedNode = tn.Nodes[0]; - Focus(); - } - } - else - OnNodeSelect(this, new vlnTreeEventArgs(SelectedNode)); - } - } - #endregion - #region InsertAllLevels - public void tv_NodeNew(MenuSelections newtype) - { - VETreeNode tn = null; - if (SelectedNode == null) return; - OnPauseRefresh(this, null); - SetLastValues((VETreeNode)SelectedNode); - - #region InsertFolderOrDocVersion - if (_LastFolderInfo != null) - { - using (Folder parentfolder = _LastFolderInfo.Get()) - { - if (newtype == MenuSelections.DocVersion) - { - int dvid = -1; // flag to allow user to cancel from dialog & then we remove it. - using (DocVersion docversion = DocVersion.MakeDocVersion(parentfolder, "Working Draft", "Title", null, null, null)) - { - ShowBrokenRules(docversion.BrokenRulesCollection); - SetLastValues(DocVersionInfo.Get(docversion.VersionID)); - if (OnNodeOpenProperty(this, new vlnTreePropertyEventArgs("Working Draft", docversion.DocVersionConfig)) == DialogResult.OK) - { - docversion.Save(); - tn = new VETreeNode(_LastDocVersionInfo); - SelectedNode.Nodes.Add(tn); // add tree node to end of list. - parentfolder.Reset_ChildFolders(); - parentfolder.Reset_FolderDocVersions(); - } - else - dvid = docversion.VersionID; - } - if (dvid != -1) DocVersion.Delete(dvid); - } - else if (newtype == MenuSelections.Folder) - { - int f1 = -1; // flag to allow user to cancel from dialog & then we remove it. - string uniquename = _LastFolderInfo.UniqueChildName("New Folder"); - using (Folder folder = Folder.MakeFolder(parentfolder, parentfolder.MyConnection, uniquename, string.Empty, "Short Name", null, string.Empty, DateTime.Now, VlnSettings.UserID)) - { - ShowBrokenRules(folder.BrokenRulesCollection); - FolderInfo fi = FolderInfo.Get(folder.FolderID); - folder.ManualOrder = fi.ManualOrder; - SetLastValues(fi); - if (OnNodeOpenProperty(this, new vlnTreePropertyEventArgs(uniquename, folder.FolderConfig)) == DialogResult.OK) - { - folder.Save(); - tn = new VETreeNode((IVEDrillDownReadOnly)_LastFolderInfo); - SelectedNode.Nodes.Add(tn); // add new tree node to end of childlist. - } - else - f1 = folder.FolderID; - } - if (f1 != -1) Folder.Delete(f1); - } - else if (newtype == MenuSelections.FolderAfter || newtype == MenuSelections.FolderBefore) - { - int f2 = -1; - string uniquename = _LastFolderInfo.MyParent.UniqueChildName("New Folder"); - int myindex = SelectedNode.Index + ((newtype == MenuSelections.FolderAfter) ? 1 : 0); - //B2025-018 Issues with folder order in tree view - //since before/after folder is at same level as current folder - //so need to use the parents order to determine where to place it - using (FolderInfo parfolderinfo = FolderInfo.Get(parentfolder.MyParent.FolderID)) - { - double? myorder = parfolderinfo.NewManualOrder(myindex); - using (Folder folder = Folder.MakeFolder(parentfolder.MyParent, parentfolder.MyConnection, uniquename, string.Empty, "Short Name", null, myorder, string.Empty, DateTime.Now, VlnSettings.UserID)) - { - ShowBrokenRules(folder.BrokenRulesCollection); - SetLastValues(FolderInfo.Get(folder.FolderID)); - if (OnNodeOpenProperty(this, new vlnTreePropertyEventArgs(uniquename, folder.FolderConfig)) == DialogResult.OK) - { - folder.Save(); - tn = new VETreeNode((IVEDrillDownReadOnly)_LastFolderInfo); - if (newtype == MenuSelections.FolderBefore) SelectedNode.Parent.Nodes.Insert(SelectedNode.Index, tn); - if (newtype == MenuSelections.FolderAfter) SelectedNode.Parent.Nodes.Insert(SelectedNode.Index + 1, tn); - } - else - f2 = folder.FolderID; - } - if (f2 != -1) Folder.Delete(f2); - } - } - } - } - #endregion - #region InsertProcedure - else if (newtype == MenuSelections.Procedure) - { - int p1 = -1; - using (Procedure procedure = Procedure.MakeProcedure(_LastDocVersionInfo, _LastDocVersionInfo.Procedures.Count != 0 ? _LastDocVersionInfo.Procedures[_LastDocVersionInfo.Procedures.Count - 1] : null, null, "New Procedure", 0)) - { - ShowBrokenRules(procedure.BrokenRulesCollection); - SetLastValues(ProcedureInfo.Get(procedure.ItemID)); - procedure.ProcedureConfig.CreatingNew = true; - if (OnNodeOpenProperty(this, new vlnTreePropertyEventArgs("New Procedure", procedure.ProcedureConfig)) == DialogResult.OK) - { - procedure.Save(); - tn = new VETreeNode(_LastProcedureInfo); - SelectedNode.Nodes.Add(tn); // add tree node to end of list. - // The following line will allow for a refresh of the procedure list on the Working Draft's treenodes docversion (B2016-034) - if (((SelectedNode as VETreeNode).VEObject as DocVersionInfo) != null) ((SelectedNode as VETreeNode).VEObject as DocVersionInfo).ResetProcedures(); - if (procedure.MyProcedureInfo.CreateEnhanced) - { - procedure.MyProcedureInfo.CreateEnhanced = false; - CreateEnhancedForProcedure(newtype, procedure, null); - } - } - else - p1 = procedure.ItemID; - } - if (p1 != -1) - DeleteItemInfoAndChildren(_LastProcedureInfo);// Delete Item and reset Previous and Next - } - else if (newtype == MenuSelections.ProcedureAfter || newtype == MenuSelections.ProcedureBefore) - { - int p2 = -1; - int tvindex = SelectedNode.Index; - // if inserting before, the parent is set in case previous is null, i.e. beginning of the list. - ProcedureInfo savLastProcedureInfo = _LastProcedureInfo; - using (Procedure procedure = Procedure.MakeProcedure((newtype == MenuSelections.ProcedureAfter) ? null : _LastProcedureInfo.ActiveParent, (newtype == MenuSelections.ProcedureAfter) ? _LastProcedureInfo : _LastProcedureInfo.MyPrevious, null, "New Procedure", 0)) - { - ShowBrokenRules(procedure.BrokenRulesCollection); - SetLastValues(ProcedureInfo.Get(procedure.ItemID)); - procedure.ProcedureConfig.CreatingNew = true; - if (OnNodeOpenProperty(this, new vlnTreePropertyEventArgs("New Procedure", procedure.ProcedureConfig)) == DialogResult.OK) - { - procedure.Save(); - tn = new VETreeNode(_LastProcedureInfo); - TreeNode par = SelectedNode.Parent; - par.Nodes.Insert(tvindex + ((newtype == MenuSelections.ProcedureBefore) ? 0 : 1), tn); - // The following line will allow for a refresh of the procedure list on the Working Draft's treenodes docversion (B2016-034) - if (((par as VETreeNode).VEObject as DocVersionInfo) != null) ((par as VETreeNode).VEObject as DocVersionInfo).ResetProcedures(); - if (procedure.MyProcedureInfo.CreateEnhanced) - { - procedure.MyProcedureInfo.CreateEnhanced = false; - CreateEnhancedForProcedure(newtype, procedure, savLastProcedureInfo); - } - } - else - p2 = procedure.ItemID; - } - if (p2 != -1) - DeleteItemInfoAndChildren(_LastProcedureInfo); // Delete Item and reset Previous and Next - } - #endregion - #region InsertSection - else if (newtype == MenuSelections.Section) // Insert subsection at end of parents section list - { - string message = string.Empty; - if (_LastProcedureInfo != null) - if (!MySessionInfo.CanCheckOutItem(_LastProcedureInfo.ItemID, CheckOutType.Procedure, ref message)) - { - FlexibleMessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - OnUnPauseRefresh(this, null); - return; - } - int s1 = -1; - if (!(_LastProcedureInfo == null) || !(_LastSectionInfo == null)) - { - // May need to create 'pseudo' nodes, for the 'Steps' and 'Sections' grouping tree nodes. - // If no grouping nodes exist off a section (we are adding a subsection), then - // add a 'pseudo' node. - // If step(s) exists, but not a section, then need 'pseudo' nodes, i.e. 'Steps' and 'Sections' - // tree nodes. - // Otherwise, the 'Sections' pseudo node will exist. - // Note that this check has to be done before the section is made, otherwise the item will - // have sections, i.e. the one getting added. - bool doPseudo = false; - if (_LastItemInfo.IsSection) // if adding off of a procedure, don't add pseudo. - { - // B2017-014: removed code that was adding a 2nd section part node. - if (SelectedNode.Nodes.Count > 0) - { - // if inserting from a section that has steps, but no subsections, prompt user to let them - // know that the steps will not be visible after the subsection insert (C2016-042): - if (_LastItemInfo.Sections == null && _LastItemInfo.Steps != null && _LastItemInfo.Steps.Count > 0) - { - // C2020-016 reformatted and reworded the message. - // C2020-047 reformatted and reworded the message. - string msgstr = - "If there are already steps in the high level section, then PROMS will hide\n" + - "the steps in this section when the subsection is created.\n\n" + - "If you would like to view or copy these hidden steps you will need to go\n" + - "into the properties of this section and check the Editable Data checkbox.\n" + - "You will then be able to view and copy those steps. When finished, open\n" + - "the properties page again and uncheck the Editable Data checkbox.\n\n" + - "Do you want to continue creating the subsection?"; - if (FlexibleMessageBox.Show(this, msgstr, "Subsection Insert", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - } - // Check to see if sections already exist, if so, the pseudo node will too. - bool hasMetaSubs = _LastItemInfo.Sections != null && _LastItemInfo.Sections.Count > 0; - if (!hasMetaSubs) doPseudo = true; - } - } - using (Section section = CreateNewSection()) - { - ShowBrokenRules(section.BrokenRulesCollection); - SectionInfo savLastSectionInfo = _LastSectionInfo; - SetLastValues(SectionInfo.Get(section.ItemID)); - if (OnNodeOpenProperty(this, new vlnTreePropertyEventArgs("New Section", section.SectionConfig)) == DialogResult.OK) - { - if (!doPseudo) - { - tn = new VETreeNode(_LastSectionInfo); - SelectedNode.Nodes.Add(tn); // add tree node to end of list. - // if the new section was flagged as either having an enhanced link for Title or Contents, create the - // Enhanced section: - Section sectiontmp = Section.Get(section.ItemID); // need to do this because of 'caching' problem. - if (sectiontmp.SectionConfig.LinkEnhanced == "T" || sectiontmp.SectionConfig.LinkEnhanced == "Y") - CreateEnhancedForSection(newtype, sectiontmp, savLastSectionInfo, sectiontmp.DisplayNumber, sectiontmp.MyContent.Text); - sectiontmp.Dispose(); - OnNodeSelect(this, new vlnTreeEventArgs(tn)); - } - else - { - // may have to add a 'steps' node if a step(s) already exist... - ItemInfo ii = (SelectedNode as VETreeNode).VEObject as ItemInfo; - int cpindx = 0; - if (SelectedNode.Nodes.Count > 0) - { - VETreeNode vtn = SelectedNode.Nodes[0] as VETreeNode; - // B2017-014: removed code that was adding a 2nd section part node. and also select node to - // refresh display - if (vtn.FirstNode != null) OnNodeSelect(this, new vlnTreeEventArgs(vtn.FirstNode)); - } - // B2017-014: removed code that was adding a 2nd section part node. - } - } - else // Properties was canceled out of: - s1 = section.ItemID; - } - if (s1 != -1) - { - DeleteItemInfoAndChildren(_LastSectionInfo);// Delete Item and reset Previous and Next - // B2020-087 refresh the tree node after canceling the creation of the subsection - _LastTreeNode.ChildrenLoaded = false; - _LastTreeNode.RefreshNode(); - _LastTreeNode.Collapse(); - } - } - } - else if (newtype == MenuSelections.SectionAfter || newtype == MenuSelections.SectionBefore) - { - string message = string.Empty; - if (!MySessionInfo.CanCheckOutItem(_LastSectionInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message)) - { - FlexibleMessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - OnUnPauseRefresh(this, null); - return; - } - int tvindex = SelectedNode.Index; - // if inserting before, the parent is set in case previous is null, i.e. beginning of the list. - int s2 = -1; - using (Section section = Section.MakeSection((newtype == MenuSelections.SectionAfter) ? null : _LastSectionInfo.MyParent, (newtype == MenuSelections.SectionAfter) ? _LastSectionInfo : _LastSectionInfo.MyPrevious, null, "New Section", 10000)) - { - ShowBrokenRules(section.BrokenRulesCollection); - SectionInfo savLastSectionInfo = _LastSectionInfo; - SetLastValues(SectionInfo.Get(section.ItemID)); - TreeNode par = SelectedNode.Parent; - if (OnNodeOpenProperty(this, new vlnTreePropertyEventArgs("New Section", section.SectionConfig)) == DialogResult.OK) - { - int indx = tvindex + ((newtype == MenuSelections.SectionBefore) ? 0 : 1); - int itemido = (indx >= par.Nodes.Count) ? -1 : (((par.Nodes[indx] as VETreeNode).VEObject) as ItemInfo).ItemID; - if (indx >= par.Nodes.Count || (par.Nodes[indx] as VETreeNode).VEObject.ToString() != _LastSectionInfo.ToString() || itemido != section.ItemID) - { - tn = new VETreeNode(_LastSectionInfo); - par.Nodes.Insert(indx, tn); - // if the new section was flagged as either having an enhanced link for Title or Contents, create the - // Enhanced section: - Section sectiontmp = Section.Get(section.ItemID); // need to do this because of 'caching' problem. - if (sectiontmp.SectionConfig.LinkEnhanced == "T" || sectiontmp.SectionConfig.LinkEnhanced == "Y") - CreateEnhancedForSection(newtype, sectiontmp, savLastSectionInfo, sectiontmp.DisplayNumber, sectiontmp.MyContent.Text); - sectiontmp.Dispose(); - } - } - else - s2 = section.ItemID; - } - if (s2 != -1) - { - DeleteItemInfoAndChildren(_LastSectionInfo);// Delete Item and reset Previous and Next - // B2020-087 refresh the tree node after canceling the creation of the subsection - _LastTreeNode.ChildrenLoaded = false; - _LastTreeNode.RefreshNode(); - _LastTreeNode.Collapse(); - } - } - #endregion - #region InsertStep - else if (newtype == MenuSelections.Step) // insert step from section - no substeps from tree. - { - string message = string.Empty; - if (!MySessionInfo.CanCheckOutItem(_LastSectionInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message)) - { - FlexibleMessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - OnUnPauseRefresh(this, null); - return; - } - tn = InsertChildStep((VETreeNode)SelectedNode); - } - else if (newtype == MenuSelections.StepAfter || newtype == MenuSelections.StepBefore && _LastStepInfo != null) - { - string message = string.Empty; - if (!MySessionInfo.CanCheckOutItem(_LastStepInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message)) - { - FlexibleMessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - OnUnPauseRefresh(this, null); - return; - } - tn = InsertBeforeOrAfter(newtype, (VETreeNode)SelectedNode); - } - #endregion - - if (tn != null) - { - SelectedNode = tn; - OnNodeNew(this, new vlnTreeEventArgs(SelectedNode)); - Refresh(); - OnNodeInsert(this, new vlnTreeEventArgs(SelectedNode)); - } - OnUnPauseRefresh(this, null); - } - private void CreateEnhancedForProcedure(MenuSelections typ, Procedure sourceProc, ProcedureInfo lastProcedureInfo) - { - if (typ == MenuSelections.ProcedureAfter || typ == MenuSelections.ProcedureBefore) // new from procedure (before or after) - { - // The procedure that this is inserted from may not have associated enhanced procedures. Going up list, look for a procedure - // that has enhanced. - ItemInfo tmpPI = lastProcedureInfo; - EnhancedDocuments eds = null; - while (eds == null && tmpPI != null) - { - ProcedureConfig pc = tmpPI.MyConfig as ProcedureConfig; - if (pc.MyEnhancedDocuments != null && pc.MyEnhancedDocuments.Count > 0) - { - eds = pc.MyEnhancedDocuments; - break; - } - tmpPI = tmpPI.MyPrevious; - } - if (eds != null) - { - foreach (EnhancedDocument ped in eds) - { - ProcedureInfo epi = ProcedureInfo.Get(ped.ItemID); - using (Procedure newenhProcedure = Procedure.MakeProcedure((typ == MenuSelections.ProcedureAfter) ? null : epi.ActiveParent, (typ == MenuSelections.ProcedureAfter) ? epi : epi.MyPrevious, null, "New Procedure", 0)) - { - SaveEnhancedForProcedure(sourceProc, newenhProcedure, ped.Type); - RefreshRelatedNode(ProcedureInfo.Get(newenhProcedure.ItemID)); - } - } - return; - } - } - // do the following code if insert the procedure from docverion, or if no linked procedure was found above while doing an insert section from before/after - DocVersionConfig dvc = sourceProc.MyProcedureInfo.MyDocVersion.MyConfig as DocVersionConfig; - ProcedureConfig sourcecfg = sourceProc.ProcedureConfig; - if (dvc != null) - { - foreach (DVEnhancedDocument ded in dvc.MyEnhancedDocuments) - { - // get the enhaced docversioninfo: - DocVersionInfo enhDVInfo = DocVersionInfo.Get(ded.VersionID); - using (Procedure newenhProcedure = Procedure.MakeProcedure(enhDVInfo, enhDVInfo.Procedures.Count != 0 ? enhDVInfo.Procedures[enhDVInfo.Procedures.Count - 1] : null, null, "New Procedure", 0)) - { - SaveEnhancedForProcedure(sourceProc, newenhProcedure, ded.Type); - RefreshRelatedNode(ProcedureInfo.Get(newenhProcedure.ItemID)); // this updates the treeview to include the new enhanced procedure - } - } - } - } - private void SaveEnhancedForProcedure(Procedure sourceProc, Procedure newenhProcedure, int enhtype) - { - ProcedureConfig newenhcfg = new ProcedureConfig(newenhProcedure); - newenhcfg.AddEnhancedDocument(0, sourceProc.ItemID); - newenhcfg.SaveEnhancedDocuments(); - using (Content c1 = Content.Get(newenhProcedure.ContentID)) - { - c1.Config = newenhcfg.ToString(); - c1.Save(); - } - sourceProc.ProcedureConfig.AddEnhancedDocument(enhtype, newenhProcedure.ItemID); - sourceProc.ProcedureConfig.SaveEnhancedDocuments(); - using (Content cs = Content.Get(sourceProc.ContentID)) - { - cs.Config = sourceProc.ProcedureConfig.ToString(); - cs.Save(); - } - } - private void CreateEnhancedForSection(MenuSelections typ, Section sourceSect, SectionInfo lastSectionInfo, string num, string title) - { - MenuSelections tmptyp = typ; - if (typ == MenuSelections.SectionAfter || typ == MenuSelections.SectionBefore) - { - ItemInfo tmpSI = lastSectionInfo; - EnhancedDocuments eds = null; // need to find a good list, i.e. there may be non-linked sections before/after: - while (eds == null && tmpSI != null) - { - SectionConfig sc = tmpSI.MyConfig as SectionConfig; - if (sc.MyEnhancedDocuments != null && sc.MyEnhancedDocuments.Count > 0) - { - eds = sc.MyEnhancedDocuments; - break; - } - // if had to skip unlinked sections, it becomes an 'after' a linked one: - tmptyp = MenuSelections.SectionAfter; - tmpSI = tmpSI.MyPrevious; - } - if (eds != null) // found valid enhanced ids to insert from: - { - foreach (EnhancedDocument sed in eds) - { - SectionInfo esi = SectionInfo.Get(sed.ItemID); - using (Section newenhSection = Section.MakeSection((tmptyp == MenuSelections.SectionAfter) ? null : esi.ActiveParent, (tmptyp == MenuSelections.SectionAfter) ? esi : esi.MyPrevious, num, title, 10000)) - { - SaveEnhancedForSection(sourceSect, newenhSection, sed.Type); - RefreshRelatedNode(SectionInfo.Get(newenhSection.ItemID)); - // B2024-023: when inserting a source section, the associated - // enhanced section did not appear in tree view or in edit window (if it - // was displayed in editor). Add to tree view and close the enhanced - // procedure edit window. Note that closing of edit window was done to - // be consistent on what happens upon delete of source w/ and enhanced - // section. - SectionInfo tmpsi = SectionInfo.Get(newenhSection.ItemID); - RefreshRelatedNode(ProcedureInfo.Get(tmpsi.MyParent.ItemID)); - OnSectionShouldClose(this, new vlnTreeSectionInfoEventArgs(tmpsi, true)); - } - } - return; - } - } - // do the following code if insert the section from the procedure, or if no linked section was found above while doing an insert section from before/after - ProcedureConfig pc = sourceSect.MyItemInfo.MyProcedure.MyConfig as ProcedureConfig; - SectionConfig sourcecfg = sourceSect.SectionConfig; - if (pc != null) - { - foreach (EnhancedDocument ed in pc.MyEnhancedDocuments) - { - // get the enhanced procedureinfo: - ProcedureInfo enhInfo = ProcedureInfo.Get(ed.ItemID); - if (enhInfo.LastChild(E_FromType.Section) != null) - { - using (Section newenhSection = Section.MakeSection(enhInfo, (enhInfo.Sections != null && enhInfo.Sections.Count != 0) ? enhInfo.Sections[enhInfo.Sections.Count - 1] : null, num, title, 10000)) - { - SaveEnhancedForSection(sourceSect, newenhSection, ed.Type); - RefreshRelatedNode(SectionInfo.Get(newenhSection.ItemID)); - } - } - else - { - ItemInfo newenhSectionII = enhInfo.InsertChild(E_FromType.Section, 10000, title, num); - using (Section newenhSect = Section.Get(newenhSectionII.ItemID)) - { - SaveEnhancedForSection(sourceSect, newenhSect, ed.Type); - RefreshRelatedNode(SectionInfo.Get(newenhSect.ItemID)); - } - } - } - } - } - private void SaveEnhancedForSection(Section sourceSect, Section newenhSection, int enhtype) - { - SectionConfig newenhcfg = new SectionConfig(newenhSection); - newenhcfg.AddEnhancedDocument(0, sourceSect.ItemID); - newenhcfg.SaveEnhancedDocuments(); // does this save data? - using (Content c1 = Content.Get(newenhSection.ContentID)) - { - c1.Config = newenhcfg.ToString(); - c1.Save(); - } - sourceSect.SectionConfig.AddEnhancedDocument(enhtype, newenhSection.ItemID); - sourceSect.SectionConfig.SaveEnhancedDocuments(); - using (Content cs = Content.Get(sourceSect.ContentID)) - { - cs.Config = sourceSect.SectionConfig.ToString(); - cs.Save(); - } - } - - private Section CreateNewSection() - { - // B2020-087 the config for SubSection_Edit was sometimes set even when there wasn't any subsections, - // so make sure it's cleared if there are no existing subsections - SectionConfig sc = _LastItemInfo.MyConfig as SectionConfig; - if (sc != null && sc.SubSection_Edit == "Y" && _LastItemInfo.Sections == null) - { - sc.SubSection_Edit = null; - using (Section mysect = Section.Get(_LastItemInfo.ItemID)) - { - mysect.MyContent.Config = sc.ToString(); - mysect.Save(); - } - } - if (_LastItemInfo.LastChild(E_FromType.Section) != null) - return Section.MakeSection(_LastItemInfo, _LastItemInfo.LastChild(E_FromType.Section), null, "New Section", 10000); - ItemInfo iii = _LastItemInfo.InsertChild(E_FromType.Section, 10000, "New Section", null); - return Section.Get(iii.ItemID); - } - private VETreeNode InsertChildStep(VETreeNode tn) - { - // 11/17/15: if inserted with step editor open, step gets inserted as child first child. If step editor is not - // open, step gets inserted at end (as last item in list) - - // If parent step is open in editor, use the OnInsertItemInfo to insert step & add RTBItems to step editor panel - ItemInfo ii = tn.VEObject as ItemInfo; - if (OnInsertItemInfo(this, new vlnTreeItemInfoInsertEventArgs(ii, E_InsertType.Child, "New Step", 20002, E_FromType.Step))) - { - if (ii.IsStep) return null; - // if this was a section, it may have enhanced, so the enhanced steps will need to be created also. - SectionConfig scfg = ii.MyConfig as SectionConfig; - if (scfg.Section_LnkEnh != "Y") return null; - SetLastValues(StepInfo.Get(ii.Steps[0].ItemID)); - } - else - { - // The parent step was not open in the step editor, just create new step(s) and add treenode. - int newId = -1; - // B2020-076: if this step has a template, insert template steps. - int topType = ii.GetSmartTemplateTopLevelIndxOfThisType(20002); - if (topType != -1) - { - ItemInfo tmp = null; - tmp = ii.InsertSmartTemplateSubStep("New Step", null, null, ItemInfo.EAddpingPart.Child, 20002, E_FromType.Step); - newId = tmp.ItemID; - } - else - { - // this line (below) adds the new step to the bottom of the section, the other line (not commented) adds it to the top. Bug fix B2016-002 - //using (Step step = Step.MakeStep(_LastItemInfo, _LastItemInfo.LastChild(E_FromType.Step), null, "New Step", 20002, E_FromType.Step)) - using (Step step = Step.MakeStep(_LastItemInfo, null, null, "New Step", 20002, E_FromType.Step)) - { - ShowBrokenRules(step.BrokenRulesCollection); - newId = step.ItemID; - } - } - SetLastValues(StepInfo.Get(newId)); - tn = new VETreeNode(_LastStepInfo); - _LastStepInfo.UpdateTransitionText(); - _LastStepInfo.UpdateROText(); - TreeNode par = SelectedNode; - par.Nodes.Insert(0, tn); - } - - // see if enhanced related steps need created: - SectionConfig scfgE = _LastItemInfo.ActiveSection.MyConfig as SectionConfig; // C2018-003 fixed use of getting the active section - if (scfgE != null && scfgE.Section_LnkEnh == "Y") - { - // set up which item to insert from based on whether editor was open (see comment from 11/17 above). - EnhancedDocuments enhdocs = null; - ItemInfo.EAddpingPart addpart = ItemInfo.EAddpingPart.Child; - if (_LastItemInfo.MyPrevious != null) // the code above will do the MakeStep regardless of whether editor is up if this is the only step. - { - addpart = ItemInfo.EAddpingPart.After; - ItemInfo lstSrc = _LastItemInfo.MyPrevious; - StepConfig stcfg = lstSrc.MyConfig as StepConfig; - if (stcfg == null) enhdocs = scfgE.MyEnhancedDocuments; - else enhdocs = stcfg.MyEnhancedDocuments; - } - else - { - enhdocs = scfgE.MyEnhancedDocuments; - } - foreach (EnhancedDocument ed in enhdocs) - { - // the new source step's item is passed in to know what type & what to link to. - // The ed.Type & itemid show what type of enhanced document (used to create new - // config Type) - _LastItemInfo.DoAddEnhancedSteps(ed.Type, ed.ItemID, addpart); - } - } - return tn; - } - - private VETreeNode InsertBeforeOrAfter(MenuSelections newtype, VETreeNode tn) - { - // If parent step is open in editor, use the OnInsertItemInfo to insert step & add RTBItems to step editor panel - ItemInfo ii = tn.VEObject as ItemInfo; - if (OnInsertItemInfo(this, new vlnTreeItemInfoInsertEventArgs(ii, (newtype == MenuSelections.StepAfter) ? E_InsertType.After : E_InsertType.Before, ""))) - { - tn = (VETreeNode)((newtype == MenuSelections.StepAfter) ? tn.NextNode : tn.PrevNode); - } - else - { - // The parent step was not open in the step editor, just create new step and add treenode. - int tvindex = SelectedNode.Index; - // B2020-076: if this step has a template, insert template steps. - int newid = -1; - if (ii.FormatStepData.UseSmartTemplate || ii.FormatStepData.UseOldTemplate) - { - ItemInfo tmp = ii.InsertSmartTemplateSteps("New Step", null, null, newtype == MenuSelections.StepAfter ? ItemInfo.EAddpingPart.After : ItemInfo.EAddpingPart.Before, (int)ii.MyContent.Type); - newid = tmp.ItemID; - } - else - { - // if inserting before, the parent is set in case previous is null, i.e. beginning of the list. - ItemInfo parent = (newtype == MenuSelections.StepAfter) ? null : _LastStepInfo.MyParent; - using (Step step = Step.MakeStep(parent, (newtype == MenuSelections.StepAfter) ? _LastStepInfo : _LastStepInfo.MyPrevious, null, "New Step", (int)_LastStepInfo.MyContent.Type, (E_FromType)_LastStepInfo.FirstSibling.ItemParts[0].FromType)) - { - ShowBrokenRules(step.BrokenRulesCollection); - newid = step.ItemID; - } - } - SetLastValues(StepInfo.Get(newid)); - tn = new VETreeNode(_LastStepInfo); - _LastStepInfo.UpdateTransitionText(); - _LastStepInfo.UpdateROText(); - TreeNode par = SelectedNode.Parent; - par.Nodes.Insert(tvindex + ((newtype == MenuSelections.StepBefore) ? 0 : 1), tn); - } - if (tn != null) - { - // add enhanced steps if applicable (this code is only run if a step is inserted, not for a section). - // Also, NOTE that this is not needed for InsertChildStep from tree because there is no menu item - // to support inserting a type that would have enhanced from tree. - StepConfig sib = ii.MyConfig as StepConfig; - foreach (EnhancedDocument ed in sib.MyEnhancedDocuments) - { - // create a new enhanced step and link it to this new source step. - // the new source step's item is passed in to know what type & what to link to. - // The ed.Type & itemid show what type of enhanced document (use to create new - // config Type) and itemid is the one to insert after. - ItemInfo.EAddpingPart addpart = ItemInfo.EAddpingPart.After; - if (newtype == MenuSelections.StepBefore) addpart = ItemInfo.EAddpingPart.Before; - ItemInfo newSourceStep = tn.VEObject as ItemInfo; - newSourceStep.DoAddEnhancedSteps(ed.Type, ed.ItemID, addpart); - } - } - return tn; - } - private void ShowBrokenRules(BrokenRulesCollection brs) - { - if (brs != null) - { - foreach (BrokenRule br in brs) - { - Console.WriteLine("broken rule {0}", br.Description); - } - } - } - #endregion - #region DeleteAllLevels - private bool tv_NodeDelete() - { - SetLastValues((VETreeNode)SelectedNode); - string message = string.Empty; - string typeDescription = "item"; - if (_LastStepInfo != null) - { - if (!MySessionInfo.CanCheckOutItem(_LastStepInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message)) - { - FlexibleMessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return false; - } - //C2020-026 specific description of what user is trying to delete - typeDescription = "\"" + _LastStepInfo.FormatStepData.StepEditData.TypeMenu.MenuItem + "\""; - if (_LastStepInfo.HasChildren) typeDescription += " and its substeps"; - } - if (_LastSectionInfo != null) - { - if (!MySessionInfo.CanCheckOutItem(_LastSectionInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message)) - { - FlexibleMessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return false; - } - //C2020-026 specific description of what user is trying to delete - typeDescription = "Section"; - if (_LastSectionInfo.HasChildren) typeDescription += " and its steps"; - } - if (_LastProcedureInfo != null) - { - if (!MySessionInfo.CanCheckOutItem(_LastProcedureInfo.ItemID, CheckOutType.Procedure, ref message)) - { - FlexibleMessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return false; - } - typeDescription = "Procedure"; //C2020-026 specific description of what user is trying to delete - } - if (_LastDocVersionInfo != null) - { - StringBuilder sb = new StringBuilder(); - foreach (ProcedureInfo pi in _LastDocVersionInfo.Procedures) - { - if (!MySessionInfo.CanCheckOutItem(pi.ItemID, CheckOutType.Procedure, ref message)) - sb.AppendLine(message); - message = string.Empty; - } - if (sb.Length > 0) - { - FlexibleMessageBox.Show(this, sb.ToString(), "Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return false; - } - typeDescription = "Procedure Set"; //C2020-026 specific description of what user is trying to delete - } - if (_LastFolderInfo != null) - { - StringBuilder sb = new StringBuilder(); - if (_LastFolderInfo.FolderDocVersionCount > 0) - { - foreach (DocVersionInfo dvi in _LastFolderInfo.FolderDocVersions) - { - foreach (ProcedureInfo pi in dvi.Procedures) - { - if (!MySessionInfo.CanCheckOutItem(pi.ItemID, CheckOutType.Procedure, ref message)) - sb.AppendLine(message); - message = string.Empty; - } - } - } - if (sb.Length > 0) - { - FlexibleMessageBox.Show(this, sb.ToString(), "Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return false; - } - typeDescription = "Folder"; //C2020-026 specific description of what user is trying to delete - } - //C2020-026 added standardized wording when attempting to delete - DialogResult result = DialogResult.No; - if (_LastProcedureInfo == null) - { - result = FlexibleMessageBox.Show("Are you sure you want to delete this " + typeDescription + "?", "Verify Delete", - MessageBoxButtons.YesNo, MessageBoxIcon.Question); - } - if (_LastProcedureInfo != null || result == DialogResult.Yes) - { - if (_LastFolderInfo != null) - { - Folder.Delete(_LastFolderInfo.FolderID); - _LastFolderInfo = null; - return true; - } - else if (_LastDocVersionInfo != null) - { - // if this has enhanced linked DocVersions, delete them first. - DocVersionConfig dvc = _LastDocVersionInfo.MyConfig as DocVersionConfig; - if (dvc != null && dvc.MyEnhancedDocuments != null && dvc.MyEnhancedDocuments.Count > 0) - { - foreach (DVEnhancedDocument dve in dvc.MyEnhancedDocuments) - { - if (dve.Type != 0) - DocVersion.Delete(dve.VersionID); - else - { - // B2018-025: for the input source docversion (id), clear out its enhanced document link information - // dvi is the source, remove this (_LastDocVersionInfo) background link from the source's config - DocVersionInfo dvi = DocVersionInfo.Get(dve.VersionID); - DocVersionConfig dvci = dvi.MyConfig as DocVersionConfig; - dvci.RemoveEnhancedLink(_LastDocVersionInfo.VersionID); - string dvccfg = dvci.ToString(); - using (DocVersion dv = dvi.Get()) - { - dv.Config = dvccfg; - dv.Save(); - DocVersionInfo.Refresh(dv); - } - } - } - } - DocVersion.Delete(_LastDocVersionInfo.VersionID); - _LastDocVersionInfo = null; - (((VETreeNode)SelectedNode.Parent).VEObject as FolderInfo).RefreshFolderDocVersions(); // B2018-082 tell tree node that it no longer has a working draft - return true; - } - else if (_LastProcedureInfo != null) - { - dlgDelProcReason dlgDPA = new dlgDelProcReason(this); // C2020-038: prompt user for reason - DialogResult res = dlgDPA.ShowDialog(this); - if (res == DialogResult.OK) - { - //If there are enhanced, they will also need deleted, save the ids so that they - // can be deleted after this item gets deleted. - List enhIds = new List(); - // C2020-038: request reason for delete procedure so this can be saved in database - ProcedureConfig prc = _LastProcedureInfo.MyConfig as ProcedureConfig; - prc.General_DelProcReason = DelProcReason; - using (Item itm = Item.Get(_LastProcedureInfo.ItemID)) - { - itm.MyContent.Config = prc.ToString(); - itm.UserID = Volian.Base.Library.VlnSettings.UserID; - itm.Save(); - } - foreach (EnhancedDocument ed in prc.MyEnhancedDocuments) - if (ed.Type != 0) enhIds.Add(ed.ItemID); - // always return false because an event gets fired to delete tree nodes. - if (!DeleteItemInfoAndChildren(_LastProcedureInfo)) return false; - - _LastProcedureInfo = null; - foreach (int enhId in enhIds) - { - ProcedureInfo pi = ProcedureInfo.Get(enhId); - // if the item was displayed in the editor, the 'DeleteItemInfoAndChildren' call - // above will go through user interface code that deletes the enhanced, so 'Get' - // will return a null (i.e. the data no longer exists). - if (pi != null) - { - if (!DeleteItemInfoAndChildren(pi)) Console.WriteLine("do an error log item"); - } - } - return false; - } - } - else if (_LastSectionInfo != null) - { - // For sections, there are a number of things to check for if enhanced is active: - // 1) in a source and the enhanced link can be none, title or contents. - // 2) if none, just delete - // 3) If just title and in source, clear links in enhanced back to this source - // before delete. - // 4) If in enhanced, by source has link type set to title, can delete this - // section, but first clear source's links - - //If there are enhanced, they will also need deleted, save the ids so that they - // can be deleted after this item gets deleted. - List enhIds = new List(); - SectionConfig sec = _LastSectionInfo.MyConfig as SectionConfig; - if (_LastSectionInfo.IsEnhancedSectionTitleOnly) - { - _LastSectionInfo.ClearEnhancedSectionFromSource(sec.MyEnhancedDocuments[0].ItemID); - } - else if (sec.Section_LnkEnh == "Y") - { - foreach (EnhancedDocument ed in sec.MyEnhancedDocuments) - if (ed.Type != 0) enhIds.Add(ed.ItemID); - } - else if (sec.Section_LnkEnh == "T") - { - // just clear enhanced links back - _LastSectionInfo.ClearEnhancedSectionLink(); - } - OnSectionShouldClose(this, new vlnTreeSectionInfoEventArgs(_LastSectionInfo, true)); - // always return false because an event gets fired to delete tree nodes. - if (!DeleteItemInfoAndChildren(_LastSectionInfo)) - { - return false; - } - // B2020-087 refresh the tree node after the delete - needed when deleting the last subsection or canceling the creation of the first subsection - (this.SelectedNode as VETreeNode).ChildrenLoaded = false; - (this.SelectedNode as VETreeNode).RefreshNode(); - (this.SelectedNode as VETreeNode).Collapse(); - WordSectionEventArgs args = new WordSectionEventArgs(_LastSectionInfo); - OnWordSectionDeleted(this, args); - _LastSectionInfo = null; - foreach (int enhId in enhIds) - { - SectionInfo si = SectionInfo.Get(enhId); - // if the item was displayed in the editor, the 'DeleteItemInfoAndChildren' call - // above will go through user interface code that deletes the enhanced, so 'Get' - // will return a null (i.e. the data no longer exists). - if (si != null) - { - if (!DeleteItemInfoAndChildren(si)) Console.WriteLine("do an error log item"); - } - } - return false; - } - else if (_LastStepInfo != null) - { - //If there are enhanced, they will also need deleted, save the ids so that they - // can be deleted after this item gets deleted. Note that if the step(s) were - // displayed in step editor, that code deletes the enhanced steps. - List enhIds = new List(); - StepConfig sc = _LastStepInfo.MyConfig as StepConfig; - foreach (EnhancedDocument ed in sc.MyEnhancedDocuments) - if (ed.Type != 0) enhIds.Add(ed.ItemID); - - // always return false because an event gets fired to delete tree nodes. - if (!DeleteItemInfoAndChildren(_LastStepInfo)) return false; - _LastStepInfo = null; - foreach (int enhId in enhIds) - { - StepInfo si = StepInfo.Get(enhId); - // if the item was displayed in the editor, the 'DeleteItemInfoAndChildren' call - // above will go through user interface code that deletes the enhanced, so 'Get' - // will return a null (i.e. the data no longer exists). - if (si != null) - { - if (!DeleteItemInfoAndChildren(si)) Console.WriteLine("do an error log item"); - } - } - return false; - } - } - return false; - } - - public void RemoveFolder(int folderId) - { - TreeNode nodeToRemove = FindNodeById(folderId, this.Nodes); - if (nodeToRemove != null) - { - // Perform the removal logic - nodeToRemove.Remove(); // This removes the node from its parent - } - } - private TreeNode FindNodeById(int folderId, TreeNodeCollection nodes) - { - foreach (TreeNode node in nodes) - { - VETreeNode vetNode = node as VETreeNode; - if (vetNode != null) - { - FolderInfo folderInfo = vetNode.VEObject as FolderInfo; - if (folderInfo != null && folderInfo.FolderID == folderId) - { - return node; - } - else - { - TreeNode foundNode = FindNodeById(folderId, node.Nodes); - if (foundNode != null) - { - return foundNode; - } - } - } - } - return null; - } - - private bool DeleteItemInfoAndChildren(ItemInfo ii) - { - DateTime dtStart = DateTime.Now; - try - { - ItemInfo pii = ii.MyParent; - bool deletedSection = ii.IsSection; - // send an event to frmVeproms that sends an event to the stepeditor to - // do delete using RTBItem - this manages windowing from the step editor. - // If the procedure is open & you're deleting procedure, you want to close open - // window - this is done in DisplayTabControl-DeleteStepTabItem. - OnProcessing(true, "Deleting"); - if (!OnDeleteItemInfo(this, new vlnTreeItemInfoEventArgs(ii))) - Item.DeleteItemAndChildren(ii); - OnProcessing(false, "Deleted"); - OnProcessingComplete(dtStart, "Deleted"); - if (deletedSection) - { - // B2020-087 if we deleted the last sub section, then clear the SubSection_Edit in the parent's config - SectionConfig sc = pii.MyConfig as SectionConfig; - if (sc != null && sc.SubSection_Edit == "Y" && pii.Sections == null) // B2020-103: Added null check - { - sc.SubSection_Edit = null; - using (Section mysect = Section.Get(pii.ItemID)) - { - mysect.MyContent.Config = sc.ToString(); - mysect.Save(); - } - } - } - return true; - } - catch (System.Data.SqlClient.SqlException ex) - { - OnProcessing(false, "Delete Failed"); - OnProcessingComplete(dtStart, "Delete Failed"); - // C2020-033: Support delete to bring up Search/Incoming Transitions panel - if (ex.Message.Contains("has External Transitions")) - { - ItemInfo iis = ItemInfo.Get(ii.ItemID); - OnSearchIncTransIn(this, new vlnTreeItemInfoEventArgs(iis)); - iis = ii.HandleSqlExceptionOnDelete(ex); - } - else - { - ItemInfo iii = ii.HandleSqlExceptionOnDelete(ex); - if (iii != null) OnOpenItem(this, new vlnTreeItemInfoEventArgs(iii)); - } - return false; - } - } - public event vlnTreeViewTimeEvent ProcessingComplete; - private void OnProcessingComplete(DateTime dtStart, string message) - { - if (ProcessingComplete != null) - ProcessingComplete(this, new vlnTreeTimeEventArgs(dtStart, message)); - } - public event vlnTreeViewStatusEvent Processing; - private void OnProcessing(bool status, string message) - { - if (Processing != null) - Processing(this, new vlnTreeStatusEventArgs(status, message)); - } - //C2021-035 Add Refresh Tree Option at highest level - public event vlnTreeViewStatusEvent RefreshFormats; - private void OnRefreshFormats(bool status, string message) - { - if (RefreshFormats != null) - RefreshFormats(this, new vlnTreeStatusEventArgs(status, message)); - } - #endregion - #region SetLastValuesAndSaveIfChangedStuff - private void SetLastValues(VETreeNode node) - { - _LastTreeNode = node; - SetLastValues(node.VEObject); - } - private void SetLastValues(IVEDrillDownReadOnly veobject) - { - _LastFolderInfo = veobject as FolderInfo; - _LastDocVersionInfo = veobject as DocVersionInfo; - _LastProcedureInfo = veobject as ProcedureInfo; - _LastSectionInfo = veobject as SectionInfo; - _LastStepInfo = veobject as StepInfo; - _LastItemInfo = veobject as ItemInfo; - } - #endregion - #region Cursor - private bool SetupDragCursor(ImageList il, TreeNode tn) - { - // Reset image list used for drag image - il.Images.Clear(); - int howBig = tn.Bounds.Size.Width + this.Indent; - if (howBig > 256) howBig = 256; - il.ImageSize = new Size(howBig, tn.Bounds.Height); - - // Create new bitmap - // This bitmap will contain the tree node image to be dragged - Bitmap bmp = new Bitmap(tn.Bounds.Width + this.Indent, tn.Bounds.Height); - - // Get graphics from bitmap - Graphics gfx = Graphics.FromImage(bmp); - - // Draw node icon into the bitmap - if (this.ImageList != null) gfx.DrawImage(this.ImageList.Images[0], 0, 0); - - // Draw node label into bitmap - gfx.DrawString(tn.Text, this.Font, new SolidBrush(this.ForeColor), - // new SolidBrush(Color.Blue), - (float)this.Indent, 1.0f); - - // Add bitmap to imagelist - _dragImageList.Images.Add(bmp); - - // Get mouse position in client coordinates - Point p = this.PointToClient(Control.MousePosition); - - // Compute delta between mouse position and node bounds - int dx = p.X + this.Indent - tn.Bounds.Left; - int dy = p.Y - tn.Bounds.Top; - - // Begin dragging image - return DragHelper.ImageList_BeginDrag(_dragImageList.Handle, 0, dx, dy); - } - private void tv_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e) - { - if (_doingCollapseNode) - { - _doingCollapseNode = false; - return; - } - // Get drag node and select it - try - { - TreeNode dragNode = (TreeNode)e.Item; - Type t = dragNode.GetType(); - //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("Item Drag {0} - {1}", t.FullName, t.BaseType.FullName); - Type t2 = Type.GetType(t.FullName); - //if(t2 != null) - // if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("Item Drag {0} - {1}", t2.FullName, t2.BaseType.FullName); - this.SelectedNode = dragNode; - ItemInfo iidrag = ((VETreeNode)dragNode).VEObject as ItemInfo; - FolderInfo fdrag = ((VETreeNode)dragNode).VEObject as FolderInfo; - DocVersionInfo ddrag = ((VETreeNode)dragNode).VEObject as DocVersionInfo; - if ((iidrag == null && fdrag == null && ddrag == null)) - { - FlexibleMessageBox.Show("Cannot drag/drop a grouping node."); - return; - } - // don't put up message, message kept coming up on any selection of node (to copy, properties, etc) - //if (iidrag != null && iidrag.IsStep) return; - if (SetupDragCursor(_dragImageList, dragNode)) - { - this.DoDragDrop(dragNode, DragDropEffects.Move | DragDropEffects.Copy);// Begin dragging - DragHelper.ImageList_EndDrag();// End dragging image - } - } - catch (Exception ex) - { - if (_MyLog.IsErrorEnabled) _MyLog.Error("tv_ItemDrag", ex); - } - } - #endregion - #region DragDrop - ImageList _dragImageList = new ImageList(); - public enum DropPosition : int - { - Child = 0, Before = 1, After = 2 - } - private class DropLocation - { - #region Business Methods - private TreeNode _dropNode; - public TreeNode DropNode - { - get { return _dropNode; } - set { _dropNode = value; } - } - private int _index; - public int Index - { - get { return _index; } - set { _index = value; } - } - private DropPosition _position; - public DropPosition Position - { - get { return _position; } - set { _position = value; } - } - DateTime _lastScroll; - public DateTime LastScroll - { - get { return _lastScroll; } - } - private string _location = string.Empty; - #endregion - #region Constructors - public DropLocation(TreeView tv, System.Windows.Forms.DragEventArgs e, DateTime lastScroll) - { - _lastScroll = lastScroll; - _dropNode = tv.GetNodeAt(tv.PointToClient(new Point(e.X, e.Y))); - if (_dropNode == null) return; - int OffsetY = tv.PointToClient(Cursor.Position).Y - _dropNode.Bounds.Top; - if (OffsetY < _dropNode.Bounds.Height / 3) // First Third - Before - { - _index = _dropNode.Index; - _dropNode = _dropNode.Parent; - _position = DropPosition.Before; - _location = string.Format("Before1 {0}[{1}] y={2}", _dropNode.Text, _index, OffsetY); - } - else if ((OffsetY / 2) < _dropNode.Bounds.Height / 3) // Second Third - Child - { - _location = string.Format("Child {0} y={1}", _dropNode.Text, OffsetY); - _position = DropPosition.Child; - _index = 0; - //if (_dropNode.Parent == null) - //{ - // if(_MyLog.IsInfoEnabled)_MyLog.Info("Root Node"); - //} - } - else // Last Third - After Now I need to check the X value - { - if (_dropNode.NextVisibleNode != null && _dropNode.Nodes.Count > 0 && _dropNode.IsExpanded)// Has Children & Expanded - Insert first child - { - // _dropNode = _dropNode.Nodes[0]; - _index = 0; - _position = DropPosition.Before; - _location = string.Format("Before2 {0}[{1}] y={2}", _dropNode.Text, _index, OffsetY); - } - else // No Children or Children Collapsed - Insert Next at various levels depending upon horizontal location. - { - Point pt = tv.PointToClient(new Point(e.X, e.Y)); - TreeNode nextParent = _dropNode.NextNode; - if (nextParent != null) nextParent = nextParent.Parent; - do - { - _index = _dropNode.Index; - _dropNode = _dropNode.Parent; - } while (pt.X < _dropNode.Bounds.X && _dropNode != nextParent); - _location = string.Format("After {0}[{1}] y={2}", _dropNode.Text, _index, OffsetY); - _position = DropPosition.After; - } - } - LimitMoves(e); - } - public void LimitMoves(DragEventArgs e) - { - if ((e.KeyState & 8) == 0) - { - //TreeNode dragNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); - //TreeNode dragNode = (TreeNode)e.Data.GetData("TreeTest.FolderTreeNode"); - TreeNode dragNode = vlnTreeView.GetTreeNodeFromData(e.Data); - switch (_position) - { - case DropPosition.Before: - if (dragNode == _dropNode.Nodes[_index] || dragNode == _dropNode.Nodes[_index].PrevNode) - { - // if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("Before {0} {1} {2} {3} {4}", dragNode.Text ,_position.ToString() , _dropNode.Nodes[_index].Text - // ,_dropNode.Nodes[_index].PrevNode,_dropNode.Nodes[_index].NextNode); - _dropNode = null; - } - break; - case DropPosition.Child: - if (dragNode.Parent == _dropNode) - { - // if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("Child {0} {1} {2} {3} {4} {5}", dragNode.Text ,_position.ToString() , _dropNode.Nodes[_index].Text - // ,_dropNode.Nodes[_index].PrevNode,_dropNode.Nodes[_index].NextNode,DateTime.Now); - _dropNode = null; - } - break; - case DropPosition.After: - if (dragNode == _dropNode.Nodes[_index] || dragNode == _dropNode.Nodes[_index].NextNode) - { - // if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("After {0} {1} {2} {3} {4}", dragNode.Text ,_position.ToString() , _dropNode.Nodes[_index].Text - // ,_dropNode.Nodes[_index].PrevNode,_dropNode.Nodes[_index].NextNode); - _dropNode = null; - } - break; - } - } - } - #endregion - public override string ToString() - { - return string.Format("{0}[{1}].{2}", _dropNode.Text, _index, _position.ToString()); - } - #region Drawing - private void TreeNodeTriangle(Graphics g) - { - Rectangle r = _dropNode.Bounds; - int RightPos = r.Right + 6; - Point[] RightTriangle = new Point[]{ - new Point(RightPos, r.Y ), - new Point(RightPos - (r.Height / 2), r.Y + (r.Height / 2)), - new Point(RightPos, r.Y + r.Height), - new Point(RightPos - (r.Height / 3), r.Y + (r.Height / 2)) - }; - g.FillPolygon(System.Drawing.Brushes.Black, RightTriangle); - } - private void InsertPointer(TreeNode tn, Graphics g) - { - TreeView tv = _dropNode.TreeView; - Rectangle r2 = _dropNode.Nodes[_index].Bounds; - Rectangle r3 = tn.Bounds; - int y = (_position == DropPosition.Before ? r2.Y : r3.Bottom); - int x = r2.Left; - - if (y == 0) - { - return; - } - //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("Line at {0} Node {1}[{2}] {3}", _location, _dropNode.Text, _index, _position.ToString()); - // Changed the color of the drag indicator to always be red - Color lc = (_position == DropPosition.After ? Color.Red : Color.Red); - Brush lb = (_position == DropPosition.After ? Brushes.Red : Brushes.Red); - Point[] RightTriangle; - if (_position == DropPosition.After) - { - RightTriangle = new Point[]{ - new Point(x, y ), - new Point(x+4, y+4), - new Point(x+8, y)}; - } - else - { - RightTriangle = new Point[]{ - new Point(x, y), - new Point(x+4, y-4), - new Point(x+8, y)}; - } - g.DrawLine(new System.Drawing.Pen(lc, 2), new Point(r2.Left, y), new Point(tv.Width - 8, y)); - g.FillPolygon(lb, RightTriangle); - } - public void ShowLocation(System.Windows.Forms.DragEventArgs e, bool ScrollOnly) - { - //if (e.Effect == DragDropEffects.None) return; - if (_dropNode != null) - { - // if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("ShowLocation1 {0} {1}", e.Effect.ToString(), DateTime.Now.Millisecond); - DragHelper.ImageList_DragShowNolock(false); - TreeView tv = _dropNode.TreeView; - TreeNode tmp = tv.GetNodeAt(tv.PointToClient(new Point(e.X, e.Y))); - // if (!ScrollOnly) - // { - if (ScrollTreeView(tmp) || !ScrollOnly) - { - //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("ShowLocation2 {0} {1}", e.Effect.ToString(), DateTime.Now.Millisecond); - tv.Refresh(); - if (e.Effect != DragDropEffects.None) - { - //tv.SelectedNode = dropNode; - Graphics g = tv.CreateGraphics(); - TreeNodeTriangle(g); - if (_position != DropPosition.Child) InsertPointer(tmp, g); - } - } - // } - // else ScrollTreeView(tmp); - DragHelper.ImageList_DragShowNolock(true); - } - } - #endregion - public void ShowLocation() - { - //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0}[{1}] {2}", _dropNode.Text, _index, _position.ToString()); - } - #region AutoScroll - private bool ScrollTreeView(TreeNode tn) - { - bool retval = false; - TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - _lastScroll.Ticks); - if (ts.Milliseconds > 100)// This controls the scroll speed - { - int top = tn.Bounds.Top; - _lastScroll = DateTime.Now; - if (tn.TreeView.ClientSize.Height < tn.Bounds.Bottom) tn.EnsureVisible();// Make sure that the current node is visible - if (tn.NextVisibleNode != null && tn.TreeView.ClientSize.Height < tn.NextVisibleNode.Bounds.Bottom) - tn.NextVisibleNode.EnsureVisible();// Make sure that the next node is visible - else - if (tn.PrevVisibleNode != null && tn.PrevVisibleNode.PrevVisibleNode != null && tn.PrevVisibleNode.PrevVisibleNode.IsVisible == false) - tn.PrevVisibleNode.PrevVisibleNode.EnsureVisible();// Make sure that the previous node is visible } - else - if (tn.PrevVisibleNode != null && tn.PrevVisibleNode.IsVisible == false) - tn.PrevVisibleNode.EnsureVisible();// Make sure that the previous node is visible - retval = (top != tn.Bounds.Top); - // if (retval) if(_MyLog.IsInfoEnabled)_MyLog.Info("Scroll"); - } - return retval; - } - #endregion - public bool Equals(DropLocation dl) - { - return (dl != null && _lastScroll.Equals(dl.LastScroll) && _dropNode.Equals(dl.DropNode) && - _position.Equals(dl.Position)); - } - } - private DropLocation _LastDropLocation = null; - private void tv_DragOver(object sender, System.Windows.Forms.DragEventArgs e) - { - try - { - TreeNode dragNode = GetTreeNodeFromData(e.Data); - if (dragNode == null) return; - // Compute drag position and move image - Point formP = this.FindForm().PointToClient(new Point(e.X, e.Y)); - DragHelper.ImageList_DragMove(formP.X - this.Left, formP.Y - this.Top); - DropLocation dl = new DropLocation(this, e, _LastDropLocation == null ? DateTime.Now : _LastDropLocation.LastScroll); - string s = string.Empty; - if (dl.DropNode == null || !AllowedToMove((VETreeNode)dragNode)) - { - e.Effect = DragDropEffects.None; - } - else - { - DragDropEffects ee = e.Effect; - if (e.KeyState == 13) // Shift and Control Keys to do a move. - ee = DragDropEffects.Move; - else - ee = DragDropEffects.None; // Default - Do nothing - if (IsChild(dragNode, dl.DropNode)) // Don't copy or move to a child node - ee = DragDropEffects.None; - else if (IsDocVersion((VETreeNode)dragNode)) // Don't move docversions - ee = DragDropEffects.None; - else if (IsFolder((VETreeNode)dragNode)) // Folder move is only valid if moving to folder with NO docversions - { - FolderInfo fdropi = ((VETreeNode)dl.DropNode).VEObject as FolderInfo; - if (fdropi == null || fdropi.FolderDocVersionCount > 0) ee = DragDropEffects.None; - } - else if (IsSection((VETreeNode)dragNode)) - { - // A section can be moved within a procedure or to a section within the same procedure... - // For HLP, just move within the same procedure - // TODO: allow for section move within subsections. - ProcedureInfo pdropi = ((VETreeNode)dl.DropNode).VEObject as ProcedureInfo; - if (pdropi == null || (dragNode.Parent != dl.DropNode)) ee = DragDropEffects.None; - } - else if (!IsFolder((VETreeNode)dragNode) && (dragNode.Parent != dl.DropNode)) - ee = DragDropEffects.None; - if (e.Effect != ee) e.Effect = ee; - dl.ShowLocation(e, dl.Equals(_LastDropLocation)); - _LastDropLocation = dl; - } - } - catch (Exception ex) - { - if (_MyLog.IsErrorEnabled) _MyLog.Error("tv_DragOver", ex); - } - } - - private bool IsSection(VETreeNode vETreeNode) - { - SectionInfo sectInfo = vETreeNode.VEObject as SectionInfo; - if (sectInfo != null) return true; - return false; - } - private bool IsProcedure(VETreeNode vETreeNode) - { - ProcedureInfo procInfo = vETreeNode.VEObject as ProcedureInfo; - if (procInfo != null) return true; - return false; - } - private bool IsDocVersion(VETreeNode dragNode) - { - DocVersionInfo dvInfo = dragNode.VEObject as DocVersionInfo; - if (dvInfo != null) return true; - return false; - } - private bool AllowedToMove(VETreeNode dragNode) - { - DocVersionInfo dvInfo = null; - if (IsFolder(dragNode)) - { - FolderInfo fi = dragNode.VEObject as FolderInfo; - return (MyUserInfo.IsAdministrator() || MyUserInfo.IsSetAdministrator(fi)); - } - else if (IsDocVersion(dragNode)) - dvInfo = dragNode.VEObject as DocVersionInfo; - else if (IsProcedure(dragNode)) - dvInfo = (dragNode.VEObject as ProcedureInfo).MyDocVersion; - else if (IsSection(dragNode)) - dvInfo = (dragNode.VEObject as SectionInfo).MyDocVersion; - // Bug fix B2016-274 if an Admin user also had Reviewer or ROEditor settings, admin could not move the tree node - if (dvInfo != null) return (MyUserInfo.IsAdministrator() || MyUserInfo.IsSetAdministrator(dvInfo)) || MyUserInfo.IsWriter(dvInfo); - return false; - } - private static TreeNode GetTreeNodeFromData(IDataObject datobj) - { - foreach (string s in datobj.GetFormats()) - { - try - { - // B2021-006: dragging text from Microsoft Word onto the tree view was crashing PROMS - // This included dragging text from the Word doc editor within PROMS. Check object type: - Object tmp = datobj.GetData(s); - if (!(tmp is TreeNode)) return null; - return (TreeNode)datobj.GetData(s); - } - catch (Exception ex) - { - if (_MyLog.IsErrorEnabled) _MyLog.Error("GetTreeNodeFromData", ex); - } - } - return null; - } - private bool IsFolder(VETreeNode veTreeNode) - { - return (veTreeNode.VEObject.GetType() == typeof(FolderInfo)); - } - private void tv_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) - { - try - { - TreeNode dragNode = GetTreeNodeFromData(e.Data); - DragHelper.ImageList_DragLeave(this.Handle); - int index = _LastDropLocation.Index + (_LastDropLocation.Position == DropPosition.After ? 1 : 0); - int myIndex = index; - if (dragNode.Parent == _LastDropLocation.DropNode && dragNode.Index <= _LastDropLocation.Index) index--; - if (e.Effect == DragDropEffects.Move)// If Move Remove drag node from parent - dragNode.Remove(); - else - dragNode = Clone(dragNode); - _LastDropLocation.DropNode.Nodes.Insert(index, dragNode); - this.SelectedNode = dragNode; - FolderInfo fdragi = ((VETreeNode)dragNode).VEObject as FolderInfo; - FolderInfo fdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as FolderInfo; - if (fdragi != null && fdropi != null && fdropi.FolderDocVersionCount == 0) - { - using (Folder fdrag = fdragi.Get()) - { - using (Folder fdrop = fdropi.Get()) - { - fdrag.ManualOrder = fdropi.NewManualOrder(myIndex); - fdrag.MyParent = fdrop; - fdrag.Save(); - } - } - return; - } - // No drag/drop supported for document versions. - - // Allow drag/drop of procedures within a Document Version (must have same parent). Note that drop location - // may either be a document version or a procedure depending on where the user wants to position the procedure. - ProcedureInfo pdragi = ((VETreeNode)dragNode).VEObject as ProcedureInfo; - ProcedureInfo pdropi = null; - if (pdragi != null) // moving a procedure - { - pdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as ProcedureInfo; - if (pdropi != null && pdragi.ActiveParent == pdropi.ActiveParent) - { - pdragi.MoveProcedure(pdragi.ActiveParent, myIndex); - return; - } - DocVersionInfo dvdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as DocVersionInfo; - DocVersionInfo dvdragpar = pdragi.ActiveParent as DocVersionInfo; - if (dvdropi != null && dvdragpar.VersionID == dvdropi.VersionID) - { - pdragi.MoveProcedure(dvdropi, myIndex); - return; - } - } - - // Allow drag/drop of sections within the same procedure or same section (if subsection) (must have same parent) - SectionInfo sdragi = ((VETreeNode)dragNode).VEObject as SectionInfo; - SectionInfo sdropi = null; - if (sdragi != null) // moving a section - { - sdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as SectionInfo; - if (sdropi != null && sdragi.ActiveParent == sdropi.ActiveParent) - { - sdragi.MoveSection(sdragi, myIndex); - return; - } - pdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as ProcedureInfo; - if (pdropi != null && ((ItemInfo)(sdragi.ActiveParent)).ItemID == pdropi.ItemID) - { - sdragi.MoveSection(pdropi, myIndex); - sdragi.Moving = true; - OnNodeSelect(dragNode, new vlnTreeEventArgs(dragNode)); - return; - } - } - - // Allow drag/drop of steps within the same parent only - StepInfo stdragi = ((VETreeNode)dragNode).VEObject as StepInfo; - StepInfo stdropi = null; - if (stdragi != null) // moving a step - { - stdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as StepInfo; - if (stdropi != null && stdragi.ActiveParent == stdropi.ActiveParent) - { - stdragi.MoveStep(stdragi.ActiveParent, myIndex); - return; - } - sdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as SectionInfo; - if (sdropi != null && stdragi.MyParent.ItemID == sdropi.ItemID) - { - stdragi.MoveStep(stdragi.ActiveParent, myIndex); - return; - } - // the following handles items under the app nodes of 'steps', 'notes', 'cautions', etc. - if (sdropi == null && dragNode.Parent == _LastDropLocation.DropNode) - { - stdragi.MoveStep(stdragi.ActiveParent, myIndex); - return; - } - } - } - catch (Exception ex) - { - if (_MyLog.IsErrorEnabled) _MyLog.Error("tv_DragDrop", ex); - } - } - // private void DumpMembers(object o) - // { - // Type t = o.GetType(); - // //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("\r\n\r\nMembers for type {0}", t.ToString()); - // MemberInfo[] mis = t.GetMembers(); - // int i = 0; - // foreach (MemberInfo mi in mis) - // { - // i++; - // try - // { - // //if(mi.MemberType != MemberTypes.Method) - // //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0} {1} {2}", i, mi.Name, mi.MemberType); - //// if (fi.Name == "TreeView") - //// fi.SetValue(o, null); - // } - // catch (Exception ex) - // { - // if(_MyLog.IsErrorEnabled)_MyLog.Error("DumpMembers", ex); - // } - // } - // } - private TreeNode Clone(TreeNode tn) - { - - TreeNode tmp = (TreeNode)tn.Clone(); - ExpandMatch(tmp, tn); - return tmp; - } - private void tv_DragDropOld(object sender, System.Windows.Forms.DragEventArgs e) - { - TreeNode dragNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");// Get the drag node - DragHelper.ImageList_DragLeave(this.Handle); - TreeNode cloneNode = (TreeNode)dragNode.Clone();// copy the source node - ExpandMatch(cloneNode, dragNode); - _LastDropLocation.DropNode.Nodes.Insert(_LastDropLocation.Index + (_LastDropLocation.Position == DropPosition.After ? 1 : 0), cloneNode); - if (e.Effect == DragDropEffects.Move)// If Move Remove drag node from parent - dragNode.Remove(); - this.SelectedNode = cloneNode; - } - private void tv_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) - { - DragHelper.ImageList_DragEnter(this.Handle, e.X - this.Left, e.Y - this.Top); - } - private void tv_DragLeave(object sender, System.EventArgs e) - { - DragHelper.ImageList_DragLeave(this.Handle); - this.Refresh(); - } - private void ExpandMatch(TreeNode tn1, TreeNode tn2) - { - if (tn2.IsExpanded) tn1.Expand(); - foreach (TreeNode tc in tn2.Nodes) ExpandMatch(tn1.Nodes[tc.Index], tc); - } - private bool IsChild(TreeNode parent, TreeNode child) - { - if (parent.Equals(child)) return true;// Check against self - foreach (TreeNode tc in parent.Nodes) if (IsChild(tc, child)) return true;//Check all children - return false;// Must not be a child at this level - } - #endregion - private bool _AdjustingTree = false; - public void AdjustTree(ItemInfo selectedItem) - { - // start at the top parent and walk down the nodes to find child - if (selectedItem == null) return; - VETreeNode node = FindNodeAndExpand(selectedItem); - if (node != null) - { - _AdjustingTree = true; - this.SelectedNode = node; - _AdjustingTree = false; - } - } - public VETreeNode FindNodeAndExpand(IVEDrillDownReadOnly selectedItem) - { - if (selectedItem.ActiveParent == null) - { - return (VETreeNode)this.Nodes[0]; // Return the top node - } - if (selectedItem == ((VETreeNode)this.Nodes[0]).VEObject) return (VETreeNode)this.Nodes[0]; // C2015-022 check needed for tree in child windows - VETreeNode parent = FindNodeAndExpand(selectedItem.ActiveParent); - if (parent == null) return null; - if (!parent.IsExpanded) - parent.Expand(); - VETreeNode child = GetChildNode(selectedItem, parent); - if (child != null) - return child; - parent.ChildrenLoaded = false; - parent.RefreshNode(); - child = GetChildNode(selectedItem, parent); - return child; - } - public VETreeNode FindNode(IVEDrillDownReadOnly selectedItem, TreeNodeCollection tnc) - { - foreach (TreeNode tn in tnc) - if (tn is VETreeNode) - { - if ((tn as VETreeNode).VEObject is ItemInfo && (selectedItem is ItemInfo) && ((tn as VETreeNode).VEObject as ItemInfo).ItemID == (selectedItem as ItemInfo).ItemID) - return tn as VETreeNode; - else - { - VETreeNode cn = FindNode(selectedItem, tn.Nodes); - if (cn != null) - return cn; - } - } - return null; - } - public VETreeNode RefreshRelatedNode(IVEDrillDownReadOnly selectedItem) - { - Console.WriteLine("vlntreeview:refreshrelatednote:start"); - VETreeNode child = FindNode(selectedItem, this.Nodes); - if (child == null) return null; - if (!child.IsExpanded) - child.Expand(); - child.ChildrenLoaded = false; - child.RefreshNode(); - Console.WriteLine("vlntreeview:refreshrelatednote:end"); - return child; - } - // B2021-066: refresh the procedure numbers within Working Draft (docversion) for applicability changed - public void RefreshDocVersion() - { - VETreeNode vetn = SelectedNode as VETreeNode; - if (vetn != null) - { - DocVersionInfo dvi = vetn.VEObject as DocVersionInfo; - if (dvi != null) - { - if (SelectedNode.Nodes != null && SelectedNode.Nodes.Count > 0 && SelectedNode.Nodes[0] is VETreeNode) - { - foreach (VETreeNode tn in SelectedNode.Nodes) - { - tn.RefreshNode(); - } - } - } - } - } - private VETreeNode GetChildNode(IVEDrillDownReadOnly selectedItem, VETreeNode parent) - { - foreach (TreeNode childNode in parent.Nodes) - { - VETreeNode child = childNode as VETreeNode; - if (child != null && CompareVEObject(child.VEObject, selectedItem)) - return child; - } - foreach (TreeNode childNode in parent.Nodes) - { - VETreeNode child = childNode as VETreeNode; - if (child.VEObject is PartInfo) - foreach (VETreeNode grandchild in child.Nodes) - if (CompareVEObject(grandchild.VEObject, selectedItem)) - return grandchild; - } - return null; - } - public bool CompareVEObject(IVEDrillDownReadOnly obj1, IVEDrillDownReadOnly obj2) - { - if (obj1.GetType().Name != obj2.GetType().Name) - { - // see if both can be cast as ItemInfo, because 1st check may be comparing ItemInfo & ProcedureInfo and returns - // false even though they are same base object type (fixes bug B2016-094) - ItemInfo ii1 = obj1 as ItemInfo; - ItemInfo ii2 = obj2 as ItemInfo; - if (ii1 == null || ii2 == null) return false; - } - ItemInfo myItem = obj1 as ItemInfo; - if (myItem != null) - if (myItem.ItemID == ((ItemInfo)obj2).ItemID) return true; - DocVersionInfo myDV = obj1 as DocVersionInfo; - if (myDV != null) - if (myDV.VersionID == ((DocVersionInfo)obj2).VersionID) return true; - FolderInfo myFolder = obj1 as FolderInfo; - if (myFolder != null) - if (myFolder.FolderID == ((FolderInfo)obj2).FolderID) return true; - return false; - } - - //C2021-035 Add Refresh Tree Option at highest level - public void RefreshTree() - { - //reload the base node - VETreeNode tbase = (VETreeNode) Nodes[0]; - tbase.ChildrenLoaded = false; - - //Refresh the formats - OnRefreshFormats(true, "Refreshing Formats"); - - //reset the procedure lists so db is re-queried in case they changed - //also clear other caches in case added steps / sections / etc... - PartInfo.ClearPartInfoCache(); - ItemInfo.ClearItemInfoCache(); - DocVersionInfo.ResetAllProcedures(); - FolderInfo.ClearFolderInfoCache(); - - //Refresh the base VEPROMS object - var fldr = tbase.VEObject as FolderInfo; - if (fldr != null) - { - Invoke((Action)(() => { tbase.VEObject = FolderInfo.Get(fldr.FolderID); })); - } - - //refresh the tree - Invoke((Action)(() => { tbase.RefreshNode(); })); - this.Invoke((Action)(() => { this.Update(); })); - } - - } - #region DragHelper - public class DragHelper - { - [DllImport("comctl32.dll")] - public static extern bool InitCommonControls(); - - [DllImport("comctl32.dll", CharSet = CharSet.Auto)] - public static extern bool ImageList_BeginDrag(IntPtr himlTrack, int - iTrack, int dxHotspot, int dyHotspot); - - [DllImport("comctl32.dll", CharSet = CharSet.Auto)] - public static extern bool ImageList_DragMove(int x, int y); - - [DllImport("comctl32.dll", CharSet = CharSet.Auto)] - public static extern void ImageList_EndDrag(); - - [DllImport("comctl32.dll", CharSet = CharSet.Auto)] - public static extern bool ImageList_DragEnter(IntPtr hwndLock, int x, int y); - - [DllImport("comctl32.dll", CharSet = CharSet.Auto)] - public static extern bool ImageList_DragLeave(IntPtr hwndLock); - - [DllImport("comctl32.dll", CharSet = CharSet.Auto)] - public static extern bool ImageList_DragShowNolock(bool fShow); - static DragHelper() - { - InitCommonControls(); - } - } - #endregion -} diff --git a/PROMS/Volian.Controls.Library/vlnTreeView3.Designer.cs b/PROMS/Volian.Controls.Library/vlnTreeView3.Designer.cs deleted file mode 100644 index 5ef609d4..00000000 --- a/PROMS/Volian.Controls.Library/vlnTreeView3.Designer.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Volian.Controls.Library -{ - partial class vlnTreeView3 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - } - - #endregion - } -} diff --git a/PROMS/Volian.Controls.Library/vlnTreeView3.cs b/PROMS/Volian.Controls.Library/vlnTreeView3.cs deleted file mode 100644 index 7c2d2b19..00000000 --- a/PROMS/Volian.Controls.Library/vlnTreeView3.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Text; -using System.Windows.Forms; -using VEPROMS.CSLA.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 - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #region Events - public event vlnTreeViewEvent NodeSelectionChange; - private void OnNodeSelectionChange(object sender, vlnTreeEventArgs args) - { - if (NodeSelectionChange != null) NodeSelectionChange(sender, args); - } - #endregion - #region Business Methods - #endregion - #region Constructors - public vlnTreeView3() - { - InitializeComponent(); - base.AfterSelect += new TreeViewEventHandler(tv_AfterSelect); - } - private void tv_AfterSelect(object sender, TreeViewEventArgs e) - { - OnNodeSelectionChange(sender, new vlnTreeEventArgs(e.Node)); - } - #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) - { - if (tn2.IsExpanded) tn1.Expand(); - foreach (TreeNode tc in tn2.Nodes) ExpandMatch(tn1.Nodes[tc.Index], tc); - } - private bool IsChild(TreeNode parent, TreeNode child) - { - if (parent.Equals(child)) return true;// Check against self - foreach (TreeNode tc in parent.Nodes) if (IsChild(tc, child)) return true;//Check all children - return false;// Must not be a child at this level - } - } -} diff --git a/PROMS/Volian.Pipe.Library/AssemblyInfo.cs b/PROMS/Volian.Pipe.Library/AssemblyInfo.cs deleted file mode 100644 index 8c130f4b..00000000 --- a/PROMS/Volian.Pipe.Library/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Volian.Pipe.Library")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Volian.Pipe.Library")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("08f1c830-b1ee-4978-905e-103b02cc4254")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PROMS/Volian.Pipe.Library/PipeClient.cs b/PROMS/Volian.Pipe.Library/PipeClient.cs deleted file mode 100644 index 502badb0..00000000 --- a/PROMS/Volian.Pipe.Library/PipeClient.cs +++ /dev/null @@ -1,66 +0,0 @@ -/********************************************************************************************* - * Copyright 2016 - Volian Enterprises, Inc. All rights reserved. - * Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE - *********************************************************************************************/ -using System; -using System.Collections.Generic; -using System.IO.Pipes; -//using System.Linq; -using System.Text; -//using System.Threading.Tasks; - -namespace Volian.Pipe.Library -{ - public class PipeClient - { - private string _Name; - public string Name - { - get { return _Name; } - set { _Name = value; } - } - private int _TimeOut = 1000; - public int TimeOut - { - get { return _TimeOut; } - set { _TimeOut = value; } - } - public PipeClient(string name) - { - _Name = name; - } - public void Send(string msg) - { - try - { - NamedPipeClientStream pipeStream = new NamedPipeClientStream(".", Name, PipeDirection.Out, PipeOptions.Asynchronous); - // The connect function will indefinitely wait for the pipe to become available - // If that is not acceptable specify a maximum waiting time (in ms) - pipeStream.Connect(TimeOut); - byte[] _buffer = Encoding.UTF8.GetBytes(msg); - pipeStream.BeginWrite(_buffer, 0, _buffer.Length, AsyncSend, pipeStream); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - } - } - private void AsyncSend(IAsyncResult iar) - { - try - { - // Get the pipe - NamedPipeClientStream pipeStream = (NamedPipeClientStream)iar.AsyncState; - // End the write - pipeStream.EndWrite(iar); - pipeStream.Flush(); - pipeStream.Close(); - pipeStream.Dispose(); - } - catch (Exception oEX) - { - Console.WriteLine(oEX.Message); - } - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Pipe.Library/PipeServer.cs b/PROMS/Volian.Pipe.Library/PipeServer.cs deleted file mode 100644 index 197d7a9d..00000000 --- a/PROMS/Volian.Pipe.Library/PipeServer.cs +++ /dev/null @@ -1,80 +0,0 @@ -/********************************************************************************************* - * Copyright 2016 - Volian Enterprises, Inc. All rights reserved. - * Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE - *********************************************************************************************/ -using System; -using System.Collections.Generic; -using System.IO.Pipes; -using System.Linq; -using System.Text; -//using System.Threading.Tasks; - -namespace Volian.Pipe.Library -{ - // Delegate for passing received message back to caller - public delegate void DelegateMessage(string Reply); - public class PipeServer - { - private string _Name; - public string Name - { - get { return _Name; } - set { _Name = value; } - } - public PipeServer(string name) - { - _Name = name; - } - public event DelegateMessage PipeMessage; - string _pipeName; - public void Listen() - { - try - { - // Create the new async pipe - NamedPipeServerStream pipeServer = new NamedPipeServerStream(Name, PipeDirection.In, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous); - // Wait for a connection - pipeServer.BeginWaitForConnection(WaitForConnectionCallBack, pipeServer); - } - catch (Exception oEX) - { - Console.WriteLine(oEX.Message); - } - } - private void WaitForConnectionCallBack(IAsyncResult iar) - { - try - { - Console.WriteLine("========WaitForConnectionCallBack========\r\n"); - // Get the pipe - NamedPipeServerStream pipeServer = (NamedPipeServerStream)iar.AsyncState; - // End waiting for the connection - pipeServer.EndWaitForConnection(iar); - byte[] buffer = new byte[4096]; - // Read the incoming message - int bytecount = 4096; - StringBuilder sb = new StringBuilder(); - while (bytecount == 4096) - { - bytecount = pipeServer.Read(buffer, 0, 4096); - // Convert byte buffer to string - string stringData = Encoding.UTF8.GetString(buffer, 0, bytecount); - sb.Append(stringData); - } - // Pass message back to calling form - PipeMessage.Invoke(sb.ToString()); - // Kill original sever and create new wait server - pipeServer.Close(); - pipeServer = null; - //pipeServer = new NamedPipeServerStream(_pipeName, PipeDirection.In, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous); - //// Recursively wait for the connection again and again.... - //pipeServer.BeginWaitForConnection(new AsyncCallback(WaitForConnectionCallBack), pipeServer); - Listen(); - } - catch - { - return; - } - } - } -} \ No newline at end of file diff --git a/PROMS/Volian.Pipe.Library/Properties/AssemblyInfo.cs b/PROMS/Volian.Pipe.Library/Properties/AssemblyInfo.cs deleted file mode 100644 index 8c130f4b..00000000 --- a/PROMS/Volian.Pipe.Library/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Volian.Pipe.Library")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Volian.Pipe.Library")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("08f1c830-b1ee-4978-905e-103b02cc4254")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PROMS/Volian.Pipe.Library/Volian.Pipe.Library.csproj b/PROMS/Volian.Pipe.Library/Volian.Pipe.Library.csproj deleted file mode 100644 index 788d4651..00000000 --- a/PROMS/Volian.Pipe.Library/Volian.Pipe.Library.csproj +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Debug - AnyCPU - {2BD7D42A-A8F6-4DEA-BDCA-5F4D58C6140F} - Library - Properties - Volian.Pipe.Library - Volian.Pipe.Library - v4.8.1 - 512 - - "%24/PROMS/Volian.Pipe.Library", RQGAAAAA - . - - MSSCCI:Microsoft Visual SourceSafe - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - x64 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - x64 - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - false - - - bin\Debug\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - false - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Print.Library/CPSGen.cs b/PROMS/Volian.Print.Library/CPSGen.cs deleted file mode 100644 index 3aa6491c..00000000 --- a/PROMS/Volian.Print.Library/CPSGen.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using VEPROMS.CSLA.Library; - -namespace Volian.Print.Library -{ - public class CPSGen - { - private vlnParagraph _MyVlnParagraph; - public vlnParagraph MyVlnParagraph - { - get { return _MyVlnParagraph; } - set { _MyVlnParagraph = value; } - } - public CPSGen(vlnParagraph myParagraph) - { - _MyVlnParagraph = myParagraph; - } - public void Generate(string fileName) - { - XmlDocument xd = new XmlDocument(); - XmlElement parent = xd.AppendChild(xd.CreateElement("Items")) as XmlElement; - Generate(0, 0,parent, MyVlnParagraph); - xd.Save(fileName); - } - public void Generate(int level,int fromType,XmlElement parent, vlnParagraph para) - { - ItemInfo itm = para.MyItemInfo; - XmlElement xe = parent.AppendChild(parent.OwnerDocument.CreateElement("Item")) as XmlElement; - AddAttribute(xe, "Level", level); - AddAttribute(xe, "FromType", fromType); - AddAttribute(xe, "Ordinal", itm.Ordinal); - AddAttribute(xe, "ParentID", (itm.ActiveParent as ItemInfo).ItemID); - //AddAttribute(xe, "Xoffset", para.XOffset); - AddAttribute(xe, "ItemID", itm.ItemID); - AddAttribute(xe, "PreviousID", itm.PreviousID); - AddAttribute(xe, "ContentID", itm.ContentID); - AddAttribute(xe, "DTS", itm.MyContent.DTS); - AddAttribute(xe, "UserID", itm.MyContent.UserID); - AddAttribute(xe, "Number", itm.MyContent.Number); - AddAttribute(xe, "Text", itm.MyContent.Text); - AddAttribute(xe, "Type", itm.MyContent.Type); - AddAttribute(xe, "FormatID", itm.MyContent.FormatID); - AddAttribute(xe, "Config", itm.MyContent.Config); - 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, "ChildrenLeft", para.ChildrenLeft); - AddChildren(level,0, parent, "ChildrenRight", para.ChildrenRight); - AddChildren(level,0, parent, "ChildrenBelow", para.ChildrenBelow); - } - private void AddChildren(int level, int fromType, XmlElement parent, string name, vlnParagraphs children) - { - if (children == null || children.Count == 0) return; - //XmlElement xchildren = xe.OwnerDocument.AppendChild(xe.OwnerDocument.CreateElement(name)) as XmlElement; - foreach(vlnParagraph child in children) - { - //XmlElement xechild = xe.ParentNode.AppendChild(xe.OwnerDocument.CreateElement("Item")) as XmlElement; - 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) - { - if (val == null) return; - XmlAttribute xa = xe.OwnerDocument.CreateAttribute(attr); - xa.Value = val.ToString(); - xe.Attributes.Append(xa); - } - } -} diff --git a/PROMS/Volian.Print.Library/CompleteRORpt.cs b/PROMS/Volian.Print.Library/CompleteRORpt.cs deleted file mode 100644 index f43a37e1..00000000 --- a/PROMS/Volian.Print.Library/CompleteRORpt.cs +++ /dev/null @@ -1,1167 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using System.IO; -using System.Windows.Forms; -using iTextSharp.text.pdf; -using iTextSharp.text; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; -using VlnStatus; - - -namespace Volian.Print.Library -{ - class CompleteROReport - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - //Dictionary _MyErrorBookMarks = new Dictionary(); - Headers Hdrs; // Header stack object. - RODataFile RO_df = null; - int curheaderlen; - string RODataFileName; - iTextSharp.text.Document _pdfReportDoc = null; - PdfPTable datatable = null; - - private iTextSharp.text.Font _f14; // = pdf.GetFont("Arial Unicode MS", 14, 1, Color.BLACK); - - public iTextSharp.text.Font F14 - { - get { return _f14; } - set { _f14 = value; } - } - private iTextSharp.text.Font _f10; - - public iTextSharp.text.Font F10 - { - get { return _f10; } - set { _f10 = value; } - } - private iTextSharp.text.Font _f12; - - public iTextSharp.text.Font F12 - { - get { return _f12; } - set { _f12 = value; } - } - private iTextSharp.text.Font _f10Bold; - - public iTextSharp.text.Font F10Bold - { - get { return _f10Bold; } - set { _f10Bold = value; } - } - private iTextSharp.text.Font _f12Bold; - - public iTextSharp.text.Font F12Bold - { - get { return _f12Bold; } - set { _f12Bold = value; } - } - - private bool _ConvertCaretToDelta = true; - - public bool ConvertCaretToDelta - { - get { return _ConvertCaretToDelta; } - 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) - { - Hdrs = new Headers(); - _pdfReportDoc = document; - RODataFileName = dataFileName; - _ConvertCaretToDelta = convertCaretToDelta; - _MyPDFWriter = mypdfwriter; - _IncludeEmptyROFields = includeEmptyROFields; - } - public void StartNewDataTable() - { - datatable = new PdfPTable(1); - datatable.TotalWidth = _pdfReportDoc.PageSize.Width - _pdfReportDoc.LeftMargin - _pdfReportDoc.RightMargin; - datatable.LockedWidth = true; - PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, F14)); - cell.HorizontalAlignment = Element.ALIGN_CENTER; - cell.BackgroundColor = Color.WHITE; - cell.BorderColor = Color.WHITE; - datatable.AddCell(cell); - datatable.HeaderRows = 3; - datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; - } - public void Run() - { - StartNewDataTable(); - RO_df = new RODataFile(RODataFileName); - PrintReport(); - RO_df.close(); - } - private Dictionary _MyDocOutline = new Dictionary(); - - internal Dictionary MyDocOutline - { - get { return _MyDocOutline; } - set { _MyDocOutline = value; } - } - public class DocOutline - { - private PdfOutline _MyOutline; - - public PdfOutline MyOutline - { - get { return _MyOutline; } - set { _MyOutline = value; } - } - private string _MyHeader; - - public string MyHeader - { - get { return _MyHeader; } - set { _MyHeader = value; } - } - public DocOutline(PdfOutline outline, string header) - { - _MyHeader = header; - _MyOutline = outline; - } - } - private string ReplaceLineDrawCharsWithUnicode(string text) - { - text = text.Replace("\xc4", "\x2500"); // Horizontal - text = text.Replace("\xb3", "\x2502"); // Vertical - text = text.Replace("\xc0", "\x2514"); // Bottom Left Corner - text = text.Replace("\xd9", "\x2518"); // Bottom Right Corner - text = text.Replace("\xc1", "\x2534"); // Bottom Tee - text = text.Replace("\xda", "\x250c"); // Upper Left Corner - text = text.Replace("\xc3", "\x251c"); // Left Tee - text = text.Replace("\xbf", "\x2510"); // Upper Right Corner - text = text.Replace("\xc2", "\x252c"); // Top Tee - text = text.Replace("\xb4", "\x2524"); // Right Tee - text = text.Replace("\xc5", "\x253c"); // Plus - return text; - } - public Phrase ConvertDOSSuperAndSubScripts(string instr, Font fnt) - { - int idx = 0; - Chunk chk; - Phrase p = new Phrase(); - bool underlineChunk = false; - instr = instr.Replace("`", "\u00B0"); //degree - 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) - { - //char[] ca = instr.ToCharArray(); // for debug - instr = instr.Replace("^", "\u0394"); // delta - } - //instr = instr.Replace("\x94", "\u0394"); // delta - the delta symbol is being read in as character x94 - instr = ReplaceLineDrawCharsWithUnicode(instr); - // Handle super/sub scripts - MatchCollection mc = Regex.Matches(instr, "[#~](.*?)[#~]"); - foreach (Match m in mc) - { - if (idx < m.Index) - { - int strlen = m.Index - idx; - int uidx = 0; - string strChk = instr.Substring(idx, strlen); - MatchCollection mc1 = Regex.Matches(strChk, "[_](.*?)"); // look ofr Underline on/off - foreach (Match m1 in mc1) - { - if (uidx < m1.Index) - { - string tstr = (instr.Substring(idx+uidx, m1.Index - uidx)); - if (tstr.EndsWith(" ")) - tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0"; - chk = new Chunk(tstr, fnt); - if (underlineChunk) - chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); - chk.SetTextRise(0); - p.Add(chk); - uidx += (tstr.Length + 1); - idx += (tstr.Length + 1); - strlen -= (tstr.Length + 1); - underlineChunk = !underlineChunk; - } - else if (uidx == m1.Index) - { - uidx++; - underlineChunk = !underlineChunk; - } - } - chk = new Chunk(instr.Substring(idx, strlen), fnt); - if (underlineChunk) - chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); - chk.SetTextRise(0); - p.Add(chk); - } - switch (m.Value[0]) - { - case '#': - chk = new Chunk(m.Value.Substring(1, m.Length-2), fnt); - if (underlineChunk) - chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); - chk.SetTextRise(.25F * chk.Font.Size); - p.Add(chk); - idx = m.Index + m.Length; - break; - case '~': - chk = new Chunk(m.Value.Substring(1, m.Length-2), fnt); - if (underlineChunk) - chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); - chk.SetTextRise(-.25F * chk.Font.Size); - p.Add(chk); - idx = m.Index + m.Length; - break; - } - } - if (idx <= instr.Length - 1) - { - int uidx = 0; - string strChk = (instr.Substring(idx)); - if (!_LastWasName) //B2016-251 Don't change underscore to underline to Name value - { - MatchCollection mc1 = Regex.Matches(strChk, "[_](.*?)"); // look for underline on/off - foreach (Match m1 in mc1) - { - if (uidx < m1.Index) - { - string tstr = (strChk.Substring(uidx, m1.Index - uidx)); - if (tstr.EndsWith(" ")) - tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0"; - chk = new Chunk(tstr, fnt); - if (underlineChunk) - chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); - chk.SetTextRise(0); - p.Add(chk); - uidx += (tstr.Length + 1); - underlineChunk = !underlineChunk; - } - else if (uidx == m1.Index) - { - uidx++; - underlineChunk = !underlineChunk; - } - } - } - if (uidx <= strChk.Length - 1) - { - string tstr = strChk.Substring(uidx); - if (tstr.EndsWith(" ")) - tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0"; - chk = new Chunk(tstr, fnt); - if (underlineChunk) - chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); - chk.SetTextRise(0); - p.Add(chk); - } - } - - return p; - } - - public void AddText(string txt, Font fnt) - { - AddText(txt, fnt, Color.BLACK); - } - - public void AddText(string txt, Font fnt, Color txtcolor) - { - // break the text up on double returns (paragraphs) and put each in their own cell - // this will allow for page breaks between paragraphs0 - string[] delim = { "\r\n\r\n","\r\n \r\n" }; - string[] strlst = txt.Split(delim,StringSplitOptions.None); - foreach (string str in strlst) - { - Font f = new Font(fnt); - f.Color = txtcolor; - PdfPCell cell = new PdfPCell(ConvertDOSSuperAndSubScripts(str, f)); - cell.BorderColor = Color.WHITE; - if (strlst.Length > 1) - cell.PaddingBottom = 6; - datatable.AddCell(cell); - } - } - - public void AddImage(string filename) - { - ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(_ROFstID, filename); - if (roImage == null) roImage = ROFstInfo.Get(_ROFstID).GetROImageByFilename(filename, null); - PdfPCell spaceCell = new PdfPCell(); - spaceCell.BorderColor = Color.WHITE; - datatable.AddCell(spaceCell); - if (roImage != null) - { - ROImageConfig rc = new ROImageConfig(roImage); - int size = Convert.ToInt32(rc.Image_Size); - byte[] cnt = roImage.Content; - byte[] dcnt = ROImageInfo.Decompress(cnt, size); - iTextSharp.text.Image it_image; - try - { - it_image = iTextSharp.text.Image.GetInstance(dcnt); - //iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(ROImageInfo.Decompress(roImage.Content, size)); - } - catch (Exception ex) - { - try - { - MemoryStream ms = new MemoryStream(dcnt); - System.Drawing.Bitmap bm = new System.Drawing.Bitmap(ms); - using (MemoryStream ms2 = new MemoryStream()) - { - bm.Save(ms2, System.Drawing.Imaging.ImageFormat.Png); - ms2.Seek(0, SeekOrigin.Begin); - byte[] newdcnt = new byte[ms2.Length]; - ms2.Read(newdcnt, 0, (int)ms2.Length); - it_image = iTextSharp.text.Image.GetInstance(newdcnt); - } - } - catch (Exception ex2) - { - AddText(string.Format("Bad Image File: {0}", filename), F12, Color.RED); - GenerateErrorMessage(ex2, "Bad Image File. ", string.Format("Image File: {0}", filename)); - roImage.Dispose(); - return; - } - } - it_image.ScaleToFit(_MyPDFWriter.DirectContent.PdfDocument.PageSize.Width - 144, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height - 216); - PdfPCell cell = new PdfPCell(it_image); - cell.BorderColor = Color.WHITE; - datatable.AddCell(cell); - roImage.Dispose(); - } - else - { - AddText(string.Format("Image File {0} is missing.", filename), F12, Color.RED); - GenerateErrorMessage(null, "Image File Missing. ", string.Format("Image File: {0}", filename)); - Application.DoEvents(); - } - } - - public void AddXYPlot(string plotlang) - { - string pngFile = VlnSettings.TemporaryFolder + @"\XYPlot1.png"; - string rawPlotLang = plotlang; - plotlang = plotlang.Replace("`", "\xB0"); //degree - plotlang = plotlang.Replace("\xF8", "\xB0"); //degree - if (ConvertCaretToDelta) - plotlang = plotlang.Replace("^", "\x394"); // delta - plotlang = plotlang.Replace("\x7F", "\x394"); //delta - PdfPCell spaceCell = new PdfPCell(); - spaceCell.BorderColor = Color.WHITE; - datatable.AddCell(spaceCell); - try - { - System.Drawing.RectangleF plotRect = MSWordToPDF.CreatePlot(pngFile, plotlang, 600F, MSWordToPDF.FormForPlotGraphics); - 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); - PdfPCell cell = new PdfPCell(it_image); - cell.BorderColor = Color.WHITE; - datatable.AddCell(cell); - } - catch (Exception e) - { - AddText("-- Error Processing X/Y Plot Language --",F12,Color.RED); - datatable.AddCell(spaceCell); - AddText(rawPlotLang, F10); - GenerateErrorMessage(null, "Error Processing X/Y Plot Lanuage. ", e.Message); - } - } - - private string processingRO = ""; - private string _MyROID = null; - public string MyROID - { - get { return _MyROID; } - set { _MyROID = value; } - } - - public void PrintReport() - { - bool StopPrinting = false; - bool UserTerminate = false; - Int16 iRecType = 0; - VlnStatusBar showStatBar = new VlnStatusBar("Complete RO Report"); - try - { - if (RO_df.GetFileLength() > 0) - { - showStatBar.BarMax = (int)RO_df.GetFileLength(); - showStatBar.StatMsg = "Creating Report"; - // Loop until either printing is aborted or end of file. - while (!StopPrinting && (iRecType = RO_df.ReadInteger16()) != -1) - { - //Console.WriteLine("Record Type: {0}.{0:X}", iRecType); - switch (iRecType) - { - case 1: // Set Header - SetHeader(); - break; - case 2: // Push Header - PushHeader(); - break; - case 3: // Pop Header - PopHeader(); - break; - case 4: // RRO Begin - RROBegin(); - break; - case 5: // RRO End - RROEnd(); - processingRO = ""; - break; - case 6: // Msg - Msg(); - break; - case 7: - processingRO = KeyField(); - break; - case 8: - MyROID = ROIDField(); - break; - case 100: // Text Field - sometimes also XY Plot - Text(); - Application.DoEvents(); - break; - case 101: // Plot Field - XYPlot(); - Application.DoEvents(); - break; - case 102: // Image Field - ImageFile(); - Application.DoEvents(); - break; - case 103: // Multi Begin - Display data for setpoints - Multiple(); - break; - case 104: // Multi End - break; - case 0: // nothing was entered in that field - if (_IncludeEmptyROFields) - NoInformatEntered(); - break; - case 255: - _pdfReportDoc.Add(datatable); - _pdfReportDoc.NewPage(); - StartNewDataTable(); - showStatBar.BarValue = (int)RO_df.GetFilePointerPosition(); - //Console.WriteLine("Record Type: {0} No Operation", iRecType); - //Console.WriteLine("----------------------------------------------"); - break; - default: // Problem - //Console.WriteLine("Record Type: {0} Unrecognized record type", iRecType); - StopPrinting = true; - UserTerminate = true; - MessageBox.Show(string.Format("Unrecognized record type [{0}]", iRecType), "Error Creating Complete RO Report", MessageBoxButtons.OK, MessageBoxIcon.Error); - break; - }; - } - } - else - { - StartNewDataTable(); - datatable.HeaderRows = 1; - AddText("Selected Referenced Object has no data.", F12); - } - //Console.WriteLine("Record Type: {0}\n** Done **", iRecType); - _pdfReportDoc.Add(datatable); - showStatBar.Dispose(); - - } - catch (Exception e) - { - Console.WriteLine("Exception : {0}", e.Message); - RO_df.close(); - _pdfReportDoc.Add(datatable); - showStatBar.Dispose(); - GenerateErrorMessage(e, "Error Processing Complete RO Report. ", null); - } - AddErrorBookmarks(); - return; - } - - private void GenerateErrorMessage( Exception e, string erMsg, string erMsg2) - { - // if there is lenght then we are in the mist of processing an RO - string headers = erMsg; - for (int iLoop = 0; iLoop < Hdrs.HdrCnt; iLoop++) - headers += Hdrs.strHdrs[iLoop] + "\n "; - if (processingRO.Length > 0) - headers += processingRO; - if (erMsg2 != null && erMsg2.Length > 0) - headers += "\n" + erMsg2; - //MessageBox.Show(headers, erMsg, MessageBoxButtons.OK, MessageBoxIcon.Error); - if (e != null) - _MyLog.Error(headers, e); - else - _MyLog.Error(headers); - PdfOutline outl = new PdfOutline(MyErrorOutline, MyPdfDestPage, processingRO.Length > 0 ? processingRO : "Problem Reading Header"); - //DestSample(outl); - } - - //private void DestSample(PdfOutline outl) - //{ - // new PdfOutline(outl, new PdfDestination(PdfDestination.FIT), "FIT"); - // new PdfOutline(outl, new PdfDestination(PdfDestination.FITV, 700), "FITV,700"); - // new PdfOutline(outl, new PdfDestination(PdfDestination.FITH, 700), "FITH,700"); - // new PdfOutline(outl, new PdfDestination(PdfDestination.XYZ, 72, 720, 5), "XYZ,72,720,5"); - // new PdfOutline(outl, new PdfDestination(PdfDestination.FITR, 72, 650, 144, 722), "FITR,72, 650, 144, 722"); - // new PdfOutline(outl, new PdfDestination(PdfDestination.XYZ, 72, 720, 10), "XYZ,72,720,10"); - // new PdfOutline(outl, new PdfDestination(PdfDestination.FITR, 0, 500, _pdfReportDoc.PageSize.Width, 720), "FITR,0, 500,_pdfReportDoc.PageSize.Width , 720"); - // new PdfOutline(outl, new PdfDestination(PdfDestination.XYZ, 0, 792, 1), "XYZ,72,720,10"); - //} - - public void AddErrorBookmarks() - { - 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."; - MessageBox.Show(emsg, "Errors Found Creating Report", MessageBoxButtons.OK, MessageBoxIcon.Information); - - } - public void Multiple() - { - Int16 typ, i, j, nw = 0; - string str, sep; - string buff = ""; - int[] width; - LastHeader(); - sep = ""; - // nw - number of fields - nw = RO_df.ReadInteger16(); - // allocate space for widths - width = new int[nw]; - // loop through and load field widths and names - for (i = 0; i < nw; i++) - { - // load width - width[i] = RO_df.ReadInteger16(); - // load name - str = RO_df.ReadText(); - // how wide is the header - int wtxt = str.Length; - buff += sep; - buff += str; - // if the width is wider than the header output spaces to pad - // to specified width - if (width[i] > wtxt) - { - int extra = width[i] - wtxt; - while (extra > 0) - { - buff += " "; - extra--; - } - // otherwise set the width to the width of the header - } - else - { - width[i] = wtxt; - } - // place a vertical bar between fields - sep = "|"; - } - sep = "\n"; - buff += "\n"; - // place horizonal bars between the header and the values - for (i = 0; i < nw; i++) - { - for (j = 0; j < width[i]; j++) - { - buff += "-"; - } - if (i < nw - 1) - buff += "|"; - } - i = 0; - // While not the end of multi - while ((typ = RO_df.ReadInteger16()) != 104) - { - if (typ == 0) - {// Next row - sep = "\n"; // set the separator (between rows) to a newline - i = 0; - } - else - {// more for this row - // get the data - str = RO_df.ReadText(); - // if first time output a newline otherwise output a vertical - // bar between values - buff += sep; - // output value - if (str != null) - buff += str; - // set the separator to a vertical bar - sep = "|"; - if (width[i] > 0) - { - int jj; - jj = width[i] - str.Length; - // pad the value to the specified width - while (jj > 0) - { - buff += " "; - jj--; - } - } - i++; - - } - } - // output the table - PutHeaderAndText(buff); - //Console.WriteLine("Multiple: {0} ", buff); - //Console.WriteLine("----------------------------------------------"); - } - - public void SetHeader() - { - string pTmp; - - //Console.WriteLine("Set Header"); - - // Get the number of header records - Int16 iNewCnt = RO_df.ReadInteger16(); - - //Console.WriteLine("Num Header Records: {0}", iNewCnt); - - // Clear the existing headers - Hdrs.strHdrs.Clear(); - // Loop through the headers - int iLoop = 0; - for (; iLoop < iNewCnt; iLoop++) - { - int hdrRptCnt = (int)RO_df.ReadInteger16(); - if (Hdrs.repeatCount.Count - 1 < iLoop) - Hdrs.repeatCount.Add((int)hdrRptCnt); - else - Hdrs.repeatCount[iLoop] =hdrRptCnt; - pTmp = RO_df.ReadText(); - //Console.WriteLine("SH[{0}]", pTmp); - if (Hdrs.strHdrs.Count - 1 < iLoop) - Hdrs.strHdrs.Add(pTmp); - else - Hdrs.strHdrs[iLoop] = pTmp; - //Console.WriteLine("Value: {0}", Hdrs.repeatCount[iLoop]); - //Console.WriteLine("Value Text: {0}", Hdrs.strHdrs[iLoop]); - //Console.WriteLine("----------------------------------------------"); - } - // Set the new header count - Hdrs.HdrCnt = iNewCnt; - } - bool _LastWasName = false;//B2016-251 Don't change underscore to underline to Name value - public void PushHeader() - { - //if (m_pPrinterOut->Row() > 55) - //// m_pPrinterOut->newpage(); - //pdfReportDoc.NewPage(); - string pTmp = RO_df.ReadText(); - //Console.WriteLine("PH[{0}]", pTmp); - curheaderlen = pTmp.Length; - _LastWasName = (pTmp == "Name");//B2016-251 Don't change underscore to underline to Name value - //Hdrs.strHdrs[Hdrs.HdrCnt] = pTmp; - Hdrs.strHdrs.Add(pTmp); - //Hdrs.repeatCount[Hdrs.HdrCnt] = 2; - Hdrs.repeatCount.Add(2); - Hdrs.HdrCnt++; - Hdrs.printedLastHeader = false; - - //m_pPrinterOut->PushedHeader(Hdrs.strHdrs[Hdrs.HdrCnt-1]); - - //Console.WriteLine("Push Header"); - //Console.WriteLine("Header Text: {0}", pTmp); - //Console.WriteLine("----------------------------------------------"); - } - - public void PopHeader() - { - if (Hdrs.repeatCount[Hdrs.HdrCnt-1] == 2) - { - // if the last header was pushed on header list - // print eject the page if the page ran out, and - // print the header with "none". - //if (m_pPrinterOut->Row() > 55) - // m_pPrinterOut->NewPage(); - LastHeader(); - //m_pPrinterOut->PutLine(0, "none"); - //m_pPrinterOut->NewLine(1); - } - // Remove the header - Hdrs.HdrCnt--; - //Hdrs.strHdrs[Hdrs.HdrCnt] = null; - Hdrs.strHdrs.RemoveAt(Hdrs.HdrCnt); - Hdrs.repeatCount.RemoveAt(Hdrs.HdrCnt); - - //Console.WriteLine("Pop Header"); - //Console.WriteLine("----------------------------------------------"); - } - - public void RROBegin() - { - //m_pPrinterOut->NewPage(); - //Console.WriteLine("RRO Begin"); - //Console.WriteLine("----------------------------------------------"); - // Start of a new RO, print out the headers - for (int iLoop = 0; iLoop < Hdrs.HdrCnt; iLoop++) - { - if (!MyDocOutline.ContainsKey(iLoop) || MyDocOutline[iLoop].MyHeader != Hdrs.strHdrs[iLoop]) - { - PdfOutline parentOutline = null; - if (iLoop == 0) - parentOutline = MyRootOutline;//_MyPDFWriter.DirectContent.RootOutline; - else - parentOutline = MyDocOutline[iLoop - 1].MyOutline; - //pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height); - AddOutlineLevel(parentOutline, iLoop, Hdrs.strHdrs[iLoop], MyPdfDestPage); - } - // Change double underscore to spaces in header text - AddText(Hdrs.strHdrs[iLoop].Replace("__"," "), F12Bold); // should be bold and first header is centered - } - } - public PdfDestination MyPdfDestTop - { - get - { - // 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); - //return new PdfDestination(PdfDestination.FITH, _Top);//_MyPDFWriter.DirectContent.PdfDocument.PageSize.Height); - return new PdfDestination(PdfDestination.XYZ, 0, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height, 1.5f); - } - } - - public PdfDestination MyPdfDestPage - { - get - { - return new PdfDestination(PdfDestination.FITV,0); - } - } - - private PdfOutline _MyErrorOutline = null; - - public PdfOutline MyErrorOutline - { - get - { - if (_MyErrorOutline == null) - { - _MyErrorOutline = new PdfOutline(_MyPDFWriter.DirectContent.RootOutline, MyPdfDestPage, "Errors"); - } - return _MyErrorOutline; - } - } - private PdfOutline _MyRootOutline = null; - - public PdfOutline MyRootOutline - { - get - { - if (_MyRootOutline == null) - { - _MyRootOutline = new PdfOutline(_MyPDFWriter.DirectContent.RootOutline, MyPdfDestTop, "Referenced Objects"); - } - return _MyRootOutline; - } - } - private PdfDestination pdfDest = null; - private void AddOutlineLevel(PdfOutline parentOutline, int iLoop, string hdr, PdfDestination pdfDest) - { - if (MyDocOutline.ContainsKey(iLoop)) - MyDocOutline[iLoop] = new DocOutline(new PdfOutline(parentOutline, pdfDest, hdr), hdr); - else - MyDocOutline.Add(iLoop,new DocOutline(new PdfOutline(parentOutline, pdfDest, hdr), hdr)); - } - - public void RROEnd() - { - //m_pPrinterOut->PageEnd(); - // Remove any headers that are left over - //Console.WriteLine("{0} headers cleaned up.", Hdrs.HdrCnt); - //Console.WriteLine("RRO End"); - //Console.WriteLine("----------------------------------------------"); - } - - public void Msg() - { - - // Set a message to the printer on its own - string szStr = RO_df.ReadText(); - PutHeaderAndText(szStr); - //m_pPrinterOut->NewLine(1); - //m_pPrinterOut->PutChr(szStr); - //m_pPrinterOut->NewLine(1); - - //Console.WriteLine("Message"); - //Console.WriteLine("Message Text: {0}", szStr); - //Console.WriteLine("----------------------------------------------"); - } - - public void NoInformatEntered() - { - PutHeaderAndText("-- No information entered --"); - } - - public void PutHeaderAndText(string txt) - { - if (!Hdrs.printedLastHeader) - { - Chunk chk = LastHeader(); - Phrase p = new Phrase(); - PdfPCell cell = new PdfPCell(); - p.Add(chk); // add the header chunk - cell.BackgroundColor = Color.WHITE; - cell.BorderColor = Color.WHITE; - cell.AddElement(p); - datatable.AddCell(cell); - } - PutText(txt); - } - public void Text() - { - // Get the lenght of the text string and read it in - Int16 iValue = RO_df.ReadInteger16(); - string szStr = ""; - // B2016-247 If size is zero it is an empty string. - if (iValue > 0) - szStr = RO_df.ReadText(iValue); - //Console.WriteLine("[{0}.{0:X}]='{1}'",iValue,szStr); - string temp = szStr; - Chunk chk = LastHeader(); - Phrase p = new Phrase(); - PdfPCell cell = new PdfPCell(); - if (MyROID != null) - { - chk.SetLocalDestination(string.Format("ROID={0}", MyROID.ToUpper())); // Destination - //Console.WriteLine("\"ROID\"\t\"{0}\"", MyROID.ToUpper()); - MyROID = null; - } - p.Add(chk); // add the header chunk - cell.BackgroundColor = Color.WHITE; - cell.BorderColor = Color.WHITE; - - bool isXYPlot = szStr.StartsWith("< 72 || (szStr.IndexOf('\r') != -1)) - { - // If the lenght of the string plus the field title is greater - // than 72 characters or has a carriage return character in it - // then output the text on multiple lines - //if (m_pPrinterOut->Row() > 55) - // m_pPrinterOut->newpage(); - - // the header goes on its own line - cell.AddElement(p); - datatable.AddCell(cell); - // text goes below the header - - if (isXYPlot) - AddXYPlot(szStr); // xy plot - sometimes plots were put in text fields - else - PutText(temp); // it's just text - } - else - { - // Otherwise output the header and text on a single line - p.Add(ConvertDOSSuperAndSubScripts(szStr,F10)); - cell.AddElement(p); - datatable.AddCell(cell); - //m_pPrinterOut->SetNumberOfNewLines(0); - //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("Value: {0}", iValue); - //Console.WriteLine("Text: {0}", szStr); - //Console.WriteLine("----------------------------------------------"); - } - - public string KeyField() - { - // use the key field as the PDF bookbark - string szStr = RO_df.ReadText(); - //PdfDestination pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height); - PdfOutline outl = new PdfOutline(MyDocOutline[Hdrs.HdrCnt - 1].MyOutline, MyPdfDestTop, szStr); - //DestSample(outl); - return szStr; - //Console.WriteLine("Key Field"); - //Console.WriteLine("Key Text: {0}", szStr); - //Console.WriteLine("----------------------------------------------"); - } - public string ROIDField() - { - // use the key field as the PDF bookbark - string szStr = RO_df.ReadText(); - //PdfDestination pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height); - //PdfOutline outl = new PdfOutline(MyDocOutline[Hdrs.HdrCnt - 1].MyOutline, MyPdfDestTop, szStr); - //DestSample(outl); - return szStr; - //Console.WriteLine("Key Field"); - //Console.WriteLine("Key Text: {0}", szStr); - //Console.WriteLine("----------------------------------------------"); - } - -// Read in the image filename, height, and width - public void ImageFile() - { - string fn = RO_df.ReadText(); - Int16 ht = RO_df.ReadInteger16(); - Int16 wd = RO_df.ReadInteger16(); - //m_pPrinterOut->PrintImage(fn, wd, ht); - - //Console.WriteLine("ImageFile"); - //Console.WriteLine("Name: {0}", fn); - //Console.WriteLine("Height: {0}", ht); - //Console.WriteLine("Width: {0}", wd); - //Console.WriteLine("----------------------------------------------"); - AddImage(fn); - } -// Read in the X/Y plot info. - public void XYPlot() - { - // Get the lenght of the text string and read it in - Int16 iValue = RO_df.ReadInteger16(); - string szStr = RO_df.ReadText(iValue); - string temp = szStr; - Chunk chk = LastHeader(); // = new Chunk(m.Value, fnt); - Phrase p = new Phrase(); - PdfPCell cell = new PdfPCell(); - p.Add(chk); // add the header chunk - cell.BackgroundColor = Color.WHITE; - cell.BorderColor = Color.WHITE; - - // the header goes on its own line - cell.AddElement(p); - datatable.AddCell(cell); - AddXYPlot(szStr); - - //Console.WriteLine("XY Plot"); - //Console.WriteLine("Value: {0}", iValue); - //Console.WriteLine("Text: {0}", szStr); - //Console.WriteLine("----------------------------------------------"); - } - - // Output the string. If it is a graph, print the graph. - // ParseForGraph contains the code to print the text. - public void PutText(string szStr) - { - if (szStr == null || szStr.Equals("NONE")) - { - //m_pPrinterOut->putchr("NONE"); - //m_pPrinterOut->newline(2); - AddText("NONE", F10); - return; - } - //m_pPrinterOut->SetNumberOfNewLines(0); - AddText(szStr,F10); - //m_pPrinterOut->newline(2); - // Include margin so the Display Data can print with a margin of zero - //m_pPrinterOut->ParseForGraph(temp, margin); - } - - // Output the last header that was push onto the header stack - // Printer::LastHeader contains the code to do this. - public Chunk LastHeader() - { - Chunk chk;// = new Chunk(m.Value, fnt); - string hdrtxt = ""; - if (Hdrs.HdrCnt > 0) - hdrtxt = Hdrs.strHdrs[Hdrs.HdrCnt - 1]; - hdrtxt += ": "; - chk = new Chunk(hdrtxt, F10Bold); - Hdrs.printedLastHeader = true; - return chk; - //m_pPrinterOut->LastHeader(); - } - - }// end CompSumROReport - - - public class Headers - { - //public string[] strHdrs; - public List strHdrs; -// public int[] repeatCount; - public int HdrCnt; - public List repeatCount; - public bool printedLastHeader; - public Headers() - { - HdrCnt = 0; - strHdrs = new List(); - repeatCount = new List(); - printedLastHeader = false; - } - } - - public class RODataFile - { - FileStream fs = null; - BinaryReader br = null; - public RODataFile(string fname) - { - fs = new FileStream(fname,FileMode.Open); - br = new BinaryReader(fs); - } - public void close() - { - br.Close(); - fs.Close(); - } - public long GetFileLength() - { - return fs.Length; - } - public long GetFilePointerPosition() - { - return fs.Position; - } -// Read an integer value from the data file - public Int16 ReadInteger16() - { - try - { - return (Int16)br.ReadUInt16(); - } - catch (Exception e) - { - Console.WriteLine("Exception : {0}", e.Message); - return -1; - } - } -// Read a text string from the data file and returns it. -// The calling program is responsible for free it -// with the "delete" operator. - - public string ReadText() - { - return ReadText(-1); - } - - public string ReadText(Int16 i16CharCount) - { - Int16 i16DataSize; - if (i16CharCount == -1) - i16DataSize = ReadInteger16(); - else - i16DataSize = i16CharCount; - - if (i16DataSize <= 0) - return null; - else - { - byte[] charbuff = new byte[i16DataSize + 1]; - charbuff = br.ReadBytes(i16DataSize); - string str = ""; - for (int i = 0; i < i16DataSize; i++) - str += Convert.ToChar(charbuff[i]).ToString(); - 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 - public long NextRecord() - { - Int16 iType; - Int16 RECORD_START = 255; - // While not the next record and not end of file get the next meta item - while ((iType = ReadInteger16()) != RECORD_START && iType != -1) - { - NextItem(); - } - return fs.Seek(0, SeekOrigin.Current); - } -// Get the next meta item and discard the data - public long NextItem() - { - string pTmp; - Int16 iRecType = ReadInteger16(); - Int16 iNewCnt; - int iLoop; - switch (iRecType) - { - case 1: // Set Header - iNewCnt = ReadInteger16(); - for (iLoop = 0; iLoop < iNewCnt; iLoop++) - { - ReadInteger16(); - pTmp = ReadText(); - //delete pTmp; - } - break; - case 2: // Push Header - case 6: // Msg - case 7: // Key Field - case 100: // Text Field - case 101: // Plot Field - pTmp = ReadText(); - //delete pTmp; - break; - case 3: // Pop Header - case 4: // RRO Begin - case 5: // RRO End - case 103: // Multi Begin - case 104: // Multi End - case 0: // Do Nothing - // Do nothing - break; - case 102: // Image Field - pTmp = ReadText(); - //delete pTmp; - ReadInteger16(); - ReadInteger16(); - break; - } - return fs.Seek(0, SeekOrigin.Current); - } -// Get the block of data that is the record - public byte[] GetRecord(ref int size) - { - byte[] data; - // Get the current position - long lCurPos = fs.Seek(0, SeekOrigin.Current); - - // Go to the end of the record and get the file position - ReadInteger16(); - NextRecord(); - long lEndRecord = fs.Seek(0, SeekOrigin.Current); - - // Get the size of the record - size = (int)(lEndRecord - lCurPos); - - // Retrieve the record from the file - data = new byte[size +1]; - data = br.ReadBytes(size); - - return data; - } - } -} - diff --git a/PROMS/Volian.Print.Library/ContActionSum.cs b/PROMS/Volian.Print.Library/ContActionSum.cs deleted file mode 100644 index 02276c91..00000000 --- a/PROMS/Volian.Print.Library/ContActionSum.cs +++ /dev/null @@ -1,379 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using LBWordLibrary; -using VEPROMS.CSLA.Library; -using System.Text.RegularExpressions; - -namespace Volian.Print.Library -{ - public class ContinuousActionSummary : IDisposable - { - private LBApplicationClass _WordApp; - private LBDocumentClass _WordDoc; - private LBSelection _WordSel; - 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 VE_Font _pkFont; - public ContinuousActionSummary() - { - _WordApp = new LBApplicationClass(); - _WordDoc = _WordApp.Documents.Add(); - _WordSel = _WordApp.Selection; - _pkFont = new VE_Font("Arial", 11, E_Style.None, 12); // copied from Calvert Placekeepers. - } - public void Visible() - { - _WordApp.Visible = true; - _WordApp.Activate(); - } - private ItemInfo GetHLSii(ItemInfo ii) - { - while (!ii.IsHigh) ii = ii.MyParent; - return ii; - } - public ContinuousActionSummary(pkParagraphs myContActSteps, VE_Font pkFont, bool doingTimeCriticalSummary = false) - { - ItemInfo prevHLSii = null; - string txtPageNum = ""; // this gets asigned the page number continuous action step text. - string txtDone = ""; // nothing is printed in the Done column - _WordApp = new LBApplicationClass(); - _WordDoc = _WordApp.Documents.Add(); - _WordSel = _WordApp.Selection; - //_WordApp.Visible = true; - _pkFont = pkFont; - AddTable(); - AddHeader(doingTimeCriticalSummary); // F2022-024 pass flag when creating a Time Critical Action Summary report - foreach (pkParagraph myContAct in myContActSteps) - { - bool addParentTab = myContAct.MyParagraph.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.ContinuousActionSummaryData.AddParentTabToSubStepTab; // F2026-001 prefix Continuous Action sub-step with parent tab - if (myContAct.MyChildren.Count > 0) - if (myContAct.MyParagraph.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.ContinuousActionSummaryData.IncludeSectionNumAndTitle) // only print the section title if it has Continuous Action Steps - AddSectionHeader(myContAct.MyParagraph.MyItemInfo.DisplayNumber, myContAct.MyParagraph.MyItemInfo.FormattedDisplayText, myContAct.MyParagraph.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.ContinuousActionSummaryData.IncludeSectionLabel); - foreach (pkParagraph pgh in myContAct.MyChildren) // within each section... - { - ItemInfo hlsii = GetHLSii(pgh.MyParagraph.MyItemInfo); - if (prevHLSii != hlsii) - { - if (_DoingSubsteps) - FinishSubstep(txtDone, txtPageNum); - // start Continuous Action text table cell - StartSubStep(); - txtPageNum = ""; - prevHLSii = hlsii; - } - foreach (pkParagraph pghC in pgh.MyCautionsAndNotes) // this is a high level step with cautions and/or notes - { - StepConfig sc = pghC.MyParagraph.MyItemInfo.MyConfig as StepConfig; - string doneStr = ""; - string NoteCautionTab = pghC.MyParagraph.MyItemInfo.MyTab.CleanText.Trim(); - NoteCautionTab += " "; - if (txtPageNum == "") txtPageNum = (pghC.MyParagraph.MyItemInfo.PageNumber + 1).ToString(); - 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 - 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 - { - stpTab = string.Format("{0} ", 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 - { - string tabPre = ""; - StringBuilder sbTabPre = new StringBuilder(); - ItemInfo prevItemInfo = pgh.MyParagraph.MyItemInfo.MyParent; - // F2026-001 The while loop below will build a sub-step prefix of the continuous action sub-step - // if the format flag (AddParentTabToSubStepTab) is set - the base format has this set to false - // it will not add the parent tab - // - if the parent is a continuous action step or sub-step as that information would be redundant - // - if the current is a RNO step type and the Parent is NOT a RNO step type - if (prevItemInfo.IncludeOnContActSum || !addParentTab) prevItemInfo = null; - while (prevItemInfo != null && !prevItemInfo.IsHigh && !prevItemInfo.IncludeOnContActSum) - { - sbTabPre.Insert(0, prevItemInfo.MyTab.CleanText.Trim()); - if ((prevItemInfo.IsInRNO && !prevItemInfo.MyParent.IsInRNO) || prevItemInfo.MyParent.IncludeOnContActSum) - prevItemInfo = null; - else - prevItemInfo = prevItemInfo.MyParent; - } - 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() + " " : ""); - tabPre = sbTabPre.ToString(); - if (!_FirstLine) // if not the first line we indent the size of high level step tab - preTabLen = GetTextWidth(hlsii.MyTab.Text.Trim() + " ") / 72f; - if (pgh.MyParagraph.MyItemInfo.IsInRNO) - { - stpTab = stpTab.TrimEnd() + "[R] "; - } - stpTab = tabPre + stpTab; - } - if (txtPageNum == "") txtPageNum = (pgh.MyParagraph.MyItemInfo.PageNumber + 1).ToString(); - AddContinuousAction(stpTab, GetContActStepText(pgh.MyParagraph.MyItemInfo), "", txtPageNum, 0, preTabLen); - if (pgh.MyChildren.Count > 0) // process the sub-steps under this parent - { - AddChildren(pgh, 1); - } - } - if (_DoingSubsteps) - FinishSubstep(txtDone, txtPageNum); - } - RepeatHeader(); - } - - private void AddChildren(pkParagraph pgh, int level) - { - StringBuilder sbPreTab = new StringBuilder(); - bool addParentTab = pgh.MyParagraph.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.ContinuousActionSummaryData.AddParentTabToSubStepTab; // F2026-001 flag to add parent tab to CAS sub-step - if (pgh.MyChildren.Count > 0) - level++; - foreach (pkParagraph cpgh in pgh.MyChildren) - { - sbPreTab.Clear(); - if (cpgh.MyCautionsAndNotes.Count > 0) - AddNotesOrCautions(cpgh,level); - string stpTab = cpgh.MyParagraph.MyItemInfo.MyTab.CleanText.Trim() + (cpgh.MyParagraph.MyItemInfo.IsInRNO ? "[R] ": " "); - if (cpgh.MyParagraph.MyItemInfo.IsNote || cpgh.MyParagraph.MyItemInfo.IsCaution) - { - stpTab = string.Format("{0} ", cpgh.MyParagraph.MyParent.MyTab.Text.Trim()) + " " + stpTab; - } - ItemInfo prevItmInfo = cpgh.MyParagraph.MyItemInfo.MyParent; - // F2026-001 the while loop below will add the sub-step's parent tab if applicable - if (prevItmInfo.IncludeOnContActSum || !addParentTab) prevItmInfo = null; // don't try to add parent tab - while (prevItmInfo != null && !prevItmInfo.IsHigh) - { - sbPreTab.Insert(0, prevItmInfo.MyTab.CleanText.Trim()); - if ((prevItmInfo.IsInRNO && !prevItmInfo.MyParent.IsInRNO) || prevItmInfo.MyParent.IncludeOnContActSum) - prevItmInfo = null; - else - prevItmInfo = prevItmInfo.MyParent; - } - stpTab = sbPreTab.ToString() + stpTab; - AddContinuousAction(stpTab, GetContActStepText(cpgh.MyParagraph.MyItemInfo), "", (cpgh.MyParagraph.MyItemInfo.PageNumber + 1).ToString(),level,0); - AddChildren(cpgh, level); - } - } - - private string GetContActStepText(ItemInfo myItemInfo) - { - //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) - { - foreach (pkParagraph cpgh in pgh.MyCautionsAndNotes) - { - string doneStr = ""; - string NoteCautionTab = string.Format("{0} NOTE: ", cpgh.MyParagraph.MyParent.MyTab.Text); - if (cpgh.MyParagraph.MyItemInfo.IsCaution) NoteCautionTab = string.Format("{0} CAUTION: ", cpgh.MyParagraph.MyParent.MyTab.Text); - AddContinuousAction(NoteCautionTab, GetContActStepText(cpgh.MyParagraph.MyItemInfo), doneStr, (cpgh.MyParagraph.MyItemInfo.PageNumber + 1).ToString(),level,0); - } - } - - - private void RepeatHeader() - { - _WordTbl.Rows.First.Select(); - _WordSel.Rows.HeadingFormat = -1; - } - private bool _FirstSection = true; - private void AddTable() - { - _FirstSection = true; - _WordTbl = _WordDoc.Tables.Add(_WordSel.Range, 1, 4, 1, 0); - _WordTbl.TopPadding = 6F; - _WordTbl.BottomPadding = 6F; - LBColumn col = _WordTbl.Columns.First; - col.SetWidth(72 * .71F, LBWdRulerStyle.wdAdjustNone); - col = col.Next; - col.SetWidth(72 * 4.7F, LBWdRulerStyle.wdAdjustNone); - col = col.Next; - col.SetWidth(72 * .56F, LBWdRulerStyle.wdAdjustNone); - col = col.Next; - col.SetWidth(72 * .56F, LBWdRulerStyle.wdAdjustNone); - _WordTbl.Rows.AllowBreakAcrossPages = 0; - } - private void AddHeader(bool doingTimeCriticalSummary) - { - WriteCell("START", true, true); - if (doingTimeCriticalSummary) // F2022-024 Title for Time Critical Action Summary Report - WriteCell("STEP TIME CRITICAL ACTION", true, true); - else - WriteCell("STEP CONTINUOUS ACTION", true, true); - WriteCell("DONE", true, true); - WriteCell("PAGE", true, false); - } - private void AddSectionHeader(string number, string title, bool IncludeSectionLabel) - { - if (!_FirstSection) - { - Advance(5); - _WordSel.MoveLeft(LBWdUnits.wdCell, 1, false); - _WordSel.SelectRow(); - _WordSel.Cells.Merge(); - } - _FirstSection = false; - Advance(2); - SetIndent(0, 0); - if (IncludeSectionLabel) - WriteCell("SECTION " + number, true, false); - else - WriteCell(number, true, false); // F2025-038 don't include the word SECTION before number and title - WriteCell(" " + title, false, true); - Advance(); - } - private float GetTextWidth(string txt) - { - // 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 - // 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); - iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); - float w = 0; - foreach (char c in txt) - { - 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; - } - private bool _FirstLine = false; - private bool _DoingSubsteps = false; - private void StartSubStep() - { - _FirstLine = true; - _DoingSubsteps = true; - Advance(2); - //SetIndent(.64F, -.31F); - } - private void FinishSubstep(string done, string page) - { - _DoingSubsteps = false; - Advance(); - SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom); - WriteCell(done, false, true); - SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalTop); - WriteCell(page, false, false); - } - float prevTabIndent = 0; - private void AddContinuousAction(string number, string text, string done, string page, int level, float preTabLen) - { - string celltxt = number; - if (!_DoingSubsteps) - Advance(2); - else - { - if (!_FirstLine) - { - _WordSel.TypeParagraph(); - celltxt = "\n" + celltxt; // not the first piece of text in the table cell, add a new line - } - } - float tabIndent = GetTextWidth(number) / 72f; - if (!_DoingSubsteps || _FirstLine || level == 0) - prevTabIndent = preTabLen; - if (text.Contains("\x05")) // hanging indent character - { - string[] parts = text.Split("\x05".ToCharArray()); - float ind = tabIndent + (GetTextWidth(parts[0]) / 72f); - SetIndent(ind, -ind); - celltxt += (parts[0] + parts[1]); - } - else - { - SetIndent(prevTabIndent + tabIndent, -tabIndent); - celltxt += text; - } - if (level == 0) - prevTabIndent = tabIndent; - WriteCell(celltxt, false, !_DoingSubsteps); - if (!_DoingSubsteps) - { - SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom); - WriteCell(done, false, true); - SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalTop); - WriteCell(page, false, false); - } - _FirstLine = false; - } - static Regex rgx = new Regex(@"\\(b|ul|up[1-9]|dn0|up0|dn[1-9]|b0|ulnone)( |$|(?=\\))"); - private void WriteRTF(string text) - { - Match m = rgx.Match(text); - while (m.Success) - { - if (m.Index > 0) - _WordSel.TypeText(text.Substring(0,m.Index)); - switch (m.Groups[1].Value) - { - case "b": // bold on - _WordSel.Font.Bold = 1; - break; - case "b0": // bold off - _WordSel.Font.Bold = 0; - break; - case "ul": // underline on - _WordSel.Font.Underline = LBWdUnderline.wdUnderlineSingle; - break; - case "ulnone": // underline off - _WordSel.Font.Underline = LBWdUnderline.wdUnderlineNone; - break; - case "dn0": // superscript off - _WordSel.Font.Superscript = 0; - break; - case "up0": // subscript off - _WordSel.Font.Subscript = 0; - break; - default: - if (m.Groups[1].Value.StartsWith("dn"))// subscript on - _WordSel.Font.Subscript = 1; - else // superscript on - _WordSel.Font.Superscript = 1; - break; - - } - text = text.Substring(m.Index+m.Length); - m = rgx.Match(text); - } - _WordSel.TypeText(text); - } - private void WriteCell(string text, bool bold, bool advance) - { - _WordSel.Font.Name = _pkFont.Family;//"Arial"; - _WordSel.Font.Bold = bold ? 1 : 0; - WriteRTF(text); - if (advance) Advance(); - } - private void SetIndent(float left, float first) - { - _WordSel.ParagraphFormat.LeftIndent = left * 72; - _WordSel.ParagraphFormat.FirstLineIndent = first * 72; - } - private void SetAlignment(LBWdParagraphAlignment hAlign, LBWdCellVerticalAlignment vAlign) - { - _WordSel.ParagraphFormat.Alignment = hAlign; - _WordSel.Cells.VerticalAlignment = vAlign; - } - private void Advance(int count) - { - _WordSel.MoveRight(LBWdUnits.wdCell, count, false); - } - private void Advance() - { - Advance(1); - } - public void Dispose() - { - _WordApp.Quit(false); - } - } -} diff --git a/PROMS/Volian.Print.Library/Grid2Pdf.cs b/PROMS/Volian.Print.Library/Grid2Pdf.cs deleted file mode 100644 index 652cc3fd..00000000 --- a/PROMS/Volian.Print.Library/Grid2Pdf.cs +++ /dev/null @@ -1,2096 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using C1.Win.C1FlexGrid; -using System.IO; -using Itenso.Rtf; -using Itenso.Rtf.Parser; -using Itenso.Rtf.Interpreter; -using Itenso.Rtf.Support; -using Volian.Print.Library; -using Volian.Controls.Library; -using iTextSharp.text; -using iTextSharp.text.pdf; -using VEPROMS.CSLA.Library; -using System.Text.RegularExpressions; - -namespace Volian.Print.Library -{ - #region Settings // RHM20150429 - Table Scrunch - public partial class vlnTable - { - private string _DebugInfo = null; // RHM20150429 - Table Scrunch - public string DebugInfo - { - get { return _DebugInfo; } - 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 - { - #region Log4Net - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #endregion - public bool ShowDetails - { get { return MyTable.ShowDetails; } } - 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 - public partial class vlnTable - { - #region Properties - // 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 - private float[] _HContents;// RHM20150525 - Table Scrunch - public float[] HContents - { - get { return _HContents; } - set { _HContents = value; } - } - private float[] _RowTop; - public float[] RowTop - { - get { return _RowTop; } - 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 - public static float XOffset - { - get { return vlnTable._XOffset; } - set { vlnTable._XOffset = value; } - } - private static float _YOffset = 0; // This moves the borders with respect to the text - public static float YOffset - { - get { return vlnTable._YOffset; } - set { vlnTable._YOffset = value; } - } - private static float _LineThicknessForThin = .9F; - public static float LineThicknessForThin - { - get { return vlnTable._LineThicknessForThin; } - set { vlnTable._LineThicknessForThin = value; } - } - private static float _LineThicknessForThick = 1.8F; - public static float LineThicknessForThick - { - get { return vlnTable._LineThicknessForThick; } - set { vlnTable._LineThicknessForThick = value; } - } - private static float _LineThicknessForDouble = .6F; - public static float LineThicknessForDouble - { - get { return vlnTable._LineThicknessForDouble; } - set { vlnTable._LineThicknessForDouble = value; } - } - public static float DoubleLineOffset - { - get { return (LineThicknessForThick - LineThicknessForDouble) / 2; }//LineThicknessForThick - 2 * LineThicknessForDouble; } - } - private float _TotalContentHeight = 0;// RHM20150525 - Table Scrunc - // TotalContentHeight - height of just the content of all rows in the table. - public float TotalContentHeight - { - get - { - if (_TotalContentHeight == 0) - { - foreach (float h in HContents) - _TotalContentHeight += h; - } - return _TotalContentHeight; - } - } - public float SpaceAvailable// RHM20150525 - Table Scrunc - { - // 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 - // 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 LeadingSpaceAvailable// B2018-085 - Table Scrunch Fix: - { - // 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/13.5 is amount of space used by leading. - get { return 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 - // (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 - public float TooBig - { - get { return _TooBig; } - set - { - _TooBig = value; - //_Adjustment = Math.Min(1F, (_TooBig / (RowTop.Length - 1)) / 12); - //if (ShowDetails) Console.WriteLine("TooBig\t{0}\t{1}", value, _Adjustment); - //if(ShowDetails) Console.WriteLine("Before RowTop={0}", RowTop[RowTop.Length-1] ); - // SpaceAvailable - amount of white space that can be removed. if the amount of the table that is too big to fit - // is less than the amount of white space that can be removed, then set extra to this amount divided by the - // number of cells, otherwise it is 0. - float extra = (_TooBig < SpaceAvailable) ? (SpaceAvailable - _TooBig) / HContents.Length : 0; - // B2018-085 Table Scrunch - Adjust Line Spacing - float leadingAdjust = 1.0F; - // if removing white space doesn't make table scrunch enough, see if adjusting leading will help - if (extra == 0) - { - // See if we can adjust Leading - float newLeading = Math.Max(12.0F, 13.5F - (_TooBig - SpaceAvailable) / LeadingSpaceAvailable); - leadingAdjust = newLeading / MyCells.MyLeading; - MyCells.MyLeading = newLeading; - foreach (vlnCell myCell in MyCells) - { - myCell.MyPara.SetLeading(MyCells.MyLeading, 0); - } - } - // The following resets the height of all rows in the table - for (int r = 0; r < RowTop.Length - 1; r++) - { - HContents[r] *= leadingAdjust; - RowTop[r + 1] = RowTop[r] + HContents[r] + extra; - } - //if(ShowDetails) Console.WriteLine("After RowTop={0}", RowTop[RowTop.Length-1] ); - } - } - private float _Adjustment = 0;// RHM20150525 - Table Scrunc - public float Adjustment - { - 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 - { - VlnSvgPageHelper myPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - if (myPageHelper.DebugLayer != null) - { - cb.BeginLayer(myPageHelper.DebugLayer); - cb.SaveState(); - cb.SetLineWidth(.1F); - cb.SetColorStroke(new Color(System.Drawing.Color.Orange)); - float yBottom = yTop - height; - cb.MoveTo(x, yTop); - cb.LineTo(x, yBottom); - int i = 0; - for (float y = yTop; y >= yBottom; y -= 10) - { - float w = 10; - if (i % 10 == 0) w = 30; - else if (i % 5 == 0) w = 20; - cb.SetLineWidth(w / 30); - i++; - cb.MoveTo(x + w, y); - cb.LineTo(x, y); - cb.Stroke(); - } - i = 0; - cb.Stroke(); - cb.RestoreState(); - cb.EndLayer(); - } - } - private void ShowRowTops(string location)// RHM20150525 - Table Scrunc - { - if (!ShowDetails) return; - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < RowTop.Length; i++) - sb.Append("\t" + RowTop[i].ToString()); - Console.WriteLine(location + "\t" + sb.ToString()); - } - private void EndSetup()// RHM20150525 - Table Scrunc - { - if (ShowDetails) ShowRowTops("vlnTable.ctor.2"); - if (ShowDetails) Console.WriteLine("^^^^^^vlnTable============{0}===============", ItemID); - } - private void SetupDebug(VlnFlexGrid myFlexGrid)// RHM20150525 - Table Scrunc - { - //ShowDetails = myFlexGrid.GetMyItemInfo().InList(38329); - //if(ShowDetails) Console.WriteLine("vvvvvvlnTable============{0}===============", ItemID); - ItemInfo myItemInfo = myFlexGrid.GetMyItemInfo(); - ItemID = myItemInfo.ItemID; - Path = myItemInfo.ShortPath; - DebugInfo = string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} ShortPath={5} Width={6} Left={7} YOffset={8}", - 0, myItemInfo.ItemID, myItemInfo.FormatStepType, myItemInfo.FormatStepData == null ? "NoStepData" : myItemInfo.FormatStepData.Type, - myItemInfo.StepLevel, myItemInfo.ShortPath, Width, XOffset, YOffset); - } - #endregion - private string _Path; - -public string Path -{ - get { return _Path; } - set { _Path = value; } -} - - #region Constructors - public vlnTable(VlnFlexGrid myFlexGrid, iTextSharp.text.pdf.PdfContentByte myContentByte) - { - MyFlexGrid = myFlexGrid; - MyContentByte = myContentByte; - InitializeSizes(); - SetupDebug(myFlexGrid);// RHM20150525 - Table Scrunc - MyCells = new vlnCells(this, MyFlexGrid, MyContentByte); - EndSetup();// RHM20150525 - Table Scrunc - } - #endregion - #region Private Methods - private void InitializeSizes() - { - RowTop = new float[MyFlexGrid.Rows.Count + 1]; - HContents = new float[MyFlexGrid.Rows.Count];// RHM20150525 - Table Scrunc - RowTop[0] = 0; - for (int r = 0; r < MyFlexGrid.Rows.Count; r++) - RowTop[r + 1] = RowTop[r] + 72 * (MyFlexGrid.Rows[r].Height == -1 - ? MyFlexGrid.Rows.DefaultSize : MyFlexGrid.Rows[r].Height) / (float)MyFlexGrid.DPI; - ColLeft = new float[MyFlexGrid.Cols.Count + 1]; - ColLeft[0] = 0; - for (int c = 0; c < MyFlexGrid.Cols.Count; c++) - ColLeft[c + 1] = 2 + ColLeft[c] + 72 * (MyFlexGrid.Cols[c].Width == -1 // RHM20150429 - Table Scrunch - ? MyFlexGrid.Cols.DefaultSize : MyFlexGrid.Cols[c].Width) / (float)MyFlexGrid.DPI; - } - #endregion - #region Public Methods - public void AdjustRowTop(int row1, int row2, float hNew) - { - // shift the row top of next row down by the adjustment, i.e. if the content needs more space - float hAdjust = hNew - (RowTop[row2 + 1] - RowTop[row1]); - for (int r = row2; r < MyFlexGrid.Rows.Count; r++) - RowTop[r + 1] += hAdjust; - } - public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top) - { - //ZoomGrid(myColumnText, left, top); - if (ShowDetails) Console.WriteLine("vvvvvvToPdf============{0}===============", ItemID);// RHM20150525 - Table Scrunc - ShowRowTops("ToPDF1"); - PdfContentByte cb = myColumnText.Canvas; // RHM20150429 - Table Scrunch - VlnSvgPageHelper myPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - string myLPI = myPageHelper.YMultiplier == 1.0F ? ",6LPI" : ",7LPI"; - Rtf2Pdf.DrawPdfDebug(myColumnText.Canvas, left-2, top+1, left + Width, top-myPageHelper.YMultiplier *(Height+1), - DebugInfo+", Height= " + (myPageHelper.YMultiplier * Height).ToString() + myLPI, 0); - PdfLayer textLayer = myPageHelper == null ? null : myPageHelper.TextLayer; // RHM20150429 - Table Scrunch - if (textLayer != null) cb.BeginLayer(textLayer); - myPageHelper.AddGap(top, top - Height, left, left + Width); - MyCells.ToPdf(myColumnText, left, top); - DrawRuler(myColumnText.Canvas, left + Width, top, myPageHelper.YMultiplier * (Height + 1)); // RHM20150429 - Table Scrunch - if (textLayer != null) cb.EndLayer(); - ShowRowTops("ToPDF2"); - if (ShowDetails) Console.WriteLine("^^^^^^ToPdf============{0}===============", ItemID); - } - 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); - myColumnText.Canvas.SetAction(PdfAction.GotoLocalPage(myColumnText.Canvas.PdfWriter.CurrentPageNumber, dest, myColumnText.Canvas.PdfWriter), left, top - Height, left + Width, top); - } - #endregion - } - public partial class vlnCells : List // RHM20150429 - Table Scrunch - { - #region Log4Net - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #endregion - #region Properties - private VlnFlexGrid _MyFlexGrid; - public VlnFlexGrid MyFlexGrid - { - get { return _MyFlexGrid; } - set { _MyFlexGrid = value; } - } - private vlnTable _MyTable; - public vlnTable MyTable - { - get { return _MyTable; } - set { _MyTable = value; } - } - public bool ShowDetails// RHM20150525 - Table Scrunc - { get { return MyTable.ShowDetails; }} - private iTextSharp.text.pdf.PdfContentByte _MyContentByte; - public iTextSharp.text.pdf.PdfContentByte MyContentByte - { - get { return _MyContentByte; } - set { _MyContentByte = value; } - } - #endregion - #region Constructors - public vlnCells(vlnTable myTable, VlnFlexGrid myFlexGrid, iTextSharp.text.pdf.PdfContentByte myContentByte) - { - MyTable = myTable; - MyFlexGrid = myFlexGrid; - MyContentByte = myContentByte; - SetupCells(); - foreach(vlnCell cell in this) - { - myTable.MyShading = VlnGridCellShading.Get(myFlexGrid.MyShading.ConvertToString()); // C2021-004 Table Cell Shading - 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 - private float _MyLeading = 13.5F; // B2018-085 AEP and APP worked with 13.5 - public float MyLeading - { - get { return _MyLeading; } - set { _MyLeading = value; } - } - #region Private Methods - private void SetupCells() - { - // Create a ColumnText to determine the cell heights - iTextSharp.text.pdf.ColumnText myColumnText1 = new iTextSharp.text.pdf.ColumnText(MyContentByte); - // Walk through all the rows - for (int r = 0; r < MyFlexGrid.Rows.Count; r++) - { - float hMax = 12; // RHM20150429 - Table Scrunch - for (int c = 0; c < MyFlexGrid.Cols.Count; c++) - { - CellRange cr = MyFlexGrid.GetMergedRange(r, c); - // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 - // Tables not being scrunched properly - // Merged cells should be adjusted based upon the bottom most cell of the range - if(MyTable.HContents[r]==0) MyTable.HContents[r] = 12; - if (cr.r2 == r && cr.c1 == c)// Use last Row - { - float w = MyTable.ColLeft[cr.c2 + 1] - MyTable.ColLeft[cr.c1]; - float h = MyTable.RowTop[cr.r2 + 1] - MyTable.RowTop[cr.r1]; - string str = MyFlexGrid.GetCellRTFString(r, c) ?? string.Empty; - if (str.Contains(@"\cf")) - { - str = System.Text.RegularExpressions.Regex.Replace(str, @"\\cf[0-9]\\", @"\"); - str = System.Text.RegularExpressions.Regex.Replace(str, @"\\cf[0-9] ", @""); - } - // the FreeMono font is used for the editor, but VESymbFix is used for printing - // The font spefication is embeded in the table text so we need to change the font reference from - // FreeMono to VESymbFix before we print the table - if (str.ToUpper().Contains("FREEMONO")) - str = str.Replace("FreeMono", "VESymbFix"); - DisplayText dt = new DisplayText(MyFlexGrid.GetMyItemInfo(), str, false); - str = dt.StartText; - str = PreProcessRTF(w, str); - // If the font is not proportional, pass the symbol font through to RtfToParagraph. It is needed - // in underlying code to set the chunk's font if the first character of a cell is a hardspace. Without - // this, pdfs were using the Helvetica font, which is a default itextsharp font. - ItemInfo ii = MyFlexGrid.GetMyItemInfo(); - iTextSharp.text.Font ff = null; - if (!ii.FormatStepData.Font.FontIsProportional()) - ff = Volian.Svg.Library.VolianPdf.GetFont("VESymbFix", (int)ii.FormatStepData.Font.Size, (int)ii.FormatStepData.Font.WindowsFont.Style); - iTextSharp.text.Paragraph myPara = RtfToParagraph(str, ff, r, c); - myColumnText1.SetSimpleColumn(0, 0, w-2, MyContentByte.PdfDocument.PageSize.Top); // Padding = 4 - if (str.Contains(@"\'05")) - { - // if there is a hanging indent, the iTextSharp paragraph properties must be set - // to print the indent. Replace the indent 'token' with a non-used symbol, this will - // create a chunk with that symbol. Then loop through all of the chunks until we find - // this symbol, adding up the widths to that point. This width is the value that - // needs to be used to set the indent. - // Notes: - // A hard return will reset the chkW (indent width) back to zero. - // We jump out of the processing loop after the first indent token is found and ignor any other ones - float chkW = CalculateHangingIndent(str); - myPara.IndentationLeft = chkW; - myPara.FirstLineIndent = -chkW; - } - Match match = Regex.Match(str, @"\\fi([-0-9]*) ?\\li([0-9]*)"); - if (match.Success) - { - float fi = float.Parse(match.Groups[1].Value) / 20; // 72 is dots per inch & 96 is standard DPI (120 is KBR's machine) - float li = float.Parse(match.Groups[2].Value) / 20; - // if there is a hanging indent, the iTextSharp paragraph properties must be set - // to print the indent. - myPara.IndentationLeft = li; - myPara.FirstLineIndent = fi; - } - // RHM 20120925 - Line spacing should default to 6 lines per inch. - // B2018-003 Change code to use absolute Leading rather than Multiplied based on Font size - myPara.SetLeading(MyLeading, 0); - // TableScrunch Phase 2: SpacingAfter is the space after the bottom line of text. - // Setting to 0 removes blank space between bottom of text & line - myPara.SpacingAfter = 8; // RHM 20120925 - Add a line to properly space text from lines. - if(Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase2)) // RHM20150429 - Table Scrunch - myPara.SpacingAfter = 0; - FixHyphens(myPara, MyTable); - FixBackslashes(myPara, MyTable); - // TableScrunch Phase 3: Remove new lines at end of text - if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase3)) - TrimNewlines(myPara); // RHM20150429 - Table Scrunch - myColumnText1.AddElement(myPara); - - 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 - float posAfter = myColumnText1.YLine; // posAfter is y of bottom of paragraph, really y top of line below this - - float hContent = 4 + posBefore - posAfter; - // TableScrunch Phase 4: sets content height, uses the size derived from iTextsharp putting out text - // y loc before text is put out - y loc after text is put out - if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase4))// RHM20150525 - Table Scrunc - { - hContent = 0 + posBefore - posAfter; - } - //if(ShowDetails) Console.WriteLine("{0}\t{1}\t{2}",r,c, hContent/12); - // hMax is maximum height of row taking into account merged cells - if (cr.r1 == cr.r2) // not merged: - hMax = Math.Max(hMax, hContent); - // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 - // Tables not being scrunched properly - // Merged cells should be adjusted based upon the bottom most cell of the range - else if(cr.r2 == r) // Adjust for Previous rows within merged cells - hMax = Math.Max(hMax, hContent- SumContents(cr.r1,cr.r2)); - - // h is row height defined in table, if height of content is > height of row, adjust. - // if the content's height is larger than the height of cell, shift row below down using AdjustRowTop. - if (hContent > h) - { - //if (ShowDetails) Console.WriteLine("Less {0},{1},{2},{3},{4},{5},{6}", r, c, posBefore, posAfter, h, hContent, hMax); - MyTable.AdjustRowTop(cr.r1, cr.r2, hContent); - } - // TableScrunch Phase 5: stores max height for row content - if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase5)) - { - //if (ShowDetails) Console.WriteLine("Greater{0},{1},{2},{3},{4},{5}", r, c, posBefore, posAfter, hContent, hMax); - //B2018-033 - Adjuust current row - // For each row, hMax is te largest height for all columns. - MyTable.HContents[r] = hMax+2; // make contents of the row a little bigger than max (max may be for merged cells) - } - Add(new vlnCell(cr.r1, cr.c1, cr.r2, cr.c2, MyTable, myPara,hContent)); - } - } - } - // This summarizes the Content heights per row - //int i=0; - //foreach (float h in MyTable.HContents) - // Console.WriteLine("{0}\t{1}", ++i, h); - } - - private float SumContents(int first, int last) - { - float total = 0; - for (int i = first; i < last; i++) - total += MyTable.HContents[i]; - 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) - { - StringBuilder sb = new StringBuilder(); - foreach(char c in str) - { - if (((int)c) < 0x20 || ((int)c) > 0x7F) - sb.Append(string.Format("<{0:X4}>",(int)c)); - else - sb.Append(c); - } - return "{" + sb.ToString() + "}"; - } - private void TrimNewlines(Paragraph myPara) - { - while (myPara.Count > 0 && ParaEndsWithNewLine(myPara)) - myPara.RemoveAt(myPara.Count - 1); - } - private bool ParaEndsWithNewLine(Paragraph myPara) - { - 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) - { - // Find chunk with hardhyphen - - // 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. - int hype=-1; - Font fnt = null; - while ((hype = GetHyphen(myPara)) > -1) - { - fnt = null; - if (hype > 0) - { - Chunk chk1 = (Chunk)myPara[hype - 1]; - if (hype > 1 && chk1.Content.Equals("\n")) - chk1 = (Chunk)myPara[hype - 2]; - // use the font of the text that precedes the hyphen (dash) - fnt = new Font(chk1.Font); //B2020-80 create new instance of the font else previous myPara chunks font size may change - } - else if (hype < myPara.Count - 1) - { - Chunk chk2 = (Chunk)myPara[hype + 1]; - if (hype != 0 && !chk2.Content.Equals("\n")) - // use the font of the text that follows the hyphen (dash) - fnt = new Font(chk2.Font); //B2020-80 create new instance of the font else previous myPara chunks font size may change - } - if (fnt == null) - { - // if there was no text following the hypen, then use the font defined for tables in the plant's format - VEPROMS.CSLA.Library.VE_Font vfnt = myTable.MyFlexGrid.GetMyItemInfo().FormatStepData.Font; - //System.Drawing.Font ffont = new System.Drawing.Font(vfnt.Family, (float)vfnt.Size); - System.Drawing.Font ffont = VE_Font.GetWinSysFont(vfnt.Family, (float)vfnt.Size); - fnt = Volian.Svg.Library.VolianPdf.GetFont(ffont); - fnt.SetStyle(myPara.Font.Style); - fnt.SetColor(myPara.Font.Color.R,myPara.Font.Color.G,myPara.Font.Color.B); - } - Chunk chk = (Chunk)myPara[hype]; - // THIS CODE IS USED FOR DEBUGGING - //if (!fnt.Familyname.StartsWith("L")) - //{ - // Console.WriteLine("font = {0}", makeitpretty(fnt)); - // Console.WriteLine("Hype = {0}\r\n{1}",hype, myPara.Content); - // if (hype > 0) - // { - // Chunk chk3 = (Chunk)myPara[hype - 1]; - // Console.WriteLine("before '{0}'", chk3.Content); - // } - // Chunk chk4 = (Chunk)myPara[hype]; - // Console.WriteLine("during '{0}'", chk4.Content); - // if (hype < myPara.Count -1) - // { - // Chunk chk5 = (Chunk)myPara[hype + 1]; - // Console.WriteLine("after '{0}'", chk5.Content); - // } - //} - string prefix = ""; - if (chk.Content == "\u2011" && hype < (myPara.Count - 1)) - { - myPara.RemoveAt(hype);// Remove standalone hyphen - chk = (Chunk)myPara[hype]; - prefix = "-"; - } - myPara.RemoveAt(hype); - // B2020-080 Wolf Creek procedure STS-IC-231 at Step 4.3 – 1st row in the I&C folder under Maintenance Procedures, - // equation text that has a "-10" that is superscript, is not printing superscript in a table cell. - // When we replace the symbol font dash character with the Ascii dash character, we need to - // check for super/subscript attributes of the text following the dash. If that text - // is super/subscripted then we need to set those attributes in the new chunk. - Chunk chkJ = new Chunk(prefix + chk.Content.Replace("\u2011", "-"), fnt); - float? subsup = (float?)chk.Attributes["SUBSUPSCRIPT"]; - if (subsup != null) - { - if (subsup > 0.0) // superscript - if (PrintOverride.CompressPropSubSup) - { - chkJ.SetTextRise(.33F * chkJ.Font.Size); - chkJ.Font.Size *= .75f; - } - else - { - chkJ.SetTextRise(.25F * chkJ.Font.Size); - if (PrintOverride.CompressSuper) chkJ.Font.Size = 9; - } - else if (subsup < 0.0) // subscript - if (PrintOverride.CompressPropSubSup) - chkJ.Font.Size *= .75f; - else - { - // if the subscript is not compressed or if it is compress but not underlined, then move it down - if (!PrintOverride.CompressSub || !fnt.IsUnderlined()) chkJ.SetTextRise(-.25F * chkJ.Font.Size); - if (PrintOverride.CompressSub) chkJ.Font.Size = 9; - } - } - myPara.Insert(hype,chkJ); - } - } - - internal static void FixBackslashes(Paragraph myPara, vlnTable myTable) - { - // Find chunk with backslash B2014-108 backslash in tables - - // If a backslash symbold is found, the remove it and add a backslash (keyboard char) to the beginning - // of the text that follows it. - int bckSlsh = -1; - Font fnt = null; - while ((bckSlsh = GetBackslash(myPara)) > -1) - { - fnt = null; - if (bckSlsh > 0) - { - Chunk chk1 = (Chunk)myPara[bckSlsh - 1]; - if (bckSlsh > 1 && chk1.Content.Equals("\n")) - chk1 = (Chunk)myPara[bckSlsh - 2]; - fnt = chk1.Font; // use the font of the text that follows the hyphen (dash) - } - else if (bckSlsh < myPara.Count - 1) - { - Chunk chk2 = (Chunk)myPara[bckSlsh + 1]; - if (bckSlsh != 0 && !chk2.Content.Equals("\n")) - fnt = chk2.Font; // use the font of the text that follows the hyphen (dash) - } - if (fnt == null) - { - // if there was no text following the hypen, then use the font defined for tables in the plant's format - VEPROMS.CSLA.Library.VE_Font vfnt = myTable.MyFlexGrid.GetMyItemInfo().FormatStepData.Font; - //System.Drawing.Font ffont = new System.Drawing.Font(vfnt.Family, (float)vfnt.Size); - System.Drawing.Font ffont = VE_Font.GetWinSysFont(vfnt.Family, (float)vfnt.Size); - fnt = Volian.Svg.Library.VolianPdf.GetFont(ffont); - fnt.SetStyle(myPara.Font.Style); - fnt.SetColor(myPara.Font.Color.R, myPara.Font.Color.G, myPara.Font.Color.B); - } - Chunk chk = (Chunk)myPara[bckSlsh]; - // THIS CODE IS USED FOR DEBUGGING - //if (!fnt.Familyname.StartsWith("L")) - //{ - // Console.WriteLine("font = {0}", makeitpretty(fnt)); - // Console.WriteLine("Hype = {0}\r\n{1}",hype, myPara.Content); - // if (hype > 0) - // { - // Chunk chk3 = (Chunk)myPara[hype - 1]; - // Console.WriteLine("before '{0}'", chk3.Content); - // } - // Chunk chk4 = (Chunk)myPara[hype]; - // Console.WriteLine("during '{0}'", chk4.Content); - // if (hype < myPara.Count -1) - // { - // Chunk chk5 = (Chunk)myPara[hype + 1]; - // Console.WriteLine("after '{0}'", chk5.Content); - // } - //} - string prefix = ""; - if (chk.Content == "\u2572" && bckSlsh < (myPara.Count - 1)) - { - myPara.RemoveAt(bckSlsh);// Remove standalone hyphen - chk = (Chunk)myPara[bckSlsh]; - prefix = "\\"; - } - myPara.RemoveAt(bckSlsh); - myPara.Insert(bckSlsh, new Chunk(prefix + chk.Content.Replace("\u2572", "\\"), fnt)); - } - } - - // THIS FUNCTION IS USED FOR DEBUGGING - private static string makeitpretty(Font fnt) - { - return string.Format("font {0}, size {1}, style {2}", fnt.Familyname, fnt.Size, fnt.Style); - } - - private static int GetHyphen(Paragraph myPara) - { - int index=0; - foreach (Chunk chk in myPara.Chunks) - if (chk.Content.Contains("\u2011")) - return index; - else - index++; - return -1; - } - private static int GetBackslash(Paragraph myPara) - { - int index=0; - foreach (Chunk chk in myPara.Chunks) - if (chk.Content.Contains("\u2572")) - return index; - else - index++; - return -1; - } - public static float CalculateHangingIndent(string rtf) - { - float chkW = 0; - // **** This is intened to be a temporary fix for V.C.Summer **** - // Two procedures would not print: A-2 SAG in Summer's SAMG set, and SAG-3 in Summer's PWOG DAMG set. - // These procedures have tables with hanging indents and use the Letter Gothic Tall font. - // It appears that the font information for the hanging indent character is not included in the RTF - // for those table cells. - // 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 - // but the text in that table cell will not be indented. - jsj 10/10/2014 - //IRtfDocument rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace(@"\'05", @"\f1 \u9999? \f0 ")); - IRtfDocument rtfDoc2 = null; - //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); - iTextSharp.text.Paragraph para2 = rtf2IText2.Convert(); - for (int ic = 0; ic < para2.Chunks.Count; ic++) - { - Chunk chk = para2.Chunks[ic] as Chunk; - if (chk.Content[0] == 9999) break; - if (chk.Content.Contains("\u270f")) - { - int i = chk.Content.IndexOf('\u270F'); - int n = chk.Content.Length; - chkW += chk.GetWidthPoint() * i / (n - i); - break; - } - if (chk.Content.Contains("\n")) - { - if (ic < para2.Chunks.Count - 2 && (para2.Chunks[ic + 1] as Chunk).Content.StartsWith("\u270f")) return chkW; - chkW = 0; //hard return - reset chkW (indent start) - } - chkW += chk.GetWidthPoint(); - } - return chkW; - } - - private static StepRTB _StatRTB = new StepRTB(); - private string PreProcessRTF(float w, string str) - { - _StatRTB.Text = string.Empty; - _StatRTB.Width = (int)w; - _StatRTB.Font = MyFlexGrid.Font; - if (str.StartsWith(@"{\rtf")) - { - // The 'Replace(@" \ulnone", @"\u160?\ulnone")' was added so that data in VEWCNSUR_MTC - // tables would print. There were a number of tables, for example in STN NB-115/8.1.6, - // that had a series of spaces underlined and these spaces were not underlined in the - // generated pdf. It seems that there is a problem somewhere in the rtb -> itextsharp - // level. This fixed the immediate problem. If there is 'b0' (bold off) after the - // space before the 'ulnone' the following won't work. Also, this change was not - // made in the non-table code. If the problem occurs there, it should be added. - _StatRTB.Rtf = Regex.Replace(str.Replace(@"\~", @"\u160?"), @"(? - /// Fix RTF so that text uses the Text font rather than the Symbol font. - /// - /// - /// - private string FixRTFToPrint(string rtf,int r, int c) - { - // Only do this if the text contains symbols. - // B2019-067 Check for a proportional symbol font such as FreeSerif which is used for proportional fonts. - // The Clock, Check Mark, and Heavy X symbols were not printing the correct character (all are replaced with a WingDing font character) - if (rtf.Contains("VESymbFix") || rtf.Contains(Volian.Base.Library.vlnFont.ProportionalSymbolFont)) - { - // bug fix: B2017-117 was getting an out of window handles error when doing a print all for Bryon - // add the using statment to free up window handle that is created doing a New RichTextBox() - using (System.Windows.Forms.RichTextBox rtb = new System.Windows.Forms.RichTextBox()) - { - rtb.Rtf = rtf.Replace(@"\u9586?", "").Replace(@"\~",@"\u160?");// rename backslash character and B2018-107 \~ to hard space to avoid RTF confusion - string strRTF = rtf; - bool changed = false; - // C2017-008 - WCN wants the box symbol to look like their checkoff/signoff box - // Check for a list of replacement character for symbols in the format file - // ReplaceSymbolChars lets you do one or more of the following with a symbol character: - // - change the point size - // - change the style - // - change the font family - // - change the symbol character - // - // below is taken from the BaseAll format file - is currently commentout and there for reference - // Wolf Creek (WCN) currently uses this to increase the size of the box symbol - // - // - // - // - // get the list of symbol replacements - FormatData fmtdata = (MyFlexGrid.GetMyItemInfo().ActiveFormat != null) ? MyFlexGrid.GetMyItemInfo().ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData; - ReplaceSymbolCharList SymReplaceList = (fmtdata != null && fmtdata.SectData.ReplaceSymbolCharList != null) ? fmtdata.SectData.ReplaceSymbolCharList : null; - // Look at one character at a time - for (int i = 0; i < rtb.TextLength; i++) - { - rtb.Select(i, 1); - // If the character is a printable character set the font to the text font - // B2019-067 Also check for a proportional symbol font for example, FreeSerif - // B2023-031 Added check of a "Text" SelectionType. - // The SelectionType was "Empty" for the non-viewable link information and thus flagged it as an error - if (rtb.SelectionLength == 0 && rtb.SelectionType == System.Windows.Forms.RichTextBoxSelectionTypes.Text && strRTF != null && (rtb.SelectionFont.FontFamily.Name == "VESymbFix" || rtb.SelectionFont.FontFamily.Name == Volian.Base.Library.vlnFont.ProportionalSymbolFont)) - { - // Add debug information to the error log if the selection length is zero - // Changed debug information to make it more useful - _MyLog.WarnFormat("\r\n=====>Font Issues in Table ItemID {0} [{1},{2}] I= {3}, TXT = {4}",MyTable.ItemID,r,c, i, rtb.Text.Substring(Math.Max(0, i-10), Math.Min(20,rtb.TextLength -i))); - strRTF = null; - } - // bug fix: B2017-046 - check for selection length of zero to fix index out of bounds error - // System.Windows.Forms.RichTextBox is having issues selection text in some cases (ex. Symbol char followed by a RO reference - without a space between them) - // B2019-067 also check fora proportional symbol font for example, FreeSerif - if (rtb.SelectionLength > 0 && (rtb.SelectionFont.FontFamily.Name == "VESymbFix" || rtb.SelectionFont.FontFamily.Name == Volian.Base.Library.vlnFont.ProportionalSymbolFont) && rtb.SelectedText[0] > ' ' && rtb.SelectedText[0] <= '\xFF') - { - //use bolding underline italics from local font - System.Drawing.Font fnt = rtb.SelectionFont; - // 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 - // window handle B2017-117 - //rtb.SelectionFont = new System.Drawing.Font(DefaultFont, fnt.Style); - rtb.SelectionFont = VE_Font.GetWinSysFont(DefaultFont, fnt.Style); - changed = true; - } - if ((rtb.SelectionFont.FontFamily.Name == "VESymbFix" || rtb.SelectionFont.FontFamily.Name.StartsWith(Volian.Base.Library.vlnFont.ProportionalSymbolFont)) && rtb.SelectedText.Length > 0) // C2017-036 get best available proportional font for symbols - { - for (int j = 0; j < SymReplaceList.MaxIndex; j++) - { - ReplaceChar rc = SymReplaceList[j]; - if (rc.Unicode != null && (rc.Family != null || rc.Size != null || rc.Style != null)) - { - char rc_uchar = Convert.ToChar(Convert.ToInt32(rc.Unicode)); - if (rc_uchar == rtb.SelectedText[0]) - { - //use bolding underline italics from local font - 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 != 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; - if (rc.Replace != null) - { - char rc_RplChar = Convert.ToChar(Convert.ToInt32(rc.Replace)); - rtb.SelectedText = rc_RplChar.ToString(); - } - changed = true; - break; // break out of foreach loop since we changed the character - } - } - } - } - } - if (changed) return rtb.Rtf.Replace("", @"\u9586?"); - } - } - return rtf; - } - private static float _SixLinesPerInch = 12; // twips - #endregion - #region Public Methods - // C2021-005 Get the largest font size being used. - // - only need for the first line of table cell text - private float GetLargestFontSize(vlnCell vc) - { - // B2021-034 WCN Maintenance; Mechanical; MPM; MPM KJ-004: 7.1.4 Table - // has single cell table with just a jpeg image - // need to specify MyPara.Chunks in stead of foreach Chunk in MyPara - float largestFontSize = 12; - foreach (Chunk ck in vc.MyPara.Chunks) - { - if (ck.Content.EndsWith("\n")) - break; // end of first line - if (ck.ToString().Trim().Length > 0) - largestFontSize = Math.Max(largestFontSize, ck.Font.Size); - } - return largestFontSize; - } - public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top) - { - // B2021-137 first print the table shading, then print the table with the borders and text - foreach (vlnCell myCell in this) - { - // B2020-034 - the topPlacementAdjust is used to position the text vertically in the table cells. - // B2020-082 - AEP Production - American Electric Power - D. C. Cook - // / Current (Post FLEX) - U1 NOP NOT [EOPs] - ES-3.3.SProcedure Body.S9..S1..S1..T1. - // Table did not print properly. Cell text was truncated. - float largestFontSize = GetLargestFontSize(myCell); // C2021-005 get the largest font size for the cell text - int topPlacementAdjust = (myCell.MyPara.Font.Size == 12 && - myCell.MyPara.Font.Familyname != "Courier New" && - myCell.MyPara.Font.Familyname != "VESymbFix") ? 1 : 3; // for font size of 12 set to one, else set to 3 - if (largestFontSize != 12) // C2021-005 adjust the text positon based on the font size change - topPlacementAdjust -= (int)(largestFontSize - 12); // C2021-005 adjust placement based on font size change - // B2020-140 for Wolf Creek check boxes in tables were printing too high in the table cells - added format variable to overide topPlacementAdjust - if (myCell.MyPara != null && ItemInfo.Get(myCell.MyTable.ItemID).ActiveFormat.MyStepSectionLayoutData.OverrideTableTopIndent != null) - { - if (largestFontSize > 18) // C2021-005 Only need when cell text has the empty box symbol which WCN format override the size to 20pts - topPlacementAdjust = (int)ItemInfo.Get(myCell.MyTable.ItemID).ActiveFormat.MyStepSectionLayoutData.OverrideTableTopIndent; - } - myCell.ToPdf(myColumnText, left, top, topPlacementAdjust, true); // B2021-137 only do the table shading - } - // do the borders - foreach (vlnCell myCell in this) - { - // B2020-034 - the topPlacementAdjust is used to position the text vertically in the table cells. - // B2020-082 - AEP Production - American Electric Power - D. C. Cook - // / Current (Post FLEX) - U1 NOP NOT [EOPs] - ES-3.3.SProcedure Body.S9..S1..S1..T1. - // Table did not print properly. Cell text was truncated. - float largestFontSize = GetLargestFontSize(myCell); // C2021-005 get the largest font size for the cell text - int topPlacementAdjust = (myCell.MyPara.Font.Size == 12 && - myCell.MyPara.Font.Familyname != "Courier New" && - myCell.MyPara.Font.Familyname != "VESymbFix") ? 1 : 3; // for font size of 12 set to one, else set to 3 - if (largestFontSize != 12) // C2021-005 adjust the text positon based on the font size change - topPlacementAdjust -= (int)(largestFontSize - 12); // C2021-005 adjust placement based on font size change - // B2020-140 for Wolf Creek check boxes in tables were printing too high in the table cells - added format variable to overide topPlacementAdjust - if (myCell.MyPara != null && ItemInfo.Get(myCell.MyTable.ItemID).ActiveFormat.MyStepSectionLayoutData.OverrideTableTopIndent != null) - { - if (largestFontSize > 18) // C2021-005 Only need when cell text has the empty box symbol which WCN format override the size to 20pts - topPlacementAdjust = (int)ItemInfo.Get(myCell.MyTable.ItemID).ActiveFormat.MyStepSectionLayoutData.OverrideTableTopIndent; - } - myCell.ToPdf(myColumnText, left, top, topPlacementAdjust, false); // B2021-137 Now do the borders and text - } - } - #endregion - } - public partial class vlnCell // RHM20150429 - Table Scrunch - { - #region Properties - private vlnTable _MyTable; - public vlnTable MyTable - { - get { return _MyTable; } - set { _MyTable = value; } - } - public VlnBorders MyBorders - { - get { return _MyTable.MyBorders; } - } - 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 - #region Line Pattern Diagram - /* - The diagram below identifies the various border names for the cell in the center - - |-AboveLeftSide |-AboveRightSide - | | - | | - | | - LeftOfTopSide | TopSide | RightOfTopSide - ------------------|-------------------|------------------ - | | - | | - |-LeftSide |-RightSide - | | - | | - LeftOfBottomSide | BottomSide | RightOfBottomSide - --------------------------------------|------------------ - | | - | | - | | - | | - |-BelowLeftSide |-BelowRightSide - */ - - #endregion - #region Horizontal Line Patterns - private GridLinePattern _TopSide = GridLinePattern.Unknown; - public GridLinePattern TopSide - { - get - { - if (_TopSide == GridLinePattern.Unknown) - _TopSide = MyBorders.HorizontalLines[r1, c1]; - return _TopSide; - } - } - private GridLinePattern _BottomSide = GridLinePattern.Unknown; - public GridLinePattern BottomSide - { - get - { - if (_BottomSide == GridLinePattern.Unknown) - _BottomSide = MyBorders.HorizontalLines[r2 + 1, c2]; - return _BottomSide; - } - } - private GridLinePattern _RightOfTopSide = GridLinePattern.Unknown; - public GridLinePattern RightOfTopSide - { - get - { - if (_RightOfTopSide == GridLinePattern.Unknown) - { - if (c2 == MyTable.MyFlexGrid.Cols.Count - 1) - _RightOfTopSide = GridLinePattern.None; - else - { - CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r1, c2 + 1); - if (cr.r1 == r1) - _RightOfTopSide = MyBorders.HorizontalLines[r1, c2 + 1]; - else - _RightOfTopSide = GridLinePattern.None; - } - } - return _RightOfTopSide; - } - } - private GridLinePattern _LeftOfTopSide = GridLinePattern.Unknown; - public GridLinePattern LeftOfTopSide - { - get - { - if (_LeftOfTopSide == GridLinePattern.Unknown) - { - if (c1 == 0) - _LeftOfTopSide = GridLinePattern.None; - else - { - // This property is only used if c1==0 or r1==0: - // A merged range for row = 0 will always return an r1=0. - CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r1, c1 - 1); - if (cr.r1 == r1) - _LeftOfTopSide = MyBorders.HorizontalLines[r1, c1 - 1]; - else // Since this section of code is only entered when r1==0, this else condition should never happen - _LeftOfTopSide = GridLinePattern.None; - } - } - return _LeftOfTopSide; - } - } - private GridLinePattern _RightOfBottomSide = GridLinePattern.Unknown; - public GridLinePattern RightOfBottomSide - { - get - { - if (_RightOfBottomSide == GridLinePattern.Unknown) // Need to consider Merged Cells - { - if (c2 == MyTable.MyFlexGrid.Cols.Count - 1) - _RightOfBottomSide = GridLinePattern.None; - else - { - CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r2, c2 + 1); - if (cr.r2 == r2) - _RightOfBottomSide = MyBorders.HorizontalLines[r2 + 1, c2 + 1]; - else - _RightOfBottomSide = GridLinePattern.None; - } - } - return _RightOfBottomSide; - } - } - private GridLinePattern _LeftOfBottomSide = GridLinePattern.Unknown; - public GridLinePattern LeftOfBottomSide - { - get - { - if (_LeftOfBottomSide == GridLinePattern.Unknown) // Need to consider Merged Cells - { - if (c1 == 0) - _LeftOfBottomSide = GridLinePattern.None; - else - { - CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r2, c1 - 1); - if (cr.r2 == r2) - _LeftOfBottomSide = MyBorders.HorizontalLines[r2 + 1, c1 - 1]; - else - _LeftOfBottomSide = GridLinePattern.None; - } - } - return _LeftOfBottomSide; - } - } - #endregion - #region Vertical Line Patterns - private GridLinePattern _LeftSide = GridLinePattern.Unknown; - public GridLinePattern LeftSide - { - get - { - if (_LeftSide == GridLinePattern.Unknown) - _LeftSide = MyBorders.VerticalLines[r1, c1]; - return _LeftSide; - } - } - private GridLinePattern _RightSide = GridLinePattern.Unknown; - public GridLinePattern RightSide - { - get - { - if (_RightSide == GridLinePattern.Unknown) - _RightSide = MyBorders.VerticalLines[r2, c2 + 1]; - return _RightSide; - } - } - private GridLinePattern _BelowRightSide = GridLinePattern.Unknown; - public GridLinePattern BelowRightSide - { - get - { - if (_BelowRightSide == GridLinePattern.Unknown) - { - if (r2 == MyTable.MyFlexGrid.Rows.Count - 1) - _BelowRightSide = GridLinePattern.None; - else - { - CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r2 + 1, c2); - if (cr.c2 == c2) - _BelowRightSide = MyBorders.VerticalLines[r2 + 1, c2 + 1]; - else - _BelowRightSide = GridLinePattern.None; - } - } - return _BelowRightSide; - } - } - private GridLinePattern _AboveRightSide = GridLinePattern.Unknown; - public GridLinePattern AboveRightSide - { - get - { - if (_AboveRightSide == GridLinePattern.Unknown) - { - if (r1 == 0) - _AboveRightSide = GridLinePattern.None; - else - { - CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r1 - 1, c2); - if (cr.c2 == c2) - _AboveRightSide = MyBorders.VerticalLines[r1 - 1, c2 + 1]; - else - _AboveRightSide = GridLinePattern.None; - } - } - return _AboveRightSide; - } - } - private GridLinePattern _BelowLeftSide = GridLinePattern.Unknown; - public GridLinePattern BelowLeftSide - { - get - { - if (_BelowLeftSide == GridLinePattern.Unknown) - { - if (r2 == MyTable.MyFlexGrid.Rows.Count - 1) - _BelowLeftSide = GridLinePattern.None; - else - { - CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r2 + 1, c1); - if (cr.c1 == c1) - _BelowLeftSide = MyBorders.VerticalLines[r2 + 1, c1]; - else - _BelowLeftSide = GridLinePattern.None; - } - } - return _BelowLeftSide; - } - } - private GridLinePattern _AboveLeftSide = GridLinePattern.Unknown; - public GridLinePattern AboveLeftSide - { - get - { - if (_AboveLeftSide == GridLinePattern.Unknown) - { - if (r1 == 0) - _AboveLeftSide = GridLinePattern.None; - else - { - // This property is only used if c1==0 or r1==0: - // A merged range for col = 0 will always return an c1=0. - CellRange cr = MyTable.MyFlexGrid.GetMergedRange(r1 - 1, c1); - if (cr.c1 == c1) - _AboveLeftSide = MyBorders.VerticalLines[r1 - 1, c1]; - else // Since this section of code is only entered when c1==0, this else condition should never happen - _AboveLeftSide = GridLinePattern.None; - } - } - return _AboveLeftSide; - } - } - #endregion - #region Static Properties - private static float XOffset { get { return vlnTable.XOffset; } } - private static float YOffset { get { return vlnTable.YOffset; } } - private static float LineThicknessForThin { get { return vlnTable.LineThicknessForThin; } } - private static float LineThicknessForThick { get { return vlnTable.LineThicknessForThick; } } - private static float LineThicknessForDouble { get { return vlnTable.LineThicknessForDouble; } } - private static float DoubleLineOffset { get { return vlnTable.DoubleLineOffset; } } - - // adjustments for line intersections: - private static float ThickOverDouble { get { return ((2 * DoubleLineOffset) + LineThicknessForDouble - LineThicknessForThick) / 2; } } - private static float ThickUnderDouble { get { return DoubleLineOffset + (LineThicknessForThick - LineThicknessForDouble) / 2; } } - private static float ThickOverThin { get { return (LineThicknessForThin - LineThicknessForThick) / 2; } } - private static float ThinOverThick { get { return (LineThicknessForThick - LineThicknessForThin) / 2; } } - private static float ThinUnderDouble { get { return DoubleLineOffset + (LineThicknessForThin - LineThicknessForDouble) / 2; } } - private static float ThinOverDouble { get { return (DoubleLineOffset + LineThicknessForThin - LineThicknessForDouble) / 2; } } - private static float DoubleUnderThin { get { return (LineThicknessForThin - LineThicknessForDouble) / 2; } } - private static float DoubleUnderThick { get { return (LineThicknessForThick - LineThicknessForDouble) / 2; } } - #endregion - #region Constructors - public vlnCell(int r1, int c1, int r2, int c2, vlnTable myTable, iTextSharp.text.Paragraph myPara, float hContent) - { - this.r1 = r1; - this.c1 = c1; - this.r2 = r2; - this.c2 = c2; - MyTable = myTable; - MyPara = myPara; - HContent = hContent; - } - #endregion - #region Public Methods - public override string ToString() - { - 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) - { - PdfContentByte cb = myColumnText.Canvas; - VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer; - if (debugLayer == null) return; - System.Drawing.Color sysColor = PrintOverride.OverrideDebugColor(System.Drawing.Color.Gray); - cb.SaveState(); - cb.BeginLayer(debugLayer); - cb.SetColorStroke(new Color(sysColor)); - cb.SetLineWidth(.1F); - cb.MoveTo(x, y - yDescent); - cb.LineTo(right, y - yDescent); - cb.LineTo(right, bottom - yDescent); - cb.LineTo(x, bottom - yDescent); - cb.LineTo(x, y - yDescent); - for (float yy = y - MyPara.TotalLeading; yy > bottom; yy -= MyPara.TotalLeading) - { - cb.MoveTo(x, yy - yDescent); - cb.LineTo(right, yy - yDescent); - } - cb.Stroke(); - if (debugText != "") - { - ColumnText ct = new ColumnText(cb); - ct.SetSimpleColumn(x, y - yDescent, right, y - yDescent - 50); - iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 2); - Chunk chk = new Chunk(debugText + string.Format(", Top = {0}", y), font); - Phrase ph = new Phrase(chk); - ct.AddElement(ph); - cb.SetColorFill(new Color(sysColor)); - ct.Go(); - } - cb.EndLayer(); - cb.RestoreState(); - } - //RHM 20180319 End of Add - // 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 - public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top, int topPlacementAdjust, bool doShading) - { - myColumnText.Canvas.SaveState(); - VlnSvgPageHelper _MyPageHelper = myColumnText.Canvas.PdfWriter.PageEvent as VlnSvgPageHelper; - float mult = _MyPageHelper.YMultiplier; - float x = MyTable.ColLeft[c1]; - float w = MyTable.ColLeft[c2 + 1] - x; - float y = mult * MyTable.RowTop[r1]; // r1 - top row of cell or top of merged cells - float h = mult * MyTable.RowTop[r2 + 1] - y; // r2 - top of last merged cell. r2+1 - top row of next cell, if merging - - // Phase 6 has no affect - YAdjust_h is set to 0. May have been used for testing/trying options. - if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase6))// RHM20150525 - Table Scrunc - { - // get height of row, - h = YAdjust_h + mult * MyTable.RowTop[r2 + 1] - y; - } - if (doShading) - { - // B2021-137 do the shading then jump out - ShadingToPdf(myColumnText, left, top, x, w, y, h); // C2021-004 Table Cell Shading - return; - } - BordersToPdf(myColumnText, left, top, x, w, y, h ,false); - float hAdjust = VeritcalTextAlignment(h,_MyPageHelper.YMultiplier); - iTextSharp.text.pdf.ColumnText myColumnText1 = new iTextSharp.text.pdf.ColumnText(myColumnText.Canvas); - float adjustTextLocation = mult * 4; // RHM 20120925 Move text down about 1 half line from the border - if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase7))// RHM20150525 - Table Scrunc - { - adjustTextLocation = mult * 0; - if (mult != 1F) adjustTextLocation=1; // 1 Point: move down a slight bit if printing 7LPI - } - // 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) - // 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 - // 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 - // B2018-003 - RHM 20180319 Change Debug Output - string dbg = string.Format("Row={0}, Col={1}, Leading={2}, SpacingBefore={3}", r1, c1, MyPara.TotalLeading * _MyPageHelper.YMultiplier, MyPara.SpacingBefore); - // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 - // Added Header to debug output - if (ShowDetails) - { - if (FirstTime) - Console.WriteLine("\"r1\"\t\"c1\"\t\"hAdjust\"\t\"adjustTextLocation\"\t\"y\"\t\"h\"\t\"top\"\t\"1 + top - y - hAdjust - adjustTextLocation\"\t\"" + - "_MyPageHelper.YMultiplier\"\t\"Text\""); - Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t\"{9}\"" - , r1, c1, hAdjust, adjustTextLocation, y, h, top, 1 + top - y - hAdjust - adjustTextLocation, - _MyPageHelper.YMultiplier, ShowText(MyPara.Content.Substring(0, Math.Min(20, MyPara.Content.Length)))); - } - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine(" R {0} C {1} Y {2} H {3} Top {4} hAdj {5} TxtLocAdj {6}", r1, c1, y, h, 2+top, hAdjust,adjustTextLocation); - foreach (Chunk chk1 in MyPara.Chunks) - { - string ctai = Rtf2Pdf.ChunkTextAttributesInfo(chk1); - Volian.Base.Library.BaselineMetaFile.WriteLine("\t{0},{1},{2},{3},\"{4}\"", chk1.Font.Familyname, chk1.Font.Size, chk1.Font.Style, ctai, TextForBaseline.FixText(chk1.Content)); - } - // B2018-003 - Adjust Leading for 7LPI if necessary - MyPara.SetLeading(MyPara.TotalLeading * _MyPageHelper.YMultiplier, 0); - vlnCells.FixHyphens(MyPara, MyTable); - vlnCells.FixBackslashes(MyPara, MyTable); - myColumnText1.AddElement(MyPara); - foreach (object obj in MyPara) - { - if(obj is iTextSharp.text.Image) - { - // B2022-028: Insert image into grid & print. Print was accounting for multiple rows in table where - // inserted image was not in first row (mod setabsoluteposition to account for location in table). - // Also, borders were no longer visible so draw those back in (added call to BordersToPdf) - iTextSharp.text.Image img = obj as iTextSharp.text.Image; - img.SetAbsolutePosition(left + x, top - y - h); - img.ScaleAbsoluteWidth(w); - img.ScaleAbsoluteHeight(h); - myColumnText.Canvas.AddImage(img); - BordersToPdf(myColumnText, left, top, x, w, y, h, true); - } - } - float posBefore = myColumnText1.YLine; // RHM20150429 - Table Scrunch - int cellStatus = myColumnText1.Go(); // B2019-109 Add to Error Log if cell too small - 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); - } - float posAfter = myColumnText1.YLine; // RHM20150429 - Table Scrunch - // B2018-033 Removed debug printout - //if(ShowDetails)Console.WriteLine("ToPDF posBefore,posAfter,difference={0},{1},{2},{3}", - // posBefore, posAfter, posBefore - posAfter,w); - // B2018-003 Calculate hh - float hh = posBefore - posAfter; - PdfDebug(myColumnText1, 1 + left + x, top - y - hh - hAdjust, left + x + w - 2, 3 + top - y - hAdjust - adjustTextLocation, dbg, MyPara.TotalLeading / 5); - myColumnText.Canvas.RestoreState(); - } - // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 - // Added Header to debug output - private static bool _FirstTime = true; - public static bool FirstTime - { - get - { - bool retval = _FirstTime; - _FirstTime = false; - return retval; - } - set { _FirstTime = value; } - } - - // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 - // Added Header to debug output - private string ShowText(string str) - { - StringBuilder sb = new StringBuilder(); - foreach (char c in str) - { - if(c<32 || c>126) - sb.Append(string.Format("[{0:X}]", (int) c)); - else - sb.Append(c); - } - return sb.ToString(); - } - private static float _SixLinesPerInch = 12; // twips - public bool IsRangeStyleNull = false; - private TextAlignEnum? _TextAlign = null; - public TextAlignEnum? TextAlign - { - get - { - if (_TextAlign == null) - { - CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2); - if (cr.Style == null) - { - IsRangeStyleNull = true; - return _TextAlign; - } - else - { - IsRangeStyleNull = false; - _TextAlign = cr.Style.TextAlign; - } - } - return (TextAlignEnum)_TextAlign; - } - } - #endregion - #region Private Text Methods - private float VeritcalTextAlignment(float h, float mult) - { - float hAdjust = 0; - //CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2); - if (!IsRangeStyleNull) - { - switch (TextAlign) - { - case TextAlignEnum.CenterBottom: - case TextAlignEnum.GeneralBottom: - case TextAlignEnum.LeftBottom: - case TextAlignEnum.RightBottom: - hAdjust = Math.Max(0,h - (mult * HContent) )-1; - //Console.WriteLine("\"Bottom\",{0},{1},{2}", h, HContent, hAdjust); - break; - case TextAlignEnum.CenterCenter: - case TextAlignEnum.GeneralCenter: - case TextAlignEnum.LeftCenter: - case TextAlignEnum.RightCenter: - hAdjust = Math.Max(0,(h - (mult * HContent)) / 2)-1; - //Console.WriteLine("\"Middle\",{0},{1},{2}", h, HContent, hAdjust); - break; - default: - break; - } - } - return hAdjust; - } - #endregion - #region Private Border Methods - // coordinate system is upside down of screen. 0,0 on screen is top/left. 0,0 on pdf is bottom/left. - // i.e. x is same, y is flipped. - private void BordersToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top, float x, float w, float y, float h, bool doTop) - { - PdfContentByte cb = myColumnText.Canvas; - cb.SaveState();// Save state before drawing borders - //SetOpacity(cb, .7F); // This line makes the borders transparent for testing - float xLeft = left + x + XOffset; - float yTop = top - y + YOffset; - float xRight = left + x + w + XOffset; - float yBottom = top - y - h + YOffset; - // ZoomToCell(myColumnText, xLeft, yTop, xRight, yBottom); - // Draw Top Side for the first row - // B2022-028: Insert image into grid & print. The top/left was no longer visible if an image is in a grid cell, redraw it - if (r1 == 0 || doTop) - DrawHorizontalLine(cb, "Top", xLeft, xRight, yTop, TopSide, LeftSide, AboveLeftSide, LeftOfTopSide, AboveRightSide, RightSide, RightOfTopSide); - // Draw Left Side for the first column - if (c1 == 0 || doTop) - DrawLineVertical(cb, "Left", xLeft, yBottom, yTop, LeftSide, BottomSide, LeftOfBottomSide, BelowLeftSide, LeftOfTopSide, TopSide, AboveLeftSide); - // Draw Bottom Side - DrawHorizontalLine(cb, "Bottom", xLeft, xRight, yBottom, BottomSide, BelowLeftSide, LeftSide, LeftOfBottomSide, RightSide, BelowRightSide, RightOfBottomSide); - // Draw Right Side - DrawLineVertical(cb, "Right", xRight, yBottom, yTop, RightSide, RightOfBottomSide, BottomSide, BelowRightSide, TopSide, RightOfTopSide, AboveRightSide); - cb.RestoreState(); - } - // C2021-004 Set the cell background shading color - private void ShadingToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top, float x, float w, float y, float h) - { - PdfContentByte cb = myColumnText.Canvas; - cb.SaveState();// Save state before shading - float xLeft = left + x + XOffset; - float yTop = top - y + YOffset; - float xRight = left + x + w + XOffset; - float yBottom = top - y - h + YOffset; - //Console.WriteLine("Color {0}", MyShading.TableShadingInfo[r1, c1]); - FillRectangle(cb, xLeft, xRight, yTop, yBottom, new Color(MyShading.GetColor(r1, c1)), new Color(MyShading.GetColor(r1, c1))); - cb.RestoreState(); - } - - // PIP TESTING SHADING CELLS - private void FillRectangle(PdfContentByte cb, float xLeft, float xRight, float yTop, float yBottom, Color FillColor, Color OutlineColor) - { - cb.SaveState(); - cb.SetColorFill(FillColor); - cb.SetLineWidth(.5f); - cb.SetColorStroke(OutlineColor); - cb.RoundRectangle(xLeft, yBottom, xRight-xLeft, yTop-yBottom, .005F); - cb.Fill(); - cb.RestoreState(); - } - - private void DrawHorizontalLine(PdfContentByte cb, string side, float xStart, float xEnd, float y, GridLinePattern LinePattern, - GridLinePattern startToLeft, GridLinePattern startToRight, GridLinePattern startAhead, - GridLinePattern endToLeft, GridLinePattern endToRight, GridLinePattern endAhead) - { - if (LinePattern != GridLinePattern.None) - { - float direction = (xStart < xEnd) ? 1 : -1; - InitializeLineStyle(cb); - SetLineColor(cb, r1, c1, side); - if (LinePattern == GridLinePattern.Double) - { - // Top Line - float dStart = -direction * DoubleIntersectionRight(startToLeft, startToRight, startAhead); - float dEnd = direction * DoubleIntersectionLeft(endToLeft, endToRight, endAhead); - DrawLine(cb, LineThicknessForDouble, xStart + dStart, y + DoubleLineOffset, xEnd + dEnd, y + DoubleLineOffset); - // Bottom Line - dStart = -direction * DoubleIntersectionLeft(startToLeft, startToRight, startAhead); - dEnd = direction * DoubleIntersectionRight(endToLeft, endToRight, endAhead); - DrawLine(cb, LineThicknessForDouble, xStart + dStart, y - DoubleLineOffset, xEnd + dEnd, y - DoubleLineOffset); - } - else if (LinePattern != GridLinePattern.Thick) - { - SetLinePattern(cb, LinePattern); - float dStart = -direction * ThinIntersection(startToLeft, startToRight, startAhead); - float dEnd = direction * ThinIntersection(endToLeft, endToRight, endAhead); - DrawLine(cb, LineThicknessForThin, xStart + dStart, y, xEnd + dEnd, y); - } - else - { - float dStart = -direction * ThickIntersection(startToLeft, startToRight, startAhead); - float dEnd = direction * ThickIntersection(endToLeft, endToRight, endAhead); - DrawLine(cb, LineThicknessForThick, xStart + dStart, y, xEnd + dEnd, y); - } - cb.Stroke(); - } - } - private void DrawLineVertical(PdfContentByte cb, string side, float x, float yStart, float yEnd, GridLinePattern LinePattern, - GridLinePattern startToLeft, GridLinePattern startToRight, GridLinePattern startAhead, - GridLinePattern endToLeft, GridLinePattern endToRight, GridLinePattern endAhead) - { - if (LinePattern != GridLinePattern.None) - { - float direction = (yStart < yEnd) ? 1 : -1; - InitializeLineStyle(cb); - SetLineColor(cb, r1, c1, side); - if (LinePattern == GridLinePattern.Double) - { - //Left Line - float dStart = -direction * DoubleIntersectionRight(startToLeft, startToRight, startAhead); - float dEnd = direction * DoubleIntersectionLeft(endToLeft, endToRight, endAhead); - DrawLine(cb, LineThicknessForDouble, x - DoubleLineOffset, yStart + dStart, x - DoubleLineOffset, yEnd + dEnd); - //Right Line - dStart = -direction * DoubleIntersectionLeft(startToLeft, startToRight, startAhead); - dEnd = direction * DoubleIntersectionRight(endToLeft, endToRight, endAhead); - DrawLine(cb, LineThicknessForDouble, x + DoubleLineOffset, yStart + dStart, x + DoubleLineOffset, yEnd + dEnd); - } - else if (LinePattern != GridLinePattern.Thick) - { - SetLinePattern(cb, LinePattern); - float dStart = -direction * ThinIntersection(startToLeft, startToRight, startAhead); - float dEnd = direction * ThinIntersection(endToLeft, endToRight, endAhead); - DrawLine(cb, LineThicknessForThin, x, yStart + dStart, x, yEnd + dEnd); - } - else - { - float dStart = -direction * ThickIntersection(startToLeft, startToRight, startAhead); - float dEnd = direction * ThickIntersection(endToLeft, endToRight, endAhead); - DrawLine(cb, LineThicknessForThick, x, yStart + dStart, x, yEnd + dEnd); - } - cb.Stroke(); - } - } - #endregion - #region Intersection Diagram - /* driving into an intersection on line being drawn, facing the intersection. Each intersection requires - * drawing of each of the four cases: - - Case 1: Line being drawn right: - - lineToLeft - ^ - | - Line Being Drawn ----->|---> LineAhead - | - v - lineToRight - - - Case 2: Line being drawn left: - - lineToRight - ^ - | - LineAhead <-----|<--- Line Being Drawn - | - v - lineToLeft - - Case 3: Line being drawn up: - - lineAhead - ^ - | - lineToLeft <-----|----> lineToRight - ^ - | - | - Line Being Drawn - - Case 4: Line being drawn down: - - Line Begin Drawn - | - | - v - lineToRight <-----|----> lineToLeft - | - | - v - lineAhead - * - */ - #endregion - #region Border Intersection Methods - private static float DoubleIntersectionLeft(GridLinePattern lineToLeft, GridLinePattern lineToRight, GridLinePattern lineAhead) - { - if (lineToLeft == GridLinePattern.Double) - return -DoubleLineOffset; - if (lineToRight == GridLinePattern.Double || lineAhead == GridLinePattern.Double) - return DoubleLineOffset; - if (lineToLeft == GridLinePattern.Thick || lineToRight == GridLinePattern.Thick) - return DoubleUnderThick; - if (VlnBorders.LineWidth(lineToLeft) == 1 || VlnBorders.LineWidth(lineToRight) == 1) - return DoubleUnderThin; - return 0; - } - private static float DoubleIntersectionRight(GridLinePattern lineToLeft, GridLinePattern lineToRight, GridLinePattern lineAhead) - { - if (lineToRight == GridLinePattern.Double) - return -DoubleLineOffset; - if (lineToLeft == GridLinePattern.Double || lineAhead == GridLinePattern.Double) - return DoubleLineOffset; - if (lineToLeft == GridLinePattern.Thick || lineToRight == GridLinePattern.Thick) - return DoubleUnderThick; - if (VlnBorders.LineWidth(lineToLeft) == 1 || VlnBorders.LineWidth(lineToRight) == 1) - return DoubleUnderThin; - return 0; - } - private static float ThinIntersection(GridLinePattern lineToLeft, GridLinePattern lineToRight, GridLinePattern lineAhead) - { - if (lineToLeft == GridLinePattern.Double && lineToRight == GridLinePattern.Double) - return -ThinUnderDouble; - if (lineToLeft == GridLinePattern.Double || lineToRight == GridLinePattern.Double) - { - if (lineAhead == GridLinePattern.Double) return -ThinUnderDouble; - return ThinOverDouble; - } - if (lineToLeft == GridLinePattern.Thick || lineToRight == GridLinePattern.Thick) - return ThinOverThick; - return 0; - } - private static float ThickIntersection(GridLinePattern lineToLeft, GridLinePattern lineToRight, GridLinePattern lineAhead) - { - if (lineToLeft == GridLinePattern.Double && lineToRight == GridLinePattern.Double) - { - if (lineAhead == GridLinePattern.Thick) return ThickOverDouble; - return -ThickUnderDouble; - } - if ( lineToLeft == GridLinePattern.Double || lineToRight == GridLinePattern.Double) - { - if (lineAhead == GridLinePattern.Double) - { - if (lineToLeft == GridLinePattern.Thick || lineToRight == GridLinePattern.Thick) - return ThickOverDouble; - return -ThickUnderDouble; - } - return ThickOverDouble; - } - if (VlnBorders.LineWidth(lineToLeft) == 1 && VlnBorders.LineWidth(lineToRight) == 1) - return ThickOverThin; - return 0; - } - #endregion - #region Basic Border Methods - private static void DrawLine(PdfContentByte cb, float lineThickness, float xStart, float yStart, float xEnd, float yEnd) - { - cb.SetLineWidth(lineThickness); - cb.MoveTo(xStart, yStart); - cb.LineTo(xEnd, yEnd); - } - private static void SetLinePattern(PdfContentByte cb, GridLinePattern linePattern) - { - if (linePattern == GridLinePattern.Dotted) - { - cb.SetLineDash(0, 2, 0); - cb.SetLineCap(PdfContentByte.LINE_CAP_ROUND); - } - else if (linePattern == GridLinePattern.Dashed) - cb.SetLineDash(4, 4, 0); - } - 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)); - //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); - } - private static void InitializeLineStyle(PdfContentByte cb) - { - cb.SetLineCap(PdfContentByte.LINE_CAP_PROJECTING_SQUARE); // Extend the line by half of it's thickness - cb.SetLineDash(0);// Solid Line - } - #endregion - #region Debug Methods - private static void SetOpacity(PdfContentByte cb, float opacity) - { - PdfGState gs = new PdfGState(); - gs.StrokeOpacity = opacity; - cb.SetGState(gs); - } - private static void ZoomToCell(iTextSharp.text.pdf.ColumnText myColumnText, float xLeft, float yTop, float xRight, float yBottom) - { - PdfDestination dest = new PdfDestination(PdfDestination.FITR, xLeft - 4, yBottom , xRight, yTop + 4); - myColumnText.Canvas.SetAction(PdfAction.GotoLocalPage(myColumnText.Canvas.PdfWriter.CurrentPageNumber, dest, myColumnText.Canvas.PdfWriter), xLeft, yBottom, xRight, yTop); - } - #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 - } -} diff --git a/PROMS/Volian.Print.Library/MergedPdf.cs b/PROMS/Volian.Print.Library/MergedPdf.cs deleted file mode 100644 index 059c9919..00000000 --- a/PROMS/Volian.Print.Library/MergedPdf.cs +++ /dev/null @@ -1,322 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Windows.Forms; -using VEPROMS.CSLA.Library; -using iTextSharp.text; -using iTextSharp.text.pdf; -using DescriptiveEnum; -using JR.Utils.GUI.Forms; - -namespace Volian.Print.Library -{ - public class MergedPdfProc - { - private string _Title; - public string Title - { - get { return _Title; } // used for pdf outline - set { _Title = value; } - } - 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) - { - _Title = title; - _PdfFileName = pfname; - } - } - // this class will manage the data & do subsequent merging of pdf files. It is used if the user - // selects the 'Merge' button off of the print dialog when doing a Print All. (C2019-012) - public class MergedPdf - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private List _mergedPdfs = null; // This list has all procedure pdfs that will be included in the merged file. - public List MergedPdfs - { - get { return _mergedPdfs; } - set { _mergedPdfs = value; } - } - 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 iTextSharp.text.Font _itextFont = null; - private MergedPdfsPageNumCorner _corner; - private float _xloc = 0; - private float _yloc = 0; - // C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location - private MergedPdfsPageNumCorner _landcorner; - private float _landxloc = 0; - private float _landyloc = 0; - // the following constructs the class that contains data for merging a group of pdfs. - public MergedPdf(string folder, DocVersionInfo dvi) - { - _folder = folder; - _docVersionInfo = dvi; - } - // the following merges the procedure pdfs into a single pdf - public bool DoTheMerge(Dictionary> MergedLandscapPages, bool generatePointListFile) - { - if (MergedPdfs == null) - { - FlexibleMessageBox.Show("There are no PDFs to merge.", "Merging Pdfs Error", MessageBoxButtons.OK); - return false; - } - iTextSharp.text.Document doc = new iTextSharp.text.Document(); - string slashReplace = _docVersionInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SlashReplace ?? "_"; - MergedFileName = _folder + @"\" + _docVersionInfo.MyFolder.Name.Replace("/", slashReplace).Replace("\\", slashReplace) + ".pdf"; - MergedFileName = ItemInfo.StripRtfFormatting(MergedFileName); - // C2021-063 file name of Alarm Point List file containing Serial Number, Title, and merged Page Number - StreamWriter sw = null; - string PointListPageNums = MergedFileName.Replace(".pdf", "_PointList.txt"); - if (generatePointListFile) - { - FileInfo fi = new FileInfo(PointListPageNums); - sw = fi.CreateText(); - } - PdfWriter writer = null; - // see if it can be created and if not, see if it is open and tell user: - try - { - writer = PdfWriter.GetInstance(doc, new FileStream(MergedFileName, FileMode.Create)); - } - catch (Exception ex) - { - StringBuilder sb = new StringBuilder(); - sb.AppendLine("Could not create"); - sb.AppendLine(); - sb.AppendLine(MergedFileName + "."); - sb.AppendLine(); - sb.AppendLine("If it is open, close and retry."); - FlexibleMessageBox.Show(sb.ToString(), "Error on CreatePdf", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - if (writer == null) return false; - doc.Open(); - PdfContentByte canvas = writer.DirectContent; - int mergedPageNumber = 0; // this is the number that will be used for the token (for of ) - int totalPages = 0; // this is the number that will be used for the token (for of ) - foreach (MergedPdfProc mpp in MergedPdfs) totalPages += mpp.PageCount; - bool doPageNum = GetPageOfInfo(); // get the format and location of page number - this can be reused for each procedure - // the MergedPdfs contains a list of all of the procedures' pdfs that will be merged into the final pdf - int idxSerialNum = 0; // used to generate the Alarm serial number for Point List file - foreach (MergedPdfProc mpp in MergedPdfs) - { - // C2021-063 write Alarm Point List information to the text file - if (generatePointListFile) - { - // write Serial Number, Title, and Page Number in the Point List file - sw.WriteLine("{0}\t{1}\t{2}", idxSerialNum++, mpp.Title, mergedPageNumber + 1); - } - string pdffilename = _folder + @"\" + mpp.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); - return false; - } - // B2019-152: The MergedLandscapePages Dictionary contains page numbers for pdfs that need to be landscaped. These are - // added on 'endpages' when printing is done. - List LandscapePages = null; // List of landscaped pages for a pdf - if (PromsPrinter.MergedLandscapePages != null) - { - string fname = mpp.PdfFileName.Substring(0, mpp.PdfFileName.IndexOf(".pdf")); - if (PromsPrinter.MergedLandscapePages.ContainsKey(fname)) - LandscapePages = PromsPrinter.MergedLandscapePages[fname]; - } - 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. - { - reader = new PdfReader(_folder + @"\" + mpp.PdfFileName); - int numPages = reader.NumberOfPages; - int currentPageNumber = 0; - PdfOutline outline = null; - Rectangle paperSize = PDFPageSize.UsePaperSize(_docVersionInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - do // merging pages into complete... - { - currentPageNumber += 1; - mergedPageNumber += 1; - doc.SetPageSize(paperSize); - doc.NewPage(); - PdfImportedPage page = writer.GetImportedPage(reader, currentPageNumber); // gets a page that is 'ready' to be written to combined pdf - // F2021-046: flag if cover page section doesn't print page number on first page of merged pdf: - if (doPageNum && (!(mpp.FirstPageNoPageNum && currentPageNumber == 1))) // get the string & fill in with and numbers - { - bool landscape = false; - if (LandscapePages != null && LandscapePages.Contains(currentPageNumber - 1)) landscape = true; - string outputpageof = _pageof.Replace("", mergedPageNumber.ToString()).Replace("", totalPages.ToString()); - AddPageNumberToPage(page, canvas, outputpageof, landscape); - } - PdfDestination dest = new PdfDestination(PdfDestination.FIT); - // 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. - if (currentPageNumber == 1) - outline = new PdfOutline(canvas.RootOutline, dest, mpp.PdfFileName.Replace(".pdf", "") + " - " + mpp.Title, false); - else - new PdfOutline(outline, dest, "Page " + currentPageNumber.ToString(), false); - canvas.AddTemplate(page, 0, 0); // adds the page to the combined pdf - } while (currentPageNumber < numPages); - } - catch (Exception ex) - { - string tmp = string.Format("Error merging pdf {0}", mpp.PdfFileName); - _MyLog.Error(tmp, ex); - } - } - // C2021-063 display the generated Alarm Point List text in NotePad - if (generatePointListFile) - { - sw.Close(); - System.Diagnostics.Process.Start(PointListPageNums); - } - doc.Close(); - return true; - } - // this method adds the page number to the page before it is merged in. It determines the position from the properties - // that were set on the doc version properties dialog (these values were set as local class variables from GetPageOfInfo) - private void AddPageNumberToPage(PdfImportedPage page, PdfContentByte cb, string outputpage, bool landscape) - { - float pgright = page.BoundingBox.Right; - float pgleft = page.BoundingBox.Left; - 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 - // B2019-152: Landscape page numbers when merging - if (landscape) - { - pgright = page.BoundingBox.Top; - pgleft = page.BoundingBox.Bottom; - pgtop = page.BoundingBox.Right; - pgbot = page.BoundingBox.Left; - cnr = _landcorner; // C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location - } - Phrase ph = new Phrase(); - Chunk chk = new Chunk(outputpage, _itextFont); - ph.Add(chk); - Paragraph pg = new Paragraph(ph); - ColumnText columnText = new ColumnText(cb); - cb.SaveState(); - switch (cnr) - { - case MergedPdfsPageNumCorner.TopRight: - columnText.Alignment = Element.ALIGN_RIGHT; - if (landscape) // B2019-152: landscape page numbers - { - System.Drawing.Drawing2D.Matrix myMatrix1 = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0); - cb.Transform(myMatrix1); - columnText.SetSimpleColumn(0, pgright - _landyloc, pgright - _landxloc, 0); // C2021-047: use landscape x & y - } - else - columnText.SetSimpleColumn(0, pgtop - _yloc, pgright - _xloc, 0); - break; - case MergedPdfsPageNumCorner.BottomRight: - columnText.Alignment = Element.ALIGN_RIGHT; - if (landscape) // B2019-152: landscape page numbers - { - System.Drawing.Drawing2D.Matrix myMatrix2 = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Width, 0); - cb.Transform(myMatrix2); - columnText.SetSimpleColumn(0, _landyloc, pgright - _landxloc, 0); // C2021-047: use landscape x & y - } - else - columnText.SetSimpleColumn(0, _yloc, pgright - _xloc, 0); - break; - case MergedPdfsPageNumCorner.TopLeft: - if (landscape) // B2019-152: landscape page numbers - { - System.Drawing.Drawing2D.Matrix myMatrix3 = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0); - cb.Transform(myMatrix3); - columnText.SetSimpleColumn(_xloc, pgright - _landyloc, pgright - _landxloc, 0); // C2021-047: use landscape x & y - } - else - { - columnText.SetSimpleColumn(_xloc, pgtop - _yloc, pgright, 0); // page alignment defaults to ALIGN_LEFT - } - break; - case MergedPdfsPageNumCorner.BottomLeft: - if (landscape) // B2019-152: landscape page numbers - { - System.Drawing.Drawing2D.Matrix myMatrix4 = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Width, 0); - cb.Transform(myMatrix4); - columnText.SetSimpleColumn(_xloc, _landyloc, pgright - _landxloc, 0); // C2021-047: use landscape x & y - } - else - { - columnText.SetSimpleColumn(_xloc, _yloc, pgright, 0); // page alignment defaults to ALIGN_LEFT - } - break; - } - columnText.AddText(pg); - columnText.Go(); - cb.RestoreState(); - } - // this method gets the format, font & location data from the doc version properties that are stored on the doc version's - // config field. It saves them as local class variables to be used in other places in this class. - private bool GetPageOfInfo() - { - DocVersionConfig dvc = (DocVersionConfig) _docVersionInfo.MyConfig; - MergedPdfsPageOf po = 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 'Other' for the format, use text in textbox to format the of string, note that and are - // resolved when adding pages to the merge document. The only other 'token' that is supported is '' - if (tmp == "Other") tmp = dvc.Print_MergedPdfsPageNumFormatOther; - _pageof = tmp.Replace("", _docVersionInfo.MyFolder.Name); - - // If font data is not supplied, use the default from the format for this working draft - string famtmp = dvc.Print_MergedPdfsPageNumFont; - if (famtmp == null || famtmp == "") - { - famtmp = _docVersionInfo.ActiveFormat.PlantFormat.FormatData.Font.Family; - } - tmp = dvc.Print_MergedPdfsPageNumFontSize; - float? tmpi=0; - if (tmp == null || tmp == "") - { - // use the default from the format from this working draft - tmpi = _docVersionInfo.ActiveFormat.PlantFormat.FormatData.Font.Size; - } - else - tmpi = int.Parse(tmp); - - // set local values of variables to be used in various other methods in this class. - _itextFont = Volian.Svg.Library.Svg.GetFont(famtmp, (float)tmpi, 0, System.Drawing.Color.Black); - _xloc = (float)dvc.Print_MergedPdfsPageNumLocX * 72; - _yloc = (float)dvc.Print_MergedPdfsPageNumLocY * 72; - _corner = dvc.Print_MergedPdfsPageNumCorner; - // C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location - _landxloc = (float)dvc.Print_MergedPdfsLandPageNumLocX * 72; - _landyloc = (float)dvc.Print_MergedPdfsLandPageNumLocY * 72; - _landcorner = dvc.Print_MergedPdfsLandPageNumCorner; - - return true; - } - } -} diff --git a/PROMS/Volian.Print.Library/PDFChronologyReport.cs b/PROMS/Volian.Print.Library/PDFChronologyReport.cs deleted file mode 100644 index 73e7ca1e..00000000 --- a/PROMS/Volian.Print.Library/PDFChronologyReport.cs +++ /dev/null @@ -1,1814 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using VEPROMS.CSLA.Library; -using iTextSharp.text.pdf; -using iTextSharp.text; -using System.IO; -using System.Text.RegularExpressions; - -namespace Volian.Print.Library -{ - public class PDFChronologyReport - { - private static Dictionary _AnnotationLookup; - public static Dictionary AnnotationLookup - { - get - { - if (_AnnotationLookup == null) - { - _AnnotationLookup = new Dictionary(); - AnnotationTypeInfoList atil = AnnotationTypeInfoList.Get(); - foreach (AnnotationTypeInfo ati in atil) - _AnnotationLookup.Add(ati.TypeID, ati.Name); - } - return _AnnotationLookup; - } - } - private string _FileName; - public string FileName - { - get { return _FileName; } - set { _FileName = value; } - } - private ProcedureInfo _MyProc; - public ProcedureInfo MyProc - { - get { return _MyProc; } - set { _MyProc = value; } - } - private ContentAuditInfoList _AuditList; - public ContentAuditInfoList AuditList - { - get { return _AuditList; } - set { _AuditList = value; } - } - private AnnotationAuditInfoList _AnnotationList; - public AnnotationAuditInfoList AnnotationList - { - get { return _AnnotationList; } - set { _AnnotationList = value; } - } - public PDFChronologyReport(string fileName, ProcedureInfo myProc, ContentAuditInfoList auditList, AnnotationAuditInfoList annotationList) - { - _FileName = fileName; - _MyProc = myProc; - _AuditList = auditList; - _AnnotationList = annotationList; - } - public void BuildChronology() - { - Rectangle paperSize = PDFPageSize.UsePaperSize(MyProc.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize);// C2020-002 paper size is now set in the format files - iTextSharp.text.Document document = new iTextSharp.text.Document(paperSize, 36, 36, 36, 36); - if (!CreateResultsPDF(document)) return; - try - { - BuildChronologyReport(document); - } - catch (Exception ex) - { - StringBuilder msg = new StringBuilder(); - document.Add(new Paragraph("Error:")); - while (ex != null) - { - document.Add(new Paragraph(ex.GetType().Name)); - document.Add(new Paragraph(ex.Message)); - ex = ex.InnerException; - } - } - finally - { - if (document.IsOpen()) - { - document.Close(); - System.Diagnostics.Process.Start(_FileName); - } - } - } - public void BuildSummary() - { - BuildSummary(true); - } - public void BuildSummary(bool openReport) - { - bool hasData = false; - Rectangle paperSize = PDFPageSize.UsePaperSize(MyProc.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - iTextSharp.text.Document document = new iTextSharp.text.Document(paperSize, 36, 36, 36, 36); - if (!CreateResultsPDF(document)) return; - try - { - BuildSummaryReport(document); - //BuildSummaryReport2(document); - } - catch (Exception ex) - { - StringBuilder msg = new StringBuilder(); - document.Add(new Paragraph("Error:")); - while (ex != null) - { - document.Add(new Paragraph(ex.GetType().Name)); - document.Add(new Paragraph(ex.Message)); - ex = ex.InnerException; - } - } - finally - { - if (document.IsOpen()) - { - document.Close(); - if(openReport) - System.Diagnostics.Process.Start(_FileName); - } - } - } - private bool CreateResultsPDF(iTextSharp.text.Document document) - { - bool result = false; - string suffix = ""; - int i = 0; - // just for safety, the while loop expects to find a file extension - // so make sure it has one before going into the loop - if (!_FileName.ToUpper().EndsWith(".PDF")) - _FileName += ".pdf"; - // Try to open a file for creating the PDF. - while (result == false) - { - 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("."); - if (loc > -1) - { - string fname = fileName.Substring(0, loc); - fileName = fname + suffix + ".pdf"; - } - else - fileName = fileName + suffix + ".pdf"; -// string fileName = _FileName.ToLower().Replace(".pdf", suffix + ".pdf"); - try - { - PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create)); - //C2017-017 add a footer consisting of the page number and date printed to summary/chronology of changes report - // This is the same Page Event used for Search reports (search results print) and is defined in PDFReport.cs - writer.PageEvent = new MyPageHelper("Procedure Changes"); - document.SetMargins(36, 36, 36, 36); - document.Open(); - _FileName = fileName; - result = true; - } - catch (System.IO.IOException exIO) - { - - if (exIO.Message.Contains("because it is being used by another process")) - suffix = string.Format("_{0}", ++i);// If this file is in use, increment the suffix and try again - else // If some other error, display a message and don't print the results - { - ShowException(exIO); - return false; - } - } - catch (Exception ex) - { - ShowException(ex); - return false; // Could not open the output file - } - } - return true; - } - private static void ShowException(Exception ex) - { - Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); - StringBuilder msg = new StringBuilder(); - string sep = ""; - string indent = ""; - while (ex != null) - { - msg.Append(string.Format("{0}{1}{2}:\r\n{1}{3}", sep, indent, ex.GetType().Name, ex.Message)); - ex = ex.InnerException; - sep = "\r\n"; - indent += " "; - } - 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 void BuildChronologyReport(iTextSharp.text.Document doc) - { - int lastAnnotationID = 0; - int cols = 5; - int borders = 0; - int paddingBottom = 6; - PdfPTable t = new PdfPTable(cols); - t.HeaderRows = 4; - t.DefaultCell.Padding = 4; - t.WidthPercentage = 100; - float[] widths = new float[] { 1f, 1f, 1f, 1f, 4f }; - t.SetWidths(widths); - //t.HorizontalAlignment = 0; - // 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 - iTextSharp.text.Font f1 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 14, 1, 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, 9, 0, Color.BLACK); - iTextSharp.text.Font f4 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 9, 1, Color.BLACK); - //report title - Phrase h = new Phrase(); - h.Font = f1; - h.Add("Chronology of Changes Report"); - PdfPCell c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - //procedure title - h = new Phrase(); - h.Font = f2; - h.Add(string.Format("{0} - {1}", MyProc.DisplayNumber, MyProc.DisplayText)); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - string section = string.Empty; - string stepnum = string.Empty; - DateTime maxDTS = DateTime.MinValue; - int lastID = 0; - ContentAuditInfo oldCAI = null; - string oldText = string.Empty; - string oldTypeName = string.Empty; -// Dictionary processedAAI = new Dictionary(); - Dictionary processedAAI = new Dictionary(); - foreach (ContentAuditInfo cai in AuditList) - { - //raw path - string[] NewPath = SplitPath(cai.Path); - if (NewPath[0] != section) - { - AddStepAnnotation(ref lastAnnotationID, cols, paddingBottom, t, f3, f4, ref h, ref c, oldCAI, processedAAI); - section = NewPath[0]; - h = new Phrase(); - h.Font = f4; - h.Add(section); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - } - //step - if (NewPath[1] != stepnum) - { - AddStepAnnotation(ref lastAnnotationID, cols, paddingBottom, t, f3, f4, ref h, ref c, oldCAI, processedAAI); - oldCAI = cai; - oldText = cai.Text; - oldTypeName = cai.TypeName; - stepnum = NewPath[1]; - string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2"); - stepnum2 = stepnum2.Replace("RNO.", "RNO"); - // check to see if we have step number to output - // if not just put in a blank cell. - // this cleans up the report so that we don't have "Step" without anything after it. - // This was happening when we were reporting change information of a section number/title - if (stepnum2 != "") - { - h = new Phrase(); - h.Font = f3; - h.Add(string.Format("Step {0}", stepnum2)); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_RIGHT; - c.PaddingBottom = paddingBottom; - c.PaddingRight = 10; - //c.Border = borders; - t.AddCell(c); - } - else - t.AddCell(BlankCell(1)); - } - else - t.AddCell(BlankCell(1)); - //what - if (cai.ContentID != lastID) maxDTS = DateTime.MinValue; - h = new Phrase(); - h.Font = f3; - string actionWhat = (cai.ActionWhat == "Added" && cai.DTS <= MyProc.ChangeBarDate) ? "Original" : cai.ActionWhat != "Changed" ? cai.ActionWhat : cai.DTS <= maxDTS ? "Restored" : cai.DTS > MyProc.ChangeBarDate ? cai.ActionWhat : "Original"; - if (actionWhat == "Deleted" || actionWhat == "Restored") - h.Add(actionWhat + "\r\n" + (cai.ActionWhen < cai.DTS ? cai.DTS.ToString("M/dd/yyyy") : cai.ActionWhen.ToString())); - else - h.Add(actionWhat); - if (cai.DTS > maxDTS) - maxDTS = cai.DTS; - lastID = cai.ContentID; - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //who - h = new Phrase(); - h.Font = f3; - h.Add(cai.UserID); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //when - h = new Phrase(); - h.Font = f3; - h.Add(cai.DTS.ToString()); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //new text - //h.Add(cai.Text); - if (cai.Type == 20008) - { - GridAuditInfoList gail = GridAuditInfoList.Get(cai.ContentID); - bool addedInfo = false; - if (gail.Count > 0) - { - GridAuditInfo gai = gail[0]; - System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); - xd.LoadXml(gai.Data); - //int grows = int.Parse(xd.SelectSingleNode("C1FlexGrid/RowInfo/Count").InnerText); - int gcols = int.Parse(xd.SelectSingleNode("C1FlexGrid/ColumnInfo/Count").InnerText); - string data = ItemInfo.ConvertToDisplayText(cai.Text); - PdfPTable gtbl = new PdfPTable(gcols); - while (data.Length > 0) - { - int indx = data.IndexOf(";"); // B2022-079: error on chronology report (data missing ';' so couldn't parse out report info) - if (indx > 0) - { - addedInfo = true; - string val = data.Substring(0, data.IndexOf(";")); - data = data.Substring(data.IndexOf(";") + 1); - Phrase hh = new Phrase(); - hh.Font = f4; - hh.Add(val); - PdfPCell cc = new PdfPCell(hh); - gtbl.AddCell(cc); - } - else - data = ""; // couldn't find separator ';', don't continue to loop - } - // If added info above, i.e. no error, put out the cell - if (addedInfo) - { - c = new PdfPCell(gtbl); - c.Colspan = cols - 4; - c.HorizontalAlignment = Element.ALIGN_LEFT; - t.AddCell(c); - } - } - if (!addedInfo) // Didn't add info, report that data not available - { - h = new Phrase(); - h.Font = f4; - c = new PdfPCell(h); - h.Add("No Audit Details Available"); - c.Colspan = cols - 4; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - t.AddCell(c); - } - } - else - { - h = new Phrase(); - h.Font = f4; - if (cai.Text != oldText && cai.TypeName != oldTypeName) - h.Add(string.Format("[Type Change {0} to {1}] - {2}", oldTypeName, cai.TypeName, ItemInfo.ConvertToDisplayText(cai.Text)));// + " to " + cai.TypeName); - else if (cai.Text == oldText && cai.TypeName != oldTypeName) - h.Add(oldTypeName + " to " + cai.TypeName); - else - { - string txt = null; - if ((cai.Text==null || cai.Text=="") && (cai.Type == 20036 || cai.Type == 20037 || cai.Type == 20038 || cai.Type == 20039)) - txt = "Embedded Image"; - else if (cai.Type > 20099) // B2020-054: Always put out 'Equation' (removed checking for null text) - txt = "Equation"; - else - txt = ItemInfo.ConvertToDisplayText(cai.Text).Replace("Go to \u25cf", "Go to ?"); - if (MyProc.MyDocVersion.MultiUnitCount > 1) - { - System.Xml.XmlNode nd; - if (cai.Config == string.Empty) - nd = null; - else - { - System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); - xd.LoadXml(cai.Config); - nd = xd.SelectSingleNode("//MasterSlave"); - } - if (nd == null) - txt += "\r\n\r\nApplicable to all units"; - else - { - nd = nd.Attributes.GetNamedItem("Applicability"); - if (nd.InnerText == "0") - txt += "\r\n\r\nApplicable to no units"; - else - { - int k = MyProc.MyDocVersion.DocVersionConfig.SelectedSlave; - string[] myss = nd.InnerText.Split(",".ToCharArray()); - string un = "\r\n\r\nApplicable to "; - string sep = string.Empty; - foreach (string ss in myss) - { - MyProc.MyDocVersion.DocVersionConfig.SelectedSlave = int.Parse(ss); - un += sep + MyProc.MyDocVersion.DocVersionConfig.Unit_Name; - sep = ","; - } - txt += un; - MyProc.MyDocVersion.DocVersionConfig.SelectedSlave = k; - } - } - } - h.Add(txt); - } - oldCAI = cai; - oldText = cai.Text; - oldTypeName = cai.TypeName; - c = new PdfPCell(h); - c.Colspan = cols - 4; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - } - ////old text - //t.AddCell(BlankCell(3)); - //h = new Phrase(); - //h.Font = f4; - //h.Add("Old text: " + cai.OldText); - //c = new PdfPCell(h); - //c.Colspan = 7; - //c.Border = 0; - //t.AddCell(c); - } - //see if any annotations for old stepnum here and add them - foreach (AnnotationAuditInfo aai in AnnotationList) - { - if (oldCAI != null && aai.IContentID == oldCAI.ContentID) - { - //add annotation to minilist -// processedAAI.Add(aai.AnnotationID, aai); - if (!processedAAI.ContainsKey(aai)) // bug fix, only add to the processed list if it is not already in the list - processedAAI.Add(aai, aai); - //write row to table - t.AddCell(BlankCell(1)); - h = new Phrase(); - h.Font = f3; - if (aai.AnnotationID != lastAnnotationID) - { - lastAnnotationID = aai.AnnotationID; - h.Add(AnnotationLookup[aai.TypeID] + " " + aai.ActionWhat); - } - else - h.Add(aai.ActionWhat); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //who - h = new Phrase(); - h.Font = f3; - h.Add(aai.UserID); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //when - h = new Phrase(); - h.Font = f3; - h.Add(aai.ActionWhen.ToString()); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //new text - h = new Phrase(); - h.Font = f4; - //h.Add(cai.Text); - h.Add(ItemInfo.ConvertToDisplayText(aai.SearchText)); - c = new PdfPCell(h); - c.Colspan = cols - 4; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - } - } - bool annotationHeader = false; - section = string.Empty; - stepnum = string.Empty; - foreach (AnnotationAuditInfo aai in AnnotationList) - { -// if (!processedAAI.ContainsKey(aai.AnnotationID)) - if (!processedAAI.ContainsKey(aai)) - { - if (!annotationHeader) - { - t.AddCell(BlankCell(cols)); - h = new Phrase(); - h.Font = f4; - h.Add("ANNOTATIONS"); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - annotationHeader = true; - } - string[] NewPath = GetNewPath(AuditList, aai.IContentID); - if (NewPath[0] != section) - { - section = NewPath[0]; - stepnum = string.Empty; - h = new Phrase(); - h.Font = f4; - h.Add(section); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - } - if (NewPath[1] != stepnum) - { - stepnum = NewPath[1]; - string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2"); - stepnum2 = stepnum2.Replace("RNO.", "RNO"); - h = new Phrase(); - h.Font = f3; - h.Add(string.Format("Step {0}", stepnum2)); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_RIGHT; - c.PaddingBottom = paddingBottom; - c.PaddingRight = 10; - //c.Border = borders; - t.AddCell(c); - } - else - { - t.AddCell(BlankCell(1)); - } - //what - h = new Phrase(); - h.Font = f3; - if (aai.AnnotationID != lastAnnotationID) - { - lastAnnotationID = aai.AnnotationID; - h.Add(AnnotationLookup[aai.TypeID] + " " + aai.ActionWhat); - } - else - h.Add(aai.ActionWhat); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //who - h = new Phrase(); - h.Font = f3; - h.Add(aai.UserID); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //when - h = new Phrase(); - h.Font = f3; - h.Add(aai.ActionWhen.ToString()); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //new text - h = new Phrase(); - h.Font = f4; - //h.Add(cai.Text); - h.Add(ItemInfo.ConvertToDisplayText(aai.SearchText)); - c = new PdfPCell(h); - c.Colspan = cols - 4; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - } - } - if (t.Rows.Count == t.HeaderRows) - { - c = new PdfPCell(new Phrase("No changes to report")); - c.Colspan = cols; - t.AddCell(c); - } - doc.Add(t); - } - - private void AddStepAnnotation(ref int lastAnnotationID, int cols, int paddingBottom, PdfPTable t, iTextSharp.text.Font f3, iTextSharp.text.Font f4, ref Phrase h, ref PdfPCell c, ContentAuditInfo oldCAI, Dictionary processedAAI) - { - //see if any annotations for old stepnum here and add them - foreach (AnnotationAuditInfo aai in AnnotationList) - { - if (oldCAI != null && aai.IContentID == oldCAI.ContentID) - { - //add annotation to minilist - // processedAAI.Add(aai.AnnotationID, aai); - if(processedAAI.ContainsKey(aai)) - return; - processedAAI.Add(aai, aai); - //write row to table - t.AddCell(BlankCell(1)); - h = new Phrase(); - h.Font = f3; - if (aai.AnnotationID != lastAnnotationID) - { - lastAnnotationID = aai.AnnotationID; - h.Add(AnnotationLookup[aai.TypeID] + " " + aai.ActionWhat); - } - else - h.Add(aai.ActionWhat); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //who - h = new Phrase(); - h.Font = f3; - h.Add(aai.UserID); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //when - h = new Phrase(); - h.Font = f3; - h.Add(aai.ActionWhen.ToString()); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //new text - h = new Phrase(); - h.Font = f4; - //h.Add(cai.Text); - h.Add(ItemInfo.ConvertToDisplayText(aai.SearchText)); - c = new PdfPCell(h); - c.Colspan = cols - 4; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - } - } - } - private static string[] SplitPath(string path) - { - // Remove Procedure Number and Title - string sectionAndStep = Regex.Replace(path + "\x7\x7\x7", "^.+?\\u0007", ""); - //sectionAndStep = sectionAndStep.Replace("\x11", sectionAndStep[0] == '\x11' ? "" : " - "); - sectionAndStep = sectionAndStep.Replace("\x11", sectionAndStep[0] == '\x11' ? "" : " "); - sectionAndStep = sectionAndStep.Replace("\\u160?", " "); // replace a hardspace with a space - // Split Section frrom Steps - return sectionAndStep.Split("\x7".ToCharArray()); - } - private string[] GetNewPath(ContentAuditInfoList AuditList, int contentID) - { - foreach (ContentAuditInfo cai in AuditList) - { - if(cai.ContentID == contentID) - return SplitPath(cai.Path); - } - ItemInfoList iil = ItemInfoList.GetByContentID(contentID); - if (iil.Count > 0) - { - return SplitPath(iil[0].SearchPath); - } - return "Section\x7Step".Split("\x7".ToCharArray()); - } - private void BuildSummaryReport2(iTextSharp.text.Document doc) - { - string section = string.Empty; - string stepnum = string.Empty; - ContentAuditInfo firstCAI = null; - ContentAuditInfo nextCAI = null; - ContentAuditInfo lastCAI = null; - List auditList = new List(); - foreach (ContentAuditInfo cai in AuditList) - { - string[] NewPath = SplitPath(cai.Path); - if (NewPath[1] != stepnum) - { - stepnum = NewPath[1]; - if (firstCAI != null) - { - if (lastCAI == null) - { - auditList.Add(firstCAI); - } - else if (lastCAI.ActionWhat == "Deleted" && firstCAI.DTS < MyProc.ChangeBarDate) - { - auditList.Add(lastCAI); - } - else if (lastCAI.ActionWhat == "Changed" && lastCAI.Text != firstCAI.Text) - { - auditList.Add(firstCAI); - auditList.Add(lastCAI); - } - else if (lastCAI.ActionWhat == "Changed" && firstCAI.ActionWhat == "Added" && lastCAI.Text == firstCAI.Text) - { - auditList.Add(firstCAI); - } - else if (lastCAI == null && firstCAI.ActionWhat == "Added") - { - auditList.Add(firstCAI); - } - lastCAI = null; - } - firstCAI = cai; - } - else - { - lastCAI = cai; - } - } - if (firstCAI != null) - auditList.Add(firstCAI); - if (lastCAI != null) - auditList.Add(lastCAI); - #region annotations - AnnotationAuditInfo firstAAI = null; - AnnotationAuditInfo nextAAI = null; - AnnotationAuditInfo lastAAI = null; - int icontentID = 0; - List annotationList = new List(); - foreach (AnnotationAuditInfo aai in AnnotationList) - { - if (aai.IContentID != icontentID) - { - icontentID = aai.IContentID; - if (firstAAI != null) - { - if (lastAAI == null) - { - annotationList.Add(firstAAI); - } - else if (lastAAI.ActionWhat == "Deleted" && firstAAI.DTS < MyProc.ChangeBarDate) - { - annotationList.Add(lastAAI); - } - else if (lastAAI.ActionWhat == "Changed" && lastAAI.SearchText != firstAAI.SearchText) - { - annotationList.Add(firstAAI); - annotationList.Add(lastAAI); - } - else if (lastAAI.ActionWhat == "Changed" && firstAAI.ActionWhat == "Added" && lastAAI.SearchText == firstAAI.SearchText) - { - annotationList.Add(firstAAI); - } - else if (lastAAI == null && firstAAI.ActionWhat == "Added") - { - annotationList.Add(firstAAI); - } - lastAAI = null; - } - firstAAI = aai; - } - else - lastAAI = aai; - } - if (firstAAI != null) - annotationList.Add(firstAAI); - if (lastAAI != null) - annotationList.Add(lastAAI); - #endregion - int cols = 5; - int borders = 0; - int paddingBottom = 6; - PdfPTable t = new PdfPTable(cols); - t.HeaderRows = 4; - t.DefaultCell.Padding = 4; - t.WidthPercentage = 100; - float[] widths = new float[] { 1f, 1f, 1f, 1f, 4f }; - t.SetWidths(widths); - //t.HorizontalAlignment = 0; - // 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 - iTextSharp.text.Font f1 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 14, 1, 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, 9, 0, Color.BLACK); - iTextSharp.text.Font f4 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 9, 1, Color.BLACK); - //report title - Phrase h = new Phrase(); - h.Font = f1; - h.Add("Summary of Changes Report"); - PdfPCell c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - //procedure title - h = new Phrase(); - h.Font = f2; - h.Add(string.Format("{0} - {1}", MyProc.DisplayNumber, MyProc.DisplayText)); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - foreach (ContentAuditInfo cai in auditList) - { - //raw path - string[] NewPath = SplitPath(cai.Path); - if (NewPath[0] != section) - { - section = NewPath[0]; - h = new Phrase(); - h.Font = f4; - h.Add(section); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - } - //step - if (NewPath[1] != stepnum) - { - firstCAI = cai; - stepnum = NewPath[1]; - string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2"); - stepnum2 = stepnum2.Replace("RNO.", "RNO"); - h = new Phrase(); - h.Font = f3; - h.Add(string.Format("Step {0}", stepnum2)); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_RIGHT; - c.PaddingBottom = paddingBottom; - c.PaddingRight = 10; - //c.Border = borders; - t.AddCell(c); - } - else - { - t.AddCell(BlankCell(1)); - nextCAI = cai; - } - //what - h = new Phrase(); - h.Font = f3; - h.Add(cai.ActionWhen > MyProc.ChangeBarDate ? cai.ActionWhat : "Original"); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //who - h = new Phrase(); - h.Font = f3; - h.Add(cai.UserID); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //when - h = new Phrase(); - h.Font = f3; - h.Add(cai.ActionWhen.ToString()); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //new text - h = new Phrase(); - h.Font = f4; - //h.Add(cai.Text); - h.Add(ItemInfo.ConvertToDisplayText(cai.Text)); - c = new PdfPCell(h); - c.Colspan = cols - 4; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - ////old text - //t.AddCell(BlankCell(3)); - //h = new Phrase(); - //h.Font = f4; - //h.Add("Old text: " + cai.OldText); - //c = new PdfPCell(h); - //c.Colspan = 7; - //c.Border = 0; - //t.AddCell(c); - } - t.AddCell(BlankCell(cols)); - h = new Phrase(); - h.Font = f4; - h.Add("ANNOTATIONS"); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - stepnum = string.Empty; - foreach (AnnotationAuditInfo aai in annotationList) - { - foreach (ContentAuditInfo cai in auditList) - { - if (cai.ContentID == aai.IContentID) - { - string[] NewPath = SplitPath(cai.Path); - if (NewPath[1] != stepnum) - { - stepnum = NewPath[1]; - string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2"); - stepnum2 = stepnum2.Replace("RNO.", "RNO"); - h = new Phrase(); - h.Font = f3; - h.Add(string.Format("Step {0}", stepnum2)); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_RIGHT; - c.PaddingBottom = paddingBottom; - c.PaddingRight = 10; - //c.Border = borders; - t.AddCell(c); - break; - } - else - { - t.AddCell(BlankCell(1)); - break; - } - } - } - //what - h = new Phrase(); - h.Font = f3; - h.Add(aai.ActionWhat); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //who - h = new Phrase(); - h.Font = f3; - h.Add(aai.UserID); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //when - h = new Phrase(); - h.Font = f3; - h.Add(aai.ActionWhen.ToString()); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //new text - h = new Phrase(); - h.Font = f4; - //h.Add(cai.Text); - h.Add(ItemInfo.ConvertToDisplayText(aai.SearchText)); - c = new PdfPCell(h); - c.Colspan = cols - 4; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - } - doc.Add(t); - } - private void BuildSummaryReport(iTextSharp.text.Document doc) - { - int lastAnnotationID = 0; - string section = string.Empty; - string stepnum = string.Empty; - int contentID = 0; - ContentAuditInfo firstCAI = null; - ContentAuditInfo nextCAI = null; - ContentAuditInfo lastCAI = null; - List auditList1 = new List(); - foreach (ContentAuditInfo cai in AuditList) - { - if (MyProc.MyLookup == null - || (cai.ActionWhat == "Deleted" && !MyProc.MyLookup.ContainsKey(cai.ItemID))// B2021-019, if step was deleted, it won't be in the MyLookup - || MyProc.MyLookup.ContainsKey(cai.ItemID)) - { - if (cai.ContentID != contentID) //new content - { - if (firstCAI != null) //not first row - { - if (lastCAI == null) - { - auditList1.Add(firstCAI); - firstCAI = null; - } - else - { - if (lastCAI.DTS > firstCAI.DTS) - { - if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat != "Deleted") - { - if (firstCAI.DTS > MyProc.ChangeBarDate) - lastCAI.ActionWhat = firstCAI.ActionWhat; - //this step was originally commented out, then jcb un commented it, but we saw a summary report that had 2 added rows - //for the same step which is highly undesirable, so we commented it out again 1/17/2012 - //for example we added 2 steps, then make a change to 1st step added\ - // - // RHM 12/4/2015 It appears that the following line is toggling between being commented-out - // and included. - // 12/4/2015 - D.C. Cook, If a new procedure is added, every new section and step was appearing in the list twice. - // First when added, then with the final text. It should only appear once with the action "Added" and with the latest - // Date Time and User as well as the latest text. - // B2019-051: Missing information in Change Summary report: - if (!(firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Added")) auditList1.Add(firstCAI); - auditList1.Add(lastCAI); - firstCAI = null; - lastCAI = null; - } - else if (firstCAI.ActionWhat == lastCAI.ActionWhat || firstCAI.ActionWhat.StartsWith("As Of:")) - { - auditList1.Add(firstCAI); - auditList1.Add(lastCAI); - firstCAI = null; - lastCAI = null; - } - else - { - firstCAI = null; - lastCAI = null; - } - } - else if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Deleted" && firstCAI.DTS == lastCAI.DTS) - { - //auditList.Add(lastCAI); - firstCAI = null; - lastCAI = null; - } - else if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Changed" && firstCAI.DTS > MyProc.ChangeBarDate) - { - lastCAI.ActionWhat = firstCAI.ActionWhat; - auditList1.Add(lastCAI); - firstCAI = null; - lastCAI = null; - } - //added by jcb - //else if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Changed" && firstCAI.DTS == lastCAI.DTS) - //{ - // auditList.Add(firstCAI); - // auditList.Add(lastCAI); - // firstCAI = null; - // lastCAI = null; - //} - } - } - firstCAI = cai; - lastCAI = null; - contentID = cai.ContentID; - } - else - lastCAI = cai; - } - } - if (lastCAI == null) - { - if (firstCAI != null) - auditList1.Add(firstCAI); - firstCAI = null; - } - else - { - if (lastCAI.DTS > firstCAI.DTS) - { - if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat != "Deleted") - { - if (firstCAI.DTS > MyProc.ChangeBarDate) - lastCAI.ActionWhat = firstCAI.ActionWhat; - auditList1.Add(firstCAI); - auditList1.Add(lastCAI); - firstCAI = null; - lastCAI = null; - } - else if (firstCAI.ActionWhat == lastCAI.ActionWhat || firstCAI.ActionWhat.StartsWith("As Of:")) - { - auditList1.Add(firstCAI); - auditList1.Add(lastCAI); - firstCAI = null; - lastCAI = null; - } - else - { - firstCAI = null; - lastCAI = null; - } - } - else if (firstCAI.ActionWhat == "Added") - { - if (lastCAI.ActionWhat == "Deleted" && firstCAI.DTS == lastCAI.DTS) - { - //auditList.Add(lastCAI); - firstCAI = null; - lastCAI = null; - } - else if (lastCAI.ActionWhat != "Deleted") - { - lastCAI.ActionWhat = firstCAI.ActionWhat; - auditList1.Add(lastCAI); - lastCAI = null; - } - - } - } - #region annotations commented out - AnnotationAuditInfo firstAAI = null; - AnnotationAuditInfo nextAAI = null; - AnnotationAuditInfo lastAAI = null; - int annotationID = 0; - List annotationList = new List(); - foreach (AnnotationAuditInfo aai in AnnotationList) - { - if (MyProc.MyLookup == null || MyProc.MyLookup.ContainsKey(aai.ItemID)) - { - if (aai.AnnotationID != annotationID) - { - annotationID = aai.AnnotationID; - if (firstAAI != null) - { - if (lastAAI == null) - { - annotationList.Add(firstAAI); - } - else if (lastAAI.ActionWhat == "Deleted" && firstAAI.DTS < MyProc.ChangeBarDate) - { - annotationList.Add(lastAAI); - } - else if (lastAAI.ActionWhat == "Changed" && firstAAI.ActionWhat != "Added") // && lastAAI.SearchText != firstAAI.SearchText) - { - annotationList.Add(firstAAI); - annotationList.Add(lastAAI); - } - else if (lastAAI.ActionWhat == "Changed" && firstAAI.ActionWhat == "Added") // && lastAAI.SearchText != firstAAI.SearchText) - { - lastAAI.ActionWhat = firstAAI.ActionWhat; - annotationList.Add(lastAAI); - firstAAI = null; - lastAAI = null; - } - else if (lastAAI.ActionWhat == "Restored" && firstAAI.ActionWhat == "Added") // && lastAAI.SearchText != firstAAI.SearchText) - { - lastAAI.ActionWhat = firstAAI.ActionWhat; - annotationList.Add(lastAAI); - firstAAI = null; - lastAAI = null; - } - else if (lastAAI == null && firstAAI.ActionWhat == "Added") - { - annotationList.Add(firstAAI); - } - lastAAI = null; - } - firstAAI = aai; - } - else - lastAAI = aai; - } - } - if (firstAAI != null) - { - if (lastAAI == null) - { - annotationList.Add(firstAAI); - } - else if (lastAAI.ActionWhat == "Deleted" && firstAAI.DTS < MyProc.ChangeBarDate) - { - annotationList.Add(lastAAI); - } - else if (lastAAI.ActionWhat == "Changed" && firstAAI.ActionWhat != "Added") // && lastAAI.SearchText != firstAAI.SearchText) - { - annotationList.Add(firstAAI); - annotationList.Add(lastAAI); - } - else if (lastAAI.ActionWhat == "Changed" && firstAAI.ActionWhat == "Added") // && lastAAI.SearchText != firstAAI.SearchText) - { - lastAAI.ActionWhat = firstAAI.ActionWhat; - annotationList.Add(lastAAI); - firstAAI = null; - lastAAI = null; - } - else if (lastAAI.ActionWhat == "Restored" && firstAAI.ActionWhat == "Added") // && lastAAI.SearchText != firstAAI.SearchText) - { - lastAAI.ActionWhat = firstAAI.ActionWhat; - annotationList.Add(lastAAI); - firstAAI = null; - lastAAI = null; - } - else if (lastAAI == null && firstAAI.ActionWhat == "Added") - { - annotationList.Add(firstAAI); - } - } - //if (firstAAI != null) - // annotationList.Add(firstAAI); - //if (lastAAI != null) - // annotationList.Add(lastAAI); - #endregion - //new final cleanup - List auditList2 = new List(); - ContentAuditInfo caiFirst = null; - foreach (ContentAuditInfo cai in auditList1) - { - if (caiFirst == null) - caiFirst = cai; - else - { - if (cai.ContentID == caiFirst.ContentID && cai.Text != caiFirst.Text) - { - if (caiFirst.ActionWhat == "Added" && (cai.ActionWhat == "Added" || cai.ActionWhat == "Restored")) - { - auditList2.Add(cai); - caiFirst = null; - } - else - { - auditList2.Add(caiFirst); - auditList2.Add(cai); - caiFirst = null; - } - } - else - { - if(caiFirst.Text != string.Empty && !(caiFirst.UserID.Contains("Renumber") || cai.UserID.Contains("Renumber"))) - auditList2.Add(caiFirst); - caiFirst = cai; - } - } - } - if (caiFirst != null) //ciaFirst could end up being null at the end of the above foreach loop - auditList2.Add(caiFirst); - int cols = 5; - int borders = 0; - int paddingBottom = 6; - PdfPTable t = new PdfPTable(cols); - t.HeaderRows = 4; - t.DefaultCell.Padding = 4; - t.WidthPercentage = 100; - float[] widths = new float[] { 1f, 1f, 1f, 1f, 4f }; - t.SetWidths(widths); - //t.HorizontalAlignment = 0; - // 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 - iTextSharp.text.Font f1 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 14, 1, 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, 9, 0, Color.BLACK); - iTextSharp.text.Font f4 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 9, 1, Color.BLACK); - //report title - Phrase h = new Phrase(); - h.Font = f1; - h.Add("Summary of Changes Report"); - PdfPCell c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - //procedure title - h = new Phrase(); - h.Font = f2; - h.Add(string.Format("{0} - {1}", MyProc.DisplayNumber, MyProc.DisplayText)); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - ContentAuditInfo oldCAI = null; - string oldText = string.Empty; - string oldTypeName = string.Empty; - // Dictionary processedAAI = new Dictionary(); - Dictionary processedAAI = new Dictionary(); - foreach (ContentAuditInfo cai in auditList2) - { - //raw path - string[] NewPath = SplitPath(cai.Path); - if (NewPath[0] != section) - { - AddStepAnnotation(ref lastAnnotationID, cols, paddingBottom, t, f3, f4, ref h, ref c, oldCAI, processedAAI); - section = NewPath[0]; - h = new Phrase(); - h.Font = f4; - h.Add(section); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - } - //step - if (NewPath[1] != stepnum) - { - AddStepAnnotation(ref lastAnnotationID, cols, paddingBottom, t, f3, f4, ref h, ref c, oldCAI, processedAAI); - ////see if any annotations for old stepnum here and add them - //foreach (AnnotationAuditInfo aai in annotationList) - //{ - // if (oldCAI != null && aai.IContentID == oldCAI.ContentID) - // { - // //add annotation to minilist - // // processedAAI.Add(aai.AnnotationID, aai); - // processedAAI.Add(aai, aai); - // //write row to table - // t.AddCell(BlankCell(1)); - // h = new Phrase(); - // h.Font = f3; - // h.Add(AnnotationLookup[aai.TypeID] + " " + aai.ActionWhat); - // c = new PdfPCell(h); - // c.Colspan = 1; - // c.HorizontalAlignment = Element.ALIGN_CENTER; - // c.PaddingBottom = paddingBottom; - // //c.Border = borders; - // t.AddCell(c); - // //who - // h = new Phrase(); - // h.Font = f3; - // h.Add(aai.UserID); - // c = new PdfPCell(h); - // c.Colspan = 1; - // c.HorizontalAlignment = Element.ALIGN_CENTER; - // c.PaddingBottom = paddingBottom; - // //c.Border = borders; - // t.AddCell(c); - // //when - // h = new Phrase(); - // h.Font = f3; - // h.Add(aai.ActionWhen.ToString()); - // c = new PdfPCell(h); - // c.Colspan = 1; - // c.HorizontalAlignment = Element.ALIGN_CENTER; - // c.PaddingBottom = paddingBottom; - // //c.Border = borders; - // t.AddCell(c); - // //new text - // h = new Phrase(); - // h.Font = f4; - // //h.Add(cai.Text); - // h.Add(ItemInfo.ConvertToDisplayText(aai.SearchText)); - // c = new PdfPCell(h); - // c.Colspan = cols - 4; - // c.HorizontalAlignment = Element.ALIGN_LEFT; - // c.PaddingBottom = paddingBottom; - // //c.Border = borders; - // t.AddCell(c); - // } - //} - oldCAI = cai; - oldText = cai.Text; - oldTypeName = cai.TypeName; - firstCAI = cai; - stepnum = NewPath[1]; - string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2"); - stepnum2 = stepnum2.Replace("RNO.", "RNO"); - // check to see if we have step number to output - // if not just put in a blank cell. - // this cleans up the report so that we don't have "Step" without anything after it. - // This was happening when we were reporting change information of a section number/title - if (stepnum2 != "") - { - h = new Phrase(); - h.Font = f3; - h.Add(string.Format("Step {0}", stepnum2)); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_RIGHT; - c.PaddingBottom = paddingBottom; - c.PaddingRight = 10; - //c.Border = borders; - t.AddCell(c); - } - else - t.AddCell(BlankCell(1)); - } - else - { - t.AddCell(BlankCell(1)); - nextCAI = cai; - } - //what - h = new Phrase(); - h.Font = f3; - // h.Add(cai.ActionWhen > MyProc.DTS ? cai.ActionWhat : "Original"); - string actionWhat = ((cai.ActionWhat == "Added" || cai.ActionWhat == "Changed") && cai.DTS <= MyProc.ChangeBarDate) ? "Original" : cai.ActionWhat; //(cai.ActionWhat == "Added" && cai.DTS <= MyProc.DTS) ? "Original" : cai.ActionWhat != "Changed" ? cai.ActionWhat : cai.DTS <= maxDTS ? "Restored" : cai.DTS > MyProc.DTS ? cai.ActionWhat : "Original"; - if (actionWhat == "Deleted" || actionWhat == "Restored") - h.Add(actionWhat + "\r\n" + (cai.ActionWhen < cai.DTS ? cai.DTS.ToString("M/dd/yyyy") : cai.ActionWhen.ToString())); - else - h.Add(actionWhat); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //who - h = new Phrase(); - h.Font = f3; - h.Add(cai.UserID); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //when - h = new Phrase(); - h.Font = f3; - h.Add(cai.DTS.ToString()); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //new text - h = new Phrase(); - h.Font = f4; - //h.Add(cai.Text); - //h.Add(ItemInfo.ConvertToDisplayText(cai.Text)); - if (cai.Type == 20008) - { - GridAuditInfoList gail = GridAuditInfoList.Get(cai.ContentID); - bool addedInfo = false; - if (gail.Count > 0) - { - GridAuditInfo gai = gail[0]; - System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); - xd.LoadXml(gai.Data); - //int grows = int.Parse(xd.SelectSingleNode("C1FlexGrid/RowInfo/Count").InnerText); - int gcols = int.Parse(xd.SelectSingleNode("C1FlexGrid/ColumnInfo/Count").InnerText); - string data = ItemInfo.ConvertToDisplayText(cai.Text); - PdfPTable gtbl = new PdfPTable(gcols); - while (data.Length > 0) - { - int indx = data.IndexOf(";"); // B2022-111: error on summary report (data missing ';' so couldn't parse out report info) - if (indx > 0) - { - addedInfo = true; - string val = data.Substring(0, data.IndexOf(";")); - data = data.Substring(data.IndexOf(";") + 1); - Phrase hh = new Phrase(); - hh.Font = f4; - hh.Add(val); - PdfPCell cc = new PdfPCell(hh); - gtbl.AddCell(cc); - } - else - data = ""; // couldn't find separator ';', don't continue to loop - } - if (addedInfo) - { - c = new PdfPCell(gtbl); - c.Colspan = cols - 4; - c.HorizontalAlignment = Element.ALIGN_LEFT; - //c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - } - } - // B2017-058: The following was added to handle when there are no grid audits, just put a message. Without - // adding this cell to the output, the columns get out of sync for rest of report. - else - { - h = new Phrase(); - h.Font = f4; - h.Add( "No change in table text found."); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - t.AddCell(c); - } - } - else - { - h = new Phrase(); - h.Font = f4; - if (cai.Text != oldText && cai.TypeName != oldTypeName) - h.Add(string.Format("[Type Change {0} to {1}] - {2}", oldTypeName, cai.TypeName, ItemInfo.ConvertToDisplayText(cai.Text)));// + " to " + cai.TypeName); - else if (cai.Text == oldText && cai.TypeName != oldTypeName) - h.Add(oldTypeName + " to " + cai.TypeName); - else - { - string txt = null; - if ((cai.Text == null || cai.Text == "") && (cai.Type == 20036 || cai.Type == 20037 || cai.Type == 20038 || cai.Type == 20039)) - txt = "Embedded Image"; - // B2020-054: Always put out 'Equation' for equations in the summary report - else if (cai.Type > 20099) - txt = "Equation"; - else - txt = ItemInfo.ConvertToDisplayText(cai.Text).Replace("Go to \u25cf", "Go to ?"); - // Add Parent/Child information if applicable - // We were doing this for the Chronology report so I added the same logic here for the Summary report - if (MyProc.MyDocVersion.MultiUnitCount > 1) - { - System.Xml.XmlNode nd; - if (cai.Config == string.Empty) - nd = null; - else - { - System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); - xd.LoadXml(cai.Config); - nd = xd.SelectSingleNode("//MasterSlave"); - } - if (nd == null) - txt += "\r\n\r\nApplicable to all units"; - else - { - nd = nd.Attributes.GetNamedItem("Applicability"); - if (nd.InnerText == "0") - txt += "\r\n\r\nApplicable to no units"; - else - { - int k = MyProc.MyDocVersion.DocVersionConfig.SelectedSlave; - string[] myss = nd.InnerText.Split(",".ToCharArray()); - string un = "\r\n\r\nApplicable to "; - string sep = string.Empty; - foreach (string ss in myss) - { - MyProc.MyDocVersion.DocVersionConfig.SelectedSlave = int.Parse(ss); - un += sep + MyProc.MyDocVersion.DocVersionConfig.Unit_Name; - sep = ","; - } - txt += un; - MyProc.MyDocVersion.DocVersionConfig.SelectedSlave = k; - } - } - } - h.Add(txt); - } - oldText = cai.Text; - oldTypeName = cai.TypeName; -// h.Add(ItemInfo.ConvertToDisplayText(cai.Text) + " " + cai.TypeName); - c = new PdfPCell(h); - c.Colspan = cols - 4; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - } - - //c = new PdfPCell(h); - //c.Colspan = cols - 4; - //c.HorizontalAlignment = Element.ALIGN_LEFT; - //c.PaddingBottom = paddingBottom; - ////c.Border = borders; - //t.AddCell(c); - ////old text - //t.AddCell(BlankCell(3)); - //h = new Phrase(); - //h.Font = f4; - //h.Add("Old text: " + cai.OldText); - //c = new PdfPCell(h); - //c.Colspan = 7; - //c.Border = 0; - //t.AddCell(c); - } - //see if any annotations for old stepnum here and add them - foreach (AnnotationAuditInfo aai in annotationList) - { - if (oldCAI != null && aai.IContentID == oldCAI.ContentID && !processedAAI.ContainsKey(aai)) - { - //add annotation to minilist - // processedAAI.Add(aai.AnnotationID, aai); - processedAAI.Add(aai, aai); - //write row to table - t.AddCell(BlankCell(1)); - h = new Phrase(); - h.Font = f3; - h.Add(AnnotationLookup[aai.TypeID] + " " + aai.ActionWhat); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //who - h = new Phrase(); - h.Font = f3; - h.Add(aai.UserID); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //when - h = new Phrase(); - h.Font = f3; - h.Add(aai.ActionWhen.ToString()); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //new text - h = new Phrase(); - h.Font = f4; - //h.Add(cai.Text); - h.Add(ItemInfo.ConvertToDisplayText(aai.SearchText)); - c = new PdfPCell(h); - c.Colspan = cols - 4; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - } - } - bool annotationHeader = false; - //t.AddCell(BlankCell(cols)); - //h = new Phrase(); - //h.Font = f4; - //h.Add("ANNOTATIONS"); - //c = new PdfPCell(h); - //c.Colspan = cols; - //c.HorizontalAlignment = Element.ALIGN_LEFT; - //c.PaddingBottom = paddingBottom; - ////c.Border = borders; - //t.AddCell(c); - //t.AddCell(BlankCell(cols)); - section = string.Empty; - stepnum = string.Empty; - foreach (AnnotationAuditInfo aai in annotationList) - { - // if (!processedAAI.ContainsKey(aai.AnnotationID)) - if (!processedAAI.ContainsKey(aai)) - { - if (!annotationHeader) - { - t.AddCell(BlankCell(cols)); - h = new Phrase(); - h.Font = f4; - h.Add("ANNOTATIONS"); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - annotationHeader = true; - } - string[] NewPath = GetNewPath(AuditList, aai.IContentID); - if (NewPath[0] != section) - { - section = NewPath[0]; - stepnum = string.Empty; - h = new Phrase(); - h.Font = f4; - h.Add(section); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - } - if (NewPath[1] != stepnum) - { - stepnum = NewPath[1]; - string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2"); - stepnum2 = stepnum2.Replace("RNO.", "RNO"); - h = new Phrase(); - h.Font = f3; - h.Add(string.Format("Step {0}", stepnum2)); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_RIGHT; - c.PaddingBottom = paddingBottom; - c.PaddingRight = 10; - //c.Border = borders; - t.AddCell(c); - } - else - { - t.AddCell(BlankCell(1)); - } - //what - h = new Phrase(); - h.Font = f3; - - h.Add(AnnotationLookup[aai.TypeID] + " " + aai.ActionWhat); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //who - h = new Phrase(); - h.Font = f3; - h.Add(aai.UserID); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //when - h = new Phrase(); - h.Font = f3; - h.Add(aai.ActionWhen.ToString()); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - //new text - h = new Phrase(); - h.Font = f4; - //h.Add(cai.Text); - h.Add(ItemInfo.ConvertToDisplayText(aai.SearchText)); - c = new PdfPCell(h); - c.Colspan = cols - 4; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - //c.Border = borders; - t.AddCell(c); - } - } - if (t.Rows.Count == t.HeaderRows) - { - c = new PdfPCell(new Phrase("No changes to report")); - c.Colspan = cols; - t.AddCell(c); - } - doc.Add(t); - } - } -} diff --git a/PROMS/Volian.Print.Library/PDFConsistencyCheckReport.cs b/PROMS/Volian.Print.Library/PDFConsistencyCheckReport.cs deleted file mode 100644 index ff5c357f..00000000 --- a/PROMS/Volian.Print.Library/PDFConsistencyCheckReport.cs +++ /dev/null @@ -1,526 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using VEPROMS.CSLA.Library; -using iTextSharp.text.pdf; -using iTextSharp.text; -using System.IO; -using System.Text.RegularExpressions; -using System.Windows.Forms; - -namespace Volian.Print.Library -{ - public class PDFConsistencyCheckReport - { - private DocVersionInfo _MyDocVersion; - public DocVersionInfo MyDocVersion - { - 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) - { - _FileName = fileName; - _MyItemInfoList = myItemInfoList; - _MyDocVersion = myDocVersion; //B2020-020 needed to pass in DocVersion to get paper size from format - } - public void BuildReport() - { - Rectangle paperSize = PDFPageSize.UsePaperSize(MyDocVersion.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - iTextSharp.text.Document document = new iTextSharp.text.Document(paperSize, 36, 36, 36, 36); - if (!CreateResultsPDF(document)) return; - try - { - BuildConsistencyReport(document); - } - catch (Exception ex) - { - StringBuilder msg = new StringBuilder(); - document.Add(new Paragraph("Error:")); - while (ex != null) - { - document.Add(new Paragraph(ex.GetType().Name)); - document.Add(new Paragraph(ex.Message)); - ex = ex.InnerException; - } - } - finally - { - if (document.IsOpen()) - { - document.Close(); - System.Diagnostics.Process.Start(_FileName); - } - } - } - private bool CreateResultsPDF(iTextSharp.text.Document document) - { - bool result = false; - string suffix = ""; - int i = 0; - // Try to open a file for creating the PDF. - while (result == false) - { - string fileName = _FileName.ToLower().Replace(".pdf", suffix + ".pdf"); - try - { - PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create)); - document.SetMargins(36, 36, 36, 36); - document.Open(); - _FileName = fileName; - result = true; - } - catch (System.IO.IOException exIO) - { - - if (exIO.Message.Contains("because it is being used by another process")) - suffix = string.Format("_{0}", ++i);// If this file is in use, increment the suffix and try again - else // If some other error, display a message and don't print the results - { - ShowException(exIO); - return false; - } - } - catch (Exception ex) - { - ShowException(ex); - return false; // Could not open the output file - } - } - return true; - } - private static void ShowException(Exception ex) - { - Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); - StringBuilder msg = new StringBuilder(); - string sep = ""; - string indent = ""; - while (ex != null) - { - msg.Append(string.Format("{0}{1}{2}:\r\n{1}{3}", sep, indent, ex.GetType().Name, ex.Message)); - ex = ex.InnerException; - sep = "\r\n"; - indent += " "; - } - 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 void BuildConsistencyReport(iTextSharp.text.Document doc) - { - // 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 - 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 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 = 5; - int borders = 0; - int paddingBottom = 6; -// float[] widths; - Csla.SortedBindingList sortedProcs = new Csla.SortedBindingList(MyItemInfoList); - sortedProcs.ApplySort("DisplayNumber", System.ComponentModel.ListSortDirection.Ascending); - bool didSome = false; - // 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 - // pagebreak. - foreach (ProcedureInfo pi in sortedProcs) - { - if (pi.IsSelected) - { - didSome = true; - break; - } - } - PdfPTable t = CreatePdfPTable(cols); - string selProc = "Procedures currently selected to be approved"; - if (!didSome) selProc = "No procedures currently selected to be approved"; - CreatePageHeader(t, f1, f4, cols, paddingBottom, "Approval Consistency Report", selProc); - //more stuff - /* - Csla.SortedBindingList sortedResults = new Csla.SortedBindingList(_SearchResults); - sortedResults.ApplySort(_DisplayMember, ListSortDirection.Ascending); - lbSrchResults.DataSource = sortedResults; - */ - - foreach (ProcedureInfo pi in sortedProcs) - { - if (pi.IsSelected) - { - PdfPTable tt = new PdfPTable(cols); - tt.KeepTogether = true; - tt.AddCell(AddSubTableCell(pi.DisplayNumber, f2, cols, paddingBottom)); - tt.AddCell(AddSubTableCell(pi.MyDifferencesText, f3, cols, paddingBottom)); - PdfPCell c = new PdfPCell(tt); - c.Colspan = cols; - t.AddCell(c); - } - } - t.AddCell(BlankCell(cols)); - doc.Add(t); - //new page with new table - if (didSome) doc.NewPage(); - 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"); - foreach (ProcedureInfo pi in MyItemInfoList) - { - if (!pi.IsSelected) - { - PdfPTable tt = new PdfPTable(cols); - tt.KeepTogether = true; - tt.AddCell(AddSubTableCell(pi.DisplayNumber, f2, cols, paddingBottom)); - tt.AddCell(AddSubTableCell(pi.MyDifferencesText, f3, cols, paddingBottom)); - PdfPCell c = new PdfPCell(tt); - c.Colspan = cols; - t.AddCell(c); - } - } - doc.Add(t); - } - private PdfPCell AddSubTableCell(string text, iTextSharp.text.Font f, int cols, float pb) - { - Phrase h = new Phrase(); - h.Font = f; - h.Add(text); - PdfPCell c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = pb; - return c; - } - private void CreatePageHeader(PdfPTable t, iTextSharp.text.Font f1, iTextSharp.text.Font f2, int cols, float pb, string hdr1, string hdr2) - { - //report title - Phrase h = new Phrase(); - h.Font = f1; - h.Add(hdr1); - PdfPCell c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = pb; - //c.Border = borders; - t.AddCell(c); - h = new Phrase(); - h.Font = f2; - h.Add(hdr2); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = pb; - //c.Border = borders; - t.AddCell(c); - t.AddCell(BlankCell(cols)); - } - private PdfPTable CreatePdfPTable(int cols) - { - PdfPTable t = new PdfPTable(cols); - t.HeaderRows = 3; - t.DefaultCell.Padding = 4; - t.WidthPercentage = 100; - float[] widths = new float[] { 1f, 1f, 1f, 1f, 4f }; - t.SetWidths(widths); - //t.HorizontalAlignment = 0; - return t; - } - public void BuildAllReport(DocVersionInfo dvi) - { - MyDocVersion = dvi; - Rectangle paperSize = PDFPageSize.UsePaperSize(MyDocVersion.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - iTextSharp.text.Document document = new iTextSharp.text.Document(paperSize, 36, 36, 36, 36); - if (!CreateResultsPDF(document)) return; - try - { - BuildAllInConsistenciesReport(document); - } - catch (Exception ex) - { - StringBuilder msg = new StringBuilder(); - document.Add(new Paragraph("Error:")); - while (ex != null) - { - document.Add(new Paragraph(ex.GetType().Name)); - document.Add(new Paragraph(ex.Message)); - ex = ex.InnerException; - } - } - finally - { - if (document.IsOpen()) - { - document.Close(); - System.Diagnostics.Process.Start(_FileName); - } - } - } - private void BuildAllInConsistenciesReport(iTextSharp.text.Document doc) - { - // 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 - 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 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 borders = 0; - int paddingBottom = 6; - PdfPTable t = new PdfPTable(cols); - t.HeaderRows = 1; - t.WidthPercentage = 100; - float[] widths = new float[] { 1f, 1f, 10f }; - t.SetWidths(widths); - Phrase h = new Phrase(); - h.Font = f1; - h.Add("Approved Procedures Inconsistencies Report"); - PdfPCell c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = 1; - t.AddCell(c); - // C2021-013: Include the Procedure set name & date - h = new Phrase(); - h.Font = f1; - string tmp = MyDocVersion.MyFolder.Name + " " + DateTime.Now.ToString("M/d/yyyy"); - h.Add(tmp); - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = 1; - t.AddCell(c); - Dictionary types = new Dictionary(); - foreach (ProcedureInfo pi in MyItemInfoList) - { - string type = pi.MyDifferences.ROConsistency.MyROChecks.Length > 0 ? "Reference Object Inconsistencies" : ""; - if (type != string.Empty && !types.ContainsKey(0)) - types.Add(0, type); - type = pi.MyDifferences.TransitionConsistency.MyTransitionChecks.Length > 0 ? "Transition Inconsistencies" : ""; - if (type != string.Empty && !types.ContainsKey(1)) - types.Add(1, type); - type = pi.MyDifferences.LibDocConsistency.MyLibDocChecks.Length > 0 ? "Library Document Inconsistencies" : ""; - if (type != string.Empty && !types.ContainsKey(2)) - types.Add(2, type); - } -// types.Clear(); - if (types.Count == 0) - { - h = new Phrase(); - h.Font = f2; - h.Add("No Inconsistencies"); - c = new PdfPCell(h); - c.Colspan = cols; - t.AddCell(c); - } - else - { -// Dictionary> ros = new Dictionary>(); - Dictionary> ros = new Dictionary>(); - DocVersionInfo dvi = MyItemInfoList[0].MyDocVersion; - ROFstInfo rofst = dvi.DocVersionAssociations[0].MyROFst; - //rofst.docVer = dvi; -// ROFSTLookup lu = MyItemInfoList[0].MyDocVersion.DocVersionAssociations[0].MyROFst.ROFSTLookup; - ROFSTLookup lu = rofst.GetROFSTLookup(dvi); - if (types.ContainsKey(0)) - { - foreach (ProcedureInfo pi in MyItemInfoList) - { - foreach (ROCheck roc in pi.MyDifferences.ROConsistency.MyROChecks) - { - ROFSTLookup.rochild rocc = lu.GetRoChild(roc.ROID); - if (rocc.type == 1) - { - // B2022-088: Find Doc Ro button not working in Word Sections - string newROValue = lu.GetRoChild(roc.ROID).value.Replace('`', '\xb0'); - string rotitle = string.Format("{0} - Current Version: {1}", lu.GetROTitle(roc.ROID), lu.GetRoChild(roc.ROID).value.Replace('`','\xb0')); - if (ros.ContainsKey(rotitle)) - { - // B2021-025: Add 'Approved' to message here and in line below to help clarify report info - ros[rotitle].Add(string.Format("Approved Procedure {0} has an ROValue of: {1}", pi.DisplayNumber, roc.ROValue),roc.ROValue == newROValue); - } - else - { - ros.Add(rotitle, new Dictionary()); - ros[rotitle].Add(string.Format("Approved Procedure {0} has an ROValue of: {1}", pi.DisplayNumber, roc.ROValue),roc.ROValue == newROValue); - } - } - } - } - } -//jcb - Dictionary> trs = new Dictionary>(); - //Dictionary> trs = new Dictionary>(); - if (types.ContainsKey(1)) - { - foreach (ProcedureInfo pi in MyItemInfoList) - { - foreach (TransitionCheck trc in pi.MyDifferences.TransitionConsistency.MyTransitionChecks) - { - TransitionInfo ti = TransitionInfo.Get(trc.TransitionID); - string fromText = ti.MyContent.Text; - //GO TO \\v \\v0 - MatchCollection mc = Regex.Matches(fromText, @"\"); - foreach (Match m in mc) - if (m.Groups[2].Value == ti.TransitionID.ToString()) - fromText = ItemInfo.ConvertToDisplayText(m.Groups[1].Value); - string newValue = ti.MyContent.ContentItems[0].Path + "\r\nCurrent Version: " + fromText; - string trtitle = "From Procedure " + newValue; - if (trs.ContainsKey(trtitle)) - { - // B2021-024: : For Working Draft, Report All Procedures Inconsistencies gives Argument Exception in report - // If the value is already in the dictionary, don't add it. - if (!trs[trtitle].ContainsValue(ItemInfo.ConvertToDisplayText(trc.TransitionValue) == fromText)) - trs[trtitle].Add(string.Format("According to {0} the destination is: {1}", pi.DisplayNumber, ItemInfo.ConvertToDisplayText(trc.TransitionValue)), ItemInfo.ConvertToDisplayText(trc.TransitionValue) == fromText); - } - else - { - trs.Add(trtitle, new Dictionary()); - trs[trtitle].Add(string.Format("According to {0} the destination is: {1}", pi.DisplayNumber, ItemInfo.ConvertToDisplayText(trc.TransitionValue)), ItemInfo.ConvertToDisplayText(trc.TransitionValue) == fromText); - } - } - } - } -//end jcb - Dictionary> lds = new Dictionary>(); - //Dictionary> lds = new Dictionary>(); - if (types.ContainsKey(2)) - { - foreach (ProcedureInfo pi in MyItemInfoList) - { - foreach (LibDocCheck ldc in pi.MyDifferences.LibDocConsistency.MyLibDocChecks) - { - DocumentInfo di = DocumentInfo.Get(ldc.DocID); - string newValue = di.DTS.ToString(); - string ldtitle = string.Format("{0} - Current Version: {1}", di.DocumentTitle, di.DTS.ToString()); - if (lds.ContainsKey(ldtitle)) - { - lds[ldtitle].Add(string.Format("Procedure {0} has a Document Date of: {1}", pi.DisplayNumber, ldc.DocDate.ToString()),ldc.DocDate.ToString() == newValue); - } - else - { - lds.Add(ldtitle, new Dictionary()); - lds[ldtitle].Add(string.Format("Procedure {0} has a Document Date of: {1}", pi.DisplayNumber, ldc.DocDate.ToString()), ldc.DocDate.ToString() == newValue); - } - } - } - } - Color goodColor = new Color(System.Drawing.Color.YellowGreen); // PaleGreen too dark - Color badColor = new Color(System.Drawing.Color.Khaki); - if (types.ContainsKey(0)) - { - h = new Phrase(); - h.Font = f2; - h.Add(types[0]); - c = new PdfPCell(h); - c.Colspan = cols; - t.AddCell(c); - foreach (string rotitle in ros.Keys) - { - t.AddCell(BlankCell(1)); - h = new Phrase(); - h.Font = f3; - h.Add(rotitle); - c = new PdfPCell(h); - c.Colspan = cols - 1; - c.BackgroundColor = goodColor; - t.AddCell(c); - foreach (KeyValuePair d in ros[rotitle]) - { - t.AddCell(BlankCell(2)); - h = new Phrase(); - h.Font = f3; - h.Add(d.Key); - c = new PdfPCell(h); - if (d.Value) - c.BackgroundColor = goodColor; - else - c.BackgroundColor = badColor; - t.AddCell(c); - } - } - } -//jcb - if (types.ContainsKey(1)) - { - h = new Phrase(); - h.Font = f2; - h.Add(types[1]); - c = new PdfPCell(h); - c.Colspan = cols; - t.AddCell(c); - foreach (string trtitle in trs.Keys) - { - t.AddCell(BlankCell(1)); - h = new Phrase(); - h.Font = f3; - h.Add(trtitle); - c = new PdfPCell(h); - c.Colspan = cols - 1; - c.BackgroundColor = goodColor; - t.AddCell(c); - foreach (KeyValuePair d in trs[trtitle]) - { - t.AddCell(BlankCell(2)); - h = new Phrase(); - h.Font = f3; - h.Add(d.Key); - c = new PdfPCell(h); - if (d.Value) - c.BackgroundColor = goodColor; - else - c.BackgroundColor = badColor; - t.AddCell(c); - } - } - } -//end jcb - if (types.ContainsKey(2)) - { - h = new Phrase(); - h.Font = f2; - h.Add(types[2]); - c = new PdfPCell(h); - c.Colspan = cols; - t.AddCell(c); - foreach (string ldtitle in lds.Keys) - { - t.AddCell(BlankCell(1)); - h = new Phrase(); - h.Font = f3; - h.Add(ldtitle); - c = new PdfPCell(h); - c.Colspan = cols - 1; - c.BackgroundColor = goodColor; - t.AddCell(c); - foreach (KeyValuePair d in lds[ldtitle]) - { - t.AddCell(BlankCell(2)); - h = new Phrase(); - h.Font = f3; - h.Add(d.Key); - c = new PdfPCell(h); - if (d.Value) - c.BackgroundColor = goodColor; - else - c.BackgroundColor = badColor; - t.AddCell(c); - } - } - } - } - doc.Add(t); - } - } -} diff --git a/PROMS/Volian.Print.Library/PDFPageSize.cs b/PROMS/Volian.Print.Library/PDFPageSize.cs deleted file mode 100644 index d294ceab..00000000 --- a/PROMS/Volian.Print.Library/PDFPageSize.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using VEPROMS.CSLA.Library; -using iTextSharp.text; - - -namespace Volian.Print.Library -{ - 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 - private static Dictionary dicPDFPageSize = new Dictionary(); - private static Dictionary dicPDFPageSizePnts = new Dictionary(); - private static void BuildPDFPageSizeDic() - { - // the page size is set in the format files using a string description i.e.: - if (dicPDFPageSize.Count > 0) return; - dicPDFPageSize.Add("LETTER", PageSize.LETTER); - dicPDFPageSize.Add("A4", PageSize.A4); - } - private static void BuildPDFPageSizeDicPnts() - { - if (dicPDFPageSizePnts.Count > 0) return; - dicPDFPageSizePnts.Add("LETTER", 792); - dicPDFPageSizePnts.Add("A4", 842); - /* Paper Size in Points - ------------------------- - Letter 612x792 - LetterSmall 612x792 - Tabloid 792x1224 - Ledger 1224x792 - Legal 612x1008 - Statement 396x612 - Executive 540x720 - A0 2384x3371 - A1 1685x2384 - A2 1190x1684 - A3 842x1190 - A4 595x842 - A4Small 595x842 - A5 420x595 - B4 729x1032 - B5 516x729 - Envelope ???x??? - Folio 612x936 - Quarto 610x780 - 10x14 720x1008 - */ - } - public static Rectangle UsePaperSize(string pgSize) - { - Rectangle recPageSize = PageSize.LETTER; - BuildPDFPageSizeDic(); - if (pgSize != null && dicPDFPageSize.ContainsKey(pgSize.ToUpper())) - recPageSize = dicPDFPageSize[pgSize.ToUpper()]; - return recPageSize; - } - public static int PaperSizePoints(string pgSize) - { - int paperPoints = 792; //LETTER paper size - BuildPDFPageSizeDicPnts(); - if (pgSize != null && dicPDFPageSizePnts.ContainsKey(pgSize.ToUpper())) - paperPoints = dicPDFPageSizePnts[pgSize.ToUpper()]; - return paperPoints; - } - } -} diff --git a/PROMS/Volian.Print.Library/PDFReport.cs b/PROMS/Volian.Print.Library/PDFReport.cs deleted file mode 100644 index e660630e..00000000 --- a/PROMS/Volian.Print.Library/PDFReport.cs +++ /dev/null @@ -1,2018 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using VEPROMS.CSLA.Library; -using iTextSharp.text.pdf; -using iTextSharp.text; -using System.IO; -using System.Text.RegularExpressions; -using System.Collections; - -namespace Volian.Print.Library -{ - // B2022-026 New code for RO Memory reduction - now use SQL tables instead of building dictionarys to get RO values - public class PDFReport - { - #region Enums - - public enum ReportType - { - SearchResults = 0, - LibraryDocUsage = 1, - ReferencedObjectsUsage = 2, - TransitionUsage = 3, - ReferencedObjectSummary = 4, - ReferencedObjectComplete = 5 - } - - #endregion - - #region Fields - - private PdfWriter _MyPdfWriter; - private ICollection _ResultList; - - private string _FileName; - private string _ReportTitle; - private string _TypesSelected; - private bool _ShowAnnotations = true; - private string _SearchString; - private string _SortedBy; // C2019-013 pass in sorting information - private DocumentInfoList _LibDocList; - - private int _ReportType = 0; - private string _ByLine; - private bool _SortUsageByProcedure = false; - private string _RODataFile = string.Empty; - private List _ROList; - private ROFSTLookup _ROFSTLookup; - private bool _IncludeMissingROs = false; - private bool _ConvertCaretToDelta = true; - private bool _IncludeEmptyROFields = false; - - private string _PaperSize = "Letter"; // C2020-002 paper size is now set in the format files - private string _RegexSearchString = null; - private ArrayList ProcSetList; - - #endregion - - #region Properties - - public ICollection ResultList - { - get { return _ResultList; } - set { _ResultList = value; } - } - - public string FileName - { - get { return _FileName; } - set { _FileName = value; } - } - - public string ReportTitle - { - get { return _ReportTitle; } - set { _ReportTitle = value; } - } - - public string TypesSelected - { - get { return _TypesSelected; } - set { _TypesSelected = value; } - } - - public bool ShowAnnotations - { - get { return _ShowAnnotations; } - set { _ShowAnnotations = value; } - } - - public string SearchString - { - get { return _SearchString; } - set { _SearchString = VEPROMS.CSLA.Library.ItemInfo.ConvertToDisplayText(value); } - } - - public string SortedBy - { - get { return _SortedBy; } - set { _SortedBy = value; } - } - - public DocumentInfoList LibDocList - { - get { return _LibDocList; } - set { _LibDocList = value; } - } - - private string RegexSearchString - { - get - { - if (_RegexSearchString == null) - { - _RegexSearchString = _SearchString; - - // Make it match the smallest matching string - _RegexSearchString = _RegexSearchString.Replace("*", ".*?"); - - // If search string starts with a wildcard use the beginning of line token (^) - if (_RegexSearchString.StartsWith(".*?")) - { - _RegexSearchString = "^" + _RegexSearchString; - } - - // If search string ends with a wildcard use the end of line token ($) - if (_RegexSearchString.EndsWith(".*?")) - { - _RegexSearchString = _RegexSearchString + "$"; - } - - _RegexSearchString = _RegexSearchString.Replace("[", @"\["); - _RegexSearchString = _RegexSearchString.Replace("]", @"\]"); - _RegexSearchString = _RegexSearchString.Replace("(", @"\("); - _RegexSearchString = _RegexSearchString.Replace(")", @"\)"); - } - - return _RegexSearchString; - } - } - - #endregion - - #region Constructors - - /// - /// Search Results Report - /// - /// - /// - /// - /// - /// - /// - public PDFReport(string reportTitle, string typesSelected, ICollection resultList, string fileName, string paperSize, string sortedBy) - { - _ResultList = resultList; - _FileName = fileName; - _ReportTitle = VEPROMS.CSLA.Library.ItemInfo.ConvertToDisplayText(reportTitle); - _TypesSelected = VEPROMS.CSLA.Library.ItemInfo.ConvertToDisplayText(typesSelected); - _ReportType = (int)ReportType.SearchResults; - _ByLine = "PROMS Search Results"; - _PaperSize = paperSize; - _SortedBy = sortedBy; // C2019--13 pass in sorted by information - - } - - /// - /// Library Document Report - /// - /// - /// - /// - /// - public PDFReport(string reportTitle, DocumentInfoList libDocList, string fileName, string paperSize) - { - _LibDocList = libDocList; - _FileName = fileName; - _ReportTitle = VEPROMS.CSLA.Library.ItemInfo.ConvertToDisplayText(reportTitle); - _ReportType = (int)ReportType.LibraryDocUsage; - _ByLine = "Generated By PROMS"; - _PaperSize = paperSize; - } - - /// - /// RO Usage - /// - /// - /// - /// - /// - /// - /// - public PDFReport(string reportTitle, ICollection resultList, string fileName, bool sortUsageByProcedure, bool includeMissingROs, string paperSize) - { - _ResultList = resultList; - _FileName = fileName; - _ReportTitle = VEPROMS.CSLA.Library.ItemInfo.ConvertToDisplayText(reportTitle); - _ReportType = (int)ReportType.ReferencedObjectsUsage; - _ByLine = "Generated By PROMS"; - _SortUsageByProcedure = sortUsageByProcedure; - _IncludeMissingROs = includeMissingROs; - _PaperSize = paperSize; - } - - /// - /// RO Complete RO Report - /// - /// - /// - /// - /// - /// - /// - /// - /// - public PDFReport(string reportTitle, string roDataFile, string outfile, ROFSTLookup fstlookup, bool completeReport, bool convertCaretToDelta, bool includeEmptyROFields, string paperSize) - { - _FileName = outfile; - _ReportTitle = reportTitle; - _ReportType = (int)ReportType.ReferencedObjectComplete; - _ByLine = "Complete Referenced Objects Report"; - _RODataFile = roDataFile; - _ConvertCaretToDelta = convertCaretToDelta; - _ROFSTLookup = fstlookup; - _IncludeEmptyROFields = includeEmptyROFields; - _PaperSize = paperSize; - } - - /// - /// RO Summary Report - /// - /// - /// - /// - /// - /// - public PDFReport(string reportTitle, string outfile, ROFSTLookup fstlookup, List roList, string paperSize) - { - _FileName = outfile; - _ReportTitle = reportTitle; - _ReportType = (int)ReportType.ReferencedObjectSummary; - _ByLine = "RO Summary Report"; - _ROFSTLookup = fstlookup; - _ROList = roList; - _PaperSize = paperSize; - } - - #endregion - - #region Public Methods - - public void AddMainRODatabaseTitle(PdfPTable datatable, int dbTitleIndex, Font f2, Color bgColor) - { - string dbTitle = _ROFSTLookup.GetRODatabaseTitle(dbTitleIndex); - - PdfPCell cell = new PdfPCell(new Phrase(dbTitle, f2)); - cell.BorderColor = Color.WHITE; - cell.Colspan = 2; - cell.BackgroundColor = bgColor; - datatable.AddCell(cell); - } - - public void AddMainPathGroup(PdfPTable datatable, string dvPath, int splitLevel, Font f2, Color bgColor, int colSpan) - { - int level = 0; - StringBuilder sb = new StringBuilder(); - string[] NewPath = dvPath.Split("\x7".ToCharArray()); - string sep = string.Empty; - int n = NewPath.Length; - - for (int j = 1; j < n && j < splitLevel; j++) - { - sb.Append(sep + "".PadLeft(2 * level) + NewPath[j].Replace("\x11", " ")).Replace(@"\u8209?", "-").Replace(@"\u9586?", @"\"); - sep = "\r\n"; - level++; - } - - if (sb.Length > 0) - { - PdfPCell cell = new PdfPCell(new Phrase(sb.ToString(), f2)); - - cell.Colspan = colSpan; - cell.BackgroundColor = bgColor; - cell.BorderWidthTop = 1; - - datatable.AddCell(cell); - } - } - - public void AddSubPathGroup(PdfPTable datatable, string oldDVPath, string dvPath, int splitLevel, Font f2, Color bgColor, int colSpan) - { - int level = 0; - StringBuilder sb = new StringBuilder(); - string[] NewPath = dvPath.Split("\x7".ToCharArray()); - string[] OldPath = oldDVPath.Split("\x7".ToCharArray()); - string sep = string.Empty; - int n = NewPath.Length - 1; - - for (int i = 0; i < n; i++) - { - if (OldPath[i] != NewPath[i]) - { - splitLevel = Math.Max(splitLevel, i); - break; - } - } - - if (splitLevel < n) - { - for (int j = splitLevel; j < n; j++) - { - sb.Append(sep + "".PadLeft(2 * level) + NewPath[j].Replace("\x11", " ")).Replace(@"\u8209?", "-").Replace(@"\u9586?", @"\"); - sep = "\r\n"; - level++; - } - - if (sb.Length > 0) - { - PdfPCell cell = new PdfPCell(new Phrase(sb.ToString(), f2)); - - cell.Colspan = colSpan; - cell.BackgroundColor = bgColor; - cell.BorderWidthTop = 1; - - datatable.AddCell(cell); - } - } - } - - public void Build() - { - iTextSharp.text.Document document = new iTextSharp.text.Document(PDFPageSize.UsePaperSize(_PaperSize), 36, 36, 36, 36); // C2020-002 paper size is now set in the format files - - if (!CreateResultsPDF(document, _ReportType)) - return; - - try - { - switch (_ReportType) // set in the PDFReport constructor - { - case (int)ReportType.SearchResults: - BuildSearchResultsTable(document); - break; - - case (int)ReportType.LibraryDocUsage: - BuildLibDocUsageReport(document); - break; - - case (int)ReportType.ReferencedObjectsUsage: - if (_SortUsageByProcedure) - BuildROUsageTableByProcedure(document); - else - BuildROUsageTableByRO(document); - break; - - case (int)ReportType.ReferencedObjectComplete: - BuildCompleteROReport(document); - break; - - case (int)ReportType.ReferencedObjectSummary: - BuildROSummaryReport(document); - break; - } - } - catch (Exception ex) - { - StringBuilder msg = new StringBuilder(); - document.Add(new Paragraph("Error:")); - - while (ex != null) - { - document.Add(new Paragraph(ex.GetType().Name)); - document.Add(new Paragraph(ex.Message)); - ex = ex.InnerException; - } - } - finally - { - if (document.IsOpen()) - { - //document.Add(new Phrase("End of Search Results",FontFactory.GetFont("Arial",4))); // B2019-089 commented out - used for debug - document.Add(new Phrase(" ", FontFactory.GetFont("Arial", 4))); // B2019-089 - assure output has at least a blank space to prevent error on close - document.Close(); - System.Diagnostics.Process.Start(_FileName); - } - } - } - - #endregion - - #region Private Methods - - private string AddGroup(PdfPTable datatable, string dvPath, string lastDvPath, Font f2, bool StripLast, Color bgColor, bool skipFirst) - { - int level = 0; - string retval = string.Empty; - StringBuilder sb = new StringBuilder(); - string ttt = dvPath.Replace("\x11", " "); - string[] OldPath = lastDvPath.Split("\x7".ToCharArray()); - string[] NewPath = dvPath.Split("\x7".ToCharArray()); - string sep = string.Empty; - bool foundMisMatch = false; - - // n-1 Exclude the "Working Draft" entry from the list - int n = NewPath.Length - 1; - int jstart = (skipFirst) ? 1 : 0; - - if (StripLast) - { - retval = NewPath[--n]; - if (retval.Contains("\x11")) - { - retval = retval.Substring(0, retval.IndexOf("\x11")); // this is the step number - } - } - - if (n == 0) - { - // B2020-006: 'clean-up' the output string by making string replaces as in 'else' below. - sb.Append(dvPath.Replace("\x11", " ").Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace(@"\u9586?", @"\")); - } - else - { - for (int j = jstart; j < n; j++) - { - if (!string.IsNullOrEmpty(NewPath[j]) && (foundMisMatch || OldPath.Length < j + 1 || NewPath[j] != OldPath[j])) - { - // B2020-006: Add hard space '\u160?' - sb.Append(sep + "".PadLeft(2 * level) + NewPath[j].Replace("\x11", " ")).Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace(@"\u9586?", @"\"); - sep = "\r\n"; - foundMisMatch = true; - } - - level++; - } - } - - if (sb.Length > 0) - { - PdfPCell cell = new PdfPCell(new Phrase(sb.ToString(), f2)); - - cell.Colspan = 2; - cell.BackgroundColor = bgColor; - cell.BorderWidthTop = 1; - datatable.AddCell(cell); - } - - return retval; - } - - private string AddGroupLibDoc(PdfPTable datatable, string dvPath, string lastDvPath, Font f2, bool StripLast, Color bgColor, bool skipFirst) - { - int level = 0; - string retval = string.Empty; - StringBuilder sb = new StringBuilder(); - string ttt = dvPath.Replace("\x11", " "); - string[] OldPath = lastDvPath.Split("\x7".ToCharArray()); - string[] NewPath = dvPath.Split("\x7".ToCharArray()); - string sep = string.Empty; - bool foundMisMatch = false; - int n = NewPath.Length - 1; - int jstart = (skipFirst) ? 1 : 0; - - if (StripLast) - { - retval = NewPath[--n]; - if (retval.Contains("\x11")) - { - retval = retval.Substring(0, retval.IndexOf("\x11")); // this is the step number - } - } - - //If no colons output the entire text - if (n == 0) - { - sb.Append(dvPath); - } - else - { - for (int j = jstart; j < n; j++) - { - if (!string.IsNullOrEmpty(NewPath[j]) && (foundMisMatch || OldPath.Length < j + 1 || NewPath[j] != OldPath[j])) - { - sb.Append(sep + "".PadLeft(2 * level) + NewPath[j].Replace("\x11", " ")).Replace(@"\u8209?", "-").Replace(@"\u9586?", @"\"); - sep = "\r\n"; - foundMisMatch = true; - } - - level++; - } - } - - if (sb.Length > 0) - { - PdfPCell cell = new PdfPCell(new Phrase(sb.ToString(), f2)); - - cell.Colspan = 2; - cell.BackgroundColor = bgColor; - cell.BorderWidthTop = 1; - datatable.AddCell(cell); - } - - return retval; - } - - private void AddProcedureSectionGroup(PdfPTable datatable, string curProc, string lastProc, string curSect, string lastSect, Font f2, Color bgColor) - { - string headerText = string.Empty; - - if (curProc != lastProc) - headerText = curProc + "\r\n"; - - if (curSect != lastSect) - headerText += " " + curSect; - - if (headerText.Length > 0) - { - headerText = headerText.Replace(@"\u8209?", "-");// repace unicode with dash char - headerText = headerText.Replace(@"\u160?", " "); // replace Hard Space with normal Space - headerText = headerText.Replace(@"\u9586?", @"\"); // replace backslash symbol with a backslash - - PdfPCell cell = new PdfPCell(new Phrase(headerText, f2)); - cell.Colspan = 2; - cell.BackgroundColor = bgColor; - cell.BorderWidthTop = 1; - datatable.AddCell(cell); - } - } - - private string GetCurProcNum(string path) - { - string[] NewPath = path.Split("\x7".ToCharArray()); - string pnumtitle = NewPath[1]; - pnumtitle = pnumtitle.Replace('\x11', ' '); - - return pnumtitle; - } - - private string GetCurSectionNumTitle(ItemInfo itm) - { - string rtnstr = string.Empty; - - if (itm.ActiveSection != null) - { - rtnstr = itm.ActiveSection.DisplayNumber; - if (rtnstr.Length > 0) rtnstr += " "; - rtnstr += itm.ActiveSection.DisplayText; - } - - return rtnstr; // string containing section and subsection number/titles - } - - private int FindSpitLevel() - { - int level = 0; - bool foundMisMatch = false; - string lastPath = string.Empty; - - foreach (string p in ProcSetList) - { - string[] NewPath = p.Split("\x7".ToCharArray()); - - if (lastPath != string.Empty) - { - string[] OldPath = lastPath.Split("\x7".ToCharArray()); - int n = NewPath.Length; - int lvl = 0; - foundMisMatch = false; - - for (int j = 0; j < n && !foundMisMatch; j++) - { - if (NewPath[j] != string.Empty && (OldPath.Length < j + 1 || NewPath[j] != OldPath[j])) - { - foundMisMatch = true; - } - - lvl++; - } - - if (level == 0) - level = lvl; - - if (foundMisMatch) - level = Math.Min(level, lvl); - } - - lastPath = p; - - if (ProcSetList.Count == 1) - { - level = NewPath.Length - 1; - } - } - - return level; - } - - /// - /// Attempt to open a file for the PDF output. - /// If the file cannot be opened because it is in use, try adding a suffix - /// If the file cannot be opened for some other reason, display an error message - /// - /// - /// - private bool CreateResultsPDF(iTextSharp.text.Document document, int typ) - { - int topMargin = 36; - - switch (typ) - { - case (int)ReportType.LibraryDocUsage: - topMargin = 80; // Add some space for the Report Header for the Library Document Report - break; - } - - bool result = false; - string suffix = string.Empty; - int i = 0; - - // Try to open a file for creating the PDF. - while (result == false) - { - string fileName = _FileName.ToLower().Replace(".pdf", suffix + ".pdf"); - - try - { - _MyPdfWriter = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create)); - _MyPdfWriter.PageEvent = new MyPageHelper(_ByLine); // JSJ - 7/8/2011 - - document.SetMargins(36, 36, topMargin, 36); - document.Open(); - - _FileName = fileName; - - result = true; - } - catch (System.IO.IOException exIO) - { - if (exIO.Message.Contains("because it is being used by another process")) - { - suffix = string.Format("_{0}", ++i);// If this file is in use, increment the suffix and try again - } - else // If some other error, display a message and don't print the results - { - ShowException(exIO); - return false; - } - } - catch (Exception ex) - { - ShowException(ex); - return false; // Could not open the output file - } - } - - return true; - } - - /// - /// Use Cells within Cells to see if I can limit the way Cells break from Page to Page - /// - /// - private void BuildSearchResultsTable(iTextSharp.text.Document document) - { - float[] headerwidths = { 20, 80 }; - PdfPTable datatable = new PdfPTable(1); - PdfPTable colHeader = new PdfPTable(headerwidths); - //datatable.FooterRows = 1; - datatable.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; - datatable.LockedWidth = true; - - // 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 - iTextSharp.text.Font f1 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 14, 1, 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, 12, 0, Color.BLACK); - PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1)); - cell.HorizontalAlignment = Element.ALIGN_CENTER; - cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); // light cyan - datatable.AddCell(cell); - - // C2019-013 add sorted by information if sorting is used - cell = new PdfPCell(new Phrase(TypesSelected + ((SortedBy.Length > 0) ? string.Format("\n{0}", SortedBy) : string.Empty), f3)); - cell.HorizontalAlignment = Element.ALIGN_LEFT; - cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); // light cyan - datatable.AddCell(cell); - - BuildSearchResultsProcSetList(); - datatable.HeaderRows = 4 + (ProcSetList.Count == 1 ? 1 : 0); - int splitAt = FindSpitLevel(); // find the split level of the common path - for all procedure sets that use these library documents - - Color subHeaderColor = new Color(0xD0, 0xF0, 0xF0); // new Color(0xD0, 0xF0, 0xD0); - datatable.DefaultCell.Padding = 0; // this removes a white space after the header was set to 4; - datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; - AddCell(colHeader, "Step", f2, subHeaderColor); - AddCell(colHeader, "Text", f2, subHeaderColor); - - datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; - string lastPath = string.Empty; - Color AnnoColor = new Color(0xFF, 0xFF, 0xC0); // yellow - Color TextColor = Color.WHITE; - Color WordSectColor = new Color(0xE8, 0xE8, 0xE8);// light grey - Color StepSectColor = new Color(0xE7, 0xFF, 0xE7); // lighter green - PdfPTable subTable = new PdfPTable(headerwidths); - string lastProcNum = string.Empty; - string lastDVPath = string.Empty; - string lastSectNumAndTitle = string.Empty; - List processedItems = new List(); - - foreach (ItemInfo item in _ResultList) - { - if (!processedItems.Contains(item.ItemID)) - { - processedItems.Add(item.ItemID); - - if (lastDVPath != item.SearchDVPath) - { - datatable.AddCell(subTable); - subTable = new PdfPTable(headerwidths); - AddMainPathGroup(datatable, item.SearchDVPath, splitAt, f2, new Color(0xB0, 0xF0, 0xF0), 0);// little brighter cyan - datatable.AddCell(colHeader); - lastProcNum = string.Empty; - lastSectNumAndTitle = string.Empty; // C2020-019 reset we are processing a different procedure set - } - - lastDVPath = item.SearchDVPath; - string curProcNum = GetCurProcNum(item.SearchPath); - - if (subTable.Rows.Count > 0) // prevent first page from being blank - { - datatable.AddCell(subTable); - subTable = new PdfPTable(headerwidths); - } - - if (curProcNum != lastProcNum) - { - lastSectNumAndTitle = string.Empty; // C2020-019 reset we are processing a different procedure - } - - lastProcNum = curProcNum; - - // B2020-006: When doing a section, don't remove the last item or the procedure title won't print (if section is only item found w/ search string) - string stepPath = AddGroup(subTable, item.SearchPath ?? item.ShortPath, lastPath, f2, item.IsSection ? false : true, new Color(0xC0, 0xFF, 0xC0), true); // light green for procedure number and title - - // C2020-019 add section number and title if is different from last item and it is not a Word Section (item will be a section if search item was found in a Word section) - string curSectNumTitle = GetCurSectionNumTitle(item); - - if (curSectNumTitle != string.Empty && curSectNumTitle != lastSectNumAndTitle && !item.IsSection) - { - AddColSpanCell(subTable, curSectNumTitle, f2, StepSectColor, 2, 0); - lastSectNumAndTitle = curSectNumTitle; - } - - lastPath = item.SearchPath ?? item.ShortPath; - stepPath = BuildStepTab(item); - AddCell(subTable, stepPath, f2, (item.IsSection ? WordSectColor : TextColor)); - AddCell(subTable, item.DisplayText, f2, (item.IsSection ? WordSectColor : TextColor)); - - if (ShowAnnotations && item.ItemAnnotationCount > 0) - { - foreach (AnnotationInfo ai in item.ItemAnnotations) - { - AddCell(subTable, ai.MyAnnotationType.Name, f2, AnnoColor); - AddCell(subTable, ai.SearchText, f2, AnnoColor); - } - } - } - } - - datatable.AddCell(subTable); - document.Add(datatable); - } - - private void AddCell(PdfPTable datatable, string str, iTextSharp.text.Font fnt, Color bgColor) - { - iTextSharp.text.Font fntBold = new Font(fnt.BaseFont, fnt.Size, Font.BOLD, Color.RED); - - Phrase p = BuildPhrase2(str, fnt, fntBold); - PdfPCell cell = new PdfPCell(p); - cell.PaddingBottom = 4; - cell.BackgroundColor = bgColor; - - datatable.AddCell(cell); - } - - private void AddColSpanCell(PdfPTable datatable, string str, iTextSharp.text.Font fnt, Color bgColor, int span, int txtAlign) - { - iTextSharp.text.Font fntBold = new Font(fnt.BaseFont, fnt.Size, Font.BOLD, Color.RED); - - Phrase p = BuildPhrase2(str, fnt, fntBold); - PdfPCell cell = new PdfPCell(p); - cell.PaddingBottom = 4; - cell.BackgroundColor = bgColor; - cell.Colspan = span; - cell.HorizontalAlignment = txtAlign; - - datatable.AddCell(cell); - } - - private Phrase BuildPhrase(string str, Font fnt, Font fntBold) - { - Phrase p = new Phrase(); - - if (_SearchString != null) - { - while (str.ToLower().Contains(_SearchString.ToLower())) - { - int iStart = str.ToLower().IndexOf(_SearchString.ToLower()); - - if (iStart > 0) - { - p.Add(new Phrase(str.Substring(0, iStart), fnt)); - } - - Phrase p2 = new Phrase(str.Substring(iStart, _SearchString.Length), fntBold); - p.Add(p2); - - str = str.Substring(iStart + _SearchString.Length); - } - } - - if (str.Length > 0) - p.Add(new Phrase(str, fnt)); - - return p; - } - - private Phrase BuildPhrase2(string str, Font fnt, Font fntBold) - { - Phrase p = new Phrase(); - int lastIndex = 0; - - if ((_SearchString ?? string.Empty) != string.Empty) - { - Regex reg = new Regex(RegexSearchString, RegexOptions.Multiline | RegexOptions.IgnoreCase); - - foreach (Match m in reg.Matches(str)) - { - if (m.Index > 0) - p.Add(new Phrase(str.Substring(lastIndex, m.Index - lastIndex), fnt)); - - Chunk chk = new Chunk(m.Value, fnt); - chk.SetBackground(Color.YELLOW); - p.Add(chk); - - lastIndex = m.Index + m.Length; - } - } - - p.Add(new Phrase(str.Substring(lastIndex), fnt)); - - return p; - } - - private void BuildLibDocUsageReport(iTextSharp.text.Document document) - { - // Adjusted from 20,80 to 25,75 to account for long Procedure Numbers - float[] headerwidths = { 25, 75 }; - // 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 - iTextSharp.text.Font f2 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 0, Color.BLACK); - BuildLibDocProcSetList(); - - int splitAt = FindSpitLevel() - 1; // find the split level of the common path - for all procedure sets that use these library documents - string lastDvPath = string.Empty; - Color AnnoBackgroundColor = new Color(0xFF, 0xFF, 0xC0); - Color TextBackgroundColor = Color.WHITE; - Color NotUsedBackgroundColor = Color.WHITE; - MyPageHelper pghlp = _MyPdfWriter.PageEvent as MyPageHelper; - pghlp.HeaderTable = LibDocTable(document, headerwidths, f2, null); - - foreach (DocumentInfo di in _LibDocList) - { - PdfPTable subtable; - subtable = BuildSubTable(document, headerwidths); - - AddGroupLibDoc(subtable, di.DocumentTitle, string.Empty, f2, false, new Color(0xC0, 0xFF, 0xC0), false); // Library Document Title - - if (di.DocumentConfig.LibDoc_Comment != null && di.DocumentConfig.LibDoc_Comment.Length > 0) - { - AddCell(subtable, "Comment", f2, AnnoBackgroundColor); - AddCell(subtable, di.DocumentConfig.LibDoc_Comment, f2, AnnoBackgroundColor); // lib doc comment - } - - if (di.DocumentEntries == null || di.DocumentEntries.Count == 0) - { - AddGroupLibDoc(subtable, "* No References To This Library Document *", string.Empty, f2, false, TextBackgroundColor, false); // Library Document Title - } - else - { - subtable.HeaderRows = 2; - System.Collections.ArrayList LibDocUsageList = GetSortedItemInfoList(di.LibraryDocumentUsageList); - lastDvPath = string.Empty; - - foreach (ItemInfo item in LibDocUsageList)//di.LibraryDocumentUsageList) - { - if (item.SearchDVPath != lastDvPath) - { - if (lastDvPath != string.Empty) - { - document.Add(subtable); - subtable = BuildSubTable(document, headerwidths); - subtable.HeaderRows = 2; - AddGroupLibDoc(subtable, di.DocumentTitle, string.Empty, f2, false, new Color(0xC0, 0xFF, 0xC0), false); // Library Document Title - } - - AddSubPathGroup(subtable, lastDvPath, item.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 2);//new Color(0xC0, 0xFF, 0xC0)); - } - - lastDvPath = item.SearchDVPath; - string ProcNumber = item.MyProcedure.ProcedureConfig.Number; - ProcNumber = ProcNumber.Replace(@"\u8209?", "-"); // repace unicode with dash char - ProcNumber = ProcNumber.Replace(@"\u160?", " "); // replace Hard Space with normal Space - ProcNumber = ProcNumber.Replace(@"\u9586?", @"\"); // replace backslash symbol with a backslash - AddCell(subtable, ProcNumber, f2, TextBackgroundColor); - AddCell(subtable, item.DisplayNumber + " - " + item.DisplayText, f2, TextBackgroundColor); - } - - } - - document.Add(subtable); - } - } - - private PdfPTable LibDocTable(iTextSharp.text.Document document, float[] headerwidths, iTextSharp.text.Font f2, DocumentInfo di) - { - PdfPTable datatable = new PdfPTable(1);// (headerwidths); - PdfPTable colheader = new PdfPTable(headerwidths); - datatable.HeaderRows = 2; - datatable.KeepTogether = false; - datatable.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; - datatable.LockedWidth = true; - - // 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 - iTextSharp.text.Font f1 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 14, 1, Color.BLACK); - iTextSharp.text.Font f3 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 12, 0, Color.BLACK); - PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1)); - cell.HorizontalAlignment = Element.ALIGN_CENTER; - //cell.Colspan = 2; - - cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); - datatable.AddCell(cell); - - Color subHeaderColor = new Color(0xD0, 0xF0, 0xD0); - datatable.DefaultCell.Padding = 4; - datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; - AddCell(colheader, "Procedure", f2, subHeaderColor); - AddCell(colheader, "Section", f2, subHeaderColor); - datatable.AddCell(colheader); - - datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; - - return datatable; - } - - private void AddROUsages(ItemInfo item, Dictionary> roUse) - { - if (item != null && !string.IsNullOrEmpty(item.FoundROID)) - { - string roid = item.FoundROID; - - if (roUse.ContainsKey(roid)) - { - ((List)roUse[roid]).Add(item); - } - else - { - List itmIfoLst = new List(); - itmIfoLst.Add(item); - roUse.Add(roid, itmIfoLst); - } - } - } - - private void PutROusageForProcedure(PdfPTable curTable, Dictionary> rosused, float[] headerwidths) - { - //if (rosused.Count == 0) return; // nothing to process - // 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 - iTextSharp.text.Font f2 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 0, Color.BLACK); - - foreach (string roKey in rosused.Keys) - { - PdfPTable rotable = new PdfPTable(headerwidths); - string rotitle = string.Empty; - - foreach (ItemInfo itm in rosused[roKey]) - { - if (string.IsNullOrEmpty(rotitle)) - { - rotitle = GetROTitleAndGroup(roKey, itm); - - if (!string.IsNullOrEmpty(rotitle)) - { - PdfPCell ROTitleCell = new PdfPCell(new Phrase(rotitle, f2)); - ROTitleCell.Colspan = 2; - ROTitleCell.HorizontalAlignment = Element.ALIGN_LEFT; - - if (rotitle.StartsWith("Missing RO")) - { - ROTitleCell.BackgroundColor = Color.PINK; - } - else - { - ROTitleCell.BackgroundColor = new Color(0xDC, 0xE7, 0xC9); //new Color(0xD0, 0xF0, 0xD0);//ligt green //new Color(0xC8, 0xC8, 0x91);//(0xAF, 0xD8, 0xD8);//(0xF5, 0xE4, 0xA0); - } - - rotable.AddCell(ROTitleCell); // put RO value and description - } - } - - string stepnum = string.Empty; - string sectitle = (itm.ActiveSection != null) ? itm.ActiveSection.DisplayText : string.Empty; - - if (itm.IsSection) - { - stepnum = (itm.ActiveSection != null) ? itm.ActiveSection.DisplayNumber : string.Empty; - } - else - { - stepnum = BuildStepTab(itm); - } - - AddCell(rotable, stepnum, f2, Color.WHITE); - AddCell(rotable, itm.DisplayText, f2, Color.WHITE); - - } - - curTable.AddCell(rotable); - } - } - - private void BuildROUsageTableByProcedure(iTextSharp.text.Document document) - { - Dictionary> roUse = new Dictionary>(); - float[] headerwidths = { 20, 80 }; - PdfPTable datatable = new PdfPTable(1); - PdfPTable colHeader = new PdfPTable(headerwidths); - //datatable.FooterRows = 1; - datatable.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; - datatable.LockedWidth = true; - - // 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 - iTextSharp.text.Font f1 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 14, 1, 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, 12, 0, Color.BLACK); - PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1)); - cell.HorizontalAlignment = Element.ALIGN_CENTER; - //cell.Colspan = 2; - cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); // light blue - datatable.AddCell(cell); - - BuildSearchResultsProcSetList(); - datatable.HeaderRows = 2;//3 + (ProcSetList.Count == 1 ? 1 : 0); - int splitAt = FindSpitLevel(); // find the split level of the common path - - Color subHeaderColor = new Color(0xD0, 0xF0, 0xF0); // light blue //new Color(0xD0, 0xF0, 0xD0);//ligt green - datatable.DefaultCell.Padding = 4; - datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; - - // This puts "Step" and "Text" column headers at the bottom of the page - AddCell(colHeader, "Step", f2, subHeaderColor); - AddCell(colHeader, "Text", f2, subHeaderColor); - datatable.AddCell(colHeader); - datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; - Color AnnoColor = new Color(0xFF, 0xFF, 0xC0); - Color TextColor = Color.WHITE; - Color SectColor = new Color(0xE0, 0xFF, 0xE0);//new Color(0xC0, 0xFF, 0xC0);//Color.LIGHT_GRAY; - PdfPTable subTable = new PdfPTable(headerwidths); - datatable.AddCell(subTable); - - string lastProcNum = string.Empty; - string lastSection = string.Empty; - //CSM B2021-043 Step numbering is out of order in RO usage report if RO values exist on steps 10 or higher. - //setting this to something other than empty - otherwise will not print first initial header - string lastDVPath = "start"; - if (_ResultList.Count > 0) - { - foreach (ItemInfo item in _ResultList) - { - bool differentProcSet = false; - bool differentRO = false; - // Check Doc Version path - // if more than one procedure set is in the report data, then - // we will output the procedure set title inside the grouping of each RO - // otherwise, if we are reporting on only one procedure set, print the - // procedure set title at the top of the report (once). - if (lastDVPath != "" && lastDVPath != item.SearchDVPath) - { - //CSM B2021-043 Step numbering is out of order in RO usage report if RO values exist on steps 10 or higher. - //was placing last item from the precious section in the new section - //place it before starting the new section and then clear items - PutROusageForProcedure(datatable, roUse, headerwidths); - roUse.Clear(); - - subTable = new PdfPTable(headerwidths); - AddMainPathGroup(datatable, item.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); - lastProcNum = string.Empty; - lastSection = string.Empty; - } - - lastDVPath = item.SearchDVPath; - //check for different procedure number - string curProcNum = GetCurProcNum(item.SearchPath); - string curSection = GetCurSectionNumTitle(item); - - if (!string.IsNullOrEmpty(lastProcNum) && (curProcNum != lastProcNum)) - { - if (roUse.Count > 0) - { - PutROusageForProcedure(datatable, roUse, headerwidths); - roUse.Clear(); - } - - lastSection = string.Empty; - } - - if (!string.IsNullOrEmpty(lastSection) && (curSection != lastSection)) - { - if (roUse.Count > 0) - { - PutROusageForProcedure(datatable, roUse, headerwidths); - roUse.Clear(); - } - } - - AddROUsages(item, roUse); // add the used ro to the list for this procedure - AddProcedureSectionGroup(datatable, curProcNum, lastProcNum, curSection, lastSection, f2, new Color(0xC0, 0xFF, 0xC0)); - - lastProcNum = curProcNum; - lastSection = curSection; - } - } - else - { // B2022-093 put out a message if no RO Usages were found - cell = new PdfPCell(new Phrase("No RO Usage Information Found", f3)); - cell.HorizontalAlignment = Element.ALIGN_LEFT; - //cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); // light blue - datatable.AddCell(cell); - } - PutROusageForProcedure(datatable, roUse, headerwidths); - - document.Add(datatable); - } - - private void AddProcROUse(ItemInfo item, Dictionary> procRoUse) - { - string dictKey = GetCurProcNum(item.SearchPath) + " " + GetCurSectionNumTitle(item); - - if (!string.IsNullOrEmpty(dictKey)) - { - if (procRoUse.ContainsKey(dictKey)) - { - ((List)procRoUse[dictKey]).Add(item); - } - else - { - List itmIfoLst = new List(); - itmIfoLst.Add(item); - procRoUse.Add(dictKey, itmIfoLst); - } - } - } - - private void PutStepListForProcedure(PdfPTable rotable, Dictionary sortedStepList) - { - // 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 - iTextSharp.text.Font f2 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 0, Color.BLACK); - - foreach (ItemInfo itm in sortedStepList.Values) - { - string stepnum = (itm.IsSection && itm.ActiveSection != null) ? itm.ActiveSection.DisplayNumber : stepnum = BuildStepTab(itm);// C2018-003 fixed use of getting the active section - AddCell(rotable, stepnum, f2, Color.WHITE); - AddCell(rotable, itm.DisplayText, f2, Color.WHITE); - } - - sortedStepList.Clear(); - } - - private void PutROusageForROID(PdfPTable curTable, Dictionary> procRoUse, float[] headerwidths, int splitAt, bool moreThanOneProcSet) - { - // 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 - iTextSharp.text.Font f2 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 0, Color.BLACK); - - Dictionary sortedStepList = new Dictionary(); - string lastProcKey = string.Empty; - string lastProcNumTitle = string.Empty; - string lastDVPath = string.Empty; - string curProcNumTitle = string.Empty; - - foreach (string procKey in procRoUse.Keys) - { - PdfPTable rotable = new PdfPTable(headerwidths); - - foreach (ItemInfo itm in procRoUse[procKey]) - { - bool didProcSetTitle = false; - // Check Doc Version path - // where we are reporting on more than one procedure set - // output the procedure set title within the RO value grouping on the report - if (moreThanOneProcSet && lastDVPath != itm.SearchDVPath) - { - AddMainPathGroup(curTable, itm.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); - didProcSetTitle = true; - } - else - { - didProcSetTitle = false; - } - - lastDVPath = itm.SearchDVPath; - - if (didProcSetTitle || procKey != lastProcKey) - { - if (sortedStepList.Count > 0) - { - PutStepListForProcedure(rotable, sortedStepList); - } - - string procNumTitleSect = string.Empty; - curProcNumTitle = GetCurProcNum(itm.SearchPath); - - if (lastProcNumTitle == string.Empty || lastProcNumTitle != curProcNumTitle) - { - procNumTitleSect = curProcNumTitle + "\r\n"; - lastProcNumTitle = curProcNumTitle; - } - - procNumTitleSect += " " + GetCurSectionNumTitle(itm); - procNumTitleSect = procNumTitleSect.Replace(@"\u8209?", "-"); // repace unicode with dash char - procNumTitleSect = procNumTitleSect.Replace(@"\u160?", " "); // replace Hard Space with normal Space - procNumTitleSect = procNumTitleSect.Replace(@"\u9586?", @"\"); // replace backslash symbol with a backslash - PdfPCell ProcTitleCell = new PdfPCell(new Phrase(procNumTitleSect, f2)); - ProcTitleCell.Colspan = 2; - ProcTitleCell.HorizontalAlignment = Element.ALIGN_LEFT; - ProcTitleCell.BackgroundColor = new Color(0xDC, 0xE7, 0xC9); //new Color(0xD0, 0xF0, 0xD0);//ligt green //new Color(0xC8, 0xC8, 0x91);//(0xAF, 0xD8, 0xD8);//(0xF5, 0xE4, 0xA0); - rotable.AddCell(ProcTitleCell); // put RO value and description - lastProcKey = procKey; - } - - string stepnum = (itm.IsSection && itm.ActiveSection != null) ? itm.ActiveSection.DisplayNumber : BuildStepTab(itm);// C2018-003 fixed use of getting the active section - string itemkey = stepnum + " " + itm.ItemID.ToString(); // add ItemId to stepnum, sometimes we have idential stepnum text for different steps (ex: blank section numbers) - - if (!sortedStepList.ContainsKey(itemkey)) - { - sortedStepList.Add(itemkey, itm); - } - } - - if (sortedStepList.Count > 0) - { - PutStepListForProcedure(rotable, sortedStepList); - } - - curTable.AddCell(rotable); - } - } - - private string GetROTitleAndGroup(string roid, ItemInfo itm) - { - string rotitle = string.Empty; - - ROFSTLookup myrofstlookup = (itm == null) ? _ROFSTLookup : itm.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(itm.MyDocVersion); - - List roTitleList = myrofstlookup.GetROTitleAndGroupPath(roid, _IncludeMissingROs, _ConvertCaretToDelta); - - if (roTitleList != null && roTitleList.Count > 0) - { - for (int cnt = 0; cnt < roTitleList.Count; cnt++) - { - if (cnt == roTitleList.Count - 1) // Last roTitle in list, don't add a NewLine character after the value - rotitle += roTitleList[cnt]; - else - rotitle += roTitleList[cnt] + "\n "; - } - } - - return rotitle; - } - - private void AddROHeaderGroup(PdfPTable datatable, string curROID, ItemInfo itm, Font f2, Color bgColor) - { - string headerText = GetROTitleAndGroup(curROID, itm); - - if (!string.IsNullOrEmpty(headerText) && headerText.Length > 0) - { - PdfPCell cell = new PdfPCell(new Phrase(headerText, f2)); - - cell.Colspan = 2; - cell.BackgroundColor = (headerText.StartsWith("Missing RO")) ? Color.PINK : bgColor; - cell.BorderWidthTop = 1; - - datatable.AddCell(cell); - } - } - - private void BuildROUsageTableByRO(iTextSharp.text.Document document) - { - Dictionary> procRoUse = new Dictionary>(); - - float[] headerwidths = { 20, 80 }; - PdfPTable datatable = new PdfPTable(1); - PdfPTable colHeader = new PdfPTable(headerwidths); - //datatable.FooterRows = 1; - datatable.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; - datatable.LockedWidth = true; - - // 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 - iTextSharp.text.Font f1 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 14, 1, 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, 12, 0, Color.BLACK); - PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1)); - cell.HorizontalAlignment = Element.ALIGN_CENTER; - cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); // light blue - datatable.AddCell(cell); - - BuildSearchResultsProcSetList(); - datatable.HeaderRows = 2;//3 + (ProcSetList.Count == 1 ? 1 : 0); - int splitAt = FindSpitLevel(); // find the split level of the common path - - Color subHeaderColor = new Color(0xD0, 0xF0, 0xF0); // light blue //new Color(0xD0, 0xF0, 0xD0);//ligt green - datatable.DefaultCell.Padding = 4; - datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; - // This puts "Step" and "Text" column headers at the bottom of the page - AddCell(colHeader, "Step", f2, subHeaderColor); - AddCell(colHeader, "Text", f2, subHeaderColor); - datatable.AddCell(colHeader); - - datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; - Color AnnoColor = new Color(0xFF, 0xFF, 0xC0); - Color TextColor = Color.WHITE; - Color SectColor = new Color(0xE0, 0xFF, 0xE0);//new Color(0xC0, 0xFF, 0xC0);//Color.LIGHT_GRAY; - PdfPTable subTable = new PdfPTable(headerwidths); - datatable.AddCell(subTable); - - string lastDVPath = string.Empty; - string lastROID = string.Empty; - bool moreThanOneProcSet = false; - bool printedSetTitle = false; - bool printedROHeader = false; - ItemInfo lastItem = null; - - if (_ResultList.Count == 0) - { - PdfPCell cell2 = new PdfPCell(new Phrase("Selected RO is not used", f2)); - - cell2.Colspan = 0; - cell2.BorderWidthTop = 1; - datatable.AddCell(cell2); - document.Add(datatable); - - return; - } - - foreach (ItemInfo item in _ResultList) - { - bool differentProcSet = false; - bool differentRO = false; - - // Check Doc Version path - // if more than one procedure set is in the report data, then - // we will output the procedure set title inside the grouping of each RO - // otherwise, if we are reporting on only one procedure set, print the - // procedure set title at the top of the report (once). - if (!string.IsNullOrEmpty(lastDVPath) && lastDVPath != item.SearchDVPath) - { - moreThanOneProcSet = true; - differentProcSet = true; - } - - lastDVPath = item.SearchDVPath; - - // Check for different ROID - string curROID = item.FoundROID; - differentRO = (!string.IsNullOrEmpty(lastROID) && !string.IsNullOrEmpty(curROID) && curROID.Substring(0, 12) != lastROID.Substring(0, 12)); - - if (procRoUse.Count > 0 && (differentProcSet || differentRO)) - { - if (!moreThanOneProcSet && !printedSetTitle) - { - AddMainPathGroup(datatable, lastDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); - printedSetTitle = true; - } - - if (!printedROHeader) - { - AddROHeaderGroup(datatable, lastROID, lastItem, f2, new Color(0xC0, 0xFF, 0xC0)); - printedROHeader = true; - } - - PutROusageForROID(datatable, procRoUse, headerwidths, splitAt, moreThanOneProcSet); - procRoUse.Clear(); - - differentProcSet = false; - } - - if (differentRO) - { - printedROHeader = false; - } - - AddProcROUse(item, procRoUse); - - lastROID = curROID; - lastItem = item; - } - - if (!moreThanOneProcSet && !printedSetTitle) - AddMainPathGroup(datatable, lastDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); - - if (!printedROHeader) - AddROHeaderGroup(datatable, lastROID, lastItem, f2, new Color(0xC0, 0xFF, 0xC0)); - - PutROusageForROID(datatable, procRoUse, headerwidths, splitAt, moreThanOneProcSet); - - document.Add(datatable); - } - - private void BuildSearchResultsProcSetList() - { - ProcSetList = new System.Collections.ArrayList(); - foreach (ItemInfo item in _ResultList) - { - if (!ProcSetList.Contains(item.SearchDVPath)) - ProcSetList.Add(item.SearchDVPath); - } - } - - private void BuildLibDocProcSetList() - { - ProcSetList = new System.Collections.ArrayList(); - foreach (DocumentInfo di in _LibDocList) - { - if (di.LibraryDocumentUsageList != null && di.LibraryDocumentUsageList.Count > 0) - foreach (ItemInfo item in di.LibraryDocumentUsageList) - { - if (!ProcSetList.Contains(item.SearchDVPath)) - ProcSetList.Add(item.SearchDVPath); - } - } - } - - private ArrayList GetSortedItemInfoList(ItemInfoList orgIFL) - { - System.Collections.ArrayList libDocProcSetList = new System.Collections.ArrayList(); - System.Collections.ArrayList rtnIFL = new System.Collections.ArrayList(); - foreach (ItemInfo item in orgIFL) - { - if (!libDocProcSetList.Contains(item.SearchDVPath)) - libDocProcSetList.Add(item.SearchDVPath); - } - foreach (string pset in libDocProcSetList) - { - foreach (ItemInfo item in orgIFL) - { - if (item.SearchDVPath.Equals(pset)) - rtnIFL.Add(item); - } - } - return rtnIFL; - } - - private void BuildCompleteROReport(iTextSharp.text.Document document) - { - CompleteROReport compRORpt = new CompleteROReport(_MyPdfWriter, document, _RODataFile, _ConvertCaretToDelta, _IncludeEmptyROFields); - - compRORpt.F10 = pdf.GetFont("Courier New", 10, 0, Color.BLACK); - compRORpt.F10Bold = pdf.GetFont("Courier New", 10, 1, Color.BLACK); - compRORpt.F12 = pdf.GetFont("Courier New", 12, 0, Color.BLACK); - compRORpt.F12Bold = pdf.GetFont("Courier New", 12, 1, Color.BLACK); - // 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 - compRORpt.F14 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 14, 1, Color.BLACK); - - //B2022 - 083: Support Conditional RO Values - compRORpt.ROFstID = _ROFSTLookup.RofstID; - - compRORpt.Run(); - } - - private string GetROTitleAndGroupsForSummary(List roTitleList, List prevROTitleList) - { - string rotitle = string.Empty; - string indent = string.Empty; - - for (int icnt = 0; icnt < roTitleList.Count; icnt++) - { - indent += " "; - - if (icnt == roTitleList.Count - 1) - { - rotitle += indent + roTitleList[icnt]; // this should be the ro description - break; //break out of for loop - } - - if (prevROTitleList == null || (icnt < roTitleList.Count && icnt < prevROTitleList.Count && prevROTitleList[icnt] != roTitleList[icnt])) - { - if (rotitle == string.Empty && prevROTitleList != null) - rotitle = "\n"; - - rotitle += indent + roTitleList[icnt] + "\n"; - } - } - - return rotitle; - } - - private List AddROHeaderGroupForSummary(PdfPTable datatable, string curROID, List prevROTitleList, Font f2, Color bgColor) - { - List roTitleList = _ROFSTLookup.GetROTitleAndGroupPath(curROID, _IncludeMissingROs, _ConvertCaretToDelta); - string headerText = GetROTitleAndGroupsForSummary(roTitleList, prevROTitleList); - - if (headerText.Length > 0) - { - Paragraph pgh = new Paragraph(headerText, f2); - PdfPCell cell = new PdfPCell(pgh); - - cell.FollowingIndent = 72; - cell.Colspan = 2; - cell.BorderColor = Color.WHITE; - cell.BackgroundColor = Color.WHITE; - cell.BorderWidthTop = 1; - - datatable.AddCell(cell); - } - - return roTitleList; - } - - private void BuildROSummaryReport(iTextSharp.text.Document document) - { - float[] headerwidths = { 10, 20, 80 }; - PdfPTable datatable = new PdfPTable(1); - datatable.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; - datatable.LockedWidth = true; - - // 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 - iTextSharp.text.Font f1 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 14, 1, 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, 12, 1, Color.BLACK); - - PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1)); - - cell.HorizontalAlignment = Element.ALIGN_CENTER; - //cell.Colspan = 2; - cell.BackgroundColor = Color.WHITE;//new Color(0xD0, 0xF0, 0xF0); // light blue - cell.BorderColor = Color.WHITE; - datatable.AddCell(cell); - - string roFSTDateTime = "RO.FST Last Created: " + _ROFSTLookup.GetRoFSTdts().ToLongDateString() + " @ " + _ROFSTLookup.GetRoFSTdts().ToShortTimeString() + "\n "; - cell = new PdfPCell(new Phrase(roFSTDateTime, f2)); - cell.BorderColor = Color.WHITE; - datatable.AddCell(cell); - - datatable.HeaderRows = 2;//3 + (ProcSetList.Count == 1 ? 1 : 0); - datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; - string lastROID = string.Empty; - List prevROTitleList = null; - int lastDBindex = -1; - - foreach (string curROID in _ROList) - { - string[] tmp = curROID.TrimEnd(',').Split(':'); //curROID.Split(':');// this is the RO FST id number (for plants with multiple RO FSTs) - string rolst = (tmp.Length == 2) ? tmp[1] : tmp[0]; - string[] roIdslst = rolst.Split(','); - - foreach (string cROID in roIdslst) - { - if (string.IsNullOrEmpty(cROID)) - break; - - if (cROID.Length == 4) - ProcessROdb(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, cROID); - else - ProcessROID(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, cROID); - } - } - - document.Add(datatable); - } - - private void ProcessROdb(PdfPTable datatable, iTextSharp.text.Font f2, iTextSharp.text.Font f3, ref PdfPCell cell, ref string lastROID, ref List prevROTitleList, ref int lastDBindex, string cROID) - { - ROFSTLookup.rodbi roDBI = _ROFSTLookup.GetRODatabase(cROID, true, true); - - if (roDBI.children != null && roDBI.children.Length > 0) - { - for (int i = 0; i < roDBI.children.Length; i++) - { - ProcessROChild(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, roDBI.children[i]); - } - } - else - { - ProcessROID(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, cROID); - - cell = new PdfPCell(new Phrase(" ", f2)); - cell.BorderColor = Color.WHITE; - datatable.AddCell(cell); - cell = new PdfPCell(new Phrase("-- No Information Entered --", f2)); - cell.BorderColor = Color.WHITE; - datatable.AddCell(cell); - } - } - - private void ProcessROChild(PdfPTable datatable, iTextSharp.text.Font f2, iTextSharp.text.Font f3, ref PdfPCell cell, ref string lastROID, ref List prevROTitleList, ref int lastDBindex, ROFSTLookup.rochild cld) - { - if (cld.children == null || cld.children.Length <= 0) // leaf node - { - ProcessROID(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, cld.roid); - } - else if (cld.children[0].ParentID == 0) // multiple return value - { - ProcessROID(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, cld.roid); - } - else - { - for (int i = 0; i < cld.children.Length; i++) - { - ProcessROChild(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, cld.children[i]); - } - } - } - - private void ProcessROID(PdfPTable datatable, iTextSharp.text.Font f2, iTextSharp.text.Font f3, ref PdfPCell cell, ref string lastROID, ref List prevROTitleList, ref int lastDBindex, string cROID) - { - int curDBindex = _ROFSTLookup.GetRODatabaseTitleIndex(cROID); - - if (lastDBindex == -1 || curDBindex != lastDBindex) - { - if (prevROTitleList != null) - { - // add blank line to separate groups on the report - cell = new PdfPCell(new Phrase(" ", f2)); - cell.BorderColor = Color.WHITE; - datatable.AddCell(cell); - } - - AddMainRODatabaseTitle(datatable, curDBindex, f3, Color.WHITE); - lastDBindex = curDBindex; - } - - if (string.IsNullOrEmpty(lastROID) || cROID != lastROID) - prevROTitleList = AddROHeaderGroupForSummary(datatable, cROID, prevROTitleList, f2, new Color(0xC0, 0xFF, 0xC0)); - - lastROID = cROID; - } - - #endregion - - #region Private Static Methods - - private static PdfPTable BuildSubTable(iTextSharp.text.Document document, float[] headerwidths) - { - PdfPTable subtable = new PdfPTable(headerwidths); - - subtable.HeaderRows = 1; - subtable.KeepTogether = true; - subtable.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; - subtable.LockedWidth = true; - subtable.DefaultCell.Padding = 4; - - return subtable; - } - - private static void ShowException(Exception ex) - { - Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); - StringBuilder msg = new StringBuilder(); - string sep = string.Empty; - string indent = string.Empty; - - while (ex != null) - { - msg.Append(string.Format("{0}{1}{2}:\r\n{1}{3}", sep, indent, ex.GetType().Name, ex.Message)); - ex = ex.InnerException; - sep = "\r\n"; - indent += " "; - } - - System.Windows.Forms.MessageBox.Show(msg.ToString(), "Error during PDF creation for search:", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); - } - - public static string BuildStepTab(ItemInfo item) - { - if (item == null) - return string.Empty; - - string sret = string.Empty; - - switch (item.MyContent.Type / 10000) - { - case 0: //procedure - sret = ProcedureInfo.Get(item.ItemID).MyTab.CleanText; - break; - - case 1: // section - sret = SectionInfo.Get(item.ItemID).MyTab.CleanText; - break; - - case 2: // step - ItemInfo pitem = item; - bool hasDelim = item.ActiveFormat.PlantFormat.FormatData.TransData.StepSubstepDelimeter != null; - List DelimList = null; - DelimList = new List(); - - if (!hasDelim) - { - SeqTabFmtList seqtabs = item.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList; - - foreach (SeqTabFmt seqtab in seqtabs) - { - string delim = seqtab.PrintTabFormat.Replace("{seq}", string.Empty); - - if (!DelimList.Contains(delim)) - { - DelimList.Add(delim.Trim()); - } - } - } - else - { - string stpdelms = item.ActiveFormat.PlantFormat.FormatData.TransData.StepSubstepDelimeter; - - foreach (char c in stpdelms) - { - if (!DelimList.Contains(c.ToString())) - { - DelimList.Add(c.ToString()); - } - } - } - - // B2016-160 Support transitions to sections - while (!pitem.IsSection && !pitem.IsHigh) - { - StepInfo stpinfo = StepInfo.Get(pitem.ItemID); - string thisTab = stpinfo.MyTab.CleanText; - - if (IncludesParentToHLS(stpinfo)) - { - if (!thisTab.Contains("\u25CF")) //Remove Bullet - { - return thisTab; - } - else - { - thisTab = null; - } - } - - string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.ToString(); - - // remove delimiters of '.' and ')' in tab. - if (!string.IsNullOrEmpty(thisTab)) - { - // get list of delimiters to remove from the format: - foreach (string rmvDelim in DelimList) - { - thisTab = thisTab.Replace(rmvDelim, string.Empty); - } - } - - if (!string.IsNullOrEmpty(thisTab)) - { - thisTab = thisTab.Trim(); - } - - // if the tab is null or - // if the the tab is not a letter or number OR - // the tab is an AND or OR type and is the letter "o" - // then reset the tab an empty string so that the type name along with the count of that type - // (ex. "AND 2", "OR 3") - if (string.IsNullOrEmpty(thisTab) || (thisTab != string.Empty && (!(char.IsLetterOrDigit(thisTab[0])) || ((pitem.IsAnd || pitem.IsOr || pitem.IsCaution || pitem.IsNote) && thisTab.Contains("o"))))) - { - thisTab = string.Empty; - } - - if (pitem.IsRNOPart) - { - if (string.IsNullOrEmpty(thisTab)) - { - sret = "RNO." + sret; //"RNO." + sret; - } - else - { - thisTab = thisTab.Trim(" ".ToCharArray()); - - if (!thisTab.EndsWith(".") && !thisTab.EndsWith(")")) - { - thisTab = thisTab + "."; - } - - sret = "RNO." + thisTab + sret; //"RNO." + thisTab + sret; - } - } - else if (pitem.IsCaution || pitem.IsNote) - { - // add the Caution or Note count to the tab (ex "Caution 1", "Note 2") - if (string.IsNullOrEmpty(thisTab)) - { - sret = "{" + typeName + " " + pitem.Ordinal.ToString() + "}"; - } - else - { - thisTab = thisTab.Trim(" ".ToCharArray()); - sret = thisTab + " " + pitem.Ordinal.ToString() + sret; - } - } - else - { - if (!string.IsNullOrEmpty(thisTab)) - { - thisTab = thisTab.Trim(" ".ToCharArray()); - - if (!thisTab.EndsWith(".") && !thisTab.EndsWith(")")) - { - thisTab = thisTab + "."; - } - } - else - { - thisTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}."; - } - - sret = thisTab + sret; - } - - pitem = pitem.ActiveParent as ItemInfo; - - if (pitem == null) - break; - } - - // add hls tab if it's not already in the tab. - if (pitem.IsHigh) - { - StepInfo stpinfo = StepInfo.Get(pitem.ItemID); - - string hlsTab = stpinfo.MyTab.CleanTextNoSymbols; //StepInfo.Get(pitem.ItemID).MyTab.CleanTextNoSymbols; - string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.GetPDDisplayName(); //.ToString(); - // C2020-043: don't remove delimiters on tabs if this step's tab has the parent tab included. - bool hasParent = false; - - if (IncludesParentToHLS(stpinfo) && !hlsTab.Contains("\u25CF")) - { - hlsTab = hlsTab.Trim(" ".ToCharArray()).TrimEnd(".".ToCharArray()); - hasParent = true; - } - - if (string.IsNullOrEmpty(hlsTab)) - { - hlsTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}."; - } - else if (!hasParent && !sret.StartsWith(hlsTab.Trim(" ".ToCharArray()))) - { - foreach (string rmvDelim in DelimList) - { - hlsTab = hlsTab.Replace(rmvDelim, string.Empty); - } - - hlsTab = hlsTab.Trim(" ".ToCharArray()); - - if (!hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) - { - hlsTab = hlsTab + "."; - } - } - - sret = hlsTab + sret; - } - - break; - } - - return sret.Trim(" .)".ToCharArray()); - } - - private static bool IncludesParentToHLS(StepInfo stpinfo) - { - if (stpinfo.IsHigh) - return true; - - StepInfo parent = StepInfo.Get((stpinfo.ActiveParent as ItemInfo).ItemID); - - if (stpinfo.MyTab.CleanText.StartsWith(parent.MyTab.CleanText.Trim()) && stpinfo.MyTab.CleanText.Length > parent.MyTab.CleanText.Length) - { - return IncludesParentToHLS(parent); - } - - return false; - } - - #endregion - } - - - public class MyPageHelper : PdfPageEventHelper - { - #region Fields - - private PdfPTable _HeaderTable = null; - protected PdfTemplate total; - protected BaseFont helv; - private int ptSize = 10; // text point size of page number and page total - string _ByLine = "PROMS"; - - #endregion - - #region Properties - - public PdfPTable HeaderTable - { - get { return _HeaderTable; } - set { _HeaderTable = value; } - } - - #endregion - - #region Constructors - - public MyPageHelper(string byLine) - { - _ByLine = byLine; - } - - #endregion - - #region Public Methods - - public override void OnOpenDocument(PdfWriter writer, iTextSharp.text.Document document) - { - total = writer.DirectContent.CreateTemplate(100, 100); - total.BoundingBox = new Rectangle(-20, -20, 100, 100); - helv = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED); - } - - public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document) - { - PdfContentByte cb = writer.DirectContent; - - cb.SaveState(); - - if (HeaderTable != null) - HeaderTable.WriteSelectedRows(0, 2, 36, document.Top + 44, cb); - String text = "Page " + writer.PageNumber + " of "; - float textBase = document.Bottom - 19;//20; - cb.BeginText(); - cb.SetFontAndSize(helv, ptSize); - - float posCenter = document.Left + ((document.Right - document.Left) / 2) - (helv.GetWidthPoint(text + "XX", ptSize) / 2); - cb.SetTextMatrix(posCenter, textBase); - cb.ShowText(text); - cb.EndText(); - cb.AddTemplate(total, posCenter + helv.GetWidthPoint(text, ptSize), textBase); - cb.RestoreState(); - - AddVolianFooter(writer, document); - AddDateFooter(writer, document); - } - - public override void OnCloseDocument(PdfWriter writer, iTextSharp.text.Document document) - { - total.BeginText(); - total.SetFontAndSize(helv, ptSize); - total.SetTextMatrix(0, 0); - total.ShowText((writer.PageNumber - 1).ToString()); - total.EndText(); - - base.OnCloseDocument(writer, document); - } - - #endregion - - #region Private Methods - - private void AddVolianFooter(PdfWriter writer, iTextSharp.text.Document document) - { - PdfContentByte cb = writer.DirectContent; - cb.SaveState(); - String text = _ByLine;//"PROMS Search Results"; - float textBase = document.Bottom - 19;//20; - float textSize = helv.GetWidthPoint(text, ptSize); - cb.BeginText(); - cb.SetFontAndSize(helv, ptSize); - cb.SetTextMatrix(document.Left, textBase); - cb.ShowText(text); - cb.EndText(); - cb.RestoreState(); - } - - private void AddDateFooter(PdfWriter writer, iTextSharp.text.Document document) - { - PdfContentByte cb = writer.DirectContent; - cb.SaveState(); - String text = DateTime.Today.ToShortDateString(); - float textBase = document.Bottom - 19;//20; - float textSize = helv.GetWidthPoint(text, ptSize); - float posRight = document.Right - helv.GetWidthPoint(text, ptSize); - cb.BeginText(); - cb.SetFontAndSize(helv, ptSize); - cb.SetTextMatrix(posRight, textBase); - cb.ShowText(text); - cb.EndText(); - cb.RestoreState(); - } - - #endregion - } - -} diff --git a/PROMS/Volian.Print.Library/PDFTransitionReport.cs b/PROMS/Volian.Print.Library/PDFTransitionReport.cs deleted file mode 100644 index fe283a83..00000000 --- a/PROMS/Volian.Print.Library/PDFTransitionReport.cs +++ /dev/null @@ -1,503 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using VEPROMS.CSLA.Library; -using iTextSharp.text.pdf; -using iTextSharp.text; -using System.IO; -using System.Text.RegularExpressions; - -namespace Volian.Print.Library -{ - public delegate void TransitionReportEvent(object sender, EventArgs args); - public class PDFTransitionReport - { - public event TransitionReportEvent TransitionProcessed; - private void OnTransitionProcessed(object sender, EventArgs args) - { - if (TransitionProcessed != null) TransitionProcessed(sender, args); - } - public event TransitionReportEvent ProcedureProcessed; - private void OnProcedureProcessed(object sender, EventArgs args) - { - if (ProcedureProcessed != null) ProcedureProcessed(sender, args); - } - public event TransitionReportEvent DocVersionProcessed; - private void OnDocVersionProcessed(object sender, EventArgs args) - { - if (DocVersionProcessed != null) DocVersionProcessed(sender, args); - } - private string _FileName; - public string FileName - { - get { return _FileName; } - set { _FileName = value; } - } - private PdfPCell _CurrentPageNumberCell = null; - private int _CurrentPageNumber = 1; - public int CurrentPageNumber - { - get - { - return _CurrentPageNumber; - } - set - { - if (_CurrentPageNumberCell != null) - { - _CurrentPageNumber = value; - _CurrentPageNumberCell.Phrase.Clear(); - _CurrentPageNumberCell.Phrase.Add("Page " + value.ToString()); - } - } - } - private FolderInfo folderInfo; - private ProcedureInfo procedureInfo; - private TransitionInfoList transitionInfoList; - private int _TransitionInfoCount; - public int TransitionInfoCount - { - get { return _TransitionInfoCount; } - set { _TransitionInfoCount = value; } - } - private List _MyDocVersionList; - public List 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) - { - _FileName = fileName; - folderInfo = fi; - if (fi.ActiveFormat != null) - _PaperSize = fi.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files - } - public PDFTransitionReport(ProcedureInfo pi, string fileName) - { - _FileName = fileName; - procedureInfo = pi; - transitionInfoList = TransitionInfoList.GetTransitionReportData(procedureInfo.MyDocVersion.VersionID, procedureInfo.ItemID); - _TransitionInfoCount = transitionInfoList.Count; - _PaperSize = pi.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files - } - public void BuildTransitionReport() - { - Rectangle paperSize = PDFPageSize.UsePaperSize(_PaperSize); // C2020-002 paper size is now set in the format files - iTextSharp.text.Document document = new iTextSharp.text.Document(paperSize.Rotate(), 36, 36, 36, 36); - if (!CreateResultsPDF(document)) return; - try - { - if (folderInfo != null) - { - if (MyDocVersionList.Count == 1) - { - DocVersionInfo dvi = MyDocVersionList[0]; - foreach (ProcedureInfo pi in dvi.Procedures) - { - procedureInfo = pi; - transitionInfoList = TransitionInfoList.GetTransitionReportData(dvi.VersionID, procedureInfo.ItemID); - if (transitionInfoList.Count > 0) - { - _TransitionInfoCount = transitionInfoList.Count; - OnProcedureProcessed(this, new EventArgs()); - BuildProcedureReport(document); - } - else - { - OnProcedureProcessed(this, new EventArgs()); - } - } - } - else - { - foreach (DocVersionInfo dvi in MyDocVersionList) - { - ProcedureCount = dvi.Procedures.Count; - OnDocVersionProcessed(this, new EventArgs()); - foreach (ProcedureInfo pi in dvi.Procedures) - { - procedureInfo = pi; - transitionInfoList = TransitionInfoList.GetTransitionReportData(dvi.VersionID, procedureInfo.ItemID); - _TransitionInfoCount = transitionInfoList.Count; - OnProcedureProcessed(this, new EventArgs()); - BuildProcedureReport(document); - } - } - } - } - else - { - BuildProcedureReport(document); - } - } - catch (Exception ex) - { - StringBuilder msg = new StringBuilder(); - document.Add(new Paragraph("Error:")); - while (ex != null) - { - document.Add(new Paragraph(ex.GetType().Name)); - document.Add(new Paragraph(ex.Message)); - ex = ex.InnerException; - } - } - finally - { - if (document.IsOpen()) - { - document.Close(); - //System.Diagnostics.Process.Start(_FileName); - } - } - } - PdfOutline outline = null; - ProcedureInfo lastProcedureInfo = null; - private PdfPTable BuildProcedurePDFTable(Dictionary levels, Dictionary fonts, int cols, int paddingBottom, int level, iTextSharp.text.Document doc) - { - PdfPTable t = new PdfPTable(cols); - t.HeaderRows = 4; - t.DefaultCell.Padding = 4; - t.WidthPercentage = 100; - float[] widths; - if(level == 1 || level == 2 || level == 4) - widths = new float[] { 20f, 47f, 33f }; - else - widths = new float[] { 33f, 47f, 20f }; - t.SetWidths(widths); - //report title - Phrase h = new Phrase(); - h.Font = fonts[1]; - if (folderInfo != null) - h.Add(string.Format("Procedure Set {0} Transition Report", folderInfo.Name)); - else - h.Add("Transition Report"); - PdfPCell c = new PdfPCell(h); - c.Colspan = cols-1; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - c.BackgroundColor = new Color(System.Drawing.Color.DarkGoldenrod); - t.AddCell(c); - //date generated - h = new Phrase(); - h.Font = fonts[4]; - h.Add(DateTime.Now.ToString("dddd MMMM d, yyyy @ h:mm tt")); - c = new PdfPCell(h); - c.HorizontalAlignment = Element.ALIGN_RIGHT; - c.PaddingBottom = paddingBottom; - c.BackgroundColor = new Color(System.Drawing.Color.DarkGoldenrod); - t.AddCell(c); - //procedure title - h = new Phrase(); - h.Font = fonts[2]; - h.Add(string.Format("{0} - {1}", procedureInfo.DisplayNumber, procedureInfo.DisplayText)); - PdfDestination dest = new PdfDestination(PdfDestination.FITH, cb.PdfDocument.PageSize.Height); - if (lastProcedureInfo != procedureInfo) - { - outline = new PdfOutline(cb.RootOutline, dest, procedureInfo.DisplayNumber, false); - lastProcedureInfo = procedureInfo; - } - c = new PdfPCell(h); - c.Colspan = cols-1; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - c.BackgroundColor = new Color(System.Drawing.Color.Goldenrod); - t.AddCell(c); - //page number - _CurrentPageNumberCell = BuildCell(1, string.Format("Page {0}",CurrentPageNumber), fonts[4], new Color(System.Drawing.Color.Goldenrod)); - _CurrentPageNumberCell.PaddingBottom = paddingBottom; - t.AddCell(_CurrentPageNumberCell); - //transition category - h = new Phrase(); - h.Font = fonts[3]; - if (transitionInfoList.Count == 0) - h.Add("N/A"); - else - { - h.Add(levels[level]); - dest = new PdfDestination(PdfDestination.FITH, cb.PdfDocument.PageSize.Height); - new PdfOutline(outline, dest, levels[level]); - } - c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - c.BackgroundColor = new Color(System.Drawing.Color.Khaki); - t.AddCell(c); - //add column headers - h = new Phrase(); - h.Font = fonts[4]; - h.Add("From Procedure Location"); - c = new PdfPCell(h); - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - c.BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod); - t.AddCell(c); - h = new Phrase(); - h.Font = fonts[4]; - h.Add("From Procedure Text"); - c = new PdfPCell(h); - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - c.BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod); - t.AddCell(c); - h = new Phrase(); - h.Font = fonts[4]; - h.Add("To Procedure Location"); - c = new PdfPCell(h); - c.HorizontalAlignment = Element.ALIGN_CENTER; - c.PaddingBottom = paddingBottom; - c.BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod); - t.AddCell(c); - return t; - } - PdfContentByte cb; - private void BuildProcedureReport(iTextSharp.text.Document doc) - { - Dictionary tranTypes = FormatInfo.GetTransitionTypesByFormatID(procedureInfo.ActiveFormat.FormatID); - Dictionary levels = new Dictionary(); - levels.Add(1, "Internal Transitions"); - levels.Add(2, "External From Transitions"); - levels.Add(3, "External To Transitions"); - levels.Add(4, "Outside From Transitions"); - levels.Add(5, "Outside To Transitions"); - Dictionary fonts = new Dictionary(); - // 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 - fonts.Add(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)); - fonts.Add(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)); - int lastLevel = transitionInfoList.Count > 0 ? transitionInfoList[0].Level : 0; //set level to first transition level - #region buildtable - int cols = 3; - int paddingBottom = 6; - if (folderInfo != null) - doc.NewPage(); - PdfPTable t = BuildProcedurePDFTable(levels, fonts, cols, paddingBottom, lastLevel, doc); - #endregion - //gather data - if (transitionInfoList.Count == 0) - { - Phrase h = new Phrase(); - h.Font = fonts[4]; - h.Add("This procedure contains no transitions"); - PdfPCell c = new PdfPCell(h); - c.Colspan = cols; - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - t.AddCell(c); - } - else - { - foreach (TransitionInfo ti in transitionInfoList) - { - //add category - OnTransitionProcessed(this, new EventArgs()); - if (ti.Level != lastLevel) - { - if (lastLevel > 0) - { - doc.Add(t); - doc.NewPage(); - lastLevel = ti.Level; - t = BuildProcedurePDFTable(levels, fonts, cols, paddingBottom, lastLevel, doc); - } - } - //add from path - Phrase h = new Phrase(); - h.Font = fonts[4]; - h.Add(StripProcInfo(ti.PathFrom, procedureInfo)); - PdfPCell c = new PdfPCell(h); - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - 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); - //add from text - h = new Phrase(); - h.Font = fonts[4]; - ItemInfo myItemInfo = ti.MyContent.ContentItems[0]; - h.Add(GetTextPath(myItemInfo, 0)); - c = new PdfPCell(h); - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - 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); - //add to text - h = new Phrase(); - h.Font = fonts[4]; - myItemInfo = ti.MyItemToID; - h.Add(GetTextPath(myItemInfo, ti.Level)); - c = new PdfPCell(h); - c.HorizontalAlignment = Element.ALIGN_LEFT; - c.PaddingBottom = paddingBottom; - 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); - } - } - doc.Add(t); - } - - private string StripProcInfo(string pathfrom, ProcedureInfo procedureInfo) - { - if (pathfrom.StartsWith(procedureInfo.DisplayNumber)) - return pathfrom.Replace(string.Format("{0}, {1}", procedureInfo.DisplayNumber, procedureInfo.DisplayText), "").Trim(); - else - return pathfrom; - } - - private string GetTextPath(ItemInfo myItemInfo, int level) - { - StringBuilder sb = new StringBuilder(); - if (myItemInfo.IsProcedure) - return myItemInfo.MyProcedure.DisplayNumber + " " + myItemInfo.MyProcedure.DisplayText; - if (myItemInfo.IsSection) - { - if (level > 1) - return myItemInfo.MyProcedure.DisplayNumber + " " + myItemInfo.MyProcedure.DisplayText + "\r\n " + myItemInfo.DisplayText; - else - return myItemInfo.DisplayText; - } - if (myItemInfo.IsHigh) - return myItemInfo.ActiveSection.DisplayText + "\r\n " + myItemInfo.DisplayText; - else - { - string tmp = ""; - return GetTextPath(myItemInfo, sb, ref tmp); - } - } - - private string GetTextPath(ItemInfo myItemInfo, StringBuilder sb, ref string indent) - { - if (myItemInfo == null) - return sb.ToString(); - if (myItemInfo.IsHigh) - { - sb.Append(myItemInfo.DisplayText); - } - else - { - if (myItemInfo.ActiveParent != null) - { - GetTextPath(myItemInfo.ActiveParent as ItemInfo, sb, ref indent); - indent += " "; - sb.Append("\r\n" + indent + myItemInfo.DisplayText); - } - } - return sb.ToString(); - } - public void BuildTransitionReport(FolderInfo fi) - { - System.Windows.Forms.MessageBox.Show("folder"); - } - private bool CreateResultsPDF(iTextSharp.text.Document document) - { - bool result = false; - string suffix = ""; - int i = 0; - // just for safety, the while loop expects to find a file extension - // so make sure it has one before going into the loop - if (!_FileName.ToUpper().EndsWith(".PDF")) - _FileName += ".pdf"; - // Try to open a file for creating the PDF. - while (result == false) - { - 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("."); - if (loc > -1) - { - string fname = fileName.Substring(0, loc); - fileName = fname + suffix + ".pdf"; - } - else - fileName = fileName + suffix + ".pdf"; - // string fileName = _FileName.ToLower().Replace(".pdf", suffix + ".pdf"); - try - { - PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create)); - writer.PageEvent = new MyPageEvent(this); - document.SetMargins(36, 36, 36, 36); - document.Open(); - cb = writer.DirectContent; - _FileName = fileName; - result = true; - } - catch (System.IO.IOException exIO) - { - - if (exIO.Message.Contains("because it is being used by another process")) - suffix = string.Format("_{0}", ++i);// If this file is in use, increment the suffix and try again - else // If some other error, display a message and don't print the results - { - ShowException(exIO); - return false; - } - } - catch (Exception ex) - { - ShowException(ex); - return false; // Could not open the output file - } - } - return true; - } - private static void ShowException(Exception ex) - { - Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); - StringBuilder msg = new StringBuilder(); - string sep = ""; - string indent = ""; - while (ex != null) - { - msg.Append(string.Format("{0}{1}{2}:\r\n{1}{3}", sep, indent, ex.GetType().Name, ex.Message)); - ex = ex.InnerException; - sep = "\r\n"; - indent += " "; - } - 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) - { - Phrase h = new Phrase(); - h.Font = f; - h.Add(txt); - PdfPCell c = new PdfPCell(h); - c.HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT; - c.Colspan = colspan; - c.BackgroundColor = clr; - return c; - } - } - public class MyPageEvent : PdfPageEventHelper - { - private PDFTransitionReport _rpt = null; - public MyPageEvent(PDFTransitionReport rpt) - { - _rpt = rpt; - } - public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document) - { - base.OnEndPage(writer, document); - _rpt.CurrentPageNumber = writer.PageNumber + 1; - } - } -} diff --git a/PROMS/Volian.Print.Library/PageCount.cs b/PROMS/Volian.Print.Library/PageCount.cs deleted file mode 100644 index 884d6f33..00000000 --- a/PROMS/Volian.Print.Library/PageCount.cs +++ /dev/null @@ -1,187 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text; -using iTextSharp.text.pdf; -using Volian.Svg.Library; - -namespace Volian.Print.Library -{ - public class PageCount - { - private bool _CanIncrement = true; - public bool CanIncrement - { - get { return _CanIncrement; } - set { _CanIncrement = value; } - } - private int Increment() - { - if (CanIncrement) Total++; - CanIncrement = false; - return Total; - } - private int _Total; - public int Total - { - get { return _Total; } - set { _Total = value; } - } - private string _FinalPageMessage; - - public string FinalPageMessage - { - get { return _FinalPageMessage; } - set { _FinalPageMessage = value; } - } - private PageCountTemplates _MyTemplates; // (for each page that has this key) - internal PageCountTemplates MyTemplates - { - get - { - if (_MyTemplates == null) _MyTemplates = new PageCountTemplates(); - return _MyTemplates; - } - set - { - _MyTemplates = value; - } - } - public void DrawTemplates() - { - int cnt = 0; - foreach (PageCountTemplate pct in MyTemplates) - { - cnt++; - string fstr = pct.Text.Replace("{OF}", _Total.ToString()); - if (pct.Text.Contains("{TOCPAGE}")) - { - fstr = pct.Text.Replace("{TOCPAGE}", _Total.ToString()); - } - if (fstr.Contains("{FINALPAGE}")) - { - fstr = fstr.Replace("{FINALPAGE}", (cnt == MyTemplates.Count) ? FinalPageMessage : ""); - } - // use font from pct - string fontFace = pct.MyFont.Name; - int fontStyle = (pct.MyFont.Bold ? iTextSharp.text.Font.BOLD : 0) + (pct.MyFont.Italic ? iTextSharp.text.Font.ITALIC : 0); - Font itextFont = Volian.Svg.Library.Svg.GetFont(fontFace, pct.MyFont.Size, fontStyle, pct.MyColor); - ColumnText columnText = new ColumnText(pct.MyTemplate); - float textSize = itextFont.BaseFont.GetWidthPoint(fstr, pct.MyFont.Size); - float flly = itextFont.BaseFont.GetDescentPoint("g", pct.MyFont.Size); - float lead = columnText.Leading; - columnText.Alignment = pct.Alignment; - Chunk chk = new Chunk(fstr, itextFont); - float width = chk.GetWidthPoint(); - // justification: - float left = 0; - float right = width * 1.01F; - switch (pct.Alignment) - { - case Element.ALIGN_CENTER: - left = -.5F * width; - right = .51F * width; - break; - case Element.ALIGN_RIGHT: - left = -1.01F * width; - right = 0; - break; - } - pct.MyTemplate.BoundingBox = new Rectangle(left, 2 * flly, right, columnText.Leading); //2*flly account for descenders - columnText.SetSimpleColumn(left, 0, right, columnText.Leading); - columnText.SetText(new Phrase(chk)); - columnText.Go(); - } - } - public PdfTemplate AddToTemplateList(PdfWriter pdfWriter, string text, System.Drawing.Font myFont, int alignment, System.Drawing.Color color) - { - Increment(); - PageCountTemplate retTemplate = new PageCountTemplate(pdfWriter, text.Replace("{PAGE}",Total.ToString()), myFont, alignment, color); - MyTemplates.Add(retTemplate); - - return retTemplate.MyTemplate; - } - } - public class PageCounts : Dictionary - { - public bool CanIncrement - { - set - { - foreach (PageCount pc in this.Values) - { - pc.CanIncrement = value; - } - } - } - public PdfTemplate AddToTemplateList(string key, PdfWriter pdfWriter, string text, System.Drawing.Font myFont, int alignment, System.Drawing.Color color) - { - if (!this.ContainsKey(key)) - { - this.Add(key, new PageCount()); - if (key.StartsWith("TOC")) this[key].CanIncrement = false; - } - return (this[key].AddToTemplateList(pdfWriter, text, myFont, alignment,color)); - } - public PdfTemplate AddToTemplateList(string key, PdfWriter pdfWriter, string text, string finalPageMessage, System.Drawing.Font myFont, int alignment, System.Drawing.Color color) - { - if (!this.ContainsKey(key)) this.Add(key, new PageCount()); - this[key].FinalPageMessage = finalPageMessage; - return (this[key].AddToTemplateList(pdfWriter, text, myFont, alignment, color)); - } - public void DrawTemplates() - { - foreach (PageCount pc in this.Values) - { - pc.DrawTemplates(); - } - } - } - - public class PageCountTemplate - { - private string _Text; - public string Text // "Page 1 of {OF}" - { - get { return _Text; } - set { _Text = value; } - } - private System.Drawing.Font _MyFont; - public System.Drawing.Font MyFont - { - get { return _MyFont; } - set { _MyFont = value; } - } - private int _Alignment; // iTextSharp Element. - 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) - { - // 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. - _MyTemplate = pdfWriter.DirectContent.CreateTemplate(1, 1); - _Text = text; - _MyFont = myFont; - _MyColor = color; - _Alignment = alignment; - } - } - public class PageCountTemplates : List - { - } -} diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs deleted file mode 100644 index 3460f87c..00000000 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ /dev/null @@ -1,2009 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; -using iTextSharp.text.pdf; -using Volian.Svg.Library; - -namespace Volian.Print.Library -{ - public partial class vlnParagraph - { - private string _PageBreakReason = null; - public string PageBreakReason - { - get { return _PageBreakReason; } - 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; } - } - /// - /// This variable is used to match 16 bit pagination - /// - private bool _Match16BitPagination = false; - private bool _CompressFoldout = false; - public bool CompressFoldout - { - get { return _CompressFoldout; } - set { _CompressFoldout = value; } - } - /// - /// Dtermines if the current step is preceded by a Page Break - /// - /// - /// - /// - /// - /// 0 - No page break - /// 1 - Break on High Level Step - /// 2 - Break within a Step - /// 3 - Break on High Level Step (SevenLinesPerInch) - /// - private int Paginate(float yLocation, float yTopMargin, float yBottomMargin) - { - // Check if paginate on a separate section, if within a section. Top level section pagination happens in PromsPrinter - float yPageSize = yTopMargin - yBottomMargin; - bool ManualPageBreak = false; - float yWithinMargins = CalculateYLocation(yLocation, yTopMargin) - yBottomMargin; // -SixLinesPerInch; - if (MyItemInfo.IsSection && MyParent != null && MyParent.MyItemInfo.IsSection && (MyItemInfo as SectionInfo).IsSeparatePagination()) - { - ShowPageBreak(1, "Page Break between separate sections", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - - // if parent was continuous & this is separate, need to paginate to get subsection on - // its own page. This occurred in BGE/OI3 set/OI-7 procedure/10.0 Attachments. - if (!(MyParent.MyItemInfo as SectionInfo).IsSeparatePagination()) return 1; - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.WCNTraining && (MyItemInfo as SectionInfo).IsSeparatePagination()) return 1; - // B2017-273 added a check for Farley format, we don't want the subsection pagelist infor to appear on the parent section page - works with ToPDF() logic - (section has steps and a sub-section ex: FNP-2-EEP-0 Attachment 4) - if (MyItemInfo.ActiveFormat.Name.ToUpper().StartsWith("FNP") && (MyItemInfo as SectionInfo).IsSeparatePagination()) return 1; - if (MyItemInfo.MyPrevious != null) // add if statement to fix Westinghouse print issue 3-21-2014 - return 1; - } - if (MyItemInfo.IsSection && _ChildrenBelow == null && YSize > (yLocation-yBottomMargin)) - { - ShowPageBreak(1, "Page Break before empty section", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 1; - } - // If printing a supinfo pdf, see if there is a page break at this supinfo paragraph, i.e. an entry will - // exist in the list that contains the supinfo paragraph pagebreaks that was generated in the first pagebreak pass - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.SupInfoPdfPrint) - { - int retval = 0; - SectionInfo supInfoSect = MyItemInfo.ActiveSection as SectionInfo; // C2018-003 fixed use of getting the active section - if (supInfoSect != null && supInfoSect.StepSectPageBreaksForSupInfo != null && supInfoSect.StepSectPageBreaksForSupInfo.Contains(MyItemInfo.ItemID)) - { - MyPromsPrinter.SupInfoPdfPageCount++; - retval = 1; - } - // Printing the supplemental information pages to a pdf: add an item to the dictionary that says what page in the supinfo pdf - // this item can be found on. - if (MyItemInfo.IsSupInfoPart) - { - MyPromsPrinter.SupInfoPdfPage.Add(MyItemInfo.ItemID, MyPromsPrinter.SupInfoPdfPageCount); - } - return retval; - } - // C2023-015: Pagination on a sub-step added. Do the code if supplemental info or if format supports sub-step pagination - // C2023-018: Pagination on sub-step (changed from C2023-015), do this code if on a step... will check for config flags in this code - else if (MyItemInfo.IsStep) - { - // C2023-018: only do the following if in supplemental info, doing checks on cautions/notes off substep - // if this is the first caution or note from a substep, if the substep has preferred page break, break at the first caution or note: - if ((MyItemInfo.MyDocStyle.SupplementalInformation && (MyItemInfo.IsCaution || MyItemInfo.IsNote) && MyItemInfo.MyParent.IsSubStep)) - { - StepConfig scs = MyItemInfo.MyParent.MyConfig as StepConfig; - // C2023-015: Pagination on a sub-step added on this check, C2023-018: removed substep check since this cannot occur - if (MyItemInfo.MyPrevious == null && scs.Step_PreferredPagebreak) - { - // B2018-103: 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. - if (MyPageHelper.ParaBreaks != null && MyPageHelper.ParaBreaks.Count > 0 && this == MyPageHelper.ParaBreaks[0]) - { - MyPageHelper.ParaBreaks.RemoveAt(0); - string reason1 = AddReason("Partial Step - Case 5"); - ShowPageBreak(1, reason1, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - } - return 2; - } - } - // Now see if there is a preferred page break on this step. - // C2023-018: Added check for sub-step - StepConfig sci = MyItemInfo.MyConfig as StepConfig; - if (sci.Step_PreferredPagebreak || sci.Step_SubStepPagebreak) - { - // C2023-018: if removing manual page breaks - add to list for permanent removal if selected and do not put a page break - // on the sub-step (do not execute the 'else' code) - if (sci.Step_SubStepPagebreak && MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null && - !MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(MyItemInfo.ItemID)) - MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(MyItemInfo.ItemID); - else - { - if (MyItemInfo.IsHigh) return 1; - // if this is the top caution/note return 1 also. Cautions always are first, that is why the check does not need to know if on a - // caution that there are notes, but check does need if on a note, are there cautions: - if (MyItemInfo.MyParent.IsHigh && MyItemInfo.IsCaution && 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 (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]) - { - MyPageHelper.ParaBreaks.RemoveAt(0); - reason = AddReason("Partial Step - Case 1"); - ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - } - return 2; - } - } - } - // 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. - //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 - bool _skipEndMessage = si != null && si.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.EndForSingle; - - // TODO: This does not account for a long step as the last step that would exceed more than one page and - // that has an end message that needs to be accounted for in determining pagination. To do that the last - // child should be the only paragraph that accounts for the End message. - // - // If last step & there should be an end message, pagination tests need to account for the 3 lines the end - // message uses. The 3 is for a line above, the end message line & the line below (in case there is a border/box line). - - // The 3 was changed to 2 for the end line & the line below. The blank line below the step gives the blank - // 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. - //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 - - // 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 - // horizonal line above the phone list. - // B2018-079 - we don't need the phone list length in this case only the length of the end message because the phone list is printed below the footer but the end message is shifted up. - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.PrintPhoneList && MyPageHelper.PhoneListHeight != 0) - yEndMsg += GetBottomContinueMessageSize(MyItemInfo.MyDocStyle);//(MyPageHelper.PhoneListHeight - vlnPrintObject.SixLinesPerInch); - - // The following code is to fix a pagination issue in SHE. It was decided to not put it into development - // because some of the pagination logic may be redesigned. Without this fix, some pages had a page break - // before they should. I did not want to lose this code, in case at some point we want to revisit this. - // if doing an end message & we already are ending with a blank line, add one line for the end message - // otherwise, we need to add two lines, i.e. ((2 * SixLinesPerInch) - yEndsWithBlankLine) - // this change was necessary to fix a pagination problem in Shearon Harris, EOPs, User Guide, Attachment 2. - //float yEndsWithBlankLine = AdjustForBlankLines(); - //KBR debug: if (yEndsWithBlankLine != 0) Console.WriteLine("*** yEndsWithBlankLine = {0}", yEndsWithBlankLine); - //float yEndMsg = !MyItemInfo.IsSection && MyItemInfo.MyHLS.NextItem == null && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? ((2 * SixLinesPerInch) - yEndsWithBlankLine) : 0; - - bool isFirstChild = MyItemInfo.MyPrevious == null; - bool nearTheTop = (yWithinMargins < yPageSize) && (yWithinMargins > (yPageSize - 5 * SixLinesPerInch)); - // if step is breaking over a number of pages, determine if the current step is the - // location of a pagebreak. ParaBreaks contains the paragraphs that break within a step. - if (MyPageHelper.ParaBreaks.Count > 0) - { - string reason = "Unknown"; - // 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]) - { - MyPageHelper.ParaBreaks.RemoveAt(0); - reason = AddReason("Partial Step - Case 1"); - ShowPageBreak(1,reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 2; // break on this item within a step - } - // check for rnos: - else if (MyPageHelper.ParaBreaks[0].CheckAlternates(this)) - { - MyPageHelper.ParaBreaks.RemoveAt(0); - reason = AddReason("Partial Step - Case 2"); - ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 2; // break on this item within a step - } - /////////////////// - // The following else ifs are reached if something previously went wrong in pagination & this code tries to account for it. - /////////////////// - // PageBreakOnStep flags break for cautions/notes/HLS in backgrounds & deviations. Don't check for that case. - // If you are in this code debugging, consider looking at ToPdf to see why the 'pagebreak above' (MyPageHelper.ParaBreaks[0]) - // the current step (this) has not caused a page break in the pdf prior to reaching this code. (RHM & KBR) - else if (!MyPageHelper.ParaBreaks[0].PageBreakOnStep && this.YTopMost > MyPageHelper.ParaBreaks[0].YTopMost) // current step is further down on page than MyPageHelper.ParaBreaks[0] - { - MyPageHelper.ParaBreaks.RemoveAt(0); - reason = AddReason("Partial Step - Case 3"); - ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 2; // break on this item within a step - } - // B2018-015 Pagination Issue VCS EOP-15.0 Step 15 - Handle when RNO is exactly aligned with the AER column - // 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)) - { - //vlnParagraph removed = MyPageHelper.ParaBreaks[0];// 2018-081 Remember where the page break was going to be - 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"); - ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 2; // break on this item within a step - } - return 0; // this is not an item with a break - } - float mySize = YSize * MyPageHelper.YMultiplier; - vlnParagraph firstChild = ChildrenBelow.Count > 0 ? ChildrenBelow[0] : null; - // Steps that have the smart template (the WCNCKL format for example), always include two children. - if (MyItemInfo.IsHigh && MyItemInfo.FormatStepData.UseSmartTemplate) // - { - if (ChildrenBelow.Count > 1) - firstChild = ChildrenBelow[1]; - } - else if (!MyItemInfo.IsSection && firstChild != null && firstChild.MyItemInfo != null && !firstChild.MyItemInfo.IsNumbered) // If not numbered get the last child - firstChild = firstChild.MyParent.ChildrenBelow[firstChild.MyParent.ChildrenBelow.Count - 1]; - float ySizeIncludingFirst = firstChild == null ? YSize : firstChild.YSize + (firstChild.YTopMost - YTopMost); - bool KeepStepsOnPage = MyItemInfo.ActiveFormat.MyStepSectionLayoutData.KeepStepsOnPage; - if (MyItemInfo.IsStepSection) - { - if (yLocation < yTopMargin) // continuous section - { - if (ChildrenBelow == null || ChildrenBelow.Count == 0) - { - // see if there is an end message. This is stored in the helper - if there is, - // we need to be sure that there is room for it. - if (MyPageHelper.BottomMessage != null && MyPageHelper.BottomMessage.Count != 0) - { - if (mySize + yEndMsg <= yWithinMargins) return 1; - } - return 0; - } - - // This is a continuous section. There may be cases where the user put a manual page - // break on the first step (child) in the section. if so, break on the section. The - // flag SectionPageBreak is set to true to flag that a pagebreak should not be done - // on that first step. - StepConfig sc = firstChild.MyItemInfo.MyConfig as StepConfig; - ManualPageBreak = MyPageHelper.OriginalPageBreak ? (sc == null ? false : sc.Step_ManualPagebreak) : - sc == null ? false : - (MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks == null)? sc.Step_NewManualPagebreak : false; - // C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. - if (sc != null && sc.Step_NewManualPagebreak && MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null && - !MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(firstChild.MyItemInfo.ItemID)) MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(firstChild.MyItemInfo.ItemID); - if (ManualPageBreak) - { - SectionPageBreak = true; - ShowPageBreak(2, "Section Page Break", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 1; - } - // can the title and the first step fit? - // 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; - //while (firstStepChild.MyItemInfo.IsSection && firstStepChild.ChildrenBelow.Count > 0) firstStepChild = firstStepChild.ChildrenBelow[0]; - if (firstStepChild.MyItemInfo.IsNumbered) - while (firstStepChild.ChildrenBelow.Count > 0 && (firstStepChild.MyItemInfo.IsSection || firstStepChild.MyItemInfo.IsHigh)) - { - firstStepChild = firstStepChild.ChildrenBelow[0]; - if (!firstStepChild.MyItemInfo.IsNumbered) - { - firstStepChild = firstStepChild.MyParent.ChildrenBelow[firstStepChild.MyParent.ChildrenBelow.Count - 1]; - break; - } - } - else - firstStepChild = firstStepChild.MyParent.ChildrenBelow[firstStepChild.MyParent.ChildrenBelow.Count - 1]; - float ySizeIncludingFirstStep = firstStepChild.YSize + (firstStepChild.YTopMost - YTopMost); - float ySizeBtmCtnMess = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle); - float ySizeBtmEndMess = GetBottomEndMessageSize(MyItemInfo.MyDocStyle); - bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > (yWithinMargins - ySizeBtmCtnMess -ySizeBtmEndMess); - if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstChild) - 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(MyItemInfo.MyDocStyle) : 0; // B2018-068 account for mult-line End Messages - if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) - { - float vpHeight = SixLinesPerInch; - foreach (vlnParagraph vp in MyPageHelper.NotesToFootNotes) vpHeight += vp.Height; - ySectionEndMsg += vpHeight; - } - if (ySizeIncludingFirstStep < yWithinMargins && ySizeIncludingFirst > yWithinMargins && yWithinMargins > (yPageSize / 2)) - ySizeIncludingFirst = ySizeIncludingFirstStep; - if (!KeepStepsOnPage && (ySizeIncludingFirst + ySectionEndMsg) > - (yLocation - (MyItemInfo.MyDocStyle.Layout.FooterLength + yBottomMargin)) && !nearTheTop) - { - if (!MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert || - (ySizeIncludingFirst < yPageSize || yWithinMargins < (yPageSize - (2 * 72)))) - { - // .oooooo. . o8o .oooooo..o . o8o - // d8P' `Y8b .o8 `"' d8P' `Y8 .o8 `"' - // 888 .ooooo. ooo. .oo. .o888oo oooo ooo. .oo. oooo oooo .ooooo. oooo oooo .oooo.o Y88bo. .ooooo. .ooooo. .o888oo oooo .ooooo. ooo. .oo. .oooo.o - // 888 d88' `88b `888P"Y88b 888 `888 `888P"Y88b `888 `888 d88' `88b `888 `888 d88( "8 `"Y8888o. d88' `88b d88' `"Y8 888 `888 d88' `88b `888P"Y88b d88( "8 - // 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 `"Y88b. `"Y88b 888ooo888 888 888 888 888 888 888 888 `"Y88b. - // `88b ooo 888 888 888 888 888 . 888 888 888 888 888 888 888 888 888 o. )88b oo .d8P 888 .o 888 .o8 888 . 888 888 888 888 888 o. )88b - // `Y8bood8P' `Y8bod8P' o888o o888o "888" o888o o888o o888o `V88V"V8P' `Y8bod8P' `V88V"V8P' 8""888P' 8""88888P' `Y8bod8P' `Y8bod8P' "888" o888o `Y8bod8P' o888o o888o 8""888P' - ShowPageBreak(4, "Page Break Before Continuous Step Section", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 1; - } - } - if (ChildrenBelow.Count > 0) - { - vlnParagraph firstHLS = ChildrenBelow[0]; - if (firstHLS.MyItemInfo.IsHigh) - firstHLS.BreakHighLevelStepWithSection = true; - } - } - // Compress Foldout - // - // .oooooo. oooooooooooo oooo .o8 . - // d8P' `Y8b `888' `8 `888 "888 .o8 - // 888 .ooooo. ooo. .oo. .oo. oo.ooooo. oooo d8b .ooooo. .oooo.o .oooo.o 888 .ooooo. 888 .oooo888 .ooooo. oooo oooo .o888oo - // 888 d88' `88b `888P"Y88bP"Y88b 888' `88b `888""8P d88' `88b d88( "8 d88( "8 888oooo8 d88' `88b 888 d88' `888 d88' `88b `888 `888 888 - // 888 888 888 888 888 888 888 888 888 888ooo888 `"Y88b. `"Y88b. 888 " 888 888 888 888 888 888 888 888 888 888 - // `88b ooo 888 888 888 888 888 888 888 888 888 .o o. )88b o. )88b 888 888 888 888 888 888 888 888 888 888 888 . - // `Y8bood8P' `Y8bod8P' o888o o888o o888o 888bod8P' d888b `Y8bod8P' 8""888P' 8""888P' o888o `Y8bod8P' o888o `Y8bod88P" `Y8bod8P' `V88V"V8P' "888" - // 888 - // o888o - // This is a foldout pages - // The format supports compression - // The contents exceeds the length of the page - // The Contents fit at seven lines per inch - //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box - if ((MyItemInfo.MyActiveSection.MyConfig as SectionConfig).Section_IsFoldout == "Y" - && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps - && mySize > yPageSize - && mySize <= yPageSize * SixLinesPerInch / _SevenLinesPerInch) - CompressFoldout = true; - return 0; // Don't Paginate (page break) on a Step Section if it's first thing on page - } - if (!MyItemInfo.IsHigh) return 0; // Don't Paginate on a Substep level - bool doSectionTitleContinued = false; - if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) - { - float vpHeight = SixLinesPerInch; - foreach (vlnParagraph vp in MyPageHelper.NotesToFootNotes) vpHeight += vp.Height; - yEndMsg += vpHeight; - } - if (MyItemInfo.MyPrevious != null && !MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader) - { - SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; - } - // Document style: DSS_PageBreakHLS breaks on hls. - if (MyItemInfo.IsHigh && (MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageBreakHLS) == E_DocStructStyle.DSS_PageBreakHLS) - { - BuildPageBreakList(yPageSize, yPageSize, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); - ShowPageBreak(1, "Page Break on DSS_PageBreakHLS", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 1; - } - // if this is a step, see if it has the 'PageBreakOnStep' format flag set to true, if so, break here. - if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.PageBreakOnStep) - { - // if this step contains Cautions or Notes page breaks have to be added for those. - if (TopMostChild != this) PageBreakOnStep = true; - - BuildPageBreakList(yPageSize, yPageSize, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); // Case 1 :Works for ES05 Step 15 SubStep 7 - ShowPageBreak(1, "Page Break on Steps, Cautions or Notes", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 1; - } - - //MyPageHelper.HLSText = MyItemInfo.DisplayText; // save the High Level Step Text - //Console.WriteLine("{0} Paginate", MyPageHelper.HLSText); - StepConfig sc1 = MyItemInfo.MyConfig as StepConfig; - ManualPageBreak = MyPageHelper.OriginalPageBreak ? (sc1 == null ? false : sc1.Step_ManualPagebreak) : - sc1 == null ? false : (MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks == null) ? sc1.Step_NewManualPagebreak : false; - // C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. - if (sc1 != null && sc1.Step_NewManualPagebreak && - MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null && !MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(MyItemInfo.ItemID)) MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(MyItemInfo.ItemID); - - if (MyItemInfo.FirstSibling == MyItemInfo && ManualPageBreak) - { - // if parent/section used this pagebreak, skip it. - if (MyParent.SectionPageBreak) - { - ManualPageBreak = false; - MyParent.SectionPageBreak = false; - } - } - if (_Match16BitPagination) mySize = YSize; - string firstStep = "No"; - if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null) - firstStep = "Yes"; - //if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins) // Don't Paginate if there is enough room, will fit on page - // Pagination Fix - Break1LineShort1 - float yExtra = (yWithinMargins == yPageSize ? 0 : SixLinesPerInch - MyItemInfo.MyDocStyle.Layout.FooterLength) ?? 0; - // Adjust yExtra and mySize for Component List items. - if (MyItemInfo.ActiveSection.MyDocStyle.ComponentList && yExtra > 0) - { - yExtra = 0; - if (mySize < Height) mySize = Height * MyPageHelper.YMultiplier; - } - float yExtra2 = (SixLinesPerInch - MyItemInfo.MyDocStyle.Layout.FooterLength) ?? 0; - // B2023-116: Vogtle alarm pagination - sub-steps are separating from their HLS even if there is room for some (not all). If using the AlarmPagination - // flag AND this is a high level flag do not set the 'KeepStepsOnPage' to false, this allows the logic to check where pagination should occur for sub-steps - bool alarmPageKeepHighWithSubs = MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AlarmPagination && MyItemInfo.IsHigh; - if (KeepStepsOnPage && !alarmPageKeepHighWithSubs && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnLowerStepLevel && ySizeIncludingFirst > yWithinMargins) - KeepStepsOnPage = false; - // B2020-123: Missing section continue message - // B2020-158 Calvert Approved Unit1 EOP-8/Appendix(1)/subsection RIC-2/Step A was printing by itself on bottom of page - if (MyParent.CalvertPrintedSubSectTitle && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertPagination) nearTheTop = true; - bool KeepWithHeader = isFirstChild && nearTheTop; - if (BreakHighLevelStepWithSection) KeepWithHeader = true; - // for a HLS that has an asterisk box with the rno separator IN the box, adjust the size by 2 lines to account for box. - if (MyItemInfo.IsStep && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex != null && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex >= 0 && - (MyItemInfo.RNOs==null ||MyItemInfo.RNOs.Count==0)) - mySize += (2*SixLinesPerInch); - // mySize is the size of this step and includes an extra blank line. For HLS, if this is the last step in section & there is room in footer to keep - // step on the page, do so by eliminating the blank line before doing the test to see if it fits. - // 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)) - 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. - { - adjMsgY = (float)-MyItemInfo.MyDocStyle.End.Flag * SixLinesPerInch; - 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) - // Beaver Valley as two sub-sections that are printed continuously followed by a third sub-section printed separate. - // without this logic, the first step is printed at the same y-location as if it was on the previous page - bool sepPaginationForSubSection = false; - // B2023-033: don't do the sub-section check that was done for Beaver Valley (F2023-015) for Calvert - // B2023-034 The fix for B2023-033 didn't fix a Calvert sub-section that uses their Valve List. - // Added a format file for use in Beaver Valley AOP format, since this logic was put in for them. - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.UseOnFirstForSeparatePaginationOnSubSect) - { - if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null && MyItemInfo.MyActiveSection.IsSubsection) - { - if ((MyItemInfo.MyActiveSection.MyConfig as SectionConfig).Section_Pagination == SectionConfig.SectionPagination.Separate) - sepPaginationForSubSection = true; - } - } - if (!ManualPageBreak && ((mySize + yEndMsg <= yWithinMargins + yExtra) || // Don't Paginate if there is enough room, will fit on page - (mySize <= yWithinMargins + yExtra && SpecialCaseForRobinson())) && !sepPaginationForSubSection) - //if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins + SixLinesPerInch) // Don't Paginate if there is enough room, will fit on page - { - // ooooo ooooo ooooo .oooooo..o o8o oooo oooo .o88o. o8o . - // `888' `888' `888' d8P' `Y8 `"' `888 `888 888 `" `"' .o8 - // 888 888 888 Y88bo. oooo oooo ooo oooo 888 888 o888oo oooo .o888oo - // 888ooooo888 888 `"Y8888o. `88. `88. .8' `888 888 888 888 `888 888 - // 888 888 888 `"Y88b `88..]88..8' 888 888 888 888 888 888 - // 888 888 888 o oo .d8P `888'`888' 888 888 888 888 888 888 . - // o888o o888o o888ooooood8 8""88888P' `8' `8' o888o o888o o888o o888o o888o "888" - //Console.WriteLine("'PageBreak',1,'No','HLS will fit on page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath); - ShowPageBreak(-1, "HLS will fit on page", firstStep, YSize, yPageSize, yWithinMargins,ManualPageBreak); - 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 - SixLinesPerInch: - // yPageSizeNextPage is the page size of the 'next' page. A format variable exists off of the docstyle - // For UseOnFirstPage vs UseOnAllButFirstPage. If this is set for this format, and processing the FIRST - // page, the size of next page, which may be different, is used in pagination calculationstop. - // If this format flag is not set, or not printing the first page of the section with this flag, - // this next page size is the same as current page size. - float yPageSizeNextPage = yPageSize; - mySize = YSize; // reset in case mySize changed for current page is compressed - // for a HLS that has an asterisk box with the rno separator IN the box, adjust the size by 2 lines to account for box. - if (MyItemInfo.IsStep && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex != null && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex >= 0 && - (MyItemInfo.RNOs == null || MyItemInfo.RNOs.Count == 0)) - 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 - yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage(); - - if (KeepStepsOnPage - && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnLowerStepLevel - && YSize == ySizeIncludingFirst - && YSize + yEndMsg > yWithinMargins) - { - // If the first step is the size of the entire step and the step has an end message then don't try to break the step - KeepStepsOnPage = false; - //_MyLog.WarnFormat("Kick Step to Next Page {0},{1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); - } - if (yWithinMargins < SixLinesPerInch) KeepStepsOnPage = false; // if there is no room to print, don't keep steps on the page - // The following was added for IP2 background printing. There were situations where there was a HLS and its paragraph was - // put on next page (IP2 bck: E-3/References), and a paragraph was writing into the footer (FR-H.1 step 2.2.3.1. KBR 10/14/14) - if (KeepStepsOnPage - && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnLowerStepLevel - && YSize == ySizeIncludingFirst - && ((ChildrenBelow.Count >= 1 && ChildrenBelow[0].MyItemInfo.IsParagraph && ChildrenBelow[0].ChildrenBelow.Count == 0) - || ChildrenBelow.Count == 0)) - { - KeepStepsOnPage = false; - } - - // Keep figure (the only figure, i.e. count==1) with its parent. - if (ChildrenBelow.Count == 1 && ChildrenBelow[0].MyItemInfo.IsFigure) KeepStepsOnPage = false; - float sectionSpace = 0; - if (doSectionTitleContinued) - { - if (SectionShowTitles) - { - vlnParagraph paraSect = MyParent; - while (!paraSect.MyItemInfo.IsSection) paraSect = paraSect.MyParent; - if (paraSect.ContinueHeight > 24) - sectionSpace = paraSect.ContinueHeight; - else - sectionSpace = 2 * SixLinesPerInch; - // sectionSpace = 3 * SixLinesPerInch;// 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 - //if (MyItemInfo.ActiveSection.DisplayText.Length < 40) sectionSpace = SixLinesPerInch; - yPageSizeNextPage -= 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 - //if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && yPageSizeNextPage < yWithinMargins + 3 * 72 && MyItemInfo.MyPrevious == null) - // KeepStepsOnPage = true; - float mySize7LPI = mySize; // +SixLinesPerInch; - if (_Match16BitPagination) mySize7LPI += SixLinesPerInch; - float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch - float ySizeBtmCtnMess1 = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle); - float ySizeBtmEndMess1 = GetBottomEndMessageSize(MyItemInfo.MyDocStyle); - // 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. - { - vlnParagraph orphan = ChildrenBelow[1];// Verify that the orphan has no children - if (orphan.ChildrenBelow.Count == 0 && orphan.ChildrenAbove.Count == 0 && orphan.ChildrenLeft.Count == 0 && orphan.ChildrenRight.Count == 0) - { - //_MyLog.WarnFormat("Orphan Found {0},{1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); - KeepStepsOnPage = false; - } - } - if (KeepStepsOnPage && ySizeIncludingFirst > (yWithinMargins - ySizeBtmCtnMess1 - ySizeBtmEndMess1)) - { - // B2023-116: Vogtle alarm pagination - sub-steps are separating from their HLS even if there is room for some (not all). - // See comment above for setting of 'alarmPageKeepHighWithSubs'. - if (alarmPageKeepHighWithSubs) - { - // F2024-006: Vogtle Alarms pagination - compare the size of the step and its first sub-step with what we think we have left on the - // page. if not enough room with a continue message then set KeepStepsOnPage to start this step on its own page. - // This solved an issue where the last line of step text was printing on top of the bottom continue message - float myFirstPieceSize = GetFirstPieceSize(true); - if (myFirstPieceSize > yWithinMargins) - KeepStepsOnPage = false; - } - else - KeepStepsOnPage = false; - } - if (!KeepWithHeader && !KeepStepsOnPage && mySize - SixLinesPerInch + yEndMsg - tableSpaceAvailable <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break - { - // Don't want extra line before step - //Console.WriteLine("'PageBreak',2,'Yes','HLS will fit on 1 Page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath); - // A page break will occur before the step is put out. ShowPageBreak with first argument of -1 is NOT a page break. - // .ooo ooooo ooooooooo. ooooo - // .88' `888' `888 `Y88. `888' - // d88' 888 888 .d88' 888 - // d888P"Ybo. 888 888ooo88P' 888 - // Y88[ ]88 888 888 888 - // `Y88 88P 888 o 888 888 - // `88bod8' o888ooooood8 o888o o888o - ShowPageBreak(5, "HLS will fit on 1 Page at 6 LPI", "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); - return 1; - } - // TODO - yEndMsg - compressed size? - - // 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 - //&& (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 - // 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 - // jsj 5-17-2016 B2015-090 - Turns out that Wolf Creek needs this logic to properly print - // the Purpose, Symptoms or Entry Conditions, and References and Commitments sections which are set to print continuous. - // Without this logic, the first step of section 2.0 print on top of the section text in OFN BB-007 - && (mySize7LPI - SixLinesPerInch + yEndMsg - tableSpaceAvailable) < ((MyItemInfo.MyPrevious == null ? yWithinMargins : yPageSizeNextPage) * SixLinesPerInch / _SevenLinesPerInch))// RHM20150525 - Table Scrunch - { - // ooooooooo ooooo ooooooooo. ooooo - // d"""""""8' `888' `888 `Y88. `888' - // .8' 888 888 .d88' 888 - // .8' 888 888ooo88P' 888 - // .8' 888 888 888 - // .8' 888 o 888 888 - // .8' o888ooooood8 o888o o888o - //Console.WriteLine("'PageBreak',3,'Yes','HLS will fit on 1 Page at 7 LPI',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath); - ShowPageBreak(7, "HLS will fit on 1 Page at 7 LPI", "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); - //Console.WriteLine("'7LPI',{0},{1}", MyItemInfo.DBSequence, YSize); - return 3; // High Level Step can fit at SevenLinesPerInch - } - else // The entire step cannot fit on a blank page or KeepStepsOnPage is true. - { - // if there is more than half a page left, then start to print on the current page - float myFirstPieceSize = GetFirstPieceSize(); //Case 0 - 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. - //float myFirstPieceSize = GetFirstPieceSize() + 2 * SixLinesPerInch; //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): - // 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 - // 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 - if ((KeepWithHeader || (!ManualPageBreak && ((MyItemInfo.ActiveFormat.MyStepSectionLayoutData.SpecialPageBreakFlag && yWithinMargins > yPageSize / 2 && - myFirstPieceSize < yWithinMargins) || KeepStepsOnPage)))) - { - //Console.WriteLine("'PageBreak',4,'No','HLS will have to split anyway',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath); - // yPageSize is space on next page. This may be different if the format flag 'UseOnAllButFirst' is - // set. - // yWithinMargins is space available on current page. - // if the HLS is part of a Smart Template (i.e. WCNCKL table), don't add in an extra line because - // that makes pagination work incorrectly because the Smart Template has a 'table' line after the - // text. - float ySpaceOnFirstPage = yWithinMargins + (MyItemInfo.FormatStepData.UseSmartTemplate ? 0 : SixLinesPerInch); - if (firstStep == "Yes") - //{ - ySpaceOnFirstPage = yWithinMargins; // Accounts for Section Title Line - //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 - // 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 - // not working because onnewpage was always false in the next BuildPageBreakList call. onnewpage is used to determine compression - // (has to be on a new page to compress page). Use calculated value rather than always false in this case. - bool onnewpage = MyItemInfo.MyPrevious == null && (MyItemInfo.MyActiveSection as SectionInfo) != null - && (MyItemInfo.MyActiveSection as SectionInfo).IsSeparatePagination(); - // B2020-123: Missing section continue message, onnewpage needs to be set to true: - if (MyParent.CalvertPrintedSubSectTitle) - { - onnewpage = true; - MyParent.CalvertPrintedSubSectTitle = false; - } - BuildPageBreakList(ySpaceOnFirstPage, yPageSize + yExtra2 + MyPageHelper.PrintedSectionPage, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, onnewpage); // Case 5 - Determine items where page break(s) occur - // ooooo ooooo ooooo .oooooo..o .oooooo..o oooo o8o . .oooooo. . - // `888' `888' `888' d8P' `Y8 d8P' `Y8 `888 `"' .o8 d8P' `Y8b .o8 - // 888 888 888 Y88bo. Y88bo. oo.ooooo. 888 oooo .o888oo 888 oooo oooo oooo d8b oooo d8b .ooooo. ooo. .oo. .o888oo - // 888ooooo888 888 `"Y8888o. `"Y8888o. 888' `88b 888 `888 888 888 `888 `888 `888""8P `888""8P d88' `88b `888P"Y88b 888 - // 888 888 888 `"Y88b `"Y88b 888 888 888 888 888 888 888 888 888 888 888ooo888 888 888 888 - // 888 888 888 o oo .d8P oo .d8P 888 888 888 888 888 . `88b ooo 888 888 888 888 888 .o 888 888 888 . - // o888o o888o o888ooooood8 8""88888P' 8""88888P' 888bod8P' o888o o888o "888" `Y8bood8P' `V88V"V8P' d888b d888b `Y8bod8P' o888o o888o "888" - // 888 - // o888o - 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); - } - else - ShowPageBreak(6, CheckForFirstCompression("HLS will have to split on current page"), "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); - // B2018-081 - Fix pagination when a Step and it's substeps are so complicated that the high level step is separated from its high level RNO - if(this.MyItemInfo.IsHigh && MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].MyItemInfo.IsHigh) - { - MyPageHelper.ParaBreaks.Clear(); - BuildPageBreakList(yPageSize + yExtra, yPageSizeNextPage + yExtra2, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); // Case 1 :Works for ES05 Step 15 SubStep 7 - ShowPageBreak(6, CheckForFirstCompression("HLS will have to split on next page"), "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); - return 1; - } - // B2019-173: Pagination problem fix for VCS. Originally similar code was in FindPageBreak, but having code at the lower level caused the problem in VCS. - else if (MyPageHelper.ParaBreaks.Count > 0 && this.MyItemInfo.IsHigh - && yWithinMargins > 0 && YSize > yPageSizeNextPage && ChildrenRight != null && ChildrenRight.Count > 0 - && ChildrenRight[0].YSize <= yPageSizeNextPage && ChildrenRight[0].YSize > yWithinMargins) - { - MyPageHelper.ParaBreaks.Clear(); - BuildPageBreakList(yPageSize + yExtra, yPageSizeNextPage + yExtra2, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); // Case 1 :Works for ES05 Step 15 SubStep 7 - ShowPageBreak(6, CheckForFirstCompression("HLS with RNO will have to split on next page"), "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); - return 1; - } - // B2023-047: Beaver Valley - pagination of subsection set as separate pagination. Need to reset page break - // list because & return 1 to start on new page. - else if (MyPageHelper.ParaBreaks.Count > 0 && this.MyItemInfo.IsHigh && sepPaginationForSubSection) - { - MyPageHelper.ParaBreaks.Clear(); - BuildPageBreakList(yPageSize + yExtra, yPageSizeNextPage + yExtra2, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); - ShowPageBreak(6, CheckForFirstCompression("HLS with Separate Pagination for SubSection"), "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); - return 1; - } - return 0; // Stay on this page - } - - // Less than half a page left, start printing on a new page. - //Console.WriteLine("'PageBreak',5,'Yes','HLS will have to split',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath); - // Determine items where page break(s) occur - //BuildPageBreakList(yPageSize, yPageSize - 2 * SixLinesPerInch); // Case Base - //BuildPageBreakList(yPageSize, yPageSize); // Case 1 :Works for ES05 Step 15 SubStep 7 - // Pagination Fix Break1LineShort2 - //BuildPageBreakList(yPageSize + yExtra, yPageSize); // Case 1 :Works for ES05 Step 15 SubStep 7 - // Pagination Fix Break1LineShort4 - BuildPageBreakList(yPageSize + yExtra, yPageSizeNextPage + yExtra2, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); // Case 1 :Works for ES05 Step 15 SubStep 7 - // ooooo ooooo ooooo .oooooo..o .oooooo..o oooo o8o . ooooo ooo - // `888' `888' `888' d8P' `Y8 d8P' `Y8 `888 `"' .o8 `888b. `8' - // 888 888 888 Y88bo. Y88bo. oo.ooooo. 888 oooo .o888oo 8 `88b. 8 .ooooo. oooo oooo ooo - // 888ooooo888 888 `"Y8888o. `"Y8888o. 888' `88b 888 `888 888 8 `88b. 8 d88' `88b `88. `88. .8' - // 888 888 888 `"Y88b `"Y88b 888 888 888 888 888 8 `88b.8 888ooo888 `88..]88..8' - // 888 888 888 o oo .d8P oo .d8P 888 888 888 888 888 . 8 `888 888 .o `888'`888' - // o888o o888o o888ooooood8 8""88888P' 8""88888P' 888bod8P' o888o o888o "888" o8o `8 `Y8bod8P' `8' `8' - // 888 - // o888o - if (firstStep == "Yes") - ShowPageBreak(9, CheckForFirstCompression("First HLS will have to split on new page"), "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); - else - ShowPageBreak(3, CheckForFirstCompression("HLS will have to split on new page"), "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); - return 1; // Paginate on High Level Steps - } - //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); - // return 0; // More than half way down the page - //} - //if (ChildrenBelow.Count > 0 && ChildrenBelow[0].YSize < yWithinMargins) - // return 0; - //Console.WriteLine("'PageBreak',5,'Yes','At least half the page is filled',{0},{1},{2},{3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath); - //return 2; - throw new Exception("PageBreak Logic Missing, vlnParagraph.cs"); - } - - // B2018-065 Calvert's continue message was not including the substep number in AOP-1A Attachment 1, added AERandRNO check - private bool AERandRNO(ItemInfo itemInfo1, ItemInfo itemInfo2) - { - bool hasAER = false; - bool hasRNO = false; - if (itemInfo1.IsInRNO) hasRNO |= true; - else - hasAER |=true; - if (itemInfo2.IsInRNO) hasRNO |= true; - else - hasAER |= true; - return hasAER && hasRNO; - } - // B2018-058 the the end message height accounting for multi-line end messages - private float GetEndMessageHeight(DocStyle docstyle) - { - float EndMsgHeight = 0; - string endmsg = MyItemInfo.MyDocStyle.End.Message ?? ""; - if (endmsg != "") - { - string[] splitOn = { "\\par" }; // B2018-058 account for RTF newlines ( used for V.C. Summer End messages) - EndMsgHeight = (endmsg.Split(splitOn,StringSplitOptions.RemoveEmptyEntries).Length + 1) * SixLinesPerInch; - } - return EndMsgHeight; - } - private float GetBottomEndMessageSize(DocStyle docstyle) - { - float myBottomMsgSpace = 0; - if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page. - { - docstyle = MyItemInfo.MyDocStyle; - string myBottomMsg = docstyle.End.Message; - myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0; - if (myBottomMsg != null && docstyle.End.Flag < 0) myBottomMsgSpace += (-(float)docstyle.End.Flag * SixLinesPerInch); - } - return myBottomMsgSpace; - } - private string CheckForFirstCompression(string reason) - { - if (MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].CompressFirstPartOfStep) - return reason + " - 7 LPI"; - return reason; - } - private string CheckForCompression(string reason) - { - if (CompressPartOfStep) - return reason + " - 7 LPI"; - return reason; - } - private string AddReason(string prefix) - { - string retval = prefix; - if (PageBreakReason != null) - retval += " - " + PageBreakReason; - return retval; - } - private bool SectionShowTitles - { - get - { - vlnParagraph parent = MyParent; - while (!parent.MyItemInfo.IsSection) - parent = parent.MyParent; - return parent.ShowSectionTitles; - } - } - private bool SpecialCaseForRobinson() - { - if (MyItemInfo.ActiveFormat.Name.StartsWith("CPL") && - MyItemInfo.MyPrevious == null && - MyItemInfo.NextItem == null && - MyItemInfo.Tables != null && - MyItemInfo.Cautions == null && - MyItemInfo.Notes == null && - MyItemInfo.Steps == null) return true; - return false; - } - private float GetYPageSizeUseOnAllButFirstPage() - { - float _PointsPerPage = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - int indx = (int)MyItemInfo.MyDocStyle.IndexOtherThanFirstPage; - foreach (DocStyle ds in MyItemInfo.ActiveFormat.PlantFormat.DocStyles.DocStyleList) - { - if (ds.Index == indx) - { - float yTopMargin = _PointsPerPage - (float)ds.Layout.TopMargin; - float yBottomMargin = Math.Max(0, yTopMargin - (float)ds.Layout.PageLength); - return yTopMargin - yBottomMargin; - } - } - return 0; - } - private void ForcePagination(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation, ref float retval) - { - MyPromsPrinter.NewPage(); - DebugText.WriteLine("*****PaginateError"); - yPageStart = yTopMargin + YVeryTop; - 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}'" - , 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 (BaselineMetaFile.IsOpen) - BaselineMetaFile.WriteLine("!! =====>,'Yes','Forced Pagination',{0},{1},,{3},'{4}'", MyItemInfo.ItemID, YSize, 0, yLocation, MyItemInfo.ShortPath); //C2018-015 add debug pagination to meta file - else - { - // B2020-159: If forced pagination errors occurred, add a description to be placed on a dialog after printing. - if (PromsPrinter.ForcedPaginations == null) PromsPrinter.ForcedPaginations = new List(); - string path = MyItemInfo.Path.Replace(MyItemInfo.MyProcedure.DisplayText, "").Replace(MyItemInfo.MyProcedure.DisplayNumber, "").TrimStart(" ,".ToCharArray()); - PromsPrinter.ForcedPaginations.Add(string.Format("{0}\t{1}\t{2}", MyPromsPrinter.PDFFile.Substring(0,MyPromsPrinter.PDFFile.IndexOf(".")), path, MyItemInfo.PageNumber)); - - } - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && MyPageHelper.CreatingSupInfoPage) - MyPromsPrinter.SupInfoPdfPageCount++; // this adjusts the page count offset when Forced Pagination occures in a SupInfo page - retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin, MyItemInfo.ItemID); // C2018-004 ItemID for create meta file for baseline compares - } - private void ShowPageBreak(int instance, string message, string breakOrNot, float YSize, float yPageSize, float yWithinMargins, bool manualPageBreak) - { - if (breakOrNot != "No") - { - bool hasBox = MyItemInfo.IsStep && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex != null && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex >= 0; - bool rnoSepIn = (MyItemInfo.RNOs==null ||MyItemInfo.RNOs.Count==0); - // DebugPagination.WriteLine("{0}", MyItemInfo.DBSequence); //,instance); - if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9},{10},{11}", - MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber - (breakOrNot == "Yes" ? 0 : 1), - MyItemInfo.ShortPath, instance, - (manualPageBreak ? "Manual " : "") + message, breakOrNot, - MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), - hasBox, rnoSepIn - ); - //C2018-015 add debug pagination to meta file - if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0:D6},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9},{10},{11}", - MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber - (breakOrNot == "Yes" ? 0 : 1), - MyItemInfo.ShortPath, instance, - (manualPageBreak ? "Manual " : "") + message, breakOrNot, - MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), - hasBox, rnoSepIn - ); - } - // Console.WriteLine("{0},{1}", MyItemInfo.DBSequence, IsFirstSubStep(MyItemInfo)); //,instance); - } - private bool ParentHasCalvertMacro - { - get - { - if (HasCalvertMacro) return true; - if (MyParent != null) return MyParent.ParentHasCalvertMacro; - return false; - } - } - private List _AlternateBreaks = null; - public List AlternateBreaks - { - get - { - if (_AlternateBreaks == null) - _AlternateBreaks = new List(); - return _AlternateBreaks; - } - } - private void AddAlternateBreak(vlnParagraph vp) - { - AlternateBreaks.Add(vp); - } - private bool CheckAlternates(vlnParagraph vpBrk) - { - if (_AlternateBreaks == null) return false; - foreach(vlnParagraph vp in AlternateBreaks) - if (vp.MyItemInfo.ItemID == vpBrk.MyItemInfo.ItemID) - { -// _MyLog.WarnFormat("alternate used '{0}'-'{1}'",vpBrk.MyItemInfo.ShortPath,vp.MyItemInfo.ShortPath); - return true; - } - return false; - } - private vlnParagraph FirstCRParagraph(vlnParagraph pg) - { - if (pg.HasCalvertMacro) return null; - while (!pg.MyParent.HasCalvertMacro) - pg = pg.MyParent; - if (pg.MyItemInfo.MyPrevious == null) - return pg; - // B2020-121: Account for Header on Caution or Note - pg = pg.MyParent.ChildrenBelow[0]; - pg = pg.TopMostChild; - return pg; - } - public float yPageSizeForPagination = -1; - private void BuildPageBreakList(float ySpaceOnCurPage, float yPageSize, bool KeepStepsOnPage, float yEndMsg, bool doSectionTitleContinued, bool onNewPage) - { - float topContinueHeight = 2 * SixLinesPerInch; - int profileDepth = ProfileTimer.Push(">>>> BuildPageBreakList"); - // 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 - // also have the flag set and be added to the pagebreakonsteplist so that a break occurs. - List PageBreakOnStepList = new List(); - if (PageBreakOnStep) - { - foreach (vlnParagraph chldAbove in _ChildrenAbove) - { - if (TopMostChild != chldAbove) - { - chldAbove.PageBreakOnStep = true; - PageBreakOnStepList.Add(chldAbove); - } - } - PageBreakOnStepList.Add(this); - } - ParagraphLocations myLocations = new ParagraphLocations(); - BuildLocationList(YTopMost, myLocations); - StepLevelList myList = myLocations.BuildStepLevelList(KeepStepsOnPage); - SortedList myPreferredBreaks = GetMyPreferredBreaks(myList); - // Find Break Locations in the list based upon StepLevel and yLocation - float yTop = 0; - float yLowerLimit = (yPageSize - 2 * SixLinesPerInch) / 2; - float yStart = Math.Max(0, (yPageSize - 2 * SixLinesPerInch) - ySpaceOnCurPage); - //Console.WriteLine("'yStart',{0},{1}", MyItemInfo.DBSequence, yStart); - - // The following three lines make page breaking match 16-bit: - if (_Match16BitPagination) - { - yLowerLimit = yStart - SixLinesPerInch + ySpaceOnCurPage / 2; - if ((yStart + MyItemInfo.MyDocStyle.Layout.TopMargin + 2 * SixLinesPerInch) > ((MyItemInfo.MyDocStyle.Layout.TopMargin + yPageSize - 2 * SixLinesPerInch) / 2)) - yLowerLimit = yStart + 2 * SixLinesPerInch; - } - // Make sure that the FirstPiece (Caution Note HLS and First Substeps) fit - float myFirstPieceSize = GetFirstPieceSize(); //Case 0 - // the following logic was added to fix Pagination for VCS BDMG1 Step 4 - if (ChildrenRight.Count > 0 && ChildrenRight[0].YOffset == YOffset) - { - float myFirstPieceRNOSize = 0; - myFirstPieceRNOSize = ChildrenRight[0].GetFirstPieceSize(); - if(myFirstPieceRNOSize < ySpaceOnCurPage) - if (ChildrenBelow.Count > 0) - { - float myFirstPieceAERSize = ChildrenBelow[0].GetFirstPieceSize() + ChildrenBelow[0].YOffset - YOffset; - if (myFirstPieceAERSize < myFirstPieceRNOSize) - myFirstPieceSize = myFirstPieceAERSize; - } - } - if (myFirstPieceSize < ySpaceOnCurPage) yLowerLimit = Math.Max(myFirstPieceSize + yStart, yLowerLimit); - //while ((YSize - yTop) >= ySpaceOnCurPage) - // Pagination Fix Break1LineShort3b - DocStyle docstyle = MyItemInfo.MyDocStyle; - float myBottomMsgSpace = GetBottomContinueMessageSize(docstyle); - 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; - } - // also account for phonelist for locating bottom continue message: - // B2018-079 - we don't need the phone list length in this case only the length of the end message plus a blank line because the phone list is printed below the footer but the end message is shifted up. - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.PrintPhoneList && MyPageHelper.PhoneListHeight != 0) - myBottomMsgSpace += vlnPrintObject.SixLinesPerInch; //(MyPageHelper.PhoneListHeight - vlnPrintObject.SixLinesPerInch); - - string myTopMsg = docstyle.Continue.Top.Message; - float myTopMsgSpace = ((myTopMsg ?? "") != "") ? 2 * SixLinesPerInch : 0; - // B2022-086: If continue message is above printable box don't include its size in pagination logic - if (docstyle.Continue.Top.RowOverride != null && docstyle.Continue.Top.RowOverride > 0) myTopMsgSpace = 0; - // For B2016-157 & B2015-211: myTopMsgSpace is 1 line, not 2. Note that this may be a more generic solution, but - // it was found during print testing for BGE and flag is used to minimize impact on other formats - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertPagination) myTopMsgSpace = ((myTopMsg ?? "") != "") ? SixLinesPerInch : 0; - if (myTopMsgSpace > 0 && doSectionTitleContinued) - { - vlnParagraph parSection = this.MyParent; - while (!parSection.MyItemInfo.IsSection) parSection = parSection.MyParent; - topContinueHeight = parSection.ContinueHeight; - if (topContinueHeight > myTopMsgSpace) - { - myTopMsgSpace = topContinueHeight; - } - } - // while the amount to print is larger than one page, i.e. ((YSize - yTop) > ySpaceOnCurPage)) - // OR there are page breaks for HLS/cautions/notes remaining, typically for backgrounds (PageBreakOnStepList.Count > 0) - vlnParagraph paraBreak = null; - float accountForCalvertAlarmConditionResponseFooter = 0; - - // 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'. - float accountForSmartTemplateHeader = 0; - //if (MyItemInfo.InList(878)) Console.WriteLine("Here"); - if (MyItemInfo.FormatStepData.UseSmartTemplate) - { - if (((MyItemInfo.MyDocStyle.End.Message ?? "") == "") || MyItemInfo.MyHLS.NextItem != null) - ySpaceOnCurPage += 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 - // `888b. `8' .o8 `888' `Y8b `888 - // 8 `88b. 8 .ooooo. oooo ooo .o888oo 888 888 oooo d8b .ooooo. .oooo. 888 oooo - // 8 `88b. 8 d88' `88b `88b..8P' 888 888oooo888' `888""8P d88' `88b `P )88b 888 .8P' - // 8 `88b.8 888ooo888 Y888' 888 888 `88b 888 888ooo888 .oP"888 888888. - // 8 `888 888 .o .o8"'88b 888 . 888 .88P 888 888 .o d8( 888 888 `88b. - // o8o `8 `Y8bod8P' o88' 888o "888" o888bood8P' d888b `Y8bod8P' `Y888""8o o888o o888o - - // For B2016-157 & B2015-211. Note that this may be a more generic solution, but - // it was found during print testing for BGE and flag is used to minimize impact on other formats - float yAccountForBottomMsg = (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertPagination) ? myBottomMsgSpace : 0; - while (((YSize - yTop) > (ySpaceOnCurPage - (accountForCalvertAlarmConditionResponseFooter + yEndMsg))) || PageBreakOnStepList.Count > 0) - { - float ySpaceOnCurPageSave = ySpaceOnCurPage; - if (((YSize - yTop) <= (ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter)) || PageBreakOnStepList.Count > 0) - ySpaceOnCurPage -= yEndMsg; - ySpaceOnCurPage -= myBottomMsgSpace; - vlnParagraph lastBreak = paraBreak; - // PageBreakOnStepList contains steps where a page break needs to occur based on format, for example backgrounds require cautions/notes/HLS - // to have page breaks. As each of these are processed (after this code) the topmost item in PageBreakOnStepList is removed. - // The following checks if the entire step will fit for these types of steps and if so return the next break, i.e. [0], from the PageBreakOnStepList. - // The if was changed to fix B2017-161. - bool DidPreferredPageBreak = false; - if (PageBreakOnStepList.Count > 0 && (PageBreakOnStepList[0].YTop - (lastBreak == null ? ((TopMostChild != null) ? TopMostChild.YTop : 0) : lastBreak.YTop) <= ySpaceOnCurPage)) - paraBreak = PageBreakOnStepList[0]; - else - { - paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter - yAccountForBottomMsg, yLowerLimit, - myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, - myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop); - // B2023-001: Check for null paraBreak: - if (paraBreak != null) paraBreak.yPageSizeForPagination = yPageSize; - // B2020-032 put in for Barakah EOPs 1T4-OP-EOP-XX-0100 Attachement 32 step 1.2.2a where a table was printing on a page by itself. - // The following logic will walk up to each parent level to see try and get as many parent step levels on the same page - // as the Table. - // B2020-035 added a null reference check to fix printing crash - // B2020-101: Proms crashes when trying to keep table with parent when table is very large. Add format flag for Barakah, - // code was added for B2020-032 and only want it for Barakah - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.PageBreakParentWithTable && paraBreak != null && paraBreak.MyItemInfo.IsTable && paraBreak.MyParent.YSize < (yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace)) - { - vlnParagraph tparent = paraBreak.MyParent; - while (!tparent.MyItemInfo.IsHigh && tparent.MyParent.YSize < (yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace)) - tparent = tparent.MyParent; - paraBreak = tparent; - } - // B2017-109: for supplemental information, if there is a preferred page break, account for it. - // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 - // Break after table if it's the only item left and there is enough space - if (paraBreak != null && paraBreak.MyGrid != null && ItemsLeft(myList) == 1 && - ((YSize - yTop) <= (paraBreak.MyGrid.SpaceAvailable + ySpaceOnCurPage - (accountForCalvertAlarmConditionResponseFooter + yEndMsg)))) - break; - if (myPreferredBreaks != null && myPreferredBreaks.Count > 0 && myPreferredBreaks.Keys[0] < paraBreak.YOffset) - { - // B2017-122: don't use preferred break if the last break was before this break - vlnParagraph prefBreak = myPreferredBreaks[myPreferredBreaks.Keys[0]]; - if (lastBreak == null || lastBreak.MyItemInfo.ShortPath.CompareTo(prefBreak.MyItemInfo.ShortPath) == -1) - paraBreak = prefBreak; - myPreferredBreaks.RemoveAt(0); - DidPreferredPageBreak = true; - } - } - // B2017-252 Pagination Fix - Break at title rather than title content - // B2017-261 - Make sure Parabreak is not null - if (paraBreak != null && paraBreak.MyItemInfo.ShortPath.EndsWith(".S1.") && (paraBreak.MyItemInfo.ActiveParent as ItemInfo).IsTitle) - paraBreak = paraBreak.MyParent; - yAccountForBottomMsg = 0; - // Do Not Remove: The following is used for debug - useful place to debug - //if (paraBreak.MyItemInfo.InList(207, 211, 214, 219, 221, 216, 197)) Console.WriteLine("BUILD2: Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release - //if (lastBreak != null && lastBreak.MyItemInfo.InList(80091, 1985)) - // Console.WriteLine("After 80091 {0}",paraBreak.ToString()); - //if (paraBreak.MyItemInfo.InList(981,996)) Console.WriteLine("Here"); - if (paraBreak == null) - { - if (DebugPagination.IsOpen) DebugPagination.WriteLine("<<< ERROR >>> Cannot find a place to break ==>,{0},'{1}','{2}',{3},{4}" - , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, YSize - yTop, ySpaceOnCurPageSave); - _MyLog.ErrorFormat("<<< ERROR >>> Cannot find a place to break\r\n==>'Cannot Find Place to Break',{0},'{1}','{2}'" - , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath); - //C2018-015 add debug pagination to meta file - if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! <<< ERROR >>> Cannot find a place to break ==>,{0},'{1}','{2}',{3},{4}" - , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, YSize - yTop, ySpaceOnCurPageSave); - _MyLog.ErrorFormat("<<< ERROR >>> Cannot find a place to break\r\n==>'Cannot Find Place to Break',{0},'{1}','{2}'" - , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath); - break; - } - //if (paraBreak.MyItemInfo.InList(54615, 54620) || MyItemInfo.InList(54573)) - //{ - // Console.WriteLine("{0}\t{1}", MyItemInfo.ItemID, paraBreak); - // Console.WriteLine("Here"); - //} - // C2018-003 fixed use of getting the active section - if (paraBreak.MyItemInfo.IsStep && paraBreak.MyItemInfo.ActiveSection != null && ((paraBreak.MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd) && - paraBreak.MyItemInfo.FormatStepData != null && paraBreak.MyItemInfo.MyParent.MyPrevious != null && paraBreak.MyItemInfo.MyParent.IsStep && paraBreak.MyItemInfo.MyParent.MyPrevious.FormatStepData.Type == "TitleWithTextBelow") - { - if (lastBreak != null && lastBreak != paraBreak.MyParent) paraBreak = paraBreak.MyParent; - } - float yLoc = ySpaceOnCurPage - (paraBreak.YOffset - (YTopMost + yTop)); - if (yLoc <= 0) // Check where it would break if the space on the page was one line shorter - { - vlnParagraph paraBreak2 = FindPageBreak(yStart, ySpaceOnCurPage - (SixLinesPerInch + accountForCalvertAlarmConditionResponseFooter), yLowerLimit, - myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, - myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop); - if (paraBreak2 != null && paraBreak != paraBreak2) - { - yLoc = ySpaceOnCurPage - (paraBreak2.YOffset - (YTopMost + yTop - 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); - paraBreak = paraBreak2; - } - } - } - // If the page break is close to the lower limit and the paraBreak is bigger than the upper limit - // and increasing the lower limit by two lines - // Causes a significant increase (at least 2 inches) in the amount of text placed on the page and - // the StepLevel only increases by 1 then use the paraBreak3 - else if (yLoc <= yLowerLimit + 24) - { - if (paraBreak.YSize > (yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace)) - { - vlnParagraph paraBreak3 = FindPageBreak(yStart, ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter, yLowerLimit + 144, - myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, - myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop); - if (paraBreak3 != null) - { - float yLoc3 = ySpaceOnCurPage - (paraBreak3.YOffset - (YTopMost + yTop)); - if (paraBreak.MyItemInfo.StepLevel + 1 >= paraBreak3.MyItemInfo.StepLevel && (yLoc - yLoc3) > 144)//144 is 2 inches - paraBreak = paraBreak3; - } - } - } - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfcreekCKLFormat) - { - if (!paraBreak.MyItemInfo.IsHigh // not a high level step - && paraBreak.MyParent.MyItemInfo.IsHigh // my parent is a hls - && paraBreak.MyItemInfo.MyPrevious == null // first substep - && paraBreak.MyParent.MyItemInfo.FormatStepData.UseSmartTemplate) // my parent has the checklist header - { - if (DebugPagination.IsOpen) DebugPagination.WriteLine("Breaking at parent of {0}", paraBreak.MyItemInfo.DisplayText); - if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! Breaking at parent of {0}", paraBreak.MyItemInfo.DisplayText); //C2018-015 add debug pagination to meta file - paraBreak = paraBreak.MyParent; - } - } - 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 - //if (MyItemInfo.InList(119826)) Console.WriteLine("here"); - //if (paraBreak.MyItemInfo.InList(40339)) - float ySpaceOnNextPage = yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace; - if (paraBreak.MyItemInfo.IsOr && paraBreak.MyParent.YSize < ySpaceOnNextPage) - { - vlnParagraph paraBreakParent = paraBreak.MyParent; - while (paraBreakParent.MyParent.YSize < ySpaceOnNextPage) - paraBreakParent = paraBreakParent.MyParent; - //_MyLog.WarnFormat("Or Step PageBreak '{0}','{1}','{2}'",paraBreak.MyItemInfo.ShortPath ,paraBreak.MyItemInfo.MyProcedure.DisplayNumber, paraBreak.MyItemInfo.MyHLS.DisplayText); - paraBreak = paraBreakParent; - } - if (!paraBreak.ParentHasCalvertMacro) - { - foreach (int lev in myList.Keys) - { - foreach (float y in myList[lev].Keys) - { - vlnParagraph p = myList[lev][y]; - if (p.YOffset == paraBreak.YOffset && p.MyItemInfo.ItemID != paraBreak.MyItemInfo.ItemID) - paraBreak.AddAlternateBreak(p); - } - } - } - // if first condition/response and the parent has caution, notes or warnings then move the break to the caution, note or warning - if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro && paraBreak.MyParent.HasCalvertMacro && paraBreak.MyItemInfo.MyPrevious == null) - { - if (paraBreak.MyParent.ChildrenAbove.Count > 0) - paraBreak = paraBreak.MyParent.ChildrenAbove[0]; - else - paraBreak = paraBreak.MyParent; - } - // If the lastbreak was part of a condition response and the location is part of a condition response account for the size of the footer. - else if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro && accountForCalvertAlarmConditionResponseFooter == 0) - { - paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - vlnPrintObject.SixLinesPerInch * 4, yLowerLimit, myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, - myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop); - if (paraBreak.MyItemInfo.MyPrevious == null) - if (paraBreak.MyParent.ChildrenAbove.Count > 0) - paraBreak = paraBreak.MyParent.ChildrenAbove[0]; - else - paraBreak = paraBreak.MyParent; - //_MyLog.WarnFormat("Keep notes and cautions with CR text {0},'{1}','{2}','{3}'", paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.ShortPath, paraBreak.MyItemInfo.MyProcedure.DisplayNumber, paraBreak.MyParent.MyParent.MyItemInfo.DisplayText); - } - if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro) - { - vlnParagraph pTop = FirstCRParagraph(paraBreak); - if (pTop != null && paraBreak.YOffset > pTop.YOffset && paraBreak.YOffset <= pTop.YOffset + 2 * SixLinesPerInch && pTop.MyParent != lastBreak) - { - if (pTop.MyItemInfo.MyPrevious == null && pTop.MyParent.ChildrenAbove.Count > 0) - { - paraBreak = pTop.MyParent.ChildrenAbove[0]; - //_MyLog.WarnFormat("Break at First CR Paragraph w/Notes {0},'{1}','{2}','{3}'", paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.ShortPath, paraBreak.MyItemInfo.MyProcedure.DisplayNumber, pTop.MyParent.MyParent.MyItemInfo.DisplayText); - } - else - { - paraBreak = pTop.MyParent; - //_MyLog.WarnFormat("Break at First CR Paragraph {0},'{1}','{2}','{3}'", paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.ShortPath, paraBreak.MyItemInfo.MyProcedure.DisplayNumber, pTop.MyParent.MyParent.MyItemInfo.DisplayText); - } - } - } - if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro) - accountForCalvertAlarmConditionResponseFooter = 5 * SixLinesPerInch; - else - accountForCalvertAlarmConditionResponseFooter = 0; - //if (lastBreak != null && paraBreak.MyItemInfo.Ordinal == 1 && !paraBreak.MyItemInfo.IsCautionOrNotePart) - //_MyLog.WarnFormat("'Strange Break',{0},'{1}','{2}','{3}',{4}", paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.ShortPath, paraBreak.MyItemInfo.MyProcedure.DisplayNumber, paraBreak.MyItemInfo.MyHLS.DisplayText,lastBreak.MyItemInfo.ItemID); - } - if (lastBreak == paraBreak) - { - throw (new Exception(string.Format("Pagination Infinite Loop {0}", lastBreak.MyItemInfo.ShortPath))); - } - // If the paraBreak is in an RNO and the location of the RNO is within the range of the AER parent, then break on the AER. - if (paraBreak.MyItemInfo.IsInRNO) - { - vlnParagraph aerParent = paraBreak.MyParent; - while (aerParent.MyItemInfo.IsInRNO) aerParent = aerParent.MyParent; - if (aerParent.YOffset + aerParent.Height > paraBreak.YOffset) - { - if (aerParent.ChildrenAbove != null && aerParent.ChildrenAbove.Count > 0) // If the aerParent has caution or note - aerParent = aerParent.ChildrenAbove[0];//, break on the caution or note. - if (aerParent != lastBreak) paraBreak = aerParent; - } - } - // MNS Pagination - Mike Weiner Case 1b to keep substeps together on one page - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.PutOnPageByItself && !paraBreak.MyParent.MyItemInfo.IsHigh && !paraBreak.MyItemInfo.IsHigh) - { - vlnParagraph firstLevel = paraBreak.MyParent; - while (firstLevel.MyItemInfo.IsInRNO) firstLevel = firstLevel.MyParent; - if (!firstLevel.MyItemInfo.IsHigh) - { - while (!firstLevel.MyParent.MyItemInfo.IsHigh) firstLevel = firstLevel.MyParent; - if (firstLevel.MyParent.ChildrenBelow != null && firstLevel.MyParent.ChildrenBelow.Count > 0 && firstLevel.MyParent.ChildrenBelow[0] != firstLevel && - firstLevel.YSize < yPageSize - (myTopMsgSpace + SixLinesPerInch)) - { - vlnParagraph firstLevel1 = firstLevel; - 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. - if (firstLevel != lastBreak && paraBreak != firstLevel) - { - //Console.WriteLine("'{0}','{1}','{2}'", firstLevel1.MyParent.MyItemInfo.ShortPath, firstLevel1.MyItemInfo.MyTab.Text, firstLevel1.MyItemInfo.ShortPath); - paraBreak = firstLevel; - } - } - } - } - // 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 - //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); - //_MyLog.InfoFormat("Place to break\r\n==>'Place to Break',{0},'{1}','{2}'" - //, 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 - //float yTopNew = paraBreak.YVeryTop - YTopMost; - //float yTopNew = paraBreak.YTopMost - YTopMost; - if (JustATableThatWillFit(paraBreak, yPageSize - (myTopMsgSpace + yEndMsg))) - 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-116: the 112 change broke a WCN print of single column. The end message adjustment was added back in and retested for 112 also - // and had no negative impact. - // B2022-086: adjust yPageSize for non-first page when second (or later) page has a different printable box (don't include - // size of alarm box in Barakah alarms is particular case that bug was written for) - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.AdjFirstSecDocStylesInPagination && MyItemInfo.MyDocStyle.IndexOtherThanFirstPage != null) yPageSize = GetYPageSizeUseOnAllButFirstPage(); - float ySpaceOnNextPage1 = yPageSize - (myTopMsgSpace + (yEndMsg == 0 ? SixLinesPerInch : 0)); // Allow for continue message and blank line. - ySpaceOnNextPage1 -= accountForSmartTemplateHeader; - // This fixes B2016-174: - // Added the check to not go into this code if on a step that needs to break. If the conditions were met, this - // code was not putting a page break on a step that needed to break, i.e. PageBreakOnStep = true. - // B2018-024: Added the 'DidPreferredPageBreak', don't do the compressed code if a preferred page break exists on the step. - if (!DidPreferredPageBreak && (MyItemInfo.IsStep && !MyItemInfo.FormatStepData.PageBreakOnStep) && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.PartialStepCompression && onNewPage) // ySpaceOnNextPage1 == ySpaceOnCurPage+myBottomMsgSpace) - { - float ySpaceAt7LPI = ((ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter) * SixLinesPerInch / _SevenLinesPerInch) - _SevenLinesPerInch; - vlnParagraph paraBreak7 = FindPageBreak(yStart, ySpaceAt7LPI, yLowerLimit, - myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, - myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop); - if (paraBreak7 != null && paraBreak7.YOffset > paraBreak.YOffset && paraBreak.MyItemInfo.StepLevel >= paraBreak7.MyItemInfo.StepLevel) - { - paraBreak = paraBreak7; - // Compress Part of Step - // .oooooo. ooooooooo. . - // d8P' `Y8b `888 `Y88. .o8 - // 888 .ooooo. ooo. .oo. .oo. oo.ooooo. oooo d8b .ooooo. .oooo.o .oooo.o 888 .d88' .oooo. oooo d8b .o888oo - // 888 d88' `88b `888P"Y88bP"Y88b 888' `88b `888""8P d88' `88b d88( "8 d88( "8 888ooo88P' `P )88b `888""8P 888 - // 888 888 888 888 888 888 888 888 888 888ooo888 `"Y88b. `"Y88b. 888 .oP"888 888 888 - // `88b ooo 888 888 888 888 888 888 888 888 888 .o o. )88b o. )88b 888 d8( 888 888 888 . - // `Y8bood8P' `Y8bod8P' o888o o888o o888o 888bod8P' d888b `Y8bod8P' 8""888P' 8""888P' o888o `Y888""8o d888b "888" - // 888 - // o888o - // - // | Step over a Number of Pages | - // | First Page | Second Page | Third Page | - //-------------------------------------------------------------------------------------- - // |paraBreak[0] |paraBreak[1] - // | | - // |CompressPartOfStep |CompressPartOfStep - // | Flags compression for 2nd page | Flags compression for 2nd page - // | of step starting at paraBreak[0] | of step starting at paraBreak[1] - // | | See code below for 'Compress Rest of Step' - // <==|CompressFirstPartOfStep | - // | Flags compression for 1st page | - // | (1st page doesn't use paraBreak) | - // - if (lastBreak != null) // not on first page of step - { - lastBreak.PageBreakReason = "More of Step at 7 LPI"; - lastBreak.CompressPartOfStep = true; - } - else - { - paraBreak.CompressFirstPartOfStep = true; - } - } - } - onNewPage = true; - float yTopNew = Math.Min(paraBreak.YTopMost, paraBreak.YVeryTop) - YTopMost; - // B2020-120: for calvert alarms, consider the size of the condition response text/lines - if (paraBreak.HasCalvertMacro) yTopNew += (accountForCalvertAlarmConditionResponseFooter - SixLinesPerInch); - // B2017-161: unnecessary PageBreak for background documents: use the 'usedPageBreakOnStepList' flag when using the PageBreakOnStepList, don't adjust space on page to account - // for continue message, if there is not one. - bool usedPageBreakOnStepList = false; - // This is for formats that break on all HLS, Cautions & Notes (often backgrounds): - if (PageBreakOnStepList.Count > 0) - { - // If the next page break is beyond the next hls/caution/note, use the next - // hls/caution/note. - if (PageBreakOnStepList[0].YTop <= paraBreak.YTop) - { - PageBreakOnStepList[0].CompressFirstPartOfStep = paraBreak.CompressFirstPartOfStep; - // B2017-252 Robinson EOP Upgrade Basis Phase 1 Procedure set located in the Pre-Upgrade (Legacy) folder, - // EOP-FR-S.1-BD, WOG Step 13 no longer fits Deviations and References on the same page. - // Added the IF condition to fix the problem - // B2017-161: unnecessary PageBreak for background documents: use the 'usedPageBreakOnStepList' flag when using the PageBreakOnStepList, don't adjust space on page to account - // for continue message, if there is not one. - // B2017-252 Pagination Fix - WCN was not paginating correctly. Reverted to orginal code. - usedPageBreakOnStepList = true; - paraBreak = PageBreakOnStepList[0]; - PageBreakOnStepList.RemoveAt(0); - 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); - yTop = yTopNew; - MyPageHelper.ParaBreaks.Add(paraBreak); - ySpaceOnNextPage1 -= paraBreak.GetSectionTopMessageSize(); // B2016-134: Account for wcntraining section top continue on substep containers (notes/cautions) - SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - // B2016-266 Only set SectionTitleContinued1 if the format supports section continue messages - bool doSectionTitleContinued1 = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader; - if (doSectionTitleContinued1 && MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) - { // B2017-036 BGE Unit 1 STP-073A-1 6.5.B.5 in the Approved Procedures did not print properly - string myMsg = MyItemInfo.MyDocStyle.Continue.Top.Message; - if (myMsg != null && myMsg != "") - doSectionTitleContinued1 = false; - } - if (doSectionTitleContinued1) ySpaceOnNextPage1 -= 2 * SixLinesPerInch; // B2016-195: Account for Section Continue Message - // B2017-161: unnecessary PageBreak for background documents: use the 'usedPageBreakOnStepList' flag when using the PageBreakOnStepList, don't adjust space on page to account - // for continue message, if there is not one. - // B2017-252 Pagination Fix - RNP was not paginating correctly. Added logic to set ySPaceOnCurPage if ySpaceOnNextPage was larger - 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; - if (_Match16BitPagination) yLowerLimit -= 1.5F * SixLinesPerInch; // 276 for HLP - yStart = 0; - // This fixes B2016-174: - // Added the check to not go into this code if on a step that needs to break. If the conditions were met, this - // code was not putting a page break on a step that needed to break, i.e. PageBreakOnStep = true. - if ((MyItemInfo.IsStep && !MyItemInfo.FormatStepData.PageBreakOnStep) && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.PartialStepCompression) - { - float adjustedCurPageYSpace = ySpaceOnCurPage; - if (MyPageHelper.PrintedSectionPage > 0 && MyItemInfo.ActiveSection != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PrintSectOnFirst) == E_DocStructStyle.DSS_PrintSectOnFirst) - { - ItemInfo ii = paraBreak.MyItemInfo; - while (!ii.IsHigh) ii = ii.MyParent; - if (ii == ii.LastSibling) //B2020-075 only adjust the Farley section page length to make room for END message if this is the last step of the section. - adjustedCurPageYSpace -= MyPageHelper.PrintedSectionPage; //B2020-064 FNP-1-ECP-0.0 Attachment 6 not enough room for end message - } - float ySpaceAt7LPI = (adjustedCurPageYSpace - (accountForCalvertAlarmConditionResponseFooter + yEndMsg)) * SixLinesPerInch / _SevenLinesPerInch; - if ((YSize - yTop) > (adjustedCurPageYSpace - (accountForCalvertAlarmConditionResponseFooter + yEndMsg)) - && (YSize - yTop) < ySpaceAt7LPI ) - { - // Compress Rest of Step - // .oooooo. ooooooooo. . - // d8P' `Y8b `888 `Y88. .o8 - // 888 .ooooo. ooo. .oo. .oo. oo.ooooo. oooo d8b .ooooo. .oooo.o .oooo.o 888 .d88' .ooooo. .oooo.o .o888oo - // 888 d88' `88b `888P"Y88bP"Y88b 888' `88b `888""8P d88' `88b d88( "8 d88( "8 888ooo88P' d88' `88b d88( "8 888 - // 888 888 888 888 888 888 888 888 888 888ooo888 `"Y88b. `"Y88b. 888`88b. 888ooo888 `"Y88b. 888 - // `88b ooo 888 888 888 888 888 888 888 888 888 .o o. )88b o. )88b 888 `88b. 888 .o o. )88b 888 . - // `Y8bood8P' `Y8bod8P' o888o o888o o888o 888bod8P' d888b `Y8bod8P' 8""888P' 8""888P' o888o o888o `Y8bod8P' 8""888P' "888" - // 888 - // o888o - paraBreak.PageBreakReason = "Rest of Step fits at 7 LPI"; - paraBreak.CompressPartOfStep = true; - break; - } - } - } - if (paraBreak != null && paraBreak.PageBreakReason == null) - paraBreak.PageBreakReason = "Rest of Step fits at 6 LPI"; - ProfileTimer.Pop(profileDepth); - } - // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 - // Howany items are left to be printed. - private int ItemsLeft(StepLevelList myList) - { - int retval = 0; - foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. - foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation - retval++; - return retval; - } - // The following finds all of the preferred page breaks for this step & if found adds them to a - // list of the location & the paragraph it is on. This is used so that pagination calculations - // occur for steps following the preferred page break rather than starting on the page after - // substep with preferred page break (B2017-109) - private SortedList GetMyPreferredBreaks(StepLevelList myList) - { - // 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 - //if (!MyItemInfo.MyDocStyle.SupplementalInformation && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AlarmPagination) return null; - SortedList sdpara = null; - foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. - { - foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation - { - vlnParagraph myPara = myList[stepLevel][yLocation]; - StepConfig sci = myPara.MyItemInfo.MyConfig as StepConfig; - if (sci != null && sci.Step_PreferredPagebreak || sci.Step_SubStepPagebreak) - { - // C2023-018: if removing manual page breaks - add to list for permanent removal if selected and do not add a possible page break - // on the sub-step (do not execute the 'else' code) - if (sci.Step_SubStepPagebreak && MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null && - !MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(MyItemInfo.ItemID)) - MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(MyItemInfo.ItemID); - else - { - if (sdpara == null) sdpara = new SortedList(); - if (myPara.ChildrenAbove != null && myPara.ChildrenAbove.Count > 0) sdpara.Add(-yLocation, myPara.ChildrenAbove[0]); - else sdpara.Add(-yLocation, myPara); - } - } - } - } - return sdpara; - } - - private float GetBottomContinueMessageSize(DocStyle docstyle) - { - float myBottomMsgSpace = 0; - docstyle = MyItemInfo.MyDocStyle; - string myBottomMsg = docstyle.Continue.Bottom.Message; - myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0; - if (myBottomMsg != null && myBottomMsg.Contains("par")) myBottomMsgSpace += SixLinesPerInch; - return myBottomMsgSpace; - } - - private bool JustATableThatWillFit(vlnParagraph paraBreak, float ypagesize) - { - if (paraBreak.MyItemInfo.MyContent.Text.Replace(" ", "").Replace(@"\u160?", "").Replace(@"\'A0", "") != "") return false; - if (paraBreak.YSize < ypagesize) return false; - if (paraBreak.ChildrenAbove.Count > 0) return false; - if (paraBreak.ChildrenLeft.Count > 0) return false; - if (paraBreak.ChildrenRight.Count > 0) return false; - if (paraBreak.ChildrenBelow.Count != 1) return false; - if (!paraBreak.ChildrenBelow[0].MyItemInfo.IsTable) return false; - vlnParagraph paraTable = paraBreak.ChildrenBelow[0]; - if (paraTable.YSize < ypagesize) - return true; - return false; - } - // B2020-108: Original FindPageBreak was renamed to FindPageBreak1 so that an additional check can be made after - // the page break is found. Check if the location identified is a parent of a table that is too long to allow parent to fit - // on the same page, if so break at the table rather than the parent. - public int levelForPagination = -1; - private static vlnParagraph FindPageBreak(float yStart, float yUpperLimit, float yLowerLimit, StepLevelList myList, vlnParagraph lastBreak, float fullPage, - float myBottomMsgSpace, bool RNOContinueOnly, float yTop) - { - vlnParagraph myPara = FindPageBreak1(yStart, yUpperLimit, yLowerLimit, myList, lastBreak, fullPage, myBottomMsgSpace, RNOContinueOnly, yTop); - float yLocation = GetYLocationFromMyList(myPara, myList); - float spaceOnPage = yUpperLimit + yLocation; - // B2020-137 added a null reference check - for Wolf Creek SYS GN-120 Attachment B - if (myPara != null && myPara.YSize > spaceOnPage && myPara.ChildrenBelow != null && myPara.ChildrenBelow.Count > 0 - && myPara.ChildrenBelow[0].MyItemInfo.IsTable && spaceOnPage > 0) - { - vlnParagraph tpara = myPara.ChildrenBelow[0] as vlnParagraph; - if (tpara.YSize + myPara.Height > yUpperLimit) return tpara; - } - return myPara; - } - private static float GetYLocationFromMyList(vlnParagraph myPara, StepLevelList myList) - { - foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. - { - foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation - { - vlnParagraph pg = myList[stepLevel][yLocation]; - if (pg == myPara) return -yLocation; - } - } - return 0; - } - /// - /// Finds the highest StepLevel (lowest StepLevel number, 0 = HLS, 1 = first substep) that - /// fills the page sufficiently (more than half-full) - /// - /// - /// - /// - /// - private static vlnParagraph FindPageBreak1(float yStart, float yUpperLimit, float yLowerLimit, StepLevelList myList, vlnParagraph lastBreak, float fullPage, - float myBottomMsgSpace,bool RNOContinueOnly, float yTop) - { - vlnParagraph minPara = null; - //StringBuilder minBuff = new StringBuilder(); - float? yLocationMin=null; - vlnParagraph minPara2 = null; - float? yLocationMin2=null; - float yAddForBtmMsg = 0; - // 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. - //if (lastBreak != null && lastBreak.MyItemInfo.InList(72481)) - //{ - // int range = 120; - // Console.WriteLine("lastBreak = {0}, {1}", yUpperLimit, lastBreak); - // foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. - // { - // foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation - // { - // if (-yLocation > yUpperLimit - range && -yLocation <= yUpperLimit + range) - // { - // vlnParagraph pg = myList[stepLevel][yLocation]; - // if (pg.PartsAbove != null && pg.PartsAbove.Count > 0) - // Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t\"{5}\"", stepLevel, yUpperLimit + yLocation, (yUpperLimit + yLocation) - pg.Height, pg.YOffset, (pg.PartsAbove[0] as vlnPrintObject).YOffset, pg); - // else - // Console.WriteLine("{0}\t{1}\t{2}\t\"{3}\"", stepLevel, yUpperLimit + yLocation, (yUpperLimit + yLocation) - pg.Height, pg); - - // } - // } - // } - //} - foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. - { - foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation - { - float spaceOnPage = yUpperLimit + yLocation; - vlnParagraph myPara = myList[stepLevel][yLocation]; - bool IsIP3Format = myPara.MyItemInfo.ActiveFormat.Name.StartsWith("IP3"); - int maxLev = stepLevel; - if (spaceOnPage > 0 && (maxLev = MaxBreakLevel(yLocation, myList, stepLevel, myPara)) > stepLevel) - { - //DebugPagination.WriteLine("'Adjust for Max StepLevel',{0},{1},{2},'{3}'",myPara.MyItemInfo.ItemID,stepLevel,maxLev, myPara.MyItemInfo.ShortPath); - //break; - } - else - { - if (RNOContinueOnly && !myPara.MyItemInfo.IsInRNO) - yAddForBtmMsg = myBottomMsgSpace; - else - yAddForBtmMsg = 0; - spaceOnPage += yAddForBtmMsg; - if (!IsIP3Format) - { - // The following lines were added for Comanche Peak ECA-TP-11-001A.SProcedure Steps.S17 (Printed as Step 12) - if (spaceOnPage > 0 && myPara.YSize > fullPage && myPara.ChildrenRight != null && myPara.ChildrenRight.Count > 0 - && myPara.ChildrenRight[0].YSize <= fullPage && myPara.ChildrenRight[0].YSize > spaceOnPage - // B2018-104: don't return if my parent is a high level - a top continue message was printing - // Was not complete, i.e. caused other pagination problems and was put back in: B2019-170: VCS page break causes printing of step on top of next page. - // 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 this line: - && !myPara.MyItemInfo.IsHigh) - { - //_MyLog.WarnFormat("\r\nMyParaBreak {0},{1},{2},{3},{4}", myPara, myPara.YSize, yUpperLimit, myPara.ChildrenRight[0].YSize, spaceOnPage); - if (myPara != lastBreak) - return myPara; - } - // The following lines were added for Comanche Peak ECA-0.1A.SProcedure Steps.S17 (Printed as Step 12) - vlnParagraph myParent = myPara.MyParent; - float spaceOnPage1 = yAddForBtmMsg + yUpperLimit + myPara.YTop + yLocation - myParent.YTop; - if (spaceOnPage1 > 0 && myParent != lastBreak && myParent.YSize > fullPage && myParent.ChildrenRight != null && myParent.ChildrenRight.Count > 0 - && myParent.ChildrenRight[0].YSize <= fullPage && myParent.ChildrenRight[0].YSize > spaceOnPage1 - // Was not complete, i.e. caused other pagination problems and was put back in: B2019-170: VCS page break causes printing of step on top of next page. - // 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 - // 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 - { - //_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) - return myParent; - } - } - // The top of this step will fit onto page (-yLocation < yWithinMargins) - float wcnChkLstBorder = myPara.MyItemInfo.MyHLS != null && myPara.MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate && - (myPara.MyItemInfo.MyHLS.FormatStepData.Suffix ?? "") != "" ? 2 * SixLinesPerInch : 0; - if (myPara != lastBreak) - { - if ((-yLocation + yStart) >= yLowerLimit) // More than the lower limit - { - if (yLocationMin == null) // No old location - { - //minBuff.AppendLine(string.Format("OLD1 >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit)); - yLocationMin = yLocation; - minPara = myPara; - } - else if (-yLocation < -yLocationMin && -yLocationMin >= yUpperLimit) // New location is smaller and old location excedes limit - { - //minBuff.AppendLine(string.Format("NEW1A >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit)); - yLocationMin = yLocation; - minPara = myPara; - } - else if (-yLocation > -yLocationMin && -yLocation <= yUpperLimit) // New location is larger and new location is less than limit - { - //minBuff.AppendLine(string.Format("NEWB1 >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit)); - yLocationMin = yLocation; - minPara = myPara; - } - } - else // Less than the lower limit - { - if (yLocationMin2 == null) - { - //minBuff.AppendLine(string.Format("OLD2 >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit)); - yLocationMin2 = yLocation; - minPara2 = myPara; - } - else if (-yLocation < -yLocationMin2 && -yLocationMin2 >= yUpperLimit) // New location is smaller and old location excedes limit - { - //minBuff.AppendLine(string.Format("NEW2A >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit)); - yLocationMin2 = yLocation; - minPara2 = myPara; - } - else if (-yLocation > -yLocationMin2 && -yLocation <= yUpperLimit) // New location is larger and new location is less than limit - { - //minBuff.AppendLine(string.Format("NEW2B >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit)); - // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 - // Break at next step if going to break at table and there is room for scrunched table - if (myPara.MyGrid != null && minPara != null && -yLocationMin <= (yUpperLimit + myPara.MyGrid.SpaceAvailable)) - return minPara; - yLocationMin2 = yLocation; - minPara2 = myPara; - } - } - } - //while (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; - 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 (-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 - if ((-yLocation + yStart) >= yLowerLimit) - if (myPara != lastBreak) - // Second RNO check was added for the following: - // B2020-013 premature break in RNO column - Callaway OTO-AC-00002 step 2 - // B2020-016 for Robinson AOP-010 step 27 was breaking too soon - // B2020-073 was not keeping all of RNO sub-step together - Comanche Peak FRC-0.1 (unit 1) Step 14 - // 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-150 was breaking bullet substep from RNO - rev 3 Braidwood EP-0 unit 1 Attachment B, step 5.a.RNO.substep 3. bullet 2 - if ((-yLocation + yStart) >= yLowerLimit) - { - vlnParagraph rnoChild = myPara.HasSecondRNOThatWillFit(yStart, yLowerLimit, yUpperLimit, myList, stepLevel, yTop); // Only if it is more than the lower limit - if (rnoChild != null) - { - // B2023-088: don't return the 'rnochild' if this is a caution or note in an alarm format - if (myPara.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AlarmPagination && minPara2 != null && minPara2.MyItemInfo.IsCautionOrNotePart) return minPara2; - return rnoChild; - } - } - // B2019-103, B2019-114 Break at a step if the step will fit on a page by itself and it will - // not fit in the current page - float yAdjustLastSubStep = 0; - if ((myPara.MyItemInfo.ActiveParent as ItemInfo).IsHigh && myPara.MyItemInfo.NextItem == null) - { - // B2020-059 Last Substep will fit on page by itself - add the bottom continue message length to the fullpage length. - // fullpage is passed in FindPageBreak() with the bottom continue message length subtracted from the full page length. - // if this is the last sub-step of the HLS then we will not need a continue message, thus we include fullpage by th length of the bottom continue message. - yAdjustLastSubStep = myBottomMsgSpace; - _MyLog.WarnFormat("Last Substep will fit on page by itself {0}", myPara.MyItemInfo.ShortPath); // add information in the error log - } - if (StepWillFitOnBlankPageButNotOnCurrentPage(myPara, yLocation, yStart, fullPage + yAdjustLastSubStep)) - if (myPara != lastBreak) - return myPara; - // If this item will not fit on the current page, put a page break - if (myPara.YBottom - myPara.YTop > (yUpperLimit + yLocation)) - if (myPara != lastBreak) - if ((-yLocation + yStart) >= yLowerLimit) // Only if it is more than the lower limit - return myPara; - // if is a caution or note & parent is a substep and entire substep doesn't fit, break. - if ((myPara.MyItemInfo.IsNote || myPara.MyItemInfo.IsCaution) && - !myPara.MyParent.MyItemInfo.IsHigh && - myPara.MyParent.YSize > (yUpperLimit + yLocation)) - { - //McGuire Unit 1 AOPs - AP/1/A/5500/07.SEnclosure 7.S31..S1..C1 - if ((-yLocation + yStart) >= yLowerLimit) // Only if it is more than the lower limit - return myPara; - } - } - } - } - } - //DebugPagination.Write(minBuff.ToString()); - if (-yLocationMin > yUpperLimit && minPara2 != null) minPara = null; - - // if breaking at a note/caution - don't break within the same box. Clear minPara (like code above) - // so that minPara2 is used. - if (minPara != null && minPara2 != null && ((minPara2.MyItemInfo.IsCautionPart && minPara.MyItemInfo.IsCaution) || (minPara2.MyItemInfo.IsNotePart && minPara.MyItemInfo.IsNote)) - && minPara.MyItemInfo.FirstSibling.ItemID == minPara2.MyItemInfo.ItemID) minPara = null; - //if (minPara != null) DebugPagination.WriteLine("### 111111 {0}", minPara); - //if(minPara2 != null) DebugPagination.WriteLine("### n222222 {0}", minPara2); - if (minPara != null && minPara.MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertPagination && - minPara.MyItemInfo.MyPrevious != null && minPara.MyItemInfo.IsCautionOrNotePart && - minPara2 != null && minPara2.MyItemInfo == minPara.MyItemInfo.FirstSibling) - { - minPara = null; // B2020-148 Calvert Approved folder Unit 2 AOP-3B section VI, Step H.18f - keep cautions/Notes with substep 18.f - DebugPagination.WriteLine("B2020-148 {0}", minPara2); - _MyLog.WarnFormat("\r\n+++ Paginagion Change B2020-148 {0}", minPara2); - } - return minPara ?? minPara2; - } - - // B2020-013 premature break in RNO column - Callaway OTO-AC-00002 step 2 - // B2020-016 bad pagination on RNOs for Robinson AOP-010 step 27 , AOP-024 Step 10, EOP E-0 step 10, EOP ECA-2.1 step 28 - // B2020-073 was not keeping all of RNO sub-step together - Comanche Peak FRC-0.1 (unit 1) Step 14 - // 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-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 - 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 - if (this.ChildrenAbove != null && this.ChildrenAbove.Count > 0) if (HasCalvertMacro) return this; - // note: "this" is the myPara from where this method is called - if (!MyItemInfo.IsInRNO || MyItemInfo.GetMaxRNOLevels <= 1) // GetMaxRNOLevels will get the greatest (lowest) RNO level in the step - return this; // does not have second (more than one) RNO - break at the myPara - if (this.MyItemInfo.IsRNOPart && this.MyItemInfo.RNOs == null) // B2020-099 if on an RNO an there isn't another one to check, just return current break on RNO - return this; - // see if there is a second RNO then see if it will fit on the page - vlnParagraph tmp = this; - while (!tmp.MyItemInfo.IsRNOPart && tmp.MyParent!=null) tmp = tmp.MyParent; // if on a substep of an RNO, move up the substep's parent (RNO) - vlnParagraph parent = tmp; - while (parent.MyParent != null && !parent.MyParent.MyItemInfo.IsSection) parent = parent.MyParent; // this will take us to the High level step - float yTopParent = parent.YTopMost; // this is where the HLS starts printing - if (this.MyItemInfo.IsRNOPart && this.MyItemInfo.RNOLevel > 1) - if ((this.YTopMost - yTopParent + yStart - yTop + this.YSize) > yUpperLimit) - { - foreach (vlnParagraph chld in parent.ChildrenBelow) - if (YBottomMostExcludingRNO(chld) > this.YTopMost) - return null; // the AER text overlaps the RNO text - DON'T use the myPara and keep looking instead - return this; // myPara is an RNO and the entire RNO will fit - } - - // check the children of the myPara and see if it has an RNO that will fit - foreach (vlnParagraph chld in tmp.ChildrenBelow) - if (chld.MyItemInfo.IsRNOPart) - if ((chld.YTopMost + yStart + yTop - yTopParent) > yLowerLimit) - if ((chld.YTopMost + yStart + yTop - yTopParent) < yUpperLimit) - 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 - } - - // B2020-081 used in HasSecondRNOThatWillFit() get the size of the AER and its substeps - private float YBottomMostExcludingRNO(vlnParagraph chld) - { - float maxBottomMost = chld.YBottom; - foreach (vlnParagraph gChld in chld.ChildrenBelow) - if (gChld.MyItemInfo.IsRNOPart == false) - maxBottomMost = Math.Max(maxBottomMost, YBottomMostExcludingRNO(gChld)); - return maxBottomMost; - } - - private static bool StepWillFitOnBlankPageButNotOnCurrentPage(vlnParagraph myPara, float yLocation, float yStart,float fullPage) - { - // B2019-150 & B2019-151 Pagination Bugs Seen for Summer EOP4.1 Step 10 and - // SAG Step 9. Added format flag to limit when this logic would be used. - if (myPara.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnStepThatWillFitOnBlankPage == false) - return false; - float spaceOnCurrentPage = fullPage - (-yLocation+yStart); - // B2019-124 - Pagination - if substep will fit on a blank page but will not fit on the current page - // And is not the first substep then break - // B2019-130 - in Calvert data (FSG-1 Appendix 1 Unit 1 Actions, step E.1.g) the THEN sub step was placed on the next page - // the THEN sub step is at the same level as the bullet items above it (is a bullet item changed to a paragraph) - // We added a check for this via current content type vs previous content type. - return (myPara.MyItemInfo.Ordinal > 1 && myPara.MyItemInfo.MyContent.Type == myPara.MyItemInfo.MyPrevious.MyContent.Type && myPara.YSize > spaceOnCurrentPage && myPara.YSize < fullPage); - } - private static bool InSameBox(vlnParagraph myPara, vlnParagraph minPara2) - { - // see if this paragraph is a note/caution or in a note/caution where its 1st sibling is the input minPara2 (this - // is the next best-case page break location. This was added for Calvert's OI3/OI-1A/Section 5/Step H.3. Without it - // the page break occurred in the middle of the list of notes. - if (minPara2 == null) return false; - if ((myPara.MyItemInfo.IsCaution || myPara.MyItemInfo.IsNote || myPara.MyItemInfo.MyParent.IsCaution || myPara.MyItemInfo.MyParent.IsNote) && minPara2 != null) - { - ItemInfo mync = (myPara.MyItemInfo.IsNote || myPara.MyItemInfo.IsCaution) ? myPara.MyItemInfo : myPara.MyItemInfo.MyParent; - if (mync == null) return false; - if (mync.FirstSibling.ItemID == minPara2.MyItemInfo.ItemID) return true; - } - return false; - } - private static int MaxBreakLevel(float yLocation, StepLevelList myList, int maxLevel, vlnParagraph myParaBreak) - { - foreach (int stepLevel in myList.Keys) - foreach (float yLoc in myList[stepLevel].Keys) - { - vlnParagraph myPara = myList[stepLevel][yLoc]; - if (Overlap(myPara, myParaBreak)) - if (stepLevel > maxLevel) - { - //DebugPagination.WriteLine("'MaxBreakLevel',{0},{1},'{2}'", myPara.MyItemInfo.ItemID, stepLevel, myPara.MyItemInfo.ShortPath); - //Console.WriteLine("'MaxBreakLevel',{0},{1},'{2}'", myPara.MyItemInfo.ItemID, stepLevel, myPara.MyItemInfo.ShortPath); - - if (!myPara.HasAncestor(myParaBreak)) - maxLevel = stepLevel; - } - } - return maxLevel; - } - private static bool Overlap(vlnParagraph myPara, vlnParagraph myParaBreak) - { - // Fix for B2016-166: Calvert pagination-splitting a Note in AER from its associated step - if (myPara.MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertPagination) - return (myPara.YOffset <= myParaBreak.YOffset && - (myPara.YOffset + myPara.Height) >= myParaBreak.YOffset); - return(myPara.YOffset == myParaBreak.YOffset); - } - private bool HasAncestor(vlnParagraph myParaBreak) - { - if (myParaBreak == MyParent) return true; - if (MyParent == null || MyParent.MyItemInfo.IsHigh) return false; - 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 - { - get // B2019-111 Keep AER Table with parent when RNO extends past the end of the page. - { - float tsa = 0; - float tsaRight = 0; - float btm = YBottom; - float btmRight = 0; - if (_ChildrenRight != null && _ChildrenRight.Count > 0) - { - tsaRight = _ChildrenRight[0].TableSpaceAvailable; - btmRight = _ChildrenRight[0].YBottomPagination; - } - if (_ChildrenBelow != null && _ChildrenBelow.Count > 0) - { - foreach (vlnParagraph pgh in _ChildrenBelow) - tsa = pgh.TableSpaceAvailable; - vlnParagraph pLast = ChildrenBelow[ChildrenBelow.Count - 1]; - btm = pLast.YBottomPagination; - } - // TableSpaceAvailable is SpaceAvailable (Amount of white space there is to work with in table) + - // LeadingSpaceAvailable (Amount of space taken up by space between lines, leading - fontsize) - if (MyGrid != null) - tsa = MyGrid.SpaceAvailable + MyGrid.LeadingSpaceAvailable; - if (btmRight != 0) - { - //_MyLog.WarnFormat("Item={00}, B={1} BR={2} T={3} TR={4}",MyItemInfo.ItemID , btm, btmRight, tsa, tsaRight); - if (btm < btmRight) - tsa = tsaRight; - } - return tsa; - } - } - } - public partial class VlnSvgPageHelper : SvgPageHelper - { - private bool _OriginalPageBreak; // use 16bit page breaks. - public bool OriginalPageBreak - { - get { return _OriginalPageBreak; } - set { _OriginalPageBreak = value; } - } - // This handles Page Breaks within a Step - private List _ParaBreaks = new List(); - public List ParaBreaks - { - get { return _ParaBreaks; } - set { _ParaBreaks = value; } - } - } -} diff --git a/PROMS/Volian.Print.Library/Placekeeper.cs b/PROMS/Volian.Print.Library/Placekeeper.cs deleted file mode 100644 index a206f917..00000000 --- a/PROMS/Volian.Print.Library/Placekeeper.cs +++ /dev/null @@ -1,393 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using LBWordLibrary; -using VEPROMS.CSLA.Library; -using System.Text.RegularExpressions; - -namespace Volian.Print.Library -{ - public class Placekeeper : IDisposable - { - private LBApplicationClass _WordApp; - private LBDocumentClass _WordDoc; - private LBSelection _WordSel; - 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 VE_Font _pkFont; - public Placekeeper() - { - _WordApp = new LBApplicationClass(); - _WordDoc = _WordApp.Documents.Add(); - _WordSel = _WordApp.Selection; - _pkFont = new VE_Font("Arial", 11, E_Style.None, 12); // Calvert uses Arial for their Placekeepers. - } - public void Visible() - { - _WordApp.Visible = true; - _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) - { - _WordApp = new LBApplicationClass(); - _WordDoc = _WordApp.Documents.Add(); - _WordSel = _WordApp.Selection; - //_WordApp.Visible = true; - _pkFont = pkFont; - AddTable(); - AddHeader(); - foreach (pkParagraph myPlacekeeper in myPlacekeepers) - { - if(myPlacekeepers.Count > 1) - AddSectionHeader(myPlacekeeper.MyParagraph.MyItemInfo.DisplayNumber, myPlacekeeper.MyParagraph.MyItemInfo.FormattedDisplayText); - foreach (pkParagraph pgh in myPlacekeeper.MyChildren) - { - foreach (pkParagraph pghC in pgh.MyCautionsAndNotes) - { - StepConfig sc = pghC.MyParagraph.MyItemInfo.MyConfig as StepConfig; - string doneStr = (sc.Step_Placekeeper.ToUpper() == "C")? "C":""; - string NoteCautionTab = "NOTE: "; - if (pghC.MyParagraph.MyItemInfo.IsCaution) NoteCautionTab = "CAUTION: "; - AddCautionOrNote(NoteCautionTab, pghC.MyParagraph.MyItemInfo.FormattedDisplayText, doneStr, (pghC.MyParagraph.MyItemInfo.PageNumber+1).ToString()); - } - AddHighLevelStep(pgh.MyParagraph.MyItemInfo.MyTab.CleanText, pgh.MyParagraph.MyItemInfo.FormattedDisplayText, pgh.MyParagraph.MyItemInfo.FormatStepType == 9 ? "C" : "", (pgh.MyParagraph.MyItemInfo.PageNumber + 1).ToString()); - if (pgh.MyChildren.Count > 0) - { - bool conAct = false; - StartSubStep(); - AddChildren(pgh, 1, ref conAct); - FinishSubstep((conAct)?"C":"", ""); - } - } - } - RepeatHeader(); - } - - private void AddChildren(pkParagraph pgh, int level, ref bool conAct) - { - foreach (pkParagraph cpgh in pgh.MyChildren) - { - - if (cpgh.MyCautionsAndNotes.Count > 0) - AddNotesOrCautions(cpgh,level, ref conAct); - if (!conAct) - conAct = IsContinuousActionPlacekeeper(conAct, cpgh); - ContinueSubStep(cpgh.MyParagraph.MyItemInfo.FormattedDisplayText, level); - AddChildren(cpgh, level+1, ref conAct); - } - } - - private void AddNotesOrCautions(pkParagraph pgh, int level, ref bool conAct) - { - foreach (pkParagraph cpgh in pgh.MyCautionsAndNotes) - { - if (!conAct) - conAct = IsContinuousActionPlacekeeper(conAct, cpgh); - ContinueNoteOrCaution(cpgh.MyParagraph.MyItemInfo, level); - } - } - - private static bool IsContinuousActionPlacekeeper(bool conAct, pkParagraph pkPar) - { - StepConfig sc = pkPar.MyParagraph.MyItemInfo.MyConfig as StepConfig; - conAct = (sc.Step_Placekeeper.ToUpper() == "C"); - return conAct; - } - - private void ContinueNoteOrCaution(ItemInfo ii, int level) - { - string NoteCautionTab = "NOTE: "; - if (ii.IsCaution) NoteCautionTab = "CAUTION: "; - if (!_FirstLine) _WordSel.TypeParagraph(); - _FirstLine = false; - SetIndent(.33F + (.31F * level), -.31F); - WriteCell(NoteCautionTab + ii.FormattedDisplayText, false, false); - } - public void BuildSample() - { - _WordSel.TypeText("Placekeeper"); - _WordSel.TypeParagraph(); - _WordApp.Visible = true; - AddTable(); - AddHeader(); - AddSectionHeader("Section VI", "Title for section VI"); - AddHighLevelStep("A.", TheQuickBrownFox, "C", "5"); - AddSubStep(TheQuickBrownFox, "C", ""); - AddCautionOrNote("NOTE:", "The Note text has a hanging indent on all but the first line of text", "", ""); - AddHighLevelStep("B.", TheQuickBrownFox, "C", "7"); - StartSubStep(); - ContinueSubStep(TheQuickBrownFox, 1); - ContinueSubStep(TheQuickBrownFox, 2); - ContinueSubStep(TheQuickBrownFox, 2); - ContinueSubStep(TheQuickBrownFox, 3); - ContinueSubStep(TheQuickBrownFox, 3); - ContinueSubStep(TheQuickBrownFox, 2); - ContinueSubStep(TheQuickBrownFox, 1); - FinishSubstep("", ""); - AddHighLevelStep("C.", TheQuickBrownFox, "C", "8"); - StartSubStep(); - ContinueSubStep(TheQuickBrownFox, 1); - ContinueSubStep(TheQuickBrownFox, 2); - ContinueSubStep(TheQuickBrownFox, 2); - ContinueSubStep(TheQuickBrownFox, 3); - ContinueSubStep(TheQuickBrownFox, 3); - ContinueSubStep(TheQuickBrownFox, 2); - ContinueSubStep(TheQuickBrownFox, 1); - FinishSubstep("", ""); - RepeatHeader(); - } - - private void RepeatHeader() - { - _WordTbl.Rows.First.Select(); - _WordSel.Rows.HeadingFormat = -1; - } - private bool _FirstSection = true; - private void AddTable() - { - _FirstSection = true; - _WordTbl = _WordDoc.Tables.Add(_WordSel.Range, 1, 4, 1, 0); - _WordTbl.TopPadding = 6F; - _WordTbl.BottomPadding = 6F; - LBColumn col = _WordTbl.Columns.First; - //col.SetWidth(12F, LBWdRulerStyle.wdAdjustNone); - //col = col.Next; - col.SetWidth(72 * .91F, LBWdRulerStyle.wdAdjustNone); - col = col.Next; - col.SetWidth(72 * 4.1F, LBWdRulerStyle.wdAdjustNone); - col = col.Next; - //col.SetWidth(72 * .81F, LBWdRulerStyle.wdAdjustNone); - col.SetWidth(72 * .76F, LBWdRulerStyle.wdAdjustNone); - col = col.Next; - //col.SetWidth(72 * .81F, LBWdRulerStyle.wdAdjustNone); - col.SetWidth(72 * .76F, LBWdRulerStyle.wdAdjustNone); - _WordTbl.Rows.AllowBreakAcrossPages = 0; - } - private void AddHeader() - { - //Advance(); - WriteCell("START", true, true); - SetIndent(0.32F, -0F); - WriteCell("FUNCTION", true, true); - WriteCell("DONE", true, true); - WriteCell("PAGE", true, false); - } - private void AddSectionHeader(string number, string title) - { - if (!_FirstSection) - { - Advance(5); - _WordSel.MoveLeft(LBWdUnits.wdCell, 1, false); - _WordSel.SelectRow(); - _WordSel.Cells.Merge(); - } - _FirstSection = false; - Advance(2); - SetIndent(0, 0); - WriteCell("SECTION " + number, true, false); - WriteCell(" " + title, false, true); - Advance(); - } - private float GetTextWidth(string txt) - { - // 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 - // 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); - iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); - float w = 0; - foreach (char c in txt) - { - 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; - } - private void AddHighLevelStep(string number, string text, string done, string page) - { - // if the text contains prerequisite steps, - // parse out the step numbers and place them in the first column - if (text.Contains(@"\{Prerequisite Step: ")) - { - string prereqToken = @"\{Prerequisite Step: "; - string preqStp = ""; - int idx = text.IndexOf(prereqToken); - while (idx >= 0) - { - int parseStart = idx+prereqToken.Length; - int endx = text.IndexOf(@"\}",parseStart); - int parseLen = endx - parseStart; - preqStp += "("+text.Substring(parseStart, parseLen) + "), "; - text = text.Remove(idx, endx+2 - idx); - idx = text.IndexOf(prereqToken); - } - Advance(1); - preqStp = preqStp.Substring(0, preqStp.Length - 2); // remove ending ", " - WriteCell(preqStp, false, true); - } - else - Advance(2); - if (text.Contains("\x05")) // hanging indent character - { - string[] parts = text.Split("\x05".ToCharArray()); - float ind = (GetTextWidth(number) + GetTextWidth(parts[0])) / 72f; - SetIndent(ind, -ind); - WriteCell(number + parts[0] + parts[1], false, true); - } - else - { - SetIndent(.33F, -.33F); - WriteCell(number + text, false, true); - } - SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom); - WriteCell(done, false, true); - SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom); - WriteCell(page, false, false); - } - private void AddSubStep(string text, string done, string page) - { - Advance(2); - SetIndent(.64F, -.31F); - //_WordSel.InsertSymbol(8226, _WordSel.Font, System.Reflection.Missing.Value, System.Reflection.Missing.Value); - WriteCell("\u2022" + "\t" + text, false, true); - SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom); - WriteCell(done, false, true); - SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom); - WriteCell(page, false, false); - } - private bool _FirstLine = false; - private void StartSubStep() - { - _FirstLine = true; - Advance(2); - SetIndent(.64F, -.31F); - } - private void ContinueSubStep(string text, int level) - { - if(!_FirstLine) _WordSel.TypeParagraph(); - _FirstLine = false; - SetIndent(.33F + (.31F * level), -.31F); - WriteCell("\u2022" + "\t" + text, false, false); - } - private void FinishSubstep(string done, string page) - { - Advance(); - SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom); - WriteCell(done, false, true); - SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom); - WriteCell(page, false, false); - } - private void AddCautionOrNote(string type, string text, string done, string page) - { - Advance(2); - SetIndent(.33F, -.33F); - WriteCell(type, true, false); - WriteCell(" " + text, false, true); - SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom); - WriteCell(done, false, true); - SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom); - WriteCell(page, false, false); - } - static Regex rgx = new Regex(@"\\(b|ul|up[1-9]|dn0|up0|dn[1-9]|b0|ulnone)( |$|(?=\\))"); - private void WriteRTF(string text) - { - //if (text.Contains("\\")) - // Console.WriteLine("here"); - Match m = rgx.Match(text); - while (m.Success) - { - if (m.Index > 0) - _WordSel.TypeText(text.Substring(0,m.Index)); - switch (m.Groups[1].Value) - { - case "b": // bold on - _WordSel.Font.Bold = 1; - break; - case "b0": // bold off - _WordSel.Font.Bold = 0; - break; - case "ul": // underline on - _WordSel.Font.Underline = LBWdUnderline.wdUnderlineSingle; - break; - case "ulnone": // underline off - _WordSel.Font.Underline = LBWdUnderline.wdUnderlineNone; - break; - case "dn0": // superscript off - _WordSel.Font.Superscript = 0; - break; - case "up0": // subscript off - _WordSel.Font.Subscript = 0; - break; - default: - if (m.Groups[1].Value.StartsWith("dn"))// subscript on - _WordSel.Font.Subscript = 1; - else // superscript on - _WordSel.Font.Superscript = 1; - break; - - } - text = text.Substring(m.Index+m.Length); - m = rgx.Match(text); - } - _WordSel.TypeText(text); - } - private void WriteCell(string text, bool bold, bool advance) - { - _WordSel.Font.Name = _pkFont.Family;//"Arial"; - _WordSel.Font.Bold = bold ? 1 : 0; - //_WordSel.TypeText(text); - WriteRTF(text); - if (advance) Advance(); - } - private void SetIndent(float left, float first) - { - _WordSel.ParagraphFormat.LeftIndent = left * 72; - _WordSel.ParagraphFormat.FirstLineIndent = first * 72; - } - private void SetAlignment(LBWdParagraphAlignment hAlign, LBWdCellVerticalAlignment vAlign) - { - _WordSel.ParagraphFormat.Alignment = hAlign; - _WordSel.Cells.VerticalAlignment = vAlign; - } - private void Advance(int count) - { - _WordSel.MoveRight(LBWdUnits.wdCell, count, false); - } - private void Advance() - { - Advance(1); - } - public void Dispose() - { - _WordApp.Quit(false); - } - } -} diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs deleted file mode 100644 index dcd0572a..00000000 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ /dev/null @@ -1,3053 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using VEPROMS.CSLA.Library; -using Volian.Svg.Library; -using iTextSharp.text.factories; -using iTextSharp.text; -using iTextSharp.text.pdf; -using System.Text.RegularExpressions; -using System.IO; -using System.Xml; -using System.Windows.Forms; -using LBWordLibrary; -using System.Drawing; -using System.Drawing.Imaging; -using Volian.Controls.Library; -using Volian.Base.Library; -using JR.Utils.GUI.Forms; - -namespace Volian.Print.Library -{ - public delegate void PromsPrinterStatusEvent(object sender, PromsPrintStatusArgs args); - public class PromsPrintStatusArgs - { - private string _MyStatus; - public string MyStatus - { - get { return _MyStatus; } - } - private DateTime _When = DateTime.Now; - public DateTime When - { - get { return _When; } - } - private PromsPrinterStatusType _Type; - public PromsPrinterStatusType Type - { - get { return _Type; } - set { _Type = value; } - } - private int _Progress = 0; - - public int Progress - { - get { return _Progress; } - set { _Progress = value; } - } - public PromsPrintStatusArgs(string myStatus, PromsPrinterStatusType type) - { - _MyStatus = myStatus; - _Type = type; - } - public PromsPrintStatusArgs(string myStatus, PromsPrinterStatusType type, int progress) - { - _MyStatus = myStatus; - _Type = type; - _Progress = progress; - } - } - public enum PromsPrinterStatusType - { - Start, - General, - MSWordToPDF, - PageList, - Watermark, - Read16, - Merge16, - Open16, - ReadMSWord, - MergeMSWord, - OpenMSWord, - OpenPDF, - Merge, - Total, - CloseDocument, - NewPage, - BuildSVG, - SetSVG, - SetPageEvent, - GetSection, - Before, - BuildStep, - Progress, - ProgressSetup, - LoadVlnParagraph - } - - //B2025-048 Problem with Printing CAS Steps - public enum PromsPrinterPrintType - { - Normal, - CAS_Only, - TCAS_only - } - public class PromsPrinter - { - public bool NeedSupInfoBreak = false; - public E_SupInfoPrintType SupInfoPrintType = E_SupInfoPrintType.None; - // used to link supinfo steps in pdf - public int SupInfoPdfPageCount = -1; - private Dictionary _SupInfoPdfPage; - public Dictionary SupInfoPdfPage - { - get { return _SupInfoPdfPage; } - set { _SupInfoPdfPage = value; } - } - private bool _DoingFacingPage = false; // used to flag actual pdf generation of facing page within final print (so no section titles get printed) - public bool DoingFacingPage - { - get { return _DoingFacingPage; } - set { _DoingFacingPage = value; } - } - // used to save word sections with resolved ROs (for export file generated from approve) - private Dictionary _DocReplace; - public Dictionary DocReplace - { - get { return _DocReplace; } - set { _DocReplace = value; } - } - private bool _SaveLinks = false; - public bool SaveLinks - { - get { return _SaveLinks; } - set { _SaveLinks = value; } - } - // C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. - // Use these 2 lists to track the items that will need to be saved after removing trailing newlines/spaces or - // manual page breaks, if the user selects to do that. - private List _RemoveTrailingHardReturnsAndSpaces = null; - public List RemoveTrailingHardReturnsAndSpaces - { - get { return _RemoveTrailingHardReturnsAndSpaces; } - set { _RemoveTrailingHardReturnsAndSpaces = value; } - } - private List _RemoveManualPageBreaks = null; - public List RemoveManualPageBreaks - { - get { return _RemoveManualPageBreaks; } - set { _RemoveManualPageBreaks = value; } - } - - private string _Prefix = ""; // RHM20150506 Multiline ItemID TextBox - public string Prefix - { - get { return _Prefix; } - set { _Prefix = value; } - } - - // B2024-062 Set to true when the procedure being printed has no content. - // When set to true, will prevent the "Try Again" dialog from appearing - // and simply exit the print function - private bool _EmptyProcedure = false; - public bool EmptyProcedure - { - get { return _EmptyProcedure; } - } - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - public event PromsPrinterStatusEvent StatusChanged; - internal void OnStatusChanged(object sender, PromsPrintStatusArgs args) - { - if (StatusChanged != null) - StatusChanged(sender, args); - } - internal void OnStatusChanged(string myStatus, PromsPrinterStatusType type) - { - OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type)); - } - public void OnStatusChanged(string msg) - { - OnStatusChanged(this, new PromsPrintStatusArgs(msg, PromsPrinterStatusType.General)); - } - internal void OnStatusChanged(string myStatus, PromsPrinterStatusType type, int progress) - { - OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type, progress)); - } - private string _Rev; - private ItemInfo _MyItem; - public ItemInfo MyItem - { - get { return _MyItem; } - set { _MyItem = value; } - } - private string _Watermark; - private string _WatermarkColor; - //C2018-009 print PROMS version - private string _PromsVersion = ""; - public string PromsVersion - { - get { return _PromsVersion; } - set { _PromsVersion = value; } - } - private string _PDFFile; - public string PDFFile - { - get { return _PDFFile; } - set { _PDFFile = value; } - } - private int _prtSectID = -1; - public int PrtSectID - { - get { return _prtSectID; } - set { _prtSectID = value; } - } - private bool _DebugOutput; - public bool DebugOutput - { - get { return _DebugOutput; } - set { _DebugOutput = value; } - } - private string _BackgroundFolder; - public string BackgroundFolder - { - get { return _BackgroundFolder; } - set { _BackgroundFolder = value; } - } - private bool _OpenPDF; - - public bool OpenPDF - { - get { return _OpenPDF; } - set { _OpenPDF = value; } - } - private bool _OverWrite; - - public bool OverWrite - { - get { return _OverWrite; } - set { _OverWrite = value; } - } - private ChangeBarDefinition _MyChangeBarDefinition; - public ChangeBarDefinition MyChangeBarDefinition - { - get { return _MyChangeBarDefinition; } - set { _MyChangeBarDefinition = value; } - } - private bool _OriginalPageBreak; // use 16bit page breaks. - public bool OriginalPageBreak - { - get { return _OriginalPageBreak; } - set { _OriginalPageBreak = value; } - } - private bool _InsertBlankPages; - public bool InsertBlankPages - { - get { return _InsertBlankPages; } - set { _InsertBlankPages = value; } - } - private bool _BatchPrint = true; // flags that a batch-type print is occurring, i.e. AllProcedures or Automatic testing - public bool BatchPrint - { - get { return _BatchPrint; } - set { _BatchPrint = value; } - } - // B2020-159: When printing, if forced pagination errors occurred (see Pagination.cs), put up a dialog with - // the places they occurred. Do not do this is running baseline/automatic print testing. - private static List _ForcedPaginations = null; - public static List ForcedPaginations - { - get { return PromsPrinter._ForcedPaginations; } - set { PromsPrinter._ForcedPaginations = value; } - } - public static DialogResult ReportForcedPaginations() - { - if (ForcedPaginations != null && ForcedPaginations.Count > 0) - { - string pnProbl = null; - foreach (string pstr in ForcedPaginations) - pnProbl = pnProbl + "\r\n" + pstr; - Clipboard.SetText(pnProbl); - return FlexibleMessageBox.Show( - "PROMS has identified location(s) in the PDF file that was created that may not have paginated correctly." - + "\r\nOn or around the following pages should be reviewed to ensure that the procedure is correct." - + "\r\nVerify that there is no missing text on the page(s) designated." - + "\r\nIf not correct, the procedure writer will have to modify the procedure content or add hard returns." - + "\r\nContact Volian if assistance is needed." - + "\r\nThe following list was placed on the Windows Clipboard." - + "\r\n\r\nPDF File\t\tSection/Step\t\t\tPDF Page No.\r\n" + pnProbl, - "Forced Pagination", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - return DialogResult.OK; - } - private static List _TransPageNumProblems = null; - public static List TransPageNumProblems - { - get { return PromsPrinter._TransPageNumProblems; } - set { PromsPrinter._TransPageNumProblems = value; } - } - public static void ClearTransPageNumProblems() - { - _TransPageNumProblems = null; - } - public static DialogResult ReportTransPageNumProblems() - { - if (TransPageNumProblems != null && TransPageNumProblems.Count > 0) - { - string pnProbl = null; - foreach (string pstr in TransPageNumProblems) - pnProbl = pnProbl + "\r\n" + pstr; - Clipboard.SetText(pnProbl); - return FlexibleMessageBox.Show("The following list was placed on the Windows Clipboard." - + "\r\nIt shows the page numbers of the locations that are referenced by transitions." - + "\r\nThis list, along with the PDF, can help you to determine the cause of the inconsistent page numbers." - + "\r\n\r\nDo you want to also review the PDF output prior to the second pass printing?" - // C2017-018 Output Column Headers for Inconsistent Page Transitions - + "\r\n\r\nItemID\tTransition Destination\tPage Pass 1\t Page Pass 2\r\n\r\n" + pnProbl, - "Inconsistent Transition Page Numbers", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - } - return DialogResult.No; - } - private ReaderHelper _MyReaderHelper; - public ReaderHelper MyReaderHelper - { - get { return _MyReaderHelper; } - set { _MyReaderHelper = value; } - } - private string _BlankPageText; // C2019-004: Allow user to define duplex blank page text - public string BlankPageText - { - get { return _BlankPageText; } - set { _BlankPageText = value; } - } - // use DidAll & MergeNotIncuded to know that printing all (not single) was done. Used w/ merge code to know when to return, i.e. not include in merged pdf - private bool _DidAll; - public bool DidAll // value passed in from frmPdfStatusForm - { - get { return _DidAll; } - set { _DidAll = value; } - } - private bool _MergeNotIncluded; - public bool MergeNotIncluded - { - get { return _MergeNotIncluded; } - set { _MergeNotIncluded = value; } - } - private MergedPdf _MergedPdf; - public MergedPdf MergedPdf - { - get { return _MergedPdf; } - set { _MergedPdf = value; } - } - - //B2025-048 Problem with Printing CAS Steps - // default to Normal - // will skip certain logic if CAS Only or CTS Only - public PromsPrinterPrintType PromsPrinterPrintType { get; set; } = PromsPrinterPrintType.Normal; - - //B2025-054 Wrong Page Numbers in CAS Summary - // when section title continued and CAS - // Flag for when should build the CAS_CTAS - //to avoid overwriting data - public bool ShouldPrint_CAS_CTAS { get; set; } = true; - - public PromsPrinter(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, string backgroundFolder, bool openPDF, bool overWrite, - ChangeBarDefinition cbd, String pdfFile, bool insertBlankPages, bool batchPrint, string prefix, bool saveLinks, int removeTrailngHardReturnsAndManualPageBreaks, string blankPageText, bool didAll, MergedPdf mergedPdf, string watermarkColor, int PrtSectID = -1) - { - Prefix = prefix; // RHM20150506 Multiline ItemID TextBox - _MyItem = myItem; - _Rev = rev; - _Watermark = watermark; - _WatermarkColor = watermarkColor; - _DebugOutput = debugOutput; - _BackgroundFolder = backgroundFolder; - _OpenPDF = openPDF; - _OverWrite = overWrite; - _MyChangeBarDefinition = cbd; - _PDFFile = pdfFile; - _OriginalPageBreak = origPgBrk; - _InsertBlankPages = insertBlankPages; - _BatchPrint = batchPrint; - _MyReaderHelper = new ReaderHelper(this); - _SaveLinks = saveLinks; - // C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. - if (removeTrailngHardReturnsAndManualPageBreaks == 1 || removeTrailngHardReturnsAndManualPageBreaks == 3) RemoveTrailingHardReturnsAndSpaces = new List(); - if (removeTrailngHardReturnsAndManualPageBreaks == 2 || removeTrailngHardReturnsAndManualPageBreaks == 3) RemoveManualPageBreaks = new List(); - _BlankPageText = blankPageText; - _DidAll = didAll; - _MergeNotIncluded = false; - _MergedPdf = mergedPdf; - _prtSectID = PrtSectID; - //_MyReaderHelper.LoadTree(myItem); - } - // Pass 1 PDF Name - private string _BeforePageNumberPdf = null; - public string BeforePageNumberPdf - { - get { return _BeforePageNumberPdf; } - set { _BeforePageNumberPdf = value; } - } - // Pass 2 PDF Name - private string _BeforePageNumber2Pdf = null; - public string BeforePageNumber2Pdf - { - get { return _BeforePageNumber2Pdf; } - set { _BeforePageNumber2Pdf = value; } - } - // B2019-152: MergedLandscapePages is a dictionary whose key is the pdf file name & values are all of the page numbers - // in that pdf that should have landscaped page numbers. These are added when the page is finished (onEndPage) - public static Dictionary> MergedLandscapePages = null; - public string Print(string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary, bool makeTimeCriticalActionSummary, int PrtSectID = -1) - { - if (_MyItem is ProcedureInfo) - { - _prtSectID = PrtSectID; - ProcedureConfig pcfg = (ProcedureConfig)(_MyItem as ProcedureInfo).MyConfig; - if (DidAll && pcfg.Print_NotInMergeAll) // will be merging a pdf, so don't print this procedure if user set that on procedure propertures - { - _MergeNotIncluded = true; - return null; - } - // B2017-186 First do Procedures that don't have page number transitions - if (!(_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || - _MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)) - { - // B2017-186 Do Facing Page SAMGs - if ((_MyItem as ProcedureInfo).ProcHasSupInfoData) - { - // Use two passes to print facing page supplemental information for SAMGs - // First pass gets pagination for the step sections and stores the associated supplemental information ids in - // the list StepSectPageBreaksForSupInfo off of the section object - // Second pass prints the supplemental information pdfs using the list generated in the first pass to know where to do the - // supplemental information page breaks & then merges in those pages when printing the step sections. - SectionInfo.ResetLookupStepSectPageBreaks(); // B2017-192: Reset lists for tracking page breaks - SectionInfo.ResetLookupStepSectPageBreaksForSupInfo(); - SupInfoPrintType = E_SupInfoPrintType.DoPageBreaks; - string retstr = Print(_MyItem as ProcedureInfo, pdfFolder, false, false, false); - if (retstr == null) return null; - SupInfoPrintType = E_SupInfoPrintType.Merge; - string tmps = Print(_MyItem as ProcedureInfo, pdfFolder, false, false, false); - if (!BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting - { - ReportForcedPaginations(); - ForcedPaginations.Clear(); - } - return tmps; - } - else // B2017-186 Neither Facing Pages or Page Number Transitions - { - string tmpss = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary, makeTimeCriticalActionSummary); - if (!BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting - { - ReportForcedPaginations(); - ForcedPaginations.Clear(); - } - return tmpss; - } - } - else // B2017-186 Page Number Transitions - { - string retstr; - // if the plant uses transition modifiers and/or page num in transition format, - // need to do two passes. First pass, sets the pagenumbers for each item, - // 2nd pass fills in the page numbers in transitions. - DirectoryInfo di = new DirectoryInfo(pdfFolder + @"\PageNumberPass1"); - if (!di.Exists) di.Create(); - if ((_MyItem as ProcedureInfo).ProcHasSupInfoData)// B2017-186 Adds Facing Page Code to Page Number Transition Code - { - // Use two passes to print facing page supplemental information for SAMGs - // First pass gets pagination for the step sections and stores the associated supplemental information ids in - // the list StepSectPageBreaksForSupInfo off of the section object - // Second pass prints the supplemental information pdfs using the list generated in the first pass to know where to do the - // supplemental information page breaks & then merges in those pages when printing the step sections. - SupInfoPrintType = E_SupInfoPrintType.DoPageBreaks; - retstr = Print(_MyItem as ProcedureInfo, pdfFolder, false, false, false); - if (retstr == null) return null; - SupInfoPrintType = E_SupInfoPrintType.Merge; - } - retstr = Print(_MyItem as ProcedureInfo, pdfFolder + @"\PageNumberPass1", false, false, false); - if (retstr == null) return null; - BeforePageNumberPdf = retstr; - BeforePageNumber2Pdf = null; // C2017-018 Initialize Pass 2 PDF Name - ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo); - _MyReaderHelper = new ReaderHelper(this); - retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary, makeTimeCriticalActionSummary); - if (!BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting - { - ReportForcedPaginations(); - ForcedPaginations.Clear(); - } - - if (TransPageNumProblems.Count > 0) - { - if (BatchPrint || (MessageBox.Show("Page Number Transitions may be fixed if a second pass is performed. Do you want to perform a second pass?", "Page Number Transition Errors", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)) - { - DirectoryInfo di1 = new DirectoryInfo(pdfFolder + @"\PageNumberPass2"); - if (!di1.Exists) di1.Create(); - FileInfo fi = new FileInfo(retstr); - // Save Pass 2 PDF Name - FileInfo fidest = new FileInfo(BeforePageNumber2Pdf = di1.FullName + @"\" + fi.Name); - if (fidest.Exists) fidest.Delete(); - try - { - fi.MoveTo(di1.FullName + @"\" + fi.Name); - } - catch (Exception ex) - { - _MyLog.ErrorFormat("{0} During Save {1}", ex.GetType().FullName, ex.Message); - } - ClearTransPageNumProblems(); - RefreshPageNumber(_MyItem); - ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo); - _MyReaderHelper = new ReaderHelper(this); - retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary, makeTimeCriticalActionSummary); - } - } - return retstr; - } - } - return ""; - } - - private void RefreshPageNumber(ItemInfo _MyItem) - { - // set all page numbers for all items under the passed in procedure item - _MyItem.PageNumber = _MyItem.PageNumberNextPass; - if (_MyItem.MyContent.ContentPartCount > 0) - { - foreach (PartInfo pi in _MyItem.MyContent.ContentParts) - { - foreach (ItemInfo ii in pi.MyItems) - RefreshPageNumber(ii); - } - } - } - internal string BuildMSWordPDF(SectionInfo section) - { - DateTime tStart = DateTime.Now; - string MSWordFile = null; - if (section.MyContent.ContentEntryCount == 1) - { - MSWordToPDF.DocReplace = DocReplace; - MSWordFile = MSWordToPDF.GetDocPdf(section, PrintOverride.TextColor); - MSWordToPDF.DocReplace = null; - //GC.Collect(); // memory garbage collection - OnStatusChanged("MSWord converted to PDF " + MSWordFile, PromsPrinterStatusType.MSWordToPDF); - } - return MSWordFile; - } - private static void AddImportedPageToLayer(PdfContentByte cb, PdfLayer layer, PdfImportedPage page, float xOff, float yOff) - { - cb.BeginLayer(layer); - iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(page); - - // the following checks if the content of page is landscape and rotates because we're printing on - // a portrait page. If, at some point, we print a total landscape page, not a mix, this will need - // re-evaluated. - if (page.Height < page.Width) - { - if (cb.PdfDocument.PageSize.Height > cb.PdfDocument.PageSize.Width) - image.RotationDegrees = 90F; - } - image.SetAbsolutePosition(xOff, yOff); - cb.AddImage(image); - cb.EndLayer(); - } - private PdfLayer _TextLayer; - private PdfLayer _BackgroundLayer; - private PdfLayer _MSWordLayer; - private PdfLayer _PagelistLayer; - private PdfLayer _DebugLayer; - private PdfLayer _WatermarkLayer; - private PdfLayer _PROMSVersionLayer; //C2018-009 print PROMS version - private void CreateLayers(PdfContentByte cb) - { - if (DebugOutput) - { - _BackgroundLayer = new PdfLayer("16-Bit", cb.PdfWriter); - _MSWordLayer = new PdfLayer("32-Bit MSWord", cb.PdfWriter); - _PagelistLayer = new PdfLayer("32-Bit Pagelist", cb.PdfWriter); - _TextLayer = new PdfLayer("32-Bit Text", cb.PdfWriter); - _DebugLayer = new PdfLayer("Debug", cb.PdfWriter); - _WatermarkLayer = new PdfLayer("Watermark", cb.PdfWriter); - _WatermarkLayer.SetPrint("Watermark", true); - _PROMSVersionLayer = new PdfLayer("PROMS Version", cb.PdfWriter); //C2018-009 print PROMS version - _PROMSVersionLayer.SetPrint("PROMS Version", true); - } - } - public static int ProcPageCount = -1; // Used to count page numbers in each pdf. This will be used if/when pdfs are merged together. - private void CloseDocument(string fileName) - { - int profileDepth = ProfileTimer.Push(">>>> CloseDocument"); - try - { - ProcPageCount = MyContentByte.PdfWriter.CurrentPageNumber - 1; - MyContentByte.PdfDocument.Close(); - MyContentByte = null; - } - catch (Exception ex) - { - Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); - } - OnStatusChanged("CloseDocument", PromsPrinterStatusType.CloseDocument); - if (OpenPDF) - System.Diagnostics.Process.Start(fileName); - OnStatusChanged("OpenPDF", PromsPrinterStatusType.OpenPDF); - ProfileTimer.Pop(profileDepth); - } - private PdfContentByte _MyContentByte = null; - public PdfContentByte MyContentByte - { - get { return _MyContentByte; } - set - { - _MyContentByte = value; - if (value != null) MyReaderHelper.LoadTree(MyItem); - } - } - public void NewPage() - { - //string path = Volian.Base.Library.vlnStackTrace.StackToStringLocal(2, 1); - NewPage(false); - } - public void NewPage(bool sectionChange) - { - // the first time we come in here we already printed the first page. - // we are now setting up the page size for the next page - iTextSharp.text.Rectangle rct = MyReaderHelper.MyPromsPrinter.MyContentByte.PdfDocument.PageSize; - // B2019-166 Only check for Word margins if the section changed - // - was getting next section's page margins prematurely (while still processing the a multi-page section) - // - this was changing the margins/orientation of other pages in the same Word section. - if (_MyHelper != null && sectionChange) - { - SectionInfo currentSection = _MyHelper.MySection; - SectionInfo nextSection = GetNextSection(currentSection); // _MyHelper.MySection.NextItem as SectionInfo; - //SectionConfig sc = (nextSection ?? currentSection).MyConfig as SectionConfig; - // If we are changing to a different section, then get the config from the nextSection - // else we are still printing in the same section so get the config from the current section - SectionConfig sc = ((!sectionChange || nextSection == null) ? currentSection.MyConfig : nextSection.MyConfig) as SectionConfig; - bool wordMargins = (sc != null && sc.Section_WordMargin == "Y"); - if (wordMargins) - { - if (nextSection != null && (sectionChange) && !nextSection.IsStepSection) //change to a word section - { - LastWordSection = nextSection; - _PageCountOfWordSection = 1; - MyReaderHelper.MySectionInfo = LastWordSection; - //ShowNeedForPageSize(); - rct = MyReaderHelper.GetSize(LastWordSection, 1); - } - else if (!currentSection.IsStepSection) //current section is a word section - { - if (currentSection != LastWordSection) - { - LastWordSection = currentSection; - _PageCountOfWordSection = 1; - } - else - if (!_MyHelper.OnBlankPage) _PageCountOfWordSection++; // B2018-049: supplemental printing throws off page sizes - MyReaderHelper.MySectionInfo = LastWordSection; - //ShowNeedForPageSize(); - rct = MyReaderHelper.GetSize(LastWordSection, _PageCountOfWordSection); - } - } - else // don't use Word margins - { - rct = PDFPageSize.UsePaperSize(MyItem.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - } - // C2018-004 create meta file for baseline compares - if (currentSection.IsStepSection) - Volian.Base.Library.BaselineMetaFile.WriteLine("{0}", rct); - else - Volian.Base.Library.BaselineMetaFile.WriteLine("UseWordMargins={0} {1} ", (wordMargins) ? "Y" : "N", rct); - //Console.WriteLine("\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"\t{4}" - // , currentSection == null ? "" : currentSection.DisplayNumber + " " + currentSection.DisplayText - // , nextSection == null ? "" : nextSection.DisplayNumber + " " + nextSection.DisplayText - // , sectionChange, wordMargins,_PageCountOfWordSection); - } - // Bug Fix: B2016-135 when using a large page size word section, that large page size was being used for the foldout page - // save this for the next section which will be the large page size word section. - // Bug Fix: B2018-049 supplemental printing throws off page sizes (need to do same thing as fix for foldouts) - // Bug Fix: B2019-165 (Byron/Braidwood) also don't do this if the current section has Don't Include Duplex Foldout checkbox checked (automation tab of section properties) - if ((_MyFoldoutReader.Count > 0) && (_MyHelper != null && !((_MyHelper.MySection.MyConfig as SectionConfig).Section_DontIncludeDuplexFoldout) || (_MyHelper != null && _MyHelper.MySection != null && _MyHelper.MySection.MyProcedure.ProcHasSupInfoData))) - MyContentByte.PdfDocument.SetPageSize(NxtRCT); - else - MyContentByte.PdfDocument.SetPageSize(rct); - NxtRCT = rct; - MyContentByte.PdfDocument.NewPage(); - } - private static bool _BaselineTesting = false; // Is the baseline being run (/P Commandline Parameter) - public static bool BaselineTesting - { - get { return PromsPrinter._BaselineTesting; } - set { PromsPrinter._BaselineTesting = value; } - } - private iTextSharp.text.Rectangle NxtRCT = PageSize.LETTER; - private SectionInfo GetNextSection(SectionInfo currentSection) - { - if (currentSection.Sections != null) - return currentSection.Sections[0].GetSectionInfo(); - if (currentSection.NextItem != null) - return currentSection.NextItem.GetSectionInfo(); - ItemInfo parent = currentSection.ActiveParent as ItemInfo; - while (parent != null && parent.NextItem == null) - parent = parent.ActiveParent as ItemInfo; - if (parent == null) return null; - return parent.NextItem.GetSectionInfo(); - } - private SectionInfo _PreviousWordSection = null; - public SectionInfo PreviousWordSection - { - get { return _PreviousWordSection; } - set { _PreviousWordSection = value; } - } - private SectionInfo _LastWordSection = null; - public SectionInfo LastWordSection - { - get { return _LastWordSection; } - set - { - PreviousWordSection = _LastWordSection; - _LastWordSection = value; - } - } - private int _PageCountOfWordSection = 0; - //private void ShowNeedForPageSize() - //{ - // if(PreviousWordSection != null && PreviousWordSection != LastWordSection) - // Console.WriteLine("Switch From {0}.{1} ",PreviousWordSection.DisplayNumber,PreviousWordSection.DisplayText); - // Console.WriteLine("To {0}.{1} Page: {2}",LastWordSection.DisplayNumber,LastWordSection.DisplayText,_PageCountOfWordSection); - // PreviousWordSection = LastWordSection; - //} - private PdfContentByte OpenDoc(ref string outputFileName, iTextSharp.text.Rectangle rect) - { - try - { - PdfWriter writer = null; - iTextSharp.text.Document document = new iTextSharp.text.Document(rect); - - try - { - if (File.Exists(outputFileName) && !OverWrite && !outputFileName.Contains("PageNumberPass") && !outputFileName.Contains("Foldout")) - { - if (!BaselineTesting && !SaveLinks) // B2024-031 don't do if creating PDF hyperlinks - { - String tmpExt = System.IO.Path.GetExtension(outputFileName); - String tmpPTH = System.IO.Path.GetDirectoryName(outputFileName); - String tmpFN = System.IO.Path.GetFileName(outputFileName); - String tmpFNNoExt = System.IO.Path.GetFileNameWithoutExtension(outputFileName); - - var files = new HashSet(Directory.GetFiles(tmpPTH, "*.pdf")); - //string baseName = Path.Combine(scpath, "Screenshot_"); - string filename; - int i = 0; - do - { - filename = tmpPTH + @"\" + tmpFNNoExt + "_" + ++i + ".pdf"; - } while (files.Contains(filename)); - - outputFileName = filename; - } - // B2024-031 if doing PDF hyperlinks (Create RO and Transition Hyperlinks) then try to - // delete the old PDF file before creating the new one - if (SaveLinks) - File.Delete(outputFileName); - } - - writer = PdfWriter.GetInstance(document, new FileStream(outputFileName, FileMode.Create)); - // PDFA1B does not allow layers, so this is disabled for now - // If enabled, CreateLayers will need to be skipped. - //writer.PDFXConformance = PdfWriter.PDFA1B; - } - catch (Exception ex) - { - StringBuilder sb = new StringBuilder(); - sb.AppendLine("Could not create"); - sb.AppendLine(); - sb.AppendLine(outputFileName + "."); - sb.AppendLine(); - sb.AppendLine("If it is open, close and retry."); - MessageBox.Show(sb.ToString(), "Error on CreatePdf", MessageBoxButtons.OK, MessageBoxIcon.Warning); - //MessageBox.Show("Could not create " + outputFileName + ". If it is open, close and retry.", "Error on CreatePdf"); - return MyContentByte = null; - } - document.Open(); - // Create Layers - CreateLayers(writer.DirectContent); - MSWordToPDF.DebugStatus = DebugOutput ? 1 : 0; - PrintOverride.Reset(); - if (DebugOutput) - { - PrintOverride.TextColor = System.Drawing.Color.Red; - PrintOverride.SvgColor = System.Drawing.Color.LawnGreen; - PrintOverride.BoxColor = System.Drawing.Color.Red; - PrintOverride.ChangeBarColor = System.Drawing.Color.Red; - PrintOverride.DebugColor = System.Drawing.Color.CadetBlue; - } - MyContentByte = writer.DirectContent; - return MyContentByte; - } - - catch (Exception ex) - { - StringBuilder sb = new StringBuilder(); - sb.AppendLine("Error occured when creating Print PDF"); - sb.AppendLine(); - sb.AppendLine(outputFileName + "."); - sb.AppendLine(); - sb.AppendLine("If it is open, close and retry."); - MessageBox.Show(sb.ToString(), "Error Creating PDF", MessageBoxButtons.OK, MessageBoxIcon.Warning); - //MessageBox.Show("Could not create " + outputFileName + ". If it is open, close and retry.", "Error on CreatePdf"); - return MyContentByte = null; - - } - } - //private string CreateFileName(string procNumber, string sectNumber, string sectTitle) - //{ - // return FixFileName(procNumber + "_" + ((sectNumber ?? "") != "" ? sectNumber : sectTitle)); - //} - //private string CreateFileName(string procNumber) - //{ - // return FixFileName(procNumber); - //} - //private string FixFileName(string name) - //{ - // return Regex.Replace(name, "[ .,/]", "_") + ".pdf"; - //} - int _StepPageNumber = 0; - private VlnSvgPageHelper _MyHelper = null; - //private static PdfReader _MyFoldoutReader = null; - //private static SectionInfo _MyFoldoutSection = null; - private static List _MyFoldoutReader = null; - public static List MyFoldoutReader - { - get { return PromsPrinter._MyFoldoutReader; } - set { PromsPrinter._MyFoldoutReader = value; } - } - private static List _MyFoldoutSection = null; - private string Print(ProcedureInfo myProcedure, string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary, bool makeTimeCriticalAction) - { - if (_ForcedPaginations != null) _ForcedPaginations.Clear(); - int profileDepth = ProfileTimer.Push(">>>> PromsPrinter.Print"); - if (_TransPageNumProblems == null) _TransPageNumProblems = new List(); - - if (_MyFoldoutReader != null) _MyFoldoutReader.Clear(); - else _MyFoldoutReader = new List(); - - if (_MyFoldoutSection != null) _MyFoldoutSection.Clear(); - else _MyFoldoutSection = new List(); - VlnItextFont.RegisterFontFolder(); //B2019-174 register the font folder so that symbols will display on auto TOC - if (myProcedure.Sections != null) - { - int cnt = 0; - foreach (SectionInfo mySection in myProcedure.Sections) - { - if (PrtSectID == -1 || (PrtSectID > -1 && mySection.ItemID == PrtSectID)) - { - if (!mySection.MyDocStyle.IsStepSection && !mySection.IsAutoTOCSection) - { - VEPROMS.CSLA.Library.Document.ConvertWordSectionToDOCX((ItemInfo)mySection); // B2023-093 Convert a Word section to the DOCX Word format if needed before printing - } - //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box - if ((myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts && (mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y") - || (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && (mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y")) - { - // if floating foldouts, need a list of sections & foldoutreaders. Just do first for now. - - _MyFoldoutSection.Add(mySection); - string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false, false, false); - _MyFoldoutReader.Add(foldoutPdf != null ? new PdfReader(foldoutPdf) : null); - cnt++; - } - } - } - } - OnStatusChanged("Print " + myProcedure.DisplayNumber, PromsPrinterStatusType.Start); - string outputFileName = pdfFolder + "\\" + Prefix + PDFFile; // RHM20150506 Multiline ItemID TextBox - - string retval = PrintProcedureOrFoldout(myProcedure, null, outputFileName, makePlacekeeper, makeContinuousActionSummary, makeTimeCriticalAction); - ProfileTimer.Pop(profileDepth); - return retval; - } - - // See if the last non Foldout Section has a Final Message. - private int GetFinalMessageSectionID(ProcedureInfo myProcedure, bool doingFoldout) - { - if (!doingFoldout) - { - // Work backwards because we don't want to include any foldouts. Find the last section that is not - // a foldout. If it has a final message, this is the 'last section' and should have a final message. - // If it doesn't have a final message, then none should be printed. - int cntSect = myProcedure.Sections.Count; - for (int i = cntSect - 1; i >= 0; i--) - { - SectionInfo mySection = myProcedure.Sections[i] as SectionInfo; - if (!((mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y")) //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box - { - if (mySection.MyDocStyle.Final != null && mySection.MyDocStyle.Final.Message != null && mySection.MyDocStyle.Final.Message.Length > 0) - return mySection.ItemID; - else - return -1; - } - } - } - return -1; - } - private bool _AllowAllWatermarks = false; - public bool AllowAllWatermarks - { - get { return _AllowAllWatermarks; } - set { _AllowAllWatermarks = value; } - } - private string _WatermarkOverrideColor = "BLUE"; // C2021-019: Override watermark color - public string WatermarkOverrideColor - { - get { return _WatermarkOverrideColor; } - set { _WatermarkOverrideColor = value; } - } - //private PdfReader readerWord; - private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName, bool makePlacekeeper, bool makeContinuousActionSummary, bool makeTimeCriticalActionSummary) - { - int profileDepth = ProfileTimer.Push(">>>> PrintProcedureOrFoldout"); - Rtf2Pdf.TextAtCounter = 0; - bool doingFoldout = myFoldoutSection != null; - // B2023-024 PROMS was using old cached PDF data when printing Word sections. - if (doingFoldout) - { - PdfInfo.RemovePDFFromCache((ItemInfo)myFoldoutSection); // remove cached PDF info to force getting of new data - if (File.Exists(outputFileName)) - File.Delete(outputFileName); // delete the temporary FOLDOUT file - } - // The following line accounts for 16bit OverrideLeftMargin when the 'Absolute' attribute is used in the genmac. - // We don't want to use the OverrideLeftMargin when 'Absolute' is used in the genmac. - // It's set here because the Volian.Svg.Library cannot call back to Volian.Print.Library to get this value. - Svg.Library.Svg.AbsoluteOffset = new PointF(2 * 72F / (float)myProcedure.ActiveFormat.PlantFormat.FormatData.Font.CPI, -9.5F); - // Create an MSWord Pdf - // Setup a pdf Document for printing - OnStatusChanged("Before OpenDoc", PromsPrinterStatusType.Before); - iTextSharp.text.Rectangle rct = PDFPageSize.UsePaperSize(myProcedure.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - if (myProcedure.Sections != null && !myProcedure.Sections[0].IsStepSection && !doingFoldout) // B2019-166 also don't do this if doing a foldout else it will use the margins set in word - { - SectionInfo si = myProcedure.Sections[0] as SectionInfo; - SectionConfig sc = si.MyConfig as SectionConfig; - bool wordMargins = (sc != null && sc.Section_WordMargin == "Y"); - if (wordMargins) - { - string pdfFile = BuildMSWordPDF(si); - try - { - PdfReader reader = new PdfReader(pdfFile); - rct = reader.GetPageSizeWithRotation(1); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, ex.GetType().FullName, MessageBoxButtons.OK, MessageBoxIcon.Warning); - _MyLog.Warn(string.Format("Error of ReadPDf [{0}],{1}.{2}", si.ItemID, si.DisplayNumber, si.DisplayText), ex); - throw new Exception("Error in readPDF", ex); - } - } - } - PdfContentByte cb = OpenDoc(ref outputFileName, rct); - if (cb == null) - { - ProfileTimer.Pop(profileDepth); - return null; - } - SetupProperties(cb.PdfDocument, myProcedure); - OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before); - NewPage(); // Start of print - //_MyLog.InfoFormat("NewPage 1 {0}", cb.PdfWriter.CurrentPageNumber); - OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage); - if (myProcedure.Sections == null) - { - // C2026-033 if we are running baselines, don't display the empty procedure message box, instead continue on as if OK was pressed. - if (!BaselineTesting) - MessageBox.Show("This procedure has no content and will not be printed.", "Empty Procedure", MessageBoxButtons.OK, MessageBoxIcon.Information); - ProfileTimer.Pop(profileDepth); - // B2024-062 Added check for EmptyProcedure. This is to prevent the Try Again message - // from appearing after the user clicks on the OK button from the Empty Procedure message - _EmptyProcedure = true; - return null; - } - OnStatusChanged(myProcedure.DisplayNumber, PromsPrinterStatusType.ProgressSetup, myProcedure.Sections.Count); - int progress = 0; - int finalMessageSectionID = GetFinalMessageSectionID(myProcedure, doingFoldout); - string LastFmtName = null; - int lastDocStyle = -1; - bool firstStepSec = true; - // C2021-019: Override the watermark color, stored in the PSI - color list set as combobox in PSI with list of colors - ProcedureConfig pc = myProcedure.MyConfig as ProcedureConfig; - WatermarkOverrideColor = _WatermarkColor; - if (pc != null) - { - string clr = pc.GetValue("PSI", "WATERMARKOVERRIDECLR"); - if (clr != null && clr != "") WatermarkOverrideColor = clr.ToUpper().Contains("DEFAULT") ? "BLUE" : clr; - } - foreach (SectionInfo mySection in myProcedure.Sections) - { - if(PrtSectID == -1 || (PrtSectID > -1 && mySection.ItemID == PrtSectID) ) - { - // B2020-115 Calculate maximum available space on a page for figures - vlnParagraph.hMax = ((float)mySection.MyDocStyle.Layout.PageLength); - vlnParagraph.wMax = ((float)mySection.MyDocStyle.Layout.PageWidth) - ((float)mySection.MyDocStyle.Layout.LeftMargin - 12); - NeedSupInfoBreak = true; - bool isFoldoutSection = (mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y"; //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box - if (((isFoldoutSection && myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts) - || (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && isFoldoutSection)) - != doingFoldout) continue; - if (myFoldoutSection != null && myFoldoutSection.ItemID != mySection.ItemID) continue; - PrintOverride.CompressSuper = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSuper; - PrintOverride.CompressSub = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSub; - PrintOverride.CompressPropSubSup = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressPropSubSup; - - OnStatusChanged((mySection.DisplayNumber ?? "") == "" ? mySection.DisplayText : mySection.DisplayNumber, PromsPrinterStatusType.Progress, progress++); - // Set up Helper for the particular Section - if (_MyHelper == null) - { - LastFmtName = mySection.ActiveFormat.Name; - lastDocStyle = (int)mySection.MyDocStyle.Index; - string hlsText = ""; - int hlsItemId = 0; - if (mySection.IsStepSection && mySection.Steps != null && mySection.Steps.Count > 0) - { - hlsItemId = mySection.Steps[0].ItemID; - hlsText = mySection.Steps[0].DisplayText; // save the High level step text for use in the page list - } - cb.PdfWriter.PageEvent = _MyHelper = new VlnSvgPageHelper(mySection, this, hlsText, hlsItemId, PrtSectID); - _MyHelper.AllowAllWatermarks = AllowAllWatermarks; - _MyHelper.MyPdfWriter = cb.PdfWriter; - _MyHelper.CreatingFoldoutPage = doingFoldout; - _MyHelper.CreatingSupInfoPage = false; - _MyHelper.MyPdfContentByte = cb; - - if (!mySection.IsStepSection) _MyHelper.PageBookmarks.Add((ItemInfo)mySection, ((mySection.DisplayNumber ?? "") == "" ? "" : mySection.DisplayNumber + " - ") + mySection.DisplayText, null); - if (DebugOutput) - { - // 16-bit background - string procedureFileName = BackgroundFolder + "\\" + PDFFile.Trim();//CreateFileName(myProcedure.DisplayNumber); - FileInfo VEPromsFile = new FileInfo(procedureFileName); - if (VEPromsFile.Exists && !doingFoldout) - { - _MyHelper.BackgroundFile = procedureFileName; - float x = 0; - float y = 0; - if (!(mySection.ActiveFormat.Name.ToUpper().StartsWith("WST") || _MyHelper.Back32BitPROMS)) // compare folder contains PROMS generated PDF - { - // X value below = 16-bit pdf OverrideLeftMargin = -2 characters at the plant format's default Font's - // characters per inch. - // 16bit OverrideLeftMargin, defined as -2 in driver\drvin.rtf, - override took 2 characters out, so we're adding it back in: - // These values adjust if overlay is 16bit versus 32bit. This is - // used so that the comparison is an exact match. Use 0,0 if comparing to another 32bit - // pdf, i.e. won't process the following 2 lines of code. - x = 2 * 72F / (float)myProcedure.ActiveFormat.PlantFormat.FormatData.Font.CPI; - y = -9.5F; - } - x += 72F * VlnSettings.GetCommandFloat("X", 0); - y -= 72F * VlnSettings.GetCommandFloat("Y", 0); - _MyHelper.BackgroundOffset = new PointF(x, y); - _MyHelper.BackgroundPageOffset = 0; - } - _MyHelper.WatermarkLayer = _WatermarkLayer; - _MyHelper.PageListLayer = _PagelistLayer; - _MyHelper.TextLayer = _TextLayer; - _MyHelper.BackgroundLayer = _BackgroundLayer; - _MyHelper.DebugLayer = _DebugLayer; - _MyHelper.PROMSVersionLayer = _PROMSVersionLayer; //C2018-009 print PROMS version - } - _MyHelper.Rev = _Rev; - _MyHelper.Watermark = _Watermark; - // C2019-039 Remove automatic zoom on Overlay PDFs - //_MyHelper.DoZoomOMatic = DebugOutput; - _MyHelper.OriginalPageBreak = OriginalPageBreak; - _MyHelper.PROMSVersion = _PromsVersion; //C2018-009 print PROMS version - _MyHelper.WatermarkColor = WatermarkOverrideColor; // C2021-019: save the override for the watermark color - OnStatusChanged("After Set PageEvent", PromsPrinterStatusType.SetPageEvent); - } - else - { - //added by jcb to reset mygaps when changing a section. found old section gaps were carrying over to new section - _MyHelper.MyGaps.Clear(); - //Console.WriteLine("'{0}' PromsPrinter", mySection.DisplayText); - // if pagination is separate or we've changed the format, we have not done the first page - // (if this format has the useonfirst page docstyle flag) - if (LastFmtName != mySection.ActiveFormat.Name || lastDocStyle != (int)mySection.MyDocStyle.Index || mySection.SectionConfig.Section_Pagination == SectionConfig.SectionPagination.Separate) - { - _MyHelper.DidFirstPageDocStyle = false; - lastDocStyle = (int)mySection.MyDocStyle.Index; - LastFmtName = mySection.ActiveFormat.Name; - } - if (!mySection.IsStepSection) _MyHelper.PageBookmarks.Add((ItemInfo)mySection, ((mySection.DisplayNumber ?? "") == "" ? "" : mySection.DisplayNumber + " - ") + mySection.DisplayText, null); - _MyHelper.MySection = mySection; - //OnStatusChanged("After Set Svg", PromsPrinterStatusType.SetSVG); - } - // if this format uses phonelists, see if this section has one. We need to know the number - //of lines to adjust the pagelength for pagination and printing. - _MyHelper.PhoneListHeight = 0; - if (mySection.ActiveFormat.PlantFormat.FormatData.SectData.PrintPhoneList) - { - // get config for section - SectionConfig sc = mySection.MyConfig as SectionConfig; - if (sc.Section_PhoneList != null && sc.Section_PhoneList == "Y") - { - DocVersionConfig dvc = mySection.MyDocVersion.MyConfig as DocVersionConfig; - if (dvc != null) - { - string phlist = dvc.Print_PhoneList; - if (phlist != null && phlist != "") - { - // count lines: - int cl = 0; - int indx = phlist.IndexOf("\n"); - while (indx > 0) - { - cl++; - if (indx + 1 > phlist.Length) - indx = -1; - else - indx = phlist.IndexOf("\n", indx + 1); - } - if (cl == 0) cl = 1; // phone list is a single line without an ending newline - _MyHelper.PhoneListHeight = cl * vlnPrintObject.SixLinesPerInch; - } - } - } - } - _MyHelper.FinalMessageSectionID = finalMessageSectionID; // set VlnSvgPageHelper with the finalMessageSectionID - - if (mySection.IsAutoTOCSection) - { - if (((cb.PdfWriter.CurrentPageNumber % 2 == 0 && !_MyHelper.CreatingFoldoutPage) || myProcedure.ProcHasSupInfoData) && InsertBlankPages) // Bug Fix: B2016-181 - add blank page if page count is even - { - InsertBlankPage(cb); - } - GenerateTOC(mySection, myProcedure, cb, _TextLayer); - // B2020-102: extra page printing after auto TOC for summer. Retested for Farley and was successful also - // F2018-033: Farley Auto TOC. If doing foldouts or supinfo facing pages, add a blank page after also: - //if (myProcedure.ProcHasSupInfoData && InsertBlankPages) // Bug Fix: B2016-181 - add blank page if page count is even - //{ - // InsertBlankPage(cb); - //} - } - else - { - if (mySection.IsStepSection) - { - if (mySection.Steps != null && mySection.Steps.Count > 0) - { - // get first step to send to floating foldout indx.&& MyItemInfo.FoldoutIndex>-1) - ItemInfo firstStep = mySection.Steps[0]; - // B2019-165 Don't print the duplex foldout (on the back of the page) if the Don't Include Duplex Foldout check box was checked in section properties - if (firstStep.FoldoutIndex() > -1 && (mySection.MyPrevious == null || !((mySection.MyPrevious.MyConfig as SectionConfig).Section_DontIncludeDuplexFoldout))) - DoFoldoutPage(cb, "Beginning of Step Section", _TextLayer, _MyHelper, firstStep.FoldoutIndex(), InsertBlankPages); - else if (!_MyHelper.CreatingFoldoutPage && _MyFoldoutReader.Count > 0 && InsertBlankPages) - { - // if it is continuous pagination, don't do blank page - not sure if this is correct place for this: - // C2023-001 if the previous section has the flag to not insert blank pages, - // then don't insert a blank page between the previous section and this one - if (mySection.SectionConfig.Section_Pagination == SectionConfig.SectionPagination.Separate && !mySection.SearchPrev.MyDocStyle.DontInsertBlankPages) - { - // only insert a blank page if this section does not have a foldout (but the procedure as a whole does) - // and the checkbox on the print dialog to add blank pages is checked - InsertBlankPage(cb); - //_MyLog.InfoFormat("NewPage Begin Step Sect blank {0}", cb.PdfWriter.CurrentPageNumber); - } - } - else - { - // If the procedure has supplemental facing pages, but this section does not & it's the first section, - // need a blank 'facing page'. Sections after the first will get blank 'facing page' in print's pagination logic - if (SupInfoPrintType == E_SupInfoPrintType.Merge && !mySection.HasSupInfoSteps && firstStepSec && InsertBlankPages) - { - InsertBlankPage(cb); - } - } - } - firstStepSec = false; - CreateStepPdf(mySection, cb); - } - else - { - CreateWordDocPdf(cb, mySection); - } - } - _MyHelper.PrintedSectionPage = 0; - } - } - if (_MyHelper != null && _MyHelper.BackgroundFile != null) - { - _MyHelper.MySvg = null; - while (cb.PdfWriter.CurrentPageNumber <= _MyHelper.BackgroundPageCount) - { - iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 30, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(PrintOverride.TextColor)); - PrintTextMessage(cb, "No Proms Output", _TextLayer, font); - NewPage(); - //_MyLog.InfoFormat("NewPage 2 {0}", cb.PdfWriter.CurrentPageNumber); - if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}'", - _MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "No PROMS Output"); - //C2018-015 add debug pagination to meta file - if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0:D6},'{1}'", - _MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "No PROMS Output"); - } - } - OnStatusChanged(myProcedure.DisplayNumber + " PDF Creation Completed", PromsPrinterStatusType.Progress, progress); - if (DebugPagination.IsOpen) DebugPagination.TotalPages += cb.PdfWriter.CurrentPageNumber; - CloseDocument(outputFileName); - if (_MyHelper != null && makePlacekeeper) - { - // Setting the default font to Arial since that is what Calvert is currently using for their Placekeeper pages - VE_Font pkFont = new VE_Font("Arial", 11, E_Style.None, 12); // default font info. - // Ideally, we should grab the font from the DocStyle used for the Placekeeper. - // Note that Calvert has two Placekeeper docSyles (EOPs and AOPs) in the same format. - // Both Placekeeper DocStyles use Arial 11 pt font, so there is no need to grab it from the format file. - //foreach (DocStyle ds in _MyHelper.MySection.ActiveFormat.PlantFormat.DocStyles.DocStyleList) - //{ // note that this will get the last Placekeeper font setting - // if (ds.StructureStyle.Style == E_DocStructStyle.Placekeeper) - // pkFont = ds.Font; - //} - if (_MyHelper.MyPlacekeepers.Count > 0) - MyPlacekeeper = new Placekeeper(_MyHelper.MyPlacekeepers, pkFont); - } - // Generate the Continuous Action Summary - if (_MyHelper != null && makeContinuousActionSummary) - { - // Set the font for the Continue Action Summary - VE_Font pkFont = myProcedure.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.ContinuousActionSummaryData.Font; // uses font defined in the format or uses what is definced in BaseAll format - if (_MyHelper.MyContActSteps.Count > 0) - MyContActSummary = new ContinuousActionSummary(_MyHelper.MyContActSteps, pkFont); - } - // F2022-024 Generate the Time Critical Action Summary - // we use the ContinuousActionSummary generator to create the Time Critical summay - if (_MyHelper != null && makeTimeCriticalActionSummary) - { - // Set the font for the Time Critical Action Summary - VE_Font pkFont = myProcedure.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.ContinuousActionSummaryData.Font; // uses font defined in the format or uses what is definced in BaseAll format - if (_MyHelper.MyTimeCriticalActionSteps.Count > 0) - MyTimeCriticalActSummary = new ContinuousActionSummary(_MyHelper.MyTimeCriticalActionSteps, pkFont, true); - } - _MyHelper = null; - ProfileTimer.Pop(profileDepth); - return outputFileName; - } - - public void InsertBlankPage(PdfContentByte cb, bool backOfLastPageOfSection = false) - { - _MyHelper.OnBlankPage = true; - string baselinemsg = "==Insert Blank Page=="; - if (_BlankPageText != null && _BlankPageText != "") // C2019-004: Allow user to define duplex blank page text - { - if (_MyHelper.IsLandscape) // rotate the blank page message on landscaped pages - { - cb.SaveState(); - System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0); - cb.Transform(myMatrix); - } - string bsfontfamily = MyItem.ActiveFormat.PlantFormat.FormatData.StepDataList[0].Font.Family; - int bsfontsize = 26; - iTextSharp.text.Font font = FontFactory.GetFont(bsfontfamily, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, bsfontsize, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(PrintOverride.TextColor)); - PrintTextMessage(cb, _BlankPageText, _TextLayer, font); - if (_MyHelper.IsLandscape) - cb.RestoreState(); - // B2019-019: Add the blank page message to the baseline output file. - baselinemsg = string.Format("==Insert Blank Page With Message \"{0}\"==", _BlankPageText); - } - else - cb.PdfDocument.Add(new iTextSharp.text.Table(1)); - NewPage(backOfLastPageOfSection); // backOfLastPageOfSection = true means that next page starts next section and to use the next section's page size - Volian.Base.Library.BaselineMetaFile.WriteLine(baselinemsg); - } - - private void SetupProperties(PdfDocument document, ProcedureInfo myProcedure) - { - document.AddTitle(string.Format("{0} {1}", myProcedure.DisplayNumber, myProcedure.DisplayText)); - document.AddSubject(myProcedure.SearchDVPath); - document.AddCreator(string.Format("{0} {1}", Application.ProductName, Application.ProductVersion)); - document.AddAuthor(Volian.Base.Library.VlnSettings.UserID); - } - private Placekeeper _MyPlacekeeper = null; - - public Placekeeper MyPlacekeeper - { - get { return _MyPlacekeeper; } - set { _MyPlacekeeper = value; } - } - - private ContinuousActionSummary _MyContActSummary = null; - - public ContinuousActionSummary MyContActSummary - { - get { return _MyContActSummary; } - set { _MyContActSummary = value; } - } - - //F2022-024 Time Critical Action Summary - private ContinuousActionSummary _MyTimeCriticalActSummary = null; - - public ContinuousActionSummary MyTimeCriticalActSummary - { - get { return _MyTimeCriticalActSummary; } - set { _MyTimeCriticalActSummary = value; } - } - - public void CreateWordDocPdf(PdfContentByte cb, SectionInfo mySection) - { - if (mySection.PageNumber == -1) // If page num transition goes to a section, need the pagenumber of section. - { - if ((mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountFoldoutPgs) == E_DocStructStyle.DontCountFoldoutPgs) - mySection.PageNumber = _MyHelper.CurrentPageNumberNoFoldouts; - else - mySection.PageNumber = _MyHelper.CurrentPageNumber; - } - else - { - if ((mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountFoldoutPgs) == E_DocStructStyle.DontCountFoldoutPgs) - mySection.PageNumberNextPass = _MyHelper.CurrentPageNumberNoFoldouts; - else - mySection.PageNumberNextPass = _MyHelper.CurrentPageNumber; - } - int profileDepth = ProfileTimer.Push(">>>> CreateWordDocPdf"); - if (_MyHelper.MySection != mySection) // C2018-004 create meta file for baseline compares - assigning MySection again will reprocess the Page List - _MyHelper.MySection = mySection; - try - { - OnStatusChanged("Get Section", PromsPrinterStatusType.GetSection); - int sectPageCount = 0; - float locEndOfWordDoc = 0; - float pdfSize = 0; - using (PdfInfo myPdf = PdfInfo.Get(mySection, false)) - { - if (myPdf == null) // B2017-218 Handle invalid word sections - { - cb.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED), 20); - cb.SetTextMatrix(cb.PdfDocument.Left + 200, cb.PdfDocument.Bottom + cb.PdfDocument.Top / 2); - cb.ShowText("Word Section Invalid"); - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("!!Word Section Invalid: ID {0} \"{1}\" \"{2}\"", mySection.ItemID, mySection.DisplayNumber, mySection.DisplayText); - } - else - { - sectPageCount = (int)(Math.Ceiling(myPdf.PageCount)); - locEndOfWordDoc = (float)(myPdf.PageCount - (sectPageCount - 1)) * 100; - pdfSize = (float)myPdf.PageCount; - } - } - string tocKey = string.Format("TOC{0}", mySection.ItemID); - if (_MyHelper.MyTOCPageCounts.ContainsKey(tocKey)) - { - PageCount pc = _MyHelper.MyTOCPageCounts[tocKey]; - // add 1 because have not hit end page yet. - pc.Total = _MyHelper.CurrentTOCPageNumber + 1; - pc.DrawTemplates(); - } - else - { - // see if this section will be added to the table of content. This is for sections that - // precede tha actual Automated TOC section. - SectionConfig sc = mySection.MyConfig as SectionConfig; - if (sc != null && sc.Section_TOC == "Y") - { - string tockey = "TOC" + mySection.ItemID.ToString(); - if (!_MyHelper.MyTOCPageNums.ContainsKey(tockey)) - // increment the CurrentTOCPageNumber by 1 since we haven't hit an - // endpage yet, and that's what increments it to the current page number. - _MyHelper.MyTOCPageNums.Add(tockey, _MyHelper.CurrentTOCPageNumber + 1); - } - } - float origYoff = (float)mySection.MyDocStyle.Layout.TopMargin; - bool resetSvgForCont = true; - for (int ii = 0; ii < sectPageCount; ii++) - { - int pageNumber = 1 + ii; - bool didFoldout = false; - if (((mySection.MyDocStyle.StructureStyle.Style ?? 0) & E_DocStructStyle.UseSectionFoldout) != 0) - { - // B2022-009: if doing a foldout & this is a landscape section, turn landscape off for the foldout - if (mySection.MyDocStyle.LandscapePageList) _MyHelper.IsLandscape = false; - didFoldout = true; - DoFoldoutPage(cb, "Word Document", _TextLayer, _MyHelper, 0, false); - if (mySection.MyDocStyle.LandscapePageList) _MyHelper.IsLandscape = true; // B2022-009: turn landscape back on for the foldout - } - if (this.MyReaderHelper != null) - { - bool doimport2 = true; - PdfImportedPage fgPage = null; - try - { - fgPage = this.MyReaderHelper.GetPage(mySection, ii + 1); - } - catch (Exception ex) - { - Console.WriteLine(ex); - doimport2 = false; - } - OnStatusChanged("Read MSWord", PromsPrinterStatusType.ReadMSWord); - if (doimport2) - { - if (((!didFoldout && _MyFoldoutReader.Count > 0) || mySection.MyProcedure.ProcHasSupInfoData) && cb.PdfWriter.CurrentPageNumber > 1 && InsertBlankPages) - { - bool doInsertBlankPage = true; - SectionInfo currentSection = _MyHelper.MySection; - iTextSharp.text.Rectangle curRecSize = cb.PdfDocument.PageSize; // save current PDF Doc Page Size - // only insert a blank page if this section does not have a foldout (but the procedure as a whole does) - // and the checkbox on the print dialog to add blank pages is checked - if (mySection.MyDocStyle.DontInsertBlankPages) - { - // C2023-001 we are going to print the first page of a section that we don't insert blank pages - // but we do need to insert a blank page for the back of the previous section's last page - doInsertBlankPage = (pageNumber == 1); - } - if (doInsertBlankPage) - { - // get the current and previous section page size - // pass in whether the page sizes are different so when a new page is started - // we use the correct page size - SectionInfo prevSection = (mySection.MyPrevious != null) ? (SectionInfo)mySection.MyPrevious : currentSection; - iTextSharp.text.Rectangle prevRecSize = MyReaderHelper.GetSize(prevSection, 1); - curRecSize = MyReaderHelper.GetSize(currentSection, 1); - if (prevSection != currentSection) - { - _MyHelper.MySection = prevSection; // make sure the back page that we are inserting is the correct page size - } - InsertBlankPage(cb, (prevRecSize != curRecSize)); - if (prevSection != currentSection) - { - _MyHelper.MySection = currentSection; - } - } - //_MyLog.InfoFormat("NewPage 3 blank {0}", cb.PdfWriter.CurrentPageNumber); - } - float yoff = 0; - if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin; - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("WD Height={0} Width={1} scPgCnt={2} locEnd={3} pdfSz={4} xOff={5} yOff={6} ScPgNum {7}", fgPage.Height, fgPage.Width, sectPageCount, locEndOfWordDoc, pdfSize, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0.0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0.0) + yoff, pageNumber); - AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0) + yoff); - // B2019-102 Handle PDF Destinations for Word Sections - if (ii == 0 && _MyHelper.MyPromsPrinter.SaveLinks) - { - ColumnText ct = new ColumnText(cb); - iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 12, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(PrintOverride.TextColor)); - Chunk chk = new Chunk(mySection.DisplayNumber, font); - chk.SetLocalDestination(string.Format("ItemID={0}", mySection.ItemID)); - //Console.WriteLine("++++ ItemID={0}", mySection.ItemID); - //float x1 = cb.PdfDocument.PageSize.Width / 2; - //float y1 = cb.PdfDocument.PageSize.Height ; // 1.8f; - float height = 12 * 1.5F; - // B2019-102 Locate the chunk below the bottom of the page - ct.SetSimpleColumn(0, -height, chk.GetWidthPoint() * 1.01F, -2 * height); - ct.AddElement(new Phrase(chk)); - cb.SetColorFill(new iTextSharp.text.Color(PrintOverride.TextColor)); - int status = ct.Go(); - if (status > 1) - _MyLog.WarnFormat("\r\n.-.-.-. Failed to add a PDF destination for {0}", mySection.ShortPath); - } - - if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}", - _MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath, pageNumber); - } - if (ii == sectPageCount - 1) - { - // if there's and end message, add it to the appropriate location on the last page of - // the word document: - if ((mySection.MyDocStyle.End.Message ?? "") != "") - { - float ylocation = cb.PdfDocument.PageSize.Height - ((float)mySection.MyDocStyle.Layout.TopMargin + locEndOfWordDoc * 72); // 72 - pts per inch. - iTextSharp.text.Font fnt = VolianPdf.GetFont(mySection.MyDocStyle.End.Font.WindowsFont); - fnt.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black)); - // F2022-017: For Word Document sections, allow the message to have the '{Section Number}' token that - // gets resolved by the section's DisplayNumber. - string myMsg = mySection.MyDocStyle.End.FixedMessage; - if (myMsg.Contains("{Section Number}")) myMsg = myMsg.Replace("{Section Number}", mySection.DisplayNumber).Trim(); - iTextSharp.text.Paragraph para = new Paragraph(myMsg, fnt); - float wtpm = (float)mySection.MyDocStyle.Layout.PageWidth - (float)mySection.MyDocStyle.Layout.LeftMargin; - float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (myMsg.Length * (float)mySection.MyDocStyle.End.Font.CharsToTwips)) / 2; - float yBottomMargin = Math.Max(0, (float)mySection.MyDocStyle.Layout.TopMargin - (float)mySection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch); - float adjMsgY = 0; - if ((float)mySection.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page. - { - adjMsgY = (float)(-(float)mySection.MyDocStyle.End.Flag * vlnPrintObject.SixLinesPerInch); - if (ylocation - adjMsgY > mySection.MyDocStyle.Layout.FooterLength) ylocation = ylocation - adjMsgY; - } - bool landscape = (mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_WordContentLandscaped) == E_DocStructStyle.DSS_WordContentLandscaped; - if (landscape) - { - cb.SaveState(); - System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0); - cb.Transform(myMatrix); - } - Rtf2Pdf.TextAt(cb, para, centerpos, ylocation + 6, 200, 12, "", yBottomMargin); - if (landscape) cb.RestoreState(); - } - } - OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord); - } - OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before); - if (mySection.MyDocStyle.LandscapePageList)// && mySection.MyDocStyle.Layout.PageWidth > mySection.MyDocStyle.Layout.PageLength) - _MyHelper.IsLandscape = true; - else - _MyHelper.IsLandscape = false; - // C2023-001 put in for Beaver Valley, DontInsertBlankPages is use on their CAS sections, which inlucde a hard page break - // with text saying that page folds out. Some procedures also have a PROMS foldout section that is printed on the - // back of the procedure step pages. When we are printing duplex with blank pages, we don't want to insert a blank - // page between the two pages of the CAS section - // "pageForNextSection" is used to tell NewPage() if it needs to check the page size of the next section before starting the - // next page - this fixes an issue where the page we inserted for the backside of the previous section was the larger page - // size (11x17 vs 8x11) - bool pageForNextSection = (ii == sectPageCount - 1 && !InsertBlankPages); - _MyHelper.SpecialCAS = false; - if (mySection.MyDocStyle.DontInsertBlankPages && ii == sectPageCount - 1) // C2023-001 beaver valley CAS section type (has hard page break for back of page) - { - pageForNextSection = true; - _MyHelper.SpecialCAS = true; // B2023-005: Beaver Valley - flag to rotate watermark on 2nd CAS page - } - NewPage(pageForNextSection); // Word Document - //_MyLog.InfoFormat("NewPage 3 {0}", cb.PdfWriter.CurrentPageNumber); - - // if this document style has another style that is for pages other than first, we need to - // reset the document style off of this section AND reset docstyle values used. - _MyHelper.DidFirstPageDocStyle = true; - - // Calvert has a case in their stp landscape word docs where a ' (Continued)' message - // appears in their pagelist item for printing the section title, {ATTACHTITLECONT} pagelist - // However, other sections use this token, but do NOT have the continue message - so - // the docstyle was added to flag the difference between them (STP-Landscape Attachments has it, - // STP-Attachments do not) - if (resetSvgForCont && (mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListAddSectCont) == E_DocStructStyle.DSS_PageListAddSectCont) - { - _MyHelper.ResetSvg(); - resetSvgForCont = false; // only need to reset it once (for all pages after 1st page) - } - - //DebugPagination.WriteLine("CreateWordDocPdf"); - if ((mySection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0) - _MyHelper.MySection = mySection; // this resets the docstyle/pagestyle in pagehelper - OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage); - } - } - catch (Exception ex) - { - NewPage(); // can we put out 'error on page'? - _MyLog.InfoFormat("NewPage error on page {0}", cb.PdfWriter.CurrentPageNumber); - } - finally - { - _MyHelper.IsLandscape = false; // reset landscape mode to false - } - ProfileTimer.Pop(profileDepth); - } - // B2019-152: AddMergedLandscapePage adds entries to the dictionary that keeps track of what pages in a pdf are landscape - // so that if merge is done, the pages that are landscaped can have landscaped page numbers placed on them - public static void AddMergedLandscapePage(VlnSvgPageHelper _MyHelper, string PDFFile) - { - string tmp = PDFFile.Substring(0, PDFFile.IndexOf(".pdf")); - if (MergedLandscapePages == null) MergedLandscapePages = new Dictionary>(); - if (MergedLandscapePages.ContainsKey(tmp)) - MergedLandscapePages[tmp].Add(_MyHelper.CurrentPageNumber); - else - { - // Create the list & add this to dictionary, pdf file with page list. - List children = new List(); - children.Add(_MyHelper.CurrentPageNumber); - MergedLandscapePages.Add(tmp, children); - } - } - private void GenerateTOC(SectionInfo tocSection, ProcedureInfo myProcedure, PdfContentByte cb, PdfLayer textLayer) - { - iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter; - float _PointsPerPage = PDFPageSize.PaperSizePoints(myProcedure.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - float yTopMargin = _PointsPerPage - (float)tocSection.MyDocStyle.Layout.TopMargin; - float yBottomMargin = Math.Max(0, yTopMargin - (float)tocSection.MyDocStyle.Layout.PageLength); // - 2 * vlnPrintObject.SixLinesPerInch); - if (textLayer != null) cb.BeginLayer(textLayer); - TableOfContentsData tOfC = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData; - //ItemInfo procItem = ItemInfo.Get(myProcedure.ItemID); - ItemInfo procItem = myProcedure; - lastyLocation = 0; - AddSectionToTOC(tocSection, procItem, tOfC, cb, yTopMargin, 0, false); // add all of the marked sections and sub-sections to the table of contents - if (textLayer != null) cb.EndLayer(); - NewPage(); - //_MyLog.InfoFormat("NewPage 4 {0}", cb.PdfWriter.CurrentPageNumber); - _NoBreakYOffset = 0; - } - float lastyLocation = 0; - private string GetRtfToC(string txt, TableOfContentsData tOfCData) - { - return GetRtfToC(txt, tOfCData, null); - } - private string GetRtfToC(string txt, TableOfContentsData tOfCData, VE_Font overrideFont) - { - StringBuilder _RtfSB = new StringBuilder(); - VEPROMS.CSLA.Library.DisplayText toctxt = new VEPROMS.CSLA.Library.DisplayText(txt, tOfCData.Font, false); - System.Drawing.Font myFont = toctxt.TextFont.WindowsFont; - if (overrideFont != null) - { - toctxt = new VEPROMS.CSLA.Library.DisplayText(txt, overrideFont, false); - myFont = overrideFont.WindowsFont;//toctxt.TextFont.WindowsFont; - } - _RtfSB.Append(vlnPrintObject.AddFontTable(myFont)); - _RtfSB.Append(toctxt.StartText); - _RtfSB.Append("}"); - return _RtfSB.ToString(); - } - private float AddSectionToTOC(SectionInfo tocSection, ItemInfo ii, TableOfContentsData tOfC, PdfContentByte cb, float yPageStart, float yLocation, bool didSubSecLineSpacing) - { - // The following adjustments are for WCN1: - // for xAdjNumber: 6 is for 1 char less in 16bit (\promsnt\exe\print\tabocont.c, method 'howMany'. - // 1.2 is a tweak to get output to match between 16 & 32 bit. - // for xAdjTitle: .8 & 1.2 are both tweaks to get output to match. - // for xAdjTitleIndent: 6 is for 1 char less. 2.4 is a tweak - float xAdjNumber = -6 + 1.2F; - float xAdjTitle = .8F + 1.2F; - float xAdjTitleIndent = -6 + 2.4F; - float yadj = 0.5F; // tweak to get 16 & 32 bit output to match. - - float yPageStartAdj = yPageStart - yadj; - float leftMargin = (float)tocSection.MyDocStyle.Layout.LeftMargin; - float secNumPos = (float)tOfC.TofCSecNumPos + xAdjNumber; - float secTitlePos = (float)tOfC.TofCSecTitlePos + xAdjTitle; - float secPagePos = (float)tOfC.TofCPageNumPos + xAdjNumber; - float height = tOfC.Font.WindowsFont.Size * 1.5F; - string lastTOCGroupHeading = ""; - bool firstGroupHeading = true; - if (ii.Sections != null) - { - int sectCnt = 0; // keep count of which section/sub-section we are processing - bool doSubY = false; - int level = 0; - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("TOC Ystart {0} LeftMar {1} ScNmPos {2} ScTtlPos {3} ScPgPos {4}", yPageStart, leftMargin, secNumPos, secTitlePos, secPagePos); - bool inGroup = false; - foreach (SectionInfo mySection in ii.Sections) - { - if (PrtSectID == -1 || (PrtSectID > -1 && mySection.ItemID == PrtSectID)) - { - sectCnt++; - SectionConfig sc = mySection.MyConfig as SectionConfig; - if ((mySection.MyDocStyle != null && mySection.MyDocStyle.IncludeInTOC && (sc == null || sc.Section_TOC != "Y")) - || ((mySection.MyDocStyle == null || !mySection.MyDocStyle.IncludeInTOC) && (sc != null && sc.Section_TOC == "Y"))) - { - // for indenting of subsections, count up tree. Only start indenting - // at third level, i.e. not indent on 1.0 and 1.1, but indent on 1.1.1: - level = 0; - ItemInfo iilvl = mySection as ItemInfo; - while (!iilvl.IsProcedure) - { - level++; - iilvl = iilvl.MyParent; - } - // check what level the plant wants the auto ToC indented: - int tofCNumLevels = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCNumLevels ?? 0; - if (tofCNumLevels > 0 && level > tofCNumLevels) return yLocation; - - int startIndentAfterLevel = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCStartIndentAfterLevel ?? 2; // - level = level <= startIndentAfterLevel ? 0 : level - startIndentAfterLevel; - float indentOffset = (level * (secTitlePos - secNumPos)); - - if (didSubSecLineSpacing && sectCnt == 1 && indentOffset > 0) // processing first sub-section and we are indenting B2016-205 - { - // processed last sub-section so use the main section line spacing (most times is double spaced) - yLocation -= (float)(tOfC.TofCLineSpacingSub ?? 1) * vlnPrintObject.SixLinesPerInch; - yLocation += (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch; - } - // The Group Title logic was added for V.C. Summer and Farley(new writer guide format) - // It allows the user to enter a Table of Contents Grouping Title on the Section Property (under automation) - // The grouping title will print if the same title wasn't last printed - string tocGrpHeading = sc.Section_TOC_Group_Title; // returns a "" if no title was entered - float yBottomMargin = yPageStart - (float)tocSection.MyDocStyle.Layout.PageLength + (2 * vlnPrintObject.SixLinesPerInch); - bool doGroupHeading = false; - if (tocGrpHeading != lastTOCGroupHeading && tocGrpHeading.Length > 0) - { - doGroupHeading = true; - inGroup = true; - // B2020-033: for single spacing, add an extra line before a grouping title: - float tmpspc = (float)(tOfC.TofCLineSpacing ?? 1); - if (lastTOCGroupHeading != "" || (firstGroupHeading && tmpspc == 1)) - { - yLocation += vlnPrintObject.SixLinesPerInch; - firstGroupHeading = false; - } - lastTOCGroupHeading = tocGrpHeading; - } - // need to do the section number, section title & page number. Page number - // has to be put on at end after number of page is known, so use a Template. - bool didGrp = false; - string tmptxt = mySection.MyContent.Number == null || mySection.MyContent.Number == "" ? " " : mySection.DisplayNumber;// B2017-019 - process "" in section number - if (tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCRemoveGrpNameInSects - && tocGrpHeading.Length > 0 && tmptxt.ToUpper().Contains(tocGrpHeading)) - { - tmptxt = tmptxt.Replace(tocGrpHeading, ""); - didGrp = true; - } - if (tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCRemoveGrpNameInSects - && lastTOCGroupHeading.Length > 0 && tmptxt.ToUpper().Contains(lastTOCGroupHeading)) - { - tmptxt = tmptxt.Replace(lastTOCGroupHeading, ""); - didGrp = true; - } - string rtfText = GetRtfToC(tmptxt, tOfC); - Paragraph myparagraphSecNum = vlnPrintObject.RtfToParagraph(rtfText); - float width = 0; - foreach (Chunk chkt in myparagraphSecNum.Chunks) - width += chkt.GetWidthPoint(); - float numwidth = width; - Rtf2Pdf.Offset = new PointF(0, 2.5F); - - // if the starting column of text would be in 'middle of' the number, just put it - // a few spaces after the number. The '18' below represents 3 chars. - float adjSecTitlePos = secTitlePos + indentOffset + (level * 6); - if (secNumPos + numwidth + indentOffset > secTitlePos + indentOffset) - adjSecTitlePos = secNumPos + numwidth + 18 - xAdjTitleIndent + indentOffset; - - // logic put in for V.C. Summer who wants to their auto table of contents to print "OPERATOR ACTIONS" (set in the format) instead of "Procedure Steps" - // - note that Summer didn't want to change the section title because they want transition to say "procedure step" for the section title. 03/08/2016 - string tocSecTitle = mySection.FormattedDisplayText;// B2017-019 - process "" in section title - tocSecTitle = ConvertSpecialChars(tocSecTitle, ii.ActiveFormat.PlantFormat.FormatData); // B2019-172 process symbol characters - if (tocSecTitle.ToUpper() == "PROCEDURE STEPS" && tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCProcedureStepsTitle != "") - tocSecTitle = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCProcedureStepsTitle; - - // Do the title first since it may wrap to 2nd line and this is an issue for - // doing a pagebreak, i.e. may cause a page break when the number on a single line - // would not. - //if (tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData - if (level == 0 && tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCUnderlineFirstLevelTitle) - { - VE_Font ovrFont = new VE_Font(tOfC.Font.Family, (int)tOfC.Font.Size, (E_Style)tOfC.Font.Style | E_Style.Underline, (float)tOfC.Font.CPI); - rtfText = GetRtfToC(tocSecTitle, tOfC, ovrFont); - } - else - rtfText = GetRtfToC(tocSecTitle, tOfC); - Paragraph myparagraphSecTitle = vlnPrintObject.RtfToParagraph(rtfText); // section title - width = secPagePos - adjSecTitlePos - ((tOfC.TofCPageNumAlign.ToUpper() == "RIGHT") ? 18 : 6);// B2021-109 proper adjustment of section title width - copied from leader dots lenth calcuation below - float savTitleWid = width; - // for South Texas Table of Contents - // if there is no section number (we put a blank in tmptxt) then move the section title over to the section number position - if (doGroupHeading) // see if the group title and the first item under it will fit on the page B2016-216 - { - VE_Font grpingFont = new VE_Font(tOfC.Font.Family, (int)tOfC.Font.Size, (E_Style)tOfC.Font.Style | E_Style.Underline, (float)tOfC.Font.CPI); - string rtfGrpingText = GetRtfToC(tocGrpHeading, tOfC, grpingFont); - Paragraph myparagraphGrpTitle = vlnPrintObject.RtfToParagraph(rtfGrpingText); - float w = secPagePos - 6; - // F2018-033: Farley Auto TOC. If line spacing is less than 0, then spacing is double spaced if on section items (such as - // Purpose, Proc Steps; and spacing is single spaced if within groups. If not less than 0, just use what is in format file. - int lnaftergroup = 1; - float lnsp = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacing ?? 0; - if (lnsp < 0) lnaftergroup = ((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 0) > 0) ? 1 : 2; - float yLocAfterGrpTitleAndFirstItem = yLocation + (lnaftergroup * vlnPrintObject.SixLinesPerInch) + vlnPrintObject.GetHeight(cb, myparagraphGrpTitle, string.Empty, w, false) + vlnPrintObject.GetHeight(cb, myparagraphSecTitle, string.Empty, savTitleWid, false); - // if group heading and first item under it does not fit on the page, do a page break - if ((yPageStart - yLocAfterGrpTitleAndFirstItem) < yBottomMargin) - { - NewPage(); - _MyHelper.ResetSvg(); // needed to reset so that PSNotFirst pagelist justify flag gets used for BGE - yLocation = lastyLocation = 0; - } - //if (yLocation > 0) yLocation += vlnPrintObject.SixLinesPerInch;// commented out for B2016-200 // for two blank line between last TOC title and the new grouping title - float rtnval = Rtf2Pdf.TextAt(cb, myparagraphGrpTitle, leftMargin + secNumPos, yPageStart - yLocation, w, height, "", yBottomMargin); // print the Group Title - yLocation += vlnPrintObject.SixLinesPerInch; // for two blank line between last TOC title and the new grouping title - added for B2016-200 - if (lnsp > -1) yLocation += (lnaftergroup * vlnPrintObject.SixLinesPerInch); // new line - } - // Print the section title - float retval = Rtf2Pdf.TextAt(cb, myparagraphSecTitle, leftMargin + ((tOfC.TofCSecNumPos == tOfC.TofCSecTitlePos && tmptxt.Equals(" ")) ? secNumPos : adjSecTitlePos), yPageStart - yLocation, width, height, "", yBottomMargin); - if (retval == 0) // couldn't fit, flags need for a page break. - { - NewPage(); - _MyHelper.ResetSvg(); // needed to reset so that PSNotFirst pagelist justify flag gets used for BGE - yLocation = lastyLocation = 0; - retval = Rtf2Pdf.TextAt(cb, myparagraphSecTitle, leftMargin + adjSecTitlePos, yPageStart - yLocation, width, height, "", yBottomMargin); - } - float ttlRetval = retval; - float savTitleFillWidth = Rtf2Pdf.FillWidth; - - // Now do the section number. Retval is the ylocation on page after the text - // is put out. - retval = Rtf2Pdf.TextAt(cb, myparagraphSecNum, leftMargin + secNumPos + indentOffset, yPageStart - yLocation, numwidth * 1.3F, height, "", yBottomMargin); - - //float lSpace = (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch; - - // adjust ylocation for pagenumber - the ylocation will get reset if the - // section title split on 2 lines and the page number needs to be on the 2nd line. - // Only do this if the title is not empty (the code was meant for if title spans more than a line) - if (retval != ttlRetval && mySection.MyContent.Text != null && mySection.MyContent.Text != "") yLocation += (retval - ttlRetval); - - // retval = the minimum (further down the page) between section number and - // title - this accounts for multi line title. - retval = Math.Min(retval, ttlRetval); - lastyLocation = retval; - - // check that the page number should be in the TOC (some BGE sections do not have the page number) - if (!((mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontNumberInTOC) == E_DocStructStyle.DontNumberInTOC)) - { - // add a template for the page number: - // if the space character is not null & is not a space, the we've got to put out - // these between the section title & the page number - if (tOfC.TofCSpaceChar != null && tOfC.TofCSpaceChar != "" && tOfC.TofCSpaceChar != " ") - { - width = 0; - foreach (Chunk chkt in myparagraphSecTitle.Chunks) - width += chkt.GetWidthPoint(); - - // get height - if two lines high, need width of 2nd line for adding - // space characters - float heightTtl = vlnPrintObject.GetHeight(cb, myparagraphSecTitle, string.Empty, savTitleWid, false); - string spaceStr = ""; - float startSpace = 0; - // the '6's in the next few code lines & in the 'while' loop below allows the placement of the dots (or other space character) - // to be not too close to section title & page number. - if (heightTtl > vlnPrintObject.SixLinesPerInch) - { - // this title is 2 or more lines, find start of leader dots by determining length of text - // on 2nd line (the savTitleFillWidth is the widest line of the split title) - float secondLineWidth = width - savTitleFillWidth; - startSpace = leftMargin + adjSecTitlePos + secondLineWidth + 6; - } - else - startSpace = leftMargin + adjSecTitlePos + width + 6; - // If the page number is Right justified, need less space characters ('.') so that page number - // doesn't have the last space character overwriting the 1st digit: - int endJust = (tOfC.TofCPageNumAlign.ToUpper() == "RIGHT") ? 18 : 6; - - float endSpace = leftMargin + secPagePos - endJust; - float numSpace = endSpace - startSpace; - rtfText = GetRtfToC(tOfC.TofCSpaceChar, tOfC); - Paragraph tmpmyparagraph = vlnPrintObject.RtfToParagraph(rtfText); - float spacchrwid = 0; - foreach (Chunk chkt in tmpmyparagraph.Chunks) - spacchrwid += chkt.GetWidthPoint(); - while (numSpace > 6) - { - spaceStr = spaceStr + tOfC.TofCSpaceChar; - numSpace -= spacchrwid; - } - - rtfText = GetRtfToC(spaceStr, tOfC); // out the leader dots - Paragraph myparagraphs = vlnPrintObject.RtfToParagraph(rtfText); - retval = Rtf2Pdf.TextAt(cb, myparagraphs, startSpace, yPageStart - yLocation, endSpace - startSpace, height, "", yBottomMargin); - - } - // if in the pre-table of content list, just put the page number out as text. - // otherwise, add a template _MyHelper.MyTOCPageCounts - string key = "TOC" + mySection.ItemID.ToString(); - if (mySection.IsAutoTOCSection || _MyHelper.MyTOCPageNums.ContainsKey(key)) - { - string pnum = _MyHelper.MyTOCPageNums.ContainsKey(key) ? _MyHelper.MyTOCPageNums[key].ToString() : (_MyHelper.CurrentTOCPageNumber + 1).ToString(); - rtfText = GetRtfToC(pnum, tOfC); - Paragraph myparagraphp = vlnPrintObject.RtfToParagraph(rtfText); - width = pnum.Length * 6; - retval = Rtf2Pdf.TextAt(cb, myparagraphp, leftMargin + secPagePos, yPageStart - yLocation, width, height, "", yBottomMargin); - } - else - AddTemplateTOCPageCounts(tOfC, yLocation, yPageStartAdj, leftMargin, secPagePos, height, key); - } - //If the format wants single spacing within subsections (2nd level and lower), then need to figure out - // spacing (vcb1 table of contents) - //bool dosuby = (((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 1) > 0) - // && (mySection.MyParent.IsSection && ((mySection.Sections != null && mySection.Sections.Count > 0) || (level > 0 && mySection.NextItem != null)))) - // || didGrp; - doSubY = (((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 1) > 0) - && (mySection.MyParent.IsSection && (/* mySection.Sections == null && */ sectCnt < ii.Sections.Count))) // B2016-205 - || didGrp; - //float spc = (float)(tOfC.TofCLineSpacing ?? 1); - if (doSubY) - { - float spcs = (float)(tOfC.TofCLineSpacingSub ?? 1); - if (spcs == -1) // F2018-033: Allow for single & double spacing for Farley (if in group or not) - { - if (inGroup) // Do not require a title to be placed on each section in group for Farley. If in group from above, single space - spcs = 1; - else - spcs = 2; - } - yLocation += (spcs * vlnPrintObject.SixLinesPerInch); - } - else - { - float spc = (float)(tOfC.TofCLineSpacing ?? 1); - if (spc == -1) // F2018-033: Allow for single & double spacing for Farley (if in group or not) - { - if (inGroup) // Do not require a title to be placed on each section in group for Farley. If in group from above, single space - spc = 1; - else - spc = 2; - } - yLocation += (spc * vlnPrintObject.SixLinesPerInch); - } - // C2021-015: Barakah High Level Steps in Table of Contents - check to see if we need to add the high level steps on - // table of contents for this section, format flag & section has steps: - if (mySection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCAllowHLS && - mySection.IsStepSection && mySection.Steps != null && mySection.Steps.Count > 0) - yLocation = AddHLSToTOC(tocSection, mySection, tOfC, cb, yPageStart, yLocation, doSubY, level + 1, adjSecTitlePos); - } - float savYLoc = yLocation; - yLocation = AddSectionToTOC(tocSection, mySection, tOfC, cb, yPageStart, yLocation, doSubY); - if (savYLoc == yLocation) // nothing was outputted i.e. the subsections are not included on the TOC // B2016-205 - { - if (doSubY && sectCnt == ii.Sections.Count) - { - // processed last sub-section so use the main section line spacing (most times is double spaced) - yLocation -= (float)(tOfC.TofCLineSpacingSub ?? 1) * vlnPrintObject.SixLinesPerInch; - yLocation += (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch; - } - } - } - } - } - return yLocation; - } - // C2021-015: Barakah High Level Steps in Table of Contents - private float AddHLSToTOC(SectionInfo tocSection, ItemInfo ii, TableOfContentsData tOfC, PdfContentByte cb, float yPageStart, float yLocation, bool didSubSecLineSpacing, int level, float parTitleXOff) - { - // if section is not in TOC, don't add the HLSs - SectionConfig sc = ii.ActiveSection.MyConfig as SectionConfig; - if (!((ii.ActiveSection.MyDocStyle != null && ii.ActiveSection.MyDocStyle.IncludeInTOC && (sc == null || sc.Section_TOC != "Y")) - || ((ii.ActiveSection.MyDocStyle == null || !ii.ActiveSection.MyDocStyle.IncludeInTOC) && (sc != null && sc.Section_TOC == "Y")))) - return yLocation; - float xAdjNumber = -6 + 1.2F; - float xAdjTitle = .8F + 1.2F; - float yadj = 0.5F; // tweak to get 16 & 32 bit output to match. - - float yPageStartAdj = yPageStart - yadj; - float leftMargin = (float)tocSection.MyDocStyle.Layout.LeftMargin; - float stepNumPos = (float)tOfC.TofCSecNumPos + xAdjNumber; - float stepTitlePos = (float)tOfC.TofCSecTitlePos + xAdjTitle; - float stepPagePos = (float)tOfC.TofCPageNumPos + xAdjNumber; - float height = tOfC.Font.WindowsFont.Size * 1.5F; - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("TOC Ystart {0} LeftMar {1} ScNmPos {2} ScTtlPos {3} ScPgPos {4}", yPageStart, leftMargin, stepNumPos, stepTitlePos, stepPagePos); - int tofCNumLevels = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCNumLevels ?? 0; - if (tofCNumLevels > 0 && level > tofCNumLevels) return yLocation; // don't go down more than number of levels as defined in format - - // figure out whether to indent. If not, set indentOffset to 0, otherwise indent number to where parent's text was (input parTitleXOff) - int startIndentAfterLevel = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCStartIndentAfterLevel ?? 2; // - level = level <= startIndentAfterLevel ? 0 : level - startIndentAfterLevel; - - // The parTitleXOff is passed in, it is the xoffset for the title of the section. This is where the number should - // start, if indenting. Without this, the xoffset was not correct: - float indentOffset = level == 0 ? 0 : parTitleXOff; - float numwidth = 0; - foreach (ItemInfo hls in ii.Steps) // Ouput each HLS that has config flag to include it. - { - StepConfig stc = hls.MyConfig as StepConfig; - if (stc != null && stc.Step_IncludeInTOC) - { - float yBottomMargin = yPageStart - (float)tocSection.MyDocStyle.Layout.PageLength + (2 * vlnPrintObject.SixLinesPerInch); - - // need to do the step number, title & page number. Page number has to be put on at end after number of page is known, so use a Template. - string tmptxt = hls.MyTab.CleanText; - if (tmptxt == null || tmptxt == "") tmptxt = " "; // if no number set to blanks. Without this, low level printing gets confused - string rtfText = GetRtfToC(tmptxt, tOfC); - Paragraph myparagraphStepNum = vlnPrintObject.RtfToParagraph(rtfText); - float width = 0; - foreach (Chunk chkt in myparagraphStepNum.Chunks) - width += chkt.GetWidthPoint(); - if (numwidth == 0) numwidth = width; // keep same xoffset for step text unless overwriting by number (see below) - Rtf2Pdf.Offset = new PointF(0, 2.5F); - - // if the starting column of text would be in 'middle of' the number, just put it - // a few spaces after the number. The '182' below represents 2 chars. - float adjStepTitlePos = indentOffset + numwidth + 6; - if (width + indentOffset > adjStepTitlePos) - { - adjStepTitlePos = numwidth + 12 + indentOffset; - numwidth = width; - } - - string tocStepTitle = hls.FormattedDisplayText; - tocStepTitle = ConvertSpecialChars(tocStepTitle, ii.ActiveFormat.PlantFormat.FormatData); // B2019-172 process symbol characters - rtfText = GetRtfToC(tocStepTitle, tOfC); - Paragraph myparagraphStepTitle = vlnPrintObject.RtfToParagraph(rtfText); - width = stepPagePos - adjStepTitlePos - ((tOfC.TofCPageNumAlign.ToUpper() == "RIGHT") ? 18 : 6);// B2021-109 proper adjustment of section title width - copied from leader dots lenth calcuation below - float savTitleWid = width; - // Print the step text - float retval = Rtf2Pdf.TextAt(cb, myparagraphStepTitle, leftMargin + ((tOfC.TofCSecNumPos == tOfC.TofCSecTitlePos && tmptxt.Equals(" ")) ? stepNumPos : adjStepTitlePos), yPageStart - yLocation, width, height, "", yBottomMargin); - if (retval == 0) // couldn't fit, flags need for a page break. - { - NewPage(); - _MyHelper.ResetSvg(); // needed to reset so that PSNotFirst pagelist justify flag gets used for BGE - yLocation = lastyLocation = 0; - retval = Rtf2Pdf.TextAt(cb, myparagraphStepTitle, leftMargin + adjStepTitlePos, yPageStart - yLocation, width, height, "", yBottomMargin); - } - float ttlRetval = retval; - float savTitleFillWidth = Rtf2Pdf.FillWidth; - - // Now do the step number. Retval is the ylocation on page after the text is put out - retval = Rtf2Pdf.TextAt(cb, myparagraphStepNum, leftMargin + indentOffset, yPageStart - yLocation, numwidth * 1.3F, height, "", yBottomMargin); - if (retval != ttlRetval) yLocation += (retval - ttlRetval); - - // retval = the minimum (further down the page) between step number & text - accounts for multi line step - retval = Math.Min(retval, ttlRetval); - lastyLocation = retval; - - // add a template for the page number: - // if the space character is not null & is not a space, the we've got to put out - // these between the section title & the page number - if (tOfC.TofCSpaceChar != null && tOfC.TofCSpaceChar != "" && tOfC.TofCSpaceChar != " ") - { - width = 0; - foreach (Chunk chkt in myparagraphStepTitle.Chunks) - width += chkt.GetWidthPoint(); - - // get height - if two lines high, need width of 2nd line for adding - // space characters - float heightTtl = vlnPrintObject.GetHeight(cb, myparagraphStepTitle, string.Empty, savTitleWid, false); - string spaceStr = ""; - float startSpace = 0; - // the '6's in the next few code lines & in the 'while' loop below allows the placement of the dots (or other space character) - // to be not too close to section title & page number. - if (heightTtl > vlnPrintObject.SixLinesPerInch) - { - // this title is 2 or more lines, find start of leader dots by determining length of text - // on 2nd line (the savTitleFillWidth is the widest line of the split title) - float secondLineWidth = width - savTitleFillWidth; - startSpace = leftMargin + adjStepTitlePos + secondLineWidth + 6; - } - else - startSpace = leftMargin + adjStepTitlePos + width + 6; - // If the page number is Right justified, need less space characters ('.') so that page number - // doesn't have the last space character overwriting the 1st digit: - int endJust = (tOfC.TofCPageNumAlign.ToUpper() == "RIGHT") ? 18 : 6; - - float endSpace = leftMargin + stepPagePos - endJust; - float numSpace = endSpace - startSpace; - rtfText = GetRtfToC(tOfC.TofCSpaceChar, tOfC); - Paragraph tmpmyparagraph = vlnPrintObject.RtfToParagraph(rtfText); - float spacchrwid = 0; - foreach (Chunk chkt in tmpmyparagraph.Chunks) - spacchrwid += chkt.GetWidthPoint(); - while (numSpace > 6) - { - spaceStr = spaceStr + tOfC.TofCSpaceChar; - numSpace -= spacchrwid; - } - - rtfText = GetRtfToC(spaceStr, tOfC); // out the leader dots - Paragraph myparagraphs = vlnPrintObject.RtfToParagraph(rtfText); - retval = Rtf2Pdf.TextAt(cb, myparagraphs, startSpace, yPageStart - yLocation, endSpace - startSpace, height, "", yBottomMargin); - } - // if in the pre-table of content list, just put the page number out as text. - // otherwise, add a template _MyHelper.MyTOCPageCounts - string key = "TOC" + hls.ItemID.ToString(); - if (ii.IsAutoTOCSection || _MyHelper.MyTOCPageNums.ContainsKey(key)) - { - string pnum = _MyHelper.MyTOCPageNums.ContainsKey(key) ? _MyHelper.MyTOCPageNums[key].ToString() : (_MyHelper.CurrentTOCPageNumber + 1).ToString(); - rtfText = GetRtfToC(pnum, tOfC); - Paragraph myparagraphp = vlnPrintObject.RtfToParagraph(rtfText); - width = pnum.Length * 6; - retval = Rtf2Pdf.TextAt(cb, myparagraphp, leftMargin + stepPagePos, yPageStart - yLocation, width, height, "", yBottomMargin); - } - else - AddTemplateTOCPageCounts(tOfC, yLocation, yPageStartAdj, leftMargin, stepPagePos, height, key); - - float spc = (float)(tOfC.TofCLineSpacing ?? 1); - yLocation += (spc * vlnPrintObject.SixLinesPerInch); - } - - } - return yLocation; - } - //B2019-172 This will add the RTF font commands around the symbol characters - // This was copied for DisplaySearch and modified - added the FormatData parameter - private string ConvertSpecialChars(string str, FormatData fmtData) - { - string rtnVal = str; - rtnVal = rtnVal.Replace("\u00A0", @"\u160?"); //convert \u00A0 to a hard space (\u00A0 shows as a blank in the search text field) - rtnVal = rtnVal.Replace("\n", @"\line "); //B2018-020 SQL content record has "\line " for the hard return - // Bug fix B2014-057 - // if we are searching for a symbol character in all procedure sets MyDocVersion is null - // when MyDocVersion is null, get the symbol list directly from the PROMS base format (BaseAll.xml) - if (fmtData != null && fmtData.SymbolList != null) - { - SymbolList sl = fmtData.SymbolList; - if (sl != null) - { - foreach (Symbol sym in sl) - { - string rplace = string.Format(sym.Unicode < 256 ? @"\'{0:X2}" : @"\u{0}?", sym.Unicode); // bug fix B2014-057 we were not including the ? in the replace - rtnVal = rtnVal.Replace(((char)sym.Unicode).ToString(), rplace); - } - } - } - return rtnVal; - } - - private void AddTemplateTOCPageCounts(TableOfContentsData tOfC, float yLocation, float yPageStartAdj, float leftMargin, float secPagePos, float height, string key) - { - PdfTemplate tmp = _MyHelper.MyTOCPageCounts.AddToTemplateList(key, _MyHelper.MyPdfWriter, "{TOCPAGE}", tOfC.Font.WindowsFont, (tOfC.TofCPageNumAlign.ToUpper() == "RIGHT") ? Element.ALIGN_RIGHT : Element.ALIGN_LEFT, PrintOverride.TextColor); - _MyHelper.MyPdfContentByte.AddTemplate(tmp, leftMargin + secPagePos, (yPageStartAdj - yLocation) - height / 2); - } - - //private string GetRtfPlacekeeper(string txt, PlacekeeperData pkCData) - //{ - // StringBuilder _RtfSB = new StringBuilder(); - // Volian.Controls.Library.DisplayText pktxt = new Volian.Controls.Library.DisplayText(txt, pkCData.Font, false); - // System.Drawing.Font myFont = pktxt.TextFont.WindowsFont; - // _RtfSB.Append(vlnPrintObject.AddFontTable(myFont)); - // _RtfSB.Append(pktxt.StartText); - // _RtfSB.Append("}"); - // return _RtfSB.ToString(); - //} - //private float AddSectionToPK(SectionInfo pkSection, ItemInfo ii, PlacekeeperData pkData, PdfContentByte cb, float yPageStart, float yLocation) - //{ - // SectionConfig pkSC = pkSection.MyConfig as SectionConfig; - // if (pkSC.Section_Placekeeper != "Y") return yLocation; // automatic generation of Placekeeper turned off - // float xAdjNumber = -6 + 1.2F; - // float xAdjTitle = .8F + 1.2F; - // float xAdjTitleIndent = -6 + 2.4F; - // float yadj = 0.5F; // tweak to get 16 & 32 bit output to match. - - // float yPageStartAdj = yPageStart - yadj; - // float leftMargin = (float)pkSection.MyDocStyle.Layout.LeftMargin; - // //float secNumPos = (float)tOfC.TofCSecNumPos + xAdjNumber; - // //float secTitlePos = (float)tOfC.TofCSecTitlePos + xAdjTitle; - // //float secPagePos = (float)tOfC.TofCPageNumPos + xAdjNumber; - // //float height = tOfC.Font.WindowsFont.Size * 1.5F; - // if (ii.Sections != null) - // { - // foreach (SectionInfo mySection in ii.Sections) - // { - // SectionConfig sc = mySection.MyConfig as SectionConfig; - // if (mySection.ItemID != pkSection.ItemID && sc != null && sc.Section_Placekeeper == "Y") - // { - // // Look at each step in the section and build a Placekeeper for those steps that are marked - - // // need to do the section number, section title & page number. Page number - // // has to be put on at end after number of page is known, so use a Template. - // //string tmptxt = mySection.MyContent.Number == null || mySection.MyContent.Number == "" ? " " : mySection.MyContent.Number; - // //string rtfText = GetRtfPlacekeeper(tmptxt, pkData);//GetRtfToC(tmptxt, tOfC); - // //Paragraph myparagraphn = vlnPrintObject.RtfToParagraph(rtfText); - // float width = 0; - // //foreach (Chunk chkt in myparagraphn.Chunks) - // // width += chkt.GetWidthPoint(); - // float numwidth = width; - // float yBottomMargin = yPageStart - (float)pkSection.MyDocStyle.Layout.PageLength + (2 * vlnPrintObject.SixLinesPerInch); - // Rtf2Pdf.Offset = new PointF(0, 2.5F); - - // //// for indenting of subsections, count up tree. Only start indenting - // //// at third level, i.e. not indent on 1.0 and 1.1, but indent on 1.1.1: - // //int level = 0; - // //ItemInfo iilvl = mySection as ItemInfo; - // //while (!iilvl.IsProcedure) - // //{ - // // level++; - // // iilvl = iilvl.MyParent; - // //} - // //// check what level the plant wants the auto ToC indented: - // //int tofCNumLevels = pkSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCNumLevels ?? 0; - // //if (tofCNumLevels > 0 && level > tofCNumLevels) return yLocation; - - // //level = level <= 2 ? 0 : level - 2; // no indenting until third level - // //float indentOffset = (level * (secTitlePos - secNumPos)); - - // // if the starting column of text would be in 'middle of' the number, just put it - // // a few spaces after the number. The '18' below represents 3 chars. - // //float adjSecTitlePos = secTitlePos + indentOffset + (level * 6); - // //if (secNumPos + numwidth + indentOffset > secTitlePos + indentOffset) - // // adjSecTitlePos = secNumPos + numwidth + 18 - xAdjTitleIndent + indentOffset; - // //rtfText = GetRtfToC(mySection.MyContent.Text, tOfC); - // //Paragraph myparagrapht = vlnPrintObject.RtfToParagraph(rtfText); - // //width = secPagePos - adjSecTitlePos - 6; - // //float retval = Rtf2Pdf.TextAt(cb, myparagrapht, leftMargin + adjSecTitlePos, yPageStart - yLocation, width, height, "", yBottomMargin); - // //float ttlRetval = retval; - // //if (retval == 0) - // //{ - // // cb.PdfDocument.NewPage(); - // // //_MyLog.InfoFormat("NewPage 5 {0}", cb.PdfWriter.CurrentPageNumber); - // // yLocation = lastyLocation = 0; - // // retval = Rtf2Pdf.TextAt(cb, myparagrapht, leftMargin + adjSecTitlePos, yPageStart - yLocation, width, height, "", yBottomMargin); - // // ttlRetval = retval; - // //} - // //retval = Rtf2Pdf.TextAt(cb, myparagraphn, leftMargin + secNumPos + indentOffset, yPageStart - yLocation, width * 1.3F, height, "", yBottomMargin); - // //if (retval == 0) // do a newpage, it couldn't fit on current page. - // //{ - // // cb.PdfDocument.NewPage(); - // // //_MyLog.InfoFormat("NewPage 5 {0}", cb.PdfWriter.CurrentPageNumber); - // // yLocation = lastyLocation = 0; - // // retval = Rtf2Pdf.TextAt(cb, myparagraphn, leftMargin + secNumPos + indentOffset, yPageStart - yLocation, width * 1.3F, height, "", yBottomMargin); - // //} - // //retval = Math.Min(retval, ttlRetval); - // //float lSpace = (tOfC.TofCLineSpacing == 2) ? 2 * vlnPrintObject.SixLinesPerInch : vlnPrintObject.SixLinesPerInch; - // //if (lastyLocation != 0 && ((lastyLocation - retval) > lSpace)) - // // yLocation += (lastyLocation - retval - lSpace); - // //lastyLocation = retval; - - // //// check that the page number should be in the TOC (some BGE sections do not have the page number) - // //if (!((mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontNumberInTOC) == E_DocStructStyle.DontNumberInTOC)) - // //{ - // // // add a template for the page number: - // // // if the space character is not null & is not a space, the we've got to put out - // // // these between the section title & the page number - // // if (tOfC.TofCSpaceChar != null && tOfC.TofCSpaceChar != "" && tOfC.TofCSpaceChar != " ") - // // { - // // width = 0; - // // foreach (Chunk chkt in myparagrapht.Chunks) - // // width += chkt.GetWidthPoint(); - // // float startSpace = leftMargin + adjSecTitlePos + width; - // // float endSpace = leftMargin + secPagePos; - // // float numSpace = endSpace - startSpace; - // // string spaceStr = ""; - // // rtfText = GetRtfToC(tOfC.TofCSpaceChar, tOfC); - // // Paragraph tmpmyparagraph = vlnPrintObject.RtfToParagraph(rtfText); - // // float spacchrwid = 0; - // // foreach (Chunk chkt in tmpmyparagraph.Chunks) - // // spacchrwid += chkt.GetWidthPoint(); - // // while (numSpace > 0) - // // { - // // spaceStr = spaceStr + tOfC.TofCSpaceChar; - // // numSpace -= spacchrwid; - // // } - // // rtfText = GetRtfToC(spaceStr, tOfC); - // // Paragraph myparagraphs = vlnPrintObject.RtfToParagraph(rtfText); - // // retval = Rtf2Pdf.TextAt(cb, myparagraphs, startSpace, yPageStart - yLocation, endSpace - startSpace, height, "", yBottomMargin); - // // } - // // // if in the pre-table of content list, just put the page number out as text. - // // // otherwise, add a template _MyHelper.MyTOCPageCounts - // // string key = "TOC" + mySection.ItemID.ToString(); - // // if (mySection.IsAutoTOCSection || _MyHelper.MyTOCPageNums.ContainsKey(key)) - // // { - // // string pnum = _MyHelper.MyTOCPageNums.ContainsKey(key) ? _MyHelper.MyTOCPageNums[key].ToString() : (_MyHelper.CurrentTOCPageNumber + 1).ToString(); - // // rtfText = GetRtfToC(pnum, tOfC); - // // Paragraph myparagraphp = vlnPrintObject.RtfToParagraph(rtfText); - // // width = pnum.Length * 6; - // // retval = Rtf2Pdf.TextAt(cb, myparagraphp, leftMargin + secPagePos, yPageStart - yLocation, width, height, "", yBottomMargin); - // // } - // // else - // // AddTemplateTOCPageCounts(tOfC, yLocation, yPageStartAdj, leftMargin, secPagePos, height, mySection); - // //} - - // yLocation += vlnPrintObject.SixLinesPerInch; - // } - // //yLocation = AddSectionToTOC(tocSection, mySection, tOfC, cb, yPageStart, yLocation); - // } - // } - // return yLocation; - //} - - //private void AddTemplatePKPageCounts(TableOfContentsData tOfC, float yLocation, float yPageStartAdj, float leftMargin, float secPagePos, float height, SectionInfo mySection) - //{ - // string key = "PK" + mySection.ItemID.ToString(); - // PdfTemplate tmp = _MyHelper.MyTOCPageCounts.AddToTemplateList(key, _MyHelper.MyPdfWriter, "{TOCPAGE}", tOfC.Font.WindowsFont, Element.ALIGN_LEFT, PrintOverride.TextColor); - // _MyHelper.MyPdfContentByte.AddTemplate(tmp, leftMargin + secPagePos, (yPageStartAdj - yLocation) - height / 2); - //} - private static void PrintTextMessage(PdfContentByte cb, string message, PdfLayer textLayer, iTextSharp.text.Font font) - { - if (textLayer != null) cb.BeginLayer(textLayer); - float fontSize = font.Size; - ColumnText ct = new ColumnText(cb); - //iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize,iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(PrintOverride.TextColor)); - Chunk chk = new Chunk(message, font); - float xCenter = cb.PdfDocument.PageSize.Width / 2; - float yCenter = cb.PdfDocument.PageSize.Height / 2; // 1.8f; - float width = chk.GetWidthPoint() * 1.01F; - float height = fontSize * 1.5F; - ct.SetSimpleColumn(xCenter - width / 2, yCenter - height / 2, xCenter + width / 2, yCenter + height / 2); - Phrase ph = new Phrase(chk); - ct.AddElement(ph); - cb.SetColorFill(new iTextSharp.text.Color(PrintOverride.TextColor)); - ct.Go(); - if (textLayer != null) cb.EndLayer(); - } - private float _NoBreakYOffset = 0; - private float _NoBreakYPageStart = 0; - private void CreateStepPdf(SectionInfo section, PdfContentByte cb) - { - int profileDepth = ProfileTimer.Push(">>>> CreateStepPdf"); - //PrintTimer pt = new PrintTimer(); - iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter; - ItemInfo myItemInfo = section as ItemInfo; - if (SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks) - { - section.StepSectPageBreaksForSupInfo.Clear(); - section.StepSectPageBreaks.Clear(); - } - // 792: 72 * 11 inches - TopRow - Top is high value for 8.5x11 paper, 842 for A4 paper - float _PointsPerPage = PDFPageSize.PaperSizePoints(myItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - float yTopMargin = _PointsPerPage - (float)myItemInfo.MyDocStyle.Layout.TopMargin; - yTopMargin -= _MyHelper.AdjustTopMarginForMultiLinePageListItems; - // the following line was modified to comment out the - 2 * SixLinesPerInch. this fixed a pagination problem with WCN EMG E-3. - // The change mentioned above caused the bottom message to print without a line separating it from step text (if the text was long - // enough to go to the bottom of page). A fix for this problem, B2017-103, is to use a format variable to define - // how many lines will go above the continue message. It was done this way so that it fixes the format/data that the problem - // was found in, i.e. Ginna Rev2 SAMG, SAG-3 step 7. This change won't affect other plants/formats but if the problem occurs - // the format value can be used to adjust the location of bottom message. However, this could adversely affect pagination and - // each plant/format needs to be done on a case by base basis. - float yBottomMargin = Math.Max(0, yTopMargin - (float)myItemInfo.MyDocStyle.Layout.PageLength - (myItemInfo.MyDocStyle.Continue.Bottom.LocAdj == null ? 0 : (int)myItemInfo.MyDocStyle.Continue.Bottom.LocAdj)); - vlnParagraph.PathPrefix = myItemInfo.Path; - //Rtf2Pdf.PdfDebug = true; - Rtf2Pdf.Offset = new PointF(0, 2.5F); - if (section.MyDocStyle.LandscapePageList) - { - if ((section.MyConfig as SectionConfig).Section_Pagination == SectionConfig.SectionPagination.Separate) - { - System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0); - cb.Transform(myMatrix); - _MyHelper.IsWatermarkLandscape = true; // B2019-145: watermark on landscape page - } - } - else - _MyHelper.IsLandscape = false; - _MyHelper.ChangeBarDefinition = MyChangeBarDefinition; - //pt.Description = "vlnParagrph"; - vlnParagraph myParagraph = new vlnParagraph(null, cb, myItemInfo, (float)myItemInfo.MyDocStyle.Layout.LeftMargin, _NoBreakYOffset, 0, myItemInfo.ColumnMode, myItemInfo.ActiveFormat, null, null, 0, true, this); - //pt.Description = "After vlnParagrph"; - //if (myParagraph.MyItemInfo.InList(15906)) - //{ - // CPSGen myGen = new CPSGen(myParagraph); - // myGen.Generate("TestCPSGEN.xml"); - //} - float localYPageStart = 0; - float yPageStart = yTopMargin; - if (myItemInfo.HasChildren || myItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0 || (myItemInfo.ActiveFormat.PlantFormat.FormatData.Express && myItemInfo.MyDocStyle.OptionalSectionContent)) - { - // if there is supplemental information associated with this section... generate the pdf. This pdf will be used to place - // supplemental information on facing pages - // B2017-267 Put in the DocStyle setting "AdjustTopMarginOnStepContinuePages" for Farley who uses the "PSOnlyFirst" in some of their pagelists so that a section title is printed only on the first page of the section. - // This will adjust the top margin when the section title is not printed on the other pages. - yTopMargin += myItemInfo.MyDocStyle.AdjustTopMarginOnStepContinuePages; - if (SupInfoPrintType == E_SupInfoPrintType.Merge && myParagraph.SupInfoSection != null && myParagraph.SupInfoSection.ChildrenBelow != null && myParagraph.SupInfoSection.ChildrenBelow.Count > 0) - GenerateSuppInfoPdf(myParagraph.SupInfoSection, yTopMargin, yBottomMargin); - localYPageStart = myParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - if (myParagraph.MyPlaceKeeper != null) - _MyHelper.MyPlacekeepers.Add(myParagraph.MyPlaceKeeper); // add this step text to the PlaceKeeper (Calvert Cliffs) - if (myParagraph.MyContAct != null) - _MyHelper.MyContActSteps.Add(myParagraph.MyContAct); // add this step to the Continuous Action Summary - // F2022-024 Time Critical Action - if (myParagraph.MyTimeCriticalAction != null) - _MyHelper.MyTimeCriticalActionSteps.Add(myParagraph.MyTimeCriticalAction); // add this step to the Time Critical Action Summary - } - else if (!myItemInfo.MyDocStyle.OptionalSectionContent) - { - SectionInfo si = myItemInfo.ActiveSection as SectionInfo; - if (si.IsSeparatePagination()) // Don't output this message for continuous sections - { - // This was causing overlap of this message with previous sections - iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 30, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(PrintOverride.TextColor)); - PrintTextMessage(cb, "No Section Content", _TextLayer, font); - } - } - SectionConfig.SectionPagination sp = SectionConfig.SectionPagination.Separate; // always the default - ItemInfo nxtItem = section.NextItem; - if (nxtItem != null) - { - // if this section & the next section are not accessory pages, see if there is continuous pagination, - // i.e. no page break between them. - if (section.IsStepSection && nxtItem.IsStepSection) - { - SectionInfo si = nxtItem as SectionInfo; - // B2017-201 if si is null we need to get it via the ItemID - if (si == null) - si = SectionInfo.Get(nxtItem.ItemID); //ActiveSection as SectionInfo; - SectionConfig sc = si.SectionConfig; - try - { - if (sc != null) sp = sc.Section_Pagination; - } - catch (Exception ex) - { - sp = SectionConfig.SectionPagination.Separate; - } - } - } - if (sp == SectionConfig.SectionPagination.Separate) - { - if (section.MyDocStyle.LandscapePageList) - { - _MyHelper.IsLandscape = false; - } - NewPage(true); // end of step section - //_MyLog.InfoFormat("NewPage 6 {0}", cb.PdfWriter.CurrentPageNumber); - _NoBreakYOffset = 0; - yPageStart = yTopMargin; - } - else - { - if (nxtItem != null && nxtItem.MyPrevious != null && nxtItem.ActiveFormat.PlantFormat.FormatData.SectData.SectionHeader.Level0Big) - localYPageStart -= 12; - if (_MyHelper.BottomMessage != null && _MyHelper.BottomMessage.Count != 0) - { - _MyHelper.DrawBottomMessage(cb); - localYPageStart += 12; - myParagraph.YBottomMost += 24; // two lines. - } - float tmplocal = localYPageStart; - _NoBreakYOffset = myParagraph.YBottomMost; - float yOffset = localYPageStart - yTopMargin; - _NoBreakYOffset -= yOffset; - yPageStart = localYPageStart; - Volian.Base.Library.DebugText.WriteLine("NOBREAK:{0},'{1}','{2}','{3}','{4}','{5}'", section.ItemID, tmplocal, yTopMargin, localYPageStart, _NoBreakYOffset, myParagraph.YBottomMost); - } - OnStatusChanged("StepSection converted to PDF " + section.ShortPath, PromsPrinterStatusType.BuildStep); - //pt.Description = "End"; - ProfileTimer.Pop(profileDepth); - _MyHelper.IsWatermarkLandscape = false; - } - - private void GenerateSuppInfoPdf(vlnParagraph vlnParagraph, float yTopMargin, float yBottomMargin) - { - ReaderHelper savMyReaderHelper = MyReaderHelper; - PdfContentByte savMyContentByte = MyContentByte; - VlnSvgPageHelper savMyHelper = _MyHelper; - if (SupInfoPdfPage == null) SupInfoPdfPage = new Dictionary(); - else SupInfoPdfPage.Clear(); - string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + vlnParagraph.MyItemInfo.ItemID.ToString() + @".pdf"; - iTextSharp.text.Rectangle pageSize = PDFPageSize.UsePaperSize(MyItem.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - PdfContentByte cb = OpenDoc(ref SupInfoPdfName, pageSize); - if (cb == null) return; - VlnSvgPageHelper myPageHelper = new VlnSvgPageHelper(vlnParagraph.MyItemInfo as SectionInfo, this, null, 0, _prtSectID); - cb.PdfWriter.PageEvent = myPageHelper; - myPageHelper.AllowAllWatermarks = AllowAllWatermarks; - myPageHelper.MyPdfWriter = cb.PdfWriter; - myPageHelper.CreatingFoldoutPage = false; - myPageHelper.CreatingSupInfoPage = true; - myPageHelper.MyPdfContentByte = cb; - myPageHelper.ChangeBarDefinition = MyChangeBarDefinition; - float yPageStart = yTopMargin; - vlnParagraph._yPageStartForSupInfo = yTopMargin; - SupInfoAjustGroupings(vlnParagraph, cb); - SupInfoPrintType = E_SupInfoPrintType.SupInfoPdfPrint; - vlnParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - SupInfoPrintType = E_SupInfoPrintType.Merge; - try - { - cb.PdfDocument.Close(); - cb = null; - } - catch (Exception ex) - { - Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); - } - _MyHelper = savMyHelper; - MyContentByte = savMyContentByte; - MyReaderHelper = savMyReaderHelper; - } - #region ShrinkSupInfoGroupAtATime - private Dictionary _AdjustForParagraphShrinkage; - private float _LastOffset; - private float _LastBottom; - /// - /// Adjust the font size so that the Supplemental Information will fit on a single page. - /// - /// supinfo paragraphs - /// pdfcontentbyte - private void SupInfoAjustGroupings(vlnParagraph vlnParagraph, PdfContentByte cb) - { - // Get groups of SupInfo paragraphs - List> supInfoGroups = FindSupInfoGroups(vlnParagraph); - float pageLength = (float)vlnParagraph.MyItemInfo.MyDocStyle.Layout.PageLength; - // Process Each Group of SupInfo paragraphs - foreach (List grp in supInfoGroups) - { - // Initialize font decrement - float decrement = 2f; - float fontSize = grp[0].IParagraph.Leading; // current font size - float mpglen = MeasureSupInfoGroupLength(grp, cb, pageLength); // Measure the length of the group of supinfo paragraphs - // If the group does not fit on a page then reduce the font size - if (mpglen > pageLength) - { - float newFontSize = fontSize; - // reduce the font size by _Decrement until the entire grouping fits on one page - while (mpglen > pageLength) // While the measured supinfo group length is greatere than the page length - { - newFontSize = fontSize - decrement; - float scaler = newFontSize / fontSize;// Calculate the reduction - ReduceSupInfoGroupFontSize(grp, scaler, cb); // Apply the smaller font size - fontSize = newFontSize; // adjust the base font size - mpglen = MeasureSupInfoGroupLength(grp, cb, pageLength);// Measure the length of the group of supinfo paragraphs - } - // Binary Search to find proper font size within .1 - while (decrement > .1f) - { - decrement = decrement / 2f; //Reduce the decrement by half - if (mpglen > pageLength) // If the measured length is too big - newFontSize -= decrement;// Reduce the font size - else - newFontSize += decrement;//Otherwise increase the font size - float scaler = newFontSize / fontSize;// Calculate the reduction - ReduceSupInfoGroupFontSize(grp, scaler, cb);// apply the new font size - fontSize = newFontSize;// adjust the base font size - mpglen = MeasureSupInfoGroupLength(grp, cb, pageLength);// Measure the length of the group of supinfo paragraphs - } - if (mpglen > pageLength) //If the measured lenght is greater than the page length reduce the font size - { - newFontSize -= decrement;// Reduce the font size - float scaler = newFontSize / fontSize;// Calculate the reduction - ReduceSupInfoGroupFontSize(grp, scaler, cb);// apply the new font size - fontSize = newFontSize;// adjust the base font size - mpglen = MeasureSupInfoGroupLength(grp, cb, pageLength);// Measure the length of the group of supinfo paragraphs - } - } - } - } - /// - /// Method to apply a multiplier to the font size to a group of supinfo paragraphs - /// - /// group of SupInfo paragraphs - /// multiplier for font size - /// The PDFContentByte which is needed to calculate the adjusted the paragraph height - private void ReduceSupInfoGroupFontSize(List grp, float scaler, PdfContentByte cb) - { - foreach (vlnParagraph pg in grp) // For each paragraph and children apply the scaler - { - // When adjusting the font size if the change causes the paragraph to change due to the number of characters - // per line these changes will impact the paragraphs below the affected paragraph - // This is kept in a dictionary. The key is the vertical offset to the affected paragraph. - // The value is the impact on the paragraph height. - _AdjustForParagraphShrinkage = new Dictionary(); - // Apply the scaler to each paragraph - ReduceSupInfoGroupFontSize(pg, scaler, cb); - } - } - /// - /// Method to apply a multiplier to the font size to a supinfo paragraph and children - /// - /// supinfo paragraph - /// font multiplier - /// pdfcontentbyte - private void ReduceSupInfoGroupFontSize(vlnParagraph pg, float scaler, PdfContentByte cb) - { - float hBefore = pg.Height;// Save initial paragraph height - AdjustSupInfoTable(pg, scaler, cb); - NewSupInfoFixChunks(pg, scaler);// Apply multiplier to font size - pg.IParagraph.Leading = scaler * pg.IParagraph.Leading; // Adjust leading (line spacing) - // B2017-112: Don't do the font size change if images. - // B2017-116: Don;t do the font size change for RTF Raw - if (pg.ImageText == null && !pg.MyItemInfo.IsRtfRaw) - { - float hAfter = pg.GetParagraphHeight(cb, pg.IParagraph, "", pg.Width); // Calculate new paragraph height - pg.Height = hAfter; // Save new Height; - pg.YBottomMost += hAfter - hBefore; // Adjust YbottomMost for font size and leading - float hleading = hBefore * scaler; // Calcuate leading change - // If the change in font size effects the paragraph height due to word wrapping save the impact to adjust - // Offsets below - if ((hleading > hAfter + 1 && scaler < 1f) || (hleading < hAfter + 1 && scaler > 1f)) - { - if (!_AdjustForParagraphShrinkage.ContainsKey(pg.YOffset)) - { - _AdjustForParagraphShrinkage.Add(pg.YOffset, hleading - hAfter); - } - } - } - else // Adjust the Image Size B2017-112 And B2017-116 - { - pg.ImageScaler *= scaler; - pg.Height *= scaler; - pg.Width *= scaler; - } - float yoBefore = pg.YOffset;// Save the offset before - float yoAfter = pg.YOffset = NewSupInfoFixOffset(pg, scaler);// Calculate the offset after - pg.YBottomMost += yoAfter - yoBefore;// Adjust YbottomMost for changes to yOffset - foreach (vlnParagraph cpg in pg.ChildrenAbove)// Process Children Above - ReduceSupInfoGroupFontSize(cpg, scaler, cb); - foreach (vlnParagraph cpg in pg.ChildrenBelow)// Process Children Below - ReduceSupInfoGroupFontSize(cpg, scaler, cb); - foreach (vlnParagraph cpg in pg.ChildrenLeft)// Process Children Left - ReduceSupInfoGroupFontSize(cpg, scaler, cb); - foreach (vlnParagraph cpg in pg.ChildrenRight)// Process Children Right - ReduceSupInfoGroupFontSize(cpg, scaler, cb); - foreach (vlnPrintObject po in pg.PartsAbove) // Process Parts Above (headers) - NewSupInfoFixParts(po, scaler); - foreach (vlnPrintObject po in pg.PartsBelow) // Process Parts Below (unknown) - NewSupInfoFixParts(po, scaler); - foreach (vlnPrintObject po in pg.PartsLeft) // Process Parts Left (Tabs) - NewSupInfoFixParts(po, scaler); - foreach (vlnPrintObject po in pg.PartsRight) // Process Parts Right (unknown) - NewSupInfoFixParts(po, scaler); - } - /// - /// Adjust the Table Fonts to shrink the sup info text - /// - /// vlnParagraph potentially containing a vlnTable - /// multiplier - /// pdfContentByte - private void AdjustSupInfoTable(vlnParagraph pg, float scaler, PdfContentByte cb) - { - // Adjust the table if it exists - if (pg.MyGrid != null) - { - // Create lists of heights before and after shrinking sup info - Dictionary beforeRowHeight = new Dictionary(); - Dictionary afterRowHeight = new Dictionary(); - for (int i = 0; i < pg.MyGrid.RowTop.GetLength(0) - 1; i++) - { - beforeRowHeight.Add(i, scaler * (pg.MyGrid.RowTop[i + 1] - pg.MyGrid.RowTop[i])); - afterRowHeight.Add(i, 0); - } - // Adjust font size for each cell. - foreach (vlnCell cell in pg.MyGrid.MyCells) - { - float x = cell.MyTable.ColLeft[cell.c1]; - float w = cell.MyTable.ColLeft[cell.c2 + 1] - x; - float hBefore = scaler * pg.GetParagraphHeight(cb, cell.MyPara, "", w); - foreach (Chunk chk in cell.MyPara.Chunks) - chk.Font.Size = scaler * chk.Font.Size; - float hAfter = 1.075F * pg.GetParagraphHeight(cb, cell.MyPara, "", w);// 1.075 is a magic number that worked for Ginna. Otherwise decenders overlapped the bottom line of the cell. - cell.HContent = hAfter; - // Save tthe height after adjusting the font size to account for changes in word wrap. - afterRowHeight[cell.r1] = Math.Max(hAfter, afterRowHeight[cell.r1]); - } - for (int i = 0; i < pg.MyGrid.RowTop.GetLength(0) - 1; i++) - { - pg.MyGrid.RowTop[i + 1] = scaler * pg.MyGrid.RowTop[i + 1];// Adjust for leading - pg.MyGrid.RowTop[i + 1] += (afterRowHeight[i] - beforeRowHeight[i]); //Adjust for word wrapping - } - } - } - /// - /// Adjust YOffset for Print Objects - /// - /// Print Object (tab, paragraph, etc.) - /// multiplier - /// - private float NewSupInfoFixOffset(vlnPrintObject vpo, float scaler) - { - float fixOffSet = 0; - // determine impact of paragraphs above due to word-wrap - foreach (float off in _AdjustForParagraphShrinkage.Keys) - if (off < vpo.YOffset) - fixOffSet += _AdjustForParagraphShrinkage[off]; - // combine this impact with the scaler on the YOffset - return scaler * vpo.YOffset - fixOffSet; - } - /// - /// Adjust Font Size and offset for Parts - /// - /// PrintObject - /// Multiplier - private void NewSupInfoFixParts(vlnPrintObject po, float scaler) - { - if (po.IParagraph == null) return; // B2017-132 check for NULL reference (happend printing Bryon SAMGS with sup info pages) - // Adjust the font size by the multiplier - foreach (Chunk chk in po.IParagraph.Chunks) - chk.Font.Size = scaler * chk.Font.Size; - po.IParagraph.Leading = scaler * po.IParagraph.Leading;// Apply the multiplier to the leading (line spacing) - po.YOffset = NewSupInfoFixOffset(po, scaler);// Adjust the YOffset - } - /// - /// Adjust the Font Size - /// - /// Paragraph - /// Multiplier - private void NewSupInfoFixChunks(vlnParagraph vlnParagraph, float scaler) - { - // Adjust the font size by the multiplier - foreach (Chunk chk in vlnParagraph.IParagraph.Chunks) - chk.Font.Size = scaler * chk.Font.Size; - } - /// - /// Measure the Length of the Group - /// - /// Group of SupInfo Paragraphs - /// pdfContentByte - /// Page Length - /// Length - private float MeasureSupInfoGroupLength(List grp, PdfContentByte cb, float pagelength) - { - _LastBottom = 0; - _LastOffset = 12;// 24; // account for the Sup Info header (two lines) - float fontSize = grp[0].IParagraph.Leading; // current font size - // For each SupInfo Paragraph calculate length - foreach (vlnParagraph pg in grp) - { - MeasureSupInfoGroupLength(pg, cb);// Measure a SupInfo Paragraph and children - _LastOffset += _LastBottom; - _LastBottom = 0; - } - //Console.WriteLine("MeasureSupInfoGroupLength {0} {1} {2} {3}", grp[0].MyItemInfo.ItemID, _LastOffset, fontSize, pagelength); - return _LastOffset; - } - /// - /// Measure the height of a supinfo paragraph and children - /// - /// SupInfo paragraph - /// pdfContentByte - private void MeasureSupInfoGroupLength(vlnParagraph pg, PdfContentByte cb) - { - _LastBottom = pg.YBottomMost; - foreach (vlnParagraph cpg in pg.ChildrenAbove) // Measure Children Above - MeasureSupInfoGroupLength(cpg, cb); - foreach (vlnParagraph cpg in pg.ChildrenBelow) // Measure Children Below - MeasureSupInfoGroupLength(cpg, cb); - foreach (vlnParagraph cpg in pg.ChildrenLeft) // Measure Children Left - MeasureSupInfoGroupLength(cpg, cb); - foreach (vlnParagraph cpg in pg.ChildrenRight) // Measure Children Right - MeasureSupInfoGroupLength(cpg, cb); - } - /// - /// Find Groups of SupInfo Paragraphs - /// - /// SupInfo Paragraph - /// List of supinfo paragraph groups - private List> FindSupInfoGroups(vlnParagraph vlnParagraph) - { - List> supInfoGroups; - supInfoGroups = new List>(); - foreach (vlnParagraph pg in vlnParagraph.ChildrenBelow) - { - SectionInfo supInfoSect = (pg.MyItemInfo.ActiveSection != null) ? pg.MyItemInfo.ActiveSection as SectionInfo : null; - if (supInfoSect != null && supInfoSect.StepSectPageBreaksForSupInfo != null && supInfoSect.StepSectPageBreaksForSupInfo.Contains(pg.MyItemInfo.ItemID)) // C2018-003 fixed use of getting the active section - supInfoGroups.Add(new List()); // add a grouping since a page break exists - if (supInfoGroups.Count == 0) - { - supInfoGroups.Add(new List()); // add a grouping since a page break exists - _MyLog.WarnFormat("SupInfo Print Groups: {0}, {1}", pg.MyItemInfo.ItemID, pg.MyItemInfo.ShortPath); - } - supInfoGroups[supInfoGroups.Count - 1].Add(pg); // add paragraph to the last grouping - } - return supInfoGroups; - } - #endregion //ShrinkSupInfoGroupAtATime - - - public void DoSupInfoPage(PdfContentByte cb, string str, PdfLayer textLayer, VlnSvgPageHelper myPageHelper, int itemid, bool insertBlankPages) - { - // see if the ID is in the facing page pdf - if so, get the page: - if (SupInfoPdfPage == null || SupInfoPdfPage.Count < 1) return; - int getpage = 0; - if (SupInfoPdfPage.ContainsKey(itemid)) getpage = SupInfoPdfPage[itemid]; - if (getpage < 0) - { - InsertBlankPage(cb); - return; - } - PdfImportedPage sipage = null; - try - { - string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + myPageHelper.MySection.ItemID.ToString() + @".pdf"; - PdfReader pdfreader = new PdfReader(SupInfoPdfName); - sipage = cb.PdfWriter.GetImportedPage(pdfreader, getpage + 1); - // F2023-035: WCN - allow for change in left margin for supplemental information pages by - // setting a value in the DocStyle for the adjustment. When importing the vlnParagraph page - // use this adjustment (note that page list items are done in VlnSvgPageHelper) - float lmargadj = myPageHelper.MySection.MyDocStyle.SupInfoMargAdj == null ? 0 : (float)myPageHelper.MySection.MyDocStyle.SupInfoMargAdj; - AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, sipage, lmargadj, 0); - DoingFacingPage = true; - myPageHelper.ResetSvg(); - NewPage(); - DoingFacingPage = false; - myPageHelper.ResetSvg(); - pdfreader.Close(); - } - catch (Exception ex) - { - Console.WriteLine(ex); - } - } - public void DoFoldoutPage(PdfContentByte cb, string str, PdfLayer textLayer, VlnSvgPageHelper myPageHelper, int foldoutindx, bool insertBlankPages) - { - if (_MyFoldoutSection == null || _MyFoldoutSection.Count == 0) return; - - // if the very first page to be output is a 'foldout', treat this as a special case, since - // if duplex printing is on, the foldout should always be on the left side, i.e. or behind - // the document text. The option PROMS provides is to either: - // 1) Skip doing the foldout before the first page, if the 'InsertBlankPages' isn't set, by not checking - // the checkbox on the print dialog. - // 2) Insert a blank page as the first page, if the 'InsertBlankPages' is set. - if (!myPageHelper.PrintedAPage && !insertBlankPages) return; - if (!myPageHelper.PrintedAPage) - { - // only insert a blank page if this is the very first page printed & section has a foldout - // and the checkbox on the print dialog to add blank pages is checked. This will put out a blank page as - // as the first page so that duplex printing is correct for this condition. - InsertBlankPage(cb); - } - - SectionInfo saveSect = myPageHelper.MySection; - myPageHelper.MySection = _MyFoldoutSection[foldoutindx]; - myPageHelper.OnFoldoutPage = true; - if (_MyFoldoutReader != null) - { - bool doimport2 = true; - PdfImportedPage fgPage = null; - try - { // read saved foldout page - fgPage = cb.PdfWriter.GetImportedPage(_MyFoldoutReader[foldoutindx], 1); - } - catch (Exception ex) - { - Console.WriteLine(ex); - doimport2 = false; - } - if (doimport2) - {// put the saved foldout page into the PDF - AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, fgPage, 0, 0); - foreach (iTextSharp.text.pdf.PdfAnnotation.PdfImportedLink il in _MyFoldoutReader[foldoutindx].GetLinks(1)) - { - if (!il.IsInternal()) - cb.PdfWriter.AddAnnotation(il.CreateAnnotation(cb.PdfWriter)); - } - - if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}", - myPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "Foldout", 1); - //if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0:D6},'{1}',{2}", - //myPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "Foldout", 1); - } - } - //_MyLog.InfoFormat("DoFoldoutPage {0}", cb.PdfWriter.CurrentPageNumber); - //PrintTextMessage(cb, "Foldout for: " + str, textLayer); - NewPage();// Temporary for foldout/16bit-32bit page alignment - //_MyLog.InfoFormat("NewPage 8 {0}", cb.PdfWriter.CurrentPageNumber); - myPageHelper.MySection = saveSect; - myPageHelper.OnFoldoutPage = false; - } - public static byte[] WatermarkPDF(byte[] buffer, string watermark) - { - PdfReader reader = new PdfReader(buffer); - MemoryStream ms = new MemoryStream(); - PdfStamper stamper = new PdfStamper(reader, ms); - PdfLayer layer = new PdfLayer("Watermark", stamper.Writer); - layer.SetPrint("Print", true); - for (int i = 1; i <= reader.NumberOfPages; i++) - { - PdfContentByte cb = stamper.GetUnderContent(i); - cb.SaveState(); - cb.BeginLayer(layer); - SvgWatermark wm = new SvgWatermark(cb, watermark, System.Drawing.Color.Blue, .15F); - //wm.SetSquareDotPattern(.7F); - //wm.SetTextPattern(8, 3); - //wm.SetTextPattern2(8); - //wm.SetHashPattern(1, 6); - //wm.SetDotPattern(5, 2); - wm.Draw(); - cb.EndLayer(); - cb.RestoreState(); - } - stamper.Close(); - /* - cb.SaveState(); - if (_WatermarkLayer != null) cb.BeginLayer(_WatermarkLayer); - SvgWatermark myWatermark = new SvgWatermark(cb, Watermark, System.Drawing.Color.Blue, .15F); - myWatermark.SetSquareDotPattern(.7F); - myWatermark.Draw(); - if (_WatermarkLayer != null) cb.EndLayer(); - cb.RestoreState(); - */ - return ms.ToArray(); - } - // C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. - public void SavePaginationFixes() - { - // If manual page breaks were removed (during pagination), save those - if (RemoveManualPageBreaks != null && RemoveManualPageBreaks.Count > 0) - { - foreach (int iid in RemoveManualPageBreaks) - { - ItemInfo ii = ItemInfo.Get(iid); - StepConfig sc = ii.MyConfig as StepConfig; - if (sc != null) - { - using (Item itm = Item.Get(iid)) - { - if (!HasManPagAnnot(ii, "Removed Manual Page Break")) VEPROMS.CSLA.Library.Annotation.MakeAnnotation(itm, AnnotationType.GetByNameOrCreate("Manual Pagination Issues"), null, "Removed Manual Page Break", null); - sc.Step_NewManualPagebreak = false; // reset the flag that was set in the config - if (sc.Step_SubStepPagebreak) sc.Step_SubStepPagebreak = false; // C2023-018: remove substep page break flags - itm.MyContent.Config = sc.ToString(); - itm.MyContent.DTS = DateTime.Now; - itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; - itm.MyContent.Save(); - } - } - } - } - // If trailing newlines and/or spages were removed, save those - if (RemoveTrailingHardReturnsAndSpaces != null && RemoveTrailingHardReturnsAndSpaces.Count > 0) - { - foreach (int iid in RemoveTrailingHardReturnsAndSpaces) - { - // first check if it exists, if the step was empty, it may have been deleted. - ItemInfo iitmp = ItemInfo.Get(iid); - if (iitmp != null) - { - string annot = "Removed Trailing Newlines and Spaces"; - if (RemoveManualPageBreaks != null && RemoveManualPageBreaks.Contains(iid)) annot = "Removed Trailing Newlines, Spaces and ManualPageBreak"; - string tmp = Regex.Replace(iitmp.MyContent.Text, "(\\\\line|\r|\n|\\\\u160\\?| )+$", ""); - // if the step ends up empty, set the text to a space (if null or "") step gets deleted. - // B2021-028: removed code that set a step config item flagging an empty step. This had been put in to print - // the same way before save but that printing was wrong and was fixed for this bug. - if (tmp == null || tmp == "") - { - tmp = " "; - annot = "Empty step. Consider deleting to restore standard pagination."; - } - bool alreadyHasAnnot = HasManPagAnnot(iitmp, annot); // don't add annotation if it exists. - using (Item itm = Item.Get(iid)) - { - if (!alreadyHasAnnot) VEPROMS.CSLA.Library.Annotation.MakeAnnotation(itm, AnnotationType.GetByNameOrCreate("Manual Pagination Issues"), null, annot, null); - itm.MyContent.Text = tmp; - itm.MyContent.DTS = DateTime.Now; - itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID; - itm.MyContent.Save(); - } - } - } - } - } - - private bool HasManPagAnnot(ItemInfo iitmp, string annotstr) - { - if (iitmp.ItemAnnotations != null && iitmp.ItemAnnotationCount > 0) - { - // check each annotation to see if this manual pagination issue exists - so it won't get added again. - foreach (AnnotationInfo ai in iitmp.ItemAnnotations) - { - if (ai.MyAnnotationType.Name.StartsWith("Manual Pagination Issues")) - if (ai.SearchText.StartsWith(annotstr)) return true; - } - } - return false; - } - } - public class ReaderHelper - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private Dictionary dicPage = new Dictionary(); - private Dictionary dicSize = new Dictionary(); - private PromsPrinter _MyPromsPrinter; - public PromsPrinter MyPromsPrinter - { - get { return _MyPromsPrinter; } - set { _MyPromsPrinter = value; } - } - private SectionInfo _MySectionInfo; - public SectionInfo MySectionInfo - { - get { return _MySectionInfo; } - set - { - if (_MySectionInfo == null || value.ItemID != _MySectionInfo.ItemID) - { - _MySectionInfo = value; - //MyPdfFile = _MyPromsPrinter.BuildMSWordPDF(MySectionInfo); - //try - //{ - // MyReader = MyPdfFile != null ? new PdfReader(MyPdfFile) : null; - // string key = string.Empty; - // for (int i = 1; i <= MyReader.NumberOfPages; i++) - // { - // key = string.Format("{0}.{1}", MySectionInfo.ItemID, i); - // dicPage.Add(key, MyPromsPrinter.MyContentByte.PdfWriter.GetImportedPage(MyReader, i)); - // dicSize.Add(key, MyReader.GetPageSizeWithRotation(i)); - // } - //} - //catch (Exception ex) - //{ - // MyReader = null; - //} - } - } - } - private string _MyPdfFile; - public string MyPdfFile - { - get { return _MyPdfFile; } - set { _MyPdfFile = value; } - } - private int _DocID; - public int DocID - { - get { return _DocID; } - set { _DocID = value; } - } - private PdfReader _MyReader; - public PdfReader MyReader - { - get { return _MyReader; } - set { _MyReader = value; } - } - public ReaderHelper(PromsPrinter pp) - { - MyPromsPrinter = pp; - //this.LoadTree(pp.MyItem); - } - public PdfImportedPage GetPage(SectionInfo sectInfo, int pageNumber) - { - string key = string.Format("{0}.{1}", sectInfo.ItemID, pageNumber); - return dicPage[key]; - } - public iTextSharp.text.Rectangle GetSize(SectionInfo sectInfo, int pageNumber) - { - string key = string.Format("{0}.{1}", sectInfo.ItemID, pageNumber); - if (dicSize.ContainsKey(key)) - return dicSize[key]; - return PDFPageSize.UsePaperSize(sectInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - } - public void LoadTree(ItemInfo ii) - { - dicPage = new Dictionary(); - dicSize = new Dictionary(); - LoadSectionTree(ii); - } - private void LoadSectionTree(ItemInfo ii) - { - if (ii.Sections == null) return; // B2021-067 crash on null reference - foreach (SectionInfo si in ii.Sections) - { - if (MyPromsPrinter.PrtSectID == -1 || (MyPromsPrinter.PrtSectID > -1 && (ii.ItemID == MyPromsPrinter.PrtSectID || si.ItemID == MyPromsPrinter.PrtSectID))) - { - if (si.IsStepSection) - { - if (si.Sections != null) LoadSectionTree(si); - } - else - { - MyPdfFile = _MyPromsPrinter.BuildMSWordPDF(si); - if (MyPdfFile != null) - { - try - { - FileInfo fi = new FileInfo(MyPdfFile); - if (fi.Length == 0) // B2017-218 Handle invalid word sections - { - if (!PromsPrinter.BaselineTesting) //B2018-071 Output a message box unless baseline testing is being performed. - MessageBox.Show(si.DisplayNumber + " " + si.DisplayText + " is not valid", "Invalid Word Section", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - MyReader = MyPdfFile != null ? new PdfReader(MyPdfFile) : null; - string key = string.Empty; - for (int i = 1; i <= MyReader.NumberOfPages; i++) - { - key = string.Format("{0}.{1}", si.ItemID, i); - dicPage.Add(key, MyPromsPrinter.MyContentByte.PdfWriter.GetImportedPage(MyReader, i)); - iTextSharp.text.Rectangle rectgl = MyReader.GetPageSizeWithRotation(i); - // If the word page is set to landscape, but the document style is not landscape, then flip the height and width (put back to portrait) - if (!((si.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_WordContentLandscaped) == E_DocStructStyle.DSS_WordContentLandscaped) && rectgl.Height < rectgl.Width) - rectgl = new iTextSharp.text.Rectangle(rectgl.Height, rectgl.Width); - dicSize.Add(key, rectgl); - //dicSize.Add(key, MyReader.GetPageSizeWithRotation(i)); - } - } - catch (Exception ex) - { - if (_MyPromsPrinter.DocReplace == null) - MessageBox.Show(ex.Message, ex.GetType().FullName, MessageBoxButtons.OK, MessageBoxIcon.Error); - _MyLog.Warn(string.Format("Error in LoadSectionTree [{0}],{1}.{2}", si.ItemID, si.DisplayNumber, si.DisplayText), ex); - } - } - } - } - } - } - } - //public class PrintTimer - //{ - // private DateTime _StartTime = DateTime.Now; - - // public DateTime StartTime - // { - // get { return _StartTime; } - // set { _StartTime = value; } - // } - // private string _Description = "Start"; - // public string Description - // { - // get { return _Description; } - // set - // { - // DateTime dtNext = DateTime.Now; - // //Console.WriteLine("{0},'{1}'", TimeSpan.FromTicks(dtNext.Ticks - LastTime.Ticks).TotalSeconds, Description); - // _Description = value; - // _LastTime = dtNext; - // } - // } - // private DateTime _LastTime = DateTime.Now; - // public DateTime LastTime - // { - // get { return _LastTime; } - // set { _LastTime = value; } - // } - //} -} - diff --git a/PROMS/Volian.Print.Library/Properties/AssemblyInfo.cs b/PROMS/Volian.Print.Library/Properties/AssemblyInfo.cs deleted file mode 100644 index 52454399..00000000 --- a/PROMS/Volian.Print.Library/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Volian.Print.Library")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Volian.Print.Library")] -[assembly: AssemblyCopyright("Copyright © 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d5d13256-54c2-4c4e-a122-faff36fb9a9e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PROMS/Volian.Print.Library/Properties/Proc licenses.licx b/PROMS/Volian.Print.Library/Properties/Proc licenses.licx deleted file mode 100644 index 00328a8c..00000000 --- a/PROMS/Volian.Print.Library/Properties/Proc licenses.licx +++ /dev/null @@ -1 +0,0 @@ -C1.Win.C1FlexGrid.C1FlexGrid, C1.Win.C1FlexGrid.2, Version=2.6.20091.401, Culture=neutral, PublicKeyToken=79882d576c6336da diff --git a/PROMS/Volian.Print.Library/Properties/licenses.licx b/PROMS/Volian.Print.Library/Properties/licenses.licx deleted file mode 100644 index 7606ef69..00000000 --- a/PROMS/Volian.Print.Library/Properties/licenses.licx +++ /dev/null @@ -1,2 +0,0 @@ -C1.Win.C1FlexGrid.C1FlexGrid, C1.Win.C1FlexGrid.2 -C1.Win.C1SpellChecker.C1SpellChecker, C1.Win.C1SpellChecker.2 diff --git a/PROMS/Volian.Print.Library/Properties/licenses.licx.bak b/PROMS/Volian.Print.Library/Properties/licenses.licx.bak deleted file mode 100644 index 8b36e5f9..00000000 --- a/PROMS/Volian.Print.Library/Properties/licenses.licx.bak +++ /dev/null @@ -1 +0,0 @@ -C1.Win.C1FlexGrid.C1FlexGrid, C1.Win.C1FlexGrid.2, Version=2.0.20162.188, Culture=neutral, PublicKeyToken=79882d576c6336da diff --git a/PROMS/Volian.Print.Library/Rtf2Pdf.cs b/PROMS/Volian.Print.Library/Rtf2Pdf.cs deleted file mode 100644 index 3f6985e5..00000000 --- a/PROMS/Volian.Print.Library/Rtf2Pdf.cs +++ /dev/null @@ -1,424 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text; -using iTextSharp.text.pdf; -using iTextSharp.text.factories; -using Itenso.Rtf; -using Itenso.Rtf.Parser; -using Itenso.Rtf.Interpreter; -using Itenso.Rtf.Support; -using System.IO; -using VEPROMS.CSLA.Library; - - -namespace Volian.Print.Library -{ - [Flags] - - // TableScrunching is used to allow for turning off/on various parts of the table scrunch test & data manipulation - public enum TableScrunching:short // RHM20150507 Table Scrunch - { - None=0, - Phase1=1, // Checks if height of table greater than what will fit on current page. (in setup) - Phase2=2, // Remove any blank space between bottom of text & line in a table cell. (in setup) - Phase3=4, // Removes new lines at end of text. (in setup) - Phase4=8, // Determines height of content, i.e. text in cell, uses leading (height of line). (in setup) - Phase5=16, // Make contents of the row a little bigger than max (max may be for merged cells). (in setup) - Phase6=32, // Has no affect - YAdjust_h is set to 0. May have been used for testing/trying options. (in ToPdf) - Phase7 =64, // Adjust y location of text: by 0 or by 1 if printing 7LPI - Phase8=128, // not used - Phase9=256, // not used - Phase10=512, // not used - AllPhases=1+2+4+8+16+32+64+128+256+512 // The default, and always used unless printing from UI list of items - } - public class Rtf2Pdf - { - #region Log4Net - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #endregion - private string _Rtf; - - public string Rtf - { - get { return _Rtf; } - set { _Rtf = value; } - } - private string _FileName; - - public string FileName - { - get { return _FileName; } - set { _FileName = value; } - } - public Rtf2Pdf(string rtf, string fileName) - { - _Rtf = rtf; - _FileName = fileName; - } - public void Process() - { - iTextSharp.text.Document document = new iTextSharp.text.Document(PaperSizeRec); // C2020-002 paper size is now set in the format files - int paperSizePoints = PDFPageSize.PaperSizePoints(PaperSize); // C2020-002 paper size is now set in the format files - PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(FileName, FileMode.Create)); - document.Open(); - // Open RTF Document - IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(Rtf); - Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc); - Paragraph para = rtf2IText.Convert(); - para.SetLeading(12F, 0); - PdfContentByte cb = writer.DirectContent; - SampleParagraphs(para, cb, paperSizePoints - 36, 252, 36); // C2020-002 paper size is now set in the format files - para.Add(new Chunk(" (continued)", para.Font)); - SampleParagraphs(para, cb, paperSizePoints - 36, 252, 324); // C2020-002 paper size is now set in the format files - // Close the document - document.Close(); - } - private static void SampleParagraphs(Paragraph para, PdfContentByte cb, float yTop, float width, float x) - { - while (yTop > 0) - { - float newYTop = TextAt(cb, para, x, yTop - 12F, width, 100,"",36); - width -= 16; - 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 - { - get { return Rtf2Pdf._PaperSize; } - set { Rtf2Pdf._PaperSize = value; } - } - 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); - public static System.Drawing.PointF Offset - { - get { return Rtf2Pdf._Offset; } - set { Rtf2Pdf._Offset = value; } - } - public static float FillWidth = 0; // max text width (used in autoToc code) - private static int _TextAtCounter = 0; - public static int 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 bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) - { - 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 VlnSplitCharacter mySplitter = new VlnSplitCharacter(); - public static string ChunkTextAttributesInfo(Chunk chk1) // C2018-004 create meta file for baseline compares - { - string rtnval = "Atrbs:"; - if (chk1.HasAttributes()) - { - float? subsup = (float?)chk1.Attributes["SUBSUPSCRIPT"]; - if (subsup != null) - { - if (subsup > 0.0) - rtnval += " SUPERSCRIPT |"; - else if (subsup < 0.0) - rtnval += " SUBSCRIPT |"; - } - if (chk1.Attributes["UNDERLINE"] != null) - rtnval += " UNDERLINE |"; - } - if (chk1.Font.BaseFont != null) - { - if (chk1.Font.BaseFont.PostscriptFontName.ToUpper().Contains("BOLD")) - rtnval += " BOLD |"; - // B2018-066 Support alternative Bold Font Style - else if ((chk1.Font.Style & iTextSharp.text.Font.BOLD) == iTextSharp.text.Font.BOLD) - rtnval += " Bold |"; - if (chk1.Font.BaseFont.PostscriptFontName.ToUpper().Contains("ITALIC")) - rtnval += " ITALICS |"; - // B2018-066 Support alternative Italic Font Style - else if ((chk1.Font.Style & iTextSharp.text.Font.ITALIC) == iTextSharp.text.Font.ITALIC) - rtnval += " Italics |"; - } - if (rtnval.Length == 6) - rtnval += " none"; - else - rtnval = rtnval.Substring(0, rtnval.Length - 2); - return rtnval; - } - 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) - { - 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) - { - 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); - _lastPageNum = cb.PdfDocument.PageNumber; - } - VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; - float left = x + Offset.X; - 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 - // AdjustedTable and AdjustedTableYtop are set in vlnParagraph.cs DrawGrid() - if (_MyPageHelper.AdjustedTable != null && _MyPageHelper.AdjustedTableYtop > y) - top += _MyPageHelper.TableAdjustment;// RHM20150525 - Table Scrunch //B2020-059 - if (iParagraph.Chunks.Count > 0) - { - if (itmID == null) - Volian.Base.Library.BaselineMetaFile.WriteLine("TX x={0} Y={1} W={2} H={3}", left-Offset.X, top-Offset.Y, width, height); - else - Volian.Base.Library.BaselineMetaFile.WriteLine("TX x={0} Y={1} W={2} H={3} ItmID={4}", left - Offset.X, top - Offset.Y, width, height, itmID); - foreach (Chunk chk1 in iParagraph) - { - //Object obj = chk1.Attributes["UNDERLINE"]; - //Console.WriteLine("\t{0},{1},{2},{3},\"{4}\"", chk1.Font.Familyname, chk1.Font.Size, chk1.Font.Style, obj != null ? "Underline" : "", FixText(chk1.Content)); - string ctai = ChunkTextAttributesInfo(chk1); - Volian.Base.Library.BaselineMetaFile.WriteLine(" {0} {1} {2} {3} \"{4}\"", chk1.Font.Familyname, chk1.Font.Size, chk1.Font.Style, ctai,TextForBaseline.FixText(chk1.Content)); - //Console.WriteLine("\t{0},{1},{2},{3},\"{4}\"", chk1.Font.Familyname, chk1.Font.Size, chk1.Font.Style, ctai, FixText(chk1.Content)); - } - } - // Change the chunks to only split on spaces rather than spaces and hyphens - foreach (Chunk chk in iParagraph) - { - if (chk.Attributes == null || !chk.Attributes.ContainsKey("NoSplit")) - { - if (chk.Attributes == null) chk.Attributes = new System.Collections.Hashtable(); - chk.SetSplitCharacter(mySplitter); - chk.Attributes.Add("NoSplit", false); - } - } - float right = left + width; - float bottom = top - height; - ColumnText myColumnText = new ColumnText(cb); - myColumnText.SetSimpleColumn(left, top, left + width, yBottomMargin); - myColumnText.AddElement(iParagraph); - float pos = myColumnText.YLine; // Save the position to be used if the paragraph fits - int status = myColumnText.Go(true); // Check to see if it will fit on the page. - if (ColumnText.HasMoreText(status)) - return 0;// Paragraph won't fit. Return 0; - myColumnText.YLine = pos; // restore the location on the page - myColumnText.AddElement(iParagraph); // add in paragraph - if (textLayer != null) cb.BeginLayer(textLayer); - myColumnText.Go(false); // Draw the paragraph - FillWidth = myColumnText.FilledWidth; - if (textLayer != null) cb.EndLayer(); - // Approximate Descent by using Leading divided by 5. - float yDescent = iParagraph.Leading / 5; - // If the BaseFont is available, calculate yAdj on the basis of the Descent - if (iParagraph.Font.BaseFont != null) - yDescent = -iParagraph.Font.BaseFont.GetDescentPoint("Almg", iParagraph.Font.Size); - if (PdfDebug) - { - // be very careful around the following line, if the cursor 'touches' - // NextTextAtCounter, it is incremented and the 'next' value may not be what - // was seen as the UniqueNumber in the pdf. - int next = NextTextAtCounter; - // buffer (unnecessary comments) so - // that cursor does NOT touch 'NextTextAtCounter' - // as easily - //if (InList(next,2958, 2961)) Console.WriteLine("Stop at UniqueNumber"); - string dbt = string.Format("[{0}]{1}", next, debugText ?? ""); - DrawPdfDebug(cb, left, top, left + width, myColumnText.YLine, dbt, yDescent); - } - return myColumnText.YLine; - } - private static bool InList(int value, params int [] examples) - { - foreach (int ex in examples) - if (ex == value) return true; - 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) - { - 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); - _lastPageNum = cb.PdfDocument.PageNumber; - } - VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; - float left = x + Offset.X; - float top = y + Offset.Y + sixLinesPerInch; - float bottom = top - height; - image.ScaleAbsoluteWidth(width); - image.ScaleAbsoluteHeight(height); - image.SetAbsolutePosition(left, bottom); - if (textLayer != null) cb.BeginLayer(textLayer); - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("FG left={0} top={1} bottom={2} Height={3} Width={4} ItmID={5}", left, top, bottom, height, width, itmID); - cb.AddImage(image); - if (hasBorder) - { - iTextSharp.text.Color boxColor = new iTextSharp.text.Color(System.Drawing.Color.Black); // (PrintOverride.OverrideBoxColor(System.Drawing.Color.Black)); - cb.SetColorStroke(boxColor); - cb.SetLineWidth(.85F); - cb.Rectangle(left-1.5F, bottom-1.5F, width+3, height+3); - cb.Stroke(); - } - if (textLayer != null) cb.EndLayer(); - if (PdfDebug) - { - // be very careful around the following line, if the cursor 'touches' - // NextTextAtCounter, it is incremented and the 'next' value may not be what - // was seen as the UniqueNumber in the pdf. - int next = NextTextAtCounter; - // buffer (unnecessary comments) so - // that cursor does NOT touch 'NextTextAtCounter' - // as easily - //if (InList(next,2958, 2961)) Console.WriteLine("Stop at UniqueNumber"); - string dbt = string.Format("[{0}]{1}", next, debugText ?? ""); - DrawPdfDebug(cb, left, top, left + width, top-height, dbt, 0); - } - - return bottom; - } - private static float _GridTopAdjust = -10; - public static float GridTopAdjust - { - 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) - { - 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); - _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 top = y + Offset.Y; - float right = left + width; - float bottom = top - height; - 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); - myColumnText.SetSimpleColumn(left, top, left + width, yBottomMargin); - //if (textLayer != null) cb.BeginLayer(textLayer); // RHM20150507 Table Scrunch - // 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 - { - _MyLog.ErrorFormat("\r\n===> Table Printing Off the Top of Page"); - Volian.Base.Library.BaselineMetaFile.WriteLine("## Error - Grid Off the Top of Page"); - } - 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); - //if (textLayer != null) cb.EndLayer(); // RHM20150507 Table Scrunch - return bottom; - } - 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 = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer; - if (debugLayer == null) return; - System.Drawing.Color sysColor = PrintOverride.OverrideDebugColor(System.Drawing.Color.Gray); - cb.SaveState(); - cb.BeginLayer(debugLayer); - cb.SetColorStroke(new Color(sysColor)); - cb.SetLineWidth(.1F); - cb.MoveTo(left, top - yDescent); - cb.LineTo(right, top - yDescent); - cb.LineTo(right, bottom - yDescent); - cb.LineTo(left, bottom - yDescent); - cb.LineTo(left, top - yDescent); - cb.Stroke(); - if (debugText != "") - { - ColumnText ct = new ColumnText(cb); - ct.SetSimpleColumn(left, 4 + top - yDescent, right, top - yDescent - 50); - iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 2); - Chunk chk = new Chunk(debugText + string.Format(", Top = {0}",top), font); - Phrase ph = new Phrase(chk); - ct.AddElement(ph); - cb.SetColorFill(new Color(sysColor)); - ct.Go(); - } - cb.EndLayer(); - 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) - { - VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; - float left = XOffset + Offset.X; - float top = yLocation + Offset.Y; - float bottom = top - Height; - float scale = .6f; - iTextSharp.text.Image it_image=null; - try - { - it_image = iTextSharp.text.Image.GetInstance(image,iTextSharp.text.Color.WHITE); - float itxtWid = scale * Width * 300 / 72; - float itxtHt = scale * Height * 300 / 72; - it_image.ScaleAbsoluteWidth(scale * Width); - it_image.ScaleAbsoluteHeight(scale * Height); - it_image.SetAbsolutePosition(left, top-(scale*Height)); - cb.AddImage(it_image); - } - catch (Exception ex) - { - Console.WriteLine("Exception {0}", ex.Message); - } - if (hasBorder) - { - iTextSharp.text.Color boxColor = new iTextSharp.text.Color(System.Drawing.Color.Black); - cb.SetColorStroke(boxColor); - cb.SetLineWidth(.85F); - cb.Rectangle(left - 1.5F, top - (scale * Height) - 1.5F, (scale * Width) + 3, (scale * Height) + 3); - cb.Stroke(); - } - if (textLayer != null) cb.EndLayer(); - if (PdfDebug) - { - // be very careful around the following line, if the cursor 'touches' - // NextTextAtCounter, it is incremented and the 'next' value may not be what - // was seen as the UniqueNumber in the pdf. - int next = NextTextAtCounter; - // buffer (unnecessary comments) so - // that cursor does NOT touch 'NextTextAtCounter' - // as easily - string dbt = string.Format("[{0}]{1}", next, debug ?? ""); - DrawPdfDebug(cb, left, top, left + (scale*Width), top-(scale*Height), dbt, 0); - } - return bottom; - } - } -} diff --git a/PROMS/Volian.Print.Library/Rtf2iTextSharp.cs b/PROMS/Volian.Print.Library/Rtf2iTextSharp.cs deleted file mode 100644 index 3b46a8c3..00000000 --- a/PROMS/Volian.Print.Library/Rtf2iTextSharp.cs +++ /dev/null @@ -1,672 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text; -using iTextSharp.text.pdf; -using iTextSharp.text.factories; -using Itenso.Rtf; -using Itenso.Rtf.Parser; -using Itenso.Rtf.Interpreter; -//using Itenso.Rtf.Model; -using Itenso.Rtf.Support; -using Microsoft.Win32; -using Volian.Base.Library; -using System.Text.RegularExpressions; -using VEPROMS.CSLA.Library; - -namespace Volian.Print.Library -{ - public partial class PrintOverride - { - public static bool CompressSub = false; - public static bool CompressSuper = false; - public static bool CompressPropSubSup = false; - private static System.Drawing.Color _TextColor = System.Drawing.Color.Empty; - public static System.Drawing.Color TextColor - { - get { return _TextColor; } - set { _TextColor = value; } - } - public static System.Drawing.Color OverrideTextColor(System.Drawing.Color color) - { - if (_TextColor == System.Drawing.Color.Empty) - return color; - return _TextColor; - } - private static System.Drawing.Color _SvgColor = System.Drawing.Color.Empty; - public static System.Drawing.Color SvgColor - { - get { return _SvgColor; } - set { _SvgColor = value; Volian.Svg.Library.Svg.OverrideColor = value; } - } - public static System.Drawing.Color OverrideSvgColor(System.Drawing.Color color) - { - if (_SvgColor == System.Drawing.Color.Empty) - return color; - return _SvgColor; - } - private static System.Drawing.Color _BoxColor = System.Drawing.Color.Empty; - public static System.Drawing.Color BoxColor - { - get { return _BoxColor; } - set { _BoxColor = value; } - } - public static System.Drawing.Color OverrideBoxColor(System.Drawing.Color color) - { - if (_BoxColor == System.Drawing.Color.Empty) - return color; - 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 OverrideChangeBarColor(System.Drawing.Color color) - { - if (_ChangeBarColor == System.Drawing.Color.Empty) - return color; - return _ChangeBarColor; - } - private static System.Drawing.Color _DebugColor = System.Drawing.Color.Empty; - public static System.Drawing.Color DebugColor - { - get { return _DebugColor; } - set { _DebugColor = value; } - } - public static System.Drawing.Color OverrideDebugColor(System.Drawing.Color color) - { - if (_DebugColor == System.Drawing.Color.Empty) - return color; - return _DebugColor; - } - public static void Reset() - { - DebugColor = System.Drawing.Color.Empty; - TextColor = System.Drawing.Color.Empty; - SvgColor = System.Drawing.Color.Empty; - BoxColor = System.Drawing.Color.Empty; - ChangeBarColor = System.Drawing.Color.Empty; - } - } - public class Rtf2iTextSharp : RtfVisualVisitorBase - { - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private bool _HasIndent = false; - public bool HasIndent - { - get { return _HasIndent; } - set { _HasIndent = value; } - } - private IRtfDocument _RtfDoc; - private Paragraph _MyParagraph = new Paragraph(); - private iTextSharp.text.Font _MyFont; - - // Allow for definition of a default font: if the font is not proportional, this gets set. - // It is needed to set the chunk's font if the first character of a cell is a hardspace (or various - // 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 Rtf2iTextSharp(IRtfDocument rtfDoc, Document doc, PdfWriter writer) - public Rtf2iTextSharp(IRtfDocument rtfDoc) - { - if (rtfDoc == null) - throw new ArgumentNullException("rtfDoc"); - - _RtfDoc = rtfDoc; - } - public Paragraph Convert() - { - int profileDepth = ProfileTimer.Push(">>>> Rtf2ITextSharp.Convert"); - _MyParagraph.Clear(); - _MyFont = null; - foreach (IRtfVisual visual in _RtfDoc.VisualContent) - { - visual.Visit(this); - } - //_MyParagraph.SetLeading(0, 1); - ProfileTimer.Pop(profileDepth); - return _MyParagraph; - } - // ---------------------------------------------------------------------- - private int _lastWasLineBreak = 0; // B2017-191 insert a NewLine when hard returns are used - protected override void DoVisitBreak(IRtfVisualBreak visualBreak) - { - switch (visualBreak.BreakKind) - { - case RtfVisualBreakKind.Line: - if (_lastWasLineBreak > 0) - { - _MyParagraph.Add(Chunk.NEWLINE); - if (_lastWasLineBreak == 1) - _MyParagraph.Add(Chunk.NEWLINE); // B2017-191 if this is the first hard return add an etra newline to create the first blank line - } - else - { - Chunk ck = HasIndent ? new Chunk("".PadLeft(200)) : new Chunk("".PadLeft(200)); - _MyParagraph.Add(ck); - } - _lastWasLineBreak++; // B2017-191 hard return count - break; - case RtfVisualBreakKind.Page: - _lastWasLineBreak = 0; // B2017-191 reset hard return count - break; - case RtfVisualBreakKind.Paragraph: - Chunk ck1 = HasIndent ? new Chunk("".PadLeft(200)) : Chunk.NEWLINE; - _MyParagraph.Add(ck1); - _lastWasLineBreak = 0; // B2017-191 reset hard return count - break; - case RtfVisualBreakKind.Section: - _lastWasLineBreak = 0; // B2017-191 reset hard return count - break; - default: - _lastWasLineBreak = 0; // B2017-191 reset hard return count - break; - } - //_MyParagraph.Add(string.Format("<{0}>", visualBreak.BreakKind.ToString())); - } - private void AddChunk(string str, iTextSharp.text.Font font) - { - if (font == null) - _MyParagraph.Add(new Chunk(str)); - else - _MyParagraph.Add(new Chunk(str, font)); - } - protected override void DoVisitSpecial(IRtfVisualSpecialChar visualSpecialChar) - { - //_MyParagraph.Add(string.Format("", visualSpecialChar.CharKind.ToString())); - iTextSharp.text.Font activeFont = _MyFont ?? DefaultFont; - switch (visualSpecialChar.CharKind) - { - case RtfVisualSpecialCharKind.Bullet: - AddChunk("\u2022", activeFont); - break; - case RtfVisualSpecialCharKind.EmDash: - AddChunk("\u2014", activeFont); - break; - case RtfVisualSpecialCharKind.EmSpace: - AddChunk("\u2003", activeFont); - break; - case RtfVisualSpecialCharKind.EnDash: - AddChunk("\u2013", activeFont); - break; - case RtfVisualSpecialCharKind.EnSpace: - AddChunk(" ", activeFont); - break; - case RtfVisualSpecialCharKind.LeftDoubleQuote: - AddChunk("\u201C", activeFont); - break; - case RtfVisualSpecialCharKind.LeftSingleQuote: - AddChunk("\u2018", activeFont); - break; - case RtfVisualSpecialCharKind.NonBreakingHyphen: - AddChunk("\u2011", activeFont); - break; - case RtfVisualSpecialCharKind.NonBreakingSpace: - //iTextSharp.text.Font font = Volian.Svg.Library.VolianPdf.GetFont(sdf); - AddChunk("\u00A0", activeFont); - break; - case RtfVisualSpecialCharKind.OptionalHyphen: - AddChunk("\u00AD", activeFont); - break; - case RtfVisualSpecialCharKind.ParagraphNumberBegin: - break; - case RtfVisualSpecialCharKind.ParagraphNumberEnd: - break; - case RtfVisualSpecialCharKind.QmSpace: - break; - case RtfVisualSpecialCharKind.RightDoubleQuote: - AddChunk("\u201D", activeFont); - break; - case RtfVisualSpecialCharKind.RightSingleQuote: - AddChunk("\u2019", activeFont); - break; - case RtfVisualSpecialCharKind.Tabulator: - break; - default: - break; - } - _lastWasLineBreak = 0; // B2017-191 reset hard return count - } - private bool ContainsAllSymbols(string p) - { - foreach (char c in p) - if (c <= '\x7F') return false; - return true; - } - private bool ContainsAnySymbols(string p) - { - foreach (char c in p) - if (c > '\x7F' && c != '\xA0' && c != '\xB0') return true; - 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 - // doing pdflink for each transition/ro in a step, see bug B2019-052 - private RoUsageInfo _Roui = null; - private TransitionInfo _Ti = null; - private int _linkType = 0; - // for the particular link, parse its text to see the type of link and its associated data, either transitioninfo or rousageinfo: - public void ParseLink(string _LinkInfoText) - { - if (_LinkInfoText == null) return; - // First parse the string - if (_LinkInfoText.Contains(@"\v")) - throw new Exception("LinkText.ParseLink found RTF token"); - Match m = Regex.Match(_LinkInfoText, @"[#]Link:([A-Za-z]*):(.*)"); - string _MyValue = m.Groups[1].Value; - string _MyLink = "#Link:" + m.Groups[2].Value + ":" + m.Groups[3].Value; - switch (m.Groups[1].Value) - { - case "ReferencedObject": - _linkType = 1; - string[] subs = m.Groups[2].Value.Split(" ".ToCharArray()); - if (subs[0].IndexOf("CROUSGID") > -1) - _Roui = null; - else if (subs[0].IndexOf("NewID") > -1) - _Roui = null; - else - { - int roUsageid = int.Parse(subs[0]); - _Roui = RoUsageInfo.Get(roUsageid); - } - break; - case "Transition": - case "TransitionRange": - _linkType = 2; - string[] subst = m.Groups[2].Value.Split(" ".ToCharArray()); - if (subst[1].IndexOf("CTID") > -1) - _Ti = null; - else if (subst[1].IndexOf("NewID") > -1) - _Ti = null; - else - { - int transitionID = int.Parse(m.Groups[2].Value.Split(" ".ToCharArray())[1]); - _Ti = TransitionInfo.Get(transitionID); - } - break; - } - } - // GetDefaultItemInfo finds the item that a transition goes to. If it goes to procedure, go to default section's (or procedure - // steps section if no default) first step (or go to default section if there are not steps). Also, go to step if there are - // steps, else go to section. And last, if none of these can be found, just go to the item passed in. - private ItemInfo GetDefaultItemInfo(ItemInfo myItemInfo) - { - if (myItemInfo.IsProcedure && myItemInfo.Sections != null) - { - SectionInfo siProcedureSteps = null; - foreach (SectionInfo si in myItemInfo.Sections) - { - if (si.IsDefaultSection) - { - if (si.Steps != null) return si.Steps[0]; - if (si.Sections != null) return si.Sections[0]; - return si; - } - if (si.DisplayText.Contains("Procedure Step")) - siProcedureSteps = si; - } - if (siProcedureSteps != null) - { - if (siProcedureSteps.Steps != null) return siProcedureSteps.Steps[0]; - if (siProcedureSteps.Sections != null) return siProcedureSteps.Sections[0]; - return siProcedureSteps; - } - } - if (myItemInfo.IsSection) - { - if (myItemInfo.Steps != null) return myItemInfo.Steps[0]; - if (myItemInfo.Sections != null) return myItemInfo.Sections[0]; - } - return myItemInfo; - } - private static int chkStart = -1; - protected override void DoVisitText(IRtfVisualText visualText) - { - //Code to find text (non-symbol) being output with a symbol font - //if(visualText.Format.Font.Name=="VESymbFix" && visualText.Text.Length > 1) - //{ - // string s = visualText.Text; - // s=s.Replace("a","").Replace("b",""); - // if(s!=visualText.Text) - // Console.WriteLine("{0}-{1}-{2}-{3}", visualText.Format.Font.Name, (int)(visualText.Text[0]),visualText.Text.Length,FixText(visualText.Text)); - //} - int profileDepth = ProfileTimer.Push(">>>> DoVisitText"); - if (visualText.Format.IsHidden) - { - // B2019-052: Hidden text contains the link text - so if doing the pdf links when printing, this can be used to determine how - // to create the link. A given link may have multiple chunks though, if there are attribute changes, symbols, etc. This - // code goes through all of the chunks of a link and sets attributes on each chunk so that the link goes to the correct - // place (RO or Transition 'to'). Note that the pdf links were originally done in vlnparagraph.cs but only went to a single - // link within a step. The code was moved here so that each ro and transition link within a step could have its on pdf link. - if (DoPdfLinks) - { - // use the start and end tokens in the link text, these may span more than one chunk. - if (visualText.Text.Contains("")) - { - string txt = visualText.Text; - ParseLink(txt); // get the link data, ro or transition - for (int i = chkStart; i < _MyParagraph.Chunks.Count; i++) - { - try - { - Chunk chk = _MyParagraph.Chunks[i] as Chunk; - if (chk != null) - { - if (_linkType == 2 && _Ti != null) // transition - { - ItemInfo tiDefault = GetDefaultItemInfo(_Ti.MyItemToID); - ItemInfo from = _Ti.MyContent.ContentItems[0]; - if (_Ti.MyItemToID.MyProcedure.ItemID == from.MyProcedure.ItemID && - !((from.ActiveSection.MyConfig as SectionConfig).Section_IsFoldout == "Y")) //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box - { // Local Go To - // B2020-028, 029 and 030: all were related to print of supplemental information when printing with - // pdf links. The pdf links in the temporary supinfo pdf caused a crash on save of file because they didn't exist. - if (_Ti.MyItemToID.MyContent.Type > 9999 && !from.IsInSupInfo) // internal to this file - { - chk.SetLocalGoto(string.Format("ItemID={0}", tiDefault.ItemID)); - chk.SetBackground(Color.CYAN); - chk.SetBackground(new Color(System.Drawing.Color.LightCyan)); - } - } - else if (_Ti != null && !from.IsInSupInfo) // Remote Go To. Added SupInfo check for B2020 bugs (see above) - { - // 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; - string remotePDFName = dvc.Print_PDFFilePrefix + _Ti.MyItemToID.MyProcedure.DisplayNumber.Replace("/", "_") + dvc.Print_PDFFileSuffix + ".pdf"; - chk.SetRemoteGoto(remotePDFName, string.Format("ItemID={0}", tiDefault.ItemID)); - chk.SetBackground(new Color(System.Drawing.Color.PeachPuff)); - } - } - else if (_linkType == 1 && _Roui != null && !_Roui.MyContent.ContentItems[0].IsInSupInfo) // referenced object. Added SupInfo check for B2020 bugs (see above) - { - if (_Roui.ROID.Substring(0, 4) != "FFFF") - { - chk.SetRemoteGoto("completeroreport.pdf", string.Format("ROID={0}", _Roui.ROID.Substring(0, 12).ToUpper())); - chk.SetBackground(new Color(System.Drawing.Color.LightGreen)); - } - } - } - } - catch (Exception ex) - { - _MyLog.ErrorFormat("Error creating pdf links {0}", ex.Message); - } - } - _Ti = null; - _Roui = null; - _linkType = 0; - chkStart = -1; - } - } - ProfileTimer.Pop(profileDepth); - _lastWasLineBreak = 0; // B2017-191 reset hard return count - return; - } - - iTextSharp.text.Font font = Volian.Svg.Library.VolianPdf.GetFont(visualText.Format.Font.Name, visualText.Format.FontSize, - (visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) + - (visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0)); - font.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(visualText.Format.ForegroundColor.AsDrawingColor)); - // The following line of code was added to allow for comparisons between the 16bit and 32bit pdf files. Without - // the size change, the overlays did not match up. It seems that the 16bit font size may be inaccurate - // and the 16bit conversion to be pdf may be off. - //if (font.Familyname.StartsWith("Arial") && font.Size == 11 && DoingComparison) font.Size = 11.15f; - iTextSharp.text.pdf.FontSelector fs = new FontSelector(); - // DEBUG - //if (visualText.Format.Font.Name != "VESymbFix" && ContainsAnySymbols(visualText.Text)) - //{ - // Console.WriteLine("Font: {0} TEXT: {1}", visualText.Format.Font.Name, ShowSpecialCharacters(visualText.Text)); - //} - if (visualText.Format.Font.Name == "VESymbFix" && ContainsAllSymbols(visualText.Text)) - { - fs.AddFont(font); - // if the symbol character cannot be found in VESymbFix then check/use the Consolas font - // We are using the VESymbFix font first because not all of the symbols that we use are in the Consolas font - // The Consolas font will give us other symbols that we don't have in VESymbFix (ex the Omega) - fs.AddFont(FontFactory.GetFont("Consolas", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, (visualText.Format.FontSize * 1.1F) / 2, - (visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) + - (visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0), font.Color)); - // added the FreeMono font because when were was a backslash symbol (\u9568?) it was not found and thus removed from the chunk B2014-108 backslash in table - fs.AddFont(FontFactory.GetFont("FreeMono", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, (visualText.Format.FontSize * 1.1F) / 2, - (visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) + - (visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0), font.Color)); - // B2021-038 add the Consolas and FreeMono without Bold or Italic - some symbols are not available as Bold or Italic - fs.AddFont(FontFactory.GetFont("Consolas", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, (visualText.Format.FontSize * 1.1F) / 2, 0, font.Color)); - fs.AddFont(FontFactory.GetFont("FreeMono", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, (visualText.Format.FontSize * 1.1F) / 2, 0, font.Color)); - Phrase ph = fs.Process(visualText.Text); - foreach (Chunk chk in ph.Chunks) - { - AdjustChunk(visualText, font, chk); - _MyParagraph.Add(chk); - } - } - // B2021-038 add the FreeSerif without Bold or Italic - some symbols are not available as Bold or Italic - else if (visualText.Format.Font.Name == "FreeSerif" && ContainsAllSymbols(visualText.Text)) - { - fs.AddFont(font); - fs.AddFont(FontFactory.GetFont("FreeSerif", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, (visualText.Format.FontSize * 1.1F) / 2, 0, font.Color)); - Phrase ph = fs.Process(visualText.Text); - foreach (Chunk chk in ph.Chunks) - { - AdjustChunk(visualText, font, chk); - _MyParagraph.Add(chk); - } - } - else - { - // The bullet character for some unknown reason was entered in a text font rather than a symbol font - // switch from x25cf ot x2022 moves to a valid bullet character in the text font - // B2017-171 Mcguire reported their bullet substeps print a smaller bullet than before - // B2017-238 V.C. Summer Bullets were not printing. Needed to check for Letter Gothic Tall font - if (font.Familyname == "Prestige Elite Tall" || font.Familyname == "Letter Gothic Tall") - ProcessMeans(visualText, visualText.Text.Replace("\u25cf", "\u2022"), font); - else - ProcessMeans(visualText, visualText.Text, font); - } - ProfileTimer.Pop(profileDepth); - _lastWasLineBreak = 0; // B2017-191 reset hard return count - } - /// - /// Method to process means from text. Draws a line above the content of the range included in the - /// square brackets. [Mean X] - /// Handles everything except font style changes within the expression. - /// - /// - /// - /// - private void ProcessMeans(IRtfVisualText visualText, string txt,iTextSharp.text.Font font) - { - Match m = Regex.Match(txt, "(.*)[[]Mean (.+)[]](.*)", RegexOptions.IgnoreCase); - Chunk chk; - if (m.Groups.Count == 4) // If the text contains [Mean ...] then follow the code to add a line above the text. - { - //The first group is the text before the last [Mean ...] - ProcessMeans(visualText, m.Groups[1].Value, font);// Recursively process the first group. - // The second group is the text within the [Mean ...] range - chk = new Chunk(m.Groups[2].Value, font); - float offset = .8f;// This is just above the character. - // If the content is lower case and does not have ascenders then move the line down. - if (Regex.IsMatch(m.Groups[2].Value, "^[acgmnopqrsuvwxyz]+$")) - offset = .6F; - //PrintOverride.CompressPropSubSup = true; - if (visualText.Format.SuperScript < 0)// Adjust line for subscript - { - offset -= .2f; - if (PrintOverride.CompressPropSubSup) offset += .2f;// Adjust line for shrinking font - } - if (visualText.Format.SuperScript > 0)//Adjust line for superscript - { - offset += .3f; - if (PrintOverride.CompressPropSubSup) offset += .2f;// Adjust line for shrinking font - } - // Draw the line - chk.SetUnderline(font.Color, 0, .05F, 0, offset, PdfContentByte.LINE_CAP_ROUND); - AdjustChunk(visualText, font, chk); - _MyParagraph.Add(chk); - // output the text following the [Mean ...] - chk = new Chunk(m.Groups[3].Value, font); - AdjustChunk(visualText, font, chk); - _MyParagraph.Add(chk); - } - else - { - chk = new Chunk(txt, font); - AdjustChunk(visualText, font, chk); - _MyParagraph.Add(chk); - } - } - private void AdjustChunk(IRtfVisualText visualText, iTextSharp.text.Font font, Chunk chk) - { - if (visualText.Format.BackgroundColor.AsDrawingColor.ToArgb() != System.Drawing.Color.White.ToArgb()) - chk.SetBackground(new iTextSharp.text.Color(visualText.Format.BackgroundColor.AsDrawingColor)); - if (visualText.Format.IsStrikeThrough) - chk.SetUnderline(font.Color, 0, 0.05F, 0, .3F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size - if (visualText.Format.IsUnderline) - if (visualText.Format.SuperScript < 0) - { - if (PrintOverride.CompressSub) - { - float yoffundx = (_MyParagraph.Leading < 12 && font.Size >= 12) ? -0.06F : -0.18F; - chk.SetUnderline(font.Color, 0, 0.07F, 0, yoffundx, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size - } - else - chk.SetUnderline(font.Color, 0, 0.05F, 0, -.381F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size - } - else if (visualText.Format.SuperScript > 0 && PrintOverride.CompressSuper) - { - float yoffundx = (_MyParagraph.Leading < 12 && font.Size >= 12) ? -0.06F : -0.18F; - chk.SetUnderline(font.Color, 0, 0.07F, 0, yoffundx, PdfContentByte.LINE_CAP_ROUND); - } - else - { - // If on a compressed printed step (Leading < 12) and a larger underlined font, then set the underlining - // a little less far down the page. Without this, the underline was touching the 2nd line of text, if it existed. - // Any plant that had compressed steps with the font size/underline would have this problem. An example - // was Braidwood FSG-6, high level steps. - float yoffund = (_MyParagraph.Leading < 12 && font.Size >= 12) ? -0.06F : -0.131F; - if(chk.Font.BaseFont.PostscriptFontName.ToUpper().Contains("BOLD")) // C2021-052 make underline thicker if text is bolded - chk.SetUnderline(font.Color, 0, 0.12F, 0, yoffund, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size - else - chk.SetUnderline(font.Color, 0, 0.05F, 0, yoffund, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size - } - - if (visualText.Format.SuperScript > 0) - { - if (PrintOverride.CompressPropSubSup) - { - chk.SetTextRise(.33F * chk.Font.Size); - chk.Font.Size *= .75f; - } - else - { - chk.SetTextRise(.25F * chk.Font.Size); - if (PrintOverride.CompressSuper) chk.Font.Size = 9; - } - - } - else if (visualText.Format.SuperScript < 0) - { - if (PrintOverride.CompressPropSubSup) - chk.Font.Size *= .75f; - else - { - // if the subscript is not compressed or if it is compress but not underlined, then move it down - if (!PrintOverride.CompressSub || !visualText.Format.IsUnderline) chk.SetTextRise(-.25F * chk.Font.Size); - if (PrintOverride.CompressSub) chk.Font.Size = 9; - } - } - else - chk.SetTextRise(0); - switch (visualText.Format.Alignment) - { - case RtfTextAlignment.Center: - _MyParagraph.Alignment = Element.ALIGN_CENTER; - break; - case RtfTextAlignment.Justify: - _MyParagraph.Alignment = Element.ALIGN_JUSTIFIED; - break; - case RtfTextAlignment.Left: - _MyParagraph.Alignment = Element.ALIGN_LEFT; - break; - case RtfTextAlignment.Right: - _MyParagraph.Alignment = Element.ALIGN_RIGHT; - break; - default: - break; - } - if (_MyFont == null) - { - _MyFont = font; - //B2021-055 If first character was a bold symbol, entire line was bold - // Set the MyParagraph font to an not bolded version - //B2021-058 Needed to double font size because GetFont will divide it to zero - _MyParagraph.Font = Volian.Svg.Library.VolianPdf.GetFont(font.Familyname, (int)(font.Size * 2), 0); - } - } - - private string ShowSpecialCharacters(string p) - { - StringBuilder sb = new StringBuilder(); - foreach (char c in p) - { - int i = (int)c; - if (i < 20 || i > 127) - sb.Append(string.Format("<{0:x}>", i)); - else - sb.Append(c); - } - return sb.ToString(); - }// DoVisitText - - - // ---------------------------------------------------------------------- - protected override void DoVisitImage(IRtfVisualImage visualImage) - { - //_MyParagraph.Add(new Chunk("")); - //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); - //Console.WriteLine("Size {0}", visualImage.ImageForDrawing.Size); - 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); - //Console.WriteLine("4 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds); - 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); - //Console.WriteLine("6 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds); - _lastWasLineBreak = 0; // B2017-191 reset hard return count - } // DoVisitImage - - } -} diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs deleted file mode 100644 index a6cc1382..00000000 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ /dev/null @@ -1,3330 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text; -using iTextSharp.text.pdf; -using iTextSharp.text.factories; -using Volian.Svg.Library; -using System.Text.RegularExpressions; -using System.Xml; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; - -namespace Volian.Print.Library -{ - public partial class VlnSvgPageHelper:SvgPageHelper - { - private float _TableAdjustment = 0;// RHM20150525 - Table Scrunch - public float TableAdjustment - { - get { return _TableAdjustment; } - set { _TableAdjustment = value; } - } - private vlnParagraph _AdjustedTable; // B2020-059 - save info of table that was compressed (set in vlnParagraph.cs DrawGrid() and used in RTF2PDF.cs TextAt()) - public vlnParagraph AdjustedTable - { - get { return _AdjustedTable; } - set { _AdjustedTable = value; } - } - private float _AdjustedTableYtop; - public float AdjustedTableYtop // B2020-059 - save the Ytop of the compressed table (set in vlnParagraph.cs DrawGrid() and used in RTF2PDF.cs TextAt()) - { - get { return _AdjustedTableYtop; } - set { _AdjustedTableYtop = value; } - } - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private pkParagraphs _MyPlacekeepers = new pkParagraphs(); - public pkParagraphs MyPlacekeepers - { - get { return _MyPlacekeepers; } - } - private pkParagraphs _MyContActSteps = new pkParagraphs(); - public pkParagraphs MyContActSteps - { - get { return _MyContActSteps; } - } - // F2022-024 Time Critical Action Step - private pkParagraphs _MyTimeCriticalActionSteps = new pkParagraphs(); - public pkParagraphs MyTimeCriticalActionSteps - { - get { return _MyTimeCriticalActionSteps; } - } - private float? _BottomContent = null;// RHM20150525 - Table Scrunch - public float? BottomContent - { - get - { - return _BottomContent; - } - set - { - if(value == null || _BottomContent == null || _BottomContent > value) - _BottomContent = value; - } - } - private PageBookmarks _PageBookmarks = new PageBookmarks(); - public PageBookmarks PageBookmarks - { - get { return _PageBookmarks; } - set { _PageBookmarks = value; } - } - private List _MyPdfOutlines = new List(); - public List MyPdfOutlines - { - get { return _MyPdfOutlines; } - } - private ChkListBoxesHelper _CheckListBoxes = null; - private ChkListBoxesHelper CheckListBoxes - { - get { return _CheckListBoxes; } - set { _CheckListBoxes = value; } - } - private vlnText _TopMessage; - public vlnText TopMessage - { - get { return _TopMessage; } - set { _TopMessage = value; } - } - private int _prtSectID = -1; - public int PrtSectID - { - get { return _prtSectID; } - set { _prtSectID = value; } - } - private List _TopMessageRs=new List(); // Added if there are 2 messages, in AER AND RNO (for BGE) - public List TopMessageRs - { - get { return _TopMessageRs; } - set { _TopMessageRs = value; } - } - private List _TopMessageSub1s=new List(); // BGE Alarms: in CONDITION/RESPONSE if break within substep - public List TopMessageSub1s - { - get { return _TopMessageSub1s; } - set { _TopMessageSub1s = value; } - } - private List _TopMessageSub2s=new List(); // BGE Alarms: in CONDITION/RESPONSE if break within substep - public List TopMessageSub2s - { - get { return _TopMessageSub2s; } - set { _TopMessageSub2s = value; } - } - private List _BottomMessage = new List(); // B2017-203) any continuous sections with end messages may have more than 1 message on a page - public List BottomMessage - { - get { return _BottomMessage; } - set { _BottomMessage = value; } - } - private vlnText _BottomMessageR; // Added if there are 2 messages, in AER AND RNO (for BGE) - public vlnText BottomMessageR - { - get { return _BottomMessageR; } - set { _BottomMessageR = value; } - } - private vlnText _BottomMessageA; // Added if there are 3 messages, at bottom AND in AER AND RNO (for BGEALARMS) - public vlnText BottomMessageA - { - get { return _BottomMessageA; } - set { _BottomMessageA = value; } - } - private Dictionary> _NotesToFootNotesHLS = new Dictionary>(); - public Dictionary> NotesToFootNotesHLS - { - get { return _NotesToFootNotesHLS; } - set { _NotesToFootNotesHLS = value; } - } - private List _NotesToFootNotes = new List(); - public List NotesToFootNotes - { - get { return _NotesToFootNotes; } - set { _NotesToFootNotes = value; } - } - private float _NotesToFootNotesYoffset = 0; - - public float NotesToFootNotesYoffset - { - get { return _NotesToFootNotesYoffset; } - set { _NotesToFootNotesYoffset = value; } - } - Dictionary _MyParagraphs = new Dictionary(); - public Dictionary MyParagraphs - { - get { return _MyParagraphs; } - set { _MyParagraphs = value; } - } - float _YMultiplier = 1; - public float YMultiplier - { - get { return _YMultiplier; } - set { _YMultiplier = value; } - } - float _PhoneListHeight = 0; - public float PhoneListHeight - { - get { return _PhoneListHeight; } - set { _PhoneListHeight = value; } - } - private float _AlarmYoffStart = 0; - public float AlarmYoffStart - { - get { return _AlarmYoffStart; } - set { _AlarmYoffStart = value; } - } - private float _AlarmYoffEnd = 0; - public float AlarmYoffEnd - { - get { return _AlarmYoffEnd; } - set { _AlarmYoffEnd = value; } - } - private float _SectionSepLineYoffStart = 0; - public float SectionSepLineYoffStart - { - get { return _SectionSepLineYoffStart; } - set { _SectionSepLineYoffStart = value; } - } - private PdfWriter _MyPdfWriter; - public PdfWriter MyPdfWriter - { - get { return _MyPdfWriter; } - set - { - MyPageCounts = new PageCounts(); - MyTOCPageCounts = new PageCounts(); - MyTOCPageNums = new Dictionary(); - _MyPdfWriter = value; - } - } - private PdfContentByte _MyPdfContentByte; - public PdfContentByte MyPdfContentByte - { - get { return _MyPdfContentByte; } - set { _MyPdfContentByte = value; } - } - private int _FinalMessageSectionID; - public int FinalMessageSectionID - { - get { return _FinalMessageSectionID; } - set { _FinalMessageSectionID = value; } - } - private bool _DidFirstPageDocStyle = false; - public bool DidFirstPageDocStyle - { - get { return _DidFirstPageDocStyle; } - set { _DidFirstPageDocStyle = value; } - } - public override void OnCloseDocument(PdfWriter writer, iTextSharp.text.Document document) - { - AddBookmarks(writer); - MyPageCounts.DrawTemplates(); - } - private bool _OnBlankPage = false; - public bool OnBlankPage // used while inserting a blank page when printing a procedure with duplex foldouts - { - get { return _OnBlankPage; } - set { _OnBlankPage = value; } - } - // when false, no page has been printed yet (for determining whether a blank page before print - // needs done if first section has foldouts) - private bool _PrintedAPage = false; - public bool PrintedAPage - { - get { return _PrintedAPage; } - set { _PrintedAPage = value; } - } - - // the following two variables are used to handle the 'PSOnlyFirst' page list Justify flag. - // PSOnlyFirst signals that the pagelist token should only be processed for the first page of - // the section. It gets set when this token is processed, so that any remaining pages will - // not get the token. It's value is derived by taking the different the location of this token - // & the location of the previous token, so that this amount can be used to move the text up - // on the 'not first' pages of the section. It's used as an adjustment on the topmargin. - // This is used in FNP formats. - private int _sectLevelNumTtlDiff = 0; - private int _PrintedSectionPage = 0; - public int PrintedSectionPage - { - get { return _PrintedSectionPage; } - set { _PrintedSectionPage = value; } - } - private static int _CountInApplProcs; // B2021-127: BNPPalr - Auto set of serial # - public static int CountInApplProcs - { - get { return _CountInApplProcs; } - set { _CountInApplProcs = value; } - } - // C2025-033 Child (slave) being printed - private static int _PrintingChild = 0; - public static int PrintingChild - { - get { return _PrintingChild; } - set { _PrintingChild = value; } - } - - //private bool _AddBlankPagesForDuplexPrinting = false; - //public bool AddBlankPagesForDuplexPrinting // Tells us if a the option to add a blank page is turn on (for procedures with duplex foldouts) - //{ - // get { return _AddBlankPagesForDuplexPrinting; } - // set { _AddBlankPagesForDuplexPrinting = value; } - //} - private int _prevSectId = 0; - public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document) - { - TableAdjustment = 0;// RHM20150525 - Table Scrunch - //string path = Volian.Base.Library.vlnStackTrace.StackToStringLocal(3, 1); - //Console.WriteLine("End {0}",path); - int profileDepth = ProfileTimer.Push(">>>> OnEndPage"); - InitialsPrinted = false; - MyPromsPrinter.OnStatusChanged(string.Format("Page {0}", CurrentPageNumber+1)); - // B2019-152: Landscape page merged page numbers - if (this.MySection != null && MySection.MyDocStyle.LandscapePageList) PromsPrinter.AddMergedLandscapePage(this, MyPromsPrinter.PDFFile); - bool onBlankPage = OnBlankPage; - if (OnBlankPage) - { - OnBlankPage = false; - } - else if (!OnFoldoutPage) - { - if (DidFirstPageDocStyle) SetDocStyleAndValues(); - AddBookmarks(writer); - MyPageCounts.CanIncrement = true; - base.OnEndPage(writer, document); - DrawFootnotes(writer.DirectContent); - DrawChangeBars(writer.DirectContent); - DrawMessages(writer.DirectContent); - if (!CreatingFoldoutPage && !CreatingSupInfoPage) - { - DrawRuler(writer.DirectContent); - float x = MySection == null ? 555 : (float)MySection.MyDocStyle.Layout.PageWidth; - DrawBottomRuler(writer.DirectContent, x / 2 - 144); //aer column - DrawBottomRuler(writer.DirectContent, x - 144); //rno column - } - } - else - { - E_NumberingSequence numseq = MySection.MyDocStyle.NumberingSequence??0; - // if a foldout is only printing within its section, don't do increments on pagecounts: - if (numseq==E_NumberingSequence.WithinEachSection) - MyPageCounts.CanIncrement = false; - else - MyPageCounts.CanIncrement = true; - base.OnEndPage(writer, document); - if (!CreatingFoldoutPage && !CreatingSupInfoPage) - DrawRuler(writer.DirectContent); - } - // added the check for onBlankPage and Foldouts to fix bug found in V.C. Summer auto table of contents - 03/08/2016 - //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box - if (!onBlankPage && (MySection.MyDocStyle.StructureStyle.Style==null || (MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0) && - !(MySection.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts && (MySection.MyConfig as SectionConfig).Section_IsFoldout == "Y")) - CurrentTOCPageNumber++; - if (MySection.ActiveFormat.PlantFormat.FormatData.SectData.PrintPhoneList) - { - SectionConfig sc = MySection.MyConfig as SectionConfig; - if (sc.Section_PhoneList != null && sc.Section_PhoneList == "Y") - { - // yoffset the footer length + the size of the phone list: - float yoff = (float)MySection.MyDocStyle.Layout.FooterLength + PhoneListHeight + 12; // 12 is an extra line for the horizontal. - DocVersionConfig dvc = MySection.MyDocVersion.MyConfig as DocVersionConfig; - if (dvc != null) - DrawPhoneList(writer.DirectContent, (float)MySection.MyDocStyle.Layout.LeftMargin, (float)MySection.MyDocStyle.Layout.PageWidth, yoff, dvc.Print_PhoneList); - } - } - - if (MySection.MyDocStyle.CenterLineX != null && !onBlankPage) - { - if ((MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS) - DrawHorizontal(writer.DirectContent, (float)MySection.MyDocStyle.Layout.LeftMargin, (float)MySection.MyDocStyle.Layout.PageWidth, (float)MySection.MyDocStyle.CenterLineYTop); - //if (MySection.ColumnMode > 0 && onBlankPage == false) - if (MySection.ColumnMode > 0 || MySection.ActiveFormat.PlantFormat.FormatData.PrintData.WCNTraining) - { - DrawCenterLine(writer.DirectContent, MySection.MyDocStyle.Layout.LeftMargin + MySection.MyDocStyle.CenterLineX ?? 0, MySection.MyDocStyle.CenterLineYTop ?? 0, MySection.MyDocStyle.CenterLineYBottom ?? 0); - if (MySection.ActiveFormat.PlantFormat.FormatData.PrintData.WCNTraining) - { - // only draw the line if this is a new section. - if (MySection.ItemID != _prevSectId) DrawHorizontal(writer.DirectContent, (float)(MySection.ActiveFormat.PlantFormat.FormatData.SectData.SectionHeaderSeparatorLine.XStartPos ?? 0), (float)(MySection.ActiveFormat.PlantFormat.FormatData.SectData.SectionHeaderSeparatorLine.Length ?? 0), SectionSepLineYoffStart); - _prevSectId = MySection.ItemID; - } - } - } - - if (MySection.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - { - float left = (float)MySection.MyDocStyle.Layout.LeftMargin + 4.40f - 6; // used 4.40 -6 to line up with the macro & not touch two digit sub-step tabs. - float right = (float)MySection.MyDocStyle.Layout.PageWidth - .76f; // used -.76 to make bge alarm lines closest to lining up with macro - if (AlarmYoffStart > 0) - { - // draw vertical - either to the alarmyoffend or bottom of page - if (AlarmYoffEnd > 0) // ends on this page. - { - DrawVertical(writer.DirectContent, left, AlarmYoffStart, AlarmYoffEnd); - DrawVertical(writer.DirectContent, right, AlarmYoffStart, AlarmYoffEnd); - DrawVertical(writer.DirectContent, (right + left) / 2, AlarmYoffStart, AlarmYoffEnd); - DrawHorizontal(writer.DirectContent, left, right, AlarmYoffEnd); - AlarmYoffStart = 0; - AlarmYoffEnd = 0; - } - else - { - float yBottom = (float)(writer.DirectContent.PdfWriter.PageSize.Height - ((float)MySection.MyDocStyle.Layout.TopMargin + (float)MySection.MyDocStyle.Layout.PageLength)); - DrawVertical(writer.DirectContent, left, AlarmYoffStart, yBottom); - DrawVertical(writer.DirectContent, right, AlarmYoffStart, yBottom); - DrawVertical(writer.DirectContent, (right + left) / 2, AlarmYoffStart, yBottom); - DrawHorizontal(writer.DirectContent, left, right, yBottom); - AlarmYoffStart = (float)writer.DirectContent.PdfWriter.PageSize.Height - (float)MySection.MyDocStyle.Layout.TopMargin; - } - } - } - PageListTopCheckOffHeader = null; - PageListLastCheckOffHeader = null; - BottomContent = null; - YMultiplier = 1; - PrintedAPage = true; - ProfileTimer.Pop(profileDepth); - } - private void DrawBottomRuler(PdfContentByte cb, float x) - { - VlnSvgPageHelper myPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - if (myPageHelper.DebugLayer != null) - { - cb.BeginLayer(myPageHelper.DebugLayer); - cb.SaveState(); - cb.SetLineWidth(.1F); - cb.SetColorStroke(new Color(System.Drawing.Color.Plum)); - float height = 350; - float yTop = 350; - float yBottom = yTop - height; - cb.MoveTo(x, yTop); - cb.LineTo(x, yBottom); - if (myPageHelper.BottomContent != null) - { - cb.MoveTo(0, (float)myPageHelper.BottomContent); - cb.LineTo(PDFPageSize.PaperSizePoints(MySection.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize), (float)myPageHelper.BottomContent); // C2020-002 paper size is now set in the format files - } - int i = 0; - for (float y = yBottom; y <= yTop; y += 12) - { - float w = 10; - if (i % 6 == 0) w = 30; - else if (i % 3 == 0) w = 20; - cb.SetLineWidth(w / 30); - i++; - cb.MoveTo(x + w, y); - cb.LineTo(x, y); - cb.Stroke(); - } - for (float y = yBottom; y <= yTop; y += 10) - { - float w = 10; - if (i % 10 == 0) w = 30; - else if (i % 5 == 0) w = 20; - cb.SetLineWidth(w / 30); - i++; - cb.MoveTo(x - w, y); - cb.LineTo(x, y); - cb.Stroke(); - } -i = 0; - cb.Stroke(); - cb.RestoreState(); - cb.EndLayer(); - } - } - private void DrawVertical(PdfContentByte cb, float x, float top, float bottom) - { - cb.SaveState(); - if (PageListLayer != null) cb.BeginLayer(PageListLayer); - cb.SetColorStroke(new Color(PrintOverride.SvgColor)); - cb.SetLineWidth(1.05f); // Tweak the line width to match vlnmacro - //cb.SetColorStroke(lineColor); - cb.MoveTo(x, top); - cb.LineTo(x, bottom); - cb.Stroke(); - if (PageListLayer != null) cb.EndLayer(); - cb.RestoreState(); - } - - private void DrawPhoneList(PdfContentByte pdfContentByte, float leftMargin, float pageWidth, float yOff, string plist) - { - // draw the line above the phone list: - yOff = yOff + 4; // move up 1/2 line: - DrawHorizontal(pdfContentByte, leftMargin, pageWidth, yOff); - - pdfContentByte.SaveState(); - if (PageListLayer != null) pdfContentByte.BeginLayer(PageListLayer); - pdfContentByte.SetColorStroke(new Color(PrintOverride.SvgColor)); - - // for each line, break it into phone items for printing. Note that 16bit code also supported - // a tabbing line - BGE wasn't using this in data at time of development. The following code may - // need expanded to support the tabbing/column definitions if this is found in data. - float lyoff = yOff - 4; - plist = plist.Replace("\r", string.Empty); - string[] lines = plist.Split("\n".ToCharArray()); - DocStyle docstyle = MySection.MyDocStyle; - try - { - foreach (string clinex in lines) - { - string cline = clinex.TrimEnd(); - if (cline != string.Empty) - { - // xoff handles the columns. The separator between phone items is a double space. A phone - // item may have a single space within it (this comes from 16bit implementation) - float xoff = (float)docstyle.Layout.LeftMargin; - int stLineindx = 0; - int endLineindx = cline.IndexOf(" "); - bool endOfLine = false; - while (!endOfLine) - { - if (endLineindx - stLineindx > 0) - { - string phone = cline.Substring(stLineindx, endLineindx - stLineindx); - float tmp = 0; - vlnText vt = new vlnText(pdfContentByte, null, phone, phone, xoff, lyoff, MySection.ActiveFormat.PlantFormat.FormatData.Font); - vt.ToPdf(pdfContentByte, 0, ref tmp, ref tmp); - xoff += 132; // columns in 16bit were a little more than 1 3/4 inches. - stLineindx = endLineindx; - if (stLineindx >= cline.Length) break; - while (cline[stLineindx] == ' ' && stLineindx < cline.Length) stLineindx++; - if (stLineindx >= cline.Length - 1) endOfLine = true; - else - { - endLineindx = cline.IndexOf(" ", stLineindx); - if (endLineindx == -1) endLineindx = cline.Length; - } - } - else - endOfLine = true; - } - lyoff = lyoff - vlnPrintObject.SixLinesPerInch; - } - } - } - catch (Exception ex) - { - _MyLog.Error("Error processing phone list.", ex); - } - if (PageListLayer != null) pdfContentByte.EndLayer(); - pdfContentByte.RestoreState(); - } - private void DrawHorizontal(PdfContentByte cb, float left, float right, float yoff) - { - // if there are gaps, check to be sure top isn't a double line box. If it's a box, don't draw the top line. - if (MyGaps != null && MyGaps.Count > 0 && MyGaps[0].YTop == (float)MySection.MyDocStyle.CenterLineYTop) return; - cb.SaveState(); - if (PageListLayer != null) cb.BeginLayer(PageListLayer); - cb.SetColorStroke(new Color(PrintOverride.SvgColor)); - if (MySection.MyDocStyle.CLineWidth != null && MySection.MyDocStyle.CLineWidth != 0) cb.SetLineWidth((float)MySection.MyDocStyle.CLineWidth); - //cb.SetColorStroke(lineColor); - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("HorzLn X1={0} Y={1} X2={2}", left, yoff, right); - cb.MoveTo(left, yoff); - cb.LineTo(right, yoff); - cb.Stroke(); - if (PageListLayer != null) cb.EndLayer(); - cb.RestoreState(); - } - private Gaps _MyGaps; - public Gaps MyGaps - { - get - { - if (_MyGaps == null) - _MyGaps = new Gaps(); - return _MyGaps; - } - } - public void AddGap(float top, float bottom, float left, float right) - { - float center = MySection.MyDocStyle.Layout.LeftMargin + MySection.MyDocStyle.CenterLineX ?? 0; - if(center == 0) return; - if (center > right || center < left) return; - MyGaps.Add(top, bottom); - } - private void DrawCenterLine(PdfContentByte cb, float xLoc, float yTop, float yBottom) - { - //iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.DarkOrange)); - cb.SaveState(); - if (PageListLayer != null) cb.BeginLayer(PageListLayer); - float lwidth = MySection.MyDocStyle.CLineWidth ?? .95f; - cb.SetLineWidth(lwidth); - cb.SetColorStroke(new Color(PrintOverride.SvgColor)); - //cb.SetColorStroke(lineColor); - cb.MoveTo(xLoc, yTop); - float ylast = yTop; - if (_MyGaps != null) - { - foreach (Gap gap in MyGaps) - { - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("CntrLn X={0} Top={1} Btm={2}", xLoc, ylast, gap.YTop - (gap.YTop - gap.YBottom) * YMultiplier); - cb.LineTo(xLoc, gap.YTop); - cb.MoveTo(xLoc, gap.YTop - (gap.YTop - gap.YBottom) * YMultiplier); - ylast = gap.YTop - (gap.YTop - gap.YBottom) * YMultiplier; - } - _MyGaps = null; - } - // put in for V.C. Summer - // the end message for EOP procedure 15.2 was at the very bottom of the page. - // the remaining center line was drawn past the page boarder. there was no need - // to print it for cases like that - if (ylast > yBottom) - { - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("CntrLn X={0} Top={1} Btm={2}", xLoc, ylast, yBottom); - cb.LineTo(xLoc, yBottom); - } - cb.Stroke(); - if (PageListLayer != null) cb.EndLayer(); - cb.RestoreState(); - } - - private bool SetDocStyleAndValues() - { - // if this document style has another style that is for pages other than first, we need to - // reset the document style off of this section AND reset docstyle values used - // AND reset the 'svg' data. - bool forceLoadSvg = false; - if ((MySection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0) - { - //Console.WriteLine("{0} ResetDocStyleAndValues", MySection.MyDocStyle.Name); - ItemInfo ii = (ItemInfo) MySection; - int indx = (int)MySection.MyDocStyle.IndexOtherThanFirstPage; - foreach (DocStyle ds in ii.ActiveFormat.PlantFormat.DocStyles.DocStyleList) - { - if (ds.Index == indx) - { - MySection.MyDocStyle = ds; - forceLoadSvg = true; - break; - } - } - } - return forceLoadSvg; - } - public void ResetSvg() - { - Volian.Svg.Library.Svg sectSvg = BuildSvg(_MySection, true); - if (sectSvg != null) MySvg = sectSvg; - } - private float? _YTopMargin = null; - public float? YTopMargin - { - get { return _YTopMargin - _AdjustTopMarginForMultiLinePageListItems; } - set { _YTopMargin = value; } - } - private void DrawRuler(PdfContentByte cb) - { - if (DebugLayer == null) return; - Layout layout = MySection.MyDocStyle.Layout; - cb.SaveState(); - cb.BeginLayer(DebugLayer); - float x = (cb.PdfWriter.PageSize.Left + cb.PdfWriter.PageSize.Right) / 2; - cb.SetLineWidth(.1F); - cb.SetColorStroke(new Color(System.Drawing.Color.CornflowerBlue)); - float yTop = (float)(cb.PdfWriter.PageSize.Height - layout.TopMargin); - //Console.WriteLine("Page,yTop,yTopMargin {0},{1},{2}", cb.PdfDocument.PageNumber, yTop, YTopMargin); - if(YTopMargin != null) yTop = (float)YTopMargin; - float yBottom = (float)(cb.PdfWriter.PageSize.Height - (layout.TopMargin + layout.PageLength)); - //Console.WriteLine("'{0}',{1},{2}", MySection.MyDocStyle.Name, yTop, yBottom); - cb.MoveTo(x, yTop); - cb.LineTo(x, yBottom); - int i = 0; - for (float y = yTop; y >= yBottom; y -= 12) - { - float w = 10; - if (Volian.Base.Library.VlnSettings.GetCommandFlag("InchRuler")) - { - if (i % 6 == 0) w = 30; - else if (i % 3 == 0) w = 20; - } - else - { - if (i % 10 == 0) w = 30; - else if (i % 5 == 0) w = 20; - } - cb.SetLineWidth(w / 30); - i++; - cb.MoveTo(x - w, y); - cb.LineTo(x, y); - cb.Stroke(); - } - i = 0; - for (float y = yTop; y >= yBottom; y -= 10.1F) - { - float w = 10; - if (Volian.Base.Library.VlnSettings.GetCommandFlag("InchRuler")) - { - if (i % 7 == 0) w = 30; - //else if (i % 5 == 0) w = 20; - } - else - { - if (i % 10 == 0) w = 30; - else if (i % 5 == 0) w = 20; - } - cb.SetLineWidth(w / 30); - i++; - cb.MoveTo(x + w, y-1); - cb.LineTo(x, y-1); - cb.Stroke(); - } - cb.SetLineWidth(.1F); - cb.Rectangle((float)layout.LeftMargin, yTop, (float)layout.PageWidth - (float)layout.LeftMargin, yBottom - yTop); - float yFooter = yBottom+(float)layout.FooterLength; - cb.MoveTo((float)layout.LeftMargin,yFooter); - cb.LineTo((float)layout.PageWidth, yFooter); - float yRuler = 612; - cb.MoveTo(0, yRuler); - cb.LineTo(612, yRuler); - for (float x1 = 0; x1 < 612; x1 += 6) // tic marks every 1/12 inch - { - if (x1 % 72 == 0) - { - cb.MoveTo(x1, yRuler-20); - cb.LineTo(x1, yRuler+20); - } - else if (x1 % 36 == 0) - { - cb.MoveTo(x1, yRuler-10); - cb.LineTo(x1, yRuler+10); - } - else - { - cb.MoveTo(x1, yRuler-5); - cb.LineTo(x1, yRuler); - } - } - for (float x1 = 0; x1 < 612; x1 += 7.2f) // tic marks every 1/10 inch - { - if (x1 % 72 == 0) - { - cb.MoveTo(x1, yRuler); - cb.LineTo(x1, yRuler + 20); - } - else if (x1 % 36 == 0) - { - cb.MoveTo(x1, yRuler); - cb.LineTo(x1, yRuler + 10); - } - else - { - cb.MoveTo(x1, yRuler); - cb.LineTo(x1, yRuler + 5); - } - } - //cb.MoveTo(122.4F, 0); //WCN2 HLS - //cb.LineTo(122.4F, cb.PdfWriter.PageSize.Height); - //cb.MoveTo(78, 0); // HLP HLS - //cb.LineTo(78, cb.PdfWriter.PageSize.Height); - //cb.MoveTo(441, 0); // HLP cover page date - //cb.LineTo(441, cb.PdfWriter.PageSize.Height); - //cb.MoveTo(71.4F, 0); // WCN Purpose page, Revision: {REV} - //cb.LineTo(71.4F, cb.PdfWriter.PageSize.Height); - cb.Stroke(); - cb.EndLayer(); - cb.RestoreState(); - } - private void AddBookmarks(PdfWriter writer) - { - foreach (PageBookmark pb in PageBookmarks) - { - int lev = pb.Level; - if (MyPdfOutlines.Count < lev || lev==0) - { - PdfDestination dest = new PdfDestination(PdfDestination.FIT); - PdfOutline pdo = new PdfOutline(writer.DirectContent.RootOutline, dest, pb.Title, false); - if (MyPdfOutlines.Count == lev) - MyPdfOutlines.Add(pdo); - else - MyPdfOutlines[lev] = pdo; - } - else - { - PdfDestination dest =pb.PdfDestination; - if(dest==null) dest = new PdfDestination(PdfDestination.FIT); - PdfOutline pdo = new PdfOutline(MyPdfOutlines[lev-1], dest,Regex.Replace(pb.Title, @"\\{Prerequisite Step: .*?\\}", string.Empty), false); - if (MyPdfOutlines.Count == lev) - MyPdfOutlines.Add(pdo); - else - MyPdfOutlines[lev] = pdo; - } - } - PageBookmarks.Clear(); - } - private void DrawFootnotes(PdfContentByte cb) - { - float tmp = 0; - if (NotesToFootNotes != null && NotesToFootNotes.Count > 0) - { - float _PointsPerPage = (float)PDFPageSize.PaperSizePoints(MySection.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - float yTopMargin = _PointsPerPage - (float)MySection.MyDocStyle.Layout.TopMargin; - float myYOff = NotesToFootNotesYoffset; - foreach (vlnParagraph ntfn in NotesToFootNotes) - { - // subtract from yTopMargin to take the location from the 'roll of paper' - // to the physical page location. - ntfn.YOffset = yTopMargin - myYOff; - ntfn.YTopMost = yTopMargin - myYOff; - - ntfn.Processed = false; // process from here - // Only use ParagraphToPdf for printing of a single step. - // This is assuming that footnotes do not have child steps. - ntfn.ParagraphToPdf(cb, yTopMargin, yTopMargin, tmp); - //ntfn.ToPdf(cb, yTopMargin, ref yTopMargin, ref tmp); - - myYOff -= (ntfn.Height); // - vlnPrintObject.SixLinesPerInch); - } - NotesToFootNotes = null; - } - } - private void DrawMessages(PdfContentByte cb) - { - float tmp = 0; - if (TopMessage != null) - { - TopMessage.ToPdf(cb, 0, ref tmp, ref tmp); - TopMessage = null; // Only output it once. - } - if (TopMessageRs != null && TopMessageRs.Count > 0) - { - foreach (vlnText vt in TopMessageRs) - { - vt.ToPdf(cb, 0, ref tmp, ref tmp); - } - TopMessageRs = null; // Only output it once. - } - if (TopMessageSub1s != null) - { - foreach (vlnText vts1 in TopMessageSub1s) - { - vts1.YOffset = AlarmYoffStart - 3 * vlnPrintObject.SixLinesPerInch; - vts1.ToPdf(cb, 0, ref tmp, ref tmp); - } - TopMessageSub1s = null; // Only output it once. - } - if (TopMessageSub2s != null) - { - foreach (vlnText vts2 in TopMessageSub2s) - { - vts2.YOffset = AlarmYoffStart - 3 * vlnPrintObject.SixLinesPerInch; - vts2.ToPdf(cb, 0, ref tmp, ref tmp); - } - TopMessageSub2s = null; // Only output it once. - } - if (BottomMessage != null && BottomMessage.Count != 0) - { - foreach (vlnText vts3 in BottomMessage) - { - vts3.ToPdf(cb, 0, ref tmp, ref tmp); - } - BottomMessage.Clear(); // Only output it once. - } - if (BottomMessageR != null) - { - BottomMessageR.ToPdf(cb, 0, ref tmp, ref tmp); - BottomMessageR = null; // Only output it once. - } - if (BottomMessageA != null) - { - BottomMessageA.ToPdf(cb, 0, ref tmp, ref tmp); - BottomMessageA = null; // Only output it once. - } - } - public void DrawBottomMessage(PdfContentByte cb) - { - float tmp = 0; - if (BottomMessage != null && BottomMessage.Count != 0) - { - foreach (vlnText vts in BottomMessage) - { - vts.ToPdf(cb, 0, ref tmp, ref tmp); - } - BottomMessage.Clear(); // Only output it once. - } - } - private void DrawChangeBars(PdfContentByte cb) - { - float tmp = 0; - // B2022-060 Prairie Island Alarms, change bars on second page of Alarm Point would sometimes be printed to far down the page - // The TopMargin setting of the first page is different than the second page and needed to be passed in to ToPDF for change bars - float topMargin = (float)MySection.MyDocStyle.Layout.TopMargin; - foreach (vlnChangeBar vcb in MyChangeBars) - { - // TODO: Pass in zeroes because topdf is inherited. - vcb.ToPdf(cb, topMargin, ref tmp, ref tmp); - } - _MyChangeBars = new List(); - } - #region SectionLevelData - private ChangeBarDefinition _ChangeBarDefinition; - public ChangeBarDefinition ChangeBarDefinition - { - get { return _ChangeBarDefinition; } - set { _ChangeBarDefinition = value; } - } - #endregion - private PdfLayer _TextLayer; - public PdfLayer TextLayer - { - get { return _TextLayer; } - set { _TextLayer = value; } - } - private PdfLayer _DebugLayer; - public PdfLayer DebugLayer - { - get { return _DebugLayer; } - set { _DebugLayer = value; } - } - private VEPROMS.CSLA.Library.SectionInfo _MySection; - public VEPROMS.CSLA.Library.SectionInfo MySection - { - get { return _MySection; } - set - { - _MySection = value; - MySectionTitle = ((_MySection.DisplayNumber ?? string.Empty) == string.Empty ? string.Empty : _MySection.DisplayNumber + " - ") + _MySection.DisplayText; - bool forceLoadSvg = false; - if (value.SectionConfig.Section_Pagination == SectionConfig.SectionPagination.Separate && value.MyDocStyle.ResetFirstPageOnSection) - DidFirstPageDocStyle = false; - if (DidFirstPageDocStyle) - forceLoadSvg = SetDocStyleAndValues(); // this method also gets the SVG (the 'else' part of this) - if (_prtSectID > -1) { - forceLoadSvg = true; - } - Volian.Svg.Library.Svg sectSvg = BuildSvg(_MySection, forceLoadSvg); - if (sectSvg != null) MySvg = sectSvg; - _YTopMargin = null; - } - } - private string _MySectionTitle; - public string MySectionTitle - { - get { return _MySectionTitle; } - set { _MySectionTitle = value; } - } - private int _MaxRNO; - public int MaxRNO - { - get - { - return _MySection.ColumnMode; - } - } - private int _CurrentPageOf = 0; - public int CurrentPageOf - { - get { return _CurrentPageOf; } - set { _CurrentPageOf = value; } - } - private string _Rev = string.Empty; - public string Rev - { - get { return _Rev; } - set { _Rev = value; } - } - private string _RevDate = string.Empty; - public string RevDate - { - get { return _RevDate; } - set { _RevDate = value; } - } - private bool _DoFloatingFoldout = true; - public bool DoFloatingFoldout - { - get { return _DoFloatingFoldout; } - set { _DoFloatingFoldout = value; } - } - - private List _MyChangeBars = new List(); - public List MyChangeBars - { - get { return _MyChangeBars; } - set { _MyChangeBars = value; } - } - public void AddChangeBar(vlnChangeBar vcb, string cbmess) - { - if (vcb == null) return; - vlnChangeBar prevCB = null; - foreach (vlnChangeBar cb in MyChangeBars) - { - // only look at changebars in same column - if (cb.XOffset == vcb.XOffset) - { - // if the two change bars end at same location, set prevCB which will - // adjust the length (top position) of the change bar. This condition - // also flags that the change bar texts overlap. - if (cb.YChangeBarBottom == vcb.YChangeBarBottom) prevCB = cb; - - // continuous case, if changes bars overlap, adjust size and don't add new one to - // the MyChangeBars list. - if (MySection.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ContinuousChangeBars || - MySection.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds) - { - if (OverlapOrSpan(cb, vcb)) - { - if (prevCB == null) prevCB = cb; - else if (prevCB.YChangeBarBottom > cb.YChangeBarBottom) prevCB = cb; - cb.BottomIsTable = (vcb.MyParent.MyItemInfo.IsTable); - } - } - } - } - // if this and the prevCB overlap, adjust yoffset/height/ybottom in the prevCB so that both change bars are - // included in this Dictionary item. A new vlnChangeBar is not added to the MyChangeBars list, the current - // one that overlaps with the new is adjusted. - if (prevCB != null) - { - // Bottom for both change bars is same, adjust top (YOffset) and height. - if (prevCB.YChangeBarBottom == vcb.YChangeBarBottom) - { - prevCB.YOffset = Math.Max(prevCB.YOffset, vcb.YOffset); - float yChangeBarBottomExtend = prevCB.YChangeBarBottomExtend; - prevCB.Height = Math.Max(prevCB.Height, vcb.Height); - prevCB.YExtendLine = prevCB.YChangeBarBottom - Math.Min(yChangeBarBottomExtend, vcb.YChangeBarBottomExtend); //Math.Max(prevCB.YExtendLine, vcb.YExtendLine); - // if a change bar message at this ychangebarbottom exists, see which message is used - if (cbmess != null && prevCB.Messages.ContainsKey(prevCB.YChangeBarBottom)) UpdateCbMessage(cbmess, prevCB, vcb.XOffset); - return; - } - // Bottom locations are not the same, but another change bar is not added, i.e. the - // length of the line is adjusted. - prevCB.YOffset = Math.Max(prevCB.YOffset, vcb.YOffset); - float yChangeBarBottomExtend1 = prevCB.YChangeBarBottomExtend; - prevCB.YChangeBarBottom = Math.Min(prevCB.YChangeBarBottom, vcb.YChangeBarBottom); - prevCB.YExtendLine = prevCB.YChangeBarBottom - Math.Min(yChangeBarBottomExtend1, vcb.YChangeBarBottomExtend); //Math.Max(prevCB.YExtendLine, vcb.YExtendLine); - // Two messages at this location, determine which one to use - if (cbmess != null && prevCB.Messages.ContainsKey(prevCB.YChangeBarBottom)) UpdateCbMessage(cbmess, prevCB, vcb.XOffset); - - // no message at this location, just add it. - else if (cbmess != null) - prevCB.Messages.Add(vcb.YChangeBarBottom, new vlnChangeBarMessage(vcb.MyParent.XOffset, cbmess)); - return; - } - - // There was no overlap, add a message if it exists, and then add the change bar to the MyChangeBars list. - if (cbmess != null) vcb.Messages.Add(vcb.YChangeBarBottom, new vlnChangeBarMessage(vcb.MyParent.XOffset, cbmess)); - MyChangeBars.Add(vcb); - } - - private static void UpdateCbMessage(string cbmess, vlnChangeBar prevCB, float xoff) - { - // If there are two messages at the same location, for example an AER change bar & and RNO - // change bar, and the messages have different text, see which change bar message should be - // added, i.e. use the one in 'rno', the greatest x value. - vlnChangeBarMessage tmp = prevCB.Messages[prevCB.YChangeBarBottom]; - if (cbmess != tmp.Message) - { - if (xoff > tmp.ParentX) - { - prevCB.Messages.Remove(prevCB.YChangeBarBottom); - prevCB.Messages.Add(prevCB.YChangeBarBottom, new vlnChangeBarMessage(xoff, cbmess)); - } - } - } - private bool OverlapOrSpan(vlnChangeBar cb, vlnChangeBar vcb) - { - float tolerance = vlnPrintObject.SixLinesPerInch; - if (cb.MyParent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && - (vcb.MyParent.MyItemInfo.IsTable || cb.MyParent.MyItemInfo.IsTable || cb.BottomIsTable)) tolerance *= 1.5f; - bool bothFootnotes = cb.MyParent.MyItemInfo.IsFootnote && vcb.MyParent.MyItemInfo.IsFootnote; - if (!bothFootnotes && cb.MyParent.MyItemInfo.MyHLS != null && vcb.MyParent.MyItemInfo.MyHLS != null && - cb.MyParent.MyItemInfo.MyHLS.ItemID != vcb.MyParent.MyItemInfo.MyHLS.ItemID) return false; - // cb.Yoffset is within range of vcb: - if (cb.YOffset <= vcb.YOffset && - cb.YOffset >= (vcb.YChangeBarBottomExtend - tolerance)) return true; - // cb.YChangeBarBottom is within range of vcb: - if ((cb.YChangeBarBottomExtend - tolerance) <= vcb.YOffset && - cb.YChangeBarBottomExtend >= (vcb.YChangeBarBottomExtend - tolerance)) return true; - // vcb.Yoffset is within range of cb: - if (vcb.YOffset <= cb.YOffset && - vcb.YOffset >= (cb.YChangeBarBottomExtend - tolerance)) return true; - // vcb.YChangeBarBottom is within range of cb: - if ((vcb.YChangeBarBottomExtend - tolerance) <= cb.YOffset && - vcb.YChangeBarBottomExtend >= (cb.YChangeBarBottomExtend - tolerance)) return true; - return false; - } - private PromsPrinter _MyPromsPrinter; - public PromsPrinter MyPromsPrinter - { - get { return _MyPromsPrinter; } - set { _MyPromsPrinter = value; } - } - private int _MyRomanPage = 1; - public VlnSvgPageHelper(VEPROMS.CSLA.Library.SectionInfo mySection, PromsPrinter myPromsPrinter, string hlsText, int hlsItemId, int PrtSectID) - : base() - { - _prtSectID = PrtSectID; - HLSText = hlsText; - HasHLSTextId = hlsItemId; - MyPromsPrinter = myPromsPrinter; - CreatingSupInfoPage = myPromsPrinter.DoingFacingPage; - MySection = mySection; - } - private Volian.Svg.Library.Svg BuildSvg(VEPROMS.CSLA.Library.SectionInfo mySection, bool forceLoad) - { - // if mysection uses continuous pagination, and the previous section uses the same format, - // and the docstyle is set to use on first page only, - // then set section to use the Use On Rest of Pages - //SectionConfig.SectionPagination sPag = SectionConfig.SectionPagination.Separate; - //if (mySection.IsStepSection && mySection.MyPrevious != null && mySection.MyPrevious.IsStepSection) - //{ - // SectionConfig sc = mySection.MyConfig as SectionConfig; - // sPag = sc.Section_Pagination; - // if (sPag == SectionConfig.SectionPagination.Continuous) - // { - // if (MySection.MyDocStyle.StructureStyle.Where == E_DocStyleUse.UseOnFirstPage) - // MySection.DidFirstPageDocStyle = true; - // } - //} - VEPROMS.CSLA.Library.FormatInfo activeFormat = mySection.ActiveFormat; - VEPROMS.CSLA.Library.DocStyle docStyle = mySection.MyDocStyle; - Volian.Svg.Library.Svg mySvg = null; - // the following line fills in the svg/svggroup/svgparts for all that is defined in the genmac definition (svg for plant) - mySvg = SvgSerializer.StringDeserialize(BuildMyText(activeFormat)); - mySvg.ViewBox.Height = 1100; - mySvg.ViewBox.Width = 850; - mySvg.Height = new SvgMeasurement(11, E_MeasurementUnits.IN); - mySvg.Width = new SvgMeasurement(8.5F, E_MeasurementUnits.IN); - mySvg.LeftMargin = (float)docStyle.Layout.LeftMargin; - mySvg.TopMargin = 9.6F; - VEPROMS.CSLA.Library.PageStyle pageStyle = docStyle.pagestyle; - HasInitials = false; - PIInitials = null; - AddPageListItems(mySvg, pageStyle, mySection, forceLoad); - mySvg.ProcessText += new SvgProcessTextEvent(mySvg_ProcessText); - // if this section had a previous section and this is continuous, don't generate the svg for - // it, we'll use the previous section. The only thing we need to do is to process through the - // pagelist items in case there are some section items, for example the checkoff header needs - // to be processed for each section whether or not it is continuous. - SectionConfig.SectionPagination sPag = SectionConfig.SectionPagination.Separate; - //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box - if ((mySection.MyConfig as SectionConfig).Section_IsFoldout != "Y" && mySection.IsStepSection && mySection.MyPrevious != null && mySection.MyPrevious.IsStepSection) - { - SectionConfig sc = mySection.MyConfig as SectionConfig; - sPag = sc.Section_Pagination; - } - //if (sPag == SectionConfig.SectionPagination.Continuous && !mySection.DidFirstPageDocStyle) return null; - if (forceLoad) return mySvg; - if (sPag == SectionConfig.SectionPagination.Continuous) return null; - return mySvg; - } - public PageCounts MyPageCounts = null; - public PageCounts MyTOCPageCounts = null; - public Dictionary MyTOCPageNums = null; - private static Regex regexFindToken = new Regex("{[^{}]*}"); - private static Regex regexFindSubToken = new Regex(@"\[[^{}]*\]"); - private string mySvg_ProcessText(object sender, SvgProcessTextArgs args) - { - if (args.MyText == null) return string.Empty; // Needed for empty genmac text (was space in 16bit files) - if (!args.MyText.Contains("{")) - return args.MyText; - /* - * Check if tokens for handling page counts ({PAGE} {OF} etc). if so, do templates. - */ - if (args.MyText.Contains("{METACURPAGE}") || args.MyText.Contains("{METATOTPAGE}")) - { - ItemInfo top = MySection; - while (top.MyParent != null && !top.MyParent.IsProcedure) - { - top = top.MyParent; - } - string key = "DocCurPage." + top.ItemID; - string txt = args.MyText.Replace("{METACURPAGE}", "{PAGE}").Replace("{METATOTPAGE}", "{OF}"); - MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, txt, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y)); - return string.Empty; - } - if (args.MyText.Contains("{DOCCURPAGE}") || args.MyText.Contains("{DOCTOTPAGE}")) - { - string key = "DocCurPage." + MySection.ItemID; - string txt = args.MyText.Replace("{DOCCURPAGE}", "{PAGE}").Replace("{DOCTOTPAGE}", "{OF}"); - MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, txt, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y)); - return string.Empty; - } - //if (args.MyText.Contains("{ROMANPAGE}")) - //{ - // //return args.MyText.Replace("{ROMANPAGE}", ItemInfo.RomanNumbering(_MyRomanPage++).ToLower()); - // string key = "RomanPage." + MySection.ItemID; - // string txt = args.MyText; - // MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, txt, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y)); - // return string.Empty; - //} - if (args.MyText.Contains("{SECONDARYPAGE}") || args.MyText.Contains("{SECONDARYOF}")) - { - string key = "SecondaryPage." + MySection.DisplayNumber; - string txt = args.MyText.Replace("{SECONDARYPAGE}", "{PAGE}").Replace("{SECONDARYOF}", "{OF}"); - MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, txt, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y)); - return string.Empty; - } - //string tocKey = "TOC" + MySection.ItemID.ToString(); - if (args.MyText.Contains("{PAGE}") || args.MyText.Contains("{OF}")) - { - - #region numberingseq - /* - public enum E_NumberingSequence : uint - { - NoPageNum = 0, - WithSteps = 1, Add to original steps section page count. - WithinEachDocStyle = 2, - WithinEachSection = 3, - WithinEachDocStyle1 = 4, - GroupedByPagination = 5, - GroupedByLevel = 6, - WithStepsAndSecondaryPageNumber = 7, - WithStepsAndSecondaryPageNumberGroupedByLevel = 8, - Like6_ButDoesntNeedSubsection = 9, - Like6_ButDoesntNeedSubsection1 = 10 - }; - */ - #endregion - // default for the key is to make it NumberingSequence. Then handle - // specific cases. - string key = ((int)MySection.MyDocStyle.NumberingSequence).ToString(); - - E_NumberingSequence numseq = MySection.MyDocStyle.NumberingSequence??0; - //Console.WriteLine("\"{0}\"\t\"{1}\"\t{2}", MySection.DisplayNumber, MySection.DisplayText, numseq); - switch (numseq) - { - case E_NumberingSequence.GroupedByPagination: - key = ((int)E_NumberingSequence.WithSteps).ToString(); - break; - case E_NumberingSequence.WithSteps: // Number with 'originalstepsection' - ProcedureInfo pc = MySection.MyProcedure; - int sectid = 0; - foreach (SectionInfo si in pc.Sections) - { - SectionConfig sc = si.MyConfig as SectionConfig; - if (sc.Section_OriginalSteps == "Y") - { - sectid = si.ItemID; - break; - } - } - if (sectid != 0) key = (int)E_NumberingSequence.WithinEachSection + "." + sectid; - break; - case E_NumberingSequence.WithinEachDocStyle: - key = key + "." + MySection.ActiveFormat.FormatID + "." + MySection.MyDocStyle.Index; - break; - //case E_NumberingSequence.WithinEachDocStyle1: - // key = key + "." + MySection.DisplayNumber; - // break; - case E_NumberingSequence.WithinEachSection: - key = key + "." + MySection.ItemID; - break; - case E_NumberingSequence.WithinEachSectionNumber: - key = key + "." + ( MySection.DisplayNumber == string.Empty ? (MySection.ActiveParent as ItemInfo).DisplayNumber : MySection.DisplayNumber); - break; - case E_NumberingSequence.GroupedByLevel: - case E_NumberingSequence.Like6_ButDoesntNeedSubsection: - if (MySection.MyParent.IsSection) - key = key + "." + MySection.MyParent.ItemID; - else - key = key + "." + MySection.ItemID; - break; - case E_NumberingSequence.WithStepsAndSecondaryPageNumber: - // For this one, we'll do two keys and templates. One will go with the main steps - // section and one will be for this secondary section. - ProcedureInfo pc1 = MySection.MyProcedure; - int psectid = 0; - foreach (SectionInfo si in pc1.Sections) - { - SectionConfig sc = si.MyConfig as SectionConfig; - if (sc.Section_OriginalSteps == "Y") - { - psectid = si.ItemID; - break; - } - } - if (psectid != 0) - { - key = (int)E_NumberingSequence.WithinEachSection + "." + psectid; - PdfTemplate tmp1 = MyPageCounts.AddToTemplateList(key, MyPdfWriter, args.MyText, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor); - } - break; - } - PdfTemplate tmp = MyPageCounts.AddToTemplateList(key, MyPdfWriter, args.MyText, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor); - // Proms page numbering designed requires a "{PAGE}" token to increment the page counter. So the easiest way - // to do that was to add a "{PAGE}" token to every page that is flagged as not to be printed. - if (!args.MyText.StartsWith("Non-printing ")) MyPdfContentByte.AddTemplate(tmp, args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y)); - return string.Empty; - } - if (args.MyText.Contains("{FINALPAGE}")) - { - if (MySection.ItemID == FinalMessageSectionID) - { - string key = "FinalPage"; - MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, args.MyText, MySection.MyDocStyle.Final.Message, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y)); - } - return string.Empty; - } - return regexFindToken.Replace(args.MyText, new MatchEvaluator(ReplacePageListToken)); - } - private string BuildMyText(VEPROMS.CSLA.Library.FormatInfo activeFormat) - { - string sGenMac = activeFormat.GenMac; - FormatInfo fibase = activeFormat; - // If this format has checkoffs (go through docstyles to see if any sections 'usecheckoffs'), then see if the ucf checkoffs are - // defined in the format's genmac: - string sGenMacBase = null; - foreach (DocStyle ds in activeFormat.PlantFormat.DocStyles.DocStyleList) - { - if (ds.Inactive == false && ds.UseCheckOffs && !sGenMac.ToUpper().Contains("C100")) - { - while (fibase.FormatID != fibase.ParentID) fibase = fibase.MyParent; - sGenMacBase = fibase.GenMac; - if (sGenMacBase != null && sGenMacBase != string.Empty) - { - XmlDocument xDocGenMacBase = new XmlDocument(); - xDocGenMacBase.LoadXml(sGenMacBase); - sGenMacBase = xDocGenMacBase.DocumentElement.InnerXml; - sGenMacBase = sGenMacBase.Replace("xmlns=\"http://www.w3.org/2000/svg\"", ""); - // replace fonts with hls fontname & size - string bsfontfamily = activeFormat.PlantFormat.FormatData.StepDataList[0].Font.Family; - string bsfontsize = activeFormat.PlantFormat.FormatData.StepDataList[0].Font.Size.ToString(); - sGenMacBase = sGenMacBase.Replace("{family}", bsfontfamily); - sGenMacBase = sGenMacBase.Replace("{size}", bsfontsize); - break; - } - } - } - if (sGenMac == null || sGenMac == string.Empty) - { - // If subformat and does not have its own genmac, find an inherited genmac. - FormatInfo tmpf = FormatInfo.Get(activeFormat.ParentID); - while (tmpf.FormatID!=1 && (sGenMac==null||sGenMac==string.Empty)) - { - sGenMac = tmpf.GenMac; - tmpf = FormatInfo.Get(tmpf.ParentID); - } - if (sGenMac == null || sGenMac == string.Empty) - sGenMac = ""; - } - if (sGenMacBase != null && sGenMacBase != string.Empty) - { - sGenMac = sGenMac.Replace("", sGenMacBase + ""); - } - if (!sGenMac.Contains("xmlns")) - sGenMac = sGenMac.Replace(".StringSerialize(mySvg); - XmlDocument xDocPrintout = new XmlDocument(); - xDocPrintout.LoadXml(str); - XmlNode xn = xDocPrintout.DocumentElement.ChildNodes[0]; - xn.AppendChild(xDocPrintout.ImportNode(xDocGenMac.DocumentElement, true)); - return xDocPrintout.OuterXml; - } - private string FirstAndLast(string token) - { - // strip the curly braces and return the first and last character - // For example Header1 becomes H1 and Box2 becomes B2 - return token.Substring(1, 1) + token.Substring(token.Length - 2, 1); - } - private static Regex regexJustTokens = new Regex(@"^{([^{}]*}{)*[^{}]*}$"); - - // The following variables are used to keep track of whether a check off header should be printed - // if the {CHKOFFHEADING} pagelist item is found. PageListTopCheckOffHeader is the text that - // should be printed at the top of the page. PageListLastCheckOffHeader is the last header that was - // printed (if a header is on the page, and another is to be printed, it doesn't get printed if it - // is the same as the previous) and PageListCheckOffHeader is the page list item converted to a - // SvgText - this stores X/Y location, etc. - public string PageListTopCheckOffHeader = null; - public string PageListLastCheckOffHeader = null; - public SvgText PageListCheckOffHeader = null; - - public Dictionary PgLogicals; - private void AddPageListItems(Volian.Svg.Library.Svg mySvg, VEPROMS.CSLA.Library.PageStyle pageStyle, VEPROMS.CSLA.Library.SectionInfo section, bool forceLoad) - { - SectionConfig sc = section.MyConfig as SectionConfig; - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("SecNum=\"{0}\" SecTitle=\"{1}\" DocStyle=\"{2}\" Format=\"{3}\" ItemID={4}", section.DisplayNumber, section.DisplayText, section.MyDocStyle.Name, sc.FormatSelection, section.ItemID); - Volian.Base.Library.BaselineMetaFile.WriteLine(" Pagination=\"{0}\" MSWordPgCnt={1} NumPages={2} WordMargin={3}", sc.Section_Pagination, section.MSWordPageCount, (string.IsNullOrEmpty(sc.Section_NumPages)) ? "0" : sc.Section_NumPages, (string.IsNullOrEmpty(sc.Section_WordMargin))?"N":sc.Section_WordMargin); - if (PgLogicals == null) PgLogicals = new Dictionary(); - else PgLogicals.Clear(); - - PageListCheckOffHeader = null; - // If this is a continuous section, then the only pagelist items we want are section type since - // we are still on the same page. - CHECK IF ON SAME PAGE!!!! - SectionConfig.SectionPagination sPag = SectionConfig.SectionPagination.Separate; - //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box - if (section.IsStepSection && section.MyPrevious != null && section.MyPrevious.IsStepSection && (section.MyConfig as SectionConfig).Section_IsFoldout != "Y") - { - SectionConfig sc1 = section.MyConfig as SectionConfig; - sPag = sc1.Section_Pagination; - } - SvgGroup svgGroup = new SvgGroup(); - - //int defPtPerRow = 72 / 6; - //int curLPI = 6; // default - //int prevLPI = 6; - //float PrevRow = 0; - //float rowAdj = 0; // = 18; - - bool usePSIvalue = false; // C2021-065 used with ROLkUpMatch pagelist flag (Barakah Alarms) - string otherChildUnit = string.Empty; // C2021-065 used when OTHER applicability information is used for the ROLookUp - // F2023-035: WCN - allow for change in left margin for supplemental information pages by - // setting a value in the DocStyle for the adjustment. - float supInfoMargAdj = 0; - if (CreatingSupInfoPage || MyPromsPrinter.DoingFacingPage) supInfoMargAdj = MySection.MyDocStyle.SupInfoMargAdj == null ? 0 : (float)MySection.MyDocStyle.SupInfoMargAdj; - foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems) - { - if (pageItem.Token == null) continue; // can be null if token is dependent on PSI lookup! - // 2024-089 selectively print pagestyle item base on Child Procedure being printed - if (PrintingChild > 0 && pageItem.ChildNum > 0 && pageItem.ChildNum != PrintingChild) continue; // C2025-033 item should not be printed for this child - DidHLSText = false; // reset to false for this group of tokens. - //if (pageItem.Token.Contains("HLSTEXT")) - // Console.WriteLine("{0} - PageList Token", pageItem.Token); - - // the pagelist 'justify="{PSNotFirst}"' flag only puts item out if not on first page of section, check for this - if (((pageItem.Justify & VEPROMS.CSLA.Library.E_Justify.PSNotFirst) == VEPROMS.CSLA.Library.E_Justify.PSNotFirst) - && PrintedSectionPage == 0) - { - PrintedSectionPage++; - continue; - } - - VE_Font useFontForCheckOffHeader = null; - if (forceLoad || (sPag == SectionConfig.SectionPagination.Separate || ((sPag == SectionConfig.SectionPagination.Continuous || sPag ==0 )&& (pageItem.Row < 0)))) - { - //if (PrevRow > 0) - //{ - // //float pgRow = (float)(pageItem.Row + rowAdj); - // if (curLPI != prevLPI) - // { - // int prow = (int)(PrevRow / defPtPerRow); - // int nrows = ((int)(pageItem.Row / defPtPerRow)) - prow; - // rowAdj += (float)Math.Abs(((nrows * (72 / curLPI)) - ((nrows * defPtPerRow) + rowAdj))); - // //rowAdj += (float)(((pgRow - PrevRow) / (72 * prevLPI)) * (72 / curLPI)); - // prevLPI = curLPI; - // } - //} - // C2019-006 - Moved and modified the RO_Lookup() logic here, before we process the tokens in the page list - // this allows us to use RO_Lookup() in a "PS=" conditional token (is usually a PSI check box) - // A while loop was also added to the we can have more than one call to RO_Lookup() on a pagelist line - // this logic was put in for Barakah Alarms - // Note that each Alarm is defined as its own RO in the Referenced Object database, with multiple return values - // to define the Window ID, Alarm, Source, Setpoint, etc. for example. - string pltok = pageItem.Token; - while (pltok.Contains("RO_Lookup(")) - { - int idxstart = pltok.IndexOf("RO_Lookup("); - int idxend = pltok.Substring(idxstart).IndexOf(")"); - string ROLookupstr = pltok.Substring(idxstart, idxend + 1); - string parms = ROLookupstr.Substring(10, ROLookupstr.Length - 11); - MatchCollection sm = regexFindToken.Matches(parms); - foreach (Match m in sm) // resolve pagelist tokens that are parameters for ROLookup() - { - string tnk = m.Value; - ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref parms, tnk, supInfoMargAdj); - } - string[] parts = parms.Split(",".ToCharArray());// split on comma - // B2019-031 Support commas embedded in Alarm ID (Procedure Number) - // B2019-075: Added the check for commas in the procedure number - this code was causing a bug in other alarms. - if (parts.Length > 3 && MySection.MyProcedure.DisplayNumber.IndexOf(",") > 0)// If extra commas combine first part to account for it - { - int n = parts.Length - 3; - string part0 = parts[0]; - for (int i = 0; i < n; i++) // append parts based upon the number of parts (commas) - part0 += "," + parts[i + 1]; - parts[0] = part0; - parts[1] = parts[n + 1];// Get the last 2 parts - parts[2] = parts[n + 2]; - } - string ROLookupVal = string.Empty; - // parts[0] - the RO to look up - for Alarms, is usually the EOP number thus uses the "{EOPNUM}" token - // parts[1] - Which of the multiple return value from the RO to return - // parts[2] - the value to use if not found in ROs - usually defined in a PSI field for that Alarm procedure - - // C2021-065 Barakah Alarms - check if child RO alarm ID matches the resolved procedure number - // if not, then use the values stored in the PSI instead of the value returned for ROLookup() - // for all of the Alarm Point window items (ROLookup() items) in the pagelist for this section (BNPP Alarms format) - // Note only one pagelist item has this flag and this special pagelist item needs to be listed before any other ROLoopUP items - if (pageItem.ROLkUpMatch) // check for paglist flag - { - string rawPrcNum = section.MyProcedure.MyContent.Number; - // C2021-065 see if we need to get the Other child info from ROLookUp - if (rawPrcNum.ToUpper().StartsWith(" in its definiation (procedure property page) - { - string procnum = section.MyProcedure.DisplayNumber; // get the cooked (resolved) procedure number - int idx = procnum.IndexOf('-'); - otherChildUnit = procnum.Substring(0, idx); // we need to get RO info for the Other child applicability - this gets child's number - } - ROLookupVal = ROLookup(parts[0], parts[1], string.Empty,otherChildUnit); // will return empty string if alarm point is not found in RO database - usePSIvalue = (ROLookupVal != section.MyProcedure.DisplayNumber); // use PSI value if child alarm ID not found or does not match resolved procedure number (alarm point) - } - // C2021-065 if usePSIvalue is true, then we know alarm point info is not in the RO database, so just use the default (PSI) value - if (usePSIvalue) - ROLookupVal = parts[2]; // C2021-065 use the value defined in the PSI - else - ROLookupVal = ROLookup(parts[0], parts[1], parts[2], otherChildUnit); - - // F2021-053: Do replace words for Page List items. This uses a DisplayText constructor that flags this case - // and gets the resulting replaced words - if (pageItem.RepWords) - { - DisplayText dt1 = new DisplayText(MyPromsPrinter.MyItem, ROLookupVal, false, true); - ROLookupVal = dt1.StartText; - // B2023-013 translate character sequences for Plus Minus, Greater Than and Less Than or Equal, Right and Left Arrows - // currently only BNPP uses this - 03-23-2023 - if (MySection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertGTELTEPMinROValue) - { - ROLookupVal = ROLookupVal.Replace("+/-", @"\'b1"); // Plus Minus - ROLookupVal = ROLookupVal.Replace("+-", @"\'b1"); // Plus Minus (without the forward slash - just in case) - ROLookupVal = ROLookupVal.Replace(">=", @"\u8805?"); // Greater than or equal - ROLookupVal = ROLookupVal.Replace("<=", @"\u8804?"); // Less than or equal - } - if (MySection.ActiveFormat.PlantFormat.FormatData.SectData.UseDashGreaterLessThenForArrowsInROValue) - { - ROLookupVal = ROLookupVal.Replace("->", @"\u8594?"); // Right Arrow - ROLookupVal = ROLookupVal.Replace("<-", @"\u8592?"); // Left Arrow - } - } - // replace the pagelist token with ROLookupVal - pltok = pltok.Substring(0, idxstart) + ROLookupVal + ((idxstart + idxend < pltok.Length) ? pltok.Substring(idxstart + idxend + 1) : string.Empty); - } - // C2021-065 (BNPP Alarms format) we are processing a paglist flag (ROLkUpMatch) to determine how to get Alarm Point information - // Nothing else is on this page list item, so use "continue" to jump to the next pagelist item as nothing gets printed for this item - if (pageItem.ROLkUpMatch) - continue; - - MatchCollection matches = regexFindToken.Matches(pltok);//(pageItem.Token); - if (matches.Count > 0) - { - string plstr = string.Empty; - // When a pagelist line (row) has more than one token that is resolved to text, each resolved token text was place on top - // of each other. Use a temporary string (plstr) to process the pagelist tokens for each pagelist line (row) before adding - // it to the svgGroup. - plstr = pltok;//pageItem.Token; - // F2017-046: Remove the '@@' characters that were getting printed on SAMG Sup Info facing pages for Calvert (BGESAM1 format). - if (MyPromsPrinter.DoingFacingPage && plstr.Contains("@@")) plstr = plstr.Replace("@@", string.Empty); - foreach (Match match in matches) - { - string token = match.Value; - //token = Regex.Replace(token, @"[\xB3-\xDF]", " "); - - // handle any conditional PS tokens - if (token.Contains(@"PS=")) - { - ProcedureConfig procConfig = new ProcedureConfig(section.MyProcedure.MyContent.Config); - if (procConfig != null) - { - int indx = token.IndexOf("="); - int qindx = token.IndexOf("?", indx); - string pstok = token.Substring(indx + 1, qindx - indx - 1); - string val = procConfig.GetValue("PSI", pstok); - int bindx = token.IndexOf("|", indx); - if (val == "Y") - { - val = token.Substring(qindx + 1, bindx - qindx - 1); - // F2017-036: see if there is a RelatedItem in this page item. RelatedItem allows for repositioning - // this current item if both items are set to be printed from the Procedure Specific Information. If both are printed - // the location of this item is defined in the RelatedItem xml. - if (pageItem.RelatedItem.Token != null) - { - // see if the related item is on this page also, if so, use the new row/col/justify: - string reltoken = pageItem.RelatedItem.Token; - string relval = procConfig.GetValue("PSI", reltoken); - if (relval == "Y") - { - //svgGroup.Add(PageItemToSvgText(pageItem.Token, (float)pageItem.RelatedItem.Row, (float)pageItem.RelatedItem.Col, pageItem.RelatedItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft, pageItem.Font, val, MySection)); - svgGroup.Add(PageItemToSvgText(pltok, (float)pageItem.RelatedItem.Row, (float)pageItem.RelatedItem.Col, pageItem.RelatedItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft, pageItem.Font, val, MySection)); - plstr = string.Empty; // Clear it so it isn't put out twice (used below) - } - } - } - else - { - int eindx = token.IndexOf("}", bindx); - val = token.Substring(bindx + 1, eindx - bindx - 1); - } - if (val != null && val != string.Empty && !PgLogicals.ContainsKey(pstok)) PgLogicals.Add(pstok, val != null); - //if (val == null || val == string.Empty) - //val = " "; - if (val == null) - val = string.Empty; - plstr = plstr.Replace(token, val); - // Get a list of Pagelist token that are inside the PS= conditional result - // Paglist tokens inside a PS= conditional are surrounded by square brackets instead of curley - // ex. [BOX3] instead of {BOX3} - MatchCollection subMatches = regexFindSubToken.Matches(plstr); - if (subMatches.Count > 0) - { - foreach (Match subMatch in subMatches) - { - string subToken = subMatch.Value; - ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, subToken, supInfoMargAdj); - } - } - } - } - else if (token.Contains(@"SI=")) // F2021-068 needed duplicate conditional logic from PSI (above) but make of folder (set) specific info - { - DocVersionConfig dvConfig = new DocVersionConfig(section.MyProcedure.MyDocVersion.Config); - FolderConfig folderConfig = new FolderConfig(section.MyProcedure.MyDocVersion.MyFolder.Config); - if (dvConfig != null || folderConfig != null) - { - int indx = token.IndexOf("="); - int qindx = token.IndexOf("?", indx); - string pstok = token.Substring(indx + 1, qindx - indx - 1); - string val = DocVersionInfo.GetInheritedSIValue(section.MyProcedure, pstok); - - int bindx = token.IndexOf("|", indx); - if (val == "Y") - { - val = token.Substring(qindx + 1, bindx - qindx - 1); - // see if there is a RelatedItem in this page item. RelatedItem allows for repositioning - // this current item if both items are set to be printed from the Procedure Specific Information. If both are printed - // the location of this item is defined in the RelatedItem xml. - if (pageItem.RelatedItem.Token != null) - { - // see if the related item is on this page also, if so, use the new row/col/justify: - string reltoken = pageItem.RelatedItem.Token; - string relval = DocVersionInfo.GetInheritedSIValue(section.MyProcedure, reltoken); - if (relval == "Y") - { - svgGroup.Add(PageItemToSvgText(pltok, (float)pageItem.RelatedItem.Row, (float)pageItem.RelatedItem.Col, pageItem.RelatedItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft, pageItem.Font, val, MySection)); - plstr = string.Empty; // Clear it so it isn't put out twice (used below) - } - } - } - else - { - int eindx = token.IndexOf("}", bindx); - val = token.Substring(bindx + 1, eindx - bindx - 1); - } - if (val != null && val != string.Empty && !PgLogicals.ContainsKey(pstok)) PgLogicals.Add(pstok, val != null); - //if (val == null || val == string.Empty) - //val = " "; - if (val == null) - val = string.Empty; - plstr = plstr.Replace(token, val); - // Get a list of Pagelist token that are inside the SI= conditional result - // Paglist tokens inside a PS= conditional are surrounded by square brackets instead of curley - // ex. [BOX3] instead of {BOX3} - MatchCollection subMatches = regexFindSubToken.Matches(plstr); - if (subMatches.Count > 0) - { - foreach (Match subMatch in subMatches) - { - string subToken = subMatch.Value; - ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, subToken, supInfoMargAdj); - } - } - } - } - - else - { - if (!ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, token, supInfoMargAdj)) break; - } - } // end foreach matches - if (plstr != string.Empty) - { - if (useFontForCheckOffHeader != null) - svgGroup.Add(PageItemToSvgText(pageItem, plstr, useFontForCheckOffHeader, MySection, supInfoMargAdj)); - else - svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection, supInfoMargAdj)); - } - } - else - svgGroup.Add(PageItemToSvgText(pageItem, pltok, MySection, supInfoMargAdj)); - } - } - // Proms page numbering designed requires a "{PAGE}" token to increment the page counter. So the easiest way - // to do that was to add a "{PAGE}" token to every page that is flagged as not to be printed. - if (sPag == SectionConfig.SectionPagination.Separate) - { - // 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 - // window handle B2017-117 - //SvgText st = new SvgText(new System.Drawing.PointF(300, 300), "Non-printing {PAGE}", new System.Drawing.Font("Arial", 10), System.Drawing.Color.Black); - SvgText st = new SvgText(new System.Drawing.PointF(300, 300), "Non-printing {PAGE}", VE_Font.GetWinSysFont("Arial", 10), System.Drawing.Color.Black); - svgGroup.Add(st); - } - // C2018-004 create meta file for baseline compares - if (svgGroup.Count > 0) - mySvg.Add(svgGroup); - else - Volian.Base.Library.BaselineMetaFile.WriteLine("No Pagelist Information"); - } - - private string ROLookup(string accpageid, string multiid, string deflt) - { - return ROLookup(accpageid, multiid, deflt, string.Empty); - } - - // C2021-065 pass in a override for the child unit - in this case the token is being used (Barakah Alarms) - private string ROLookup(string accpageid, string multiid, string deflt, string overrideChild) - { - ROFSTLookup myLookup = MySection.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MySection.MyDocVersion, overrideChild); - - //C2026-047 first try the RO Lookup with the ascii dash character in the accpageid. If not found, try again with the unicode dash - ROFSTLookup.rochild roc = myLookup.GetROChildByAccPageID("<" + accpageid.Replace(@"\u8209?", "-") + "." + multiid + ">", MySection.MyDocVersion.DocVersionConfig.RODefaults_setpointprefix, MySection.MyDocVersion.DocVersionConfig.RODefaults_graphicsprefix); - - if (roc.value == null) - { - // try again but this time with the unicode dash - roc = myLookup.GetROChildByAccPageID("<" + accpageid + "." + multiid + ">", MySection.MyDocVersion.DocVersionConfig.RODefaults_setpointprefix, MySection.MyDocVersion.DocVersionConfig.RODefaults_graphicsprefix); - } - - if (!deflt.StartsWith("[") && !string.IsNullOrEmpty(roc.value) && roc.value.Trim().Length > 0) // don't return val if it's an empty or blank string - jsj 01-28-2019 - { - roc.value = roc.value.Replace("[xB3]", "\xB3"); - roc.value = roc.value.Replace("[xB2]", "\xB2"); - return roc.value; - } - - return deflt; - } - - private bool _DidHLSText = false; - public bool DidHLSText - { - get { return _DidHLSText; } - set { _DidHLSText = value; } - } - private int _HasHLSTextId = 0; - public int HasHLSTextId - { - get { return _HasHLSTextId; } - set { _HasHLSTextId = value; } - } - private string _HLSText = string.Empty; - public string HLSText - { - get { return _HLSText; } - set - { - if (_HLSText == string.Empty) - _HLSText = value; - } - } - private string _HLSTAB = string.Empty; - public string HLSTAB - { - get { return _HLSTAB; } - set { _HLSTAB = value; } - } - private string _HLRNO = string.Empty; - public string HLRNO - { - get { return _HLRNO; } - set { _HLRNO = value; } - } - private bool _OldTemplateContMsg = false; - public bool OldTemplateContMsg - { - get { return _OldTemplateContMsg; } - set { _OldTemplateContMsg = value; } - } - private float _AdjustTopMarginForMultiLinePageListItems = 0; - public float AdjustTopMarginForMultiLinePageListItems - { - get { return _AdjustTopMarginForMultiLinePageListItems; } - set { _AdjustTopMarginForMultiLinePageListItems = value; } - } - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// true - if token is resolved - /// false - if entire text is processed - /// - private bool ProcessPaglistToken(VEPROMS.CSLA.Library.SectionInfo section, SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, ref VE_Font useFontForCheckOffHeader, ref string plstr, string token, float supInfoMargAdj) - { - bool retval = true; - - //Console.WriteLine("{0} ProcessPagelistToken", token); - // Paglist token inside a PS= conditional are surrounded by square brackets instead of curley - // ex. [BOX3] instead of {BOX3}, thus the redunant looking cases - switch (token) - { - case "{!atom}": - // Add an Atom Figure to the SVG - plstr = plstr.Replace(token, string.Empty); - AddImage(svgGroup, 160.5f, 170.5f, 288f, 323f, "atom.bmp"); - break; - case "{!cpllogo}": - plstr = plstr.Replace(token, string.Empty); - AddImage(svgGroup, 10f, 10f, 78.7f, 29.8f, "cpllogo.bmp"); - break; - //case "{!domlogo}": - // AddImage(svgGroup, 10f, 70f, 123f, 40.1f, "domlogo.bmp"); - // break; - //case "{!gpclogo}": - // AddImage(svgGroup, 10f, 150f, 35.2f, 35.8f, "gpclogo.bmp"); - // break; - case "{HEADER1}": - case "[HEADER1]": - case "{HEADER2}": - case "[HEADER2]": - case "{HEADER3}": - case "[HEADER3]": - case "{HEADER4}": - case "[HEADER4]": - case "{HEADER5}": - case "[HEADER5]": - case "{HEADER6}": - case "[HEADER6]": - case "{HEADER7}": - case "[HEADER7]": - case "{HEADER8}": - case "[HEADER8]": - case "{HEADER9}": - case "[HEADER9]": - case "{HEADER10}": - case "[HEADER10]": - case "{BOX1}": - case "[BOX1]": - case "{BOX2}": - case "[BOX2]": - case "{BOX3}": - case "[BOX3]": - case "{BOX4}": - case "[BOX4]": - case "{BOX5}": - case "[BOX5]": - case "{BOX6}": - case "[BOX6]": - case "{BOX7}": - case "[BOX7]": - case "{BOX8}": - case "[BOX8]": - case "{BOX9}": - case "[BOX9]": - plstr = plstr.Replace(token, string.Empty); - svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(token), supInfoMargAdj)); - break; - case "{PMODEBOX}": // need to set either 1 or 2 depending on number of columns - case "[PMODEBOX]": - string box = "1"; - if (_MySection.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.Four) - box = "4"; - else if (_MySection.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.Three) - box = "3"; - else if (_MySection.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.Two) - box = "2"; - box = "{BOX" + box + "}"; - plstr = plstr.Replace(token, string.Empty); - svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(box), supInfoMargAdj)); - break; - case "{DRAFTPAGE}": - //if (!AllowedWatermarks.Contains("Draft")) AllowedWatermarks.Add("Draft"); -- B2018-124 not needed anymore - plstr = plstr.Replace(token, string.Empty);// Remove token since it is handled now - break; - case "{REFERENCEPAGE}": - //if (!AllowedWatermarks.Contains("Reference")) AllowedWatermarks.Add("Reference"); -- B2018-124 not needed anymore - plstr = plstr.Replace(token, string.Empty);// Remove token since it is handled now - break; - case "{MASTERPAGE}": - //if (!AllowedWatermarks.Contains("Master")) AllowedWatermarks.Add("Master"); -- B2018-124 not needed anymore - plstr = plstr.Replace(token, string.Empty);// Remove token since it is handled now - break; - case "{SAMPLEPAGE}": - //if (!AllowedWatermarks.Contains("Sample")) AllowedWatermarks.Add("Sample"); -- B2018-124 not needed anymore - plstr = plstr.Replace(token, string.Empty);// Remove token since it is handled now - break; - //case "{INFORMATIONPAGE}": - // if (!AllowedWatermarks.Contains("Information Only")) AllowedWatermarks.Add("Information Only"); -- B2018-124 not needed anymore - // break; - case "{PROCTITLE}": - case "[PROCTITLE]": - case "{PROCTITLE1}": - case "[PROCTITLE1]": - case "{PROCTITLE2}": - case "[PROCTITLE2]": - case "{PROCTITLE3}": - case "[PROCTITLE3]": - case "{COVERPROCTITLE}": - case "[COVERPROCTITLE]": - int tlen = (token.Contains("COVERPROCTITLE"))?(int)section.ActiveFormat.PlantFormat.FormatData.ProcData.CoverTitleLength : (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength; - //float linelen = (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength * (float)pageItem.Font.CPI / 12; - float linelen = tlen * (float)pageItem.Font.CPI / 12; - string title = section.MyProcedure.MyContent.Text; - if (title.Contains("") && !section.ActiveFormat.PlantFormat.FormatData.ProcData.PrintNoTitle) - plstr = string.Empty; - else - { - if (section.ActiveFormat.PlantFormat.FormatData.ProcData.CapitalizeTitle) title = title.ToUpper(); - // B2022-035: resolve unit specific designators - // B2024-025 - process all of the applicability token (, , ) - title = VEPROMS.CSLA.Library.DisplayText.ResolveUnitSpecific(section.MyDocVersion, title); - plstr = SplitTitle(svgGroup, pageItem, title, (int)linelen, token, plstr, null); //,rowAdj); - } - break; - case "{COVERTITLE1}": - case "[COVERTITLE1]": - case "{COVERTITLE2}": - case "[COVERTITLE2]": - int ctlen = section.ActiveFormat.PlantFormat.FormatData.ProcData.CoverTitleLength ?? 0; - float coverlinelen = ((ctlen == 0) ? (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength : ctlen) * (float)pageItem.Font.CPI / 12; - string title1 = section.MyProcedure.MyContent.Text; - if (section.ActiveFormat.PlantFormat.FormatData.ProcData.CapitalizeTitle) title1 = title1.ToUpper(); - // F2024-012 copied this line from above (processing COVERPROCTITLE) to resolve unit designators in the procedure title - // B2024-025 - process all of the applicability token (, , ) - title1 = VEPROMS.CSLA.Library.DisplayText.ResolveUnitSpecific(section.MyDocVersion, title1); - plstr = SplitCoverTitle(svgGroup, pageItem, title1, (int)coverlinelen, token, plstr);//, rowAdj); - break; - case "{TITLE&UNIT}": - case "[TITLE&UNIT]": - tlen = (token.Contains("COVERPROCTITLE"))?(int)section.ActiveFormat.PlantFormat.FormatData.ProcData.CoverTitleLength : (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength; - linelen = tlen * (float)pageItem.Font.CPI / 12; - plstr = SplitTitleAndUnit(svgGroup, pageItem, section.MyProcedure.MyContent.Text.ToUpper(), (int)linelen, token, plstr); //,rowAdj); - break; - case "{SPLITEOPNUM}": - case "[SPLITEOPNUM]": - string eopnum1 = section.MyProcedure.MyContent.Number; - string unitnum1 = MySection.MyDocVersion.DocVersionConfig.Unit_ProcedureNumber; - string unitname1 = MySection.MyDocVersion.DocVersionConfig.Unit_Name; - if (unitnum1.Length > 0) - { - if (unitnum1.Contains("#")) - eopnum1 = unitnum1.Replace("#", eopnum1); - if (unitnum1.Contains("!")) - eopnum1 = unitnum1.Replace("!", unitname1); - if (eopnum1 == string.Empty) - eopnum1 = section.MyProcedure.MyContent.Number; - } - plstr = SplitEOPNumber(svgGroup, pageItem, eopnum1, token, plstr); - break; - case "{CM:(Cont)}": - if (OldTemplateContMsg) - plstr = plstr.Replace("{CM:(Cont)}", "(Cont)"); - else - plstr = plstr.Replace("{CM:(Cont)}", string.Empty); - break; - case "{RF:REFERENCE}": - // This token is used by IP2. In 16bit it is processed when the PO_DISTRIBUTEAPPROVED - // purchase option is set and a file 'ref.dat' exists. Text from this file replaced - // the token. It was decided by RHM/KBR on 10/7/14 that this would not be implemented - // unless/until it is determined that it is used (no data that Volian currently has - // contains this file). To implement it requires a config item off of the procedure level, - // user interface support on the Procedure Properties dialog and print support. - plstr = plstr.Replace("{RF:REFERENCE}", string.Empty); - break; - case "{NULLDOCCURPAGE}": - // This token is used by IP2. There was no support for it in 16bit and the 16bit to 32bit - // output compared so it is just removed here so that a pagelist token error is not output - // in error log. - plstr = plstr.Replace("{NULLDOCCURPAGE}", string.Empty); - break; - case "{PDFDate}": - plstr = plstr.Replace("{PDFDate}", DateTime.Now.ToString("MM/dd/yyyy")); - break; - case "{PDFTime}": - plstr = plstr.Replace("{PDFTime}", DateTime.Now.ToString("HH:mm:ss")); - break; - // F2023-087: Added PDFDate at PDFTime - note that cannot have multiple tokens in a conditional because of reg expression - // processing. - case "[PDFDateAtTime]": - plstr = plstr.Replace("[PDFDateAtTime]", DateTime.Now.ToString("MM/dd/yyyy") + " at " + DateTime.Now.ToString("HH:mm:ss")); - break; - case "{EOPNUM}": - case "[EOPNUM]": - case "{PREDELIMEOPNUM}": - case "[PREDELIMEOPNUM]": - case "{EOPNUMROLU}": - case "[EOPNUMROLU]": - string eopnum = section.MyProcedure.MyContent.Number; - string unitnum = MySection.MyDocVersion.DocVersionConfig.Unit_ProcedureNumber; - string unitname = MySection.MyDocVersion.DocVersionConfig.Unit_Name; - if (unitnum.Length > 0) - { - if (unitnum.Contains("#")) - eopnum = unitnum.Replace("#", eopnum); - if (unitnum.Contains("!")) - eopnum = unitnum.Replace("!", unitname); - if (eopnum == string.Empty) - eopnum = section.MyProcedure.MyContent.Number; - - if (eopnum.ToUpper().Contains(@", , , , , , , , - // F2023-078 - for Vogtle Units 3 & 4 Alarms - also remove dash after unit number - eopnum = Regex.Replace(eopnum, @"\(-|\\u8209\?)", string.Empty, RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\", string.Empty, RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)ID)\>(-|\\u8209\?)", string.Empty, RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)NAME)\>(-|\\u8209\?)", string.Empty, RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)TEXT)\>(-|\\u8209\?)", string.Empty, RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)NUMBER)\>(-|\\u8209\?)", string.Empty, RegexOptions.IgnoreCase); - // B2021-148 remove space character after "OTHER" - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)OTHERID)\>(-|\\u8209\?)", string.Empty, RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)OTHERNAME)\>(-|\\u8209\?)", string.Empty, RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)OTHERTEXT)\>(-|\\u8209\?)", string.Empty, RegexOptions.IgnoreCase); - eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)OTHERNUMBER)\>(-|\\u8209\?)", string.Empty, RegexOptions.IgnoreCase); - } - else - eopnum = section.MyProcedure.DisplayNumber;// B2021-066: found and fixed during proc pc/pc work - } - } - // B2022-066 the "{PREDELIMEOPNUM}" token was not being processed because there was a space after the "{" - if (token.Equals("{PREDELIMEOPNUM}")) - { - // only use up to the first non-alphanumeric character of the procedur number - // Prairie Island (NSP) Alarms use this token - int idx = 0; - while (idx < eopnum.Length && char.IsLetterOrDigit(eopnum[idx])) idx++; - if (idx < eopnum.Length) - eopnum = eopnum.Substring(0, idx); - } - - if (pageItem.TrimEnding != null) - eopnum = eopnum.TrimEnd(pageItem.TrimEnding.ToCharArray()); - - plstr = plstr.Replace(token, eopnum); - //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, eopnum))); - //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, section.MyProcedure.MyContent.Number))); - break; - case "{SECTIONLEVELTITLE}": - case "[SECTIONLEVELTITLE]": - case "{ATTACHTITLECONT}": - case "[ATTACHTITLECONT]": - // B2020-038: incorrect pagination: Note that if PSOnlyFirst is active and pagination is set to continuous, pagination may be incorrect in printed output (no code change-just info here in case happens again) - bool printsectlevel = ((pageItem.Justify & VEPROMS.CSLA.Library.E_Justify.PSOnlyFirst) != VEPROMS.CSLA.Library.E_Justify.PSOnlyFirst) || - (((pageItem.Justify & VEPROMS.CSLA.Library.E_Justify.PSOnlyFirst) == VEPROMS.CSLA.Library.E_Justify.PSOnlyFirst) && PrintedSectionPage==0); - // if there is 'no title' for the section, only print it if a format flag says to print it. - if (printsectlevel) - { - if (section.DisplayText.ToUpper().Contains("") && !section.ActiveFormat.PlantFormat.FormatData.ProcData.PrintNoTitle) printsectlevel = false; - } - if (MyPromsPrinter.DoingFacingPage) printsectlevel = false; // don't put out section title/number if doing SAMG facing pages - if (printsectlevel) - { - string stitle = section.DisplayText; - if (((section.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListAddSectCont) == E_DocStructStyle.DSS_PageListAddSectCont) - && token.Contains("ATTACHTITLECONT") && DidFirstPageDocStyle) - { - string myMsg = section.MyDocStyle.Continue.Top.Message; - if (myMsg != null && myMsg != string.Empty)stitle = stitle + myMsg; - } - // B2023-043: Beaver Valley AOP - allow attributes, such as superscript on section titles when printing - if (section.ActiveFormat.PlantFormat.FormatData.PrintData.SectionTitleWithAttributes) - stitle = section.FormattedDisplayText; - // B2021-119: large titles on Landscape Word Attachments are printing on 2 lines. - // B2022-149: crash on cast if null - int? stl = (int?)section.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumberAndTitleLength; - if (section.MyDocStyle.LandscapePageList && section.ActiveFormat.PlantFormat.FormatData.SectData.SectNumAndTlLenLand != null) - stl = section.ActiveFormat.PlantFormat.FormatData.SectData.SectNumAndTlLenLand; - - plstr = SplitTitle(svgGroup, pageItem, stitle, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token, plstr, stl); - if ((pageItem.Justify & VEPROMS.CSLA.Library.E_Justify.PSOnlyFirst) == VEPROMS.CSLA.Library.E_Justify.PSOnlyFirst) // B2020-047 only set PrintedSectionPage if PSOnly is used - PrintedSectionPage = (int)pageItem.Row - _sectLevelNumTtlDiff; - } - else - plstr = plstr.Replace(token, string.Empty); - //svgGroup.Add(PageItemToSvgText(pageItem, section.DisplayText)); - break; - case "{METASECTIONTITLE}": // This will print the top level section title (versus level above current) starting from a sub-section - case "[METASECTIONTITLE]": - if (section.MyParent.IsSection) - { - // get top most section: - ItemInfo top = section; - while (top.MyParent != null && !top.MyParent.IsProcedure) - { - top = top.MyParent; - } - // B2023-043: Beaver Valley AOP - allow attributes, such as superscript on section titles when printing - string tmptitle = (section.ActiveFormat.PlantFormat.FormatData.PrintData.SectionTitleWithAttributes) ? top.FormattedDisplayText : top.DisplayText; - plstr = SplitTitle(svgGroup, pageItem, tmptitle, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token, plstr, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumberAndTitleLength); - } - else - plstr = plstr.Replace(token, string.Empty); - break; - case "{TOPSECTIONTITLE}": // This will print the top level section title - case "[TOPSECTIONTITLE]": - // get top most section: put in for Vogtle Units 3 & 4 formats - { - ItemInfo top = section; - while (top.MyParent != null && !top.MyParent.IsProcedure) - { - top = top.MyParent; - } - // B2024-013 changed to use the FormattedDisplayTextKeepHardReturn instead of display text for the section title - // this gives us to use the hard return that the user placed in the section title - if (top.IsSection) - plstr = SplitTitle(svgGroup, pageItem, top.FormattedDisplayTextKeepHardReturn, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token, plstr, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumberAndTitleLength); - else - plstr = plstr.Replace(token, string.Empty); - } - break; - case "{SECTIONLEVELNUMBER}": - case "[SECTIONLEVELNUMBER]": - // don't put out section title/number if doing SAMG facing pages - if (!MyPromsPrinter.DoingFacingPage) - { - plstr = plstr.Replace(token, section.DisplayNumber); - _sectLevelNumTtlDiff = (int)pageItem.Row; - } - else - plstr = plstr.Replace(token, string.Empty); - // B2020-040: pagelist was {SECTIONLEVELNUMBER}, {SECTIONLEVELTITLE} and if no SECTIONLEVELNUMBER exists, printed - // text starts with a ', ' - remove it. - if (plstr.StartsWith(", ") && plstr.IndexOf("{SECTIONLEVELTITLE}") == 2) - plstr = plstr.Substring(2); - // F2021-075 pagelist was {SECTIONLEVELNUMBER} - {SECTIONLEVELTITLE} and if no SECTIONLEVELNUMBER exists, printed - // text starts with a ' - ' - remove it. - else if (plstr.StartsWith(" - ") && plstr.IndexOf("{SECTIONLEVELTITLE}") == 3) - plstr = plstr.Substring(3); - //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, section.DisplayNumber))); - break; - case "{METASECTIONNUMBER}": // This will print the top level section number when starting from a sub-section - case "[METASECTIONNUMBER]": - if (section.MyParent.IsSection) - { - // get top most section: - ItemInfo top = section; - while (top.MyParent != null && !top.MyParent.IsProcedure) - { - top = top.MyParent; - } - plstr = plstr.Replace(token, top.DisplayNumber); - } - else - plstr = plstr.Replace(token, string.Empty); - break; - case "{TOPSECTIONNUMBER}": // This will print the top level section number - case "[TOPSECTIONNUMBER]": - // get top most section: - { - ItemInfo top = section; - while (top.MyParent != null && !top.MyParent.IsProcedure) - { - top = top.MyParent; - } - if (top.IsSection) - plstr = plstr.Replace(token, top.DisplayNumber); - else - plstr = plstr.Replace(token, string.Empty); - } - break; - case "{UNITTEXT}": - case "[UNITTEXT]": - plstr = plstr.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Text); - //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Text))); - break; - case "{UNITNUMBER}": - case "[UNITNUMBER]": - string unbr = MySection.MyDocVersion.DocVersionConfig.Unit_Number; - if (MySection.ActiveFormat.PlantFormat.FormatData.PrintData.PrintCommonForZeroUnit && unbr == "0") - { - if (String.IsNullOrEmpty(MySection.MyDocStyle.AltMultiUnitWording)) - plstr = "COMMON"; // for Comanche Peak, replace "Unit 0" with "COMMON" - else - plstr = MySection.MyDocStyle.AltMultiUnitWording; // for Comanche Peak Abnormal, replace "Unit 0" with "UNIT 1 AND 2" - } - else - plstr = plstr.Replace(token, unbr); - break; - case "{VCBUNIT}": - case "[VCBUNIT]": - string unbr2 = MySection.MyDocVersion.DocVersionConfig.Unit_Number; - if (unbr2 == "0") - { - if (MySection.MyProcedure.DisplayNumber.StartsWith("VCS") || MySection.MyProcedure.DisplayNumber.StartsWith("MD")) - plstr = "NSBU"; - else if (MySection.MyProcedure.DisplayNumber.StartsWith("VC2")) - plstr = "Unit 2"; - else if (MySection.MyProcedure.DisplayNumber.StartsWith("VC3")) - plstr = "Unit 3"; - else - plstr = "Units 2 & 3"; // for VC Summer, replace "Unit 0" with "Units 2 & 3" - } - else - plstr = plstr.Replace(token, unbr2); - break; - case "{ATTACHNUM}": - case "[ATTACHNUM]": - plstr = plstr.Replace(token, "1"); // used by SHESDD - but 16bit returns '1' unless has format flag 'MoveParensToToken' that was only in SCE (San Onofre) - break; - case "{ATTACHNUM1}": - case "[ATTACHNUM1]": - string numAtt = GetAttachNum1(); - plstr = plstr.Replace(token, numAtt); // used by SHESDD - but 16bit returns '1' unless has format flag 'MoveParensToToken' that was only in SCE (San Onofre) - break; - case "{CHKOFFHEADING}": - case "[CHKOFFHEADING]": - // unfortunately, the font is not stored on the page list item if there is an active - // check off header. It is stored with the checkoff data as defined by user selection - // of the selected header (selection stored in section config). - int sindx = section.CheckOffHeadingIndex(); - VE_Font vf = sindx <= 0 ? pageItem.Font : - section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font; - useFontForCheckOffHeader = vf; - PageListCheckOffHeader = PageItemToSvgText(pageItem, pageItem.Token, vf, section, 0); - break; - case "{HLSTEXT}": - DidHLSText = true; - plstr = plstr.Replace(token, HLSText); - break; - case "{VALTYPE}": - ItemInfo firstHigh = ValveGetFirstStep(section); - if (firstHigh != null) - { - int typ = (int)firstHigh.MyContent.Type - 20000; - switch (typ) - { - case 2: - plstr = plstr.Replace(token, "VALVE"); - break; - case 9: - plstr = plstr.Replace(token, "SWITCH"); - break; - case 3: - plstr = plstr.Replace(token, "BREAKER"); - break; - default: - plstr = plstr.Replace(token, string.Empty); - break; - } - } - else - plstr = plstr.Replace(token, string.Empty); - break; - case "{STARTUP}": - ItemInfo firstHighs = ValveGetFirstStep(section); - if (firstHighs != null) - { - int typs = (int)firstHighs.MyContent.Type - 20000; - switch (typs) - { - case 2: - // the following test for OI-3A came from 16bit code: - string num = section.MyProcedure.MyContent.Number.ToUpper().Replace(@"\U8209?", "-"); - if (num.Equals("OI-3A")) - plstr = plstr.Replace(token, " SDC/"); - else - plstr = plstr.Replace(token, "STARTUP/"); - break; - default: - plstr = plstr.Replace(token, string.Empty); - break; - } - } - else - plstr = plstr.Replace(token, string.Empty); - break; - case "{PROCDES}": - ProcDescrList pdl = section.ActiveFormat.PlantFormat.FormatData.PrintData.ProcDescrList; - if (pdl != null && pdl.Count > 0) - { - string procnum = section.MyProcedure.MyContent.Number.Replace(@"\u8209?", "-").Replace(@"\u9586?", @"\"); - foreach (ProcDescr pd in pdl) - { - if (pd.MatchProcNumber != null) - { - string matchStr = (pd.MatchProcNumber.StartsWith("*}")) ? pd.MatchProcNumber.Substring(2) : pd.MatchProcNumber; - if (procnum.Contains(matchStr)) - { - if (pd.ProcDescr1 == "{null}") // used to override fmt file inheritance & set null/empty string - plstr = string.Empty; - else - plstr = pd.ProcDescr1; - break; - } - if (pd.MatchProcNumber == "@") - { - // 16bit code looked like it only checked for the first character, but this code looks at - // all characters. It was not working correctly for BGE. Didn't want to change it for other - // plants that have been delivered - so added special code for BGE. - if (section.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) - { - if (Regex.IsMatch(procnum.Substring(0,1),"[A-Za-z]")) - plstr = pd.ProcDescr1; - else - plstr = string.Empty; - break; - } - if (Regex.IsMatch(procnum, "^[A-Za-z]+$")) - plstr = pd.ProcDescr1; - else - plstr = string.Empty; - break; - } - } - else - plstr = "UNKNOWN"; - } - } - break; - case "{PROCDES2}": - ProcDescrList pdl2 = section.ActiveFormat.PlantFormat.FormatData.PrintData.ProcDescrList; - if (pdl2 != null && pdl2.Count > 0) - { - string procnum = section.MyProcedure.MyContent.Number.Replace(@"\u8209?", "-").Replace(@"\u9586?", @"\"); - foreach (ProcDescr pd in pdl2) - { - if (pd.MatchProcNumber != null) - { - string matchStr = (pd.MatchProcNumber.StartsWith("*}")) ? pd.MatchProcNumber.Substring(2) : pd.MatchProcNumber; - if (procnum.Contains(matchStr)) - { - plstr = pd.ProcDescr2; - break; - } - if (pd.MatchProcNumber == "@") - { - if (Regex.IsMatch(procnum, "^[A-Za-z]+$")) - plstr = pd.ProcDescr2; - else - plstr = string.Empty; - break; - } - } - else - plstr = "UNKNOWN"; - } - } - break; - case "{CURDATE}": - DateTime thisDate1 = DateTime.Today; - plstr = plstr.Replace(token, thisDate1.ToString("MMMM dd, yyyy")); - break; - case "{CURTIME}": - DateTime thisDate2 = DateTime.Now; - plstr = plstr.Replace(token, thisDate2.ToString("H:mm")); - break; - case "{HLRNO}": - plstr = HLRNO==null?string.Empty:plstr.Replace(token, HLRNO); - break; - case "{HLSTAB}": - if (HLSTAB.Contains("{!Clock}")) // F2022-024 replace with the clock symbol defined in GenMac format file - { - HLSTAB = HLSTAB.Replace("{!Clock}",string.Empty).TrimStart(" ".ToCharArray()); - svgGroup.Add(PageItemToSvgUse(pageItem, "Clock", supInfoMargAdj)); - } - plstr = plstr.Replace(token, HLSTAB); - break; - case "{UNITALPHA}": - // copied from 16bit's pagelist.cs for BGE: - string unitnm = MySection.MyDocVersion.DocVersionConfig.Print_UnitNumberForPageList; - if (unitnm == "1") - plstr = plstr.Replace(token, "ONE"); - else if (unitnm == "2") - plstr = plstr.Replace(token, "TWO"); - else - plstr = plstr.Replace(token, "ONE AND TWO"); - break; - case "{INITIALS}": - // For Calvert: if this section has checkoffs turned on, put out this pagelist item: - // Get SectionInfos to access specific section config items... - //SectionInfo si = SectionInfo.Get(MySection.ItemID); - //SectionInfo si = MySection.GetSectionInfo(); - //SectionConfig sectCfg = si.MyConfig as SectionConfig; - //int sc = sectCfg.Section_CheckoffListSelection; - if (!MySection.HasInitials) - { - plstr = plstr.Replace(token, string.Empty); - //PIInitials = pageItem; - } - else - { - if (pageItem.Row == -MySection.MyDocStyle.Layout.TopMargin) - { - plstr = plstr.Replace(token, string.Empty); - PIInitials = pageItem; - } - else - plstr = plstr.Replace(token, "INITIALS"); - } - break; - case "{REVUNIT}": - // copied from 16bit's pagelist.cs for BGE: - string revUnit = null; - string unitNum = MySection.MyDocVersion.DocVersionConfig.Print_UnitNumberForPageList; - if (Rev != null && Rev != string.Empty) - { - revUnit = Rev; - int indxs = Rev.IndexOf(MySection.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash ? '\\' : '/'); - if (indxs > 0) revUnit = Rev.Substring(0, indxs); - } - else - revUnit = " "; - - if (unitNum == "2") - revUnit += "/Unit 2"; - else if (unitNum == "1") - revUnit += "/Unit 1"; - plstr = plstr.Replace(token, revUnit); - break; - case "[UNIT]": - string un = MySection.MyDocVersion.DocVersionConfig.Print_UnitNumberForPageList; - plstr = plstr.Replace(token, un); - break; - case "{MCRSERNUM}": // B2021-127: BNPPalr - Auto set of serial # - int sernum = section.MyProcedure.Ordinal - VlnSvgPageHelper.CountInApplProcs; - plstr = plstr.Replace(token, sernum.ToString()); - break; - default: - if (token.Contains(@"SI-")) // procedure set specific information. (at folder or working draft levels) - { - DocVersionConfig dvConfig = new DocVersionConfig(section.MyProcedure.MyDocVersion.Config); - FolderConfig folderConfig = new FolderConfig(section.MyProcedure.MyDocVersion.MyFolder.Config); - if (dvConfig != null || folderConfig != null) - { - int indx = token.IndexOf("-"); - int qindx = token.IndexOf("?", indx); - string val = null; - if (qindx == -1) - { - val = DocVersionInfo.GetInheritedSIValue(section.MyProcedure, token.Substring(4, token.Length - 5)); - // C2021-051: Applicability tokens in Procedure Set and Folder Specific Information - if (val.ToUpper().Contains("") || val.ToUpper().Contains("") || val.ToUpper().Contains("') - if(val.ToUpper().Contains("") || val.ToUpper().Contains(" 0 || (pageItem.MaxWidthCurPage ?? 0) > 0) - { - int locwid = ((pageItem.MaxWidth??0)>0)?(int)pageItem.MaxWidth:(int)pageItem.MaxWidthCurPage; - AdjustTopMarginForMultiLinePageListItems = SplitTextMaxWidth(svgGroup, pageItem, val, locwid, token, ref plstr); - if ((pageItem.MaxWidthCurPage ?? 0) > 0) AdjustTopMarginForMultiLinePageListItems = 0; - } - else - plstr = plstr.Replace(token, val); - //svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection)); - } - else - { - string pstok = token.Substring(indx + 1, qindx - indx - 1); - plstr = procConfig.GetValue("PSI", pstok); - // the first part of the string between the ? and ' ' is the other logical - // to see if it's on. If on, just use col and/or row as defined. Otherwise use - // value between = and |. - int sindx2 = token.IndexOf(" ", qindx); - string logcheck = token.Substring(qindx + 1, sindx2 - qindx - 1); - if (PgLogicals.ContainsKey(logcheck)) - { - int bindx = token.IndexOf("|", indx); - string newval = token.Substring(sindx2 + 1, bindx - sindx2 - 1); - float col = pageItem.Col ?? 0; - if (newval.ToUpper().Contains("COL")) - { - col = System.Convert.ToInt32(newval.Substring(4)); - } - svgGroup.Add(PageItemToSvgText(pageItem.Token, pageItem.Row ?? 0, col, pageItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft, pageItem.Font, plstr, MySection)); - plstr = string.Empty; // clear so it doesn't get added twice, i.e. in the method that calls this. - } - } - } - } - else - { - if (plstr != string.Empty) - { - svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection, supInfoMargAdj)); - plstr = string.Empty; - } - //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token)); - } - //_MyLog.InfoFormat("Token not processed {0}", token); - if (plstr == string.Empty) retval = false; - break; - } - return retval; - } - // F2021-034: Resolve applicability unit tokens (not just '') - private string ResolveUnitApp(DocVersionInfo dvi, string str) - { - if (dvi == null) return str; - // B2024-025 - process all of the applicability token (, , ) - str = VEPROMS.CSLA.Library.DisplayText.ResolveUnitSpecific(dvi, str); - // look for un-resolved tokens and replace less/greater than chars with "*?" and "?*" respectively - string tmp = str.ToUpper(); - int sindx = tmp.IndexOf("", sindx + 1); - string reptmp; - while (sindx > -1 && eindx > -1) // B2022-007 added while loop to process more than one ", "?*")); - tmp = str.ToUpper(); - sindx = tmp.IndexOf("", sindx + 1); - } - //string tmp = str.ToUpper(); - //int sindx = tmp.IndexOf("", sindx + 1); - //string reptmp; - //while (sindx > -1 && eindx > -1) // B2022-007 added while loop to process more than one ") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Number); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Text); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Number); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Name); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_ID); - // // B2021-145: For applicability, the tree view & pdf file name are not getting resolved when using any of the ‘OTHER’ tokens - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Text); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Number); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Name); - // else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_ID); - // else str = str.Replace(reptmp, tmp.Replace("<", "*?").Replace(">", "?*")); - // tmp = str.ToUpper(); - // sindx = tmp.IndexOf("", sindx + 1); - //} - return str; - } - // B2019-076: moved the following to DocVersionExt.cs to make it available to transitionext.cs code. - //private string GetInheritedSIValue(ProcedureInfo pi, string fieldName) - //{ - // string val = null; - // DocVersionConfig dvConfig = new DocVersionConfig(pi.MyDocVersion.Config); - // if (dvConfig != null) - // { - // val = dvConfig.GetValue("SI", fieldName); - // if (val != null && val != string.Empty) return val; // the value exists within the docversion level - // } - // FolderInfo fi = pi.MyDocVersion.MyFolder; - // while (fi != null) - // { - // FolderConfig folderConfig = new FolderConfig(fi.Config); - // if (folderConfig != null) - // { - // val = folderConfig.GetValue("SI", fieldName); - // if (val != null && val != string.Empty) return val; // the value exists within this folder - // } - // fi = fi.ActiveParent as FolderInfo; - // } - // return val; - //} - private static ItemInfo ValveGetFirstStep(VEPROMS.CSLA.Library.SectionInfo section) - { - ItemInfo firstHigh = null; - if (section.Steps == null || section.Steps.Count == 0) - { - // see if there is a 1st subsection with a step. The formats must match - // if this is true, use that step. Otherwise just clear the token. - if (section.Sections != null && section.Sections.Count > 0 && - section.Sections[0].Steps != null || section.Sections[0].Steps.Count != 0) - { - if (section.ActiveFormat.FormatID == section.Sections[0].ActiveFormat.FormatID && - section.MyContent.Type == section.Sections[0].MyContent.Type) - firstHigh = section.Sections[0].Steps[0]; - } - } - else - firstHigh = section.Steps[0]; - return firstHigh; - } - - private string GetAttachNum1() - { - int cnt = 0; - SectionInfo si = MySection; - while (si != null) - { - if (si.MyContent.Type == MySection.MyContent.Type) cnt++; - si = si.MyPrevious as SectionInfo; - } - return cnt.ToString(); - } - private static void AddImage(SvgGroup svgGroup, float x, float y, float w, float h, string figure) - { - svgGroup.Add(new SvgImage(new System.Drawing.PointF(x, y), new System.Drawing.SizeF(w, h), - System.Windows.Forms.Application.StartupPath + @"\Resources\" + figure)); - } - private float SplitTextMaxWidth(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match, ref string plstr) - { - List titleLines = Volian.Base.Library.RtfTools.SplitText(title, (int)len); - float yOffset = 0; - int cnt = 0; - foreach (string line in titleLines) - { - cnt++; - if (cnt == 1 && yOffset == 0) - plstr = plstr.Replace(match, line); - else - { - if (cnt == 1) - { - plstr = plstr.Replace(match, line); // include preceeding text with the first line v.c. summer - svgGroup.Add(PageItemToSvgText(pageItem, plstr, yOffset)); - plstr = string.Empty; - } - else - svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset)); - plstr = plstr.Replace(match, string.Empty); - } - yOffset += (float)((pageItem.Font.Size > 14) ? pageItem.Font.Size : 12); - } - return Math.Max(0, yOffset); - } - private string SplitTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match, string plstr,int? numAndTitleLen) - { - bool includePrecedingText = false; - if (match == "{PROCTITLE2}" || match == "[PROCTITLE2]") return plstr.Replace(match, string.Empty); - // F2017-013 - Ginna (RGESAM1) this handles when you have {SECTIONLEVELNUMBER} and {SECTIONLEVELTITLE} on the same line. - // The section number was already replaced in plstr so when determining where to split the title, - // include the section number (and anything before the title) in the calculation of where to split. - // test for the ussage of the SectionNumberAndTitleLength (numAndTitleLen parameter) format variable (use a flag for this logic) - // This logic does not handle any pagelist tokens following the section title. - // "@@" acts like a hanging indent (Calvert) so don't include stuff before the title - // For now, made this explicite with the use of SectionLevelTitle - if ((numAndTitleLen != null && numAndTitleLen > 0) && !plstr.Contains("@@") && (plstr.IndexOf("{SECTIONLEVELTITLE}") > 0)) - { - int idx = plstr.IndexOf(match); - title = plstr.Replace(match, title); // include everthing on this line for splitting - plstr = plstr.Substring(idx); // since title include everthing before {SECTIONLEVELTITLE} plstr needs to be {SECTIONLEVELTITLE} and everything after it - includePrecedingText = true; - } - // check to see if the title needs to wrap - if ((len == null || len == 0 || ItemInfo.StripRtfFormatting(title).Length < len) && (!includePrecedingText || ItemInfo.StripRtfFormatting(title).Length < numAndTitleLen)) - { - // B2022-061: don't print '\line' as part of procedure title in pagelist items. - if (match == "{PROCTITLE}") title = title.Replace("\\line ", string.Empty); - if (match == "{PROCTITLE2}" || match == "[PROCTITLE2]") return plstr.Replace(match, string.Empty); // this would have been done in proctitle1 - plstr = plstr.Replace(match, title).Replace("@@",string.Empty); - //svgGroup.Add(PageItemToSvgText(pageItem, title)); - return plstr; - } - - // BGE has a '@@' in its section number/title pagelist item for eops. If the title goes onto two lines, - // the '@@' marked the starting location for the title. Process this differently than other split titles: - if (plstr.Contains("@@")) - { - DoSpecialSectNumTitle(svgGroup, pageItem, title, len, match, plstr); - return string.Empty; // all resolved pagelist items were already added to svgGroup for printing. - } - // Otherwise determine how many line to split the text into - ListtitleLines = Volian.Base.Library.RtfTools.SplitText(title,(includePrecedingText)?(int)numAndTitleLen: (int)len); - - // Adjust y location based on which pagelist token & how many lines. Proctitle1 is adjusted if - // there are more than 2 lines (proctitle1 should have it's own y location that is used if there are 1 or 2 lines.) - float yOffset = (pageItem.Token.Contains("1") && titleLines.Count <= 2) ? 0 : (-6 * (titleLines.Count - 1)); - - // the following was added to support the vcb format proctitles that should always start on the line defined and - // move down the page for additional lines (this was added to handle a 3 line title printing abouve the border) - if (pageItem.Token.Contains("3")) yOffset = 0; - int cnt = 0; - - // if the title broke into two lines & proctitle1 & proctitle2 are on the same line, handle that - // and return the string: - if (titleLines.Count == 2 && pageItem.Token.Contains("1") && pageItem.Token.Contains("2")) - { - plstr = plstr.Replace("{PROCTITLE1}", titleLines[0]); - plstr = plstr.Replace("[PROCTITLE1]", titleLines[0]); - plstr = plstr.Replace("{PROCTITLE2}", titleLines[1]); - plstr = plstr.Replace("[PROCTITLE2]", titleLines[1]); - return plstr; - } - foreach (string line in titleLines) - { - cnt++; - if (cnt == 1 && yOffset == 0) // adj == 0 means we use PROCTITLE1/PROCTITLE2 pagelist tokens with 2 or less lines - plstr = plstr.Replace(match, line); - else - { - if (cnt == 1) - { - plstr = plstr.Replace(match, line); // include preceeding text with the first line v.c. summer - svgGroup.Add(PageItemToSvgText(pageItem, plstr, yOffset)); - plstr = string.Empty; - } - else - svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset)); - plstr = plstr.Replace(match, string.Empty); - } - yOffset += (float)((pageItem.Font.Size > 14) ? pageItem.Font.Size : 12); - } - return plstr; - } - private PageItem _PIInitials = null; - public PageItem PIInitials - { - get { return _PIInitials; } - set - { - if (_PIInitials != null && value == null) - _LastPIInitials = _PIInitials; - _PIInitials = value; - } - } - private PageItem _LastPIInitials = null; - public PageItem LastPIInitials - { - get { return _LastPIInitials; } - set { _LastPIInitials = value; } - } - private bool _HasInitials = false; - public bool HasInitials - { - get { return _HasInitials; } - set { _HasInitials = value; } - } - private bool _InitialsPrinted = false; - public bool InitialsPrinted - { - get { return _InitialsPrinted; } - set { _InitialsPrinted = value; } - } - public bool PrintInitials(PdfContentByte cb,float yLocation, float leftMargin) - { - if (InitialsPrinted) return false; - InitialsPrinted = true; - vlnParagraph.TextAt(cb,this, PIInitials ?? LastPIInitials, yLocation, leftMargin); - return true; - } - private void DoSpecialSectNumTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match, string plstr) - { - // first add anything up to the "@@" to the svgGroup: - string befAts = plstr.Substring(0, plstr.IndexOf("@@")); - svgGroup.Add(PageItemToSvgText(pageItem, befAts, 0)); - - // get the new xoffset. This will be the column value + the size of 'stuff' before the '@@' - float xoff = (float)pageItem.Col; - xoff += (befAts.Length * pageItem.Font.CharsToTwips); - - float yoff = (float)pageItem.Row; - - List titleLines = Volian.Base.Library.RtfTools.SplitText(title, (int)len); - foreach (string line in titleLines) - { - svgGroup.Add(PageItemToSvgText(pageItem.Token, yoff, xoff, (E_Justify)pageItem.Justify, pageItem.Font, line, MySection)); - yoff += (float)((pageItem.Font.Size > 14) ? pageItem.Font.Size : 12); - } - } - private string SplitTitleAndUnit(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string token, string plstr) - { - List titleLines = Volian.Base.Library.RtfTools.SplitText(title, (int)len); - // Add a separate line with the Unit Number - titleLines.Add("UNIT " + MySection.MyDocVersion.DocVersionConfig.Unit_Number); - // Adjust y location based on which pagelist token & how many lines. - float yOffset = (-6 * (titleLines.Count - 1)); - foreach (string line in titleLines) - { - svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset)); - yOffset += (float)((pageItem.Font.Size > 14) ? pageItem.Font.Size : 12); - } - return plstr.Replace(token, string.Empty); - } - private string SplitEOPNumber(SvgGroup svgGroup, PageItem pageItem, string eopnum, string token, string plstr) - { - string[] eopnums = eopnum.Split(" ".ToCharArray()); - float yOffset = (-6 * (eopnums.Length - 1)); - foreach (string line in eopnums) - { - svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset)); - yOffset += (float)((pageItem.Font.Size > 14) ? pageItem.Font.Size : 12); - } - return plstr.Replace(token, string.Empty); - } - //private string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab - //// add symbol characters as needed - //// "\u25CF" - solid bullet - //// \x0394 - delta - //private float GetTextWidth(VE_Font vefont, string txt, string symblFontName) - //{ - // 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); - // iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); - // iTextSharp.text.Font iSymblFont = Volian.Svg.Library.VolianPdf.GetFont(symbFont); - // float w = 0; - // foreach (char c in txt) - // { - // int idx = symblsStr.IndexOf(c); - // if (idx >= 0) // symbol character - use symbol font to find its width - // w += iSymblFont.BaseFont.GetWidthPointKerned(symblsStr[idx].ToString(), (float)vefont.Size); - // else - // w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)vefont.Size); - // } - // //float w = iFont.BaseFont.GetWidthPointKerned(Text.Replace("\u25CF","@"), (float)vefont.Size); - // return w; - //} - - private string SplitCoverTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match, string plstr) - { - if (len == null || ItemInfo.StripRtfFormatting(title).Length < len) - { - if (match == "{COVERTITLE2}" || match == "[COVERTITLE2]") return plstr; // this would have been done in COVERTITLE1 - plstr = plstr.Replace(match, title); - //svgGroup.Add(PageItemToSvgText(pageItem, title)); - return plstr; - } - // Otherwise determine how many line to split the text into - List titleLines = Volian.Base.Library.RtfTools.SplitText(title, (int)len); - if (match == "{COVERTITLE1}" || match == "[COVERTITLE1]") - { - plstr = plstr.Replace(match, titleLines[0]); - //svgGroup.Add(PageItemToSvgText(pageItem, titleLines[0])); - return plstr; - } - // if the token was proctitle, dont' adjust. If the token was PROCTITLE1/2 then - // move down 6. -// int adj = pageItem.Token.Contains("1") || pageItem.Token.Contains("2") ? 0 : -6; - int adj = (titleLines.Count > 2) ? -6 : 0; - float yOffset = adj * (titleLines.Count - 2); - int lnCnt = 0; - foreach (string line in titleLines) - { - lnCnt++; - if (lnCnt == 1) continue; - plstr = plstr.Replace(match, line); - svgGroup.Add(PageItemToSvgText(pageItem, plstr, yOffset)); - plstr = string.Empty; // clear it because it was added into the list in the line above this, i.e. don't duplicate - yOffset += 12; - } - return plstr; - } - private int FindWidth(string title, int start, int len) - { - for (int ii = start + len; ii > start; ii--) - { - if (title[ii] == ' ') - { - while (title[ii] == ' ') ii--; - if (ii > start) - return 2 + ii - start; - return len; - } - } - return len; - } - private SvgPart PageItemToSvgUse(VEPROMS.CSLA.Library.PageItem pageItem, string templateName, float supmargadj) - { - SvgUse svgUse = new SvgUse(); - svgUse.UseID = templateName; - svgUse.X = new SvgMeasurement((float)(pageItem.Col ?? 0) + supmargadj, E_MeasurementUnits.PT); // F2023-035: Add in supplemental info margin adjust - svgUse.Y = new SvgMeasurement((float)(pageItem.Row ?? 0), E_MeasurementUnits.PT); - return svgUse; - } - private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, VE_Font font, SectionInfo mySection, float supmargadj) - { - SvgText svgText = PageItemToSvgText(pageItem, text, mySection, supmargadj); - svgText.Font = font.WindowsFont; - return svgText; - } - private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, SectionInfo mySection, float supmargadj) - { - SvgText svgText = new SvgText(); - // F2021-053: Do replace words for Page List items. Send format items down to svgtext. - SvgText.CompressSuper = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSuper; - SvgText.CompressSub = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSub; - SvgText.CompressPropSubSup = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressPropSubSup; - svgText.Text = text; - // F2023-039 logic to specify a color when printing a paglist line - if (pageItem.TextColor != null && pageItem.TextColor != "") - svgText.FillColor = System.Drawing.Color.FromName(pageItem.TextColor);// System.Drawing.Color.Red; - VEPROMS.CSLA.Library.E_Justify justify = pageItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft; - float colAdj16bit = 0; - if ((justify & VEPROMS.CSLA.Library.E_Justify.PSLeft) == VEPROMS.CSLA.Library.E_Justify.PSLeft) - svgText.Justify = SvgJustify.Left; - else if ((justify & VEPROMS.CSLA.Library.E_Justify.PSRight) == VEPROMS.CSLA.Library.E_Justify.PSRight) - svgText.Justify = SvgJustify.Right; - else - { - svgText.Justify = SvgJustify.Center; - if (((justify & VEPROMS.CSLA.Library.E_Justify.PSTrue) != VEPROMS.CSLA.Library.E_Justify.PSTrue) && - !mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PicaIgnoreFiveSixths) - { - // the default CPI for Proms is 12, in 16bit 12 is the default - if a font wasn't defined - // or when doing a positioning calculation 12 was used. So we need to make an adjustment - // to handle non-12 CPI (12CPI will just cancel out in the following calculation). - - // Take the difference between the width in Points of a character at 12CPI and a character - // at the defined font's CPI. Multiply that times the length of title and divide by two - // to find the half-way point. - - // if the PageItem's font CPI is null, then default to 12 CPI - colAdj16bit = (1 + text.Length) * ((72 / (float)(pageItem.Font.CPI ?? 12)) - (72 / 12)) / 2; - } - } - svgText.Font = pageItem.Font.WindowsFont; - // F2021-070 & 066 - shrink font size of page list items if format has amount - string tmpText = text; - if (pageItem.FontShrinkAftLen != null && pageItem.FontShrinkAftLen > 0) - svgText.FontSize = ShrinkIt(ref tmpText, svgText, (float)pageItem.FontShrinkAftLen, pageItem.FontTooSmallMsg); - if (tmpText != text) svgText.Text = tmpText; - float row = (float)pageItem.Row < 0 ? -(float)pageItem.Row : (float)pageItem.Row; - if ((justify & VEPROMS.CSLA.Library.E_Justify.PSTop) == VEPROMS.CSLA.Library.E_Justify.PSTop) row -= ((72 / 6) / 2); - float lcol = pageItem.Col ?? 0; - - // the column may need adjusted based on the document styles PageWidth. This was done in - // the 16bit code and was needed here to get the printed output to match. - if (pageItem.Font.FontIsProportional() && svgText.Justify == SvgJustify.Center) - { - int dotsPerChar = (int)(2400 / (mySection.MyDocStyle.Layout.PageWidth / 6)); - lcol = (lcol * 25) / dotsPerChar; - } - // F2023-035: WCN - allow for change in left margin for supplemental information pages by - // setting a value in the DocStyle for the adjustment. - svgText.X = new SvgMeasurement((float)lcol - colAdj16bit + supmargadj, E_MeasurementUnits.PT); // F2023-035: Add in supplemental info margin adjust - svgText.Y = new SvgMeasurement(row, E_MeasurementUnits.PT); - if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine(" PL x {0} y {1} {2} {3} {4} \"{5}\"", svgText.X, svgText.Y, svgText.FontFamily, svgText.FontSize, svgText.SVGFontStyle, TextForBaseline.FixText(svgText.Text)); - return svgText; - } - // F2021-070 & 066 - shrink font size of page list items if format has amount. ShrinkIt compares size (width) of text with input font and - // will decrement font size by one until the text size is less than value from format file. - // Additional work has been done for F2021-066 to allow for only shrinking to font size greater/equal to 8 and if it goes smaller than that - // to put out a message. - private static string ShrinkIt(ref string text, SvgText svgText, float fontShrinkAftLen, string reptext) - { - int tmpi = Convert.ToInt32(svgText.FontSize.Substring(0, svgText.FontSize.IndexOf("PT"))); - string origFontSize = svgText.FontSize; - using (var image = new System.Drawing.Bitmap(1, 1)) - { - using (var g = System.Drawing.Graphics.FromImage(image)) - { - try - { - // pageitem's font size did not have a 'set'. svgtext's fontsize is in format of 12PT, so get font size from that - // and decrement until it is less than format value - System.Drawing.SizeF mySize = g.MeasureString(text, svgText.Font); - while (mySize.Width > fontShrinkAftLen && tmpi > 8) - { - tmpi = tmpi - 1; - svgText.FontSize = tmpi.ToString() + "PT"; - mySize = g.MeasureString(text, svgText.Font); - - } - // Additional work for F2021-066: if font size goes less than or equal to 6, use original font size & if - // there is a message in format file to use instead of text, then use it. - if (tmpi == 8 && mySize.Width > fontShrinkAftLen) - { - if (reptext != null && reptext != string.Empty) - text = reptext; - else // As per PAL (11/15/21) have default message and highlight by italics (text was already bolded) - { - text = "Text Too Long To Fit"; - svgText.SVGFontStyle = "italic"; - } - svgText.FontSize = origFontSize; - } - } - catch // don't reset if error occurred. - { - } - } - } - return svgText.FontSize; - } - private SvgPart PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, float yOffset) - { - SvgText svgText = new SvgText(); - svgText.Text = text; - VEPROMS.CSLA.Library.E_Justify justify = pageItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft; - float colAdj16bit = 0; - if ((justify & VEPROMS.CSLA.Library.E_Justify.PSLeft) == VEPROMS.CSLA.Library.E_Justify.PSLeft) - svgText.Justify = SvgJustify.Left; - else if ((justify & VEPROMS.CSLA.Library.E_Justify.PSRight) == VEPROMS.CSLA.Library.E_Justify.PSRight) - svgText.Justify = SvgJustify.Right; - else - { - svgText.Justify = SvgJustify.Center; - if (((justify & VEPROMS.CSLA.Library.E_Justify.PSTrue) != VEPROMS.CSLA.Library.E_Justify.PSTrue) && - !MySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PicaIgnoreFiveSixths) - { - // the default CPI for Proms is 12, in 16bit 12 is the default - if a font wasn't defined - // or when doing a positioning calculation 12 was used. So we need to make an adjustment - // to handle non-12 CPI (12CPI will just cancel out in the following calculation). - - // Take the difference between the width in Points of a character at 12CPI and a character - // at the defined font's CPI. Multiply that times the length of title and divide by two - // to find the half-way point. - colAdj16bit = (1 + text.Length) * ((72 / (float)pageItem.Font.CPI) - (72 / 12)) / 2; - } - } - float lcol = pageItem.Col ?? 0; - - // the column may need adjusted based on the document styles PageWidth. This was done in - // the 16bit code and was needed here to get the printed output to match. - if (pageItem.Font.FontIsProportional() && svgText.Justify == SvgJustify.Center) - { - int dotsPerChar = (int)(2400 / (MySection.MyDocStyle.Layout.PageWidth / 6)); - lcol = (lcol * 25) / dotsPerChar; - } - svgText.Font = pageItem.Font.WindowsFont; - svgText.X = new SvgMeasurement((float)lcol - colAdj16bit, E_MeasurementUnits.PT); // new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT); - svgText.Y = new SvgMeasurement((float)(yOffset + pageItem.Row ?? 0), E_MeasurementUnits.PT); - if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine(" PL x {0} y {1} {2} {3} {4} \"{5}\"", svgText.X, svgText.Y, svgText.FontFamily, svgText.FontSize, svgText.SVGFontStyle, TextForBaseline.FixText(svgText.Text)); - return svgText; - } - private SvgPart PageItemToSvgText(string token, float row, float col, E_Justify just, VE_Font font, string text, SectionInfo MySection) - { - SvgText svgText = new SvgText(); - svgText.Text = text; - VEPROMS.CSLA.Library.E_Justify justify = just; - float colAdj16bit = 0; - if ((justify & VEPROMS.CSLA.Library.E_Justify.PSLeft) == VEPROMS.CSLA.Library.E_Justify.PSLeft) - svgText.Justify = SvgJustify.Left; - else if ((justify & VEPROMS.CSLA.Library.E_Justify.PSRight) == VEPROMS.CSLA.Library.E_Justify.PSRight) - svgText.Justify = SvgJustify.Right; - else - { - svgText.Justify = SvgJustify.Center; - if (((justify & VEPROMS.CSLA.Library.E_Justify.PSTrue) != VEPROMS.CSLA.Library.E_Justify.PSTrue) && - !MySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PicaIgnoreFiveSixths) - { - // the default CPI for Proms is 12, in 16bit 12 is the default - if a font wasn't defined - // or when doing a positioning calculation 12 was used. So we need to make an adjustment - // to handle non-12 CPI (12CPI will just cancel out in the following calculation). - - // Take the difference between the width in Points of a character at 12CPI and a character - // at the defined font's CPI. Multiply that times the length of title and divide by two - // to find the half-way point. - colAdj16bit = (1 + text.Length) * ((72 / (float)font.CPI) - (72 / 12)) / 2; - } - } - float lcol = col; - - // the column may need adjusted based on the document styles PageWidth. This was done in - // the 16bit code and was needed here to get the printed output to match. - if (font.FontIsProportional() && svgText.Justify == SvgJustify.Center) - { - int dotsPerChar = (int)(2400 / (MySection.MyDocStyle.Layout.PageWidth / 6)); - lcol = (lcol * 25) / dotsPerChar; - } - // F2021-053: Do replace words for Page List items. Send format items down to svgtext. - SvgText.CompressSuper = MySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSuper; - SvgText.CompressSub = MySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSub; - SvgText.CompressPropSubSup = MySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressPropSubSup; - svgText.Font = font.WindowsFont; - svgText.X = new SvgMeasurement((float)lcol - colAdj16bit, E_MeasurementUnits.PT); // new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT); - svgText.Y = new SvgMeasurement(row, E_MeasurementUnits.PT); - if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine(" PL x {0} y {1} {2} {3} {4} \"{5}\"", svgText.X, svgText.Y, svgText.FontFamily, svgText.FontSize, svgText.SVGFontStyle, TextForBaseline.FixText(svgText.Text)); - return svgText; - } - private static List _MissingTokens = new List(); - protected override string ReplacePageListToken(Match match) - { - switch (match.Value) - { - case "{PAGE}": // Current Page Number - return CurrentPageNumber.ToString(); - case "{OF}": // Total Page Count for this section - return CurrentPageOf.ToString(); - case "{REV}": // Revision Number and/or Revision string. - case "{REV2}": - // The 16bit code has a revision number & then a revision date. This revision date - // was actually either a date OR a string. The 32bit code no longer will call this - // token or string RevDate. HLP procs & stpdif show the different types of data - // that are used. - - // 16-bit had code to string preceeding blanks. - if (Rev != null && Rev != string.Empty) Rev = Rev.TrimStart(" ".ToCharArray()); - - // Now check the format flags to determine if/how the Rev string should be parsed. - if ((MySection.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate && Rev.Contains("/")) - || (MySection.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash && Rev.Contains("\\"))) - { - int indx = Rev.IndexOf(MySection.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash ? '\\' : '/'); - if (match.Value == "{REV}") return Rev.Substring(0,indx); - return Rev.Substring(indx+1); - } - if (match.Value == "{REV}")return Rev; - return System.DateTime.Today.ToShortDateString(); - case "{CHKOFFHEADING}": - return PageListTopCheckOffHeader; - case "{ROMANPAGE}": - return ItemInfo.RomanNumbering(CurrentPageNumber).ToLower(); - case "{SETREV}": - return MySection.MyDocVersion.DocVersionConfig.ProcedureSetRev; - case "{NULLDOCCURPAGE}": - return string.Empty; - } - if (!_MissingTokens.Contains(match.Value)) - { - _MissingTokens.Add(match.Value); - _MyLog.InfoFormat("Unhandled token {0}", match.Value); - } - return string.Empty; - } - } - public class ChkListBoxesHelper : List - { - private float _yOffsetStart; - private float _yOffsetEnd; - public ChkListBoxesHelper() - : base() - { - } - public void Add(ItemInfo myHls, float yoffStart, float yoffend) - { - Add(new ChkListBoxHelper()); - } - public void Draw() - { - foreach (ChkListBoxHelper cb in this) - { - - } - } - } - public class ChkListBoxHelper - { - public ChkListBoxHelper() - { - } - } - public class PageBookmarks : List - { - public PageBookmarks() - : base() - { - } - public void Add(ItemInfo itemInfo, string title, PdfDestination pdfDestination) - { - foreach (PageBookmark pb in this) - if (pb.Title == title) return; - Add(new PageBookmark(itemInfo, title, pdfDestination)); - } - } - public class PageBookmark - { - private ItemInfo _MyItemInfo; - public ItemInfo MyItemInfo - { - get { return _MyItemInfo; } - set { _MyItemInfo = value; } - } - private string _Title; - public string Title - { - get { return _Title; } - set { _Title = value; } - } - private PdfDestination _PdfDestination; - public PdfDestination PdfDestination - { - get { return _PdfDestination; } - set { _PdfDestination = value; } - } - public PageBookmark(ItemInfo itemInfo, string title, PdfDestination pdfDestination) - { - _MyItemInfo = itemInfo; - _Title = title; - _PdfDestination = pdfDestination; - } - internal bool IsTopLevel - { - get - { - ItemInfo parent = MyItemInfo.ActiveParent as ItemInfo; - if (parent == null || parent.IsProcedure) return true; - return false; - } - } - internal int Level - { - get - { - int level = 0; - ItemInfo parent = MyItemInfo.ActiveParent as ItemInfo; - while (parent != null && !parent.IsProcedure) - { - level++; - parent = parent.ActiveParent as ItemInfo; - } - return level; - } - } - } - public class ChangeBarDefinition // anything that is section level should go in here. - { - private PrintChangeBar _MyChangeBarType; - public PrintChangeBar MyChangeBarType - { - get { return _MyChangeBarType; } - set { _MyChangeBarType = value; } - } - private PrintChangeBarLoc _MyChangeBarLoc; - public PrintChangeBarLoc MyChangeBarLoc - { - get { return _MyChangeBarLoc; } - set { _MyChangeBarLoc = value; } - } - private PrintChangeBarText _MyChangeBarText; - public PrintChangeBarText MyChangeBarText - { - get { return _MyChangeBarText; } - set { _MyChangeBarText = value; } - } - private string _MyChangeBarMessage; // user defined change bar message from docconfig - public string MyChangeBarMessage - { - get { return _MyChangeBarMessage; } - set { _MyChangeBarMessage = value; } - } - private int _MyChangeBarColumn; // two dimensional array, if both on same side, values are = - public int MyChangeBarColumn - { - get { return _MyChangeBarColumn; } - set { _MyChangeBarColumn = value; } - } - /* - * could have line thickness (set default from 16-bit), line color (set default as black), line style - */ - public ChangeBarDefinition() - { - } - public ChangeBarDefinition(PrintChangeBar myCBT, PrintChangeBarLoc myCBL, PrintChangeBarText myCBTxt, string myCBMsg) - { - _MyChangeBarType = myCBT; - _MyChangeBarLoc = myCBL; - _MyChangeBarText = myCBTxt; - } - public ChangeBarDefinition(DocVersionConfig docverConfig, FormatInfo formatInfo) - { - // if there is not overridden data on the docversion, prompt user... - ChangeBarData changeBarData = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData; - if (docverConfig == null || docverConfig.Print_ChangeBar == PrintChangeBar.SelectBeforePrinting) - { - // use these for now, i.e. this is what user would have selected from dialog. - _MyChangeBarType = PrintChangeBar.WithDefault; - _MyChangeBarLoc = PrintChangeBarLoc.OutsideBox; - _MyChangeBarText = PrintChangeBarText.None; - } - else - { - _MyChangeBarType = docverConfig.Print_ChangeBar; - _MyChangeBarLoc = docverConfig.Print_ChangeBarLoc; - _MyChangeBarText = docverConfig.Print_ChangeBarText; - } - if (_MyChangeBarType == PrintChangeBar.WithDefault) // get data from format - { - _MyChangeBarText = changeBarData.ChangeBarMessage == "ChgID" ? PrintChangeBarText.ChgID : - changeBarData.ChangeBarMessage == "DateAndChgID" ? PrintChangeBarText.DateChgID : - changeBarData.ChangeBarMessage == "None" ? PrintChangeBarText.None : - changeBarData.ChangeBarMessage == "RevNum" ? PrintChangeBarText.RevNum : PrintChangeBarText.UserDef; - } - if (_MyChangeBarType != PrintChangeBar.Without) - { - // if the format has the absolutefixedchangecolumn format flag, then always use the fixedchangecolumn from the - // format, otherwise, use the default column based on the selected location, stored in the base format. - _MyChangeBarColumn = (changeBarData.AbsoluteFixedChangeColumn) ? - (int)changeBarData.FixedChangeColumn : - System.Convert.ToInt32(changeBarData.DefaultCBLoc.Split(",".ToCharArray())[(int)(_MyChangeBarLoc)]); - if (_MyChangeBarText == PrintChangeBarText.UserDef) - _MyChangeBarMessage = docverConfig.Print_UserCBMess1 + @"\n" + docverConfig.Print_UserCBMess2; - - } - } - } - public class CheckOffHeaderHelper - { - private SvgText _SvgText; - public SvgText SvgText - { - get { return _SvgText; } - set { _SvgText = value; } - } - private VEPROMS.CSLA.Library.VE_Font _CheckOffHeaderFont; - public VEPROMS.CSLA.Library.VE_Font CheckOffHeaderFont - { - get { return _CheckOffHeaderFont; } - set { _CheckOffHeaderFont = value; } - } - public CheckOffHeaderHelper(SvgText stext, VEPROMS.CSLA.Library.VE_Font vf) - { - _SvgText = stext; - _CheckOffHeaderFont = vf; - } - } - public class Gap - { - private float _YTop; - public float YTop - { - get { return _YTop; } - set { _YTop = value; } - } - private float _YBottom; - public float YBottom - { - get { return _YBottom; } - set { _YBottom = value; } - } - public Gap(float yTop, float yBottom) - { - _YTop = yTop; - _YBottom = yBottom; - } - } - public class Gaps : List - { - public void Add(float yTop, float yBotttom) - { - this.Add(new Gap(yTop, yBotttom)); - } - } -} diff --git a/PROMS/Volian.Print.Library/Volian.Print.Library.csproj b/PROMS/Volian.Print.Library/Volian.Print.Library.csproj deleted file mode 100644 index d4694ccd..00000000 --- a/PROMS/Volian.Print.Library/Volian.Print.Library.csproj +++ /dev/null @@ -1,168 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {94830C07-6A3A-450E-9674-C9B4293A7726} - Library - Properties - Volian.Print.Library - Volian.Print.Library - - - - - - - - - v4.8.1 - - - - - 2.0 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - x64 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - x64 - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - prompt - false - - - bin\x86\Release\ - TRACE - true - pdbonly - x64 - prompt - false - - - - - False - ..\..\..\..\3rdPartyLibraries\CSLA\CSLA20cs_DLL_Net_4.8.1_Build\Csla.dll - - - ..\FlexableMessageBox\bin\Debug\FlexableMessageBox.dll - - - ..\..\..\..\3rdPartyLibraries\RtfConverter\bin\Debug\Itenso.Rtf.Interpreter.dll - - - ..\..\..\..\3rdPartyLibraries\RtfConverter\bin\Debug\Itenso.Rtf.Parser.dll - - - False - ..\..\..\..\3rdPartyLibraries\iTechSharp\itextsharp.dll - - - False - ..\LBWordLibrary\bin\Debug\LBWordLibrary.dll - - - ..\..\..\..\3rdPartyLibraries\Log4Net\log4net.dll - - - - True - - - - - - - ..\ReferencedObjects\LibSource\VlnStatus\bin\Debug\VlnStatus.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {41B2D786-1C03-4C1A-9247-DA9F0D6B06D5} - VEPROMS.CSLA.Library - - - {AEEE9FD1-6892-45E2-A67E-418C06D46FF9} - Volian.Base.Library - - - {8556527C-6615-487F-8AF7-22EBC3EF0268} - Volian.Controls.Library - - - {293911B5-C602-483F-A97F-F962EEFB3CAE} - Volian.Svg.Library - - - - - - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Print.Library/Volian.Print.Library.gclicx b/PROMS/Volian.Print.Library/Volian.Print.Library.gclicx deleted file mode 100644 index 5c0be60b..00000000 --- a/PROMS/Volian.Print.Library/Volian.Print.Library.gclicx +++ /dev/null @@ -1,2 +0,0 @@ -da3d5d14-691f-4908-aa3c-fd3239734232;-8584914772854775808;Vm9saWFuLlByaW50LkxpYnJhcnkuZGxs;ZGEzZDVkMTQtNjkxZi00OTA4LWFhM2MtZmQzMjM5NzM0MjMy,MDEwODE5MjdYWFhYWFhYWDA1Mg,Sk9ITi1XSU4xMA,RmFsc2U,ODQzNA,RmFsc2U,MA,MA,djIwMjIuMw,,;c7VmK7aSALscK1Nd/lI1cS3mms+p4j4Fsa2LgKQ1JmeSkNKq5X8LWx2NLOHITkvv+3IbbTQcVPnGa7hKiEDHlfH3thfwEvtzoqprZSXMOYfNPiXTPIIYPNb6L31Qq7AGiogvw+dMD9o/AiUWt4Q7a5SRmYU+PbrlNAXVISIzndw -da3d5d14-691f-4908-aa3c-fd3239734232;-8584865524854775808;Vm9saWFuLlByaW50LkxpYnJhcnkuZGxs;ZGEzZDVkMTQtNjkxZi00OTA4LWFhM2MtZmQzMjM5NzM0MjMy,NjE5MDczODdYWFhYWFhYWDA1Mw,Q0hSSVM,RmFsc2U,ODg5NA,RmFsc2U,MA,MA,djIwMjQuMQ,,;luo/kWHt4XRAYR+3s8m8QoRagBcvXLv0mHvCYU2VCIeACFord4tdtTGmSUvmGhEmUiAd7YvaTlDlFrlni6CWaVlxa1mdbWuWsNVUkRnyJZ8kOAt1A+3SGfHecCsqotTW7apXjwW5qXLZ/fcgutioe7xaXgniFQysshTdUWt26T8 diff --git a/PROMS/Volian.Print.Library/packages.config b/PROMS/Volian.Print.Library/packages.config deleted file mode 100644 index e28eb0be..00000000 --- a/PROMS/Volian.Print.Library/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/PROMS/Volian.Print.Library/pdf.cs b/PROMS/Volian.Print.Library/pdf.cs deleted file mode 100644 index ccfbc88d..00000000 --- a/PROMS/Volian.Print.Library/pdf.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text; -using iTextSharp.text.pdf; -using System.IO; -using Microsoft.Win32; -using Volian.Base.Library; - -namespace Volian.Print.Library -{ - public class pdf - { - private Document _MyDocument; - public Document MyDocument - { - get { return _MyDocument; } - 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) - { - _MyFileName = myFileName; - _MyDocument = new Document(PageSize.LETTER); - try - { - _MyWriter = PdfWriter.GetInstance(_MyDocument, new FileStream(myFileName, FileMode.Create)); - _MyWriter.SetAtLeastPdfVersion(PdfWriter.VERSION_1_7); - } - catch (Exception ex) - { - Console.WriteLine("{0} - {1}\r\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace); - } - } - public pdf(string myFileName, Rectangle mySize) - { - _MyFileName = myFileName; - _MyDocument = new Document(mySize); - try - { - _MyWriter = PdfWriter.GetInstance(_MyDocument, new FileStream(myFileName, FileMode.Create)); - _MyWriter.SetAtLeastPdfVersion(PdfWriter.VERSION_1_7); - } - catch (Exception ex) - { - Console.WriteLine("{0} - {1}\r\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace); - } - } - public void Close() - { - MyDocument.Close(); - } - private Color _WatermarkColor = Color.BLUE; - private float _WatermarkOpacity = .10F; - public void WatermarkPageNumber(int pageNumber) - { - Rectangle pageSize = ContentByte.PdfWriter.PageSize; // Get page size - BaseFont myBasefont = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, Encoding.ASCII.EncodingName, BaseFont.EMBEDDED); - string strPage = pageNumber.ToString(); - float h = myBasefont.GetAscentPoint(strPage, 10); - float w = myBasefont.GetWidthPoint(strPage, 10); - float fontSizeH = 10 * pageSize.Height / h; - float fontSizeW = 10 * pageSize.Width / w; - float myFontSize = fontSizeH < fontSizeW ? fontSizeH : fontSizeW; - ContentByte.SaveState(); - ContentByte.BeginText(); - ContentByte.SetPatternFill(PatternPainter); - ContentByte.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE); - ContentByte.SetLineWidth(.5F); - ContentByte.SetFontAndSize(myBasefont, myFontSize);// Set font and size - ContentByte.SetColorStroke(_WatermarkColor); - PdfGState gs2 = new PdfGState(); - gs2.StrokeOpacity = _WatermarkOpacity; - ContentByte.SetGState(gs2); - ContentByte.ShowTextAlignedKerned(PdfContentByte.ALIGN_CENTER, strPage, pageSize.Width / 2, 0, 0);// Draw the text - ContentByte.EndText(); - ContentByte.FillStroke(); // Controlled by TextRenderMode above - ContentByte.RestoreState(); - - } - private PdfPatternPainter _PatternPainter; - - public PdfPatternPainter PatternPainter - { - get - { - if (_PatternPainter == null) - _PatternPainter = SetSquareDotPattern(2); - return _PatternPainter; - } - } - public PdfPatternPainter SetSquareDotPattern(float radius) - { - PdfPatternPainter myPatternPainter; - myPatternPainter = ContentByte.CreatePattern(radius * 4, radius * 2, radius * 4, radius * 2); - PdfGState gState = new PdfGState(); - gState.FillOpacity = _WatermarkOpacity; - myPatternPainter.SetGState(gState); - myPatternPainter.SetColorFill(_WatermarkColor); - myPatternPainter.Rectangle(0, 0, radius, radius); - myPatternPainter.Rectangle(radius * 2, radius, radius, radius); - myPatternPainter.Fill(); - return myPatternPainter; - } - public static iTextSharp.text.Font GetFont(string fontName, float fontSize, int fontStyle, Color fontColor) - { - // B2019-116 Use Volian.Base.Library.VlnItextFont - // This is a generic class for dealing with iTextSharp Fonts - // Code moved and consolidated from Volian.Print.Library, Volian PDF.Library and VG - VlnItextFont.RegisterFont(fontName); - return iTextSharp.text.FontFactory.GetFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize, fontStyle, fontColor); - } - } -} diff --git a/PROMS/Volian.Print.Library/pkParagraph.cs b/PROMS/Volian.Print.Library/pkParagraph.cs deleted file mode 100644 index 0a57b8c3..00000000 --- a/PROMS/Volian.Print.Library/pkParagraph.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Volian.Print.Library -{ - public class pkParagraph - { - private vlnParagraph _MyParagraph; - public vlnParagraph MyParagraph - { - get { return _MyParagraph; } - } - private pkParagraphs _MyChildren; - public pkParagraphs MyChildren - { - get { return _MyChildren; } - } - private pkParagraphs _MyCautionsAndNotes; - public pkParagraphs MyCautionsAndNotes - { - get { return _MyCautionsAndNotes; } - } - public pkParagraph(vlnParagraph myParagraph) - { - _MyParagraph = myParagraph; - _MyChildren = new pkParagraphs(); - _MyCautionsAndNotes = new pkParagraphs(); - } - public pkParagraph AddChild(vlnParagraph myParagraph) - { - pkParagraph tmp = new pkParagraph(myParagraph); - _MyChildren.Add(tmp); - return tmp; - } - public pkParagraph AddCautionsAndNotes(vlnParagraph myParagraph) - { - pkParagraph tmp = new pkParagraph(myParagraph); - _MyCautionsAndNotes.Add(tmp); - return tmp; - } - } - public class pkParagraphs:List - { - } -} diff --git a/PROMS/Volian.Print.Library/vlnBox.cs b/PROMS/Volian.Print.Library/vlnBox.cs deleted file mode 100644 index 4ea37c80..00000000 --- a/PROMS/Volian.Print.Library/vlnBox.cs +++ /dev/null @@ -1,678 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using iTextSharp.text.pdf; -using iTextSharp.text; -using VEPROMS.CSLA.Library; - - -namespace Volian.Print.Library -{ - public partial class vlnBox : vlnPrintObject - { - 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 - { - get { return _MyBox; } - set { _MyBox = value; } - } - // the following two fields are used if 'boxed' step, thus - // no 'Box' was defined in format file. - public override float Height - { - get - { - if (_Height == 0) - _Height = GetParagraphHeight(MyContentByte, IParagraph,string.Empty, Width); - return _Height; - } - set { _Height = value; } - } - public string DefBox = null; - public float DefEnd = 0; - - private bool _ContainsPageBreak = false; - public bool ContainsPageBreak - { - 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"; - //private bool _DoBottom = true; - public vlnBox() - { - } - public vlnBox(vlnParagraph paragraph) - { - } - public const string BoxThin = "\x2510.\x2500.\x250c.\x2502. . .\x2518.\x2514. .\x2500. . "; - const string BoxThick = "\x2584.\x2584.\x2584.\x2588. . .\x2580.\x2580. .\x2580. . "; - const string BoxDouble = "\x2557.\x2550.\x2554.\x2551. . .\x255D.\x255A. .\x2550. . "; - const string BoxFPLNote = "\x2557.\x2550\xad.\x2554\xad.\x2551. . .\x255d.\x255a\xad. .\x2550\xad. . "; - const string BoxFPLCaution = "\x2588.\x2580.\x2588.\x2588. . .\x2588.\x2588. .\x2584. . "; - const string BoxAsterisk = " *.* .* . . . . *.* . .* . . "; - const string BoxAsteriskWithSides1 = " *.* .* .* . . . *.* . .* . . "; // ip2 - const string BoxAsteriskWithSides2 = " *. *.*.*. . . *.*. . *. . "; // ip3 - const string BoxAsteriskWithSides3 = "*.*.*.*.*.*.*.*.*.*.*.*"; //byr - const string BoxAsteriskWithSides4 = "*.*.*.*.*.*.*.*. .*. . "; // wep2 - const string BoxAsteriskWithSides5 = "*.*.*.*. . .*.*. .*.*.*"; // WEP2 (Point Beach) - const string BoxAsteriskTopBottom = "*.*.*. . . .*.*. .*. . "; // fnp - const string BoxLineTopBottom = "\x2500.\x2500.\x2500. . . .\x2500.\x2500. .\x2500. . "; // fnp - const string BoxAsteriskTopBotton2 = " .*. . . . . . . .*. . "; // Robinson (CPL) - public vlnBox MyParentBox - { - get - { - // B2018-096 AEP 082.002CD Note Box overlapping Step Box - vlnParagraph parent = MyParent.MyParent; - if(parent == null) return null; - if (parent.MyItemInfo.FormatStepData != null && !parent.MyItemInfo.FormatStepData.BoxIt) return null; - if (parent.PartsContainer == null) return null; - foreach(vlnPrintObject obj in parent.PartsContainer) - if (obj is vlnBox) - return(obj as vlnBox); - return null; - } - } - public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) - { - if (MyBox == null) return yPageStart; - cb.SaveState(); - VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; - if (textLayer != null) cb.BeginLayer(textLayer); - MyContentByte = cb; - //Console.WriteLine("'{0}','{1}'", CharToAsc(MyBox.BoxStyle), MyParent.MyItemInfo.ShortPath); - float top = CalculateYOffset(yPageStart, yTopMargin) - (7*MyPageHelper.YMultiplier); - float bottom = top - (Height * MyPageHelper.YMultiplier); - float left = (float)((MyBox.Start ?? 0) + MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin); - float myBoxLeftAdj = 0; - if (MyParent.MyItemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null) - myBoxLeftAdj = float.Parse(MyParent.MyItemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj); - left += myBoxLeftAdj; - float right = (float)MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin + (float)(MyBox.End ?? DefEnd); - if (MyParentBox != null)// B2018-096 AEP 082.002CD Note Box overlapping Step Box - right = (float)MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin + MyParentBox.DefEnd - SixLinesPerInch/2; - right += myBoxLeftAdj; - iTextSharp.text.Color boxColor = new iTextSharp.text.Color(PrintOverride.OverrideBoxColor(System.Drawing.Color.Black)); - cb.SetColorStroke(boxColor); - - float gapTopBox = top; - float gapBottomBox = top - Height; - if (MyParent.MyItemInfo.MyDocStyle.CenterLineYTop!=null && DefBox == vlnBox.DOUBLEboxHLS) - { - // For top box, if at top of page, the first gap begins at the centerlineYTop, otherwise it starts where - // the box is drawn, with an adjustment to allow for the first line of text & the extra line above the box - gapTopBox = (top + 3*SixLinesPerInch > (float)MyParent.MyItemInfo.MyDocStyle.CenterLineYTop) ? - (float)MyParent.MyItemInfo.MyDocStyle.CenterLineYTop : top + 1.3f * vlnPrintObject.SixLinesPerInch; - // The bottom gap must be moved down just a little to account for the double box (bottom line of box) - gapBottomBox -= 3.2f; - } - if (MyParent.MyItemInfo.MyDocStyle.CenterLineYTop!=null)_MyPageHelper.MyGaps.Add(gapTopBox, gapBottomBox); - // F2021-026: Barakah single column thick double box around Warnings - if (DefBox == null && MyBox.ThickDouble) - { - Volian.Base.Library.BaselineMetaFile.WriteLine("BXDblThick Lf={0} Rt={1} Tp={2} Bt={3}", left, (float)MyParent.MyItemInfo.MyDocStyle.Layout.PageWidth, top, bottom); - DrawDoubleHlsBoxThick(cb, top, bottom, left, (float)MyParent.MyItemInfo.MyDocStyle.Layout.PageWidth); - } - else if (DefBox != null && DefBox != vlnBox.DOUBLEboxHLS) - { - cb.SetLineWidth(.6F); - float lheight = Height; - if (top > yTopMargin) - { - lheight -= (top - yTopMargin); - } - if (bottom < yBottomMargin) - { - lheight += (bottom - yBottomMargin); - bottom = yBottomMargin; - } - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("BX Lf={0} Bt={1} W={2} H={3}", left, bottom, right - left, lheight * MyPageHelper. YMultiplier); - cb.Rectangle(left, bottom, right - left, lheight * MyPageHelper.YMultiplier); - } - else if (DefBox == vlnBox.DOUBLEboxHLS) - { - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("BXHLS Lf={0} Rt={1} Tp={2} Bt={3}", left, (float)MyParent.MyItemInfo.MyDocStyle.Layout.PageWidth,top, bottom); - DrawDoubleHlsBox(cb, top, bottom, left, (float)MyParent.MyItemInfo.MyDocStyle.Layout.PageWidth); - } - else - { - const float llxOffset = 3; - float lineThickness = 0; - switch (MyBox.BoxStyle) - { - case BoxThin: - lineThickness = .6F; - cb.SetLineWidth(lineThickness); - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("BXThin Lf={0} Bt={1} W={2} H={3}", left + llxOffset, bottom + (lineThickness / 2), right - left, (Height - lineThickness) * MyPageHelper.YMultiplier); - cb.Rectangle(left + llxOffset, bottom + (lineThickness / 2), right - left, (Height - lineThickness) * MyPageHelper.YMultiplier); - break; - case BoxThick: - lineThickness = 6; - cb.SetLineWidth(lineThickness); - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("BXThick Lf={0} Bt={1} W={2} H={3}", left + llxOffset, bottom + (lineThickness / 2), right - left, (Height - lineThickness) * MyPageHelper.YMultiplier); - cb.Rectangle(left + llxOffset, bottom + (lineThickness / 2), right - left, (Height - lineThickness) * MyPageHelper.YMultiplier); - break; - case BoxDouble: - if (MyBox.NumLines == 3) - { - lineThickness = .6F; - cb.SetLineWidth(lineThickness / 2F); - // outer rectangle (rectangle's are defined as x,y,w,h) - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("BX3lns1 Lf={0} Bt={1} W={2} H={3}", left + llxOffset - lineThickness * 1.5F, bottom - lineThickness, right - left + lineThickness * 3, (Height + lineThickness * 2) * MyPageHelper.YMultiplier); - cb.Rectangle(left + llxOffset - lineThickness * 1.5F, bottom - lineThickness, right - left + lineThickness * 3, (Height + lineThickness * 2) * MyPageHelper.YMultiplier); - // inner rectangle - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("BX3lns2 Lf={0} Bt={1} W={2} H={3}", left + llxOffset + lineThickness, bottom + lineThickness * 1.5F, right - left - lineThickness * 2, (Height - lineThickness * 3) * MyPageHelper.YMultiplier); - cb.Rectangle(left + llxOffset + lineThickness, bottom + lineThickness * 1.5F, right - left - lineThickness * 2, (Height - lineThickness * 3) * MyPageHelper.YMultiplier); - // outer outer most - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("BX3lns3 Lf={0} Bt={1} W={2} H={3}", left + llxOffset - lineThickness * 4F, bottom - lineThickness * 3.5F, right - left + lineThickness * 8, (Height + lineThickness * 7) * MyPageHelper.YMultiplier); - cb.Rectangle(left + llxOffset - lineThickness * 4F, bottom - lineThickness * 3.5F, right - left + lineThickness * 8, (Height + lineThickness * 7) * MyPageHelper.YMultiplier); - break; - } - lineThickness = .6F; - cb.SetLineWidth(lineThickness); - // outer rectangle (rectangle's are defined as x,y,w,h) - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("BX2lns1 Lf={0} Bt={1} W={2} H={3}", left + llxOffset - lineThickness * 1.5F, bottom - lineThickness, right - left + lineThickness * 3, (Height + lineThickness * 2) * MyPageHelper.YMultiplier); - cb.Rectangle(left + llxOffset - lineThickness * 1.5F, bottom - lineThickness, right - left + lineThickness * 3, (Height + lineThickness * 2) * MyPageHelper.YMultiplier); - // inner rectangle - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("BX2lns2 Lf={0} Bt={1} W={2} H={3}", left + llxOffset + lineThickness, bottom + lineThickness * 1.5F, right - left - lineThickness * 2, (Height - lineThickness * 3) * MyPageHelper.YMultiplier); - cb.Rectangle(left + llxOffset + lineThickness, bottom + lineThickness * 1.5F, right - left - lineThickness * 2, (Height - lineThickness * 3) * MyPageHelper.YMultiplier); - break; - case BoxFPLNote: - lineThickness = 2; - cb.SetLineWidth(lineThickness); - float[] linePattern = { 6, 1.75F, 2.5F, 1.75F }; - cb.SetLineDash(linePattern,3); - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("BXFPLNt Lf={0} Bt={1} W={2} H={3}", left + llxOffset, bottom + (lineThickness / 2) - 1, right - left, (2 + Height - lineThickness) * MyPageHelper.YMultiplier); - cb.Rectangle(left + llxOffset, bottom + (lineThickness / 2) -1, right - left, (2 + Height - lineThickness) * MyPageHelper.YMultiplier); - break; - case BoxFPLCaution: - lineThickness = 3; - cb.SetLineWidth(lineThickness); - // use a Y adjustment (top & bottom) to make the caution box match the 16bit output. - - // F2021-038: SHE/SHEA format - Less space between text and bottom line of Caution Box - float YbxAdjust = (MyParent.MyItemInfo.IsStep && MyParent.MyItemInfo.FormatStepData.NoYBxAdjust) ? 0 : 6.5F; - - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("BXFPLCn Lf={0} Bt={1} W={2} H={3}", left + llxOffset, bottom - YbxAdjust + (lineThickness / 2), right - left, (Height - lineThickness + 2 * YbxAdjust) * MyPageHelper.YMultiplier); - cb.Rectangle(left + llxOffset, bottom - YbxAdjust + (lineThickness / 2), right - left, (Height - lineThickness + 2*YbxAdjust) * MyPageHelper.YMultiplier); - break; - case BoxAsterisk: - case BoxAsteriskTopBottom: - case BoxAsteriskTopBotton2: - DrawAsteriskTopBottom(cb, yPageStart, yTopMargin, yBottomMargin, ref top, ref bottom, left, MyBox.Font); - break; - case BoxLineTopBottom: // fnp note box - lineThickness = .6f; - cb.SetLineWidth(lineThickness); - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("BXFNPNt Lf={0} Rt={1} Tp={2} Bt={3}", left + llxOffset, right, top, bottom); - cb.MoveTo(left + llxOffset, bottom); - cb.LineTo(right, bottom); - cb.MoveTo(left + llxOffset, top); - cb.LineTo(right, top); - break; - case BoxAsteriskWithSides1: - case BoxAsteriskWithSides3: - case BoxAsteriskWithSides4: - case BoxAsteriskWithSides5: - DrawAsteriskTopBottom(cb, yPageStart, yTopMargin, yBottomMargin, ref top, ref bottom, left, MyBox.Font); - DrawAsteriskSide(cb, yPageStart, yTopMargin, yBottomMargin, top, bottom, left, right, MyBox.Font); - break; - case BoxAsteriskWithSides2: // special processing for IP3's box - DrawAsteriskTopBottomHLS(cb, yPageStart, yTopMargin, yBottomMargin, ref top, ref bottom, left, MyBox.Font); - DrawAsteriskSideHLS(cb, yPageStart, yTopMargin, yBottomMargin, top, bottom, left, right, MyBox.Font); - break; - default: - // For other than thick, thin and double. - if (!_UnimplementedBoxStyles.Contains(MyBox.BoxStyle)) - { - _UnimplementedBoxStyles.Add(MyBox.BoxStyle); - _MyLog.InfoFormat("Unimplemented Box Style {0} {1}", ShowBoxStyle(MyBox.BoxStyle), MyParent.MyItemInfo.ShortPath); - //Console.WriteLine("Unimplemented Box Style {0} {1}", ShowBoxStyle(MyBox.BoxStyle), MyParent.MyItemInfo.ShortPath); - } - break; - //throw new Exception("Missing vlnBox handler"); - } - } - cb.Stroke(); - if (textLayer != null) cb.EndLayer(); - cb.RestoreState(); - return yPageStart; - } - - private static void DrawDoubleHlsBox(PdfContentByte cb, float top, float bottom, float left, float right) - { - float lineThickness = .6f; - float lnOff = 1.3f * vlnPrintObject.SixLinesPerInch; - cb.SetLineWidth(lineThickness); - // top (double line) - cb.MoveTo(left, top + lnOff); - cb.LineTo(right, top + lnOff); - cb.MoveTo(left + 3.6f, top + lnOff - 3); - cb.LineTo(right - 3.6f, top + lnOff - 3); - // bottom (double line) - cb.MoveTo(left, bottom - 2f); - cb.LineTo(right, bottom - 2f); - cb.MoveTo(left + 3.6f, bottom+1f); - cb.LineTo(right - 3.6f, bottom+1f); - // sides - cb.MoveTo(left + 3.6f, top + lnOff - 3); - cb.LineTo(left + 3.6f, bottom +1f); - cb.MoveTo(right - 3.6f, top + lnOff - 3); - cb.LineTo(right - 3.6f, bottom +1f); - } - // F2021-026: Barakah single column thick double box around Warnings - // F2021-081: Barakah thick double box, adjust to add more space between boxes - // F2022-012: Barakah move the top 2 lines down slightly so they don't overlap INIT underline if at top of page. - private static void DrawDoubleHlsBoxThick(PdfContentByte cb, float top, float bottom, float left, float right) - { - float lineThickness = 3; - float lnOff = 1f * vlnPrintObject.SixLinesPerInch; - cb.SetLineWidth(lineThickness); - // top (double line) - cb.MoveTo(left-2.5f, top + lnOff-4); // outer (lower y moves up page) - cb.LineTo(right+2.5f, top + lnOff-4); - cb.MoveTo(left + 4.5f, top + lnOff - 11); // inner - cb.LineTo(right - 4.5f, top + lnOff - 11); - // bottom (double line) - cb.MoveTo(left-2.5f, bottom - 6); - cb.LineTo(right+2.5f, bottom - 6); - cb.MoveTo(left + 4.5f, bottom+ 1); - cb.LineTo(right - 4.5f, bottom+ 1); - // sides - cb.MoveTo(left + 4.5f, top + lnOff - 9.5f); // inner box - cb.LineTo(left + 4.5f, bottom - 0.5f); - cb.MoveTo(right - 4.5f, top + lnOff - 9.5f); - cb.LineTo(right - 4.5f, bottom - 0.5f); - cb.MoveTo(left - 2.5f, top + lnOff-2.5f); // outer box - cb.LineTo(left-2.5f, bottom - 7.5f); - cb.MoveTo(right + 2.5f, top + lnOff -2.5f); - cb.LineTo(right+2.5f, bottom - 7.5f); - } - - private void DrawAsteriskTopBottom(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. - // For this box, there are no vertical edges (RGE uses this box type) - top = CalculateYOffset(yPageStart, yTopMargin); - // Bug fix B2013-091 - // added YMultiplier to handle compress pages - // bottom row of asterisks was in non-compressed line location - bottom = top - (Height * MyPageHelper.YMultiplier); - - // 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; - // if the box has a font, use it - otherwise use this item info's font - VE_Font vf = null; - bool UseBoxFont = false; - try - { - UseBoxFont = MyParent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox; - } - catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false. - { - } - if (UseBoxFont) - vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); - else - vf = new VE_Font(MyParent.MyItemInfo.FormatStepData.Font.Family, (int)MyParent.MyItemInfo.FormatStepData.Font.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); - - // To find the length of the line, account for the length of the upper right corner also (BXURC) - int urcLen = MyBox.BXHorz[MyBox.BXHorz.Length - 1] == ' ' && MyBox.BXURC[0] == ' ' ? 1 : MyBox.BXURC.Length; - float endHorz = (float)MyBox.End - (float)MyBox.Start - (float)(urcLen * (72 / vf.CPI)); - - float bxHorzTextWidth = GetTextWidth(vf, MyBox.BXHorz); // get the width of the BXHorz string - // Do the top line first: - StringBuilder sb = new StringBuilder(); - sb.Append(MyBox.BXULC); - float size = GetTextWidth(vf, MyBox.BXULC); //(float)(MyBox.BXULC.Length * (72 / vf.CPI)); - string bxstr = null; - if (!ContainsPageBreak) // Only do top line if there is no page break. - { - while (size < endHorz) - { - sb.Append(MyBox.BXHorz); - size = size + bxHorzTextWidth; //(float)(MyBox.BXHorz.Length * (72 / vf.CPI)); - } - // 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 - // end of the string, so remove the space before tacking on the upper right corner: - bxstr = sb.ToString(); - if (bxstr[bxstr.Length - 1] == ' ' && MyBox.BXURC[0] == ' ') bxstr = bxstr.TrimEnd(); - bxstr = bxstr + MyBox.BXURC; - size = size + GetTextWidth(vf, MyBox.BXURC);//(float)((MyBox.BXURC.Length) * (72 / vf.CPI)); - Rtf = GetRtf(bxstr, vf); - IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. - Rtf2Pdf.TextAt(cb, IParagraph, left, top, size + 10, 100, "", yBottomMargin); - } - - // Handle the bottom line now: - if (bottom < yBottomMargin) return; // Box goes off page, i.e. page break, don't do bottom - - sb.Remove(0, sb.Length); - sb.Append(MyBox.BXLLC); - size = GetTextWidth(vf, MyBox.BXLLC); //(float)(MyBox.BXLLC.Length * (72 / vf.CPI)); - while (size < endHorz) - { - sb.Append(MyBox.BXHorz); - size = size + bxHorzTextWidth;//(float)(MyBox.BXHorz.Length * (72 / vf.CPI)); - } - bxstr = sb.ToString().TrimEnd() + MyBox.BXLRC; - size = size + GetTextWidth(vf, MyBox.BXLRC); //(float)((MyBox.BXLRC.Length) * (72 / vf.CPI)); - Rtf = GetRtf(bxstr, vf); - IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. - Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size + 10, 100, "", yBottomMargin); - } - private string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab - // add symbol characters as needed - // "\u25CF" - solid bullet - // \x0394 - delta - - private System.Drawing.FontStyle GetSysFontStyle(VE_Font f) - { - if (f.Style == E_Style.Italics) - return System.Drawing.FontStyle.Italic; - return FontStyle.Regular; - } - private float GetTextWidth(VE_Font vefont, string txt) - { - string symblFontName = (vefont.FontIsProportional()) ? Volian.Base.Library.vlnFont.ProportionalSymbolFont : "VESymbFix"; // C2017-036 get best available proportional font for symbols - // 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 - // 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 symbFont = VE_Font.GetWinSysFont(symblFontName, (float)vefont.Size); - iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); - iTextSharp.text.Font iSymblFont = Volian.Svg.Library.VolianPdf.GetFont(symbFont); - float w = 0; - foreach (char c in txt) - { - int idx = symblsStr.IndexOf(c); - if (idx >= 0) // symbol character - use symbol font to find its width - w += iSymblFont.BaseFont.GetWidthPointKerned(symblsStr[idx].ToString(), (float)vefont.Size); - else - w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)vefont.Size); - } - //float w = iFont.BaseFont.GetWidthPointKerned(Text.Replace("\u25CF","@"), (float)vefont.Size); - return w; - } - 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. - // The vlnBox property, ContainsPageBreak, flags that a break occurred. - if (!ContainsPageBreak) // if no page break, just use top as is. - { - top = CalculateYOffset(yPageStart, yTopMargin); - bottom = top - (Height * MyPageHelper.YMultiplier); - } - else - { - // to calculate the bottom, don't adjust the top yet. - top = CalculateYOffset(yPageStart, yTopMargin); - bottom = top - (Height * MyPageHelper.YMultiplier); - top = yTopMargin; // reset top to top margin since there was a page break. - } - - // Check that the bottom is within the bottom margin, if this step spans more than one page, - // stop the side asterisks at the bottom margin. (pagination puts inserts a page break here) - - if (bottom < yBottomMargin) bottom = yBottomMargin; - - float height = (SixLinesPerInch * MyPageHelper.YMultiplier) + 4; // just add a little on so that height is a little bigger than character - - // 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; - // if the box has a font, use it - otherwise use this item info's font - VE_Font vf = null; - bool UseBoxFont = false; - try - { - UseBoxFont = MyParent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox; - } - catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false. - { - } - if (UseBoxFont) - vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); - else - vf = new VE_Font(MyParent.MyItemInfo.FormatStepData.Font.Family, (int)MyParent.MyItemInfo.FormatStepData.Font.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); - - // Left side first: - Rtf = GetRtf(MyBox.BXVert, vf); - IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. - // start down one line because the top/bottom code draws the corner - float vertDiff = top - (SixLinesPerInch * MyPageHelper.YMultiplier); - float width = (float)(MyBox.BXVert.Length * (72 / vf.CPI)); - while (vertDiff > bottom) - { - Rtf2Pdf.TextAt(cb, IParagraph, left, vertDiff, width, height, "", yBottomMargin); - vertDiff -= (SixLinesPerInch * MyPageHelper.YMultiplier); - } - - // right side: - vertDiff = top - (SixLinesPerInch * MyPageHelper.YMultiplier); - Rtf = GetRtf(MyBox.BXVert.TrimEnd(), vf); - IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. - while (vertDiff > bottom) - { - Rtf2Pdf.TextAt(cb, IParagraph, right, vertDiff, width, height, "", yBottomMargin); - vertDiff -= (SixLinesPerInch * MyPageHelper.YMultiplier); - } - } - - private string ShowBoxStyle(string str) - { - StringBuilder sb = new StringBuilder(); - foreach (Char c in str) - { - if (c >= ' ' && c < 128) - sb.Append(c); - else - sb.Append(string.Format("x{0:X0000}", (int)c)); - } - return sb.ToString(); - } - private static List _UnimplementedBoxStyles = new List(); - 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) - { - // this box is not drawn, it is a series of asterisks drawn above and below text. - top = CalculateYOffset(yPageStart, yTopMargin); - if (MyPageHelper.YMultiplier != 1) top += 2; - float ytmpbottom1 = yPageStart - (MyParent.YBottomForBox > 0 ? MyParent.YBottomForBox : MyParent.YBottomMost); - if (MyPageHelper.YMultiplier != 1) - { - ytmpbottom1 = (-1 + yTopMargin - (yTopMargin - ytmpbottom1) * MyPageHelper.YMultiplier) + 2; - } - bottom = ytmpbottom1; - // 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; - // if the box has a font, use it - otherwise use this item info's font - VE_Font vf = null; - bool UseBoxFont = false; - try - { - UseBoxFont = MyParent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox; - } - catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false. - { - } - if (UseBoxFont) - vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); - else - vf = new VE_Font(MyParent.MyItemInfo.FormatStepData.Font.Family, (int)MyParent.MyItemInfo.FormatStepData.Font.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); - - // To find the length of the line, account for the length of the upper right corner also (BXURC) - int urcLen = MyBox.BXHorz[MyBox.BXHorz.Length - 1] == ' ' && MyBox.BXURC[0] == ' ' ? 1 : MyBox.BXURC.Length; - float endHorz = (float)MyBox.End - (float)MyBox.Start - (float)(urcLen * (72 / vf.CPI)); - - float bxHorzTextWidth = GetTextWidth(vf, MyBox.BXHorz); // get the width of the BXHorz string - // Do the top line first: - StringBuilder sb = new StringBuilder(); - sb.Append(MyBox.BXULC); - float size = GetTextWidth(vf, MyBox.BXULC); //(float)(MyBox.BXULC.Length * (72 / vf.CPI)); - string bxstr = null; - if (!ContainsPageBreak) // Only do top line if there is no page break. - { - while (size < endHorz) - { - sb.Append(MyBox.BXHorz); - size = size + bxHorzTextWidth; //(float)(MyBox.BXHorz.Length * (72 / vf.CPI)); - } - // 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 - // end of the string, so remove the space before tacking on the upper right corner: - bxstr = sb.ToString(); - if (bxstr[bxstr.Length - 1] == ' ' && MyBox.BXURC[0] == ' ') bxstr = bxstr.TrimEnd(); - bxstr = bxstr + MyBox.BXURC; - size = size + GetTextWidth(vf, MyBox.BXURC);//(float)((MyBox.BXURC.Length) * (72 / vf.CPI)); - Rtf = GetRtf(bxstr, vf); - IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. - Rtf2Pdf.TextAt(cb, IParagraph, left, top, size + 10, 100, "", yBottomMargin); - } - - // Handle the bottom line now: - if (bottom < yBottomMargin) return; // Box goes off page, i.e. page break, don't do bottom - - sb.Remove(0, sb.Length); - sb.Append(MyBox.BXLLC); - size = GetTextWidth(vf, MyBox.BXLLC); //(float)(MyBox.BXLLC.Length * (72 / vf.CPI)); - while (size < endHorz) - { - sb.Append(MyBox.BXHorz); - size = size + bxHorzTextWidth;//(float)(MyBox.BXHorz.Length * (72 / vf.CPI)); - } - bxstr = sb.ToString().TrimEnd() + MyBox.BXLRC; - size = size + GetTextWidth(vf, MyBox.BXLRC); //(float)((MyBox.BXLRC.Length) * (72 / vf.CPI)); - Rtf = GetRtf(bxstr, vf); - IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. - Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size + 10, 100, "", yBottomMargin); - } - 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. - // The vlnBox property, ContainsPageBreak, flags that a break occurred. - float yOffBreak = 0; - if (!ContainsPageBreak) - { - top = CalculateYOffset(yPageStart, yTopMargin); - if (MyPageHelper.YMultiplier != 1) top += 2; - // if this broke, the bottom is defined where the parabreak occurred. - yOffBreak = MyPageHelper.ParaBreaks.Count > 0 ? MyPageHelper.ParaBreaks[0].YOffset : 0; - if (yOffBreak > 0) - bottom = (yPageStart - yOffBreak) * MyPageHelper.YMultiplier; - else - { - float ytmpbottom = yPageStart - (MyParent.YBottomForBox > 0 ? MyParent.YBottomForBox : MyParent.YBottomMost); - if (MyPageHelper.YMultiplier != 1) - { - ytmpbottom = -1 + yTopMargin - (yTopMargin - ytmpbottom) * MyPageHelper.YMultiplier; - } - bottom = ytmpbottom; - } - } - else - { - top = CalculateYOffset(yPageStart, yTopMargin); - yOffBreak = MyPageHelper.ParaBreaks.Count > 0 ? MyPageHelper.ParaBreaks[0].YOffset : 0; - if (yOffBreak > 0) - bottom = (yPageStart - yOffBreak) * MyPageHelper.YMultiplier; - else - { - float ytmpbottom1 = yPageStart - (MyParent.YBottomForBox > 0 ? MyParent.YBottomForBox : MyParent.YBottomMost); - if (MyPageHelper.YMultiplier != 1) - { - ytmpbottom1 = -1 + yTopMargin - (yTopMargin - ytmpbottom1) * MyPageHelper.YMultiplier; - } - bottom = ytmpbottom1; - } - top = yTopMargin; // reset top to top margin since there was a page break. - } - // Check that the bottom is within the bottom margin, if this step spans more than one page, - // stop the side asterisks at the bottom margin. (pagination puts inserts a page break here) - if (bottom < yBottomMargin) bottom = yBottomMargin; - - float height = (SixLinesPerInch * MyPageHelper.YMultiplier) + 4; // just add a little on so that height is a little bigger than character - - // 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; - // if the box has a font, use it - otherwise use this item info's font - VE_Font vf = null; - bool UseBoxFont = false; - try - { - UseBoxFont = MyParent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox; - } - catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false. - { - } - if (UseBoxFont) - vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); - else - vf = new VE_Font(MyParent.MyItemInfo.FormatStepData.Font.Family, (int)MyParent.MyItemInfo.FormatStepData.Font.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); - - // Left side first: - Rtf = GetRtf(MyBox.BXVert, vf); - IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. - // start down one line because the top/bottom code draws the corner - float vertDiff = top - (SixLinesPerInch * MyPageHelper.YMultiplier); - float width = (float)(MyBox.BXVert.Length * (72 / vf.CPI)); - while (vertDiff > bottom) - { - Rtf2Pdf.TextAt(cb, IParagraph, left, vertDiff, width, height, "", yBottomMargin); - vertDiff -= (SixLinesPerInch * MyPageHelper.YMultiplier); - } - - // right side: - vertDiff = top - (SixLinesPerInch * MyPageHelper.YMultiplier); - Rtf = GetRtf(MyBox.BXVert.TrimEnd(), vf); - IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. - while (vertDiff > bottom) - { - Rtf2Pdf.TextAt(cb, IParagraph, right, vertDiff, width, height, "", yBottomMargin); - vertDiff -= (SixLinesPerInch * MyPageHelper.YMultiplier); - } - } - - } -} diff --git a/PROMS/Volian.Print.Library/vlnChangeBar.cs b/PROMS/Volian.Print.Library/vlnChangeBar.cs deleted file mode 100644 index 4c23968a..00000000 --- a/PROMS/Volian.Print.Library/vlnChangeBar.cs +++ /dev/null @@ -1,262 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using iTextSharp.text.pdf; -using iTextSharp.text; -using VEPROMS.CSLA.Library; - -namespace Volian.Print.Library -{ - public class vlnChangeBarMessage - { - private float _ParentX; - public float ParentX - { - get { return _ParentX; } - set { _ParentX = value; } - } - private string _Message; - public string Message - { - get { return _Message; } - set { _Message = value; } - } - private static int _UniqueMessageId = 0; - public static int UniqueMessageId - { - get { return vlnChangeBarMessage._UniqueMessageId++; } - set { vlnChangeBarMessage._UniqueMessageId = value; } - } - private int _MessageId = UniqueMessageId; - public int MessageId - { - get { return _MessageId; } - set { _MessageId = value; } - } - public vlnChangeBarMessage(float parentx, string msg) - { - _ParentX = parentx; - _Message = msg; - } - } - public partial class vlnChangeBar : vlnPrintObject - { - private bool _HasChangeBar; - public bool HasChangeBar - { - get { return _HasChangeBar; } - set { _HasChangeBar = value; } - } - protected float _YChangeBarBottom; - public float YChangeBarBottom - { - get - { - if (_YChangeBarBottom == 0F) _YChangeBarBottom = _YOffset - _Height; - return _YChangeBarBottom; - } - set - { - _YChangeBarBottom = value; - _Height = _YOffset - _YChangeBarBottom; - } - } - private SortedDictionary _Messages; - public SortedDictionary Messages - { - get { return _Messages; } - set { _Messages = value; } - } - private int _MessageAlignment; - public int MessageAlignment - { - 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) - { - // for grids, a y adjustment is made to match 16bit output, see the variable 'GridTopAdjust'. Take this - // adjustment into account for the change bar. 6.5 positioned the change bar to match 16bit output. - if (parent.MyItemInfo.MyContent.MyGrid != null) yoff -= 6.5F; - MyContentByte = cb; - XOffset = xoff; - YOffset = yoff; - MyParent = parent; - _IsRev = isRev; - _MsgAtTop = msgAtTop; - Messages = new SortedDictionary(); - // if there is an RNO separator, add the separator's height in too. - float scale = parent.MyItemInfo.IsRtfRaw ? 0.6f : 1; // use scale for equations (B2016-265) - Height = (scale * parent.Height) * MyPageHelper.YMultiplier; // B2017-102, removed the extra line (was making changebar to long) - foreach (vlnPrintObject vpo in parent.PartsBelow) - { - if (vpo is vlnRNOSeparator) - { - // see if any of children don't have changebar - if ((vpo as vlnRNOSeparator).ExtendChangeBar) - _YExtendLine = (vpo.Height + vpo.YOffset - ((scale * parent.Height) + parent.YOffset)) * MyPageHelper.YMultiplier; - } - } - foreach (vlnPrintObject vph in parent.PartsAbove) - { - if (vph is vlnHeader) - { - string sep = parent.MyItemInfo.MyHeader == null ? "" : parent.MyItemInfo.MyHeader.CleanText; - vlnHeader tmp = vph as vlnHeader; - // if the part above is not the same type and it's a Note or Caution and the OnlyBulletSameCautionNoteType is true - // don't extend the change bar to the item above - if (!parent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.OnlyBulletSameCautionNoteType || - ((parent.MyItemInfo.IsCaution || parent.MyItemInfo.IsNote) && - (parent.MyItemInfo.MyContent.Type != vph.MyParent.MyItemInfo.MyContent.Type))) - { - // the separator must exist and the previous must have a change bar. - - // B2019-055 added check if the previous caution or note have the same type number - // B2019-168 added format flag 'SeparateChangeBarsForDiffNotesCautions' to control when fix for B2019-055 would take affect - if ((sep != "") && (tmp.Text == sep) && parent.MyItemInfo.MyPrevious != null && parent.MyItemInfo.MyPrevious.HasChangeBar - && (!parent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.SeparateChangeBarsForDiffNotesCautions || parent.MyItemInfo.MyContent.Type == parent.MyItemInfo.MyPrevious.MyContent.Type)) - { - if (MyPageHelper.MyParagraphs.ContainsKey(parent.MyItemInfo.MyPrevious.ItemID)) - { - vlnParagraph prev = MyPageHelper.MyParagraphs[parent.MyItemInfo.MyPrevious.ItemID]; - float delta = parent.YOffset - prev.YOffset; - _YOffset += delta; - _Height += delta; - } - else if (parent.PartsAbove.Count > 0) - { - float delta = parent.YOffset - parent.PartsAbove[0].YOffset; - _YOffset += delta; - _Height += delta; - } - } - } - } - } - _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 float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) - { - float? topMost = null; - cb.SaveState(); - // B2022-060 Prairie Island Alarms, change bars on second page of Alarm Point would sometimes be printed to far down the page - // The TopMargin setting of the first page is different than the second page and needed to be passed in - // for bug fix B2015-159 - // Ginna reported an instance where a change bar started printing inside the page header box - // in their Abnornal procedures AP-SG.1 step 41.b RNO which continued onto the next page - // calculate a new starting position for the change bar - if (_MyParent is vlnParagraph) - { - vlnParagraph pgh = _MyParent as vlnParagraph; - topMost = cb.PdfWriter.PageSize.Height - yPageStart; - } - VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; - if (textLayer != null) cb.BeginLayer(textLayer); - float yAdj = -3.75F; //0.5F; - float xAdj = 3F; - //cb.SetColorStroke(Color.GREEN); - // TODO: Should default to black - iTextSharp.text.Color changeBarColor = new iTextSharp.text.Color(PrintOverride.OverrideChangeBarColor(System.Drawing.Color.Black)); - cb.SetColorStroke(changeBarColor); - cb.SetLineWidth(.5F); - // for Bug Fix 2015-159 - // reset the YOffset if up too high before printing the change bar - if (topMost != null) - YOffset = Math.Min(YOffset, (float)topMost); - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("ChgBar X1={0} Y1={1} X2={2} Y2={3} ID={4}", XOffset + xAdj, YOffset - yAdj, XOffset + xAdj, YChangeBarBottomExtend - yAdj - 1, MyParent.MyItemInfo.ItemID); - cb.MoveTo(XOffset + xAdj, YOffset - yAdj); // combination yStart and YOffset - cb.LineTo(XOffset + xAdj, YChangeBarBottomExtend - yAdj - 1); - cb.Stroke(); - DebugPdf(cb, XOffset + xAdj - 1.5F, YOffset - yAdj + 4); - DebugPdf(cb, XOffset + xAdj - 1.5F, YChangeBarBottomExtend - yAdj - 1); - - if (Messages != null) - { - // if doing messages at top, then remove duplicates if they are next to each other. - // If this was not done, the location of messages was not correct. - if (_MsgAtTop && Messages.Count > 1) - { - string lastNoDup = ""; - SortedDictionary tmpNoDup = new SortedDictionary(); - foreach (KeyValuePair nodupM in Messages) - { - vlnChangeBarMessage noDupCmb = (vlnChangeBarMessage)nodupM.Value; - if (lastNoDup != noDupCmb.Message) tmpNoDup.Add(nodupM.Key, noDupCmb); - lastNoDup = noDupCmb.Message; - } - Messages = tmpNoDup; - } - // Loop through messages for this change bar. The first message is the bottom-most, which is always put out. - // Working up, if the current message is the same as the one below it, don't put it out. - string lastMsg = null; - int incrementMsgAtTop = (Messages == null ? 0 : Messages.Count-1); - foreach (KeyValuePair kvp in Messages) - { - float yBottom = (float)System.Convert.ToDouble(kvp.Key); - vlnChangeBarMessage vcbm = (vlnChangeBarMessage)kvp.Value; - if (lastMsg != vcbm.Message) - { - // use bigger font if revnum msg - - // 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 - // 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)): - Volian.Svg.Library.VolianPdf.GetFont(VE_Font.GetWinSysFont("Letter Gothic", 5.5F)); - - Chunk chk = new Chunk(vcbm.Message.IndexOf(@"\n") > -1 ? vcbm.Message.Substring(0, vcbm.Message.IndexOf(@"\n")) : vcbm.Message, iFont); - Paragraph myparagraph = new Paragraph(chk); - if (vcbm.Message.IndexOf(@"\n") > -1) - { - myparagraph.Add(Chunk.NEWLINE); - myparagraph.Add(new Chunk(vcbm.Message.Substring(vcbm.Message.IndexOf(@"\n") + 2, vcbm.Message.Length - vcbm.Message.IndexOf(@"\n") - 2), iFont)); - } - myparagraph.Alignment = MessageAlignment; - myparagraph.Leading = iFont.Size; - float w = GetTableWidth(cb, myparagraph, MyParent.MyItemInfo.MyDocStyle.Layout.PageWidth); - float h = GetParagraphHeight(cb, myparagraph, string.Empty, w); - cb.SetColorFill(changeBarColor); - float yloc = yBottom + h - Rtf2Pdf.Offset.Y + 2.7F; - if (_MsgAtTop) - { - yloc = YOffset - ((incrementMsgAtTop * h)); // + 2); - incrementMsgAtTop--; - } - Rtf2Pdf.TextAt(cb, myparagraph, XOffset + xAdj - Rtf2Pdf.Offset.X + 3, yloc, w, h, "", yBottomMargin); - lastMsg = vcbm.Message; - } - } - } - if (textLayer != null) cb.EndLayer(); - cb.RestoreState(); - return yPageStart; - } - } -} diff --git a/PROMS/Volian.Print.Library/vlnHeader.cs b/PROMS/Volian.Print.Library/vlnHeader.cs deleted file mode 100644 index a7234ee4..00000000 --- a/PROMS/Volian.Print.Library/vlnHeader.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using iTextSharp.text.pdf; -using iTextSharp.text; -using VEPROMS.CSLA.Library; - -namespace Volian.Print.Library -{ - public partial class vlnHeader: vlnText - { - private string _OrigStr; - public float HeaderWidth - { - get { return _WidthAdjust + (MyFont.CharsToTwips * Text.Length); } - } - public vlnHeader(vlnParagraph myParent, PdfContentByte cb, string origStr, string cleanStr, float xoffset, float yoffset, VE_Font vFont) - { - MyParent = myParent; - MyContentByte = cb; - YOffset = yoffset; - Width = MyParent.Width; - Text = cleanStr; - _OrigStr = (origStr.StartsWith(" ") && !origStr.Contains(@"\"))?origStr:null; - Rtf = GetRtf(origStr, vFont); - XOffset = xoffset; - MyFont = vFont; - } - public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) - { - string fontFace = MyFont.WindowsFont.Name; - int fontStyle = (MyFont.WindowsFont.Bold ? iTextSharp.text.Font.BOLD : 0) + (MyFont.WindowsFont.Italic ? iTextSharp.text.Font.ITALIC : 0); - iTextSharp.text.Font itextFont = Volian.Svg.Library.Svg.GetFont(fontFace, MyFont.WindowsFont.Size, fontStyle, System.Drawing.Color.Black); - float hdrwidth = itextFont.BaseFont.GetWidthPoint(Text, MyFont.WindowsFont.Size); - if (_OrigStr != null) hdrwidth = itextFont.BaseFont.GetWidthPoint(_OrigStr, MyFont.WindowsFont.Size); - hdrwidth += 5; - float yLocation = CalculateYOffset(yPageStart, yTopMargin); - Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, hdrwidth, 100, "", yBottomMargin); - return yPageStart; - } - } -} diff --git a/PROMS/Volian.Print.Library/vlnMacro.cs b/PROMS/Volian.Print.Library/vlnMacro.cs deleted file mode 100644 index f701f3ca..00000000 --- a/PROMS/Volian.Print.Library/vlnMacro.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using iTextSharp.text.pdf; -using iTextSharp.text; -using VEPROMS.CSLA.Library; - -namespace Volian.Print.Library -{ - public partial class vlnMacro : vlnPrintObject - { - private bool _UseInternalY = false; - // B2020-121: Account for Header on Caution or Note - public bool UseInternalY { get => _UseInternalY; set => _UseInternalY = value; } - private string _MacroDef; - public string MacroDef - { - get { return _MacroDef; } - set { _MacroDef = value; } - } - public vlnMacro(float xoffset, float yoffset, string macroDef) - { - YOffset = yoffset; - XOffset = xoffset; - MacroDef = macroDef; - } - public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) - { - cb.SaveState(); - MyContentByte = cb; - float yLocation = CalculateYOffset(yPageStart, yTopMargin); - 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 - if (MyPageHelper.YMultiplier != 1) yLocation += SixLinesPerInch - _SevenLinesPerInch; - VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; - if (textLayer != null) cb.BeginLayer(textLayer); - MyContentByte = cb; - System.Drawing.Color push = PrintOverride.SvgColor; - PrintOverride.SvgColor = PrintOverride.TextColor == System.Drawing.Color.Empty ? System.Drawing.Color.Black : PrintOverride.TextColor; - if (MyPageHelper != null && MyPageHelper.MySvg != null && MacroDef != null) - { - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("MC X={0} Y={1} {2}", XOffset - MyPageHelper.MySvg.LeftMargin, yLocation + MyPageHelper.TableAdjustment, MacroDef); - // PageList items are located with respect to the left margin, macros are not. - // B2019-094 - needed to account for TableAdjustment - checkoff in South Texas FSG20 Addendum 5 step 5 - MyPageHelper.MySvg.DrawMacro(MacroDef, XOffset - MyPageHelper.MySvg.LeftMargin, yLocation + MyPageHelper.TableAdjustment, cb); - } - PrintOverride.SvgColor = push; - if (textLayer != null) cb.EndLayer(); - cb.RestoreState(); - return yPageStart; - } - } -} diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs deleted file mode 100644 index c8f153f4..00000000 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ /dev/null @@ -1,7359 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -//using System.Drawing; -using System.Text.RegularExpressions; -using System.IO; -using iTextSharp.text.pdf; -using iTextSharp.text; -using Itenso.Rtf; -using Itenso.Rtf.Parser; -using Itenso.Rtf.Interpreter; -using Itenso.Rtf.Support; -using Volian.Controls.Library; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; - -namespace Volian.Print.Library -{ - public partial class vlnParagraphs : List - { - private vlnParagraph _Parent; - public vlnParagraph Parent - { - get { return _Parent; } - set { _Parent = value; } - } - public vlnParagraphs(vlnParagraph parent) - { - _Parent = parent; - } - // Step Designators are used by Comanche Peak and stored in their CAUTION2 type - // We need to save this information and not process it like a normal Caution. - private string _StepDesignator; - public string StepDesignator - { - get { return _StepDesignator; } - set { _StepDesignator = value; } - } - private float? _StepDesignatorColumn; - - public float? StepDesignatorColumn - { - get { return _StepDesignatorColumn; } - set { _StepDesignatorColumn = value; } - } - private VE_Font _StepDesignatorFont; - - public VE_Font StepDesignatorFont - { - get { return _StepDesignatorFont; } - set { _StepDesignatorFont = value; } - } - - public bool IsEnhancedBackgroundFormat(ItemInfo itminfo) - { - return ((itminfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds); - } - public bool IsEnhancedDeviationFormat(ItemInfo itminfo) - { - return ((itminfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations); - } - public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo) - { - return Add(cb, itemInfoList, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo, null); - } - public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo, PromsPrinter pp) - { - int profileDepth = ProfileTimer.Push(">>>> vlnParagraphs.Add"); - bool bxHlsDraw = false; - int? bxIndex = null; - vlnBox box = null; - float yTop = yoff; - ItemInfo lastChild = null; - string lastHeader = null; - bool didComponentTableRow = false; - float tableBottomMost = 0; - float xoffBase = xoff; - int prevTplRow = 0; - int maxRnoSav = maxRNO; - foreach (ItemInfo iChildItemInfo in itemInfoList) - { - if (pp != null) pp.OnStatusChanged((iChildItemInfo.DisplayNumber ?? "") == "" ? iChildItemInfo.DisplayText : iChildItemInfo.DisplayNumber, PromsPrinterStatusType.LoadVlnParagraph); - if (iChildItemInfo.IsFootnote) - { - vlnParagraph para = new vlnParagraph(Parent, cb, iChildItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight, true, iChildItemInfo.IsSection ? pp : null); - continue; // don't add it, vlnParagraph adds this item to the footnote list in ToPdf. - } - maxRNO = maxRnoSav; - if (iChildItemInfo.IsHigh) bxIndex = null; - if (iChildItemInfo.IsSection && (iChildItemInfo as SectionInfo).ColumnMode != maxRNO) - maxRNO = (iChildItemInfo as SectionInfo).ColumnMode; - int maxRnoTemplate = iChildItemInfo.TemplateChildColumnMode; - if (maxRnoTemplate >= 0) maxRNO = maxRnoTemplate - 1; - ItemInfo childItemInfo = iChildItemInfo; - int? bxIndx = childItemInfo.FormatStepData == null ? -1 : childItemInfo.FormatStepData.StepLayoutData.STBoxindex; - // if the Caution or Note is not boxed, then use ColT to set the starting column of the Note or Caution - if (((bxIndx ?? -1) == -1) && (childItemInfo.IsCaution || childItemInfo.IsNote) && !childItemInfo.IsInRNO && - !childItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Dev_Format && - !IsEnhancedBackgroundFormat(childItemInfo) && !IsEnhancedDeviationFormat(childItemInfo)) - //xoff += (float)childItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColT; - xoff = xoffBase + (float)childItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColT; - - // if in a ComponentTableFormat (FNP sub format 1, component list), column headers are defined - // by the first level of children. The data for the column is the child of the column header. - // Sometimes the column will not have data, the following handles that case. Also, use - // the boolean didComponentTableRow to keep track of the bottom most yoff of the table row. - if ((childItemInfo.MyDocStyle.ComponentList) && childItemInfo.MyParent.IsInTemplate() || - (childItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && childItemInfo.IsInTemplate())) - { - if (childItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - { - // if this template element has a -1 for row, print it (if = 0 this is a heading for edit - // and not printed). if this template element has a width of > 0, then also print it, - // these are headings and should be printed). This was added for Calvert Alarm (BGEALN) format for - // DEVICE/SETPOINT (row=-1), and for POSSIBLE CAUSES, AUTOMATIC ACTIONS, etc (width>0) - // find the indexes into the template for this item. The index must be for the HLS this is - // or this is under. - int tindx = childItemInfo.TemplateIndex; - if (tindx == -1) - xoff = (float)childItemInfo.MyDocStyle.Layout.LeftMargin; - else if (childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].row < 0 || - childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].width > 0) - { - // move down for the 'POSSIBLE CAUSES'. To know it's that step type, check - // the column field in template. -1 represents staying on same row but using - // the start template field to get the xoffset. - if (prevTplRow == -1 && prevTplRow != childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].row) - { - // position to the furthest down the page of the Device/setpoint/annunciator window: - yoff = Math.Max(yoff, Parent.YBottomMost + vlnPrintObject.SixLinesPerInch); - yoff = Math.Max(yoff, tableBottomMost + vlnPrintObject.SixLinesPerInch); - } - xoff = (float)childItemInfo.MyDocStyle.Layout.LeftMargin + (childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].start * 7.2f); - prevTplRow = childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].row; - } - } - else - { - // childItemInfo = 'child' and set to use a template for defining size. - // Note that the 'IsCaution1' was added for Calvert Valve lists, i.e. - // the Caution1 is a subheader & must be printed within the valve list table. - if (childItemInfo.Steps == null && !childItemInfo.IsCaution1) - continue; - if (!childItemInfo.IsCaution1) childItemInfo = childItemInfo.Steps[0]; - didComponentTableRow = true; - } - } - if (childItemInfo.FormatStepData != null && childItemInfo.FormatStepData.TabData != null && childItemInfo.FormatStepData.TabData.IsTransition) - { - lastHeader = childItemInfo.DisplayText; - } - else - { - if ((childItemInfo.IsCaution || childItemInfo.IsNote) && - childItemInfo.MyPrevious != null && childItemInfo.MyPrevious.MyContent.Type != childItemInfo.MyContent.Type && - childItemInfo.NextItem != null && childItemInfo.MyContent.Type == childItemInfo.NextItem.MyContent.Type) - childItemInfo.SetupTags(); // added for V.C. Summer Transition caution in EOP-15.0 step 5.4 - if (lastHeader != null) - { - childItemInfo.SetHeader(childItemInfo.FormatStepData.TabData.Font, lastHeader); - lastHeader = null; - } - // if the format has MatchUpRNOCautNote, then add a line to yoff, if not at top of rno column. - if (childItemInfo.FormatStepData != null && childItemInfo.FormatStepData.MatchUpRNO) - { - if (childItemInfo.MyParent != null && childItemInfo.MyParent.MyParent != null && !childItemInfo.MyParent.MyParent.IsHigh) - { - yoff += vlnPrintObject.SixLinesPerInch; - Parent.AdjustForMatchUpRNO = vlnPrintObject.SixLinesPerInch; // B2020-112 - } - } - // if this is a caution/note and it has a caution/note substep, do it before this caution/note, so that - // it comes above it. - if (childItemInfo.Cautions != null && (childItemInfo.IsCaution || childItemInfo.IsNote)) - yoff = Add(cb, childItemInfo.Cautions, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo); - if (childItemInfo.Notes != null && (childItemInfo.IsCaution || childItemInfo.IsNote)) - yoff = Add(cb, childItemInfo.Notes, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo); - //int? bxIndx = childItemInfo.FormatStepData == null ? -1 : childItemInfo.FormatStepData.StepLayoutData.STBoxindex; - bool boxHLS = false; - - // If this step has a previous, and its header is different than the previous's header. Allow it to go - // into the box code. Without this check, none of the box code is run. This caused a problem - // for VCS where two different type notes where not getting separate boxes. - bool doSeparateBoxHdrChg = false; - if (childItemInfo.MyPrevious != null && ((childItemInfo.MyHeader != null && childItemInfo.MyPrevious.MyHeader != null - && childItemInfo.MyHeader.CleanText != childItemInfo.MyPrevious.MyHeader.CleanText) || - (childItemInfo.MyHeader == null && childItemInfo.MyPrevious.MyHeader != null || childItemInfo.MyHeader != null && childItemInfo.MyPrevious.MyHeader == null))) - doSeparateBoxHdrChg = childItemInfo.MyPrevious.MyContent.Type != childItemInfo.MyContent.Type;//true; - - bool alwaysBox = (childItemInfo.IsHigh && childItemInfo.FormatStepData.BoxIt); - if ((alwaysBox || (bxIndx ?? -1) != -1) && (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt || childItemInfo.MyHeader != null || doSeparateBoxHdrChg || childItemInfo.FormatStepData.SeparateBox)) - { - if (childItemInfo.FormatStepData.BoxIt) // this is a boxed HLS - { - box = new vlnBox(); - box.MyBox = new Box(); - box.DefBox = vlnBox.BoxThin; - StepSectionLayoutData ssld = formatInfo.MyStepSectionLayoutData; - float colR = float.Parse(formatInfo.MyStepSectionLayoutData.ColRTable.Split(",".ToCharArray())[childItemInfo.ColumnMode]); - int widS = vlnPrintObject.ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, maxRNO); - box.DefEnd = (float)(ssld.ColS + colR + widS + (60 / 4.8)); - box.YOffset = yoff - .75F * vlnPrintObject.SixLinesPerInch; - } - else if (bxIndex == null) // First boxed step - { - if (childItemInfo.IsHigh) boxHLS = true; - box = new vlnBox(); - box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; - if (box.MyBox != null) - { - // B2022-130: Barakah warning box prints on bottom of section title if warning is on first HLS - if (box.MyBox.ThickDouble && childItemInfo.MyParent != null && childItemInfo.MyParent.IsHigh && childItemInfo.MyParent.ItemID == childItemInfo.MyParent.FirstSibling.ItemID) - { - if (!childItemInfo.MyParent.MyParent.MyDocStyle.CancelSectTitle) - yoff += vlnPrintObject.SixLinesPerInch; - } - box.YOffset = yoff; - int ln = 1; // a format flag determines whether there is a space before the note/caution. - if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; - if (!boxHLS || (boxHLS && !childItemInfo.HasCautionOrNote)) - { - // note that in the following line of code, the Calvert Alarms' caution1 is their annunciator window - // so it needs the extra lines as defined by 'ln' or the text will be too close to the top of the box. - if (!formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || iChildItemInfo.IsCaution1) - yoff += ln * vlnPrintObject.SixLinesPerInch; - else - yoff += vlnPrintObject.SixLinesPerInch; - } - if (box.MyBox != null) - yoff += (float)(box.MyBox.AdjSpB4Tab ?? 0); // F2024-078 adjust space above the Note/Caution box tab - } - bxIndex = bxIndx; - } - else // Change Box Style - { - bool handleSeparateBox = true; - if (childItemInfo.IsCaution && !childItemInfo.FormatStepData.SeparateBox && !childItemInfo.FormatStepData.SeparateBoxCautions) handleSeparateBox = false; - if (childItemInfo.IsNote && !childItemInfo.FormatStepData.SeparateBox) handleSeparateBox = false; - - if (bxIndx != null && (handleSeparateBox || bxIndex != bxIndx || doSeparateBoxHdrChg)) - { - bool didSeparateBoxChgYAdjust = false; - if (box != null) - { - box.Height = yoff - box.YOffset; // new height, with children - if (formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || - formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) - { - if (childItemInfo.MyHeader != null && childItemInfo.MyPrevious != null - && ((childItemInfo.MyPrevious.IsCautionOrNotePart && childItemInfo.IsCautionOrNotePart) - || childItemInfo.FormatStepData.SeparateBox)) - yoff += vlnPrintObject.SixLinesPerInch * 2; - } - else if (childItemInfo.MyHeader != null && childItemInfo.MyPrevious != null - && ((childItemInfo.MyPrevious.IsCaution && childItemInfo.IsCaution) || - (childItemInfo.MyPrevious.IsNote && childItemInfo.IsNote) || childItemInfo.FormatStepData.SeparateBox)) - yoff += vlnPrintObject.SixLinesPerInch * 2; - // B2020-026: Farley - Notes before Cautions/cautions and notes in same 'parts' list, so bxIndex what not null, need - // to add an extra line after note box. - else if (formatInfo.Name.ToUpper().StartsWith("FNP") && childItemInfo.MyPrevious != null && childItemInfo.MyPrevious.IsNote && childItemInfo.IsCaution) - yoff += vlnPrintObject.SixLinesPerInch * 2; - else if (doSeparateBoxHdrChg) // F2021-038: SHE/SHEA format - Less space after boxes (removes it below) - { - didSeparateBoxChgYAdjust = true; - yoff += vlnPrintObject.SixLinesPerInch * 2; - } - } - box = new vlnBox(); - box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; - // F2021-038: SHE/SHEA format - Less space after boxes - if (didSeparateBoxChgYAdjust && childItemInfo.IsStep && childItemInfo.FormatStepData.NoYBxAdjust) yoff -= vlnPrintObject.SixLinesPerInch; - int ln = 1; // a format flag determines whether there is a space before the note/caution. - //if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; - if (childItemInfo.MixCautionNotesDiffType()) ln += 2; - box.YOffset = yoff + ((ln - 1) * vlnPrintObject.SixLinesPerInch); - if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; - yoff += ln * vlnPrintObject.SixLinesPerInch; - if (box.MyBox != null) - yoff += (float)(box.MyBox.AdjSpB4Tab ?? 0); // F2024-078 adjust space above the Note/Caution box tab - } - } - bxIndex = bxIndx; - } - else if (((bxIndx ?? -1) == -1) && box != null) - { - // BGE STP has a null box for its 'Date Time Stamp', i.e. Note4, - // without this code if there is a previous sibling the 'Date Time Note' was - // included in its previous sibling's box: - // (STBoxindex="" is how Note4's box in BGE STP is defined - it is the only place - // in the format files that this is done) - box.Height = yoff - box.YOffset; // new height, with children - yoff += 2 * vlnPrintObject.SixLinesPerInch; - box = null; - } - // DoubleBoxHls is a format flag used by BGE to draw double lined boxes around their HLS - if (childItemInfo.IsHigh && ((childItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)) - { - boxHLS = true; - box = new vlnBox(); - box.MyBox = new Box(); - box.DefBox = vlnBox.DOUBLEboxHLS; - bxHlsDraw = true; - } - vlnParagraph para = null; - // Comanche peak or WCN bck Step designator - if (childItemInfo.IsCaution2 && childItemInfo.SameRowAsParent || - childItemInfo.IsCaution1 && childItemInfo.SameRowAsParent) - { - // Save the Step Designator information - // SameRowAsParentMultiLine currently used in Comanche Peak EOP and Flex formats - handles a hard return in the caution type - _StepDesignator = ((childItemInfo.SameRowAsParentMultiLines) ? childItemInfo.MulitLineStepDesignatorDisplayText : childItemInfo.DisplayText); - int typ = ((int)childItemInfo.MyContent.Type) % 10000; - _StepDesignatorColumn = formatInfo.PlantFormat.FormatData.StepDataList[typ].ColOverride; - E_Style es = (E_Style)childItemInfo.FormatStepData.Font.Style; - _StepDesignatorFont = new VE_Font(childItemInfo.FormatStepData.Font.Family, (int)childItemInfo.FormatStepData.Font.Size, es, (float)childItemInfo.FormatStepData.Font.CPI); - } - else - { - if (childItemInfo is SectionInfo) formatInfo = (childItemInfo as SectionInfo).LocalFormat ?? formatInfo; - if (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight); - if (childItemInfo.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.ContActBoxOnSubSteps && - box != null && box.MyBox != null && bxIndx == null) // point beach boxed substeps - { - box.Height = yoff - box.YOffset - (1F * vlnPrintObject.SixLinesPerInch); - box = null; - yoff += 1 * vlnPrintObject.SixLinesPerInch; - } - para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight, true, pp); - - // if doing the component list (FNP), keep track of the bottom most columns' data - // so this can be returned after the row is done. - tableBottomMost = Math.Max(tableBottomMost, para.YBottomMost); - if (box != null && box.MyParent == null) - { - box.MyParent = para; - para.PartsContainer.Add(box); - } - Add(para); - if (didComponentTableRow && iChildItemInfo.Steps != null && iChildItemInfo.Steps.Count > 1) - tableBottomMost = Math.Max(tableBottomMost, AddComponentTableSiblings(cb, iChildItemInfo.Steps[1], xoff, para.YBottomMost, rnoLevel, maxRNO, formatInfo, yoffRight, pp)); - - // Calvert Alarm's caution1 is the Annunciator window, i.e. in top right of page. Adjust - // y offset for this caution that is printed BELOW the hls. - if (childItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && iChildItemInfo.IsCaution1) para.MyHighLevelParagraph.YBottomMost = para.YBottomMost; - - // para.YBottomMost will have y for bottom of any substeps that are also enclosed in the box. - if (childItemInfo.IsStep && childItemInfo.MyHLS != null && childItemInfo.MyHLS.FormatStepData.UseSmartTemplate && para.ChildrenBelow.Count > 0 && para.ChildrenBelow[0].YBottomMost > para.YBottomMost) - yoff = para.ChildrenBelow[0].YBottomMost; - // if doing the component list (FNP), yoff for the HLS (if it's the component in the list, - // i.e. the leftmost item in the table), the yoff is either the HLS bottom, or the bottom most - // of all of the other columns' data. - else if (childItemInfo.IsHigh && childItemInfo.FormatStepData.UseOldTemplate && childItemInfo.MyDocStyle.ComponentList) - yoff = Math.Max(para.YBottom, para.YBottomMost) + vlnPrintObject.SixLinesPerInch; - // increment the y offset if not doing the ComponentTableFormat - else if (!para.UseTemplateKeepOnCurLine(childItemInfo)) - { - // B2019-028: These comments ARE NOT relevant and the code added, the if and the else/console.writeline - // are not correct (left in commented out so that change can be seen): - // Don't set to zero after a Word Section - // Otherwise the step section output will overlap previous step section output - // if in a sub section. - // To see the problem, create a section with three subsections. - // First section a multiple page step section - // Second section a word section - // Third section a step section - // skip the logic in the next three lines. (if to else) - //if (para.YBottomMost > 0) - yoff = para.YBottomMost; - //else - //Console.WriteLine("ERROR Would have changed yoff from {0} to zero",yoff); - } - // don't adjust YBottomost until after yoff is set for the RNO Separator - para.YBottomMost += para.YBottomMostAdjust; - if (box != null && childItemInfo.FormatStepData != null && childItemInfo.FormatStepData.BoxIt) - { - box.Height = yoff - box.YOffset - (1.1F * vlnPrintObject.SixLinesPerInch); - box = null; // if doing boxed steps, only do single sibling at a time. - } - if (bxHlsDraw) - { - box.YOffset = para.YTop; - box.Height = para.Height; - box = null; - } - else if (boxHLS) - { - // the following line controls whether there is 1 line or 2 lines between - // the box line & the starting/ending yoffset of the HLS. WEP2 had no extra line between - // box & top/bottom of step. The DiffContActBox was added for WEP2. - int boxLnAdjust = iChildItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox ? 1 : 2; - box.YOffset = para.YTop - (boxLnAdjust * vlnPrintObject.SixLinesPerInch); - boxLnAdjust = iChildItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox ? 1 : 0; - - // if the YBottomForBox is set, use it to define height. Note that this property was - // introduced for IP3 continuous hls (surrounded by the asterisk box), no other format/step type uses it. - if (para.YBottomForBox > 0) - box.Height = para.YBottomForBox - box.YOffset - (boxLnAdjust * vlnPrintObject.SixLinesPerInch); // para.YTop - (1.1F * vlnPrintObject.SixLinesPerInch); - else - box.Height = para.YBottomMost - box.YOffset - (boxLnAdjust * vlnPrintObject.SixLinesPerInch); // para.YTop - (1.1F * vlnPrintObject.SixLinesPerInch); - box = null; - } - } - if (boxHLS) - { - // if the next HLS is boxed also, only need 1 line separating, otherwise - // need 2. - ItemInfo nxt = childItemInfo.GetNextItem(); - int nxtIsBoxed = 2; - if (nxt != null && - nxt.FormatStepData.StepLayoutData.STBoxindex != null && nxt.FormatStepData.StepLayoutData.STBoxindex >= 0) nxtIsBoxed--; - if (nxt != null && (nxt.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS) nxtIsBoxed = 0; - yoff += (nxtIsBoxed * vlnPrintObject.SixLinesPerInch); - } - if (childItemInfo.IsSequential && childItemInfo.NextItem != null && childItemInfo.MyParent.IsHigh && ((childItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.XBlankW1stLevSub) == E_DocStructStyle.XBlankW1stLevSub)) - { - yoff += vlnPrintObject.SixLinesPerInch; - if (para != null) para.AdjustForXBlankW1stLevSub = vlnPrintObject.SixLinesPerInch; // B2020-112 - } - boxHLS = false; - lastChild = childItemInfo; - } - } - if (box != null && box.MyBox != null) - { - box.Height = yoff - box.YOffset; // new height, with children - // C2017-024 Wolf Creek wanted a hold point with out text and no extra blank lines in the caution/note box - // so if they put only a hard space in for the text, then we will print the note/caution box with only the tab text - // B2018-077 added check for parts under the note (ex. a table off of the note text) fix for Calvert OI-27B 6.11.B and 6.12.B - if (box.MyParent.MyItemInfo.MyContent.Text.StartsWith(@"\u160?") && box.MyParent.MyItemInfo.DisplayText.Length == 1 && box.MyParent.MyItemInfo.MyContent.ContentPartCount == 0) - { - box.Height -= 3 * vlnPrintObject.SixLinesPerInch; - yoff -= vlnPrintObject.SixLinesPerInch; - } - else - yoff += 2 * vlnPrintObject.SixLinesPerInch; - if (lastChild != null && lastChild.FormatStepData.AlwaysUseExtraLines && (lastChild.IsCaution || lastChild.IsNote)) - { - if (!lastChild.MyParent.IsHigh) - yoff += lastChild.ActiveFormat.PlantFormat.FormatData.StepDataList[2].StepLayoutData.STExtraSpace ?? 0; - } - } - // after the last child substep when doing a Component table row (FNP Component Lists), set the value - // of the yoff to be the bottom most line in the table. - if (didComponentTableRow) yoff = tableBottomMost; - ProfileTimer.Pop(profileDepth); - return yoff; - } - private float AddComponentTableSiblings(PdfContentByte cb, ItemInfo ii, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, float yoffRight, PromsPrinter pp) - { - // Some of the data for the valve lists (BGE) and component lists (FARLEY) have - // sibling data within a column, rather than hard returns within the same paragraph. - float tableBottomMost = 0; - while (ii != null) - { - vlnParagraph para = new vlnParagraph(Parent, cb, ii, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight, true, pp); - tableBottomMost = Math.Max(tableBottomMost, para.YBottomMost); - yoff = para.YBottomMost; - Add(para); - ii = ii.GetNextItem(); - } - return tableBottomMost; - } - public float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) - { - foreach (vlnParagraph child in this) - { - yPageStart = child.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - } - return yPageStart; - } - } - public partial class vlnParagraph : vlnPrintObject - { - // B2020-115 Create Static properties for vlnParagraph to limit the size of a figure and paginate large figures properly onto their own page. - public static float wMax = 0; - public static float hMax = 0; - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - public override string ToString() - { - return string.Format("{0} - {1} - {2} - '{3}'", this.MyItemInfo.ItemID, this.YTop, this.YSize, this.MyItemInfo.ShortPath); - } - private bool _PageBreakOnStep = false; - public bool PageBreakOnStep - { - get { return _PageBreakOnStep; } - set { _PageBreakOnStep = value; } - } - private bool HasCalvertMacro = false; // this step has the Calvert (BGE) Alarm CONDITION/RESPONSE macro associated with it - private float WidthNoLimit = 0; - private vlnTable _MyGrid; - public vlnTable MyGrid - { - get { return _MyGrid; } - set { _MyGrid = value; } - } - public float SectYPageStart = 0; - private bool _IsWordDocPara = false; - public bool IsWordDocPara - { - get { return _IsWordDocPara; } - set { _IsWordDocPara = value; } - } - public static bool HasPrefPageBreak = false; // use to track page breaks for supp info - public bool PrefPageBreak = false; - private bool _ShowSectionTitles; - public bool ShowSectionTitles - { - get { return _ShowSectionTitles; } - set { _ShowSectionTitles = value; } - } - - public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) - { - // Don't print section titles for supplemental information because the title is 'Supplemental Information': - if (MyItemInfo.IsSection && MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.SupInfoPdfPrint) return yPageStart; - //if(PartsAbove.Count > 0 && PartsAbove[0] is vlnHeader) - // if (PartsLeft.Count > 0 && PartsLeft[0] is vlnTab) - // //if((PartsLeft[0] as vlnTab).Text[0] != '\u25CF') - // _MyLog.WarnFormat("NoteTab '{0}','{1}','{2}','{3}','{4}','{5}','{6}'", (PartsAbove[0] as vlnHeader).Text, (PartsLeft[0] as vlnTab).Text, MyItemInfo.MyProcedure.DisplayNumber, MyItemInfo.MyHLS.DisplayText, - // MyItemInfo.ShortPath, MyItemInfo.FormatStepData.TabData.IdentPrint, MyItemInfo.FormatStepData.TabData.IdentEdit); - // - // 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 - foreach (Chunk chk in IParagraph.Chunks) - { - if (chk.Font.Size > 16) chk.SetTextRise(-2f); - } - if (MyItemInfo.IsFootnote && Processed) return yPageStart; - int pagenumTran = 0; - if ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountFoldoutPgs) == E_DocStructStyle.DontCountFoldoutPgs) - pagenumTran = MyPageHelper.CurrentPageNumberNoFoldouts; - else - pagenumTran = MyPageHelper.CurrentPageNumber; - if (MyItemInfo.PageNumber == -1) MyItemInfo.PageNumber = pagenumTran; - else if (MyItemInfo.PageNumberUsed != 0 && MyItemInfo.PageNumberUsed != pagenumTran) - { - if (PromsPrinter.TransPageNumProblems == null) PromsPrinter.TransPageNumProblems = new List(); - // C2017-018 Insert tabs between columns - string pnErr = string.Format("{0}\t{1}\t{2}\t{3}", MyItemInfo.ItemID, MyItemInfo.ShortPath, MyItemInfo.PageNumberUsed, pagenumTran); - PromsPrinter.TransPageNumProblems.Add(pnErr); - } - MyItemInfo.PageNumberNextPass = pagenumTran; - if (Processed) return yPageStart; - //float localYPageStart = yPageStart; - Processed = true; - if (_PartsAbove != null && _PartsAbove.Count > 0) - { - // For McGuire and Catawba, they use CustomSpacing which inserts a blank line before high level steps - // if we paginate on one of these blank lines, we want to skip that blank line so that there isn't an - // extra blank line at the top of the page. - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.CustomSpacing && - PartsAbove[0].YOffset + yTopMargin == yPageStart && PartsAbove[0].IParagraph.Content == " ") - { - if (MyItemInfo.IsHigh && ((YOffset - YTopMost) > SixLinesPerInch)) - { - //Console.WriteLine("==> {0} {1} MOST {2} DIF {3}", MyItemInfo.ShortPath, YOffset, YTopMost, YOffset - YTopMost); - yPageStart = yTopMargin + YTopMost; - } - else - yPageStart = yTopMargin + YOffset; - } - else - yPageStart = PartsAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - } - - if (MyItemInfo.IsHigh && ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)) yPageStart -= SixLinesPerInch; - if (MyItemInfo.IsHigh && MyItemInfo.MyDocStyle.SpecialStepsFoldout) yPageStart -= SixLinesPerInch; - if (MyItemInfo.IsHigh && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.DoSTExtraAtTop && (yPageStart - YTopMost == yTopMargin)) - { - yPageStart += ((MyItemInfo.FormatStepData == null) ? 0 : MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0); - // F2021-038: SHE/SHEA format - Less space after boxes: the AlwaysUseExtyraLines was removed in SHE/SHEA format, but the - // following adjustment to the y location of HLS when AT TOP of page is still needed, i.e. added the NoYBxAdjust check which is SHE/SHEA specific - if ((MyItemInfo.Cautions != null && (MyItemInfo.Cautions[0].FormatStepData.AlwaysUseExtraLines || MyItemInfo.Cautions[0].FormatStepData.NoYBxAdjust)) || (MyItemInfo.Notes != null && (MyItemInfo.Notes[0].FormatStepData.AlwaysUseExtraLines || MyItemInfo.Notes[0].FormatStepData.NoYBxAdjust))) - yPageStart -= ((MyItemInfo.FormatStepData == null) ? 0 : MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0); - } - // Save the HLS & RNO string in case the pagelist item uses it (some of the backgrounds): - if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.PageBreakOnStep) - { - MyPageHelper.HLSTAB = MyItemInfo.HighLevelStepTabPageList; - // find the rno and use it's tab for the HLRNO part. - ItemInfo rno = MyItemInfo.RNOs != null && MyItemInfo.RNOs.Count > 0 ? MyItemInfo.RNOs[0] : null; - string rnotab = (rno == null) ? null : rno.DisplayText; - MyPageHelper.HLRNO = rno == null ? null : MyItemInfo.FormatStepData.TabData.RNOIdent + rnotab; - MyPageHelper.ResetSvg(); - } - - float yLocation = CalculateYOffset(yPageStart, yTopMargin); - if (MyItemInfo.HasChangeBar && MyPageHelper.ChangeBarDefinition.MyChangeBarType != PrintChangeBar.Without) MyPageHelper.AddChangeBar(DoChangeBar(cb, MyItemInfo, MyPageHelper, XOffset, yLocation, MyPageHelper.MaxRNO, MyItemInfo.ActiveFormat), cbMess); - float retval = yLocation; - // 'doprint' will always be true if not doing NSP's {HLSTEXT} token in page list. The following code is used to prevent - // printing the High level step, if the high level step is printed from the pagelist using {HLSTEXT} token. - bool doprint = !(MyPageHelper.DidHLSText && MyItemInfo.ItemID == MyPageHelper.HasHLSTextId); - if (MyItemInfo.IsFigure) - { - yLocation -= (SixLinesPerInch * MyPageHelper.YMultiplier); - if (ImageText != null) - retval = DrawFigure(cb, yBottomMargin, yLocation, yPageStart, yTopMargin); - else - retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); - if (MyItemInfo.IsInSupInfo) _yPageStartForSupInfo = retval; - } - else if (MyItemInfo.IsRtfRaw) - { - retval = DrawRaw(cb, yBottomMargin, yLocation, yPageStart, yTopMargin); - if (MyItemInfo.IsInSupInfo) _yPageStartForSupInfo = retval * .6f; - } - else if (!MyItemInfo.IsStepSection - || (ShowSectionTitles - && !MyItemInfo.MyDocStyle.CancelSectTitle - && !MyItemInfo.MyDocStyle.SpecialStepsFoldout)) // Don't ouput the Step Section title - { - // if this is a section, then check the section config for printable header too. - if (MyItemInfo.IsSection) - { - SectionConfig sch = MyItemInfo.MyConfig as SectionConfig; - //if (!(ShowSectionTitles - // && !MyItemInfo.MyDocStyle.CancelSectTitle - // && !MyItemInfo.MyDocStyle.SpecialStepsFoldout - // && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) - // && - if (sch != null && sch.Section_PrintHdr != "Y") doprint = false; - } - if (MyItemInfo.MyContent.MyGrid != null) - { - int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawGrid"); - // RHM20150507 Include Footer - retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin + (float)MyItemInfo.MyDocStyle.Layout.FooterLength, ref yLocation); // RHM20150429 - Table Scrunch - if (MyItemInfo.IsInSupInfo) _yPageStartForSupInfo = (float)MyPageHelper.BottomContent - SixLinesPerInch; - ProfileTimer.Pop(profileDepth); - } - else - { - if (doprint) - { - int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawText"); - IsCompressed = (MyPageHelper.YMultiplier != 1 && MyItemInfo != null && MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.Font.Size >= 12 && (MyItemInfo.FormatStepData.Font.Style & E_Style.Underline) != 0); - - retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); - // _yPageStartForSupInfo is used to move steps down the page for the supinfo pdf. Each supinfo step may not be related to previous in structure, so need this to set y location. - if (MyItemInfo.IsInSupInfo) _yPageStartForSupInfo = retval; - // Wolf Creek Training format puts a separator line after printing the section number/title - if (MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.WCNTraining) - MyPageHelper.SectionSepLineYoffStart = retval - (SixLinesPerInch / 2); - SectionContinuePrinted = true; - ProfileTimer.Pop(profileDepth); - } - } - if (MyItemInfo.IsHigh) - { - // C2025-014 change the zoom setting on the bookmark of a step from FITBH to FITV so that instead of zooming in - // on the step it will zoom to the page level ( like it does when you select a bookmark on a section. - MyPageHelper.PageBookmarks.Add(MyItemInfo, (MyItemInfo.MyTab == null) ? "" : MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText, - new PdfDestination(PdfDestination.FITV, yLocation + YVeryTop - YTopMost + SixLinesPerInch)); - } - } - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfcreekCKLFormat) - { - DrawChkOrValveTableLines(cb, MyItemInfo, yPageStart, yTopMargin, yBottomMargin, yLocation); - } - if (MyItemInfo.IsSection) - { - SectionConfig sc = MyItemInfo.MyConfig as SectionConfig; - if ((MyItemInfo.MyDocStyle != null && MyItemInfo.MyDocStyle.IncludeInTOC && (sc == null || sc.Section_TOC != "Y")) - || ((MyItemInfo.MyDocStyle == null || !MyItemInfo.MyDocStyle.IncludeInTOC) && (sc != null && sc.Section_TOC == "Y"))) - { - string tocKey = string.Format("TOC{0}", MyItemInfo.ItemID); - if (MyPageHelper.MyTOCPageCounts.ContainsKey(tocKey)) - { - PageCount pc = MyPageHelper.MyTOCPageCounts[tocKey]; - if (pc.Total == 0) - { - pc.Total = MyPageHelper.CurrentTOCPageNumber + 1; - pc.DrawTemplates(); - - } - } - } - } - else if (MyItemInfo.IsHigh && MyItemInfo.MyDocStyle != null && MyItemInfo.MyDocStyle.IncludeInTOC) // && (MyItemInfo.MyActiveSection.MyConfig as SectionConfig).Section_HLS_on_TOC == "Y") - { - // C2021-015: Barakah High Level Steps in Table of Contents - SectionConfig sc = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - StepConfig stc = MyItemInfo.MyConfig as StepConfig; - if ((sc != null && sc.Section_TOC != "Y") && (stc != null && stc.Step_IncludeInTOC)) - { - string tocKey = string.Format("TOC{0}", MyItemInfo.ItemID); - if (MyPageHelper.MyTOCPageCounts.ContainsKey(tocKey)) - { - PageCount pc = MyPageHelper.MyTOCPageCounts[tocKey]; - if (pc.Total == 0) - { - pc.Total = MyPageHelper.CurrentTOCPageNumber + 1; - pc.DrawTemplates(); - - } - } - } - } - if (!doprint) return yPageStart; - if (_PartsLeft != null && _PartsLeft.Count > 0) yPageStart = PartsLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - if (_PartsRight != null && _PartsRight.Count > 0) yPageStart = PartsRight.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - if (_PartsBelow != null && _PartsBelow.Count > 0) yPageStart = PartsBelow.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - if (_PartsContainer != null && _PartsContainer.Count > 0) yPageStart = PartsContainer.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - - //if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart); - return yPageStart; - } - - private float DrawRaw(PdfContentByte cb, float yBottomMargin, float yLocation, float yPageStart, float yTopMargin) - { - if (DebugText.IsOpen) DebugText.WriteLine("{0},'{1}','{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText); - float retval = yLocation; - System.Drawing.Size sz = RtfRawItem.GetRtfRawSize(MyItemInfo.MyContent.Text); - Height = sz.Height; - Width = sz.Width; - Volian.Controls.Library.RTF myRtb = new RTF(); - myRtb.Size = sz; - myRtb.Rtf = MyItemInfo.MyContent.Text; - try - { - System.Drawing.Image image = new System.Drawing.Bitmap((int)Width, (int)Height); - System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(image); - myRtb.RenderClipped(gr, new System.Drawing.Rectangle(0, 0, (int)Width, (int)Height)); - // B2017-116 Adjust Image Size by Scaler (Used for Facing Pages - Sup Info) - // B2017-241 Adjust Bottom Message Location for the raw figure (Equation or Visio) - MyPageHelper.BottomContent = yLocation - (.6F * Height * MyPageHelper.YMultiplier * ImageScaler); - retval = Rtf2Pdf.RtfRawAt(cb, image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier * ImageScaler, Height * MyPageHelper.YMultiplier * ImageScaler, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.ToUpper().Contains("BORDERLESS")); - } - catch (Exception ex) - { - return retval + 2 * SixLinesPerInch; // couldn't print equation, just print 2 blank lines. - } - return retval; - } - private bool _SectionContinuePrinted = false; - - public bool SectionContinuePrinted - { - get { return _SectionContinuePrinted; } - set { _SectionContinuePrinted = value; } - } - private void DrawChkOrValveTableLines(PdfContentByte cb, ItemInfo ii, float yPageStart, float yTopMargin, float yBottomMargin, float yLocation) - { - if (!ii.IsStep || ii.IsCaution || ii.IsNote) return; - - Box bx = ii.ActiveFormat.PlantFormat.FormatData.BoxList[0]; - float lpi = MyPageHelper.YMultiplier == 1.0 ? SixLinesPerInch : _SevenLinesPerInch; - bool savedebug = Rtf2Pdf.PdfDebug; - Rtf2Pdf.PdfDebug = false; - // 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 - // window handle B2017-117 - //System.Drawing.Font symbFont = new System.Drawing.Font("VESymbFix", (float)ii.FormatStepData.Font.Size); - System.Drawing.Font symbFont = VE_Font.GetWinSysFont("VESymbFix", (float)ii.FormatStepData.Font.Size); - iTextSharp.text.Font iSymblFont = Volian.Svg.Library.VolianPdf.GetFont(symbFont); - iSymblFont.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black)); - // The vertPos array from the format defines the column locations: - string[] vertPos = ii.MyHLS.FormatStepData.VertPos.Split(",".ToCharArray()); - // Count how many vertical lines are in the checklist table: - int cntVertPos = vertPos.Length - 1; - while (vertPos[cntVertPos] == "0" && cntVertPos > 0) cntVertPos--; - cntVertPos++; - Paragraph paraVertLine = new Paragraph(ii.ActiveFormat.PlantFormat.FormatData.BoxList[0].BXVert, iSymblFont); - float lWidth = 100; - float csize = 6 - .3f; // added the .3 to make line up with 16bit. - - // if High Level Step, just need to do edges for number of lines: - if (ii.IsHigh) - { - // count # of '{\par} commands in prefix and suffix. - int countLine = 0; - string preSuf_Fix = (ii.FormatStepData.Prefix != null && ii.FormatStepData.Prefix != "") ? ii.FormatStepData.Prefix : null; - if (preSuf_Fix != null) countLine++; // account for a line of prefix (if no \par) - // if this is a proportional font, need to 'draw' the prefix/suffix. NOTE that the suffix should - // just list the headers and the prefix can be 'empty'. - if (ii.FormatStepData.Font.FontIsProportional()) - { - float yLocVertLine = yLocation + (lpi * 1.5F); // +(lpi / 2); - // Prefix, i.e. Top line: - Paragraph topLeftLine = new Paragraph(bx.BXULC, iSymblFont); - Rtf2Pdf.TextAt(cb, topLeftLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); - Paragraph topRightLine = new Paragraph(bx.BXURC, iSymblFont); - Rtf2Pdf.TextAt(cb, topRightLine, float.Parse(vertPos[cntVertPos - 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); - Paragraph horzLine = new Paragraph(bx.BXHorz, iSymblFont); - float thPos = float.Parse(vertPos[0]) + csize; - while (thPos < float.Parse(vertPos[cntVertPos - 1])) - { - Rtf2Pdf.TextAt(cb, horzLine, thPos + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); - thPos += csize; - } - - // Vertical Lines around HLS - //int countLine = (int)(this.Height / lpi); - yLocVertLine = yLocation + (lpi/2);// -(lpi / 2); - for (int i = 0; i < 1; i++) - { - Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); - Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[cntVertPos - 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); - yLocVertLine -= lpi; - } - - // Suffix, i.e. Column headers. - // first do left/right side chars above and below column headers - //countLine = (int)(this.Height / lpi); - Paragraph sideLeftLine = new Paragraph(bx.BXMLS, iSymblFont); - Rtf2Pdf.TextAt(cb, sideLeftLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); - Rtf2Pdf.TextAt(cb, sideLeftLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine - (2 * lpi), lWidth, 100, null, yBottomMargin); - Paragraph sideRightLine = new Paragraph(bx.BXMRS, iSymblFont); - Rtf2Pdf.TextAt(cb, sideRightLine, float.Parse(vertPos[6]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); - Rtf2Pdf.TextAt(cb, sideRightLine, float.Parse(vertPos[6]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine - (2 * lpi), lWidth, 100, null, yBottomMargin); - - // now do the lines with the 'T' type lines for top/bottom of vertical lines. - thPos = float.Parse(vertPos[0]) + csize; - while (thPos < float.Parse(vertPos[cntVertPos - 1])) - { - Rtf2Pdf.TextAt(cb, horzLine, thPos + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); - Rtf2Pdf.TextAt(cb, horzLine, thPos + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine - (2 * lpi), lWidth, 100, null, yBottomMargin); - thPos += csize; - } - - // now do the vertical bar between header words and the column header words. - yLocVertLine -= lpi; - string[] colHdrs = _MyItemInfo.FormatStepData.Suffix.Substring(_MyItemInfo.FormatStepData.Suffix.IndexOf(";") + 1).Split(",".ToCharArray()); - iTextSharp.text.Font iHdrFont = Volian.Svg.Library.VolianPdf.GetFont(_MyItemInfo.FormatStepData.Font.WindowsFont); - iHdrFont.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black)); - - Paragraph topT = new Paragraph(bx.BXUMID, iSymblFont); - Paragraph crossT = new Paragraph(bx.BXMID, iSymblFont); - - for (int i = 0; i < cntVertPos; i++) - { - // do vertical line: - Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[i]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); - // do the column header text - center it: - if (i < colHdrs.Length) - { - Paragraph parColHdr = new Paragraph(colHdrs[i], iHdrFont); - // find the center point of column header and subtract 1/2 width of the text to locate the text. - float hloc = (float.Parse(vertPos[i]) + ((float.Parse(vertPos[i + 1]) - float.Parse(vertPos[i])) / 2)); - Chunk chk = (Chunk)parColHdr.Chunks[0]; - hloc = hloc - (chk.GetWidthPoint() / 2); - Rtf2Pdf.TextAt(cb, parColHdr, hloc + (float)ii.MyDocStyle.Layout.LeftMargin, yLocVertLine, lWidth, 100, null, yBottomMargin); - } - // Do the crosswise table characters, i.e. T and + - if (i > 0 && i < colHdrs.Length) - { - Rtf2Pdf.TextAt(cb, topT, float.Parse(vertPos[i]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine + lpi, lWidth, 100, null, yBottomMargin); - Rtf2Pdf.TextAt(cb, crossT, float.Parse(vertPos[i]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine - lpi, lWidth, 100, null, yBottomMargin); - } - } - } - else - #region OriginalHLS - { - int hIndx = preSuf_Fix.IndexOf(@"{\par}"); - while (preSuf_Fix != null && hIndx >= 0) - { - hIndx = preSuf_Fix.IndexOf(@"{\par}", hIndx + 1); - countLine++; - } - preSuf_Fix = (ii.FormatStepData.Suffix != null && ii.FormatStepData.Suffix != "") ? ii.FormatStepData.Suffix : null; - if (preSuf_Fix != null) countLine++; // account for a line of suffix (if no \par) - hIndx = preSuf_Fix.IndexOf(@"{\par}"); - while (preSuf_Fix != null && hIndx >= 0) - { - hIndx = preSuf_Fix.IndexOf(@"{\par}", hIndx + 1); - countLine++; - } - // get first and last vertpos for location of lines: - // for each line of text, draw the start & end box line: - countLine = (int)(this.Height / lpi) - countLine; - float yLocVertLine = yLocation - lpi / 2; - for (int i = 0; i < countLine; i++) - { - Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); - Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[cntVertPos - 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); - yLocVertLine -= lpi; - } - } - #endregion OriginalHLS - } - else - { - // This section of code draws the lines around the substeps (the actual table part) - Paragraph horzLine = new Paragraph(ii.ActiveFormat.PlantFormat.FormatData.BoxList[0].BXHorz, iSymblFont); - bool bottomOfTable = ii.NextItem == null || - (MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].MyItemInfo.ItemID == ii.NextItem.ItemID); - // if bottom of table use different cross/beg/end chars than if in middle of table. - Paragraph leftLine = new Paragraph(bottomOfTable ? bx.BXLLC : bx.BXMLS, iSymblFont); - Paragraph rightLine = new Paragraph(bottomOfTable ? bx.BXLRC : bx.BXMRS, iSymblFont); - - // If this item is in the leftmost column in table, this is determined by looking at its parent, - // its parent must be a HLS, do the vertical lines since all cells have all vertical lines. - // Lines should be drawn from current to ybottommost. Also draw the bottom line. - if (ii.MyParent.IsHigh) - { - // first do the vertical bars. - float curY = yLocation; - while (curY > (yPageStart - this.YBottomMost + lpi)) - { - for (int i = 0; i < cntVertPos; i++) - Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[i]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, curY + 3, lWidth, 100, null, yBottomMargin); - curY -= lpi; - } - // Now do the bottom line for this item. - Paragraph crossLine = new Paragraph(bottomOfTable ? bx.BXLMID : bx.BXMID, iSymblFont); - float yloc = yPageStart - this.YBottomMost + 18; - Rtf2Pdf.TextAt(cb, leftLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yloc, lWidth, 100, null, yBottomMargin); - float hPos = float.Parse(vertPos[0]) + csize; - int doHorizCnt = 0; - while (doHorizCnt < cntVertPos - 1) - { - while (hPos < float.Parse(vertPos[doHorizCnt + 1])) - { - Rtf2Pdf.TextAt(cb, horzLine, hPos + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yloc, lWidth, 100, null, yBottomMargin); - hPos += csize; - } - - // put out middle piece, i.e. + (cross) lines or bottom line - hPos = float.Parse(vertPos[doHorizCnt + 1]); - if (doHorizCnt < cntVertPos - 2) // don't put out crossLine on last one. - Rtf2Pdf.TextAt(cb, crossLine, float.Parse(vertPos[doHorizCnt + 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yloc, lWidth, 100, null, yBottomMargin); - hPos += csize; - doHorizCnt++; - } - // put out the right side piece - Rtf2Pdf.TextAt(cb, rightLine, float.Parse(vertPos[cntVertPos - 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yloc, lWidth, 100, null, yBottomMargin); - } - // Now handle middle parts of the table. For whatever sub level we're at, draw the cross character - // and the horizontal. This is case where the component number may have multiple descriptions,positions, etc. associated - // with it. - if (!ii.MyParent.IsHigh && ii.NextItem != null) - { - // draw horizontally from this sublevel to the end. - int sublev = 0; - ItemInfo par = this.MyItemInfo; - while (!par.IsHigh) - { - sublev++; - par = par.MyParent; - } - sublev--; - float ylocs = yPageStart - this.YBottomMost + 15; - for (int i = sublev; i < cntVertPos - 1; i++) - { - float hPos = float.Parse(vertPos[i]) + csize; - Rtf2Pdf.TextAt(cb, leftLine, float.Parse(vertPos[i]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, ylocs, lWidth, 100, null, yBottomMargin); - while (hPos < float.Parse(vertPos[i + 1])) - { - // do the horizontal line - Rtf2Pdf.TextAt(cb, horzLine, hPos + (float)ii.MyDocStyle.Layout.LeftMargin - csize, ylocs, lWidth, 100, null, yBottomMargin); - hPos += csize; - } - } - // Do the last cross character - Rtf2Pdf.TextAt(cb, rightLine, float.Parse(vertPos[cntVertPos - 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, ylocs, lWidth, 100, null, yBottomMargin); - } - } - Rtf2Pdf.PdfDebug = savedebug; - } - private float DrawGrid(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) - { - //DebugText.WriteLine("{0},'{1}','{2}','<>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText); - if (DebugText.IsOpen) DebugText.WriteLine("{0},'{1}','{2}','<>',{3}", MyItemInfo.ItemID, MyItemInfo.ShortPath, MyItemInfo.MyContent.Text, XOffset); - //if (MyItemInfo.InList(11019,11024,111026)) // RHM20150507 Table Scrunch - // Console.WriteLine("here"); - float heightBefore = (MyGrid.Height + 4) * MyPageHelper.YMultiplier; // B2020-014 added parenthesis was calculating wrong for 7lpi Callaway FSG-7 Attachment 7 - // B2018-033 Account for bottom continue message when seeing if a scrunched table will fit - float ySizeBtmCtnMess = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle); - // B2018-085 Ignore the bottom continue message if the Table is the last part of the step. - if(ySizeBtmCtnMess > 0 && MyParent.MyItemInfo.IsHigh && YBottomMost == MyParent.YBottomMost) ySizeBtmCtnMess = 0; - // TableScrunch Phase 1: Is height of table greater than what will fit on current page. - if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase1) && heightBefore > (yLocation - (yBottomMargin + ySizeBtmCtnMess))) - { - // TooBig is the amount of height that the grid is larger than the amount of space on the page. It is set to - // (height of grid w/ compressed setting if needed + line) - (how much room on page) - // NOTE TooBig actually will do the adjustments of the row heights by eliminating the blank space! - MyGrid.TooBig = SixLinesPerInch + MyGrid.Height * MyPageHelper.YMultiplier - (yLocation - yBottomMargin - ySizeBtmCtnMess); - float heightAfter = (MyGrid.Height + 4) * MyPageHelper.YMultiplier; // B2020-014 added parenthesis was calculating wrong for 7lpi Callaway FSG-7 Attachment 7 - MyPageHelper.TableAdjustment += (heightBefore - heightAfter); - MyPageHelper.AdjustedTable = this; // B2020-059 - save the information of the table that is being compressed (used in RTF2PDF.cs TextAt()) - MyPageHelper.AdjustedTableYtop = yLocation; // B2020-059 save the top location of the compressed table (used in RTF2PDF.cs TextAt()) - //B2018-092 Determine if the Table is too big by checking it including either 6 LPI or 7 LPI as appropriate - if (heightAfter * MyPageHelper.YMultiplier < (yLocation - yBottomMargin - ySizeBtmCtnMess)) - { - // B2018-081 - Removed error log message if the code was able to properly adjust the table - //_MyLog.WarnFormat("\r\n==> Table is too big to fit on page, Vertical Padding adjusted to fit in\r\n" + - // " [{0}] {1}\r\n" + - // " in {2}\r\n" + - // " Height Before={3:N2} Height After={4:N2} SpaceAvailable={5:N2}\r\n" + - // " No action necessary", - // MyItemInfo.ItemID,_MyItemInfo.ShortPath, - // _MyItemInfo.SearchDVPath.Replace("\a", "/"), heightBefore / 72, MyGrid.Height / 72, (yTopMargin - yBottomMargin) / 72); - //_MyLog.ErrorFormat("<<< WARNING >>> Table is too big to fit on page, Vertical Padding adjusted to fit\r\n==>'Table Adjusted',{0},'{1}','{2}',{3},{4},{5}" - // , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, heightBefore, MyGrid.Height, (yTopMargin - yBottomMargin)); - } - else - MyGrid.IsTooBig = true; - if (MyItemInfo.HasChangeBar && MyPageHelper.ChangeBarDefinition.MyChangeBarType != PrintChangeBar.Without) - { - foreach (vlnChangeBar vcb in MyPageHelper.MyChangeBars) - { - if (vcb.Height == heightBefore / MyPageHelper.YMultiplier - 4) - { - float heightDif = (heightBefore - heightAfter); - vcb.YChangeBarBottom += heightDif; - FixMessages(vcb, heightDif); - break; - } - } - } - } - //B2018-092 Correct the location of the bottom continue message including either 6 LPI or 7 LPI as appropriate - MyPageHelper.BottomContent = yLocation - (MyGrid.Height + 4) * MyPageHelper.YMultiplier; - float retval = Rtf2Pdf.GridAt(cb, MyGrid, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless")); - //B2018-092 Determine if the Table is too big by checking it including either 6 LPI or 7 LPI as appropriate - if ((MyGrid.Height + 4)* MyPageHelper.YMultiplier > (yLocation - yBottomMargin - ySizeBtmCtnMess)) - { - // B2018-081 Changed the Error Log Message to be more useful when a table is too big. - _MyLog.ErrorFormat("\r\n===> Table is too big to fit on page, expect pagination problems in\r\n" + - " 1> Item [{0}] {1}\r\n" + - " 2> in {2}\r\n" + - " 3> Height Before={3:N2} Height After={4:N2} SpaceAvailable={5:N2}\r\n" + - " 4> ACTION REQUIRED: Table should be restructured or split over multiple pages", - MyItemInfo.ItemID, _MyItemInfo.ShortPath, - _MyItemInfo.SearchDVPath.Replace("\a", "/"), heightBefore/72, MyGrid.Height/72, (yTopMargin - yBottomMargin)/72); - //_MyLog.ErrorFormat("<<< ERROR >>> Table is too big to fit on page, expect pagination problems\r\n==>'Table Too Big',{0},'{1}','{2}',{3},{4},{5}" // RHM20150429 - Table Scrunch - // , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, heightBefore, MyGrid.Height, (yTopMargin - yBottomMargin)); - } - return retval; - } - - private void FixMessages(vlnChangeBar vcb, float heightDif) - { - SortedDictionary msd = vcb.Messages; - vcb.Messages = new SortedDictionary(); - foreach (float key in msd.Keys) - { - vcb.Messages.Add(key + heightDif, msd[key]); - } - } - private float DrawText(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) - { - if (DebugText.IsOpen) DebugText.WriteLine("{0},'{1}','{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText); - //Console.WriteLine("{0},{1},'{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content); - float retval = yLocation; - if (MyItemInfo.IsRtfRaw) - { - retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin, MyItemInfo.ItemID); // C2018-004 ItemID for create meta file for baseline compares - return retval; - } - - // Calvert Alarms have a special case, center text if the next/previous is not the same type of caution or note. - // Calvert Alarms have a note1 that is a warning. if a regular note preceeded it, this regular note was not centered. - // F2023-126: Vogtle Alarms - center single line caution/note if more than one type exist off step, added the check for NoteCautionCenterOneAllTypes - bool doAlign = false; - if ((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert || MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.NoteCautionCenterOneAllTypes) && (MyItemInfo.IsCaution || MyItemInfo.IsNote || MyItemInfo.IsNote1)) - { - bool diffAsPrev = MyItemInfo.MyPrevious == null || (MyItemInfo.MyPrevious != null && MyItemInfo.MyContent.Type != MyItemInfo.MyPrevious.MyContent.Type); - bool diffAsNext = MyItemInfo.NextItem == null || (MyItemInfo.NextItem != null && MyItemInfo.MyContent.Type != MyItemInfo.NextItem.MyContent.Type); - if (diffAsPrev && diffAsNext) doAlign = true; - } - // Check if only one line, i.e. "Height < (1.2F * IParagraph.Leading". The Leading can be for six or seven lines per inch, so the 1.2 - // multiplier accounts for both. - // B2021-091 added a null reference check - MyItemInfo was a section and didn't have FormatStepData - // F2021-042: Added FormatStepData.AlwaysCenter for BNPP1 - Critical Step text always must be centered - // B2022-146: Left Justify Note & Caution text that has sub-steps (for Beaver Valley) - bool cnWithChildren = !MyItemInfo.IsStepSection && MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.CenterOnlyIfNoSubs && MyItemInfo.HasChildren; - if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.CenterOneLineOnly && !cnWithChildren && ((MyItemInfo.MyPrevious == null && MyItemInfo.NextItem == null) - || MyItemInfo.FormatStepData.SeparateBox || doAlign || MyItemInfo.FormatStepData.AlwaysCenter) && Height < (1.2F * IParagraph.Leading)) - IParagraph.Alignment = Element.ALIGN_CENTER; - // if this step is centered, but not part of the checklist or valvelist format, use itextsharp to center it. - // if it was part of the checklist or valvelist, then the centering is based on the column definitions for the table and - // was calculated when the paragraph was made. - // B2021-091 added a null reference check - MyItemInfo was a section and didn't have FormatStepData - if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.StepPrintData.Justify == "Center" && !MyItemInfo.FormatStepData.StepLayoutData.AlignWithParentTab) - IParagraph.Alignment = Element.ALIGN_CENTER; - if (PrefixSpecialCharacter && IParagraph.Chunks.Count > 0) - { - Chunk chk = IParagraph.Chunks[0] as Chunk; - if (chk.Content == " ") - { - PrefixSpecialCharacter = false; - //Console.WriteLine("Special {0}", MyItemInfo.MyHLS.DisplayText); - IParagraph.Chunks.RemoveAt(0); - } - } - // if printing checklist header, adjust ypagestart & ylocation so that won't get forced pagination (pagination is already ok) - //Console.WriteLine("'Q1',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); - if (PrintHeader) - { - yPageStart = yTopMargin + YVeryTop; - yLocation = yPageStart - YOffset; // yLocation is physical location from bottom of page. - } - if (yLocation - Height < 24) - { - if (DebugPagination.IsOpen) - DebugPagination.WriteLine("Very Low {0},{1},{2},{3},{4},{5}", MyItemInfo.ShortPath, MyItemInfo.ItemID, yLocation, Height, yLocation - Height, yTopMargin - MyItemInfo.MyDocStyle.Layout.PageLength); - //C2018-015 add debug pagination to meta file - if (BaselineMetaFile.IsOpen) - BaselineMetaFile.WriteLine("!! Very Low {0},{1},{2},{3},{4},{5}", MyItemInfo.ShortPath, MyItemInfo.ItemID, yLocation, Height, yLocation - Height, yTopMargin - MyItemInfo.MyDocStyle.Layout.PageLength); - } - int profileDepth = ProfileTimer.Push(">>>> Rtf2Pdf.TextAt"); - // ooooooooo. oooooooooo. oooooooooooo ooooooooooooo o8o . o8o - // `888 `Y88. `888' `Y8b `888' `8 8' 888 `8 `"' .o8 `"' - // 888 .d88' 888 888 888 888 oooo d8b .oooo. ooo. .oo. .oooo.o oooo .o888oo oooo .ooooo. ooo. .oo. .oooo.o - // 888ooo88P' 888 888 888oooo8 888 `888""8P `P )88b `888P"Y88b d88( "8 `888 888 `888 d88' `88b `888P"Y88b d88( "8 - // 888 888 888 888 " 888 888 .oP"888 888 888 `"Y88b. 888 888 888 888 888 888 888 `"Y88b. - // 888 888 d88' 888 888 888 d8( 888 888 888 o. )88b 888 888 . 888 888 888 888 888 o. )88b - // o888o o888bood8P' o888o o888o d888b `Y888""8o o888o o888o 8""888P' o888o "888" o888o `Y8bod8P' o888o o888o 8""888P' - // - // Design Suggestion: - // During vlnParagraaph Constuctor Build an end point dictionary - // During toPdf check for end points before adding GoTos for Local - // Need to have a way to get to sections which do not have any output (header only) - // Need to have a way to identify procedures - // - // B2018-034 The following code previously used IParagraph rather than _IParagraph. If the variable IsCompressed (7LPI) is true for this step - // IParagraph would be refreshed each time it was referenced. Thus the link information would be lost when the IParagraph was re-created. - // This resulted in PDFLinks to steps that were not not identified with a LocalDestination. This was changed from the original code to - // fix B2015-076 when the Byron Flex Procedure 0BFSG-6 was printed. The issue for this bug was that the underlining at 7LPI was overlaping the - // top of the next line of text. I was not able to find the case referencedd in the source safe document. However, by adding a line of - // text "One more line" to the end of step 2 in attachment C, I was able to see the effect. - if (_IParagraph.Chunks.Count > 0 && MyPageHelper.MyPromsPrinter.SaveLinks) - { - // B2018-034 The following code previously used IParagraph rather than _IParagraph. See first Comment - Chunk chk1 = _IParagraph.Chunks[0] as Chunk; - if (MyItemInfo.MyContent.Text.ToUpper().Contains("LINK:TR") && MyItemInfo.MyContent.ContentTransitionCount==0) - Console.WriteLine("Missing Transition {0}", MyItemInfo.ItemID); - chk1.SetLocalDestination(string.Format("ItemID={0}", MyItemInfo.ItemID)); // Destination - // B2019-052: If multiple ROs/Transitions within a step, each should have a their own link rather than all linking to same thing. - // Note the pdf link code that was here was moved to Rtf2iTextSharp.cs in DoVisitText so that each 'chunk' could have a link. - // The code that remained here was the code that marks the destination for each step & the code that does the pdf links for - // enhanced steps. - // Also, the method GetDefaultItemInfo was moved to Rtf2iTextSharp.cs also - it was only called from code that was moved. - - StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config); - DVEnhancedDocuments dveds = MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments; - foreach (EnhancedDocument ed in sc.MyEnhancedDocuments) - { - DVEnhancedDocument dved = dveds.GetByType(ed.Type); - AddLinkToEnhancedDocument(cb, yLocation, ed.ItemID, dved.PdfToken, dved.PdfX); - } - // MyPageHelper.BottomContent = yLocation - Height; - //if (MyItemInfo.InList(39048)) Console.WriteLine("Here"); - } - MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier); - retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin, MyItemInfo.ItemID); // C2018-004 ItemID for create meta file for baseline compares - ProfileTimer.Pop(profileDepth); - if (retval == 0) // problem occurred - paragraph was not able to be printed on page - { // pagination logic needs to be fixed. - // oooooooooooo ooooooooo. o8o . o8o - // `888' `8 `888 `Y88. `"' .o8 `"' - // 888 .ooooo. oooo d8b .ooooo. .ooooo. 888 .d88' .oooo. .oooooooo oooo ooo. .oo. .oooo. .o888oo oooo .ooooo. ooo. .oo. - // 888oooo8 d88' `88b `888""8P d88' `"Y8 d88' `88b 888ooo88P' `P )88b 888' `88b `888 `888P"Y88b `P )88b 888 `888 d88' `88b `888P"Y88b - // 888 " 888 888 888 888 888ooo888 888 .oP"888 888 888 888 888 888 .oP"888 888 888 888 888 888 888 - // 888 888 888 888 888 .o8 888 .o 888 d8( 888 `88bod8P' 888 888 888 d8( 888 888 . 888 888 888 888 888 - // o888o `Y8bod8P' d888b `Y8bod8P' `Y8bod8P' o888o `Y888""8o `8oooooo. o888o o888o o888o `Y888""8o "888" o888o `Y8bod8P' o888o o888o - // d" YD - // "Y88888P' - ForcePagination(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation, ref retval); - } - else - { - if (MyItemInfo.IsStepSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && (MyItemInfo.ActiveSection as SectionInfo).HasInitials) - { - if (MyPageHelper.PrintInitials(cb, yLocation, (float)MyItemInfo.MyDocStyle.Layout.LeftMargin)) - { - //if(yLocation != yTopMargin) - // Console.WriteLine("'{0}',{1},'{2}',{3},{4},{5},{6}", MyItemInfo.MyProcedure.DisplayNumber, MyItemInfo.ItemID - // , MyItemInfo.DisplayNumber, yLocation,yTopMargin,MyItemInfo.HasCautionOrNote,MyPageHelper.CurrentPageNumber+1); - } - } - } - return retval; - } - private static void AddLinkToEnhancedDocument(PdfContentByte cb, float yLocation, int itemID, String token, int xLocation) - { - ItemInfo ii = ItemInfo.Get(itemID); - //B2020-133 if "ii" is null, then the itemid was not found- probable enhanced step was deleted. so just return with out creating a link - if (ii == null) return; - string prefix = ii.MyDocVersion.DocVersionConfig.Print_PDFFilePrefix ?? ""; - string suffix = ii.MyDocVersion.DocVersionConfig.Print_PDFFileSuffix ?? ""; - ColumnText ct = new ColumnText(cb); - ct.SetSimpleColumn(xLocation, yLocation - 12, xLocation + 30, 12 + yLocation); - iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 12); - Chunk chk = new Chunk(token); - chk.SetRemoteGoto(prefix + ii.MyProcedure.DisplayNumber.Replace("/", "_") + suffix + ".pdf", string.Format("ItemID={0}", itemID)); - chk.SetBackground(new Color(System.Drawing.Color.LemonChiffon)); - ct.AddElement(chk); - cb.SetColorFill(Color.BLUE); - ct.Go(); - - //foreach (Chunk chk in IParagraph.Chunks) - //{ - // chk.SetRemoteGoto(ii.MyProcedure.DisplayNumber.Replace("/", "_") + ".pdf", string.Format("ItemID={0}",ii.ItemID)); - // chk.SetBackground(new Color(System.Drawing.Color.LemonChiffon)); - //} - } - private static bool _MissingInitials = false; - - public static bool MissingInitials - { - get { return vlnParagraph._MissingInitials; } - set { vlnParagraph._MissingInitials = value; } - } - public static void TextAt(PdfContentByte cb, VlnSvgPageHelper myPageHelper, PageItem pi, float yloc, float leftMargin) - { - System.Drawing.Color sysColor = PrintOverride.OverrideSvgColor(System.Drawing.Color.Black); - cb.SaveState(); - if (myPageHelper.PageListLayer != null) cb.BeginLayer(myPageHelper.PageListLayer); - ColumnText ct = new ColumnText(cb); - iTextSharp.text.Font font; - int fontStyle = 0; - bool underline = false; - if (pi == null) // The header for the signoffs is missing in the current section format. - // An Example can currently be found in Calvert OI-34 - { - if (!MissingInitials) // Only show this once. - { - _MyLog.WarnFormat("Initials Header Missing" + - "\r\nInitials header missing for section {0}" + - "\r\nfrom format [{1}], {2}, subformat {3}" + - "\r\nA default Arial font and a default location will be used." + - "\r\nPerhaps another section format should be used.", - myPageHelper.MySection.ShortPath, - myPageHelper.MySection.ActiveFormat.Name, - myPageHelper.MySection.ActiveFormat.Description, - myPageHelper.MySection.MyDocStyle.Name); - MissingInitials = true; - } - ct.SetSimpleColumn(450 + leftMargin, yloc + 6.9F, 550 + leftMargin, yloc - 50); - font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 10F); - } - else - { - ct.SetSimpleColumn((float)pi.Col + leftMargin, yloc + 6.9F, (float)pi.Col + 100 + leftMargin, yloc - 50); - fontStyle = (pi.Font.WindowsFont.Bold ? iTextSharp.text.Font.BOLD : 0) + (pi.Font.WindowsFont.Italic ? iTextSharp.text.Font.ITALIC : 0); - font = FontFactory.GetFont(pi.Font.Family, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, (float)pi.Font.Size, fontStyle); - underline = pi.Font.WindowsFont.Underline; - } - Chunk chk = new Chunk("INITIALS", font); - if (underline) - chk.SetUnderline(new iTextSharp.text.Color(sysColor), 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size - Phrase ph = new Phrase(chk); - ct.AddElement(ph); - cb.SetColorFill(new iTextSharp.text.Color(sysColor)); - ct.Go(); - if (myPageHelper.PageListLayer != null) cb.EndLayer(); - cb.RestoreState(); - } - private bool _PrintHeader = false; - public bool PrintHeader - { - get { return _PrintHeader; } - set { _PrintHeader = value; } - } - private bool CalvertPrintedSubSectTitle = false; // B2020-123 - private static List myAttributes = new List(); - private static void AddAttribute(string attr) - { - if (myAttributes.Contains(attr)) - return; - //Console.WriteLine("Attribute = \"{0}\"", attr); - myAttributes.Add(attr); - } - private void CheckAttributes(System.Collections.Hashtable attributes) - { - foreach (string attr in attributes.Keys) - { - AddAttribute(attr); - } - } - private string FormattedText - { - get - { - bool subscript = false; - //if (_MyItemInfo.ItemID == 467) - // Console.Write(""); - StringBuilder sb = new StringBuilder(); - //if (IParagraph.Chunks.Count > 1) - // Console.WriteLine("{0} Chunks", IParagraph.Chunks.Count); - foreach (Chunk chk in IParagraph.Chunks) - { - string prefix = ""; - string suffix = ""; - CheckAttributes(chk.Attributes); - if (chk.Font.BaseFont != null && chk.Font.BaseFont.PostscriptFontName.ToUpper().Contains("BOLD")) - { - prefix += "\xD5"; - suffix = "\xD6" + suffix; - } - if (chk.Attributes.ContainsKey("SUBSUPSCRIPT")) - { - float sup = (float)(chk.Attributes["SUBSUPSCRIPT"]); - if (sup > 0) - { - prefix += "\xA6"; - suffix = "\xD1" + suffix; - } - else if (sup < 0) - { - prefix += "\xD1"; - suffix = "\xA6" + suffix; - } - - } - if (chk.Attributes.ContainsKey("UNDERLINE")) - { - prefix += "\x16"; - suffix = "\x16" + suffix; ; - } - sb.Append(prefix + chk.Content + suffix); - } - string retval = sb.ToString(); - retval = retval.Replace("\xD1\xA6", "");// Remove Multiple Superscript commands in a row - retval = retval.Replace("\xA6\xD1", "");// Remove Multiple Superscript commands in a row - retval = retval.Replace("\xD6\xD5", ""); - retval = retval.Replace("\xD6\x16\xD5", "\x16"); - return retval; - } - } - private float _ImageScaler = 1F; - /// - /// Scaler used to adjust the Image Size on Sup Info (Facing Pages) - /// - public float ImageScaler - { - get { return _ImageScaler; } - set { _ImageScaler = value; } - } - //private bool _TextDebug = false; //true; this will turn on a writeline with debug in DrawText() - private float DrawFigure(PdfContentByte cb, float yBottomMargin, float yLocation, float yPageStart, float yTopMargin) - { - int profileDepth = ProfileTimer.Push("vlnParagraph.DrawFigure"); - float retval = yLocation; - if (ImageText != null) - { - if (ImageText == "figure") - { - ImageConfig ic = new ImageConfig(MyItemInfo.MyContent.MyImage); - // B2016-277: add a try catch in case of there being 'bad' data in the text field for an image/figure - try - { - byte[] idata = (ic != null && ic.Image_DataSize > 0) ? ROImageInfo.Decompress(MyItemInfo.MyContent.MyImage.Data, ic.Image_DataSize) : MyItemInfo.MyContent.MyImage.Data; - MemoryStream ms = new MemoryStream(idata); - System.Drawing.Image img = System.Drawing.Image.FromStream(ms); - Width = img.Width; - Height = img.Height; - if (ic != null && ic.Image_Height != 0) - { - Width = ic.Image_Width; - Height = ic.Image_Height; - } - // B2020-115 Limit the figure size to the space available in a page. - float mult = 1.0F; - if (Width > (vlnParagraph.wMax-12)) mult = (vlnParagraph.wMax-24) / Width; - if (Height > (vlnParagraph.hMax-36)) mult = Math.Min(mult, (vlnParagraph.hMax-36) / Height); - if (mult < 1.0F) - { - Width = Width * mult; - Height = Height * mult; - } - iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(idata); - // B2017-241 Adjust Bottom Message Location for the figure - MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier); - // B2017-112 Adjust Image Size by Scaler (Used for Facing Pages - Sup Info) - retval = Rtf2Pdf.FigureAt(cb, it_image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier * ImageScaler, Height * MyPageHelper.YMultiplier * ImageScaler, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"), MyItemInfo.ItemID, SixLinesPerInch); // C2018-004 added ItemID for create meta file for baseline compares - } - catch - { - retval += SixLinesPerInch; - } - } - else - { - string[] vals = ImageText.Split("\n".ToCharArray()); - ProcedureInfo proc = MyItemInfo.MyProcedure; - DocVersionInfo dvi = proc.ActiveParent as DocVersionInfo; - ROFstInfo rofst = dvi.DocVersionAssociations[0].MyROFst; - ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]); - if (roImage == null) roImage = rofst.GetROImageByFilename(vals[0], MyItemInfo);// need code to go and get an ROImaage if it exists - if (roImage != null) - { - ROImageConfig rc = new ROImageConfig(roImage); - int size = Convert.ToInt32(rc.Image_Size); - byte[] cnt = roImage.Content; - byte[] dcnt = ROImageInfo.Decompress(cnt, size); - iTextSharp.text.Image it_image = null; - try - { - it_image = iTextSharp.text.Image.GetInstance(dcnt); - } - catch - { - MemoryStream ms = new MemoryStream(dcnt); - System.Drawing.Bitmap bm = new System.Drawing.Bitmap(ms); - using (MemoryStream ms2 = new MemoryStream()) - { - bm.Save(ms2, System.Drawing.Imaging.ImageFormat.Png); - ms2.Seek(0, SeekOrigin.Begin); - byte[] newdcnt = new byte[ms2.Length]; - ms2.Read(newdcnt, 0, (int)ms2.Length); - try - { - it_image = iTextSharp.text.Image.GetInstance(newdcnt); - } - catch (Exception ex) - { - _MyLog.Error(string.Format("{0}", roImage.FileName), ex); - return yLocation; - } - } - } - StepInfo si = (StepInfo)MyItemInfo; - StepConfig sc = new StepConfig(si.MyContent.Config); - if (sc != null && sc.Step_ImageWidth != 0) - { - Width = sc.Step_ImageWidth; - Height = sc.Step_ImageHeight; - } - // B2017-241 Adjust Bottom Message Location for the figure - MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier); - retval = Rtf2Pdf.FigureAt(cb, it_image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier, Height * MyPageHelper.YMultiplier, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"), MyItemInfo.ItemID, SixLinesPerInch); - } - } - // The following code was added to fix B2016-219 (for VCS, the centerline drew through a figure). The 'top' value was taken from the code - // that draws the vlnBoxes (Caution/Note, etc) - // The adjustments, adjtop & adjbottom, were necessary to get the vertical centerline to meet up correctly with the top/bottom of the figure. These - // numbers were determined by trial and error. - - // only add gap if centered, i.e. in 2 column mode & table is centered - if (MyItemInfo.ColumnMode > 0 && (!MyItemInfo.FormatStepData.Type.Contains("AER") && !MyItemInfo.IsInRNO)) - { - float top = CalculateYOffset(yPageStart, yTopMargin) - (7 * MyPageHelper.YMultiplier); - float adjtop = 0; - float adjbottom = 0; - if (MyPageHelper.YMultiplier == 1) - adjtop = -3; - else - adjbottom = -1; - MyPageHelper.MyGaps.Add(new Gap(top + adjtop, top - Height - Rtf2Pdf.Offset.Y + adjbottom)); - } - } - ProfileTimer.Pop(profileDepth); - return retval; - } - private string DebugInfo - { - get - { - if (!Rtf2Pdf.PdfDebug) return "No Path"; - int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DebugInfo"); - string retval = string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} ShortPath={5} Width={6} Left={7} YOffset={8}, PaginationLevel = {9}, yPageSize = {10}", - DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData == null ? "NoStepData" : MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.ShortPath, Width, XOffset, YOffset, levelForPagination, yPageSizeForPagination); - ProfileTimer.Pop(profileDepth); - return retval; - } - } - private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin) - { - float _PointsPerPage = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files - // if this document style has another style that is for pages other than first, we need to - // reset the document style off of this section AND reset docstyle values used. - // C2018-003 fixed use of getting the active section - if (MyItemInfo.ActiveSection != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0) - { - ItemInfo ii = (ItemInfo)MyItemInfo.ActiveSection; - int indx = (int)MyItemInfo.ActiveSection.MyDocStyle.IndexOtherThanFirstPage; - foreach (DocStyle ds in ii.ActiveFormat.PlantFormat.DocStyles.DocStyleList) - { - if (ds.Index == indx) - { - // C2018-004 create meta file for baseline compares - // B2020-008: removed some code that was causing the header to not get refreshed, and uncommented - // out the ResetSvg command below. - Volian.Base.Library.BaselineMetaFile.WriteLine("Reset DocStyle to \"{0}\"",ds.Name); - MyItemInfo.ActiveSection.MyDocStyle = ds; - MyPageHelper.MySection = MyItemInfo.ActiveSection as SectionInfo; - MyPageHelper.MySection.MyDocStyle = ds; - MyPageHelper.ResetSvg(); - break; - } - } - MyPageHelper.DidFirstPageDocStyle = true; - if (DebugPagination.IsOpen) DebugPagination.WriteLine("ResetDocStyleAndValues"); - if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! ResetDocStyleAndValues"); //C2018-015 add debug pagination to meta file - MyPageHelper.MySection = (SectionInfo)MyItemInfo.ActiveSection; - yTopMargin = _PointsPerPage - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.TopMargin; - yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.PageLength); - } - // B2020-047 move check of PrintSectionPage to after the ResetSvg - // B2020-152 un-did the change for B2020-047 which was put in for Westinghouse. The issue reported for B2020-047 remained corrected - else if (MyPageHelper.PrintedSectionPage > 0) - { - MyPageHelper.ResetSvg(); - if (MyItemInfo.ActiveSection != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PrintSectOnFirst) == E_DocStructStyle.DSS_PrintSectOnFirst) - { - yTopMargin = _PointsPerPage - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.TopMargin + MyPageHelper.PrintedSectionPage; - MyPageHelper.YTopMargin = yTopMargin; - yBottomMargin = Math.Max(0, _PointsPerPage - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.TopMargin - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.PageLength); - } - } - } - private string GetSectCombinedTab(ItemInfo tmp) - { - ItemInfo itemInfo = tmp; - if (itemInfo.IsCautionOrNotePart) itemInfo = itemInfo.ActiveParent as ItemInfo; // if caution/note get to its associated step - itemInfo = itemInfo.ActiveParent as ItemInfo; // don't want this one in the combined tab, start at parent - // B2018-084: continue message had bullets in it that didn't have correct font. The message should not have had bullets at - // all - in the following line, there was an 'if' rather than a 'while' - go up parents until find the correct step type - // don't just go up 1 level. - while (!itemInfo.IsHigh && !itemInfo.IsSequential && !itemInfo.IsSection) itemInfo = itemInfo.ActiveParent as ItemInfo; - string prTab = ""; - string thisTab = itemInfo.MyTab.CleanText.Trim(); - if (!itemInfo.IsSection || itemInfo.IsSeparateSubsection) - { - ItemInfo mypar = itemInfo.MyParent; - while (mypar != null && !mypar.IsProcedure) - { - // The following check was added for BGE/OI34. Their APPENDIX sections had the subsections - // printing with incorrect tab in the SectionTitleContinued message. Before this - // fix the tabs were A.B Procedure (Continued) rather than B. Procedure (Continued). - // Unfortunately there was not enough time to make the 'if' statement based on config - // or format settings. - bool addTab = true; - if (mypar.IsSection && mypar.DisplayNumber.ToUpper().Contains("APPENDIX ")) - { - SectionConfig sch = mypar.MyConfig as SectionConfig; - addTab = (sch == null || sch.Section_PrintHdr == "Y");// && !mypar.MyDocStyle.CancelSectTitle; - } - if (addTab) - { - string pTab = mypar.MyTab.CleanText.Trim(); - if (pTab.Length > 0 && char.IsLetterOrDigit(pTab[0])) - { - pTab = pTab.TrimEnd(" .".ToCharArray()) + "."; - prTab = pTab + prTab; - } - else - { - // There' a bullet or some other graphics character. - // clear out the tab we are building so the we can build - // a continue tab up to this bullet or graphic character. - prTab = ""; - thisTab = ""; - } - } - mypar = (mypar.IsSection && !mypar.IsSeparateSubsection) ? null : mypar.MyParent; - } - } - return (prTab + thisTab.Trim()).TrimEnd(".".ToCharArray()); - } - private static bool DoSubs = true; // flag whether to print substeps (don't if doing continued checklist header) - public float AdjustForXBlankW1stLevSub = 0; // B2020-112 this & next line - public float AdjustForMatchUpRNO = 0; - protected float _ContinueHeight = 0; - public virtual float ContinueHeight - { - get - { - int profileDepth = ProfileTimer.Push(">>>> vlnPrintObject.ContinueHeight"); - if (_ContinueHeight == 0 - && MyItemInfo.MyDocStyle.Continue.Top.Message != null - && MyItemInfo.MyDocStyle.Continue.Top.Message.Contains("%s") - && MyItemInfo.MyDocStyle.Continue.Top.Message.ToUpper().EndsWith(" (Continued)".ToUpper())) - { - string suffix = MyItemInfo.MyDocStyle.Continue.Top.Message.Replace("%sR", "").Replace("%s", ""); - _ContinueHeight = GetParagraphHeight(MyContentByte, IParagraph, suffix, Width); - } - ProfileTimer.Pop(profileDepth); - return _ContinueHeight; - } - set { _Height = value; } - } - // Check if the parent section has both an editable steps section and a sub-section - private bool ParentHasSectionAndSteps() - { - if (!MyItemInfo.ActiveParent.IsSection) return false; - SectionInfo parent = MyItemInfo.ActiveParent as SectionInfo; - bool hasSteps = false; - bool hasSections = false; - foreach(PartInfo pi in parent.MyContent.ContentParts) - { - if (pi.FromType == (int)E_FromType.Step && parent.SectionConfig.SubSection_Edit == "Y") hasSteps = true; - if (pi.FromType == (int)E_FromType.Section) hasSections = true; - } - return hasSteps && hasSections; - } - public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) - { - int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.ToPdf"); - if (MyItemInfo.ActiveFormat.Name.ToUpper().StartsWith("FNP") && MyItemInfo.IsSection && ParentHasSectionAndSteps()) - MyPageHelper.BottomMessage.Clear(); // B2017-266 reset the END message on the sub-section - if (MyItemInfo.IsFootnote && Processed) - { - ProfileTimer.Pop(profileDepth); - return yPageStart; - } - if (MyItemInfo.IsInSupInfo) // if generating the pdf for supinfos (facing page) pdf, need a different cb to go to that file. - { - MyContentByte = cb; - MyPageHelper = null; - } - bool doThreeContinues = false; - // For BGE, the very first subsection's pagelist items were not correct - the section/meta section titles were - // at the wrong level. Reset the page helper's section. - if (MyItemInfo.IsStepSection) - { - if (MyItemInfo.IsSection && MyItemInfo.MyPrevious == null && MyItemInfo.MyParent.IsSection && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseWestinghouse) - { - // don't do the following for the WCN training format: - // if parent was continuous & this is separate, don't reset document style to subsection (next page) type - // this was putting incorrect pagelist item on parent section's page. This occurred in BGE/OI3 set/OI-7 procedure/10.0 Attachments. - // B2017-273 added a check for Farley format, we don't want the subsection pagelist infor to appear on the parent section page - works with Paginate() logic - (section has steps and a sub-section ex: FNP-2-EEP-0 Attachment 4) - if (!MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.WCNTraining && !MyItemInfo.ActiveFormat.Name.ToUpper().StartsWith("FNP") && (MyParent.MyItemInfo as SectionInfo).IsSeparatePagination() || !(MyItemInfo as SectionInfo).IsSeparatePagination()) - { - MyPageHelper.MySection = MyItemInfo as SectionInfo; - MyPageHelper.ResetSvg(); - } - } - } - // For Calvert Alarms: A macro exists around the CONDITION/RESPONSE portion. If the page break occurs so that - // this 'table' moved to the following page AND there is an associated note/caution that is not on the next page, - // remove the macro so that the header macro doesn't print on the page with the note (without this, an extraneous - // header for the 'table'is printed. - if (PartsLeft.Count != 0 && (PartsLeft[0] is vlnMacro) && MyPageHelper.ParaBreaks.Count != 0 && MyPageHelper.ParaBreaks[0].MyItemInfo.MyPrevious == null) - if (!MyPageHelper.ParaBreaks[0].MyItemInfo.IsNote && !MyPageHelper.ParaBreaks[0].MyItemInfo.IsCaution) - { - // Only clear the header if it is the first child below - if (ChildrenBelow[0].MyItemInfo.ItemID == MyPageHelper.ParaBreaks[0].MyItemInfo.ItemID) - PartsLeft.Clear(); - //else - // _MyLog.WarnFormat("Would Have Cleared PageHeader '{0}','{1}'", MyItemInfo.MyProcedure.DisplayNumber, MyItemInfo.MyHLS.DisplayText); - } - if (IsWordDocPara) - { - SectionInfo si = SectionInfo.Get(MyItemInfo.ItemID); - //Changing this caused Header issues for FNP FNP-1-FRP-1.3 Attachment 3 (Word Sub-Sections) - //SectionInfo si1 = MyItemInfo.GetSectionInfo(); - //CompareSectionInfo(si, si1); - MyPromsPrinter.NewPage(true); - //_MyLog.InfoFormat("NewPage 9 {0}", cb.PdfWriter.CurrentPageNumber); - // Add Bookmark for Word Subsections - MyPageHelper.PageBookmarks.Add(si, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null); - MyPageHelper.MyPromsPrinter.CreateWordDocPdf(cb, si); - Processed = true; - { - ProfileTimer.Pop(profileDepth); - return yPageStart; - } - } - float yLocalypagestart = yPageStart; - // yPageStart is offset into roll; YTopMost is offset of topmost of this paragraph. - float yLocation = yPageStart - YTopMost; - - // If this document style has a pagelist item with a continue (some IP2BCK docstyles), clear - // out the variable that flags a continue message - MyPageHelper.OldTemplateContMsg = false; - - if (DebugText.IsOpen) DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortPath, XOffset, yLocation, yPageStart, YTopMost); - int profileDepth1 = ProfileTimer.Push(">>>> vlnParagraph.Paginate"); - int paginate = Paginate(yLocation, yTopMargin, yBottomMargin); - ProfileTimer.Pop(profileDepth1); - bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null); - bool doSectionTitleContinued = false; // will add " Continued" to the section title if format flag is set - DocStyle docstyle = null; - // If SAMG facing page print & doing first pass to generate page break list of supplemental info and - // there was a page break in the step section, but not an associated supinfo item, do the page break when the - // next supinfo item is found: - SectionInfo supInfoSect = MyItemInfo.ActiveSection as SectionInfo; // C2018-003 fixed use of getting the active section - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks && MyPromsPrinter.NeedSupInfoBreak && MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0) - { - // if this has a caution/note with supinfo, that is id that needs to go in pagination list, unless it is in there. - int aboveSupinfoId = ChildrenAboveHaveSupInfo(); - if (supInfoSect != null) - { - if (supInfoSect.StepSectPageBreaksForSupInfo.Contains(aboveSupinfoId)) aboveSupinfoId = -1; - supInfoSect.StepSectPageBreaksForSupInfo.Add(aboveSupinfoId != -1 ? aboveSupinfoId : MyItemInfo.SupInfos[0].ItemID); - } - MyPromsPrinter.NeedSupInfoBreak = false; - } - bool itemIsPrinted = false; - switch (paginate) - { - // .oooooo. .oooo. - // d8P' `Y8b d8P'`Y8b - // 888 .oooo. .oooo.o .ooooo. 888 888 - // 888 `P )88b d88( "8 d88' `88b 888 888 - // 888 .oP"888 `"Y88b. 888ooo888 888 888 - // `88b ooo d8( 888 o. )88b 888 .o `88b d88' - // `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' `Y8bd8P' - case 0: // No page break - if (MyItemInfo.IsSection) - { - SectionInfo si = MyItemInfo as SectionInfo; - MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null); - DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart); - } - // SupInfo has its own pagination and ylocation handling, reset ypagestart & ylocation if continuing on current page. - // The value used was saved when the previous SupInfo step was printed. - if (MyItemInfo.IsSupInfoPart) - { - yPageStart = _yPageStartForSupInfo - SixLinesPerInch; - yLocation = yPageStart - YTopMost; - } - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge) - { - // printing a procedure with section(s) that have supplemental information - determine facing page needed to be merged in. For - // case 0, it is typically at the beginning of the section since the page break occurred in the code that calls this. - // Note that if the procedure has any sections with supinfo, then the entire procedure will need facing pages, either blank page - // or supinfo steps. - // If the section title is printed, then need to get the facing page before the section title is printed and if - // this is the hls where the section title was printed, don't do the facing page. - bool titlePrinted = false; - if (MyItemInfo.IsSection || (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null)) - { - // see if the section title is printed. - SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - titlePrinted = (sch == null || sch.Section_PrintHdr == "Y") || !(MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps; - titlePrinted &= (ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle); - } - // If this is first step section and there is no supinfo, the blank page was done in proms printer. - // If this is first step section and there is supinfo, it needs to be put out - bool notFirstOrFirstHasSupInfo = false; - bool firstSec = true; - foreach (SectionInfo sec in MyItemInfo.MyProcedure.Sections) - { - if (sec.IsStepSection) - { - if (MyItemInfo.ActiveSection != null && sec.ItemID == MyItemInfo.ActiveSection.ItemID) break; // C2018-003 fixed use of getting the active section - firstSec = false; - break; - } - } - notFirstOrFirstHasSupInfo = !firstSec || (MyItemInfo.ActiveSection != null && (MyItemInfo.ActiveSection as SectionInfo).HasSupInfoSteps); // C2018-003 fixed use of getting the active section - if (notFirstOrFirstHasSupInfo && ((MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null && !titlePrinted) || (MyItemInfo.IsStepSection && titlePrinted)) && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) - { - // If there is supplemental information to be printed on the facing page, then get the id that has supinfo - // so that it can be retrieved from the pdf for the supinfos for this section. - int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); - if (sid != -1) - { - MyPromsPrinter.DoSupInfoPage(cb, "TEMP", MyPageHelper.TextLayer, MyPageHelper, sid, true); - } - else - { - MyPromsPrinter.InsertBlankPage(cb); - } - } - } - if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null && ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)) - yPageStart -= SixLinesPerInch; - if (MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].CompressFirstPartOfStep) - MyPageHelper.YMultiplier = _SevenLinesPerInch / SixLinesPerInch; - if (CompressFoldout) - MyPageHelper.YMultiplier = _SevenLinesPerInch / SixLinesPerInch; - - ///else - /// MyPageHelper.YMultiplier = 1; - break; - // .oooooo. .o - // d8P' `Y8b o888 - //888 .oooo. .oooo.o .ooooo. 888 - //888 `P )88b d88( "8 d88' `88b 888 - //888 .oP"888 `"Y88b. 888ooo888 888 - //`88b ooo d8( 888 o. )88b 888 .o 888 - // `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' o888o - case 1: // Break on High Level Step - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks) - { - // page break here, determine if there is caution/note above where the page break actually needs to go: - int aboveSupinfoId = ChildrenAboveHaveSupInfo(); - if (supInfoSect!=null && MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0 && aboveSupinfoId > 0) supInfoSect.StepSectPageBreaksForSupInfo.Add(aboveSupinfoId); - else if (supInfoSect != null && MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0) supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID); - else MyPromsPrinter.NeedSupInfoBreak = true; - if (supInfoSect!=null) supInfoSect.StepSectPageBreaks.Add(MyItemInfo.ItemID); - } - YTopMost = OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); - docstyle = MyItemInfo.MyDocStyle; - if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin); - bool doSectionContinue = !MyItemInfo.IsSection && ((docstyle.StructureStyle.Style & E_DocStructStyle.BottomSectionContinue) == E_DocStructStyle.BottomSectionContinue); - if (doSectionContinue) DoBottomContinueMsg(cb, yBottomMargin, yLocation, docstyle, false); - MyPromsPrinter.NewPage(); - //_MyLog.InfoFormat("NewPage 10 {0}", cb.PdfWriter.CurrentPageNumber); - if (MyItemInfo.IsSection && MyParent != null && MyParent.MyItemInfo.IsSection && (MyItemInfo as SectionInfo).IsSeparatePagination()) - { - // F2023-015 for Beaver Valley as two sub-sections that are printed continuously followed by a third sub-section printed - // with separate pagination. This section type uses a different pagelist for the pages after the first page. - // Needed to call ResetDocStyleAndValues to set the new page with the other pagelist sytle. - ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); - RefreshDocStyle(); - yTopMargin = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize) - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.TopMargin; // C2018-003 fixed use of getting the active section // C2020-002 paper size is now set in the format files - yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.PageLength); // C2018-003 fixed use of getting the active section - yPageStart = yTopMargin; - } - else if (MyItemInfo.IsSection || (MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null)) //do not reset for 1st step - { - //Console.WriteLine("'b1',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); - ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); - //Console.WriteLine("'a1',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); - } - DebugText.WriteLine("Paginate1"); - if (MyItemInfo.IsSection) - { - SectionInfo si = MyItemInfo as SectionInfo; - MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null); - - } - // Only do foldout page if not done for section break, i.e. check the there's a previous step. - if (MyItemInfo.MyPrevious != null && MyItemInfo.FoldoutIndex() > -1) - MyPromsPrinter.DoFoldoutPage(cb, "HLS", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.FoldoutIndex(), false); - // B2018-108 if paginating on first step don't add blank page (it was already added at this point) - // B2023-011: Beaver Valley - continuous section printing on its own page throws off CAS/blank pages - // added the IsSection check to the else if - else if (PromsPrinter.MyFoldoutReader.Count > 0 && MyPageHelper.MyPromsPrinter.InsertBlankPages && (MyItemInfo.IsSection || (MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null))) - { - // insert a blank page if this step section had a foldout associated and the checkbox - // on the print dialog, to add blank pages, is checked AND the page did NOT have a - // preceeding foldout. - if (MyItemInfo.FoldoutIndex() <= -1) - { - MyPromsPrinter.InsertBlankPage(cb); - //_MyLog.InfoFormat("NewPage 10 blank {0}", cb.PdfWriter.CurrentPageNumber); - } - } - // See comments under case 0 explaining supinfo/facing page processing. - itemIsPrinted = IsPrintedStepItemForSupInfo(); - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyPageHelper.CreatingSupInfoPage && itemIsPrinted /*&& !MyItemInfo.IsSection*/ && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) - { - int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); - if (sid != -1) - { - MyPromsPrinter.DoSupInfoPage(cb, "TEMP", MyPageHelper.TextLayer, MyPageHelper, sid, true); - } - else - { - MyPromsPrinter.InsertBlankPage(cb); // C2019-004: Allow user to define duplex blank page text - } - } - if (MyItemInfo.MyDocStyle.LandscapePageList) - { - System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0); - cb.Transform(myMatrix); - } - yPageStart = yTopMargin + YTopMost; - // B2020-001 Catawba had an extra line at the top of a page that paginated on a section (EP/1/A/5000/E0 section B) - // Needed to remove the extra line spacing that is before the start of section B - (section is set for continuous pagination) - if (MyItemInfo.IsSection && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CustomSpacing) - yPageStart += (float)MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[25].StepLayoutData.STExtraSpace; - DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart); - SectionTopMessage(cb, yTopMargin, yLocation); // does wcntraining & suppinfo section title - if (MyPageHelper.CreatingSupInfoPage) yPageStart -= (2 * SixLinesPerInch); - if (doSectionContinue) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle, null); - // If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it - // B2020-164 added check for SpecialCaseCalvert to bypass IsSeparateSubsection STP O-67B-2 step 6.5 - // B2025-060 no section continue message if previous was not in same section or sub-section - // fixes Vogtle units 3&4 3-AOP-116 Attachments 2 & 3 - if ((!MyItemInfo.IsSection || MyItemInfo.IsSubsection) && - (MyItemInfo.MyPrevious != null && MyItemInfo.ActiveSection == MyItemInfo.MyPrevious.ActiveSection) && - MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader && - (!MyItemInfo.IsSection || (MyItemInfo.IsSeparateSubsection || MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert))) - { - // B2020-162 - SpecialCaseCalvert flag affect single column procedures, use SpecialCaseCalvertPagination for Two Column procedures instead - // B2020-163 - above bug (162) section header breaking from HLS caused forced pagination. turned out we didn't need to change this for B2020-162. - SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; - //B2020-123 - Calvert - set CalvertPrintedSubSectTitle flag to fix section continue bug - //B2020-166 - Calvert - only set CalvertPrintedSubSectTitle flag if doSectionTitleContinued is set - if (doSectionTitleContinued && MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) CalvertPrintedSubSectTitle = true; // B2020-123 - } - - if (MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].CompressFirstPartOfStep) - MyPageHelper.YMultiplier = _SevenLinesPerInch / SixLinesPerInch; - else - MyPageHelper.YMultiplier = 1; - break; - // .oooooo. .oooo. - // d8P' `Y8b .dP""Y88b - // 888 .oooo. .oooo.o .ooooo. ]8P' - // 888 `P )88b d88( "8 d88' `88b .d8P' - // 888 .oP"888 `"Y88b. 888ooo888 .dP' - // `88b ooo d8( 888 o. )88b 888 .o .oP .o - // `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' 8888888888 - case 2: // Break within a Step' - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks) - { - if (supInfoSect!=null&& MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0) supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID); - else MyPromsPrinter.NeedSupInfoBreak = true; - if (supInfoSect!=null) supInfoSect.StepSectPageBreaks.Add(MyItemInfo.ItemID); - } - YTopMost = OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); - docstyle = MyItemInfo.MyDocStyle; - bool doAlarmBox = false; - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - { - { - // Recognize that the break occurred WITHIN the CONDITION/RESPONSE table. - // Otherwise, we get extraneous header/top of box lines in pdf. - if (MyPageHelper.AlarmYoffStart > 0) - { - // if the first step in box is what broke to next page, then - // don't print the box on this page, only print it on next page: - doAlarmBox = true; - if (MyItemInfo.MyPrevious == null && MyParent.HasCalvertMacro) - MyPageHelper.AlarmYoffStart = 0; - else if (MyPageHelper.AlarmYoffEnd == 0) - { - // doThreeContinues flags when continue messages are printed in the - // bottom of the CONDITION/RESPONSE table columns. - doThreeContinues = MyItemInfo.StepLevel > 1; - MyPageHelper.AlarmYoffEnd = CalculateYLocation(yLocation, yTopMargin); - } - else if (MyPageHelper.AlarmYoffEnd > 0) - doAlarmBox = false; - - } - } - } - if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin); - // B2019-115 Locate Bottom Continue Message below AER Table if necesssary - float bcm_yLocation = TableBottom == -1 ? yLocation: Math.Min(TableBottom,yLocation); - DoBottomContinueMsg(cb, yBottomMargin, bcm_yLocation, docstyle, doThreeContinues); - MyPromsPrinter.NewPage(); - // C2018-003 fixed use of getting the active section - // F2023-112 Vogtle Units 3 & 4 background document format DSS_PageListBkgndStpContMsg to print continue message next to step number - if (MyItemInfo.IsStep && (MyItemInfo.ActiveSection != null && - ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd) || - ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListBkgndStpContMsg) == E_DocStructStyle.DSS_PageListBkgndStpContMsg))) - { - // check if parent (can be HLS, Caution or Note) has the UseOldTemplate. If so, - // flag that a continue message should be printed as part of a pagelist header (if pagelist - // has CM: page list item) - ItemInfo itm = MyItemInfo; - while (itm.IsStep && !itm.FormatStepData.UseOldTemplate) itm = itm.MyParent; - // don't put out continue if the page break item is the same as background step item (caution/note or hls) - if (itm.IsStep && itm.ItemID != MyItemInfo.ItemID) - { - MyPageHelper.OldTemplateContMsg = true; - MyPageHelper.ResetSvg(); - } - } - //_MyLog.InfoFormat("NewPage 11 {0}", cb.PdfWriter.CurrentPageNumber); - //Console.WriteLine("'b2',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); - ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); - //Console.WriteLine("'a2',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); - - DebugText.WriteLine("Paginate2"); - if (MyItemInfo.MyHLS.FoldoutIndex() > -1) - MyPromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.MyHLS.FoldoutIndex(), false); // temporary foldout - else if (PromsPrinter.MyFoldoutReader.Count > 0 && MyPageHelper.MyPromsPrinter.InsertBlankPages) - { - MyPromsPrinter.InsertBlankPage(cb); - _MyLog.InfoFormat("NewPage Break within step blank {0}", cb.PdfWriter.CurrentPageNumber); - } - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyPageHelper.CreatingSupInfoPage && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) - { - int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); - if (sid != -1) - { - MyPromsPrinter.DoSupInfoPage(cb, "TEMP", MyPageHelper.TextLayer, MyPageHelper, sid, true); - } - else - { - MyPromsPrinter.InsertBlankPage(cb); - } - } - // if there is a 'container vlnbox' around the HLS, flag that the drawn box must also break: - if (MyHighLevelParagraph != null && MyHighLevelParagraph.PartsContainer != null && MyHighLevelParagraph.PartsContainer.Count > 0 && - !((MyHighLevelParagraph.MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)) - { - foreach (vlnPrintObject vpo in MyHighLevelParagraph.PartsContainer) - { - vlnBox vb = vpo as vlnBox; - if (vb != null) - { - vb.ContainsPageBreak = true; - PartsContainer.Add(vb); - } - } - } - - // If there is a box, adjust the yTopMost to include it. - float yTopMost = YTopMost; - if ((MyItemInfo.IsCautionPart || MyItemInfo.IsNotePart) && MyParent.PartsAbove.Count > 0) - yTopMost = MyParent.PartsAbove[0].YOffset; - yTopMost = Math.Min(yTopMost, YVeryTop); - yPageStart = yTopMargin + yTopMost;// -2 * SixLinesPerInch; - DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart); - if (EmptyTopMostPart) yPageStart += SixLinesPerInch; - bool addExtraLines = false; - // If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader) - { - // if this is calvert OI/STP, then also check that docstyle has a top continue message - // in the document style that includes 'Continued' - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) - { - string myMsg = MyItemInfo.MyDocStyle.Continue.Top.Message; - if (myMsg == null || myMsg == "") - { - // There is no message, but still need to check if there is a Section Title Continued message: - // This was added for BGE OI34 (if break was within step, no section title continue message was printed) - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader) - { - SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; - } - else - doSectionTitleContinued = false; - } - else - { - SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; - } - } - else - { - SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; - } - } - addExtraLines = SectionTopMessage(cb, yTopMargin, yLocation); // this does wcntraining top section continue message and supplemental info message - if (MyPageHelper.CreatingSupInfoPage) yPageStart -= (2 * SixLinesPerInch); - if (!addExtraLines && (!doSectionTitleContinued || !SectionShowTitles)) - addExtraLines = DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle, doThreeContinues && MyItemInfo.MyParent != null && MyItemInfo.MyParent.MyTab != null ? MyItemInfo.MyParent.MyTab.CleanText : null); - // B2020-128: If compression flag is on RNO, see if there is an AER to the left and do the 7lpi multiplier - if (CompressPartOfStep || CompressRnoWithAerToTheLeft()) - { - MyPageHelper.YMultiplier = _SevenLinesPerInch / SixLinesPerInch; - CompressPartOfStep = false; - } - else - MyPageHelper.YMultiplier = 1; - - // For Calvert Alarms, if there was a page break and there is an box around the current - // step, need to add the header for the box, which is stored in a macro. Also set the - // 'AlarmYoffStart' value to where the vertical lines of the box start on this page. - if (doAlarmBox && MyItemInfo.StepLevel > 1) - { - float alrmY = yTopMargin - (2 * SixLinesPerInch); // CalculateYOffset(yPageStart, yTopMargin); - vlnMacro vlnm = new vlnMacro((float)docstyle.Layout.LeftMargin - 12, alrmY, "H4"); - vlnm.UseInternalY = true; // B2020-121: Account for Header on Caution or Note - PartsLeft.Add(vlnm); - MyPageHelper.AlarmYoffStart = alrmY - SixLinesPerInch; - yPageStart -= (4 * SixLinesPerInch); - if(ChildrenRight.Count>0 && ChildrenRight[0].ChildrenAbove.Count > 0 && ChildrenRight[0].ChildrenAbove[0].MyItemInfo.IsCautionOrNotePart) - yPageStart += (SixLinesPerInch); // B2020-121: Account for Header on Caution or Note - } - // For Calvert Alarms, if there is no box & this is top of page, if previous step - // had box (macro), adjust up page. The constructor (vlnParagraph), inserted these - // lines after the box so that the following text did not print right next to box. - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - { - if (MyItemInfo.MyPrevious != null && MyItemInfo.MyPrevious.TemplateIndex > 0 && MyItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[MyItemInfo.MyPrevious.TemplateIndex].hmacro > 0) - yPageStart += (3 * SixLinesPerInch); - } - // Now check if this is a template type step & if so, add the HLS's prefix/suffix to it. - // Since the entire checklist HLS (checklist table header) is printed as part of the - // continue, create a new paragraph to handle pagination and printing. - if (MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate) - { - DoSubs = false; - vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, yPageStart, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)", 0, false, MyPromsPrinter); - smartPara.PrintHeader = true; - float mytmpfloat = smartPara.ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); - yPageStart -= smartPara.Height; - DoSubs = true; - } - if (addExtraLines) yPageStart -= (2 * SixLinesPerInch); - if (MyItemInfo.IsRNOPart && MyItemInfo.FormatStepData.DoubleSpace && MyItemInfo.FormatStepData.SpaceDouble) yPageStart += SixLinesPerInch; - break; - // .oooooo. .oooo. - // d8P' `Y8b .dP""Y88b - // 888 .oooo. .oooo.o .ooooo. ]8P' - // 888 `P )88b d88( "8 d88' `88b <88b. - // 888 .oP"888 `"Y88b. 888ooo888 `88b. - // `88b ooo d8( 888 o. )88b 888 .o o. .88P - // `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' `8bd88P' - case 3: // Break on High Level Step (SevenLinesPerInch) - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks) - { - if (supInfoSect!=null && MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0) supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID); - else MyPromsPrinter.NeedSupInfoBreak = true; - if(supInfoSect!=null) supInfoSect.StepSectPageBreaks.Add(MyItemInfo.ItemID); - } - if (!firstHighLevelStep || (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyPageHelper.CreatingSupInfoPage)) // B2017-229: Added supinfo print check to run facing page logic - { - YTopMost = OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); - if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin); - MyPromsPrinter.NewPage(); // HLS (7 lpi) breakif (MyItemInfo.IsSection) - //_MyLog.InfoFormat("NewPage 12 {0}", cb.PdfWriter.CurrentPageNumber); - //Console.WriteLine("'b3',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); - ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); - //Console.WriteLine("'a3',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); - DebugText.WriteLine("Paginate3"); - if (MyItemInfo.IsSection) - { - SectionInfo si = MyItemInfo as SectionInfo; - MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null); - } - if (MyItemInfo.FoldoutIndex() > -1) - MyPromsPrinter.DoFoldoutPage(cb, "HLS (7 lpi) break", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.FoldoutIndex(), false); - else if (PromsPrinter.MyFoldoutReader.Count > 0 && MyPageHelper.MyPromsPrinter.InsertBlankPages) - { - // insert a blank page if this step section had a foldout associated and the checkbox - // on the print dialog, to add blank pages, is checked - MyPromsPrinter.InsertBlankPage(cb); - //_MyLog.InfoFormat("NewPage 12 lpi blank {0}", cb.PdfWriter.CurrentPageNumber); - } - // See comments under case 0 explaining supinfo/facing page processing. - itemIsPrinted = IsPrintedStepItemForSupInfo(); - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyPageHelper.CreatingSupInfoPage && itemIsPrinted /*&& !MyItemInfo.IsSection */ && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData) - { - int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID); - if (sid != -1) - { - MyPromsPrinter.DoSupInfoPage(cb, "TEMP", MyPageHelper.TextLayer, MyPageHelper, sid, true); - } - else - { - // B2020-031: Don't put out an extra blank page if section has title that is printed (blank page is output then) - bool titlePrinted = false; - if (MyItemInfo.IsSection || (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null)) - { - // see if the section title is printed. - SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - titlePrinted = (sch == null || sch.Section_PrintHdr == "Y") || !(MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps; - titlePrinted &= (ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle); - } - if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null && !titlePrinted) - MyPromsPrinter.InsertBlankPage(cb); - } - } - if (MyItemInfo.MyDocStyle.LandscapePageList) - { - System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0); - cb.Transform(myMatrix); - } - - // If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it - if (!MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader) - { - SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; - } - } - // if printing the section title, we already have the y location (note that only do this for the - // first step in the section. - if (MyItemInfo.MyPrevious == null && MyItemInfo.MyParent != null && MyItemInfo.MyParent.IsStepSection && - ShowSectionTitles - && !MyItemInfo.MyDocStyle.CancelSectTitle - && !MyItemInfo.MyDocStyle.SpecialStepsFoldout) - yPageStart = yPageStart; - else - yPageStart = yTopMargin + YTopMost; - MyPageHelper.YMultiplier = _SevenLinesPerInch / SixLinesPerInch; - DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart); - break; - } - // If "doSectionTitleContinued" is true then print the section title with "(Continued)" appended to it - // format must have ContinueSectinHeader format flag set to true - //B2025-048 Problem with Printing CAS Steps - // skip this if printing CAS or CTAS - was causing it to - // skip/overwrite data - if (doSectionTitleContinued) - { - vlnParagraph sectContPara; - string contMsg = (MyItemInfo.ActiveSection != null) ? MyItemInfo.ActiveSection.MyDocStyle.Continue.SectionTitle.AppendToTitle : ""; // C2018-003 fixed use of getting the active section - // For Calvert, the xoffset will be the highest level sections xoffset (there are metasections, - // don't use their xoffset or the continue message is indented too much) - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) - { - float secContinueTabXoff = (float)MyItemInfo.MyDocStyle.Layout.LeftMargin; - float secContinueXoff = 0f; - float secContinueTabWidth = 0f; - vlnParagraph fndTopSect = this; - while (fndTopSect.MyParent != null) - { - fndTopSect = fndTopSect.MyParent; - } - if (fndTopSect != null && fndTopSect.MyTab != null) - { - secContinueTabXoff = fndTopSect.MyTab.XOffset; - secContinueTabWidth = fndTopSect.MyTab.Width; - secContinueXoff = fndTopSect.XOffset; - } - // get to the correct section for the message, i.e. if on a section, the message should be the parent - // section (not the activesection which is myself); if on a step, the message should be the active section - ItemInfo sectForCont = MyItemInfo.IsSection && MyItemInfo.MyParent.IsSection ? MyItemInfo.MyParent : MyItemInfo.ActiveSection; - //B2025-054 Wrong Page Numbers in CAS Summary - // when section title continued and CAS - //to avoid overwriting data - // - this will be built at a different call to vlnParagraph - if (MyPromsPrinter.PromsPrinterPrintType != PromsPrinterPrintType.Normal) - MyPromsPrinter.ShouldPrint_CAS_CTAS = false; - sectContPara = new vlnParagraph(MyParent.MyParent, cb, sectForCont, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null || contMsg == "") ? " (Continued)" : contMsg, 0, false, MyPromsPrinter); - if (sectContPara.PartsLeft.Count > 0) - { - vlnTab vt = sectContPara.MyTab; - string ctab = GetSectCombinedTab(MyItemInfo); - vt.Rtf = GetRtf(ctab, vt.MyFont); - float wd = vt.GetTextWidth(vt.MyFont, ctab); - vt.XOffset = secContinueTabXoff; - vt.Width = secContinueXoff - secContinueTabXoff; - sectContPara.XOffset = secContinueXoff; - if ((wd + 12) > secContinueXoff - secContinueTabXoff) // 12 is 2 characters - { - float dif = wd + 12 - (secContinueXoff - secContinueTabXoff); - vt.Width += dif; - sectContPara.XOffset += dif; - sectContPara.Width -= dif; - } - - } - float mytmpfloat = sectContPara.ParagraphToPdf(cb, yTopMargin, yTopMargin, yBottomMargin); - if (sectContPara.SectionContinuePrinted) - yPageStart -= sectContPara.Height + SixLinesPerInch; - } - else - { - //B2025-054 Wrong Step Numbers - // when section title continued and CAS - //to avoid overwriting data - // - this will be built at a different call to vlnParagraph - if (MyPromsPrinter.PromsPrinterPrintType != PromsPrinterPrintType.Normal) - MyPromsPrinter.ShouldPrint_CAS_CTAS = false; - sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null || contMsg == "") ? " (Continued)" : contMsg, 0, false, MyPromsPrinter); - float mytmpfloat = sectContPara.ParagraphToPdf(cb, yTopMargin, yTopMargin, yBottomMargin); - if (sectContPara.SectionContinuePrinted) - yPageStart -= sectContPara.Height + SixLinesPerInch; - } - } - //out of section title section - reset this back to true (default) - MyPromsPrinter.ShouldPrint_CAS_CTAS = true; - - // see if this hls has footnotes, add to the footnote datastructure for processing at end of page. - if (MyItemInfo.IsHigh && MyPageHelper.NotesToFootNotesHLS.ContainsKey(MyItemInfo.ItemID)) AddFootNote(cb); - - yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - // B2017-122: if doing supinfo pagebreaks, if there should be a break on a step (not hls) that has a caution/note do it here: - if (!MyItemInfo.IsHigh && ChildrenAbove != null && ChildrenAbove.Count > 0 && MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks && MyPromsPrinter.NeedSupInfoBreak && MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0) - { - // if this has a caution/note with supinfo, that is id that needs to go in pagination list, unless it is in there. - int aboveSupinfoId = ChildrenAboveHaveSupInfo(); - if (supInfoSect != null) - { - if (supInfoSect.StepSectPageBreaksForSupInfo.Contains(aboveSupinfoId)) aboveSupinfoId = -1; - supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID); - } - MyPromsPrinter.NeedSupInfoBreak = false; - } - yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - - // Handle the PageBreakOnStep flag for a HLS. This will put out the page break right before - // a HLS. One example of this use is for backgrounds (CALBCK). - // 'this' below is a highlevel step, and the only time that ParaBreaks[0] will == 'this' is - // when the PageBreakOnStep flag is true. - if (MyPageHelper.ParaBreaks != null && MyPageHelper.ParaBreaks.Count > 0 && - MyPageHelper.ParaBreaks[0] == this && this.MyItemInfo.FormatStepData.PageBreakOnStep)// B2017-224 Top Continue Messages Add check for PageBreakOnStep 9/26/2017 Ginna SAMGs SAG-8 Step 4 - { - ShowPageBreak(1, CheckForCompression("PageBreakOnStep/Caution/Note HLS"), "Yes", YTop - YBottomMost, yTopMargin - yBottomMargin, yTopMargin - yBottomMargin, false); - YTopMost = OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); - MyPageHelper.BottomMessage.Clear(); - MyPageHelper.TopMessage = null; - MyPromsPrinter.NewPage(); - if (CompressPartOfStep) - { - MyPageHelper.YMultiplier = _SevenLinesPerInch / SixLinesPerInch; - CompressPartOfStep = false; - } - MyPageHelper.ParaBreaks.RemoveAt(0); - yPageStart = yTopMargin + YTop; - } - // The following sets the beginning/ending y location for the lines around the - // CONDITION/RESPONSE text for Calvert Alarm format - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - { - int tindx = MyItemInfo.TemplateIndex; - if (tindx >= 0) - { - // save this position to start drawing the alarm box lines around substeps: - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[MyItemInfo.TemplateIndex].row > 0) - MyPageHelper.AlarmYoffStart = CalculateYOffset(yPageStart, yTopMargin) - SixLinesPerInch; - else if (MyPageHelper.AlarmYoffStart > 0 && MyPageHelper.AlarmYoffEnd == 0) - MyPageHelper.AlarmYoffEnd = CalculateYOffset(yPageStart, yTopMargin) + (2 * SixLinesPerInch); - } - } - int profileDepth2 = ProfileTimer.Push(">>>> vlnParagraph.ParagraphToPdf"); - // B2020-162 - SpecialCaseCalvert flag affect single column procedures, use SpecialCaseCalvertPagination for Two Column procedures instead - if (MyItemInfo.IsSubsection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertPagination) CalvertPrintedSubSectTitle = true; // B2020-123 - yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); - ProfileTimer.Pop(profileDepth2); - // If the yPageStart changes by more than a small amount (pagination) in the RNO (right column), then update - // yPageStart for the AER (left column). - float yPageStartRNO = ChildrenRight.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - if (yPageStartRNO - yPageStart > 24) // 24 is two lines - yPageStart = yPageStartRNO; - yPageStart = ChildrenBelow.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - - if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null) // last hls, add the 'end' message, if there is one - { - docstyle = MyItemInfo.MyDocStyle; - // 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. - //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 - // B2017-201 if si is null we need to get it via the ItemID - if (si == null) - si = SectionInfo.Get(MyItemInfo.MyActiveSection.ItemID); // MyActiveSection does not try to resolve anything - ActiveSection is call above and will resolve and set MyActiveSection - bool _skipEndMessage = (si == null ||si.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One) && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.EndForSingle; - bool _lastSect = true; - if (si != null && si.MyActiveParent.IsSection) // is this meta/subsection. Only put end message out on last section - { - ItemInfo mysect = si as ItemInfo; - if (mysect.NextItem != null && !docstyle.End.EndMessageOnEachSubSection) _lastSect = false; - } - string myMsg = (docstyle.End == null) ? null : docstyle.End.FixedMessage; - if (myMsg != null && !_skipEndMessage && _lastSect) - { - // If the flag is 0 or 1, just put the end message out right below this vlnParagraph: - float msg_yLocation = CalculateYLocation(yPageStart - YBottomMost, yTopMargin); - //if (MyPageHelper.YMultiplier < 1) - // msg_yLocation += 4;// Robinson - if the page is compressed, we need this adjustment. - - // the following is for IP3 - it was commented out so that an update could be put on - // before this was tested. - // if end message has {par}, remove these but add a line for each. - //int parindx = myMsg.IndexOf("{par}"); - //bool foundpar = false; - //while (parindx > -1) - //{ - // foundpar = true; - // msg_yLocation += SixLinesPerInch; - // parindx = myMsg.IndexOf("{par}", parindx + 1); - //} - //if (foundpar) myMsg = myMsg.Replace("{par}", ""); - // use the 'flag' to position the message. - if (docstyle.End.Flag > 2) // >2 position at an absolute location defined by docstyle.End.Flag. - { - msg_yLocation = yTopMargin - (float)(docstyle.End.Flag * SixLinesPerInch); - } - float adjMsgY = 0; - if (docstyle.End.Flag < 0) // Adjust this many lines down the page. - { - adjMsgY = (float)(-docstyle.End.Flag * SixLinesPerInch); - if (msg_yLocation - adjMsgY > docstyle.Layout.FooterLength) msg_yLocation = msg_yLocation - adjMsgY; - } - if (myMsg.Contains("{Section Number}")) myMsg = myMsg.Replace("{Section Number}", MyItemInfo.ActiveSection.DisplayNumber); - //jcb code - //if (myMsg.Contains("%-8s")) - // myMsg = myMsg.Replace("%-8s", MyItemInfo.MyProcedure.DisplayNumber.PadRight(8)); - if (myMsg.Contains("%-12s")) - myMsg = myMsg.Replace("%-12s", MyItemInfo.MyProcedure.DisplayNumber.PadRight(12)); - float xpos = 0; - if (yTopMargin - docstyle.Layout.PageLength >= msg_yLocation && docstyle.End.Message != null && docstyle.End.Message != "" && docstyle.End.Flag <= 2) - { - // B2018-037: adjust location of end message to bottom of page if it is too low. This occurs when data just doesn't - // fit on the page, but will locate end message at a more reasonable location. - msg_yLocation = (float)yTopMargin - (float)docstyle.Layout.PageLength; - _MyLog.WarnFormat("End Message LOW on page: {0}, {1}, {2}, Page {3}", msg_yLocation, MyItemInfo.ItemID, MyItemInfo.ShortPath, MyPageHelper.CurrentPageNumber + 1); - } - if ((docstyle.End.Margin ?? 0) != 0) - { - xpos = (float)docstyle.Layout.LeftMargin + (float)docstyle.End.Margin; - MyPageHelper.BottomMessage.Add(new vlnText(cb, this, myMsg, myMsg, xpos, msg_yLocation, docstyle.End.Font)); - } - else - { // Center the bottom message - float wtpm = (float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin; - //B2022-126 was using the wrong font definition to calaculate the centering position - // ** B2023-099 commented out and restored the previous calculation. This caused problems centering the END message in Ginna - // their END message prints with the Prestige Elite font but he centering calc uses Courier New - //xpos = XOffsetBox + (float)docstyle.Layout.LeftMargin + (wtpm - (myMsg.Length * docstyle.End.Font.CharsToTwips)) / 2; - xpos = XOffsetBox + (float)docstyle.Layout.LeftMargin + (wtpm - (myMsg.Length * MyItemInfo.FormatStepData.Font.CharsToTwips)) / 2; - xpos = Math.Max(xpos, XOffsetBox + (float)docstyle.Layout.LeftMargin); - vlnText vttmp = new vlnText(cb, this, myMsg, myMsg, xpos, msg_yLocation, docstyle.End.Font); - MyPageHelper.BottomMessage.Add(vttmp); - MyPageHelper.MyGaps.Add(new Gap(msg_yLocation, msg_yLocation - vttmp.Height)); - yPageStart -= (vttmp.Height + adjMsgY); - } - } - } - if (yLocalypagestart != yPageStart) DebugText.WriteLine("ToPdf-yPagestartDiff:{0},{1},{2},{3}", MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, MyItemInfo.ItemID, yLocalypagestart, yPageStart); - - // if doing NotesToFootnotes (Calvert valve list format), get the bottom location so that - // footnotes will be printed after last text on page. This is used for the end of the section. - // Pages that broke within pagination logic above had footnote location set during pagination code. - if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) - MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yPageStart - YBottomMost, yTopMargin); - ProfileTimer.Pop(profileDepth); - return yPageStart; - } - // B2020-128: If compression flag is on RNO, see if there is an AER to the left and do the 7lpi multiplier - private bool CompressRnoWithAerToTheLeft() - { - if (!MyItemInfo.IsInRNO) return false; - foreach (vlnParagraph vPara in MyPageHelper.MyParagraphs.Values) - { - if (!vPara.Processed) - { - if (vPara.YOffset <= YOffset && vPara.CompressPartOfStep) return true; - } - } - return false; - } - private bool IsPrintedStepItemForSupInfo() - { - bool printedMySectTitle = true; - if (MyItemInfo.IsSection) - { - // see if the section title is printed. - SectionConfig sch = (MyItemInfo.ActiveSection != null) ? MyItemInfo.ActiveSection.MyConfig as SectionConfig : null; // C2018-003 fixed use of getting the active section - printedMySectTitle = (sch == null || sch.Section_PrintHdr == "Y") || !(MyItemInfo.ActiveSection as SectionInfo).HasSupInfoSteps; - printedMySectTitle &= (ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle); - } - return printedMySectTitle; - } - private int ChildrenAboveHaveSupInfo() - { - if (ChildrenAbove == null || ChildrenAbove.Count < 1) return -1; - foreach (vlnParagraph p in ChildrenAbove) - { - if (p.MyItemInfo.SupInfos != null && p.MyItemInfo.SupInfos.Count > 0) return p.MyItemInfo.SupInfos[0].ItemID; - } - return -1; - } - // Find the step that has supplemental information from this step down page until a preferred page break is found - // or a regular page break. - // It is used to determine whether there is a supinfo facing page or if there should be a blank page. - private bool FoundStepPageBreak = false; - private int GetIdThatHasSupInfoItems(ItemInfo ii, int startid) - { - if (ii == null) return -1; - FoundStepPageBreak = false; - // if this item has supinfo, return its id - if (ii.SupInfos != null && ii.SupInfos.Count > 0) return ii.SupInfos[0].ItemID; - - // see if any substeps of this item have supinfo, and if so, return the substep's id - int id = GetSubThatHasSupInfoItems(ii, startid); - if (id != -1) return id; - if (FoundStepPageBreak) return -1; // Set in GetSubThatHasSupInfoItems - - // Now go to the next item, check if it or any of its substeps have supinfo, and if so, return the id - ItemInfo sib = ii.NextItem; - id = GetIdThatHasSupInfoItemsSibNext(sib, startid); - if (id != -1) return id; - if (FoundStepPageBreak) return -1; // Set in GetIdThatHasSupInfoItemsSibNext - - // B2017-122: if this is a note or caution off substep, check if substep has supinfo: - if ((ii.IsNote || ii.IsCaution) && !ii.MyParent.IsHigh) - { - if (ii.MyParent.SupInfos != null && ii.MyParent.SupInfos.Count > 0) return ii.MyParent.SupInfos[0].ItemID; - int sbfromNC = GetSubThatHasSupInfoItems(ii.MyParent, startid); - if (sbfromNC != -1) return sbfromNC; - if (FoundStepPageBreak) return -1; // Set in GetSubThatHasSupInfoItems - } - - // Go to the parent, and find its next and check if it or any of its substeps or next steps or any of their substeps have supinfo, - // and if so, return the id. - ItemInfo par = ii.MyParent; - ItemInfo parsnxt = par.GetNext(); - //B2023-068 check if we are already at the section or procedure level - if (!par.IsSection && !par.IsProcedure && parsnxt != null) - { - par = parsnxt; - while (par != null && !par.IsSection) - { - id = GetIdThatHasSupInfoItemsSibNext(par, startid); - if (id != -1) return id; - par = par.MyParent; - ItemInfo sparsnxt = par.GetNext(); - if (!par.IsSection && sparsnxt != null) par = sparsnxt; - else return -1; - } - } - return -1; - } - - private int GetIdThatHasSupInfoItemsSibNext(ItemInfo ii, int startid) - { - int id = -1; - while (ii != null) - { - SectionInfo supInfoSect = ii.ActiveSection as SectionInfo; - // B2017-193 Error occured when a section in the MRU was being loaded as an iteminfo - if (supInfoSect == null) supInfoSect = SectionInfo.Get(ii.ActiveSection.ItemID); - // if there is a pagebreak on this step section step, quit looking for supinfos. The - // break has to occur here. - if (supInfoSect.StepSectPageBreaks.Contains(ii.ItemID)) - { - FoundStepPageBreak = true; - return -1; - } - if (ii.SupInfos != null && ii.SupInfos.Count > 0) - { - // check if this is in the list of page breaks for supinfos, if not it may have one of its cautions/notes rather than its id: - if (!supInfoSect.StepSectPageBreaksForSupInfo.Contains(ii.SupInfos[0].ItemID)) - { - if (ii.Cautions != null) - { - foreach (ItemInfo caution in ii.Cautions) - if (caution.SupInfos != null && caution.SupInfos.Count > 0 && supInfoSect.StepSectPageBreaksForSupInfo.Contains(caution.SupInfos[0].ItemID)) return caution.SupInfos[0].ItemID; - } - if (ii.Notes != null) - { - foreach (ItemInfo note in ii.Notes) - if (note.SupInfos != null && note.SupInfos.Count > 0 && supInfoSect.StepSectPageBreaksForSupInfo.Contains(note.SupInfos[0].ItemID)) return note.SupInfos[0].ItemID; - } - } - return ii.SupInfos[0].ItemID; - } - id = GetSubThatHasSupInfoItems(ii, startid); - if (id == -2) return -1; - if (id != -1) return id; - ii = ii.NextItem; - } - return -1; - } - private int GetSubThatHasSupInfoItems(ItemInfo ii, int startid) - { - if (ii.MyContent.ContentParts != null) - { - SectionInfo supInfoSect = ii.ActiveSection as SectionInfo; - if (supInfoSect == null) supInfoSect = SectionInfo.Get(ii.ActiveSection.ItemID); - foreach (PartInfo pi in ii.MyContent.ContentParts) - { - if ((E_FromType)pi.FromType != E_FromType.SupInfo) - { - foreach (ItemInfo iic in pi.MyItems) - { - // B2018-021: added code to be sure that check isn't on current step, i.e. startid != iic.ItemID & - // flag when the following page break is found so the next supplemental information page isn't printed - // on a step where the step is on the following page from the one we are looking for. - if (startid != iic.ItemID) - { - if (supInfoSect.StepSectPageBreaks.Contains(iic.ItemID)) - { - FoundStepPageBreak = true; - return -1; - } - if (iic.SupInfos != null && iic.SupInfos.Count > 0) return iic.SupInfos[0].ItemID; - int id = GetSubThatHasSupInfoItems(iic, startid); - if (id != -1) return id; - } - } - } - } - } - return -1; - } - private float GetSectionTopMessageSize() - { - // B2016-134: Account for wcntraining section top continue if item has container - float retval = 0; - if (MyItemInfo.MyDocStyle.SectTop != null && MyItemInfo.MyDocStyle.SectTop.Message != null) - { - if (PartsContainer != null && PartsContainer.Count > 0) retval = SixLinesPerInch * 1; - } - return retval; - } - // For WCNTRN (Wolf Creek Training format): the following prints the section number (and continued, if - // section is continued from previous page) in the Responsibility column. - private bool SectionTopMessage(PdfContentByte cb, float yTopMargin, float yLocation) - { - if (MyPageHelper.CreatingSupInfoPage) - { - float scttopWidths = "Supplemental Information".Length * 6; - float ctrs = ((float)MyItemInfo.MyDocStyle.Layout.PageWidth - (float)MyItemInfo.MyDocStyle.Layout.LeftMargin) / 2; - float sctcntrXs = (float)MyItemInfo.MyDocStyle.Layout.LeftMargin + ctrs - (scttopWidths / 2); - VE_Font vf = MyItemInfo.MyDocStyle.Font; - // F2017-039: The following null check was added in case the format's doc style does not have a font defined: - if (vf == null || vf.Style == null || vf.Family == null || vf.Size == null || vf.CPI == null) vf = MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font; - E_Style sty = E_Style.Underline; - if (vf != null && vf.Style != null) sty = (E_Style)(vf.Style | E_Style.Underline); - vf = new VE_Font(vf.Family, (int)vf.Size, sty, (float)vf.CPI); - MyPageHelper.TopMessage = new vlnText(cb, this, "Supplemental Information", "Supplemental Information", sctcntrXs, yTopMargin + 0.1F, vf); - return true; - } - bool addextra = false; - if (MyItemInfo.MyDocStyle.SectTop != null && MyItemInfo.MyDocStyle.SectTop.Message != null) - { - float sectMsgY = 0; - if (PartsContainer == null || PartsContainer.Count == 0) - sectMsgY = CalculateYLocation(YTop, yTopMargin); - else - { - // B2016-134: Account for section top continue if item has container, i.e. move section top continue message above the container - sectMsgY = CalculateYLocation(YTopMost - (SixLinesPerInch * 3), yTopMargin); // 3 is # of lines: header, box, blank line moving up page - addextra = true; - } - VE_Font sctMsgFont = MyItemInfo.MyDocStyle.SectTop.Font; - string scttop = null; - if (!MyItemInfo.IsStepSection && MyItemInfo.MyDocStyle.SectTop.Message != null) - scttop = MyItemInfo.MyDocStyle.SectTop.Message.Replace("%s", (MyItemInfo.ActiveSection as SectionInfo).DisplayNumber); - else - scttop = (MyItemInfo as SectionInfo).DisplayNumber; - float scttopWidth = scttop.Length * 6; - float ctr = (float)MyItemInfo.MyDocStyle.SectTop.Margin; - float sctcntrX = (float)MyItemInfo.MyDocStyle.Layout.LeftMargin + ctr - (scttopWidth / 2); - vlnText mySectMsg = new vlnText(cb, this, scttop, scttop, sctcntrX, sectMsgY, sctMsgFont); - PartsLeft.Add(mySectMsg); - } - return addextra; - } - // Added to try to resolve a problem when printing FNP-1-FRP-I.3 Attachment 3 Table 1. - // May be needed to evaluate this problem in the future. - //private void CompareSectionInfo(SectionInfo si, SectionInfo si1) - //{ - // if (si.ItemID != si1.ItemID) - // Console.WriteLine("Different"); - // if (si.ActiveFormat.FullName != si1.ActiveFormat.FullName) - // Console.WriteLine("Different"); - // if (si.ActiveParent != si1.ActiveParent) - // Console.WriteLine("Different"); - // if (si.ActiveSection.ItemID != si1.ActiveSection.ItemID) - // Console.WriteLine("Different"); - // if (si.MyDocStyle.Name != si1.MyDocStyle.Name) - // Console.WriteLine("Different"); - //} - private void AddFootNote(PdfContentByte cb) - { - // for calvert valve lists footnotes, if there is footnote data, save it for vlnSvgPageHelper - // which puts the footnotes out when page is printed. - List myNotes = MyPageHelper.NotesToFootNotesHLS[MyItemInfo.ItemID]; - foreach (int myNote in myNotes) - { - ItemInfo inote = StepInfo.Get(myNote); - - // first check if this exact text is already in the foot note list. If it is - // in there, don't add it. - bool inlist = false; - if (MyPageHelper.NotesToFootNotes != null) - { - foreach (vlnParagraph vp in MyPageHelper.NotesToFootNotes) - { - if (vp.MyItemInfo.MyContent.Text == inote.MyContent.Text) - { - inlist = true; - break; - } - } - } - if (!inlist) - { - vlnParagraph vpFNote = new vlnParagraph(null, cb, inote, (float)MyItemInfo.MyDocStyle.Layout.LeftMargin, 0, 0, 0, MyItemInfo.ActiveFormat, null, null, 0, false, MyPromsPrinter); - vpFNote.Width = (float)MyItemInfo.MyDocStyle.Layout.PageWidth - (float)MyItemInfo.MyDocStyle.Layout.LeftMargin; - vpFNote.Height = 0; - vpFNote.XOffset = (float)MyItemInfo.MyDocStyle.Layout.LeftMargin; - if (MyPageHelper.NotesToFootNotes == null) MyPageHelper.NotesToFootNotes = new List(); - MyPageHelper.NotesToFootNotes.Add(vpFNote); - } - } - MyPageHelper.NotesToFootNotesHLS.Remove(MyItemInfo.ItemID); - } - private bool DoTopContinueMsg(PdfContentByte cb, ref float yPageStart, float yTopMargin, DocStyle docstyle, string subTab) - { - bool addExtraLine = false; - if ((bool)docstyle.Continue.Top.UseStepTabs) - { - // UseStepTabs is a format flag added for Comanche Peak to print out step tabs as - // a top comtinue message. This code will go up through parents putting out - // their tabs - at this y location, but at the tabs' x location - vlnParagraph myPar = this; - MyPageHelper.TopMessageRs = new List(); - while (!myPar.MyItemInfo.IsHigh) - { - myPar = myPar.MyParent; - foreach (vlnPrintObject vpo in myPar.PartsLeft) - { - if (vpo is vlnTab) - { - vlnTab vt = vpo as vlnTab; - string cltxt = vt.Text; - // Originally the Comache Peak customer did not want the '*'. As of 6/22/15, CP wants the asterisk in continue msg - ///cltxt = cltxt.Replace("*", " "); - // replace C# representation of unicode character "\u25CF" which is hex - // with the rtf representation @"\u9679?" - if (cltxt.Contains("\u25CF")) cltxt = cltxt.Replace("\u25CF", @"\u9679?"); // handle a bullet, if it isn't unicode yet - float msgTopMargin = yTopMargin; - // B2017-106: if caution/note move the message up a little so it doesn't touch the caution/note lines: - if (MyItemInfo.IsNote || MyItemInfo.IsCaution) msgTopMargin += 4; - // B2018-140: if table move the message up a little so it doesn't touch the table lines: - if (MyItemInfo.IsTable) msgTopMargin += 6; - MyPageHelper.TopMessageRs.Add(new vlnText(cb, this, cltxt, cltxt, vt.XOffset, msgTopMargin, vt.MyFont)); - } - else if (vpo is vlnText) // As of 6/22/15, CP wants the step designator in the continue message also. - { - vpo.YOffset = yTopMargin; - int nlcnt = 1; // number of lines to adjust the yoffset for the next step designator we are adding to TopMessageRs - string rtxt = ""; - int istr = 0; - int Rsidx = 0; - MyPageHelper.TopMessageRs.Add(vpo as vlnText); // this appends a previous step designator associated with this sub-step (there may be more than one and/or might have multiple lines) - // we are processing the step designator on the top continue message in reverse order - // we therefore need to adjust the y location of multiple step designors attached tothe top continue message - if (MyPageHelper.TopMessageRs.Count > 3) - { - Rsidx = MyPageHelper.TopMessageRs.Count - 1; - rtxt = MyPageHelper.TopMessageRs[Rsidx].Text; - // find the number of lines to shift existing TopMessageRs step designators down - istr = rtxt.IndexOf("\\line", 0); - while (istr != -1) - { - nlcnt++; - istr = rtxt.IndexOf("\\line", istr + 1); - } - // move the previous TopMessageRs step designators down - Rsidx -= 2; // index to the previous step desginator - while (Rsidx > 0) - { - MyPageHelper.TopMessageRs[Rsidx].YOffset -= (nlcnt * SixLinesPerInch); - Rsidx -= 2;// every other TopMessageRs is a step designator - } - } - // for Comanche Peak - if step breaks on a sub-step, and both the high level step and the sub-step have a step designator - // then since the high level step and its step designator are printed as part of the top continue message, - // move the step designator associated with the sub-step down so that it does not print on top of the - // ones in the top continue message. - if (this.PartsLeft.Count > 1) // was a step designator printed for the sub-step? - { - // count the number of lines in the step designator text in the top continue message - nlcnt = 0; // reset for the number of lines to push the sub-step's step designator down - Rsidx = MyPageHelper.TopMessageRs.Count - 1; // note that TopMessageRs[0] is a tab not a step designator - while (Rsidx > 0) - { - nlcnt++; - rtxt = MyPageHelper.TopMessageRs[Rsidx].Text; - istr = rtxt.IndexOf("\\line", 0); - while (istr != -1) - { - nlcnt++; - istr = rtxt.IndexOf("\\line", istr + 1); - } - Rsidx -= 2; // every other TopMessageRs is a step designator - } - if (nlcnt > 0) - { - for (int idx = 1; idx < this.PartsLeft.Count; idx++) - { - vlnPrintObject vpol = this.PartsLeft[idx]; - vpol.YOffset += (nlcnt * SixLinesPerInch); // move the existing step designator down - } - } - } - } - } - } - return false; - } - - string myMsg = docstyle.Continue.Top.Message; - MyPageHelper.TopMessageRs = new List(); - // bug fix B2106-099 - // when there are more than one Caution/Note off of a high level background step, - // the second, third, etc background Caution/Note pages begin printing two additional lines from the top of the page - // to fix, added a check to see the the item we are printing has the PageBrrakOnStep flag set, if it's set, - // then DON'T add two lines to the yPageStart (for the top conitnue message) - if (myMsg != null && myMsg != "" && !MyItemInfo.IsSection && !MyItemInfo.FormatStepData.PageBreakOnStep) // B2020-123 - { - // C2019-044 for BNPP put the top continue message on the same row as the Checkoff/Signoff header - // This is done by specifing a row positon in the top continue definition in the format. - // If the top continue messsage RowOverride is being used, don't move the yPageStart down (don't need to make room for it) - if (docstyle.Continue.Top.RowOverride == null) - yPageStart -= 2 * SixLinesPerInch;// Allow two lines for top continue message - if (myMsg.IndexOf(@"%sR") > -1) - { - ItemInfo myAer = MyItemInfo.IsHigh ? MyItemInfo : MyItemInfo.MyParent; - if (MyItemInfo.IsInRNO) - { - // If this is an RNO part, find the parent that is not an RNO (the reason for this is - // that RNO parts are structured as parent/child not sibling relationships, for - // example, RNO part 1.2 is the child of 1.1 not sibling). Also, if this is a caution - // or note of the RNO part, do the same because it should not use the RNO part's tab. - // However, the RNO Part will have the combined tab using its parent because this is - // needed if any of its children, for example substeps, need the combined tab. - if (((MyItemInfo.IsNote || MyItemInfo.IsCaution) && MyItemInfo.MyParent.IsRNOPart) || MyItemInfo.IsRNOPart) - { - ItemInfo ip = MyItemInfo.MyParent; - while (ip.IsRNOPart) ip = ip.MyParent; - myMsg = myMsg.Replace(@"%sR", ip.CombinedTab); - } - // B2020-154: Incorrect top continue message tab in RNO column if for single level substep with a Caution/Note - else if ((MyItemInfo.IsNote || MyItemInfo.IsCaution) && MyItemInfo.MyParent.MyParent.IsRNOPart) - { - if (DebugPagination.IsOpen) DebugPagination.WriteLine("***===>,'Yes','Case 1:Changed RNO Continue Message',{0},{1},,{3},'{4}'", MyItemInfo.ItemID, YSize, 0, 0, this); - ItemInfo ip = MyItemInfo.MyParent; - while (!ip.IsRNOPart) ip = ip.MyParent; - myMsg = myMsg.Replace(@"%sR", ip.CombinedTab); - } - // B2020-154: Incorrect top continue message tab in RNO column for substep with a Caution/Note within parent substeps - else if ((MyItemInfo.IsNote || MyItemInfo.IsCaution) && MyItemInfo.MyParent.MyParent.IsInRNO) - { - if (DebugPagination.IsOpen) DebugPagination.WriteLine("***===>,'Yes','Case 2:Changed RNO Continue Message',{0},{1},,{3},'{4}'", MyItemInfo.ItemID, YSize, 0, 0, this); - myMsg = myMsg.Replace(@"%sR", MyItemInfo.MyParent.MyParent.CombinedTab); - } - else - myMsg = myMsg.Replace(@"%sR", MyItemInfo.MyParent.CombinedTab); - float xor = MyTopRNO.MyTab.XOffset; - MyPageHelper.TopMessageRs.Add(new vlnText(cb, this, myMsg, myMsg, xor, yTopMargin + 0.1F, docstyle.Continue.Top.Font)); - // get aer message, go up parent until find aer and use its combined tab: - myAer = MyItemInfo; - while (myAer.IsInRNO) myAer = myAer.MyParent; - } - else if (!MyItemInfo.IsHigh && (MyItemInfo.IsNote || MyItemInfo.IsCaution)) - { - ItemInfo ip1 = MyItemInfo.MyParent; - if (!ip1.IsHigh) myAer = ip1.MyParent; - } - myMsg = docstyle.Continue.Top.Message.Replace(@"%sR", myAer.CombinedTab); - } - if (myMsg.IndexOf(@"%s") > -1) - { - if (MyItemInfo.MyParent.IsSection && (docstyle.StructureStyle.Style & E_DocStructStyle.BottomSectionContinue) == E_DocStructStyle.BottomSectionContinue) - myMsg = myMsg.Replace(@"%s", MyItemInfo.MyParent.MyTab.CleanText.Trim()); - else - { - // F2020-023: tab includes parent tab and if caution/note don't use its parent, go up another level - string noBullet = MyItemInfo.IsCautionOrNotePart ? MyItemInfo.MyParent.MyParent.CombinedTab : MyItemInfo.MyParent.CombinedTab; - // F2026-002 Vogtle Units 3&4, don't include the RNO sub-step tab if the parent is an AER sub-step - if (docstyle.Continue.Top.DontIncludeRNOTabIfHasAERParent && MyItemInfo.MyParent.IsRNOPart && !MyItemInfo.MyParent.MyParent.IsRNOPart) - noBullet = MyItemInfo.MyParent.MyParent.CombinedTab; - // C2021-024: WCN1 if bullet exists in combined tab, stop right before bullet. - // B2021-085 & 087: crash if noBullet was null. Also, if null, see if text in parent. if no text, replace the - // "%s." with noBullet (null) which won't put out just a '.' as step number. - if (docstyle.Continue.Top.RemoveBullet) - { - if (noBullet == null && MyItemInfo.IsCautionOrNotePart) noBullet = MyItemInfo.MyParent.CombinedTab; - if (noBullet != null) - { - int ind = noBullet.IndexOf(".o"); - if (ind < 0) ind = noBullet.IndexOf(".*"); - if (ind > -1) noBullet = noBullet.Substring(0, ind); - } - else - { - myMsg = myMsg.Replace(@"%s.", noBullet); - } - } - myMsg = myMsg.Replace(@"%s", noBullet); - } - } - if (myMsg.IndexOf(@"%3d") > -1) - myMsg = myMsg.Replace(@"%3d", MyItemInfo.MyHLS.Ordinal.ToString()); - if (myMsg.IndexOf(@"%2d") > -1) - myMsg = myMsg.Replace(@"%2d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray()).PadLeft(2)); - if (myMsg.IndexOf(@"%d") > -1) - myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray())); - if (myMsg.IndexOf(@"%c") > -1) - myMsg = myMsg.Replace(@"%c", " "); - - // Top Continue message includes high level step tab and text - if ((docstyle.Continue.Top.HLS ?? 0) == 1) - { - myMsg = docstyle.Continue.Top.Message; // reset because we did replace strings in code above - ItemInfo parentStep = MyItemInfo.MyHLS; // get the high level step - myMsg = string.Format(myMsg, parentStep.CombinedTab, parentStep.DisplayTextKeepSpecialChars); - } - // B2023-115 Top continue message for Vogtle Alarms: 1st version done on 12/6/23. Changes to logic as per request - // from engineering done on 12/12/23. See comment below for logic for 12/12/23 (history of this file has previous - // logic) - if (((docstyle.Continue.Top.HLS ?? 0) == 4) || ((docstyle.Continue.Top.HLS ?? 0) == 7)) - { - // Vogtle Alarms: Their alarms are set up differently than standard procedures - the HLS in Vogtle - // alarms is a section in other procedures. The top continue message is shown when a break occurs: - // • A continued message will appear on the top of the page ONLY if the pagination occurs anywhere - // within the first level substep. If, for example, the page break occurs between substep 3 and substep - // 4 as in example 2, no continued message will appear on the top of the page. - // • If a continued message is needed, the continued message will include the first level substep number - // if it is a sequential substep, such as “5. (continued)”. If it is NOT a sequential substep, then only - // the word “(continued)” will appear. - // • If a page break occurs between high level steps, such as before “Causes:”, then no continued message is needed. - - // F2024-027 & F2024-028 - // Vogtle Units 3&4 needed similar top continue messages in the Local Alarms attachments as they have for the MCR Alarm point pages - // with the exception that when High Level Step (grouping text) is split and continued to the next page, the top continue message - // needs to be the HLS text with "(continued)" appended to it. - // Added a TOP.HLS value of 7 to allow for this minor difference and is set in the docstyle for that section - - bool doMessage = true; - if (MyItemInfo.IsHigh) doMessage = false; // at high, don't do message - if (MyItemInfo.MyParent.IsHigh) doMessage = false; // at first level, don't do message - // Caution/Note on first level, don't do message - if ((MyItemInfo.IsCaution || MyItemInfo.IsNote) && MyItemInfo.MyParent.MyParent.IsHigh) doMessage = false; - myMsg = docstyle.Continue.Top.Message; - if (doMessage) - { - // Get to highest level below HLS - ItemInfo cur = MyItemInfo; - while (!cur.MyParent.IsHigh) cur = cur.MyParent; - // if sequential, add on step number, otherwise just put out message: - myMsg = !cur.IsSequential ? myMsg : cur.CombinedTab + ". " + myMsg; - } - // F2024-027 & F2024-028 added else if to check of the case where we want to use the High Level Step text in the top continue message - else if (((docstyle.Continue.Top.HLS ?? 0) == 7) && MyItemInfo.MyParent != null && MyItemInfo.MyParent.IsHigh) - { - myMsg = MyItemInfo.MyParent.DisplayText + " " + myMsg; - } - else // if not doing message, clear it & set yPageStart back to what it was before handling message - { - myMsg = ""; - yPageStart += 2 * SixLinesPerInch; - } - } - // B2021-138: Top continue message for Barakah Single column New (2021) format was incorrect for some lower - // sub-steps. - if ((docstyle.Continue.Top.HLS ?? 0) == 6) - { - myMsg = docstyle.Continue.Top.Message; // reset because we did replace strings in code above - ItemInfo parentStep = MyItemInfo.MyHLS; - string ctab = parentStep.CombinedTab; - if (!MyItemInfo.MyParent.IsHigh) // If lower sub-step, get parent substep tab, skipping caution/note if in one of those - ctab = (MyItemInfo.IsInCautionOrNote) ? MyItemInfo.MyParent.MyParent.CombinedTab : MyItemInfo.MyParent.CombinedTab; - myMsg = string.Format(myMsg, ctab, parentStep.DisplayTextKeepSpecialChars); - } - // Calvert Alarms, step description have the alarm number as part of the top continue message - // Also, if the break is within the CONDITION/RESPONSE, there are continue messages in both columns at the top - // of the table, note that the continue messages WITHIN table are only printed when the - // steplevel is greater than 2 - this is from 16bit. - // NOTE THAT this code is not complete - the positioning & addition of step tab for within table are not working correctly - if ((docstyle.Continue.Top.HLS ?? 0) == 3) - { - MyPageHelper.TopMessageSub1s = new List(); - MyPageHelper.TopMessageSub2s = new List(); - - //string HLSTabTextForContMsg = MyHighLevelParagraph.MyItemInfo.MyTab.CleanText + " " + MyHighLevelParagraph.MyItemInfo.MyContent.Text; - //int len = (HLSTabTextForContMsg.Length - 10) * 6; - string tabText = @"\ul\b " + MyHighLevelParagraph.MyItemInfo.MyTab.CleanText.Trim() + @"\b0\ulnone"; - // B2017-185: added the replace of unicode dash to regular dash for the continue message so it matches the step text: - string stepText = @"\b " + MyHighLevelParagraph.MyItemInfo.MyContent.Text.Replace(@"\u8209?", "-") + @"\b0"; - //HLSTabTextForContMsg = @"\ul\b " + MyHighLevelParagraph.MyItemInfo.MyTab.CleanText.Trim() + @"\b0\ulnone \b " + MyHighLevelParagraph.MyItemInfo.MyContent.Text + @"\b0"; - vlnText vt1 = new vlnText(cb, this, tabText, tabText, MyHighLevelParagraph.MyTab.XOffset, yTopMargin + 0.1F, docstyle.Continue.Top.Font); - vt1.Width = MyHighLevelParagraph.MyTab.Width; - MyPageHelper.TopMessageRs.Add(vt1); - vlnText vt2 = new vlnText(cb, this, stepText, stepText, MyHighLevelParagraph.XOffset, yTopMargin + 0.1F, docstyle.Continue.Top.Font); - vt2.Width = MyHighLevelParagraph.Width; - MyPageHelper.TopMessageRs.Add(vt2); - - // the following code is used to print the top continue messages in the Calvert Alarm format - // CONDITION/RESPONSE table. Messages only get printed if the break is on a substep at steplevel > 2. - // see comments within code for what the tab contains, it varies depending on which side - // break occurred & how deep in the step the break occurred. - if (subTab != null && MyItemInfo.StepLevel > 2) { - bool incond = !MyItemInfo.IsInRNO; - float ybot = yTopMargin + (4 * SixLinesPerInch); - string concatrnoTab = ""; // constructed tab for Response side - string concataerTab = ""; // constructed tab for Condition side - float xoffTab = 0; // position for Response tab - float xoffMsg = 0; // position for Response message - vlnParagraph useAerParaForTab = null; // use this paragraph under Conditions for locating tab & message - if (incond) - { - // If break is in Condition side of table, use Condition tab of parent & no tab for Response side. - // Both sides have the message '(continued)'. - useAerParaForTab = MyParent; - concataerTab = MyParent.MyTab != null ? MyParent.MyTab.Text.TrimEnd() : ""; - xoffTab = 0; // no rno tab - xoffMsg = ToInt(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColRTable, 1) + (float)MyItemInfo.MyDocStyle.Layout.LeftMargin + ((useAerParaForTab != null && useAerParaForTab.MyTab != null) ? useAerParaForTab.MyTab.Width : 7.2f); - } - else - { - // break occurred in Response side. Use the tabs up to highest RNO concatenated together. - vlnParagraph useRnoParaForTab = MyParent; - vlnParagraph useParaForTab = MyParent; - while (useParaForTab.MyItemInfo.IsInRNO) - { - concatrnoTab = (useParaForTab.MyTab != null ? useParaForTab.MyTab.Text.TrimEnd() : "") + concatrnoTab.Trim(); - if (concatrnoTab.Length > 0 && concatrnoTab[0] > '\xff') concatrnoTab = ""; - useRnoParaForTab = useParaForTab; - useParaForTab = useParaForTab.MyParent; - } - xoffTab = useRnoParaForTab.MyTab.XOffset; - xoffMsg = useRnoParaForTab.XOffset; - - // aer message when rno broke. Need to concatenate up the Condition side also until - // hitting 1st non-sequential, i.e. moves out of Condition/Response table. - useAerParaForTab = useParaForTab; // useParaForTab is 1st found non-Response step, i.e. moved into Condition side of table - while (useParaForTab.MyItemInfo.IsSequential) - { - concataerTab = (useParaForTab.MyTab != null ? useParaForTab.MyTab.Text.TrimEnd() : "") + concataerTab.Trim(); - useAerParaForTab = useParaForTab; - useParaForTab = useParaForTab.MyParent; - } - } - // For RNO tab, add a vlntext for tab and one for continue message: - float xoff1 = xoffMsg; - if (!incond) - { - vlnText vtc = new vlnText(cb, this, concatrnoTab, concatrnoTab, xoffTab, ybot, docstyle.Continue.Bottom.Font); - MyPageHelper.TopMessageSub1s.Add(vtc); - Chunk chk = (vtc.IParagraph.Chunks[0]) as Chunk; - if (chk != null) - { - float xoff2 = xoffTab + chk.GetWidthPoint() + 6; - // If the "(continue)" is going to overlap the tab, then move the "Continue)" so that it doesn't overlap. - if (xoff2 > xoff1) xoff1 = xoff2; - } - } - MyPageHelper.TopMessageSub1s.Add(new vlnText(cb, this, myMsg, myMsg, xoff1, ybot, docstyle.Continue.Bottom.Font)); - - // for aer tab, add a vlntext for tab and one for continue message: - MyPageHelper.TopMessageSub2s.Add(new vlnText(cb, this, concataerTab, concataerTab, useAerParaForTab.MyTab.XOffset, ybot, docstyle.Continue.Bottom.Font)); - MyPageHelper.TopMessageSub2s.Add(new vlnText(cb, this, myMsg, myMsg, useAerParaForTab.XOffset, ybot, docstyle.Continue.Bottom.Font)); - addExtraLine = true; - } - } - if (!PageBreakOnStep) - { - float colPos = docstyle.Layout.LeftMargin + docstyle.Continue.Top.Margin ?? 0; - if (!docstyle.Continue.Top.PlaceAtLeftMargin) //F2019-033 when true position with respect only to the left margin - colPos += XOffsetBox; //XOffsetbox get set when the tables, figures & equations were beyond the border and needed repositioned - // C2019-044 for BNPP, put the top continue message on the same row as the checkoff/signoff heading - // RowOverride specifies the position of the top continue message - // For BNPP, RowOverride is set to the same row as the checkoff header is set to in the pagelist - if (docstyle.Continue.Top.RowOverride != null) - { - float adjRowPosition = (float)docstyle.Layout.TopMargin - (float)docstyle.Continue.Top.RowOverride; - MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, colPos, yTopMargin + 0.1F + adjRowPosition, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); - } - else - MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, colPos, yTopMargin + 0.1F, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); - - } - else - MyPageHelper.TopMessage = null; - } - return addExtraLine; - } - - private void DoBottomContinueMsg(PdfContentByte cb, float yBottomMargin, float yLocation, DocStyle docstyle, bool doThreeContinues) - { - // Console.WriteLine("Page {0} - yLocation {1}", cb.PdfWriter.PageNumber, yLocation); - string myMsg = docstyle.Continue.Bottom.Message; - - // a format flag exists that states to only put a BOTTOM message if it is a certain type (RNO) - // check for this.... - bool RNOContinueOnly = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly; - bool doBottom = !RNOContinueOnly || (MyItemInfo.IsInRNO && RNOContinueOnly); - if (doBottom && myMsg != null && myMsg != "") - { - myMsg = ReplaceStepBottomContinue(myMsg); - float msg_yLocation = 0; - if (myMsg.Contains("{par}")) - { - myMsg = myMsg.Replace("{par}", ""); - msg_yLocation = -SixLinesPerInch; - } - float yBtmMarginForMsg = yBottomMargin; - - // one of the format flags for FNP had an adjustment for printing the section title only - // on the first page of the section. Adjust the location of the bottom continue message - // if this adjustment was made (the current topmargin may not reflect the value within - // the document style) - if (MyPageHelper.PrintedSectionPage > 0) - { - if (MyItemInfo.ActiveSection != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PrintSectOnFirst) == E_DocStructStyle.DSS_PrintSectOnFirst) // C2018-003 fixed use of getting the active section - { - float localYTopMargin = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize) - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.TopMargin; // C2020-002 paper size is now set in the format files - yBtmMarginForMsg = Math.Max(0, localYTopMargin - (float)MyItemInfo.ActiveSection.MyDocStyle.Layout.PageLength); - } - } - // include space for phone list when determining bottom continue message location - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.PrintPhoneList && MyPageHelper.PhoneListHeight != 0) - yBtmMarginForMsg += (MyPageHelper.PhoneListHeight - vlnPrintObject.SixLinesPerInch); - // B2019-079: Account for compression when locating the bottom continue message - if (MyPageHelper.YMultiplier != 1) - { - //float topOfPage = PDFPageSize.PaperSizePoints(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize) - (float)MyItemInfo.MyDocStyle.Layout.TopMargin; // A4 paper logic - float topOfPage = 792 - (float)MyItemInfo.MyDocStyle.Layout.TopMargin; - yLocation = topOfPage - (topOfPage - yLocation) * MyPageHelper.YMultiplier; - } - switch (docstyle.Continue.Bottom.Location) - { - case E_ContBottomLoc.EndOfText: // place continue string at end of text - // msg_yLocation accounts for extra lines in message from docstyle; and BottomContent is the actual - // location of the last line of text on page. - //msg_yLocation = ((float)(MyPageHelper.BottomContent??0) - (SixLinesPerInch * MyPageHelper.YMultiplier)); // B2018-080 null reference check added - // B2019-079 changed yLocaton - msg_yLocation to '+'. The msg_ylocation has an adjustment for adding an extra line by moving down the page, this was moving - // the line up the page (double negative). - msg_yLocation = yLocation + msg_yLocation - (SixLinesPerInch * MyPageHelper.YMultiplier); //B2019-021 yLocation accounts for checkoffs - if (yBottomMargin + (docstyle.Layout.FooterLength ?? 0) > msg_yLocation) - { // Adjusted Continue Message Y Offset - //DebugPagination.WriteLine("====>> {0},'{1}'", msg_yLocation, MyItemInfo.ShortPath); - //msg_yLocation = (float) MyPageHelper.BottomContent - SixLinesPerInch; // Account for how low the lowest Item is on the page - float msg_yLocationOld = msg_yLocation = yBottomMargin + (docstyle.Layout.FooterLength ?? 0); - if (MyPageHelper.BottomContent != null) - msg_yLocation = Math.Min(yBottomMargin + (docstyle.Layout.FooterLength ?? 0), (float)MyPageHelper.BottomContent - SixLinesPerInch);// RHM20150525 - Table Scrunch - if (msg_yLocationOld != msg_yLocation) - _MyLog.WarnFormat("Continue Message Moved from {0} to {1} for {2}", msg_yLocationOld, msg_yLocation, this);// RHM20150525 - Table Scrunch - } - break; - case E_ContBottomLoc.BtwnTextAndBottom: // place continue string between end of text & bottom of page - msg_yLocation = msg_yLocation + yLocation - ((yLocation - yBottomMargin) / 2); // +SixLinesPerInch; // (need this for IP3) - msg_yLocation = Math.Max(msg_yLocation, yBottomMargin + SixLinesPerInch); - break; - case E_ContBottomLoc.BottomOfPage: // place continue message at bottom of page - //msg_yLocation = yBottomMargin + 2 * SixLinesPerInch + (float)docstyle.Layout.FooterLength; // 2 lines above bottom margin - msg_yLocation = msg_yLocation + yBtmMarginForMsg + (float)docstyle.Layout.FooterLength; - // if (MyPageHelper.YMultiplier != 1.0F) msg_yLocation = msg_yLocation / MyPageHelper.YMultiplier; - break; - case E_ContBottomLoc.BelowBottom1: - msg_yLocation = msg_yLocation + yBtmMarginForMsg; - break; - case E_ContBottomLoc.BottomWithFooter: // put bottom message AND if in CONDITION/RESPONSE table, in both columns. - msg_yLocation = msg_yLocation + yBtmMarginForMsg; - break; - case E_ContBottomLoc.EndOfText2: // Like EndOfText but limited within yBottomMargin - msg_yLocation = Math.Max(msg_yLocation + yLocation - SixLinesPerInch, yBottomMargin + SixLinesPerInch); - break; - case E_ContBottomLoc.BtwnTextAndBottom2: - // Like BtwnTextAndBottom but accounts for line spacing of step & is 1 line up on page (for BGE - Procedure Steps - 2 column) - float adj = (!MyItemInfo.IsSection && MyItemInfo.FormatStepData.StepLayoutData.EveryNLines == 1) ? SixLinesPerInch : 0; - msg_yLocation = msg_yLocation + yLocation - ((yLocation - yBottomMargin) / 2) + adj;// +SixLinesPerInch; - if (msg_yLocation < yBottomMargin) msg_yLocation = yBottomMargin; - break; - default: - _MyLog.WarnFormat("**** BOTTOM CONTINUE MESSAGE NOT CODED FOR LOCATION {0}*****", docstyle.Continue.Bottom.Location); - break; - } - if (!PageBreakOnStep) - { - float xoffB = 0; - // Added for Calvert Alarms: if 'doThreeContinues', continue message at bottom of page - // and a continue message at the bottom of each column. - if (doThreeContinues) - { - float ybot = yLocation; - xoffB = (float)docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.Margin ?? 0; - MyPageHelper.BottomMessageA = new vlnText(cb, this, myMsg, myMsg, xoffB, ybot, docstyle.Continue.Bottom.Font); - xoffB = docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.MarginR ?? 0; - MyPageHelper.BottomMessageR = new vlnText(cb, this, myMsg, myMsg, xoffB, ybot, docstyle.Continue.Bottom.Font); - MyPageHelper.AlarmYoffEnd -= SixLinesPerInch; - float tmp = (((float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin) / 2) - (myMsg.Length / 2 * 5); - xoffB = (float)docstyle.Layout.LeftMargin + tmp; - } - else if (docstyle.Continue.Bottom.Location == E_ContBottomLoc.BottomWithFooter) - { - float tmp = (((float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin) / 2) - (myMsg.Length / 2 * 5); - xoffB = (float)docstyle.Layout.LeftMargin + tmp; - } - else if (RNOContinueOnly) - { - // The following line was added for McGuire APs/AP/1/5500/12, Step 13 - //if (msg_yLocation < yBottomMargin + SixLinesPerInch) msg_yLocation = yBottomMargin + SixLinesPerInch; - float colR = float.Parse(MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColRTable.Split(",".ToCharArray())[MyItemInfo.ColumnMode]); - xoffB = colR + docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.Margin ?? 0; - } - else if (MyItemInfo.IsInRNO && (docstyle.Continue.Bottom.MarginR ?? 0) > 0) - { - xoffB = (float)docstyle.Layout.LeftMargin + (float)docstyle.Continue.Bottom.MarginR; - MyPageHelper.BottomMessageR = new vlnText(cb, this, myMsg, myMsg, xoffB, msg_yLocation, docstyle.Continue.Bottom.Font); - xoffB = (float)docstyle.Layout.LeftMargin + (float)docstyle.Continue.Bottom.Margin; - - } - // FloatingContinueMessage format flag: - // if breaking at the AER put continue message in left column, - // if breaking RNO put continue message in Right column. - else if (MyItemInfo.IsInRNO && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.FloatingContinueMessage) - { - float colR = float.Parse(MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColRTable.Split(",".ToCharArray())[MyItemInfo.ColumnMode]); - xoffB = colR + docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.Margin ?? 0; - } - else - xoffB = docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.Margin ?? 0; - //MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, docstyle.Continue.Bottom.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); - MyPageHelper.BottomMessage.Clear(); // B2017-207 should be only one continue message - was putting an extra continue message in middle of page for V.S.Summer (ex. AOP set, 900.4 Attachment 12) - MyPageHelper.BottomMessage.Add(new vlnText(cb, this, myMsg, myMsg, xoffB, msg_yLocation, docstyle.Continue.Bottom.Font)); - } - } - if (PageBreakOnStep) MyPageHelper.BottomMessage.Clear(); - } - - private void RefreshDocStyle() - { - MyItemInfo.ActiveSection = null; - MyItemInfo.MyDocStyle = null; - MyPageHelper.MySection = MyItemInfo as SectionInfo; - MyPageHelper.ResetSvg(); - MyPageHelper.PrintedSectionPage = 0; - } - - private string ReplaceStepBottomContinue(string myMsg) - { - string tb = null; - if (MyItemInfo.IsSection) - tb = MyItemInfo.MyTab.CleanText.Trim(); - else - tb = MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols; - // if the tab ends with .0, remove it if it was added because of the virtualdotinhls flag. - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.VirtualDotInHLSTab && tb.Contains(".0")) tb = tb.Replace(".0", ""); - if (myMsg.IndexOf(@"%d") > -1) - myMsg = myMsg.Replace(@"%d", tb.Trim()); - if (myMsg.IndexOf(@"%0d") > -1) - myMsg = myMsg.Replace(@"%0d", tb.Trim(" .".ToCharArray())); - if (myMsg.IndexOf(@"%2d") > -1) - myMsg = myMsg.Replace(@"%2d", tb.Trim(" .".ToCharArray()).PadLeft(2)); - if (myMsg.IndexOf(@"%3d") > -1) - myMsg = myMsg.Replace(@"%3d", MyItemInfo.MyHLS.Ordinal.ToString()); - // F2020-023: tab includes parent tab and if caution/note don't use its parent, go up another level - if (myMsg.IndexOf(@"%s") > -1) // %s was added for F2020-023 - { - string tmp = tb.Trim(); - if (!MyItemInfo.MyParent.IsHigh) - { - tmp = MyItemInfo.IsCautionOrNotePart ? MyItemInfo.MyParent.MyParent.CombinedTab : MyItemInfo.MyParent.CombinedTab; - // C2021-024: WCN1 if bullet exists in combined tab, stop right before bullet. - // B2021-085 & 087: crash if noBullet was null. Also, if null, see if text in parent. if no text, replace the - // "%s." with noBullet (null) which won't put out just a '.' as step number. - if (MyItemInfo.MyDocStyle.Continue.Bottom.RemoveBullet) - { - if (tmp == null && MyItemInfo.IsCautionOrNotePart) tmp = MyItemInfo.MyParent.CombinedTab; - if (tmp != null) - { - int ind = tmp.IndexOf(".o"); - if (ind < 0) ind = tmp.IndexOf(".*"); - if (ind > -1) tmp = tmp.Substring(0, ind); - } - else - { - myMsg = myMsg.Replace(@"%s.", tmp); - } - } - } - myMsg = myMsg.Replace(@"%s", tmp); - } - return myMsg; - } - private vlnParagraph TopMostChild - { - get - { - if (ChildrenAbove.Count > 0) return ChildrenAbove[0].TopMostChild; - return this; - } - } - private bool EmptyTopMostPart - { - get - { - if (TopMostChild.PartsAbove.Count == 0) return false; - if (TopMostChild.PartsContainer != null && TopMostChild.PartsContainer.Count > 0) return false; // B2016-198: not 'EmptyTopMostPart' if there is a box. - foreach (vlnPrintObject po in TopMostChild.PartsAbove) - { - vlnHeader hd = po as vlnHeader; - if (hd == null) return false; - if (hd.Text != "") return false; - } - return true; - } - } - // B2019-115 Locate Bottom Continue Message below AER Table if necesssary - private float _TableBottom = -1; - public float TableBottom - { - get { return _TableBottom; } - set { _TableBottom = value; } - } - private float OutputOtherPageSteps(PdfContentByte cb, float YTopMost, float yPageStart, float yTopMargin, float yBottomMargin) - { - // B2019-115 Locate Bottom Continue Message below AER Table if necessary - Initialize TableBottom to -1 - TableBottom = -1; - float retval = YTopMost; - // Find any items remaining in MyPageHelper.MyParagraphs that should be printed on this page. - vlnParagraphs process = new vlnParagraphs(null); - int processed = 0; - foreach (vlnParagraph vPara in MyPageHelper.MyParagraphs.Values) - { - if (!vPara.Processed) - { - if (vPara.MyItemInfo.IsTable && (vPara.YOffset <= YTopMost) && vPara.MyItemInfo.ActiveSection.ColumnMode > 0 && vPara.Height + yBottomMargin < yPageStart - vPara.YOffset) //B2019-120 Byron ELEC-1 step 3 second table was not printing on following page - { - if (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID) - { - // B2019-115 Locate Bottom Continue Message below AER Table if necessary - _MyLog.WarnFormat("\r\n=-=-=> Table Print on First Page {0} {1} ColumnMode = {2}", vPara.MyItemInfo.ItemID, vPara.MyItemInfo.ShortPath, vPara.MyItemInfo.ActiveSection.ColumnMode); - process.Add(vPara); - // Console.WriteLine("Table YOffset {0} height {1} Bottom = {2} yPageStart = {3} Bottom {4}", vPara.YOffset, vPara.Height, vPara.YOffset + vPara.Height - yPageStart, yPageStart, this.YBottom); - } - } - else if (((vPara.YOffset + vPara.Height) < YTopMost)) - { - // B2019-028: Added check for active section in next line so that following section text doesn't overlap or start too far down on page for case where there is a subsection - // with subsections of type Step/Word/Step - //if (vPara.MyItemInfo.ActiveSection.ItemID == this.MyItemInfo.ActiveSection.ItemID && (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID)) // 20150701 Complicated RNO change - if (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID) - { - // B2019-077: 2.0 SCOPE empty section not printing for WES (revert to previous code line versus above) - process.Add(vPara); - } - else // 20150701 Complicated RNO change - _MyLog.WarnFormat("Less Than: Step Could Have Fit {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); - } - else if (((vPara.YOffset + vPara.Height) == YTopMost)) - { - - // B2019-028: see above comment (same check was added) - //if (vPara.MyItemInfo.ActiveSection.ItemID == this.MyItemInfo.ActiveSection.ItemID && (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID)) // RHM20150507 Table Scrunch - if (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID) // B2019-077: see above - { - process.Add(vPara); - _MyLog.WarnFormat("New AerRno PageBreak Logic: Step Could Have Fit {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); - } - else // RHM20150507 Table Scrunch - _MyLog.WarnFormat("Equal: Step Could Have Fit {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); - } - else if (((vPara.YOffset) < YTopMost)) - { - retval = Math.Min(retval, vPara.YTopMost); - } - } - else - processed++; - } - //Console.WriteLine("~~~ {0} has {1} Steps {2} Processed {3} to Process", MyItemInfo.ShortPath, MyPageHelper.MyParagraphs.Count - // , processed,process.Count); - foreach (vlnParagraph vPara in process) - { - vPara.ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); - // B2019-115 Locate Bottom Continue Message below AER Table if necessary - if(vPara.MyItemInfo.IsTable) - { - if (TableBottom == -1) - TableBottom = (yPageStart-vPara.YOffset)-vPara.Height- SixLinesPerInch; - else - TableBottom = Math.Min(TableBottom, (yPageStart - vPara.YOffset) - vPara.Height - SixLinesPerInch); - } - } - return retval; - } - private float _YVeryTop = -1; - public float YVeryTop - { - get - { - if (_YVeryTop == -1) - { - _YVeryTop = YTop; - _YVeryTop = VeryTop(PartsAbove, _YVeryTop); - _YVeryTop = VeryTop(PartsContainer, _YVeryTop); - } - return _YVeryTop; - } - } - - private float VeryTop(vlnPrintObjects parts, float yVeryTop) - { - if (parts != null) - foreach (vlnPrintObject part in parts) - if (part.YOffset < yVeryTop) - yVeryTop = part.YOffset; - return yVeryTop; - } - /// - /// This gets the height of the step with it's Caution's, Notes and potentially any First Substeps - /// - /// - // F2024-006: Vogtle Alarms pagination - added 'includeFirstSub' to get that size of the first substep with the parent step - // to help determine pagination - private float GetFirstPieceSize(bool includeFirstSub = false) - { - vlnParagraph paraLast = GetFirstPieceLastPart(includeFirstSub); - float retval = (paraLast.YBottom) - YTopMost; - //Console.WriteLine(MyItemInfo.DBSequence); - return retval; - } - public override float YBottom - { - get - { - float bottom = YOffset + Height; - if (PartsBelow != null) - { - foreach (vlnPrintObject part in PartsBelow) - { - float partBottom = part.YBottom; - bottom = Math.Max(partBottom, bottom); - } - } - return bottom; - } - } - public float YVeryBottom - { - get - { - float bottom = YOffset + Height; - if (ChildrenBelow != null) - foreach (vlnParagraph child in ChildrenBelow) - bottom = Math.Max(child.YVeryBottom, bottom); - if (ChildrenLeft != null) - foreach (vlnParagraph child in ChildrenLeft) - bottom = Math.Max(child.YVeryBottom, bottom); - if (ChildrenRight != null) - foreach (vlnParagraph child in ChildrenRight) - bottom = Math.Max(child.YVeryBottom, bottom); - if (PartsBelow != null) - foreach (vlnPrintObject part in PartsBelow) - bottom = Math.Max(part.YBottom, bottom); - return bottom; - } - } - public float YBottomText - { - get - { - return YOffset + Height; - } - } - private float _YBottomForBox = 0; - public float YBottomForBox - { - get { return _YBottomForBox; } - set { _YBottomForBox = value; } - } - // F2024-006: Vogtle Alarms pagination - added 'includeFirstSub' to get that size of the first substep with the parent step - // to help determine pagination - even when PaginateOnFirstSubstep is turned on - private vlnParagraph GetFirstPieceLastPart(bool includeFirstSub = false) - { - vlnParagraph para = this; - if ((!MyItemInfo.ActiveFormat.MyStepSectionLayoutData.PaginateOnFirstSubstep || includeFirstSub) && ChildrenBelow != null && ChildrenBelow.Count > 0) - { - // If the substep has a separator (OR, AND) then return the last substep rather than the first. - string mySep = ChildrenBelow[0].MyItemInfo.FormatStepData.Sep ?? "{Null}"; - if (mySep != "{Null}" && mySep != "") - para = ChildrenBelow[ChildrenBelow.Count - 1].GetFirstPieceLastPart(); - else - { - // MNS Pagination - Mike Weiner Case 1a to keep step together with any non-sequential substeps (ANDs, EQ List) - bool keepEqListTogether = ChildrenBelow[0].MyItemInfo.ActiveFormat.MyStepSectionLayoutData.PutOnPageByItself; - if (keepEqListTogether && !ChildrenBelow[0].MyItemInfo.IsSequential && !this.MyItemInfo.IsHigh) // Extend to the last Item. - para = ChildrenBelow[ChildrenBelow.Count - 1].GetFirstPieceLastPart(); - else - para = ChildrenBelow[0].GetFirstPieceLastPart(includeFirstSub); - } - } - if (ChildrenRight != null && ChildrenRight.Count > 0) - { - foreach (vlnParagraph paraRight in ChildrenRight) - { - vlnParagraph paraRightLast = paraRight.GetFirstPieceLastPart(includeFirstSub); - if (paraRightLast.YBottom > para.YBottom) - para = paraRightLast; - } - } - return para; - } - /// - /// Find items from previous page (yLocation less than yTop) and remove them from the list. - /// yTop is the new starting location on the next page for this step. - /// - /// - /// - private void RemoveProcessedParagraphs(StepLevelList myList, float yTop) - { - // the two CleanUpLists are used to remove items from - // the original list because list items cannot be removed in a - // 'foreach'. - List CleanupListStepLevel = new List(); - foreach (int stepLevel in myList.Keys) - { - List CleanupListYLocation = new List(); - SortedList AdjustYLocation = new SortedList(); - foreach (float yLocation in myList[stepLevel].Keys) - { - if (-yLocation <= yTop) - CleanupListYLocation.Add(yLocation); - else - AdjustYLocation.Add(-yLocation, yLocation); // order in ascending order - } - foreach (float yLocation in CleanupListYLocation) - myList[stepLevel].Remove(yLocation); - foreach (float yLocation in AdjustYLocation.Keys) - { - vlnParagraph para = myList[stepLevel][-yLocation]; - myList[stepLevel].Remove(-yLocation); - // shift yLocation by yTop to work with items whose locations - // are defined from the top of the new page rather than - // from the beginning of the step. - // Note that yLocation is negative to have items in descending - // order so that adding yTop decrements their values. - if (!myList[stepLevel].ContainsKey(yTop - yLocation)) - myList[stepLevel].Add(yTop - yLocation, para); - } - if (myList[stepLevel].Count == 0) - CleanupListStepLevel.Add(stepLevel); - } - foreach (int stepLevel in CleanupListStepLevel) - myList.Remove(stepLevel); - } - /// - /// Builds a list of paragraphs by StepLevel and yLocation in descending order. - /// - /// - /// - private void BuildLocationList(float yTopMost, ParagraphLocations myLocations) - { - foreach (vlnParagraph child in ChildrenAbove) - child.BuildLocationList(yTopMost, myLocations); - foreach (vlnParagraph child in ChildrenLeft) - child.BuildLocationList(yTopMost, myLocations); - - // Add a list entry consisting of StepLevel, yoffset from the beginning of this step, paragraph itself - myLocations.Add(this, yTopMost); - - foreach (vlnParagraph child in ChildrenRight) - child.BuildLocationList(yTopMost, myLocations); - foreach (vlnParagraph child in ChildrenBelow) - child.BuildLocationList(yTopMost, myLocations); - } - private int COL_WID_ADJ = 6; // adjusts for incorrect use of WidSTable when breaking a line (it breaks 6 chars too short) - private bool IsTitleType(ItemInfo itm) - { - if (itm.FormatStepData != null && (itm.FormatStepData.Index == 42 || itm.FormatStepData.Index == 43)) return true; - return false; - } - private static VlnFlexGrid _MyFlexGrid = new VlnFlexGrid(1, 1); - public static VlnFlexGrid MyFlexGrid - { - get { return _MyFlexGrid; } - } - private pkParagraph _MyPlaceKeeper = null; - public pkParagraph MyPlaceKeeper - { - get { return _MyPlaceKeeper; } - set { _MyPlaceKeeper = value; } - } - private pkParagraph _MyContAct = null; - public pkParagraph MyContAct - { - get { return _MyContAct; } - set { _MyContAct = value; } - } - // F2022-024 Time Critical Action - private pkParagraph _MyTimeCriticalAction = null; - public pkParagraph MyTimeCriticalAction - { - get { return _MyTimeCriticalAction; } - set { _MyTimeCriticalAction = value; } - } - public static bool InList(int id, params int[] ids) - { - foreach (int listid in ids) - if (id == listid) return true; - return false; - } - private bool _PrefixSpecialCharacter = false; - public bool PrefixSpecialCharacter - { - get { return _PrefixSpecialCharacter; } - set { _PrefixSpecialCharacter = value; } - } - private string _Prefix; - public string Prefix - { - get { return _Prefix; } - set { _Prefix = value; } - } - private string _Suffix; - public string Suffix - { - get { return _Suffix; } - set { _Suffix = value; } - } - private float RoughSizeOfPage - { - get - { - return (float)(MyItemInfo.MyDocStyle.Layout.PageLength /*- MyItemInfo.MyDocStyle.Layout.TopMargin*/ - MyItemInfo.MyDocStyle.Layout.FooterLength); - } - } - private PromsPrinter _MyPromsPrinter; - public PromsPrinter MyPromsPrinter - { - get { return _MyPromsPrinter; } - set { _MyPromsPrinter = value; } - } - public static float _yPageStartForSupInfo = 0; - public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent, bool loadChildren, PromsPrinter pp) - { - MyPromsPrinter = pp ?? parent.MyPromsPrinter; - int profileDepth = ProfileTimer.Push(">>>> vlnParagraph"); - Prefix = prefix; - Suffix = suffix; - MyItemInfo = itemInfo; - MyContentByte = cb; - if (itemInfo.IsFootnote && loadChildren) - { - // notestofootnoteshls is a list, a hls can have more than one note - if (MyPageHelper.NotesToFootNotesHLS.ContainsKey(itemInfo.MyHLS.ItemID)) - MyPageHelper.NotesToFootNotesHLS[itemInfo.MyHLS.ItemID].Add(itemInfo.ItemID); - else - { - List notesList = new List(); - notesList.Add(itemInfo.ItemID); - MyPageHelper.NotesToFootNotesHLS.Add(itemInfo.MyHLS.ItemID, notesList); - } - Processed = true; // don't want to print during normal ToPdf/ParagraphToPdf cycle - print in vlnsvgpagehelper - ProfileTimer.Pop(profileDepth); - return; - } - // do some 'setup' for Calvert Alarms: - if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - { - // The CONDITION/RESPONSE portion of the alarm uses a macro to print the 'table' heading, - // i.e. the lines/boxes and text for CONDITION and RESPONSE. This does not have a tab, - // tabs are where the macros are usually stored, so flag this for future reference. - // The 2nd if is executed when the step is at the same y offset as the parent, i.e. DEVICE & SETPOINT text. - if (itemInfo.TemplateIndex > 0 && itemInfo.ActiveFormat.PlantFormat.FormatData.Templates[itemInfo.TemplateIndex].hmacro > 0) - HasCalvertMacro = true; - if (KeepOnParentLine(itemInfo)) yoff = parent.YOffset; - } - float yOffOrig = yoff; - // Save step text information to be used to create a PlaceKeeper (Calver Cliffs) - BuildPlacekeeper(parent, itemInfo); - - // Save step text information to be used to create a Continuous Action Summary - if (MyPromsPrinter.ShouldPrint_CAS_CTAS) BuildContinuousActionSummary(parent, itemInfo); - - // F2022-024 Time Critical Step - // Save step text information to be used to create a Time Critical Action Summary - if (MyPromsPrinter.ShouldPrint_CAS_CTAS) BuildTimeCriticalActionSummary(parent, itemInfo); - - if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null) - _MyBoxLeftAdj = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj); - ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles; - if (itemInfo.IsSection && itemInfo.ActiveSection.DisplayText.ToUpper().Contains("") && !itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.PrintNoTitle) ShowSectionTitles = false; - HasIndent = itemInfo.IsStep && itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.DontResetIndentOnNewline; - - int MetaLevel = 0; // if meta section, stores what level this section is. - float savCheckListBottomMost = 0; - //int[] problemIDs = { 889 }; - //List lProblemIDs = new List(problemIDs); - //if (lProblemIDs.Contains(itemInfo.ItemID)) - // Console.WriteLine("Found Item {0}", itemInfo.ItemID);formatInfochecko - MyParent = parent; - // The following code determines the last paragraph for an RNO - // MyTopRNO finds the Top paragraph for an RNO - if (itemInfo.IsInRNO) - { - if (rnoLevel <= maxRNO && itemInfo.IsRNOPart) // Not top level RNO - MyTopRNO = this; - else - MyTopRNO = MyParent.MyTopRNO; - if (MyTopRNO != null) MyTopRNO.LastRNO = this; - } - if (!MyPageHelper.MyParagraphs.ContainsKey(itemInfo.ItemID) && !itemInfo.IsFootnote) - { - MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this); - } - // if this a continuous subsection, refresh the style. - // This was commented out to fix a Westinghouse print issue 3-21-2014, orignally put in for Farley - //if (itemInfo.IsStepSection && !(itemInfo as SectionInfo).IsSeparatePagination() && itemInfo.MyParent.IsSection) - // RefreshDocStyle(); - - XOffset = xoff; - if (!MyItemInfo.IsStep && !MyItemInfo.IsStepSection && MyItemInfo.MyContent.MyEntry != null) - { - IsWordDocPara = true; - // special case - this is a 'Word Doc' paragraph. The Processed flag is used to know - // that steps need put out on a page for the pagination logic, and since there are no steps - // we don't want to have to worry about putting this out for pagination logic. - Processed = true; - ProfileTimer.Pop(profileDepth); - return; - } - YTopMost = YOffset = yoff; - vlnTab mytab = null; - bool doSectTab = false; - // if this substep has a caution or note as its parent, then there may have been a special indent done on the - // substep... check the CautionOrNoteSubstepIndent value, this is the additional indent amount in number - // of characters. - if (itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote) - { - // if this is a Note or Caution off of a Note or Caution (Catawba EG/1A/CSAM/SACGR1 step 1) - // then indent it the length of its tab - if (itemInfo.IsCaution || itemInfo.IsNote) - XOffset += (!itemInfo.IsBackgroundStep()) ? (itemInfo.FormatStepData.TabData.IdentPrint.Length - 1) * 6 : 0; // B2018-139 don't adjust XOffset when processing a Caution, or Note background text is is off of Caution or Note WCN BG SAG-10 step 4 - - else - if (itemInfo.ActiveFormat.MyStepSectionLayoutData.DevNoteOrCautionTabOffset != null) - XOffset = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.DevNoteOrCautionTabOffset); - else - XOffset += 72 * (itemInfo.FormatStepData.CautionOrNoteSubstepIndent == null ? 0 : (float)itemInfo.FormatStepData.CautionOrNoteSubstepIndent / (float)itemInfo.FormatStepData.Font.CPI); - } - - if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && - itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab - || (itemInfo.Steps != null && itemInfo.Steps.Count > 0 && itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab)) - itemInfo.MyTab = null; - - float xMetaAdj = 0; - - if (itemInfo.IsFootnote) itemInfo.MyTab = null; - - if (itemInfo.IsSupInfoPart) XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - - //if (itemInfo.MyTab != null && itemInfo.MyTab.Text != null && itemInfo.MyTab.Text != "") - // bug fix - if the section does not have a section number, then we need to build an empty tab for the itemInfo - // so that we place the section title in the correct location. so we need to go into this IF code block - // even if itemInfo has a MyTab that is an empty string when itemInfo is a section - 2/11/2015 - if (itemInfo.MyTab != null && itemInfo.MyTab.Text != null && (itemInfo.MyTab.Text != "" || itemInfo.IsSection)) - { - float localXOffset = XOffset; - bool doprint = true; - if (itemInfo.IsSection) - { - MyItemInfo.ActiveSection = null; - MyItemInfo.MyDocStyle = null; - DocStyle ds = MyItemInfo.MyDocStyle; - - if (!ds.ComponentList && ShowSectionTitles - && !MyItemInfo.MyDocStyle.CancelSectTitle - && !MyItemInfo.MyDocStyle.SpecialStepsFoldout) // Don't ouput the Step Section title - { - SectionConfig sch = MyItemInfo.MyConfig as SectionConfig; - if (sch != null && sch.Section_PrintHdr != "Y") - { - doprint = false; - YTopMost = 0; - } - } - else - doprint = false; - } - // if printing the supplemental info facing page, don't put out the section title. ToPdf will put out 'Supplemental Information' title. - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && MyPageHelper.CreatingSupInfoPage && itemInfo.IsSection) doprint = false; - if (doprint && itemInfo.IsSection && !itemInfo.MyDocStyle.CancelSectTitle && (itemInfo.MyConfig as SectionConfig).Section_IsFoldout != "Y") //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box - { - doSectTab = true; - if (itemInfo.IsStepSection && formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Just.Contains("PSLeft")) - { - float offset = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - if (formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos != null) - { - ItemInfo iilvl = itemInfo; - while (!iilvl.IsProcedure) - { - // see if this metasection, walking up the tree, has its header printed, - // if so, indent for it. - SectionConfig sch1 = iilvl.MyConfig as SectionConfig; - if (sch1.Section_PrintHdr == "Y" || MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) - MetaLevel++; - iilvl = iilvl.MyParent; - } - - if (formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) - { - if (MetaLevel == 1) - offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; - else - { - SectionConfig sc = itemInfo.MyParent.MyConfig as SectionConfig; - if (MyParent != null) - { - // if the parent is not printed, then adjust the xoffset based on - // the level of the metasection. Note that the 'if (MetaLevel==20) MetaLevel = 1' - // line of code was added so that the xoffsets between 16 & 32 bit are closer. - // This code was added to fix problems in BGE OI34, Appendix sections/subsection xoffsets. - if (sc != null && sc.Section_PrintHdr == "N") - { - if (MetaLevel == 2) MetaLevel = 1; - xMetaAdj = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[0].ColSByLevel; - for (int i = 0; i < MetaLevel; i++) - { - xMetaAdj += (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos - (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; - xMetaAdj += (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[i].SecNumPositionAdj; - } - offset += xMetaAdj; - } - else - { - offset = (sc != null && sc.SubSection_AutoIndent == "Y") ? MyParent.XOffset - : (MyParent.MyTab != null) ? MyParent.MyTab.XOffset : XOffset; - } - } - } - } - else - { - - MetaLevel = MetaLevel <= 2 ? 1 : MetaLevel - 1; - if (MetaLevel == 1) - offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; - else - { - xMetaAdj = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[0].ColSByLevel; - for (int i = 0; i < MetaLevel; i++) - { - xMetaAdj += (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos - (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; - xMetaAdj += (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[i].SecNumPositionAdj; - - } - offset += xMetaAdj; - itemInfo.MyTab.Text = itemInfo.MyTab.Text.TrimEnd(" ".ToCharArray()); - itemInfo.MyTab.CleanText = itemInfo.MyTab.CleanText.TrimEnd(" ".ToCharArray()); - if (((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_SameXOffSubsections) == E_DocStructStyle.DSS_SameXOffSubsections)) - offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; - } - } - } - localXOffset = offset; - } - } - if (!itemInfo.IsSection || doSectTab) - { - if (itemInfo.IsSupInfoPart) // get combined tab if on a supinfo facing page: - mytab = GetSupInfoTab(cb, itemInfo, yoff, mytab, doSectTab, localXOffset); - else if (itemInfo.MyTab.AltPrintTab != null) - mytab = new vlnTab(cb, this, itemInfo.MyTab.AltPrintTab, itemInfo.MyTab.AltPrintTab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline); - else - { - string clntxt = itemInfo.MyTab.CleanText; - if (!string.IsNullOrEmpty(itemInfo.FormatStepData?.TabData?.MacroEditTag) && itemInfo.FormatStepData.TabData.MacroEditTag == "_" && clntxt.StartsWith("_")) - clntxt = clntxt.Substring(1); - mytab = new vlnTab(cb, this, itemInfo.MyTab.Text, clntxt, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline); - } - PartsLeft.Add(mytab); - if (mytab.MyMacro != null) PartsLeft.Add(mytab.MyMacro); - } - } - else if (itemInfo.IsSupInfoPart) // if it was an empty tab - it may have been a caution/note - { - mytab = GetSupInfoTab(cb, itemInfo, yoff, mytab, doSectTab, XOffset); - PartsLeft.Add(mytab); - } - // if this is the High Level RNO step (MyTopRNO) and we are numbering the RNO, adjust the xoffset to start the tab - // at the x location rather than starting the text at the x location: - AdjustWidth(itemInfo, maxRNO, formatInfo, mytab); - bool adjustAgain = ((itemInfo.MyTab != null && itemInfo.MyTab.Position == 0) || (itemInfo.MyPrevious != null && itemInfo.MyPrevious.FormatStepData != null && itemInfo.MyPrevious.FormatStepData.TabData.IsTransition)) ? true : false; - if (!itemInfo.IsSection && itemInfo.FormatStepData.NumberHighLevel && itemInfo.IsRNOPart && (MyTopRNO == null || itemInfo.ItemID == MyTopRNO.MyItemInfo.ItemID)) - { - // adjust the x-offset of the RNO to include the tab. - if (itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthSameAsHighParent)// && !itemInfo.MyParent.IsHigh) - { - vlnParagraph hls = GetHighLevelParagraph(); - float RnoOffset1 = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO); - float offset = hls.Width + RnoOffset1 + hls.XOffset; - vlnTab tb = hls.MyTab; - //offset += tb.Width; - if (MyTopRNO == null) - Width -= (float)itemInfo.ActiveFormat.MyStepSectionLayoutData.SingleColumnRNOIndent; - offset -= Width; - float inc = offset - XOffset; - if (mytab != null) - mytab.XOffset += inc;// +(itemInfo.MyParent.IsHigh ? 6.8f : 0); - XOffset += inc; - adjustAgain = false; - } - else if (itemInfo.FormatStepData.AdjHighLevelTab != null && itemInfo.ColumnMode > 0) - // For Farley (only plant format to use AdjHighLevelTab), determine the xoffset based on - // where the right edge of the text is. Their RNO's are numbered with parent numbering - // so the calculations for determining the xoffset backs up from the right edge. - { - float rightTextEdge = this.MyHighLevelParagraph.XOffset + this.MyHighLevelParagraph.Width; - int colRx = int.Parse(formatInfo.MyStepSectionLayoutData.ColRTable.Split(",".ToCharArray())[itemInfo.ColumnMode]); - rightTextEdge += (colRx + (itemInfo.FormatStepData.AdjHighLevelTab ?? 0)); - float diff = rightTextEdge - (XOffset + Width); - if (mytab != null) mytab.XOffset += diff; - XOffset += diff; - adjustAgain = false; - } - else if (mytab != null) - { - float adjusttab = (itemInfo.MyParent.IsHigh) ? itemInfo.FormatStepData.AdjHighLevelTab ?? 0 : 0; - mytab.XOffset += (mytab.Width + adjusttab); - XOffset = mytab.XOffset + mytab.Width; - if (adjusttab != 0) Width += (mytab.Width); - } - } - if (adjustAgain) - { - AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj); - // Used in Ginna's Attachment format. - // if the Note/Caution is off of a sub-step, then adjust the width so that the Caution/Note text box does not extend past the HLS text box - if (itemInfo.IsCautionOrNotePart && maxRNO == 0 && (itemInfo.ActiveSection != null && itemInfo.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.LimitCautionNoteWidthToHLS)) // C2018-003 fixed use of getting the active section - { - float wMax = MyHighLevelParagraph.Width + MyHighLevelParagraph.XOffset - XOffset; - if (wMax < Width && (Width + XOffset > MyItemInfo.MyDocStyle.Layout.PageWidth)) Width = wMax; - } - } - - if (itemInfo.IsSection && MyParent == null && itemInfo.MyDocStyle.SupplementalInformation && MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge) - { - _SupInfoSection = new vlnParagraph(this, cb, itemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRightParent, false, pp); - MyPromsPrinter.SupInfoPdfPageCount = -1; - } - // For Calvert Alarms: if within the CONDITION/RESPONSE table, indent by 1 character. - // Sequential substeps are ok because of the tab string, but items without a tab & other step - // types were writing over the CONDITION/RESPONSE vertical table line. This code uses - // 7.2 for the character size to match 16bit output. - if (itemInfo.IsStep && !itemInfo.IsSequential && !itemInfo.IsCaution && !itemInfo.IsNote && MyParent.HasCalvertMacro) - { - XOffset += 7.2f; - if (mytab != null) mytab.XOffset += 7.2f; - } - if ((itemInfo.IsCaution || (itemInfo.IsNote && !itemInfo.IsFootnote)) && (itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS) - { - if (itemInfo.IsInRNO) - { - XOffset = MyTopRNO.MyTab != null ? MyTopRNO.MyTab.XOffset : MyTopRNO.XOffset; - Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - XOffset - 10; - } - else - { - XOffset = MyHighLevelParagraph.MyTab.XOffset; - Width = MyHighLevelParagraph.MyTab.Width + MyHighLevelParagraph.Width - 6; // make width 1/2 char smaller so it doesn't touch line - } - } - if (UseTemplateWidthOrXOff(itemInfo)) - { - float txoff = GetWidthOrStartFromTemplate(itemInfo, itemInfo.ActiveFormat, false); - if (txoff > 0) XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + txoff; // GetWidthOrStartFromTemplate(itemInfo, itemInfo.ActiveFormat, false); - } - if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) - yoff += SetHeader(this, cb, itemInfo, formatInfo); - else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.SeparateBox && itemInfo.FirstSibling.MyHeader != null && itemInfo.FirstSibling.MyHeader.Text != null) - yoff += SetHeader(this, cb, itemInfo.FirstSibling, formatInfo); - float yoffLeft = yoff; - if (ChildrenAbove != null) - ChildrenAbove.StepDesignator = null; //reset StepDesignator - if (DoSubs && itemInfo.Cautions != null && (!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || itemInfo.Cautions[0].FormatStepData.Type != "Caution1") && !(itemInfo.IsCaution || itemInfo.IsNote)) - { - if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) - { - // For deviations, the Cautions are always in the same place. - // Fix for Catawba E-1 deviation for step 10. Has note/caution off of a paragraph instead of HLS - float xoffDev = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - if (loadChildren) yoffLeft = ChildrenLeft.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); - } - else - { - if (yoffRightParent > yoff && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) != E_DocStructStyle.DoubleBoxHLS)) yoff = yoffRightParent; - if (loadChildren) yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); - } - } - if (DoSubs && itemInfo.Notes != null && !(itemInfo.IsCaution || itemInfo.IsNote)) - { - if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) - { - // For deviations, the Cautions are always in the same place. - // Fix for Catawba E-1 deviation for step 10. Has note/caution off of a paragraph instead of HLS - float xoffDev = (float)itemInfo.MyDocStyle.Layout.LeftMargin + 6 + (float)(itemInfo.ActiveFormat.MyStepSectionLayoutData.WidT); - if (loadChildren) yoffLeft = Math.Max(yoffLeft, ChildrenLeft.Add(cb, itemInfo.Notes, xoffDev, yoff, yoff, rnoLevel, maxRNO, formatInfo)); - } - else - { - // Notes/Cautions span the page. If the right (RNO) column is below current yoff, use the - // yoff from this. Without this, an overlap of text between the note and the bottom of the - // RNO was occurring for FNP - Unit 2/AOP, AOP-4.0. - if (yoffRightParent > yoff && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) != E_DocStructStyle.DoubleBoxHLS)) yoff = yoffRightParent; - if (loadChildren) - { - float yoffadj = 0; - if (itemInfo.IsTable && MyFlexGrid.BorderStyle == C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None && !MyFlexGrid.TopRowHasBorder()) - yoffadj = SixLinesPerInch; // adjust the yoffset if the note is off of a borderless table - yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff + yoffadj, yoff + yoffadj, rnoLevel, maxRNO, formatInfo) - yoffadj; - } - } - } - if (itemInfo is StepInfo && ((itemInfo as StepInfo).MyConfig as StepConfig).Step_PreferredPagebreak) HasPrefPageBreak = true; - // The following adds supplemental information items to the SupInfoSection list off of the section level paragraph for printing - // of the sup info pdf. The SupInfoSection list is just a flat list of all supplemental information within the section. - if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && loadChildren && itemInfo.SupInfos != null) - { - SupInfoSection.ChildrenBelow.Add(cb, itemInfo.SupInfos, XOffset, 0, 0, rnoLevel, maxRNO, formatInfo); - } - - // Without the following, BGE had gaps in y-direction if the AER/RNO both had cautions/notes. - // The only time this needs done is if caution/notes are printed in separate columns in dual - // column mode (used the DoubleBoxHLS BGE flag for this - if another plant needs this, make it - // a more generic flag). - if (itemInfo.IsRNOPart && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS) && - rnoLevel == maxRNO && ChildrenAbove.Count > 0 && MyParent.ChildrenAbove.Count > 0) - { - float yDeltaRno = yoff - yOffOrig; - float yDeltaAer = SixLinesPerInch + yOffOrig - MyParent.ChildrenAbove[0].YTopMost; - if (yDeltaRno > yDeltaAer) - { - foreach (vlnParagraph chlda in MyParent.ChildrenAbove) - { - chlda.AdjustYOffset(yDeltaAer - yDeltaRno); - } - foreach (vlnParagraph chld in ChildrenAbove) - chld.AdjustYOffset(yDeltaAer); - yoff -= yDeltaAer; - } - else - { - foreach (vlnParagraph chld in ChildrenAbove) - chld.AdjustYOffset(yDeltaRno); - yoff -= yDeltaRno; - } - } - // Comanche Peak uses CAUTION2 type to enter a Step Designator, which is placed to the left of the step number. - // The Step Designator information is saved during the processing of the Cautions (ChildrenAbove) - // defined in the vlnParagraphs class (of which ChildrenAbove is defined) - if (ChildrenAbove.StepDesignator != null) - { - string pref = ChildrenAbove.StepDesignator; - float colOvrd = (float)(ChildrenAbove.StepDesignatorColumn ?? 0); - float xPref = (colOvrd > 0) ? colOvrd : mytab.XOffset - (pref.Length * (72 / (float)_MyItemInfo.FormatStepData.Font.CPI)); - PartsLeft.Add(new vlnText(cb, this, pref, pref, xPref, yoff, ChildrenAbove.StepDesignatorFont)); - ChildrenAbove.StepDesignator = null; - ChildrenAbove.StepDesignatorColumn = null; - } - DoAnnotationPrintableText(cb, itemInfo, yoff); // Look in annotation type to see if annotation has text that should be printed (like a step designator) - - // if this is a hls with a box, adjust the starting y location for the hls. this is done here - // in case this hls had a boxed caution and/or note before it. Also, this code is here rather - // than in the vlnparagraphs.add code because the yoff in that code will position the box, but - // this code positions the hls (in y direction), without this, the hls starts on the box line. - int bxIndx = itemInfo.IsSection ? 0 : itemInfo.FormatStepData.StepLayoutData.STBoxindex ?? 0; - if (itemInfo.IsHigh && bxIndx > 0) - { - int boxLnAdjust = itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox ? 1 : 2; - yoff += (boxLnAdjust * SixLinesPerInch); // this yoff is where the BOX starts (boxLnAdjust was added for WEP2) - } - - // If the format has that extra space should be put out before the step, then - // handle this by using the 'PartsAbove' structure. By using the parts above, the extra - // space above will be done regardless of where page breaks fall. - float addExtraSpace = 0; - if (MyItemInfo.FormatStepData != null && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CustomSpacing) - addExtraSpace = MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0; - //if (MyItemInfo.MyParent != null && MyItemInfo.MyParent.FormatStepData != null && - // MyItemInfo.MyParent.FormatStepData.Type != "TitleWithTextRight") - // addExtraSpace = (MyItemInfo.FormatStepData == null) ? 0 : MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0; - if (MyItemInfo.MyParent != null && MyItemInfo.MyParent.FormatStepData != null) - addExtraSpace = (MyItemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight" || MyItemInfo.FormatStepData == null) ? 0 : MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0; - // If a high level step, the 16bit code uses the value of the extra space - // from the high level step format regardless of what type of high level step it is: - // Added check for UseSTExtraRealValue, if set, we want to use what is set for the specific step type - // Added check for CustomSpacing (was also in 16-bit logic) - if (!MyItemInfo.ActiveFormat.MyStepSectionLayoutData.UseSTExtraRealValue && - !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CustomSpacing && - MyItemInfo.IsHigh) - addExtraSpace = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[2].StepLayoutData.STExtraSpace ?? 0; - // If CustomSpacing flag is true - // then use the STExtraSpace from the step type called "Default" (index number 25) - //if (YOffset != 0 && MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.CustomSpacing) - if (YOffset != 0 && MyItemInfo.IsSection && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CustomSpacing) - addExtraSpace = (float)MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[25].StepLayoutData.STExtraSpace; - if (YOffset != 0 && MyItemInfo.FormatStepData != null && - MyItemInfo.MyPrevious == null && MyItemInfo.FormatStepData.ThreeBlanksAbove && (!MyItemInfo.IsNote || MyItemInfo.MyParent.Cautions == null)) - addExtraSpace = 24; // already has one blank line above, added two more - //if (YOffset != 0 && MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace > 0) - // addExtraSpace = (float)MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace; - // if this plant has the AlwaysUseExtraLines and there are notes/cautions above the hls, don't add in the - // extra space: - if (itemInfo.IsHigh && (itemInfo.Cautions != null || itemInfo.Notes != null)) - { - if ((itemInfo.Cautions != null && itemInfo.Cautions[0].FormatStepData.AlwaysUseExtraLines) || (itemInfo.Notes != null && itemInfo.Notes[0].FormatStepData.AlwaysUseExtraLines)) - addExtraSpace = 0; - // F2021-038: SHE/SHEA format - Less space after boxes - if (itemInfo.Cautions != null && itemInfo.Cautions[itemInfo.Cautions.Count - 1].FormatStepData.NoYBxAdjust) - addExtraSpace = 0; - if (itemInfo.Notes != null && itemInfo.Notes[itemInfo.Notes.Count - 1].FormatStepData.NoYBxAdjust) - addExtraSpace = 0; - } - // F2021-038: SHE/SHEA format - Less space after boxes. The following is for when a HLS has an RNO that has Cautions/Notes - if (itemInfo.IsHigh && itemInfo.RNOs != null) - { - if (itemInfo.RNOs[0].Notes != null && itemInfo.RNOs[0].Notes[0].FormatStepData.NoYBxAdjust) - addExtraSpace = 0; - if (itemInfo.RNOs[0].Cautions != null && itemInfo.RNOs[0].Cautions[0].FormatStepData.NoYBxAdjust) - addExtraSpace = 0; - } - if (addExtraSpace > 0 && MyItemInfo.FormatStepData != null) - { - // We need to strip out the underline style from the font before putting out - // the extra line. - VE_Font vf = MyItemInfo.FormatStepData.Font; - E_Style sty = (E_Style)vf.Style; - if ((sty & E_Style.Underline) != 0) - sty ^= E_Style.Underline; - vf = new VE_Font(vf.Family, (int)vf.Size, sty, (float)vf.CPI); - this.PartsAbove.Add(new vlnText(cb, this, " ", " ", 72, yoff, vf)); - } - - yoff += addExtraSpace; - - YTop = yoff; - YOffset = yoff; - if (mytab != null && mytab.SeparateBullet) - { - string identB = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.IdentB; - vlnText myBullet = new vlnText(cb, this, identB, identB, XOffset - 12, YOffset, MyItemInfo.FormatStepData.TabData.Bullet.Font); - myBullet.Rtf = myBullet.Rtf.Replace("\u25CF", @"\f1\u9679?\f0 "); - PartsLeft.Add(myBullet); - } - if (itemInfo.MyTab != null && itemInfo.MyTab.AsteriskOffset != 0) - { - - // the '-24' in x-direction & '+4' in y-direction was used for the SHE format to get the continuous - // HLS's asterisk to match 16bit. The font size was set at 16 to make it match also: - VE_Font astFont = new VE_Font(MyItemInfo.FormatStepData.TabData.Font.Family, 16, E_Style.Bold, 10); - vlnText myAsterisk = new vlnText(cb, this, "*", "*", mytab.XOffset - 24, YOffset + 4, astFont); - PartsLeft.Add(myAsterisk); - } - if (itemInfo.IsRNOPart && rnoLevel > maxRNO) - { - // the DoubleSpace & SpaceDouble flags seem redundant. The 2nd line was added for foldout - // line spacing for IP2 foldouts (one example can be found in E-1) - if (!itemInfo.FormatStepData.SpaceDouble && itemInfo.MyParent.IsHigh) - { - // but it we are in single column mode, don't remove the blank line. (Wolf Creek Admin Instructions - wcn1) - if (itemInfo.ActiveSection != null && (itemInfo.ActiveSection as SectionInfo).SectionConfig.Section_ColumnMode != SectionConfig.SectionColumnMode.One) // C2018-003 fixed use of getting the active section - yoff = YOffset = yoff - SixLinesPerInch; - } - else if (itemInfo.FormatStepData.NoSpaceMultipleRNOs) yoff = YOffset = yoff - SixLinesPerInch; - if (itemInfo.FormatStepData.DoubleSpace && itemInfo.FormatStepData.SpaceDouble) yoff = YOffset = yoff + SixLinesPerInch; - } - AddMacros(itemInfo, mytab); - if (mytab != null) - { - mytab.YOffset = yoff; - if (mytab.MyMacro != null) mytab.MyMacro.YOffset = yoff; - } - // For background formats, HLS's or Caution or any Notes have tab on line and then text - // on line below (with space in between) - if (itemInfo.IsBackgroundStep() && itemInfo.MyTab != null && itemInfo.MyTab.AltPrintTab != null && itemInfo.MyTab.AltPrintTab.Trim() != "") - yoff = YOffset = yoff + (2 * SixLinesPerInch); - CheckOff co = itemInfo.GetCheckOffStep(); - float yForCheckoff = yoff; //0; - default checkoff row is same as FIRST line of text - // if dropCheckoff is true, then the checkoff is place on the same of row as the LAST line of text - bool dropCheckoff = itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.DropCheckOff - || (co != null && co.DropCheckOff); - if (itemInfo.MyContent.MyGrid != null) - { - vlnCells.DefaultFont = itemInfo.FormatStepData.Font.WindowsFont;// Set the default text font based upon the format - int profileDepth1 = ProfileTimer.Push(">>>> Before vlnParagraph.Grid"); - //Use Static MyFlexGrid - BWD INST2 - FlexGrid Errors - MyFlexGrid.LoadGrid(itemInfo); - MyGrid = new vlnTable(MyFlexGrid, cb); - Height = MyGrid.Height; - Width = MyGrid.Width; - // Adjust the XOffset before determining if the table will overlap the RNO column RHM 20150529 - CalculateXOffsetGridOrFigure(itemInfo, maxRNO, formatInfo); - - yoff = AdjustLocIfLongerRNO(itemInfo, yoff, yoffRightParent); - // if the table does not have a border, only move down one line: - float yoffForBorder = 2 * SixLinesPerInch; - if (MyFlexGrid.BorderStyle == C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None && !MyFlexGrid.TopRowHasBorder()) - yoffForBorder -= SixLinesPerInch; - //yForCheckoff = yoff + Height - SixLinesPerInch; - if (dropCheckoff) - yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text - yoff += (Height + yoffForBorder); //(2 * SixLinesPerInch)); - yoff = (float)Math.Ceiling(yoff); - ProfileTimer.Pop(profileDepth1); - } - else if (itemInfo.IsRtfRaw) - { - CalculateXOffsetGridOrFigure(itemInfo, maxRNO, formatInfo); - YOffset = yoff; - yoff += Height * .6f; // .6 is used as a scale factor in RtfRawAt (rtf2pdf). Use it here too for moving down page after equation. - yoff = (float)Math.Ceiling(yoff); - yoff += AdjustForBlankLines(); - } - else if (itemInfo.IsFigure) // if a figure we've got to determine the size: - { - int profileDepth2 = ProfileTimer.Push(">>>> Before vlnParagraph.Figure"); - string erMsg = null; - if (itemInfo.MyContent.Text != null) // ro image - { - if (itemInfo.MyContent.Text != "") // also check for text, there is an RO image then: - { - ProcedureInfo proc = itemInfo.MyProcedure; - DocVersionInfo dvi = proc.MyDocVersion; - ROFstInfo rofst = dvi.DocVersionAssociations[0].MyROFst; - //rofst.docVer = dvi; - ROFSTLookup lookup = rofst.GetROFSTLookup(dvi); - string linkInfoText = itemInfo.MyContent.Text.Replace(@"\v ", ""); - Match m = Regex.Match(linkInfoText, @"(.*)[#]Link:([A-Za-z]*):(.*)"); - string val = null; - if (m.Length > 0) // if m.lengh is zero, then no match was found - no RO was entered in the figure substep - { - if (m.Groups.Count < 4) - { - //erMsg = "RO was not found during data migration."; - // added newlines in the RO number (shown in figure substep type with figure RO) - // if we are here, then there is no RO link information, use this number to find the RO image to print - val = string.Format("{0}\n{1}\n{2}\n{3}", - linkInfoText.Substring(0, linkInfoText.Length - 16), - linkInfoText.Substring(linkInfoText.Length - 16, 8), - linkInfoText.Substring(linkInfoText.Length - 8, 4), - linkInfoText.Substring(linkInfoText.Length - 4, 4)); - val = val.Replace(@"\u8209?", "-").Replace(@"\u9586?", @"\"); // replace dash and backslash symbols with dash and backslash characters - } - else - { - string[] subs = m.Groups[3].Value.Split(" ".ToCharArray()); - // B2022-088: Find Doc Ro button not working in Word Sections - val = lookup.GetRoChild(subs[1]).value; - if (val == null || val == "?") val = lookup.GetRoChild(subs[1].Substring(0, 12)).value; - if (val == "?") - { - erMsg = string.Format("Referenced Object does not exist."); - _MyLog.WarnFormat("\r\nMissing Referenced Object {0} in {1}", subs[1], itemInfo.ShortPath); - yoff += 2 * SixLinesPerInch; - } - } - } - GC.Collect(); // memory garbage collection (Regex memory bug) - if (val != null && val != "?") - { - string[] vals = val.Split("\n".ToCharArray()); - Width = Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips; - int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier); - // Check that the Height of figure isn't too big to fit on the page, if it is - // set the Height to the printable part of page - Height of the HLS and an extra line - // for between HLS & figure. - float h1 = lines * SixLinesPerInch; - float h2 = RoughSizeOfPage - MyParent.Height - SixLinesPerInch; - Height = Math.Min(h1, h2); - if (h1 > h2) - { - Width *= (h2 / h1); - } - StepInfo si = (StepInfo)MyItemInfo; - StepConfig sc = new StepConfig(si.MyContent.Config); - if (sc != null && sc.Step_ImageWidth != 0) - { - Width = sc.Step_ImageWidth; - Height = sc.Step_ImageHeight; - } - yoff = AdjustLocIfLongerRNO(itemInfo, yoff, yoffRightParent); - if (dropCheckoff) - yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text - bool noborder = MyItemInfo.FormatStepData.Type.ToUpper().Contains("BORDERLESS"); - yoff += (Height + ((noborder ? 1 : 2) * SixLinesPerInch)); // RHM 20120925 - Eliminate extra space after Figure } - try - { - ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]); - if (roImage != null) - ImageText = val; - else - { - roImage = rofst.GetROImageByFilename(vals[0], MyItemInfo);// need code to go and get an ROImaage if it exists - if (roImage == null) - erMsg = string.Format("Image {0} does not exist.", vals[0]); - else - ImageText = val; - } - } - catch (Exception ex) - { - erMsg = string.Format("Image {0} does not exist, error = {1}.", vals[0], ex.Message); - } - } - if (erMsg != null) Rtf = GetRtf(erMsg, itemInfo.ActiveFormat.PlantFormat.FormatData.Font); - } - CalculateXOffsetGridOrFigure(itemInfo, maxRNO, formatInfo); - } - else - { - // figure - ImageText = "figure"; - } - if (ImageText == null && erMsg == null) - { - ImageText = "figure"; - ImageConfig ic = new ImageConfig(MyItemInfo.MyContent.MyImage); - // B2016-277: add a try catch in case of there being 'bad' data in the text field for an image/figure - try - { - byte[] idata = (ic != null && ic.Image_DataSize > 0) ? ROImageInfo.Decompress(MyItemInfo.MyContent.MyImage.Data, ic.Image_DataSize) : MyItemInfo.MyContent.MyImage.Data; - MemoryStream ms = new MemoryStream(idata); - System.Drawing.Image img = System.Drawing.Image.FromStream(ms); - Width = img.Width; - Height = img.Height; - if (ic != null && ic.Image_Height != 0) - { - Width = ic.Image_Width; - Height = ic.Image_Height; - - // B2022-041: extra whitespace after resized image. Make same adjustment here that gets made in ParagrphToPdf - // B2023-040: WCN pagination changed for And steps with large image after - add format flag for - // Barakah - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.AdjustLargeImage) - { - float mult = 1.0F; - if (Width > (vlnParagraph.wMax - 12)) mult = (vlnParagraph.wMax - 24) / Width; - if (Height > (vlnParagraph.hMax - 36)) mult = Math.Min(mult, (vlnParagraph.hMax - 36) / Height); - if (mult < 1.0F) - { - Width = Width * mult; - Height = Height * mult; - } - } - } - yoff = AdjustLocIfLongerRNO(itemInfo, yoff, yoffRightParent); - bool noborder = MyItemInfo.FormatStepData.Type.ToUpper().Contains("BORDERLESS"); - yoff += (Height + SixLinesPerInch); // B2019-059 only one extra line after a figure (does not matter if it has a border or not) - CalculateXOffsetGridOrFigure(itemInfo, maxRNO, formatInfo); - } - catch (Exception ex) - { - _MyLog.WarnFormat("Bad figure content data: item = {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); - } - } - ProfileTimer.Pop(profileDepth2); - } - else - { - // For Calvert Alarms, the 'CONDITION/RESPONSE' portion uses a macro to print - // the CONDITION and RESPONSE text with the lines around it. Add the macro here because - // there is no tab for the step & that's where the macro is usually stored: - if (HasCalvertMacro) PartsLeft.Add(new vlnMacro(xoff - 12f, yoff, "H4")); - - //if (itemInfo.IsSection) - // Rtf = GetRtf(itemInfo, prefix, " (Continued)"); - //else - // BuildRtf(); // not necessary, RTF is lazyloaded - if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate) - { - if (itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab - || (itemInfo.Steps != null && itemInfo.Steps.Count > 0 && itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab)) - { - int stplevl = TheStepLevel(itemInfo); - if (stplevl >= 0 && MyItemInfo.MyHLS.FormatStepData.VertPos[stplevl] > 0) - { - if (MyItemInfo.FormatStepData.StepPrintData.Justify == "Center") - { - string[] vertPos = MyItemInfo.MyHLS.FormatStepData.VertPos.Split(",".ToCharArray()); - float hloc = (float.Parse(vertPos[stplevl]) + ((float.Parse(vertPos[stplevl + 1]) - float.Parse(vertPos[stplevl])) / 2)); - Chunk chk = (Chunk)IParagraph.Chunks[0]; - hloc = hloc - (chk.GetWidthPoint() / 2); - XOffset = hloc + (float)itemInfo.MyDocStyle.Layout.LeftMargin; - } - else - XOffset = float.Parse(MyItemInfo.MyHLS.FormatStepData.VertPos.Split(",".ToCharArray())[stplevl]) + (float)itemInfo.MyDocStyle.Layout.LeftMargin; - } - } - } - if (itemInfo.IsTablePart) // Not for grid, this is for old-style tables. - { - Width = GetTableWidth(cb, IParagraph, MyItemInfo.MyDocStyle.Layout.PageWidth); - CalculateXOffsetGridOrFigure(itemInfo, maxRNO, formatInfo); - } - else - if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.StepPrintData != null && (itemInfo.IsHigh || (!itemInfo.IsHigh && itemInfo.MyContent.Type != itemInfo.MyParent.MyContent.Type))) XOffset += (float)(itemInfo.FormatStepData.StepPrintData.PosAdjust ?? 0); - - // point beach wpb subformats 20 & 22 were printing some text past right margin. Limit the width to the right margin, i.e. pagewid - if (itemInfo.ActiveFormat.MyStepSectionPrintData.LimitWidToPageWid) - { - float lim = (MyTab == null ? (XOffset - (float)itemInfo.MyDocStyle.Layout.LeftMargin) : MyTab.XOffset + MyTab.Width) + Width; - float docStyleLim = (float)itemInfo.MyDocStyle.Layout.PageWidth - (float)itemInfo.MyDocStyle.Layout.LeftMargin; - - if (lim > docStyleLim) - { - WidthNoLimit = Width; // Use this width to calculate childrens' width, without this, code was making children to narrow! - Width = docStyleLim - (MyTab == null ? (XOffset - (float)itemInfo.MyDocStyle.Layout.LeftMargin) : MyTab.XOffset + MyTab.Width); - } - } - if (itemInfo.IsSection && ShowSectionTitles - && !MyItemInfo.MyDocStyle.CancelSectTitle) - { - if (MyItemInfo.MyDocStyle.Layout.SectionMacro != null) - { - string macro = GetMacroName(MyItemInfo.MyDocStyle.Layout.SectionMacro); - PartsAbove.Add(new vlnMacro(xoff, yoff, macro)); - yoff += SixLinesPerInch; - YOffset = yoff; - } - } - - // if this step has a prefix but it's not checklist... do a partsleft for prefix - if (_MyItemInfo.IsStep && !_MyItemInfo.FormatStepData.UseSmartTemplate) - { - if (_MyItemInfo.FormatStepData.Prefix != null && _MyItemInfo.FormatStepData.Prefix != "") - { - string pref = _MyItemInfo.FormatStepData.Prefix.Replace("{Backspace}", ""); - float xPref = XOffset - (pref.Length * (72 / (float)_MyItemInfo.FormatStepData.Font.CPI)); - E_Style es = (E_Style)_MyItemInfo.FormatStepData.Font.Style & E_Style.Bold; - VE_Font tmpFont = new VE_Font(_MyItemInfo.FormatStepData.Font.Family, (int)_MyItemInfo.FormatStepData.Font.Size, es, (float)_MyItemInfo.FormatStepData.Font.CPI); - PartsLeft.Add(new vlnText(cb, this, pref, pref, xPref, yoff, tmpFont)); - } - } - // If checklists, the substeps are printed in a row, need to keep track of the 'longest' in - // y direction (bottommost) across the row. - if (itemInfo.IsStep && itemInfo.MyHLS != null && (itemInfo.MyHLS.FormatStepData.UseSmartTemplate || (itemInfo.MyHLS.FormatStepData.UseOldTemplate && itemInfo.MyDocStyle.ComponentList)) && (TheStepLevel(itemInfo) >= 0)) - savCheckListBottomMost = yoff + Height + (itemInfo.MyHLS.FormatStepData.UseSmartTemplate ? SixLinesPerInch : 0); - - // The following was added for BGE valve lists, this format (BGEVLV) used caution1 as - // a subheader within the valve list. To print correctly, a line needs to be added to - // where the bottom of this (subheader) is located and XOffset is set to the leftmargin. - if (itemInfo.IsStep && itemInfo.MyHLS != null && !itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && itemInfo.IsCaution1 && itemInfo.MyHLS.FormatStepData.UseOldTemplate && itemInfo.MyDocStyle.ComponentList) - { - savCheckListBottomMost += SixLinesPerInch; - yoff += Height; - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - } - - if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && itemInfo.IsCaution1) savCheckListBottomMost = yoff + Height; - // Get Y offset for regular steps, or if section title is output or if not within row (not last column of - // text) for wcn checklist, i.e. - if ((!itemInfo.IsStepSection && itemInfo.MyHLS != null && !itemInfo.MyHLS.FormatStepData.UseSmartTemplate) // regular step - || (ShowSectionTitles - && !MyItemInfo.MyDocStyle.CancelSectTitle - && !MyItemInfo.MyDocStyle.SpecialStepsFoldout) - // In Checklist: I don't have children or if I have children the first child doesn't alignwithparent. - || (!itemInfo.IsStepSection && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate - && ((itemInfo.Steps == null || itemInfo.Steps.Count == 0) - || !itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab)) - || ((MyItemInfo.IsNote || MyItemInfo.IsCaution) && MyItemInfo.MyParent.IsSection)) // B2016-222 check if is a caution or note and parent is a section - { - bool doprint = !(MyPageHelper.DidHLSText && MyItemInfo.ItemID == MyPageHelper.HasHLSTextId); - if (MyItemInfo.IsSection) - { - SectionConfig sch = MyItemInfo.MyConfig as SectionConfig; - if (sch != null && sch.Section_PrintHdr != "Y") doprint = false; - } - //C2025-021 Add logic to PROMS to support a special High Level Step type that is not printed. - if (doprint && !UseTemplateKeepOnCurLine(itemInfo) && !itemInfo.IsType("InvisibleHigh")) - { - float tyoff = yoff; - if (itemInfo.Steps != null) - { - if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextRight") - if (loadChildren) tyoff = ChildrenRight.Add(cb, itemInfo.Steps, XOffset + 72, yoff, yoff, rnoLevel, maxRNO, formatInfo); - } - yoff += Height; - yoff = Math.Max(yoff, tyoff); - yoff += AdjustForBlankLines(); - if (dropCheckoff) - yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text - } - } - } - if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - { - // For Calvert Alarms, the row has formatting that makes this template item have a header & box - // (CONDITION/RESPONSE), header with box around it is defined in genmac whereas the lines around - // substeps are drawn in pagehelper. Adjust some yoffsets around this box. - // Need to: - // 1) move the text down a bit for top line (1.5f * SixLinesPerInch) - // 2) move the substep down 2 lines (2 * SixLinesPerInch) for bottom of box - // and space before substep - // 3) if the previous item had this condition, add space for the - // line below. - if (HasCalvertMacro) - { - YOffset += (1.5f * vlnPrintObject.SixLinesPerInch); - yoff += (2 * vlnPrintObject.SixLinesPerInch); - } - if (itemInfo.MyPrevious != null && itemInfo.MyPrevious.TemplateIndex > 0) - { - if (itemInfo.MyPrevious.ActiveFormat.PlantFormat.FormatData.Templates[itemInfo.MyPrevious.TemplateIndex].hmacro > 0) - { - YOffset += (3 * vlnPrintObject.SixLinesPerInch); - yoff += (3 * vlnPrintObject.SixLinesPerInch); - } - } - } - if (co != null && !MyItemInfo.IsInSupInfo) // C2018-002: don't print checkboxes on supplemental infromation pages. - { - // if this item's content is empty, and the flag is set to 'notonempty', don't print out the - // checkoff - this was added for shearon harris: - if (!(co.NotOnEmpty && itemInfo.MyContent.Text.Replace(@"\u160?", " ").TrimEnd() == "")) - { - float xloc_co = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - // if the format has 'SkipSpaces', look at the tab, and back up the macros to the number of - // spaces in the tab. - if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.SkipSpaces) - { - if (mytab != null) - xloc_co = mytab.XOffset; - else - xloc_co = XOffset; //there's no tab - put checkoff at step's xoff. Macro should back up from step's x. - } - else - { - if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation != 0) - xloc_co += (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation; - else if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation != 0) - { - float relX = (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation; - xloc_co = XOffset + (relX > 0 ? Width : 0) + relX; - } - } - - // CheckOffXtraLines was introduced for the additional lines needed for the longer signoffs - // for VCBA (&WST1), for F2016-061. - float checkOffNumberOfLines = (co.CheckOffNumberOfLines ?? 0); - if (checkOffNumberOfLines > 0) - { - yForCheckoff += (2 * SixLinesPerInch); - PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff/* + xtraCheckOffLines */, co.Macro)); - yoff += ((checkOffNumberOfLines *= SixLinesPerInch) + (2 * SixLinesPerInch)); - } - else - { - // if xtraCheckOffLines is a negative number, start the checkoff on the same line - // as text and adjust the y-offset after the checkoff by the amount of the absolute - // value of xtraCheckOffLines. - // if xtraCheckOffLines is a positive number, start the checkoff xtraCheckOffLines - 1 - // down from the text and adjust the y-offset after the checkoff by the amount - // of xtraCheckOffLines. - float xtraCheckOffLines = (co.CheckOffXtraLines ?? 0); - if (xtraCheckOffLines < 0) - { - xtraCheckOffLines = -xtraCheckOffLines; - xtraCheckOffLines *= SixLinesPerInch; - PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff/* + xtraCheckOffLines */, co.Macro)); - yoff += xtraCheckOffLines; - } - else - { - xtraCheckOffLines *= SixLinesPerInch; - xtraCheckOffLines -= ((xtraCheckOffLines > 0) ? SixLinesPerInch : 0); - PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff + xtraCheckOffLines, co.Macro)); - yoff += (xtraCheckOffLines != 0) ? xtraCheckOffLines + SixLinesPerInch : 0; - } - } - } - } - // for WCNTRN, do the responsibility: - if (formatInfo.PlantFormat.FormatData.PrintData.WCNTraining) DoResponsibility(cb, YOffset); - float yOffRight = yoff; - float RnoOffset = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO); - if (DoSubs && rnoLevel < maxRNO && itemInfo.RNOs != null) - { - if (loadChildren) yOffRight = ChildrenRight.Add(cb, itemInfo.RNOs, XOffset + RnoOffset, YTop, YTop, rnoLevel + 1, maxRNO, formatInfo); - if (ChildrenRight[0].ChildrenAbove.Count > 0) - { - float adj = ChildrenRight[0].YOffset - YOffset; - YOffset = ChildrenRight[0].YOffset; - yoff += adj; - if (MyTab != null) MyTab.YOffset = ChildrenRight[0].YOffset; - if (PartsRight.Count > 0) PartsRight[0].YOffset = ChildrenRight[0].YOffset; - //B2020-160 use YTopMost instead of Yoffset if there are children above. - // Get the minimun value between the AER and RNO YtopMost. - // example. Calvert AOP-7E/XIII/Step A5.h Unit 2 Approved set - //B2021-027 use YOffset if there isn't any children above (AER). - // example: Catawba Unit 1 AP’s; AP/1/A/5500/050; Enclosure 8 step 1 - if (ChildrenAbove.Count == 0) - YTopMost = ChildrenRight[0].ChildrenAbove[0].YOffset; //B2021-027 - else - YTopMost = Math.Min(ChildrenAbove[0].YTopMost, ChildrenRight[0].ChildrenAbove[0].YTopMost); //B2020-160 - } - } - // if this hls had a box drawn, add a line for substeps. - if (itemInfo.IsHigh && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)) yoff += vlnPrintObject.SixLinesPerInch; - - // Need code to determine if the table will overlap the Right Column if it does then - // use YOffRight rather than yoff - if (DoSubs && itemInfo.Tables != null) - { - bool aerTableOrFigure = itemInfo.Tables[0].FormatStepData.Type.Contains("AER"); - // get the first table & see if it is borderless. If borderless, 16bit code removed a - // line (yoffset) before printing it: - float yoffadj = 0; - if (itemInfo.Tables[0].IsTable) - { - MyFlexGrid.LoadGrid(itemInfo.Tables[0]); - // B2018-077 added check for caution and note parts in which case we want the blank line - fix for Calvert OI-27B 6.11.B and 6.12.B - if (MyFlexGrid.BorderStyle == C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None && !MyFlexGrid.TopRowHasBorder() && !MyItemInfo.IsCautionOrNotePart) - yoffadj = -SixLinesPerInch; - } - // B2023-008: when an equation is off a paragraph sub-step in single column mode, extra lines were added so - // when in single column mode & the substep has an equation (rtfraw), then don't reset yoffright to yverybottom - bool rtfRawInSingleCol = (itemInfo.ColumnMode == ((int)VEPROMS.CSLA.Library.SectionConfig.SectionColumnMode.One-1)) && (itemInfo.Tables != null && itemInfo.Tables.Count > 0 && itemInfo.Tables[0].IsRtfRaw); - if (yOffRight < yoffRightParent) yOffRight = yoffRightParent; - // find the very bottom Yoffset (don't do this is in single column mode for cautions/notes: B2016-261) - vlnParagraph parentPar = parent; - if (!rtfRawInSingleCol && (!((MyItemInfo.IsCaution || MyItemInfo.IsNote) && itemInfo.RNOLevel == 0))) - { - while (parentPar != null && parentPar.MyItemInfo.IsStep) - { - float vb = parentPar.YVeryBottom; - if (yOffRight < vb) yOffRight = vb; - parentPar = parentPar.MyParent; - } - } - bool rightLonger = yOffRight > yoff; - if (!aerTableOrFigure && itemInfo.RNOLevel == 0) // Centered Table - { - if (loadChildren) - yoff = ChildrenBelow.Add(cb, itemInfo.Tables, XOffset, rightLonger ? yOffRight : yoff + yoffadj, yOffRight + yoffadj, rnoLevel, maxRNO, formatInfo); - } - else // AER or RNO Table - if (loadChildren) - yoff = ChildrenBelow.Add(cb, itemInfo.Tables, XOffset, yoff + yoffadj, yOffRight + yoffadj, rnoLevel, maxRNO, formatInfo); - } - yOffRight = Math.Max(yOffRight, yoffLeft); - // Look for the meta section case where the 'Editable' flag is set to 'N', which means that - // these steps should not be printed: - bool printsteps = true; - if (itemInfo.Steps != null && itemInfo.IsSection && itemInfo.Sections != null && itemInfo.Sections.Count > 0) - { - SectionConfig sc = itemInfo.MyConfig as SectionConfig; - if (sc != null && sc.SubSection_Edit != "Y") printsteps = false; - } - bool rnoBefore = false; - bool rnoAfter = false; - if (rnoLevel >= maxRNO && itemInfo.RNOs != null && - !itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfCreekBackgroundFormat && - !itemInfo.RNOs[0].FormatStepData.InPageList) - { - if ((itemInfo.ActiveFormat.MyStepSectionPrintData.HLRNOStpSeparatorString ?? "") != "" || - (itemInfo.ActiveFormat.MyStepSectionPrintData.HLStpSeparatorString ?? "") != "") - rnoBefore = true; - else - rnoAfter = true; - } - if (rnoBefore) - { - if ((itemInfo.ActiveFormat.MyStepSectionPrintData.HLStpSeparatorString ?? "") != "") - { - string tmpSepStr = itemInfo.ActiveFormat.MyStepSectionPrintData.HLStpSeparatorString; - float tmpSepLen = itemInfo.ActiveFormat.MyStepSectionPrintData.HLStpSeparatorString.Length; - float xsep = MyHighLevelParagraph.PartsLeft.Count > 0 ? MyHighLevelParagraph.PartsLeft[0].XOffset : MyHighLevelParagraph.XOffset; - vlnRNOSeparator mySep = new vlnRNOSeparator(this, cb, tmpSepStr, xsep, yoff, itemInfo.ActiveFormat, false); - PartsBelow.Add(mySep); - yoff += mySep.Height;// +SixLinesPerInch; - } - if (loadChildren) yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, MyTab.XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo); - if ((itemInfo.ActiveFormat.MyStepSectionPrintData.HLRNOStpSeparatorString ?? "") != "") - { - string tmpSepStr = itemInfo.ActiveFormat.MyStepSectionPrintData.HLRNOStpSeparatorString; - float tmpSepLen = itemInfo.ActiveFormat.MyStepSectionPrintData.HLRNOStpSeparatorString.Length; - float xsep = MyHighLevelParagraph.PartsLeft.Count > 0 ? MyHighLevelParagraph.PartsLeft[0].XOffset : MyHighLevelParagraph.XOffset; - vlnRNOSeparator mySep = new vlnRNOSeparator(this, cb, tmpSepStr, xsep, yoff, itemInfo.ActiveFormat, false); - PartsBelow.Add(mySep); - yoff += mySep.Height;// +SixLinesPerInch; - } - } - // For Calvert Alarms, 'Caution1' was used to implement the Annunciator Window, i.e. is printed - // below the HLS and close to the right margin. - if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && itemInfo.Cautions != null && itemInfo.Cautions[0].FormatStepData.Type == "Caution1") - { - if (loadChildren) - yoff = ChildrenBelow.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); - savCheckListBottomMost = yoff; - } - if (DoSubs && itemInfo.Steps != null && printsteps) - { - if (itemInfo.FormatStepData == null || itemInfo.FormatStepData.Type != "TitleWithTextRight") - if (rnoBefore) - { - if (loadChildren) - yoff = ChildrenBelow.Add(cb, itemInfo.Steps, MyTab.XOffset, yoff, yOffRight, rnoLevel, maxRNO, formatInfo); - } - else - if (loadChildren) yoff = ChildrenBelow.Add(cb, itemInfo.Steps, XOffset, yoff, yOffRight, rnoLevel, maxRNO, formatInfo); - } - if (itemInfo.Sections != null) - if (loadChildren) - yoff = ChildrenBelow.Add(cb, itemInfo.Sections, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo, pp); - if (itemInfo.Procedures != null) - if (loadChildren) - yoff = ChildrenBelow.Add(cb, itemInfo.Procedures, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); - // Don't add the RNO to print if doing backgrounds. That piece of data is part of the pagelist item. - if (rnoAfter) - if (loadChildren) - yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo); - YBottomPagination = yoff;// B2019-111 Exclude Right for Pagination - yoff = Math.Max(yoff, yOffRight); - // TODO - use RNOSepAfterAER flag too: - string tmpRnoSepStr = formatInfo.MyStepSectionPrintData.RNOSepString; - float tmpRnoSepLen = formatInfo.MyStepSectionPrintData.RNOSepLineLength ?? 0; - if (rnoLevel < maxRNO && itemInfo.RNOs != null && (tmpRnoSepStr != null || tmpRnoSepLen != 0)) - { - vlnParagraph rno = ChildrenRight[0]; - vlnParagraph bottomChild = BottomChild; - float xsep = MyHighLevelParagraph.XOffset + RnoOffset; - - // ip3 has an rno separator and also has asterisk boxes around continous HLS. If - // the hls has RNOs off of it, then the rno separator line is outside of the box. If - // there are RNOs, but not off of HLS, then rno separator line is within the box (this is - // how 16bit proms did this). The following use of yadjSep and YBottomForBox handle that - float yadjSep = (MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex != null && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex >= 0 && - MyItemInfo.MyHLS.RNOs != null && MyItemInfo.MyHLS.RNOs.Count > 0) ? 2 * SixLinesPerInch : 0; - vlnRNOSeparator myRnoSep = new vlnRNOSeparator(this, cb, tmpRnoSepStr, xsep, yoff + yadjSep, formatInfo, bottomChild == null ? true : bottomChild.MyItemInfo.HasChangeBar); - // TODO: May need to handle more than one RNO column for RNO Separator - if ((rno.LastRNO.MyItemInfo.HasChangeBar == false && bottomChild != null && bottomChild.MyItemInfo.HasChangeBar) - || (bottomChild != null && bottomChild.YBottom > rno.LastRNO.YBottomMost)) - bottomChild.PartsBelow.Add(myRnoSep); - else - rno.LastRNO.PartsBelow.Add(myRnoSep); - MyHighLevelParagraph.YBottomForBox = 0; - if (yadjSep > 0) - { - MyHighLevelParagraph.YBottomForBox = yoff; // if hlrno, box before sep - YBottomMostAdjust = SixLinesPerInch; // added for IP3 pagination, the RNO separator is outside asterisk box - } - yoff += (myRnoSep.Height + SixLinesPerInch); - } - // if in WCNTRN (Wolf Creek Training), need to consider the ysize of the Responsibility text when setting - // YBottomMost, i.e. if the Responsibilty has more height (y-direction) compared to the actual step text, - // need to move down on page the height of the responsibility. - if (formatInfo.PlantFormat.FormatData.PrintData.WCNTraining && MyItemInfo.IsHigh) - { - if (PartsLeft.Count > 0 && PartsLeft[0] is vlnText) - { - foreach (vlnText vt in PartsLeft) - yoff = Math.Max(yoff, vt.YOffset + vt.Height); - } - } - YBottomMost = yoff; - - if ((MyItemInfo.IsHigh || MyItemInfo.IsCaution1) && MyItemInfo.MyDocStyle.LandscapePageList && MyItemInfo.MyDocStyle.ComponentList) - { - // put out line after step (for BGEVLV format) - float macroY = YBottomMost - (0.25f * SixLinesPerInch); - PartsLeft.Add(new vlnMacro((float)MyItemInfo.MyDocStyle.Layout.LeftMargin, macroY, "B9")); - } - - // For Checklist, the substeps are in rows of data. The YBottomMost is the bottom most for - // the row. - if (savCheckListBottomMost != 0) YBottomMost = Math.Max(savCheckListBottomMost, YBottomMost); - if (XOffsetCenter != null) XOffset = (float)XOffsetCenter; - ProfileTimer.Pop(profileDepth); - } - - private vlnTab GetSupInfoTab(PdfContentByte cb, ItemInfo itemInfo, float yoff, vlnTab mytab, bool doSectTab, float localXOffset) - { - string strmytab = null; - if (itemInfo.MyParent.IsHigh) - strmytab = itemInfo.MyTab.CleanText; - else if (itemInfo.MyParent.IsCaution) - strmytab = "Caution"; - else if (itemInfo.MyParent.IsNote) - strmytab = "Note"; - else - { - // B2018-022: use flag to determine whether to pre-pend the parent's tab as part of the supplemental info tab - // (if the procedure tab is long, such as in Farley, the tab overwrites text in the supplemental info pages) - strmytab = itemInfo.ActiveSection.ActiveFormat.PlantFormat.FormatData.PrintData.SupInfoIncludeParTab - ? ItemInfo.GetCombinedTab(itemInfo.MyParent, itemInfo.MyParent.MyParent.CombinedTab) - : itemInfo.MyTab.CleanText; - } - strmytab = strmytab.Trim(); - mytab = new vlnTab(cb, this, strmytab, strmytab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline); - return mytab; - } - private static VE_Font _AnnotationFont; - public static VE_Font AnnotationFont - { - get { return vlnParagraph._AnnotationFont; } - set { vlnParagraph._AnnotationFont = value; } - } - - // Check to see if the procedure has any printable text in the annotations - private bool? _CanDoPrintableText = null; - public bool CanDoPrintableText - { - get - { - if (_CanDoPrintableText == null) - { - _CanDoPrintableText = false; - AnnotationTypeInfoList atil = AnnotationTypeInfoList.Get(); - foreach (AnnotationTypeInfo ati in atil) - { - AnnotationTypeConfig atc = new AnnotationTypeConfig(ati.Config); - if (atc.PrintableText_XLocation != 0) - { - _CanDoPrintableText = true; - break; - } - } - } - return (bool)_CanDoPrintableText; - } - } - private void DoAnnotationPrintableText(PdfContentByte cb, ItemInfo itemInfo, float yoff) - { - // check to see if this procedure has any printable annotations. - // if it does not, then there is no need to spin through checking for the given itemInfo - if (!CanDoPrintableText) return; - - // if this step has an Annotation and it has config data to define location, parse out '[xx]' and print it at the location - // this was added for VC Summer (unit 2 & 3) but is available for any data that has defined the location in the config (from the folder properties - // at the top node - annotationtype tab. - if (itemInfo.ItemAnnotationCount > 0) - { - foreach (AnnotationInfo ai in itemInfo.ItemAnnotations) - { - // get the annotation type from the annotation, and see if it has a print location: - AnnotationTypeInfo at = ai.MyAnnotationType; - AnnotationTypeConfig atc = new AnnotationTypeConfig(at.Config); - if (atc.PrintableText_XLocation != 0) - { - int st = ai.SearchText.IndexOf("["); - int end = ai.SearchText.IndexOf("]"); - if (st != -1 && end != -1 && end > st) - { - string pref = ai.SearchText.Substring(st + 1, end - st - 1); // annotation - parse out [xx] - pref = Regex.Replace(pref, "{Up}", @"\u8593?", RegexOptions.IgnoreCase); - pref = Regex.Replace(pref, "{Down}", @"\u8595?", RegexOptions.IgnoreCase); - float xPref = atc.PrintableText_XLocation; - if (AnnotationFont == null) - AnnotationFont = new VE_Font(_MyItemInfo.FormatStepData.Font.Family, 6, (E_Style)_MyItemInfo.FormatStepData.Font.Style, 20F); - PartsLeft.Add(new vlnText(cb, this, pref, pref, xPref, yoff, AnnotationFont)); - break; - } - } - } - } - } - - private float AdjustLocIfLongerRNO(ItemInfo itemInfo, float yoff, float yoffRightParent) - { - if (!itemInfo.IsInRNO && yoffRightParent > yoff && itemInfo.FormatStepData.Type.Contains("AER")) - { - // is the width of this table going to cause the table to overlap the RNO - vlnParagraph parRno = FindParentRNO(); - float xMinRno = FindMinXOffsetRno(parRno); - if (XOffset + Width > xMinRno - 12) // 12 = 2 characters, so that tables don't almost touch & look like an overlap - { - if ((float)MyItemInfo.MyDocStyle.Layout.LeftMargin + Width > xMinRno) - { - yoff = yoffRightParent; - YOffset = yoff; - } - else - XOffset = (float)MyItemInfo.MyDocStyle.Layout.LeftMargin; - } - } - return yoff; - } - private float FindMinXOffsetRno(vlnParagraph parRno) - { - // Find the minimum xoffset in the rno column that overlaps in the y direction with - // the table that is currently being processed. This is necessary in order to fix the - // case where the AER table overlaps an RNO table (or tab/text) - float xcur = 0; - // YOffset/Height is for the current table, check it against the rno's yoffset & height - // if aer & rno are within y range of each other - if (YOffset <= (parRno.YOffset + parRno.Height) && (YOffset + Height) >= parRno.YOffset) - { - xcur = parRno.XOffset; - if (parRno.MyTab != null) xcur = parRno.MyTab.XOffset; - } - // recursively look at steps in the rno column to get the smallest xoffset which will - // then be used to compare to table's xoffset/width to see if there is an overlap - if (parRno.ChildrenBelow != null) - { - foreach (vlnParagraph vp in parRno.ChildrenBelow) - { - // yoffset is past where the table is, so don't consider it: - if (vp.YOffset > (YOffset + Height)) return xcur; - - float xchild = FindMinXOffsetRno(vp); - if (xchild > 0 && (xcur == 0 || xchild < xcur)) - xcur = xchild; - } - } - return xcur; - } - private void DoResponsibility(PdfContentByte cb, float yoff) // WCNTRN's text in 1st column (saved in config for HLS) - { - StepConfig sc2 = MyItemInfo.MyConfig as StepConfig; - if (sc2 != null) - { - string resp = sc2.Step_Responsibility; - - if (resp != null && resp != "") // lines are separated by "\r\n" - { - resp = DelimitResponse((int)MyItemInfo.MyDocStyle.SectTop.MaxLen, resp); - if (!resp.EndsWith("\r\n")) resp = resp + "\r\n"; // parsing needs this. - int indx = resp.IndexOf("\r\n"); - int stindx = 0; - float y = yoff; - while (indx > -1) - { - string subresp = resp.Substring(stindx, indx - stindx); - float respWidth = subresp.Length * 6; - float ctr = (float)MyItemInfo.MyDocStyle.SectTop.Margin; - float respcntrX = (float)MyItemInfo.MyDocStyle.Layout.LeftMargin + ctr - (respWidth / 2); - vlnText myResp = new vlnText(cb, this, subresp, subresp, respcntrX, y, MyItemInfo.FormatStepData.Font); - PartsLeft.Add(myResp); - y += SixLinesPerInch; - stindx = indx + 2; - indx = stindx < resp.Length ? resp.IndexOf("\r\n", stindx) : -1; - } - } - } - } - private string DelimitResponse(int maxLen, string responsStr) - { - // This code handles whether user enters \r\n to separate lines or not. The - // max width that a line can be in the Responsibility column is a format flag (passed in) - List results = new List(); - int width = 0; // keep track of current width of current 'line' while looking for space to break - int start = 0; // start of line (index into string 'text') - int lastspace = 0; // location of lastspace (index into string) - for (int indx = 0; indx < responsStr.Length; indx++) - { - if ((indx + 1) < responsStr.Length && responsStr.Substring(indx, 2) == "\r\n") - { - results.Add(responsStr.Substring(start, indx - start).Trim(" ".ToCharArray()) + "\r\n"); - start = indx + 2; - width = 0; - } - else - { - if (responsStr[indx] == ' ') lastspace = indx; - width++; - if (width > maxLen) - { - // what should be done if lastspace == 0 - // cannot find space char to split on, so break the word - bool spFound = true; - if (lastspace == 0) - { - lastspace = indx; - spFound = false; - } - results.Add(responsStr.Substring(start, lastspace - start).Trim(" ".ToCharArray()) + "\r\n"); - start = lastspace + (spFound ? 1 : 0); // increment start based on whether a space is found, i.e. if no space keep at 'indx' - // width either is equal to width of text after the last space, or is zero if at the maxlen of width: - width = (indx - lastspace - 1) > 0 ? indx - lastspace - 1 : 0; - lastspace = 0; - } - } - } - if (width > 0 || start < responsStr.Length) results.Add(responsStr.Substring(start).Trim(" ".ToCharArray())); - string retval = null; - foreach (string st in results) retval = retval + st; - return retval; - } - public override string Rtf - { - get - { - if (_Rtf == null) BuildRtf(); - return _Rtf; - } - set { _Rtf = value; } - } - private void BuildRtf() - { - int profileDepth = ProfileTimer.Push(">>>> BuildRtf"); - if (_Rtf == null) - { - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && MyItemInfo.IsCaution1 && - MyItemInfo.MyContent.Text.StartsWith(@"\u") && !MyItemInfo.MyContent.Text.StartsWith(@"\u160?")) - { - Rtf = GetRtf(MyItemInfo, " " + (Prefix ?? ""), Suffix); - PrefixSpecialCharacter = true; - } - else - { - Rtf = GetRtf(MyItemInfo, Prefix, Suffix); - } - // Need the following with some modifications for WCNCKL format: - if (Rtf.Contains("{Backspace}")) - { - XOffset -= 25; - Width += 24; - Rtf = Rtf.Replace("{Backspace}", ""); - } - } - Rtf = FixRTFToPrint(MyItemInfo, Rtf); - ProfileTimer.Pop(profileDepth); - } - // C2018-024 I in Arial font changed to I in TimesNewRoman - private static System.Drawing.Font _TNR; - // F2018-013 Changed to static and public so that it can be used with step identifiers for bullets - public static string FixRTFToPrint(ItemInfo myItemInfo, string rtf) - { - // Only do this if the text contains symbols. - if ((rtf.Contains("VESymbFix") || rtf.Contains(Volian.Base.Library.vlnFont.ProportionalSymbolFont))) // C2017-036 get best available proportional font for symbols - { - // bug fix: B2017-117 was getting an out of window handles error when doing a print all for Bryon - // add the using statment to free up window handle that is created doing a New RichTextBox() - using (System.Windows.Forms.RichTextBox rtb = new System.Windows.Forms.RichTextBox()) - { - rtb.Rtf = rtf.Replace(@"\\", ""); // rename backslash character to avoid RTF confusion - //string showRTF = rtf; - bool changed = false; - // C2018-024 I in Arial font changed to I in TimesNewRoman - if (myItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ChangeFontUpperCaseIinArial) - { - bool lastWasNumber = false; - for (int i = 0; i < rtb.TextLength - 1; i++) - { - rtb.Select(i, 2); - if (rtb.SelectionLength == 2) - { - if ((rtb.SelectedText == ".I") && rtb.SelectionFont.FontFamily.Name == "Arial") - { - if (_TNR == null) - _TNR = new System.Drawing.Font("Times New Roman", rtb.SelectionFont.Size, rtb.SelectionFont.Style); - if (lastWasNumber) - { - rtb.SelectionFont = _TNR; - changed = true; - lastWasNumber = false; - } - } - else - lastWasNumber = Regex.IsMatch(rtb.SelectedText, @"[0-9]\."); - } - } - } - // C2017-008 - WCN wants the box symbol to look like their checkoff/signoff box - // Check for a list of replacement character for symbols in the format file - // ReplaceSymbolChars lets you do one or more of the following with a symbol character: - // - change the point size - // - change the style - // - change the font family - // - change the symbol character - // - // below is taken from the BaseAll format file - is currently commentout and there for reference - // Wolf Creek (WCN) currently uses this to increase the size of the box symbol - // - // - // - // - // get the list of symbol replacements - FormatData fmtdata = (myItemInfo.ActiveFormat != null) ? myItemInfo.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData; - ReplaceSymbolCharList SymReplaceList = (fmtdata != null && fmtdata.SectData.ReplaceSymbolCharList != null) ? fmtdata.SectData.ReplaceSymbolCharList : null; - // Look at one character at a time - for (int i = 0; i < rtb.TextLength; i++) - { - rtb.Select(i, 1); - if ((rtb.SelectedRtf.Contains("VESymbFix") || rtb.SelectedRtf.Contains(Volian.Base.Library.vlnFont.ProportionalSymbolFont)) && rtb.SelectedText.Length > 0) // C2017-036 get best available proportional font for symbols - { - for (int j = 0; j < SymReplaceList.MaxIndex; j++) - { - ReplaceChar rc = SymReplaceList[j]; - if (rc.Unicode != null && (rc.Family != null || rc.Size != null || rc.Style != null)) - { - char rc_uchar = Convert.ToChar(Convert.ToInt32(rc.Unicode)); - if (rc_uchar == rtb.SelectedText[0]) - { - //use bolding underline italics from local font - System.Drawing.Font fnt = rtb.SelectionFont; - // 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 - // window handle B2017-117 - //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 != 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; - if (rc.Replace != null) - { - char rc_RplChar = Convert.ToChar(Convert.ToInt32(rc.Replace)); - rtb.SelectedText = rc_RplChar.ToString(); - } - changed = true; - break; // break out of foreach loop since we changed the character - } - } - } - } - } - if (changed) - { - if (rtb.Rtf.EndsWith(" \\par\r\n}\r\n") && rtf.EndsWith(" }")) //B2018-060 rtb.RTF added extra new line characters and commands to the end. so remove it. - rtf = rtb.Rtf.Replace(" \\par\r\n}\r\n", " }"); - else - rtf = rtb.Rtf; - return rtf.Replace("", @"\\"); // put back the backslash character - } - } - } - return rtf; - } - - // for Calvert (BGE) alarms, some step text is kept on the same line as its parent. This - // is flagged by the -1 row in the template definition. - private bool KeepOnParentLine(ItemInfo itemInfo) - { - int tindx = itemInfo.TemplateIndex; - if (tindx < 0) return false; - if (itemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].row == -1) return true; - return false; - } - - private void AdjustYOffset(float yDelta) - { - YOffset -= yDelta; - foreach (vlnPrintObject vpo in PartsAbove) - vpo.YOffset -= yDelta; - foreach (vlnParagraph vp in ChildrenBelow) - vp.AdjustYOffset(yDelta); - } - - private void BuildPlacekeeper(vlnParagraph parent, ItemInfo itemInfo) - { - if (itemInfo is SectionInfo && (itemInfo as SectionInfo).SectionConfig.Section_Placekeeper.ToUpper() != "N") // if is a section type and the section is marked to create placekeeper - { - MyPlaceKeeper = new pkParagraph(this); - if (parent != null && parent.MyItemInfo.IsSection) - parent.MyPlaceKeeper = MyPlaceKeeper; - } - else if (parent != null && parent.MyPlaceKeeper != null && itemInfo is StepInfo)//InList(parent.MyItemInfo.ItemID, 513, 514, 519, 520, 525)) - { - StepConfig sc = itemInfo.MyConfig as StepConfig; - if (sc != null && sc.Step_Placekeeper.ToUpper() != "N") - { - if (itemInfo.IsCautionPart || itemInfo.IsNotePart) - MyPlaceKeeper = parent.MyPlaceKeeper.AddCautionsAndNotes(this); - else - MyPlaceKeeper = parent.MyPlaceKeeper.AddChild(this); - } - } - } - - private void BuildContinuousActionSummary(vlnParagraph parent, ItemInfo itemInfo) - { - if (itemInfo is SectionInfo) - { - MyContAct = new pkParagraph(this); - if (parent != null && parent.MyItemInfo.IsSection) - parent.MyContAct = MyContAct; - } - else if (itemInfo is StepInfo) - { - StepConfig sc = itemInfo.MyConfig as StepConfig; - if ((sc != null && sc.Step_CAS == "True") || ((sc == null || sc.Step_CAS == null) && itemInfo.IncludeOnContActSum)) - { - // save this step info for use on the Continuous Action Summary - vlnParagraph tparent = parent; - while (tparent != null && tparent.MyContAct == null) - tparent = tparent.MyParent; - if (parent.MyContAct != null) - { - if (itemInfo.IsCautionPart || itemInfo.IsNotePart) - MyContAct = parent.MyContAct.AddCautionsAndNotes(this); - else - MyContAct = parent.MyContAct.AddChild(this); - } - else - MyContAct = tparent.MyContAct.AddChild(this); - } - } - } - private void BuildTimeCriticalActionSummary(vlnParagraph parent, ItemInfo itemInfo) - { - if (itemInfo is SectionInfo) - { - MyTimeCriticalAction = new pkParagraph(this); - if (parent != null && parent.MyItemInfo.IsSection) - parent.MyTimeCriticalAction = MyTimeCriticalAction; - } - else if (itemInfo is StepInfo) - { - StepConfig sc = itemInfo.MyConfig as StepConfig; - if ((sc != null && sc.Step_TCAS == "True") || ((sc == null || sc.Step_TCAS == null) && itemInfo.IncludeOnTimeCriticalActionSum)) - { - // save this step info for use on the Continuous Action Summary - vlnParagraph tparent = parent; - while (tparent != null && tparent.MyTimeCriticalAction == null) - tparent = tparent.MyParent; - if (parent.MyTimeCriticalAction != null) - { - if (itemInfo.IsCautionPart || itemInfo.IsNotePart) - MyTimeCriticalAction = parent.MyTimeCriticalAction.AddCautionsAndNotes(this); - else - MyTimeCriticalAction = parent.MyTimeCriticalAction.AddChild(this); - } - else - MyTimeCriticalAction = tparent.MyTimeCriticalAction.AddChild(this); - } - } - } - - private vlnParagraph FindParentRNO() - { - if (ChildrenRight != null && ChildrenRight.Count > 0) return ChildrenRight[0]; - return MyParent.FindParentRNO(); - } - - private string GetMacroName(string str) - { - int mindx = str.IndexOf(@"{!"); - string macro = str.Substring(mindx + 2, str.Length - 3); - return macro; - } - - private int TheStepLevel(ItemInfo itemInfo) - { - if (itemInfo.IsHigh) return -1; - int lev = 0; - ItemInfo ii = itemInfo; - while (!ii.MyParent.IsHigh) - { - lev++; - ii = ii.MyParent; - } - return lev; - } - - private string SectionHasCheckOffHeader(ItemInfo itemInfo, ref VE_Font font) - { - // If the passed in itemInfo is not a section, get it's parent section. This may be a subsection, so - // it will be found here, versus using 'MyActiveSection'. - while (!itemInfo.IsSection) - { - itemInfo = itemInfo.MyParent; - } - // See if this section has a checkoffheading index - this value, if set is stored in the config field. - // -1 flags no entries in the format's CheckOffHeaderList & 0 flags the first - // entry which is always '{NO HEADING}'. So only continue if it's greater than 0. - //SectionInfo si = SectionInfo.Get(itemInfo.ItemID); // sometimes the itemInfo isn't a section info - SectionInfo si = itemInfo.GetSectionInfo(); // sometimes the itemInfo isn't a section info - int sindx = si.CheckOffHeadingIndex(); - - // If there is a checkoff header for this section, see if this section has subsections. - // If this has a header but no subsections, put out the header. - // Else if this section has a header AND subsections, don't put it out... - // the subsection's checkoff header will be processed (or lack there of). - bool doCheckoffHeader = sindx > 0 && (itemInfo.Sections == null || itemInfo.Sections.Count == 0); - - // if doing it, then grab the string from the format.... CHECK if this works for subsection, it is - // getting ActiveSection which may return the top section, not subsections. - if (doCheckoffHeader && itemInfo.SectionCheckOffHeader != "") - { - font = itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font; - return itemInfo.SectionCheckOffHeader; - } - return null; - } - - private void DoCheckOffHeader(PdfContentByte cb, ItemInfo itemInfo, float yLocation, float yTopMargin, float yPageStart) - { - // CheckOffHeaders are handled in two different ways: - // 1) Where the pagelist item puts them - this is at the 'top' of the page, when the current section on the - // page has a checkoff header defined. Support for this is here AND in the VlnSvgPageHelper pagelist code. - // 2) If a continuous section, and it doesn't start at 'top' of the page, then the checkoff header is - // printed on the same line as the continuous section. Support for this is here, the check off header is added - // to the 'PartRight' off of the section's VlnParagraph. - - // First see if there is any checkoff data in the format file and that there - // is a pagelist item for the checkoff header. - int maxindx = itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList.MaxIndexNoInherit; - if (maxindx <= 0) return; - if (MyPageHelper.PageListCheckOffHeader == null) return; - - VE_Font font = null; - ItemInfo mySectionInfo = itemInfo.ActiveSection; // C2018-003 fixed use of getting the active section - ItemInfo mySubSectionInfo = itemInfo; - - // If the passed in itemInfo is not a section, get it's parent section. This may be a subsection, so - // it will be found here, versus using 'MyActiveSection' which is the topmost section. The passed in - // item may be a regular step, i.e. if a page break had occurred. - if (!itemInfo.IsSection) - { - while (!mySubSectionInfo.IsSection) - { - mySubSectionInfo = mySubSectionInfo.MyParent; - } - } - else - mySubSectionInfo = (mySectionInfo == null || mySectionInfo.Sections == null) ? null : mySectionInfo.Sections[0]; - - if (mySectionInfo == mySubSectionInfo) mySubSectionInfo = null; - - // The following duplicates the 16bit logic. The 16bit logic only put out a header if: - // there is no subsection and section has a header (from config); - // OR there is a subsection and the first subsection has a header. - // For locating the header in 16bit logic: - // If no subsections, output with section - // If subsections and continuous section, put out on same line as subsection. (done here) - // If subsections and starts at top of page, (on top of page, use pagelist code in VlnSvgPageHelper) - - // Get SectionInfos to access specific section config items... - //SectionInfo si = SectionInfo.Get(mySectionInfo.ItemID); - SectionInfo si = (mySectionInfo != null)? mySectionInfo.GetSectionInfo() : null; - int sindx = si.CheckOffHeadingIndex(); - //SectionInfo subi = mySubSectionInfo == null ? null : SectionInfo.Get(mySubSectionInfo.ItemID); - SectionInfo subi = (mySubSectionInfo == null)? null : mySubSectionInfo.GetSectionInfo(); - int subindx = (subi == null)? -1 : subi.CheckOffHeadingIndex(); - - // if there is no subsections & the main section doesn't use a header OR - // if there is a subsection, & it does not use a header... Return. - if ((subi == null && sindx < 1) || (subi != null && subindx < 1)) return; - - // figure out location now: - // if step, it uses pagelist logic to locate it (this is a page break condition). - // if continuous, put out with subsection if there is one, otherwise section. - // otherwise, use pagelist logic. - bool usePageListCOHdr = false; - - // B2022-129: Barakah - Adjust the INITIAL header location, i.e. make it a pagelist item - if (itemInfo.IsStep || itemInfo.MyDocStyle.AdjSectTitleLoc) - { - usePageListCOHdr = true; - } - // This checks to see if the section is starting at the top of the page. - // If it is, then we want to use PageList to print the checkoff/sighoff header - // else the checkoff/signoff header will be printed across from the section title where ever it is on the page (i.e. section pagination set to continuous) - else if (subi == null) //no subsection - { - // B2021-106 added check if the section has a note or caution - if ((yPageStart - YOffset) == yTopMargin || mySectionInfo.HasCautionOrNote) usePageListCOHdr = true; - } - else // there is a sub-section - { - // B2021-106 added check if the section has a note or caution - if (mySectionInfo == itemInfo && ((yPageStart - YOffset) == yTopMargin) || mySectionInfo.HasCautionOrNote) usePageListCOHdr = true; - if (!usePageListCOHdr && mySubSectionInfo != itemInfo) return; - } - - // grab the string from the format, depending on whether it should get it from the section or subsection. - string cohead = (mySubSectionInfo != null) ? mySubSectionInfo.SectionCheckOffHeader : (mySectionInfo != null)? mySectionInfo.SectionCheckOffHeader : null; - if (cohead == "" || cohead == null) return; - - // PageListCheckOffHeader is an svgtext - but really we only need the x/y location for this (pagelist support) - // The actual text is from the checkoff header selection in the section config. - if (cohead != MyPageHelper.PageListLastCheckOffHeader) - { - font = mySectionInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font; - float chkOffY = CalculateYLocation(YTop, yTopMargin); - if (MyPageHelper.YMultiplier != 1) - { - chkOffY = -1 + yTopMargin - (yTopMargin - yLocation) * MyPageHelper.YMultiplier; - if (Rtf != null) - IParagraph.Leading = _SevenLinesPerInch; - } - if (!usePageListCOHdr) - { - vlnText myCOHead = new vlnText(cb, this, cohead, cohead, MyPageHelper.PageListCheckOffHeader.X.Value + (float)MyItemInfo.MyDocStyle.Layout.LeftMargin, chkOffY, font); - PartsRight.Add(myCOHead); - } - else - MyPageHelper.PageListTopCheckOffHeader = cohead; - MyPageHelper.PageListLastCheckOffHeader = cohead; - } - } - internal vlnParagraph BottomChild - { - get - { - float bottomChildYBottomText = YBottomText; - vlnParagraph bottomChild = this; - foreach (vlnParagraph child in ChildrenRight) - { - vlnParagraph grandChild = child.BottomChild; - if (grandChild != null && grandChild.YBottomText > bottomChildYBottomText) bottomChild = grandChild; - if (grandChild != null && grandChild.YBottomText == bottomChildYBottomText && grandChild.MyItemInfo.HasChangeBar) bottomChild = grandChild; - bottomChildYBottomText = bottomChild.YBottomText; - } - foreach (vlnParagraph child in ChildrenBelow) - { - vlnParagraph grandChild = child.BottomChild; - if (grandChild != null && grandChild.YBottomText > bottomChildYBottomText) bottomChild = grandChild; - if (grandChild != null && grandChild.YBottomText == bottomChildYBottomText && grandChild.MyItemInfo.HasChangeBar) bottomChild = grandChild; - bottomChildYBottomText = bottomChild.YBottomText; - } - return bottomChild; - } - } - private void CalculateXOffsetGridOrFigure(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo) - { - float scale = itemInfo.IsRtfRaw ? 0.6f : 1.0f; - bool aerTableOrFigure = itemInfo.FormatStepData.Type.Contains("AER"); - vlnParagraph hls1 = MyParent; - if (!formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && !itemInfo.IsInSupInfo) - while (hls1.MyParent != null && !hls1.MyItemInfo.IsHigh) hls1 = hls1.MyParent; - else if (itemInfo.IsInSupInfo) - while (hls1.MyParent != null && !hls1.MyItemInfo.IsSupInfoPart) hls1 = hls1.MyParent; - float colR = float.Parse(formatInfo.MyStepSectionLayoutData.ColRTable.Split(",".ToCharArray())[itemInfo.ColumnMode]); - float xLowerLimit = (aerTableOrFigure && hls1.PartsLeft != null && hls1.PartsLeft.Count > 0) ? hls1.PartsLeft[0].XOffset : hls1.XOffset; - float xUpperLimit = 0; - float pageWidth = ((float)itemInfo.ActiveSection.MyDocStyle.Layout.PageWidth); // C2018-003 fixed use of getting the active section - float leftMargin = ((float)itemInfo.ActiveSection.MyDocStyle.Layout.LeftMargin); // C2018-003 fixed use of getting the active section - if (itemInfo.IsInRNO) - // if in rno column, the upper limit is width of the page (right margin). Subtract off size of a character - xUpperLimit = pageWidth - (72 / (float)MyItemInfo.FormatStepData.Font.CPI); - else - // in the following calculation, the hls width (hls1.Width) == rno column width, so xUpperLimit is - // the around the right margin, i.e. 'hls xoffset' + 'location of rno (colR) * columnmode' + 'width of rno' - xUpperLimit = hls1.XOffset + hls1.Width + hls1.CheckOffWidth + colR * itemInfo.ColumnMode; - - // If a table is within the alarm section and its parent is a template item is single column - // adjust the xoffset so that the table is centered around center of page - bool ctrCalvertAlarmTbl = false; - if (formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - ctrCalvertAlarmTbl = MyItemInfo.IsWithInSingleColumnTemplate(); - // B2019-049 added check for table being in a Caution or Note - if so, use the single column setting for the format variable TableCenterPos - float TableCenterPos = float.Parse(formatInfo.MyStepSectionLayoutData.TableCenterPos.Split(",".ToCharArray())[(itemInfo.IsInCautionOrNote)?0:itemInfo.ColumnMode]); - if (ctrCalvertAlarmTbl || formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TieTabToLevel) - XOffset = leftMargin + (pageWidth - leftMargin - (scale * Width)) / 2; - else - { - if (!aerTableOrFigure && itemInfo.RNOLevel == 0 && TableCenterPos != 0) // Only adjust TableCenterPos for Non-RNO Cenetered Tables - { - XOffset = TableCenterPos; - XOffset = XOffset - (this.Width / 2) + (float)itemInfo.MyDocStyle.Layout.LeftMargin; - } - else if (itemInfo.RNOLevel != 0) // RNO - XOffset = MyParent.XOffset + (MyParent.Width / 2) - ((scale * Width) / 2); - else if (aerTableOrFigure) - { - // if in the BGE alarm format and the hls is a Window (upper right corner when it prints), use the parent of the table - // to print in aer column (B2014-105) - if (MyItemInfo.IsInCalvertConditionResponse) - XOffset = hls1.XOffset + hls1.Width / 2 - Width / 2; - else - XOffset = MyHighLevelParagraph.XOffset + MyHighLevelParagraph.Width / 2 - Width / 2; - } - else // Centered Table or Figure - { - // Determine center of hls - XOffset = hls1.XOffset + hls1.Width / 2; - // Determine left edge of the table by subtracting 1/2 of its width. - XOffset -= Width / 2; - // Add in 1/2 of the width of all RNO columns - XOffset += (colR * itemInfo.ColumnMode) / 2; - - if (!aerTableOrFigure && !MyItemInfo.IsRtfRaw) - { - // 05/14/12 - 16bit code adjusts the center depending upon the CPI of the table font. - // Start with XOffset of table, then calculate the XOffset adjusted for the table font, - // based on the default CPI of 12. Adjust the XOffset by the difference of these - // two numbers. - XOffset -= (XOffset - (XOffset * (float)MyItemInfo.FormatStepData.Font.CPI / 12)); - } - XOffset -= 12; // This makes the 16bit & 32bit align very closely. - // if outside of the page margins then center within the page margins - float xOffset2 = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - float xWidth2 = (float)itemInfo.MyDocStyle.Layout.PageWidth; - if (XOffset + Width > xOffset2 + xWidth2) - XOffset = xOffset2 / 2 + xWidth2 / 2 - Width / 2; - - } - // 05/14/12 - The PosAdjust is a format flag from 16bit. For WCN2, it appears that this amount equals - // the amount of difference from a 10 CPI to a 12 CPI font. See comment above. - float posAdjust = (float)(itemInfo.FormatStepData.StepPrintData.PosAdjust ?? 0); - if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.StepPrintData != null && - posAdjust > 0) - { - if (Width < hls1.Width - posAdjust) - XOffset += posAdjust; - else if (Width < hls1.Width) - XOffset = hls1.XOffset + hls1.Width - Width; // align with the right edge of hls text - } - } - if (itemInfo.MyDocStyle.Layout.CenterToStepThenPage) - { - if (Width > hls1.Width) - { - float XOffsetPage = leftMargin + ((pageWidth - leftMargin) - Width) / 2; - float fraction = (Width - hls1.Width) / ((pageWidth - leftMargin) - hls1.Width); - float XOffsetNew = (1 - fraction) * XOffset + fraction * XOffsetPage; - _MyLog.WarnFormat("***XOffsetAdjust-CenterToStepThenPage*** ItemID, XOffset, XOffsetPage, XOffsetNew ={0},{1},{2},{3}", itemInfo.ItemID, XOffset, XOffsetPage, XOffsetNew); - XOffset = XOffsetNew; - } - } - else - { - // if the XOffset < High Level Step Text's XOffset , then align with the High Level Step Text' - // B2020-161 - needed to substract the checkoff width when deterniming the XOffset - // fixes centered tables in Calvert Unit 2 STP O-90-2 step 6.3.A - if (XOffset < xLowerLimit && Width < (xUpperLimit - xLowerLimit - hls1.CheckOffWidth)) - XOffset = xLowerLimit; - - // if the right margin exceeds the right edge of the rightmost RNO, then adjust right edge to match. - // In lines below, the 12 was used for Wolf Creek 2 column format, the pagewidth goes beyond the right border line so that - // the tables, figures & equations were beyond the border. -12 takes it enough so that if boxed, it won't print out of border - // We know this is not ideal. - if (MyItemInfo.IsRtfRaw && (XOffset + (scale * Width) > xUpperLimit - 12)) - XOffset = xUpperLimit - (scale * Width) - 12; - if (!MyItemInfo.IsRtfRaw && XOffset + Width > xUpperLimit) - XOffset = xUpperLimit - Width; - // because of the above, if it pushes beyond the left margin, use the left margin. - if (XOffset < (float)itemInfo.MyDocStyle.Layout.LeftMargin) - XOffset = XOffsetBox = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - } - } - private float AdjustForBlankLines() - { - if (MyParent != null && MyParent.MyItemInfo.FormatStepData != null && MyParent.MyItemInfo.FormatStepData.Type == "TitleWithTextRight") return 0; - // F2022-121 added SpecialStepsFoldoutKeepWhiteSpace flag to allow for all of the other special foldout formatting, but - // not compress the page - if (MyItemInfo.MyDocStyle.SpecialStepsFoldout && !MyItemInfo.MyDocStyle.SpecialStepsFoldoutKeepWhiteSpace) return 0; - if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.Prefix != null && MyItemInfo.FormatStepData.Suffix != null && MyItemInfo.FormatStepData.UseSmartTemplate) return 0; - int everyNLines = MyItemInfo.FormatStepData == null ? 1 : MyItemInfo.FormatStepData.StepLayoutData.EveryNLines ?? 1; - if (everyNLines == -99) return 0; - if (everyNLines == -1) return -SixLinesPerInch; - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || - (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && MyItemInfo.IsStep && MyItemInfo.FormatStepData.StepLayoutData.STBoxindex != null)) - { - if ((MyItemInfo.IsCaution || MyItemInfo.IsNote || MyItemInfo.MyParent.IsCaution || MyItemInfo.MyParent.IsNote) && !MyItemInfo.FormatStepData.SpaceIn - && (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0) - && (MyItemInfo.NextItem == null || MyItemInfo.MyContent.Type != MyItemInfo.NextItem.MyContent.Type)) - { - // C2014-009: Don't add another blank line - print the calvert Condition/Response RNO Caution/Notes without it. - if (!(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && MyItemInfo.IsInRNO)) - return 0; - } - //B2020-117 for multiple Calvert Condition/Response Cautions,Note, and Warnings, do add an extra blank line - // between them - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && - MyItemInfo.IsInRNO && (MyItemInfo.IsCaution || MyItemInfo.IsNote) && - MyItemInfo != MyItemInfo.LastSibling) - return 0; - if (everyNLines == 99 && MyItemInfo.NextItem == null) - { - if (MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0 && MyItemInfo.Steps[0].MyContent.Type == MyItemInfo.MyContent.Type) return 0; - if (MyItemInfo.MyParent.NextItem != null && MyItemInfo.MyParent.NextItem.MyContent.Type == MyItemInfo.MyContent.Type) return 0; - } - } - // B2015-005: if there isn't a blank line after this step && it has children, see if there shouldn't be - // a blank line, i.e. if the first substep child's type is the same as this. - if (!MyItemInfo.IsHigh && everyNLines == 99 && MyItemInfo.NextItem == null && MyItemInfo.HasChildren) - { - ItemInfo chld = MyItemInfo.FirstChild(E_FromType.Step); - if (chld != null && chld.MyContent.Type == MyItemInfo.MyContent.Type) return 0; - } - // F2021-033: No blank line between hls and its first substep: - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.NoBlankHlsAndFirstSub && MyItemInfo.IsHigh) - { - // F2021-060 Do not remove blank line between step and Caution, Note or Warning below it (Caution, Note, Warning are off 1st sub step) - if (MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0 && !MyItemInfo.Steps[0].HasCautionOrNote) return 0; - } - // F2021-025: Barakah single column no blank line between last Note/Caution/Warning text and bottom line of box - // C2021-049: Barakah no blank line between last Note/Caution/Warning text, include sub-step text by using 'IsInCautionOrNote' - // B2022-017: Barakah within note/caution, if note has substeps, there should be a blank line between note & 1st substep - // B2022-027: Barakah blank line not printing after list within another list. Rewrote code for all of these issues so that - // code looks up parents to see if they have next before returning a 0 (no blank line) - // B2022-042: double Caution followed by Critical Step missing bullet - // F2022-010: substeps in multiple notes, cautions, warning print differently - if (MyItemInfo.IsInCautionOrNote) - { - float adjLastBlankLineInNoteCautionWarning = 0; - // Get the box information for the Note, Caution, or Warning - ItemInfo tifo = (MyItemInfo.IsCaution || MyItemInfo.IsNote) ? MyItemInfo : MyItemInfo.ParentNoteOrCaution; - int typ = ((int)tifo.MyContent.Type) % 10000; - int? bxIndx = tifo.ActiveFormat.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex; - if (bxIndx != null) - { - Box bx = tifo.ActiveFormat.PlantFormat.FormatData.BoxList[(int)bxIndx]; - // F2024-078 save the adjustment of the last blank line - this value will be added to the SixLinesPerInch value (a blank line) - adjLastBlankLineInNoteCautionWarning = (float)(bx.AdjLastBlnkLn ?? 0); - } - //} - // if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.NoBlankLastNoteCautionWarn && (MyItemInfo.IsInCautionOrNote)) - // F2024-078 added check for adjustment of the last blank line in the Note/Caution box - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.NoBlankLastNoteCautionWarn || adjLastBlankLineInNoteCautionWarning != 0) - { - if ((MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0) && (MyItemInfo.NextItem == null)) // there are no sub-steps, see if any parents have next - { - ItemInfo par = MyItemInfo.MyParent; - while (par.IsInCautionOrNote) // while in the caution or note, see if there is anything below this item - { - // if there is no next item, or content types are different, go up to see if the parent has any next item. If note - // keep going up tree, otherwise there is a next so don't return 0, i.e. continue on with code to determine - // whether there is a blank line - if ((par.NextItem == null) || (par.MyContent.Type != par.NextItem.MyContent.Type)) par = par.MyParent; - else break; - } - if (!par.IsInCautionOrNote || (par != null && par.MyContent.Type != par.NextItem.MyContent.Type)) - { - if (adjLastBlankLineInNoteCautionWarning != 0) - return SixLinesPerInch + adjLastBlankLineInNoteCautionWarning; // F2024-078 adjust the size of the last blank line of Note/Caution box - else - return 0; // no blank line after last text line of Note/Caution/Warning - } - } - if ((MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0) && MyItemInfo.NextItem != null && MyItemInfo.MyContent.Type != MyItemInfo.NextItem.MyContent.Type) - { - if (adjLastBlankLineInNoteCautionWarning != 0) - return SixLinesPerInch + adjLastBlankLineInNoteCautionWarning; - else - return 0; // no blank line after last text line of Note/Caution/Warning - } - } - } - if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch; - // B2022-003: BNPP Alarms (BNPPalr) - incorrect line spacing for substeps off substeps. Added a format flag so as not to affect other plants. - if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.StepPrintData != null && MyItemInfo.FormatStepData.StepPrintData.BlankAfterSubWithSub && MyItemInfo.NextItem != null && MyItemInfo.HasChildren && MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0) return SixLinesPerInch; - - // If the next table child is a figure, equation or a visio drawing add a blank line - if (MyItemInfo.Tables != null && MyItemInfo.Tables.Count > 0 && MyItemInfo.Tables[0].MyContent.MyGrid == null) return SixLinesPerInch; - // Pagination issue to be used with yEndsWithBlankLine in Pagination code, but not checked in yet. - //if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch; - return 0; - } - private void AddMacros(ItemInfo itemInfo, vlnTab mytab) - { - float y = YOffset; - float x = mytab == null ? XOffset : mytab.XOffset + mytab.TabOffset; - List myMacros = itemInfo.MyMacros; - if (myMacros != null) - { - int colMode = (MyItemInfo.ActiveSection != null)? MyItemInfo.ActiveSection.ColumnMode : 0; // C2018-003 fixed use of getting the active section - foreach (Macro myMacro in myMacros) - { - // if the format has the 'LocWithXOff' locate the macro along with the tab's offset. - // however, if the tab is more than 2 characters long, adjust so that it aligns with the - // last two characters, not the first 2. - string tabText = mytab == null ? null : mytab.Text.Trim(" .".ToCharArray()); - int tablen = (tabText == null) ? 0 : (tabText.Length <= 2) ? 0 : tabText.Length - 2; - if (myMacro.LocWithXOff ?? false) x = mytab == null ? XOffset : ((float)mytab.XOffset + (tablen * (float)mytab.MyFont.CharsToTwips)); - if (colMode == 0 && myMacro.SingleColMacroDef != null && myMacro.SingleColMacroDef.Length > 0) - { - float macroXOffset = myMacro.MacroXOffSet ?? 0; - float widthAdj = myMacro.SingleColWidthAdjust ?? 0; // set as negative number in format - float rightTextEdge = (itemInfo.IsHigh) ? XOffset + Width + mytab.XOffset : this.MyHighLevelParagraph.XOffset + this.MyHighLevelParagraph.Width; - x = (macroXOffset > 0) ? macroXOffset : rightTextEdge; - if (rightTextEdge > x) - Width += widthAdj; - PartsRight.Add(new vlnMacro(x, y, myMacro.SingleColMacroDef)); - } - else - PartsLeft.Add(new vlnMacro(x, y, myMacro.MacroDef)); - } - } - } - // HLP Change bar flags in format file: - // Locations: With Text, Outside Box, AER on Left RNO on Right, To The Left of Text - // Text: Date & Change ID, Revision Number, Change ID, None, Custom (use input data) - // Flag AERChgBarMsgRNOChgBarNoMsg and AERMsgRNONoMsg are NOT Used in 16-bit. - private string cbMess = null; - private vlnChangeBar DoChangeBar(PdfContentByte cb, ItemInfo itemInfo, VlnSvgPageHelper myPageHelper, float xoff, float yoff, int maxRNO, FormatInfo formatInfo) //, vlnChangeBar myCB) - { - // find column for the change bar based on format flags - this is code from 16-bit - // if AbsoluteFixedChangeColumn - // if FixedAERChangeColumn - // if col>ColsS+ColR+COL_WID+ADJ - // FixedChangeColumn - // else - // AERLeftChangeBarLocation() - // else - // FixedChangeColumn - // else - // ChangeBarLocation() - ChangeBarData cbd = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData; - float cols = formatInfo.MyStepSectionLayoutData.ColS ?? 0; - float colr = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO); - // FixedChangeColumn + - Column location for change bars - // 0 - Separate AER and RNO change bars to the right of the text - // -10 to -1 - Change bars on left (specify # of columns from the text) - // <-10 - AER change bars on the left and RNO change bars on the right. - // FixedAERChangeColumn overrides the -5 default setting in chgbar.c, value is converted to a negative by the code - - float col = (cbd.AbsoluteFixedChangeColumn) ? - ((cbd.FixedAERChangeColumn ?? 0) > 0) ? - (xoff > (cols + colr + COL_WID_ADJ)) ? - cbd.FixedChangeColumn ?? 0 : AERLeftChangeBarLocation(formatInfo) : - cbd.FixedChangeColumn ?? 0 : ChangeBarLocation(xoff, this, formatInfo, maxRNO); - string chgIdTxt = null; - if (itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds) - { - StepConfig sc = itemInfo.MyConfig as StepConfig; - chgIdTxt = sc == null ? null : sc.Step_ChangeID; - } - if (myPageHelper.ChangeBarDefinition.MyChangeBarText == PrintChangeBarText.ChgID) - cbMess = chgIdTxt != null ? chgIdTxt : itemInfo.MyContent.UserID; - else if (myPageHelper.ChangeBarDefinition.MyChangeBarText == PrintChangeBarText.DateChgID) - { - string fmtDate = itemInfo.MyContent.DTS.ToShortDateString(); - if (fmtDate.Length != 10) // need to add zeros - { - if (fmtDate.IndexOf("/") == 1) - fmtDate = "0" + fmtDate; - if (fmtDate.IndexOf("/", 3) == 1) - fmtDate = fmtDate.Substring(0, 3) + "0" + fmtDate.Substring(3, fmtDate.Length - 3); - } - cbMess = (chgIdTxt != null ? chgIdTxt : itemInfo.MyContent.UserID) + @"\n" + fmtDate; - } - else if (myPageHelper.ChangeBarDefinition.MyChangeBarText == PrintChangeBarText.RevNum) - { - - string lRev = myPageHelper.Rev; - // Now check the format flags to determine if/how the Rev string should be parsed. - if ((itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate && lRev.Contains("/")) - || (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash && lRev.Contains("\\"))) - { - int indx = lRev.IndexOf(itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate ? '/' : '\\'); - cbMess = lRev.Substring(0, indx > -1 ? indx : lRev.Length); - } - else - cbMess = lRev; - } - else if (myPageHelper.ChangeBarDefinition.MyChangeBarText == PrintChangeBarText.UserDef) - cbMess = myPageHelper.ChangeBarDefinition.MyChangeBarMessage; - - int msgAlign = Element.ALIGN_LEFT; - if (myPageHelper.ChangeBarDefinition.MyChangeBarLoc == PrintChangeBarLoc.LeftOfText || - (myPageHelper.ChangeBarDefinition.MyChangeBarLoc == PrintChangeBarLoc.AERleftRNOright && - !itemInfo.IsInRNO)) msgAlign = Element.ALIGN_RIGHT; - float coltotwips = col * itemInfo.FormatStepData.Font.CharsToTwips; - if (cbd.AbsoluteFixedChangeColumn) coltotwips = col * itemInfo.ActiveFormat.PlantFormat.FormatData.Font.CharsToTwips; - // B2023-052: Beaver Valley - Inconsistent change bar location - used AbsoluteFixedChangeColumn flag, but the LeftMargin - // was still added in, thus sections had different locations for change bar if sections had different left margin. Use - // adjustment, 'AbsChgBarAdj' - coltotwips += itemInfo.MyDocStyle.Layout.AbsChgBarAdj ?? 0; - if (itemInfo.IsFigure) coltotwips = col * itemInfo.ActiveFormat.PlantFormat.FormatData.Font.CharsToTwips; - return new vlnChangeBar(cb, this, (float)itemInfo.MyDocStyle.Layout.LeftMargin + coltotwips, yoff, msgAlign, - myPageHelper.ChangeBarDefinition.MyChangeBarText == PrintChangeBarText.RevNum, - itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds); - } - - // changed this function to return a float instead of an int to correct a rounding error which cause change bars - // to inconsistantly position next to changed text. Bug B2015-033 - private float ChangeBarLocation(float c, vlnParagraph paragraph, FormatInfo formatInfo, int maxRNO) - { - int fixedChgCol = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData.FixedChangeColumn ?? 0; - float cols = formatInfo.MyStepSectionLayoutData.ColS ?? 0; - int colr = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO); - float tmpc = c; - Box bxCautNote = null; // used for notes and cautions in the Prairie Island Alarms format - if (MyItemInfo.IsCaution || MyItemInfo.IsNote) - { - // Temporary fix for change bars on Notes and Cautions where the FixedChgCol < -10 - tmpc = (float)formatInfo.MyStepSectionLayoutData.ColT + (float)formatInfo.MyStepSectionLayoutData.WidT; // end position of Caution / Note - int typ = (int)(MyItemInfo.MyContent.Type % 10000); - int? bxIndx = formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex; - if (bxIndx != null) - { - bxCautNote = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; - if (bxCautNote != null) - tmpc = (float)bxCautNote.Start + (float)bxCautNote.End; // end position of a boxed Caution / Note - } - } - // if this is a caution or note, put the change bar to the right of the text: - //if ((paragraph.MyItemInfo.IsCaution || paragraph.MyItemInfo.IsNote) && fixedChgCol < -10) return -fixedChgCol; - if ((fixedChgCol == 0))// && paragraph.MyItemInfo.IsCaution || paragraph.MyItemInfo.IsNote) - //if ((fixedChgCol==0) || paragraph.MyItemInfo.IsCaution || paragraph.MyItemInfo.IsNote) - { - float rightEdge = (paragraph.XOffset + paragraph.Width + 5); - rightEdge -= (float)paragraph.MyItemInfo.MyDocStyle.Layout.LeftMargin; - if (bxCautNote != null) - rightEdge = (float)bxCautNote.End + 10; // used for notes and cautions in the Prairie Island Alarms format - rightEdge = rightEdge / paragraph.MyItemInfo.FormatStepData.Font.CharsToTwips; - return MyItemInfo.IsFigure ? rightEdge + 1 : rightEdge; // B2017-111: Add a little more space between figure & change bar - } - if (fixedChgCol < -10 || fixedChgCol >= 0) - return ((fixedChgCol > 0) ? fixedChgCol : - (fixedChgCol == 0) ? (int)c + 1 : - (tmpc > (cols + colr + COL_WID_ADJ)) ? -fixedChgCol : - //(c > (cols + colr + COL_WID_ADJ) || (MyItemInfo.IsCaution || MyItemInfo.IsNote)) ? -fixedChgCol : - AERLeftChangeBarLocation(formatInfo)); - else - return (fixedChgCol + (((c < cols + Width + colr) || TableTest() - || MyItemInfo.IsCaution || MyItemInfo.IsNote) ? 0 : cols + colr)); // || (GetColumnMode() == 0)) ? 0 : cols + colr)); - /* Change bars to left of text -- ColS+WidS+ColR is the end of RNO col*/ - } - /* - ** Centered tables whose width exceeds the end of the RNO column should - ** still have their change bars printed on the left. This procedure checks - ** to make sure the step is a table and that it is not an RNO. - */ - private bool TableTest() - { - return false; - //return ((s->Type == TABLE || s->Type == BORDERLESSTABLE) && - //!(strchr((char *)&s->dbseq[2],RNO_MARKER))); - } - private float GetBottomYoff(float bottomY) - { - foreach (vlnParagraph child in ChildrenBelow) - { - if (child.YOffset > bottomY) bottomY = child.YOffset; - bottomY = child.GetBottomYoff(bottomY); - } - return bottomY; - } - private int AERLeftChangeBarLocation(FormatInfo formatInfo) - { - // use -5 default unless it is format specified - int fixedAERChgCol = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData.FixedAERChangeColumn ?? 0; - return (fixedAERChgCol != 0) ? - (fixedAERChgCol > 100) ? - (fixedAERChgCol % 100) : -fixedAERChgCol : -5; - } - private StringBuilder _RtfSB = null; - public string GetRtf(ItemInfo itemInfo, string prefix, string suffix) - { - int profileDepth = ProfileTimer.Push(">>>> GetRtf"); - _RtfSB = new StringBuilder(); - DisplayText vlntxt = new DisplayText(itemInfo, E_EditPrintMode.Print, E_ViewMode.View, true, E_FieldToEdit.StepText, false, prefix, suffix, MyPageHelper.MyPromsPrinter.RemoveTrailingHardReturnsAndSpaces != null); - - //C2025-021 Add logic to PROMS to support a special High Level Step type that is not printed. - if (itemInfo.IsType("InvisibleHigh")) - { - System.Drawing.Font myHighFont = vlntxt.TextFont.WindowsFont; - _RtfSB.Append(AddFontTable(myHighFont)); - _RtfSB.Append("}"); - string rtfHigh = _RtfSB.ToString(); - ProfileTimer.Pop(profileDepth); - return rtfHigh; - } - - // C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. - if (DisplayText.RemoveTrailingBlankID > 0 && !MyPageHelper.MyPromsPrinter.RemoveTrailingHardReturnsAndSpaces.Contains(itemInfo.ItemID)) MyPageHelper.MyPromsPrinter.RemoveTrailingHardReturnsAndSpaces.Add(DisplayText.RemoveTrailingBlankID); - System.Drawing.Font myFont = vlntxt.TextFont.WindowsFont; - if (!itemInfo.IsTable && StepRTB.MyFontFamily != null) - // 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 - // window handle B2017-117 - //myFont = new System.Drawing.Font(StepRTB.MyFontFamily, myFont.Size, myFont.Style); - myFont = VE_Font.GetWinSysFont(StepRTB.MyFontFamily, myFont.Size, myFont.Style); - - string stText = null; // if Calvert (BGE) Alarms, the text is included in the macro, so save text as a blank: - if (HasCalvertMacro) - { - stText = " "; - // turn underline off - // 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 - // window handle B2017-117 - //myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, System.Drawing.FontStyle.Regular); //myFont.Style. | FontStyle.Underline); - myFont = VE_Font.GetWinSysFont(myFont.FontFamily, myFont.Size, System.Drawing.FontStyle.Regular); //myFont.Style. | FontStyle.Underline); - } - else - stText = vlntxt.StartText; - - if (itemInfo.IsHigh && itemInfo.MyDocStyle.UndSpecialStepsFoldout) - { - // 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 - // window handle B2017-117 - //myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, myFont.Style | System.Drawing.FontStyle.Underline); - myFont = VE_Font.GetWinSysFont(myFont.FontFamily, myFont.Size, myFont.Style | System.Drawing.FontStyle.Underline); - stText = stText.Replace(@"\ulnone ", ""); - stText = stText.Replace(@"\ulnone", ""); - } - if (stText.Contains("{IND}")) stText = stText.Replace("{IND}", "\x5"); - if (itemInfo.IsSection && itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumber.Level0Big && itemInfo.MyParent.IsProcedure) - // 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 - // window handle B2017-117 - //myFont = new System.Drawing.Font(myFont.FontFamily, 14, myFont.Style | System.Drawing.FontStyle.Bold); - myFont = VE_Font.GetWinSysFont(myFont.FontFamily, 14, myFont.Style | System.Drawing.FontStyle.Bold); - _RtfSB.Append(AddFontTable(myFont)); - _RtfSB.Append(stText); - if (_MyItemInfo.IsStep && !itemInfo.FormatStepData.UseSmartTemplate && _MyItemInfo.FormatStepData.Suffix != null && _MyItemInfo.FormatStepData.Suffix != "") - _RtfSB.Append(_MyItemInfo.FormatStepData.Suffix.Replace("{ulnone}", @"\ulnone ")); - _RtfSB.Append("}"); - string rtf = _RtfSB.ToString(); - UnderlineTerminateList utl = MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.UnderlineTerminateList; - if (utl != null && myFont.Underline) - { - foreach (UnderlineTerminate ut in utl) - { - MatchCollection mc = Regex.Matches(rtf, "(? 0) - { - Match m = mc[mc.Count - 1]; - rtf = rtf.Substring(0, m.Index) + @"\ulnone " + rtf.Substring(m.Index); - } - } - } - ProfileTimer.Pop(profileDepth); - return rtf; - } - private float _XOffsetBox = 0; - public float XOffsetBox - { - get { return _XOffsetBox; } - set { _XOffsetBox = value; } - } - private float _MyBoxLeftAdj = 0; - private float SetHeader(vlnParagraph para, PdfContentByte cb, ItemInfo itemInfo, FormatInfo formatInfo) - { - float xoff = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - // The '6' below is really converting from characters to Twips. But instead of considering the CPI, 16bit assumed - // it was 12 to center the header. That's where the 6 comes from. - float hdrWidth = (itemInfo.MyHeader.CleanText == null) ? 0 : itemInfo.MyHeader.CleanText.Length * 6; - int typ = ((int)itemInfo.MyContent.Type) % 10000; - int? bxIndx = formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex; - float adjmentAfterBoxedNoteCautionTab = 0; // F2024-078 used to save the adjustment of the space after the Note/Caution tab - - if (itemInfo.MyHeader.Justify == System.Drawing.ContentAlignment.MiddleCenter) - { - if (bxIndx != null) - { - Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; - if (bx.TabPos > 0) - xoff += (float)bx.TabPos; // xoff starts as left margin - else - xoff += (float)((bx.TxtStart + _MyBoxLeftAdj + XOffsetBox + (bx.TxtWidth / 2)) - (hdrWidth / 2)); // xoff starts as left margin - adjmentAfterBoxedNoteCautionTab = (float) (bx.AdjSpAftTab ?? 0); // F2024-078 save the adjustment of the space (line) after the Note/Caution tab - } - else if (formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && itemInfo.IsInRNO && (itemInfo.IsCaution || itemInfo.IsNote)) // C2014-009 - xoff = XOffset + (para.Width / 2) - (hdrWidth / 2); - else if (formatInfo.MyStepSectionLayoutData.Separator.Location > 0) - xoff = XOffset + AdjustToCharPosition((float)((para.Width - hdrWidth) / formatInfo.MyStepSectionLayoutData.Separator.Location), itemInfo.MyHeader.MyFont.CPI); - else if (itemInfo.IsInRNO && itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].NumberWithLevel) - xoff = XOffset + (para.Width / 2) - (hdrWidth / 2); - else if (itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].NumberWithLevel) - xoff = XOffset + (para.Width / 2) - (hdrWidth / 2); - else - xoff = XOffset + (para.Width / 2) + (hdrWidth / 2); // XOffset has left margin included - } - else - xoff = XOffset; // XOffset has left margin included - // KEEP: This may be needed in the future to fix location of 'OR's when Separator location="0" - // the following code would place the 'OR' at the location of the tab rather than text. This - // is how 16bit was. However, a number of plants had been sent out with the xoffset at the xlocation - // of text (does not match 16bit) when this was found for BGE OI3/OI-1B/6.1.B.4. Previous releases - // went to CAT, MCG, FPL, NSP. - //{ - // if (this.MyTab != null) - // xoff = this.MyTab.XOffset; - // else - // xoff = XOffset; - //} - // B2018-096 AEP 082.002CD Note Box overlapping Step Box - vlnHeader myHeader = new vlnHeader(this, cb, itemInfo.MyHeader.Text, itemInfo.MyHeader.CleanText.TrimStart(" ".ToCharArray()), xoff + AdjustHeader + _MyBoxLeftAdj, YOffset, itemInfo.MyHeader.MyFont); - PartsAbove.Add(myHeader); - //return myHeader.Height + (!MyItemInfo.MyDocStyle.SpecialStepsFoldout || (MyItemInfo.MyDocStyle.ExtraLineHeader && (MyItemInfo.IsCaution || MyItemInfo.IsNote)) ? SixLinesPerInch : 0); - // Only use SpaceIn property for Cautions or Notes - bool bSpaceIn = (MyItemInfo.IsCaution || MyItemInfo.IsNote) ? MyItemInfo.FormatStepData.SpaceIn : true; - // F2022-121 added SpecialStepsFoldoutKeepWhiteSpace flag to allow for all of the other special foldout formatting, but - // not compress the page - this need to handle explicit OR and AND sub-steps to ensure there are blank lines before and after - // the separator text. - return myHeader.Height + (!MyItemInfo.MyDocStyle.SpecialStepsFoldout || (MyItemInfo.MyDocStyle.SpecialStepsFoldout && MyItemInfo.MyDocStyle.SpecialStepsFoldoutKeepWhiteSpace) || (MyItemInfo.MyDocStyle.ExtraLineHeader && (MyItemInfo.IsCaution || MyItemInfo.IsNote)) ? bSpaceIn ? SixLinesPerInch : 0 : 0) + adjmentAfterBoxedNoteCautionTab; // F2024-078 add adjustment to the space after the Note/Caution tab - } - private float AdjustToCharPosition(float position, float? CPI) - { - int iPosition = (int)position; - int charsToTwips = (int)(72 / (CPI ?? 12)); - iPosition = (iPosition / charsToTwips) * charsToTwips; - position = (position / 7.2F) * 7.2F; - return (float)iPosition; - } - private bool _SectionPageBreak = false; - public bool SectionPageBreak - { - get { return _SectionPageBreak; } - set { _SectionPageBreak = value; } - } - private bool _Processed = false; - public bool Processed - { - get { return _Processed; } - set { _Processed = value; } - } - private vlnParagraph _LastRNO; - public vlnParagraph LastRNO - { - get { return _LastRNO; } - set { _LastRNO = value; } - } - private vlnParagraph _MyTopRNO; - public vlnParagraph MyTopRNO - { - get { return _MyTopRNO; } - set { _MyTopRNO = value; } - } - private static string _PathPrefix = ""; - public static string PathPrefix - { - get { return vlnParagraph._PathPrefix; } - set { vlnParagraph._PathPrefix = value; } - } - protected float _YBottomMost; // Bottom of the paragraph including the children - public float YBottomMost - { - get { return _YBottomMost; } - set - { - _YBottomMost = value; - } - } - private float _YBottomPagination; // B2019-111 Keep table with Parent - protected float YBottomPagination - { - get { return _YBottomPagination; } - set { _YBottomPagination = value; } - } - protected float _YBottomMostAdjust = 0; // the RNO separator is outside asterisk box, account for additional Y space - public float YBottomMostAdjust - { - get { return _YBottomMostAdjust; } - set { _YBottomMostAdjust = value; } - } - protected float _YTopMost; // Top of the paragraph including the children - public float YTopMost - { - get { return _YTopMost; } - set { _YTopMost = value; } - } - protected float _YTop; // Top of the paragraph including parts - public float YTop - { - get { return _YTop; } - set - { - vlnParagraph vp = this as vlnParagraph; - _YTop = value; - - } - } - public float SmartTemplateAdjust - { - // If we're in a smart template (WCNCKL checklists) then account for the bottom line in the - // table. - get { return (MyItemInfo.IsHigh && MyItemInfo.FormatStepData.UseSmartTemplate) ? SixLinesPerInch : 0; } - } - public float YSize // How big this paragraph is with all of its children - { - get - { - float ysize = SmartTemplateAdjust + _YBottomMost - _YTopMost; - if (MyItemInfo.IsHigh && ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)) - ysize += SixLinesPerInch; - return ysize; - } - } - private ItemInfo _MyItemInfo; - public ItemInfo MyItemInfo - { - get { return _MyItemInfo; } - set { _MyItemInfo = value; } - } - private vlnParagraph _MyHighLevelParagraph; - - public vlnParagraph MyHighLevelParagraph - { - get - { - if (_MyHighLevelParagraph == null) - { - _MyHighLevelParagraph = GetHighLevelParagraph(); - } - return _MyHighLevelParagraph; - } - } - private vlnParagraph GetHighLevelParagraph() - { - if (MyItemInfo.IsHigh) return this; - return MyParent.GetHighLevelParagraph(); - } - private vlnParagraph _SupInfoSection; - public vlnParagraph SupInfoSection - { - get - { - if (_SupInfoSection == null) - { - _SupInfoSection = GetSupInfoSectionParagraph(); - } - return _SupInfoSection; - } - } - private vlnParagraph GetSupInfoSectionParagraph() - { - if (MyItemInfo.IsSection) return this._SupInfoSection; - return MyParent.GetSupInfoSectionParagraph(); - } - // Tab, Separator, ChangeBar, Box, Circle, Checkoff - private vlnTab _MyTab; - public vlnTab MyTab - { - get - { - if (_MyTab == null) - { - foreach (vlnPrintObject po in PartsLeft) - { - if (po is vlnTab) - { - _MyTab = po as vlnTab; - break; - } - } - } - return _MyTab; - } - } - private vlnPrintObjects _PartsAbove; - public vlnPrintObjects PartsAbove - { - get - { - if (_PartsAbove == null) _PartsAbove = new vlnPrintObjects(); - return _PartsAbove; - } - } - private vlnPrintObjects _PartsBelow; - public vlnPrintObjects PartsBelow - { - get - { - if (_PartsBelow == null) _PartsBelow = new vlnPrintObjects(); - return _PartsBelow; - } - } - private vlnPrintObjects _PartsRight; - public vlnPrintObjects PartsRight - { - get - { - if (_PartsRight == null) _PartsRight = new vlnPrintObjects(); - return _PartsRight; - } - } - private vlnPrintObjects _PartsLeft; - public vlnPrintObjects PartsLeft - { - get - { - if (_PartsLeft == null) _PartsLeft = new vlnPrintObjects(); - return _PartsLeft; - } - } - private vlnPrintObjects _PartsContainer; - public vlnPrintObjects PartsContainer - { - get - { - if (_PartsContainer == null) _PartsContainer = new vlnPrintObjects(); - return _PartsContainer; - } - } - private vlnParagraphs _ChildrenAbove; - public vlnParagraphs ChildrenAbove - { - get - { - if (_ChildrenAbove == null) _ChildrenAbove = new vlnParagraphs(this); - return _ChildrenAbove; - } - } - private vlnParagraphs _ChildrenBelow; - public vlnParagraphs ChildrenBelow - { - get - { - if (_ChildrenBelow == null) _ChildrenBelow = new vlnParagraphs(this); - return _ChildrenBelow; - } - } - private vlnParagraphs _ChildrenRight; - public vlnParagraphs ChildrenRight - { - get - { - if (_ChildrenRight == null) _ChildrenRight = new vlnParagraphs(this); - return _ChildrenRight; - } - } - private vlnParagraphs _ChildrenLeft; - public vlnParagraphs ChildrenLeft - { - get - { - if (_ChildrenLeft == null) _ChildrenLeft = new vlnParagraphs(this); - return _ChildrenLeft; - } - } - private float? _XOffsetCenter = null; - - public float? XOffsetCenter - { - get { return _XOffsetCenter; } - set { _XOffsetCenter = value; } - } - - public bool IsEnhancedBackgroundFormat(ItemInfo itminfo) - { - return ((itminfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds); - } - - public void AdjustXOffsetForTab(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab, float xMetaAdj) - { - if (itemInfo.IsSupInfoPart) - { - // The SupInfoTabOff was added to the base format during initial development to shift the tab over by 3/4 inch (54) to allow for enough space for Note/Caution tab - int sitabloc = itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SupInfoTabOff == null ? 0 : (int)itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SupInfoTabOff; - // B2023-069 allow for the adjustment of the Supplemental Information tab at the section level (SecOvrideSupInfoTabOff). - // this will also override the SupInoTabOff setting which is for the entire format - int secOvrSupInfoTab = itemInfo.MyDocStyle.SecOvrideSupInfoTabOff == null ? 0 : (int)itemInfo.MyDocStyle.SecOvrideSupInfoTabOff; - if (secOvrSupInfoTab != 0) sitabloc = secOvrSupInfoTab; - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + sitabloc; - if (myTab != null) - { - myTab.XOffset = XOffset - ((myTab == null) ? 0 : myTab.Width) - 12; - // B2017-253 - Limit the tab offset to 2 points inside the left margin - myTab.XOffset = Math.Max(myTab.XOffset,itemInfo.MyDocStyle.Layout.LeftMargin ?? 72)+2; - float mytbwidth = myTab.Width; - myTab.Width = 2.5f * myTab.Width; - // C2018-022: adjust xoffset of text by 12 if the tab would overwrite the text and the format flag is on: - if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SupInfoAdjustXOffForLongTab && ((myTab.XOffset + mytbwidth + 12) > XOffset)) - XOffset = 12F + myTab.XOffset + mytbwidth; - } - // B2017-102: need to set width here since using Xoffset because AdjustWidth is called before this adjustment. - Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - XOffset - (sitabloc / 2); - return; - } - // F2019-069: Hold Point designator for Barakah, use parent's tab for xoffset - if (itemInfo.IsStep && itemInfo.FormatStepData.ColUseParentTab && (myTab == null || myTab.Text == "")) - { - if (MyParent != null) - { - XOffset = (MyParent.MyTab == null || MyParent.MyTab.Text == null || MyParent.MyTab.Text.Trim() == "") ? MyParent.XOffset : MyParent.MyTab.XOffset; - return; - } - } - float tabWidth = (myTab == null) ? 0 : myTab.Width; - if (itemInfo.IsStepSection) - { - if (formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Just == "PSLeft") - { - int level = 0; - ItemInfo iilvl = itemInfo; - while (!iilvl.IsProcedure) - { - level++; - iilvl = iilvl.MyParent; - } - if (formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) - { - XOffset = (myTab == null ? 0 : myTab.XOffset) + ((float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos - (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos); - } - else - { - level = level <= 2 ? 1 : level - 1; - if (level == 1) - { - // Use the section number position for the section title when the section number is blank - if (formatInfo.PlantFormat.FormatData.SectData.SectionHeader.UseNumPosWhenNumBlank && MyTab != null && MyTab.Text.Trim().Length == 0) - { - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + ((float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos); - } - else - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (level * (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos); - } - else if (formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) - XOffset = (myTab == null ? 0 : myTab.XOffset) + ((float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos - (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos); - else - { - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[level].ColSByLevel; - XOffset += (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[level].SecTitlePositionAdj; - XOffset -= xMetaAdj; - } - - if (itemInfo.MyDocStyle.SectTitleOffsetOverride != null) - { - XOffset += (float)itemInfo.MyDocStyle.SectTitleOffsetOverride; - } - - } - } - else if (formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Just == "PSCenter") - { - float hdrWidth = itemInfo.MyContent.Text.Length * 6; - float ctr = (((float)itemInfo.MyDocStyle.Layout.PageWidth - (float)itemInfo.MyDocStyle.Layout.LeftMargin)) / 2; - XOffsetCenter = (float)itemInfo.MyDocStyle.Layout.LeftMargin + ctr - (hdrWidth / 2); - } - return; - } - // B2021-091 added a null reference check - itemInfo was a section and didn't have FormatStepData so just return - if (itemInfo.FormatStepData == null) return; - - int? bxIndx = itemInfo.FormatStepData.StepLayoutData.STBoxindex; - float? colOvrd = itemInfo.FormatStepData.ColOverride; - if (itemInfo.IsBackgroundStep())//WolfCreekBackgroundFormat && IsHigh||IsNote||IsCaution or ImplicitOR - { - int adj = 2; - if (myTab != null) - { - //B2018-139 use XOffset when processing HLS, Caution, or Note background text and tab - if (itemInfo.IsHigh || (itemInfo.IsNote && (itemInfo.MyParent.IsHigh || itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote)) || (itemInfo.IsCaution && (itemInfo.MyParent.IsHigh || itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote))) - myTab.XOffset = XOffset; - else - { - // F2018-041 seq tabs off of TitleWithTextBelow were running into the step text - myTab.XOffset = XOffset + (itemInfo.FormatStepData.Font.CharsToTwips * adj); // F2018-041 move tab over 2 chars so it positions like paragraphs under TitleWithTextBelow - adj += myTab.Text.Length; // F2018-041 add the length of the tab to the adjustment of the XOffset - } - } - XOffset += (itemInfo.FormatStepData.Font.CharsToTwips * adj); // indent 2 characters for background steps - // B2018-146 Adjust the width to match the HLS Right Margin. - //if (itemInfo.ActiveFormat.Name.StartsWith("WCN")) -- Not needed since IsBackgroundStep - Width = this.MyHighLevelParagraph.Width + this.MyHighLevelParagraph.XOffset - this.XOffset; - //else - // Width -= (itemInfo.FormatStepData.Font.CharsToTwips * adj); // Adjust width by 2 characters - return; - } - else if (itemInfo.FormatStepData.UseOldTemplate && itemInfo.IsInTemplate() && - (MyItemInfo.ActiveSection != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd)) // C2018-003 fixed use of getting the active section - { - if (myTab != null) myTab.XOffset = XOffset; - XOffset += myTab.Width; - return; - } - else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextBelow") - { - if ((colOvrd ?? 0) != 0) - XOffset = (float)colOvrd; - else - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - // B2018-146 Adjust the width to match the HLS Right Margin. - if(itemInfo.IsPartOfBackgroundStep()) - //if(itemInfo.ActiveFormat.Name.StartsWith("WCN")) - Width = this.MyHighLevelParagraph.Width + this.MyHighLevelParagraph.XOffset - this.XOffset; - return; - } - else if (itemInfo.IsParagraph && - (((itemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) || - ((itemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations)) && - itemInfo.FormatStepData != null && PreviousIsTitleWithTextBelow(itemInfo)) - { - // This code was needed for fix for B2015-183 && - // IP2 backgrounds so that any 'paragraph's that were at the same - // level as the 'TitleWithTextBelow's would have same left margin (xoffset) as the 'TitleWithTextBelow'. - // an example of this can be found in IP2 Backgrounds, 2-E-0, Step Description Table, Step 22, PLANT-SPECIFIC INFORMATION. - // (NOTE that the IP2 exaxmple was no longer in the data when the work on B2015-183 was done) - if ((colOvrd ?? 0) != 0) - XOffset = (float)colOvrd; - else - { - //Adjuust Indent for Wolf Creek Background format flag - float indentBG1 = itemInfo.IsPartOfBackgroundStep() ? itemInfo.FormatStepData.Font.CharsToTwips * 2 : 0; - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + indentBG1; - // B2018-146 Adjust the width to match the HLS Right Margin. - if (itemInfo.IsPartOfBackgroundStep()) - //if (itemInfo.ActiveFormat.Name.StartsWith("WCN")) - Width = this.MyHighLevelParagraph.XOffset + this.MyHighLevelParagraph.Width - XOffset; - else - Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - (float)itemInfo.MyDocStyle.Layout.LeftMargin - indentBG1; - } - return; - } - else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextBelow" && (!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || (!itemInfo.IsCaution && !itemInfo.IsNote))) - { - float childindent = itemInfo.MyParent.FormatStepData.ChildIndent ?? 0; - if (myTab != null) - { - float delta = childindent + MyParent.XOffset - myTab.XOffset; - myTab.XOffset += delta; - XOffset += delta; - // B2018-036: set the width of (background/deviation/alarms/etc) steps that have a tab - if (!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || !UseTemplateWidthOrXOff(itemInfo.MyParent)) - { - // B2018-146 Adjust the width to match the HLS Right Margin. - // F2023-112 added format flag for Vogtle Units 3 & 4 backgrounds. This allows use of override width on AND and List sub-step types - if (itemInfo.IsBackgroundStepOrChild() || itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.Vogtle3and4BackgroundFormat) - Width = this.MyHighLevelParagraph.Width + this.MyHighLevelParagraph.XOffset - this.XOffset; - else - Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - (float)itemInfo.MyDocStyle.Layout.LeftMargin - delta; - } - } - else - { - //Adjust Indent for Wolf Creek Background format flag - float indentBG2 = itemInfo.IsPartOfBackgroundStep() ? itemInfo.FormatStepData.Font.CharsToTwips * 2 : 0; - XOffset = childindent + MyParent.XOffset + indentBG2;//(itemInfo.FormatStepData.Font.CharsToTwips * 2); - // B2016-164: Added the following 'if' so that the width is not recalculated if in the alarm format & the parent has a template - // B2016-168: The fix for 164 broke deviation document printing. The if statement was fixed for both: - // B2019-057 Added a check to see if there is a width override for this step element (Robinson AOP Backgrounds - paragraphs) - float wdthovrd = (itemInfo.FormatStepData.WidthOverride == null) ? 0 : (float)ToInt(itemInfo.FormatStepData.WidthOverride, maxRNO); - if ((!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || !UseTemplateWidthOrXOff(itemInfo.MyParent)) && wdthovrd == 0) - Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - (float)itemInfo.MyDocStyle.Layout.LeftMargin - indentBG2; - } - return; - } - else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextRight") - { - if ((colOvrd ?? 0) != 0) - XOffset = (float)colOvrd; - else - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - return; - } - else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight") - { - XOffset = MyParent.MyParent.XOffset; - // if the step text has a tab, then we need to position the tab to the XOffset and then ajust the text XOffset - // by the length of the tab. - fix for IP2 backgrounds (ex. 2-ECA-3.3, step 6) - if (myTab != null) - { - myTab.XOffset = XOffset; - XOffset += (myTab.Text.Length * myTab.MyFont.CharsToTwips);//myTab.Width - myTab.XOffset; - } - return; - } - if (itemInfo.IsHigh) - { - if (formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || - ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_SameXOffSubsections) == E_DocStructStyle.DSS_SameXOffSubsections)) - { - // the HLS in the template prints the tab/step on the right edge of page. Don't - // do the other calculations to relocate it. - if (itemInfo.FormatStepData.UseOldTemplate && itemInfo.IsInTemplate()) - { - MyTab.XOffset = XOffset - MyTab.Width; - return; - } - // the following code handles the xoffsets of tabs/HLS in the non-alarm sections for - // the Calvert Alarm format. - if (itemInfo.MyDocStyle.UseColSByLevel) - { - if (myTab != null) - { - myTab.Rtf = myTab.Rtf.Replace(myTab.Text, myTab.Text.TrimStart(" ".ToCharArray())); - // B2022-129: don't indent HLS when flag is on (Barakah - single column step attachment with meta sect) - if (itemInfo.MyDocStyle.AdjSectTitleLoc) - { - myTab.XOffset = MyParent.MyTab.XOffset; - XOffset = MyParent.XOffset; - } - else - { - myTab.XOffset = MyParent.XOffset; - XOffset = myTab.XOffset + MyTab.Width; - } - } - else - XOffset = MyParent.XOffset; // unnumbered hls - return; - } - } - float x = 0; - float xoff = 0; - if ((colOvrd ?? 0) != 0) - x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)colOvrd; - else - x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; - - xoff = x - XOffset; - // ColSByLevel will specify the column in which the High Level Step starts with - // respect to the overall level calculation based on sections & meta-sections. - // Only a few of the single column formats use this: WCN1, CAL1, RGEBCK - if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TieTabToLevel - && !(itemInfo.MyDocStyle.SpecialStepsFoldout && itemInfo.MyDocStyle.UseColSByLevel)) - { - int indxLevel = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel(); - // B2021-113: BNPP1new - subsection & HLS should be same level (xoffset of tab & text) - if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.SubSectAndHighSameLevel && !MyItemInfo.MyActiveSection.MyParent.IsProcedure) indxLevel++; - float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.MaxIndex].ColSByLevel; - float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; - float adjCols = (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent; - float xtabcol = adjCols - ((myTab == null || myTab.Text == null) ? 0 : (myTab.Text.Length * 7.2f)); - if (indxLevel > 1 && myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + xtabcol; - else if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel; - if (myTab != null) - { - myTab.Rtf = myTab.Rtf.Replace(myTab.Text, myTab.Text.TrimStart(" ".ToCharArray())); - if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList != null && - formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList.Count > 0) - // B2021-113: BNPP1new - subsection & HLS should be same level (xoffset of tab & text) - if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.SubSectAndHighSameLevel && !MyItemInfo.MyActiveSection.MyParent.IsProcedure) - XOffset += tabWidth; - else - XOffset = myTab.XOffset + GetLeftJustify(formatInfo, indxLevel); // 2.1.1 goes here xoffset = 136 - else - XOffset = myTab.XOffset + (myTab.Text.Length * (float)itemInfo.FormatStepData.Font.CPI) - colsbylevel; - } - } - else - { - XOffset += xoff; - // For Calvert, adjust from the left margin and current section's tab. This is used - // in BGEEOP (see EOP-0/Purpose ). However, it caused BGESTP's to print LossOfAC steps (unnumbered HLS) too - // far to the left. The ForceAlignNullTabWSectHead was introduced so that for that step type (LossOfAC) in STP/OI format, - // the SectData.SectionHeader.Pos was used rather than SectData.SectionNumber.Pos - if (myTab == null && !itemInfo.FormatStepData.ForceAlignNullTabWSectHead && itemInfo.FormatStepData.AlignNullTabWSectHead && itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; - else if (myTab == null && itemInfo.FormatStepData.AlignNullTabWSectHead) - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos; - if (myTab != null) - { - if (itemInfo.MyDocStyle.AlignHLSTabWithSect || itemInfo.FormatStepData.AlignHLSTabWithSectOvride) - { - float orgXOffset = MyTab.XOffset; - myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos; - XOffset = myTab.XOffset + myTab.Width; - // F2025-040 Adjust the Cont Act box position around HLS number - if (myTab.MyMacro != null) myTab.MyMacro.XOffset += (MyTab.XOffset - orgXOffset); - } - else - { - myTab.XOffset += xoff; - if (myTab.MyMacro != null) myTab.MyMacro.XOffset += xoff; - } - } - else - { - if (itemInfo.MyDocStyle.AlignHLSTabWithSect) - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos; - } - } - } - else if (((colOvrd ?? 0) != 0) && (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.NullBox)) - { - float tabOffset = (myTab == null ? 0 : myTab.XOffset) - XOffset; - XOffset = (float)colOvrd; - if (myTab != null) myTab.XOffset = XOffset + tabOffset; - return; - } - else if (((colOvrd ?? 0) != 0) && (IsEnhancedBackgroundFormat(itemInfo) && (itemInfo.IsNote || itemInfo.IsCaution))) - { - float tabOffset = (myTab == null ? 0 : myTab.XOffset); - // Adjust the position of the Note/Caution text by the difference of the colOverride and the tab xoffset - XOffset += ((float)colOvrd - tabOffset); - if (myTab != null) myTab.XOffset = (float)colOvrd; // set the note/caution tab offset to the colOverride - return; - } - // put in for Point Beach (wep2) we don't want to do this if we are processing a boxed substep (cont. action substep) - else if (bxIndx != null && (itemInfo.IsCaution || itemInfo.IsNote || - !itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.ContActBoxOnSubSteps)) - { - Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; - if (bx == null) - { - if ((colOvrd ?? 0) != 0) - { - // 16-bit code subtracted the left margin - //xoff = ((float)colOvrd - (float)itemInfo.MyDocStyle.Layout.LeftMargin) - XOffset; - //XOffset += xoff; - //if (myTab != null) myTab.XOffset += xoff; - //xoff = MyParent.XOffset - myTab.XOffset; - //XOffset += xoff; - float tabOffset = (myTab == null ? 0 : myTab.XOffset) - XOffset; - - XOffset = (float)colOvrd; - if (myTab != null) myTab.XOffset = XOffset + tabOffset; - return; - } - else - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + tabWidth + XOffsetBox; - } - else - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + _MyBoxLeftAdj + tabWidth + XOffsetBox; - if (myTab != null) myTab.XOffset = XOffset - tabWidth; - } - else if (itemInfo.IsRNOPart && itemInfo.MyParent != null && itemInfo.MyParent.IsRNOPart && itemInfo.FormatStepData.NumberWithLevel) - { - // xoffset is same as parent RNO (this is a BGE format flag). Instead of RNO's being siblings, - // they had a parent/child relationship. So want the child to have same xoffset as parent, i.e. - // the same xoffset. - XOffset = MyParent.XOffset; - myTab.XOffset = MyParent.MyTab.XOffset; - return; - } - else if (itemInfo.IsRNOPart && (colOvrd > 0 || !((ItemInfo)itemInfo.ActiveParent).IsHigh) && itemInfo.FormatStepData.OffsetTab) - { - if (colOvrd > 0) - { - XOffset = (int)colOvrd; - if (!((ItemInfo)itemInfo.MyParent).IsHigh) - { - ItemInfo hls = itemInfo.MyHLS; - XOffset -= (itemInfo.MyTab.Offset - hls.MyTab.Offset); - } - } - // if this format has the centerline & numberwithlevel (special tabbing for rno) then - // position rno xoffset of the tab to be close to centerline & text indented from there (only BGE) - if (itemInfo.MyDocStyle.CenterLineX != null && itemInfo.FormatStepData.NumberWithLevel) - { - // if the tab is 3 char or smaller, make the indent amount for the rno text 4 characters. - // if bigger, make it the additional tab size. - int len = myTab.Text.Trim().Length; - int adj = len <= 3 ? 4 : (len - 3) + 4; - float rnoOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)itemInfo.MyDocStyle.CenterLineX + 5; - float tPtPerChar = itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar ?? 6; - XOffset = rnoOffset + tPtPerChar * adj; - Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - XOffset - 11; // 11 is about size of char, so don't touch right line. - if (myTab != null) myTab.XOffset = rnoOffset; - } - // if the step is within the rno and we're numbering the high level rno, we've got to account for the - // indenting (increased x offset) for the top level rno's tab, if there is no top level rno: - else if (itemInfo.FormatStepData.NumberHighLevel && (itemInfo.MyHLS.RNOs == null || itemInfo.MyHLS.RNOs.Count <= 0)) - { - // add in the size that an RNO off HLS would take. - tabWidth += itemInfo.MyTab.RNOTabWidthAdjust; - XOffset += tabWidth; - if (myTab != null) myTab.XOffset += tabWidth; - } - if (itemInfo.ActiveFormat.MyStepSectionLayoutData.DevNoteOrCautionTabOffset != null) - { - MyTab.XOffset = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.DevNoteOrCautionTabOffset); - XOffset = MyTab.XOffset + tabWidth - MyTab.TabAlign; - } - } - else if (MyParent != null) - { - if (myTab == null && itemInfo.FormatStepData.AlignNullTabWSectHead && itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; - else if (itemInfo.ActiveFormat.MyStepSectionLayoutData.DevNoteOrCautionTabOffset != null) - { - if (MyTab != null) - { - MyTab.XOffset = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.DevNoteOrCautionTabOffset); - XOffset = MyTab.XOffset + tabWidth - MyTab.TabAlign; - if (myTab.MyMacro != null && myTab.MyMacro.XOffset != 0) myTab.MyMacro.XOffset += tabWidth - myTab.TabAlign; - } - } - else if (itemInfo.IsSequential && itemInfo.MyParent.IsHigh && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.Align1StLevSubWHLS) == E_DocStructStyle.Align1StLevSubWHLS)) - { - XOffset = MyParent.XOffset; - if (myTab != null) myTab.XOffset = (MyParent.MyTab != null ? MyParent.MyTab.XOffset : XOffset); - } - else if (itemInfo.IsSequential && itemInfo.MyHLS.FormatStepData.AppendDotZero)// F2018-025 shift first level substep to column position of high level step Westinghouse wst1 step type 50 - { - if (itemInfo.MyParent.IsHigh) - { - XOffset = MyParent.XOffset; - if (myTab != null) myTab.XOffset = (MyParent.MyTab != null ? MyParent.MyTab.XOffset : XOffset); - } - else - { - myTab.XOffset = MyParent.XOffset; - XOffset = myTab.XOffset + MyTab.Width; - } - } - else if (myTab != null && itemInfo.IsSequential && formatInfo.PlantFormat.FormatData.SectData.UseMetaSections && formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList.Count > 0) - { - int indxLevels = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel(); - // B2021-113: BNPP1new - subsection & HLS should be same level (xoffset of tab & text) - if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.SubSectAndHighSameLevel && !MyItemInfo.MyActiveSection.MyParent.IsProcedure) indxLevels++; - float tableftadj = GetLeftJustify(formatInfo, indxLevels); - if (tableftadj != 0) - { - // the order of this is important. First adjust the tab's xoffset for the width of - // the tab. The offset of text needs to be adjusted by the 'leftjustify' format variable - // if it existed for this level. - myTab.XOffset += tabWidth; - if (tableftadj != 0 && myTab.Width < tableftadj) - tabWidth = myTab.Width = tableftadj; - XOffset += tabWidth; - myTab.Rtf = myTab.Rtf.Replace(myTab.Text, myTab.Text.TrimStart(" ".ToCharArray())); - Width = MyParent.Width - myTab.Width; - } - else // if no left justify, right align the tab - { - XOffset += tabWidth - (myTab == null ? 0 : myTab.TabAlign); - if (myTab != null) - { - myTab.XOffset += tabWidth - myTab.TabAlign; - if (myTab.MyMacro != null && myTab.MyMacro.XOffset != 0) myTab.MyMacro.XOffset += tabWidth - myTab.TabAlign; - } - } - } - - //else if ((itemInfo.FormatStepData.ColOverride ?? 0) > 0) - //{ - // XOffset = (float)itemInfo.FormatStepData.ColOverride; - // MyTab.XOffset = XOffset; - // return; - //} - else // if no left justify, right align the tab - { - // The following fixes F2016-033: Print the Verification Point at left margin. - if (itemInfo.ActiveFormat.Name.ToUpper().StartsWith("VCB") && (itemInfo.FormatStepData.ColOverride ?? 0) > 0) - { - XOffset = (float)itemInfo.FormatStepData.ColOverride; - } - else - { - XOffset += tabWidth - (myTab == null ? 0 : myTab.TabAlign); - if (myTab != null) - { - myTab.XOffset += tabWidth - myTab.TabAlign; - if (myTab.MyMacro != null && myTab.MyMacro.XOffset != 0) myTab.MyMacro.XOffset += tabWidth - myTab.TabAlign; - } - // B2018-146 Adjust the width to match the HLS Right Margin. - if (itemInfo.IsBackgroundStepOrChild()) - Width = this.MyHighLevelParagraph.Width + this.MyHighLevelParagraph.XOffset - this.XOffset; - } - } - } - // if format had a tab adjustment for step type, use it. MyTab.Offset is only set for FNP formats - // to get the correct xoffset for their tabs/text. The issue is that they use very large tabs - // because levels of substeps include the parent tab. This code will only be run for FNP. - if (itemInfo.MyTab != null && itemInfo.MyTab.Offset != 0) - { - float xOffTabNew = (MyParent.MyTab != null ? MyParent.MyTab.XOffset : MyParent.XOffset) + itemInfo.MyTab.Offset; - xOffTabNew += MyParent.MyTab == null ? 0 : MyParent.MyTab.TabOffset; - float xIncrement = xOffTabNew - MyTab.XOffset; - myTab.XOffset += xIncrement; - XOffset += xIncrement; - Width -= xIncrement; - } - } - private bool PreviousIsTitleWithTextBelow(ItemInfo itemInfo) - { - while (itemInfo.MyPrevious != null) - { - if (itemInfo.MyPrevious.FormatStepData.Type == "TitleWithTextBelow") return true; - itemInfo = itemInfo.MyPrevious; - } - return false; - } - - private static float GetLeftJustify(FormatInfo formatInfo, int indxLevels) - { - LeftJustifyList jstlst = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList; - float tableftadj = 0; - foreach (LeftJustify lj in jstlst) - { - if (lj.Index == indxLevels) - { - tableftadj = lj.Size ?? 0; - break; - } - } - return tableftadj; - } - private float _CheckOffWidth = 0; - public float CheckOffWidth - { - get { return _CheckOffWidth; } - set { _CheckOffWidth = value; } - } - private float _AdjustHeader = 0;// B2018-096 AEP 082.002CD Note Box overlapping Step Box - public float AdjustHeader - { - get { return _AdjustHeader; } - set { _AdjustHeader = value; } - } - public void AdjustWidth(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab) - { - int? bxIndx = itemInfo.IsStep ? itemInfo.FormatStepData.StepLayoutData.STBoxindex : null; - float? widOvrd = 0; - float xwid = 0; - if (itemInfo.IsStep && itemInfo.MyHLS != null && UseTemplateWidthOrXOff(itemInfo) && (xwid = GetWidthOrStartFromTemplate(itemInfo, formatInfo, true)) > 0) - widOvrd = xwid; - else - widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride == null ? null : - (float?)ToInt(itemInfo.FormatStepData.WidthOverride, maxRNO); - // Calvert subheaders in valve lists - the text gets centered, so the width is the width - // of the page (also, don't do this for alarms, thus the !SpecialCaseCalvert Alarms, since - // alarms use Caution1 as the annunciator): - if (itemInfo.IsStep && itemInfo.MyHLS != null && !itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && - itemInfo.MyHLS.FormatStepData.UseOldTemplate && itemInfo.MyDocStyle.ComponentList && itemInfo.IsCaution1) - { - Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - (float)itemInfo.MyDocStyle.Layout.LeftMargin; - return; - } - - // Calvert Alarms had a case where the Title With Text Below (type 42) did not match - // any of the template items, but needed the width from the template. The previous step (of - // same type) was in the template. Check for this case. The issue can be found in - // Unit 1 Alarms/1c06/Alarm E-48/'General Information' section. - if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && widOvrd == 0) - { - if (itemInfo.MyPrevious != null && itemInfo.MyPrevious.TemplateIndex > 1) widOvrd = GetWidthOrStartFromTemplate(itemInfo.MyPrevious, itemInfo.MyPrevious.ActiveFormat, true); - } - - // for IP2 backgrounds, set widths appropriately for template items: - if (itemInfo.IsStep && (itemInfo.ActiveSection != null && (itemInfo.ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd)) // C2018-003 fixed use of getting the active section - { - if (itemInfo.FormatStepData.Type.ToUpper() == "TITLEWITHTEXTBELOW") - { - Width = MyParent.Width; - return; - } - if (itemInfo.MyPrevious != null && itemInfo.MyPrevious.FormatStepData.Type == "TitleWithTextBelow") - { - Width = MyParent.MyParent.Width; - return; - } - if (widOvrd == 0 && itemInfo.MyParent.IsStep && - (itemInfo.MyParent.FormatStepData.Type.ToUpper() == "TITLEWITHTEXTBELOW" || - (((itemInfo.ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd) && - itemInfo.FormatStepData != null && MyParent.MyItemInfo.MyPrevious != null && MyParent.MyItemInfo.MyPrevious.FormatStepData.Type == "TitleWithTextBelow"))) - { - Width = MyParent.MyParent.Width + (MyParent.MyParent.MyTab != null ? MyParent.MyParent.MyTab.Width : 0); - Width -= (MyTab != null ? MyTab.Width : 0); - return; - } - } - - //widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride; - // Don't adjust the RNO width if in single column mode: - if (itemInfo.IsRNOPart && itemInfo.MyParent.IsHigh && itemInfo.ActiveSection != null && itemInfo.ActiveSection.ColumnMode != 0 && itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAlt != null) // C2018-003 fixed use of getting the active section - { - string[] splitRNOWidthAlt = itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAlt.Split(','); - float ovrd = (itemInfo.RNOLevel < splitRNOWidthAlt.Length) ? float.Parse(splitRNOWidthAlt[itemInfo.RNOLevel]) : 0; - if (ovrd > 0) - widOvrd = ovrd; // + 6; // Change bars on RNO column (signoff line) would not line up with 16-bit without this - NSP Alarms - } - if ((widOvrd ?? 0) != 0) - { - //F2023-112 Vogtle Units 3 & 4 Backgrounds. Don't use override width of paragraph when it's off of TitleWithTextRight - // We need to allow the code to calculate the width of that paragraph for this case (later in this function) - if (!(itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.Vogtle3and4BackgroundFormat && itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight")) - { - Width = (float)widOvrd; - // if there's a box, we may need to do an adjustment on the width, if the tab data was changed - // so don't return. - if (bxIndx == null) return; - } - } - float tabWidth = (myTab == null) ? 0 : myTab.Width; - if (itemInfo.IsHigh) - { - float CheckOffAdj = 0; - bool ChkOff = itemInfo.MyDocStyle.UseCheckOffs; - // C2019-040 use format flag to see if any of the steps in this section have a checkoff set - previously we check if the format file name starts with VCB (VCB no longer a customer) - if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert || itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckoffsWithoutHeader) - { - SectionInfo si = itemInfo.ActiveSection.GetSectionInfo(); - ChkOff = si.HasInitials; // this determines if any steps within the section have checkoffs. - } - bool FmtHasAdj = false; - if (ChkOff) - { - if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffAdjustment != null) - { - FmtHasAdj = true; - CheckOffAdj = -(float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffAdjustment; - } - // C2019-040 use format flag to not readjust the CheckOffAdj value - previously we check if the format file name starts with VCB (VCB no longer a customer) - if (!itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckoffsWithoutHeader) // Don't do the following if in a vcb format (part of fix F2016-039) - { - if (!HasCheckOffHeading(itemInfo, formatInfo) && CheckOffAdj < 0) - CheckOffAdj += (float)(9 * 7.2); // 9 is the size of the SIGNOFF adjustment - else if (!FmtHasAdj && HasCheckOffHeading(itemInfo, formatInfo)) - // For Robinson, tried using font's CharsToTwips but it made it too narrow, so used hardcoded 6: - CheckOffAdj = -((float)9 * 6); - } - } - float adjwidth = CheckOffAdj; - CheckOffWidth = -CheckOffAdj; - adjwidth = AdjustMetaWidth(itemInfo, formatInfo, adjwidth, FmtHasAdj); - Width = ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, maxRNO); - Width += _WidthAdjust; - Width += adjwidth; - - // if AlignHLSTabWithSect is set, we moved the starting x location of the HLS, and following steps - // to be under section header. Adjust the width accordingly, or the text may go out of the margin. - if (myTab == null && itemInfo.FormatStepData.AlignNullTabWSectHead && itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) - Width = Width + (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos - (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; - else if (myTab == null && itemInfo.FormatStepData.AlignNullTabWSectHead) - Width = Width + (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos; - else if (itemInfo.MyDocStyle.AlignHLSTabWithSect) - Width = Width - (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos; - - // B2022-002: Section text is printing into the INITIAL column (BNPP1new). If this flag is set adjust the width of the - // section text to that of the first hls (child) text and its tab. This is to prevent the very long section titles (that should have - // been steps) from extending into the INITIAL (checkoff) column. - if (formatInfo.PlantFormat.FormatData.SectData.AdjWidthForCheckOff && MyParent != null && MyParent.MyItemInfo.IsSection && ChkOff && CheckOffWidth != 0 && itemInfo.ItemID == itemInfo.FirstSibling.ItemID) - { - SectionInfo si = MyParent.MyItemInfo.GetSectionInfo(); - if (si.HasInitials) MyParent.Width = Width + ((myTab == null) ? 0 : myTab.Width); - } - } - else if (bxIndx != null) - { - Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; - if (bx == null) - { - // NOT SURE IF WE NEED TO TEST FOR THE NULLBOX FORMAT FLAG, MAYBE "bx == null" IS THE SAME THING - //if (formatInfo.MyStepSectionLayoutData.NullBox) - if (widOvrd != 0) - Width = (float)widOvrd - tabWidth; - else - Width = (float)formatInfo.MyStepSectionLayoutData.WidT - tabWidth; - } - else - { - float oldWidth = _WidthAdjustBox + (float)bx.TxtWidth - tabWidth; // add 1 to get it to wrap like 16Bit - // B2018-096 AEP 082.002CD Note Box overlapping Step Box - if (MyParent.MyItemInfo.FormatStepData != null && MyParent.MyItemInfo.FormatStepData.BoxIt) // B2018-100 not for parents that are sections // B2018-098 only adjust width if parent has Boxit turned on - { - Width = Math.Min(MyParent.Width + MyParent.XOffset - XOffset, oldWidth); - AdjustHeader = (Width - oldWidth) / 2; - } - else - Width = oldWidth; - } - } - else if ((itemInfo.IsCaution || itemInfo.IsNote) && !itemInfo.FormatStepData.UseOldTemplate) - { - float mycolT = (float)formatInfo.MyStepSectionLayoutData.ColT; - if (formatInfo.MyStepSectionLayoutData.Dev_Format) - Width = (float)formatInfo.MyStepSectionLayoutData.WidT + 1; - else if (itemInfo.IsInRNO) - { - // C2014-009: Condition/Response adjust xoffset & width - // B2020-117 add a check that there is only one Caution/Note/Warning - if (MyItemInfo.FormatStepData.CenterOneLineAdjust && MyItemInfo.FirstSibling == MyItemInfo.LastSibling) - { - int rnoOff = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO); - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - { - XOffset = MyTopRNO.MyTab.XOffset + 7.2f; - Width = MyParent.Width + (MyParent.XOffset - XOffset); - } - else - { - XOffset = rnoOff + MyHighLevelParagraph.XOffset; - Width = MyParent.Width; - } - } - // B2020-117 There are muliple Cautions, Notes, or Warnings in the Calvert Alarm Contition/Response - // Need to adjust the starting positon of the bulleted tab, text and width - else if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - { - XOffset = MyTopRNO.MyTab.XOffset + 7.2f; - this.MyTab.XOffset = XOffset; - XOffset += this.MyTab.Width; - Width = MyParent.Width + (MyParent.XOffset - XOffset); - } - else - Width = (MyParent.XOffset + MyParent.Width) - (XOffset + mycolT); - } - else - { - // B2016-269: if caution/note & not boxed, with tab adjust width based on xoffset of tab - // so text doesn't print out of right border. - // B2017-027: Added a check for column mode - we only want to do this if in single column mode - if (!MyItemInfo.MyParent.IsHigh && MyTab != null && MyTab.YOffset == YOffset && MyItemInfo.ActiveSection != null && MyItemInfo.ActiveSection.ColumnMode == 0) // C2018-003 fixed use of getting the active section - { - // B2017-xxx if this is a caution/note off of a substep in the supinfo column, need to look up for its supinfo part, not - // its HLS. - if (MyItemInfo.IsInSupInfo) - { - vlnParagraph supinfopart = this; - while (supinfopart.MyParent != null && !supinfopart.MyItemInfo.IsSupInfoPart) supinfopart = supinfopart.MyParent; - XOffset = supinfopart.XOffset; - MyTab.XOffset = XOffset - MyTab.Width - 10; - Width = supinfopart.Width; - } - else - Width = MyHighLevelParagraph.Width - MyTab.Width - (MyTab.XOffset - MyHighLevelParagraph.XOffset) - 6; - } - else - Width = (float)formatInfo.MyStepSectionLayoutData.WidT - 6 - mycolT; - } - XOffset += mycolT; // adjust caution/note text position - if (PartsLeft != null && PartsLeft.Count > 0)// adjust tab position - { - if (myTab != null && (itemInfo.IsNote || itemInfo.IsCaution)) - Width -= myTab.Width; - foreach (vlnPrintObject vpo in PartsLeft) - vpo.XOffset += mycolT; - } - } - else if (itemInfo.IsSection) - { - // B2023-074 The itemInfo we are processing is a section (number and title). Change maxRNO to zero to getting the width. - // The Width is used when printing the section number and title (when the check box on the properties page is checked) - // and is assumemed the section is a single column section (maxRNO = 0) and uses the format variable WidSTablePrint - // which holds the widths for then the section has one column, two column, or three column. - // For printing section numbers and titles like this, we always want to accomodate for lone section title text. - // So the initial width should always be set to the one column width value so that it can spane across the page. - Width = ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, 0); - float adjwidths = 0; - adjwidths = AdjustMetaWidth(itemInfo, formatInfo, adjwidths, false); - Width += (adjwidths + _WidthAdjust); - } - else if (MyParent == null) - { - // 72 points / inch - 7 inches (about width of page) - Width = 72 * 7; - } - else if (itemInfo.IsRNOPart && itemInfo.ActiveSection != null && itemInfo.ActiveSection.ColumnMode != 0 && itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAltAll != null) // C2018-003 fixed use of getting the active section - { - // This code was added for AEP. Other code that adjusted RNO widths was only adjusting the RNO widths - // off of the HLS. AEP needed adjusting for all RNOs. - float ovrd = (float)itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAltAll; - if (ovrd > 0) - Width = ovrd - tabWidth; - if (XOffset + Width > (float)itemInfo.MyDocStyle.Layout.PageWidth) - Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - XOffset - 5; - } - else if (itemInfo.IsRNOPart && !((ItemInfo)itemInfo.ActiveParent).IsHigh) - { - if (itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAdj != null && !((ItemInfo)itemInfo.ActiveParent).IsInRNO) - Width = MyParent.Width + float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAdj); - else - Width = MyParent.Width; - } - else if (itemInfo.IsRtfRaw) // this needs to be before the check for 'IsTablePart' - the rtfraw may be a table part, but the size is defined by raw rtf - { - System.Drawing.Size sz = RtfRawItem.GetRtfRawSize(MyItemInfo.MyContent.Text); - Height = sz.Height; - Width = sz.Width; - Rtf = MyItemInfo.MyContent.Text; - } - else if (itemInfo.IsTablePart) - { - Width = 72 * 7; // TODO: Need to determine the Width of the Table based upon the contents - } - else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight") // B2019-141: Background steps width too small - { - Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - XOffset; - } - else if (itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote) - { - if (itemInfo.ActiveFormat.MyStepSectionLayoutData.DevNoteOrCautionTabOffset != null) - Width = MyParent.MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign); - else - Width = MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign); - Width -= 72 * (itemInfo.FormatStepData.CautionOrNoteSubstepIndent == null ? 0 : (float)itemInfo.FormatStepData.CautionOrNoteSubstepIndent / (float)itemInfo.FormatStepData.Font.CPI); - } - else - { - float adjwidth = 0; - if (itemInfo.IsRNOPart && itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthSameAsHighParent && itemInfo.MyParent.IsHigh) - Width = adjwidth + MyParent.Width; - else if (itemInfo.MyTab != null && itemInfo.MyTab.Position != 0) - Width = adjwidth + MyParent.Width; - else if (MyParent.WidthNoLimit != 0) - Width = adjwidth + MyParent.WidthNoLimit - tabWidth + (myTab == null ? 0 : myTab.TabAlign); - else if ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd) - Width = adjwidth + MyParent.Width - (MyTab != null ? MyTab.Width : 0); - else - Width = adjwidth + MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign); - } - if (itemInfo.IsSequential && itemInfo.MyParent.IsHigh && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.Align1StLevSubWHLS) == E_DocStructStyle.Align1StLevSubWHLS)) - Width += 10; // FIX THIS!!! - } - - private float AdjustMetaWidth(ItemInfo itemInfo, FormatInfo formatInfo, float adjwidth, bool coadj) - { - SectData sd = formatInfo.PlantFormat.FormatData.SectData; - if (((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_SameXOffSubsections) == E_DocStructStyle.DSS_SameXOffSubsections)) - { - // don't adjust the width if there already was an adjustment for checkoffs - for VCB only (F2016-039) - VCB no longer a customer - // C2019-040 use format flag to adjust the width (was already don for checkoffs) - previously we check if the format file name starts with VCB (VCB no longer a customer) - if (!(itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckoffsWithoutHeader && coadj)) - adjwidth = MyTab != null ? -MyTab.Width : 0; - } - else if (sd.UseMetaSections) - { - if (sd.StepSectionData.StepSectionLayoutData.TieTabToLevel) - { - if (ShowSectionTitles - && !itemInfo.MyDocStyle.CancelSectTitle - && !(itemInfo.MyDocStyle.SpecialStepsFoldout && itemInfo.MyDocStyle.UseColSByLevel)) - { - int indxLevel = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel(); - //F2022-023 Used the SubSectAndHighSameLevel (BNPP1New format) flag to get the proper level if we have sub-sections so that we get the proper WidSAdjByLevel value - if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.SubSectAndHighSameLevel && !MyItemInfo.MyActiveSection.MyParent.IsProcedure) indxLevel++; - adjwidth += formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.MaxIndex].WidSAdjByLevel ?? 0; ; - float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.MaxIndex].ColSByLevel; - float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; - adjwidth -= seclvlindent; - if (itemInfo.IsStep) adjwidth -= AdjustForSectionLevelTab(); - if (itemInfo.IsSection && itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.WCNTraining) - adjwidth -= (float)((itemInfo.MyTab.CleanText.Trim().Length * 72) / itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.SectionHeader.Font.CPI); - } - } - else - { - if (formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.MaxIndex > 0) - adjwidth += (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[itemInfo.PrintLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.MaxIndex].ColSByLevel; - } - } - return adjwidth; - } - - // for Component Table, don't increment yoff unless last item in table that HAS data associated - // with it (there may be empty cells at end). - public bool UseTemplateKeepOnCurLine(ItemInfo itemInfo) - { - if (!itemInfo.IsStep || !itemInfo.MyDocStyle.ComponentList) return false; - if (!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert - && itemInfo.MyHLS.FormatStepData.UseOldTemplate) return true; - return false; - } - private bool UseTemplateWidthOrXOff(ItemInfo itemInfo) - { - if (!itemInfo.IsStep) return false; - if (itemInfo.MyHLS == null) return false; - if (itemInfo.MyHLS.FormatStepData.UseSmartTemplate || (itemInfo.MyDocStyle.ComponentList && itemInfo.MyHLS.FormatStepData.UseOldTemplate)) - { - ItemInfo useForTemplate = itemInfo.IsHigh ? itemInfo : itemInfo.MyParent; - int topIndx = useForTemplate.GetSmartTemplateTopLevelIndx(); - int tpIndx = -1; - if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - { - if (itemInfo.IsCaution1) return false; - else tpIndx = useForTemplate.GetSmartTemplateIndex(topIndx, itemInfo.MyContent.Text); - } - else - tpIndx = useForTemplate.GetSmartTemplateIndex(topIndx, (int)useForTemplate.MyContent.Type); - if (tpIndx > -1) return true; - } - return false; - } - private float GetWidthOrStartFromTemplate(ItemInfo itemInfo, FormatInfo formatInfo, bool bGetWidth) - { - int topIndx = itemInfo.GetSmartTemplateTopLevelIndx(); - int tmplIndx = 0; - if (itemInfo.MyDocStyle.ComponentList && !itemInfo.IsHigh) - { - // The following was added so that the Calvert Alarms sequentials under the CONDITION/RESPONSE would be - // printed as 2 column (data within the template definition set the columns to 2) - if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) - { - if (itemInfo.IsSequential && itemInfo.MyParent.TemplateIndex > 0) - { - if (bGetWidth && itemInfo.MyParent.ColumnMode == 1) // 2 columns - return (ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, itemInfo.ColumnMode) - MyTab.Width); - } - tmplIndx = itemInfo.TemplateIndex; - if (tmplIndx == -1) return 0; - } - else - { - // The ComponentTable format (FNP component table as one example), uses a template - // where the items in the template below the HLS are all paragraphs (the intermediate steps - // are TitleWithTextRight). Find the ordinal of in this list to get the index. Use the ordinal - // as an offset from the HLS's index into the template. - tmplIndx = itemInfo.MyParent.Ordinal + topIndx; - if (tmplIndx < 0 || tmplIndx > formatInfo.PlantFormat.FormatData.Templates.Count - 1) return 0; - } - } - else - { - tmplIndx = itemInfo.GetSmartTemplateIndex(topIndx, (int)itemInfo.MyContent.Type); - if (tmplIndx == -1) return 0; - } - // Calvert Alarms' template defines number of columns & their width. - if (bGetWidth && formatInfo.PlantFormat.FormatData.Templates[tmplIndx].width == 0) - { - int nocol = formatInfo.PlantFormat.FormatData.Templates[tmplIndx].nocolm == 0 ? 0 : formatInfo.PlantFormat.FormatData.Templates[tmplIndx].nocolm - 1; - return ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, nocol); - } - int ncol = bGetWidth ? formatInfo.PlantFormat.FormatData.Templates[tmplIndx].width : formatInfo.PlantFormat.FormatData.Templates[tmplIndx].start; - // now convert to the units for this format. The template width data is in number of columns. - return (ncol * itemInfo.FormatStepData.Font.CharsToTwips) + (bGetWidth ? 1 : 0); // + 1 is slight adjustment so column doesn't wrap - } - private float AdjustForSectionLevelTab() - { - string sectTab = MyItemInfo.ActiveSection.MyTab.CleanText.TrimEnd(); - if (sectTab.EndsWith(".0")) return 0; - string myTab = MyItemInfo.MyTab.CleanText; - // -1 below code, +1 for '.' and -2 for standard wid of tab - // standard wid of this tab is 2 (ex: '1.') - // so adjust width if longer than normal - return (float)(sectTab.Length - 1) * 72 / (float)MyItemInfo.FormatStepData.Font.CPI; - } - private bool HasCheckOffHeading(ItemInfo itemInfo, FormatInfo formatInfo) - { - if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList.MaxIndex != 0) - { - // does this section have a check off heading? - SectionConfig sc = (itemInfo.ActiveSection != null) ? itemInfo.MyActiveSection.MyConfig as SectionConfig : null; // C2018-003 fixed use of getting the active section - if (sc != null && sc.Section_CheckoffHeaderSelection > 0) return true; - } - if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderInPagelist) return true; - return false; - } - } - - /// - /// First order by stepLevel, then within a stepLevel, order by descending yLocation on page. - /// Want to find maximum y value that fits on page, i.e. put the most on page that can - /// fit which is defined by the largest yLocation - /// - public class StepLevelList : SortedDictionary> - { - public StepLevelList() - : base() - { - } - public void Add(int stepLevel, float yLocation, vlnParagraph para) - { - if (stepLevel == 0) return; - if (!this.ContainsKey(stepLevel)) - this.Add(stepLevel, new SortedDictionary()); - // using a negative for yLocation so that its in descending order: - // B2020-112: Make various adjustments to location if there are format flags used - // B2020-116: Only make the 112 change for Calvert - // B2020-151: check for SpecialCaseCalvertPagination flag instead of SpecialCase Calvert flag so only EOPs/AOPs are affected - float adjust = 0; - if (para.MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertPagination) - adjust = para.YVeryTop - para.YTop; - //if (para.MyItemInfo.MyParent.IsHigh && (para.ChildrenAbove == null || para.ChildrenAbove.Count == 0)) - //{ - // //Console.WriteLine("Adjust Add extra Line (flag) = '{0}'", para); - // adjust -= para.AdjustForXBlankW1stLevSub; - //} - //else if (para.MyParent.MyItemInfo.IsHigh && (para.MyParent.ChildrenAbove != null && para.MyParent.ChildrenAbove.Count > 0) - // && para.MyParent.ChildrenAbove[0] == para) - //{ - // //Console.WriteLine("Adjust Add extra Line (flag) = '{0}'", para); - // adjust -= para.MyParent.AdjustForXBlankW1stLevSub; - //} - //if (para.AdjustForMatchUpRNO != 0 && (para.ChildrenAbove == null || para.ChildrenAbove.Count == 0)) - // adjust -= para.AdjustForMatchUpRNO; - //else if (para.MyParent.AdjustForMatchUpRNO != 0 && (para.MyParent.ChildrenAbove != null && para.MyParent.ChildrenAbove.Count > 0) - // && para.MyParent.ChildrenAbove[0] == para) - // adjust -= para.MyParent.AdjustForMatchUpRNO; - - if (!this[stepLevel].ContainsKey(-(yLocation + adjust))) - this[stepLevel].Add(-(yLocation + adjust), para); - } - } - public class ParagraphLocations : List - { - public ParagraphLocations() - : base() - { - } - public void Add(vlnParagraph myParagraph, float yTopMost) - { - ParagraphLocation foundOverlap = FindOverlap(myParagraph); - if (foundOverlap == null) - { - this.Add(new ParagraphLocation(yTopMost, myParagraph)); - return; - } - ParagraphLocation doubleOverlap = FindOverlap(foundOverlap); - while (doubleOverlap != null) - { - doubleOverlap.Merge(foundOverlap); - this.Remove(foundOverlap); - foundOverlap = doubleOverlap; - doubleOverlap = FindOverlap(foundOverlap); - } - } - - private ParagraphLocation FindOverlap(vlnParagraph myParagraph) - { - foreach (ParagraphLocation paraLoc in this) - if (paraLoc.Overlap(myParagraph)) - return paraLoc; - return null; - } - private ParagraphLocation FindOverlap(ParagraphLocation myParaLoc) - { - foreach (ParagraphLocation paraLoc in this) - if (paraLoc != myParaLoc && paraLoc.Overlap(myParaLoc)) - return paraLoc; - return null; - } - internal StepLevelList BuildStepLevelList(bool KeepStepsOnPage) - { - StepLevelList myList = new StepLevelList(); - foreach (ParagraphLocation paraLoc in this) - { - int level = paraLoc.StepLevel; - if (KeepStepsOnPage) - { - // B2020-116: change from checking for type 20001 to looking for a non-high sequential since some - // step types were sequential but not 20001 - bool keepBullettedTogether = paraLoc.MyParagraph.MyItemInfo.IsSubStep; - if (!paraLoc.MyParagraph.MyItemInfo.IsHigh) - { - bool AlarmPagination = paraLoc.MyParagraph.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AlarmPagination; - if (paraLoc.MyParagraph.MyItemInfo.IsSequential) - { - if (DontBreakHere(paraLoc)) - //if (paraLoc.MyParagraph.MyItemInfo.MyPrevious == null) // First substep - level = 0; - else - level = 1; // AlarmPagination?3:1; // B2023-091: backout B2023-088 make it easier to break on a sequential for alarms - } - else if (AlarmPagination && paraLoc.MyParagraph.MyItemInfo.IsSubStep) - { - // make it harder to break on first caution or note & within a list if doing Alarm Pagination: - vlnParagraph myPara = paraLoc.MyParagraph; - if ((myPara.MyItemInfo.IsCaution || myPara.MyItemInfo.IsNote) && myPara.MyItemInfo.MyPrevious == null) level = 1; - else if (myPara.MyItemInfo.MyPrevious != null || myPara.MyItemInfo.NextItem != null) level = 2; - } - } - } - // For B2015-014, some migrated data for background documents had the TitleWithTextBelow with associated paragraphs - // as siblings rather than children. Pagination was sometimes putting the TitleWithTextBelow on one page and the - // paragraphs on next. The following code checks thse types, if in enhanced documents but not the Short Form Deviations. - if (paraLoc.MyParagraph.MyItemInfo.ActiveFormat != null - && ((paraLoc.MyParagraph.MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) - || (((paraLoc.MyParagraph.MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations) - && paraLoc.MyParagraph.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.EnhancedShortFormDev)) - { - if (!paraLoc.MyParagraph.MyItemInfo.IsTitle && paraLoc.MyParagraph.MyItemInfo.MyPrevious != null && paraLoc.MyParagraph.MyItemInfo.MyPrevious.FormatStepData.Type == "TitleWithTextBelow") level = 0; - } - paraLoc.MyParagraph.levelForPagination = level; - myList.Add(level, paraLoc.YTop, paraLoc.MyParagraph); - } - return myList; - } - private bool DontBreakHere(ParagraphLocation paraLoc) - { - if (paraLoc.MyParagraph.MyItemInfo.MyPrevious == null) // First substep - return true; - vlnParagraph myPara = paraLoc.MyParagraph; - while (!myPara.MyItemInfo.IsHigh) - { - if (myPara.MyItemInfo.IsCaution) return true; - if (myPara.MyItemInfo.IsNote) return true; - myPara = myPara.MyParent; - } - return false; - } - } - public class ParagraphLocation - { - public override string ToString() - { - return string.Format("{0} {1} - {2} - '{3}'", this.MyParagraph.MyItemInfo.ItemID, this.StepLevel, this.YTop, this.MyParagraph.MyItemInfo.ShortPath); - } - private float _YTop; - public float YTop - { - get { return _YTop; } - set { _YTop = value; } - } - private float _YBottom; - public float YBottom - { - get { return _YBottom; } - set { _YBottom = value; } - } - private int _StepLevel; - public int StepLevel - { - get { return _StepLevel; } - set { - //if (MyParagraph.MyItemInfo.InList(97960,84472,91010)) - // Console.WriteLine("stop"); - _StepLevel = value; } - } - private vlnParagraph _MyParagraph; - public vlnParagraph MyParagraph - { - get { return _MyParagraph; } - set { _MyParagraph = value; } - } - public ParagraphLocation(float yTopMost, vlnParagraph myParagraph) - { - MyParagraph = myParagraph; - YTop = myParagraph.YVeryTop - yTopMost; - YBottom = myParagraph.YBottom - yTopMost; - StepLevel = myParagraph.MyItemInfo.StepLevel; - // B2020-115 Set a very large figure's Step Level so that pagination will happen prior to the figure. - if (myParagraph.MyItemInfo.IsFigure && myParagraph.MyParent.Height + myParagraph.Height > vlnParagraph.hMax) - { - StepLevel = 1;// Set figure as a guaranteed break location - } - } - public bool Overlap(vlnParagraph otherParagraph) - { - if (Between(otherParagraph.YTop, YTop, YBottom)) return true; - if (Between(otherParagraph.YBottom, YTop, YBottom)) return true; - if (Between(YTop, otherParagraph.YVeryTop, otherParagraph.YBottom)) return true; - if (Between(YBottom, otherParagraph.YVeryTop, otherParagraph.YBottom)) return true; - return false; - } - public static bool Between(float x, float lower, float higher) - { return x > lower && x < higher; } - public bool Overlap(ParagraphLocation otherParagraphLocation) - { - if (Between(otherParagraphLocation.YTop, YTop, YBottom)) return true; // The top is within the other - if (Between(otherParagraphLocation.YBottom, YTop, YBottom)) return true; // The bottom is within the other - if (Between(YTop, otherParagraphLocation.YTop, otherParagraphLocation.YBottom)) return true; // the other top is within this one - if (Between(YBottom, otherParagraphLocation.YTop, otherParagraphLocation.YBottom)) return true;// I believe this is unnecessary - return false; - } - public void Merge(vlnParagraph otherParagraph) - { - if (StepLevel < otherParagraph.MyItemInfo.StepLevel) MyParagraph = otherParagraph; - YTop = Math.Min(YTop, otherParagraph.YVeryTop); - YBottom = Math.Max(YBottom, otherParagraph.YBottom); - StepLevel = Math.Max(StepLevel, otherParagraph.MyItemInfo.StepLevel); - } - public void Merge(ParagraphLocation otherParagraphLocation) - { - if (StepLevel < otherParagraphLocation.StepLevel) MyParagraph = otherParagraphLocation.MyParagraph; - YTop = Math.Min(YTop, otherParagraphLocation.YTop); - YBottom = Math.Max(YBottom, otherParagraphLocation.YBottom); - StepLevel = Math.Max(StepLevel, otherParagraphLocation.StepLevel); - } - } -} diff --git a/PROMS/Volian.Print.Library/vlnPrintObject.cs b/PROMS/Volian.Print.Library/vlnPrintObject.cs deleted file mode 100644 index b09edea2..00000000 --- a/PROMS/Volian.Print.Library/vlnPrintObject.cs +++ /dev/null @@ -1,569 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using iTextSharp.text.pdf; -using iTextSharp.text; -using Itenso.Rtf; -using Itenso.Rtf.Parser; -using Itenso.Rtf.Interpreter; -using Itenso.Rtf.Support; -using Volian.Controls.Library; -using VEPROMS.CSLA.Library; -using Volian.Base.Library; -using System.Text.RegularExpressions; - -namespace Volian.Print.Library -{ - public abstract partial class vlnPrintObject - { - // Used for debugging: - private static int _UniqueDebugId = 0; - public static int UniqueDebugId - { - get { return _UniqueDebugId++; } - set { _UniqueDebugId = value; } - } - private int _DebugId = UniqueDebugId; - public int DebugId - { - 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 _WidthAdjustBox = 6; - private static float _SixLinesPerInch = 12; // twips - public static float SixLinesPerInch - { - get { return vlnPrintObject._SixLinesPerInch; } - set { vlnPrintObject._SixLinesPerInch = value; } - } - protected static float _SevenLinesPerInch = 10.1F;//72F / 7F; - - protected float _XOffset; - public float XOffset - { - get { return _XOffset; } - set {_XOffset = value; } - } - protected float _YOffset; - public float YOffset - { - get { return _YOffset; } - set - { - _YOffset = value; - } - } - - protected vlnParagraph _MyParent; - public vlnParagraph MyParent - { - get { return _MyParent; } - set - { - _MyParent = value; - if (_MyParent != null) - { - - } - } - } - 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 - public virtual string Rtf - { - get { return _Rtf; } - set { _Rtf = value; } - } - 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(); - // B2018-034 Attributes were being lost when the IsCompressed flag was true. - // The following variable was changed to a public so that it could be used - // for setting PDF Links without creating IParagraph when IsCompressed was true. - public iTextSharp.text.Paragraph _IParagraph; - public iTextSharp.text.Paragraph IParagraph - { - get - { - // 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. - //if (_IParagraph == null || IsCompressed) - if (Rtf != null && (_IParagraph == null || IsCompressed)) - { - int profileDepth = ProfileTimer.Push(">>>> VlnPrintObject.IParagraph"); - string myRtf = Rtf; - // Add a printable character (hard space) between multiple newlines - // this asssures that the blank line will be printed - if (myRtf.Contains(@"\line \line ")) - myRtf= myRtf.Replace(@"\line \line ", @"\line \u160? \line "); - if (myRtf.Contains(@"\pard\line ")) // Bug fix: B2016-145 for VC.Summer End Message - myRtf = myRtf.Replace(@"\pard\line ", @"\par "); - // B2018-034 Attributes were being lost when the IsCompressed flag was true. - // CopyAttributesToNewIParagraph retains any attribute which have been set - Paragraph oldParagraph = _IParagraph; - _IParagraph = RtfToParagraph(myRtf, HasIndent, MyPageHelper.MyPromsPrinter.SaveLinks); - // B2018-034 Attributes were being lost when the IsCompressed flag was true. - // CopyAttributesToNewIParagraph retains any attribute which have been set - CopyAttributesToNewIParagraph(oldParagraph, _IParagraph); - ProfileTimer.Pop(profileDepth); - } - return _IParagraph; - } - set { _IParagraph = value; } - } - // B2018-034 Attributes were being lost when the IsCompressed flag was true. - // CopyAttributesToNewIParagraph retains any attribute which have been set - private void CopyAttributesToNewIParagraph(Paragraph oldParagraph, Paragraph newParagraph) - { - if (oldParagraph == null) return; - if (oldParagraph.Chunks.Count != newParagraph.Chunks.Count) return; - for (int i = 0; i < oldParagraph.Chunks.Count; i++) - { - System.Collections.Hashtable oldTable = (oldParagraph.Chunks[i] as Chunk).Attributes; - System.Collections.Hashtable newTable = (newParagraph.Chunks[i] as Chunk).Attributes; - if (oldTable.Count == newTable.Count) return; - foreach (System.Collections.DictionaryEntry de in oldTable) - if (!newTable.ContainsKey(de.Key)) - newTable.Add(de.Key, de.Value); - } - } - private float _Width; - public float Width - { - get { return _Width; } - set - { - // Debug B2018-146 - Check to see what is setting the width - //if (this is vlnParagraph && (this as vlnParagraph).MyItemInfo.InList(1986333, 1986334, 1986335)) - // Console.WriteLine("here"); - //if (this is vlnParagraph) - //if ((this as vlnParagraph).MyItemInfo.InList(1986333)) - //Console.WriteLine("{0} Width {1} Right {2} Right Margin {3}", (this as vlnParagraph).MyItemInfo.ItemID, value, - //value + this.XOffset, (this as vlnParagraph).MyItemInfo.MyDocStyle.Layout.PageWidth - - //(this as vlnParagraph).MyItemInfo.MyDocStyle.Layout.LeftMargin); - _Width = value; - } - } - protected float _Height; - public virtual float Height - { - get - { - int profileDepth = ProfileTimer.Push(">>>> vlnPrintObject.Height"); - if (_Height == 0) - _Height = GetParagraphHeight(MyContentByte, IParagraph, string.Empty, Width); - ProfileTimer.Pop(profileDepth); - return _Height; - } - set { _Height = value; } - } - public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width) - { - 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) - { - ColumnText myColumnText = new ColumnText(cb); - float pgHeight = cb.PdfDocument.PageSize.Height; // C2020-002 paper size is now set in the format files - myColumnText.SetSimpleColumn(0, pgHeight, width, 0); // Bottom margin - if (suffix != string.Empty) - { - Chunk chk = iParagraph.Chunks[0] as Chunk; - iParagraph.Add(new Chunk(suffix, chk.Font)); - myColumnText.AddText(iParagraph); - } - else - { - 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. - if (ColumnText.HasMoreText(status) && throwException) - { - // B2016-142: If the paragraph won't fit on page and indenting is on, remove - // indenting & try again: - if (iParagraph.FirstLineIndent < 0) - { - iParagraph.FirstLineIndent = 0; - iParagraph.IndentationLeft = 0; - return GetHeight(cb, iParagraph, suffix, width, throwException); - } - //throw (new Exception("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 - } - public float GetTableWidth(PdfContentByte cb, Paragraph iParagraph, float? maxWidth) - { - int iWidth = (int)(maxWidth ?? 72 * 8.5F); - float h = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth); - int iWidthMax = iWidth; // maximum width in Characters - int iDelta = iWidth / 2; - iWidth = iWidth / 2; - while (iDelta > 0) - { - float h2 = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth,false); - iDelta = iDelta / 2; - if (h2 == h) iWidthMax = iWidth; - iWidth += (h2>h ? 1: -1) * iDelta; - } - return (float) iWidthMax; - } - private PdfContentByte _MyContentByte; - public PdfContentByte MyContentByte - { - get { return _MyContentByte; } - set { _MyContentByte = value; } - } - private VlnSvgPageHelper _MyPageHelper; - public VlnSvgPageHelper MyPageHelper - { - get - { - if(_MyPageHelper == null) - _MyPageHelper = MyContentByte.PdfWriter.PageEvent as VlnSvgPageHelper; - return _MyPageHelper; - } - set { _MyPageHelper = value; } - } - public vlnPrintObject() - { - } - /// - /// No conversion necessary: twips -> twips - /// - /// - /// - public static int ToInt(int value) - { - return value; - } - /// - /// No conversion necessary: int? twips -> int twips - /// - /// - /// - public static int ToInt(int? value) - { - return ToInt((int)value); - } - /// - /// No conversion necessary: string twips -> int twips - /// - /// - /// - public static int ToInt(string value) - { - return ToInt((int)Convert.ToSingle(value)); - } - /// - /// No conversion necessary: value from a list in a string, twips -> int twips - /// - /// - /// - public static int ToInt(string value, int i) - { - string s = (value.Contains(",")) ? value.Split(",".ToCharArray())[i] : value; - return ToInt(s); - } - public static string GetRtf(string text, VE_Font vFont) - { - StringBuilder rtfSB = new StringBuilder(); - //DisplayText vlntxt = new DisplayText(text.TrimStart(" ".ToCharArray()), 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(vlntxt.StartText); - rtfSB.Append("}"); - return rtfSB.ToString(); - } - public static string AddFontTable(VE_Font vfont) - { - System.Drawing.Font font = vfont.WindowsFont; - StringBuilder rtfSB = new StringBuilder(); - StringBuilder sbbeg = new StringBuilder(); - StringBuilder sbend = new StringBuilder(); - if ((vfont.Style & E_Style.Bold) > 0) - { - sbbeg.Append(@"\b"); - sbend.Append(@"\b0"); - } - if ((vfont.Style & E_Style.Underline) > 0) - { - sbbeg.Append(@"\ul"); - sbend.Insert(0, @"\ulnone"); - } - if ((vfont.Style & E_Style.Italics) > 0) - { - sbbeg.Append(@"\i"); - sbend.Insert(0, @"\i0"); - } - rtfSB.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 " + font.FontFamily.Name + @";}"); //}\f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}}"; - if (!FontIsFixed(font)) - rtfSB.Append(@"{\f1\fnil\fcharset0 " + Volian.Base.Library.vlnFont.ProportionalSymbolFont + @";}}{\colortbl ;\red255\green0\blue0;}"); // C2017-036 get best available proportional font for symbols - else - rtfSB.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}{\colortbl ;\red255\green0\blue0;}"); - rtfSB.Append("\r\n"); - // use styles to construct rtf commands to insert into next line (where \b, etc is) - rtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}"; - return rtfSB.ToString(); - } - public static string AddFontTable(System.Drawing.Font font) - { - StringBuilder rtfSB = new StringBuilder(); - StringBuilder sbbeg = new StringBuilder(); - StringBuilder sbend = new StringBuilder(); - if (font.Bold) - { - sbbeg.Append(@"\b"); - sbend.Append(@"\b0"); - } - if (font.Underline) - { - sbbeg.Append(@"\ul"); - sbend.Insert(0, @"\ulnone"); - } - if (font.Italic) - { - sbbeg.Append(@"\i"); - sbend.Insert(0, @"\i0"); - } - rtfSB.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 " + font.FontFamily.Name + @";}"); //}\f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}}"; - if (!FontIsFixed(font)) - rtfSB.Append(@"{\f1\fnil\fcharset0 " + Volian.Base.Library.vlnFont.ProportionalSymbolFont + @";}}{\colortbl ;\red255\green0\blue0;}"); // C2017-036 get best available proportional font for symbols - else - rtfSB.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}{\colortbl ;\red255\green0\blue0;}"); - rtfSB.Append("\r\n"); - // use styles to construct rtf commands to insert into next line (where \b, etc is) - rtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}"; - return rtfSB.ToString(); - } - private static bool FontIsFixed(System.Drawing.Font font) - { - iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); - float fW = iFont.BaseFont.GetWidthPointKerned("W", 12); - float fE = iFont.BaseFont.GetWidthPointKerned("!", 12); - return fW == fE; - } - public static iTextSharp.text.Paragraph RtfToParagraph(string rtf) - { - return RtfToParagraph(rtf, false, false); - } - public static iTextSharp.text.Paragraph RtfToParagraph(string rtf, bool hasIndent, bool doPdfLinks) - { - if (hasIndent) - { - hasIndent = rtf.Contains("\x05"); - if (hasIndent && rtf.Contains(@"\par \par")) rtf = rtf.Replace(@"\par \par", @"\par \u160? \par"); - if (hasIndent && rtf.Contains(@"\par\par")) rtf = rtf.Replace(@"\par\par", @"\par \u160? \par"); - } - - IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf); - Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc); - rtf2IText.DoPdfLinks = doPdfLinks; - rtf2IText.HasIndent = hasIndent; - iTextSharp.text.Paragraph para = rtf2IText.Convert(); - para.SetLeading(_SixLinesPerInch, 0); - 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 - // to print the indent. Replace the indent 'token' with a non-used symbol, this will - // create a chunk with that symbol. Then loop through all of the chunks until we find - // this symbol, adding up the widths to that point. This width is the value that - // needs to be used to set the indent. - // Notes: - // A hard return will reset the chkW (indent width) back to zero. - // We jump out of the processing loop after the first indent token is found and ignor any other ones - float chkW = CalculateHangingIndent(rtf); - para.IndentationLeft = chkW; - para.FirstLineIndent = -chkW; - } - Match match = Regex.Match(rtf, @"\\fi([-0-9]*) ?\\li([0-9]*)"); - if (match.Success) - { - float fi = float.Parse(FixNumber(match.Groups[1].Value)) / 20; - float li = float.Parse(FixNumber(match.Groups[2].Value)) / 20; - // if there is a hanging indent, the iTextSharp paragraph properties must be set - // to print the indent. - para.IndentationLeft = li; - para.FirstLineIndent = fi; - } - // 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 - { - Chunk chk = obj as Chunk; - if (chk != null && (chk.Attributes==null || !chk.Attributes.ContainsKey("NoSplit"))) - { - if (chk.Attributes == null) chk.Attributes = new System.Collections.Hashtable(); - chk.SetSplitCharacter(mySplitter); - chk.Attributes.Add("NoSplit", false); - } - } - return para; - } - private static string FixNumber(string num) - { - if (num == "") return ("0"); - return num; - } - public static float CalculateHangingIndent(string rtf) - { - float chkW=0; - IRtfDocument rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace("\x05", @"\f1 \u9999? \f0 ")); - Rtf2iTextSharp rtf2IText2 = new Rtf2iTextSharp(rtfDoc2); - iTextSharp.text.Paragraph para2 = rtf2IText2.Convert(); - foreach (Chunk chk in para2.Chunks) - { - if (chk.Content[0] == 9999) break; - if (chk.Content.Contains("\u270f")) - { - int i = chk.Content.IndexOf('\u270F'); - int n = chk.Content.Length; - chkW += chk.GetWidthPoint() * i / (n - i); - break; - } - if (chk.Content.Contains("\n")) chkW = 0; //hard return - reset chkW (indent start) - chkW += chk.GetWidthPoint(); - } - return chkW; - } - public abstract float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin); - protected float CalculateYOffset(float yPageStart, float yTopMargin) - { - float yLocation = yPageStart - YOffset; - if (MyPageHelper.YMultiplier != 1) - { - yLocation = -1 + yTopMargin - (yTopMargin - yLocation) * MyPageHelper.YMultiplier; - if (Rtf != null) - IParagraph.Leading = _SevenLinesPerInch; - } - return yLocation; - } - protected float CalculateYLocation(float yLocation, float yTopMargin) - { - if (MyPageHelper.YMultiplier != 1) - yLocation = -1 + yTopMargin - (yTopMargin - yLocation) * MyPageHelper.YMultiplier; - return yLocation; - } - public void DebugPdf(PdfContentByte cb, float left, float top) - { - VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer; - if (debugLayer == null) return; - cb.SaveState(); - cb.BeginLayer(debugLayer); - ColumnText ct = new ColumnText(cb); - ct.SetSimpleColumn(left, top, left+50, top - 50); - iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 2); - Chunk chk = new Chunk(DebugId.ToString(), font); - Phrase ph = new Phrase(chk); - ct.AddElement(ph); - cb.SetColorFill(new iTextSharp.text.Color(PrintOverride.OverrideDebugColor(System.Drawing.Color.Gray))); - ct.Go(); - cb.EndLayer(); - cb.RestoreState(); - } - public virtual float YBottom - { get { return YOffset + Height;} } - } - public partial class vlnPrintObjects : List - { - public float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) - { - foreach (vlnPrintObject part in this) - { - // F2018-013 Replace Symbols as necesasary on tabs (consistent bullets) - if(part.Rtf != null) part.Rtf = vlnParagraph.FixRTFToPrint(part.MyParent.MyItemInfo, part.Rtf); - yPageStart = part.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); - } - return yPageStart; - } - } - - public enum PartLocation : int - { - None = 0, // Non-printable - Below = 1, // RNO Separator - Above = 2, // Tab Headers, Separator? - Right = 3, // Change Bars - Left = 4, // Tabs, Checkoffs? (maybe part of tab) - Container = 5 // Box - }; - public enum ChildLocation : int - { - None = 0, - Below = 1, - Above = 2, - Right = 3, // RNO - Left = 4 - } - -} diff --git a/PROMS/Volian.Print.Library/vlnRNOSeparator.cs b/PROMS/Volian.Print.Library/vlnRNOSeparator.cs deleted file mode 100644 index db4ff3c9..00000000 --- a/PROMS/Volian.Print.Library/vlnRNOSeparator.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using iTextSharp.text.pdf; -using iTextSharp.text; -using VEPROMS.CSLA.Library; - -namespace Volian.Print.Library -{ - public partial class vlnRNOSeparator : vlnPrintObject - { - private VE_Font _MyFont; - public VE_Font MyFont - { - 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 separator is a control-A use RNOSepLine*/ - 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) - ExtendChangeBar = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeBarToRNOSep ? extendChangeBar : false; - YOffset = yoffset; - XOffset = xoffset; - XLength = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.RNOSepLineLength??0; - _MyParent = parent; - MyFont = formatInfo.PlantFormat.FormatData.Font; - if (XLength == 0) - { - if (sepStr != null) - Rtf = GetRtf(sepStr, formatInfo.PlantFormat.FormatData.Font); - else - Rtf = "--------------------------"; //TODO - What should this be: is this Ctrl-A? - Width = sepStr.Length * MyFont.CharsToTwips + _WidthAdjust; - } - else - { - Width = XLength; - Height = SixLinesPerInch; - } - } - public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) - { - float yLocation = CalculateYOffset(yPageStart, yTopMargin); - if (XLength != 0) - { - cb.SaveState(); - VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; - PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; - if (textLayer != null) cb.BeginLayer(textLayer); - iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideChangeBarColor(System.Drawing.Color.Black)); - cb.SetColorStroke(lineColor); - cb.SetLineWidth(.5F); - // C2018-004 create meta file for baseline compares - Volian.Base.Library.BaselineMetaFile.WriteLine("RNOSepLn X1={0} Y1={1} X2={2} Y2={3}", XOffset, yLocation - 7, XOffset + XLength, yLocation - 7); - cb.MoveTo(XOffset/* + xAdj */, yLocation - 7); - cb.LineTo(XOffset + XLength, yLocation-7); - cb.Stroke(); - if (textLayer != null) cb.EndLayer(); - cb.RestoreState(); - } - else - Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "", yBottomMargin); - MyPageHelper.BottomContent = yLocation-SixLinesPerInch; - return yPageStart; - } - } -} diff --git a/PROMS/Volian.Print.Library/vlnTab.cs b/PROMS/Volian.Print.Library/vlnTab.cs deleted file mode 100644 index 40fce490..00000000 --- a/PROMS/Volian.Print.Library/vlnTab.cs +++ /dev/null @@ -1,367 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using iTextSharp.text.pdf; -using iTextSharp.text; -using VEPROMS.CSLA.Library; - -namespace Volian.Print.Library -{ - public partial class vlnTab : vlnText - { - /// - /// Used to Align Tabs for numeric tabs that can go to 2 digits - /// - private float? _TabAlign; - public float TabAlign // Offset to Last printable character - { - get - { - if (_TabAlign == null) - { - _TabAlign = 0; - if (Text != null && (!MyParent.MyItemInfo.IsStep || !MyParent.MyItemInfo.FormatStepData.TabData.NoTabAlign)) - { - while (_TabAlign < Text.Length && Text[(int)_TabAlign] == ' ') - _TabAlign++; - if (_TabAlign < Text.Length) - { - if ("0123456789".Contains(Text[(int)_TabAlign].ToString())) - { - while (_TabAlign < Text.Length && "0123456789".Contains(Text[(int)_TabAlign].ToString())) - _TabAlign++; - _TabAlign--; - } - } - else - _TabAlign = 0; - } - } - return (float)_TabAlign * MyFont.CharsToTwips; - } - } - private float? _TabOffset; - public float TabOffset // Offset to first printable character - { - get - { - if (_TabOffset == null) - { - _TabOffset = 0; - if (Text != null) - { - while (_TabOffset= Text.Length) _TabOffset = 0; - 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 - // add symbol characters as needed - // "\u25CF" - solid bullet - // \u0394 - delta - - private System.Drawing.FontStyle GetSysFontStyle(VE_Font f) - { - 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) - { - // 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 - // 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 symbFont = VE_Font.GetWinSysFont(symblFontName, (float)vefont.Size); - iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); - iTextSharp.text.Font iSymblFont = Volian.Svg.Library.VolianPdf.GetFont(symbFont); - float w = 0; - foreach (char c in txt) - { - int idx = symblsStr.IndexOf(c); - if (idx >= 0) // symbol character - use symbol font to find its width - w += iSymblFont.BaseFont.GetWidthPointKerned(symblsStr[idx].ToString(), (float)vefont.Size); - else - w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)vefont.Size); - } - //float w = iFont.BaseFont.GetWidthPointKerned(Text.Replace("\u25CF","@"), (float)vefont.Size); - return w; - } - bool _ScriptCaution = false; - - public bool ScriptCaution - { - get { return _ScriptCaution; } - set { _ScriptCaution = value; } - } - bool _SeparateBullet = false; - - public bool SeparateBullet - { - 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) - { - SymbolFontName = symblFontName; - bool alignAsIfBulleted = false; - ScriptCaution = (origTab.Contains("Caution") && vFont.Family == "VolianScript"); - MyContentByte = cb; - MyParent = myparent; - YOffset = yoffset; - Text = cleanTab; - MyFont = vFont; - // C2018-024 I in Arial font changed to I in TimesNewRoman - if (myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ChangeFontUpperCaseIinArial && cleanTab.StartsWith("I.")) - vFont = new VE_Font("Times New Roman", (int)vFont.Size, (E_Style)vFont.Style, (float)vFont.CPI); - // BGE has a format flag to increase size of font, if top level: - if (doSectTab && myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumber.Level0Big && myparent.MyItemInfo.MyParent.IsProcedure) - vFont = new VE_Font(vFont.Family, 14, (E_Style)vFont.Style | E_Style.Bold, 8); - float CCCs = GetTextWidth(MyFont, "CCCCCCCCCC", symblFontName); - float IIIs = GetTextWidth(MyFont, "iiiiiiiiii", symblFontName); - string origTab1 = origTab; - if (ScriptCaution) - { - Text = origTab.Replace("Caution ", "\uF043\uF061\uF069\uF06E\uF06F\uF074\uF075\uF020\uF020"); - Width = 90; - } - 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; - else if (CCCs != IIIs) - { - float tPtPerChar = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar ?? 6; - 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 - Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName); //MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length); - - // 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. - // To do this we set the TabData.Bullet.Separate to true (currently - 4/26/2013 - only NSP uses this). - // Because of the different font sizes, when the Caution/Note did have have a bullet, the positioning - // was off by the lenght of IdentB (the bullet string), thus the "alignAsIfBulleted" bool - if ((myparent.MyItemInfo.FormatStepData != null) && myparent.MyItemInfo.FormatStepData.TabData.Bullet.Separate) - if (myparent.MyItemInfo.MyPrevious != null || myparent.MyItemInfo.NextItem != null) - SeparateBullet = true; - else - alignAsIfBulleted = true; - - if (origTab.Contains(@"{!")) - { - int mindx = origTab.IndexOf(@"{!"); - int meindx = origTab.IndexOf(@"}", mindx); - string macro = origTab.Substring(mindx, meindx - mindx + 1); - // Width for placement of macro should be position in the string where the macro was located. - float lwidth = MyFont.CharsToTwips * (origTab.Length - meindx - 1); - MyMacro = new vlnMacro(xoffset - lwidth, yoffset, macro.Substring(2, macro.Length - 3)); - xoffset += myparent.MyItemInfo.FormatStepData.TabData.MacroTabAdjust ?? 0; - origTab = origTab.Replace(macro, ""); - cleanTab = origTab; - if (CCCs != IIIs) - { - float? tPtPerChar1 = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar; - if (tPtPerChar1 != null) - Width = (float)tPtPerChar1 * origTab.Length; - else if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0) - Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth; - else - { - origTab = origTab + " "; - origTab = origTab.TrimStart(" ".ToCharArray()); - if (mindx > 2) // ouch! - Width = 6f * (origTab.Length - 1); // FPL (macro is after {numeric}) FPL is good with genmac output! - else - Width = 3 + (6f * origTab.Length); // NSP (macro is before {numeric}) - } - } - else - Width = GetTextWidth(MyFont, (cleanTab != null ? cleanTab : origTab), symblFontName);//MyFont.CharsToTwips * (cleanTab != null ? cleanTab.Length : origTab.Length); - } - else - { - origTab = origTab1; - } - - // if this tab was underlined, we may need to add partial underlining back in, if it was - // removed when the bullet was added. This handles the case where the bullet was appended - // to the tab, for example "NOTE: o". - if (removedUnderline) - { - int sep = origTab.IndexOfAny(". ".ToCharArray()); - string prefix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b\ul " : @"\ul "; - 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); - } - - UnderlineTerminateList utl = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.UnderlineTerminateList; - - // if this tab is underlined, the underlining should not underline the ':'. Check for "NOTE:" - // or "CAUTION:", i.e. only underline up to ':' - if (myparent.MyItemInfo.IsStep && ((myparent.MyItemInfo.FormatStepData.AlwaysTab || myparent.MyItemInfo.MyPrevious == null) - && ((vFont.Style & E_Style.Underline) > 0) && (origTab.ToUpper().Contains("NOTE:") || - origTab.ToUpper().Contains("CAUTION:")))) - { - FontStyle style = FontStyle.Regular; - if ((vFont.Style & E_Style.Bold) > 0) style |= FontStyle.Bold; - if ((vFont.Style & E_Style.Italics) > 0) style |= FontStyle.Italic; - // 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 - // 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); - int indxC = origTab.IndexOf(":"); - origTab = @"\ul " + origTab.Substring(0, indxC) + @"\ulnone" + origTab.Substring(indxC); - } - else if (utl != null && utl.Count > 0 && ((vFont.Style & E_Style.Underline) > 0)) - { - foreach (UnderlineTerminate ut in utl) - { - if (origTab.Contains(ut.Text)) - { - FontStyle style = FontStyle.Regular; - if ((vFont.Style & E_Style.Bold) > 0) style |= FontStyle.Bold; - if ((vFont.Style & E_Style.Italics) > 0) style |= FontStyle.Italic; - // 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 - // 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); - int indxC = origTab.IndexOf(ut.Text); - string prefix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b\ul " : @"\ul "; - string suffix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b0\ulnone " : @"\ulnone "; - //origTab = @"\ul " + origTab.Substring(0, indxC) + @"\ulnone " + origTab.Substring(indxC); - origTab = prefix + origTab.Substring(0, indxC) + suffix + origTab.Substring(indxC); - break; - } - } - } - Rtf = GetRtf(origTab, vFont); - Rtf = Rtf.Replace("\u0394", @"\f1\u916?\f0 "); // delta 0x0394 - Rtf = Rtf.Replace("\u03BF", @"\f1\u959?\f0 "); // F2025-015 lowercase omicron check with hex value replace with RTF string - if (ScriptCaution) - { - Rtf = GetRtf("\u25CFCaution ", vFont); - Rtf = Rtf.Replace("\u25CF", @"\f1\fs20 \u9679?\f0\par\f0\fs64 "); // bullet 25CF // jsj- force bullet size (is different than tab text) - if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.MyPrevious != null) - Rtf = Rtf.Replace("Caution ", @"\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?"); - else - { - if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.NextItem == null) - Rtf = Rtf.Replace(@"\u9679?", ""); - Rtf = Rtf.Replace("Caution ", @"\u61507?\u61537?\u61557?\u61556?\u61545?\u61551?\u61550?\u61472?\u61472?"); - } - } - else - { - if (SeparateBullet) - Rtf = Rtf.Replace("\u25CF", ""); - else - Rtf = Rtf.Replace("\u25CF", @"\f1\u9679?\f0 "); // bullet 25CF // jsj- add space after \f0 - //Rtf = Rtf.Replace("\u25CF", @"\f1\fs18\b0\i0 \u9679?\f0 "); // bullet 25CF // jsj- add space after \f0 - if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.MyPrevious != null && - (!myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.OnlyBulletSameCautionNoteType || - (myparent.MyItemInfo.MyPrevious.MyContent.Type == myparent.MyItemInfo.MyContent.Type))) - { - //if (scriptCaution) - // Rtf = Rtf.Replace("CAUTION ", @"\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?"); - Rtf = Rtf.Replace("Caution:", " "); - Rtf = Rtf.Replace("Note:", " "); - Rtf = Rtf.Replace("CAUTION:", " "); - Rtf = Rtf.Replace("NOTE:", " "); - Rtf = Rtf.Replace("Caution", " "); - Rtf = Rtf.Replace("Note", " "); - Rtf = Rtf.Replace("CAUTION", " "); - 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 - // it's location more like a 'tab'. - if (doSectTab) - { - XOffset = xoffset; - // the width was just a little small, so it was wrapping - but only if there were no spaces at end - // so use this condition to do minimal impact (WCN1 format, for section tabs with three places, i.e. 6.1.2 - if (!cleanTab.EndsWith(" ")) Width += .1f; - } - else - { - // if using a proportional font and the tab font/size is different than the text font/size - if (CCCs != IIIs && - (MyFont.Family != myparent.MyItemInfo.FormatStepData.Font.Family || - MyFont.Size != myparent.MyItemInfo.FormatStepData.Font.Size)) - { - // This is needed for Prairie Island (NSP) Caution/Note tabs to consistantly position - // them at the same horizontal (column) position on the page - string txt = Text; - if (alignAsIfBulleted) - txt += myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB; - // 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 - // 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); - iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); - float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)MyFont.Size); - Width = w; - } - XOffset = xoffset - Width; - } - - } - public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) - { - // Don't print a Tab if the text contains a Grid - if (MyParent.MyItemInfo.MyContent.MyGrid != null) return yPageStart; - if (MyParent.MyItemInfo.FormatStepData != null && MyParent.MyItemInfo.FormatStepData.StepPrintData != null) - XOffset += (float)(MyParent.MyItemInfo.FormatStepData.StepPrintData.PosAdjust ?? 0); - float yLocation = CalculateYOffset(yPageStart, yTopMargin); - Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "", yBottomMargin); - return yPageStart; - } - } -} diff --git a/PROMS/Volian.Print.Library/vlnText.cs b/PROMS/Volian.Print.Library/vlnText.cs deleted file mode 100644 index 5693d0e1..00000000 --- a/PROMS/Volian.Print.Library/vlnText.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using iTextSharp.text.pdf; -using iTextSharp.text; -using VEPROMS.CSLA.Library; - -namespace Volian.Print.Library -{ - public partial class vlnText : vlnPrintObject - { - //public float Width - //{ - // get { return _CharsToTwips * Text.Length; } - //} - private string _Text; - public string Text - { - get { return _Text; } - set { _Text = value; } - } - private VE_Font _MyFont; - public VE_Font MyFont - { - get { return _MyFont; } - set { _MyFont = value; } - } - public vlnText(PdfContentByte cb, vlnParagraph myparent, string origText, string cleanText, float xoffset, float yoffset, VE_Font vFont) - { - MyContentByte = cb; - MyParent = myparent; - YOffset = yoffset; - Text = cleanText; - Rtf = GetRtf(origText, vFont); - XOffset = xoffset; - MyFont = vFont; - Width = MyFont.CharsToTwips * (Text.Length + 5); - } - public vlnText() - { - } - public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) - { - // The END message was not printing for NSP. The yLocation was getting set to a negative number, thus printing off the page. - // Found that the YOffset, cacluated when the bottom message was created, is really the actual location, at least in this case. - float yLocation = CalculateYOffset(yPageStart, yTopMargin); - if (yLocation < 0) yLocation = YOffset; - Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "", yBottomMargin); - return yPageStart; - } - } -}