LCL, fix typos and postscriptcanvas Y margin

git-svn-id: trunk@15815 -
This commit is contained in:
jesus 2008-07-18 21:16:39 +00:00
parent c7d1d9ba34
commit 34f9100000
2 changed files with 54 additions and 9 deletions

View File

@ -558,8 +558,8 @@ end;
//Modify X and Y for use Left and Top margin //Modify X and Y for use Left and Top margin
procedure TPostScriptPrinterCanvas.TranslateCoord(var X,Y : Integer); procedure TPostScriptPrinterCanvas.TranslateCoord(var X,Y : Integer);
begin begin
Y:=PageHeight-TopMarging-Y; Y:=PageHeight+BottomMargin-Y;
X:=X+LeftMarging; X:=X+LeftMargin;
end; end;
//Save the last position //Save the last position

View File

@ -53,8 +53,10 @@ type
fPageHeight : Integer; fPageHeight : Integer;
fPageWidth : Integer; fPageWidth : Integer;
fPageNum : Integer; fPageNum : Integer;
fTopMarging : Integer; fTopMargin : Integer;
fLeftMarging : Integer; fLeftMargin : Integer;
fBottomMargin : Integer;
fRightMargin : Integer;
function GetPageHeight: Integer; function GetPageHeight: Integer;
function GetPageWidth: Integer; function GetPageWidth: Integer;
@ -66,7 +68,10 @@ type
procedure BeginDoc; virtual; procedure BeginDoc; virtual;
procedure NewPage; virtual; procedure NewPage; virtual;
procedure EndDoc; virtual; procedure EndDoc; virtual;
function GetLeftMargin: Integer;
function GetTopMargin: Integer;
function GetBottomMargin: Integer;
function GetRightMargin: Integer;
public public
constructor Create(APrinter: TPrinter); virtual; constructor Create(APrinter: TPrinter); virtual;
procedure Changing; override; procedure Changing; override;
@ -77,8 +82,10 @@ type
property PageHeight : Integer read GetPageHeight write SetPageHeight; property PageHeight : Integer read GetPageHeight write SetPageHeight;
property PageWidth : Integer read GetPageWidth write SetPageWidth; property PageWidth : Integer read GetPageWidth write SetPageWidth;
property PageNumber : Integer read fPageNum; property PageNumber : Integer read fPageNum;
property TopMarging : Integer read fTopMarging write fTopMarging; property TopMargin : Integer read GetLeftMargin write FTopMargin;
property LeftMarging: Integer read fLeftMarging write fLeftMarging; property LeftMargin: Integer read GetTopMargin write FLeftMargin;
property BottomMargin: Integer read GetBottomMargin write FBottomMargin;
property RightMargin: Integer read GetRightMargin write FRightMargin;
end; end;
@ -903,8 +910,10 @@ begin
Inherited Create; Inherited Create;
fPageWidth :=0; fPageWidth :=0;
fPageHeight :=0; fPageHeight :=0;
fTopMarging :=0; fTopMargin :=0;
fLeftMarging:=0; fLeftMargin :=0;
fRightMargin :=0;
fBottomMargin :=0;
fPrinter:=aPrinter; fPrinter:=aPrinter;
end; end;
@ -930,6 +939,42 @@ begin
//No special action //No special action
end; end;
function TPrinterCanvas.GetLeftMargin: Integer;
begin
if (fLeftMargin=0) and (fPrinter<>nil) then
Result:=fPrinter.PaperSize.PaperRect.WorkRect.Left
else
Result:=FLeftMargin;
end;
function TPrinterCanvas.GetTopMargin: Integer;
begin
if (fTopMargin=0) and (fPrinter<>nil) then
Result:=fPrinter.PaperSize.PaperRect.WorkRect.Top
else
Result:=fTopMargin;
end;
function TPrinterCanvas.GetBottomMargin: Integer;
begin
if (fBottomMargin=0) and (fPrinter<>nil) then
begin
with fPrinter.Papersize.PaperRect do
Result := PhysicalRect.Bottom-WorkRect.Bottom;
end else
Result := fBottomMargin;
end;
function TPrinterCanvas.GetRightMargin: Integer;
begin
if (fRightMargin=0) and (fPrinter<>nil) then
begin
with fPrinter.Papersize.PaperRect do
Result := PhysicalRect.Right-WorkRect.Right;
end else
Result := fRightMargin;
end;
INITIALIZATION INITIALIZATION
//TPrinter it's an basic object. If you override this object, //TPrinter it's an basic object. If you override this object,
//you must create an instance. //you must create an instance.