mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-16 20:22:54 +02:00
LazReport, fix band's titles in report designer for some locales
git-svn-id: trunk@27453 -
This commit is contained in:
parent
46efadcf0b
commit
cd506ebd5a
@ -415,6 +415,9 @@ type
|
|||||||
procedure P4Click(Sender: TObject);
|
procedure P4Click(Sender: TObject);
|
||||||
procedure P5Click(Sender: TObject);
|
procedure P5Click(Sender: TObject);
|
||||||
procedure P6Click(Sender: TObject);
|
procedure P6Click(Sender: TObject);
|
||||||
|
function GetTitleRect: TRect;
|
||||||
|
function TitleSize: Integer;
|
||||||
|
procedure CalcTitleSize;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
|
|
||||||
@ -1247,6 +1250,7 @@ var
|
|||||||
PrevY, PrevBottomY, ColumnXAdjust: Integer;
|
PrevY, PrevBottomY, ColumnXAdjust: Integer;
|
||||||
Append, WasPF: Boolean;
|
Append, WasPF: Boolean;
|
||||||
CompositeMode: Boolean;
|
CompositeMode: Boolean;
|
||||||
|
MaxTitleSize: Integer = 0;
|
||||||
|
|
||||||
{$IFDEF DebugLR}
|
{$IFDEF DebugLR}
|
||||||
var
|
var
|
||||||
@ -3611,6 +3615,7 @@ procedure TfrBandView.Draw(aCanvas: TCanvas);
|
|||||||
var
|
var
|
||||||
h, oldh: HFont;
|
h, oldh: HFont;
|
||||||
St : String;
|
St : String;
|
||||||
|
R : TRect;
|
||||||
begin
|
begin
|
||||||
fFrameWidth := 1;
|
fFrameWidth := 1;
|
||||||
if BandType in [btCrossHeader..btCrossFooter] then
|
if BandType in [btCrossHeader..btCrossFooter] then
|
||||||
@ -3643,37 +3648,37 @@ begin
|
|||||||
Rectangle(x, y, x + dx + 1, y + dy + 1);
|
Rectangle(x, y, x + dx + 1, y + dy + 1);
|
||||||
Brush.Color := clBtnFace;
|
Brush.Color := clBtnFace;
|
||||||
Brush.Style := bsSolid;
|
Brush.Style := bsSolid;
|
||||||
|
CalcTitleSize;
|
||||||
|
R := GetTitleRect;
|
||||||
if ShowBandTitles then
|
if ShowBandTitles then
|
||||||
begin
|
begin
|
||||||
|
FillRect(R);
|
||||||
if BandType in [btCrossHeader..btCrossFooter] then
|
if BandType in [btCrossHeader..btCrossFooter] then
|
||||||
begin
|
begin
|
||||||
FillRect(Rect(x - 18, y, x, y + 100));
|
|
||||||
Pen.Color := clBtnShadow;
|
Pen.Color := clBtnShadow;
|
||||||
MoveTo(x - 18, y + 98); LineTo(x, y + 98);
|
MoveTo(r.left, r.Bottom-2); LineTo(r.right, r.Bottom-2);
|
||||||
Pen.Color := clBlack;
|
Pen.Color := clBlack;
|
||||||
MoveTo(x - 18, y + 99); LineTo(x, y + 99);
|
MoveTo(r.left, r.Bottom-1); LineTo(r.right, r.Bottom-1);
|
||||||
Pen.Color := clBtnHighlight;
|
Pen.Color := clBtnHighlight;
|
||||||
MoveTo(x - 18, y + 99); LineTo(x - 18, y);
|
MoveTo(r.left, r.bottom-1); lineto(r.left, r.top);
|
||||||
h := Create90Font(Font);
|
h := Create90Font(Font);
|
||||||
oldh := SelectObject(Handle, h);
|
oldh := SelectObject(Handle, h);
|
||||||
Brush.Color:=clBtnFace;
|
Brush.Color:=clBtnFace;
|
||||||
TextOut(x - 15, y + 94, frBandNames[BandType]);
|
TextOut(r.Left + 3, r.bottom-6, frBandNames[BandType]);
|
||||||
SelectObject(Handle, oldh);
|
SelectObject(Handle, oldh);
|
||||||
DeleteObject(h);
|
DeleteObject(h);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
|
||||||
FillRect(Rect(x, y - 18, x + 100, y));
|
|
||||||
Pen.Color := clBtnShadow;
|
Pen.Color := clBtnShadow;
|
||||||
MoveTo(x + 98, y - 18);
|
MoveTo(r.Right-2, r.Top);
|
||||||
LineTo(x + 98, y);
|
LineTo(r.Right-2, r.Bottom);
|
||||||
Pen.Color := clBlack;
|
Pen.Color := clBlack;
|
||||||
MoveTo(x + 99, y - 18);
|
MoveTo(r.Right-1, r.Top);
|
||||||
LineTo(x + 99, y);
|
LineTo(r.Right-1, r.Bottom);
|
||||||
st:=frBandNames[BandType];
|
st:=frBandNames[BandType];
|
||||||
Brush.Color:=clBtnFace;
|
Brush.Color:=clBtnFace;
|
||||||
TextOut(x+4,y-17, frBandNames[BandType]);
|
TextOut(r.left+5, r.top+1, frBandNames[BandType]);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -3684,7 +3689,7 @@ begin
|
|||||||
h := Create90Font(Font);
|
h := Create90Font(Font);
|
||||||
oldh := SelectObject(Handle, h);
|
oldh := SelectObject(Handle, h);
|
||||||
Brush.Color:=clBtnFace;
|
Brush.Color:=clBtnFace;
|
||||||
TextOut(x + 2, y + 94, frBandNames[BandType]);
|
TextOut(x + 2, r.bottom-6, frBandNames[BandType]);
|
||||||
SelectObject(Handle, oldh);
|
SelectObject(Handle, oldh);
|
||||||
DeleteObject(h);
|
DeleteObject(h);
|
||||||
end
|
end
|
||||||
@ -3713,10 +3718,8 @@ begin
|
|||||||
else
|
else
|
||||||
R1 := CreateRectRgn(x - 10, y - 10, x + dx + 10, y + dy + 10);
|
R1 := CreateRectRgn(x - 10, y - 10, x + dx + 10, y + dy + 10);
|
||||||
|
|
||||||
if BandType in [btCrossHeader..btCrossFooter] then
|
with GetTitleRect do
|
||||||
R := CreateRectRgn(x - 18, y, x, y + 100)
|
R := CreateRectRgn(Left,Top,Right,Bottom);
|
||||||
else
|
|
||||||
R := CreateRectRgn(x, y - 18, x + 100, y);
|
|
||||||
|
|
||||||
R2:=CreateRectRgn(0,0,0,0);
|
R2:=CreateRectRgn(0,0,0,0);
|
||||||
|
|
||||||
@ -3729,30 +3732,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TfrBandView.PointInView(aX,aY: Integer): Boolean;
|
function TfrBandView.PointInView(aX,aY: Integer): Boolean;
|
||||||
Var Rc : TRect;
|
var
|
||||||
|
Rc : TRect;
|
||||||
begin
|
begin
|
||||||
Rc:=Bounds(x, y,dx+1,dy + 1);
|
Rc:=Bounds(x, y,dx+1,dy + 1);
|
||||||
Result:=((aX>Rc.Left) and (aX<Rc.Right) and (aY>Rc.Top) and (aY<Rc.Bottom));
|
Result:=((aX>Rc.Left) and (aX<Rc.Right) and (aY>Rc.Top) and (aY<Rc.Bottom));
|
||||||
{$IFDEF DebugLR}
|
{$IFDEF DebugLR}
|
||||||
DbgOut('(',IntToStr(aX),'>',InttoStr(Rc.Left),') and (',InttoStr(aX),'<',InttoStr(Rc.Right));
|
DebugLn('PointInView, Bounds=%s Point=%d,%d Res=%s',[dbgs(rc),ax,ay,BoolToStr(result)]);
|
||||||
DebugLn(') and (',InttoStr(aY),'>',InttoStr(Rc.Top),') and (',InttoStR(aY),
|
|
||||||
'<',InttoStr(Rc.Bottom),')=',BoolToStr(Result));
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
if not Result and ShowBandTitles then
|
if not Result and ShowBandTitles then
|
||||||
begin
|
begin
|
||||||
if BandType in [btCrossHeader..btCrossFooter] then
|
Rc := GetTitleRect;
|
||||||
Rc:=Bounds(x-18,y, 18,100)
|
Result := PtInRect(Rc, Point(Ax,Ay));
|
||||||
else
|
|
||||||
Rc:=Bounds(x,y-18,100, 18);
|
|
||||||
|
|
||||||
Result:=((aX>Rc.Left) and (aX<Rc.Right) and (aY>Rc.Top) and (aY<Rc.Bottom));
|
|
||||||
{$IFDEF DebugLR}
|
{$IFDEF DebugLR}
|
||||||
DbgOut('(',InttoStr(aX),'>',InttoStr(Rc.Left),') and (',InttoStr(aX),'<',
|
DebugLn('PointInView, TitleRect=%s Point=%d,%d Res=%s',[dbgs(rc),ax,ay,BoolToStr(result)]);
|
||||||
IntToStr(Rc.Right),') and (',IntToStr(aY),'>');
|
|
||||||
DebugLn(IntToStr(Rc.Top),') and (',InttoStr(aY),'<',IntToStr(Rc.Bottom),')=',BoolToStr(Result));
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3909,6 +3904,37 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TfrBandView.GetTitleRect: TRect;
|
||||||
|
begin
|
||||||
|
if BandType in [btCrossHeader..btCrossFooter] then
|
||||||
|
result := rect(x - 18, y, x, y + TitleSize + 10)
|
||||||
|
else
|
||||||
|
result := rect(x, y-18, x + TitleSize + 10, y);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TfrBandView.TitleSize: Integer;
|
||||||
|
begin
|
||||||
|
if MaxTitleSize<100 then
|
||||||
|
result := 100
|
||||||
|
else
|
||||||
|
result := MaxTitleSize;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrBandView.CalcTitleSize;
|
||||||
|
var
|
||||||
|
Bt: TfrBandType;
|
||||||
|
W: Integer;
|
||||||
|
begin
|
||||||
|
if MaxTitleSize=0 then begin
|
||||||
|
MaxTitleSize := Canvas.TextWidth('-'); // work around gtk2 first calc is not right
|
||||||
|
for bt := btReportTitle to btNone do begin
|
||||||
|
W := Canvas.TextWidth(frBandNames[bt]);
|
||||||
|
if W>MaxTitleSize then
|
||||||
|
MaxTitleSize := W;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{----------------------------------------------------------------------------}
|
{----------------------------------------------------------------------------}
|
||||||
constructor TfrSubReportView.Create;
|
constructor TfrSubReportView.Create;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user