You've already forked lazarus-ccr
tvplanit: Fix layout of ContactGrid in case of rotated print formats
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8530 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -27,7 +27,6 @@
|
|||||||
{* ***** END LICENSE BLOCK ***** *}
|
{* ***** END LICENSE BLOCK ***** *}
|
||||||
|
|
||||||
{$I vp.inc}
|
{$I vp.inc}
|
||||||
{$DEFINE DEBUG_CONTACTGRID}
|
|
||||||
|
|
||||||
unit VpContactGrid;
|
unit VpContactGrid;
|
||||||
|
|
||||||
@ -36,7 +35,6 @@ interface
|
|||||||
uses
|
uses
|
||||||
{$IFDEF LCL}
|
{$IFDEF LCL}
|
||||||
LMessages, LCLProc, LCLType, LCLIntf,
|
LMessages, LCLProc, LCLType, LCLIntf,
|
||||||
{$IFDEF DEBUG_CONTACTGRID}LazLogger,{$ENDIF}
|
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Windows, Messages,
|
Windows, Messages,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -1996,10 +1994,6 @@ begin
|
|||||||
else
|
else
|
||||||
nPos := FContactsBefore;
|
nPos := FContactsBefore;
|
||||||
nTrackPos := nPos;
|
nTrackPos := nPos;
|
||||||
|
|
||||||
{$IFDEF DEBUG_CONTACTGRID}
|
|
||||||
DebugLn(['[TVpContactGrid.SetHScrollPos] VisibleContacts=', FVisibleContacts, ' ContactsBefore=', FContactsBefore]);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
SetScrollInfo(Handle, SB_HORZ, scrollInfo, True);
|
SetScrollInfo(Handle, SB_HORZ, scrollInfo, True);
|
||||||
end;
|
end;
|
||||||
|
@ -4,7 +4,7 @@ unit VpContactGridPainter;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses lazlogger,
|
uses
|
||||||
LCLType, LCLIntf, SysUtils,
|
LCLType, LCLIntf, SysUtils,
|
||||||
Types, Classes, Graphics,
|
Types, Classes, Graphics,
|
||||||
VpConst, VPBase, VpData, VpBasePainter, VpContactGrid;
|
VpConst, VPBase, VpData, VpBasePainter, VpContactGrid;
|
||||||
@ -297,49 +297,41 @@ procedure TVpContactGridPainter.DrawContactRow(ABitmap: TBitmap;
|
|||||||
var
|
var
|
||||||
txtheight: Integer;
|
txtheight: Integer;
|
||||||
txtColWidth: Integer;
|
txtColWidth: Integer;
|
||||||
|
txtPt: TPoint;
|
||||||
begin
|
begin
|
||||||
if AText = '' then begin
|
if AText = '' then begin
|
||||||
ATextRect := Rect(0, 0, 0, 0);
|
ATextRect := Rect(0, 0, 0, 0);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
txtHeight := ABitmap.Canvas.TextHeight(VpProductName);
|
txtHeight := ABitmap.Canvas.TextHeight(VpProductName) + FScaledTextMargin div 2;
|
||||||
|
|
||||||
case Angle of
|
case Angle of
|
||||||
ra0:
|
ra0:
|
||||||
begin
|
begin
|
||||||
ATextRect.Left := FScaledTextMargin;
|
ATextRect := Rect(FScaledTextMargin, AWholeRect.Bottom, AWholeRect.Right, AWholeRect.Bottom + txtHeight);
|
||||||
ATextRect.Top := AWholeRect.Bottom + FScaledTextMargin div 2;
|
|
||||||
ATextRect.Right := ABitmap.Width;
|
|
||||||
ATextRect.Bottom := ATextRect.Top + txtHeight + FScaledTextMargin div 2;
|
|
||||||
AWholeRect.Bottom := ATextRect.Bottom;
|
AWholeRect.Bottom := ATextRect.Bottom;
|
||||||
txtColWidth := ABitmap.Width;
|
txtColWidth := ABitmap.Width;
|
||||||
|
txtPt := ATextRect.TopLeft;
|
||||||
end;
|
end;
|
||||||
ra90:
|
ra90:
|
||||||
begin
|
begin
|
||||||
ATextRect.Left := AWholeRect.Left - txtHeight + FScaledTextMargin div 2;
|
ATextRect := Rect(AWholeRect.Left - txtHeight - 1, FScaledTextMargin, AWholeRect.Left - 1, AWholeRect.Bottom);
|
||||||
ATextRect.Top := FScaledTextMargin;
|
|
||||||
ATextRect.Right := AWholeRect.Left - FScaledTextMargin div 2;
|
|
||||||
ATextRect.Bottom := AWholeRect.Bottom + FScaledTextMargin div 2;
|
|
||||||
AWholeRect.Left := ATextRect.Left;
|
AWholeRect.Left := ATextRect.Left;
|
||||||
txtColWidth := ABitmap.Height;
|
txtColWidth := ABitmap.Height;
|
||||||
|
txtPt := Point(ATextRect.Right, ATextRect.Top);
|
||||||
end;
|
end;
|
||||||
ra180:
|
ra180:
|
||||||
begin
|
begin
|
||||||
ATextRect.Left := AWholeRect.Right - FScaledTextMargin * 2; // Shouldn't this be "div 2" ?
|
ATextRect := Rect(AWholeRect.Left, AWholeRect.Top - txtHeight, AWholeRect.Right - FScaledTextMargin, AWholeRect.Top);
|
||||||
//ATextRect.Top := AWholeRect.Top - txtHeight - FScaledTextMargin;
|
|
||||||
ATextRect.Top := AWholeRect.Top - txtHeight; // + FScaledTextMargin div 2;
|
|
||||||
ATextRect.Right := AWholeRect.Left + FScaledTextMargin;
|
|
||||||
ATextRect.Bottom := AWholeRect.Top - FScaledTextMargin div 2;
|
|
||||||
AWholeRect.Top := ATextRect.Top;
|
AWholeRect.Top := ATextRect.Top;
|
||||||
txtColWidth := ABitmap.Width;
|
txtColWidth := ABitmap.Width;
|
||||||
|
txtPt := Point(ATextRect.Right, ATextRect.Bottom);
|
||||||
end;
|
end;
|
||||||
ra270:
|
ra270:
|
||||||
begin
|
begin
|
||||||
ATextRect.Left := AWholeRect.Right;
|
ATextRect := Rect(AWholeRect.Right + 1, AWholeRect.Top, AWholeRect.Right + txtHeight + 1, AWholeRect.Bottom - FScaledTextMargin);
|
||||||
ATextRect.Top := AWholeRect.Bottom - FScaledTextMargin;
|
txtPt := Point(ATextRect.Left, ATextRect.Bottom);
|
||||||
ATextRect.Right := AWholeRect.Right + txtHeight + FScaledTextMargin div 2;
|
|
||||||
ATextRect.Bottom := AWholeRect.Top + FScaledTextMargin div 2;
|
|
||||||
AWholeRect.Right := ATextRect.Right;
|
AWholeRect.Right := ATextRect.Right;
|
||||||
txtColWidth := ABitmap.Height;
|
txtColWidth := ABitmap.Height;
|
||||||
end;
|
end;
|
||||||
@ -348,39 +340,31 @@ begin
|
|||||||
AText := GetDisplayString(ABitmap.Canvas, AText, 2, txtColWidth - FScaledTextMargin * 2);
|
AText := GetDisplayString(ABitmap.Canvas, AText, 2, txtColWidth - FScaledTextMargin * 2);
|
||||||
|
|
||||||
if ALabel <> '' then begin
|
if ALabel <> '' then begin
|
||||||
TPSTextOutAtPoint(
|
ABitmap.Canvas.TextOut(txtPt.X, txtPt.Y, ALabel);
|
||||||
ABitmap.Canvas,
|
|
||||||
Angle,
|
|
||||||
Rect(0, 0, ABitmap.Width, ABitmap.Height),
|
|
||||||
ATextRect.Left + FScaledTextMargin,
|
|
||||||
ATextRect.Top + FScaledTextMargin div 2,
|
|
||||||
ALabel
|
|
||||||
);
|
|
||||||
|
|
||||||
with ATextRect do
|
|
||||||
case Angle of
|
case Angle of
|
||||||
ra0 : TopLeft := Point(Left + FLabelWidth, Top + FScaledTextMargin div 2);
|
ra0:
|
||||||
ra90 : TopLeft := Point(Top + FLabelWidth, Left + FScaledTextMargin);
|
begin
|
||||||
ra180 : TopLeft := Point(Left - FLabelWidth, top + FScaledTextMargin div 2);
|
inc(ATextRect.Left, FLabelWidth);
|
||||||
ra270 : TopLeft := Point(Left + FScaledTextMargin div 2, Top - FLabelWidth);
|
txtPt.X := ATextRect.Left;
|
||||||
end;
|
end;
|
||||||
TPSTextOutAtPoint(
|
ra90:
|
||||||
ABitmap.Canvas,
|
begin
|
||||||
Angle,
|
inc(ATextRect.Top, FLabelWidth);
|
||||||
Rect(0, 0, ABitmap.Width, ABitmap.Height),
|
txtPt.Y := ATextRect.Top;
|
||||||
ATextRect.Left,
|
end;
|
||||||
ATextRect.Top,
|
ra180:
|
||||||
AText
|
begin
|
||||||
);
|
dec(ATextRect.Right, FLabelWidth);
|
||||||
end else
|
txtPt.X := ATextRect.Right;
|
||||||
TPSTextOutAtPoint(
|
end;
|
||||||
ABitmap.Canvas,
|
ra270:
|
||||||
Angle,
|
begin
|
||||||
Rect(0, 0, ABitmap.Width, ABitmap.Height),
|
dec(ATextRect.Bottom, FLabelWidth);
|
||||||
ATextRect.Left + FScaledTextMargin,
|
txtPt.Y := ATextRect.Bottom;
|
||||||
ATextRect.Top + FScaledTextMargin div 2,
|
end;
|
||||||
AText
|
end;
|
||||||
);
|
end;
|
||||||
|
ABitmap.Canvas.TextOut(txtPt.X, txtPt.Y, AText);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Draws selected data for the specified contact on the auxiliary bitmap.
|
{ Draws selected data for the specified contact on the auxiliary bitmap.
|
||||||
@ -410,7 +394,13 @@ begin
|
|||||||
{$IF VP_LCL_SCALING = 0}
|
{$IF VP_LCL_SCALING = 0}
|
||||||
ABitmap.Canvas.Font.Size := ScaleY(ABitmap.Canvas.Font.Size, DesignTimeDPI);
|
ABitmap.Canvas.Font.Size := ScaleY(ABitmap.Canvas.Font.Size, DesignTimeDPI);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Abitmap.Canvas.Brush.Color := RealColor;
|
ABitmap.Canvas.Brush.Color := RealColor;
|
||||||
|
case Angle of
|
||||||
|
ra0 : ABitmap.Canvas.Font.Orientation := 0;
|
||||||
|
ra90 : ABitmap.Canvas.Font.Orientation := 2700;
|
||||||
|
ra180 : ABitmap.Canvas.Font.Orientation := 1800;
|
||||||
|
ra270 : ABitmap.Canvas.Font.Orientation := 900;
|
||||||
|
end;
|
||||||
|
|
||||||
// Draw company
|
// Draw company
|
||||||
DrawContactRow(ABitmap, AContact.Company, '', AWholeRect, AContactRec.CompanyRect);
|
DrawContactRow(ABitmap, AContact.Company, '', AWholeRect, AContactRec.CompanyRect);
|
||||||
@ -575,8 +565,6 @@ begin
|
|||||||
|
|
||||||
// Draw the contact data
|
// Draw the contact data
|
||||||
WholeRect := HeadRect;
|
WholeRect := HeadRect;
|
||||||
if Angle = ra180 then
|
|
||||||
WholeRect.BottomRight := Point(TmpBmp.Width, TmpBmp.Height);
|
|
||||||
if DrawContactRows(TmpBmp, contact, Anchor, WholeRect, Col, RecsInCol, CR) then
|
if DrawContactRows(TmpBmp, contact, Anchor, WholeRect, Col, RecsInCol, CR) then
|
||||||
begin
|
begin
|
||||||
newPage := false;
|
newPage := false;
|
||||||
|
Reference in New Issue
Block a user