diff --git a/Intento.MT.Plugin.PropertiesForm/IntentoMTFormOptions.cs b/Intento.MT.Plugin.PropertiesForm/IntentoMTFormOptions.cs index 2246702..ac556c4 100644 --- a/Intento.MT.Plugin.PropertiesForm/IntentoMTFormOptions.cs +++ b/Intento.MT.Plugin.PropertiesForm/IntentoMTFormOptions.cs @@ -44,6 +44,17 @@ public partial class IntentoMTFormOptions /// public string ProviderName { get; set; } + // --------------------------- Empty segments settings ------------------------------- + /// + /// Fail translation on empty segments + /// + public bool EmptySegmentsCheckEnabled { get; set; } + + /// + /// Percentage of empty segments to fail translation + /// + public int EmptySegmentsPercentage { get; set; } + // --------------------------- Account and provider authentication parameters ------------------------------- /// /// Using external authentication (not "Via Intento") diff --git a/Intento.MT.Plugin.PropertiesForm/WinForms/IntentoFormAdvanced.Designer.cs b/Intento.MT.Plugin.PropertiesForm/WinForms/IntentoFormAdvanced.Designer.cs index cf7db55..0639281 100644 --- a/Intento.MT.Plugin.PropertiesForm/WinForms/IntentoFormAdvanced.Designer.cs +++ b/Intento.MT.Plugin.PropertiesForm/WinForms/IntentoFormAdvanced.Designer.cs @@ -1,33 +1,33 @@ -namespace Intento.MT.Plugin.PropertiesForm.WinForms -{ - partial class IntentoFormAdvanced - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { +namespace Intento.MT.Plugin.PropertiesForm.WinForms +{ + partial class IntentoFormAdvanced + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { this.groupBoxProxy = new System.Windows.Forms.GroupBox(); this.groupBoxAuth = new System.Windows.Forms.GroupBox(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); @@ -44,6 +44,7 @@ private void InitializeComponent() this.labelPort = new System.Windows.Forms.Label(); this.textBoxPort = new System.Windows.Forms.TextBox(); this.checkBoxProxy = new System.Windows.Forms.CheckBox(); + this.checkBoxEmptySegments = new System.Windows.Forms.CheckBox(); this.checkBoxSaveApiKeyInRegistry = new System.Windows.Forms.CheckBox(); this.checkBoxTrace = new System.Windows.Forms.CheckBox(); this.buttonCancel = new System.Windows.Forms.Button(); @@ -55,6 +56,9 @@ private void InitializeComponent() this.checkBoxCustomTagParser = new System.Windows.Forms.CheckBox(); this.checkBoxCutTags = new System.Windows.Forms.CheckBox(); this.checkBoxSaveLocally = new System.Windows.Forms.CheckBox(); + this.spinBoxEmptySegmentsPercent = new System.Windows.Forms.NumericUpDown(); + this.labelEmptySegmentsPercentage = new System.Windows.Forms.Label(); + this.panelEmptySegmentsPercent = new System.Windows.Forms.Panel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.panel1 = new System.Windows.Forms.Panel(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); @@ -67,6 +71,7 @@ private void InitializeComponent() this.panel2.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.statusStrip1.SuspendLayout(); + this.panelEmptySegmentsPercent.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.panel1.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout(); @@ -100,7 +105,7 @@ private void InitializeComponent() this.groupBoxAuth.Margin = new System.Windows.Forms.Padding(0); this.groupBoxAuth.Name = "groupBoxAuth"; this.groupBoxAuth.Size = new System.Drawing.Size(503, 104); - this.groupBoxAuth.TabIndex = 16; + this.groupBoxAuth.TabIndex = 17; this.groupBoxAuth.TabStop = false; // // tableLayoutPanel4 @@ -181,7 +186,7 @@ private void InitializeComponent() this.panel2.Name = "panel2"; this.panel2.Padding = new System.Windows.Forms.Padding(3); this.panel2.Size = new System.Drawing.Size(503, 28); - this.panel2.TabIndex = 19; + this.panel2.TabIndex = 20; // // checkBoxAuth // @@ -191,7 +196,7 @@ private void InitializeComponent() this.checkBoxAuth.Margin = new System.Windows.Forms.Padding(0); this.checkBoxAuth.Name = "checkBoxAuth"; this.checkBoxAuth.Size = new System.Drawing.Size(497, 22); - this.checkBoxAuth.TabIndex = 17; + this.checkBoxAuth.TabIndex = 18; this.checkBoxAuth.Text = "Authorization required"; this.checkBoxAuth.UseVisualStyleBackColor = true; this.checkBoxAuth.CheckedChanged += new System.EventHandler(this.checkBoxAuth_CheckedChanged); @@ -214,7 +219,7 @@ private void InitializeComponent() this.tableLayoutPanel2.RowCount = 1; this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel2.Size = new System.Drawing.Size(503, 28); - this.tableLayoutPanel2.TabIndex = 18; + this.tableLayoutPanel2.TabIndex = 19; // // labelAddress // @@ -255,7 +260,7 @@ private void InitializeComponent() this.textBoxPort.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3); this.textBoxPort.Name = "textBoxPort"; this.textBoxPort.Size = new System.Drawing.Size(77, 22); - this.textBoxPort.TabIndex = 15; + this.textBoxPort.TabIndex = 16; this.textBoxPort.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxPort_KeyPress); // // checkBoxProxy @@ -266,11 +271,24 @@ private void InitializeComponent() this.checkBoxProxy.Location = new System.Drawing.Point(3, 26); this.checkBoxProxy.Name = "checkBoxProxy"; this.checkBoxProxy.Size = new System.Drawing.Size(513, 18); - this.checkBoxProxy.TabIndex = 13; + this.checkBoxProxy.TabIndex = 15; this.checkBoxProxy.Text = "checkBoxProxy"; this.checkBoxProxy.UseVisualStyleBackColor = true; this.checkBoxProxy.CheckedChanged += new System.EventHandler(this.checkBoxProxy_CheckedChanged); // + // checkBoxEmptySegments + // + this.checkBoxEmptySegments.Dock = System.Windows.Forms.DockStyle.Top; + this.checkBoxEmptySegments.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.checkBoxEmptySegments.Location = new System.Drawing.Point(6, 52); + this.checkBoxEmptySegments.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); + this.checkBoxEmptySegments.Name = "checkBoxEmptySegments"; + this.checkBoxEmptySegments.Size = new System.Drawing.Size(507, 34); + this.checkBoxEmptySegments.TabIndex = 14; + this.checkBoxEmptySegments.Text = "checkBoxEmptySegments"; + this.checkBoxEmptySegments.UseVisualStyleBackColor = true; + this.checkBoxEmptySegments.CheckedChanged += new System.EventHandler(this.checkBoxEmptySegments_CheckedChanged); + // // checkBoxSaveApiKeyInRegistry // this.checkBoxSaveApiKeyInRegistry.Dock = System.Windows.Forms.DockStyle.Fill; @@ -390,6 +408,38 @@ private void InitializeComponent() this.checkBoxSaveLocally.UseVisualStyleBackColor = true; this.checkBoxSaveLocally.Visible = false; // + // spinBoxEmptySegmentsPercent + // + this.spinBoxEmptySegmentsPercent.Dock = System.Windows.Forms.DockStyle.Right; + this.spinBoxEmptySegmentsPercent.Enabled = false; + this.spinBoxEmptySegmentsPercent.Location = new System.Drawing.Point(347, 0); + this.spinBoxEmptySegmentsPercent.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); + this.spinBoxEmptySegmentsPercent.Name = "spinBoxEmptySegmentsPercent"; + this.spinBoxEmptySegmentsPercent.Size = new System.Drawing.Size(160, 37); + this.spinBoxEmptySegmentsPercent.TabIndex = 41; + // + // labelEmptySegmentsPercentage + // + this.labelEmptySegmentsPercentage.Dock = System.Windows.Forms.DockStyle.Left; + this.labelEmptySegmentsPercentage.Location = new System.Drawing.Point(0, 0); + this.labelEmptySegmentsPercentage.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.labelEmptySegmentsPercentage.Name = "labelEmptySegmentsPercentage"; + this.labelEmptySegmentsPercentage.Size = new System.Drawing.Size(160, 44); + this.labelEmptySegmentsPercentage.TabIndex = 42; + this.labelEmptySegmentsPercentage.Text = "labelEmptySegmentsPercentage"; + this.labelEmptySegmentsPercentage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // panelEmptySegmentsPercent + // + this.panelEmptySegmentsPercent.Controls.Add(this.spinBoxEmptySegmentsPercent); + this.panelEmptySegmentsPercent.Controls.Add(this.labelEmptySegmentsPercentage); + this.panelEmptySegmentsPercent.Dock = System.Windows.Forms.DockStyle.Top; + this.panelEmptySegmentsPercent.Location = new System.Drawing.Point(525, 52); + this.panelEmptySegmentsPercent.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); + this.panelEmptySegmentsPercent.Name = "panelEmptySegmentsPercent"; + this.panelEmptySegmentsPercent.Size = new System.Drawing.Size(507, 44); + this.panelEmptySegmentsPercent.TabIndex = 43; + // // tableLayoutPanel1 // this.tableLayoutPanel1.AutoSize = true; @@ -398,15 +448,18 @@ private void InitializeComponent() this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel1.Controls.Add(this.checkBoxTrace, 0, 0); this.tableLayoutPanel1.Controls.Add(this.checkBoxSaveLocally, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.checkBoxProxy, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.checkBoxEmptySegments, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.panelEmptySegmentsPercent, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.checkBoxProxy, 0, 2); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.Size = new System.Drawing.Size(519, 47); + this.tableLayoutPanel1.Size = new System.Drawing.Size(519, 72); this.tableLayoutPanel1.TabIndex = 41; // // panel1 @@ -524,42 +577,46 @@ private void InitializeComponent() this.ResumeLayout(false); this.PerformLayout(); - } - - #endregion - - private System.Windows.Forms.GroupBox groupBoxProxy; - private System.Windows.Forms.CheckBox checkBoxAuth; - private System.Windows.Forms.GroupBox groupBoxAuth; - private System.Windows.Forms.TextBox textBoxPassword; - private System.Windows.Forms.Label labelPassword; - private System.Windows.Forms.TextBox textBoxUserName; - private System.Windows.Forms.Label labelUserName; - private System.Windows.Forms.TextBox textBoxPort; - private System.Windows.Forms.Label labelPort; - private System.Windows.Forms.TextBox textBoxAddress; - private System.Windows.Forms.Label labelAddress; - public System.Windows.Forms.CheckBox checkBoxProxy; - public System.Windows.Forms.CheckBox checkBoxSaveApiKeyInRegistry; - public System.Windows.Forms.CheckBox checkBoxTrace; - private System.Windows.Forms.Button buttonCancel; - public System.Windows.Forms.Button buttonSave; - private System.Windows.Forms.StatusStrip statusStrip1; - public System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; - private System.Windows.Forms.TextBox textBoxCustomSettingsName; - private System.Windows.Forms.Label labelCustomSettingsName; - public System.Windows.Forms.CheckBox checkBoxCustomTagParser; - public System.Windows.Forms.CheckBox checkBoxCutTags; - private System.Windows.Forms.Label labelError; - public System.Windows.Forms.CheckBox checkBoxSaveLocally; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5; - private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.Panel panel4; - } + } + + #endregion + + private System.Windows.Forms.GroupBox groupBoxProxy; + private System.Windows.Forms.CheckBox checkBoxAuth; + private System.Windows.Forms.GroupBox groupBoxAuth; + private System.Windows.Forms.TextBox textBoxPassword; + private System.Windows.Forms.Label labelPassword; + private System.Windows.Forms.TextBox textBoxUserName; + private System.Windows.Forms.Label labelUserName; + private System.Windows.Forms.TextBox textBoxPort; + private System.Windows.Forms.Label labelPort; + private System.Windows.Forms.TextBox textBoxAddress; + private System.Windows.Forms.Label labelAddress; + public System.Windows.Forms.CheckBox checkBoxProxy; + public System.Windows.Forms.CheckBox checkBoxEmptySegments; + public System.Windows.Forms.NumericUpDown spinBoxEmptySegmentsPercent; + public System.Windows.Forms.CheckBox checkBoxSaveApiKeyInRegistry; + public System.Windows.Forms.CheckBox checkBoxTrace; + private System.Windows.Forms.Button buttonCancel; + public System.Windows.Forms.Button buttonSave; + private System.Windows.Forms.StatusStrip statusStrip1; + public System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.TextBox textBoxCustomSettingsName; + private System.Windows.Forms.Label labelCustomSettingsName; + public System.Windows.Forms.CheckBox checkBoxCustomTagParser; + public System.Windows.Forms.CheckBox checkBoxCutTags; + private System.Windows.Forms.Label labelError; + public System.Windows.Forms.CheckBox checkBoxSaveLocally; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.Label labelEmptySegmentsPercentage; + private System.Windows.Forms.Panel panelEmptySegmentsPercent; + } } \ No newline at end of file diff --git a/Intento.MT.Plugin.PropertiesForm/WinForms/IntentoFormAdvanced.cs b/Intento.MT.Plugin.PropertiesForm/WinForms/IntentoFormAdvanced.cs index 9fbdf28..73f91d0 100644 --- a/Intento.MT.Plugin.PropertiesForm/WinForms/IntentoFormAdvanced.cs +++ b/Intento.MT.Plugin.PropertiesForm/WinForms/IntentoFormAdvanced.cs @@ -31,12 +31,13 @@ private void LocalizeContent() checkBoxProxy.Text = Resource.FAcheckBoxProxy; labelAddress.Text = Resource.FAlabelAddress; checkBoxTrace.Text = Resource.FAcheckBoxTrace; + checkBoxEmptySegments.Text = Resource.FAcheckBoxEmptySegments; + labelEmptySegmentsPercentage.Text = Resource.FAlabelEmptySegmentsPercentage; labelPassword.Text = Resource.FAlabelPassword; labelPort.Text = Resource.FAlabelPort; labelUserName.Text = Resource.FAlabelUserName; buttonCancel.Text = Resource.Cancel; - buttonSave.Text = Resource.Save; - checkBoxTrace.Text = Resource.FAcheckBoxTrace; + buttonSave.Text = Resource.Save; Text = Resource.FAcaption; labelCustomSettingsName.Text = Resource.FAlabelCustomSettingsName; checkBoxCustomTagParser.Text = Resource.FAcheckBoxCustomTagParser; @@ -58,6 +59,11 @@ private void checkBoxProxy_CheckedChanged(object sender, EventArgs e) groupBoxProxy.Enabled = checkBoxProxy.Checked; } + private void checkBoxEmptySegments_CheckedChanged(object sender, EventArgs e) + { + panelEmptySegmentsPercent.Enabled = checkBoxEmptySegments.Checked; + } + private void buttonSave_Click(object sender, EventArgs e) { RemoteLogService.SetTraceEndTime(DateTime.Now.AddMinutes(checkBoxTrace.Checked ? 30 : -40)); @@ -66,6 +72,10 @@ private void buttonSave_Click(object sender, EventArgs e) parent.CurrentOptions.CutTag = checkBoxCutTags.Checked; parent.CurrentOptions.SaveLocally = checkBoxSaveLocally.Checked; + parent.CurrentOptions.EmptySegmentsCheckEnabled = checkBoxEmptySegments.Checked; + // TODO do we need to check that value is in range? + parent.CurrentOptions.EmptySegmentsPercentage = (int)spinBoxEmptySegmentsPercent.Value; + if (!checkBoxProxy.Checked) { if (parent.CurrentOptions.ProxySettings != null) @@ -194,6 +204,11 @@ private void IntentoFormAdvanced_Shown(object sender, EventArgs e) checkBoxSaveLocally.Checked = parent.CurrentOptions.SaveLocally; checkBoxSaveLocally.Visible = parent.IsTrados || !parent.MemoqPublic; + checkBoxEmptySegments.Checked = parent.CurrentOptions.EmptySegmentsCheckEnabled; + // TODO shouldn't this be called after setting the value? + checkBoxEmptySegments_CheckedChanged(null, null); + spinBoxEmptySegmentsPercent.Value = parent.CurrentOptions.EmptySegmentsPercentage; + // Specific setting for Trados textBoxCustomSettingsName.Visible = parent.IsTrados; labelCustomSettingsName.Visible = parent.IsTrados; diff --git a/Intento.MT.Plugin.PropertiesForm/WinForms/Resource.Designer.cs b/Intento.MT.Plugin.PropertiesForm/WinForms/Resource.Designer.cs index f0637be..22ab4e3 100644 --- a/Intento.MT.Plugin.PropertiesForm/WinForms/Resource.Designer.cs +++ b/Intento.MT.Plugin.PropertiesForm/WinForms/Resource.Designer.cs @@ -294,6 +294,15 @@ internal static string FACheckBoxCutTags { } } + /// + /// Looks up a localized string similar to Empty segments check. + /// + internal static string FAcheckBoxEmptySegments { + get { + return ResourceManager.GetString("FAcheckBoxEmptySegments", resourceCulture); + } + } + /// /// Looks up a localized string similar to Enable proxy server (Attention! Proxy settings apply to all sets of settings). /// @@ -348,6 +357,15 @@ internal static string FAlabelCustomSettingsName { } } + /// + /// Looks up a localized string similar to Percentage. + /// + internal static string FAlabelEmptySegmentsPercentage { + get { + return ResourceManager.GetString("FAlabelEmptySegmentsPercentage", resourceCulture); + } + } + /// /// Looks up a localized string similar to Password:. /// diff --git a/Intento.MT.Plugin.PropertiesForm/WinForms/Resource.resx b/Intento.MT.Plugin.PropertiesForm/WinForms/Resource.resx index 42b8c56..c6b9777 100644 --- a/Intento.MT.Plugin.PropertiesForm/WinForms/Resource.resx +++ b/Intento.MT.Plugin.PropertiesForm/WinForms/Resource.resx @@ -356,4 +356,10 @@ If you have selected custom model or glossary, please adjust the language pair:< Uncheck all + + Empty segments check + + + Percentage + \ No newline at end of file