jvcllaz: Make JvSpellChecker platform-independent

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6238 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-03-12 10:04:11 +00:00
parent 6eb42439cf
commit 6ee65d5dbb
9 changed files with 114 additions and 132 deletions

View File

@ -4,9 +4,6 @@
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<Flags>
<UseDefaultCompilerOptions Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="JvSpellCheckerDemo"/>

View File

@ -1,14 +1,16 @@
program JvSpellCheckerDemo;
uses
Forms, Interfaces,
Forms, Interfaces, LCLVersion,
MainFrm in 'MainFrm.pas' {frmMain},
JvSpellCheckerForm in 'JvSpellCheckerForm.pas' {frmSpellChecker};
{$R *.res}
begin
{$IF LCL_FullVersion >= 1080000}
Application.Scaled := True;
{$ENDIF}
Application.Initialize;
Application.CreateForm(TfrmMain, frmMain);
Application.CreateForm(TfrmSpellChecker, frmSpellChecker);

View File

@ -1,104 +1,107 @@
object frmSpellChecker: TfrmSpellChecker
object frmSpellChecker: TfrmSpellChecker
Left = 338
Height = 334
Top = 177
Width = 384
BorderStyle = bsDialog
Caption = 'Spell check document'
ClientHeight = 334
ClientWidth = 384
Color = clBtnFace
DefaultMonitor = dmDesktop
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Shell Dlg 2'
Font.Style = []
FormStyle = fsStayOnTop
OldCreateOrder = False
Position = poMainFormCenter
Scaled = False
OnCreate = FormCreate
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
Position = poMainFormCenter
LCLVersion = '1.9.0.0'
Scaled = False
object Label1: TLabel
Left = 16
Height = 15
Top = 16
Width = 72
Height = 13
Width = 81
Caption = 'Not in wordlist:'
ParentColor = False
end
object Label2: TLabel
Left = 16
Height = 15
Top = 102
Width = 62
Height = 13
Width = 67
Caption = 'Suggestions:'
ParentColor = False
end
object lblNoSuggestions: TLabel
Left = 179
AnchorSideRight.Control = edNewWord
AnchorSideRight.Side = asrBottom
Left = 166
Height = 15
Top = 101
Width = 93
Height = 13
Width = 104
Anchors = [akTop, akRight]
Caption = '(nothing to display)'
ParentColor = False
Visible = False
end
object Label3: TLabel
Left = 16
Height = 15
Top = 56
Width = 65
Height = 13
Width = 70
Caption = 'Replace with:'
ParentColor = False
end
object edNewWord: TEdit
Left = 16
Height = 23
Top = 72
Width = 254
Height = 21
Anchors = [akLeft, akTop, akRight]
Anchors = [akTop, akLeft, akRight]
TabOrder = 1
end
object lbSuggestions: TListBox
Left = 16
Height = 82
Top = 120
Width = 254
Height = 82
Anchors = [akLeft, akTop, akRight, akBottom]
ItemHeight = 13
TabOrder = 2
Anchors = [akTop, akLeft, akRight, akBottom]
ItemHeight = 0
OnClick = lbSuggestionsClick
TabOrder = 2
end
object btnIgnore: TButton
Left = 294
Height = 25
Top = 32
Width = 75
Height = 25
Action = acIgnore
Anchors = [akTop, akRight]
TabOrder = 3
end
object btnIgnoreAll: TButton
Left = 294
Height = 25
Top = 61
Width = 75
Height = 25
Action = acIgnoreAll
Anchors = [akTop, akRight]
TabOrder = 4
end
object btnChange: TButton
Left = 294
Height = 25
Top = 120
Width = 75
Height = 25
Action = acChange
Anchors = [akTop, akRight]
TabOrder = 5
end
object btnClose: TButton
Left = 294
Top = 286
Width = 75
Height = 25
Top = 289
Width = 75
Action = acClose
Anchors = [akRight, akBottom]
Cancel = True
@ -106,68 +109,78 @@
end
object btnAdd: TButton
Left = 294
Height = 25
Top = 149
Width = 75
Height = 25
Action = acAdd
Anchors = [akTop, akRight]
TabOrder = 6
end
object GroupBox1: TGroupBox
Left = 16
Top = 209
Width = 257
Height = 105
Top = 209
Width = 254
Anchors = [akLeft, akRight, akBottom]
Caption = ' Ignore: '
ClientHeight = 85
ClientWidth = 250
TabOrder = 7
object chkUpperCase: TCheckBox
AnchorSideTop.Control = GroupBox1
Left = 24
Top = 23
Width = 207
Height = 17
Height = 19
Top = 4
Width = 118
BorderSpacing.Top = 4
Caption = '&UPPERCASE words'
TabOrder = 0
end
object chkNumber: TCheckBox
AnchorSideTop.Control = chkUpperCase
AnchorSideTop.Side = asrBottom
Left = 24
Top = 39
Width = 207
Height = 17
Height = 19
Top = 23
Width = 130
Caption = 'Words with &numbers'
TabOrder = 1
end
object chkURL: TCheckBox
AnchorSideTop.Control = chkNumber
AnchorSideTop.Side = asrBottom
Left = 24
Top = 55
Width = 207
Height = 17
Height = 19
Top = 42
Width = 135
Caption = 'Internet and file &paths'
TabOrder = 2
end
object chkHTML: TCheckBox
AnchorSideTop.Control = chkURL
AnchorSideTop.Side = asrBottom
Left = 24
Top = 71
Width = 207
Height = 17
Height = 19
Top = 61
Width = 82
Caption = 'HT&ML code'
TabOrder = 3
end
end
object edBadWord: TEdit
Left = 16
Height = 23
Top = 32
Width = 254
Height = 21
Anchors = [akLeft, akTop, akRight]
Anchors = [akTop, akLeft, akRight]
Color = clBtnFace
ReadOnly = True
TabOrder = 0
end
object alSpell: TActionList
OnUpdate = alSpellUpdate
Left = 296
Top = 224
left = 296
top = 224
object acIgnore: TAction
Caption = '&Ignore'
OnExecute = acIgnoreExecute
@ -186,8 +199,8 @@
end
object acClose: TAction
Caption = '&Close'
ShortCut = 27
OnExecute = acCloseExecute
ShortCut = 27
end
end
end

