LazReport, use debug output facilities from lclproc

git-svn-id: trunk@28623 -
This commit is contained in:
jesus 2010-12-04 20:20:34 +00:00
parent 074cd19dbd
commit dec60d59d3
2 changed files with 170 additions and 210 deletions

View File

@ -1267,21 +1267,6 @@ var
MaxTitleSize: Integer = 0; MaxTitleSize: Integer = 0;
{$IFDEF DebugLR} {$IFDEF DebugLR}
var
wspc: integer = 4;
nspc: integer = 0;
sspc: string = '';
procedure IncSpc(aInc:Integer);
begin
nspc := nspc + aInc;
if nspc<0 then
nspc := 0;
//WriteLn('[',nspc,']');
SetLength(sspc, nspc*wspc);
if aInc>0 then
fillchar(sspc[1], nspc*wspc, ' ');
end;
function Bandtyp2str(typ: TfrBandType): string; function Bandtyp2str(typ: TfrBandType): string;
begin begin
case typ of case typ of
@ -1418,7 +1403,7 @@ begin
for i := 0 to frAddInsCount - 1 do for i := 0 to frAddInsCount - 1 do
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sfrCreateObject classname compare %s=%s',[sspc,frAddIns[i].ClassRef.ClassName,ClassName]); DebugLn('frCreateObject classname compare %s=%s',[frAddIns[i].ClassRef.ClassName,ClassName]);
{$ENDIF} {$ENDIF}
if frAddIns[i].ClassRef.ClassName = ClassName then if frAddIns[i].ClassRef.ClassName = ClassName then
@ -1437,7 +1422,7 @@ begin
if Result <> nil then if Result <> nil then
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sfrCreateObject instance classname=%s',[sspc,ClassName]); DebugLn('frCreateObject instance classname=%s',[ClassName]);
{$ENDIF} {$ENDIF}
Result.ID := ObjID; Result.ID := ObjID;
@ -1662,7 +1647,7 @@ begin
wy1 := Round((FrameWidth * ScaleY - 1) / 2); wy1 := Round((FrameWidth * ScaleY - 1) / 2);
wy2 := Round(FrameWidth * ScaleY / 2); wy2 := Round(FrameWidth * ScaleY / 2);
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sCalcGaps: dx=%d ScaleX=%f',[sspc,dx,ScaleX]); DebugLn('CalcGaps: dx=%d ScaleX=%f',[dx,ScaleX]);
{$ENDIF} {$ENDIF}
fFrameWidth := FrameWidth * ScaleX; fFrameWidth := FrameWidth * ScaleX;
gapx := wx2 + 2; gapx := wx2 + 2;
@ -1840,7 +1825,7 @@ end;
procedure TfrView.Print(Stream: TStream); procedure TfrView.Print(Stream: TStream);
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s%s.TfrView.Print()',[sspc,name]); DebugLn('%s.TfrView.Print()',[name]);
{$ENDIF} {$ENDIF}
BeginDraw(Canvas); BeginDraw(Canvas);
Memo1.Assign(Memo); Memo1.Assign(Memo);
@ -1853,7 +1838,7 @@ begin
frWriteString(Stream, ClassName); frWriteString(Stream, ClassName);
SaveToStream(Stream); SaveToStream(Stream);
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s%s.TfrView.Print() end',[sspc,name]); DebugLn('%s.TfrView.Print() end',[name]);
{$ENDIF} {$ENDIF}
end; end;
@ -1869,8 +1854,8 @@ var
i : Integer; i : Integer;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s%s.TfrView.LoadFromStream begin StreamMode=%d ClassName=%s', DebugLn('%s.TfrView.LoadFromStream begin StreamMode=%d ClassName=%s',
[sspc,name,Ord(StreamMode),ClassName]); [name,Ord(StreamMode),ClassName]);
{$ENDIF} {$ENDIF}
with Stream do with Stream do
begin begin
@ -1917,7 +1902,7 @@ begin
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s%s.TfrView.LoadFromStream end',[sspc,name]); DebugLn('%s.TfrView.LoadFromStream end',[name]);
{$ENDIF} {$ENDIF}
end; end;
@ -1970,7 +1955,7 @@ var
B: Integer; B: Integer;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s%s.SaveToStream begin',[sspc,name]); DebugLn('%s.SaveToStream begin',[name]);
{$ENDIF} {$ENDIF}
with Stream do with Stream do
@ -2010,7 +1995,7 @@ begin
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
Debugln('%s%s.SaveToStream end',[sspc,name]); Debugln('%s.SaveToStream end',[name]);
{$ENDIF} {$ENDIF}
end; end;
@ -2489,7 +2474,7 @@ begin
with aCanvas do with aCanvas do
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sAssignFont(%s)',[sspc,self.Font.Name]); DebugLn('AssignFont(%s)',[self.Font.Name]);
{$ENDIF} {$ENDIF}
//** Brush.Style := bsClear; //** Brush.Style := bsClear;
Font.Assign(Self.Font); Font.Assign(Self.Font);
@ -2542,9 +2527,9 @@ begin
until i > Len - 2; until i > Len - 2;
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(1); DebugLnEnter('');
debugLn('%sbreakword: s=%s result=%s',[sspc,dbgstr(s),dbgstr(result)]); debugLn('breakword: s=%s result=%s',[dbgstr(s),dbgstr(result)]);
IncSpc(-1); DebugLnExit('');
{$ENDIF} {$ENDIF}
end; end;
@ -2564,7 +2549,7 @@ var
w := WCanvas.TextWidth(Copy(str, 1, n - 1)) else w := WCanvas.TextWidth(Copy(str, 1, n - 1)) else
w := WCanvas.TextWidth(str); w := WCanvas.TextWidth(str);
{$IFDEF DebugLR} {$IFDEF DebugLR}
debugLn('%sOutline: str="%s" w/=%d w%%=%d',[sspc, str,w div 256, w mod 256]); debugLn('Outline: str="%s" w/=%d w%%=%d',[str,w div 256, w mod 256]);
{$ENDIF} {$ENDIF}
SMemo.Add(str + Chr(w div 256) + Chr(w mod 256)); SMemo.Add(str + Chr(w div 256) + Chr(w mod 256));
Inc(size, size1); Inc(size, size1);
@ -2698,7 +2683,7 @@ var
size1 := -WCanvas.Font.Height + LineSpacing; size1 := -WCanvas.Font.Height + LineSpacing;
maxWidth := dx - gapx - gapx; maxWidth := dx - gapx - gapx;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sOutMemo: Size=%d Size1=%d MaxWidth=%d dx=%d gapx=%d',[sspc,Size,Size1,MaxWidth,dx,gapx]); DebugLn('OutMemo: Size=%d Size1=%d MaxWidth=%d dx=%d gapx=%d',[Size,Size1,MaxWidth,dx,gapx]);
{$ENDIF} {$ENDIF}
for i := 0 to Memo1.Count - 1 do for i := 0 to Memo1.Count - 1 do
begin begin
@ -2740,9 +2725,8 @@ begin
WCanvas.Font.Assign(Font); WCanvas.Font.Assign(Font);
WCanvas.Font.Height := -Round(Font.Size * 96 / 72); WCanvas.Font.Height := -Round(Font.Size * 96 / 72);
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrMemoView.WrapMemo INI Font.PPI=%d Font.Size=%d Canvas.Font.PPI=%d WCanvas.Font.Size=%d', DebugLnEnter('TfrMemoView.WrapMemo INI Font.PPI=%d Font.Size=%d Canvas.Font.PPI=%d WCanvas.Font.Size=%d',
[sspc, Font.PixelsPerInch, Font.Size,Canvas.Font.PixelsPerInch,WCanvas.Font.Size]); [Font.PixelsPerInch, Font.Size,Canvas.Font.PixelsPerInch,WCanvas.Font.Size]);
IncSpc(1);
{$ENDIF} {$ENDIF}
SetTextCharacterExtra(WCanvas.Handle, CharacterSpacing); SetTextCharacterExtra(WCanvas.Handle, CharacterSpacing);
@ -2752,8 +2736,7 @@ begin
else else
OutMemo; OutMemo;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrMemoView.WrapMemo DONE',[]);
DebugLn('%sTfrMemoView.WrapMemo DONE',[sspc]);
{$ENDIF} {$ENDIF}
end; end;
@ -2801,7 +2784,7 @@ var
nw := Round(w * ScaleX); // needed width nw := Round(w * ScaleX); // needed width
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sCanvas.Font.Size=%d TextWidth=%d',[sspc,Canvas.Font.Size,Canvas.TextWidth(St)]); DebugLn('Canvas.Font.Size=%d TextWidth=%d',[Canvas.Font.Size,Canvas.TextWidth(St)]);
{$ENDIF} {$ENDIF}
(* (*
while (Canvas.TextWidth(St) > nw) and (Canvas.Font.Size>1) do while (Canvas.TextWidth(St) > nw) and (Canvas.Font.Size>1) do
@ -2814,10 +2797,10 @@ var
*) *)
th := -Canvas.Font.Height+Round(LineSpacing * ScaleY); th := -Canvas.Font.Height+Round(LineSpacing * ScaleY);
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTh=%d Canvas.TextHeight(H)=%d',[sspc,Th,Canvas.TextHeight('H')]); DebugLn('Th=%d Canvas.TextHeight(H)=%d',[Th,Canvas.TextHeight('H')]);
Debugln('%sCanvas.Font.Size=%d TextWidth=%d',[sspc,Canvas.Font.Size,Canvas.TextWidth(St)]); Debugln('Canvas.Font.Size=%d TextWidth=%d',[Canvas.Font.Size,Canvas.TextWidth(St)]);
aw := Canvas.TextWidth(St); // actual width aw := Canvas.TextWidth(St); // actual width
DebugLn('%snw=%d aw=%d',[sspc,nw,aw]); DebugLn('nw=%d aw=%d',[nw,aw]);
{$ENDIF} {$ENDIF}
case Alignment of case Alignment of
Classes.taLeftJustify : CurX :=x+gapx; Classes.taLeftJustify : CurX :=x+gapx;
@ -2843,7 +2826,7 @@ var
th := -Canvas.Font.Height+Round(LineSpacing * ScaleY); th := -Canvas.Font.Height+Round(LineSpacing * ScaleY);
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTh=%d Canvas.TextHeight(H)=%d DR=%s',[sspc,Th,Canvas.TextHeight('H'),dbgs(DR)]); DebugLn('Th=%d Canvas.TextHeight(H)=%d DR=%s',[Th,Canvas.TextHeight('H'),dbgs(DR)]);
{$ENDIF} {$ENDIF}
CurStrNo := 0; CurStrNo := 0;
@ -2977,16 +2960,14 @@ var
DTFlags: Cardinal; DTFlags: Cardinal;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DbgOut('%sTfrMemoView.CalcWidth INIT text=%s Font.PPI=%d Font.Size=%d dx=%d dy=%d', DebugLnEnter('TfrMemoView.CalcWidth INIT text=%s Font.PPI=%d Font.Size=%d dx=%d dy=%d',
[sspc,aMemo.Text,Font.PixelsPerInch,Font.Size,Dx,dy]); [aMemo.Text,Font.PixelsPerInch,Font.Size,Dx,dy]);
IncSpc(1);
{$ENDIF} {$ENDIF}
CalcRect := Rect(0, 0, dx, dy); CalcRect := Rect(0, 0, dx, dy);
Canvas.Font.Assign(Font); Canvas.Font.Assign(Font);
Canvas.Font.Height := -Round(Font.Size * 96 / 72); Canvas.Font.Height := -Round(Font.Size * 96 / 72);
{$IFDEF DebugLR} {$IFDEF DebugLR}
DbgOut('%sCanvas.Font.PPI=%d Canvas.Font.Size=%d', DebugLn('Canvas.Font.PPI=%d Canvas.Font.Size=%d',[Canvas.Font.PixelsPerInch,Canvas.Font.Size]);
[sspc,Canvas.Font.PixelsPerInch,Canvas.Font.Size]);
{$ENDIF} {$ENDIF}
DTFlags := DT_CALCRECT; DTFlags := DT_CALCRECT;
if Flags and flWordBreak <> 0 then if Flags and flWordBreak <> 0 then
@ -3001,8 +2982,7 @@ begin
DrawText(Canvas.Handle, PChar(s), Length(s), CalcRect, DTFlags); DrawText(Canvas.Handle, PChar(s), Length(s), CalcRect, DTFlags);
Result := CalcRect.Right + Round(2 * FrameWidth) + 2; Result := CalcRect.Right + Round(2 * FrameWidth) + 2;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrMemoView.CalcWidth DONE Width=%d Rect=%s',[Result,dbgs(CalcRect)]);
DbgOut('%sTfrMemoView.CalcWidth DONE Width=%d Rect=%s',[sspc,Result,dbgs(CalcRect)]);
{$ENDIF} {$ENDIF}
end; end;
@ -3017,8 +2997,8 @@ begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
if IsPrinting then begin if IsPrinting then begin
DebugLn(''); DebugLn('');
Debugln('%sTfrMemoView.Draw: Name=%s Printing=%s Canvas.Font.PPI=%d', Debugln('TfrMemoView.Draw: Name=%s Printing=%s Canvas.Font.PPI=%d',
[sspc,Name,dbgs(IsPrinting),Canvas.Font.PixelsPerInch]); [Name,dbgs(IsPrinting),Canvas.Font.PixelsPerInch]);
end; end;
NewDx := 0; NewDx := 0;
{$ENDIF} {$ENDIF}
@ -3035,7 +3015,7 @@ begin
dx := newdx; dx := newdx;
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sNewDx=%d Dx=%d',[sspc,NewDx,dx]); DebugLn('NewDx=%d Dx=%d',[NewDx,dx]);
{$ENDIF} {$ENDIF}
Streaming := False; Streaming := False;
Memo1.Assign(Memo); Memo1.Assign(Memo);
@ -3052,8 +3032,7 @@ begin
begin begin
NeedWrap := Pos(#1, Memo1.Text) = 0; NeedWrap := Pos(#1, Memo1.Text) = 0;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sMemo1: Count=%d Text=%s NeedWrap=%s', DebugLn('Memo1: Count=%d Text=%s NeedWrap=%s', [Memo1.Count,dbgstr(Memo1.text),dbgs(needwrap)]);
[sspc,Memo1.Count,dbgstr(Memo1.text),dbgs(needwrap)]);
{$ENDIF} {$ENDIF}
if Memo1[Memo1.Count - 1] = #1 then if Memo1[Memo1.Count - 1] = #1 then
Memo1.Delete(Memo1.Count - 1); Memo1.Delete(Memo1.Count - 1);
@ -3092,7 +3071,7 @@ var
i: Integer; i: Integer;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrMemoView.Print %s',[sspc,Name]); DebugLn('TfrMemoView.Print %s',[Name]);
{$ENDIF} {$ENDIF}
BeginDraw(TempBmp.Canvas); BeginDraw(TempBmp.Canvas);
Streaming := True; Streaming := True;
@ -3243,7 +3222,7 @@ var
TmpLayout: TTextLayout; TmpLayout: TTextLayout;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sStream.Position=%d Stream.Size=%d',[sspc,Stream.Position,Stream.Size]); DebugLn('Stream.Position=%d Stream.Size=%d',[Stream.Position,Stream.Size]);
{$ENDIF} {$ENDIF}
inherited LoadFromStream(Stream); inherited LoadFromStream(Stream);
@ -4113,8 +4092,7 @@ var
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrPictureView.Draw INI',[sspc]); DebugLnEnter('TfrPictureView.Draw INI');
IncSpc(1);
{$ENDIF} {$ENDIF}
BeginDraw(aCanvas); BeginDraw(aCanvas);
CalcGaps; CalcGaps;
@ -4174,8 +4152,7 @@ begin
end; end;
RestoreCoord; RestoreCoord;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrPictureView.Draw DONE');
DebugLn('%sTfrPictureView.Draw DONE',[sspc]);
{$ENDIF} {$ENDIF}
end; end;
@ -4795,9 +4772,8 @@ var
ox,oy: Integer; ox,oy: Integer;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrBand.DrawObject INI t=%s:%s Xadj=%d Margin=%d DiableDrawing=%s', DebugLnEnter('TfrBand.DrawObject INI t=%s:%s Xadj=%d Margin=%d DiableDrawing=%s',
[sspc,dbgsname(t),t.name,Parent.XAdjust,Parent.LeftMargin,BoolToStr(DisableDrawing,true)]); [dbgsname(t),t.name,Parent.XAdjust,Parent.LeftMargin,BoolToStr(DisableDrawing,true)]);
IncSpc(1);
{$ENDIF} {$ENDIF}
CurPage := Parent; CurPage := Parent;
CurBand := Self; CurBand := Self;
@ -4808,12 +4784,11 @@ begin
ox := t.x; Inc(t.x, Parent.XAdjust - Parent.LeftMargin); ox := t.x; Inc(t.x, Parent.XAdjust - Parent.LeftMargin);
oy := t.y; Inc(t.y, y); oy := t.y; Inc(t.y, y);
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sPrinting view %s x=%d y=%d dx=%d dy=%d',[sspc,ViewInfo(t),t.x,t.y,t.dx,t.dy]); DebugLnEnter('Printing view %s x=%d y=%d dx=%d dy=%d',[ViewInfo(t),t.x,t.y,t.dx,t.dy]);
IncSpc(1);
{$ENDIF} {$ENDIF}
t.Print(MasterReport.EMFPages[PageNo]^.Stream); t.Print(MasterReport.EMFPages[PageNo]^.Stream);
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('');
{$ENDIF} {$ENDIF}
t.x := ox; t.y := oy; t.x := ox; t.y := oy;
if (t is TfrMemoView) and if (t is TfrMemoView) and
@ -4824,8 +4799,7 @@ begin
on exception do DoError; on exception do DoError;
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrBand.DrawObject DONE t=%s:%s',[dbgsname(t),t.name]);
DebugLn('%sTfrBand.DrawObject DONE t=%s:%s',[sspc,dbgsname(t),t.name]);
{$ENDIF} {$ENDIF}
end; end;
@ -4913,8 +4887,7 @@ var
t: TfrView; t: TfrView;
begin begin
{$ifdef DebugLR} {$ifdef DebugLR}
DebugLn('%sDrawObjects INIT',[sspc]); DebugLnEnter('DrawObjects INIT');
IncSpc(1);
{$endif} {$endif}
Result := False; Result := False;
for i := 0 to Objects.Count - 1 do for i := 0 to Objects.Count - 1 do
@ -4937,8 +4910,7 @@ begin
if MasterReport.Terminated then break; if MasterReport.Terminated then break;
end; end;
{$ifdef DebugLR} {$ifdef DebugLR}
IncSpc(-1); DebugLnExit('DrawObjects DONE result=%s',[BoolToStr(result,true)]);
DebugLn('%sDrawObjects DONE result=%s',[sspc,BoolToStr(result,true)]);
{$endif} {$endif}
end; end;
@ -5091,15 +5063,12 @@ end;
function TfrBand.CheckPageBreak(ay, ady: Integer; PBreak: Boolean): Boolean; function TfrBand.CheckPageBreak(ay, ady: Integer; PBreak: Boolean): Boolean;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrBand.CheckPageBreak INI ay=%d ady=%d Pbreak=%d', DebugLnEnter('TfrBand.CheckPageBreak INI ay=%d ady=%d Pbreak=%d',[ay,ady,ord(pbreak)]);
[sspc,ay,ady,ord(pbreak)]);
IncSpc(1);
{$ENDIF} {$ENDIF}
Result := False; Result := False;
with Parent do begin with Parent do begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%say+dy+ady=%d CurBottomY=%d', DebugLn('say+dy+ady=%d CurBottomY=%d',[ay+Bands[btColumnFooter].dy+ady,CurBottomY]);
[sspc, ay+Bands[btColumnFooter].dy+ady,CurBottomY]);
{$ENDIF} {$ENDIF}
if not RowsLayout then begin if not RowsLayout then begin
if ay + Bands[btColumnFooter].dy + ady > CurBottomY then if ay + Bands[btColumnFooter].dy + ady > CurBottomY then
@ -5111,9 +5080,7 @@ begin
end; end;
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrBand.CheckPageBreak END ay=%d ady=%d Result=%d',[ay,ady,ord(Result)]);
DebugLn('%sTfrBand.CheckPageBreak END ay=%d ady=%d Result=%d',
[sspc,ay,ady,ord(Result)]);
{$ENDIF} {$ENDIF}
end; end;
@ -5125,15 +5092,15 @@ begin
if (CurColumn=0) and (typ=btMasterData) then begin if (CurColumn=0) and (typ=btMasterData) then begin
BandHeight := DoCalcHeight; BandHeight := DoCalcHeight;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrBand.CheckNextColumn INI CurY=%d BHeight=%d CurY+BH=%d CurBottomY=%d', DebugLn('TfrBand.CheckNextColumn INI CurY=%d BHeight=%d CurY+BH=%d CurBottomY=%d',
[sspc,CurY,BandHeight,CurY+BandHeight,CurBottomY]); [CurY,BandHeight,CurY+BandHeight,CurBottomY]);
{$ENDIF} {$ENDIF}
// check left height space when on last column // check left height space when on last column
if CurY + BandHeight>CurBottomY then if CurY + BandHeight>CurBottomY then
NewPage; NewPage;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrBand.CheckNextColumn END CurY=%d BHeight=%d CurY+BH=%d CurBottomY=%d', DebugLn('TfrBand.CheckNextColumn END CurY=%d BHeight=%d CurY+BH=%d CurBottomY=%d',
[sspc,CurY,BandHeight,CurY+BandHeight,CurBottomY]); [CurY,BandHeight,CurY+BandHeight,CurBottomY]);
{$ENDIF} {$ENDIF}
end; end;
end; end;
@ -5162,8 +5129,7 @@ var
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sDrawPageBreak INI y=%d Maxdy=%d',[sspc,y,maxdy]); DebugLnEnter('DrawPageBreak INI y=%d Maxdy=%d',[y,maxdy]);
IncSpc(1);
{$ENDIF} {$ENDIF}
for i := 0 to Objects.Count - 1 do for i := 0 to Objects.Count - 1 do
begin begin
@ -5183,14 +5149,12 @@ begin
if t is TfrMemoView then if t is TfrMemoView then
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sCalcHeight Memo INI',[sspc]); DebugLnEnter('CalcHeight Memo INI');
IncSpc(1);
{$ENDIF} {$ENDIF}
TfrMemoView(t).CalcHeight; // wraps a memo onto separate lines TfrMemoView(t).CalcHeight; // wraps a memo onto separate lines
t.Memo1.Assign(SMemo); t.Memo1.Assign(SMemo);
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('CalcHeight Memo DONE');
DebugLn('%sCalcHeight Memo DONE',[sspc]);
{$ENDIF} {$ENDIF}
end; end;
end; end;
@ -5277,8 +5241,7 @@ begin
end; end;
Inc(Parent.CurY, maxdy); Inc(Parent.CurY, maxdy);
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('DrawPageBreak END Parent.CurY=%d',[Parent.CurY]);
DebugLn('%sDrawPageBreak END Parent.CurY=%d',[sspc,Parent.CurY]);
{$ENDIF} {$ENDIF}
end; end;
@ -5311,9 +5274,8 @@ begin
if UseY then if UseY then
y := Parent.CurY; y := Parent.CurY;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrBand.DoDraw INI Band=%s sfy=%d y=%d dy=%d XAdjust=%d CurY=%d Stretch=%d PageBreak=%d', DebugLnEnter('TfrBand.DoDraw INI Band=%s sfy=%d y=%d dy=%d XAdjust=%d CurY=%d Stretch=%d PageBreak=%d',
[sspc, bandInfo(self), sfy, y, dy, Parent.XAdjust, parent.cury, Ord(Stretched), Ord(PageBreak)]); [bandInfo(self), sfy, y, dy, Parent.XAdjust, parent.cury, Ord(Stretched), Ord(PageBreak)]);
IncSpc(1);
{$ENDIF} {$ENDIF}
Parent.RowStarted := True; Parent.RowStarted := True;
@ -5382,9 +5344,8 @@ begin
Parent.DoAggregate([btPageFooter, btMasterFooter, btDetailFooter, Parent.DoAggregate([btPageFooter, btMasterFooter, btDetailFooter,
btSubDetailFooter, btGroupFooter, btReportSummary]); btSubDetailFooter, btGroupFooter, btReportSummary]);
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrBand.DoDraw END sfy=%d y=%d dy=%d xadjust=%d CurY=%d',
DebugLn('%sTfrBand.DoDraw END sfy=%d y=%d dy=%d xadjust=%d CurY=%d', [sfy, y, dy, parent.xadjust, parent.cury]);
[sspc, sfy, y, dy, parent.xadjust, parent.cury]);
{$ENDIF} {$ENDIF}
end; end;
@ -5415,8 +5376,7 @@ var
b: TfrBand; b: TfrBand;
begin begin
{$IFDEF debugLr} {$IFDEF debugLr}
DebugLn('%sTFrBand.Draw INI Band=%s y=%d vis=%s',[sspc,BandInfo(self),y,BoolToStr(Visible,true)]); DebugLnEnter('TFrBand.Draw INI Band=%s y=%d vis=%s',[BandInfo(self),y,BoolToStr(Visible,true)]);
IncSpc(1);
{$endif} {$endif}
Result := False; Result := False;
CurView := View; CurView := View;
@ -5531,8 +5491,7 @@ begin
Parent.LastBandType := typ; Parent.LastBandType := typ;
{$IFDEF debugLr} {$IFDEF debugLr}
IncSpc(-1); DebugLnExit('TFrBand.Draw END %s y=%d PageNo=%d EOFReached=',[dbgsname(self),y, PageNo]);
DebugLn('%sTFrBand.Draw END %s y=%d PageNo=%d EOFReached=',[sspc, dbgsname(self),y, PageNo]);
{$endif} {$endif}
end; end;
@ -5580,14 +5539,13 @@ var
v: Boolean; v: Boolean;
begin begin
{$ifdef DebugLR} {$ifdef DebugLR}
DebugLn('%sTfrBand.DoAggregate INIT Band=%s',[sspc, BandInfo(self)]); DebugLnEnter('TfrBand.DoAggregate INIT Band=%s',[BandInfo(self)]);
IncSpc(1);
{$endif} {$endif}
for i := 0 to Values.Count - 1 do for i := 0 to Values.Count - 1 do
begin begin
s := Values[i]; s := Values[i];
{$ifdef DebugLR} {$ifdef DebugLR}
DbgOut(sspc,'Mangling Values[',dbgs(i),']=',QuotedStr(DecodeValue(s)),' ==> '); DbgOut('Mangling Values[',dbgs(i),']=',QuotedStr(DecodeValue(s)),' ==> ');
{$endif} {$endif}
Values[i] := Copy(s, 1, Pos('=', s) - 1) + '=0' + Copy(s, Pos('=', s) + 2, 255); Values[i] := Copy(s, 1, Pos('=', s) - 1) + '=0' + Copy(s, Pos('=', s) + 2, 255);
{$ifdef DebugLR} {$ifdef DebugLR}
@ -5608,8 +5566,7 @@ begin
Visible := v; Visible := v;
Inc(Count); Inc(Count);
{$ifdef DebugLR} {$ifdef DebugLR}
IncSpc(-1); DebugLnExit('TfrBand.DoAggregate DONE Band=%s',[BandInfo(self)]);
DebugLn('%sTfrBand.DoAggregate DONE Band=%s',[sspc, BandInfo(self)]);
{$endif} {$endif}
end; end;
@ -6105,8 +6062,7 @@ var
Field: TfrTField; Field: TfrTField;
begin begin
{$ifdef DebugLR} {$ifdef DebugLR}
DebugLn('%sTfrPage.PrepareObjects INIT',[sspc]); DebugLnEnter('TfrPage.PrepareObjects INIT');
IncSpc(1);
{$endif} {$endif}
CurPage := Self; CurPage := Self;
@ -6132,7 +6088,7 @@ begin
if Field <> nil then if Field <> nil then
begin begin
{$ifdef DebugLR} {$ifdef DebugLR}
DebugLn('%sFor View=%s found Field=%s',[sspc,ViewInfo(t),Field.FieldName]); DebugLn('For View=%s found Field=%s',[ViewInfo(t),Field.FieldName]);
{$endif} {$endif}
t.FDataSet := DSet; t.FDataSet := DSet;
t.FField := Field.FieldName; t.FField := Field.FieldName;
@ -6147,8 +6103,7 @@ begin
end; end;
end; end;
{$ifdef DebugLR} {$ifdef DebugLR}
IncSpc(-1); DebugLnExit('TfrPage.PrepareObjects DONE');
DebugLn('%sTfrPage.PrepareObjects DONE',[sspc]);
{$endif} {$endif}
end; end;
@ -6158,15 +6113,13 @@ begin
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn; DebugLn;
DebugLn('%sTfrPage.ShowBand INI Band=%s',[sspc,BandInfo(b)]); DebugLnEnter('TfrPage.ShowBand INI Band=%s',[BandInfo(b)]);
IncSpc(1);
{$ENDIF} {$ENDIF}
if Mode = pmBuildList then if Mode = pmBuildList then
AddRecord(b, rtShowBand) else AddRecord(b, rtShowBand) else
b.Draw; b.Draw;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrPage.ShowBand END Band=%s',[BandInfo(b)]);
DebugLn('%sTfrPage.ShowBand END Band=%s',[sspc,BandInfo(b)]);
{$ENDIF} {$ENDIF}
end; end;
end; end;
@ -6281,8 +6234,8 @@ end;
procedure TfrPage.DrawPageFooters; procedure TfrPage.DrawPageFooters;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTFrPage.DrawPageFootersPage INI PageNo=%d XAdjust=%d CurColumn=%d', DebugLn('TFrPage.DrawPageFootersPage INI PageNo=%d XAdjust=%d CurColumn=%d',
[sspc,PageNo, XAdjust, CurColumn]); [PageNo, XAdjust, CurColumn]);
{$ENDIF} {$ENDIF}
CurColumn := 0; CurColumn := 0;
XAdjust := LeftMargin; XAdjust := LeftMargin;
@ -6303,17 +6256,16 @@ begin
end; end;
PageNo := MasterReport.EMFPages.Count; PageNo := MasterReport.EMFPages.Count;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTFrPage.DrawPageFootersPage FIN PageNo=%d XAdjust=%d CurColumn=%d', DebugLn('TFrPage.DrawPageFootersPage FIN PageNo=%d XAdjust=%d CurColumn=%d',
[sspc, PageNo, XAdjust, CurColumn]); [PageNo, XAdjust, CurColumn]);
{$ENDIF} {$ENDIF}
end; end;
procedure TfrPage.NewPage; procedure TfrPage.NewPage;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTFrPage.NewPage INI PageNo=%d CurBottomY=%d CurY=%d XAdjust=%d', DebugLnEnter('TFrPage.NewPage INI PageNo=%d CurBottomY=%d CurY=%d XAdjust=%d',
[sspc,PageNo, CurBottomY, CurY, XAdjust]); [PageNo, CurBottomY, CurY, XAdjust]);
IncSpc(1);
{$ENDIF} {$ENDIF}
CurReport.InternalOnProgress(PageNo + 1); CurReport.InternalOnProgress(PageNo + 1);
@ -6324,7 +6276,7 @@ begin
MasterReport.EMFPages.Add(Self); MasterReport.EMFPages.Add(Self);
Append := False; Append := False;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s---- Start of new page ----',[sspc]); DebugLn('---- Start of new page ----');
{$ENDIF} {$ENDIF}
ShowBand(Bands[btOverlay]); ShowBand(Bands[btOverlay]);
CurY := TopMargin; CurY := TopMargin;
@ -6332,9 +6284,8 @@ begin
if not RowsLayout then if not RowsLayout then
ShowBand(Bands[btColumnHeader]); ShowBand(Bands[btColumnHeader]);
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TFrPage.NewPage END PageNo=%d CurBottomY=%d CurY=%d XAdjust=%d',
DebugLn('%sTFrPage.NewPage END PageNo=%d CurBottomY=%d CurY=%d XAdjust=%d', [PageNo, CurBottomY, CurY, XAdjust]);
[sspc,PageNo, CurBottomY, CurY, XAdjust]);
{$ENDIF} {$ENDIF}
end; end;
@ -6343,9 +6294,8 @@ var
b: TfrBand; b: TfrBand;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrPage.NewColumn INI CurColumn=%d ColCount=%d CurY=%d XAdjust=%d', DebugLnEnter('TfrPage.NewColumn INI CurColumn=%d ColCount=%d CurY=%d XAdjust=%d',
[sspc,CurColumn, ColCount, CurY, XAdjust]); [CurColumn, ColCount, CurY, XAdjust]);
IncSpc(1);
{$ENDIF} {$ENDIF}
if CurColumn < ColCount - 1 then if CurColumn < ColCount - 1 then
begin begin
@ -6375,18 +6325,16 @@ begin
Band.ResetLastValues; Band.ResetLastValues;
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrPage.NewColumn END CurColumn=%d ColCount=%d CurY=%d XAdjust=%d',
DebugLn('%sTfrPage.NewColumn END CurColumn=%d ColCount=%d CurY=%d XAdjust=%d', [CurColumn, ColCount, CurY, XAdjust]);
[sspc,CurColumn, ColCount, CurY, XAdjust]);
{$ENDIF} {$ENDIF}
end; end;
procedure TfrPage.NextColumn(Band: TFrBand); procedure TfrPage.NextColumn(Band: TFrBand);
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrPage.NextColumn INI CurColumn=%d ColCount=%d CurY=%d XAdjust=%d', DebugLnEnter('TfrPage.NextColumn INI CurColumn=%d ColCount=%d CurY=%d XAdjust=%d',
[sspc,CurColumn, ColCount, CurY, XAdjust]); [CurColumn, ColCount, CurY, XAdjust]);
IncSpc(1);
{$ENDIF} {$ENDIF}
if CurColumn < ColCount - 1 then if CurColumn < ColCount - 1 then
begin begin
@ -6397,9 +6345,8 @@ begin
else else
StartColumn; StartColumn;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrPage.NextColumn END CurColumn=%d ColCount=%d CurY=%d XAdjust=%d',
DebugLn('%sTfrPage.NextColumn END CurColumn=%d ColCount=%d CurY=%d XAdjust=%d', [CurColumn, ColCount, CurY, XAdjust]);
[sspc,CurColumn, ColCount, CurY, XAdjust]);
{$ENDIF} {$ENDIF}
end; end;
@ -6527,14 +6474,14 @@ var
i: Integer; i: Integer;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sShowStack INI',[sspc]); DebugLnEnter('ShowStack INI');
{$ENDIF} {$ENDIF}
for i := 1 to BndStackTop do for i := 1 to BndStackTop do
if BandExists(BndStack[i]) then if BandExists(BndStack[i]) then
ShowBand(BndStack[i]); ShowBand(BndStack[i]);
BndStackTop := 0; BndStackTop := 0;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sShowStack END',[sspc]); DebugLnExit('ShowStack END');
{$ENDIF} {$ENDIF}
end; end;
@ -6558,8 +6505,7 @@ var
begin begin
b := Bands[Bnds[Level, bpData]]; b := Bands[Bnds[Level, bpData]];
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sDoop(Level=%d) INI b=%s mode=',[sspc,Level,bandinfo(b)]); DebugLnEnter('Doop(Level=%d) INI b=%s mode=',[Level,bandinfo(b)]);
IncSpc(1);
{$ENDIF} {$ENDIF}
while (b <> nil) and (b.Dataset <> nil) do while (b <> nil) and (b.Dataset <> nil) do
begin begin
@ -6628,8 +6574,8 @@ var
begin begin
curGroupValue := frParser.Calc(b1.GroupCondition); curGroupValue := frParser.Calc(b1.GroupCondition);
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sGroupCondition=%s LastGroupValue=%s curGroupValue=%s', DebugLn('GroupCondition=%s LastGroupValue=%s curGroupValue=%s',
[sspc,b1.GroupCondition,varstr(b1.LastGroupValue),varstr(curGroupValue)]); [b1.GroupCondition,varstr(b1.LastGroupValue),varstr(curGroupValue)]);
{$ENDIF} {$ENDIF}
if (curGroupValue <> b1.LastGroupValue) or if (curGroupValue <> b1.LastGroupValue) or
b.Dataset.Eof then b.Dataset.Eof then
@ -6698,15 +6644,13 @@ var
b := b.Next; b := b.Next;
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('Doop(Level=%d) END',[Level]);
DebugLn('%sDoop(Level=%d) END',[sspc,Level]);
{$ENDIF} {$ENDIF}
end; end;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrPage.FormPage INI Mode=%d',[sspc,ord(mode)]); DebugLnEnter('TfrPage.FormPage INI Mode=%d',[ord(mode)]);
IncSpc(1);
{$ENDIF} {$ENDIF}
if Mode = pmNormal then if Mode = pmNormal then
begin begin
@ -6728,7 +6672,7 @@ begin
CurColumn := 0; CurColumn := 0;
XAdjust := LeftMargin; XAdjust := LeftMargin;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sXAdjust=%d CurBottomY=%d PrevY=%d',[sspc,XAdjust,CurBottomY,PrevY]); DebugLn('XAdjust=%d CurBottomY=%d PrevY=%d',[XAdjust,CurBottomY,PrevY]);
{$ENDIF} {$ENDIF}
if not Append then if not Append then
begin begin
@ -6741,7 +6685,7 @@ begin
CurY := PrevY; CurY := PrevY;
sfPage := PageNo; sfPage := PageNo;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sXAdjust=%d CurY=%d sfPage=%d',[sspc,XAdjust,CurY,sfpage]); DebugLn('XAdjust=%d CurY=%d sfPage=%d',[XAdjust,CurY,sfpage]);
{$ENDIF} {$ENDIF}
ShowBand(Bands[btReportTitle]); ShowBand(Bands[btReportTitle]);
if PageNo = sfPage then // check if new page was formed if PageNo = sfPage then // check if new page was formed
@ -6767,7 +6711,7 @@ begin
end; end;
HasGroups := Bands[btGroupHeader].Objects.Count > 0; HasGroups := Bands[btGroupHeader].Objects.Count > 0;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sGroupsCount=%d MaxLevel=%d doing DoLoop(1)',[sspc, DebugLn('GroupsCount=%d MaxLevel=%d doing DoLoop(1)',[
Bands[btGroupHeader].Objects.Count, MaxLevel]); Bands[btGroupHeader].Objects.Count, MaxLevel]);
{$ENDIF} {$ENDIF}
DisableControls; DisableControls;
@ -6795,9 +6739,8 @@ begin
PageNo := sfPage + 1; PageNo := sfPage + 1;
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrPage.FormPage END PrevY=%d PrevBottomY=%d PageNo=%d XAdjust=%d',
DebugLn('%sTfrPage.FormPage END PrevY=%d PrevBottomY=%d PageNo=%d XAdjust=%d', [PrevY,PrevBottomY,PageNo,XAdjust]);
[sspc,PrevY,PrevBottomY,PageNo,XAdjust]);
{$ENDIF} {$ENDIF}
end; end;
@ -7197,8 +7140,8 @@ var
begin begin
IsPrinting := Printer.Printing and (Canvas is TPrinterCanvas); IsPrinting := Printer.Printing and (Canvas is TPrinterCanvas);
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrEMFPages.Draw IsPrinting=%d PageIndex=%d Canvas.ClassName=%s '+ DebugLn('TfrEMFPages.Draw IsPrinting=%d PageIndex=%d Canvas.ClassName=%s '+
'CanvasPPI=%d',[sspc, ord(IsPrinting), Index, Canvas.ClassName, 'CanvasPPI=%d',[ord(IsPrinting), Index, Canvas.ClassName,
Canvas.Font.pixelsPerInch]); Canvas.Font.pixelsPerInch]);
{$ENDIF} {$ENDIF}
@ -7887,14 +7830,14 @@ begin
ParValue := FormatValueStr(ValStr, Format, FormatStr); ParValue := FormatValueStr(ValStr, Format, FormatStr);
} }
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrReport.InternalOnGetValue(%s) Value=%s',[sspc,ParName,ParValue]); DebugLn('TfrReport.InternalOnGetValue(%s) Value=%s',[ParName,ParValue]);
{$ENDIF} {$ENDIF}
end; end;
procedure TfrReport.InternalOnEnterRect(Memo: TStringList; View: TfrView); procedure TfrReport.InternalOnEnterRect(Memo: TStringList; View: TfrView);
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrReport.InternalOnEnterRect View=%s',[sspc,ViewInfo(View)]); DebugLn('TfrReport.InternalOnEnterRect View=%s',[ViewInfo(View)]);
{$ENDIF} {$ENDIF}
with View do with View do
if (FDataSet <> nil) and frIsBlob(TfrTField(FDataSet.FindField(FField))) then if (FDataSet <> nil) and frIsBlob(TfrTField(FDataSet.FindField(FField))) then
@ -8122,7 +8065,7 @@ begin
// val := '0'; // val := '0';
val := varempty; val := varempty;
{$ifdef DebugLR} {$ifdef DebugLR}
DebugLn('%sOnGetParsFunction aName=%s p1=%s p2=%s p3=%s',[sspc,aName,p1,p2,p3]); DebugLn('OnGetParsFunction aName=%s p1=%s p2=%s p3=%s',[aName,p1,p2,p3]);
{$endif} {$endif}
for i := 0 to frFunctionsCount - 1 do for i := 0 to frFunctionsCount - 1 do
if frFunctions[i].FunctionLibrary.OnFunction(aName, p1, p2, p3, val) then if frFunctions[i].FunctionLibrary.OnFunction(aName, p1, p2, p3, val) then
@ -8467,8 +8410,7 @@ var
procedure TfrReport.BuildBeforeModal(Sender: TObject); procedure TfrReport.BuildBeforeModal(Sender: TObject);
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrReport.BuildBeforeModal INIT FinalPass=%s DoublePass=%s',[sspc,dbgs(FinalPass),dbgs(DoublePass)]); DebugLnEnter('TfrReport.BuildBeforeModal INIT FinalPass=%s DoublePass=%s',[dbgs(FinalPass),dbgs(DoublePass)]);
IncSpc(1);
{$ENDIF} {$ENDIF}
DoBuildReport; DoBuildReport;
if FinalPass then if FinalPass then
@ -8488,8 +8430,7 @@ begin
DoublePass := True; DoublePass := True;
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrReport.BuildBeforeModal DONE');
DebugLn('%sTfrReport.BuildBeforeModal DONE',[sspc]);
{$ENDIF} {$ENDIF}
end; end;
@ -8498,8 +8439,7 @@ var
ParamOk: Boolean; ParamOk: Boolean;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrReport.PrepareReport INIT',[sspc]); DebugLnEnter('TfrReport.PrepareReport INIT');
IncSpc(1);
{$ENDIF} {$ENDIF}
DocMode := dmPrinting; DocMode := dmPrinting;
CurDate := Date; CurDate := Date;
@ -8529,8 +8469,7 @@ begin
if Assigned(FOnEndDoc) then if Assigned(FOnEndDoc) then
FOnEndDoc; FOnEndDoc;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrReport.PrepareReport DONE');
DebugLn('%sTfrReport.PrepareReport DONE',[sspc]);
{$ENDIF} {$ENDIF}
end; end;
@ -8548,16 +8487,14 @@ begin
EMFPages.Clear; EMFPages.Clear;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sDoPrepareReport INIT DoublePass=%s',[sspc,BoolToStr(DoublePass)]); DebugLnEnter('DoPrepareReport INIT DoublePass=%s',[BoolToStr(DoublePass)]);
IncSpc(1);
{$ENDIF} {$ENDIF}
s := sReportPreparing; s := sReportPreparing;
if DoublePass then if DoublePass then
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sDoPrepareReport FirstPass Begin',[sspc]); DebugLnEnter('DoPrepareReport FirstPass Begin');
IncSpc(1);
{$ENDIF} {$ENDIF}
DisableDrawing := True; DisableDrawing := True;
@ -8578,14 +8515,12 @@ begin
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('DoPrepareReport FirstPass End');
DebugLn('%sDoPrepareReport FirstPass End',[sspc]);
{$ENDIF} {$ENDIF}
end end
else BuildBeforeModal(nil); else BuildBeforeModal(nil);
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('DoPrepareReport DONE');
DebugLn('%sDoPrepareReport DONE',[sspc]);
{$ENDIF} {$ENDIF}
Exit; Exit;
end; end;
@ -8593,14 +8528,13 @@ begin
if not Assigned(FOnProgress) and FShowProgress then if not Assigned(FOnProgress) and FShowProgress then
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sDoPrepareReport SecondPass begin',[sspc]); DebugLnEnter('DoPrepareReport SecondPass begin');
IncSpc(1);
{$ENDIF} {$ENDIF}
with frProgressForm do with frProgressForm do
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s1',[sspc]); DebugLn('1');
{$ENDIF} {$ENDIF}
if Title = '' then if Title = '' then
Caption := s Caption := s
@ -8610,45 +8544,43 @@ begin
Label1.Caption := FirstCaption + ' 1'; Label1.Caption := FirstCaption + ' 1';
OnBeforeModal:=@BuildBeforeModal; OnBeforeModal:=@BuildBeforeModal;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s2',[sspc]); DebugLn('2');
{$ENDIF} {$ENDIF}
if Visible then if Visible then
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s3',[sspc]); DebugLn('3');
{$ENDIF} {$ENDIF}
if not FirstPassTerminated then if not FirstPassTerminated then
DoublePass := True; DoublePass := True;
BuildBeforeModal(nil); BuildBeforeModal(nil);
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s4',[sspc]); DebugLn('4');
{$ENDIF} {$ENDIF}
end end
else else
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s5',[sspc]); DebugLn('5');
{$ENDIF} {$ENDIF}
SavedAllPages := 0; SavedAllPages := 0;
if Show_Modal(Self) = mrCancel then if Show_Modal(Self) = mrCancel then
Result := False; Result := False;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s6',[sspc]); DebugLn('6');
{$ENDIF} {$ENDIF}
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('DoPrepareReport SecondPass End');
DebugLn('%sDoPrepareReport SecondPass End',[sspc]);
{$ENDIF} {$ENDIF}
end; end;
end end
else BuildBeforeModal(nil); else BuildBeforeModal(nil);
Terminated := False; Terminated := False;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('DoPrepareReport DONE');
DebugLn('%sDoPrepareReport DONE',[sspc]);
{$ENDIF} {$ENDIF}
end; end;
@ -8739,8 +8671,7 @@ var
BM : Pointer; BM : Pointer;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrReport.DoBuildReport INIT',[sspc]); DebugLnEnter('TfrReport.DoBuildReport INIT');
IncSpc(1);
{$ENDIF} {$ENDIF}
HookList.Clear; HookList.Clear;
CanRebuild := True; CanRebuild := True;
@ -8770,11 +8701,11 @@ begin
repeat repeat
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sp1',[sspc]); DebugLn('p1');
{$ENDIF} {$ENDIF}
InternalOnProgress(PageNo + 1); InternalOnProgress(PageNo + 1);
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sp2',[sspc]); DebugLn('p2');
{$ENDIF} {$ENDIF}
for i := 0 to Pages.Count - 1 do for i := 0 to Pages.Count - 1 do
@ -8791,7 +8722,7 @@ begin
FCurPage.FormPage; FCurPage.FormPage;
{$IFDEF DebugLR} {$IFDEF DebugLR}
debugLn('%sp3',[sspc]); debugLn('p3');
{$ENDIF} {$ENDIF}
Append := False; Append := False;
@ -8811,7 +8742,7 @@ begin
end; end;
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sp4',[sspc]); DebugLn('p4');
{$ENDIF} {$ENDIF}
InternalOnProgress(PageNo); InternalOnProgress(PageNo);
@ -8834,8 +8765,7 @@ begin
frDataManager.AfterPreparing; frDataManager.AfterPreparing;
Values.Items.Sorted := False; Values.Items.Sorted := False;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrReport.DoBuildReport DONE');
DebugLn('%sTfrReport.DoBuildReport DONE',[sspc]);
{$ENDIF} {$ENDIF}
end; end;
@ -8857,8 +8787,7 @@ var
p: TfrPreviewForm; p: TfrPreviewForm;
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrReport.ShowPreparedReport INIT',[sspc]); DebugLnEnter('TfrReport.ShowPreparedReport INIT');
IncSpc(1);
{$ENDIF} {$ENDIF}
CurReport := Self; CurReport := Self;
MasterReport := Self; MasterReport := Self;
@ -8877,17 +8806,16 @@ begin
p := TfrPreviewForm.Create(nil); p := TfrPreviewForm.Create(nil);
p.BorderIcons:=p.BorderIcons - [biMinimize]; p.BorderIcons:=p.BorderIcons - [biMinimize];
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s1 TfrPreviewForm.visible=%s',[sspc,BooLToStr(p.Visible)]); DebugLn('1 TfrPreviewForm.visible=%s',[BooLToStr(p.Visible)]);
{$ENDIF} {$ENDIF}
p.Caption := s; p.Caption := s;
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%s2 TfrPreviewForm.visible=%s',[sspc,BooLToStr(p.Visible)]); DebugLn('2 TfrPreviewForm.visible=%s',[BooLToStr(p.Visible)]);
{$ENDIF} {$ENDIF}
p.Show_Modal(Self); p.Show_Modal(Self);
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrReport.ShowPreparedReport DONE');
DebugLn('%sTfrReport.ShowPreparedReport DONE',[sspc]);
{$ENDIF} {$ENDIF}
end; end;
@ -9708,8 +9636,7 @@ var
{$ENDIF} {$ENDIF}
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sTfrStdFunctionLibrary.DoFunction FNo=%d (%s) p1=%s p2=%s p3=%s val=%s',[sspc,FNo,FNoStr,p1,p2,p3,val]); DebugLnEnter('TfrStdFunctionLibrary.DoFunction FNo=%d (%s) p1=%s p2=%s p3=%s val=%s',[FNo,FNoStr,p1,p2,p3,val]);
IncSpc(1);
{$ENDIF} {$ENDIF}
dk := dkNone; dk := dkNone;
val := '0'; val := '0';
@ -9834,8 +9761,8 @@ begin
else if (CurBand.View<>nil) and ((DataSet = nil) or (Field = nil)) then else if (CurBand.View<>nil) and ((DataSet = nil) or (Field = nil)) then
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('%sCurBand=%s CurBand.View=%s AggrBand=%s', DebugLn('CurBand=%s CurBand.View=%s AggrBand=%s',
[sspc,BandInfo(CurBand),dbgsName(CurBand.View),BandInfo(AggrBand)]); [BandInfo(CurBand),dbgsName(CurBand.View),BandInfo(AggrBand)]);
{$ENDIF} {$ENDIF}
s1 := Trim(string(p2)); s1 := Trim(string(p2));
if s1 = '' then begin if s1 = '' then begin
@ -9857,7 +9784,7 @@ begin
VarName := VarName + '00' else VarName := VarName + '00' else
VarName := VarName + IntToStr(CurPage.ColPos); VarName := VarName + IntToStr(CurPage.ColPos);
{$ifdef DebugLR} {$ifdef DebugLR}
dbgOut(sspc, 'VarName=', QuotedStr(VarName)); dbgOut('VarName=', QuotedStr(VarName));
{$endif} {$endif}
if not AggrBand.Visible and (AnsiCompareText(CurBand.View.Name, s1) = 0) then if not AggrBand.Visible and (AnsiCompareText(CurBand.View.Name, s1) = 0) then
begin begin
@ -9904,15 +9831,14 @@ begin
if dk = dkAvg then if dk = dkAvg then
val := val / AggrBand.Count; val := val / AggrBand.Count;
{$ifdef DebugLR} {$ifdef DebugLR}
DebugLn('%s Value=%s',[sspc,Val]); DebugLn('Value=%s',[Val]);
{$endif} {$endif}
end; end;
end; end;
end; end;
end; end;
{$IFDEF DebugLR} {$IFDEF DebugLR}
IncSpc(-1); DebugLnExit('TfrStdFunctionLibrary.DoFunction DONE val=%s',[val]);
DebugLn('%sTfrStdFunctionLibrary.DoFunction DONE val=%s',[sspc,val]);
{$ENDIF} {$ENDIF}
end; end;

