You've already forked lazarus-ccr
tvplanit: Show current page number and page count in PrintPreview.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8507 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -51,10 +51,12 @@ type
|
||||
|
||||
TfrmPrintPreview = class(TForm)
|
||||
Bevel1: TBevel;
|
||||
PageInfo: TLabel;
|
||||
Panel1: TPanel;
|
||||
cboxZoom: TComboBox;
|
||||
btnCancel: TToolButton;
|
||||
Panel2: TPanel;
|
||||
pnlPageCount: TPanel;
|
||||
VpPrintPreview1: TVpPrintPreview;
|
||||
VpPrintFormatComboBox1: TVpPrintFormatComboBox;
|
||||
ToolBar1: TToolBar;
|
||||
@ -86,6 +88,7 @@ type
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure ToolBar1Resize(Sender: TObject);
|
||||
procedure VpPrintFormatComboBox1Change(Sender: TObject);
|
||||
|
||||
private
|
||||
@ -93,6 +96,7 @@ type
|
||||
procedure PopulateImageList;
|
||||
procedure SetCaptions;
|
||||
procedure SetDrawingStyle(AValue: TVpDrawingStyle);
|
||||
procedure UpdatePageInfo;
|
||||
|
||||
public
|
||||
Resource: TVpResource;
|
||||
@ -234,6 +238,7 @@ procedure TfrmPrintPreview.VpPrintFormatComboBox1Change(Sender: TObject);
|
||||
begin
|
||||
VpPrintPreview1.ForceUpdate;
|
||||
VpPrintPreview1.FirstPage;
|
||||
UpdatePageInfo;
|
||||
end;
|
||||
|
||||
procedure TfrmPrintPreview.OKBtnClick(Sender: TObject);
|
||||
@ -280,6 +285,7 @@ begin
|
||||
EditForm.VpPrintPreview1.ForceUpdate;
|
||||
EditForm.VpPrintPreview1.FirstPage;
|
||||
EditForm.DrawingStyle := FDrawingStyle;
|
||||
// EditForm.PageInfo.Caption := Format('%d pages', [EditForm.VpPrintPreview1.PageCount]);
|
||||
EditForm.ShowModal;
|
||||
if EditForm.ReturnCode = rtCommit then begin
|
||||
Result := True;
|
||||
@ -383,6 +389,9 @@ begin
|
||||
VpPrintPreview1.ZoomFactor := TVpPPZoomFactor(cboxZoom.ItemIndex);
|
||||
end;
|
||||
|
||||
{ Print button clicked. The PrintView form itself does not send anything to
|
||||
the printer. The calling procedure - in this case: the PrintPreviewDialog.Execute
|
||||
method - must do this if the ReturnCode of the PrintPreview is rtCommit. }
|
||||
procedure TfrmPrintPreview.actPrintExecute(Sender: TObject);
|
||||
begin
|
||||
ReturnCode := rtCommit;
|
||||
@ -392,23 +401,29 @@ end;
|
||||
procedure TfrmPrintPreview.actFirstPageExecute(Sender: TObject);
|
||||
begin
|
||||
VpPrintPreview1.FirstPage;
|
||||
UpdatePageInfo;
|
||||
end;
|
||||
|
||||
procedure TfrmPrintPreview.actPrevPageExecute(Sender: TObject);
|
||||
begin
|
||||
VpPrintPreview1.PrevPage;
|
||||
UpdatePageInfo;
|
||||
end;
|
||||
|
||||
procedure TfrmPrintPreview.actNextPageExecute(Sender: TObject);
|
||||
begin
|
||||
VpPrintPreview1.NextPage;
|
||||
UpdatePageInfo;
|
||||
end;
|
||||
|
||||
procedure TfrmPrintPreview.actLastPageExecute(Sender: TObject);
|
||||
begin
|
||||
VpPrintPreview1.LastPage;
|
||||
UpdatePageInfo;
|
||||
end;
|
||||
|
||||
{ OnUpdate handler for the main form actionlist. Enables/disables the actions
|
||||
(first/previous/next/last page buttons). }
|
||||
procedure TfrmPrintPreview.actMainUpdate(Action: TBasicAction;
|
||||
var Handled: Boolean);
|
||||
begin
|
||||
@ -457,6 +472,9 @@ var
|
||||
begin
|
||||
if VpPrintPreview1.ControlLink = nil then
|
||||
exit;
|
||||
|
||||
UpdatePageInfo;
|
||||
|
||||
(*
|
||||
cnv := TControlCanvas.Create;
|
||||
try
|
||||
@ -475,5 +493,15 @@ begin
|
||||
end;*)
|
||||
end;
|
||||
|
||||
procedure TfrmPrintPreview.ToolBar1Resize(Sender: TObject);
|
||||
begin
|
||||
pnlPageCount.Width := Toolbar1.ClientWidth - pnlPageCount.Left;
|
||||
end;
|
||||
|
||||
procedure TfrmPrintPreview.UpdatePageInfo;
|
||||
begin
|
||||
PageInfo.Caption := Format('page %d of %d', [VpPrintPreview1.CurPage+1, VpPrintPreview1.PageCount]);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
Reference in New Issue
Block a user