mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-06 09:50:18 +02:00
# revisions: 46268,46325,46349,46716,46722
git-svn-id: branches/fixes_3_2@46814 -
This commit is contained in:
parent
ccb4cb1a96
commit
ea682ec52f
@ -99,7 +99,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
InOutFunc:=@StreamWrite;
|
InOutFunc:=@StreamWrite;
|
||||||
FlushFunc:=@StreamWrite;
|
FlushFunc:=@StreamWrite;
|
||||||
if mode=fmAppend then
|
if Mode=fmAppend then
|
||||||
|
begin
|
||||||
|
Mode:=fmOutput; // see comments in text.inc
|
||||||
Try
|
Try
|
||||||
GetStream(F).Seek(0,soFromEnd);
|
GetStream(F).Seek(0,soFromEnd);
|
||||||
except
|
except
|
||||||
@ -109,6 +111,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ ---------------------------------------------------------------------
|
{ ---------------------------------------------------------------------
|
||||||
|
@ -247,6 +247,8 @@ const
|
|||||||
bmOncePerDataloop,bmOncePerPage,bmOncePerPage,bmOncePerPage,
|
bmOncePerDataloop,bmOncePerPage,bmOncePerPage,bmOncePerPage,
|
||||||
bmUnrestricted);
|
bmUnrestricted);
|
||||||
|
|
||||||
|
DefaultImageType = 'png';
|
||||||
|
|
||||||
const
|
const
|
||||||
cMMperInch = 25.4;
|
cMMperInch = 25.4;
|
||||||
cCMperInch = 2.54;
|
cCMperInch = 2.54;
|
||||||
@ -2090,10 +2092,12 @@ type
|
|||||||
FImage: TFPCustomImage;
|
FImage: TFPCustomImage;
|
||||||
FStretched: boolean;
|
FStretched: boolean;
|
||||||
FFieldName: TFPReportString;
|
FFieldName: TFPReportString;
|
||||||
|
FDBImageType : TFPReportString;
|
||||||
FImageID: integer;
|
FImageID: integer;
|
||||||
procedure SetImage(AValue: TFPCustomImage);
|
procedure SetImage(AValue: TFPCustomImage);
|
||||||
procedure SetStretched(AValue: boolean);
|
procedure SetStretched(AValue: boolean);
|
||||||
procedure SetFieldName(AValue: TFPReportString);
|
procedure SetFieldName(AValue: TFPReportString);
|
||||||
|
procedure SetDBImageType(AValue: TFPReportString);
|
||||||
procedure LoadDBData(AData: TFPReportData);
|
procedure LoadDBData(AData: TFPReportData);
|
||||||
procedure SetImageID(AValue: integer);
|
procedure SetImageID(AValue: integer);
|
||||||
function GetImage: TFPCustomImage;
|
function GetImage: TFPCustomImage;
|
||||||
@ -2105,6 +2109,7 @@ type
|
|||||||
property ImageID: integer read FImageID write SetImageID;
|
property ImageID: integer read FImageID write SetImageID;
|
||||||
property Stretched: boolean read FStretched write SetStretched;
|
property Stretched: boolean read FStretched write SetStretched;
|
||||||
property FieldName: TFPReportString read FFieldName write SetFieldName;
|
property FieldName: TFPReportString read FFieldName write SetFieldName;
|
||||||
|
property DBImageType : TFPReportString read FDBImageType write SetDBImageType;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -2126,6 +2131,7 @@ type
|
|||||||
property ImageID;
|
property ImageID;
|
||||||
property Stretched;
|
property Stretched;
|
||||||
property FieldName;
|
property FieldName;
|
||||||
|
property DBImageType;
|
||||||
property OnBeforePrint;
|
property OnBeforePrint;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -5331,16 +5337,55 @@ begin
|
|||||||
Changed;
|
Changed;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFPReportCustomImage.SetDBImageType(AValue: TFPReportString);
|
||||||
|
begin
|
||||||
|
if FDBImageType = AValue then
|
||||||
|
exit;
|
||||||
|
FDBImageType := AValue;
|
||||||
|
Changed;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TryVarByteArrayToStream(var AValue : Variant; Stream : TMemoryStream) : boolean;
|
||||||
|
var
|
||||||
|
p : Pointer;
|
||||||
|
c : Integer;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
if not VarIsArray(AValue) then
|
||||||
|
exit;
|
||||||
|
c := VarArrayHighBound(AValue,1) - VarArrayLowBound(AValue,1) + 1;
|
||||||
|
Result := (c > 0) and VarIsType(AValue[VarArrayLowBound(AValue,1)],varByte);
|
||||||
|
if not Result then
|
||||||
|
exit;
|
||||||
|
p := VarArrayLock(AValue);
|
||||||
|
try
|
||||||
|
Stream.SetSize(c);
|
||||||
|
Move(p^,Stream.Memory^,c);
|
||||||
|
finally
|
||||||
|
VarArrayUnlock(AValue);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFPReportCustomImage.LoadDBData(AData: TFPReportData);
|
procedure TFPReportCustomImage.LoadDBData(AData: TFPReportData);
|
||||||
var
|
var
|
||||||
|
v : Variant;
|
||||||
s: string;
|
s: string;
|
||||||
lStream: TMemoryStream;
|
lStream: TMemoryStream;
|
||||||
|
irc : TFPCustomImageReaderClass;
|
||||||
begin
|
begin
|
||||||
s := AData.FieldValues[FFieldName];
|
v := AData.FieldValues[FFieldName];
|
||||||
lStream := TMemoryStream.Create;
|
lStream := TMemoryStream.Create;
|
||||||
try
|
try
|
||||||
|
if not TryVarByteArrayToStream(v,lStream) then
|
||||||
|
begin
|
||||||
|
s := v;
|
||||||
FPReportMIMEEncodeStringToStream(s, lStream);
|
FPReportMIMEEncodeStringToStream(s, lStream);
|
||||||
LoadPNGFromStream(lStream)
|
end;
|
||||||
|
s := Trim(DBImageType);
|
||||||
|
if (s = '') then
|
||||||
|
s := DefaultImageType;
|
||||||
|
irc := TFPCustomImage.FindReaderFromExtension(s);
|
||||||
|
LoadFromStream(lStream,irc);
|
||||||
finally
|
finally
|
||||||
lStream.Free;
|
lStream.Free;
|
||||||
end;
|
end;
|
||||||
@ -5390,6 +5435,7 @@ begin
|
|||||||
AWriter.WriteInteger('ImageIndex', idx);
|
AWriter.WriteInteger('ImageIndex', idx);
|
||||||
AWriter.WriteBoolean('Stretched', Stretched);
|
AWriter.WriteBoolean('Stretched', Stretched);
|
||||||
AWriter.WriteString('FieldName', FieldName);
|
AWriter.WriteString('FieldName', FieldName);
|
||||||
|
AWriter.WriteString('DBImageType', DBImageType);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPReportCustomImage.RecalcLayout;
|
procedure TFPReportCustomImage.RecalcLayout;
|
||||||
@ -5402,15 +5448,25 @@ function TFPReportCustomImage.PrepareObject(aRTParent: TFPReportElement): TFPRep
|
|||||||
Var
|
Var
|
||||||
Img : TFPReportCustomImage;
|
Img : TFPReportCustomImage;
|
||||||
B : TFPReportCustomBand;
|
B : TFPReportCustomBand;
|
||||||
|
D : TFPReportData;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=inherited PrepareObject(aRTParent);
|
Result:=inherited PrepareObject(aRTParent);
|
||||||
if Result=Nil then
|
if Result=Nil then
|
||||||
exit;
|
exit;
|
||||||
img := TFPReportCustomImage(Result);
|
img := TFPReportCustomImage(Result);
|
||||||
|
if Assigned(Band) then
|
||||||
|
B := Band
|
||||||
|
else
|
||||||
B := artParent as TFPReportCustomBand;
|
B := artParent as TFPReportCustomBand;
|
||||||
if (img.FieldName <> '') and Assigned(B.GetData) then
|
if (img.FieldName <> '') then
|
||||||
img.LoadDBData(B.GetData);
|
begin
|
||||||
|
D := B.GetData;
|
||||||
|
if not(Assigned(D)) and Assigned(B.Page.Data) then
|
||||||
|
D := B.Page.Data;
|
||||||
|
if Assigned(D) then
|
||||||
|
img.LoadDBData(D);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TFPReportCustomImage.Create(AOwner: TComponent);
|
constructor TFPReportCustomImage.Create(AOwner: TComponent);
|
||||||
@ -5419,6 +5475,7 @@ begin
|
|||||||
FImage := nil;
|
FImage := nil;
|
||||||
FStretched := False;
|
FStretched := False;
|
||||||
FImageID := -1;
|
FImageID := -1;
|
||||||
|
FDBImageType := DefaultImageType;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TFPReportCustomImage.Destroy;
|
destructor TFPReportCustomImage.Destroy;
|
||||||
@ -5458,6 +5515,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
FStretched := i.Stretched;
|
FStretched := i.Stretched;
|
||||||
FFieldName := i.FieldName;
|
FFieldName := i.FieldName;
|
||||||
|
FDBImageType := i.DBImageType;
|
||||||
FImageID := i.ImageID;
|
FImageID := i.ImageID;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -5469,6 +5527,7 @@ begin
|
|||||||
ImageID := AReader.ReadInteger('ImageIndex', -1);
|
ImageID := AReader.ReadInteger('ImageIndex', -1);
|
||||||
Stretched := AReader.ReadBoolean('Stretched', Stretched);
|
Stretched := AReader.ReadBoolean('Stretched', Stretched);
|
||||||
FieldName := AReader.ReadString('FieldName', FieldName);
|
FieldName := AReader.ReadString('FieldName', FieldName);
|
||||||
|
DBImageType := AReader.ReadString('DBImageType', DBImageType);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPReportCustomImage.LoadFromFile(const AFileName: string);
|
procedure TFPReportCustomImage.LoadFromFile(const AFileName: string);
|
||||||
|
@ -115,7 +115,7 @@ type
|
|||||||
//
|
//
|
||||||
|
|
||||||
type
|
type
|
||||||
TSocket = Cardinal;
|
TSocket = UINT_PTR;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Select uses arrays of SOCKETs. These macros manipulate such
|
// Select uses arrays of SOCKETs. These macros manipulate such
|
||||||
|
@ -157,6 +157,12 @@ const
|
|||||||
{$EXTERNALSYM SERVICE_CONTROL_POWEREVENT}
|
{$EXTERNALSYM SERVICE_CONTROL_POWEREVENT}
|
||||||
SERVICE_CONTROL_SESSIONCHANGE = $0000000E;
|
SERVICE_CONTROL_SESSIONCHANGE = $0000000E;
|
||||||
{$EXTERNALSYM SERVICE_CONTROL_SESSIONCHANGE}
|
{$EXTERNALSYM SERVICE_CONTROL_SESSIONCHANGE}
|
||||||
|
SERVICE_CONTROL_TIMECHANGE = $00000010;
|
||||||
|
{$EXTERNALSYM SERVICE_CONTROL_TIMECHANGE}
|
||||||
|
SERVICE_CONTROL_TRIGGEREVENT = $00000020;
|
||||||
|
{$EXTERNALSYM SERVICE_CONTROL_TRIGGEREVENT}
|
||||||
|
SERVICE_CONTROL_USERMODEREBOOT = $00000040;
|
||||||
|
{$EXTERNALSYM SERVICE_CONTROL_USERMODEREBOOT}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Service State -- for CurrentState
|
// Service State -- for CurrentState
|
||||||
@ -197,6 +203,13 @@ const
|
|||||||
{$EXTERNALSYM SERVICE_ACCEPT_POWEREVENT}
|
{$EXTERNALSYM SERVICE_ACCEPT_POWEREVENT}
|
||||||
SERVICE_ACCEPT_SESSIONCHANGE = $00000080;
|
SERVICE_ACCEPT_SESSIONCHANGE = $00000080;
|
||||||
{$EXTERNALSYM SERVICE_ACCEPT_SESSIONCHANGE}
|
{$EXTERNALSYM SERVICE_ACCEPT_SESSIONCHANGE}
|
||||||
|
SERVICE_ACCEPT_TIMECHANGE = $00000200;
|
||||||
|
{$EXTERNALSYM SERVICE_ACCEPT_TIMECHANGE}
|
||||||
|
SERVICE_ACCEPT_TRIGGEREVENT = $00000400;
|
||||||
|
{$EXTERNALSYM SERVICE_ACCEPT_TRIGGEREVENT}
|
||||||
|
SERVICE_ACCEPT_USERMODEREBOOT = $00000800;
|
||||||
|
{$EXTERNALSYM SERVICE_ACCEPT_USERMODEREBOOT}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Service Control Manager object specific access types
|
// Service Control Manager object specific access types
|
||||||
|
Loading…
Reference in New Issue
Block a user