This commit is contained in:
parent
f97178b8da
commit
25291a3a80
38
PROMS/Volian.Controls.Library/VlnSpellCheck.cs
Normal file
38
PROMS/Volian.Controls.Library/VlnSpellCheck.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
public class VlnSpellCheck
|
||||
{
|
||||
private StepItem _MyStepItem;
|
||||
public StepItem MyStepItem
|
||||
{
|
||||
get { return _MyStepItem; }
|
||||
set
|
||||
{
|
||||
_MyStepItem = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public VlnSpellCheck()
|
||||
{
|
||||
}
|
||||
|
||||
public void DoSpellCheck()
|
||||
{
|
||||
while (MyStepItem.MyStepRTB.SpellCheckNext())
|
||||
{
|
||||
ItemInfo next = MyStepItem.MyItemInfo.SearchNext;
|
||||
if (next.IsSection)
|
||||
return; // spell check only current section
|
||||
MyStepItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(next);
|
||||
}
|
||||
MyStepItem.MyStepRTB.Focus();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
211
PROMS/Volian.Controls.Library/VlnSpellCheckDlg.Designer.cs
generated
Normal file
211
PROMS/Volian.Controls.Library/VlnSpellCheckDlg.Designer.cs
generated
Normal file
@ -0,0 +1,211 @@
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
partial class VlnSpellCheckDlg
|
||||
{
|
||||
/// <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.lblNotInDictionary = new DevComponents.DotNetBar.LabelX();
|
||||
this.txbBadWord = new DevComponents.DotNetBar.Controls.TextBoxX();
|
||||
this.lbSuggestList = new System.Windows.Forms.ListBox();
|
||||
this.btnIgnore = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnIgnoreAll = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnChange = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnChangeAll = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnAddToDictionary = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnCancel = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnRemove = new DevComponents.DotNetBar.ButtonX();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblNotInDictionary
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
this.lblNotInDictionary.BackgroundStyle.Class = "";
|
||||
this.lblNotInDictionary.Location = new System.Drawing.Point(12, 1);
|
||||
this.lblNotInDictionary.Name = "lblNotInDictionary";
|
||||
this.lblNotInDictionary.Size = new System.Drawing.Size(108, 23);
|
||||
this.lblNotInDictionary.TabIndex = 0;
|
||||
this.lblNotInDictionary.Text = "Not In Dictionary:";
|
||||
//
|
||||
// txbBadWord
|
||||
//
|
||||
this.txbBadWord.AcceptsReturn = true;
|
||||
this.txbBadWord.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
//
|
||||
//
|
||||
//
|
||||
this.txbBadWord.Border.Class = "TextBoxBorder";
|
||||
this.txbBadWord.Location = new System.Drawing.Point(12, 30);
|
||||
this.txbBadWord.Name = "txbBadWord";
|
||||
this.txbBadWord.Size = new System.Drawing.Size(185, 22);
|
||||
this.txbBadWord.TabIndex = 1;
|
||||
this.txbBadWord.TextChanged += new System.EventHandler(this.txbBadWord_TextChanged);
|
||||
//
|
||||
// lbSuggestList
|
||||
//
|
||||
this.lbSuggestList.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.lbSuggestList.FormattingEnabled = true;
|
||||
this.lbSuggestList.ItemHeight = 16;
|
||||
this.lbSuggestList.Location = new System.Drawing.Point(12, 58);
|
||||
this.lbSuggestList.Name = "lbSuggestList";
|
||||
this.lbSuggestList.Size = new System.Drawing.Size(185, 148);
|
||||
this.lbSuggestList.TabIndex = 2;
|
||||
this.lbSuggestList.SelectedIndexChanged += new System.EventHandler(this.lbSuggestList_SelectedIndexChanged);
|
||||
this.lbSuggestList.DoubleClick += new System.EventHandler(this.lbSuggestList_DoubleClick);
|
||||
//
|
||||
// btnIgnore
|
||||
//
|
||||
this.btnIgnore.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
this.btnIgnore.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnIgnore.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnIgnore.Location = new System.Drawing.Point(208, 29);
|
||||
this.btnIgnore.Name = "btnIgnore";
|
||||
this.btnIgnore.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnIgnore.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnIgnore.TabIndex = 3;
|
||||
this.btnIgnore.Text = "Ignore";
|
||||
this.btnIgnore.Click += new System.EventHandler(this.btnIgnore_Click);
|
||||
//
|
||||
// btnIgnoreAll
|
||||
//
|
||||
this.btnIgnoreAll.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
this.btnIgnoreAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnIgnoreAll.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnIgnoreAll.Location = new System.Drawing.Point(289, 29);
|
||||
this.btnIgnoreAll.Name = "btnIgnoreAll";
|
||||
this.btnIgnoreAll.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnIgnoreAll.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnIgnoreAll.TabIndex = 4;
|
||||
this.btnIgnoreAll.Text = "Ignore All";
|
||||
this.btnIgnoreAll.Click += new System.EventHandler(this.btnIgnoreAll_Click);
|
||||
//
|
||||
// btnChange
|
||||
//
|
||||
this.btnChange.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
this.btnChange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnChange.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnChange.Location = new System.Drawing.Point(208, 58);
|
||||
this.btnChange.Name = "btnChange";
|
||||
this.btnChange.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnChange.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnChange.TabIndex = 5;
|
||||
this.btnChange.Text = "Change";
|
||||
this.btnChange.Click += new System.EventHandler(this.btnChange_Click);
|
||||
//
|
||||
// btnChangeAll
|
||||
//
|
||||
this.btnChangeAll.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
this.btnChangeAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnChangeAll.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnChangeAll.Location = new System.Drawing.Point(289, 58);
|
||||
this.btnChangeAll.Name = "btnChangeAll";
|
||||
this.btnChangeAll.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnChangeAll.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnChangeAll.TabIndex = 6;
|
||||
this.btnChangeAll.Text = "Change All";
|
||||
this.btnChangeAll.Click += new System.EventHandler(this.btnChangeAll_Click);
|
||||
//
|
||||
// btnAddToDictionary
|
||||
//
|
||||
this.btnAddToDictionary.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
this.btnAddToDictionary.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnAddToDictionary.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnAddToDictionary.Location = new System.Drawing.Point(208, 1);
|
||||
this.btnAddToDictionary.Name = "btnAddToDictionary";
|
||||
this.btnAddToDictionary.Size = new System.Drawing.Size(156, 23);
|
||||
this.btnAddToDictionary.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnAddToDictionary.TabIndex = 7;
|
||||
this.btnAddToDictionary.Text = "Add To Dictionary";
|
||||
this.btnAddToDictionary.Click += new System.EventHandler(this.btnAddToDictionary_Click);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Location = new System.Drawing.Point(287, 188);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCancel.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnCancel.TabIndex = 8;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
//
|
||||
// btnRemove
|
||||
//
|
||||
this.btnRemove.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
this.btnRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnRemove.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnRemove.Location = new System.Drawing.Point(208, 87);
|
||||
this.btnRemove.Name = "btnRemove";
|
||||
this.btnRemove.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnRemove.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnRemove.TabIndex = 9;
|
||||
this.btnRemove.Text = "Remove";
|
||||
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
|
||||
//
|
||||
// VlnSpellCheckDlg
|
||||
//
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.ClientSize = new System.Drawing.Size(374, 223);
|
||||
this.Controls.Add(this.btnRemove);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnAddToDictionary);
|
||||
this.Controls.Add(this.btnChangeAll);
|
||||
this.Controls.Add(this.btnChange);
|
||||
this.Controls.Add(this.btnIgnoreAll);
|
||||
this.Controls.Add(this.btnIgnore);
|
||||
this.Controls.Add(this.lbSuggestList);
|
||||
this.Controls.Add(this.txbBadWord);
|
||||
this.Controls.Add(this.lblNotInDictionary);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(392, 266);
|
||||
this.Name = "VlnSpellCheckDlg";
|
||||
this.Text = "Spell Check";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DevComponents.DotNetBar.LabelX lblNotInDictionary;
|
||||
private DevComponents.DotNetBar.Controls.TextBoxX txbBadWord;
|
||||
private System.Windows.Forms.ListBox lbSuggestList;
|
||||
private DevComponents.DotNetBar.ButtonX btnIgnore;
|
||||
private DevComponents.DotNetBar.ButtonX btnIgnoreAll;
|
||||
private DevComponents.DotNetBar.ButtonX btnChange;
|
||||
private DevComponents.DotNetBar.ButtonX btnChangeAll;
|
||||
private DevComponents.DotNetBar.ButtonX btnAddToDictionary;
|
||||
private DevComponents.DotNetBar.ButtonX btnCancel;
|
||||
private DevComponents.DotNetBar.ButtonX btnRemove;
|
||||
}
|
||||
}
|
292
PROMS/Volian.Controls.Library/VlnSpellCheckDlg.cs
Normal file
292
PROMS/Volian.Controls.Library/VlnSpellCheckDlg.cs
Normal file
@ -0,0 +1,292 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar;
|
||||
using C1.Win.C1SpellChecker;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
// Our custom Spell Checker dialog
|
||||
public partial class VlnSpellCheckDlg : DevComponents.DotNetBar.Office2007Form, ISpellDialog
|
||||
{
|
||||
private C1SpellChecker _Spell;
|
||||
private ISpellCheckableEditor _Editor;
|
||||
private CharRangeList _Errors;
|
||||
private int _ErrorCount;
|
||||
private int _ErrorIndex = -1; // current error index
|
||||
private bool _AutoSuggest = true;
|
||||
private string _NoSuggestionsText = "(no suggestions)";
|
||||
|
||||
Dictionary<string, string> _changeAll = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="CharRange"/> object that represents the error currently
|
||||
/// displayed in the dialog.
|
||||
/// </summary>
|
||||
public CharRange CurrentError
|
||||
{
|
||||
get { return _Errors[_ErrorIndex]; }
|
||||
}
|
||||
|
||||
public VlnSpellCheckDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes the dialog to use the given parameters.
|
||||
/// </summary>
|
||||
/// <param name="spell"><see cref="C1SpellChecker"/> to use for spelling.</param>
|
||||
/// <param name="editor"><see cref="ISpellCheckableEditor"/> that contains the text to spell-check.</param>
|
||||
/// <param name="errors"><see cref="CharRangeList"/> that contains the initial error list.</param>
|
||||
public void Initialize(C1SpellChecker spell, ISpellCheckableEditor editor, CharRangeList errors)
|
||||
{
|
||||
_Spell = spell;
|
||||
_Editor = editor;
|
||||
_Errors = errors;
|
||||
if (_Errors == null)
|
||||
{
|
||||
_Errors = _Spell.CheckText(_Editor.Text);
|
||||
}
|
||||
_ErrorCount += _Errors.Count;
|
||||
btnAddToDictionary.Visible = _Spell.UserDictionary.Enabled;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the total number of errors detected in the control.
|
||||
/// </summary>
|
||||
public int ErrorCount
|
||||
{
|
||||
get { return _ErrorCount; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the index of the current error into the <see cref="Errors"/> list.
|
||||
/// </summary>
|
||||
public int ErrorIndex
|
||||
{
|
||||
get { return _ErrorIndex; }
|
||||
set
|
||||
{
|
||||
_ErrorIndex = value;
|
||||
UpdateCurrentError();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateEditor(string replacement)
|
||||
{
|
||||
// save starting point to continue checking from here
|
||||
int start = CurrentError.Start;
|
||||
|
||||
if (replacement.Length == 0)
|
||||
{
|
||||
// if replacement is empty, expand over spaces and commas
|
||||
CharRange delete = CharRange.ExpandOverWhitespace(_Editor.Text, CurrentError);
|
||||
_Editor.Select(delete.Start, delete.Text.Length);
|
||||
}
|
||||
|
||||
// replace word in text and re-check
|
||||
_Editor.SelectedText = replacement;
|
||||
_Errors = _Spell.CheckText(_Editor.Text, start);
|
||||
|
||||
// update index
|
||||
ErrorIndex = ErrorIndex; // originally 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="Form.Load"/> event.
|
||||
/// </summary>
|
||||
/// <param name="e"><see cref="EventArgs"/> that contains the event data.</param>
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
// fire load event
|
||||
base.OnLoad(e);
|
||||
|
||||
// show first error (after firing load event)
|
||||
ErrorIndex = 0;
|
||||
}
|
||||
|
||||
private bool _Initializing = false;
|
||||
private string _OrgWord;
|
||||
|
||||
// update dialog to show current error
|
||||
private void UpdateCurrentError()
|
||||
{
|
||||
// design time
|
||||
if (DesignMode || _Errors == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// finished with this batch of errors
|
||||
if (ErrorIndex >= _Errors.Count)
|
||||
{
|
||||
// check whether the editor has more text to check
|
||||
while (_Editor.HasMoreText())
|
||||
{
|
||||
_Errors = _Spell.CheckText(_Editor.Text);
|
||||
if (_Errors.Count > 0)
|
||||
{
|
||||
_ErrorCount += _Errors.Count;
|
||||
ErrorIndex = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// editor has no more text...
|
||||
DialogResult = DialogResult.OK;
|
||||
return;
|
||||
}
|
||||
|
||||
// update current error
|
||||
CharRange err = CurrentError;
|
||||
|
||||
// select word in editor
|
||||
_Editor.Select(err.Start, err.Text.Length);
|
||||
|
||||
// honor 'change all' list
|
||||
if (_changeAll.ContainsKey(err.Text))
|
||||
{
|
||||
txbBadWord.Text = _changeAll[err.Text];
|
||||
btnChange_Click(this, EventArgs.Empty);
|
||||
return;
|
||||
}
|
||||
|
||||
_Initializing = true;
|
||||
// show bad word, new text
|
||||
txbBadWord.Text = _OrgWord = err.Text;
|
||||
|
||||
// repeated word?
|
||||
if (err.Duplicate)
|
||||
{
|
||||
// adjust dialog
|
||||
lblNotInDictionary.Text = "Duplicate Word";
|
||||
btnIgnoreAll.Enabled = false;
|
||||
btnAddToDictionary.Enabled = false;
|
||||
btnRemove.Enabled = true;
|
||||
|
||||
// no suggestions
|
||||
lbSuggestList.Items.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
// adjust dialog
|
||||
lblNotInDictionary.Text = "Not In Dictionary";
|
||||
btnIgnoreAll.Enabled = true;
|
||||
btnAddToDictionary.Enabled = true;
|
||||
btnRemove.Enabled = false;
|
||||
|
||||
SetupSuggestions(err.Text);
|
||||
}
|
||||
|
||||
// focus to new word
|
||||
_AutoSuggest = false;
|
||||
txbBadWord.SelectAll();
|
||||
txbBadWord.Focus();
|
||||
_AutoSuggest = true;
|
||||
AcceptButton = btnIgnore;
|
||||
|
||||
// show 'Add' button only if user dictionary is enabled
|
||||
btnAddToDictionary.Visible = _Spell.UserDictionary.Enabled;
|
||||
|
||||
// all ready, fire ErrorDisplayed event
|
||||
//OnErrorDisplayed(EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void SetupSuggestions(string badWord)
|
||||
{
|
||||
// show suggestions
|
||||
_Initializing = true;
|
||||
string[] suggestions = _Spell.GetSuggestions(badWord);
|
||||
lbSuggestList.Items.Clear();
|
||||
if (suggestions.Length > 0)
|
||||
{
|
||||
lbSuggestList.Items.AddRange(suggestions);
|
||||
lbSuggestList.SelectedIndex = -1;
|
||||
lbSuggestList.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lbSuggestList.Items.Add(_NoSuggestionsText);
|
||||
lbSuggestList.SelectedIndex = -1;
|
||||
lbSuggestList.Enabled = false;
|
||||
}
|
||||
_Initializing = false;
|
||||
}
|
||||
|
||||
private void txbBadWord_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
btnChange.Enabled = (_OrgWord != txbBadWord.Text);
|
||||
btnChangeAll.Enabled = btnChange.Enabled && lblNotInDictionary.Text == "Not In Dictionary";
|
||||
btnAddToDictionary.Enabled = _Spell.UserDictionary.Enabled && !InDictionary(txbBadWord.Text);
|
||||
if (_AutoSuggest && !_Initializing)
|
||||
{
|
||||
SetupSuggestions(txbBadWord.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private bool InDictionary(string word)
|
||||
{
|
||||
if (_Spell.MainDictionary.Contains(word))
|
||||
return true;
|
||||
if (_Spell.CustomDictionary != null && _Spell.CustomDictionary.Contains(word))
|
||||
return true;
|
||||
if (_Spell.UserDictionary != null && _Spell.UserDictionary.Contains(word))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void btnChange_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateEditor(txbBadWord.Text);
|
||||
}
|
||||
|
||||
private void btnChangeAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
_changeAll[CurrentError.Text] = txbBadWord.Text;
|
||||
UpdateEditor(txbBadWord.Text);
|
||||
}
|
||||
|
||||
private void btnIgnore_Click(object sender, EventArgs e)
|
||||
{
|
||||
ErrorIndex++;
|
||||
}
|
||||
|
||||
private void btnIgnoreAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
_Spell.IgnoreList.Add(CurrentError.Text);
|
||||
_Errors = _Spell.CheckText(_Editor.Text, CurrentError.Start);
|
||||
UpdateCurrentError();
|
||||
}
|
||||
|
||||
private void btnAddToDictionary_Click(object sender, EventArgs e)
|
||||
{
|
||||
_Spell.UserDictionary.AddWord(CurrentError.Text);
|
||||
_Errors = _Spell.CheckText(_Editor.Text, CurrentError.Start);
|
||||
ErrorIndex = 0;
|
||||
}
|
||||
|
||||
private void lbSuggestList_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
_AutoSuggest = false;
|
||||
if (!_Initializing && lbSuggestList.Text != _NoSuggestionsText)
|
||||
txbBadWord.Text = lbSuggestList.Text;
|
||||
_AutoSuggest = true;
|
||||
}
|
||||
|
||||
// double-click selects word for suggestion list and changes mis-spelled word
|
||||
private void lbSuggestList_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (txbBadWord.Text == lbSuggestList.Text)
|
||||
{
|
||||
UpdateEditor(txbBadWord.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateEditor("");
|
||||
}
|
||||
}
|
||||
}
|
120
PROMS/Volian.Controls.Library/VlnSpellCheckDlg.resx
Normal file
120
PROMS/Volian.Controls.Library/VlnSpellCheckDlg.resx
Normal 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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
Loading…
x
Reference in New Issue
Block a user