Стартовый пул

This commit is contained in:
2024-04-02 08:46:59 +03:00
parent fd57fffd3a
commit 3bb34d000b
5591 changed files with 3291734 additions and 0 deletions

View File

@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="demo"/>
<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="2">
<Item1>
<PackageName Value="econtrol_package"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="11">
<Unit0>
<Filename Value="demo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fmMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
<Unit2>
<Filename Value="..\..\atsynedit\atsynedit_adapter_econtrol.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_Adapter_EControl"/>
</Unit2>
<Unit3>
<Filename Value="..\..\atsynedit\atsynedit.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit"/>
</Unit3>
<Unit4>
<Filename Value="..\..\atsynedit\atsynedit_canvasproc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_CanvasProc"/>
</Unit4>
<Unit5>
<Filename Value="..\..\atsynedit\atsynedit_adapters.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_Adapters"/>
</Unit5>
<Unit6>
<Filename Value="..\..\atsynedit\atstringproc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATStringProc"/>
</Unit6>
<Unit7>
<Filename Value="..\..\atsynedit\atstringproc_textbuffer.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATStringProc_TextBuffer"/>
</Unit7>
<Unit8>
<Filename Value="..\..\atsynedit\atsynedit_fold.inc"/>
<IsPartOfProject Value="True"/>
</Unit8>
<Unit9>
<Filename Value="..\..\atsynedit\atsynedit_ranges.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_Ranges"/>
</Unit9>
<Unit10>
<Filename Value="..\..\atsynedit\atsynedit_hilite.inc"/>
<IsPartOfProject Value="True"/>
</Unit10>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="demo"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir);..\..\atsynedit"/>
<OtherUnitFiles Value="..\..\atsynedit;..\..\proc_lexer"/>
<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>

View File

