mirror of
https://github.com/ulfgebhardt/delphi_textpad.git
synced 2025-12-12 17:25:49 +00:00
init commit
This commit is contained in:
commit
da09c34c32
1
Script/rylon.ysc
Normal file
1
Script/rylon.ysc
Normal file
@ -0,0 +1 @@
|
||||
ladida;;;255;;;;;;
|
||||
17
Script/ycfg.ysc
Normal file
17
Script/ycfg.ysc
Normal file
@ -0,0 +1,17 @@
|
||||
//text;FontName;FontSize;FontColor;Bold;Italic;Underline;StrikeOut;Großkleinschreibung beachten?
|
||||
=;;;255;;;;;;
|
||||
0;;;8421376;;;;;;
|
||||
1;;;8421376;;;;;;
|
||||
2;;;8421376;;;;;;
|
||||
3;;;8421376;;;;;;
|
||||
4;;;8421376;;;;;;
|
||||
5;;;8421376;;;;;;
|
||||
6;;;8421376;;;;;;
|
||||
7;;;8421376;;;;;;
|
||||
8;;;8421376;;;;;;
|
||||
9;;;8421376;;;;;;
|
||||
//;;;16711935;;1;;;;
|
||||
ö;;;255;;;1;;;
|
||||
ä;;;255;;;1;;;
|
||||
ü;;;255;;;1;;;
|
||||
ß;;;255;;;1;;;
|
||||
35
TextPad.cfg
Normal file
35
TextPad.cfg
Normal file
@ -0,0 +1,35 @@
|
||||
-$A8
|
||||
-$B-
|
||||
-$C+
|
||||
-$D+
|
||||
-$E-
|
||||
-$F-
|
||||
-$G+
|
||||
-$H+
|
||||
-$I+
|
||||
-$J-
|
||||
-$K-
|
||||
-$L+
|
||||
-$M-
|
||||
-$N+
|
||||
-$O+
|
||||
-$P+
|
||||
-$Q-
|
||||
-$R-
|
||||
-$S-
|
||||
-$T-
|
||||
-$U-
|
||||
-$V+
|
||||
-$W-
|
||||
-$X+
|
||||
-$YD
|
||||
-$Z1
|
||||
-cg
|
||||
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
-H+
|
||||
-W+
|
||||
-M
|
||||
-$M16384,1048576
|
||||
-K$00400000
|
||||
-LE"c:\programme\delphi\delphi 6\Projects\Bpl"
|
||||
-LN"c:\programme\delphi\delphi 6\Projects\Bpl"
|
||||
83
TextPad.dof
Normal file
83
TextPad.dof
Normal file
@ -0,0 +1,83 @@
|
||||
[FileVersion]
|
||||
Version=6.0
|
||||
[Compiler]
|
||||
A=8
|
||||
B=0
|
||||
C=1
|
||||
D=1
|
||||
E=0
|
||||
F=0
|
||||
G=1
|
||||
H=1
|
||||
I=1
|
||||
J=0
|
||||
K=0
|
||||
L=1
|
||||
M=0
|
||||
N=1
|
||||
O=1
|
||||
P=1
|
||||
Q=0
|
||||
R=0
|
||||
S=0
|
||||
T=0
|
||||
U=0
|
||||
V=1
|
||||
W=0
|
||||
X=1
|
||||
Y=1
|
||||
Z=1
|
||||
ShowHints=1
|
||||
ShowWarnings=1
|
||||
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
[Linker]
|
||||
MapFile=0
|
||||
OutputObjs=0
|
||||
ConsoleApp=1
|
||||
DebugInfo=0
|
||||
RemoteSymbols=0
|
||||
MinStackSize=16384
|
||||
MaxStackSize=1048576
|
||||
ImageBase=4194304
|
||||
ExeDescription=
|
||||
[Directories]
|
||||
OutputDir=
|
||||
UnitOutputDir=
|
||||
PackageDLLOutputDir=
|
||||
PackageDCPOutputDir=
|
||||
SearchPath=
|
||||
Packages=vcl;rtl;vclx;VclSmp;vclshlctrls;fileinfo;gif;rotlab;Zip;Indy60;semipanel;trayico;MivSkinComponents
|
||||
Conditionals=
|
||||
DebugSourceDirs=
|
||||
UsePackages=0
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=
|
||||
Launcher=
|
||||
UseLauncher=0
|
||||
DebugCWD=
|
||||
[Version Info]
|
||||
IncludeVerInfo=0
|
||||
AutoIncBuild=0
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=0
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=1031
|
||||
CodePage=1252
|
||||
[Version Info Keys]
|
||||
CompanyName=
|
||||
FileDescription=
|
||||
FileVersion=1.0.0.0
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=
|
||||
14
TextPad.dpr
Normal file
14
TextPad.dpr
Normal file
@ -0,0 +1,14 @@
|
||||
program TextPad;
|
||||
|
||||
uses
|
||||
Forms,
|
||||
main in 'main.pas' {fTextPad},
|
||||
tpscript in 'tpscript.pas';
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TfTextPad, fTextPad);
|
||||
Application.Run;
|
||||
end.
|
||||
BIN
TextPad.res
Normal file
BIN
TextPad.res
Normal file
Binary file not shown.
103
main.dfm
Normal file
103
main.dfm
Normal file
@ -0,0 +1,103 @@
|
||||
object fTextPad: TfTextPad
|
||||
Left = 227
|
||||
Top = 181
|
||||
Width = 870
|
||||
Height = 640
|
||||
Caption = 'TextPad'
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
Menu = MainMenu
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object text: TRichEdit
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 862
|
||||
Height = 594
|
||||
Align = alClient
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Courier'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
OnChange = textChange
|
||||
end
|
||||
object MainMenu: TMainMenu
|
||||
Left = 96
|
||||
Top = 56
|
||||
object extPad1: TMenuItem
|
||||
Caption = 'TextPad'
|
||||
object Save1: TMenuItem
|
||||
Caption = 'Save'
|
||||
OnClick = Save1Click
|
||||
end
|
||||
object Saveas1: TMenuItem
|
||||
Caption = 'Save as'
|
||||
OnClick = Saveas1Click
|
||||
end
|
||||
object Open1: TMenuItem
|
||||
Caption = 'Open'
|
||||
OnClick = Open1Click
|
||||
end
|
||||
object N1: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object Exit1: TMenuItem
|
||||
Caption = 'Exit'
|
||||
OnClick = Exit1Click
|
||||
end
|
||||
end
|
||||
object Optionen1: TMenuItem
|
||||
Caption = 'Optionen'
|
||||
object Schrift1: TMenuItem
|
||||
Caption = 'Schrift'
|
||||
OnClick = Schrift1Click
|
||||
end
|
||||
object Script1: TMenuItem
|
||||
Caption = 'Script'
|
||||
end
|
||||
end
|
||||
object About1: TMenuItem
|
||||
Caption = 'About'
|
||||
OnClick = About1Click
|
||||
end
|
||||
end
|
||||
object dSchrift: TFontDialog
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
MinFontSize = 0
|
||||
MaxFontSize = 0
|
||||
Left = 96
|
||||
Top = 24
|
||||
end
|
||||
object Open: TOpenDialog
|
||||
DefaultExt = '.txt'
|
||||
Filter =
|
||||
'Text File (*.txt)|*.txt|Yeminy Text File (*.yem)|*.yem|Yeminy Co' +
|
||||
'nfig File (*.ycfg)|*.ycfg|Alle Files|*'
|
||||
Left = 64
|
||||
Top = 24
|
||||
end
|
||||
object Save: TSaveDialog
|
||||
DefaultExt = '.txt'
|
||||
Filter =
|
||||
'Text File (*.txt)|*.txt|Yeminy Text File (*.yem)|*.yem|Yeminy Co' +
|
||||
'nfig File (*.ycfg)|*.ycfg|Alle Files|*'
|
||||
Left = 64
|
||||
Top = 56
|
||||
end
|
||||
end
|
||||
255
main.pas
Normal file
255
main.pas
Normal file
@ -0,0 +1,255 @@
|
||||
unit main;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, Menus, StdCtrls, ComCtrls, about, ycfg, tpscript;
|
||||
|
||||
type
|
||||
TfTextPad = class(TForm)
|
||||
text: TRichEdit;
|
||||
MainMenu: TMainMenu;
|
||||
extPad1: TMenuItem;
|
||||
About1: TMenuItem;
|
||||
Schrift1: TMenuItem;
|
||||
Exit1: TMenuItem;
|
||||
dSchrift: TFontDialog;
|
||||
Save1: TMenuItem;
|
||||
Open1: TMenuItem;
|
||||
N1: TMenuItem;
|
||||
Open: TOpenDialog;
|
||||
Save: TSaveDialog;
|
||||
Optionen1: TMenuItem;
|
||||
Script1: TMenuItem;
|
||||
Saveas1: TMenuItem;
|
||||
procedure Exit1Click(Sender: TObject);
|
||||
procedure Schrift1Click(Sender: TObject);
|
||||
procedure loadconfig;
|
||||
procedure saveconfig;
|
||||
function askReally:word;
|
||||
procedure About1Click(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure Save1Click(Sender: TObject);
|
||||
procedure Saveas1Click(Sender: TObject);
|
||||
procedure Open1Click(Sender: TObject);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
procedure textChange(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
textname:string;
|
||||
scriptname:string;
|
||||
script:TScript;
|
||||
end;
|
||||
|
||||
var
|
||||
fTextPad: TfTextPad;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfTextPad.loadconfig;
|
||||
var temps:TStringlist;
|
||||
begin
|
||||
|
||||
if fileexists(extractfilepath(Application.exename)+'textpad.ycfg') then
|
||||
begin
|
||||
temps:=TStringlist.Create;
|
||||
|
||||
temps.LoadFromFile(extractfilepath(Application.exename)+'textpad.ycfg');
|
||||
|
||||
text.Font.Color:=getycfgint(temps,'Color',000000);
|
||||
text.Font.Name:=getycfgstr(temps,'Font');
|
||||
text.Font.Size:=getycfgint(temps,'Fontsize',12);
|
||||
if getycfgbool(temps,'Bold') then text.Font.Style := text.Font.Style + [fsBold] else text.Font.Style := text.Font.Style - [fsBold];
|
||||
if getycfgbool(temps,'Italic') then text.Font.Style := text.Font.Style + [fsItalic] else text.Font.Style := text.Font.Style - [fsItalic];
|
||||
if getycfgbool(temps,'Underline') then text.Font.Style := text.Font.Style + [fsUnderline] else text.Font.Style := text.Font.Style - [fsUnderline];
|
||||
if getycfgbool(temps,'StrikeOut') then text.Font.Style := text.Font.Style + [fsStrikeOut] else text.Font.Style := text.Font.Style - [fsStrikeOut];
|
||||
|
||||
scriptname:=extractfilepath(Application.exename)+getycfgstr(temps,'Script');
|
||||
|
||||
temps.Free;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfTextPad.saveconfig;
|
||||
var temps:TStringlist;
|
||||
begin
|
||||
|
||||
if fileexists(extractfilepath(Application.exename)+'textpad.ycfg') then
|
||||
begin
|
||||
temps:=TStringlist.Create;
|
||||
|
||||
temps.LoadFromFile(extractfilepath(Application.exename)+'textpad.ycfg');
|
||||
|
||||
setycfgint(temps,'Color',text.font.color);
|
||||
setycfgstr(temps,'Font',text.Font.Name);
|
||||
setycfgint(temps,'Fontsize',text.Font.size);
|
||||
if Integer(fsBold in Text.Font.Style)>0 then setycfgbool(temps,'Bold',true) else setycfgbool(temps,'Bold',false);
|
||||
if Integer(fsItalic in Text.Font.Style)>0 then setycfgbool(temps,'Italic',true) else setycfgbool(temps,'Italic',false);
|
||||
if Integer(fsUnderline in Text.Font.Style)>0 then setycfgbool(temps,'Underline',true) else setycfgbool(temps,'Underline',false);
|
||||
if Integer(fsStrikeOut in Text.Font.Style)>0 then setycfgbool(temps,'StrikeOut',true) else setycfgbool(temps,'StrikeOut',false);
|
||||
|
||||
temps.SaveToFile(extractfilepath(Application.exename)+'textpad.ycfg');
|
||||
|
||||
temps.Free;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfTextPad.Exit1Click(Sender: TObject);
|
||||
begin
|
||||
|
||||
Application.Terminate;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfTextPad.Schrift1Click(Sender: TObject);
|
||||
begin
|
||||
|
||||
dSchrift.Font:=text.Font;
|
||||
if dSchrift.Execute then text.Font:=dSchrift.Font;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfTextPad.About1Click(Sender: TObject);
|
||||
begin
|
||||
|
||||
showabout(Application);
|
||||
|
||||
end;
|
||||
|
||||
procedure TfTextPad.FormCreate(Sender: TObject);
|
||||
begin
|
||||
|
||||
loadconfig;
|
||||
|
||||
Script:=TScript.Create;
|
||||
|
||||
Script.loadscript(scriptname);
|
||||
|
||||
textname:='';
|
||||
|
||||
open.InitialDir:=extractfilepath(Application.exename);
|
||||
save.InitialDir:=extractfilepath(Application.exename);
|
||||
|
||||
text.SelLength:=2;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfTextPad.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
|
||||
saveconfig;
|
||||
|
||||
end;
|
||||
|
||||
function TfTextPad.askReally:word;
|
||||
begin
|
||||
|
||||
result:=messagedlg('Du hast nocht gespeichert - Daten Speichern?',mtwarning,[mbyes,mbno,mbAbort],0);
|
||||
|
||||
end;
|
||||
|
||||
procedure TfTextPad.Save1Click(Sender: TObject);
|
||||
var temps:TStringlist;
|
||||
begin
|
||||
|
||||
temps:=TStringlist.Create;
|
||||
|
||||
temps.Text:=text.Lines.Text;
|
||||
|
||||
if textname='' then
|
||||
begin
|
||||
if save.Execute then
|
||||
begin
|
||||
textname:=save.FileName;
|
||||
temps.SaveToFile(textname);
|
||||
|
||||
end;
|
||||
end else temps.SaveToFile(textname);
|
||||
|
||||
text.Modified:=false;
|
||||
|
||||
fTextPad.caption:='TextPad - '+extractfilename(textname);
|
||||
|
||||
temps.Free;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfTextPad.Saveas1Click(Sender: TObject);
|
||||
var temps:TStringlist;
|
||||
begin
|
||||
|
||||
temps:=TStringlist.Create;
|
||||
|
||||
temps.Text:=text.Lines.Text;
|
||||
|
||||
if save.Execute then
|
||||
begin
|
||||
textname:=save.FileName;
|
||||
temps.SaveToFile(textname);
|
||||
end;
|
||||
|
||||
text.Modified:=false;
|
||||
|
||||
fTextPad.caption:='TextPad - '+extractfilename(textname);
|
||||
|
||||
temps.Free;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfTextPad.Open1Click(Sender: TObject);
|
||||
var tempw:word;
|
||||
begin
|
||||
|
||||
if text.Modified then
|
||||
begin
|
||||
tempw:=askReally;
|
||||
|
||||
if tempw=mryes then Save1Click(self);
|
||||
if tempw=mrabort then exit;
|
||||
end;
|
||||
|
||||
if open.Execute then
|
||||
begin
|
||||
textname:=open.FileName;
|
||||
text.Lines.LoadFromFile(textname);
|
||||
end;
|
||||
|
||||
text.Modified:=false;
|
||||
|
||||
fTextPad.caption:='TextPad - '+extractfilename(textname);
|
||||
|
||||
end;
|
||||
|
||||
procedure TfTextPad.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
var tempw:word;
|
||||
begin
|
||||
|
||||
if text.Modified then
|
||||
begin
|
||||
tempw:=askReally;
|
||||
|
||||
if tempw=mryes then Save1Click(self);
|
||||
if tempw=mrabort then canclose:=false;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfTextPad.textChange(Sender: TObject);
|
||||
var temp:TPoint;
|
||||
begin
|
||||
|
||||
text.SelLength:=2;
|
||||
|
||||
if script.changedebug then script.setRich(text);
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
12
textpad.ycfg
Normal file
12
textpad.ycfg
Normal file
@ -0,0 +1,12 @@
|
||||
//textpad config
|
||||
|
||||
//Font
|
||||
Font=Fixedsys
|
||||
Fontsize=10
|
||||
Bold=1
|
||||
Italic=0
|
||||
Color=0
|
||||
Underline=0
|
||||
StrikeOut=0
|
||||
|
||||
Script=Script\ycfg.ysc
|
||||
164
tpscript.pas
Normal file
164
tpscript.pas
Normal file
@ -0,0 +1,164 @@
|
||||
unit tpscript;
|
||||
|
||||
interface
|
||||
|
||||
uses sysutils,classes,ycfg,ComCtrls,Graphics,dialogs,windows;
|
||||
|
||||
type TScriptPart = class
|
||||
public
|
||||
Text:string;
|
||||
FontName:string;
|
||||
FontSize:integer;
|
||||
FontColor:integer;
|
||||
Bold:integer;
|
||||
Italic:integer;
|
||||
Underline:integer;
|
||||
StrikeOut:integer;
|
||||
Grosskleinschreibung:boolean;
|
||||
BisZeilenEnde:boolean;
|
||||
NurSeperiert:boolean;
|
||||
VorrigesWort:boolean;
|
||||
NaechstesWort:boolean;
|
||||
|
||||
end;
|
||||
|
||||
type TScript = class
|
||||
public
|
||||
ScriptParts:array of TScriptPart;
|
||||
changedebug:boolean;
|
||||
Font:TFont;
|
||||
|
||||
procedure loadscript(Filepath:string);
|
||||
procedure setRich(Rich:TRichedit);
|
||||
|
||||
destructor destroy;
|
||||
constructor create;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
constructor Tscript.create;
|
||||
begin
|
||||
|
||||
changedebug:=true;
|
||||
|
||||
end;
|
||||
|
||||
procedure TScript.setRich(Rich:TRichedit);
|
||||
var i,j:integer;
|
||||
tempp:TPoint;
|
||||
font:TFont;
|
||||
begin
|
||||
|
||||
for i:=0 to length(ScriptParts)-1 do
|
||||
begin
|
||||
if ScriptParts[i].Grosskleinschreibung then
|
||||
begin
|
||||
if lowercase(copy(rich.lines.text,length(rich.lines.Text)-length(ScriptParts[i].text)-1,length(ScriptParts[i].text)))=lowercase(ScriptParts[i].text) then
|
||||
begin
|
||||
tempp:=rich.CaretPos;
|
||||
font:=rich.Font;
|
||||
changedebug:=false;
|
||||
rich.Lines.BeginUpdate;
|
||||
|
||||
rich.SelStart:=length(rich.lines.Text)-length(ScriptParts[i].text)-2;
|
||||
rich.SelLength:=length(ScriptParts[i].text);
|
||||
|
||||
changedebug:=false;
|
||||
|
||||
if ScriptParts[i].FontName<>'' then rich.SelAttributes.Name:=ScriptParts[i].FontName;
|
||||
if ScriptParts[i].FontSize>0 then rich.SelAttributes.Size:=ScriptParts[i].FontSize;
|
||||
if ScriptParts[i].FontColor>0 then rich.SelAttributes.Color:=ScriptParts[i].FontColor;
|
||||
if ScriptParts[i].Bold=0 then rich.SelAttributes.Style:=rich.SelAttributes.Style-[fsbold];
|
||||
if ScriptParts[i].Bold=1 then rich.SelAttributes.Style:=rich.SelAttributes.Style+[fsbold];
|
||||
if ScriptParts[i].italic=0 then rich.SelAttributes.Style:=rich.SelAttributes.Style-[fsitalic];
|
||||
if ScriptParts[i].italic=1 then rich.SelAttributes.Style:=rich.SelAttributes.Style+[fsitalic];
|
||||
if ScriptParts[i].underline=0 then rich.SelAttributes.Style:=rich.SelAttributes.Style-[fsunderline];
|
||||
if ScriptParts[i].underline=1 then rich.SelAttributes.Style:=rich.SelAttributes.Style+[fsunderline];
|
||||
if ScriptParts[i].strikeout=0 then rich.SelAttributes.Style:=rich.SelAttributes.Style-[fsstrikeout];
|
||||
if ScriptParts[i].strikeout=1 then rich.SelAttributes.Style:=rich.SelAttributes.Style+[fsstrikeout];
|
||||
|
||||
rich.CaretPos:=tempp;
|
||||
rich.SelLength:=2;
|
||||
rich.Font:=font;
|
||||
rich.Lines.EndUpdate;
|
||||
changedebug:=true;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
if lowercase(copy(rich.lines.text,length(rich.lines.Text)-length(ScriptParts[i].text)-1,length(ScriptParts[i].text)))=lowercase(ScriptParts[i].text) then
|
||||
begin
|
||||
tempp:=rich.CaretPos;
|
||||
font:=rich.Font;
|
||||
changedebug:=false;
|
||||
rich.Lines.BeginUpdate;
|
||||
|
||||
rich.SelStart:=length(rich.lines.Text)-length(ScriptParts[i].text)-2;
|
||||
rich.SelLength:=length(ScriptParts[i].text);
|
||||
|
||||
changedebug:=false;
|
||||
|
||||
if ScriptParts[i].FontName<>'' then rich.SelAttributes.Name:=ScriptParts[i].FontName;
|
||||
if ScriptParts[i].FontSize>0 then rich.SelAttributes.Size:=ScriptParts[i].FontSize;
|
||||
if ScriptParts[i].FontColor>0 then rich.SelAttributes.Color:=ScriptParts[i].FontColor;
|
||||
if ScriptParts[i].Bold=0 then rich.SelAttributes.Style:=rich.SelAttributes.Style-[fsbold];
|
||||
if ScriptParts[i].Bold=1 then rich.SelAttributes.Style:=rich.SelAttributes.Style+[fsbold];
|
||||
if ScriptParts[i].italic=0 then rich.SelAttributes.Style:=rich.SelAttributes.Style-[fsitalic];
|
||||
if ScriptParts[i].italic=1 then rich.SelAttributes.Style:=rich.SelAttributes.Style+[fsitalic];
|
||||
if ScriptParts[i].underline=0 then rich.SelAttributes.Style:=rich.SelAttributes.Style-[fsunderline];
|
||||
if ScriptParts[i].underline=1 then rich.SelAttributes.Style:=rich.SelAttributes.Style+[fsunderline];
|
||||
if ScriptParts[i].strikeout=0 then rich.SelAttributes.Style:=rich.SelAttributes.Style-[fsstrikeout];
|
||||
if ScriptParts[i].strikeout=1 then rich.SelAttributes.Style:=rich.SelAttributes.Style+[fsstrikeout];
|
||||
|
||||
rich.CaretPos:=tempp;
|
||||
rich.SelLength:=2;
|
||||
rich.Font:=font;
|
||||
rich.Lines.EndUpdate;
|
||||
changedebug:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TScript.loadscript(Filepath:string);
|
||||
var temps:TStringlist;
|
||||
i:integer;
|
||||
begin
|
||||
|
||||
if fileexists(filepath) then
|
||||
begin
|
||||
temps:=TStringlist.create;
|
||||
temps.LoadFromFile(filepath);
|
||||
for i:=0 to temps.Count-1 do
|
||||
begin
|
||||
if getnumberofdivides(temps.Strings[i],';')>=9 then
|
||||
begin
|
||||
setlength(Scriptparts,length(scriptparts)+1);
|
||||
Scriptparts[length(scriptparts)-1]:=TScriptpart.Create;
|
||||
Scriptparts[length(scriptparts)-1].Text:=dividestring(temps.Strings[i],';',1);
|
||||
Scriptparts[length(scriptparts)-1].FontName:=dividestring(temps.Strings[i],';',2);
|
||||
Scriptparts[length(scriptparts)-1].FontSize:=strtointdef(dividestring(temps.Strings[i],';',3),-1);
|
||||
Scriptparts[length(scriptparts)-1].FontColor:=strtointdef(dividestring(temps.Strings[i],';',4),-1);
|
||||
Scriptparts[length(scriptparts)-1].Bold:=strtointdef(dividestring(temps.Strings[i],';',5),-1);
|
||||
Scriptparts[length(scriptparts)-1].Italic:=strtointdef(dividestring(temps.Strings[i],';',6),-1);
|
||||
Scriptparts[length(scriptparts)-1].Underline:=strtointdef(dividestring(temps.Strings[i],';',7),-1);
|
||||
Scriptparts[length(scriptparts)-1].StrikeOut:=strtointdef(dividestring(temps.Strings[i],';',8),-1);
|
||||
if dividestring(temps.Strings[i],';',9)='1' then Scriptparts[length(scriptparts)-1].Grosskleinschreibung:=true else Scriptparts[length(scriptparts)-1].Grosskleinschreibung:=false;
|
||||
end;
|
||||
end;
|
||||
temps.Free;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
destructor TScript.destroy;
|
||||
var i:integer;
|
||||
begin
|
||||
|
||||
for i:=0 to length(ScriptParts)-1 do Scriptparts[i].Free;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user