diff --git a/TBF/BenchControl/Output/Printers/Enhanced/Printer.cs b/TBF/BenchControl/Output/Printers/Enhanced/Printer.cs index db32afade..88c3804d5 100644 --- a/TBF/BenchControl/Output/Printers/Enhanced/Printer.cs +++ b/TBF/BenchControl/Output/Printers/Enhanced/Printer.cs @@ -3,6 +3,7 @@ /// using System; using System.Collections.Generic; +using System.Drawing.Printing; using System.Globalization; using System.Threading; using Results.Output.Printers.Enhanced; @@ -99,6 +100,7 @@ namespace TBF.BenchControl.Output.Printers.Enhanced printerCfg.Footer = newCfg.Footer; printerCfg.DocName = newCfg.DocName; + printerCfg.NrOfCopies = newCfg.NrOfCopies; ApplyConfig(); } @@ -164,34 +166,38 @@ namespace TBF.BenchControl.Output.Printers.Enhanced if (batch.WaterMeters.Count > 0) { EnhancedPrinterCfg cfg = new EnhancedPrinterCfg - { - PageOrientation = printerCfg.PageOrientation, - Template = printerCfg.Template, - TopMargin = printerCfg.TopMargin, - BottomMargin = printerCfg.BottomMargin, - LeftMargin = printerCfg.LeftMargin, - TitFntFml = printerCfg.TitFntFml, - TitFntSz = printerCfg.TitFntSz, - TitFntSty = printerCfg.TitFntSty, - HdrFntFml = printerCfg.HdrFntFml, - HdrFntSz = printerCfg.HdrFntSz, - HdrFntSty = printerCfg.HdrFntSty, - BodyFntFml = printerCfg.BodyFntFml, - BodyFntSz = printerCfg.BodyFntSz, - BodyFntSty = printerCfg.BodyFntSty, - FooterFntFml = printerCfg.FooterFntFml, - FooterFntSz = printerCfg.FooterFntSz, - FooterFntSty = printerCfg.FooterFntSty, - GoodOnly = printerCfg.GoodOnly, - SupressPrinting = printerCfg.SupressPrinting, - CultureInfo = (printerCfg.Culture == Culture.system) ? Thread.CurrentThread.CurrentCulture : new CultureInfo(printerCfg.Culture.ToString()), - Header = printerCfg.Header, - CommonItems = printerCfg.CommonItems, - TestItems = printerCfg.SelectedItems, - Footer = printerCfg.Footer, - }; + { + PageOrientation = printerCfg.PageOrientation, + Template = printerCfg.Template, + TopMargin = printerCfg.TopMargin, + BottomMargin = printerCfg.BottomMargin, + LeftMargin = printerCfg.LeftMargin, + TitFntFml = printerCfg.TitFntFml, + TitFntSz = printerCfg.TitFntSz, + TitFntSty = printerCfg.TitFntSty, + HdrFntFml = printerCfg.HdrFntFml, + HdrFntSz = printerCfg.HdrFntSz, + HdrFntSty = printerCfg.HdrFntSty, + BodyFntFml = printerCfg.BodyFntFml, + BodyFntSz = printerCfg.BodyFntSz, + BodyFntSty = printerCfg.BodyFntSty, + FooterFntFml = printerCfg.FooterFntFml, + FooterFntSz = printerCfg.FooterFntSz, + FooterFntSty = printerCfg.FooterFntSty, + GoodOnly = printerCfg.GoodOnly, + SupressPrinting = printerCfg.SupressPrinting, + CultureInfo = (printerCfg.Culture == Culture.system) ? Thread.CurrentThread.CurrentCulture : new CultureInfo(printerCfg.Culture.ToString()), + Header = printerCfg.Header, + CommonItems = printerCfg.CommonItems, + TestItems = printerCfg.SelectedItems, + Footer = printerCfg.Footer, + }; - new Results.Output.Printers.Enhanced.EnhancedPrintDocument(batch, cfg, documentName).Print(); + for (int i = 1; i <= printerCfg.NrOfCopies; i++) + { + string docName = string.Format(((printerCfg.NrOfCopies == 1) ? "{0}" : "{0}-{1}"), documentName, i); + new Results.Output.Printers.Enhanced.EnhancedPrintDocument(batch, cfg, docName).Print(); + } } } } diff --git a/TBF/BenchControl/Output/Printers/Enhanced/PrinterCfg.cs b/TBF/BenchControl/Output/Printers/Enhanced/PrinterCfg.cs index 0cc0fe3e6..b4919c48d 100644 --- a/TBF/BenchControl/Output/Printers/Enhanced/PrinterCfg.cs +++ b/TBF/BenchControl/Output/Printers/Enhanced/PrinterCfg.cs @@ -42,6 +42,7 @@ namespace TBF.BenchControl.Output.Printers.Enhanced public string Header; /// =Title public string Footer; public string DocName; + public int NrOfCopies; [XmlIgnore] public Config.Entities.MetersKind MetersKind; @@ -81,6 +82,7 @@ namespace TBF.BenchControl.Output.Printers.Enhanced Header = string.Empty; Footer = string.Empty; DocName = string.Empty; + NrOfCopies = 1; } public string ToString(int i) diff --git a/TBF/BenchControl/Output/Printers/Enhanced/PrinterCfgCtrl.Designer.cs b/TBF/BenchControl/Output/Printers/Enhanced/PrinterCfgCtrl.Designer.cs index 0fc3ec847..8c110964d 100644 --- a/TBF/BenchControl/Output/Printers/Enhanced/PrinterCfgCtrl.Designer.cs +++ b/TBF/BenchControl/Output/Printers/Enhanced/PrinterCfgCtrl.Designer.cs @@ -74,6 +74,8 @@ namespace TBF.BenchControl.Output.Printers.Enhanced this.headerFontLabel = new System.Windows.Forms.Label(); this.templateTextBox = new System.Windows.Forms.TextBox(); this.templateLabel = new System.Windows.Forms.Label(); + this.nrOfCopiesTextBox = new System.Windows.Forms.TextBox(); + this.nrOfCopiesLabel = new System.Windows.Forms.Label(); this.SuspendLayout(); // // nameTextBox @@ -128,7 +130,7 @@ namespace TBF.BenchControl.Output.Printers.Enhanced this.orientationComboBox.FormattingEnabled = true; this.orientationComboBox.Location = new System.Drawing.Point(142, 83); this.orientationComboBox.Name = "orientationComboBox"; - this.orientationComboBox.Size = new System.Drawing.Size(218, 21); + this.orientationComboBox.Size = new System.Drawing.Size(146, 21); this.orientationComboBox.TabIndex = 6; // // topMarginTextBox @@ -475,10 +477,29 @@ namespace TBF.BenchControl.Output.Printers.Enhanced this.templateLabel.TabIndex = 3; this.templateLabel.Text = "Template"; // + // nrOfCopiesTextBox + // + this.nrOfCopiesTextBox.Enabled = false; + this.nrOfCopiesTextBox.Location = new System.Drawing.Point(340, 83); + this.nrOfCopiesTextBox.Name = "nrOfCopiesTextBox"; + this.nrOfCopiesTextBox.Size = new System.Drawing.Size(20, 20); + this.nrOfCopiesTextBox.TabIndex = 43; + // + // nrOfCopiesLabel + // + this.nrOfCopiesLabel.AutoSize = true; + this.nrOfCopiesLabel.Location = new System.Drawing.Point(291, 86); + this.nrOfCopiesLabel.Name = "nrOfCopiesLabel"; + this.nrOfCopiesLabel.Size = new System.Drawing.Size(48, 13); + this.nrOfCopiesLabel.TabIndex = 44; + this.nrOfCopiesLabel.Text = "# copies"; + // // PrinterCfgCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.nrOfCopiesLabel); + this.Controls.Add(this.nrOfCopiesTextBox); this.Controls.Add(this.templateTextBox); this.Controls.Add(this.templateLabel); this.Controls.Add(this.footerItalicCheckBox); @@ -575,5 +596,7 @@ namespace TBF.BenchControl.Output.Printers.Enhanced private System.Windows.Forms.Label headerFontLabel; private System.Windows.Forms.TextBox templateTextBox; private System.Windows.Forms.Label templateLabel; + private System.Windows.Forms.TextBox nrOfCopiesTextBox; + private System.Windows.Forms.Label nrOfCopiesLabel; } } diff --git a/TBF/BenchControl/Output/Printers/Enhanced/PrinterCfgCtrl.cs b/TBF/BenchControl/Output/Printers/Enhanced/PrinterCfgCtrl.cs index a0b160e44..0869150e4 100644 --- a/TBF/BenchControl/Output/Printers/Enhanced/PrinterCfgCtrl.cs +++ b/TBF/BenchControl/Output/Printers/Enhanced/PrinterCfgCtrl.cs @@ -113,6 +113,7 @@ namespace TBF.BenchControl.Output.Printers.Enhanced cultureComboBox.Text = config.Culture.ToString(); docNameTextBox.Text = config.DocName; + nrOfCopiesTextBox.Text = config.NrOfCopies.ToString(); } public void Unlock() @@ -147,6 +148,7 @@ namespace TBF.BenchControl.Output.Printers.Enhanced testItemsButton.Enabled = true; footerButton.Enabled = true; docNameTextBox.Enabled = true; + nrOfCopiesTextBox.Enabled = true; } public CfgUpdateFlags VerifyCfg(ref string message) @@ -204,9 +206,15 @@ namespace TBF.BenchControl.Output.Printers.Enhanced if (!cultureComboBox.Items.Contains(cultureComboBox.Text)) { - flags |= CfgUpdateFlags.Error; message += Environment.NewLine + "Invalid culture"; - } + flags |= CfgUpdateFlags.Error; + } + + if (!int.TryParse(nrOfCopiesTextBox.Text, out dummy) || dummy < 1 || dummy > 9) + { + message += Environment.NewLine + "'Copies' should be between 1 and 9"; + flags |= CfgUpdateFlags.Error; + } return flags; } @@ -282,6 +290,7 @@ namespace TBF.BenchControl.Output.Printers.Enhanced flags |= UpdateDifferent(ref config.Footer, footer, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); flags |= UpdateDifferent(ref config.DocName, docNameTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + flags |= UpdateDifferent(ref config.NrOfCopies, nrOfCopiesTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0) { diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index ddf35e05b..52b080361 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.18.995.0")] -[assembly: AssemblyFileVersion("2.18.995.0")] +[assembly: AssemblyVersion("2.18.996.0")] +[assembly: AssemblyFileVersion("2.18.996.0")]