@@ -0,0 +1,22 @@
program demo;
{$mode objfpc}{$H+}
uses
//heaptrc,
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1, ATSynEdit, atsynedit_adapters, ATSynEdit_CanvasProc,
ATStringProc_TextBuffer, ATSynEdit_Ranges, ecLists, ecStrUtils;
{$R *.res}
begin
RequireDerivedFormResource:= True;
Application.Initialize;
Application.CreateForm(TfmMain, fmMain);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,452 @@
object fmMain: TfmMain
Left = 391
Height = 578
Top = 237
Width = 889
Caption = 'Demo'
ClientHeight = 578
ClientWidth = 889
OnCreate = FormCreate
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.5'
object Panel1: TPanel
Left = 0
Height = 218
Top = 360
Width = 889
Align = alBottom
BevelOuter = bvNone
ClientHeight = 218
ClientWidth = 889
TabOrder = 0
object chkWrap: TCheckBox
Left = 9
Height = 24
Top = 8
Width = 98
Caption = 'word wrap'
OnChange = chkWrapChange
TabOrder = 0
end
object edLexer: TComboBox
Left = 9
Height = 31
Top = 120
Width = 176
DropDownCount = 24
ItemHeight = 0
OnChange = edLexerChange
Style = csDropDownList
TabOrder = 5
end
object files: TShellListView
Left = 352
Height = 208
Top = 3
Width = 528
Anchors = [akTop, akLeft, akBottom]
Color = clDefault
HideSelection = False
ReadOnly = True
ShowColumnHeaders = False
SortType = stText
TabOrder = 12
ToolTips = False
ViewStyle = vsSmallIcon
OnClick = filesClick
ObjectTypes = [otNonFolders]
end
object chkFullSel: TCheckBox
Left = 9
Height = 24
Top = 48
Width = 129
Caption = 'show full sel-bg'
OnChange = chkFullSelChange
TabOrder = 2
end
object chkFullHilite: TCheckBox
Left = 9
Height = 24
Top = 68
Width = 154
Caption = 'show full syntax-bg'
OnChange = chkFullHiliteChange
TabOrder = 3
end
object bOpen: TButton
Left = 192
Height = 25
Top = 8
Width = 152
Caption = 'open...'
OnClick = bOpenClick
TabOrder = 8
end
object chkUnpri: TCheckBox
Left = 9
Height = 24
Top = 28
Width = 130
Caption = 'show unprinted'
OnChange = chkUnpriChange
TabOrder = 1
end
object chkShowCur: TCheckBox
Left = 9
Height = 24
Top = 88
Width = 132
Caption = 'show cur line bg'
OnChange = chkShowCurChange
TabOrder = 4
end
object chkLexer: TCheckBox
Left = 9
Height = 24
Top = 152
Width = 108
Caption = 'enable lexer'
Checked = True
OnChange = chkLexerChange
State = cbChecked
TabOrder = 6
end
object chkDyn: TCheckBox
Left = 9
Height = 24
Top = 176
Width = 119
Caption = 'dynamic hilite'
OnChange = chkDynChange
TabOrder = 7
end
object bComment: TButton
Left = 192
Height = 25
Top = 40
Width = 152
Caption = 'comment sel'
OnClick = bCommentClick
TabOrder = 9
end
object bUncomment: TButton
Left = 192
Height = 25
Top = 72
Width = 152
Caption = 'uncomment sel'
OnClick = bUncommentClick
TabOrder = 10
end
object bExport: TButton
Left = 192
Height = 25
Top = 104
Width = 152
Caption = 'export html'
OnClick = bExportClick
TabOrder = 11
end
end
object Tree: TTreeView
Left = 0
Height = 360
Top = 0
Width = 240
Align = alLeft
HideSelection = False
Images = ImageListTree
ReadOnly = True
RightClickSelect = True
RowSelect = True
TabOrder = 1
OnClick = TreeClick
Options = [tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoRowSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
end
object PanelText: TPanel
Left = 245
Height = 360
Top = 0
Width = 644
Align = alClient
BevelOuter = bvNone
Caption = 'PanelText'
TabOrder = 2
end
object Splitter1: TSplitter
Left = 240
Height = 360
Top = 0
Width = 5
end
object OpenDialog1: TOpenDialog
left = 264
top = 176
end
object ImageListTree: TImageList
AllocBy = 10
left = 368
top = 176
Bitmap = {
4C69080000001000000010000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000848484FF848484FF8484
84FF848484FF848484FF00000000000000000000000000000000000000000000
000000000000000000000000000000000000848484FFC6C6C6FF00FFFFFFC6C6
C6FF00FFFFFFC6C6C6FF848484FF000000000000000000000000000000000000
0000000000000000000000000000848484FFC6C6C6FF00FFFFFFC6C6C6FF00FF
FFFFC6C6C6FF00FFFFFFC6C6C6FF848484FF848484FF848484FF848484FF8484
84FF848484FF0000000000000000848484FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFF848484FF000000FF00000000848484FFFFFFFFFF00FFFFFFC6C6C6FF00FF
FFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FF
FFFF848484FF000000FF00000000848484FFFFFFFFFFC6C6C6FF00FFFFFFC6C6
C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6
C6FF848484FF000000FF00000000848484FFFFFFFFFF00FFFFFFC6C6C6FF00FF
FFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FF
FFFF848484FF000000FF00000000848484FFFFFFFFFFC6C6C6FF00FFFFFFC6C6
C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6
C6FF848484FF000000FF00000000848484FFFFFFFFFF00FFFFFFC6C6C6FF00FF
FFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FF
FFFF848484FF000000FF00000000848484FFFFFFFFFFC6C6C6FF00FFFFFFC6C6
C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6
C6FF848484FF000000FF00000000848484FFFFFFFFFF00FFFFFFC6C6C6FF00FF
FFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FFFFFFC6C6C6FF00FF
FFFF848484FF000000FF00000000848484FF848484FF848484FF848484FF8484
84FF848484FF848484FF848484FF848484FF848484FF848484FF848484FF8484
84FF848484FF000000FF0000000000000000000000FF000000FF000000FF0000
00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000
00FF000000FF000000FF00000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000FFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FF0000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000848400FF848400FFFF0000FFFF0000FF840000FF0000
0000000000000000000000000000000000000000000000000000000000000000
000000000000FFFF00FFFFFFFFFFFF0000FFFF0000FFFF0000FF000000FF8484
84FF000000000000000000000000000000000000000000000000000000000000
00000000000000000000848400FF848400FFFF0000FFFF0000FF000000FF8484
84FF000000000000000000000000000000000000000000000000000000000000
000000000000FFFF00FFFFFFFFFFFF0000FFFF0000FFFF0000FF000000FF8484
84FF0000000000000000000000000000FFFF000084FF00000000000000000000
0000848484FFFFFFFFFFFF0000FF848400FFFF0000FFFF0000FF000000FF8484
84FF0000000000000000000000000000FFFF0000FFFF000084FF000084FF0000
000000000000848484FF848484FF848484FF848484FF848484FF848484FF8484
84FF0000000000000000000000000000FFFF0000FFFF000084FF000084FF0000
84FF000084FFFFFFFFFFFFFFFFFFFFFFFFFF008484FF008484FF008484FF0000
00000000000000000000000000000000FFFF0000FFFF0000FFFF000084FF0000
84FF000084FF000000FFFFFFFFFF848484FF00FFFFFF00FFFFFF008484FF0084
84FF0000000000000000000000000000FFFF0000FFFF0000FFFF0000FFFF0000
00FF000000FF848484FF008484FF00FFFFFF00FFFFFF008484FF008484FF0084
84FF008484FF00000000000000000000FFFF0000FFFF0000FFFF000000FF8484
84FF848484FF848484FF008484FF00FFFFFF008484FF008484FF008484FF0084
84FF008484FF00000000000000000000FFFF000000FF000000FF848484FF8484
84FF848484FF848484FF008484FF008484FF008484FF008484FF008484FF0084
84FF000000FF848484FF000000000000000000000000848484FF848484FF8484
84FF000000000000000000000000008484FF008484FF008484FF008484FF0084
84FF000000FF848484FF00000000000000000000000000000000848484FF0000
0000000000000000000000000000848484FF008484FF008484FF008484FF0000
00FF848484FF848484FF00000000000000000000000000000000000000000000
000000000000000000000000000000000000000000FF000000FF000000FF8484
84FF848484FF0000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000848484FF848484FF8484
84FF000000000000000000000000000000000000000000000000000000000000
000000000000FFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FF0000
0000000000000000000000000000000000000000000000000000000000000000
000000000000848484FF848484FF848484FF848484FF848484FF840000FF0000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFF00FF848484FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FF8484
84FF000000000000000000000000000000000000000000000000000000000000
000000000000848484FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FF8484
84FF000000000000000000000000000000000000000000000000000000000000
0000FFFF00FF848484FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FF8484
84FF0000000000000000000000000000FFFF000084FF00000000000000000000
0000848484FF848484FFFF0000FF848400FFFF0000FFFF0000FF000000FF8484
84FF0000000000000000000000000000FFFF848484FF000084FF000084FF0000
000000000000848484FF848484FF848484FF848484FF848484FF848484FF8484
84FF0000000000000000000000000000FFFF848484FF848484FF848484FF0000
84FF000084FFFFFFFFFFFFFFFFFFFFFFFFFF008484FF008484FF008484FF0000
00000000000000000000000000000000FFFF848484FFFFFFFFFFFFFFFFFF8484
84FF848484FF000000FFFFFFFFFFFFFFFFFF00FFFFFF848484FF848484FF0084
84FF0000000000000000000000000000FFFF848484FFFFFFFFFF0000FFFF0000
00FF000000FF848484FF008484FF00FFFFFF848484FF848484FFFFFFFFFFFFFF
FFFF008484FF00000000000000000000FFFF848484FF0000FFFF000000FF8484
84FF848484FF848484FF008484FF848484FF848484FFFFFFFFFFFFFFFFFFFFFF
FFFF008484FF848484FF000000000000FFFF000000FF000000FF848484FF8484
84FF848484FF848484FF008484FF848484FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFF000000FF848484FF000000000000000000000000848484FF848484FF8484
84FF000000000000000000000000008484FF848484FFFFFFFFFFFFFFFFFF0084
84FF000000FF848484FF00000000000000000000000000000000848484FF0000
0000000000000000000000000000848484FF008484FF848484FF008484FF0000
00FF848484FF0000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000FF000000FF000000FF8484
84FF848484FF0000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000848484FF848484FF8484
84FF000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000848484FF0000
000000000000848484FF0000000000000000848484FF00000000000000008484
84FF000000000000000000000000000000000000000000000000848484FF0000
000000000000848484FF848400FF848400FFFF0000FF840000FF000000008484
84FF00000000000000000000000000000000848484FF848484FF000000FF8484
84FF848484FF000000FF848484FFFF0000FFFF0000FF000000FF848484FF0000
00FF848484FF848484FF00000000000000000000000000000000848484FFFFFF
FFFFFFFFFFFF848484FF848400FF848400FFFF0000FF000000FF848484FF8484
84FF00000000000000000000000000000000000000000000FFFF000084FFFFFF
FFFFFFFFFFFF848484FFFF0000FF848400FFFF0000FF000000FF848484FF8484
84FF00000000000000000000000000000000848484FF0000FFFF0000FFFF0000
84FF848484FF000000FF848484FF848484FF848484FF848484FF848484FF0000
00FF848484FF848484FF0000000000000000000000000000FFFF0000FFFF0000
84FF000084FF000084FFFFFFFFFFFFFFFFFF008484FF008484FFFFFFFFFF8484
84FF00000000000000000000000000000000000000000000FFFF0000FFFF0000
FFFF000000FF000000FF008484FF00FFFFFF00FFFFFF008484FF008484FF0084
84FF00000000000000000000000000000000848484FF0000FFFF0000FFFF0000
00FF848484FF848484FF008484FF00FFFFFF008484FF008484FF008484FF0084
84FF848484FF848484FF0000000000000000000000000000FFFF000000FF8484
84FF848484FF848484FF008484FF008484FF008484FF008484FF008484FF0000
00FF000000000000000000000000000000000000000000000000848484FF8484
84FFFFFFFFFF848484FFFFFFFFFF848484FF008484FF008484FF000000FF8484
84FF00000000000000000000000000000000848484FF848484FF000000FF8484
84FF848484FF000000FF848484FF848484FF000000FF000000FF848484FF8484
84FF848484FF848484FF00000000000000000000000000000000848484FF0000
000000000000848484FF0000000000000000848484FF848484FF848484FF8484
84FF000000000000000000000000000000000000000000000000848484FF0000
000000000000848484FF0000000000000000848484FF00000000000000008484
84FF000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000848484FF848484FF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000848484FFC6C6C6FFC6C6C6FF848484FF848484FF00000000000000000000
0000000000000000000000000000000000000000000000000000000000008484
84FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FF848484FF848484FF0000
0000000000000000000000000000000000000000000000000000848484FFC6C6
C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FF8484
84FF848484FF00000000000000000000000000000000848484FFC6C6C6FFC6C6
C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FF848484FF8484
84FF000000FF00000000000000000000000000000000848484FFC6C6C6FFC6C6
C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FF848484FF8484
84FF000000FF00000000000000000000000000000000848484FFFFFFFFFFC6C6
C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FFC6C6C6FF848484FF848484FF8484
84FF000000FF00000000000000000000000000000000848484FFC6C6C6FFFFFF
FFFFFFFFFFFFC6C6C6FFC6C6C6FFC6C6C6FF848484FF848484FF848484FF8484
84FF000000FF00000000000000000000000000000000848484FFFFFFFFFFC6C6
C6FFFFFFFFFFC6C6C6FFFFFFFFFFC6C6C6FF848484FF848484FF848484FF8484
84FF000000FF00000000000000000000000000000000848484FFC6C6C6FFFFFF
FFFFC6C6C6FFFFFFFFFFC6C6C6FFC6C6C6FF848484FF848484FF848484FF0000
00FF000000000000000000000000000000000000000000000000848484FF8484
84FFFFFFFFFFC6C6C6FFFFFFFFFFC6C6C6FF848484FF848484FF000000FF0000
0000000000000000000000000000000000000000000000000000000000000000
0000848484FF848484FF848484FFC6C6C6FF848484FF000000FF000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000848484FF000000FF00000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000005A5A5AFF292929FF4A4A4AFF00000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000292929FF313131FF00000000212121FF424242FF000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000004A4A4AFF4A4A4AFF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000001810
18FF101010FF181818FF080808FF000000FF0000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000292921FF000000FF00000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000292121FF212121FF00000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00FF181818FF212121FF0000000000000000313131FF313131FF000000000000
00FF181818FF0000000000000000000000000000000000000000000000000808
08FF101010FF00000000000000000000000000000000393939FF080808FF3131
31FF000000000000000000000000000000000000000000000000000000000808
08FF313131FF000000000000000000000000000000FF101010FF212121FF0000
0000000000000000000000000000000000000000000000000000000000000808
08FF000000000000000000000000000000FF101010FF00000000212121FF2121
21FF000000000000000000000000000000000000000000000000313131FF2121
21FF000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000FF000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000848484FF00FF00FF0000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000848484FF00FF00FF00FF00FF00FF00FF00000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000848484FF008400FF00FF00FF00FF00FF00FF00FF000000000000
0000000000000000000000000000000000000000000000000000000000008484
84FF00000000848484FF008400FF008400FF00FF00FF00FF00FF00FF00FF0000
000000FF00FF0000000000000000000000000000000000000000848484FF00FF
00FF848484FF848484FF008400FF008400FF008400FF00FF00FF00FF00FF00FF
00FF00FF00FF848484FF000000000000000000000000848484FF00FF00FF00FF
00FF00FF00FF848484FF008400FF000000FF000000FF000000FF00FF00FF00FF
00FF00FF00FF848484FF00000000000000000000000000000000000000FF00FF
00FF00FF00FF00FF00FF008400FF000000FF848484FF008400FF00FF00FF00FF
00FF00FF00FF848484FF00000000000000000000000000000000000000000000
00FF00FF00FF00FF00FF008400FF000000FF848484FF00FF00FF00FF00FF00FF
00FF00FF00FF848484FF00000000000000000000000000000000000000000000
0000000000FF000000FF000000FF848484FF848484FF00000000848484FF8484
84FF848484FF848484FF00000000000000000000000000000000000000000000
000000000000848484FF848484FF848484FF0000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000848484FF00FFFFFF0000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000848484FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000848484FF008484FF00FFFFFF00FFFFFF00FFFFFF000000000000
0000000000000000000000000000000000000000000000000000000000008484
84FF00000000848484FF008484FF008484FF00FFFFFF00FFFFFF00FFFFFF0000
000000FFFFFF0000000000000000000000000000000000000000848484FF00FF
FFFF848484FF848484FF008484FF008484FF008484FF00FFFFFF00FFFFFF00FF
FFFF00FFFFFF848484FF000000000000000000000000848484FF00FFFFFF00FF
FFFF00FFFFFF848484FF008484FF000000FF000000FF000000FF00FFFFFF00FF
FFFF00FFFFFF848484FF00000000000000000000000000000000000000FF00FF
FFFF00FFFFFF00FFFFFF008484FF000000FF848484FF008484FF00FFFFFF00FF
FFFF00FFFFFF848484FF00000000000000000000000000000000000000000000
00FF00FFFFFF00FFFFFF008484FF000000FF848484FF00FFFFFF00FFFFFF00FF
FFFF00FFFFFF848484FF00000000000000000000000000000000000000000000
0000000000FF000000FF000000FF848484FF848484FF00000000848484FF8484
84FF848484FF848484FF00000000000000000000000000000000000000000000
000000000000848484FF848484FF848484FF0000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000
}
end
end

View File

@@ -0,0 +1,360 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, ShellCtrls, ComCtrls,
LclIntf, LclType,
ATSynEdit,
ATStringProc,
ATSynEdit_Adapter_EControl,
ATSynEdit_Carets,
ATSynEdit_Export_HTML,
ecSyntAnal,
proc_lexer;
type
{ TfmMain }
TfmMain = class(TForm)
bOpen: TButton;
bComment: TButton;
bUncomment: TButton;
bExport: TButton;
chkDyn: TCheckBox;
chkFullHilite: TCheckBox;
chkFullSel: TCheckBox;
chkLexer: TCheckBox;
chkShowCur: TCheckBox;
chkUnpri: TCheckBox;
chkWrap: TCheckBox;
edLexer: TComboBox;
files: TShellListView;
ImageListTree: TImageList;
OpenDialog1: TOpenDialog;
Panel1: TPanel;
PanelText: TPanel;
Splitter1: TSplitter;
Tree: TTreeView;
procedure AdapterParseBegin(Sender: TObject);
procedure AdapterParseDone(Sender: TObject);
procedure bCommentClick(Sender: TObject);
procedure bExportClick(Sender: TObject);
procedure bOpenClick(Sender: TObject);
procedure bUncommentClick(Sender: TObject);
procedure chkDynChange(Sender: TObject);
procedure chkFullHiliteChange(Sender: TObject);
procedure chkFullSelChange(Sender: TObject);
procedure chkLexerChange(Sender: TObject);
procedure chkShowCurChange(Sender: TObject);
procedure chkUnpriChange(Sender: TObject);
procedure chkWrapChange(Sender: TObject);
procedure EditorChangeCaretPos(Sender: TObject);
procedure edLexerChange(Sender: TObject);
procedure filesClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TreeClick(Sender: TObject);
private
{ private declarations }
ed: TATSynEdit;
FDir: string;
FFilename: string;
procedure DoCommentAct(Act: TATCommentAction);
procedure DoLexer(const aname: string);
procedure DoOpenFile(const fn: string);
procedure EditCalcStaple(Sender: TObject; ALine, AIndent: integer; var AColor: TColor);
procedure EditClickGutter(Sender: TObject; ABand: integer; ALine: integer);
function GetComment: string;
procedure UpdateLexList;
public
{ public declarations }
end;
var
fmMain: TfmMain;
implementation
{$R *.lfm}
var
manager: TecSyntaxManager;
adapter: TATAdapterEControl;
{ TfmMain }
procedure TfmMain.UpdateLexList;
var
i: integer;
sl: tstringlist;
begin
sl:= tstringlist.create;
try
for i:= 0 to manager.AnalyzerCount-1 do
sl.Add(manager.Analyzers[i].LexerName);
sl.sort;
edLexer.Items.AddStrings(sl);
finally
sl.free;
end;
end;
procedure TfmMain.DoOpenFile(const fn: string);
var
an: TecSyntAnalyzer;
begin
FFilename:= fn;
adapter.Lexer:= nil;
Tree.Items.Clear;
ed.LoadFromFile(fn);
ed.SetFocus;
an:= DoFindLexerForFilename(manager, fn);
adapter.Lexer:= an;
if Assigned(an) then
edLexer.ItemIndex:= edLexer.Items.IndexOf(an.LexerName);
end;
procedure TfmMain.FormCreate(Sender: TObject);
var
fname_lxl: string;
begin
FDir:= ExtractFileDir(ExtractFileDir(ExtractFileDir(Application.ExeName)))+'/test_syntax_files/';
fname_lxl:= ExtractFilePath(Application.ExeName)+'lib.lxl';
manager:= TecSyntaxManager.Create(Self);
manager.LoadFromFile(fname_lxl);
UpdateLexList;
ed:= TATSynEdit.Create(Self);
ed.Font.Name:= 'Courier New';
ed.Parent:= PanelText;
ed.Align:= alClient;
ed.OptUnprintedVisible:= false;
ed.OptRulerVisible:= false;
ed.Colors.TextBG:= $e0f0f0;
ed.Colors.CurrentLineBG:= clTeal;
ed.Gutter[ed.GutterBandNum].Visible:= false;
ed.Gutter.Update;
ed.OnClickGutter:= @EditClickGutter;
ed.OnCalcStaple:= @EditCalcStaple;
ed.OnChangeCaretPos:=@EditorChangeCaretPos;
adapter:= TATAdapterEControl.Create(Self);
adapter.OnParseBegin:=@AdapterParseBegin;
adapter.OnParseDone:=@AdapterParseDone;
ed.AdapterHilite:= adapter;
chkWrap.Checked:= ed.OptWrapMode=cWrapOn;
chkFullSel.Checked:= ed.OptShowFullSel;
chkFullHilite.Checked:= ed.OptShowFullHilite;
chkUnpri.Checked:= ed.OptUnprintedVisible;
chkShowCur.Checked:= ed.OptShowCurLine;
chkDyn.Checked:= adapter.DynamicHiliteEnabled;
end;
procedure TfmMain.FormShow(Sender: TObject);
begin
if DirectoryExists(FDir) then
files.Root:= FDir;
end;
procedure TfmMain.TreeClick(Sender: TObject);
var
R: TecTextRange;
P: TPoint;
begin
if adapter.TreeBusy then exit;
if Tree.Selected=nil then exit;
if Tree.Selected.Data=nil then exit;
R:= TecTextRange(Tree.Selected.Data);
P:= adapter.TreeGetPositionOfRange(R);
ed.DoGotoPos_AndUnfold(P, 5, 5);
ed.SetFocus;
end;
procedure TfmMain.chkWrapChange(Sender: TObject);
begin
if chkWrap.checked then
ed.OptWrapMode:= cWrapOn
else
ed.OptWrapMode:= cWrapOff;
end;
procedure TfmMain.EditorChangeCaretPos(Sender: TObject);
begin
adapter.TreeShowItemForCaret(Tree, Point(ed.Carets[0].PosX, ed.Carets[0].PosY));
end;
procedure TfmMain.chkFullSelChange(Sender: TObject);
begin
ed.OptShowFullSel:= chkFullSel.Checked;
ed.Update;
end;
procedure TfmMain.chkLexerChange(Sender: TObject);
begin
adapter.Lexer:= nil;
ed.Fold.Clear;
if chkLexer.Checked then
adapter.Lexer:= DoFindLexerForFilename(manager, FFilename);
ed.Update;
end;
procedure TfmMain.chkShowCurChange(Sender: TObject);
begin
ed.OptShowCurLine:= chkShowCur.Checked;
ed.Update;
end;
procedure TfmMain.chkUnpriChange(Sender: TObject);
begin
ed.OptUnprintedVisible:= chkUnpri.Checked;
ed.Update;
end;
procedure TfmMain.chkFullHiliteChange(Sender: TObject);
begin
ed.OptShowFullHilite:= chkFullHilite.Checked;
ed.Update;
end;
procedure TfmMain.bOpenClick(Sender: TObject);
begin
with OpenDialog1 do
begin
Filename:= '';
InitialDir:= FDir;
if not Execute then exit;
DoOpenFile(Filename);
end;
end;
function TfmMain.GetComment: string;
var
an: TecSyntAnalyzer;
begin
Result:= '';
an:= adapter.Lexer;
if Assigned(an) then
Result:= an.LineComment;
end;
procedure TfmMain.DoCommentAct(Act: TATCommentAction);
var
Str: string;
begin
Str:= GetComment;
if Str='' then
Showmessage('No line comment defined for lexer')
else
Ed.DoCommentSelectionLines(Act, Str);
end;
procedure TfmMain.bCommentClick(Sender: TObject);
begin
DoCommentAct(cCommentAdd_AtNonespace_IfNone);
end;
procedure TfmMain.bExportClick(Sender: TObject);
var
fn: string;
begin
fn:= GetTempDir+DirectorySeparator+'_export.html';
DoEditorExportToHTML(Ed, fn, 'Export test',
'Courier New', 12, false,
clWhite, clMedGray);
if FileExists(fn) then
OpenDocument(fn);
end;
procedure TfmMain.AdapterParseDone(Sender: TObject);
begin
adapter.TreeFill(Tree);
EditorChangeCaretPos(Self);
end;
procedure TfmMain.AdapterParseBegin(Sender: TObject);
begin
Tree.Items.Clear;
end;
procedure TfmMain.bUncommentClick(Sender: TObject);
begin
DoCommentAct(cCommentRemove);
end;
procedure TfmMain.chkDynChange(Sender: TObject);
begin
adapter.DynamicHiliteEnabled:= chkDyn.Checked;
Ed.Update;
end;
procedure TfmMain.DoLexer(const aname: string);
begin
adapter.Lexer:= manager.FindAnalyzer(aname);
ed.Update;
end;
procedure TfmMain.edLexerChange(Sender: TObject);
begin
DoLexer(edLexer.Text);
end;
procedure TfmMain.filesClick(Sender: TObject);
var
fn: string;
begin
if files.Selected=nil then exit;
//while adapter.TreeBusy do Application.ProcessMessages;
fn:= files.GetPathFromItem(files.Selected);
if FileExistsUTF8(fn) then
DoOpenFile(fn);
end;
procedure TfmMain.EditClickGutter(Sender: TObject; ABand: integer; ALine: integer);
begin
if ABand=ed.GutterBandBm then
begin
if ed.Strings.LinesBm[ALine]<>0 then
ed.Strings.LinesBm[ALine]:= 0
else
ed.Strings.LinesBm[ALine]:= 1;
ed.Update;
end;
end;
procedure TfmMain.EditCalcStaple(Sender: TObject; ALine, AIndent: integer; var AColor: TColor);
const
nColors = 10;
cl: array[0..nColors-1] of TColor = (
clGray,
clBlue,
clRed,
clGreen,
clOlive,
clMaroon,
clLime,
clMoneyGreen,
clNavy,
clTeal
);
begin
AColor:= cl[AIndent div 2 mod nColors];
end;
end.

View File

@@ -0,0 +1,80 @@
object fmLexerLib: TfmLexerLib
Left = 434
Height = 468
Top = 338
Width = 459
BorderIcons = [biSystemMenu]
Caption = 'Lexer library'
ClientHeight = 468
ClientWidth = 459
OnShow = FormShow
Position = poScreenCenter
ShowInTaskBar = stNever
LCLVersion = '1.5'
object ButtonPanel1: TButtonPanel
Left = 6
Height = 29
Top = 433
Width = 447
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
HelpButton.DefaultCaption = True
CloseButton.Name = 'CloseButton'
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 2
ShowButtons = [pbClose]
ShowBevel = False
end
object ToolBar1: TToolBar
Left = 0
Height = 28
Top = 0
Width = 459
AutoSize = True
ButtonHeight = 28
Caption = 'ToolBar1'
EdgeInner = esNone
EdgeOuter = esNone
ShowCaptions = True
TabOrder = 0
object bProp: TToolButton
Left = 1
Top = 0
Caption = 'Config'
OnClick = bPropClick
end
object bDel: TToolButton
Left = 88
Top = 0
Caption = 'Delete'
OnClick = bDelClick
end
object bAdd: TToolButton
Left = 52
Top = 0
Caption = 'Add'
OnClick = bAddClick
end
end
object List: TCheckListBox
Left = 6
Height = 393
Top = 34
Width = 447
Align = alClient
BorderSpacing.Around = 6
ItemHeight = 0
OnClickCheck = ListClickCheck
TabOrder = 1
TopIndex = -1
end
object OpenDlg: TOpenDialog
Filter = 'Zip files|*.zip'
Options = [ofHideReadOnly, ofFileMustExist, ofEnableSizing, ofViewDetail]
left = 280
top = 360
end
end

View File

@@ -0,0 +1,216 @@
(*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (c) Alexey Torgashin
*)
unit formlexerlib;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel,
StdCtrls, ComCtrls, CheckLst,
LCLIntf, LCLType, LCLProc,
ecSyntAnal,
formlexerprop, proc_lexer_install_zip,
math;
type
{ TfmLexerLib }
TfmLexerLib = class(TForm)
ButtonPanel1: TButtonPanel;
List: TCheckListBox;
OpenDlg: TOpenDialog;
ToolBar1: TToolBar;
bProp: TToolButton;
bDel: TToolButton;
bAdd: TToolButton;
procedure bAddClick(Sender: TObject);
procedure bDelClick(Sender: TObject);
procedure bPropClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ListClickCheck(Sender: TObject);
private
{ private declarations }
procedure UpdateList;
public
FManager: TecSyntaxManager;
FFontName: string;
FFontSize: integer;
FDirAcp: string;
{ public declarations }
end;
var
fmLexerLib: TfmLexerLib;
function DoShowDialogLexerLib(ALexerManager: TecSyntaxManager;
const ADirAcp: string;
const AFontName: string;
AFontSize: integer): boolean;
implementation
{$R *.lfm}
function DoShowDialogLexerLib(ALexerManager: TecSyntaxManager;
const ADirAcp: string; const AFontName: string; AFontSize: integer): boolean;
var
F: TfmLexerLib;
begin
F:= TfmLexerLib.Create(nil);
try
F.FManager:= ALexerManager;
F.FFontName:= AFontName;
F.FFontSize:= AFontSize;
F.FDirAcp:= ADirAcp;
F.ShowModal;
Result:= F.FManager.Modified;
finally
F.Free;
end;
end;
function IsLexerLinkDup(an: TecSyntAnalyzer; LinkN: integer): boolean;
var
i: integer;
begin
Result:= false;
for i:= 0 to LinkN-1 do
if an.SubAnalyzers[i].SyntAnalyzer=an.SubAnalyzers[LinkN].SyntAnalyzer then
begin
Result:= true;
exit
end;
end;
{ TfmLexerLib }
procedure TfmLexerLib.FormShow(Sender: TObject);
begin
UpdateList;
if List.Items.Count>0 then
List.ItemIndex:= 0;
end;
procedure TfmLexerLib.ListClickCheck(Sender: TObject);
var
an: TecSyntAnalyzer;
n: integer;
begin
n:= List.ItemIndex;
if n<0 then exit;
an:= List.Items.Objects[n] as TecSyntAnalyzer;
an.Internal:= not List.Checked[n];
FManager.Modified:= true;
end;
procedure TfmLexerLib.bPropClick(Sender: TObject);
var
an: TecSyntAnalyzer;
n: integer;
begin
n:= List.ItemIndex;
if n<0 then exit;
an:= List.Items.Objects[n] as TecSyntAnalyzer;
if DoShowDialogLexerProp(an, FFontName, FFontSize) then
begin
FManager.Modified:= true;
UpdateList;
List.ItemIndex:= n;
end;
end;
procedure TfmLexerLib.bDelClick(Sender: TObject);
var
an: TecSyntAnalyzer;
n: integer;
begin
n:= List.ItemIndex;
if n<0 then exit;
an:= List.Items.Objects[n] as TecSyntAnalyzer;
if Application.MessageBox(
PChar(Format('Delete lexer "%s"?', [an.LexerName])),
PChar(Caption),
MB_OKCANCEL or MB_ICONWARNING)=id_ok then
begin
an.Free;
FManager.Modified:= true;
UpdateList;
List.ItemIndex:= Min(n, List.Count-1);
end;
end;
procedure TfmLexerLib.bAddClick(Sender: TObject);
var
msg: string;
begin
OpenDlg.Filename:= '';
if not OpenDlg.Execute then exit;
if DoInstallLexerFromZip(OpenDlg.FileName, FManager, FDirAcp, msg) then
begin
UpdateList;
Application.MessageBox(
PChar('Installed:'#13+msg),
PChar(Caption), MB_OK or MB_ICONINFORMATION);
end;
end;
procedure TfmLexerLib.UpdateList;
var
sl: tstringlist;
an: TecSyntAnalyzer;
an_sub: TecSubAnalyzerRule;
links: string;
i, j: integer;
begin
List.Items.BeginUpdate;
List.Items.Clear;
sl:= tstringlist.create;
try
for i:= 0 to FManager.AnalyzerCount-1 do
begin
an:= FManager.Analyzers[i];
sl.AddObject(an.LexerName, an);
end;
sl.sort;
for i:= 0 to sl.count-1 do
begin
an:= sl.Objects[i] as TecSyntAnalyzer;
links:= '';
for j:= 0 to an.SubAnalyzers.Count-1 do
if not IsLexerLinkDup(an, j) then
begin
if links='' then
links:= 'links: '
else
links:= links+', ';
an_sub:= an.SubAnalyzers[j];
if an_sub<>nil then
if an_sub.SyntAnalyzer<>nil then
links:= links+an_sub.SyntAnalyzer.LexerName;
end;
if links<>'' then links:= ' ('+links+')';
List.Items.AddObject(sl[i]+links, an);
List.Checked[List.Count-1]:= not an.Internal;
end;
finally
sl.free;
end;
List.Items.EndUpdate;
end;
end.

View File

@@ -0,0 +1,548 @@
object fmLexerProp: TfmLexerProp
Left = 218
Height = 566
Top = 300
Width = 623
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = 'Lexer properties'
ClientHeight = 566
ClientWidth = 623
OnCreate = FormCreate
OnDestroy = FormDestroy
Position = poScreenCenter
ShowInTaskBar = stNever
LCLVersion = '1.5'
object ButtonPanel1: TButtonPanel
Left = 6
Height = 29
Top = 531
Width = 611
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
HelpButton.DefaultCaption = True
CloseButton.Name = 'CloseButton'
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 1
ShowButtons = [pbOK, pbCancel]
ShowBevel = False
end
object chkBorderT: TPageControl
Left = 0
Height = 525
Top = 0
Width = 623
ActivePage = TabSheetGen
Align = alClient
TabIndex = 0
TabOrder = 0
object TabSheetGen: TTabSheet
Caption = 'General'
ClientHeight = 494
ClientWidth = 619
object Label2: TLabel
Left = 6
Height = 17
Top = 0
Width = 607
Align = alTop
BorderSpacing.Left = 6
BorderSpacing.Right = 6
Caption = 'Lexer name:'
ParentColor = False
end
object edName: TEdit
Left = 6
Height = 27
Top = 20
Width = 607
Align = alTop
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 6
BorderSpacing.Bottom = 3
TabOrder = 0
end
object Label3: TLabel
Left = 6
Height = 17
Top = 50
Width = 607
Align = alTop
BorderSpacing.Left = 6
BorderSpacing.Right = 6
Caption = 'File types:'
ParentColor = False
end
object edExt: TEdit
Left = 6
Height = 27
Top = 70
Width = 607
Align = alTop
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 6
BorderSpacing.Bottom = 3
TabOrder = 1
end
object Label4: TLabel
Left = 6
Height = 17
Top = 100
Width = 607
Align = alTop
BorderSpacing.Left = 6
BorderSpacing.Right = 6
Caption = 'Line-comment string:'
ParentColor = False
end
object edLineCmt: TEdit
Left = 6
Height = 27
Top = 120
Width = 607
Align = alTop
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 6
BorderSpacing.Bottom = 3
TabOrder = 2
end
object Label1: TLabel
Left = 6
Height = 17
Top = 150
Width = 607
Align = alTop
BorderSpacing.Left = 6
BorderSpacing.Right = 6
Caption = 'Sample text:'
ParentColor = False
end
object edSample: TATSynEdit
Left = 6
Height = 315
Top = 173
Width = 607
Align = alClient
BorderSpacing.Around = 6
BorderStyle = bsSingle
Font.Height = -12
Font.Name = 'Courier New'
ParentFont = False
TabOrder = 3
TabStop = True
CursorText = crIBeam
CursorBm = crHandPoint
Colors.TextFont = clBlack
Colors.TextBG = clWhite
Colors.TextDisabledFont = clMedGray
Colors.TextDisabledBG = clSilver
Colors.TextSelFont = clHighlightText
Colors.TextSelBG = clHighlight
Colors.Caret = clBlack
Colors.GutterFont = clGray
Colors.GutterBG = 14737632
Colors.GutterCaretBG = 13158600
Colors.GutterPlusBorder = clGray
Colors.GutterPlusBG = 16053492
Colors.GutterFoldLine = clGray
Colors.GutterFoldBG = 13158600
Colors.GutterSeparatorBG = clBlack
Colors.CurrentLineBG = 14741744
Colors.MarginRight = clSilver
Colors.MarginCaret = clLime
Colors.MarginUser = clYellow
Colors.IndentVertLines = clMedGray
Colors.BookmarkBG = clMoneyGreen
Colors.RulerFont = clGray
Colors.RulerBG = 14737632
Colors.CollapseLine = 10510432
Colors.CollapseMarkFont = 14712960
Colors.CollapseMarkBG = clCream
Colors.UnprintedFont = 5263600
Colors.UnprintedBG = 14737632
Colors.UnprintedHexFont = clMedGray
Colors.MinimapBorder = clSilver
Colors.MinimapSelBG = 15658734
Colors.StateChanged = 61680
Colors.StateAdded = 2146336
Colors.StateSaved = clMedGray
Colors.BlockStaple = clMedGray
Colors.BlockSepLine = clMedGray
Colors.LockedBG = 14737632
Colors.TextHintFont = clGray
Colors.ComboboxArrow = clGray
Colors.ComboboxArrowBG = 15790320
WantTabs = True
OptTabSpaces = False
OptTabSize = 8
OptFoldStyle = cFoldHereWithTruncatedText
OptTextLocked = 'wait...'
OptTextHintFontStyle = [fsItalic]
OptTextHintCenter = False
OptTextOffsetTop = 0
OptTextOffsetFromLine = 1
OptAutoIndent = True
OptAutoIndentKind = cIndentAsIs
OptCopyLinesIfNoSel = True
OptCutLinesIfNoSel = False
OptLastLineOnTop = False
OptOverwriteSel = True
OptOverwriteAllowedOnPaste = False
OptShowStapleStyle = cLineStyleSolid
OptShowStapleIndent = -1
OptShowStapleWidthPercent = 100
OptShowFullSel = False
OptShowFullHilite = True
OptShowCurLine = False
OptShowCurLineMinimal = True
OptShowScrollHint = False
OptShowCurColumn = False
OptCaretManyAllowed = True
OptCaretVirtual = True
OptCaretShape = cCaretShapeVertPixels1
OptCaretShapeOvr = cCaretShapeFull
OptCaretShapeRO = cCaretShapeHorzPixels1
OptCaretBlinkTime = 600
OptCaretBlinkEnabled = True
OptCaretStopUnfocused = True
OptCaretPreferLeftSide = True
OptGutterVisible = True
OptGutterPlusSize = 4
OptGutterShowFoldAlways = True
OptGutterShowFoldLines = True
OptGutterShowFoldLinesAll = False
OptRulerVisible = False
OptRulerSize = 20
OptRulerFontSize = 8
OptRulerMarkSizeSmall = 3
OptRulerMarkSizeBig = 7
OptRulerTextIndent = 0
OptMinimapVisible = False
OptMinimapCharWidth = 0
OptMinimapShowSelBorder = False
OptMinimapShowSelAlways = True
OptMicromapVisible = False
OptMicromapWidth = 30
OptCharSpacingX = 0
OptCharSpacingY = 1
OptWrapMode = cWrapOff
OptWrapIndented = True
OptMarginRight = 80
OptNumbersAutosize = True
OptNumbersAlignment = taRightJustify
OptNumbersFontSize = 0
OptNumbersStyle = cNumbersNone
OptNumbersShowFirst = True
OptNumbersShowCarets = False
OptNumbersSkippedChar = '.'
OptNumbersIndentLeft = 5
OptNumbersIndentRight = 5
OptUnprintedVisible = False
OptUnprintedSpaces = True
OptUnprintedEnds = True
OptUnprintedEndsDetails = True
OptUnprintedReplaceSpec = True
OptMouseEnableNormalSelection = True
OptMouseEnableColumnSelection = True
OptMouseDownForPopup = False
OptMouseHideCursorOnType = False
OptMouse2ClickSelectsLine = False
OptMouse3ClickSelectsLine = True
OptMouse2ClickDragSelectsWords = True
OptMouseDragDrop = True
OptMouseNiceScroll = True
OptMouseRightClickMovesCaret = False
OptMouseGutterClickSelectsLine = True
OptKeyBackspaceUnindent = True
OptKeyPageKeepsRelativePos = True
OptKeyUpDownNavigateWrapped = True
OptKeyUpDownKeepColumn = True
OptKeyHomeEndNavigateWrapped = True
OptKeyPageUpDownSize = cPageSizeFullMinus1
OptKeyLeftRightSwapSel = True
OptKeyLeftRightSwapSelAndSelect = False
OptKeyHomeToNonSpace = True
OptKeyEndToNonSpace = True
OptKeyTabIndents = True
OptIndentSize = 2
OptIndentKeepsAlign = True
OptShowIndentLines = True
OptShowGutterCaretBG = True
OptAllowScrollbarVert = True
OptAllowScrollbarHorz = True
OptAllowZooming = True
OptAllowReadOnly = True
OptUndoLimit = 5000
OptUndoGrouped = True
OptUndoAfterSave = True
OptSavingForceFinalEol = False
OptSavingTrimSpaces = False
end
end
object TabSheetStyles: TTabSheet
Caption = 'Styles'
ClientHeight = 494
ClientWidth = 619
object ListStyles: TListBox
Left = 6
Height = 482
Top = 6
Width = 176
Align = alLeft
BorderSpacing.Around = 6
ItemHeight = 0
OnClick = ListStylesClick
ScrollWidth = 174
TabOrder = 0
TopIndex = -1
end
object Panel1: TPanel
Left = 188
Height = 482
Top = 6
Width = 425
Align = alClient
BorderSpacing.Around = 6
BevelOuter = bvNone
ClientHeight = 482
ClientWidth = 425
TabOrder = 1
object edColorFont: TColorBox
Left = 208
Height = 31
Top = 65
Width = 190
ColorRectWidth = 22
NoneColorColor = clNone
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeNone, cbCustomColor, cbPrettyNames]
DropDownCount = 20
ItemHeight = 0
TabOrder = 2
end
object edColorBG: TColorBox
Left = 8
Height = 31
Top = 65
Width = 190
ColorRectWidth = 22
NoneColorColor = clNone
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeNone, cbCustomColor, cbPrettyNames]
DropDownCount = 20
ItemHeight = 0
TabOrder = 1
end
object Label5: TLabel
Left = 208
Height = 17
Top = 49
Width = 91
Caption = 'Color of font:'
ParentColor = False
end
object edStyleType: TComboBox
Left = 8
Height = 31
Top = 18
Width = 190
ItemHeight = 0
Items.Strings = (
'Misc font (not supp.)'
'Colors, styles'
'Colors'
'Color BG only'
)
OnChange = edStyleTypeChange
Style = csDropDownList
TabOrder = 0
end
object Label6: TLabel
Left = 8
Height = 17
Top = 0
Width = 70
Caption = 'Style type:'
ParentColor = False
end
object Label7: TLabel
Left = 8
Height = 17
Top = 48
Width = 81
Caption = 'Color of BG:'
ParentColor = False
end
object Label8: TLabel
Left = 8
Height = 17
Top = 104
Width = 77
Caption = 'Font styles:'
ParentColor = False
end
object chkBold: TCheckBox
Left = 8
Height = 24
Top = 120
Width = 57
Caption = 'Bold'
TabOrder = 3
end
object chkItalic: TCheckBox
Left = 88
Height = 24
Top = 120
Width = 59
Caption = 'Italic'
TabOrder = 4
end
object chkStrik: TCheckBox
Left = 280
Height = 24
Top = 120
Width = 83
Caption = 'Stikeout'
TabOrder = 6
end
object chkUnder: TCheckBox
Left = 168
Height = 24
Top = 120
Width = 91
Caption = 'Underline'
TabOrder = 5
end
object bApplyStl: TButton
Left = 8
Height = 29
Top = 304
Width = 143
AutoSize = True
Caption = 'Apply style changes'
OnClick = bApplyStlClick
TabOrder = 12
end
object Label9: TLabel
Left = 8
Height = 17
Top = 152
Width = 58
Caption = 'Borders:'
ParentColor = False
end
object cbBorderL: TComboBox
Left = 8
Height = 31
Top = 184
Width = 100
DropDownCount = 20
ItemHeight = 0
Style = csDropDownList
TabOrder = 7
end
object cbBorderT: TComboBox
Left = 112
Height = 31
Top = 184
Width = 100
DropDownCount = 20
ItemHeight = 0
Style = csDropDownList
TabOrder = 8
end
object cbBorderR: TComboBox
Left = 216
Height = 31
Top = 184
Width = 100
DropDownCount = 20
ItemHeight = 0
Style = csDropDownList
TabOrder = 9
end
object cbBorderB: TComboBox
Left = 320
Height = 31
Top = 184
Width = 100
DropDownCount = 20
ItemHeight = 0
Style = csDropDownList
TabOrder = 10
end
object Label10: TLabel
Left = 8
Height = 17
Top = 168
Width = 28
Caption = 'Left'
ParentColor = False
end
object Label11: TLabel
Left = 112
Height = 17
Top = 168
Width = 25
Caption = 'Top'
ParentColor = False
end
object Label12: TLabel
Left = 216
Height = 17
Top = 168
Width = 35
Caption = 'Right'
ParentColor = False
end
object Label13: TLabel
Left = 320
Height = 17
Top = 168
Width = 52
Caption = 'Bottom'
ParentColor = False
end
object Label14: TLabel
Left = 8
Height = 17
Top = 216
Width = 109
Caption = 'Color of border:'
ParentColor = False
end
object edColorBorder: TColorBox
Left = 8
Height = 31
Top = 232
Width = 190
ColorRectWidth = 22
NoneColorColor = clNone
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeNone, cbCustomColor, cbPrettyNames]
DropDownCount = 20
ItemHeight = 0
TabOrder = 11
end
end
end
object TabSheetNotes: TTabSheet
Caption = 'Notes'
ClientHeight = 494
ClientWidth = 619
object edNotes: TMemo
Left = 6
Height = 482
Top = 6
Width = 607
Align = alClient
BorderSpacing.Around = 6
ScrollBars = ssBoth
TabOrder = 0
end
end
end
end

