C2021-019: Override Watermark Text and Color

This commit is contained in:
2021-07-06 15:16:40 +00:00
parent aa9c2574bf
commit a3f89c5fa0
10 changed files with 135 additions and 12 deletions

View File

@@ -60,6 +60,7 @@ namespace VEPROMS
this.muLocID = new DevComponents.Editors.ComboItem();
this.lblWatermarkS = new DevComponents.DotNetBar.LabelX();
this.cbxWaterMark = new DevComponents.DotNetBar.Controls.ComboBoxEx();
this.lblWaterMarkOvrd = new DevComponents.DotNetBar.LabelX();
this.btnCreatePDF = new DevComponents.DotNetBar.ButtonX();
this.btnCancel = new DevComponents.DotNetBar.ButtonX();
this.DlgBrowseFolder = new System.Windows.Forms.FolderBrowserDialog();
@@ -592,7 +593,7 @@ namespace VEPROMS
this.cbxWaterMark.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxWaterMark.FormattingEnabled = true;
this.cbxWaterMark.ItemHeight = 17;
this.cbxWaterMark.Location = new System.Drawing.Point(181, 70);
this.cbxWaterMark.Location = new System.Drawing.Point(181, 65);
this.cbxWaterMark.Margin = new System.Windows.Forms.Padding(2);
this.cbxWaterMark.Name = "cbxWaterMark";
this.cbxWaterMark.Size = new System.Drawing.Size(157, 23);
@@ -601,6 +602,21 @@ namespace VEPROMS
this.cbxWaterMark.Visible = false;
this.cbxWaterMark.WatermarkFont = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cbxWaterMark.WatermarkText = "select watermark option";
this.lblWatermarkS.Text = "Watermark";
//
// lblWaterMarkOvrd
//
this.lblWaterMarkOvrd.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lblWaterMarkOvrd.BackColor = System.Drawing.Color.Transparent;
this.lblWaterMarkOvrd.Font = new System.Drawing.Font("Microsoft Sans Serif",7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblWaterMarkOvrd.Location = new System.Drawing.Point(181, 67);
this.lblWaterMarkOvrd.Margin = new System.Windows.Forms.Padding(2);
this.lblWaterMarkOvrd.Name = "lblWaterMarkOvrd";
this.lblWaterMarkOvrd.Size = new System.Drawing.Size(180, 23);
this.superTooltip1.SetSuperTooltip(this.lblWaterMarkOvrd, new DevComponents.DotNetBar.SuperTooltipInfo("Watermark Overrides", "", "Shows Watermark and Watermark colors as overwridden from Procedure Specific Information (PSI).", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(130, 100)));
this.lblWaterMarkOvrd.TabIndex = 106;
this.lblWaterMarkOvrd.Text = "Watermark";
this.lblWaterMarkOvrd.Visible = false;
//
// btnCreatePDF
//
@@ -1234,6 +1250,7 @@ namespace VEPROMS
this.expPrnSetting.Controls.Add(this.ppGpbxUserSpecCB);
this.expPrnSetting.Controls.Add(this.labelX5);
this.expPrnSetting.Controls.Add(this.cbxWaterMark);
this.expPrnSetting.Controls.Add(this.lblWaterMarkOvrd);
this.expPrnSetting.Controls.Add(this.lblGeneratePlacekeeper);
this.expPrnSetting.Controls.Add(this.swtbtnChgBar);
this.expPrnSetting.Controls.Add(this.swtbtnWaterMark);
@@ -1413,6 +1430,7 @@ namespace VEPROMS
private System.Windows.Forms.CheckBox cbxOverwritePDF2;
private System.Windows.Forms.CheckBox cbxOpenAfterCreate2;
private DevComponents.DotNetBar.Controls.ComboBoxEx cbxWaterMark;
private DevComponents.DotNetBar.LabelX lblWaterMarkOvrd;
private System.Windows.Forms.BindingSource docVersionConfigBindingSource;
private DevComponents.DotNetBar.Controls.TextBoxX txbPDFLocation;
private System.Windows.Forms.CheckBox cbxDebug;

View File

@@ -425,12 +425,33 @@ namespace VEPROMS
itm.Save();
}
}
// C2021-019: Override Watermark Text and Color from PSI
string waterMarkTextOverride = pc.GetValue("PSI", "WATERMARKOVERRIDE");
if (waterMarkTextOverride != null && waterMarkTextOverride != "")
{
cbxWaterMark.Visible = false;
lblWaterMarkOvrd.Visible = true;
lblWaterMarkOvrd.Text = waterMarkTextOverride;
}
// do color override
// if there is override text, label contains overridden text in the color selected from color override
// if no override text, combo box text color is override color
string waterMarkColorOverride = pc.GetValue("PSI", "WATERMARKOVERRIDECLR");
if (waterMarkColorOverride != null && waterMarkColorOverride != "")
{
string strColor = waterMarkColorOverride.ToUpper().Contains("DEFAULT") ? "BLUE" : waterMarkColorOverride;
if (lblWaterMarkOvrd.Visible)
lblWaterMarkOvrd.ForeColor = Color.FromName(strColor);
else
cbxWaterMark.ForeColor = Color.FromName(strColor);
}
}
else
{
RevNum = "0";
RevDate = DateTime.Today.ToShortDateString();
ReviewDate = null;
cbxWaterMark.Visible = true;
}
// B2019-044 use Enum without the "None" option for the print dialog
cbxWaterMark.DataSource = EnumDetail<PrintDlgWatermarkList>.Details();
@@ -555,7 +576,26 @@ namespace VEPROMS
private void swtbtnWaterMark_ValueChanged(object sender, EventArgs e)
{
cbxWaterMark.Visible = swtbtnWaterMark.Value;
if (!swtbtnWaterMark.Value) // C2021-019: make both invisible
{
cbxWaterMark.Visible = swtbtnWaterMark.Value;
lblWaterMarkOvrd.Visible = swtbtnWaterMark.Value;
}
else // C2021-019: determine whether combo box or lable needs to be made visible
{
ProcedureConfig pc = MyProcedure.MyConfig as ProcedureConfig;
string waterMarkTextOverride = pc.GetValue("PSI", "WATERMARKOVERRIDE");
if (waterMarkTextOverride != null && waterMarkTextOverride != "")
{
cbxWaterMark.Visible = false;
lblWaterMarkOvrd.Visible = true;
}
else
{
cbxWaterMark.Visible = true;
lblWaterMarkOvrd.Visible = false;
}
}
}
private void txbPDFLocation_Leave(object sender, EventArgs e)
@@ -650,7 +690,7 @@ namespace VEPROMS
// If file exists, determine if overwrite checkbox allows overwrite, if not prompt.
Volian.Print.Library.Rtf2Pdf.PdfDebug = cbxDebug.Checked;
// B2019-128: The combo box list did not include the 'None' option so the selected value was not the correct watermark (had to add 1 to the selected index)
PrintWatermark pw = (swtbtnWaterMark.Value) ? (PrintWatermark)(cbxWaterMark.SelectedIndex+1) : PrintWatermark.None;
string waterMarkText = (swtbtnWaterMark.Value) ? cbxWaterMark.Text : "None"; // C2021-019
// Determine change bar settings. First get from config & then see if override from dialog.
// Also check that format allows override.
ChangeBarDefinition cbd = DetermineChangeBarSettings();
@@ -663,6 +703,12 @@ namespace VEPROMS
{
string locpdfname = null; // get pdf file name for later merge code
MyProcedure = myProc;
// C2021-019: Override Watermark Text, 'waterMarkText' will have whatever watermark text should be printed
ProcedureConfig procConfig = MyProcedure.MyConfig as ProcedureConfig;
string waterMarkTextOverride = "";
if (procConfig != null) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE");
if (swtbtnWaterMark.Value && waterMarkTextOverride != null && waterMarkTextOverride != "") waterMarkText = waterMarkTextOverride;
// C2020-002 paper size is now set in the format files - default is Letter
Volian.Print.Library.Rtf2Pdf.PaperSize = myProc.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize;
if (myProc.Sections != null)
@@ -686,7 +732,7 @@ namespace VEPROMS
string myPDFPath = GetMultiunitPDFPath();
_MergedPdfPath = myPDFPath; // If Slave, need its subdirectory/unit path for merging
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked,
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, myPDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd);//C2018-009 print PROMS version
frmStatus.CloseWhenDone = true;
@@ -715,7 +761,7 @@ namespace VEPROMS
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
// B2016-249 Output Procedure to folder associated with Parent Child
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked,
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd);//C2018-009 print PROMS version
frmStatus.CloseWhenDone = true;
@@ -746,7 +792,7 @@ namespace VEPROMS
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
ProfileTimer.Pop(profileDepth1);
// B2016-249 Output Procedure to folder associated with Parent Child
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked,
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked,
cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text,
new Point(Left, Bottom - 50), swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd);//C2018-009 print PROMS version
frmStatus.CloseWhenDone = true;
@@ -847,7 +893,12 @@ namespace VEPROMS
Volian.Print.Library.Rtf2Pdf.PdfDebug = cbxDebug.Checked;
// B2019-044 don't print the watermark if the watermark switch on the print dialog is turned off
cbxWaterMark.Visible = true;
string waterMarkText = (swtbtnWaterMark.Value) ? cbxWaterMark.Text : "None" ; // B2018-124 use text of watermark form drop down list instead of enum value
ProcedureConfig procConfig = MyProcedure.MyConfig as ProcedureConfig;
string waterMarkTextOverride = "";
if (procConfig != null) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE"); // C2021-019: override watermark text
if (swtbtnWaterMark.Value && waterMarkTextOverride != null && waterMarkTextOverride != "") waterMarkText = waterMarkTextOverride;
// Determine change bar settings. First get from config & then see if override from dialog.
// Also check that format allows override.
ChangeBarDefinition cbd = DetermineChangeBarSettings();

