diff --git a/Results/Output/Printers/Zapiska/ZapiskaPrintDocument.cs b/Results/Output/Printers/Zapiska/ZapiskaPrintDocument.cs index 4998d0eb4..6b77b48b1 100644 --- a/Results/Output/Printers/Zapiska/ZapiskaPrintDocument.cs +++ b/Results/Output/Printers/Zapiska/ZapiskaPrintDocument.cs @@ -23,8 +23,12 @@ namespace Results.Output.Printers.Zapiska readonly int topMargin; readonly int bottomMargin; readonly int leftMargin; - readonly int leftMargin2; - readonly int leftMargin3; + readonly int leftMarginCommon1; + readonly int leftMarginCommon2; + readonly int leftMarginCommon3; + readonly int leftMarginBelow1; + readonly int leftMarginBelow2; + readonly int leftMarginBelow3; readonly int SpacingOne; readonly int SpacingOneAndHalf; @@ -59,6 +63,9 @@ namespace Results.Output.Printers.Zapiska IList commonItems2; IList commonItems3; IList selectedItems; + IList belowItems1; + IList belowItems2; + IList belowItems3; string footer; /// @@ -88,7 +95,10 @@ namespace Results.Output.Printers.Zapiska commonItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems2); commonItems3 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems3); selectedItems = Results.WMeterRsltItemSpec.FromStrArray(cfg.SelectedItems); - footer = string.IsNullOrEmpty(cfg.Footer) ? string.Empty : cfg.Footer.Replace("~", Environment.NewLine); + belowItems1 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems1); + belowItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems2); + belowItems3 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems3); + footer = string.IsNullOrEmpty(cfg.Footer) ? string.Empty : cfg.Footer.Replace("~", Environment.NewLine); /// Initialize fonts titleFont = new Font((cfg.TitFntFml != null ? cfg.TitFntFml : "Arial"), (cfg.TitFntSz > 0 ? cfg.TitFntSz : 10), (FontStyle)cfg.TitFntSty); @@ -109,8 +119,13 @@ namespace Results.Output.Printers.Zapiska printWidth = base.DefaultPageSettings.PaperSize.Width - leftMargin - leftMargin; } - leftMargin2 = leftMargin + (int)(printWidth * cfg.ColW1Pct / 100.0f); - leftMargin3 = leftMargin + (int)(printWidth * (cfg.ColW1Pct + cfg.ColW2Pct) / 100.0f); + leftMarginCommon1 = leftMargin + (int)(printWidth * cfg.ColW0Pct / 100.0f); + leftMarginCommon2 = leftMargin + (int)(printWidth * (cfg.ColW0Pct + cfg.ColW1Pct) / 100.0f); + leftMarginCommon3 = leftMargin + (int)(printWidth * (cfg.ColW0Pct + cfg.ColW1Pct + cfg.ColW2Pct) / 100.0f); + + leftMarginBelow1 = leftMargin + (int)(printWidth * cfg.BelowW0Pct / 100.0f); + leftMarginBelow2 = leftMargin + (int)(printWidth * (cfg.BelowW0Pct + cfg.BelowW1Pct) / 100.0f); + leftMarginBelow3 = leftMargin + (int)(printWidth * (cfg.BelowW0Pct + cfg.BelowW1Pct + cfg.BelowW2Pct) / 100.0f); SpacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height; SpacingOneAndHalf = (3 * SpacingOne) / 2; @@ -194,9 +209,9 @@ namespace Results.Output.Printers.Zapiska switch (n) { default: - case 1: commonItems = commonItems1; lMargin = leftMargin; break; - case 2: commonItems = commonItems2; lMargin = leftMargin2; break; - case 3: commonItems = commonItems3; lMargin = leftMargin3; break; + case 1: commonItems = commonItems1; lMargin = leftMarginCommon1; break; + case 2: commonItems = commonItems2; lMargin = leftMarginCommon2; break; + case 3: commonItems = commonItems3; lMargin = leftMarginCommon3; break; } if (commonItems.Count == 0) continue; /// Common part is empty @@ -244,6 +259,50 @@ namespace Results.Output.Printers.Zapiska e.HasMorePages = (nrPages > 1) && (pageNr == 1); + ///---------------- + /// Below items + ///---------------- + for (int n = 1; n <= 3; n++) + { + IList belowItems; + int lMargin; + switch (n) + { + default: + case 1: belowItems = belowItems1; lMargin = leftMarginBelow1; break; + case 2: belowItems = belowItems2; lMargin = leftMarginBelow2; break; + case 3: belowItems = belowItems3; lMargin = leftMarginBelow3; break; + } + + if (belowItems.Count == 0) continue; /// Below part is empty + + string[] leftColumn = new string[belowItems.Count]; + string[] rightColumn = new string[belowItems.Count]; + + int cnt = 0; + foreach (var v in belowItems) + { + leftColumn[cnt] = v.Caption; + rightColumn[cnt] = (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty; + cnt++; + } + + /// Determine left column width + int leftColWidth = 0; + foreach (var s in leftColumn) + { + int itemWidth = (int)e.Graphics.MeasureString(s, font).Width; + if (itemWidth > leftColWidth) leftColWidth = itemWidth; + } + + /// Write aligned columns + for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++) + { + PrintAt(e, lMargin, nextWmTop + SpacingOne * i, leftColumn[i]); + PrintAt(e, lMargin + leftColWidth + GapBetweenCommonColumns, nextWmTop + SpacingOne * i, rightColumn[i]); + } + } + ///---------- /// Footer ///---------- diff --git a/Results/Output/Printers/Zapiska/ZapiskaPrinterCfg.cs b/Results/Output/Printers/Zapiska/ZapiskaPrinterCfg.cs index 7612ff978..b1d99e422 100644 --- a/Results/Output/Printers/Zapiska/ZapiskaPrinterCfg.cs +++ b/Results/Output/Printers/Zapiska/ZapiskaPrinterCfg.cs @@ -24,14 +24,23 @@ namespace Results.Output.Printers.Zapiska public int BodyFntSz; public int BodyFntSty; public bool SupressPrinting; /// Bypass printing when true + public bool GoodOnly; public System.Globalization.CultureInfo CultureInfo; - public int ColW1Pct; + + public string Header; /// =Title + public int ColW0Pct; + public int ColW1Pct; public int ColW2Pct; public string[] CommonItems1; public string[] CommonItems2; public string[] CommonItems3; public string[] SelectedItems; - public string Header; /// =Title + public int BelowW0Pct; + public int BelowW1Pct; + public int BelowW2Pct; + public string[] BelowItems1; + public string[] BelowItems2; + public string[] BelowItems3; public string Footer; } } diff --git a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/Printer.cs b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/Printer.cs index ff0fc4cfb..7f57e61ae 100644 --- a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/Printer.cs +++ b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/Printer.cs @@ -92,13 +92,20 @@ namespace TBF.BenchControl.Output.Printers.Zapiska printerCfg.SupressPrinting = newCfg.SupressPrinting; printerCfg.Culture = newCfg.Culture; printerCfg.Header = newCfg.Header; - printerCfg.ColW1Pct = newCfg.ColW1Pct; + printerCfg.ColW0Pct = newCfg.ColW0Pct; + printerCfg.ColW1Pct = newCfg.ColW1Pct; printerCfg.ColW2Pct = newCfg.ColW2Pct; printerCfg.CommonItems1 = newCfg.CommonItems1; printerCfg.CommonItems2 = newCfg.CommonItems2; printerCfg.CommonItems3 = newCfg.CommonItems3; printerCfg.SelectedItems = newCfg.SelectedItems; - printerCfg.Footer = newCfg.Footer; + printerCfg.BelowW0Pct = newCfg.BelowW0Pct; + printerCfg.BelowW1Pct = newCfg.BelowW1Pct; + printerCfg.BelowW2Pct = newCfg.BelowW2Pct; + printerCfg.BelowItems1 = newCfg.BelowItems1; + printerCfg.BelowItems2 = newCfg.BelowItems2; + printerCfg.BelowItems3 = newCfg.BelowItems3; + printerCfg.Footer = newCfg.Footer; ApplyConfig(); } @@ -181,7 +188,8 @@ namespace TBF.BenchControl.Output.Printers.Zapiska HdrFntSty = printerCfg.HdrFntSty, BodyFntSty = printerCfg.BodyFntSty, SupressPrinting = printerCfg.SupressPrinting, - CultureInfo = culture, + GoodOnly = printerCfg.GoodOnly, + CultureInfo = culture, Header = printerCfg.Header, ColW1Pct = printerCfg.ColW1Pct, ColW2Pct = printerCfg.ColW2Pct, diff --git a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfg.cs b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfg.cs index 922293b9d..ce91f7574 100644 --- a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfg.cs +++ b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfg.cs @@ -32,14 +32,27 @@ namespace TBF.BenchControl.Output.Printers.Zapiska public int BodyFntSty; public bool SupressPrinting; /// Bypass printing when true public Culture Culture; - public int ColW1Pct; - public int ColW2Pct; - public string[] CommonItems1; - public string[] CommonItems2; + public bool GoodOnly; + + public string Header; /// =Title + + public int ColW0Pct; + public string[] CommonItems1; + public int ColW1Pct; + public string[] CommonItems2; + public int ColW2Pct; public string[] CommonItems3; + public string[] SelectedItems; - public string Header; /// =Title - public string Footer; + + public int BelowW0Pct; + public string[] BelowItems1; + public int BelowW1Pct; + public string[] BelowItems2; + public int BelowW2Pct; + public string[] BelowItems3; + + public string Footer; [XmlIgnore] public Config.Entities.MetersKind MetersKind; diff --git a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.Designer.cs b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.Designer.cs index 8d29c51b8..1e05c4b72 100644 --- a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.Designer.cs +++ b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.Designer.cs @@ -71,6 +71,19 @@ namespace TBF.BenchControl.Output.Printers.Zapiska this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.colW0TextBox = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); + this.belowW0TextBox = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.belowW2TextBox = new System.Windows.Forms.TextBox(); + this.belowW1TextBox = new System.Windows.Forms.TextBox(); + this.belowItems3Button = new System.Windows.Forms.Button(); + this.belowItems2Button = new System.Windows.Forms.Button(); + this.belowItems1Button = new System.Windows.Forms.Button(); + this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // nameTextBox @@ -78,7 +91,7 @@ namespace TBF.BenchControl.Output.Printers.Zapiska this.nameTextBox.Enabled = false; this.nameTextBox.Location = new System.Drawing.Point(142, 40); this.nameTextBox.Name = "nameTextBox"; - this.nameTextBox.Size = new System.Drawing.Size(218, 20); + this.nameTextBox.Size = new System.Drawing.Size(205, 20); this.nameTextBox.TabIndex = 2; // // nameLabel @@ -103,7 +116,7 @@ namespace TBF.BenchControl.Output.Printers.Zapiska // this.supressPrintingCheckBox.AutoSize = true; this.supressPrintingCheckBox.Enabled = false; - this.supressPrintingCheckBox.Location = new System.Drawing.Point(19, 313); + this.supressPrintingCheckBox.Location = new System.Drawing.Point(353, 42); this.supressPrintingCheckBox.Name = "supressPrintingCheckBox"; this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17); this.supressPrintingCheckBox.TabIndex = 38; @@ -125,7 +138,7 @@ namespace TBF.BenchControl.Output.Printers.Zapiska this.orientationComboBox.FormattingEnabled = true; this.orientationComboBox.Location = new System.Drawing.Point(142, 64); 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 = 4; // // topMarginTextBox @@ -182,20 +195,20 @@ namespace TBF.BenchControl.Output.Printers.Zapiska // commonItems1Button // this.commonItems1Button.Enabled = false; - this.commonItems1Button.Location = new System.Drawing.Point(142, 259); + this.commonItems1Button.Location = new System.Drawing.Point(301, 236); this.commonItems1Button.Name = "commonItems1Button"; - this.commonItems1Button.Size = new System.Drawing.Size(70, 23); + this.commonItems1Button.Size = new System.Drawing.Size(47, 23); this.commonItems1Button.TabIndex = 33; - this.commonItems1Button.Text = "Common 1"; + this.commonItems1Button.Text = "Col. 1"; this.commonItems1Button.UseVisualStyleBackColor = true; this.commonItems1Button.Click += new System.EventHandler(this.commonItems1Button_Click); // // footerButton // this.footerButton.Enabled = false; - this.footerButton.Location = new System.Drawing.Point(142, 309); + this.footerButton.Location = new System.Drawing.Point(142, 314); this.footerButton.Name = "footerButton"; - this.footerButton.Size = new System.Drawing.Size(218, 23); + this.footerButton.Size = new System.Drawing.Size(312, 23); this.footerButton.TabIndex = 37; this.footerButton.Text = "Footer"; this.footerButton.UseVisualStyleBackColor = true; @@ -206,7 +219,7 @@ namespace TBF.BenchControl.Output.Printers.Zapiska this.headerButton.Enabled = false; this.headerButton.Location = new System.Drawing.Point(142, 209); this.headerButton.Name = "headerButton"; - this.headerButton.Size = new System.Drawing.Size(218, 23); + this.headerButton.Size = new System.Drawing.Size(312, 23); this.headerButton.TabIndex = 27; this.headerButton.Text = "Title"; this.headerButton.UseVisualStyleBackColor = true; @@ -215,9 +228,9 @@ namespace TBF.BenchControl.Output.Printers.Zapiska // testItemsButton // this.testItemsButton.Enabled = false; - this.testItemsButton.Location = new System.Drawing.Point(142, 284); + this.testItemsButton.Location = new System.Drawing.Point(142, 261); this.testItemsButton.Name = "testItemsButton"; - this.testItemsButton.Size = new System.Drawing.Size(218, 23); + this.testItemsButton.Size = new System.Drawing.Size(312, 23); this.testItemsButton.TabIndex = 36; this.testItemsButton.Text = "Water meter items"; this.testItemsButton.UseVisualStyleBackColor = true; @@ -384,45 +397,45 @@ namespace TBF.BenchControl.Output.Printers.Zapiska // commonItems2Button // this.commonItems2Button.Enabled = false; - this.commonItems2Button.Location = new System.Drawing.Point(216, 259); + this.commonItems2Button.Location = new System.Drawing.Point(354, 236); this.commonItems2Button.Name = "commonItems2Button"; - this.commonItems2Button.Size = new System.Drawing.Size(70, 23); + this.commonItems2Button.Size = new System.Drawing.Size(47, 23); this.commonItems2Button.TabIndex = 34; - this.commonItems2Button.Text = "Common 2"; + this.commonItems2Button.Text = "Col. 2"; this.commonItems2Button.UseVisualStyleBackColor = true; this.commonItems2Button.Click += new System.EventHandler(this.commonItems2Button_Click); // // commonItems3Button // this.commonItems3Button.Enabled = false; - this.commonItems3Button.Location = new System.Drawing.Point(290, 259); + this.commonItems3Button.Location = new System.Drawing.Point(407, 236); this.commonItems3Button.Name = "commonItems3Button"; - this.commonItems3Button.Size = new System.Drawing.Size(70, 23); + this.commonItems3Button.Size = new System.Drawing.Size(47, 23); this.commonItems3Button.TabIndex = 35; - this.commonItems3Button.Text = "Common 3"; + this.commonItems3Button.Text = "Col. 3"; this.commonItems3Button.UseVisualStyleBackColor = true; this.commonItems3Button.Click += new System.EventHandler(this.commonItems3Button_Click); // // colW2TextBox // this.colW2TextBox.Enabled = false; - this.colW2TextBox.Location = new System.Drawing.Point(216, 236); + this.colW2TextBox.Location = new System.Drawing.Point(245, 237); this.colW2TextBox.Name = "colW2TextBox"; - this.colW2TextBox.Size = new System.Drawing.Size(44, 20); + this.colW2TextBox.Size = new System.Drawing.Size(30, 20); this.colW2TextBox.TabIndex = 31; // // colW1TextBox // this.colW1TextBox.Enabled = false; - this.colW1TextBox.Location = new System.Drawing.Point(142, 236); + this.colW1TextBox.Location = new System.Drawing.Point(192, 237); this.colW1TextBox.Name = "colW1TextBox"; - this.colW1TextBox.Size = new System.Drawing.Size(44, 20); + this.colW1TextBox.Size = new System.Drawing.Size(30, 20); this.colW1TextBox.TabIndex = 29; // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(186, 239); + this.label3.Location = new System.Drawing.Point(222, 240); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(15, 13); this.label3.TabIndex = 30; @@ -431,7 +444,7 @@ namespace TBF.BenchControl.Output.Printers.Zapiska // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(260, 238); + this.label4.Location = new System.Drawing.Point(275, 240); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(15, 13); this.label4.TabIndex = 32; @@ -446,10 +459,144 @@ namespace TBF.BenchControl.Output.Printers.Zapiska this.label5.TabIndex = 28; this.label5.Text = "Column widths in %"; // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(172, 240); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(15, 13); + this.label6.TabIndex = 40; + this.label6.Text = "%"; + // + // colW0TextBox + // + this.colW0TextBox.Enabled = false; + this.colW0TextBox.Location = new System.Drawing.Point(142, 237); + this.colW0TextBox.Name = "colW0TextBox"; + this.colW0TextBox.Size = new System.Drawing.Size(30, 20); + this.colW0TextBox.TabIndex = 39; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(172, 293); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(15, 13); + this.label7.TabIndex = 50; + this.label7.Text = "%"; + // + // belowW0TextBox + // + this.belowW0TextBox.Enabled = false; + this.belowW0TextBox.Location = new System.Drawing.Point(142, 290); + this.belowW0TextBox.Name = "belowW0TextBox"; + this.belowW0TextBox.Size = new System.Drawing.Size(30, 20); + this.belowW0TextBox.TabIndex = 49; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(16, 292); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(97, 13); + this.label8.TabIndex = 41; + this.label8.Text = "Column widths in %"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(275, 293); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(15, 13); + this.label9.TabIndex = 45; + this.label9.Text = "%"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(222, 293); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(15, 13); + this.label10.TabIndex = 43; + this.label10.Text = "%"; + // + // belowW2TextBox + // + this.belowW2TextBox.Enabled = false; + this.belowW2TextBox.Location = new System.Drawing.Point(245, 290); + this.belowW2TextBox.Name = "belowW2TextBox"; + this.belowW2TextBox.Size = new System.Drawing.Size(30, 20); + this.belowW2TextBox.TabIndex = 44; + // + // belowW1TextBox + // + this.belowW1TextBox.Enabled = false; + this.belowW1TextBox.Location = new System.Drawing.Point(192, 290); + this.belowW1TextBox.Name = "belowW1TextBox"; + this.belowW1TextBox.Size = new System.Drawing.Size(30, 20); + this.belowW1TextBox.TabIndex = 42; + // + // belowItems3Button + // + this.belowItems3Button.Enabled = false; + this.belowItems3Button.Location = new System.Drawing.Point(407, 288); + this.belowItems3Button.Name = "belowItems3Button"; + this.belowItems3Button.Size = new System.Drawing.Size(47, 23); + this.belowItems3Button.TabIndex = 48; + this.belowItems3Button.Text = "Col. 3"; + this.belowItems3Button.UseVisualStyleBackColor = true; + this.belowItems3Button.Click += new System.EventHandler(this.belowItems3Button_Click); + // + // belowItems2Button + // + this.belowItems2Button.Enabled = false; + this.belowItems2Button.Location = new System.Drawing.Point(354, 288); + this.belowItems2Button.Name = "belowItems2Button"; + this.belowItems2Button.Size = new System.Drawing.Size(47, 23); + this.belowItems2Button.TabIndex = 47; + this.belowItems2Button.Text = "Col. 2"; + this.belowItems2Button.UseVisualStyleBackColor = true; + this.belowItems2Button.Click += new System.EventHandler(this.belowItems2Button_Click); + // + // belowItems1Button + // + this.belowItems1Button.Enabled = false; + this.belowItems1Button.Location = new System.Drawing.Point(301, 288); + this.belowItems1Button.Name = "belowItems1Button"; + this.belowItems1Button.Size = new System.Drawing.Size(47, 23); + this.belowItems1Button.TabIndex = 46; + this.belowItems1Button.Text = "Col. 1"; + this.belowItems1Button.UseVisualStyleBackColor = true; + this.belowItems1Button.Click += new System.EventHandler(this.belowItems1Button_Click); + // + // goodOnlyCheckBox + // + this.goodOnlyCheckBox.AutoSize = true; + this.goodOnlyCheckBox.Enabled = false; + this.goodOnlyCheckBox.Location = new System.Drawing.Point(16, 265); + this.goodOnlyCheckBox.Name = "goodOnlyCheckBox"; + this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17); + this.goodOnlyCheckBox.TabIndex = 51; + this.goodOnlyCheckBox.Text = "Good only"; + this.goodOnlyCheckBox.UseVisualStyleBackColor = true; + // // PrinterCfgCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.goodOnlyCheckBox); + this.Controls.Add(this.label7); + this.Controls.Add(this.belowW0TextBox); + this.Controls.Add(this.label8); + this.Controls.Add(this.label9); + this.Controls.Add(this.label10); + this.Controls.Add(this.belowW2TextBox); + this.Controls.Add(this.belowW1TextBox); + this.Controls.Add(this.belowItems3Button); + this.Controls.Add(this.belowItems2Button); + this.Controls.Add(this.belowItems1Button); + this.Controls.Add(this.label6); + this.Controls.Add(this.colW0TextBox); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.label3); @@ -491,7 +638,7 @@ namespace TBF.BenchControl.Output.Printers.Zapiska this.Controls.Add(this.nameLabel); this.Controls.Add(this.classNameLabel); this.Name = "PrinterCfgCtrl"; - this.Size = new System.Drawing.Size(400, 350); + this.Size = new System.Drawing.Size(492, 350); this.Load += new System.EventHandler(this.PrinterCfgCtrl_Load); this.ResumeLayout(false); this.PerformLayout(); @@ -540,5 +687,18 @@ namespace TBF.BenchControl.Output.Printers.Zapiska private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox colW0TextBox; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.TextBox belowW0TextBox; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.TextBox belowW2TextBox; + private System.Windows.Forms.TextBox belowW1TextBox; + private System.Windows.Forms.Button belowItems3Button; + private System.Windows.Forms.Button belowItems2Button; + private System.Windows.Forms.Button belowItems1Button; + private System.Windows.Forms.CheckBox goodOnlyCheckBox; } } diff --git a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.cs b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.cs index a3848a628..f2f76775e 100644 --- a/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/Output/Printers/Zapiska/PrinterCfgCtrl.cs @@ -33,7 +33,10 @@ namespace TBF.BenchControl.Output.Printers.Zapiska string[] commonItems2; string[] commonItems3; string[] testItems; - string footer; + string[] belowItems1; + string[] belowItems2; + string[] belowItems3; + string footer; public PrinterCfgCtrl() { @@ -60,7 +63,10 @@ namespace TBF.BenchControl.Output.Printers.Zapiska commonItems2 = config.CommonItems2; commonItems3 = config.CommonItems3; testItems = config.SelectedItems; - footer = config.Footer; + belowItems1 = config.BelowItems1; + belowItems2 = config.BelowItems2; + belowItems3 = config.BelowItems3; + footer = config.Footer; Redraw(); } @@ -113,11 +119,17 @@ namespace TBF.BenchControl.Output.Printers.Zapiska bodyBoldCheckBox.Checked = ((config.BodyFntSty & (int)System.Drawing.FontStyle.Bold) != 0); bodyItalicCheckBox.Checked = ((config.BodyFntSty & (int)System.Drawing.FontStyle.Italic) != 0); - colW1TextBox.Text = config.ColW1Pct.ToString(); + colW0TextBox.Text = config.ColW0Pct.ToString(); + colW1TextBox.Text = config.ColW1Pct.ToString(); colW2TextBox.Text = config.ColW2Pct.ToString(); + belowW0TextBox.Text = config.BelowW0Pct.ToString(); + belowW1TextBox.Text = config.BelowW1Pct.ToString(); + belowW2TextBox.Text = config.BelowW2Pct.ToString(); + supressPrintingCheckBox.Checked = config.SupressPrinting; - cultureComboBox.Text = config.Culture.ToString(); + goodOnlyCheckBox.Checked = config.GoodOnly; + cultureComboBox.Text = config.Culture.ToString(); } public void Unlock() @@ -140,15 +152,23 @@ namespace TBF.BenchControl.Output.Printers.Zapiska bodyBoldCheckBox.Enabled = true; bodyItalicCheckBox.Enabled = true; supressPrintingCheckBox.Enabled = true; + goodOnlyCheckBox.Enabled = true; cultureComboBox.Enabled = true; headerButton.Enabled = true; - colW1TextBox.Enabled = true; + colW0TextBox.Enabled = true; + colW1TextBox.Enabled = true; colW2TextBox.Enabled = true; commonItems1Button.Enabled = true; commonItems2Button.Enabled = true; commonItems3Button.Enabled = true; testItemsButton.Enabled = true; - footerButton.Enabled = true; + belowW0TextBox.Enabled = true; + belowW1TextBox.Enabled = true; + belowW2TextBox.Enabled = true; + belowItems1Button.Enabled = true; + belowItems2Button.Enabled = true; + belowItems3Button.Enabled = true; + footerButton.Enabled = true; } public CfgUpdateFlags VerifyCfg(ref string message) @@ -161,7 +181,7 @@ namespace TBF.BenchControl.Output.Printers.Zapiska flags |= CfgUpdateFlags.Error; } - int dummy, dummy2; + int dummy, dummy2, dummy3; if (!int.TryParse(topMarginTextBox.Text, out dummy) || dummy < 0 || dummy > 500) { message += Environment.NewLine + "'Top margin' should be between 0 and 500"; @@ -204,24 +224,54 @@ namespace TBF.BenchControl.Output.Printers.Zapiska message += Environment.NewLine + "Invalid culture"; } - if (!int.TryParse(colW1TextBox.Text, out dummy) || dummy < 0 || dummy > 100) + if (!int.TryParse(colW0TextBox.Text, out dummy) || dummy < 0 || dummy > 100) + { + message += Environment.NewLine + "Column width 0 should be between 0 and 100"; + flags |= CfgUpdateFlags.Error; + } + + if (!int.TryParse(colW1TextBox.Text, out dummy2) || dummy2 < 0 || dummy2 > 100) { message += Environment.NewLine + "Column width 1 should be between 0 and 100"; flags |= CfgUpdateFlags.Error; } - if (!int.TryParse(colW2TextBox.Text, out dummy2) || dummy2 < 0 || dummy2 > 100) + if (!int.TryParse(colW2TextBox.Text, out dummy3) || dummy3 < 0 || dummy3 > 100) { message += Environment.NewLine + "Column width 2 should be between 0 and 100"; flags |= CfgUpdateFlags.Error; } - if (dummy + dummy2 > 100) + if (dummy + dummy2 + dummy3 > 100) { message += Environment.NewLine + "Sum of column widths should be <= 100"; flags |= CfgUpdateFlags.Error; } + if (!int.TryParse(belowW0TextBox.Text, out dummy) || dummy < 0 || dummy > 100) + { + message += Environment.NewLine + "Column width 0 should be between 0 and 100"; + flags |= CfgUpdateFlags.Error; + } + + if (!int.TryParse(belowW1TextBox.Text, out dummy2) || dummy2 < 0 || dummy2 > 100) + { + message += Environment.NewLine + "Column width 1 should be between 0 and 100"; + flags |= CfgUpdateFlags.Error; + } + + if (!int.TryParse(belowW2TextBox.Text, out dummy3) || dummy3 < 0 || dummy3 > 100) + { + message += Environment.NewLine + "Column width 2 should be between 0 and 100"; + flags |= CfgUpdateFlags.Error; + } + + if (dummy + dummy2 + dummy3 > 100) + { + message += Environment.NewLine + "Sum of column widths should be <= 100"; + flags |= CfgUpdateFlags.Error; + } + return flags; } @@ -330,52 +380,62 @@ namespace TBF.BenchControl.Output.Printers.Zapiska flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); } - tmp = int.Parse(colW1TextBox.Text); - if (config.ColW1Pct != tmp) + if (config.GoodOnly != goodOnlyCheckBox.Checked) + { + config.GoodOnly = goodOnlyCheckBox.Checked; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + } + + tmp = int.Parse(colW0TextBox.Text); + if (config.ColW0Pct != tmp) { - config.ColW1Pct = tmp; + config.ColW0Pct = tmp; flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); } - tmp = int.Parse(colW2TextBox.Text); + tmp = int.Parse(colW1TextBox.Text); + if (config.ColW1Pct != tmp) + { + config.ColW1Pct = tmp; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + } + tmp = int.Parse(colW2TextBox.Text); if (config.ColW2Pct != tmp) { config.ColW2Pct = tmp; flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); } + tmp = int.Parse(belowW0TextBox.Text); + if (config.BelowW0Pct != tmp) + { + config.BelowW0Pct = tmp; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + } + tmp = int.Parse(belowW1TextBox.Text); + if (config.BelowW1Pct != tmp) + { + config.BelowW1Pct = tmp; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + } + tmp = int.Parse(belowW2TextBox.Text); + if (config.BelowW2Pct != tmp) + { + config.BelowW2Pct = tmp; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + } - if (config.CommonItems1 != commonItems1) - { - config.CommonItems1 = commonItems1; - flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); - } - if (config.CommonItems2 != commonItems2) - { - config.CommonItems2 = commonItems2; - flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); - } - if (config.CommonItems3 != commonItems3) - { - config.CommonItems3 = commonItems3; - flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); - } + if (config.Header != header) { config.Header = header; flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); } - if (config.SelectedItems != testItems) - { - config.SelectedItems = testItems; - flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); - } + if (config.CommonItems1 != commonItems1) { config.CommonItems1 = commonItems1; flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); } + if (config.CommonItems2 != commonItems2) { config.CommonItems2 = commonItems2; flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); } + if (config.CommonItems3 != commonItems3) { config.CommonItems3 = commonItems3; flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); } - if (config.Header != header) - { - config.Header = header; - flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); - } + if (config.SelectedItems != testItems) { config.SelectedItems = testItems; flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); } - if (config.Footer != footer) - { - config.Footer = footer; - flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); - } + if (config.BelowItems1 != belowItems1) { config.BelowItems1 = belowItems1; flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); } + if (config.BelowItems2 != belowItems2) { config.BelowItems2 = belowItems2; flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); } + if (config.BelowItems3 != belowItems3) { config.BelowItems3 = belowItems3; flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); } + + if (config.Footer != footer) { config.Footer = footer; flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); } if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0) { @@ -449,6 +509,47 @@ namespace TBF.BenchControl.Output.Printers.Zapiska testItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems); } } + private void belowItems1Button_Click(object sender, EventArgs e) + { + Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg() + { + MetersKind = config.MetersKind, + SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(belowItems1), + }; + + if (dlg.ShowDialog() == DialogResult.OK) + { + belowItems1 = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems); + } + } + + private void belowItems2Button_Click(object sender, EventArgs e) + { + Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg() + { + MetersKind = config.MetersKind, + SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(belowItems2), + }; + + if (dlg.ShowDialog() == DialogResult.OK) + { + belowItems2 = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems); + } + } + + private void belowItems3Button_Click(object sender, EventArgs e) + { + Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg() + { + MetersKind = config.MetersKind, + SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(belowItems3), + }; + + if (dlg.ShowDialog() == DialogResult.OK) + { + belowItems3 = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems); + } + } private void footerButton_Click(object sender, EventArgs e) { diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index 80b5c3204..e24a9b7bb 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.16.667.1")] -[assembly: AssemblyFileVersion("2.16.667.1")] +[assembly: AssemblyVersion("2.16.668.1")] +[assembly: AssemblyFileVersion("2.16.668.1")]