View File

@@ -0,0 +1,272 @@
(*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (c) Alexey Torgashin
*)
unit formlexerprop;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Graphics, FileUtil, Forms, Controls, StdCtrls,
Dialogs, ButtonPanel, ComCtrls, ExtCtrls, ColorBox,
ecSyntAnal,
ATSynEdit,
ATSynEdit_Adapter_EControl;
type
{ TfmLexerProp }
TfmLexerProp = class(TForm)
bApplyStl: TButton;
ButtonPanel1: TButtonPanel;
chkBold: TCheckBox;
chkItalic: TCheckBox;
chkStrik: TCheckBox;
chkUnder: TCheckBox;
cbBorderL: TComboBox;
cbBorderT: TComboBox;
cbBorderR: TComboBox;
cbBorderB: TComboBox;
edColorFont: TColorBox;
edColorBG: TColorBox;
edColorBorder: TColorBox;
edStyleType: TComboBox;
edExt: TEdit;
edLineCmt: TEdit;
edName: TEdit;
edSample: TATSynEdit;
Label1: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
edNotes: TMemo;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
ListStyles: TListBox;
chkBorderT: TPageControl;
Panel1: TPanel;
TabSheetGen: TTabSheet;
TabSheetNotes: TTabSheet;
TabSheetStyles: TTabSheet;
procedure bApplyStlClick(Sender: TObject);
procedure edStyleTypeChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure ListStylesClick(Sender: TObject);
private
{ private declarations }
FAn: TecSyntAnalyzer;
procedure InitBorder(cb: TCombobox);
procedure UpdateStl;
procedure UpdateStlEn(fmt: TecFormatType);
procedure UpdateStlFromList;
procedure UpdateStlToList;
public
{ public declarations }
Adapter: TATAdapterEControl;
end;
var
fmLexerProp: TfmLexerProp;
function DoShowDialogLexerProp(an: TecSyntAnalyzer;
AFontName: string; AFontSize: integer): boolean;
implementation
{$R *.lfm}
{ TfmLexerProp }
procedure TfmLexerProp.FormCreate(Sender: TObject);
begin
Adapter:= TATAdapterEControl.Create(Self);
edSample.AdapterHilite:= Adapter;
InitBorder(cbBorderL);
InitBorder(cbBorderT);
InitBorder(cbBorderR);
InitBorder(cbBorderB);
end;
procedure TfmLexerProp.bApplyStlClick(Sender: TObject);
begin
UpdateStlToList;
end;
procedure TfmLexerProp.edStyleTypeChange(Sender: TObject);
begin
UpdateStlEn(TecFormatType(edStyleType.ItemIndex));
end;
procedure TfmLexerProp.FormDestroy(Sender: TObject);
begin
edSample.AdapterHilite:= nil;
FreeAndNil(Adapter);
end;
procedure TfmLexerProp.ListStylesClick(Sender: TObject);
begin
UpdateStlFromList;
end;
procedure TfmLexerProp.UpdateStl;
var
i: integer;
fmt: TecSyntaxFormat;
begin
ListStyles.Items.Clear;
for i:= 0 to FAn.Formats.Count-1 do
begin
fmt:= FAn.Formats[i];
ListStyles.Items.Add(fmt.DisplayName);
end;
if ListStyles.Count>0 then
ListStyles.ItemIndex:= 0;
UpdateStlFromList;
end;
procedure TfmLexerProp.UpdateStlFromList;
var
n: integer;
fmt: TecSyntaxFormat;
begin
n:= ListStyles.ItemIndex;
if n<0 then exit;
fmt:= FAn.Formats[n];
UpdateStlEn(fmt.FormatType);
edStyleType.ItemIndex:= Ord(fmt.FormatType);
edColorFont.Selected:= fmt.Font.Color;
edColorBG.Selected:= fmt.BgColor;
edColorBorder.Selected:= fmt.BorderColorBottom;
chkBold.Checked:= fsBold in fmt.Font.Style;
chkItalic.Checked:= fsItalic in fmt.Font.Style;
chkUnder.Checked:= fsUnderline in fmt.Font.Style;
chkStrik.Checked:= fsStrikeOut in fmt.Font.Style;
cbBorderL.ItemIndex:= Ord(fmt.BorderTypeLeft);
cbBorderT.ItemIndex:= Ord(fmt.BorderTypeTop);
cbBorderR.ItemIndex:= Ord(fmt.BorderTypeRight);
cbBorderB.ItemIndex:= Ord(fmt.BorderTypeBottom);
end;
procedure TfmLexerProp.UpdateStlEn(fmt: TecFormatType);
begin
edColorFont.Enabled:= fmt in [ftCustomFont, ftFontAttr, ftColor];
edColorBG.Enabled:= true;
chkBold.Enabled:= fmt in [ftCustomFont, ftFontAttr];
chkItalic.Enabled:= chkBold.Enabled;
chkUnder.Enabled:= chkBold.Enabled;
chkStrik.Enabled:= chkBold.Enabled;
end;
procedure TfmLexerProp.UpdateStlToList;
var
n: integer;
fmt: TecSyntaxFormat;
fs: TFontStyles;
begin
n:= ListStyles.ItemIndex;
if n<0 then exit;
fmt:= FAn.Formats[n];
fmt.FormatType:= TecFormatType(edStyleType.ItemIndex);
fmt.Font.Color:= edColorFont.Selected;
fmt.BgColor:= edColorBG.Selected;
fmt.BorderColorBottom:= edColorBorder.Selected;
fs:= [];
if chkBold.Checked then Include(fs, fsBold);
if chkItalic.Checked then Include(fs, fsItalic);
if chkUnder.Checked then Include(fs, fsUnderline);
if chkStrik.Checked then Include(fs, fsStrikeOut);
fmt.Font.Style:= fs;
fmt.BorderTypeLeft:= TecBorderLineType(cbBorderL.ItemIndex);
fmt.BorderTypeTop:= TecBorderLineType(cbBorderT.ItemIndex);
fmt.BorderTypeRight:= TecBorderLineType(cbBorderR.ItemIndex);
fmt.BorderTypeBottom:= TecBorderLineType(cbBorderB.ItemIndex);
end;
function DoShowDialogLexerProp(an: TecSyntAnalyzer; AFontName: string;
AFontSize: integer): boolean;
var
F: TfmLexerProp;
begin
Result:= false;
if an=nil then exit;
F:= TfmLexerProp.Create(nil);
try
F.FAn:= an;
F.edName.Text:= an.LexerName;
F.edExt.Text:= an.Extentions;
F.edLineCmt.Text:= an.LineComment;
F.edNotes.Lines.AddStrings(an.Notes);
F.UpdateStl;
F.edSample.Font.Name:= AFontName;
F.edSample.Font.Size:= AFontSize;
F.edSample.Gutter[F.edSample.GutterBandBm].Visible:= false;
F.edSample.Gutter[F.edSample.GutterBandNum].Visible:= false;
F.Adapter.Lexer:= an;
if Assigned(an.SampleText) then
begin
F.edSample.Strings.LoadFromString(an.SampleText.Text);
F.edSample.Update(true);
F.edSample.DoEventChange;
end;
if F.ShowModal<>mrOk then exit;
if Trim(F.edName.Text)='' then exit;
Result:= true;
an.LexerName:= F.edName.Text;
an.Extentions:= F.edExt.Text;
an.LineComment:= F.edLineCmt.Text;
an.Notes.Clear;
an.Notes.AddStrings(F.edNotes.Lines);
finally
F.Free;
end;
end;
procedure TfmLexerProp.InitBorder(cb: TCombobox);
begin
with cb.Items do
begin
Clear;
Add('none');
Add('solid');
Add('dash');
Add('dot');
Add('dash dot');
Add('dash dot dot');
Add('solid2');
Add('solid3');
Add('wave');
Add('double');
end;
end;
end.

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="Demo"/>
<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="3">
<Item1>
<PackageName Value="atsynedit_package"/>
</Item1>
<Item2>
<PackageName Value="econtrol_package"/>
</Item2>
<Item3>
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages>
<Units Count="4">
<Unit0>
<Filename Value="lex_lib_demo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unmain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fmMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
<Unit2>
<Filename Value="formlexerlib.pas"/>
<IsPartOfProject Value="True"/>
<HasResources Value="True"/>
</Unit2>
<Unit3>
<Filename Value="formlexerprop.pas"/>
<IsPartOfProject Value="True"/>
<HasResources Value="True"/>
</Unit3>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="lex_lib_demo"/>
</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"/>
</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>

