mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 17:49:14 +02:00
LCL: Improvements for DBImage. Issue #22416, patch from Tony Whyman
git-svn-id: trunk@40924 -
This commit is contained in:
parent
5628ed72f2
commit
8d88bf826d
@ -969,10 +969,15 @@ Type
|
|||||||
|
|
||||||
{ TDBImage }
|
{ TDBImage }
|
||||||
|
|
||||||
|
TOnDBImageRead = procedure(Sender: TObject; S: TStream; var GraphExt : string) of object;
|
||||||
|
TOnDBImageWrite = procedure(Sender: TObject; S: TStream; GraphExt : string) of object;
|
||||||
|
|
||||||
TDBImage = class(TCustomImage)
|
TDBImage = class(TCustomImage)
|
||||||
private
|
private
|
||||||
FDataLink: TFieldDataLink;
|
FDataLink: TFieldDataLink;
|
||||||
FAutoDisplay: Boolean;
|
FAutoDisplay: Boolean;
|
||||||
|
FOnDBImageRead: TOnDBImageRead;
|
||||||
|
FOnDBImageWrite: TOnDBImageWrite;
|
||||||
FQuickDraw: Boolean;
|
FQuickDraw: Boolean;
|
||||||
FPictureLoaded: boolean;
|
FPictureLoaded: boolean;
|
||||||
FUpdatingRecord: boolean;
|
FUpdatingRecord: boolean;
|
||||||
@ -1011,6 +1016,9 @@ Type
|
|||||||
property DragMode;
|
property DragMode;
|
||||||
property OnClick;
|
property OnClick;
|
||||||
property OnDblClick;
|
property OnDblClick;
|
||||||
|
property OnDBImageRead: TOnDBImageRead read FOnDBImageRead write FOnDBImageRead;
|
||||||
|
property OnDBImageWrite: TOnDBImageWrite read FOnDBImageWrite write FOnDBImageWrite;
|
||||||
|
property PopupMenu;
|
||||||
property OnDragDrop;
|
property OnDragDrop;
|
||||||
property OnDragOver;
|
property OnDragOver;
|
||||||
property OnEndDrag;
|
property OnEndDrag;
|
||||||
|
@ -107,7 +107,10 @@ begin
|
|||||||
try
|
try
|
||||||
i := pos(';',fe);
|
i := pos(';',fe);
|
||||||
if i > 0 then fe := copy(fe,1,i-1);
|
if i > 0 then fe := copy(fe,1,i-1);
|
||||||
s.WriteAnsiString(fe);
|
if assigned(FOnDBImageWrite) then
|
||||||
|
OnDBImageWrite(self,s,fe) //Call extermal method to save type of image
|
||||||
|
else
|
||||||
|
s.WriteAnsiString(fe); //otherwise write file extension to stream
|
||||||
Picture.Graphic.SaveToStream(s);
|
Picture.Graphic.SaveToStream(s);
|
||||||
finally
|
finally
|
||||||
s.Free;
|
s.Free;
|
||||||
@ -152,7 +155,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
AGraphic := nil;
|
AGraphic := nil;
|
||||||
try
|
try
|
||||||
GraphExt := s.ReadAnsiString;
|
if assigned(FOnDBImageRead) then
|
||||||
|
OnDBImageRead(self,s,GraphExt) //External method to identify graphic type
|
||||||
|
//returns file extension for graphic type (e.g. jpg)
|
||||||
|
else
|
||||||
|
GraphExt := s.ReadAnsiString; //Read file extension Graphic type from stream
|
||||||
|
|
||||||
gc := GetGraphicClassForFileExtension(GraphExt);
|
gc := GetGraphicClassForFileExtension(GraphExt);
|
||||||
if assigned(gc) then
|
if assigned(gc) then
|
||||||
|
Loading…
Reference in New Issue
Block a user