mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 01:06:02 +02:00
added synedit example
git-svn-id: trunk@4428 -
This commit is contained in:
parent
cb62f2cbfa
commit
e4f766c128
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -287,6 +287,7 @@ examples/scrollbar.pp svneol=native#text/pascal
|
||||
examples/selection.pp svneol=native#text/pascal
|
||||
examples/selectionform.pp svneol=native#text/pascal
|
||||
examples/speedtest.pp svneol=native#text/pascal
|
||||
examples/synedit1.pas svneol=native#text/pascal
|
||||
examples/testall.pp svneol=native#text/pascal
|
||||
examples/testallform.pp svneol=native#text/pascal
|
||||
examples/testtools.inc svneol=native#text/pascal
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Don't edit, this file is generated by FPCMake Version 1.1 [2003/06/20]
|
||||
# Don't edit, this file is generated by FPCMake Version 1.1 [2003/06/26]
|
||||
#
|
||||
default: all
|
||||
MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx
|
||||
@ -212,8 +212,8 @@ LCL_PLATFORM=gtk
|
||||
endif
|
||||
export LCL_PLATFORM
|
||||
endif
|
||||
override TARGET_UNITS+=hello notebk comdialogs progressbar trackbar listboxtest bitbutton combobox checkbox scrollbar edittest memotest groupbox speedtest toolbar messagedialogs notebooktest listviewtest testall
|
||||
override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) trackbar toolbar testall speedtest scrollbar progressbar notebooktest notebk messagedialogs memotest listviewtest listboxtest hello groupbox edittest comdialogs combobox checkbox bitbutton
|
||||
override TARGET_UNITS+=hello notebk comdialogs progressbar trackbar listboxtest bitbutton combobox checkbox scrollbar edittest memotest groupbox speedtest toolbar messagedialogs notebooktest listviewtest synedit1 testall
|
||||
override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) trackbar toolbar testall speedtest scrollbar progressbar notebooktest notebk messagedialogs memotest listviewtest listboxtest hello groupbox edittest comdialogs combobox checkbox bitbutton synedit1
|
||||
override COMPILER_OPTIONS+=-gl
|
||||
override COMPILER_UNITDIR+=../lcl/units ../lcl/units/$(LCL_PLATFORM) ../components/units .. .
|
||||
ifdef REQUIRE_UNITSDIR
|
||||
@ -894,6 +894,7 @@ REQUIRE_PACKAGES_RTL=1
|
||||
REQUIRE_PACKAGES_PASZLIB=1
|
||||
REQUIRE_PACKAGES_NETDB=1
|
||||
REQUIRE_PACKAGES_LIBASYNC=1
|
||||
REQUIRE_PACKAGES_PTHREADS=1
|
||||
REQUIRE_PACKAGES_FCL=1
|
||||
REQUIRE_PACKAGES_REGEXPR=1
|
||||
REQUIRE_PACKAGES_MYSQL=1
|
||||
@ -906,6 +907,7 @@ REQUIRE_PACKAGES_RTL=1
|
||||
REQUIRE_PACKAGES_PASZLIB=1
|
||||
REQUIRE_PACKAGES_NETDB=1
|
||||
REQUIRE_PACKAGES_LIBASYNC=1
|
||||
REQUIRE_PACKAGES_PTHREADS=1
|
||||
REQUIRE_PACKAGES_FCL=1
|
||||
REQUIRE_PACKAGES_REGEXPR=1
|
||||
REQUIRE_PACKAGES_MYSQL=1
|
||||
@ -918,6 +920,7 @@ REQUIRE_PACKAGES_RTL=1
|
||||
REQUIRE_PACKAGES_PASZLIB=1
|
||||
REQUIRE_PACKAGES_NETDB=1
|
||||
REQUIRE_PACKAGES_LIBASYNC=1
|
||||
REQUIRE_PACKAGES_PTHREADS=1
|
||||
REQUIRE_PACKAGES_FCL=1
|
||||
REQUIRE_PACKAGES_REGEXPR=1
|
||||
REQUIRE_PACKAGES_MYSQL=1
|
||||
@ -930,6 +933,7 @@ REQUIRE_PACKAGES_RTL=1
|
||||
REQUIRE_PACKAGES_PASZLIB=1
|
||||
REQUIRE_PACKAGES_NETDB=1
|
||||
REQUIRE_PACKAGES_LIBASYNC=1
|
||||
REQUIRE_PACKAGES_PTHREADS=1
|
||||
REQUIRE_PACKAGES_FCL=1
|
||||
REQUIRE_PACKAGES_REGEXPR=1
|
||||
REQUIRE_PACKAGES_MYSQL=1
|
||||
@ -942,6 +946,7 @@ REQUIRE_PACKAGES_RTL=1
|
||||
REQUIRE_PACKAGES_PASZLIB=1
|
||||
REQUIRE_PACKAGES_NETDB=1
|
||||
REQUIRE_PACKAGES_LIBASYNC=1
|
||||
REQUIRE_PACKAGES_PTHREADS=1
|
||||
REQUIRE_PACKAGES_FCL=1
|
||||
REQUIRE_PACKAGES_REGEXPR=1
|
||||
REQUIRE_PACKAGES_MYSQL=1
|
||||
@ -1276,6 +1281,32 @@ ifdef UNITDIR_LIBASYNC
|
||||
override COMPILER_UNITDIR+=$(UNITDIR_LIBASYNC)
|
||||
endif
|
||||
endif
|
||||
ifdef REQUIRE_PACKAGES_PTHREADS
|
||||
PACKAGEDIR_PTHREADS:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /pthreads/Makefile.fpc,$(PACKAGESDIR))))))
|
||||
ifneq ($(PACKAGEDIR_PTHREADS),)
|
||||
ifneq ($(wildcard $(PACKAGEDIR_PTHREADS)/$(OS_TARGET)),)
|
||||
UNITDIR_PTHREADS=$(PACKAGEDIR_PTHREADS)/$(OS_TARGET)
|
||||
else
|
||||
UNITDIR_PTHREADS=$(PACKAGEDIR_PTHREADS)
|
||||
endif
|
||||
ifdef CHECKDEPEND
|
||||
$(PACKAGEDIR_PTHREADS)/$(FPCMADE):
|
||||
$(MAKE) -C $(PACKAGEDIR_PTHREADS) $(FPCMADE)
|
||||
override ALLDEPENDENCIES+=$(PACKAGEDIR_PTHREADS)/$(FPCMADE)
|
||||
endif
|
||||
else
|
||||
PACKAGEDIR_PTHREADS=
|
||||
UNITDIR_PTHREADS:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /pthreads/Package.fpc,$(UNITSDIR)))))
|
||||
ifneq ($(UNITDIR_PTHREADS),)
|
||||
UNITDIR_PTHREADS:=$(firstword $(UNITDIR_PTHREADS))
|
||||
else
|
||||
UNITDIR_PTHREADS=
|
||||
endif
|
||||
endif
|
||||
ifdef UNITDIR_PTHREADS
|
||||
override COMPILER_UNITDIR+=$(UNITDIR_PTHREADS)
|
||||
endif
|
||||
endif
|
||||
ifdef REQUIRE_PACKAGES_FCL
|
||||
PACKAGEDIR_FCL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))))
|
||||
ifneq ($(PACKAGEDIR_FCL),)
|
||||
|
@ -10,7 +10,7 @@ version=0.9b
|
||||
units=hello notebk comdialogs progressbar trackbar listboxtest \
|
||||
bitbutton combobox checkbox scrollbar edittest memotest \
|
||||
groupbox speedtest toolbar messagedialogs notebooktest \
|
||||
listviewtest testall
|
||||
listviewtest synedit1 testall
|
||||
|
||||
[require]
|
||||
packages=fcl regexpr
|
||||
@ -19,7 +19,7 @@ packages=fcl regexpr
|
||||
files=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) \
|
||||
trackbar toolbar testall speedtest scrollbar progressbar notebooktest \
|
||||
notebk messagedialogs memotest listviewtest listboxtest hello groupbox \
|
||||
edittest comdialogs combobox checkbox bitbutton
|
||||
edittest comdialogs combobox checkbox bitbutton synedit1
|
||||
|
||||
[default]
|
||||
|
||||
|
94
examples/synedit1.pas
Normal file
94
examples/synedit1.pas
Normal file
@ -0,0 +1,94 @@
|
||||
{
|
||||
***************************************************************************
|
||||
* *
|
||||
* This source is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This code is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* A copy of the GNU General Public License is available on the World *
|
||||
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
|
||||
* obtain it by writing to the Free Software Foundation, *
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************
|
||||
}
|
||||
program synedit1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Interfaces, Classes, SysUtils, Forms, Controls, GraphType, Graphics, SynEdit,
|
||||
SynHighlighterPas;
|
||||
|
||||
type
|
||||
TForm1 = class(TForm)
|
||||
SynEdit1: TSynEdit;
|
||||
PascalHighligher: TSynPasSyn;
|
||||
procedure Form1Resize(Sender: TObject);
|
||||
private
|
||||
procedure LoadText(const Filename: string);
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.Form1Resize(Sender: TObject);
|
||||
begin
|
||||
with SynEdit1 do
|
||||
SetBounds(10,10,Parent.ClientWidth-10,Parent.ClientHeight-20);
|
||||
end;
|
||||
|
||||
procedure TForm1.LoadText(const Filename: string);
|
||||
begin
|
||||
SynEdit1.Lines.LoadFromFile(Filename);
|
||||
end;
|
||||
|
||||
constructor TForm1.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
SetBounds(10,20,620,400);
|
||||
OnResize:=@Form1Resize;
|
||||
|
||||
SynEdit1:=TSynEdit.Create(Self);
|
||||
with SynEdit1 do begin
|
||||
Parent:=Self;
|
||||
|
||||
end;
|
||||
|
||||
PascalHighligher:=TSynPasSyn.Create(Self);
|
||||
with PascalHighligher do begin
|
||||
CommentAttri.Foreground:=clBlue;
|
||||
CommentAttri.Style:=[fsBold];
|
||||
KeyAttri.Style:=[fsBold];
|
||||
StringAttri.Foreground:=clBlue;
|
||||
SymbolAttri.Foreground:=clRed;
|
||||
end;
|
||||
|
||||
SynEdit1.Highlighter:=PascalHighligher;
|
||||
|
||||
LoadText('synedit1.pas');
|
||||
OnResize(nil);
|
||||
end;
|
||||
|
||||
destructor TForm1.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user