Стартовый пул
This commit is contained in:
102
ATSynEdit/app/test_offsettocaret/project1.lpi
Normal file
102
ATSynEdit/app/test_offsettocaret/project1.lpi
Normal file
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="project1"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="3">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\..\atsynedit\atstringproc_textbuffer.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="ATStringProc_TextBuffer"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="project1"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="..\..\atsynedit"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<IncludeAssertionCode Value="True"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<Checks>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
21
ATSynEdit/app/test_offsettocaret/project1.lpr
Normal file
21
ATSynEdit/app/test_offsettocaret/project1.lpr
Normal file
@@ -0,0 +1,21 @@
|
||||
program project1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, Unit1, atstringproc_textbuffer
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:= True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
27
ATSynEdit/app/test_offsettocaret/unit1.lfm
Normal file
27
ATSynEdit/app/test_offsettocaret/unit1.lfm
Normal file
@@ -0,0 +1,27 @@
|
||||
object Form1: TForm1
|
||||
Left = 350
|
||||
Height = 259
|
||||
Top = 362
|
||||
Width = 508
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 259
|
||||
ClientWidth = 508
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.5'
|
||||
object Memo1: TMemo
|
||||
Left = 0
|
||||
Height = 259
|
||||
Top = 0
|
||||
Width = 508
|
||||
Align = alClient
|
||||
Font.CharSet = RUSSIAN_CHARSET
|
||||
Font.Height = -12
|
||||
Font.Name = 'Courier New'
|
||||
Font.Pitch = fpFixed
|
||||
Font.Quality = fqDraft
|
||||
ParentFont = False
|
||||
ScrollBars = ssBoth
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
69
ATSynEdit/app/test_offsettocaret/unit1.pas
Normal file
69
ATSynEdit/app/test_offsettocaret/unit1.pas
Normal file
@@ -0,0 +1,69 @@
|
||||
unit Unit1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
atstringproc_textbuffer, Types;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
Memo1: TMemo;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
buf: TATStringBuffer;
|
||||
s: tstringlist;
|
||||
list: tlist;
|
||||
i: integer;
|
||||
pos: integer;
|
||||
pnt0, pnt: tpoint;
|
||||
begin
|
||||
s:= tstringlist.create;
|
||||
for i:= 0 to 20 do
|
||||
s.add(stringofchar('t', random(40)));
|
||||
|
||||
list:= tlist.create;
|
||||
for i:= 0 to s.count-1 do
|
||||
list.add(pointer(length(s[i])));
|
||||
|
||||
buf:= TATStringBuffer.create;
|
||||
buf.Setup(s.text, list, 1);
|
||||
|
||||
for i:= 0 to 1000 do
|
||||
begin
|
||||
pnt0.y:= random(s.count);
|
||||
pnt0.x:= random(length(s[pnt0.y]));
|
||||
pos:= buf.CaretToStr(pnt0);
|
||||
pnt:= buf.StrToCaret(pos);
|
||||
if not PointsEqual(pnt, pnt0) then
|
||||
begin
|
||||
memo1.lines.add('bad test: line:col '+inttostr(pnt0.y)+':'+inttostr(pnt0.x));
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
memo1.lines.add('ok test');
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user