View File

@@ -0,0 +1,22 @@
program lex_lib_demo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, unmain
{ you can add units after this };
{$R *.res}
begin
Application.Title:='Demo';
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TfmMain, fmMain);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,167 @@
unit proc_lexer_install_zip;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, FileUtil,
ecSyntAnal;
function DoInstallLexerFromZip(const fn_zip: string;
Manager: TecSyntaxManager;
const dir_acp: string;
out s_installed: string): boolean;
var
cInstallLexerZipTitle: string = 'Install zip';
implementation
uses
LCLIntf, LCLProc, LCLType,
IniFiles,
Zipper;
function MsgBox(const msg: string; flags: integer): integer;
begin
Result:= Application.MessageBox(PChar(msg), PChar(cInstallLexerZipTitle), flags);
end;
function DoInstallLexerFromZip(const fn_zip: string;
Manager: TecSyntaxManager;
const dir_acp: string;
out s_installed: string): boolean;
var
unzip: TUnZipper;
list: TStringlist;
dir, fn_inf, fn_lexer, fn_acp: string;
s_title, s_type, s_lexer: string;
an, an_sub: TecSyntAnalyzer;
i_lexer, i_sub: integer;
begin
Result:= false;
dir:= GetTempDir(false)+DirectorySeparator+'zip_lexer';
if not DirectoryExists(dir) then
CreateDir(dir);
if not DirectoryExists(dir) then
begin
MsgBox('Cannot create dir:'#13+dir, mb_ok or mb_iconerror);
exit
end;
fn_inf:= dir+DirectorySeparator+'install.inf';
if FileExists(fn_inf) then
DeleteFile(fn_inf);
unzip:= TUnZipper.Create;
try
unzip.FileName:= fn_zip;
unzip.OutputPath:= dir;
unzip.Examine;
list:= TStringlist.create;
try
list.Add('install.inf');
unzip.UnZipFiles(list);
finally
FreeAndNil(list);
end;
if not FileExists(fn_inf) then
begin
MsgBox('Cannot find install.inf in zip', mb_ok or mb_iconerror);
exit
end;
unzip.Files.Clear;
unzip.UnZipAllFiles;
finally
unzip.Free;
end;
with TIniFile.Create(fn_inf) do
try
s_title:= ReadString('info', 'title', '');
s_type:= ReadString('info', 'type', '');
//s_subdir:= ReadString('info', 'subdir', '');
finally
Free
end;
if (s_title='') or (s_type='') then
begin
MsgBox('Incorrect install.inf in zip', mb_ok or mb_iconerror);
exit
end;
if (s_type<>'lexer') then
begin
MsgBox('Unsupported addon type: '+s_type, mb_ok or mb_iconerror);
exit
end;
if MsgBox('This package contains:'#13#13+
'title: '+s_title+#13+
'type: '+s_type+#13#13+
'Do you want to install it?',
MB_OKCANCEL or MB_ICONQUESTION)<>id_ok then exit;
s_installed:= '';
with TIniFile.Create(fn_inf) do
try
for i_lexer:= 1 to 20 do
begin
s_lexer:= ReadString('lexer'+Inttostr(i_lexer), 'file', '');
if s_lexer='' then Break;
//lexer file
fn_lexer:= ExtractFileDir(fn_inf)+DirectorySeparator+s_lexer+'.lcf';
if not FileExists(fn_lexer) then
begin
MsgBox('Cannot find lexer file: '+fn_lexer, mb_ok or mb_iconerror);
exit
end;
fn_acp:= ExtractFileDir(fn_inf)+DirectorySeparator+s_lexer+'.acp';
if FileExists(fn_acp) then
if dir_acp<>'' then
CopyFile(fn_acp, dir_acp+DirectorySeparator+s_lexer+'.acp');
an:= Manager.FindAnalyzer(s_lexer);
if an=nil then
an:= Manager.AddAnalyzer;
an.LoadFromFile(fn_lexer);
s_installed:= s_installed+s_lexer+#13;
//links
for i_sub:= 0 to an.SubAnalyzers.Count-1 do
begin
s_lexer:= ReadString('lexer'+Inttostr(i_lexer), 'link'+Inttostr(i_sub+1), '');
if s_lexer='' then Continue;
if s_lexer='Style sheets' then s_lexer:= 'CSS';
if s_lexer='Assembler' then s_lexer:= 'Assembly';
an_sub:= Manager.FindAnalyzer(s_lexer);
if an_sub<>nil then
begin
an.SubAnalyzers.Items[i_sub].SyntAnalyzer:= an_sub;
//MsgBox('Linked lexer "'+an.LexerName+'" to "'+s_lexer+'"', mb_ok or MB_ICONINFORMATION);
end
else
begin
MsgBox('Cannot find linked sublexer in library: '+s_lexer, MB_OK or MB_ICONWARNING);
Continue;
end;
end;
end;
finally
Free
end;
Result:= true;
end;
end.

View File

@@ -0,0 +1,30 @@
object fmMain: TfmMain
Left = 428
Height = 231
Top = 408
Width = 454
BorderStyle = bsDialog
Caption = 'Demo'
ClientHeight = 231
ClientWidth = 454
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.5'
object bShow: TButton
Left = 144
Height = 40
Top = 80
Width = 152
Caption = 'Lexer lib dialog'
OnClick = bShowClick
TabOrder = 0
end
object Label1: TLabel
Left = 8
Height = 17
Top = 184
Width = 45
Caption = 'Label1'
ParentColor = False
end
end

View File

@@ -0,0 +1,76 @@
unit unmain;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
LclIntf, LclProc, LclType,
ecSyntAnal,
formlexerlib;
type
{ TfmMain }
TfmMain = class(TForm)
bShow: TButton;
Label1: TLabel;
procedure bShowClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
procedure UpdStatus;
{ private declarations }
public
{ public declarations }
end;
var
fmMain: TfmMain;
implementation
{$R *.lfm}
var
Manager: TecSyntaxManager;
{ TfmMain }
procedure TfmMain.bShowClick(Sender: TObject);
var
dirAcp: string;
begin
dirAcp:= ExtractFileDir(Application.ExeName)+DirectorySeparator+'acp';
CreateDir(dirAcp);
DoShowDialogLexerLib(Manager, dirAcp, 'Courier new', 9);
if Manager.Modified then
begin
UpdStatus;
Manager.Modified:= false;
if Application.MessageBox('Lib was modified. Save file?', 'Demo',
MB_OKCANCEL or MB_ICONQUESTION)=id_ok then
Manager.SaveToFile(Manager.FileName);
end;
end;
procedure TfmMain.FormCreate(Sender: TObject);
var
fn: string;
begin
fn:= ExtractFileDir(Application.ExeName)+DirectorySeparator+
'lexlib'+DirectorySeparator+'small.lxl';
Manager:= TecSyntaxManager.Create(Self);
Manager.LoadFromFile(fn);
UpdStatus;
end;
procedure TfmMain.UpdStatus;
begin
Label1.Caption:= Format('library "%s" has %d lexers',
[Extractfilename(Manager.FileName), Manager.AnalyzerCount]);
end;
end.

View File

@@ -0,0 +1,266 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<AutoCreateForms Value="False"/>
<Title Value="Demo"/>
<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="37">
<Unit0>
<Filename Value="demo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="formmain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fmMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
<Unit2>
<Filename Value="formkey.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fmCmd"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit2>
<Unit3>
<Filename Value="..\..\atsynedit\atstrings_editing.inc"/>
<IsPartOfProject Value="True"/>
</Unit3>
<Unit4>
<Filename Value="..\..\atsynedit\atsynedit_carets.inc"/>
<IsPartOfProject Value="True"/>
</Unit4>
<Unit5>
<Filename Value="..\..\atsynedit\atsynedit_cmd_clipboard.inc"/>
<IsPartOfProject Value="True"/>
</Unit5>
<Unit6>
<Filename Value="..\..\atsynedit\atsynedit_cmd_editing.inc"/>
<IsPartOfProject Value="True"/>
</Unit6>
<Unit7>
<Filename Value="..\..\atsynedit\atsynedit_cmd_handler.inc"/>
<IsPartOfProject Value="True"/>
</Unit7>
<Unit8>
<Filename Value="..\..\atsynedit\atsynedit_cmd_keys.inc"/>
<IsPartOfProject Value="True"/>
</Unit8>
<Unit9>
<Filename Value="..\..\atsynedit\atsynedit_cmd_misc.inc"/>
<IsPartOfProject Value="True"/>
</Unit9>
<Unit10>
<Filename Value="..\..\atsynedit\atsynedit_proc.inc"/>
<IsPartOfProject Value="True"/>
</Unit10>
<Unit11>
<Filename Value="..\..\atsynedit\atsynedit_canvasproc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_CanvasProc"/>
</Unit11>
<Unit12>
<Filename Value="..\..\atsynedit\atsynedit_keymap.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_Keymap"/>
</Unit12>
<Unit13>
<Filename Value="..\..\atsynedit\atstringproc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATStringProc"/>
</Unit13>
<Unit14>
<Filename Value="..\..\atsynedit\atstringproc_wordjump.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATStringProc_WordJump"/>
</Unit14>
<Unit15>
<Filename Value="..\..\atsynedit\atstrings.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATStrings"/>
</Unit15>
<Unit16>
<Filename Value="..\..\atsynedit\atsynedit_carets.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_Carets"/>
</Unit16>
<Unit17>
<Filename Value="..\..\atsynedit\atsynedit.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit"/>
</Unit17>
<Unit18>
<Filename Value="..\..\atsynedit\atsynedit_commands.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_Commands"/>
</Unit18>
<Unit19>
<Filename Value="..\..\atsynedit\atsynedit_keymap_init.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_Keymap_Init"/>
</Unit19>
<Unit20>
<Filename Value="..\..\atsynedit\atsynedit_hilite.inc"/>
<IsPartOfProject Value="True"/>
</Unit20>
<Unit21>
<Filename Value="..\..\atsynedit\atsynedit_sel.inc"/>
<IsPartOfProject Value="True"/>
</Unit21>
<Unit22>
<Filename Value="..\..\atsynedit\atsynedit_gutter.pas"/>
<IsPartOfProject Value="True"/>
</Unit22>
<Unit23>
<Filename Value="formopt.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fmOpt"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit23>
<Unit24>
<Filename Value="..\..\atsynedit\atstrings_load.inc"/>
<IsPartOfProject Value="True"/>
</Unit24>
<Unit25>
<Filename Value="..\..\atsynedit\atstrings_undo.pas"/>
<IsPartOfProject Value="True"/>
</Unit25>
<Unit26>
<Filename Value="..\..\atsynedit\atstrings_save.inc"/>
<IsPartOfProject Value="True"/>
</Unit26>
<Unit27>
<Filename Value="..\..\atsynedit\atsynedit_wrapinfo.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_WrapInfo"/>
</Unit27>
<Unit28>
<Filename Value="..\..\atsynedit\atsynedit_cmd_sel.inc"/>
<IsPartOfProject Value="True"/>
</Unit28>
<Unit29>
<Filename Value="..\..\atsynedit\atsynedit_debug.inc"/>
<IsPartOfProject Value="True"/>
</Unit29>
<Unit30>
<Filename Value="..\..\atsynedit\atsynedit_edits.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_Edits"/>
</Unit30>
<Unit31>
<Filename Value="formcombo.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fmCombo"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit31>
<Unit32>
<Filename Value="..\..\atsynedit\atsynedit_ranges.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_Ranges"/>
</Unit32>
<Unit33>
<Filename Value="..\..\atsynedit\atsynedit_fold.inc"/>
<IsPartOfProject Value="True"/>
</Unit33>
<Unit34>
<Filename Value="..\..\atsynedit\atsynedit_adapters.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_Adapters"/>
</Unit34>
<Unit35>
<Filename Value="formfind.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fmFind"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit35>
<Unit36>
<Filename Value="..\..\atsynedit\atsynedit_export_html.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit_Export_HTML"/>
</Unit36>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="demo"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir);..\..\comp\atsynedit;..\..\atsynedit"/>
<OtherUnitFiles Value="..\..\atsynedit;..\..\proc_lexer"/>
<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="4">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
<Item4>
<Name Value="ERegExpr"/>
</Item4>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,41 @@
program demo;
{$mode objfpc}{$H+}
uses
//heaptrc,
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms,
atsynedit_canvasproc,
atsynedit_keymap,
atstringproc,
atstringproc_wordjump,
atstrings,
atstrings_undo,
atsynedit_carets,
atsynedit,
atsynedit_gutter,
atsynedit_commands,
atsynedit_keymap_init,
atsynedit_wrapinfo,
atsynedit_edits,
atsynedit_ranges, ATSynEdit_Adapters,
formmain,
formkey,
formopt,
formcombo, formfind, atsynedit_export_html;
{$R *.res}
begin
Application.Title:= 'Demo';
RequireDerivedFormResource:= True;
Application.Initialize;
Application.CreateForm(TfmMain, fmMain);
Application.CreateForm(TfmOpt, fmOpt);
Application.Run;
end.

View File

