diff --git a/components/lazreport/source/lr_class.pas b/components/lazreport/source/lr_class.pas index d75d0a7daf..3f5bc31ca9 100644 --- a/components/lazreport/source/lr_class.pas +++ b/components/lazreport/source/lr_class.pas @@ -1380,31 +1380,7 @@ var {$IFDEF DebugLR} function Bandtyp2str(typ: TfrBandType): string; begin - case typ of - btReportTitle: result := 'btReportTitle'; - btReportSummary: result := 'btReportSummary'; - btPageHeader: result := 'btPageHeader'; - btPageFooter: result := 'btPageFooter'; - btMasterHeader: result := 'btMasterHeader'; - btMasterData: result := 'btMasterData'; - btMasterFooter: result := 'btMasterFooter'; - btDetailHeader: result := 'btDetailHeader'; - btDetailData: result := 'btDetailData'; - btDetailFooter: result := 'btDetailFooter'; - btSubDetailHeader: result := 'btSubDetailHeader'; - btSubDetailData: result := 'btSubDetailData'; - btSubDetailFooter: result := 'btSubDetailFooter'; - btOverlay: result := 'btOverlay'; - btColumnHeader: result := 'btColumnHeader'; - btColumnFooter: result := 'btColumnFooter'; - btGroupHeader: result := 'btGroupHeader'; - btGroupFooter: result := 'btGroupFooter'; - btCrossHeader: result := 'btCrossHeader'; - btCrossData: result := 'btCrossData'; - btCrossFooter: result := 'btCrossFooter'; - btNone: result:='btNone'; - end; - + WriteStr(Result, typ); end; function BandInfo(Band: TfrBand): string; @@ -1417,6 +1393,13 @@ begin result := format('"%s":%s typ=%s',[View.Name, dbgsname(View), frTypeObjectToStr(View.Typ)]); end; +function ViewInfoDim(View: TfrView): string; +begin + with View do + result := sysutils.format('"%s":%s typ=%s DIM:%d %d %d %d', + [Name, dbgsname(View), frTypeObjectToStr(Typ), x, y, dx, dy]); +end; + function VarStr(V:Variant): string; begin if VarIsNull(v) then @@ -1916,9 +1899,6 @@ begin wx2 := Round(FrameWidth * ScaleX / 2); wy1 := Round((FrameWidth * ScaleY - 1) / 2); wy2 := Round(FrameWidth * ScaleY / 2); - {$IFDEF DebugLR} - DebugLn('CalcGaps: dx=%d ScaleX=%f',[dx,ScaleX]); - {$ENDIF} fFrameWidth := FrameWidth * ScaleX; gapx := wx2 + 2; gapy := wy2 div 2 + 1; @@ -1932,6 +1912,10 @@ begin if frbBottom in Frames then Inc(bx, wx1); if frbRight in Frames then Inc(by, wy1); DRect := Rect(bx, by, bx1 + 1, by1 + 1); + {$IFDEF DebugLR} + DebugLn('CalcGaps: ScaleXY:%f %f OLD:%d %d %d %d NEW: %d %d %d %d GAPS: %d %d DRECT: %s', + [ScaleX,ScaleY,SaveX,SaveY,SaveDx,SaveDy,x,y,dx,dy,gapx,gapy,dbgs(drect)]); + {$ENDIF} end; procedure TfrView.RestoreCoord; @@ -2249,9 +2233,13 @@ procedure TfrView.SaveToStream(Stream: TStream); var S: Single; B: Integer; + {$IFDEF DebugLR} + st: string; + {$ENDIF} begin {$IFDEF DebugLR} - DebugLn('%s.SaveToStream begin',[name]); + WriteStr(st, StreamMode); + DebugLn('%s.SaveToStream begin StreamMode=%s',[name, st]); {$ENDIF} with Stream do @@ -2864,8 +2852,8 @@ var if (n > 0) and (str[n] = #1) then w := WCanvas.TextWidth(Copy(str, 1, n - 1)) else w := WCanvas.TextWidth(str); - {$IFDEF DebugLR} - debugLn('Outline: str="%s" w/=%d w%%=%d',[str,w div 256, w mod 256]); + {$IFDEF DebugLR_detail} + debugLn('Outline: str="%s" w/=%d w%%=%d',[copy(str,1,12),w div 256, w mod 256]); {$ENDIF} SMemo.Add(str + Chr(w div 256) + Chr(w mod 256)); Inc(size, size1); @@ -3003,7 +2991,8 @@ var size1 := -WCanvas.Font.Height + LineSpacing; maxWidth := dx - gapx - gapx; {$IFDEF DebugLR} - DebugLn('OutMemo I: Size=%d Size1=%d MaxWidth=%d y=%d dx=%d gapy=%d gapx=%d',[Size,Size1,MaxWidth,y,dx,gapy,gapx]); + DebugLn('OutMemo I: Size=%d Size1=%d MaxWidth=%d DIM:%d %d %d %d gapxy:%d %d', + [Size,Size1,MaxWidth,x,y,dx,dy,gapx,gapy]); {$ENDIF} for i := 0 to Memo1.Count - 1 do begin @@ -3015,7 +3004,8 @@ var VHeight := size - y + gapy; TextHeight := size1; {$IFDEF DebugLR} - DebugLn('OutMemo E: Size=%d Size1=%d MaxWidth=%d y=%d dx=%d gapy=%d gapx=%d VHeight=%d',[Size,Size1,MaxWidth,y,dx,gapy,gapx,VHeight]); + DebugLn('OutMemo E: Size=%d Size1=%d MaxWidth=%d DIM:%d %d %d %d gapxy:%d %d', + [Size,Size1,MaxWidth,x,y,dx,dy,gapx,gapy]); {$ENDIF} end; @@ -3080,8 +3070,8 @@ var n, nw, w, curx: Integer; Ts: TTextStyle; begin - {$IFDEF DebugLR} - DebugLn('OutLine Cury=%d + th=%d = %d < dr.bottom=%d == %s',[cury,th,cury+th,dr.bottom,dbgs(cury+th CurBottomY then @@ -5543,6 +5537,9 @@ begin repeat newDy := Parent.CurBottomY - Parent.Bands[btColumnFooter].dy - y - 2; aMaxy := 0; + {$IFDEF DebugLR} + WriteLn('Parent.CurBottomy=',Parent.CurBottomY,' NewDY=',newDY); + {$ENDIF} for i := 0 to Objects.Count - 1 do begin t :=TfrView(Objects[i]); @@ -5583,6 +5580,10 @@ begin // drawing the remaining part of some object if t.y + t.dy > newdy then begin + {$IFDEF DebugLR} + DebugLn('BIGGER THAN PAGE: t=%s Acumdy=%d y+dy=%d newdy=%d', + [ViewInfoDIM(t), TfrStretcheable(t).ActualHeight, t.y + t.dy,newdy]); + {$ENDIF} // the rest of "t" is too large to fit in the rest of the page oldy := t.y; olddy := t.dy; t.y := 0; t.dy := newdy; @@ -5593,6 +5594,10 @@ begin t.Selected := true; end else begin + {$IFDEF DebugLR} + DebugLn('REMAINING OF PAGE: t=%s Acumdy=%d y+dy=%d newdy=%d', + [ViewInfoDIM(t),TfrStretcheable(t).ActualHeight, t.y + t.dy,newdy]); + {$ENDIF} // the rest of "t" fits within the remaining space on page oldy := t.y; olddy := t.dy; t.dy := t.y + t.dy; @@ -5771,7 +5776,7 @@ var b: TfrBand; begin {$IFDEF debugLr} - DebugLnEnter('TFrBand.Draw INI Band=%s y=%d vis=%s',[BandInfo(self),y,BoolToStr(Visible,true)]); + DebugLnEnter('TFrBand.Draw INI Band=%s y=%d dy=%d vis=%s',[BandInfo(self),y,dy,BoolToStr(Visible,true)]); {$endif} Result := False; CurView := View; @@ -6827,6 +6832,9 @@ var BooksBkUp : array of TBookRecord; CurGroupValue : variant; BookPrev : pointer; + {$IFDEF DebugLR} + mys : string; + {$ENDIF} procedure AddToStack(b: TfrBand); begin @@ -7054,7 +7062,8 @@ var begin {$IFDEF DebugLR} - DebugLnEnter('TfrPage.FormPage INI Mode=%d',[ord(mode)]); + WriteStr(Mys, Mode); + DebugLnEnter('TfrPage.FormPage INI Mode=%s',[MyS]); {$ENDIF} if Mode = pmNormal then begin