mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 18:29:09 +02:00
* Rework registering system and ReadElement so Barcode/QR classes are read correctly from stream
git-svn-id: trunk@38969 -
This commit is contained in:
parent
0b296ac828
commit
dcea95d536
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,7 @@ Type
|
|||||||
Public
|
Public
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
Constructor Create(AOwner: TComponent); override;
|
Constructor Create(AOwner: TComponent); override;
|
||||||
|
Class Function ElementType : String; override;
|
||||||
// Will calculate the value to display. Either Value or evaluated expression.
|
// Will calculate the value to display. Either Value or evaluated expression.
|
||||||
Function BarcodeValue : String;
|
Function BarcodeValue : String;
|
||||||
Procedure ReadElement(AReader: TFPReportStreamer); override;
|
Procedure ReadElement(AReader: TFPReportStreamer); override;
|
||||||
@ -111,6 +112,11 @@ begin
|
|||||||
FWeight:=2.0;
|
FWeight:=2.0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TFPReportBarcode.ElementType: String;
|
||||||
|
begin
|
||||||
|
Result:='BarCode';
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFPReportBarcode.BeforePrint;
|
procedure TFPReportBarcode.BeforePrint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -221,7 +227,7 @@ Const
|
|||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
gElementFactory.RegisterClass('Barcode',TFPReportBarcode).SetIconFromBytes(Icon);
|
TFPReportBarcode.RegisterElement.SetIconFromBytes(Icon);
|
||||||
// Fallback renderer
|
// Fallback renderer
|
||||||
gElementFactory.RegisterImageRenderer(TFPReportBarcode,@RenderBarcode);
|
gElementFactory.RegisterImageRenderer(TFPReportBarcode,@RenderBarcode);
|
||||||
end;
|
end;
|
||||||
@ -229,7 +235,7 @@ end;
|
|||||||
Procedure UnRegisterReportBarcode;
|
Procedure UnRegisterReportBarcode;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
gElementFactory.RemoveClass('Barcode');
|
TFPReportBarcode.UnRegisterElement;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
@ -40,6 +40,7 @@ Type
|
|||||||
procedure RecalcLayout; override;
|
procedure RecalcLayout; override;
|
||||||
Procedure DoWriteLocalProperties(AWriter: TFPReportStreamer; AOriginal: TFPReportElement=nil); override;
|
Procedure DoWriteLocalProperties(AWriter: TFPReportStreamer; AOriginal: TFPReportElement=nil); override;
|
||||||
Public
|
Public
|
||||||
|
Class Function ElementType : String; override;
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
// Will calculate the value to display. Either Value or evaluated expression.
|
// Will calculate the value to display. Either Value or evaluated expression.
|
||||||
Function QRCodeValue : String;
|
Function QRCodeValue : String;
|
||||||
@ -85,6 +86,11 @@ begin
|
|||||||
AWriter.WriteBoolean('Center',Center);
|
AWriter.WriteBoolean('Center',Center);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TFPReportQRCode.ElementType: String;
|
||||||
|
begin
|
||||||
|
Result:='QRCode';
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFPReportQRCode.Assign(Source: TPersistent);
|
procedure TFPReportQRCode.Assign(Source: TPersistent);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
@ -209,7 +215,7 @@ Const
|
|||||||
68,174, 66, 96,130);
|
68,174, 66, 96,130);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
gElementFactory.RegisterClass('QRCode',TFPReportQRCode).SetIconFromBytes(Icon);
|
TFPReportQRCode.RegisterElement.SetIconFromBytes(Icon);
|
||||||
// Fallback renderer
|
// Fallback renderer
|
||||||
gElementFactory.RegisterImageRenderer(TFPReportQRCode,@RenderQRCode);
|
gElementFactory.RegisterImageRenderer(TFPReportQRCode,@RenderQRCode);
|
||||||
end;
|
end;
|
||||||
@ -217,7 +223,7 @@ end;
|
|||||||
Procedure UnRegisterReportQRCode;
|
Procedure UnRegisterReportQRCode;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
gElementFactory.RemoveClass('QRCode');
|
TFPReportElement.UnRegisterElement;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
Loading…
Reference in New Issue
Block a user