@@ -0,0 +1,21 @@
program demo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, formmain,
ATSynEdit, ATStrings, ATStringProc, ATCanvasProc;
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,58 @@
object fmCombo: TfmCombo
Left = 426
Height = 240
Top = 370
Width = 397
Caption = 'Combo'
ClientHeight = 240
ClientWidth = 397
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.5'
object Panel1: TPanel
Left = 16
Height = 49
Top = 32
Width = 335
BevelOuter = bvNone
ClientHeight = 49
ClientWidth = 335
TabOrder = 0
object Label1: TLabel
Left = 0
Height = 17
Top = 4
Width = 97
Caption = 'ATComboEdit:'
ParentColor = False
end
end
object ButtonPanel1: TButtonPanel
Left = 6
Height = 29
Top = 205
Width = 385
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
HelpButton.DefaultCaption = True
CloseButton.Name = 'CloseButton'
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 1
ShowButtons = [pbClose]
ShowBevel = False
end
object chkEnabled: TCheckBox
Left = 17
Height = 24
Top = 174
Width = 80
Caption = 'Enabled'
Checked = True
OnChange = chkEnabledChange
State = cbChecked
TabOrder = 2
end
end

View File

@@ -0,0 +1,81 @@
unit formcombo;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, ButtonPanel, ATSynEdit_Edits;
type
{ TfmCombo }
TfmCombo = class(TForm)
ButtonPanel1: TButtonPanel;
chkEnabled: TCheckBox;
Label1: TLabel;
Panel1: TPanel;
procedure chkEnabledChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
procedure ComboCommand(Sender: TObject; ACmd: integer; const AText: string; var AHandled: boolean);
{ private declarations }
public
{ public declarations }
ed: TATComboEdit;
end;
var
fmCombo: TfmCombo;
implementation
uses ATSynEdit_Commands;
{$R *.lfm}
{ TfmCombo }
procedure TfmCombo.FormCreate(Sender: TObject);
begin
ed:= TATComboEdit.Create(Self);
ed.Parent:= Panel1;
ed.Align:= alBottom;
ed.OnCommand:= @ComboCommand;
ed.Text:= 'Test';
ed.OptTextHint:= '(empty)';
end;
procedure TfmCombo.chkEnabledChange(Sender: TObject);
begin
ed.Enabled:= chkEnabled.Checked;
end;
procedure TfmCombo.ComboCommand(Sender: TObject; ACmd: integer;
const AText: string; var AHandled: boolean);
var
s: string;
n: integer;
begin
if ACmd=cCommand_KeyEnter then
begin
with ed do
begin
s:= UTF8Encode(Trim(Text));
ShowMessage('Enter: '+s);
Text:= '';
DoCaretSingle(0, 0);
n:= Items.IndexOf(s);
if n>=0 then Items.Delete(n);
Items.Insert(0, s);
end;
AHandled:= true;
end;
end;
end.

View File

@@ -0,0 +1,149 @@
object fmFind: TfmFind
Left = 521
Height = 233
Top = 265
Width = 489
BorderStyle = bsDialog
Caption = 'Find/Replace'
ClientHeight = 233
ClientWidth = 489
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.5'
object bFind: TButton
Left = 376
Height = 25
Top = 48
Width = 99
Caption = 'find'
ModalResult = 1
TabOrder = 9
end
object bCancel: TButton
Left = 376
Height = 25
Top = 144
Width = 99
Cancel = True
Caption = 'cancel'
ModalResult = 2
TabOrder = 14
end
object Label1: TLabel
Left = 9
Height = 17
Top = 8
Width = 66
Caption = 'find what:'
ParentColor = False
end
object edFind: TEdit
Left = 9
Height = 27
Top = 32
Width = 359
TabOrder = 0
end
object chkRegex: TCheckBox
Left = 9
Height = 24
Top = 128
Width = 64
Caption = 'regex'
OnChange = chkRegexChange
TabOrder = 3
end
object chkBack: TCheckBox
Left = 9
Height = 24
Top = 200
Width = 92
Caption = 'backward'
TabOrder = 6
end
object chkCase: TCheckBox
Left = 9
Height = 24
Top = 152
Width = 118
Caption = 'case sensitive'
TabOrder = 4
end
object chkWords: TCheckBox
Left = 9
Height = 24
Top = 176
Width = 142
Caption = 'whole words only'
TabOrder = 5
end
object edRep: TEdit
Left = 9
Height = 27
Top = 88
Width = 359
TabOrder = 2
end
object chkRep: TCheckBox
Left = 9
Height = 24
Top = 64
Width = 112
Caption = 'replace with:'
OnChange = chkRepChange
TabOrder = 1
end
object bRep: TButton
Left = 376
Height = 25
Top = 16
Width = 99
Caption = 'replace'
Default = True
ModalResult = 6
TabOrder = 10
end
object bRepAll: TButton
Left = 376
Height = 25
Top = 48
Width = 99
Caption = 'replace all'
ModalResult = 10
TabOrder = 11
end
object chkFromCaret: TCheckBox
Left = 216
Height = 24
Top = 128
Width = 98
Caption = 'from caret'
TabOrder = 7
end
object bCount: TButton
Left = 376
Height = 25
Top = 80
Width = 99
Caption = 'count all'
ModalResult = 5
TabOrder = 12
end
object chkConfirm: TCheckBox
Left = 216
Height = 24
Top = 152
Width = 131
Caption = 'confirm replace'
TabOrder = 8
end
object bMarkAll: TButton
Left = 376
Height = 25
Top = 112
Width = 99
Caption = 'mark all'
ModalResult = 4
TabOrder = 13
end
end

View File

@@ -0,0 +1,85 @@
unit formfind;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel,
StdCtrls;
type
{ TfmFind }
TfmFind = class(TForm)
bCount: TButton;
bMarkAll: TButton;
bFind: TButton;
bCancel: TButton;
bRep: TButton;
bRepAll: TButton;
chkFromCaret: TCheckBox;
chkConfirm: TCheckBox;
chkRep: TCheckBox;
chkRegex: TCheckBox;
chkBack: TCheckBox;
chkCase: TCheckBox;
chkWords: TCheckBox;
edFind: TEdit;
edRep: TEdit;
Label1: TLabel;
procedure chkRegexChange(Sender: TObject);
procedure chkRepChange(Sender: TObject);
procedure FormShow(Sender: TObject);
private
procedure Update;
{ private declarations }
public
{ public declarations }
end;
var
fmFind: TfmFind;
implementation
{$R *.lfm}
{ TfmFind }
procedure TfmFind.chkRegexChange(Sender: TObject);
begin
Update;
end;
procedure TfmFind.chkRepChange(Sender: TObject);
begin
Update;
end;
procedure TfmFind.FormShow(Sender: TObject);
begin
Update;
end;
procedure TfmFInd.Update;
var
rep: boolean;
begin
rep:= chkRep.Checked;
chkWords.Enabled:= not chkRegex.Checked;
chkBack.Enabled:= not chkRegex.Checked;
chkConfirm.Enabled:= rep;
edRep.Enabled:= rep;
bFind.Visible:= not rep;
bRep.Visible:= rep;
bRepAll.Visible:= rep;
if rep then Caption:= 'Replace' else Caption:= 'Find';
if rep then bRep.Default:= true else bFind.Default:= true;
end;
end.

View File

@@ -0,0 +1,59 @@
object fmCmd: TfmCmd
Left = 425
Height = 620
Top = 120
Width = 679
ActiveControl = List
Caption = 'Commands'
ClientHeight = 620
ClientWidth = 679
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.5'
object List: TListView
Left = 6
Height = 573
Top = 6
Width = 667
Align = alClient
AutoSort = False
BorderSpacing.Around = 6
Columns = <
item
Caption = 'name'
Width = 350
end
item
Caption = 'key1'
Width = 150
end
item
Caption = 'key2'
Width = 150
end>
ColumnClick = False
ReadOnly = True
RowSelect = True
TabOrder = 0
ViewStyle = vsReport
OnDblClick = ListDblClick
end
object ButtonPanel1: TButtonPanel
Left = 6
Height = 29
Top = 585
Width = 667
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
HelpButton.DefaultCaption = True
CloseButton.Name = 'CloseButton'
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 1
ShowButtons = [pbOK, pbCancel]
ShowGlyphs = []
ShowBevel = False
end
end

View File

@@ -0,0 +1,78 @@
unit formkey;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, comctrls,
ButtonPanel, ATSynedit;
type
{ TfmCmd }
TfmCmd = class(TForm)
ButtonPanel1: TButtonPanel;
List: TListView;
procedure FormShow(Sender: TObject);
procedure ListDblClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
edit: TATSynEdit;
end;
var
fmCmd: TfmCmd;
function DoCommandDialog(AEdit: TATSynEdit): integer;
implementation
uses
Menus, LCLProc;
{$R *.lfm}
function DoCommandDialog(AEdit: TATSynEdit): integer;
begin
Result:= 0;
with TfmCmd.Create(nil) do
try
edit:= AEdit;
if ShowModal=mrOk then
if List.Selected<>nil then
Result:= StrToIntDef(List.Selected.SubItems[2], 0);
finally
Free
end;
end;
{ TfmCmd }
procedure TfmCmd.FormShow(Sender: TObject);
var
i: integer;
begin
for i:= 0 to edit.Keymap.Count-1 do
with edit.Keymap.Items[i] do
with List.Items.Add do
begin
Caption:= Name;
SubItems.Add(ShortCutToText(Keys1[0]));
SubItems.Add(ShortCutToText(Keys2[0]));
SubItems.Add(Inttostr(Command));
end;
if List.Items.Count>0 then
List.Selected:= List.Items[0];
end;
procedure TfmCmd.ListDblClick(Sender: TObject);
begin
//ModalResult:= mrOk;
end;
end.

View File

@@ -0,0 +1,73 @@
object fmKeyOpt: TfmKeyOpt
Left = 464
Height = 160
Top = 241
Width = 291
BorderStyle = bsDialog
Caption = 'Hotkey'
ClientHeight = 160
ClientWidth = 291
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.4.0.2'
object ButtonPanel1: TButtonPanel
Left = 6
Height = 33
Top = 121
Width = 279
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
HelpButton.DefaultCaption = True
CloseButton.Name = 'CloseButton'
CloseButton.Caption = 'Clear key'
CloseButton.DefaultCaption = False
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 5
ShowButtons = [pbOK, pbCancel, pbClose]
ShowGlyphs = []
end
object chkCtrl: TCheckBox
Left = 24
Height = 19
Top = 16
Width = 39
Caption = 'Ctrl'
TabOrder = 0
end
object chkAlt: TCheckBox
Left = 24
Height = 19
Top = 40
Width = 35
Caption = 'Alt'
TabOrder = 1
end
object chkShift: TCheckBox
Left = 24
Height = 19
Top = 64
Width = 44
Caption = 'Shift'
TabOrder = 2
end
object chkMeta: TCheckBox
Left = 24
Height = 19
Top = 88
Width = 47
Caption = 'Meta'
TabOrder = 3
end
object ed: TComboBox
Left = 112
Height = 23
Top = 48
Width = 112
DropDownCount = 30
ItemHeight = 15
Style = csDropDownList
TabOrder = 4
end
end

View File

