Munich Printer page orientation can be selected in component properties, version 1.5.122.
This commit is contained in:
@@ -45,11 +45,14 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public MunichPrintDocument(Printer printer)
|
||||
public MunichPrintDocument(Printer printer,
|
||||
Entities.PageOrientation pageOrientation)
|
||||
{
|
||||
prn = printer;
|
||||
combined = (prn.Results[0].MetersKind == Entities.MetersKind.Combined);
|
||||
secondTableOffset = (prn.Results.Count + 2) * SpacingOneAndHalf;
|
||||
|
||||
DefaultPageSettings.Landscape = (pageOrientation == Entities.PageOrientation.Landscape);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
{
|
||||
if (Results != null && Results.Count >= 1)
|
||||
{
|
||||
new MunichPrintDocument(this).Print();
|
||||
new MunichPrintDocument(this, printerCfg.PageOrientation).Print();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,12 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
public IComponent GetComponent(IList<IComponent> components) { return new Printer(this); }
|
||||
public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public Entities.PageOrientation PageOrientation;
|
||||
public bool SupressPrinting; /// Bypass printing when true
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
public ProcParams ProcParams;
|
||||
@@ -30,6 +36,8 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
{
|
||||
Name = "PrintedProtocol";
|
||||
ParentName = string.Empty;
|
||||
PageOrientation = Entities.PageOrientation.Portrait;
|
||||
SupressPrinting = false;
|
||||
ProcParams = new ProcParams();
|
||||
}
|
||||
|
||||
@@ -41,7 +49,10 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
return string.Format("Name={0}, Orientation={1}, SupressPrinting={2}",
|
||||
Name,
|
||||
PageOrientation,
|
||||
SupressPrinting ? "yes" : "no");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
public PrinterCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
orientationComboBox.Items.Add(Entities.PageOrientation.Portrait.ToString());
|
||||
orientationComboBox.Items.Add(Entities.PageOrientation.Landscape.ToString());
|
||||
}
|
||||
|
||||
private void PrinterCfgCtrl_Load(object sender, EventArgs e)
|
||||
@@ -39,21 +42,39 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
{
|
||||
}
|
||||
|
||||
Entities.PageOrientation GetOrientation(string str)
|
||||
{
|
||||
if (str.Equals(Entities.PageOrientation.Landscape.ToString())) return Entities.PageOrientation.Landscape;
|
||||
if (str.Equals(Entities.PageOrientation.Portrait.ToString())) return Entities.PageOrientation.Portrait;
|
||||
return (Entities.PageOrientation)(-1);
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
orientationComboBox.Text = config.PageOrientation.ToString();
|
||||
supressPrintingCheckBox.Checked = config.SupressPrinting;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
orientationComboBox.Enabled = true;
|
||||
supressPrintingCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
if ((int)GetOrientation(orientationComboBox.Text) < 0)
|
||||
{
|
||||
message += Environment.NewLine + "Invalid 'Page orientation'";
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -64,6 +85,8 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.PageOrientation = GetOrientation(orientationComboBox.Text);
|
||||
config.SupressPrinting = supressPrintingCheckBox.Checked;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
+43
-5
@@ -34,12 +34,15 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.orientationComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.orientationLabel = new System.Windows.Forms.Label();
|
||||
this.supressPrintingCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
|
||||
this.nameTextBox.Location = new System.Drawing.Point(143, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
@@ -47,7 +50,7 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(27, 60);
|
||||
this.nameLabel.Location = new System.Drawing.Point(25, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
@@ -56,20 +59,52 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
|
||||
this.classNameLabel.Location = new System.Drawing.Point(140, 24);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// BasicPrinterCfgCtrl
|
||||
// orientationComboBox
|
||||
//
|
||||
this.orientationComboBox.Enabled = false;
|
||||
this.orientationComboBox.FormattingEnabled = true;
|
||||
this.orientationComboBox.Location = new System.Drawing.Point(143, 85);
|
||||
this.orientationComboBox.Name = "orientationComboBox";
|
||||
this.orientationComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.orientationComboBox.TabIndex = 9;
|
||||
//
|
||||
// orientationLabel
|
||||
//
|
||||
this.orientationLabel.AutoSize = true;
|
||||
this.orientationLabel.Location = new System.Drawing.Point(25, 88);
|
||||
this.orientationLabel.Name = "orientationLabel";
|
||||
this.orientationLabel.Size = new System.Drawing.Size(84, 13);
|
||||
this.orientationLabel.TabIndex = 8;
|
||||
this.orientationLabel.Text = "Page orientation";
|
||||
//
|
||||
// supressPrintingCheckBox
|
||||
//
|
||||
this.supressPrintingCheckBox.AutoSize = true;
|
||||
this.supressPrintingCheckBox.Enabled = false;
|
||||
this.supressPrintingCheckBox.Location = new System.Drawing.Point(143, 123);
|
||||
this.supressPrintingCheckBox.Name = "supressPrintingCheckBox";
|
||||
this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17);
|
||||
this.supressPrintingCheckBox.TabIndex = 12;
|
||||
this.supressPrintingCheckBox.Text = "Supress printing";
|
||||
this.supressPrintingCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// PrinterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.orientationComboBox);
|
||||
this.Controls.Add(this.orientationLabel);
|
||||
this.Controls.Add(this.supressPrintingCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "BasicPrinterCfgCtrl";
|
||||
this.Name = "PrinterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.PrinterCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
@@ -82,5 +117,8 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.ComboBox orientationComboBox;
|
||||
private System.Windows.Forms.Label orientationLabel;
|
||||
private System.Windows.Forms.CheckBox supressPrintingCheckBox;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user