TabChange added

This commit is contained in:
2018-06-01 21:24:44 +03:00
parent 258dfbff07
commit dd82a79ed3

View File

@@ -18,9 +18,12 @@ uses
type type
TAGLog=class abstract TAGLog=class abstract
strict protected strict protected
OneTabStr:string;
tabs:cardinal; tabs:cardinal;
tabstr:string; tabstr:string;
constructor Create(); constructor Create();
procedure TabRegen();
procedure SetTabText(const s:string);virtual;
const const
CBaseTab='--------------------------'; CBaseTab='--------------------------';
public public
@@ -30,6 +33,7 @@ type
procedure UnTab();virtual; procedure UnTab();virtual;
procedure Write(const Text:string;o:TObject=nil);overload;virtual;abstract; procedure Write(const Text:string;o:TObject=nil);overload;virtual;abstract;
destructor Destroy();override; destructor Destroy();override;
property TabText:string read OneTabStr write SetTabText;
end; end;
TAGRamLog=class(TAGLog) TAGRamLog=class(TAGLog)
@@ -96,6 +100,8 @@ type
end; end;
TAGMultiLog=class(TAGLog) TAGMultiLog=class(TAGLog)
strict protected
procedure SetTabText(const s:string);override;
public public
type type
TLogsList={$IFDEF FPC}specialize TFPGList<TAGLog>{$ELSE}TList<TAGLog>{$ENDIF}; TLogsList={$IFDEF FPC}specialize TFPGList<TAGLog>{$ELSE}TList<TAGLog>{$ENDIF};
@@ -110,12 +116,15 @@ type
const const
CharSize=SizeOf(char);//{$IFDEF FPC}1{$ELSE}2{$ENDIF}; CharSize=SizeOf(char);//{$IFDEF FPC}1{$ELSE}2{$ENDIF};
DefOneTabStr=' ';
Implementation Implementation
constructor TAGLog.Create(); constructor TAGLog.Create();
begin begin
Self.Write(CBaseTab+'Logging init-'+CBaseTab); Self.Write(CBaseTab+'Logging init-'+CBaseTab);
TabRegen;
OneTabStr:=DefOneTabStr;
end; end;
class function TAGLog.SizeableWordtoStr(i:word;size:int8):string; class function TAGLog.SizeableWordtoStr(i:word;size:int8):string;
@@ -164,6 +173,21 @@ dec(tabs);
Delete(tabstr,1,2); Delete(tabstr,1,2);
end; end;
procedure TAGLog.TabRegen();
var
i:cardinal;
begin
tabstr:='';
for i:=1 to tabs do
tabstr:=tabstr+OneTabStr;
end;
procedure TAGLog.SetTabText(const s:string);
begin
OneTabStr:=s;
TabRegen;
end;
destructor TAGLog.Destroy(); destructor TAGLog.Destroy();
begin begin
Self.Write(CBaseTab+'Logging ended'+CBaseTab); Self.Write(CBaseTab+'Logging ended'+CBaseTab);
@@ -366,6 +390,14 @@ end;
{TAGMultiLog} {TAGMultiLog}
procedure TAGMultiLog.SetTabText(const s:string);
var
i:TAGLog;
begin
for i in Logs do
i.TabText:=s;
end;
constructor TAGMultiLog.Create(Default:TLogsList); constructor TAGMultiLog.Create(Default:TLogsList);
begin begin
//inherited Create; //inherited Create;