@@ -0,0 +1,129 @@
unit formkeyoption;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel,
StdCtrls;
type
{ TfmKeyOpt }
TfmKeyOpt = class(TForm)
ButtonPanel1: TButtonPanel;
chkCtrl: TCheckBox;
chkAlt: TCheckBox;
chkShift: TCheckBox;
chkMeta: TCheckBox;
ed: TComboBox;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
function DoDialogHotkey(S: string): string;
implementation
{$R *.lfm}
function DoDialogHotkey(S: string): string;
var
n: integer;
begin
Result:= S;
with TfmKeyOpt.Create(nil) do
try
chkCtrl.Checked:= Pos('Ctrl+', S)>0;
chkAlt.Checked:= Pos('Alt+', S)>0;
chkShift.Checked:= Pos('Shift+', S)>0;
chkMeta.Checked:= Pos('Meta+', S)>0;
repeat
n:= Pos('+', S);
if n=0 then Break;
Delete(S, 1, n);
until false;
ed.ItemIndex:= ed.Items.IndexOf(S);
if ed.ItemIndex<0 then
ed.ItemIndex:= 0;
case ShowModal of
mrOk:
begin
Result:= ed.Text;
if chkMeta.Checked then Result:= 'Meta+'+Result;
if chkShift.Checked then Result:= 'Shift+'+Result;
if chkAlt.Checked then Result:= 'Alt+'+Result;
if chkCtrl.Checked then Result:= 'Ctrl+'+Result;
end;
mrClose:
Result:= '';
end;
finally
Free;
end;
end;
{ TfmKeyOpt }
procedure TfmKeyOpt.FormCreate(Sender: TObject);
var
i: integer;
begin
for i:= Ord('A') to Ord('Z') do
ed.Items.Add(Chr(i));
for i:= 0 to 9 do
ed.Items.Add(Inttostr(i));
for i:= 1 to 12 do
ed.Items.Add('F'+Inttostr(i));
ed.Items.Add('Left');
ed.Items.Add('Right');
ed.Items.Add('Up');
ed.Items.Add('Down');
ed.Items.Add('Ins');
ed.Items.Add('Del');
ed.Items.Add('Home');
ed.Items.Add('End');
ed.Items.Add('PgUp');
ed.Items.Add('PgDn');
ed.Items.Add('Enter');
ed.Items.Add('BkSp');
ed.Items.Add('Tab');
ed.Items.Add('Esc');
ed.Items.Add('-');
ed.Items.Add('=');
ed.Items.Add('`');
ed.Items.Add(',');
ed.Items.Add('.');
ed.Items.Add(';');
ed.Items.Add('''');
ed.Items.Add('\');
ed.Items.Add('/');
ed.Items.Add('[');
ed.Items.Add(']');
for i:= 0 to 9 do
ed.Items.Add('Num'+Inttostr(i));
ed.Items.Add('NumPlus');
ed.Items.Add('NumMinus');
ed.Items.Add('NumMul');
ed.Items.Add('NumDiv');
ed.Items.Add('NumDot');
ed.Items.Add('NumClear');
ed.Items.Add('NumLock');
ed.Items.Add('ScrollLock');
ed.Items.Add('CapsLock');
ed.Items.Add('Break');
ed.Items.Add('PopUp');
end;
end.

View File

@@ -0,0 +1,556 @@
object fmMain: TfmMain
Left = 266
Height = 498
Top = 242
Width = 953
Caption = 'Demo'
ClientHeight = 498
ClientWidth = 953
Menu = MainMenu1
OnCreate = FormCreate
OnDestroy = FormDestroy
OnResize = FormResize
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.5'
object PanelMain: TPanel
Left = 0
Height = 498
Top = 0
Width = 672
Align = alClient
BevelOuter = bvNone
ClientHeight = 498
ClientWidth = 672
TabOrder = 0
object Status: TStatusBar
Left = 0
Height = 21
Top = 477
Width = 672
Panels = <>
end
object StatusMsg: TStatusBar
Left = 0
Height = 21
Top = 456
Width = 672
Font.Color = clBlue
Panels = <>
ParentFont = False
end
object progress: TProgressBar
AnchorSideLeft.Control = PanelMain
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = StatusMsg
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = StatusMsg
AnchorSideBottom.Side = asrCenter
Left = 507
Height = 14
Top = 459
Width = 160
Anchors = [akRight, akBottom]
BorderSpacing.Right = 5
Smooth = True
Step = 1
TabOrder = 2
Visible = False
end
object btnStop: TButton
AnchorSideRight.Control = progress
AnchorSideBottom.Control = StatusMsg
AnchorSideBottom.Side = asrCenter
Left = 412
Height = 22
Top = 455
Width = 90
Anchors = [akRight, akBottom]
BorderSpacing.Right = 5
Caption = 'stop'
OnClick = btnStopClick
TabOrder = 3
Visible = False
end
end
object PanelRt: TPanel
Left = 672
Height = 498
Top = 0
Width = 281
Align = alRight
BevelOuter = bvNone
ClientHeight = 498
ClientWidth = 281
TabOrder = 1
object chkGutter: TCheckBox
Left = 8
Height = 24
Top = 8
Width = 68
Caption = 'gutter'
OnChange = chkGutterChange
TabOrder = 0
end
object chkRuler: TCheckBox
Left = 8
Height = 24
Top = 28
Width = 58
Caption = 'ruler'
OnChange = chkRulerChange
TabOrder = 1
end
object chkMinimap: TCheckBox
Left = 8
Height = 24
Top = 48
Width = 85
Caption = 'minimap'
OnChange = chkMinimapChange
TabOrder = 2
end
object edSpaceX: TSpinEdit
Left = 8
Height = 27
Top = 240
Width = 52
MaxValue = 10
MinValue = -5
OnChange = edSpaceXChange
TabOrder = 8
end
object Label1: TLabel
Left = 67
Height = 17
Top = 244
Width = 63
Caption = 'spacing-x'
ParentColor = False
end
object Label2: TLabel
Left = 67
Height = 17
Top = 308
Width = 47
Caption = 'margin'
ParentColor = False
end
object edMarRt: TSpinEdit
Left = 8
Height = 27
Top = 304
Width = 52
MaxValue = 200
MinValue = 20
OnChange = edMarRtChange
TabOrder = 10
Value = 20
end
object gWrap: TGroupBox
Left = 144
Height = 104
Top = 4
Width = 128
Caption = 'wrap'
ClientHeight = 85
ClientWidth = 124
TabOrder = 11
object chkWrapOff: TRadioButton
Left = 8
Height = 24
Top = 0
Width = 46
Caption = 'off'
Checked = True
OnChange = chkWrapOffChange
TabOrder = 0
TabStop = True
end
object chkWrapOn: TRadioButton
Left = 8
Height = 24
Top = 20
Width = 76
Caption = 'at edge'
OnChange = chkWrapOnChange
TabOrder = 1
end
object chkWrapMargin: TRadioButton
Left = 8
Height = 24
Top = 40
Width = 90
Caption = 'at margin'
OnChange = chkWrapMarginChange
TabOrder = 2
end
object chkWrapIndent: TCheckBox
Left = 8
Height = 24
Top = 60
Width = 101
Caption = 'with indent'
OnChange = chkWrapIndentChange
TabOrder = 3
end
end
object edFontsize: TSpinEdit
Left = 8
Height = 27
Top = 176
Width = 52
MaxValue = 40
MinValue = 4
OnChange = edFontsizeChange
TabOrder = 6
Value = 10
end
object Label4: TLabel
Left = 67
Height = 17
Top = 180
Width = 58
Caption = 'font size'
ParentColor = False
end
object gUnpri: TGroupBox
Left = 144
Height = 104
Top = 108
Width = 128
Caption = 'unprintable'
ClientHeight = 85
ClientWidth = 124
TabOrder = 12
object chkUnprintVis: TCheckBox
Left = 8
Height = 24
Top = 1
Width = 61
Caption = 'show'
OnChange = chkUnprintVisChange
TabOrder = 0
end
object chkUnprintSp: TCheckBox
Left = 8
Height = 24
Top = 20
Width = 72
Caption = 'spaces'
OnChange = chkUnprintSpChange
TabOrder = 1
end
object chkUnprintEnd: TCheckBox
Left = 8
Height = 24
Top = 40
Width = 58
Caption = 'ends'
OnChange = chkUnprintEndChange
TabOrder = 2
end
object chkUnprintEndDet: TCheckBox
Left = 8
Height = 24
Top = 60
Width = 101
Caption = 'end-details'
OnChange = chkUnprintEndDetChange
TabOrder = 3
end
end
object edTabsize: TSpinEdit
Left = 8
Height = 27
Top = 208
Width = 52
MaxValue = 12
MinValue = 1
OnChange = edTabsizeChange
TabOrder = 7
Value = 8
end
object Label5: TLabel
Left = 67
Height = 17
Top = 212
Width = 52
Caption = 'tab size'
ParentColor = False
end
object bFont: TButton
Left = 8
Height = 25
Top = 92
Width = 81
Caption = 'font...'
OnClick = bFontClick
TabOrder = 4
end
object chkMicromap: TCheckBox
Left = 8
Height = 24
Top = 68
Width = 95
Caption = 'micromap'
OnChange = chkMicromapChange
TabOrder = 3
end
object edSpaceY: TSpinEdit
Left = 8
Height = 27
Top = 272
Width = 52
MaxValue = 10
MinValue = -5
OnChange = edSpaceYChange
TabOrder = 9
end
object Label6: TLabel
Left = 67
Height = 17
Top = 276
Width = 62
Caption = 'spacing-y'
ParentColor = False
end
object bOpt: TButton
Left = 8
Height = 25
Top = 120
Width = 81
Caption = 'opts...'
OnClick = bOptClick
TabOrder = 5
end
object Memo1: TMemo
Left = 14
Height = 151
Top = 336
Width = 162
ScrollBars = ssBoth
TabOrder = 13
Visible = False
end
object btnMarker: TButton
Left = 144
Height = 25
Top = 224
Width = 96
Caption = 'marker'
OnClick = btnMarkerClick
TabOrder = 14
end
end
object OpenDialog1: TOpenDialog
Options = [ofFileMustExist, ofEnableSizing]
left = 472
top = 20
end
object FontDialog1: TFontDialog
Title = 'Font'
MinFontSize = 0
MaxFontSize = 0
left = 536
top = 20
end
object SaveDialog1: TSaveDialog
Options = [ofOverwritePrompt, ofEnableSizing, ofViewDetail]
left = 504
top = 20
end
object MainMenu1: TMainMenu
left = 432
top = 80
object mnuFile: TMenuItem
Caption = 'File'
object mnuFileOpen: TMenuItem
Caption = 'Open..'
ShortCut = 16463
OnClick = mnuFileOpenClick
end
object mnuFileSav: TMenuItem
Caption = 'Save..'
OnClick = mnuFileSaveClick
end
object mnuFileEnd: TMenuItem
Caption = 'Set ends'
object mnuEndWin: TMenuItem
Caption = 'win'
OnClick = mnuEndWinClick
end
object mnuEndUnix: TMenuItem
Caption = 'unix'
OnClick = mnuEndUnixClick
end
object mnuEndMac: TMenuItem
Caption = 'mac'
OnClick = mnuEndMacClick
end
end
object mnuFileHtml: TMenuItem
Caption = 'Export HTML'
OnClick = mnuFileHtmlClick
end
end
object MenuItem9: TMenuItem
Caption = 'Search'
object mnuFind: TMenuItem
Caption = 'find...'
ShortCut = 16454
OnClick = mnuFindClick
end
object mnuFindNext: TMenuItem
Caption = 'find next'
ShortCut = 114
OnClick = mnuFindNextClick
end
object mnuGoto: TMenuItem
Caption = 'go to..'
ShortCut = 16455
OnClick = bGotoClick
end
end
object mnuEnc: TMenuItem
Caption = 'Encoding'
end
object mnuTst: TMenuItem
Caption = 'Test'
object mnuTCaret1: TMenuItem
Caption = 'set 100 cr''s'
OnClick = mnuTCaret1Click
end
object mnuTCaretK: TMenuItem
Caption = 'set 2000 cr''s'
OnClick = bAddCrtClick
end
object mnuTMargin: TMenuItem
Caption = 'set margins..'
OnClick = mnuTMarginClick
end
object mnuTBms: TMenuItem
Caption = 'toggle bookm'
OnClick = mnuTBmsClick
end
object MenuItem5: TMenuItem
Caption = '-'
end
object mnuSyntax: TMenuItem
Caption = 'hilite syntax'
ShortCut = 16467
OnClick = mnuSyntaxClick
end
object mnuUnderline: TMenuItem
Caption = 'underline ''www'''
OnClick = mnuUnderlineClick
end
object MenuItem1: TMenuItem
Caption = '-'
end
object mnuPane: TMenuItem
Caption = 'show pane'
Checked = True
OnClick = mnuPaneClick
end
object mnuOneLine: TMenuItem
Caption = 'combo..'
OnClick = mnuOneLineClick
end
end
object mnuOpts: TMenuItem
Caption = 'Options'
object mnuOptDlg: TMenuItem
Caption = 'options..'
ShortCut = 120
OnClick = bOptClick
end
object mnuOptSave: TMenuItem
Caption = 'save'
Visible = False
OnClick = btnSaveClick
end
object mnuOptLoad: TMenuItem
Caption = 'load'
Visible = False
OnClick = btnLoadClick
end
end
object mnuHlp: TMenuItem
Caption = 'Help'
object mnuHelpKey: TMenuItem
Caption = 'commands..'
ShortCut = 112
OnClick = bKeymapClick
end
object MenuItem2: TMenuItem
Caption = '-'
end
object mnuHelpMous: TMenuItem
Caption = 'mouse help..'
OnClick = mnuHelpMousClick
end
end
end
object PopupBookmk: TPopupMenu
left = 480
top = 104
object mnuBms: TMenuItem
Caption = 'toggle all bm''s'
OnClick = mnuBmsClick
end
end
object PopupNums: TPopupMenu
left = 523
top = 128
object MenuItem3: TMenuItem
Caption = 'test nums'
Enabled = False
end
end
object PopupFold: TPopupMenu
left = 568
top = 152
object MenuItem4: TMenuItem
Caption = 'test fold'
Enabled = False
end
end
object PopupMinimap: TPopupMenu
left = 448
top = 192
object MenuItem6: TMenuItem
Caption = 'minimap'
Enabled = False
end
end
object PopupMicromap: TPopupMenu
left = 496
top = 216
object MenuItem7: TMenuItem
Caption = 'micromap'
Enabled = False
end
end
object PopupRuler: TPopupMenu
left = 552
top = 240
object MenuItem8: TMenuItem
Caption = 'ruler'
Enabled = False
end
end
object TimerHint: TTimer
Enabled = False
Interval = 5500
OnTimer = TimerHintTimer
left = 560
top = 303
end
object ApplicationProperties1: TApplicationProperties
ShowButtonGlyphs = sbgNever
ShowMenuGlyphs = sbgNever
left = 548
top = 366
end
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,474 @@
unit formopt;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ButtonPanel, Spin, ComCtrls, ATSynEdit, ATSynEdit_CanvasProc;
type
{ TfmOpt }
TfmOpt = class(TForm)
bColDown: TButton;
bColUp: TButton;
ButtonPanel1: TButtonPanel;
chkCrBlinkEn: TCheckBox;
chkMsNormalSel: TCheckBox;
chkMsColumnSel: TCheckBox;
chkUnprintArrowDown: TCheckBox;
chkShowFullHilite: TCheckBox;
chkMsHideCursor: TCheckBox;
chkLeftRtSwapAndSel: TCheckBox;
chkGutterSep: TCheckBox;
chkGutterNumAuto: TCheckBox;
chkGutterBm: TCheckBox;
chkGutterEmpty: TCheckBox;
chkGutterFold: TCheckBox;
chkGutterNum: TCheckBox;
chkGutterStat: TCheckBox;
chkShowFoldLinesAll: TCheckBox;
chkBackspUnindent: TCheckBox;
chkEnterIndent: TCheckBox;
chkMsMenuDown: TCheckBox;
chkTabIndent: TCheckBox;
chkUnindentKeepAlign: TCheckBox;
chkUnprintAsciiRep: TCheckBox;
chkShowFoldLines: TCheckBox;
chkShowFoldAlways: TCheckBox;
chkCrPreferLeft: TCheckBox;
chkKeepCol: TCheckBox;
chkCurLineMin: TCheckBox;
chkScrollHint: TCheckBox;
chkPageKeepRel: TCheckBox;
chkNavHomeEnd: TCheckBox;
chkMsNiceScroll: TCheckBox;
chkSaveEol: TCheckBox;
chkSaveTrim: TCheckBox;
chkShowNum1st: TCheckBox;
chkShowNumCr: TCheckBox;
chkMapSelBorder: TCheckBox;
chkMapSelAlways: TCheckBox;
chkShowNumBg: TCheckBox;
chkTabSpaces: TCheckBox;
chkUndoSv: TCheckBox;
chkUndoGr: TCheckBox;
chkCutNoSel: TCheckBox;
chkDotLn: TCheckBox;
chkMsClickNumSel: TCheckBox;
chkCrStopUnfocus: TCheckBox;
chkEndNonspace: TCheckBox;
chkHomeNonspace: TCheckBox;
chkLeftRtSwap: TCheckBox;
chkNavUpDown: TCheckBox;
chkOvrSel: TCheckBox;
chkMsRtClickMove: TCheckBox;
chkMsDragDrop: TCheckBox;
chkCrMul: TCheckBox;
chkCrVirt: TCheckBox;
chkMsClick2: TCheckBox;
chkMsClick2Drag: TCheckBox;
chkMsClick3: TCheckBox;
chkShowFullSel: TCheckBox;
chkCopyNoSel: TCheckBox;
chkCurCol: TCheckBox;
chkCurLine: TCheckBox;
chkLastOnTop: TCheckBox;
chkOvrPaste: TCheckBox;
chkUnprintEnd: TCheckBox;
chkUnprintEndDet: TCheckBox;
chkUnprintSpace: TCheckBox;
chkUnprintEn: TCheckBox;
edMapCharWidth: TSpinEdit;
edNumAlign: TComboBox;
edIndentKind: TComboBox;
edCrShape: TComboBox;
edCrShape2: TComboBox;
edCrTime: TSpinEdit;
edSizeSep: TSpinEdit;
edWordChars: TEdit;
edIndentSize: TSpinEdit;
edPlusSize: TSpinEdit;
edNumChar: TEdit;
edNumStyle: TComboBox;
edPageSize: TComboBox;
edRulerFSize: TSpinEdit;
edRulerIndent: TSpinEdit;
edRulerSize: TSpinEdit;
edSizeBm: TSpinEdit;
edSizeEmpty: TSpinEdit;
edSizeFold: TSpinEdit;
edSizeNum1: TSpinEdit;
edSizeNum2: TSpinEdit;
edSizeNum: TSpinEdit;
edSizeState: TSpinEdit;
edTabArrowSize: TSpinEdit;
edTabArrowPnt: TSpinEdit;
edTextHint: TEdit;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
groupIndent: TGroupBox;
LabChars: TLabel;
Label1: TLabel;
Label10: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label2: TLabel;
Label20: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
LabelArr: TLabel;
LabelArr1: TLabel;
LabelHint: TLabel;
ListCol: TListBox;
ListShapes: TListBox;
PageControl1: TPageControl;
edUndo: TSpinEdit;
edNumSize: TSpinEdit;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
TabSheet6: TTabSheet;
TabSheet7: TTabSheet;
TabSheet8: TTabSheet;
TabSheet9: TTabSheet;
procedure bColDownClick(Sender: TObject);
procedure bColUpClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
procedure InitShape(ed: TCombobox);
end;
var
fmOpt: TfmOpt;
procedure DoConfigEditor(ed: TATSynEdit);
implementation
{$R *.lfm}
const
nameBm = 'bookmk';
nameNums = 'nums';
nameState = 'states';
nameFold = 'fold';
nameSep = 'separator';
procedure DoConfigEditor(ed: TATSynEdit);
var
i: integer;
begin
with fmOpt do
begin
with ListCol do
begin
Items.Clear;
for i:= 0 to 4 do
begin
if i=ed.GutterBandBm then Items.Add(nameBm);
if i=ed.GutterBandNum then Items.Add(nameNums);
if i=ed.GutterBandState then Items.Add(nameState);
if i=ed.GutterBandFold then Items.Add(nameFold);
if i=ed.GutterBandSep then Items.Add(nameSep);
end;
ItemIndex:= 0;
end;
//general
chkCurLine.Checked:= ed.OptShowCurLine;
chkCurLineMin.Checked:= ed.OptShowCurLineMinimal;
chkCurCol.Checked:= ed.OptShowCurColumn;
chkLastOnTop.Checked:= ed.OptLastLineOnTop;
chkShowFullSel.Checked:= ed.OptShowFullSel;
chkShowFullHilite.Checked:= ed.OptShowFullHilite;
chkCopyNoSel.Checked:= ed.OptCopyLinesIfNoSel;
chkCutNoSel.Checked:= ed.OptCutLinesIfNoSel;
chkOvrPaste.Checked:= ed.OptOverwriteAllowedOnPaste;
chkDotLn.Checked:= ed.OptShowIndentLines;
edTextHint.Text:= ed.OptTextHint;
edWordChars.Text:= ed.OptWordChars;
chkSaveEol.Checked:= ed.OptSavingForceFinalEol;
chkSaveTrim.Checked:= ed.OptSavingTrimSpaces;
chkScrollHint.Checked:= ed.OptShowScrollHint;
//unprint
chkUnprintEn.Checked:= ed.OptUnprintedVisible;
chkUnprintSpace.Checked:= ed.OptUnprintedSpaces;
chkUnprintEnd.Checked:= ed.OptUnprintedEnds;
chkUnprintEndDet.Checked:= ed.OptUnprintedEndsDetails;
chkUnprintArrowDown.Checked:= OptUnprintedEndArrowOrDot;
chkUnprintAsciiRep.Checked:= ed.OptUnprintedReplaceSpec;
edTabArrowSize.Value:= OptUnprintedTabCharLength;
edTabArrowPnt.Value:= OptUnprintedTabPointerScale;
//caret
chkCrBlinkEn.Checked:= ed.OptCaretBlinkEnabled;
edCrTime.Value:= ed.OptCaretBlinkTime;
chkCrVirt.Checked:= ed.OptCaretVirtual;
chkCrMul.Checked:= ed.OptCaretManyAllowed;
chkCrStopUnfocus.Checked:= ed.OptCaretStopUnfocused;
chkCrPreferLeft.Checked:= ed.OptCaretPreferLeftSide;
edCrShape.ItemIndex:= Ord(ed.OptCaretShape);
edCrShape2.ItemIndex:= Ord(ed.OptCaretShapeOvr);
//gutter
edNumStyle.ItemIndex:= Ord(ed.OptNumbersStyle);
edNumAlign.ItemIndex:= Ord(ed.OptNumbersAlignment);
edNumSize.Value:= ed.OptNumbersFontSize;
edNumChar.Text:= ed.OptNumbersSkippedChar;
edPlusSize.Value:= ed.OptGutterPlusSize;
chkShowNum1st.Checked:= ed.OptNumbersShowFirst;
chkShowNumCr.Checked:= ed.OptNumbersShowCarets;
chkShowNumBg.Checked:= ed.OptShowGutterCaretBG;
chkShowFoldAlways.Checked:= ed.OptGutterShowFoldAlways;
chkShowFoldLines.Checked:= ed.OptGutterShowFoldLines;
chkShowFoldLinesAll.Checked:= ed.OptGutterShowFoldLinesAll;
edRulerSize.Value:= ed.OptRulerSize;
edRulerFSize.Value:= ed.OptRulerFontSize;
edRulerIndent.Value:= ed.OptRulerTextIndent;
chkGutterBm.Checked:= ed.Gutter[ed.GutterBandBm].Visible;
chkGutterNum.Checked:= ed.Gutter[ed.GutterBandNum].Visible;
chkGutterFold.Checked:= ed.Gutter[ed.GutterBandFold].Visible;
chkGutterStat.Checked:= ed.Gutter[ed.GutterBandState].Visible;
chkGutterSep.Checked:= ed.Gutter[ed.GutterBandSep].Visible;
chkGutterEmpty.Checked:= ed.Gutter[ed.GutterBandEmpty].Visible;
edSizeBm.Value:= ed.Gutter[ed.GutterBandBm].Size;
edSizeFold.Value:= ed.Gutter[ed.GutterBandFold].Size;
edSizeState.Value:= ed.Gutter[ed.GutterBandState].Size;
edSizeSep.Value:= ed.Gutter[ed.GutterBandSep].Size;
edSizeEmpty.Value:= ed.Gutter[ed.GutterBandEmpty].Size;
edSizeNum.Value:= ed.Gutter[ed.GutterBandNum].Size;
edSizeNum1.Value:= ed.OptNumbersIndentLeft;
edSizeNum2.Value:= ed.OptNumbersIndentRight;
chkGutterNumAuto.Checked:= ed.OptNumbersAutosize;
//minimap
edMapCharWidth.Value:= ed.OptMinimapCharWidth;
chkMapSelBorder.Checked:= ed.OptMinimapShowSelBorder;
chkMapSelAlways.Checked:= ed.OptMinimapShowSelAlways;
//key
chkTabSpaces.Checked:= ed.OptTabSpaces;
chkOvrSel.Checked:= ed.OptOverwriteSel;
chkNavUpDown.Checked:= ed.OptKeyUpDownNavigateWrapped;
chkNavHomeEnd.Checked:= ed.OptKeyHomeEndNavigateWrapped;
chkKeepCol.Checked:= ed.OptKeyUpDownKeepColumn;
chkLeftRtSwap.Checked:= ed.OptKeyLeftRightSwapSel;
chkLeftRtSwapAndSel.Checked:= ed.OptKeyLeftRightSwapSelAndSelect;
chkHomeNonspace.Checked:= ed.OptKeyHomeToNonSpace;
chkEndNonspace.Checked:= ed.OptKeyEndToNonSpace;
chkTabIndent.Checked:= ed.OptKeyTabIndents;
chkEnterIndent.Checked:= ed.OptAutoIndent;
chkBackspUnindent.Checked:= ed.OptKeyBackspaceUnindent;
edIndentKind.ItemIndex:= Ord(ed.OptAutoIndentKind);
edIndentSize.Value:= ed.OptIndentSize;
chkUnindentKeepAlign.Checked:= ed.OptIndentKeepsAlign;
edPageSize.ItemIndex:= Ord(ed.OptKeyPageUpDownSize);
chkPageKeepRel.Checked:= ed.OptKeyPageKeepsRelativePos;
//mouse
chkMsNormalSel.Checked:= ed.OptMouseEnableNormalSelection;
chkMsColumnSel.Checked:= ed.OptMouseEnableColumnSelection;
chkMsClick2.Checked:= ed.OptMouse2ClickSelectsLine;
chkMsClick3.Checked:= ed.OptMouse3ClickSelectsLine;
chkMsClick2Drag.Checked:= ed.OptMouse2ClickDragSelectsWords;
chkMsClickNumSel.Checked:= ed.OptMouseGutterClickSelectsLine;
chkMsDragDrop.Checked:= ed.OptMouseDragDrop;
chkMsRtClickMove.Checked:= ed.OptMouseRightClickMovesCaret;
chkMsNiceScroll.Checked:= ed.OptMouseNiceScroll;
chkMsHideCursor.Checked:= ed.OptMouseHideCursorOnType;
chkMsMenuDown.Checked:= ed.OptMouseDownForPopup;
//undo
edUndo.Value:= ed.OptUndoLimit;
chkUndoGr.Checked:= ed.OptUndoGrouped;
chkUndoSv.Checked:= ed.OptUndoAfterSave;
if ShowModal=mrOk then
begin
ed.GutterBandBm:= ListCol.Items.IndexOf(nameBm);
ed.GutterBandNum:= ListCol.Items.IndexOf(nameNums);
ed.GutterBandState:= ListCol.Items.IndexOf(nameState);
ed.GutterBandFold:= ListCol.Items.IndexOf(nameFold);
ed.GutterBandSep:= ListCol.Items.IndexOf(nameSep);
//general
ed.OptShowCurLine:= chkCurLine.Checked;
ed.OptShowCurLineMinimal:= chkCurLineMin.Checked;
ed.OptShowCurColumn:= chkCurCol.Checked;
ed.OptTextHint:= edTextHint.Text;
ed.OptWordChars:= edWordChars.Text;
ed.OptOverwriteAllowedOnPaste:= chkOvrPaste.Checked;
ed.OptCopyLinesIfNoSel:= chkCopyNoSel.Checked;
ed.OptCutLinesIfNoSel:= chkCutNoSel.Checked;
ed.OptShowFullSel:= chkShowFullSel.Checked;
ed.OptShowFullHilite:= chkShowFullHilite.Checked;
ed.OptLastLineOnTop:= chkLastOnTop.Checked;
ed.OptShowIndentLines:= chkDotLn.Checked;
ed.OptSavingForceFinalEol:= chkSaveEol.Checked;
ed.OptSavingTrimSpaces:= chkSaveTrim.Checked;
ed.OptShowScrollHint:= chkScrollHint.Checked;
//unprint
ed.OptUnprintedVisible:= chkUnprintEn.Checked;
ed.OptUnprintedSpaces:= chkUnprintSpace.Checked;
ed.OptUnprintedEnds:= chkUnprintEnd.Checked;
ed.OptUnprintedEndsDetails:= chkUnprintEndDet.Checked;
ed.OptUnprintedReplaceSpec:= chkUnprintAsciiRep.Checked;
OptUnprintedTabCharLength:= edTabArrowSize.Value;
OptUnprintedTabPointerScale:= edTabArrowPnt.Value;
OptUnprintedEndArrowOrDot:= chkUnprintArrowDown.Checked;
//caret
ed.OptCaretBlinkEnabled:= chkCrBlinkEn.Checked;
ed.OptCaretBlinkTime:= edCrTime.Value;
ed.OptCaretShape:= TATSynCaretShape(edCrShape.ItemIndex);
ed.OptCaretShapeOvr:= TATSynCaretShape(edCrShape2.ItemIndex);
ed.OptCaretVirtual:= chkCrVirt.Checked;
ed.OptCaretManyAllowed:= chkCrMul.Checked;
ed.OptCaretStopUnfocused:= chkCrStopUnfocus.Checked;
ed.OptCaretPreferLeftSide:= chkCrPreferLeft.Checked;
//gutter
ed.OptNumbersFontSize:= edNumSize.Value;
ed.OptNumbersStyle:= TATSynNumbersStyle(edNumStyle.ItemIndex);
ed.OptNumbersAlignment:= TAlignment(edNumAlign.ItemIndex);
ed.OptNumbersShowFirst:= chkShowNum1st.Checked;
ed.OptNumbersShowCarets:= chkShowNumCr.Checked;
ed.OptNumbersSkippedChar:= edNumChar.Text;
ed.OptGutterShowFoldAlways:= chkShowFoldAlways.Checked;
ed.OptGutterShowFoldLines:= chkShowFoldLines.Checked;
ed.OptGutterShowFoldLinesAll:= chkShowFoldLinesAll.Checked;
ed.OptGutterPlusSize:= edPlusSize.Value;
ed.OptShowGutterCaretBG:= chkShowNumBg.Checked;
ed.OptRulerSize:= edRulerSize.Value;
ed.OptRulerFontSize:= edRulerFSize.Value;
ed.OptRulerTextIndent:= edRulerIndent.Value;
ed.Gutter[ed.GutterBandBm].Visible:= chkGutterBm.Checked;
ed.Gutter[ed.GutterBandNum].Visible:= chkGutterNum.Checked;
ed.Gutter[ed.GutterBandFold].Visible:= chkGutterFold.Checked;
ed.Gutter[ed.GutterBandState].Visible:= chkGutterStat.Checked;
ed.Gutter[ed.GutterBandSep].Visible:= chkGutterSep.Checked;
ed.Gutter[ed.GutterBandEmpty].Visible:= chkGutterEmpty.Checked;
ed.Gutter[ed.GutterBandBm].Size:= edSizeBm.Value;
ed.Gutter[ed.GutterBandNum].Size:= edSizeNum.Value;
ed.Gutter[ed.GutterBandFold].Size:= edSizeFold.Value;
ed.Gutter[ed.GutterBandState].Size:= edSizeState.Value;
ed.Gutter[ed.GutterBandSep].Size:= edSizeSep.Value;
ed.Gutter[ed.GutterBandEmpty].Size:= edSizeEmpty.Value;
ed.OptNumbersAutosize:= chkGutterNumAuto.Checked;
ed.OptNumbersIndentLeft:= edSizeNum1.Value;
ed.OptNumbersIndentRight:= edSizeNum2.Value;
//minimap
ed.OptMinimapCharWidth:= edMapCharWidth.Value;
ed.OptMinimapShowSelBorder:= chkMapSelBorder.Checked;
ed.OptMinimapShowSelAlways:= chkMapSelAlways.Checked;
//key
ed.OptTabSpaces:= chkTabSpaces.Checked;
ed.OptOverwriteSel:= chkOvrSel.Checked;
ed.OptKeyUpDownKeepColumn:= chkKeepCol.Checked;
ed.OptKeyUpDownNavigateWrapped:= chkNavUpDown.Checked;
ed.OptKeyHomeEndNavigateWrapped:= chkNavHomeEnd.Checked;
ed.OptKeyPageUpDownSize:= TATPageUpDownSize(edPageSize.ItemIndex);
ed.OptKeyLeftRightSwapSel:= chkLeftRtSwap.Checked;
ed.OptKeyLeftRightSwapSelAndSelect:= chkLeftRtSwapAndSel.Checked;
ed.OptKeyHomeToNonSpace:= chkHomeNonspace.Checked;
ed.OptKeyEndToNonSpace:= chkEndNonspace.Checked;
ed.OptKeyPageKeepsRelativePos:= chkPageKeepRel.Checked;
ed.OptKeyTabIndents:= chkTabIndent.Checked;
ed.OptAutoIndent:= chkEnterIndent.Checked;
ed.OptKeyBackspaceUnindent := chkBackspUnindent.Checked;
ed.OptAutoIndentKind:= TATAutoIndentKind(edIndentKind.ItemIndex);
ed.OptIndentSize:= edIndentSize.Value;
ed.OptIndentKeepsAlign:= chkUnindentKeepAlign.Checked;
//mouse
ed.OptMouseEnableNormalSelection:= chkMsNormalSel.Checked;
ed.OptMouseEnableColumnSelection:= chkMsColumnSel.Checked;
ed.OptMouse2ClickSelectsLine:= chkMsClick2.Checked;
ed.OptMouse3ClickSelectsLine:= chkMsClick3.Checked;
ed.OptMouse2ClickDragSelectsWords:= chkMsClick2Drag.Checked;
ed.OptMouseGutterClickSelectsLine:= chkMsClickNumSel.Checked;
ed.OptMouseDragDrop:= chkMsDragDrop.Checked;
ed.OptMouseRightClickMovesCaret:= chkMsRtClickMove.Checked;
ed.OptMouseNiceScroll:= chkMsNiceScroll.Checked;
ed.OptMouseHideCursorOnType:= chkMsHideCursor.Checked;
ed.OptMouseDownForPopup:= chkMsMenuDown.Checked;
//undo
ed.OptUndoLimit:= edUndo.Value;
ed.OptUndoGrouped:= chkUndoGr.Checked;
ed.OptUndoAfterSave:= chkUndoSv.Checked;
//apply
ed.Gutter.Update;
ed.Update;
end;
end;
end;
{ TfmOpt }
procedure TfmOpt.FormCreate(Sender: TObject);
begin
InitShape(edCrShape);
InitShape(edCrShape2);
end;
procedure SwapItems(L: TListbox; n1, n2: integer);
var
s: string;
begin
s:= L.Items[n1];
L.Items[n1]:= L.Items[n2];
L.Items[n2]:= s;
L.ItemIndex:= n2;
end;
procedure TfmOpt.bColUpClick(Sender: TObject);
begin
with ListCol do
if ItemIndex>0 then
SwapItems(ListCol, ItemIndex, ItemIndex-1);
end;
procedure TfmOpt.bColDownClick(Sender: TObject);
begin
with ListCol do
if ItemIndex<Count-1 then
SwapItems(ListCol, ItemIndex, ItemIndex+1);
end;
procedure TfmOpt.InitShape(ed: TCombobox);
begin
ed.Items.Clear;
ed.Items.AddStrings(ListShapes.Items);
end;
end.

View File

@@ -0,0 +1,106 @@
<?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="4">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fmMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
<Unit2>
<Filename Value="..\..\atsynedit\atsynedit.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit"/>
</Unit2>
<Unit3>
<Filename Value="..\..\atsynedit\atstrings.pas"/>
<IsPartOfProject Value="True"/>
</Unit3>
</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>

View File

@@ -0,0 +1,20 @@
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1, atstrings, atsynedit;
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TfmMain, fmMain);
Application.Run;
end.