View File

@ -29,10 +29,10 @@ unit JvSpellCheckerForm;
interface
{$mode objfpc}{$H+}
//{$I jvcl.inc}
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
LCLIntf, LMessages,
SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, JvSpellChecker, ActnList;
type
@ -94,6 +94,7 @@ type
ASpellChecker: TJvSpellChecker;
FOnReplaceText: TJvReplaceTextEvent;
FOnSelectText: TJvSelectTextEvent;
procedure AsyncClose(Data: PtrInt);
procedure CloseAndReport(ReportSuccess: boolean);
function GetNextWord: boolean;
procedure DoReplaceText(Sender: TObject; StartIndex, ALength: integer; const NewText: string);
@ -116,6 +117,11 @@ implementation
{$R *.lfm}
procedure TfrmSpellChecker.AsyncClose(Data: PtrInt);
begin
Close;
end;
procedure TfrmSpellChecker.FormCreate(Sender: TObject);
var S:string;
begin
@ -256,7 +262,8 @@ begin
S := 'There is nothing to spell check';
ShowMessage(S);
// delay since we might have been called from the OnShow event (can't close in OnShow)
PostMessage(Handle, WM_CLOSE, 0, 0);
Application.QueueAsyncCall(@AsyncClose, 0);
// PostMessage(Handle, LM_CLOSE, 0, 0);
end;
procedure TfrmSpellChecker.acIgnoreExecute(Sender: TObject);

View File

@ -26,11 +26,13 @@
unit MainFrm;
{$mode objfpc}{$H+}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus, ComCtrls, JvComponent;
SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus, ComCtrls;
type
TfrmMain = class(TForm)
@ -68,7 +70,9 @@ type
var
frmMain: TfrmMain;
implementation
uses
JvSpellCheckerForm;