View File

@ -39,7 +39,11 @@ function GetBrackedVariable(s: String; var i, j: Integer): String;
implementation implementation
uses SysUtils, Variants; uses SysUtils, Variants
{$IFDEF DebugLRCalcs}
, LCLProc
{$ENDIF}
;
const const
ttGe = #1; ttLe = #2; ttGe = #1; ttLe = #2;
@ -93,6 +97,9 @@ var
nm: Array[1..32] of Variant; nm: Array[1..32] of Variant;
v: Double; v: Double;
begin begin
{$IFDEF DebugLRCalcs}
DebugLnEnter('TfrParser.CalcOPZ INIT s=%s',[dbgstr(s)]);
{$ENDIF}
st := 1; st := 1;
i := 1; i := 1;
nm[1] := 0; nm[1] := 0;
@ -177,7 +184,13 @@ begin
if Assigned(FOnGetValue) then if Assigned(FOnGetValue) then
begin begin
nm[st] := Null; nm[st] := Null;
{$IFDEF DebugLRCalcs}
DebugLnEnter('TfrParser.CalcOPZ "[" -> FOnGetValue s1=%s',[s1]);
{$ENDIF}
FOnGetValue(s1, nm[st]); FOnGetValue(s1, nm[st]);
{$IFDEF DebugLRCalcs}
DebugLnExit('TfrParser.CalcOPZ "[" <- FOnGetValue res=%s',[string(nm[st])]);
{$ENDIF}
end; end;
Inc(st); Inc(st);
end end
@ -227,7 +240,13 @@ begin
if Int(StrToFloat(Calc(s2))) <> 0 then if Int(StrToFloat(Calc(s2))) <> 0 then
s1 := s3 else s1 := s3 else
s1 := s4; s1 := s4;
{$IFDEF DebugLRCalcs}
DebugLnEnter('TfrParser.CalcOPZ IF -> S1=%s',[s1]);
{$ENDIF}
nm[st] := Calc(s1); nm[st] := Calc(s1);
{$IFDEF DebugLRCalcs}
DebugLnExit('TfrParser.CalcOPZ IF <- Res=%s',[string(nm[st])]);
{$ENDIF}
end end
else if s1 = 'STRTODATE' then else if s1 = 'STRTODATE' then
nm[st] := StrToDate(Calc(s2)) nm[st] := StrToDate(Calc(s2))
@ -257,6 +276,9 @@ begin
Inc(i); Inc(i);
end; end;
Result := nm[1]; Result := nm[1];
{$IFDEF DebugLRCalcs}
DebugLnExit('TfrParser.CalcOPZ DONE res=%s',[string(result)]);
{$ENDIF}
end; end;
function TfrParser.GetIdentify(const s: String; var i: Integer): String; function TfrParser.GetIdentify(const s: String; var i: Integer): String;
@ -375,6 +397,9 @@ var
end; end;
begin begin
{$IFDEF DebugLRCalcs}
DebugLnEnter('TfrParser.Str2OPZ INIT s=%s',[dbgstr(s)]);
{$ENDIF}
res := ''; res := '';
stack := ''; stack := '';
i := 1; vr := False; i := 1; vr := False;
@ -525,11 +550,20 @@ begin
end; end;
if stack <> '' then res := res + stack; if stack <> '' then res := res + stack;
Result := res; Result := res;
{$IFDEF DebugLRCalcs}
DebugLnExit('TfrParser.Str2OPZ DONE result=%s',[dbgstr(string(result))]);
{$ENDIF}
end; end;
function TfrParser.Calc(const s: String): Variant; function TfrParser.Calc(const s: String): Variant;
begin begin
{$IFDEF DebugLRCalcs}
DebugLnEnter('TfrParser.Calc INIT s=%s',[dbgstr(s)]);
{$ENDIF}
Result := CalcOPZ(Str2OPZ(s)); Result := CalcOPZ(Str2OPZ(s));
{$IFDEF DebugLRCalcs}
DebugLnExit('TfrParser.Calc DONE res=%s',[string(result)]);
{$ENDIF}
end; end;
end. end.