View File

@@ -0,0 +1,68 @@
object fmMain: TfmMain
Left = 222
Height = 442
Top = 254
Width = 932
Caption = 'App'
ClientHeight = 442
ClientWidth = 932
OnCreate = FormCreate
OnShow = FormShow
LCLVersion = '1.5'
object Panel1: TPanel
Left = 0
Height = 442
Top = 0
Width = 626
Align = alClient
BevelOuter = bvNone
Caption = 'Panel1'
TabOrder = 0
end
object Panel2: TPanel
Left = 632
Height = 442
Top = 0
Width = 300
Align = alRight
BevelOuter = bvNone
ClientHeight = 442
ClientWidth = 300
TabOrder = 1
object bGettext: TButton
Left = 0
Height = 25
Top = 400
Width = 80
Caption = 'Get text'
OnClick = bGettextClick
TabOrder = 0
end
object List: TShellListView
Left = 0
Height = 442
Top = 0
Width = 300
Align = alClient
Color = clWhite
HideSelection = False
ReadOnly = True
RowSelect = True
SortColumn = 0
SortType = stText
TabOrder = 1
ViewStyle = vsSmallIcon
OnClick = ListClick
ObjectTypes = [otNonFolders]
end
end
object Splitter1: TSplitter
Left = 626
Height = 442
Top = 0
Width = 6
Align = alRight
Beveled = True
ResizeAnchor = akRight
end
end

View File

@@ -0,0 +1,76 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls, ShellCtrls, atstrings, atsynedit, atstringproc;
type
{ TfmMain }
TfmMain = class(TForm)
bGettext: TButton;
Panel1: TPanel;
Panel2: TPanel;
List: TShellListView;
Splitter1: TSplitter;
procedure bGettextClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ListClick(Sender: TObject);
private
{ private declarations }
fDir: string;
ed: TATSynEdit;
public
{ public declarations }
end;
var
fmMain: TfmMain;
implementation
{$R *.lfm}
{ TfmMain }
procedure TfmMain.FormCreate(Sender: TObject);
begin
ed:= TATSynEdit.Create(Self);
ed.Parent:= Panel1;
ed.Align:= alClient;
ed.Font.Name:= 'Courier New';
ed.OptUnprintedVisible:= false;
ed.OptRulerVisible:= false;
ed.OptWrapMode:= cWrapOff;
fDir:= ExtractFilePath(Application.Exename)+'../../test_files';
end;
procedure TfmMain.FormShow(Sender: TObject);
begin
List.Root:= fDir;
end;
procedure TfmMain.ListClick(Sender: TObject);
var
s: string;
begin
s:= List.GetPathFromItem(List.Selected);
if not FileExistsUTF8(s) then Exit;
ed.LoadFromFile(s);
ed.SetFocus;
Caption:= 'App - '+ExtractFileName(s);
end;
procedure TfmMain.bGettextClick(Sender: TObject);
begin
ShowMessage(UTF8Encode(ed.Strings.TextString));
end;
end.

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="Demo"/>
<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="2">
<Unit0>
<Filename Value="demo.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>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="demo"/>
</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>
<GenerateDebugInfo Value="False"/>
<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>

View File

@@ -0,0 +1,22 @@
program demo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1
{ you can add units after this };
{$R *.res}
begin
Application.Title:= 'Demo';
RequireDerivedFormResource:= True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,10 @@
object Form1: TForm1
Left = 260
Height = 391
Top = 262
Width = 690
Caption = 'Demo'
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.4.0.4'
end

View File

@@ -0,0 +1,52 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ATSynEdit, ATSynEdit_Keymap_Init;
type
{ TForm1 }
TForm1 = class(TForm)
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
ed: TATSynEdit;
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
ed:= TATSynEdit.Create(Self);
ed.Parent:= Self;
ed.Font.Name:= 'Courier New';
ed.Align:= alClient;
ed.OptUnprintedVisible:= false;
ed.OptRulerVisible:= false;
ed.Colors.TextBG:= $e0f0f0;
ed.LoadFromFile(ExtractFilePath(Application.ExeName)+'unit1.pas');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ed.OptCaretBlinkEnabled:= not ed.OptCaretBlinkEnabled;
ed.SetFocus;
end;
end.

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="demo"/>
<ResourceType Value="res"/>
</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="2">
<Unit0>
<Filename Value="demo.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>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="demo"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<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>

View File

@@ -0,0 +1,19 @@
program demo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1
{ you can add units after this };
begin
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,20 @@
object Form1: TForm1
Left = 456
Height = 278
Top = 453
Width = 500
Caption = 'Form1'
ClientHeight = 278
ClientWidth = 500
OnPaint = FormPaint
LCLVersion = '1.5'
object Button1: TButton
Left = 154
Height = 25
Top = 68
Width = 75
Caption = 'close'
OnClick = Button1Click
TabOrder = 0
end
end

View File

@@ -0,0 +1,58 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormPaint(Sender: TObject);
var
c: tcanvas;
begin
c:= self.canvas;
c.brush.color:= clyellow;
c.fillrect(0, 0, 200, 200);
c.pen.color:= clred;
c.line(10,10,30,10);
c.line(30,10,50,10);
c.line(50,10,80,10);
c.line(10,10,10,30);
c.line(10,30,10,50);
c.line(10,50,10,80);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;
end.

View File

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="demo"/>
<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="2">
<Item1>
<PackageName Value="atsynedit_package"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="3">
<Unit0>
<Filename Value="demo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fmMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
<Unit2>
<Filename Value="..\..\atsynedit\atsynedit.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ATSynEdit"/>
</Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="demo"/>
</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>

View File

