diff --git a/TBF/Rig/Output/Printers/OnePerMeter/Printer.cs b/TBF/Rig/Output/Printers/OnePerMeter/Printer.cs index 82f5eb3aa..95bda2a26 100644 --- a/TBF/Rig/Output/Printers/OnePerMeter/Printer.cs +++ b/TBF/Rig/Output/Printers/OnePerMeter/Printer.cs @@ -1,14 +1,18 @@ -/// +using Common; +using log4net; +using Results.Entities; +using Results.Output.Printers.OnePerMeter; +/// /// Copyright (c) 2017-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; +using System.Drawing.Printing; using System.Globalization; +using System.IO; using System.Threading; -using Results.Entities; -using Results.Output.Printers.OnePerMeter; -using log4net; -using Common; +using System.Windows.Forms; +using TBF.Rig.Output.FileWriters; namespace TBF.Rig.Output.Printers.OnePerMeter { @@ -135,27 +139,106 @@ namespace TBF.Rig.Output.Printers.OnePerMeter printerCfg.ImgWid = newCfg.ImgWid; printerCfg.ImgHgh = newCfg.ImgHgh; printerCfg.ImgName = newCfg.ImgName; - printerCfg.DocName = newCfg.DocName; + //printerCfg.DocName = newCfg.DocName; printerCfg.BarcodeType = newCfg.BarcodeType; printerCfg.BarcodeLeft = newCfg.BarcodeLeft; printerCfg.BarcodeTop = newCfg.BarcodeTop; printerCfg.BarcodeWidth = newCfg.BarcodeWidth; printerCfg.BarcodeHeight = newCfg.BarcodeHeight; + printerCfg.YearFolders = newCfg.YearFolders; + printerCfg.MonthFolders = newCfg.MonthFolders; + printerCfg.DayFolders = newCfg.DayFolders; - ApplyConfig(); + ApplyConfig(); } } }; } - #endregion Configuration Change Handling + #endregion Configuration Change Handling + /// + /// Returns a file name derived from a DateTime structure. + /// Creates directories on this path as a side effect. + /// + /// Date and time + /// File name + string GetFilename(string destinationPath, DateTime time) + { + string directory = destinationPath; /// Ends with "\\"; - /// - /// Prints the test cycle results, Events: Event.ResultsPrinted - /// - /// Batch results to print - /// Reference to the operation + switch (printerCfg.YearFolders) + { + case YearFolders.FourDigit: + directory = string.Format("{0}{1:yyyy}\\", directory, time); + break; + case YearFolders.TwoDigit: + directory = string.Format("{0}{1:yy}\\", directory, time); + break; + } + + switch (printerCfg.MonthFolders) + { + case MonthFolders.Name: + { + string monthStr; + switch (time.Month) + { + default: + case 1: monthStr = "January"; break; + case 2: monthStr = "February"; break; + case 3: monthStr = "March"; break; + case 4: monthStr = "April"; break; + case 5: monthStr = "May"; break; + case 6: monthStr = "June"; break; + case 7: monthStr = "July"; break; + case 8: monthStr = "August"; break; + case 9: monthStr = "September"; break; + case 10: monthStr = "October"; break; + case 11: monthStr = "November"; break; + case 12: monthStr = "December"; break; + } + directory = string.Format("{0}{1}\\", directory, monthStr); + break; + } + case MonthFolders.Digit: + directory = string.Format("{0}{1}\\", directory, time.Month.ToString()); + break; + case MonthFolders.TwoDigit: + directory = string.Format("{0}{1:MM}\\", directory, time); + break; + } + + switch (printerCfg.DayFolders) + { + case DayFolders.Digit: + directory = string.Format("{0}{1}\\", directory, time.Day.ToString()); + break; + case DayFolders.TwoDigit: + directory = string.Format("{0}{1:dd}\\", directory, time); + break; + } + + Directory.CreateDirectory(directory); + + return directory; + + /*try + { + if (string.IsNullOrEmpty(printerCfg.FileNameFormat)) throw new Exception(); + return directory + string.Format(printerCfg.FileNameFormat, time); + } + catch + { + return string.Format("{0}{1:yyMMdd-HHmm}.txt", directory, time); + }*/ + } + + /// + /// Prints the test cycle results, Events: Event.ResultsPrinted + /// + /// Batch results to print + /// Reference to the operation public IOperation ProcessResultsOp(Batch batch) { this.batch = batch; @@ -181,15 +264,19 @@ namespace TBF.Rig.Output.Printers.OnePerMeter string documentName; try { - if (string.IsNullOrEmpty(printerCfg.DocName)) throw (new Exception()); - documentName = string.Format(printerCfg.DocName, wm.StartTime(), wm.EndTime(), wm.BatchNr(), wm.WMPosition, wm.SerialNr); + if (string.IsNullOrEmpty(printerCfg.FileNameFormat)) throw (new Exception()); + documentName = string.Format(printerCfg.FileNameFormat, wm.StartTime(), wm.EndTime(), wm.BatchNr(), wm.WMPosition, wm.SerialNr, wm.BenchId()); } catch { documentName = string.Format("{0}-{1}", batch.BatchNr, wm.WMPosition); } - PrintResults(batch, wm, documentName); + if (string.IsNullOrEmpty(printerCfg.DestinationPath)) throw (new Exception()); + PrintResults(batch, wm, documentName, printerCfg.DestinationPath, "print"); + + if (!string.IsNullOrEmpty(printerCfg.DestinationPath2)) + PrintResults(batch, wm, documentName, printerCfg.DestinationPath2, "print"); } } @@ -209,8 +296,17 @@ namespace TBF.Rig.Output.Printers.OnePerMeter { } + string UpdatePathAndCreateFolderByEndTime(Batch batch, string destination) + { + if (!string.IsNullOrEmpty(destination)) + { + return GetFilename(destination, batch.EndTime); + } - void PrintResults(Batch batch, WaterMeter wm, string documentName) + return ""; + } + + public void PrintResults(Batch batch, WaterMeter wm, string documentName, string destination, string whoCall) { OnePerMeterPrinterCfg cfg = new OnePerMeterPrinterCfg { PageOrientation = printerCfg.PageOrientation, @@ -269,8 +365,177 @@ namespace TBF.Rig.Output.Printers.OnePerMeter }; var pd = new OnePerMeterPrintDocument(batch, cfg, wm, documentName); + + //...MF + string destinationFolder = destination; + //if (!string.IsNullOrEmpty(printerCfg.PrinterName)) pd.PrinterSettings.PrinterName = printerCfg.PrinterName; + //pd.Print(); + + // If you already have printer name in config, keep this + if (!string.IsNullOrEmpty(printerCfg.PrinterName)) + pd.PrinterSettings.PrinterName = printerCfg.PrinterName; + + if (IsMicrosoftPdfPrinter(pd.PrinterSettings)) + { + // Validate destination folder text + if (string.IsNullOrWhiteSpace(destinationFolder)) + { + MessageBox.Show( + "Destination folder for PDF is not set.\n\nPlease select a folder before printing to PDF.", + "PDF destination not set", + MessageBoxButtons.OK, + MessageBoxIcon.Warning); + return; + } + + try + { + destinationFolder = UpdatePathAndCreateFolderByEndTime(batch, destinationFolder); + // Ensure destination folder exists (create if missing) + if (!Directory.Exists(destinationFolder)) + Directory.CreateDirectory(destinationFolder); + } + catch (Exception ex) + { + MessageBox.Show( + "Failed to create or access the destination folder:\n" + + destinationFolder + "\n\n" + + "Error: " + ex.Message, + "Destination folder error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + return; + } + + // Build full PDF path: Destination\DocumentName.pdf + string fileName = documentName; + if (!fileName.EndsWith(".pdf", StringComparison.OrdinalIgnoreCase)) + fileName += ".pdf"; + + printerCfg.DocName = fileName; + + if (fileName.Contains(" ")) + { + MessageBox.Show( + "The generated PDF file name contains spaces:\n\n" + + fileName + "\n\n" + + "Microsoft Print to PDF may not be able to save the file correctly " + + "when the file name contains spaces.\n" + + "Please remove spaces from the file name.", + "Invalid PDF file name", + MessageBoxButtons.OK, + MessageBoxIcon.Warning); + + return; + } + + string fullPath = Path.Combine(destinationFolder, fileName); + + // Extra validation: path must be absolute and with .pdf extension + if (!Path.IsPathRooted(fullPath)) + { + MessageBox.Show( + "The generated PDF file path is not valid:\n" + fullPath, + "Invalid PDF path", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + return; + } + + // Tell printer to print directly to file (no Save dialog) + pd.PrinterSettings.PrintToFile = true; + pd.PrinterSettings.PrintFileName = fullPath; + + // Suppress default print status dialog + //pd.PrintController = new StandardPrintController(); + + try + { + // 1) Show preview + if (whoCall.Equals("preview")) + ShowPreview(batch, cfg, wm, documentName); + else + pd.Print(); + } + catch (Exception ex) + { + MessageBox.Show( + "Printing to PDF failed.\n\n" + + "Target file:\n" + fullPath + "\n\n" + + "Error: " + ex.Message, + "PDF printing error - target folder not exists.", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + else + { + // Non-PDF printer – normal printing + try + { + + // 1) Show preview + if (whoCall.Equals("preview")) + ShowPreview(batch, cfg, wm, documentName); + + else + // 2) If you want an extra confirmation before real printing: + if (MessageBox.Show("Print this report to PDF?", + "Confirm printing", + MessageBoxButtons.YesNo, + MessageBoxIcon.Question) == DialogResult.Yes) + { + pd.Print(); + } + } + catch (Exception ex) + { + MessageBox.Show( + "Print() failed.\n\nError: " + ex.Message, + "Printing error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + + /*var pd = new OnePerMeterPrintDocument(batch, cfg, wm, documentName); if (!string.IsNullOrEmpty(printerCfg.PrinterName)) pd.PrinterSettings.PrinterName = printerCfg.PrinterName; - pd.Print(); + pd.Print();*/ } - } + + private bool IsMicrosoftPdfPrinter(PrinterSettings settings) + { + if (settings == null) return false; + + // Check if the printer name contains "Microsoft Print to PDF" + return settings.PrinterName.IndexOf("Microsoft Print to PDF", + StringComparison.OrdinalIgnoreCase) >= 0; + } + + private void ShowPreview(Results.Entities.Batch batch, + OnePerMeterPrinterCfg cfg, + Results.Entities.WaterMeter wm, + string documentName) + { + using (var pd = new OnePerMeterPrintDocument(batch, cfg, wm, documentName)) + using (var preview = new PrintPreviewDialog()) + { + preview.Document = pd; + preview.WindowState = FormWindowState.Maximized; // fullscreen preview + preview.ShowIcon = false; + preview.Text = "Preview – " + documentName; + + preview.ShowDialog(); // user can zoom, scroll, print from toolbar + } + } + + private void PrintToPdf(Results.Entities.Batch batch, + OnePerMeterPrinterCfg cfg, + Results.Entities.WaterMeter wm, + string documentName, + string destinationFolder) + { + + } + } } diff --git a/TBF/Rig/Output/Printers/OnePerMeter/PrinterCfg.cs b/TBF/Rig/Output/Printers/OnePerMeter/PrinterCfg.cs index 72e5dbaed..b514ff344 100644 --- a/TBF/Rig/Output/Printers/OnePerMeter/PrinterCfg.cs +++ b/TBF/Rig/Output/Printers/OnePerMeter/PrinterCfg.cs @@ -1,11 +1,12 @@ -/// +using Common; +using Config.Entities; +/// /// Copyright (c) 2017-2023 Sensus Slovensko a.s. /// using System.Collections.Generic; using System.Xml.Serialization; -using Common; -using Config.Entities; using TBF.Rig.Generic; +using TBF.Rig.Output.FileWriters; namespace TBF.Rig.Output.Printers.OnePerMeter { @@ -16,9 +17,15 @@ namespace TBF.Rig.Output.Printers.OnePerMeter public IComponentCfgCtrl GetControl(IList cmpntEntities) { return new PrinterCfgCtrl(); } - /// - /// Serialized parameters - /// + /// + /// Serialized parameters + /// + public string DestinationPath; /// Directory path into which the results will be saved + public string DestinationPath2; /// Directory path into which the 2nd copy of results will be saved + public YearFolders YearFolders; + public MonthFolders MonthFolders; + public DayFolders DayFolders; + public string FileNameFormat; public string PrinterName; public PageOrientation PageOrientation; public string Template; @@ -83,8 +90,8 @@ namespace TBF.Rig.Output.Printers.OnePerMeter [XmlIgnore] public MetersKind MetersKind; - /// Private parameterless constructor invoked by all other (public) constructors - PrinterCfg() + /// Private parameterless constructor invoked by all other (public) constructors + PrinterCfg() { } diff --git a/TBF/Rig/Output/Printers/OnePerMeter/PrinterCfgCtrl.Designer.cs b/TBF/Rig/Output/Printers/OnePerMeter/PrinterCfgCtrl.Designer.cs index de46be9ab..c3adf6a74 100644 --- a/TBF/Rig/Output/Printers/OnePerMeter/PrinterCfgCtrl.Designer.cs +++ b/TBF/Rig/Output/Printers/OnePerMeter/PrinterCfgCtrl.Designer.cs @@ -66,8 +66,6 @@ namespace TBF.Rig.Output.Printers.OnePerMeter this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox(); this.templateTextBox = new System.Windows.Forms.TextBox(); this.templateLabel = new System.Windows.Forms.Label(); - this.docNameLabel = new System.Windows.Forms.Label(); - this.docNameTextBox = new System.Windows.Forms.TextBox(); this.footerItalicCheckBox = new System.Windows.Forms.CheckBox(); this.footerBoldCheckBox = new System.Windows.Forms.CheckBox(); this.footerFontSizeTextBox = new System.Windows.Forms.TextBox(); @@ -106,7 +104,6 @@ namespace TBF.Rig.Output.Printers.OnePerMeter this.graphWidthTextBox = new System.Windows.Forms.TextBox(); this.graphTopTextBox = new System.Windows.Forms.TextBox(); this.graphLeftTextBox = new System.Windows.Forms.TextBox(); - this.label14 = new System.Windows.Forms.Label(); this.barcodeLabel = new System.Windows.Forms.Label(); this.barcodeHeightTextBox = new System.Windows.Forms.TextBox(); this.barcodeWidthTextBox = new System.Windows.Forms.TextBox(); @@ -117,24 +114,42 @@ namespace TBF.Rig.Output.Printers.OnePerMeter this.selectPrinterButton = new System.Windows.Forms.Button(); this.printerLabel = new System.Windows.Forms.Label(); this.tableAlignmentComboBox = new System.Windows.Forms.ComboBox(); + this.fileNameFmtTextBox = new System.Windows.Forms.TextBox(); + this.fileNameFmtLabel = new System.Windows.Forms.Label(); + this.destination2Button = new System.Windows.Forms.Button(); + this.destination2TextBox = new System.Windows.Forms.TextBox(); + this.destination2Label = new System.Windows.Forms.Label(); + this.dayFoldersComboBox = new System.Windows.Forms.ComboBox(); + this.monthFoldersComboBox = new System.Windows.Forms.ComboBox(); + this.yearFoldersComboBox = new System.Windows.Forms.ComboBox(); + this.dayFoldersLabel = new System.Windows.Forms.Label(); + this.monthFoldersLabel = new System.Windows.Forms.Label(); + this.yearFoldersLabel = new System.Windows.Forms.Label(); + this.destinationButton = new System.Windows.Forms.Button(); + this.destinationTextBox = new System.Windows.Forms.TextBox(); + this.destinationLabel = new System.Windows.Forms.Label(); + this.posibleParams1ComboBox = new System.Windows.Forms.ComboBox(); + this.previewButton = new System.Windows.Forms.Button(); + this.documentNameLabel = new System.Windows.Forms.Label(); + this.documentNameTextBox = new System.Windows.Forms.TextBox(); + this.generateDocNameButton = new System.Windows.Forms.Button(); + this.saveComponentButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // nameTextBox // this.nameTextBox.Enabled = false; - this.nameTextBox.Location = new System.Drawing.Point(189, 4); - this.nameTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.nameTextBox.Location = new System.Drawing.Point(142, 3); this.nameTextBox.Name = "nameTextBox"; - this.nameTextBox.Size = new System.Drawing.Size(193, 22); + this.nameTextBox.Size = new System.Drawing.Size(146, 20); this.nameTextBox.TabIndex = 2; // // nameLabel // this.nameLabel.AutoSize = true; - this.nameLabel.Location = new System.Drawing.Point(21, 7); - this.nameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.nameLabel.Location = new System.Drawing.Point(16, 6); this.nameLabel.Name = "nameLabel"; - this.nameLabel.Size = new System.Drawing.Size(44, 16); + this.nameLabel.Size = new System.Drawing.Size(35, 13); this.nameLabel.TabIndex = 1; this.nameLabel.Text = "Name"; // @@ -142,10 +157,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.supressPrintingCheckBox.AutoSize = true; this.supressPrintingCheckBox.Enabled = false; - this.supressPrintingCheckBox.Location = new System.Drawing.Point(476, 114); - this.supressPrintingCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.supressPrintingCheckBox.Location = new System.Drawing.Point(358, 223); this.supressPrintingCheckBox.Name = "supressPrintingCheckBox"; - this.supressPrintingCheckBox.Size = new System.Drawing.Size(125, 20); + this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17); this.supressPrintingCheckBox.TabIndex = 33; this.supressPrintingCheckBox.Text = "Supress printing"; this.supressPrintingCheckBox.UseVisualStyleBackColor = true; @@ -153,10 +167,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // orientationLabel // this.orientationLabel.AutoSize = true; - this.orientationLabel.Location = new System.Drawing.Point(21, 86); - this.orientationLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.orientationLabel.Location = new System.Drawing.Point(17, 200); this.orientationLabel.Name = "orientationLabel"; - this.orientationLabel.Size = new System.Drawing.Size(105, 16); + this.orientationLabel.Size = new System.Drawing.Size(84, 13); this.orientationLabel.TabIndex = 5; this.orientationLabel.Text = "Page orientation"; // @@ -164,76 +177,68 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.orientationComboBox.Enabled = false; this.orientationComboBox.FormattingEnabled = true; - this.orientationComboBox.Location = new System.Drawing.Point(189, 82); - this.orientationComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.orientationComboBox.Location = new System.Drawing.Point(143, 197); this.orientationComboBox.Name = "orientationComboBox"; - this.orientationComboBox.Size = new System.Drawing.Size(193, 24); + this.orientationComboBox.Size = new System.Drawing.Size(146, 21); this.orientationComboBox.TabIndex = 6; // // topMarginTextBox // this.topMarginTextBox.Enabled = false; - this.topMarginTextBox.Location = new System.Drawing.Point(189, 110); - this.topMarginTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.topMarginTextBox.Location = new System.Drawing.Point(143, 219); this.topMarginTextBox.Name = "topMarginTextBox"; - this.topMarginTextBox.Size = new System.Drawing.Size(57, 22); + this.topMarginTextBox.Size = new System.Drawing.Size(44, 20); this.topMarginTextBox.TabIndex = 8; // // topMarginLabel // this.topMarginLabel.AutoSize = true; - this.topMarginLabel.Location = new System.Drawing.Point(21, 112); - this.topMarginLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.topMarginLabel.Location = new System.Drawing.Point(17, 221); this.topMarginLabel.Name = "topMarginLabel"; - this.topMarginLabel.Size = new System.Drawing.Size(142, 16); + this.topMarginLabel.Size = new System.Drawing.Size(116, 13); this.topMarginLabel.TabIndex = 7; this.topMarginLabel.Text = "Top/bottom/left margin"; // // leftMarginTextBox // this.leftMarginTextBox.Enabled = false; - this.leftMarginTextBox.Location = new System.Drawing.Point(325, 110); - this.leftMarginTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.leftMarginTextBox.Location = new System.Drawing.Point(245, 219); this.leftMarginTextBox.Name = "leftMarginTextBox"; - this.leftMarginTextBox.Size = new System.Drawing.Size(57, 22); + this.leftMarginTextBox.Size = new System.Drawing.Size(44, 20); this.leftMarginTextBox.TabIndex = 10; // // bottomMarginTextBox // this.bottomMarginTextBox.Enabled = false; - this.bottomMarginTextBox.Location = new System.Drawing.Point(257, 110); - this.bottomMarginTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.bottomMarginTextBox.Location = new System.Drawing.Point(194, 219); this.bottomMarginTextBox.Name = "bottomMarginTextBox"; - this.bottomMarginTextBox.Size = new System.Drawing.Size(57, 22); + this.bottomMarginTextBox.Size = new System.Drawing.Size(44, 20); this.bottomMarginTextBox.TabIndex = 9; // // cultureComboBox // this.cultureComboBox.Enabled = false; this.cultureComboBox.FormattingEnabled = true; - this.cultureComboBox.Location = new System.Drawing.Point(189, 240); - this.cultureComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cultureComboBox.Location = new System.Drawing.Point(143, 325); this.cultureComboBox.Name = "cultureComboBox"; - this.cultureComboBox.Size = new System.Drawing.Size(145, 24); + this.cultureComboBox.Size = new System.Drawing.Size(110, 21); this.cultureComboBox.TabIndex = 32; // // cultureLabel // this.cultureLabel.AutoSize = true; - this.cultureLabel.Location = new System.Drawing.Point(21, 246); - this.cultureLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.cultureLabel.Location = new System.Drawing.Point(17, 330); this.cultureLabel.Name = "cultureLabel"; - this.cultureLabel.Size = new System.Drawing.Size(51, 16); + this.cultureLabel.Size = new System.Drawing.Size(42, 13); this.cultureLabel.TabIndex = 31; this.cultureLabel.Text = "Cullture"; // // footerButton // this.footerButton.Enabled = false; - this.footerButton.Location = new System.Drawing.Point(388, 354); - this.footerButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.footerButton.Location = new System.Drawing.Point(292, 418); this.footerButton.Name = "footerButton"; - this.footerButton.Size = new System.Drawing.Size(133, 25); + this.footerButton.Size = new System.Drawing.Size(100, 20); this.footerButton.TabIndex = 41; this.footerButton.Text = "Footer"; this.footerButton.UseVisualStyleBackColor = true; @@ -242,10 +247,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // headerButton // this.headerButton.Enabled = false; - this.headerButton.Location = new System.Drawing.Point(388, 238); - this.headerButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.headerButton.Location = new System.Drawing.Point(292, 323); this.headerButton.Name = "headerButton"; - this.headerButton.Size = new System.Drawing.Size(133, 25); + this.headerButton.Size = new System.Drawing.Size(100, 20); this.headerButton.TabIndex = 37; this.headerButton.Text = "Title"; this.headerButton.UseVisualStyleBackColor = true; @@ -254,10 +258,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // testItemsButton // this.testItemsButton.Enabled = false; - this.testItemsButton.Location = new System.Drawing.Point(388, 284); - this.testItemsButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.testItemsButton.Location = new System.Drawing.Point(292, 361); this.testItemsButton.Name = "testItemsButton"; - this.testItemsButton.Size = new System.Drawing.Size(133, 25); + this.testItemsButton.Size = new System.Drawing.Size(100, 20); this.testItemsButton.TabIndex = 39; this.testItemsButton.Text = "1st table"; this.testItemsButton.UseVisualStyleBackColor = true; @@ -266,20 +269,18 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // headerFontLabel // this.headerFontLabel.AutoSize = true; - this.headerFontLabel.Location = new System.Drawing.Point(21, 165); - this.headerFontLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.headerFontLabel.Location = new System.Drawing.Point(17, 264); this.headerFontLabel.Name = "headerFontLabel"; - this.headerFontLabel.Size = new System.Drawing.Size(137, 16); + this.headerFontLabel.Size = new System.Drawing.Size(112, 13); this.headerFontLabel.TabIndex = 16; this.headerFontLabel.Text = "Header font/size/style"; // // titleFontLabel // this.titleFontLabel.AutoSize = true; - this.titleFontLabel.Location = new System.Drawing.Point(21, 139); - this.titleFontLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.titleFontLabel.Location = new System.Drawing.Point(17, 243); this.titleFontLabel.Name = "titleFontLabel"; - this.titleFontLabel.Size = new System.Drawing.Size(117, 16); + this.titleFontLabel.Size = new System.Drawing.Size(97, 13); this.titleFontLabel.TabIndex = 11; this.titleFontLabel.Text = "Title font/size/style"; // @@ -287,77 +288,69 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.titleFontFamilyComboBox.Enabled = false; this.titleFontFamilyComboBox.FormattingEnabled = true; - this.titleFontFamilyComboBox.Location = new System.Drawing.Point(189, 135); - this.titleFontFamilyComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.titleFontFamilyComboBox.Location = new System.Drawing.Point(143, 240); this.titleFontFamilyComboBox.Name = "titleFontFamilyComboBox"; - this.titleFontFamilyComboBox.Size = new System.Drawing.Size(145, 24); + this.titleFontFamilyComboBox.Size = new System.Drawing.Size(110, 21); this.titleFontFamilyComboBox.TabIndex = 12; // // headerFontFamilyComboBox // this.headerFontFamilyComboBox.Enabled = false; this.headerFontFamilyComboBox.FormattingEnabled = true; - this.headerFontFamilyComboBox.Location = new System.Drawing.Point(189, 161); - this.headerFontFamilyComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.headerFontFamilyComboBox.Location = new System.Drawing.Point(143, 261); this.headerFontFamilyComboBox.Name = "headerFontFamilyComboBox"; - this.headerFontFamilyComboBox.Size = new System.Drawing.Size(145, 24); + this.headerFontFamilyComboBox.Size = new System.Drawing.Size(110, 21); this.headerFontFamilyComboBox.TabIndex = 17; // // bodyFontFamilyComboBox // this.bodyFontFamilyComboBox.Enabled = false; this.bodyFontFamilyComboBox.FormattingEnabled = true; - this.bodyFontFamilyComboBox.Location = new System.Drawing.Point(189, 187); - this.bodyFontFamilyComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.bodyFontFamilyComboBox.Location = new System.Drawing.Point(143, 282); this.bodyFontFamilyComboBox.Name = "bodyFontFamilyComboBox"; - this.bodyFontFamilyComboBox.Size = new System.Drawing.Size(145, 24); + this.bodyFontFamilyComboBox.Size = new System.Drawing.Size(110, 21); this.bodyFontFamilyComboBox.TabIndex = 22; // // bodyFontLabel // this.bodyFontLabel.AutoSize = true; - this.bodyFontLabel.Location = new System.Drawing.Point(21, 191); - this.bodyFontLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.bodyFontLabel.Location = new System.Drawing.Point(17, 285); this.bodyFontLabel.Name = "bodyFontLabel"; - this.bodyFontLabel.Size = new System.Drawing.Size(123, 16); + this.bodyFontLabel.Size = new System.Drawing.Size(101, 13); this.bodyFontLabel.TabIndex = 21; this.bodyFontLabel.Text = "Body font/size/style"; // // titleFontSizeTextBox // this.titleFontSizeTextBox.Enabled = false; - this.titleFontSizeTextBox.Location = new System.Drawing.Point(344, 135); - this.titleFontSizeTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.titleFontSizeTextBox.Location = new System.Drawing.Point(259, 240); this.titleFontSizeTextBox.Name = "titleFontSizeTextBox"; - this.titleFontSizeTextBox.Size = new System.Drawing.Size(39, 22); + this.titleFontSizeTextBox.Size = new System.Drawing.Size(30, 20); this.titleFontSizeTextBox.TabIndex = 13; // // headerFontSizeTextBox // this.headerFontSizeTextBox.Enabled = false; - this.headerFontSizeTextBox.Location = new System.Drawing.Point(344, 161); - this.headerFontSizeTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.headerFontSizeTextBox.Location = new System.Drawing.Point(259, 261); this.headerFontSizeTextBox.Name = "headerFontSizeTextBox"; - this.headerFontSizeTextBox.Size = new System.Drawing.Size(39, 22); + this.headerFontSizeTextBox.Size = new System.Drawing.Size(30, 20); this.headerFontSizeTextBox.TabIndex = 18; // // bodyFontSizeTextBox // this.bodyFontSizeTextBox.Enabled = false; - this.bodyFontSizeTextBox.Location = new System.Drawing.Point(344, 187); - this.bodyFontSizeTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.bodyFontSizeTextBox.Location = new System.Drawing.Point(259, 282); this.bodyFontSizeTextBox.Name = "bodyFontSizeTextBox"; - this.bodyFontSizeTextBox.Size = new System.Drawing.Size(39, 22); + this.bodyFontSizeTextBox.Size = new System.Drawing.Size(30, 20); this.bodyFontSizeTextBox.TabIndex = 23; // // titleBoldCheckBox // this.titleBoldCheckBox.AutoSize = true; this.titleBoldCheckBox.Enabled = false; - this.titleBoldCheckBox.Location = new System.Drawing.Point(408, 139); - this.titleBoldCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.titleBoldCheckBox.Location = new System.Drawing.Point(307, 243); this.titleBoldCheckBox.Name = "titleBoldCheckBox"; - this.titleBoldCheckBox.Size = new System.Drawing.Size(18, 17); + this.titleBoldCheckBox.Size = new System.Drawing.Size(15, 14); this.titleBoldCheckBox.TabIndex = 14; this.titleBoldCheckBox.UseVisualStyleBackColor = true; // @@ -365,10 +358,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.titleItalicCheckBox.AutoSize = true; this.titleItalicCheckBox.Enabled = false; - this.titleItalicCheckBox.Location = new System.Drawing.Point(441, 139); - this.titleItalicCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.titleItalicCheckBox.Location = new System.Drawing.Point(332, 243); this.titleItalicCheckBox.Name = "titleItalicCheckBox"; - this.titleItalicCheckBox.Size = new System.Drawing.Size(18, 17); + this.titleItalicCheckBox.Size = new System.Drawing.Size(15, 14); this.titleItalicCheckBox.TabIndex = 15; this.titleItalicCheckBox.UseVisualStyleBackColor = true; // @@ -376,10 +368,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.headerItalicCheckBox.AutoSize = true; this.headerItalicCheckBox.Enabled = false; - this.headerItalicCheckBox.Location = new System.Drawing.Point(441, 165); - this.headerItalicCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.headerItalicCheckBox.Location = new System.Drawing.Point(332, 264); this.headerItalicCheckBox.Name = "headerItalicCheckBox"; - this.headerItalicCheckBox.Size = new System.Drawing.Size(18, 17); + this.headerItalicCheckBox.Size = new System.Drawing.Size(15, 14); this.headerItalicCheckBox.TabIndex = 20; this.headerItalicCheckBox.UseVisualStyleBackColor = true; // @@ -387,10 +378,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.headerBoldCheckBox.AutoSize = true; this.headerBoldCheckBox.Enabled = false; - this.headerBoldCheckBox.Location = new System.Drawing.Point(408, 165); - this.headerBoldCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.headerBoldCheckBox.Location = new System.Drawing.Point(307, 264); this.headerBoldCheckBox.Name = "headerBoldCheckBox"; - this.headerBoldCheckBox.Size = new System.Drawing.Size(18, 17); + this.headerBoldCheckBox.Size = new System.Drawing.Size(15, 14); this.headerBoldCheckBox.TabIndex = 19; this.headerBoldCheckBox.UseVisualStyleBackColor = true; // @@ -398,10 +388,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.bodyItalicCheckBox.AutoSize = true; this.bodyItalicCheckBox.Enabled = false; - this.bodyItalicCheckBox.Location = new System.Drawing.Point(441, 191); - this.bodyItalicCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.bodyItalicCheckBox.Location = new System.Drawing.Point(332, 285); this.bodyItalicCheckBox.Name = "bodyItalicCheckBox"; - this.bodyItalicCheckBox.Size = new System.Drawing.Size(18, 17); + this.bodyItalicCheckBox.Size = new System.Drawing.Size(15, 14); this.bodyItalicCheckBox.TabIndex = 25; this.bodyItalicCheckBox.UseVisualStyleBackColor = true; // @@ -409,10 +398,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.bodyBoldCheckBox.AutoSize = true; this.bodyBoldCheckBox.Enabled = false; - this.bodyBoldCheckBox.Location = new System.Drawing.Point(408, 191); - this.bodyBoldCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.bodyBoldCheckBox.Location = new System.Drawing.Point(307, 285); this.bodyBoldCheckBox.Name = "bodyBoldCheckBox"; - this.bodyBoldCheckBox.Size = new System.Drawing.Size(18, 17); + this.bodyBoldCheckBox.Size = new System.Drawing.Size(15, 14); this.bodyBoldCheckBox.TabIndex = 24; this.bodyBoldCheckBox.UseVisualStyleBackColor = true; // @@ -420,10 +408,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.label1.Location = new System.Drawing.Point(395, 119); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(297, 227); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(40, 17); + this.label1.Size = new System.Drawing.Size(32, 13); this.label1.TabIndex = 37; this.label1.Text = "Bold"; // @@ -431,20 +418,18 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.label2.Location = new System.Drawing.Point(436, 119); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Location = new System.Drawing.Point(328, 227); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(30, 17); + this.label2.Size = new System.Drawing.Size(24, 13); this.label2.TabIndex = 38; this.label2.Text = "Ital."; // // testItems2Button // this.testItems2Button.Enabled = false; - this.testItems2Button.Location = new System.Drawing.Point(388, 308); - this.testItems2Button.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.testItems2Button.Location = new System.Drawing.Point(292, 380); this.testItems2Button.Name = "testItems2Button"; - this.testItems2Button.Size = new System.Drawing.Size(133, 25); + this.testItems2Button.Size = new System.Drawing.Size(100, 20); this.testItems2Button.TabIndex = 40; this.testItems2Button.Text = "2nd table"; this.testItems2Button.UseVisualStyleBackColor = true; @@ -454,10 +439,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.goodOnlyCheckBox.AutoSize = true; this.goodOnlyCheckBox.Enabled = false; - this.goodOnlyCheckBox.Location = new System.Drawing.Point(476, 132); - this.goodOnlyCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.goodOnlyCheckBox.Location = new System.Drawing.Point(358, 237); this.goodOnlyCheckBox.Name = "goodOnlyCheckBox"; - this.goodOnlyCheckBox.Size = new System.Drawing.Size(91, 20); + this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17); this.goodOnlyCheckBox.TabIndex = 34; this.goodOnlyCheckBox.Text = "Good only"; this.goodOnlyCheckBox.UseVisualStyleBackColor = true; @@ -465,49 +449,27 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // templateTextBox // this.templateTextBox.Enabled = false; - this.templateTextBox.Location = new System.Drawing.Point(189, 57); - this.templateTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.templateTextBox.Location = new System.Drawing.Point(143, 176); this.templateTextBox.Name = "templateTextBox"; - this.templateTextBox.Size = new System.Drawing.Size(193, 22); + this.templateTextBox.Size = new System.Drawing.Size(146, 20); this.templateTextBox.TabIndex = 4; // // templateLabel // this.templateLabel.AutoSize = true; - this.templateLabel.Location = new System.Drawing.Point(21, 60); - this.templateLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.templateLabel.Location = new System.Drawing.Point(17, 179); this.templateLabel.Name = "templateLabel"; - this.templateLabel.Size = new System.Drawing.Size(65, 16); + this.templateLabel.Size = new System.Drawing.Size(51, 13); this.templateLabel.TabIndex = 3; this.templateLabel.Text = "Template"; // - // docNameLabel - // - this.docNameLabel.AutoSize = true; - this.docNameLabel.Location = new System.Drawing.Point(396, 57); - this.docNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.docNameLabel.Name = "docNameLabel"; - this.docNameLabel.Size = new System.Drawing.Size(155, 16); - this.docNameLabel.TabIndex = 42; - this.docNameLabel.Text = "Doc.name (0=start 1-end,"; - // - // docNameTextBox - // - this.docNameTextBox.Enabled = false; - this.docNameTextBox.Location = new System.Drawing.Point(403, 89); - this.docNameTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.docNameTextBox.Name = "docNameTextBox"; - this.docNameTextBox.Size = new System.Drawing.Size(200, 22); - this.docNameTextBox.TabIndex = 43; - // // footerItalicCheckBox // this.footerItalicCheckBox.AutoSize = true; this.footerItalicCheckBox.Enabled = false; - this.footerItalicCheckBox.Location = new System.Drawing.Point(441, 217); - this.footerItalicCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.footerItalicCheckBox.Location = new System.Drawing.Point(332, 306); this.footerItalicCheckBox.Name = "footerItalicCheckBox"; - this.footerItalicCheckBox.Size = new System.Drawing.Size(18, 17); + this.footerItalicCheckBox.Size = new System.Drawing.Size(15, 14); this.footerItalicCheckBox.TabIndex = 30; this.footerItalicCheckBox.UseVisualStyleBackColor = true; // @@ -515,181 +477,162 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.footerBoldCheckBox.AutoSize = true; this.footerBoldCheckBox.Enabled = false; - this.footerBoldCheckBox.Location = new System.Drawing.Point(408, 217); - this.footerBoldCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.footerBoldCheckBox.Location = new System.Drawing.Point(307, 306); this.footerBoldCheckBox.Name = "footerBoldCheckBox"; - this.footerBoldCheckBox.Size = new System.Drawing.Size(18, 17); + this.footerBoldCheckBox.Size = new System.Drawing.Size(15, 14); this.footerBoldCheckBox.TabIndex = 29; this.footerBoldCheckBox.UseVisualStyleBackColor = true; // // footerFontSizeTextBox // this.footerFontSizeTextBox.Enabled = false; - this.footerFontSizeTextBox.Location = new System.Drawing.Point(344, 213); - this.footerFontSizeTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.footerFontSizeTextBox.Location = new System.Drawing.Point(259, 303); this.footerFontSizeTextBox.Name = "footerFontSizeTextBox"; - this.footerFontSizeTextBox.Size = new System.Drawing.Size(39, 22); + this.footerFontSizeTextBox.Size = new System.Drawing.Size(30, 20); this.footerFontSizeTextBox.TabIndex = 28; // // footerFontFamilyComboBox // this.footerFontFamilyComboBox.Enabled = false; this.footerFontFamilyComboBox.FormattingEnabled = true; - this.footerFontFamilyComboBox.Location = new System.Drawing.Point(189, 213); - this.footerFontFamilyComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.footerFontFamilyComboBox.Location = new System.Drawing.Point(143, 303); this.footerFontFamilyComboBox.Name = "footerFontFamilyComboBox"; - this.footerFontFamilyComboBox.Size = new System.Drawing.Size(145, 24); + this.footerFontFamilyComboBox.Size = new System.Drawing.Size(110, 21); this.footerFontFamilyComboBox.TabIndex = 27; // // footerFontLabel // this.footerFontLabel.AutoSize = true; - this.footerFontLabel.Location = new System.Drawing.Point(21, 217); - this.footerFontLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.footerFontLabel.Location = new System.Drawing.Point(17, 306); this.footerFontLabel.Name = "footerFontLabel"; - this.footerFontLabel.Size = new System.Drawing.Size(130, 16); + this.footerFontLabel.Size = new System.Drawing.Size(107, 13); this.footerFontLabel.TabIndex = 26; this.footerFontLabel.Text = "Footer font/size/style"; // // imageNameTextBox // this.imageNameTextBox.Enabled = false; - this.imageNameTextBox.Location = new System.Drawing.Point(383, 379); - this.imageNameTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.imageNameTextBox.Location = new System.Drawing.Point(288, 438); this.imageNameTextBox.Name = "imageNameTextBox"; - this.imageNameTextBox.Size = new System.Drawing.Size(220, 22); + this.imageNameTextBox.Size = new System.Drawing.Size(166, 20); this.imageNameTextBox.TabIndex = 44; // // imageLeftTextBox // this.imageLeftTextBox.Enabled = false; - this.imageLeftTextBox.Location = new System.Drawing.Point(188, 380); - this.imageLeftTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.imageLeftTextBox.Location = new System.Drawing.Point(142, 439); this.imageLeftTextBox.Name = "imageLeftTextBox"; - this.imageLeftTextBox.Size = new System.Drawing.Size(43, 22); + this.imageLeftTextBox.Size = new System.Drawing.Size(33, 20); this.imageLeftTextBox.TabIndex = 46; // // imageTopTextBox // this.imageTopTextBox.Enabled = false; - this.imageTopTextBox.Location = new System.Drawing.Point(236, 380); - this.imageTopTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.imageTopTextBox.Location = new System.Drawing.Point(178, 439); this.imageTopTextBox.Name = "imageTopTextBox"; - this.imageTopTextBox.Size = new System.Drawing.Size(40, 22); + this.imageTopTextBox.Size = new System.Drawing.Size(31, 20); this.imageTopTextBox.TabIndex = 47; // // imageWidthTextBox // this.imageWidthTextBox.Enabled = false; - this.imageWidthTextBox.Location = new System.Drawing.Point(281, 380); - this.imageWidthTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.imageWidthTextBox.Location = new System.Drawing.Point(212, 439); this.imageWidthTextBox.Name = "imageWidthTextBox"; - this.imageWidthTextBox.Size = new System.Drawing.Size(40, 22); + this.imageWidthTextBox.Size = new System.Drawing.Size(31, 20); this.imageWidthTextBox.TabIndex = 48; // // imageHeightTextBox // this.imageHeightTextBox.Enabled = false; - this.imageHeightTextBox.Location = new System.Drawing.Point(327, 380); - this.imageHeightTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.imageHeightTextBox.Location = new System.Drawing.Point(246, 439); this.imageHeightTextBox.Name = "imageHeightTextBox"; - this.imageHeightTextBox.Size = new System.Drawing.Size(40, 22); + this.imageHeightTextBox.Size = new System.Drawing.Size(31, 20); this.imageHeightTextBox.TabIndex = 49; // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(23, 384); - this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label4.Location = new System.Drawing.Point(18, 442); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(133, 16); + this.label4.Size = new System.Drawing.Size(115, 13); this.label4.TabIndex = 50; this.label4.Text = "Image left/top/w/h/file"; // // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(73, 335); - this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label8.Location = new System.Drawing.Point(56, 402); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(280, 16); + this.label8.Size = new System.Drawing.Size(224, 13); this.label8.TabIndex = 57; this.label8.Text = "Graph and image coordinates are in 0.254 mm"; // // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(229, 273); - this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label6.Location = new System.Drawing.Point(173, 352); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(19, 16); + this.label6.Size = new System.Drawing.Size(15, 13); this.label6.TabIndex = 67; this.label6.Text = "%"; // // colW0TextBox // this.colW0TextBox.Enabled = false; - this.colW0TextBox.Location = new System.Drawing.Point(189, 270); - this.colW0TextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.colW0TextBox.Location = new System.Drawing.Point(143, 349); this.colW0TextBox.Name = "colW0TextBox"; - this.colW0TextBox.Size = new System.Drawing.Size(39, 22); + this.colW0TextBox.Size = new System.Drawing.Size(30, 20); this.colW0TextBox.TabIndex = 66; // // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(21, 273); - this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label5.Location = new System.Drawing.Point(17, 352); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(120, 16); + this.label5.Size = new System.Drawing.Size(97, 13); this.label5.TabIndex = 58; this.label5.Text = "Column widths in %"; // // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(352, 273); - this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label7.Location = new System.Drawing.Point(265, 352); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(19, 16); + this.label7.Size = new System.Drawing.Size(15, 13); this.label7.TabIndex = 62; this.label7.Text = "%"; // // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(291, 273); - this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label9.Location = new System.Drawing.Point(219, 352); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(19, 16); + this.label9.Size = new System.Drawing.Size(15, 13); this.label9.TabIndex = 60; this.label9.Text = "%"; // // colW2TextBox // this.colW2TextBox.Enabled = false; - this.colW2TextBox.Location = new System.Drawing.Point(312, 270); - this.colW2TextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.colW2TextBox.Location = new System.Drawing.Point(235, 349); this.colW2TextBox.Name = "colW2TextBox"; - this.colW2TextBox.Size = new System.Drawing.Size(39, 22); + this.colW2TextBox.Size = new System.Drawing.Size(30, 20); this.colW2TextBox.TabIndex = 61; // // colW1TextBox // this.colW1TextBox.Enabled = false; - this.colW1TextBox.Location = new System.Drawing.Point(251, 270); - this.colW1TextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.colW1TextBox.Location = new System.Drawing.Point(189, 349); this.colW1TextBox.Name = "colW1TextBox"; - this.colW1TextBox.Size = new System.Drawing.Size(39, 22); + this.colW1TextBox.Size = new System.Drawing.Size(30, 20); this.colW1TextBox.TabIndex = 59; // // commonItems3Button // this.commonItems3Button.Enabled = false; - this.commonItems3Button.Location = new System.Drawing.Point(529, 261); - this.commonItems3Button.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.commonItems3Button.Location = new System.Drawing.Point(398, 342); this.commonItems3Button.Name = "commonItems3Button"; - this.commonItems3Button.Size = new System.Drawing.Size(63, 25); + this.commonItems3Button.Size = new System.Drawing.Size(47, 20); this.commonItems3Button.TabIndex = 65; this.commonItems3Button.Text = "Col. 3"; this.commonItems3Button.UseVisualStyleBackColor = true; @@ -698,10 +641,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // commonItems2Button // this.commonItems2Button.Enabled = false; - this.commonItems2Button.Location = new System.Drawing.Point(459, 261); - this.commonItems2Button.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.commonItems2Button.Location = new System.Drawing.Point(345, 342); this.commonItems2Button.Name = "commonItems2Button"; - this.commonItems2Button.Size = new System.Drawing.Size(63, 25); + this.commonItems2Button.Size = new System.Drawing.Size(47, 20); this.commonItems2Button.TabIndex = 64; this.commonItems2Button.Text = "Col. 2"; this.commonItems2Button.UseVisualStyleBackColor = true; @@ -710,10 +652,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // commonItems1Button // this.commonItems1Button.Enabled = false; - this.commonItems1Button.Location = new System.Drawing.Point(388, 261); - this.commonItems1Button.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.commonItems1Button.Location = new System.Drawing.Point(292, 342); this.commonItems1Button.Name = "commonItems1Button"; - this.commonItems1Button.Size = new System.Drawing.Size(63, 25); + this.commonItems1Button.Size = new System.Drawing.Size(47, 20); this.commonItems1Button.TabIndex = 63; this.commonItems1Button.Text = "Col. 1"; this.commonItems1Button.UseVisualStyleBackColor = true; @@ -722,77 +663,69 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(229, 304); - this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label10.Location = new System.Drawing.Point(173, 377); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(19, 16); + this.label10.Size = new System.Drawing.Size(15, 13); this.label10.TabIndex = 74; this.label10.Text = "%"; // // belowW0TextBox // this.belowW0TextBox.Enabled = false; - this.belowW0TextBox.Location = new System.Drawing.Point(189, 300); - this.belowW0TextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.belowW0TextBox.Location = new System.Drawing.Point(143, 374); this.belowW0TextBox.Name = "belowW0TextBox"; - this.belowW0TextBox.Size = new System.Drawing.Size(39, 22); + this.belowW0TextBox.Size = new System.Drawing.Size(30, 20); this.belowW0TextBox.TabIndex = 73; // // label11 // this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(21, 304); - this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label11.Location = new System.Drawing.Point(17, 377); this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(120, 16); + this.label11.Size = new System.Drawing.Size(97, 13); this.label11.TabIndex = 68; this.label11.Text = "Column widths in %"; // // label12 // this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(352, 304); - this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label12.Location = new System.Drawing.Point(265, 377); this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(19, 16); + this.label12.Size = new System.Drawing.Size(15, 13); this.label12.TabIndex = 72; this.label12.Text = "%"; // // label13 // this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(291, 304); - this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label13.Location = new System.Drawing.Point(219, 377); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(19, 16); + this.label13.Size = new System.Drawing.Size(15, 13); this.label13.TabIndex = 70; this.label13.Text = "%"; // // belowW2TextBox // this.belowW2TextBox.Enabled = false; - this.belowW2TextBox.Location = new System.Drawing.Point(312, 300); - this.belowW2TextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.belowW2TextBox.Location = new System.Drawing.Point(235, 374); this.belowW2TextBox.Name = "belowW2TextBox"; - this.belowW2TextBox.Size = new System.Drawing.Size(39, 22); + this.belowW2TextBox.Size = new System.Drawing.Size(30, 20); this.belowW2TextBox.TabIndex = 71; // // belowW1TextBox // this.belowW1TextBox.Enabled = false; - this.belowW1TextBox.Location = new System.Drawing.Point(251, 300); - this.belowW1TextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.belowW1TextBox.Location = new System.Drawing.Point(189, 374); this.belowW1TextBox.Name = "belowW1TextBox"; - this.belowW1TextBox.Size = new System.Drawing.Size(39, 22); + this.belowW1TextBox.Size = new System.Drawing.Size(30, 20); this.belowW1TextBox.TabIndex = 69; // // belowItems3Button // this.belowItems3Button.Enabled = false; - this.belowItems3Button.Location = new System.Drawing.Point(529, 331); - this.belowItems3Button.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.belowItems3Button.Location = new System.Drawing.Point(398, 399); this.belowItems3Button.Name = "belowItems3Button"; - this.belowItems3Button.Size = new System.Drawing.Size(63, 25); + this.belowItems3Button.Size = new System.Drawing.Size(47, 20); this.belowItems3Button.TabIndex = 77; this.belowItems3Button.Text = "Col. 3"; this.belowItems3Button.UseVisualStyleBackColor = true; @@ -801,10 +734,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // belowItems2Button // this.belowItems2Button.Enabled = false; - this.belowItems2Button.Location = new System.Drawing.Point(459, 331); - this.belowItems2Button.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.belowItems2Button.Location = new System.Drawing.Point(345, 399); this.belowItems2Button.Name = "belowItems2Button"; - this.belowItems2Button.Size = new System.Drawing.Size(63, 25); + this.belowItems2Button.Size = new System.Drawing.Size(47, 20); this.belowItems2Button.TabIndex = 76; this.belowItems2Button.Text = "Col. 2"; this.belowItems2Button.UseVisualStyleBackColor = true; @@ -813,10 +745,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // belowItems1Button // this.belowItems1Button.Enabled = false; - this.belowItems1Button.Location = new System.Drawing.Point(388, 331); - this.belowItems1Button.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.belowItems1Button.Location = new System.Drawing.Point(292, 399); this.belowItems1Button.Name = "belowItems1Button"; - this.belowItems1Button.Size = new System.Drawing.Size(63, 25); + this.belowItems1Button.Size = new System.Drawing.Size(47, 20); this.belowItems1Button.TabIndex = 75; this.belowItems1Button.Text = "Col. 1"; this.belowItems1Button.UseVisualStyleBackColor = true; @@ -826,141 +757,117 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.tableFormComboBox.Enabled = false; this.tableFormComboBox.FormattingEnabled = true; - this.tableFormComboBox.Location = new System.Drawing.Point(523, 285); - this.tableFormComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tableFormComboBox.Location = new System.Drawing.Point(393, 362); this.tableFormComboBox.Name = "tableFormComboBox"; - this.tableFormComboBox.Size = new System.Drawing.Size(80, 24); + this.tableFormComboBox.Size = new System.Drawing.Size(61, 21); this.tableFormComboBox.TabIndex = 78; // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(23, 358); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Location = new System.Drawing.Point(18, 421); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(111, 16); + this.label3.Size = new System.Drawing.Size(97, 13); this.label3.TabIndex = 83; this.label3.Text = "Graph left/top/w/h"; // // graphHeightTextBox // this.graphHeightTextBox.Enabled = false; - this.graphHeightTextBox.Location = new System.Drawing.Point(327, 354); - this.graphHeightTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.graphHeightTextBox.Location = new System.Drawing.Point(246, 418); this.graphHeightTextBox.Name = "graphHeightTextBox"; - this.graphHeightTextBox.Size = new System.Drawing.Size(40, 22); + this.graphHeightTextBox.Size = new System.Drawing.Size(31, 20); this.graphHeightTextBox.TabIndex = 82; // // graphWidthTextBox // this.graphWidthTextBox.Enabled = false; - this.graphWidthTextBox.Location = new System.Drawing.Point(281, 354); - this.graphWidthTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.graphWidthTextBox.Location = new System.Drawing.Point(212, 418); this.graphWidthTextBox.Name = "graphWidthTextBox"; - this.graphWidthTextBox.Size = new System.Drawing.Size(40, 22); + this.graphWidthTextBox.Size = new System.Drawing.Size(31, 20); this.graphWidthTextBox.TabIndex = 81; // // graphTopTextBox // this.graphTopTextBox.Enabled = false; - this.graphTopTextBox.Location = new System.Drawing.Point(236, 354); - this.graphTopTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.graphTopTextBox.Location = new System.Drawing.Point(178, 418); this.graphTopTextBox.Name = "graphTopTextBox"; - this.graphTopTextBox.Size = new System.Drawing.Size(40, 22); + this.graphTopTextBox.Size = new System.Drawing.Size(31, 20); this.graphTopTextBox.TabIndex = 80; // // graphLeftTextBox // this.graphLeftTextBox.Enabled = false; - this.graphLeftTextBox.Location = new System.Drawing.Point(188, 354); - this.graphLeftTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.graphLeftTextBox.Location = new System.Drawing.Point(142, 418); this.graphLeftTextBox.Name = "graphLeftTextBox"; - this.graphLeftTextBox.Size = new System.Drawing.Size(43, 22); + this.graphLeftTextBox.Size = new System.Drawing.Size(33, 20); this.graphLeftTextBox.TabIndex = 79; // - // label14 - // - this.label14.AutoSize = true; - this.label14.Location = new System.Drawing.Point(452, 73); - this.label14.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(139, 16); - this.label14.TabIndex = 84; - this.label14.Text = " 2=batch, 3=wm, 4=s/n)"; - // // barcodeLabel // this.barcodeLabel.AutoSize = true; - this.barcodeLabel.Location = new System.Drawing.Point(23, 410); - this.barcodeLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.barcodeLabel.Location = new System.Drawing.Point(18, 463); this.barcodeLabel.Name = "barcodeLabel"; - this.barcodeLabel.Size = new System.Drawing.Size(140, 16); + this.barcodeLabel.Size = new System.Drawing.Size(121, 13); this.barcodeLabel.TabIndex = 89; this.barcodeLabel.Text = "Barcode left/t/w/h/type"; // // barcodeHeightTextBox // this.barcodeHeightTextBox.Enabled = false; - this.barcodeHeightTextBox.Location = new System.Drawing.Point(327, 406); - this.barcodeHeightTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.barcodeHeightTextBox.Location = new System.Drawing.Point(246, 460); this.barcodeHeightTextBox.Name = "barcodeHeightTextBox"; - this.barcodeHeightTextBox.Size = new System.Drawing.Size(40, 22); + this.barcodeHeightTextBox.Size = new System.Drawing.Size(31, 20); this.barcodeHeightTextBox.TabIndex = 88; // // barcodeWidthTextBox // this.barcodeWidthTextBox.Enabled = false; - this.barcodeWidthTextBox.Location = new System.Drawing.Point(281, 406); - this.barcodeWidthTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.barcodeWidthTextBox.Location = new System.Drawing.Point(212, 460); this.barcodeWidthTextBox.Name = "barcodeWidthTextBox"; - this.barcodeWidthTextBox.Size = new System.Drawing.Size(40, 22); + this.barcodeWidthTextBox.Size = new System.Drawing.Size(31, 20); this.barcodeWidthTextBox.TabIndex = 87; // // barcodeTopTextBox // this.barcodeTopTextBox.Enabled = false; - this.barcodeTopTextBox.Location = new System.Drawing.Point(236, 406); - this.barcodeTopTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.barcodeTopTextBox.Location = new System.Drawing.Point(178, 460); this.barcodeTopTextBox.Name = "barcodeTopTextBox"; - this.barcodeTopTextBox.Size = new System.Drawing.Size(40, 22); + this.barcodeTopTextBox.Size = new System.Drawing.Size(31, 20); this.barcodeTopTextBox.TabIndex = 86; // // barcodeLeftTextBox // this.barcodeLeftTextBox.Enabled = false; - this.barcodeLeftTextBox.Location = new System.Drawing.Point(188, 406); - this.barcodeLeftTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.barcodeLeftTextBox.Location = new System.Drawing.Point(142, 460); this.barcodeLeftTextBox.Name = "barcodeLeftTextBox"; - this.barcodeLeftTextBox.Size = new System.Drawing.Size(43, 22); + this.barcodeLeftTextBox.Size = new System.Drawing.Size(33, 20); this.barcodeLeftTextBox.TabIndex = 85; // // barcodeTypeComboBox // this.barcodeTypeComboBox.Enabled = false; this.barcodeTypeComboBox.FormattingEnabled = true; - this.barcodeTypeComboBox.Location = new System.Drawing.Point(383, 405); - this.barcodeTypeComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.barcodeTypeComboBox.Location = new System.Drawing.Point(288, 459); this.barcodeTypeComboBox.Name = "barcodeTypeComboBox"; - this.barcodeTypeComboBox.Size = new System.Drawing.Size(220, 24); + this.barcodeTypeComboBox.Size = new System.Drawing.Size(166, 21); this.barcodeTypeComboBox.TabIndex = 90; // // printerComboBox // this.printerComboBox.Enabled = false; this.printerComboBox.FormattingEnabled = true; - this.printerComboBox.Location = new System.Drawing.Point(189, 30); - this.printerComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.printerComboBox.Location = new System.Drawing.Point(143, 154); this.printerComboBox.Name = "printerComboBox"; - this.printerComboBox.Size = new System.Drawing.Size(331, 24); + this.printerComboBox.Size = new System.Drawing.Size(249, 21); this.printerComboBox.TabIndex = 93; // // selectPrinterButton // this.selectPrinterButton.Enabled = false; - this.selectPrinterButton.Location = new System.Drawing.Point(523, 28); - this.selectPrinterButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.selectPrinterButton.Location = new System.Drawing.Point(393, 153); this.selectPrinterButton.Name = "selectPrinterButton"; - this.selectPrinterButton.Size = new System.Drawing.Size(81, 27); + this.selectPrinterButton.Size = new System.Drawing.Size(61, 22); this.selectPrinterButton.TabIndex = 92; this.selectPrinterButton.Text = "Select"; this.selectPrinterButton.UseVisualStyleBackColor = true; @@ -969,10 +876,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // printerLabel // this.printerLabel.AutoSize = true; - this.printerLabel.Location = new System.Drawing.Point(21, 33); - this.printerLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.printerLabel.Location = new System.Drawing.Point(17, 157); this.printerLabel.Name = "printerLabel"; - this.printerLabel.Size = new System.Drawing.Size(45, 16); + this.printerLabel.Size = new System.Drawing.Size(37, 13); this.printerLabel.TabIndex = 91; this.printerLabel.Text = "Printer"; // @@ -980,16 +886,260 @@ namespace TBF.Rig.Output.Printers.OnePerMeter // this.tableAlignmentComboBox.Enabled = false; this.tableAlignmentComboBox.FormattingEnabled = true; - this.tableAlignmentComboBox.Location = new System.Drawing.Point(523, 309); - this.tableAlignmentComboBox.Margin = new System.Windows.Forms.Padding(4); + this.tableAlignmentComboBox.Location = new System.Drawing.Point(393, 381); this.tableAlignmentComboBox.Name = "tableAlignmentComboBox"; - this.tableAlignmentComboBox.Size = new System.Drawing.Size(80, 24); + this.tableAlignmentComboBox.Size = new System.Drawing.Size(61, 21); this.tableAlignmentComboBox.TabIndex = 94; // + // fileNameFmtTextBox + // + this.fileNameFmtTextBox.Enabled = false; + this.fileNameFmtTextBox.Location = new System.Drawing.Point(142, 133); + this.fileNameFmtTextBox.Name = "fileNameFmtTextBox"; + this.fileNameFmtTextBox.Size = new System.Drawing.Size(187, 20); + this.fileNameFmtTextBox.TabIndex = 108; + // + // fileNameFmtLabel + // + this.fileNameFmtLabel.AutoSize = true; + this.fileNameFmtLabel.Location = new System.Drawing.Point(17, 136); + this.fileNameFmtLabel.Name = "fileNameFmtLabel"; + this.fileNameFmtLabel.Size = new System.Drawing.Size(84, 13); + this.fileNameFmtLabel.TabIndex = 107; + this.fileNameFmtLabel.Text = "File name format"; + // + // destination2Button + // + this.destination2Button.Enabled = false; + this.destination2Button.Location = new System.Drawing.Point(303, 46); + this.destination2Button.Name = "destination2Button"; + this.destination2Button.Size = new System.Drawing.Size(30, 20); + this.destination2Button.TabIndex = 100; + this.destination2Button.Text = "..."; + this.destination2Button.UseVisualStyleBackColor = true; + this.destination2Button.Click += new System.EventHandler(this.destination2Button_Click); + // + // destination2TextBox + // + this.destination2TextBox.Enabled = false; + this.destination2TextBox.Location = new System.Drawing.Point(142, 46); + this.destination2TextBox.Name = "destination2TextBox"; + this.destination2TextBox.Size = new System.Drawing.Size(146, 20); + this.destination2TextBox.TabIndex = 99; + // + // destination2Label + // + this.destination2Label.AutoSize = true; + this.destination2Label.Location = new System.Drawing.Point(17, 49); + this.destination2Label.Name = "destination2Label"; + this.destination2Label.Size = new System.Drawing.Size(69, 13); + this.destination2Label.TabIndex = 98; + this.destination2Label.Text = "Destination 2"; + // + // dayFoldersComboBox + // + this.dayFoldersComboBox.Enabled = false; + this.dayFoldersComboBox.FormattingEnabled = true; + this.dayFoldersComboBox.Location = new System.Drawing.Point(142, 111); + this.dayFoldersComboBox.Name = "dayFoldersComboBox"; + this.dayFoldersComboBox.Size = new System.Drawing.Size(146, 21); + this.dayFoldersComboBox.TabIndex = 106; + // + // monthFoldersComboBox + // + this.monthFoldersComboBox.Enabled = false; + this.monthFoldersComboBox.FormattingEnabled = true; + this.monthFoldersComboBox.Location = new System.Drawing.Point(142, 89); + this.monthFoldersComboBox.Name = "monthFoldersComboBox"; + this.monthFoldersComboBox.Size = new System.Drawing.Size(146, 21); + this.monthFoldersComboBox.TabIndex = 104; + // + // yearFoldersComboBox + // + this.yearFoldersComboBox.Enabled = false; + this.yearFoldersComboBox.FormattingEnabled = true; + this.yearFoldersComboBox.Location = new System.Drawing.Point(142, 67); + this.yearFoldersComboBox.Name = "yearFoldersComboBox"; + this.yearFoldersComboBox.Size = new System.Drawing.Size(146, 21); + this.yearFoldersComboBox.TabIndex = 102; + // + // dayFoldersLabel + // + this.dayFoldersLabel.AutoSize = true; + this.dayFoldersLabel.Location = new System.Drawing.Point(17, 114); + this.dayFoldersLabel.Name = "dayFoldersLabel"; + this.dayFoldersLabel.Size = new System.Drawing.Size(60, 13); + this.dayFoldersLabel.TabIndex = 105; + this.dayFoldersLabel.Text = "Day folders"; + // + // monthFoldersLabel + // + this.monthFoldersLabel.AutoSize = true; + this.monthFoldersLabel.Location = new System.Drawing.Point(17, 92); + this.monthFoldersLabel.Name = "monthFoldersLabel"; + this.monthFoldersLabel.Size = new System.Drawing.Size(71, 13); + this.monthFoldersLabel.TabIndex = 103; + this.monthFoldersLabel.Text = "Month folders"; + // + // yearFoldersLabel + // + this.yearFoldersLabel.AutoSize = true; + this.yearFoldersLabel.Location = new System.Drawing.Point(17, 70); + this.yearFoldersLabel.Name = "yearFoldersLabel"; + this.yearFoldersLabel.Size = new System.Drawing.Size(63, 13); + this.yearFoldersLabel.TabIndex = 101; + this.yearFoldersLabel.Text = "Year folders"; + // + // destinationButton + // + this.destinationButton.Enabled = false; + this.destinationButton.Location = new System.Drawing.Point(303, 25); + this.destinationButton.Name = "destinationButton"; + this.destinationButton.Size = new System.Drawing.Size(30, 20); + this.destinationButton.TabIndex = 97; + this.destinationButton.Text = "..."; + this.destinationButton.UseVisualStyleBackColor = true; + this.destinationButton.Click += new System.EventHandler(this.destinationButton_Click); + // + // destinationTextBox + // + this.destinationTextBox.Enabled = false; + this.destinationTextBox.Location = new System.Drawing.Point(142, 25); + this.destinationTextBox.Name = "destinationTextBox"; + this.destinationTextBox.Size = new System.Drawing.Size(146, 20); + this.destinationTextBox.TabIndex = 96; + // + // destinationLabel + // + this.destinationLabel.AutoSize = true; + this.destinationLabel.Location = new System.Drawing.Point(17, 28); + this.destinationLabel.Name = "destinationLabel"; + this.destinationLabel.Size = new System.Drawing.Size(60, 13); + this.destinationLabel.TabIndex = 95; + this.destinationLabel.Text = "Destination"; + // + // posibleParams1ComboBox + // + this.posibleParams1ComboBox.Enabled = false; + this.posibleParams1ComboBox.FormattingEnabled = true; + this.posibleParams1ComboBox.Items.AddRange(new object[] { + "---------- Variables --------", + "{0} = start time", + "{1} = end time", + "{2} = batch ", + "{3} = wm position (WaterMeter)", + "{4} = s/n (Serial number)", + "{5} = bench id", + "---------- Time formats --------", + ":HH = hour (00-23)", + ":H = hour (0-23)", + ":mm = minute (00-59)", + ":m = minute (0-59)", + ":ss = seconds (00-59)", + ":s = seconds (0-59)", + ":fff = milliseconds (000-999)", + ":ff = fraction of second (2 digits)", + ":f = fraction of second (1 digit)", + ":yyyy = year (4 digits)", + ":yy = year (2 digits)", + ":MM = month (2 digits)", + ":M = month (1-2 digits)", + ":dd = day (2 digits)", + ":d = day (1-2 digits)", + ":MMM = month short name", + ":MMMM = month long name", + ":ddd = weekday short", + ":dddd = weekday long", + ":yyyy-MM-dd = ISO date", + ":HH-mm-ss = time dashed", + ":yyyyMMdd = date compact", + ":yyyyMMdd_HHmmss = timestamp", + ":zzz = timezone offset", + ":K = timezone (Z or offset)"}); + this.posibleParams1ComboBox.Location = new System.Drawing.Point(332, 132); + this.posibleParams1ComboBox.Name = "posibleParams1ComboBox"; + this.posibleParams1ComboBox.Size = new System.Drawing.Size(167, 21); + this.posibleParams1ComboBox.TabIndex = 111; + this.posibleParams1ComboBox.SelectedIndexChanged += new System.EventHandler(this.posibleParams1ComboBox_SelectedIndexChanged); + // + // previewButton + // + this.previewButton.Enabled = false; + this.previewButton.Location = new System.Drawing.Point(331, 531); + this.previewButton.Name = "previewButton"; + this.previewButton.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.previewButton.Size = new System.Drawing.Size(156, 25); + this.previewButton.TabIndex = 112; + this.previewButton.Text = "Document preview"; + this.previewButton.UseVisualStyleBackColor = true; + this.previewButton.Click += new System.EventHandler(this.previewButton_Click); + // + // documentNameLabel + // + this.documentNameLabel.AutoSize = true; + this.documentNameLabel.Enabled = false; + this.documentNameLabel.Location = new System.Drawing.Point(18, 508); + this.documentNameLabel.Name = "documentNameLabel"; + this.documentNameLabel.Size = new System.Drawing.Size(85, 13); + this.documentNameLabel.TabIndex = 113; + this.documentNameLabel.Text = "Document name"; + // + // documentNameTextBox + // + this.documentNameTextBox.Enabled = false; + this.documentNameTextBox.Location = new System.Drawing.Point(142, 505); + this.documentNameTextBox.Name = "documentNameTextBox"; + this.documentNameTextBox.Size = new System.Drawing.Size(345, 20); + this.documentNameTextBox.TabIndex = 114; + // + // generateDocNameButton + // + this.generateDocNameButton.Enabled = false; + this.generateDocNameButton.Location = new System.Drawing.Point(142, 531); + this.generateDocNameButton.Name = "generateDocNameButton"; + this.generateDocNameButton.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.generateDocNameButton.Size = new System.Drawing.Size(187, 25); + this.generateDocNameButton.TabIndex = 115; + this.generateDocNameButton.Text = "(Re)generate document name"; + this.generateDocNameButton.UseVisualStyleBackColor = true; + this.generateDocNameButton.Click += new System.EventHandler(this.generateDocNameButton_Click); + // + // saveComponentButton + // + this.saveComponentButton.Enabled = false; + this.saveComponentButton.Location = new System.Drawing.Point(331, 559); + this.saveComponentButton.Name = "saveComponentButton"; + this.saveComponentButton.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.saveComponentButton.Size = new System.Drawing.Size(156, 26); + this.saveComponentButton.TabIndex = 116; + this.saveComponentButton.Text = "Save component config"; + this.saveComponentButton.UseVisualStyleBackColor = true; + this.saveComponentButton.Click += new System.EventHandler(this.saveComponentButton_Click); + // // PrinterCfgCtrl // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.saveComponentButton); + this.Controls.Add(this.generateDocNameButton); + this.Controls.Add(this.documentNameTextBox); + this.Controls.Add(this.documentNameLabel); + this.Controls.Add(this.previewButton); + this.Controls.Add(this.posibleParams1ComboBox); + this.Controls.Add(this.fileNameFmtTextBox); + this.Controls.Add(this.fileNameFmtLabel); + this.Controls.Add(this.destination2Button); + this.Controls.Add(this.destination2TextBox); + this.Controls.Add(this.destination2Label); + this.Controls.Add(this.dayFoldersComboBox); + this.Controls.Add(this.monthFoldersComboBox); + this.Controls.Add(this.yearFoldersComboBox); + this.Controls.Add(this.dayFoldersLabel); + this.Controls.Add(this.monthFoldersLabel); + this.Controls.Add(this.yearFoldersLabel); + this.Controls.Add(this.destinationButton); + this.Controls.Add(this.destinationTextBox); + this.Controls.Add(this.destinationLabel); this.Controls.Add(this.tableAlignmentComboBox); this.Controls.Add(this.printerComboBox); this.Controls.Add(this.selectPrinterButton); @@ -1000,7 +1150,6 @@ namespace TBF.Rig.Output.Printers.OnePerMeter this.Controls.Add(this.barcodeWidthTextBox); this.Controls.Add(this.barcodeTopTextBox); this.Controls.Add(this.barcodeLeftTextBox); - this.Controls.Add(this.label14); this.Controls.Add(this.label3); this.Controls.Add(this.graphHeightTextBox); this.Controls.Add(this.graphWidthTextBox); @@ -1039,8 +1188,6 @@ namespace TBF.Rig.Output.Printers.OnePerMeter this.Controls.Add(this.footerFontSizeTextBox); this.Controls.Add(this.footerFontFamilyComboBox); this.Controls.Add(this.footerFontLabel); - this.Controls.Add(this.docNameTextBox); - this.Controls.Add(this.docNameLabel); this.Controls.Add(this.templateTextBox); this.Controls.Add(this.templateLabel); this.Controls.Add(this.goodOnlyCheckBox); @@ -1076,9 +1223,8 @@ namespace TBF.Rig.Output.Printers.OnePerMeter this.Controls.Add(this.supressPrintingCheckBox); this.Controls.Add(this.nameTextBox); this.Controls.Add(this.nameLabel); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "PrinterCfgCtrl"; - this.Size = new System.Drawing.Size(607, 431); + this.Size = new System.Drawing.Size(536, 598); this.Load += new System.EventHandler(this.PrinterCfgCtrl_Load); this.ResumeLayout(false); this.PerformLayout(); @@ -1122,8 +1268,6 @@ namespace TBF.Rig.Output.Printers.OnePerMeter private System.Windows.Forms.CheckBox goodOnlyCheckBox; private System.Windows.Forms.TextBox templateTextBox; private System.Windows.Forms.Label templateLabel; - private System.Windows.Forms.Label docNameLabel; - private System.Windows.Forms.TextBox docNameTextBox; private System.Windows.Forms.CheckBox footerItalicCheckBox; private System.Windows.Forms.CheckBox footerBoldCheckBox; private System.Windows.Forms.TextBox footerFontSizeTextBox; @@ -1162,7 +1306,6 @@ namespace TBF.Rig.Output.Printers.OnePerMeter private System.Windows.Forms.TextBox graphWidthTextBox; private System.Windows.Forms.TextBox graphTopTextBox; private System.Windows.Forms.TextBox graphLeftTextBox; - private System.Windows.Forms.Label label14; private System.Windows.Forms.Label barcodeLabel; private System.Windows.Forms.TextBox barcodeHeightTextBox; private System.Windows.Forms.TextBox barcodeWidthTextBox; @@ -1173,5 +1316,25 @@ namespace TBF.Rig.Output.Printers.OnePerMeter private System.Windows.Forms.Button selectPrinterButton; private System.Windows.Forms.Label printerLabel; private System.Windows.Forms.ComboBox tableAlignmentComboBox; + private System.Windows.Forms.TextBox fileNameFmtTextBox; + private System.Windows.Forms.Label fileNameFmtLabel; + private System.Windows.Forms.Button destination2Button; + private System.Windows.Forms.TextBox destination2TextBox; + private System.Windows.Forms.Label destination2Label; + private System.Windows.Forms.ComboBox dayFoldersComboBox; + private System.Windows.Forms.ComboBox monthFoldersComboBox; + private System.Windows.Forms.ComboBox yearFoldersComboBox; + private System.Windows.Forms.Label dayFoldersLabel; + private System.Windows.Forms.Label monthFoldersLabel; + private System.Windows.Forms.Label yearFoldersLabel; + private System.Windows.Forms.Button destinationButton; + private System.Windows.Forms.TextBox destinationTextBox; + private System.Windows.Forms.Label destinationLabel; + private System.Windows.Forms.ComboBox posibleParams1ComboBox; + private System.Windows.Forms.Button previewButton; + private System.Windows.Forms.Label documentNameLabel; + private System.Windows.Forms.TextBox documentNameTextBox; + private System.Windows.Forms.Button generateDocNameButton; + private System.Windows.Forms.Button saveComponentButton; } } diff --git a/TBF/Rig/Output/Printers/OnePerMeter/PrinterCfgCtrl.cs b/TBF/Rig/Output/Printers/OnePerMeter/PrinterCfgCtrl.cs index c9870bde8..b0b41d527 100644 --- a/TBF/Rig/Output/Printers/OnePerMeter/PrinterCfgCtrl.cs +++ b/TBF/Rig/Output/Printers/OnePerMeter/PrinterCfgCtrl.cs @@ -1,15 +1,24 @@ -/// +using Common; +using Config.Entities; +using log4net; +using NHibernate; +using Renci.SshNet; +using Results.Output.Printers; +/// /// Copyright (c) 2017-2023 Sensus Slovensko a.s. /// using System; +using System.Collections.Generic; using System.Drawing.Printing; +using System.IO; using System.Windows.Forms; -using log4net; -using Common; -using Results.Output.Printers; using TBF.Resources; using TBF.Rig.Configs; +using TBF.Rig.Configs.ParamsProvider; using TBF.Rig.Generic; +using TBF.Rig.Output.FileWriters; +using TBF.UI.Bench.Components; +using TBF.UI.ResultsMI; namespace TBF.Rig.Output.Printers.OnePerMeter { @@ -41,12 +50,23 @@ namespace TBF.Rig.Output.Printers.OnePerMeter string[] belowItems3; string footer; - public PrinterCfgCtrl() - { - InitializeComponent(); + string whoCall = ""; + Printer metaPrinter = null; + ComponentParametersDlg pf1 = null; + PrintResultsSelectionDlg pf2 = null; + CfgUpdateFlags flags; /// Or-ed from particular Flags from ComponentParametersDlg + + IList cmpntEntities; + ISession session; + + public PrinterCfgCtrl() + { + InitializeComponent(); Localize(); - orientationComboBox.Items.Add(PageOrientation.Portrait.ToString()); + flags = CfgUpdateFlags.None; + + orientationComboBox.Items.Add(PageOrientation.Portrait.ToString()); orientationComboBox.Items.Add(PageOrientation.Landscape.ToString()); foreach (var ff in System.Drawing.FontFamily.Families) @@ -75,12 +95,34 @@ namespace TBF.Rig.Output.Printers.OnePerMeter private void PrinterCfgCtrl_Load(object sender, EventArgs e) { - for (Culture s = 0; s < Culture.Count; s++) cultureComboBox.Items.Add(s.ToString()); + pf1 = (ComponentParametersDlg)ParentForm; + pf2 = pf1.SharedButtonsParentForm as PrintResultsSelectionDlg; + + if (pf2 != null) + { + metaPrinter = new Printer(config); + + whoCall = "preview"; + generateDocNameButton.Enabled = true; + previewButton.Enabled = true; + documentNameLabel.Enabled = true; + documentNameTextBox.Enabled = true; + saveComponentButton.Enabled = true; + + generateDocumentName(); + } + + for (Culture s = 0; s < Culture.Count; s++) cultureComboBox.Items.Add(s.ToString()); printerComboBox.Items.Add(Strings.default_printer); foreach (var p in PrinterSettings.InstalledPrinters) printerComboBox.Items.Add(p); - header = config.Header; + for (YearFolders s = 0; s < YearFolders.Count; s++) yearFoldersComboBox.Items.Add(s.ToString()); + for (MonthFolders s = 0; s < MonthFolders.Count; s++) monthFoldersComboBox.Items.Add(s.ToString()); + for (DayFolders s = 0; s < DayFolders.Count; s++) dayFoldersComboBox.Items.Add(s.ToString()); + for (Culture s = 0; s < Culture.Count; s++) cultureComboBox.Items.Add(s.ToString()); + + header = config.Header; commonItems1 = config.CommonItems1; commonItems2 = config.CommonItems2; commonItems3 = config.CommonItems3; @@ -91,14 +133,25 @@ namespace TBF.Rig.Output.Printers.OnePerMeter belowItems3 = config.BelowItems3; footer = config.Footer; - Redraw(); + session = TBF.DB.CreateSession(DBKind.Config); + cmpntEntities = session.QueryOver() + .OrderBy(x => x.ItemNr).Asc + .List(); + + Redraw(); } void Localize() { nameLabel.Text = Strings.Name; + destinationLabel.Text = "Destination"; + destination2Label.Text = "Destination" + " 2"; + yearFoldersLabel.Text = "Year folders"; + monthFoldersLabel.Text = "Month folders"; + dayFoldersLabel.Text = "Day folders"; + fileNameFmtLabel.Text = "File name format"; templateLabel.Text = "Template"; - cultureLabel.Text = "Culture"; + cultureLabel.Text = "Culture"; headerButton.Text = Strings.Header; footerButton.Text = Strings.Footer; } @@ -109,8 +162,16 @@ namespace TBF.Rig.Output.Printers.OnePerMeter void Redraw() { - if (config == null) return; /// Control was not loaded, settings were not changed - nameTextBox.Text = config.Name; + if (config == null) return; /// Control was not loaded, settings were not changed + metaPrinter = new Printer(config); + nameTextBox.Text = config.Name; + destinationTextBox.Text = config.DestinationPath; + destination2TextBox.Text = config.DestinationPath2; + yearFoldersComboBox.Text = config.YearFolders.ToString(); + monthFoldersComboBox.Text = config.MonthFolders.ToString(); + dayFoldersComboBox.Text = config.DayFolders.ToString(); + fileNameFmtTextBox.Text = config.FileNameFormat; + //documentNameTextBox.Text = config.DocName; printerComboBox.Text = string.IsNullOrEmpty(config.PrinterName) ? Strings.default_printer : config.PrinterName; templateTextBox.Text = config.Template; orientationComboBox.Text = config.PageOrientation.ToString(); @@ -161,7 +222,7 @@ namespace TBF.Rig.Output.Printers.OnePerMeter imageWidthTextBox.Text = config.ImgWid.ToString(); imageHeightTextBox.Text = config.ImgHgh.ToString(); imageNameTextBox.Text = config.ImgName; - docNameTextBox.Text = config.DocName; + //docNameTextBox.Text = config.DocName; tableFormComboBox.Text = config.Form.ToString(); tableAlignmentComboBox.Text = config.Alignment.ToDescription(); @@ -176,6 +237,15 @@ namespace TBF.Rig.Output.Printers.OnePerMeter public void Unlock() { nameTextBox.Enabled = true; + destinationTextBox.Enabled = true; + destinationButton.Enabled = true; + destination2TextBox.Enabled = true; + destination2Button.Enabled = true; + yearFoldersComboBox.Enabled = true; + monthFoldersComboBox.Enabled = true; + dayFoldersComboBox.Enabled = true; + fileNameFmtTextBox.Enabled = true; + posibleParams1ComboBox.Enabled = true; printerComboBox.Enabled = true; selectPrinterButton.Enabled = true; templateTextBox.Enabled = true; @@ -229,7 +299,6 @@ namespace TBF.Rig.Output.Printers.OnePerMeter imageWidthTextBox.Enabled = true; imageHeightTextBox.Enabled = true; imageNameTextBox.Enabled = true; - docNameTextBox.Enabled = true; barcodeTypeComboBox.Enabled = true; barcodeLeftTextBox.Enabled = true; barcodeTopTextBox.Enabled = true; @@ -241,7 +310,25 @@ namespace TBF.Rig.Output.Printers.OnePerMeter { CfgUpdateFlags flags = CfgUpdateFlags.None; - if ((int)GetOrientation(orientationComboBox.Text) < 0) + if (!yearFoldersComboBox.Items.Contains(yearFoldersComboBox.Text)) + { + flags |= CfgUpdateFlags.Error; + message += Environment.NewLine + "Invalid year folders selection"; + } + + if (!monthFoldersComboBox.Items.Contains(monthFoldersComboBox.Text)) + { + flags |= CfgUpdateFlags.Error; + message += Environment.NewLine + "Invalid month folders selection"; + } + + if (!dayFoldersComboBox.Items.Contains(dayFoldersComboBox.Text)) + { + flags |= CfgUpdateFlags.Error; + message += Environment.NewLine + "Invalid day folder selection"; + } + + if ((int)GetOrientation(orientationComboBox.Text) < 0) { message += Environment.NewLine + "Invalid 'Page orientation'"; flags |= CfgUpdateFlags.Error; @@ -438,6 +525,56 @@ namespace TBF.Rig.Output.Printers.OnePerMeter flags |= CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange; } + if (config.DestinationPath != destinationTextBox.Text) + { + config.DestinationPath = destinationTextBox.Text; + if (!config.DestinationPath.EndsWith("\\")) config.DestinationPath += "\\"; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + } + + if (config.DestinationPath2 != destination2TextBox.Text) + { + config.DestinationPath2 = destination2TextBox.Text; + if (!config.DestinationPath2.EndsWith("\\")) config.DestinationPath2 += "\\"; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + } + + for (YearFolders i = 0; i < YearFolders.Count; i++) + { + if (i.ToString().Equals(yearFoldersComboBox.Text) && (config.YearFolders != i)) + { + config.YearFolders = i; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + break; + } + } + + for (MonthFolders i = 0; i < MonthFolders.Count; i++) + { + if (i.ToString().Equals(monthFoldersComboBox.Text) && (config.MonthFolders != i)) + { + config.MonthFolders = i; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + break; + } + } + + for (DayFolders i = 0; i < DayFolders.Count; i++) + { + if (i.ToString().Equals(dayFoldersComboBox.Text) && (config.DayFolders != i)) + { + config.DayFolders = i; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + break; + } + } + + if (config.FileNameFormat != fileNameFmtTextBox.Text) + { + config.FileNameFormat = fileNameFmtTextBox.Text; + flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + } + string newPrinter = (printerComboBox.Text == Strings.default_printer) ? string.Empty : printerComboBox.Text; if (config.PrinterName != newPrinter) { @@ -545,7 +682,7 @@ namespace TBF.Rig.Output.Printers.OnePerMeter flags |= UpdateDifferent(ref config.ImgHgh, imageHeightTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); flags |= UpdateDifferent(ref config.ImgName, imageNameTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); - flags |= UpdateDifferent(ref config.DocName, docNameTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); + //flags |= UpdateDifferent(ref config.DocName, docNameTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange); for (BarcodeType bt = BarcodeType.None; bt < BarcodeType.Count; bt++) { @@ -567,9 +704,9 @@ namespace TBF.Rig.Output.Printers.OnePerMeter } return flags; - } + } - private void headerButton_Click(object sender, EventArgs e) + private void headerButton_Click(object sender, EventArgs e) { HeaderFooterDlg dlg = new HeaderFooterDlg(true, string.IsNullOrEmpty(header) ? string.Empty : header.Replace("~", Environment.NewLine)); if (dlg.ShowDialog() == DialogResult.OK) @@ -724,5 +861,297 @@ namespace TBF.Rig.Output.Printers.OnePerMeter printerComboBox.Text = dlg.PrinterSettings.PrinterName; } } - } + + private void destinationButton_Click(object sender, EventArgs e) + { + using (var dlg = new FolderBrowserDialog()) + { + dlg.Description = "Select destination folder"; + dlg.ShowNewFolderButton = true; + + // predfill existing folder if valid + if (System.IO.Directory.Exists(destinationTextBox.Text)) + dlg.SelectedPath = destinationTextBox.Text; + + if (dlg.ShowDialog() == DialogResult.OK) + destinationTextBox.Text = dlg.SelectedPath; + } + } + + private void destination2Button_Click(object sender, EventArgs e) + { + using (var dlg = new FolderBrowserDialog()) + { + dlg.Description = "Select destination folder"; + dlg.ShowNewFolderButton = true; + + // predfill existing folder if valid + if (System.IO.Directory.Exists(destination2TextBox.Text)) + dlg.SelectedPath = destination2TextBox.Text; + + if (dlg.ShowDialog() == DialogResult.OK) + destination2TextBox.Text = dlg.SelectedPath; + } + } + + private void posibleParams1ComboBox_SelectedIndexChanged(object sender, EventArgs e) + { + // Read the selected item text from the ComboBox + // Example: "{0} = start time" or ":ss = seconds" + string selected = posibleParams1ComboBox.Text; + + // Find the position of '=' which separates the token from the description + int eqIndex = selected.IndexOf('='); + + // Continue only if '=' exists in the string + if (eqIndex > 0) + { + // Extract the token part before '=' + // Examples: + // "{0} = start time" -> "{0}" + // ":ss = seconds" -> ":ss" + string token = selected.Substring(0, eqIndex).Trim(); + + // Get the current caret position in the TextBox + int pos = fileNameFmtTextBox.SelectionStart; + + // Insert the token at the caret position + fileNameFmtTextBox.Text = + fileNameFmtTextBox.Text.Insert(pos, token); + + // Move caret to the end of the inserted token + fileNameFmtTextBox.SelectionStart = pos + token.Length; + } + } + + private void previewButton_Click(object sender, EventArgs e) + { + var errors = new List(); + + // Basic null / state checks + if (metaPrinter == null) + errors.Add("Printer object is not initialized."); + + if (pf2 == null) + errors.Add("Preview data (pf2) are not available."); + + if (pf2?.batch == null) + errors.Add("Batch data are not available."); + + if (pf2?.batch?.WaterMeters == null || pf2.batch.WaterMeters.Count == 0) + errors.Add("There is no water meter in the selected batch."); + + string documentName = documentNameTextBox.Text; + if (string.IsNullOrWhiteSpace(documentName)) + errors.Add("Document name is not set."); + + string destinationFolder = destinationTextBox.Text; + if (string.IsNullOrWhiteSpace(destinationFolder)) + errors.Add("Destination folder is not set."); + + // If there are any collected errors, show them in a single dialog + if (errors.Count > 0) + { + string message = "Preview cannot be started due to the following issues:\n\n" + + string.Join("\n", errors); + MessageBox.Show( + message, + "Preview error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + return; + } + + try + { + var wm = pf2.batch.WaterMeters[0]; + + metaPrinter.PrintResults( + pf2.batch, + wm, + documentName, + destinationFolder, + whoCall); + } + catch (Exception ex) + { + MessageBox.Show( + "Preview failed.\n\nError: " + ex.Message, + "Preview error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + + /*private void fileNameFmtTextBox_TextChanged(object sender, EventArgs e) + { + if (whoCall == "preview") + { + generateDocumentName(); + } + }*/ + + private void fileNameFmtTextBox_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + if (whoCall == "preview") + { + generateDocumentName(); + } + + // prevent "ding" sound when pressing Enter in TextBox + e.Handled = true; + e.SuppressKeyPress = true; + } + } + + private void generateDocumentName() + { + var errors = new List(); + + // Basic null checks + if (pf2 == null) + errors.Add("Preview data (pf2) are not available."); + + if (pf2?.batch == null) + errors.Add("Batch data are not available."); + + if (pf2?.batch?.WaterMeters == null || pf2.batch.WaterMeters.Count == 0) + errors.Add("There is no water meter in the selected batch."); + + string format = fileNameFmtTextBox.Text; + if (string.IsNullOrWhiteSpace(format)) + errors.Add("File name format is empty."); + + // If we collected any errors, show them in a single dialog + if (errors.Count > 0) + { + string message = "Document name cannot be generated due to the following issues:\n\n" + + string.Join("\n", errors); + + MessageBox.Show( + message, + "File name format error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + + return; + } + + try + { + var wm = pf2.batch.WaterMeters[0]; + + documentNameTextBox.Text = string.Format( + format, + wm.StartTime(), + wm.EndTime(), + wm.BatchNr(), + wm.WMPosition, + wm.SerialNr, + wm.BenchId()); + } + catch (FormatException ex) + { + MessageBox.Show( + "The file name format is not valid.\n\n" + + "Please check placeholders and format codes.\n\n" + + "Error: " + ex.Message, + "File name format error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + catch (Exception ex) + { + MessageBox.Show( + "Failed to generate document name.\n\n" + + "Error: " + ex.Message, + "Document name error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + + private void generateDocNameButton_Click(object sender, EventArgs e) + { + if (whoCall == "preview") + { + generateDocumentName(); + } + } + + private void saveComponentButton_Click(object sender, EventArgs e) + { + + string message = string.Empty; + CfgUpdateFlags flags = VerifyCfg(ref message); + + flags |= UpdateCfg(); + + if ((flags & CfgUpdateFlags.RestartRqrd) == CfgUpdateFlags.RestartRqrd) + { + MessageBox.Show(Strings.Program_restart_is_required_to_apply_some_settings, + Strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + //ComponentCfgCtrl.Closing(); + + if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0) + { + foreach (var cmpnt in cmpntEntities) + { + if (cmpnt.Name == config.Name) + { + string xml; + using (var sw = new StringWriter()) + { + config.GetSerializer().Serialize(sw, config); + xml = sw.ToString(); + } + cmpnt.Parameters = xml; + } + } + + if (SaveDBChanges(session)) + flags = CfgUpdateFlags.None; /// Changes saved + else + flags = CfgUpdateFlags.Error; + } + if ((flags & CfgUpdateFlags.Error) == CfgUpdateFlags.Error) + { + MessageBox.Show(Strings.Please_change_the_following_settings + message, + Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + + /// + /// Save DB changes, return true when DB changes saved OK + /// + bool SaveDBChanges(ISession session) + { + using (ITransaction transaction = session.BeginTransaction()) + { + try + { + foreach (var cmpnt in cmpntEntities) + { + if(cmpnt.Name == config.Name) + session.SaveOrUpdate(cmpnt); + } + + transaction.Commit(); + session.Flush(); + return true; + } + catch (Exception exc) + { + transaction.Rollback(); + log.ErrorFormat("Exception when saving components : {1}", exc.Message); + return false; + } + } + } + } } diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index 062ee596a..74a3c8668 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -1456,7 +1456,9 @@ - + + Component + diff --git a/TBF/UI/Bench/Components/ComponentParametersDlg.cs b/TBF/UI/Bench/Components/ComponentParametersDlg.cs index 3a4ec2856..26319d9e8 100644 --- a/TBF/UI/Bench/Components/ComponentParametersDlg.cs +++ b/TBF/UI/Bench/Components/ComponentParametersDlg.cs @@ -1,39 +1,47 @@ -/// +using Common; +using NHibernate; + +/// /// Copyright (c) 2013-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; +using System.Drawing; using System.Windows.Forms; -using Common; +using TBF.Resources; using TBF.Rig; using TBF.Rig.Generic; -using TBF.Resources; using TBF.UI.Shared; namespace TBF.UI.Bench.Components { - public partial class ComponentParametersDlg : Form - { - public IComponentCfgCtrl ComponentCfgCtrl; + public partial class ComponentParametersDlg : Form + { + public IComponentCfgCtrl ComponentCfgCtrl; const int ComponentCfgCtrlHeight = 350; const int ComponentCfgCtrlMoreHeight = 250; + public Form SharedButtonsParentForm + { + get { return sharedButtons.ParentForm; }//...MF + } - public IComponentCfg Config - { - get - { - if (ComponentCfgCtrl == null) return null; - return ComponentCfgCtrl.Config; - } - } + public IComponentCfg Config + { + get + { + if (ComponentCfgCtrl == null) return null; + return ComponentCfgCtrl.Config; + } + } - public CfgUpdateFlags Flags; + public CfgUpdateFlags Flags; public bool UnlockAfterStart; - /// - /// List of components (=component configuration instances) - /// - public IList CmpntEntities; + /// + /// List of components (=component configuration instances) + /// + public IList CmpntEntities; + public ISession Session; int cmpntEntityId; @@ -48,7 +56,7 @@ namespace TBF.UI.Bench.Components /// Config.Entities.Component.Id or 0 when this is a new/copied/immported component public ComponentParametersDlg(Form parentForm, int cmpntEntityId = 0) : this() - { + { this.cmpntEntityId = cmpntEntityId; /// SharedDlgButtons configuration @@ -62,20 +70,24 @@ namespace TBF.UI.Bench.Components sharedButtons.MoreClicked += moreButton_Click; Flags = CfgUpdateFlags.None; - } + } - private void ComponentCfgForm_Load(object sender, EventArgs e) - { - Text = Strings.Properties; + private void ComponentCfgForm_Load(object sender, EventArgs e) + { + Text = Strings.Properties; - if (ComponentCfgCtrl != null) - { - splitContainer.Panel1.Controls.Add((UserControl)ComponentCfgCtrl); + if (ComponentCfgCtrl != null) + { + var ctrl = (UserControl)ComponentCfgCtrl; + + ctrl.Dock = DockStyle.Fill; + splitContainer.Panel1.Controls.Add(ctrl); + + // auto–resize dialog based on this control + ResizeToFitControl(ctrl); if (ComponentCfgCtrl.ShowMore) - { sharedButtons.OptionalButtons = SharedButtons.Buttons.More; - } if (UnlockAfterStart) { @@ -89,30 +101,30 @@ namespace TBF.UI.Bench.Components /// Handler of the Unlock button click /// private void Unlock(object sender, EventArgs e) - { - ComponentCfgCtrl.Unlock(); - } + { + ComponentCfgCtrl.Unlock(); + } - public CfgUpdateFlags VerifyCfg(ref string message) - { - if (ComponentCfgCtrl == null) return CfgUpdateFlags.None; /// Nothing to verify -> OK + public CfgUpdateFlags VerifyCfg(ref string message) + { + if (ComponentCfgCtrl == null) return CfgUpdateFlags.None; /// Nothing to verify -> OK return ComponentCfgCtrl.VerifyCfg(ref message); - } + } - private void okButton_Click(object sender, EventArgs e) - { - string message = string.Empty; - CfgUpdateFlags flags = VerifyCfg(ref message); - if ((flags & CfgUpdateFlags.Error) == CfgUpdateFlags.Error) - { - MessageBox.Show(Strings.Please_change_the_following_settings + message, - Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } + private void okButton_Click(object sender, EventArgs e) + { + string message = string.Empty; + CfgUpdateFlags flags = VerifyCfg(ref message); + if ((flags & CfgUpdateFlags.Error) == CfgUpdateFlags.Error) + { + MessageBox.Show(Strings.Please_change_the_following_settings + message, + Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } - if (ComponentCfgCtrl != null) - { - flags = ComponentCfgCtrl.UpdateCfg(); + if (ComponentCfgCtrl != null) + { + flags = ComponentCfgCtrl.UpdateCfg(); /// Prevent component name duplicity if (CmpntEntities != null) @@ -127,41 +139,60 @@ namespace TBF.UI.Bench.Components } } - if ((flags & CfgUpdateFlags.RestartRqrd) == CfgUpdateFlags.RestartRqrd) - { - MessageBox.Show(Strings.Program_restart_is_required_to_apply_some_settings, - Strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - ComponentCfgCtrl.Closing(); - } + if ((flags & CfgUpdateFlags.RestartRqrd) == CfgUpdateFlags.RestartRqrd) + { + MessageBox.Show(Strings.Program_restart_is_required_to_apply_some_settings, + Strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + ComponentCfgCtrl.Closing(); + } - Flags = flags; - DialogResult = DialogResult.OK; - Close(); - return; - } + Flags = flags; + DialogResult = DialogResult.OK; + Close(); + return; + } - private void cancelButton_Click(object sender, EventArgs e) - { - if (ComponentCfgCtrl != null) ComponentCfgCtrl.Closing(); - DialogResult = DialogResult.Cancel; - Close(); - return; - } + private void cancelButton_Click(object sender, EventArgs e) + { + if (ComponentCfgCtrl != null) ComponentCfgCtrl.Closing(); + DialogResult = DialogResult.Cancel; + Close(); + return; + } - private void moreButton_Click(object sender, EventArgs e) - { - ComponentCfgCtrl.Unlock(); + private void moreButton_Click(object sender, EventArgs e) + { + ComponentCfgCtrl.Unlock(); - if (sharedButtons.MoreActive) - { + if (sharedButtons.MoreActive) + { Height = Height + ComponentCfgCtrlMoreHeight; - } - else - { + } + else + { Height = Height - ComponentCfgCtrlMoreHeight; - } - return; - } - } + } + return; + } + private void ResizeToFitControl(UserControl cfgCtrl) + { + if (cfgCtrl == null) return; + + // Ask the control for its preferred size + Size desired = cfgCtrl.PreferredSize; + + // Extra space for right panel + form borders + int extraWidth = splitContainer.Panel2.Width + 40; + int extraHeight = 80; + + this.Width = desired.Width + extraWidth; + this.Height = desired.Height + extraHeight; + + // Do not exceed screen working area + var screen = Screen.FromControl(this).WorkingArea; + if (this.Width > screen.Width) this.Width = screen.Width - 20; + if (this.Height > screen.Height) this.Height = screen.Height - 20; + } + } } diff --git a/TBF/UI/ResultsMI/PreviousResultsDlg.cs b/TBF/UI/ResultsMI/PreviousResultsDlg.cs index 67619b9df..3ed534a26 100644 --- a/TBF/UI/ResultsMI/PreviousResultsDlg.cs +++ b/TBF/UI/ResultsMI/PreviousResultsDlg.cs @@ -221,16 +221,29 @@ namespace TBF.UI.ResultsMI /// /// Called from PreviousResultCtrl when 'Print' button pressed. /// - public void OnPrint(object sender, PreviousResultIdEventArgs data) + public void OnPrint(object sender, PreviousResultIdEventArgs data) //...MF { - if (PrintHandler == null) return; + if (PrintHandler == null) + return; + try { PrintHandler(sender, data); } catch (Exception e) { + // Log to file / internal logger log.Error("PrintHandler(...) failed", e); + + // Show message box to user + MessageBox.Show( + "Printing failed.\n\n" + + "Error: " + e.Message + + "\n\nCheck printer settings or try again.", + "Printing error", + MessageBoxButtons.OK, + MessageBoxIcon.Error + ); } } @@ -245,7 +258,7 @@ namespace TBF.UI.ResultsMI { if (c is IResultsPrinter) printers.Add(c as IResultsPrinter); } - var dlg = new PrintResultsSelectionDlg(printers); + var dlg = new PrintResultsSelectionDlg(printers, b); if (dlg.ShowDialog() != DialogResult.OK) return; TBF.Rig.IOperation printResultsOp = dlg.SelectedPrinter.ProcessResultsOp(b); diff --git a/TBF/UI/ResultsMI/PrintResultsSelectionDlg.Designer.cs b/TBF/UI/ResultsMI/PrintResultsSelectionDlg.Designer.cs index 1ed538db9..0282da216 100644 --- a/TBF/UI/ResultsMI/PrintResultsSelectionDlg.Designer.cs +++ b/TBF/UI/ResultsMI/PrintResultsSelectionDlg.Designer.cs @@ -32,6 +32,7 @@ this.printerLabel = new System.Windows.Forms.Label(); this.okButton = new System.Windows.Forms.Button(); this.cancelButton = new System.Windows.Forms.Button(); + this.editPrinterButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // printersComboBox @@ -73,11 +74,23 @@ this.cancelButton.UseVisualStyleBackColor = true; this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); // + // editPrinterButton + // + this.editPrinterButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.editPrinterButton.Location = new System.Drawing.Point(121, 68); + this.editPrinterButton.Name = "editPrinterButton"; + this.editPrinterButton.Size = new System.Drawing.Size(92, 40); + this.editPrinterButton.TabIndex = 6; + this.editPrinterButton.Text = "Edit printer"; + this.editPrinterButton.UseVisualStyleBackColor = true; + this.editPrinterButton.Click += new System.EventHandler(this.editPrinterButton_Click); + // // PrintResultsSelectionDlg // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(546, 127); + this.Controls.Add(this.editPrinterButton); this.Controls.Add(this.cancelButton); this.Controls.Add(this.okButton); this.Controls.Add(this.printerLabel); @@ -96,5 +109,6 @@ private System.Windows.Forms.Label printerLabel; private System.Windows.Forms.Button okButton; private System.Windows.Forms.Button cancelButton; + private System.Windows.Forms.Button editPrinterButton; } } \ No newline at end of file diff --git a/TBF/UI/ResultsMI/PrintResultsSelectionDlg.cs b/TBF/UI/ResultsMI/PrintResultsSelectionDlg.cs index 01a4cb943..4a0d27a97 100644 --- a/TBF/UI/ResultsMI/PrintResultsSelectionDlg.cs +++ b/TBF/UI/ResultsMI/PrintResultsSelectionDlg.cs @@ -1,12 +1,18 @@ /// /// Copyright (c) 2023 Sensus Slovensko a.s. /// +using Common; +using NHibernate; +using Results.Entities; using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using TBF.Resources; +using TBF.Rig.Generic; using TBF.Rig.GenericDevices; +using TBF.UI.Bench.Components; +using Config.Entities; namespace TBF.UI.ResultsMI { @@ -14,10 +20,12 @@ namespace TBF.UI.ResultsMI { readonly IList printers; public IResultsPrinter SelectedPrinter; + public Batch batch; - public PrintResultsSelectionDlg(IList printers) + public PrintResultsSelectionDlg(IList printers, Batch batch)//...MF { this.printers = printers; + this.batch = batch; InitializeComponent(); @@ -58,5 +66,19 @@ namespace TBF.UI.ResultsMI DialogResult = DialogResult.Cancel; Close(); } + + private void editPrinterButton_Click(object sender, EventArgs e)//...MF + { + if (printers != null) + foreach (var p in printers) + if (p.Cfg.Name == printersComboBox.Text) + { + ComponentParametersDlg printerCfgForm = new ComponentParametersDlg(this, p.Cfg.Id); + printerCfgForm.ComponentCfgCtrl = p.Cfg.GetControl(null); + printerCfgForm.ComponentCfgCtrl.Config = p.Cfg; + DialogResult dr = printerCfgForm.ShowDialog(); + if (dr != DialogResult.OK) return; + } + } } }