mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-27 21:29:54 +02:00
LazReport: Fix paint ButtonControl, fix reorder designer pages, fix export to PDF. Issue #31941, patch from Lagunov Aleksey.
git-svn-id: trunk@56674 -
This commit is contained in:
parent
0f1a653071
commit
a11668995f
@ -736,11 +736,12 @@ end;
|
|||||||
|
|
||||||
procedure TlrButtonPanel.PaintDesignControl;
|
procedure TlrButtonPanel.PaintDesignControl;
|
||||||
var
|
var
|
||||||
AY, AX, aH, aW:integer;
|
AY, AX, aH, aW, W1:integer;
|
||||||
R1:TRect;
|
R1:TRect;
|
||||||
i:TPanelButton;
|
i:TPanelButton;
|
||||||
|
|
||||||
B:TPanelBitBtn;
|
B:TPanelBitBtn;
|
||||||
|
TR: TTextStyle;
|
||||||
begin
|
begin
|
||||||
AY:=(DRect.Top + DRect.Bottom) div 2;
|
AY:=(DRect.Top + DRect.Bottom) div 2;
|
||||||
aH:=Canvas.TextHeight(Text) div 2;
|
aH:=Canvas.TextHeight(Text) div 2;
|
||||||
@ -768,7 +769,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
if Assigned(B) then
|
if Assigned(B) then
|
||||||
begin
|
begin
|
||||||
R1.Left:=R1.Right - B.Width;
|
if B.Width <= 0 then
|
||||||
|
W1:=75
|
||||||
|
else
|
||||||
|
W1:=B.Width;
|
||||||
|
|
||||||
|
R1.Left:=R1.Right - W1;
|
||||||
|
|
||||||
DrawFrameControl(Canvas.Handle, R1, DFC_BUTTON, DFCS_BUTTONPUSH);
|
DrawFrameControl(Canvas.Handle, R1, DFC_BUTTON, DFCS_BUTTONPUSH);
|
||||||
|
|
||||||
AX:=(R1.Left + R1.Right) div 2;
|
AX:=(R1.Left + R1.Right) div 2;
|
||||||
@ -776,10 +783,13 @@ begin
|
|||||||
aW:=Canvas.TextWidth(B.Caption);
|
aW:=Canvas.TextWidth(B.Caption);
|
||||||
aH:=Canvas.TextHeight(B.Caption) div 2;
|
aH:=Canvas.TextHeight(B.Caption) div 2;
|
||||||
|
|
||||||
if aW>B.Width then
|
FillChar(TR,SizeOf(TR),0);
|
||||||
Canvas.TextRect(R1, 0, AY - aH, B.Caption)
|
TR.ShowPrefix := true;
|
||||||
|
|
||||||
|
if aW>W1 then
|
||||||
|
Canvas.TextRect(R1, 0, AY - aH, B.Caption, TR)
|
||||||
else
|
else
|
||||||
Canvas.TextRect(R1, AX - (aW div 2), AY - aH, B.Caption)
|
Canvas.TextRect(R1, AX - (aW div 2), AY - aH, B.Caption, TR)
|
||||||
|
|
||||||
end;
|
end;
|
||||||
R1.Right:=R1.Left - 6;
|
R1.Right:=R1.Left - 6;
|
||||||
|
@ -210,10 +210,28 @@ begin
|
|||||||
FList.Clear;
|
FList.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function MakePSName(AFontName: string; AFontStyle: TFontStyles):string;
|
||||||
|
begin
|
||||||
|
Result:=AFontName;
|
||||||
|
|
||||||
|
if Graphics.fsBold in AFontStyle then
|
||||||
|
Result:=Result + '-Bold';
|
||||||
|
|
||||||
|
if Graphics.fsItalic in AFontStyle then
|
||||||
|
Result:=Result + '-Oblique';
|
||||||
|
|
||||||
|
if Graphics.fsUnderline in AFontStyle then
|
||||||
|
Result:=Result + '-Underline';
|
||||||
|
|
||||||
|
if Graphics.fsStrikeOut in AFontStyle then
|
||||||
|
Result:=Result + '-StrikeOut';
|
||||||
|
end;
|
||||||
|
|
||||||
function TExportFonts.AddItem(AFontName: string; AFontStyle: TFontStyles
|
function TExportFonts.AddItem(AFontName: string; AFontStyle: TFontStyles
|
||||||
): TExportFontItem;
|
): TExportFontItem;
|
||||||
var
|
var
|
||||||
S1, S2, S3: String;
|
S1, S2, S3, S: String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=FindItem(AFontName, AFontStyle);
|
Result:=FindItem(AFontName, AFontStyle);
|
||||||
if Assigned(Result) then exit;
|
if Assigned(Result) then exit;
|
||||||
@ -225,7 +243,8 @@ begin
|
|||||||
S2:=ExtractFileName(Result.FTTFFontInfo.FileName);
|
S2:=ExtractFileName(Result.FTTFFontInfo.FileName);
|
||||||
S3:=AFontName;
|
S3:=AFontName;
|
||||||
FOwner.FPDFDocument.FontDirectory:=S1;
|
FOwner.FPDFDocument.FontDirectory:=S1;
|
||||||
Result.FPdfFont:=FOwner.FPDFDocument.AddFont(S2, S3);
|
S:=MakePSName(AFontName, AFontStyle);
|
||||||
|
Result.FPdfFont:=FOwner.FPDFDocument.AddFont(S2, S);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Result:=FDefaultFontNormal;
|
Result:=FDefaultFontNormal;
|
||||||
@ -375,7 +394,11 @@ begin
|
|||||||
{$IF (FPC_FULLVERSION >= 30101)}
|
{$IF (FPC_FULLVERSION >= 30101)}
|
||||||
gTTFontCache.BuildFontCacheIgnoresErrors:=true;
|
gTTFontCache.BuildFontCacheIgnoresErrors:=true;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
{$IFDEF WINDOWS}
|
||||||
CreateFontDirList;
|
CreateFontDirList;
|
||||||
|
{$ELSE}
|
||||||
|
gTTFontCache.ReadStandardFonts;
|
||||||
|
{$ENDIF}
|
||||||
gTTFontCache.BuildFontCache;
|
gTTFontCache.BuildFontCache;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -870,12 +893,11 @@ begin
|
|||||||
FPDFDocument.Infos.ApplicationName := ApplicationName;
|
FPDFDocument.Infos.ApplicationName := ApplicationName;
|
||||||
FPDFDocument.Infos.CreationDate := Now;
|
FPDFDocument.Infos.CreationDate := Now;
|
||||||
|
|
||||||
// FPDFDocument.Options:=FPdfOptions.FOptions;
|
FPDFDocument.Options:=FPDFDocument.Options + [poPageOriginAtTop, poUseRawJPEG];
|
||||||
FPDFDocument.Options:=FPDFDocument.Options + [poPageOriginAtTop];
|
FPDFDocument.DefaultOrientation := ppoPortrait;
|
||||||
FPDFDocument.DefaultOrientation := ppoPortrait; // FPdfOptions.PaperOrientation;
|
|
||||||
|
|
||||||
FPDFDocument.StartDocument;
|
FPDFDocument.StartDocument;
|
||||||
FCurSection := FPDFDocument.Sections.AddSection; // we always need at least one section
|
FCurSection := FPDFDocument.Sections.AddSection;
|
||||||
|
|
||||||
SetupFonts;
|
SetupFonts;
|
||||||
end;
|
end;
|
||||||
|
@ -91,11 +91,14 @@ type
|
|||||||
TfrFrameBorders = set of TfrFrameBorder;
|
TfrFrameBorders = set of TfrFrameBorder;
|
||||||
TfrFrameStyle = (frsSolid,frsDash, frsDot, frsDashDot, frsDashDotDot,frsDouble);
|
TfrFrameStyle = (frsSolid,frsDash, frsDot, frsDashDot, frsDashDotDot,frsDouble);
|
||||||
TfrPageType = (ptReport, ptDialog); //todo: - remove this
|
TfrPageType = (ptReport, ptDialog); //todo: - remove this
|
||||||
|
|
||||||
TfrReportOption = (roIgnoreFieldNotFound, roIgnoreSymbolNotFound, roHideDefaultFilter,
|
TfrReportOption = (roIgnoreFieldNotFound, roIgnoreSymbolNotFound, roHideDefaultFilter,
|
||||||
roDontUpgradePreparedReport, // on saving an old prepared report don't update to current version
|
roDontUpgradePreparedReport, // on saving an old prepared report don't update to current version
|
||||||
roSaveAndRestoreBookmarks, // try to save and later restore dataset bookmarks on building report
|
roSaveAndRestoreBookmarks, // try to save and later restore dataset bookmarks on building report
|
||||||
roPageHeaderBeforeReportTitle // PageHeader band is printed before ReportTitle band
|
roPageHeaderBeforeReportTitle, // PageHeader band is printed before ReportTitle band
|
||||||
|
roDisableCancelBuild // Disable cancel button in build progress form
|
||||||
);
|
);
|
||||||
|
|
||||||
TfrReportOptions = set of TfrReportOption;
|
TfrReportOptions = set of TfrReportOption;
|
||||||
TfrObjectType = (otlReportView, otlUIControl);
|
TfrObjectType = (otlReportView, otlUIControl);
|
||||||
|
|
||||||
@ -1205,6 +1208,7 @@ type
|
|||||||
procedure DoPrintReport(const PageNumbers: String; Copies: Integer);
|
procedure DoPrintReport(const PageNumbers: String; Copies: Integer);
|
||||||
procedure SetComments(const AValue: TStringList);
|
procedure SetComments(const AValue: TStringList);
|
||||||
procedure SetPrinterTo(const PrnName: String);
|
procedure SetPrinterTo(const PrnName: String);
|
||||||
|
procedure SetReportOptions(AValue: TfrReportOptions);
|
||||||
procedure SetScript(AValue: TfrScriptStrings);
|
procedure SetScript(AValue: TfrScriptStrings);
|
||||||
procedure SetVars(Value: TStrings);
|
procedure SetVars(Value: TStrings);
|
||||||
procedure ClearAttribs;
|
procedure ClearAttribs;
|
||||||
@ -1321,7 +1325,7 @@ type
|
|||||||
property InitialZoom: TfrPreviewZoom read FInitialZoom write FInitialZoom;
|
property InitialZoom: TfrPreviewZoom read FInitialZoom write FInitialZoom;
|
||||||
property ModalPreview: Boolean read FModalPreview write FModalPreview default True;
|
property ModalPreview: Boolean read FModalPreview write FModalPreview default True;
|
||||||
property ModifyPrepared: Boolean read FModifyPrepared write FModifyPrepared default True;
|
property ModifyPrepared: Boolean read FModifyPrepared write FModifyPrepared default True;
|
||||||
property Options: TfrReportOptions read FReportOptions write FReportOptions;
|
property Options: TfrReportOptions read FReportOptions write SetReportOptions;
|
||||||
property Preview: TfrPreview read FPreview write FPreview;
|
property Preview: TfrPreview read FPreview write FPreview;
|
||||||
property PreviewButtons: TfrPreviewButtons read FPreviewButtons write FPreviewButtons;
|
property PreviewButtons: TfrPreviewButtons read FPreviewButtons write FPreviewButtons;
|
||||||
property RebuildPrinter: boolean read FRebuildPrinter write FRebuildPrinter default False;
|
property RebuildPrinter: boolean read FRebuildPrinter write FRebuildPrinter default False;
|
||||||
@ -11624,6 +11628,15 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrReport.SetReportOptions(AValue: TfrReportOptions);
|
||||||
|
begin
|
||||||
|
if FReportOptions=AValue then Exit;
|
||||||
|
FReportOptions:=AValue;
|
||||||
|
|
||||||
|
if Assigned(frProgressForm) then
|
||||||
|
frProgressForm.Button1.Enabled:=not (roDisableCancelBuild in FReportOptions);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrReport.SetScript(AValue: TfrScriptStrings);
|
procedure TfrReport.SetScript(AValue: TfrScriptStrings);
|
||||||
begin
|
begin
|
||||||
fScript.Assign(AValue);
|
fScript.Assign(AValue);
|
||||||
|
@ -43,7 +43,7 @@ type
|
|||||||
SaveAs: Boolean; var Saved: Boolean) of object;
|
SaveAs: Boolean; var Saved: Boolean) of object;
|
||||||
|
|
||||||
TfrDesignerForm = class;
|
TfrDesignerForm = class;
|
||||||
TlrTabEditControl = class(TCustomTabControl);
|
//TlrTabEditControl = class(TCustomTabControl);
|
||||||
|
|
||||||
{ TfrDesigner }
|
{ TfrDesigner }
|
||||||
|
|
||||||
@ -634,7 +634,7 @@ type
|
|||||||
procedure InplaceEditorMenuClick(Sender: TObject);
|
procedure InplaceEditorMenuClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
FTabMouseDown:boolean;
|
FTabMouseDown:boolean;
|
||||||
FTabsPage:TlrTabEditControl;
|
//FTabsPage:TlrTabEditControl;
|
||||||
procedure TabsEditDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
|
procedure TabsEditDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
|
||||||
procedure TabsEditDragDrop(Sender, Source: TObject; X, Y: Integer);
|
procedure TabsEditDragDrop(Sender, Source: TObject; X, Y: Integer);
|
||||||
procedure TabsEditMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
procedure TabsEditMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
@ -2934,13 +2934,21 @@ begin
|
|||||||
Panel7.Visible := false;
|
Panel7.Visible := false;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
FTabsPage:=TlrTabEditControl((Tab1.Tabs as TTabControlNoteBookStrings).NoteBook);
|
{ FTabsPage:=TlrTabEditControl((Tab1.Tabs as TTabControlNoteBookStrings).NoteBook);
|
||||||
FTabsPage.DragMode:=dmManual;
|
FTabsPage.DragMode:=dmManual;
|
||||||
FTabsPage.OnDragOver:=@TabsEditDragOver;
|
FTabsPage.OnDragOver:=@TabsEditDragOver;
|
||||||
FTabsPage.OnDragDrop:=@TabsEditDragDrop;
|
FTabsPage.OnDragDrop:=@TabsEditDragDrop;
|
||||||
FTabsPage.OnMouseDown:=@TabsEditMouseDown;
|
FTabsPage.OnMouseDown:=@TabsEditMouseDown;
|
||||||
FTabsPage.OnMouseMove:=@TabsEditMouseMove;
|
FTabsPage.OnMouseMove:=@TabsEditMouseMove;
|
||||||
FTabsPage.OnMouseUp:=@TabsEditMouseUp;
|
FTabsPage.OnMouseUp:=@TabsEditMouseUp;}
|
||||||
|
|
||||||
|
Tab1.DragMode:=dmManual;
|
||||||
|
Tab1.OnDragOver:=@TabsEditDragOver;
|
||||||
|
Tab1.OnDragDrop:=@TabsEditDragDrop;
|
||||||
|
Tab1.OnMouseDown:=@TabsEditMouseDown;
|
||||||
|
Tab1.OnMouseMove:=@TabsEditMouseMove;
|
||||||
|
Tab1.OnMouseUp:=@TabsEditMouseUp;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TfrDesignerForm.Destroy;
|
destructor TfrDesignerForm.Destroy;
|
||||||
@ -4566,7 +4574,8 @@ end;
|
|||||||
procedure TfrDesignerForm.TabsEditDragOver(Sender, Source: TObject; X,
|
procedure TfrDesignerForm.TabsEditDragOver(Sender, Source: TObject; X,
|
||||||
Y: Integer; State: TDragState; var Accept: Boolean);
|
Y: Integer; State: TDragState; var Accept: Boolean);
|
||||||
begin
|
begin
|
||||||
Accept:=(Source = FTabsPage) and (FTabsPage.IndexOfPageAt(X, Y) <> Tab1.TabIndex);
|
//Accept:=(Source = FTabsPage) and (FTabsPage.IndexOfPageAt(X, Y) <> Tab1.TabIndex);
|
||||||
|
Accept:=(Source = Tab1) and (Tab1.IndexOfTabAt(X, Y) <> Tab1.TabIndex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrDesignerForm.TabsEditDragDrop(Sender, Source: TObject; X,
|
procedure TfrDesignerForm.TabsEditDragDrop(Sender, Source: TObject; X,
|
||||||
@ -4574,7 +4583,8 @@ procedure TfrDesignerForm.TabsEditDragDrop(Sender, Source: TObject; X,
|
|||||||
var
|
var
|
||||||
NewIndex: Integer;
|
NewIndex: Integer;
|
||||||
begin
|
begin
|
||||||
NewIndex:=FTabsPage.IndexOfPageAt(X, Y);
|
//NewIndex:=FTabsPage.IndexOfPageAt(X, Y);
|
||||||
|
NewIndex:=Tab1.IndexOfTabAt(X, Y);
|
||||||
//ShowMessageFmt('New index = %d', [NewIndex]);
|
//ShowMessageFmt('New index = %d', [NewIndex]);
|
||||||
if (NewIndex>-1) and (NewIndex < CurReport.Pages.Count) then
|
if (NewIndex>-1) and (NewIndex < CurReport.Pages.Count) then
|
||||||
begin
|
begin
|
||||||
@ -4600,7 +4610,8 @@ procedure TfrDesignerForm.TabsEditMouseMove(Sender: TObject;
|
|||||||
Shift: TShiftState; X, Y: Integer);
|
Shift: TShiftState; X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
if FTabMouseDown then
|
if FTabMouseDown then
|
||||||
FTabsPage.BeginDrag(false);
|
//FTabsPage.BeginDrag(false);
|
||||||
|
Tab1.BeginDrag(false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrDesignerForm.TabsEditMouseUp(Sender: TObject;
|
procedure TfrDesignerForm.TabsEditMouseUp(Sender: TObject;
|
||||||
|
Loading…
Reference in New Issue
Block a user