Spell check completed message is now possible to hide permanent

This commit is contained in:
niksedk 2014-08-07 19:08:17 +02:00
parent 4aa08a733e
commit 6b4741ef06
8 changed files with 321 additions and 8 deletions

View File

@ -0,0 +1,99 @@
namespace Nikse.SubtitleEdit.Forms
{
partial class DialogDoNotShowAgain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.checkBoxDoNotDisplayAgain = new System.Windows.Forms.CheckBox();
this.buttonOK = new System.Windows.Forms.Button();
this.labelText = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// checkBoxDoNotDisplayAgain
//
this.checkBoxDoNotDisplayAgain.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkBoxDoNotDisplayAgain.AutoSize = true;
this.checkBoxDoNotDisplayAgain.Location = new System.Drawing.Point(12, 283);
this.checkBoxDoNotDisplayAgain.Name = "checkBoxDoNotDisplayAgain";
this.checkBoxDoNotDisplayAgain.Size = new System.Drawing.Size(179, 17);
this.checkBoxDoNotDisplayAgain.TabIndex = 0;
this.checkBoxDoNotDisplayAgain.Text = "Don\'t display this message again";
this.checkBoxDoNotDisplayAgain.UseVisualStyleBackColor = true;
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(497, 279);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 21);
this.buttonOK.TabIndex = 3;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// labelText
//
this.labelText.AutoSize = true;
this.labelText.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.labelText.Location = new System.Drawing.Point(12, 24);
this.labelText.Name = "labelText";
this.labelText.Size = new System.Drawing.Size(33, 13);
this.labelText.TabIndex = 2;
this.labelText.Text = "text...";
//
// DialogDoNotShowAgain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 312);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.labelText);
this.Controls.Add(this.checkBoxDoNotDisplayAgain);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DialogDoNotShowAgain";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "SpellCheckCompleted";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DialogDoNotShowAgain_FormClosing);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SpellCheckCompleted_KeyDown);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.CheckBox checkBoxDoNotDisplayAgain;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Label labelText;
}
}

View File

@ -0,0 +1,64 @@
using Nikse.SubtitleEdit.Logic;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Nikse.SubtitleEdit.Forms
{
public partial class DialogDoNotShowAgain : Form
{
public bool DoNoDisplayAgain { get; set; }
public DialogDoNotShowAgain(string title, string text)
{
InitializeComponent();
Rectangle screenRectangle = RectangleToScreen(this.ClientRectangle);
int titleBarHeight = screenRectangle.Top - this.Top;
if (!string.IsNullOrEmpty(Configuration.Settings.Language.Main.DoNotDisplayMessageAgain))
{
checkBoxDoNotDisplayAgain.Text = Configuration.Settings.Language.Main.DoNotDisplayMessageAgain;
}
else
{
checkBoxDoNotDisplayAgain.Visible = false;
}
this.Text = title;
labelText.Text = text;
FixLargeFonts();
int width = Math.Max(checkBoxDoNotDisplayAgain.Width, labelText.Width);
this.Width = width + buttonOK.Width + 75;
this.Height = labelText.Top + labelText.Height + buttonOK.Height + titleBarHeight + 40;
}
private void FixLargeFonts()
{
Graphics graphics = this.CreateGraphics();
SizeF textSize = graphics.MeasureString(buttonOK.Text, this.Font);
if (textSize.Height > buttonOK.Height - 4)
{
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
Utilities.SetButtonHeight(this, newButtonHeight, 1);
}
}
private void SpellCheckCompleted_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape || e.KeyCode == Keys.Enter)
DialogResult = DialogResult.Cancel;
}
private void buttonOK_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void DialogDoNotShowAgain_FormClosing(object sender, FormClosingEventArgs e)
{
DoNoDisplayAgain = checkBoxDoNotDisplayAgain.Checked;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -963,13 +963,26 @@ namespace Nikse.SubtitleEdit.Forms
if (_noOfChangedWords > 0 || _noOfAddedWords > 0 || _noOfSkippedWords > 0 || completedMessage == Configuration.Settings.Language.SpellCheck.SpellCheckCompleted)
{
this.Hide();
MessageBox.Show(completedMessage + Environment.NewLine +
Environment.NewLine +
string.Format(mainLanguage.NumberOfCorrectedWords, _noOfChangedWords) + Environment.NewLine +
string.Format(mainLanguage.NumberOfSkippedWords, _noOfSkippedWords) + Environment.NewLine +
string.Format(mainLanguage.NumberOfCorrectWords, _noOfCorrectWords) + Environment.NewLine +
string.Format(mainLanguage.NumberOfWordsAddedToDictionary, _noOfAddedWords) + Environment.NewLine +
string.Format(mainLanguage.NumberOfNameHits, _noOfNamesEtc), _mainWindow.Title + " - " + mainLanguage.SpellCheck);
if (Configuration.Settings.Tools.SpellCheckShowCompletedMessage)
{
var form = new DialogDoNotShowAgain(_mainWindow.Title + " - " + mainLanguage.SpellCheck,
completedMessage + Environment.NewLine +
Environment.NewLine +
string.Format(mainLanguage.NumberOfCorrectedWords, _noOfChangedWords) + Environment.NewLine +
string.Format(mainLanguage.NumberOfSkippedWords, _noOfSkippedWords) + Environment.NewLine +
string.Format(mainLanguage.NumberOfCorrectWords, _noOfCorrectWords) + Environment.NewLine +
string.Format(mainLanguage.NumberOfWordsAddedToDictionary, _noOfAddedWords) + Environment.NewLine +
string.Format(mainLanguage.NumberOfNameHits, _noOfNamesEtc));
form.ShowDialog(_mainWindow);
Configuration.Settings.Tools.SpellCheckShowCompletedMessage = !form.DoNoDisplayAgain;
}
else
{
if (_noOfChangedWords > 0)
_mainWindow.ShowStatus(completedMessage + " - " + string.Format(mainLanguage.NumberOfCorrectedWords, _noOfChangedWords));
else
_mainWindow.ShowStatus(completedMessage);
}
}
}

