mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-20 12:19:31 +02:00
Examples: SynEdit Bookmarks
git-svn-id: trunk@32904 -
This commit is contained in:
parent
bbe92fcaa7
commit
2353e90507
6
.gitattributes
vendored
6
.gitattributes
vendored
@ -3212,6 +3212,12 @@ examples/SynEdit/SynAnyHighlighter/synanysynhighlighter.lpr svneol=native#text/p
|
||||
examples/SynEdit/SynAnyHighlighter/unit1.lfm svneol=native#text/plain
|
||||
examples/SynEdit/SynAnyHighlighter/unit1.lrs svneol=native#text/pascal
|
||||
examples/SynEdit/SynAnyHighlighter/unit1.pas svneol=native#text/plain
|
||||
examples/SynEdit/SynGutterMarks/SynGutterMarkExample.ico -text
|
||||
examples/SynEdit/SynGutterMarks/SynGutterMarkExample.lpi svneol=native#text/xml
|
||||
examples/SynEdit/SynGutterMarks/SynGutterMarkExample.lpr svneol=native#text/pascal
|
||||
examples/SynEdit/SynGutterMarks/SynGutterMarkExample.res -text
|
||||
examples/SynEdit/SynGutterMarks/unit1.lfm svneol=native#text/plain
|
||||
examples/SynEdit/SynGutterMarks/unit1.pas svneol=native#text/pascal
|
||||
examples/SynEdit/SynPositionHighlighter/synpositionhighlighterexample1.lpi svneol=native#text/plain
|
||||
examples/SynEdit/SynPositionHighlighter/synpositionhighlighterexample1.lpr svneol=native#text/plain
|
||||
examples/SynEdit/SynPositionHighlighter/unit1.lfm svneol=native#text/plain
|
||||
|
BIN
examples/SynEdit/SynGutterMarks/SynGutterMarkExample.ico
Normal file
BIN
examples/SynEdit/SynGutterMarks/SynGutterMarkExample.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
93
examples/SynEdit/SynGutterMarks/SynGutterMarkExample.lpi
Normal file
93
examples/SynEdit/SynGutterMarks/SynGutterMarkExample.lpi
Normal file
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="SynGutterMarkExample"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="SynEdit"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="SynGutterMarkExample.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="SynGutterMarkExample"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="10"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="SynGutterMarkExample"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="True"/>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
<UseHeaptrc Value="True"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<UseMsgFile Value="True"/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
21
examples/SynEdit/SynGutterMarks/SynGutterMarkExample.lpr
Normal file
21
examples/SynEdit/SynGutterMarks/SynGutterMarkExample.lpr
Normal file
@ -0,0 +1,21 @@
|
||||
program SynGutterMarkExample;
|
||||
|
||||
{$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
|
||||
RequireDerivedFormResource := True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
BIN
examples/SynEdit/SynGutterMarks/SynGutterMarkExample.res
Normal file
BIN
examples/SynEdit/SynGutterMarks/SynGutterMarkExample.res
Normal file
Binary file not shown.
1414
examples/SynEdit/SynGutterMarks/unit1.lfm
Normal file
1414
examples/SynEdit/SynGutterMarks/unit1.lfm
Normal file
File diff suppressed because it is too large
Load Diff
112
examples/SynEdit/SynGutterMarks/unit1.pas
Normal file
112
examples/SynEdit/SynGutterMarks/unit1.pas
Normal file
@ -0,0 +1,112 @@
|
||||
unit Unit1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, Spin,
|
||||
SynEdit, SynEditTypes, SynEditMarks;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
Button1: TButton;
|
||||
chkMarkGutterAutoSize: TCheckBox;
|
||||
chkDrawBookMarkFirst: TCheckBox;
|
||||
chkBookMark: TCheckBox;
|
||||
ImageList1: TImageList;
|
||||
imgBookMarks: TImageList;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
Label4: TLabel;
|
||||
Panel1: TPanel;
|
||||
Panel2: TPanel;
|
||||
Panel3: TPanel;
|
||||
spinMarkGutterWidth: TSpinEdit;
|
||||
SpinLine: TSpinEdit;
|
||||
spinImg: TSpinEdit;
|
||||
SynEdit1: TSynEdit;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure chkDrawBookMarkFirstChange(Sender: TObject);
|
||||
procedure chkBookMarkChange(Sender: TObject);
|
||||
procedure chkMarkGutterAutoSizeChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure spinMarkGutterWidthChange(Sender: TObject);
|
||||
procedure SynEdit1StatusChange(Sender: TObject; Changes: TSynStatusChanges);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.SynEdit1StatusChange(Sender: TObject; Changes: TSynStatusChanges);
|
||||
begin
|
||||
if scModified in Changes then SpinLine.MaxValue := SynEdit1.Lines.Count;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
var
|
||||
m: TSynEditMark;
|
||||
begin
|
||||
if chkBookMark.Checked
|
||||
then begin
|
||||
SynEdit1.SetBookMark(spinImg.Value, 1, SpinLine.Value);
|
||||
end
|
||||
else begin
|
||||
m := TSynEditMark.Create(SynEdit1);
|
||||
m.Line := SpinLine.Value;
|
||||
m.ImageList := ImageList1;
|
||||
m.ImageIndex := spinImg.Value;
|
||||
m.Visible := true;
|
||||
SynEdit1.Marks.Add(m);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.chkDrawBookMarkFirstChange(Sender: TObject);
|
||||
begin
|
||||
SynEdit1.BookMarkOptions.DrawBookmarksFirst := chkDrawBookMarkFirst.Checked;
|
||||
end;
|
||||
|
||||
procedure TForm1.chkBookMarkChange(Sender: TObject);
|
||||
begin
|
||||
if chkBookMark.Checked
|
||||
then spinImg.MaxValue := 9
|
||||
else spinImg.MaxValue := 4;
|
||||
end;
|
||||
|
||||
procedure TForm1.chkMarkGutterAutoSizeChange(Sender: TObject);
|
||||
begin
|
||||
SynEdit1.Gutter.MarksPart(0).AutoSize := chkMarkGutterAutoSize.Checked;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
(* SynEdit currently does not include own images for bookmarks.
|
||||
If no images are given it will currently crash
|
||||
*)
|
||||
SynEdit1.BookMarkOptions.BookmarkImages := imgBookMarks;
|
||||
spinMarkGutterWidth.Value := SynEdit1.Gutter.MarksPart(0).Width;
|
||||
chkMarkGutterAutoSize.Checked := SynEdit1.Gutter.MarksPart(0).AutoSize;
|
||||
chkDrawBookMarkFirst.Checked := SynEdit1.BookMarkOptions.DrawBookmarksFirst;
|
||||
end;
|
||||
|
||||
procedure TForm1.spinMarkGutterWidthChange(Sender: TObject);
|
||||
begin
|
||||
SynEdit1.Gutter.MarksPart(0).Width := spinMarkGutterWidth.Value;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user