Spell check usability - Now 'change' / 'change all' buttons are only enabled when textbox text has been changed (thx Zoltan)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@643 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-09-17 06:45:03 +00:00
parent 124a11ac29
commit a71d7c38e7
4 changed files with 31 additions and 13 deletions

View File

@ -81,8 +81,8 @@
//
// groupBoxSuggestions
//
this.groupBoxSuggestions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxSuggestions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxSuggestions.Controls.Add(this.buttonUseSuggestionAlways);
this.groupBoxSuggestions.Controls.Add(this.buttonUseSuggestion);
this.groupBoxSuggestions.Controls.Add(this.listBoxSuggestions);
@ -117,8 +117,8 @@
//
// listBoxSuggestions
//
this.listBoxSuggestions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listBoxSuggestions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listBoxSuggestions.FormattingEnabled = true;
this.listBoxSuggestions.Location = new System.Drawing.Point(6, 39);
this.listBoxSuggestions.Name = "listBoxSuggestions";
@ -189,6 +189,7 @@
this.textBoxWord.Name = "textBoxWord";
this.textBoxWord.Size = new System.Drawing.Size(290, 22);
this.textBoxWord.TabIndex = 31;
this.textBoxWord.TextChanged += new System.EventHandler(this.textBoxWord_TextChanged);
this.textBoxWord.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxWordKeyDown);
//
// buttonSkipOnce
@ -255,9 +256,9 @@
//
// groupBoxTextAsImage
//
this.groupBoxTextAsImage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxTextAsImage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxTextAsImage.Controls.Add(this.pictureBoxText);
this.groupBoxTextAsImage.Location = new System.Drawing.Point(12, 12);
this.groupBoxTextAsImage.Name = "groupBoxTextAsImage";
@ -268,9 +269,9 @@
//
// pictureBoxText
//
this.pictureBoxText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBoxText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBoxText.Location = new System.Drawing.Point(6, 18);
this.pictureBoxText.Name = "pictureBoxText";
this.pictureBoxText.Size = new System.Drawing.Size(684, 127);
@ -279,8 +280,8 @@
//
// groupBoxText
//
this.groupBoxText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxText.Controls.Add(this.richTextBoxParagraph);
this.groupBoxText.Controls.Add(this.buttonEditWholeText);
this.groupBoxText.Controls.Add(this.buttonEditWord);

View File

@ -250,5 +250,11 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void textBoxWord_TextChanged(object sender, EventArgs e)
{
buttonChange.Enabled = textBoxWord.Text != _originalWord;
buttonChangeAll.Enabled = buttonChange.Enabled;
}
}
}

View File

@ -149,6 +149,7 @@
this.textBoxWord.Name = "textBoxWord";
this.textBoxWord.Size = new System.Drawing.Size(250, 21);
this.textBoxWord.TabIndex = 1;
this.textBoxWord.TextChanged += new System.EventHandler(this.textBoxWord_TextChanged);
//
// buttonAbort
//
@ -254,7 +255,7 @@
this.checkBoxAutoChangeNames.AutoSize = true;
this.checkBoxAutoChangeNames.Location = new System.Drawing.Point(8, 157);
this.checkBoxAutoChangeNames.Name = "checkBoxAutoChangeNames";
this.checkBoxAutoChangeNames.Size = new System.Drawing.Size(216, 17);
this.checkBoxAutoChangeNames.Size = new System.Drawing.Size(209, 17);
this.checkBoxAutoChangeNames.TabIndex = 12;
this.checkBoxAutoChangeNames.Text = "Auto fix names where only casing differ";
this.checkBoxAutoChangeNames.UseVisualStyleBackColor = true;

View File

@ -44,6 +44,7 @@ namespace Nikse.SubtitleEdit.Forms
string[] _words;
int _wordsIndex;
Subtitle _subtitle;
string _originalWord;
int _noOfSkippedWords = 0;
int _noOfChangedWords = 0;
@ -111,6 +112,7 @@ namespace Nikse.SubtitleEdit.Forms
public void Initialize(string languageName, string word, List<string> suggestions, string paragraph, string progress)
{
_originalWord = word;
_suggestions = suggestions;
groupBoxWordNotFound.Visible = true;
groupBoxEditWholeText.Visible = false;
@ -122,6 +124,9 @@ namespace Nikse.SubtitleEdit.Forms
{
listBoxSuggestions.Items.Add(suggestion);
}
if (listBoxSuggestions.Items.Count > 0)
listBoxSuggestions.SelectedIndex = 0;
richTextBoxParagraph.Text = paragraph;
comboBoxDictionaries.SelectedIndexChanged -= ComboBoxDictionariesSelectedIndexChanged;
@ -727,6 +732,11 @@ namespace Nikse.SubtitleEdit.Forms
PrepareNextWord();
}
private void textBoxWord_TextChanged(object sender, EventArgs e)
{
buttonChange.Enabled = textBoxWord.Text != _originalWord;
buttonChangeAll.Enabled = buttonChange.Enabled;
}
}
}