From: <the...@us...> - 2006-11-29 17:19:52
|
Revision: 730 http://svn.sourceforge.net/instantobjects/revision/?rev=730&view=rev Author: the_kique Date: 2006-11-29 09:19:47 -0800 (Wed, 29 Nov 2006) Log Message: ----------- Added icon support to AssignToPicture [1603283], compatibility to Assign method in TPicture class [1603285] Modified Paths: -------------- trunk/Source/Core/InstantPersistence.pas trunk/Source/Core/InstantTypes.pas Modified: trunk/Source/Core/InstantPersistence.pas =================================================================== --- trunk/Source/Core/InstantPersistence.pas 2006-11-29 10:53:06 UTC (rev 729) +++ trunk/Source/Core/InstantPersistence.pas 2006-11-29 17:19:47 UTC (rev 730) @@ -422,6 +422,7 @@ procedure SetAsVariant(AValue: Variant); override; function Write(const Buffer; Position, Count: Integer): Integer; virtual; procedure WriteObject(Writer: TInstantWriter); override; + procedure AssignTo(Dest: TPersistent); override; public destructor Destroy; override; procedure Assign(Source: TPersistent); override; @@ -1956,6 +1957,9 @@ // gif format else if (P[0] = #$47) and (P[1] = #$49) and (P[2] = #$46) then Result := gffGif + // Ico format + else if (P[0] = #00) and (P[1] = #00) and (P[2] = #01) and (P[3] = #00) then + Result := gffIco // bitmap format with TGraphicHeader header else if (P[0] = #01) and (P[1] = #00) and (P[2] = #00) and (P[3] = #01) and (PLongint(@p[4])^ = StreamLength - SizeOfGraphicHeader) then @@ -3543,6 +3547,14 @@ Dest.Graphic := nil; end; +procedure TInstantBlob.AssignTo(Dest: TPersistent); +begin + if Dest is TPicture then + AssignToPicture(TPicture(Dest)) + else + inherited; +end; + { TInstantMemo } class function TInstantMemo.AttributeType: TInstantAttributeType; @@ -8815,12 +8827,14 @@ TInstantObjectReference, TInstantConnectionDefs, TInstantConnectionDef]); ClassList := TList.Create; {$IFDEF MSWINDOWS} + GraphicClassList[gffIco] := Graphics.TIcon; GraphicClassList[gffBmp] := Graphics.TBitmap; {$IFNDEF FPC} GraphicClassList[gffEmf] := Graphics.TMetaFile; {$ENDIF} {$ENDIF} {$IFDEF LINUX} + GraphicClassList[gffIco] := QGraphics.TIcon; GraphicClassList[gffBmp] := QGraphics.TBitmap; GraphicClassList[gffPng] := QGraphics.TBitmap; GraphicClassList[gffJpeg]:= QGraphics.TBitmap; Modified: trunk/Source/Core/InstantTypes.pas =================================================================== --- trunk/Source/Core/InstantTypes.pas 2006-11-29 10:53:06 UTC (rev 729) +++ trunk/Source/Core/InstantTypes.pas 2006-11-29 17:19:47 UTC (rev 730) @@ -48,7 +48,7 @@ TInstantAttributeCategory = (acUnknown, acSimple, acElement, acContainer); TInstantGraphicFileFormat = (gffUnknown, gffBmp, gffTiff, gffJpeg, gffPng, - gffDcx, gffPcx, gffEmf, gffGif); + gffDcx, gffPcx, gffEmf, gffGif, gffIco); TInstantPersistence = (peEmbedded, peStored); |