mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 20:36:38 +02:00
* Fix bug ID #32308, rename PageNumber to PageIndex
git-svn-id: trunk@55731 -
This commit is contained in:
parent
b27d1511ab
commit
bbfb00769c
@ -229,7 +229,7 @@ end;
|
||||
|
||||
procedure TFPreportPreviewForm.DoNextAction(Sender: TObject);
|
||||
begin
|
||||
FRender.PageNumber:=FRender.PageNumber+1
|
||||
FRender.PageIndex:=FRender.PageIndex+1
|
||||
end;
|
||||
|
||||
procedure TFPreportPreviewForm.DoPaintReport(Sender: TObject);
|
||||
@ -239,17 +239,17 @@ end;
|
||||
|
||||
procedure TFPreportPreviewForm.DoPreviousAction(Sender: TObject);
|
||||
begin
|
||||
FRender.PageNumber:=FRender.PageNumber-1;
|
||||
FRender.PageIndex:=FRender.PageIndex-1;
|
||||
end;
|
||||
|
||||
procedure TFPreportPreviewForm.UpdateNextAction(Sender: TObject);
|
||||
begin
|
||||
(Sender as TAction).Enabled:=(FRender.PageNumber<ReportPages.Count-1);
|
||||
(Sender as TAction).Enabled:=(FRender.PageIndex<ReportPages.Count-1);
|
||||
end;
|
||||
|
||||
procedure TFPreportPreviewForm.UpdatePreviousAction(Sender: TObject);
|
||||
begin
|
||||
(Sender as TAction).Enabled:=(FRender.PageNumber>0);
|
||||
(Sender as TAction).Enabled:=(FRender.PageIndex>0);
|
||||
|
||||
end;
|
||||
|
||||
|
@ -89,7 +89,7 @@ type
|
||||
FImageWidth: integer;
|
||||
FImageHeight: integer;
|
||||
FFonts : TFPObjectHashTable;
|
||||
FPageNumber: Integer;
|
||||
FPageIndex : Integer;
|
||||
FPages : TFPList;
|
||||
FVDPI: integer;
|
||||
FVertOffset: Integer;
|
||||
@ -102,7 +102,7 @@ type
|
||||
function GetPageCount: Integer;
|
||||
procedure PrepareCanvas;
|
||||
procedure SetHyperlinksEnabled(AValue: Boolean);
|
||||
procedure SetPageNumber(AValue: Integer);
|
||||
procedure SetPageIndex(AValue: Integer);
|
||||
protected
|
||||
procedure RenderFrame(const AFrame: TFPReportFrame; const ARect: Trect; const ABackgroundColor: TColor);
|
||||
Procedure RenderImage(aRect : TFPReportRect; var AImage: TFPCustomImage) ; override;
|
||||
@ -153,7 +153,7 @@ type
|
||||
property VDPI: integer read FVDPI write FVDPI;
|
||||
property Zoom : Double read FZoom write FZoom;
|
||||
Property Canvas : TCanvas Read FCanvas Write FCanvas;
|
||||
Property PageNumber : Integer Read FPageNumber Write SetPageNumber;
|
||||
Property PageIndex : Integer Read FPageIndex Write SetPageIndex;
|
||||
Property PageCount : Integer Read GetPageCount;
|
||||
Property CurrentPage : TFPReportPage Read GetCurrentPage;
|
||||
Property HorzOffset : Integer Read FHorzOffset Write FHorzOffset;
|
||||
@ -176,7 +176,8 @@ uses
|
||||
fpwritepng,
|
||||
math;
|
||||
|
||||
|
||||
Resourcestring
|
||||
SErrPageOutOfRange = 'Page index %d out of allowed range [0..%d]';
|
||||
|
||||
type
|
||||
|
||||
@ -288,8 +289,8 @@ end;
|
||||
|
||||
function TFPReportExportCanvas.GetCurrentPage: TFPReportPage;
|
||||
begin
|
||||
if Assigned(FPages) and (PageNumber<FPages.Count) then
|
||||
Result:=TFPReportPage(FPages[PageNumber])
|
||||
if Assigned(FPages) and (PageIndex<FPages.Count) then
|
||||
Result:=TFPReportPage(FPages[PageIndex])
|
||||
else
|
||||
Result:=Nil;
|
||||
end;
|
||||
@ -301,7 +302,10 @@ end;
|
||||
|
||||
function TFPReportExportCanvas.GetPageCount: Integer;
|
||||
begin
|
||||
Result:=FPages.Count;
|
||||
if Assigned(FPages) then
|
||||
Result:=FPages.Count
|
||||
else
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function TFPReportExportCanvas.CoordToPoint(const APos: TFPReportPoint;
|
||||
@ -890,10 +894,12 @@ begin
|
||||
FreeAndNil(FHyperLinks);
|
||||
end;
|
||||
|
||||
procedure TFPReportExportCanvas.SetPageNumber(AValue: Integer);
|
||||
procedure TFPReportExportCanvas.SetPageIndex(AValue: Integer);
|
||||
begin
|
||||
if FPageNumber=AValue then Exit;
|
||||
FPageNumber:=AValue;
|
||||
if FPageIndex=AValue then Exit;
|
||||
FPageIndex:=AValue;
|
||||
if Assigned(Report) and (FPageIndex<0) or (FPageIndex>=PageCount) then
|
||||
Raise EReportError.CreateFmt(SErrPageOutOfRange,[FPageIndex,PageCount-1]);
|
||||
RenderCurrentPage;
|
||||
end;
|
||||
|
||||
|
@ -90,10 +90,10 @@ type
|
||||
procedure DoExport(Sender: TObject);
|
||||
procedure ExportReport(REC: TFPReportExporterClass);
|
||||
procedure FillExportMenu;
|
||||
function GetPageNumber: Integer;
|
||||
function GetPageIndex: Integer;
|
||||
procedure ResizePreview;
|
||||
procedure SetCurrentZoom(AValue: Integer);
|
||||
procedure SetPageNumber(AValue: Integer);
|
||||
procedure SetPageIndex(AValue: Integer);
|
||||
Protected
|
||||
function GetEnableHyperLinks: Boolean ; override;
|
||||
procedure SetEnableHyperLinks(AValue: Boolean); override;
|
||||
@ -106,7 +106,7 @@ type
|
||||
{ public declarations }
|
||||
Property CurrentZoom : Integer Read FCurrentZoom Write SetCurrentZoom;
|
||||
// Zero based !
|
||||
Property PageNumber : Integer Read GetPageNumber Write SetPageNumber;
|
||||
Property PageIndex : Integer Read GetPageIndex Write SetPageIndex;
|
||||
// If not set, the OpenURL method of LCL will be called.
|
||||
Property OnOpenURL : TOpenURLEvent Read FOnOpenURL Write FOnOpenURL;
|
||||
end;
|
||||
@ -175,27 +175,27 @@ end;
|
||||
|
||||
procedure TFPReportPreviewForm.AExportPDFUpdate(Sender: TObject);
|
||||
begin
|
||||
|
||||
(Sender as TAction).Enabled:=ReportExportManager.FindExporter(PDFExport)<>Nil;
|
||||
end;
|
||||
|
||||
procedure TFPReportPreviewForm.ANextExecute(Sender: TObject);
|
||||
begin
|
||||
PageNumber:=PageNumber+1;
|
||||
PageIndex:=PageIndex+1;
|
||||
end;
|
||||
|
||||
procedure TFPReportPreviewForm.ANextUpdate(Sender: TObject);
|
||||
begin
|
||||
(Sender as TAction).Enabled:=FRender.PageNumber<ReportPages.Count;
|
||||
(Sender as TAction).Enabled:=PageIndex<ReportPages.Count-1;
|
||||
end;
|
||||
|
||||
procedure TFPReportPreviewForm.APreviousExecute(Sender: TObject);
|
||||
begin
|
||||
PageNumber:=PageNumber-1;
|
||||
PageIndex:=PageIndex-1;
|
||||
end;
|
||||
|
||||
procedure TFPReportPreviewForm.APreviousUpdate(Sender: TObject);
|
||||
begin
|
||||
(Sender as TAction).Enabled:=FRender.PageNumber>0;
|
||||
(Sender as TAction).Enabled:=PageIndex>0;
|
||||
end;
|
||||
|
||||
procedure TFPReportPreviewForm.APrintExecute(Sender: TObject);
|
||||
@ -236,7 +236,7 @@ Var
|
||||
begin
|
||||
PN:=StrToIntDef(EPage.Text,-1);
|
||||
if (PN<1) or (PN>FRender.PageCount) then exit;
|
||||
FRender.PageNumber:=PN-1;
|
||||
FRender.PageIndex:=PN-1;
|
||||
end;
|
||||
|
||||
|
||||
@ -251,14 +251,14 @@ begin
|
||||
Frender.RenderCurrentPage;
|
||||
end;
|
||||
|
||||
function TFPReportPreviewForm.GetPageNumber: Integer;
|
||||
function TFPReportPreviewForm.GetPageIndex: Integer;
|
||||
begin
|
||||
Result:=FRender.PageNumber;
|
||||
Result:=FRender.PageIndex;
|
||||
end;
|
||||
|
||||
procedure TFPReportPreviewForm.SetPageNumber(AValue: Integer);
|
||||
procedure TFPReportPreviewForm.SetPageIndex(AValue: Integer);
|
||||
begin
|
||||
FRender.PageNumber:=AValue;
|
||||
FRender.PageIndex:=AValue;
|
||||
EPage.Text:=IntToStr(AValue+1);
|
||||
end;
|
||||
|
||||
@ -281,7 +281,7 @@ begin
|
||||
FRender.Execute;
|
||||
LPageCount.Caption:=Format(SPageCount,[FRender.PageCount]);
|
||||
EPage.Text:='1';
|
||||
PageNumber:=0;
|
||||
PageIndex:=0;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -68,7 +68,7 @@ procedure TFPreportPrinterExport.PrintPage(P : TPrinter; E : TFPReportExportCanv
|
||||
|
||||
begin
|
||||
E.Canvas:=P.Canvas;
|
||||
E.PageNumber:=PageNo;
|
||||
E.PageIndex:=PageNo;
|
||||
E.Execute;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user