You've already forked lazarus-ccr
GridPrinter: More options to control the preview's toolbar.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8609 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -4,41 +4,10 @@
|
||||
{"hash":13109985,"name":"tgridprintpreviewform.tbdivider1.caption","sourcebytes":[116,98,68,105,118,105,100,101,114,49],"value":"tbDivider1"},
|
||||
{"hash":13109986,"name":"tgridprintpreviewform.tbdivider2.caption","sourcebytes":[116,98,68,105,118,105,100,101,114,50],"value":"tbDivider2"},
|
||||
{"hash":13109987,"name":"tgridprintpreviewform.tbdivider3.caption","sourcebytes":[116,98,68,105,118,105,100,101,114,51],"value":"tbDivider3"},
|
||||
{"hash":14901026,"name":"tgridprintpreviewform.edpagenumber.text","sourcebytes":[101,100,80,97,103,101,78,117,109,98,101,114],"value":"edPageNumber"},
|
||||
{"hash":13109988,"name":"tgridprintpreviewform.tbdivider4.caption","sourcebytes":[116,98,68,105,118,105,100,101,114,52],"value":"tbDivider4"},
|
||||
{"hash":13109989,"name":"tgridprintpreviewform.tbdivider5.caption","sourcebytes":[116,98,68,105,118,105,100,101,114,53],"value":"tbDivider5"},
|
||||
{"hash":5738580,"name":"tgridprintpreviewform.acprint.caption","sourcebytes":[80,114,105,110,116],"value":"Print"},
|
||||
{"hash":5738580,"name":"tgridprintpreviewform.acprint.hint","sourcebytes":[80,114,105,110,116],"value":"Print"},
|
||||
{"hash":4863637,"name":"tgridprintpreviewform.acclose.caption","sourcebytes":[67,108,111,115,101],"value":"Close"},
|
||||
{"hash":4863637,"name":"tgridprintpreviewform.acclose.hint","sourcebytes":[67,108,111,115,101],"value":"Close"},
|
||||
{"hash":5048740,"name":"tgridprintpreviewform.acfirstpage.caption","sourcebytes":[70,105,114,115,116],"value":"First"},
|
||||
{"hash":217173685,"name":"tgridprintpreviewform.acfirstpage.hint","sourcebytes":[83,104,111,119,32,102,105,114,115,116,32,112,97,103,101],"value":"Show first page"},
|
||||
{"hash":147653555,"name":"tgridprintpreviewform.acprevpage.caption","sourcebytes":[80,114,101,118,105,111,117,115],"value":"Previous"},
|
||||
{"hash":239386821,"name":"tgridprintpreviewform.acprevpage.hint","sourcebytes":[83,104,111,119,32,112,114,101,118,105,111,117,115,32,112,97,103,101],"value":"Show previous page"},
|
||||
{"hash":347380,"name":"tgridprintpreviewform.acnextpage.caption","sourcebytes":[78,101,120,116],"value":"Next"},
|
||||
{"hash":923269,"name":"tgridprintpreviewform.acnextpage.hint","sourcebytes":[83,104,111,119,32,110,101,120,116,32,112,97,103,101],"value":"Show next page"},
|
||||
{"hash":338084,"name":"tgridprintpreviewform.aclastpage.caption","sourcebytes":[76,97,115,116],"value":"Last"},
|
||||
{"hash":84807877,"name":"tgridprintpreviewform.aclastpage.hint","sourcebytes":[83,104,111,119,32,108,97,115,116,32,112,97,103,101],"value":"Show last page"},
|
||||
{"hash":23459486,"name":"tgridprintpreviewform.aczoomin.caption","sourcebytes":[90,111,111,109,32,105,110],"value":"Zoom in"},
|
||||
{"hash":23459486,"name":"tgridprintpreviewform.aczoomin.hint","sourcebytes":[90,111,111,109,32,105,110],"value":"Zoom in"},
|
||||
{"hash":106918100,"name":"tgridprintpreviewform.aczoomout.caption","sourcebytes":[90,111,111,109,32,111,117,116],"value":"Zoom out"},
|
||||
{"hash":106918100,"name":"tgridprintpreviewform.aczoomout.hint","sourcebytes":[90,111,111,109,32,111,117,116],"value":"Zoom out"},
|
||||
{"hash":108902056,"name":"tgridprintpreviewform.aczoomtofitwidth.caption","sourcebytes":[70,105,116,32,119,105,100,116,104],"value":"Fit width"},
|
||||
{"hash":28176728,"name":"tgridprintpreviewform.aczoomtofitwidth.hint","sourcebytes":[90,111,111,109,32,116,111,32,102,105,116,32,119,105,100,116,104],"value":"Zoom to fit width"},
|
||||
{"hash":116338068,"name":"tgridprintpreviewform.aczoomtofitheight.caption","sourcebytes":[70,105,116,32,104,101,105,103,104,116],"value":"Fit height"},
|
||||
{"hash":122522228,"name":"tgridprintpreviewform.aczoomtofitheight.hint","sourcebytes":[90,111,111,109,32,116,111,32,102,105,116,32,112,97,103,101,32,104,101,105,103,104,116],"value":"Zoom to fit page height"},
|
||||
{"hash":213797,"name":"tgridprintpreviewform.aczoom100.caption","sourcebytes":[49,48,48,37],"value":"100%"},
|
||||
{"hash":23626005,"name":"tgridprintpreviewform.aczoom100.hint","sourcebytes":[79,114,105,103,105,110,97,108,32,115,105,122,101],"value":"Original size"},
|
||||
{"hash":59301891,"name":"tgridprintpreviewform.acpagemargins.caption","sourcebytes":[77,97,114,103,105,110,115],"value":"Margins"},
|
||||
{"hash":116328739,"name":"tgridprintpreviewform.acpagemargins.hint","sourcebytes":[80,97,103,101,32,109,97,114,103,105,110,115],"value":"Page margins"},
|
||||
{"hash":208537918,"name":"tgridprintpreviewform.acheaderfooter.caption","sourcebytes":[72,101,97,100,101,114,47,102,111,111,116,101,114,46,46,46],"value":"Header/footer..."},
|
||||
{"hash":120242270,"name":"tgridprintpreviewform.acheaderfooter.hint","sourcebytes":[72,101,97,100,101,114,47,102,111,111,116,101,114,32,99,111,110,102,105,103,117,114,97,116,105,111,110],"value":"Header/footer configuration"},
|
||||
{"hash":110855028,"name":"tgridprintpreviewform.acportrait.caption","sourcebytes":[80,111,114,116,114,97,105,116],"value":"Portrait"},
|
||||
{"hash":97583166,"name":"tgridprintpreviewform.acportrait.hint","sourcebytes":[80,111,114,116,114,97,105,116,32,112,97,103,101,32,111,114,105,101,110,116,97,116,105,111,110],"value":"Portrait page orientation"},
|
||||
{"hash":79284965,"name":"tgridprintpreviewform.aclandscape.caption","sourcebytes":[76,97,110,100,115,99,97,112,101],"value":"Landscape"},
|
||||
{"hash":214097038,"name":"tgridprintpreviewform.aclandscape.hint","sourcebytes":[76,97,110,100,115,99,97,112,101,32,112,97,103,101,32,111,114,105,101,110,116,97,116,105,111,110],"value":"Landscape page orientation"},
|
||||
{"hash":252759476,"name":"tgridprintpreviewform.acprintcolsfirst.caption","sourcebytes":[67,111,108,117,109,110,115,32,102,105,114,115,116],"value":"Columns first"},
|
||||
{"hash":179142132,"name":"tgridprintpreviewform.acprintcolsfirst.hint","sourcebytes":[70,105,114,115,116,32,112,114,105,110,116,32,99,111,108,117,109,110,115,32,102,114,111,109,32,116,111,112,32,116,111,32,98,111,116,116,111,109,44,13,10,116,104,101,110,32,112,114,105,110,116,32,102,114,111,109,32,108,101,102,116,32,116,111,32,114,105,103,104,116],"value":"First print columns from top to bottom,\r\nthen print from left to right"},
|
||||
{"hash":90873668,"name":"tgridprintpreviewform.acprintrowsfirst.caption","sourcebytes":[82,111,119,115,32,102,105,114,115,116],"value":"Rows first"},
|
||||
{"hash":159637965,"name":"tgridprintpreviewform.acprintrowsfirst.hint","sourcebytes":[70,105,114,115,116,32,112,114,105,110,116,32,114,111,119,115,32,102,114,111,109,32,108,101,102,116,32,116,111,32,114,105,103,104,116,44,13,10,116,104,101,110,32,112,114,105,110,116,32,102,114,111,109,32,116,111,112,32,116,111,32,98,111,116,116,111,109],"value":"First print rows from left to right,\r\nthen print from top to bottom"}
|
||||
{"hash":231980464,"name":"tgridprintpreviewform.tbpagesetup.caption","sourcebytes":[116,98,80,97,103,101,83,101,116,117,112],"value":"tbPageSetup"},
|
||||
{"hash":13109990,"name":"tgridprintpreviewform.tbdivider6.caption","sourcebytes":[116,98,68,105,118,105,100,101,114,54],"value":"tbDivider6"},
|
||||
{"hash":13109991,"name":"tgridprintpreviewform.tbdivider7.caption","sourcebytes":[116,98,68,105,118,105,100,101,114,55],"value":"tbDivider7"},
|
||||
{"hash":14901026,"name":"tgridprintpreviewform.edpagenumber.text","sourcebytes":[101,100,80,97,103,101,78,117,109,98,101,114],"value":"edPageNumber"}
|
||||
]}
|
||||
|
||||
@@ -13,16 +13,24 @@ type
|
||||
TGridPrintPreviewZoomMode = (zmCustom, zmFitWidth, zmFitHeight);
|
||||
|
||||
TGridPrintPreviewOption = (ppoNavigationBtns, ppoNavigationEdit,
|
||||
ppoZoomBtns, ppoPageOrientationBtns, ppoMarginsBtn, ppoHeaderFooterBtn,
|
||||
ppoPrintOrderBtns
|
||||
ppoZoomBtns,
|
||||
ppoPageOrientationBtns, ppoMarginsBtn, ppoHeaderFooterBtn,
|
||||
ppoPrintOrderBtns, ppoCenterBtns,
|
||||
ppoPageSetupBtn,
|
||||
ppoPageNumberInfo,
|
||||
ppoZoomLevelInfo
|
||||
);
|
||||
TGridPrintPreviewOptions = set of TGridPrintPreviewOption;
|
||||
|
||||
const
|
||||
DEFAULT_GRIDPRN_OPTIONS = [
|
||||
ppoNavigationBtns, ppoNavigationEdit,
|
||||
ppoZoomBtns, ppoPageOrientationBtns, ppoMarginsBtn, ppoHeaderFooterBtn,
|
||||
ppoPrintOrderBtns
|
||||
ppoZoomBtns,
|
||||
// ppoPageOrientationBtns, ppoMarginsBtn, ppoHeaderFooterBtn,
|
||||
// ppoPrintOrderBtns, ppoCenterBtns,
|
||||
ppoPageSetupBtn,
|
||||
ppoPageNumberInfo,
|
||||
ppoZoomLevelInfo
|
||||
];
|
||||
|
||||
type
|
||||
@@ -41,6 +49,8 @@ type
|
||||
acLandscape: TAction;
|
||||
acPrintColsFirst: TAction;
|
||||
acPrintRowsFirst: TAction;
|
||||
acCenterHor: TAction;
|
||||
acCenterVert: TAction;
|
||||
acZoom100: TAction;
|
||||
acZoomToFitWidth: TAction;
|
||||
acZoomToFitHeight: TAction;
|
||||
@@ -49,8 +59,21 @@ type
|
||||
ActionList: TActionList;
|
||||
edPageNumber: TEdit;
|
||||
InfoPanel: TPanel;
|
||||
mnuHeaderFooter: TMenuItem;
|
||||
mnuPageMargins: TMenuItem;
|
||||
mnuLandscape: TMenuItem;
|
||||
mnuPortrait: TMenuItem;
|
||||
mnuPrintColsFirst: TMenuItem;
|
||||
mnuPrintRowsFirst: TMenuItem;
|
||||
mnuCenterHor: TMenuItem;
|
||||
mnuCenterVert: TMenuItem;
|
||||
PageSetupPopup: TPopupMenu;
|
||||
PageNoEditPanel: TPanel;
|
||||
PreviewImage: TImage;
|
||||
ScrollBox: TScrollBox;
|
||||
mnuSeparator3: TMenuItem;
|
||||
mnuSeparator2: TMenuItem;
|
||||
mnuSeparator1: TMenuItem;
|
||||
ToolbarImages: TImageList;
|
||||
ToolBar: TToolBar;
|
||||
tbPrint: TToolButton;
|
||||
@@ -67,14 +90,21 @@ type
|
||||
tbZoomWidth: TToolButton;
|
||||
tbZoomHeight: TToolButton;
|
||||
tbZoom100: TToolButton;
|
||||
ToolButton1: TToolButton;
|
||||
tbPageMargins: TToolButton;
|
||||
tbHeaderFooter: TToolButton;
|
||||
ToolButton2: TToolButton;
|
||||
ToolButton3: TToolButton;
|
||||
tbDivider5: TToolButton;
|
||||
tbDivider4: TToolButton;
|
||||
tbPortraint: TToolButton;
|
||||
tbPortrait: TToolButton;
|
||||
tbLandscape: TToolButton;
|
||||
tbDivider5: TToolButton;
|
||||
tbPageSetup: TToolButton;
|
||||
tbPrintColsFirst: TToolButton;
|
||||
tbPrintRowsFirst: TToolButton;
|
||||
tbCenterHor: TToolButton;
|
||||
tbCenterVert: TToolButton;
|
||||
tbDivider6: TToolButton;
|
||||
tbDivider7: TToolButton;
|
||||
procedure acCenterHorExecute(Sender: TObject);
|
||||
procedure acCenterVertExecute(Sender: TObject);
|
||||
procedure acCloseExecute(Sender: TObject);
|
||||
procedure acFirstPageExecute(Sender: TObject);
|
||||
procedure acHeaderFooterExecute(Sender: TObject);
|
||||
@@ -115,6 +145,7 @@ type
|
||||
FDraggedPos: Integer;
|
||||
FGridPrinter: TGridPrinter;
|
||||
FHintWindow: THintWindow;
|
||||
FInfoMask: String;
|
||||
FPageCount: Integer;
|
||||
FPageNumber: Integer;
|
||||
FOptions: TGridPrintPreviewOptions;
|
||||
@@ -165,6 +196,8 @@ uses
|
||||
|
||||
const
|
||||
ZOOM_MULTIPLIER = 1.05;
|
||||
CHECKMARK = #$E2#$9C#$93; // Checkmark characer in UTF-8
|
||||
SPACE_CHECKMARK = ' ' + CHECKMARK;
|
||||
|
||||
{ Returns true when X1 is in range between X2-Delta and X2+Delta. }
|
||||
function InRange(X1, X2, Delta: Integer): Boolean; inline;
|
||||
@@ -185,6 +218,16 @@ begin
|
||||
Result := X;
|
||||
end;
|
||||
|
||||
{ Appends a checkmark to the given caption string if AEnable is true.
|
||||
Meant to better show the checked state of menu items having icons. }
|
||||
function MarkAsChecked(ACaption: String; AEnable: Boolean): String;
|
||||
begin
|
||||
if AEnable then
|
||||
Result := ACaption + SPACE_CHECKMARK
|
||||
else
|
||||
Result := ACaption;
|
||||
end;
|
||||
|
||||
{ TGridPrintPreviewForm }
|
||||
|
||||
constructor TGridPrintPreviewForm.Create(AOwner: TComponent);
|
||||
@@ -208,6 +251,32 @@ begin
|
||||
ModalResult := mrCancel;
|
||||
end;
|
||||
|
||||
procedure TGridPrintPreviewForm.acCenterHorExecute(Sender: TObject);
|
||||
begin
|
||||
if Assigned(FGridPrinter) then
|
||||
begin
|
||||
if acCenterHor.Checked then
|
||||
FGridPrinter.Options := FGridPrinter.Options + [gpoCenterHor]
|
||||
else
|
||||
FGridPrinter.Options := FGridPrinter.Options - [gpoCenterHor];
|
||||
acCenterHor.Caption := MarkAsChecked(RSCenterHor, acCenterHor.Checked);
|
||||
ShowPage(FPageNumber);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGridPrintPreviewForm.acCenterVertExecute(Sender: TObject);
|
||||
begin
|
||||
if Assigned(FGridPrinter) then
|
||||
begin
|
||||
if acCenterVert.Checked then
|
||||
FGridPrinter.Options := FGridPrinter.Options + [gpoCenterVert]
|
||||
else
|
||||
FGridPrinter.Options := FGridPrinter.Options - [gpoCenterVert];
|
||||
acCenterVert.Caption := MarkAsChecked(RSCenterVert, acCenterVert.Checked);
|
||||
ShowPage(FPageNumber);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGridPrintPreviewForm.acFirstPageExecute(Sender: TObject);
|
||||
begin
|
||||
ShowPage(1);
|
||||
@@ -232,6 +301,8 @@ begin
|
||||
if Assigned(FGridPrinter) then
|
||||
begin
|
||||
acLandscape.Checked := true;
|
||||
acLandscape.Caption := MarkAsChecked(RSLandscape, true);
|
||||
acPortrait.Caption := MarkAsChecked(RSPortrait, false);
|
||||
FGridPrinter.Orientation := poLandscape;
|
||||
ShowPage(FPageNumber);
|
||||
end;
|
||||
@@ -259,6 +330,8 @@ begin
|
||||
if Assigned(FGridPrinter) then
|
||||
begin
|
||||
acPortrait.Checked := true;
|
||||
acPortrait.Caption := MarkAsChecked(RSPortrait, true);
|
||||
acLandscape.Caption := MarkAsChecked(RSLandscape, false);
|
||||
FGridPrinter.Orientation := poPortrait;
|
||||
ShowPage(FPageNumber);
|
||||
end;
|
||||
@@ -275,6 +348,8 @@ begin
|
||||
if Assigned(FGridPrinter) then
|
||||
begin
|
||||
acPrintColsFirst.Checked := true;
|
||||
acPrintColsFirst.Caption := MarkAsChecked(RSPrintColsFirst, true);
|
||||
acPrintRowsFirst.Caption := RSPrintRowsFirst;
|
||||
FGridPrinter.PrintOrder := poColsFirst;
|
||||
ShowPage(FPageNumber);
|
||||
end;
|
||||
@@ -290,6 +365,8 @@ begin
|
||||
if Assigned(FGridPrinter) then
|
||||
begin
|
||||
acPrintRowsFirst.Checked := true;
|
||||
acPrintRowsFirst.Caption := MarkAsChecked(RSPrintRowsFirst, true);
|
||||
acPrintColsFirst.Caption := RSPrintColsFirst;
|
||||
FGridPrinter.PrintOrder := poRowsFirst;
|
||||
ShowPage(FPageNumber);
|
||||
end;
|
||||
@@ -324,8 +401,10 @@ begin
|
||||
acLandscape.Enabled := (FGridPrinter <> nil);
|
||||
acHeaderFooter.Enabled := acPrint.Enabled;
|
||||
acPageMargins.Enabled := acPrint.Enabled;
|
||||
acPrintColsFirst.Enabled := acPrint.Enabled;;
|
||||
acPrintRowsFirst.Enabled := acPrint.Enabled;;
|
||||
acPrintColsFirst.Enabled := acPrint.Enabled;
|
||||
acPrintRowsFirst.Enabled := acPrint.Enabled;
|
||||
acCenterHor.Enabled := acPrint.Enabled;
|
||||
acCenterVert.Enabled := acPrint.Enabled;
|
||||
end;
|
||||
|
||||
procedure TGridPrintPreviewForm.acZoomInZoomOutExecute(Sender: TObject);
|
||||
@@ -771,30 +850,45 @@ begin
|
||||
begin
|
||||
FGridPrinter := AValue;
|
||||
case FGridPrinter.Orientation of
|
||||
poPortrait: acPortrait.Checked := true;
|
||||
poLandscape: acLandscape.Checked := true;
|
||||
poPortrait:
|
||||
acPortrait.Checked := true;
|
||||
poLandscape:
|
||||
acLandscape.Checked := true;
|
||||
end;
|
||||
|
||||
case FGridPrinter.PrintOrder of
|
||||
poRowsFirst: acPrintRowsFirst.Checked := true;
|
||||
poColsFirst: acPrintColsFirst.Checked := true;
|
||||
poRowsFirst:
|
||||
acPrintRowsFirst.Checked := true;
|
||||
poColsFirst:
|
||||
acPrintColsFirst.Checked := true;
|
||||
end;
|
||||
acCenterHor.Checked := gpoCenterHor in FGridPrinter.Options;
|
||||
acCenterVert.Checked := gpoCenterVert in FGridPrinter.Options;
|
||||
|
||||
acPortrait.Caption := MarkAsChecked(RSPortrait, acPortrait.Checked);
|
||||
acLandscape.Caption := MarkAsChecked(RSLandscape, acLandscape.Checked);
|
||||
acPrintRowsFirst.Caption := MarkAsChecked(RSPrintRowsFirst, acPrintRowsFirst.Checked);
|
||||
acPrintColsFirst.Caption := MarkAsChecked(RSPrintColsFirst, acPrintColsFirst.Checked);
|
||||
acCenterHor.Caption := MarkAsChecked(RSCenterHor, acCenterHor.Checked);
|
||||
acCenterVert.Caption := MarkAsChecked(RSCenterVert, acCenterVert.Checked);
|
||||
end;
|
||||
SetOptions(FOptions);
|
||||
end;
|
||||
|
||||
procedure TGridPrintPreviewForm.SetOptions(AValue: TGridPrintPreviewOptions);
|
||||
begin
|
||||
if FOptions <> AValue then
|
||||
//if FOptions <> AValue then
|
||||
begin
|
||||
FOptions := AValue;
|
||||
|
||||
// Page navigation
|
||||
acFirstPage.Visible := ppoNavigationBtns in FOptions;
|
||||
acPrevpage.Visible := acFirstpage.Visible;
|
||||
acNextPage.Visible := acFirstPage.Visible;
|
||||
acLastPage.Visible := acFirstPage.Visible;
|
||||
edPageNumber.Visible := ppoNavigationEdit in FOptions;
|
||||
tbDivider1.Visible := acFirstPage.Visible or edPageNumber.Visible;
|
||||
PageNoEditPanel.Visible := ppoNavigationEdit in FOptions;
|
||||
tbDivider1.Visible := acFirstPage.Visible or PageNoEditPanel.Visible;
|
||||
|
||||
// Zooming
|
||||
acZoomIn.Visible := ppoZoomBtns in FOptions;
|
||||
acZoomOut.Visible := acZoomIn.Visible;
|
||||
acZoom100.Visible := acZoomIn.Visible;
|
||||
@@ -802,15 +896,78 @@ begin
|
||||
acZoomtoFitHeight.Visible := acZoomIn.Visible;
|
||||
tbDivider2.Visible := acZoomIn.Visible;
|
||||
|
||||
acPortrait.Visible := ppoPageOrientationBtns in FOptions;
|
||||
acLandscape.Visible := acPortrait.Visible;
|
||||
acHeaderFooter.Visible := ppoHeaderFooterBtn in FOptions;
|
||||
acPageMargins.Visible := ppoMarginsBtn in FOptions;
|
||||
tbDivider3.Visible := acPortrait.Visible or acHeaderFooter.Visible or acPageMargins.Visible;
|
||||
// Page orientation, header/footer and page margins
|
||||
if ppoPageOrientationBtns in FOptions then
|
||||
begin
|
||||
tbPortrait.Action := acPortrait;
|
||||
tbLandscape.Action := acLandscape;
|
||||
end else
|
||||
begin
|
||||
tbPortrait.Action := nil;
|
||||
tbLandscape.Action := nil;
|
||||
end;
|
||||
tbPortrait.Visible := tbPortrait.Action <> nil;
|
||||
tbLandscape.Visible := tbLandscape.Action <> nil;
|
||||
|
||||
acPrintColsFirst.Visible := ppoPrintOrderBtns in FOptions;
|
||||
acPrintRowsFirst.Visible := acPrintColsFirst.Visible;
|
||||
tbDivider4.Visible := acPrintColsFirst.Visible;
|
||||
if ppoHeaderFooterBtn in FOptions then
|
||||
tbHeaderFooter.Action := acHeaderFooter
|
||||
else
|
||||
tbHeaderFooter.Action := nil;
|
||||
tbHeaderFooter.Visible := tbHeaderFooter.Action <> nil;
|
||||
|
||||
if ppoMarginsBtn in FOptions then
|
||||
tbPageMargins.Action := acPageMargins
|
||||
else
|
||||
tbPageMargins.Action := nil;
|
||||
tbPageMargins.Visible := tbPageMargins.Action <> nil;
|
||||
|
||||
tbDivider3.Visible :=
|
||||
(FOptions * [ppoPageOrientationBtns, ppoHeaderFooterBtn, ppoMarginsBtn] <> []);
|
||||
|
||||
// Print order
|
||||
if ppoPrintOrderBtns in FOptions then
|
||||
begin
|
||||
tbPrintColsFirst.Action := acPrintColsFirst;
|
||||
tbPrintRowsFirst.Action := acPrintRowsFirst;
|
||||
end else
|
||||
begin
|
||||
tbPrintColsFirst.Action := nil;
|
||||
tbPrintRowsFirst.Action := nil;
|
||||
end;
|
||||
tbPrintColsFirst.Visible := tbPrintColsFirst.Action <> nil;
|
||||
tbPrintRowsFirst.Visible := tbPrintRowsFirst.Action <> nil;
|
||||
tbDivider4.Visible := tbPrintColsFirst.Visible;
|
||||
|
||||
// Page centering
|
||||
if ppoCenterBtns in FOptions then
|
||||
begin
|
||||
tbCenterHor.Action := acCenterHor;
|
||||
tbCenterVert.Action := acCenterVert;
|
||||
end else
|
||||
begin
|
||||
tbCenterHor.Action := nil;
|
||||
tbCenterVert.Action := nil;
|
||||
end;
|
||||
tbCenterHor.Visible := tbCenterHor.Action <> nil;
|
||||
tbCenterVert.Visible := tbCenterVert.Action <> nil;
|
||||
tbDivider5.Visible := tbCenterHor.Action <> nil;
|
||||
|
||||
// Page setup dropdown button
|
||||
tbPageSetup.Visible := ppoPageSetupBtn in FOptions;
|
||||
tbDivider6.Visible := tbPageSetup.Visible;
|
||||
|
||||
// Page number info
|
||||
if FOptions * [ppoPageNumberInfo, ppoZoomLevelInfo] = [ppoPageNumberInfo, ppoZoomLevelInfo] then
|
||||
FInfoMask := RSPageAndZoomInfo
|
||||
else
|
||||
if (ppoPageNumberInfo in FOptions) then
|
||||
FInfoMask := RSPageInfo
|
||||
else
|
||||
if (ppoZoomLevelInfo in FOptions) then
|
||||
FInfoMask := RSZoomInfo
|
||||
else
|
||||
FInfoMask := '';
|
||||
InfoPanel.Visible := FInfoMask <> '';
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -877,9 +1034,14 @@ end;
|
||||
|
||||
procedure TGridPrintPreviewForm.UpdateInfoPanel;
|
||||
begin
|
||||
InfoPanel.Caption := Format(RSPageAndZoomInfo, [FPageNumber, FPageCount, FZoom]);
|
||||
InfoPanel.Width := InfoPanel.Canvas.TextWidth(InfoPanel.Caption);
|
||||
InfoPanel.Left := Toolbar.ClientWidth - InfoPanel.Width - 8;
|
||||
if FOptions * [ppoPageNumberInfo, ppoZoomLevelInfo] <> [] then
|
||||
begin
|
||||
InfoPanel.Caption := Format(FInfoMask, [FPageNumber, FPageCount, FZoom]);
|
||||
InfoPanel.Width := InfoPanel.Canvas.TextWidth(InfoPanel.Caption);
|
||||
InfoPanel.Left := Toolbar.ClientWidth - InfoPanel.Width - 8;
|
||||
InfoPanel.Show;
|
||||
end else
|
||||
InfoPanel.Hide;
|
||||
edPageNumber.Text := IntToStr(FPageNumber);
|
||||
end;
|
||||
|
||||
@@ -890,6 +1052,14 @@ begin
|
||||
// Toolbar captions
|
||||
acPrint.Caption := RSPrint;
|
||||
acClose.Caption := RSClose;
|
||||
acPortrait.Caption := RSPortrait;
|
||||
acLandscape.Caption := RSLandscape;
|
||||
acHeaderFooter.Caption := RSHeaderFooter;
|
||||
acPageMargins.Caption := RSPageMargins;
|
||||
acPrintColsFirst.Caption := RSPrintColsFirst;
|
||||
acPrintRowsFirst.Caption := RSPrintRowsFirst;
|
||||
acCenterHor.Caption := RSCenterHor;
|
||||
acCenterVert.Caption := RSCenterVert;
|
||||
|
||||
// Toolbar hints
|
||||
acPrint.Hint := RSPrint;
|
||||
@@ -904,11 +1074,15 @@ begin
|
||||
acZoomToFitHeight.Hint := RSZoomToFitPageHeight;
|
||||
acZoom100.Hint := RSOriginalSize;
|
||||
acPageMargins.Hint := RSPageMarginsConfig;
|
||||
acHeaderFooter.Hint := RSHeaderFooterConfig;
|
||||
acPortrait.Hint := RSPortraitPageOrientation;
|
||||
acLandscape.Hint := RSLandscapePageOrientation;
|
||||
acPrintColsFirst.Hint := RSPrintColsFirst;
|
||||
acPrintRowsFirst.Hint := RSPrintRowsFirst;
|
||||
acPortrait.Hint := RSPortraitHint;
|
||||
acLandscape.Hint := RSLandscapeHint;
|
||||
acHeaderFooter.Hint := RSHeaderFooterHint;
|
||||
acPageMargins.Hint := RSPageMarginsHint;
|
||||
acPrintColsFirst.Hint := RSPrintColsFirstHint;
|
||||
acPrintRowsFirst.Hint := RSPrintRowsFirstHint;
|
||||
acCenterHor.Hint := RSCenterHorHint;
|
||||
acCenterVert.Hint := RSCenterVertHint;
|
||||
tbPageSetup.Hint := RSPageSetupHint;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@@ -23,13 +23,27 @@ resourcestring
|
||||
RSZoomToFitPageHeight = 'Zoom to fit page height';
|
||||
RSOriginalSize = 'Original size (100%)';
|
||||
RSPageMarginsConfig = 'Page margins configuration';
|
||||
RSHeaderFooterConfig = 'Header/footer configuration';
|
||||
RSPortraitPageOrientation = 'Portrait page orientation';
|
||||
RSLandscapePageOrientation = 'Landscape page orientation';
|
||||
RSPrintColsFirst = 'First print columns from top to bottom,' + LineEnding +
|
||||
RSPortrait = 'Portrait';
|
||||
RSPortraitHint = 'Portrait page orientation';
|
||||
RSLandscape = 'Landscape';
|
||||
RSLandscapeHint = 'Landscape page orientation';
|
||||
RSHeaderFooter = 'Header/footer...';
|
||||
RSHeaderFooterHint = 'Header/footer configuration';
|
||||
RSPageMargins = 'Margins';
|
||||
RSPageMarginsHint = 'Page margins';
|
||||
RSPrintColsFirst = 'Columns first';
|
||||
RSPrintColsFirstHint = 'First print columns from top to bottom,' + LineEnding +
|
||||
'then print from left to right';
|
||||
RSPrintRowsFirst = 'First print rows from left to right,' + LineEnding +
|
||||
RSPrintRowsFirst = 'Rows first';
|
||||
RSPrintRowsFirstHint = 'First print rows from left to right,' + LineEnding +
|
||||
'then print from top to bottom';
|
||||
RSCenterHor = 'Center horizontally';
|
||||
RSCenterHorHint = 'Center grid in page horizontally';
|
||||
RSCenterVert = 'Center vertically';
|
||||
RSCenterVertHint = 'Center grid in page vertically';
|
||||
RSPageSetupHint = 'Page setup options';
|
||||
RSPageInfoPanel = 'Page numbers';
|
||||
RSZoomInfoPanel = 'Zoom level';
|
||||
|
||||
RSLeftMargin = 'Left margin';
|
||||
RSTopMargin = 'Top margin';
|
||||
@@ -38,7 +52,9 @@ resourcestring
|
||||
RSHeaderMargin = 'Header margin';
|
||||
RSFooterMargin = 'Footer margin';
|
||||
|
||||
RSPageAndZoomInfo = 'Page %d of %d, Zoom %d %%';
|
||||
RSPageInfo = 'Page %0:d of %1:d';
|
||||
RSZoomInfo = 'Zoom %2:d %%';
|
||||
RSPageAndZoomInfo = 'Page %0:d of %1:d, Zoom %2:d %%';
|
||||
|
||||
// Header / footer
|
||||
RSHeader = 'Header';
|
||||
|
||||
Reference in New Issue
Block a user