View File

@@ -16,11 +16,13 @@ namespace VEPROMS
private StepTabRibbon _MyStepTabRibbon;
private Dictionary<string, StepRTB> _DicStepRtb;
private Dictionary<string, CheckBox> _DicCheckBox;
private Dictionary<string, ComboBox> _DicComboBox;
public frmPSI(ProcedureInfo pi)
{
InitializeComponent();
_DicStepRtb = new Dictionary<string, StepRTB>();
_DicCheckBox = new Dictionary<string, CheckBox>();
_DicComboBox = new Dictionary<string, ComboBox>();
InitializeSpecificControls(pi);
_MyStepTabRibbon = new StepTabRibbon();
}
@@ -92,6 +94,23 @@ namespace VEPROMS
maxx = ((int)fld.x * 2 + (int)fld.width * 2) > maxx ? ((int)fld.x * 2 + (int)fld.width * 2) : maxx;
maxy = ((int)fld.y * 2 + (int)fld.height * 2) > maxy ? ((int)fld.y * 2 + (int)fld.height * 2) : maxy;
}
// C2021-019: override of watermark text/color - provide support for combo box in PSI dialog
if (fld.type.ToLower() == "combo")
{
ComboBox cmb = new ComboBox();
_DicComboBox.Add(fld.name, cmb);
cmb.Location = new Point((int)fld.x * 2, (int)fld.y * 2);
cmb.Visible = true;
cmb.Width = (int)fld.width * 2;
string tmp = fld.text;
string[] tmps = tmp.Split(",".ToCharArray());
foreach (string t in tmps) cmb.Items.Add(t);
string val = procConfig.GetValue("PSI", fld.name);
if (val != null && val != "") cmb.SelectedItem = val;
this.panelPSI.Controls.Add(cmb);
maxx = ((int)fld.x * 2 + (int)fld.width * 2) > maxx ? ((int)fld.x * 2 + (int)fld.width * 2) : maxx;
maxy = ((int)fld.y * 2 + (int)fld.height * 2) > maxy ? ((int)fld.y * 2 + (int)fld.height * 2) : maxy;
}
}
if (maxx > xB4Scroll)
{
@@ -163,6 +182,18 @@ namespace VEPROMS
procConfig.SetValue("PSI", fld.name, newval);
}
}
// C2021-019: override of watermark text/color - save combo box selection
else if (fld.type.ToLower() == "combo")
{
ComboBox cmbcur = _DicComboBox[fld.name];
string newval = cmbcur.Text;
string oldval = procConfig.GetValue("PSI", fld.name);
if (newval != oldval)
{
isDirty = true;
procConfig.SetValue("PSI", fld.name, newval);
}
}
}
if (isDirty)
{