[1715] | 1 | unit fHunSpell;
|
---|
| 2 | (* ***************************** BEGIN LICENSE BLOCK **********************
|
---|
| 3 | *
|
---|
| 4 | * Copyright (C) 2015
|
---|
| 5 | * Sunil Kumar Arora (digitiger@gmail.com sunil@healthsevak.com)
|
---|
| 6 | * All Rights Reserved.
|
---|
| 7 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
| 8 | *
|
---|
| 9 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
| 10 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
| 11 | * the License. You may obtain a copy of the License at
|
---|
| 12 | * http://www.mozilla.org/MPL/
|
---|
| 13 | *
|
---|
| 14 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
| 15 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
| 16 | * for the specific language governing rights and limitations under the
|
---|
| 17 | * License.
|
---|
| 18 | *
|
---|
| 19 | * Alternatively, the content of this file maybe used under the terms of either
|
---|
| 20 | * the GNU General Public License Version 2 or later (the "GPL"), or the GNU
|
---|
| 21 | * Lesser General Public License Version 2.1 or later (the "LGPL"), in which
|
---|
| 22 | * case the provisions of the GPL or the LGPL are applicable instead of those
|
---|
| 23 | * above. If you wish to allow use of your version of this file only under the
|
---|
| 24 | * terms of either the GPL or the LGPL, and not to allow others to use your
|
---|
| 25 | * version of this file under the terms of the MPL, indicate your division by
|
---|
| 26 | * deleting the provisions above and replace them with the notice and other
|
---|
| 27 | * provisions required by the GPL or LGPL. If you do not delete the provisions
|
---|
| 28 | * above, a recipient may use your version of this file under the terms of any
|
---|
| 29 | * one of the MPL, the GPL or the LGPL.
|
---|
| 30 | *
|
---|
| 31 | * *********************** END LICENSE BLOCK *********************************)
|
---|
| 32 |
|
---|
| 33 | interface
|
---|
| 34 |
|
---|
| 35 | uses
|
---|
| 36 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 37 | StdCtrls, ComCtrls, RichEdit, Buttons, ExtCtrls, ShellAPI,
|
---|
[1725] | 38 | skaSpellCheck, jpeg;
|
---|
[1715] | 39 |
|
---|
| 40 | type
|
---|
| 41 | TfrmHunSpell = class(TForm)
|
---|
| 42 | btnClose: TButton;
|
---|
| 43 | OpenDialog1: TOpenDialog;
|
---|
| 44 | SpellCheck1: TskaHunSpellChecker;
|
---|
| 45 | edtDictionary: TEdit;
|
---|
| 46 | btnSelectDict: TBitBtn;
|
---|
| 47 | RichEdit1: TRichEdit;
|
---|
| 48 | pnlMisSpelled: TPanel;
|
---|
| 49 | Label1: TLabel;
|
---|
[1725] | 50 | lstSuggestions: TListBox;
|
---|
[1715] | 51 | Label4: TLabel;
|
---|
[1725] | 52 | edtMisSpelt: TEdit;
|
---|
[1715] | 53 | btnReplaceWith: TButton;
|
---|
| 54 | btnChangeAll: TButton;
|
---|
| 55 | btnChange: TButton;
|
---|
| 56 | btnAddToDictionary: TButton;
|
---|
| 57 | btnIgnoreAll: TButton;
|
---|
| 58 | btnIgnoreOnce: TButton;
|
---|
| 59 | btnAbort: TButton;
|
---|
[1725] | 60 | btnAbout: TButton;
|
---|
| 61 | pnlAbout: TPanel;
|
---|
| 62 | btnHideAbout: TButton;
|
---|
[1715] | 63 | btnUndo: TButton;
|
---|
[1718] | 64 | cbIgnoreAllCaps: TCheckBox;
|
---|
| 65 | cbIgnoreDigit: TCheckBox;
|
---|
[1725] | 66 | btnRestat: TButton;
|
---|
| 67 | cbHyphenatedWord: TCheckBox;
|
---|
| 68 | StaticText1: TStaticText;
|
---|
| 69 | StaticText2: TStaticText;
|
---|
| 70 | StaticText3: TStaticText;
|
---|
| 71 | Label2: TLabel;
|
---|
| 72 | StaticText4: TStaticText;
|
---|
| 73 | Label3: TLabel;
|
---|
| 74 | StaticText5: TStaticText;
|
---|
| 75 | StaticText6: TStaticText;
|
---|
| 76 | Image1: TImage;
|
---|
| 77 | lblDictionariesURL: TLabel;
|
---|
| 78 | lblDictionary: TLabel;
|
---|
| 79 | lblOpenMedURL: TLabel;
|
---|
| 80 | Label5: TLabel;
|
---|
| 81 | Label6: TLabel;
|
---|
[1715] | 82 | procedure FormCreate(Sender: TObject);
|
---|
| 83 | procedure btnIgnoreOnceClick(Sender: TObject);
|
---|
| 84 | procedure btnIgnoreAllClick(Sender: TObject);
|
---|
| 85 | procedure btnChangeClick(Sender: TObject);
|
---|
| 86 | procedure btnChangeAllClick(Sender: TObject);
|
---|
| 87 | procedure btnCloseClick(Sender: TObject);
|
---|
| 88 | procedure FormActivate(Sender: TObject);
|
---|
| 89 | procedure btnSelectDictClick(Sender: TObject);
|
---|
| 90 | procedure edtDictionaryEnter(Sender: TObject);
|
---|
| 91 | procedure btnReplaceWithClick(Sender: TObject);
|
---|
| 92 | procedure btnAddToDictionaryClick(Sender: TObject);
|
---|
[1725] | 93 | procedure FormShow(Sender: TObject);
|
---|
[1715] | 94 | procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 95 | procedure btnAbortClick(Sender: TObject);
|
---|
[1725] | 96 | procedure lblOpenMedURLClick(Sender: TObject);
|
---|
| 97 | procedure btnAboutClick(Sender: TObject);
|
---|
| 98 | procedure btnHideAboutClick(Sender: TObject);
|
---|
[1715] | 99 | procedure btnUndoClick(Sender: TObject);
|
---|
| 100 | procedure RichEdit1KeyUp(Sender: TObject; var Key: Word;
|
---|
| 101 | Shift: TShiftState);
|
---|
| 102 | procedure RichEdit1KeyDown(Sender: TObject; var Key: Word;
|
---|
| 103 | Shift: TShiftState);
|
---|
[1725] | 104 | procedure lstSuggestionsDblClick(Sender: TObject);
|
---|
| 105 | procedure SpellCheck1StateChange(const Sender: TObject;
|
---|
| 106 | const State: TSpellState);
|
---|
[1715] | 107 | procedure SpellCheck1Abort(Sender: TObject);
|
---|
| 108 | procedure SpellCheck1Start(Sender: TObject);
|
---|
[1718] | 109 | procedure cbIgnoreAllCapsClick(Sender: TObject);
|
---|
| 110 | procedure cbIgnoreDigitClick(Sender: TObject);
|
---|
| 111 | procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
---|
[1725] | 112 | procedure btnRestatClick(Sender: TObject);
|
---|
| 113 | procedure cbHyphenatedWordClick(Sender: TObject);
|
---|
| 114 | procedure Image1Click(Sender: TObject);
|
---|
| 115 | procedure Label6Click(Sender: TObject);
|
---|
| 116 | procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
---|
[1715] | 117 | private
|
---|
| 118 | { Private declarations }
|
---|
| 119 | NoEngineOpted: Boolean;
|
---|
| 120 | FSourceControl: TCustomMemo;
|
---|
| 121 | procedure GoToURL(const aURL: String);
|
---|
[1725] | 122 | procedure UpdateGUI;
|
---|
[1715] | 123 | public
|
---|
| 124 | { Public declarations }
|
---|
| 125 | Showhighlight:boolean;
|
---|
| 126 | highlightcolor:TColor;
|
---|
| 127 | HighLightList:TStringlist;
|
---|
| 128 | OldRichEditWndProc: {integer}pointer;
|
---|
| 129 | PRichEditWndProc:pointer;
|
---|
[1725] | 130 | class function DoHunSpellCheck(AnEditControl: TCustomMemo): TModalResult; static;
|
---|
[1715] | 131 | end;
|
---|
| 132 |
|
---|
| 133 | Resourcestring
|
---|
| 134 | TX_AFF_NOT_FOUND = 'Correspong AFF file named not found!'
|
---|
| 135 | + #13
|
---|
| 136 | + ' Specify dictionary file whose *.aff is also '
|
---|
| 137 | + 'present in same directory.' ;
|
---|
| 138 | TX_DIC_FILE_NOT_FOUND = 'Dictionary File for SpellCheck Engine not found!';
|
---|
| 139 | TX_SPELL_COMPLETE = 'Spell Check Complete';
|
---|
| 140 | TX_SPELL_CANCELLED = 'Spell Check Aborted'
|
---|
| 141 | + #13
|
---|
| 142 | + 'No Changes applied to the original text!';
|
---|
| 143 |
|
---|
| 144 | Const
|
---|
[1725] | 145 | DefaultDicFile = '\dict\en_US-large.dic';
|
---|
| 146 |
|
---|
[1715] | 147 | var
|
---|
| 148 | frmHunSpell: TfrmHunSpell;
|
---|
| 149 |
|
---|
| 150 | implementation
|
---|
| 151 | {$R *.DFM}
|
---|
| 152 |
|
---|
| 153 |
|
---|
[1725] | 154 | class function TfrmHunSpell.DoHunSpellCheck(AnEditControl: TCustomMemo): TModalResult;
|
---|
[1715] | 155 | var
|
---|
| 156 | frm: TfrmHunSpell;
|
---|
| 157 | begin
|
---|
| 158 | Result := mrCancel;
|
---|
| 159 | frm:= TfrmHunSpell.create(Application);
|
---|
| 160 | try
|
---|
| 161 | frm.RichEdit1.Text:= AnEditControl.Text;
|
---|
| 162 | frm.FSourceControl := AnEditControl;
|
---|
| 163 | Result := frm.ShowModal;
|
---|
| 164 | finally
|
---|
| 165 | frm.Free;
|
---|
| 166 | end;
|
---|
| 167 | end;
|
---|
| 168 |
|
---|
| 169 | {************ HighLight ***********888}
|
---|
[1725] | 170 | procedure TfrmHunSpell.FormShow(Sender: TObject);
|
---|
[1715] | 171 | begin
|
---|
[1725] | 172 | if SpellCheck1.SpellCheckState = ssReady then
|
---|
| 173 | SpellCheck1.CheckSpelling;
|
---|
| 174 | try
|
---|
| 175 | if lstSuggestions.Count > 0 then
|
---|
| 176 | btnChange.SetFocus;
|
---|
| 177 | except
|
---|
| 178 | end;
|
---|
| 179 | end;
|
---|
| 180 |
|
---|
| 181 | procedure TfrmHunSpell.GoToURL(const aURL: String);
|
---|
| 182 | begin
|
---|
[1715] | 183 | if length(trim(aURL)) > 4 then
|
---|
| 184 | ShellExecute(Handle, 'open', PChar(aURL), '', '', SW_NORMAL);
|
---|
| 185 | end;
|
---|
| 186 |
|
---|
[1725] | 187 | procedure TfrmHunSpell.Image1Click(Sender: TObject);
|
---|
[1715] | 188 | begin
|
---|
[1725] | 189 | inherited;
|
---|
| 190 | GoToURL('http://www.healthsevak.com');
|
---|
| 191 | end;
|
---|
| 192 |
|
---|
| 193 | procedure TfrmHunSpell.Label6Click(Sender: TObject);
|
---|
| 194 | begin
|
---|
| 195 | inherited;
|
---|
| 196 | GoToURL('mailto: digitiger@gmail.com');
|
---|
| 197 | end;
|
---|
| 198 |
|
---|
| 199 | procedure TfrmHunSpell.lblOpenMedURLClick(Sender: TObject);
|
---|
| 200 | begin
|
---|
| 201 | inherited;
|
---|
[1715] | 202 | GoToURL(TLabel(sender).Caption);
|
---|
| 203 | end;
|
---|
| 204 |
|
---|
| 205 | procedure TfrmHunSpell.lstSuggestionsDblClick(Sender: TObject);
|
---|
| 206 | begin
|
---|
[1725] | 207 | inherited;
|
---|
| 208 | btnChangeClick(sender);
|
---|
[1715] | 209 | end;
|
---|
| 210 |
|
---|
| 211 | procedure TfrmHunSpell.RichEdit1KeyDown(Sender: TObject; var Key: Word;
|
---|
| 212 | Shift: TShiftState);
|
---|
| 213 | begin
|
---|
[1725] | 214 | inherited;
|
---|
[1715] | 215 | if SpellCheck1.SpellCheckState = ssChecking then
|
---|
| 216 | SpellCheck1.ManualChangeStart;
|
---|
| 217 | end;
|
---|
| 218 |
|
---|
| 219 | procedure TfrmHunSpell.RichEdit1KeyUp(Sender: TObject; var Key: Word;
|
---|
| 220 | Shift: TShiftState);
|
---|
| 221 | begin
|
---|
[1725] | 222 | inherited;
|
---|
| 223 | if SpellCheck1.SpellCheckState in [ssCancelled, ssCompleted] then
|
---|
[1715] | 224 | SpellCheck1.Reopen;
|
---|
[1725] | 225 |
|
---|
[1715] | 226 | if SpellCheck1.SpellCheckState = ssChecking then
|
---|
| 227 | SpellCheck1.ManualChangeDone;
|
---|
| 228 | end;
|
---|
| 229 |
|
---|
| 230 | procedure TfrmHunSpell.SpellCheck1Abort(Sender: TObject);
|
---|
| 231 | begin
|
---|
[1725] | 232 | inherited;
|
---|
[1715] | 233 | UpdateGUI;
|
---|
| 234 | end;
|
---|
| 235 |
|
---|
| 236 | procedure TfrmHunSpell.SpellCheck1Start(Sender: TObject);
|
---|
| 237 | begin
|
---|
[1725] | 238 | inherited;
|
---|
[1715] | 239 | UpdateGUI;
|
---|
| 240 | end;
|
---|
| 241 |
|
---|
| 242 | procedure TfrmHunSpell.SpellCheck1StateChange(const Sender: TObject;
|
---|
| 243 | const State: TSpellState);
|
---|
| 244 | begin
|
---|
[1725] | 245 | inherited;
|
---|
[1715] | 246 | if State = ssCompleted then
|
---|
| 247 | ShowMessage(TX_SPELL_COMPLETE);
|
---|
| 248 | UpdateGUI;
|
---|
| 249 | end;
|
---|
| 250 |
|
---|
| 251 | procedure TfrmHunSpell.UpdateGUI;
|
---|
| 252 | var
|
---|
| 253 | Checking: Boolean;
|
---|
| 254 | begin
|
---|
[1725] | 255 | if csDestroying in componentstate then
|
---|
| 256 | exit;
|
---|
[1715] | 257 | Checking := SpellCheck1.SpellCheckState = ssChecking;
|
---|
| 258 | pnlMisSpelled.Visible := Checking;
|
---|
| 259 | pnlMisSpelled.Enabled := Checking;
|
---|
| 260 | btnClose.Visible := not Checking;
|
---|
| 261 | end;
|
---|
| 262 |
|
---|
| 263 | {************* FormCreate **********}
|
---|
[1725] | 264 | procedure TfrmHunSpell.btnAboutClick(Sender: TObject);
|
---|
[1715] | 265 | begin
|
---|
[1725] | 266 | inherited;
|
---|
| 267 | pnlAbout.Show;
|
---|
| 268 | pnlAbout.BringToFront;
|
---|
[1715] | 269 | end;
|
---|
| 270 |
|
---|
| 271 | procedure TfrmHunSpell.btnAddToDictionaryClick(Sender: TObject);
|
---|
| 272 | begin
|
---|
| 273 | SpellCheck1.AddCustomWord;
|
---|
| 274 | end;
|
---|
| 275 |
|
---|
| 276 | procedure TfrmHunSpell.btnReplaceWithClick(Sender: TObject);
|
---|
| 277 | begin
|
---|
| 278 | SpellCheck1.CorrectWithMyWord;
|
---|
| 279 | end;
|
---|
| 280 |
|
---|
[1725] | 281 | procedure TfrmHunSpell.btnRestatClick(Sender: TObject);
|
---|
| 282 | begin
|
---|
| 283 | inherited;
|
---|
| 284 | SpellCheck1.ReStart
|
---|
| 285 | end;
|
---|
| 286 |
|
---|
[1715] | 287 | procedure TfrmHunSpell.btnAbortClick(Sender: TObject);
|
---|
| 288 | begin
|
---|
[1725] | 289 | if SpellCheck1.AbortSpellCheck(True) then
|
---|
[1715] | 290 | end;
|
---|
| 291 |
|
---|
| 292 | procedure TfrmHunSpell.btnChangeAllClick(Sender: TObject);
|
---|
| 293 | begin
|
---|
| 294 | SpellCheck1.ChangeAll;
|
---|
| 295 | end;
|
---|
| 296 |
|
---|
| 297 | procedure TfrmHunSpell.btnChangeClick(Sender: TObject);
|
---|
| 298 | begin
|
---|
| 299 | SpellCheck1.Change;
|
---|
| 300 | end;
|
---|
| 301 |
|
---|
| 302 | procedure TfrmHunSpell.btnCloseClick(Sender: TObject);
|
---|
| 303 | begin
|
---|
[1725] | 304 | close;
|
---|
[1715] | 305 | end;
|
---|
| 306 |
|
---|
| 307 | procedure TfrmHunSpell.btnIgnoreAllClick(Sender: TObject);
|
---|
| 308 | begin
|
---|
| 309 | SpellCheck1.IgnoreAll;
|
---|
| 310 | end;
|
---|
| 311 |
|
---|
| 312 | procedure TfrmHunSpell.btnIgnoreOnceClick(Sender: TObject);
|
---|
| 313 | begin
|
---|
| 314 | SpellCheck1.IgnoreOnce;
|
---|
| 315 | end;
|
---|
| 316 |
|
---|
| 317 | procedure TfrmHunSpell.btnSelectDictClick(Sender: TObject);
|
---|
| 318 | var
|
---|
| 319 | aff: String;
|
---|
| 320 | begin
|
---|
| 321 | if OpenDialog1.Execute then
|
---|
| 322 | begin
|
---|
| 323 | if SpellCheck1.DictionaryFileName = OpenDialog1.FileName then
|
---|
| 324 | exit;
|
---|
| 325 |
|
---|
| 326 | aff := ChangeFileExt(OpenDialog1.FileName, '.aff');
|
---|
| 327 | if not FileExists(aff) then
|
---|
| 328 | begin
|
---|
| 329 | ShowMessage(TX_AFF_NOT_FOUND);
|
---|
| 330 | OpenDialog1.FileName := '';
|
---|
| 331 | btnSelectDictClick(self);
|
---|
| 332 | end
|
---|
| 333 | else
|
---|
| 334 | begin
|
---|
| 335 | if SpellCheck1.SpellCheckState = ssChecking then
|
---|
| 336 | SpellCheck1.AbortSpellCheck(False);
|
---|
| 337 | edtDictionary.Text := OpenDialog1.FileName;
|
---|
| 338 | SpellCheck1.DictionaryFileName := edtDictionary.Text;
|
---|
| 339 | SpellCheck1.AffixFileName := aff;
|
---|
| 340 | SpellCheck1.Open;
|
---|
| 341 | end;
|
---|
| 342 | end;
|
---|
| 343 | end;
|
---|
| 344 |
|
---|
| 345 | procedure TfrmHunSpell.btnUndoClick(Sender: TObject);
|
---|
| 346 | begin
|
---|
| 347 | inherited;
|
---|
| 348 | SpellCheck1.Undo;
|
---|
| 349 | end;
|
---|
| 350 |
|
---|
[1725] | 351 | procedure TfrmHunSpell.btnHideAboutClick(Sender: TObject);
|
---|
| 352 | begin
|
---|
| 353 | inherited;
|
---|
| 354 | pnlAbout.hide;
|
---|
| 355 | end;
|
---|
| 356 |
|
---|
| 357 | procedure TfrmHunSpell.cbHyphenatedWordClick(Sender: TObject);
|
---|
| 358 | begin
|
---|
| 359 | inherited;
|
---|
| 360 | if SpellCheck1.HyphenatedWords <> cbHyphenatedWord.Checked then
|
---|
| 361 | SpellCheck1.HyphenatedWords := cbHyphenatedWord.Checked;
|
---|
| 362 |
|
---|
| 363 | if SpellCheck1.SpellCheckState = ssChecking then
|
---|
| 364 | SpellCheck1.ReStart;
|
---|
| 365 | end;
|
---|
| 366 |
|
---|
[1718] | 367 | procedure TfrmHunSpell.cbIgnoreAllCapsClick(Sender: TObject);
|
---|
| 368 | begin
|
---|
[1725] | 369 | inherited;
|
---|
[1718] | 370 | if SpellCheck1.IgnoreAllCaps <> cbIgnoreAllCaps.Checked then
|
---|
| 371 | SpellCheck1.IgnoreAllCaps := cbIgnoreAllCaps.Checked;
|
---|
[1725] | 372 |
|
---|
| 373 | if SpellCheck1.SpellCheckState = ssChecking then
|
---|
| 374 | SpellCheck1.ReStart;
|
---|
[1718] | 375 | end;
|
---|
| 376 |
|
---|
| 377 | procedure TfrmHunSpell.cbIgnoreDigitClick(Sender: TObject);
|
---|
| 378 | begin
|
---|
[1725] | 379 | inherited;
|
---|
[1718] | 380 | if SpellCheck1.IgnoreWordWithDigits <> cbIgnoreDigit.Checked then
|
---|
| 381 | SpellCheck1.IgnoreWordWithDigits := cbIgnoreDigit.Checked;
|
---|
[1725] | 382 |
|
---|
| 383 | if SpellCheck1.SpellCheckState = ssChecking then
|
---|
| 384 | SpellCheck1.ReStart;
|
---|
[1718] | 385 | end;
|
---|
| 386 |
|
---|
[1715] | 387 | procedure TfrmHunSpell.edtDictionaryEnter(Sender: TObject);
|
---|
| 388 | begin
|
---|
| 389 | btnSelectDict.SetFocus;
|
---|
| 390 | end;
|
---|
| 391 |
|
---|
| 392 | procedure TfrmHunSpell.FormActivate(Sender: TObject);
|
---|
| 393 | begin
|
---|
[1725] | 394 | if ( not btnRestat.Enabled) and (not NoEngineOpted) then
|
---|
[1715] | 395 | begin
|
---|
| 396 | btnSelectDictClick(self);
|
---|
| 397 | NoEngineOpted := True;
|
---|
| 398 | end;
|
---|
[1718] | 399 | if cbIgnoreAllCaps.Checked <> SpellCheck1.IgnoreAllCaps then
|
---|
| 400 | cbIgnoreAllCaps.Checked := SpellCheck1.IgnoreAllCaps;
|
---|
| 401 |
|
---|
| 402 | if cbIgnoreDigit.Checked <> SpellCheck1.IgnoreWordWithDigits then
|
---|
| 403 | cbIgnoreDigit.Checked := SpellCheck1.IgnoreWordWithDigits;
|
---|
[1725] | 404 |
|
---|
| 405 | if cbHyphenatedWord.Checked <> SpellCheck1.HyphenatedWords then
|
---|
| 406 | cbHyphenatedWord.Checked := SpellCheck1.HyphenatedWords;
|
---|
[1715] | 407 | end;
|
---|
| 408 |
|
---|
| 409 | procedure TfrmHunSpell.FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 410 | begin
|
---|
[1725] | 411 | if SpellCheck1.SpellCheckState = ssCompleted then
|
---|
[1715] | 412 | begin
|
---|
[1725] | 413 | // ShowMsg(TX_SPELL_COMPLETE, TShow508MessageIcon(1), smbOK) ;
|
---|
[1715] | 414 | if Assigned(FSourceControl) then
|
---|
| 415 | FSourceControl.Text := RichEdit1.Text;
|
---|
[1725] | 416 | end;
|
---|
| 417 | {else
|
---|
| 418 | ShowMsg(TX_SPELL_CANCELLED + CRLF + TX_NO_CORRECTIONS,
|
---|
| 419 | TShow508MessageIcon(1), smbOK) ;}
|
---|
[1715] | 420 | end;
|
---|
| 421 |
|
---|
[1718] | 422 | procedure TfrmHunSpell.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
---|
| 423 | begin
|
---|
[1725] | 424 | inherited;
|
---|
| 425 |
|
---|
[1718] | 426 | CanClose := (SpellCheck1.SpellCheckState <> ssChecking)
|
---|
| 427 | or (SpellCheck1.AbortSpellCheck(True));
|
---|
| 428 | if CanClose then
|
---|
| 429 | ModalResult := mrCancel;
|
---|
| 430 | end;
|
---|
| 431 |
|
---|
[1715] | 432 | procedure TfrmHunSpell.FormCreate(Sender: TObject);
|
---|
| 433 | var
|
---|
| 434 | dicFile: String;
|
---|
| 435 | function affFile: String;
|
---|
| 436 | begin
|
---|
| 437 | Result := ChangeFileExt(dicFile, '.aff');
|
---|
| 438 | end;
|
---|
| 439 | begin
|
---|
[1725] | 440 | dicFile := ExtractFilePath(Application.ExeName)+ DefaultDicFile;
|
---|
[1715] | 441 |
|
---|
| 442 | if (FileExists(dicFile)) and (FileExists(affFile)) then
|
---|
| 443 | begin
|
---|
| 444 | SpellCheck1.AffixFileName := affFile;
|
---|
[1725] | 445 | SpellCheck1.DictionaryFileName := dicFile;
|
---|
| 446 | edtDictionary.Text := dicFile;
|
---|
[1715] | 447 | end
|
---|
| 448 | else
|
---|
| 449 | edtDictionary.Text := TX_Dic_File_Not_Found;
|
---|
| 450 |
|
---|
| 451 | if edtDictionary.Text = TX_Dic_File_Not_Found then
|
---|
| 452 | btnSelectDictClick(self);
|
---|
[1725] | 453 |
|
---|
| 454 | SpellCheck1.SourceTextControl := RichEdit1;
|
---|
| 455 | SpellCheck1.SuggestionList := lstSuggestions;
|
---|
| 456 | SpellCheck1.MisSpeltWord := edtMisSpelt;
|
---|
| 457 | btnRestat.Enabled := (SpellCheck1.DictionaryFileName <> '')
|
---|
[1715] | 458 | and FileExists(dicFile);
|
---|
| 459 | end;
|
---|
| 460 |
|
---|
| 461 |
|
---|
| 462 |
|
---|
[1725] | 463 | procedure TfrmHunSpell.FormKeyUp(Sender: TObject; var Key: Word;
|
---|
| 464 | Shift: TShiftState);
|
---|
| 465 | begin
|
---|
| 466 | if (key = 27) and (pnlAbout.Showing) then
|
---|
| 467 | btnHideAboutClick(self);
|
---|
| 468 | end;
|
---|
| 469 |
|
---|
[1715] | 470 | end.
|
---|