@@ -0,0 +1,21 @@
program demo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1, ATSynEdit
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:= True;
Application.Initialize;
Application.CreateForm(TfmMain, fmMain);
Application.Run;
end.

View File

@@ -0,0 +1,343 @@
object fmMain: TfmMain
Left = 359
Height = 419
Top = 457
Width = 685
Caption = 'Test'
ClientHeight = 419
ClientWidth = 685
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.5'
object ed: TATSynEdit
Left = 6
Height = 308
Top = 6
Width = 673
Align = alClient
BorderSpacing.Around = 6
BorderStyle = bsSingle
Font.Height = -12
Font.Name = 'Courier New'
ParentFont = False
TabOrder = 0
TabStop = True
CursorText = crIBeam
CursorBm = crHandPoint
Colors.TextFont = clBlack
Colors.TextBG = clWhite
Colors.TextDisabledFont = clGray
Colors.TextDisabledBG = 15790320
Colors.TextSelFont = clHighlightText
Colors.TextSelBG = clHighlight
Colors.Caret = clBlack
Colors.GutterFont = clGray
Colors.GutterBG = 14737632
Colors.GutterCaretBG = 13158600
Colors.GutterPlusBorder = clGray
Colors.GutterPlusBG = 16053492
Colors.GutterFoldLine = clGray
Colors.GutterFoldBG = 13158600
Colors.GutterSeparatorBG = clBlack
Colors.CurrentLineBG = 14741744
Colors.MarginRight = clSilver
Colors.MarginCaret = clLime
Colors.MarginUser = clYellow
Colors.IndentVertLines = clMedGray
Colors.BookmarkBG = clMoneyGreen
Colors.RulerFont = clGray
Colors.RulerBG = 14737632
Colors.CollapseLine = 10510432
Colors.CollapseMarkFont = 14712960
Colors.CollapseMarkBG = clWhite
Colors.UnprintedFont = 5263600
Colors.UnprintedBG = 14737632
Colors.UnprintedHexFont = clMedGray
Colors.MinimapBorder = clSilver
Colors.MinimapSelBG = 15658734
Colors.StateChanged = 61680
Colors.StateAdded = 2146336
Colors.StateSaved = clMedGray
Colors.BlockStaple = clMedGray
Colors.BlockSepLine = clMedGray
Colors.LockedBG = 14737632
Colors.TextHintFont = clGray
Colors.ComboboxArrow = clGray
Colors.ComboboxArrowBG = 15790320
WantTabs = True
OptTabSpaces = False
OptTabSize = 10
OptFoldStyle = cFoldHereWithTruncatedText
OptTextLocked = 'wait...'
OptTextHintFontStyle = [fsItalic]
OptTextHintCenter = False
OptTextOffsetTop = 0
OptTextOffsetFromLine = 1
OptAutoIndent = True
OptAutoIndentKind = cIndentAsIs
OptCopyLinesIfNoSel = True
OptCutLinesIfNoSel = False
OptLastLineOnTop = False
OptOverwriteSel = True
OptOverwriteAllowedOnPaste = False
OptShowStapleStyle = cLineStyleSolid
OptShowStapleIndent = -1
OptShowStapleWidthPercent = 100
OptShowFullSel = False
OptShowFullHilite = True
OptShowCurLine = False
OptShowCurLineMinimal = True
OptShowScrollHint = False
OptShowCurColumn = False
OptCaretManyAllowed = True
OptCaretVirtual = True
OptCaretShape = cCaretShapeVertPixels1
OptCaretShapeOvr = cCaretShapeFull
OptCaretShapeRO = cCaretShapeHorzPixels1
OptCaretBlinkTime = 600
OptCaretBlinkEnabled = True
OptCaretStopUnfocused = True
OptCaretPreferLeftSide = True
OptGutterVisible = True
OptGutterPlusSize = 4
OptGutterShowFoldAlways = True
OptGutterShowFoldLines = True
OptGutterShowFoldLinesAll = False
OptRulerVisible = True
OptRulerSize = 19
OptRulerFontSize = 8
OptRulerMarkSizeSmall = 3
OptRulerMarkSizeBig = 7
OptRulerTextIndent = 0
OptMinimapVisible = False
OptMinimapCharWidth = 0
OptMinimapShowSelBorder = False
OptMinimapShowSelAlways = True
OptMicromapVisible = False
OptMicromapWidth = 30
OptCharSpacingX = 0
OptCharSpacingY = 1
OptWrapMode = cWrapOn
OptWrapIndented = True
OptMarginRight = 80
OptNumbersAutosize = True
OptNumbersAlignment = taRightJustify
OptNumbersFontSize = 0
OptNumbersStyle = cNumbersEach5th
OptNumbersShowFirst = True
OptNumbersShowCarets = False
OptNumbersSkippedChar = '.'
OptNumbersIndentLeft = 5
OptNumbersIndentRight = 5
OptUnprintedVisible = False
OptUnprintedSpaces = True
OptUnprintedEnds = True
OptUnprintedEndsDetails = True
OptUnprintedReplaceSpec = True
OptMouseEnableNormalSelection = True
OptMouseEnableColumnSelection = True
OptMouseDownForPopup = False
OptMouseHideCursorOnType = False
OptMouse2ClickSelectsLine = False
OptMouse3ClickSelectsLine = True
OptMouse2ClickDragSelectsWords = True
OptMouseDragDrop = True
OptMouseNiceScroll = True
OptMouseRightClickMovesCaret = False
OptMouseGutterClickSelectsLine = True
OptKeyBackspaceUnindent = True
OptKeyPageKeepsRelativePos = True
OptKeyUpDownNavigateWrapped = True
OptKeyUpDownKeepColumn = True
OptKeyHomeEndNavigateWrapped = True
OptKeyPageUpDownSize = cPageSizeFullMinus1
OptKeyLeftRightSwapSel = True
OptKeyLeftRightSwapSelAndSelect = False
OptKeyHomeToNonSpace = True
OptKeyEndToNonSpace = True
OptKeyTabIndents = True
OptIndentSize = 2
OptIndentKeepsAlign = True
OptShowIndentLines = True
OptShowGutterCaretBG = True
OptAllowScrollbarVert = True
OptAllowScrollbarHorz = True
OptAllowZooming = True
OptAllowReadOnly = True
OptUndoLimit = 5000
OptUndoGrouped = True
OptUndoAfterSave = True
OptSavingForceFinalEol = False
OptSavingTrimSpaces = False
end
object Panel1: TPanel
Left = 0
Height = 99
Top = 320
Width = 685
Align = alBottom
ClientHeight = 99
ClientWidth = 685
TabOrder = 1
object ATComboEdit1: TATComboEdit
Left = 8
Height = 26
Top = 0
Width = 300
BorderStyle = bsSingle
Font.Height = -12
Font.Name = 'Courier New'
ParentFont = False
TabOrder = 0
TabStop = True
CursorText = crIBeam
CursorBm = crHandPoint
Colors.TextFont = clBlack
Colors.TextBG = clWhite
Colors.TextDisabledFont = clGray
Colors.TextDisabledBG = 15790320
Colors.TextSelFont = clHighlightText
Colors.TextSelBG = clHighlight
Colors.Caret = clBlack
Colors.GutterFont = clGray
Colors.GutterBG = 14737632
Colors.GutterCaretBG = 13158600
Colors.GutterPlusBorder = clGray
Colors.GutterPlusBG = 16053492
Colors.GutterFoldLine = clGray
Colors.GutterFoldBG = 13158600
Colors.GutterSeparatorBG = clBlack
Colors.CurrentLineBG = 14741744
Colors.MarginRight = clSilver
Colors.MarginCaret = clLime
Colors.MarginUser = clYellow
Colors.IndentVertLines = clMedGray
Colors.BookmarkBG = clMoneyGreen
Colors.RulerFont = clGray
Colors.RulerBG = 14737632
Colors.CollapseLine = 10510432
Colors.CollapseMarkFont = 14712960
Colors.CollapseMarkBG = clCream
Colors.UnprintedFont = 5263600
Colors.UnprintedBG = 14737632
Colors.UnprintedHexFont = clMedGray
Colors.MinimapBorder = clSilver
Colors.MinimapSelBG = 15658734
Colors.StateChanged = 61680
Colors.StateAdded = 2146336
Colors.StateSaved = clMedGray
Colors.BlockStaple = clMedGray
Colors.BlockSepLine = clMedGray
Colors.LockedBG = 14737632
Colors.TextHintFont = clGray
Colors.ComboboxArrow = clGray
Colors.ComboboxArrowBG = 15790320
WantTabs = False
OptTabSpaces = False
OptTabSize = 8
OptFoldStyle = cFoldHereWithTruncatedText
OptTextLocked = 'wait...'
OptTextHintFontStyle = [fsItalic]
OptTextHintCenter = False
OptTextOffsetTop = 2
OptTextOffsetFromLine = 1
OptAutoIndent = True
OptAutoIndentKind = cIndentAsIs
OptCopyLinesIfNoSel = True
OptCutLinesIfNoSel = False
OptLastLineOnTop = False
OptOverwriteSel = True
OptOverwriteAllowedOnPaste = False
OptShowStapleStyle = cLineStyleSolid
OptShowStapleIndent = -1
OptShowStapleWidthPercent = 100
OptShowFullSel = False
OptShowFullHilite = True
OptShowCurLine = False
OptShowCurLineMinimal = True
OptShowScrollHint = False
OptShowCurColumn = False
OptCaretManyAllowed = False
OptCaretVirtual = False
OptCaretShape = cCaretShapeVertPixels1
OptCaretShapeOvr = cCaretShapeFull
OptCaretShapeRO = cCaretShapeHorzPixels1
OptCaretBlinkTime = 600
OptCaretBlinkEnabled = True
OptCaretStopUnfocused = True
OptCaretPreferLeftSide = True
OptGutterVisible = False
OptGutterPlusSize = 4
OptGutterShowFoldAlways = True
OptGutterShowFoldLines = True
OptGutterShowFoldLinesAll = False
OptRulerVisible = False
OptRulerSize = 20
OptRulerFontSize = 8
OptRulerMarkSizeSmall = 3
OptRulerMarkSizeBig = 7
OptRulerTextIndent = 0
OptMinimapVisible = False
OptMinimapCharWidth = 0
OptMinimapShowSelBorder = False
OptMinimapShowSelAlways = True
OptMicromapVisible = True
OptMicromapWidth = 22
OptCharSpacingX = 0
OptCharSpacingY = 1
OptWrapMode = cWrapOff
OptWrapIndented = True
OptMarginRight = 1000
OptNumbersAutosize = True
OptNumbersAlignment = taRightJustify
OptNumbersFontSize = 0
OptNumbersStyle = cNumbersEach5th
OptNumbersShowFirst = True
OptNumbersShowCarets = False
OptNumbersSkippedChar = '.'
OptNumbersIndentLeft = 5
OptNumbersIndentRight = 5
OptUnprintedVisible = False
OptUnprintedSpaces = True
OptUnprintedEnds = True
OptUnprintedEndsDetails = True
OptUnprintedReplaceSpec = True
OptMouseEnableNormalSelection = True
OptMouseEnableColumnSelection = True
OptMouseDownForPopup = False
OptMouseHideCursorOnType = False
OptMouse2ClickSelectsLine = False
OptMouse3ClickSelectsLine = True
OptMouse2ClickDragSelectsWords = True
OptMouseDragDrop = False
OptMouseNiceScroll = False
OptMouseRightClickMovesCaret = False
OptMouseGutterClickSelectsLine = True
OptKeyBackspaceUnindent = True
OptKeyPageKeepsRelativePos = True
OptKeyUpDownNavigateWrapped = True
OptKeyUpDownKeepColumn = True
OptKeyHomeEndNavigateWrapped = True
OptKeyPageUpDownSize = cPageSizeFullMinus1
OptKeyLeftRightSwapSel = True
OptKeyLeftRightSwapSelAndSelect = False
OptKeyHomeToNonSpace = True
OptKeyEndToNonSpace = True
OptKeyTabIndents = True
OptIndentSize = 2
OptIndentKeepsAlign = True
OptShowIndentLines = True
OptShowGutterCaretBG = True
OptAllowScrollbarVert = False
OptAllowScrollbarHorz = False
OptAllowZooming = False
OptAllowReadOnly = False
OptUndoLimit = 200
OptUndoGrouped = True
OptUndoAfterSave = True
OptSavingForceFinalEol = False
OptSavingTrimSpaces = False
OptComboboxArrowSize = 4
end
end
end

View File

@@ -0,0 +1,52 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, ATSynEdit, ATSynEdit_Edits, LCLType;
type
{ TfmMain }
TfmMain = class(TForm)
ATComboEdit1: TATComboEdit;
ed: TATSynEdit;
Panel1: TPanel;
procedure FormShow(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
fmMain: TfmMain;
implementation
{$R *.lfm}
{ TfmMain }
procedure TfmMain.FormShow(Sender: TObject);
begin
ed.Strings.Clear;
ed.Strings.LineAdd('This is demo text');
ed.Strings.LineAdd('test');
ed.Strings.LineAdd('test...');
ed.Update(true);
{
combo2:= tatcomboedit.create(Self);
combo2.parent:= panel1;
combo2.left:= 350;
combo2.width:= 300;
combo2.top:= 20;
}
end;
end.

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="Finder test"/>
<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="2">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fmMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="project1"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="../../atsynedit"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-dUnicode"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,22 @@
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1
{ you can add units after this };
{$R *.res}
begin
Application.Title:='Finder test';
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TfmMain, fmMain);
Application.Run;
end.

View File

@@ -0,0 +1,137 @@
object fmMain: TfmMain
Left = 516
Height = 320
Top = 250
Width = 667
BorderStyle = bsDialog
Caption = 'Test Finder.FindMatch'
ClientHeight = 320
ClientWidth = 667
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.5'
object Memo1: TMemo
Left = 8
Height = 48
Top = 24
Width = 407
Lines.Strings = (
'register'
)
TabOrder = 0
end
object Memo2: TMemo
Left = 8
Height = 216
Top = 96
Width = 407
Lines.Strings = (
'unit shapeline_reg;'
''
'interface'
''
'uses'
' SysUtils, Classes, Controls, LResources, shapeline;'
''
'procedure Register;'
''
'implementation'
''
'procedure Register;'
'begin'
' RegisterComponents(''Misc'', [TShapeLine]);'
'end;'
''
'initialization'
' {$I res/icons.lrs}'
''
'end.'
)
TabOrder = 1
end
object bFindNext: TButton
Left = 431
Height = 25
Top = 62
Width = 120
Caption = 'find next'
OnClick = bFindNextClick
TabOrder = 3
end
object bFind: TButton
Left = 431
Height = 25
Top = 30
Width = 120
Caption = 'find first'
OnClick = bFindClick
TabOrder = 2
end
object Label1: TLabel
Left = 8
Height = 17
Top = 7
Width = 62
Caption = 'find what'
ParentColor = False
end
object Label2: TLabel
Left = 8
Height = 17
Top = 80
Width = 70
Caption = 'find where'
ParentColor = False
end
object Memo3: TMemo
Left = 424
Height = 58
Top = 254
Width = 230
Lines.Strings = (
''
)
ReadOnly = True
TabOrder = 8
end
object chkBack: TCheckBox
Left = 431
Height = 24
Top = 174
Width = 92
Caption = 'backward'
TabOrder = 7
end
object chkCase: TCheckBox
Left = 431
Height = 24
Top = 126
Width = 89
Caption = 'case sens'
TabOrder = 5
end
object chkWords: TCheckBox
Left = 431
Height = 24
Top = 150
Width = 111
Caption = 'whole words'
TabOrder = 6
end
object Label3: TLabel
Left = 424
Height = 17
Top = 230
Width = 39
Caption = 'result'
ParentColor = False
end
object chkRegex: TCheckBox
Left = 431
Height = 24
Top = 102
Width = 64
Caption = 'regex'
TabOrder = 4
end
end

View File

@@ -0,0 +1,93 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
atsynedit_finder, regexpr;
type
{ TfmMain }
TfmMain = class(TForm)
bFindNext: TButton;
bFind: TButton;
chkRegex: TCheckBox;
chkBack: TCheckBox;
chkCase: TCheckBox;
chkWords: TCheckBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Memo1: TMemo;
Memo2: TMemo;
Memo3: TMemo;
procedure bFindNextClick(Sender: TObject);
procedure bFindClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
Finder: TATTextFinder;
procedure DoFind(ANext: boolean);
{ private declarations }
public
{ public declarations }
end;
var
fmMain: TfmMain;
implementation
{$R *.lfm}
{ TfmMain }
procedure TfmMain.bFindClick(Sender: TObject);
begin
DoFind(false);
end;
procedure TfmMain.bFindNextClick(Sender: TObject);
begin
DoFind(true);
end;
procedure TfmMain.DoFind(ANext: boolean);
var
NFromPos, NSkipLen: integer;
begin
Finder.StrFind:= trim(Memo1.Text);
Finder.StrText:= trim(Memo2.Text);
Finder.OptCase:= chkCase.Checked;
Finder.OptWords:= chkWords.Checked;
Finder.OptBack:= chkBack.Checked;
Finder.OptRegex:= chkRegex.Checked;
NSkipLen:= Finder.MatchLen;
if ANext then
NFromPos:= Finder.MatchPos
else
if Finder.OptRegex then
NFromPos:= 1
else
if Finder.OptBack then
NFromPos:= Length(Finder.StrText)
else
NFromPos:= 1;
if not FInder.FindMatch(ANext, NSkipLen, NFromPos) then
memo3.text:= '(not found)'
else
memo3.text:= 'context:'#13+Copy(Finder.StrText, Finder.MatchPos-2, FInder.MatchLen+4);
end;
procedure TfmMain.FormCreate(Sender: TObject);
begin
FInder:= TATTextFinder.Create;
end;
end.

View 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>

View 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.

View 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

View 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.