View File

@ -987,6 +987,7 @@ namespace Nikse.SubtitleEdit.Logic
NothingToUndo = "Nothing to undo",
InvalidLanguageNameX = "Invalid language name: {0}",
UnableToChangeLanguage = "Unable to change language!",
DoNotDisplayMessageAgain = "Don't display this message again",
NumberOfCorrectedWords = "Number of corrected words: {0}",
NumberOfSkippedWords = "Number of skipped words: {0}",
NumberOfCorrectWords = "Number of correct words: {0}",

View File

@ -863,6 +863,7 @@
public string NothingToUndo { get; set; }
public string InvalidLanguageNameX { get; set; }
public string UnableToChangeLanguage { get; set; }
public string DoNotDisplayMessageAgain { get; set; }
public string NumberOfCorrectedWords { get; set; }
public string NumberOfSkippedWords { get; set; }
public string NumberOfCorrectWords { get; set; }

View File

@ -82,6 +82,7 @@ namespace Nikse.SubtitleEdit.Logic
public bool SpellCheckAutoChangeNames { get; set; }
public bool SpellCheckOneLetterWords { get; set; }
public bool SpellCheckEnglishAllowInQuoteAsIng { get; set; }
public bool SpellCheckShowCompletedMessage { get; set; }
public bool OcrFixUseHardcodedRules { get; set; }
public string Interjections { get; set; }
public string MicrosoftBingApiId { get; set; }
@ -175,6 +176,7 @@ namespace Nikse.SubtitleEdit.Logic
GoogleTranslateLastTargetLanguage = "en";
SpellCheckOneLetterWords = true;
SpellCheckEnglishAllowInQuoteAsIng = false;
SpellCheckShowCompletedMessage = true;
ListViewSyntaxColorDurationSmall = true;
ListViewSyntaxColorDurationBig = true;
ListViewSyntaxColorOverlap = true;
@ -1499,7 +1501,10 @@ namespace Nikse.SubtitleEdit.Logic
settings.Tools.SpellCheckOneLetterWords = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("SpellCheckEnglishAllowInQuoteAsIng");
if (subNode != null)
settings.Tools.SpellCheckEnglishAllowInQuoteAsIng = Convert.ToBoolean(subNode.InnerText);
settings.Tools.SpellCheckEnglishAllowInQuoteAsIng = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("SpellCheckShowCompletedMessage");
if (subNode != null)
settings.Tools.SpellCheckShowCompletedMessage = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("OcrFixUseHardcodedRules");
if (subNode != null)
settings.Tools.OcrFixUseHardcodedRules = Convert.ToBoolean(subNode.InnerText);
@ -2703,6 +2708,7 @@ namespace Nikse.SubtitleEdit.Logic
textWriter.WriteElementString("SpellCheckAutoChangeNames", settings.Tools.SpellCheckAutoChangeNames.ToString());
textWriter.WriteElementString("SpellCheckOneLetterWords", settings.Tools.SpellCheckOneLetterWords.ToString());
textWriter.WriteElementString("SpellCheckEnglishAllowInQuoteAsIng", settings.Tools.SpellCheckEnglishAllowInQuoteAsIng.ToString());
textWriter.WriteElementString("SpellCheckShowCompletedMessage", settings.Tools.SpellCheckShowCompletedMessage.ToString());
textWriter.WriteElementString("OcrFixUseHardcodedRules", settings.Tools.OcrFixUseHardcodedRules.ToString());
textWriter.WriteElementString("Interjections", settings.Tools.Interjections);
textWriter.WriteElementString("MicrosoftBingApiId", settings.Tools.MicrosoftBingApiId);

View File

@ -561,6 +561,12 @@
<Compile Include="Forms\SpellCheck.Designer.cs">
<DependentUpon>SpellCheck.cs</DependentUpon>
</Compile>
<Compile Include="Forms\DialogDoNotShowAgain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\DialogDoNotShowAgain.Designer.cs">
<DependentUpon>DialogDoNotShowAgain.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Split.cs">
<SubType>Form</SubType>
</Compile>
@ -1431,6 +1437,9 @@
<DependentUpon>SpellCheck.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\DialogDoNotShowAgain.resx">
<DependentUpon>DialogDoNotShowAgain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Split.resx">
<DependentUpon>Split.cs</DependentUpon>
</EmbeddedResource>