text
stringlengths
14
6.51M
{************************************************} { } { ATPrintPreview- printing procedures } { Copyright (C) Alexey Torgashin } { http://uvviewsoft.com } { } {************************************************} {$I _Print.inc} unit ATxPrintProc; interface uses Windows, Graphics, ExtCtrls; type TATPrintFitMode = ( pFitNormal, pFitBest, pFitStretch, pFitSize ); TATPrintPosition = ( pPosTopLeft, pPosTop, pPosTopRight, pPosLeft, pPosCenter, pPosRight, pPosBottomLeft, pPosBottom, pPosBottomRight ); TATPrintUnit = ( pUnitMm, pUnitCm, pUnitIn ); const cUnitIn: array[TATPrintUnit] of Double = (2.54 * 10, 2.54, 1); type TFloatRect = record Left, Top, Right, Bottom: Double; end; TFloatSize = record X, Y: Double; end; TATPrintFooter = record Enabled: Boolean; EnableLine: Boolean; Caption: WideString; FontName: TFontName; FontSize: Integer; FontStyle: TFontStyles; FontColor: TColor; FontCharset: TFontCharset; end; type TATPrintOptions = record Copies: Integer; OptFit: TATPrintFitMode; OptFitSize: TFloatSize; OptPosition: TATPrintPosition; OptMargins: TFloatRect; OptUnit: TATPrintUnit; OptGamma: Double; OptFooter: TATPrintFooter; PixelsPerInch: Integer; JobCaption: string; FailOnErrors, NoPreview: Boolean; end; function BitmapPrint( ABitmap: TBitmap; var AOptions: TATPrintOptions): Boolean; function BitmapPrintAction( ABitmap: TBitmap; ATargetCanvas: TCanvas; ATargetWidth, ATargetHeight: Integer; ATargetPPIX, ATargetPPIY: Integer; AOptFit: TATPrintFitMode; AOptFitSize: TFloatSize; AOptPosition: TATPrintPosition; const AOptMargins: TFloatRect; AOptUnit: TATPrintUnit; const AOptGamma: Double; const AOptFooter: TATPrintFooter; AOptPreviewMode: Boolean; APixelsPerInch: Integer): Boolean; function PicturePrint( APicture: TPicture; var AOptions: TATPrintOptions): Boolean; function ImagePrint( AImage: TImage; var AOptions: TATPrintOptions): Boolean; type TATBitmapPreviewProc = function( ABitmap: TBitmap; var AOptions: TATPrintOptions): Boolean; var ATBitmapPreview: TATBitmapPreviewProc = nil; implementation uses SysUtils, Classes, Jpeg, Printers, Forms; //------------------------------------------------------------------------------ function ImagePrint( AImage: TImage; var AOptions: TATPrintOptions): Boolean; begin Assert(Assigned(AImage), 'Image not assigned'); Result := PicturePrint(AImage.Picture, AOptions); end; //------------------------------------------------------------------------------ function PicturePrint( APicture: TPicture; var AOptions: TATPrintOptions): Boolean; var bmp: TBitmap; begin if not Assigned(APicture.Graphic) then begin Result := False; Exit end; bmp := TBitmap.Create; try with APicture do begin bmp.PixelFormat := pf24bit; bmp.Width := Graphic.Width; bmp.Height := Graphic.Height; bmp.Canvas.Draw(0, 0, Graphic); end; Result := BitmapPrint(bmp, AOptions); finally bmp.Free; end; end; //------------------------------------------------------------------------------ procedure ValidateRect(var R: TRect); const cMinRectSize = 4; //px begin with R do begin if Right < Left then Right := Left + cMinRectSize; if Bottom < Top then Bottom := Top + cMinRectSize; end; end; //------------------------------------------------------------------------------ // Original copyright: Fedorovskih Nikolay // Date: 5 Jun 2002 // procedure BitmapGamma(Bitmap: TBitmap; L: Double); function Power(Base, Exponent: Double): Double; begin Result := Exp(Exponent * Ln(Base)); end; type TRGB = record B, G, R: Byte; end; pRGB = ^TRGB; var Dest: pRGB; X, Y: Word; GT: array[0..255] of Byte; begin //Added Assert(Assigned(Bitmap), 'Bitmap not assigned'); Assert(Bitmap.PixelFormat = pf24Bit, 'Bitmap format incorrect'); //Added if L < 0.01 then L := 0.01; if L > 7.0 then L := 7.0; GT[0] := 0; for X := 1 to 255 do GT[X] := Round(255 * Power(X / 255, 1 / L)); for Y := 0 to Bitmap.Height - 1 do begin Dest := Bitmap.ScanLine[y]; for X := 0 to Bitmap.Width - 1 do begin with Dest^ do begin R := GT[R]; G := GT[G]; B := GT[B]; end; Inc(Dest); end; end; end; //------------------------------------------------------------------------------ function FloatRect( const Left, Top, Right, Bottom: Double): TFloatRect; begin Result.Left := Left; Result.Top := Top; Result.Right := Right; Result.Bottom := Bottom; end; //------------------------------------------------------------------------------ function PreviewMarginsRect( ATargetWidth, ATargetHeight: Integer; ATargetPPIX, ATargetPPIY: Integer; const AOptMargins: TFloatRect; AOptUnit: TATPrintUnit): TRect; begin Result := Rect( Trunc(AOptMargins.Left / cUnitIn[AOptUnit] * ATargetPPIX), Trunc(AOptMargins.Top / cUnitIn[AOptUnit] * ATargetPPIY), ATargetWidth - Trunc(AOptMargins.Right / cUnitIn[AOptUnit] * ATargetPPIX), ATargetHeight - Trunc(AOptMargins.Bottom / cUnitIn[AOptUnit] * ATargetPPIY) ); ValidateRect(Result); end; //------------------------------------------------------------------------------ function FontHeight(ACanvas: TCanvas): Integer; var Metric: TTextMetric; begin if GetTextMetrics(ACanvas.Handle, Metric) then Result := Metric.tmHeight else Result := Abs(ACanvas.Font.Height); end; //------------------------------------------------------------------------------ procedure STextOut(C: TCanvas; X, Y: Integer; const S: WideString); begin TextOutW(C.Handle, X, Y, PWChar(S), Length(S)); end; //------------------------------------------------------------------------------ function BitmapPrintAction( ABitmap: TBitmap; ATargetCanvas: TCanvas; ATargetWidth, ATargetHeight: Integer; ATargetPPIX, ATargetPPIY: Integer; AOptFit: TATPrintFitMode; AOptFitSize: TFloatSize; AOptPosition: TATPrintPosition; const AOptMargins: TFloatRect; AOptUnit: TATPrintUnit; const AOptGamma: Double; const AOptFooter: TATPrintFooter; AOptPreviewMode: Boolean; APixelsPerInch: Integer): Boolean; // function FooterHeightSrc: Integer; var b: TBitmap; begin b := TBitmap.Create; b.Width := 10; b.Height := 10; with b.Canvas do try Font.Name := AOptFooter.FontName; Font.Size := AOptFooter.FontSize; Font.Style := AOptFooter.FontStyle; Font.Charset := AOptFooter.FontCharset; Result := Trunc(FontHeight(b.Canvas) * 1.2); finally b.Free; end; end; // function FooterOffset: Integer; begin Result := AOptFooter.FontSize div 2; end; // var Bitmap2: TBitmap; UseBitmap2: Boolean; Scale, ScalePX, ScalePY, ScaleX, ScaleY: Double; AvailWidth, AvailHeight, RectSizeX, RectSizeY, RectOffsetX, RectOffsetY: Integer; XLine, YLine, XText, YText: Integer; AvailRect, MarginsRect: TRect; begin Result := True; ScalePX := ATargetPPIX / APixelsPerInch; ScalePY := ATargetPPIY / APixelsPerInch; //Calc margins MarginsRect := PreviewMarginsRect( ATargetWidth, ATargetHeight, ATargetPPIX, ATargetPPIY, AOptMargins, AOptUnit); //Calc avalilable rect (margins minus footer) AvailRect := MarginsRect; if AOptFooter.Enabled then Dec(AvailRect.Bottom, Trunc(FooterHeightSrc * ScalePY)); ValidateRect(AvailRect); with AvailRect do begin AvailWidth := Right - Left; AvailHeight := Bottom - Top; end; case AOptFit of pFitStretch: begin RectSizeX := AvailWidth; RectSizeY := AvailHeight; RectOffsetX := 0; RectOffsetY := 0; end; else begin if (AOptFit = pFitSize) then begin RectSizeX := Trunc(AOptFitSize.X / cUnitIn[AOptUnit] * ATargetPPIX); RectSizeY := Trunc(AOptFitSize.Y / cUnitIn[AOptUnit] * ATargetPPIY); end else begin ScaleX := AvailWidth / ABitmap.Width / ScalePX; ScaleY := AvailHeight / ABitmap.Height / ScalePY; if ScaleX < ScaleY then Scale := ScaleX else Scale := ScaleY; if (AOptFit = pFitNormal) and (Scale > 1.0) then Scale := 1.0; RectSizeX := Trunc(ABitmap.Width * Scale * ScalePX); RectSizeY := Trunc(ABitmap.Height * Scale * ScalePY); end; case AOptPosition of pPosTopLeft: begin RectOffsetX := 0; RectOffsetY := 0; end; pPosTop: begin RectOffsetX := (AvailWidth - RectSizeX) div 2; RectOffsetY := 0; end; pPosTopRight: begin RectOffsetX := (AvailWidth - RectSizeX); RectOffsetY := 0; end; pPosLeft: begin RectOffsetX := 0; RectOffsetY := (AvailHeight - RectSizeY) div 2; end; pPosCenter: begin RectOffsetX := (AvailWidth - RectSizeX) div 2; RectOffsetY := (AvailHeight - RectSizeY) div 2; end; pPosRight: begin RectOffsetX := (AvailWidth - RectSizeX); RectOffsetY := (AvailHeight - RectSizeY) div 2; end; pPosBottomLeft: begin RectOffsetX := 0; RectOffsetY := (AvailHeight - RectSizeY); end; pPosBottom: begin RectOffsetX := (AvailWidth - RectSizeX) div 2; RectOffsetY := (AvailHeight - RectSizeY); end; else begin RectOffsetX := (AvailWidth - RectSizeX); RectOffsetY := (AvailHeight - RectSizeY); end; end; end; end; //case AOptFit //Apply gamma UseBitmap2 := AOptGamma <> 1.0; if UseBitmap2 then begin Bitmap2 := TBitmap.Create; Bitmap2.PixelFormat := pf24bit; try Bitmap2.Assign(ABitmap); BitmapGamma(Bitmap2, AOptGamma); except Application.MessageBox('Cannot allocate gamma bitmap', 'Error', MB_OK or MB_ICONERROR); UseBitmap2 := False; FreeAndNil(Bitmap2); Bitmap2 := ABitmap; end; end else Bitmap2 := ABitmap; try //Draw bitmap ATargetCanvas.StretchDraw( Rect( MarginsRect.Left + RectOffsetX, MarginsRect.Top + RectOffsetY, MarginsRect.Left + RectOffsetX + RectSizeX, MarginsRect.Top + RectOffsetY + RectSizeY), Bitmap2); //Draw footer if AOptFooter.Enabled then begin XLine := Trunc(FooterOffset * ScalePX); YLine := AvailHeight; YText := YLine + Trunc(2 * ScalePY); if AOptFooter.EnableLine then begin ATargetCanvas.Brush.Color := clWhite; ATargetCanvas.Pen.Color := clBlack; ATargetCanvas.Pen.Style := psSolid; ATargetCanvas.MoveTo(MarginsRect.Left + XLine, MarginsRect.Top + YLine); ATargetCanvas.LineTo(MarginsRect.Left + AvailWidth - XLine, MarginsRect.Top + YLine); end; ATargetCanvas.Font.Name := AOptFooter.FontName; ATargetCanvas.Font.Size := AOptFooter.FontSize; ATargetCanvas.Font.Style := AOptFooter.FontStyle; ATargetCanvas.Font.Color := AOptFooter.FontColor; ATargetCanvas.Font.Charset := AOptFooter.FontCharset; XText := (AvailWidth - ATargetCanvas.TextWidth(AOptFooter.Caption)) div 2; if XText < 0 then XText := 0; STextOut(ATargetCanvas, MarginsRect.Left + XText, MarginsRect.Top + YText, AOptFooter.Caption); end; //Draw empty space ATargetCanvas.Brush.Color := clWhite; ATargetCanvas.FillRect(Rect(0, 0, ATargetWidth + 1, MarginsRect.Top)); ATargetCanvas.FillRect(Rect(0, 0, MarginsRect.Left, ATargetHeight + 1)); ATargetCanvas.FillRect(Rect(0, MarginsRect.Bottom + 1, ATargetWidth + 1, ATargetHeight + 1)); ATargetCanvas.FillRect(Rect(MarginsRect.Right + 1, 0, ATargetWidth + 1, ATargetHeight + 1)); //Draw margins if AOptPreviewMode then begin ATargetCanvas.Brush.Style := bsClear; ATargetCanvas.Pen.Color := clBlack; ATargetCanvas.Pen.Style := psDash; ATargetCanvas.Rectangle(MarginsRect); end; except Result := False; end; if UseBitmap2 then FreeAndNil(Bitmap2); end; //------------------------------------------------------------------------------ {$I _Print2.inc} function BitmapPrint( ABitmap: TBitmap; var AOptions: TATPrintOptions): Boolean; begin Result := False; Assert( Assigned(ABitmap) and (ABitmap.Width > 0) and (ABitmap.Height > 0), 'BitmapPrint: bitmap is empty.'); //Preview code if not AOptions.NoPreview then begin if Assigned(ATBitmapPreview) then begin if not ATBitmapPreview(ABitmap, AOptions) then Exit; end else begin if AOptions.FailOnErrors then Exit; end; end; //end of preview code try if AOptions.Copies <= 0 then AOptions.Copies := 1; Printer.Title := AOptions.JobCaption; Printer.Copies := AOptions.Copies; Printer.BeginDoc; try Result := BitmapPrintAction( ABitmap, Printer.Canvas, Printer.PageWidth, Printer.PageHeight, GetDeviceCaps(Printer.Handle, LOGPIXELSX), GetDeviceCaps(Printer.Handle, LOGPIXELSY), AOptions.OptFit, AOptions.OptFitSize, AOptions.OptPosition, AOptions.OptMargins, AOptions.OptUnit, AOptions.OptGamma, AOptions.OptFooter, False, //AOptPreviewMode AOptions.PixelsPerInch ); finally Printer.EndDoc; end; except Result := False; end; end; end.
unit MWpasU; // Please, don't delete this comment. \\ (* Copyright Owner: Yahe Copyright Year : 2007-2018 Unit : MWpasU (platform dependant) Version: 1.4.5c Contact E-Mail: hello@yahe.sh *) // Please, don't delete this comment. \\ (* Description: This unit contains the shared memory interface implementation for the application MWconn by Markus B. Weber. It is a plain C to Pascal translation. *) (* Change Log: // See "change.log" for Information. *) interface uses Windows, SysUtils; // includes all other include files {$I MWpasU.inc} // opens the shared memory interface of MWconn // use CloseMWconnIO() to close it again function OpenMWconnIO(var AFile : THandle; var AMapping : PMWconnIO; const AInstance : String = '') : TMWconnAccessMode; // closes an already open shared memory interface // of MWconn opened with OpenMWconnIO() procedure CloseMWconnIO(var AFile : THandle; var AMapping : PMWconnIO); // returns whether the MWconn semaphore exists function IsMWconnRunning(const AInstance : String = '') : Boolean; // returns a data snapshot returned by MWconn function ReturnMWconnIO(var AData : TMWconnIO; const AInstance : String = '') : Boolean; // takes an enumerator and returns a string with the access mode function AccessModeToString(const AAccessMode : TMWconnAccessMode) : String; // duration values less than 0 are replaced by empty strings // durations are millisecond values // the result is: ":<aWaitDuration>:<aReadDuration>:<aCommand>" function BuildATCommand(const ACommand : String; const AWaitDuration : LongInt; const AReadDuration : LongInt) : String; // takes a number and returns an enumerator denoting the operation mode function GetOperationMode(const AOpMode : Byte) : TMWconnOperationMode; // takes an enumerator and returns a string with the operation mode function OperationModeToString(const AOperationMode : TMWconnOperationMode) : String; // takes a number and returns a string with the correct version number function ProgramVersionToString(const AProgramVersion : Word) : String; implementation // opens the shared memory interface of MWconn // use CloseMWconnIO() to close it again function OpenMWconnIO(var AFile : THandle; var AMapping : PMWconnIO; const AInstance : String = '') : TMWconnAccessMode; function MapMWconnIO(const AMappedFile : String; const AMapMode : Cardinal; var AFile : THandle; var AMapping : PMWconnIO) : Boolean; begin Result := false; AFile := OpenFileMapping(AMapMode, false, PChar(AMappedFile)); if (AFile <> 0) then begin try AMapping := MapViewOfFile(AFile, AMapMode, 0, 0, SizeOf(TMWconnIO)); Result := (AMapping <> nil); except CloseHandle(AFile); end; end; end; type TMapModeData = record AccessMode : TMWconnAccessMode; MapMode : Cardinal; end; const CMapFile : array [0..1] of String = (MWconnFileGlobal, MWconnFile); CMapMode : array [0..2] of TMapModeData = ((AccessMode : mwamAll; MapMode : FILE_MAP_ALL_ACCESS;), (AccessMode : mwamWrite; MapMode : FILE_MAP_WRITE;), (AccessMode : mwamRead; MapMode : FILE_MAP_READ;)); var LIndexA : Byte; LIndexB : Byte; begin Result := mwamNone; for LIndexA := Low(CMapFile) to High(CMapFile) do begin for LIndexB := Low(CMapMode) to High(CMapMode) do begin if MapMWconnIO(CMapFile[LIndexA] + Trim(AInstance), CMapMode[LIndexB].MapMode, AFile, AMapping) then Result := CMapMode[LIndexB].AccessMode; if (Result <> mwamNone) then Break; end; if (Result <> mwamNone) then Break; end; end; // closes an already open shared memory interface // of MWconn opened with OpenMWconnIO() procedure CloseMWconnIO(var AFile : THandle; var AMapping : PMWconnIO); begin if (AMapping <> nil) then UnmapViewOfFile(AMapping); if (AFile <> 0) then CloseHandle(AFile); AFile := 0; AMapping := nil; end; // returns whether the MWconn semaphore exists function IsMWconnRunning(const AInstance : String = '') : Boolean; const SEMAPHORE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or 3; var LSemaphore : THandle; begin LSemaphore := OpenSemaphore(SEMAPHORE_ALL_ACCESS, true, PChar(MWconnSemaphore + AInstance)); try Result := (LSemaphore <> 0); finally CloseHandle(LSemaphore); end; end; // returns a data snapshot returned by MWconn function ReturnMWconnIO(var AData : TMWconnIO; const AInstance : String = '') : Boolean; var LBuffer : PMWconnIO; LHandle : THandle; begin Result := false; if (OpenMWconnIO(LHandle, LBuffer, AInstance) <> mwamNone) then begin try CopyMemory(@AData, LBuffer, SizeOf(TMWconnIO)); Result := true; finally CloseMWconnIO(LHandle, LBuffer); end; end; end; // takes an enumerator and returns a string with the access mode function AccessModeToString(const AAccessMode : TMWconnAccessMode) : String; begin case AAccessMode of mwamAll : Result := 'ALL'; mwamRead : Result := 'READ'; mwamWrite : Result := 'WRITE'; else Result := 'NONE'; end; end; // duration values less than 0 are replaced by empty strings // durations are millisecond values // the result is: ":<aWaitDuration>:<aReadDuration>:<aCommand>" function BuildATCommand(const ACommand : String; const AWaitDuration : LongInt; const AReadDuration : LongInt) : String; const CSeperator = ':'; begin Result := CSeperator; if (AWaitDuration >= 0) then Result := Result + IntToStr(AWaitDuration); Result := Result + CSeperator; if (AReadDuration >= 0) then Result := Result + IntToStr(AReadDuration); Result := Result + CSeperator; Result := Result + ACommand; end; // takes a number and returns an enumerator denoting the operation mode function GetOperationMode(const AOpMode : Byte) : TMWconnOperationMode; begin case AOpMode of 1 : Result := mwomGPRS; 2 : Result := mwomUMTS; else Result := mwomUnknown; end; end; // takes an enumerator and returns a string with the operation mode function OperationModeToString(const AOperationMode : TMWconnOperationMode) : String; begin case AOperationMode of mwomGPRS : Result := 'GPRS'; mwomUMTS : Result := 'UMTS'; else Result := 'unknown'; end; end; // takes a number and returns a string with the correct version number function ProgramVersionToString(const AProgramVersion : Word) : String; begin Result := IntToStr(AProgramVersion shr $08) + '.' + IntToStr(AProgramVersion and $FF); end; end.
{******************************************************************************} { } { Delphi FB4D Library } { Copyright (c) 2018-2023 Christoph Schneider } { Schneider Infosystems AG, Switzerland } { https://github.com/SchneiderInfosystems/FB4D } { } {******************************************************************************} { } { Licensed under the Apache License, Version 2.0 (the "License"); } { you may not use this file except in compliance with the License. } { You may obtain a copy of the License at } { } { http://www.apache.org/licenses/LICENSE-2.0 } { } { Unless required by applicable law or agreed to in writing, software } { distributed under the License is distributed on an "AS IS" BASIS, } { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } { See the License for the specific language governing permissions and } { limitations under the License. } { } {******************************************************************************} unit FB4D.Document; interface uses System.Types, System.Classes, System.JSON, System.SysUtils, {$IFNDEF LINUX64} System.Sensors, {$ENDIF} FB4D.Interfaces, FB4D.Response, FB4D.Request; {$WARN DUPLICATE_CTOR_DTOR OFF} type TFirestoreDocument = class(TInterfacedObject, IFirestoreDocument) private fJSONObj: TJSONObject; fCreated, fUpdated: TDateTime; fDocumentName: string; fFields: array of record Name: string; Obj: TJSONObject; end; function FieldIndByName(const FieldName: string): integer; function ConvertRefPath(const Reference: string): string; public class function CreateCursor(const ProjectID: string): IFirestoreDocument; constructor Create(DocumentPath: TRequestResourceParam; const ProjectID: string; const Database: string = cDefaultDatabaseID); constructor CreateFromJSONObj(Response: IFirebaseResponse); overload; constructor CreateFromJSONObj(JSONObj: TJSONObject); overload; destructor Destroy; override; function DocumentName(FullPath: boolean): string; function DocumentFullPath: TRequestResourceParam; function DocumentPathWithinDatabase: TRequestResourceParam; function CreateTime(TimeZone: TTimeZone = tzUTC): TDateTime; function UpdateTime(TimeZone: TTimeZone = tzUTC): TDatetime; function CountFields: integer; function FieldName(Ind: integer): string; function FieldByName(const FieldName: string): TJSONObject; function FieldValue(Ind: integer): TJSONObject; function FieldType(Ind: integer): TFirestoreFieldType; function FieldTypeByName(const FieldName: string): TFirestoreFieldType; function AllFields: TStringDynArray; function GetValue(Ind: integer): TJSONValue; overload; function GetValue(const FieldName: string): TJSONValue; overload; function GetStringValue(const FieldName: string): string; function GetStringValueDef(const FieldName, Default: string): string; function GetIntegerValue(const FieldName: string): integer; function GetIntegerValueDef(const FieldName: string; Default: integer): integer; function GetInt64Value(const FieldName: string): Int64; function GetInt64ValueDef(const FieldName: string; Default: Int64): Int64; function GetDoubleValue(const FieldName: string): double; function GetDoubleValueDef(const FieldName: string; Default: double): double; function GetTimeStampValue(const FieldName: string; TimeZone: TTimeZone = tzUTC): TDateTime; function GetTimeStampValueDef(const FieldName: string; Default: TDateTime; TimeZone: TTimeZone = tzUTC): TDateTime; function GetBoolValue(const FieldName: string): boolean; function GetBoolValueDef(const FieldName: string; Default: boolean): boolean; function GetGeoPoint(const FieldName: string): TLocationCoord2D; function GetReference(const FieldName: string): string; function GetReferenceDef(const FieldName, Default: string): string; function GetBytes(const FieldName: string): TBytes; function GetArraySize(const FieldName: string): integer; function GetArrayType(const FieldName: string; Index: integer): TFirestoreFieldType; function GetArrayItem(const FieldName: string; Index: integer): TJSONPair; function GetArrayValue(const FieldName: string; Index: integer): TJSONValue; function GetArrayValues(const FieldName: string): TJSONObjects; function GetArrayMapValues(const FieldName: string): TJSONObjects; function GetArrayStringValues(const FieldName: string): TStringDynArray; function GetMapSize(const FieldName: string): integer; function GetMapType(const FieldName: string; Index: integer): TFirestoreFieldType; function GetMapSubFieldName(const FieldName: string; Index: integer): string; function GetMapValue(const FieldName: string; Index: integer): TJSONObject; overload; function GetMapValue(const FieldName, SubFieldName: string): TJSONObject; overload; function GetMapValues(const FieldName: string): TJSONObjects; function AddOrUpdateField(Field: TJSONPair): IFirestoreDocument; overload; function AddOrUpdateField(const FieldName: string; Val: TJSONValue): IFirestoreDocument; overload; function AsJSON: TJSONObject; function Clone: IFirestoreDocument; class function GetFieldType(const FieldType: string): TFirestoreFieldType; class function IsCompositeType(FieldType: TFirestoreFieldType): boolean; end; TFirestoreDocuments = class(TInterfacedObject, IFirestoreDocuments, IEnumerable<IFirestoreDocument>, IEnumerable) private fDocumentList: array of IFirestoreDocument; fServerTimeStampUTC: TDatetime; fPageToken: string; fSkippedResults: integer; protected function GetGenericEnumerator: IEnumerator<IFirestoreDocument>; function GetEnumerator: IEnumerator; function IFirestoreDocuments.GetEnumerator = GetGenericEnumerator; function IEnumerable<IFirestoreDocument>.GetEnumerator = GetGenericEnumerator; public constructor CreateFromJSONDocumentsObj(Response: IFirebaseResponse); class function IsJSONDocumentsObj(Response: IFirebaseResponse): boolean; constructor CreateFromJSONArr(Response: IFirebaseResponse); destructor Destroy; override; procedure AddFromJSONDocumentsObj(Response: IFirebaseResponse); function Count: integer; function Document(Ind: integer): IFirestoreDocument; function ServerTimeStamp(TimeZone: TTimeZone): TDateTime; function SkippedResults: integer; function MorePagesToLoad: boolean; function PageToken: string; procedure AddPageTokenToNextQuery(Query: TQueryParams); end; TFirestoreDocsEnumerator = class(TInterfacedObject, IEnumerator<IFirestoreDocument>, IEnumerator) private fDocs: TFirestoreDocuments; fCursor: integer; protected protected function GetCurrent: TObject; function GenericGetCurrent: IFirestoreDocument; function IEnumerator<IFirestoreDocument>.GetCurrent = GenericGetCurrent; public constructor Create(Docs: TFirestoreDocuments); function MoveNext: Boolean; procedure Reset; end; implementation uses System.Generics.Collections, System.NetEncoding, FB4D.Helpers; resourcestring rsInvalidDocNotOneNode = 'Invalid document - not one node only'; rsInvalidDocNode = 'Invalid document node: %s'; rsNotObj = 'not an object: '; rsInvalidDocArr = 'Invalid document - not an array: %s'; rsInvalidDocumentPath = 'Invalid document path "%s", expected "projects/*/database/*/documents"'; rsDocIndexOutOfBound = 'Index out of bound for document list'; rsInvalidDocNodeCountLess3 = 'Invalid document - node count less 3'; rsJSONFieldNameMissing = 'JSON field name missing'; rsJSONFieldCreateTimeMissing = 'JSON field createTime missing'; rsJSONFieldUpdateTimeMissing = 'JSON field updateTime missing'; rsFieldIsNotJSONObj = 'Field %d is not a JSON object as expected'; rsFieldIndexOutOfBound = 'Index out of bound for field list'; rsFieldNotContainJSONObj = 'Field does not contain a JSONObject'; rsFieldNotContainTypeValPair = 'Field does not contain type-value pair'; rsFieldNoFound = 'Field %s not found'; rsArrFieldNotJSONObj = 'Arrayfield[%d] does not contain a JSONObject'; rsArrFieldNotTypeValue = 'Arrayfield[%d] does not contain type-value pair'; rsArrFieldNoMap = 'Arrayfield[%d] does not contain a map'; rsArrIndexOutOfBound = 'Array index out of bound for array field'; rsMapIndexOutOfBound = 'Map index out of bound for array field'; rsInvalidMapField = 'Field %s is not a map field'; { TFirestoreDocuments } constructor TFirestoreDocuments.CreateFromJSONArr(Response: IFirebaseResponse); var JSONArr: TJSONArray; Obj: TJSONObject; c: integer; begin inherited Create; fSkippedResults := 0; fPageToken := ''; JSONArr := Response.GetContentAsJSONArr; try SetLength(fDocumentList, 0); if JSONArr.Count < 1 then raise EFirestoreDocument.Create(rsInvalidDocNotOneNode); for c := 0 to JSONArr.Count - 1 do begin Obj := JSONArr.Items[c] as TJSONObject; if (JSONArr.Count >= 1) and (Obj.Pairs[0].JsonString.Value = 'readTime') then begin // Empty [{'#$A' "readTime": "2018-06-21T08:08:50.445723Z"'#$A'}'#$A'] SetLength(fDocumentList, 0); if (JSONArr.Count >= 2) and (Obj.Pairs[1].JsonString.Value = 'skippedResults') then fSkippedResults := (Obj.Pairs[1].JsonValue as TJSONNumber).AsInt; end else if Obj.Pairs[0].JsonString.Value <> 'document' then raise EFirestoreDocument.CreateFmt(rsInvalidDocNode, [Obj.Pairs[0].JsonString.ToString]) else if not(Obj.Pairs[0].JsonValue is TJSONObject) then raise EFirestoreDocument.CreateFmt(rsInvalidDocNode, [rsNotObj + Obj.ToString]) else begin SetLength(fDocumentList, length(fDocumentList) + 1); fDocumentList[length(fDocumentList) - 1] := TFirestoreDocument.CreateFromJSONObj( Obj.Pairs[0].JsonValue as TJSONObject); end; end; finally JSONArr.Free; end; fServerTimeStampUTC := Response.GetServerTime(tzUTC); end; constructor TFirestoreDocuments.CreateFromJSONDocumentsObj( Response: IFirebaseResponse); var c: integer; JSONObj: TJSONObject; JSONArr: TJSONArray; begin fSkippedResults := 0; JSONObj := Response.GetContentAsJSONObj; try if JSONObj.Count < 1 then SetLength(fDocumentList, 0) else if JSONObj.Pairs[0].JsonString.Value = 'documents' then begin if not(JSONObj.Pairs[0].JsonValue is TJSONArray) then raise EFirestoreDocument.CreateFmt(rsInvalidDocArr, [JSONObj.ToString]); JSONArr := JSONObj.Pairs[0].JsonValue as TJSONArray; SetLength(fDocumentList, JSONArr.Count); for c := 0 to JSONArr.Count - 1 do fDocumentList[c] := TFirestoreDocument.CreateFromJSONObj( JSONArr.Items[c] as TJSONObject); end else begin SetLength(fDocumentList, 1); fDocumentList[0] := TFirestoreDocument.CreateFromJSONObj(JSONObj); end; fServerTimeStampUTC := Response.GetServerTime(tzUTC); if not JSONObj.TryGetValue<string>('nextPageToken', fPageToken) then fPageToken := ''; finally JSONObj.Free; end; end; procedure TFirestoreDocuments.AddFromJSONDocumentsObj( Response: IFirebaseResponse); var c, l: integer; JSONObj: TJSONObject; JSONArr: TJSONArray; begin fSkippedResults := 0; JSONObj := Response.GetContentAsJSONObj; try if JSONObj.Count >= 1 then begin l := length(fDocumentList); if JSONObj.Pairs[0].JsonString.Value = 'documents' then begin if not(JSONObj.Pairs[0].JsonValue is TJSONArray) then raise EFirestoreDocument.CreateFmt(rsInvalidDocArr, [JSONObj.ToString]); JSONArr := JSONObj.Pairs[0].JsonValue as TJSONArray; SetLength(fDocumentList, l + JSONArr.Count); for c := 0 to JSONArr.Count - 1 do fDocumentList[l + c] := TFirestoreDocument.CreateFromJSONObj( JSONArr.Items[c] as TJSONObject); end else begin SetLength(fDocumentList, l + 1); fDocumentList[l] := TFirestoreDocument.CreateFromJSONObj(JSONObj); end; end; fServerTimeStampUTC := Response.GetServerTime(tzUTC); if not JSONObj.TryGetValue<string>('nextPageToken', fPageToken) then fPageToken := ''; finally JSONObj.Free; end; end; class function TFirestoreDocuments.IsJSONDocumentsObj( Response: IFirebaseResponse): boolean; var JSONObj: TJSONObject; begin JSONObj := Response.GetContentAsJSONObj; try result := (JSONObj.Count = 1) and (JSONObj.Pairs[0].JsonString.ToString = '"documents"'); finally JSONObj.Free; end; end; destructor TFirestoreDocuments.Destroy; begin SetLength(fDocumentList, 0); inherited; end; function TFirestoreDocuments.Count: integer; begin result := length(fDocumentList); end; function TFirestoreDocuments.Document(Ind: integer): IFirestoreDocument; begin if (Ind >= 0) and (Ind < Count) then result := fDocumentList[Ind] else raise EFirestoreDocument.Create(rsDocIndexOutOfBound); end; function TFirestoreDocuments.ServerTimeStamp(TimeZone: TTimeZone): TDateTime; const cInitialDate: double = 0; begin case TimeZone of tzUTC: result := fServerTimeStampUTC; tzLocalTime: result := TFirebaseHelpers.ConvertToLocalDateTime(fServerTimeStampUTC); else result := TDateTime(cInitialDate); end; end; function TFirestoreDocuments.SkippedResults: integer; begin result := fSkippedResults; end; function TFirestoreDocuments.MorePagesToLoad: boolean; begin result := not fPageToken.IsEmpty; end; function TFirestoreDocuments.PageToken: string; begin result := fPageToken; end; procedure TFirestoreDocuments.AddPageTokenToNextQuery(Query: TQueryParams); begin if MorePagesToLoad then Query.AddPageToken(fPageToken); end; function TFirestoreDocuments.GetEnumerator: IEnumerator; begin result := GetGenericEnumerator; end; function TFirestoreDocuments.GetGenericEnumerator: IEnumerator<IFirestoreDocument>; begin result := TFirestoreDocsEnumerator.Create(self); end; { TFirestoreDocument } constructor TFirestoreDocument.Create(DocumentPath: TRequestResourceParam; const ProjectID, Database: string); begin inherited Create; fDocumentName := Format(cFirestoreDocumentPath, [ProjectID, Database, TFirebaseHelpers.EncodeResourceParams(DocumentPath)]); fJSONObj := TJSONObject.Create; fJSONObj.AddPair('name', fDocumentName); SetLength(fFields, 0); end; class function TFirestoreDocument.CreateCursor( const ProjectID: string): IFirestoreDocument; begin result := TFirestoreDocument.Create(['CursorDoc'], ProjectID); end; constructor TFirestoreDocument.CreateFromJSONObj(JSONObj: TJSONObject); var obj: TJSONObject; c: integer; begin inherited Create; fJSONObj := JSONObj.Clone as TJSONObject; if fJSONObj.Count < 3 then raise EFirestoreDocument.Create(rsInvalidDocNodeCountLess3); if not fJSONObj.TryGetValue('name', fDocumentName) then raise EStorageObject.Create(rsJSONFieldNameMissing); if not fJSONObj.TryGetValue('createTime', fCreated) then raise EStorageObject.Create(rsJSONFieldCreateTimeMissing); if not fJSONObj.TryGetValue('updateTime', fUpdated) then raise EStorageObject.Create(rsJSONFieldUpdateTimeMissing); if fJSONObj.TryGetValue('fields', obj) then begin SetLength(fFields, obj.Count); for c := 0 to CountFields - 1 do begin fFields[c].Name := obj.Pairs[c].JsonString.Value; if not(obj.Pairs[c].JsonValue is TJSONObject) then raise EStorageObject.CreateFmt(rsFieldIsNotJSONObj, [c]); fFields[c].Obj := obj.Pairs[c].JsonValue.Clone as TJSONObject; end; end else SetLength(fFields, 0); end; constructor TFirestoreDocument.CreateFromJSONObj(Response: IFirebaseResponse); var JSONObj: TJSONObject; begin JSONObj := Response.GetContentAsJSONObj; try CreateFromJSONObj(JSONObj); finally JSONObj.Free; end; end; destructor TFirestoreDocument.Destroy; var c: integer; begin for c := 0 to length(fFields) - 1 do FreeAndNil(fFields[c].Obj); SetLength(fFields, 0); fJSONObj.Free; inherited; end; function TFirestoreDocument.FieldIndByName(const FieldName: string): integer; var c: integer; begin result := -1; for c := 0 to CountFields - 1 do if SameText(fFields[c].Name, FieldName) then exit(c); end; function TFirestoreDocument.AddOrUpdateField(const FieldName: string; Val: TJSONValue): IFirestoreDocument; var FieldsObj: TJSONObject; Ind: integer; begin Assert(Assigned(fJSONObj), 'Missing JSON object in AddOrUpdateField'); if not fJSONObj.TryGetValue('fields', FieldsObj) then begin FieldsObj := TJSONObject.Create; fJSONObj.AddPair('fields', FieldsObj); end; Ind := FieldIndByName(FieldName); if Ind < 0 then begin Ind := CountFields; SetLength(fFields, Ind + 1); fFields[Ind].Name := FieldName; end else FieldsObj.RemovePair(FieldName).free; FieldsObj.AddPair(FieldName, Val); fFields[Ind].Obj := Val.Clone as TJSONObject; result := self; end; function TFirestoreDocument.AddOrUpdateField( Field: TJSONPair): IFirestoreDocument; var FieldName: string; FieldsObj: TJSONObject; Ind: integer; begin FieldName := Field.JsonString.Value; if not fJSONObj.TryGetValue('fields', FieldsObj) then begin FieldsObj := TJSONObject.Create; fJSONObj.AddPair('fields', FieldsObj); end; Ind := FieldIndByName(FieldName); if Ind < 0 then begin Ind := CountFields; SetLength(fFields, Ind + 1); fFields[Ind].Name := FieldName; end else FieldsObj.RemovePair(FieldName).free; FieldsObj.AddPair(Field); fFields[Ind].Obj := Field.JsonValue.Clone as TJSONObject; result := self; end; function TFirestoreDocument.AsJSON: TJSONObject; begin result := fJSONObj; end; function TFirestoreDocument.CountFields: integer; begin result := length(fFields); end; function TFirestoreDocument.DocumentName(FullPath: boolean): string; begin result := fDocumentName; if not FullPath then result := result.SubString(result.LastDelimiter('/') + 1); end; function TFirestoreDocument.DocumentFullPath: TRequestResourceParam; begin result := fDocumentName.Split(['/']); end; function TFirestoreDocument.DocumentPathWithinDatabase: TRequestResourceParam; var RemovedProjAndDB: string; c, p: integer; begin p := 0; for c := 1 to 5 do begin p := pos('/', fDocumentName, p + 1); if p = 0 then raise EFirestoreDocument.CreateFmt(rsInvalidDocumentPath, [fDocumentName]); end; RemovedProjAndDB := copy(fDocumentName, p + 1); result := RemovedProjAndDB.Split(['/']); end; function TFirestoreDocument.FieldName(Ind: integer): string; begin if (Ind < 0 ) or (Ind >= CountFields) then raise EFirestoreDocument.Create(rsFieldIndexOutOfBound); result := fFields[Ind].Name; end; function TFirestoreDocument.FieldType(Ind: integer): TFirestoreFieldType; var Obj: TJSONObject; begin if (Ind < 0 ) or (Ind >= CountFields) then raise EFirestoreDocument.Create(rsFieldIndexOutOfBound); if not(fFields[Ind].Obj is TJSONObject) then raise EFirestoreDocument.Create(rsFieldNotContainJSONObj); Obj := fFields[Ind].Obj as TJSONObject; if Obj.Count <> 1 then raise EFirestoreDocument.Create(rsFieldNotContainTypeValPair); result := GetFieldType(Obj.Pairs[0].JsonString.Value); end; function TFirestoreDocument.FieldValue(Ind: integer): TJSONObject; begin if (Ind < 0 ) or (Ind >= CountFields) then raise EFirestoreDocument.Create(rsFieldIndexOutOfBound); result := fFields[Ind].Obj; end; function TFirestoreDocument.FieldTypeByName( const FieldName: string): TFirestoreFieldType; var c: integer; begin for c := 0 to CountFields - 1 do if SameText(fFields[c].Name, FieldName) then exit(FieldType(c)); raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); end; function TFirestoreDocument.AllFields: TStringDynArray; var c: integer; begin SetLength(result, CountFields); for c := 0 to CountFields - 1 do result[c] := fFields[c].Name; end; class function TFirestoreDocument.GetFieldType( const FieldType: string): TFirestoreFieldType; begin if SameText(FieldType, 'nullValue') then result := fftNull else if SameText(FieldType, 'booleanValue') then result := fftBoolean else if SameText(FieldType, 'integerValue') then result := fftInteger else if SameText(FieldType, 'doubleValue') then result := fftDouble else if SameText(FieldType, 'timestampValue') then result := fftTimeStamp else if SameText(FieldType, 'stringValue') then result := fftString else if SameText(FieldType, 'bytesValue') then result := fftBytes else if SameText(FieldType, 'referenceValue') then result := fftReference else if SameText(FieldType, 'geoPointValue') then result := fftGeoPoint else if SameText(FieldType, 'arrayValue') then result := fftArray else if SameText(FieldType, 'mapValue') then result := fftMap else raise EFirestoreDocument.CreateFmt('Unknown field type %s', [FieldType]); end; function TFirestoreDocument.FieldByName(const FieldName: string): TJSONObject; var c: integer; begin result := nil; for c := 0 to CountFields - 1 do if SameText(fFields[c].Name, FieldName) then exit(fFields[c].Obj); end; function TFirestoreDocument.GetValue(Ind: integer): TJSONValue; var Obj: TJSONObject; begin if Ind >= CountFields then raise EFirestoreDocument.Create(rsFieldIndexOutOfBound); if not(fFields[Ind].Obj is TJSONObject) then raise EFirestoreDocument.Create(rsFieldNotContainJSONObj); Obj := fFields[Ind].Obj as TJSONObject; if Obj.Count <> 1 then raise EFirestoreDocument.Create(rsFieldNotContainTypeValPair); result := Obj.Pairs[0].JsonValue; end; function TFirestoreDocument.GetValue(const FieldName: string): TJSONValue; var c: integer; begin for c := 0 to CountFields - 1 do if SameText(fFields[c].Name, FieldName) then exit(GetValue(c)); raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); end; function TFirestoreDocument.GetStringValue(const FieldName: string): string; var Val: TJSONValue; begin Val := FieldByName(FieldName); if assigned(Val) then result := Val.GetValue<string>('stringValue') else raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); end; function TFirestoreDocument.GetStringValueDef(const FieldName, Default: string): string; var Val: TJSONValue; begin Val := FieldByName(FieldName); if not assigned(Val) then result := Default else if not Val.TryGetValue<string>('stringValue', result) then result := Default; end; function TFirestoreDocument.GetIntegerValue(const FieldName: string): integer; var Val: TJSONValue; begin Val := FieldByName(FieldName); if assigned(Val) then result := Val.GetValue<integer>('integerValue') else raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); end; function TFirestoreDocument.GetIntegerValueDef(const FieldName: string; Default: integer): integer; var Val: TJSONValue; begin Val := FieldByName(FieldName); if not assigned(Val) then result := Default else if not Val.TryGetValue<integer>('integerValue', result) then result := Default; end; function TFirestoreDocument.GetInt64Value(const FieldName: string): Int64; var Val: TJSONValue; begin Val := FieldByName(FieldName); if assigned(Val) then result := Val.GetValue<Int64>('integerValue') else raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); end; function TFirestoreDocument.GetInt64ValueDef(const FieldName: string; Default: Int64): Int64; var Val: TJSONValue; begin Val := FieldByName(FieldName); if not assigned(Val) then result := Default else if not Val.TryGetValue<Int64>('integerValue', result) then result := Default; end; function TFirestoreDocument.GetDoubleValue(const FieldName: string): double; var Val: TJSONValue; begin Val := FieldByName(FieldName); if assigned(Val) then result := Val.GetValue<double>('doubleValue') else raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); end; function TFirestoreDocument.GetDoubleValueDef(const FieldName: string; Default: double): double; var Val: TJSONValue; begin Val := FieldByName(FieldName); if not assigned(Val) then result := Default else if not Val.TryGetValue<double>('doubleValue', result) then result := Default; end; function TFirestoreDocument.GetTimeStampValue(const FieldName: string; TimeZone: TTimeZone): TDateTime; var Val: TJSONValue; begin Val := FieldByName(FieldName); if assigned(Val) then begin result := Val.GetValue<TDateTime>('timestampValue'); if TimeZone = tzLocalTime then result := TFirebaseHelpers.ConvertToLocalDateTime(result); end else raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); end; function TFirestoreDocument.GetTimeStampValueDef(const FieldName: string; Default: TDateTime; TimeZone: TTimeZone): TDateTime; var Val: TJSONValue; begin Val := FieldByName(FieldName); if not assigned(Val) then result := Default else if Val.TryGetValue<TDateTime>('timestampValue', result) then begin if TimeZone = tzLocalTime then result := TFirebaseHelpers.ConvertToLocalDateTime(result); end else result := Default; end; function TFirestoreDocument.GetBoolValue(const FieldName: string): boolean; var Val: TJSONValue; begin Val := FieldByName(FieldName); if assigned(Val) then result := Val.GetValue<boolean>('booleanValue') else raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); end; function TFirestoreDocument.GetBoolValueDef(const FieldName: string; Default: boolean): boolean; var Val: TJSONValue; begin Val := FieldByName(FieldName); if not assigned(Val) then result := Default else if not Val.TryGetValue<boolean>('booleanValue', result) then result := Default; end; function TFirestoreDocument.GetGeoPoint( const FieldName: string): TLocationCoord2D; var Val: TJSONValue; begin Val := FieldByName(FieldName).GetValue<TJSONValue>('geoPointValue'); if assigned(Val) then result := TLocationCoord2D.Create(Val.GetValue<double>('latitude'), Val.GetValue<double>('longitude')) else raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); end; function TFirestoreDocument.ConvertRefPath(const Reference: string): string; begin result := StringReplace(Reference, '\/', '/', [rfReplaceAll]); end; function TFirestoreDocument.GetReference(const FieldName: string): string; var Val: TJSONValue; begin Val := FieldByName(FieldName); if assigned(Val) then result := ConvertRefPath(Val.GetValue<string>('referenceValue')) else raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); end; function TFirestoreDocument.GetReferenceDef(const FieldName, Default: string): string; var Val: TJSONValue; begin Val := FieldByName(FieldName); if not assigned(Val) then result := Default else if Val.TryGetValue<string>('referenceValue', result) then result := ConvertRefPath(result) else result := Default; end; function TFirestoreDocument.GetBytes(const FieldName: string): TBytes; var Val: TJSONValue; begin Val := FieldByName(FieldName); if assigned(Val) then result := TNetEncoding.Base64.DecodeStringToBytes( Val.GetValue<string>('bytesValue')) else raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); end; function TFirestoreDocument.GetArraySize(const FieldName: string): integer; var Val: TJSONValue; Obj: TJSONObject; Arr: TJSONArray; begin Val := FieldByName(FieldName); if not assigned(Val) then exit(0); Obj := Val.GetValue<TJSONObject>('arrayValue'); if not assigned(Obj) then exit(0); Arr := Obj.GetValue('values') as TJSONArray; if not assigned(Arr) then exit(0); result := Arr.Count; end; function TFirestoreDocument.GetArrayValues( const FieldName: string): TJSONObjects; var Val: TJSONValue; Obj: TJSONObject; Arr: TJSONArray; c: integer; begin Val := FieldByName(FieldName); if not assigned(Val) then exit(nil); Obj := Val.GetValue<TJSONObject>('arrayValue'); if not assigned(Obj) then exit(nil); Arr := Obj.GetValue('values') as TJSONArray; if not assigned(Arr) then exit(nil); SetLength(result, Arr.Count); for c := 0 to Arr.Count - 1 do begin if not(Arr.Items[c] is TJSONObject) then raise EFirestoreDocument.CreateFmt(rsArrFieldNotJSONObj, [c]); Obj := Arr.Items[c] as TJSONObject; if Obj.Count <> 1 then raise EFirestoreDocument.CreateFmt(rsArrFieldNotTypeValue, [c]); result[c] := Obj; end; end; function TFirestoreDocument.GetArrayMapValues( const FieldName: string): TJSONObjects; var Val: TJSONValue; Obj: TJSONObject; Arr: TJSONArray; c: integer; FieldType: string; begin Val := FieldByName(FieldName); if not assigned(Val) then exit(nil); Obj := Val.GetValue<TJSONObject>('arrayValue'); if not assigned(Obj) then exit(nil); Arr := Obj.GetValue('values') as TJSONArray; if not assigned(Arr) then exit(nil); SetLength(result, Arr.Count); for c := 0 to Arr.Count - 1 do begin if not(Arr.Items[c] is TJSONObject) then raise EFirestoreDocument.CreateFmt(rsArrFieldNotJSONObj, [c]); Obj := Arr.Items[c] as TJSONObject; if Obj.Count <> 1 then raise EFirestoreDocument.CreateFmt(rsArrFieldNotTypeValue, [c]); FieldType := Obj.Pairs[0].JsonString.Value; if SameText(FieldType, 'mapValue') then result[c] := Obj.GetValue<TJSONObject>('mapValue.fields') else raise EFirestoreDocument.CreateFmt(rsArrFieldNoMap, [c]); end; end; function TFirestoreDocument.GetArrayStringValues( const FieldName: string): TStringDynArray; var Val: TJSONValue; Obj: TJSONObject; Arr: TJSONArray; c: integer; FieldType: string; begin SetLength(result, 0); Val := FieldByName(FieldName); if not assigned(Val) then exit; Obj := Val.GetValue<TJSONObject>('arrayValue'); Arr := Obj.GetValue('values') as TJSONArray; if not assigned(Arr) then exit; SetLength(result, Arr.Count); for c := 0 to Arr.Count - 1 do begin if not(Arr.Items[c] is TJSONObject) then raise EFirestoreDocument.CreateFmt(rsArrFieldNotJSONObj, [c]); Obj := Arr.Items[c] as TJSONObject; if Obj.Count <> 1 then raise EFirestoreDocument.CreateFmt(rsArrFieldNotTypeValue, [c]); FieldType := Obj.Pairs[0].JsonString.Value; if SameText(FieldType, 'stringValue') then result[c] := Obj.GetValue<string>('stringValue') else raise EFirestoreDocument.CreateFmt(rsArrFieldNoMap, [c]); end; end; function TFirestoreDocument.GetArrayType(const FieldName: string; Index: integer): TFirestoreFieldType; var Objs: TJSONObjects; begin Objs := GetArrayValues(FieldName); if not assigned(Objs) then raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); if Index >= length(Objs) then raise EFirestoreDocument.Create(rsArrIndexOutOfBound); result := GetFieldType(Objs[Index].Pairs[0].JsonString.Value); end; function TFirestoreDocument.GetArrayValue(const FieldName: string; Index: integer): TJSONValue; var Objs: TJSONObjects; begin Objs := GetArrayValues(FieldName); if not assigned(Objs) then raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); if Index >= length(Objs) then raise EFirestoreDocument.Create(rsArrIndexOutOfBound); result := Objs[Index].Pairs[0].JsonValue; end; function TFirestoreDocument.GetArrayItem(const FieldName: string; Index: integer): TJSONPair; var Objs: TJSONObjects; begin Objs := GetArrayValues(FieldName); if not assigned(Objs) then raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); if Index >= length(Objs) then raise EFirestoreDocument.Create(rsArrIndexOutOfBound); result := Objs[Index].Pairs[0]; end; function TFirestoreDocument.GetMapSize(const FieldName: string): integer; var Val: TJSONValue; Obj, Obj2: TJSONObject; begin Val := FieldByName(FieldName); if not assigned(Val) then exit(0); Obj := Val.GetValue<TJSONObject>('mapValue'); if not assigned(Obj) then exit(0); Obj2 := Obj.GetValue('fields') as TJSONObject; if not assigned(Obj2) then exit(0); result := Obj2.Count; end; function TFirestoreDocument.GetMapType(const FieldName: string; Index: integer): TFirestoreFieldType; var Objs: TJSONObjects; begin Objs := GetMapValues(FieldName); if not assigned(Objs) then raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); if (Index < 0) or (Index >= length(Objs)) then raise EFirestoreDocument.Create(rsMapIndexOutOfBound); result := GetFieldType(Objs[Index].Pairs[0].JsonString.Value); end; function TFirestoreDocument.GetMapSubFieldName(const FieldName: string; Index: integer): string; var Val: TJSONValue; Obj, Obj2: TJSONObject; begin Val := FieldByName(FieldName); if not assigned(Val) then raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); Obj := Val.GetValue<TJSONObject>('mapValue'); if not assigned(Obj) then raise EFirestoreDocument.CreateFmt(rsInvalidMapField, [FieldName]); Obj2 := Obj.GetValue('fields') as TJSONObject; if not assigned(Obj2) then raise EFirestoreDocument.CreateFmt(rsInvalidMapField, [FieldName]); if (Index < 0) or (Index >= Obj2.Count) then raise EFirestoreDocument.Create(rsMapIndexOutOfBound); result := Obj2.Pairs[Index].JsonString.Value; end; function TFirestoreDocument.GetMapValue(const FieldName: string; Index: integer): TJSONObject; var Objs: TJSONObjects; begin Objs := GetMapValues(FieldName); if not assigned(Objs) then raise EFirestoreDocument.CreateFmt(rsFieldNoFound, [FieldName]); if (Index < 0) or (Index >= length(Objs)) then raise EFirestoreDocument.Create(rsMapIndexOutOfBound); result := Objs[Index]; end; function TFirestoreDocument.GetMapValue(const FieldName, SubFieldName: string): TJSONObject; var Val: TJSONValue; Obj, Obj2: TJSONObject; c: integer; begin Val := FieldByName(FieldName); if not assigned(Val) then exit(nil); Obj := Val.GetValue<TJSONObject>('mapValue'); if not assigned(Obj) then exit(nil); Obj2 := Obj.GetValue('fields') as TJSONObject; if not assigned(Obj2) then exit(nil); for c := 0 to Obj2.Count - 1 do if Obj2.Pairs[c].JsonString.Value = SubFieldName then exit(Obj2.Pairs[c].JsonValue as TJSONObject); result := nil; end; function TFirestoreDocument.GetMapValues(const FieldName: string): TJSONObjects; var Val: TJSONValue; Obj, Obj2: TJSONObject; c: integer; begin Val := FieldByName(FieldName); if not assigned(Val) then exit(nil); Obj := Val.GetValue<TJSONObject>('mapValue'); if not assigned(Obj) then exit(nil); Obj2 := Obj.GetValue('fields') as TJSONObject; if not assigned(Obj2) then exit(nil); SetLength(result, Obj2.Count); for c := 0 to Obj2.Count - 1 do result[c] := Obj2.Pairs[c].JsonValue as TJSONObject; end; function TFirestoreDocument.CreateTime(TimeZone: TTimeZone): TDateTime; begin result := fCreated; if TimeZone = tzLocalTime then result := TFirebaseHelpers.ConvertToLocalDateTime(result); end; function TFirestoreDocument.UpdateTime(TimeZone: TTimeZone): TDatetime; begin result := fUpdated; if TimeZone = tzLocalTime then result := TFirebaseHelpers.ConvertToLocalDateTime(result); end; function TFirestoreDocument.Clone: IFirestoreDocument; begin result := TFirestoreDocument.CreateFromJSONObj(fJSONObj); end; class function TFirestoreDocument.IsCompositeType( FieldType: TFirestoreFieldType): boolean; begin result := FieldType in [fftArray, fftMap]; end; { TFirestoreDocsEnumerator } constructor TFirestoreDocsEnumerator.Create(Docs: TFirestoreDocuments); begin fDocs := Docs; fCursor := -1; end; function TFirestoreDocsEnumerator.GetCurrent: TObject; begin result := TObject(GenericGetCurrent); end; function TFirestoreDocsEnumerator.GenericGetCurrent: IFirestoreDocument; begin if fCursor < fDocs.Count then result := fDocs.Document(fCursor) else result := nil; end; function TFirestoreDocsEnumerator.MoveNext: Boolean; begin inc(fCursor); result := fCursor < fDocs.Count; end; procedure TFirestoreDocsEnumerator.Reset; begin fCursor := -1; end; end.
unit gCitizens; //============================================================================= // gCitizens.pas //============================================================================= // // Responsible for managing citizens (creating, looking for work, death, etc) // //============================================================================= interface uses SwinGame, sgTypes, gTypes, gMap; procedure CreateCitizens(var game : GameData; home : Point2D; count : Integer); implementation function RandomName(var game : GameData) : String; var i: Integer; begin i := Random(High(game.names)); result := game.names[i]; end; procedure CreateCitizen(var game : GameData; home : Point2D); var idx: Integer; begin SetLength(game.citizens, Length(game.citizens) + 1); idx := High(game.citizens); game.citizens[idx].home := home; game.citizens[idx].firstName := RandomName(game); game.citizens[idx].lastName := RandomName(game); end; procedure CreateCitizens(var game : GameData; home : Point2D; count : Integer); var i: Integer; begin for i := 1 to count do begin CreateCitizen(game, home); end; end; end.
unit UOrderedRawList; interface uses Classes, URawBytes; type // Maintains a TRawBytes (AnsiString) list ordered to quick search withoud duplicates { TOrderedRawList } TOrderedRawList = Class private FList : TList; public Constructor Create; Destructor Destroy; Override; Procedure Clear; Function Add(Const RawData : TRawBytes; tagValue : Integer = 0) : Integer; Procedure Remove(Const RawData : TRawBytes); Function Count : Integer; Function Get(index : Integer) : TRawBytes; Procedure Delete(index : Integer); procedure SetTag(Const RawData : TRawBytes; newTagValue : Integer); function GetTag(Const RawData : TRawBytes) : Integer; overload; function GetTag(index : Integer) : Integer; overload; Function IndexOf(Const RawData : TRawBytes) : Integer; Function Find(const RawData: TRawBytes; var Index: Integer): Boolean; Procedure CopyFrom(master : TOrderedRawList); End; implementation uses SysUtils, UBaseType; { TOrderedRawList } Type TRawListData = Record RawData : TRawBytes; tag : Integer; End; PRawListData = ^TRawListData; function TOrderedRawList.Add(const RawData: TRawBytes; tagValue : Integer = 0) : Integer; Var P : PRawListData; begin if Find(RawData,Result) then begin PRawListData(FList[Result])^.tag := tagValue; end else begin New(P); P^.RawData := RawData; P^.tag := tagValue; FList.Insert(Result,P); end; end; procedure TOrderedRawList.Remove(const RawData: TRawBytes); Var i : Integer; begin i := IndexOf(RawData); If i>=0 then Delete(i); end; procedure TOrderedRawList.Clear; Var P : PRawListData; i : Integer; begin for i := FList.Count - 1 downto 0 do begin P := FList[i]; Dispose(P); end; FList.Clear; end; function TOrderedRawList.Count: Integer; begin Result := FList.Count; end; constructor TOrderedRawList.Create; begin FList := TList.Create; end; procedure TOrderedRawList.Delete(index: Integer); Var P : PRawListData; begin P := PRawListData(FList[index]); FList.Delete(index); Dispose(P); end; destructor TOrderedRawList.Destroy; begin Clear; FreeAndNil(FList); inherited; end; function TOrderedRawList.Find(const RawData: TRawBytes; var Index: Integer): Boolean; var L, H, I: Integer; c : Integer; begin Result := False; L := 0; H := FList.Count - 1; while L <= H do begin I := (L + H) shr 1; c := TBaseType.BinStrComp(PRawListData(FList[i])^.RawData,RawData); if C < 0 then L := I + 1 else begin H := I - 1; if C = 0 then begin Result := True; L := I; end; end; end; Index := L; end; function TOrderedRawList.Get(index: Integer): TRawBytes; begin Result := PRawListData(FList[index])^.RawData; end; function TOrderedRawList.GetTag(index: Integer): Integer; begin Result := PRawListData(FList[index])^.tag; end; function TOrderedRawList.GetTag(const RawData: TRawBytes): Integer; Var i : Integer; begin if Not Find(RawData,i) then begin Result := 0; end else begin Result := PRawListData(FList[i])^.tag; end; end; function TOrderedRawList.IndexOf(const RawData: TRawBytes): Integer; begin if Not Find(RawData,Result) then Result := -1; end; procedure TOrderedRawList.CopyFrom(master: TOrderedRawList); Var i : Integer; begin If master=Self then Exit; Clear; For i:=0 to master.Count-1 do begin Add(master.Get(i),master.GetTag(i)); end; end; procedure TOrderedRawList.SetTag(const RawData: TRawBytes; newTagValue: Integer); begin Add(RawData,newTagValue); end; end.
unit uModeloRelatorioController; interface uses System.SysUtils, uDMModeloRelatorio, uRegras, uEnumerador, uDM, Data.DB, Vcl.Forms, uFuncoesSIDomper, Data.DBXJSON, Data.DBXJSONReflect, uConverter; type TModeloRelatorioController = class private FModel: TDMModeloRelatorio; FOperacao: TOperacao; procedure Post; public procedure Filtrar(ACampo, ATexto, AAtivo: string; AContem: Boolean = False); procedure FiltrarUsuario(ACampo, ATexto, AAtivo: string; AContem: Boolean = False); procedure FiltrarCodigo(ACodigo: Integer); procedure LocalizarId(AId: Integer); procedure LocalizarCodigo(ACodigo: integer); procedure Novo(AIdUsuario: Integer); procedure Editar(AId: Integer; AFormulario: TForm); function Salvar(AIdUsuario: Integer): Integer; procedure Excluir(AIdUsuario, AId: Integer); procedure Cancelar(); procedure Imprimir(AIdUsuario: Integer); function ProximoId(): Integer; function ProximoCodigo(): Integer; procedure Pesquisar(AId, Codigo: Integer); function CodigoAtual: Integer; property Model: TDMModeloRelatorio read FModel write FModel; constructor Create(); destructor Destroy; override; end; implementation { TModeloRelatorioController } uses uModeloRelatorioVO; procedure TModeloRelatorioController.Cancelar; begin if FModel.CDSCadastro.State in [dsEdit, dsInsert] then FModel.CDSCadastro.Cancel; end; function TModeloRelatorioController.CodigoAtual: Integer; begin Result := FModel.CDSCadastroModR_Codigo.AsInteger; end; constructor TModeloRelatorioController.Create; begin inherited Create; FModel := TDMModeloRelatorio.Create(nil); end; destructor TModeloRelatorioController.Destroy; begin FreeAndNil(FModel); inherited; end; procedure TModeloRelatorioController.Editar(AId: Integer; AFormulario: TForm); var Negocio: TServerModule2Client; Resultado: Boolean; begin if AId = 0 then raise Exception.Create('Não há Registro para Editar!'); DM.Conectar; Negocio := TServerModule2Client.Create(DM.Conexao.DBXConnection); try FModel.CDSCadastro.Close; Resultado := Negocio.Editar(CModeloRelatorio, dm.IdUsuario, AId); FModel.CDSCadastro.Open; TFuncoes.HabilitarCampo(AFormulario, Resultado); FOperacao := opEditar; finally FreeAndNil(Negocio); DM.Desconectar; end; end; procedure TModeloRelatorioController.Excluir(AIdUsuario, AId: Integer); var Negocio: TServerModule2Client; begin if AId = 0 then raise Exception.Create('Não há Registro para Excluir!'); DM.Conectar; Negocio := TServerModule2Client.Create(DM.Conexao.DBXConnection); try Negocio.Excluir(CModeloRelatorio, AIdUsuario, AId); FModel.CDSConsulta.Delete; finally FreeAndNil(Negocio); DM.Desconectar; end; end; procedure TModeloRelatorioController.Filtrar(ACampo, ATexto, AAtivo: string; AContem: Boolean); var Negocio: TServerModule2Client; begin DM.Conectar; Negocio := TServerModule2Client.Create(DM.Conexao.DBXConnection); try FModel.CDSConsulta.Close; Negocio.Filtrar(CModeloRelatorio, ACampo, ATexto, AAtivo, AContem); FModel.CDSConsulta.Open; finally FreeAndNil(Negocio); end; end; procedure TModeloRelatorioController.FiltrarCodigo(ACodigo: Integer); var Negocio: TServerModule2Client; begin DM.Conectar; Negocio := TServerModule2Client.Create(DM.Conexao.DBXConnection); try FModel.CDSConsulta.Close; Negocio.FiltrarCodigo(CModeloRelatorio, ACodigo); FModel.CDSConsulta.Open; finally DM.Desconectar; FreeAndNil(Negocio); end; end; procedure TModeloRelatorioController.FiltrarUsuario(ACampo, ATexto, AAtivo: string; AContem: Boolean); var Negocio: TServerModule2Client; begin DM.Conectar; Negocio := TServerModule2Client.Create(dm.Conexao.DBXConnection); try FModel.CDSConsulta.Close; Negocio.ModeloRelatoriosFiltrar(ACampo, ATexto, AAtivo, dm.IdUsuario, AContem); FModel.CDSConsulta.Open; finally FreeAndNil(Negocio); DM.Desconectar; end; end; procedure TModeloRelatorioController.Imprimir(AIdUsuario: Integer); var Negocio: TServerModule2Client; begin DM.Conectar; Negocio := TServerModule2Client.Create(dm.Conexao.DBXConnection); try Negocio.Relatorio(CModeloRelatorio, AIdUsuario); FModel.Rel.Print; finally FreeAndNil(Negocio); DM.Desconectar; end; end; procedure TModeloRelatorioController.LocalizarCodigo(ACodigo: integer); var Negocio: TServerModule2Client; begin DM.Conectar; Negocio := TServerModule2Client.Create(DM.Conexao.DBXConnection); try FModel.CDSCadastro.Close; Negocio.LocalizarCodigo(CModeloRelatorio, ACodigo); FModel.CDSCadastro.Open; finally DM.Desconectar; FreeAndNil(Negocio); end; end; procedure TModeloRelatorioController.LocalizarId(AId: Integer); var Negocio: TServerModule2Client; begin DM.Conectar; Negocio := TServerModule2Client.Create(DM.Conexao.DBXConnection); try FModel.CDSCadastro.Close; Negocio.LocalizarId(CModeloRelatorio, AId); FModel.CDSCadastro.Open; finally FreeAndNil(Negocio); DM.Desconectar; end; end; procedure TModeloRelatorioController.Novo(AIdUsuario: Integer); var Negocio: TServerModule2Client; begin DM.Conectar; Negocio := TServerModule2Client.Create(DM.Conexao.DBXConnection); try FModel.CDSCadastro.Close; Negocio.Novo(CModeloRelatorio, AIdUsuario); FModel.CDSCadastro.Open; FModel.CDSCadastro.Append; FModel.CDSCadastroModR_Codigo.AsInteger := ProximoCodigo(); FOperacao := opIncluir; finally FreeAndNil(Negocio); DM.Desconectar; end; end; procedure TModeloRelatorioController.Pesquisar(AId, Codigo: Integer); begin if AId > 0 then LocalizarId(AId) else LocalizarCodigo(Codigo); end; procedure TModeloRelatorioController.Post; begin if FModel.CDSConsulta.State in [dsEdit, dsInsert] then FModel.CDSConsulta.Post; end; function TModeloRelatorioController.ProximoCodigo: Integer; var Negocio: TServerModule2Client; iCodigo: Integer; begin DM.Conectar; Negocio := TServerModule2Client.Create(DM.Conexao.DBXConnection); try iCodigo := StrToInt(Negocio.ProximoCodigo(CModeloRelatorio).ToString); Result := iCodigo; finally FreeAndNil(Negocio); DM.Desconectar; end; end; function TModeloRelatorioController.ProximoId: Integer; var Negocio: TServerModule2Client; iCodigo: Integer; begin DM.Conectar; Negocio := TServerModule2Client.Create(DM.Conexao.DBXConnection); try iCodigo := StrToInt(Negocio.ProximoId(CModeloRelatorio).ToString); Result := iCodigo; finally FreeAndNil(Negocio); DM.Desconectar; end; end; function TModeloRelatorioController.Salvar(AIdUsuario: Integer): Integer; var Negocio: TServerModule2Client; Model: TModeloRelatorioVO; oObjetoJSON : TJSONValue; begin Model := TModeloRelatorioVO.Create; DM.Conectar; Negocio := TServerModule2Client.Create(DM.Conexao.DBXConnection); try try Model.Id := FModel.CDSCadastroModR_Id.AsInteger; Model.Codigo := FModel.CDSCadastroModR_Codigo.AsInteger; Model.Descricao := FModel.CDSCadastroModR_Descricao.AsString; Model.Arquivo := FModel.CDSCadastroModR_Arquivo.AsString; Model.IdRevenda := FModel.CDSCadastroModR_Revenda.AsInteger; oObjetoJSON := TConverte.ObjectToJSON<TModeloRelatorioVO>(Model); Result := StrToIntDef(Negocio.ModeloRelatorioSalvar(oObjetoJSON).ToString(),0); Post; FOperacao := opNavegar; except on E: Exception do begin TFuncoes.MensagemErroBanco(E.Message); Abort; end; end; finally FreeAndNil(Negocio); FreeAndNil(Model); DM.Desconectar; end; end; end.
{ This file is part of the Free Pascal run time library. Copyright (c) 2008 by the Free Pascal development team Tiff reader for fpImage. See the file COPYING.FPC, included in this distribution, for details about the copyright. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ********************************************************************** Working: Grayscale 8,16bit (optional alpha), RGB 8,16bit (optional alpha), Orientation, ToDo: Compression: LZW, packbits, deflate, jpeg, ... thumbnail Planar ColorMap multiple images separate mask pages fillorder - not needed by baseline tiff reader bigtiff 64bit offsets endian - currently using system endianess } unit FPWriteTiff; {$mode objfpc}{$H+} {off $DEFINE VerboseTiffWriter} interface uses Math, Classes, SysUtils, FPimage, FPTiffCmn; type { TTiffWriteEntry } TTiffWriteEntry = class public Tag: Word; EntryType: Word; Count: DWord; Data: Pointer; DataPos: DWord; Bytes: DWord; destructor Destroy; override; end; TTiffWriteStrip = record Data: Pointer; Bytes: DWord; end; PTiffWriteStrip = ^TTiffWriteStrip; { TTiffWriteStripOffsets } TTiffWriteStripOffsets = class(TTiffWriteEntry) public Strips: PTiffWriteStrip; StripByteCounts: TTiffWriteEntry; constructor Create; destructor Destroy; override; procedure SetCount(NewCount: DWord); end; { TFPWriterTiff } TFPWriterTiff = class(TFPCustomImageWriter) private FSaveCMYKAsRGB: boolean; fStartPos: Int64; FEntries: TFPList; // list of TFPList of TTiffWriteEntry fStream: TStream; fPosition: DWord; procedure ClearEntries; procedure WriteTiff; procedure WriteHeader; procedure WriteIDFs; procedure WriteEntry(Entry: TTiffWriteEntry); procedure WriteData; procedure WriteEntryData(Entry: TTiffWriteEntry); procedure WriteBuf(var Buf; Count: DWord); procedure WriteWord(w: Word); procedure WriteDWord(d: DWord); protected procedure InternalWrite(Stream: TStream; Img: TFPCustomImage); override; procedure AddEntryString(Tag: word; const s: string); procedure AddEntryShort(Tag: word; Value: Word); procedure AddEntryLong(Tag: word; Value: DWord); procedure AddEntryRational(Tag: word; const Value: TTiffRational); procedure AddEntry(Tag: Word; EntryType: Word; EntryCount: DWord; Data: Pointer; Bytes: DWord; CopyData: boolean = true); procedure AddEntry(Entry: TTiffWriteEntry); procedure TiffError(Msg: string); public constructor Create; override; destructor Destroy; override; procedure Clear; procedure AddImage(Img: TFPCustomImage); procedure SaveToStream(Stream: TStream); property SaveCMYKAsRGB: boolean read FSaveCMYKAsRGB write FSaveCMYKAsRGB; end; function CompareTiffWriteEntries(Entry1, Entry2: Pointer): integer; implementation function CompareTiffWriteEntries(Entry1, Entry2: Pointer): integer; begin Result:=integer(TTiffWriteEntry(Entry1).Tag)-integer(TTiffWriteEntry(Entry2).Tag); end; { TFPWriterTiff } procedure TFPWriterTiff.WriteWord(w: Word); begin if fStream<>nil then fStream.WriteWord(w); inc(fPosition,2); end; procedure TFPWriterTiff.WriteDWord(d: DWord); begin if fStream<>nil then fStream.WriteDWord(d); inc(fPosition,4); end; procedure TFPWriterTiff.ClearEntries; var i: Integer; List: TFPList; j: Integer; begin for i:=FEntries.Count-1 downto 0 do begin List:=TFPList(FEntries[i]); for j:=List.Count-1 downto 0 do TObject(List[j]).Free; List.Free; end; FEntries.Clear; end; procedure TFPWriterTiff.WriteTiff; begin {$IFDEF VerboseTiffWriter} writeln('TFPWriterTiff.WriteTiff fStream=',fStream<>nil); {$ENDIF} fPosition:=0; WriteHeader; WriteIDFs; WriteData; end; procedure TFPWriterTiff.WriteHeader; var EndianMark: String; begin EndianMark:={$IFDEF FPC_BIG_ENDIAN}'MM'{$ELSE}'II'{$ENDIF}; WriteBuf(EndianMark[1],2); WriteWord(42); WriteDWord(8); end; procedure TFPWriterTiff.WriteIDFs; var i: Integer; List: TFPList; j: Integer; Entry: TTiffWriteEntry; NextIDFPos: DWord; begin for i:=0 to FEntries.Count-1 do begin List:=TFPList(FEntries[i]); // write count {$IFDEF VerboseTiffWriter} writeln('TFPWriterTiff.WriteIDFs Count=',List.Count); {$ENDIF} WriteWord(List.Count); // write array of entries for j:=0 to List.Count-1 do begin Entry:=TTiffWriteEntry(List[j]); WriteEntry(Entry); end; // write position of next IDF if i<FEntries.Count-1 then NextIDFPos:=fPosition+4 else NextIDFPos:=0; WriteDWord(NextIDFPos); end; end; procedure TFPWriterTiff.WriteEntry(Entry: TTiffWriteEntry); var PadBytes: DWord; begin {$IFDEF VerboseTiffWriter} writeln('TFPWriterTiff.WriteEntry Tag=',Entry.Tag,' Type=',Entry.EntryType,' Count=',Entry.Count,' Bytes=',Entry.Bytes); {$ENDIF} WriteWord(Entry.Tag); WriteWord(Entry.EntryType); WriteDWord(Entry.Count); if Entry.Bytes<=4 then begin if Entry.Bytes>0 then WriteBuf(Entry.Data^,Entry.Bytes); PadBytes:=0; WriteBuf(PadBytes,4-Entry.Bytes); end else begin WriteDWord(Entry.DataPos); end; end; procedure TFPWriterTiff.WriteData; var i: Integer; List: TFPList; j: Integer; Entry: TTiffWriteEntry; Strips: TTiffWriteStripOffsets; k: Integer; Bytes: DWord; begin for i:=0 to FEntries.Count-1 do begin List:=TFPList(FEntries[i]); // write entry data for j:=0 to List.Count-1 do begin Entry:=TTiffWriteEntry(List[j]); WriteEntryData(Entry); end; // write strips for j:=0 to List.Count-1 do begin Entry:=TTiffWriteEntry(List[j]); if Entry is TTiffWriteStripOffsets then begin Strips:=TTiffWriteStripOffsets(Entry); // write Strips for k:=0 to Strips.Count-1 do begin PDWord(Strips.Data)[k]:=fPosition; Bytes:=Strips.Strips[k].Bytes; PDWord(Strips.StripByteCounts.Data)[k]:=Bytes; {$IFDEF VerboseTiffWriter} //writeln('TFPWriterTiff.WriteData Strip fPosition=',fPosition,' Bytes=',Bytes); {$ENDIF} if Bytes>0 then WriteBuf(Strips.Strips[k].Data^,Bytes); end; end; end; end; end; procedure TFPWriterTiff.WriteEntryData(Entry: TTiffWriteEntry); begin if Entry.Bytes>4 then begin Entry.DataPos:=fPosition; WriteBuf(Entry.Data^,Entry.Bytes); end; end; procedure TFPWriterTiff.WriteBuf(var Buf; Count: DWord); begin if Count=0 then exit; if (fStream<>nil) then fStream.Write(Buf,Count); inc(fPosition,Count); end; procedure TFPWriterTiff.AddImage(Img: TFPCustomImage); var IDF: TTiffIDF; GrayBits: Word; RedBits: Word; GreenBits: Word; BlueBits: Word; AlphaBits: Word; ImgWidth: DWord; ImgHeight: DWord; Compression: Word; BitsPerSample: array[0..3] of Word; SamplesPerPixel: Integer; BitsPerPixel: DWord; i: Integer; OrientedWidth: DWord; OrientedHeight: DWord; y: integer; x: Integer; StripOffsets: TTiffWriteStripOffsets; Row: DWord; BytesPerLine: DWord; StripBytes: DWord; Strip: PByte; Run: PByte; StripIndex: DWord; Col: TFPColor; Value: Integer; dx: Integer; dy: Integer; CurEntries: TFPList; StripCounts: TTiffWriteEntry; begin StripOffsets:=nil; Strip:=nil; IDF:=TTiffIDF.Create; try // add new list of entries CurEntries:=TFPList.Create; FEntries.Add(CurEntries); if Img.Extra[TiffPhotoMetric]='' then IDF.PhotoMetricInterpretation:=2 else begin IDF.PhotoMetricInterpretation:=StrToInt64Def(Img.Extra[TiffPhotoMetric],High(IDF.PhotoMetricInterpretation)); if SaveCMYKAsRGB and (IDF.PhotoMetricInterpretation=5) then IDF.PhotoMetricInterpretation:=2; end; if not (IDF.PhotoMetricInterpretation in [0,1,2]) then TiffError('PhotoMetricInterpretation="'+Img.Extra[TiffPhotoMetric]+'" not supported'); IDF.Artist:=Img.Extra[TiffArtist]; IDF.Copyright:=Img.Extra[TiffCopyright]; IDF.DocumentName:=Img.Extra[TiffDocumentName]; IDF.DateAndTime:=Img.Extra[TiffDateTime]; IDF.ImageDescription:=Img.Extra[TiffImageDescription]; IDF.Orientation:=StrToIntDef(Img.Extra[TiffOrientation],1); if not (IDF.Orientation in [1..8]) then IDF.Orientation:=1; IDF.ResolutionUnit:=StrToIntDef(Img.Extra[TiffResolutionUnit],2); if not (IDF.ResolutionUnit in [1..3]) then IDF.ResolutionUnit:=2; IDF.XResolution:=StrToTiffRationalDef(Img.Extra[TiffXResolution],TiffRational72); IDF.YResolution:=StrToTiffRationalDef(Img.Extra[TiffYResolution],TiffRational72); GrayBits:=StrToIntDef(Img.Extra[TiffGrayBits],8); RedBits:=StrToIntDef(Img.Extra[TiffRedBits],8); GreenBits:=StrToIntDef(Img.Extra[TiffGreenBits],8); BlueBits:=StrToIntDef(Img.Extra[TiffBlueBits],8); AlphaBits:=StrToIntDef(Img.Extra[TiffAlphaBits],8); ImgWidth:=Img.Width; ImgHeight:=Img.Height; Compression:=1; if IDF.Orientation in [1..4] then begin OrientedWidth:=ImgWidth; OrientedHeight:=ImgHeight; end else begin OrientedWidth:=ImgHeight; OrientedHeight:=ImgWidth; end; {$IFDEF VerboseTiffWriter} writeln('TFPWriterTiff.AddImage PhotoMetricInterpretation=',IDF.PhotoMetricInterpretation); writeln('TFPWriterTiff.AddImage ImageWidth=',ImgWidth,' ImageHeight=',ImgHeight); writeln('TFPWriterTiff.AddImage Orientation=',IDF.Orientation); writeln('TFPWriterTiff.AddImage ResolutionUnit=',IDF.ResolutionUnit); writeln('TFPWriterTiff.AddImage XResolution=',TiffRationalToStr(IDF.XResolution)); writeln('TFPWriterTiff.AddImage YResolution=',TiffRationalToStr(IDF.YResolution)); writeln('TFPWriterTiff.AddImage GrayBits=',GrayBits,' RedBits=',RedBits,' GreenBits=',GreenBits,' BlueBits=',BlueBits,' AlphaBits=',AlphaBits); writeln('TFPWriterTiff.AddImage Compression=',Compression); {$ENDIF} // required meta entries AddEntryShort(262,IDF.PhotoMetricInterpretation); AddEntryLong(256,ImgWidth); AddEntryLong(257,ImgHeight); AddEntryShort(259,Compression); AddEntryShort(274,IDF.Orientation); AddEntryShort(296,IDF.ResolutionUnit); AddEntryRational(282,IDF.XResolution); AddEntryRational(283,IDF.YResolution); case IDF.PhotoMetricInterpretation of 0,1: begin BitsPerSample[0]:=GrayBits; SamplesPerPixel:=1; end; 2: begin BitsPerSample[0]:=RedBits; BitsPerSample[1]:=GreenBits; BitsPerSample[2]:=BlueBits; SamplesPerPixel:=3; end; end; if AlphaBits>0 then begin BitsPerSample[SamplesPerPixel]:=AlphaBits; inc(SamplesPerPixel); // ExtraSamples AddEntryShort(338,2);// 2=unassociated alpha end; // BitsPerSample (required) AddEntry(258,3,SamplesPerPixel,@BitsPerSample[0],SamplesPerPixel*2); AddEntryShort(277,SamplesPerPixel); // RowsPerStrip (required) BitsPerPixel:=0; for i:=0 to SamplesPerPixel-1 do inc(BitsPerPixel,BitsPerSample[i]); BytesPerLine:=(BitsPerPixel*OrientedWidth+7) div 8; if OrientedWidth=0 then IDF.RowsPerStrip:=8 else IDF.RowsPerStrip:=8192 div BytesPerLine; if IDF.RowsPerStrip<1 then IDF.RowsPerStrip:=1; {$IFDEF VerboseTiffWriter} writeln('TFPWriterTiff.AddImage BitsPerPixel=',BitsPerPixel,' OrientedWidth=',OrientedWidth,' BytesPerLine=',BytesPerLine,' RowsPerStrip=',IDF.RowsPerStrip); {$ENDIF} AddEntryLong(278,IDF.RowsPerStrip); // optional entries if IDF.Artist<>'' then AddEntryString(315,IDF.Artist); if IDF.Copyright<>'' then AddEntryString(33432,IDF.Copyright); if IDF.DocumentName<>'' then AddEntryString(269,IDF.DocumentName); if IDF.DateAndTime<>'' then AddEntryString(306,IDF.DateAndTime); if IDF.ImageDescription<>'' then AddEntryString(270,IDF.ImageDescription); // StripOffsets: StripOffsets, StripByteCounts StripOffsets:=TTiffWriteStripOffsets.Create; AddEntry(StripOffsets); StripCounts:=TTiffWriteEntry.Create; StripCounts.Tag:=279; StripCounts.EntryType:=4; StripOffsets.StripByteCounts:=StripCounts; AddEntry(StripCounts); if OrientedHeight>0 then begin StripOffsets.SetCount((OrientedHeight+IDF.RowsPerStrip-1) div IDF.RowsPerStrip); // compute StripOffsets Row:=0; StripIndex:=0; dx:=0; dy:=0; for y:=0 to OrientedHeight-1 do begin if Row=0 then begin // allocate Strip for the next rows StripBytes:=Min(IDF.RowsPerStrip,OrientedHeight-y)*BytesPerLine; //writeln('TFPWriterTiff.AddImage StripIndex=',StripIndex,' StripBytes=',StripBytes); GetMem(Strip,StripBytes); FillByte(Strip^,StripBytes,0); StripOffsets.Strips[StripIndex].Data:=Strip; StripOffsets.Strips[StripIndex].Bytes:=StripBytes; inc(StripIndex); Run:=Strip; end; // write line for x:=0 to OrientedWidth-1 do begin // Orientation case IDF.Orientation of 1: begin dx:=x; dy:=y; end;// 0,0 is left, top 2: begin dx:=OrientedWidth-x-1; dy:=y; end;// 0,0 is right, top 3: begin dx:=OrientedWidth-x-1; dy:=OrientedHeight-y-1; end;// 0,0 is right, bottom 4: begin dx:=x; dy:=OrientedHeight-y; end;// 0,0 is left, bottom 5: begin dx:=y; dy:=x; end;// 0,0 is top, left (rotated) 6: begin dx:=OrientedHeight-y-1; dy:=x; end;// 0,0 is top, right (rotated) 7: begin dx:=OrientedHeight-y-1; dy:=OrientedWidth-x-1; end;// 0,0 is bottom, right (rotated) 8: begin dx:=y; dy:=OrientedWidth-x-1; end;// 0,0 is bottom, left (rotated) end; Col:=Img.Colors[dx,dy]; case IDF.PhotoMetricInterpretation of 0,1: begin // grayscale Value:=(DWord(Col.red)+Col.green+Col.blue) div 3; if IDF.PhotoMetricInterpretation=0 then Value:=$ffff-Value;// 0 is white if GrayBits=8 then begin Run^:=Value shr 8; inc(Run); end else if GrayBits=16 then begin PWord(Run)^:=Value; inc(Run,2); end; if AlphaBits=8 then begin Run^:=Col.alpha shr 8; inc(Run); end else if AlphaBits=16 then begin PWord(Run)^:=Col.alpha; inc(Run,2); end; end; 2: begin // RGB if RedBits=8 then begin Run^:=Col.red shr 8; inc(Run); end else if RedBits=16 then begin PWord(Run)^:=Col.red; inc(Run,2); end; if GreenBits=8 then begin Run^:=Col.green shr 8; inc(Run); end else if GreenBits=16 then begin PWord(Run)^:=Col.green; inc(Run,2); end; if BlueBits=8 then begin Run^:=Col.blue shr 8; inc(Run); end else if BlueBits=16 then begin PWord(Run)^:=Col.blue; inc(Run,2); end; if AlphaBits=8 then begin Run^:=Col.alpha shr 8; inc(Run); end else if AlphaBits=16 then begin PWord(Run)^:=Col.alpha; inc(Run,2); end; end; end; end; // next row inc(Row); if (Row=IDF.RowsPerStrip) then Row:=0; end; end; CurEntries.Sort(@CompareTiffWriteEntries); finally IDF.Free; end; end; procedure TFPWriterTiff.SaveToStream(Stream: TStream); begin fStartPos:=Stream.Position; // simulate write to compute offsets fStream:=nil; WriteTiff; // write to stream fStream:=Stream; WriteTiff; fStream:=nil; end; procedure TFPWriterTiff.InternalWrite(Stream: TStream; Img: TFPCustomImage); begin AddImage(Img); SaveToStream(Stream); end; procedure TFPWriterTiff.AddEntryString(Tag: word; const s: string); begin if s<>'' then AddEntry(Tag,2,length(s)+1,@s[1],length(s)+1) else AddEntry(Tag,2,0,nil,0); end; procedure TFPWriterTiff.AddEntryShort(Tag: word; Value: Word); begin AddEntry(Tag,3,1,@Value,2); end; procedure TFPWriterTiff.AddEntryLong(Tag: word; Value: DWord); begin AddEntry(Tag,4,1,@Value,4); end; procedure TFPWriterTiff.AddEntryRational(Tag: word; const Value: TTiffRational ); begin AddEntry(Tag,5,1,@Value,8); end; procedure TFPWriterTiff.AddEntry(Tag: Word; EntryType: Word; EntryCount: DWord; Data: Pointer; Bytes: DWord; CopyData: boolean); var Entry: TTiffWriteEntry; begin Entry:=TTiffWriteEntry.Create; Entry.Tag:=Tag; Entry.EntryType:=EntryType; Entry.Count:=EntryCount; if CopyData then begin if Bytes>0 then begin GetMem(Entry.Data,Bytes); System.Move(Data^,Entry.Data^,Bytes); end else begin Entry.Data:=nil; end; end else Entry.Data:=Data; Entry.Bytes:=Bytes; AddEntry(Entry); end; procedure TFPWriterTiff.AddEntry(Entry: TTiffWriteEntry); var List: TFPList; begin List:=TFPList(FEntries[FEntries.Count-1]); List.Add(Entry); end; procedure TFPWriterTiff.TiffError(Msg: string); begin raise Exception.Create('TFPWriterTiff.TiffError: '+Msg); end; constructor TFPWriterTiff.Create; begin inherited Create; FEntries:=TFPList.Create; FSaveCMYKAsRGB:=true; end; destructor TFPWriterTiff.Destroy; begin Clear; FreeAndNil(FEntries); inherited Destroy; end; procedure TFPWriterTiff.Clear; begin ClearEntries; end; { TTiffWriteEntry } destructor TTiffWriteEntry.Destroy; begin ReAllocMem(Data,0); inherited Destroy; end; { TTiffWriteStripOffsets } constructor TTiffWriteStripOffsets.Create; begin Tag:=273; EntryType:=4; end; destructor TTiffWriteStripOffsets.Destroy; var i: Integer; begin if Strips<>nil then begin for i:=0 to Count-1 do ReAllocMem(Strips[i].Data,0); ReAllocMem(Strips,0); end; inherited Destroy; end; procedure TTiffWriteStripOffsets.SetCount(NewCount: DWord); var Size: DWord; begin {$IFDEF VerboseTiffWriter} writeln('TTiffWriteStripOffsets.SetCount OldCount=',Count,' NewCount=',NewCount); {$ENDIF} Count:=NewCount; Size:=Count*SizeOf(TTiffWriteStrip); ReAllocMem(Strips,Size); if Size>0 then FillByte(Strips^,Size,0); Size:=Count*SizeOf(DWord); // StripOffsets ReAllocMem(Data,Size); if Size>0 then FillByte(Data^,Size,0); Bytes:=Size; // StripByteCounts ReAllocMem(StripByteCounts.Data,Size); if Size>0 then FillByte(StripByteCounts.Data^,Size,0); StripByteCounts.Count:=Count; StripByteCounts.Bytes:=Size; end; end.
unit Translate2TextTest; {* Преобразовать таблицу или её часть в текст } // Модуль: "w:\common\components\rtl\Garant\Daily\Translate2TextTest.pas" // Стереотип: "TestCase" // Элемент модели: "TTranslate2TextTest" MUID: (4C3463D800E5) {$Include w:\common\components\rtl\Garant\Daily\TestDefine.inc.pas} interface {$If Defined(nsTest) AND NOT Defined(NoScripts)} uses l3IntfUses , TableToolsTest , evEditorInterfaces ; type TTranslate2TextTest = {abstract} class(TTableToolsTest) {* Преобразовать таблицу или её часть в текст } protected {$If NOT Defined(NoVCM)} procedure ApplyTools(const aRange: IedRange); override; {* Вызвать инструмент для таблицы } {$IfEnd} // NOT Defined(NoVCM) function GetFolder: AnsiString; override; {* Папка в которую входит тест } function GetModelElementGUID: AnsiString; override; {* Идентификатор элемента модели, который описывает тест } end;//TTranslate2TextTest {$IfEnd} // Defined(nsTest) AND NOT Defined(NoScripts) implementation {$If Defined(nsTest) AND NOT Defined(NoScripts)} uses l3ImplUses , TestFrameWork , evMsgCode , evOp {$If Defined(k2ForEditor)} , evCursorTools {$IfEnd} // Defined(k2ForEditor) {$If NOT Defined(NoVCM)} , vcmBase {$IfEnd} // NOT Defined(NoVCM) , SysUtils {$If NOT Defined(NoVCL)} , Forms {$IfEnd} // NOT Defined(NoVCL) , l3Base //#UC START# *4C3463D800E5impl_uses* //#UC END# *4C3463D800E5impl_uses* ; {$If NOT Defined(NoVCM)} procedure TTranslate2TextTest.ApplyTools(const aRange: IedRange); {* Вызвать инструмент для таблицы } //#UC START# *4C345B580083_4C3463D800E5_var* //#UC END# *4C345B580083_4C3463D800E5_var* begin //#UC START# *4C345B580083_4C3463D800E5_impl* aRange.Table.Cells.Translate2Text; //#UC END# *4C345B580083_4C3463D800E5_impl* end;//TTranslate2TextTest.ApplyTools {$IfEnd} // NOT Defined(NoVCM) function TTranslate2TextTest.GetFolder: AnsiString; {* Папка в которую входит тест } begin Result := 'EditorTests'; end;//TTranslate2TextTest.GetFolder function TTranslate2TextTest.GetModelElementGUID: AnsiString; {* Идентификатор элемента модели, который описывает тест } begin Result := '4C3463D800E5'; end;//TTranslate2TextTest.GetModelElementGUID {$IfEnd} // Defined(nsTest) AND NOT Defined(NoScripts) end.
unit UWIZOperationFee_Custom; {$mode delphi} {$modeswitch nestedprocvars} { Copyright (c) 2018 Sphere 10 Software (http://www.sphere10.com/) Distributed under the MIT software license, see the accompanying file LICENSE or visit http://www.opensource.org/licenses/mit-license.php. Acknowledgements: Ugochukwu Mmaduekwe - main developer Herman Schoenfeld - designer } interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Buttons, Spin, UCommon, UCommon.Collections, UWallet, UCoreObjects, UFRMAccountSelect, UNode, UWizard, UWIZOperationPayload_Encryption, UWIZOperationSigner_Select; type { TWIZOperationFee_Custom } TWIZOperationFee_Custom = class(TWizardForm<TExecuteOperationsModel>) fseFee: TFloatSpinEdit; gbTransactionFee: TGroupBox; lblestimatedfee: TLabel; lblPASC: TLabel; lblNote1: TLabel; lblNote2: TLabel; lblTotalFeeValue: TLabel; procedure UpdateUI(); procedure fseFeeChange(Sender: TObject); public procedure OnPresent; override; procedure OnNext; override; function Validate(out message: ansistring): boolean; override; end; implementation {$R *.lfm} uses UAccounts, UCoreUtils, UUserInterface, USettings; { TWIZOperationFee_Custom } procedure TWIZOperationFee_Custom.UpdateUI(); var LOperationFee: int64; begin TAccountComp.TxtToMoney(Trim(fseFee.ValueToStr(fseFee.Value)), LOperationFee); lblTotalFeeValue.Caption := Format('%s PASC', [TAccountComp.FormatMoney(LOperationFee * Length(Model.Account.SelectedAccounts))]); end; procedure TWIZOperationFee_Custom.fseFeeChange(Sender: TObject); begin UpdateUI(); end; procedure TWIZOperationFee_Custom.OnPresent; begin UpdateUI(); fseFee.SetFocus; end; procedure TWIZOperationFee_Custom.OnNext; begin if Model.Payload.HasPayload then UpdatePath(ptInject, [TWIZOperationPayload_Encryption]) else if Length(Model.Account.SelectedAccounts) > 1 then UpdatePath(ptInject, [TWIZOperationSigner_Select]) else begin Model.Signer.SignerAccount := Model.Account.SelectedAccounts[0]; Model.Signer.OperationSigningMode := akaPrimary; end; end; function TWIZOperationFee_Custom.Validate(out message: ansistring): boolean; var LOperationFee: int64; LAccount: TAccount; begin Result := True; if not TAccountComp.TxtToMoney(Trim(fseFee.ValueToStr(fseFee.Value)), LOperationFee) then begin message := Format('Invalid Fee Value "%s"', [fseFee.ValueToStr(fseFee.Value)]); Result := False; Exit; end; Model.Fee.SingleOperationFee := LOperationFee; if Length(Model.Account.SelectedAccounts) > 1 then if not (Model.Fee.SingleOperationFee > 0) then begin message := 'Zero Fee Is Only Allowed For Single Operations.'; Result := False; Exit; end; // get signer accounts from selected accounts Model.Signer.SignerCandidates := TCoreTool.GetSignerCandidates(Length(Model.Account.SelectedAccounts), Model.Fee.SingleOperationFee, Model.Account.SelectedAccounts); if Length(Model.Signer.SignerCandidates) < 1 then begin message := 'No Valid Signer Account Was Found With The Current Requirements.'; Result := False; Exit; end; end; end.
(* * TASK #2 - Summations * * GUEST LANGUAGE: THIS IS THE C VERSION OF ch-2.pl, suitable for * the Free Pascal compiler. *) uses sysutils; const maxints = 256; type intarray = array [0..maxints-1] of integer; var debug : boolean; (* process_args( nel, v ); * Process command line arguments, * specifically process the -d flag, * set nel to the number of remaining arguments, * check that all those remaining arguments are +ve numbers, * copy remaining args to a new integer array v. *) procedure process_args( var nel : integer; var v : intarray ); (* note: paramStr(i)); for i in 1 to paramCount() *) var nparams : integer; arg : integer; i : integer; p : string; begin nparams := paramCount(); arg := 1; if (nparams>0) and SameText( paramStr(arg), '-d' ) then begin debug := true; arg := 2; end; nel := 1+nparams-arg; if nel < 2 then begin writeln( stderr, 'Usage: summations [-d] list of +ve numbers' ); halt; end; if nel > maxints then begin writeln( stderr, 'summations too many numbers (max ', maxints, ')' ); halt; end; if debug then begin writeln( 'debug: arg', arg, ', nparams=', nparams, ', nel=', nel ); end; // elements are in argv[arg..nparams], copy them to v[] // check that all remaining arguments are +ve integers, // and then copy them to v[] for i := arg to nparams do begin p := paramStr(i); if (p[1] < '0') or (p[1] > '9') then begin writeln( stderr, 'summations arg ', i, ' (', p, ') is not a +ve number' ); halt; end; v[i-arg] := StrToInt( p ); end; end; procedure main; var nel : integer; v : intarray; r, i : integer; pos : integer; begin debug := false; process_args( nel, v ); r := 1; if debug then begin write( 'row ', r, ':' ); for i := 0 to nel-1 do begin write( ' ', v[i] ); end; writeln; end; while nel > 1 do begin // shift v array down for i := 0 to nel-1 do begin v[i] := v[i+1]; end; v[nel-1] := -1; nel := nel - 1; for pos := 1 to nel-1 do begin v[pos] += v[pos-1]; end; r := r+1; if debug then begin write( 'row ', r, ':' ); for i := 0 to nel-1 do begin write( ' ', v[i] ); end; writeln; end; end; writeln( v[0] ); end; begin main; end.
unit objItemPedido; interface uses System.SysUtils, FireDAC.Comp.Client, Vcl.Dialogs; type TItemPedido = class(TObject) private FnumeroPedido : Integer; FcodigoItem : Integer; Fquantidade : Integer; Fdesconto : Double; Fconexao : TFDConnection; FvalorTotal : Double; protected function getNumeroPedido: Integer; function getCodigoItem: Integer; function getQuantidade: Integer; function getDesconto: Double; function getValorTotal: Double; procedure setNumeroPedido(const Value: Integer); procedure setCodigoItem(const Value: Integer); procedure setQuantidade(const Value: Integer); procedure setDesconto(const Value: Double); procedure setValorTotal(const Value: Double); public property numeroPedido : Integer read getNumeroPedido write setNumeroPedido; property codigoItem : Integer read getCodigoItem write setCodigoItem; property quantidade : Integer read getQuantidade write setQuantidade; property desconto : Double read getDesconto write setDesconto; property valorTotal : Double read getValorTotal write setValorTotal; function Salvar : Boolean; function Editar : Boolean; function Excluir : Boolean; function ExcluirItensPorPedido : Boolean; function PossuiItens : Boolean; function RetornaValorBruto : Double; function RetornaValorDesconto : Double; function RetornaValorLiquido : Double; function ItemExistenteNoPedido : Boolean; procedure CarregarItensPedido(var quItensPedido : TFDQuery); constructor Create(objConexao : TFDConnection); destructor Destroy; end; implementation { TItemPedido } function TItemPedido.getCodigoItem: Integer; begin result := FcodigoItem; end; function TItemPedido.getDesconto: Double; begin result := Fdesconto; end; function TItemPedido.getNumeroPedido: Integer; begin result := FnumeroPedido; end; function TItemPedido.getQuantidade: Integer; begin result := Fquantidade; end; function TItemPedido.getValorTotal: Double; begin result := FvalorTotal; end; procedure TItemPedido.setCodigoItem(const Value: Integer); begin FcodigoItem := Value; end; procedure TItemPedido.setDesconto(const Value: Double); begin Fdesconto := Value; end; procedure TItemPedido.setNumeroPedido(const Value: Integer); begin FnumeroPedido := Value; end; procedure TItemPedido.setQuantidade(const Value: Integer); begin Fquantidade := Value; end; procedure TItemPedido.setValorTotal(const Value: Double); begin FvalorTotal := Value; end; procedure TItemPedido.CarregarItensPedido(var quItensPedido: TFDQuery); begin try quItensPedido.Close; quItensPedido.SQL.Clear; quItensPedido.SQL.Add('SELECT ITPED.NUMEROPEDIDO, ITPED.CODIGOITEM, ITPED.QUANTIDADE, ITPED.DESCONTO,'); quItensPedido.SQL.Add(' ITEM.VALOR AS VALORITEM, ITPED.VALORTOTAL, ITEM.DESCRICAO'); quItensPedido.SQL.Add('FROM ITENSPEDIDO ITPED'); quItensPedido.SQL.Add(' INNER JOIN ITENS ITEM ON ITEM.CODIGO = ITPED.CODIGOITEM'); quItensPedido.SQL.Add('WHERE NUMEROPEDIDO = :NUMEROPEDIDO'); quItensPedido.SQL.Add('ORDER BY CODIGOITEM'); quItensPedido.Params.ParamByName('NUMEROPEDIDO').AsInteger := numeroPedido; quItensPedido.Open; except on e:Exception do ShowMessage('Erro ao carregar itens do pedido!' + #13 + 'Erro: ' + e.Message); end; end; constructor TItemPedido.Create(objConexao: TFDConnection); begin inherited Create; Fconexao := objConexao; end; destructor TItemPedido.Destroy; begin inherited; end; function TItemPedido.Salvar: Boolean; var quInserir : TFDQuery; begin try result := False; quInserir := TFDQuery.Create(nil); quInserir.Connection := Fconexao; try quInserir.Close; quInserir.SQL.Clear; quInserir.SQL.Add('INSERT INTO ITENSPEDIDO ( NUMEROPEDIDO, CODIGOITEM, QUANTIDADE, DESCONTO, VALORTOTAL)'); quInserir.SQL.Add('VALUES (:NUMEROPEDIDO, :CODIGOITEM, :QUANTIDADE, :DESCONTO, :VALORTOTAL)'); quInserir.Params.ParamByName('NUMEROPEDIDO').AsInteger := numeroPedido; quInserir.Params.ParamByName('CODIGOITEM').AsInteger := codigoItem; quInserir.Params.ParamByName('QUANTIDADE').AsInteger := quantidade; quInserir.Params.ParamByName('DESCONTO').AsFloat := desconto; quInserir.Params.ParamByName('VALORTOTAL').AsFloat := valorTotal; quInserir.ExecSQL; if quInserir.RowsAffected < 1 then raise Exception.Create('Item do pedido não inserido.'); result := True; except on e:Exception do raise Exception.Create(e.Message); end; finally quInserir.Close; FreeAndNil(quInserir); end; end; function TItemPedido.Editar: Boolean; var quEditar : TFDQuery; begin try result := False; quEditar := TFDQuery.Create(nil); quEditar.Connection := Fconexao; try quEditar.Close; quEditar.SQL.Clear; quEditar.SQL.Add('UPDATE ITENSPEDIDO'); quEditar.SQL.Add('SET QUANTIDADE = :QUANTIDADE,'); quEditar.SQL.Add(' DESCONTO = :DESCONTO,'); quEditar.SQL.Add(' VALORTOTAL = :VALORTOTAL'); quEditar.SQL.Add('WHERE NUMEROPEDIDO = :NUMEROPEDIDO'); quEditar.SQL.Add('AND CODIGOITEM = :CODIGOITEM'); quEditar.Params.ParamByName('QUANTIDADE').AsInteger := quantidade; quEditar.Params.ParamByName('DESCONTO').AsFloat := desconto; quEditar.Params.ParamByName('VALORTOTAL').AsFloat := valorTotal; quEditar.Params.ParamByName('NUMEROPEDIDO').AsInteger := numeroPedido; quEditar.Params.ParamByName('CODIGOITEM').AsInteger := codigoItem; quEditar.ExecSQL; if quEditar.RowsAffected < 1 then raise Exception.Create('Item do pedido não alterado.'); result := True; except on e:Exception do raise Exception.Create(e.Message); end; finally quEditar.Close; FreeAndNil(quEditar); end; end; function TItemPedido.Excluir: Boolean; var quExcluir : TFDQuery; begin try result := False; quExcluir := TFDQuery.Create(nil); quExcluir.Connection := Fconexao; try quExcluir.Close; quExcluir.SQL.Clear; quExcluir.SQL.Add('DELETE FROM ITENSPEDIDO'); quExcluir.SQL.Add('WHERE NUMEROPEDIDO = :NUMEROPEDIDO'); quExcluir.SQL.Add('AND CODIGOITEM = :CODIGOITEM'); quExcluir.Params.ParamByName('NUMEROPEDIDO').AsInteger := numeroPedido; quExcluir.Params.ParamByName('CODIGOITEM').AsInteger := codigoItem; quExcluir.ExecSQL; if quExcluir.RowsAffected < 1 then raise Exception.Create('Item do pedido não excluído.'); result := True; except on e:Exception do raise Exception.Create(e.Message); end; finally quExcluir.Close; FreeAndNil(quExcluir); end; end; function TItemPedido.ExcluirItensPorPedido: Boolean; var quExcluir : TFDQuery; begin try result := False; quExcluir := TFDQuery.Create(nil); quExcluir.Connection := Fconexao; try quExcluir.Close; quExcluir.SQL.Clear; quExcluir.SQL.Add('DELETE FROM ITENSPEDIDO'); quExcluir.SQL.Add('WHERE NUMEROPEDIDO = :NUMEROPEDIDO'); quExcluir.Params.ParamByName('NUMEROPEDIDO').AsInteger := numeroPedido; quExcluir.ExecSQL; if quExcluir.RowsAffected < 1 then raise Exception.Create('Itens do pedido não excluídos.'); result := True; except on e:Exception do raise Exception.Create(e.Message); end; finally quExcluir.Close; FreeAndNil(quExcluir); end; end; function TItemPedido.PossuiItens: Boolean; var quItensPedido : TFDQuery; begin try quItensPedido := TFDQuery.Create(nil); quItensPedido.Connection := Fconexao; try result := false; quItensPedido.Close; quItensPedido.SQL.Clear; quItensPedido.SQL.Add('SELECT CODIGOITEM'); quItensPedido.SQL.Add('FROM ITENSPEDIDO'); quItensPedido.SQL.Add('WHERE NUMEROPEDIDO = :NUMEROPEDIDO'); quItensPedido.Params.ParamByName('NUMEROPEDIDO').AsInteger := numeroPedido; quItensPedido.Open; if not quItensPedido.Eof then result := true; except on e:Exception do raise Exception.Create(e.Message); end; finally quItensPedido.Close; FreeAndNil(quItensPedido); end; end; function TItemPedido.RetornaValorBruto: Double; var quValorBruto : TFDQuery; begin try result := 0; quValorBruto := TFDQuery.Create(nil); quValorBruto.Connection := Fconexao; try quValorBruto.Close; quValorBruto.SQL.Clear; quValorBruto.SQL.Add('SELECT IFNULL(SUM(ITEM.VALOR * ITPED.QUANTIDADE), 0) AS VALORBRUTO'); quValorBruto.SQL.Add('FROM ITENSPEDIDO ITPED'); quValorBruto.SQL.Add(' INNER JOIN ITENS ITEM ON ITEM.CODIGO = ITPED.CODIGOITEM'); quValorBruto.SQL.Add('WHERE ITPED.NUMEROPEDIDO = :NUMEROPEDIDO'); quValorBruto.Params.ParamByName('NUMEROPEDIDO').AsInteger := numeroPedido; quValorBruto.Open; if not quValorBruto.Eof then result := quValorBruto.FieldByName('VALORBRUTO').AsFloat; except on e:Exception do raise Exception.Create(e.Message); end; finally quValorBruto.Close; FreeAndNil(quValorBruto); end; end; function TItemPedido.RetornaValorDesconto: Double; var quValorDesconto : TFDQuery; begin try result := 0; quValorDesconto := TFDQuery.Create(nil); quValorDesconto.Connection := Fconexao; try quValorDesconto.Close; quValorDesconto.SQL.Clear; quValorDesconto.SQL.Add('SELECT IFNULL(SUM(DESCONTO), 0) DESCONTO'); quValorDesconto.SQL.Add('FROM ITENSPEDIDO'); quValorDesconto.SQL.Add('WHERE NUMEROPEDIDO = :NUMEROPEDIDO'); quValorDesconto.Params.ParamByName('NUMEROPEDIDO').AsInteger := numeroPedido; quValorDesconto.Open; if not quValorDesconto.Eof then result := quValorDesconto.FieldByName('DESCONTO').AsFloat; except on e:Exception do raise Exception.Create(e.Message); end; finally quValorDesconto.Close; FreeAndNil(quValorDesconto); end; end; function TItemPedido.RetornaValorLiquido: Double; var quValorLiquido : TFDQuery; begin try result := 0; quValorLiquido := TFDQuery.Create(nil); quValorLiquido.Connection := Fconexao; try quValorLiquido.Close; quValorLiquido.SQL.Clear; quValorLiquido.SQL.Add('SELECT IFNULL(SUM(VALORTOTAL), 0) AS VALORTOTAL'); quValorLiquido.SQL.Add('FROM ITENSPEDIDO'); quValorLiquido.SQL.Add('WHERE NUMEROPEDIDO = :NUMEROPEDIDO'); quValorLiquido.Params.ParamByName('NUMEROPEDIDO').AsInteger := numeroPedido; quValorLiquido.Open; if not quValorLiquido.Eof then result := quValorLiquido.FieldByName('VALORTOTAL').AsFloat; except on e:Exception do raise Exception.Create(e.Message); end; finally quValorLiquido.Close; FreeAndNil(quValorLiquido); end; end; function TItemPedido.ItemExistenteNoPedido: Boolean; var quItemExistente : TFDQuery; begin try result := False; quItemExistente := TFDQuery.Create(nil); quItemExistente.Connection := Fconexao; try quItemExistente.Close; quItemExistente.SQL.Clear; quItemExistente.SQL.Add('SELECT CODIGOITEM'); quItemExistente.SQL.Add('FROM ITENSPEDIDO'); quItemExistente.SQL.Add('WHERE NUMEROPEDIDO = :NUMEROPEDIDO'); quItemExistente.SQL.Add('AND CODIGOITEM = :CODIGOITEM'); quItemExistente.Params.ParamByName('NUMEROPEDIDO').AsInteger := numeroPedido; quItemExistente.Params.ParamByName('CODIGOITEM').AsInteger := codigoItem; quItemExistente.Open; if not quItemExistente.Eof then result := True; except on e:Exception do raise Exception.Create(e.Message); end; finally quItemExistente.Close; FreeAndNil(quItemExistente); end; end; end.
unit IOUnit; {$Z4} //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Библиотека "GCI" // Модуль: "w:/shared/GCI/IOUnit.pas" // Delphi интерфейсы для адаптера (.pas) // Generated from UML model, root element: <<Interfaces::Category>> shared::GCI::IO // // пакет интерфейсов ввода-вывода // // // Все права принадлежат ООО НПП "Гарант-Сервис". // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// interface uses SysUtils ; type IString = interface; { - предварительное описание IString. } // Во время выполнения операции copy_to один из потоков, участвовавших в операции перешёл в // некорректное состояние. EOperationError = class (Exception); // функция не реализована ENotImplemented = class (Exception); // точка от которой считается смещение. Константы должны совпадать по значению с MSDN-овскими PStreamSeekDirection = ^TStreamSeekDirection; TStreamSeekDirection = ( SSD_BEGIN // смещение относительно начала потока , SSD_CURRENT // смещение относительнотекущей позиции в потоке , SSD_END // смещение относительно конца потока ); // для универсальной передачи времени между разными языками, платформами. PDateTimeBox = ^TDateTimeBox; TDateTimeBox = packed record rDay: Smallint; // день в месяце (1-31) rMounth: Smallint; // месяц в году (1-12) rYear: Smallint; // год rHour: Smallint; // час (0-23) rMinute: Smallint; // минута в часе (0-59) rSecond: Smallint; // секунда в минуте (0-59) rMillisecond: Smallint; // миллисекунды (0-999) end; // Интерфейс для работы со строками. Предпочтительно использовать именно этот тип для работы со // всеми строковыми данными. IString = interface (IInterface) ['{952E8D0E-1685-49D2-BFDB-D854F4BF0156}'] function DontUseMe: Pointer; // добавляет к строке переданную подстроку, возвращает указатель на свой буфер function Add ( const aStr: PAnsiChar ): PAnsiChar; overload; stdcall; // добавляет к строке переданную подстроку, возвращает указатель на свой буфер function Add ( const aStr: IString ): PAnsiChar; overload; stdcall; // кодовая страница function GetCodePage (): Smallint; stdcall; procedure SetCodePage (aCodePage: Smallint); stdcall; // указатель на начало аллоцированного буфера (строки) function GetData (): PAnsiChar; stdcall; // длинна текстовой строки function GetLength (): Longword; stdcall; // размер аллоцированого буфера, для хранения текстовой строки function GetMaximum (): Longword; stdcall; procedure SetMaximum (aMaximum: Longword); stdcall; // устанавливает значение строки равное переданному (переданная строка копируеться) procedure Reset ( const aStr: PAnsiChar ); overload; stdcall; // возвращает бинарную копию строки procedure Strdup ( out aRet {: IString} ); stdcall; end; // Интерфейс для работы с потоком // Stream - must be native for DLL outside implementation end.
// Author : Thierry Parent // Version : 12.4 // // HomePage : http://www.codeproject.com/csharp/TraceTool.asp // Download : http://sourceforge.net/projects/tracetool/ // See License.txt for license informationunit unt_XTraceOptions; unit unt_XTraceTable; {$WARN SYMBOL_PLATFORM OFF} interface uses Classes , ComObj, ActiveX, TraceToolCom_TLB, StdVcl, tracetool ; type TXTraceTable = class(TAutoObject, IXTraceTable) protected function Get_RowCount: Integer; safecall; function GetRowData(Row: Integer): WideString; safecall; function GetTitle: WideString; safecall; procedure AddColumnTitle(const ColTitle: WideString); safecall; procedure AddRow; safecall; procedure AddRowData(const Cell: WideString); safecall; private fRows : TStringList ; fCurrentRow : integer ; fTitle : string ; public constructor Create; destructor Destroy; override ; end; implementation uses ComServ; //------------------------------------------------------------------------------ constructor TXTraceTable.create(); begin inherited create(); // TComObject.Create fRows := TStringList.create() ; fCurrentRow := -1 ; end; //------------------------------------------------------------------------------ destructor TXTraceTable.destroy; begin inherited Destroy() ; // TComObject.Destroy fRows.free ; fRows := nil ; end; //------------------------------------------------------------------------------ procedure TXTraceTable.AddColumnTitle(const ColTitle: WideString); begin if fTitle = '' then fTitle := ColTitle else fTitle := fTitle + #9 + ColTitle ; end; //------------------------------------------------------------------------------ procedure TXTraceTable.AddRow; begin fCurrentRow := fRows.Add('') ; end; //------------------------------------------------------------------------------ procedure TXTraceTable.AddRowData(const Cell: WideString); var currentRowString : string ; begin if fCurrentRow = -1 then AddRow() ; currentRowString := fRows.Strings[fCurrentRow] ; if currentRowString = '' then fRows.Strings[fCurrentRow] := cell else fRows.Strings[fCurrentRow] := currentRowString + #9 + cell ; end; //------------------------------------------------------------------------------ function TXTraceTable.Get_RowCount: Integer; begin result := fRows.Count ; end; //------------------------------------------------------------------------------ function TXTraceTable.GetRowData(Row: Integer): WideString; begin if row < fRows.count then result := fRows.Strings[Row] ; end; //------------------------------------------------------------------------------ function TXTraceTable.GetTitle: WideString; begin result := fTitle ; end; //------------------------------------------------------------------------------ initialization TAutoObjectFactory.Create(ComServer, TXTraceTable, Class_XTraceTable, ciSingleInstance, tmFree); end.
unit CacheManagerAuto; interface uses Windows, ActiveX, ComObj, CacheManager_TLB, CacheObjects, CacheManagerRDO; type TCacheManagerAuto = class(TAutoObject, ICacheManagerAuto) protected function ContainsFolder(const Name: WideString): WordBool; safecall; function GetFolderIterator(const Folder: WideString): OleVariant; safecall; function GetPath: WideString; safecall; function SetClass(const Name: WideString): WordBool; safecall; function SetObject(X, Y: Integer): WordBool; safecall; function SetObjectOfWorld(X, Y: Integer; const World: WideString): WordBool; safecall; function SetPath(const aPath: WideString): WordBool; safecall; function SetWorld(const Name: WideString): WordBool; safecall; procedure CreateFolder(const Name: WideString); safecall; procedure CreateObject(const aPath: WideString); safecall; procedure Flush; safecall; private fWorldName : string; fProxy : TWorldRDO; fPropertyName : string; fCachedObject : TCachedObject; fPath : string; private function GetIDsOfNames(const IID : TGUID; Names : Pointer; NameCount, LocaleID : Integer; DispIDs : Pointer) : HResult; override; stdcall; function Invoke(DispID : Integer; const IID : TGUID; LocaleID : Integer; Flags : Word; var Params; VarResult, ExcepInfo, ArgErr : Pointer) : HResult; override; stdcall; function SetToObject(const aPath : string): WordBool; safecall; function RequestCache(Id : string) : string; function UpdateCache (Id : string) : boolean; public destructor Destroy; override; end; implementation uses Classes, SysUtils, ComServ, FolderIteratorAuto, CacheCommon, RegistryData, CacheNameUtils; const NormalDispId = $100; // TCacheProxyAuto function TCacheManagerAuto.GetIDsOfNames(const IID : TGUID; Names : Pointer; NameCount, LocaleID : Integer; DispIDs : Pointer) : HResult; begin if inherited GetIDsOfNames( IID, Names, NameCount, LocaleID, DispIDs ) = S_OK then result := S_OK else if fCachedObject <> nil then begin fPropertyName := POLEStrList(Names)^[0]; PInteger(DispIds)^ := NormalDispId; result := S_OK; end else result := DISP_E_UNKNOWNNAME; end; function TCacheManagerAuto.Invoke(DispID : Integer; const IID : TGUID; LocaleID : Integer; Flags : Word; var Params; VarResult, ExcepInfo, ArgErr : Pointer) : HResult; var Parameters : TDispParams; ParamValue : OleVariant; PropValue : string; IndexValue : OleVariant; begin if DispId = NormalDispId then try Parameters := TDispParams(Params); if (Flags and DISPATCH_PROPERTYGET <> 0) or (Flags and DISPATCH_METHOD <> 0) then if VarResult <> nil then case Parameters.cArgs of 0 : begin PropValue := fCachedObject.Properties[fPropertyName]; PVariant(VarResult)^ := PropValue; result := S_OK; end; 1 : begin VariantInit( ParamValue ); VariantChangeType( ParamValue, OleVariant(Parameters.rgvarg[0]), 0, VT_BSTR ); PropValue := fCachedObject.Properties[fPropertyName + ParamValue]; PVariant(VarResult)^ := PropValue; result := S_OK; end; else result := DISP_E_BADPARAMCOUNT; end else result := DISP_E_MEMBERNOTFOUND else if (Parameters.cNamedArgs = 1) and (Parameters.rgdispidNamedArgs[0] = DISPID_PROPERTYPUT) then case Parameters.cArgs of 1 : begin VariantInit( ParamValue ); VariantChangeType( ParamValue, OleVariant(Parameters.rgvarg[0]), 0, VT_BSTR ); fCachedObject.Properties[fPropertyName] := ParamValue; result := S_OK; end; 2 : begin VariantInit( ParamValue ); VariantChangeType( ParamValue, OleVariant(Parameters.rgvarg[0]), 0, VT_BSTR ); VariantInit(IndexValue); VariantChangeType( IndexValue, OleVariant(Parameters.rgvarg[1]), 0, VT_BSTR ); fCachedObject.Properties[fPropertyName + IndexValue] := ParamValue; result := S_OK; end; else result := DISP_E_BADPARAMCOUNT end else Result := DISP_E_PARAMNOTOPTIONAL except result := DISP_E_EXCEPTION; end else result := inherited Invoke( DispID, IID, LocaleID, Flags, Params, VarResult, ExcepInfo, ArgErr ); end; function TCacheManagerAuto.SetToObject(const aPath : string): WordBool; procedure ReturnToPrevPath; begin if fPath <> '' then fCachedObject.SetPath( fPath ); end; var TTL : string; LastMod : string; AuxPath : string; begin AuxPath := aPath; if fCachedObject = nil then fCachedObject := TCachedObject.Open( AuxPath, true ) else fCachedObject.SetPath( AuxPath ); if not (ioFileDoesntExist in fCachedObject.IOResult) and not (ioTimeOutRead in fCachedObject.IOResult) then begin TTL := fCachedObject[ppTTL]; LastMod := fCachedObject[ppLastMod]; try if (TTL <> TTLNever) and (LastMod <> '') and (Now - StrToDateTime( LastMod ) > StrToDateTime( TTL )) then if UpdateCache( fCachedObject[ppObjId] ) then begin result := true; fPath := AuxPath; end else begin result := false; ReturnToPrevPath; end else result := true; fCachedObject.Unlock; except result := false; ReturnToPrevPath; end; end else begin result := false; ReturnToPrevPath; end; end; function TCacheManagerAuto.GetFolderIterator(const Folder: WideString): OleVariant; begin if fCachedObject <> nil then result := TFolderIteratorAuto.Assign( fCachedObject.GetFolderIterator( Folder )) as IDispatch else result := TFolderIteratorAuto.Assign( nil ) as IDispatch; end; function TCacheManagerAuto.GetPath : WideString; begin if fCachedObject <> nil then result := fCachedObject.Path else result := ''; end; function TCacheManagerAuto.SetPath(const aPath: WideString): WordBool; begin result := SetToObject( fWorldName + '\' + aPath ); end; function TCacheManagerAuto.ContainsFolder(const Name: WideString): WordBool; begin result := (fCachedObject <> nil) and fCachedObject.ContainsFolder( Name ); end; function TCacheManagerAuto.UpdateCache(Id : string) : boolean; var Cache : TStringList; Data : string; begin Data := RequestCache( Id ); if (Data <> '') or (Data <> resError) then begin Cache := TStringList.Create; Cache.Text := Data; fCachedObject.UpdateProperties( Cache ); fCachedObject.Properties[ppLastMod] := DateTimeToStr( Now ); result := true; end else result := true; end; procedure TCacheManagerAuto.CreateObject(const aPath: WideString); begin fCachedObject.Free; fCachedObject := TCachedObject.Create( aPath, nil ); end; procedure TCacheManagerAuto.Flush; begin if fCachedObject <> nil then fCachedObject.Flush; end; procedure TCacheManagerAuto.CreateFolder(const Name: WideString); begin if fCachedObject <> nil then fCachedObject.CreateFolder( Name ); end; function TCacheManagerAuto.RequestCache(Id : string) : string; begin if fProxy <> nil then result := fProxy.GetCache( StrToInt( Id ) ) else result := ''; end; function TCacheManagerAuto.SetClass(const Name: WideString) : WordBool; begin result := SetToObject( GetClassPath( Name ) ); end; function TCacheManagerAuto.SetObject(X, Y: Integer) : WordBool; var Path : string; WildCards : string; SearchRec : TSearchRec; begin try if fWorldName <> '' then begin Path := GetObjectFolder( fWorldName, X, Y ); WildCards := GetCoordWildCards( X, Y ); try if FindFirst( Path + WildCards, faArchive, SearchRec ) = 0 then begin Path := Copy( SearchRec.Name, length( WildCards ), length( SearchRec.Name ) - length( WildCards ) + 1 ); TranslateChars( Path, '×', '\' ); result := SetToObject( Path ); end else result := false; finally FindClose( SearchRec ); end; end else result := false; except result := false; end; end; function TCacheManagerAuto.SetWorld(const Name: WideString) : WordBool; begin try fProxy := GetWorldRDO( Name ); fWorldName := Name; result := true; fCachedObject.Free; fCachedObject := nil; except fProxy := nil; result := false; end; end; function TCacheManagerAuto.SetObjectOfWorld(X, Y: Integer; const World: WideString) : WordBool; begin result := SetWorld( World ) and SetObject( X, Y ); end; destructor TCacheManagerAuto.Destroy; begin fCachedObject.Free; fProxy.Free; inherited; end; initialization TAutoObjectFactory.Create( ComServer, TCacheManagerAuto, Class_CacheManagerAuto, ciMultiInstance ); end.
unit LisDiaCom; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, Mask, ComCtrls, DateUtils, JvToolEdit, JvBaseEdits, JvExMask, JvSpin; type TFLisDiaCom = class(TForm) Label7: TLabel; Label8: TLabel; GroupBox1: TGroupBox; lbFec: TLabel; Label9: TLabel; Label10: TLabel; bbFin: TBitBtn; bbImp: TBitBtn; ppVis: TBitBtn; FecIni: TDateTimePicker; FecFin: TDateTimePicker; Label5: TLabel; PagIni: TJvSpinEdit; btnEdiInf: TBitBtn; procedure ppVisClick(Sender: TObject); procedure bbImpClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure btnEdiInfClick(Sender: TObject); private FVisualiza: boolean; function Verifica: boolean; procedure SetVisualiza(const Value: boolean); { Private declarations } public { Public declarations } property Visualiza: boolean read FVisualiza write SetVisualiza; end; var FLisDiaCom: TFLisDiaCom; implementation uses LibroCompras; {$R *.DFM} procedure TFLisDiaCom.ppVisClick(Sender: TObject); begin if not Verifica then raise exception.create( 'Por favor, seleccione Fecha de Inicio o Numero de Asiento' ); FVisualiza := TBitBtn( Sender ).Name = 'ppVis'; end; procedure TFLisDiaCom.bbImpClick(Sender: TObject); begin if not Verifica then raise exception.create( 'Por favor, seleccione Fecha de Inicio o Numero de Asiento' ); FVisualiza := TBitBtn( Sender ).Name = 'ppVis'; end; function TFLisDiaCom.Verifica: boolean; begin Result := ( FecIni.date > 0 ) and ( FecFin.date >= FecIni.date ); end; procedure TFLisDiaCom.SetVisualiza(const Value: boolean); begin FVisualiza := Value; end; procedure TFLisDiaCom.FormCreate(Sender: TObject); begin FecIni.date := StartOfTheMonth( date-25 ); FecFin.date := StartOfTheMonth( date )-1; end; procedure TFLisDiaCom.btnEdiInfClick(Sender: TObject); begin // DisenarLisCompras; end; end.
unit uExportarParametros; interface uses System.SysUtils, System.Classes, uArquivoTexto, uDM, uFireDAC, uParametroVO, System.Generics.Collections, uGenericDAO; type TExportarParametros = class private FArquivo: string; public procedure Exportar(); function Importar(): TObjectList<TParametroVO>; constructor Create(); overload; end; implementation { TExportarParametros } constructor TExportarParametros.Create; begin inherited Create; FArquivo := 'D:\DOMPER\SIDomper\Banco\Parametros.txt'; end; procedure TExportarParametros.Exportar; var obj: TFireDAC; Arq: TArquivoTexto; begin obj := TFireDAC.create; Arq := TArquivoTexto.Create(FArquivo, tpExportar); try obj.OpenSQL('SELECT * FROM Parametros'); while not obj.Model.Eof do begin Arq.ExportarInt(obj.Model.FieldByName('Par_Codigo').AsInteger, 001, 005); Arq.ExportarInt(obj.Model.FieldByName('Par_Programa').AsInteger, 006, 005); Arq.ExportarString(obj.Model.FieldByName('Par_Nome').AsString, 011, 200); Arq.ExportarString(obj.Model.FieldByName('Par_Valor').AsString, 211, 250); Arq.ExportarString(obj.Model.FieldByName('Par_Obs').AsString, 411, 500); Arq.NovaLinha(); obj.Model.Next; end; finally FreeAndNil(obj); FreeAndNil(Arq); end; end; function TExportarParametros.Importar: TObjectList<TParametroVO>; var model: TParametroVO; lista: TObjectList<TParametroVO>; Arq: TArquivoTexto; begin lista := TObjectList<TParametroVO>.Create(); Arq := TArquivoTexto.Create(FArquivo, tpImportar); try while not (Arq.FimArquivo()) do begin Arq.ProximoRegistro(); model := TParametroVO.Create; model.Id := 0; model.Codigo := Arq.ImportarInt(001, 005); model.Programa := Arq.ImportarInt(006, 005); model.Nome := Arq.ImportarString(011, 200); model.Valor := Arq.ImportarString(211, 250); model.Obs := Arq.ImportarString(461, 500); lista.Add(model); end; finally FreeAndNil(Arq); end; Result := lista; end; end.
unit QRJpegImage; {$I QRDEFS.INC} interface uses quickrpt, DB, graphics, Windows, classes, jpeg, controls; type TQRDBJPGImage = class(TQRPrintable) private FField : TField; FDataSet : TDataSet; FDataField : string; FPicture: TPicture; FStretch: boolean; FCenter: boolean; FImageOffset : integer; FPictureLoaded: boolean; procedure PictureChanged(Sender: TObject); procedure SetCenter(Value: Boolean); procedure SetDataField(const Value: string); procedure SetDataSet(Value: TDataSet); procedure SetPicture(Value: TPicture); procedure SetStretch(Value: Boolean); protected function GetPalette: HPALETTE; override; procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Paint; override; procedure Prepare; override; procedure Print(OfsX, OfsY : integer); override; procedure UnPrepare; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure GetExpandedHeight(var newheight : extended ); override; procedure GetFieldString( var DataStr : string); override; procedure LoadPicture; property Field: TField read FField; property Picture: TPicture read FPicture write SetPicture; published property Center: boolean read FCenter write SetCenter default True; property DataField: string read FDataField write SetDataField; property DataSet: TDataSet read FDataSet write SetDataSet; property Stretch: boolean read FStretch write SetStretch default False; property ImageOffset: integer read FImageOffset write FImageOffset default 0; end; //procedure register; implementation uses qrprntr, forms, qrctrls; { procedure register; begin registercomponents('QReport',[TQRDBJPGImage]); end; } { TQRDBJPGImage } constructor TQRDBJPGImage.Create(AOwner: TComponent); begin inherited Create(AOwner); ControlStyle := ControlStyle + [csFramed, csOpaque]; Width := 105; Height := 105; FPicture := TPicture.Create; FPicture.OnChange := PictureChanged; FCenter := True; end; destructor TQRDBJPGImage.Destroy; begin FPicture.Free; inherited Destroy; end; procedure TQRDBJPGImage.Prepare; begin inherited Prepare; if assigned(FDataSet) then begin FField := DataSet.FindField(FDataField); if Field is TBlobField then begin Caption := ''; end; end else FField := nil; end; // return value in screen pixels procedure TQRDBJPGImage.GetExpandedHeight(var newheight : extended ); var DrawPict: TJpegImage; begin newheight := self.Height; // default in case of failure. DrawPict := TJpegImage.Create; try if assigned(FField) and (FField is TBlobField) then begin DrawPict.Assign(FField); newheight := DrawPict.Height; end finally drawpict.free; end; end; procedure TQRDBJPGImage.GetFieldString( var DataStr : string); begin end; procedure TQRDBJPGImage.Print(OfsX, OfsY : integer); var Dest: TRect; DrawPict: TJpegImage; expimg : TQRImage; expbmp : graphics.TBitmap; tmpstr : TMemoryStream; begin with QRPrinter.Canvas do begin Brush.Style := bsSolid; Brush.Color := Color; DrawPict := TJpegImage.Create; tmpstr := TMemoryStream.Create; try if assigned(FField) and (FField is TBlobField) then begin TBlobfield(FField).SaveToStream(tmpstr); tmpstr.Position := FImageOffset; drawpict.LoadFromStream(tmpstr); //DrawPict.Assign(FField); Dest.Left := QRPrinter.XPos(OfsX + Size.Left); Dest.Top := QRPrinter.YPos(OfsY + Size.Top); Dest.Right := QRPrinter.XPos(OfsX + Size.Width + Size.Left); Dest.Bottom := QRPrinter.YPos(OfsY + Size.Height + Size.Top); if Stretch then begin if (DrawPict = nil) or DrawPict.Empty then FillRect(Dest) else with QRPrinter.Canvas do StretchDraw(Dest, DrawPict); end else begin IntersectClipRect(Handle, Dest.Left, Dest.Top, Dest.Right, Dest.Bottom); Dest.Right := Dest.Left + round(DrawPict.Width / Screen.PixelsPerInch * 254 * ParentReport.QRPrinter.XFactor); Dest.Bottom := Dest.Top + round(DrawPict.Height / Screen.PixelsPerInch * 254 * ParentReport.QRPrinter.YFactor); if Center then OffsetRect(Dest, (QRPrinter.XSize(Size.Width) - round(DrawPict.Width / Screen.PixelsPerInch * 254 * ParentReport.QRPrinter.XFactor)) div 2, (QRPrinter.YSize(Size.Height) - round(DrawPict.Height / Screen.PixelsPerInch * 254 * ParentReport.QRPrinter.YFactor)) div 2); QRPrinter.Canvas.StretchDraw(Dest, DrawPict); SelectClipRgn(Handle, 0); end; end; finally end; end; if parentreport.Exporting then begin expimg := TQRImage.Create(parentreport); expimg.Size.Height := self.Size.Height; expimg.Size.Width := self.Size.Width; expimg.Size.Left := self.Size.left; expimg.Size.Top := self.Size.top; expbmp := graphics.TBitmap.Create; expbmp.Width := drawpict.Width; expbmp.height := drawpict.height; expbmp.Canvas.Draw(0,0,drawpict); expimg.Picture.Bitmap.Assign(expbmp); TQRExportFilter(ParentReport.ExportFilter).acceptgraphic( qrprinter.XPos(OfsX + expimg.Size.Left), qrprinter.YPos(OfsY+ expimg.size.top ), expimg ); expimg.Free; expbmp.Free; end; DrawPict.Free; tmpstr.Free; inherited Print(OfsX,OfsY); end; procedure TQRDBJPGImage.UnPrepare; begin FField := nil; inherited UnPrepare; end; procedure TQRDBJPGImage.SetDataSet(Value: TDataSet); begin FDataSet := Value; if Value <> nil then Value.FreeNotification(Self); end; procedure TQRDBJPGImage.SetDataField(const Value: string); begin FDataField := Value; end; function TQRDBJPGImage.GetPalette: HPALETTE; begin Result := 0; end; procedure TQRDBJPGImage.SetCenter(Value: Boolean); begin if FCenter <> Value then begin FCenter := Value; Invalidate; end; end; procedure TQRDBJPGImage.SetPicture(Value: TPicture); begin FPicture.Assign(Value); end; procedure TQRDBJPGImage.SetStretch(Value: Boolean); begin if FStretch <> Value then begin FStretch := Value; Invalidate; end; end; procedure TQRDBJPGImage.Paint; var W, H: Integer; R: TRect; S: string; begin with Canvas do begin Brush.Style := bsSolid; Brush.Color := Color; Font := Self.Font; if Field <> nil then S := Field.DisplayLabel else S := Name; S := '(' + S + ')'; W := TextWidth(S); H := TextHeight(S); R := ClientRect; TextRect(R, (R.Right - W) div 2, (R.Bottom - H) div 2, S); end; Inherited Paint; end; procedure TQRDBJPGImage.PictureChanged(Sender: TObject); begin FPictureLoaded := True; Invalidate; end; procedure TQRDBJPGImage.Notification(AComponent: TComponent; Operation: TOperation); begin inherited Notification(AComponent, Operation); if (Operation = opRemove) and (AComponent = DataSet) then DataSet := nil; end; procedure TQRDBJPGImage.LoadPicture; begin if not FPictureLoaded and (Field is TBlobField) then Picture.Assign(FField); end; end.
unit TTSNOTLISTTAGTable; interface uses Classes, DB, DBISAMTb, SysUtils, DBISAMTableAU, DataBuf; type TTTSNOTLISTTAGRecord = record PCifFlag: String[1]; PLoanNum: String[20]; PTrackCode: String[8]; PCategorySub: Integer; PSeparateBy: String[10]; PSortBy: String[120]; End; TTTSNOTLISTTAGBuffer = class(TDataBuf) protected function PtrIndex(Index:integer):Pointer;override; public Data: TTTSNOTLISTTAGRecord; function FieldNameToIndex(s:string):integer;override; function FieldType(index:integer):TFieldType;override; end; TEITTSNOTLISTTAG = (TTSNOTLISTTAGPrimaryKey, TTSNOTLISTTAGBySort); TTTSNOTLISTTAGTable = class( TDBISAMTableAU ) private FDFCifFlag: TStringField; FDFLoanNum: TStringField; FDFTrackCode: TStringField; FDFCategorySub: TIntegerField; FDFSeparateBy: TStringField; FDFSortBy: TStringField; procedure SetPCifFlag(const Value: String); function GetPCifFlag:String; procedure SetPLoanNum(const Value: String); function GetPLoanNum:String; procedure SetPTrackCode(const Value: String); function GetPTrackCode:String; procedure SetPCategorySub(const Value: Integer); function GetPCategorySub:Integer; procedure SetPSeparateBy(const Value: String); function GetPSeparateBy:String; procedure SetPSortBy(const Value: String); function GetPSortBy:String; procedure SetEnumIndex(Value: TEITTSNOTLISTTAG); function GetEnumIndex: TEITTSNOTLISTTAG; protected procedure CreateFields; procedure SetActive(Value: Boolean); override; procedure LoadFieldDefs(AStringList:TStringList);override; procedure LoadIndexDefs(AStringList:TStringList);override; public function GetDataBuffer:TTTSNOTLISTTAGRecord; procedure StoreDataBuffer(ABuffer:TTTSNOTLISTTAGRecord); property DFCifFlag: TStringField read FDFCifFlag; property DFLoanNum: TStringField read FDFLoanNum; property DFTrackCode: TStringField read FDFTrackCode; property DFCategorySub: TIntegerField read FDFCategorySub; property DFSeparateBy: TStringField read FDFSeparateBy; property DFSortBy: TStringField read FDFSortBy; property PCifFlag: String read GetPCifFlag write SetPCifFlag; property PLoanNum: String read GetPLoanNum write SetPLoanNum; property PTrackCode: String read GetPTrackCode write SetPTrackCode; property PCategorySub: Integer read GetPCategorySub write SetPCategorySub; property PSeparateBy: String read GetPSeparateBy write SetPSeparateBy; property PSortBy: String read GetPSortBy write SetPSortBy; published property Active write SetActive; property EnumIndex: TEITTSNOTLISTTAG read GetEnumIndex write SetEnumIndex; end; { TTTSNOTLISTTAGTable } procedure Register; implementation procedure TTTSNOTLISTTAGTable.CreateFields; begin FDFCifFlag := CreateField( 'CifFlag' ) as TStringField; FDFLoanNum := CreateField( 'LoanNum' ) as TStringField; FDFTrackCode := CreateField( 'TrackCode' ) as TStringField; FDFCategorySub := CreateField( 'CategorySub' ) as TIntegerField; FDFSeparateBy := CreateField( 'SeparateBy' ) as TStringField; FDFSortBy := CreateField( 'SortBy' ) as TStringField; end; { TTTSNOTLISTTAGTable.CreateFields } procedure TTTSNOTLISTTAGTable.SetActive(Value: Boolean); begin inherited SetActive(Value); if Active then CreateFields; end; { TTTSNOTLISTTAGTable.SetActive } procedure TTTSNOTLISTTAGTable.SetPCifFlag(const Value: String); begin DFCifFlag.Value := Value; end; function TTTSNOTLISTTAGTable.GetPCifFlag:String; begin result := DFCifFlag.Value; end; procedure TTTSNOTLISTTAGTable.SetPLoanNum(const Value: String); begin DFLoanNum.Value := Value; end; function TTTSNOTLISTTAGTable.GetPLoanNum:String; begin result := DFLoanNum.Value; end; procedure TTTSNOTLISTTAGTable.SetPTrackCode(const Value: String); begin DFTrackCode.Value := Value; end; function TTTSNOTLISTTAGTable.GetPTrackCode:String; begin result := DFTrackCode.Value; end; procedure TTTSNOTLISTTAGTable.SetPCategorySub(const Value: Integer); begin DFCategorySub.Value := Value; end; function TTTSNOTLISTTAGTable.GetPCategorySub:Integer; begin result := DFCategorySub.Value; end; procedure TTTSNOTLISTTAGTable.SetPSeparateBy(const Value: String); begin DFSeparateBy.Value := Value; end; function TTTSNOTLISTTAGTable.GetPSeparateBy:String; begin result := DFSeparateBy.Value; end; procedure TTTSNOTLISTTAGTable.SetPSortBy(const Value: String); begin DFSortBy.Value := Value; end; function TTTSNOTLISTTAGTable.GetPSortBy:String; begin result := DFSortBy.Value; end; procedure TTTSNOTLISTTAGTable.LoadFieldDefs(AStringList: TStringList); begin inherited; with AstringList do begin Add('CifFlag, String, 1, N'); Add('LoanNum, String, 20, N'); Add('TrackCode, String, 8, N'); Add('CategorySub, Integer, 0, N'); Add('SeparateBy, String, 10, N'); Add('SortBy, String, 120, N'); end; end; procedure TTTSNOTLISTTAGTable.LoadIndexDefs(AStringList: TStringList); begin inherited; with AstringList do begin Add('PrimaryKey, CifFlag;LoanNum;TrackCode;CategorySub, Y, Y, N, N'); Add('BySort, SeparateBy;SortBy, N, N, Y, N'); end; end; procedure TTTSNOTLISTTAGTable.SetEnumIndex(Value: TEITTSNOTLISTTAG); begin case Value of TTSNOTLISTTAGPrimaryKey : IndexName := ''; TTSNOTLISTTAGBySort : IndexName := 'BySort'; end; end; function TTTSNOTLISTTAGTable.GetDataBuffer:TTTSNOTLISTTAGRecord; var buf: TTTSNOTLISTTAGRecord; begin fillchar(buf, sizeof(buf), 0); buf.PCifFlag := DFCifFlag.Value; buf.PLoanNum := DFLoanNum.Value; buf.PTrackCode := DFTrackCode.Value; buf.PCategorySub := DFCategorySub.Value; buf.PSeparateBy := DFSeparateBy.Value; buf.PSortBy := DFSortBy.Value; result := buf; end; procedure TTTSNOTLISTTAGTable.StoreDataBuffer(ABuffer:TTTSNOTLISTTAGRecord); begin DFCifFlag.Value := ABuffer.PCifFlag; DFLoanNum.Value := ABuffer.PLoanNum; DFTrackCode.Value := ABuffer.PTrackCode; DFCategorySub.Value := ABuffer.PCategorySub; DFSeparateBy.Value := ABuffer.PSeparateBy; DFSortBy.Value := ABuffer.PSortBy; end; function TTTSNOTLISTTAGTable.GetEnumIndex: TEITTSNOTLISTTAG; var iname : string; begin iname := uppercase(indexname); if iname = '' then result := TTSNOTLISTTAGPrimaryKey; if iname = 'BYSORT' then result := TTSNOTLISTTAGBySort; end; (********************************************) (************ Register Component ************) (********************************************) procedure Register; begin RegisterComponents( 'TTS Tables', [ TTTSNOTLISTTAGTable, TTTSNOTLISTTAGBuffer ] ); end; { Register } function TTTSNOTLISTTAGBuffer.FieldNameToIndex(s:string):integer; const flist:array[1..6] of string = ('CIFFLAG','LOANNUM','TRACKCODE','CATEGORYSUB','SEPARATEBY','SORTBY' ); var x : integer; begin s := uppercase(s); x := 1; while (x <= 6) and (flist[x] <> s) do inc(x); if x <= 6 then result := x else result := 0; end; function TTTSNOTLISTTAGBuffer.FieldType(index:integer):TFieldType; begin result := ftUnknown; case index of 1 : result := ftString; 2 : result := ftString; 3 : result := ftString; 4 : result := ftInteger; 5 : result := ftString; 6 : result := ftString; end; end; function TTTSNOTLISTTAGBuffer.PtrIndex(index:integer):Pointer; begin result := nil; case index of 1 : result := @Data.PCifFlag; 2 : result := @Data.PLoanNum; 3 : result := @Data.PTrackCode; 4 : result := @Data.PCategorySub; 5 : result := @Data.PSeparateBy; 6 : result := @Data.PSortBy; end; end; end.
unit CustNodesForm; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, StdCtrls; type TForm1 = class(TForm) TreeView1: TTreeView; Button1: TButton; Label1: TLabel; procedure TreeView1CreateNodeClass(Sender: TCustomTreeView; var NodeClass: TTreeNodeClass); procedure Button1Click(Sender: TObject); procedure TreeView1Click(Sender: TObject); private CurrentNodeClass: TTreeNodeClass; public procedure AddChildNodes(BaseNode: TTreeNode; nItems: Integer); end; var Form1: TForm1; implementation {$R *.dfm} type TMyNode = class (TTreeNode) private FExtraCode: Integer; protected procedure SetExtraCode(const Value: Integer); virtual; function GetExtraCode: Integer; virtual; public property ExtraCode: Integer read GetExtraCode write SetExtraCode; end; TMySubNode = class (TMyNode) protected function GetExtraCode: Integer; override; end; procedure TForm1.TreeView1CreateNodeClass(Sender: TCustomTreeView; var NodeClass: TTreeNodeClass); begin NodeClass := CurrentNodeClass; end; { TMyNode } function TMyNode.GetExtraCode: Integer; begin Result := FExtraCode; end; procedure TMyNode.SetExtraCode(const Value: Integer); begin FExtraCode := Value; end; procedure TForm1.AddChildNodes (BaseNode: TTreeNode; nItems: Integer); var MyNode: TMyNode; j: Integer; begin for j := 1 to nItems do begin CurrentNodeClass := TMySubNode; MyNode := TreeView1.Items.AddChild (BaseNode, 'value' + IntToStr (j)) as TMyNode; MyNode.ExtraCode := j; // recursively add more nodes, up to a given level if MyNode.Level <= 5 then AddChildNodes(MyNode, Random (5)); end; // let the system update the form Application.ProcessMessages; end; procedure TForm1.Button1Click(Sender: TObject); var MyNode: TMyNode; i: Integer; begin Randomize; for i := 1 to 5 do begin CurrentNodeClass := TMyNode; MyNode := TreeView1.Items.AddChild (nil, 'item' + IntToStr (i)) as TMyNode; MyNode.ExtraCode := i; AddChildNodes(MyNode, Random (5)); end; end; procedure TForm1.TreeView1Click(Sender: TObject); var MyNode: TMyNode; begin MyNode := TreeView1.Selected as TMyNode; Label1.Caption := MyNode.Text + ' [' + MyNode.ClassName + '] = ' + IntToStr (MyNode.ExtraCode); end; { TMySubNode } function TMySubNode.GetExtraCode: Integer; begin Result := fExtraCode * (Parent as TMyNode).ExtraCode; end; end.
unit View.CadastroEntregadores; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters, cxClasses, dxLayoutContainer, dxLayoutControl, Common.ENum, Common.Utils, Global.Parametros, cxContainer, cxEdit, dxLayoutcxEditAdapters, cxLabel, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client, cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage, cxNavigator, dxDateRanges, cxDataControllerConditionalFormattingRulesManagerDialog, cxDBData, cxGridLevel, cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, cxDBLookupComboBox, cxSpinEdit, cxTextEdit, cxMaskEdit, cxButtonEdit, cxCurrencyEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit, Control.VerbasExpressas, Control.TiposVerbasExpressas, System.Actions, Vcl.ActnList, dxLayoutControlAdapters, Vcl.Menus, Vcl.StdCtrls, cxButtons, cxCheckBox, Data.Bind.EngExt, Vcl.Bind.DBEngExt, System.Rtti, System.Bindings.Outputs, Vcl.Bind.Editors, Data.Bind.Components, Data.Bind.DBScope, Control.EntregadoresExpressas, Control.Bases, Control.Cadastro, cxDBEdit, cxImageComboBox, cxBlobEdit, Control.ExtraviosMultas, Control.Lancamentos, Control.Entregas, Vcl.Bind.Navigator, FireDAC.Stan.Async, FireDAC.DApt; type Tview_CadastroEntregadores = class(TForm) layoutControlPadraoGroup_Root: TdxLayoutGroup; layoutControlPadrao: TdxLayoutControl; labelTitle: TcxLabel; layoutItemLabelTitle: TdxLayoutItem; memTableEntregadores: TFDMemTable; memTableEntregadorescod_cadastro: TIntegerField; memTableEntregadorescod_entregador: TIntegerField; memTableEntregadoresnom_fantasia: TStringField; memTableEntregadorescod_agente: TIntegerField; memTableEntregadoresdes_chave: TStringField; memTableEntregadorescod_grupo: TIntegerField; memTableEntregadoresval_verba: TFloatField; memTableEntregadoresnom_executante: TStringField; memTableEntregadoresdom_ativo: TIntegerField; memTableEntregadorescod_tabela: TIntegerField; dsEntregadores: TDataSource; layoutControlCadastroGroup_Root: TdxLayoutGroup; layoutControlCadastro: TdxLayoutControl; layoutItemCadastro: TdxLayoutItem; buttonEditPessoa: TcxButtonEdit; layoutItemCodigoCadastro: TdxLayoutItem; textEditNomePessoa: TcxTextEdit; layoutItemNomePessoa: TdxLayoutItem; dxLayoutAutoCreatedGroup1: TdxLayoutAutoCreatedGroup; maskEditCodigo: TcxMaskEdit; layoutItemCodigo: TdxLayoutItem; textEditNomeFantasia: TcxTextEdit; layoutItemNomeFantasia: TdxLayoutItem; buttonEditCodigoAgente: TcxButtonEdit; layoutItemCodigoAgente: TdxLayoutItem; textEditNomeAgente: TcxTextEdit; layoutItemNomeAgente: TdxLayoutItem; dxLayoutAutoCreatedGroup2: TdxLayoutAutoCreatedGroup; textEditCodigoERP: TcxTextEdit; layoutItemCodigoERP: TdxLayoutItem; currencyEditTicketMedio: TcxCurrencyEdit; layoutItemTicketMedio: TdxLayoutItem; dxLayoutAutoCreatedGroup3: TdxLayoutAutoCreatedGroup; layoutControlFooterGroup_Root: TdxLayoutGroup; layoutControlFooter: TdxLayoutControl; layoutItemFooter: TdxLayoutItem; actionListEntregadores: TActionList; actionLocalizar: TAction; actionFechar: TAction; buttonGravar: TcxButton; layoutItemButtonGravar: TdxLayoutItem; checkBoxAtivo: TcxCheckBox; layoutItemCheckBoxAtivo: TdxLayoutItem; buttonFechar: TcxButton; layoutItemButtonFechar: TdxLayoutItem; actionLocalizarAgentes: TAction; actionLocalizarPessoas: TAction; buttonEditCodigoTabela: TcxButtonEdit; layoutItemButtonEditCodigoTabela: TdxLayoutItem; textEditDescricaoTabela: TcxTextEdit; layoutItemTextEditDescricaoTabela: TdxLayoutItem; buttonEditCodigoFaixa: TcxButtonEdit; layoutItemButtonEditCodigoFaixa: TdxLayoutItem; memTableEntregadorescod_cliente: TIntegerField; actionPesquisarTabelas: TAction; memTableEntregadoresdat_manutencao: TSQLTimeStampField; layoutGroupHistorico: TdxLayoutGroup; memTableExtravios: TFDMemTable; memTableExtravioscod_extravio: TIntegerField; memTableExtraviosdes_extravio: TStringField; memTableExtraviosnum_nossonumero: TStringField; memTableExtravioscod_agente: TIntegerField; memTableExtraviosval_produto: TFloatField; memTableExtraviosdat_extravio: TDateField; memTableExtraviosval_multa: TFloatField; memTableExtraviosval_verba: TFloatField; memTableExtraviosval_total: TFloatField; memTableExtraviosdom_restricao: TStringField; memTableExtravioscod_entregador: TIntegerField; memTableExtravioscod_tipo: TIntegerField; memTableExtraviosval_verba_franquia: TFloatField; memTableExtraviosval_extrato_franquia: TFloatField; memTableExtraviosdom_extrato_franquia: TStringField; memTableExtraviosdat_extravio_franquia: TDateField; memTableExtraviosdes_envio_correspondencia: TStringField; memTableExtraviosdes_retorno_correspondencia: TStringField; memTableExtraviosdes_observacoes: TMemoField; memTableExtraviosval_percentual_pago: TFloatField; memTableExtraviosid_extrato: TIntegerField; memTableExtraviosseq_acareacao: TIntegerField; memTableExtraviosnom_executor: TStringField; memTableExtraviosdat_manutencao: TDateTimeField; memTableExtraviosnum_extrato: TStringField; gridExtraviosDBTableViewExtravios: TcxGridDBTableView; gridExtraviosLevelExtavios: TcxGridLevel; gridExtravios: TcxGrid; layoutItemExtravios: TdxLayoutItem; dsExtravios: TDataSource; gridExtraviosDBTableViewExtravioscod_extravio: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosdes_extravio: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosnum_nossonumero: TcxGridDBColumn; gridExtraviosDBTableViewExtravioscod_agente: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosval_produto: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosdat_extravio: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosval_multa: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosval_verba: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosval_total: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosdom_restricao: TcxGridDBColumn; gridExtraviosDBTableViewExtravioscod_entregador: TcxGridDBColumn; gridExtraviosDBTableViewExtravioscod_tipo: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosval_verba_franquia: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosval_extrato_franquia: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosdom_extrato_franquia: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosdat_extravio_franquia: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosdes_envio_correspondencia: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosdes_retorno_correspondencia: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosdes_observacoes: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosval_percentual_pago: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosid_extrato: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosseq_acareacao: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosnom_executor: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosdat_manutencao: TcxGridDBColumn; gridExtraviosDBTableViewExtraviosnum_extrato: TcxGridDBColumn; memTableLancamentos: TFDMemTable; memTableLancamentoscod_lancamento: TIntegerField; memTableLancamentosdes_lancamento: TStringField; memTableLancamentosdat_lancamento: TDateField; memTableLancamentoscod_entregador: TIntegerField; memTableLancamentoscod_entregador_: TIntegerField; memTableLancamentosdes_tipo: TStringField; memTableLancamentosval_lancamento: TFloatField; memTableLancamentosdat_desconto: TDateField; memTableLancamentosnum_extrato: TStringField; memTableLancamentosdom_persistir: TStringField; gridLancamentosDBTableViewLancamentos: TcxGridDBTableView; gridLancamentosLevelLancamentos: TcxGridLevel; gridLancamentos: TcxGrid; layoutItemLancamentos: TdxLayoutItem; dsLancamentos: TDataSource; gridLancamentosDBTableViewLancamentoscod_lancamento: TcxGridDBColumn; gridLancamentosDBTableViewLancamentosdes_lancamento: TcxGridDBColumn; gridLancamentosDBTableViewLancamentosdat_lancamento: TcxGridDBColumn; gridLancamentosDBTableViewLancamentoscod_entregador: TcxGridDBColumn; gridLancamentosDBTableViewLancamentoscod_entregador_: TcxGridDBColumn; gridLancamentosDBTableViewLancamentosdes_tipo: TcxGridDBColumn; gridLancamentosDBTableViewLancamentosval_lancamento: TcxGridDBColumn; gridLancamentosDBTableViewLancamentosdom_desconto: TcxGridDBColumn; gridLancamentosDBTableViewLancamentosdat_desconto: TcxGridDBColumn; gridLancamentosDBTableViewLancamentosnum_extrato: TcxGridDBColumn; gridLancamentosDBTableViewLancamentosdom_persistir: TcxGridDBColumn; gridRemessasDBTableViewRemessas: TcxGridDBTableView; gridRemessasLevelRemessas: TcxGridLevel; gridRemessas: TcxGrid; layoutItemREmessas: TdxLayoutItem; memTableExpressas: TFDMemTable; memTableExpressasval_verba_entregador: TCurrencyField; memTableExpressasqtd_volumes: TIntegerField; memTableExpressasqtd_entregas: TIntegerField; memTableExpressasval_producao: TCurrencyField; memTableExpressasdat_baixa: TDateField; dsExpressas: TDataSource; gridRemessasDBTableViewRemessasdat_baixa: TcxGridDBColumn; gridRemessasDBTableViewRemessasqtd_entregas: TcxGridDBColumn; gridRemessasDBTableViewRemessasqtd_volumes: TcxGridDBColumn; gridRemessasDBTableViewRemessasval_verba: TcxGridDBColumn; gridRemessasDBTableViewRemessasval_producao: TcxGridDBColumn; memTableLancamentosdom_desconto: TStringField; actionPesquisarFaixas: TAction; SaveDialog: TSaveDialog; actionNovo: TAction; actionEditar: TAction; actionCancelar: TAction; actionGravar: TAction; memTableEntregadoresdat_codigo: TDateTimeField; memTableLancamentoscod_referencia: TIntegerField; memTableLancamentosdat_cadastro: TDateTimeField; memTableLancamentosnom_usuario: TStringField; memTableExpressascod_cliente: TIntegerField; memTableExpressascod_base: TIntegerField; dsBases: TDataSource; dsClientes: TDataSource; textEditID: TcxTextEdit; layoutItemID: TdxLayoutItem; lookupComboBoxCliente: TcxLookupComboBox; layoutItemCliente: TdxLayoutItem; memTableEntregadoresid_entregador: TIntegerField; procedure FormShow(Sender: TObject); procedure actionFecharExecute(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure actionLocalizarAgentesExecute(Sender: TObject); procedure actionLocalizarPessoasExecute(Sender: TObject); procedure buttonEditCodigoAgentePropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); procedure buttonEditPessoaPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); procedure actionPesquisarTabelasExecute(Sender: TObject); procedure actionLocalizarExecute(Sender: TObject); procedure buttonEditCodigoTabelaPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); procedure memTableExpressasCalcFields(DataSet: TDataSet); procedure actionPesquisarFaixasExecute(Sender: TObject); procedure gridExtraviosDBTableViewExtraviosNavigatorButtonsButtonClick(Sender: TObject; AButtonIndex: Integer; var ADone: Boolean); procedure gridLancamentosDBTableViewLancamentosNavigatorButtonsButtonClick(Sender: TObject; AButtonIndex: Integer; var ADone: Boolean); procedure gridRemessasDBTableViewRemessasNavigatorButtonsButtonClick(Sender: TObject; AButtonIndex: Integer; var ADone: Boolean); procedure FormKeyPress(Sender: TObject; var Key: Char); procedure LiveBindingsBindNavigateCancel1Execute(Sender: TObject); procedure actionNovoExecute(Sender: TObject); procedure actionEditarExecute(Sender: TObject); procedure actionCancelarExecute(Sender: TObject); procedure actionGravarExecute(Sender: TObject); procedure fdqueryEntregadoresAfterClose(DataSet: TDataSet); private { Private declarations } procedure PesquisaAgente; procedure PesquisaPessoas; procedure PesquisaTabelas; procedure PesquisaFaixas; procedure PesquisaEntregadores; procedure PopulaExtravios(iEntregador: integer); procedure PopulaLancamentos(iCadastro: integer); procedure PopulaExpressas(iEntregador: integer); procedure PopulaCampos; procedure LimpaCampos; procedure Gravar; procedure ExportarExtravios; procedure ExportaLancamentos; procedure ExportaExpressas; procedure IncludeData; procedure EditData; procedure CloseForm; procedure StartForm; function RetornaNomeAgente(iCodigo: integer): String; function RetornaNomePessoa(iCodigo: integer): String; function RetornaDescricaoTabela(iCodigo: integer): string; function RetornaValorFaixa(iCliente,iTabela,iFaixa: Integer): String; function ValidaDados(): boolean; procedure Modo; public { Public declarations } iID: Integer; end; var view_CadastroEntregadores: Tview_CadastroEntregadores; FAcao: TAcao; dataCodigo: TDateTime; implementation {$R *.dfm} uses Data.SisGeF, View.PesquisarPessoas; procedure Tview_CadastroEntregadores.actionCancelarExecute(Sender: TObject); begin FAcao := tacIndefinido; LimpaCampos; Modo; end; procedure Tview_CadastroEntregadores.actionEditarExecute(Sender: TObject); begin FAcao := tacAlterar; Modo; textEditNomeFantasia.SetFocus; end; procedure Tview_CadastroEntregadores.actionFecharExecute(Sender: TObject); begin CloseForm; end; procedure Tview_CadastroEntregadores.actionGravarExecute(Sender: TObject); begin if not ValidaDados() then begin Exit; end; if Application.MessageBox('Confirma gravar os dados?', 'Gravar', MB_YESNO + MB_ICONQUESTION) = IDNO then begin exit; end; Gravar; end; procedure Tview_CadastroEntregadores.actionLocalizarAgentesExecute(Sender: TObject); begin PesquisaAgente; end; procedure Tview_CadastroEntregadores.actionLocalizarExecute(Sender: TObject); begin PesquisaEntregadores; end; procedure Tview_CadastroEntregadores.actionLocalizarPessoasExecute(Sender: TObject); begin PesquisaPessoas; end; procedure Tview_CadastroEntregadores.actionNovoExecute(Sender: TObject); begin LimpaCampos; FAcao := tacIncluir; Modo; maskEditCodigo.SetFocus; end; procedure Tview_CadastroEntregadores.actionPesquisarFaixasExecute(Sender: TObject); begin PesquisaFaixas; end; procedure Tview_CadastroEntregadores.actionPesquisarTabelasExecute(Sender: TObject); begin PesquisaTabelas; end; procedure Tview_CadastroEntregadores.buttonEditCodigoAgentePropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); begin if (Facao = tacIncluir) or (FAcao = tacAlterar) then begin textEditNomeAgente.Text := RetornaNomeAgente(StrToIntDef(buttonEditCodigoAgente.Text,0)); end; end; procedure Tview_CadastroEntregadores.buttonEditCodigoTabelaPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); begin if (Facao = tacIncluir) or (FAcao = tacAlterar) then begin textEditDescricaoTabela.Text := RetornaDescricaoTabela(StrToIntDef(buttonEditCodigoTabela.Text,0)); end; end; procedure Tview_CadastroEntregadores.buttonEditPessoaPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); begin if (Facao = tacIncluir) or (FAcao = tacAlterar) then begin textEditNomePessoa.Text := RetornaNomePessoa(StrToIntDef(buttonEditPessoa.Text,0)); end; end; procedure Tview_CadastroEntregadores.CloseForm; begin FAcao := tacIndefinido; if memTableEntregadores.Active then memTableEntregadores.Close; ModalResult := mrCancel; end; procedure Tview_CadastroEntregadores.EditData; begin PesquisaEntregadores; FAcao := tacAlterar; Modo; textEditNomeFantasia.SetFocus; end; procedure Tview_CadastroEntregadores.ExportaExpressas; begin SaveDialog.Filter := ''; SaveDialog.Filter := 'Excel (*.xls) |*.xls|XML (*.xml) |*.xml|Arquivo Texto (*.txt) |*.txt|Página Web (*.html)|*.html|Arquivo separado por virgulas (*.csv)|*.csv'; SaveDialog.Title := 'Exportar Dados'; SaveDialog.DefaultExt := 'xls'; if SaveDialog.Execute then begin TUtils.ExportarDados(gridRemessas, SaveDialog.FileName); end; end; procedure Tview_CadastroEntregadores.ExportaLancamentos; begin SaveDialog.Filter := ''; SaveDialog.Filter := 'Excel (*.xls) |*.xls|XML (*.xml) |*.xml|Arquivo Texto (*.txt) |*.txt|Página Web (*.html)|*.html|Arquivo separado por virgulas (*.csv)|*.csv'; SaveDialog.Title := 'Exportar Dados'; SaveDialog.DefaultExt := 'xls'; if SaveDialog.Execute then begin TUtils.ExportarDados(gridLancamentos, SaveDialog.FileName); end; end; procedure Tview_CadastroEntregadores.ExportarExtravios; begin SaveDialog.Filter := ''; SaveDialog.Filter := 'Excel (*.xls) |*.xls|XML (*.xml) |*.xml|Arquivo Texto (*.txt) |*.txt|Página Web (*.html)|*.html|Arquivo separado por virgulas (*.csv)|*.csv'; SaveDialog.Title := 'Exportar Dados'; SaveDialog.DefaultExt := 'xls'; if SaveDialog.Execute then begin TUtils.ExportarDados(gridExtravios, SaveDialog.FileName); end; end; procedure Tview_CadastroEntregadores.fdqueryEntregadoresAfterClose(DataSet: TDataSet); begin Data_Sisgef.FDConnectionMySQL.Close; end; procedure Tview_CadastroEntregadores.FormClose(Sender: TObject; var Action: TCloseAction); begin if memTableExtravios.Active then memTableExtravios.Close; if memTableLancamentos.Active then memTableLancamentos.Close; if memTableExpressas.Active then memTableExpressas.Close; if memTableEntregadores.Active then memTableEntregadores.Close; Action := caFree; view_CadastroEntregadores := nil; end; procedure Tview_CadastroEntregadores.FormKeyPress(Sender: TObject; var Key: Char); begin if gridExtravios.IsFocused then Exit; if gridLancamentos.IsFocused then Exit; if gridRemessas.IsFocused then Exit; If Key = #13 then begin Key := #0; Perform(Wm_NextDlgCtl, 0, 0); end; end; procedure Tview_CadastroEntregadores.FormShow(Sender: TObject); begin StartForm; end; procedure Tview_CadastroEntregadores.Gravar; var entregadores : TEntregadoresExpressasControl; begin try entregadores := TEntregadoresExpressasControl.Create; entregadores.Entregadores.ID := StrToIntDef(textEditID.Text,0); entregadores.Entregadores.Cadastro := buttonEditPessoa.EditValue; entregadores.Entregadores.Entregador := maskEditCodigo.EditValue; entregadores.Entregadores.Fantasia := textEditNomeFantasia.Text; entregadores.Entregadores.Agente := buttonEditCodigoAgente.EditValue; if memTableEntregadoresdat_codigo.Value = 0 then begin entregadores.Entregadores.Data := Now(); end else begin entregadores.Entregadores.Data := dataCodigo; end; entregadores.Entregadores.Chave := textEditCodigoERP.Text; entregadores.Entregadores.Grupo := buttonEditCodigoFaixa.EditValue; entregadores.Entregadores.Verba := currencyEditTicketMedio.Value; entregadores.Entregadores.Executor := Global.Parametros.pUser_Name; entregadores.Entregadores.Tabela := buttonEditCodigoTabela.EditValue; entregadores.Entregadores.Cliente := lookupComboBoxCliente.EditValue; entregadores.Entregadores.Manutencao := Now(); entregadores.Entregadores.Ativo := checkBoxAtivo.EditValue; entregadores.Entregadores.Acao := FAcao; if not entregadores.Gravar() then begin Application.MessageBox('Ocorreu um problema ao tentar gravar os dados!', 'Atenção', MB_OK + MB_ICONEXCLAMATION); Exit; end else begin Application.MessageBox('Dados gravados com sucesso!', 'Atenção', MB_OK + MB_ICONINFORMATION); FAcao := tacIndefinido; LimpaCampos; Modo; ModalResult := mrOk; end; finally entregadores.Free; end; end; procedure Tview_CadastroEntregadores.gridExtraviosDBTableViewExtraviosNavigatorButtonsButtonClick(Sender: TObject; AButtonIndex: Integer; var ADone: Boolean); begin case AButtonIndex of 16: ExportarExtravios; end; end; procedure Tview_CadastroEntregadores.gridLancamentosDBTableViewLancamentosNavigatorButtonsButtonClick(Sender: TObject; AButtonIndex: Integer; var ADone: Boolean); begin case AButtonIndex of 16: ExportaLancamentos; end; end; procedure Tview_CadastroEntregadores.gridRemessasDBTableViewRemessasNavigatorButtonsButtonClick(Sender: TObject; AButtonIndex: Integer; var ADone: Boolean); begin case AButtonIndex of 16: ExportaExpressas; end; end; procedure Tview_CadastroEntregadores.IncludeData; begin LimpaCampos; FAcao := tacIncluir; Modo; maskEditCodigo.SetFocus; end; procedure Tview_CadastroEntregadores.LimpaCampos; begin textEditID.Text := '0'; buttonEditPessoa.EditValue := 0; textEditNomePessoa.Text := ''; maskEditCodigo.EditValue := 0; textEditNomeFantasia.Text := ''; buttonEditCodigoAgente.EditValue := 0; textEditNomeAgente.Text := ''; dataCodigo := Now(); textEditCodigoERP.Text := ''; buttonEditCodigoFaixa.EditValue := 0; currencyEditTicketMedio.Value := 0; buttonEditCodigoTabela.EditValue := 0; textEditDescricaoTabela.Text := ''; lookupComboBoxCliente.ItemIndex := -1; checkBoxAtivo.EditValue := 1; end; procedure Tview_CadastroEntregadores.LiveBindingsBindNavigateCancel1Execute(Sender: TObject); begin Facao := tacIndefinido; Modo; end; procedure Tview_CadastroEntregadores.memTableExpressasCalcFields(DataSet: TDataSet); begin memTableExpressasval_producao.AsFloat := memTableExpressasval_verba_entregador.AsFloat * memTableExpressasqtd_entregas.AsInteger; end; procedure Tview_CadastroEntregadores.Modo; begin if FAcao = tacIndefinido then begin actionNovo.Enabled := True; actionEditar.Enabled := False; actionLocalizar.Enabled := True; actionCancelar.Enabled := False; actionGravar.Enabled := False; maskEditCodigo.Properties.ReadOnly := True; actionLocalizarPessoas.Enabled := False; buttonEditPessoa.Properties.ReadOnly := True; actionLocalizarAgentes.Enabled := False; buttonEditCodigoAgente.Properties.ReadOnly := True; textEditCodigoERP.Properties.ReadOnly := True; lookupComboBoxCliente.Properties.ReadOnly := True; actionPesquisarTabelas.Enabled := False; buttonEditCodigoTabela.Properties.ReadOnly := True; actionPesquisarFaixas.Enabled := False; buttonEditCodigoFaixa.Properties.ReadOnly := True; currencyEditTicketMedio.Properties.ReadOnly := True; checkBoxAtivo.Properties.ReadOnly := True; layoutGroupHistorico.Visible := False; if memTableExtravios.Active then memTableExtravios.Close; if memTableLancamentos.Active then memTableLancamentos.Close; if memTableExpressas.Active then memTableExpressas.Close; if memTableEntregadores.Active then memTableEntregadores.Close; end else if FAcao = tacIncluir then begin actionNovo.Enabled := False; actionEditar.Enabled := False; actionLocalizar.Enabled := False; actionCancelar.Enabled := True; actionGravar.Enabled := True; maskEditCodigo.Properties.ReadOnly := False; actionLocalizarPessoas.Enabled := True; buttonEditPessoa.Properties.ReadOnly := False; actionLocalizarAgentes.Enabled:= True; buttonEditCodigoAgente.Properties.ReadOnly := False; textEditCodigoERP.Properties.ReadOnly := False; lookupComboBoxCliente.Properties.ReadOnly := False; actionPesquisarTabelas.Enabled := True; buttonEditCodigoTabela.Properties.ReadOnly := False; actionPesquisarFaixas.Enabled := True; buttonEditCodigoFaixa.Properties.ReadOnly := False; currencyEditTicketMedio.Properties.ReadOnly := False; checkBoxAtivo.Properties.ReadOnly := False; layoutGroupHistorico.Visible := False; end else if FAcao = tacAlterar then begin actionNovo.Enabled := False; actionEditar.Enabled := False; actionLocalizar.Enabled := False; actionCancelar.Enabled := True; actionGravar.Enabled := True; maskEditCodigo.Properties.ReadOnly := True; actionLocalizarPessoas.Enabled := True; buttonEditPessoa.Properties.ReadOnly := False; actionLocalizarAgentes.Enabled := True; buttonEditCodigoAgente.Properties.ReadOnly := False; textEditCodigoERP.Properties.ReadOnly := False; lookupComboBoxCliente.Properties.ReadOnly := False; actionPesquisarTabelas.Enabled := True; buttonEditCodigoTabela.Properties.ReadOnly := False; actionPesquisarFaixas.Enabled := True; buttonEditCodigoFaixa.Properties.ReadOnly := False; currencyEditTicketMedio.Properties.ReadOnly := False; checkBoxAtivo.Properties.ReadOnly := False; layoutGroupHistorico.Visible := True; maskEditCodigo.Properties.ReadOnly := True; end else if FAcao = tacPesquisa then begin actionNovo.Enabled := True; actionEditar.Enabled := True; actionLocalizar.Enabled := True; actionCancelar.Enabled := True; actionGravar.Enabled := False; maskEditCodigo.Properties.ReadOnly := True; actionLocalizarPessoas.Enabled := False; buttonEditPessoa.Properties.ReadOnly := True; actionLocalizarAgentes.Enabled:= False; buttonEditCodigoAgente.Properties.ReadOnly := True; textEditCodigoERP.Properties.ReadOnly := True; lookupComboBoxCliente.Properties.ReadOnly := True; actionPesquisarTabelas.Enabled := False; buttonEditCodigoTabela.Properties.ReadOnly := True; actionPesquisarFaixas.Enabled := False; buttonEditCodigoFaixa.Properties.ReadOnly := True; currencyEditTicketMedio.Properties.ReadOnly := True; checkBoxAtivo.Properties.ReadOnly := True; layoutGroupHistorico.Visible := True; end; end; procedure Tview_CadastroEntregadores.PesquisaAgente; var sSQL: String; sWhere: String; begin try sSQL := ''; sWhere := ''; if not Assigned(View_PesquisarPessoas) then begin View_PesquisarPessoas := TView_PesquisarPessoas.Create(Application); end; View_PesquisarPessoas.dxLayoutItem1.Visible := True; View_PesquisarPessoas.dxLayoutItem2.Visible := True; sSQL := 'select COD_AGENTE as "Código", DES_RAZAO_SOCIAL as Nome, NOM_FANTASIA as Alias, NUM_CNPJ as "CNPJ / CPF" ' + 'from tbagentes '; sWhere := 'where COD_AGENTE like paraN or DES_RAZAO_SOCIAL like "%param%" or NOM_FANTASIA like "%param%" or ' + 'NUM_CNPJ like "%param%"'; View_PesquisarPessoas.sSQL := sSQL; View_PesquisarPessoas.sWhere := sWhere; View_PesquisarPessoas.bOpen := False; View_PesquisarPessoas.Caption := 'Pesquisa de Agentes'; if View_PesquisarPessoas.ShowModal = mrOK then begin buttonEditCodigoAgente.EditValue := View_PesquisarPessoas.qryPesquisa.Fields[1].AsString; textEditNomeAgente.Text := View_PesquisarPessoas.qryPesquisa.Fields[2].AsString; end; finally View_PesquisarPessoas.qryPesquisa.Close; View_PesquisarPessoas.tvPesquisa.ClearItems; FreeAndNil(View_PesquisarPessoas); end; end; procedure Tview_CadastroEntregadores.PesquisaEntregadores; var aParam: array of variant; sQuery: String; entregadores : TEntregadoresExpressasControl; begin if iID <> 0 then begin entregadores := TEntregadoresExpressasControl.Create; sQuery := 'id_entregador = ' + iID.ToString; SetLength(aParam,2); aparam := ['FILTRO', sQuery]; memTableEntregadores.CopyDataSet(entregadores.Localizar(aParam)); Finalize(aParam); if not memTableEntregadores.IsEmpty then begin FAcao := tacPesquisa; PopulaCampos; PopulaExtravios(memTableEntregadorescod_entregador.AsInteger); PopulaLancamentos(memTableEntregadorescod_entregador.AsInteger); PopulaExpressas(memTableEntregadorescod_entregador.AsInteger); Modo; end; entregadores.Free; end; end; procedure Tview_CadastroEntregadores.PesquisaFaixas; var sSQL: String; sWhere: String; begin try sSQL := ''; sWhere := ''; if not Assigned(View_PesquisarPessoas) then begin View_PesquisarPessoas := TView_PesquisarPessoas.Create(Application); end; if lookupComboBoxCliente.EditValue= 0 then begin Application.MessageBox('Informe o Cliente!', 'Atenção', MB_OK + MB_ICONWARNING); Exit; end; if StrToIntDef(buttonEditCodigoTabela.EditText, 0) = 0 then begin Application.MessageBox('Informe a Tabela de Verbas!', 'Atenção', MB_OK + MB_ICONWARNING); Exit; end; View_PesquisarPessoas.dxLayoutItem1.Visible := True; View_PesquisarPessoas.dxLayoutItem2.Visible := True; sSQL := 'select id_grupo as "Faixa", format(val_verba,2,"de_DE") as "Ticket Médio", ' + 'num_cep_inicial as "CEP Inicial", num_cep_final as "CEP Final", format(qtd_peso_inicial,3,"de_DE") as "Peso Inicial", ' + 'format(qtd_peso_final,3,"de_DE") as "Peso Final" ' + 'from expressas_verbas where cod_cliente = ' + VarToStr(lookupComboBoxCliente.EditValue) + ' and cod_tipo = ' + VarToStr(buttonEditCodigoTabela.EditValue); sWhere := ''; View_PesquisarPessoas.dxLayoutItem1.Visible := False; View_PesquisarPessoas.sSQL := sSQL; View_PesquisarPessoas.sWhere := sWhere; View_PesquisarPessoas.bOpen := True; View_PesquisarPessoas.Caption := 'Pesquisa de Faixas'; if View_PesquisarPessoas.ShowModal = mrOK then begin buttonEditCodigoFaixa.EditValue := View_PesquisarPessoas.qryPesquisa.Fields[1].AsInteger; end; finally if View_PesquisarPessoas.qryPesquisa.Active then begin View_PesquisarPessoas.qryPesquisa.Close; View_PesquisarPessoas.tvPesquisa.ClearItems; end; FreeAndNil(View_PesquisarPessoas); end; end; procedure Tview_CadastroEntregadores.PesquisaPessoas; var sSQL: String; sWhere: String; begin try sSQL := ''; sWhere := ''; if not Assigned(View_PesquisarPessoas) then begin View_PesquisarPessoas := TView_PesquisarPessoas.Create(Application); end; View_PesquisarPessoas.dxLayoutItem1.Visible := True; View_PesquisarPessoas.dxLayoutItem2.Visible := True; sSQL := 'select COD_CADASTRO as "Código", DES_RAZAO_SOCIAL as Nome, NUM_IE as "CNPJ / CPF", NUM_CNPJ as "CNPJ / CPF" ' + 'from tbentregadores '; sWhere := 'where COD_CADASTRO like paraN or DES_RAZAO_SOCIAL like "%param%" or NUM_IE like "%param%" or ' + 'NUM_CNPJ like "%param%"'; View_PesquisarPessoas.sSQL := sSQL; View_PesquisarPessoas.sWhere := sWhere; View_PesquisarPessoas.bOpen := False; View_PesquisarPessoas.Caption := 'Pesquisa de Tabelas de Verbas'; if View_PesquisarPessoas.ShowModal = mrOK then begin buttonEditPessoa.EditValue := View_PesquisarPessoas.qryPesquisa.Fields[1].AsString; textEditNomePessoa.Text := View_PesquisarPessoas.qryPesquisa.Fields[2].AsString; end; finally View_PesquisarPessoas.qryPesquisa.Close; View_PesquisarPessoas.tvPesquisa.ClearItems; FreeAndNil(View_PesquisarPessoas); end; end; procedure Tview_CadastroEntregadores.PesquisaTabelas; var sSQL: String; sWhere: String; begin try sSQL := ''; sWhere := ''; if not Assigned(View_PesquisarPessoas) then begin View_PesquisarPessoas := TView_PesquisarPessoas.Create(Application); end; View_PesquisarPessoas.dxLayoutItem1.Visible := True; View_PesquisarPessoas.dxLayoutItem2.Visible := True; sSQL := 'select cod_tipo as "Código", des_tipo as "Descrição" ' + 'from expressas_tipos_verbas '; sWhere := 'where cod_tipo like paraN or des_tipo like "%param%"'; View_PesquisarPessoas.sSQL := sSQL; View_PesquisarPessoas.sWhere := sWhere; View_PesquisarPessoas.bOpen := True; View_PesquisarPessoas.Caption := 'Pesquisa de Tabelas'; if View_PesquisarPessoas.ShowModal = mrOK then begin buttonEditCodigoTabela.EditValue := View_PesquisarPessoas.qryPesquisa.Fields[1].AsString; textEditDescricaoTabela.Text := View_PesquisarPessoas.qryPesquisa.Fields[2].AsString; end; finally View_PesquisarPessoas.qryPesquisa.Close; View_PesquisarPessoas.tvPesquisa.ClearItems; FreeAndNil(View_PesquisarPessoas); end; end; procedure Tview_CadastroEntregadores.PopulaCampos; begin textEditID.Text := memTableEntregadoresid_entregador.AsString; buttonEditPessoa.EditValue := memTableEntregadorescod_cadastro.AsInteger; textEditNomePessoa.Text := RetornaNomePessoa(memTableEntregadorescod_cadastro.AsInteger); maskEditCodigo.EditValue := memTableEntregadorescod_entregador.AsInteger; textEditNomeFantasia.Text := memTableEntregadoresnom_fantasia.AsString; buttonEditCodigoAgente.EditValue := memTableEntregadorescod_agente.AsInteger; textEditNomeAgente.Text := RetornaNomeAgente(memTableEntregadorescod_agente.AsInteger); dataCodigo := memTableEntregadoresdat_codigo.AsDateTime; textEditCodigoERP.Text := memTableEntregadoresdes_chave.AsString; buttonEditCodigoFaixa.EditValue := memTableEntregadorescod_grupo.AsInteger; currencyEditTicketMedio.Value := memTableEntregadoresval_verba.AsFloat; buttonEditCodigoTabela.EditValue := memTableEntregadorescod_tabela.AsInteger; textEditDescricaoTabela.Text := RetornaDescricaoTabela(memTableEntregadorescod_tabela.AsInteger); lookupComboBoxCliente.EditValue := memTableEntregadorescod_cliente.AsInteger; checkBoxAtivo.EditValue := memTableEntregadoresdom_ativo.AsInteger; end; procedure Tview_CadastroEntregadores.PopulaExpressas(iEntregador: integer); var entregas : TEntregasControl; begin try entregas := TEntregasControl.Create; if memTableExpressas.Active then begin memTableExpressas.Close; end; memTableExpressas.CopyDataSet(entregas.GetAReceber(iEntregador)); finally entregas.Free; end; end; procedure Tview_CadastroEntregadores.PopulaExtravios(iEntregador: integer); var extravios : TExtraviosMultasControl; aParam: array of variant; begin try extravios := TExtraviosMultasControl.Create; SetLength(aParam,1); aParam := ['ENTREGADOR', iEntregador]; if memTableExtravios.Active then begin memTableExtravios.Close; end; memTableExtravios.CopyDataSet(extravios.Localizar(aParam)); Finalize(aParam); finally extravios.Free; end; end; procedure Tview_CadastroEntregadores.PopulaLancamentos(iCadastro: integer); var lancamentos : TLancamentosControl; aParam : array of Variant; begin try lancamentos := TLancamentosControl.Create; if iCadastro = 0 then begin Exit; end; SetLength(aParam,2); aParam := ['ENTREGADOR', iCadastro]; if memTableLancamentos.Active then begin memTableLancamentos.Close; end; memTableLancamentos.Data := lancamentos.Localizar(aParam).Data; Finalize(aParam); finally lancamentos.Free; end; end; function Tview_CadastroEntregadores.RetornaDescricaoTabela(iCodigo: integer): string; var tabela : TTiposVerbasExpressasControl; sRetorno: String; begin try Result := ''; sRetorno := ''; tabela := TTiposVerbasExpressasControl.Create; if icodigo <> 0 then begin sRetorno := tabela.GetField('des_tipo', 'cod_tipo', iCodigo.ToString) end; if sRetorno.IsEmpty then begin sRetorno := 'NONE'; end; Result := sRetorno; finally tabela.free; end; end; function Tview_CadastroEntregadores.RetornaNomeAgente(iCodigo: integer): String; var base : TBasesControl; sRetorno: String; begin try Result := ''; sRetorno := ''; base := TBasesControl.Create; if icodigo <> 0 then begin sRetorno := base.GetField('NOM_FANTASIA', 'COD_AGENTE', iCodigo.ToString) end; if sRetorno.IsEmpty then begin sRetorno := 'NONE'; end; Result := sRetorno; finally base.free; end; end; function Tview_CadastroEntregadores.RetornaNomePessoa(iCodigo: integer): String; var cadastro : TCadastroControl; sRetorno: String; begin try Result := ''; sRetorno := ''; cadastro := TCadastroControl.Create; if icodigo <> 0 then begin sRetorno := cadastro.GetField('DES_RAZAO_SOCIAL', 'COD_CADASTRO', iCodigo.ToString) end; if sRetorno.IsEmpty then begin sRetorno := 'NONE'; end; Result := sRetorno; finally cadastro.free; end; end; function Tview_CadastroEntregadores.RetornaValorFaixa(iCliente,iTabela,iFaixa: Integer): String; var verba : TVerbasExpressasControl; sRetorno: String; begin try Result := ''; sRetorno := ''; verba := TVerbasExpressasControl.Create; sRetorno := verba.RetornaValorFaixa(iCliente,iTabela,iFaixa); if sRetorno.IsEmpty then begin sRetorno := '0,00'; end; Result := sRetorno; finally verba.Free end; end; procedure Tview_CadastroEntregadores.StartForm; begin labelTitle.Caption := Self.Caption; Data_Sisgef.PopulaClientesEmpresa; Data_Sisgef.PopulaBases; if iID = 0 then IncludeData else EditData; end; function Tview_CadastroEntregadores.ValidaDados: boolean; var entregadores: TEntregadoresExpressasControl; tipos: TTiposVerbasExpressasControl; verbas : TVerbasExpressasControl; aParam : array of variant; begin try Result := False; entregadores := TEntregadoresExpressasControl.Create; tipos := TTiposVerbasExpressasControl.Create; verbas := TVerbasExpressasControl.Create; if maskEditCodigo.EditValue = 0 then begin Application.MessageBox('Informe o código do entregador!', 'Atenção', MB_OK + MB_ICONWARNING); Exit; end; if textEditNomeFantasia.Text = '' then begin Application.MessageBox('Informe o noe Fantasia!', 'Atenção', MB_OK + MB_ICONWARNING); Exit; end; if buttonEditPessoa.EditValue = 0 then begin if Application.MessageBox('Código da Pessoa não informado. Continuar?', 'Atenção', MB_YESNO + MB_ICONQUESTION) = IDNO then begin Exit; end; end; if buttonEditCodigoAgente.EditValue = 0 then begin Application.MessageBox('Informe o código do Agente!', 'Atenção', MB_OK + MB_ICONWARNING); Exit; end; if textEditCodigoERP.Text = '' then begin Application.MessageBox('Informe o código ERP!', 'Atenção', MB_OK + MB_ICONWARNING); Exit; end; if lookupComboBoxCliente.ItemIndex = -1 then begin Application.MessageBox('Informe o código do cliente!', 'Atenção', MB_OK + MB_ICONWARNING); Exit; end; if Facao = tacIncluir then begin if entregadores.EntregadorExiste(1,maskEditCodigo.EditValue, lookupComboBoxCliente.EditValue, '') then begin Application.MessageBox('Código de entregador já cadastrado!', 'Atenção', MB_OK + MB_ICONWARNING); Exit; end; if entregadores.GetField('nom_fantasia','nom_fantasia',QuotedStr(textEditNomeFantasia.Text)) <> '' then begin if Application.MessageBox('Nome fantasia já existe. Continuar com este mesmo?', 'Atenção', MB_YESNO + MB_ICONQUESTION) = IDNO then begin Exit; end; end; if entregadores.EntregadorExiste(2,maskEditCodigo.EditValue, 0, textEditCodigoERP.Text) then begin Application.MessageBox('Código ERP já cadastrado!', 'Atenção', MB_OK + MB_ICONWARNING); Exit; end; end; if FAcao = tacAlterar then begin SetLength(aParam,2); aParam := ['ID',StrTOIntDef(textEditID.Text, 0)]; if entregadores.LocalizarExato(aParam) then begin if entregadores.Entregadores.Cadastro <> buttonEditPessoa.EditValue then begin if buttonEditPessoa.EditValue <> 0 then begin if Application.MessageBox('Entregador já está vinculado a outra pessoa. Conrtinuar ?', 'Atenção', MB_YESNO + MB_ICONQUESTION) = IDNO then begin Exit; end; end; end; end; end; if buttonEditCodigoTabela.EditValue <> 0 then begin if tipos.GetField('cod_tipo','cod_tipo',VarToStr(buttonEditCodigoTabela.EditValue)) = '' then begin Application.MessageBox('Código de tabela não cadastrado!', 'Atenção', MB_OK + MB_ICONWARNING); Exit; end; if buttonEditCodigoFaixa.EditValue <> 0 then begin SetLength(aParam,2); aParam := ['FILTRO', 'cod_cliente = ' + VarToStr(lookupComboBoxCliente.EditValue) + ' and cod_tipo = ' + buttonEditCodigoTabela.EditText + ' and id_grupo = ' + buttonEditCodigoFaixa.EditText]; if verbas.Localizar(aParam).IsEmpty then begin Application.MessageBox('Faixa de tabela inexistente!', 'Atenção', MB_OK + MB_ICONWARNING); Exit; end; end; end; if (buttonEditCodigoTabela.EditValue = 0) and (buttonEditCodigoFaixa.EditValue = 0) and (currencyEditTicketMedio.Value = 0) then begin if Application.MessageBox('Nenhum tipo de verba foi informada. Continuar?','Atenção', MB_YESNO + MB_ICONQUESTION) = IDNO then begin Exit; end; end; Result := True; finally if Length(aParam) <> 0 then begin Finalize(aParam); end; entregadores.Free; tipos.Free; verbas.Free; end; end; end.
unit uFuncoes; interface uses System.Types, Winapi.Windows, Vcl.Dialogs, IniFiles, Grids, DBGrids, uDMServer, IdStackWindows, System.SysUtils, Vcl.Forms, FireDAC.Comp.Client, FireDAC.Phys.IBWrapper; Type TConfigINI = record psCaminhoDB : String; psPorta : String; end; Type TFuncoes = class(TObject) private class var FPorta, FConexaoBD: String; class function fncRecuperaNomeComputador: String; class function fncRecuperaNomedoUsuario: String; public class procedure pcdCarregaInformacoes; class procedure GravaIni(psCaminhoBD, psPorta: string); class function LerConfigIni: TConfigINI; class procedure AutoSizeDBGrid(const xDBGrid: TDBGrid); class function getIP: String; end; implementation { TFuncoes } class function TFuncoes.fncRecuperaNomeComputador: String; var Computer: PChar; CSize: DWORD; vlResult: String; begin Computer := #0; CSize := MAX_COMPUTERNAME_LENGTH + 1; try GetMem(Computer,CSize); if GetComputerName(Computer,CSize ) then vlResult := Computer; finally Result := vlResult; FreeMem(Computer); end; end; class function TFuncoes.getIP: String; var IdStackWin: TIdStackWindows; begin try IdStackWin := TIdStackWindows.Create; try Result := IdStackWin.LocalAddresses.Text; finally IdStackWin.Free; end; Except on e :exception do result := e.Message; end; end; class function TFuncoes.fncRecuperaNomedoUsuario: String; var Computer: PChar; CSize: DWORD; vlResult: String; begin Computer := #0; CSize := MAX_COMPUTERNAME_LENGTH + 1; try GetMem(Computer,CSize); if GetUserName(Computer,CSize ) then vlResult := Computer; finally Result := vlResult; FreeMem(Computer); end; end; class procedure TFuncoes.pcdCarregaInformacoes; begin DMServer.FDInformacoes.Close; DMServer.FDInformacoes.Open; DMServer.FDInformacoes.Append; DMServer.FDInformacoesInformacao.AsString := 'Nome do Computador: '; DMServer.FDInformacoesValor.AsString := fncRecuperaNomeComputador; DMServer.FDInformacoes.Post; DMServer.FDInformacoes.Append; DMServer.FDInformacoesInformacao.AsString := 'Nome do Usuário: '; DMServer.FDInformacoesValor.AsString := fncRecuperaNomedoUsuario; DMServer.FDInformacoes.Post; DMServer.FDInformacoes.Append; DMServer.FDInformacoesInformacao.AsString := 'Porta Configurada: '; DMServer.FDInformacoesValor.AsString := FPorta; DMServer.FDInformacoes.Post; DMServer.FDInformacoes.Append; DMServer.FDInformacoesInformacao.AsString := 'Caminho do Banco: '; DMServer.FDInformacoesValor.AsString := FConexaoBD; DMServer.FDInformacoes.Post; DMServer.FDInformacoes.Append; DMServer.FDInformacoesInformacao.AsString := 'Banco de Dados: '; if DMServer.FDConexao.Connected then DMServer.FDInformacoesValor.AsString := 'Conectado' else DMServer.FDInformacoesValor.AsString := 'Desconectado'; DMServer.FDInformacoes.Post; end; class procedure TFuncoes.GravaIni(psCaminhoBD, psPorta: string); var ArqIni: TIniFile; begin ArqIni := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'ConfigServer.ini'); try ArqIni.WriteString('Config', 'CaminhoBD', psCaminhoBD); ArqIni.WriteString('Config', 'Porta', psPorta); finally ArqIni.Free; end; end; class function TFuncoes.LerConfigIni: TConfigINI; var ArqIni: TIniFile; voConfigINI : TConfigINI; begin ArqIni := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'ConfigServer.ini'); try voConfigINI.psCaminhoDB := ArqIni.ReadString('Config', 'CaminhoBD', ''); voConfigINI.psPorta := ArqIni.ReadString('Config', 'Porta', ''); FPorta := voConfigINI.psPorta; FConexaoBD := voConfigINI.psCaminhoDB; finally ArqIni.Free; Result := voConfigINI; end; end; class procedure TFuncoes.AutoSizeDBGrid(const xDBGrid: TDBGrid); var I, TotalWidht, VarWidth, QtdTotalColuna : Integer; xColumn : TColumn; begin // Largura total de todas as colunas antes de redimensionar TotalWidht := 0; // Como dividir todo o espaço extra na grade VarWidth := 0; // Quantas colunas devem ser auto-redimensionamento QtdTotalColuna := 0; for I := 0 to -1 + xDBGrid.Columns.Count do begin TotalWidht := TotalWidht + xDBGrid.Columns[I].Width; if xDBGrid.Columns[I].Field.Tag <> 0 then Inc(QtdTotalColuna); end; // Adiciona 1px para a linha de separador de coluna if dgColLines in xDBGrid.Options then TotalWidht := TotalWidht + xDBGrid.Columns.Count; // Adiciona a largura da coluna indicadora if dgIndicator in xDBGrid.Options then TotalWidht := TotalWidht + IndicatorWidth; // width vale "Left" VarWidth := xDBGrid.ClientWidth - TotalWidht; // Da mesma forma distribuir VarWidth para todas as colunas auto-resizable if QtdTotalColuna > 0 then VarWidth := varWidth div QtdTotalColuna; for I := 0 to -1 + xDBGrid.Columns.Count do begin xColumn := xDBGrid.Columns[I]; if xColumn.Field.Tag <> 0 then begin xColumn.Width := xColumn.Width + VarWidth; if xColumn.Width < xColumn.Field.Tag then xColumn.Width := xColumn.Field.Tag; end; end; end; end.
program TestRtfDoc; { Test program for RtfDoc unit. } {$IFDEF FPC} {$MODE Delphi} {$ELSE} {$APPTYPE CONSOLE} {$ENDIF} {$R+,Q+} uses SysUtils, RtfPars, {Free Pascal unit with TRtfParser class and rtf constants} RtfDoc; {Descendant class used in this program} begin with TRtfDoc.Create do {Create TRtfDoc object} begin try try Start('test.rtf'); {Create RTF file} except on EInOutError do {File read-only or some other I/O error} begin WriteLn('Can''t create file'); Exit; end; end; OutDefaultFontTable(2); {Select font 2 (Arial) as default} OutCtrl(rtfParAttr, rtfQuadCenter, rtfNoParam); {Center line} OutCtrl(rtfCharAttr, rtfBold, 1); {Turn on bolding} OutText('Hello'); {Output some text} OutCtrl(rtfCharAttr, rtfBold, 0); {Turn off bolding} OutText(' there!'); {Output some more text} OutCtrl(rtfSpecialChar, rtfPar, rtfNoParam); {End of paragraph} Done; {Close RTF file} finally Free; {Free TRtfDoc object} end; end; end.
unit clServicosContratos; interface uses clConexao; type TServicosContratos = class(TObject) private constructor Create; destructor Destroy; function getCadastro: Integer; function getCodigo: Integer; procedure setCadastro(const Value: Integer); procedure setCodigo(const Value: Integer); function getTipo: String; procedure setTipo(const Value: String); protected _codigo : Integer; _cadastro : Integer; _tipo : String; _conexao: TConexao; public property Codigo : Integer read getCodigo write setCodigo; property Cadastro : Integer read getCadastro write setCadastro; property Tipo : String read getTipo write setTipo; function Validar(): Boolean; function Delete(filtro: String): Boolean; function getObject(id, filtro: String): Boolean; function Insert(): Boolean; function Update(): Boolean; function getField(campo, coluna: String): String; end; const TABLENAME = 'TBSERVICOSCONTRATOS'; implementation uses SysUtils, Dialogs, udm, clUtil, ZDataset, ZAbstractRODataset, DB; { TServicosContratos } function TServicosContratos.getCadastro: Integer; begin Result := _cadastro; end; function TServicosContratos.getCodigo: Integer; begin Result := _codigo; end; function TServicosContratos.getTipo: String; begin Result := _tipo; end; constructor TServicosContratos.Create; begin _conexao := TConexao.Create; end; destructor TServicosContratos.Destroy; begin _conexao.Free; end; function TServicosContratos.Validar(): Boolean; begin try Result := False; if Self.Codigo = 0 then begin MessageDlg('Informe o código do Serviço!', mtWarning, [mbOK], 0); Exit; end; if Self.Cadastro = 0 then begin MessageDlg('Informe o código do Funcionário/Empresa!', mtWarning, [mbOK], 0); Exit; end; if Self.Tipo.IsEmpty then begin MessageDlg('Informe se o serviço é de Funcionário ou Empresa!', mtWarning, [mbOK], 0); Exit; end; Result := True; Except on E: Exception do ShowMessage('Classe: ' + E.ClassName + chr(13) + 'Mensagem: ' + E.Message); end; end; function TServicosContratos.Delete(filtro: String): Boolean; begin try Result := False; if (not _conexao.VerifyConnZEOS(0)) then begin MessageDlg('Erro ao estabelecer conexão ao banco de dados (' + Self.ClassName + ') !', mtError, [mbCancel], 0); end; with dm.QryCRUD do begin Close; SQL.Clear; SQL.Add('DELETE FROM ' + TABLENAME); if filtro = 'CODIGO' then begin SQL.Add('WHERE COD_SERVCO = :CODIGO'); ParamByName('CODIGO').AsInteger := Self.Codigo; end else if filtro = 'CADASTRO' then begin SQL.Add('WHERE COD_CADASTRO = :CADASTRO'); ParamByName('CADASTRO').AsInteger := Self.Cadastro; end; dm.ZConn.PingServer; ExecSQL; end; dm.QryCRUD.Close; dm.QryCRUD.SQL.Clear; Result := True; except on E: Exception do ShowMessage('Classe: ' + E.ClassName + chr(13) + 'Mensagem: ' + E.Message); end; end; function TServicosContratos.getObject(id, filtro: String): Boolean; begin try Result := False; if TUtil.Empty(id) then begin Exit; end; if (not _conexao.VerifyConnZEOS(0)) then begin MessageDlg('Erro ao estabelecer conexão ao banco de dados (' + Self.ClassName + ') !', mtError, [mbCancel], 0); end; with dm.QryGetObject do begin Close; SQL.Clear; SQL.Add('SELECT * FROM ' + TABLENAME); if filtro = 'CODIGO' then begin SQL.Add('WHERE COD_SERVICO = :CODIGO'); ParamByName('CODIGO').AsInteger := StrToInt(id); end else if filtro = 'CADASTRO' then begin SQL.Add('WHERE COD_CADASTRO = :CADASTRO'); ParamByName('CADASTRO').AsInteger := StrToInt(id); end; dm.ZConn.PingServer; Open; if not IsEmpty then First; end; if dm.QryGetObject.RecordCount > 0 then begin Self.Codigo := dm.QryGetObject.FieldByName('COD_SERVICO').AsInteger; Self.Cadastro := dm.QryGetObject.FieldByName('COD_CADASTRO').AsInteger; Self.Tipo := dm.QryGetObject.FieldByName('DOM_TIPO').AsString; Result := True; end else begin dm.QryGetObject.Close; dm.QryGetObject.SQL.Clear; end; Except on E: Exception do ShowMessage('Classe: ' + E.ClassName + chr(13) + 'Mensagem: ' + E.Message); end; end; function TServicosContratos.Insert(): Boolean; begin try Result := False; if (not _conexao.VerifyConnZEOS(0)) then begin MessageDlg('Erro ao estabelecer conexão ao banco de dados (' + Self.ClassName + ') !', mtError, [mbCancel], 0); end; with dm.QryCRUD do begin Close; SQL.Clear; SQL.Text := 'INSERT INTO ' + TABLENAME + '(' + 'COD_SERVICO, ' + 'COD_CADASTRO, ' + 'DOM_TIPO) ' + 'VALUES (' + ':CODIGO, ' + ':CADASTRO' + ':TIPO);'; ParamByName('CODIGO').AsInteger := Self.Codigo; ParamByName('CADASTRO').AsInteger := Self.Cadastro; ParamByName('TIPO').AsString := Self.Tipo; dm.ZConn.PingServer; ExecSQL; end; dm.QryCRUD.Close; dm.QryCRUD.SQL.Clear; Result := True; Except on E: Exception do ShowMessage('Classe: ' + E.ClassName + chr(13) + 'Mensagem: ' + E.Message); end; end; function TServicosContratos.Update(): Boolean; begin try Result := False; if (not _conexao.VerifyConnZEOS(0)) then begin MessageDlg('Erro ao estabelecer conexão ao banco de dados (' + Self.ClassName + ') !', mtError, [mbCancel], 0); end; with dm.QryCRUD do begin Close; SQL.Clear; SQL.Text := 'UPDATE ' + TABLENAME + ' SET ' + 'COD_CADASTRO = :CADASTRO, ' + 'DOM_TIPO = :TIPO ' + 'WHERE COD_CADASTRO = :CADASTRO'; ParamByName('CODIGO').AsInteger := Self.Codigo; ParamByName('CADASTRO').AsInteger := Self.Cadastro; ParamByName('TIPO').AsString := Self.Tipo; dm.ZConn.PingServer; ExecSQL; end; dm.QryCRUD.Close; dm.QryCRUD.SQL.Clear; Result := True; Except on E: Exception do ShowMessage('Classe: ' + E.ClassName + chr(13) + 'Mensagem: ' + E.Message); end; end; function TServicosContratos.getField(campo, coluna: String): String; begin try Result := ''; if (not _conexao.VerifyConnZEOS(0)) then begin MessageDlg('Erro ao estabelecer conexão ao banco de dados (' + Self.ClassName + ') !', mtError, [mbCancel], 0); end; with dm.QryGetObject do begin Close; SQL.Clear; SQL.Text := 'SELECT ' + campo + ' FROM ' + TABLENAME; if coluna = 'CODIGO' then begin SQL.Add(' WHERE COD_SERVICO = :CODIGO '); ParamByName('CODIGO').AsInteger := Self.Codigo; end else if coluna = 'CADASTRO' then begin SQL.Add(' WHERE COD_CADASTRO = :CADASTRO '); ParamByName('CADASTRO').AsInteger := Self.Cadastro; end; dm.ZConn.PingServer; Open; if not IsEmpty then First; end; if dm.QryGetObject.RecordCount > 0 then Result := dm.QryGetObject.FieldByName(campo).AsString; dm.QryGetObject.Close; dm.QryGetObject.SQL.Clear; Except on E: Exception do ShowMessage('Classe: ' + E.ClassName + chr(13) + 'Mensagem: ' + E.Message); end; end; procedure TServicosContratos.setCadastro(const Value: Integer); begin _cadastro := Value; end; procedure TServicosContratos.setCodigo(const Value: Integer); begin _codigo := Value; end; procedure TServicosContratos.setTipo(const Value: String); begin _tipo := Value; end; end.
unit vcmMenuManagerRes; // Модуль: "w:\common\components\gui\Garant\VCM\implementation\vcmMenuManagerRes.pas" // Стереотип: "UtilityPack" // Элемент модели: "vcmMenuManagerRes" MUID: (4B8E967F00BE) {$Include w:\common\components\gui\Garant\VCM\vcmDefine.inc} interface {$If NOT Defined(NoVCM)} uses l3IntfUses , l3StringIDEx ; const {* Локализуемые строки TvcmUserTypeHints } str_vcmCloseHint: Tl3StringIDEx = (rS : -1; rLocalized : false; rKey : 'vcmCloseHint'; rValue : 'Закрыть'); {* 'Закрыть' } str_vcmMaximizedHint: Tl3StringIDEx = (rS : -1; rLocalized : false; rKey : 'vcmMaximizedHint'; rValue : 'Открыть в новом окне'); {* 'Открыть в новом окне' } str_vcmOpenHint: Tl3StringIDEx = (rS : -1; rLocalized : false; rKey : 'vcmOpenHint'; rValue : 'Открыть в текущем окне'); {* 'Открыть в текущем окне' } {$IfEnd} // NOT Defined(NoVCM) implementation {$If NOT Defined(NoVCM)} uses l3ImplUses //#UC START# *4B8E967F00BEimpl_uses* //#UC END# *4B8E967F00BEimpl_uses* ; initialization str_vcmCloseHint.Init; {* Инициализация str_vcmCloseHint } str_vcmMaximizedHint.Init; {* Инициализация str_vcmMaximizedHint } str_vcmOpenHint.Init; {* Инициализация str_vcmOpenHint } {$IfEnd} // NOT Defined(NoVCM) end.
unit Thread.ImportarPlanilhaEntradaEntregas; interface uses System.Classes, Dialogs, Windows, Forms, SysUtils, Messages, Controls, System.DateUtils, System.StrUtils, Generics.Collections, Control.Entregas, Control.PlanilhaEntradaEntregas, Control.EntregadoresExpressas, Control.DestinosTransportes, FireDAC.Comp.Client, Control.Sistema, Model.PlanilhaEntradaEntregas; type Thread_ImportarPlanilhaEntradaEntregas = class(TThread) private { Private declarations } destinos : TDestinosTransportesControl; entregas: TEntregasControl; planilha : TPlanilhasEntradasEntregasControl; planilhas : TObjectList<TPlanilhaEntradaEntregas>; sMensagem: String; FdPos: Double; iLinha: Integer; iPos : Integer; iTotal : Integer; protected procedure Execute; override; procedure AtualizaLog; procedure AtualizaProgress; procedure TerminaProcesso; procedure IniciaProcesso; public FFile: String; bCancel : Boolean; iCodigoCliente : Integer; end; implementation { Important: Methods and properties of objects in visual components can only be used in a method called using Synchronize, for example, Synchronize(UpdateCaption); and UpdateCaption could look like, procedure Thread_ImportarPlanilhaEntradaEntregas.UpdateCaption; begin Form1.Caption := 'Updated in a thread'; end; or Synchronize( procedure begin Form1.Caption := 'Updated in thread via an anonymous method' end ) ); where an anonymous method is passed. Similarly, the developer can call the Queue method with similar parameters as above, instead passing another TThread class as the first parameter, putting the calling thread in a queue with the other thread. } { Thread_ImportarPlanilhaEntradaEntregas } uses Common.Utils, Global.Parametros, Common.ENum, View.ImportarPedidos; procedure Thread_ImportarPlanilhaEntradaEntregas.Execute; var Contador, I, LinhasTotal, iRet: Integer; Linha, campo, codigo, sMess, sData: String; d: Real; aParam: array of Variant; FDQuery : TFDQuery; FDQuery1 : TFDQuery; begin try try entregas := TEntregasControl.Create; planilha := TPlanilhasEntradasEntregasControl.Create; planilhas := TObjectList<TPlanilhaEntradaEntregas>.Create; destinos := TDestinosTransportesControl.Create; // Carregando o arquivo ... planilhas := planilha.GetPlanilha(FFile); if planilhas.Count > 0 then begin iPos := 0; FdPos := 0; iTotal := planilhas.Count; Synchronize(IniciaProcesso); for I := 0 to planilhas.Count - 1 do begin FDQuery := TSistemaControl.GetInstance.Conexao.ReturnQuery; SetLength(aParam,2); aParam[0] := 'NN'; aParam[1] := planilhas[i].NossoNumero; FDQuery := entregas.Localizar(aParam); Finalize(aParam); if FDQuery.IsEmpty then begin entregas.Entregas.Distribuidor := 0; entregas.Entregas.Entregador := 0; entregas.Entregas.NN := planilhas[I].NossoNumero; entregas.Entregas.Cliente := StrToInt(planilhas[I].CodigoCliente); entregas.Entregas.NF := planilhas[I].NumeroNF; entregas.Entregas.Consumidor := planilhas[I].NomeConsumidor; entregas.Entregas.Endereco := planilhas[I].Logradouro; entregas.Entregas.Complemento := Copy(Trim(planilhas[I].Complemento) + ' ' + Trim(planilhas[I].AosCuidados), 1,70); entregas.Entregas.Bairro := planilhas[I].Bairro; entregas.Entregas.Cidade := planilhas[I].Cidade; entregas.Entregas.Cep := planilhas[I].CEP; entregas.Entregas.Telefone := Copy(planilhas[I].Telefone, 1, 30); entregas.Entregas.Expedicao := StrToDate(planilhas[I].Expedicao); entregas.Entregas.Previsao := StrToDate(planilhas[I].Previsao); entregas.Entregas.Status := StrToInt(planilhas[I].Status); entregas.Entregas.Baixado := 'N'; planilhas[I].ValorVerba := ReplaceStr(planilhas[I].ValorVerba, 'R$ ', ''); entregas.Entregas.VerbaFranquia := StrToFloatDef(planilhas[I].ValorVerba,0); planilhas[I].Peso := ReplaceStr(planilhas[I].Peso, ' KG', ''); planilhas[I].Peso := ReplaceStr(planilhas[I].Peso, '.', ','); entregas.Entregas.PesoReal := StrToFloatDef(planilhas[I].Peso,0); entregas.Entregas.Volumes := StrToInt(planilhas[I].Volume); entregas.Entregas.VolumesExtra := 0; entregas.Entregas.ValorVolumes := 0; entregas.Entregas.Atraso := 0; entregas.Entregas.Container := planilhas[I].Container; planilhas[I].ValorProuto := ReplaceStr(planilhas[I].ValorProuto, 'R$ ', ''); planilhas[I].ValorProuto := ReplaceStr(planilhas[I].ValorProuto, '.', ''); entregas.Entregas.ValorProduto := StrToFloatDef(planilhas[I].ValorProuto,0); entregas.Entregas.Altura := StrToIntDef(planilhas[I].Altura, 0); entregas.Entregas.Largura := StrToIntDef(planilhas[I].Largura, 0); entregas.Entregas.Comprimento := StrToIntDef(planilhas[I].Comprimento, 0); entregas.Entregas.Rastreio := '> ' + FormatDateTime('yyyy/mm/dd hh:mm:ss', Now) + ' importado por ' + Global.Parametros.pUser_Name; entregas.Entregas.CodCliente := iCodigoCliente; entregas.Entregas.Acao := tacIncluir; if not entregas.Gravar then begin sMensagem := 'Erro ao Incluir os dados do NN ' + entregas.Entregas.NN + ' !'; Synchronize(AtualizaLog); end; FDQuery.Connection.Close; FDQuery.Free; FDQuery1 := TSistemaControl.GetInstance.Conexao.ReturnQuery; SetLength(aParam,2); aParam[0] := 'CODIGO'; aParam[1] := StrToIntDef(planilhas[I].CodigoDestino, 0); FDQuery1 := destinos.Localizar(aParam); Finalize(aParam); if FDQuery1.IsEmpty then begin FDQuery1.Connection.Close; FDQuery1.Free; destinos.Destinos.Destino := StrToIntDef(planilhas[I].CodigoDestino, 0); destinos.Destinos.Descricao := planilhas[I].NomeDestino; destinos.Destinos.Log := '> ' + FormatDateTime('yyyy-mm-dd hh:mm:ss', Now()) + ' incluso por ' + Global.Parametros.pUser_Name; if not destinos.gravar then begin sMensagem := 'Erro ao incluir o destino ' + destinos.Destinos.Descricao + ' !'; Synchronize(AtualizaLog); end; end else begin FDQuery1.Connection.Close; FDQuery1.Free; end; end else begin FDQuery.Connection.Close; FDQuery.Free; end; iPos := iPos + 1; FdPos := (iPos / iTotal) * 100; if not(Self.Terminated) then begin Synchronize(AtualizaProgress); end else begin Abort; end; end; end; Except on E: Exception do begin Application.MessageBox(PChar('Classe: ' + E.ClassName + chr(13) + 'Mensagem: ' + E.Message), 'Erro', MB_OK + MB_ICONERROR); bCancel := True; end; end; finally if bCancel then begin sMensagem := FormatDateTime('yyyy/mm/dd hh:mm:ss', Now) + ' importação cancelada ...'; Synchronize(AtualizaLog); Application.MessageBox('Importação cancelada!', 'Importação de Entregas', MB_OK + MB_ICONWARNING); end else begin sMensagem := FormatDateTime('yyyy/mm/dd hh:mm:ss', Now) + ' importação concluída com sucesso'; Synchronize(AtualizaLog); Application.MessageBox('Importação concluída com sucesso!', 'Importação de Entregas', MB_OK + MB_ICONINFORMATION); end; Synchronize(TerminaProcesso); entregas.Free; destinos.Free; planilhas.Free; end; end; procedure Thread_ImportarPlanilhaEntradaEntregas.IniciaProcesso; begin bCancel := False; view_ImportarPedidos.actCancelar.Enabled := True; view_ImportarPedidos.actFechar.Enabled := False; view_ImportarPedidos.actImportar.Enabled := False; view_ImportarPedidos.actAbrirArquivo.Enabled := False; view_ImportarPedidos.dxLayoutItem8.Visible := True; sMensagem := FormatDateTime('yyyy/mm/dd hh:mm:ss', Now) + ' iniciando importação de ' + iTotal.ToString + ' registros do arquivo ' + FFile; AtualizaLog; end; procedure Thread_ImportarPlanilhaEntradaEntregas.AtualizaLog; begin view_ImportarPedidos.memLOG.Lines.Add(sMensagem); view_ImportarPedidos.memLOG.Lines.Add(''); iLinha := view_ImportarPedidos.memLOG.Lines.Count - 1; view_ImportarPedidos.memLOG.Refresh; end; procedure Thread_ImportarPlanilhaEntradaEntregas.AtualizaProgress; begin view_ImportarPedidos.pbImportacao.Position := FdPos; view_ImportarPedidos.pbImportacao.Properties.Text := FormatFloat('0.00%',FdPos); view_ImportarPedidos.pbImportacao.Refresh; view_ImportarPedidos.memLOG.Lines[iLinha] := ' >>> ' + IntToStr(iPos) + ' registros processados'; view_ImportarPedidos.memLOG.Refresh; if not(view_ImportarPedidos.actCancelar.Visible) then begin view_ImportarPedidos.actCancelar.Visible := True; view_ImportarPedidos.actFechar.Enabled := False; view_ImportarPedidos.actImportar.Enabled := False; end; end; procedure Thread_ImportarPlanilhaEntradaEntregas.TerminaProcesso; begin view_ImportarPedidos.actCancelar.Enabled := False; view_ImportarPedidos.actFechar.Enabled := True; view_ImportarPedidos.actImportar.Enabled := True; view_ImportarPedidos.actAbrirArquivo.Enabled := True; view_ImportarPedidos.edtArquivo.Clear; view_ImportarPedidos.pbImportacao.Position := 0; view_ImportarPedidos.pbImportacao.Clear; view_ImportarPedidos.dxLayoutItem8.Visible := False; view_ImportarPedidos.cboCliente.ItemIndex := 0; end; end.
unit UWIZSendPASC_EnterRecipient; {$mode delphi} {$modeswitch nestedprocvars} { Copyright (c) 2018 Sphere 10 Software (http://www.sphere10.com/) Distributed under the MIT software license, see the accompanying file LICENSE or visit http://www.opensource.org/licenses/mit-license.php. Acknowledgements: Ugochukwu Mmaduekwe - main developer Herman Schoenfeld - designer } interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Buttons, UCommon, UCommon.Collections, UWallet, UCoreObjects, UFRMAccountSelect, UNode, UWizard, UWIZSendPASC, UWIZSendPASC_EnterQuantity, UCoreUtils; type { TWIZSendPASC_EnterRecipient } TWIZSendPASC_EnterRecipient = class(TWizardForm<TExecuteOperationsModel>) edtDestAcc: TEdit; gbRecipient: TGroupBox; lblDestAccNumber: TLabel; lblDestAccNumberValue: TLabel; lblDestAccNumberName: TLabel; lblDestAccNumberNameValue: TLabel; lblDestNotice: TLabel; btnSearch: TSpeedButton; procedure btnSearchClick(Sender: TObject); procedure edtDestAccChange(Sender: TObject); procedure UpdateUI(); public procedure OnPresent; override; procedure OnNext; override; function Validate(out message: ansistring): boolean; override; end; implementation {$R *.lfm} uses UAccounts, UUserInterface, USettings; { TWIZSendPASC_EnterRecipient } procedure TWIZSendPASC_EnterRecipient.edtDestAccChange(Sender: TObject); begin UpdateUI(); end; procedure TWIZSendPASC_EnterRecipient.UpdateUI(); var LTempAccount: TAccount; LAccountNumber: cardinal; begin if TAccountComp.AccountTxtNumberToAccountNumber(edtDestAcc.Text, LAccountNumber) then begin if (LAccountNumber < 0) or (LAccountNumber >= TNode.Node.Bank.AccountsCount) then begin lblDestAccNumberValue.Caption := 'Unknown'; lblDestAccNumberNameValue.Caption := 'Unknown'; Exit; end; LTempAccount := TNode.Node.Operations.SafeBoxTransaction.account(LAccountNumber); lblDestAccNumberValue.Caption := edtDestAcc.Text; lblDestAccNumberNameValue.Caption := LTempAccount.Name; end else begin lblDestAccNumberValue.Caption := 'Unknown'; lblDestAccNumberNameValue.Caption := 'Unknown'; end; end; procedure TWIZSendPASC_EnterRecipient.OnPresent; begin UpdateUI(); edtDestAcc.SetFocus; end; procedure TWIZSendPASC_EnterRecipient.btnSearchClick(Sender: TObject); var LFRMAccountSelect: TFRMAccountSelect; LAccountNumber: cardinal; begin LFRMAccountSelect := TFRMAccountSelect.Create(Self); LFRMAccountSelect.Position := poMainFormCenter; try LFRMAccountSelect.Node := TNode.Node; LFRMAccountSelect.WalletKeys := TWallet.Keys; LFRMAccountSelect.Filters := edtDestAcc.Tag; if TAccountComp.AccountTxtNumberToAccountNumber(edtDestAcc.Text, LAccountNumber) then LFRMAccountSelect.DefaultAccount := LAccountNumber; LFRMAccountSelect.AllowSelect := True; if LFRMAccountSelect.ShowModal = mrOk then edtDestAcc.Text := TAccountComp.AccountNumberToAccountTxtNumber(LFRMAccountSelect.GetSelected); finally LFRMAccountSelect.Free; end; end; procedure TWIZSendPASC_EnterRecipient.OnNext; var LAccountNumber: cardinal; LAccount: TAccount; begin TAccountComp.AccountTxtNumberToAccountNumber(edtDestAcc.Text, LAccountNumber); Model.SendPASC.DestinationAccount := TNode.Node.Operations.SafeBoxTransaction.account(LAccountNumber); UpdatePath(ptInject, [TWIZSendPASC_EnterQuantity]); end; function TWIZSendPASC_EnterRecipient.Validate(out message: ansistring): boolean; function GetAccountNumberWithChecksum(constref AAccount: TAccount): string; begin Result := AAccount.AccountString; end; var LAccountNumbersWithChecksum: TArray<string>; LAccountNumber: cardinal; begin Result := True; if not (TAccountComp.AccountTxtNumberToAccountNumber(edtDestAcc.Text, LAccountNumber)) then begin message := Format('Invalid Destination Account "%s"', [edtDestAcc.Text]); Result := False; Exit; end; if (LAccountNumber < 0) or (LAccountNumber >= TNode.Node.Bank.AccountsCount) then begin message := Format('Invalid Destination Account "%s"', [TAccountComp.AccountNumberToAccountTxtNumber(LAccountNumber)]); Result := False; Exit; end; LAccountNumbersWithChecksum := TListTool<TAccount, string>.Transform(Model.Account.SelectedAccounts, GetAccountNumberWithChecksum); if TArrayTool<string>.Contains(LAccountNumbersWithChecksum, edtDestAcc.Text) then begin message := 'Sender And Destination Account Are Same'; Result := False; Exit; end; end; end.
program GRAPH1 ( OUTPUT ) ; //*************************************** // graphic representation of a function // f(x) = exp(-x) * sin(2*pi*x) //*************************************** const D = 0.0625 ; // 1 / 16, 16 lines for interval [x, x+1] S = 40 ; // 40 character widths for interval [y, y+1] H = 34 ; // character position of x-axis C = 6.28318 ; // 2 * pi LIM = 32 ; var X , Y : REAL ; I , N : INTEGER ; begin (* HAUPTPROGRAMM *) for I := 0 to LIM do begin X := D * I ; Y := EXP ( - X ) * SIN ( C * X ) ; N := ROUND ( S * Y ) + H ; WRITELN ( '*' : N ) end (* for *) end (* HAUPTPROGRAMM *) .
unit evdBadEVDToEmptyDocumentTranslator; // Модуль: "w:\common\components\gui\Garant\Everest\evdBadEVDToEmptyDocumentTranslator.pas" // Стереотип: "SimpleClass" // Элемент модели: "TevdBadEVDToEmptyDocumentTranslator" MUID: (53BC0D790357) {$Include w:\common\components\gui\Garant\Everest\evDefine.inc} interface uses l3IntfUses , k2TagTranslator , k2Base , l3Variant , k2TagGen ; type TevdBadEVDToEmptyDocumentTranslator = class(Tk2TagTranslator) private f_WasDocumentOpened: Boolean; f_DocType: Tk2Type; f_DocLanguage: Integer; protected procedure StartChild(TypeID: Tl3Type); override; procedure OpenStream; override; {* вызывается один раз при начале генерации. Для перекрытия в потомках. } procedure CloseStream(NeedUndo: Boolean); override; {* вызывается один раз в конце генерации. Для перекрытия в потомках. } public constructor Create(aDocType: Tk2Type; aDocLanguage: Integer); reintroduce; class procedure SetTo(var theGenerator: Ik2TagGenerator; aDocType: Tk2Type; aDocLanguage: Integer); overload; class procedure SetTo(var theGenerator: Tk2TagGenerator; aDocType: Tk2Type; aDocLanguage: Integer); overload; end;//TevdBadEVDToEmptyDocumentTranslator implementation uses l3ImplUses , Para_Const , Document_Const , k2Tags , SysUtils //#UC START# *53BC0D790357impl_uses* //#UC END# *53BC0D790357impl_uses* ; constructor TevdBadEVDToEmptyDocumentTranslator.Create(aDocType: Tk2Type; aDocLanguage: Integer); //#UC START# *53BD37FF01C1_53BC0D790357_var* //#UC END# *53BD37FF01C1_53BC0D790357_var* begin //#UC START# *53BD37FF01C1_53BC0D790357_impl* inherited Create; f_DocType := aDocType; f_DocLanguage := aDocLanguage; //#UC END# *53BD37FF01C1_53BC0D790357_impl* end;//TevdBadEVDToEmptyDocumentTranslator.Create class procedure TevdBadEVDToEmptyDocumentTranslator.SetTo(var theGenerator: Ik2TagGenerator; aDocType: Tk2Type; aDocLanguage: Integer); //#UC START# *53BD38250015_53BC0D790357_var* var l_G : TevdBadEVDToEmptyDocumentTranslator; //#UC END# *53BD38250015_53BC0D790357_var* begin //#UC START# *53BD38250015_53BC0D790357_impl* l_G := Create(aDocType, aDocLanguage); try l_G.Generator := theGenerator; theGenerator := l_G; finally FreeAndNil(l_G); end;//try..finally //#UC END# *53BD38250015_53BC0D790357_impl* end;//TevdBadEVDToEmptyDocumentTranslator.SetTo class procedure TevdBadEVDToEmptyDocumentTranslator.SetTo(var theGenerator: Tk2TagGenerator; aDocType: Tk2Type; aDocLanguage: Integer); //#UC START# *53BE871800DF_53BC0D790357_var* var l_G : TevdBadEVDToEmptyDocumentTranslator; //#UC END# *53BE871800DF_53BC0D790357_var* begin //#UC START# *53BE871800DF_53BC0D790357_impl* l_G := Create(aDocType, aDocLanguage); try l_G.Generator := theGenerator; l_G.SetRefTo(theGenerator); finally FreeAndNil(l_G); end;//try..finally //#UC END# *53BE871800DF_53BC0D790357_impl* end;//TevdBadEVDToEmptyDocumentTranslator.SetTo procedure TevdBadEVDToEmptyDocumentTranslator.StartChild(TypeID: Tl3Type); //#UC START# *4836D4650177_53BC0D790357_var* //#UC END# *4836D4650177_53BC0D790357_var* begin //#UC START# *4836D4650177_53BC0D790357_impl* inherited; if TypeID.IsKindOf(k2_typDocument) then f_WasDocumentOpened := true; //#UC END# *4836D4650177_53BC0D790357_impl* end;//TevdBadEVDToEmptyDocumentTranslator.StartChild procedure TevdBadEVDToEmptyDocumentTranslator.OpenStream; {* вызывается один раз при начале генерации. Для перекрытия в потомках. } //#UC START# *4836D49800CA_53BC0D790357_var* //#UC END# *4836D49800CA_53BC0D790357_var* begin //#UC START# *4836D49800CA_53BC0D790357_impl* inherited; f_WasDocumentOpened := false; //#UC END# *4836D49800CA_53BC0D790357_impl* end;//TevdBadEVDToEmptyDocumentTranslator.OpenStream procedure TevdBadEVDToEmptyDocumentTranslator.CloseStream(NeedUndo: Boolean); {* вызывается один раз в конце генерации. Для перекрытия в потомках. } //#UC START# *4836D4B003DC_53BC0D790357_var* //#UC END# *4836D4B003DC_53BC0D790357_var* begin //#UC START# *4836D4B003DC_53BC0D790357_impl* if not f_WasDocumentOpened then begin if (Generator <> nil) then begin if (f_DocType = nil) then Generator.StartChild(k2_typDocument) else Generator.StartChild(f_DocType); Generator.AddIntegerAtom(k2_tiLanguage, f_DocLanguage); Generator.StartDefaultChild; Generator.Finish; Generator.Finish; end;//Generator <> nil end;//not f_WasDocumentOpened inherited; //#UC END# *4836D4B003DC_53BC0D790357_impl* end;//TevdBadEVDToEmptyDocumentTranslator.CloseStream end.
unit l3MultiThreadIntegerList; // Модуль: "w:\common\components\rtl\Garant\L3\l3MultiThreadIntegerList.pas" // Стереотип: "UtilityPack" // Элемент модели: "l3MultiThreadIntegerList" MUID: (53A2C805017C) {$Include w:\common\components\rtl\Garant\L3\l3Define.inc} interface uses l3IntfUses , l3ProtoObject , l3ProtoIntegerList , SyncObjs ; type IntegerIterator_ForEachF_Action = function(anItem: Integer): Boolean; {* Тип подитеративной функции для IntegerIterator.ForEachF } IntegerIterator_ForOneF_Action = function(anItem: Integer): Boolean; {* Тип подитеративной функции для IntegerIterator.ForOneF } (* IntegerIterator = interface procedure ForEachF(anAction: IntegerIterator_ForEachF_Action); procedure ForOneF(anAction: IntegerIterator_ForOneF_Action; anIndex: Integer); end;//IntegerIterator *) _l3CriticalSectionHolder_Parent_ = Tl3ProtoObject; {$Include w:\common\components\rtl\Garant\L3\l3CriticalSectionHolder.imp.pas} Tl3MultiThreadIntegerList = class(_l3CriticalSectionHolder_) private f_Items: Tl3ProtoIntegerList; protected function NeedSort: Boolean; virtual; procedure Cleanup; override; {* Функция очистки полей объекта. } procedure InitFields; override; public procedure Add(anItem: Integer); procedure Remove(anItem: Integer); procedure Clear; procedure ForEachF(anAction: IntegerIterator_ForEachF_Action); procedure ForOneF(anAction: IntegerIterator_ForOneF_Action; anIndex: Integer); protected property Items: Tl3ProtoIntegerList read f_Items; end;//Tl3MultiThreadIntegerList function L2IntegerIteratorForEachFAction(anAction: Pointer): IntegerIterator_ForEachF_Action; {* Функция формирования заглушки для ЛОКАЛЬНОЙ подитеративной функции для IntegerIterator.ForEachF } function L2IntegerIteratorForOneFAction(anAction: Pointer): IntegerIterator_ForOneF_Action; {* Функция формирования заглушки для ЛОКАЛЬНОЙ подитеративной функции для IntegerIterator.ForOneF } implementation uses l3ImplUses , l3Base , SysUtils //#UC START# *53A2C805017Cimpl_uses* //#UC END# *53A2C805017Cimpl_uses* ; function L2IntegerIteratorForEachFAction(anAction: Pointer): IntegerIterator_ForEachF_Action; {* Функция формирования заглушки для ЛОКАЛЬНОЙ подитеративной функции для IntegerIterator.ForEachF } asm jmp l3LocalStub end;//L2IntegerIteratorForEachFAction function L2IntegerIteratorForOneFAction(anAction: Pointer): IntegerIterator_ForOneF_Action; {* Функция формирования заглушки для ЛОКАЛЬНОЙ подитеративной функции для IntegerIterator.ForOneF } asm jmp l3LocalStub end;//L2IntegerIteratorForOneFAction {$Include w:\common\components\rtl\Garant\L3\l3CriticalSectionHolder.imp.pas} procedure Tl3MultiThreadIntegerList.Add(anItem: Integer); //#UC START# *53A2C8C10024_53A2C7AA03BF_var* //#UC END# *53A2C8C10024_53A2C7AA03BF_var* begin //#UC START# *53A2C8C10024_53A2C7AA03BF_impl* Lock; try Items.Add(anItem); finally Unlock; end;//try..finally //#UC END# *53A2C8C10024_53A2C7AA03BF_impl* end;//Tl3MultiThreadIntegerList.Add procedure Tl3MultiThreadIntegerList.Remove(anItem: Integer); //#UC START# *53A2C8EE02B5_53A2C7AA03BF_var* //#UC END# *53A2C8EE02B5_53A2C7AA03BF_var* begin //#UC START# *53A2C8EE02B5_53A2C7AA03BF_impl* Lock; try Items.Remove(anItem); finally Unlock; end;//try..finally //#UC END# *53A2C8EE02B5_53A2C7AA03BF_impl* end;//Tl3MultiThreadIntegerList.Remove function Tl3MultiThreadIntegerList.NeedSort: Boolean; //#UC START# *53A2C90A0344_53A2C7AA03BF_var* //#UC END# *53A2C90A0344_53A2C7AA03BF_var* begin //#UC START# *53A2C90A0344_53A2C7AA03BF_impl* Result := false; //#UC END# *53A2C90A0344_53A2C7AA03BF_impl* end;//Tl3MultiThreadIntegerList.NeedSort procedure Tl3MultiThreadIntegerList.Clear; //#UC START# *53A84920013D_53A2C7AA03BF_var* //#UC END# *53A84920013D_53A2C7AA03BF_var* begin //#UC START# *53A84920013D_53A2C7AA03BF_impl* Lock; try Items.Clear; finally Unlock; end;//try..finally //#UC END# *53A84920013D_53A2C7AA03BF_impl* end;//Tl3MultiThreadIntegerList.Clear procedure Tl3MultiThreadIntegerList.ForEachF(anAction: IntegerIterator_ForEachF_Action); //#UC START# *53A2C89B0302_53A2C7AA03BF_var* function DoIt(aData : PInteger; anIndex : Integer) : Boolean; begin Result := anAction(aData^); end; var Hack : Pointer absolute anAction; //#UC END# *53A2C89B0302_53A2C7AA03BF_var* begin //#UC START# *53A2C89B0302_53A2C7AA03BF_impl* try Lock; try f_Items.IterateAllF(l3L2IA(@DoIt)); finally Unlock; end;//try..finally finally l3FreeLocalStub(Hack); end;//try..finally //#UC END# *53A2C89B0302_53A2C7AA03BF_impl* end;//Tl3MultiThreadIntegerList.ForEachF procedure Tl3MultiThreadIntegerList.ForOneF(anAction: IntegerIterator_ForOneF_Action; anIndex: Integer); //#UC START# *53A84EAD0005_53A2C7AA03BF_var* var Hack : Pointer absolute anAction; //#UC END# *53A84EAD0005_53A2C7AA03BF_var* begin //#UC START# *53A84EAD0005_53A2C7AA03BF_impl* try Lock; try if (anIndex >= 0) AND (anIndex < f_Items.Count) then anAction(f_Items[anIndex]); finally Unlock; end;//try..finally finally l3FreeLocalStub(Hack); end;//try..finally //#UC END# *53A84EAD0005_53A2C7AA03BF_impl* end;//Tl3MultiThreadIntegerList.ForOneF procedure Tl3MultiThreadIntegerList.Cleanup; {* Функция очистки полей объекта. } //#UC START# *479731C50290_53A2C7AA03BF_var* //#UC END# *479731C50290_53A2C7AA03BF_var* begin //#UC START# *479731C50290_53A2C7AA03BF_impl* FreeAndNil(f_Items); inherited; //#UC END# *479731C50290_53A2C7AA03BF_impl* end;//Tl3MultiThreadIntegerList.Cleanup procedure Tl3MultiThreadIntegerList.InitFields; //#UC START# *47A042E100E2_53A2C7AA03BF_var* //#UC END# *47A042E100E2_53A2C7AA03BF_var* begin //#UC START# *47A042E100E2_53A2C7AA03BF_impl* inherited; if NeedSort then f_Items := Tl3ProtoIntegerList.MakeSorted else f_Items := Tl3ProtoIntegerList.Create; //#UC END# *47A042E100E2_53A2C7AA03BF_impl* end;//Tl3MultiThreadIntegerList.InitFields end.
unit ce_symstring; {$I ce_defines.inc} interface uses ce_observer, ce_interfaces, ce_project, ce_synmemo, ce_common; type (** * Enumerates the symbol kinds, used to index an associative array. *) TCESymbol = (CAF, CAP, CFF, CFP, CI, CPF, CPP, CPO, CPR, CPN, CPFS, CPCD); (** * TCESymbolExpander is designed to expand Coedit symbolic strings, * using the information collected from several observer interfaces. *) TCESymbolExpander = class(ICEMultiDocObserver, ICEProjectObserver) private fProj: TCEProject; fDoc: TCESynMemo; fNeedUpdate: boolean; fSymbols: array[TCESymbol] of string; procedure updateSymbols; // procedure projNew(aProject: TCEProject); procedure projClosing(aProject: TCEProject); procedure projFocused(aProject: TCEProject); procedure projChanged(aProject: TCEProject); procedure projCompiling(aProject: TCEProject); // procedure docNew(aDoc: TCESynMemo); procedure docClosing(aDoc: TCESynMemo); procedure docFocused(aDoc: TCESynMemo); procedure docChanged(aDoc: TCESynMemo); public constructor Create; destructor Destroy; override; // expands the symbols contained in symString function get(const symString: string): string; end; var symbolExpander: TCESymbolExpander; implementation uses Forms, SysUtils, Classes; {$REGION Standard Comp/Obj------------------------------------------------------} constructor TCESymbolExpander.Create; begin EntitiesConnector.addObserver(self); fNeedUpdate := true; end; destructor TCESymbolExpander.Destroy; begin fNeedUpdate := false; EntitiesConnector.removeObserver(self); inherited; end; {$ENDREGION} {$REGION ICEProjectObserver ----------------------------------------------------} procedure TCESymbolExpander.projNew(aProject: TCEProject); begin fProj := aProject; fNeedUpdate := true; end; procedure TCESymbolExpander.projClosing(aProject: TCEProject); begin if fProj <> aProject then exit; fProj := nil; fNeedUpdate := true; end; procedure TCESymbolExpander.projFocused(aProject: TCEProject); begin fProj := aProject; fNeedUpdate := true; end; procedure TCESymbolExpander.projChanged(aProject: TCEProject); begin if fProj <> aProject then exit; fNeedUpdate := true; end; procedure TCESymbolExpander.projCompiling(aProject: TCEProject); begin end; {$ENDREGION} {$REGION ICEMultiDocObserver ---------------------------------------------------} procedure TCESymbolExpander.docNew(aDoc: TCESynMemo); begin fDoc := aDoc; fNeedUpdate := true; end; procedure TCESymbolExpander.docClosing(aDoc: TCESynMemo); begin if aDoc <> fDoc then exit; fDoc := nil; fNeedUpdate := true; end; procedure TCESymbolExpander.docFocused(aDoc: TCESynMemo); begin if (aDoc <> nil) and (fDoc = aDoc) then exit; fDoc := aDoc; fNeedUpdate := true; end; procedure TCESymbolExpander.docChanged(aDoc: TCESynMemo); begin if aDoc <> fDoc then exit; fNeedUpdate := true; end; {$ENDREGION} {$REGION Symbol things ---------------------------------------------------------} procedure TCESymbolExpander.updateSymbols; var hasProj: boolean; hasDoc: boolean; fname: string; i: Integer; str: TStringList; const na = '``'; begin if not fNeedUpdate then exit; fNeedUpdate := false; hasProj := fProj <> nil; hasDoc := fDoc <> nil; // application fSymbols[CAF] := Application.ExeName; fSymbols[CAP] := ExtractFilePath(Application.ExeName); // document if hasDoc then begin if fileExists(fDoc.fileName) then begin fSymbols[CFF] := fDoc.fileName; fSymbols[CFP] := ExtractFilePath(fDoc.fileName); end else begin fSymbols[CFF] := na; fSymbols[CFP] := na; end; if fDoc.Identifier <> '' then fSymbols[CI] := fDoc.Identifier else fSymbols[CI] := na; end else begin fSymbols[CFF] := na; fSymbols[CFP] := na; fSymbols[CI] := na; end; // project if hasProj then begin if fileExists(fProj.fileName) then begin fSymbols[CPF] := fProj.fileName; fSymbols[CPP] := ExtractFilePath(fProj.fileName); fSymbols[CPR] := fProj.getAbsoluteFilename(fProj.RootFolder); fSymbols[CPN] := stripFileExt(extractFileName(fProj.fileName)); fSymbols[CPO] := fProj.outputFilename; if fSymbols[CPR] = '' then fSymbols[CPR] := fSymbols[CPP]; end else begin fSymbols[CPF] := na; fSymbols[CPP] := na; fSymbols[CPR] := na; fSymbols[CPN] := na; fSymbols[CPO] := na; end; if fProj.Sources.Count = 0 then begin fSymbols[CPFS] := na; fSymbols[CPCD] := na; end else begin str := TStringList.Create; try for i := 0 to fProj.Sources.Count-1 do begin fname := fProj.getAbsoluteSourceName(i); if dExtList.IndexOf(ExtractFileExt(fname)) = -1 then continue; str.Add(fname); end; fSymbols[CPFS] := str.Text; fSymbols[CPCD] := commonFolder(str); finally str.Free; end; end; end else begin fSymbols[CPF] := na; fSymbols[CPP] := na; fSymbols[CPR] := na; fSymbols[CPN] := na; fSymbols[CPO] := na; fSymbols[CPFS] := na; fSymbols[CPCD] := na; end; end; function TCESymbolExpander.get(const symString: string): string; var elems: TStringList; elem: string; begs, ends: boolean; i: integer; begin Result := ''; if symString = '' then exit; // updateSymbols; elems := TStringList.Create; try i := 0; elem := ''; repeat Inc(i); if not (symString[i] in ['<', '>']) then elem += symString[i] else begin if symString[i] = '<' then begs := True; ends := symString[i] = '>'; elems.Add(elem); elem := ''; if begs and ends then begin begs := False; ends := False; // elem.obj is a flag to differenciate symbols from elements elems.Objects[elems.Count - 1] := Self; end; end; until i = length(symString); elems.Add(elem); elem := ''; for i := 0 to elems.Count - 1 do begin if elems.Objects[i] = nil then Result += elems.Strings[i] else case elems.Strings[i] of '<', '>': continue; 'CAF', 'CoeditApplicationFile': Result += fSymbols[CAF]; 'CAP', 'CoeditApplicationPath': Result += fSymbols[CAP]; // 'CFF', 'CurrentFileFile': Result += fSymbols[CFF]; 'CFP', 'CurrentFilePath': Result += fSymbols[CFP]; 'CI', 'CurrentIdentifier': Result += fSymbols[CI]; // 'CPF', 'CurrentProjectFile': Result += fSymbols[CPF]; 'CPFS', 'CurrentProjectFiles': Result += fSymbols[CPFS]; 'CPN', 'CurrentProjectName': Result += fSymbols[CPN]; 'CPO', 'CurrentProjectOutput': Result += fSymbols[CPO]; 'CPP', 'CurrentProjectPath': Result += fSymbols[CPP]; 'CPR', 'CurrentProjectRoot': Result += fSymbols[CPR]; 'CPCD','CurrentProjectCommonDirectory': Result += fSymbols[CPCD]; end; end; finally elems.Free; end; end; {$ENDREGION} initialization symbolExpander := TCESymbolExpander.Create; finalization symbolExpander.Free; end.
unit ExcludedTests; {* Тесты, которые не надо запускать - [$227477825]. } // Модуль: "w:\common\components\rtl\Garant\DUnitTuning\ExcludedTests.pas" // Стереотип: "SimpleClass" // Элемент модели: "TExcludedTests" MUID: (4C44675A0269) {$Include w:\common\components\rtl\Garant\DUnitTuning\tfwDefine.inc} interface {$If Defined(nsTest) AND NOT Defined(NotTunedDUnit)} uses l3IntfUses , l3StringList ; type TExcludedTests = class(Tl3StringList) {* Тесты, которые не надо запускать - [$227477825]. } public class function Exists: Boolean; {* Определяет создан ли экземпляр синглетона } class function Instance: TExcludedTests; {* Метод получения экземпляра синглетона TExcludedTests } end;//TExcludedTests {$IfEnd} // Defined(nsTest) AND NOT Defined(NotTunedDUnit) implementation {$If Defined(nsTest) AND NOT Defined(NotTunedDUnit)} uses l3ImplUses , SysUtils , l3Base //#UC START# *4C44675A0269impl_uses* //#UC END# *4C44675A0269impl_uses* ; var g_TExcludedTests: TExcludedTests = nil; {* Экземпляр синглетона TExcludedTests } procedure TExcludedTestsFree; {* Метод освобождения экземпляра синглетона TExcludedTests } begin l3Free(g_TExcludedTests); end;//TExcludedTestsFree class function TExcludedTests.Exists: Boolean; {* Определяет создан ли экземпляр синглетона } begin Result := g_TExcludedTests <> nil; end;//TExcludedTests.Exists class function TExcludedTests.Instance: TExcludedTests; {* Метод получения экземпляра синглетона TExcludedTests } begin if (g_TExcludedTests = nil) then begin l3System.AddExitProc(TExcludedTestsFree); g_TExcludedTests := Create; end; Result := g_TExcludedTests; end;//TExcludedTests.Instance {$IfEnd} // Defined(nsTest) AND NOT Defined(NotTunedDUnit) end.
unit CapitolTownsSheet; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, VisualControls, ObjectInspectorInterfaces, PercentEdit, GradientBox, FramedButton, SheetHandlers, ExtCtrls, ComCtrls, InternationalizerComponent; const tidTownName = 'Town'; tidTownRating = 'TownRating'; tidTownTax = 'TownTax'; tidTownPopulation = 'TownPopulation'; tidTownQOL = 'TownQOL'; tidTownQOS = 'TownQOS'; tidTownWealth = 'TownWealth'; tidTownCount = 'TownCount'; tidActualRuler = 'ActualRuler'; tidCurrBlock = 'CurrBlock'; type TCapitolTownsSheetHandler = class; TCapitolTownsSheetViewer = class(TVisualControl) lvTowns: TListView; pnTax: TPanel; lbTax: TLabel; pbTax: TPercentEdit; InternationalizerComponent1: TInternationalizerComponent; procedure pbTaxMoveBar(Sender: TObject); procedure pbTaxChange(Sender: TObject); procedure lvTownsChange(Sender: TObject; Item: TListItem; Change: TItemChange); public { Public declarations } private procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND; private fHandler : TCapitolTownsSheetHandler; fProperties : TStringList; end; TCapitolTownsSheetHandler = class(TSheetHandler, IPropertySheetHandler) private fControl : TCapitolTownsSheetViewer; fHasAccess : boolean; fCurrBlock : integer; private function CreateControl(Owner : TControl) : TControl; override; function GetControl : TControl; override; procedure RenderProperties(Properties : TStringList); override; procedure SetFocus; override; procedure Clear; override; private procedure threadedGetProperties(const parms : array of const); procedure threadedRenderProperties(const parms : array of const); procedure threadedSetTownTax( const parms : array of const ); end; function CapitolTownsHandlerCreator : IPropertySheetHandler; stdcall; implementation {$R *.DFM} uses Threads, SheetHandlerRegistry, FiveViewUtils, Protocol, SheetUtils, MathUtils, Literals; // TCapitolTownsSheetHandler function TCapitolTownsSheetHandler.CreateControl(Owner : TControl) : TControl; begin fControl := TCapitolTownsSheetViewer.Create(Owner); fControl.fProperties := TStringList.Create; fControl.fHandler := self; result := fControl; end; function TCapitolTownsSheetHandler.GetControl : TControl; begin result := fControl; end; procedure TCapitolTownsSheetHandler.RenderProperties(Properties : TStringList); var cnt : integer; i : integer; iStr : string; Item : TListItem; begin try fControl.fProperties.Assign( Properties ); SheetUtils.ClearListView(fControl.lvTowns); fControl.lvTowns.Items.BeginUpdate; try fHasAccess := (uppercase(Properties.Values[tidActualRuler]) = uppercase(fContainer.GetClientView.getUserName)); cnt := StrToInt(Properties.Values[tidTownCount]); for i := 0 to pred(cnt) do begin iStr := IntToStr(i); Item := fControl.lvTowns.Items.Add; Item.Caption := Properties.Values[tidTownName + iStr]; Item.SubItems.Add(Properties.Values[tidTownPopulation + iStr]); Item.SubItems.Add(Properties.Values[tidTownQOL + iStr] + '%'); Item.SubItems.Add(Properties.Values[tidTownQOS + iStr] + '%'); Item.SubItems.Add(Properties.Values[tidTownWealth + iStr] + '%'); Item.SubItems.Add(Properties.Values[tidTownTax + iStr] + '%'); end; finally fControl.lvTowns.Items.EndUpdate; end; if cnt = 0 then SheetUtils.AddItem(fControl.lvTowns, [GetLiteral('Literal192')]); fControl.pnTax.Visible := fHasAccess; except fControl.pnTax.Visible := false; end; end; procedure TCapitolTownsSheetHandler.SetFocus; begin if not fLoaded then begin inherited; SheetUtils.AddItem(fControl.lvTowns, [GetLiteral('Literal193')]); Threads.Fork( threadedGetProperties, priHigher, [fLastUpdate] ); end; end; procedure TCapitolTownsSheetHandler.Clear; begin inherited; fControl.lvTowns.Items.BeginUpdate; try fControl.lvTowns.Items.Clear; finally fControl.lvTowns.Items.EndUpdate; end; end; procedure TCapitolTownsSheetHandler.threadedGetProperties(const parms : array of const); var Names : TStringList; Update : integer; Prop : TStringList; Proxy : OleVariant; aux : string; i : integer; iStr : string; begin Update := parms[0].vInteger; try Lock; try Proxy := fContainer.GetCacheObjectProxy; if (Update = fLastUpdate) and not VarIsEmpty(Proxy) then begin aux := Proxy.Properties(tidTownCount); if (Update = fLastUpdate) and (aux <> '') then begin Names := TStringList.Create; Prop := TStringList.Create; Prop.Values[tidTownCount] := aux; try for i := 0 to pred(StrToInt(aux)) do begin iStr := IntToStr(i); Names.Add(tidTownName + iStr); Names.Add(tidTownRating + iStr); Names.Add(tidTownTax + iStr); Names.Add(tidTownPopulation + iStr); Names.Add(tidTownQOL + iStr); Names.Add(tidTownQOS + iStr); Names.Add(tidTownWealth + iStr); end; Names.Add( tidActualRuler ); Names.Add( tidCurrBlock ); if Update = fLastUpdate then fContainer.GetPropertyList(Proxy, Names, Prop); finally Names.Free; end; if Update = fLastUpdate then Join(threadedRenderProperties, [Prop, Update]) else Prop.Free; end; end; finally Unlock; end; except end; end; procedure TCapitolTownsSheetHandler.threadedRenderProperties(const parms : array of const); var Prop : TStringList absolute parms[0].vPointer; begin try try if fLastUpdate = parms[1].vInteger then RenderProperties(Prop); fCurrBlock := StrToInt(Prop.Values[tidCurrBlock]); finally Prop.Free; end; except end; end; procedure TCapitolTownsSheetHandler.threadedSetTownTax( const parms : array of const ); var Index : integer; Value : integer; MSProxy : olevariant; begin try Index := parms[0].vInteger; Value := parms[1].vInteger; if fHasAccess then try MSProxy := fContainer.GetMSProxy; MSProxy.BindTo(fCurrBlock); MSProxy.RDOSetTownTaxes( Index, Value ); except beep; end; except end; end; function CapitolTownsHandlerCreator : IPropertySheetHandler; begin result := TCapitolTownsSheetHandler.Create; end; procedure TCapitolTownsSheetViewer.WMEraseBkgnd(var Message: TMessage); begin Message.Result := 1; end; procedure TCapitolTownsSheetViewer.pbTaxMoveBar(Sender: TObject); begin if lvTowns.Selected <> nil then begin lbTax.Caption := GetFormattedLiteral('Literal194', [pbTax.Value]); lvTowns.Selected.SubItems[4] := IntToStr( pbTax.Value ) + '%'; fProperties.Values[tidTownTax + IntToStr(lvTowns.Selected.Index)] := IntToStr( pbTax.Value ); end; end; procedure TCapitolTownsSheetViewer.pbTaxChange(Sender: TObject); begin if lvTowns.Selected <> nil then begin lvTowns.Selected.SubItems[4] := IntToStr( pbTax.Value ) + '%'; fProperties.Values[tidTownTax + IntToStr(lvTowns.Selected.Index)] := IntToStr( pbTax.Value ); Fork( fHandler.threadedSetTownTax, priNormal, [lvTowns.Selected.Index, pbTax.Value] ); end; end; procedure TCapitolTownsSheetViewer.lvTownsChange(Sender: TObject; Item: TListItem; Change: TItemChange); begin if lvTowns.Selected <> nil then begin lbTax.Caption := GetFormattedLiteral('Literal195', [lvTowns.Selected.SubItems[4]]); pbTax.Value := StrToInt( fProperties.Values[tidTownTax + IntToStr(lvTowns.Selected.Index)] ); end; end; initialization SheetHandlerRegistry.RegisterSheetHandler( 'CapitolTowns', CapitolTownsHandlerCreator ); end.
unit ResumenSel; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, Buttons, Vcl.Imaging.pngimage; type TFResumenSel = class(TForm) lbCampo: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; btnOK: TBitBtn; edCampo: TEdit; edSuma: TEdit; edCant: TEdit; edMax: TEdit; edMin: TEdit; edProm: TEdit; Image1: TImage; private { Private declarations } public { Public declarations } procedure setearDatos( const campo: string; valor, Max, min: double; cant: Integer ); end; var FResumenSel: TFResumenSel; implementation {$R *.dfm} procedure TFResumenSel.setearDatos(const campo: string; valor, Max, min: double; cant: Integer); begin edCampo.Text := campo; edSuma.Text := Format( '%14.2f', [ valor ]); edMax.Text := Format( '%14.2f', [ max ]); edMin.Text := Format( '%14.2f', [ min ]); edProm.Text := Format( '%14.2f', [ valor / cant ]); edCant.Text := Format( '%8.0d', [ cant ]); end; end.
unit StockDayData_Parse_Sina_Html3; interface uses win.iobuffer, define_stockday_sina, define_stock_quotes, QuickList_Int; // 这里一个原则 尽量不引入 AdataAccess 这种外部 数据访问 独立性强 //function DataParse_DayData_Sina(ADataAccess: TStockDayDataAccess; AResultData: PIOBuffer): Boolean; overload; function DataParse_DayData_Sina(AResultData: PIOBuffer): TALIntegerList; overload; implementation uses Sysutils, StockDayData_Parse_Sina, UtilsHttp, UtilsLog, HtmlParserAll3; {$IFNDEF RELEASE} const LOGTAG = 'StockDayData_Parse_Sina_Html3.pas'; {$ENDIF} type PParseRecord = ^TParseRecord; TParseRecord = record HtmlDoc: PHtmlDocDomNode; IsInTable: Integer; IsTableHeadReady: Boolean; TableHeader: TRT_DealDayData_HeaderSina; DealDayData: TRT_Quote_Day; end; function GetNodeText(ANode: PHtmlDomNode; AColIndex: TDealDayDataHeadName_Sina): WideString; var i: integer; tmpNode: PHtmlDomNode; begin Result := ''; if nil = ANode then exit; if nil = ANode.childNodes then Exit; if headDay = AColIndex then begin for i := 0 to ANode.childNodes.length - 1 do begin tmpNode := ANode.childNodes.item(i); if HTMLDOM_NODE_ELEMENT = tmpNode.nodetype then begin Result := Result + GetNodeText(tmpNode, AColIndex); end; if '' <> Result then exit; if HTMLDOM_NODE_TEXT = tmpNode.nodetype then begin Result := Trim(tmpNode.nodeValue); end; end; exit; end; for i := 0 to ANode.childNodes.length - 1 do begin tmpNode := ANode.childNodes.item(i); if HTMLDOM_NODE_ELEMENT = tmpNode.nodetype then begin if 1 = ANode.childNodes.length then begin Result := GetNodeText(tmpNode, AColIndex); if '' <> Result then exit; end; end; if HTMLDOM_NODE_TEXT = tmpNode.nodetype then begin Result := Trim(tmpNode.nodeValue); end; end; end; procedure ParseStockDealDataTableRow(ADayDatas: TALIntegerList; AParseRecord: PParseRecord; ANode: PHtmlDomNode); overload; var i: integer; tmpChild: PHtmlDomNode; tmpHeadColName: TDealDayDataHeadName_Sina; tmpStr: string; tmpTDIndex: integer; tmpIsHead: Boolean; tmpDayData: PRT_Quote_Day; begin FillChar(AParseRecord.DealDayData, SizeOf(AParseRecord.DealDayData), 0); tmpTDIndex := -1; tmpIsHead := false; for i := 0 to ANode.childNodes.length - 1 do begin tmpChild := ANode.childNodes.item(i); if SameText(tmpChild.nodeName, 'td') then begin inc (tmpTDIndex); if (not AParseRecord.IsTableHeadReady) then begin // 处理 行数据 tmpStr := trim(tmpChild.nodeValue); if '' = tmpStr then begin tmpStr := GetNodeText(tmpChild, headNone); end; if '' <> tmpStr then begin for tmpHeadColName := Low(TDealDayDataHeadName_Sina) to High(TDealDayDataHeadName_Sina) do begin if SameText(tmpStr, DealDayDataHeadNames_Sina[tmpHeadColName]) or (Pos(DealDayDataHeadNames_Sina[tmpHeadColName], tmpStr) > 0) then begin AParseRecord.TableHeader.HeadNameIndex[tmpHeadColName] := tmpTDIndex; tmpIsHead := true; end; end; end; end else begin // 处理 行数据 for tmpHeadColName := Low(TDealDayDataHeadName_Sina) to High(TDealDayDataHeadName_Sina) do begin if AParseRecord.TableHeader.HeadNameIndex[tmpHeadColName] = tmpTDIndex then begin tmpStr := trim(tmpChild.nodeValue); if '' = tmpStr then begin tmpStr := Trim(GetNodeText(tmpChild, tmpHeadColName)); end; if '' <> tmpStr then begin ParseSinaCellData(tmpHeadColName, @AParseRecord.DealDayData, tmpStr); end; end; end; end; end; end; if not AParseRecord.IsTableHeadReady then begin AParseRecord.IsTableHeadReady := tmpIsHead; end else begin //AddDealDayData(ADataAccess, @AParseRecord.DealDayData); if 0 < AParseRecord.DealDayData.DealDate.Value then begin tmpDayData := nil; i := ADayDatas.IndexOf(AParseRecord.DealDayData.DealDate.Value); if 0 <= i then begin tmpDayData := PRT_Quote_Day(ADayDatas.Objects[i]); end else begin if (Trunc(Now) >= AParseRecord.DealDayData.DealDate.Value) then begin tmpDayData := System.New(PRT_Quote_Day); FillChar(tmpDayData^, SizeOf(TRT_Quote_Day), 0); ADayDatas.AddObject(AParseRecord.DealDayData.DealDate.Value, TObject(tmpDayData)); end; end; if nil <> tmpDayData then begin tmpDayData^ := AParseRecord.DealDayData; end; end; end; end; function HtmlParse_DayData_Sina_Table(ADayDatas: TALIntegerList; AParseRecord: PParseRecord; ANode: PHtmlDomNode): Boolean; var i, j: integer; tmpNode1: PHtmlDomNode; tmpcnt1: integer; tmpcnt2: integer; tmpRow: integer; tmpTagName: string; var tmpHeadColName: TDealDayDataHeadName_Sina; begin Result := false; AParseRecord.IsTableHeadReady := false; for tmpHeadColName := low(TDealDayDataHeadName_Sina) to high(TDealDayDataHeadName_Sina) do begin AParseRecord.TableHeader.HeadNameIndex[tmpHeadColName] := -1; end; tmpcnt1 := ANode.childNodes.length; tmpRow := 0; for i := 0 to tmpcnt1 - 1 do begin tmpNode1 := ANode.childNodes.item(i); tmpTagName := lowercase(tmpNode1.nodeName); if SameText(tmpTagName, 'tr') then begin ParseStockDealDataTableRow(ADayDatas, AParseRecord, tmpNode1); end; if SameText(tmpTagName, 'tbody') then begin tmpcnt2 := tmpNode1.childNodes.length; for j := 0 to tmpcnt2 - 1 do begin if SameText(HtmlDomNodeGetName(tmpNode1.childNodes.item(j)), 'tr') then begin ParseStockDealDataTableRow(ADayDatas, AParseRecord, ANode.childNodes.item(i)); end; end; continue; end; end; if AParseRecord.IsTableHeadReady then begin Result := true; end; end; function HtmlParse_DayData_Sina(ADayDatas: TALIntegerList; AParseRecord: PParseRecord; ANode: PHtmlDomNode): Boolean; var i: integer; tmpcnt: integer; tmpTableId: WideString; tmpNode: PHtmlDomNode; tmpIsHandledNode: Boolean; begin result := false; if nil = ANode then exit; tmpIsHandledNode := false; if SameText(string(lowercase(ANode.nodeName)), 'table') then begin Inc(AParseRecord.IsInTable); tmpcnt := 0; if nil <> ANode.childNodes then tmpcnt := ANode.childNodes.length; tmpTableId := ''; tmpNode := nil; if nil <> ANode.attributes then begin for i := 0 to ANode.attributes.length - 1 do begin tmpNode := ANode.attributes.item(i); if SameText('id', tmpNode.nodeName) then begin tmpTableId := GetNodeText(tmpNode, headNone); Break; end; end; end; if tmpTableId <> '' then begin if SameText('FundHoldSharesTable', tmpTableId) then begin tmpIsHandledNode := true; end else begin if Pos('fundholdsharestable', lowercase(tmpTableId)) = 1 then begin tmpIsHandledNode := true; end; end; end; end; if tmpIsHandledNode then begin result := HtmlParse_DayData_Sina_Table(ADayDatas, AParseRecord, ANode); end else begin if nil <> ANode.childNodes then begin tmpcnt := ANode.childNodes.length; for i := 0 to tmpcnt - 1 do begin tmpNode := ANode.childNodes.item(i); if not result then begin result := HtmlParse_DayData_Sina(ADayDatas, AParseRecord, tmpNode); end else begin HtmlParse_DayData_Sina(ADayDatas, AParseRecord, tmpNode); end; end; end; end; if SameText(string(lowercase(ANode.nodeName)), 'table') then begin Dec(AParseRecord.IsInTable); end; end; function DataParse_DayData_Sina(AResultData: PIOBuffer): TALIntegerList; overload; var tmpParseRec: TParseRecord; // 168k 的数据太大 不能这样设置 tmpHttpHeadSession: THttpHeadParseSession; begin Result := nil; if nil = AResultData then exit; FillChar(tmpParseRec, SizeOf(tmpParseRec), 0); FIllChar(tmpHttpHeadSession, SizeOf(tmpHttpHeadSession), 0); HttpBufferHeader_Parser(AResultData, @tmpHttpHeadSession); if (199 < tmpHttpHeadSession.RetCode) and (300 > tmpHttpHeadSession.RetCode)then begin //SaveHttpResponseToFile(AResultData, @tmpHttpHeadSession, 'e:\test.html'); try tmpParseRec.HtmlDoc := HtmlParserparseString(WideString(AnsiString(PAnsiChar(@AResultData.Data[tmpHttpHeadSession.HeadEndPos + 1])))); if nil = tmpParseRec.HtmlDoc then begin Log(LOGTAG, 'Parse Html Doc nil'); end else begin try Result := TALIntegerList.Create; Result.Clear; if HtmlParse_DayData_Sina(Result, @tmpParseRec, PHtmlDomNode(tmpParseRec.HtmlDoc)) then begin end; finally HtmlDomNodeFree(PHtmlDomNode(tmpParseRec.HtmlDoc)); tmpParseRec.HtmlDoc := nil; end; end; except //Log('ParserSinaDataError:', ADataAccess.StockItem.sCode + 'error html');// + AnsiString(PAnsiChar(@AResultData.Data[tmpHttpHeadSession.HeadEndPos + 1]))); end; end; end; end.
unit cConfiguration; interface uses GR32, INIFiles, SysUtils, classes, forms; type TRRConfig = class private _Changed : Boolean; _LeftTextColour : TColor32; _MidTextColour : TColor32; _GridlineColour : TColor32; _OptionsFilename : String; _Palette : String; _GridlinesEnabled,_GridlinesOnDef : Boolean; _DisplayLeftMiddleText : Boolean; _DataFile : String; _BackupFiles : Boolean; _EmulatorPath : String; _EmulatorFilenameSettings : Byte; _EmulatorDisplaySaveWarning : Boolean; _LastPaletteTSA : Byte; _LastPaletteTileEditor : Byte; _LastPaletteTitleScreenEd : Byte; _MapperWarnings : Byte; _RecentlyOpenedFiles : TStringlist; _AutoCheck : Boolean; _OriginalROMFile : String; _IPSOutput : String; _AutoObjMode : Boolean; _SpecObjOutline : TColor32; _IconTransparency : Boolean; _IconOpaque : Byte; _DisableEnemyDeletePrompt : Boolean; _DontAllowEdits : Boolean; procedure SetLeftTextColour(pLeftTextColour : TColor32); procedure SetSpecObjColour(pLeftTextColour : TColor32); procedure SetMiddleTextColour(pMiddleTextColour : TColor32); procedure SetGridlineColour(pGridlineColour : TColor32); function GetFullPalette: String; procedure SetFullPalette(const Value: String); function GetFullDataFilename: String; procedure SetFullDataFileName(const Value: String); procedure SetDataFile(const Value: String); procedure SetDisplayLeftMiddleText(const Value: Boolean); procedure SetGridlinesEnabled(const Value: Boolean); procedure SetDontAllowEdits(const Value: Boolean); procedure SetOptionsFileName(const Value: String); procedure SetPalette(const Value: String); procedure SetGridlinesOnDef(const Value: Boolean); procedure SetBackupFiles(const Value: Boolean); procedure SetEmu83Filename(const Value: Byte); procedure SetIconTransparency(const Value: Boolean); procedure SetIconOpaque(const Value: Byte); procedure SetEmulatorDisplaySaveWarning(const Value: Boolean); procedure SetEmuPath(const Value: String); procedure SetLastPaletteTileEditor(const Value: Byte); procedure SetLastPaletteTitleScreen(const Value: Byte); procedure SetLastPaletteTSA(const Value: Byte); procedure SetMapperWarnings(const Value: Byte); function GetNumberOfRecentlyOpenedFiles: Integer; function GetRecentFile(index: Integer): String; procedure SetRecentFile(index: Integer; const Value: String); procedure SetupMRU; procedure SetAutoCheck(const Value: Boolean); procedure SetOriginalROMFile(const Value : String); procedure SetIPSOutput(const Value : String); procedure SetAutoObjMode (const Value : Boolean); procedure SetDisableEnemyDeletePrompt (const Value : Boolean); procedure CleanupMRU(); public constructor Create(pOptionsFilename : String); destructor Destroy;override; property Changed : Boolean read _Changed write _Changed; procedure Save; procedure Load; property LeftTextColour : TColor32 read _LeftTextColour write SetLeftTextColour; property MiddleTextColour : TColor32 read _MidTextColour write SetMiddleTextColour; property GridlineColour : TColor32 read _GridlineColour write SetGridlineColour; property SpecObjOutline : TColor32 read _SpecObjOutline write SetSpecObjColour; property NumberOfRecentlyOpenedFiles : Integer read GetNumberOfRecentlyOpenedFiles; property RecentFile [index : Integer] : String read GetRecentFile write SetRecentFile; procedure AddRecentFile(pNewFile : String); procedure LoadDefaultSettings; property DrawTransparentIcons : Boolean read _IconTransparency write SetIconTransparency; property IconTransparency : Byte read _IconOpaque write SetIconOpaque; property Filename : String read _OptionsFilename write SetOptionsFileName; property Palette : String read _Palette write SetPalette; property FullPaletteName : String read GetFullPalette write SetFullPalette; property GridlinesOn : Boolean read _GridlinesEnabled write SetGridlinesEnabled; property GridlinesOnByDefault : Boolean read _GridlinesOnDef write SetGridlinesOnDef; property DispLeftMidText : Boolean read _DisplayLeftMiddleText write SetDisplayLeftMiddleText; property DataFileName : String read _DataFile write SetDataFile; property FullDataFileName : String read GetFullDataFilename write SetFullDataFileName; property BackupFilesWhenSaving : Boolean read _BackupFiles write SetBackupFiles; property EmulatorPath : String read _EmulatorPath write SetEmuPath; property EmulatorFileSettings : Byte read _EmulatorFilenameSettings write SetEmu83Filename; property EmulatorDisplaySaveWarning : Boolean read _EmulatorDisplaySaveWarning write SetEmulatorDisplaySaveWarning; property LastPaletteTSA : Byte read _LastPaletteTSA write SetLastPaletteTSA; property LastPaletteTileEditor : Byte read _LastPaletteTileEditor write SetLastPaletteTileEditor; property LastPaletteTitleScreenEd : Byte read _LastPaletteTitleScreenEd write SetLastPaletteTitleScreen; property MapperWarnings : Byte read _MapperWarnings write SetMapperWarnings; property AutoCheck : Boolean read _AutoCheck write SetAutoCheck; property OriginalROMFile : String read _OriginalROMFile write SetOriginalROMFile; property IPSOutput : String read _IPSOutput write SetIPSOutput; property AutoObjMode : Boolean read _AutoObjMode write SetAutoObjMode; property DisableEnemyDeletePrompt : Boolean read _DisableEnemyDeletePrompt write SetDisableEnemyDeletePrompt; property DontAllowEdits : Boolean read _DontAllowEdits write SetDontAllowEdits; end; implementation constructor TRRConfig.Create(pOptionsFilename : String); begin _OptionsFIlename := pOptionsFilename; Load; Save; end; procedure TRRConfig.Save; var INI : TMemINIFile; begin INI := TMemINIFile.Create(_OptionsFilename); try // Write the left text settings. INI.WriteInteger('LeftText','R',(_LeftTextColour and $00FF0000) shr 16); INI.WriteInteger('LeftText','G',(_LeftTextColour and $0000FF00) shr 8); INI.WriteInteger('LeftText','B',_LeftTextColour and $0000FF); INI.WriteInteger('LeftText','A',_LeftTextColour shr 24); // Write the middle text settings INI.WriteInteger('MidText','R',(_MidTextColour and $00FF0000) shr 16); INI.WriteInteger('MidText','G',(_MidTextColour and $0000FF00) shr 8); INI.WriteInteger('MidText','B',_MidTextColour and $0000FF); INI.WriteInteger('MidText','A',_MidTextColour shr 24); // Write the gridline settings INI.WriteInteger('Gridline','R',(_GridlineColour and $00FF0000) shr 16); INI.WriteInteger('Gridline','G',(_GridlineColour and $0000FF00) shr 8); INI.WriteInteger('Gridline','B',_GridlineColour and $0000FF); INI.WriteInteger('Gridline','A',_GridlineColour shr 24); // Write the special object outline settings INI.WriteInteger('SpecOutline','R',(_SpecObjOutline and $00FF0000) shr 16); INI.WriteInteger('SpecOutline','G',(_SpecObjOutline and $0000FF00) shr 8); INI.WriteInteger('SpecOutline','B',_SpecObjOutline and $0000FF); INI.WriteInteger('SpecOutline','A',_SpecObjOutline shr 24); ini.WriteString('General','Palette',_Palette); INI.WriteBool('General','Gridlines',_GridlinesOnDef); INI.WriteBool('General','DispMidLeftText',_DisplayLeftMiddleText); INI.WriteString('General','DataFile',_DataFile); INI.WriteString('General','EmulatorPath',_EmulatorPath); INI.WriteInteger('General','EmuFileSettings',_EmulatorFilenameSettings); INI.WriteBool('General','Backup',_BackupFiles); INI.WriteBool('General','EmuDisplaySaveWarning',_EmulatorDisplaySaveWarning); INI.WriteInteger('General','LastPalTilEd',_LastPaletteTSA); INI.WriteInteger('General','LastPalTSA',_LastPaletteTileEditor); INI.WriteInteger('General','LastPalTitle',_LastPaletteTitleScreenEd); INI.WriteInteger('General','MapperWarnings',_MapperWarnings); INI.WriteBool('General','AutoCheck',_AutoCheck); INI.WriteBool('General','DisableEnemyDeletePrompt',_DisableEnemyDeletePrompt); SetupMRU(); INI.WriteString('Recent','RecentFile0',_RecentlyOpenedFiles[0]); INI.WriteString('Recent','RecentFile1',_RecentlyOpenedFiles[1]); INI.WriteString('Recent','RecentFile2',_RecentlyOpenedFiles[2]); INI.WriteString('Recent','RecentFile3',_RecentlyOpenedFiles[3]); INI.WriteString('Recent','RecentFile4',_RecentlyOpenedFiles[4]); INI.WriteString('IPS','Original',_OriginalROMFile); INI.WriteString('IPS','Output',_IPSOutput); INI.WriteBool('General','AutoObjMode',_AutoObjMode); INI.WriteBool('General','IconTrans',_IconTransparency); INI.WriteInteger('General','IconOpaque',_IconOpaque); INI.WriteBool('General','DontAllowEdits',_DontAllowEdits); INI.UpdateFile; finally FreeAndNil(INI); end; _Changed := False; end; procedure TRRConfig.Load; var INI : TMemINIFile; begin INI := TMemINIFile.Create(_OptionsFilename); try _LeftTextColour := (INI.ReadInteger('LeftText','A',$FF) shl 24) + (INI.ReadInteger('LeftText','R',$FF) shl 16) + (INI.ReadInteger('LeftText','G',$00) shl 8) + (INI.ReadInteger('LeftText','B',$00)); _MidTextColour := (INI.ReadInteger('MidText','A',$FF) shl 24) + (INI.ReadInteger('MidText','R',$00) shl 16) + (INI.ReadInteger('MidText','G',$FF) shl 8) + (INI.ReadInteger('MidText','B',$00)); _GridlineColour := (INI.ReadInteger('Gridline','A',$FF) shl 24) + (INI.ReadInteger('Gridline','R',$FF) shl 16) + (INI.ReadInteger('Gridline','G',$FF) shl 8) + (INI.ReadInteger('Gridline','B',$FF)); // _LeftTextColour := INI.ReadInteger('General','LeftTextColour',$FFFF0000); _SpecObjOutline := (INI.ReadInteger('SpecOutline','A',$FF) shl 24) + (INI.ReadInteger('SpecOutline','R',$FF) shl 16) + (INI.ReadInteger('SpecOutline','G',$00) shl 8) + (INI.ReadInteger('SpecOutline','B',$00)); _Palette := ini.ReadString('General','Palette','fx3nespal.pal'); _GridlinesOnDef := INI.ReadBool('General','Gridlines',True); _GridlinesEnabled := _GridlinesOnDef; _DisplayLeftMiddleText := INI.ReadBool('General','DispMidLeftText', True); _DataFile := INI.ReadString('General','DataFile','Mega Man (U).ini'); _BackupFiles := INI.ReadBool('General','Backup',True); _EmulatorFilenameSettings := INI.readInteger('General','emufilesettings',0); _EmulatorPath := INI.ReadString('General','EmulatorPath',''); _EmulatorDisplaySaveWarning := INI.ReadBool('General','EmuDisplaySaveWarning',True); _LastPaletteTSA := INI.ReadInteger('General','LastPalTilEd',0); _LastPaletteTileEditor := INI.ReadInteger('General','LastPalTSA',0); _LastPaletteTitleScreenEd := INI.ReadInteger('General','LastPalTitle',0); _MapperWarnings := INI.ReadInteger('General','MapperWarnings',1); _AutoCheck := INI.ReadBool('General','AutoCheck',True); _OriginalROMFile := INI.ReadString('IPS','Original',''); _IPSOutput := INI.ReadString('IPS','Output',''); _AutoObjMode := INI.ReadBool('General','AutoObjMode',True); _IconTransparency := INI.ReadBool('General','IconTrans', False); _IconOpaque := INI.ReadInteger('General','IconOpaque',200); _DisableEnemyDeletePrompt := INI.ReadBool('General','DisableEnemyDeletePrompt', False); _DontAllowEdits := INI.ReadBool('General','DontAllowEdits',true); SetupMRU(); _RecentlyOpenedFiles[0] := (INI.ReadString('Recent','RecentFile0','')); _RecentlyOpenedFiles[1] := (INI.ReadString('Recent','RecentFile1','')); _RecentlyOpenedFiles[2] := (INI.ReadString('Recent','RecentFile2','')); _RecentlyOpenedFiles[3] := (INI.ReadString('Recent','RecentFile3','')); _RecentlyOpenedFiles[4] := (INI.ReadString('Recent','RecentFile4','')); CleanupMRU(); finally FreeAndNil(INI); end; end; procedure TRRConfig.SetLeftTextColour(pLeftTextColour : TColor32); begin _LeftTextColour := pLeftTextColour; _Changed := True; end; procedure TRRConfig.SetSpecObjColour(pLeftTextColour : TColor32); begin _SpecObjOutline := pLeftTextColour; _Changed := True; end; procedure TRRConfig.SetMiddleTextColour(pMiddleTextColour : TColor32); begin _MidTextColour := pMiddleTextColour; _Changed := True; end; procedure TRRConfig.SetGridlineColour(pGridlineColour : TColor32); begin _GridlineColour := pGridlineColour; _Changed := True; end; function TRRConfig.GetFullPalette: String; begin result := ExtractFileDir(Application.ExeName) + '\Data\Palettes\' + _Palette; end; procedure TRRConfig.SetFullPalette(const Value: String); begin _Palette := ExtractFileName(Value); _Changed := True; end; function TRRConfig.GetFullDataFilename: String; begin result := ExtractFileDir(Application.ExeName) + '\Data\' + _DataFile; end; procedure TRRConfig.SetFullDataFileName(const Value: String); begin _DataFile := ExtractFileName(Value); _Changed := True; end; procedure TRRConfig.SetDataFile(const Value: String); begin _DataFile := Value; _Changed := True; end; procedure TRRConfig.SetDisplayLeftMiddleText(const Value: Boolean); begin _DisplayLeftMiddleText := Value; _Changed := True; end; procedure TRRConfig.SetGridlinesEnabled(const Value: Boolean); begin _GridlinesEnabled := Value; end; procedure TRRConfig.SetOptionsFileName(const Value: String); begin _OptionsFilename := Value; _Changed := True; end; procedure TRRConfig.SetPalette(const Value: String); begin _Palette := Value; _Changed := True; end; procedure TRRConfig.SetGridlinesOnDef(const Value: Boolean); begin _GridlinesOnDef := Value; _Changed := True; end; procedure TRRConfig.SetBackupFiles(const Value: Boolean); begin _BackupFiles := Value; _Changed := True; end; procedure TRRConfig.SetEmu83Filename(const Value: Byte); begin _EmulatorFilenameSettings := Value; _Changed := True; end; procedure TRRConfig.SetEmulatorDisplaySaveWarning(const Value: Boolean); begin _EmulatorDisplaySaveWarning := Value; _Changed := True; end; procedure TRRConfig.SetEmuPath(const Value: String); begin _EmulatorPath := Value; _Changed := True; end; procedure TRRConfig.SetLastPaletteTileEditor(const Value: Byte); begin _LastPaletteTileEditor := Value; _Changed := True; end; procedure TRRConfig.SetLastPaletteTitleScreen(const Value: Byte); begin _LastPaletteTitleScreenEd := Value; _Changed := True; end; procedure TRRConfig.SetMapperWarnings(const Value: Byte); begin _MapperWarnings := Value; _Changed := True; end; function TRRConfig.GetNumberOfRecentlyOpenedFiles: Integer; var i : Integer; count : Integer; begin if Assigned(_RecentlyOpenedFiles) = True then begin count := 0; for i := 0 to _RecentlyOpenedFiles.Count - 1 do begin if _RecentlyOpenedFiles[i] <> '' then inc(Count); end; result := count; end else result := -1; end; function TRRConfig.GetRecentFile(index: Integer): String; begin result := _RecentlyOpenedFiles[index]; end; procedure TRRConfig.SetRecentFile(index: Integer; const Value: String); begin _RecentlyOpenedFiles[index] := Value; _Changed := True; end; procedure TRRConfig.SetupMRU; var i, initcount : Integer; begin if Assigned(_RecentlyOpenedFiles) = false then _RecentlyOpenedFiles := TStringList.Create; if _RecentlyOpenedFiles.Count < 5 then begin initcount := _RecentlyOpenedFiles.Count; for i := initcount to 4 do _RecentlyOpenedFiles.Add(''); end; end; procedure TRRConfig.SetAutoCheck(const Value: Boolean); begin _AutoCheck := Value; _Changed := True; end; procedure TRRConfig.SetLastPaletteTSA(const Value: Byte); begin _LastPaletteTSA := Value; _Changed := True; end; destructor TRRConfig.Destroy; begin if Assigned(_RecentlyOpenedFiles) = true then FreeAndNil(_RecentlyOpenedFiles); inherited; end; procedure TRRConfig.AddRecentFile(pNewFile : String); var i,index : Integer; TempString : String; begin index := _RecentlyOpenedFiles.IndexOf(pNewFile); if index = -1 then begin for i := 3 downto 0 do begin _RecentlyOpenedFiles[i+1] := _RecentlyOpenedFiles[i]; end; _RecentlyOpenedFiles[0] := pNewFile; end else begin if index > 0 then begin TempString := _RecentlyOpenedFiles[index]; for i := index downto 1 do begin _RecentlyOpenedFiles[i] := _RecentlyOpenedFiles[i - 1]; end; _RecentlyOpenedFiles[0] := TempString; end; end; _Changed := True; end; procedure TRRConfig.LoadDefaultSettings; begin _LeftTextColour := $FFFF0000; _MidTextColour := $FF00FF00; _GridlineColour := $FFFFFFFF; _SpecObjOutline := $FFFF0000; // _LeftTextColour := INI.ReadInteger('General','LeftTextColour',$FFFF0000); _Palette := 'fx3nespal.pal'; _GridlinesOnDef := True; _DisplayLeftMiddleText := True; _BackupFiles := True; _EmulatorFilenameSettings := 0; _EmulatorPath := ''; _EmulatorDisplaySaveWarning := True; _MapperWarnings := 1; _AutoCheck := True; _OriginalROMFile := ''; _IPSOutput := ''; _AutoObjMode := True; _IconTransparency := False; _IconOpaque := 200; _DisableEnemyDeletePrompt := False; _DontAllowEdits := True; end; procedure TRRConfig.SetOriginalROMFile(const Value : String); begin _OriginalROMFile := Value; _Changed := True; end; procedure TRRConfig.SetIPSOutput(const Value : String); begin _IPSOutput := Value; _Changed := True; end; procedure TRRConfig.SetAutoObjMode (const Value : Boolean); begin _AutoObjMode := Value; _Changed := True; end; procedure TRRConfig.CleanupMRU(); var i : Integer; begin for i := 4 downto 0 do begin if FileExists(_RecentlyOpenedFiles[i]) = False then begin _RecentlyOpenedFiles[i] := ''; _Changed := True; end; end; end; procedure TRRConfig.SetIconTransparency(const Value: Boolean); begin _IconTransparency := Value; _Changed := True; end; procedure TRRConfig.SetIconOpaque(const Value: Byte); begin _IconOpaque := Value; _Changed := True; end; procedure TRRConfig.SetDisableEnemyDeletePrompt (const Value : Boolean); begin _DisableEnemyDeletePrompt := Value; _Changed := True; end; procedure TRRConfig.SetDontAllowEdits(const Value: Boolean); begin self._DontAllowEdits := Value; _Changed := True; end; end.
{*************************************************************************} { TTodoList component } { for Delphi & C++Builder } { } { Copyright © 2001-2013 } { Email : info@tmssoftware.com } { Web : http://www.tmssoftware.com } { } { The source code is given as is. The author is not responsible } { for any possible damage done due to the use of this code. } { The component can be freely used in any application. The complete } { source code remains property of the author and may not be distributed, } { published, given or sold in any form as such. No parts of the source } { code can be included in any other component or application without } { written authorization of the author. } {*************************************************************************} unit TodoList; { With the USE_PLANNERDATEPICKER definition disabled, the component uses the Win32 date picker component for date editing. It's colors can be set using the EditColors.DefaultDateEditor property. With the USE_PLANNERDATEPICKER definition enabled, the component has a CalendarType property. The programmer can choose to use the Win32 date picker, or to use the TMS date picker. The colors of the TMS date picker can be set using the EditColors.PlannerDateEditor property. So, for editing the colors of the Win32 date picker, we use the EditColors.DefaultDateEditor property, and for editing the colors of the TMS date picker, we use the EditColors.PlannerDateEditor property. } //{$DEFINE USE_PLANNERDATEPICKER} {$I TMSDEFS.INC} {$R TODOLIST.RES} interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, StdCtrls, ExtCtrls, Forms, Spin, ComCtrls, Math, Mask, Buttons, ComObj, AdvStyleIF, ToDoXPVS, Clipbrd, Types {$IFDEF USE_PLANNERDATEPICKER} , PlannerCal, PlannerDatePicker {$ENDIF} {$IFDEF DELPHI_UNICODE} , Character {$ENDIF} {$IFDEF DELPHIXE3_LVL} , System.UITypes {$ENDIF} ; const CHECKBOXSIZE = 14; {$IFDEF DELPHI_UNICODE} STRSIZE = 2; {$ENDIF} {$IFNDEF DELPHI_UNICODE} STRSIZE = 1; {$ENDIF} MAJ_VER = 1; // Major version nr. MIN_VER = 5; // Minor version nr. REL_VER = 1; // Release nr. BLD_VER = 0; // Build nr. DATE_VER = 'May, 2013'; // Month version // version history // 1.2.3.0 : added MaxLength property in TodoItem // : ImportFromCSV improved // : ClearListOnImport property added // : OnItemRightClick event added // 1.2.3.1 : Sort issue with category column fixed // 1.2.4.0 : Whidbey style added // 1.2.4.1 : Fixed issue with TotalTimeSuffix // 1.2.4.2 : Fixed issue with OnItemRightClick for empty todolist // 1.3.0.0 : New Style interface // : New Office 2007 Luna & Obsidian styles // 1.3.0.1 : Fixed issue for SetFocus // 1.3.1.0 : New support for Office 2007 silver style added // 1.3.2.0 : New exposed Anchors property // 1.3.2.1 : Fixed issue with Item.Select for multiselect mode // 1.3.2.2 : Fixed issue with sorting on tdStatus, tdTotalTime // : Improved : initial completiondate in inplace editor // 1.3.2.3 : Fixed issue with parent visibility change during edit // : Fixed issue with Notes/Priority editor displaying first time // 1.3.2.4 : Fixed issue with focus leave when editing stops // 1.4.0.0 : New: Terminal, Windows Vista & Windows 7 styles // : Fixed : issue with save & load files with Delphi 2009 // 1.5.0.0 : New : Built in support for Office 2010 colors // 1.5.1.0 : New : Windows 8, Office 2013 styles added var CF_TODOITEM: word; type TTodoListBox = class; TCustomTodoList = class; TTodoData = (tdSubject, tdCompletion, tdNotes, tdPriority, tdDueDate, tdStatus, tdImage, tdComplete, tdTotalTime, tdCompletionDate, tdCreationDate, tdResource, tdHandle, tdProject, tdCategory); TCheckType = (ctCheckBox, ctCheckMark, ctGlyph); TSortDirection = (sdAscending, sdDescending); TCompleteClick = procedure(Sender: TObject; ItemIndex: Integer) of object; TTodoDateTimePicker = class(TDateTimePicker) private protected procedure KeyDown(var Key: Word; Shift: TShiftState); override; public published end; { TCompleteCheck } TCompleteCheck = class(TPersistent) private FUnCompletedGlyph: TBitmap; FCompletedGlyph: TBitmap; FCheckType: TCheckType; FOnChange: TNotifyEvent; procedure SetCheckType(const Value: TCheckType); procedure SetCompletedGlyph(const Value: TBitmap); procedure SetUnCompletedGlyph(const Value: TBitmap); protected procedure Changed; public constructor Create; destructor Destroy; override; published property CompletedGlyph: TBitmap read FCompletedGlyph write SetCompletedGlyph; property UnCompletedGlyph: TBitmap read FUnCompletedGlyph write SetUnCompletedGlyph; property CheckType: TCheckType read FCheckType write SetCheckType; property OnChange: TNotifyEvent read FOnChange write FOnChange; end; TTodoListStyle = (esOffice2003Blue, esOffice2003Silver, esOffice2003Olive, esOffice2003Classic, esOffice2007Luna, esOffice2007Obsidian, esWindowsXP, esWhidbey, esCustom, esOffice2007Silver, esWindowsVista, esWindows7, esTerminal, esOffice2010Blue, esOffice2010Silver, esOffice2010Black, esWindows8, esOffice2013White, esOffice2013LightGray, esOffice2013Gray); { TProgressLook } TProgressLook = class(TPersistent) private FUnCompleteFontColor: TColor; FCompleteColor: TColor; FUnCompleteColor: TColor; FCompleteFontColor: TColor; FOnChange: TNotifyEvent; FStacked: Boolean; FShowPercentage: Boolean; FShowBorder: Boolean; FCompletionSmooth: Boolean; FShowGradient: Boolean; FLevel2Perc: Integer; FLevel1Perc: Integer; FSteps: Integer; FLevel3Color: TColor; FLevel1Color: TColor; FLevel0Color: TColor; FLevel3ColorTo: TColor; FLevel2ColorTo: TColor; FLevel0ColorTo: TColor; FLevel1ColorTo: TColor; FBorderColor: TColor; FLevel2Color: TColor; procedure SetCompleteColor(const Value: TColor); procedure SetCompleteFontColor(const Value: TColor); procedure SetUnCompleteColor(const Value: TColor); procedure SetUnCompleteFontColor(const Value: TColor); procedure SetBorderColor(const Value: TColor); procedure SetCompletionSmooth(const Value: Boolean); procedure SetLevel0Color(const Value: TColor); procedure SetLevel0ColorTo(const Value: TColor); procedure SetLevel1Color(const Value: TColor); procedure SetLevel1ColorTo(const Value: TColor); procedure SetLevel1Perc(const Value: Integer); procedure SetLevel2Color(const Value: TColor); procedure SetLevel2ColorTo(const Value: TColor); procedure SetLevel2Perc(const Value: Integer); procedure SetLevel3Color(const Value: TColor); procedure SetLevel3ColorTo(const Value: TColor); procedure SetShowBorder(const Value: Boolean); procedure SetShowGradient(const Value: Boolean); procedure SetShowPercentage(const Value: Boolean); procedure SetStacked(const Value: Boolean); procedure SetSteps(const Value: Integer); protected procedure Changed; public constructor Create; published property CompleteColor: TColor read FCompleteColor write SetCompleteColor; property CompleteFontColor: TColor read FCompleteFontColor write SetCompleteFontColor; property UnCompleteColor: TColor read FUnCompleteColor write SetUnCompleteColor; property UnCompleteFontColor: TColor read FUnCompleteFontColor write SetUnCompleteFontColor; property OnChange: TNotifyEvent read FOnChange write FOnChange; property Level0Color: TColor read FLevel0Color write SetLevel0Color; property Level0ColorTo: TColor read FLevel0ColorTo write SetLevel0ColorTo; property Level1Color: TColor read FLevel1Color write SetLevel1Color; property Level1ColorTo: TColor read FLevel1ColorTo write SetLevel1ColorTo; property Level2Color: TColor read FLevel2Color write SetLevel2Color; property Level2ColorTo: TColor read FLevel2ColorTo write SetLevel2ColorTo; property Level3Color: TColor read FLevel3Color write SetLevel3Color; property Level3ColorTo: TColor read FLevel3ColorTo write SetLevel3ColorTo; property Level1Perc: Integer read FLevel1Perc write SetLevel1Perc; property Level2Perc: Integer read FLevel2Perc write SetLevel2Perc; property BorderColor: TColor read FBorderColor write SetBorderColor; property ShowBorder: Boolean read FShowBorder write SetShowBorder; property Stacked: Boolean read FStacked write SetStacked; property ShowPercentage: Boolean read FShowPercentage write SetShowPercentage; property CompletionSmooth: Boolean read FCompletionSmooth write SetCompletionSmooth; property ShowGradient: Boolean read FShowGradient write SetShowGradient; property Steps: Integer read FSteps write SetSteps; end; TTodoColumnItem = class(TCollectionItem) private FWidth: Integer; FAlignment: TAlignment; FFont: TFont; FColor: TColor; FTodoData: TTodoData; FCaption: string; FOnChange: TNotifyEvent; FEditable: Boolean; FTag: Boolean; FImageIndex: Integer; FMaxLength: Integer; procedure SetWidth(const value: Integer); procedure SetAlignment(const value: tAlignment); procedure SetFont(const value: TFont); procedure SetColor(const value: TColor); procedure SetTodoData(const Value: TTodoData); procedure SetCaption(const Value: string); procedure SetImageIndex(const Value: Integer); protected function GetDisplayName: string; override; procedure SaveToStream(S: TStream); procedure LoadFromStream(S: TStream); public constructor Create(Collection: TCollection); override; destructor Destroy; override; procedure Assign(Source: TPersistent); override; procedure Changed; virtual; property OnChange: TNotifyEvent read FOnChange write FOnChange; published property Alignment: TAlignment read fAlignment write SetAlignment; property Caption: string read FCaption write SetCaption; property Color: TColor read FColor write SetColor; property Editable: Boolean read FEditable write FEditable; // Can this column be edited in-place by the user? property Font: TFont read FFont write SetFont; property ImageIndex: Integer read FImageIndex write SetImageIndex; property Tag: Boolean read FTag write FTag; property TodoData: TTodoData read FTodoData write SetTodoData; property Width: Integer read FWidth write SetWidth; property MaxLength: Integer read FMaxLength write FMaxLength; end; TTodoColumnCollection = class(TCollection) private FOwner: TTodoListBox; function GetItem(Index: Integer): TTodoColumnItem; procedure SetItem(Index: Integer; const Value: TTodoColumnItem); protected procedure Update(Item: TCollectionItem); override; public constructor Create(AOwner: TTodoListBox); procedure Swap(Item1, Item2: TTodoColumnItem); function Add: TTodoColumnItem; function Insert(Index: Integer): TTodoColumnItem; property Items[Index: Integer]: TTodoColumnItem read GetItem write SetItem; default; function GetOwner: TPersistent; override; end; TTodoStatus = (tsNotStarted, tsCompleted, tsInProgress, tsDeferred); TTodoPriority = (tpLowest, tpLow, tpNormal, tpHigh, tpHighest); EConversionFunctionException = class(Exception); TStatusStrings = class(TPersistent) private FOwner: TCustomTodoList; FStatusStrings: array[Low(TTodoStatus)..High(TTodoStatus)] of string; function GetStringD: string; procedure SetStringD(const Value: string); function GetStringC: string; procedure SetStringC(const Value: string); function GetStringI: string; procedure SetStringI(const Value: string); function GetStringN: string; procedure SetStringN(const Value: string); function GetString(Index: TTodoStatus): string; procedure SetString(Index: TTodoStatus; const Value: string); protected property Owner: TCustomTodoList read FOwner; public constructor Create(AOwner: TCustomTodoList); property Items[Index: TTodoStatus]: string read GetString write SetString; default; published property Deferred: string read GetStringD write SetStringD; property NotStarted: string read GetStringN write SetStringN; property Completed: string read GetStringC write SetStringC; property InProgress: string read GetStringI write SetStringI; end; TPriorityStrings = class(TPersistent) private FOwner: TCustomTodoList; FPriorityStrings: array[Low(TTodoPriority)..High(TTodoPriority)] of string; function GetStringH: string; function GetStringHS: string; function GetStringL: string; function GetStringLS: string; function GetStringN: string; procedure SetStringH(const Value: string); procedure SetStringHS(const Value: string); procedure SetStringL(const Value: string); procedure SetStringLS(const Value: string); procedure SetStringN(const Value: string); function GetString(Index: TTodoPriority): string; procedure SetString(Index: TTodoPriority; const Value: string); protected property Owner: TCustomTodoList read FOwner; public constructor Create(AOwner: TCustomTodoList); property Items[Index: TTodoPriority]: string read GetString write SetString; default; published property Lowest: string read GetStringLS write SetStringLS; property Low: string read GetStringL write SetStringL; property Normal: string read GetStringN write SetStringN; property High: string read GetStringH write SetStringH; property Highest: string read GetStringHS write SetStringHS; end; TEditColors = class; TBackForeColors = class(TPersistent) private FColorControl: TWinControl; FOwner: TEditColors; procedure SetFontColor(const Value: TColor); procedure SetBackColor(const Value: TColor); function GetBackColor: TColor; function GetFontColor: TColor; public constructor Create(AOwner: TEditColors; AColorControl: TWinControl); property ColorControl: TWinControl read FColorControl write FColorControl; property Owner: TEditColors read FOwner; published property FontColor: TColor read GetFontColor write SetFontColor; property BackColor: TColor read GetBackColor write SetBackColor; end; TDatePickerColors = class(TPersistent) private FOwner: TEditColors; FColorControl: TTodoDateTimePicker; function GetBackColor: TColor; function GetFontColor: TColor; procedure SetBackColor(const Value: TColor); procedure SetFontColor(const Value: TColor); function GetCalColors: TMonthCalColors; procedure SetCalColors(const Value: TMonthCalColors); public constructor Create(AOwner: TEditColors; AColorControl: TTodoDateTimePicker); property Owner: TEditColors read FOwner; published property BackColor: TColor read GetBackColor write SetBackColor; property FontColor: TColor read GetFontColor write SetFontColor; property CalColors: TMonthCalColors read GetCalColors write SetCalColors; end; {$IFDEF USE_PLANNERDATEPICKER} TPlannerDatePickerColors = class; TCalendarColors = class(TPersistent) private FOwner: TPlannerDatePickerColors; function GetColor: TColor; procedure SetColor(const Value: TColor); function GetEventDayColor: TColor; procedure SetEventDayColor(const Value: TColor); function GetEventMarkerColor: TColor; procedure SetEventMarkerColor(const Value: TColor); function GetFocusColor: TColor; procedure SetFocusColor(const Value: TColor); function GetHeaderColor: TColor; procedure SetHeaderColor(const Value: TColor); function GetInactiveColor: TColor; procedure SetInactiveColor(const Value: TColor); function GetSelectColor: TColor; procedure SetSelectColor(const Value: TColor); function GetSelectFontColor: TColor; procedure SetSelectFontColor(const Value: TColor); function GetTextColor: TColor; procedure SetTextColor(const Value: TColor); function GetWeekendColor: TColor; procedure SetWeekendColor(const Value: TColor); function GetGradientDirection: TGradientDirection; function GetGradientEndColor: TColor; function GetGradientStartColor: TColor; procedure SetGradientDirection(const Value: TGradientDirection); procedure SetGradientEndColor(const Value: TColor); procedure SetGradientStartColor(const Value: TColor); public constructor Create(AOwner: TPlannerDatePickerColors); property Owner: TPlannerDatePickerColors read FOwner; published property Color: TColor read GetColor write SetColor; property EventDayColor: TColor read GetEventDayColor write SetEventDayColor; property EventMarkerColor: TColor read GetEventMarkerColor write SetEventMarkerColor; property FocusColor: TColor read GetFocusColor write SetFocusColor; property GradientDirection: TGradientDirection read GetGradientDirection write SetGradientDirection; property GradientEndColor: TColor read GetGradientEndColor write SetGradientEndColor; property GradientStartColor: TColor read GetGradientStartColor write SetGradientStartColor; property HeaderColor: TColor read GetHeaderColor write SetHeaderColor; property InactiveColor: TColor read GetInactiveColor write SetInactiveColor; property SelectColor: TColor read GetSelectColor write SetSelectColor; property SelectFontColor: TColor read GetSelectFontColor write SetSelectFontColor; property TextColor: TColor read GetTextColor write SetTextColor; property WeekendColor: TColor read GetWeekendColor write SetWeekendColor; end; TPlannerDatePickerColors = class(TPersistent) private FOwner: TEditColors; FColorControl: TPlannerDatePicker; FCalendarColors: TCalendarColors; function GetBackColor: TColor; function GetFontColor: TColor; procedure SetBackColor(const Value: TColor); procedure SetFontColor(const Value: TColor); public constructor Create(AOwner: TEditColors; AColorControl: TPlannerDatePicker); destructor Destroy; override; property Owner: TEditColors read FOwner; published property BackColor: TColor read GetBackColor write SetBackColor; property FontColor: TColor read GetFontColor write SetFontColor; property CalendarColors: TCalendarColors read FCalendarColors write FCalendarColors; end; {$ENDIF} TEditColors = class(TPersistent) private FOwner: TCustomTodoList; FStringEditor: TBackForeColors; FMemoEditor: TBackForeColors; FIntegerEditor: TBackForeColors; FPriorityEditor: TBackForeColors; FStatusEditor: TBackForeColors; {$IFDEF USE_PLANNERDATEPICKER} FPlannerDateEditor: TPlannerDatePickerColors; {$ENDIF} FDefaultDateEditor: TDatePickerColors; public property Owner: TCustomTodoList read FOwner; constructor Create(AOwner: TCustomTodoList); destructor Destroy; override; published property StringEditor: TBackForeColors read FStringEditor write FStringEditor; property MemoEditor: TBackForeColors read FMemoEditor write FMemoEditor; property IntegerEditor: TBackForeColors read FIntegerEditor write FIntegerEditor; property PriorityEditor: TBackForeColors read FPriorityEditor write FPriorityEditor; property StatusEditor: TBackForeColors read FStatusEditor write FStatusEditor; {$IFDEF USE_PLANNERDATEPICKER} property PlannerDateEditor: TPlannerDatePickerColors read FPlannerDateEditor write FPlannerDateEditor; property DefaultDateEditor: TDatePickerColors read FDefaultDateEditor write FDefaultDateEditor; {$ELSE} property DateEditor: TDatePickerColors read FDefaultDateEditor write FDefaultDateEditor; {$ENDIF} end; { Some functions which work with this: TodoStatusToString, TodoStatusFromString, TodoStatusCommaText. The same naming convention for TodoPriority: TodoPriorityToString, TodoPriorityFromString, TodoPriorityCommaText If any of these functions fail, they raise an EConversionFunctionException. } TInplaceSpinEdit = class(TSpinEdit) private FTodoList: TTodoListBox; procedure WMKeyDown(var Msg: TWMKeydown); message WM_KEYDOWN; procedure WMChar(var Msg: TWMChar); message WM_CHAR; protected public constructor Create(AOwner: TComponent); override; published end; TTimeSpinBtnState = set of (tbFocusRect, tbAllowTimer); TTimerSpinButton = class(TSpeedButton) private FRepeatTimer: TTimer; FTimeBtnState: TTimeSpinBtnState; FHasMouse: Boolean; procedure TimerExpired(Sender: TObject); procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; protected procedure Paint; override; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; property TimeBtnState: TTimeSpinBtnState read FTimeBtnState write FTimeBtnState; end; TSpinSpeedButtons = class(TWinControl) private FUpButton: TTimerSpinButton; //TSpeedButton; FDownButton: TTimerSpinButton; //TSpeedButton; FOnUpBtnClick: TNotifyEvent; FOnDownBtnClick: TNotifyEvent; procedure AdjustSize(var W, H: Integer); reintroduce; procedure WMSize(var Message: TWMSize); message WM_SIZE; procedure UpBtnClick(Sender: TObject); procedure DownBtnClick(Sender: TObject); public constructor Create(aOwner: TComponent); override; procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override; published property OnUpBtnClick: TNotifyEvent read FOnUpBtnClick write FOnUpBtnClick; property OnDownBtnClick: TNotifyEvent read FOnDownBtnClick write FOnDownBtnClick; end; TInplaceFloatSpinEdit = class(TCustomMaskEdit) private FTodoList: TTodoListBox; FUpDownBtns: TSpinSpeedButtons; FPrecision: integer; FIncrementFloat: double; FDecSep: Char; procedure WMSize(var Message: TWMSize); message WM_SIZE; procedure WMKeyDown(var Msg: TWMKeydown); message WM_KEYDOWN; procedure WMChar(var Msg: TWMChar); message WM_CHAR; procedure SetEditRect; procedure SetPrecision(const Value: integer); function GetFloatValue: double; procedure SetFloatValue(const Value: double); procedure UpClick(Sender: TObject); procedure DownClick(Sender: TObject); protected procedure KeyPress(var Key: Char); override; function IsValidChar(var Key: Char): Boolean; procedure CreateParams(var Params: TCreateParams); override; procedure CreateWnd; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; published property Precision: integer read FPrecision write SetPrecision; property FloatValue: double read GetFloatValue write SetFloatValue; property IncrementFloat: double read FIncrementFloat write FIncrementFloat; property DecSep: Char read fDecSep write fDecSep; property OnExit; end; TInplaceListBox = class(TListBox) private FOldItemIndex: Integer; FOnSelected: TNotifyEvent; FMouseDown: Boolean; FTodoList: TTodoListBox; function GetItemIndexEx: Integer; procedure SetItemIndexEx(const Value: Integer); procedure CMWantSpecialKey(var Msg: TCMWantSpecialKey); message CM_WANTSPECIALKEY; protected procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure KeyPress(var Key: Char); override; public constructor Create(AOwner: TComponent); override; published property OnSelected: TNotifyEvent read FOnSelected write FOnSelected; property ItemIndex: Integer read GetItemIndexEx write SetItemIndexEx; end; TInplaceODListBox = class(TInplaceListBox) private FImageList: TImageList; FTodoList: TTodoListBox; protected procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState); override; public constructor Create(AOwner: TComponent); override; published property ImageList: TImageList read FImageList write FImageList; end; TInplaceMemo = class(TMemo) private FOldText: TStringList; FTodoList: TTodoListBox; procedure CMWantSpecialKey(var Msg: TCMWantSpecialKey); message CM_WANTSPECIALKEY; protected procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyPress(var Key: Char); override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; published property OrigLines: TStringList read FOldText; end; TInplaceEdit = class(TEdit) private FOldText: string; FTodoList: TTodoListBox; FNumericOnly: Boolean; function GetText: string; procedure SetText(const Value: string); protected procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyPress(var Key: Char); override; procedure CreateParams(var Params: TCreateParams); override; public constructor Create(AOwner: TComponent); override; property NumericOnly: Boolean read FNumericOnly write FNumericOnly; published property Text: string read GetText write SetText; end; TCompletion = 0..100; TTodoItem = class(TCollectionItem) private FImageIndex: Integer; FNotes: TStringList; FTag: Integer; FTotalTime: double; FSubject: string; FCompletion: TCompletion; FDueDate: TDateTime; FPriority: TTodoPriority; FStatus: TTodoStatus; FOnChange: TNotifyEvent; FComplete: Boolean; FCreationDate: TDateTime; FCompletionDate: TDateTime; FResource: string; FDBKey: string; FProject: string; FCategory: string; procedure SetImageIndex(const value: Integer); procedure StringsChanged(sender: TObject); procedure SetCompletion(const Value: TCompletion); procedure SetDueDate(const Value: TDateTime); procedure SetNotes(const Value: TStringList); procedure SetPriority(const Value: TTodoPriority); procedure SetStatus(const Value: TTodoStatus); procedure SetSubject(const Value: string); procedure SetTotalTime(const Value: double); procedure SetComplete(const Value: Boolean); procedure SetCompletionDate(const Value: TDateTime); procedure SetCreationDate(const Value: TDateTime); procedure SetResource(const Value: string); function GetNotesLine: string; procedure SetProject(const Value: string); procedure SetCategory(const Value: string); protected function GetDisplayName: string; override; public constructor Create(Collection: TCollection); override; destructor Destroy; override; procedure Assign(Source: TPersistent); override; procedure Changed; virtual; procedure Select; procedure UnSelect; procedure SaveToStream(S: TStream); procedure LoadFromStream(S: TStream); property DBKey: string read FDBKey write FDBKey; property NotesLine: string read GetNotesLine; property OnChange: TNotifyEvent read FOnChange write FOnChange; published property Category: string read FCategory write SetCategory; property Complete: Boolean read FComplete write SetComplete; property Completion: TCompletion read FCompletion write SetCompletion; property CompletionDate: TDateTime read FCompletionDate write SetCompletionDate; property CreationDate: TDateTime read FCreationDate write SetCreationDate; property DueDate: TDateTime read FDueDate write SetDueDate; property ImageIndex: Integer read FImageIndex write SetImageIndex; property Notes: TStringList read FNotes write SetNotes; property Priority: TTodoPriority read FPriority write SetPriority; property Project: string read FProject write SetProject; property Resource: string read FResource write SetResource; property Status: TTodoStatus read FStatus write SetStatus; property Subject: string read FSubject write SetSubject; property Tag: Integer read FTag write FTag; property TotalTime: double read FTotalTime write SetTotalTime; end; TTodoItemCollection = class(TCollection) private FOwner: TTodoListBox; function GetItem(Index: Integer): TTodoItem; procedure SetItem(Index: Integer; const Value: TTodoItem); procedure PasteItem(Position: Boolean); protected procedure Update(Item: TCollectionItem); override; procedure ItemChanged(Index: Integer); public constructor Create(AOwner: TTodoListBox); function GetItemClass: TCollectionItemClass; virtual; procedure Changed; virtual; function Add: TTodoItem; function Insert(Index: Integer): TTodoItem; function GetOwner: TPersistent; override; function IndexOf(s: string): TPoint; function IndexInTodoOf(col: Integer; s: string): Integer; function IndexInRowOf(row: Integer; s: string): Integer; procedure CopyToClipboard; procedure CutToClipboard; procedure PasteFromClipboard; property Items[Index: Integer]: TTodoItem read GetItem write SetItem; default; end; TTodoItemIO = class(TComponent) FItem: TTodoItem; public constructor CreateItem(AOwner: TTodoItemCollection); destructor Destroy; override; published property Item: TTodoItem read FItem write FItem; end; TGridLineStyle = (glsNone, glsItems, glsAlways); {$IFDEF DELPHIXE2_LVL} [ComponentPlatformsAttribute(pidWin32 or pidWin64)] {$ENDIF} TTodoListBox = class(TCustomListBox) private // Variables that represent the current editing state ActiveEditor: TWinControl; // current active editor, or nil if no active editor EditedColumn: TTodoColumnItem; EditedItem: TTodoItem; { If ActiveEditor<>nil, then the Edited* variables represent the current edited column and item. } // The actual editor objects. StringEditor: TInplaceEdit; FNumericOnlyEditor: TInplaceEdit; StringListEditor: TInplaceMemo; {$IFDEF USE_PLANNERDATEPICKER} PlannerDateEditor: TPlannerDatePicker; {$ENDIF} DefaultDateEditor: TTodoDateTimePicker; IntegerEditor: TInplaceSpinEdit; FFloatEditor: TInplaceFloatSpinEdit; PriorityEditor: TInplaceODListBox; StatusEditor: TInplaceListBox; EditorParent: TForm; { end of in-place editor object } FOwner: TCustomTodoList; FImages: TImageList; FPriorityImageList: TImageList; FTodoColumns: TTodoColumnCollection; FTodoItems: TTodoItemCollection; FGridLines: TGridLineStyle; FGridLineColor: TColor; FItemIndex: Integer; FUpdateCount: Integer; FSortTodo: Integer; FSortedEx: Boolean; FLookupIncr: Boolean; FLookupTodo: Integer; FLookup: string; FDateFormat: string; FColumnsChanged: TNotifyEvent; FPreview: Boolean; FPreviewFont: TFont; FCompletionFont: TFont; FProgressLook: TProgressLook; FShowSelection: Boolean; FPriorityFont: TFont; FEditable: Boolean; FEditSelectAll: Boolean; FSelectionColor: TColor; FSelectionFontColor: TColor; FFocusColumn: Integer; FOnSelectItem: TNotifyEvent; FSelectionColorTo: TColor; FActiveColumnColor: TColor; FUseTab: Boolean; FShowPriorityText: Boolean; FIsWinXP: Boolean; FOnHorizontalScroll: TNotifyEvent; fScrollHorizontal: Boolean; FActiveItemColorTo: TColor; FActiveItemColor: TColor; FMouseDownNotDone: Boolean; FHandleGlyph: TBitmap; FPreviewColorTo: TColor; FPreviewColor: TColor; FStretchLastColumn: Boolean; FTotalTimeSuffix: string; procedure EditorOnExit(Sender: TObject); { This procedure is executed when the in-place editors lose focus. The task of this procedure is to transfer the edited data from the editor to the TodoListBox, then to hide the editor. } procedure EditorParentOnDeactivate(Sender: TObject); { This procedure is executed when the EditorParent deactivates. This calls EditorOnExit, in order to deactivate the active in-place editor. } procedure SetImages(const Value: TImageList); procedure SetItemIndexEx(const Value: Integer); function GetItemIndexEx: Integer; procedure SetGridLines(const Value: TGridLineStyle); procedure SynchItems; procedure SynchColumns; { function GetTodoItems(i, j: Integer): String; procedure SetTodoItems(i, j: Integer; const Value: String); } function GetSortedEx: Boolean; procedure SetSortedEx(const Value: Boolean); procedure SetDateFormat(const Value: string); procedure SetPreview(const Value: Boolean); procedure SetCompletionFont(const Value: TFont); procedure SetPreviewFont(const Value: TFont); procedure SetProgressLook(const Value: TProgressLook); procedure ProgressLookChanged(Sender: TObject); procedure SetShowSelection(const Value: Boolean); procedure SetPriorityFont(const Value: TFont); procedure CNCommand(var Message: TWMCommand); message CN_COMMAND; procedure WMHScroll(var WMScroll: TWMScroll); message WM_HSCROLL; procedure WMLButtonUp(var Message: TWMLButtonDown); message WM_LBUTTONUP; procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN; // procedure WMEraseBkGnd(var Message: TWMEraseBkGnd); message WM_ERASEBKGND; // procedure WMPaint(var Message: TWMPaint); message WM_PAINT; procedure WMVScroll(var Message: TWMScroll); message WM_VSCROLL; procedure CMHintShow(var M: TCMHintShow); message CM_HINTSHOW; procedure CMWantSpecialKey(var Msg: TCMWantSpecialKey); message CM_WANTSPECIALKEY; function XYToColItem(const X, Y: Integer; var ColIdx, ItemIdx: Integer; var R: TRect): Boolean; procedure ColItemRect(ColIdx, ItemIdx: Integer; var R: TRect); function ClickedOnNotes(const CalcItem: Boolean; const P: TPoint; out ItemIdx: Integer; out R: TRect): Boolean; procedure SetSelectionColor(const Value: TColor); procedure SetSelectionFontColor(const Value: TColor); procedure StartEdit(Index, Column: Integer; FromMouse: Boolean; Msg: TMessage; X, Y: Integer; ch: Char); procedure AdvanceEdit; procedure SetSelectionColorTo(const Value: TColor); procedure SetActiveColumnColor(const Value: TColor); procedure SetShowPriorityText(const Value: Boolean); procedure SetScrollHorizontal(const Value: Boolean); function MaxHorizontalExtent: integer; procedure InputFromCSV(FileName: string; insertmode: Boolean); procedure OutputToCSV(FileName: string; appendmode: Boolean); procedure SetActiveItemColor(const Value: TColor); procedure SetActiveItemColorTo(const Value: TColor); procedure SetHandleGlyph(const Value: TBitmap); procedure SetGridLineColor(const Value: TColor); procedure SetPreviewColor(const Value: TColor); procedure SetPreviewColorTo(const Value: TColor); procedure SetStretchLastColumn(const Value: Boolean); function GetControlWidth: Integer; protected procedure MeasureItem(Index: Integer; var Height: Integer); override; procedure WndProc(var Message: TMessage); override; //procedure WMSize(var Msg: TWMSize); message WM_SIZE; procedure UpdateHScrollExtent(maxextent: Integer); procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyPress(var Key: Char); override; procedure CreateWnd; override; procedure Notification(AComponent: TComponent; AOperation: TOperation); override; property Items; procedure DoEnter; override; procedure SendClickMessage(Msg: TMessage; X, Y: Integer); procedure SetEditorFont(Editor: TWinControl; Font: TFont); procedure EditNotesInPreviewArea(Idx: Integer; R: TRect; Msg: TMessage; X, Y: Integer); procedure ShowEditor(Editor: TWinControl; R: TRect; UseSeparateParent: boolean); procedure RepaintItem(Index: Integer); procedure SetHorizontalScrollBar; procedure DrawGrid(ACanvas: TCanvas); public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Loaded; override; property Text; procedure BeginUpdate; procedure EndUpdate; published property ActiveColumnColor: TColor read FActiveColumnColor write SetActiveColumnColor; property ActiveItemColor: TColor read FActiveItemColor write SetActiveItemColor; property ActiveItemColorTo: TColor read FActiveItemColorTo write SetActiveItemColorTo; property Align; property Anchors; property Constraints; property DragKind; property BorderStyle; property Color; property CompletionFont: TFont read FCompletionFont write SetCompletionFont; property Cursor; property Ctl3D; property DateFormat: string read FDateFormat write SetDateFormat; property DragCursor; property DragMode; property Editable: Boolean read FEditable write FEditable; property EditSelectAll: Boolean read FEditSelectAll write FEditSelectAll; // If false, the caret will be put in the location the user clicked. If true, the whole subject text will be selected on user click. property Enabled; property Font; property GridLines: TGridLineStyle read FGridLines write SetGridLines default glsAlways; property GridLineColor: TColor read FGridLineColor write SetGridLineColor; property HandleGlyph: TBitmap read FHandleGlyph write SetHandleGlyph; property Images: TImageList read FImages write SetImages; property IntegralHeight; property ItemHeight; property ItemIndex: Integer read GetItemIndexEx write SetItemIndexEx; property LookupIncr: Boolean read fLookupIncr write fLookupIncr; property LookupTodo: Integer read fLookupTodo write fLookupTodo; property MultiSelect; property ParentColor; property ParentCtl3D; property ParentFont; property ParentShowHint; property PopupMenu; property Preview: Boolean read FPreview write SetPreview; property PreviewFont: TFont read FPreviewFont write SetPreviewFont; property PreviewColor: TColor read FPreviewColor write SetPreviewColor default clNone; property PreviewColorTo: TColor read FPreviewColorTo write SetPreviewColorTo default clNone; property PriorityFont: TFont read FPriorityFont write SetPriorityFont; property ProgressLook: TProgressLook read FProgressLook write SetProgressLook; property ScrollHorizontal: Boolean read fScrollHorizontal write SetScrollHorizontal; property SelectionColor: TColor read FSelectionColor write SetSelectionColor; property SelectionColorTo: TColor read FSelectionColorTo write SetSelectionColorTo; property SelectionFontColor: TColor read FSelectionFontColor write SetSelectionFontColor; property ShowHint; property ShowPriorityText: Boolean read FShowPriorityText write SetShowPriorityText; property ShowSelection: Boolean read FShowSelection write SetShowSelection; property SortTodo: Integer read FSortTodo write FSortTodo; property Sorted: Boolean read GetSortedEx write SetSortedEx; property StretchLastColumn: Boolean read FStretchLastColumn write SetStretchLastColumn default True; property TabOrder; property TabStop; property TodoColumns: TTodoColumnCollection read FTodoColumns write FTodoColumns; property TodoItems: TTodoItemCollection read FTodoItems write FTodoItems; property UseTab: Boolean read FUseTab write FUseTab; property Visible; property OnClick; property OnDblClick; property OnDragDrop; property OnDragOver; property OnDrawItem; property OnEndDrag; property OnEnter; property OnExit; property OnKeyDown; property OnKeyPress; property OnKeyUp; property OnMouseMove; property OnMouseDown; property OnMouseUp; property OnMeasureItem; property OnStartDrag; property OnHorizontalScroll: TNotifyEvent read FOnHorizontalScroll write FOnHorizontalScroll; property OnStartDock; property OnEndDock; property OnContextPopup; property OnColumnsChanged: TNotifyEvent read FColumnsChanged write FColumnsChanged; property OnSelectItem: TNotifyEvent read FOnSelectItem write FOnSelectItem; property TotalTimeSuffix: string read FTotalTimeSuffix write FTotalTimeSuffix; end; TImagePosition = (ipLeft, ipRight); TVAlignment = (vtaCenter, vtaTop, vtaBottom); THeaderOrientation = (hoHorizontal, hoVertical); THeaderClickEvent = procedure(Sender: TObject; SectionIndex: Integer) of object; THeaderDragDropEvent = procedure(Sender: TObject; FromSection, ToSection: Integer) of object; TTodoHeader = class(THeader) private FOffset: Integer; FLeftPos: Integer; FAlignment: TAlignment; FVAlignment: TVAlignment; FColor: TColor; FLineColor: TColor; FFlat: Boolean; FImageList: TImageList; FInplaceEdit: TMemo; FImagePosition: TImagePosition; FOnClick: THeaderClickEvent; FOnRightClick: THeaderClickEvent; FOnDragDrop: THeaderDragDropEvent; FOrientation: THeaderOrientation; FSectionDragDrop: Boolean; FDragging: Boolean; FDragStart: Integer; FEditSection: Integer; FEditWidth: Integer; FOnSectionEditEnd: THeaderClickEvent; FOnSectionEditStart: THeaderClickEvent; FSectionEdit: Boolean; FItemHeight: Integer; FTextHeight: Integer; FSortedSection: Integer; FSortDirection: TSortDirection; FSortShow: Boolean; FOwner: TCustomTodoList; FHScroll: integer; FColorTo: TColor; FActiveColorTo: TColor; FActiveColor: TColor; FActiveColumn: Integer; procedure SetAlignment(const Value: TAlignment); procedure SetColor(const Value: TColor); procedure SetImageList(const Value: TImageList); procedure SetImagePosition(const Value: TImagePosition); procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN; procedure WMLButtonUp(var Message: TWMLButtonUp); message WM_LBUTTONUP; procedure WMRButtonDown(var Message: TWMLButtonDown); message WM_RBUTTONDOWN; procedure SetOrientation(const Value: THeaderOrientation); procedure SetFlat(const Value: Boolean); procedure SetLineColor(const Value: TColor); procedure SetVAlignment(const Value: TVAlignment); procedure InplaceExit(Sender: TObject); procedure SetItemHeight(const Value: Integer); procedure SetTextHeight(const Value: Integer); procedure SetSortDirection(const Value: TSortDirection); procedure SetSortedSection(const Value: Integer); procedure DrawSortIndicator(Canvas: TCanvas; X, Y: Integer); procedure OwnOnDragDrop(Sender: TObject; FromSection, ToSection: Integer); procedure SetColorTo(const Value: TColor); procedure SetActiveColor(const Value: TColor); procedure SetActiveColorTo(const Value: TColor); procedure SetActiveColumn(const Value: Integer); public constructor Create(AOwner: TComponent); override; destructor Destroy; override; protected function XYToSection(X, Y: Integer): Integer; function GetSectionRect(X: Integer): TRect; procedure Paint; override; procedure HorizontalScroll(X: integer); published property Alignment: TAlignment read FAlignment write SetAlignment; property ActiveColumn: Integer read FActiveColumn write SetActiveColumn; property ActiveColor: TColor read FActiveColor write SetActiveColor; property ActiveColorTo: TColor read FActiveColorTo write SetActiveColorTo; property Color: TColor read FColor write SetColor; property ColorTo: TColor read FColorTo write SetColorTo; property Flat: Boolean read FFlat write SetFlat; property Images: TImageList read FImageList write SetImageList; property ImagePosition: TImagePosition read FImagePosition write SetImagePosition; property ItemHeight: Integer read FItemHeight write SetItemHeight; property TextHeight: Integer read FTextHeight write SetTextHeight; property LineColor: TColor read FLineColor write SetLineColor; property SectionDragDrop: Boolean read FSectionDragDrop write FSectionDragDrop; property SectionEdit: Boolean read FSectionEdit write FSectionEdit; property SortedSection: Integer read FSortedSection write SetSortedSection; property SortDirection: TSortDirection read FSortDirection write SetSortDirection; property SortShow: Boolean read FSortShow write FSortShow; property VAlignment: TVAlignment read FVAlignment write SetVAlignment; property Orientation: THeaderOrientation read FOrientation write SetOrientation default hoHorizontal; property OnClick: THeaderClickEvent read FOnClick write FOnClick; property OnDragDrop: THeaderDragDropEvent read FOnDragDrop write FOnDragDrop; property OnRightClick: THeaderClickEvent read FOnRightClick write FOnRightClick; property OnSectionEditStart: THeaderClickEvent read FOnSectionEditStart write FOnSectionEditStart; property OnSectionEditEnd: THeaderClickEvent read FOnSectionEditEnd write FOnSectionEditEnd; end; TStatusToStringEvent = procedure(Sender: TObject; AValue: TTodoStatus; var AString: string) of object; TStringToStatusEvent = procedure(Sender: TObject; AString: string; var AValue: TTodoStatus) of object; TPriorityToStringEvent = procedure(Sender: TObject; AValue: TTodoPriority; var AString: string) of object; TStringToPriorityEvent = procedure(Sender: TObject; AString: string; var AValue: TTodoPriority) of object; TTodoItemEvent = procedure(Sender: TObject; ATodoItem: TTodoItem; var Allow: Boolean) of object; TTodoItemSelectEvent = procedure(Sender: TObject; ATodoItem: TTodoItem) of object; TListHeaderEvent = procedure(Sender: TObject; Column: Integer) of object; TOnHeaderDragDropEvent = procedure(Sender: TObject; FromCol, ToCol: Integer) of object; {$IFDEF USE_PLANNERDATEPICKER} TCalendarType = (tcDefaultCalendar, tcPlannerCalendar); {$ENDIF} TCustomTodoList = class(TCustomControl, ITMSStyle) { TCustomTodoList is made of a TTodoHeader and a TTodoListBox bellow it. } private {$IFDEF USE_PLANNERDATEPICKER} FCalendarType: TCalendarType; {$ENDIF} FTodoHeader: TTodoHeader; FTodoListBox: TTodoListBox; FBorderStyle: TBorderStyle; FOnMouseUp: TMouseEvent; FOnMouseDown: TMouseEvent; FOnMouseMove: TMouseMoveEvent; FOnKeyDown: TKeyEvent; FOnKeyUp: TKeyEvent; FOnKeyPress: TKeyPressEvent; FOnPriorityToString: TPriorityToStringEvent; FOnStatusToString: TStatusToStringEvent; FOnStringToPriority: TStringToPriorityEvent; FOnStringToStatus: TStringToStatusEvent; FPreviewHeight: Integer; FItemHeight: Integer; FStatusStrings: TStatusStrings; FPriorityStrings: TPriorityStrings; FEditColors: TEditColors; FCompleteCheck: TCompleteCheck; FOnClick: TNotifyEvent; FOnDblClick: TNotifyEvent; FOnDragDrop: TDragDropEvent; FOnEndDrag: TEndDragEvent; FOnDragOver: TDragOverEvent; FOnStartDrag: TStartDragEvent; FOnEnter: TNotifyEvent; FOnExit: TNotifyEvent; FSorted: Boolean; FSortColumn: Integer; FSortDirection: TSortDirection; FNewIdx: Integer; FOnHeaderRightClick: TListHeaderEvent; FOnHeaderClick: TListHeaderEvent; FAutoInsertItem: Boolean; FAutoDeleteItem: Boolean; FOnItemInsert: TTodoItemEvent; FOnItemDelete: TTodoItemEvent; FOnEditStart: TNotifyEvent; FOnEditDone: TNotifyEvent; FOnItemSelect: TTodoItemSelectEvent; FOnItemRightClick: TTodoItemSelectEvent; FCompletionGraphic: Boolean; FHintShowFullText: Boolean; FHeaderDragDrop: Boolean; FOnHeaderDragDrop: TOnHeaderDragDropEvent; FAutoAdvanceEdit: Boolean; FStatusListWidth: Integer; FPriorityListWidth: Integer; FNullDate: string; FOnCompleteClick: TCompleteClick; FCategory: TStringList; FLook: TTodoListStyle; FAutoThemeAdapt: Boolean; FTotalTimeSuffix: string; procedure NCPaintProc; function GetColor: TColor; procedure SetColor(const Value: TColor); function GetFont: TFont; procedure SetFont(const Value: TFont); function GetTodoItems: TTodoItemCollection; procedure SetTodoItems(const Value: TTodoItemCollection); procedure SetBorderStyle(const Value: TBorderStyle); function GetTodoColumns: TTodoColumnCollection; procedure SetTodoColumns(const Value: TTodoColumnCollection); procedure SectionSized(Sender: TObject; SectionIdx, SectionWidth: Integer); function GetDateFormat: string; procedure SetDateFormat(const Value: string); procedure SetImages(const Value: TImageList); function GetImages: TImageList; function GetGridLines: TGridLineStyle; procedure SetGridLines(const Value: TGridLineStyle); function GetItemHeight: Integer; procedure SetItemHeight(const Value: Integer); function GetPreview: Boolean; procedure SetPreview(const Value: Boolean); function GetCompletionFont: TFont; function GetPreviewFont: TFont; procedure SetCompletionFont(const Value: TFont); procedure SetPreviewFont(const Value: TFont); function GetProgressLook: TProgressLook; procedure SetProgressLook(const Value: TProgressLook); { function XYToColItem(const X,Y: Integer; var ColIdx,ItemIdx: Integer; var R:TRect): Boolean; } function GetPriorityFont: TFont; procedure SetPriorityFont(const Value: TFont); procedure SetEditable(const Value: boolean); function GetEditable: boolean; function GetSelectAllInSubjectEdit: Boolean; procedure SetSelectAllInSubjectEdit(const Value: Boolean); function GetShowSelection: Boolean; procedure SetShowSelection(const Value: Boolean); procedure SetPreviewHeight(const Value: Integer); function GetSelectionColor: TColor; function GetSelectionFontColor: TColor; procedure SetSelectionColor(const Value: TColor); procedure SetSelectionFontColor(const Value: TColor); procedure SetCompleteCheck(const Value: TCompleteCheck); function GetDragCursor: TCursor; function GetDragKind: TDragKind; function GetDragMode: TDragMode; procedure SetDragCursor(const Value: TCursor); procedure SetDragKind(const Value: TDragKind); procedure SetDragModeEx(const Value: TDragMode); procedure SetSortColumn(const Value: Integer); procedure SetSortDirection(const Value: TSortDirection); procedure SetSorted(const Value: Boolean); function GetSelected: TTodoItem; function GetHeaderFont: TFont; procedure SetHeaderFont(const Value: TFont); function GetEditColumn: Integer; procedure SetEditColumn(const Value: Integer); function GetTabStopEx: Boolean; procedure SetTabStopEx(const Value: Boolean); function GetTabOrderEx: Integer; procedure SetTabOrderEx(const Value: Integer); procedure SetCompletionGraphic(const Value: Boolean); procedure SetHeaderDragDrop(const Value: Boolean); procedure SetHintShowFullText(const Value: Boolean); procedure SetNullDate(const Value: string); function GetEditItem: TTodoItem; function GetSelectionColorTo: TColor; procedure SetSelectionColorTo(const Value: TColor); function GetActiveColumnColor: TColor; procedure SetActiveColumnColor(const Value: TColor); function GetUseTab: Boolean; procedure SetUseTab(const Value: Boolean); function GetMultiSelect: Boolean; procedure SetMultiSelect(const Value: Boolean); function GetSelCount: integer; function GetItemSelected(Index: Integer): Boolean; procedure SetItemSelected(Index: Integer; const Value: Boolean); function GetShowPriorityText: Boolean; procedure SetShowPriorityText(const Value: Boolean); procedure LisBoxHorizontalScroll(Sender: TObject); procedure SetCategory(const Value: TStringList); function GetActiveItemColor: TColor; function GetActiveItemColorTo: TColor; procedure SetActiveItemColor(const Value: TColor); procedure SetActiveItemColorTo(const Value: TColor); function GetScrollHorizontal: Boolean; procedure SetScrollHorizontal(const Value: Boolean); function GetHeaderColor: TColor; function GetHeaderColorTo: TColor; procedure SetHeaderColor(const Value: TColor); procedure SetHeaderColorTo(const Value: TColor); function GetHandleGlyph: TBitmap; procedure SetHandleGlyph(const Value: TBitmap); procedure SetHeaderImages(const Value: TImageList); function GetHeaderImages: TImageList; function GetHeaderHeight: Integer; procedure SetHeaderHeight(const Value: Integer); function GetGridLineColor: TColor; procedure SetGridLineColor(const Value: TColor); function GetPreviewColor: TColor; function GetPreviewColorTo: TColor; procedure SetPreviewColor(const Value: TColor); procedure SetPreviewColorTo(const Value: TColor); function GetStretchLastColumn: Boolean; procedure SetStretchLastColumn(const Value: Boolean); function GetHeaderActiveColor: TColor; function GetHeaderActiveColorTo: TColor; procedure SetHeaderActiveColor(const Value: TColor); procedure SetHeaderActiveColorTo(const Value: TColor); procedure SetLook(const Value: TTodoListStyle); procedure SetComponentStyle(AStyle: TTMSStyle); procedure ThemeAdapt; function GetVersion: string; procedure SetVersion(const Value: string); procedure SetTotalTimeSuffix(const Value: string); protected procedure WndProc(var Message: TMessage); override; procedure CreateWnd; override; procedure CreateParams(var Params: TCreateParams); override; { The procedures bellow (ListXXX) are event handlers for the member TTodoListBox object. Their only purpose is to call the TCustomTodoList event handlers. } procedure ListMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure ListMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure ListMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure ListKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); procedure ListKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure ListKeyPress(Sender: TObject; var Key: Char); procedure ListClick(Sender: TObject); procedure ListDblClick(Sender: TObject); procedure ListDragDrop(Sender, Source: TObject; X, Y: Integer); procedure ListDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); procedure ListStartDrag(Sender: TObject; var DragObject: TDragObject); procedure ListEndDrag(Sender, Target: TObject; X, Y: Integer); procedure ListEnter(Sender: TObject); procedure ListExit(Sender: TObject); procedure ListSelect(Sender: TObject); procedure HeaderClick(Sender: TObject; Section: Integer); procedure HeaderRightClick(Sender: TObject; Section: Integer); procedure CheckChanged(Sender: TObject); function CompareItems(A, B: Integer): Integer; procedure SwapItems(A, B: Integer); procedure QuickSortItems(Left, Right: Integer); function AllowAutoDelete(ATodoItem: TTodoItem): Boolean; virtual; function AllowAutoInsert(ATodoItem: TTodoItem): Boolean; virtual; procedure ItemSelect(ATodoItem: TTodoItem); virtual; procedure EditDone(Data: TTodoData; EditItem: TTodoItem); virtual; procedure CompleteClick(ItemIndex: Integer); procedure EditStart; virtual; property TodoListBox: TTodoListBox read FTodoListBox; procedure ColumnsChanged(Sender: TObject); function FormatDateTimeEx(Format: string; dt: TDateTime): string; procedure Notification(AComponent: TComponent; AOperation: TOperation); override; function GetVersionNr: Integer; virtual; function GetVersionString:string; virtual; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Loaded; override; procedure SetFocus; override; procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override; function StatusToString(AValue: TTodoStatus): string; virtual; function StringToStatus(AValue: string): TTodoStatus; virtual; function PriorityToString(AValue: TTodoPriority): string; virtual; function StringToPriority(AValue: string): TTodoPriority; virtual; function StatusCommaText: string; virtual; function PriorityCommaText: string; virtual; procedure SaveToStream(S: TStream); procedure LoadFromStream(S: TStream); procedure ImportFromCSV(FileName: string); virtual; procedure ExportToCSV(FileName: string); procedure SaveToFile(FileName: string); procedure LoadFromFile(FileName: string); procedure SaveColumns(FileName: string); procedure LoadColumns(FileName: string); procedure Sort; procedure HideEditor; procedure ShowEditor(Index, Column: Integer); procedure SelectAll; property VersionNr: Integer read GetVersionNr; property VersionString: string read GetVersionString; property List: TTodoListBox read FTodoListBox; property Selected: TTodoItem read GetSelected; property ItemSelected[Index: Integer]: Boolean read GetItemSelected write SetItemSelected; property EditColumn: Integer read GetEditColumn write SetEditColumn; property EditItem: TTodoItem read GetEditItem; procedure AddColumn(Data: TTodoData; ACaption: string); procedure RemoveColumn(Data: TTodoData); property ActiveColumnColor: TColor read GetActiveColumnColor write SetActiveColumnColor; property ActiveItemColor: TColor read GetActiveItemColor write SetActiveItemColor; property ActiveItemColorTo: TColor read GetActiveItemColorTo write SetActiveItemColorTo; property Align; property AutoAdvanceEdit: Boolean read FAutoAdvanceEdit write FAutoAdvanceEdit; property AutoInsertItem: Boolean read FAutoInsertItem write FAutoInsertItem default True; property AutoDeleteItem: Boolean read FAutoDeleteItem write FAutoDeleteItem default True; property AutoThemeAdapt: Boolean read FAutoThemeAdapt write FAutoThemeAdapt default False; property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle default bsSingle; property Category: TStringList read FCategory write SetCategory; {$IFDEF USE_PLANNERDATEPICKER} property CalendarType: TCalendarType read FCalendarType write FCalendarType default tcPlannerCalendar; {$ENDIF} property Color: TColor read GetColor write SetColor; property Columns: TTodoColumnCollection read GetTodoColumns write SetTodoColumns; property CompleteCheck: TCompleteCheck read FCompleteCheck write SetCompleteCheck; property CompletionFont: TFont read GetCompletionFont write SetCompletionFont; property CompletionGraphic: Boolean read FCompletionGraphic write SetCompletionGraphic default True; property Cursor; property DateFormat: string read GetDateFormat write SetDateFormat; property DragCursor: TCursor read GetDragCursor write SetDragCursor; property DragMode: TDragMode read GetDragMode write SetDragModeEx; property DragKind: TDragKind read GetDragKind write SetDragKind; property Editable: boolean read GetEditable write SetEditable; property EditColors: TEditColors read FEditColors write FEditColors; property EditSelectAll: Boolean read GetSelectAllInSubjectEdit write SetSelectAllInSubjectEdit; // If false, the caret will be put in the location the user clicked. If true, the whole subject text will be selected on user click. property Font: TFont read GetFont write SetFont; property GridLines: TGridLineStyle read GetGridLines write SetGridLines default glsAlways; property GridLineColor: TColor read GetGridLineColor write SetGridLineColor; property HandleGlyph: TBitmap read GetHandleGlyph write SetHandleGlyph; property HeaderColor: TColor read GetHeaderColor write SetHeaderColor; property HeaderColorTo: TColor read GetHeaderColorTo write SetHeaderColorTo; property HeaderActiveColor: TColor read GetHeaderActiveColor write SetHeaderActiveColor; property HeaderActiveColorTo: TColor read GetHeaderActiveColorTo write SetHeaderActiveColorTo; property HeaderDragDrop: Boolean read FHeaderDragDrop write SetHeaderDragDrop default False; property HeaderFont: TFont read GetHeaderFont write SetHeaderFont; property HeaderHeight: Integer read GetHeaderHeight write SetHeaderHeight; property HeaderImages: TImageList read GetHeaderImages write SetHeaderImages; property HintShowFullText: Boolean read FHintShowFullText write SetHintShowFullText default False; property Images: TImageList read GetImages write SetImages; property Items: TTodoItemCollection read GetTodoItems write SetTodoItems; property ItemHeight: Integer read GetItemHeight write SetItemHeight; property Look: TTodoListStyle read FLook write SetLook default esOffice2003Blue; property MultiSelect: Boolean read GetMultiSelect write SetMultiSelect; property NullDate: string read FNullDate write SetNullDate; property Preview: Boolean read GetPreview write SetPreview; property PreviewFont: TFont read GetPreviewFont write SetPreviewFont; property PreviewColor: TColor read GetPreviewColor write SetPreviewColor; property PreviewColorTo: TColor read GetPreviewColorTo write SetPreviewColorTo; property PreviewHeight: Integer read FPreviewHeight write SetPreviewHeight; property PriorityFont: TFont read GetPriorityFont write SetPriorityFont; property PriorityStrings: TPriorityStrings read FPriorityStrings write FPriorityStrings; property PriorityListWidth: Integer read FPriorityListWidth write FPriorityListWidth; property ProgressLook: TProgressLook read GetProgressLook write SetProgressLook; property ScrollHorizontal: Boolean read GetScrollHorizontal write SetScrollHorizontal; property SelCount: integer read GetSelCount; property SelectionColor: TColor read GetSelectionColor write SetSelectionColor; property SelectionColorTo: TColor read GetSelectionColorTo write SetSelectionColorTo; property SelectionFontColor: TColor read GetSelectionFontColor write SetSelectionFontColor; property ShowPriorityText: Boolean read GetShowPriorityText write SetShowPriorityText; property ShowSelection: Boolean read GetShowSelection write SetShowSelection; property Sorted: Boolean read FSorted write SetSorted; property SortDirection: TSortDirection read FSortDirection write SetSortDirection; property SortColumn: Integer read FSortColumn write SetSortColumn; property StatusStrings: TStatusStrings read FStatusStrings write FStatusStrings; property StatusListWidth: Integer read FStatusListWidth write FStatusListWidth; property StretchLastColumn: Boolean read GetStretchLastColumn write SetStretchLastColumn; property TabStop: Boolean read GetTabStopEx write SetTabStopEx; property TabOrder: Integer read GetTabOrderEx write SetTabOrderEx; property UseTab: Boolean read GetUseTab write SetUseTab; property OnClick: TNotifyEvent read FOnClick write FOnClick; property OnCompleteClick: TCompleteClick read FOnCompleteClick write FOnCompleteClick; property OnDblClick: TNotifyEvent read FOnDblClick write FOnDblClick; property OnDragDrop: TDragDropEvent read FOnDragDrop write FOnDragDrop; property OnDragOver: TDragOverEvent read FOnDragOver write FOnDragOver; property OnEditDone: TNotifyEvent read FOnEditDone write FOnEditDone; property OnEditStart: TNotifyEvent read FOnEditStart write FOnEditStart; property OnExit: TNotifyEvent read FOnExit write FOnExit; property OnEnter: TNotifyEvent read FOnEnter write FOnEnter; property OnHeaderClick: TListHeaderEvent read FOnHeaderClick write FOnHeaderClick; property OnHeaderDragDrop: TOnHeaderDragDropEvent read FOnHeaderDragDrop write FOnHeaderDragDrop; property OnHeaderRightClick: TListHeaderEvent read FOnHeaderRightClick write FOnHeaderRightClick; property OnItemDelete: TTodoItemEvent read FOnItemDelete write FOnItemDelete; property OnItemInsert: TTodoItemEvent read FOnItemInsert write FOnItemInsert; property OnItemSelect: TTodoItemSelectEvent read FOnItemSelect write FOnItemSelect; property OnItemRightClick: TTodoItemSelectEvent read FOnItemRightClick write FOnItemRightClick; property OnStartDrag: TStartDragEvent read FOnStartDrag write FOnStartDrag; property OnEndDrag: TEndDragEvent read FOnEndDrag write FOnEndDrag; property OnKeyDown: TKeyEvent read FOnKeyDown write FOnKeyDown; property OnKeyUp: TKeyEvent read FOnKeyUp write FOnKeyUp; property OnKeyPress: TKeyPressEvent read FOnKeyPress write FOnKeyPress; property OnMouseMove: TMouseMoveEvent read FOnMouseMove write FOnMouseMove; property OnMouseDown: TMouseEvent read FOnMouseDown write FOnMouseDown; property OnMouseUp: TMouseEvent read FOnMouseUp write FOnMouseUp; property OnStatusToString: TStatusToStringEvent read FOnStatusToString write FOnStatusToString; property OnStringToStatus: TStringToStatusEvent read FOnStringToStatus write FOnStringToStatus; property OnPriorityToString: TPriorityToStringEvent read FOnPriorityToString write FOnPriorityToString; property OnStringToPriority: TStringToPriorityEvent read FOnStringToPriority write FOnStringToPriority; property Version: string read GetVersion write SetVersion; property TotalTimeSuffix: string read FTotalTimeSuffix write SetTotalTimeSuffix; end; {$IFDEF DELPHIXE2_LVL} [ComponentPlatformsAttribute(pidWin32 or pidWin64)] {$ENDIF} TTodoList = class(TCustomTodoList) published property ActiveColumnColor; property ActiveItemColor; property ActiveItemColorTo; property Align; property Anchors; property AutoAdvanceEdit; property AutoInsertItem; property AutoDeleteItem; property AutoThemeAdapt; property BorderStyle; property Category; {$IFDEF USE_PLANNERDATEPICKER} property CalendarType; {$ENDIF} property Color; property Columns; property CompleteCheck; property CompletionFont; property CompletionGraphic; property Cursor; property DateFormat; property DragCursor; property DragMode; property DragKind; property Editable; property EditColors; property EditSelectAll; property Font; property GridLines; property GridLineColor; property HandleGlyph; property HeaderActiveColor; property HeaderActiveColorTo; property HeaderColor; property HeaderColorTo; property HeaderDragDrop; property HeaderFont; property HeaderHeight; property HeaderImages; property HintShowFullText; property Images; property ItemHeight; property Items; property Look; property NullDate; property MultiSelect; property PopupMenu; property Preview; property PreviewFont; property PreviewColor; property PreviewColorTo; property PreviewHeight; property PriorityFont; property PriorityStrings; property PriorityListWidth; property ProgressLook; property ScrollHorizontal; property SelCount; property SelectionColor; property SelectionColorTo; property SelectionFontColor; property ShowPriorityText; property ShowSelection; property Sorted; property SortDirection; property SortColumn; property StatusStrings; property StatusListWidth; property StretchLastColumn; property TabOrder; property TabStop; property UseTab; property OnClick; property OnCompleteClick; property OnDblClick; property OnDragDrop; property OnDragOver; property OnEditDone; property OnEditStart; property OnEnter; property OnExit; property OnHeaderClick; property OnHeaderDragDrop; property OnHeaderRightClick; property OnItemDelete; property OnItemInsert; property OnItemSelect; property OnItemRightClick; property OnStartDrag; property OnEndDrag; property OnKeyDown; property OnKeyUp; property OnKeyPress; property OnMouseMove; property OnMouseDown; property OnMouseUp; property OnStatusToString; property OnStringToStatus; property OnPriorityToString; property OnStringToPriority; property Version; property TotalTimeSuffix; end; TGaugeOrientation = (goHorizontal, goVertical); TGaugeSettings = record Level0Color: TColor; Level0ColorTo: TColor; Level1Color: TColor; Level1ColorTo: TColor; Level2Color: TColor; Level2ColorTo: TColor; Level3Color: TColor; Level3ColorTo: TColor; Level1Perc: Integer; Level2Perc: Integer; BorderColor: TColor; ShowBorder: Boolean; Stacked: Boolean; ShowPercentage: Boolean; Font: TFont; CompletionSmooth: Boolean; ShowGradient: Boolean; Steps: Integer; Position: Integer; BackgroundColor: TColor; Orientation: TGaugeOrientation; end; procedure DrawGauge(Canvas: TCanvas; R: TRect; Position: Integer; Settings: TGaugeSettings); function ReadInteger(S: TStream): Integer; function ReadDouble(S: TStream): Double; function ReadWord(S: TStream): Word; function ReadString(S: TStream; Size: Integer): string; function ReadDateTime(S: TStream): TDateTime; function ReadByte(S: TStream): Byte; function ReadBoolean(S: TStream): Boolean; procedure WriteInteger(S: TStream; Value: Integer); procedure SaveProperty(S: TStream; ID: Byte; Buffer: Pointer; Size: Word); function VarCharPos(ch: Char; const s: string; var Res: Integer): Integer; function SinglePos(p: char; s: string; var sp: Integer): Integer; function DoubleToSingleChar(ch: Char; const s: string): string; procedure CSVToLineFeeds(var s: string); implementation uses ShellApi, CommCtrl, Dialogs, ImgList; const LINEFEED = #13; const // theme changed notifier WM_THEMECHANGED = $031A; type XPColorScheme = (xpNone, xpBlue, xpGreen, xpGray); {$I DELPHIXE.INC} function IsNumChar(ch: char): boolean; begin {$IFNDEF DELPHIXE4_LVL} {$IFNDEF DELPHI_UNICODE} Result := (ch in ['0'..'9']); {$ENDIF} {$IFDEF DELPHI_UNICODE} Result := Character.IsNumber(ch); {$ENDIF} {$ENDIF} {$IFDEF DELPHIXE4_LVL} Result := ch.IsNumber; {$ENDIF} end; function CurrentXPTheme:XPColorScheme; var FileName, ColorScheme, SizeName: WideString; hThemeLib: THandle; GetCurrentThemeName: function(pszThemeFileName: PWideChar; cchMaxNameChars: Integer; pszColorBuff: PWideChar; cchMaxColorChars: Integer; pszSizeBuff: PWideChar; cchMaxSizeChars: Integer): THandle cdecl stdcall; IsThemeActive: function: BOOL cdecl stdcall; begin hThemeLib := 0; Result := xpNone; try hThemeLib := LoadLibrary('uxtheme.dll'); if hThemeLib > 0 then begin IsThemeActive := GetProcAddress(hThemeLib,'IsThemeActive'); if Assigned(IsThemeActive) then if IsThemeActive then begin GetCurrentThemeName := GetProcAddress(hThemeLib,'GetCurrentThemeName'); if Assigned(GetCurrentThemeName) then begin SetLength(FileName, 255); SetLength(ColorScheme, 255); SetLength(SizeName, 255); OleCheck(GetCurrentThemeName(PWideChar(FileName), 255, PWideChar(ColorScheme), 255, PWideChar(SizeName), 255)); if (PWideChar(ColorScheme) = 'NormalColor') then Result := xpBlue else if (PWideChar(ColorScheme) = 'HomeStead') then Result := xpGreen else if (PWideChar(ColorScheme) = 'Metallic') then Result := xpGray else Result := xpNone; end; end; end; finally if hThemeLib <> 0 then FreeLibrary(hThemeLib); end; end; //------------------------------------------------------------------------------ function VarPos(su, s: string; var Respos: Integer): Integer; begin Respos := Pos(su, s); Result := Respos; end; function CharPos(ch: Char; const s: string): Integer; var i: Integer; begin Result := 0; for i := 1 to Length(s) do if s[i] = ch then begin Result := i; Break; end; end; procedure CSVToLineFeeds(var s: string); var res: string; i: Integer; begin if CharPos(#10, s) = 0 then Exit; Res := ''; for i := 1 to Length(s) do if s[i] = #10 then Res := Res + #13#10 else Res := Res + s[i]; s := Res; end; function DoubleToSingleChar(ch: Char; const s: string): string; var Res: string; i: Integer; begin if (s = '') or (CharPos(ch, s) = 0) then begin DoubleToSingleChar := s; Exit; end; res := ''; i := 1; repeat if s[i] <> ch then Res := Res + s[i] else if ((s[i] = ch) and (s[i + 1] = ch)) then begin Inc(i); Res := Res + s[i]; end; Inc(i); until (i > Length(s)); DoubleToSingleChar := Res; { res := s[1]; for i := 2 to Length(s) do begin if s[i] <> ch then Res := Res + s[i] else if ((s[i] = ch) and (s[i - 1] <> ch)) then Res := Res + s[i]; end; DoubleToSingleChar := Res; } end; function SinglePos(p: char; s: string; var sp: Integer): Integer; var i: Integer; QuoteCount: Integer; begin i := 1; QuoteCount := 0; while i <= Length(s) do begin if s[i] = p then begin if i < Length(s) then Inc(QuoteCount) else if i = Length(s) then begin Result := i; sp := i; Exit; end; end else begin if (Odd(QuoteCount)) then begin Result := i - 1; sp := i - 1; Exit; end else QuoteCount := 0; end; Inc(i); end; Result := 0; sp := 0; end; function VarCharPos(ch: Char; const s: string; var Res: Integer): Integer; var i: Integer; begin Result := 0; for i := 1 to Length(s) do if s[i] = ch then begin Res := i; Result := i; Break; end; end; procedure LineFeedsToCSV(var s: string); var vp: Integer; begin while VarPos(#13#10, s, vp) > 0 do Delete(s, vp, 2); s := '"' + s + '"'; end; function LinesInText(s: string; multiline: boolean): Integer; var vp: Integer; begin Result := 1; if not Multiline then Exit; while VarPos(LINEFEED, s, vp) > 0 do begin Inc(Result); Delete(s, 1, vp); end; end; function CSVQuotes(const s: string): string; var i: Integer; begin Result := ''; for i := 1 to length(s) do begin Result := Result + s[i]; if s[i] = '"' then Result := Result + '"'; end; end; //----------------------------------------------------------------- DrawGradient procedure DrawGradient(Canvas: TCanvas; FromColor, ToColor: TColor; Steps: Integer; R: TRect; Direction: Boolean); var diffr, startr, endr: Integer; diffg, startg, endg: Integer; diffb, startb, endb: Integer; rstepr, rstepg, rstepb, rstepw: Real; i, stepw: Word; begin if Steps = 0 then Steps := 1; FromColor := ColorToRGB(FromColor); ToColor := ColorToRGB(ToColor); startr := (FromColor and $0000FF); startg := (FromColor and $00FF00) shr 8; startb := (FromColor and $FF0000) shr 16; endr := (ToColor and $0000FF); endg := (ToColor and $00FF00) shr 8; endb := (ToColor and $FF0000) shr 16; diffr := endr - startr; diffg := endg - startg; diffb := endb - startb; rstepr := diffr / steps; rstepg := diffg / steps; rstepb := diffb / steps; if Direction then rstepw := (R.Right - R.Left) / Steps else rstepw := (R.Bottom - R.Top) / Steps; with Canvas do begin for i := 0 to steps - 1 do begin endr := startr + Round(rstepr * i); endg := startg + Round(rstepg * i); endb := startb + Round(rstepb * i); stepw := Round(i * rstepw); Pen.Color := endr + (endg shl 8) + (endb shl 16); Brush.Color := Pen.Color; if Direction then Rectangle(R.Left + stepw, R.Top, R.Left + stepw + Round(rstepw) + 1, R.Bottom) else Rectangle(R.Left, R.Top + stepw, R.Right, R.Top + stepw + Round(rstepw) + 1); end; end; end; //------------------------------------------------------------------------------ procedure DrawRectangle(Canvas: TCanvas; R: TRect; aColor: TColor); begin canvas.Brush.Color := aColor; Canvas.FillRect(R); end; //-------------------------------------------------------------------- DrawGauge { procedure DivideInSegment(Canvas: TCanvas; R: TRect; Position: integer); var i: integer; r1: TRect; begin r1.Left := 10; r1.Top := 1; r1.Right := 12; r1.Bottom := R.Bottom + 2; for i := 0 to R.Right div 9 do begin Canvas.Brush.Color := clBtnFace; Canvas.FillRect(r1); r1.Left := r1.Left + 9; r1.Right := r1.Left + 2; end; end; } procedure DrawGauge(Canvas: TCanvas; R: TRect; Position: Integer; Settings: TGaugeSettings); var RectL: TRect; RectM: TRect; RectR: TRect; WidthBar: integer; WidthPart: Integer; Continue: Boolean; GradDir: Boolean; BrushColor: TColor; BrushColorTo: TColor; Percentage: Integer; BarFilled: Integer; NumberOfBlock: Integer; i: Integer; EmptyWidth: integer; {$IFNDEF TMSCLX} lf: TLogFont; {$ENDIF} tf: TFont; R1: TRect; R2: TRect; begin if (Settings.Orientation = goHorizontal) then WidthBar := R.Right - R.Left else WidthBar := R.Bottom - R.Top; Continue := true; Percentage := -1; Canvas.Brush.Color := Settings.BackgroundColor; GradDir := not (Settings.Orientation = goHorizontal); if (Settings.ShowPercentage) then Percentage := Position; //Draw Border if (Settings.ShowBorder) then Canvas.Pen.Color := Settings.BorderColor else Canvas.Pen.Color := Settings.BackgroundColor; Canvas.Rectangle(R.Left, R.Top, R.Right, R.Bottom); WidthBar := WidthBar - 2; if (Position > 0) then begin if (Settings.Stacked) then begin if (Position >= Settings.Level1Perc) then WidthPart := Round((Settings.Level1Perc / 100) * WidthBar) else begin WidthPart := Round((Position / 100) * WidthBar); Continue := false; end; //Draw first part if (Settings.Orientation = goHorizontal) then begin RectL.Left := R.Left + 1; RectL.Top := R.Top + 1; RectL.Right := RectL.Left + WidthPart; RectL.Bottom := r.Bottom - 1; end else begin RectL.Left := r.Left + 1; RectL.Right := R.Right - 1; RectL.Top := R.Bottom - WidthPart; RectL.Bottom := R.Bottom - 1; end; if (Settings.ShowGradient) then begin if not (Settings.Orientation = goHorizontal) then begin R1.Left := RectL.Left; R1.Right := RectL.Left + (RectL.Right - RectL.Left) div 2; R1.Bottom := RectL.Bottom; R1.Top := RectL.Top; R2.Left := R1.Right; R2.Right := RectL.Right; R2.Bottom := RectL.Bottom; R2.Top := RectL.Top; end else begin R1.Left := RectL.Left; R1.Right := RectL.Right; R1.Top := RectL.Top; R1.Bottom := RectL.Top + (RectL.Bottom - RectL.Top) div 2; R2.Top := R1.Bottom; R2.Left := RectL.Left; R2.Right := RectL.Right; R2.Bottom := RectL.Bottom; end; DrawGradient(Canvas, Settings.Level0ColorTo, Settings.Level0Color, Settings.Steps, R1, GradDir); DrawGradient(Canvas, Settings.Level0Color, Settings.Level0ColorTo, Settings.Steps, R2, GradDir); end else DrawRectangle(Canvas, RectL, Settings.Level0Color); BarFilled := WidthPart; if (Continue) then begin //Draw second part if (Settings.Orientation = goHorizontal) then begin RectM.Left := RectL.Right; RectM.Top := r.Top + 1; RectM.Bottom := r.Bottom - 1; end else begin RectM.Left := R.Left + 1; RectM.Right := R.Right - 1; RectM.Bottom := RectL.Top; end; if (Position >= Settings.Level2Perc) then WidthPart := Round(WidthBar * ((Settings.Level2Perc - Settings.Level1Perc) / 100)) else begin WidthPart := Round(WidthBar * ((Position - Settings.Level1Perc) / 100)); Continue := false; end; if (Settings.Orientation = goHorizontal) then RectM.Right := WidthPart + RectM.Left else RectM.Top := RectM.Bottom - WidthPart; if (Settings.ShowGradient) then begin if not (Settings.Orientation = goHorizontal) then begin R1.Left := RectM.Left; R1.Right := RectM.Left + (RectM.Right - RectM.Left) div 2; R1.Bottom := RectM.Bottom; R1.Top := RectM.Top; R2.Left := R1.Right; R2.Right := RectM.Right; R2.Bottom := RectM.Bottom; R2.Top := RectM.Top; end else begin R1.Left := RectM.Left; R1.Right := RectM.Right; R1.Top := RectM.Top; R1.Bottom := RectM.Top + (RectM.Bottom - RectM.Top) div 2; R2.Top := R1.Bottom; R2.Left := RectM.Left; R2.Right := RectM.Right; R2.Bottom := RectM.Bottom; end; DrawGradient(Canvas, Settings.Level1ColorTo, Settings.Level1Color, Settings.Steps, R1, GradDir); DrawGradient(Canvas, Settings.Level1Color, Settings.Level1ColorTo, Settings.Steps, R2, GradDir); end else DrawRectangle(Canvas, RectM, Settings.Level1Color); BarFilled := BarFilled + WidthPart; if (Continue) then begin //Draw third part if (Position = 100) then WidthPart := Round(WidthBar - BarFilled) else WidthPart := Round(WidthBar * ((Position - Settings.Level2Perc) / 100)); if (Settings.Orientation = goHorizontal) then begin RectR.Left := RectM.Right; RectR.Top := R.Top + 1; RectR.Bottom := r.Bottom - 1; RectR.Right := RectR.Left + WidthPart; end else begin RectR.Left := R.Left + 1; RectR.Right := R.Right - 1; RectR.Bottom := RectM.Top - 1; RectR.Top := RectR.Bottom - WidthPart; end; if (Settings.ShowGradient) then begin if not (Settings.Orientation = goHorizontal) then begin R1.Left := RectR.Left; R1.Right := RectR.Left + (RectR.Right - RectR.Left) div 2; R1.Bottom := RectR.Bottom; R1.Top := RectR.Top; R2.Left := R1.Right; R2.Right := RectR.Right; R2.Bottom := RectR.Bottom; R2.Top := RectR.Top; end else begin R1.Left := RectR.Left; R1.Right := RectR.Right; R1.Top := RectR.Top; R1.Bottom := RectR.Top + (RectR.Bottom - RectR.Top) div 2; R2.Top := R1.Bottom; R2.Left := RectR.Left; R2.Right := RectR.Right; R2.Bottom := RectR.Bottom; end; DrawGradient(Canvas, Settings.Level3ColorTo, Settings.Level3Color, Settings.Steps, R1, GradDir); DrawGradient(Canvas, Settings.Level3Color, Settings.Level3ColorTo, Settings.Steps, R2, GradDir); end else DrawRectangle(Canvas, RectR, Settings.Level3Color); end; end; end else begin if (Position < Settings.Level1Perc) then begin BrushColor := Settings.Level0Color; BrushColorTo := Settings.Level0ColorTo; end else begin if (Position < Settings.Level2Perc) then begin BrushColor := Settings.Level1Color; BrushColorTo := Settings.Level1ColorTo; end else begin if (Position < 100) then begin BrushColor := Settings.Level2Color; BrushColorTo := Settings.Level2ColorTo; end else begin BrushColor := Settings.Level3Color; BrushColorTo := Settings.Level3ColorTo; end; end; end; if not (Settings.CompletionSmooth) then begin Canvas.Brush.Color := Settings.BackgroundColor; if (Round((Position * WidthBar) / 100) > 9) then begin if (Settings.Orientation = goHorizontal) then begin RectL.Left := R.Left + 2; RectL.Right := RectL.Left + 7; RectL.Top := R.Top + 2; RectL.Bottom := R.Bottom - 2; end else begin RectL.Left := R.Left + 2; RectL.Right := R.Right - 2; RectL.Bottom := R.Bottom - 2; RectL.Top := RectL.Bottom - 7; end; if (Settings.ShowGradient) then begin if not (Settings.Orientation = goHorizontal) then begin R1.Left := RectL.Left; R1.Right := RectL.Left + (RectL.Right - RectL.Left) div 2; R1.Bottom := RectL.Bottom; R1.Top := RectL.Top; R2.Left := R1.Right; R2.Right := RectL.Right; R2.Bottom := RectL.Bottom; R2.Top := RectL.Top; end else begin R1.Left := RectL.Left; R1.Right := RectL.Right; R1.Top := RectL.Top; R1.Bottom := RectL.Top + (RectL.Bottom - RectL.Top) div 2; R2.Top := R1.Bottom; R2.Left := RectL.Left; R2.Right := RectL.Right; R2.Bottom := RectL.Bottom; end; DrawGradient(Canvas, BrushColorTo, BrushColor, Settings.Steps, R1, GradDir); DrawGradient(Canvas, BrushColor, BrushColorTo, Settings.Steps, R2, GradDir); end else DrawRectangle(Canvas, RectL, BrushColor); NumberOfBlock := (Round((Position * WidthBar) / 100) div 9) - 1; EmptyWidth := Round((Position * WidthBar) / 100) mod 9; for i := 0 to NumberOfBlock - 1 do begin if (Settings.Orientation = goHorizontal) then begin RectL.Left := RectL.Right + 2; RectL.Right := RectL.Left + 7; end else begin RectL.Bottom := RectL.Top - 2; RectL.Top := RectL.Bottom - 7; end; if (Settings.ShowGradient) then begin if not (Settings.Orientation = goHorizontal) then begin R1.Left := RectL.Left; R1.Right := RectL.Left + (RectL.Right - RectL.Left) div 2; R1.Bottom := RectL.Bottom; R1.Top := RectL.Top; R2.Left := R1.Right; R2.Right := RectL.Right; R2.Bottom := RectL.Bottom; R2.Top := RectL.Top; end else begin R1.Left := RectL.Left; R1.Right := RectL.Right; R1.Top := RectL.Top; R1.Bottom := RectL.Top + (RectL.Bottom - RectL.Top) div 2; R2.Top := R1.Bottom; R2.Left := RectL.Left; R2.Right := RectL.Right; R2.Bottom := RectL.Bottom; end; DrawGradient(Canvas, BrushColorTo, BrushColor, Settings.Steps, R1, GradDir); DrawGradient(Canvas, BrushColor, BrushColorTo, Settings.Steps, R2, GradDir); end else DrawRectangle(Canvas, RectL, BrushColor); end; if (EmptyWidth > 2) then begin if (Settings.Orientation = goHorizontal) then begin RectL.Left := RectL.Right + 2; RectL.Right := RectL.Left + (EmptyWidth - 1); end else begin RectL.Bottom := RectL.Top - 2; RectL.Top := RectL.Bottom - (EmptyWidth - 1); end; if (Settings.ShowGradient) then begin if not (Settings.Orientation = goHorizontal) then begin R1.Left := RectL.Left; R1.Right := RectL.Left + (RectL.Right - RectL.Left) div 2; R1.Bottom := RectL.Bottom; R1.Top := RectL.Top; R2.Left := R1.Right; R2.Right := RectL.Right; R2.Bottom := RectL.Bottom; R2.Top := RectL.Top; end else begin R1.Left := RectL.Left; R1.Right := RectL.Right; R1.Top := RectL.Top; R1.Bottom := RectL.Top + (RectL.Bottom - RectL.Top) div 2; R2.Top := R1.Bottom; R2.Left := RectL.Left; R2.Right := RectL.Right; R2.Bottom := RectL.Bottom; end; DrawGradient(Canvas, BrushColorTo, BrushColor, Settings.Steps, R1, GradDir); DrawGradient(Canvas, BrushColor, BrushColorTo, Settings.Steps, R2, GradDir); end else DrawRectangle(Canvas, RectL, BrushColor); end; Canvas.Brush.style := bsClear; end else begin if (Round((Position * WidthBar) / 100) > 1) then begin if (Settings.Orientation = goHorizontal) then begin RectL.Left := R.Left + 2; RectL.Right := RectL.Left + (Round((Position * WidthBar) / 100) - 1); RectL.Top := R.Top + 2; RectL.Bottom := R.Bottom - 2; end else begin RectL.Left := R.Left + 2; RectL.Right := R.Right - 2; RectL.Bottom := R.Bottom - 2; RectL.Top := RectL.Bottom - (Round((Position * WidthBar) / 100) - 1); end; if (Settings.ShowGradient) then begin if not (Settings.Orientation = goHorizontal) then begin R1.Left := RectL.Left; R1.Right := RectL.Left + (RectL.Right - RectL.Left) div 2; R1.Bottom := RectL.Bottom; R1.Top := RectL.Top; R2.Left := R1.Right; R2.Right := RectL.Right; R2.Bottom := RectL.Bottom; R2.Top := RectL.Top; end else begin R1.Left := RectL.Left; R1.Right := RectL.Right; R1.Top := RectL.Top; R1.Bottom := RectL.Top + (RectL.Bottom - RectL.Top) div 2; R2.Top := R1.Bottom; R2.Left := RectL.Left; R2.Right := RectL.Right; R2.Bottom := RectL.Bottom; end; DrawGradient(Canvas, BrushColorTo, BrushColor, Settings.Steps, R1, GradDir); DrawGradient(Canvas, BrushColor, BrushColorTo, Settings.Steps, R2, GradDir); end else DrawRectangle(Canvas, RectL, BrushColor); end; end; end else begin WidthPart := Round((Position / 100) * WidthBar); if (Settings.Orientation = goHorizontal) then begin RectL.Left := R.Left + 1; RectL.Top := R.Top + 1; RectL.Right := RectL.Left + WidthPart; RectL.Bottom := R.Bottom - 1; end else begin RectL.Left := r.Left + 1; RectL.Bottom := R.Bottom - 1; RectL.Top := RectL.Bottom - WidthPart; RectL.Right := r.Right - 1; end; if (Settings.ShowGradient) then begin if not (Settings.Orientation = goHorizontal) then begin R1.Left := RectL.Left; R1.Right := RectL.Left + (RectL.Right - RectL.Left) div 2; R1.Bottom := RectL.Bottom; R1.Top := RectL.Top; R2.Left := R1.Right; R2.Right := RectL.Right; R2.Bottom := RectL.Bottom; R2.Top := RectL.Top; end else begin R1.Left := RectL.Left; R1.Right := RectL.Right; R1.Top := RectL.Top; R1.Bottom := RectL.Top + (RectL.Bottom - RectL.Top) div 2; R2.Top := R1.Bottom; R2.Left := RectL.Left; R2.Right := RectL.Right; R2.Bottom := RectL.Bottom; end; DrawGradient(Canvas, BrushColorTo, BrushColor, Settings.Steps, R1, GradDir); DrawGradient(Canvas, BrushColor, BrushColorTo, Settings.Steps, R2, GradDir); end else DrawRectangle(Canvas, RectL, BrushColor); end; end; end; //Draw text with PositionPercentage if (Percentage <> -1) then begin Canvas.Brush.Style := bsClear; Canvas.Font.Name := Settings.Font.Name; Canvas.Font.Size := Settings.Font.Size; Canvas.Font.Color := Settings.Font.Color; Canvas.Font.Style := Settings.Font.Style; if not (Settings.Orientation = goHorizontal) then begin tf := TFont.Create; try tf.Assign(Settings.Font); {$IFNDEF TMSCLX} GetObject(tf.Handle, sizeof(lf), @lf); lf.lfEscapement := 900; lf.lfOrientation := 900; tf.Handle := CreateFontIndirect(lf); {$ENDIF} Canvas.Font.Assign(tf); Canvas.TextOut(R.Left + ((R.Right - R.Left) div 2 - (Canvas.TextHeight(IntToStr(Percentage) + '%') div 2)), R.Top + ((R.Bottom - R.Top) div 2) + Canvas.TextWidth(IntToStr(Percentage) + '%') div 2 , IntToStr(Percentage) + '%'); finally tf.Free; end; end else begin Canvas.TextOut(((R.Right - R.Left) div 2) - (Canvas.TextWidth(IntToStr(Percentage) + '%') div 2) + r.Left, r.Top + ((R.Bottom - R.Top) div 2) - Canvas.TextHeight(IntToStr(Percentage) + '%') div 2, IntToStr(Percentage) + '%'); end; end; if (Settings.ShowBorder) then Canvas.Pen.Color := Settings.BorderColor else Canvas.Pen.Color := Settings.BackgroundColor; Canvas.Brush.Style := bsClear; Canvas.Rectangle(R.Left, R.Top, R.Right, R.Bottom); end; //------------------------------------------------------------------------------ procedure SaveProperty(S: TStream; ID: Byte; Buffer: Pointer; Size: Word); begin S.Write(ID, 1); S.Write(Size, 2); S.Write(Buffer^, Size); end; procedure WriteInteger(S: TStream; Value: Integer); begin S.Write(Value, 4); end; function ReadBoolean(S: TStream): Boolean; begin S.Read(Result, 1); end; function ReadByte(S: TStream): Byte; begin S.Read(Result, 1); end; function ReadDateTime(S: TStream): TDateTime; begin S.Read(Result, 8); end; function ReadString(S: TStream; Size: Integer): string; begin SetLength(Result, Size div STRSIZE); S.Read(Result[1], Size); end; function ReadWord(S: TStream): Word; begin S.Read(Result, 2); end; function ReadInteger(S: TStream): Integer; begin S.Read(Result, 4); end; function ReadDouble(S: TStream): Double; begin S.Read(Result, 8); end; { Calculates the border withs of a WinControl. } procedure WinControlBorderWidths(WinControl: TWinControl; out LeftBorderWidth, RightBorderWidth, TopBorderWidth, BottomBorderWidth: integer); var WindowRect: TRect; ClientOrigin: TPoint; begin // Put window rect, client origin into local variables GetWindowRect(WinControl.Handle, WindowRect); ClientOrigin := WinControl.ClientOrigin; LeftBorderWidth := ClientOrigin.X - WindowRect.Left; TopBorderWidth := ClientOrigin.Y - WindowRect.Top; RightBorderWidth := WindowRect.Right - (ClientOrigin.X + WinControl.ClientWidth); BottomBorderWidth := WindowRect.Bottom - (ClientOrigin.Y + WinControl.ClientHeight); end; function AlignToFlag(alignment: TAlignment): dword; begin case Alignment of taLeftJustify: Result := DT_LEFT; taRightJustify: Result := DT_RIGHT; taCenter: Result := DT_CENTER; else Result := DT_LEFT; end; end; procedure TTodoListBox.CNCommand(var Message: TWMCommand); begin inherited; if Message.NotifyCode = LBN_SELCHANGE then begin if Assigned(FOnSelectItem) then FOnSelectItem(Self); //DrawGrid(); end; end; procedure TTodoListBox.WMHScroll(var WMScroll: TWMScroll); begin if ActiveEditor <> nil then EditorOnExit(Self); inherited; if (WMScroll.ScrollCode <> SB_ENDSCROLL) then begin if Assigned(FOnHorizontalScroll) then FOnHorizontalScroll(Self); end; if (GetScrollPos(Handle, SB_HORZ) = 0) then Invalidate; end; function TTodoListBox.XYToColItem(const X, Y: Integer; var ColIdx, ItemIdx: Integer; var R: TRect): Boolean; begin ItemIdx := SendMessage(Handle, LB_ITEMFROMPOINT, 0, MakeLong(X, Y)); Result := ItemIdx >= 0; if Result then begin SendMessage(Handle, LB_GETITEMRECT, ItemIdx, Longint(@R)); R.Bottom := R.Top + FOwner.ItemHeight - 1; R.Left := R.Left - GetScrollPos(Handle, SB_HORZ); // New Result := False; ColIdx := 0; while ColIdx < TodoColumns.Count do begin R.Right := R.Left + TodoColumns.Items[ColIdx].Width; if not ScrollHorizontal and (ColIdx = TodoColumns.Count - 1) and (r.Right < Width) and StretchLastColumn then begin // if visible items < total items // subtract scrollbar size r.Right := GetControlWidth; end; if (X >= R.Left) and (X < R.Right) and (Y <= R.Bottom) then begin Result := True; Break; end else R.Left := R.Right; Inc(ColIdx); end; end; end; procedure TTodoListBox.ColItemRect(ColIdx, ItemIdx: Integer; var R: TRect); var j: Integer; begin SendMessage(Handle, LB_GETITEMRECT, ItemIdx, Longint(@R)); R.Bottom := R.Top + FOwner.ItemHeight - 1; R.Left := R.Left - GetScrollPos(Handle, SB_HORZ); // New j := 0; while (j < TodoColumns.Count) do begin R.Right := R.Left + TodoColumns.Items[j].Width; if (j = ColIdx) then begin if not ScrollHorizontal and (j = TodoColumns.Count - 1) and (r.Right < Width) and StretchLastColumn then begin r.Right := GetControlWidth; end; Break end else R.Left := R.Right; Inc(j); end; end; procedure TTodoListBox.DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState); var r, pr, R2, R3: TRect; su: string; Align: DWORD; col: Integer; IHeight: Integer; IIndent: Integer; PaintGradient: Boolean; dx: integer; ACanvas: TCanvas; dc: HDC; CurDate: TDate; LB: TLogBrush; HPen,HOldPen: THandle; brect: TRect; procedure DrawCheck(R: TRect; State: Boolean; Alignment: TAlignment); var DrawState: Integer; DrawRect: TRect; Bmp: TBitmap; HTheme: THandle; begin if State then DrawState := DFCS_BUTTONCHECK or DFCS_CHECKED or DFCS_FLAT else DrawState := DFCS_BUTTONCHECK or DFCS_FLAT; case Alignment of taLeftJustify: begin DrawRect.Left := R.Left + 1; DrawRect.Top := R.Top + 1; DrawRect.Right := DrawRect.Left + CHECKBOXSIZE; DrawRect.Bottom := DrawRect.Top + CHECKBOXSIZE; end; taCenter: begin DrawRect.Left := R.Left + ((R.Right - R.Left - CHECKBOXSIZE) shr 1) + 1; DrawRect.Top := R.Top + 1; DrawRect.Right := DrawRect.Left + CHECKBOXSIZE; DrawRect.Bottom := DrawRect.Top + CHECKBOXSIZE; end; taRightJustify: begin DrawRect.Left := R.Right - CHECKBOXSIZE - 1; DrawRect.Top := R.Top + 1; DrawRect.Right := DrawRect.Left + CHECKBOXSIZE; DrawRect.Bottom := DrawRect.Top + CHECKBOXSIZE; end; end; case FOwner.CompleteCheck.CheckType of ctCheckBox: begin if FIsWinXP then begin if IsThemeActive then begin HTheme := OpenThemeData(Parent.Handle, 'button'); if State then DrawThemeBackground(HTheme, ACanvas.Handle, BP_CHECKBOX, CBS_CHECKEDNORMAL, @DrawRect, nil) else DrawThemeBackground(HTheme, ACanvas.Handle, BP_CHECKBOX, CBS_UNCHECKEDNORMAL, @DrawRect, nil); CloseThemeData(HTheme); Exit; end; end; DrawFrameControl(ACanvas.Handle, DrawRect, DFC_BUTTON, DrawState); end; ctCheckMark: begin Bmp := TBitmap.Create; try if State then Bmp.LoadFromResourceName(hinstance, 'TMSTODO02') else Bmp.LoadFromResourceName(hinstance, 'TMSTODO03'); Bmp.TransparentMode := tmAuto; Bmp.Transparent := True; ACanvas.Draw(DrawRect.Left, DrawRect.Top, Bmp); bmp.FreeImage; finally Bmp.Free; end; end; ctGlyph: begin if State and not FOwner.FCompleteCheck.FCompletedGlyph.Empty then begin FOwner.FCompleteCheck.FCompletedGlyph.Transparent := true; ACanvas.Draw(DrawRect.Left, DrawRect.Top, FOwner.FCompleteCheck.FCompletedGlyph); end; if not State and not FOwner.FCompleteCheck.FUnCompletedGlyph.Empty then begin FOwner.FCompleteCheck.FUnCompletedGlyph.Transparent := true; ACanvas.Draw(DrawRect.Left, DrawRect.Top, FOwner.FCompleteCheck.FUnCompletedGlyph); end; end; end; end; procedure DrawHandle(R: TRect; Alignment: TAlignment); var Bmp: TBitmap; DrawRect: TRect; begin case Alignment of taLeftJustify: begin DrawRect.Left := R.Left + 1; DrawRect.Top := R.Top + 1; DrawRect.Right := DrawRect.Left + CHECKBOXSIZE; DrawRect.Bottom := DrawRect.Top + CHECKBOXSIZE; end; taCenter: begin DrawRect.Left := R.Left + ((R.Right - R.Left - CHECKBOXSIZE) shr 1) + 1; DrawRect.Top := R.Top + 1; DrawRect.Right := DrawRect.Left + CHECKBOXSIZE; DrawRect.Bottom := DrawRect.Top + CHECKBOXSIZE; end; taRightJustify: begin DrawRect.Left := R.Right - CHECKBOXSIZE - 1; DrawRect.Top := R.Top + 1; DrawRect.Right := DrawRect.Left + CHECKBOXSIZE; DrawRect.Bottom := DrawRect.Top + CHECKBOXSIZE; end; end; if not HandleGlyph.Empty then ACanvas.Draw(DrawRect.Left, DrawRect.Top, HandleGlyph) else begin Bmp := TBitmap.Create; try Bmp.LoadFromResourceName(hinstance, 'TMSTODO02'); Bmp.TransparentMode := tmAuto; Bmp.Transparent := True; ACanvas.Draw(DrawRect.Left, DrawRect.Top, Bmp); Bmp.FreeImage; finally Bmp.Free; end; end; end; procedure DrawCompletion(R: TRect; Completion: Integer; OldStyle: Boolean); var SrcColor: TColor; SrcRect, TgtRect: TRect; W, H: Integer; Txt: string; FS: TFontStyles; Settings: TGaugeSettings; begin inflaterect(r,-1,-1); if OldStyle then begin SrcColor := ACanvas.Brush.Color; ACanvas.Brush.Color := Color; ACanvas.Brush.Color := FProgressLook.CompleteColor; ACanvas.Pen.Color := FProgressLook.CompleteColor; ACanvas.Font.Color := FProgressLook.CompleteFontColor; FS := ACanvas.Font.Style; ACanvas.Font.Style := []; InflateRect(R, -2, -2); SrcRect := R; W := R.Right - R.Left; H := R.Bottom - R.Top; Txt := IntToStr(Completion) + '%'; SrcRect.Right := SrcRect.Left + Round(W * Completion / 100); TgtRect.Left := R.Left + ((W - ACanvas.Textwidth(Txt)) shr 1); TgtRect.Top := R.Top + ((H - ACanvas.Textheight(Txt)) shr 1); ACanvas.TextRect(SrcRect, TgtRect.Left, TgtRect.Top, Txt); ACanvas.Brush.Color := FProgressLook.UnCompleteColor; ACanvas.Pen.Color := FProgressLook.UnCompleteColor; ACanvas.Font.Color := FProgressLook.UnCompleteFontColor; SrcRect.Left := SrcRect.Right; SrcRect.Right := R.Right; ACanvas.TexTRect(SrcRect, TgtRect.Left, TgtRect.Top, Txt); ACanvas.Brush.Color := SrcColor; ACanvas.Pen.Color := SrcColor; Inflaterect(R, 1, 1); ACanvas.FrameRect(R); Inflaterect(R, 1, 1); ACanvas.FrameRect(R); ACanvas.Font.Style := FS; end else begin Settings.Level0Color := FProgressLook.Level0Color; Settings.Level0ColorTo := FProgressLook.Level0ColorTo; Settings.Level1Color := FProgressLook.Level1Color; Settings.Level1ColorTo := FProgressLook.Level1ColorTo; Settings.Level2Color := FProgressLook.Level2Color; Settings.Level2ColorTo := FProgressLook.Level2ColorTo; Settings.Level3Color := FProgressLook.Level3Color; Settings.Level3ColorTo := FProgressLook.Level3ColorTo; Settings.Level1Perc := FProgressLook.Level1Perc; Settings.Level2Perc := FProgressLook.Level2Perc; Settings.ShowBorder := FProgressLook.ShowBorder; Settings.Stacked := FProgressLook.Stacked; Settings.ShowPercentage := FProgressLook.ShowPercentage; Settings.CompletionSmooth := FProgressLook.CompletionSmooth; Settings.ShowGradient := FProgressLook.ShowGradient; Settings.Font := ACanvas.Font; Settings.Font.Color := FProgressLook.FCompleteFontColor; Settings.Orientation := goHorizontal; Settings.Steps := FProgressLook.Steps; if FProgressLook.UnCompleteColor <> clNone then Settings.BackgroundColor := FProgressLook.UnCompleteColor else Settings.BackgroundColor := ACanvas.Brush.Color; DrawGauge(ACanvas, R, Completion, Settings); end; end; begin if (Index < 0) or (Index >= TodoItems.Count) then Exit; CurDate := Date; dx := 0; if FScrollHorizontal then dx := GetScrollPos(Handle, SB_HORZ); r := Rect; (* bmp := TBitmap.Create; bmp.Width := r.Right - r.Left; if Index = TodoItems.Count - 1 then bmp.Height := Height else bmp.Height := r.Bottom - r.Top; ACanvas := bmp.Canvas; r.Left := 0; r.Top := 0; r.Right := bmp.Width; r.Bottom := bmp.Height; *) brect := r; dc := GetDC(Handle); ACanvas := TCanvas.Create; if dx = 0 then ACanvas.handle := Canvas.Handle else ACanvas.Handle := dc; ACanvas.Font.Assign(Font); if Index = TodoItems.Count - 1 then begin r.Bottom := Height; end; ACanvas.Pen.Color := Color; ACanvas.Brush.Color := Color; ACanvas.Rectangle(r.Left, r.Top, r.Right, r.Bottom); DrawGrid(ACanvas); // Rect is the rectangle covering the entire row. r.Left := r.Left - dx; IHeight := FOwner.ItemHeight; SetBkMode(ACanvas.Handle, TRANSPARENT); for Col := 1 to TodoColumns.Count do begin r.Right := r.Left + TodoColumns.Items[Col - 1].Width; if not ScrollHorizontal and (Col = TodoColumns.Count) and (r.Right < Width) and StretchLastColumn then begin r.Right := GetControlWidth; end; { At the end of this for loop there is an r.Left := r.Right } PaintGradient := false; if TodoItems.Items[Index].Complete then ACanvas.Font.Assign(FCompletionFont) else begin if TodoItems.Items[Index].Priority in [tpHighest, tpHigh] then ACanvas.Font.Assign(FPriorityFont) else ACanvas.Font.Assign(TodoColumns.Items[Col - 1].Font); end; if (odSelected in State) and FShowSelection then begin ACanvas.Brush.Color := FSelectionColor; ACanvas.Font.Color := FSelectionFontColor; if FSelectionColorTo <> clNone then PaintGradient := true; end else begin ACanvas.Brush.Color := TodoColumns.Items[Col - 1].Color; end; if ((FFocusColumn = Col - 1) and (GetFocus = Handle)) and (odSelected in State) and FOwner.Editable then begin ACanvas.Brush.Color := FActiveColumnColor; //Color; ACanvas.Font.Color := Font.Color; PaintGradient := false; end; case TodoColumns.Items[Col - 1].Alignment of taLeftJustify: Align := DT_LEFT; taCenter: Align := DT_CENTER; taRightJustify: Align := DT_RIGHT; else Align := DT_LEFT; end; ACanvas.Pen.Color := ACanvas.Brush.Color; if Col = TodoColumns.Count then begin R2 := BRect; R2.Left := r.Left; R2.Bottom := Rect.Top + FOwner.FItemHeight - 1; if PaintGradient then begin DrawGradient(ACanvas, SelectionColor, SelectionColorTo, 16, R2, false); ACanvas.Brush.Style := bsClear; end else ACanvas.Rectangle(r.Left, Rect.Top, Rect.Right, Rect.Top + FOwner.FItemHeight); end else begin R2 := r; R2.Top := BRect.Top; R2.Bottom := BRect.Top + FOwner.FItemHeight - 1; if PaintGradient then begin DrawGradient(ACanvas, SelectionColor, SelectionColorTo, 16, R2, false); ACanvas.Brush.Style := bsClear; end else ACanvas.Rectangle(r.Left, Rect.Top, r.Right, Rect.Top + FOwner.FItemHeight); end; if (TodoColumns.Items[Col - 1].TodoData <> tdCompletion) then OffsetRect(r, 1, 1); if (FGridLines <> glsNone) then OffsetRect(r, 1, 1); r.Bottom := r.Top + IHeight; if ((Int(TodoItems.Items[Index].CreationDate) = CurDate) or (Int(TodoItems.Items[Index].DueDate) = CurDate) or ((Int(TodoItems.Items[Index].CreationDate) <= CurDate) and (Int(TodoItems.Items[Index].DueDate) >= CurDate))) and (FActiveItemColor <> clNone) and (not (odSelected in State)) then begin DrawGradient(ACanvas, FActiveItemColor, FActiveItemColorTo, 16, r, false); ACanvas.Brush.Style := bsClear; end; case TodoColumns.Items[Col - 1].TodoData of tdSubject: begin su := TodoItems.Items[Index].Subject; DrawTextEx(ACanvas.Handle, Pchar(su), Length(su), r, Align or DT_END_ELLIPSIS or DT_SINGLELINE, nil); end; tdResource: begin su := TodoItems.Items[Index].Resource; DrawTextEx(ACanvas.Handle, Pchar(su), Length(su), r, Align or DT_END_ELLIPSIS or DT_SINGLELINE, nil); end; tdNotes: begin su := TodoItems.Items[Index].NotesLine; DrawTextEx(ACanvas.Handle, PChar(su), Length(su), r, Align or DT_END_ELLIPSIS or DT_SINGLELINE, nil); end; tdDueDate: begin su := FOwner.FormatDateTimeEx(FDateFormat, TodoItems.Items[Index].DueDate); DrawTextEx(ACanvas.Handle, PChar(su), Length(su), r, Align or DT_END_ELLIPSIS or DT_SINGLELINE, nil); end; tdCreationDate: begin su := FOwner.FormatDateTimeEx(FDateFormat, TodoItems.Items[Index].CreationDate); DrawTextEx(ACanvas.handle, PChar(su), Length(su), r, Align or DT_END_ELLIPSIS or DT_SINGLELINE, nil); end; tdCompletionDate: begin su := FOwner.FormatDateTimeEx(FDateFormat, TodoItems.Items[Index].CompletionDate); DrawTextEx(ACanvas.handle, PChar(su), Length(su), r, Align or DT_END_ELLIPSIS or DT_SINGLELINE, nil); end; tdTotalTime: begin su := floatToStr(TodoItems.Items[Index].TotalTime) + FTotalTimeSuffix; DrawTextEx(ACanvas.handle, PChar(su), Length(su), r, Align or DT_END_ELLIPSIS or DT_SINGLELINE, nil); end; tdStatus: begin su := FOwner.StatusToString(TodoItems.Items[Index].Status); DrawTextEx(ACanvas.Handle, PChar(su), Length(su), r, Align or DT_END_ELLIPSIS or DT_SINGLELINE, nil); end; tdProject: begin su := TodoItems.Items[Index].Project; DrawTextEx(ACanvas.Handle, Pchar(su), Length(su), r, Align or DT_END_ELLIPSIS or DT_SINGLELINE, nil); end; tdImage: begin if Assigned(FImages) and (TodoItems.Items[Index].ImageIndex >= 0) then begin FImages.Draw(ACanvas, r.Left, r.Top, TodoItems.Items[Index].ImageIndex); end; end; tdComplete: begin DrawCheck(r, TodoItems.Items[Index].Complete, TodoColumns.Items[Col - 1].Alignment); end; tdHandle: begin DrawHandle(r, TodoColumns.Items[Col - 1].Alignment); end; tdCompletion: begin if FOwner.CompletionGraphic then begin if TodoItems.Items[Index].Complete then DrawCompletion(r, 100, false) else DrawCompletion(r, TodoItems.Items[Index].Completion, false) end else begin if TodoItems.Items[Index].Complete then su := '100%' else su := IntToStr(TodoItems.Items[Index].Completion) + '%'; DrawTextEx(ACanvas.Handle, Pchar(su), Length(su), r, Align or DT_END_ELLIPSIS or DT_SINGLELINE, nil); end; end; tdPriority: begin IIndent := 0; case Align of DT_CENTER: IIndent := Max(0, r.Right - r.Left - FPriorityImageList.Width) div 2; DT_LEFT: IIndent := 0; DT_RIGHT: IIndent := Max(0, r.Right - r.Left - FPriorityImageList.Width); end; case TodoItems.Items[Index].Priority of tpLowest: FPriorityImageList.Draw(ACanvas, r.Left + IIndent, r.Top, 4, True); tpLow: FPriorityImageList.Draw(ACanvas, r.Left + IIndent, r.Top, 3, True); tpNormal: FPriorityImageList.Draw(ACanvas, r.Left + IIndent, r.Top, 2, True); tpHigh: FPriorityImageList.Draw(ACanvas, r.Left + IIndent, r.Top, 1, True); tpHighest: FPriorityImageList.Draw(ACanvas, r.Left + IIndent, r.Top, 0, True); end; R3 := r; if Align = DT_RIGHT then R3.Right := R3.Right - FPriorityImageList.Width - 2 else R3.Left := r.Left + IIndent + FPriorityImageList.Width + 2; if FShowPriorityText then DrawTextEx(ACanvas.Handle, Pchar(FOwner.PriorityToString(TodoItems.Items[Index].Priority)), Length(FOwner.PriorityToString(TodoItems.Items[Index].Priority)), r3, Align or DT_END_ELLIPSIS or DT_SINGLELINE, nil); end; tdCategory: begin su := TodoItems.Items[Index].Category; DrawTextEx(ACanvas.Handle, PChar(su), Length(su), r, Align or DT_END_ELLIPSIS or DT_SINGLELINE, nil); end; end; if (FFocusColumn = Col - 1) and (GetFocus = Handle) and (ItemIndex = Index) then begin // DrawFocusRect(Canvas.Handle,R); end; if (FGridLines <> glsNone) then OffsetRect(r, -1, -1); if (TodoColumns.Items[Col - 1].TodoData <> tdCompletion) then OffsetRect(r, -1, -1); r.Left := r.Right; end; if FPreview then begin SetBkMode(ACanvas.Handle, TRANSPARENT); ACanvas.Font.Assign(FPreviewFont); if (odSelected in State) and FShowSelection then ACanvas.Font.Color := SelectionFontColor; ACanvas.Brush.Color := Color; if (odSelected in State) and FShowSelection then ACanvas.Brush.Color := SelectionColor; if (PreviewColor <> clNone) and not ((odSelected in State) and FShowSelection) then ACanvas.Brush.Color := PreviewColor; ACanvas.Pen.Color := ACanvas.Brush.Color; su := TodoItems.Items[Index].Notes.Text; pr := Rect; pr.Top := Rect.Top + IHeight; if (PreviewColor <> clNone) and not ((odSelected in State) and FShowSelection) then DrawGradient(ACanvas, PreviewColor, PreviewColorTo, 16, pr, False) else ACanvas.Rectangle(pr.Left, pr.Top, pr.Right, pr.Bottom); SetBKMode(ACanvas.Handle,TRANSPARENT); pr.Top := pr.Top + 1; DrawTextEx(ACanvas.Handle, Pchar(su), length(su), pr, DT_TOP or DT_WORDBREAK, nil); end; PaintGradient := false; if (odSelected in State) and FShowSelection then begin ACanvas.Brush.Color := FSelectionColor; if SelectionColorTo <> clNone then PaintGradient := true; end else begin ACanvas.Brush.Color := Color; end; r.Right := Rect.Right; ACanvas.Pen.Color := ACanvas.Brush.Color; if PaintGradient then begin R2 := r; R2.Bottom := R2.Bottom - 1; DrawGradient(ACanvas, SelectionColor, SelectionColorTo, 16, R2, false); end else ACanvas.Rectangle(r.Left, r.Top, r.Right, r.Bottom); if ((Int(TodoItems.Items[Index].CreationDate) = CurDate) or (Int(TodoItems.Items[Index].DueDate) = CurDate) or ((Int(TodoItems.Items[Index].CreationDate) <= CurDate) and (Int(TodoItems.Items[Index].DueDate) >= CurDate))) and (FActiveItemColor <> clNone) and (not (odSelected in State)) then begin DrawGradient(ACanvas, FActiveItemColor, FActiveItemColorTo, 16, r, false); ACanvas.Brush.Style := bsClear; end; if (FGridLines <> glsNone) then begin ACanvas.Pen.Color := FGridLineColor; lb.lbColor := ColorToRGB(FGridLineColor); lb.lbStyle := bs_Solid; HPen := ExtCreatePen(PS_COSMETIC or PS_ALTERNATE,1,lb,0,nil); HOldPen := SelectObject(ACanvas.Handle, HPen); Windows.MoveToEx(ACanvas.Handle, Rect.Left, Rect.Bottom - 1,nil); Windows.LineTo(ACanvas.Handle, Rect.Right, Rect.Bottom - 1); r.Left := Rect.Left - dx; if not Preview then begin for Col := 1 to FTodoColumns.Count - 1 do begin r.Left := r.Left + FTodoColumns.Items[Col - 1].Width; Windows.MoveToEx(ACanvas.Handle, r.Left, Rect.Top,nil); Windows.LineTo(ACanvas.Handle, r.Left, Rect.Bottom); end; end; DeleteObject(SelectObject(ACanvas.Handle,HOldPen)); end; (* dc := GetDC(Handle); ACanvas := TCanvas.Create; if dx = 0 then ACanvas.handle := Canvas.Handle else ACanvas.Handle := dc; ACanvas.Draw(Rect.Left, Rect.Top, bmp); bmp.Free; *) ACanvas.Free; ReleaseDC(handle, dc); end; procedure TTodoListBox.CreateWnd; begin inherited CreateWnd; end; procedure TTodoListBox.SetHandleGlyph(const Value: TBitmap); begin FHandleGlyph.Assign(Value); end; procedure TTodoListBox.EditorParentOnDeactivate(Sender: TObject); begin EditorOnExit(ActiveEditor); end; constructor TTodoListBox.Create(AOwner: TComponent); var VerInfo: TOSVersioninfo; begin inherited Create(AOwner); // FOwner := AOwner as TCustomTodoList; // Yields 'invalid class typecast' when component put on a form FOwner := AOwner as TCustomTodoList; Style := lbOwnerDrawFixed; FTodoColumns := TTodoColumnCollection.Create(self); FTodoItems := TTodoItemCollection.Create(self); FUpdateCount := 0; FDateFormat := ShortDateFormat; //DoubleBuffered := True; FCompletionFont := TFont.Create; FCompletionFont.Style := FCompletionFont.Style + [fsStrikeOut]; FCompletionFont.Color := clGray; FPriorityFont := TFont.Create; FPriorityFont.Color := clRed; FPriorityFont.OnChange := ProgressLookChanged; FPreviewFont := TFont.Create; FPreviewFont.Color := clBlue; FPreviewFont.OnChange := ProgressLookChanged; FPreviewColor := clNone; FPreviewColorTo := clNone; FProgressLook := TProgressLook.Create; FProgressLook.OnChange := ProgressLookChanged; FShowSelection := True; FStretchLastColumn := True; FEditable := True; // TODO: default to false FEditSelectAll := False; // Create the components used as in-place editors ActiveEditor := nil; EditorParent := TForm.Create(self); EditorParent.Visible := False; // EditorParent.Parent := Self; EditorParent.BorderStyle := bsNone; EditorParent.OnDeactivate := EditorParentOnDeactivate; StringEditor := TInplaceEdit.Create(Self); StringEditor.Visible := False; StringEditor.BorderStyle := bsNone; FNumericOnlyEditor := TInplaceEdit.Create(Self); FNumericOnlyEditor.NumericOnly := true; FNumericOnlyEditor.Visible := false; FNumericOnlyEditor.BorderStyle := bsNone; IntegerEditor := TInplaceSpinEdit.Create(Self); IntegerEditor.Visible := False; StringListEditor := TInplaceMemo.Create(self); StringListEditor.Visible := False; StringListEditor.Ctl3D := False; FFloatEditor := TInplaceFloatSpinEdit.Create(self); FFloatEditor.Visible := False; {$IFDEF USE_PLANNERDATEPICKER} PlannerDateEditor := TPlannerDatePicker.Create(Self); PlannerDateEditor.EditorEnabled := True; PlannerDateEditor.Visible := False; {$ENDIF} DefaultDateEditor := TTodoDateTimePicker.Create(Self); DefaultDateEditor.Visible := False; if Assigned(FOwner) then DefaultDateEditor.Parent := FOwner; PriorityEditor := TInplaceODListBox.Create(Self); PriorityEditor.Visible := False; PriorityEditor.Ctl3D := False; StatusEditor := TInplaceListBox.Create(Self); StatusEditor.Visible := False; StatusEditor.Ctl3D := False; // Assign the in-place editors OnExit event StringEditor.OnExit := EditorOnExit; IntegerEditor.OnExit := EditorOnExit; StringListEditor.OnExit := EditorOnExit; FNumericOnlyEditor.OnExit := EditorOnExit; FFloatEditor.OnExit := EditorOnExit; {$IFDEF USE_PLANNERDATEPICKER} PlannerDateEditor.OnExit := EditorOnExit; {$ENDIF} DefaultDateEditor.OnExit := EditorOnExit; PriorityEditor.OnExit := EditorOnExit; PriorityEditor.OnSelected := EditorOnExit; StatusEditor.OnExit := EditorOnExit; StatusEditor.OnSelected := EditorOnExit; FPriorityImageList := TImageList.Create(Self); // FPriorityImageList.GetResource(rtBitmap,'TMSTODO01',12,[],RGB(255,255,255)); FPriorityImageList.GetInstRes(HInstance, rtBitmap, 'TMSTODO01', 12, [], RGB(255, 255, 255)); FScrollHorizontal := false; FGridLineColor := clSilver; FSelectionColor := clHighLight; FSelectionColorTo := clNone; FSelectionFontColor := clHighLightText; FActiveColumnColor := clWhite; FUseTab := false; FShowPriorityText := true; FActiveItemColor := clNone; FActiveItemColorTo := clNone; FHandleGlyph := TBitmap.Create; GridLines := glsAlways; VerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); GetVersionEx(verinfo); FIsWinXP := (verinfo.dwMajorVersion > 5) or ((verinfo.dwMajorVersion = 5) and (verinfo.dwMinorVersion >= 1)); FTotalTimeSuffix := 'h'; end; destructor TTodoListBox.Destroy; begin FCompletionFont.Free; FPreviewFont.Free; FPriorityFont.Free; FTodoColumns.Free; FTodoItems.Free; FProgressLook.Free; FPriorityImageList.Free; FNumericOnlyEditor.Free; FHandleGlyph.Free; inherited Destroy; end; procedure TTodoListBox.MeasureItem(Index: Integer; var Height: Integer); var Res: Integer; Canvas: TCanvas; begin Height := 40; if (Index >= 0) then begin Canvas := TCanvas.Create; Canvas.Handle := GetDC(Handle); Res := Canvas.TextHeight('gh') + 4; {some overlap on fonts} ReleaseDC(Handle, Canvas.Handle); Canvas.Free; SendMessage(Handle, CB_SETITEMHEIGHT, Index, Res); end else Res := 20; Height := Res; end; procedure TTodoListBox.WndProc(var Message: TMessage); begin inherited; if (Message.msg = LB_DELETESTRING) or (Message.msg = LB_RESETCONTENT) then begin if FScrollHorizontal and (FUpdateCount = 0) then UpdateHScrollExtent(0); end; end; { procedure TTodoListBox.WMSize(var Msg: TWMSize); begin if FScrollHorizontal then UpdateHScrollExtent(0); end; } procedure TTodoListBox.UpdateHScrollExtent(maxextent: Integer); var max, w: Integer; r: TRect; begin if (FUpdateCount > 0) or (FTodoColumns.Count <= 0) then Exit; if {(Items.Count <= 0) or }(FScrollHorizontal = False) then begin SendMessage(Handle, LB_SETHORIZONTALEXTENT, 0, 0); SendMessage(Handle, WM_HSCROLL, SB_TOP, 0); Exit; end; if MaxExtent > 0 then Max := MaxExtent else Max := MaxHorizontalExtent; SendMessage(self.Handle, LB_GETITEMRECT, 0, Longint(@r)); w := r.Right - r.Left; inc(FUpdateCount); if Max > w then begin SendMessage(Handle, LB_SETHORIZONTALEXTENT, Max, 0); end else begin SendMessage(Handle, LB_SETHORIZONTALEXTENT, 0, 0); SendMessage(Handle, WM_HSCROLL, SB_TOP, 0); ShowScrollBar(Handle, SB_HORZ, False); end; dec(FUpdateCount); end; procedure TTodoListBox.SetImages(const Value: TImageList); begin FImages := Value; Invalidate; end; function TTodoListBox.GetItemIndexEx: Integer; begin Result := SendMessage(Self.Handle, LB_GETCURSEL, 0, 0); end; procedure TTodoListBox.SetItemIndexEx(const Value: Integer); var OldIndex: integer; begin OldIndex := FItemIndex; FItemIndex := Value; if MultiSelect then begin SendMessage(Handle, LB_SELITEMRANGE, Value, MakeLParam(Value, Value)); end; if FItemIndex <> OldIndex then SendMessage(Handle, LB_SETCURSEL, value, 0) else RepaintItem(Value); end; procedure TTodoListBox.Notification(AComponent: TComponent; AOperation: TOperation); begin if (AOperation = opRemove) and (AComponent = FImages) then FImages := nil; inherited; end; procedure TTodoListBox.SynchColumns; begin if Assigned(FColumnsChanged) then FColumnsChanged(self); end; procedure TTodoListBox.SetProgressLook(const Value: TProgressLook); begin FProgressLook.Assign(Value); end; procedure TTodoListBox.ProgressLookChanged(Sender: TObject); begin Invalidate; end; procedure TTodoListBox.SetGridLines(const Value: TGridLineStyle); begin FGridLines := Value; Invalidate; end; procedure TTodoListBox.SetGridLineColor(const Value: TColor); begin FGridLineColor := Value; Invalidate; end; procedure TTodoListBox.SynchItems; var OldIdx: Integer; begin OldIdx := ItemIndex; if (csLoading in ComponentState) then Exit; if FUpdateCount > 0 then Exit; //synchronize nr. of listboxitems with collection while (Items.Count > FTodoItems.Count) do Items.Delete(Items.Count - 1); while (Items.Count < FTodoItems.Count) do Items.Add(''); if (ItemIndex = -1) and (Items.Count > 0) and (OldIdx <> -1) then begin if OldIdx < Items.Count then ItemIndex := OldIdx else ItemIndex := Items.Count - 1; end; end; procedure TTodoListBox.Loaded; begin inherited; SynchItems; ItemIndex := FItemIndex; end; procedure TTodoListBox.BeginUpdate; begin inc(FUpdateCount); end; procedure TTodoListBox.EndUpdate; begin if FUpdateCount > 0 then begin Dec(FUpdateCount); if FUpdateCount = 0 then SynchItems; end; end; procedure TTodoListBox.SetDateFormat(const Value: string); begin FDateFormat := Value; Invalidate; end; { function TTodoListBox.GetTodoItems(i, j: Integer): String; begin if (i >= Items.Count) then raise Exception.Create('Item index out of range'); // for k := 1 to j do // if fTodos.Items[k-1].TodoData<>ctText then dec(j); Result := GetTodo(succ(j), Items[i]); end; procedure TTodoListBox.SetTodoItems(i, j: Integer; const Value: String); var s,n,l: String; k: Integer; begin if (i >= Items.Count) then raise Exception.Create('Item index out of range'); // for k := 1 to j do // if fTodos.Items[k-1].TodoType<>ctText then dec(j); inc(j); s := self.Items[i]; k := 0; n := ''; repeat if n <> '' then n := n + '|'; l := GetTodoString(s); if (k <> j) then n := n + l else n := n + Value; inc(k); until (k > j); if (s <> '') then begin n := n + '|' + s; end; Items[i] := n; end; } function TTodoListBox.GetSortedEx: Boolean; begin Result := FSortedEx; end; procedure TTodoListBox.SetShowSelection(const Value: Boolean); begin if FShowSelection <> Value then begin FShowSelection := Value; Invalidate; end; end; procedure TTodoListBox.SetSortedEx(const Value: Boolean); begin FSortedEx := Value; end; procedure TTodoListBox.DoEnter; begin inherited; FLookup := ''; end; procedure TTodoListBox.KeyPress(var Key: Char); var Msg: TMessage; begin {$IFNDEF DELPHI_UNICODE} if (Key in ['A'..'z', '0'..'9']) and FOwner.Editable then {$ENDIF} {$IFDEF DELPHI_UNICODE} {$IFDEF DELPHIXE4_LVL} if Key.IsLetterOrDigit and FOwner.Editable then {$ENDIF} {$IFNDEF DELPHIXE4_LVL} if character.IsLetterOrDigit(Key) and FOwner.Editable then {$ENDIF} {$ENDIF} begin if (FFocusColumn >= 0) and (FOwner.Columns[FFocusColumn].TodoData = tdComplete) then begin inherited; Exit; end; StartEdit(ItemIndex, FFocusColumn, False, Msg, 0, 0, Key); end; inherited; end; procedure TTodoListBox.KeyDown(var Key: Word; Shift: TShiftState); var i: Integer; s: string; Msg: TMessage; ATodoItem: TTodoItem; DelItemCount: integer; function Max(a, b: Integer): Integer; begin if (a > b) then Result := a else Result := b; end; begin if key in [VK_LEFT, VK_RIGHT] then begin if Key = VK_LEFT then if FFocusColumn > 0 then begin FFocusColumn := FFocusColumn - 1; FOwner.FTodoHeader.ActiveColumn := FFocusColumn; ItemIndex := ItemIndex; end; if Key = VK_RIGHT then if FFocusColumn < FOwner.Columns.Count - 1 then begin FFocusColumn := FFocusColumn + 1; FOwner.FTodoHeader.ActiveColumn := FFocusColumn; ItemIndex := ItemIndex; end; Key := 0; end; inherited; if Key = VK_TAB then begin if Shift = [ssShift] then begin if FFocusColumn > 0 then begin FFocusColumn := FFocusColumn - 1; FOwner.FTodoHeader.ActiveColumn := FFocusColumn; ItemIndex := ItemIndex; end; end else begin if FFocusColumn < FOwner.Columns.Count - 1 then begin FFocusColumn := FFocusColumn + 1; FOwner.FTodoHeader.ActiveColumn := FFocusColumn; ItemIndex := ItemIndex; end; end; //StartEdit(ItemIndex,FFocusColumn,False,Msg,0,0,#0); end; if (Key = VK_F2) or (Key = VK_SPACE) then begin StartEdit(ItemIndex, FFocusColumn, False, Msg, 0, 0, #0); end; if (Key = VK_INSERT) and FOwner.AutoInsertItem then begin ATodoItem := FOwner.Items.Add; ATodoItem.CreationDate := Now; ATodoItem.DueDate := Now + 1; ATodoItem.CompletionDate := ATodoItem.DueDate; if FOwner.AllowAutoInsert(ATodoItem) then begin ATodoItem.Select; for i := 1 to FOwner.Columns.Count do if FOwner.Columns[i - 1].TodoData = tdSubject then begin FFocusColumn := i - 1; FOwner.FTodoHeader.ActiveColumn := FFocusColumn; end; StartEdit(ItemIndex, FFocusColumn, False, Msg, 0, 0, #0); end else begin ATodoItem.Free; end; end; if (Key = VK_DELETE) and FOwner.AutoDeleteItem then begin if not MultiSelect then begin ATodoItem := FOwner.Items[ItemIndex]; if FOwner.AllowAutoDelete(ATodoItem) then FOwner.Items[ItemIndex].Free; end else begin i := 0; DelItemCount := 0; while ((i < Items.Count) and (DelItemCount < SelCount)) do begin if selected[i] then begin ATodoItem := FOwner.Items[i]; if FOwner.AllowAutoDelete(ATodoItem) then FOwner.Items[i].Free; inc(DelItemCount); end else inc(i); end; end; end; if key in [VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT, VK_NEXT, VK_PRIOR, VK_HOME, VK_END, VK_ESCAPE] then begin FLookup := ''; Exit; end; if (ssCtrl in Shift) then begin if key = 67 {C} then begin TodoItems.CopyToClipboard; end; if key = 86 {V} then begin TodoItems.PasteFromClipboard; end; if Key = 88 {X} then begin TodoItems.CutToClipboard; end; end; if (key = VK_BACK) and (Length(FLookup) > 0) then Delete(FLookup, Length(FLookup), 1) else if not FLookupIncr then fLookup := chr(key) else if (key > 31) and (key <= 255) then FLookup := FLookup + chr(key); if (ItemIndex >= 0) or (FLookupIncr) then begin for i := Max(1, ItemIndex + 1) to Items.Count do begin // s := TodoItems[i-1,fLookupTodo]; if (s <> '') then if (pos(UpperCase(FLookup), uppercase(s)) = 1) then begin ItemIndex := i - 1; // Invalidate; Exit; end; end; end; for i := 1 to Items.Count do begin //s := TodoItems[i-1,fLookupTodo]; if (s <> '') then if (pos(uppercase(fLookup), uppercase(s)) = 1) then begin ItemIndex := i - 1; Exit; end; end; if FLookupIncr then begin fLookup := chr(key); for i := 1 to Items.Count do begin //s := TodoItems[i-1,fLookupTodo]; if (s <> '') then if (pos(uppercase(fLookup), uppercase(s)) = 1) then begin ItemIndex := i - 1; Exit; end; end; end; end; procedure TTodoListBox.SetPreview(const Value: Boolean); begin FPreview := Value; Invalidate; end; procedure TTodoListBox.SetCompletionFont(const Value: TFont); begin FCompletionFont.Assign(Value); Invalidate; end; procedure TTodoListBox.SetPreviewFont(const Value: TFont); begin FPreviewFont.Assign(Value); Invalidate; end; procedure TTodoListBox.SetPriorityFont(const Value: TFont); begin FPriorityFont.Assign(Value); Invalidate; end; procedure TTodoListBox.SetSelectionColor(const Value: TColor); begin FSelectionColor := Value; Invalidate; end; procedure TTodoListBox.SetSelectionColorTo(const Value: TColor); begin FSelectionColorTo := Value; Invalidate; end; procedure TTodoListBox.SetSelectionFontColor(const Value: TColor); begin FSelectionFontColor := Value; Invalidate; end; procedure TTodoListBox.SetActiveColumnColor(const Value: TColor); begin FActiveColumnColor := Value; Invalidate; end; procedure TTodoListBox.SetActiveItemColor(const Value: TColor); begin FActiveItemColor := Value; Invalidate; end; procedure TTodoListBox.SetActiveItemColorTo(const Value: TColor); begin FActiveItemColorTo := Value; Invalidate; end; procedure TTodoListBox.SetShowPriorityText(const Value: Boolean); begin FShowPriorityText := Value; Invalidate; end; procedure TTodoListBox.SetScrollHorizontal(const Value: Boolean); begin if FScrollHorizontal <> Value then begin FScrollHorizontal := Value; UpdateHScrollExtent(0); end; end; procedure TTodoListBox.SetStretchLastColumn(const Value: Boolean); begin FStretchLastColumn := Value; Invalidate; end; function TTodoListBox.GetControlWidth: Integer; begin Result := Width; if (Items.Count * ItemHeight > Height) then Result := Result - GetSystemMetrics(SM_CXHSCROLL); end; function TTodoListBox.MaxHorizontalExtent: integer; var i: integer; begin Result := 0; if FTodoColumns.Count <= 0 then exit; for i := 0 to TodoColumns.Count - 1 do begin Result := Result + TodoColumns.Items[i].Width; end; end; procedure TTodoListBox.InputFromCSV(FileName: string; insertmode: Boolean); var buffer, celltext: string; s: Integer; f: TextFile; delimiterpos, quotepos: Integer; lr: TStringList; ColCount, dif: integer; begin ColCount := 15; TodoItems.Clear; dif := 1; AssignFile(f, FileName); {$I-} Reset(f); {$I+} if (IOResult <> 0) then raise Exception.Create('Cannot open file ' + FileName); lr := TStringList.Create; // do intelligent estimate of the separator Reset(f); while not Eof(f) do begin ReadLn(f, buffer); lr.CommaText := Buffer; s := 1; //StrtCol; while VarCharPos(#0 {FDelimiter}, Buffer, DelimiterPos) > 0 do begin if Buffer[1] = '"' then begin Delete(buffer, 1, 1); //delete first quote from buffer if SinglePos('"', Buffer, QuotePos) > 0 then //search for next single quote begin CellText := Copy(buffer, 1, QuotePos - 1); CellText := DoubleToSingleChar('"', CellText); Delete(buffer, 1, QuotePos); end else CellText := ''; VarCharPos(#0 {FDelimiter}, buffer, DelimiterPos); end else begin CellText := Copy(buffer, 1, DelimiterPos - 1); CellText := DoubleToSingleChar('"', CellText); end; { if JavaCSV then JavaToLineFeeds(CellText) else } CSVToLineFeeds(CellText); Delete(buffer, 1, DelimiterPos); Inc(s); if s >= ColCount then ColCount := s; end; if Length(Buffer) > 0 then begin if Buffer[1] = '"' then Delete(buffer, 1, 1); if Length(Buffer) > 0 then begin if Buffer[Length(Buffer)] = '"' then Delete(Buffer, Length(Buffer), 1); end; CellText := DoubleToSingleChar('"', Buffer); { if JavaCSV then JavaToLineFeeds(CellText) else } CSVToLineFeeds(CellText); Inc(s); if s > ColCount then ColCount := s; end; with FTodoItems.Add do begin Subject := lr[0]; Resource := lr[1]; Notes.text := lr[2]; //WriteToCSV(CellText); Status := FOwner.StringToStatus(lr[2 + dif]); Project := lr[3 + dif]; Category := lr[4 + dif]; Complete := Lr[5 + dif] = 'True'; Completion := StrtoInt(lr[6 + dif]); CompletionDate := StrToDate(lr[7 + dif]); CreationDate := StrToDate(lr[8 + dif]); DueDate := StrToDate(lr[9 + dif]); TotalTime := StrToFloat(lr[10 + dif]); Tag := Strtoint(lr[11 + dif]); ImageIndex := StrToInt(lr[12 + dif]); Priority := FOwner.StringToPriority(lr[13 + dif]); end; end; CloseFile(f); lr.Free; UpdateHScrollExtent(0) end; procedure TTodoListBox.OutputToCSV(FileName: string; appendmode: Boolean); var f: TextFile; s: Integer; CellText: string; Delim: Char; dblquotes: Boolean; procedure WriteToCSV(S: string); begin S := CSVQuotes(S); { if FOemConvert then StringToOem(CellText); } dblquotes := false; if ({(FAlwaysQuotes) or }((Pos(Delim, S) = 0) and (Pos('"', S) > 0))) then begin S := '"' + S + '"'; dblquotes := true; end; if S = '' then begin { if JavaCSV then CellText := '^' else if QuoteEmptyCells then CellText := '""'; } end; if (Pos(Delim, S) > 0) or (LinesInText(CellText, true) > 1) then begin { if JavaCSV then LinefeedstoJava(CellText) else } begin // if not dblquotes then LinefeedsToCSV(S) // else // LinefeedsToCSVNQ(CellText); end; end; Write(f, S); write(f, Delim); end; begin if true {FDelimiter = #0} then Delim := ',' { else Delim := FDelimiter}; AssignFile(f, FileName); if AppendMode then begin {$I-} Reset(f); {$I+} if IOResult <> 0 then begin {$I-} Rewrite(f); {$I+} if IOResult <> 0 then raise Exception.Create('Cannot Create file ' + FileName); end else Append(f); end else begin {$I-} Rewrite(f); {$I+} if IOResult <> 0 then raise Exception.Create('Cannot Create file ' + FileName); end; for s := 0 {SaveStartCol} to TodoItems.Count - 1 {SaveEndCol + n} do begin CellText := TodoItems.Items[s].Notes.Text; WriteToCSV(TodoItems.Items[s].Subject); WriteToCSV(TodoItems.Items[s].Resource); WriteToCSV(CellText); WriteToCSV(FOwner.StatusToString(TodoItems.Items[s].Status)); WriteToCSV(TodoItems.Items[s].Project); WriteToCSV(TodoItems.Items[s].Category); if TodoItems.Items[s].Complete then WriteToCSV('True') else WriteToCSV('False'); WriteToCSV(Inttostr(TodoItems.Items[s].Completion)); WriteToCSV(DateToStr(TodoItems.Items[s].CompletionDate)); WriteToCSV(DateToStr(TodoItems.Items[s].CreationDate)); WriteToCSV(DateToStr(TodoItems.Items[s].DueDate)); WriteToCSV(FloatToStr(TodoItems.Items[s].TotalTime)); WriteToCSV(inttostr(TodoItems.Items[s].Tag)); WriteToCSV(Inttostr(TodoItems.Items[s].ImageIndex)); WriteToCSV(FOwner.PriorityToString(TodoItems.Items[s].Priority)); Writeln(f); end; CloseFile(f); end; { TTodoColumnItem } procedure TTodoColumnItem.Assign(Source: TPersistent); begin if Source is TTodoColumnItem then begin Alignment := TTodoColumnItem(Source).Alignment; Caption := TTodoColumnItem(Source).Caption; Color := TTodoColumnItem(Source).Color; Editable := TTodoColumnItem(Source).Editable; Font.Assign(TTodoColumnItem(Source).Font); TodoData := TTodoColumnItem(Source).TodoData; Width := TTodoColumnItem(Source).Width; end; end; constructor TTodoColumnItem.Create(Collection: TCollection); var AOwner: TTodoListBox; begin inherited; FFont := TFont.Create; FWidth := 100; FColor := clWindow; FEditable := True; FImageIndex := -1; AOwner := TTodoColumnCollection(Collection).FOwner; FFont.Assign(AOwner.Font); if AOwner.HandleAllocated then begin AOwner.SynchColumns; AOwner.SetHorizontalScrollBar; end; end; destructor TTodoColumnItem.Destroy; var AOwner: TTodoListBox; begin AOwner := TTodoColumnCollection(Collection).FOwner; if AOwner.HandleAllocated then begin AOwner.SynchColumns; AOwner.SetHorizontalScrollBar; end; FFont.Free; inherited; end; function TTodoColumnItem.GetDisplayName: string; begin if Caption <> '' then Result := Caption else Result := 'Column ' + IntToStr(Index); case TodoData of tdSubject: Result := Result + ' (Subject)'; tdCompletion: Result := Result + ' (Completion)'; tdNotes: Result := Result + ' (Notes)'; tdPriority: Result := Result + ' (Priority)'; tdDueDate: Result := Result + ' (Due Date)'; tdStatus: Result := Result + ' (Status)'; tdImage: Result := Result + ' (Image)'; tdComplete: Result := Result + ' (Complete)'; tdTotalTime: Result := Result + ' (Total time)'; tdCompletionDate: Result := Result + ' (Completion date)'; tdCreationDate: Result := Result + ' (Creation date)'; tdResource: Result := Result + ' (Resource)'; tdHandle: Result := Result + ' (Handle)'; tdProject: Result := Result + ' (Project)'; tdCategory: Result := Result + ' (Category)'; end; end; procedure TTodoColumnItem.SetAlignment(const value: tAlignment); begin FAlignment := Value; Changed; end; procedure TTodoColumnItem.SetColor(const value: TColor); begin FColor := Value; Changed; end; procedure TTodoColumnItem.SetTodoData(const Value: TTodoData); begin FTodoData := Value; if FTodoData = tdHandle then FEditable := False; Changed; end; procedure TTodoColumnItem.SetFont(const Value: TFont); begin FFont.Assign(Value); Changed; end; procedure TTodoColumnItem.SetWidth(const Value: Integer); var AOwner: TTodoListBox; begin FWidth := Value; Changed; AOwner := TTodoColumnCollection(Collection).FOwner; if AOwner.HandleAllocated then begin AOwner.SynchColumns; AOwner.SetHorizontalScrollBar; end; end; procedure TTodoColumnItem.SetCaption(const Value: string); var AOwner: TTodoListBox; begin FCaption := Value; Changed; AOwner := TTodoColumnCollection(Collection).FOwner; if AOwner.HandleAllocated then AOwner.SynchColumns; end; procedure TTodoColumnItem.Changed; begin if Assigned(FOnChange) then FOnChange(Self); TTodoColumnCollection(Collection).Changed; end; procedure TTodoColumnItem.LoadFromStream(S: TStream); var Count, i, ID, Size: Integer; begin Count := ReadInteger(S); for i := 1 to Count do begin ID := ReadByte(S); Size := ReadWord(S); case ID of 1: Width := ReadInteger(S); 2: Caption := ReadString(S, Size); 3: TodoData := TTodoData(ReadByte(S)); end end; end; procedure TTodoColumnItem.SaveToStream(S: TStream); begin // the number of properties i'm saving WriteInteger(S, 3); SaveProperty(S, 1, @FWidth, 4); SaveProperty(S, 2, @FCaption[1], Length(FCaption) * STRSIZE); SaveProperty(S, 3, @FTodoData, 1); end; procedure TTodoColumnItem.SetImageIndex(const Value: Integer); begin FImageIndex := Value; Changed; end; { TTodoColumnCollection } function TTodoColumnCollection.Add: TTodoColumnItem; begin Result := TTodoColumnItem(inherited Add); end; constructor TTodoColumnCollection.Create(AOwner: TTodoListBox); begin inherited Create(TTodoColumnItem); FOwner := AOwner; end; function TTodoColumnCollection.GetItem(Index: Integer): TTodoColumnItem; begin Result := TTodoColumnItem(inherited Items[index]); end; function TTodoColumnCollection.GetOwner: tPersistent; begin Result := FOwner; end; function TTodoColumnCollection.Insert(Index: Integer): TTodoColumnItem; begin Result := TTodoColumnItem(inherited Insert(index)); end; procedure TTodoColumnCollection.SetItem(Index: Integer; const Value: TTodoColumnItem); begin inherited SetItem(Index, Value); end; procedure TTodoColumnCollection.Swap(Item1, Item2: TTodoColumnItem); var ti: TTodoColumnItem; begin ti := TTodoColumnItem.Create(Self); ti.Assign(Item1); Item1.Assign(Item2); Item2.Assign(ti); ti.Free; end; procedure TTodoColumnCollection.Update(Item: TCollectionItem); begin inherited; if FOwner.HandleAllocated then begin FOwner.Invalidate; FOwner.SynchColumns; end; end; { TTodoItemCollection } function TTodoItemCollection.Add: TTodoItem; begin Result := TTodoItem(inherited Add); end; constructor TTodoItemCollection.Create(aOwner: TTodoListBox); begin inherited Create(TTodoItem); FOwner := AOwner; end; function TTodoItemCollection.GetItem(Index: Integer): TTodoItem; begin Result := TTodoItem(inherited Items[index]); end; function TTodoItemCollection.GetOwner: tPersistent; begin Result := FOwner; end; function TTodoItemCollection.Insert(index: Integer): TTodoItem; begin Result := TTodoItem(inherited Insert(index)); end; function TTodoItemCollection.IndexInTodoOf(col: Integer; s: string): Integer; var i: Integer; begin Result := -1; for i := 1 to Count do begin if Items[i - 1].Notes.Count > col then if Items[i - 1].Notes[col] = s then begin Result := i - 1; Break; end; end; end; function TTodoItemCollection.IndexInRowOf(row: Integer; s: string): Integer; var i: Integer; begin Result := -1; if (Count > Row) then for i := 1 to Items[row].Notes.Count do begin if Items[row].Notes[i - 1] = s then begin Result := i - 1; Break; end; end; end; function TTodoItemCollection.IndexOf(s: string): tpoint; var i, j: Integer; begin Result := Point(-1, -1); for i := 1 to Count do begin for j := 1 to Items[i - 1].Notes.Count do if Items[i - 1].Notes[j - 1] = s then begin Result.y := i - 1; Result.x := j - 1; Break; end; end; end; procedure TTodoItemCollection.SetItem(Index: Integer; const Value: TTodoItem); begin inherited SetItem(Index, Value); end; procedure TTodoItemCollection.Update(Item: TCollectionItem); begin inherited; end; procedure TTodoItemCollection.Changed; begin FOwner.Invalidate; end; procedure TTodoItemCollection.ItemChanged(Index: Integer); begin if (Index >= 0) and (Index < FOwner.Items.Count) then begin FOwner.RepaintItem(Index) end; end; function TTodoItemCollection.GetItemClass: TCollectionItemClass; begin Result := TTodoItem; end; procedure TTodoItemCollection.CopyToClipboard; var Clipboard: TClipboard; TodoItemIO: TTodoItemIO; MemStream: TMemoryStream; Data: THandle; DataPtr: Pointer; Selected: TTodoItem; begin if FOwner.ItemIndex < 0 then exit; Clipboard := TClipboard.Create; Selected := Items[FOwner.ItemIndex]; if Assigned(Selected) then begin { Selected.ItemBegin := Selected.ItemBegin; Selected.ItemEnd := Selected.ItemEnd; Selected.DBTag := MakeLong(Selected.ItemBeginPrecis, Selected.ItemEndPrecis); } TodoItemIO := TTodoItemIO.CreateItem(Self); TodoItemIO.Item.Assign(Selected); MemStream := TMemoryStream.Create; try MemStream.WriteComponent(TodoItemIO); Clipboard.Open; try Data := GlobalAlloc(GMEM_MOVEABLE + GMEM_DDESHARE, MemStream.Size); try DataPtr := GlobalLock(Data); try Move(MemStream.Memory^, DataPtr^, MemStream.Size); Clipboard.Clear; SetClipboardData(CF_TODOITEM, Data); finally GlobalUnlock(Data); end; except GlobalFree(Data); raise; end; finally Clipboard.Close; end; finally MemStream.Free; end; TodoItemIO.Free; end; Clipboard.Free; end; procedure TTodoItemCollection.CutToClipboard; begin CopyToClipboard; if (FOwner.ItemIndex >= 0) then FOwner.TodoItems.Delete(FOwner.ItemIndex); // FOwner.FreeItem(Selected); end; procedure TTodoItemCollection.PasteFromClipboard; begin PasteItem(False); end; procedure TTodoItemCollection.PasteItem(Position: Boolean); var Clipboard: TClipboard; TodoItemIO: TTodoItemIO; MemStream: TMemoryStream; Data: THandle; DataPtr: Pointer; begin Clipboard := TClipboard.Create; Clipboard.Open; Data := 0; try Data := GetClipboardData(CF_TODOITEM); if Data = 0 then Exit; DataPtr := GlobalLock(Data); if DataPtr = nil then Exit; try MemStream := TMemoryStream.Create; MemStream.WriteBuffer(DataPtr^, GlobalSize(Data)); MemStream.Position := 0; TodoItemIO := TTodoItemIO.CreateItem(Self); try MemStream.ReadComponent(TodoItemIO); with TodoItemIO.Item do { if Position then begin ItemBegin := FOwner.SelItemBegin; ItemEnd := FOwner.SelItemEnd; ItemPos := FOwner.SelPosition; end else begin ItemBeginPrecis := LoWord(DBTag); ItemEndPrecis := HiWord(DBTag); end; } FOwner.TodoItems.Add.Assign(TodoItemIO.Item); // .CreateItem.Assign(TodoItemIO.Item); finally TodoItemIO.Free; MemStream.Free; end; finally end; finally GlobalUnlock(Data); end; Clipboard.Close; Clipboard.Free; end; { TTodoItem } procedure TTodoItem.Assign(Source: TPersistent); begin if Source is TTodoItem then begin ImageIndex := TTodoItem(Source).ImageIndex; Notes.Assign(TTodoItem(Source).Notes); TTodoItemCollection(collection).FOwner.SynchItems; Subject := TTodoItem(Source).Subject; Category := TTodoItem(Source).Category; Complete := TTodoItem(Source).Complete; Completion := TTodoItem(Source).Completion; CompletionDate := TTodoItem(Source).CompletionDate; CreationDate := TTodoItem(Source).CreationDate; DueDate := TTodoItem(Source).DueDate; Priority := TTodoItem(Source).Priority; Project := TTodoItem(Source).Project; Resource := TTodoItem(Source).Resource; Status := TTodoItem(Source).Status; Tag := TTodoItem(Source).Tag; TotalTime := TTodoItem(Source).TotalTime; end; end; constructor TTodoItem.Create(Collection: TCollection); var AOwner: TTodoListBox; begin inherited; FNotes := TStringList.Create; FImageIndex := -1; FNotes.OnChange := StringsChanged; AOwner := TTodoItemCollection(Collection).FOwner; if AOwner.HandleAllocated then AOwner.SynchItems; end; destructor TTodoItem.Destroy; var AOwner: TTodoListBox; begin AOwner := TTodoItemCollection(Collection).FOwner; FNotes.Free; inherited; if AOwner.HandleAllocated then AOwner.SynchItems; end; function TTodoItem.GetDisplayName: string; begin if Subject <> '' then Result := Subject else Result := 'Item' + IntToStr(Index); end; procedure TTodoItem.Changed; begin { if Assigned(FOnChange) then FOnChange(Self); } TTodoItemCollection(Collection).ItemChanged(Index); end; procedure TTodoItem.SetCompletion(const Value: TCompletion); begin if FCompletion <> Value then begin FCompletion := Value; Changed; end; end; procedure TTodoItem.SetDueDate(const Value: TDateTime); begin if FDueDate <> Value then begin FDueDate := Value; Changed; end; end; procedure TTodoItem.SetImageIndex(const Value: Integer); begin if FImageIndex <> Value then begin FImageIndex := value; Changed; end; end; procedure TTodoItem.SetNotes(const Value: TStringList); begin FNotes.Assign(Value); Changed; end; procedure TTodoItem.SetPriority(const Value: TTodoPriority); begin if FPriority <> Value then begin FPriority := Value; Changed; end; end; procedure TTodoItem.SetStatus(const Value: TTodoStatus); begin if FStatus <> Value then begin FStatus := Value; Changed; end; end; procedure TTodoItem.SetSubject(const Value: string); begin if FSubject <> Value then begin FSubject := Value; Changed; end; end; procedure TTodoItem.SetTotalTime(const Value: double); begin if FTotalTime <> Value then begin FTotalTime := Value; Changed; end; end; procedure TTodoItem.StringsChanged(sender: TObject); var Idx: Integer; begin Idx := TTodoItemCollection(Collection).FOwner.ItemIndex; TTodoItemCollection(Collection).FOwner.SynchItems; TTodoItemCollection(Collection).FOwner.ItemIndex := Idx; end; procedure TTodoItem.SetComplete(const Value: Boolean); begin if FComplete <> Value then begin FComplete := Value; Changed; end; end; procedure TTodoItem.SetCompletionDate(const Value: TDateTime); begin if FCompletionDate <> Value then begin FCompletionDate := Value; Changed; end; end; procedure TTodoItem.SetCreationDate(const Value: TDateTime); begin if FCreationDate <> Value then begin FCreationDate := Value; Changed; end; end; procedure TTodoItem.SetResource(const Value: string); begin if FResource <> Value then begin FResource := Value; Changed; end; end; procedure TTodoItem.Select; begin with (Collection as TTodoItemCollection).FOwner as TTodoListBox do begin ItemIndex := Self.Index; if MultiSelect then Selected[self.Index] := true; end; end; procedure TTodoItem.UnSelect; begin with (Collection as TTodoItemCollection).FOwner as TTodoListBox do begin if MultiSelect then Selected[self.Index] := false else ItemIndex := -1; end; end; function TTodoItem.GetNotesLine: string; begin if Notes.Count > 0 then Result := Notes.Strings[0] else Result := ''; end; procedure TTodoItem.SaveToStream(S: TStream); var STemp: string; begin // the number of properties i'm saving WriteInteger(S, 15); //14 // save the properties STemp := Notes.Text; SaveProperty(S, 1, @FComplete, 1); SaveProperty(S, 2, @FCompletion, 1); SaveProperty(S, 3, @FCompletionDate, 8); SaveProperty(S, 4, @FCreationDate, 8); SaveProperty(S, 5, @FDueDate, 8); SaveProperty(S, 6, @FImageIndex, 4); SaveProperty(S, 7, @STemp[1], Length(STemp) * STRSIZE); SaveProperty(S, 8, @FPriority, 1); SaveProperty(S, 9, @FResource[1], Length(FResource) * STRSIZE); SaveProperty(S, 10, @FStatus, 1); SaveProperty(S, 11, @FSubject[1], Length(FSubject) * STRSIZE); SaveProperty(S, 12, @FTag, 4); SaveProperty(S, 13, @FTotalTime, 8); SaveProperty(S, 14, @FProject[1], Length(FProject) * STRSIZE); SaveProperty(S, 15, @FCategory[1], Length(FCategory) * STRSIZE); end; procedure TTodoItem.LoadFromStream(S: TStream); var Count, i, ID, Size: Integer; begin Count := ReadInteger(S); for i := 1 to Count do begin ID := ReadByte(S); Size := ReadWord(S); case ID of 1: Complete := ReadBoolean(S); 2: Completion := ReadByte(S); 3: CompletionDate := ReadDateTime(S); 4: CreationDate := ReadDateTime(S); 5: DueDate := ReadDateTime(S); 6: ImageIndex := ReadInteger(S); 7: Notes.Text := ReadString(S, Size); 8: Priority := TTodoPriority(ReadByte(S)); 9: Resource := ReadString(S, Size); 10: Status := TTodoStatus(ReadByte(S)); 11: Subject := ReadString(S, Size); 12: Tag := ReadInteger(S); 13: TotalTime := ReadDouble(S); 14: Project := ReadString(S, Size); 15: Category := ReadString(S, Size); else S.Seek(Size, soFromCurrent); end end; end; procedure TTodoItem.SetProject(const Value: string); begin if FProject <> Value then begin FProject := Value; Changed; end; end; procedure TTodoItem.SetCategory(const Value: string); begin if FCategory <> Value then begin FCategory := Value; Changed; end; end; { TTodoHeader } constructor TTodoHeader.Create(AOwner: TComponent); begin inherited Create(AOwner); FOwner := AOwner as TCustomTodoList; FColor := clBtnFace; FColorTo := clWhite; FActiveColor := clNone; FActiveColorTo := clNone; FLeftPos := 0; FTextHeight := 16; FItemHeight := 16; if not (csDesigning in ComponentState) then begin FInplaceEdit := TMemo.Create(Self); FInplaceEdit.Parent := Self; FInplaceEdit.Visible := False; FInplaceEdit.OnExit := InplaceExit; end; FOnDragDrop := OwnOnDragDrop; FHScroll := 0; end; destructor TTodoHeader.Destroy; begin if not (csDesigning in ComponentState) then FInplaceEdit.Free; inherited; end; procedure TTodoHeader.InplaceExit(Sender: TObject); begin Sections[FEditSection] := FInplaceEdit.Text; SectionWidth[FEditSection] := FEditWidth; FInplaceEdit.Visible := False; end; procedure TTodoHeader.SetAlignment(const Value: TAlignment); begin FAlignment := Value; Invalidate; end; procedure TTodoHeader.SetVAlignment(const Value: TVAlignment); begin FVAlignment := Value; Invalidate; end; procedure TTodoHeader.SetColor(const Value: TColor); begin FColor := Value; Invalidate; end; procedure TTodoHeader.SetLineColor(const Value: TColor); begin FLineColor := Value; Invalidate; end; procedure TTodoHeader.SetImageList(const Value: TImageList); begin FImageList := Value; Invalidate; end; procedure TTodoHeader.SetOrientation(const Value: THeaderOrientation); begin FOrientation := Value; Invalidate; end; procedure TTodoHeader.SetFlat(const Value: Boolean); begin FFlat := Value; Invalidate; end; procedure TTodoHeader.SetImagePosition(const Value: TImagePosition); begin FImagePosition := Value; Invalidate; end; function TTodoHeader.GetSectionRect(X: Integer): TRect; var Offset, SectionIndex: Integer; begin Offset := 0; for SectionIndex := 0 to X - 1 do Offset := Offset + SectionWidth[SectionIndex]; if FOrientation = hoHorizontal then begin Result.Left := Offset; Result.Right := Offset + SectionWidth[X]; Result.Top := 0; Result.Bottom := Self.Height; end else begin Result.Left := 0; Result.Right := Self.Height; Result.Top := Offset; Result.Bottom := Offset + SectionWidth[X]; end; end; function TTodoHeader.XYToSection(X, Y: Integer): Integer; var Ofs, SectionIndex: Integer; begin Ofs := 0; SectionIndex := 0; if FOrientation = hoHorizontal then begin while (Ofs < X) and (SectionIndex < Sections.Count) do begin Ofs := Ofs + SectionWidth[SectionIndex]; Inc(SectionIndex); end; Dec(SectionIndex); end else begin while (Ofs < Y) and (SectionIndex < Sections.Count) do begin Ofs := Ofs + SectionWidth[SectionIndex]; Inc(SectionIndex); end; Dec(SectionIndex); end; Result := SectionIndex; end; procedure TTodoHeader.DrawSortIndicator(Canvas: TCanvas; x, y: Integer); var left, vpos: Integer; begin left := x; vpos := y; if FSortDirection = sdDescending then begin {draw a full Colored triangle} Canvas.Pen.Color := clWhite; Canvas.Pen.Width := 1; Canvas.MoveTo(Left + 4, vpos - 4); Canvas.LineTo(Left, vpos + 4); Canvas.pen.Color := clGray; Canvas.LineTo(Left - 4, vpos - 4); Canvas.LineTo(Left + 4, vpos - 4); Canvas.pen.Color := clBlack; end else begin Canvas.pen.Color := clWhite; Canvas.pen.Width := 1; Canvas.MoveTo(Left - 4, vpos + 4); Canvas.LineTo(Left + 4, vpos + 4); Canvas.LineTo(Left, vpos - 4); Canvas.pen.Color := clGray; Canvas.LineTo(Left - 4, vpos + 4); Canvas.pen.Color := clBlack; end; end; procedure TTodoHeader.Paint; var SectionIndex, w, AIdx: Integer; s: string; r: TRect; pr: TRect; HorizontalAlign: Word; VerticalAlign: Word; AllPainted: Boolean; DoDraw: Boolean; ImgIdx: Integer; clr,clrto: TColor; begin with Canvas do begin Font := Self.Font; Brush.Color := FColor; if FLineColor = clNone then Pen.Color := FColor else Pen.Color := FLineColor; Pen.Width := 1; SectionIndex := 0; if (Orientation = hoHorizontal) then r := Rect(0, 0, 0, ClientHeight) else r := Rect(0, 0, ClientWidth, 0); w := 0; s := ''; ImgIdx := -1; HorizontalAlign := AlignToFlag(FAlignment); VerticalAlign := 0; AllPainted := False; repeat if SectionIndex < Sections.Count then begin w := SectionWidth[SectionIndex]; case FVAlignment of vtaTop: VerticalAlign := DT_TOP; vtaCenter: VerticalAlign := DT_VCENTER; vtaBottom: VerticalAlign := DT_BOTTOM; else VerticalAlign := DT_TOP; end; if FOffset = 1 then begin if (SectionIndex < Sections.Count - 1 - FLeftPos) and (SectionIndex > 0) then begin AIdx := SectionIndex + FLeftPos; s := Sections[AIdx]; ImgIdx := Integer(Sections.Objects[AIdx]); end else begin s := ''; end; end else begin if (SectionIndex < Sections.Count - FLeftPos) then AIdx := SectionIndex + 1 + FLeftPos - 1 else AIdx := 0; s := Sections[AIdx]; ImgIdx := Integer(Sections.Objects[AIdx]); end; Inc(SectionIndex); end; if (Orientation = hoHorizontal) then begin r.Left := r.Right; Inc(r.Right, w); if (ClientWidth - r.Right < 2) or (SectionIndex = Sections.Count) then begin r.Right := ClientWidth; AllPainted := True; end; end else begin r.Top := r.Bottom; Inc(r.Bottom, w); if (ClientHeight - r.Bottom < 2) or (SectionIndex = Sections.Count) then begin r.Bottom := ClientHeight; AllPainted := True; end; end; pr := r; if (SectionIndex - 1 = ActiveColumn) and (ActiveColumn >= 0) then begin clr := FActiveColor; clrto := FActiveColorTo; Brush.Color := clr; end else begin clr := FColor; clrto := FColorTo; end; if (clrto <> clNone) then DrawGradient(Canvas, clr, clrto, 16, r, false) else FillRect(r); DoDraw := True; SetBKMode(Canvas.Handle, TRANSPARENT); { if Assigned(TPlanner(Owner).FOnPlannerHeaderDraw) then begin Font := Self.Font; Brush.Color := FColor; Pen.Color := FLineColor; Pen.Width := 1; TPlanner(Owner).FOnPlannerHeaderDraw(TPlanner(Owner), Canvas, r, AIdx, DoDraw); end; } if DoDraw then begin InflateRect(pr, -4, -2); if Assigned(FImageList) and (ImgIdx <> -1) then begin if (ImgIdx < FImageList.Count) then begin FImageList.Draw(Canvas, pr.Left, pr.Top, ImgIdx); pr.Left := pr.Left + FImageList.Width + 2; end; end; { if Assigned(FImageList) and (FImageList.Count + 1 + FOffset - FLeftPos > SectionIndex) and (SectionIndex > FOffset) and (SectionIndex <= Sections.Count - 1 - FLeftPos) then begin if FImagePosition = ipLeft then begin FImageList.Draw(Canvas, pr.Left, pr.Top, SectionIndex - 1 - FOffset + FLeftPos); pr.Left := pr.Left + FImageList.Width; end else begin pr.Right := pr.Right - FImageList.Width; FImageList.Draw(Canvas, pr.Right, pr.Top, SectionIndex - 1 - FOffset); end; end; s := CLFToLF(s); } if Pos(#13, s) = 0 then VerticalAlign := VerticalAlign or DT_SINGLELINE else VerticalAlign := 0; pr.Bottom := pr.Top + FTextHeight; if (SectionIndex - 1 = SortedSection) and FSortShow then pr.Right := pr.Right - 16; DrawText(Canvas.Handle, PChar(s), Length(s), pr, DT_NOPREFIX or DT_END_ELLIPSIS or HorizontalAlign or VerticalAlign); if (SectionIndex - 1 = SortedSection) and FSortShow then begin DrawText(Canvas.Handle, PChar(s), Length(s), pr, DT_NOPREFIX or DT_END_ELLIPSIS or HorizontalAlign or VerticalAlign or DT_CALCRECT); if (pr.Right > pr.Left) then begin if (r.Right > pr.Right) then DrawSortIndicator(Canvas, r.Right - 8, pr.Top + 6) else DrawSortIndicator(Canvas, pr.Right + 8, pr.Top + 6) end; end; if not FFlat then begin DrawEdge(Canvas.Handle, r, BDR_RAISEDINNER, BF_TOPLEFT); DrawEdge(Canvas.Handle, r, BDR_RAISEDINNER, BF_BOTTOMRIGHT); end else begin if (SectionIndex > 1) and (Orientation = hoHorizontal) and (FLineColor <> clNone) then begin Canvas.MoveTo(r.Left + 1, r.Top); Canvas.LineTo(r.Left + 1, r.Bottom); end; if (SectionIndex > 1) and (Orientation = hoVertical) and (FLineColor <> clNone) then begin Canvas.MoveTo(r.Left, r.Top + 2); Canvas.LineTo(r.Right, r.Top + 2); end; end; { with (Owner as TPlanner) do begin APlannerItem := Items.HeaderFirst(SectionIndex - 2 + FLeftPos); while Assigned(APlannerItem) do begin pr.Left := r.Left + 2; pr.Right := r.Right - 2; pr.Top := pr.Bottom; pr.Bottom := pr.Bottom + FItemHeight; APlannerItem.FRepainted := False; FGrid.PaintItemCol(Self.Canvas, pr, APlannerItem, False); APlannerItem := Items.HeaderNext(SectionIndex - 2 + FLeftPos); end; end; } Font := Self.Font; Brush.Color := FColor; Pen.Color := FLineColor; Pen.Width := 1; end; until (AllPainted); end; end; procedure TTodoHeader.WMLButtonDown(var Message: TWMLButtonDown); var r: TRect; Column: Integer; begin if FSectionDragDrop and not FDragging then begin FDragStart := XYToSection(Message.XPos, Message.YPos); if (FDragStart >= FOffset) then begin FDragging := True; Self.Cursor := crDrag; SetCapture(Self.Handle); end; end; if FSectionEdit and not (csDesigning in ComponentState) then begin if FInplaceEdit.Visible then begin Sections[FEditSection] := FInplaceEdit.Text; SectionWidth[FEditSection] := FEditWidth; end; FEditSection := XYToSection(Message.xpos, Message.ypos); r := GetSectionRect(FEditSection); InflateRect(r, -2, -2); OffsetRect(r, 2, 2); FInplaceEdit.Top := r.Top; FInplaceEdit.Left := r.Left; FInplaceEdit.Width := r.Right - r.Left; FInplaceEdit.Height := r.Bottom - r.Top; FInplaceEdit.Color := Self.Color; FInplaceEdit.Font.Assign(Self.Font); FInplaceEdit.Text := Self.Sections[FEditSection]; FInplaceEdit.BorderStyle := bsNone; FInplaceEdit.Visible := True; FInplaceEdit.SelectAll; FEditWidth := SectionWidth[FEditSection]; FInplaceEdit.SetFocus; end; inherited; Column := XYToSection(Message.XPos, Message.YPos); with Owner as TCustomTodoList do begin r := GetSectionRect(Column); HideEditor; if (Column >= 0) and (Column < Columns.Count) and (Abs(Message.Xpos - r.Left) > 4) and (Abs(Message.XPos - r.Right) > 4) then begin if Columns[Column].TodoData <> tdHandle then begin if SortColumn = Column then begin if SortDirection = sdAscending then SortDirection := sdDescending else SortDirection := sdAscending; end else begin SortColumn := Column; end; end; end; end; if Assigned(FOnClick) then FOnClick(Self, Column); end; procedure TTodoHeader.WMLButtonUp(var Message: TWMLButtonUp); var FDragStop: Integer; begin inherited; if Assigned(FOnClick) then FOnClick(Self, XYToSection(Message.xpos, Message.ypos)); if FSectionDragDrop and FDragging then begin FDragging := False; Self.Cursor := crDefault; ReleaseCapture; if Assigned(FOnDragDrop) then begin FDragStop := XYToSection(Message.xpos, Message.ypos); if (FDragStop >= FOffset) and (FDragStop <> FDragStart) then FOnDragDrop(Self, FDragStart, FDragStop); end; end; end; procedure TTodoHeader.WMRButtonDown(var Message: TWMLButtonDown); begin inherited; if Assigned(FOnRightClick) then FOnRightClick(Self, XYToSection(Message.xpos, Message.ypos)); end; procedure TTodoHeader.SetItemHeight(const Value: Integer); begin FItemHeight := Value; Invalidate; end; procedure TTodoHeader.SetTextHeight(const Value: Integer); begin FTextHeight := Value; Invalidate; end; procedure TTodoHeader.SetSortDirection(const Value: TSortDirection); begin FSortDirection := Value; Invalidate; end; procedure TTodoHeader.SetSortedSection(const Value: Integer); begin FSortedSection := Value; Invalidate; end; procedure TTodoHeader.OwnOnDragDrop(Sender: TObject; FromSection, ToSection: Integer); begin FOwner.Columns.Items[FromSection].Index := ToSection; FOwner.ColumnsChanged(FOwner); if Assigned(FOwner.FOnHeaderDragDrop) then FOwner.FOnHeaderDragDrop(FOwner, FromSection, ToSection); end; procedure TTodoHeader.HorizontalScroll(X: integer); begin FHScroll := -X; Self.SectionWidth[0] := SectionWidth[0] + FHScroll; Invalidate; end; procedure TTodoHeader.SetColorTo(const Value: TColor); begin FColorTo := Value; Invalidate; end; procedure TTodoHeader.SetActiveColor(const Value: TColor); begin FActiveColor := Value; Invalidate; end; procedure TTodoHeader.SetActiveColorTo(const Value: TColor); begin FActiveColorTo := Value; Invalidate; end; procedure TTodoHeader.SetActiveColumn(const Value: Integer); begin FActiveColumn := Value; Invalidate; end; { TCustomTodoList } procedure TCustomTodoList.CheckChanged(Sender: TObject); begin Invalidate; end; procedure TCustomTodoList.ColumnsChanged(Sender: TObject); var Col: Integer; begin if (csLoading in ComponentState) then Exit; with FTodoHeader do begin while (Sections.Count > FTodoListBox.TodoColumns.Count) do Sections.Delete(Sections.Count - 1); while (Sections.Count < FTodoListBox.TodoColumns.Count) do Sections.Add(''); for Col := 1 to Sections.Count do begin Sections[Col - 1] := FTodoListBox.TodoColumns.Items[Col - 1].Caption; Sections.Objects[Col - 1] := TObject(FTodoListBox.TodoColumns.Items[Col - 1].ImageIndex); SectionWidth[Col - 1] := FTodoListBox.TodoColumns.Items[Col - 1].Width; end; end; if (FTodoHeader.Sections.count > 0) then FTodoHeader.HorizontalScroll(GetScrollPos(FTodoListBox.Handle, SB_HORZ)); end; constructor TCustomTodoList.Create(AOwner: TComponent); begin inherited; FTodoListBox := TTodoListBox.Create(Self); FTodoHeader := TTodoHeader.Create(Self); FStatusStrings := TStatusStrings.Create(Self); FPriorityStrings := TPriorityStrings.Create(Self); FEditColors := TEditColors.Create(Self); FCategory := TStringList.Create; FCompleteCheck := TCompleteCheck.Create; FCompleteCheck.OnChange := CheckChanged; {$IFDEF USE_PLANNERDATEPICKER} FCalendarType := tcPlannerCalendar; {$ENDIF} FTodoHeader.Parent := self; FTodoHeader.Visible := True; FTodoHeader.BorderStyle := bsNone; FTodoHeader.Height := 22; FTodoHeader.Align := alTop; FTodoHeader.OnSized := SectionSized; FTodoHeader.OnClick := HeaderClick; FTodoHeader.OnRightClick := HeaderRightClick; FTodoListBox.Parent := Self; FTodoListBox.Visible := True; FTodoListBox.Align := alClient; FTodoListBox.BorderStyle := bsNone; FTodoListBox.OnColumnsChanged := ColumnsChanged; FTodoListBox.ParentShowHint := False; FTodoListBox.OnMouseMove := ListMouseMove; FTodoListBox.OnMouseDown := ListMouseDown; FTodoListBox.OnMouseUp := ListMouseUp; FTodoListBox.OnKeyDown := ListKeyDown; FTodoListBox.OnKeyUp := ListKeyUp; FTodoListBox.OnKeyPress := ListKeyPress; FTodoListBox.OnClick := ListClick; FTodoListBox.OnDblClick := ListDblClick; FTodoListBox.OnDragDrop := ListDragDrop; FTodoListBox.OnDragOver := ListDragOver; FTodoListBox.OnStartDrag := ListStartDrag; FTodoListBox.OnEndDrag := ListEndDrag; FTodoListBox.OnEnter := ListEnter; FTodoListBox.OnExit := ListExit; FTodoListBox.OnSelectItem := ListSelect; FTodoListBox.OnHorizontalScroll := LisBoxHorizontalScroll; with Columns.Add do begin TodoData := tdHandle; Width := 32; end; with Columns.Add do begin TodoData := tdSubject; Caption := 'Subject'; end; with Columns.Add do begin TodoData := tdCompletion; Caption := 'Completion'; end; FNullDate := 'None'; TabStop := False; ItemHeight := 22; DoubleBuffered := true; Width := 250; Height := 200; FStatusListWidth := -1; FPriorityListWidth := -1; BorderStyle := bsSingle; FAutoInsertItem := True; FAutoDeleteItem := True; FCompletionGraphic := True; FHintShowFullText := False; HeaderDragDrop := False; Look := esOffice2003Blue; GridLines := glsAlways; FTotalTimeSuffix := 'h'; end; procedure TCustomTodoList.CreateWnd; begin inherited; if (csDesigning in ComponentState) then FTodoListBox.SynchColumns; end; procedure TCustomTodoList.CreateParams(var Params: TCreateParams); begin inherited; if FBorderStyle = bsSingle then Params.Style := Params.Style or WS_BORDER else Params.Style := Params.Style and not WS_BORDER; end; destructor TCustomTodoList.Destroy; begin FTodoListBox.Free; FTodoHeader.Free; FTodoHeader := nil; FStatusStrings.Free; FPriorityStrings.Free; FEditColors.Free; FCategory.Free; FCompleteCheck.Free; inherited; end; function TCustomTodoList.GetColor: TColor; begin Result := FTodoListBox.Color; end; function TCustomTodoList.GetCompletionFont: TFont; begin Result := FTodoListBox.CompletionFont; end; function TCustomTodoList.GetDateFormat: string; begin Result := FTodoListBox.DateFormat; end; function TCustomTodoList.GetEditable: boolean; begin result := FTodoListBox.Editable; end; function TCustomTodoList.GetFont: TFont; begin Result := FTodoListBox.Font; end; function TCustomTodoList.GetGridLines: TGridLineStyle; begin Result := FTodoListBox.GridLines; end; function TCustomTodoList.GetImages: TImageList; begin Result := FTodoListBox.Images; end; function TCustomTodoList.GetItemHeight: Integer; begin Result := FItemHeight; end; function TCustomTodoList.GetPreview: Boolean; begin Result := FTodoListBox.Preview; end; function TCustomTodoList.GetPreviewFont: TFont; begin Result := FTodoListBox.PreviewFont; end; function TCustomTodoList.GetPriorityFont: TFont; begin Result := FTodoListBox.PriorityFont; end; function TCustomTodoList.GetProgressLook: TProgressLook; begin Result := FTodoListBox.ProgressLook; end; function TCustomTodoList.GetSelectAllInSubjectEdit: Boolean; begin Result := FTodoListBox.EditSelectAll; end; function TCustomTodoList.GetSelectionColor: TColor; begin Result := FTodoListBox.SelectionColor; end; function TCustomTodoList.GetSelectionFontColor: TColor; begin Result := FTodoListBox.SelectionFontColor; end; function TCustomTodoList.GetShowSelection: Boolean; begin Result := FTodoListBox.ShowSelection; end; function TCustomTodoList.GetTodoColumns: TTodoColumnCollection; begin Result := FTodoListBox.TodoColumns; end; function TCustomTodoList.GetTodoItems: TTodoItemCollection; begin Result := FTodoListBox.TodoItems; end; procedure TCustomTodoList.ListClick(Sender: TObject); begin if Assigned(FOnClick) then FOnClick(Self); end; procedure TCustomTodoList.ListDblClick(Sender: TObject); begin if Assigned(FOnDblClick) then FOnDblClick(Self); end; procedure TCustomTodoList.ListKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Assigned(FOnKeyDown) then FOnKeyDown(Self, Key, Shift); end; procedure TCustomTodoList.ListKeyPress(Sender: TObject; var Key: Char); begin if Assigned(FOnKeyPress) then FOnKeyPress(Self, Key); end; procedure TCustomTodoList.ListKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Assigned(FOnKeyUp) then FOnKeyUp(Self, Key, Shift); end; procedure TCustomTodoList.ListMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var r: TRect; ColIdx,ItemIdx: Integer; ATodoItem: TTodoItem; begin if Assigned(FOnMouseDown) then FOnMouseDown(Self, Button, Shift, X, Y); if (Button = mbRight) and Assigned(FOnItemRightClick) then begin if FTodoListBox.XYToColItem(X,Y,ColIdx,ItemIdx,r) then begin //ATodoItem := Items[FTodoListBox.ItemIndex]; if ItemIdx < Items.Count then begin ATodoItem := Items[ItemIdx]; FOnItemRightClick(Self, ATodoItem); end; end; end; end; procedure TCustomTodoList.ListMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin if Assigned(FOnMouseMove) then FOnMouseMove(Self, Shift, X, Y); end; procedure TCustomTodoList.ListMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if Assigned(FOnMouseUp) then FOnMouseUp(Self, Button, Shift, X, Y); end; procedure TCustomTodoList.ListDragDrop(Sender, Source: TObject; X, Y: Integer); begin if Assigned(FOnDragDrop) then FOnDragDrop(Self, Source, X, Y); end; procedure TCustomTodoList.ListDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); begin if Assigned(FOnDragOver) then FOnDragOver(Self, Source, X, Y, State, Accept); end; procedure TCustomTodoList.ListEndDrag(Sender, Target: TObject; X, Y: Integer); begin if Assigned(FOnEndDrag) then FOnEndDrag(Self, Target, X, Y); end; procedure TCustomTodoList.ListStartDrag(Sender: TObject; var DragObject: TDragObject); begin if Assigned(FOnStartDrag) then FOnStartDrag(Self, DragObject); end; procedure TCustomTodoList.Loaded; begin inherited; FTodoListBox.SynchItems; ColumnsChanged(FTodoListBox); if FAutoThemeAdapt then ThemeAdapt; end; procedure TCustomTodoList.SetFocus; begin FTodoListBox.SetFocus; end; function TCustomTodoList.PriorityCommaText: string; var i: TTodoPriority; begin for i := Low(TTodoPriority) to High(TTodoPriority) do Result := Result + ',"' + PriorityStrings[i] + '"'; Delete(Result, 1, 1); // Result := '"Lowest", "Low", "Normal", "High", "Highest"'; end; function TCustomTodoList.PriorityToString(AValue: TTodoPriority): string; begin // case AValue of // tpLowest: Result := 'Lowest'; // tpLow: Result := 'Low'; // tpNormal: Result := 'Normal'; // tpHigh: Result := 'High'; // tpHighest: Result := 'Highest'; // else // EConversionFunctionException.Create('TodoPriorityToString error. Unknown priority passed as parameter to the function.'); // end; Result := PriorityStrings[AValue]; if Assigned(FOnPriorityToString) then FOnPriorityToString(Self, AValue, Result); end; procedure TCustomTodoList.SectionSized(Sender: TObject; SectionIdx, SectionWidth: Integer); begin if FTodoListBox.TodoColumns.Count > SectionIdx then begin FTodoListBox.TodoColumns.Items[SectionIdx].Width := SectionWidth; //SetScrollPos(FTodoListBox.Handle,SB_HORZ, 0, false); //LisBoxHorizontalScroll(self); end; end; procedure TCustomTodoList.SetBorderStyle(const Value: TBorderStyle); begin if FBorderStyle <> Value then begin FBorderStyle := Value; RecreateWnd; end; end; procedure TCustomTodoList.SetColor(const Value: TColor); begin FTodoListBox.Color := Value; end; procedure TCustomTodoList.SetCompleteCheck(const Value: TCompleteCheck); begin FCompleteCheck.Assign(Value); end; procedure TCustomTodoList.SetCompletionFont(const Value: TFont); begin FTodoListBox.CompletionFont.Assign(Value); end; procedure TCustomTodoList.SetDateFormat(const Value: string); begin FTodoListBox.DateFormat := Value; end; procedure TCustomTodoList.SetEditable(const Value: boolean); begin FTodoListBox.Editable := Value; end; procedure TCustomTodoList.SetFont(const Value: TFont); begin FTodoListBox.Font.Assign(Value); end; procedure TCustomTodoList.SetGridLines(const Value: TGridLineStyle); begin FTodoListBox.GridLines := Value; end; procedure TCustomTodoList.SetImages(const Value: TImageList); begin FTodoListBox.Images := Value; end; procedure TCustomTodoList.SetItemHeight(const Value: Integer); begin if Preview then begin FTodoListBox.ItemHeight := Value + PreviewHeight; FItemHeight := FTodoListBox.ItemHeight - PreviewHeight; end else begin FTodoListBox.ItemHeight := Value; FItemHeight := FTodoListBox.ItemHeight; end; { Why not just a FItemHeight := Value; at the end of the Set method? Because the TCustomListBox ItemHeight property refuses to take all values. For example, if I assign to 0, it will remain set to the default value. The FItemHeight setting code above exists in order to propagate this behaviour to the TCustomTodoList level. } end; procedure TCustomTodoList.SetPreview(const Value: Boolean); begin FTodoListBox.Preview := Value; SetItemHeight(ItemHeight); end; procedure TCustomTodoList.SetPreviewFont(const Value: TFont); begin FTodoListBox.PreviewFont.Assign(Value); end; procedure TCustomTodoList.SetPreviewHeight(const Value: Integer); begin FPreviewHeight := Value; SetItemHeight(ItemHeight); end; procedure TCustomTodoList.SetPriorityFont(const Value: TFont); begin FTodoListBox.PriorityFont.Assign(Value); end; procedure TCustomTodoList.SetProgressLook(const Value: TProgressLook); begin FTodoListBox.ProgressLook.Assign(Value); end; procedure TCustomTodoList.SetSelectAllInSubjectEdit(const Value: Boolean); begin FTodoListBox.EditSelectAll := Value; end; procedure TCustomTodoList.SetSelectionColor(const Value: TColor); begin FTodoListBox.SelectionColor := Value; end; procedure TCustomTodoList.SetSelectionFontColor(const Value: TColor); begin FTodoListBox.SelectionFontColor := Value; end; procedure TCustomTodoList.SetShowSelection(const Value: Boolean); begin FTodoListBox.ShowSelection := Value; end; procedure TCustomTodoList.SetTodoColumns(const Value: TTodoColumnCollection); begin FTodoListBox.TodoColumns.Assign(Value); end; procedure TCustomTodoList.SetTodoItems(const Value: TTodoItemCollection); begin FTodoListBox.TodoItems.Assign(Value); end; function TCustomTodoList.StatusCommaText: string; var i: TTodoStatus; begin for i := Low(TTodoStatus) to High(TTodoStatus) do Result := Result + ',"' + StatusStrings[i] + '"'; Delete(Result, 1, 1); // Result:='"Not started", "In progress", "Completed", "Deferred"'; end; function TCustomTodoList.StatusToString(AValue: TTodoStatus): string; begin Result := StatusStrings[AValue]; if Assigned(FOnStatusToString) then FOnStatusToString(Self, AValue, Result); end; function TCustomTodoList.StringToPriority(AValue: string): TTodoPriority; var i: TTodoPriority; lFound: Boolean; begin AValue := LowerCase(AValue); lFound := False; for i := Low(TTodoPriority) to High(TTodoPriority) do if LowerCase(PriorityStrings[i]) = AValue then begin lFound := True; Result := i; end; if not lFound then raise EConversionFunctionException.Create('TodoPriorityFromString error. The parameter "' + AValue + '" is not a valid priority string.'); if Assigned(FOnStringToPriority) then FOnStringToPriority(Self, AValue, Result); end; function TCustomTodoList.StringToStatus(AValue: string): TTodoStatus; var i: TTodoStatus; lFound: Boolean; begin lFound := False; AValue := LowerCase(AValue); for i := Low(TTodoStatus) to High(TTodoStatus) do if LowerCase(StatusStrings[i]) = AValue then begin lFound := True; Result := i; end; if not lFound then raise EConversionFunctionException.Create('TodoStatusFromString error. The parameter "' + AValue + '" is not a valid status string.'); if Assigned(FOnStringToStatus) then FOnStringToStatus(Self, AValue, Result); end; function TCustomTodoList.CompareItems(A, B: Integer): Integer; var Item1, Item2: TTodoItem; begin Item1 := Items.Items[A]; Item2 := Items.Items[B]; Result := 0; case Columns.Items[FSortColumn].TodoData of tdComplete: begin if Item1.Complete and not Item2.Complete then Result := 1; if not Item1.Complete and Item2.Complete then Result := -1; end; tdCompletion: begin if Item1.Completion > Item2.Completion then Result := 1 else if Item1.Completion < Item2.Completion then Result := -1; end; tdCompletionDate: begin if Item1.CompletionDate > Item2.CompletionDate then Result := 1 else if Item1.CompletionDate < Item2.CompletionDate then Result := -1; end; tdCreationDate: begin if Item1.CreationDate > Item2.CreationDate then Result := 1 else if Item1.CreationDate < Item2.CreationDate then Result := -1; end; tdDueDate: begin if Item1.DueDate > Item2.DueDate then Result := 1 else if Item1.DueDate < Item2.DueDate then Result := -1; end; tdPriority: begin if Item1.Priority > Item2.Priority then Result := 1 else if Item1.Priority < Item2.Priority then Result := -1; end; tdStatus: begin if Item1.Status > Item2.Status then Result := 1 else if Item1.Status < Item2.Status then Result := -1; end; tdTotalTime: begin if Item1.TotalTime > Item2.TotalTime then Result := 1 else if Item1.TotalTime < Item2.TotalTime then Result := -1; end; tdSubject: begin Result := AnsiStrComp(PChar(Item1.Subject), PChar(Item2.Subject)); end; tdCategory: begin Result := AnsiStrComp(PChar(Item1.Category), PChar(Item2.Category)); end; tdResource: begin Result := AnsiStrComp(PChar(Item1.Resource), PChar(Item2.Resource)); end; tdNotes: begin Result := AnsiStrComp(PChar(Item1.Notes.Text), PChar(Item2.Notes.Text)); end; tdProject: begin Result := AnsiStrComp(PChar(Item1.Project), PChar(Item2.Project)); end; tdImage: if Item1.ImageIndex > Item2.ImageIndex then Result := 1 else if Item1.ImageIndex < Item2.ImageIndex then Result := -1; end; if FSortDirection = sdDescending then Result := Result * -1; end; procedure TCustomTodoList.SwapItems(A, B: Integer); var SI: TTodoItem; SK: string; begin SI := Items.Add; SI.Assign(Items.Items[A]); SK := Items.Items[A].DBKey; // public property Items.Items[A].Assign(Items.Items[B]); Items.Items[A].DBKey := Items.Items[B].DBKey; Items.Items[B].Assign(SI); Items.Items[B].DBKey := SK; SI.Free; end; procedure TCustomTodoList.QuickSortItems(Left, Right: Integer); var i, j: Integer; Mid: Integer; begin i := Left; j := Right; // get middle item here Mid := (Left + Right) shr 1; repeat while (CompareItems(Mid, i) > 0) and (i < Right) do Inc(i); while (CompareItems(Mid, j) < 0) and (j > Left) do Dec(j); if i <= j then begin if i <> j then begin if CompareItems(i, j) <> 0 then begin if i = FNewIdx then FNewIdx := j else if j = FNewIdx then FNewIdx := i; SwapItems(i, j); end; end; Inc(i); Dec(j); end; until i > j; if (Left < j) then QuicksortItems(Left, j); if (i < Right) then QuickSortItems(i, right); end; procedure TCustomTodoList.Sort; begin FNewIdx := FTodoListBox.ItemIndex; if Items.Count > 1 then QuickSortItems(0, Items.Count - 1); FTodoListBox.ItemIndex := FNewIdx; ListSelect(Self); end; { function TCustomTodoList.XYToColItem(const X, Y: Integer; var ColIdx, ItemIdx: Integer; var R:TRect): Boolean; begin ItemIdx := SendMessage(FTodoListBox.Handle,LB_ITEMFROMPOINT,0,MakeLong(X,Y)); Result := ItemIdx >= 0; if Result then begin SendMessage(FTodoListBox.Handle,LB_GETITEMRECT,ItemIdx,Longint(@R)); Result := False; ColIdx := 0; while ColIdx < Columns.Count do begin R.Right := R.Left + Columns.Items[ColIdx].Width; if (X >= R.Left) and (X <= R.Right) then begin Result := True; Break; end else R.Left := R.Right; Inc(ColIdx); end; end; end; } procedure TCustomTodoList.ListEnter(Sender: TObject); begin if Assigned(FOnEnter) then FOnEnter(Self); end; procedure TCustomTodoList.ListExit(Sender: TObject); begin if Assigned(FOnExit) then FOnExit(Self); end; function TCustomTodoList.GetDragCursor: TCursor; begin Result := FTodoListBox.DragCursor; end; function TCustomTodoList.GetDragKind: TDragKind; begin Result := FTodoListBox.DragKind; end; function TCustomTodoList.GetDragMode: TDragMode; begin Result := FTodoListBox.DragMode; end; procedure TCustomTodoList.SetDragCursor(const Value: TCursor); begin FTodoListBox.DragCursor := Value; end; procedure TCustomTodoList.SetDragKind(const Value: TDragKind); begin FTodoListBox.DragKind := Value; end; procedure TCustomTodoList.SetDragModeEx(const Value: TDragMode); begin FTodoListBox.DragMode := Value; end; procedure TCustomTodoList.SetSortColumn(const Value: Integer); begin if FSortColumn <> Value then begin FSortColumn := Value; FTodoHeader.SortedSection := Value; if FSorted and (FSortColumn >= 0) then Sort; end; end; procedure TCustomTodoList.SetSortDirection(const Value: TSortDirection); begin if FSortDirection <> Value then begin FSortDirection := Value; FTodoHeader.SortDirection := Value; if FSorted then Sort; end; end; procedure TCustomTodoList.SetSorted(const Value: Boolean); begin FSorted := Value; FTodoHeader.SortShow := Value; FTodoHeader.Invalidate; if (FSorted = True) and (SortColumn >= 0) and (SortColumn < Columns.Count) then Sort; end; procedure TCustomTodoList.HeaderClick(Sender: TObject; Section: Integer); begin if Assigned(FOnHeaderClick) then FOnHeaderClick(Self, Section); end; procedure TCustomTodoList.HeaderRightClick(Sender: TObject; Section: Integer); begin if Assigned(FOnHeaderRightClick) then FOnHeaderRightClick(Self, Section); end; procedure TCustomTodoList.HideEditor; begin FTodoListBox.EditorOnExit(Self); end; procedure TCustomTodoList.ShowEditor(Index, Column: Integer); var Msg: TMessage; begin FTodoListBox.StartEdit(Index, Column, False, Msg, 0, 0, #0); end; function TCustomTodoList.GetSelected: TTodoItem; begin Result := nil; if FTodoListBox.ItemIndex >= 0 then Result := Items[FTodoListBox.ItemIndex]; end; function TCustomTodoList.GetHeaderFont: TFont; begin Result := FTodoHeader.Font; end; procedure TCustomTodoList.SetHeaderFont(const Value: TFont); begin FTodoHeader.Font.Assign(Value); end; function TCustomTodoList.AllowAutoDelete(ATodoItem: TTodoItem): Boolean; var Allow: Boolean; begin Allow := True; if Assigned(FOnItemDelete) then FOnItemDelete(Self, ATodoItem, Allow); Result := Allow; end; function TCustomTodoList.AllowAutoInsert(ATodoItem: TTodoItem): Boolean; var Allow: Boolean; begin Allow := True; if Assigned(FOnItemInsert) then FOnItemInsert(Self, ATodoItem, Allow); Result := Allow; end; procedure TCustomTodoList.EditDone; begin if Assigned(FOnEditDone) then FOnEditDone(Self); end; procedure TCustomTodoList.EditStart; begin if Assigned(FOnEditStart) then FOnEditStart(Self); end; function TCustomTodoList.GetEditColumn: Integer; begin Result := FTodoListBox.FFocusColumn; end; procedure TCustomTodoList.SetEditColumn(const Value: Integer); begin FTodoListBox.FFocusColumn := Value; end; procedure TCustomTodoList.ListSelect(Sender: TObject); var ATodoItem: TTodoItem; begin if FTodoListBox.ItemIndex >= 0 then ATodoItem := Items[FTodoListBox.ItemIndex] else ATodoItem := nil; ItemSelect(ATodoItem); end; procedure TCustomTodoList.ItemSelect(ATodoItem: TTodoItem); begin if Assigned(FOnItemSelect) then FOnItemSelect(Self, ATodoItem); end; procedure TCustomTodoList.AddColumn(Data: TTodoData; ACaption: string); begin with Columns.Add do begin TodoData := Data; Caption := ACaption; end end; procedure TCustomTodoList.RemoveColumn(Data: TTodoData); var i: Integer; begin for i := 1 to Columns.Count do begin if Columns[i - 1].TodoData = Data then begin Columns[i - 1].Free; Break; end; end; end; function TCustomTodoList.GetTabStopEx: Boolean; begin Result := FTodoListBox.TabStop; end; procedure TCustomTodoList.SetTabStopEx(const Value: Boolean); begin inherited TabStop := False; FTodoListBox.TabStop := Value; end; function TCustomTodoList.GetTabOrderEx: Integer; begin Result := FTodoListBox.TabOrder; end; procedure TCustomTodoList.SetTabOrderEx(const Value: Integer); begin FTodoListBox.TabOrder := Value; end; procedure TCustomTodoList.SaveToStream(S: TStream); var i: Integer; begin i := Items.Count; S.Write(i, 4); for i := 0 to Items.Count - 1 do Items[i].SaveToStream(S); end; procedure TCustomTodoList.LoadFromStream(S: TStream); var i, Count: Integer; begin Items.Clear; if S.Size > 0 then begin S.Read(Count, 4); for i := 1 to Count do Items.Add.LoadFromStream(S); SortColumn := -1; end; end; procedure TCustomTodoList.LoadFromFile(FileName: string); var S: TFileStream; begin S := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); try LoadFromStream(S); finally S.Free; end; end; procedure TCustomTodoList.SaveToFile(FileName: string); var S: TFileStream; begin S := TFileStream.Create(FileName, fmCreate or fmShareExclusive); try SaveToStream(S); finally S.Free; end; end; procedure TCustomTodoList.LoadColumns(FileName: string); var S: TFileStream; Count, i: Integer; begin S := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); try Columns.Clear; Count := ReadInteger(S); for i := 1 to Count do Columns.Add.LoadFromStream(S); finally S.Free; end; end; procedure TCustomTodoList.SaveColumns(FileName: string); var S: TFileStream; i: Integer; begin S := TFileStream.Create(FileName, fmCreate or fmShareExclusive); try WriteInteger(S, Columns.Count); for i := 0 to Columns.Count - 1 do Columns[i].SaveToStream(S); finally S.Free; end; end; procedure TCustomTodoList.SetCompletionGraphic(const Value: Boolean); begin FCompletionGraphic := Value; Invalidate; end; procedure TCustomTodoList.SetHeaderDragDrop(const Value: Boolean); begin FHeaderDragDrop := Value; FTodoHeader.SectionDragDrop := Value; end; procedure TCustomTodoList.SetHintShowFullText(const Value: Boolean); begin FHintShowFullText := Value; FTodoListBox.ShowHint := Value; end; procedure TCustomTodoList.NCPaintProc; var DC: HDC; ARect: TRect; Canvas: TCanvas; begin if BorderStyle = bsNone then Exit; DC := GetWindowDC(Handle); try Canvas := TCanvas.Create; Canvas.Handle := DC; GetWindowRect(Handle, ARect); if (Parent is TWinControl) then begin Canvas.Pen.Color := clGray; Canvas.MoveTo(0, Height); Canvas.LineTo(0, 0); Canvas.LineTo(Width - 1, 0); Canvas.LineTo(Width - 1, Height - 1); Canvas.LineTo(0, Height - 1); end; Canvas.Free; finally ReleaseDC(Handle, DC); end; end; procedure TCustomTodoList.WndProc(var Message: TMessage); begin inherited; if Message.Msg = WM_NCPAINT then NCPaintProc; if (Message.Msg = WM_THEMECHANGED) and AutoThemeAdapt then begin ThemeAdapt; end; if (Message.Msg = CM_SYSFONTCHANGED) and AutoThemeAdapt then begin ThemeAdapt; end; end; procedure TCustomTodoList.SetBounds(ALeft, ATop, AWidth, AHeight: Integer); begin inherited; if Assigned(Parent) then if Parent.HandleAllocated then NCPaintProc; end; function TCustomTodoList.FormatDateTimeEx(Format: string; dt: TDateTime): string; begin Result := FormatDateTime(Format, dt); if (dt = 0) and (FNullDate <> '') then Result := FNullDate; end; procedure TCustomTodoList.SetNullDate(const Value: string); begin FNullDate := Value; Invalidate; end; function TCustomTodoList.GetEditItem: TTodoItem; begin Result := List.EditedItem; end; procedure TCustomTodoList.CompleteClick(ItemIndex: Integer); begin if Assigned(FOnCompleteClick) then FOnCompleteClick(Self, ItemIndex); end; function TCustomTodoList.GetSelectionColorTo: TColor; begin Result := FTodoListBox.SelectionColorTo; end; procedure TCustomTodoList.SetSelectionColorTo(const Value: TColor); begin FTodoListBox.SelectionColorTo := Value; end; function TCustomTodoList.GetActiveColumnColor: TColor; begin Result := FTodoListBox.ActiveColumnColor; end; procedure TCustomTodoList.SetActiveColumnColor(const Value: TColor); begin FTodoListBox.ActiveColumnColor := Value; end; function TCustomTodoList.GetUseTab: Boolean; begin Result := FTodoListBox.UseTab; end; procedure TCustomTodoList.SetUseTab(const Value: Boolean); begin FTodoListBox.UseTab := Value; end; function TCustomTodoList.GetMultiSelect: Boolean; begin Result := FTodoListBox.MultiSelect; end; procedure TCustomTodoList.SetMultiSelect(const Value: Boolean); begin FTodoListBox.MultiSelect := Value; end; function TCustomTodoList.GetSelCount: integer; begin Result := FTodoListBox.SelCount; end; function TCustomTodoList.GetItemSelected(Index: Integer): Boolean; begin Result := FTodoListBox.Selected[Index]; end; procedure TCustomTodoList.SetItemSelected(Index: Integer; const Value: Boolean); begin FTodoListBox.Selected[Index] := Value; end; procedure TCustomTodoList.SelectAll; {$IFNDEF DELPHI6_LVL} var i: Integer; {$ENDIF} begin {$IFDEF DELPHI6_LVL} FTodoListBox.SelectAll; {$ENDIF} {$IFNDEF DELPHI6_LVL} for i := 1 to FTodoListBox.Items.Count do FTodoListBox.Selected[i - 1] := True; {$ENDIF} end; function TCustomTodoList.GetShowPriorityText: Boolean; begin Result := FTodoListBox.ShowPriorityText; end; procedure TCustomTodoList.SetShowPriorityText(const Value: Boolean); begin FTodoListBox.ShowPriorityText := Value; end; procedure TCustomTodoList.LisBoxHorizontalScroll(Sender: TObject); begin //Showmessage(inttostr(GetScrollPos(FTodoListBox.Handle,SB_HORZ))); ColumnsChanged(self); //FTodoHeader.HorizontalScroll(GetScrollPos(FTodoListBox.Handle,SB_HORZ)); end; procedure TCustomTodoList.SetCategory(const Value: TStringList); begin FCategory.Assign(Value); end; procedure TCustomTodoList.ExportToCSV(FileName: string); begin FTodoListBox.OutputToCSV(FileName, false); end; procedure TCustomTodoList.ImportFromCSV(FileName: string); begin FTodoListBox.InputFromCSV(FileName, false); end; function TCustomTodoList.GetActiveItemColor: TColor; begin Result := FTodoListBox.ActiveItemColor; end; procedure TCustomTodoList.SetActiveItemColor(const Value: TColor); begin FTodoListBox.ActiveItemColor := Value; end; function TCustomTodoList.GetActiveItemColorTo: TColor; begin Result := FTodoListBox.ActiveItemColorTo; end; procedure TCustomTodoList.SetActiveItemColorTo(const Value: TColor); begin FTodoListBox.ActiveItemColorTo := Value; end; function TCustomTodoList.GetScrollHorizontal: Boolean; begin Result := FTodoListBox.ScrollHorizontal; end; procedure TCustomTodoList.SetScrollHorizontal(const Value: Boolean); begin FTodoListBox.ScrollHorizontal := Value; end; function TCustomTodoList.GetHeaderColor: TColor; begin Result := FTodoHeader.Color; end; function TCustomTodoList.GetHeaderColorTo: TColor; begin Result := FTodoHeader.ColorTo; end; procedure TCustomTodoList.SetHeaderColor(const Value: TColor); begin FTodoHeader.Color := Value; end; procedure TCustomTodoList.SetHeaderColorTo(const Value: TColor); begin FTodoHeader.ColorTo := Value; end; function TCustomTodoList.GetHandleGlyph: TBitmap; begin Result := FTodoListBox.HandleGlyph; end; procedure TCustomTodoList.SetHandleGlyph(const Value: TBitmap); begin FTodoListBox.HandleGlyph := Value; end; procedure TCustomTodoList.SetHeaderImages(const Value: TImageList); begin FTodoHeader.Images := Value; Invalidate; end; procedure TCustomTodoList.Notification(AComponent: TComponent; AOperation: TOperation); begin if (AOperation = opRemove) and (AComponent = HeaderImages) then HeaderImages := nil; inherited; end; function TCustomTodoList.GetHeaderImages: TImageList; begin if Assigned(FTodoHeader) then Result := FTodoHeader.Images else Result := nil; end; function TCustomTodoList.GetHeaderHeight: Integer; begin Result := FTodoHeader.Height; end; procedure TCustomTodoList.SetHeaderHeight(const Value: Integer); begin FTodoHeader.Height := Value; end; function TCustomTodoList.GetGridLineColor: TColor; begin Result := FTodoListBox.GridLineColor; end; procedure TCustomTodoList.SetGridLineColor(const Value: TColor); begin FTodoListBox.GridLineColor := Value; end; function TCustomTodoList.GetVersionNr: Integer; begin Result := MakeLong(MakeWord(BLD_VER,REL_VER),MakeWord(MIN_VER,MAJ_VER)); end; function TCustomTodoList.GetVersionString: string; var vn: Integer; begin vn := GetVersionNr; Result := IntToStr(Hi(Hiword(vn)))+'.'+IntToStr(Lo(Hiword(vn)))+'.'+IntToStr(Hi(Loword(vn)))+'.'+IntToStr(Lo(Loword(vn)))+' '+DATE_VER; end; function TCustomTodoList.GetPreviewColor: TColor; begin Result := FTodoListBox.PreviewColor; end; function TCustomTodoList.GetPreviewColorTo: TColor; begin Result := FTodoListBox.PreviewColorTo; end; procedure TCustomTodoList.SetPreviewColor(const Value: TColor); begin FTodoListBox.PreviewColor := Value; end; procedure TCustomTodoList.SetPreviewColorTo(const Value: TColor); begin FTodoListBox.PreviewColorTo := Value; end; function TCustomTodoList.GetStretchLastColumn: Boolean; begin Result := FTodoListBox.StretchLastColumn; end; procedure TCustomTodoList.SetStretchLastColumn(const Value: Boolean); begin FTodoListBox.StretchLastColumn := Value; end; function TCustomTodoList.GetHeaderActiveColor: TColor; begin Result := FTodoHeader.ActiveColor; end; function TCustomTodoList.GetHeaderActiveColorTo: TColor; begin Result := FTodoHeader.ActiveColorTo; end; procedure TCustomTodoList.SetHeaderActiveColor(const Value: TColor); begin FTodoHeader.ActiveColor := Value; end; procedure TCustomTodoList.SetHeaderActiveColorTo(const Value: TColor); begin FTodoHeader.ActiveColorTo := Value; end; procedure TCustomTodoList.SetComponentStyle(AStyle: TTMSStyle); begin Look := TTodoListStyle(AStyle); end; procedure TCustomTodoList.SetLook(const Value: TTodoListStyle); begin FLook := Value; PreviewColor := clNone; PreviewColorTo := clNone; PreviewFont.Color := clBlack; ActiveItemColor := clNone; ActiveItemColorTo := clNone; SelectionColor := clHighLight; SelectionColorTo := clNone; case FLook of esOffice2003Blue: begin HeaderColor := $FCE1CB; HeaderColorTo := $E0A57D; HeaderActiveColor := $94E6FB; HeaderActiveColorTo := $1595EE; end; esOffice2003Olive: begin HeaderColor := $CFF0EA; HeaderColorTo := $8CC0B1; HeaderActiveColor := $94E6FB; HeaderActiveColorTo := $1595EE; end; esOffice2003Silver: begin HeaderColor := $ECE2E1; HeaderColorTo := $B39698; HeaderActiveColor := $94E6FB; HeaderActiveColorTo := $1595EE; end; esOffice2003Classic: begin HeaderColor := clWhite; HeaderColorTo := $ccd4d8; HeaderActiveColor := $d8d5d4; HeaderActiveColorTo := $d8d5d4; end; esOffice2007Luna: begin HeaderColor := clWhite; HeaderColorTo := $FFD2AF; HeaderActiveColor := $94E6FB; HeaderActiveColorTo := $1595EE; PreviewColor := clWhite; PreviewColorTo := $fff6ec; PreviewFont.Color := $808080; ActiveItemColor := $e8c8b3; ActiveItemColorTo := $e8c8b3; SelectionColor := $7a4c29; SelectionColorTo := $7a4c29; end; esOffice2007Obsidian: begin HeaderColor := $F2F1F0; HeaderColorTo := $C9C2BD; HeaderActiveColor := $94E6FB; HeaderActiveColorTo := $1595EE; PreviewColor := clWhite; PreviewColorTo := $fff6ec; PreviewFont.Color := $808080; ActiveItemColor := $e8c8b3; ActiveItemColorTo := $e8c8b3; SelectionColor := $7a4c29; SelectionColorTo := $7a4c29; end; esOffice2007Silver: begin HeaderColor := clWhite; HeaderColorTo := $DCD7D4; HeaderActiveColor := $94E6FB; HeaderActiveColorTo := $1595EE; PreviewColor := clWhite; PreviewColorTo := $fff6ec; PreviewFont.Color := $808080; ActiveItemColor := $e8c8b3; ActiveItemColorTo := $e8c8b3; SelectionColor := $7a4c29; SelectionColorTo := $7a4c29; end; esWindowsXP: begin HeaderColor := clBtnFace; HeaderColorTo := clBtnFace; HeaderActiveColor := clBtnFace; HeaderActiveColorTo := clBtnFace; end; esWhidbey: begin HeaderColor := $EBEEEF;//$808080; HeaderColorTo := $7E9898;//$808080; HeaderActiveColor := $94E6FB;//$D8D5D4; HeaderActiveColorTo := $1595EE;//$D8D5D4; end; esWindowsVista: begin HeaderColor := $FFFDF9; HeaderColorTo := $FFFAF0; HeaderActiveColor := $FEF9F0; HeaderActiveColorTo := $FDF0D7; end; esWindows7: begin HeaderColor := $FDFBFA; HeaderColorTo := $FDF3EB; HeaderActiveColor := $FCEBDC; HeaderActiveColorTo := $FCDBC1; end; esTerminal: begin HeaderColor := clBtnFace; HeaderColorTo := clBtnFace; HeaderActiveColor := clHighLight; HeaderActiveColorTo := clHighLight; end; esOffice2010Blue: begin HeaderColor := $FDF6EF; HeaderColorTo := $F0DAC7; HeaderActiveColor := $7BEEFF; HeaderActiveColorTo := $6CD0FF; SelectionColor := $6CD0FF; SelectionColorTo := $6CD0FF; end; esOffice2010Silver: begin HeaderColor := $FFFFFF; HeaderColorTo := $EDE5E0; HeaderActiveColor := $7BEEFF; HeaderActiveColorTo := $6CD0FF; SelectionColor := $6CD0FF; SelectionColorTo := $6CD0FF; end; esOffice2010Black: begin HeaderColor := $BFBFBF; HeaderColorTo := $919191; HeaderActiveColor := $7BEEFF; HeaderActiveColorTo := $6CD0FF; SelectionColor := $6CD0FF; SelectionColorTo := $6CD0FF; end; esWindows8: begin HeaderActiveColor := $F7F6F5; HeaderActiveColorTo := $F7F6F5; HeaderColor := $F7F6F5; HeaderColorTo := $F7F6F5; SelectionColor := $DAA026; SelectionColorTo := $DAA026; end; esOffice2013White: begin HeaderActiveColor := clWhite; HeaderActiveColorTo := clWhite; HeaderColor := clWhite; HeaderColorTo := clWhite; SelectionColor := $FF9933; SelectionColorTo := $FF9933; end; esOffice2013LightGray: begin HeaderActiveColor := $FAFAFA; HeaderActiveColorTo := $FAFAFA; HeaderColor := $FAFAFA; HeaderColorTo := $FAFAFA; SelectionColor := $FF9933; SelectionColorTo := $FF9933; end; esOffice2013Gray: begin HeaderActiveColor := $F3F3F3; HeaderActiveColorTo := $F3F3F3; HeaderColor := $F3F3F3; HeaderColorTo := $F3F3F3; SelectionColor := $FF9933; SelectionColorTo := $FF9933; end; end; end; procedure TCustomTodoList.ThemeAdapt; var eTheme: XPColorScheme; begin eTheme := CurrentXPTheme(); case eTheme of xpBlue: Look := esOffice2003Blue; xpGreen: Look := esOffice2003Olive; xpGray: Look := esOffice2003Silver; else Look := esOffice2003Classic; end; end; function TCustomToDoList.GetVersion: string; var vn: Integer; begin vn := GetVersionNr; Result := IntToStr(Hi(Hiword(vn)))+'.'+IntToStr(Lo(Hiword(vn)))+'.'+IntToStr(Hi(Loword(vn)))+'.'+IntToStr(Lo(Loword(vn))); end; procedure TCustomToDoList.SetVersion(const Value: string); begin end; procedure TCustomTodoList.SetTotalTimeSuffix(const Value: string); begin FTotalTimeSuffix := Value; FTodoListBox.TotalTimeSuffix := Value; end; { TProgressLook } procedure TProgressLook.Changed; begin if Assigned(FOnChange) then FOnChange(Self); end; constructor TProgressLook.Create; begin inherited; FCompleteColor := clRed; FCompleteFontColor := clBlue; FUnCompleteColor := clNone; FUnCompleteFontColor := clWindowText; FLevel0Color := clLime; FLevel0ColorTo := $00E1FFE1; FLevel1Color := clYellow; FLevel1ColorTo := $00CAFFFF; FLevel2Color := $0053A9FF; FLevel2ColorTo := $00A8D3FF; FLevel3Color := clRed; FLevel3ColorTo := $00CACAFF; FLevel1Perc := 70; FLevel2Perc := 90; FBorderColor := clBlack; FShowBorder := false; FStacked := false; FShowPercentage := true; FCompletionSmooth := true; FShowGradient := true; FSteps := 11; end; procedure TProgressLook.SetBorderColor(const Value: TColor); begin if FBorderColor <> Value then begin FBorderColor := Value; Changed; end; end; procedure TProgressLook.SetCompleteColor(const Value: TColor); begin if FCompleteColor <> Value then begin FCompleteColor := Value; Changed; end; end; procedure TProgressLook.SetCompleteFontColor(const Value: TColor); begin if FCompleteFontColor <> Value then begin FCompleteFontColor := Value; Changed; end; end; procedure TProgressLook.SetCompletionSmooth(const Value: Boolean); begin if FCompletionSmooth <> Value then begin FCompletionSmooth := Value; Changed; end; end; procedure TProgressLook.SetLevel0Color(const Value: TColor); begin if FLevel0Color <> Value then begin FLevel0Color := Value; Changed; end; end; procedure TProgressLook.SetLevel0ColorTo(const Value: TColor); begin if FLevel0ColorTo <> Value then begin FLevel0ColorTo := Value; Changed; end; end; procedure TProgressLook.SetLevel1Color(const Value: TColor); begin if FLevel1Color <> Value then begin FLevel1Color := Value; Changed; end; end; procedure TProgressLook.SetLevel1ColorTo(const Value: TColor); begin if FLevel1ColorTo <> Value then begin FLevel1ColorTo := Value; Changed; end; end; procedure TProgressLook.SetLevel1Perc(const Value: Integer); begin if FLevel1Perc <> Value then begin FLevel1Perc := Value; Changed; end; end; procedure TProgressLook.SetLevel2Color(const Value: TColor); begin if FLevel2Color <> Value then begin FLevel2Color := Value; Changed; end; end; procedure TProgressLook.SetLevel2ColorTo(const Value: TColor); begin if FLevel2ColorTo <> Value then begin FLevel2ColorTo := Value; Changed; end; end; procedure TProgressLook.SetLevel2Perc(const Value: Integer); begin if FLevel2Perc <> Value then begin FLevel2Perc := Value; Changed; end; end; procedure TProgressLook.SetLevel3Color(const Value: TColor); begin if FLevel3Color <> Value then begin FLevel3Color := Value; Changed; end; end; procedure TProgressLook.SetLevel3ColorTo(const Value: TColor); begin if FLevel3ColorTo <> Value then begin FLevel3ColorTo := Value; Changed; end; end; procedure TProgressLook.SetShowBorder(const Value: Boolean); begin if FShowBorder <> Value then begin FShowBorder := Value; Changed; end; end; procedure TProgressLook.SetShowGradient(const Value: Boolean); begin if FShowGradient <> Value then begin FShowGradient := Value; Changed; end; end; procedure TProgressLook.SetShowPercentage(const Value: Boolean); begin if FShowPercentage <> Value then begin FShowPercentage := Value; Changed; end; end; procedure TProgressLook.SetStacked(const Value: Boolean); begin if FStacked <> Value then begin FStacked := Value; Changed; end; end; procedure TProgressLook.SetSteps(const Value: Integer); begin if FSteps <> Value then begin FSteps := Value; Changed; end; end; procedure TProgressLook.SetUnCompleteColor(const Value: TColor); begin if FUnCompleteColor <> Value then begin FUnCompleteColor := Value; Changed; end; end; procedure TProgressLook.SetUnCompleteFontColor(const Value: TColor); begin if FUnCompleteFontColor <> Value then begin FUnCompleteFontColor := Value; Changed; end; end; procedure TTodoListBox.EditorOnExit(Sender: TObject); var Date: TDateTime; TodoData: TTodoData; begin if ActiveEditor = nil then Exit; { This event handler executes when an in-place editor component loses focus. The task of this event handler is to transfer the data to the TodoListBox, then to make the editor disappear. } if Assigned(EditedColumn) then TodoData := EditedColumn.TodoData else TodoData := tdNotes; if ActiveEditor = StringEditor then // string begin if TodoData = tdSubject then EditedItem.Subject := StringEditor.Text; if TodoData = tdResource then EditedItem.Resource := StringEditor.Text; if TodoData = tdProject then EditedItem.Project := StringEditor.Text; end {$IFDEF USE_PLANNERDATEPICKER} else if ActiveEditor = PlannerDateEditor then // date begin if (PlannerDateEditor.Text = '') then Date := 0 else Date := PlannerDateEditor.Calendar.Date; if TodoData = tdCompletionDate then EditedItem.CompletionDate := Date else if TodoData = tdCreationDate then EditedItem.CreationDate := Date else if TodoData = tdDueDate then EditedItem.DueDate := Date; end {$ENDIF} else if ActiveEditor = DefaultDateEditor then // date begin Date := DefaultDateEditor.Date; if TodoData = tdCompletionDate then EditedItem.CompletionDate := Date else if TodoData = tdCreationDate then EditedItem.CreationDate := Date else if TodoData = tdDueDate then EditedItem.DueDate := Date; end else if ActiveEditor = IntegerEditor then // integer begin { if TodoData = tdTotalTime then EditedItem.TotalTime := IntegerEditor.Value else if TodoData = tdCompletion then begin EditedItem.Completion := Min(Max(IntegerEditor.Value, 0), 100); EditedItem.Complete := EditedItem.Completion = 100; end; } end else if ActiveEditor = StringListEditor then // string list begin EditedItem.Notes.Text := StringListEditor.Lines.Text; end else if ActiveEditor = PriorityEditor then // priority begin if TodoData = tdPriority then EditedItem.Priority := FOwner.StringToPriority(PriorityEditor.Items[PriorityEditor.ItemIndex]); end else if ActiveEditor = StatusEditor then begin if TodoData = tdStatus then EditedItem.Status := FOwner.StringToStatus(StatusEditor.Items[StatusEditor.ItemIndex]); if ToDoData = tdCategory then begin if (StatusEditor.ItemIndex >= 0) and (StatusEditor.ItemIndex < StatusEditor.Items.Count) then EditedItem.Category := StatusEditor.Items[StatusEditor.ItemIndex] else EditedItem.Category := ''; end; end else if ActiveEditor = FNumericOnlyEditor then begin if TodoData = tdCompletion then begin EditedItem.Completion := Min(Max(strtoint(FNumericOnlyEditor.Text), 0), 100); EditedItem.Complete := EditedItem.Completion = 100; end; end else if ActiveEditor = FFloatEditor then begin EditedItem.TotalTime := FFloatEditor.FloatValue; //FFloatEditor.Value:=0; end; if ActiveEditor.Parent = EditorParent then ActiveEditor.Parent.Hide else ActiveEditor.Hide; ActiveEditor := nil; FOwner.EditDone(TodoData, EditedItem); if Assigned(FOwner.Parent) then begin // if FOwner.Parent.Visible then // SetFocus; end; end; constructor TInplaceListBox.Create(AOwner: TComponent); begin inherited; FMouseDown := False; FTodoList := TTodoListBox(AOwner); end; function TInplaceListBox.GetItemIndexEx: Integer; begin Result := inherited ItemIndex; end; procedure TInplaceListBox.SetItemIndexEx(const Value: Integer); begin FOldItemIndex := Value; inherited ItemIndex := Value; end; procedure TInplaceListBox.KeyPress(var Key: Char); begin inherited; if Key = #13 then begin if Assigned(FOnSelected) then FOnSelected(Self); FTodoList.AdvanceEdit; end; if Key = #27 then begin ItemIndex := FOldItemIndex; if Assigned(FOnSelected) then FOnSelected(Self); end; end; procedure TInplaceListBox.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin inherited; FMouseDown := True; end; procedure TInplaceListBox.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin inherited; if FMouseDown then if Assigned(FOnSelected) then FOnSelected(Self); FMouseDown := False; end; procedure TInplaceListBox.CMWantSpecialKey(var Msg: TCMWantSpecialKey); begin if Msg.CharCode = VK_TAB then begin PostMessage(Handle, WM_CHAR, ord(#13), 0); end; inherited; end; { TInplaceODListBox } constructor TInplaceODListBox.Create(AOwner: TComponent); begin inherited; Style := lbOwnerDrawFixed; FTodoList := TTodoListBox(AOwner); end; procedure TInplaceODListBox.DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState); begin Rect.Left := Rect.Left + 16; inherited DrawItem(Index, Rect, State); if Assigned(ImageList) then begin Rect.Left := Rect.Left - 16; if odSelected in State then Canvas.Brush.Color := clHighLight else Canvas.Brush.Color := clWindow; Canvas.Pen.Color := Canvas.Brush.Color; Canvas.Rectangle(Rect.Left, Rect.Top, Rect.Left + 16, Rect.Bottom); ImageList.DrawingStyle := dsTransparent; ImageList.Draw(Canvas, Rect.Left, Rect.Top, 4 - Index, True); end; end; { TInplaceEdit } constructor TInplaceEdit.Create(AOwner: TComponent); begin inherited; FTodoList := TTodoListBox(AOwner); FNumericOnly := false; end; procedure TInplaceEdit.CreateParams(var Params: TCreateParams); begin inherited; Params.Style := Params.Style or ES_MULTILINE; end; function TInplaceEdit.GetText: string; begin Result := inherited Text; end; procedure TInplaceEdit.KeyDown(var Key: Word; Shift: TShiftState); begin inherited; if Key = VK_F4 then DoExit; end; procedure TInplaceEdit.KeyPress(var Key: Char); begin inherited; if Key = #27 then begin Text := FOldText; DoExit; end; if FNumericOnly then begin if not ((IsNumChar(Key)) or (Key = chr(VK_BACK)) or (key = #13)) then Key := #0; //Exit; end; if Key = #13 then begin DoExit; FTodoList.AdvanceEdit; end; end; procedure TInplaceEdit.SetText(const Value: string); begin inherited Text := Value; FOldText := Value; end; procedure ComboBoxDropDown(ComboBoxHandle: THandle; Down: boolean = true); begin if Down then SendMessage(ComboBoxHandle, CB_SHOWDROPDOWN, 1, 0) else SendMessage(ComboBoxHandle, CB_SHOWDROPDOWN, 0, 0); end; procedure TTodoListBox.WMVScroll(var Message: TWMScroll); begin if ActiveEditor <> nil then EditorOnExit(Self); inherited; end; procedure SetFontButKeepFontColor(Destination, Source: TFont); var SaveColor: TColor; begin SaveColor := Destination.Color; Destination.Assign(Source); Destination.Color := SaveColor; end; procedure TTodoListBox.SetEditorFont(Editor: TWinControl; Font: TFont); begin if Editor = StatusEditor then SetFontButKeepFontColor(StatusEditor.Font, Font) else if Editor = PriorityEditor then SetFontButKeepFontColor(PriorityEditor.Font, Font) {$IFDEF USE_PLANNERDATEPICKER} else if Editor = PlannerDateEditor then SetFontButKeepFontColor(PlannerDateEditor.Font, Font) {$ENDIF} else if Editor = DefaultDateEditor then SetFontButKeepFontColor(DefaultDateEditor.Font, Font) else if Editor = IntegerEditor then SetFontButKeepFontColor(IntegerEditor.Font, Font) else if Editor = StringListEditor then SetFontButKeepFontColor(StringListEditor.Font, Font) else if Editor = StringEditor then SetFontButKeepFontColor(StringEditor.Font, Font); end; procedure SetControlRect(Control: TControl; Rect: TRect); begin Control.Top := Rect.Top; Control.Left := Rect.Left; Control.Width := Rect.Right - Rect.Left; Control.Height := Rect.Bottom - Rect.Top; end; procedure TTodoListBox.ShowEditor(Editor: TWinControl; R: TRect; UseSeparateParent: Boolean); begin ActiveEditor := Editor; if UseSeparateParent then begin // Empty the content of the form while EditorParent.ControlCount <> 0 do EditorParent.Controls[EditorParent.ControlCount - 1].Parent := nil; // Set size ActiveEditor.Parent := EditorParent; ActiveEditor.Left := 0; ActiveEditor.Top := 0; ActiveEditor.Width := R.Right - R.Left; ActiveEditor.Height := R.Bottom - R.Top; // Put the editor parent in the correct position R.TopLeft := ClientToScreen(R.TopLeft); R.BottomRight := ClientToScreen(R.BottomRight); {$IFDEF DELPHI9_LVL} SetControlRect(EditorParent, Rect(0,0,0,0)); {$ELSE} SetControlRect(EditorParent, R); {$ENDIF} end else begin ActiveEditor.Parent := Self; SetControlRect(ActiveEditor, R); end; SetEditorFont(ActiveEditor, EditedColumn.Font); ActiveEditor.Visible := True; if UseSeparateParent then EditorParent.Visible := True; {$IFDEF DELPHI9_LVL} SetControlRect(EditorParent, R); {$ENDIF} ActiveEditor.SetFocus; end; procedure PopulateListBoxEditor(ListBoxEditor: TListBox; CommaText: string); var R: TRect; begin { In the constructor, I create TListBox editors. For example, the PriorityEditor is of type TListBox, and it's parent is the TodoListBox. When I access the Items property of TListBox, TListBox checks to see if the final parent of the TListBox is a TCustomForm. It finds it is not (because the parent is not set yet), and raises an exception. That is why I use this workaround. } if ListBoxEditor.Tag = 0 then begin ListBoxEditor.Items.CommaText := CommaText; R := ListBoxEditor.ItemRect(ListBoxEditor.Items.Count - 1); ListBoxEditor.Tag := R.Bottom; end; ListBoxEditor.ClientHeight := ListBoxEditor.Tag; ListBoxEditor.Parent.Height := ListBoxEditor.Height; end; procedure TTodoListBox.SendClickMessage(Msg: TMessage; X, Y: Integer); var P: TPoint; MMsg: TWMLButtonDown absolute Msg; begin // Calculate screen coordinates // P.X := Message.XPos; // P.Y := Message.YPos; P := Point(X, Y); P := ClientToScreen(P); P := ActiveEditor.ScreenToClient(P); MMsg.XPos := P.X; MMsg.YPos := P.Y; // ActiveEditor.Perform(WM_LBUTTONDOWN, RawMessage.WParam, Msg.LParam); // ActiveEditor.Perform(WM_LBUTTONUP, RawMessage.WParam, Msg.LParam); ActiveEditor.Perform(WM_LBUTTONDOWN, Msg.WParam, Msg.LParam); ActiveEditor.Perform(WM_LBUTTONUP, Msg.WParam, Msg.LParam); end; procedure TTodoListBox.EditNotesInPreviewArea(Idx: Integer; R: TRect; Msg: TMessage; X, Y: Integer); begin EditedItem := TodoItems.Items[Idx]; if ActiveEditor <> nil then EditorOnExit(ActiveEditor); // ShowEditor function does not apply here, because of the possibility // that the "Notes" column might be missing ActiveEditor := StringListEditor; StringListEditor.Parent := FOwner; StringListEditor.BorderStyle := bsNone; with StringListEditor do begin SetFontButKeepFontColor(Font, TCustomTodoList(Self.Parent).PreviewFont); Lines.Assign(EditedItem.Notes); OrigLines.Assign(EditedItem.Notes); { Here I could substract the top border height and the left border width, in order to put the string list editor in the correct position. However, if the TodoList has left=0, this makes all components on the form shift to the right. So I have to adjust preview drawing in order to achieve the same effect. } Top := Self.Top + R.Top + Self.FOwner.ItemHeight + 1; Left := Self.Left + R.Left; Height := TCustomTodoList(Self.Parent).PreviewHeight; Width := R.Right - R.Left; Visible := True; SendClickMessage(Msg, X, Y); if FEditSelectAll then SelectAll; end; end; procedure TTodoListBox.AdvanceEdit; begin if (FFocusColumn < FOwner.Columns.Count) and FOwner.AutoAdvanceEdit then begin FFocusColumn := FFocusColumn + 1; FOwner.FTodoHeader.ActiveColumn := FFocusColumn; PostMessage(Self.Handle, WM_KEYDOWN, VK_F2, 0); end; end; procedure TTodoListBox.StartEdit(Index, Column: Integer; FromMouse: Boolean; Msg: TMessage; X, Y: Integer; ch: Char); var R: TRect; P: TPoint; NewCompletion: Integer; TodoData: TTodoData; OldIdx: Integer; maxLength: Integer; begin if not FOwner.Editable then Exit; if (Index < 0) or (Index >= Items.Count) then Exit; if Index <> ItemIndex then begin ItemIndex := Index; FOwner.ListSelect(Self); end; if (Column >= 0) and (Column < TodoColumns.Count) then begin if not TodoColumns.Items[Column].Editable then Exit; end else if not FOwner.Preview then Exit; FOwner.EditStart; ColItemRect(Column, Index, R); R.Bottom := R.Top + FOwner.ItemHeight; InflateRect(R, -1, -1); P := Point(X, Y); // If there is an active editor, if ActiveEditor <> nil then EditorOnExit(ActiveEditor); // Assign current column and item fields EditedColumn := nil; if (Column >= 0) and (Column < TodoColumns.Count) then begin EditedColumn := TodoColumns.Items[Column]; TodoData := EditedColumn.TodoData; maxLength := EditedColumn.MaxLength; end else begin TodoData := tdNotes; maxLength := 0; end; EditedItem := TodoItems.Items[Index]; StringEditor.MaxLength := maxLength; StringListEditor.MaxLength := maxLength; case TodoData of tdSubject: begin if ch <> #0 then StringEditor.Text := ch else StringEditor.Text := EditedItem.Subject; StringEditor.Font.Assign(TodoColumns.Items[Column].Font); ShowEditor(StringEditor, R, False); if FEditSelectAll and (ch = #0) then StringEditor.SelectAll // Select all the text in editor. This call may not be needed. else if FromMouse then SendClickMessage(Msg, X, Y) else StringEditor.SelStart := Length(StringEditor.Text); end; tdResource: begin if ch <> #0 then StringEditor.Text := ch else StringEditor.Text := EditedItem.Resource; StringEditor.Font.Assign(TodoColumns.Items[Column].Font); ShowEditor(StringEditor, R, False); if FEditSelectAll and (ch = #0) then StringEditor.SelectAll // Select all the text in editor. This call may not be needed. else if FromMouse then SendClickMessage(Msg, X, Y) else StringEditor.SelStart := Length(StringEditor.Text); end; tdProject: begin if ch <> #0 then StringEditor.Text := ch else StringEditor.Text := EditedItem.Project; StringEditor.Font.Assign(TodoColumns.Items[Column].Font); ShowEditor(StringEditor, R, False); if FEditSelectAll and (ch = #0) then StringEditor.SelectAll // Select all the text in editor. This call may not be needed. else if FromMouse then SendClickMessage(Msg, X, Y) else StringEditor.SelStart := Length(StringEditor.Text); end; tdNotes: if FOwner.Preview then begin StringListEditor.Font.Assign(PreviewFont); OldIdx := Index; ClickedOnNotes(False, P, Index, R); // Calculate correct rectangle EditNotesInPreviewArea(OldIdx, R, Msg, X, Y); end else begin ShowEditor(StringListEditor, R, True); StringListEditor.Font.Assign(TodoColumns.Items[Column].Font); StringListEditor.BorderStyle := bsSingle; StringListEditor.Lines.Assign(EditedItem.Notes); StringListEditor.OrigLines.Assign(EditedItem.Notes); if (StringListEditor.Lines.Text = '') and (ch <> #0) then begin StringListEditor.Lines.Text := ch; StringListEditor.SelStart := 1; end; StringListEditor.Height := StringListEditor.Width; EditorParent.Height := StringListEditor.Height; end; tdTotalTime: begin FFloatEditor.FloatValue := EditedItem.TotalTime; ShowEditor(FFloatEditor, R, False); FFloatEditor.Font.Assign(TodoColumns.Items[Column].Font); end; tdDueDate: begin {$IFDEF USE_PLANNERDATEPICKER} if TCustomTodoList(Parent).CalendarType = tcPlannerCalendar then begin PlannerDateEditor.Calendar.Date := EditedItem.DueDate; if (EditedItem.DueDate = 0) then PlannerDateEditor.Text := '' else PlannerDateEditor.Text := DateToStr(EditedItem.DueDate); PlannerDateEditor.BorderStyle := bsNone; ShowEditor(PlannerDateEditor, R, False); PlannerDateEditor.DropDown; end else begin {$ENDIF} if EditedItem.DueDate <> 0 then DefaultDateEditor.Date := EditedItem.DueDate else DefaultDateEditor.Date := Now; ShowEditor(DefaultDateEditor, R, False); DefaultDateEditor.Font.Assign(TodoColumns.Items[Column].Font); if FromMouse then SendClickMessage(Msg, X, Y); // ResendThisClickMessageToActiveEditor; {$IFDEF USE_PLANNERDATEPICKER} end; {$ENDIF} end; tdCompletionDate: begin {$IFDEF USE_PLANNERDATEPICKER} if TCustomTodoList(Parent).CalendarType = tcPlannerCalendar then begin PlannerDateEditor.Calendar.Date := Now; if EditedItem.CompletionDate = 0 then PlannerDateEditor.Text := '' else PlannerDateEditor.Text := DateToStr(EditedItem.CompletionDate); PlannerDateEditor.BorderStyle := bsNone; ShowEditor(PlannerDateEditor, R, False); PlannerDateEditor.DropDown; end else begin {$ENDIF} if (DefaultDateEditor.Date <> 0) and (EditedItem.CompletionDate <> 0) then DefaultDateEditor.Date := EditedItem.CompletionDate else DefaultDateEditor.Date := Now; ShowEditor(DefaultDateEditor, R, False); DefaultDateEditor.Font.Assign(TodoColumns.Items[Column].Font); {$IFDEF USE_PLANNERDATEPICKER} end; {$ENDIF} end; tdCreationDate: begin {$IFDEF USE_PLANNERDATEPICKER} if TCustomTodoList(Parent).CalendarType = tcPlannerCalendar then begin PlannerDateEditor.Calendar.Date := EditedItem.CreationDate; if EditedItem.CreationDate = 0 then PlannerDateEditor.Text := '' else PlannerDateEditor.Text := DateToStr(EditedItem.CreationDate); PlannerDateEditor.BorderStyle := bsNone; ShowEditor(PlannerDateEditor, R, False); PlannerDateEditor.DropDown; end else begin {$ENDIF} if EditedItem.CreationDate <> 0 then DefaultDateEditor.Date := EditedItem.CreationDate else DefaultDateEditor.Date := Now; ShowEditor(DefaultDateEditor, R, False); DefaultDateEditor.Font.Assign(TodoColumns.Items[Column].Font); ComboBoxDropDown(DefaultDateEditor.Handle); {$IFDEF USE_PLANNERDATEPICKER} end; {$ENDIF} end; tdPriority: begin if (TCustomTodoList(Parent).FPriorityListWidth > 0) then R.Right := R.Left + TCustomTodoList(Parent).FPriorityListWidth; ShowEditor(PriorityEditor, R, True); PopulateListBoxEditor(PriorityEditor, FOwner.PriorityCommaText); // must be always called after ShowEditor PriorityEditor.ItemIndex := PriorityEditor.Items.IndexOf(FOwner.PriorityToString(EditedItem.Priority)); PriorityEditor.Ctl3D := False; PriorityEditor.Font.Assign(TodoColumns.Items[Column].Font); PriorityEditor.ImageList := FPriorityImageList; end; tdStatus: begin if (TCustomTodoList(Parent).FStatusListWidth > 0) then R.Right := R.Left + TCustomTodoList(Parent).FStatusListWidth; ShowEditor(StatusEditor, R, True); StatusEditor.Tag := 0; PopulateListBoxEditor(StatusEditor, FOwner.StatusCommaText); StatusEditor.ItemIndex := StatusEditor.Items.IndexOf(FOwner.StatusToString(EditedItem.Status)); StatusEditor.Font.Assign(TodoColumns.Items[Column].Font); StatusEditor.Ctl3D := False; end; tdCategory: begin if (TCustomTodoList(Parent).FStatusListWidth > 0) then R.Right := R.Left + TCustomTodoList(Parent).FStatusListWidth; ShowEditor(StatusEditor, R, True); StatusEditor.Tag := 0; PopulateListBoxEditor(StatusEditor, FOwner.Category.CommaText); StatusEditor.ItemIndex := StatusEditor.Items.IndexOf(EditedItem.Category); StatusEditor.Font.Assign(TodoColumns.Items[Column].Font); StatusEditor.Ctl3D := False; end; // Items which don't have a specialized editor tdComplete: begin TodoItems.Items[Index].Complete := not TodoItems.Items[Index].Complete; FOwner.CompleteClick(Index); FOwner.EditDone(TodoData, TodoItems.Items[Index]); end; tdCompletion: if FOwner.CompletionGraphic then begin if FromMouse then begin if (X < R.Right - 1) then begin NewCompletion := 100 * (X - R.Left) div (R.Right - R.Left - 2); TodoItems.Items[Index].Complete := NewCompletion = 100; TodoItems.Items[Index].Completion := NewCompletion; if NewCompletion = 100 then FOwner.CompleteClick(Index); FOwner.EditDone(TodoData, TodoItems.Items[Index]); end; end else begin FNumericOnlyEditor.Text := inttostr(TodoItems.Items[Index].Completion); FNumericOnlyEditor.Font.Assign(TodoColumns.Items[Column].Font); R.Top := R.Top + 1; R.Bottom := R.Bottom - 1; ShowEditor(FNumericOnlyEditor, R, False); if FEditSelectAll and (ch = #0) then FNumericOnlyEditor.SelectAll // Select all the text in editor. This call may not be needed. else if FromMouse then SendClickMessage(Msg, X, Y) else FNumericOnlyEditor.SelStart := Length(FNumericOnlyEditor.Text); R.Top := R.Top - 2; R.Bottom := R.Bottom + 2; end; end else begin IntegerEditor.Value := EditedItem.Completion; ShowEditor(IntegerEditor, R, False); IntegerEditor.Font.Assign(TodoColumns.Items[Column].Font); end; end; end; procedure TTodoListBox.RepaintItem(Index: Integer); var r: TRect; begin SendMessage(Handle, LB_GETITEMRECT, Index, longint(@r)); InvalidateRect(Handle, @r, False); end; procedure TTodoListBox.SetHorizontalScrollBar; begin UpdateHScrollExtent(0); end; procedure TTodoListBox.DrawGrid(ACanvas: TCanvas); var lb: TLogBrush; x,y, Col, w: Integer; HPen, HOldPen: THandle; begin if (FGridLines = glsAlways) then begin if FScrollHorizontal then w := SendMessage(Handle, LB_GETHORIZONTALEXTENT,0,0) else w := Width; lb.lbColor := ColorToRGB(FGridLineColor); lb.lbStyle := bs_Solid; HPen := ExtCreatePen(PS_COSMETIC or PS_ALTERNATE,1,lb,0,nil); HOldPen := SelectObject(ACanvas.Handle, HPen); y := ItemHeight; while (y < Height) do begin Windows.MoveToEx(ACanvas.Handle, 0, y - 1,nil); Windows.LineTo(ACanvas.Handle, w, y - 1); y := y + ItemHeight; end; if not Preview then begin if FScrollHorizontal then x := - GetScrollPos(Handle, SB_HORZ) else x := 0; for Col := 1 to FTodoColumns.Count - 1 do begin x := x + FTodoColumns.Items[Col - 1].Width; Windows.MoveToEx(ACanvas.Handle, x, 0,nil); Windows.LineTo(ACanvas.Handle, x, Height); end; end; DeleteObject(SelectObject(ACanvas.Handle,HOldPen)); end; end; { procedure TTodoListBox.WMPaint(var Message: TWMPaint); begin inherited; DrawGrid; end; procedure TTodoListBox.WMEraseBkGnd(var Message: TWMEraseBkGnd); begin message.Result := 0; end; } procedure TTodoListBox.WMLButtonUp(var Message: TWMLButtonDown); var R: TRect; P: TPoint; EditedColIdx, EditedItemIdx: Integer; RawMessage: TMessage absolute Message; begin if FMouseDownNotDone then begin if FOwner.DragMode = dmAutomatic then EndDrag(False); inherited; Exit; end; if not FEditable then begin inherited; Exit; end; P.X := Message.XPos; P.Y := Message.YPos; if XYToColItem(P.X, P.Y, EditedColIdx, EditedItemIdx, R) and (EditedItemIdx < TodoItems.Count) then begin if FFocusColumn <> EditedColIdx then begin FFocusColumn := EditedColIdx; FOwner.FTodoHeader.ActiveColumn := FFocusColumn; RepaintItem(EditedItemIdx); end; if not TodoColumns.Items[EditedColIdx].Editable then begin inherited; Exit; end; if FOwner.DragMode = dmAutomatic then EndDrag(False); inherited; if Message.Keys <> 8 then StartEdit(EditedItemIdx, EditedColIdx, True, RawMessage, Message.XPos, Message.YPos, #0); end else inherited; if FOwner.Preview and ClickedOnNotes(True, P, EditedItemIdx, R) then begin if FOwner.DragMode = dmAutomatic then EndDrag(False); EditNotesInPreviewArea(EditedItemIdx, R, RawMessage, Message.XPos, Message.YPos); end; end; { Even if the result is false, it calculates the preview rectangle of the clicked item. } function TTodoListBox.ClickedOnNotes(const CalcItem: Boolean; const P: TPoint; out ItemIdx: Integer; out R: TRect): Boolean; var TopBorderWidth, LeftBorderWidth, RightBorderWidth, BottomBorderWidth: integer; begin if CalcItem then ItemIdx := ItemAtPos(P, True); if ItemIdx = -1 then Result := False else begin SendMessage(Handle, LB_GETITEMRECT, ItemIdx, Longint(@R)); Result := (P.Y > R.Top + FOwner.ItemHeight) and (P.Y < R.Bottom); // Take into account listbox border width WinControlBorderWidths(self, LeftBorderWidth, RightBorderWidth, TopBorderWidth, BottomBorderWidth); R.Top := R.Top + TopBorderWidth; R.Bottom := R.Bottom + TopBorderWidth; R.Left := R.Left + LeftBorderWidth; R.Right := R.Right + LeftBorderWidth; end end; procedure TTodoListBox.SetPreviewColor(const Value: TColor); begin FPreviewColor := Value; Invalidate; end; procedure TTodoListBox.SetPreviewColorTo(const Value: TColor); begin FPreviewColorTo := Value; Invalidate; end; { TStatusStrings } constructor TStatusStrings.Create(AOwner: TCustomTodoList); begin inherited Create; FOwner := AOwner; FStatusStrings[tsDeferred] := 'Deferred'; FStatusStrings[tsNotStarted] := 'Not started'; FStatusStrings[tsCompleted] := 'Completed'; FStatusStrings[tsInProgress] := 'In progress'; end; function TStatusStrings.GetString(Index: TTodoStatus): string; begin Result := FStatusStrings[Index]; end; function TStatusStrings.GetStringC: string; begin Result := FStatusStrings[tsCompleted]; end; function TStatusStrings.GetStringD: string; begin Result := FStatusStrings[tsDeferred]; end; function TStatusStrings.GetStringI: string; begin Result := FStatusStrings[tsInProgress]; end; function TStatusStrings.GetStringN: string; begin Result := FStatusStrings[tsNotStarted]; end; procedure TStatusStrings.SetString(Index: TTodoStatus; const Value: string); begin FStatusStrings[Index] := Value; FOwner.Invalidate; end; procedure TStatusStrings.SetStringC(const Value: string); begin FStatusStrings[tsCompleted] := Value; FOwner.Invalidate; end; procedure TStatusStrings.SetStringD(const Value: string); begin FStatusStrings[tsDeferred] := Value; FOwner.Invalidate; end; procedure TStatusStrings.SetStringI(const Value: string); begin FStatusStrings[tsInProgress] := Value; FOwner.Invalidate; end; procedure TStatusStrings.SetStringN(const Value: string); begin FStatusStrings[tsNotStarted] := Value; FOwner.Invalidate; end; { TPriorityStrings } constructor TPriorityStrings.Create(AOwner: TCustomTodoList); begin inherited Create; FOwner := AOwner; FPriorityStrings[tpLowest] := 'Lowest'; FPriorityStrings[tpLow] := 'Low'; FPriorityStrings[tpNormal] := 'Normal'; FPriorityStrings[tpHigh] := 'High'; FPriorityStrings[tpHighest] := 'Highest'; end; function TPriorityStrings.GetString(Index: TTodoPriority): string; begin Result := FPriorityStrings[Index]; end; function TPriorityStrings.GetStringH: string; begin Result := FPriorityStrings[tpHigh]; end; function TPriorityStrings.GetStringHS: string; begin Result := FPriorityStrings[tpHighest]; end; function TPriorityStrings.GetStringL: string; begin Result := FPriorityStrings[tpLow]; end; function TPriorityStrings.GetStringLS: string; begin Result := FPriorityStrings[tpLowest]; end; function TPriorityStrings.GetStringN: string; begin Result := FPriorityStrings[tpNormal]; end; procedure TPriorityStrings.SetString(Index: TTodoPriority; const Value: string); begin FPriorityStrings[Index] := Value; FOwner.Invalidate; end; procedure TPriorityStrings.SetStringH(const Value: string); begin FPriorityStrings[tpHigh] := Value; FOwner.Invalidate; end; procedure TPriorityStrings.SetStringHS(const Value: string); begin FPriorityStrings[tpHighest] := Value; FOwner.Invalidate; end; procedure TPriorityStrings.SetStringL(const Value: string); begin FPriorityStrings[tpLow] := Value; FOwner.Invalidate; end; procedure TPriorityStrings.SetStringLS(const Value: string); begin FPriorityStrings[tpLowest] := Value; FOwner.Invalidate; end; procedure TPriorityStrings.SetStringN(const Value: string); begin FPriorityStrings[tpNormal] := Value; FOwner.Invalidate; end; { TEditColors } constructor TEditColors.Create(AOwner: TCustomTodoList); begin inherited Create; FOwner := AOwner; FStringEditor := TBackForeColors.Create(Self, FOwner.FTodoListBox.StringEditor); FMemoEditor := TBackForeColors.Create(Self, FOwner.FTodoListBox.StringListEditor); FIntegerEditor := TBackForeColors.Create(Self, FOwner.FTodoListBox.IntegerEditor); FPriorityEditor := TBackForeColors.Create(Self, FOwner.FTodoListBox.PriorityEditor); FStatusEditor := TBackForeColors.Create(Self, FOwner.FTodoListBox.StatusEditor); {$IFDEF USE_PLANNERDATEPICKER} FPlannerDateEditor := TPlannerDatePickerColors.Create(Self, TPlannerDatePicker(FOwner.FTodoListBox.PlannerDateEditor)); {$ENDIF} FDefaultDateEditor := TDatePickerColors.Create(Self, TTodoDateTimePicker(FOwner.FTodoListBox.DefaultDateEditor)); end; destructor TEditColors.Destroy; begin FStringEditor.Free; FMemoEditor.Free; FIntegerEditor.Free; FPriorityEditor.Free; FStatusEditor.Free; {$IFDEF USE_PLANNERDATEPICKER} FPlannerDateEditor.Free; {$ENDIF} FDefaultDateEditor.Free; inherited; end; { TBackForeColors } constructor TBackForeColors.Create(AOwner: TEditColors; AColorControl: TWinControl); begin inherited Create; FOwner := AOwner; FColorControl := AColorControl; end; function TBackForeColors.GetBackColor: TColor; begin if FColorControl is TInPlaceEdit then Result := TInPlaceEdit(FColorControl).Color else if FColorControl is TInplaceMemo then Result := TInplaceMemo(FColorControl).Color else if FColorControl is TSpinEdit then Result := TSpinEdit(FColorControl).Color else if FColorControl is TInPlaceODListBox then Result := TInPlaceODListBox(FColorControl).Color else if FColorControl is TInPlaceListBox then Result := TInPlaceListBox(FColorControl).Color else raise Exception.Create('TEditColors.GetBackColor: unknown control class.'); end; function TBackForeColors.GetFontColor: TColor; begin if FColorControl is TInPlaceEdit then Result := TInPlaceEdit(FColorControl).Font.Color else if FColorControl is TInplaceMemo then Result := TInplaceMemo(FColorControl).Font.Color else if FColorControl is TSpinEdit then Result := TSpinEdit(FColorControl).Font.Color else if FColorControl is TInPlaceODListBox then Result := TInPlaceODListBox(FColorControl).Font.Color else if FColorControl is TInPlaceListBox then Result := TInPlaceListBox(FColorControl).Font.Color else raise Exception.Create('TEditColors.GetFontColor: unknown control class.'); end; procedure TBackForeColors.SetBackColor(const Value: TColor); begin if FColorControl is TInPlaceEdit then TInPlaceEdit(FColorControl).Color := Value else if FColorControl is TInplaceMemo then TInplaceMemo(FColorControl).Color := Value else if FColorControl is TSpinEdit then TSpinEdit(FColorControl).Color := Value else if FColorControl is TInPlaceODListBox then TInPlaceODListBox(FColorControl).Color := Value else if FColorControl is TInPlaceListBox then TInPlaceListBox(FColorControl).Color := Value else raise Exception.Create('TEditColors.SetBackColor: unknown control class.'); end; procedure TBackForeColors.SetFontColor(const Value: TColor); begin if FColorControl is TInPlaceEdit then TInPlaceEdit(FColorControl).Font.Color := Value else if FColorControl is TInplaceMemo then TInplaceMemo(FColorControl).Font.Color := Value else if FColorControl is TSpinEdit then TSpinEdit(FColorControl).Font.Color := Value else if FColorControl is TInPlaceODListBox then TInPlaceODListBox(FColorControl).Font.Color := Value else if FColorControl is TInPlaceListBox then TInPlaceListBox(FColorControl).Font.Color := Value else raise Exception.Create('TEditColors.SetFontColor: unknown control class.'); end; { TDatePickerColors } constructor TDatePickerColors.Create(AOwner: TEditColors; AColorControl: TTodoDateTimePicker); begin inherited Create; FOwner := AOwner; FColorControl := AColorControl; end; function TDatePickerColors.GetBackColor: TColor; begin Result := FColorControl.Color; end; function TDatePickerColors.GetCalColors: TMonthCalColors; begin Result := FColorControl.CalColors; end; function TDatePickerColors.GetFontColor: TColor; begin Result := FColorControl.Font.Color; end; procedure TDatePickerColors.SetBackColor(const Value: TColor); begin FColorControl.Color := Value; end; procedure TDatePickerColors.SetCalColors(const Value: TMonthCalColors); begin FColorControl.CalColors.Assign(Value); end; procedure TDatePickerColors.SetFontColor(const Value: TColor); begin FColorControl.Font.Color := Value; end; {$IFDEF USE_PLANNERDATEPICKER} { TPlannerDatePickerColors } constructor TPlannerDatePickerColors.Create(AOwner: TEditColors; AColorControl: TPlannerDatePicker); begin inherited Create; FOwner := AOwner; FColorControl := AColorControl; FCalendarColors := TCalendarColors.Create(Self); end; function TPlannerDatePickerColors.GetBackColor: TColor; begin Result := FColorControl.Color; end; function TPlannerDatePickerColors.GetFontColor: TColor; begin Result := FColorControl.Font.Color; end; procedure TPlannerDatePickerColors.SetBackColor(const Value: TColor); begin FColorControl.Color := Value; end; procedure TPlannerDatePickerColors.SetFontColor(const Value: TColor); begin FColorControl.Font.Color := Value; end; destructor TPlannerDatePickerColors.Destroy; begin FCalendarColors.Free; inherited; end; constructor TCalendarColors.Create(AOwner: TPlannerDatePickerColors); begin inherited Create; FOwner := AOwner; end; function TCalendarColors.GetColor: TColor; begin Result := FOwner.FColorControl.Calendar.Color; end; function TCalendarColors.GetEventDayColor: TColor; begin Result := FOwner.FColorControl.Calendar.EventDayColor; end; function TCalendarColors.GetEventMarkerColor: TColor; begin Result := FOwner.FColorControl.Calendar.EventMarkerColor; end; function TCalendarColors.GetFocusColor: TColor; begin Result := FOwner.FColorControl.Calendar.FocusColor; end; function TCalendarColors.GetGradientDirection: TGradientDirection; begin Result := FOwner.FColorControl.Calendar.GradientDirection; end; function TCalendarColors.GetGradientEndColor: TColor; begin Result := FOwner.FColorControl.Calendar.GradientEndColor; end; function TCalendarColors.GetGradientStartColor: TColor; begin Result := FOwner.FColorControl.Calendar.GradientStartColor; end; function TCalendarColors.GetHeaderColor: TColor; begin Result := FOwner.FColorControl.Calendar.HeaderColor; end; function TCalendarColors.GetInactiveColor: TColor; begin Result := FOwner.FColorControl.Calendar.InactiveColor; end; function TCalendarColors.GetSelectColor: TColor; begin Result := FOwner.FColorControl.Calendar.SelectColor; end; function TCalendarColors.GetSelectFontColor: TColor; begin Result := FOwner.FColorControl.Calendar.SelectFontColor; end; function TCalendarColors.GetTextColor: TColor; begin Result := FOwner.FColorControl.Calendar.TextColor; end; function TCalendarColors.GetWeekendColor: TColor; begin Result := FOwner.FColorControl.Calendar.WeekendColor; end; procedure TCalendarColors.SetColor(const Value: TColor); begin FOwner.FColorControl.Calendar.Color := Value; end; procedure TCalendarColors.SetEventDayColor(const Value: TColor); begin FOwner.FColorControl.Calendar.EventDayColor := Value; end; procedure TCalendarColors.SetEventMarkerColor(const Value: TColor); begin FOwner.FColorControl.Calendar.EventMarkerColor := Value; end; procedure TCalendarColors.SetFocusColor(const Value: TColor); begin FOwner.FColorControl.Calendar.FocusColor := Value; end; procedure TCalendarColors.SetGradientDirection( const Value: TGradientDirection); begin FOwner.FColorControl.Calendar.GradientDirection := Value; end; procedure TCalendarColors.SetGradientEndColor(const Value: TColor); begin FOwner.FColorControl.Calendar.GradientEndColor := Value; end; procedure TCalendarColors.SetGradientStartColor(const Value: TColor); begin FOwner.FColorControl.Calendar.GradientStartColor := Value; end; procedure TCalendarColors.SetHeaderColor(const Value: TColor); begin FOwner.FColorControl.Calendar.HeaderColor := Value; end; procedure TCalendarColors.SetInactiveColor(const Value: TColor); begin FOwner.FColorControl.Calendar.InactiveColor := Value; end; procedure TCalendarColors.SetSelectColor(const Value: TColor); begin FOwner.FColorControl.Calendar.SelectColor := Value; end; procedure TCalendarColors.SetSelectFontColor(const Value: TColor); begin FOwner.FColorControl.Calendar.SelectFontColor := Value; end; procedure TCalendarColors.SetTextColor(const Value: TColor); begin FOwner.FColorControl.Calendar.TextColor := Value; end; procedure TCalendarColors.SetWeekendColor(const Value: TColor); begin FOwner.FColorControl.Calendar.WeekendColor := Value; end; {$ENDIF} { TCompleteCheck } procedure TCompleteCheck.Changed; begin if Assigned(FOnChange) then FOnChange(Self); end; constructor TCompleteCheck.Create; begin FCompletedGlyph := TBitmap.Create; FUnCompletedGlyph := TBitmap.Create; end; destructor TCompleteCheck.Destroy; begin FCompletedGlyph.Free; FUnCompletedGlyph.Free; inherited; end; procedure TCompleteCheck.SetCheckType(const Value: TCheckType); begin FCheckType := Value; Changed; end; procedure TCompleteCheck.SetCompletedGlyph(const Value: TBitmap); begin FCompletedGlyph.Assign(Value); Changed; end; procedure TCompleteCheck.SetUnCompletedGlyph(const Value: TBitmap); begin FUnCompletedGlyph.Assign(Value); Changed; end; { TTodoDateTimePicker } procedure TTodoDateTimePicker.KeyDown(var Key: Word; Shift: TShiftState); begin if Key = VK_RETURN then Parent.SetFocus; if Key = VK_TAB then begin PostMessage(Handle, WM_KEYDOWN, ord(#27), 0); end; inherited; end; { TInplaceMemo } procedure TInplaceMemo.CMWantSpecialKey(var Msg: TCMWantSpecialKey); begin if Msg.CharCode = VK_ESCAPE then begin Lines.Assign(FOldText); DoExit; end; if Msg.CharCode = VK_TAB then begin PostMessage(Handle, WM_CHAR, ord(#27), 0); end; inherited; end; constructor TInplaceMemo.Create(AOwner: TComponent); begin inherited; FTodoList := TTodoListBox(AOwner); FOldText := TStringList.Create; end; destructor TInplaceMemo.Destroy; begin FOldText.Free; inherited; end; procedure TInplaceMemo.KeyDown(var Key: Word; Shift: TShiftState); begin inherited; if Key = VK_F4 then DoExit; end; procedure TInplaceMemo.KeyPress(var Key: Char); begin inherited; if Key = #27 then begin DoExit; FTodoList.AdvanceEdit; end; end; procedure TTodoListBox.CMHintShow(var M: TCMHintShow); var ColIdx, ItemIdx: Integer; R: TRect; Text: string; Canvas: TCanvas; begin if not FOwner.HintShowFullText then begin inherited; Exit; end; // get the item underneath the mouse cursor if XYToColItem(M.HintInfo.CursorPos.X, M.HintInfo.CursorPos.Y, ColIdx, ItemIdx, R) and (ItemIdx < TodoItems.Count) then begin // fetch the text that should appear untrimmed in the column Text := ''; with TodoItems.Items[ItemIdx] do case TodoColumns.Items[ColIdx].TodoData of tdSubject: Text := Subject; tdCompletion: if not FOwner.CompletionGraphic then Text := IntToStr(Completion); tdNotes: if not FOwner.Preview then Text := Notes.Text; tdPriority: Text := FOwner.PriorityToString(Priority); tdDueDate: Text := FormatDateTime(FDateFormat, DueDate); tdStatus: Text := FOwner.StatusStrings[Status]; tdTotalTime: Text := FloatToStr(TotalTime) + FTotalTimeSuffix; tdCompletionDate: Text := FormatDateTime(FDateFormat, CompletionDate); tdCreationDate: Text := FormatDateTime(FDateFormat, CreationDate); tdResource: Text := Resource; tdProject: Text := Project; tdCategory: Text := Category; end; // see if the text fits the column, and if not, show the hint if Length(Trim(Text)) > 0 then with M.HintInfo^ do begin Canvas := TCanvas.Create; Canvas.Handle := GetDC(0); try Canvas.Font := TodoColumns.Items[ColIdx].Font; if Canvas.TextWidth(Text) > R.Right - R.Left then begin HintStr := Text; R.TopLeft := ClientToScreen(R.TopLeft); R.BottomRight := ClientToScreen(R.BottomRight); HintPos.Y := R.Top; HintPos.X := R.Left; CursorRect := R; HintMaxWidth := FOwner.ClientWidth; end; finally ReleaseDC(0, Canvas.Handle); Canvas.Free; end; end; end; end; procedure TTodoListBox.CMWantSpecialKey(var Msg: TCMWantSpecialKey); begin inherited; if (Msg.CharCode = VK_TAB) and (FUseTab) then Msg.Result := 1; end; { TInplaceSpinEdit } constructor TInplaceSpinEdit.Create(AOwner: TComponent); begin inherited; FTodoList := TTodoListBox(AOwner); end; procedure TInplaceSpinEdit.WMChar(var Msg: TWMChar); begin if Msg.CharCode = VK_RETURN then Msg.CharCode := 0; inherited; end; procedure TInplaceSpinEdit.WMKeyDown(var Msg: TWMKeydown); begin if Msg.CharCode = VK_RETURN then begin DoExit; FTodoList.AdvanceEdit; Msg.CharCode := 0; end; inherited; end; procedure TTodoListBox.WMLButtonDown(var Message: TWMLButtonDown); var ColIdx, ItemIdx: Integer; R: TRect; begin FMouseDownNotDone := true; XYToColItem(Message.XPos , Message.YPos, ColIdx, ItemIdx, R); if (ItemIdx >= 0) and (ColIdx >= 0) and (ColIdx < FOwner.Columns.Count) then begin if FOwner.Columns[ColIdx].TodoData = tdHandle then FMouseDownNotDone := false; end; inherited; FMouseDownNotDone := false; // DrawGrid; end; { TInplaceFloatSpinEdit } constructor TInplaceFloatSpinEdit.Create(AOwner: TComponent); begin inherited; ControlStyle := ControlStyle - [csSetCaption]; FTodoList := TTodoListBox(AOwner); FUpDownBtns := TSpinSpeedButtons.Create(Self); FUpDownBtns.Visible := True; FUpDownBtns.Parent := Self; FUpDownBtns.OnUpBtnClick := UpClick; FUpDownBtns.OnDownBtnClick := DownClick; FIncrementFloat := 1.0; Text := '0'; FDecSep := DecimalSeparator; end; destructor TInplaceFloatSpinEdit.destroy; begin FUpDownBtns.Free; inherited; end; function TInplaceFloatSpinEdit.GetFloatValue: double; begin try Result := StrToFloat(Text); except Result := 0; end; end; function TInplaceFloatSpinEdit.IsValidChar(var Key: Char): Boolean; begin // Result := (Key = '.' {DecimalSeparator}) or (Key in ['+', '-', '0'..'9']) or ((Key < #32) and (Key <> Chr(VK_RETURN))); Result := (Key = FDecSep) or (IsNumChar(Key)) or (Key = '+') or (Key = '-') or ((Key < #32) and (Key <> Chr(VK_RETURN))); (* if (FSpinType = sptFloat) and not (key in [chr(vk_escape),chr(vk_return),chr(vk_back)]) then begin if (key = ThousandSeparator) then key := DateSeparator; *) // if (key = '.' {DecimalSeparator}) and ((Pos('.' {DecimalSeparator}, self.Text) > 0) { or (FPrecision = 0)}) then // Result := False; if (key = FDecSep) and ((Pos(FDecSep, self.Text) > 0) { or (FPrecision = 0)}) then Result := False; (* dp := Pos(DecimalSeparator,self.Text); if (FPrecision > 0) and (dp > 0) and (selstart >= dp) and (sellength = 0) then begin if (Length(self.Text) >= dp + FPrecision) then Result := False; end; end; *) end; procedure TInplaceFloatSpinEdit.KeyPress(var Key: Char); begin if not IsValidChar(Key) then begin Key := #0; MessageBeep(0); end; if Key <> #0 then inherited KeyPress(Key); end; procedure TInplaceFloatSpinEdit.SetFloatValue(const Value: double); begin if FPrecision < 0 then Text := FloatToStrF(Value, ffGeneral, 4, 4) else if FPrecision = 0 then Text := FloatToStr(Value) else Text := FloatToStrF(Value, ffFixed, 15, FPrecision); end; procedure TInplaceFloatSpinEdit.SetPrecision(const Value: integer); begin FPrecision := Value; FloatValue := GetFloatValue; end; procedure TInplaceFloatSpinEdit.UpClick(Sender: TObject); begin FloatValue := FloatValue + FIncrementFloat; end; procedure TInplaceFloatSpinEdit.DownClick(Sender: TObject); begin FloatValue := FloatValue - FIncrementFloat; end; procedure TInplaceFloatSpinEdit.WMChar(var Msg: TWMChar); begin if Msg.CharCode = VK_RETURN then Msg.CharCode := 0; inherited; end; procedure TInplaceFloatSpinEdit.WMKeyDown(var Msg: TWMKeydown); begin if Msg.CharCode = VK_RETURN then begin DoExit; FTodoList.AdvanceEdit; Msg.CharCode := 0; end; case Msg.CharCode of VK_UP: begin UpClick(self); end; VK_DOWN: begin DownClick(self); end; end; inherited; end; procedure TInplaceFloatSpinEdit.WMSize(var Message: TWMSize); begin inherited; if (FUpDownBtns <> nil) then FUpDownBtns.SetBounds(Width - FUpDownBtns.Width - 5, 0, FUpDownBtns.Width, Height - 2); SetEditRect; end; procedure TInplaceFloatSpinEdit.SetEditRect; var Loc: TRect; Dist: integer; begin if BorderStyle = bsNone then Dist := 2 else Dist := 0; SendMessage(Handle, EM_GETRECT, 0, LongInt(@Loc)); Loc.Bottom := ClientHeight + 1; {+1 is workaround for windows paint bug} Loc.Right := ClientWidth - FUpDownBtns.Width - 2 - Dist; Loc.Top := Dist; Loc.Left := Dist; SendMessage(Handle, EM_SETRECTNP, 0, LongInt(@Loc)); SendMessage(Handle, EM_GETRECT, 0, LongInt(@Loc)); end; procedure TInplaceFloatSpinEdit.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); Params.Style := Params.Style or ES_MULTILINE or WS_CLIPCHILDREN; end; procedure TInplaceFloatSpinEdit.CreateWnd; begin inherited CreateWnd; SetEditRect; end; { TSpinSpeedButton } constructor TSpinSpeedButtons.create(aOwner: TComponent); begin inherited Create(AOwner); //ControlStyle := ControlStyle - [csAcceptsControls, csSetCaption] + // [csFramed, csOpaque]; FUpButton := {TSpeedButton} TTimerSpinButton.Create(self); FUpButton.OnClick := UpBtnClick; FUpButton.Glyph.Handle := LoadBitmap(HInstance, 'SPINUPBTN'); FUpButton.NumGlyphs := 1; FUpButton.Visible := True; FUpButton.Enabled := True; FUpButton.Parent := Self; FUpButton.Height := 12; FUpButton.width := 15; FDownButton := {TSpeedButton} TTimerSpinButton.Create(self); FDownButton.OnClick := DownBtnClick; FDownButton.Glyph.Handle := LoadBitmap(HInstance, 'SPINDOWNBTN'); FUpButton.NumGlyphs := 1; FDownButton.Visible := True; FDownButton.Enabled := True; FDownButton.Parent := Self; FDownButton.Height := 12; FDownButton.Width := 15; Width := 15; Height := 25; end; procedure TSpinSpeedButtons.AdjustSize(var W, H: Integer); begin if (FUpButton = nil) or (csLoading in ComponentState) then Exit; if W < 15 then W := 15; FUpButton.SetBounds(0, 0, W, H div 2); FDownButton.SetBounds(0, FUpButton.Height - 1, W, H - FUpButton.Height); end; procedure TSpinSpeedButtons.WMSize(var Message: TWMSize); var W, H: Integer; begin inherited; { check for minimum size } W := Width; H := Height; AdjustSize(W, H); if (W <> Width) or (H <> Height) then inherited SetBounds(Left, Top, W, H); Message.Result := 0; end; procedure TSpinSpeedButtons.SetBounds(ALeft, ATop, AWidth, AHeight: Integer); var W, H: Integer; begin W := AWidth; H := AHeight; AdjustSize(W, H); inherited SetBounds(ALeft, ATop, W, H); end; procedure TSpinSpeedButtons.DownBtnClick(Sender: TObject); begin if Assigned(FOnDownBtnClick) then FOnDownBtnClick(Self); end; procedure TSpinSpeedButtons.UpBtnClick(Sender: TObject); begin if Assigned(FOnUpBtnClick) then FOnUpBtnClick(Self); end; {TTimerSpinButton} destructor TTimerSpinButton.Destroy; begin if FRepeatTimer <> nil then FRepeatTimer.Free; inherited Destroy; end; procedure TTimerSpinButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin inherited MouseDown(Button, Shift, X, Y); if tbAllowTimer in FTimeBtnState then begin if FRepeatTimer = nil then FRepeatTimer := TTimer.Create(Self); FRepeatTimer.OnTimer := TimerExpired; FRepeatTimer.Interval := InitRepeatPause; FRepeatTimer.Enabled := True; end; InvalidateRect(parent.handle, nil, true); end; procedure TTimerSpinButton.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin inherited MouseUp(Button, Shift, X, Y); if FRepeatTimer <> nil then FRepeatTimer.Enabled := False; InvalidateRect(parent.handle, nil, true); end; procedure TTimerSpinButton.TimerExpired(Sender: TObject); begin FRepeatTimer.Interval := RepeatPause; if (FState = bsDown) and MouseCapture then begin try Click; except FRepeatTimer.Enabled := False; raise; end; end; end; procedure TTimerSpinButton.Paint; begin inherited Paint; end; constructor TTimerSpinButton.Create(AOwner: TComponent); begin inherited; FHasMouse := False; TimeBtnState := [tbAllowTimer]; end; procedure TTimerSpinButton.CMMouseEnter(var Message: TMessage); begin inherited; FHasMouse := True; Invalidate; end; procedure TTimerSpinButton.CMMouseLeave(var Message: TMessage); begin inherited; FHasMouse := False; Invalidate; end; { TTodoItemIO } constructor TTodoItemIO.CreateItem(AOwner: TTodoItemCollection); begin inherited Create(nil); FItem := TTodoItem(AOwner.GetItemClass.Create(AOwner)); end; destructor TTodoItemIO.Destroy; begin FItem.Free; inherited; end; initialization CF_TODOITEM := RegisterClipboardFormat('TTodo Item'); end.
unit ZMDllLoad19; (* ZMDLLLoad19.pas - Dynamically load the DLL Copyright (C) 2009, 2010 by Russell J. Peters, Roger Aelbrecht, Eric W. Engler and Chris Vleghert. This file is part of TZipMaster Version 1.9. TZipMaster is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. TZipMaster is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with TZipMaster. If not, see <http://www.gnu.org/licenses/>. contact: problems@delphizip.org (include ZipMaster in the subject). updates: http://www.delphizip.org DelphiZip maillist subscribe at http://www.freelists.org/list/delphizip modified 2009-09-22 --------------------------------------------------------------------------- *) interface uses Classes, Windows, ZMDelZip19, ZMWrkr19; procedure _DLL_Abort(worker: TZMWorker; key: Cardinal); function _DLL_Banner: String; function _DLL_Build: Integer; function _DLL_Exec(worker: TZMWorker; const Rec: pDLLCommands; var key: Cardinal): Integer; function _DLL_Load(worker: TZMWorker): Integer; function _DLL_Loaded(worker: TZMWorker): Boolean; function _DLL_Path: String; procedure _DLL_Remove(worker: TZMWorker); procedure _DLL_Unload(worker: TZMWorker); implementation {$I '.\ZMConfig19.inc'} uses SysUtils, ZipMstr19, ZMCompat19, ZMXcpt19, {$IFNDEF STATIC_LOAD_DELZIP_DLL} ZMCore19, ZMExtrLZ7719, ZMUtils19, ZMDLLOpr19, SyncObjs, {$ENDIF} ZMMsg19; procedure CheckExec(RetVal: Integer); var x: Integer; begin if RetVal < 0 then begin x := -RetVal; if x > _DZ_ERR_MAX then raise EZipMaster.CreateResInt(GE_DLLCritical, x); if (x = _DZ_ERR_CANCELLED) or (x = _DZ_ERR_ABORT) then x := DS_Canceled else x := x + DZ_RES_GOOD; raise EZipMaster.CreateResDisp(x, True); end; end; {$IFDEF STATIC_LOAD_DELZIP_DLL} // 'static' loaded dll functions function DZ_Abort(C: Cardinal): Integer; STDCALL; EXTERNAL DelZipDLL_Name {$IFDEF VERD2010up} Delayed {$ENDIF}; function DZ_Path: pChar; STDCALL; EXTERNAL DelZipDLL_Name {$IFDEF VERD2010up} Delayed {$ENDIF}; function DZ_PrivVersion: Integer; STDCALL; EXTERNAL DelZipDLL_Name {$IFDEF VERD2010up} Delayed {$ENDIF}; function DZ_Exec(C: pDLLCommands): Integer; STDCALL; EXTERNAL DelZipDLL_Name {$IFDEF VERD2010up} Delayed {$ENDIF}; function DZ_Version: Integer; STDCALL; EXTERNAL DelZipDLL_Name {$IFDEF VERD2010up} Delayed {$ENDIF}; function DZ_Banner: pChar; STDCALL; EXTERNAL DelZipDLL_Name {$IFDEF VERD2010up} Delayed {$ENDIF}; function DZ_Name(var buf; bufsiz: Integer; wide: Boolean): Integer; STDCALL; external DelZipDLL_Name {$IFDEF VERD2010up} Delayed {$ENDIF}; {$ELSE} type TZMCount = record worker: TZMWorker; Count: Integer; end; type TZMDLLLoader = class(TObject) private AbortFunc: TAbortOperationFunc; BannerFunc: TDLLBannerFunc; Counts: array of TZMCount; ExecFunc: TDLLExecFunc; fBanner: String; fHasResDLL: Integer; fKillTemp: Boolean; fLoadErr: Integer; fLoading: Integer; fLoadPath: String; fPath: String; fVer: Integer; // guard data for access by several threads Guard: TCriticalSection; hndl: HWND; NameFunc: TDLLNameFunc; PathFunc: TDLLPathFunc; Priv: Integer; PrivFunc: TDLLPrivVersionFunc; TmpFileName: String; VersFunc: TDLLVersionFunc; function GetIsLoaded: Boolean; function LoadLib(worker: TZMWorker; FullPath: String; MustExist: Boolean) : Integer; procedure ReleaseLib; procedure RemoveTempDLL; protected function Counts_Dec(worker: TZMWorker): Integer; function Counts_Find(worker: TZMWorker): Integer; function Counts_Inc(worker: TZMWorker): Integer; procedure Empty; function ExtractResDLL(worker: TZMWorker; OnlyVersion: Boolean): Integer; function LoadDLL(worker: TZMWorker): Integer; function UnloadDLL: Integer; property IsLoaded: Boolean Read GetIsLoaded; public procedure Abort(worker: TZMWorker; key: Cardinal); procedure AfterConstruction; override; function Banner: String; procedure BeforeDestruction; override; function Build: Integer; function Exec(worker: TZMWorker; const Rec: pDLLCommands; var key: Cardinal) : Integer; function Load(worker: TZMWorker): Integer; function Loaded(worker: TZMWorker): Boolean; function Path: String; procedure Remove(worker: TZMWorker); procedure Unload(worker: TZMWorker); property Ver: Integer Read fVer; end; const MINDLLBUILD = DELZIPVERSION * 10000; RESVER_UNTRIED = -99; // have not looked for resdll yet RESVER_NONE = -1; // not available RESVER_BAD = 0; // was bad copy/version // const MIN_RESDLL_SIZE = 50000; MAX_RESDLL_SIZE = 600000; var G_LoadedDLL: TZMDLLLoader = nil; procedure TZMDLLLoader.Abort(worker: TZMWorker; key: Cardinal); begin if Loaded(worker) and (hndl <> 0) then AbortFunc(key); end; procedure TZMDLLLoader.AfterConstruction; begin inherited; Guard := TCriticalSection.Create; fKillTemp := False; Empty; fPath := DelZipDLL_Name; TmpFileName := ''; fLoading := 0; fBanner := ''; fHasResDLL := RESVER_UNTRIED; // unknown end; function TZMDLLLoader.Banner: String; var tmp: AnsiString; begin Result := ''; if IsLoaded then begin tmp := BannerFunc; Result := String(tmp); end; end; procedure TZMDLLLoader.BeforeDestruction; begin if hndl <> 0 then FreeLibrary(hndl); Counts := nil; FreeAndNil(Guard); hndl := 0; RemoveTempDLL; inherited; end; function TZMDLLLoader.Build: Integer; begin Result := 0; if IsLoaded then Result := Priv; end; { TZMDLLLoader } function TZMDLLLoader.Counts_Dec(worker: TZMWorker): Integer; var p: string; keepLoaded: Boolean; i: Integer; begin Result := -1; Guard.Enter; try // find worker i := Counts_Find(worker); if i >= 0 then begin // found Dec(Counts[i].Count); Result := Counts[i].Count; if Result < 1 then begin // not wanted - remove from list Counts[i].worker := nil; Counts[i].Count := 0; end; end; // ignore unload if loading if fLoading = 0 then begin keepLoaded := False; for i := 0 to HIGH(Counts) do if (Counts[i].worker <> nil) and (Counts[i].Count > 0) then begin keepLoaded := True; break; end; if not keepLoaded then begin p := fPath; UnloadDLL; if worker.Verbosity >= zvVerbose then worker.ReportMsg(LD_DLLUnloaded, [p]); end; end; finally Guard.Leave; end; end; function TZMDLLLoader.Counts_Find(worker: TZMWorker): Integer; var i: Integer; begin Result := -1; if Counts <> nil then begin for i := 0 to HIGH(Counts) do begin if Counts[i].worker = worker then begin // found Result := i; break; end; end; end; end; function TZMDLLLoader.Counts_Inc(worker: TZMWorker): Integer; var len: Integer; i: Integer; loadVer: Integer; begin Guard.Enter; try // find worker i := Counts_Find(worker); if i >= 0 then begin // found Inc(Counts[i].Count); Result := Counts[i].Count; end else begin // need new one - any empty i := Counts_Find(nil); if i >= 0 then begin // have empty position - use it Counts[i].worker := worker; Counts[i].Count := 1; Result := 1; end else begin // need to extend len := HIGH(Counts); if len > 0 then Inc(len) else len := 0; SetLength(Counts, len + 4); // clear the rest for i := len + 3 downto len + 1 do begin Counts[i].worker := nil; Counts[i].Count := 0; end; i := len; Counts[i].worker := worker; Counts[i].Count := 1; Result := 1; end; end; if not IsLoaded then begin // avoid re-entry Inc(fLoading); try if fLoading = 1 then begin try loadVer := LoadDLL(worker); except on Ers: EZipMaster do begin loadVer := -1; worker.ShowExceptionError(Ers); end; on E: Exception do begin loadVer := -1; worker.ShowExceptionError(E); end; end; if loadVer < DELZIPVERSION then begin // could not load it - empty it (i is index for this worker) Counts[i].worker := nil; Counts[i].Count := 0; if worker.Verbosity >= zvVerbose then worker.ReportMsg(LD_LoadErr, [fLoadErr, SysErrorMessage(fLoadErr) , fLoadPath]); Result := -1; end else begin if worker.Verbosity >= zvVerbose then worker.ReportMsg(LD_DLLLoaded, [fPath]); end; end; finally Dec(fLoading); end; end; finally Guard.Leave; end; end; procedure TZMDLLLoader.Empty; begin hndl := 0; ExecFunc := nil; VersFunc := nil; PrivFunc := nil; AbortFunc := nil; NameFunc := nil; PathFunc := nil; BannerFunc := nil; fVer := 0; Priv := 0; fBanner := ''; end; function TZMDLLLoader.Exec(worker: TZMWorker; const Rec: pDLLCommands; var key: Cardinal): Integer; begin Result := -1; // what error if Counts_Inc(worker) > 0 then begin try Result := ExecFunc(Rec); finally Counts_Dec(worker); key := 0; end; end; end; function TZMDLLLoader.ExtractResDLL(worker: TZMWorker; OnlyVersion: Boolean): Integer; var fs: TFileStream; rs: TResourceStream; done: Boolean; w: Word; begin done := False; Result := -1; fs := nil; rs := nil; try // only check if unknown or know exists if (fHasResDLL = RESVER_UNTRIED) or (fHasResDLL > MINDLLBUILD) then rs := OpenResStream(DZRES_DLL, RT_RCDATA); if fHasResDLL = RESVER_UNTRIED then fHasResDLL := RESVER_NONE; // in case of exception // read the dll version if it exists if (rs <> nil) and (rs.Size > MIN_RESDLL_SIZE) and (rs.Size < MAX_RESDLL_SIZE) then begin rs.Position := 0; rs.ReadBuffer(Result, sizeof(Integer)); fHasResDLL := Result; // the dll version if (Result > MINDLLBUILD) and not OnlyVersion then begin rs.ReadBuffer(w, sizeof(Word)); rs.Position := sizeof(Integer); TmpFileName := worker.MakeTempFileName('DZ_', '.dll'); if TmpFileName = '' then raise EZipMaster.CreateResDisp(DS_NoTempFile, True); fs := TFileStream.Create(TmpFileName, fmCreate); if w = IMAGE_DOS_SIGNATURE then done := fs.CopyFrom(rs, rs.Size - sizeof(Integer)) = (rs.Size - sizeof(Integer)) else done := LZ77Extract(fs, rs, rs.Size - sizeof(Integer)) = 0; if not done then fHasResDLL := RESVER_BAD; // could not extract end; end; finally FreeAndNil(fs); FreeAndNil(rs); if not OnlyVersion then begin if (not done) and FileExists(TmpFileName) then DeleteFile(TmpFileName); if not FileExists(TmpFileName) then TmpFileName := ''; end; end; end; function TZMDLLLoader.GetIsLoaded: Boolean; begin Result := hndl <> 0; end; function TZMDLLLoader.Load(worker: TZMWorker): Integer; begin Result := 0; if Counts_Inc(worker) > 0 then Result := G_LoadedDLL.Ver; end; function TZMDLLLoader.LoadDLL(worker: TZMWorker): Integer; var AllowResDLL: Boolean; FullPath: String; DBuild: Integer; DLLDirectory: String; dpth: string; begin if hndl = 0 then begin fVer := 0; FullPath := ''; DLLDirectory := DelimitPath(TZMDLLOpr(worker).DLLDirectory, False); if DLLDirectory = '><' then begin // use res dll (or else) if (TmpFileName <> '') or (ExtractResDLL(worker, False) > MINDLLBUILD{MIN_RESDLL_SIZE}) then LoadLib(worker, TmpFileName, True); Result := fVer; exit; end; if DLLDirectory <> '' then begin // check relative? if DLLDirectory[1] = '.' then FullPath := PathConcat(ExtractFilePath(ParamStr(0)), DLLDirectory) else FullPath := DLLDirectory; if (ExtractNameOfFile(DLLDirectory) <> '') and (CompareText(ExtractFileExt(DLLDirectory), '.DLL') = 0) then begin // must load the named dll LoadLib(worker, FullPath, True); Result := fVer; exit; end; dpth := ExtractFilePath(FullPath); if (dpth <> '') and not DirExists(dpth) then FullPath := ''; end; AllowResDLL := DLLDirectory = ''; // only if no path specified // DBuild := MINDLLBUILD;//0; if AllowResDLL then begin // check for res dll once only if fHasResDLL = RESVER_UNTRIED then ExtractResDLL(worker, True); // read the res dll version if it exists if fHasResDLL < MINDLLBUILD then AllowResDLL := False; // none or bad version end; DBuild := LoadLib(worker, PathConcat(FullPath, DelZipDLL_Name), not AllowResDLL); // if not loaded we only get here if allowResDLL is true; if DBuild < MINDLLBUILD then begin // use resdll if no other available if (TmpFileName <> '') or (ExtractResDLL(worker, False) > 0) then begin if LoadLib(worker, TmpFileName, False) < MINDLLBUILD then begin // could not load the res dll fHasResDLL := RESVER_BAD; // is bad version end; end; end; end; Result := fVer; // if (Result > 0) and (worker.Verbosity >= zvVerbose) then // worker.ReportMsg(LD_DLLLoaded,[fPath]); end; function TZMDLLLoader.Loaded(worker: TZMWorker): Boolean; var i: Integer; begin Result := False; i := Counts_Find(worker); if (i >= 0) and (Counts[i].Count > 0) then Result := True; end; // returns build function TZMDLLLoader.LoadLib(worker: TZMWorker; FullPath: String; MustExist: Boolean): Integer; var oldMode: Cardinal; tmp: AnsiString; begin if hndl > 0 then FreeLibrary(hndl); Empty; fLoadErr := 0; fLoadPath := FullPath; oldMode := SetErrorMode(SEM_FAILCRITICALERRORS or SEM_NOGPFAULTERRORBOX); try hndl := LoadLibrary(pChar(FullPath)); if hndl > HInstance_Error then begin @ExecFunc := GetProcAddress(hndl, DelZipDLL_Execfunc); if (@ExecFunc <> nil) then @VersFunc := GetProcAddress(hndl, DelZipDLL_Versfunc); if (@VersFunc <> nil) then @PrivFunc := GetProcAddress(hndl, DelZipDLL_Privfunc); if (@PrivFunc <> nil) then @AbortFunc := GetProcAddress(hndl, DelZipDLL_Abortfunc); if (@AbortFunc <> nil) then @NameFunc := GetProcAddress(hndl, DelZipDLL_Namefunc); if (@NameFunc <> nil) then @BannerFunc := GetProcAddress(hndl, DelZipDLL_Bannerfunc); if (@BannerFunc <> nil) then @PathFunc := GetProcAddress(hndl, DelZipDLL_Pathfunc); end else fLoadErr := GetLastError; finally SetErrorMode(oldMode); end; if hndl <= HInstance_Error then begin Empty; if MustExist then begin if worker.Verbosity >= zvVerbose then worker.ReportMsg(LD_LoadErr, [fLoadErr, SysErrorMessage(fLoadErr), fLoadPath]); raise EZipMaster.CreateResStr(LD_NoDLL, FullPath); end; Result := 0; exit; end; if (@BannerFunc <> nil) then begin Priv := PrivFunc; fVer := VersFunc; SetLength(fPath, MAX_PATH + 1); {$IFDEF UNICODE} NameFunc(fPath[1], MAX_PATH, True); {$ELSE} NameFunc(fPath[1], MAX_PATH, False); {$ENDIF} fPath := String(pChar(fPath)); tmp := BannerFunc; fBanner := String(tmp); end; if (fVer < DELZIPVERSION) or (fVer > 300) then begin FullPath := fPath; FreeLibrary(hndl); Empty; if MustExist then begin if worker.Verbosity >= zvVerbose then worker.ReportMsg(LD_LoadErr, [fLoadErr, SysErrorMessage(fLoadErr), fLoadPath]); raise EZipMaster.CreateResStr(LD_NoDLL, FullPath); end; end; Result := Priv; end; function TZMDLLLoader.Path: String; begin Result := ''; if IsLoaded then Result := fPath; end; procedure TZMDLLLoader.ReleaseLib; begin if hndl <> 0 then begin FreeLibrary(hndl); hndl := 0; end; if hndl = 0 then begin Empty; fPath := ''; if fKillTemp then RemoveTempDLL; end; end; procedure TZMDLLLoader.Remove(worker: TZMWorker); var i: Integer; begin Guard.Enter; try i := Counts_Find(worker); if i >= 0 then begin // found - remove it Counts[i].worker := nil; Counts[i].Count := 0; end; finally Guard.Leave; end; end; procedure TZMDLLLoader.RemoveTempDLL; var t: String; begin t := TmpFileName; TmpFileName := ''; fKillTemp := False; if (t <> '') and FileExists(t) then SysUtils.DeleteFile(t); end; procedure TZMDLLLoader.Unload(worker: TZMWorker); begin Counts_Dec(worker); end; function TZMDLLLoader.UnloadDLL: Integer; begin ReleaseLib; Result := fVer; end; {$ENDIF} { public functions } procedure _DLL_Abort(worker: TZMWorker; key: Cardinal); begin if key <> 0 then {$IFDEF STATIC_LOAD_DELZIP_DLL} DZ_Abort(key); {$ELSE} G_LoadedDLL.Abort(worker, key); {$ENDIF} end; function _DLL_Banner: String; begin {$IFDEF STATIC_LOAD_DELZIP_DLL} Result := DZ_Banner; {$ELSE} Result := G_LoadedDLL.Banner; {$ENDIF} end; function _DLL_Build: Integer; begin {$IFDEF STATIC_LOAD_DELZIP_DLL} Result := DZ_PrivVersion; {$ELSE} Result := G_LoadedDLL.Build; {$ENDIF} end; function _DLL_Exec(worker: TZMWorker; const Rec: pDLLCommands; var key: Cardinal): Integer; begin try {$IFDEF STATIC_LOAD_DELZIP_DLL} Result := DZ_Exec(Rec); {$ELSE} Result := G_LoadedDLL.Exec(worker, Rec, key); {$ENDIF} key := 0; except Result := -6; // -7; key := 0; end; CheckExec(Result); end; function _DLL_Load(worker: TZMWorker): Integer; begin {$IFDEF STATIC_LOAD_DELZIP_DLL} Result := DZ_Version; {$ELSE} Result := G_LoadedDLL.Load(worker); {$ENDIF} end; function _DLL_Loaded(worker: TZMWorker): Boolean; begin {$IFDEF STATIC_LOAD_DELZIP_DLL} Result := True; {$ELSE} Result := G_LoadedDLL.Loaded(worker); {$ENDIF} end; function _DLL_Path: String; begin {$IFDEF STATIC_LOAD_DELZIP_DLL} Result := DZ_Path; {$ELSE} Result := G_LoadedDLL.Path; {$ENDIF} end; // remove from list procedure _DLL_Remove(worker: TZMWorker); begin {$IFDEF STATIC_LOAD_DELZIP_DLL} // nothing to do {$ELSE} G_LoadedDLL.Remove(worker); {$ENDIF} end; procedure _DLL_Unload(worker: TZMWorker); begin {$IFNDEF STATIC_LOAD_DELZIP_DLL} G_LoadedDLL.Unload(worker); {$ENDIF} end; {$IFNDEF STATIC_LOAD_DELZIP_DLL} initialization G_LoadedDLL := TZMDLLLoader.Create; finalization FreeAndNil(G_LoadedDLL); {$ENDIF} end.
{******************************************************************************* 作者: dmzn@163.com 2010-8-6 描述: 服务器模块 *******************************************************************************} unit UROModule; {$I Link.Inc} interface uses SysUtils, Classes, SyncObjs, uROIndyTCPServer, uROClient, uROServer, IdContext, uROClassFactories, UMgrDBConn, uROIndyHTTPServer, uROSOAPMessage, uROBinMessage, uROServerIntf, uRODiscovery, uROIndyUDPServer, uRODiscovery_Intf, uROTypes, uROBroadcastServer; type TROServerType = (stTcp, stHttp); TROServerTypes = set of TROServerType; //服务类型 TROModuleParam = record FPortTCP: Integer; FPortHttp: Integer; //监听端口 FPoolSizeSrvConn: Integer; FPoolSizeSrvDB: Integer; //缓冲池 FPoolBehaviorSrvConn: TROPoolBehavior; FPoolBehaviorSrvDB: TROPoolBehavior; //缓冲模式 FVerLocalMIT: string; FVerClient : string; //终端版本 FRemoteURL: string; //远程服务 end; PROModuleStatus = ^TROModuleStatus; TROModuleStatus = record FSrvTCP: Boolean; FSrvHttp: Boolean; //服务状态 FNumTCPActive: Cardinal; FNumTCPTotal: Cardinal; FNumTCPMax: Cardinal; FNumHttpActive: Cardinal; FNumHttpMax: Cardinal; FNumHttpTotal: Cardinal; //连接计数 FNumConn: Cardinal; FNumDB: Cardinal; FNumSweetHeart: Cardinal; FNumSignIn: Cardinal; FNumRegister: Cardinal; FNumSQLQuery: Cardinal; FNumSQLExecute: Cardinal; FNumSQLUpdates: Cardinal; //请求计数 FNumActionError: Cardinal;//执行错误计数 FTerminalID: string; FSpID: string; FMAC: string; //代理,终端标识 FOnline: Boolean; //是否连线 end; TROModule = class(TDataModule) ROBinMsg: TROBinMessage; ROSOAPMsg: TROSOAPMessage; ROHttp1: TROIndyHTTPServer; ROTcp1: TROIndyTCPServer; RODisSrv1: TRODiscoveryServer; ROBroSrv1: TROBroadcastServer; RODisMsg: TROBinMessage; procedure DataModuleCreate(Sender: TObject); procedure DataModuleDestroy(Sender: TObject); procedure ROHttp1AfterServerActivate(Sender: TObject); procedure ROHttp1InternalIndyServerConnect(AContext: TIdContext); procedure ROTcp1InternalIndyServerConnect(AContext: TIdContext); procedure ROHttp1InternalIndyServerDisconnect(AContext: TIdContext); procedure ROTcp1InternalIndyServerDisconnect(AContext: TIdContext); procedure RODisSrv1ServiceFound(aSender: TObject; aName: String; var ioDiscoveryOptions: TRODiscoveryOptions; var ioHandled: Boolean); private { Private declarations } FStatus: TROModuleStatus; //运行状态 FSrvConn: IROClassFactory; //连接服务类厂 FSrvDB: IROClassFactory; //数据服务类厂 FSyncLock: TCriticalSection; //同步锁 procedure RegClassFactories; //注册类厂 procedure UnregClassFactories; //反注册 procedure BeforeStartServer; procedure AfterStopServer; //准备,善后 public { Public declarations } function ActiveServer(const nServer: TROServerTypes; const nActive: Boolean; var nMsg: string): Boolean; //服务操作 function LockModuleStatus: PROModuleStatus; procedure ReleaseStatusLock; //获取状态 procedure ActionROModuleParam(const nIsRead: Boolean); //处理参数 end; var ROModule: TROModule; gROModuleParam: TROModuleParam; implementation {$R *.dfm} uses Windows, IniFiles, UDataModule, USysService, USysMAC, USysConst, SrvConn_Impl, SrvDB_Impl, FZSale_Invk; const cParam = 'DBSync'; procedure TROModule.ActionROModuleParam(const nIsRead: Boolean); var nIni: TIniFile; begin nIni := TIniFile.Create(gPath + sConfigFile); try with gROModuleParam,nIni do begin if nIsRead then begin FPortTCP := ReadInteger(cParam, 'PortTCP', 8081); FPortHttp := ReadInteger(cParam, 'PortHttp', 8082); FPoolSizeSrvConn := ReadInteger(cParam, 'PoolSizeSrvConn', 5); FPoolSizeSrvDB := ReadInteger(cParam, 'PoolSizeSrvDB', 20); FPoolBehaviorSrvConn := TROPoolBehavior(ReadInteger(cParam, 'PoolBehaviorSrvConn', Ord(pbWait))); FPoolBehaviorSrvDB := TROPoolBehavior(ReadInteger(cParam, 'PoolBehaviorSrvDB', Ord(pbWait))); FRemoteURL := ReadString(cParam, 'RemoteURL', ''); with LockModuleStatus^ do try FStatus.FTerminalID := ReadString(cParam, 'TerminalID', ''); FStatus.FSpID := ReadString(cParam, 'SpID', ''); finally ReleaseStatusLock; end; end else begin WriteInteger(cParam, 'PortTCP', FPortTCP); WriteInteger(cParam, 'PortHttp', FPortHttp); WriteInteger(cParam, 'PoolSizeSrvConn', FPoolSizeSrvConn); WriteInteger(cParam, 'PoolSizeSrvDB', FPoolSizeSrvDB); WriteInteger(cParam, 'PoolBehaviorSrvConn', Ord(FPoolBehaviorSrvConn)); WriteInteger(cParam, 'PoolBehaviorSrvDB', Ord(FPoolBehaviorSrvDB)); WriteString(cParam, 'RemoteURL', FRemoteURL); with LockModuleStatus^ do try WriteString(cParam, 'TerminalID', FTerminalID); WriteString(cParam, 'SpID', FSpID); finally ReleaseStatusLock; end; end; end; finally nIni.Free; end; end; //------------------------------------------------------------------------------ procedure TROModule.DataModuleCreate(Sender: TObject); begin FSrvConn := nil; FSrvDB := nil; FillChar(FStatus, SizeOf(FStatus), #0); FSyncLock := TCriticalSection.Create; ActionROModuleParam(True); FStatus.FMAC := MakeActionID_MAC; end; procedure TROModule.DataModuleDestroy(Sender: TObject); var nStr: string; begin ActiveServer([stTcp, stHttp], False, nStr); UnregClassFactories; FSyncLock.Free; end; //Desc: 同步锁定模块状态 function TROModule.LockModuleStatus: PROModuleStatus; begin FSyncLock.Enter; Result := @FStatus; end; //Desc: 释放模块同步锁 procedure TROModule.ReleaseStatusLock; begin FSyncLock.Leave; end; //Desc: 服务器启动 procedure TROModule.ROHttp1AfterServerActivate(Sender: TObject); begin with gROModuleParam, LockModuleStatus^ do begin FSrvTCP := ROTcp1.Active; FSrvHttp := ROHttp1.Active; ReleaseStatusLock; end; if not (csDestroying in ComponentState) then AdminStatusChange(gSysParam.FIsAdmin); //xxxxx end; //Desc: TCP新连接 procedure TROModule.ROTcp1InternalIndyServerConnect(AContext: TIdContext); begin with gROModuleParam, LockModuleStatus^ do begin FNumTCPTotal := FNumTCPTotal + 1; FNumTCPActive := FNumTCPActive + 1; if FNumTCPActive > FNumTCPMax then FNumTCPMax := FNumTCPActive; ReleaseStatusLock; end; end; //Desc: Http新连接 procedure TROModule.ROHttp1InternalIndyServerConnect(AContext: TIdContext); begin with gROModuleParam, LockModuleStatus^ do begin FNumHttpTotal := FNumHttpTotal + 1; FNumHttpActive := FNumHttpActive + 1; if FNumHttpActive > FNumHttpMax then FNumHttpMax := FNumHttpActive; ReleaseStatusLock; end; end; //Desc: TCP断开 procedure TROModule.ROTcp1InternalIndyServerDisconnect(AContext: TIdContext); begin with gROModuleParam, LockModuleStatus^ do begin FNumTCPActive := FNumTCPActive - 1; ReleaseStatusLock; end; end; //Desc: HTTP断开 procedure TROModule.ROHttp1InternalIndyServerDisconnect(AContext: TIdContext); begin with gROModuleParam, LockModuleStatus^ do begin FNumHttpActive := FNumHttpActive - 1; ReleaseStatusLock; end; end; //------------------------------------------------------------------------------ procedure Create_SrvDB(out anInstance : IUnknown); begin anInstance := TSrvDB.Create; end; procedure Create_SrvConn(out anInstance : IUnknown); begin anInstance := TSrvConn.Create; end; //Desc: 注册类厂 procedure TROModule.RegClassFactories; begin UnregClassFactories; with gROModuleParam do begin FSrvConn := TROPooledClassFactory.Create(cService_Conn, Create_SrvConn, TSrvConn_Invoker, FPoolSizeSrvConn, FPoolBehaviorSrvConn); FSrvDB := TROPooledClassFactory.Create(cService_DB, Create_SrvDB, TSrvDB_Invoker, FPoolSizeSrvDB, FPoolBehaviorSrvDB); end; end; //Desc: 注销类厂 procedure TROModule.UnregClassFactories; begin if Assigned(FSrvConn) then begin UnRegisterClassFactory(FSrvConn); FSrvConn := nil; end; if Assigned(FSrvDB) then begin UnRegisterClassFactory(FSrvDB); FSrvDB := nil; end; end; //Date: 2010-8-7 //Parm: 服务类型;动作;提示信息 //Desc: 对nServer执行nActive动作 function TROModule.ActiveServer(const nServer: TROServerTypes; const nActive: Boolean; var nMsg: string): Boolean; begin try if nActive and ((not ROTcp1.Active) and (not ROHttp1.Active)) then BeforeStartServer; //启动前准备 if stTcp in nServer then begin if nActive then ROTcp1.Active := False; ROTcp1.Port := gROModuleParam.FPortTCP; ROTcp1.Active := nActive; end; if stHttp in nServer then begin if nActive then ROHttp1.Active := False; ROHttp1.Port := gROModuleParam.FPortHttp; ROHttp1.Active := nActive; end; ROBroSrv1.Active := ROHttp1.Active or ROTcp1.Active; //服务广播 if (not ROTcp1.Active) and (not ROHttp1.Active) then begin UnregClassFactories; //卸载类厂 AfterStopServer; //关闭善后 end; Result := True; nMsg := ''; except on nE:Exception do begin Result := False; nMsg := nE.Message; ShowDebugLog(nMsg, True); end; end; end; //Desc: 启动前准备工作 procedure TROModule.BeforeStartServer; var nParam: TDBParam; begin {$IFDEF EnableSyncDB} with nParam, gSysParam, FDM do begin begin FID := sSysDB; FHost := FLocalHost; FPort := FLocalPort; FDB := FLocalDB; FUser := FLocalUser; FPwd := FLocalPwd; FConn := FLocalConn; end; LocalConn.Close; LocalConn.ConnectionString := gDBConnManager.MakeDBConnection(nParam); LocalConn.Connected := True; AdjustAllSystemTables; //重置系统表 LocalConn.Connected := False; gDBConnManager.AddParam(nParam); end; {$ENDIF} if (FSrvConn = nil) or (FSrvDB = nil) then RegClassFactories; //xxxxx with RODisSrv1 do begin ServiceList.Clear; ServiceList.Add(cService_DB); ServiceList.Add(cService_Conn); end; end; //Desc: 服务关闭后善后工作 procedure TROModule.AfterStopServer; begin FDM.LocalConn.Connected := False; end; //------------------------------------------------------------------------------ type TMyDiscoveryResultOptions = class(TRODiscoveryOptions) private FPath: string; published property Path: string read FPath write FPath; end; //Desc: 服务内容传递 procedure TROModule.RODisSrv1ServiceFound(aSender: TObject; aName: String; var ioDiscoveryOptions: TRODiscoveryOptions; var ioHandled: Boolean); var nStr: string; begin with gROModuleParam do begin nStr := Format(':%d/Bin', [FPortHttp]); ioDiscoveryOptions := TMyDiscoveryResultOptions.Create; TMyDiscoveryResultOptions(ioDiscoveryOptions).Path := nStr; end; end; initialization RegisterROClass(TMyDiscoveryResultOptions); finalization UnregisterROClass(TMyDiscoveryResultOptions); end.
unit m3NewStorageStreamPrim; // Модуль: "w:\common\components\rtl\Garant\m3\m3NewStorageStreamPrim.pas" // Стереотип: "SimpleClass" // Элемент модели: "Tm3NewStorageStreamPrim" MUID: (5448F0A40180) {$Include w:\common\components\rtl\Garant\m3\m3Define.inc} interface uses l3IntfUses , m3CommonStorageStream , m3StorageBlock , m3StoreHeaderDataPrim , m3StorageInterfaces , Classes ; type Tm3NewStorageStreamPrim = {abstract} class(Tm3CommonStorageStream) private f_Block: Tm3StorageBlock; f_HeaderData: Tm3StoreHeaderDataPrim; f_Position: Int64; protected procedure MoveStreamPointer; procedure Cleanup; override; {* Функция очистки полей объекта. } procedure DoRead(aBuff: Pointer; aSize: Integer; var theResult: Integer; var theReturn: hResult); override; procedure DoWrite(aBuff: Pointer; aSize: Integer; var theResult: Integer; var theReturn: hResult); override; procedure DoSeek(anOffset: Int64; anOrigin: TSeekOrigin; var theResult: Int64; var theReturn: hResult); override; procedure DoSetSize(aSize: Int64; var theReturn: hResult); override; function DoGetSize: Int64; override; function DoGetName: WideString; override; public constructor Create(anAccess: Tm3StoreAccess; aHeaderData: Tm3StoreHeaderDataPrim); reintroduce; end;//Tm3NewStorageStreamPrim implementation uses l3ImplUses , Windows , l3Base , ComObj , m2COMLib , ActiveX , m2S32Lib , m2S64Lib , SysUtils , m2MemLib , m3Exceptions //#UC START# *5448F0A40180impl_uses* //#UC END# *5448F0A40180impl_uses* ; procedure Tm3NewStorageStreamPrim.MoveStreamPointer; //#UC START# *5448F1A501FE_5448F0A40180_var* var l_Next : Tm3StorageBlock; //#UC END# *5448F1A501FE_5448F0A40180_var* begin //#UC START# *5448F1A501FE_5448F0A40180_impl* if f_Block.IsFull then begin l_Next := f_Block.CreateNext; try l_Next.SetRefTo(f_Block); finally FreeAndNil(l_Next); end;//try..finally end;//f_Block.IsFull //#UC END# *5448F1A501FE_5448F0A40180_impl* end;//Tm3NewStorageStreamPrim.MoveStreamPointer constructor Tm3NewStorageStreamPrim.Create(anAccess: Tm3StoreAccess; aHeaderData: Tm3StoreHeaderDataPrim); //#UC START# *5448F1C80365_5448F0A40180_var* //#UC END# *5448F1C80365_5448F0A40180_var* begin //#UC START# *5448F1C80365_5448F0A40180_impl* Assert((anAccess = m3_saRead) OR (anAccess = m3_saReadWrite) OR (anAccess = STGM_READ) OR (anAccess = STGM_READWRITE)); Assert(aHeaderData <> nil); aHeaderData.SetRefTo(f_HeaderData); f_Position := 0; inherited Create(anAccess, aHeaderData.Stream, aHeaderData.Name); f_Block := Tm3StorageBlock.Create(aHeaderData); if not Self.ReadOnly then if (aHeaderData.Stream.Logger <> nil) then aHeaderData.Stream.Logger.ToLog('Получен поток для записи: ' + ClassName + ' имя: ' + aHeaderData.Name.AsString); //#UC END# *5448F1C80365_5448F0A40180_impl* end;//Tm3NewStorageStreamPrim.Create procedure Tm3NewStorageStreamPrim.Cleanup; {* Функция очистки полей объекта. } //#UC START# *479731C50290_5448F0A40180_var* //#UC END# *479731C50290_5448F0A40180_var* begin //#UC START# *479731C50290_5448F0A40180_impl* try FreeAndNil(f_Block); finally FreeAndNil(f_HeaderData); inherited; end;//try..finally //#UC END# *479731C50290_5448F0A40180_impl* end;//Tm3NewStorageStreamPrim.Cleanup procedure Tm3NewStorageStreamPrim.DoRead(aBuff: Pointer; aSize: Integer; var theResult: Integer; var theReturn: hResult); //#UC START# *4FA27CF501C4_5448F0A40180_var* var l_SizeToRead : Integer; l_Size : Integer; //#UC END# *4FA27CF501C4_5448F0A40180_var* begin //#UC START# *4FA27CF501C4_5448F0A40180_impl* if SUCCEEDED(theReturn) then begin while (theResult <> aSize) do begin l_SizeToRead := aSize - theResult; l_SizeToRead := m2S64Min(f_HeaderData.RRealSize - f_Position, l_SizeToRead); l_Size := f_Block.Read(PANSIChar(aBuff) + theResult, l_SizeToRead); if (l_Size = 0) then break; Inc(theResult, l_Size); Inc(f_Position, l_Size); MoveStreamPointer; end;//while (theResult <> aSize) end;//SUCCEEDED(theReturn) //#UC END# *4FA27CF501C4_5448F0A40180_impl* end;//Tm3NewStorageStreamPrim.DoRead procedure Tm3NewStorageStreamPrim.DoWrite(aBuff: Pointer; aSize: Integer; var theResult: Integer; var theReturn: hResult); //#UC START# *4FA27D310344_5448F0A40180_var* var l_SizeToWrite : Integer; l_Size : Integer; //#UC END# *4FA27D310344_5448F0A40180_var* begin //#UC START# *4FA27D310344_5448F0A40180_impl* Assert(not Self.ReadOnly); if SUCCEEDED(theReturn) then begin while (theResult <> aSize) do begin l_SizeToWrite := aSize - theResult; l_Size := f_Block.Write(PANSIChar(aBuff) + theResult, l_SizeToWrite); if (l_Size = 0) then break; Inc(theResult, l_Size); Inc(f_Position, l_Size); f_HeaderData.RRealSize := m2S64Max(f_HeaderData.RRealSize, f_Position); MoveStreamPointer; end;//while (theResult <> aSize) end;//SUCCEEDED(theReturn) //#UC END# *4FA27D310344_5448F0A40180_impl* end;//Tm3NewStorageStreamPrim.DoWrite procedure Tm3NewStorageStreamPrim.DoSeek(anOffset: Int64; anOrigin: TSeekOrigin; var theResult: Int64; var theReturn: hResult); //#UC START# *4FA27D5302C5_5448F0A40180_var* procedure __Seek(const aPosition: Int64; var theResult: Int64); var l_Next : Tm3StorageBlock; l_BlockIndex : Int64; begin//__Seek if ((APosition >= 0) and (APosition <= f_HeaderData.RRealSize)) then begin if (APosition <> f_Position) then begin l_BlockIndex := APosition div f_HeaderData.Stream.ClusterBodySize; if (l_BlockIndex <> f_Block.Index) then begin if (l_BlockIndex = 0) then begin FreeAndNil(f_Block); f_Block := Tm3StorageBlock.Create(f_HeaderData); end//l_BlockIndex = 0 else if (l_BlockIndex > f_Block.Index) then begin while (l_BlockIndex <> f_Block.Index) do begin l_Next := f_Block.CreateNext; try l_Next.SetRefTo(f_Block); finally FreeAndNil(l_Next); end;//try..finally end;//l_BlockIndex <> f_Block.Index end//l_BlockIndex > f_Block.Index else if (l_BlockIndex < f_Block.Index) then begin while (l_BlockIndex <> f_Block.Index) do begin l_Next := f_Block.CreatePrev; try l_Next.SetRefTo(f_Block); finally FreeAndNil(l_Next); end;//try..finally end;//l_BlockIndex <> f_Block.Index end;//l_BlockIndex > f_Block.Index end;//l_BlockIndex <> f_Block.Index Assert(l_BlockIndex = f_Block.Index); f_Block.SetPositionInStream(aPosition); f_Position := aPosition; end;//APosition <> FPosition end//((APosition >= 0) and (APosition <= RRealSize)) else Assert(false, 'Смещаемся за границу потока'); theResult := f_Position; end;//__Seek //#UC END# *4FA27D5302C5_5448F0A40180_var* begin //#UC START# *4FA27D5302C5_5448F0A40180_impl* if SUCCEEDED(theReturn) then begin case anOrigin of soBeginning: __Seek(anOffset, theResult); soCurrent: __Seek(anOffset + f_Position, theResult); soEnd: __Seek(anOffset + f_HeaderData.RRealSize, theResult); else begin Assert(false, 'Неверный anOrigin'); OleError(E_UNEXPECTED); end;//else end;//case anOrigin end;//SUCCEEDED(theReturn) //#UC END# *4FA27D5302C5_5448F0A40180_impl* end;//Tm3NewStorageStreamPrim.DoSeek procedure Tm3NewStorageStreamPrim.DoSetSize(aSize: Int64; var theReturn: hResult); //#UC START# *4FA27DCD02B4_5448F0A40180_var* procedure __GrowSize(const ASize: Int64); const CMaxBuffSize = 1024*1024; var LBuff : Pointer; LBuffSize : LongInt; LSize : Int64; begin//__GrowSize LSize := ASize; LBuffSize := LongInt(m2S64Min(LSize, CMaxBuffSize)); m2MEMAlloc(LBuff, LBuffSize, 0); try while (LSize <> 0) do begin LBuffSize := LongInt(m2S64Min(LSize, Int64(LBuffSize))); m2COMWriteBuffer(Self, LBuff^, LBuffSize); Dec(LSize, LBuffSize); end;//LSize <> 0 finally m2MEMFree(LBuff); end;//try..finally end;//__GrowSize procedure __ReduceSize(const ASize: Int64); var l_Pos : Int64; begin//__ReduceSize m2COMSeek(Self, aSize, STREAM_SEEK_SET); if (f_Position = 0) then begin FreeAndNil(f_Block); l_Pos := f_HeaderData.FirstCluster; f_HeaderData.Stream.RemoveTOCBuffData(l_Pos); f_HeaderData.FirstCluster := l_Pos; f_Block := Tm3StorageBlock.Create(f_HeaderData); end//f_Position = 0 else begin l_Pos := f_Block.NextPosition; f_HeaderData.Stream.RemoveTOCBuffData(l_Pos); f_Block.NextPosition := l_Pos; end;//f_Position = 0 f_HeaderData.RRealSize := f_Position; end;//__ReduceSize var l_Size : Int64; //#UC END# *4FA27DCD02B4_5448F0A40180_var* begin //#UC START# *4FA27DCD02B4_5448F0A40180_impl* Assert(not Self.ReadOnly); if SUCCEEDED(theReturn) then begin l_Size := m2COMSeek(Self, 0, STREAM_SEEK_END); if (l_Size < ASize) then __GrowSize(ASize - l_Size) else if (l_Size > ASize) then __ReduceSize(ASize); end;//SUCCEEDED(theReturn) //#UC END# *4FA27DCD02B4_5448F0A40180_impl* end;//Tm3NewStorageStreamPrim.DoSetSize function Tm3NewStorageStreamPrim.DoGetSize: Int64; //#UC START# *4FA2802E0231_5448F0A40180_var* //#UC END# *4FA2802E0231_5448F0A40180_var* begin //#UC START# *4FA2802E0231_5448F0A40180_impl* Result := f_HeaderData.RRealSize; //#UC END# *4FA2802E0231_5448F0A40180_impl* end;//Tm3NewStorageStreamPrim.DoGetSize function Tm3NewStorageStreamPrim.DoGetName: WideString; //#UC START# *5412FB880320_5448F0A40180_var* //#UC END# *5412FB880320_5448F0A40180_var* begin //#UC START# *5412FB880320_5448F0A40180_impl* Result := f_HeaderData.Name.AsWideString; //#UC END# *5412FB880320_5448F0A40180_impl* end;//Tm3NewStorageStreamPrim.DoGetName end.
unit MP3Handler; interface uses VoyagerInterfaces, Classes, Controls, MP3Player, MPlayer; type TMP3Handler = class( TInterfacedObject, IMetaURLHandler, IURLHandler ) public constructor Create; destructor Destroy; override; private fPlayers : TStringList; // IMetaURLHandler private function getName : string; function getOptions : TURLHandlerOptions; function getCanHandleURL( URL : TURL ) : THandlingAbility; function Instantiate : IURLHandler; // IURLHandler private function HandleURL( URL : TURL ) : TURLHandlingResult; function HandleEvent( EventId : TEventId; var info ) : TEventHandlingResult; function getControl : TControl; procedure setMasterURLHandler( URLHandler : IMasterURLHandler ); private fMasterURLHandler : IMasterURLHandler; private //procedure OnNotify( Sender : TXaudioPlayer; State : Integer ); procedure PlayerState(Sender : TMP3Player; PrevState, NewState : TMP3PlayerState); private fLastVolume : integer; fDisabled : boolean; end; const tidMetaHandler_Sound = 'MP3Handler'; const htmlAction_Play = 'PLAY'; htmlAction_Stop = 'STOP'; htmlAction_Pause = 'PAUSE'; htmlAction_Resume = 'RESUME'; htmlAction_SetVolume = 'SETVOLUME'; htmlParmName_MediaId = 'MediaId'; htmlParmName_MediaURL = 'MediaURL'; htmlParmName_Volume = 'Volume'; htmlParmName_UseCache = 'UseCache'; htmlParmName_Rewind = 'Rewind'; htmlParmName_Loop = 'Loop'; const evnAnswerMediaStatus = 6000; evnMediaStatusChanged = 6001; type TMediaStatusInfo = record MediaId : string; Status : TMPNotifyValues; end; implementation uses URLParser, SysUtils, Events, Forms, SoundLib; // TMP3Handler constructor TMP3Handler.Create; begin inherited Create; fPlayers := TStringList.Create; fLastVolume := -1; end; destructor TMP3Handler.Destroy; var i : integer; begin for i := 0 to pred(fPlayers.Count) do TMediaPlayer(fPlayers.Objects[i]).Free; fPlayers.Free; inherited; end; function TMP3Handler.getName : string; begin result := tidMetaHandler_Sound; end; function TMP3Handler.getOptions : TURLHandlerOptions; begin result := [hopCacheable, hopNonVisual]; end; function TMP3Handler.getCanHandleURL( URL : TURL ) : THandlingAbility; begin result := 0; end; function TMP3Handler.Instantiate : IURLHandler; begin result := self; end; function TMP3Handler.HandleURL( URL : TURL ) : TURLHandlingResult; function GetCachePath : string; begin fMasterURLHandler.HandleEvent( evnAnswerPrivateCache, result ); end; function Play( URL : string ) : TURLHandlingResult; var MediaId : string; MediaURL : string; idx : integer; Player : TMP3Player; begin MediaId := uppercase(URLParser.GetParmValue( URL, htmlParmName_MediaId )); MediaURL := uppercase(URLParser.GetParmValue( URL, htmlParmName_MediaURL )); if (MediaId <> '') and (MediaURL <> '') then begin try idx := fPlayers.IndexOf( MediaId ); if idx >= 0 then Player := TMP3Player(fPlayers.Objects[idx]) else try Player := TMP3Player.Create; Player.DirectSound := GetDSoundInstance; Player.OnStateChange := PlayerState; fPlayers.AddObject( MediaId, Player ); except fDisabled := true; Player := nil; end; if not fDisabled then begin Player.Loop := (uppercase(URLParser.GetParmValue( URL, htmlParmName_Loop )) = 'YES'); if ExtractFilePath(MediaURL) = '' then Player.FileName := GetCachePath + 'Sound\' + MediaURL else Player.FileName := MediaURL; Player.Play; result := urlHandled; end else result := urlHandled; except result := urlError; end; end else result := urlError; end; function Stop( URL : string ) : TURLHandlingResult; var MediaId : string; idx : integer; begin MediaId := uppercase(URLParser.GetParmValue( URL, htmlParmName_MediaId )); idx := fPlayers.IndexOf( MediaId ); if idx >= 0 then TMP3Player(fPlayers.Objects[idx]).Stop; result := urlHandled; end; function Pause : TURLHandlingResult; var MediaId : string; idx : integer; begin MediaId := uppercase(URLParser.GetParmValue( URL, htmlParmName_MediaId )); idx := fPlayers.IndexOf( MediaId ); if idx >= 0 then TMP3Player(fPlayers.Objects[idx]).Pause; result := urlHandled; end; function Resume : TURLHandlingResult; var MediaId : string; idx : integer; begin MediaId := uppercase(URLParser.GetParmValue( URL, htmlParmName_MediaId )); idx := fPlayers.IndexOf( MediaId ); if idx >= 0 then TMP3Player(fPlayers.Objects[idx]).Play; result := urlHandled; end; function SetVolume( URL : string ) : TURLHandlingResult; var MediaId : string; Volume : integer; idx : integer; begin MediaId := uppercase(URLParser.GetParmValue( URL, htmlParmName_MediaId )); Volume := StrToInt(URLParser.GetParmValue( URL, htmlParmName_Volume )); idx := fPlayers.IndexOf( MediaId ); if idx >= 0 then TMP3Player(fPlayers.Objects[idx]).Volume:= Volume; fLastVolume := Volume; result := urlHandled; end; var Action : string; begin Action := URLParser.GetURLAction( URL ); if not fDisabled then begin if Action = htmlAction_Play then result := Play( URL ) else if Action = htmlAction_Stop then result := Stop( URL ) else if Action = htmlAction_Pause then result := Pause else if Action = htmlAction_Resume then result := Resume else if Action = htmlAction_SetVolume then result := SetVolume( URL ) else result := urlNotHandled; end else result := urlHandled; end; function TMP3Handler.HandleEvent( EventId : TEventId; var info ) : TEventHandlingResult; begin result := evnHandled; end; function TMP3Handler.getControl : TControl; begin result := nil; end; procedure TMP3Handler.setMasterURLHandler( URLHandler : IMasterURLHandler ); begin fMasterURLHandler := URLHandler; end; procedure TMP3Handler.PlayerState(Sender : TMP3Player; PrevState, NewState : TMP3PlayerState); function GetMediaIdOf( Player : TObject ) : string; var i : integer; begin i := 0; while (i < fPlayers.Count) and (fPlayers.Objects[i] <> Player) do inc( i ); if i < fPlayers.Count then result := fPlayers[i] else result := ''; end; var Info : TMediaStatusInfo; begin Info.MediaId := GetMediaIdOf( Sender ); case NewState of mpsStopped : if (Info.MediaId <> '') then begin Info.Status := nvSuccessful; fMasterURLHandler.HandleEvent( evnMediaStatusChanged, Info ); end; end; end; end.
//**************************************************************** // // Inventory Control // // Copyright (c) 2002-2005 TAI, Failproof Manufacturing Systems. // //**************************************************************** // // Change History // // 09/14/2004 David Verespey Create Form // 05/27/2005 David verespey Break form into parts Read Daily Build/ ASN report/ Invoice report // unit DailyBuildTotal; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, History, ComObj, Excel2000, DB, DBTables, ExtCtrls; type TFormMode=(fmDaily,fmASN,fmINVOICE); TDailyBuildtotalForm = class(TForm) Hist: THistory; DoneButton: TButton; RunTimer: TTimer; procedure DoneButtonClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure RunTimerTimer(Sender: TObject); private { Private declarations } fToDate:TDate; fFromDate:TDate; fLine:string; fFileName:string; fFormMode:TFormMode; public { Public declarations } procedure Execute; property FileName:string read fFileName write fFileName; property FormMode:TFormMode read fFormMode write fFormMode; property Line:string read fLine write fLine; property FromDate:Tdate read fFromDate write fFromDate; property ToDate:TDate read fToDate write fToDate; end; var DailyBuildtotalForm: TDailyBuildtotalForm; excel,mysheet:variant; excelASN,mysheetASN:variant; excelINV,mysheetINV:variant; implementation uses DataModule; {$R *.dfm} procedure TDailyBuildtotalForm.Execute; begin ShowModal; end; procedure TDailyBuildtotalForm.DoneButtonClick(Sender: TObject); begin Close; end; procedure TDailyBuildtotalForm.FormShow(Sender: TObject); begin RunTimer.Enabled:=TRUE; end; procedure TDailyBuildtotalForm.RunTimerTimer(Sender: TObject); var z,x,i,count:integer; //devdatedone:boolean; invoicetotal:extended; lastpickup:string; begin RunTimer.Enabled:=FALSE; //devdatedone:=FALSE; application.ProcessMessages; lastpickup:=''; case fFormMode of // // Daily Process of input, update inventory and add information for later ASN/INV processing // // fmDaily: begin try Data_Module.LogActLog('ALC PULL','Start ALC Pull'); Hist.Append('Start ALC Pull'); application.ProcessMessages; // Open Worksheet with build info // excel := createOleObject('Excel.Application'); excel.visible := False; excel.DisplayAlerts := False; excel.workbooks.open(fFilename); Data_Module.LogActLog('ALC PULL','Filename='+fFilename); Hist.Append('Filename='+fFilename); mysheet := excel.workSheets[1]; // Check if today has already been processed // Data_Module.ProductionDate:=formatdatetime('yyyymmdd',StrToDate(mysheet.cells[3,2].value)); Data_Module.AssyCode := fLine; Data_Module.Inv_dataset.Filter:=''; Data_Module.Inv_dataset.Filtered:=FALSE; Data_Module.GetShippingInfo; if Data_Module.ProductionDate = Data_Module.Inv_DataSet.FieldByName('VC_PRODUCTION_DATE').AsString then begin // Already done post error // Data_Module.LogActLog('ALC PULL','Production Date:'+Data_Module.ProductionDate+', Already processed'); Hist.Append('Production Date:'+Data_Module.ProductionDate+', Already processed'); end else begin Data_Module.Inv_Connection.BeginTrans; // Find last entry i:=8; while not VarIsEmpty(mysheet.cells[i,8].value) do begin INC(i); end; count:=mysheet.cells[i-1,8].value; Data_Module.LogActLog('ALC PULL','Count='+IntToStr(count)); Hist.Append('Count='+IntToStr(count)); DAta_Module.Quantity:=Count; Data_Module.Continuation:=0; // If not, Move through worksheet add to daily build table // i:=8; while not VarIsEmpty(mysheet.cells[i,1].value) do begin Data_Module.AssyCode:=mysheet.cells[i,1].value; //Assembly Code Data_Module.Quantity:=mysheet.cells[i,8].value; // Build Qty if Data_Module.Quantity > 0 then begin // Remove inventory if not Data_Module.InsertExcelShippingInfo then begin if Data_Module.Inv_Connection.InTransaction then Data_Module.Inv_Connection.RollbackTrans; Data_Module.LogActLog('ALC PULL','Inventory update failure for Assembly('+Data_Module.AssyCode+')'); Hist.Append('Inventory update failure for Assembly('+Data_Module.AssyCode+')'); ShowMessage('Unable to process ALC pull, fix error and retry'); excel.Workbooks.Close; excel.Quit; excel:=Unassigned; mysheet:=Unassigned; DoneButton.Visible:=TRUE; exit; end else begin Data_Module.LogActLog('ALC PULL','Import Assy Code = '+Data_Module.AssyCode+', Count = '+IntToStr(Data_Module.Quantity)); Hist.Append('Import Assy Code = '+Data_Module.AssyCode+', Count = '+IntToStr(Data_Module.Quantity)); application.ProcessMessages; end; // Add to Build History if not Data_Module.InsertBuildHist then begin if Data_Module.Inv_Connection.InTransaction then Data_Module.Inv_Connection.RollbackTrans; Data_Module.LogActLog('BUILD HIST','Build Hist update failure for Assembly('+Data_Module.AssyCode+')'); Hist.Append('Build Hist update failure for Assembly('+Data_Module.AssyCode+')'); ShowMessage('Unable to process ALC pull, fix error and retry'); excel.Workbooks.Close; excel.Quit; excel:=Unassigned; mysheet:=Unassigned; DoneButton.Visible:=TRUE; exit; end else begin Data_Module.LogActLog('BUILD HIST','BUILD HIST Assy Code = '+Data_Module.AssyCode+', Count = '+IntToStr(Data_Module.Quantity)); Hist.Append('BUILD HIST Assy Code = '+Data_Module.AssyCode+', Count = '+IntToStr(Data_Module.Quantity)); application.ProcessMessages; end; end; INC(i); end; // // Do Scrap // Hist.Append('Do Scrap............'); i:=31; while not VarIsEmpty(mysheet.cells[i,8].value) do begin INC(i); end; x:=i-1; for i:=31 to x do begin if not VarIsEmpty(mysheet.cells[i,1].value) then begin if mysheet.cells[i,10].value <> 0 then begin // process scrap // // compare current with new and update if different // // Data_Module.PartNum:=copy(mysheet.cells[i,1].value,1,5)+copy(mysheet.cells[i,1].value,7,5)+'00'; Data_Module.ScrapCount:=mysheet.cells[i,10].value; z:=Data_Module.InsertAutoScrap; if z > 0 then begin Data_Module.LogActLog('SCRAP','Partnumber = '+Data_Module.PartNum+', Count = '+IntToStr(z)); Hist.Append('Scrap Partnumber = '+Data_Module.PartNum+', Count = '+IntToStr(z)); end else if z < 0 then begin Data_Module.LogActLog('ERROR','Unable to Scrap Partnumber = '+Data_Module.PartNum+', Count = '+IntToStr(z)); Hist.Append('Failed to Scrap Partnumber = '+Data_Module.PartNum+', Count = '+IntToStr(z)); end; end; end; end; Hist.Append('Scrap Complete............'); Data_Module.Quantity:=count; Data_Module.CarTruck:=fLine; Data_Module.InsertExcelShippingEndInfo; Data_Module.Inv_Connection.CommitTrans; end; excel.Workbooks.Close; excel.Quit; excel:=Unassigned; mysheet:=Unassigned; except on e:exception do begin Data_Module.LogActLog('ERROR','Failed on Daily Build, '+e.Message); Hist.Append('Failed on Daily Build, '+e.Message); if Data_Module.Inv_Connection.InTransaction then Data_Module.Inv_Connection.RollbackTrans; excel.Workbooks.Close; excel.Quit; excel:=Unassigned; mysheet:=Unassigned; end; end; end; fmASN: begin try Data_Module.LogActLog('ASN CREATE','Start ASN'); Hist.Append('Start ASN'); application.ProcessMessages; // // Get Data based on range Data_Module.BeginDate:=fFromDate; Data_Module.EndDate:=fToDate; Data_Module.LogActLog('ASN CREATE','ASN From='+FormatDateTime('yyyymmdd',fFromDate)+'To='+FormatDateTime('yyyymmdd',fToDate)); Hist.Append('ASN From='+FormatDateTime('yyyymmdd',fFromDate)+'To='+FormatDateTime('yyyymmdd',fToDate)); Data_Module.ASN:=1; Data_Module.INVOICE:=0; Data_Module.GetBuildHist; if Data_Module.Inv_DataSet.RecordCount > 0 then begin Data_Module.Inv_Connection.BeginTrans; count:=0; // Loop records while not Data_Module.Inv_DataSet.Eof do begin if lastpickup <> Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString then begin if lastpickup <> '' then begin // close old // // Save ASN // excelASN.ActiveWorkbook.SaveAs(Data_Module.fiReportsOutputDir.AsString+'\ASN'+formatdatetime('yyyymmddhhmmss0',now)+IntToStr(count)+'.csv',xlCSV); INC(count); excelASN.Workbooks.Close; excelASN.Quit; excelASN:=Unassigned; mysheetASN:=Unassigned; Data_Module.LogActLog('ASN CREATE','Finish ASN PickUpDate='+lastpickup+'PickUptime='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_TIME').AsString); Hist.Append('Finish ASN PickUpDate='+lastpickup+'PickUptime='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_TIME').AsString); end; lastpickup:=Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString; // // Create ASN // excelASN := createOleObject('Excel.Application'); excelASN.visible := FALSE; excelASN.DisplayAlerts := False; excelASN.workbooks.add; mysheetASN := excelASN.workSheets[1]; mysheetASN.Columns[3].NumberFormat := '@'; mysheetASN.Columns[2].NumberFormat := '@'; //ASN Header mysheetASN.Cells[1,1].value := 'H'; //Qualifier mysheetASN.Cells[1,2].value := Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString; //Pickup Date mysheetASN.Cells[1,3].value := Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_TIME').AsString; //Pickup Time mysheetASN.Cells[1,4].value := 'PT'; //Ship Code mysheetASN.Cells[1,5].value := 'ASM'; //Packaging Code mysheetASN.Cells[1,6].value := ''; //Lading Qty mysheetASN.Cells[1,7].value := ''; //Carrier Supplier Code mysheetASN.Cells[1,8].value := ''; //Equipment Description Code mysheetASN.Cells[1,9].value := ''; //Equipment Number x:=2; Data_Module.LogActLog('ASN CREATE','ASN PickUpDate='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString+' PickUptime='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_TIME').AsString); Hist.Append('ASN PickUpDate='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString+' PickUptime='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_TIME').AsString); end; //ASN PO line mysheetASN.Cells[x,1].value := 'O'; //Qualifier mysheetASN.Cells[x,2].value := Data_module.Inv_DataSet.FieldByName('VC_PO_NUMBER').AsString; //PO Number INC(X); //ASN item line mysheetASN.Cells[x,1].value := 'I'; //Qualifier mysheetASN.Cells[x,2].NumberFormat := '@'; mysheetASN.Cells[x,2].value := Data_module.Inv_DataSet.FieldByName('VC_ASSY_PART_NUMBER_CODE').AsString; // PartNumber mysheetASN.Cells[x,3].NumberFormat := '@'; mysheetASN.Cells[x,3].value := Data_module.Inv_DataSet.FieldByName('VC_ASSY_PART_NUMBER_CODE').AsString; // Customer Partnumber //mysheetASN.Cells[x,4].value := Data_module.Inv_DataSet.FieldByName('Qty').AsString; // Units Shipped // Use the lesser requested value, PO will not be fully charged against {if Data_module.Inv_DataSet.FieldByName('IN_QTY').AsInteger < Data_module.Inv_DataSet.FieldByName('Available').AsInteger then begin mysheetASN.Cells[x,4].value := Data_module.Inv_DataSet.FieldByName('IN_QTY').AsString; // Units Shipped Data_Module.Quantity := Data_module.Inv_DataSet.FieldByName('IN_QTY').AsInteger; end // Else use the PO amount. If equal the PO will be filled, if greater than it has already been charge against or this line fills it completely else begin mysheetASN.Cells[x,4].value := Data_module.Inv_DataSet.FieldByName('Available').AsString; // Units Shipped Data_Module.Quantity := Data_module.Inv_DataSet.FieldByName('Available').AsInteger; end;} mysheetASN.Cells[x,4].value := Data_module.Inv_DataSet.FieldByName('IN_PO_QTY').AsString; // Units Shipped Data_Module.Quantity := Data_module.Inv_DataSet.FieldByName('IN_PO_QTY').AsInteger; mysheetASN.Cells[x,5].value := 'EA'; //Basis Code INC(X); Data_Module.LogActLog('ASN CREATE','ASN AssyCode='+Data_module.Inv_DataSet.FieldByName('VC_ASSY_PART_NUMBER_CODE').AsString+ 'PONumber='+Data_module.Inv_DataSet.FieldByName('VC_PO_NUMBER').AsString+ 'Qty='+Data_module.Inv_DataSet.FieldByName('IN_PO_QTY').AsString); Hist.Append('ASN AssyCode='+Data_module.Inv_DataSet.FieldByName('VC_ASSY_PART_NUMBER_CODE').AsString+ ' PONumber='+Data_module.Inv_DataSet.FieldByName('VC_PO_NUMBER').AsString+ ' Qty='+Data_module.Inv_DataSet.FieldByName('IN_PO_QTY').AsString); // Add to Charged Data_Module.AssyCode:=Data_module.Inv_DataSet.FieldByName('VC_ASSY_PART_NUMBER_CODE').AsString; Data_Module.ProductionDate:=Data_module.Inv_DataSet.FieldByName('VC_PRODUCTION_DATE').AsString; Data_Module.PickUp:=Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString; //Data_Module.Quantity:=Data_module.Inv_DataSet.FieldByName('Available').AsInteger; Data_Module.PONumber:=Data_module.Inv_DataSet.FieldByName('VC_PO_NUMBER').AsString; if not Data_Module.InsertPOCharged then begin if data_Module.Inv_Connection.InTransaction then Data_Module.Inv_Connection.RollbackTrans; excelASN.Workbooks.Close; excelASN.Quit; excelASN:=Unassigned; mysheetASN:=Unassigned; Data_Module.LogActLog('ASN CREATE','Failed ASN'); Hist.Append('Fail on ASN Create'); ShowMessage('Fail on ASN Create'); DoneButton.Visible:=TRUE; exit; end; Data_Module.Inv_DataSet.Next; end; // // Save ASN // excelASN.ActiveWorkbook.SaveAs(Data_Module.fiReportsOutputDir.AsString+'\ASN'+formatdatetime('yyyymmddhhmmss',now)+IntToStr(count)+'.csv',xlCSV); excelASN.Workbooks.Close; excelASN.Quit; excelASN:=Unassigned; mysheetASN:=Unassigned; Data_Module.LogActLog('ASN CREATE','Finish ASN PickUpDate='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString+'PickUptime='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_TIME').AsString); Hist.Append('Finish ASN PickUpDate='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString+' PickUptime='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_TIME').AsString); Data_Module.Inv_Connection.CommitTrans; // // Update ASN Bit //Data_Module.UpdateASNDone; end else begin Data_Module.LogActLog('ASN','No ASN records for range'); Hist.Append('No ASN records for range'); end; except on e:exception do begin if data_Module.Inv_Connection.InTransaction then Data_Module.Inv_Connection.RollbackTrans; Data_Module.LogActLog('ERROR','Failed on ASN, '+e.Message); Hist.Append('Failed on ASN, '+e.Message); ShowMessage('Fail on ASN Create'); excelASN.Workbooks.Close; excelASN.Quit; excelASN:=Unassigned; mysheetASN:=Unassigned; end; end; end; fmINVOICE: begin try Data_Module.LogActLog('INV CREATE','Start INVOICE'); Hist.Append('Start INVOICE'); application.ProcessMessages; // // Get Data based on range Data_Module.BeginDate:=fFromDate; Data_Module.EndDate:=fToDate; Data_Module.LogActLog('INV CREATE','INVOICE From='+FormatDateTime('yyyymmdd',fFromDate)+' To='+FormatDateTime('yyyymmdd',fToDate)); Hist.Append('INVOICE From='+FormatDateTime('yyyymmdd',fFromDate)+' To='+FormatDateTime('yyyymmdd',fToDate)); Data_Module.ASN:=0; Data_Module.INVOICE:=1; Data_Module.GetBuildHist; invoicetotal:=0; count:=0; if Data_Module.Inv_DataSet.RecordCount > 0 then begin // Loop records Data_Module.Inv_Connection.BeginTrans; while not Data_Module.Inv_DataSet.Eof do begin if lastpickup <> Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString then begin if lastpickup <> '' then begin // // Save Invoice // mysheetINV.Cells[z,1].value := 'T'; // Qualifier mysheetINV.Cells[z,2].value := floattostrf(invoicetotal,ffFixed,12,4); // Invoice total excelINV.ActiveSheet.SaveAs(Data_Module.fiReportsOutputDir.AsString+'\INV'+formatdatetime('yyyymmddhhmmss0',now)+IntToStr(count)+'.csv',xlCSV ); INC(count); excelINV.Workbooks.Close; excelINV.Quit; excelINV:=Unassigned; mysheetINV:=Unassigned; Hist.Append('Finish INVOICE PickUpDate='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString+' PickUptime='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_TIME').AsString); Data_Module.LogActLog('INV CREATE','Finish ASN PickUpDate='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString+' PickUptime='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_TIME').AsString); end; // // Create INVOICE // excelINV := createOleObject('Excel.Application'); excelINV.visible := FALSE; excelINV.DisplayAlerts := False; excelINV.workbooks.add; mysheetINV := excelINV.workSheets[1]; mysheetINV.Columns[6].NumberFormat := '@'; //INVOICE Header mysheetINV.Range['B1','C1'].NumberFormat := '@'; mysheetINV.Range['B1','B1'].Value:=copy(Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString,3,6); //Invoice Date mysheetINV.Range['C1','C1'].Value:='01'+copy(Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString,3,6); //Invoice Number mysheetINV.Cells[1,1].value := 'H'; //Qualifier z:=2; invoicetotal:=0; lastpickup:=Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString; end; // Add Line to INVOICE mysheetINV.Cells[z,1].value := 'I'; // Qualifier mysheetINV.Cells[z,2].value := Data_module.Inv_DataSet.FieldByName('IN_QTY_CHARGED').AsString; // Units Shipped mysheetINV.Cells[z,3].value := ''; // Basis Code mysheetINV.Cells[z,4].value := Data_module.Inv_DataSet.FieldByName('MO_ASSEMBLY_COST').AsString; // Unit Price mysheetINV.Cells[z,5].value := ''; // Basis of unit price Code mysheetINV.Cells[z,6].NumberFormat := '@'; mysheetINV.Cells[z,6].value := Data_module.Inv_DataSet.FieldByName('VC_ASSY_PART_NUMBER_CODE').AsString; // Customer Partnumber mysheetINV.Cells[z,7].value := ''; // Product B mysheetINV.Cells[z,8].value := ''; // Product C mysheetINV.Cells[z,9].value := Data_module.Inv_DataSet.FieldByName('VC_PO_NUMBER').AsString; // Reference USE This to send PO mysheetINV.Cells[z,10].value := Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString; // Date INC(z); Data_Module.LogActLog('INV CREATE','INVOICE AssyCode='+Data_module.Inv_DataSet.FieldByName('VC_ASSY_PART_NUMBER_CODE').AsString+ ' PONumber='+Data_module.Inv_DataSet.FieldByName('VC_PO_NUMBER').AsString+ ' Qty='+Data_module.Inv_DataSet.FieldByName('IN_QTY_CHARGED').AsString); Hist.Append('INVOICE AssyCode='+Data_module.Inv_DataSet.FieldByName('VC_ASSY_PART_NUMBER_CODE').AsString+ ' PONumber='+Data_module.Inv_DataSet.FieldByName('VC_PO_NUMBER').AsString+ ' Qty='+Data_module.Inv_DataSet.FieldByName('IN_QTY_CHARGED').AsString); invoicetotal:=invoicetotal+Data_module.Inv_DataSet.FieldByName('totalcost').AsFloat; // // Update INVOICE Bit Data_Module.INVOICE:=Data_module.Inv_DataSet.FieldByName('IN_CHARGE_ID').AsInteger; if not Data_Module.UpdateINVDone then begin if data_Module.Inv_Connection.InTransaction then Data_Module.Inv_Connection.RollbackTrans; excelINV.Workbooks.Close; excelINV.Quit; excelINV:=Unassigned; mysheetINV:=Unassigned; Data_Module.LogActLog('ERROR','Failed on INVOICE'); Hist.Append('Failed on INVOICE'); ShowMessage('Fail on INVOICE Create'); DoneButton.Visible:=TRUE; exit; end; Data_Module.Inv_DataSet.Next; end; // // Save Invoice // mysheetINV.Cells[z,1].value := 'T'; // Qualifier mysheetINV.Cells[z,2].value := floattostrf(invoicetotal,ffFixed,12,4); // Invoice total excelINV.ActiveSheet.SaveAs(Data_Module.fiReportsOutputDir.AsString+'\INV'+formatdatetime('yyyymmddhhmmss0',now)+IntToStr(count)+'.csv',xlCSV ); excelINV.Workbooks.Close; excelINV.Quit; excelINV:=Unassigned; mysheetINV:=Unassigned; Hist.Append('Finish INVOICE PickUpDate='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString+'PickUptime='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_TIME').AsString); Data_Module.LogActLog('INV CREATE','Finish ASN PickUpDate='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_DATE').AsString+'PickUptime='+Data_module.Inv_DataSet.FieldByName('VC_PICK_UP_TIME').AsString); Data_Module.Inv_Connection.CommitTrans; end else begin Data_Module.LogActLog('INV','No INVOICE records for range'); Hist.Append('No INVOICE records for range'); end; except on e:exception do begin if data_Module.Inv_Connection.InTransaction then Data_Module.Inv_Connection.RollbackTrans; excelINV.Workbooks.Close; excelINV.Quit; excelINV:=Unassigned; mysheetINV:=Unassigned; Data_Module.LogActLog('ERROR','Failed on INVOICE, '+e.Message); Hist.Append('GetBuildHistFailed on INVOICE, '+e.Message); ShowMessage('Fail on INVOICE Create'); end; end; end; end; DoneButton.Visible:=TRUE; end; end.
unit DelphiUp.View.Services.Utils; interface uses FMX.Objects; type TServiceUtils = class private public class procedure ResourceImage( aResource : String; aImage : TImage); end; implementation uses System.Classes, System.Types; { TServiceUtils } class procedure TServiceUtils.ResourceImage(aResource: String; aImage: TImage); var Resource : TResourceStream; begin Resource := TResourceStream.Create(HInstance, aResource, RT_RCDATA); try aImage.Bitmap.LoadFromStream(Resource); finally Resource.Free; end; end; end.
unit UFormConv; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Misc; type TFormConv = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; edX0: TEdit; edX1: TEdit; edY1: TEdit; edY0: TEdit; edYmin: TEdit; BtnOk: TButton; BtnCancel: TButton; BtnApply: TButton; procedure FormShow(Sender: TObject); procedure BtnOkClick(Sender: TObject); procedure BtnApplyClick(Sender: TObject); private { Private declarations } function Validate:Boolean; public { Public declarations } X0,X1,Y0,Y1,Ymin:Double; end; var FormConv: TFormConv; implementation {$R *.DFM} procedure TFormConv.FormShow(Sender: TObject); begin edX0.Text:=FloatToStr(X0); edX1.Text:=FloatToStr(X1); edY0.Text:=FloatToStr(Y0); edY1.Text:=FloatToStr(Y1); edYmin.Text:=FloatToStr(Ymin); end; function TFormConv.Validate: Boolean; const MX = 3.4E+38; begin try CheckMinMax(X0,0,1,edX0); CheckMinMax(Y0,-MX,+MX,edY0); CheckMinMax(X1,0,1,edX1); CheckMinMax(Y1,-MX,+MX,edY1); CheckMinMax(Ymin,-MX,Y0,edYmin); if X0=X1 then raise Exception.Create('Значение X0 должно отличаться от X1'); Result:=True; except on E:Exception do begin Application.MessageBox(PChar(E.Message),'Ошибка',MB_ICONERROR or MB_OK); Result:=False; end; end; end; procedure TFormConv.BtnOkClick(Sender: TObject); begin if Validate then ModalResult:=mrOK; end; procedure TFormConv.BtnApplyClick(Sender: TObject); begin if Validate then ModalResult:=mrYes; end; end.
/// /// MVCBr.FormView - implements base class of FormView /// Auth: amarildo lacerda /// Date: jan/2017 { Changes: 29-mar-2017 + MainViewEvent - send ViewEvent to MainView by: amarildo lacerda + ViewEventOther - send ViewEvent to other VIEW } unit MVCBr.FormView; interface uses {$IFDEF LINUX} {$ELSE} {$IFDEF FMX} FMX.Forms, System.UiTypes, {$ELSE} VCL.Forms, {$ENDIF}{$ENDIF} System.Classes, System.SysUtils, System.RTTI, System.JSON, MVCBr.ApplicationController, MVCBr.Interf, MVCBr.View; type {$IFDEF FMX} TFormClass = class of TForm; {$ENDIF} TViewFactoryAdapter = class; IViewAdpater = interface(IView) ['{A5FCFDC8-67F2-4202-AED1-95314077F28F}'] function Form: {$IFDEF LINUX} TComponent {$ELSE} TForm{$ENDIF}; function ThisAs: TViewFactoryAdapter; end; /// <summary> /// TViewFactoryAdpater é um conector para receber um FORM, /// a ser utilizado para formularios que não herdam diretamente de TFormFactory /// </summary> TViewFactoryAdapter = class(TViewFactory, IViewAdpater) private FisShowModal: boolean; FOnProc: TProc<IView>; procedure SetisShowModal(const Value: boolean); protected FForm: {$IFDEF LINUX} TComponent {$ELSE} TForm{$ENDIF}; {$IFDEF LINUX} {$ELSE} procedure DoClose(Sender: TObject; var Action: TCloseAction); {$ENDIF} public class function New(AClass: {$IFDEF LINUX} TComponentClass {$ELSE} TFormClass{$ENDIF}; const AShowModal: boolean = true): IView; overload; class function New(AForm: {$IFDEF LINUX} TComponent {$ELSE} TForm{$ENDIF}; const AShowModal: boolean = true): IView; overload; property isShowModal: boolean read FisShowModal write SetisShowModal; function ShowView(const AProc: TProc<IView>): Integer; override; function Form: {$IFDEF LINUX} TComponent {$ELSE} TForm{$ENDIF}; function ThisAs: TViewFactoryAdapter; function This: TObject; end; /// <summary> /// TFormFactory é utilizado para herança dos TForms para transformar o FORM em VIEW no MVCBr /// </summary> TFormFactory = class({$IFDEF LINUX} TComponent{$ELSE} TForm{$ENDIF}, IMVCBrBase, IView) private FEventRef: Integer; FID: string; {$IFDEF LINUX} FCaption: string; {$ELSE} FOnClose: TCloseEvent; procedure SetOnClose(const Value: TCloseEvent); {$ENDIF} function GetPropertyValue(ANome: string): TValue; procedure SetPropertyValue(ANome: string; const Value: TValue); function GetText: string; procedure SetText(const Value: string); protected FOnCloseProc: TProc<IView>; FController: IController; FShowModal: boolean; // FViewModel:IViewModel; {$IFDEF LINUX} {$ELSE} procedure DoCloseView(Sender: TObject; var ACloseAction: TCloseAction); {$ENDIF} procedure SetController(const AController: IController); function Controller(const AController: IController): IView; virtual; procedure SetShowModal(const AShowModal: boolean); /// Retorna se a apresentação do formulário é ShowModal function GetShowModal: boolean; public procedure AfterConstruction; override; procedure Init; virtual; function ApplicationControllerInternal: IApplicationController; function ApplicationController: TApplicationController; constructor Create(AOwner: TComponent); override; destructor Destroy; override; function GetGuid(AII: IInterface): TGuid; function ViewEvent(AMessage: string; var AHandled: boolean): IView; overload; virtual; function ViewEvent(AMessage: TJsonValue; var AHandled: boolean): IView; overload; virtual; function MainViewEvent(AMessage: string; var AHandled: boolean) : IView; virtual; function ViewEventOther(AMessage: string; var AHandled: boolean): IView; Procedure DoCommand(ACommand: string; const AArgs: array of TValue); virtual; function GetID: string; property isShowModal: boolean read GetShowModal write SetShowModal; /// Retorna o controller ao qual a VIEW esta conectada function GetController: IController; virtual; /// Retorna o SELF function This: TObject; virtual; /// Executa um method genérico do FORM/VIEW function InvokeMethod<T>(AMethod: string; const Args: TArray<TValue>): T; function ResolveController(const IID: TGuid): IController; overload; virtual; function ResolveController<TIController>: TIController; overload; function GetModel<TIModel>: TIModel; overload; function GetModel(AII: TGuid): IModel; overload; /// Obter ou Alterar o valor de uma propriedade do ObjetoClass (VIEW) property PropertyValue[ANome: string]: TValue read GetPropertyValue write SetPropertyValue; /// Apresenta o VIEW para o usuario function ShowView(const IIDController: TGuid; const AProcBeforeShow: TProc<IView>; const AProcONClose: TProc<IView>) : IView; overload; virtual; function ShowView(const AProcBeforeShow: TProc<IView>): Integer; overload; virtual; function ShowView(const AProcBeforeShow: TProc<IView>; AShowModal: boolean) : Integer; overload; virtual; function ShowView(const IIDController: TGuid; const AProcBeforeShow: TProc<IView>): IView; overload; virtual; function ShowView(const IIDController: TGuid): IView; overload; virtual; function ShowView(): IView; overload; procedure SetViewModel(const AViewModel: IViewModel); virtual; function GetViewModel: IViewModel; virtual; /// Evento para atualizar os dados da VIEW function Update: IView; virtual; property Text: string read GetText write SetText; published {$IFDEF LINUX} {$ELSE} property OnClose: TCloseEvent read FOnClose write SetOnClose; {$ENDIF} end; implementation { TViewFormFacotry } procedure TFormFactory.AfterConstruction; begin inherited; FShowModal := true; end; /// Set Controller to VIEW function TFormFactory.Controller(const AController: IController): IView; begin result := self; FController := AController; end; var LViewsCount: Integer = 0; /// counter to instance of VIEW constructor TFormFactory.Create(AOwner: TComponent); begin inherited; FEventRef := 0; inc(LViewsCount); FID := classname + '_' + intToStr(LViewsCount); end; destructor TFormFactory.Destroy; begin if assigned(FController) then FController.This.RevokeInstance(FController); // clear controller FController := nil; inherited; end; function TFormFactory.GetController: IController; begin result := FController; end; function TFormFactory.GetGuid(AII: IInterface): TGuid; begin result := TMVCBr.GetGuid(AII); end; function TFormFactory.GetID: string; begin result := FID; end; function TFormFactory.GetModel(AII: TGuid): IModel; begin FController.GetModel(AII, result); end; function TFormFactory.GetModel<TIModel>: TIModel; begin result := FController.This.GetModel<TIModel>; end; function TFormFactory.GetPropertyValue(ANome: string): TValue; begin result := TMVCBr.GetProperty(self, ANome); end; function TFormFactory.GetShowModal: boolean; begin result := FShowModal; end; function TFormFactory.GetText: string; begin {$IFDEF LINUX} result := FCaption; {$ELSE} {$IFDEF FMX} result := inherited Caption; {$ELSE} result := inherited Caption; {$ENDIF} {$ENDIF} end; function TFormFactory.GetViewModel: IViewModel; begin result := nil; if assigned(FController) then result := FController.GetModelByType(mtViewModel) as IViewModel; end; procedure TFormFactory.Init; begin end; function TFormFactory.InvokeMethod<T>(AMethod: string; const Args: TArray<TValue>): T; begin result := TMVCBr.InvokeMethod<T>(self, AMethod, Args); end; function TFormFactory.ResolveController(const IID: TGuid): IController; begin result := FController.This.ResolveController(IID); end; function TFormFactory.ResolveController<TIController>: TIController; begin result := GetController.This.ResolveController<TIController>(); end; procedure TFormFactory.SetController(const AController: IController); begin FController := AController; end; {$IFDEF LINUX} {$ELSE} procedure TFormFactory.SetOnClose(const Value: TCloseEvent); begin FOnClose := Value; end; procedure TFormFactory.DoCloseView(Sender: TObject; var ACloseAction: TCloseAction); begin if assigned(FOnCloseProc) then FOnCloseProc(self); if assigned(FOnClose) then FOnClose(Sender, ACloseAction); end; {$ENDIF} function TFormFactory.ApplicationController: TApplicationController; begin result := TApplicationController (MVCBr.ApplicationController.ApplicationController.This); end; function TFormFactory.ApplicationControllerInternal: IApplicationController; begin result := MVCBr.ApplicationController.ApplicationController; end; procedure TFormFactory.DoCommand(ACommand: string; const AArgs: array of TValue); begin end; function TFormFactory.ViewEvent(AMessage: TJsonValue; var AHandled: boolean): IView; begin result := self; end; function TFormFactory.ViewEventOther(AMessage: string; var AHandled: boolean): IView; begin result := self; if FEventRef = 0 then begin /// check NO LOOP /// takecare with this lines... dont put your code in LOOP /// sometimes you will need some override to broken LOOPs /// if other view call this event, it will drop at second calls /// a better implementation its call ViewEvent to 1 VIEW only by her TGUID (IInterface) inc(FEventRef); try ApplicationController.ViewEventOther(GetController, AMessage, AHandled); finally dec(FEventRef); end; end; end; function TFormFactory.ViewEvent(AMessage: string; var AHandled: boolean): IView; begin result := self; /// use inherited this method on child /// takecare put code here and start a loop whithout end end; function TFormFactory.MainViewEvent(AMessage: string; var AHandled: boolean): IView; begin ApplicationController.MainView.ViewEvent(AMessage, AHandled); end; procedure TFormFactory.SetPropertyValue(ANome: string; const Value: TValue); begin TMVCBr.SetProperty(self, ANome, Value); end; procedure TFormFactory.SetShowModal(const AShowModal: boolean); begin FShowModal := AShowModal; end; procedure TFormFactory.SetText(const Value: string); begin {$IFDEF LINUX} FCaption := Value; {$ELSE} {$IFDEF FMX} Inherited Caption := Value; {$ELSE} Inherited Caption := Value; {$ENDIF} {$ENDIF} end; procedure TFormFactory.SetViewModel(const AViewModel: IViewModel); begin // fazer herança if assigned(AViewModel) then AViewModel.View(self); end; function TFormFactory.ShowView(const IIDController: TGuid): IView; begin result := ShowView(IIDController, procedure(Sender: IView) begin // stub to nothing.. end); end; function TFormFactory.ShowView(const IIDController: TGuid; const AProcBeforeShow: TProc<IView>): IView; var LController: IController; begin result := nil; LController := ResolveController(IIDController); if assigned(LController) then begin result := LController.GetView; result.ShowView(AProcBeforeShow); end; end; function TFormFactory.ShowView(const AProcBeforeShow: TProc<IView>): Integer; begin result := 0; if assigned(AProcBeforeShow) then AProcBeforeShow(self); {$IFDEF LINUX} {$ELSE} {$IFDEF MSWINDOWS} if FShowModal then result := ord(ShowModal); {$ELSE} Show; {$ENDIF} {$ENDIF} end; function TFormFactory.ShowView(const IIDController: TGuid; const AProcBeforeShow: TProc<IView>; const AProcONClose: TProc<IView>): IView; var ctrl: IController; begin result := nil; ctrl := ResolveController(IIDController); if assigned(ctrl) then begin result := ctrl.GetView; if assigned(AProcBeforeShow) then AProcBeforeShow(TFormFactory(result.This)); FOnCloseProc := AProcONClose; {$IFDEF LINUX} {$ELSE} OnClose := DoCloseView; {$ENDIF} result.ShowView(); end; end; function TFormFactory.This: TObject; begin result := self; end; function TFormFactory.Update: IView; begin result := self; end; { TViewFactoryAdapter } {$IFDEF LINUX} {$ELSE} procedure TViewFactoryAdapter.DoClose(Sender: TObject; var Action: TCloseAction); begin if assigned(FOnProc) then FOnProc(self); if assigned(FForm) and assigned(FForm.OnClose) then FForm.OnClose(Sender, Action); end; {$ENDIF} function TViewFactoryAdapter.Form: {$IFDEF LINUX} TComponent{$ELSE} TForm{$ENDIF}; begin result := FForm; end; class function TViewFactoryAdapter.New(AForm: {$IFDEF LINUX} TComponent{$ELSE} TForm{$ENDIF}; const AShowModal: boolean): IView; var obj: TViewFactoryAdapter; begin obj := TViewFactoryAdapter.Create; obj.FForm := AForm; obj.isShowModal := AShowModal; result := obj; end; class function TViewFactoryAdapter.New(AClass: {$IFDEF LINUX} TComponentClass{$ELSE} TFormClass{$ENDIF}; const AShowModal: boolean): IView; var obj: TViewFactoryAdapter; begin obj := TViewFactoryAdapter.Create; obj.FForm := AClass.Create(nil); obj.isShowModal := AShowModal; result := obj; end; procedure TViewFactoryAdapter.SetisShowModal(const Value: boolean); begin FisShowModal := Value; end; function TViewFactoryAdapter.ShowView(const AProc: TProc<IView>): Integer; begin FOnProc := AProc; {$IFDEF LINUX} {$ELSE} if isShowModal then begin result := ord(FForm.ShowModal); if assigned(AProc) then AProc(self); end else begin FForm.OnClose := DoClose; FForm.Show; end; {$ENDIF} end; function TViewFactoryAdapter.This: TObject; begin result := self; // nao alterar... é esperado retornuar um view como retorno end; function TViewFactoryAdapter.ThisAs: TViewFactoryAdapter; begin result := self; end; function TFormFactory.ShowView: IView; begin result := self; ShowView(nil); end; function TFormFactory.ShowView(const AProcBeforeShow: TProc<IView>; AShowModal: boolean): Integer; begin FShowModal := AShowModal; result := ShowView(AProcBeforeShow); end; end.
unit GX_OpenFileConfig; interface uses Classes, Controls, Forms, StdCtrls, Buttons, ComCtrls, ExtCtrls, GX_ConfigurationInfo, GX_BaseForm; type TIDEOverride = class(TStringList) private function GetOverrideOpenUnit: Boolean; procedure SetOverrideOpenUnit(Value: Boolean); function GetOverrideOpenForm: Boolean; procedure SetOverrideOpenForm(Value: Boolean); function GetOverrideOpenProject: Boolean; procedure SetOverrideOpenProject(Value: Boolean); function BooleanString(Value: Boolean): string; function GetOpenUnitDefaultType: string; procedure SetOpenUnitDefaultType(const Value: string); function GetOpenProjectDefaultType: string; procedure SetOpenProjectDefaultType(const Value: string); function GetOpenFormDefaultType: string; procedure SetOpenFormDefaultType(const Value: string); public property OverrideOpenForm: Boolean read GetOverrideOpenForm write SetOverrideOpenForm; property OverrideOpenProject: Boolean read GetOverrideOpenProject write SetOverrideOpenProject; property OpenUnitDefaultType: string read GetOpenUnitDefaultType write SetOpenUnitDefaultType; property OpenFormDefaultType: string read GetOpenFormDefaultType write SetOpenFormDefaultType; property OpenProjectDefaultType: string read GetOpenProjectDefaultType write SetOpenProjectDefaultType; property OverrideOpenUnit: Boolean read GetOverrideOpenUnit write SetOverrideOpenUnit; end; TFileType = class(TCollectionItem) private FFileTypeName: string; FExtensions: string; FPaths: TStringList; FCustomDirectories: Boolean; FRecursive: Boolean; FRecentFiles: TStringList; FMaxRecentFiles: Integer; FFavorites: TStringList; public constructor Create(Collection: TCollection); override; destructor Destroy; override; property FileTypeName: string read FFileTypeName write FFileTypeName; property Extensions: string read FExtensions write FExtensions; property Paths: TStringList read FPaths write FPaths; property CustomDirectories: Boolean read FCustomDirectories write FCustomDirectories; property Recursive: Boolean read FRecursive write FRecursive; property RecentFiles: TStringList read FRecentFiles write FRecentFiles; property MaxRecentFiles: Integer read FMaxRecentFiles write FMaxRecentFiles; property Favorites: TStringList read FFavorites write FFavorites; end; TFileTypes = class(TCollection) private function GetItem(Index: Integer): TFileType; public property Items[Index: Integer]: TFileType read GetItem; default; end; TOpenFileSettings = class(TObject) private procedure LoadDefaultSettings(FileTypes: TFileTypes); public MatchAnywhere: Boolean; DefaultFileType: string; IDEOverride: TIDEOverride; FileTypes: TFileTypes; ConfigurationKey: string; LastTabIndex: Integer; constructor Create; destructor Destroy; override; procedure InternalLoadSettings(Settings: TExpertSettings); procedure SaveToRegistry; procedure InternalSaveSettings(Settings: TExpertSettings); end; TfmOpenFileConfig = class(TfmBaseForm) pnlButtons: TPanel; pnlConfig: TPanel; pnlButtonsRight: TPanel; btnHelp: TButton; btnCancel: TButton; btnOK: TButton; pcConfigPages: TPageControl; tsTypes: TTabSheet; lblExtension: TLabel; lblMaxRecentFiles: TLabel; gbxCustomDirectory: TGroupBox; btnDirectory: TSpeedButton; lbxDirectoryList: TListBox; btnDirectoryAdd: TBitBtn; btnDirectoryDelete: TBitBtn; chkRecursive: TCheckBox; btnDirectoryReplace: TBitBtn; edtDirectory: TEdit; lbxTypeList: TListBox; edtExtension: TEdit; btnTypeAdd: TBitBtn; btnTypeDelete: TBitBtn; edtMaxRecentFiles: TEdit; tsIDEOptions: TTabSheet; gbxIDEMenuItems: TGroupBox; lblMenuItem: TLabel; lblFileGroup: TLabel; bvlRow: TBevel; chkOverrideViewUnit: TCheckBox; chkOverrideViewForm: TCheckBox; cbxViewUnitType: TComboBox; cbxViewFormType: TComboBox; chkOverrideOpenProject: TCheckBox; cbxOpenProjectType: TComboBox; gbxGeneralSettings: TGroupBox; lblDefault: TLabel; cbxDefaultFileTypes: TComboBox; chkMatchAnywhere: TCheckBox; chkCustomDirectoryList: TCheckBox; procedure chkCustomDirectoryListClick(Sender: TObject); procedure btnTypeAddClick(Sender: TObject); procedure lbxTypeListClick(Sender: TObject); procedure btnOKClick(Sender: TObject); procedure btnTypeDeleteClick(Sender: TObject); procedure btnDirectoryClick(Sender: TObject); procedure btnDirectoryAddClick(Sender: TObject); procedure btnDirectoryDeleteClick(Sender: TObject); procedure btnDirectoryReplaceClick(Sender: TObject); procedure lbxDirectoryListClick(Sender: TObject); procedure btnHelpClick(Sender: TObject); procedure FormCreate(Sender: TObject); private FCurrentFileType: TFileType; FSettings: TOpenFileSettings; procedure SaveConfigValue; function SelectDirectory: Boolean; procedure UseSettings(Settings: TOpenFileSettings); procedure SaveSettings(Settings: TOpenFileSettings); function GetFileTypes: TFileTypes; function IDEOverride: TIDEOverride; procedure lbxDirectoryListFilesDropped(Sender: TObject; Files: TStrings); public class function ExecuteWithSettings(Settings: TOpenFileSettings): Boolean; property FileTypes: TFileTypes read GetFileTypes; end; implementation uses SysUtils, Dialogs, GX_GenericUtils, GX_GxUtils, GX_dzVclUtils; {$R *.dfm} const DefaultMaxMRU = 100; { TFileType } constructor TFileType.Create(Collection: TCollection); begin inherited; FPaths := TStringList.Create; FRecentFiles := TStringList.Create; FRecentFiles.Sorted := True; FRecentFiles.Duplicates := dupIgnore; FFavorites := TStringList.Create; FFavorites.Sorted := True; FFavorites.Duplicates := dupIgnore; end; destructor TFileType.Destroy; begin FreeAndNil(FPaths); FreeAndNil(FRecentFiles); FreeAndNil(FFavorites); inherited; end; { TFileTypes } function TFileTypes.GetItem(Index: Integer): TFileType; begin Assert((Index > -1) and (Index < Count)); Result := inherited GetItem(Index) as TFileType; end; {TIDEOverride} function TIDEOverride.GetOverrideOpenUnit: Boolean; begin Result := (Values['OverrideOpenUnit'] = 'True'); end; procedure TIDEOverride.SetOverrideOpenUnit(Value: Boolean); begin if Values['OverrideOpenUnit'] = '' then Add('OverrideOpenUnit=' + BooleanString(Value)) else Values['OverrideOpenUnit'] := BooleanString(Value); end; function TIDEOverride.GetOverrideOpenForm: Boolean; begin Result := (Values['OverrideOpenForm'] = 'True'); end; procedure TIDEOverride.SetOverrideOpenForm(Value: Boolean); begin if Values['OverrideOpenForm'] = '' then Add('OverrideOpenForm=' + BooleanString(Value)) else Values['OverrideOpenForm'] := BooleanString(Value); end; function TIDEOverride.GetOverrideOpenProject: Boolean; begin Result := (Values['OverrideOpenProject'] = 'True'); end; procedure TIDEOverride.SetOverrideOpenProject(Value: Boolean); begin if Values['OverrideOpenProject'] = '' then Add('OverrideOpenProject=' + BooleanString(Value)) else Values['OverrideOpenProject'] := BooleanString(Value); end; function TIDEOverride.BooleanString(Value: Boolean): string; begin if Value then Result := 'True' else Result := 'False'; end; function TIDEOverride.GetOpenUnitDefaultType: string; begin Result := Values['OverrideOpenUnitDefault']; end; procedure TIDEOverride.SetOpenUnitDefaultType(const Value: string); begin if Values['OverrideOpenUnitDefault'] = '' then Add('OverrideOpenUnitDefault=' + Value) else Values['OverrideOpenUnitDefault'] := Value; end; function TIDEOverride.GetOpenProjectDefaultType: string; begin Result := Values['OverrideOpenProjectDefault']; end; procedure TIDEOverride.SetOpenProjectDefaultType(const Value: string); begin if Values['OverrideOpenProjectDefault'] = '' then Add('OverrideOpenProjectDefault=' + Value) else Values['OverrideOpenProjectDefault'] := Value; end; function TIDEOverride.GetOpenFormDefaultType: string; begin Result := Values['OverrideOpenFormDefault']; end; procedure TIDEOverride.SetOpenFormDefaultType(const Value: string); begin if Values['OverrideOpenFormDefault'] = '' then Add('OverrideOpenFormDefault=' + Value) else Values['OverrideOpenFormDefault'] := Value; end; { TOpenFileSettings } constructor TOpenFileSettings.Create; begin inherited; IDEOverride := TIDEOverride.Create; FileTypes := TFileTypes.Create(TFileType); end; destructor TOpenFileSettings.Destroy; begin FreeAndNil(IDEOverride); FreeAndNil(FileTypes); inherited; end; procedure TOpenFileSettings.LoadDefaultSettings(FileTypes: TFileTypes); var FileType: TFileType; begin FileTypes.Clear; FileType := TFileType.Create(FileTypes); FileType.FileTypeName := 'Delphi Units'; FileType.Extensions := '*.pas;*.inc'; FileType.MaxRecentFiles := DefaultMaxMRU; FileType := TFileType.Create(FileTypes); FileType.FileTypeName := 'Delphi Forms'; FileType.Extensions := '*.dfm;*.fmx;*.nfm;*.xfm'; FileType.MaxRecentFiles := DefaultMaxMRU; FileType := TFileType.Create(FileTypes); FileType.FileTypeName := 'Delphi Projects'; FileType.Extensions := '*.dpr;*.dpk;*.bpg;*.bdsproj;*.dproj;*.groupproj'; FileType.MaxRecentFiles := DefaultMaxMRU; FileType := TFileType.Create(FileTypes); FileType.FileTypeName := 'Text Files'; FileType.Extensions := '*.txt;*.html;*.htm;*.sql;*.py;*.iss;*.ini;*.bat;*.log;*.map;*.conf;*.dsk;*.rc;*.xml;*.pl'; FileType.MaxRecentFiles := DefaultMaxMRU; end; procedure TOpenFileSettings.InternalLoadSettings(Settings: TExpertSettings); const InvalidTypeName = '<invalid>'; var NumFileTypes: Integer; i: Integer; KeyString: string; FileType: TFileType; TypeName: string; FileTypeSettings: TExpertSettings; begin Assert(Assigned(Settings)); FileTypes.Clear; MatchAnywhere := Settings.ReadBool('MatchAnywhere', True); IDEOverride.Text := Settings.ReadString('IDEOverride', ''); DefaultFileType := Settings.ReadString('DefaultFileType', ''); NumFileTypes := Settings.ReadInteger('NumberFileTypes', 0); LastTabIndex := Settings.ReadInteger('LastTabIndex', 0); IDEOverride.CommaText := Settings.ReadString('IDEOverride', ''); if NumFileTypes > 0 then begin FileTypeSettings := Settings.CreateExpertSettings('FileTypes'); try for i := 0 to NumFileTypes - 1 do begin KeyString := IntToStr(i); TypeName := FileTypeSettings.ReadString('FileType' + KeyString, InvalidTypeName); if TypeName = InvalidTypeName then Continue; FileType := TFileType.Create(FileTypes); FileType.FileTypeName := TypeName; FileTypeSettings.ReadStrings('Paths' + KeyString, FileType.Paths); FileType.Extensions := FileTypeSettings.ReadString('Extensions' + KeyString, AllFilesWildCard); FileType.CustomDirectories := FileTypeSettings.ReadBool('CustomDirectory' + KeyString, False); FileType.Recursive := FileTypeSettings.ReadBool('RecursiveDirectory' + KeyString, False); FileTypeSettings.ReadStrings('RecentFiles' + KeyString, FileType.RecentFiles); FileTypeSettings.ReadStrings('Favorites' + KeyString, FileType.Favorites); FileType.MaxRecentFiles := FileTypeSettings.ReadInteger('MaxRecentFiles' + KeyString, DefaultMaxMRU); end; finally FreeAndNil(FileTypeSettings); end; end; if FileTypes.Count < 1 then LoadDefaultSettings(FileTypes); end; procedure TOpenFileSettings.InternalSaveSettings(Settings: TExpertSettings); var j: Integer; i: Integer; FileType: TFileType; KeyString: string; FileTypeSettings: TExpertSettings; begin // Do not localize any of the following lines Settings.WriteBool('MatchAnywhere', MatchAnywhere); Settings.WriteString('DefaultFileType', DefaultFileType); Settings.WriteInteger('NumberFileTypes', FileTypes.Count); Settings.WriteString('IDEOverride', IDEOverride.CommaText); Settings.WriteInteger('LastTabIndex', LastTabIndex); FileTypeSettings := Settings.CreateExpertSettings('FileTypes'); try for i := 0 to FileTypes.Count - 1 do begin FileType := FileTypes[i]; KeyString := IntToStr(i); FileTypeSettings.WriteString('FileType' + KeyString, FileType.FileTypeName); FileTypeSettings.WriteStrings('Paths' + KeyString, FileType.Paths); FileTypeSettings.WriteString('Extensions' + KeyString, FileType.Extensions); FileTypeSettings.WriteBool('CustomDirectory' + KeyString, FileType.CustomDirectories); FileTypeSettings.WriteBool('RecursiveDirectory' + KeyString, FileType.Recursive); FileTypeSettings.WriteInteger('MaxRecentFiles' + KeyString, FileType.MaxRecentFiles); FileTypeSettings.WriteStrings('Favorites' + KeyString, FileType.Favorites); for j := FileType.RecentFiles.Count - 1 downto FileType.MaxRecentFiles do FileType.RecentFiles.Delete(j); FileTypeSettings.WriteStrings('RecentFiles' + KeyString, FileType.RecentFiles); end; finally FreeAndNil(FileTypeSettings); end; end; procedure TOpenFileSettings.SaveToRegistry; var Registry: TGExpertsSettings; ExpSettings: TExpertSettings; begin ExpSettings := nil; Registry := TGExpertsSettings.Create(''); try ExpSettings := Registry.CreateExpertSettings(ConfigurationKey); InternalSaveSettings(Expsettings); finally FreeAndNil(ExpSettings); FreeAndNil(Registry); end; end; { TfmOpenFileConfig } procedure TfmOpenFileConfig.lbxDirectoryListFilesDropped(Sender: TObject; Files: TStrings); var i: integer; s: string; begin for i := 0 to Files.Count - 1 do begin s := Files[i]; while (s <> '') and not DirectoryExists(s) do begin s := ExtractFileDir(s); end; if s <> '' then EnsureStringInList(lbxDirectoryList.Items, AddSlash(s)) end; end; function TfmOpenFileConfig.GetFileTypes: TFileTypes; begin Assert(Assigned(FSettings)); Result := FSettings.FileTypes; end; function TfmOpenFileConfig.IDEOverride: TIDEOverride; begin Assert(Assigned(FSettings)); Assert(Assigned(FSettings.IDEOverride)); Result := FSettings.IDEOverride; end; procedure TfmOpenFileConfig.chkCustomDirectoryListClick(Sender: TObject); begin SetEnabledOnControlAndChildren(gbxCustomDirectory, chkCustomDirectoryList.Checked); chkCustomDirectoryList.Enabled := True; gbxCustomDirectory.Enabled := True; end; procedure TfmOpenFileConfig.btnTypeAddClick(Sender: TObject); var GroupName: string; FileType: TFileType; begin if InputQuery('File Group Name', 'File Group Name', GroupName) and (GroupName <> '') then begin if lbxTypeList.Items.IndexOf(GroupName) = -1 then begin FileType := TFileType.Create(FileTypes); FileType.FileTypeName := GroupName; lbxTypeList.Items.Add(FileType.FileTypeName); lbxTypeList.ItemIndex := lbxTypeList.Items.IndexOf(FileType.FileTypeName); lbxTypeList.OnClick(lbxTypeList); end; end; end; procedure TfmOpenFileConfig.lbxTypeListClick(Sender: TObject); var i: Integer; begin SaveConfigValue; for i := 0 to FileTypes.Count - 1 do if lbxTypeList.Items[lbxTypeList.ItemIndex] = FileTypes[i].FileTypeName then begin FCurrentFileType := FileTypes[i]; Break; end; edtExtension.Text := FCurrentFileType.Extensions; chkCustomDirectoryList.Checked := FCurrentFileType.CustomDirectories; chkCustomDirectoryListClick(chkCustomDirectoryList); lbxDirectoryList.Items.Assign(FCurrentFileType.Paths); chkRecursive.Checked := FCurrentFileType.Recursive; edtMaxRecentFiles.Text := IntToStr(FCurrentFileType.MaxRecentFiles); end; procedure TfmOpenFileConfig.SaveConfigValue; begin if Assigned(FCurrentFileType) then begin FCurrentFileType.Extensions := edtExtension.Text; FCurrentFileType.CustomDirectories := chkCustomDirectoryList.Checked; FCurrentFileType.Recursive := chkRecursive.Checked; FCurrentFileType.Paths.Assign(lbxDirectoryList.Items); FCurrentFileType.MaxRecentFiles := StrToIntDef(edtMaxRecentFiles.Text, DefaultMaxMRU); end; end; procedure TfmOpenFileConfig.btnOKClick(Sender: TObject); begin if chkOverrideViewUnit.Checked and (cbxViewUnitType.ItemIndex = -1) then raise Exception.Create('A default type must be assigned to override View Unit'); if chkOverrideViewForm.Checked and (cbxViewFormType.ItemIndex = -1) then raise Exception.Create('A default type must be assigned to override View Form'); if chkOverrideOpenProject.Checked and (cbxOpenProjectType.ItemIndex = -1) then raise Exception.Create('A default type must be assigned to override Open Project'); SaveConfigValue; SaveSettings(FSettings); ModalResult := mrOK; end; procedure TfmOpenFileConfig.btnTypeDeleteClick(Sender: TObject); var i: Integer; begin if (lbxTypeList.Items.Count > 0) and (MessageDlg('Delete selected item?', mtConfirmation, [mbYes, mbNo], 0) = mrYes) then begin for i := 0 to FileTypes.Count - 1 do if lbxTypeList.Items[lbxTypeList.ItemIndex] = FileTypes[i].FileTypeName then begin FileTypes.Delete(i); lbxTypeList.Items.Delete(lbxTypeList.ItemIndex); FCurrentFileType := nil; if lbxTypeList.Items.Count > 0 then begin lbxTypeList.ItemIndex := 0; lbxTypeList.OnClick(lbxTypeList); end; Break; end; end; end; procedure TfmOpenFileConfig.btnDirectoryClick(Sender: TObject); begin SelectDirectory; end; procedure TfmOpenFileConfig.btnDirectoryAddClick(Sender: TObject); procedure AddDirectory; begin EnsureStringInList(lbxDirectoryList.Items, AddSlash(Trim(edtDirectory.Text))) end; begin if Trim(edtDirectory.Text) <> '' then AddDirectory else if SelectDirectory then AddDirectory; end; procedure TfmOpenFileConfig.btnDirectoryDeleteClick(Sender: TObject); begin if lbxDirectoryList.ItemIndex <> -1 then lbxDirectoryList.Items.Delete(lbxDirectoryList.ItemIndex) else DeleteStringFromList(lbxDirectoryList.Items, edtDirectory.Text); end; procedure TfmOpenFileConfig.btnDirectoryReplaceClick(Sender: TObject); begin if lbxDirectoryList.ItemIndex <> -1 then lbxDirectoryList.Items[lbxDirectoryList.ItemIndex] := AddSlash(Trim(edtDirectory.Text)); end; procedure TfmOpenFileConfig.lbxDirectoryListClick(Sender: TObject); begin edtDirectory.Text := lbxDirectoryList.Items[lbxDirectoryList.ItemIndex]; end; function TfmOpenFileConfig.SelectDirectory: Boolean; var NewDirectory: string; begin NewDirectory := Trim(edtDirectory.Text); Result := GetDirectory(NewDirectory); if Result then edtDirectory.Text := AddSlash(NewDirectory); end; class function TfmOpenFileConfig.ExecuteWithSettings(Settings: TOpenFileSettings): Boolean; var Form: TfmOpenFileConfig; begin Assert(Assigned(Settings)); Form := TfmOpenFileConfig.Create(nil); try Form.UseSettings(Settings); Result := Form.ShowModal = mrOK; if Result then begin Form.SaveSettings(Settings); Settings.SaveToRegistry; end; finally FreeAndNil(Form); end; end; procedure TfmOpenFileConfig.FormCreate(Sender: TObject); begin SetParentBackgroundValue(gbxCustomDirectory, True); SetParentBackgroundValue(gbxGeneralSettings, True); SetParentBackgroundValue(gbxIDEMenuItems, True); TWinControl_ActivateDropFiles(lbxDirectoryList, lbxDirectoryListFilesDropped) end; procedure TfmOpenFileConfig.SaveSettings(Settings: TOpenFileSettings); begin Assert(Assigned(Settings)); Settings.MatchAnywhere := chkMatchAnywhere.Checked; Settings.DefaultFileType := cbxDefaultFileTypes.Text; IDEOverride.Clear; IDEOverride.OverrideOpenUnit := chkOverrideViewUnit.Checked; IDEOverride.OpenUnitDefaultType := cbxViewUnitType.Text; IDEOverride.OverrideOpenForm := chkOverrideViewForm.Checked; IDEOverride.OpenFormDefaultType := cbxViewFormType.Text; IDEOverride.OverrideOpenProject := chkOverrideOpenProject.Checked; IDEOverride.OpenProjectDefaultType := cbxOpenProjectType.Text; end; procedure TfmOpenFileConfig.UseSettings(Settings: TOpenFileSettings); var i: Integer; begin Assert(Assigned(Settings)); FSettings := Settings; chkMatchAnywhere.Checked := Settings.MatchAnywhere; for i := 0 to FileTypes.Count - 1 do lbxTypeList.Items.Add(FileTypes[i].FileTypeName); lbxTypeList.ItemIndex := 0; lbxTypeList.OnClick(lbxTypeList); cbxDefaultFileTypes.Items.Assign(lbxTypeList.Items); cbxViewUnitType.Items.Assign(cbxDefaultFileTypes.Items); cbxViewFormType.Items.Assign(cbxDefaultFileTypes.Items); cbxOpenProjectType.Items.Assign(cbxDefaultFileTypes.Items); cbxDefaultFileTypes.ItemIndex := cbxDefaultFileTypes.Items.IndexOf(Settings.DefaultFileType); cbxViewUnitType.ItemIndex := cbxViewUnitType.Items.IndexOf(IDEOverride.OpenUnitDefaultType); cbxViewFormType.ItemIndex := cbxViewFormType.Items.IndexOf(IDEOverride.OpenFormDefaultType); cbxOpenProjectType.ItemIndex := cbxOpenProjectType.Items.IndexOf(IDEOverride.OpenProjectDefaultType); chkOverrideViewUnit.Checked := IDEOverride.OverrideOpenUnit; chkOverrideViewForm.Checked := IDEOverride.OverrideOpenForm; chkOverrideOpenProject.Checked := IDEOverride.OverrideOpenProject; end; procedure TfmOpenFileConfig.btnHelpClick(Sender: TObject); begin GxContextHelp(Self, 46); end; end.
unit NotifyUnit; // Модуль: "w:\garant6x\implementation\Garant\tie\Garant\GblAdapterLib\NotifyUnit.pas" // Стереотип: "Interfaces" // Элемент модели: "Notify" MUID: (45EEA85502B4) {$Include w:\garant6x\implementation\Garant\nsDefine.inc} interface uses l3IntfUses , BaseTypesUnit ; type TNotifyType = ( NT_LONG_OPERATION_START , NT_LONG_OPERATION_END , NT_MONITORING_UPDATE , NT_SHUTDOWN , NT_LOGOUT , NT_BASE_UPDATE_START , NT_BASE_UPDATE_END , NT_BASE_UPDATE_FAILED , NT_CONSULTATION_RECEIVED {* Получен ответ } , NT_CONSULTATION_NOT_SENT {* Консультация не отправлена } , NT_NO_SUBSCRIPTION {* Консультация не отправлена, тк не прошла валидация } , NT_INTERNET_AVAILABLE {* Приходит при успешной связи с удалёнными сервисами (СК или сервер ревизий документов) } , NT_NEW_CHAT_MESSAGES_RECEIVED {* получены новые сообщения для чата } , NT_CHAT_CONTACT_ADDED {* добавлен новый контакт для чата } , NT_CHAT_CONTACT_REMOVED {* удалён контакт чата } , NT_INTERNET_NOT_AVAILABLE {* нет доступа к серверу ревизий документов } );//TNotifyType INotification = interface ['{30BDF2EC-FBC4-4477-AC3B-5BB8CBFC8A4D}'] function GetId: TNotifyType; stdcall; procedure GetData; stdcall; procedure SetType(type: TNotifyType); stdcall; procedure SetData(var data: IVariant); stdcall; property Id: TNotifyType read GetId; property Data: read GetData; end;//INotification IListener = interface {* Callback на облочке для получения сообщений с адаптера } ['{DFAC9F0B-95D4-4E9B-8525-1A10739E41A9}'] procedure Fire(const notify: INotification); stdcall; end;//IListener INotifyManager = interface {* Менеджер, обеспечивающий обмен сообщениями между адаптером и оболочкой } ['{4E4282C5-1F27-4A9E-8F8D-3CC8B00FDA97}'] procedure RegisterListenerForNotify(notify_id: TNotifyType; var listener: IListener); stdcall; procedure RegisterTransformer(type: TNotifyType; var transformer); stdcall; procedure ListenForAll; stdcall; procedure ListenOnlyForMe; stdcall; procedure StopListenMe; stdcall; end;//INotifyManager implementation uses l3ImplUses ; end.
{*********************************************************} {* VPSQLPARADOXDIALECT.PAS 1.03 *} {*********************************************************} {* ***** BEGIN LICENSE BLOCK ***** *} {* Version: MPL 1.1 *} {* *} {* The contents of this file are subject to the Mozilla Public License *} {* Version 1.1 (the "License"); you may not use this file except in *} {* compliance with the License. You may obtain a copy of the License at *} {* http://www.mozilla.org/MPL/ *} {* *} {* Software distributed under the License is distributed on an "AS IS" basis, *} {* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License *} {* for the specific language governing rights and limitations under the *} {* License. *} {* *} {* The Original Code is TurboPower Visual PlanIt *} {* *} {* The Initial Developer of the Original Code is TurboPower Software *} {* *} {* Portions created by TurboPower Software Inc. are Copyright (C) 2002 *} {* TurboPower Software Inc. All Rights Reserved. *} {* *} {* Contributor(s): *} {* Hannes Danzl *} {* *} {* ***** END LICENSE BLOCK ***** *} {This unit was provided by Hannes Danzl and is used here with permission } // a sql dialect class for paradox unit VPSQLParadoxDialect; interface uses VPSQLDialect, VPDbIntf, dbtables, db, sysutils; type // a sql dialect class for paradox TVPParadoxSQLDialect = class(TBaseSQLDialect) protected // override to use 'create table "%TableName%" (%Fields%)' since paradox // can have the fileextension in the tablename function GetCreateSyntax: String; override; // return the right strings function SQLGetColumnDef(const aFieldDef: TFieldDef): String; override; // override to avoid abstract error procedure EnsureDatabaseExists; virtual; end; implementation procedure TVPParadoxSQLDialect.EnsureDatabaseExists; begin // do nothing end; function TVPParadoxSQLDialect.GetCreateSyntax: String; begin result:='create table "%TableName%" (%Fields%)'; end; function TVPParadoxSQLDialect.SQLGetColumnDef( const aFieldDef: TFieldDef): String; var aTypeName: String; begin case aFieldDef.DataType of ftInteger: aTypeName:='INTEGER'; ftFloat: aTypeName:='NUMERIC'; ftString: if aFieldDef.Size<256 then aTypeName:='VARCHAR('+inttostr(aFieldDef.Size)+')' else aTypeName:='BLOB(1,1)'; ftBoolean: aTypeName:='BOOLEAN'; ftDate: aTypeName:='DATE'; ftTime: aTypeName:='TIME'; ftDateTime: aTypeName:='TIMESTAMP'; end; // case result:=aFieldDef.Name+' '+aTypeName; end; function CreateParadoxDialect(InterfaceClass: String): TObject; begin result:=TVPParadoxSQLDialect.Create(nil); end; initialization // IMPORTANT: register it sSQLDialectFactory.RegisterInterfaceType('Paradox', @CreateParadoxDialect); end.
unit zsAgentApp; interface uses Windows, Messages, Sysutils, BaseApp, BaseWinApp, define_zsprocess; type TZSAgentAppData = record ZsProcess : TZsProcess; ZsMainWnd : TZsWndMain; end; TzsAgentApp = class(TBaseWinApp) protected fZSAgentAppData: TZSAgentAppData; function CreateAppCommandWindow: Boolean; procedure Test; public function Initialize: Boolean; override; procedure Finalize; override; procedure Run; override; end; var GlobalApp: TzsAgentApp = nil; implementation uses UtilsWindows, windef_msg, define_stockapp, define_message, //UtilsLog, utils_zs_deal, utils_zs_dealquery, utils_zs_dialog, utils_zs_main, utils_zs_login, utils_zs_export, utils_zsprocess; {$IFNDEF RELEASE} const LOGTAG = 'zsAgentApp.pas'; {$ENDIF} { TzsAgentApp } function TzsAgentApp.Initialize: Boolean; begin Result := inherited Initialize; if Result then begin Result := CheckSingleInstance(AppMutexName_StockDeal_Agent_ZSZQ); if Result then begin FillChar(fZSAgentAppData, SizeOf(fZSAgentAppData), 0); fZSAgentAppData.ZsProcess.LoginAccountId := 1808175166; //Application.Initialize; end; end; end; procedure TzsAgentApp.Finalize; begin inherited; end; procedure TzsAgentApp.Test; var tmpMainWnd: TZsWndMain; tmpLoginWnd: TZsWndLogin; tmpMainDealWnd: TZSWndMainDeal; tmpWndDialogs: TZsWndDialogs; begin FillChar(tmpLoginWnd, SizeOf(tmpLoginWnd), 0); if FindZSLoginWnd(@fZSAgentAppData.ZsProcess, @tmpLoginWnd) then begin AutoLogin(@fZSAgentAppData.ZsProcess, @tmpLoginWnd, 12177); end; FillChar(tmpMainWnd, SizeOf(tmpMainWnd), 0); if FindZSMainWnd(@fZSAgentAppData.ZsProcess, @tmpMainWnd) then begin CloseZsDialog(@fZSAgentAppData.ZsProcess, nil); TraverseCheckMainChildWindowA(tmpMainWnd.Core.WindowHandle, @tmpMainWnd); if IsWindow(tmpMainWnd.Core.WindowHandle) then begin if IsWindow(tmpMainWnd.WndFunctionTree) then begin ForceBringFrontWindow(tmpMainWnd.Core.WindowHandle); //ClickFunctionTreeBuyNode(@tmpMainWnd); //ClickFunctionTreeSaleNode(@tmpMainWnd); //ClickFunctionTreeCancelNode(@tmpMainWnd); //ClickFunctionTreeQueryNode(@tmpMainWnd); ClickFunctionTreeQueryDealNode(@tmpMainWnd); Exit; FillChar(tmpMainDealWnd, SizeOf(tmpMainDealWnd), 0); TraverseCheckMainDealPanelChildWindowA(tmpMainWnd.WndDealPanel, @tmpMainWnd, @tmpMainDealWnd); if IsWindow(tmpMainDealWnd.WndAccountCombo) then begin //InputEditWnd(tmpMainDealWnd.WndStockCodeEdit, '002414'); InputEditWnd(tmpMainDealWnd.WndStockCodeEdit, '601199'); SleepWait(20); //InputEditWnd(tmpMainDealWnd.WndPriceEdit, FormatFloat('0.00', 25.1)); InputEditWnd(tmpMainDealWnd.WndPriceEdit, FormatFloat('0.00', 8.5)); SleepWait(20); InputEditWnd(tmpMainDealWnd.WndNumEdit, IntToStr(100)); SleepWait(20); ClickButtonWnd(tmpMainDealWnd.WndOrderButton); FillChar(tmpWndDialogs, SizeOf(tmpWndDialogs), 0); if FindZSDialogWnd(@fZSAgentAppData.ZsProcess, @tmpWndDialogs, 0) then begin if 1 = tmpWndDialogs.WndCount then begin ForceBringFrontWindow(tmpWndDialogs.WndArray[0].Core.WindowHandle); ClickButtonWnd(tmpWndDialogs.WndArray[0].OKButton); end; end; Sleep(100); while CloseZsDialog(@fZSAgentAppData.ZsProcess, 0) do begin Sleep(100); end; end; end; end; end; end; function BusinessCommandWndProcA(AWnd: HWND; AMsg: UINT; wParam: WPARAM; lParam: LPARAM; var AResult: LRESULT): Boolean; begin Result := true; case AMsg of WM_Deal_Request_Buy: begin CallBuy(@GlobalApp.fZSAgentAppData.ZsProcess, @GlobalApp.fZSAgentAppData.ZsMainWnd, wParam, LoWord(lParam) / 100, HiWord(lParam)); end; WM_Deal_Request_Sale: begin CallSale(@GlobalApp.fZSAgentAppData.ZsProcess, @GlobalApp.fZSAgentAppData.ZsMainWnd, wParam, LoWord(lParam) / 100, HiWord(lParam)); end; WM_Deal_Request_Cancel: begin end; WM_Data_Export: begin //Log(LOGTAG, 'WM_Data_Export'); CallExport( @GlobalApp.fZSAgentAppData.ZsProcess, @GlobalApp.fZSAgentAppData.ZsMainWnd, wParam, lParam); end; WM_Data_Config: begin //Log(LOGTAG, 'WM_Data_Config:' + IntToStr(wParam) + '/' + IntToStr(lParam)); if Config_Export_DownClick = wParam then begin Global_Export_DownClickCount := lParam; end; AResult := 1; end; else Result := false; end; end; function AppCommandWndProcA(AWnd: HWND; AMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; begin Result := 0; case AMsg of WM_AppStart: begin end; WM_AppRequestEnd: begin end; WM_AppNotifyShutdownMachine: begin end; else if BusinessCommandWndProcA(AWnd, AMsg, wParam, lParam, Result) then exit; end; Result := DefWindowProcA(AWnd, AMsg, wParam, lParam); end; function TzsAgentApp.CreateAppCommandWindow: Boolean; var tmpRegWinClass: TWndClassA; tmpGetWinClass: TWndClassA; tmpIsReged: Boolean; begin Result := false; ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD); ChangeWindowMessageFilter(WM_AppRequestEnd, MSGFLT_ADD); ChangeWindowMessageFilter(WM_AppNotifyShutdownMachine, MSGFLT_ADD); ChangeWindowMessageFilter(WM_Data_Config, MSGFLT_ADD); ChangeWindowMessageFilter(WM_Data_Export, MSGFLT_ADD); ChangeWindowMessageFilter(WM_Deal_Request_Buy, MSGFLT_ADD); ChangeWindowMessageFilter(WM_Deal_Request_Sale, MSGFLT_ADD); ChangeWindowMessageFilter(WM_Deal_Request_Cancel, MSGFLT_ADD); FillChar(tmpRegWinClass, SizeOf(tmpRegWinClass), 0); tmpRegWinClass.hInstance := HInstance; tmpRegWinClass.lpfnWndProc := @AppCommandWndProcA; tmpRegWinClass.lpszClassName := define_stockapp.AppCmdWndClassName_StockDealAgent_ZSZQ; tmpIsReged := GetClassInfoA(HInstance, tmpRegWinClass.lpszClassName, tmpGetWinClass); if tmpIsReged then begin if (tmpGetWinClass.lpfnWndProc <> tmpRegWinClass.lpfnWndProc) then begin UnregisterClassA(tmpRegWinClass.lpszClassName, HInstance); tmpIsReged := false; end; end; if not tmpIsReged then begin if 0 = RegisterClassA(tmpRegWinClass) then exit; end; //TBaseStockApp(fBaseAppAgentData.HostApp).AppWindow := CreateWindowExA( Self.AppWindow := CreateWindowExA( WS_EX_TOOLWINDOW //or WS_EX_APPWINDOW //or WS_EX_TOPMOST , tmpRegWinClass.lpszClassName, '', WS_POPUP {+ 0}, 0, 0, 0, 0, HWND_MESSAGE, 0, HInstance, nil); Result := Windows.IsWindow(Self.AppWindow); if Result then begin //Log(LOGTAG, 'CreateAppCommandWindow Succ'); end else begin //Log(LOGTAG, 'CreateAppCommandWindow Fail'); end; end; procedure TzsAgentApp.Run; var tmpProcessHandle: THandle; begin inherited; if FindZSProcess(@fZSAgentAppData.ZsProcess) then begin tmpProcessHandle := Windows.OpenProcess(PROCESS_TERMINATE, FALSE, fZSAgentAppData.ZsProcess.Process.Core.ProcessId); if (0 <> tmpProcessHandle) and (INVALID_HANDLE_VALUE <> tmpProcessHandle) then begin // 发布的时候 必须 杀非管理进程 调试的时候不用 杀进程 Windows.TerminateProcess(tmpProcessHandle, 0); fZSAgentAppData.ZsProcess.Process.Core.ProcessId := 0; end; end; //if (0 <> fZSAgentAppData.ZsProcess.Process.Core.ProcessId) then begin if CreateAppCommandWindow then begin PostMessage(Self.AppWindow, WM_AppStart, 0, 0); RunAppMsgLoop; end; end; end; end.
unit UCommandLine; interface function GetCmdLineSwitch(const ASwitch: string; const IgnoreCase: Boolean = True): Boolean; function GetCmdLineSwitchValue(out AValue: string; const ASwitch: string; const IgnoreCase: Boolean = True): Boolean; function IsCmdLineSwitch(index:Integer):Boolean; implementation uses SysUtils; function GetCmdLineSwitch(const ASwitch: string; const IgnoreCase: Boolean = True): Boolean; begin Result := FindCmdLineSwitch(ASwitch, ['-','/'], IgnoreCase); end; {************************************************************************** * NAME: FindCmdLineSwitchValue * DESC: Kommandozeilenparser für Optionen der Form: ['-'|'/']Name[':'|'=']Wert * * Beispiel: * Kommandozeile "-a:WertA /b:WertB -c=WertC -d=WertD * FindCmdLineSwitchValue(Value,'a',False) ==> Result=True, Value=WertA * FindCmdLineSwitchValue(Value,'A',False) ==> Result=False * FindCmdLineSwitchValue(Value,'A',True) ==> Result=False, Value=WertA * PARAMS: out AValue: string; const ASwitch: string; const IgnoreCase: Boolean = True * RESULT: Boolean * CREATED: 14-03-2003/haide * CHANGED: *************************************************************************} function GetCmdLineSwitchValue(out AValue: string; const ASwitch: string; const IgnoreCase: Boolean = True): Boolean; const CompareFunction: array[Boolean] of function(const s1,s2: string): Integer = ( CompareStr, CompareText ); var iCmdLine,iSplit: Integer; s,sName,sValue: String; begin Result := False; for iCmdLine := 1 to ParamCount do begin s := ParamStr(iCmdLine); if not (s[1] in ['-','/']) then Continue; Delete(s,1,1); iSplit := Pos(':',s); if iSplit = 0 then iSplit := Pos('=',s); if iSplit = 0 then Continue; sName := Copy(s,1,iSplit-1); sValue := Copy(s,iSplit+1,666); if CompareFunction[IgnoreCase](ASwitch,sName) = 0 then begin AValue := sValue; Result := True; Break; end; end; end; function IsCmdLineSwitch(index:Integer):Boolean; var s : string; begin s := ParamStr(index); Result := (s[1] in ['-','/']); end; end.
unit alcuRegionImportTaskPrim; // Модуль: "w:\archi\source\projects\PipeInAuto\Tasks\alcuRegionImportTaskPrim.pas" // Стереотип: "SimpleClass" // Элемент модели: "TalcuRegionImportTaskPrim" MUID: (5408670901C0) {$Include w:\archi\source\projects\PipeInAuto\alcuDefine.inc} interface {$If Defined(ServerTasks)} uses l3IntfUses , alcuImport , l3Variant , k2Base ; type TalcuRegionImportTaskPrim = class(TalcuImport) protected function pm_GetRegionIndex: Integer; procedure pm_SetRegionIndex(aValue: Integer); function pm_GetFTPParams: Tl3Tag; procedure pm_SetFTPParams(aValue: Tl3Tag); function pm_GetFileNameMask: AnsiString; procedure pm_SetFileNameMask(const aValue: AnsiString); function pm_GetSourceWarehouse: AnsiString; procedure pm_SetSourceWarehouse(const aValue: AnsiString); public class function GetTaggedDataType: Tk2Type; override; public property RegionIndex: Integer read pm_GetRegionIndex write pm_SetRegionIndex; property FTPParams: Tl3Tag read pm_GetFTPParams write pm_SetFTPParams; property FileNameMask: AnsiString read pm_GetFileNameMask write pm_SetFileNameMask; property SourceWarehouse: AnsiString read pm_GetSourceWarehouse write pm_SetSourceWarehouse; end;//TalcuRegionImportTaskPrim {$IfEnd} // Defined(ServerTasks) implementation {$If Defined(ServerTasks)} uses l3ImplUses , RegionImportTask_Const //#UC START# *5408670901C0impl_uses* //#UC END# *5408670901C0impl_uses* ; function TalcuRegionImportTaskPrim.pm_GetRegionIndex: Integer; begin Assert(Self <> nil); Assert(TaggedData <> nil); Result := (TaggedData.IntA[k2_attrRegionIndex]); end;//TalcuRegionImportTaskPrim.pm_GetRegionIndex procedure TalcuRegionImportTaskPrim.pm_SetRegionIndex(aValue: Integer); begin TaggedData.IntW[k2_attrRegionIndex, nil] := (aValue); end;//TalcuRegionImportTaskPrim.pm_SetRegionIndex function TalcuRegionImportTaskPrim.pm_GetFTPParams: Tl3Tag; begin Assert(Self <> nil); Assert(TaggedData <> nil); Result := (TaggedData.Attr[k2_attrFTPParams]); end;//TalcuRegionImportTaskPrim.pm_GetFTPParams procedure TalcuRegionImportTaskPrim.pm_SetFTPParams(aValue: Tl3Tag); begin TaggedData.AttrW[k2_attrFTPParams, nil] := (aValue); end;//TalcuRegionImportTaskPrim.pm_SetFTPParams function TalcuRegionImportTaskPrim.pm_GetFileNameMask: AnsiString; begin Assert(Self <> nil); Assert(TaggedData <> nil); Result := (TaggedData.StrA[k2_attrFileNameMask]); end;//TalcuRegionImportTaskPrim.pm_GetFileNameMask procedure TalcuRegionImportTaskPrim.pm_SetFileNameMask(const aValue: AnsiString); begin TaggedData.StrW[k2_attrFileNameMask, nil] := (aValue); end;//TalcuRegionImportTaskPrim.pm_SetFileNameMask function TalcuRegionImportTaskPrim.pm_GetSourceWarehouse: AnsiString; begin Assert(Self <> nil); Assert(TaggedData <> nil); Result := (TaggedData.StrA[k2_attrSourceWarehouse]); end;//TalcuRegionImportTaskPrim.pm_GetSourceWarehouse procedure TalcuRegionImportTaskPrim.pm_SetSourceWarehouse(const aValue: AnsiString); begin TaggedData.StrW[k2_attrSourceWarehouse, nil] := (aValue); end;//TalcuRegionImportTaskPrim.pm_SetSourceWarehouse class function TalcuRegionImportTaskPrim.GetTaggedDataType: Tk2Type; begin Result := k2_typRegionImportTask; end;//TalcuRegionImportTaskPrim.GetTaggedDataType {$IfEnd} // Defined(ServerTasks) end.
unit frm_clientes; {$mode objfpc}{$H+} interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, Buttons, StdCtrls, ExtCtrls, ActnList, DBGrids, EditBtn, MaskEdit, Menus, Grids, RTTIGrids, RTTICtrls, cs_cad, m_label, m_edit, m_combobox, m_button, m_maskedit, m_dbgrid, m_bitbtn, m_drawgrid, m_stringgrid, m_checkbox, m_memo, cs_util; type { TfrmClientes } TfrmClientes = class(TclsFormcad) btnAlterarContato: TMariaeBitBtn; btnExcluirContato: TMariaeBitBtn; btnInserirContato: TMariaeBitBtn; imlEnder: TImageList; labOu1: TMariaeLabel; labTipoPessoa: TMariaeLabel; cbbTipoPessoa: TMariaeComboBox; cbbSitu: TMariaeComboBox; labAvisoCnpj: TMariaeLabel; cbbTipoEnder: TMariaeComboBox; cbbUF: TMariaeComboBox; cbbCidade: TMariaeComboBox; dbgEnder: TMariaeDBGrid; btnInserirEnder: TMariaeBitBtn; btnAlterarEnder: TMariaeBitBtn; btnExcluirEnder: TMariaeBitBtn; btnPrincipalEnder: TMariaeBitBtn; cbbChat: TMariaeComboBox; dbgContato: TMariaeDBGrid; chkOpc: TMariaeCheckBox; chkDebitos: TMariaeCheckBox; chkPendDoc: TMariaeCheckBox; chkImpPartNumber: TMariaeCheckBox; cbbCRT: TMariaeComboBox; cbbFormaPagto: TMariaeComboBox; cbbDestinacao: TMariaeComboBox; labObs: TMariaeLabel; memObs: TMariaeMemo; txtDescVendExterno: TMariaeEdit; txtDescRepres: TMariaeEdit; txtIdObsNF: TMariaeEdit; txtDescObsNF: TMariaeEdit; txtMarkup: TMariaeEdit; txtIdCondPagto: TMariaeEdit; txtDescTabPrecos: TMariaeEdit; txtDescAreaVendas: TMariaeEdit; txtDescCondPagto: TMariaeEdit; txtIdTransp: TMariaeEdit; txtIdVendedor: TMariaeEdit; txtIdVendExterno: TMariaeEdit; txtIdRepres: TMariaeEdit; txtIdTabPrecos: TMariaeEdit; txtIdAreaVendas: TMariaeEdit; txtDescTransp: TMariaeEdit; txtDescVendedor: TMariaeEdit; labTransp: TMariaeLabel; labDestinacao: TMariaeLabel; labMarkup: TMariaeLabel; labObsNF: TMariaeLabel; labTabPrecos: TMariaeLabel; labVendedor: TMariaeLabel; labVendExterno: TMariaeLabel; labRepres: TMariaeLabel; labCondPagto: TMariaeLabel; labAtualizadoEm: TMariaeLabel; labCRT: TMariaeLabel; labAreaVendas: TMariaeLabel; labFormaPagto: TMariaeLabel; txtDataFixaDia3: TMariaeEdit; txtRecBruta: TMariaeEdit; txtCredito: TMariaeEdit; txtTotalLcompras: TMariaeEdit; txtDispLcompras: TMariaeEdit; labUltCompra: TMariaeLabel; labRecBruta: TMariaeLabel; labCredito: TMariaeLabel; labLimiteCompras: TMariaeLabel; labTotalLcompras: TMariaeLabel; labDispLcompras: TMariaeLabel; txtConta: TMariaeEdit; mkeUltCompra: TMariaeMaskEdit; txtDataFixaDia2: TMariaeEdit; txtCodBanco: TMariaeEdit; txtAgencia: TMariaeEdit; txtRespCom: TMariaeEdit; txtRespFin: TMariaeEdit; txtFoneRespCom: TMariaeEdit; txtFoneRespFin: TMariaeEdit; txtDataFixaDia1: TMariaeEdit; txtDescBanco: TMariaeEdit; labFinanceiro: TMariaeLabel; labOu: TMariaeLabel; labConta: TMariaeLabel; labDataAbe: TMariaeLabel; labBanco: TMariaeLabel; labAgencia: TMariaeLabel; labRespCom: TMariaeLabel; labRespFin: TMariaeLabel; labFoneRespFin: TMariaeLabel; labFoneRespCom: TMariaeLabel; labDataFixCob: TMariaeLabel; mkeDataAbe: TMariaeMaskEdit; txtNome: TMariaeEdit; txtCargo: TMariaeEdit; txtCelular: TMariaeEdit; txtFone: TMariaeEdit; txtRamal: TMariaeEdit; txtEmail: TMariaeEdit; txtIdChat: TMariaeEdit; labNome: TMariaeLabel; labCargo: TMariaeLabel; labDtAdm: TMariaeLabel; labCelular: TMariaeLabel; labFone: TMariaeLabel; labRamal: TMariaeLabel; labEmail: TMariaeLabel; labChat: TMariaeLabel; pmiMovItens: TMenuItem; pmiListaClientes: TMenuItem; pmiMovVendas: TMenuItem; pmnRelatorio: TPopupMenu; txtComplem: TMariaeEdit; mkeDtAdm: TMariaeMaskEdit; txtTelefone: TMariaeEdit; txtContato: TMariaeEdit; txtPontoRef: TMariaeEdit; txtLogradouro: TMariaeEdit; txtNumero: TMariaeEdit; txtBairro: TMariaeEdit; labTipoEnder: TMariaeLabel; labTelefone: TMariaeLabel; labLogradouro: TMariaeLabel; lanNumero: TMariaeLabel; labComplem: TMariaeLabel; labPontoRef: TMariaeLabel; labUF: TMariaeLabel; labBairro: TMariaeLabel; labCep: TMariaeLabel; labContato: TMariaeLabel; mkeCep: TMariaeMaskEdit; txtEstadoCivil: TMariaeComboBox; txtSexo: TMariaeComboBox; txtInscest: TMariaeEdit; txtDataCadastro: TMariaeMaskEdit; txtCnpj: TMariaeMaskEdit; txtSite: TMariaeEdit; txtDataNascimento: TMariaeMaskEdit; txtFantasia: TMariaeEdit; txtRazao: TMariaeEdit; labSitu: TMariaeLabel; labDataCadastro: TMariaeLabel; labRazao: TMariaeLabel; labFantasia: TMariaeLabel; labCnpj: TMariaeLabel; labInscest: TMariaeLabel; labDataNascimento: TMariaeLabel; labSite: TMariaeLabel; labEstadoCivil: TMariaeLabel; labSexo: TMariaeLabel; txtNomeAbrev: TMariaeEdit; txtCodigo: TMariaeEdit; labCodigo: TMariaeLabel; labNomeAbrev: TMariaeLabel; panCodigo: TPanel; pgcClientes: TPageControl; tabIdent: TTabSheet; tabEnder: TTabSheet; tabCont: TTabSheet; tabCob: TTabSheet; tabCred: TTabSheet; tabFatur: TTabSheet; tabObs: TTabSheet; mkeAtualizadoEm: TMariaeMaskEdit; procedure tbnEditarClick(Sender: TObject); procedure tbnNovoClick(Sender: TObject); procedure tbnRelatorioClick(Sender: TObject); procedure TIListBox1EditingDone(Sender: TObject); private public end; var frmClientes: TfrmClientes; implementation {$R *.lfm} { TfrmClientes } procedure TfrmClientes.tbnEditarClick(Sender: TObject); begin ShowMessage('Pressionado Ctrl+E'); end; procedure TfrmClientes.tbnNovoClick(Sender: TObject); begin ShowMessage('Pressionado Ctrl+N'); end; procedure TfrmClientes.tbnRelatorioClick(Sender: TObject); begin Self.tbnRelatorio.DropdownMenu.PopUp; end; procedure TfrmClientes.TIListBox1EditingDone(Sender: TObject); begin ShowMessage('9'); end; end.
unit vulkan_core; (* ** Copyright 2015-2021 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 *) (* ** This header is generated from the Khronos Vulkan XML API Registry. ** *) interface //#################################################################### ■ uses LUX.Code.C; const DLLNAME = 'vulkan-1.dll'; const VK_VERSION_1_0 = 1; ////#include "vk_platform.h" type VK_DEFINE_HANDLE_T = record end; VK_DEFINE_HANDLE = ^VK_DEFINE_HANDLE_T; {$IF not Defined( VK_DEFINE_NON_DISPATCHABLE_HANDLE ) } {$IF Defined( __LP64__ ) or Defined( _WIN64 ) or ( Defined( __x86_64__ ) and not Defined( __ILP32__ ) ) or Defined( _M_X64 ) or Defined( __ia64 ) or Defined( _M_IA64 ) or Defined( __aarch64__ ) or Defined( __powerpc64__ ) } type VK_DEFINE_NON_DISPATCHABLE_HANDLE_T = record end; VK_DEFINE_NON_DISPATCHABLE_HANDLE = ^VK_DEFINE_NON_DISPATCHABLE_HANDLE_T; {$ELSE} type VK_DEFINE_NON_DISPATCHABLE_HANDLE = T_uint64_t; {$ENDIF} {$ENDIF} function VK_MAKE_VERSION( const major_,minor_,patch_:T_uint32_t ) :T_uint32_t; inline; // DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead. //#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) // Patch version should always be set to 0 // Vulkan 1.0 version number const VK_API_VERSION_1_0 :T_uint32_t = {VK_MAKE_VERSION( 1, 0, 0 )} ( 1 shl 22 ) or ( 2 shl 12 ) or 0; // Patch version should always be set to 0 // Version of this file const VK_HEADER_VERSION = 170; // Complete version of this file const VK_HEADER_VERSION_COMPLETE :T_uint32_t = {VK_MAKE_VERSION( 1, 2, VK_HEADER_VERSION )} ( 1 shl 22 ) or ( 2 shl 12 ) or VK_HEADER_VERSION; function VK_VERSION_MAJOR( const version_:T_uint32_t ) :T_uint32_t; inline; function VK_VERSION_MINOR( const version_:T_uint32_t ) :T_uint32_t; inline; function VK_VERSION_PATCH( const version_:T_uint32_t ) :T_uint32_t; inline; const VK_NULL_HANDLE = 0; type VkBool32 = T_uint32_t; P_VkBool32 = ^VkBool32; type VkDeviceAddress = T_uint64_t; P_VkDeviceAddress = ^VkDeviceAddress; type VkDeviceSize = T_uint64_t; P_VkDeviceSize = ^VkDeviceSize; type VkFlags = T_uint32_t; P_VkFlags = ^VkFlags; type VkSampleMask = T_uint32_t; P_VkSampleMask = ^VkSampleMask; type VkBuffer = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkBuffer = ^VkBuffer; type VkImage = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkImage = ^VkImage; type VkInstance = VK_DEFINE_HANDLE; P_VkInstance = ^VkInstance; type VkPhysicalDevice = VK_DEFINE_HANDLE; P_VkPhysicalDevice = ^VkPhysicalDevice; type VkDevice = VK_DEFINE_HANDLE; P_VkDevice = ^VkDevice; type VkQueue = VK_DEFINE_HANDLE; P_VkQueue = ^VkQueue; type VkSemaphore = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkSemaphore = ^VkSemaphore; type VkCommandBuffer = VK_DEFINE_HANDLE; P_VkCommandBuffer = ^VkCommandBuffer; type VkFence = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkFence = ^VkFence; type VkDeviceMemory = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkDeviceMemory = ^VkDeviceMemory; type VkEvent = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkEvent = ^VkEvent; type VkQueryPool = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkQueryPool = ^VkQueryPool; type VkBufferView = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkBufferView = ^VkBufferView; type VkImageView = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkImageView = ^VkImageView; type VkShaderModule = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkShaderModule = ^VkShaderModule; type VkPipelineCache = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkPipelineCache = ^VkPipelineCache; type VkPipelineLayout = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkPipelineLayout = ^VkPipelineLayout; type VkPipeline = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkPipeline = ^VkPipeline; type VkRenderPass = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkRenderPass = ^VkRenderPass; type VkDescriptorSetLayout = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkDescriptorSetLayout = ^VkDescriptorSetLayout; type VkSampler = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkSampler = ^VkSampler; type VkDescriptorSet = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkDescriptorSet = ^VkDescriptorSet; type VkDescriptorPool = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkDescriptorPool = ^VkDescriptorPool; type VkFramebuffer = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkFramebuffer = ^VkFramebuffer; type VkCommandPool = VK_DEFINE_NON_DISPATCHABLE_HANDLE; P_VkCommandPool = ^VkCommandPool; const VK_ATTACHMENT_UNUSED = UInt32( $FFFFFFFF ); {(~0U)} const VK_FALSE = 0; const VK_LOD_CLAMP_NONE = T_float( 1000.0 ); const VK_QUEUE_FAMILY_IGNORED = UInt32( $FFFFFFFF ); {(~0U)} const VK_REMAINING_ARRAY_LAYERS = UInt32( $FFFFFFFF ); {(~0U)} const VK_REMAINING_MIP_LEVELS = UInt32( $FFFFFFFF ); {(~0U)} const VK_SUBPASS_EXTERNAL = UInt32( $FFFFFFFF ); {(~0U)} const VK_TRUE = 1; const VK_WHOLE_SIZE = UInt64( $FFFFFFFFFFFFFFFF ); {(~0ULL)} const VK_MAX_MEMORY_TYPES = 32; const VK_MAX_MEMORY_HEAPS = 16; const VK_MAX_PHYSICAL_DEVICE_NAME_SIZE = 256; const VK_UUID_SIZE = 16; const VK_MAX_EXTENSION_NAME_SIZE = 256; const VK_MAX_DESCRIPTION_SIZE = 256; type P_VkResult = ^VkResult; VkResult = ( VK_SUCCESS = 0, VK_NOT_READY = 1, VK_TIMEOUT = 2, VK_EVENT_SET = 3, VK_EVENT_RESET = 4, VK_INCOMPLETE = 5, VK_ERROR_OUT_OF_HOST_MEMORY = -1, VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, VK_ERROR_INITIALIZATION_FAILED = -3, VK_ERROR_DEVICE_LOST = -4, VK_ERROR_MEMORY_MAP_FAILED = -5, VK_ERROR_LAYER_NOT_PRESENT = -6, VK_ERROR_EXTENSION_NOT_PRESENT = -7, VK_ERROR_FEATURE_NOT_PRESENT = -8, VK_ERROR_INCOMPATIBLE_DRIVER = -9, VK_ERROR_TOO_MANY_OBJECTS = -10, VK_ERROR_FORMAT_NOT_SUPPORTED = -11, VK_ERROR_FRAGMENTED_POOL = -12, VK_ERROR_UNKNOWN = -13, VK_ERROR_OUT_OF_POOL_MEMORY = -1000069000, VK_ERROR_INVALID_EXTERNAL_HANDLE = -1000072003, VK_ERROR_FRAGMENTATION = -1000161000, VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS = -1000257000, VK_ERROR_SURFACE_LOST_KHR = -1000000000, VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, VK_SUBOPTIMAL_KHR = 1000001003, VK_ERROR_OUT_OF_DATE_KHR = -1000001004, VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, VK_ERROR_INVALID_SHADER_NV = -1000012000, VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT = -1000158000, VK_ERROR_NOT_PERMITTED_EXT = -1000174001, VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT = -1000255000, VK_THREAD_IDLE_KHR = 1000268000, VK_THREAD_DONE_KHR = 1000268001, VK_OPERATION_DEFERRED_KHR = 1000268002, VK_OPERATION_NOT_DEFERRED_KHR = 1000268003, VK_PIPELINE_COMPILE_REQUIRED_EXT = 1000297000, VK_ERROR_OUT_OF_POOL_MEMORY_KHR = VK_ERROR_OUT_OF_POOL_MEMORY, VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = VK_ERROR_INVALID_EXTERNAL_HANDLE, VK_ERROR_FRAGMENTATION_EXT = VK_ERROR_FRAGMENTATION, VK_ERROR_INVALID_DEVICE_ADDRESS_EXT = VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS, VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR = VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS, VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT = VK_PIPELINE_COMPILE_REQUIRED_EXT, VK_RESULT_MAX_ENUM = $7FFFFFFF ); type P_VkStructureType = ^VkStructureType; VkStructureType = ( VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2, VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3, VK_STRUCTURE_TYPE_SUBMIT_INFO = 4, VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5, VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6, VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7, VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8, VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9, VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17, VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18, VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19, VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20, VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22, VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23, VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24, VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25, VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26, VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27, VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28, VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29, VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30, VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32, VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34, VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35, VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36, VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37, VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38, VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39, VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40, VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41, VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42, VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44, VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45, VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46, VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47, VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES = 1000094000, VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO = 1000157000, VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO = 1000157001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES = 1000083000, VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS = 1000127000, VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO = 1000127001, VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO = 1000060000, VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO = 1000060003, VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO = 1000060004, VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO = 1000060005, VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO = 1000060006, VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO = 1000060013, VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO = 1000060014, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES = 1000070000, VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO = 1000070001, VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2 = 1000146000, VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2 = 1000146001, VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2 = 1000146002, VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2 = 1000146003, VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2 = 1000146004, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2 = 1000059000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 = 1000059001, VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2 = 1000059002, VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2 = 1000059003, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2 = 1000059004, VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2 = 1000059005, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2 = 1000059006, VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2 = 1000059007, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2 = 1000059008, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES = 1000117000, VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO = 1000117001, VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO = 1000117002, VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO = 1000117003, VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO = 1000053000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES = 1000053001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES = 1000053002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES = 1000120000, VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO = 1000145000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES = 1000145001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES = 1000145002, VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2 = 1000145003, VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO = 1000156000, VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO = 1000156001, VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO = 1000156002, VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO = 1000156003, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES = 1000156004, VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES = 1000156005, VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO = 1000085000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO = 1000071000, VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES = 1000071001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO = 1000071002, VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES = 1000071003, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES = 1000071004, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO = 1000072000, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO = 1000072001, VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO = 1000072002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO = 1000112000, VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES = 1000112001, VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO = 1000113000, VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO = 1000077000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO = 1000076000, VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES = 1000076001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES = 1000168000, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT = 1000168001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES = 1000063000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES = 49, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES = 50, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES = 51, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES = 52, VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO = 1000147000, VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2 = 1000109000, VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2 = 1000109001, VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2 = 1000109002, VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2 = 1000109003, VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2 = 1000109004, VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO = 1000109005, VK_STRUCTURE_TYPE_SUBPASS_END_INFO = 1000109006, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES = 1000177000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES = 1000196000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES = 1000180000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES = 1000082000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES = 1000197000, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO = 1000161000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES = 1000161001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES = 1000161002, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO = 1000161003, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT = 1000161004, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES = 1000199000, VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE = 1000199001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES = 1000221000, VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO = 1000246000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES = 1000130000, VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO = 1000130001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES = 1000211000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES = 1000108000, VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO = 1000108001, VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO = 1000108002, VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO = 1000108003, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES = 1000253000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES = 1000175000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES = 1000241000, VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT = 1000241001, VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT = 1000241002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES = 1000261000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES = 1000207000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES = 1000207001, VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO = 1000207002, VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO = 1000207003, VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO = 1000207004, VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO = 1000207005, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES = 1000257000, VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO = 1000244001, VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO = 1000257002, VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO = 1000257003, VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO = 1000257004, VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000, VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001, VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR = 1000060007, VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR = 1000060008, VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR = 1000060009, VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR = 1000060010, VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR = 1000060011, VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR = 1000060012, VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 1000002000, VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 1000002001, VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR = 1000003000, VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000, VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000, VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = 1000018000, VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000, VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001, VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT = 1000028000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT = 1000028001, VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_STREAM_CREATE_INFO_EXT = 1000028002, VK_STRUCTURE_TYPE_IMAGE_VIEW_HANDLE_INFO_NVX = 1000030000, VK_STRUCTURE_TYPE_IMAGE_VIEW_ADDRESS_PROPERTIES_NVX = 1000030001, VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000, VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP = 1000049000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV = 1000050000, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = 1000056000, VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = 1000056001, VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057000, VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057001, VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV = 1000058000, VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000, VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN = 1000062000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES_EXT = 1000066000, VK_STRUCTURE_TYPE_IMAGE_VIEW_ASTC_DECODE_MODE_EXT = 1000067000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT = 1000067001, VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073000, VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073001, VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR = 1000073002, VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR = 1000073003, VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR = 1000074000, VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR = 1000074001, VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR = 1000074002, VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR = 1000075000, VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078000, VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078001, VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR = 1000078002, VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR = 1000078003, VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR = 1000079000, VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR = 1000079001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR = 1000080000, VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_CONDITIONAL_RENDERING_INFO_EXT = 1000081000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT = 1000081001, VK_STRUCTURE_TYPE_CONDITIONAL_RENDERING_BEGIN_INFO_EXT = 1000081002, VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV = 1000087000, VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT = 1000090000, VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT = 1000091000, VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT = 1000091001, VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT = 1000091002, VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT = 1000091003, VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE = 1000092000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_ATTRIBUTES_PROPERTIES_NVX = 1000097000, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV = 1000098000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT = 1000099000, VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT = 1000099001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT = 1000101000, VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT = 1000101001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT = 1000102000, VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT = 1000102001, VK_STRUCTURE_TYPE_HDR_METADATA_EXT = 1000105000, VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR = 1000111000, VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114000, VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114001, VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR = 1000114002, VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR = 1000115000, VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR = 1000115001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR = 1000116000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR = 1000116001, VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_CREATE_INFO_KHR = 1000116002, VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_SUBMIT_INFO_KHR = 1000116003, VK_STRUCTURE_TYPE_ACQUIRE_PROFILING_LOCK_INFO_KHR = 1000116004, VK_STRUCTURE_TYPE_PERFORMANCE_COUNTER_KHR = 1000116005, VK_STRUCTURE_TYPE_PERFORMANCE_COUNTER_DESCRIPTION_KHR = 1000116006, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR = 1000119000, VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001, VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002, VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR = 1000121000, VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR = 1000121001, VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR = 1000121002, VK_STRUCTURE_TYPE_DISPLAY_PLANE_INFO_2_KHR = 1000121003, VK_STRUCTURE_TYPE_DISPLAY_PLANE_CAPABILITIES_2_KHR = 1000121004, VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000, VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000, VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT = 1000128000, VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT = 1000128001, VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT = 1000128002, VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT = 1000128003, VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT = 1000128004, VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID = 1000129000, VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID = 1000129001, VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID = 1000129002, VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID = 1000129003, VK_STRUCTURE_TYPE_MEMORY_GET_ANDROID_HARDWARE_BUFFER_INFO_ANDROID = 1000129004, VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID = 1000129005, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT = 1000138000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES_EXT = 1000138001, VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT = 1000138002, VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO_EXT = 1000138003, VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT = 1000143000, VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT = 1000143001, VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT = 1000143002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT = 1000143003, VK_STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT = 1000143004, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT = 1000148000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT = 1000148001, VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT = 1000148002, VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV = 1000149000, VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR = 1000150007, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_GEOMETRY_INFO_KHR = 1000150000, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_DEVICE_ADDRESS_INFO_KHR = 1000150002, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR = 1000150003, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR = 1000150004, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR = 1000150005, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR = 1000150006, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_VERSION_INFO_KHR = 1000150009, VK_STRUCTURE_TYPE_COPY_ACCELERATION_STRUCTURE_INFO_KHR = 1000150010, VK_STRUCTURE_TYPE_COPY_ACCELERATION_STRUCTURE_TO_MEMORY_INFO_KHR = 1000150011, VK_STRUCTURE_TYPE_COPY_MEMORY_TO_ACCELERATION_STRUCTURE_INFO_KHR = 1000150012, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR = 1000150013, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR = 1000150014, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR = 1000150017, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR = 1000150020, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR = 1000347000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR = 1000347001, VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR = 1000150015, VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR = 1000150016, VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_INTERFACE_CREATE_INFO_KHR = 1000150018, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR = 1000348013, VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV = 1000152000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV = 1000154000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV = 1000154001, VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT = 1000158000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT = 1000158002, VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT = 1000158003, VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT = 1000158004, VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT = 1000158005, VK_STRUCTURE_TYPE_VALIDATION_CACHE_CREATE_INFO_EXT = 1000160000, VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT = 1000160001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_FEATURES_KHR = 1000163000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_PROPERTIES_KHR = 1000163001, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV = 1000164000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV = 1000164001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV = 1000164002, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV = 1000164005, VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_NV = 1000165000, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_NV = 1000165001, VK_STRUCTURE_TYPE_GEOMETRY_NV = 1000165003, VK_STRUCTURE_TYPE_GEOMETRY_TRIANGLES_NV = 1000165004, VK_STRUCTURE_TYPE_GEOMETRY_AABB_NV = 1000165005, VK_STRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NV = 1000165006, VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_NV = 1000165007, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_INFO_NV = 1000165008, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV = 1000165009, VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_NV = 1000165011, VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_INFO_NV = 1000165012, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV = 1000166000, VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV = 1000166001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT = 1000170000, VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT = 1000170001, VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT = 1000174000, VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT = 1000178000, VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT = 1000178001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT = 1000178002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR = 1000181000, VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD = 1000183000, VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT = 1000184000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD = 1000185000, VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD = 1000189000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT = 1000190000, VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT = 1000190001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT = 1000190002, VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP = 1000191000, VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO_EXT = 1000192000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV = 1000201000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV = 1000202000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV = 1000202001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_NV = 1000203000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV = 1000204000, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_EXCLUSIVE_SCISSOR_STATE_CREATE_INFO_NV = 1000205000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV = 1000205002, VK_STRUCTURE_TYPE_CHECKPOINT_DATA_NV = 1000206000, VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV = 1000206001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL = 1000209000, VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_QUERY_CREATE_INFO_INTEL = 1000210000, VK_STRUCTURE_TYPE_INITIALIZE_PERFORMANCE_API_INFO_INTEL = 1000210001, VK_STRUCTURE_TYPE_PERFORMANCE_MARKER_INFO_INTEL = 1000210002, VK_STRUCTURE_TYPE_PERFORMANCE_STREAM_MARKER_INFO_INTEL = 1000210003, VK_STRUCTURE_TYPE_PERFORMANCE_OVERRIDE_INFO_INTEL = 1000210004, VK_STRUCTURE_TYPE_PERFORMANCE_CONFIGURATION_ACQUIRE_INFO_INTEL = 1000210005, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT = 1000212000, VK_STRUCTURE_TYPE_DISPLAY_NATIVE_HDR_SURFACE_CAPABILITIES_AMD = 1000213000, VK_STRUCTURE_TYPE_SWAPCHAIN_DISPLAY_NATIVE_HDR_CREATE_INFO_AMD = 1000213001, VK_STRUCTURE_TYPE_IMAGEPIPE_SURFACE_CREATE_INFO_FUCHSIA = 1000214000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES_KHR = 1000215000, VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT = 1000218000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_PROPERTIES_EXT = 1000218001, VK_STRUCTURE_TYPE_RENDER_PASS_FRAGMENT_DENSITY_MAP_CREATE_INFO_EXT = 1000218002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT = 1000225000, VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO_EXT = 1000225001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES_EXT = 1000225002, VK_STRUCTURE_TYPE_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR = 1000226000, VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR = 1000226001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR = 1000226002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR = 1000226003, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_KHR = 1000226004, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD = 1000227000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD = 1000229000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT = 1000234000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT = 1000237000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT = 1000238000, VK_STRUCTURE_TYPE_MEMORY_PRIORITY_ALLOCATE_INFO_EXT = 1000238001, VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR = 1000239000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV = 1000240000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT = 1000244000, VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT = 1000244002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES_EXT = 1000245000, VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT = 1000247000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV = 1000249000, VK_STRUCTURE_TYPE_COOPERATIVE_MATRIX_PROPERTIES_NV = 1000249001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_NV = 1000249002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV = 1000250000, VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_REDUCTION_STATE_CREATE_INFO_NV = 1000250001, VK_STRUCTURE_TYPE_FRAMEBUFFER_MIXED_SAMPLES_COMBINATION_NV = 1000250002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT = 1000251000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT = 1000252000, VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT = 1000255000, VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_FULL_SCREEN_EXCLUSIVE_EXT = 1000255002, VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT = 1000255001, VK_STRUCTURE_TYPE_HEADLESS_SURFACE_CREATE_INFO_EXT = 1000256000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT = 1000259000, VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT = 1000259001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT = 1000259002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT = 1000260000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT = 1000265000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT = 1000267000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR = 1000269000, VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR = 1000269001, VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_PROPERTIES_KHR = 1000269002, VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INFO_KHR = 1000269003, VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_STATISTIC_KHR = 1000269004, VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR = 1000269005, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES_EXT = 1000276000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV = 1000277000, VK_STRUCTURE_TYPE_GRAPHICS_SHADER_GROUP_CREATE_INFO_NV = 1000277001, VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV = 1000277002, VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_TOKEN_NV = 1000277003, VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NV = 1000277004, VK_STRUCTURE_TYPE_GENERATED_COMMANDS_INFO_NV = 1000277005, VK_STRUCTURE_TYPE_GENERATED_COMMANDS_MEMORY_REQUIREMENTS_INFO_NV = 1000277006, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV = 1000277007, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT = 1000281000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES_EXT = 1000281001, VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDER_PASS_TRANSFORM_INFO_QCOM = 1000282000, VK_STRUCTURE_TYPE_RENDER_PASS_TRANSFORM_BEGIN_INFO_QCOM = 1000282001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_MEMORY_REPORT_FEATURES_EXT = 1000284000, VK_STRUCTURE_TYPE_DEVICE_DEVICE_MEMORY_REPORT_CREATE_INFO_EXT = 1000284001, VK_STRUCTURE_TYPE_DEVICE_MEMORY_REPORT_CALLBACK_DATA_EXT = 1000284002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT = 1000286000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT = 1000286001, VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT = 1000287000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT = 1000287001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT = 1000287002, VK_STRUCTURE_TYPE_PIPELINE_LIBRARY_CREATE_INFO_KHR = 1000290000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES_EXT = 1000295000, VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO_EXT = 1000295001, VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO_EXT = 1000295002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES_EXT = 1000297000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV = 1000300000, VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV = 1000300001, VK_STRUCTURE_TYPE_MEMORY_BARRIER_2_KHR = 1000314000, VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2_KHR = 1000314001, VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2_KHR = 1000314002, VK_STRUCTURE_TYPE_DEPENDENCY_INFO_KHR = 1000314003, VK_STRUCTURE_TYPE_SUBMIT_INFO_2_KHR = 1000314004, VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO_KHR = 1000314005, VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO_KHR = 1000314006, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES_KHR = 1000314007, VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_2_NV = 1000314008, VK_STRUCTURE_TYPE_CHECKPOINT_DATA_2_NV = 1000314009, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES_KHR = 1000325000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_PROPERTIES_NV = 1000326000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV = 1000326001, VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_ENUM_STATE_CREATE_INFO_NV = 1000326002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT = 1000332000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT = 1000332001, VK_STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM = 1000333000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES_EXT = 1000335000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR = 1000336000, VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2_KHR = 1000337000, VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2_KHR = 1000337001, VK_STRUCTURE_TYPE_COPY_BUFFER_TO_IMAGE_INFO_2_KHR = 1000337002, VK_STRUCTURE_TYPE_COPY_IMAGE_TO_BUFFER_INFO_2_KHR = 1000337003, VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2_KHR = 1000337004, VK_STRUCTURE_TYPE_RESOLVE_IMAGE_INFO_2_KHR = 1000337005, VK_STRUCTURE_TYPE_BUFFER_COPY_2_KHR = 1000337006, VK_STRUCTURE_TYPE_IMAGE_COPY_2_KHR = 1000337007, VK_STRUCTURE_TYPE_IMAGE_BLIT_2_KHR = 1000337008, VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2_KHR = 1000337009, VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2_KHR = 1000337010, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT = 1000340000, VK_STRUCTURE_TYPE_DIRECTFB_SURFACE_CREATE_INFO_EXT = 1000346000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_VALVE = 1000351000, VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE = 1000351002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES, VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2, VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2, VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2, VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2, VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO, VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO, VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO, VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO, VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO, VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO_KHR = VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO, VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO_KHR = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES, VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO, VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO, VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO, VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO, VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES, VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES, VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO, VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES, VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO, VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO_KHR = VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO, VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO_KHR = VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO, VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2_KHR = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2, VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2_KHR = VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2, VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2_KHR = VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2, VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2_KHR = VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2, VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2_KHR = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2, VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO_KHR = VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO, VK_STRUCTURE_TYPE_SUBPASS_END_INFO_KHR = VK_STRUCTURE_TYPE_SUBPASS_END_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO, VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES, VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES, VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO, VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO, VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES_KHR, VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS, VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES, VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO, VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR = VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2, VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2, VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR = VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2, VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2, VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR = VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2, VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO, VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO, VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO_KHR = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO, VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO_KHR = VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO, VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO_KHR = VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES, VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES_KHR = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES, VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR = VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO, VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT_EXT = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT_KHR = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES, VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR = VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES, VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO, VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO, VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO_KHR = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO, VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO_KHR = VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO, VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO_INTEL = VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_QUERY_CREATE_INFO_INTEL, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES, VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR = VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT, VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT, VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_EXT = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO, VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES, VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_KHR = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO, VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO, VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO_KHR = VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO, VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES, VK_STRUCTURE_TYPE_MAX_ENUM = $7FFFFFFF ); type P_VkImageLayout = ^VkImageLayout; VkImageLayout = ( VK_IMAGE_LAYOUT_UNDEFINED = 0, VK_IMAGE_LAYOUT_GENERAL = 1, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 2, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3, VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 4, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 5, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 6, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 7, VK_IMAGE_LAYOUT_PREINITIALIZED = 8, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL = 1000117000, VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL = 1000117001, VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL = 1000241000, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL = 1000241001, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL = 1000241002, VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL = 1000241003, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = 1000111000, VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV = 1000164003, VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT = 1000218000, VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR = 1000314000, VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR = 1000314001, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV, VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR = VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_MAX_ENUM = $7FFFFFFF ); type P_VkObjectType = ^VkObjectType; VkObjectType = ( VK_OBJECT_TYPE_UNKNOWN = 0, VK_OBJECT_TYPE_INSTANCE = 1, VK_OBJECT_TYPE_PHYSICAL_DEVICE = 2, VK_OBJECT_TYPE_DEVICE = 3, VK_OBJECT_TYPE_QUEUE = 4, VK_OBJECT_TYPE_SEMAPHORE = 5, VK_OBJECT_TYPE_COMMAND_BUFFER = 6, VK_OBJECT_TYPE_FENCE = 7, VK_OBJECT_TYPE_DEVICE_MEMORY = 8, VK_OBJECT_TYPE_BUFFER = 9, VK_OBJECT_TYPE_IMAGE = 10, VK_OBJECT_TYPE_EVENT = 11, VK_OBJECT_TYPE_QUERY_POOL = 12, VK_OBJECT_TYPE_BUFFER_VIEW = 13, VK_OBJECT_TYPE_IMAGE_VIEW = 14, VK_OBJECT_TYPE_SHADER_MODULE = 15, VK_OBJECT_TYPE_PIPELINE_CACHE = 16, VK_OBJECT_TYPE_PIPELINE_LAYOUT = 17, VK_OBJECT_TYPE_RENDER_PASS = 18, VK_OBJECT_TYPE_PIPELINE = 19, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 20, VK_OBJECT_TYPE_SAMPLER = 21, VK_OBJECT_TYPE_DESCRIPTOR_POOL = 22, VK_OBJECT_TYPE_DESCRIPTOR_SET = 23, VK_OBJECT_TYPE_FRAMEBUFFER = 24, VK_OBJECT_TYPE_COMMAND_POOL = 25, VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION = 1000156000, VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE = 1000085000, VK_OBJECT_TYPE_SURFACE_KHR = 1000000000, VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000, VK_OBJECT_TYPE_DISPLAY_KHR = 1000002000, VK_OBJECT_TYPE_DISPLAY_MODE_KHR = 1000002001, VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT = 1000128000, VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR = 1000150000, VK_OBJECT_TYPE_VALIDATION_CACHE_EXT = 1000160000, VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV = 1000165000, VK_OBJECT_TYPE_PERFORMANCE_CONFIGURATION_INTEL = 1000210000, VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR = 1000268000, VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NV = 1000277000, VK_OBJECT_TYPE_PRIVATE_DATA_SLOT_EXT = 1000295000, VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE, VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR = VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION, VK_OBJECT_TYPE_MAX_ENUM = $7FFFFFFF ); type P_VkVendorId = ^VkVendorId; VkVendorId = ( VK_VENDOR_ID_VIV = $10001, VK_VENDOR_ID_VSI = $10002, VK_VENDOR_ID_KAZAN = $10003, VK_VENDOR_ID_CODEPLAY = $10004, VK_VENDOR_ID_MESA = $10005, VK_VENDOR_ID_POCL = $10006, VK_VENDOR_ID_MAX_ENUM = $7FFFFFFF ); type P_VkPipelineCacheHeaderVersion = ^VkPipelineCacheHeaderVersion; VkPipelineCacheHeaderVersion = ( VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = $7FFFFFFF ); type P_VkSystemAllocationScope = ^VkSystemAllocationScope; VkSystemAllocationScope = ( VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1, VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4, VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = $7FFFFFFF ); type P_VkInternalAllocationType = ^VkInternalAllocationType; VkInternalAllocationType = ( VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0, VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = $7FFFFFFF ); type P_VkFormat = ^VkFormat; VkFormat = ( VK_FORMAT_UNDEFINED = 0, VK_FORMAT_R4G4_UNORM_PACK8 = 1, VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2, VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3, VK_FORMAT_R5G6B5_UNORM_PACK16 = 4, VK_FORMAT_B5G6R5_UNORM_PACK16 = 5, VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6, VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7, VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8, VK_FORMAT_R8_UNORM = 9, VK_FORMAT_R8_SNORM = 10, VK_FORMAT_R8_USCALED = 11, VK_FORMAT_R8_SSCALED = 12, VK_FORMAT_R8_UINT = 13, VK_FORMAT_R8_SINT = 14, VK_FORMAT_R8_SRGB = 15, VK_FORMAT_R8G8_UNORM = 16, VK_FORMAT_R8G8_SNORM = 17, VK_FORMAT_R8G8_USCALED = 18, VK_FORMAT_R8G8_SSCALED = 19, VK_FORMAT_R8G8_UINT = 20, VK_FORMAT_R8G8_SINT = 21, VK_FORMAT_R8G8_SRGB = 22, VK_FORMAT_R8G8B8_UNORM = 23, VK_FORMAT_R8G8B8_SNORM = 24, VK_FORMAT_R8G8B8_USCALED = 25, VK_FORMAT_R8G8B8_SSCALED = 26, VK_FORMAT_R8G8B8_UINT = 27, VK_FORMAT_R8G8B8_SINT = 28, VK_FORMAT_R8G8B8_SRGB = 29, VK_FORMAT_B8G8R8_UNORM = 30, VK_FORMAT_B8G8R8_SNORM = 31, VK_FORMAT_B8G8R8_USCALED = 32, VK_FORMAT_B8G8R8_SSCALED = 33, VK_FORMAT_B8G8R8_UINT = 34, VK_FORMAT_B8G8R8_SINT = 35, VK_FORMAT_B8G8R8_SRGB = 36, VK_FORMAT_R8G8B8A8_UNORM = 37, VK_FORMAT_R8G8B8A8_SNORM = 38, VK_FORMAT_R8G8B8A8_USCALED = 39, VK_FORMAT_R8G8B8A8_SSCALED = 40, VK_FORMAT_R8G8B8A8_UINT = 41, VK_FORMAT_R8G8B8A8_SINT = 42, VK_FORMAT_R8G8B8A8_SRGB = 43, VK_FORMAT_B8G8R8A8_UNORM = 44, VK_FORMAT_B8G8R8A8_SNORM = 45, VK_FORMAT_B8G8R8A8_USCALED = 46, VK_FORMAT_B8G8R8A8_SSCALED = 47, VK_FORMAT_B8G8R8A8_UINT = 48, VK_FORMAT_B8G8R8A8_SINT = 49, VK_FORMAT_B8G8R8A8_SRGB = 50, VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51, VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52, VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53, VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54, VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55, VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56, VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57, VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58, VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59, VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60, VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61, VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62, VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63, VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64, VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65, VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66, VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67, VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68, VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69, VK_FORMAT_R16_UNORM = 70, VK_FORMAT_R16_SNORM = 71, VK_FORMAT_R16_USCALED = 72, VK_FORMAT_R16_SSCALED = 73, VK_FORMAT_R16_UINT = 74, VK_FORMAT_R16_SINT = 75, VK_FORMAT_R16_SFLOAT = 76, VK_FORMAT_R16G16_UNORM = 77, VK_FORMAT_R16G16_SNORM = 78, VK_FORMAT_R16G16_USCALED = 79, VK_FORMAT_R16G16_SSCALED = 80, VK_FORMAT_R16G16_UINT = 81, VK_FORMAT_R16G16_SINT = 82, VK_FORMAT_R16G16_SFLOAT = 83, VK_FORMAT_R16G16B16_UNORM = 84, VK_FORMAT_R16G16B16_SNORM = 85, VK_FORMAT_R16G16B16_USCALED = 86, VK_FORMAT_R16G16B16_SSCALED = 87, VK_FORMAT_R16G16B16_UINT = 88, VK_FORMAT_R16G16B16_SINT = 89, VK_FORMAT_R16G16B16_SFLOAT = 90, VK_FORMAT_R16G16B16A16_UNORM = 91, VK_FORMAT_R16G16B16A16_SNORM = 92, VK_FORMAT_R16G16B16A16_USCALED = 93, VK_FORMAT_R16G16B16A16_SSCALED = 94, VK_FORMAT_R16G16B16A16_UINT = 95, VK_FORMAT_R16G16B16A16_SINT = 96, VK_FORMAT_R16G16B16A16_SFLOAT = 97, VK_FORMAT_R32_UINT = 98, VK_FORMAT_R32_SINT = 99, VK_FORMAT_R32_SFLOAT = 100, VK_FORMAT_R32G32_UINT = 101, VK_FORMAT_R32G32_SINT = 102, VK_FORMAT_R32G32_SFLOAT = 103, VK_FORMAT_R32G32B32_UINT = 104, VK_FORMAT_R32G32B32_SINT = 105, VK_FORMAT_R32G32B32_SFLOAT = 106, VK_FORMAT_R32G32B32A32_UINT = 107, VK_FORMAT_R32G32B32A32_SINT = 108, VK_FORMAT_R32G32B32A32_SFLOAT = 109, VK_FORMAT_R64_UINT = 110, VK_FORMAT_R64_SINT = 111, VK_FORMAT_R64_SFLOAT = 112, VK_FORMAT_R64G64_UINT = 113, VK_FORMAT_R64G64_SINT = 114, VK_FORMAT_R64G64_SFLOAT = 115, VK_FORMAT_R64G64B64_UINT = 116, VK_FORMAT_R64G64B64_SINT = 117, VK_FORMAT_R64G64B64_SFLOAT = 118, VK_FORMAT_R64G64B64A64_UINT = 119, VK_FORMAT_R64G64B64A64_SINT = 120, VK_FORMAT_R64G64B64A64_SFLOAT = 121, VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122, VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123, VK_FORMAT_D16_UNORM = 124, VK_FORMAT_X8_D24_UNORM_PACK32 = 125, VK_FORMAT_D32_SFLOAT = 126, VK_FORMAT_S8_UINT = 127, VK_FORMAT_D16_UNORM_S8_UINT = 128, VK_FORMAT_D24_UNORM_S8_UINT = 129, VK_FORMAT_D32_SFLOAT_S8_UINT = 130, VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131, VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132, VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133, VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134, VK_FORMAT_BC2_UNORM_BLOCK = 135, VK_FORMAT_BC2_SRGB_BLOCK = 136, VK_FORMAT_BC3_UNORM_BLOCK = 137, VK_FORMAT_BC3_SRGB_BLOCK = 138, VK_FORMAT_BC4_UNORM_BLOCK = 139, VK_FORMAT_BC4_SNORM_BLOCK = 140, VK_FORMAT_BC5_UNORM_BLOCK = 141, VK_FORMAT_BC5_SNORM_BLOCK = 142, VK_FORMAT_BC6H_UFLOAT_BLOCK = 143, VK_FORMAT_BC6H_SFLOAT_BLOCK = 144, VK_FORMAT_BC7_UNORM_BLOCK = 145, VK_FORMAT_BC7_SRGB_BLOCK = 146, VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147, VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148, VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149, VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150, VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151, VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152, VK_FORMAT_EAC_R11_UNORM_BLOCK = 153, VK_FORMAT_EAC_R11_SNORM_BLOCK = 154, VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155, VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156, VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157, VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158, VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159, VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160, VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161, VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162, VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163, VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164, VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165, VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166, VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167, VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168, VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169, VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170, VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171, VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172, VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173, VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174, VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175, VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176, VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177, VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178, VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179, VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180, VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181, VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182, VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183, VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184, VK_FORMAT_G8B8G8R8_422_UNORM = 1000156000, VK_FORMAT_B8G8R8G8_422_UNORM = 1000156001, VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM = 1000156002, VK_FORMAT_G8_B8R8_2PLANE_420_UNORM = 1000156003, VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM = 1000156004, VK_FORMAT_G8_B8R8_2PLANE_422_UNORM = 1000156005, VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM = 1000156006, VK_FORMAT_R10X6_UNORM_PACK16 = 1000156007, VK_FORMAT_R10X6G10X6_UNORM_2PACK16 = 1000156008, VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 = 1000156009, VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = 1000156010, VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = 1000156011, VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16 = 1000156012, VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 = 1000156013, VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16 = 1000156014, VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16 = 1000156015, VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16 = 1000156016, VK_FORMAT_R12X4_UNORM_PACK16 = 1000156017, VK_FORMAT_R12X4G12X4_UNORM_2PACK16 = 1000156018, VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 = 1000156019, VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = 1000156020, VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = 1000156021, VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16 = 1000156022, VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16 = 1000156023, VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16 = 1000156024, VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16 = 1000156025, VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16 = 1000156026, VK_FORMAT_G16B16G16R16_422_UNORM = 1000156027, VK_FORMAT_B16G16R16G16_422_UNORM = 1000156028, VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM = 1000156029, VK_FORMAT_G16_B16R16_2PLANE_420_UNORM = 1000156030, VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM = 1000156031, VK_FORMAT_G16_B16R16_2PLANE_422_UNORM = 1000156032, VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM = 1000156033, VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000, VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001, VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002, VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003, VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004, VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005, VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006, VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007, VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT = 1000066000, VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT = 1000066001, VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT = 1000066002, VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT = 1000066003, VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT = 1000066004, VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT = 1000066005, VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT = 1000066006, VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT = 1000066007, VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT = 1000066008, VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT = 1000066009, VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT = 1000066010, VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT = 1000066011, VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT = 1000066012, VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT = 1000066013, VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT = 1000340000, VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT = 1000340001, VK_FORMAT_G8B8G8R8_422_UNORM_KHR = VK_FORMAT_G8B8G8R8_422_UNORM, VK_FORMAT_B8G8R8G8_422_UNORM_KHR = VK_FORMAT_B8G8R8G8_422_UNORM, VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM, VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM, VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM, VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR = VK_FORMAT_G8_B8R8_2PLANE_422_UNORM, VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM, VK_FORMAT_R10X6_UNORM_PACK16_KHR = VK_FORMAT_R10X6_UNORM_PACK16, VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR = VK_FORMAT_R10X6G10X6_UNORM_2PACK16, VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR = VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16, VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR = VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16, VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR = VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16, VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16, VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16, VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16, VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16, VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16, VK_FORMAT_R12X4_UNORM_PACK16_KHR = VK_FORMAT_R12X4_UNORM_PACK16, VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR = VK_FORMAT_R12X4G12X4_UNORM_2PACK16, VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR = VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16, VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR = VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16, VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR = VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16, VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16, VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16, VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16, VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16, VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16, VK_FORMAT_G16B16G16R16_422_UNORM_KHR = VK_FORMAT_G16B16G16R16_422_UNORM, VK_FORMAT_B16G16R16G16_422_UNORM_KHR = VK_FORMAT_B16G16R16G16_422_UNORM, VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM, VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR = VK_FORMAT_G16_B16R16_2PLANE_420_UNORM, VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM, VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR = VK_FORMAT_G16_B16R16_2PLANE_422_UNORM, VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM, VK_FORMAT_MAX_ENUM = $7FFFFFFF ); type P_VkImageTiling = ^VkImageTiling; VkImageTiling = ( VK_IMAGE_TILING_OPTIMAL = 0, VK_IMAGE_TILING_LINEAR = 1, VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT = 1000158000, VK_IMAGE_TILING_MAX_ENUM = $7FFFFFFF ); type P_VkImageType = ^VkImageType; VkImageType = ( VK_IMAGE_TYPE_1D = 0, VK_IMAGE_TYPE_2D = 1, VK_IMAGE_TYPE_3D = 2, VK_IMAGE_TYPE_MAX_ENUM = $7FFFFFFF ); type P_VkPhysicalDeviceType = ^VkPhysicalDeviceType; VkPhysicalDeviceType = ( VK_PHYSICAL_DEVICE_TYPE_OTHER = 0, VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, VK_PHYSICAL_DEVICE_TYPE_CPU = 4, VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = $7FFFFFFF ); type P_VkQueryType = ^VkQueryType; VkQueryType = ( VK_QUERY_TYPE_OCCLUSION = 0, VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, VK_QUERY_TYPE_TIMESTAMP = 2, VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT = 1000028004, VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR = 1000116000, VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR = 1000150000, VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR = 1000150001, VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV = 1000165000, VK_QUERY_TYPE_PERFORMANCE_QUERY_INTEL = 1000210000, VK_QUERY_TYPE_MAX_ENUM = $7FFFFFFF ); type P_VkSharingMode = ^VkSharingMode; VkSharingMode = ( VK_SHARING_MODE_EXCLUSIVE = 0, VK_SHARING_MODE_CONCURRENT = 1, VK_SHARING_MODE_MAX_ENUM = $7FFFFFFF ); type P_VkComponentSwizzle = ^VkComponentSwizzle; VkComponentSwizzle = ( VK_COMPONENT_SWIZZLE_IDENTITY = 0, VK_COMPONENT_SWIZZLE_ZERO = 1, VK_COMPONENT_SWIZZLE_ONE = 2, VK_COMPONENT_SWIZZLE_R = 3, VK_COMPONENT_SWIZZLE_G = 4, VK_COMPONENT_SWIZZLE_B = 5, VK_COMPONENT_SWIZZLE_A = 6, VK_COMPONENT_SWIZZLE_MAX_ENUM = $7FFFFFFF ); type P_VkImageViewType = ^VkImageViewType; VkImageViewType = ( VK_IMAGE_VIEW_TYPE_1D = 0, VK_IMAGE_VIEW_TYPE_2D = 1, VK_IMAGE_VIEW_TYPE_3D = 2, VK_IMAGE_VIEW_TYPE_CUBE = 3, VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6, VK_IMAGE_VIEW_TYPE_MAX_ENUM = $7FFFFFFF ); type P_VkBlendFactor = ^VkBlendFactor; VkBlendFactor = ( VK_BLEND_FACTOR_ZERO = 0, VK_BLEND_FACTOR_ONE = 1, VK_BLEND_FACTOR_SRC_COLOR = 2, VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3, VK_BLEND_FACTOR_DST_COLOR = 4, VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 5, VK_BLEND_FACTOR_SRC_ALPHA = 6, VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 7, VK_BLEND_FACTOR_DST_ALPHA = 8, VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 9, VK_BLEND_FACTOR_CONSTANT_COLOR = 10, VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11, VK_BLEND_FACTOR_CONSTANT_ALPHA = 12, VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13, VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 14, VK_BLEND_FACTOR_SRC1_COLOR = 15, VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16, VK_BLEND_FACTOR_SRC1_ALPHA = 17, VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18, VK_BLEND_FACTOR_MAX_ENUM = $7FFFFFFF ); type P_VkBlendOp = ^VkBlendOp; VkBlendOp = ( VK_BLEND_OP_ADD = 0, VK_BLEND_OP_SUBTRACT = 1, VK_BLEND_OP_REVERSE_SUBTRACT = 2, VK_BLEND_OP_MIN = 3, VK_BLEND_OP_MAX = 4, VK_BLEND_OP_ZERO_EXT = 1000148000, VK_BLEND_OP_SRC_EXT = 1000148001, VK_BLEND_OP_DST_EXT = 1000148002, VK_BLEND_OP_SRC_OVER_EXT = 1000148003, VK_BLEND_OP_DST_OVER_EXT = 1000148004, VK_BLEND_OP_SRC_IN_EXT = 1000148005, VK_BLEND_OP_DST_IN_EXT = 1000148006, VK_BLEND_OP_SRC_OUT_EXT = 1000148007, VK_BLEND_OP_DST_OUT_EXT = 1000148008, VK_BLEND_OP_SRC_ATOP_EXT = 1000148009, VK_BLEND_OP_DST_ATOP_EXT = 1000148010, VK_BLEND_OP_XOR_EXT = 1000148011, VK_BLEND_OP_MULTIPLY_EXT = 1000148012, VK_BLEND_OP_SCREEN_EXT = 1000148013, VK_BLEND_OP_OVERLAY_EXT = 1000148014, VK_BLEND_OP_DARKEN_EXT = 1000148015, VK_BLEND_OP_LIGHTEN_EXT = 1000148016, VK_BLEND_OP_COLORDODGE_EXT = 1000148017, VK_BLEND_OP_COLORBURN_EXT = 1000148018, VK_BLEND_OP_HARDLIGHT_EXT = 1000148019, VK_BLEND_OP_SOFTLIGHT_EXT = 1000148020, VK_BLEND_OP_DIFFERENCE_EXT = 1000148021, VK_BLEND_OP_EXCLUSION_EXT = 1000148022, VK_BLEND_OP_INVERT_EXT = 1000148023, VK_BLEND_OP_INVERT_RGB_EXT = 1000148024, VK_BLEND_OP_LINEARDODGE_EXT = 1000148025, VK_BLEND_OP_LINEARBURN_EXT = 1000148026, VK_BLEND_OP_VIVIDLIGHT_EXT = 1000148027, VK_BLEND_OP_LINEARLIGHT_EXT = 1000148028, VK_BLEND_OP_PINLIGHT_EXT = 1000148029, VK_BLEND_OP_HARDMIX_EXT = 1000148030, VK_BLEND_OP_HSL_HUE_EXT = 1000148031, VK_BLEND_OP_HSL_SATURATION_EXT = 1000148032, VK_BLEND_OP_HSL_COLOR_EXT = 1000148033, VK_BLEND_OP_HSL_LUMINOSITY_EXT = 1000148034, VK_BLEND_OP_PLUS_EXT = 1000148035, VK_BLEND_OP_PLUS_CLAMPED_EXT = 1000148036, VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT = 1000148037, VK_BLEND_OP_PLUS_DARKER_EXT = 1000148038, VK_BLEND_OP_MINUS_EXT = 1000148039, VK_BLEND_OP_MINUS_CLAMPED_EXT = 1000148040, VK_BLEND_OP_CONTRAST_EXT = 1000148041, VK_BLEND_OP_INVERT_OVG_EXT = 1000148042, VK_BLEND_OP_RED_EXT = 1000148043, VK_BLEND_OP_GREEN_EXT = 1000148044, VK_BLEND_OP_BLUE_EXT = 1000148045, VK_BLEND_OP_MAX_ENUM = $7FFFFFFF ); type P_VkCompareOp = ^VkCompareOp; VkCompareOp = ( VK_COMPARE_OP_NEVER = 0, VK_COMPARE_OP_LESS = 1, VK_COMPARE_OP_EQUAL = 2, VK_COMPARE_OP_LESS_OR_EQUAL = 3, VK_COMPARE_OP_GREATER = 4, VK_COMPARE_OP_NOT_EQUAL = 5, VK_COMPARE_OP_GREATER_OR_EQUAL = 6, VK_COMPARE_OP_ALWAYS = 7, VK_COMPARE_OP_MAX_ENUM = $7FFFFFFF ); type P_VkDynamicState = ^VkDynamicState; VkDynamicState = ( VK_DYNAMIC_STATE_VIEWPORT = 0, VK_DYNAMIC_STATE_SCISSOR = 1, VK_DYNAMIC_STATE_LINE_WIDTH = 2, VK_DYNAMIC_STATE_DEPTH_BIAS = 3, VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4, VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5, VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6, VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7, VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8, VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000, VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000, VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT = 1000143000, VK_DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHR = 1000347000, VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV = 1000164004, VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV = 1000164006, VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV = 1000205001, VK_DYNAMIC_STATE_FRAGMENT_SHADING_RATE_KHR = 1000226000, VK_DYNAMIC_STATE_LINE_STIPPLE_EXT = 1000259000, VK_DYNAMIC_STATE_CULL_MODE_EXT = 1000267000, VK_DYNAMIC_STATE_FRONT_FACE_EXT = 1000267001, VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT = 1000267002, VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT = 1000267003, VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT = 1000267004, VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT = 1000267005, VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT = 1000267006, VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT = 1000267007, VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT = 1000267008, VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT = 1000267009, VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT = 1000267010, VK_DYNAMIC_STATE_STENCIL_OP_EXT = 1000267011, VK_DYNAMIC_STATE_MAX_ENUM = $7FFFFFFF ); type P_VkFrontFace = ^VkFrontFace; VkFrontFace = ( VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, VK_FRONT_FACE_CLOCKWISE = 1, VK_FRONT_FACE_MAX_ENUM = $7FFFFFFF ); type P_VkVertexInputRate = ^VkVertexInputRate; VkVertexInputRate = ( VK_VERTEX_INPUT_RATE_VERTEX = 0, VK_VERTEX_INPUT_RATE_INSTANCE = 1, VK_VERTEX_INPUT_RATE_MAX_ENUM = $7FFFFFFF ); type P_VkPrimitiveTopology = ^VkPrimitiveTopology; VkPrimitiveTopology = ( VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0, VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1, VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5, VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6, VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9, VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10, VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = $7FFFFFFF ); type P_VkPolygonMode = ^VkPolygonMode; VkPolygonMode = ( VK_POLYGON_MODE_FILL = 0, VK_POLYGON_MODE_LINE = 1, VK_POLYGON_MODE_POINT = 2, VK_POLYGON_MODE_FILL_RECTANGLE_NV = 1000153000, VK_POLYGON_MODE_MAX_ENUM = $7FFFFFFF ); type P_VkStencilOp = ^VkStencilOp; VkStencilOp = ( VK_STENCIL_OP_KEEP = 0, VK_STENCIL_OP_ZERO = 1, VK_STENCIL_OP_REPLACE = 2, VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3, VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4, VK_STENCIL_OP_INVERT = 5, VK_STENCIL_OP_INCREMENT_AND_WRAP = 6, VK_STENCIL_OP_DECREMENT_AND_WRAP = 7, VK_STENCIL_OP_MAX_ENUM = $7FFFFFFF ); type P_VkLogicOp = ^VkLogicOp; VkLogicOp = ( VK_LOGIC_OP_CLEAR = 0, VK_LOGIC_OP_AND = 1, VK_LOGIC_OP_AND_REVERSE = 2, VK_LOGIC_OP_COPY = 3, VK_LOGIC_OP_AND_INVERTED = 4, VK_LOGIC_OP_NO_OP = 5, VK_LOGIC_OP_XOR = 6, VK_LOGIC_OP_OR = 7, VK_LOGIC_OP_NOR = 8, VK_LOGIC_OP_EQUIVALENT = 9, VK_LOGIC_OP_INVERT = 10, VK_LOGIC_OP_OR_REVERSE = 11, VK_LOGIC_OP_COPY_INVERTED = 12, VK_LOGIC_OP_OR_INVERTED = 13, VK_LOGIC_OP_NAND = 14, VK_LOGIC_OP_SET = 15, VK_LOGIC_OP_MAX_ENUM = $7FFFFFFF ); type P_VkBorderColor = ^VkBorderColor; VkBorderColor = ( VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0, VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1, VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2, VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5, VK_BORDER_COLOR_FLOAT_CUSTOM_EXT = 1000287003, VK_BORDER_COLOR_INT_CUSTOM_EXT = 1000287004, VK_BORDER_COLOR_MAX_ENUM = $7FFFFFFF ); type P_VkFilter = ^VkFilter; VkFilter = ( VK_FILTER_NEAREST = 0, VK_FILTER_LINEAR = 1, VK_FILTER_CUBIC_IMG = 1000015000, VK_FILTER_CUBIC_EXT = VK_FILTER_CUBIC_IMG, VK_FILTER_MAX_ENUM = $7FFFFFFF ); type P_VkSamplerAddressMode = ^VkSamplerAddressMode; VkSamplerAddressMode = ( VK_SAMPLER_ADDRESS_MODE_REPEAT = 0, VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE_KHR = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = $7FFFFFFF ); type P_VkSamplerMipmapMode = ^VkSamplerMipmapMode; VkSamplerMipmapMode = ( VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, VK_SAMPLER_MIPMAP_MODE_LINEAR = 1, VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = $7FFFFFFF ); type P_VkDescriptorType = ^VkDescriptorType; VkDescriptorType = ( VK_DESCRIPTOR_TYPE_SAMPLER = 0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3, VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT = 1000138000, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR = 1000150000, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV = 1000165000, VK_DESCRIPTOR_TYPE_MUTABLE_VALVE = 1000351000, VK_DESCRIPTOR_TYPE_MAX_ENUM = $7FFFFFFF ); type P_VkAttachmentLoadOp = ^VkAttachmentLoadOp; VkAttachmentLoadOp = ( VK_ATTACHMENT_LOAD_OP_LOAD = 0, VK_ATTACHMENT_LOAD_OP_CLEAR = 1, VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2, VK_ATTACHMENT_LOAD_OP_MAX_ENUM = $7FFFFFFF ); type P_VkAttachmentStoreOp = ^VkAttachmentStoreOp; VkAttachmentStoreOp = ( VK_ATTACHMENT_STORE_OP_STORE = 0, VK_ATTACHMENT_STORE_OP_DONT_CARE = 1, VK_ATTACHMENT_STORE_OP_NONE_QCOM = 1000301000, VK_ATTACHMENT_STORE_OP_MAX_ENUM = $7FFFFFFF ); type P_VkPipelineBindPoint = ^VkPipelineBindPoint; VkPipelineBindPoint = ( VK_PIPELINE_BIND_POINT_GRAPHICS = 0, VK_PIPELINE_BIND_POINT_COMPUTE = 1, VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR = 1000165000, VK_PIPELINE_BIND_POINT_RAY_TRACING_NV = VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR, VK_PIPELINE_BIND_POINT_MAX_ENUM = $7FFFFFFF ); type P_VkCommandBufferLevel = ^VkCommandBufferLevel; VkCommandBufferLevel = ( VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0, VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1, VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = $7FFFFFFF ); type P_VkIndexType = ^VkIndexType; VkIndexType = ( VK_INDEX_TYPE_UINT16 = 0, VK_INDEX_TYPE_UINT32 = 1, VK_INDEX_TYPE_NONE_KHR = 1000165000, VK_INDEX_TYPE_UINT8_EXT = 1000265000, VK_INDEX_TYPE_NONE_NV = VK_INDEX_TYPE_NONE_KHR, VK_INDEX_TYPE_MAX_ENUM = $7FFFFFFF ); type P_VkSubpassContents = ^VkSubpassContents; VkSubpassContents = ( VK_SUBPASS_CONTENTS_INLINE = 0, VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1, VK_SUBPASS_CONTENTS_MAX_ENUM = $7FFFFFFF ); type P_VkAccessFlagBits = ^VkAccessFlagBits; VkAccessFlagBits = ( VK_ACCESS_INDIRECT_COMMAND_READ_BIT = $00000001, VK_ACCESS_INDEX_READ_BIT = $00000002, VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = $00000004, VK_ACCESS_UNIFORM_READ_BIT = $00000008, VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = $00000010, VK_ACCESS_SHADER_READ_BIT = $00000020, VK_ACCESS_SHADER_WRITE_BIT = $00000040, VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = $00000080, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = $00000100, VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = $00000200, VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = $00000400, VK_ACCESS_TRANSFER_READ_BIT = $00000800, VK_ACCESS_TRANSFER_WRITE_BIT = $00001000, VK_ACCESS_HOST_READ_BIT = $00002000, VK_ACCESS_HOST_WRITE_BIT = $00004000, VK_ACCESS_MEMORY_READ_BIT = $00008000, VK_ACCESS_MEMORY_WRITE_BIT = $00010000, VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT = $02000000, VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT = $04000000, VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT = $08000000, VK_ACCESS_CONDITIONAL_RENDERING_READ_BIT_EXT = $00100000, VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = $00080000, VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR = $00200000, VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR = $00400000, VK_ACCESS_SHADING_RATE_IMAGE_READ_BIT_NV = $00800000, VK_ACCESS_FRAGMENT_DENSITY_MAP_READ_BIT_EXT = $01000000, VK_ACCESS_COMMAND_PREPROCESS_READ_BIT_NV = $00020000, VK_ACCESS_COMMAND_PREPROCESS_WRITE_BIT_NV = $00040000, VK_ACCESS_NONE_KHR = 0, VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_NV = VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR, VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_NV = VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR, VK_ACCESS_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR = VK_ACCESS_SHADING_RATE_IMAGE_READ_BIT_NV, VK_ACCESS_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkAccessFlags = ^VkAccessFlags; VkAccessFlags = VkFlags; type P_VkImageAspectFlagBits = ^VkImageAspectFlagBits; VkImageAspectFlagBits = ( VK_IMAGE_ASPECT_COLOR_BIT = $00000001, VK_IMAGE_ASPECT_DEPTH_BIT = $00000002, VK_IMAGE_ASPECT_STENCIL_BIT = $00000004, VK_IMAGE_ASPECT_METADATA_BIT = $00000008, VK_IMAGE_ASPECT_PLANE_0_BIT = $00000010, VK_IMAGE_ASPECT_PLANE_1_BIT = $00000020, VK_IMAGE_ASPECT_PLANE_2_BIT = $00000040, VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT = $00000080, VK_IMAGE_ASPECT_MEMORY_PLANE_1_BIT_EXT = $00000100, VK_IMAGE_ASPECT_MEMORY_PLANE_2_BIT_EXT = $00000200, VK_IMAGE_ASPECT_MEMORY_PLANE_3_BIT_EXT = $00000400, VK_IMAGE_ASPECT_PLANE_0_BIT_KHR = VK_IMAGE_ASPECT_PLANE_0_BIT, VK_IMAGE_ASPECT_PLANE_1_BIT_KHR = VK_IMAGE_ASPECT_PLANE_1_BIT, VK_IMAGE_ASPECT_PLANE_2_BIT_KHR = VK_IMAGE_ASPECT_PLANE_2_BIT, VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkImageAspectFlags = ^VkImageAspectFlags; VkImageAspectFlags = VkFlags; type P_VkFormatFeatureFlagBits = ^VkFormatFeatureFlagBits; VkFormatFeatureFlagBits = ( VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = $00000001, VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = $00000002, VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = $00000004, VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = $00000008, VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = $00000010, VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = $00000020, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = $00000040, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = $00000080, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = $00000100, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = $00000200, VK_FORMAT_FEATURE_BLIT_SRC_BIT = $00000400, VK_FORMAT_FEATURE_BLIT_DST_BIT = $00000800, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = $00001000, VK_FORMAT_FEATURE_TRANSFER_SRC_BIT = $00004000, VK_FORMAT_FEATURE_TRANSFER_DST_BIT = $00008000, VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT = $00020000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT = $00040000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT = $00080000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT = $00100000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT = $00200000, VK_FORMAT_FEATURE_DISJOINT_BIT = $00400000, VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT = $00800000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT = $00010000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = $00002000, VK_FORMAT_FEATURE_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR = $20000000, VK_FORMAT_FEATURE_FRAGMENT_DENSITY_MAP_BIT_EXT = $01000000, VK_FORMAT_FEATURE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = $40000000, VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT, VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = VK_FORMAT_FEATURE_TRANSFER_DST_BIT, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT, VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR = VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT, VK_FORMAT_FEATURE_DISJOINT_BIT_KHR = VK_FORMAT_FEATURE_DISJOINT_BIT, VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR = VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG, VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkFormatFeatureFlags = ^VkFormatFeatureFlags; VkFormatFeatureFlags = VkFlags; type P_VkImageCreateFlagBits = ^VkImageCreateFlagBits; VkImageCreateFlagBits = ( VK_IMAGE_CREATE_SPARSE_BINDING_BIT = $00000001, VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = $00000002, VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = $00000004, VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = $00000008, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = $00000010, VK_IMAGE_CREATE_ALIAS_BIT = $00000400, VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT = $00000040, VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT = $00000020, VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT = $00000080, VK_IMAGE_CREATE_EXTENDED_USAGE_BIT = $00000100, VK_IMAGE_CREATE_PROTECTED_BIT = $00000800, VK_IMAGE_CREATE_DISJOINT_BIT = $00000200, VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV = $00002000, VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT = $00001000, VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT = $00004000, VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT, VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT, VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_KHR = VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT, VK_IMAGE_CREATE_EXTENDED_USAGE_BIT_KHR = VK_IMAGE_CREATE_EXTENDED_USAGE_BIT, VK_IMAGE_CREATE_DISJOINT_BIT_KHR = VK_IMAGE_CREATE_DISJOINT_BIT, VK_IMAGE_CREATE_ALIAS_BIT_KHR = VK_IMAGE_CREATE_ALIAS_BIT, VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkImageCreateFlags = ^VkImageCreateFlags; VkImageCreateFlags = VkFlags; type P_VkSampleCountFlagBits = ^VkSampleCountFlagBits; VkSampleCountFlagBits = ( VK_SAMPLE_COUNT_1_BIT = $00000001, VK_SAMPLE_COUNT_2_BIT = $00000002, VK_SAMPLE_COUNT_4_BIT = $00000004, VK_SAMPLE_COUNT_8_BIT = $00000008, VK_SAMPLE_COUNT_16_BIT = $00000010, VK_SAMPLE_COUNT_32_BIT = $00000020, VK_SAMPLE_COUNT_64_BIT = $00000040, VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkSampleCountFlags = ^VkSampleCountFlags; VkSampleCountFlags = VkFlags; type P_VkImageUsageFlagBits = ^VkImageUsageFlagBits; VkImageUsageFlagBits = ( VK_IMAGE_USAGE_TRANSFER_SRC_BIT = $00000001, VK_IMAGE_USAGE_TRANSFER_DST_BIT = $00000002, VK_IMAGE_USAGE_SAMPLED_BIT = $00000004, VK_IMAGE_USAGE_STORAGE_BIT = $00000008, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = $00000010, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = $00000020, VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = $00000040, VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = $00000080, VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV = $00000100, VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT = $00000200, VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV, VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkImageUsageFlags = ^VkImageUsageFlags; VkImageUsageFlags = VkFlags; type P_VkInstanceCreateFlags = ^VkInstanceCreateFlags; VkInstanceCreateFlags = VkFlags; type P_VkMemoryHeapFlagBits = ^VkMemoryHeapFlagBits; VkMemoryHeapFlagBits = ( VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = $00000001, VK_MEMORY_HEAP_MULTI_INSTANCE_BIT = $00000002, VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHR = VK_MEMORY_HEAP_MULTI_INSTANCE_BIT, VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkMemoryHeapFlags = ^VkMemoryHeapFlags; VkMemoryHeapFlags = VkFlags; type P_VkMemoryPropertyFlagBits = ^VkMemoryPropertyFlagBits; VkMemoryPropertyFlagBits = ( VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = $00000001, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = $00000002, VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = $00000004, VK_MEMORY_PROPERTY_HOST_CACHED_BIT = $00000008, VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = $00000010, VK_MEMORY_PROPERTY_PROTECTED_BIT = $00000020, VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD = $00000040, VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD = $00000080, VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkMemoryPropertyFlags = ^VkMemoryPropertyFlags; VkMemoryPropertyFlags = VkFlags; type P_VkQueueFlagBits = ^VkQueueFlagBits; VkQueueFlagBits = ( VK_QUEUE_GRAPHICS_BIT = $00000001, VK_QUEUE_COMPUTE_BIT = $00000002, VK_QUEUE_TRANSFER_BIT = $00000004, VK_QUEUE_SPARSE_BINDING_BIT = $00000008, VK_QUEUE_PROTECTED_BIT = $00000010, VK_QUEUE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkQueueFlags = ^VkQueueFlags; VkQueueFlags = VkFlags; type P_VkDeviceCreateFlags = ^VkDeviceCreateFlags; VkDeviceCreateFlags = VkFlags; type P_VkDeviceQueueCreateFlagBits = ^VkDeviceQueueCreateFlagBits; VkDeviceQueueCreateFlagBits = ( VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT = $00000001, VK_DEVICE_QUEUE_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkDeviceQueueCreateFlags = ^VkDeviceQueueCreateFlags; VkDeviceQueueCreateFlags = VkFlags; type P_VkPipelineStageFlagBits = ^VkPipelineStageFlagBits; VkPipelineStageFlagBits = ( VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = $00000001, VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = $00000002, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = $00000004, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = $00000008, VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = $00000010, VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = $00000020, VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = $00000040, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = $00000080, VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = $00000100, VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = $00000200, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = $00000400, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = $00000800, VK_PIPELINE_STAGE_TRANSFER_BIT = $00001000, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = $00002000, VK_PIPELINE_STAGE_HOST_BIT = $00004000, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = $00008000, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = $00010000, VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT = $01000000, VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT = $00040000, VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR = $02000000, VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR = $00200000, VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV = $00400000, VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV = $00080000, VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV = $00100000, VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT = $00800000, VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV = $00020000, VK_PIPELINE_STAGE_NONE_KHR = 0, VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_NV = VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR, VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_NV = VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR, VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV, VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type VkPipelineStageFlags = VkFlags; P_VkPipelineStageFlags = ^VkPipelineStageFlags; type P_VkMemoryMapFlags = ^VkMemoryMapFlags; VkMemoryMapFlags = VkFlags; type P_VkSparseMemoryBindFlagBits = ^VkSparseMemoryBindFlagBits; VkSparseMemoryBindFlagBits = ( VK_SPARSE_MEMORY_BIND_METADATA_BIT = $00000001, VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkSparseMemoryBindFlags = ^VkSparseMemoryBindFlags; VkSparseMemoryBindFlags = VkFlags; type P_VkSparseImageFormatFlagBits = ^VkSparseImageFormatFlagBits; VkSparseImageFormatFlagBits = ( VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = $00000001, VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = $00000002, VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = $00000004, VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkSparseImageFormatFlags = ^VkSparseImageFormatFlags; VkSparseImageFormatFlags = VkFlags; type P_VkFenceCreateFlagBits = ^VkFenceCreateFlagBits; VkFenceCreateFlagBits = ( VK_FENCE_CREATE_SIGNALED_BIT = $00000001, VK_FENCE_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkFenceCreateFlags = ^VkFenceCreateFlags; VkFenceCreateFlags = VkFlags; type P_VkSemaphoreCreateFlags = ^VkSemaphoreCreateFlags; VkSemaphoreCreateFlags = VkFlags; type P_VkEventCreateFlagBits = ^VkEventCreateFlagBits; VkEventCreateFlagBits = ( VK_EVENT_CREATE_DEVICE_ONLY_BIT_KHR = $00000001, VK_EVENT_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkEventCreateFlags = ^VkEventCreateFlags; VkEventCreateFlags = VkFlags; type P_VkQueryPipelineStatisticFlagBits = ^VkQueryPipelineStatisticFlagBits; VkQueryPipelineStatisticFlagBits = ( VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = $00000001, VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = $00000002, VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = $00000004, VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = $00000008, VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = $00000010, VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = $00000020, VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = $00000040, VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = $00000080, VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = $00000100, VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = $00000200, VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = $00000400, VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkQueryPipelineStatisticFlags = ^VkQueryPipelineStatisticFlags; VkQueryPipelineStatisticFlags = VkFlags; type P_VkQueryPoolCreateFlags = ^VkQueryPoolCreateFlags; VkQueryPoolCreateFlags = VkFlags; type P_VkQueryResultFlagBits = ^VkQueryResultFlagBits; VkQueryResultFlagBits = ( VK_QUERY_RESULT_64_BIT = $00000001, VK_QUERY_RESULT_WAIT_BIT = $00000002, VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = $00000004, VK_QUERY_RESULT_PARTIAL_BIT = $00000008, VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkQueryResultFlags = ^VkQueryResultFlags; VkQueryResultFlags = VkFlags; type P_VkBufferCreateFlagBits = ^VkBufferCreateFlagBits; VkBufferCreateFlagBits = ( VK_BUFFER_CREATE_SPARSE_BINDING_BIT = $00000001, VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = $00000002, VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = $00000004, VK_BUFFER_CREATE_PROTECTED_BIT = $00000008, VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT = $00000010, VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT = VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkBufferCreateFlags = ^VkBufferCreateFlags; VkBufferCreateFlags = VkFlags; type P_VkBufferUsageFlagBits = ^VkBufferUsageFlagBits; VkBufferUsageFlagBits = ( VK_BUFFER_USAGE_TRANSFER_SRC_BIT = $00000001, VK_BUFFER_USAGE_TRANSFER_DST_BIT = $00000002, VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = $00000004, VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = $00000008, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = $00000010, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = $00000020, VK_BUFFER_USAGE_INDEX_BUFFER_BIT = $00000040, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = $00000080, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = $00000100, VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT = $00020000, VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT = $00000800, VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT = $00001000, VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT = $00000200, VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR = $00080000, VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR = $00100000, VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR = $00000400, VK_BUFFER_USAGE_RAY_TRACING_BIT_NV = VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR, VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT = VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR = VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkBufferUsageFlags = ^VkBufferUsageFlags; VkBufferUsageFlags = VkFlags; type P_VkBufferViewCreateFlags = ^VkBufferViewCreateFlags; VkBufferViewCreateFlags = VkFlags; type P_VkImageViewCreateFlagBits = ^VkImageViewCreateFlagBits; VkImageViewCreateFlagBits = ( VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DYNAMIC_BIT_EXT = $00000001, VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DEFERRED_BIT_EXT = $00000002, VK_IMAGE_VIEW_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkImageViewCreateFlags = ^VkImageViewCreateFlags; VkImageViewCreateFlags = VkFlags; type P_VkShaderModuleCreateFlagBits = ^VkShaderModuleCreateFlagBits; VkShaderModuleCreateFlagBits = ( VK_SHADER_MODULE_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkShaderModuleCreateFlags = ^VkShaderModuleCreateFlags; VkShaderModuleCreateFlags = VkFlags; type P_VkPipelineCacheCreateFlagBits = ^VkPipelineCacheCreateFlagBits; VkPipelineCacheCreateFlagBits = ( VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT_EXT = $00000001, VK_PIPELINE_CACHE_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkPipelineCacheCreateFlags = ^VkPipelineCacheCreateFlags; VkPipelineCacheCreateFlags = VkFlags; type P_VkColorComponentFlagBits = ^VkColorComponentFlagBits; VkColorComponentFlagBits = ( VK_COLOR_COMPONENT_R_BIT = $00000001, VK_COLOR_COMPONENT_G_BIT = $00000002, VK_COLOR_COMPONENT_B_BIT = $00000004, VK_COLOR_COMPONENT_A_BIT = $00000008, VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkColorComponentFlags = ^VkColorComponentFlags; VkColorComponentFlags = VkFlags; type P_VkPipelineCreateFlagBits = ^VkPipelineCreateFlagBits; VkPipelineCreateFlagBits = ( VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = $00000001, VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = $00000002, VK_PIPELINE_CREATE_DERIVATIVE_BIT = $00000004, VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT = $00000008, VK_PIPELINE_CREATE_DISPATCH_BASE_BIT = $00000010, VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR = $00004000, VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR = $00008000, VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR = $00010000, VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR = $00020000, VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR = $00001000, VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR = $00002000, VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR = $00080000, VK_PIPELINE_CREATE_DEFER_COMPILE_BIT_NV = $00000020, VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR = $00000040, VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR = $00000080, VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV = $00040000, VK_PIPELINE_CREATE_LIBRARY_BIT_KHR = $00000800, VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT = $00000100, VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT = $00000200, VK_PIPELINE_CREATE_DISPATCH_BASE = VK_PIPELINE_CREATE_DISPATCH_BASE_BIT, VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR = VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT, VK_PIPELINE_CREATE_DISPATCH_BASE_KHR = VK_PIPELINE_CREATE_DISPATCH_BASE, VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkPipelineCreateFlags = ^VkPipelineCreateFlags; VkPipelineCreateFlags = VkFlags; type P_VkPipelineShaderStageCreateFlagBits = ^VkPipelineShaderStageCreateFlagBits; VkPipelineShaderStageCreateFlagBits = ( VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT = $00000001, VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT = $00000002, VK_PIPELINE_SHADER_STAGE_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkPipelineShaderStageCreateFlags = ^VkPipelineShaderStageCreateFlags; VkPipelineShaderStageCreateFlags = VkFlags; type P_VkShaderStageFlagBits = ^VkShaderStageFlagBits; VkShaderStageFlagBits = ( VK_SHADER_STAGE_VERTEX_BIT = $00000001, VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = $00000002, VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = $00000004, VK_SHADER_STAGE_GEOMETRY_BIT = $00000008, VK_SHADER_STAGE_FRAGMENT_BIT = $00000010, VK_SHADER_STAGE_COMPUTE_BIT = $00000020, VK_SHADER_STAGE_ALL_GRAPHICS = $0000001F, VK_SHADER_STAGE_ALL = $7FFFFFFF, VK_SHADER_STAGE_RAYGEN_BIT_KHR = $00000100, VK_SHADER_STAGE_ANY_HIT_BIT_KHR = $00000200, VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR = $00000400, VK_SHADER_STAGE_MISS_BIT_KHR = $00000800, VK_SHADER_STAGE_INTERSECTION_BIT_KHR = $00001000, VK_SHADER_STAGE_CALLABLE_BIT_KHR = $00002000, VK_SHADER_STAGE_TASK_BIT_NV = $00000040, VK_SHADER_STAGE_MESH_BIT_NV = $00000080, VK_SHADER_STAGE_RAYGEN_BIT_NV = VK_SHADER_STAGE_RAYGEN_BIT_KHR, VK_SHADER_STAGE_ANY_HIT_BIT_NV = VK_SHADER_STAGE_ANY_HIT_BIT_KHR, VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV = VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, VK_SHADER_STAGE_MISS_BIT_NV = VK_SHADER_STAGE_MISS_BIT_KHR, VK_SHADER_STAGE_INTERSECTION_BIT_NV = VK_SHADER_STAGE_INTERSECTION_BIT_KHR, VK_SHADER_STAGE_CALLABLE_BIT_NV = VK_SHADER_STAGE_CALLABLE_BIT_KHR, VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkCullModeFlagBits = ^VkCullModeFlagBits; VkCullModeFlagBits = ( VK_CULL_MODE_NONE = 0, VK_CULL_MODE_FRONT_BIT = $00000001, VK_CULL_MODE_BACK_BIT = $00000002, VK_CULL_MODE_FRONT_AND_BACK = $00000003, VK_CULL_MODE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkCullModeFlags = ^VkCullModeFlags; VkCullModeFlags = VkFlags; type P_VkPipelineVertexInputStateCreateFlags = ^VkPipelineVertexInputStateCreateFlags; VkPipelineVertexInputStateCreateFlags = VkFlags; type P_VkPipelineInputAssemblyStateCreateFlags = ^VkPipelineInputAssemblyStateCreateFlags; VkPipelineInputAssemblyStateCreateFlags = VkFlags; type P_VkPipelineTessellationStateCreateFlags = ^VkPipelineTessellationStateCreateFlags; VkPipelineTessellationStateCreateFlags = VkFlags; type P_VkPipelineViewportStateCreateFlags = ^VkPipelineViewportStateCreateFlags; VkPipelineViewportStateCreateFlags = VkFlags; type P_VkPipelineRasterizationStateCreateFlags = ^VkPipelineRasterizationStateCreateFlags; VkPipelineRasterizationStateCreateFlags = VkFlags; type P_VkPipelineMultisampleStateCreateFlags = ^VkPipelineMultisampleStateCreateFlags; VkPipelineMultisampleStateCreateFlags = VkFlags; type P_VkPipelineDepthStencilStateCreateFlags = ^VkPipelineDepthStencilStateCreateFlags; VkPipelineDepthStencilStateCreateFlags = VkFlags; type P_VkPipelineColorBlendStateCreateFlags = ^VkPipelineColorBlendStateCreateFlags; VkPipelineColorBlendStateCreateFlags = VkFlags; type P_VkPipelineDynamicStateCreateFlags = ^VkPipelineDynamicStateCreateFlags; VkPipelineDynamicStateCreateFlags = VkFlags; type P_VkPipelineLayoutCreateFlags = ^VkPipelineLayoutCreateFlags; VkPipelineLayoutCreateFlags = VkFlags; type P_VkShaderStageFlags = ^VkShaderStageFlags; VkShaderStageFlags = VkFlags; type P_VkSamplerCreateFlagBits = ^VkSamplerCreateFlagBits; VkSamplerCreateFlagBits = ( VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT = $00000001, VK_SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT = $00000002, VK_SAMPLER_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkSamplerCreateFlags = ^VkSamplerCreateFlags; VkSamplerCreateFlags = VkFlags; type P_VkDescriptorPoolCreateFlagBits = ^VkDescriptorPoolCreateFlagBits; VkDescriptorPoolCreateFlagBits = ( VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = $00000001, VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT = $00000002, VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE = $00000004, VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT = VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT, VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkDescriptorPoolCreateFlags = ^VkDescriptorPoolCreateFlags; VkDescriptorPoolCreateFlags = VkFlags; type P_VkDescriptorPoolResetFlags = ^VkDescriptorPoolResetFlags; VkDescriptorPoolResetFlags = VkFlags; type P_VkDescriptorSetLayoutCreateFlagBits = ^VkDescriptorSetLayoutCreateFlagBits; VkDescriptorSetLayoutCreateFlagBits = ( VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT = $00000002, VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR = $00000001, VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_VALVE = $00000004, VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT = VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkDescriptorSetLayoutCreateFlags = ^VkDescriptorSetLayoutCreateFlags; VkDescriptorSetLayoutCreateFlags = VkFlags; type P_VkAttachmentDescriptionFlagBits = ^VkAttachmentDescriptionFlagBits; VkAttachmentDescriptionFlagBits = ( VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = $00000001, VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkAttachmentDescriptionFlags = ^VkAttachmentDescriptionFlags; VkAttachmentDescriptionFlags = VkFlags; type P_VkDependencyFlagBits = ^VkDependencyFlagBits; VkDependencyFlagBits = ( VK_DEPENDENCY_BY_REGION_BIT = $00000001, VK_DEPENDENCY_DEVICE_GROUP_BIT = $00000004, VK_DEPENDENCY_VIEW_LOCAL_BIT = $00000002, VK_DEPENDENCY_VIEW_LOCAL_BIT_KHR = VK_DEPENDENCY_VIEW_LOCAL_BIT, VK_DEPENDENCY_DEVICE_GROUP_BIT_KHR = VK_DEPENDENCY_DEVICE_GROUP_BIT, VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkDependencyFlags = ^VkDependencyFlags; VkDependencyFlags = VkFlags; type P_VkFramebufferCreateFlagBits = ^VkFramebufferCreateFlagBits; VkFramebufferCreateFlagBits = ( VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT = $00000001, VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT_KHR = VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, VK_FRAMEBUFFER_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkFramebufferCreateFlags = ^VkFramebufferCreateFlags; VkFramebufferCreateFlags = VkFlags; type P_VkRenderPassCreateFlagBits = ^VkRenderPassCreateFlagBits; VkRenderPassCreateFlagBits = ( VK_RENDER_PASS_CREATE_TRANSFORM_BIT_QCOM = $00000002, VK_RENDER_PASS_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkRenderPassCreateFlags = ^VkRenderPassCreateFlags; VkRenderPassCreateFlags = VkFlags; type P_VkSubpassDescriptionFlagBits = ^VkSubpassDescriptionFlagBits; VkSubpassDescriptionFlagBits = ( VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX = $00000001, VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX = $00000002, VK_SUBPASS_DESCRIPTION_FRAGMENT_REGION_BIT_QCOM = $00000004, VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM = $00000008, VK_SUBPASS_DESCRIPTION_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkSubpassDescriptionFlags = ^VkSubpassDescriptionFlags; VkSubpassDescriptionFlags = VkFlags; type P_VkCommandPoolCreateFlagBits = ^VkCommandPoolCreateFlagBits; VkCommandPoolCreateFlagBits = ( VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = $00000001, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = $00000002, VK_COMMAND_POOL_CREATE_PROTECTED_BIT = $00000004, VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkCommandPoolCreateFlags = ^VkCommandPoolCreateFlags; VkCommandPoolCreateFlags = VkFlags; type P_VkCommandPoolResetFlagBits = ^VkCommandPoolResetFlagBits; VkCommandPoolResetFlagBits = ( VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = $00000001, VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkCommandPoolResetFlags = ^VkCommandPoolResetFlags; VkCommandPoolResetFlags = VkFlags; type P_VkCommandBufferUsageFlagBits = ^VkCommandBufferUsageFlagBits; VkCommandBufferUsageFlagBits = ( VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = $00000001, VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = $00000002, VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = $00000004, VK_COMMAND_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkCommandBufferUsageFlags = ^VkCommandBufferUsageFlags; VkCommandBufferUsageFlags = VkFlags; type P_VkQueryControlFlagBits = ^VkQueryControlFlagBits; VkQueryControlFlagBits = ( VK_QUERY_CONTROL_PRECISE_BIT = $00000001, VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkQueryControlFlags = ^VkQueryControlFlags; VkQueryControlFlags = VkFlags; type P_VkCommandBufferResetFlagBits = ^VkCommandBufferResetFlagBits; VkCommandBufferResetFlagBits = ( VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = $00000001, VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkCommandBufferResetFlags = ^VkCommandBufferResetFlags; VkCommandBufferResetFlags = VkFlags; type P_VkStencilFaceFlagBits = ^VkStencilFaceFlagBits; VkStencilFaceFlagBits = ( VK_STENCIL_FACE_FRONT_BIT = $00000001, VK_STENCIL_FACE_BACK_BIT = $00000002, VK_STENCIL_FACE_FRONT_AND_BACK = $00000003, VK_STENCIL_FRONT_AND_BACK = VK_STENCIL_FACE_FRONT_AND_BACK, VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkStencilFaceFlags = ^VkStencilFaceFlags; VkStencilFaceFlags = VkFlags; type P_VkExtent2D = ^VkExtent2D; VkExtent2D = record width :T_uint32_t; height :T_uint32_t; end; type P_VkExtent3D = ^VkExtent3D; VkExtent3D = record width :T_uint32_t; height :T_uint32_t; depth :T_uint32_t; end; type P_VkOffset2D = ^VkOffset2D; VkOffset2D = record x :T_int32_t; y :T_int32_t; end; type P_VkOffset3D = ^VkOffset3D; VkOffset3D = record x :T_int32_t; y :T_int32_t; z :T_int32_t; end; type P_VkRect2D = ^VkRect2D; VkRect2D = record offset :VkOffset2D; extent :VkExtent2D; end; type P_VkBaseInStructure = ^VkBaseInStructure; VkBaseInStructure = record sType :VkStructureType; pNext :P_VkBaseInStructure; end; type P_VkBaseOutStructure = ^VkBaseOutStructure; VkBaseOutStructure = record sType :VkStructureType; pNext :P_VkBaseOutStructure; end; type P_VkBufferMemoryBarrier = ^VkBufferMemoryBarrier; VkBufferMemoryBarrier = record sType :VkStructureType; pNext :P_void; srcAccessMask :VkAccessFlags; dstAccessMask :VkAccessFlags; srcQueueFamilyIndex :T_uint32_t; dstQueueFamilyIndex :T_uint32_t; buffer :VkBuffer; offset :VkDeviceSize; size :VkDeviceSize; end; type P_VkDispatchIndirectCommand = ^VkDispatchIndirectCommand; VkDispatchIndirectCommand = record x :T_uint32_t; y :T_uint32_t; z :T_uint32_t; end; type P_VkDrawIndexedIndirectCommand = ^VkDrawIndexedIndirectCommand; VkDrawIndexedIndirectCommand = record indexCount :T_uint32_t; instanceCount :T_uint32_t; firstIndex :T_uint32_t; vertexOffset :T_int32_t; firstInstance :T_uint32_t; end; type P_VkDrawIndirectCommand = ^VkDrawIndirectCommand; VkDrawIndirectCommand = record vertexCount :T_uint32_t; instanceCount :T_uint32_t; firstVertex :T_uint32_t; firstInstance :T_uint32_t; end; type P_VkImageSubresourceRange = ^VkImageSubresourceRange; VkImageSubresourceRange = record aspectMask :VkImageAspectFlags; baseMipLevel :T_uint32_t; levelCount :T_uint32_t; baseArrayLayer :T_uint32_t; layerCount :T_uint32_t; end; type P_VkImageMemoryBarrier = ^VkImageMemoryBarrier; VkImageMemoryBarrier = record sType :VkStructureType; pNext :P_void; srcAccessMask :VkAccessFlags; dstAccessMask :VkAccessFlags; oldLayout :VkImageLayout; newLayout :VkImageLayout; srcQueueFamilyIndex :T_uint32_t; dstQueueFamilyIndex :T_uint32_t; image :VkImage; subresourceRange :VkImageSubresourceRange; end; type P_VkMemoryBarrier = ^VkMemoryBarrier; VkMemoryBarrier = record sType :VkStructureType; pNext :P_void; srcAccessMask :VkAccessFlags; dstAccessMask :VkAccessFlags; end; type PFN_vkAllocationFunction = function( pUserData_ :P_void; size_ :T_size_t; alignment_ :T_size_t; allocationScope_ :VkSystemAllocationScope ) :P_void; type PFN_vkFreeFunction = procedure( pUserData_ :P_void; pMemory_ :P_void ); type PFN_vkInternalAllocationNotification = procedure( pUserData_ :P_void; size_ :T_size_t; allocationType_ :VkInternalAllocationType; allocationScope_ :VkSystemAllocationScope ); type PFN_vkInternalFreeNotification = procedure( pUserData_ :P_void; size_ :T_size_t; allocationType_ :VkInternalAllocationType; allocationScope_ :VkSystemAllocationScope ); type PFN_vkReallocationFunction = function( pUserData_ :P_void; pOriginal_ :P_void; size_ :T_size_t; alignment_ :T_size_t; allocationScope_ :VkSystemAllocationScope ) :P_void; type P_PFN_vkVoidFunction = ^PFN_vkVoidFunction; PFN_vkVoidFunction = procedure; type P_VkAllocationCallbacks = ^VkAllocationCallbacks; VkAllocationCallbacks = record pUserData :P_void; pfnAllocation :PFN_vkAllocationFunction; pfnReallocation :PFN_vkReallocationFunction; pfnFree :PFN_vkFreeFunction; pfnInternalAllocation :PFN_vkInternalAllocationNotification; pfnInternalFree :PFN_vkInternalFreeNotification; end; type P_VkApplicationInfo = ^VkApplicationInfo; VkApplicationInfo = record sType :VkStructureType; pNext :P_void; pApplicationName :P_char; applicationVersion :T_uint32_t; pEngineName :P_char; engineVersion :T_uint32_t; apiVersion :T_uint32_t; end; type P_VkFormatProperties = ^VkFormatProperties; VkFormatProperties = record linearTilingFeatures :VkFormatFeatureFlags; optimalTilingFeatures :VkFormatFeatureFlags; bufferFeatures :VkFormatFeatureFlags; end; type P_VkImageFormatProperties = ^VkImageFormatProperties; VkImageFormatProperties = record maxExtent :VkExtent3D; maxMipLevels :T_uint32_t; maxArrayLayers :T_uint32_t; sampleCounts :VkSampleCountFlags; maxResourceSize :VkDeviceSize; end; type P_VkInstanceCreateInfo = ^VkInstanceCreateInfo; VkInstanceCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkInstanceCreateFlags; pApplicationInfo :P_VkApplicationInfo; enabledLayerCount :T_uint32_t; ppEnabledLayerNames :PP_char; enabledExtensionCount :T_uint32_t; ppEnabledExtensionNames :PP_char; end; type P_VkMemoryHeap = ^VkMemoryHeap; VkMemoryHeap = record size :VkDeviceSize; flags :VkMemoryHeapFlags; end; type P_VkMemoryType = ^VkMemoryType; VkMemoryType = record propertyFlags :VkMemoryPropertyFlags; heapIndex :T_uint32_t; end; type P_VkPhysicalDeviceFeatures = ^VkPhysicalDeviceFeatures; VkPhysicalDeviceFeatures = record robustBufferAccess :VkBool32; fullDrawIndexUint32 :VkBool32; imageCubeArray :VkBool32; independentBlend :VkBool32; geometryShader :VkBool32; tessellationShader :VkBool32; sampleRateShading :VkBool32; dualSrcBlend :VkBool32; logicOp :VkBool32; multiDrawIndirect :VkBool32; drawIndirectFirstInstance :VkBool32; depthClamp :VkBool32; depthBiasClamp :VkBool32; fillModeNonSolid :VkBool32; depthBounds :VkBool32; wideLines :VkBool32; largePoints :VkBool32; alphaToOne :VkBool32; multiViewport :VkBool32; samplerAnisotropy :VkBool32; textureCompressionETC2 :VkBool32; textureCompressionASTC_LDR :VkBool32; textureCompressionBC :VkBool32; occlusionQueryPrecise :VkBool32; pipelineStatisticsQuery :VkBool32; vertexPipelineStoresAndAtomics :VkBool32; fragmentStoresAndAtomics :VkBool32; shaderTessellationAndGeometryPointSize :VkBool32; shaderImageGatherExtended :VkBool32; shaderStorageImageExtendedFormats :VkBool32; shaderStorageImageMultisample :VkBool32; shaderStorageImageReadWithoutFormat :VkBool32; shaderStorageImageWriteWithoutFormat :VkBool32; shaderUniformBufferArrayDynamicIndexing :VkBool32; shaderSampledImageArrayDynamicIndexing :VkBool32; shaderStorageBufferArrayDynamicIndexing :VkBool32; shaderStorageImageArrayDynamicIndexing :VkBool32; shaderClipDistance :VkBool32; shaderCullDistance :VkBool32; shaderFloat64 :VkBool32; shaderInt64 :VkBool32; shaderInt16 :VkBool32; shaderResourceResidency :VkBool32; shaderResourceMinLod :VkBool32; sparseBinding :VkBool32; sparseResidencyBuffer :VkBool32; sparseResidencyImage2D :VkBool32; sparseResidencyImage3D :VkBool32; sparseResidency2Samples :VkBool32; sparseResidency4Samples :VkBool32; sparseResidency8Samples :VkBool32; sparseResidency16Samples :VkBool32; sparseResidencyAliased :VkBool32; variableMultisampleRate :VkBool32; inheritedQueries :VkBool32; end; type P_VkPhysicalDeviceLimits = ^VkPhysicalDeviceLimits; VkPhysicalDeviceLimits = record maxImageDimension1D :T_uint32_t; maxImageDimension2D :T_uint32_t; maxImageDimension3D :T_uint32_t; maxImageDimensionCube :T_uint32_t; maxImageArrayLayers :T_uint32_t; maxTexelBufferElements :T_uint32_t; maxUniformBufferRange :T_uint32_t; maxStorageBufferRange :T_uint32_t; maxPushConstantsSize :T_uint32_t; maxMemoryAllocationCount :T_uint32_t; maxSamplerAllocationCount :T_uint32_t; bufferImageGranularity :VkDeviceSize; sparseAddressSpaceSize :VkDeviceSize; maxBoundDescriptorSets :T_uint32_t; maxPerStageDescriptorSamplers :T_uint32_t; maxPerStageDescriptorUniformBuffers :T_uint32_t; maxPerStageDescriptorStorageBuffers :T_uint32_t; maxPerStageDescriptorSampledImages :T_uint32_t; maxPerStageDescriptorStorageImages :T_uint32_t; maxPerStageDescriptorInputAttachments :T_uint32_t; maxPerStageResources :T_uint32_t; maxDescriptorSetSamplers :T_uint32_t; maxDescriptorSetUniformBuffers :T_uint32_t; maxDescriptorSetUniformBuffersDynamic :T_uint32_t; maxDescriptorSetStorageBuffers :T_uint32_t; maxDescriptorSetStorageBuffersDynamic :T_uint32_t; maxDescriptorSetSampledImages :T_uint32_t; maxDescriptorSetStorageImages :T_uint32_t; maxDescriptorSetInputAttachments :T_uint32_t; maxVertexInputAttributes :T_uint32_t; maxVertexInputBindings :T_uint32_t; maxVertexInputAttributeOffset :T_uint32_t; maxVertexInputBindingStride :T_uint32_t; maxVertexOutputComponents :T_uint32_t; maxTessellationGenerationLevel :T_uint32_t; maxTessellationPatchSize :T_uint32_t; maxTessellationControlPerVertexInputComponents :T_uint32_t; maxTessellationControlPerVertexOutputComponents :T_uint32_t; maxTessellationControlPerPatchOutputComponents :T_uint32_t; maxTessellationControlTotalOutputComponents :T_uint32_t; maxTessellationEvaluationInputComponents :T_uint32_t; maxTessellationEvaluationOutputComponents :T_uint32_t; maxGeometryShaderInvocations :T_uint32_t; maxGeometryInputComponents :T_uint32_t; maxGeometryOutputComponents :T_uint32_t; maxGeometryOutputVertices :T_uint32_t; maxGeometryTotalOutputComponents :T_uint32_t; maxFragmentInputComponents :T_uint32_t; maxFragmentOutputAttachments :T_uint32_t; maxFragmentDualSrcAttachments :T_uint32_t; maxFragmentCombinedOutputResources :T_uint32_t; maxComputeSharedMemorySize :T_uint32_t; maxComputeWorkGroupCount :array [ 0..3-1 ] of T_uint32_t; maxComputeWorkGroupInvocations :T_uint32_t; maxComputeWorkGroupSize :array [ 0..3-1 ] of T_uint32_t; subPixelPrecisionBits :T_uint32_t; subTexelPrecisionBits :T_uint32_t; mipmapPrecisionBits :T_uint32_t; maxDrawIndexedIndexValue :T_uint32_t; maxDrawIndirectCount :T_uint32_t; maxSamplerLodBias :T_float; maxSamplerAnisotropy :T_float; maxViewports :T_uint32_t; maxViewportDimensions :array [ 0..2-1 ] of T_uint32_t; viewportBoundsRange :array [ 0..2-1 ] of T_float; viewportSubPixelBits :T_uint32_t; minMemoryMapAlignment :T_size_t; minTexelBufferOffsetAlignment :VkDeviceSize; minUniformBufferOffsetAlignment :VkDeviceSize; minStorageBufferOffsetAlignment :VkDeviceSize; minTexelOffset :T_int32_t; maxTexelOffset :T_uint32_t; minTexelGatherOffset :T_int32_t; maxTexelGatherOffset :T_uint32_t; minInterpolationOffset :T_float; maxInterpolationOffset :T_float; subPixelInterpolationOffsetBits :T_uint32_t; maxFramebufferWidth :T_uint32_t; maxFramebufferHeight :T_uint32_t; maxFramebufferLayers :T_uint32_t; framebufferColorSampleCounts :VkSampleCountFlags; framebufferDepthSampleCounts :VkSampleCountFlags; framebufferStencilSampleCounts :VkSampleCountFlags; framebufferNoAttachmentsSampleCounts :VkSampleCountFlags; maxColorAttachments :T_uint32_t; sampledImageColorSampleCounts :VkSampleCountFlags; sampledImageIntegerSampleCounts :VkSampleCountFlags; sampledImageDepthSampleCounts :VkSampleCountFlags; sampledImageStencilSampleCounts :VkSampleCountFlags; storageImageSampleCounts :VkSampleCountFlags; maxSampleMaskWords :T_uint32_t; timestampComputeAndGraphics :VkBool32; timestampPeriod :T_float; maxClipDistances :T_uint32_t; maxCullDistances :T_uint32_t; maxCombinedClipAndCullDistances :T_uint32_t; discreteQueuePriorities :T_uint32_t; pointSizeRange :array [ 0..2-1 ] of T_float; lineWidthRange :array [ 0..2-1 ] of T_float; pointSizeGranularity :T_float; lineWidthGranularity :T_float; strictLines :VkBool32; standardSampleLocations :VkBool32; optimalBufferCopyOffsetAlignment :VkDeviceSize; optimalBufferCopyRowPitchAlignment :VkDeviceSize; nonCoherentAtomSize :VkDeviceSize; end; type P_VkPhysicalDeviceMemoryProperties = ^VkPhysicalDeviceMemoryProperties; VkPhysicalDeviceMemoryProperties = record memoryTypeCount :T_uint32_t; memoryTypes :array [ 0..VK_MAX_MEMORY_TYPES-1 ] of VkMemoryType; memoryHeapCount :T_uint32_t; memoryHeaps :array [ 0..VK_MAX_MEMORY_HEAPS-1 ] of VkMemoryHeap; end; type P_VkPhysicalDeviceSparseProperties = ^VkPhysicalDeviceSparseProperties; VkPhysicalDeviceSparseProperties = record residencyStandard2DBlockShape :VkBool32; residencyStandard2DMultisampleBlockShape :VkBool32; residencyStandard3DBlockShape :VkBool32; residencyAlignedMipSize :VkBool32; residencyNonResidentStrict :VkBool32; end; type P_VkPhysicalDeviceProperties = ^VkPhysicalDeviceProperties; VkPhysicalDeviceProperties = record apiVersion :T_uint32_t; driverVersion :T_uint32_t; vendorID :T_uint32_t; deviceID :T_uint32_t; deviceType :VkPhysicalDeviceType; deviceName :array [ 0..VK_MAX_PHYSICAL_DEVICE_NAME_SIZE-1 ] of T_char; pipelineCacheUUID :array [ 0..VK_UUID_SIZE-1 ] of T_uint8_t; limits :VkPhysicalDeviceLimits; sparseProperties :VkPhysicalDeviceSparseProperties; end; type P_VkQueueFamilyProperties = ^VkQueueFamilyProperties; VkQueueFamilyProperties = record queueFlags :VkQueueFlags; queueCount :T_uint32_t; timestampValidBits :T_uint32_t; minImageTransferGranularity :VkExtent3D; end; type P_VkDeviceQueueCreateInfo = ^VkDeviceQueueCreateInfo; VkDeviceQueueCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkDeviceQueueCreateFlags; queueFamilyIndex :T_uint32_t; queueCount :T_uint32_t; pQueuePriorities :P_float; end; type P_VkDeviceCreateInfo = ^VkDeviceCreateInfo; VkDeviceCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkDeviceCreateFlags; queueCreateInfoCount :T_uint32_t; pQueueCreateInfos :P_VkDeviceQueueCreateInfo; enabledLayerCount :T_uint32_t; ppEnabledLayerNames :PP_char; enabledExtensionCount :T_uint32_t; ppEnabledExtensionNames :PP_char; pEnabledFeatures :P_VkPhysicalDeviceFeatures; end; type P_VkExtensionProperties = ^VkExtensionProperties; VkExtensionProperties = record extensionName :array [ 0..VK_MAX_EXTENSION_NAME_SIZE-1 ] of T_char; specVersion :T_uint32_t; end; type P_VkLayerProperties = ^VkLayerProperties; VkLayerProperties = record layerName :array [ 0..VK_MAX_EXTENSION_NAME_SIZE-1 ] of T_char; specVersion :T_uint32_t; implementationVersion :T_uint32_t; description :array [ 0..VK_MAX_DESCRIPTION_SIZE-1 ] of T_char; end; type P_VkSubmitInfo = ^VkSubmitInfo; VkSubmitInfo = record sType :VkStructureType; pNext :P_void; waitSemaphoreCount :T_uint32_t; pWaitSemaphores :P_VkSemaphore; pWaitDstStageMask :P_VkPipelineStageFlags; commandBufferCount :T_uint32_t; pCommandBuffers :P_VkCommandBuffer; signalSemaphoreCount :T_uint32_t; pSignalSemaphores :P_VkSemaphore; end; type P_VkMappedMemoryRange = ^VkMappedMemoryRange; VkMappedMemoryRange = record sType :VkStructureType; pNext :P_void; memory :VkDeviceMemory; offset :VkDeviceSize; size :VkDeviceSize; end; type P_VkMemoryAllocateInfo = ^VkMemoryAllocateInfo; VkMemoryAllocateInfo = record sType :VkStructureType; pNext :P_void; allocationSize :VkDeviceSize; memoryTypeIndex :T_uint32_t; end; type P_VkMemoryRequirements = ^VkMemoryRequirements; VkMemoryRequirements = record size :VkDeviceSize; alignment :VkDeviceSize; memoryTypeBits :T_uint32_t; end; type P_VkSparseMemoryBind = ^VkSparseMemoryBind; VkSparseMemoryBind = record resourceOffset :VkDeviceSize; size :VkDeviceSize; memory :VkDeviceMemory; memoryOffset :VkDeviceSize; flags :VkSparseMemoryBindFlags; end; type P_VkSparseBufferMemoryBindInfo = ^VkSparseBufferMemoryBindInfo; VkSparseBufferMemoryBindInfo = record buffer :VkBuffer; bindCount :T_uint32_t; pBinds :P_VkSparseMemoryBind; end; type P_VkSparseImageOpaqueMemoryBindInfo = ^VkSparseImageOpaqueMemoryBindInfo; VkSparseImageOpaqueMemoryBindInfo = record image :VkImage; bindCount :T_uint32_t; pBinds :P_VkSparseMemoryBind; end; type P_VkImageSubresource = ^VkImageSubresource; VkImageSubresource = record aspectMask :VkImageAspectFlags; mipLevel :T_uint32_t; arrayLayer :T_uint32_t; end; type P_VkSparseImageMemoryBind = ^VkSparseImageMemoryBind; VkSparseImageMemoryBind = record subresource :VkImageSubresource; offset :VkOffset3D; extent :VkExtent3D; memory :VkDeviceMemory; memoryOffset :VkDeviceSize; flags :VkSparseMemoryBindFlags; end; type P_VkSparseImageMemoryBindInfo = ^VkSparseImageMemoryBindInfo; VkSparseImageMemoryBindInfo = record image :VkImage; bindCount :T_uint32_t; pBinds :P_VkSparseImageMemoryBind; end; type P_VkBindSparseInfo = ^VkBindSparseInfo; VkBindSparseInfo = record sType :VkStructureType; pNext :P_void; waitSemaphoreCount :T_uint32_t; pWaitSemaphores :P_VkSemaphore; bufferBindCount :T_uint32_t; pBufferBinds :P_VkSparseBufferMemoryBindInfo; imageOpaqueBindCount :T_uint32_t; pImageOpaqueBinds :P_VkSparseImageOpaqueMemoryBindInfo; imageBindCount :T_uint32_t; pImageBinds :P_VkSparseImageMemoryBindInfo; signalSemaphoreCount :T_uint32_t; pSignalSemaphores :P_VkSemaphore; end; type P_VkSparseImageFormatProperties = ^VkSparseImageFormatProperties; VkSparseImageFormatProperties = record aspectMask :VkImageAspectFlags; imageGranularity :VkExtent3D; flags :VkSparseImageFormatFlags; end; type P_VkSparseImageMemoryRequirements = ^VkSparseImageMemoryRequirements; VkSparseImageMemoryRequirements = record formatProperties :VkSparseImageFormatProperties; imageMipTailFirstLod :T_uint32_t; imageMipTailSize :VkDeviceSize; imageMipTailOffset :VkDeviceSize; imageMipTailStride :VkDeviceSize; end; type P_VkFenceCreateInfo = ^VkFenceCreateInfo; VkFenceCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkFenceCreateFlags; end; type P_VkSemaphoreCreateInfo = ^VkSemaphoreCreateInfo; VkSemaphoreCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkSemaphoreCreateFlags; end; type P_VkEventCreateInfo = ^VkEventCreateInfo; VkEventCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkEventCreateFlags; end; type P_VkQueryPoolCreateInfo = ^VkQueryPoolCreateInfo; VkQueryPoolCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkQueryPoolCreateFlags; queryType :VkQueryType; queryCount :T_uint32_t; pipelineStatistics :VkQueryPipelineStatisticFlags; end; type P_VkBufferCreateInfo = ^VkBufferCreateInfo; VkBufferCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkBufferCreateFlags; size :VkDeviceSize; usage :VkBufferUsageFlags; sharingMode :VkSharingMode; queueFamilyIndexCount :T_uint32_t; pQueueFamilyIndices :P_uint32_t; end; type P_VkBufferViewCreateInfo = ^VkBufferViewCreateInfo; VkBufferViewCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkBufferViewCreateFlags; buffer :VkBuffer; format :VkFormat; offset :VkDeviceSize; range :VkDeviceSize; end; type P_VkImageCreateInfo = ^VkImageCreateInfo; VkImageCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkImageCreateFlags; imageType :VkImageType; format :VkFormat; extent :VkExtent3D; mipLevels :T_uint32_t; arrayLayers :T_uint32_t; samples :VkSampleCountFlagBits; tiling :VkImageTiling; usage :VkImageUsageFlags; sharingMode :VkSharingMode; queueFamilyIndexCount :T_uint32_t; pQueueFamilyIndices :P_uint32_t; initialLayout :VkImageLayout; end; type P_VkSubresourceLayout = ^VkSubresourceLayout; VkSubresourceLayout = record offset :VkDeviceSize; size :VkDeviceSize; rowPitch :VkDeviceSize; arrayPitch :VkDeviceSize; depthPitch :VkDeviceSize; end; type P_VkComponentMapping = ^VkComponentMapping; VkComponentMapping = record r :VkComponentSwizzle; g :VkComponentSwizzle; b :VkComponentSwizzle; a :VkComponentSwizzle; end; type P_VkImageViewCreateInfo = ^VkImageViewCreateInfo; VkImageViewCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkImageViewCreateFlags; image :VkImage; viewType :VkImageViewType; format :VkFormat; components :VkComponentMapping; subresourceRange :VkImageSubresourceRange; end; type P_VkShaderModuleCreateInfo = ^VkShaderModuleCreateInfo; VkShaderModuleCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkShaderModuleCreateFlags; codeSize :T_size_t; pCode :P_uint32_t; end; type P_VkPipelineCacheCreateInfo = ^VkPipelineCacheCreateInfo; VkPipelineCacheCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineCacheCreateFlags; initialDataSize :T_size_t; pInitialData :P_void; end; type P_VkSpecializationMapEntry = ^VkSpecializationMapEntry; VkSpecializationMapEntry = record constantID :T_uint32_t; offset :T_uint32_t; size :T_size_t; end; type P_VkSpecializationInfo = ^VkSpecializationInfo; VkSpecializationInfo = record mapEntryCount :T_uint32_t; pMapEntries :P_VkSpecializationMapEntry; dataSize :T_size_t; pData :P_void; end; type P_VkPipelineShaderStageCreateInfo = ^VkPipelineShaderStageCreateInfo; VkPipelineShaderStageCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineShaderStageCreateFlags; stage :VkShaderStageFlagBits; module :VkShaderModule; pName :P_char; pSpecializationInfo :P_VkSpecializationInfo; end; type P_VkComputePipelineCreateInfo = ^VkComputePipelineCreateInfo; VkComputePipelineCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineCreateFlags; stage :VkPipelineShaderStageCreateInfo; layout :VkPipelineLayout; basePipelineHandle :VkPipeline; basePipelineIndex :T_int32_t; end; type P_VkVertexInputBindingDescription = ^VkVertexInputBindingDescription; VkVertexInputBindingDescription = record binding :T_uint32_t; stride :T_uint32_t; inputRate :VkVertexInputRate; end; type P_VkVertexInputAttributeDescription = ^VkVertexInputAttributeDescription; VkVertexInputAttributeDescription = record location :T_uint32_t; binding :T_uint32_t; format :VkFormat; offset :T_uint32_t; end; type P_VkPipelineVertexInputStateCreateInfo = ^VkPipelineVertexInputStateCreateInfo; VkPipelineVertexInputStateCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineVertexInputStateCreateFlags; vertexBindingDescriptionCount :T_uint32_t; pVertexBindingDescriptions :P_VkVertexInputBindingDescription; vertexAttributeDescriptionCount :T_uint32_t; pVertexAttributeDescriptions :P_VkVertexInputAttributeDescription; end; type P_VkPipelineInputAssemblyStateCreateInfo = ^VkPipelineInputAssemblyStateCreateInfo; VkPipelineInputAssemblyStateCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineInputAssemblyStateCreateFlags; topology :VkPrimitiveTopology; primitiveRestartEnable :VkBool32; end; type P_VkPipelineTessellationStateCreateInfo = ^VkPipelineTessellationStateCreateInfo; VkPipelineTessellationStateCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineTessellationStateCreateFlags; patchControlPoints :T_uint32_t; end; type P_VkViewport = ^VkViewport; VkViewport = record x :T_float; y :T_float; width :T_float; height :T_float; minDepth :T_float; maxDepth :T_float; end; type P_VkPipelineViewportStateCreateInfo = ^VkPipelineViewportStateCreateInfo; VkPipelineViewportStateCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineViewportStateCreateFlags; viewportCount :T_uint32_t; pViewports :P_VkViewport; scissorCount :T_uint32_t; pScissors :P_VkRect2D; end; type P_VkPipelineRasterizationStateCreateInfo = ^VkPipelineRasterizationStateCreateInfo; VkPipelineRasterizationStateCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineRasterizationStateCreateFlags; depthClampEnable :VkBool32; rasterizerDiscardEnable :VkBool32; polygonMode :VkPolygonMode; cullMode :VkCullModeFlags; frontFace :VkFrontFace; depthBiasEnable :VkBool32; depthBiasConstantFactor :T_float; depthBiasClamp :T_float; depthBiasSlopeFactor :T_float; lineWidth :T_float; end; type P_VkPipelineMultisampleStateCreateInfo = ^VkPipelineMultisampleStateCreateInfo; VkPipelineMultisampleStateCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineMultisampleStateCreateFlags; rasterizationSamples :VkSampleCountFlagBits; sampleShadingEnable :VkBool32; minSampleShading :T_float; pSampleMask :P_VkSampleMask; alphaToCoverageEnable :VkBool32; alphaToOneEnable :VkBool32; end; type P_VkStencilOpState = ^VkStencilOpState; VkStencilOpState = record failOp :VkStencilOp; passOp :VkStencilOp; depthFailOp :VkStencilOp; compareOp :VkCompareOp; compareMask :T_uint32_t; writeMask :T_uint32_t; reference :T_uint32_t; end; type P_VkPipelineDepthStencilStateCreateInfo = ^VkPipelineDepthStencilStateCreateInfo; VkPipelineDepthStencilStateCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineDepthStencilStateCreateFlags; depthTestEnable :VkBool32; depthWriteEnable :VkBool32; depthCompareOp :VkCompareOp; depthBoundsTestEnable :VkBool32; stencilTestEnable :VkBool32; front :VkStencilOpState; back :VkStencilOpState; minDepthBounds :T_float; maxDepthBounds :T_float; end; type P_VkPipelineColorBlendAttachmentState = ^VkPipelineColorBlendAttachmentState; VkPipelineColorBlendAttachmentState = record blendEnable :VkBool32; srcColorBlendFactor :VkBlendFactor; dstColorBlendFactor :VkBlendFactor; colorBlendOp :VkBlendOp; srcAlphaBlendFactor :VkBlendFactor; dstAlphaBlendFactor :VkBlendFactor; alphaBlendOp :VkBlendOp; colorWriteMask :VkColorComponentFlags; end; type P_VkPipelineColorBlendStateCreateInfo = ^VkPipelineColorBlendStateCreateInfo; VkPipelineColorBlendStateCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineColorBlendStateCreateFlags; logicOpEnable :VkBool32; logicOp :VkLogicOp; attachmentCount :T_uint32_t; pAttachments :P_VkPipelineColorBlendAttachmentState; blendConstants :array [ 0..4-1 ] of T_float; end; type P_VkPipelineDynamicStateCreateInfo = ^VkPipelineDynamicStateCreateInfo; VkPipelineDynamicStateCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineDynamicStateCreateFlags; dynamicStateCount :T_uint32_t; pDynamicStates :P_VkDynamicState; end; type P_VkGraphicsPipelineCreateInfo = ^VkGraphicsPipelineCreateInfo; VkGraphicsPipelineCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineCreateFlags; stageCount :T_uint32_t; pStages :P_VkPipelineShaderStageCreateInfo; pVertexInputState :P_VkPipelineVertexInputStateCreateInfo; pInputAssemblyState :P_VkPipelineInputAssemblyStateCreateInfo; pTessellationState :P_VkPipelineTessellationStateCreateInfo; pViewportState :P_VkPipelineViewportStateCreateInfo; pRasterizationState :P_VkPipelineRasterizationStateCreateInfo; pMultisampleState :P_VkPipelineMultisampleStateCreateInfo; pDepthStencilState :P_VkPipelineDepthStencilStateCreateInfo; pColorBlendState :P_VkPipelineColorBlendStateCreateInfo; pDynamicState :P_VkPipelineDynamicStateCreateInfo; layout :VkPipelineLayout; renderPass :VkRenderPass; subpass :T_uint32_t; basePipelineHandle :VkPipeline; basePipelineIndex :T_int32_t; end; type P_VkPushConstantRange = ^VkPushConstantRange; VkPushConstantRange = record stageFlags :VkShaderStageFlags; offset :T_uint32_t; size :T_uint32_t; end; type P_VkPipelineLayoutCreateInfo = ^VkPipelineLayoutCreateInfo; VkPipelineLayoutCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkPipelineLayoutCreateFlags; setLayoutCount :T_uint32_t; pSetLayouts :P_VkDescriptorSetLayout; pushConstantRangeCount :T_uint32_t; pPushConstantRanges :P_VkPushConstantRange; end; type P_VkSamplerCreateInfo = ^VkSamplerCreateInfo; VkSamplerCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkSamplerCreateFlags; magFilter :VkFilter; minFilter :VkFilter; mipmapMode :VkSamplerMipmapMode; addressModeU :VkSamplerAddressMode; addressModeV :VkSamplerAddressMode; addressModeW :VkSamplerAddressMode; mipLodBias :T_float; anisotropyEnable :VkBool32; maxAnisotropy :T_float; compareEnable :VkBool32; compareOp :VkCompareOp; minLod :T_float; maxLod :T_float; borderColor :VkBorderColor; unnormalizedCoordinates :VkBool32; end; type P_VkCopyDescriptorSet = ^VkCopyDescriptorSet; VkCopyDescriptorSet = record sType :VkStructureType; pNext :P_void; srcSet :VkDescriptorSet; srcBinding :T_uint32_t; srcArrayElement :T_uint32_t; dstSet :VkDescriptorSet; dstBinding :T_uint32_t; dstArrayElement :T_uint32_t; descriptorCount :T_uint32_t; end; type P_VkDescriptorBufferInfo = ^VkDescriptorBufferInfo; VkDescriptorBufferInfo = record buffer :VkBuffer; offset :VkDeviceSize; range :VkDeviceSize; end; type P_VkDescriptorImageInfo = ^VkDescriptorImageInfo; VkDescriptorImageInfo = record sampler :VkSampler; imageView :VkImageView; imageLayout :VkImageLayout; end; type P_VkDescriptorPoolSize = ^VkDescriptorPoolSize; VkDescriptorPoolSize = record type_ :VkDescriptorType; descriptorCount :T_uint32_t; end; type P_VkDescriptorPoolCreateInfo = ^VkDescriptorPoolCreateInfo; VkDescriptorPoolCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkDescriptorPoolCreateFlags; maxSets :T_uint32_t; poolSizeCount :T_uint32_t; pPoolSizes :P_VkDescriptorPoolSize; end; type P_VkDescriptorSetAllocateInfo = ^VkDescriptorSetAllocateInfo; VkDescriptorSetAllocateInfo = record sType :VkStructureType; pNext :P_void; descriptorPool :VkDescriptorPool; descriptorSetCount :T_uint32_t; pSetLayouts :P_VkDescriptorSetLayout; end; type P_VkDescriptorSetLayoutBinding = ^VkDescriptorSetLayoutBinding; VkDescriptorSetLayoutBinding = record binding :T_uint32_t; descriptorType :VkDescriptorType; descriptorCount :T_uint32_t; stageFlags :VkShaderStageFlags; pImmutableSamplers :P_VkSampler; end; type P_VkDescriptorSetLayoutCreateInfo = ^VkDescriptorSetLayoutCreateInfo; VkDescriptorSetLayoutCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkDescriptorSetLayoutCreateFlags; bindingCount :T_uint32_t; pBindings :P_VkDescriptorSetLayoutBinding; end; type P_VkWriteDescriptorSet = ^VkWriteDescriptorSet; VkWriteDescriptorSet = record sType :VkStructureType; pNext :P_void; dstSet :VkDescriptorSet; dstBinding :T_uint32_t; dstArrayElement :T_uint32_t; descriptorCount :T_uint32_t; descriptorType :VkDescriptorType; pImageInfo :P_VkDescriptorImageInfo; pBufferInfo :P_VkDescriptorBufferInfo; pTexelBufferView :P_VkBufferView; end; type P_VkAttachmentDescription = ^VkAttachmentDescription; VkAttachmentDescription = record flags :VkAttachmentDescriptionFlags; format :VkFormat; samples :VkSampleCountFlagBits; loadOp :VkAttachmentLoadOp; storeOp :VkAttachmentStoreOp; stencilLoadOp :VkAttachmentLoadOp; stencilStoreOp :VkAttachmentStoreOp; initialLayout :VkImageLayout; finalLayout :VkImageLayout; end; type P_VkAttachmentReference = ^VkAttachmentReference; VkAttachmentReference = record attachment :T_uint32_t; layout :VkImageLayout; end; type P_VkFramebufferCreateInfo = ^VkFramebufferCreateInfo; VkFramebufferCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkFramebufferCreateFlags; renderPass :VkRenderPass; attachmentCount :T_uint32_t; pAttachments :P_VkImageView; width :T_uint32_t; height :T_uint32_t; layers :T_uint32_t; end; type P_VkSubpassDescription = ^VkSubpassDescription; VkSubpassDescription = record flags :VkSubpassDescriptionFlags; pipelineBindPoint :VkPipelineBindPoint; inputAttachmentCount :T_uint32_t; pInputAttachments :P_VkAttachmentReference; colorAttachmentCount :T_uint32_t; pColorAttachments :P_VkAttachmentReference; pResolveAttachments :P_VkAttachmentReference; pDepthStencilAttachment :P_VkAttachmentReference; preserveAttachmentCount :T_uint32_t; pPreserveAttachments :P_uint32_t; end; type P_VkSubpassDependency = ^VkSubpassDependency; VkSubpassDependency = record srcSubpass :T_uint32_t; dstSubpass :T_uint32_t; srcStageMask :VkPipelineStageFlags; dstStageMask :VkPipelineStageFlags; srcAccessMask :VkAccessFlags; dstAccessMask :VkAccessFlags; dependencyFlags :VkDependencyFlags; end; type P_VkRenderPassCreateInfo = ^VkRenderPassCreateInfo; VkRenderPassCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkRenderPassCreateFlags; attachmentCount :T_uint32_t; pAttachments :P_VkAttachmentDescription; subpassCount :T_uint32_t; pSubpasses :P_VkSubpassDescription; dependencyCount :T_uint32_t; pDependencies :P_VkSubpassDependency; end; type P_VkCommandPoolCreateInfo = ^VkCommandPoolCreateInfo; VkCommandPoolCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkCommandPoolCreateFlags; queueFamilyIndex :T_uint32_t; end; type P_VkCommandBufferAllocateInfo = ^VkCommandBufferAllocateInfo; VkCommandBufferAllocateInfo = record sType :VkStructureType; pNext :P_void; commandPool :VkCommandPool; level :VkCommandBufferLevel; commandBufferCount :T_uint32_t; end; type P_VkCommandBufferInheritanceInfo = ^VkCommandBufferInheritanceInfo; VkCommandBufferInheritanceInfo = record sType :VkStructureType; pNext :P_void; renderPass :VkRenderPass; subpass :T_uint32_t; framebuffer :VkFramebuffer; occlusionQueryEnable :VkBool32; queryFlags :VkQueryControlFlags; pipelineStatistics :VkQueryPipelineStatisticFlags; end; type P_VkCommandBufferBeginInfo = ^VkCommandBufferBeginInfo; VkCommandBufferBeginInfo = record sType :VkStructureType; pNext :P_void; flags :VkCommandBufferUsageFlags; pInheritanceInfo :P_VkCommandBufferInheritanceInfo; end; type P_VkBufferCopy = ^VkBufferCopy; VkBufferCopy = record srcOffset :VkDeviceSize; dstOffset :VkDeviceSize; size :VkDeviceSize; end; type P_VkImageSubresourceLayers = ^VkImageSubresourceLayers; VkImageSubresourceLayers = record aspectMask :VkImageAspectFlags; mipLevel :T_uint32_t; baseArrayLayer :T_uint32_t; layerCount :T_uint32_t; end; type P_VkBufferImageCopy = ^VkBufferImageCopy; VkBufferImageCopy = record bufferOffset :VkDeviceSize; bufferRowLength :T_uint32_t; bufferImageHeight :T_uint32_t; imageSubresource :VkImageSubresourceLayers; imageOffset :VkOffset3D; imageExtent :VkExtent3D; end; type P_VkClearColorValue = ^VkClearColorValue; VkClearColorValue = record case Byte of 0:( float32 :array [ 0..4-1 ] of T_float ); 1:( int32 :array [ 0..4-1 ] of T_int32_t ); 2:( uint32 :array [ 0..4-1 ] of T_uint32_t ); end; type P_VkClearDepthStencilValue = ^VkClearDepthStencilValue; VkClearDepthStencilValue = record depth :T_float; stencil :T_uint32_t; end; type P_VkClearValue = ^VkClearValue; VkClearValue = record case Byte of 0:( color :VkClearColorValue ); 1:( depthStencil :VkClearDepthStencilValue ); end; type P_VkClearAttachment = ^VkClearAttachment; VkClearAttachment = record aspectMask :VkImageAspectFlags; colorAttachment :T_uint32_t; clearValue :VkClearValue; end; type P_VkClearRect = ^VkClearRect; VkClearRect = record rect :VkRect2D; baseArrayLayer :T_uint32_t; layerCount :T_uint32_t; end; type P_VkImageBlit = ^VkImageBlit; VkImageBlit = record srcSubresource :VkImageSubresourceLayers; srcOffsets :array [ 0..2-1 ] of VkOffset3D; dstSubresource :VkImageSubresourceLayers; dstOffsets :array [ 0..2-1 ] of VkOffset3D; end; type P_VkImageCopy = ^VkImageCopy; VkImageCopy = record srcSubresource :VkImageSubresourceLayers; srcOffset :VkOffset3D; dstSubresource :VkImageSubresourceLayers; dstOffset :VkOffset3D; extent :VkExtent3D; end; type P_VkImageResolve = ^VkImageResolve; VkImageResolve = record srcSubresource :VkImageSubresourceLayers; srcOffset :VkOffset3D; dstSubresource :VkImageSubresourceLayers; dstOffset :VkOffset3D; extent :VkExtent3D; end; type P_VkRenderPassBeginInfo = ^VkRenderPassBeginInfo; VkRenderPassBeginInfo = record sType :VkStructureType; pNext :P_void; renderPass :VkRenderPass; framebuffer :VkFramebuffer; renderArea :VkRect2D; clearValueCount :T_uint32_t; pClearValues :P_VkClearValue; end; type PFN_vkCreateInstance = function( const pCreateInfo_:P_VkInstanceCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pInstance_:P_VkInstance ) :VkResult; type PFN_vkDestroyInstance = procedure( instance_:VkInstance; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkEnumeratePhysicalDevices = function( instance_:VkInstance; pPhysicalDeviceCount_:P_uint32_t; pPhysicalDevices_:P_VkPhysicalDevice ) :VkResult; type PFN_vkGetPhysicalDeviceFeatures = procedure( physicalDevice_:VkPhysicalDevice; pFeatures_:P_VkPhysicalDeviceFeatures ); type PFN_vkGetPhysicalDeviceFormatProperties = procedure( physicalDevice_:VkPhysicalDevice; format_:VkFormat; pFormatProperties_:P_VkFormatProperties ); type PFN_vkGetPhysicalDeviceImageFormatProperties = function( physicalDevice_:VkPhysicalDevice; format_:VkFormat; type_:VkImageType; tiling_:VkImageTiling; usage_:VkImageUsageFlags; flags_:VkImageCreateFlags; pImageFormatProperties_:P_VkImageFormatProperties ) :VkResult; type PFN_vkGetPhysicalDeviceProperties = procedure( physicalDevice_:VkPhysicalDevice; pProperties_:P_VkPhysicalDeviceProperties ); type PFN_vkGetPhysicalDeviceQueueFamilyProperties = procedure( physicalDevice_:VkPhysicalDevice; pQueueFamilyPropertyCount_:P_uint32_t; pQueueFamilyProperties_:P_VkQueueFamilyProperties ); type PFN_vkGetPhysicalDeviceMemoryProperties = procedure( physicalDevice_:VkPhysicalDevice; pMemoryProperties_:P_VkPhysicalDeviceMemoryProperties ); type PFN_vkGetInstanceProcAddr = function( instance_:VkInstance; const pName_:P_char ) :PFN_vkVoidFunction; type PFN_vkGetDeviceProcAddr = function( device_:VkDevice; const pName_:P_char ) :PFN_vkVoidFunction; type PFN_vkCreateDevice = function( physicalDevice_:VkPhysicalDevice; const pCreateInfo_:P_VkDeviceCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pDevice_:P_VkDevice ) :VkResult; type PFN_vkDestroyDevice = procedure( device_:VkDevice; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkEnumerateInstanceExtensionProperties = function( const pLayerName_:P_char; pPropertyCount_:P_uint32_t; pProperties_:P_VkExtensionProperties ) :VkResult; type PFN_vkEnumerateDeviceExtensionProperties = function( physicalDevice_:VkPhysicalDevice; const pLayerName_:P_char; pPropertyCount_:P_uint32_t; pProperties_:P_VkExtensionProperties ) :VkResult; type PFN_vkEnumerateInstanceLayerProperties = function( pPropertyCount_:P_uint32_t; pProperties_:P_VkLayerProperties ) :VkResult; type PFN_vkEnumerateDeviceLayerProperties = function( physicalDevice_:VkPhysicalDevice; pPropertyCount_:P_uint32_t; pProperties_:P_VkLayerProperties ) :VkResult; type PFN_vkGetDeviceQueue = procedure( device_:VkDevice; queueFamilyIndex_:T_uint32_t; queueIndex_:T_uint32_t; pQueue_:P_VkQueue ); type PFN_vkQueueSubmit = function( queue_:VkQueue; submitCount_:T_uint32_t; const pSubmits_:P_VkSubmitInfo; fence_:VkFence ) :VkResult; type PFN_vkQueueWaitIdle = function( queue_:VkQueue ) :VkResult; type PFN_vkDeviceWaitIdle = function( device_:VkDevice ) :VkResult; type PFN_vkAllocateMemory = function( device_:VkDevice; const pAllocateInfo_:P_VkMemoryAllocateInfo; const pAllocator_:P_VkAllocationCallbacks; pMemory_:P_VkDeviceMemory ) :VkResult; type PFN_vkFreeMemory = procedure( device_:VkDevice; memory_:VkDeviceMemory; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkMapMemory = function( device_:VkDevice; memory_:VkDeviceMemory; offset_:VkDeviceSize; size_:VkDeviceSize; flags_:VkMemoryMapFlags; ppData_:PP_void ) :VkResult; type PFN_vkUnmapMemory = procedure( device_:VkDevice; memory_:VkDeviceMemory ); type PFN_vkFlushMappedMemoryRanges = function( device_:VkDevice; memoryRangeCount_:T_uint32_t; const pMemoryRanges_:P_VkMappedMemoryRange ) :VkResult; type PFN_vkInvalidateMappedMemoryRanges = function( device_:VkDevice; memoryRangeCount_:T_uint32_t; const pMemoryRanges_:P_VkMappedMemoryRange ) :VkResult; type PFN_vkGetDeviceMemoryCommitment = procedure( device_:VkDevice; memory_:VkDeviceMemory; pCommittedMemoryInBytes_:P_VkDeviceSize ); type PFN_vkBindBufferMemory = function( device_:VkDevice; buffer_:VkBuffer; memory_:VkDeviceMemory; memoryOffset_:VkDeviceSize ) :VkResult; type PFN_vkBindImageMemory = function( device_:VkDevice; image_:VkImage; memory_:VkDeviceMemory; memoryOffset_:VkDeviceSize ) :VkResult; type PFN_vkGetBufferMemoryRequirements = procedure( device_:VkDevice; buffer_:VkBuffer; pMemoryRequirements_:P_VkMemoryRequirements ); type PFN_vkGetImageMemoryRequirements = procedure( device_:VkDevice; image_:VkImage; pMemoryRequirements_:P_VkMemoryRequirements ); type PFN_vkGetImageSparseMemoryRequirements = procedure( device_:VkDevice; image_:VkImage; pSparseMemoryRequirementCount_:P_uint32_t; pSparseMemoryRequirements_:P_VkSparseImageMemoryRequirements ); type PFN_vkGetPhysicalDeviceSparseImageFormatProperties = procedure( physicalDevice_:VkPhysicalDevice; format_:VkFormat; type_:VkImageType; samples_:VkSampleCountFlagBits; usage_:VkImageUsageFlags; tiling_:VkImageTiling; pPropertyCount_:P_uint32_t; pProperties_:P_VkSparseImageFormatProperties ); type PFN_vkQueueBindSparse = function( queue_:VkQueue; bindInfoCount_:T_uint32_t; const pBindInfo_:P_VkBindSparseInfo; fence_:VkFence ) :VkResult; type PFN_vkCreateFence = function( device_:VkDevice; const pCreateInfo_:P_VkFenceCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pFence_:P_VkFence ) :VkResult; type PFN_vkDestroyFence = procedure( device_:VkDevice; fence_:VkFence; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkResetFences = function( device_:VkDevice; fenceCount_:T_uint32_t; const pFences_:P_VkFence ) :VkResult; type PFN_vkGetFenceStatus = function( device_:VkDevice; fence_:VkFence ) :VkResult; type PFN_vkWaitForFences = function( device_:VkDevice; fenceCount_:T_uint32_t; const pFences_:P_VkFence; waitAll_:VkBool32; timeout_:T_uint64_t ) :VkResult; type PFN_vkCreateSemaphore = function( device_:VkDevice; const pCreateInfo_:P_VkSemaphoreCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pSemaphore_:P_VkSemaphore ) :VkResult; type PFN_vkDestroySemaphore = procedure( device_:VkDevice; semaphore_:VkSemaphore; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkCreateEvent = function( device_:VkDevice; const pCreateInfo_:P_VkEventCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pEvent_:P_VkEvent ) :VkResult; type PFN_vkDestroyEvent = procedure( device_:VkDevice; event_:VkEvent; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkGetEventStatus = function( device_:VkDevice; event_:VkEvent ) :VkResult; type PFN_vkSetEvent = function( device_:VkDevice; event_:VkEvent ) :VkResult; type PFN_vkResetEvent = function( device_:VkDevice; event_:VkEvent ) :VkResult; type PFN_vkCreateQueryPool = function( device_:VkDevice; const pCreateInfo_:P_VkQueryPoolCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pQueryPool_:P_VkQueryPool ) :VkResult; type PFN_vkDestroyQueryPool = procedure( device_:VkDevice; queryPool_:VkQueryPool; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkGetQueryPoolResults = function( device_:VkDevice; queryPool_:VkQueryPool; firstQuery_:T_uint32_t; queryCount_:T_uint32_t; dataSize_:T_size_t; pData_:P_void; stride_:VkDeviceSize; flags_:VkQueryResultFlags ) :VkResult; type PFN_vkCreateBuffer = function( device_:VkDevice; const pCreateInfo_:P_VkBufferCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pBuffer_:P_VkBuffer ) :VkResult; type PFN_vkDestroyBuffer = procedure( device_:VkDevice; buffer_:VkBuffer; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkCreateBufferView = function( device_:VkDevice; const pCreateInfo_:P_VkBufferViewCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pView_:P_VkBufferView ) :VkResult; type PFN_vkDestroyBufferView = procedure( device_:VkDevice; bufferView_:VkBufferView; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkCreateImage = function( device_:VkDevice; const pCreateInfo_:P_VkImageCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pImage_:P_VkImage ) :VkResult; type PFN_vkDestroyImage = procedure( device_:VkDevice; image_:VkImage; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkGetImageSubresourceLayout = procedure( device_:VkDevice; image_:VkImage; const pSubresource_:P_VkImageSubresource; pLayout_:P_VkSubresourceLayout ); type PFN_vkCreateImageView = function( device_:VkDevice; const pCreateInfo_:P_VkImageViewCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pView_:P_VkImageView ) :VkResult; type PFN_vkDestroyImageView = procedure( device_:VkDevice; imageView_:VkImageView; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkCreateShaderModule = function( device_:VkDevice; const pCreateInfo_:P_VkShaderModuleCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pShaderModule_:P_VkShaderModule ) :VkResult; type PFN_vkDestroyShaderModule = procedure( device_:VkDevice; shaderModule_:VkShaderModule; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkCreatePipelineCache = function( device_:VkDevice; const pCreateInfo_:P_VkPipelineCacheCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pPipelineCache_:P_VkPipelineCache ) :VkResult; type PFN_vkDestroyPipelineCache = procedure( device_:VkDevice; pipelineCache_:VkPipelineCache; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkGetPipelineCacheData = function( device_:VkDevice; pipelineCache_:VkPipelineCache; pDataSize_:P_size_t; pData_:P_void ) :VkResult; type PFN_vkMergePipelineCaches = function( device_:VkDevice; dstCache_:VkPipelineCache; srcCacheCount_:T_uint32_t; const pSrcCaches_:P_VkPipelineCache ) :VkResult; type PFN_vkCreateGraphicsPipelines = function( device_:VkDevice; pipelineCache_:VkPipelineCache; createInfoCount_:T_uint32_t; const pCreateInfos_:P_VkGraphicsPipelineCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pPipelines_:P_VkPipeline ) :VkResult; type PFN_vkCreateComputePipelines = function( device_:VkDevice; pipelineCache_:VkPipelineCache; createInfoCount_:T_uint32_t; const pCreateInfos_:P_VkComputePipelineCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pPipelines_:P_VkPipeline ) :VkResult; type PFN_vkDestroyPipeline = procedure( device_:VkDevice; pipeline_:VkPipeline; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkCreatePipelineLayout = function( device_:VkDevice; const pCreateInfo_:P_VkPipelineLayoutCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pPipelineLayout_:P_VkPipelineLayout ) :VkResult; type PFN_vkDestroyPipelineLayout = procedure( device_:VkDevice; pipelineLayout_:VkPipelineLayout; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkCreateSampler = function( device_:VkDevice; const pCreateInfo_:P_VkSamplerCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pSampler_:P_VkSampler ) :VkResult; type PFN_vkDestroySampler = procedure( device_:VkDevice; sampler_:VkSampler; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkCreateDescriptorSetLayout = function( device_:VkDevice; const pCreateInfo_:P_VkDescriptorSetLayoutCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pSetLayout_:P_VkDescriptorSetLayout ) :VkResult; type PFN_vkDestroyDescriptorSetLayout = procedure( device_:VkDevice; descriptorSetLayout_:VkDescriptorSetLayout; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkCreateDescriptorPool = function( device_:VkDevice; const pCreateInfo_:P_VkDescriptorPoolCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pDescriptorPool_:P_VkDescriptorPool ) :VkResult; type PFN_vkDestroyDescriptorPool = procedure( device_:VkDevice; descriptorPool_:VkDescriptorPool; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkResetDescriptorPool = function( device_:VkDevice; descriptorPool_:VkDescriptorPool; flags_:VkDescriptorPoolResetFlags ) :VkResult; type PFN_vkAllocateDescriptorSets = function( device_:VkDevice; const pAllocateInfo_:P_VkDescriptorSetAllocateInfo; pDescriptorSets_:P_VkDescriptorSet ) :VkResult; type PFN_vkFreeDescriptorSets = function( device_:VkDevice; descriptorPool_:VkDescriptorPool; descriptorSetCount_:T_uint32_t; const pDescriptorSets_:P_VkDescriptorSet ) :VkResult; type PFN_vkUpdateDescriptorSets = procedure( device_:VkDevice; descriptorWriteCount_:T_uint32_t; const pDescriptorWrites_:P_VkWriteDescriptorSet; descriptorCopyCount_:T_uint32_t; const pDescriptorCopies_:P_VkCopyDescriptorSet ); type PFN_vkCreateFramebuffer = function( device_:VkDevice; const pCreateInfo_:P_VkFramebufferCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pFramebuffer_:P_VkFramebuffer ) :VkResult; type PFN_vkDestroyFramebuffer = procedure( device_:VkDevice; framebuffer_:VkFramebuffer; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkCreateRenderPass = function( device_:VkDevice; const pCreateInfo_:P_VkRenderPassCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pRenderPass_:P_VkRenderPass ) :VkResult; type PFN_vkDestroyRenderPass = procedure( device_:VkDevice; renderPass_:VkRenderPass; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkGetRenderAreaGranularity = procedure( device_:VkDevice; renderPass_:VkRenderPass; pGranularity_:P_VkExtent2D ); type PFN_vkCreateCommandPool = function( device_:VkDevice; const pCreateInfo_:P_VkCommandPoolCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pCommandPool_:P_VkCommandPool ) :VkResult; type PFN_vkDestroyCommandPool = procedure( device_:VkDevice; commandPool_:VkCommandPool; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkResetCommandPool = function( device_:VkDevice; commandPool_:VkCommandPool; flags_:VkCommandPoolResetFlags ) :VkResult; type PFN_vkAllocateCommandBuffers = function( device_:VkDevice; const pAllocateInfo_:P_VkCommandBufferAllocateInfo; pCommandBuffers_:P_VkCommandBuffer ) :VkResult; type PFN_vkFreeCommandBuffers = procedure( device_:VkDevice; commandPool_:VkCommandPool; commandBufferCount_:T_uint32_t; const pCommandBuffers_:P_VkCommandBuffer ); type PFN_vkBeginCommandBuffer = function( commandBuffer_:VkCommandBuffer; const pBeginInfo_:P_VkCommandBufferBeginInfo ) :VkResult; type PFN_vkEndCommandBuffer = function( commandBuffer_:VkCommandBuffer ) :VkResult; type PFN_vkResetCommandBuffer = function( commandBuffer_:VkCommandBuffer; flags_:VkCommandBufferResetFlags ) :VkResult; type PFN_vkCmdBindPipeline = procedure( commandBuffer_:VkCommandBuffer; pipelineBindPoint_:VkPipelineBindPoint; pipeline_:VkPipeline ); type PFN_vkCmdSetViewport = procedure( commandBuffer_:VkCommandBuffer; firstViewport_:T_uint32_t; viewportCount_:T_uint32_t; const pViewports_:P_VkViewport ); type PFN_vkCmdSetScissor = procedure( commandBuffer_:VkCommandBuffer; firstScissor_:T_uint32_t; scissorCount_:T_uint32_t; const pScissors_:P_VkRect2D ); type PFN_vkCmdSetLineWidth = procedure( commandBuffer_:VkCommandBuffer; lineWidth_:T_float ); type PFN_vkCmdSetDepthBias = procedure( commandBuffer_:VkCommandBuffer; depthBiasConstantFactor_:T_float; depthBiasClamp_:T_float; depthBiasSlopeFactor_:T_float ); type T_blendConstants = array [ 0..4-1 ] of T_float; PFN_vkCmdSetBlendConstants = procedure( commandBuffer_:VkCommandBuffer; const blendConstants_:T_blendConstants ); type PFN_vkCmdSetDepthBounds = procedure( commandBuffer_:VkCommandBuffer; minDepthBounds_:T_float; maxDepthBounds_:T_float ); type PFN_vkCmdSetStencilCompareMask = procedure( commandBuffer_:VkCommandBuffer; faceMask_:VkStencilFaceFlags; compareMask_:T_uint32_t ); type PFN_vkCmdSetStencilWriteMask = procedure( commandBuffer_:VkCommandBuffer; faceMask_:VkStencilFaceFlags; writeMask_:T_uint32_t ); type PFN_vkCmdSetStencilReference = procedure( commandBuffer_:VkCommandBuffer; faceMask_:VkStencilFaceFlags; reference_:T_uint32_t ); type PFN_vkCmdBindDescriptorSets = procedure( commandBuffer_:VkCommandBuffer; pipelineBindPoint_:VkPipelineBindPoint; layout_:VkPipelineLayout; firstSet_:T_uint32_t; descriptorSetCount_:T_uint32_t; const pDescriptorSets_:P_VkDescriptorSet; dynamicOffsetCount_:T_uint32_t; const pDynamicOffsets_:P_uint32_t ); type PFN_vkCmdBindIndexBuffer = procedure( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; indexType_:VkIndexType ); type PFN_vkCmdBindVertexBuffers = procedure( commandBuffer_:VkCommandBuffer; firstBinding_:T_uint32_t; bindingCount_:T_uint32_t; const pBuffers_:P_VkBuffer; const pOffsets_:P_VkDeviceSize ); type PFN_vkCmdDraw = procedure( commandBuffer_:VkCommandBuffer; vertexCount_:T_uint32_t; instanceCount_:T_uint32_t; firstVertex_:T_uint32_t; firstInstance_:T_uint32_t ); type PFN_vkCmdDrawIndexed = procedure( commandBuffer_:VkCommandBuffer; indexCount_:T_uint32_t; instanceCount_:T_uint32_t; firstIndex_:T_uint32_t; vertexOffset_:T_int32_t; firstInstance_:T_uint32_t ); type PFN_vkCmdDrawIndirect = procedure( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; drawCount_:T_uint32_t; stride_:T_uint32_t ); type PFN_vkCmdDrawIndexedIndirect = procedure( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; drawCount_:T_uint32_t; stride_:T_uint32_t ); type PFN_vkCmdDispatch = procedure( commandBuffer_:VkCommandBuffer; groupCountX_:T_uint32_t; groupCountY_:T_uint32_t; groupCountZ_:T_uint32_t ); type PFN_vkCmdDispatchIndirect = procedure( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize ); type PFN_vkCmdCopyBuffer = procedure( commandBuffer_:VkCommandBuffer; srcBuffer_:VkBuffer; dstBuffer_:VkBuffer; regionCount_:T_uint32_t; const pRegions_:P_VkBufferCopy ); type PFN_vkCmdCopyImage = procedure( commandBuffer_:VkCommandBuffer; srcImage_:VkImage; srcImageLayout_:VkImageLayout; dstImage_:VkImage; dstImageLayout_:VkImageLayout; regionCount_:T_uint32_t; const pRegions_:P_VkImageCopy ); type PFN_vkCmdBlitImage = procedure( commandBuffer_:VkCommandBuffer; srcImage_:VkImage; srcImageLayout_:VkImageLayout; dstImage_:VkImage; dstImageLayout_:VkImageLayout; regionCount_:T_uint32_t; const pRegions_:P_VkImageBlit; filter_:VkFilter ); type PFN_vkCmdCopyBufferToImage = procedure( commandBuffer_:VkCommandBuffer; srcBuffer_:VkBuffer; dstImage_:VkImage; dstImageLayout_:VkImageLayout; regionCount_:T_uint32_t; const pRegions_:P_VkBufferImageCopy ); type PFN_vkCmdCopyImageToBuffer = procedure( commandBuffer_:VkCommandBuffer; srcImage_:VkImage; srcImageLayout_:VkImageLayout; dstBuffer_:VkBuffer; regionCount_:T_uint32_t; const pRegions_:P_VkBufferImageCopy ); type PFN_vkCmdUpdateBuffer = procedure( commandBuffer_:VkCommandBuffer; dstBuffer_:VkBuffer; dstOffset_:VkDeviceSize; dataSize_:VkDeviceSize; const pData_:P_void ); type PFN_vkCmdFillBuffer = procedure( commandBuffer_:VkCommandBuffer; dstBuffer_:VkBuffer; dstOffset_:VkDeviceSize; size_:VkDeviceSize; data_:T_uint32_t ); type PFN_vkCmdClearColorImage = procedure( commandBuffer_:VkCommandBuffer; image_:VkImage; imageLayout_:VkImageLayout; const pColor_:P_VkClearColorValue; rangeCount_:T_uint32_t; const pRanges_:P_VkImageSubresourceRange ); type PFN_vkCmdClearDepthStencilImage = procedure( commandBuffer_:VkCommandBuffer; image_:VkImage; imageLayout_:VkImageLayout; const pDepthStencil_:P_VkClearDepthStencilValue; rangeCount_:T_uint32_t; const pRanges_:P_VkImageSubresourceRange ); type PFN_vkCmdClearAttachments = procedure( commandBuffer_:VkCommandBuffer; attachmentCount_:T_uint32_t; const pAttachments_:P_VkClearAttachment; rectCount_:T_uint32_t; const pRects_:P_VkClearRect ); type PFN_vkCmdResolveImage = procedure( commandBuffer_:VkCommandBuffer; srcImage_:VkImage; srcImageLayout_:VkImageLayout; dstImage_:VkImage; dstImageLayout_:VkImageLayout; regionCount_:T_uint32_t; const pRegions_:P_VkImageResolve ); type PFN_vkCmdSetEvent = procedure( commandBuffer_:VkCommandBuffer; event_:VkEvent; stageMask_:VkPipelineStageFlags ); type PFN_vkCmdResetEvent = procedure( commandBuffer_:VkCommandBuffer; event_:VkEvent; stageMask_:VkPipelineStageFlags ); type PFN_vkCmdWaitEvents = procedure( commandBuffer_:VkCommandBuffer; eventCount_:T_uint32_t; const pEvents_:P_VkEvent; srcStageMask_:VkPipelineStageFlags; dstStageMask_:VkPipelineStageFlags; memoryBarrierCount_:T_uint32_t; const pMemoryBarriers_:P_VkMemoryBarrier; bufferMemoryBarrierCount_:T_uint32_t; const pBufferMemoryBarriers_:P_VkBufferMemoryBarrier; imageMemoryBarrierCount_:T_uint32_t; const pImageMemoryBarriers_:P_VkImageMemoryBarrier ); type PFN_vkCmdPipelineBarrier = procedure( commandBuffer_:VkCommandBuffer; srcStageMask_:VkPipelineStageFlags; dstStageMask_:VkPipelineStageFlags; dependencyFlags_:VkDependencyFlags; memoryBarrierCount_:T_uint32_t; const pMemoryBarriers_:P_VkMemoryBarrier; bufferMemoryBarrierCount_:T_uint32_t; const pBufferMemoryBarriers_:P_VkBufferMemoryBarrier; imageMemoryBarrierCount_:T_uint32_t; const pImageMemoryBarriers_:P_VkImageMemoryBarrier ); type PFN_vkCmdBeginQuery = procedure( commandBuffer_:VkCommandBuffer; queryPool_:VkQueryPool; query_:T_uint32_t; flags_:VkQueryControlFlags ); type PFN_vkCmdEndQuery = procedure( commandBuffer_:VkCommandBuffer; queryPool_:VkQueryPool; query_:T_uint32_t ); type PFN_vkCmdResetQueryPool = procedure( commandBuffer_:VkCommandBuffer; queryPool_:VkQueryPool; firstQuery_:T_uint32_t; queryCount_:T_uint32_t ); type PFN_vkCmdWriteTimestamp = procedure( commandBuffer_:VkCommandBuffer; pipelineStage_:VkPipelineStageFlagBits; queryPool_:VkQueryPool; query_:T_uint32_t ); type PFN_vkCmdCopyQueryPoolResults = procedure( commandBuffer_:VkCommandBuffer; queryPool_:VkQueryPool; firstQuery_:T_uint32_t; queryCount_:T_uint32_t; dstBuffer_:VkBuffer; dstOffset_:VkDeviceSize; stride_:VkDeviceSize; flags_:VkQueryResultFlags ); type PFN_vkCmdPushConstants = procedure( commandBuffer_:VkCommandBuffer; layout_:VkPipelineLayout; stageFlags_:VkShaderStageFlags; offset_:T_uint32_t; size_:T_uint32_t; const pValues_:P_void ); type PFN_vkCmdBeginRenderPass = procedure( commandBuffer_:VkCommandBuffer; const pRenderPassBegin_:P_VkRenderPassBeginInfo; contents_:VkSubpassContents ); type PFN_vkCmdNextSubpass = procedure( commandBuffer_:VkCommandBuffer; contents_:VkSubpassContents ); type PFN_vkCmdEndRenderPass = procedure( commandBuffer_:VkCommandBuffer ); type PFN_vkCmdExecuteCommands = procedure( commandBuffer_:VkCommandBuffer; commandBufferCount_:T_uint32_t; const pCommandBuffers_:P_VkCommandBuffer ); {$IFNDEF VK_NO_PROTOTYPES } function vkCreateInstance( pCreateInfo_ :P_VkInstanceCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pInstance_ :P_VkInstance ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyInstance( instance_ :VkInstance; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkEnumeratePhysicalDevices( instance_ :VkInstance; pPhysicalDeviceCount_ :P_uint32_t; pPhysicalDevices_ :P_VkPhysicalDevice ) :VkResult; stdcall; external DLLNAME; procedure vkGetPhysicalDeviceFeatures( physicalDevice_ :VkPhysicalDevice; pFeatures_ :P_VkPhysicalDeviceFeatures ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceFormatProperties( physicalDevice_ :VkPhysicalDevice; format_ :VkFormat; pFormatProperties_ :P_VkFormatProperties ); stdcall; external DLLNAME; function vkGetPhysicalDeviceImageFormatProperties( physicalDevice_:VkPhysicalDevice; format_ :VkFormat; type_ :VkImageType; tiling_ :VkImageTiling; usage_ :VkImageUsageFlags; flags_ :VkImageCreateFlags; pImageFormatProperties_ :P_VkImageFormatProperties ) :VkResult; stdcall; external DLLNAME; procedure vkGetPhysicalDeviceProperties( physicalDevice_ :VkPhysicalDevice; pProperties_ :P_VkPhysicalDeviceProperties ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceQueueFamilyProperties( physicalDevice_ :VkPhysicalDevice; pQueueFamilyPropertyCount_ :P_uint32_t; pQueueFamilyProperties_ :P_VkQueueFamilyProperties ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceMemoryProperties( physicalDevice_ :VkPhysicalDevice; pMemoryProperties_ :P_VkPhysicalDeviceMemoryProperties ); stdcall; external DLLNAME; function vkGetInstanceProcAddr( instance_ :VkInstance; pName_ :P_char ) :PFN_vkVoidFunction; stdcall; external DLLNAME; function vkGetDeviceProcAddr( device_ :VkDevice; pName_ :P_char ) :PFN_vkVoidFunction; stdcall; external DLLNAME; function vkCreateDevice( physicalDevice_ :VkPhysicalDevice; pCreateInfo_ :P_VkDeviceCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pDevice_ :P_VkDevice ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyDevice( device_ :VkDevice; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkEnumerateInstanceExtensionProperties( pLayerName_ :P_char; pPropertyCount_ :P_uint32_t; pProperties_ :P_VkExtensionProperties ) :VkResult; stdcall; external DLLNAME; function vkEnumerateDeviceExtensionProperties( physicalDevice_ :VkPhysicalDevice; pLayerName_ :P_char; pPropertyCount_ :P_uint32_t; pProperties_ :P_VkExtensionProperties ) :VkResult; stdcall; external DLLNAME; function vkEnumerateInstanceLayerProperties( pPropertyCount_ :P_uint32_t; pProperties_ :P_VkLayerProperties ) :VkResult; stdcall; external DLLNAME; function vkEnumerateDeviceLayerProperties( physicalDevice_ :VkPhysicalDevice; pPropertyCount_ :P_uint32_t; pProperties_ :P_VkLayerProperties ) :VkResult; stdcall; external DLLNAME; procedure vkGetDeviceQueue( device_ :VkDevice; queueFamilyIndex_ :T_uint32_t; queueIndex_ :T_uint32_t; pQueue_ :P_VkQueue ); stdcall; external DLLNAME; function vkQueueSubmit( queue_ :VkQueue; submitCount_ :T_uint32_t; pSubmits_ :P_VkSubmitInfo; fence_ :VkFence ) :VkResult; stdcall; external DLLNAME; function vkQueueWaitIdle( queue_ :VkQueue ) :VkResult; stdcall; external DLLNAME; function vkDeviceWaitIdle( device_ :VkDevice ) :VkResult; stdcall; external DLLNAME; function vkAllocateMemory( device_ :VkDevice; pAllocateInfo_ :P_VkMemoryAllocateInfo; pAllocator_ :P_VkAllocationCallbacks; pMemory_ :P_VkDeviceMemory ) :VkResult; stdcall; external DLLNAME; procedure vkFreeMemory( device_ :VkDevice; memory_ :VkDeviceMemory; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkMapMemory( device_ :VkDevice; memory_ :VkDeviceMemory; offset_ :VkDeviceSize; size_ :VkDeviceSize; flags_ :VkMemoryMapFlags; ppData_ :PP_void ) :VkResult; stdcall; external DLLNAME; procedure vkUnmapMemory( device_ :VkDevice; memory_ :VkDeviceMemory ); stdcall; external DLLNAME; function vkFlushMappedMemoryRanges( device_ :VkDevice; memoryRangeCount_ :T_uint32_t; pMemoryRanges_ :P_VkMappedMemoryRange ) :VkResult; stdcall; external DLLNAME; function vkInvalidateMappedMemoryRanges( device_ :VkDevice; memoryRangeCount_ :T_uint32_t; pMemoryRanges_ :P_VkMappedMemoryRange ) :VkResult; stdcall; external DLLNAME; procedure vkGetDeviceMemoryCommitment( device_ :VkDevice; memory_ :VkDeviceMemory; pCommittedMemoryInBytes_ :P_VkDeviceSize ); stdcall; external DLLNAME; function vkBindBufferMemory( device_ :VkDevice; buffer_ :VkBuffer; memory_ :VkDeviceMemory; memoryOffset_ :VkDeviceSize ) :VkResult; stdcall; external DLLNAME; function vkBindImageMemory( device_ :VkDevice; image_ :VkImage; memory_ :VkDeviceMemory; memoryOffset_ :VkDeviceSize ) :VkResult; stdcall; external DLLNAME; procedure vkGetBufferMemoryRequirements( device_ :VkDevice; buffer_ :VkBuffer; pMemoryRequirements_ :P_VkMemoryRequirements ); stdcall; external DLLNAME; procedure vkGetImageMemoryRequirements( device_ :VkDevice; image_ :VkImage; pMemoryRequirements_ :P_VkMemoryRequirements ); stdcall; external DLLNAME; procedure vkGetImageSparseMemoryRequirements( device_ :VkDevice; image_ :VkImage; pSparseMemoryRequirementCount_ :P_uint32_t; pSparseMemoryRequirements_ :P_VkSparseImageMemoryRequirements ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceSparseImageFormatProperties( physicalDevice_ :VkPhysicalDevice; format_ :VkFormat; type_ :VkImageType; samples_ :VkSampleCountFlagBits; usage_ :VkImageUsageFlags; tiling_ :VkImageTiling; pPropertyCount_ :P_uint32_t; pProperties_ :P_VkSparseImageFormatProperties ); stdcall; external DLLNAME; function vkQueueBindSparse( queue_ :VkQueue; bindInfoCount_ :T_uint32_t; pBindInfo_ :P_VkBindSparseInfo; fence_ :VkFence ) :VkResult; stdcall; external DLLNAME; function vkCreateFence( device_ :VkDevice; pCreateInfo_ :P_VkFenceCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pFence_ :P_VkFence ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyFence( device_ :VkDevice; fence_ :VkFence; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkResetFences( device_ :VkDevice; fenceCount_ :T_uint32_t; pFences_ :P_VkFence ) :VkResult; stdcall; external DLLNAME; function vkGetFenceStatus( device_ :VkDevice; fence_ :VkFence ) :VkResult; stdcall; external DLLNAME; function vkWaitForFences( device_ :VkDevice; fenceCount_ :T_uint32_t; pFences_ :P_VkFence; waitAll_ :VkBool32; timeout_ :T_uint64_t ) :VkResult; stdcall; external DLLNAME; function vkCreateSemaphore( device_ :VkDevice; pCreateInfo_ :P_VkSemaphoreCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pSemaphore_ :P_VkSemaphore ) :VkResult; stdcall; external DLLNAME; procedure vkDestroySemaphore( device_ :VkDevice; semaphore_ :VkSemaphore; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkCreateEvent( device_ :VkDevice; pCreateInfo_ :P_VkEventCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pEvent_ :P_VkEvent ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyEvent( device_ :VkDevice; event_ :VkEvent; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkGetEventStatus( device_ :VkDevice; event_ :VkEvent ) :VkResult; stdcall; external DLLNAME; function vkSetEvent( device_ :VkDevice; event_ :VkEvent ) :VkResult; stdcall; external DLLNAME; function vkResetEvent( device_ :VkDevice; event_ :VkEvent ) :VkResult; stdcall; external DLLNAME; function vkCreateQueryPool( device_ :VkDevice; pCreateInfo_ :P_VkQueryPoolCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pQueryPool_ :P_VkQueryPool ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyQueryPool( device_ :VkDevice; queryPool_ :VkQueryPool; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkGetQueryPoolResults( device_ :VkDevice; queryPool_ :VkQueryPool; firstQuery_ :T_uint32_t; queryCount_ :T_uint32_t; dataSize_ :T_size_t; pData_ :P_void; stride_ :VkDeviceSize; flags_ :VkQueryResultFlags ) :VkResult; stdcall; external DLLNAME; function vkCreateBuffer( device_ :VkDevice; pCreateInfo_ :P_VkBufferCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pBuffer_ :P_VkBuffer ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyBuffer( device_ :VkDevice; buffer_ :VkBuffer; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkCreateBufferView( device_ :VkDevice; pCreateInfo_ :P_VkBufferViewCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pView_ :P_VkBufferView ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyBufferView( device_ :VkDevice; bufferView_ :VkBufferView; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkCreateImage( device_ :VkDevice; pCreateInfo_ :P_VkImageCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pImage_ :P_VkImage ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyImage( device_ :VkDevice; image_ :VkImage; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; procedure vkGetImageSubresourceLayout( device_ :VkDevice; image_ :VkImage; pSubresource_ :P_VkImageSubresource; pLayout_ :P_VkSubresourceLayout ); stdcall; external DLLNAME; function vkCreateImageView( device_ :VkDevice; pCreateInfo_ :P_VkImageViewCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pView_ :P_VkImageView ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyImageView( device_ :VkDevice; imageView_ :VkImageView; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkCreateShaderModule( device_ :VkDevice; pCreateInfo_ :P_VkShaderModuleCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pShaderModule_ :P_VkShaderModule ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyShaderModule( device_ :VkDevice; shaderModule_ :VkShaderModule; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkCreatePipelineCache( device_ :VkDevice; pCreateInfo_ :P_VkPipelineCacheCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pPipelineCache_ :P_VkPipelineCache ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyPipelineCache( device_ :VkDevice; pipelineCache_ :VkPipelineCache; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkGetPipelineCacheData( device_ :VkDevice; pipelineCache_ :VkPipelineCache; pDataSize_ :P_size_t; pData_ :P_void ) :VkResult; stdcall; external DLLNAME; function vkMergePipelineCaches( device_ :VkDevice; dstCache_ :VkPipelineCache; srcCacheCount_ :T_uint32_t; pSrcCaches_ :P_VkPipelineCache ) :VkResult; stdcall; external DLLNAME; function vkCreateGraphicsPipelines( device_ :VkDevice; pipelineCache_ :VkPipelineCache; createInfoCount_ :T_uint32_t; pCreateInfos_ :P_VkGraphicsPipelineCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pPipelines_ :P_VkPipeline ) :VkResult; stdcall; external DLLNAME; function vkCreateComputePipelines( device_ :VkDevice; pipelineCache_ :VkPipelineCache; createInfoCount_ :T_uint32_t; pCreateInfos_ :P_VkComputePipelineCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pPipelines_ :P_VkPipeline ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyPipeline( device_ :VkDevice; pipeline_ :VkPipeline; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkCreatePipelineLayout( device_ :VkDevice; pCreateInfo_ :P_VkPipelineLayoutCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pPipelineLayout_ :P_VkPipelineLayout ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyPipelineLayout( device_ :VkDevice; pipelineLayout_ :VkPipelineLayout; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkCreateSampler( device_ :VkDevice; pCreateInfo_ :P_VkSamplerCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pSampler_ :P_VkSampler ) :VkResult; stdcall; external DLLNAME; procedure vkDestroySampler( device_ :VkDevice; sampler_ :VkSampler; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkCreateDescriptorSetLayout( device_ :VkDevice; pCreateInfo_ :P_VkDescriptorSetLayoutCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pSetLayout_ :P_VkDescriptorSetLayout ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyDescriptorSetLayout( device_ :VkDevice; descriptorSetLayout_ :VkDescriptorSetLayout; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkCreateDescriptorPool( device_ :VkDevice; pCreateInfo_ :P_VkDescriptorPoolCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pDescriptorPool_ :P_VkDescriptorPool ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyDescriptorPool( device_ :VkDevice; descriptorPool_ :VkDescriptorPool; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkResetDescriptorPool( device_ :VkDevice; descriptorPool_ :VkDescriptorPool; flags_ :VkDescriptorPoolResetFlags ) :VkResult; stdcall; external DLLNAME; function vkAllocateDescriptorSets( device_ :VkDevice; pAllocateInfo_ :P_VkDescriptorSetAllocateInfo; pDescriptorSets_ :P_VkDescriptorSet ) :VkResult; stdcall; external DLLNAME; function vkFreeDescriptorSets( device_ :VkDevice; descriptorPool_ :VkDescriptorPool; descriptorSetCount_ :T_uint32_t; pDescriptorSets_ :P_VkDescriptorSet ) :VkResult; stdcall; external DLLNAME; procedure vkUpdateDescriptorSets( device_ :VkDevice; descriptorWriteCount_ :T_uint32_t; pDescriptorWrites_ :P_VkWriteDescriptorSet; descriptorCopyCount_ :T_uint32_t; pDescriptorCopies_ :P_VkCopyDescriptorSet ); stdcall; external DLLNAME; function vkCreateFramebuffer( device_ :VkDevice; pCreateInfo_ :P_VkFramebufferCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pFramebuffer_ :P_VkFramebuffer ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyFramebuffer( device_ :VkDevice; framebuffer_ :VkFramebuffer; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkCreateRenderPass( device_ :VkDevice; pCreateInfo_ :P_VkRenderPassCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pRenderPass_ :P_VkRenderPass ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyRenderPass( device_ :VkDevice; renderPass_ :VkRenderPass; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; procedure vkGetRenderAreaGranularity( device_ :VkDevice; renderPass_ :VkRenderPass; pGranularity_ :P_VkExtent2D ); stdcall; external DLLNAME; function vkCreateCommandPool( device_ :VkDevice; pCreateInfo_ :P_VkCommandPoolCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pCommandPool_ :P_VkCommandPool ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyCommandPool( device_ :VkDevice; commandPool_ :VkCommandPool; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkResetCommandPool( device_ :VkDevice; commandPool_ :VkCommandPool; flags_ :VkCommandPoolResetFlags ) :VkResult; stdcall; external DLLNAME; function vkAllocateCommandBuffers( device_ :VkDevice; pAllocateInfo_ :P_VkCommandBufferAllocateInfo; pCommandBuffers_ :P_VkCommandBuffer ) :VkResult; stdcall; external DLLNAME; procedure vkFreeCommandBuffers( device_ :VkDevice; commandPool_ :VkCommandPool; commandBufferCount_ :T_uint32_t; pCommandBuffers_ :P_VkCommandBuffer ); stdcall; external DLLNAME; function vkBeginCommandBuffer( commandBuffer_ :VkCommandBuffer; pBeginInfo_ :P_VkCommandBufferBeginInfo ) :VkResult; stdcall; external DLLNAME; function vkEndCommandBuffer( commandBuffer_ :VkCommandBuffer ) :VkResult; stdcall; external DLLNAME; function vkResetCommandBuffer( commandBuffer_ :VkCommandBuffer; flags_ :VkCommandBufferResetFlags ) :VkResult; stdcall; external DLLNAME; procedure vkCmdBindPipeline( commandBuffer_ :VkCommandBuffer; pipelineBindPoint_ :VkPipelineBindPoint; pipeline_ :VkPipeline ); stdcall; external DLLNAME; procedure vkCmdSetViewport( commandBuffer_ :VkCommandBuffer; firstViewport_ :T_uint32_t; viewportCount_ :T_uint32_t; pViewports_ :P_VkViewport ); stdcall; external DLLNAME; procedure vkCmdSetScissor( commandBuffer_ :VkCommandBuffer; firstScissor_ :T_uint32_t; scissorCount_ :T_uint32_t; pScissors_ :P_VkRect2D ); stdcall; external DLLNAME; procedure vkCmdSetLineWidth( commandBuffer_ :VkCommandBuffer; lineWidth_ :T_float ); stdcall; external DLLNAME; procedure vkCmdSetDepthBias( commandBuffer_ :VkCommandBuffer; depthBiasConstantFactor_ :T_float; depthBiasClamp_ :T_float; depthBiasSlopeFactor_ :T_float ); stdcall; external DLLNAME; procedure vkCmdSetBlendConstants( commandBuffer_ :VkCommandBuffer; const blendConstants_ :T_blendConstants ); stdcall; external DLLNAME; procedure vkCmdSetDepthBounds( commandBuffer_ :VkCommandBuffer; minDepthBounds_ :T_float; maxDepthBounds_ :T_float ); stdcall; external DLLNAME; procedure vkCmdSetStencilCompareMask( commandBuffer_ :VkCommandBuffer; faceMask_ :VkStencilFaceFlags; compareMask_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdSetStencilWriteMask( commandBuffer_ :VkCommandBuffer; faceMask_ :VkStencilFaceFlags; writeMask_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdSetStencilReference( commandBuffer_ :VkCommandBuffer; faceMask_ :VkStencilFaceFlags; reference_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdBindDescriptorSets( commandBuffer_ :VkCommandBuffer; pipelineBindPoint_ :VkPipelineBindPoint; layout_ :VkPipelineLayout; firstSet_ :T_uint32_t; descriptorSetCount_ :T_uint32_t; pDescriptorSets_ :P_VkDescriptorSet; dynamicOffsetCount_ :T_uint32_t; pDynamicOffsets_ :P_uint32_t ); stdcall; external DLLNAME; procedure vkCmdBindIndexBuffer( commandBuffer_ :VkCommandBuffer; buffer_ :VkBuffer; offset_ :VkDeviceSize; indexType_ :VkIndexType ); stdcall; external DLLNAME; procedure vkCmdBindVertexBuffers( commandBuffer_ :VkCommandBuffer; firstBinding_ :T_uint32_t; bindingCount_ :T_uint32_t; pBuffers_ :P_VkBuffer; pOffsets_ :P_VkDeviceSize ); stdcall; external DLLNAME; procedure vkCmdDraw( commandBuffer_ :VkCommandBuffer; vertexCount_ :T_uint32_t; instanceCount_ :T_uint32_t; firstVertex_ :T_uint32_t; firstInstance_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDrawIndexed( commandBuffer_ :VkCommandBuffer; indexCount_ :T_uint32_t; instanceCount_ :T_uint32_t; firstIndex_ :T_uint32_t; vertexOffset_ :T_int32_t; firstInstance_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDrawIndirect( commandBuffer_ :VkCommandBuffer; buffer_ :VkBuffer; offset_ :VkDeviceSize; drawCount_ :T_uint32_t; stride_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDrawIndexedIndirect( commandBuffer_ :VkCommandBuffer; buffer_ :VkBuffer; offset_ :VkDeviceSize; drawCount_ :T_uint32_t; stride_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDispatch( commandBuffer_ :VkCommandBuffer; groupCountX_ :T_uint32_t; groupCountY_ :T_uint32_t; groupCountZ_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDispatchIndirect( commandBuffer_ :VkCommandBuffer; buffer_ :VkBuffer; offset_ :VkDeviceSize ); stdcall; external DLLNAME; procedure vkCmdCopyBuffer( commandBuffer_ :VkCommandBuffer; srcBuffer_ :VkBuffer; dstBuffer_ :VkBuffer; regionCount_ :T_uint32_t; pRegions_ :P_VkBufferCopy ); stdcall; external DLLNAME; procedure vkCmdCopyImage( commandBuffer_ :VkCommandBuffer; srcImage_ :VkImage; srcImageLayout_ :VkImageLayout; dstImage_ :VkImage; dstImageLayout_ :VkImageLayout; regionCount_ :T_uint32_t; pRegions_ :P_VkImageCopy ); stdcall; external DLLNAME; procedure vkCmdBlitImage( commandBuffer_ :VkCommandBuffer; srcImage_ :VkImage; srcImageLayout_ :VkImageLayout; dstImage_ :VkImage; dstImageLayout_ :VkImageLayout; regionCount_ :T_uint32_t; pRegions_ :P_VkImageBlit; filter_ :VkFilter ); stdcall; external DLLNAME; procedure vkCmdCopyBufferToImage( commandBuffer_ :VkCommandBuffer; srcBuffer_ :VkBuffer; dstImage_ :VkImage; dstImageLayout_ :VkImageLayout; regionCount_ :T_uint32_t; pRegions_ :P_VkBufferImageCopy ); stdcall; external DLLNAME; procedure vkCmdCopyImageToBuffer( commandBuffer_ :VkCommandBuffer; srcImage_ :VkImage; srcImageLayout_ :VkImageLayout; dstBuffer_ :VkBuffer; regionCount_ :T_uint32_t; pRegions_ :P_VkBufferImageCopy ); stdcall; external DLLNAME; procedure vkCmdUpdateBuffer( commandBuffer_ :VkCommandBuffer; dstBuffer_ :VkBuffer; dstOffset_ :VkDeviceSize; dataSize_ :VkDeviceSize; pData_ :P_void ); stdcall; external DLLNAME; procedure vkCmdFillBuffer( commandBuffer_ :VkCommandBuffer; dstBuffer_ :VkBuffer; dstOffset_ :VkDeviceSize; size_ :VkDeviceSize; data_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdClearColorImage( commandBuffer_ :VkCommandBuffer; image_ :VkImage; imageLayout_ :VkImageLayout; pColor_ :P_VkClearColorValue; rangeCount_ :T_uint32_t; pRanges_ :P_VkImageSubresourceRange ); stdcall; external DLLNAME; procedure vkCmdClearDepthStencilImage( commandBuffer_ :VkCommandBuffer; image_ :VkImage; imageLayout_ :VkImageLayout; pDepthStencil_ :P_VkClearDepthStencilValue; rangeCount_ :T_uint32_t; pRanges_ :P_VkImageSubresourceRange ); stdcall; external DLLNAME; procedure vkCmdClearAttachments( commandBuffer_ :VkCommandBuffer; attachmentCount_ :T_uint32_t; pAttachments_ :P_VkClearAttachment; rectCount_ :T_uint32_t; pRects_ :P_VkClearRect ); stdcall; external DLLNAME; procedure vkCmdResolveImage( commandBuffer_ :VkCommandBuffer; srcImage_ :VkImage; srcImageLayout_ :VkImageLayout; dstImage_ :VkImage; dstImageLayout_ :VkImageLayout; regionCount_ :T_uint32_t; pRegions_ :P_VkImageResolve ); stdcall; external DLLNAME; procedure vkCmdSetEvent( commandBuffer_ :VkCommandBuffer; event_ :VkEvent; stageMask_ :VkPipelineStageFlags ); stdcall; external DLLNAME; procedure vkCmdResetEvent( commandBuffer_ :VkCommandBuffer; event_ :VkEvent; stageMask_ :VkPipelineStageFlags ); stdcall; external DLLNAME; procedure vkCmdWaitEvents( commandBuffer_ :VkCommandBuffer; eventCount_ :T_uint32_t; pEvents_ :P_VkEvent; srcStageMask_ :VkPipelineStageFlags; dstStageMask_ :VkPipelineStageFlags; memoryBarrierCount_ :T_uint32_t; pMemoryBarriers_ :P_VkMemoryBarrier; bufferMemoryBarrierCount_ :T_uint32_t; pBufferMemoryBarriers_ :P_VkBufferMemoryBarrier; imageMemoryBarrierCount_ :T_uint32_t; pImageMemoryBarriers_ :P_VkImageMemoryBarrier ); stdcall; external DLLNAME; procedure vkCmdPipelineBarrier( commandBuffer_ :VkCommandBuffer; srcStageMask_ :VkPipelineStageFlags; dstStageMask_ :VkPipelineStageFlags; dependencyFlags_ :VkDependencyFlags; memoryBarrierCount_ :T_uint32_t; pMemoryBarriers_ :P_VkMemoryBarrier; bufferMemoryBarrierCount_ :T_uint32_t; pBufferMemoryBarriers_ :P_VkBufferMemoryBarrier; imageMemoryBarrierCount_ :T_uint32_t; pImageMemoryBarriers_ :P_VkImageMemoryBarrier ); stdcall; external DLLNAME; procedure vkCmdBeginQuery( commandBuffer_ :VkCommandBuffer; queryPool_ :VkQueryPool; query_ :T_uint32_t; flags_ :VkQueryControlFlags ); stdcall; external DLLNAME; procedure vkCmdEndQuery( commandBuffer_ :VkCommandBuffer; queryPool_ :VkQueryPool; query_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdResetQueryPool( commandBuffer_ :VkCommandBuffer; queryPool_ :VkQueryPool; firstQuery_ :T_uint32_t; queryCount_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdWriteTimestamp( commandBuffer_ :VkCommandBuffer; pipelineStage_ :VkPipelineStageFlagBits; queryPool_ :VkQueryPool; query_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdCopyQueryPoolResults( commandBuffer_ :VkCommandBuffer; queryPool_ :VkQueryPool; firstQuery_ :T_uint32_t; queryCount_ :T_uint32_t; dstBuffer_ :VkBuffer; dstOffset_ :VkDeviceSize; stride_ :VkDeviceSize; flags_ :VkQueryResultFlags ); stdcall; external DLLNAME; procedure vkCmdPushConstants( commandBuffer_ :VkCommandBuffer; layout_ :VkPipelineLayout; stageFlags_ :VkShaderStageFlags; offset_ :T_uint32_t; size_ :T_uint32_t; pValues_ :P_void ); stdcall; external DLLNAME; procedure vkCmdBeginRenderPass( commandBuffer_ :VkCommandBuffer; pRenderPassBegin_ :P_VkRenderPassBeginInfo; contents_ :VkSubpassContents ); stdcall; external DLLNAME; procedure vkCmdNextSubpass( commandBuffer_ :VkCommandBuffer; contents_ :VkSubpassContents ); stdcall; external DLLNAME; procedure vkCmdEndRenderPass( commandBuffer_ :VkCommandBuffer ); stdcall; external DLLNAME; procedure vkCmdExecuteCommands( commandBuffer_ :VkCommandBuffer; commandBufferCount_ :T_uint32_t; pCommandBuffers_ :P_VkCommandBuffer ); stdcall; external DLLNAME; {$ENDIF} const VK_VERSION_1_1 = 1; // Vulkan 1.1 version number const VK_API_VERSION_1_1 = {VK_MAKE_VERSION( 1, 1, 0 )} ( 1 shl 22 ) or ( 1 shl 12 ) or 0; // Patch version should always be set to 0 type P_VkSamplerYcbcrConversion = ^VkSamplerYcbcrConversion; VkSamplerYcbcrConversion = VK_DEFINE_NON_DISPATCHABLE_HANDLE; type P_VkDescriptorUpdateTemplate = ^VkDescriptorUpdateTemplate; VkDescriptorUpdateTemplate = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_MAX_DEVICE_GROUP_SIZE = 32; const VK_LUID_SIZE = 8; const VK_QUEUE_FAMILY_EXTERNAL = UInt32( $FFFFFFFF )-1; {(~0U-1)} type P_VkPointClippingBehavior = ^VkPointClippingBehavior; VkPointClippingBehavior = ( VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES = 0, VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY = 1, VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR = VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES, VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY_KHR = VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY, VK_POINT_CLIPPING_BEHAVIOR_MAX_ENUM = $7FFFFFFF ); type P_VkTessellationDomainOrigin = ^VkTessellationDomainOrigin; VkTessellationDomainOrigin = ( VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT = 0, VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT = 1, VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT_KHR = VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT, VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT_KHR = VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT, VK_TESSELLATION_DOMAIN_ORIGIN_MAX_ENUM = $7FFFFFFF ); type P_VkSamplerYcbcrModelConversion = ^VkSamplerYcbcrModelConversion; VkSamplerYcbcrModelConversion = ( VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY = 0, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY = 1, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709 = 2, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601 = 3, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020 = 4, VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020, VK_SAMPLER_YCBCR_MODEL_CONVERSION_MAX_ENUM = $7FFFFFFF ); type P_VkSamplerYcbcrRange = ^VkSamplerYcbcrRange; VkSamplerYcbcrRange = ( VK_SAMPLER_YCBCR_RANGE_ITU_FULL = 0, VK_SAMPLER_YCBCR_RANGE_ITU_NARROW = 1, VK_SAMPLER_YCBCR_RANGE_ITU_FULL_KHR = VK_SAMPLER_YCBCR_RANGE_ITU_FULL, VK_SAMPLER_YCBCR_RANGE_ITU_NARROW_KHR = VK_SAMPLER_YCBCR_RANGE_ITU_NARROW, VK_SAMPLER_YCBCR_RANGE_MAX_ENUM = $7FFFFFFF ); type P_VkChromaLocation = ^VkChromaLocation; VkChromaLocation = ( VK_CHROMA_LOCATION_COSITED_EVEN = 0, VK_CHROMA_LOCATION_MIDPOINT = 1, VK_CHROMA_LOCATION_COSITED_EVEN_KHR = VK_CHROMA_LOCATION_COSITED_EVEN, VK_CHROMA_LOCATION_MIDPOINT_KHR = VK_CHROMA_LOCATION_MIDPOINT, VK_CHROMA_LOCATION_MAX_ENUM = $7FFFFFFF ); type P_VkDescriptorUpdateTemplateType = ^VkDescriptorUpdateTemplateType; VkDescriptorUpdateTemplateType = ( VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET = 0, VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR = 1, VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET, VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM = $7FFFFFFF ); type P_VkSubgroupFeatureFlagBits = ^VkSubgroupFeatureFlagBits; VkSubgroupFeatureFlagBits = ( VK_SUBGROUP_FEATURE_BASIC_BIT = $00000001, VK_SUBGROUP_FEATURE_VOTE_BIT = $00000002, VK_SUBGROUP_FEATURE_ARITHMETIC_BIT = $00000004, VK_SUBGROUP_FEATURE_BALLOT_BIT = $00000008, VK_SUBGROUP_FEATURE_SHUFFLE_BIT = $00000010, VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT = $00000020, VK_SUBGROUP_FEATURE_CLUSTERED_BIT = $00000040, VK_SUBGROUP_FEATURE_QUAD_BIT = $00000080, VK_SUBGROUP_FEATURE_PARTITIONED_BIT_NV = $00000100, VK_SUBGROUP_FEATURE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkSubgroupFeatureFlags = ^VkSubgroupFeatureFlags; VkSubgroupFeatureFlags = VkFlags; type P_VkPeerMemoryFeatureFlagBits = ^VkPeerMemoryFeatureFlagBits; VkPeerMemoryFeatureFlagBits = ( VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT = $00000001, VK_PEER_MEMORY_FEATURE_COPY_DST_BIT = $00000002, VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT = $00000004, VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT = $00000008, VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT_KHR = VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT, VK_PEER_MEMORY_FEATURE_COPY_DST_BIT_KHR = VK_PEER_MEMORY_FEATURE_COPY_DST_BIT, VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT_KHR = VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT, VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT_KHR = VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT, VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkPeerMemoryFeatureFlags = ^VkPeerMemoryFeatureFlags; VkPeerMemoryFeatureFlags = VkFlags; type P_VkMemoryAllocateFlagBits = ^VkMemoryAllocateFlagBits; VkMemoryAllocateFlagBits = ( VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT = $00000001, VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT = $00000002, VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT = $00000004, VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT_KHR = VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT, VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT, VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkMemoryAllocateFlags = ^VkMemoryAllocateFlags; VkMemoryAllocateFlags = VkFlags; type P_VkCommandPoolTrimFlags = ^VkCommandPoolTrimFlags; VkCommandPoolTrimFlags = VkFlags; type P_VkDescriptorUpdateTemplateCreateFlags = ^VkDescriptorUpdateTemplateCreateFlags; VkDescriptorUpdateTemplateCreateFlags = VkFlags; type P_VkExternalMemoryHandleTypeFlagBits = ^VkExternalMemoryHandleTypeFlagBits; VkExternalMemoryHandleTypeFlagBits = ( VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT = $00000001, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT = $00000002, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = $00000004, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT = $00000008, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT = $00000010, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT = $00000020, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT = $00000040, VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT = $00000200, VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID = $00000400, VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT = $00000080, VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT = $00000100, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkExternalMemoryHandleTypeFlags = ^VkExternalMemoryHandleTypeFlags; VkExternalMemoryHandleTypeFlags = VkFlags; type P_VkExternalMemoryFeatureFlagBits = ^VkExternalMemoryFeatureFlagBits; VkExternalMemoryFeatureFlagBits = ( VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT = $00000001, VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT = $00000002, VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT = $00000004, VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR = VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT, VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR = VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT, VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT, VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkExternalMemoryFeatureFlags = ^VkExternalMemoryFeatureFlags; VkExternalMemoryFeatureFlags = VkFlags; type P_VkExternalFenceHandleTypeFlagBits = ^VkExternalFenceHandleTypeFlagBits; VkExternalFenceHandleTypeFlagBits = ( VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT = $00000001, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT = $00000002, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = $00000004, VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT = $00000008, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR = VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT, VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkExternalFenceHandleTypeFlags = ^VkExternalFenceHandleTypeFlags; VkExternalFenceHandleTypeFlags = VkFlags; type P_VkExternalFenceFeatureFlagBits = ^VkExternalFenceFeatureFlagBits; VkExternalFenceFeatureFlagBits = ( VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT = $00000001, VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT = $00000002, VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR = VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT, VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT_KHR = VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT, VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkExternalFenceFeatureFlags = ^VkExternalFenceFeatureFlags; VkExternalFenceFeatureFlags = VkFlags; type P_VkFenceImportFlagBits = ^VkFenceImportFlagBits; VkFenceImportFlagBits = ( VK_FENCE_IMPORT_TEMPORARY_BIT = $00000001, VK_FENCE_IMPORT_TEMPORARY_BIT_KHR = VK_FENCE_IMPORT_TEMPORARY_BIT, VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkFenceImportFlags = ^VkFenceImportFlags; VkFenceImportFlags = VkFlags; type P_VkSemaphoreImportFlagBits = ^VkSemaphoreImportFlagBits; VkSemaphoreImportFlagBits = ( VK_SEMAPHORE_IMPORT_TEMPORARY_BIT = $00000001, VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR = VK_SEMAPHORE_IMPORT_TEMPORARY_BIT, VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkSemaphoreImportFlags = ^VkSemaphoreImportFlags; VkSemaphoreImportFlags = VkFlags; type P_VkExternalSemaphoreHandleTypeFlagBits = ^VkExternalSemaphoreHandleTypeFlagBits; VkExternalSemaphoreHandleTypeFlagBits = ( VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT = $00000001, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT = $00000002, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = $00000004, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT = $00000008, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT = $00000010, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE_BIT = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkExternalSemaphoreHandleTypeFlags = ^VkExternalSemaphoreHandleTypeFlags; VkExternalSemaphoreHandleTypeFlags = VkFlags; type P_VkExternalSemaphoreFeatureFlagBits = ^VkExternalSemaphoreFeatureFlagBits; VkExternalSemaphoreFeatureFlagBits = ( VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT = $00000001, VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT = $00000002, VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR = VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT, VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR = VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT, VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkExternalSemaphoreFeatureFlags = ^VkExternalSemaphoreFeatureFlags; VkExternalSemaphoreFeatureFlags = VkFlags; type P_VkPhysicalDeviceSubgroupProperties = ^VkPhysicalDeviceSubgroupProperties; VkPhysicalDeviceSubgroupProperties = record sType :VkStructureType; pNext :P_void; subgroupSize :T_uint32_t; supportedStages :VkShaderStageFlags; supportedOperations :VkSubgroupFeatureFlags; quadOperationsInAllStages :VkBool32; end; type P_VkBindBufferMemoryInfo = ^VkBindBufferMemoryInfo; VkBindBufferMemoryInfo = record sType :VkStructureType; pNext :P_void; buffer :VkBuffer; memory :VkDeviceMemory; memoryOffset :VkDeviceSize; end; type P_VkBindImageMemoryInfo = ^VkBindImageMemoryInfo; VkBindImageMemoryInfo = record sType :VkStructureType; pNext :P_void; image :VkImage; memory :VkDeviceMemory; memoryOffset :VkDeviceSize; end; type P_VkPhysicalDevice16BitStorageFeatures = ^VkPhysicalDevice16BitStorageFeatures; VkPhysicalDevice16BitStorageFeatures = record sType :VkStructureType; pNext :P_void; storageBuffer16BitAccess :VkBool32; uniformAndStorageBuffer16BitAccess :VkBool32; storagePushConstant16 :VkBool32; storageInputOutput16 :VkBool32; end; type P_VkMemoryDedicatedRequirements = ^VkMemoryDedicatedRequirements; VkMemoryDedicatedRequirements = record sType :VkStructureType; pNext :P_void; prefersDedicatedAllocation :VkBool32; requiresDedicatedAllocation :VkBool32; end; type P_VkMemoryDedicatedAllocateInfo = ^VkMemoryDedicatedAllocateInfo; VkMemoryDedicatedAllocateInfo = record sType :VkStructureType; pNext :P_void; image :VkImage; buffer :VkBuffer; end; type P_VkMemoryAllocateFlagsInfo = ^VkMemoryAllocateFlagsInfo; VkMemoryAllocateFlagsInfo = record sType :VkStructureType; pNext :P_void; flags :VkMemoryAllocateFlags; deviceMask :T_uint32_t; end; type P_VkDeviceGroupRenderPassBeginInfo = ^VkDeviceGroupRenderPassBeginInfo; VkDeviceGroupRenderPassBeginInfo = record sType :VkStructureType; pNext :P_void; deviceMask :T_uint32_t; deviceRenderAreaCount :T_uint32_t; pDeviceRenderAreas :P_VkRect2D; end; type P_VkDeviceGroupCommandBufferBeginInfo = ^VkDeviceGroupCommandBufferBeginInfo; VkDeviceGroupCommandBufferBeginInfo = record sType :VkStructureType; pNext :P_void; deviceMask :T_uint32_t; end; type P_VkDeviceGroupSubmitInfo = ^VkDeviceGroupSubmitInfo; VkDeviceGroupSubmitInfo = record sType :VkStructureType; pNext :P_void; waitSemaphoreCount :T_uint32_t; pWaitSemaphoreDeviceIndices :P_uint32_t; commandBufferCount :T_uint32_t; pCommandBufferDeviceMasks :P_uint32_t; signalSemaphoreCount :T_uint32_t; pSignalSemaphoreDeviceIndices :P_uint32_t; end; type P_VkDeviceGroupBindSparseInfo = ^VkDeviceGroupBindSparseInfo; VkDeviceGroupBindSparseInfo = record sType :VkStructureType; pNext :P_void; resourceDeviceIndex :T_uint32_t; memoryDeviceIndex :T_uint32_t; end; type P_VkBindBufferMemoryDeviceGroupInfo = ^VkBindBufferMemoryDeviceGroupInfo; VkBindBufferMemoryDeviceGroupInfo = record sType :VkStructureType; pNext :P_void; deviceIndexCount :T_uint32_t; pDeviceIndices :P_uint32_t; end; type P_VkBindImageMemoryDeviceGroupInfo = ^VkBindImageMemoryDeviceGroupInfo; VkBindImageMemoryDeviceGroupInfo = record sType :VkStructureType; pNext :P_void; deviceIndexCount :T_uint32_t; pDeviceIndices :P_uint32_t; splitInstanceBindRegionCount :T_uint32_t; pSplitInstanceBindRegions :P_VkRect2D; end; type P_VkPhysicalDeviceGroupProperties = ^VkPhysicalDeviceGroupProperties; VkPhysicalDeviceGroupProperties = record sType :VkStructureType; pNext :P_void; physicalDeviceCount :T_uint32_t; physicalDevices :array [ 0..VK_MAX_DEVICE_GROUP_SIZE-1 ] of VkPhysicalDevice; subsetAllocation :VkBool32; end; type P_VkDeviceGroupDeviceCreateInfo = ^VkDeviceGroupDeviceCreateInfo; VkDeviceGroupDeviceCreateInfo = record sType :VkStructureType; pNext :P_void; physicalDeviceCount :T_uint32_t; pPhysicalDevices :P_VkPhysicalDevice; end; type P_VkBufferMemoryRequirementsInfo2 = ^VkBufferMemoryRequirementsInfo2; VkBufferMemoryRequirementsInfo2 = record sType :VkStructureType; pNext :P_void; buffer :VkBuffer; end; type P_VkImageMemoryRequirementsInfo2 = ^VkImageMemoryRequirementsInfo2; VkImageMemoryRequirementsInfo2 = record sType :VkStructureType; pNext :P_void; image :VkImage; end; type P_VkImageSparseMemoryRequirementsInfo2 = ^VkImageSparseMemoryRequirementsInfo2; VkImageSparseMemoryRequirementsInfo2 = record sType :VkStructureType; pNext :P_void; image :VkImage; end; type P_VkMemoryRequirements2 = ^VkMemoryRequirements2; VkMemoryRequirements2 = record sType :VkStructureType; pNext :P_void; memoryRequirements :VkMemoryRequirements; end; type P_VkSparseImageMemoryRequirements2 = ^VkSparseImageMemoryRequirements2; VkSparseImageMemoryRequirements2 = record sType :VkStructureType; pNext :P_void; memoryRequirements :VkSparseImageMemoryRequirements; end; type P_VkPhysicalDeviceFeatures2 = ^VkPhysicalDeviceFeatures2; VkPhysicalDeviceFeatures2 = record sType :VkStructureType; pNext :P_void; features :VkPhysicalDeviceFeatures; end; type P_VkPhysicalDeviceProperties2 = ^VkPhysicalDeviceProperties2; VkPhysicalDeviceProperties2 = record sType :VkStructureType; pNext :P_void; properties :VkPhysicalDeviceProperties; end; type P_VkFormatProperties2 = ^VkFormatProperties2; VkFormatProperties2 = record sType :VkStructureType; pNext :P_void; formatProperties :VkFormatProperties; end; type P_VkImageFormatProperties2 = ^VkImageFormatProperties2; VkImageFormatProperties2 = record sType :VkStructureType; pNext :P_void; imageFormatProperties :VkImageFormatProperties; end; type P_VkPhysicalDeviceImageFormatInfo2 = ^VkPhysicalDeviceImageFormatInfo2; VkPhysicalDeviceImageFormatInfo2 = record sType :VkStructureType; pNext :P_void; format :VkFormat; type_ :VkImageType; tiling :VkImageTiling; usage :VkImageUsageFlags; flags :VkImageCreateFlags; end; type P_VkQueueFamilyProperties2 = ^VkQueueFamilyProperties2; VkQueueFamilyProperties2 = record sType :VkStructureType; pNext :P_void; queueFamilyProperties :VkQueueFamilyProperties; end; type P_VkPhysicalDeviceMemoryProperties2 = ^VkPhysicalDeviceMemoryProperties2; VkPhysicalDeviceMemoryProperties2 = record sType :VkStructureType; pNext :P_void; memoryProperties :VkPhysicalDeviceMemoryProperties; end; type P_VkSparseImageFormatProperties2 = ^VkSparseImageFormatProperties2; VkSparseImageFormatProperties2 = record sType :VkStructureType; pNext :P_void; properties :VkSparseImageFormatProperties; end; type P_VkPhysicalDeviceSparseImageFormatInfo2 = ^VkPhysicalDeviceSparseImageFormatInfo2; VkPhysicalDeviceSparseImageFormatInfo2 = record sType :VkStructureType; pNext :P_void; format :VkFormat; type_ :VkImageType; samples :VkSampleCountFlagBits; usage :VkImageUsageFlags; tiling :VkImageTiling; end; type P_VkPhysicalDevicePointClippingProperties = ^VkPhysicalDevicePointClippingProperties; VkPhysicalDevicePointClippingProperties = record sType :VkStructureType; pNext :P_void; pointClippingBehavior :VkPointClippingBehavior; end; type P_VkInputAttachmentAspectReference = ^VkInputAttachmentAspectReference; VkInputAttachmentAspectReference = record subpass :T_uint32_t; inputAttachmentIndex :T_uint32_t; aspectMask :VkImageAspectFlags; end; type P_VkRenderPassInputAttachmentAspectCreateInfo = ^VkRenderPassInputAttachmentAspectCreateInfo; VkRenderPassInputAttachmentAspectCreateInfo = record sType :VkStructureType; pNext :P_void; aspectReferenceCount :T_uint32_t; pAspectReferences :P_VkInputAttachmentAspectReference; end; type P_VkImageViewUsageCreateInfo = ^VkImageViewUsageCreateInfo; VkImageViewUsageCreateInfo = record sType :VkStructureType; pNext :P_void; usage :VkImageUsageFlags; end; type P_VkPipelineTessellationDomainOriginStateCreateInfo = ^VkPipelineTessellationDomainOriginStateCreateInfo; VkPipelineTessellationDomainOriginStateCreateInfo = record sType :VkStructureType; pNext :P_void; domainOrigin :VkTessellationDomainOrigin; end; type P_VkRenderPassMultiviewCreateInfo = ^VkRenderPassMultiviewCreateInfo; VkRenderPassMultiviewCreateInfo = record sType :VkStructureType; pNext :P_void; subpassCount :T_uint32_t; pViewMasks :P_uint32_t; dependencyCount :T_uint32_t; pViewOffsets :P_int32_t; correlationMaskCount :T_uint32_t; pCorrelationMasks :P_uint32_t; end; type P_VkPhysicalDeviceMultiviewFeatures = ^VkPhysicalDeviceMultiviewFeatures; VkPhysicalDeviceMultiviewFeatures = record sType :VkStructureType; pNext :P_void; multiview :VkBool32; multiviewGeometryShader :VkBool32; multiviewTessellationShader :VkBool32; end; type P_VkPhysicalDeviceMultiviewProperties = ^VkPhysicalDeviceMultiviewProperties; VkPhysicalDeviceMultiviewProperties = record sType :VkStructureType; pNext :P_void; maxMultiviewViewCount :T_uint32_t; maxMultiviewInstanceIndex :T_uint32_t; end; type P_VkPhysicalDeviceVariablePointersFeatures = ^VkPhysicalDeviceVariablePointersFeatures; VkPhysicalDeviceVariablePointersFeatures = record sType :VkStructureType; pNext :P_void; variablePointersStorageBuffer :VkBool32; variablePointers :VkBool32; end; type P_VkPhysicalDeviceVariablePointerFeatures = ^VkPhysicalDeviceVariablePointerFeatures; VkPhysicalDeviceVariablePointerFeatures = VkPhysicalDeviceVariablePointersFeatures; type P_VkPhysicalDeviceProtectedMemoryFeatures = ^VkPhysicalDeviceProtectedMemoryFeatures; VkPhysicalDeviceProtectedMemoryFeatures = record sType :VkStructureType; pNext :P_void; protectedMemory :VkBool32; end; type P_VkPhysicalDeviceProtectedMemoryProperties = ^VkPhysicalDeviceProtectedMemoryProperties; VkPhysicalDeviceProtectedMemoryProperties = record sType :VkStructureType; pNext :P_void; protectedNoFault :VkBool32; end; type P_VkDeviceQueueInfo2 = ^VkDeviceQueueInfo2; VkDeviceQueueInfo2 = record sType :VkStructureType; pNext :P_void; flags :VkDeviceQueueCreateFlags; queueFamilyIndex :T_uint32_t; queueIndex :T_uint32_t; end; type P_VkProtectedSubmitInfo = ^VkProtectedSubmitInfo; VkProtectedSubmitInfo = record sType :VkStructureType; pNext :P_void; protectedSubmit :VkBool32; end; type P_VkSamplerYcbcrConversionCreateInfo = ^VkSamplerYcbcrConversionCreateInfo; VkSamplerYcbcrConversionCreateInfo = record sType :VkStructureType; pNext :P_void; format :VkFormat; ycbcrModel :VkSamplerYcbcrModelConversion; ycbcrRange :VkSamplerYcbcrRange; components :VkComponentMapping; xChromaOffset :VkChromaLocation; yChromaOffset :VkChromaLocation; chromaFilter :VkFilter; forceExplicitReconstruction :VkBool32; end; type P_VkSamplerYcbcrConversionInfo = ^VkSamplerYcbcrConversionInfo; VkSamplerYcbcrConversionInfo = record sType :VkStructureType; pNext :P_void; conversion :VkSamplerYcbcrConversion; end; type P_VkBindImagePlaneMemoryInfo = ^VkBindImagePlaneMemoryInfo; VkBindImagePlaneMemoryInfo = record sType :VkStructureType; pNext :P_void; planeAspect :VkImageAspectFlagBits; end; type P_VkImagePlaneMemoryRequirementsInfo = ^VkImagePlaneMemoryRequirementsInfo; VkImagePlaneMemoryRequirementsInfo = record sType :VkStructureType; pNext :P_void; planeAspect :VkImageAspectFlagBits; end; type P_VkPhysicalDeviceSamplerYcbcrConversionFeatures = ^VkPhysicalDeviceSamplerYcbcrConversionFeatures; VkPhysicalDeviceSamplerYcbcrConversionFeatures = record sType :VkStructureType; pNext :P_void; samplerYcbcrConversion :VkBool32; end; type P_VkSamplerYcbcrConversionImageFormatProperties = ^VkSamplerYcbcrConversionImageFormatProperties; VkSamplerYcbcrConversionImageFormatProperties = record sType :VkStructureType; pNext :P_void; combinedImageSamplerDescriptorCount :T_uint32_t; end; type P_VkDescriptorUpdateTemplateEntry = ^VkDescriptorUpdateTemplateEntry; VkDescriptorUpdateTemplateEntry = record dstBinding :T_uint32_t; dstArrayElement :T_uint32_t; descriptorCount :T_uint32_t; descriptorType :VkDescriptorType; offset :T_size_t; stride :T_size_t; end; type P_VkDescriptorUpdateTemplateCreateInfo = ^VkDescriptorUpdateTemplateCreateInfo; VkDescriptorUpdateTemplateCreateInfo = record sType :VkStructureType; pNext :P_void; flags :VkDescriptorUpdateTemplateCreateFlags; descriptorUpdateEntryCount :T_uint32_t; pDescriptorUpdateEntries :P_VkDescriptorUpdateTemplateEntry; templateType :VkDescriptorUpdateTemplateType; descriptorSetLayout :VkDescriptorSetLayout; pipelineBindPoint :VkPipelineBindPoint; pipelineLayout :VkPipelineLayout; set_ :T_uint32_t; end; type P_VkExternalMemoryProperties = ^VkExternalMemoryProperties; VkExternalMemoryProperties = record externalMemoryFeatures :VkExternalMemoryFeatureFlags; exportFromImportedHandleTypes :VkExternalMemoryHandleTypeFlags; compatibleHandleTypes :VkExternalMemoryHandleTypeFlags; end; type P_VkPhysicalDeviceExternalImageFormatInfo = ^VkPhysicalDeviceExternalImageFormatInfo; VkPhysicalDeviceExternalImageFormatInfo = record sType :VkStructureType; pNext :P_void; handleType :VkExternalMemoryHandleTypeFlagBits; end; type P_VkExternalImageFormatProperties = ^VkExternalImageFormatProperties; VkExternalImageFormatProperties = record sType :VkStructureType; pNext :P_void; externalMemoryProperties :VkExternalMemoryProperties; end; type P_VkPhysicalDeviceExternalBufferInfo = ^VkPhysicalDeviceExternalBufferInfo; VkPhysicalDeviceExternalBufferInfo = record sType :VkStructureType; pNext :P_void; flags :VkBufferCreateFlags; usage :VkBufferUsageFlags; handleType :VkExternalMemoryHandleTypeFlagBits; end; type P_VkExternalBufferProperties = ^VkExternalBufferProperties; VkExternalBufferProperties = record sType :VkStructureType; pNext :P_void; externalMemoryProperties :VkExternalMemoryProperties; end; type P_VkPhysicalDeviceIDProperties = ^VkPhysicalDeviceIDProperties; VkPhysicalDeviceIDProperties = record sType :VkStructureType; pNext :P_void; deviceUUID :array [ 0..VK_UUID_SIZE-1 ] of T_uint8_t; driverUUID :array [ 0..VK_UUID_SIZE-1 ] of T_uint8_t; deviceLUID :array [ 0..VK_LUID_SIZE-1 ] of T_uint8_t; deviceNodeMask :T_uint32_t; deviceLUIDValid :VkBool32; end; type P_VkExternalMemoryImageCreateInfo = ^VkExternalMemoryImageCreateInfo; VkExternalMemoryImageCreateInfo = record sType :VkStructureType; pNext :P_void; handleTypes :VkExternalMemoryHandleTypeFlags; end; type P_VkExternalMemoryBufferCreateInfo = ^VkExternalMemoryBufferCreateInfo; VkExternalMemoryBufferCreateInfo = record sType :VkStructureType; pNext :P_void; handleTypes :VkExternalMemoryHandleTypeFlags; end; type P_VkExportMemoryAllocateInfo = ^VkExportMemoryAllocateInfo; VkExportMemoryAllocateInfo = record sType :VkStructureType; pNext :P_void; handleTypes :VkExternalMemoryHandleTypeFlags; end; type P_VkPhysicalDeviceExternalFenceInfo = ^VkPhysicalDeviceExternalFenceInfo; VkPhysicalDeviceExternalFenceInfo = record sType :VkStructureType; pNext :P_void; handleType :VkExternalFenceHandleTypeFlagBits; end; type P_VkExternalFenceProperties = ^VkExternalFenceProperties; VkExternalFenceProperties = record sType :VkStructureType; pNext :P_void; exportFromImportedHandleTypes :VkExternalFenceHandleTypeFlags; compatibleHandleTypes :VkExternalFenceHandleTypeFlags; externalFenceFeatures :VkExternalFenceFeatureFlags; end; type P_VkExportFenceCreateInfo = ^VkExportFenceCreateInfo; VkExportFenceCreateInfo = record sType :VkStructureType; pNext :P_void; handleTypes :VkExternalFenceHandleTypeFlags; end; type P_VkExportSemaphoreCreateInfo = ^VkExportSemaphoreCreateInfo; VkExportSemaphoreCreateInfo = record sType :VkStructureType; pNext :P_void; handleTypes :VkExternalSemaphoreHandleTypeFlags; end; type P_VkPhysicalDeviceExternalSemaphoreInfo = ^VkPhysicalDeviceExternalSemaphoreInfo; VkPhysicalDeviceExternalSemaphoreInfo = record sType :VkStructureType; pNext :P_void; handleType :VkExternalSemaphoreHandleTypeFlagBits; end; type P_VkExternalSemaphoreProperties = ^VkExternalSemaphoreProperties; VkExternalSemaphoreProperties = record sType :VkStructureType; pNext :P_void; exportFromImportedHandleTypes :VkExternalSemaphoreHandleTypeFlags; compatibleHandleTypes :VkExternalSemaphoreHandleTypeFlags; externalSemaphoreFeatures :VkExternalSemaphoreFeatureFlags; end; type P_VkPhysicalDeviceMaintenance3Properties = ^VkPhysicalDeviceMaintenance3Properties; VkPhysicalDeviceMaintenance3Properties = record sType :VkStructureType; pNext :P_void; maxPerSetDescriptors :T_uint32_t; maxMemoryAllocationSize :VkDeviceSize; end; type P_VkDescriptorSetLayoutSupport = ^VkDescriptorSetLayoutSupport; VkDescriptorSetLayoutSupport = record sType :VkStructureType; pNext :P_void; supported :VkBool32; end; type P_VkPhysicalDeviceShaderDrawParametersFeatures = ^VkPhysicalDeviceShaderDrawParametersFeatures; VkPhysicalDeviceShaderDrawParametersFeatures = record sType :VkStructureType; pNext :P_void; shaderDrawParameters :VkBool32; end; type P_VkPhysicalDeviceShaderDrawParameterFeatures = ^VkPhysicalDeviceShaderDrawParameterFeatures; VkPhysicalDeviceShaderDrawParameterFeatures = VkPhysicalDeviceShaderDrawParametersFeatures; type PFN_vkEnumerateInstanceVersion = function( pApiVersion_:P_uint32_t ) :VkResult; type PFN_vkBindBufferMemory2 = function( device_:VkDevice; bindInfoCount_:T_uint32_t; const pBindInfos_:P_VkBindBufferMemoryInfo ) :VkResult; type PFN_vkBindImageMemory2 = function( device_:VkDevice; bindInfoCount_:T_uint32_t; const pBindInfos_:P_VkBindImageMemoryInfo ) :VkResult; type PFN_vkGetDeviceGroupPeerMemoryFeatures = procedure( device_:VkDevice; heapIndex_:T_uint32_t; localDeviceIndex_:T_uint32_t; remoteDeviceIndex_:T_uint32_t; pPeerMemoryFeatures_:P_VkPeerMemoryFeatureFlags ); type PFN_vkCmdSetDeviceMask = procedure( commandBuffer_:VkCommandBuffer; deviceMask_:T_uint32_t ); type PFN_vkCmdDispatchBase = procedure( commandBuffer_:VkCommandBuffer; baseGroupX_:T_uint32_t; baseGroupY_:T_uint32_t; baseGroupZ_:T_uint32_t; groupCountX_:T_uint32_t; groupCountY_:T_uint32_t; groupCountZ_:T_uint32_t ); type PFN_vkEnumeratePhysicalDeviceGroups = function( instance_:VkInstance; pPhysicalDeviceGroupCount_:P_uint32_t; pPhysicalDeviceGroupProperties_:P_VkPhysicalDeviceGroupProperties ) :VkResult; type PFN_vkGetImageMemoryRequirements2 = procedure( device_:VkDevice; const pInfo_:P_VkImageMemoryRequirementsInfo2; pMemoryRequirements_:P_VkMemoryRequirements2 ); type PFN_vkGetBufferMemoryRequirements2 = procedure( device_:VkDevice; const pInfo_:P_VkBufferMemoryRequirementsInfo2; pMemoryRequirements_:P_VkMemoryRequirements2 ); type PFN_vkGetImageSparseMemoryRequirements2 = procedure( device_:VkDevice; const pInfo_:P_VkImageSparseMemoryRequirementsInfo2; pSparseMemoryRequirementCount_:P_uint32_t; pSparseMemoryRequirements_:P_VkSparseImageMemoryRequirements2 ); type PFN_vkGetPhysicalDeviceFeatures2 = procedure( physicalDevice_:VkPhysicalDevice; pFeatures_:P_VkPhysicalDeviceFeatures2 ); type PFN_vkGetPhysicalDeviceProperties2 = procedure( physicalDevice_:VkPhysicalDevice; pProperties_:P_VkPhysicalDeviceProperties2 ); type PFN_vkGetPhysicalDeviceFormatProperties2 = procedure( physicalDevice_:VkPhysicalDevice; format_:VkFormat; pFormatProperties_:P_VkFormatProperties2 ); type PFN_vkGetPhysicalDeviceImageFormatProperties2 = function( physicalDevice_:VkPhysicalDevice; const pImageFormatInfo_:P_VkPhysicalDeviceImageFormatInfo2; pImageFormatProperties_:P_VkImageFormatProperties2 ) :VkResult; type PFN_vkGetPhysicalDeviceQueueFamilyProperties2 = procedure( physicalDevice_:VkPhysicalDevice; pQueueFamilyPropertyCount_:P_uint32_t; pQueueFamilyProperties_:P_VkQueueFamilyProperties2 ); type PFN_vkGetPhysicalDeviceMemoryProperties2 = procedure( physicalDevice_:VkPhysicalDevice; pMemoryProperties_:P_VkPhysicalDeviceMemoryProperties2 ); type PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 = procedure( physicalDevice_:VkPhysicalDevice; const pFormatInfo_:P_VkPhysicalDeviceSparseImageFormatInfo2; pPropertyCount_:P_uint32_t; pProperties_:P_VkSparseImageFormatProperties2 ); type PFN_vkTrimCommandPool = procedure( device_:VkDevice; commandPool_:VkCommandPool; flags_:VkCommandPoolTrimFlags ); type PFN_vkGetDeviceQueue2 = procedure( device_:VkDevice; const pQueueInfo_:P_VkDeviceQueueInfo2; pQueue_:P_VkQueue ); type PFN_vkCreateSamplerYcbcrConversion = function( device_:VkDevice; const pCreateInfo_:P_VkSamplerYcbcrConversionCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pYcbcrConversion_:P_VkSamplerYcbcrConversion ) :VkResult; type PFN_vkDestroySamplerYcbcrConversion = procedure( device_:VkDevice; ycbcrConversion_:VkSamplerYcbcrConversion; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkCreateDescriptorUpdateTemplate = function( device_:VkDevice; const pCreateInfo_:P_VkDescriptorUpdateTemplateCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pDescriptorUpdateTemplate_:P_VkDescriptorUpdateTemplate ) :VkResult; type PFN_vkDestroyDescriptorUpdateTemplate = procedure( device_:VkDevice; descriptorUpdateTemplate_:VkDescriptorUpdateTemplate; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkUpdateDescriptorSetWithTemplate = procedure( device_:VkDevice; descriptorSet_:VkDescriptorSet; descriptorUpdateTemplate_:VkDescriptorUpdateTemplate; const pData_:P_void ); type PFN_vkGetPhysicalDeviceExternalBufferProperties = procedure( physicalDevice_:VkPhysicalDevice; const pExternalBufferInfo_:P_VkPhysicalDeviceExternalBufferInfo; pExternalBufferProperties_:P_VkExternalBufferProperties ); type PFN_vkGetPhysicalDeviceExternalFenceProperties = procedure( physicalDevice_:VkPhysicalDevice; const pExternalFenceInfo_:P_VkPhysicalDeviceExternalFenceInfo; pExternalFenceProperties_:P_VkExternalFenceProperties ); type PFN_vkGetPhysicalDeviceExternalSemaphoreProperties = procedure( physicalDevice_:VkPhysicalDevice; const pExternalSemaphoreInfo_:P_VkPhysicalDeviceExternalSemaphoreInfo; pExternalSemaphoreProperties_:P_VkExternalSemaphoreProperties ); type PFN_vkGetDescriptorSetLayoutSupport = procedure( device_:VkDevice; const pCreateInfo_:P_VkDescriptorSetLayoutCreateInfo; pSupport_:P_VkDescriptorSetLayoutSupport ); {$IFNDEF VK_NO_PROTOTYPES } function vkEnumerateInstanceVersion( pApiVersion_ :P_uint32_t ) :VkResult; stdcall; external DLLNAME; function vkBindBufferMemory2( device_ :VkDevice; bindInfoCount_ :T_uint32_t; pBindInfos_ :P_VkBindBufferMemoryInfo ) :VkResult; stdcall; external DLLNAME; function vkBindImageMemory2( device_ :VkDevice; bindInfoCount_ :T_uint32_t; pBindInfos_ :P_VkBindImageMemoryInfo ) :VkResult; stdcall; external DLLNAME; procedure vkGetDeviceGroupPeerMemoryFeatures( device_ :VkDevice; heapIndex_ :T_uint32_t; localDeviceIndex_ :T_uint32_t; remoteDeviceIndex_ :T_uint32_t; pPeerMemoryFeatures_ :P_VkPeerMemoryFeatureFlags ); stdcall; external DLLNAME; procedure vkCmdSetDeviceMask( commandBuffer_ :VkCommandBuffer; deviceMask_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDispatchBase( commandBuffer_ :VkCommandBuffer; baseGroupX_ :T_uint32_t; baseGroupY_ :T_uint32_t; baseGroupZ_ :T_uint32_t; groupCountX_ :T_uint32_t; groupCountY_ :T_uint32_t; groupCountZ_ :T_uint32_t ); stdcall; external DLLNAME; function vkEnumeratePhysicalDeviceGroups( instance_ :VkInstance; pPhysicalDeviceGroupCount_ :P_uint32_t; pPhysicalDeviceGroupProperties_ :P_VkPhysicalDeviceGroupProperties ) :VkResult; stdcall; external DLLNAME; procedure vkGetImageMemoryRequirements2( device_ :VkDevice; pInfo_ :P_VkImageMemoryRequirementsInfo2; pMemoryRequirements_ :P_VkMemoryRequirements2 ); stdcall; external DLLNAME; procedure vkGetBufferMemoryRequirements2( device_ :VkDevice; pInfo_ :P_VkBufferMemoryRequirementsInfo2; pMemoryRequirements_ :P_VkMemoryRequirements2 ); stdcall; external DLLNAME; procedure vkGetImageSparseMemoryRequirements2( device_ :VkDevice; pInfo_ :P_VkImageSparseMemoryRequirementsInfo2; pSparseMemoryRequirementCount_ :P_uint32_t; pSparseMemoryRequirements_ :P_VkSparseImageMemoryRequirements2 ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceFeatures2( physicalDevice_ :VkPhysicalDevice; pFeatures_ :P_VkPhysicalDeviceFeatures2 ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceProperties2( physicalDevice_ :VkPhysicalDevice; pProperties_ :P_VkPhysicalDeviceProperties2 ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceFormatProperties2( physicalDevice_ :VkPhysicalDevice; format_ :VkFormat; pFormatProperties_ :P_VkFormatProperties2 ); stdcall; external DLLNAME; function vkGetPhysicalDeviceImageFormatProperties2( physicalDevice_ :VkPhysicalDevice; pImageFormatInfo_ :P_VkPhysicalDeviceImageFormatInfo2; pImageFormatProperties_ :P_VkImageFormatProperties2 ) :VkResult; stdcall; external DLLNAME; procedure vkGetPhysicalDeviceQueueFamilyProperties2( physicalDevice_ :VkPhysicalDevice; pQueueFamilyPropertyCount_ :P_uint32_t; pQueueFamilyProperties_ :P_VkQueueFamilyProperties2 ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceMemoryProperties2( physicalDevice_ :VkPhysicalDevice; pMemoryProperties_ :P_VkPhysicalDeviceMemoryProperties2 ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceSparseImageFormatProperties2( physicalDevice_ :VkPhysicalDevice; pFormatInfo_ :P_VkPhysicalDeviceSparseImageFormatInfo2; pPropertyCount_ :P_uint32_t; pProperties_ :P_VkSparseImageFormatProperties2 ); stdcall; external DLLNAME; procedure vkTrimCommandPool( device_ :VkDevice; commandPool_ :VkCommandPool; flags_ :VkCommandPoolTrimFlags ); stdcall; external DLLNAME; procedure vkGetDeviceQueue2( device_ :VkDevice; pQueueInfo_ :P_VkDeviceQueueInfo2; pQueue_ :P_VkQueue ); stdcall; external DLLNAME; function vkCreateSamplerYcbcrConversion( device_ :VkDevice; pCreateInfo_ :P_VkSamplerYcbcrConversionCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pYcbcrConversion_ :P_VkSamplerYcbcrConversion ) :VkResult; stdcall; external DLLNAME; procedure vkDestroySamplerYcbcrConversion( device_ :VkDevice; ycbcrConversion_ :VkSamplerYcbcrConversion; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkCreateDescriptorUpdateTemplate( device_ :VkDevice; pCreateInfo_ :P_VkDescriptorUpdateTemplateCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pDescriptorUpdateTemplate_ :P_VkDescriptorUpdateTemplate ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyDescriptorUpdateTemplate( device_ :VkDevice; descriptorUpdateTemplate_ :VkDescriptorUpdateTemplate; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; procedure vkUpdateDescriptorSetWithTemplate( device_ :VkDevice; descriptorSet_ :VkDescriptorSet; descriptorUpdateTemplate_ :VkDescriptorUpdateTemplate; pData_ :P_void ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceExternalBufferProperties( physicalDevice_ :VkPhysicalDevice; pExternalBufferInfo_ :P_VkPhysicalDeviceExternalBufferInfo; pExternalBufferProperties_ :P_VkExternalBufferProperties ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceExternalFenceProperties( physicalDevice_ :VkPhysicalDevice; pExternalFenceInfo_ :P_VkPhysicalDeviceExternalFenceInfo; pExternalFenceProperties_ :P_VkExternalFenceProperties ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceExternalSemaphoreProperties( physicalDevice_ :VkPhysicalDevice; pExternalSemaphoreInfo_ :P_VkPhysicalDeviceExternalSemaphoreInfo; pExternalSemaphoreProperties_ :P_VkExternalSemaphoreProperties ); stdcall; external DLLNAME; procedure vkGetDescriptorSetLayoutSupport( device_ :VkDevice; pCreateInfo_ :P_VkDescriptorSetLayoutCreateInfo; pSupport_ :P_VkDescriptorSetLayoutSupport ); stdcall; external DLLNAME; {$ENDIF} const VK_VERSION_1_2 = 1; // Vulkan 1.2 version number const VK_API_VERSION_1_2 = {VK_MAKE_VERSION( 1, 2, 0 )} ( 1 shl 22 ) or ( 2 shl 12 ) or 0; // Patch version should always be set to 0 const VK_MAX_DRIVER_NAME_SIZE = 256; const VK_MAX_DRIVER_INFO_SIZE = 256; type P_VkDriverId = ^VkDriverId; VkDriverId = ( VK_DRIVER_ID_AMD_PROPRIETARY = 1, VK_DRIVER_ID_AMD_OPEN_SOURCE = 2, VK_DRIVER_ID_MESA_RADV = 3, VK_DRIVER_ID_NVIDIA_PROPRIETARY = 4, VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS = 5, VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA = 6, VK_DRIVER_ID_IMAGINATION_PROPRIETARY = 7, VK_DRIVER_ID_QUALCOMM_PROPRIETARY = 8, VK_DRIVER_ID_ARM_PROPRIETARY = 9, VK_DRIVER_ID_GOOGLE_SWIFTSHADER = 10, VK_DRIVER_ID_GGP_PROPRIETARY = 11, VK_DRIVER_ID_BROADCOM_PROPRIETARY = 12, VK_DRIVER_ID_MESA_LLVMPIPE = 13, VK_DRIVER_ID_MOLTENVK = 14, VK_DRIVER_ID_AMD_PROPRIETARY_KHR = VK_DRIVER_ID_AMD_PROPRIETARY, VK_DRIVER_ID_AMD_OPEN_SOURCE_KHR = VK_DRIVER_ID_AMD_OPEN_SOURCE, VK_DRIVER_ID_MESA_RADV_KHR = VK_DRIVER_ID_MESA_RADV, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR = VK_DRIVER_ID_NVIDIA_PROPRIETARY, VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR = VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS, VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA_KHR = VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA, VK_DRIVER_ID_IMAGINATION_PROPRIETARY_KHR = VK_DRIVER_ID_IMAGINATION_PROPRIETARY, VK_DRIVER_ID_QUALCOMM_PROPRIETARY_KHR = VK_DRIVER_ID_QUALCOMM_PROPRIETARY, VK_DRIVER_ID_ARM_PROPRIETARY_KHR = VK_DRIVER_ID_ARM_PROPRIETARY, VK_DRIVER_ID_GOOGLE_SWIFTSHADER_KHR = VK_DRIVER_ID_GOOGLE_SWIFTSHADER, VK_DRIVER_ID_GGP_PROPRIETARY_KHR = VK_DRIVER_ID_GGP_PROPRIETARY, VK_DRIVER_ID_BROADCOM_PROPRIETARY_KHR = VK_DRIVER_ID_BROADCOM_PROPRIETARY, VK_DRIVER_ID_MAX_ENUM = $7FFFFFFF ); type P_VkShaderFloatControlsIndependence = ^VkShaderFloatControlsIndependence; VkShaderFloatControlsIndependence = ( VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY = 0, VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL = 1, VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE = 2, VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY_KHR = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY, VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL, VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE_KHR = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE, VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_MAX_ENUM = $7FFFFFFF ); type P_VkSamplerReductionMode = ^VkSamplerReductionMode; VkSamplerReductionMode = ( VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE = 0, VK_SAMPLER_REDUCTION_MODE_MIN = 1, VK_SAMPLER_REDUCTION_MODE_MAX = 2, VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE, VK_SAMPLER_REDUCTION_MODE_MIN_EXT = VK_SAMPLER_REDUCTION_MODE_MIN, VK_SAMPLER_REDUCTION_MODE_MAX_EXT = VK_SAMPLER_REDUCTION_MODE_MAX, VK_SAMPLER_REDUCTION_MODE_MAX_ENUM = $7FFFFFFF ); type P_VkSemaphoreType = ^VkSemaphoreType; VkSemaphoreType = ( VK_SEMAPHORE_TYPE_BINARY = 0, VK_SEMAPHORE_TYPE_TIMELINE = 1, VK_SEMAPHORE_TYPE_BINARY_KHR = VK_SEMAPHORE_TYPE_BINARY, VK_SEMAPHORE_TYPE_TIMELINE_KHR = VK_SEMAPHORE_TYPE_TIMELINE, VK_SEMAPHORE_TYPE_MAX_ENUM = $7FFFFFFF ); type P_VkResolveModeFlagBits = ^VkResolveModeFlagBits; VkResolveModeFlagBits = ( VK_RESOLVE_MODE_NONE = 0, VK_RESOLVE_MODE_SAMPLE_ZERO_BIT = $00000001, VK_RESOLVE_MODE_AVERAGE_BIT = $00000002, VK_RESOLVE_MODE_MIN_BIT = $00000004, VK_RESOLVE_MODE_MAX_BIT = $00000008, VK_RESOLVE_MODE_NONE_KHR = VK_RESOLVE_MODE_NONE, VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT, VK_RESOLVE_MODE_AVERAGE_BIT_KHR = VK_RESOLVE_MODE_AVERAGE_BIT, VK_RESOLVE_MODE_MIN_BIT_KHR = VK_RESOLVE_MODE_MIN_BIT, VK_RESOLVE_MODE_MAX_BIT_KHR = VK_RESOLVE_MODE_MAX_BIT, VK_RESOLVE_MODE_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkResolveModeFlags = ^VkResolveModeFlags; VkResolveModeFlags = VkFlags; type P_VkDescriptorBindingFlagBits = ^VkDescriptorBindingFlagBits; VkDescriptorBindingFlagBits = ( VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT = $00000001, VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT = $00000002, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT = $00000004, VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT = $00000008, VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT = VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT_EXT = VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT = VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT, VK_DESCRIPTOR_BINDING_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkDescriptorBindingFlags = ^VkDescriptorBindingFlags; VkDescriptorBindingFlags = VkFlags; type P_VkSemaphoreWaitFlagBits = ^VkSemaphoreWaitFlagBits; VkSemaphoreWaitFlagBits = ( VK_SEMAPHORE_WAIT_ANY_BIT = $00000001, VK_SEMAPHORE_WAIT_ANY_BIT_KHR = VK_SEMAPHORE_WAIT_ANY_BIT, VK_SEMAPHORE_WAIT_FLAG_BITS_MAX_ENUM = $7FFFFFFF ); type P_VkSemaphoreWaitFlags = ^VkSemaphoreWaitFlags; VkSemaphoreWaitFlags = VkFlags; type P_VkPhysicalDeviceVulkan11Features = ^VkPhysicalDeviceVulkan11Features; VkPhysicalDeviceVulkan11Features = record sType :VkStructureType; pNext :P_void; storageBuffer16BitAccess :VkBool32; uniformAndStorageBuffer16BitAccess :VkBool32; storagePushConstant16 :VkBool32; storageInputOutput16 :VkBool32; multiview :VkBool32; multiviewGeometryShader :VkBool32; multiviewTessellationShader :VkBool32; variablePointersStorageBuffer :VkBool32; variablePointers :VkBool32; protectedMemory :VkBool32; samplerYcbcrConversion :VkBool32; shaderDrawParameters :VkBool32; end; type P_VkPhysicalDeviceVulkan11Properties = ^VkPhysicalDeviceVulkan11Properties; VkPhysicalDeviceVulkan11Properties = record sType :VkStructureType; pNext :P_void; deviceUUID :array [ 0..VK_UUID_SIZE-1 ] of T_uint8_t; driverUUID :array [ 0..VK_UUID_SIZE-1 ] of T_uint8_t; deviceLUID :array [ 0..VK_LUID_SIZE-1 ] of T_uint8_t; deviceNodeMask :T_uint32_t; deviceLUIDValid :VkBool32; subgroupSize :T_uint32_t; subgroupSupportedStages :VkShaderStageFlags; subgroupSupportedOperations :VkSubgroupFeatureFlags; subgroupQuadOperationsInAllStages :VkBool32; pointClippingBehavior :VkPointClippingBehavior; maxMultiviewViewCount :T_uint32_t; maxMultiviewInstanceIndex :T_uint32_t; protectedNoFault :VkBool32; maxPerSetDescriptors :T_uint32_t; maxMemoryAllocationSize :VkDeviceSize; end; type P_VkPhysicalDeviceVulkan12Features = ^VkPhysicalDeviceVulkan12Features; VkPhysicalDeviceVulkan12Features = record sType :VkStructureType; pNext :P_void; samplerMirrorClampToEdge :VkBool32; drawIndirectCount :VkBool32; storageBuffer8BitAccess :VkBool32; uniformAndStorageBuffer8BitAccess :VkBool32; storagePushConstant8 :VkBool32; shaderBufferInt64Atomics :VkBool32; shaderSharedInt64Atomics :VkBool32; shaderFloat16 :VkBool32; shaderInt8 :VkBool32; descriptorIndexing :VkBool32; shaderInputAttachmentArrayDynamicIndexing :VkBool32; shaderUniformTexelBufferArrayDynamicIndexing :VkBool32; shaderStorageTexelBufferArrayDynamicIndexing :VkBool32; shaderUniformBufferArrayNonUniformIndexing :VkBool32; shaderSampledImageArrayNonUniformIndexing :VkBool32; shaderStorageBufferArrayNonUniformIndexing :VkBool32; shaderStorageImageArrayNonUniformIndexing :VkBool32; shaderInputAttachmentArrayNonUniformIndexing :VkBool32; shaderUniformTexelBufferArrayNonUniformIndexing :VkBool32; shaderStorageTexelBufferArrayNonUniformIndexing :VkBool32; descriptorBindingUniformBufferUpdateAfterBind :VkBool32; descriptorBindingSampledImageUpdateAfterBind :VkBool32; descriptorBindingStorageImageUpdateAfterBind :VkBool32; descriptorBindingStorageBufferUpdateAfterBind :VkBool32; descriptorBindingUniformTexelBufferUpdateAfterBind :VkBool32; descriptorBindingStorageTexelBufferUpdateAfterBind :VkBool32; descriptorBindingUpdateUnusedWhilePending :VkBool32; descriptorBindingPartiallyBound :VkBool32; descriptorBindingVariableDescriptorCount :VkBool32; runtimeDescriptorArray :VkBool32; samplerFilterMinmax :VkBool32; scalarBlockLayout :VkBool32; imagelessFramebuffer :VkBool32; uniformBufferStandardLayout :VkBool32; shaderSubgroupExtendedTypes :VkBool32; separateDepthStencilLayouts :VkBool32; hostQueryReset :VkBool32; timelineSemaphore :VkBool32; bufferDeviceAddress :VkBool32; bufferDeviceAddressCaptureReplay :VkBool32; bufferDeviceAddressMultiDevice :VkBool32; vulkanMemoryModel :VkBool32; vulkanMemoryModelDeviceScope :VkBool32; vulkanMemoryModelAvailabilityVisibilityChains :VkBool32; shaderOutputViewportIndex :VkBool32; shaderOutputLayer :VkBool32; subgroupBroadcastDynamicId :VkBool32; end; type P_VkConformanceVersion = ^VkConformanceVersion; VkConformanceVersion = record major :T_uint8_t; minor :T_uint8_t; subminor :T_uint8_t; patch :T_uint8_t; end; type P_VkPhysicalDeviceVulkan12Properties = ^VkPhysicalDeviceVulkan12Properties; VkPhysicalDeviceVulkan12Properties = record sType :VkStructureType; pNext :P_void; driverID :VkDriverId; driverName :array [ 0..VK_MAX_DRIVER_NAME_SIZE-1 ] of T_char; driverInfo :array [ 0..VK_MAX_DRIVER_INFO_SIZE-1 ] of T_char; conformanceVersion :VkConformanceVersion; denormBehaviorIndependence :VkShaderFloatControlsIndependence; roundingModeIndependence :VkShaderFloatControlsIndependence; shaderSignedZeroInfNanPreserveFloat16 :VkBool32; shaderSignedZeroInfNanPreserveFloat32 :VkBool32; shaderSignedZeroInfNanPreserveFloat64 :VkBool32; shaderDenormPreserveFloat16 :VkBool32; shaderDenormPreserveFloat32 :VkBool32; shaderDenormPreserveFloat64 :VkBool32; shaderDenormFlushToZeroFloat16 :VkBool32; shaderDenormFlushToZeroFloat32 :VkBool32; shaderDenormFlushToZeroFloat64 :VkBool32; shaderRoundingModeRTEFloat16 :VkBool32; shaderRoundingModeRTEFloat32 :VkBool32; shaderRoundingModeRTEFloat64 :VkBool32; shaderRoundingModeRTZFloat16 :VkBool32; shaderRoundingModeRTZFloat32 :VkBool32; shaderRoundingModeRTZFloat64 :VkBool32; maxUpdateAfterBindDescriptorsInAllPools :T_uint32_t; shaderUniformBufferArrayNonUniformIndexingNative :VkBool32; shaderSampledImageArrayNonUniformIndexingNative :VkBool32; shaderStorageBufferArrayNonUniformIndexingNative :VkBool32; shaderStorageImageArrayNonUniformIndexingNative :VkBool32; shaderInputAttachmentArrayNonUniformIndexingNative :VkBool32; robustBufferAccessUpdateAfterBind :VkBool32; quadDivergentImplicitLod :VkBool32; maxPerStageDescriptorUpdateAfterBindSamplers :T_uint32_t; maxPerStageDescriptorUpdateAfterBindUniformBuffers :T_uint32_t; maxPerStageDescriptorUpdateAfterBindStorageBuffers :T_uint32_t; maxPerStageDescriptorUpdateAfterBindSampledImages :T_uint32_t; maxPerStageDescriptorUpdateAfterBindStorageImages :T_uint32_t; maxPerStageDescriptorUpdateAfterBindInputAttachments :T_uint32_t; maxPerStageUpdateAfterBindResources :T_uint32_t; maxDescriptorSetUpdateAfterBindSamplers :T_uint32_t; maxDescriptorSetUpdateAfterBindUniformBuffers :T_uint32_t; maxDescriptorSetUpdateAfterBindUniformBuffersDynamic :T_uint32_t; maxDescriptorSetUpdateAfterBindStorageBuffers :T_uint32_t; maxDescriptorSetUpdateAfterBindStorageBuffersDynamic :T_uint32_t; maxDescriptorSetUpdateAfterBindSampledImages :T_uint32_t; maxDescriptorSetUpdateAfterBindStorageImages :T_uint32_t; maxDescriptorSetUpdateAfterBindInputAttachments :T_uint32_t; supportedDepthResolveModes :VkResolveModeFlags; supportedStencilResolveModes :VkResolveModeFlags; independentResolveNone :VkBool32; independentResolve :VkBool32; filterMinmaxSingleComponentFormats :VkBool32; filterMinmaxImageComponentMapping :VkBool32; maxTimelineSemaphoreValueDifference :T_uint64_t; framebufferIntegerColorSampleCounts :VkSampleCountFlags; end; type P_VkImageFormatListCreateInfo = ^VkImageFormatListCreateInfo; VkImageFormatListCreateInfo = record sType :VkStructureType; pNext :P_void; viewFormatCount :T_uint32_t; pViewFormats :P_VkFormat; end; type P_VkAttachmentDescription2 = ^VkAttachmentDescription2; VkAttachmentDescription2 = record sType :VkStructureType; pNext :P_void; flags :VkAttachmentDescriptionFlags; format :VkFormat; samples :VkSampleCountFlagBits; loadOp :VkAttachmentLoadOp; storeOp :VkAttachmentStoreOp; stencilLoadOp :VkAttachmentLoadOp; stencilStoreOp :VkAttachmentStoreOp; initialLayout :VkImageLayout; finalLayout :VkImageLayout; end; type P_VkAttachmentReference2 = ^VkAttachmentReference2; VkAttachmentReference2 = record sType :VkStructureType; pNext :P_void; attachment :T_uint32_t; layout :VkImageLayout; aspectMask :VkImageAspectFlags; end; type P_VkSubpassDescription2 = ^VkSubpassDescription2; VkSubpassDescription2 = record sType :VkStructureType; pNext :P_void; flags :VkSubpassDescriptionFlags; pipelineBindPoint :VkPipelineBindPoint; viewMask :T_uint32_t; inputAttachmentCount :T_uint32_t; pInputAttachments :P_VkAttachmentReference2; colorAttachmentCount :T_uint32_t; pColorAttachments :P_VkAttachmentReference2; pResolveAttachments :P_VkAttachmentReference2; pDepthStencilAttachment :P_VkAttachmentReference2; preserveAttachmentCount :T_uint32_t; pPreserveAttachments :P_uint32_t; end; type P_VkSubpassDependency2 = ^VkSubpassDependency2; VkSubpassDependency2 = record sType :VkStructureType; pNext :P_void; srcSubpass :T_uint32_t; dstSubpass :T_uint32_t; srcStageMask :VkPipelineStageFlags; dstStageMask :VkPipelineStageFlags; srcAccessMask :VkAccessFlags; dstAccessMask :VkAccessFlags; dependencyFlags :VkDependencyFlags; viewOffset :T_int32_t; end; type P_VkRenderPassCreateInfo2 = ^VkRenderPassCreateInfo2; VkRenderPassCreateInfo2 = record sType :VkStructureType; pNext :P_void; flags :VkRenderPassCreateFlags; attachmentCount :T_uint32_t; pAttachments :P_VkAttachmentDescription2; subpassCount :T_uint32_t; pSubpasses :P_VkSubpassDescription2; dependencyCount :T_uint32_t; pDependencies :P_VkSubpassDependency2; correlatedViewMaskCount :T_uint32_t; pCorrelatedViewMasks :P_uint32_t; end; type P_VkSubpassBeginInfo = ^VkSubpassBeginInfo; VkSubpassBeginInfo = record sType :VkStructureType; pNext :P_void; contents :VkSubpassContents; end; type P_VkSubpassEndInfo = ^VkSubpassEndInfo; VkSubpassEndInfo = record sType :VkStructureType; pNext :P_void; end; type P_VkPhysicalDevice8BitStorageFeatures = ^VkPhysicalDevice8BitStorageFeatures; VkPhysicalDevice8BitStorageFeatures = record sType :VkStructureType; pNext :P_void; storageBuffer8BitAccess :VkBool32; uniformAndStorageBuffer8BitAccess :VkBool32; storagePushConstant8 :VkBool32; end; type P_VkPhysicalDeviceDriverProperties = ^VkPhysicalDeviceDriverProperties; VkPhysicalDeviceDriverProperties = record sType :VkStructureType; pNext :P_void; driverID :VkDriverId; driverName :array [ 0..VK_MAX_DRIVER_NAME_SIZE-1 ] of T_char; driverInfo :array [ 0..VK_MAX_DRIVER_INFO_SIZE-1 ] of T_char; conformanceVersion :VkConformanceVersion; end; type P_VkPhysicalDeviceShaderAtomicInt64Features = ^VkPhysicalDeviceShaderAtomicInt64Features; VkPhysicalDeviceShaderAtomicInt64Features = record sType :VkStructureType; pNext :P_void; shaderBufferInt64Atomics :VkBool32; shaderSharedInt64Atomics :VkBool32; end; type P_VkPhysicalDeviceShaderFloat16Int8Features = ^VkPhysicalDeviceShaderFloat16Int8Features; VkPhysicalDeviceShaderFloat16Int8Features = record sType :VkStructureType; pNext :P_void; shaderFloat16 :VkBool32; shaderInt8 :VkBool32; end; type P_VkPhysicalDeviceFloatControlsProperties = ^VkPhysicalDeviceFloatControlsProperties; VkPhysicalDeviceFloatControlsProperties = record sType :VkStructureType; pNext :P_void; denormBehaviorIndependence :VkShaderFloatControlsIndependence; roundingModeIndependence :VkShaderFloatControlsIndependence; shaderSignedZeroInfNanPreserveFloat16 :VkBool32; shaderSignedZeroInfNanPreserveFloat32 :VkBool32; shaderSignedZeroInfNanPreserveFloat64 :VkBool32; shaderDenormPreserveFloat16 :VkBool32; shaderDenormPreserveFloat32 :VkBool32; shaderDenormPreserveFloat64 :VkBool32; shaderDenormFlushToZeroFloat16 :VkBool32; shaderDenormFlushToZeroFloat32 :VkBool32; shaderDenormFlushToZeroFloat64 :VkBool32; shaderRoundingModeRTEFloat16 :VkBool32; shaderRoundingModeRTEFloat32 :VkBool32; shaderRoundingModeRTEFloat64 :VkBool32; shaderRoundingModeRTZFloat16 :VkBool32; shaderRoundingModeRTZFloat32 :VkBool32; shaderRoundingModeRTZFloat64 :VkBool32; end; type P_VkDescriptorSetLayoutBindingFlagsCreateInfo = ^VkDescriptorSetLayoutBindingFlagsCreateInfo; VkDescriptorSetLayoutBindingFlagsCreateInfo = record sType :VkStructureType; pNext :P_void; bindingCount :T_uint32_t; pBindingFlags :P_VkDescriptorBindingFlags; end; type P_VkPhysicalDeviceDescriptorIndexingFeatures = ^VkPhysicalDeviceDescriptorIndexingFeatures; VkPhysicalDeviceDescriptorIndexingFeatures = record sType :VkStructureType; pNext :P_void; shaderInputAttachmentArrayDynamicIndexing :VkBool32; shaderUniformTexelBufferArrayDynamicIndexing :VkBool32; shaderStorageTexelBufferArrayDynamicIndexing :VkBool32; shaderUniformBufferArrayNonUniformIndexing :VkBool32; shaderSampledImageArrayNonUniformIndexing :VkBool32; shaderStorageBufferArrayNonUniformIndexing :VkBool32; shaderStorageImageArrayNonUniformIndexing :VkBool32; shaderInputAttachmentArrayNonUniformIndexing :VkBool32; shaderUniformTexelBufferArrayNonUniformIndexing :VkBool32; shaderStorageTexelBufferArrayNonUniformIndexing :VkBool32; descriptorBindingUniformBufferUpdateAfterBind :VkBool32; descriptorBindingSampledImageUpdateAfterBind :VkBool32; descriptorBindingStorageImageUpdateAfterBind :VkBool32; descriptorBindingStorageBufferUpdateAfterBind :VkBool32; descriptorBindingUniformTexelBufferUpdateAfterBind :VkBool32; descriptorBindingStorageTexelBufferUpdateAfterBind :VkBool32; descriptorBindingUpdateUnusedWhilePending :VkBool32; descriptorBindingPartiallyBound :VkBool32; descriptorBindingVariableDescriptorCount :VkBool32; runtimeDescriptorArray :VkBool32; end; type P_VkPhysicalDeviceDescriptorIndexingProperties = ^VkPhysicalDeviceDescriptorIndexingProperties; VkPhysicalDeviceDescriptorIndexingProperties = record sType :VkStructureType; pNext :P_void; maxUpdateAfterBindDescriptorsInAllPools :T_uint32_t; shaderUniformBufferArrayNonUniformIndexingNative :VkBool32; shaderSampledImageArrayNonUniformIndexingNative :VkBool32; shaderStorageBufferArrayNonUniformIndexingNative :VkBool32; shaderStorageImageArrayNonUniformIndexingNative :VkBool32; shaderInputAttachmentArrayNonUniformIndexingNative :VkBool32; robustBufferAccessUpdateAfterBind :VkBool32; quadDivergentImplicitLod :VkBool32; maxPerStageDescriptorUpdateAfterBindSamplers :T_uint32_t; maxPerStageDescriptorUpdateAfterBindUniformBuffers :T_uint32_t; maxPerStageDescriptorUpdateAfterBindStorageBuffers :T_uint32_t; maxPerStageDescriptorUpdateAfterBindSampledImages :T_uint32_t; maxPerStageDescriptorUpdateAfterBindStorageImages :T_uint32_t; maxPerStageDescriptorUpdateAfterBindInputAttachments :T_uint32_t; maxPerStageUpdateAfterBindResources :T_uint32_t; maxDescriptorSetUpdateAfterBindSamplers :T_uint32_t; maxDescriptorSetUpdateAfterBindUniformBuffers :T_uint32_t; maxDescriptorSetUpdateAfterBindUniformBuffersDynamic :T_uint32_t; maxDescriptorSetUpdateAfterBindStorageBuffers :T_uint32_t; maxDescriptorSetUpdateAfterBindStorageBuffersDynamic :T_uint32_t; maxDescriptorSetUpdateAfterBindSampledImages :T_uint32_t; maxDescriptorSetUpdateAfterBindStorageImages :T_uint32_t; maxDescriptorSetUpdateAfterBindInputAttachments :T_uint32_t; end; type P_VkDescriptorSetVariableDescriptorCountAllocateInfo = ^VkDescriptorSetVariableDescriptorCountAllocateInfo; VkDescriptorSetVariableDescriptorCountAllocateInfo = record sType :VkStructureType; pNext :P_void; descriptorSetCount :T_uint32_t; pDescriptorCounts :P_uint32_t; end; type P_VkDescriptorSetVariableDescriptorCountLayoutSupport = ^VkDescriptorSetVariableDescriptorCountLayoutSupport; VkDescriptorSetVariableDescriptorCountLayoutSupport = record sType :VkStructureType; pNext :P_void; maxVariableDescriptorCount :T_uint32_t; end; type P_VkSubpassDescriptionDepthStencilResolve = ^VkSubpassDescriptionDepthStencilResolve; VkSubpassDescriptionDepthStencilResolve = record sType :VkStructureType; pNext :P_void; depthResolveMode :VkResolveModeFlagBits; stencilResolveMode :VkResolveModeFlagBits; pDepthStencilResolveAttachment :P_VkAttachmentReference2; end; type P_VkPhysicalDeviceDepthStencilResolveProperties = ^VkPhysicalDeviceDepthStencilResolveProperties; VkPhysicalDeviceDepthStencilResolveProperties = record sType :VkStructureType; pNext :P_void; supportedDepthResolveModes :VkResolveModeFlags; supportedStencilResolveModes :VkResolveModeFlags; independentResolveNone :VkBool32; independentResolve :VkBool32; end; type P_VkPhysicalDeviceScalarBlockLayoutFeatures = ^VkPhysicalDeviceScalarBlockLayoutFeatures; VkPhysicalDeviceScalarBlockLayoutFeatures = record sType :VkStructureType; pNext :P_void; scalarBlockLayout :VkBool32; end; type P_VkImageStencilUsageCreateInfo = ^VkImageStencilUsageCreateInfo; VkImageStencilUsageCreateInfo = record sType :VkStructureType; pNext :P_void; stencilUsage :VkImageUsageFlags; end; type P_VkSamplerReductionModeCreateInfo = ^VkSamplerReductionModeCreateInfo; VkSamplerReductionModeCreateInfo = record sType :VkStructureType; pNext :P_void; reductionMode :VkSamplerReductionMode; end; type P_VkPhysicalDeviceSamplerFilterMinmaxProperties = ^VkPhysicalDeviceSamplerFilterMinmaxProperties; VkPhysicalDeviceSamplerFilterMinmaxProperties = record sType :VkStructureType; pNext :P_void; filterMinmaxSingleComponentFormats :VkBool32; filterMinmaxImageComponentMapping :VkBool32; end; type P_VkPhysicalDeviceVulkanMemoryModelFeatures = ^VkPhysicalDeviceVulkanMemoryModelFeatures; VkPhysicalDeviceVulkanMemoryModelFeatures = record sType :VkStructureType; pNext :P_void; vulkanMemoryModel :VkBool32; vulkanMemoryModelDeviceScope :VkBool32; vulkanMemoryModelAvailabilityVisibilityChains :VkBool32; end; type P_VkPhysicalDeviceImagelessFramebufferFeatures = ^VkPhysicalDeviceImagelessFramebufferFeatures; VkPhysicalDeviceImagelessFramebufferFeatures = record sType :VkStructureType; pNext :P_void; imagelessFramebuffer :VkBool32; end; type P_VkFramebufferAttachmentImageInfo = ^VkFramebufferAttachmentImageInfo; VkFramebufferAttachmentImageInfo = record sType :VkStructureType; pNext :P_void; flags :VkImageCreateFlags; usage :VkImageUsageFlags; width :T_uint32_t; height :T_uint32_t; layerCount :T_uint32_t; viewFormatCount :T_uint32_t; pViewFormats :P_VkFormat; end; type P_VkFramebufferAttachmentsCreateInfo = ^VkFramebufferAttachmentsCreateInfo; VkFramebufferAttachmentsCreateInfo = record sType :VkStructureType; pNext :P_void; attachmentImageInfoCount :T_uint32_t; pAttachmentImageInfos :P_VkFramebufferAttachmentImageInfo; end; type P_VkRenderPassAttachmentBeginInfo = ^VkRenderPassAttachmentBeginInfo; VkRenderPassAttachmentBeginInfo = record sType :VkStructureType; pNext :P_void; attachmentCount :T_uint32_t; pAttachments :P_VkImageView; end; type P_VkPhysicalDeviceUniformBufferStandardLayoutFeatures = ^VkPhysicalDeviceUniformBufferStandardLayoutFeatures; VkPhysicalDeviceUniformBufferStandardLayoutFeatures = record sType :VkStructureType; pNext :P_void; uniformBufferStandardLayout :VkBool32; end; type P_VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures = ^VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures; VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures = record sType :VkStructureType; pNext :P_void; shaderSubgroupExtendedTypes :VkBool32; end; type P_VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures = ^VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures; VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures = record sType :VkStructureType; pNext :P_void; separateDepthStencilLayouts :VkBool32; end; type P_VkAttachmentReferenceStencilLayout = ^VkAttachmentReferenceStencilLayout; VkAttachmentReferenceStencilLayout = record sType :VkStructureType; pNext :P_void; stencilLayout :VkImageLayout; end; type P_VkAttachmentDescriptionStencilLayout = ^VkAttachmentDescriptionStencilLayout; VkAttachmentDescriptionStencilLayout = record sType :VkStructureType; pNext :P_void; stencilInitialLayout :VkImageLayout; stencilFinalLayout :VkImageLayout; end; type P_VkPhysicalDeviceHostQueryResetFeatures = ^VkPhysicalDeviceHostQueryResetFeatures; VkPhysicalDeviceHostQueryResetFeatures = record sType :VkStructureType; pNext :P_void; hostQueryReset :VkBool32; end; type P_VkPhysicalDeviceTimelineSemaphoreFeatures = ^VkPhysicalDeviceTimelineSemaphoreFeatures; VkPhysicalDeviceTimelineSemaphoreFeatures = record sType :VkStructureType; pNext :P_void; timelineSemaphore :VkBool32; end; type P_VkPhysicalDeviceTimelineSemaphoreProperties = ^VkPhysicalDeviceTimelineSemaphoreProperties; VkPhysicalDeviceTimelineSemaphoreProperties = record sType :VkStructureType; pNext :P_void; maxTimelineSemaphoreValueDifference :T_uint64_t; end; type P_VkSemaphoreTypeCreateInfo = ^VkSemaphoreTypeCreateInfo; VkSemaphoreTypeCreateInfo = record sType :VkStructureType; pNext :P_void; semaphoreType :VkSemaphoreType; initialValue :T_uint64_t; end; type P_VkTimelineSemaphoreSubmitInfo = ^VkTimelineSemaphoreSubmitInfo; VkTimelineSemaphoreSubmitInfo = record sType :VkStructureType; pNext :P_void; waitSemaphoreValueCount :T_uint32_t; pWaitSemaphoreValues :P_uint64_t; signalSemaphoreValueCount :T_uint32_t; pSignalSemaphoreValues :P_uint64_t; end; type P_VkSemaphoreWaitInfo = ^VkSemaphoreWaitInfo; VkSemaphoreWaitInfo = record sType :VkStructureType; pNext :P_void; flags :VkSemaphoreWaitFlags; semaphoreCount :T_uint32_t; pSemaphores :P_VkSemaphore; pValues :P_uint64_t; end; type P_VkSemaphoreSignalInfo = ^VkSemaphoreSignalInfo; VkSemaphoreSignalInfo = record sType :VkStructureType; pNext :P_void; semaphore :VkSemaphore; value :T_uint64_t; end; type P_VkPhysicalDeviceBufferDeviceAddressFeatures = ^VkPhysicalDeviceBufferDeviceAddressFeatures; VkPhysicalDeviceBufferDeviceAddressFeatures = record sType :VkStructureType; pNext :P_void; bufferDeviceAddress :VkBool32; bufferDeviceAddressCaptureReplay :VkBool32; bufferDeviceAddressMultiDevice :VkBool32; end; type P_VkBufferDeviceAddressInfo = ^VkBufferDeviceAddressInfo; VkBufferDeviceAddressInfo = record sType :VkStructureType; pNext :P_void; buffer :VkBuffer; end; type P_VkBufferOpaqueCaptureAddressCreateInfo = ^VkBufferOpaqueCaptureAddressCreateInfo; VkBufferOpaqueCaptureAddressCreateInfo = record sType :VkStructureType; pNext :P_void; opaqueCaptureAddress :T_uint64_t; end; type P_VkMemoryOpaqueCaptureAddressAllocateInfo = ^VkMemoryOpaqueCaptureAddressAllocateInfo; VkMemoryOpaqueCaptureAddressAllocateInfo = record sType :VkStructureType; pNext :P_void; opaqueCaptureAddress :T_uint64_t; end; type P_VkDeviceMemoryOpaqueCaptureAddressInfo = ^VkDeviceMemoryOpaqueCaptureAddressInfo; VkDeviceMemoryOpaqueCaptureAddressInfo = record sType :VkStructureType; pNext :P_void; memory :VkDeviceMemory; end; type PFN_vkCmdDrawIndirectCount = procedure( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; countBuffer_:VkBuffer; countBufferOffset_:VkDeviceSize; maxDrawCount_:T_uint32_t; stride_:T_uint32_t ); type PFN_vkCmdDrawIndexedIndirectCount = procedure( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; countBuffer_:VkBuffer; countBufferOffset_:VkDeviceSize; maxDrawCount_:T_uint32_t; stride_:T_uint32_t ); type PFN_vkCreateRenderPass2 = function( device_:VkDevice; const pCreateInfo_:P_VkRenderPassCreateInfo2; const pAllocator_:P_VkAllocationCallbacks; pRenderPass_:P_VkRenderPass ) :VkResult; type PFN_vkCmdBeginRenderPass2 = procedure( commandBuffer_:VkCommandBuffer; const pRenderPassBegin_:P_VkRenderPassBeginInfo; const pSubpassBeginInfo_:P_VkSubpassBeginInfo ); type PFN_vkCmdNextSubpass2 = procedure( commandBuffer_:VkCommandBuffer; const pSubpassBeginInfo_:P_VkSubpassBeginInfo; const pSubpassEndInfo_:P_VkSubpassEndInfo ); type PFN_vkCmdEndRenderPass2 = procedure( commandBuffer_:VkCommandBuffer; const pSubpassEndInfo_:P_VkSubpassEndInfo ); type PFN_vkResetQueryPool = procedure( device_:VkDevice; queryPool_:VkQueryPool; firstQuery_:T_uint32_t; queryCount_:T_uint32_t ); type PFN_vkGetSemaphoreCounterValue = function( device_:VkDevice; semaphore_:VkSemaphore; pValue_:P_uint64_t ) :VkResult; type PFN_vkWaitSemaphores = function( device_:VkDevice; const pWaitInfo_:P_VkSemaphoreWaitInfo; timeout_:T_uint64_t ) :VkResult; type PFN_vkSignalSemaphore = function( device_:VkDevice; const pSignalInfo_:P_VkSemaphoreSignalInfo ) :VkResult; type PFN_vkGetBufferDeviceAddress = function( device_:VkDevice; const pInfo_:P_VkBufferDeviceAddressInfo ) :VkDeviceAddress; type PFN_vkGetBufferOpaqueCaptureAddress = function( device_:VkDevice; const pInfo_:P_VkBufferDeviceAddressInfo ) :T_uint64_t; type PFN_vkGetDeviceMemoryOpaqueCaptureAddress = function( device_:VkDevice; const pInfo_:P_VkDeviceMemoryOpaqueCaptureAddressInfo ) :T_uint64_t; {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdDrawIndirectCount( commandBuffer_ :VkCommandBuffer; buffer_ :VkBuffer; offset_ :VkDeviceSize; countBuffer_ :VkBuffer; countBufferOffset_ :VkDeviceSize; maxDrawCount_ :T_uint32_t; stride_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDrawIndexedIndirectCount( commandBuffer_ :VkCommandBuffer; buffer_ :VkBuffer; offset_ :VkDeviceSize; countBuffer_ :VkBuffer; countBufferOffset_ :VkDeviceSize; maxDrawCount_ :T_uint32_t; stride_ :T_uint32_t ); stdcall; external DLLNAME; function vkCreateRenderPass2( device_ :VkDevice; pCreateInfo_ :P_VkRenderPassCreateInfo2; pAllocator_ :P_VkAllocationCallbacks; pRenderPass_ :P_VkRenderPass ) :VkResult; stdcall; external DLLNAME; procedure vkCmdBeginRenderPass2( commandBuffer_ :VkCommandBuffer; pRenderPassBegin_ :P_VkRenderPassBeginInfo; pSubpassBeginInfo_ :P_VkSubpassBeginInfo ); stdcall; external DLLNAME; procedure vkCmdNextSubpass2( commandBuffer_ :VkCommandBuffer; pSubpassBeginInfo_ :P_VkSubpassBeginInfo; pSubpassEndInfo_ :P_VkSubpassEndInfo ); stdcall; external DLLNAME; procedure vkCmdEndRenderPass2( commandBuffer_ :VkCommandBuffer; pSubpassEndInfo_ :P_VkSubpassEndInfo ); stdcall; external DLLNAME; procedure vkResetQueryPool( device_ :VkDevice; queryPool_ :VkQueryPool; firstQuery_ :T_uint32_t; queryCount_ :T_uint32_t ); stdcall; external DLLNAME; function vkGetSemaphoreCounterValue( device_ :VkDevice; semaphore_ :VkSemaphore; pValue_ :P_uint64_t ) :VkResult; stdcall; external DLLNAME; function vkWaitSemaphores( device_ :VkDevice; pWaitInfo_ :P_VkSemaphoreWaitInfo; timeout_ :T_uint64_t ) :VkResult; stdcall; external DLLNAME; function vkSignalSemaphore( device_ :VkDevice; pSignalInfo_ :P_VkSemaphoreSignalInfo ) :VkResult; stdcall; external DLLNAME; function vkGetBufferDeviceAddress( device_ :VkDevice; pInfo_ :P_VkBufferDeviceAddressInfo ) :VkDeviceAddress; stdcall; external DLLNAME; function vkGetBufferOpaqueCaptureAddress( device_ :VkDevice; pInfo_ :P_VkBufferDeviceAddressInfo ) :T_uint64_t; stdcall; external DLLNAME; function vkGetDeviceMemoryOpaqueCaptureAddress( device_ :VkDevice; pInfo_ :P_VkDeviceMemoryOpaqueCaptureAddressInfo ) :T_uint64_t; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_surface = 1; type P_VkSurfaceKHR = ^VkSurfaceKHR; VkSurfaceKHR = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_KHR_SURFACE_SPEC_VERSION = 25; const VK_KHR_SURFACE_EXTENSION_NAME = 'VK_KHR_surface'; type P_VkPresentModeKHR = ^VkPresentModeKHR; VkPresentModeKHR = ( VK_PRESENT_MODE_IMMEDIATE_KHR = 0, VK_PRESENT_MODE_MAILBOX_KHR = 1, VK_PRESENT_MODE_FIFO_KHR = 2, VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR = 1000111000, VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR = 1000111001, VK_PRESENT_MODE_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkColorSpaceKHR = ^VkColorSpaceKHR; VkColorSpaceKHR = ( VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0, VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = 1000104001, VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT = 1000104002, VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT = 1000104003, VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT = 1000104004, VK_COLOR_SPACE_BT709_LINEAR_EXT = 1000104005, VK_COLOR_SPACE_BT709_NONLINEAR_EXT = 1000104006, VK_COLOR_SPACE_BT2020_LINEAR_EXT = 1000104007, VK_COLOR_SPACE_HDR10_ST2084_EXT = 1000104008, VK_COLOR_SPACE_DOLBYVISION_EXT = 1000104009, VK_COLOR_SPACE_HDR10_HLG_EXT = 1000104010, VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011, VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012, VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013, VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104014, VK_COLOR_SPACE_DISPLAY_NATIVE_AMD = 1000213000, VK_COLORSPACE_SRGB_NONLINEAR_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, VK_COLOR_SPACE_DCI_P3_LINEAR_EXT = VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT, VK_COLOR_SPACE_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkSurfaceTransformFlagBitsKHR = ^VkSurfaceTransformFlagBitsKHR; VkSurfaceTransformFlagBitsKHR = ( VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = $00000001, VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = $00000002, VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = $00000004, VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = $00000008, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = $00000010, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = $00000020, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = $00000040, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = $00000080, VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = $00000100, VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkCompositeAlphaFlagBitsKHR = ^VkCompositeAlphaFlagBitsKHR; VkCompositeAlphaFlagBitsKHR = ( VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = $00000001, VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = $00000002, VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = $00000004, VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = $00000008, VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkCompositeAlphaFlagsKHR = ^VkCompositeAlphaFlagsKHR; VkCompositeAlphaFlagsKHR = VkFlags; type P_VkSurfaceTransformFlagsKHR = ^VkSurfaceTransformFlagsKHR; VkSurfaceTransformFlagsKHR = VkFlags; type P_VkSurfaceCapabilitiesKHR = ^VkSurfaceCapabilitiesKHR; VkSurfaceCapabilitiesKHR = record minImageCount :T_uint32_t; maxImageCount :T_uint32_t; currentExtent :VkExtent2D; minImageExtent :VkExtent2D; maxImageExtent :VkExtent2D; maxImageArrayLayers :T_uint32_t; supportedTransforms :VkSurfaceTransformFlagsKHR; currentTransform :VkSurfaceTransformFlagBitsKHR; supportedCompositeAlpha :VkCompositeAlphaFlagsKHR; supportedUsageFlags :VkImageUsageFlags; end; type P_VkSurfaceFormatKHR = ^VkSurfaceFormatKHR; VkSurfaceFormatKHR = record format :VkFormat; colorSpace :VkColorSpaceKHR; end; type PFN_vkDestroySurfaceKHR = procedure( instance_:VkInstance; surface_:VkSurfaceKHR; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkGetPhysicalDeviceSurfaceSupportKHR = function( physicalDevice_:VkPhysicalDevice; queueFamilyIndex_:T_uint32_t; surface_:VkSurfaceKHR; pSupported_:P_VkBool32 ) :VkResult; type PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = function( physicalDevice_:VkPhysicalDevice; surface_:VkSurfaceKHR; pSurfaceCapabilities_:P_VkSurfaceCapabilitiesKHR ) :VkResult; type PFN_vkGetPhysicalDeviceSurfaceFormatsKHR = function( physicalDevice_:VkPhysicalDevice; surface_:VkSurfaceKHR; pSurfaceFormatCount_:P_uint32_t; pSurfaceFormats_:P_VkSurfaceFormatKHR ) :VkResult; type PFN_vkGetPhysicalDeviceSurfacePresentModesKHR = function( physicalDevice_:VkPhysicalDevice; surface_:VkSurfaceKHR; pPresentModeCount_:P_uint32_t; pPresentModes_:P_VkPresentModeKHR ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } procedure vkDestroySurfaceKHR( instance_ :VkInstance; surface_ :VkSurfaceKHR; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkGetPhysicalDeviceSurfaceSupportKHR( physicalDevice_ :VkPhysicalDevice; queueFamilyIndex_ :T_uint32_t; surface_ :VkSurfaceKHR; pSupported_ :P_VkBool32 ) :VkResult; stdcall; external DLLNAME; function vkGetPhysicalDeviceSurfaceCapabilitiesKHR( physicalDevice_ :VkPhysicalDevice; surface_ :VkSurfaceKHR; pSurfaceCapabilities_ :P_VkSurfaceCapabilitiesKHR ) :VkResult; stdcall; external DLLNAME; function vkGetPhysicalDeviceSurfaceFormatsKHR( physicalDevice_ :VkPhysicalDevice; surface_ :VkSurfaceKHR; pSurfaceFormatCount_ :P_uint32_t; pSurfaceFormats_ :P_VkSurfaceFormatKHR ) :VkResult; stdcall; external DLLNAME; function vkGetPhysicalDeviceSurfacePresentModesKHR( physicalDevice_ :VkPhysicalDevice; surface_ :VkSurfaceKHR; pPresentModeCount_ :P_uint32_t; pPresentModes_ :P_VkPresentModeKHR ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_swapchain = 1; type P_VkSwapchainKHR = ^VkSwapchainKHR; VkSwapchainKHR = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_KHR_SWAPCHAIN_SPEC_VERSION = 70; const VK_KHR_SWAPCHAIN_EXTENSION_NAME = 'VK_KHR_swapchain'; type P_VkSwapchainCreateFlagBitsKHR = ^VkSwapchainCreateFlagBitsKHR; VkSwapchainCreateFlagBitsKHR = ( VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = $00000001, VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR = $00000002, VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR = $00000004, VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkSwapchainCreateFlagsKHR = ^VkSwapchainCreateFlagsKHR; VkSwapchainCreateFlagsKHR = VkFlags; type P_VkDeviceGroupPresentModeFlagBitsKHR = ^VkDeviceGroupPresentModeFlagBitsKHR; VkDeviceGroupPresentModeFlagBitsKHR = ( VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR = $00000001, VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR = $00000002, VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR = $00000004, VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR = $00000008, VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkDeviceGroupPresentModeFlagsKHR = ^VkDeviceGroupPresentModeFlagsKHR; VkDeviceGroupPresentModeFlagsKHR = VkFlags; type P_VkSwapchainCreateInfoKHR = ^VkSwapchainCreateInfoKHR; VkSwapchainCreateInfoKHR = record sType :VkStructureType; pNext :P_void; flags :VkSwapchainCreateFlagsKHR; surface :VkSurfaceKHR; minImageCount :T_uint32_t; imageFormat :VkFormat; imageColorSpace :VkColorSpaceKHR; imageExtent :VkExtent2D; imageArrayLayers :T_uint32_t; imageUsage :VkImageUsageFlags; imageSharingMode :VkSharingMode; queueFamilyIndexCount :T_uint32_t; pQueueFamilyIndices :P_uint32_t; preTransform :VkSurfaceTransformFlagBitsKHR; compositeAlpha :VkCompositeAlphaFlagBitsKHR; presentMode :VkPresentModeKHR; clipped :VkBool32; oldSwapchain :VkSwapchainKHR; end; type P_VkPresentInfoKHR = ^VkPresentInfoKHR; VkPresentInfoKHR = record sType :VkStructureType; pNext :P_void; waitSemaphoreCount :T_uint32_t; pWaitSemaphores :P_VkSemaphore; swapchainCount :T_uint32_t; pSwapchains :P_VkSwapchainKHR; pImageIndices :P_uint32_t; pResults :P_VkResult; end; type P_VkImageSwapchainCreateInfoKHR = ^VkImageSwapchainCreateInfoKHR; VkImageSwapchainCreateInfoKHR = record sType :VkStructureType; pNext :P_void; swapchain :VkSwapchainKHR; end; type P_VkBindImageMemorySwapchainInfoKHR = ^VkBindImageMemorySwapchainInfoKHR; VkBindImageMemorySwapchainInfoKHR = record sType :VkStructureType; pNext :P_void; swapchain :VkSwapchainKHR; imageIndex :T_uint32_t; end; type P_VkAcquireNextImageInfoKHR = ^VkAcquireNextImageInfoKHR; VkAcquireNextImageInfoKHR = record sType :VkStructureType; pNext :P_void; swapchain :VkSwapchainKHR; timeout :T_uint64_t; semaphore :VkSemaphore; fence :VkFence; deviceMask :T_uint32_t; end; type P_VkDeviceGroupPresentCapabilitiesKHR = ^VkDeviceGroupPresentCapabilitiesKHR; VkDeviceGroupPresentCapabilitiesKHR = record sType :VkStructureType; pNext :P_void; presentMask :array [ 0..VK_MAX_DEVICE_GROUP_SIZE-1 ] of T_uint32_t; modes :VkDeviceGroupPresentModeFlagsKHR; end; type P_VkDeviceGroupPresentInfoKHR = ^VkDeviceGroupPresentInfoKHR; VkDeviceGroupPresentInfoKHR = record sType :VkStructureType; pNext :P_void; swapchainCount :T_uint32_t; pDeviceMasks :P_uint32_t; mode :VkDeviceGroupPresentModeFlagBitsKHR; end; type P_VkDeviceGroupSwapchainCreateInfoKHR = ^VkDeviceGroupSwapchainCreateInfoKHR; VkDeviceGroupSwapchainCreateInfoKHR = record sType :VkStructureType; pNext :P_void; modes :VkDeviceGroupPresentModeFlagsKHR; end; type PFN_vkCreateSwapchainKHR = function( device_:VkDevice; const pCreateInfo_:P_VkSwapchainCreateInfoKHR; const pAllocator_:P_VkAllocationCallbacks; pSwapchain_:P_VkSwapchainKHR ) :VkResult; type PFN_vkDestroySwapchainKHR = procedure( device_:VkDevice; swapchain_:VkSwapchainKHR; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkGetSwapchainImagesKHR = function( device_:VkDevice; swapchain_:VkSwapchainKHR; pSwapchainImageCount_:P_uint32_t; pSwapchainImages_:P_VkImage ) :VkResult; type PFN_vkAcquireNextImageKHR = function( device_:VkDevice; swapchain_:VkSwapchainKHR; timeout_:T_uint64_t; semaphore_:VkSemaphore; fence_:VkFence; pImageIndex_:P_uint32_t ) :VkResult; type PFN_vkQueuePresentKHR = function( queue_:VkQueue; const pPresentInfo_:P_VkPresentInfoKHR ) :VkResult; type PFN_vkGetDeviceGroupPresentCapabilitiesKHR = function( device_:VkDevice; pDeviceGroupPresentCapabilities_:P_VkDeviceGroupPresentCapabilitiesKHR ) :VkResult; type PFN_vkGetDeviceGroupSurfacePresentModesKHR = function( device_:VkDevice; surface_:VkSurfaceKHR; pModes_:P_VkDeviceGroupPresentModeFlagsKHR ) :VkResult; type PFN_vkGetPhysicalDevicePresentRectanglesKHR = function( physicalDevice_:VkPhysicalDevice; surface_:VkSurfaceKHR; pRectCount_:P_uint32_t; pRects_:P_VkRect2D ) :VkResult; type PFN_vkAcquireNextImage2KHR = function( device_:VkDevice; const pAcquireInfo_:P_VkAcquireNextImageInfoKHR; pImageIndex_:P_uint32_t ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkCreateSwapchainKHR( device_ :VkDevice; pCreateInfo_ :P_VkSwapchainCreateInfoKHR; pAllocator_ :P_VkAllocationCallbacks; pSwapchain_ :P_VkSwapchainKHR ) :VkResult; stdcall; external DLLNAME; procedure vkDestroySwapchainKHR( device_ :VkDevice; swapchain_ :VkSwapchainKHR; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkGetSwapchainImagesKHR( device_ :VkDevice; swapchain_ :VkSwapchainKHR; pSwapchainImageCount_ :P_uint32_t; pSwapchainImages_ :P_VkImage ) :VkResult; stdcall; external DLLNAME; function vkAcquireNextImageKHR( device_ :VkDevice; swapchain_ :VkSwapchainKHR; timeout_ :T_uint64_t; semaphore_ :VkSemaphore; fence_ :VkFence; pImageIndex_ :P_uint32_t ) :VkResult; stdcall; external DLLNAME; function vkQueuePresentKHR( queue_ :VkQueue; pPresentInfo_ :P_VkPresentInfoKHR ) :VkResult; stdcall; external DLLNAME; function vkGetDeviceGroupPresentCapabilitiesKHR( device_ :VkDevice; pDeviceGroupPresentCapabilities_ :P_VkDeviceGroupPresentCapabilitiesKHR ) :VkResult; stdcall; external DLLNAME; function vkGetDeviceGroupSurfacePresentModesKHR( device_ :VkDevice; surface_ :VkSurfaceKHR; pModes_ :P_VkDeviceGroupPresentModeFlagsKHR ) :VkResult; stdcall; external DLLNAME; function vkGetPhysicalDevicePresentRectanglesKHR( physicalDevice_ :VkPhysicalDevice; surface_ :VkSurfaceKHR; pRectCount_ :P_uint32_t; pRects_ :P_VkRect2D ) :VkResult; stdcall; external DLLNAME; function vkAcquireNextImage2KHR( device_ :VkDevice; pAcquireInfo_ :P_VkAcquireNextImageInfoKHR; pImageIndex_ :P_uint32_t ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_display = 1; type P_VkDisplayKHR = ^VkDisplayKHR; VkDisplayKHR = VK_DEFINE_NON_DISPATCHABLE_HANDLE; type P_VkDisplayModeKHR = ^VkDisplayModeKHR; VkDisplayModeKHR = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_KHR_DISPLAY_SPEC_VERSION = 23; const VK_KHR_DISPLAY_EXTENSION_NAME = 'VK_KHR_display'; type P_VkDisplayModeCreateFlagsKHR = ^VkDisplayModeCreateFlagsKHR; VkDisplayModeCreateFlagsKHR = VkFlags; type P_VkDisplayPlaneAlphaFlagBitsKHR = ^VkDisplayPlaneAlphaFlagBitsKHR; VkDisplayPlaneAlphaFlagBitsKHR = ( VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = $00000001, VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = $00000002, VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = $00000004, VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = $00000008, VK_DISPLAY_PLANE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkDisplayPlaneAlphaFlagsKHR = ^VkDisplayPlaneAlphaFlagsKHR; VkDisplayPlaneAlphaFlagsKHR = VkFlags; type P_VkDisplaySurfaceCreateFlagsKHR = ^VkDisplaySurfaceCreateFlagsKHR; VkDisplaySurfaceCreateFlagsKHR = VkFlags; type P_VkDisplayModeParametersKHR = ^VkDisplayModeParametersKHR; VkDisplayModeParametersKHR = record visibleRegion :VkExtent2D; refreshRate :T_uint32_t; end; type P_VkDisplayModeCreateInfoKHR = ^VkDisplayModeCreateInfoKHR; VkDisplayModeCreateInfoKHR = record sType :VkStructureType; pNext :P_void; flags :VkDisplayModeCreateFlagsKHR; parameters :VkDisplayModeParametersKHR; end; type P_VkDisplayModePropertiesKHR = ^VkDisplayModePropertiesKHR; VkDisplayModePropertiesKHR = record displayMode :VkDisplayModeKHR; parameters :VkDisplayModeParametersKHR; end; type P_VkDisplayPlaneCapabilitiesKHR = ^VkDisplayPlaneCapabilitiesKHR; VkDisplayPlaneCapabilitiesKHR = record supportedAlpha :VkDisplayPlaneAlphaFlagsKHR; minSrcPosition :VkOffset2D; maxSrcPosition :VkOffset2D; minSrcExtent :VkExtent2D; maxSrcExtent :VkExtent2D; minDstPosition :VkOffset2D; maxDstPosition :VkOffset2D; minDstExtent :VkExtent2D; maxDstExtent :VkExtent2D; end; type P_VkDisplayPlanePropertiesKHR = ^VkDisplayPlanePropertiesKHR; VkDisplayPlanePropertiesKHR = record currentDisplay :VkDisplayKHR; currentStackIndex :T_uint32_t; end; type P_VkDisplayPropertiesKHR = ^VkDisplayPropertiesKHR; VkDisplayPropertiesKHR = record display :VkDisplayKHR; displayName :P_char; physicalDimensions :VkExtent2D; physicalResolution :VkExtent2D; supportedTransforms :VkSurfaceTransformFlagsKHR; planeReorderPossible :VkBool32; persistentContent :VkBool32; end; type P_VkDisplaySurfaceCreateInfoKHR = ^VkDisplaySurfaceCreateInfoKHR; VkDisplaySurfaceCreateInfoKHR = record sType :VkStructureType; pNext :P_void; flags :VkDisplaySurfaceCreateFlagsKHR; displayMode :VkDisplayModeKHR; planeIndex :T_uint32_t; planeStackIndex :T_uint32_t; transform :VkSurfaceTransformFlagBitsKHR; globalAlpha :T_float; alphaMode :VkDisplayPlaneAlphaFlagBitsKHR; imageExtent :VkExtent2D; end; type PFN_vkGetPhysicalDeviceDisplayPropertiesKHR = function( physicalDevice_:VkPhysicalDevice; pPropertyCount_:P_uint32_t; pProperties_:P_VkDisplayPropertiesKHR ) :VkResult; type PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR = function( physicalDevice_:VkPhysicalDevice; pPropertyCount_:P_uint32_t; pProperties_:P_VkDisplayPlanePropertiesKHR ) :VkResult; type PFN_vkGetDisplayPlaneSupportedDisplaysKHR = function( physicalDevice_:VkPhysicalDevice; planeIndex_:T_uint32_t; pDisplayCount_:P_uint32_t; pDisplays_:P_VkDisplayKHR ) :VkResult; type PFN_vkGetDisplayModePropertiesKHR = function( physicalDevice_:VkPhysicalDevice; display_:VkDisplayKHR; pPropertyCount_:P_uint32_t; pProperties_:P_VkDisplayModePropertiesKHR ) :VkResult; type PFN_vkCreateDisplayModeKHR = function( physicalDevice_:VkPhysicalDevice; display_:VkDisplayKHR; const pCreateInfo_:P_VkDisplayModeCreateInfoKHR; const pAllocator_:P_VkAllocationCallbacks; pMode_:P_VkDisplayModeKHR ) :VkResult; type PFN_vkGetDisplayPlaneCapabilitiesKHR = function( physicalDevice_:VkPhysicalDevice; mode_:VkDisplayModeKHR; planeIndex_:T_uint32_t; pCapabilities_:P_VkDisplayPlaneCapabilitiesKHR ) :VkResult; type PFN_vkCreateDisplayPlaneSurfaceKHR = function( instance_:VkInstance; const pCreateInfo_:P_VkDisplaySurfaceCreateInfoKHR; const pAllocator_:P_VkAllocationCallbacks; pSurface_:P_VkSurfaceKHR ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetPhysicalDeviceDisplayPropertiesKHR( physicalDevice_ :VkPhysicalDevice; pPropertyCount_ :P_uint32_t; pProperties_ :P_VkDisplayPropertiesKHR ) :VkResult; stdcall; external DLLNAME; function vkGetPhysicalDeviceDisplayPlanePropertiesKHR( physicalDevice_ :VkPhysicalDevice; pPropertyCount_ :P_uint32_t; pProperties_ :P_VkDisplayPlanePropertiesKHR ) :VkResult; stdcall; external DLLNAME; function vkGetDisplayPlaneSupportedDisplaysKHR( physicalDevice_ :VkPhysicalDevice; planeIndex_ :T_uint32_t; pDisplayCount_ :P_uint32_t; pDisplays_ :P_VkDisplayKHR ) :VkResult; stdcall; external DLLNAME; function vkGetDisplayModePropertiesKHR( physicalDevice_ :VkPhysicalDevice; display_ :VkDisplayKHR; pPropertyCount_ :P_uint32_t; pProperties_ :P_VkDisplayModePropertiesKHR ) :VkResult; stdcall; external DLLNAME; function vkCreateDisplayModeKHR( physicalDevice_ :VkPhysicalDevice; display_ :VkDisplayKHR; pCreateInfo_ :P_VkDisplayModeCreateInfoKHR; pAllocator_ :P_VkAllocationCallbacks; pMode_ :P_VkDisplayModeKHR ) :VkResult; stdcall; external DLLNAME; function vkGetDisplayPlaneCapabilitiesKHR( physicalDevice_ :VkPhysicalDevice; mode_ :VkDisplayModeKHR; planeIndex_ :T_uint32_t; pCapabilities_ :P_VkDisplayPlaneCapabilitiesKHR ) :VkResult; stdcall; external DLLNAME; function vkCreateDisplayPlaneSurfaceKHR( instance_ :VkInstance; pCreateInfo_ :P_VkDisplaySurfaceCreateInfoKHR; pAllocator_ :P_VkAllocationCallbacks; pSurface_ :P_VkSurfaceKHR ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_display_swapchain = 1; const VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION = 10; const VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME = 'VK_KHR_display_swapchain'; type P_VkDisplayPresentInfoKHR = ^VkDisplayPresentInfoKHR; VkDisplayPresentInfoKHR = record sType :VkStructureType; pNext :P_void; srcRect :VkRect2D; dstRect :VkRect2D; persistent :VkBool32; end; type PFN_vkCreateSharedSwapchainsKHR = function( device_:VkDevice; swapchainCount_:T_uint32_t; const pCreateInfos_:P_VkSwapchainCreateInfoKHR; const pAllocator_:P_VkAllocationCallbacks; pSwapchains_:P_VkSwapchainKHR ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkCreateSharedSwapchainsKHR( device_ :VkDevice; swapchainCount_ :T_uint32_t; pCreateInfos_ :P_VkSwapchainCreateInfoKHR; pAllocator_ :P_VkAllocationCallbacks; pSwapchains_ :P_VkSwapchainKHR ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_sampler_mirror_clamp_to_edge = 1; const VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION = 3; const VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME = 'VK_KHR_sampler_mirror_clamp_to_edge'; const VK_KHR_multiview = 1; const VK_KHR_MULTIVIEW_SPEC_VERSION = 1; const VK_KHR_MULTIVIEW_EXTENSION_NAME = 'VK_KHR_multiview'; type P_VkRenderPassMultiviewCreateInfoKHR = ^VkRenderPassMultiviewCreateInfoKHR; VkRenderPassMultiviewCreateInfoKHR = VkRenderPassMultiviewCreateInfo; type P_VkPhysicalDeviceMultiviewFeaturesKHR = ^VkPhysicalDeviceMultiviewFeaturesKHR; VkPhysicalDeviceMultiviewFeaturesKHR = VkPhysicalDeviceMultiviewFeatures; type P_VkPhysicalDeviceMultiviewPropertiesKHR = ^VkPhysicalDeviceMultiviewPropertiesKHR; VkPhysicalDeviceMultiviewPropertiesKHR = VkPhysicalDeviceMultiviewProperties; const VK_KHR_get_physical_device_properties2 = 1; const VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION = 2; const VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME = 'VK_KHR_get_physical_device_properties2'; type P_VkPhysicalDeviceFeatures2KHR = ^VkPhysicalDeviceFeatures2KHR; VkPhysicalDeviceFeatures2KHR = VkPhysicalDeviceFeatures2; type P_VkPhysicalDeviceProperties2KHR = ^VkPhysicalDeviceProperties2KHR; VkPhysicalDeviceProperties2KHR = VkPhysicalDeviceProperties2; type P_VkFormatProperties2KHR = ^VkFormatProperties2KHR; VkFormatProperties2KHR = VkFormatProperties2; type P_VkImageFormatProperties2KHR = ^VkImageFormatProperties2KHR; VkImageFormatProperties2KHR = VkImageFormatProperties2; type P_VkPhysicalDeviceImageFormatInfo2KHR = ^VkPhysicalDeviceImageFormatInfo2KHR; VkPhysicalDeviceImageFormatInfo2KHR = VkPhysicalDeviceImageFormatInfo2; type P_VkQueueFamilyProperties2KHR = ^VkQueueFamilyProperties2KHR; VkQueueFamilyProperties2KHR = VkQueueFamilyProperties2; type P_VkPhysicalDeviceMemoryProperties2KHR = ^VkPhysicalDeviceMemoryProperties2KHR; VkPhysicalDeviceMemoryProperties2KHR = VkPhysicalDeviceMemoryProperties2; type P_VkSparseImageFormatProperties2KHR = ^VkSparseImageFormatProperties2KHR; VkSparseImageFormatProperties2KHR = VkSparseImageFormatProperties2; type P_VkPhysicalDeviceSparseImageFormatInfo2KHR = ^VkPhysicalDeviceSparseImageFormatInfo2KHR; VkPhysicalDeviceSparseImageFormatInfo2KHR = VkPhysicalDeviceSparseImageFormatInfo2; type PFN_vkGetPhysicalDeviceFeatures2KHR = procedure( physicalDevice_:VkPhysicalDevice; pFeatures_:P_VkPhysicalDeviceFeatures2 ); type PFN_vkGetPhysicalDeviceProperties2KHR = procedure( physicalDevice_:VkPhysicalDevice; pProperties_:P_VkPhysicalDeviceProperties2 ); type PFN_vkGetPhysicalDeviceFormatProperties2KHR = procedure( physicalDevice_:VkPhysicalDevice; format_:VkFormat; pFormatProperties_:P_VkFormatProperties2 ); type PFN_vkGetPhysicalDeviceImageFormatProperties2KHR = function( physicalDevice_:VkPhysicalDevice; const pImageFormatInfo_:P_VkPhysicalDeviceImageFormatInfo2; pImageFormatProperties_:P_VkImageFormatProperties2 ) :VkResult; type PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR = procedure( physicalDevice_:VkPhysicalDevice; pQueueFamilyPropertyCount_:P_uint32_t; pQueueFamilyProperties_:P_VkQueueFamilyProperties2 ); type PFN_vkGetPhysicalDeviceMemoryProperties2KHR = procedure( physicalDevice_:VkPhysicalDevice; pMemoryProperties_:P_VkPhysicalDeviceMemoryProperties2 ); type PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR = procedure( physicalDevice_:VkPhysicalDevice; const pFormatInfo_:P_VkPhysicalDeviceSparseImageFormatInfo2; pPropertyCount_:P_uint32_t; pProperties_:P_VkSparseImageFormatProperties2 ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkGetPhysicalDeviceFeatures2KHR( physicalDevice_ :VkPhysicalDevice; pFeatures_ :P_VkPhysicalDeviceFeatures2 ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceProperties2KHR( physicalDevice_ :VkPhysicalDevice; pProperties_ :P_VkPhysicalDeviceProperties2 ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceFormatProperties2KHR( physicalDevice_ :VkPhysicalDevice; format_ :VkFormat; pFormatProperties_ :P_VkFormatProperties2 ); stdcall; external DLLNAME; function vkGetPhysicalDeviceImageFormatProperties2KHR( physicalDevice_ :VkPhysicalDevice; pImageFormatInfo_ :P_VkPhysicalDeviceImageFormatInfo2; pImageFormatProperties_ :P_VkImageFormatProperties2 ) :VkResult; stdcall; external DLLNAME; procedure vkGetPhysicalDeviceQueueFamilyProperties2KHR( physicalDevice_ :VkPhysicalDevice; pQueueFamilyPropertyCount_ :P_uint32_t; pQueueFamilyProperties_ :P_VkQueueFamilyProperties2 ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceMemoryProperties2KHR( physicalDevice_ :VkPhysicalDevice; pMemoryProperties_ :P_VkPhysicalDeviceMemoryProperties2 ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceSparseImageFormatProperties2KHR( physicalDevice_ :VkPhysicalDevice; pFormatInfo_ :P_VkPhysicalDeviceSparseImageFormatInfo2; pPropertyCount_ :P_uint32_t; pProperties_ :P_VkSparseImageFormatProperties2 ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_device_group = 1; const VK_KHR_DEVICE_GROUP_SPEC_VERSION = 4; const VK_KHR_DEVICE_GROUP_EXTENSION_NAME = 'VK_KHR_device_group'; type P_VkPeerMemoryFeatureFlagsKHR = ^VkPeerMemoryFeatureFlagsKHR; VkPeerMemoryFeatureFlagsKHR = VkPeerMemoryFeatureFlags; type P_VkPeerMemoryFeatureFlagBitsKHR = ^VkPeerMemoryFeatureFlagBitsKHR; VkPeerMemoryFeatureFlagBitsKHR = VkPeerMemoryFeatureFlagBits; type P_VkMemoryAllocateFlagsKHR = ^VkMemoryAllocateFlagsKHR; VkMemoryAllocateFlagsKHR = VkMemoryAllocateFlags; type P_VkMemoryAllocateFlagBitsKHR = ^VkMemoryAllocateFlagBitsKHR; VkMemoryAllocateFlagBitsKHR = VkMemoryAllocateFlagBits; type P_VkMemoryAllocateFlagsInfoKHR = ^VkMemoryAllocateFlagsInfoKHR; VkMemoryAllocateFlagsInfoKHR = VkMemoryAllocateFlagsInfo; type P_VkDeviceGroupRenderPassBeginInfoKHR = ^VkDeviceGroupRenderPassBeginInfoKHR; VkDeviceGroupRenderPassBeginInfoKHR = VkDeviceGroupRenderPassBeginInfo; type P_VkDeviceGroupCommandBufferBeginInfoKHR = ^VkDeviceGroupCommandBufferBeginInfoKHR; VkDeviceGroupCommandBufferBeginInfoKHR = VkDeviceGroupCommandBufferBeginInfo; type P_VkDeviceGroupSubmitInfoKHR = ^VkDeviceGroupSubmitInfoKHR; VkDeviceGroupSubmitInfoKHR = VkDeviceGroupSubmitInfo; type P_VkDeviceGroupBindSparseInfoKHR = ^VkDeviceGroupBindSparseInfoKHR; VkDeviceGroupBindSparseInfoKHR = VkDeviceGroupBindSparseInfo; type P_VkBindBufferMemoryDeviceGroupInfoKHR = ^VkBindBufferMemoryDeviceGroupInfoKHR; VkBindBufferMemoryDeviceGroupInfoKHR = VkBindBufferMemoryDeviceGroupInfo; type P_VkBindImageMemoryDeviceGroupInfoKHR = ^VkBindImageMemoryDeviceGroupInfoKHR; VkBindImageMemoryDeviceGroupInfoKHR = VkBindImageMemoryDeviceGroupInfo; type PFN_vkGetDeviceGroupPeerMemoryFeaturesKHR = procedure( device_:VkDevice; heapIndex_:T_uint32_t; localDeviceIndex_:T_uint32_t; remoteDeviceIndex_:T_uint32_t; pPeerMemoryFeatures_:P_VkPeerMemoryFeatureFlags ); type PFN_vkCmdSetDeviceMaskKHR = procedure( commandBuffer_:VkCommandBuffer; deviceMask_:T_uint32_t ); type PFN_vkCmdDispatchBaseKHR = procedure( commandBuffer_:VkCommandBuffer; baseGroupX_:T_uint32_t; baseGroupY_:T_uint32_t; baseGroupZ_:T_uint32_t; groupCountX_:T_uint32_t; groupCountY_:T_uint32_t; groupCountZ_:T_uint32_t ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkGetDeviceGroupPeerMemoryFeaturesKHR( device_ :VkDevice; heapIndex_ :T_uint32_t; localDeviceIndex_ :T_uint32_t; remoteDeviceIndex_ :T_uint32_t; pPeerMemoryFeatures_ :P_VkPeerMemoryFeatureFlags ); stdcall; external DLLNAME; procedure vkCmdSetDeviceMaskKHR( commandBuffer_ :VkCommandBuffer; deviceMask_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDispatchBaseKHR( commandBuffer_ :VkCommandBuffer; baseGroupX_ :T_uint32_t; baseGroupY_ :T_uint32_t; baseGroupZ_ :T_uint32_t; groupCountX_ :T_uint32_t; groupCountY_ :T_uint32_t; groupCountZ_ :T_uint32_t ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_shader_draw_parameters = 1; const VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION = 1; const VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME = 'VK_KHR_shader_draw_parameters'; const VK_KHR_maintenance1 = 1; const VK_KHR_MAINTENANCE1_SPEC_VERSION = 2; const VK_KHR_MAINTENANCE1_EXTENSION_NAME = 'VK_KHR_maintenance1'; type P_VkCommandPoolTrimFlagsKHR = ^VkCommandPoolTrimFlagsKHR; VkCommandPoolTrimFlagsKHR = VkCommandPoolTrimFlags; type PFN_vkTrimCommandPoolKHR = procedure( device_:VkDevice; commandPool_:VkCommandPool; flags_:VkCommandPoolTrimFlags ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkTrimCommandPoolKHR( device_ :VkDevice; commandPool_ :VkCommandPool; flags_ :VkCommandPoolTrimFlags ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_device_group_creation = 1; const VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION = 1; const VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME = 'VK_KHR_device_group_creation'; const VK_MAX_DEVICE_GROUP_SIZE_KHR = VK_MAX_DEVICE_GROUP_SIZE; type P_VkPhysicalDeviceGroupPropertiesKHR = ^VkPhysicalDeviceGroupPropertiesKHR; VkPhysicalDeviceGroupPropertiesKHR = VkPhysicalDeviceGroupProperties; type P_VkDeviceGroupDeviceCreateInfoKHR = ^VkDeviceGroupDeviceCreateInfoKHR; VkDeviceGroupDeviceCreateInfoKHR = VkDeviceGroupDeviceCreateInfo; type PFN_vkEnumeratePhysicalDeviceGroupsKHR = function( instance_:VkInstance; pPhysicalDeviceGroupCount_:P_uint32_t; pPhysicalDeviceGroupProperties_:P_VkPhysicalDeviceGroupProperties ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkEnumeratePhysicalDeviceGroupsKHR( instance_ :VkInstance; pPhysicalDeviceGroupCount_ :P_uint32_t; pPhysicalDeviceGroupProperties_ :P_VkPhysicalDeviceGroupProperties ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_external_memory_capabilities = 1; const VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION = 1; const VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME = 'VK_KHR_external_memory_capabilities'; const VK_LUID_SIZE_KHR = VK_LUID_SIZE; type P_VkExternalMemoryHandleTypeFlagsKHR = ^VkExternalMemoryHandleTypeFlagsKHR; VkExternalMemoryHandleTypeFlagsKHR = VkExternalMemoryHandleTypeFlags; type P_VkExternalMemoryHandleTypeFlagBitsKHR = ^VkExternalMemoryHandleTypeFlagBitsKHR; VkExternalMemoryHandleTypeFlagBitsKHR = VkExternalMemoryHandleTypeFlagBits; type P_VkExternalMemoryFeatureFlagsKHR = ^VkExternalMemoryFeatureFlagsKHR; VkExternalMemoryFeatureFlagsKHR = VkExternalMemoryFeatureFlags; type P_VkExternalMemoryFeatureFlagBitsKHR = ^VkExternalMemoryFeatureFlagBitsKHR; VkExternalMemoryFeatureFlagBitsKHR = VkExternalMemoryFeatureFlagBits; type P_VkExternalMemoryPropertiesKHR = ^VkExternalMemoryPropertiesKHR; VkExternalMemoryPropertiesKHR = VkExternalMemoryProperties; type P_VkPhysicalDeviceExternalImageFormatInfoKHR = ^VkPhysicalDeviceExternalImageFormatInfoKHR; VkPhysicalDeviceExternalImageFormatInfoKHR = VkPhysicalDeviceExternalImageFormatInfo; type P_VkExternalImageFormatPropertiesKHR = ^VkExternalImageFormatPropertiesKHR; VkExternalImageFormatPropertiesKHR = VkExternalImageFormatProperties; type P_VkPhysicalDeviceExternalBufferInfoKHR = ^VkPhysicalDeviceExternalBufferInfoKHR; VkPhysicalDeviceExternalBufferInfoKHR = VkPhysicalDeviceExternalBufferInfo; type P_VkExternalBufferPropertiesKHR = ^VkExternalBufferPropertiesKHR; VkExternalBufferPropertiesKHR = VkExternalBufferProperties; type P_VkPhysicalDeviceIDPropertiesKHR = ^VkPhysicalDeviceIDPropertiesKHR; VkPhysicalDeviceIDPropertiesKHR = VkPhysicalDeviceIDProperties; type PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR = procedure( physicalDevice_:VkPhysicalDevice; const pExternalBufferInfo_:P_VkPhysicalDeviceExternalBufferInfo; pExternalBufferProperties_:P_VkExternalBufferProperties ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkGetPhysicalDeviceExternalBufferPropertiesKHR( physicalDevice_ :VkPhysicalDevice; pExternalBufferInfo_ :P_VkPhysicalDeviceExternalBufferInfo; pExternalBufferProperties_ :P_VkExternalBufferProperties ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_external_memory = 1; const VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION = 1; const VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME = 'VK_KHR_external_memory'; const VK_QUEUE_FAMILY_EXTERNAL_KHR = VK_QUEUE_FAMILY_EXTERNAL; type P_VkExternalMemoryImageCreateInfoKHR = ^VkExternalMemoryImageCreateInfoKHR; VkExternalMemoryImageCreateInfoKHR = VkExternalMemoryImageCreateInfo; type P_VkExternalMemoryBufferCreateInfoKHR = ^VkExternalMemoryBufferCreateInfoKHR; VkExternalMemoryBufferCreateInfoKHR = VkExternalMemoryBufferCreateInfo; type P_VkExportMemoryAllocateInfoKHR = ^VkExportMemoryAllocateInfoKHR; VkExportMemoryAllocateInfoKHR = VkExportMemoryAllocateInfo; const VK_KHR_external_memory_fd = 1; const VK_KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION = 1; const VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME = 'VK_KHR_external_memory_fd'; type P_VkImportMemoryFdInfoKHR = ^VkImportMemoryFdInfoKHR; VkImportMemoryFdInfoKHR = record sType :VkStructureType; pNext :P_void; handleType :VkExternalMemoryHandleTypeFlagBits; fd :T_int; end; type P_VkMemoryFdPropertiesKHR = ^VkMemoryFdPropertiesKHR; VkMemoryFdPropertiesKHR = record sType :VkStructureType; pNext :P_void; memoryTypeBits :T_uint32_t; end; type P_VkMemoryGetFdInfoKHR = ^VkMemoryGetFdInfoKHR; VkMemoryGetFdInfoKHR = record sType :VkStructureType; pNext :P_void; memory :VkDeviceMemory; handleType :VkExternalMemoryHandleTypeFlagBits; end; type PFN_vkGetMemoryFdKHR = function( device_:VkDevice; const pGetFdInfo_:P_VkMemoryGetFdInfoKHR; pFd_:P_int ) :VkResult; type PFN_vkGetMemoryFdPropertiesKHR = function( device_:VkDevice; handleType_:VkExternalMemoryHandleTypeFlagBits; fd_:T_int; pMemoryFdProperties_:P_VkMemoryFdPropertiesKHR ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetMemoryFdKHR( device_ :VkDevice; pGetFdInfo_ :P_VkMemoryGetFdInfoKHR; pFd_ :P_int ) :VkResult; stdcall; external DLLNAME; function vkGetMemoryFdPropertiesKHR( device_ :VkDevice; handleType_ :VkExternalMemoryHandleTypeFlagBits; fd_ :T_int; pMemoryFdProperties_ :P_VkMemoryFdPropertiesKHR ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_external_semaphore_capabilities = 1; const VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION = 1; const VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME = 'VK_KHR_external_semaphore_capabilities'; type P_VkExternalSemaphoreHandleTypeFlagsKHR = ^VkExternalSemaphoreHandleTypeFlagsKHR; VkExternalSemaphoreHandleTypeFlagsKHR = VkExternalSemaphoreHandleTypeFlags; type P_VkExternalSemaphoreHandleTypeFlagBitsKHR = ^VkExternalSemaphoreHandleTypeFlagBitsKHR; VkExternalSemaphoreHandleTypeFlagBitsKHR = VkExternalSemaphoreHandleTypeFlagBits; type P_VkExternalSemaphoreFeatureFlagsKHR = ^VkExternalSemaphoreFeatureFlagsKHR; VkExternalSemaphoreFeatureFlagsKHR = VkExternalSemaphoreFeatureFlags; type P_VkExternalSemaphoreFeatureFlagBitsKHR = ^VkExternalSemaphoreFeatureFlagBitsKHR; VkExternalSemaphoreFeatureFlagBitsKHR = VkExternalSemaphoreFeatureFlagBits; type P_VkPhysicalDeviceExternalSemaphoreInfoKHR = ^VkPhysicalDeviceExternalSemaphoreInfoKHR; VkPhysicalDeviceExternalSemaphoreInfoKHR = VkPhysicalDeviceExternalSemaphoreInfo; type P_VkExternalSemaphorePropertiesKHR = ^VkExternalSemaphorePropertiesKHR; VkExternalSemaphorePropertiesKHR = VkExternalSemaphoreProperties; type PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR = procedure( physicalDevice_:VkPhysicalDevice; const pExternalSemaphoreInfo_:P_VkPhysicalDeviceExternalSemaphoreInfo; pExternalSemaphoreProperties_:P_VkExternalSemaphoreProperties ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkGetPhysicalDeviceExternalSemaphorePropertiesKHR( physicalDevice_ :VkPhysicalDevice; pExternalSemaphoreInfo_ :P_VkPhysicalDeviceExternalSemaphoreInfo; pExternalSemaphoreProperties_ :P_VkExternalSemaphoreProperties ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_external_semaphore = 1; const VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION = 1; const VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME = 'VK_KHR_external_semaphore'; type P_VkSemaphoreImportFlagsKHR = ^VkSemaphoreImportFlagsKHR; VkSemaphoreImportFlagsKHR = VkSemaphoreImportFlags; type P_VkSemaphoreImportFlagBitsKHR = ^VkSemaphoreImportFlagBitsKHR; VkSemaphoreImportFlagBitsKHR = VkSemaphoreImportFlagBits; type P_VkExportSemaphoreCreateInfoKHR = ^VkExportSemaphoreCreateInfoKHR; VkExportSemaphoreCreateInfoKHR = VkExportSemaphoreCreateInfo; const VK_KHR_external_semaphore_fd = 1; const VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION = 1; const VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME = 'VK_KHR_external_semaphore_fd'; type P_VkImportSemaphoreFdInfoKHR = ^VkImportSemaphoreFdInfoKHR; VkImportSemaphoreFdInfoKHR = record sType :VkStructureType; pNext :P_void; semaphore :VkSemaphore; flags :VkSemaphoreImportFlags; handleType :VkExternalSemaphoreHandleTypeFlagBits; fd :T_int; end; type P_VkSemaphoreGetFdInfoKHR = ^VkSemaphoreGetFdInfoKHR; VkSemaphoreGetFdInfoKHR = record sType :VkStructureType; pNext :P_void; semaphore :VkSemaphore; handleType :VkExternalSemaphoreHandleTypeFlagBits; end; type PFN_vkImportSemaphoreFdKHR = function( device_:VkDevice; const pImportSemaphoreFdInfo_:P_VkImportSemaphoreFdInfoKHR ) :VkResult; type PFN_vkGetSemaphoreFdKHR = function( device_:VkDevice; const pGetFdInfo_:P_VkSemaphoreGetFdInfoKHR; pFd_:P_int ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkImportSemaphoreFdKHR( device_ :VkDevice; pImportSemaphoreFdInfo_ :P_VkImportSemaphoreFdInfoKHR ) :VkResult; stdcall; external DLLNAME; function vkGetSemaphoreFdKHR( device_ :VkDevice; pGetFdInfo_ :P_VkSemaphoreGetFdInfoKHR; pFd_ :P_int ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_push_descriptor = 1; const VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION = 2; const VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME = 'VK_KHR_push_descriptor'; type P_VkPhysicalDevicePushDescriptorPropertiesKHR = ^VkPhysicalDevicePushDescriptorPropertiesKHR; VkPhysicalDevicePushDescriptorPropertiesKHR = record sType :VkStructureType; pNext :P_void; maxPushDescriptors :T_uint32_t; end; type PFN_vkCmdPushDescriptorSetKHR = procedure( commandBuffer_:VkCommandBuffer; pipelineBindPoint_:VkPipelineBindPoint; layout_:VkPipelineLayout; set_:T_uint32_t; descriptorWriteCount_:T_uint32_t; const pDescriptorWrites_:P_VkWriteDescriptorSet ); type PFN_vkCmdPushDescriptorSetWithTemplateKHR = procedure( commandBuffer_:VkCommandBuffer; descriptorUpdateTemplate_:VkDescriptorUpdateTemplate; layout_:VkPipelineLayout; set_:T_uint32_t; const pData_:P_void ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdPushDescriptorSetKHR( commandBuffer_ :VkCommandBuffer; pipelineBindPoint_ :VkPipelineBindPoint; layout_ :VkPipelineLayout; set_ :T_uint32_t; descriptorWriteCount_ :T_uint32_t; pDescriptorWrites_ :P_VkWriteDescriptorSet ); stdcall; external DLLNAME; procedure vkCmdPushDescriptorSetWithTemplateKHR( commandBuffer_ :VkCommandBuffer; descriptorUpdateTemplate_ :VkDescriptorUpdateTemplate; layout_ :VkPipelineLayout; set_ :T_uint32_t; pData_ :P_void ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_shader_float16_int8 = 1; const VK_KHR_SHADER_FLOAT16_INT8_SPEC_VERSION = 1; const VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME = 'VK_KHR_shader_float16_int8'; type P_VkPhysicalDeviceShaderFloat16Int8FeaturesKHR = ^VkPhysicalDeviceShaderFloat16Int8FeaturesKHR; VkPhysicalDeviceShaderFloat16Int8FeaturesKHR = VkPhysicalDeviceShaderFloat16Int8Features; type P_VkPhysicalDeviceFloat16Int8FeaturesKHR = ^VkPhysicalDeviceFloat16Int8FeaturesKHR; VkPhysicalDeviceFloat16Int8FeaturesKHR = VkPhysicalDeviceShaderFloat16Int8Features; const VK_KHR_16bit_storage = 1; const VK_KHR_16BIT_STORAGE_SPEC_VERSION = 1; const VK_KHR_16BIT_STORAGE_EXTENSION_NAME = 'VK_KHR_16bit_storage'; type P_VkPhysicalDevice16BitStorageFeaturesKHR = ^VkPhysicalDevice16BitStorageFeaturesKHR; VkPhysicalDevice16BitStorageFeaturesKHR = VkPhysicalDevice16BitStorageFeatures; const VK_KHR_incremental_present = 1; const VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION = 1; const VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME = 'VK_KHR_incremental_present'; type P_VkRectLayerKHR = ^VkRectLayerKHR; VkRectLayerKHR = record offset :VkOffset2D; extent :VkExtent2D; layer :T_uint32_t; end; type P_VkPresentRegionKHR = ^VkPresentRegionKHR; VkPresentRegionKHR = record rectangleCount :T_uint32_t; pRectangles :P_VkRectLayerKHR; end; type P_VkPresentRegionsKHR = ^VkPresentRegionsKHR; VkPresentRegionsKHR = record sType :VkStructureType; pNext :P_void; swapchainCount :T_uint32_t; pRegions :P_VkPresentRegionKHR; end; const VK_KHR_descriptor_update_template = 1; type P_VkDescriptorUpdateTemplateKHR = ^VkDescriptorUpdateTemplateKHR; VkDescriptorUpdateTemplateKHR = VkDescriptorUpdateTemplate; const VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION = 1; const VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME = 'VK_KHR_descriptor_update_template'; type P_VkDescriptorUpdateTemplateTypeKHR = ^VkDescriptorUpdateTemplateTypeKHR; VkDescriptorUpdateTemplateTypeKHR = VkDescriptorUpdateTemplateType; type P_VkDescriptorUpdateTemplateCreateFlagsKHR = ^VkDescriptorUpdateTemplateCreateFlagsKHR; VkDescriptorUpdateTemplateCreateFlagsKHR = VkDescriptorUpdateTemplateCreateFlags; type P_VkDescriptorUpdateTemplateEntryKHR = ^VkDescriptorUpdateTemplateEntryKHR; VkDescriptorUpdateTemplateEntryKHR = VkDescriptorUpdateTemplateEntry; type P_VkDescriptorUpdateTemplateCreateInfoKHR = ^VkDescriptorUpdateTemplateCreateInfoKHR; VkDescriptorUpdateTemplateCreateInfoKHR = VkDescriptorUpdateTemplateCreateInfo; type PFN_vkCreateDescriptorUpdateTemplateKHR = function( device_:VkDevice; const pCreateInfo_:P_VkDescriptorUpdateTemplateCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pDescriptorUpdateTemplate_:P_VkDescriptorUpdateTemplate ) :VkResult; type PFN_vkDestroyDescriptorUpdateTemplateKHR = procedure( device_:VkDevice; descriptorUpdateTemplate_:VkDescriptorUpdateTemplate; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkUpdateDescriptorSetWithTemplateKHR = procedure( device_:VkDevice; descriptorSet_:VkDescriptorSet; descriptorUpdateTemplate_:VkDescriptorUpdateTemplate; const pData_:P_void ); {$IFNDEF VK_NO_PROTOTYPES } function vkCreateDescriptorUpdateTemplateKHR( device_ :VkDevice; pCreateInfo_ :P_VkDescriptorUpdateTemplateCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pDescriptorUpdateTemplate_ :P_VkDescriptorUpdateTemplate ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyDescriptorUpdateTemplateKHR( device_ :VkDevice; descriptorUpdateTemplate_ :VkDescriptorUpdateTemplate; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; procedure vkUpdateDescriptorSetWithTemplateKHR( device_ :VkDevice; descriptorSet_ :VkDescriptorSet; descriptorUpdateTemplate_ :VkDescriptorUpdateTemplate; pData_ :P_void ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_imageless_framebuffer = 1; const VK_KHR_IMAGELESS_FRAMEBUFFER_SPEC_VERSION = 1; const VK_KHR_IMAGELESS_FRAMEBUFFER_EXTENSION_NAME = 'VK_KHR_imageless_framebuffer'; type P_VkPhysicalDeviceImagelessFramebufferFeaturesKHR = ^VkPhysicalDeviceImagelessFramebufferFeaturesKHR; VkPhysicalDeviceImagelessFramebufferFeaturesKHR = VkPhysicalDeviceImagelessFramebufferFeatures; type P_VkFramebufferAttachmentsCreateInfoKHR = ^VkFramebufferAttachmentsCreateInfoKHR; VkFramebufferAttachmentsCreateInfoKHR = VkFramebufferAttachmentsCreateInfo; type P_VkFramebufferAttachmentImageInfoKHR = ^VkFramebufferAttachmentImageInfoKHR; VkFramebufferAttachmentImageInfoKHR = VkFramebufferAttachmentImageInfo; type P_VkRenderPassAttachmentBeginInfoKHR = ^VkRenderPassAttachmentBeginInfoKHR; VkRenderPassAttachmentBeginInfoKHR = VkRenderPassAttachmentBeginInfo; const VK_KHR_create_renderpass2 = 1; const VK_KHR_CREATE_RENDERPASS_2_SPEC_VERSION = 1; const VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME = 'VK_KHR_create_renderpass2'; type P_VkRenderPassCreateInfo2KHR = ^VkRenderPassCreateInfo2KHR; VkRenderPassCreateInfo2KHR = VkRenderPassCreateInfo2; type P_VkAttachmentDescription2KHR = ^VkAttachmentDescription2KHR; VkAttachmentDescription2KHR = VkAttachmentDescription2; type P_VkAttachmentReference2KHR = ^VkAttachmentReference2KHR; VkAttachmentReference2KHR = VkAttachmentReference2; type P_VkSubpassDescription2KHR = ^VkSubpassDescription2KHR; VkSubpassDescription2KHR = VkSubpassDescription2; type P_VkSubpassDependency2KHR = ^VkSubpassDependency2KHR; VkSubpassDependency2KHR = VkSubpassDependency2; type P_VkSubpassBeginInfoKHR = ^VkSubpassBeginInfoKHR; VkSubpassBeginInfoKHR = VkSubpassBeginInfo; type P_VkSubpassEndInfoKHR = ^VkSubpassEndInfoKHR; VkSubpassEndInfoKHR = VkSubpassEndInfo; type PFN_vkCreateRenderPass2KHR = function( device_:VkDevice; const pCreateInfo_:P_VkRenderPassCreateInfo2; const pAllocator_:P_VkAllocationCallbacks; pRenderPass_:P_VkRenderPass ) :VkResult; type PFN_vkCmdBeginRenderPass2KHR = procedure( commandBuffer_:VkCommandBuffer; const pRenderPassBegin_:P_VkRenderPassBeginInfo; const pSubpassBeginInfo_:P_VkSubpassBeginInfo ); type PFN_vkCmdNextSubpass2KHR = procedure( commandBuffer_:VkCommandBuffer; const pSubpassBeginInfo_:P_VkSubpassBeginInfo; const pSubpassEndInfo_:P_VkSubpassEndInfo ); type PFN_vkCmdEndRenderPass2KHR = procedure( commandBuffer_:VkCommandBuffer; const pSubpassEndInfo_:P_VkSubpassEndInfo ); {$IFNDEF VK_NO_PROTOTYPES } function vkCreateRenderPass2KHR( device_ :VkDevice; pCreateInfo_ :P_VkRenderPassCreateInfo2; pAllocator_ :P_VkAllocationCallbacks; pRenderPass_ :P_VkRenderPass ) :VkResult; stdcall; external DLLNAME; procedure vkCmdBeginRenderPass2KHR( commandBuffer_ :VkCommandBuffer; pRenderPassBegin_ :P_VkRenderPassBeginInfo; pSubpassBeginInfo_ :P_VkSubpassBeginInfo ); stdcall; external DLLNAME; procedure vkCmdNextSubpass2KHR( commandBuffer_ :VkCommandBuffer; pSubpassBeginInfo_ :P_VkSubpassBeginInfo; pSubpassEndInfo_ :P_VkSubpassEndInfo ); stdcall; external DLLNAME; procedure vkCmdEndRenderPass2KHR( commandBuffer_ :VkCommandBuffer; pSubpassEndInfo_ :P_VkSubpassEndInfo ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_shared_presentable_image = 1; const VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION = 1; const VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME = 'VK_KHR_shared_presentable_image'; type P_VkSharedPresentSurfaceCapabilitiesKHR = ^VkSharedPresentSurfaceCapabilitiesKHR; VkSharedPresentSurfaceCapabilitiesKHR = record sType :VkStructureType; pNext :P_void; sharedPresentSupportedUsageFlags :VkImageUsageFlags; end; type PFN_vkGetSwapchainStatusKHR = function( device_:VkDevice; swapchain_:VkSwapchainKHR ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetSwapchainStatusKHR( device_ :VkDevice; swapchain_ :VkSwapchainKHR ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_external_fence_capabilities = 1; const VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION = 1; const VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME = 'VK_KHR_external_fence_capabilities'; type P_VkExternalFenceHandleTypeFlagsKHR = ^VkExternalFenceHandleTypeFlagsKHR; VkExternalFenceHandleTypeFlagsKHR = VkExternalFenceHandleTypeFlags; type P_VkExternalFenceHandleTypeFlagBitsKHR = ^VkExternalFenceHandleTypeFlagBitsKHR; VkExternalFenceHandleTypeFlagBitsKHR = VkExternalFenceHandleTypeFlagBits; type P_VkExternalFenceFeatureFlagsKHR = ^VkExternalFenceFeatureFlagsKHR; VkExternalFenceFeatureFlagsKHR = VkExternalFenceFeatureFlags; type P_VkExternalFenceFeatureFlagBitsKHR = ^VkExternalFenceFeatureFlagBitsKHR; VkExternalFenceFeatureFlagBitsKHR = VkExternalFenceFeatureFlagBits; type P_VkPhysicalDeviceExternalFenceInfoKHR = ^VkPhysicalDeviceExternalFenceInfoKHR; VkPhysicalDeviceExternalFenceInfoKHR = VkPhysicalDeviceExternalFenceInfo; type P_VkExternalFencePropertiesKHR = ^VkExternalFencePropertiesKHR; VkExternalFencePropertiesKHR = VkExternalFenceProperties; type PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR = procedure( physicalDevice_:VkPhysicalDevice; const pExternalFenceInfo_:P_VkPhysicalDeviceExternalFenceInfo; pExternalFenceProperties_:P_VkExternalFenceProperties ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkGetPhysicalDeviceExternalFencePropertiesKHR( physicalDevice_ :VkPhysicalDevice; pExternalFenceInfo_ :P_VkPhysicalDeviceExternalFenceInfo; pExternalFenceProperties_ :P_VkExternalFenceProperties ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_external_fence = 1; const VK_KHR_EXTERNAL_FENCE_SPEC_VERSION = 1; const VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME = 'VK_KHR_external_fence'; type P_VkFenceImportFlagsKHR = ^VkFenceImportFlagsKHR; VkFenceImportFlagsKHR = VkFenceImportFlags; type P_VkFenceImportFlagBitsKHR = ^VkFenceImportFlagBitsKHR; VkFenceImportFlagBitsKHR = VkFenceImportFlagBits; type P_VkExportFenceCreateInfoKHR = ^VkExportFenceCreateInfoKHR; VkExportFenceCreateInfoKHR = VkExportFenceCreateInfo; const VK_KHR_external_fence_fd = 1; const VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION = 1; const VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME = 'VK_KHR_external_fence_fd'; type P_VkImportFenceFdInfoKHR = ^VkImportFenceFdInfoKHR; VkImportFenceFdInfoKHR = record sType :VkStructureType; pNext :P_void; fence :VkFence; flags :VkFenceImportFlags; handleType :VkExternalFenceHandleTypeFlagBits; fd :T_int; end; type P_VkFenceGetFdInfoKHR = ^VkFenceGetFdInfoKHR; VkFenceGetFdInfoKHR = record sType :VkStructureType; pNext :P_void; fence :VkFence; handleType :VkExternalFenceHandleTypeFlagBits; end; type PFN_vkImportFenceFdKHR = function( device_:VkDevice; const pImportFenceFdInfo_:P_VkImportFenceFdInfoKHR ) :VkResult; type PFN_vkGetFenceFdKHR = function( device_:VkDevice; const pGetFdInfo_:P_VkFenceGetFdInfoKHR; pFd_:P_int ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkImportFenceFdKHR( device_ :VkDevice; pImportFenceFdInfo_ :P_VkImportFenceFdInfoKHR ) :VkResult; stdcall; external DLLNAME; function vkGetFenceFdKHR( device_ :VkDevice; pGetFdInfo_ :P_VkFenceGetFdInfoKHR; pFd_ :P_int ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_performance_query = 1; const VK_KHR_PERFORMANCE_QUERY_SPEC_VERSION = 1; const VK_KHR_PERFORMANCE_QUERY_EXTENSION_NAME = 'VK_KHR_performance_query'; type P_VkPerformanceCounterUnitKHR = ^VkPerformanceCounterUnitKHR; VkPerformanceCounterUnitKHR = ( VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR = 0, VK_PERFORMANCE_COUNTER_UNIT_PERCENTAGE_KHR = 1, VK_PERFORMANCE_COUNTER_UNIT_NANOSECONDS_KHR = 2, VK_PERFORMANCE_COUNTER_UNIT_BYTES_KHR = 3, VK_PERFORMANCE_COUNTER_UNIT_BYTES_PER_SECOND_KHR = 4, VK_PERFORMANCE_COUNTER_UNIT_KELVIN_KHR = 5, VK_PERFORMANCE_COUNTER_UNIT_WATTS_KHR = 6, VK_PERFORMANCE_COUNTER_UNIT_VOLTS_KHR = 7, VK_PERFORMANCE_COUNTER_UNIT_AMPS_KHR = 8, VK_PERFORMANCE_COUNTER_UNIT_HERTZ_KHR = 9, VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR = 10, VK_PERFORMANCE_COUNTER_UNIT_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkPerformanceCounterScopeKHR = ^VkPerformanceCounterScopeKHR; VkPerformanceCounterScopeKHR = ( VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_BUFFER_KHR = 0, VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR = 1, VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_KHR = 2, VK_QUERY_SCOPE_COMMAND_BUFFER_KHR = VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_BUFFER_KHR, VK_QUERY_SCOPE_RENDER_PASS_KHR = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR, VK_QUERY_SCOPE_COMMAND_KHR = VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_KHR, VK_PERFORMANCE_COUNTER_SCOPE_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkPerformanceCounterStorageKHR = ^VkPerformanceCounterStorageKHR; VkPerformanceCounterStorageKHR = ( VK_PERFORMANCE_COUNTER_STORAGE_INT32_KHR = 0, VK_PERFORMANCE_COUNTER_STORAGE_INT64_KHR = 1, VK_PERFORMANCE_COUNTER_STORAGE_UINT32_KHR = 2, VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR = 3, VK_PERFORMANCE_COUNTER_STORAGE_FLOAT32_KHR = 4, VK_PERFORMANCE_COUNTER_STORAGE_FLOAT64_KHR = 5, VK_PERFORMANCE_COUNTER_STORAGE_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkPerformanceCounterDescriptionFlagBitsKHR = ^VkPerformanceCounterDescriptionFlagBitsKHR; VkPerformanceCounterDescriptionFlagBitsKHR = ( VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_BIT_KHR = $00000001, VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_BIT_KHR = $00000002, VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_KHR = VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_BIT_KHR, VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_KHR = VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_BIT_KHR, VK_PERFORMANCE_COUNTER_DESCRIPTION_FLAG_BITS_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkPerformanceCounterDescriptionFlagsKHR = ^VkPerformanceCounterDescriptionFlagsKHR; VkPerformanceCounterDescriptionFlagsKHR = VkFlags; type P_VkAcquireProfilingLockFlagBitsKHR = ^VkAcquireProfilingLockFlagBitsKHR; VkAcquireProfilingLockFlagBitsKHR = ( VK_ACQUIRE_PROFILING_LOCK_FLAG_BITS_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkAcquireProfilingLockFlagsKHR = ^VkAcquireProfilingLockFlagsKHR; VkAcquireProfilingLockFlagsKHR = VkFlags; type P_VkPhysicalDevicePerformanceQueryFeaturesKHR = ^VkPhysicalDevicePerformanceQueryFeaturesKHR; VkPhysicalDevicePerformanceQueryFeaturesKHR = record sType :VkStructureType; pNext :P_void; performanceCounterQueryPools :VkBool32; performanceCounterMultipleQueryPools :VkBool32; end; type P_VkPhysicalDevicePerformanceQueryPropertiesKHR = ^VkPhysicalDevicePerformanceQueryPropertiesKHR; VkPhysicalDevicePerformanceQueryPropertiesKHR = record sType :VkStructureType; pNext :P_void; allowCommandBufferQueryCopies :VkBool32; end; type P_VkPerformanceCounterKHR = ^VkPerformanceCounterKHR; VkPerformanceCounterKHR = record sType :VkStructureType; pNext :P_void; unit_ :VkPerformanceCounterUnitKHR; scope :VkPerformanceCounterScopeKHR; storage :VkPerformanceCounterStorageKHR; uuid :array [ 0..VK_UUID_SIZE-1 ] of T_uint8_t; end; type P_VkPerformanceCounterDescriptionKHR = ^VkPerformanceCounterDescriptionKHR; VkPerformanceCounterDescriptionKHR = record sType :VkStructureType; pNext :P_void; flags :VkPerformanceCounterDescriptionFlagsKHR; name :array [ 0..VK_MAX_DESCRIPTION_SIZE-1 ] of T_char; category :array [ 0..VK_MAX_DESCRIPTION_SIZE-1 ] of T_char; description :array [ 0..VK_MAX_DESCRIPTION_SIZE-1 ] of T_char; end; type P_VkQueryPoolPerformanceCreateInfoKHR = ^VkQueryPoolPerformanceCreateInfoKHR; VkQueryPoolPerformanceCreateInfoKHR = record sType :VkStructureType; pNext :P_void; queueFamilyIndex :T_uint32_t; counterIndexCount :T_uint32_t; pCounterIndices :P_uint32_t; end; type P_VkPerformanceCounterResultKHR = ^VkPerformanceCounterResultKHR; VkPerformanceCounterResultKHR = record case Byte of 0:( int32 :T_int32_t ); 1:( int64 :T_int64_t ); 2:( uint32 :T_uint32_t ); 3:( uint64 :T_uint64_t ); 4:( float32 :T_float ); 5:( float64 :double ); end; type P_VkAcquireProfilingLockInfoKHR = ^VkAcquireProfilingLockInfoKHR; VkAcquireProfilingLockInfoKHR = record sType :VkStructureType; pNext :P_void; flags :VkAcquireProfilingLockFlagsKHR; timeout :T_uint64_t; end; type P_VkPerformanceQuerySubmitInfoKHR = ^VkPerformanceQuerySubmitInfoKHR; VkPerformanceQuerySubmitInfoKHR = record sType :VkStructureType; pNext :P_void; counterPassIndex :T_uint32_t; end; type PFN_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR = function( physicalDevice_:VkPhysicalDevice; queueFamilyIndex_:T_uint32_t; pCounterCount_:P_uint32_t; pCounters_:P_VkPerformanceCounterKHR; pCounterDescriptions_:P_VkPerformanceCounterDescriptionKHR ) :VkResult; type PFN_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR = procedure( physicalDevice_:VkPhysicalDevice; const pPerformanceQueryCreateInfo_:P_VkQueryPoolPerformanceCreateInfoKHR; pNumPasses_:P_uint32_t ); type PFN_vkAcquireProfilingLockKHR = function( device_:VkDevice; const pInfo_:P_VkAcquireProfilingLockInfoKHR ) :VkResult; type PFN_vkReleaseProfilingLockKHR = procedure( device_:VkDevice ); {$IFNDEF VK_NO_PROTOTYPES } function vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR( physicalDevice_ :VkPhysicalDevice; queueFamilyIndex_ :T_uint32_t; pCounterCount_ :P_uint32_t; pCounters_ :P_VkPerformanceCounterKHR; pCounterDescriptions_ :P_VkPerformanceCounterDescriptionKHR ) :VkResult; stdcall; external DLLNAME; procedure vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR( physicalDevice_ :VkPhysicalDevice; pPerformanceQueryCreateInfo_ :P_VkQueryPoolPerformanceCreateInfoKHR; pNumPasses_ :P_uint32_t ); stdcall; external DLLNAME; function vkAcquireProfilingLockKHR( device_ :VkDevice; pInfo_ :P_VkAcquireProfilingLockInfoKHR ) :VkResult; stdcall; external DLLNAME; procedure vkReleaseProfilingLockKHR( device_ :VkDevice ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_maintenance2 = 1; const VK_KHR_MAINTENANCE2_SPEC_VERSION = 1; const VK_KHR_MAINTENANCE2_EXTENSION_NAME = 'VK_KHR_maintenance2'; type P_VkPointClippingBehaviorKHR = ^VkPointClippingBehaviorKHR; VkPointClippingBehaviorKHR = VkPointClippingBehavior; type P_VkTessellationDomainOriginKHR = ^VkTessellationDomainOriginKHR; VkTessellationDomainOriginKHR = VkTessellationDomainOrigin; type P_VkPhysicalDevicePointClippingPropertiesKHR = ^VkPhysicalDevicePointClippingPropertiesKHR; VkPhysicalDevicePointClippingPropertiesKHR = VkPhysicalDevicePointClippingProperties; type P_VkRenderPassInputAttachmentAspectCreateInfoKHR = ^VkRenderPassInputAttachmentAspectCreateInfoKHR; VkRenderPassInputAttachmentAspectCreateInfoKHR = VkRenderPassInputAttachmentAspectCreateInfo; type P_VkInputAttachmentAspectReferenceKHR = ^VkInputAttachmentAspectReferenceKHR; VkInputAttachmentAspectReferenceKHR = VkInputAttachmentAspectReference; type P_VkImageViewUsageCreateInfoKHR = ^VkImageViewUsageCreateInfoKHR; VkImageViewUsageCreateInfoKHR = VkImageViewUsageCreateInfo; type P_VkPipelineTessellationDomainOriginStateCreateInfoKHR = ^VkPipelineTessellationDomainOriginStateCreateInfoKHR; VkPipelineTessellationDomainOriginStateCreateInfoKHR = VkPipelineTessellationDomainOriginStateCreateInfo; const VK_KHR_get_surface_capabilities2 = 1; const VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION = 1; const VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME = 'VK_KHR_get_surface_capabilities2'; type P_VkPhysicalDeviceSurfaceInfo2KHR = ^VkPhysicalDeviceSurfaceInfo2KHR; VkPhysicalDeviceSurfaceInfo2KHR = record sType :VkStructureType; pNext :P_void; surface :VkSurfaceKHR; end; type P_VkSurfaceCapabilities2KHR = ^VkSurfaceCapabilities2KHR; VkSurfaceCapabilities2KHR = record sType :VkStructureType; pNext :P_void; surfaceCapabilities :VkSurfaceCapabilitiesKHR; end; type P_VkSurfaceFormat2KHR = ^VkSurfaceFormat2KHR; VkSurfaceFormat2KHR = record sType :VkStructureType; pNext :P_void; surfaceFormat :VkSurfaceFormatKHR; end; type PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR = function( physicalDevice_:VkPhysicalDevice; const pSurfaceInfo_:P_VkPhysicalDeviceSurfaceInfo2KHR; pSurfaceCapabilities_:P_VkSurfaceCapabilities2KHR ) :VkResult; type PFN_vkGetPhysicalDeviceSurfaceFormats2KHR = function( physicalDevice_:VkPhysicalDevice; const pSurfaceInfo_:P_VkPhysicalDeviceSurfaceInfo2KHR; pSurfaceFormatCount_:P_uint32_t; pSurfaceFormats_:P_VkSurfaceFormat2KHR ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetPhysicalDeviceSurfaceCapabilities2KHR( physicalDevice_ :VkPhysicalDevice; pSurfaceInfo_ :P_VkPhysicalDeviceSurfaceInfo2KHR; pSurfaceCapabilities_ :P_VkSurfaceCapabilities2KHR ) :VkResult; stdcall; external DLLNAME; function vkGetPhysicalDeviceSurfaceFormats2KHR( physicalDevice_ :VkPhysicalDevice; pSurfaceInfo_ :P_VkPhysicalDeviceSurfaceInfo2KHR; pSurfaceFormatCount_ :P_uint32_t; pSurfaceFormats_ :P_VkSurfaceFormat2KHR ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_variable_pointers = 1; const VK_KHR_VARIABLE_POINTERS_SPEC_VERSION = 1; const VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME = 'VK_KHR_variable_pointers'; type P_VkPhysicalDeviceVariablePointerFeaturesKHR = ^VkPhysicalDeviceVariablePointerFeaturesKHR; VkPhysicalDeviceVariablePointerFeaturesKHR = VkPhysicalDeviceVariablePointersFeatures; type P_VkPhysicalDeviceVariablePointersFeaturesKHR = ^VkPhysicalDeviceVariablePointersFeaturesKHR; VkPhysicalDeviceVariablePointersFeaturesKHR = VkPhysicalDeviceVariablePointersFeatures; const VK_KHR_get_display_properties2 = 1; const VK_KHR_GET_DISPLAY_PROPERTIES_2_SPEC_VERSION = 1; const VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME = 'VK_KHR_get_display_properties2'; type P_VkDisplayProperties2KHR = ^VkDisplayProperties2KHR; VkDisplayProperties2KHR = record sType :VkStructureType; pNext :P_void; displayProperties :VkDisplayPropertiesKHR; end; type P_VkDisplayPlaneProperties2KHR = ^VkDisplayPlaneProperties2KHR; VkDisplayPlaneProperties2KHR = record sType :VkStructureType; pNext :P_void; displayPlaneProperties :VkDisplayPlanePropertiesKHR; end; type P_VkDisplayModeProperties2KHR = ^VkDisplayModeProperties2KHR; VkDisplayModeProperties2KHR = record sType :VkStructureType; pNext :P_void; displayModeProperties :VkDisplayModePropertiesKHR; end; type P_VkDisplayPlaneInfo2KHR = ^VkDisplayPlaneInfo2KHR; VkDisplayPlaneInfo2KHR = record sType :VkStructureType; pNext :P_void; mode :VkDisplayModeKHR; planeIndex :T_uint32_t; end; type P_VkDisplayPlaneCapabilities2KHR = ^VkDisplayPlaneCapabilities2KHR; VkDisplayPlaneCapabilities2KHR = record sType :VkStructureType; pNext :P_void; capabilities :VkDisplayPlaneCapabilitiesKHR; end; type PFN_vkGetPhysicalDeviceDisplayProperties2KHR = function( physicalDevice_:VkPhysicalDevice; pPropertyCount_:P_uint32_t; pProperties_:P_VkDisplayProperties2KHR ) :VkResult; type PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR = function( physicalDevice_:VkPhysicalDevice; pPropertyCount_:P_uint32_t; pProperties_:P_VkDisplayPlaneProperties2KHR ) :VkResult; type PFN_vkGetDisplayModeProperties2KHR = function( physicalDevice_:VkPhysicalDevice; display_:VkDisplayKHR; pPropertyCount_:P_uint32_t; pProperties_:P_VkDisplayModeProperties2KHR ) :VkResult; type PFN_vkGetDisplayPlaneCapabilities2KHR = function( physicalDevice_:VkPhysicalDevice; const pDisplayPlaneInfo_:P_VkDisplayPlaneInfo2KHR; pCapabilities_:P_VkDisplayPlaneCapabilities2KHR ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetPhysicalDeviceDisplayProperties2KHR( physicalDevice_ :VkPhysicalDevice; pPropertyCount_ :P_uint32_t; pProperties_ :P_VkDisplayProperties2KHR ) :VkResult; stdcall; external DLLNAME; function vkGetPhysicalDeviceDisplayPlaneProperties2KHR( physicalDevice_ :VkPhysicalDevice; pPropertyCount_ :P_uint32_t; pProperties_ :P_VkDisplayPlaneProperties2KHR ) :VkResult; stdcall; external DLLNAME; function vkGetDisplayModeProperties2KHR( physicalDevice_ :VkPhysicalDevice; display_ :VkDisplayKHR; pPropertyCount_ :P_uint32_t; pProperties_ :P_VkDisplayModeProperties2KHR ) :VkResult; stdcall; external DLLNAME; function vkGetDisplayPlaneCapabilities2KHR( physicalDevice_ :VkPhysicalDevice; pDisplayPlaneInfo_ :P_VkDisplayPlaneInfo2KHR; pCapabilities_ :P_VkDisplayPlaneCapabilities2KHR ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_dedicated_allocation = 1; const VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION = 3; const VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME = 'VK_KHR_dedicated_allocation'; type P_VkMemoryDedicatedRequirementsKHR = ^VkMemoryDedicatedRequirementsKHR; VkMemoryDedicatedRequirementsKHR = VkMemoryDedicatedRequirements; type P_VkMemoryDedicatedAllocateInfoKHR = ^VkMemoryDedicatedAllocateInfoKHR; VkMemoryDedicatedAllocateInfoKHR = VkMemoryDedicatedAllocateInfo; const VK_KHR_storage_buffer_storage_class = 1; const VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION = 1; const VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME = 'VK_KHR_storage_buffer_storage_class'; const VK_KHR_relaxed_block_layout = 1; const VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION = 1; const VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME = 'VK_KHR_relaxed_block_layout'; const VK_KHR_get_memory_requirements2 = 1; const VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION = 1; const VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME = 'VK_KHR_get_memory_requirements2'; type P_VkBufferMemoryRequirementsInfo2KHR = ^VkBufferMemoryRequirementsInfo2KHR; VkBufferMemoryRequirementsInfo2KHR = VkBufferMemoryRequirementsInfo2; type P_VkImageMemoryRequirementsInfo2KHR = ^VkImageMemoryRequirementsInfo2KHR; VkImageMemoryRequirementsInfo2KHR = VkImageMemoryRequirementsInfo2; type P_VkImageSparseMemoryRequirementsInfo2KHR = ^VkImageSparseMemoryRequirementsInfo2KHR; VkImageSparseMemoryRequirementsInfo2KHR = VkImageSparseMemoryRequirementsInfo2; type P_VkMemoryRequirements2KHR = ^VkMemoryRequirements2KHR; VkMemoryRequirements2KHR = VkMemoryRequirements2; type P_VkSparseImageMemoryRequirements2KHR = ^VkSparseImageMemoryRequirements2KHR; VkSparseImageMemoryRequirements2KHR = VkSparseImageMemoryRequirements2; type PFN_vkGetImageMemoryRequirements2KHR = procedure( device_:VkDevice; const pInfo_:P_VkImageMemoryRequirementsInfo2; pMemoryRequirements_:P_VkMemoryRequirements2 ); type PFN_vkGetBufferMemoryRequirements2KHR = procedure( device_:VkDevice; const pInfo_:P_VkBufferMemoryRequirementsInfo2; pMemoryRequirements_:P_VkMemoryRequirements2 ); type PFN_vkGetImageSparseMemoryRequirements2KHR = procedure( device_:VkDevice; const pInfo_:P_VkImageSparseMemoryRequirementsInfo2; pSparseMemoryRequirementCount_:P_uint32_t; pSparseMemoryRequirements_:P_VkSparseImageMemoryRequirements2 ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkGetImageMemoryRequirements2KHR( device_ :VkDevice; pInfo_ :P_VkImageMemoryRequirementsInfo2; pMemoryRequirements_ :P_VkMemoryRequirements2 ); stdcall; external DLLNAME; procedure vkGetBufferMemoryRequirements2KHR( device_ :VkDevice; pInfo_ :P_VkBufferMemoryRequirementsInfo2; pMemoryRequirements_ :P_VkMemoryRequirements2 ); stdcall; external DLLNAME; procedure vkGetImageSparseMemoryRequirements2KHR( device_ :VkDevice; pInfo_ :P_VkImageSparseMemoryRequirementsInfo2; pSparseMemoryRequirementCount_ :P_uint32_t; pSparseMemoryRequirements_ :P_VkSparseImageMemoryRequirements2 ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_image_format_list = 1; const VK_KHR_IMAGE_FORMAT_LIST_SPEC_VERSION = 1; const VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME = 'VK_KHR_image_format_list'; type P_VkImageFormatListCreateInfoKHR = ^VkImageFormatListCreateInfoKHR; VkImageFormatListCreateInfoKHR = VkImageFormatListCreateInfo; const VK_KHR_sampler_ycbcr_conversion = 1; type P_VkSamplerYcbcrConversionKHR = ^VkSamplerYcbcrConversionKHR; VkSamplerYcbcrConversionKHR = VkSamplerYcbcrConversion; const VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION = 14; const VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME = 'VK_KHR_sampler_ycbcr_conversion'; type P_VkSamplerYcbcrModelConversionKHR = ^VkSamplerYcbcrModelConversionKHR; VkSamplerYcbcrModelConversionKHR = VkSamplerYcbcrModelConversion; type P_VkSamplerYcbcrRangeKHR = ^VkSamplerYcbcrRangeKHR; VkSamplerYcbcrRangeKHR = VkSamplerYcbcrRange; type P_VkChromaLocationKHR = ^VkChromaLocationKHR; VkChromaLocationKHR = VkChromaLocation; type P_VkSamplerYcbcrConversionCreateInfoKHR = ^VkSamplerYcbcrConversionCreateInfoKHR; VkSamplerYcbcrConversionCreateInfoKHR = VkSamplerYcbcrConversionCreateInfo; type P_VkSamplerYcbcrConversionInfoKHR = ^VkSamplerYcbcrConversionInfoKHR; VkSamplerYcbcrConversionInfoKHR = VkSamplerYcbcrConversionInfo; type P_VkBindImagePlaneMemoryInfoKHR = ^VkBindImagePlaneMemoryInfoKHR; VkBindImagePlaneMemoryInfoKHR = VkBindImagePlaneMemoryInfo; type P_VkImagePlaneMemoryRequirementsInfoKHR = ^VkImagePlaneMemoryRequirementsInfoKHR; VkImagePlaneMemoryRequirementsInfoKHR = VkImagePlaneMemoryRequirementsInfo; type P_VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR = ^VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR; VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR = VkPhysicalDeviceSamplerYcbcrConversionFeatures; type P_VkSamplerYcbcrConversionImageFormatPropertiesKHR = ^VkSamplerYcbcrConversionImageFormatPropertiesKHR; VkSamplerYcbcrConversionImageFormatPropertiesKHR = VkSamplerYcbcrConversionImageFormatProperties; type PFN_vkCreateSamplerYcbcrConversionKHR = function( device_:VkDevice; const pCreateInfo_:P_VkSamplerYcbcrConversionCreateInfo; const pAllocator_:P_VkAllocationCallbacks; pYcbcrConversion_:P_VkSamplerYcbcrConversion ) :VkResult; type PFN_vkDestroySamplerYcbcrConversionKHR = procedure( device_:VkDevice; ycbcrConversion_:VkSamplerYcbcrConversion; const pAllocator_:P_VkAllocationCallbacks ); {$IFNDEF VK_NO_PROTOTYPES } function vkCreateSamplerYcbcrConversionKHR( device_ :VkDevice; pCreateInfo_ :P_VkSamplerYcbcrConversionCreateInfo; pAllocator_ :P_VkAllocationCallbacks; pYcbcrConversion_ :P_VkSamplerYcbcrConversion ) :VkResult; stdcall; external DLLNAME; procedure vkDestroySamplerYcbcrConversionKHR( device_ :VkDevice; ycbcrConversion_ :VkSamplerYcbcrConversion; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_bind_memory2 = 1; const VK_KHR_BIND_MEMORY_2_SPEC_VERSION = 1; const VK_KHR_BIND_MEMORY_2_EXTENSION_NAME = 'VK_KHR_bind_memory2'; type P_VkBindBufferMemoryInfoKHR = ^VkBindBufferMemoryInfoKHR; VkBindBufferMemoryInfoKHR = VkBindBufferMemoryInfo; type P_VkBindImageMemoryInfoKHR = ^VkBindImageMemoryInfoKHR; VkBindImageMemoryInfoKHR = VkBindImageMemoryInfo; type PFN_vkBindBufferMemory2KHR = function( device_:VkDevice; bindInfoCount_:T_uint32_t; const pBindInfos_:P_VkBindBufferMemoryInfo ) :VkResult; type PFN_vkBindImageMemory2KHR = function( device_:VkDevice; bindInfoCount_:T_uint32_t; const pBindInfos_:P_VkBindImageMemoryInfo ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkBindBufferMemory2KHR( device_ :VkDevice; bindInfoCount_ :T_uint32_t; pBindInfos_ :P_VkBindBufferMemoryInfo ) :VkResult; stdcall; external DLLNAME; function vkBindImageMemory2KHR( device_ :VkDevice; bindInfoCount_ :T_uint32_t; pBindInfos_ :P_VkBindImageMemoryInfo ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_maintenance3 = 1; const VK_KHR_MAINTENANCE3_SPEC_VERSION = 1; const VK_KHR_MAINTENANCE3_EXTENSION_NAME = 'VK_KHR_maintenance3'; type P_VkPhysicalDeviceMaintenance3PropertiesKHR = ^VkPhysicalDeviceMaintenance3PropertiesKHR; VkPhysicalDeviceMaintenance3PropertiesKHR = VkPhysicalDeviceMaintenance3Properties; type P_VkDescriptorSetLayoutSupportKHR = ^VkDescriptorSetLayoutSupportKHR; VkDescriptorSetLayoutSupportKHR = VkDescriptorSetLayoutSupport; type PFN_vkGetDescriptorSetLayoutSupportKHR = procedure( device_:VkDevice; const pCreateInfo_:P_VkDescriptorSetLayoutCreateInfo; pSupport_:P_VkDescriptorSetLayoutSupport ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkGetDescriptorSetLayoutSupportKHR( device_ :VkDevice; pCreateInfo_ :P_VkDescriptorSetLayoutCreateInfo; pSupport_ :P_VkDescriptorSetLayoutSupport ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_draw_indirect_count = 1; const VK_KHR_DRAW_INDIRECT_COUNT_SPEC_VERSION = 1; const VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME = 'VK_KHR_draw_indirect_count'; type PFN_vkCmdDrawIndirectCountKHR = procedure( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; countBuffer_:VkBuffer; countBufferOffset_:VkDeviceSize; maxDrawCount_:T_uint32_t; stride_:T_uint32_t ); type PFN_vkCmdDrawIndexedIndirectCountKHR = procedure( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; countBuffer_:VkBuffer; countBufferOffset_:VkDeviceSize; maxDrawCount_:T_uint32_t; stride_:T_uint32_t ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdDrawIndirectCountKHR( commandBuffer_ :VkCommandBuffer; buffer_ :VkBuffer; offset_ :VkDeviceSize; countBuffer_ :VkBuffer; countBufferOffset_ :VkDeviceSize; maxDrawCount_ :T_uint32_t; stride_ :T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDrawIndexedIndirectCountKHR( commandBuffer_ :VkCommandBuffer; buffer_ :VkBuffer; offset_ :VkDeviceSize; countBuffer_ :VkBuffer; countBufferOffset_ :VkDeviceSize; maxDrawCount_ :T_uint32_t; stride_ :T_uint32_t ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_shader_subgroup_extended_types = 1; const VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_SPEC_VERSION = 1; const VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_EXTENSION_NAME = 'VK_KHR_shader_subgroup_extended_types'; type P_VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR = ^VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR; VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR = VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures; const VK_KHR_8bit_storage = 1; const VK_KHR_8BIT_STORAGE_SPEC_VERSION = 1; const VK_KHR_8BIT_STORAGE_EXTENSION_NAME = 'VK_KHR_8bit_storage'; type P_VkPhysicalDevice8BitStorageFeaturesKHR = ^VkPhysicalDevice8BitStorageFeaturesKHR; VkPhysicalDevice8BitStorageFeaturesKHR = VkPhysicalDevice8BitStorageFeatures; const VK_KHR_shader_atomic_int64 = 1; const VK_KHR_SHADER_ATOMIC_INT64_SPEC_VERSION = 1; const VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME = 'VK_KHR_shader_atomic_int64'; type P_VkPhysicalDeviceShaderAtomicInt64FeaturesKHR = ^VkPhysicalDeviceShaderAtomicInt64FeaturesKHR; VkPhysicalDeviceShaderAtomicInt64FeaturesKHR = VkPhysicalDeviceShaderAtomicInt64Features; const VK_KHR_shader_clock = 1; const VK_KHR_SHADER_CLOCK_SPEC_VERSION = 1; const VK_KHR_SHADER_CLOCK_EXTENSION_NAME = 'VK_KHR_shader_clock'; type P_VkPhysicalDeviceShaderClockFeaturesKHR = ^VkPhysicalDeviceShaderClockFeaturesKHR; VkPhysicalDeviceShaderClockFeaturesKHR = record sType :VkStructureType; pNext :P_void; shaderSubgroupClock :VkBool32; shaderDeviceClock :VkBool32; end; const VK_KHR_driver_properties = 1; const VK_KHR_DRIVER_PROPERTIES_SPEC_VERSION = 1; const VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME = 'VK_KHR_driver_properties'; const VK_MAX_DRIVER_NAME_SIZE_KHR = VK_MAX_DRIVER_NAME_SIZE; const VK_MAX_DRIVER_INFO_SIZE_KHR = VK_MAX_DRIVER_INFO_SIZE; type P_VkDriverIdKHR = ^VkDriverIdKHR; VkDriverIdKHR = VkDriverId; type P_VkConformanceVersionKHR = ^VkConformanceVersionKHR; VkConformanceVersionKHR = VkConformanceVersion; type P_VkPhysicalDeviceDriverPropertiesKHR = ^VkPhysicalDeviceDriverPropertiesKHR; VkPhysicalDeviceDriverPropertiesKHR = VkPhysicalDeviceDriverProperties; const VK_KHR_shader_float_controls = 1; const VK_KHR_SHADER_FLOAT_CONTROLS_SPEC_VERSION = 4; const VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME = 'VK_KHR_shader_float_controls'; type P_VkShaderFloatControlsIndependenceKHR = ^VkShaderFloatControlsIndependenceKHR; VkShaderFloatControlsIndependenceKHR = VkShaderFloatControlsIndependence; type P_VkPhysicalDeviceFloatControlsPropertiesKHR = ^VkPhysicalDeviceFloatControlsPropertiesKHR; VkPhysicalDeviceFloatControlsPropertiesKHR = VkPhysicalDeviceFloatControlsProperties; const VK_KHR_depth_stencil_resolve = 1; const VK_KHR_DEPTH_STENCIL_RESOLVE_SPEC_VERSION = 1; const VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME = 'VK_KHR_depth_stencil_resolve'; type P_VkResolveModeFlagBitsKHR = ^VkResolveModeFlagBitsKHR; VkResolveModeFlagBitsKHR = VkResolveModeFlagBits; type P_VkResolveModeFlagsKHR = ^VkResolveModeFlagsKHR; VkResolveModeFlagsKHR = VkResolveModeFlags; type P_VkSubpassDescriptionDepthStencilResolveKHR = ^VkSubpassDescriptionDepthStencilResolveKHR; VkSubpassDescriptionDepthStencilResolveKHR = VkSubpassDescriptionDepthStencilResolve; type P_VkPhysicalDeviceDepthStencilResolvePropertiesKHR = ^VkPhysicalDeviceDepthStencilResolvePropertiesKHR; VkPhysicalDeviceDepthStencilResolvePropertiesKHR = VkPhysicalDeviceDepthStencilResolveProperties; const VK_KHR_swapchain_mutable_format = 1; const VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_SPEC_VERSION = 1; const VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME = 'VK_KHR_swapchain_mutable_format'; const VK_KHR_timeline_semaphore = 1; const VK_KHR_TIMELINE_SEMAPHORE_SPEC_VERSION = 2; const VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME = 'VK_KHR_timeline_semaphore'; type P_VkSemaphoreTypeKHR = ^VkSemaphoreTypeKHR; VkSemaphoreTypeKHR = VkSemaphoreType; type P_VkSemaphoreWaitFlagBitsKHR = ^VkSemaphoreWaitFlagBitsKHR; VkSemaphoreWaitFlagBitsKHR = VkSemaphoreWaitFlagBits; type P_VkSemaphoreWaitFlagsKHR = ^VkSemaphoreWaitFlagsKHR; VkSemaphoreWaitFlagsKHR = VkSemaphoreWaitFlags; type P_VkPhysicalDeviceTimelineSemaphoreFeaturesKHR = ^VkPhysicalDeviceTimelineSemaphoreFeaturesKHR; VkPhysicalDeviceTimelineSemaphoreFeaturesKHR = VkPhysicalDeviceTimelineSemaphoreFeatures; type P_VkPhysicalDeviceTimelineSemaphorePropertiesKHR = ^VkPhysicalDeviceTimelineSemaphorePropertiesKHR; VkPhysicalDeviceTimelineSemaphorePropertiesKHR = VkPhysicalDeviceTimelineSemaphoreProperties; type P_VkSemaphoreTypeCreateInfoKHR = ^VkSemaphoreTypeCreateInfoKHR; VkSemaphoreTypeCreateInfoKHR = VkSemaphoreTypeCreateInfo; type P_VkTimelineSemaphoreSubmitInfoKHR = ^VkTimelineSemaphoreSubmitInfoKHR; VkTimelineSemaphoreSubmitInfoKHR = VkTimelineSemaphoreSubmitInfo; type P_VkSemaphoreWaitInfoKHR = ^VkSemaphoreWaitInfoKHR; VkSemaphoreWaitInfoKHR = VkSemaphoreWaitInfo; type P_VkSemaphoreSignalInfoKHR = ^VkSemaphoreSignalInfoKHR; VkSemaphoreSignalInfoKHR = VkSemaphoreSignalInfo; type PFN_vkGetSemaphoreCounterValueKHR = function( device_:VkDevice; semaphore_:VkSemaphore; pValue_:P_uint64_t ) :VkResult; type PFN_vkWaitSemaphoresKHR = function( device_:VkDevice; const pWaitInfo_:P_VkSemaphoreWaitInfo; timeout_:T_uint64_t ) :VkResult; type PFN_vkSignalSemaphoreKHR = function( device_:VkDevice; const pSignalInfo_:P_VkSemaphoreSignalInfo ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetSemaphoreCounterValueKHR( device_ :VkDevice; semaphore_ :VkSemaphore; pValue_ :P_uint64_t ) :VkResult; stdcall; external DLLNAME; function vkWaitSemaphoresKHR( device_ :VkDevice; pWaitInfo_ :P_VkSemaphoreWaitInfo; timeout_ :T_uint64_t ) :VkResult; stdcall; external DLLNAME; function vkSignalSemaphoreKHR( device_ :VkDevice; pSignalInfo_ :P_VkSemaphoreSignalInfo ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_vulkan_memory_model = 1; const VK_KHR_VULKAN_MEMORY_MODEL_SPEC_VERSION = 3; const VK_KHR_VULKAN_MEMORY_MODEL_EXTENSION_NAME = 'VK_KHR_vulkan_memory_model'; type P_VkPhysicalDeviceVulkanMemoryModelFeaturesKHR = ^VkPhysicalDeviceVulkanMemoryModelFeaturesKHR; VkPhysicalDeviceVulkanMemoryModelFeaturesKHR = VkPhysicalDeviceVulkanMemoryModelFeatures; const VK_KHR_shader_terminate_invocation = 1; const VK_KHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION = 1; const VK_KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME = 'VK_KHR_shader_terminate_invocation'; type P_VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR = ^VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR; VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR = record sType :VkStructureType; pNext :P_void; shaderTerminateInvocation :VkBool32; end; const VK_KHR_fragment_shading_rate = 1; const VK_KHR_FRAGMENT_SHADING_RATE_SPEC_VERSION = 1; const VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME = 'VK_KHR_fragment_shading_rate'; type P_VkFragmentShadingRateCombinerOpKHR = ^VkFragmentShadingRateCombinerOpKHR; VkFragmentShadingRateCombinerOpKHR = ( VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR = 0, VK_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_KHR = 1, VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MIN_KHR = 2, VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MAX_KHR = 3, VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MUL_KHR = 4, VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkFragmentShadingRateAttachmentInfoKHR = ^VkFragmentShadingRateAttachmentInfoKHR; VkFragmentShadingRateAttachmentInfoKHR = record sType :VkStructureType; pNext :P_void; pFragmentShadingRateAttachment :P_VkAttachmentReference2; shadingRateAttachmentTexelSize :VkExtent2D; end; type P_VkPipelineFragmentShadingRateStateCreateInfoKHR = ^VkPipelineFragmentShadingRateStateCreateInfoKHR; VkPipelineFragmentShadingRateStateCreateInfoKHR = record sType :VkStructureType; pNext :P_void; fragmentSize :VkExtent2D; combinerOps :array [ 0..2-1 ] of VkFragmentShadingRateCombinerOpKHR; end; type P_VkPhysicalDeviceFragmentShadingRateFeaturesKHR = ^VkPhysicalDeviceFragmentShadingRateFeaturesKHR; VkPhysicalDeviceFragmentShadingRateFeaturesKHR = record sType :VkStructureType; pNext :P_void; pipelineFragmentShadingRate :VkBool32; primitiveFragmentShadingRate :VkBool32; attachmentFragmentShadingRate :VkBool32; end; type P_VkPhysicalDeviceFragmentShadingRatePropertiesKHR = ^VkPhysicalDeviceFragmentShadingRatePropertiesKHR; VkPhysicalDeviceFragmentShadingRatePropertiesKHR = record sType :VkStructureType; pNext :P_void; minFragmentShadingRateAttachmentTexelSize :VkExtent2D; maxFragmentShadingRateAttachmentTexelSize :VkExtent2D; maxFragmentShadingRateAttachmentTexelSizeAspectRatio :T_uint32_t; primitiveFragmentShadingRateWithMultipleViewports :VkBool32; layeredShadingRateAttachments :VkBool32; fragmentShadingRateNonTrivialCombinerOps :VkBool32; maxFragmentSize :VkExtent2D; maxFragmentSizeAspectRatio :T_uint32_t; maxFragmentShadingRateCoverageSamples :T_uint32_t; maxFragmentShadingRateRasterizationSamples :VkSampleCountFlagBits; fragmentShadingRateWithShaderDepthStencilWrites :VkBool32; fragmentShadingRateWithSampleMask :VkBool32; fragmentShadingRateWithShaderSampleMask :VkBool32; fragmentShadingRateWithConservativeRasterization :VkBool32; fragmentShadingRateWithFragmentShaderInterlock :VkBool32; fragmentShadingRateWithCustomSampleLocations :VkBool32; fragmentShadingRateStrictMultiplyCombiner :VkBool32; end; type P_VkPhysicalDeviceFragmentShadingRateKHR = ^VkPhysicalDeviceFragmentShadingRateKHR; VkPhysicalDeviceFragmentShadingRateKHR = record sType :VkStructureType; pNext :P_void; sampleCounts :VkSampleCountFlags; fragmentSize :VkExtent2D; end; type PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR = function( physicalDevice_:VkPhysicalDevice; pFragmentShadingRateCount_:P_uint32_t; pFragmentShadingRates_:P_VkPhysicalDeviceFragmentShadingRateKHR ) :VkResult; type T_combinerOps = array [ 0..2-1 ] of VkFragmentShadingRateCombinerOpKHR; PFN_vkCmdSetFragmentShadingRateKHR = procedure( commandBuffer_:VkCommandBuffer; const pFragmentSize_:P_VkExtent2D; const combinerOps_:T_combinerOps ); {$IFNDEF VK_NO_PROTOTYPES } function vkGetPhysicalDeviceFragmentShadingRatesKHR( physicalDevice_ :VkPhysicalDevice; pFragmentShadingRateCount_ :P_uint32_t; pFragmentShadingRates_ :P_VkPhysicalDeviceFragmentShadingRateKHR ) :VkResult; stdcall; external DLLNAME; procedure vkCmdSetFragmentShadingRateKHR( commandBuffer_ :VkCommandBuffer; pFragmentSize_ :P_VkExtent2D; const combinerOps_ :T_combinerOps ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_spirv_1_4 = 1; const VK_KHR_SPIRV_1_4_SPEC_VERSION = 1; const VK_KHR_SPIRV_1_4_EXTENSION_NAME = 'VK_KHR_spirv_1_4'; const VK_KHR_surface_protected_capabilities = 1; const VK_KHR_SURFACE_PROTECTED_CAPABILITIES_SPEC_VERSION = 1; const VK_KHR_SURFACE_PROTECTED_CAPABILITIES_EXTENSION_NAME = 'VK_KHR_surface_protected_capabilities'; type P_VkSurfaceProtectedCapabilitiesKHR = ^VkSurfaceProtectedCapabilitiesKHR; VkSurfaceProtectedCapabilitiesKHR = record sType :VkStructureType; pNext :P_void; supportsProtected :VkBool32; end; const VK_KHR_separate_depth_stencil_layouts = 1; const VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_SPEC_VERSION = 1; const VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_EXTENSION_NAME = 'VK_KHR_separate_depth_stencil_layouts'; type P_VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR = ^VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR; VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR = VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures; type P_VkAttachmentReferenceStencilLayoutKHR = ^VkAttachmentReferenceStencilLayoutKHR; VkAttachmentReferenceStencilLayoutKHR = VkAttachmentReferenceStencilLayout; type P_VkAttachmentDescriptionStencilLayoutKHR = ^VkAttachmentDescriptionStencilLayoutKHR; VkAttachmentDescriptionStencilLayoutKHR = VkAttachmentDescriptionStencilLayout; const VK_KHR_uniform_buffer_standard_layout = 1; const VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_SPEC_VERSION = 1; const VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME = 'VK_KHR_uniform_buffer_standard_layout'; type P_VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR = ^VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR; VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR = VkPhysicalDeviceUniformBufferStandardLayoutFeatures; const VK_KHR_buffer_device_address = 1; const VK_KHR_BUFFER_DEVICE_ADDRESS_SPEC_VERSION = 1; const VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME = 'VK_KHR_buffer_device_address'; type P_VkPhysicalDeviceBufferDeviceAddressFeaturesKHR = ^VkPhysicalDeviceBufferDeviceAddressFeaturesKHR; VkPhysicalDeviceBufferDeviceAddressFeaturesKHR = VkPhysicalDeviceBufferDeviceAddressFeatures; type P_VkBufferDeviceAddressInfoKHR = ^VkBufferDeviceAddressInfoKHR; VkBufferDeviceAddressInfoKHR = VkBufferDeviceAddressInfo; type P_VkBufferOpaqueCaptureAddressCreateInfoKHR = ^VkBufferOpaqueCaptureAddressCreateInfoKHR; VkBufferOpaqueCaptureAddressCreateInfoKHR = VkBufferOpaqueCaptureAddressCreateInfo; type P_VkMemoryOpaqueCaptureAddressAllocateInfoKHR = ^VkMemoryOpaqueCaptureAddressAllocateInfoKHR; VkMemoryOpaqueCaptureAddressAllocateInfoKHR = VkMemoryOpaqueCaptureAddressAllocateInfo; type P_VkDeviceMemoryOpaqueCaptureAddressInfoKHR = ^VkDeviceMemoryOpaqueCaptureAddressInfoKHR; VkDeviceMemoryOpaqueCaptureAddressInfoKHR = VkDeviceMemoryOpaqueCaptureAddressInfo; type PFN_vkGetBufferDeviceAddressKHR = function( device_:VkDevice; const pInfo_:P_VkBufferDeviceAddressInfo ) :VkDeviceAddress; type PFN_vkGetBufferOpaqueCaptureAddressKHR = function( device_:VkDevice; const pInfo_:P_VkBufferDeviceAddressInfo ) :T_uint64_t; type PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR = function( device_:VkDevice; const pInfo_:P_VkDeviceMemoryOpaqueCaptureAddressInfo ) :T_uint64_t; {$IFNDEF VK_NO_PROTOTYPES } function vkGetBufferDeviceAddressKHR( device_ :VkDevice; pInfo_ :P_VkBufferDeviceAddressInfo ) :VkDeviceAddress; stdcall; external DLLNAME; function vkGetBufferOpaqueCaptureAddressKHR( device_ :VkDevice; pInfo_ :P_VkBufferDeviceAddressInfo ) :T_uint64_t; stdcall; external DLLNAME; function vkGetDeviceMemoryOpaqueCaptureAddressKHR( device_ :VkDevice; pInfo_ :P_VkDeviceMemoryOpaqueCaptureAddressInfo ) :T_uint64_t; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_deferred_host_operations = 1; type P_VkDeferredOperationKHR = ^VkDeferredOperationKHR; VkDeferredOperationKHR = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_KHR_DEFERRED_HOST_OPERATIONS_SPEC_VERSION = 4; const VK_KHR_DEFERRED_HOST_OPERATIONS_EXTENSION_NAME = 'VK_KHR_deferred_host_operations'; type PFN_vkCreateDeferredOperationKHR = function( device_:VkDevice; const pAllocator_:P_VkAllocationCallbacks; pDeferredOperation_:P_VkDeferredOperationKHR ) :VkResult; type PFN_vkDestroyDeferredOperationKHR = procedure( device_:VkDevice; operation_:VkDeferredOperationKHR; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkGetDeferredOperationMaxConcurrencyKHR = function( device_:VkDevice; operation_:VkDeferredOperationKHR ) :T_uint32_t; type PFN_vkGetDeferredOperationResultKHR = function( device_:VkDevice; operation_:VkDeferredOperationKHR ) :VkResult; type PFN_vkDeferredOperationJoinKHR = function( device_:VkDevice; operation_:VkDeferredOperationKHR ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkCreateDeferredOperationKHR( device_ :VkDevice; pAllocator_ :P_VkAllocationCallbacks; pDeferredOperation_ :P_VkDeferredOperationKHR ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyDeferredOperationKHR( device_ :VkDevice; operation_ :VkDeferredOperationKHR; pAllocator_ :P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkGetDeferredOperationMaxConcurrencyKHR( device_ :VkDevice; operation_ :VkDeferredOperationKHR ) :T_uint32_t; stdcall; external DLLNAME; function vkGetDeferredOperationResultKHR( device_ :VkDevice; operation_ :VkDeferredOperationKHR ) :VkResult; stdcall; external DLLNAME; function vkDeferredOperationJoinKHR( device_ :VkDevice; operation_ :VkDeferredOperationKHR ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_pipeline_executable_properties = 1; const VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_SPEC_VERSION = 1; const VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME = 'VK_KHR_pipeline_executable_properties'; type P_VkPipelineExecutableStatisticFormatKHR = ^VkPipelineExecutableStatisticFormatKHR; VkPipelineExecutableStatisticFormatKHR = ( VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BOOL32_KHR = 0, VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_INT64_KHR = 1, VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR = 2, VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_FLOAT64_KHR = 3, VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR = ^VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR; VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR = record sType :VkStructureType; pNext :P_void; pipelineExecutableInfo :VkBool32; end; type P_VkPipelineInfoKHR = ^VkPipelineInfoKHR; VkPipelineInfoKHR = record sType :VkStructureType; pNext :P_void; pipeline :VkPipeline; end; type P_VkPipelineExecutablePropertiesKHR = ^VkPipelineExecutablePropertiesKHR; VkPipelineExecutablePropertiesKHR = record sType :VkStructureType; pNext :P_void; stages :VkShaderStageFlags; name :array [ 0..VK_MAX_DESCRIPTION_SIZE-1 ] of T_char; description :array [ 0..VK_MAX_DESCRIPTION_SIZE-1 ] of T_char; subgroupSize :T_uint32_t; end; type P_VkPipelineExecutableInfoKHR = ^VkPipelineExecutableInfoKHR; VkPipelineExecutableInfoKHR = record sType :VkStructureType; pNext :P_void; pipeline :VkPipeline; executableIndex :T_uint32_t; end; type P_VkPipelineExecutableStatisticValueKHR = ^VkPipelineExecutableStatisticValueKHR; VkPipelineExecutableStatisticValueKHR = record case Byte of 0:( b32 :VkBool32 ); 1:( i64 :T_int64_t ); 2:( u64 :T_uint64_t ); 3:( f64 :double ); end; type P_VkPipelineExecutableStatisticKHR = ^VkPipelineExecutableStatisticKHR; VkPipelineExecutableStatisticKHR = record sType :VkStructureType; pNext :P_void; name :array [ 0..VK_MAX_DESCRIPTION_SIZE-1 ] of T_char; description :array [ 0..VK_MAX_DESCRIPTION_SIZE-1 ] of T_char; format :VkPipelineExecutableStatisticFormatKHR; value :VkPipelineExecutableStatisticValueKHR; end; type P_VkPipelineExecutableInternalRepresentationKHR = ^VkPipelineExecutableInternalRepresentationKHR; VkPipelineExecutableInternalRepresentationKHR = record sType :VkStructureType; pNext :P_void; name :array [ 0..VK_MAX_DESCRIPTION_SIZE-1 ] of T_char; description :array [ 0..VK_MAX_DESCRIPTION_SIZE-1 ] of T_char; isText :VkBool32; dataSize :T_size_t; pData :P_void; end; type PFN_vkGetPipelineExecutablePropertiesKHR = function( device_:VkDevice; const pPipelineInfo_:P_VkPipelineInfoKHR; pExecutableCount_:P_uint32_t; pProperties_:P_VkPipelineExecutablePropertiesKHR ) :VkResult; type PFN_vkGetPipelineExecutableStatisticsKHR = function( device_:VkDevice; const pExecutableInfo_:P_VkPipelineExecutableInfoKHR; pStatisticCount_:P_uint32_t; pStatistics_:P_VkPipelineExecutableStatisticKHR ) :VkResult; type PFN_vkGetPipelineExecutableInternalRepresentationsKHR = function( device_:VkDevice; const pExecutableInfo_:P_VkPipelineExecutableInfoKHR; pInternalRepresentationCount_:P_uint32_t; pInternalRepresentations_:P_VkPipelineExecutableInternalRepresentationKHR ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetPipelineExecutablePropertiesKHR( device_ :VkDevice; pPipelineInfo_ :P_VkPipelineInfoKHR; pExecutableCount_ :P_uint32_t; pProperties_ :P_VkPipelineExecutablePropertiesKHR ) :VkResult; stdcall; external DLLNAME; function vkGetPipelineExecutableStatisticsKHR( device_ :VkDevice; pExecutableInfo_ :P_VkPipelineExecutableInfoKHR; pStatisticCount_ :P_uint32_t; pStatistics_ :P_VkPipelineExecutableStatisticKHR ) :VkResult; stdcall; external DLLNAME; function vkGetPipelineExecutableInternalRepresentationsKHR( device_ :VkDevice; pExecutableInfo_ :P_VkPipelineExecutableInfoKHR; pInternalRepresentationCount_ :P_uint32_t; pInternalRepresentations_ :P_VkPipelineExecutableInternalRepresentationKHR ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_KHR_pipeline_library = 1; const VK_KHR_PIPELINE_LIBRARY_SPEC_VERSION = 1; const VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME = 'VK_KHR_pipeline_library'; type P_VkPipelineLibraryCreateInfoKHR = ^VkPipelineLibraryCreateInfoKHR; VkPipelineLibraryCreateInfoKHR = record sType :VkStructureType; pNext :P_void; libraryCount :T_uint32_t; pLibraries :P_VkPipeline; end; const VK_KHR_shader_non_semantic_info = 1; const VK_KHR_SHADER_NON_SEMANTIC_INFO_SPEC_VERSION = 1; const VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME = 'VK_KHR_shader_non_semantic_info'; const VK_KHR_synchronization2 = 1; type P_VkFlags64 = ^VkFlags64; VkFlags64 = T_uint64_t; const VK_KHR_SYNCHRONIZATION_2_SPEC_VERSION = 1; const VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME = 'VK_KHR_synchronization2'; type P_VkPipelineStageFlags2KHR = ^VkPipelineStageFlags2KHR; VkPipelineStageFlags2KHR = VkFlags64; // Flag bits for VkPipelineStageFlags2KHR const VK_PIPELINE_STAGE_2_NONE_KHR :VkPipelineStageFlags2KHR = 0; const VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT_KHR :VkPipelineStageFlags2KHR = $00000001; const VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT_KHR :VkPipelineStageFlags2KHR = $00000002; const VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR :VkPipelineStageFlags2KHR = $00000004; const VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT_KHR :VkPipelineStageFlags2KHR = $00000008; const VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT_KHR :VkPipelineStageFlags2KHR = $00000010; const VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT_KHR :VkPipelineStageFlags2KHR = $00000020; const VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT_KHR :VkPipelineStageFlags2KHR = $00000040; const VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT_KHR :VkPipelineStageFlags2KHR = $00000080; const VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT_KHR :VkPipelineStageFlags2KHR = $00000100; const VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT_KHR :VkPipelineStageFlags2KHR = $00000200; const VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR :VkPipelineStageFlags2KHR = $00000400; const VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR :VkPipelineStageFlags2KHR = $00000800; const VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR :VkPipelineStageFlags2KHR = $00001000; const VK_PIPELINE_STAGE_2_TRANSFER_BIT_KHR :VkPipelineStageFlags2KHR = $00001000; const VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT_KHR :VkPipelineStageFlags2KHR = $00002000; const VK_PIPELINE_STAGE_2_HOST_BIT_KHR :VkPipelineStageFlags2KHR = $00004000; const VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR :VkPipelineStageFlags2KHR = $00008000; const VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR :VkPipelineStageFlags2KHR = $00010000; const VK_PIPELINE_STAGE_2_COPY_BIT_KHR :VkPipelineStageFlags2KHR = UInt64( $100000000 ); {ULL} const VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR :VkPipelineStageFlags2KHR = UInt64( $200000000 ); {ULL} const VK_PIPELINE_STAGE_2_BLIT_BIT_KHR :VkPipelineStageFlags2KHR = UInt64( $400000000 ); {ULL} const VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR :VkPipelineStageFlags2KHR = UInt64( $800000000 ); {ULL} const VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT_KHR :VkPipelineStageFlags2KHR = UInt64( $1000000000 ); {ULL} const VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR :VkPipelineStageFlags2KHR = UInt64( $2000000000 ); {ULL} const VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR :VkPipelineStageFlags2KHR = UInt64( $4000000000 ); {ULL} const VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT :VkPipelineStageFlags2KHR = $01000000; const VK_PIPELINE_STAGE_2_CONDITIONAL_RENDERING_BIT_EXT :VkPipelineStageFlags2KHR = $00040000; const VK_PIPELINE_STAGE_2_COMMAND_PREPROCESS_BIT_NV :VkPipelineStageFlags2KHR = $00020000; const VK_PIPELINE_STAGE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR :VkPipelineStageFlags2KHR = $00400000; const VK_PIPELINE_STAGE_2_SHADING_RATE_IMAGE_BIT_NV :VkPipelineStageFlags2KHR = $00400000; const VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR :VkPipelineStageFlags2KHR = $02000000; const VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_KHR :VkPipelineStageFlags2KHR = $00200000; const VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_NV :VkPipelineStageFlags2KHR = $00200000; const VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_NV :VkPipelineStageFlags2KHR = $02000000; const VK_PIPELINE_STAGE_2_FRAGMENT_DENSITY_PROCESS_BIT_EXT :VkPipelineStageFlags2KHR = $00800000; const VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV :VkPipelineStageFlags2KHR = $00080000; const VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV :VkPipelineStageFlags2KHR = $00100000; type P_VkAccessFlags2KHR = ^VkAccessFlags2KHR; VkAccessFlags2KHR = VkFlags64; // Flag bits for VkAccessFlags2KHR const VK_ACCESS_2_NONE_KHR :VkAccessFlags2KHR = 0; const VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT_KHR :VkAccessFlags2KHR = $00000001; const VK_ACCESS_2_INDEX_READ_BIT_KHR :VkAccessFlags2KHR = $00000002; const VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT_KHR :VkAccessFlags2KHR = $00000004; const VK_ACCESS_2_UNIFORM_READ_BIT_KHR :VkAccessFlags2KHR = $00000008; const VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT_KHR :VkAccessFlags2KHR = $00000010; const VK_ACCESS_2_SHADER_READ_BIT_KHR :VkAccessFlags2KHR = $00000020; const VK_ACCESS_2_SHADER_WRITE_BIT_KHR :VkAccessFlags2KHR = $00000040; const VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT_KHR :VkAccessFlags2KHR = $00000080; const VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT_KHR :VkAccessFlags2KHR = $00000100; const VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT_KHR :VkAccessFlags2KHR = $00000200; const VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT_KHR :VkAccessFlags2KHR = $00000400; const VK_ACCESS_2_TRANSFER_READ_BIT_KHR :VkAccessFlags2KHR = $00000800; const VK_ACCESS_2_TRANSFER_WRITE_BIT_KHR :VkAccessFlags2KHR = $00001000; const VK_ACCESS_2_HOST_READ_BIT_KHR :VkAccessFlags2KHR = $00002000; const VK_ACCESS_2_HOST_WRITE_BIT_KHR :VkAccessFlags2KHR = $00004000; const VK_ACCESS_2_MEMORY_READ_BIT_KHR :VkAccessFlags2KHR = $00008000; const VK_ACCESS_2_MEMORY_WRITE_BIT_KHR :VkAccessFlags2KHR = $00010000; const VK_ACCESS_2_SHADER_SAMPLED_READ_BIT_KHR :VkAccessFlags2KHR = UInt64( $100000000 ); {ULL} const VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR :VkAccessFlags2KHR = UInt64( $200000000 ); {ULL} const VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR :VkAccessFlags2KHR = UInt64( $400000000 ); {ULL} const VK_ACCESS_2_TRANSFORM_FEEDBACK_WRITE_BIT_EXT :VkAccessFlags2KHR = $02000000; const VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT :VkAccessFlags2KHR = $04000000; const VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT :VkAccessFlags2KHR = $08000000; const VK_ACCESS_2_CONDITIONAL_RENDERING_READ_BIT_EXT :VkAccessFlags2KHR = $00100000; const VK_ACCESS_2_COMMAND_PREPROCESS_READ_BIT_NV :VkAccessFlags2KHR = $00020000; const VK_ACCESS_2_COMMAND_PREPROCESS_WRITE_BIT_NV :VkAccessFlags2KHR = $00040000; const VK_ACCESS_2_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR :VkAccessFlags2KHR = $00800000; const VK_ACCESS_2_SHADING_RATE_IMAGE_READ_BIT_NV :VkAccessFlags2KHR = $00800000; const VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_KHR :VkAccessFlags2KHR = $00200000; const VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_KHR :VkAccessFlags2KHR = $00400000; const VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_NV :VkAccessFlags2KHR = $00200000; const VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_NV :VkAccessFlags2KHR = $00400000; const VK_ACCESS_2_FRAGMENT_DENSITY_MAP_READ_BIT_EXT :VkAccessFlags2KHR = $01000000; const VK_ACCESS_2_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT :VkAccessFlags2KHR = $00080000; type P_VkSubmitFlagBitsKHR = ^VkSubmitFlagBitsKHR; VkSubmitFlagBitsKHR = ( VK_SUBMIT_PROTECTED_BIT_KHR = $00000001, VK_SUBMIT_FLAG_BITS_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkSubmitFlagsKHR = ^VkSubmitFlagsKHR; VkSubmitFlagsKHR = VkFlags; type P_VkMemoryBarrier2KHR = ^VkMemoryBarrier2KHR; VkMemoryBarrier2KHR = record sType :VkStructureType; pNext :P_void; srcStageMask :VkPipelineStageFlags2KHR; srcAccessMask :VkAccessFlags2KHR; dstStageMask :VkPipelineStageFlags2KHR; dstAccessMask :VkAccessFlags2KHR; end; type P_VkBufferMemoryBarrier2KHR = ^VkBufferMemoryBarrier2KHR; VkBufferMemoryBarrier2KHR = record sType :VkStructureType; pNext :P_void; srcStageMask :VkPipelineStageFlags2KHR; srcAccessMask :VkAccessFlags2KHR; dstStageMask :VkPipelineStageFlags2KHR; dstAccessMask :VkAccessFlags2KHR; srcQueueFamilyIndex :T_uint32_t; dstQueueFamilyIndex :T_uint32_t; buffer :VkBuffer; offset :VkDeviceSize; size :VkDeviceSize; end; type P_VkImageMemoryBarrier2KHR = ^VkImageMemoryBarrier2KHR; VkImageMemoryBarrier2KHR = record sType :VkStructureType; pNext :P_void; srcStageMask :VkPipelineStageFlags2KHR; srcAccessMask :VkAccessFlags2KHR; dstStageMask :VkPipelineStageFlags2KHR; dstAccessMask :VkAccessFlags2KHR; oldLayout :VkImageLayout; newLayout :VkImageLayout; srcQueueFamilyIndex :T_uint32_t; dstQueueFamilyIndex :T_uint32_t; image :VkImage; subresourceRange :VkImageSubresourceRange; end; type P_VkDependencyInfoKHR = ^VkDependencyInfoKHR; VkDependencyInfoKHR = record sType :VkStructureType; pNext :P_void; dependencyFlags :VkDependencyFlags; memoryBarrierCount :T_uint32_t; pMemoryBarriers :P_VkMemoryBarrier2KHR; bufferMemoryBarrierCount :T_uint32_t; pBufferMemoryBarriers :P_VkBufferMemoryBarrier2KHR; imageMemoryBarrierCount :T_uint32_t; pImageMemoryBarriers :P_VkImageMemoryBarrier2KHR; end; type P_VkSemaphoreSubmitInfoKHR = ^VkSemaphoreSubmitInfoKHR; VkSemaphoreSubmitInfoKHR = record sType :VkStructureType; pNext :P_void; semaphore :VkSemaphore; value :T_uint64_t; stageMask :VkPipelineStageFlags2KHR; deviceIndex :T_uint32_t; end; type P_VkCommandBufferSubmitInfoKHR = ^VkCommandBufferSubmitInfoKHR; VkCommandBufferSubmitInfoKHR = record sType :VkStructureType; pNext :P_void; commandBuffer :VkCommandBuffer; deviceMask :T_uint32_t; end; type P_VkSubmitInfo2KHR = ^VkSubmitInfo2KHR; VkSubmitInfo2KHR = record sType :VkStructureType; pNext :P_void; flags :VkSubmitFlagsKHR; waitSemaphoreInfoCount :T_uint32_t; pWaitSemaphoreInfos :P_VkSemaphoreSubmitInfoKHR; commandBufferInfoCount :T_uint32_t; pCommandBufferInfos :P_VkCommandBufferSubmitInfoKHR; signalSemaphoreInfoCount :T_uint32_t; pSignalSemaphoreInfos :P_VkSemaphoreSubmitInfoKHR; end; type P_VkPhysicalDeviceSynchronization2FeaturesKHR = ^VkPhysicalDeviceSynchronization2FeaturesKHR; VkPhysicalDeviceSynchronization2FeaturesKHR = record sType :VkStructureType; pNext :P_void; synchronization2 :VkBool32; end; type P_VkQueueFamilyCheckpointProperties2NV = ^VkQueueFamilyCheckpointProperties2NV; VkQueueFamilyCheckpointProperties2NV = record sType :VkStructureType; pNext :P_void; checkpointExecutionStageMask :VkPipelineStageFlags2KHR; end; type P_VkCheckpointData2NV = ^VkCheckpointData2NV; VkCheckpointData2NV = record sType :VkStructureType; pNext :P_void; stage :VkPipelineStageFlags2KHR; pCheckpointMarker :P_void; end; type PFN_vkCmdSetEvent2KHR = procedure( commandBuffer_:VkCommandBuffer; event_:VkEvent; const pDependencyInfo_:P_VkDependencyInfoKHR ); type PFN_vkCmdResetEvent2KHR = procedure( commandBuffer_:VkCommandBuffer; event_:VkEvent; stageMask_:VkPipelineStageFlags2KHR ); type PFN_vkCmdWaitEvents2KHR = procedure( commandBuffer_:VkCommandBuffer; eventCount_:T_uint32_t; const pEvents_:P_VkEvent; const pDependencyInfos_:P_VkDependencyInfoKHR ); type PFN_vkCmdPipelineBarrier2KHR = procedure( commandBuffer_:VkCommandBuffer; const pDependencyInfo_:P_VkDependencyInfoKHR ); type PFN_vkCmdWriteTimestamp2KHR = procedure( commandBuffer_:VkCommandBuffer; stage_:VkPipelineStageFlags2KHR; queryPool_:VkQueryPool; query_:T_uint32_t ); type PFN_vkQueueSubmit2KHR = function( queue_:VkQueue; submitCount_:T_uint32_t; const pSubmits_:P_VkSubmitInfo2KHR; fence_:VkFence ) :VkResult; type PFN_vkCmdWriteBufferMarker2AMD = procedure( commandBuffer_:VkCommandBuffer; stage_:VkPipelineStageFlags2KHR; dstBuffer_:VkBuffer; dstOffset_:VkDeviceSize; marker_:T_uint32_t ); type PFN_vkGetQueueCheckpointData2NV = procedure( queue_:VkQueue; pCheckpointDataCount_:P_uint32_t; pCheckpointData_:P_VkCheckpointData2NV ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdSetEvent2KHR( commandBuffer_:VkCommandBuffer; event_:VkEvent; pDependencyInfo_:P_VkDependencyInfoKHR ); stdcall; external DLLNAME; procedure vkCmdResetEvent2KHR( commandBuffer_:VkCommandBuffer; event_:VkEvent; stageMask_:VkPipelineStageFlags2KHR ); stdcall; external DLLNAME; procedure vkCmdWaitEvents2KHR( commandBuffer_:VkCommandBuffer; eventCount_:T_uint32_t; pEvents_:P_VkEvent; pDependencyInfos_:P_VkDependencyInfoKHR ); stdcall; external DLLNAME; procedure vkCmdPipelineBarrier2KHR( commandBuffer_:VkCommandBuffer; pDependencyInfo_:P_VkDependencyInfoKHR ); stdcall; external DLLNAME; procedure vkCmdWriteTimestamp2KHR( commandBuffer_:VkCommandBuffer; stage_:VkPipelineStageFlags2KHR; queryPool_:VkQueryPool; query_:T_uint32_t ); stdcall; external DLLNAME; function vkQueueSubmit2KHR( queue_:VkQueue; submitCount_:T_uint32_t; pSubmits_:P_VkSubmitInfo2KHR; fence_:VkFence ) :VkResult; stdcall; external DLLNAME; procedure vkCmdWriteBufferMarker2AMD( commandBuffer_:VkCommandBuffer; stage_:VkPipelineStageFlags2KHR; dstBuffer_:VkBuffer; dstOffset_:VkDeviceSize; marker_:T_uint32_t ); stdcall; external DLLNAME; procedure vkGetQueueCheckpointData2NV( queue_:VkQueue; pCheckpointDataCount_:P_uint32_t; pCheckpointData_:P_VkCheckpointData2NV ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_zero_initialize_workgroup_memory = 1; const VK_KHR_ZERO_INITIALIZE_WORKGROUP_MEMORY_SPEC_VERSION = 1; const VK_KHR_ZERO_INITIALIZE_WORKGROUP_MEMORY_EXTENSION_NAME = 'VK_KHR_zero_initialize_workgroup_memory'; type P_VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR = ^VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR; VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR = record sType :VkStructureType; pNext :P_void; shaderZeroInitializeWorkgroupMemory :VkBool32; end; const VK_KHR_workgroup_memory_explicit_layout = 1; const VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_SPEC_VERSION = 1; const VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_EXTENSION_NAME = 'VK_KHR_workgroup_memory_explicit_layout'; type P_VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR = ^VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR; VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR = record sType :VkStructureType; pNext :P_void; workgroupMemoryExplicitLayout :VkBool32; workgroupMemoryExplicitLayoutScalarBlockLayout :VkBool32; workgroupMemoryExplicitLayout8BitAccess :VkBool32; workgroupMemoryExplicitLayout16BitAccess :VkBool32; end; const VK_KHR_copy_commands2 = 1; const VK_KHR_COPY_COMMANDS_2_SPEC_VERSION = 1; const VK_KHR_COPY_COMMANDS_2_EXTENSION_NAME = 'VK_KHR_copy_commands2'; type P_VkBufferCopy2KHR = ^VkBufferCopy2KHR; VkBufferCopy2KHR = record sType :VkStructureType; pNext :P_void; srcOffset :VkDeviceSize; dstOffset :VkDeviceSize; size :VkDeviceSize; end; type P_VkCopyBufferInfo2KHR = ^VkCopyBufferInfo2KHR; VkCopyBufferInfo2KHR = record sType :VkStructureType; pNext :P_void; srcBuffer :VkBuffer; dstBuffer :VkBuffer; regionCount :T_uint32_t; pRegions :P_VkBufferCopy2KHR; end; type P_VkImageCopy2KHR = ^VkImageCopy2KHR; VkImageCopy2KHR = record sType :VkStructureType; pNext :P_void; srcSubresource :VkImageSubresourceLayers; srcOffset :VkOffset3D; dstSubresource :VkImageSubresourceLayers; dstOffset :VkOffset3D; extent :VkExtent3D; end; type P_VkCopyImageInfo2KHR = ^VkCopyImageInfo2KHR; VkCopyImageInfo2KHR = record sType :VkStructureType; pNext :P_void; srcImage :VkImage; srcImageLayout :VkImageLayout; dstImage :VkImage; dstImageLayout :VkImageLayout; regionCount :T_uint32_t; pRegions :P_VkImageCopy2KHR; end; type P_VkBufferImageCopy2KHR = ^VkBufferImageCopy2KHR; VkBufferImageCopy2KHR = record sType :VkStructureType; pNext :P_void; bufferOffset :VkDeviceSize; bufferRowLength :T_uint32_t; bufferImageHeight :T_uint32_t; imageSubresource :VkImageSubresourceLayers; imageOffset :VkOffset3D; imageExtent :VkExtent3D; end; type P_VkCopyBufferToImageInfo2KHR = ^VkCopyBufferToImageInfo2KHR; VkCopyBufferToImageInfo2KHR = record sType :VkStructureType; pNext :P_void; srcBuffer :VkBuffer; dstImage :VkImage; dstImageLayout :VkImageLayout; regionCount :T_uint32_t; pRegions :P_VkBufferImageCopy2KHR; end; type P_VkCopyImageToBufferInfo2KHR = ^VkCopyImageToBufferInfo2KHR; VkCopyImageToBufferInfo2KHR = record sType :VkStructureType; pNext :P_void; srcImage :VkImage; srcImageLayout :VkImageLayout; dstBuffer :VkBuffer; regionCount :T_uint32_t; pRegions :P_VkBufferImageCopy2KHR; end; type P_VkImageBlit2KHR = ^VkImageBlit2KHR; VkImageBlit2KHR = record sType :VkStructureType; pNext :P_void; srcSubresource :VkImageSubresourceLayers; srcOffsets :array [ 0..2-1 ] of VkOffset3D; dstSubresource :VkImageSubresourceLayers; dstOffsets :array [ 0..2-1 ] of VkOffset3D; end; type P_VkBlitImageInfo2KHR = ^VkBlitImageInfo2KHR; VkBlitImageInfo2KHR = record sType :VkStructureType; pNext :P_void; srcImage :VkImage; srcImageLayout :VkImageLayout; dstImage :VkImage; dstImageLayout :VkImageLayout; regionCount :T_uint32_t; pRegions :P_VkImageBlit2KHR; filter :VkFilter; end; type P_VkImageResolve2KHR = ^VkImageResolve2KHR; VkImageResolve2KHR = record sType :VkStructureType; pNext :P_void; srcSubresource :VkImageSubresourceLayers; srcOffset :VkOffset3D; dstSubresource :VkImageSubresourceLayers; dstOffset :VkOffset3D; extent :VkExtent3D; end; type P_VkResolveImageInfo2KHR = ^VkResolveImageInfo2KHR; VkResolveImageInfo2KHR = record sType :VkStructureType; pNext :P_void; srcImage :VkImage; srcImageLayout :VkImageLayout; dstImage :VkImage; dstImageLayout :VkImageLayout; regionCount :T_uint32_t; pRegions :P_VkImageResolve2KHR; end; type PFN_vkCmdCopyBuffer2KHR = procedure( commandBuffer_:VkCommandBuffer; const pCopyBufferInfo_:P_VkCopyBufferInfo2KHR ); type PFN_vkCmdCopyImage2KHR = procedure( commandBuffer_:VkCommandBuffer; const pCopyImageInfo_:P_VkCopyImageInfo2KHR ); type PFN_vkCmdCopyBufferToImage2KHR = procedure( commandBuffer_:VkCommandBuffer; const pCopyBufferToImageInfo_:P_VkCopyBufferToImageInfo2KHR ); type PFN_vkCmdCopyImageToBuffer2KHR = procedure( commandBuffer_:VkCommandBuffer; const pCopyImageToBufferInfo_:P_VkCopyImageToBufferInfo2KHR ); type PFN_vkCmdBlitImage2KHR = procedure( commandBuffer_:VkCommandBuffer; const pBlitImageInfo_:P_VkBlitImageInfo2KHR ); type PFN_vkCmdResolveImage2KHR = procedure( commandBuffer_:VkCommandBuffer; const pResolveImageInfo_:P_VkResolveImageInfo2KHR ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdCopyBuffer2KHR( commandBuffer_:VkCommandBuffer; pCopyBufferInfo_:P_VkCopyBufferInfo2KHR ); stdcall; external DLLNAME; procedure vkCmdCopyImage2KHR( commandBuffer_:VkCommandBuffer; pCopyImageInfo_:P_VkCopyImageInfo2KHR ); stdcall; external DLLNAME; procedure vkCmdCopyBufferToImage2KHR( commandBuffer_:VkCommandBuffer; pCopyBufferToImageInfo_:P_VkCopyBufferToImageInfo2KHR ); stdcall; external DLLNAME; procedure vkCmdCopyImageToBuffer2KHR( commandBuffer_:VkCommandBuffer; pCopyImageToBufferInfo_:P_VkCopyImageToBufferInfo2KHR ); stdcall; external DLLNAME; procedure vkCmdBlitImage2KHR( commandBuffer_:VkCommandBuffer; pBlitImageInfo_:P_VkBlitImageInfo2KHR ); stdcall; external DLLNAME; procedure vkCmdResolveImage2KHR( commandBuffer_:VkCommandBuffer; pResolveImageInfo_:P_VkResolveImageInfo2KHR ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_debug_report = 1; type P_VkDebugReportCallbackEXT = ^VkDebugReportCallbackEXT; VkDebugReportCallbackEXT = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_EXT_DEBUG_REPORT_SPEC_VERSION = 9; const VK_EXT_DEBUG_REPORT_EXTENSION_NAME = 'VK_EXT_debug_report'; type P_VkDebugReportObjectTypeEXT = ^VkDebugReportObjectTypeEXT; VkDebugReportObjectTypeEXT = ( VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14, VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20, VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27, VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT = 28, VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT = 29, VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT = 30, VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT = 33, VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT = 1000156000, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT = 1000085000, VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR_EXT = 1000150000, VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT = 1000165000, VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkDebugReportFlagBitsEXT = ^VkDebugReportFlagBitsEXT; VkDebugReportFlagBitsEXT = ( VK_DEBUG_REPORT_INFORMATION_BIT_EXT = $00000001, VK_DEBUG_REPORT_WARNING_BIT_EXT = $00000002, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = $00000004, VK_DEBUG_REPORT_ERROR_BIT_EXT = $00000008, VK_DEBUG_REPORT_DEBUG_BIT_EXT = $00000010, VK_DEBUG_REPORT_FLAG_BITS_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkDebugReportFlagsEXT = ^VkDebugReportFlagsEXT; VkDebugReportFlagsEXT = VkFlags; type PFN_vkDebugReportCallbackEXT = function( flags_:VkDebugReportFlagsEXT; objectType_:VkDebugReportObjectTypeEXT; object_:T_uint64_t; location_:T_size_t; messageCode_:T_int32_t; pLayerPrefix_:P_char; pMessage_:P_char; pUserData_:P_void ) :VkBool32; type P_VkDebugReportCallbackCreateInfoEXT = ^VkDebugReportCallbackCreateInfoEXT; VkDebugReportCallbackCreateInfoEXT = record sType :VkStructureType; pNext :P_void; flags :VkDebugReportFlagsEXT; pfnCallback :PFN_vkDebugReportCallbackEXT; pUserData :P_void; end; type PFN_vkCreateDebugReportCallbackEXT = function( instance_:VkInstance; const pCreateInfo_:P_VkDebugReportCallbackCreateInfoEXT; const pAllocator_:P_VkAllocationCallbacks; pCallback_:P_VkDebugReportCallbackEXT ) :VkResult; type PFN_vkDestroyDebugReportCallbackEXT = procedure( instance_:VkInstance; callback_:VkDebugReportCallbackEXT; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkDebugReportMessageEXT = procedure( instance_:VkInstance; flags_:VkDebugReportFlagsEXT; objectType_:VkDebugReportObjectTypeEXT; object_:T_uint64_t; location_:T_size_t; messageCode_:T_int32_t; const pLayerPrefix_:P_char; const pMessage_:P_char ); {$IFNDEF VK_NO_PROTOTYPES } function vkCreateDebugReportCallbackEXT( instance_:VkInstance; pCreateInfo_:P_VkDebugReportCallbackCreateInfoEXT; pAllocator_:P_VkAllocationCallbacks; pCallback_:P_VkDebugReportCallbackEXT ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyDebugReportCallbackEXT( instance_:VkInstance; callback_:VkDebugReportCallbackEXT; pAllocator_:P_VkAllocationCallbacks ); stdcall; external DLLNAME; procedure vkDebugReportMessageEXT( instance_:VkInstance; flags_:VkDebugReportFlagsEXT; objectType_:VkDebugReportObjectTypeEXT; object_:T_uint64_t; location_:T_size_t; messageCode_:T_int32_t; pLayerPrefix_:P_char; pMessage_:P_char ); stdcall; external DLLNAME; {$ENDIF} const VK_NV_glsl_shader = 1; const VK_NV_GLSL_SHADER_SPEC_VERSION = 1; const VK_NV_GLSL_SHADER_EXTENSION_NAME = 'VK_NV_glsl_shader'; const VK_EXT_depth_range_unrestricted = 1; const VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION = 1; const VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME = 'VK_EXT_depth_range_unrestricted'; const VK_IMG_filter_cubic = 1; const VK_IMG_FILTER_CUBIC_SPEC_VERSION = 1; const VK_IMG_FILTER_CUBIC_EXTENSION_NAME = 'VK_IMG_filter_cubic'; const VK_AMD_rasterization_order = 1; const VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION = 1; const VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME = 'VK_AMD_rasterization_order'; type P_VkRasterizationOrderAMD = ^VkRasterizationOrderAMD; VkRasterizationOrderAMD = ( VK_RASTERIZATION_ORDER_STRICT_AMD = 0, VK_RASTERIZATION_ORDER_RELAXED_AMD = 1, VK_RASTERIZATION_ORDER_MAX_ENUM_AMD = $7FFFFFFF ); type P_VkPipelineRasterizationStateRasterizationOrderAMD = ^VkPipelineRasterizationStateRasterizationOrderAMD; VkPipelineRasterizationStateRasterizationOrderAMD = record sType :VkStructureType; pNext :P_void; rasterizationOrder :VkRasterizationOrderAMD; end; const VK_AMD_shader_trinary_minmax = 1; const VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION = 1; const VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME = 'VK_AMD_shader_trinary_minmax'; const VK_AMD_shader_explicit_vertex_parameter = 1; const VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION = 1; const VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME = 'VK_AMD_shader_explicit_vertex_parameter'; const VK_EXT_debug_marker = 1; const VK_EXT_DEBUG_MARKER_SPEC_VERSION = 4; const VK_EXT_DEBUG_MARKER_EXTENSION_NAME = 'VK_EXT_debug_marker'; type P_VkDebugMarkerObjectNameInfoEXT = ^VkDebugMarkerObjectNameInfoEXT; VkDebugMarkerObjectNameInfoEXT = record sType :VkStructureType; pNext :P_void; objectType :VkDebugReportObjectTypeEXT; object_ :T_uint64_t; pObjectName :P_char; end; type P_VkDebugMarkerObjectTagInfoEXT = ^VkDebugMarkerObjectTagInfoEXT; VkDebugMarkerObjectTagInfoEXT = record sType :VkStructureType; pNext :P_void; objectType :VkDebugReportObjectTypeEXT; object_ :T_uint64_t; tagName :T_uint64_t; tagSize :T_size_t; pTag :P_void; end; type P_VkDebugMarkerMarkerInfoEXT = ^VkDebugMarkerMarkerInfoEXT; VkDebugMarkerMarkerInfoEXT = record sType :VkStructureType; pNext :P_void; pMarkerName :P_char; color :array [ 0..4-1 ] of T_float; end; type PFN_vkDebugMarkerSetObjectTagEXT = function( device_:VkDevice; const pTagInfo_:P_VkDebugMarkerObjectTagInfoEXT ) :VkResult; type PFN_vkDebugMarkerSetObjectNameEXT = function( device_:VkDevice; const pNameInfo_:P_VkDebugMarkerObjectNameInfoEXT ) :VkResult; type PFN_vkCmdDebugMarkerBeginEXT = procedure( commandBuffer_:VkCommandBuffer; const pMarkerInfo_:P_VkDebugMarkerMarkerInfoEXT ); type PFN_vkCmdDebugMarkerEndEXT = procedure( commandBuffer_:VkCommandBuffer ); type PFN_vkCmdDebugMarkerInsertEXT = procedure( commandBuffer_:VkCommandBuffer; const pMarkerInfo_:P_VkDebugMarkerMarkerInfoEXT ); {$IFNDEF VK_NO_PROTOTYPES } function vkDebugMarkerSetObjectTagEXT( device_:VkDevice; pTagInfo_:P_VkDebugMarkerObjectTagInfoEXT ) :VkResult; stdcall; external DLLNAME; function vkDebugMarkerSetObjectNameEXT( device_:VkDevice; pNameInfo_:P_VkDebugMarkerObjectNameInfoEXT ) :VkResult; stdcall; external DLLNAME; procedure vkCmdDebugMarkerBeginEXT( commandBuffer_:VkCommandBuffer; pMarkerInfo_:P_VkDebugMarkerMarkerInfoEXT ); stdcall; external DLLNAME; procedure vkCmdDebugMarkerEndEXT( commandBuffer_:VkCommandBuffer ); stdcall; external DLLNAME; procedure vkCmdDebugMarkerInsertEXT( commandBuffer_:VkCommandBuffer; pMarkerInfo_:P_VkDebugMarkerMarkerInfoEXT ); stdcall; external DLLNAME; {$ENDIF} const VK_AMD_gcn_shader = 1; const VK_AMD_GCN_SHADER_SPEC_VERSION = 1; const VK_AMD_GCN_SHADER_EXTENSION_NAME = 'VK_AMD_gcn_shader'; const VK_NV_dedicated_allocation = 1; const VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION = 1; const VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME = 'VK_NV_dedicated_allocation'; type P_VkDedicatedAllocationImageCreateInfoNV = ^VkDedicatedAllocationImageCreateInfoNV; VkDedicatedAllocationImageCreateInfoNV = record sType :VkStructureType; pNext :P_void; dedicatedAllocation :VkBool32; end; type P_VkDedicatedAllocationBufferCreateInfoNV = ^VkDedicatedAllocationBufferCreateInfoNV; VkDedicatedAllocationBufferCreateInfoNV = record sType :VkStructureType; pNext :P_void; dedicatedAllocation :VkBool32; end; type P_VkDedicatedAllocationMemoryAllocateInfoNV = ^VkDedicatedAllocationMemoryAllocateInfoNV; VkDedicatedAllocationMemoryAllocateInfoNV = record sType :VkStructureType; pNext :P_void; image :VkImage; buffer :VkBuffer; end; const VK_EXT_transform_feedback = 1; const VK_EXT_TRANSFORM_FEEDBACK_SPEC_VERSION = 1; const VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME = 'VK_EXT_transform_feedback'; type P_VkPipelineRasterizationStateStreamCreateFlagsEXT = ^VkPipelineRasterizationStateStreamCreateFlagsEXT; VkPipelineRasterizationStateStreamCreateFlagsEXT = VkFlags; type P_VkPhysicalDeviceTransformFeedbackFeaturesEXT = ^VkPhysicalDeviceTransformFeedbackFeaturesEXT; VkPhysicalDeviceTransformFeedbackFeaturesEXT = record sType :VkStructureType; pNext :P_void; transformFeedback :VkBool32; geometryStreams :VkBool32; end; type P_VkPhysicalDeviceTransformFeedbackPropertiesEXT = ^VkPhysicalDeviceTransformFeedbackPropertiesEXT; VkPhysicalDeviceTransformFeedbackPropertiesEXT = record sType :VkStructureType; pNext :P_void; maxTransformFeedbackStreams :T_uint32_t; maxTransformFeedbackBuffers :T_uint32_t; maxTransformFeedbackBufferSize :VkDeviceSize; maxTransformFeedbackStreamDataSize :T_uint32_t; maxTransformFeedbackBufferDataSize :T_uint32_t; maxTransformFeedbackBufferDataStride :T_uint32_t; transformFeedbackQueries :VkBool32; transformFeedbackStreamsLinesTriangles :VkBool32; transformFeedbackRasterizationStreamSelect :VkBool32; transformFeedbackDraw :VkBool32; end; type P_VkPipelineRasterizationStateStreamCreateInfoEXT = ^VkPipelineRasterizationStateStreamCreateInfoEXT; VkPipelineRasterizationStateStreamCreateInfoEXT = record sType :VkStructureType; pNext :P_void; flags :VkPipelineRasterizationStateStreamCreateFlagsEXT; rasterizationStream :T_uint32_t; end; type PFN_vkCmdBindTransformFeedbackBuffersEXT = procedure( commandBuffer_:VkCommandBuffer; firstBinding_:T_uint32_t; bindingCount_:T_uint32_t; const pBuffers_:P_VkBuffer; const pOffsets_:P_VkDeviceSize; const pSizes_:P_VkDeviceSize ); type PFN_vkCmdBeginTransformFeedbackEXT = procedure( commandBuffer_:VkCommandBuffer; firstCounterBuffer_:T_uint32_t; counterBufferCount_:T_uint32_t; const pCounterBuffers_:P_VkBuffer; const pCounterBufferOffsets_:P_VkDeviceSize ); type PFN_vkCmdEndTransformFeedbackEXT = procedure( commandBuffer_:VkCommandBuffer; firstCounterBuffer_:T_uint32_t; counterBufferCount_:T_uint32_t; const pCounterBuffers_:P_VkBuffer; const pCounterBufferOffsets_:P_VkDeviceSize ); type PFN_vkCmdBeginQueryIndexedEXT = procedure( commandBuffer_:VkCommandBuffer; queryPool_:VkQueryPool; query_:T_uint32_t; flags_:VkQueryControlFlags; index_:T_uint32_t ); type PFN_vkCmdEndQueryIndexedEXT = procedure( commandBuffer_:VkCommandBuffer; queryPool_:VkQueryPool; query_:T_uint32_t; index_:T_uint32_t ); type PFN_vkCmdDrawIndirectByteCountEXT = procedure( commandBuffer_:VkCommandBuffer; instanceCount_:T_uint32_t; firstInstance_:T_uint32_t; counterBuffer_:VkBuffer; counterBufferOffset_:VkDeviceSize; counterOffset_:T_uint32_t; vertexStride_:T_uint32_t ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdBindTransformFeedbackBuffersEXT( commandBuffer_:VkCommandBuffer; firstBinding_:T_uint32_t; bindingCount_:T_uint32_t; pBuffers_:P_VkBuffer; pOffsets_:P_VkDeviceSize; pSizes_:P_VkDeviceSize ); stdcall; external DLLNAME; procedure vkCmdBeginTransformFeedbackEXT( commandBuffer_:VkCommandBuffer; firstCounterBuffer_:T_uint32_t; counterBufferCount_:T_uint32_t; pCounterBuffers_:P_VkBuffer; pCounterBufferOffsets_:P_VkDeviceSize ); stdcall; external DLLNAME; procedure vkCmdEndTransformFeedbackEXT( commandBuffer_:VkCommandBuffer; firstCounterBuffer_:T_uint32_t; counterBufferCount_:T_uint32_t; pCounterBuffers_:P_VkBuffer; pCounterBufferOffsets_:P_VkDeviceSize ); stdcall; external DLLNAME; procedure vkCmdBeginQueryIndexedEXT( commandBuffer_:VkCommandBuffer; queryPool_:VkQueryPool; query_:T_uint32_t; flags_:VkQueryControlFlags; index_:T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdEndQueryIndexedEXT( commandBuffer_:VkCommandBuffer; queryPool_:VkQueryPool; query_:T_uint32_t; index_:T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDrawIndirectByteCountEXT( commandBuffer_:VkCommandBuffer; instanceCount_:T_uint32_t; firstInstance_:T_uint32_t; counterBuffer_:VkBuffer; counterBufferOffset_:VkDeviceSize; counterOffset_:T_uint32_t; vertexStride_:T_uint32_t ); stdcall; external DLLNAME; {$ENDIF} const VK_NVX_image_view_handle = 1; const VK_NVX_IMAGE_VIEW_HANDLE_SPEC_VERSION = 2; const VK_NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME = 'VK_NVX_image_view_handle'; type P_VkImageViewHandleInfoNVX = ^VkImageViewHandleInfoNVX; VkImageViewHandleInfoNVX = record sType :VkStructureType; pNext :P_void; imageView :VkImageView; descriptorType :VkDescriptorType; sampler :VkSampler; end; type P_VkImageViewAddressPropertiesNVX = ^VkImageViewAddressPropertiesNVX; VkImageViewAddressPropertiesNVX = record sType :VkStructureType; pNext :P_void; deviceAddress :VkDeviceAddress; size :VkDeviceSize; end; type PFN_vkGetImageViewHandleNVX = function( device_:VkDevice; const pInfo_:P_VkImageViewHandleInfoNVX ) :T_uint32_t; type PFN_vkGetImageViewAddressNVX = function( device_:VkDevice; imageView_:VkImageView; pProperties_:P_VkImageViewAddressPropertiesNVX ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetImageViewHandleNVX( device_:VkDevice; pInfo_:P_VkImageViewHandleInfoNVX ) :T_uint32_t; stdcall; external DLLNAME; function vkGetImageViewAddressNVX( device_:VkDevice; imageView_:VkImageView; pProperties_:P_VkImageViewAddressPropertiesNVX ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_AMD_draw_indirect_count = 1; const VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION = 2; const VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME = 'VK_AMD_draw_indirect_count'; type PFN_vkCmdDrawIndirectCountAMD = procedure( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; countBuffer_:VkBuffer; countBufferOffset_:VkDeviceSize; maxDrawCount_:T_uint32_t; stride_:T_uint32_t ); type PFN_vkCmdDrawIndexedIndirectCountAMD = procedure( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; countBuffer_:VkBuffer; countBufferOffset_:VkDeviceSize; maxDrawCount_:T_uint32_t; stride_:T_uint32_t ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdDrawIndirectCountAMD( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; countBuffer_:VkBuffer; countBufferOffset_:VkDeviceSize; maxDrawCount_:T_uint32_t; stride_:T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDrawIndexedIndirectCountAMD( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; countBuffer_:VkBuffer; countBufferOffset_:VkDeviceSize; maxDrawCount_:T_uint32_t; stride_:T_uint32_t ); stdcall; external DLLNAME; {$ENDIF} const VK_AMD_negative_viewport_height = 1; const VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION = 1; const VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME = 'VK_AMD_negative_viewport_height'; const VK_AMD_gpu_shader_half_float = 1; const VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION = 2; const VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME = 'VK_AMD_gpu_shader_half_float'; const VK_AMD_shader_ballot = 1; const VK_AMD_SHADER_BALLOT_SPEC_VERSION = 1; const VK_AMD_SHADER_BALLOT_EXTENSION_NAME = 'VK_AMD_shader_ballot'; const VK_AMD_texture_gather_bias_lod = 1; const VK_AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION = 1; const VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME = 'VK_AMD_texture_gather_bias_lod'; type P_VkTextureLODGatherFormatPropertiesAMD = ^VkTextureLODGatherFormatPropertiesAMD; VkTextureLODGatherFormatPropertiesAMD = record sType :VkStructureType; pNext :P_void; supportsTextureGatherLODBiasAMD :VkBool32; end; const VK_AMD_shader_info = 1; const VK_AMD_SHADER_INFO_SPEC_VERSION = 1; const VK_AMD_SHADER_INFO_EXTENSION_NAME = 'VK_AMD_shader_info'; type P_VkShaderInfoTypeAMD = ^VkShaderInfoTypeAMD; VkShaderInfoTypeAMD = ( VK_SHADER_INFO_TYPE_STATISTICS_AMD = 0, VK_SHADER_INFO_TYPE_BINARY_AMD = 1, VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD = 2, VK_SHADER_INFO_TYPE_MAX_ENUM_AMD = $7FFFFFFF ); type P_VkShaderResourceUsageAMD = ^VkShaderResourceUsageAMD; VkShaderResourceUsageAMD = record numUsedVgprs :T_uint32_t; numUsedSgprs :T_uint32_t; ldsSizePerLocalWorkGroup :T_uint32_t; ldsUsageSizeInBytes :T_size_t; scratchMemUsageInBytes :T_size_t; end; type P_VkShaderStatisticsInfoAMD = ^VkShaderStatisticsInfoAMD; VkShaderStatisticsInfoAMD = record shaderStageMask :VkShaderStageFlags; resourceUsage :VkShaderResourceUsageAMD; numPhysicalVgprs :T_uint32_t; numPhysicalSgprs :T_uint32_t; numAvailableVgprs :T_uint32_t; numAvailableSgprs :T_uint32_t; computeWorkGroupSize :array [ 0..3-1 ] of T_uint32_t; end; type PFN_vkGetShaderInfoAMD = function( device_:VkDevice; pipeline_:VkPipeline; shaderStage_:VkShaderStageFlagBits; infoType_:VkShaderInfoTypeAMD; pInfoSize_:P_size_t; pInfo_:P_void ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetShaderInfoAMD( device_:VkDevice; pipeline_:VkPipeline; shaderStage_:VkShaderStageFlagBits; infoType_:VkShaderInfoTypeAMD; pInfoSize_:P_size_t; pInfo_:P_void ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_AMD_shader_image_load_store_lod = 1; const VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_SPEC_VERSION = 1; const VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME = 'VK_AMD_shader_image_load_store_lod'; const VK_NV_corner_sampled_image = 1; const VK_NV_CORNER_SAMPLED_IMAGE_SPEC_VERSION = 2; const VK_NV_CORNER_SAMPLED_IMAGE_EXTENSION_NAME = 'VK_NV_corner_sampled_image'; type P_VkPhysicalDeviceCornerSampledImageFeaturesNV = ^VkPhysicalDeviceCornerSampledImageFeaturesNV; VkPhysicalDeviceCornerSampledImageFeaturesNV = record sType :VkStructureType; pNext :P_void; cornerSampledImage :VkBool32; end; const VK_IMG_format_pvrtc = 1; const VK_IMG_FORMAT_PVRTC_SPEC_VERSION = 1; const VK_IMG_FORMAT_PVRTC_EXTENSION_NAME = 'VK_IMG_format_pvrtc'; const VK_NV_external_memory_capabilities = 1; const VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION = 1; const VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME = 'VK_NV_external_memory_capabilities'; type P_VkExternalMemoryHandleTypeFlagBitsNV = ^VkExternalMemoryHandleTypeFlagBitsNV; VkExternalMemoryHandleTypeFlagBitsNV = ( VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV = $00000001, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV = $00000002, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV = $00000004, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV = $00000008, VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_NV = $7FFFFFFF ); type P_VkExternalMemoryHandleTypeFlagsNV = ^VkExternalMemoryHandleTypeFlagsNV; VkExternalMemoryHandleTypeFlagsNV = VkFlags; type P_VkExternalMemoryFeatureFlagBitsNV = ^VkExternalMemoryFeatureFlagBitsNV; VkExternalMemoryFeatureFlagBitsNV = ( VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV = $00000001, VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV = $00000002, VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV = $00000004, VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_NV = $7FFFFFFF ); type P_VkExternalMemoryFeatureFlagsNV = ^VkExternalMemoryFeatureFlagsNV; VkExternalMemoryFeatureFlagsNV = VkFlags; type P_VkExternalImageFormatPropertiesNV = ^VkExternalImageFormatPropertiesNV; VkExternalImageFormatPropertiesNV = record imageFormatProperties :VkImageFormatProperties; externalMemoryFeatures :VkExternalMemoryFeatureFlagsNV; exportFromImportedHandleTypes :VkExternalMemoryHandleTypeFlagsNV; compatibleHandleTypes :VkExternalMemoryHandleTypeFlagsNV; end; type PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV = function( physicalDevice_:VkPhysicalDevice; format_:VkFormat; type_:VkImageType; tiling_:VkImageTiling; usage_:VkImageUsageFlags; flags_:VkImageCreateFlags; externalHandleType_:VkExternalMemoryHandleTypeFlagsNV; pExternalImageFormatProperties_:P_VkExternalImageFormatPropertiesNV ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetPhysicalDeviceExternalImageFormatPropertiesNV( physicalDevice_:VkPhysicalDevice; format_:VkFormat; type_:VkImageType; tiling_:VkImageTiling; usage_:VkImageUsageFlags; flags_:VkImageCreateFlags; externalHandleType_:VkExternalMemoryHandleTypeFlagsNV; pExternalImageFormatProperties_:P_VkExternalImageFormatPropertiesNV ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_NV_external_memory = 1; const VK_NV_EXTERNAL_MEMORY_SPEC_VERSION = 1; const VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME = 'VK_NV_external_memory'; type P_VkExternalMemoryImageCreateInfoNV = ^VkExternalMemoryImageCreateInfoNV; VkExternalMemoryImageCreateInfoNV = record sType :VkStructureType; pNext :P_void; handleTypes :VkExternalMemoryHandleTypeFlagsNV; end; type P_VkExportMemoryAllocateInfoNV = ^VkExportMemoryAllocateInfoNV; VkExportMemoryAllocateInfoNV = record sType :VkStructureType; pNext :P_void; handleTypes :VkExternalMemoryHandleTypeFlagsNV; end; const VK_EXT_validation_flags = 1; const VK_EXT_VALIDATION_FLAGS_SPEC_VERSION = 2; const VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME = 'VK_EXT_validation_flags'; type P_VkValidationCheckEXT = ^VkValidationCheckEXT; VkValidationCheckEXT = ( VK_VALIDATION_CHECK_ALL_EXT = 0, VK_VALIDATION_CHECK_SHADERS_EXT = 1, VK_VALIDATION_CHECK_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkValidationFlagsEXT = ^VkValidationFlagsEXT; VkValidationFlagsEXT = record sType :VkStructureType; pNext :P_void; disabledValidationCheckCount :T_uint32_t; pDisabledValidationChecks :P_VkValidationCheckEXT; end; const VK_EXT_shader_subgroup_ballot = 1; const VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION = 1; const VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME = 'VK_EXT_shader_subgroup_ballot'; const VK_EXT_shader_subgroup_vote = 1; const VK_EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION = 1; const VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME = 'VK_EXT_shader_subgroup_vote'; const VK_EXT_texture_compression_astc_hdr = 1; const VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_SPEC_VERSION = 1; const VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_EXTENSION_NAME = 'VK_EXT_texture_compression_astc_hdr'; type P_VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT = ^VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT; VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT = record sType :VkStructureType; pNext :P_void; textureCompressionASTC_HDR :VkBool32; end; const VK_EXT_astc_decode_mode = 1; const VK_EXT_ASTC_DECODE_MODE_SPEC_VERSION = 1; const VK_EXT_ASTC_DECODE_MODE_EXTENSION_NAME = 'VK_EXT_astc_decode_mode'; type P_VkImageViewASTCDecodeModeEXT = ^VkImageViewASTCDecodeModeEXT; VkImageViewASTCDecodeModeEXT = record sType :VkStructureType; pNext :P_void; decodeMode :VkFormat; end; type P_VkPhysicalDeviceASTCDecodeFeaturesEXT = ^VkPhysicalDeviceASTCDecodeFeaturesEXT; VkPhysicalDeviceASTCDecodeFeaturesEXT = record sType :VkStructureType; pNext :P_void; decodeModeSharedExponent :VkBool32; end; const VK_EXT_conditional_rendering = 1; const VK_EXT_CONDITIONAL_RENDERING_SPEC_VERSION = 2; const VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME = 'VK_EXT_conditional_rendering'; type P_VkConditionalRenderingFlagBitsEXT = ^VkConditionalRenderingFlagBitsEXT; VkConditionalRenderingFlagBitsEXT = ( VK_CONDITIONAL_RENDERING_INVERTED_BIT_EXT = $00000001, VK_CONDITIONAL_RENDERING_FLAG_BITS_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkConditionalRenderingFlagsEXT = ^VkConditionalRenderingFlagsEXT; VkConditionalRenderingFlagsEXT = VkFlags; type P_VkConditionalRenderingBeginInfoEXT = ^VkConditionalRenderingBeginInfoEXT; VkConditionalRenderingBeginInfoEXT = record sType :VkStructureType; pNext :P_void; buffer :VkBuffer; offset :VkDeviceSize; flags :VkConditionalRenderingFlagsEXT; end; type P_VkPhysicalDeviceConditionalRenderingFeaturesEXT = ^VkPhysicalDeviceConditionalRenderingFeaturesEXT; VkPhysicalDeviceConditionalRenderingFeaturesEXT = record sType :VkStructureType; pNext :P_void; conditionalRendering :VkBool32; inheritedConditionalRendering :VkBool32; end; type P_VkCommandBufferInheritanceConditionalRenderingInfoEXT = ^VkCommandBufferInheritanceConditionalRenderingInfoEXT; VkCommandBufferInheritanceConditionalRenderingInfoEXT = record sType :VkStructureType; pNext :P_void; conditionalRenderingEnable :VkBool32; end; type PFN_vkCmdBeginConditionalRenderingEXT = procedure( commandBuffer_:VkCommandBuffer; const pConditionalRenderingBegin_:P_VkConditionalRenderingBeginInfoEXT ); type PFN_vkCmdEndConditionalRenderingEXT = procedure( commandBuffer_:VkCommandBuffer ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdBeginConditionalRenderingEXT( commandBuffer_:VkCommandBuffer; pConditionalRenderingBegin_:P_VkConditionalRenderingBeginInfoEXT ); stdcall; external DLLNAME; procedure vkCmdEndConditionalRenderingEXT( commandBuffer_:VkCommandBuffer ); stdcall; external DLLNAME; {$ENDIF} const VK_NV_clip_space_w_scaling = 1; const VK_NV_CLIP_SPACE_W_SCALING_SPEC_VERSION = 1; const VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME = 'VK_NV_clip_space_w_scaling'; type P_VkViewportWScalingNV = ^VkViewportWScalingNV; VkViewportWScalingNV = record xcoeff :T_float; ycoeff :T_float; end; type P_VkPipelineViewportWScalingStateCreateInfoNV = ^VkPipelineViewportWScalingStateCreateInfoNV; VkPipelineViewportWScalingStateCreateInfoNV = record sType :VkStructureType; pNext :P_void; viewportWScalingEnable :VkBool32; viewportCount :T_uint32_t; pViewportWScalings :P_VkViewportWScalingNV; end; type PFN_vkCmdSetViewportWScalingNV = procedure( commandBuffer_:VkCommandBuffer; firstViewport_:T_uint32_t; viewportCount_:T_uint32_t; const pViewportWScalings_:P_VkViewportWScalingNV ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdSetViewportWScalingNV( commandBuffer_:VkCommandBuffer; firstViewport_:T_uint32_t; viewportCount_:T_uint32_t; pViewportWScalings_:P_VkViewportWScalingNV ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_direct_mode_display = 1; const VK_EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION = 1; const VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME = 'VK_EXT_direct_mode_display'; type PFN_vkReleaseDisplayEXT = function( physicalDevice_:VkPhysicalDevice; display_:VkDisplayKHR ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkReleaseDisplayEXT( physicalDevice_:VkPhysicalDevice; display_:VkDisplayKHR ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_EXT_display_surface_counter = 1; const VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION = 1; const VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME = 'VK_EXT_display_surface_counter'; type P_VkSurfaceCounterFlagBitsEXT = ^VkSurfaceCounterFlagBitsEXT; VkSurfaceCounterFlagBitsEXT = ( VK_SURFACE_COUNTER_VBLANK_BIT_EXT = $00000001, VK_SURFACE_COUNTER_VBLANK_EXT = VK_SURFACE_COUNTER_VBLANK_BIT_EXT, VK_SURFACE_COUNTER_FLAG_BITS_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkSurfaceCounterFlagsEXT = ^VkSurfaceCounterFlagsEXT; VkSurfaceCounterFlagsEXT = VkFlags; type P_VkSurfaceCapabilities2EXT = ^VkSurfaceCapabilities2EXT; VkSurfaceCapabilities2EXT = record sType :VkStructureType; pNext :P_void; minImageCount :T_uint32_t; maxImageCount :T_uint32_t; currentExtent :VkExtent2D; minImageExtent :VkExtent2D; maxImageExtent :VkExtent2D; maxImageArrayLayers :T_uint32_t; supportedTransforms :VkSurfaceTransformFlagsKHR; currentTransform :VkSurfaceTransformFlagBitsKHR; supportedCompositeAlpha :VkCompositeAlphaFlagsKHR; supportedUsageFlags :VkImageUsageFlags; supportedSurfaceCounters :VkSurfaceCounterFlagsEXT; end; type PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT = function( physicalDevice_:VkPhysicalDevice; surface_:VkSurfaceKHR; pSurfaceCapabilities_:P_VkSurfaceCapabilities2EXT ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetPhysicalDeviceSurfaceCapabilities2EXT( physicalDevice_:VkPhysicalDevice; surface_:VkSurfaceKHR; pSurfaceCapabilities_:P_VkSurfaceCapabilities2EXT ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_EXT_display_control = 1; const VK_EXT_DISPLAY_CONTROL_SPEC_VERSION = 1; const VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME = 'VK_EXT_display_control'; type P_VkDisplayPowerStateEXT = ^VkDisplayPowerStateEXT; VkDisplayPowerStateEXT = ( VK_DISPLAY_POWER_STATE_OFF_EXT = 0, VK_DISPLAY_POWER_STATE_SUSPEND_EXT = 1, VK_DISPLAY_POWER_STATE_ON_EXT = 2, VK_DISPLAY_POWER_STATE_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkDeviceEventTypeEXT = ^VkDeviceEventTypeEXT; VkDeviceEventTypeEXT = ( VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT = 0, VK_DEVICE_EVENT_TYPE_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkDisplayEventTypeEXT = ^VkDisplayEventTypeEXT; VkDisplayEventTypeEXT = ( VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT = 0, VK_DISPLAY_EVENT_TYPE_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkDisplayPowerInfoEXT = ^VkDisplayPowerInfoEXT; VkDisplayPowerInfoEXT = record sType :VkStructureType; pNext :P_void; powerState :VkDisplayPowerStateEXT; end; type P_VkDeviceEventInfoEXT = ^VkDeviceEventInfoEXT; VkDeviceEventInfoEXT = record sType :VkStructureType; pNext :P_void; deviceEvent :VkDeviceEventTypeEXT; end; type P_VkDisplayEventInfoEXT = ^VkDisplayEventInfoEXT; VkDisplayEventInfoEXT = record sType :VkStructureType; pNext :P_void; displayEvent :VkDisplayEventTypeEXT; end; type P_VkSwapchainCounterCreateInfoEXT = ^VkSwapchainCounterCreateInfoEXT; VkSwapchainCounterCreateInfoEXT = record sType :VkStructureType; pNext :P_void; surfaceCounters :VkSurfaceCounterFlagsEXT; end; type PFN_vkDisplayPowerControlEXT = function( device_:VkDevice; display_:VkDisplayKHR; const pDisplayPowerInfo_:P_VkDisplayPowerInfoEXT ) :VkResult; type PFN_vkRegisterDeviceEventEXT = function( device_:VkDevice; const pDeviceEventInfo_:P_VkDeviceEventInfoEXT; const pAllocator_:P_VkAllocationCallbacks; pFence_:P_VkFence ) :VkResult; type PFN_vkRegisterDisplayEventEXT = function( device_:VkDevice; display_:VkDisplayKHR; const pDisplayEventInfo_:P_VkDisplayEventInfoEXT; const pAllocator_:P_VkAllocationCallbacks; pFence_:P_VkFence ) :VkResult; type PFN_vkGetSwapchainCounterEXT = function( device_:VkDevice; swapchain_:VkSwapchainKHR; counter_:VkSurfaceCounterFlagBitsEXT; pCounterValue_:P_uint64_t ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkDisplayPowerControlEXT( device_:VkDevice; display_:VkDisplayKHR; pDisplayPowerInfo_:P_VkDisplayPowerInfoEXT ) :VkResult; stdcall; external DLLNAME; function vkRegisterDeviceEventEXT( device_:VkDevice; pDeviceEventInfo_:P_VkDeviceEventInfoEXT; pAllocator_:P_VkAllocationCallbacks; pFence_:P_VkFence ) :VkResult; stdcall; external DLLNAME; function vkRegisterDisplayEventEXT( device_:VkDevice; display_:VkDisplayKHR; pDisplayEventInfo_:P_VkDisplayEventInfoEXT; pAllocator_:P_VkAllocationCallbacks; pFence_:P_VkFence ) :VkResult; stdcall; external DLLNAME; function vkGetSwapchainCounterEXT( device_:VkDevice; swapchain_:VkSwapchainKHR; counter_:VkSurfaceCounterFlagBitsEXT; pCounterValue_:P_uint64_t ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_GOOGLE_display_timing = 1; const VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION = 1; const VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME = 'VK_GOOGLE_display_timing'; type P_VkRefreshCycleDurationGOOGLE = ^VkRefreshCycleDurationGOOGLE; VkRefreshCycleDurationGOOGLE = record refreshDuration :T_uint64_t; end; type P_VkPastPresentationTimingGOOGLE = ^VkPastPresentationTimingGOOGLE; VkPastPresentationTimingGOOGLE = record presentID :T_uint32_t; desiredPresentTime :T_uint64_t; actualPresentTime :T_uint64_t; earliestPresentTime :T_uint64_t; presentMargin :T_uint64_t; end; type P_VkPresentTimeGOOGLE = ^VkPresentTimeGOOGLE; VkPresentTimeGOOGLE = record presentID :T_uint32_t; desiredPresentTime :T_uint64_t; end; type P_VkPresentTimesInfoGOOGLE = ^VkPresentTimesInfoGOOGLE; VkPresentTimesInfoGOOGLE = record sType :VkStructureType; pNext :P_void; swapchainCount :T_uint32_t; pTimes :P_VkPresentTimeGOOGLE; end; type PFN_vkGetRefreshCycleDurationGOOGLE = function( device_:VkDevice; swapchain_:VkSwapchainKHR; pDisplayTimingProperties_:P_VkRefreshCycleDurationGOOGLE ) :VkResult; type PFN_vkGetPastPresentationTimingGOOGLE = function( device_:VkDevice; swapchain_:VkSwapchainKHR; pPresentationTimingCount_:P_uint32_t; pPresentationTimings_:P_VkPastPresentationTimingGOOGLE ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetRefreshCycleDurationGOOGLE( device_:VkDevice; swapchain_:VkSwapchainKHR; pDisplayTimingProperties_:P_VkRefreshCycleDurationGOOGLE ) :VkResult; stdcall; external DLLNAME; function vkGetPastPresentationTimingGOOGLE( device_:VkDevice; swapchain_:VkSwapchainKHR; pPresentationTimingCount_:P_uint32_t; pPresentationTimings_:P_VkPastPresentationTimingGOOGLE ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_NV_sample_mask_override_coverage = 1; const VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_SPEC_VERSION = 1; const VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME = 'VK_NV_sample_mask_override_coverage'; const VK_NV_geometry_shader_passthrough = 1; const VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION = 1; const VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME = 'VK_NV_geometry_shader_passthrough'; const VK_NV_viewport_array2 = 1; const VK_NV_VIEWPORT_ARRAY2_SPEC_VERSION = 1; const VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME = 'VK_NV_viewport_array2'; const VK_NVX_multiview_per_view_attributes = 1; const VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_SPEC_VERSION = 1; const VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_EXTENSION_NAME = 'VK_NVX_multiview_per_view_attributes'; type P_VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX = ^VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX; VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX = record sType :VkStructureType; pNext :P_void; perViewPositionAllComponents :VkBool32; end; const VK_NV_viewport_swizzle = 1; const VK_NV_VIEWPORT_SWIZZLE_SPEC_VERSION = 1; const VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME = 'VK_NV_viewport_swizzle'; type P_VkViewportCoordinateSwizzleNV = ^VkViewportCoordinateSwizzleNV; VkViewportCoordinateSwizzleNV = ( VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV = 0, VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV = 1, VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV = 2, VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV = 3, VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV = 4, VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV = 5, VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV = 6, VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV = 7, VK_VIEWPORT_COORDINATE_SWIZZLE_MAX_ENUM_NV = $7FFFFFFF ); type P_VkPipelineViewportSwizzleStateCreateFlagsNV = ^VkPipelineViewportSwizzleStateCreateFlagsNV; VkPipelineViewportSwizzleStateCreateFlagsNV = VkFlags; type P_VkViewportSwizzleNV = ^VkViewportSwizzleNV; VkViewportSwizzleNV = record x :VkViewportCoordinateSwizzleNV; y :VkViewportCoordinateSwizzleNV; z :VkViewportCoordinateSwizzleNV; w :VkViewportCoordinateSwizzleNV; end; type P_VkPipelineViewportSwizzleStateCreateInfoNV = ^VkPipelineViewportSwizzleStateCreateInfoNV; VkPipelineViewportSwizzleStateCreateInfoNV = record sType :VkStructureType; pNext :P_void; flags :VkPipelineViewportSwizzleStateCreateFlagsNV; viewportCount :T_uint32_t; pViewportSwizzles :P_VkViewportSwizzleNV; end; const VK_EXT_discard_rectangles = 1; const VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION = 1; const VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME = 'VK_EXT_discard_rectangles'; type P_VkDiscardRectangleModeEXT = ^VkDiscardRectangleModeEXT; VkDiscardRectangleModeEXT = ( VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT = 0, VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT = 1, VK_DISCARD_RECTANGLE_MODE_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkPipelineDiscardRectangleStateCreateFlagsEXT = ^VkPipelineDiscardRectangleStateCreateFlagsEXT; VkPipelineDiscardRectangleStateCreateFlagsEXT = VkFlags; type P_VkPhysicalDeviceDiscardRectanglePropertiesEXT = ^VkPhysicalDeviceDiscardRectanglePropertiesEXT; VkPhysicalDeviceDiscardRectanglePropertiesEXT = record sType :VkStructureType; pNext :P_void; maxDiscardRectangles :T_uint32_t; end; type P_VkPipelineDiscardRectangleStateCreateInfoEXT = ^VkPipelineDiscardRectangleStateCreateInfoEXT; VkPipelineDiscardRectangleStateCreateInfoEXT = record sType :VkStructureType; pNext :P_void; flags :VkPipelineDiscardRectangleStateCreateFlagsEXT; discardRectangleMode :VkDiscardRectangleModeEXT; discardRectangleCount :T_uint32_t; pDiscardRectangles :P_VkRect2D; end; type PFN_vkCmdSetDiscardRectangleEXT = procedure( commandBuffer_:VkCommandBuffer; firstDiscardRectangle_:T_uint32_t; discardRectangleCount_:T_uint32_t; const pDiscardRectangles_:P_VkRect2D ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdSetDiscardRectangleEXT( commandBuffer_:VkCommandBuffer; firstDiscardRectangle_:T_uint32_t; discardRectangleCount_:T_uint32_t; pDiscardRectangles_:P_VkRect2D ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_conservative_rasterization = 1; const VK_EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION = 1; const VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME = 'VK_EXT_conservative_rasterization'; type P_VkConservativeRasterizationModeEXT = ^VkConservativeRasterizationModeEXT; VkConservativeRasterizationModeEXT = ( VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT = 0, VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT = 1, VK_CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT = 2, VK_CONSERVATIVE_RASTERIZATION_MODE_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkPipelineRasterizationConservativeStateCreateFlagsEXT = ^VkPipelineRasterizationConservativeStateCreateFlagsEXT; VkPipelineRasterizationConservativeStateCreateFlagsEXT = VkFlags; type P_VkPhysicalDeviceConservativeRasterizationPropertiesEXT = ^VkPhysicalDeviceConservativeRasterizationPropertiesEXT; VkPhysicalDeviceConservativeRasterizationPropertiesEXT = record sType :VkStructureType; pNext :P_void; primitiveOverestimationSize :T_float; maxExtraPrimitiveOverestimationSize :T_float; extraPrimitiveOverestimationSizeGranularity :T_float; primitiveUnderestimation :VkBool32; conservativePointAndLineRasterization :VkBool32; degenerateTrianglesRasterized :VkBool32; degenerateLinesRasterized :VkBool32; fullyCoveredFragmentShaderInputVariable :VkBool32; conservativeRasterizationPostDepthCoverage :VkBool32; end; type P_VkPipelineRasterizationConservativeStateCreateInfoEXT = ^VkPipelineRasterizationConservativeStateCreateInfoEXT; VkPipelineRasterizationConservativeStateCreateInfoEXT = record sType :VkStructureType; pNext :P_void; flags :VkPipelineRasterizationConservativeStateCreateFlagsEXT; conservativeRasterizationMode :VkConservativeRasterizationModeEXT; extraPrimitiveOverestimationSize :T_float; end; const VK_EXT_depth_clip_enable = 1; const VK_EXT_DEPTH_CLIP_ENABLE_SPEC_VERSION = 1; const VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME = 'VK_EXT_depth_clip_enable'; type P_VkPipelineRasterizationDepthClipStateCreateFlagsEXT = ^VkPipelineRasterizationDepthClipStateCreateFlagsEXT; VkPipelineRasterizationDepthClipStateCreateFlagsEXT = VkFlags; type P_VkPhysicalDeviceDepthClipEnableFeaturesEXT = ^VkPhysicalDeviceDepthClipEnableFeaturesEXT; VkPhysicalDeviceDepthClipEnableFeaturesEXT = record sType :VkStructureType; pNext :P_void; depthClipEnable :VkBool32; end; type P_VkPipelineRasterizationDepthClipStateCreateInfoEXT = ^VkPipelineRasterizationDepthClipStateCreateInfoEXT; VkPipelineRasterizationDepthClipStateCreateInfoEXT = record sType :VkStructureType; pNext :P_void; flags :VkPipelineRasterizationDepthClipStateCreateFlagsEXT; depthClipEnable :VkBool32; end; const VK_EXT_swapchain_colorspace = 1; const VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION = 4; const VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME = 'VK_EXT_swapchain_colorspace'; const VK_EXT_hdr_metadata = 1; const VK_EXT_HDR_METADATA_SPEC_VERSION = 2; const VK_EXT_HDR_METADATA_EXTENSION_NAME = 'VK_EXT_hdr_metadata'; type P_VkXYColorEXT = ^VkXYColorEXT; VkXYColorEXT = record x :T_float; y :T_float; end; type P_VkHdrMetadataEXT = ^VkHdrMetadataEXT; VkHdrMetadataEXT = record sType :VkStructureType; pNext :P_void; displayPrimaryRed :VkXYColorEXT; displayPrimaryGreen :VkXYColorEXT; displayPrimaryBlue :VkXYColorEXT; whitePoint :VkXYColorEXT; maxLuminance :T_float; minLuminance :T_float; maxContentLightLevel :T_float; maxFrameAverageLightLevel :T_float; end; type PFN_vkSetHdrMetadataEXT = procedure( device_:VkDevice; swapchainCount_:T_uint32_t; const pSwapchains_:P_VkSwapchainKHR; const pMetadata_:P_VkHdrMetadataEXT ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkSetHdrMetadataEXT( device_:VkDevice; swapchainCount_:T_uint32_t; pSwapchains_:P_VkSwapchainKHR; pMetadata_:P_VkHdrMetadataEXT ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_external_memory_dma_buf = 1; const VK_EXT_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION = 1; const VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME = 'VK_EXT_external_memory_dma_buf'; const VK_EXT_queue_family_foreign = 1; const VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION = 1; const VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME = 'VK_EXT_queue_family_foreign'; const VK_QUEUE_FAMILY_FOREIGN_EXT = UInt32( $FFFFFFFF )-2; {(~0U-2)} const VK_EXT_debug_utils = 1; type P_VkDebugUtilsMessengerEXT = ^VkDebugUtilsMessengerEXT; VkDebugUtilsMessengerEXT = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_EXT_DEBUG_UTILS_SPEC_VERSION = 2; const VK_EXT_DEBUG_UTILS_EXTENSION_NAME = 'VK_EXT_debug_utils'; type P_VkDebugUtilsMessengerCallbackDataFlagsEXT = ^VkDebugUtilsMessengerCallbackDataFlagsEXT; VkDebugUtilsMessengerCallbackDataFlagsEXT = VkFlags; type P_VkDebugUtilsMessageSeverityFlagBitsEXT = ^VkDebugUtilsMessageSeverityFlagBitsEXT; VkDebugUtilsMessageSeverityFlagBitsEXT = ( VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT = $00000001, VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT = $00000010, VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT = $00000100, VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT = $00001000, VK_DEBUG_UTILS_MESSAGE_SEVERITY_FLAG_BITS_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkDebugUtilsMessageTypeFlagBitsEXT = ^VkDebugUtilsMessageTypeFlagBitsEXT; VkDebugUtilsMessageTypeFlagBitsEXT = ( VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT = $00000001, VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT = $00000002, VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT = $00000004, VK_DEBUG_UTILS_MESSAGE_TYPE_FLAG_BITS_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkDebugUtilsMessageTypeFlagsEXT = ^VkDebugUtilsMessageTypeFlagsEXT; VkDebugUtilsMessageTypeFlagsEXT = VkFlags; type P_VkDebugUtilsMessageSeverityFlagsEXT = ^VkDebugUtilsMessageSeverityFlagsEXT; VkDebugUtilsMessageSeverityFlagsEXT = VkFlags; type P_VkDebugUtilsMessengerCreateFlagsEXT = ^VkDebugUtilsMessengerCreateFlagsEXT; VkDebugUtilsMessengerCreateFlagsEXT = VkFlags; type P_VkDebugUtilsLabelEXT = ^VkDebugUtilsLabelEXT; VkDebugUtilsLabelEXT = record sType :VkStructureType; pNext :P_void; pLabelName :P_char; color :array [ 0..4-1 ] of T_float; end; type P_VkDebugUtilsObjectNameInfoEXT = ^VkDebugUtilsObjectNameInfoEXT; VkDebugUtilsObjectNameInfoEXT = record sType :VkStructureType; pNext :P_void; objectType :VkObjectType; objectHandle :T_uint64_t; pObjectName :P_char; end; type P_VkDebugUtilsMessengerCallbackDataEXT = ^VkDebugUtilsMessengerCallbackDataEXT; VkDebugUtilsMessengerCallbackDataEXT = record sType :VkStructureType; pNext :P_void; flags :VkDebugUtilsMessengerCallbackDataFlagsEXT; pMessageIdName :P_char; messageIdNumber :T_int32_t; pMessage :P_char; queueLabelCount :T_uint32_t; pQueueLabels :P_VkDebugUtilsLabelEXT; cmdBufLabelCount :T_uint32_t; pCmdBufLabels :P_VkDebugUtilsLabelEXT; objectCount :T_uint32_t; pObjects :P_VkDebugUtilsObjectNameInfoEXT; end; type PFN_vkDebugUtilsMessengerCallbackEXT = function( messageSeverity_:VkDebugUtilsMessageSeverityFlagBitsEXT; messageTypes_:VkDebugUtilsMessageTypeFlagsEXT; pCallbackData_:P_VkDebugUtilsMessengerCallbackDataEXT; pUserData_:P_void ) :VkBool32; type P_VkDebugUtilsMessengerCreateInfoEXT = ^VkDebugUtilsMessengerCreateInfoEXT; VkDebugUtilsMessengerCreateInfoEXT = record sType :VkStructureType; pNext :P_void; flags :VkDebugUtilsMessengerCreateFlagsEXT; messageSeverity :VkDebugUtilsMessageSeverityFlagsEXT; messageType :VkDebugUtilsMessageTypeFlagsEXT; pfnUserCallback :PFN_vkDebugUtilsMessengerCallbackEXT; pUserData :P_void; end; type P_VkDebugUtilsObjectTagInfoEXT = ^VkDebugUtilsObjectTagInfoEXT; VkDebugUtilsObjectTagInfoEXT = record sType :VkStructureType; pNext :P_void; objectType :VkObjectType; objectHandle :T_uint64_t; tagName :T_uint64_t; tagSize :T_size_t; pTag :P_void; end; type PFN_vkSetDebugUtilsObjectNameEXT = function( device_:VkDevice; const pNameInfo_:P_VkDebugUtilsObjectNameInfoEXT ) :VkResult; type PFN_vkSetDebugUtilsObjectTagEXT = function( device_:VkDevice; const pTagInfo_:P_VkDebugUtilsObjectTagInfoEXT ) :VkResult; type PFN_vkQueueBeginDebugUtilsLabelEXT = procedure( queue_:VkQueue; const pLabelInfo_:P_VkDebugUtilsLabelEXT ); type PFN_vkQueueEndDebugUtilsLabelEXT = procedure( queue_:VkQueue ); type PFN_vkQueueInsertDebugUtilsLabelEXT = procedure( queue_:VkQueue; const pLabelInfo_:P_VkDebugUtilsLabelEXT ); type PFN_vkCmdBeginDebugUtilsLabelEXT = procedure( commandBuffer_:VkCommandBuffer; const pLabelInfo_:P_VkDebugUtilsLabelEXT ); type PFN_vkCmdEndDebugUtilsLabelEXT = procedure( commandBuffer_:VkCommandBuffer ); type PFN_vkCmdInsertDebugUtilsLabelEXT = procedure( commandBuffer_:VkCommandBuffer; const pLabelInfo_:P_VkDebugUtilsLabelEXT ); type PFN_vkCreateDebugUtilsMessengerEXT = function( instance_:VkInstance; const pCreateInfo_:P_VkDebugUtilsMessengerCreateInfoEXT; const pAllocator_:P_VkAllocationCallbacks; pMessenger_:P_VkDebugUtilsMessengerEXT ) :VkResult; type PFN_vkDestroyDebugUtilsMessengerEXT = procedure( instance_:VkInstance; messenger_:VkDebugUtilsMessengerEXT; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkSubmitDebugUtilsMessageEXT = procedure( instance_:VkInstance; messageSeverity_:VkDebugUtilsMessageSeverityFlagBitsEXT; messageTypes_:VkDebugUtilsMessageTypeFlagsEXT; const pCallbackData_:P_VkDebugUtilsMessengerCallbackDataEXT ); {$IFNDEF VK_NO_PROTOTYPES } function vkSetDebugUtilsObjectNameEXT( device_:VkDevice; pNameInfo_:P_VkDebugUtilsObjectNameInfoEXT ) :VkResult; stdcall; external DLLNAME; function vkSetDebugUtilsObjectTagEXT( device_:VkDevice; pTagInfo_:P_VkDebugUtilsObjectTagInfoEXT ) :VkResult; stdcall; external DLLNAME; procedure vkQueueBeginDebugUtilsLabelEXT( queue_:VkQueue; pLabelInfo_:P_VkDebugUtilsLabelEXT ); stdcall; external DLLNAME; procedure vkQueueEndDebugUtilsLabelEXT( queue_:VkQueue ); stdcall; external DLLNAME; procedure vkQueueInsertDebugUtilsLabelEXT( queue_:VkQueue; pLabelInfo_:P_VkDebugUtilsLabelEXT ); stdcall; external DLLNAME; procedure vkCmdBeginDebugUtilsLabelEXT( commandBuffer_:VkCommandBuffer; pLabelInfo_:P_VkDebugUtilsLabelEXT ); stdcall; external DLLNAME; procedure vkCmdEndDebugUtilsLabelEXT( commandBuffer_:VkCommandBuffer ); stdcall; external DLLNAME; procedure vkCmdInsertDebugUtilsLabelEXT( commandBuffer_:VkCommandBuffer; pLabelInfo_:P_VkDebugUtilsLabelEXT ); stdcall; external DLLNAME; function vkCreateDebugUtilsMessengerEXT( instance_:VkInstance; pCreateInfo_:P_VkDebugUtilsMessengerCreateInfoEXT; pAllocator_:P_VkAllocationCallbacks; pMessenger_:P_VkDebugUtilsMessengerEXT ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyDebugUtilsMessengerEXT( instance_:VkInstance; messenger_:VkDebugUtilsMessengerEXT; pAllocator_:P_VkAllocationCallbacks ); stdcall; external DLLNAME; procedure vkSubmitDebugUtilsMessageEXT( instance_:VkInstance; messageSeverity_:VkDebugUtilsMessageSeverityFlagBitsEXT; messageTypes_:VkDebugUtilsMessageTypeFlagsEXT; pCallbackData_:P_VkDebugUtilsMessengerCallbackDataEXT ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_sampler_filter_minmax = 1; const VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION = 2; const VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME = 'VK_EXT_sampler_filter_minmax'; type P_VkSamplerReductionModeEXT = ^VkSamplerReductionModeEXT; VkSamplerReductionModeEXT = VkSamplerReductionMode; type P_VkSamplerReductionModeCreateInfoEXT = ^VkSamplerReductionModeCreateInfoEXT; VkSamplerReductionModeCreateInfoEXT = VkSamplerReductionModeCreateInfo; type P_VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT = ^VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT; VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT = VkPhysicalDeviceSamplerFilterMinmaxProperties; const VK_AMD_gpu_shader_int16 = 1; const VK_AMD_GPU_SHADER_INT16_SPEC_VERSION = 2; const VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME = 'VK_AMD_gpu_shader_int16'; const VK_AMD_mixed_attachment_samples = 1; const VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION = 1; const VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME = 'VK_AMD_mixed_attachment_samples'; const VK_AMD_shader_fragment_mask = 1; const VK_AMD_SHADER_FRAGMENT_MASK_SPEC_VERSION = 1; const VK_AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME = 'VK_AMD_shader_fragment_mask'; const VK_EXT_inline_uniform_block = 1; const VK_EXT_INLINE_UNIFORM_BLOCK_SPEC_VERSION = 1; const VK_EXT_INLINE_UNIFORM_BLOCK_EXTENSION_NAME = 'VK_EXT_inline_uniform_block'; type P_VkPhysicalDeviceInlineUniformBlockFeaturesEXT = ^VkPhysicalDeviceInlineUniformBlockFeaturesEXT; VkPhysicalDeviceInlineUniformBlockFeaturesEXT = record sType :VkStructureType; pNext :P_void; inlineUniformBlock :VkBool32; descriptorBindingInlineUniformBlockUpdateAfterBind :VkBool32; end; type P_VkPhysicalDeviceInlineUniformBlockPropertiesEXT = ^VkPhysicalDeviceInlineUniformBlockPropertiesEXT; VkPhysicalDeviceInlineUniformBlockPropertiesEXT = record sType :VkStructureType; pNext :P_void; maxInlineUniformBlockSize :T_uint32_t; maxPerStageDescriptorInlineUniformBlocks :T_uint32_t; maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks :T_uint32_t; maxDescriptorSetInlineUniformBlocks :T_uint32_t; maxDescriptorSetUpdateAfterBindInlineUniformBlocks :T_uint32_t; end; type P_VkWriteDescriptorSetInlineUniformBlockEXT = ^VkWriteDescriptorSetInlineUniformBlockEXT; VkWriteDescriptorSetInlineUniformBlockEXT = record sType :VkStructureType; pNext :P_void; dataSize :T_uint32_t; pData :P_void; end; type P_VkDescriptorPoolInlineUniformBlockCreateInfoEXT = ^VkDescriptorPoolInlineUniformBlockCreateInfoEXT; VkDescriptorPoolInlineUniformBlockCreateInfoEXT = record sType :VkStructureType; pNext :P_void; maxInlineUniformBlockBindings :T_uint32_t; end; const VK_EXT_shader_stencil_export = 1; const VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION = 1; const VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME = 'VK_EXT_shader_stencil_export'; const VK_EXT_sample_locations = 1; const VK_EXT_SAMPLE_LOCATIONS_SPEC_VERSION = 1; const VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME = 'VK_EXT_sample_locations'; type P_VkSampleLocationEXT = ^VkSampleLocationEXT; VkSampleLocationEXT = record x :T_float; y :T_float; end; type P_VkSampleLocationsInfoEXT = ^VkSampleLocationsInfoEXT; VkSampleLocationsInfoEXT = record sType :VkStructureType; pNext :P_void; sampleLocationsPerPixel :VkSampleCountFlagBits; sampleLocationGridSize :VkExtent2D; sampleLocationsCount :T_uint32_t; pSampleLocations :P_VkSampleLocationEXT; end; type P_VkAttachmentSampleLocationsEXT = ^VkAttachmentSampleLocationsEXT; VkAttachmentSampleLocationsEXT = record attachmentIndex :T_uint32_t; sampleLocationsInfo :VkSampleLocationsInfoEXT; end; type P_VkSubpassSampleLocationsEXT = ^VkSubpassSampleLocationsEXT; VkSubpassSampleLocationsEXT = record subpassIndex :T_uint32_t; sampleLocationsInfo :VkSampleLocationsInfoEXT; end; type P_VkRenderPassSampleLocationsBeginInfoEXT = ^VkRenderPassSampleLocationsBeginInfoEXT; VkRenderPassSampleLocationsBeginInfoEXT = record sType :VkStructureType; pNext :P_void; attachmentInitialSampleLocationsCount :T_uint32_t; pAttachmentInitialSampleLocations :P_VkAttachmentSampleLocationsEXT; postSubpassSampleLocationsCount :T_uint32_t; pPostSubpassSampleLocations :P_VkSubpassSampleLocationsEXT; end; type P_VkPipelineSampleLocationsStateCreateInfoEXT = ^VkPipelineSampleLocationsStateCreateInfoEXT; VkPipelineSampleLocationsStateCreateInfoEXT = record sType :VkStructureType; pNext :P_void; sampleLocationsEnable :VkBool32; sampleLocationsInfo :VkSampleLocationsInfoEXT; end; type P_VkPhysicalDeviceSampleLocationsPropertiesEXT = ^VkPhysicalDeviceSampleLocationsPropertiesEXT; VkPhysicalDeviceSampleLocationsPropertiesEXT = record sType :VkStructureType; pNext :P_void; sampleLocationSampleCounts :VkSampleCountFlags; maxSampleLocationGridSize :VkExtent2D; sampleLocationCoordinateRange :array [ 0..2-1 ] of T_float; sampleLocationSubPixelBits :T_uint32_t; variableSampleLocations :VkBool32; end; type P_VkMultisamplePropertiesEXT = ^VkMultisamplePropertiesEXT; VkMultisamplePropertiesEXT = record sType :VkStructureType; pNext :P_void; maxSampleLocationGridSize :VkExtent2D; end; type PFN_vkCmdSetSampleLocationsEXT = procedure( commandBuffer_:VkCommandBuffer; const pSampleLocationsInfo_:P_VkSampleLocationsInfoEXT ); type PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT = procedure( physicalDevice_:VkPhysicalDevice; samples_:VkSampleCountFlagBits; pMultisampleProperties_:P_VkMultisamplePropertiesEXT ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdSetSampleLocationsEXT( commandBuffer_:VkCommandBuffer; pSampleLocationsInfo_:P_VkSampleLocationsInfoEXT ); stdcall; external DLLNAME; procedure vkGetPhysicalDeviceMultisamplePropertiesEXT( physicalDevice_:VkPhysicalDevice; samples_:VkSampleCountFlagBits; pMultisampleProperties_:P_VkMultisamplePropertiesEXT ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_blend_operation_advanced = 1; const VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION = 2; const VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME = 'VK_EXT_blend_operation_advanced'; type P_VkBlendOverlapEXT = ^VkBlendOverlapEXT; VkBlendOverlapEXT = ( VK_BLEND_OVERLAP_UNCORRELATED_EXT = 0, VK_BLEND_OVERLAP_DISJOINT_EXT = 1, VK_BLEND_OVERLAP_CONJOINT_EXT = 2, VK_BLEND_OVERLAP_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT = ^VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT; VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT = record sType :VkStructureType; pNext :P_void; advancedBlendCoherentOperations :VkBool32; end; type P_VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT = ^VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT; VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT = record sType :VkStructureType; pNext :P_void; advancedBlendMaxColorAttachments :T_uint32_t; advancedBlendIndependentBlend :VkBool32; advancedBlendNonPremultipliedSrcColor :VkBool32; advancedBlendNonPremultipliedDstColor :VkBool32; advancedBlendCorrelatedOverlap :VkBool32; advancedBlendAllOperations :VkBool32; end; type P_VkPipelineColorBlendAdvancedStateCreateInfoEXT = ^VkPipelineColorBlendAdvancedStateCreateInfoEXT; VkPipelineColorBlendAdvancedStateCreateInfoEXT = record sType :VkStructureType; pNext :P_void; srcPremultiplied :VkBool32; dstPremultiplied :VkBool32; blendOverlap :VkBlendOverlapEXT; end; const VK_NV_fragment_coverage_to_color = 1; const VK_NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION = 1; const VK_NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME = 'VK_NV_fragment_coverage_to_color'; type P_VkPipelineCoverageToColorStateCreateFlagsNV = ^VkPipelineCoverageToColorStateCreateFlagsNV; VkPipelineCoverageToColorStateCreateFlagsNV = VkFlags; type P_VkPipelineCoverageToColorStateCreateInfoNV = ^VkPipelineCoverageToColorStateCreateInfoNV; VkPipelineCoverageToColorStateCreateInfoNV = record sType :VkStructureType; pNext :P_void; flags :VkPipelineCoverageToColorStateCreateFlagsNV; coverageToColorEnable :VkBool32; coverageToColorLocation :T_uint32_t; end; const VK_NV_framebuffer_mixed_samples = 1; const VK_NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION = 1; const VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME = 'VK_NV_framebuffer_mixed_samples'; type P_VkCoverageModulationModeNV = ^VkCoverageModulationModeNV; VkCoverageModulationModeNV = ( VK_COVERAGE_MODULATION_MODE_NONE_NV = 0, VK_COVERAGE_MODULATION_MODE_RGB_NV = 1, VK_COVERAGE_MODULATION_MODE_ALPHA_NV = 2, VK_COVERAGE_MODULATION_MODE_RGBA_NV = 3, VK_COVERAGE_MODULATION_MODE_MAX_ENUM_NV = $7FFFFFFF ); type P_VkPipelineCoverageModulationStateCreateFlagsNV = ^VkPipelineCoverageModulationStateCreateFlagsNV; VkPipelineCoverageModulationStateCreateFlagsNV = VkFlags; type P_VkPipelineCoverageModulationStateCreateInfoNV = ^VkPipelineCoverageModulationStateCreateInfoNV; VkPipelineCoverageModulationStateCreateInfoNV = record sType :VkStructureType; pNext :P_void; flags :VkPipelineCoverageModulationStateCreateFlagsNV; coverageModulationMode :VkCoverageModulationModeNV; coverageModulationTableEnable :VkBool32; coverageModulationTableCount :T_uint32_t; pCoverageModulationTable :P_float; end; const VK_NV_fill_rectangle = 1; const VK_NV_FILL_RECTANGLE_SPEC_VERSION = 1; const VK_NV_FILL_RECTANGLE_EXTENSION_NAME = 'VK_NV_fill_rectangle'; const VK_NV_shader_sm_builtins = 1; const VK_NV_SHADER_SM_BUILTINS_SPEC_VERSION = 1; const VK_NV_SHADER_SM_BUILTINS_EXTENSION_NAME = 'VK_NV_shader_sm_builtins'; type P_VkPhysicalDeviceShaderSMBuiltinsPropertiesNV = ^VkPhysicalDeviceShaderSMBuiltinsPropertiesNV; VkPhysicalDeviceShaderSMBuiltinsPropertiesNV = record sType :VkStructureType; pNext :P_void; shaderSMCount :T_uint32_t; shaderWarpsPerSM :T_uint32_t; end; type P_VkPhysicalDeviceShaderSMBuiltinsFeaturesNV = ^VkPhysicalDeviceShaderSMBuiltinsFeaturesNV; VkPhysicalDeviceShaderSMBuiltinsFeaturesNV = record sType :VkStructureType; pNext :P_void; shaderSMBuiltins :VkBool32; end; const VK_EXT_post_depth_coverage = 1; const VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION = 1; const VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME = 'VK_EXT_post_depth_coverage'; const VK_EXT_image_drm_format_modifier = 1; const VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION = 1; const VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME = 'VK_EXT_image_drm_format_modifier'; type P_VkDrmFormatModifierPropertiesEXT = ^VkDrmFormatModifierPropertiesEXT; VkDrmFormatModifierPropertiesEXT = record drmFormatModifier :T_uint64_t; drmFormatModifierPlaneCount :T_uint32_t; drmFormatModifierTilingFeatures :VkFormatFeatureFlags; end; type P_VkDrmFormatModifierPropertiesListEXT = ^VkDrmFormatModifierPropertiesListEXT; VkDrmFormatModifierPropertiesListEXT = record sType :VkStructureType; pNext :P_void; drmFormatModifierCount :T_uint32_t; pDrmFormatModifierProperties :P_VkDrmFormatModifierPropertiesEXT; end; type P_VkPhysicalDeviceImageDrmFormatModifierInfoEXT = ^VkPhysicalDeviceImageDrmFormatModifierInfoEXT; VkPhysicalDeviceImageDrmFormatModifierInfoEXT = record sType :VkStructureType; pNext :P_void; drmFormatModifier :T_uint64_t; sharingMode :VkSharingMode; queueFamilyIndexCount :T_uint32_t; pQueueFamilyIndices :P_uint32_t; end; type P_VkImageDrmFormatModifierListCreateInfoEXT = ^VkImageDrmFormatModifierListCreateInfoEXT; VkImageDrmFormatModifierListCreateInfoEXT = record sType :VkStructureType; pNext :P_void; drmFormatModifierCount :T_uint32_t; pDrmFormatModifiers :P_uint64_t; end; type P_VkImageDrmFormatModifierExplicitCreateInfoEXT = ^VkImageDrmFormatModifierExplicitCreateInfoEXT; VkImageDrmFormatModifierExplicitCreateInfoEXT = record sType :VkStructureType; pNext :P_void; drmFormatModifier :T_uint64_t; drmFormatModifierPlaneCount :T_uint32_t; pPlaneLayouts :P_VkSubresourceLayout; end; type P_VkImageDrmFormatModifierPropertiesEXT = ^VkImageDrmFormatModifierPropertiesEXT; VkImageDrmFormatModifierPropertiesEXT = record sType :VkStructureType; pNext :P_void; drmFormatModifier :T_uint64_t; end; type PFN_vkGetImageDrmFormatModifierPropertiesEXT = function( device_:VkDevice; image_:VkImage; pProperties_:P_VkImageDrmFormatModifierPropertiesEXT ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetImageDrmFormatModifierPropertiesEXT( device_:VkDevice; image_:VkImage; pProperties_:P_VkImageDrmFormatModifierPropertiesEXT ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_EXT_validation_cache = 1; type P_VkValidationCacheEXT = ^VkValidationCacheEXT; VkValidationCacheEXT = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_EXT_VALIDATION_CACHE_SPEC_VERSION = 1; const VK_EXT_VALIDATION_CACHE_EXTENSION_NAME = 'VK_EXT_validation_cache'; type P_VkValidationCacheHeaderVersionEXT = ^VkValidationCacheHeaderVersionEXT; VkValidationCacheHeaderVersionEXT = ( VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT = 1, VK_VALIDATION_CACHE_HEADER_VERSION_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkValidationCacheCreateFlagsEXT = ^VkValidationCacheCreateFlagsEXT; VkValidationCacheCreateFlagsEXT = VkFlags; type P_VkValidationCacheCreateInfoEXT = ^VkValidationCacheCreateInfoEXT; VkValidationCacheCreateInfoEXT = record sType :VkStructureType; pNext :P_void; flags :VkValidationCacheCreateFlagsEXT; initialDataSize :T_size_t; pInitialData :P_void; end; type P_VkShaderModuleValidationCacheCreateInfoEXT = ^VkShaderModuleValidationCacheCreateInfoEXT; VkShaderModuleValidationCacheCreateInfoEXT = record sType :VkStructureType; pNext :P_void; validationCache :VkValidationCacheEXT; end; type PFN_vkCreateValidationCacheEXT = function( device_:VkDevice; const pCreateInfo_:P_VkValidationCacheCreateInfoEXT; const pAllocator_:P_VkAllocationCallbacks; pValidationCache_:P_VkValidationCacheEXT ) :VkResult; type PFN_vkDestroyValidationCacheEXT = procedure( device_:VkDevice; validationCache_:VkValidationCacheEXT; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkMergeValidationCachesEXT = function( device_:VkDevice; dstCache_:VkValidationCacheEXT; srcCacheCount_:T_uint32_t; const pSrcCaches_:P_VkValidationCacheEXT ) :VkResult; type PFN_vkGetValidationCacheDataEXT = function( device_:VkDevice; validationCache_:VkValidationCacheEXT; pDataSize_:P_size_t; pData_:P_void ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkCreateValidationCacheEXT( device_:VkDevice; pCreateInfo_:P_VkValidationCacheCreateInfoEXT; pAllocator_:P_VkAllocationCallbacks; pValidationCache_:P_VkValidationCacheEXT ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyValidationCacheEXT( device_:VkDevice; validationCache_:VkValidationCacheEXT; pAllocator_:P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkMergeValidationCachesEXT( device_:VkDevice; dstCache_:VkValidationCacheEXT; srcCacheCount_:T_uint32_t; pSrcCaches_:P_VkValidationCacheEXT ) :VkResult; stdcall; external DLLNAME; function vkGetValidationCacheDataEXT( device_:VkDevice; validationCache_:VkValidationCacheEXT; pDataSize_:P_size_t; pData_:P_void ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_EXT_descriptor_indexing = 1; const VK_EXT_DESCRIPTOR_INDEXING_SPEC_VERSION = 2; const VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME = 'VK_EXT_descriptor_indexing'; type P_VkDescriptorBindingFlagBitsEXT = ^VkDescriptorBindingFlagBitsEXT; VkDescriptorBindingFlagBitsEXT = VkDescriptorBindingFlagBits; type P_VkDescriptorBindingFlagsEXT = ^VkDescriptorBindingFlagsEXT; VkDescriptorBindingFlagsEXT = VkDescriptorBindingFlags; type P_VkDescriptorSetLayoutBindingFlagsCreateInfoEXT = ^VkDescriptorSetLayoutBindingFlagsCreateInfoEXT; VkDescriptorSetLayoutBindingFlagsCreateInfoEXT = VkDescriptorSetLayoutBindingFlagsCreateInfo; type P_VkPhysicalDeviceDescriptorIndexingFeaturesEXT = ^VkPhysicalDeviceDescriptorIndexingFeaturesEXT; VkPhysicalDeviceDescriptorIndexingFeaturesEXT = VkPhysicalDeviceDescriptorIndexingFeatures; type P_VkPhysicalDeviceDescriptorIndexingPropertiesEXT = ^VkPhysicalDeviceDescriptorIndexingPropertiesEXT; VkPhysicalDeviceDescriptorIndexingPropertiesEXT = VkPhysicalDeviceDescriptorIndexingProperties; type P_VkDescriptorSetVariableDescriptorCountAllocateInfoEXT = ^VkDescriptorSetVariableDescriptorCountAllocateInfoEXT; VkDescriptorSetVariableDescriptorCountAllocateInfoEXT = VkDescriptorSetVariableDescriptorCountAllocateInfo; type P_VkDescriptorSetVariableDescriptorCountLayoutSupportEXT = ^VkDescriptorSetVariableDescriptorCountLayoutSupportEXT; VkDescriptorSetVariableDescriptorCountLayoutSupportEXT = VkDescriptorSetVariableDescriptorCountLayoutSupport; const VK_EXT_shader_viewport_index_layer = 1; const VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION = 1; const VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME = 'VK_EXT_shader_viewport_index_layer'; const VK_NV_shading_rate_image = 1; const VK_NV_SHADING_RATE_IMAGE_SPEC_VERSION = 3; const VK_NV_SHADING_RATE_IMAGE_EXTENSION_NAME = 'VK_NV_shading_rate_image'; type P_VkShadingRatePaletteEntryNV = ^VkShadingRatePaletteEntryNV; VkShadingRatePaletteEntryNV = ( VK_SHADING_RATE_PALETTE_ENTRY_NO_INVOCATIONS_NV = 0, VK_SHADING_RATE_PALETTE_ENTRY_16_INVOCATIONS_PER_PIXEL_NV = 1, VK_SHADING_RATE_PALETTE_ENTRY_8_INVOCATIONS_PER_PIXEL_NV = 2, VK_SHADING_RATE_PALETTE_ENTRY_4_INVOCATIONS_PER_PIXEL_NV = 3, VK_SHADING_RATE_PALETTE_ENTRY_2_INVOCATIONS_PER_PIXEL_NV = 4, VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_PIXEL_NV = 5, VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X1_PIXELS_NV = 6, VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_1X2_PIXELS_NV = 7, VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X2_PIXELS_NV = 8, VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X2_PIXELS_NV = 9, VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X4_PIXELS_NV = 10, VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X4_PIXELS_NV = 11, VK_SHADING_RATE_PALETTE_ENTRY_MAX_ENUM_NV = $7FFFFFFF ); type P_VkCoarseSampleOrderTypeNV = ^VkCoarseSampleOrderTypeNV; VkCoarseSampleOrderTypeNV = ( VK_COARSE_SAMPLE_ORDER_TYPE_DEFAULT_NV = 0, VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV = 1, VK_COARSE_SAMPLE_ORDER_TYPE_PIXEL_MAJOR_NV = 2, VK_COARSE_SAMPLE_ORDER_TYPE_SAMPLE_MAJOR_NV = 3, VK_COARSE_SAMPLE_ORDER_TYPE_MAX_ENUM_NV = $7FFFFFFF ); type P_VkShadingRatePaletteNV = ^VkShadingRatePaletteNV; VkShadingRatePaletteNV = record shadingRatePaletteEntryCount :T_uint32_t; pShadingRatePaletteEntries :P_VkShadingRatePaletteEntryNV; end; type P_VkPipelineViewportShadingRateImageStateCreateInfoNV = ^VkPipelineViewportShadingRateImageStateCreateInfoNV; VkPipelineViewportShadingRateImageStateCreateInfoNV = record sType :VkStructureType; pNext :P_void; shadingRateImageEnable :VkBool32; viewportCount :T_uint32_t; pShadingRatePalettes :P_VkShadingRatePaletteNV; end; type P_VkPhysicalDeviceShadingRateImageFeaturesNV = ^VkPhysicalDeviceShadingRateImageFeaturesNV; VkPhysicalDeviceShadingRateImageFeaturesNV = record sType :VkStructureType; pNext :P_void; shadingRateImage :VkBool32; shadingRateCoarseSampleOrder :VkBool32; end; type P_VkPhysicalDeviceShadingRateImagePropertiesNV = ^VkPhysicalDeviceShadingRateImagePropertiesNV; VkPhysicalDeviceShadingRateImagePropertiesNV = record sType :VkStructureType; pNext :P_void; shadingRateTexelSize :VkExtent2D; shadingRatePaletteSize :T_uint32_t; shadingRateMaxCoarseSamples :T_uint32_t; end; type P_VkCoarseSampleLocationNV = ^VkCoarseSampleLocationNV; VkCoarseSampleLocationNV = record pixelX :T_uint32_t; pixelY :T_uint32_t; sample :T_uint32_t; end; type P_VkCoarseSampleOrderCustomNV = ^VkCoarseSampleOrderCustomNV; VkCoarseSampleOrderCustomNV = record shadingRate :VkShadingRatePaletteEntryNV; sampleCount :T_uint32_t; sampleLocationCount :T_uint32_t; pSampleLocations :P_VkCoarseSampleLocationNV; end; type P_VkPipelineViewportCoarseSampleOrderStateCreateInfoNV = ^VkPipelineViewportCoarseSampleOrderStateCreateInfoNV; VkPipelineViewportCoarseSampleOrderStateCreateInfoNV = record sType :VkStructureType; pNext :P_void; sampleOrderType :VkCoarseSampleOrderTypeNV; customSampleOrderCount :T_uint32_t; pCustomSampleOrders :P_VkCoarseSampleOrderCustomNV; end; type PFN_vkCmdBindShadingRateImageNV = procedure( commandBuffer_:VkCommandBuffer; imageView_:VkImageView; imageLayout_:VkImageLayout ); type PFN_vkCmdSetViewportShadingRatePaletteNV = procedure( commandBuffer_:VkCommandBuffer; firstViewport_:T_uint32_t; viewportCount_:T_uint32_t; const pShadingRatePalettes_:P_VkShadingRatePaletteNV ); type PFN_vkCmdSetCoarseSampleOrderNV = procedure( commandBuffer_:VkCommandBuffer; sampleOrderType_:VkCoarseSampleOrderTypeNV; customSampleOrderCount_:T_uint32_t; const pCustomSampleOrders_:P_VkCoarseSampleOrderCustomNV ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdBindShadingRateImageNV( commandBuffer_:VkCommandBuffer; imageView_:VkImageView; imageLayout_:VkImageLayout ); stdcall; external DLLNAME; procedure vkCmdSetViewportShadingRatePaletteNV( commandBuffer_:VkCommandBuffer; firstViewport_:T_uint32_t; viewportCount_:T_uint32_t; pShadingRatePalettes_:P_VkShadingRatePaletteNV ); stdcall; external DLLNAME; procedure vkCmdSetCoarseSampleOrderNV( commandBuffer_:VkCommandBuffer; sampleOrderType_:VkCoarseSampleOrderTypeNV; customSampleOrderCount_:T_uint32_t; pCustomSampleOrders_:P_VkCoarseSampleOrderCustomNV ); stdcall; external DLLNAME; {$ENDIF} const VK_NV_ray_tracing = 1; type P_VkAccelerationStructureNV = ^VkAccelerationStructureNV; VkAccelerationStructureNV = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_NV_RAY_TRACING_SPEC_VERSION = 3; const VK_NV_RAY_TRACING_EXTENSION_NAME = 'VK_NV_ray_tracing'; const VK_SHADER_UNUSED_KHR = UInt32( $FFFFFFFF ); {(~0U)} const VK_SHADER_UNUSED_NV = VK_SHADER_UNUSED_KHR; type P_VkRayTracingShaderGroupTypeKHR = ^VkRayTracingShaderGroupTypeKHR; VkRayTracingShaderGroupTypeKHR = ( VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR = 0, VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR = 1, VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR = 2, VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_NV = VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR, VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_NV = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_NV = VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR, VK_RAY_TRACING_SHADER_GROUP_TYPE_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkRayTracingShaderGroupTypeNV = ^VkRayTracingShaderGroupTypeNV; VkRayTracingShaderGroupTypeNV = VkRayTracingShaderGroupTypeKHR; type P_VkGeometryTypeKHR = ^VkGeometryTypeKHR; VkGeometryTypeKHR = ( VK_GEOMETRY_TYPE_TRIANGLES_KHR = 0, VK_GEOMETRY_TYPE_AABBS_KHR = 1, VK_GEOMETRY_TYPE_INSTANCES_KHR = 2, VK_GEOMETRY_TYPE_TRIANGLES_NV = VK_GEOMETRY_TYPE_TRIANGLES_KHR, VK_GEOMETRY_TYPE_AABBS_NV = VK_GEOMETRY_TYPE_AABBS_KHR, VK_GEOMETRY_TYPE_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkGeometryTypeNV = ^VkGeometryTypeNV; VkGeometryTypeNV = VkGeometryTypeKHR; type P_VkAccelerationStructureTypeKHR = ^VkAccelerationStructureTypeKHR; VkAccelerationStructureTypeKHR = ( VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR = 0, VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR = 1, VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR = 2, VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV = VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR, VK_ACCELERATION_STRUCTURE_TYPE_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkAccelerationStructureTypeNV = ^VkAccelerationStructureTypeNV; VkAccelerationStructureTypeNV = VkAccelerationStructureTypeKHR; type P_VkCopyAccelerationStructureModeKHR = ^VkCopyAccelerationStructureModeKHR; VkCopyAccelerationStructureModeKHR = ( VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR = 0, VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR = 1, VK_COPY_ACCELERATION_STRUCTURE_MODE_SERIALIZE_KHR = 2, VK_COPY_ACCELERATION_STRUCTURE_MODE_DESERIALIZE_KHR = 3, VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NV = VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR, VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV = VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR, VK_COPY_ACCELERATION_STRUCTURE_MODE_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkCopyAccelerationStructureModeNV = ^VkCopyAccelerationStructureModeNV; VkCopyAccelerationStructureModeNV = VkCopyAccelerationStructureModeKHR; type P_VkAccelerationStructureMemoryRequirementsTypeNV = ^VkAccelerationStructureMemoryRequirementsTypeNV; VkAccelerationStructureMemoryRequirementsTypeNV = ( VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_OBJECT_NV = 0, VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_BUILD_SCRATCH_NV = 1, VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_UPDATE_SCRATCH_NV = 2, VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_MAX_ENUM_NV = $7FFFFFFF ); type P_VkGeometryFlagBitsKHR = ^VkGeometryFlagBitsKHR; VkGeometryFlagBitsKHR = ( VK_GEOMETRY_OPAQUE_BIT_KHR = $00000001, VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_KHR = $00000002, VK_GEOMETRY_OPAQUE_BIT_NV = VK_GEOMETRY_OPAQUE_BIT_KHR, VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NV = VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_KHR, VK_GEOMETRY_FLAG_BITS_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkGeometryFlagsKHR = ^VkGeometryFlagsKHR; VkGeometryFlagsKHR = VkFlags; type P_VkGeometryFlagsNV = ^VkGeometryFlagsNV; VkGeometryFlagsNV = VkGeometryFlagsKHR; type P_VkGeometryFlagBitsNV = ^VkGeometryFlagBitsNV; VkGeometryFlagBitsNV = VkGeometryFlagBitsKHR; type P_VkGeometryInstanceFlagBitsKHR = ^VkGeometryInstanceFlagBitsKHR; VkGeometryInstanceFlagBitsKHR = ( VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR = $00000001, VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR = $00000002, VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR = $00000004, VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR = $00000008, VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_DISABLE_BIT_NV = VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_NV = VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR, VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_NV = VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR, VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_NV = VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR, VK_GEOMETRY_INSTANCE_FLAG_BITS_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkGeometryInstanceFlagsKHR = ^VkGeometryInstanceFlagsKHR; VkGeometryInstanceFlagsKHR = VkFlags; type P_VkGeometryInstanceFlagsNV = ^VkGeometryInstanceFlagsNV; VkGeometryInstanceFlagsNV = VkGeometryInstanceFlagsKHR; type P_VkGeometryInstanceFlagBitsNV = ^VkGeometryInstanceFlagBitsNV; VkGeometryInstanceFlagBitsNV = VkGeometryInstanceFlagBitsKHR; type P_VkBuildAccelerationStructureFlagBitsKHR = ^VkBuildAccelerationStructureFlagBitsKHR; VkBuildAccelerationStructureFlagBitsKHR = ( VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR = $00000001, VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR = $00000002, VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR = $00000004, VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR = $00000008, VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_KHR = $00000010, VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR, VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR, VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR, VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR, VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_KHR, VK_BUILD_ACCELERATION_STRUCTURE_FLAG_BITS_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkBuildAccelerationStructureFlagsKHR = ^VkBuildAccelerationStructureFlagsKHR; VkBuildAccelerationStructureFlagsKHR = VkFlags; type P_VkBuildAccelerationStructureFlagsNV = ^VkBuildAccelerationStructureFlagsNV; VkBuildAccelerationStructureFlagsNV = VkBuildAccelerationStructureFlagsKHR; type P_VkBuildAccelerationStructureFlagBitsNV = ^VkBuildAccelerationStructureFlagBitsNV; VkBuildAccelerationStructureFlagBitsNV = VkBuildAccelerationStructureFlagBitsKHR; type P_VkRayTracingShaderGroupCreateInfoNV = ^VkRayTracingShaderGroupCreateInfoNV; VkRayTracingShaderGroupCreateInfoNV = record sType :VkStructureType; pNext :P_void; type_ :VkRayTracingShaderGroupTypeKHR; generalShader :T_uint32_t; closestHitShader :T_uint32_t; anyHitShader :T_uint32_t; intersectionShader :T_uint32_t; end; type P_VkRayTracingPipelineCreateInfoNV = ^VkRayTracingPipelineCreateInfoNV; VkRayTracingPipelineCreateInfoNV = record sType :VkStructureType; pNext :P_void; flags :VkPipelineCreateFlags; stageCount :T_uint32_t; pStages :P_VkPipelineShaderStageCreateInfo; groupCount :T_uint32_t; pGroups :P_VkRayTracingShaderGroupCreateInfoNV; maxRecursionDepth :T_uint32_t; layout :VkPipelineLayout; basePipelineHandle :VkPipeline; basePipelineIndex :T_int32_t; end; type P_VkGeometryTrianglesNV = ^VkGeometryTrianglesNV; VkGeometryTrianglesNV = record sType :VkStructureType; pNext :P_void; vertexData :VkBuffer; vertexOffset :VkDeviceSize; vertexCount :T_uint32_t; vertexStride :VkDeviceSize; vertexFormat :VkFormat; indexData :VkBuffer; indexOffset :VkDeviceSize; indexCount :T_uint32_t; indexType :VkIndexType; transformData :VkBuffer; transformOffset :VkDeviceSize; end; type P_VkGeometryAABBNV = ^VkGeometryAABBNV; VkGeometryAABBNV = record sType :VkStructureType; pNext :P_void; aabbData :VkBuffer; numAABBs :T_uint32_t; stride :T_uint32_t; offset :VkDeviceSize; end; type P_VkGeometryDataNV = ^VkGeometryDataNV; VkGeometryDataNV = record triangles :VkGeometryTrianglesNV; aabbs :VkGeometryAABBNV; end; type P_VkGeometryNV = ^VkGeometryNV; VkGeometryNV = record sType :VkStructureType; pNext :P_void; geometryType :VkGeometryTypeKHR; geometry :VkGeometryDataNV; flags :VkGeometryFlagsKHR; end; type P_VkAccelerationStructureInfoNV = ^VkAccelerationStructureInfoNV; VkAccelerationStructureInfoNV = record sType :VkStructureType; pNext :P_void; type_ :VkAccelerationStructureTypeNV; flags :VkBuildAccelerationStructureFlagsNV; instanceCount :T_uint32_t; geometryCount :T_uint32_t; pGeometries :P_VkGeometryNV; end; type P_VkAccelerationStructureCreateInfoNV = ^VkAccelerationStructureCreateInfoNV; VkAccelerationStructureCreateInfoNV = record sType :VkStructureType; pNext :P_void; compactedSize :VkDeviceSize; info :VkAccelerationStructureInfoNV; end; type P_VkBindAccelerationStructureMemoryInfoNV = ^VkBindAccelerationStructureMemoryInfoNV; VkBindAccelerationStructureMemoryInfoNV = record sType :VkStructureType; pNext :P_void; accelerationStructure :VkAccelerationStructureNV; memory :VkDeviceMemory; memoryOffset :VkDeviceSize; deviceIndexCount :T_uint32_t; pDeviceIndices :P_uint32_t; end; type P_VkWriteDescriptorSetAccelerationStructureNV = ^VkWriteDescriptorSetAccelerationStructureNV; VkWriteDescriptorSetAccelerationStructureNV = record sType :VkStructureType; pNext :P_void; accelerationStructureCount :T_uint32_t; pAccelerationStructures :P_VkAccelerationStructureNV; end; type P_VkAccelerationStructureMemoryRequirementsInfoNV = ^VkAccelerationStructureMemoryRequirementsInfoNV; VkAccelerationStructureMemoryRequirementsInfoNV = record sType :VkStructureType; pNext :P_void; type_ :VkAccelerationStructureMemoryRequirementsTypeNV; accelerationStructure :VkAccelerationStructureNV; end; type P_VkPhysicalDeviceRayTracingPropertiesNV = ^VkPhysicalDeviceRayTracingPropertiesNV; VkPhysicalDeviceRayTracingPropertiesNV = record sType :VkStructureType; pNext :P_void; shaderGroupHandleSize :T_uint32_t; maxRecursionDepth :T_uint32_t; maxShaderGroupStride :T_uint32_t; shaderGroupBaseAlignment :T_uint32_t; maxGeometryCount :T_uint64_t; maxInstanceCount :T_uint64_t; maxTriangleCount :T_uint64_t; maxDescriptorSetAccelerationStructures :T_uint32_t; end; type P_VkTransformMatrixKHR = ^VkTransformMatrixKHR; VkTransformMatrixKHR = record matrix_:array [ 0..3-1, 0..4-1 ] of T_float; end; type P_VkTransformMatrixNV = ^VkTransformMatrixNV; VkTransformMatrixNV = VkTransformMatrixKHR; type P_VkAabbPositionsKHR = ^VkAabbPositionsKHR; VkAabbPositionsKHR = record minX :T_float; minY :T_float; minZ :T_float; maxX :T_float; maxY :T_float; maxZ :T_float; end; type P_VkAabbPositionsNV = ^VkAabbPositionsNV; VkAabbPositionsNV = VkAabbPositionsKHR; type P_VkAccelerationStructureInstanceKHR = ^VkAccelerationStructureInstanceKHR; VkAccelerationStructureInstanceKHR = record transform :VkTransformMatrixKHR; instanceCustomIndex :T_uint32_t; {:24} mask :T_uint32_t; {:8} instanceShaderBindingTableRecordOffset: T_uint32_t; {:24} flags :VkGeometryInstanceFlagsKHR; {:8} accelerationStructureReference :T_uint64_t; end; type P_VkAccelerationStructureInstanceNV = ^VkAccelerationStructureInstanceNV; VkAccelerationStructureInstanceNV = VkAccelerationStructureInstanceKHR; type PFN_vkCreateAccelerationStructureNV = function( device_:VkDevice; const pCreateInfo_:P_VkAccelerationStructureCreateInfoNV; const pAllocator_:P_VkAllocationCallbacks; pAccelerationStructure_:P_VkAccelerationStructureNV ) :VkResult; type PFN_vkDestroyAccelerationStructureNV = procedure( device_:VkDevice; accelerationStructure_:VkAccelerationStructureNV; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkGetAccelerationStructureMemoryRequirementsNV = procedure( device_:VkDevice; const pInfo_:P_VkAccelerationStructureMemoryRequirementsInfoNV; pMemoryRequirements_:P_VkMemoryRequirements2KHR ); type PFN_vkBindAccelerationStructureMemoryNV = function( device_:VkDevice; bindInfoCount_:T_uint32_t; const pBindInfos_:P_VkBindAccelerationStructureMemoryInfoNV ) :VkResult; type PFN_vkCmdBuildAccelerationStructureNV = procedure( commandBuffer_:VkCommandBuffer; const pInfo_:P_VkAccelerationStructureInfoNV; instanceData_:VkBuffer; instanceOffset_:VkDeviceSize; update_:VkBool32; dst_:VkAccelerationStructureNV; src_:VkAccelerationStructureNV; scratch_:VkBuffer; scratchOffset_:VkDeviceSize ); type PFN_vkCmdCopyAccelerationStructureNV = procedure( commandBuffer_:VkCommandBuffer; dst_:VkAccelerationStructureNV; src_:VkAccelerationStructureNV; mode_:VkCopyAccelerationStructureModeKHR ); type PFN_vkCmdTraceRaysNV = procedure( commandBuffer_:VkCommandBuffer; raygenShaderBindingTableBuffer_:VkBuffer; raygenShaderBindingOffset_:VkDeviceSize; missShaderBindingTableBuffer_:VkBuffer; missShaderBindingOffset_:VkDeviceSize; missShaderBindingStride_:VkDeviceSize; hitShaderBindingTableBuffer_:VkBuffer; hitShaderBindingOffset_:VkDeviceSize; hitShaderBindingStride_:VkDeviceSize; callableShaderBindingTableBuffer_:VkBuffer; callableShaderBindingOffset_:VkDeviceSize; callableShaderBindingStride_:VkDeviceSize; width_:T_uint32_t; height_:T_uint32_t; depth_:T_uint32_t ); type PFN_vkCreateRayTracingPipelinesNV = function( device_:VkDevice; pipelineCache_:VkPipelineCache; createInfoCount_:T_uint32_t; const pCreateInfos_:P_VkRayTracingPipelineCreateInfoNV; const pAllocator_:P_VkAllocationCallbacks; pPipelines_:P_VkPipeline ) :VkResult; type PFN_vkGetRayTracingShaderGroupHandlesKHR = function( device_:VkDevice; pipeline_:VkPipeline; firstGroup_:T_uint32_t; groupCount_:T_uint32_t; dataSize_:T_size_t; pData_:P_void ) :VkResult; type PFN_vkGetRayTracingShaderGroupHandlesNV = function( device_:VkDevice; pipeline_:VkPipeline; firstGroup_:T_uint32_t; groupCount_:T_uint32_t; dataSize_:T_size_t; pData_:P_void ) :VkResult; type PFN_vkGetAccelerationStructureHandleNV = function( device_:VkDevice; accelerationStructure_:VkAccelerationStructureNV; dataSize_:T_size_t; pData_:P_void ) :VkResult; type PFN_vkCmdWriteAccelerationStructuresPropertiesNV = procedure( commandBuffer_:VkCommandBuffer; accelerationStructureCount_:T_uint32_t; const pAccelerationStructures_:P_VkAccelerationStructureNV; queryType_:VkQueryType; queryPool_:VkQueryPool; firstQuery_:T_uint32_t ); type PFN_vkCompileDeferredNV = function( device_:VkDevice; pipeline_:VkPipeline; shader_:T_uint32_t ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkCreateAccelerationStructureNV( device_:VkDevice; pCreateInfo_:P_VkAccelerationStructureCreateInfoNV; pAllocator_:P_VkAllocationCallbacks; pAccelerationStructure_:P_VkAccelerationStructureNV ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyAccelerationStructureNV( device_:VkDevice; accelerationStructure_:VkAccelerationStructureNV; pAllocator_:P_VkAllocationCallbacks ); stdcall; external DLLNAME; procedure vkGetAccelerationStructureMemoryRequirementsNV( device_:VkDevice; pInfo_:P_VkAccelerationStructureMemoryRequirementsInfoNV; pMemoryRequirements_:P_VkMemoryRequirements2KHR ); stdcall; external DLLNAME; function vkBindAccelerationStructureMemoryNV( device_:VkDevice; bindInfoCount_:T_uint32_t; pBindInfos_:P_VkBindAccelerationStructureMemoryInfoNV ) :VkResult; stdcall; external DLLNAME; procedure vkCmdBuildAccelerationStructureNV( commandBuffer_:VkCommandBuffer; pInfo_:P_VkAccelerationStructureInfoNV; instanceData_:VkBuffer; instanceOffset_:VkDeviceSize; update_:VkBool32; dst_:VkAccelerationStructureNV; src_:VkAccelerationStructureNV; scratch_:VkBuffer; scratchOffset_:VkDeviceSize ); stdcall; external DLLNAME; procedure vkCmdCopyAccelerationStructureNV( commandBuffer_:VkCommandBuffer; dst_:VkAccelerationStructureNV; src_:VkAccelerationStructureNV; mode_:VkCopyAccelerationStructureModeKHR ); stdcall; external DLLNAME; procedure vkCmdTraceRaysNV( commandBuffer_:VkCommandBuffer; raygenShaderBindingTableBuffer_:VkBuffer; raygenShaderBindingOffset_:VkDeviceSize; missShaderBindingTableBuffer_:VkBuffer; missShaderBindingOffset_:VkDeviceSize; missShaderBindingStride_:VkDeviceSize; hitShaderBindingTableBuffer_:VkBuffer; hitShaderBindingOffset_:VkDeviceSize; hitShaderBindingStride_:VkDeviceSize; callableShaderBindingTableBuffer_:VkBuffer; callableShaderBindingOffset_:VkDeviceSize; callableShaderBindingStride_:VkDeviceSize; width_:T_uint32_t; height_:T_uint32_t; depth_:T_uint32_t ); stdcall; external DLLNAME; function vkCreateRayTracingPipelinesNV( device_:VkDevice; pipelineCache_:VkPipelineCache; createInfoCount_:T_uint32_t; pCreateInfos_:P_VkRayTracingPipelineCreateInfoNV; pAllocator_:P_VkAllocationCallbacks; pPipelines_:P_VkPipeline ) :VkResult; stdcall; external DLLNAME; function vkGetRayTracingShaderGroupHandlesKHR( device_:VkDevice; pipeline_:VkPipeline; firstGroup_:T_uint32_t; groupCount_:T_uint32_t; dataSize_:T_size_t; pData_:P_void ) :VkResult; stdcall; external DLLNAME; function vkGetRayTracingShaderGroupHandlesNV( device_:VkDevice; pipeline_:VkPipeline; firstGroup_:T_uint32_t; groupCount_:T_uint32_t; dataSize_:T_size_t; pData_:P_void ) :VkResult; stdcall; external DLLNAME; function vkGetAccelerationStructureHandleNV( device_:VkDevice; accelerationStructure_:VkAccelerationStructureNV; dataSize_:T_size_t; pData_:P_void ) :VkResult; stdcall; external DLLNAME; procedure vkCmdWriteAccelerationStructuresPropertiesNV( commandBuffer_:VkCommandBuffer; accelerationStructureCount_:T_uint32_t; pAccelerationStructures_:P_VkAccelerationStructureNV; queryType_:VkQueryType; queryPool_:VkQueryPool; firstQuery_:T_uint32_t ); stdcall; external DLLNAME; function vkCompileDeferredNV( device_:VkDevice; pipeline_:VkPipeline; shader_:T_uint32_t ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_NV_representative_fragment_test = 1; const VK_NV_REPRESENTATIVE_FRAGMENT_TEST_SPEC_VERSION = 2; const VK_NV_REPRESENTATIVE_FRAGMENT_TEST_EXTENSION_NAME = 'VK_NV_representative_fragment_test'; type P_VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV = ^VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV; VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV = record sType :VkStructureType; pNext :P_void; representativeFragmentTest :VkBool32; end; type P_VkPipelineRepresentativeFragmentTestStateCreateInfoNV = ^VkPipelineRepresentativeFragmentTestStateCreateInfoNV; VkPipelineRepresentativeFragmentTestStateCreateInfoNV = record sType :VkStructureType; pNext :P_void; representativeFragmentTestEnable :VkBool32; end; const VK_EXT_filter_cubic = 1; const VK_EXT_FILTER_CUBIC_SPEC_VERSION = 3; const VK_EXT_FILTER_CUBIC_EXTENSION_NAME = 'VK_EXT_filter_cubic'; type P_VkPhysicalDeviceImageViewImageFormatInfoEXT = ^VkPhysicalDeviceImageViewImageFormatInfoEXT; VkPhysicalDeviceImageViewImageFormatInfoEXT = record sType :VkStructureType; pNext :P_void; imageViewType :VkImageViewType; end; type P_VkFilterCubicImageViewImageFormatPropertiesEXT = ^VkFilterCubicImageViewImageFormatPropertiesEXT; VkFilterCubicImageViewImageFormatPropertiesEXT = record sType :VkStructureType; pNext :P_void; filterCubic :VkBool32; filterCubicMinmax :VkBool32; end; const VK_QCOM_render_pass_shader_resolve = 1; const VK_QCOM_RENDER_PASS_SHADER_RESOLVE_SPEC_VERSION = 4; const VK_QCOM_RENDER_PASS_SHADER_RESOLVE_EXTENSION_NAME = 'VK_QCOM_render_pass_shader_resolve'; const VK_EXT_global_priority = 1; const VK_EXT_GLOBAL_PRIORITY_SPEC_VERSION = 2; const VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME = 'VK_EXT_global_priority'; type P_VkQueueGlobalPriorityEXT = ^VkQueueGlobalPriorityEXT; VkQueueGlobalPriorityEXT = ( VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT = 128, VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT = 256, VK_QUEUE_GLOBAL_PRIORITY_HIGH_EXT = 512, VK_QUEUE_GLOBAL_PRIORITY_REALTIME_EXT = 1024, VK_QUEUE_GLOBAL_PRIORITY_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkDeviceQueueGlobalPriorityCreateInfoEXT = ^VkDeviceQueueGlobalPriorityCreateInfoEXT; VkDeviceQueueGlobalPriorityCreateInfoEXT = record sType :VkStructureType; pNext :P_void; globalPriority :VkQueueGlobalPriorityEXT; end; const VK_EXT_external_memory_host = 1; const VK_EXT_EXTERNAL_MEMORY_HOST_SPEC_VERSION = 1; const VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME = 'VK_EXT_external_memory_host'; type P_VkImportMemoryHostPointerInfoEXT = ^VkImportMemoryHostPointerInfoEXT; VkImportMemoryHostPointerInfoEXT = record sType :VkStructureType; pNext :P_void; handleType :VkExternalMemoryHandleTypeFlagBits; pHostPointer :P_void; end; type P_VkMemoryHostPointerPropertiesEXT = ^VkMemoryHostPointerPropertiesEXT; VkMemoryHostPointerPropertiesEXT = record sType :VkStructureType; pNext :P_void; memoryTypeBits :T_uint32_t; end; type P_VkPhysicalDeviceExternalMemoryHostPropertiesEXT = ^VkPhysicalDeviceExternalMemoryHostPropertiesEXT; VkPhysicalDeviceExternalMemoryHostPropertiesEXT = record sType :VkStructureType; pNext :P_void; minImportedHostPointerAlignment :VkDeviceSize; end; type PFN_vkGetMemoryHostPointerPropertiesEXT = function( device_:VkDevice; handleType_:VkExternalMemoryHandleTypeFlagBits; const pHostPointer_:P_void; pMemoryHostPointerProperties_:P_VkMemoryHostPointerPropertiesEXT ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetMemoryHostPointerPropertiesEXT( device_:VkDevice; handleType_:VkExternalMemoryHandleTypeFlagBits; pHostPointer_:P_void; pMemoryHostPointerProperties_:P_VkMemoryHostPointerPropertiesEXT ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_AMD_buffer_marker = 1; const VK_AMD_BUFFER_MARKER_SPEC_VERSION = 1; const VK_AMD_BUFFER_MARKER_EXTENSION_NAME = 'VK_AMD_buffer_marker'; type PFN_vkCmdWriteBufferMarkerAMD = procedure( commandBuffer_:VkCommandBuffer; pipelineStage_:VkPipelineStageFlagBits; dstBuffer_:VkBuffer; dstOffset_:VkDeviceSize; marker_:T_uint32_t ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdWriteBufferMarkerAMD( commandBuffer_:VkCommandBuffer; pipelineStage_:VkPipelineStageFlagBits; dstBuffer_:VkBuffer; dstOffset_:VkDeviceSize; marker_:T_uint32_t ); stdcall; external DLLNAME; {$ENDIF} const VK_AMD_pipeline_compiler_control = 1; const VK_AMD_PIPELINE_COMPILER_CONTROL_SPEC_VERSION = 1; const VK_AMD_PIPELINE_COMPILER_CONTROL_EXTENSION_NAME = 'VK_AMD_pipeline_compiler_control'; type P_VkPipelineCompilerControlFlagBitsAMD = ^VkPipelineCompilerControlFlagBitsAMD; VkPipelineCompilerControlFlagBitsAMD = ( VK_PIPELINE_COMPILER_CONTROL_FLAG_BITS_MAX_ENUM_AMD = $7FFFFFFF ); type P_VkPipelineCompilerControlFlagsAMD = ^VkPipelineCompilerControlFlagsAMD; VkPipelineCompilerControlFlagsAMD = VkFlags; type P_VkPipelineCompilerControlCreateInfoAMD = ^VkPipelineCompilerControlCreateInfoAMD; VkPipelineCompilerControlCreateInfoAMD = record sType :VkStructureType; pNext :P_void; compilerControlFlags :VkPipelineCompilerControlFlagsAMD; end; const VK_EXT_calibrated_timestamps = 1; const VK_EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION = 1; const VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME = 'VK_EXT_calibrated_timestamps'; type P_VkTimeDomainEXT = ^VkTimeDomainEXT; VkTimeDomainEXT = ( VK_TIME_DOMAIN_DEVICE_EXT = 0, VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT = 1, VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT = 2, VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT = 3, VK_TIME_DOMAIN_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkCalibratedTimestampInfoEXT = ^VkCalibratedTimestampInfoEXT; VkCalibratedTimestampInfoEXT = record sType :VkStructureType; pNext :P_void; timeDomain :VkTimeDomainEXT; end; type PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT = function( physicalDevice_:VkPhysicalDevice; pTimeDomainCount_:P_uint32_t; pTimeDomains_:P_VkTimeDomainEXT ) :VkResult; type PFN_vkGetCalibratedTimestampsEXT = function( device_:VkDevice; timestampCount_:T_uint32_t; const pTimestampInfos_:P_VkCalibratedTimestampInfoEXT; pTimestamps_:P_uint64_t; pMaxDeviation_:P_uint64_t ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetPhysicalDeviceCalibrateableTimeDomainsEXT( physicalDevice_:VkPhysicalDevice; pTimeDomainCount_:P_uint32_t; pTimeDomains_:P_VkTimeDomainEXT ) :VkResult; stdcall; external DLLNAME; function vkGetCalibratedTimestampsEXT( device_:VkDevice; timestampCount_:T_uint32_t; pTimestampInfos_:P_VkCalibratedTimestampInfoEXT; pTimestamps_:P_uint64_t; pMaxDeviation_:P_uint64_t ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_AMD_shader_core_properties = 1; const VK_AMD_SHADER_CORE_PROPERTIES_SPEC_VERSION = 2; const VK_AMD_SHADER_CORE_PROPERTIES_EXTENSION_NAME = 'VK_AMD_shader_core_properties'; type P_VkPhysicalDeviceShaderCorePropertiesAMD = ^VkPhysicalDeviceShaderCorePropertiesAMD; VkPhysicalDeviceShaderCorePropertiesAMD = record sType :VkStructureType; pNext :P_void; shaderEngineCount :T_uint32_t; shaderArraysPerEngineCount :T_uint32_t; computeUnitsPerShaderArray :T_uint32_t; simdPerComputeUnit :T_uint32_t; wavefrontsPerSimd :T_uint32_t; wavefrontSize :T_uint32_t; sgprsPerSimd :T_uint32_t; minSgprAllocation :T_uint32_t; maxSgprAllocation :T_uint32_t; sgprAllocationGranularity :T_uint32_t; vgprsPerSimd :T_uint32_t; minVgprAllocation :T_uint32_t; maxVgprAllocation :T_uint32_t; vgprAllocationGranularity :T_uint32_t; end; const VK_AMD_memory_overallocation_behavior = 1; const VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_SPEC_VERSION = 1; const VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_EXTENSION_NAME = 'VK_AMD_memory_overallocation_behavior'; type P_VkMemoryOverallocationBehaviorAMD = ^VkMemoryOverallocationBehaviorAMD; VkMemoryOverallocationBehaviorAMD = ( VK_MEMORY_OVERALLOCATION_BEHAVIOR_DEFAULT_AMD = 0, VK_MEMORY_OVERALLOCATION_BEHAVIOR_ALLOWED_AMD = 1, VK_MEMORY_OVERALLOCATION_BEHAVIOR_DISALLOWED_AMD = 2, VK_MEMORY_OVERALLOCATION_BEHAVIOR_MAX_ENUM_AMD = $7FFFFFFF ); type P_VkDeviceMemoryOverallocationCreateInfoAMD = ^VkDeviceMemoryOverallocationCreateInfoAMD; VkDeviceMemoryOverallocationCreateInfoAMD = record sType :VkStructureType; pNext :P_void; overallocationBehavior :VkMemoryOverallocationBehaviorAMD; end; const VK_EXT_vertex_attribute_divisor = 1; const VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION = 3; const VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME = 'VK_EXT_vertex_attribute_divisor'; type P_VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT = ^VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT; VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT = record sType :VkStructureType; pNext :P_void; maxVertexAttribDivisor :T_uint32_t; end; type P_VkVertexInputBindingDivisorDescriptionEXT = ^VkVertexInputBindingDivisorDescriptionEXT; VkVertexInputBindingDivisorDescriptionEXT = record binding :T_uint32_t; divisor :T_uint32_t; end; type P_VkPipelineVertexInputDivisorStateCreateInfoEXT = ^VkPipelineVertexInputDivisorStateCreateInfoEXT; VkPipelineVertexInputDivisorStateCreateInfoEXT = record sType :VkStructureType; pNext :P_void; vertexBindingDivisorCount :T_uint32_t; pVertexBindingDivisors :P_VkVertexInputBindingDivisorDescriptionEXT; end; type P_VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT = ^VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT; VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT = record sType :VkStructureType; pNext :P_void; vertexAttributeInstanceRateDivisor :VkBool32; vertexAttributeInstanceRateZeroDivisor :VkBool32; end; const VK_EXT_pipeline_creation_feedback = 1; const VK_EXT_PIPELINE_CREATION_FEEDBACK_SPEC_VERSION = 1; const VK_EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME = 'VK_EXT_pipeline_creation_feedback'; type P_VkPipelineCreationFeedbackFlagBitsEXT = ^VkPipelineCreationFeedbackFlagBitsEXT; VkPipelineCreationFeedbackFlagBitsEXT = ( VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT_EXT = $00000001, VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT_EXT = $00000002, VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT_EXT = $00000004, VK_PIPELINE_CREATION_FEEDBACK_FLAG_BITS_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkPipelineCreationFeedbackFlagsEXT = ^VkPipelineCreationFeedbackFlagsEXT; VkPipelineCreationFeedbackFlagsEXT = VkFlags; type P_VkPipelineCreationFeedbackEXT = ^VkPipelineCreationFeedbackEXT; VkPipelineCreationFeedbackEXT = record flags :VkPipelineCreationFeedbackFlagsEXT; duration :T_uint64_t; end; type P_VkPipelineCreationFeedbackCreateInfoEXT = ^VkPipelineCreationFeedbackCreateInfoEXT; VkPipelineCreationFeedbackCreateInfoEXT = record sType :VkStructureType; pNext :P_void; pPipelineCreationFeedback :P_VkPipelineCreationFeedbackEXT; pipelineStageCreationFeedbackCount :T_uint32_t; pPipelineStageCreationFeedbacks :P_VkPipelineCreationFeedbackEXT; end; const VK_NV_shader_subgroup_partitioned = 1; const VK_NV_SHADER_SUBGROUP_PARTITIONED_SPEC_VERSION = 1; const VK_NV_SHADER_SUBGROUP_PARTITIONED_EXTENSION_NAME = 'VK_NV_shader_subgroup_partitioned'; const VK_NV_compute_shader_derivatives = 1; const VK_NV_COMPUTE_SHADER_DERIVATIVES_SPEC_VERSION = 1; const VK_NV_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME = 'VK_NV_compute_shader_derivatives'; type P_VkPhysicalDeviceComputeShaderDerivativesFeaturesNV = ^VkPhysicalDeviceComputeShaderDerivativesFeaturesNV; VkPhysicalDeviceComputeShaderDerivativesFeaturesNV = record sType :VkStructureType; pNext :P_void; computeDerivativeGroupQuads :VkBool32; computeDerivativeGroupLinear :VkBool32; end; const VK_NV_mesh_shader = 1; const VK_NV_MESH_SHADER_SPEC_VERSION = 1; const VK_NV_MESH_SHADER_EXTENSION_NAME = 'VK_NV_mesh_shader'; type P_VkPhysicalDeviceMeshShaderFeaturesNV = ^VkPhysicalDeviceMeshShaderFeaturesNV; VkPhysicalDeviceMeshShaderFeaturesNV = record sType :VkStructureType; pNext :P_void; taskShader :VkBool32; meshShader :VkBool32; end; type P_VkPhysicalDeviceMeshShaderPropertiesNV = ^VkPhysicalDeviceMeshShaderPropertiesNV; VkPhysicalDeviceMeshShaderPropertiesNV = record sType :VkStructureType; pNext :P_void; maxDrawMeshTasksCount :T_uint32_t; maxTaskWorkGroupInvocations :T_uint32_t; maxTaskWorkGroupSize :array [ 0..3-1 ] of T_uint32_t; maxTaskTotalMemorySize :T_uint32_t; maxTaskOutputCount :T_uint32_t; maxMeshWorkGroupInvocations :T_uint32_t; maxMeshWorkGroupSize :array [ 0..3-1 ] of T_uint32_t; maxMeshTotalMemorySize :T_uint32_t; maxMeshOutputVertices :T_uint32_t; maxMeshOutputPrimitives :T_uint32_t; maxMeshMultiviewViewCount :T_uint32_t; meshOutputPerVertexGranularity :T_uint32_t; meshOutputPerPrimitiveGranularity :T_uint32_t; end; type P_VkDrawMeshTasksIndirectCommandNV = ^VkDrawMeshTasksIndirectCommandNV; VkDrawMeshTasksIndirectCommandNV = record taskCount :T_uint32_t; firstTask :T_uint32_t; end; type PFN_vkCmdDrawMeshTasksNV = procedure( commandBuffer_:VkCommandBuffer; taskCount_:T_uint32_t; firstTask_:T_uint32_t ); type PFN_vkCmdDrawMeshTasksIndirectNV = procedure( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; drawCount_:T_uint32_t; stride_:T_uint32_t ); type PFN_vkCmdDrawMeshTasksIndirectCountNV = procedure( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; countBuffer_:VkBuffer; countBufferOffset_:VkDeviceSize; maxDrawCount_:T_uint32_t; stride_:T_uint32_t ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdDrawMeshTasksNV( commandBuffer_:VkCommandBuffer; taskCount_:T_uint32_t; firstTask_:T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDrawMeshTasksIndirectNV( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; drawCount_:T_uint32_t; stride_:T_uint32_t ); stdcall; external DLLNAME; procedure vkCmdDrawMeshTasksIndirectCountNV( commandBuffer_:VkCommandBuffer; buffer_:VkBuffer; offset_:VkDeviceSize; countBuffer_:VkBuffer; countBufferOffset_:VkDeviceSize; maxDrawCount_:T_uint32_t; stride_:T_uint32_t ); stdcall; external DLLNAME; {$ENDIF} const VK_NV_fragment_shader_barycentric = 1; const VK_NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION = 1; const VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME = 'VK_NV_fragment_shader_barycentric'; type P_VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV = ^VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV; VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV = record sType :VkStructureType; pNext :P_void; fragmentShaderBarycentric :VkBool32; end; const VK_NV_shader_image_footprint = 1; const VK_NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION = 2; const VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME = 'VK_NV_shader_image_footprint'; type P_VkPhysicalDeviceShaderImageFootprintFeaturesNV = ^VkPhysicalDeviceShaderImageFootprintFeaturesNV; VkPhysicalDeviceShaderImageFootprintFeaturesNV = record sType :VkStructureType; pNext :P_void; imageFootprint :VkBool32; end; const VK_NV_scissor_exclusive = 1; const VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION = 1; const VK_NV_SCISSOR_EXCLUSIVE_EXTENSION_NAME = 'VK_NV_scissor_exclusive'; type P_VkPipelineViewportExclusiveScissorStateCreateInfoNV = ^VkPipelineViewportExclusiveScissorStateCreateInfoNV; VkPipelineViewportExclusiveScissorStateCreateInfoNV = record sType :VkStructureType; pNext :P_void; exclusiveScissorCount :T_uint32_t; pExclusiveScissors :P_VkRect2D; end; type P_VkPhysicalDeviceExclusiveScissorFeaturesNV = ^VkPhysicalDeviceExclusiveScissorFeaturesNV; VkPhysicalDeviceExclusiveScissorFeaturesNV = record sType :VkStructureType; pNext :P_void; exclusiveScissor :VkBool32; end; type PFN_vkCmdSetExclusiveScissorNV = procedure( commandBuffer_:VkCommandBuffer; firstExclusiveScissor_:T_uint32_t; exclusiveScissorCount_:T_uint32_t; const pExclusiveScissors_:P_VkRect2D ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdSetExclusiveScissorNV( commandBuffer_:VkCommandBuffer; firstExclusiveScissor_:T_uint32_t; exclusiveScissorCount_:T_uint32_t; pExclusiveScissors_:P_VkRect2D ); stdcall; external DLLNAME; {$ENDIF} const VK_NV_device_diagnostic_checkpoints = 1; const VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_SPEC_VERSION = 2; const VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_EXTENSION_NAME = 'VK_NV_device_diagnostic_checkpoints'; type P_VkQueueFamilyCheckpointPropertiesNV = ^VkQueueFamilyCheckpointPropertiesNV; VkQueueFamilyCheckpointPropertiesNV = record sType :VkStructureType; pNext :P_void; checkpointExecutionStageMask :VkPipelineStageFlags; end; type P_VkCheckpointDataNV = ^VkCheckpointDataNV; VkCheckpointDataNV = record sType :VkStructureType; pNext :P_void; stage :VkPipelineStageFlagBits; pCheckpointMarker :P_void; end; type PFN_vkCmdSetCheckpointNV = procedure( commandBuffer_:VkCommandBuffer; const pCheckpointMarker_:P_void ); type PFN_vkGetQueueCheckpointDataNV = procedure( queue_:VkQueue; pCheckpointDataCount_:P_uint32_t; pCheckpointData_:P_VkCheckpointDataNV ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdSetCheckpointNV( commandBuffer_:VkCommandBuffer; pCheckpointMarker_:P_void ); stdcall; external DLLNAME; procedure vkGetQueueCheckpointDataNV( queue_:VkQueue; pCheckpointDataCount_:P_uint32_t; pCheckpointData_:P_VkCheckpointDataNV ); stdcall; external DLLNAME; {$ENDIF} const VK_INTEL_shader_integer_functions2 = 1; const VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_SPEC_VERSION = 1; const VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_EXTENSION_NAME = 'VK_INTEL_shader_integer_functions2'; type P_VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL = ^VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL; VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL = record sType :VkStructureType; pNext :P_void; shaderIntegerFunctions2 :VkBool32; end; const VK_INTEL_performance_query = 1; type P_VkPerformanceConfigurationINTEL = ^VkPerformanceConfigurationINTEL; VkPerformanceConfigurationINTEL = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_INTEL_PERFORMANCE_QUERY_SPEC_VERSION = 2; const VK_INTEL_PERFORMANCE_QUERY_EXTENSION_NAME = 'VK_INTEL_performance_query'; type P_VkPerformanceConfigurationTypeINTEL = ^VkPerformanceConfigurationTypeINTEL; VkPerformanceConfigurationTypeINTEL = ( VK_PERFORMANCE_CONFIGURATION_TYPE_COMMAND_QUEUE_METRICS_DISCOVERY_ACTIVATED_INTEL = 0, VK_PERFORMANCE_CONFIGURATION_TYPE_MAX_ENUM_INTEL = $7FFFFFFF ); type P_VkQueryPoolSamplingModeINTEL = ^VkQueryPoolSamplingModeINTEL; VkQueryPoolSamplingModeINTEL = ( VK_QUERY_POOL_SAMPLING_MODE_MANUAL_INTEL = 0, VK_QUERY_POOL_SAMPLING_MODE_MAX_ENUM_INTEL = $7FFFFFFF ); type P_VkPerformanceOverrideTypeINTEL = ^VkPerformanceOverrideTypeINTEL; VkPerformanceOverrideTypeINTEL = ( VK_PERFORMANCE_OVERRIDE_TYPE_NULL_HARDWARE_INTEL = 0, VK_PERFORMANCE_OVERRIDE_TYPE_FLUSH_GPU_CACHES_INTEL = 1, VK_PERFORMANCE_OVERRIDE_TYPE_MAX_ENUM_INTEL = $7FFFFFFF ); type P_VkPerformanceParameterTypeINTEL = ^VkPerformanceParameterTypeINTEL; VkPerformanceParameterTypeINTEL = ( VK_PERFORMANCE_PARAMETER_TYPE_HW_COUNTERS_SUPPORTED_INTEL = 0, VK_PERFORMANCE_PARAMETER_TYPE_STREAM_MARKER_VALID_BITS_INTEL = 1, VK_PERFORMANCE_PARAMETER_TYPE_MAX_ENUM_INTEL = $7FFFFFFF ); type P_VkPerformanceValueTypeINTEL = ^VkPerformanceValueTypeINTEL; VkPerformanceValueTypeINTEL = ( VK_PERFORMANCE_VALUE_TYPE_UINT32_INTEL = 0, VK_PERFORMANCE_VALUE_TYPE_UINT64_INTEL = 1, VK_PERFORMANCE_VALUE_TYPE_FLOAT_INTEL = 2, VK_PERFORMANCE_VALUE_TYPE_BOOL_INTEL = 3, VK_PERFORMANCE_VALUE_TYPE_STRING_INTEL = 4, VK_PERFORMANCE_VALUE_TYPE_MAX_ENUM_INTEL = $7FFFFFFF ); type P_VkPerformanceValueDataINTEL = ^VkPerformanceValueDataINTEL; VkPerformanceValueDataINTEL = record case Byte of 0:( value32 :T_uint32_t ); 1:( value64 :T_uint64_t ); 2:( valueFloat :T_float ); 3:( valueBool :VkBool32 ); 4:( valueString :P_char ); end; type P_VkPerformanceValueINTEL = ^VkPerformanceValueINTEL; VkPerformanceValueINTEL = record type_ :VkPerformanceValueTypeINTEL; data :VkPerformanceValueDataINTEL; end; type P_VkInitializePerformanceApiInfoINTEL = ^VkInitializePerformanceApiInfoINTEL; VkInitializePerformanceApiInfoINTEL = record sType :VkStructureType; pNext :P_void; pUserData :P_void; end; type P_VkQueryPoolPerformanceQueryCreateInfoINTEL = ^VkQueryPoolPerformanceQueryCreateInfoINTEL; VkQueryPoolPerformanceQueryCreateInfoINTEL = record sType :VkStructureType; pNext :P_void; performanceCountersSampling :VkQueryPoolSamplingModeINTEL; end; type P_VkQueryPoolCreateInfoINTEL = ^VkQueryPoolCreateInfoINTEL; VkQueryPoolCreateInfoINTEL = VkQueryPoolPerformanceQueryCreateInfoINTEL; type P_VkPerformanceMarkerInfoINTEL = ^VkPerformanceMarkerInfoINTEL; VkPerformanceMarkerInfoINTEL = record sType :VkStructureType; pNext :P_void; marker :T_uint64_t; end; type P_VkPerformanceStreamMarkerInfoINTEL = ^VkPerformanceStreamMarkerInfoINTEL; VkPerformanceStreamMarkerInfoINTEL = record sType :VkStructureType; pNext :P_void; marker :T_uint32_t; end; type P_VkPerformanceOverrideInfoINTEL = ^VkPerformanceOverrideInfoINTEL; VkPerformanceOverrideInfoINTEL = record sType :VkStructureType; pNext :P_void; type_ :VkPerformanceOverrideTypeINTEL; enable :VkBool32; parameter :T_uint64_t; end; type P_VkPerformanceConfigurationAcquireInfoINTEL = ^VkPerformanceConfigurationAcquireInfoINTEL; VkPerformanceConfigurationAcquireInfoINTEL = record sType :VkStructureType; pNext :P_void; type_ :VkPerformanceConfigurationTypeINTEL; end; type PFN_vkInitializePerformanceApiINTEL = function( device_:VkDevice; const pInitializeInfo_:P_VkInitializePerformanceApiInfoINTEL ) :VkResult; type PFN_vkUninitializePerformanceApiINTEL = procedure( device_:VkDevice ); type PFN_vkCmdSetPerformanceMarkerINTEL = function( commandBuffer_:VkCommandBuffer; const pMarkerInfo_:P_VkPerformanceMarkerInfoINTEL ) :VkResult; type PFN_vkCmdSetPerformanceStreamMarkerINTEL = function( commandBuffer_:VkCommandBuffer; const pMarkerInfo_:P_VkPerformanceStreamMarkerInfoINTEL ) :VkResult; type PFN_vkCmdSetPerformanceOverrideINTEL = function( commandBuffer_:VkCommandBuffer; const pOverrideInfo_:P_VkPerformanceOverrideInfoINTEL ) :VkResult; type PFN_vkAcquirePerformanceConfigurationINTEL = function( device_:VkDevice; const pAcquireInfo_:P_VkPerformanceConfigurationAcquireInfoINTEL; pConfiguration_:P_VkPerformanceConfigurationINTEL ) :VkResult; type PFN_vkReleasePerformanceConfigurationINTEL = function( device_:VkDevice; configuration_:VkPerformanceConfigurationINTEL ) :VkResult; type PFN_vkQueueSetPerformanceConfigurationINTEL = function( queue_:VkQueue; configuration_:VkPerformanceConfigurationINTEL ) :VkResult; type PFN_vkGetPerformanceParameterINTEL = function( device_:VkDevice; parameter_:VkPerformanceParameterTypeINTEL; pValue_:P_VkPerformanceValueINTEL ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkInitializePerformanceApiINTEL( device_:VkDevice; pInitializeInfo_:P_VkInitializePerformanceApiInfoINTEL ) :VkResult; stdcall; external DLLNAME; procedure vkUninitializePerformanceApiINTEL( device_:VkDevice ); stdcall; external DLLNAME; function vkCmdSetPerformanceMarkerINTEL( commandBuffer_:VkCommandBuffer; pMarkerInfo_:P_VkPerformanceMarkerInfoINTEL ) :VkResult; stdcall; external DLLNAME; function vkCmdSetPerformanceStreamMarkerINTEL( commandBuffer_:VkCommandBuffer; pMarkerInfo_:P_VkPerformanceStreamMarkerInfoINTEL ) :VkResult; stdcall; external DLLNAME; function vkCmdSetPerformanceOverrideINTEL( commandBuffer_:VkCommandBuffer; pOverrideInfo_:P_VkPerformanceOverrideInfoINTEL ) :VkResult; stdcall; external DLLNAME; function vkAcquirePerformanceConfigurationINTEL( device_:VkDevice; pAcquireInfo_:P_VkPerformanceConfigurationAcquireInfoINTEL; pConfiguration_:P_VkPerformanceConfigurationINTEL ) :VkResult; stdcall; external DLLNAME; function vkReleasePerformanceConfigurationINTEL( device_:VkDevice; configuration_:VkPerformanceConfigurationINTEL ) :VkResult; stdcall; external DLLNAME; function vkQueueSetPerformanceConfigurationINTEL( queue_:VkQueue; configuration_:VkPerformanceConfigurationINTEL ) :VkResult; stdcall; external DLLNAME; function vkGetPerformanceParameterINTEL( device_:VkDevice; parameter_:VkPerformanceParameterTypeINTEL; pValue_:P_VkPerformanceValueINTEL ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_EXT_pci_bus_info = 1; const VK_EXT_PCI_BUS_INFO_SPEC_VERSION = 2; const VK_EXT_PCI_BUS_INFO_EXTENSION_NAME = 'VK_EXT_pci_bus_info'; type P_VkPhysicalDevicePCIBusInfoPropertiesEXT = ^VkPhysicalDevicePCIBusInfoPropertiesEXT; VkPhysicalDevicePCIBusInfoPropertiesEXT = record sType :VkStructureType; pNext :P_void; pciDomain :T_uint32_t; pciBus :T_uint32_t; pciDevice :T_uint32_t; pciFunction :T_uint32_t; end; const VK_AMD_display_native_hdr = 1; const VK_AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION = 1; const VK_AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME = 'VK_AMD_display_native_hdr'; type P_VkDisplayNativeHdrSurfaceCapabilitiesAMD = ^VkDisplayNativeHdrSurfaceCapabilitiesAMD; VkDisplayNativeHdrSurfaceCapabilitiesAMD = record sType :VkStructureType; pNext :P_void; localDimmingSupport :VkBool32; end; type P_VkSwapchainDisplayNativeHdrCreateInfoAMD = ^VkSwapchainDisplayNativeHdrCreateInfoAMD; VkSwapchainDisplayNativeHdrCreateInfoAMD = record sType :VkStructureType; pNext :P_void; localDimmingEnable :VkBool32; end; type PFN_vkSetLocalDimmingAMD = procedure( device_:VkDevice; swapChain_:VkSwapchainKHR; localDimmingEnable_:VkBool32 ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkSetLocalDimmingAMD( device_:VkDevice; swapChain_:VkSwapchainKHR; localDimmingEnable_:VkBool32 ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_fragment_density_map = 1; const VK_EXT_FRAGMENT_DENSITY_MAP_SPEC_VERSION = 1; const VK_EXT_FRAGMENT_DENSITY_MAP_EXTENSION_NAME = 'VK_EXT_fragment_density_map'; type P_VkPhysicalDeviceFragmentDensityMapFeaturesEXT = ^VkPhysicalDeviceFragmentDensityMapFeaturesEXT; VkPhysicalDeviceFragmentDensityMapFeaturesEXT = record sType :VkStructureType; pNext :P_void; fragmentDensityMap :VkBool32; fragmentDensityMapDynamic :VkBool32; fragmentDensityMapNonSubsampledImages :VkBool32; end; type P_VkPhysicalDeviceFragmentDensityMapPropertiesEXT = ^VkPhysicalDeviceFragmentDensityMapPropertiesEXT; VkPhysicalDeviceFragmentDensityMapPropertiesEXT = record sType :VkStructureType; pNext :P_void; minFragmentDensityTexelSize :VkExtent2D; maxFragmentDensityTexelSize :VkExtent2D; fragmentDensityInvocations :VkBool32; end; type P_VkRenderPassFragmentDensityMapCreateInfoEXT = ^VkRenderPassFragmentDensityMapCreateInfoEXT; VkRenderPassFragmentDensityMapCreateInfoEXT = record sType :VkStructureType; pNext :P_void; fragmentDensityMapAttachment :VkAttachmentReference; end; const VK_EXT_scalar_block_layout = 1; const VK_EXT_SCALAR_BLOCK_LAYOUT_SPEC_VERSION = 1; const VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME = 'VK_EXT_scalar_block_layout'; type P_VkPhysicalDeviceScalarBlockLayoutFeaturesEXT = ^VkPhysicalDeviceScalarBlockLayoutFeaturesEXT; VkPhysicalDeviceScalarBlockLayoutFeaturesEXT = VkPhysicalDeviceScalarBlockLayoutFeatures; const VK_GOOGLE_hlsl_functionality1 = 1; const VK_GOOGLE_HLSL_FUNCTIONALITY1_SPEC_VERSION = 1; const VK_GOOGLE_HLSL_FUNCTIONALITY1_EXTENSION_NAME = 'VK_GOOGLE_hlsl_functionality1'; const VK_GOOGLE_decorate_string = 1; const VK_GOOGLE_DECORATE_STRING_SPEC_VERSION = 1; const VK_GOOGLE_DECORATE_STRING_EXTENSION_NAME = 'VK_GOOGLE_decorate_string'; const VK_EXT_subgroup_size_control = 1; const VK_EXT_SUBGROUP_SIZE_CONTROL_SPEC_VERSION = 2; const VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME = 'VK_EXT_subgroup_size_control'; type P_VkPhysicalDeviceSubgroupSizeControlFeaturesEXT = ^VkPhysicalDeviceSubgroupSizeControlFeaturesEXT; VkPhysicalDeviceSubgroupSizeControlFeaturesEXT = record sType :VkStructureType; pNext :P_void; subgroupSizeControl :VkBool32; computeFullSubgroups :VkBool32; end; type P_VkPhysicalDeviceSubgroupSizeControlPropertiesEXT = ^VkPhysicalDeviceSubgroupSizeControlPropertiesEXT; VkPhysicalDeviceSubgroupSizeControlPropertiesEXT = record sType :VkStructureType; pNext :P_void; minSubgroupSize :T_uint32_t; maxSubgroupSize :T_uint32_t; maxComputeWorkgroupSubgroups :T_uint32_t; requiredSubgroupSizeStages :VkShaderStageFlags; end; type P_VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT = ^VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT; VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT = record sType :VkStructureType; pNext :P_void; requiredSubgroupSize :T_uint32_t; end; const VK_AMD_shader_core_properties2 = 1; const VK_AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION = 1; const VK_AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME = 'VK_AMD_shader_core_properties2'; type P_VkShaderCorePropertiesFlagBitsAMD = ^VkShaderCorePropertiesFlagBitsAMD; VkShaderCorePropertiesFlagBitsAMD = ( VK_SHADER_CORE_PROPERTIES_FLAG_BITS_MAX_ENUM_AMD = $7FFFFFFF ); type P_VkShaderCorePropertiesFlagsAMD = ^VkShaderCorePropertiesFlagsAMD; VkShaderCorePropertiesFlagsAMD = VkFlags; type P_VkPhysicalDeviceShaderCoreProperties2AMD = ^VkPhysicalDeviceShaderCoreProperties2AMD; VkPhysicalDeviceShaderCoreProperties2AMD = record sType :VkStructureType; pNext :P_void; shaderCoreFeatures :VkShaderCorePropertiesFlagsAMD; activeComputeUnitCount :T_uint32_t; end; const VK_AMD_device_coherent_memory = 1; const VK_AMD_DEVICE_COHERENT_MEMORY_SPEC_VERSION = 1; const VK_AMD_DEVICE_COHERENT_MEMORY_EXTENSION_NAME = 'VK_AMD_device_coherent_memory'; type P_VkPhysicalDeviceCoherentMemoryFeaturesAMD = ^VkPhysicalDeviceCoherentMemoryFeaturesAMD; VkPhysicalDeviceCoherentMemoryFeaturesAMD = record sType :VkStructureType; pNext :P_void; deviceCoherentMemory :VkBool32; end; const VK_EXT_shader_image_atomic_int64 = 1; const VK_EXT_SHADER_IMAGE_ATOMIC_INT64_SPEC_VERSION = 1; const VK_EXT_SHADER_IMAGE_ATOMIC_INT64_EXTENSION_NAME = 'VK_EXT_shader_image_atomic_int64'; type P_VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT = ^VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT; VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT = record sType :VkStructureType; pNext :P_void; shaderImageInt64Atomics :VkBool32; sparseImageInt64Atomics :VkBool32; end; const VK_EXT_memory_budget = 1; const VK_EXT_MEMORY_BUDGET_SPEC_VERSION = 1; const VK_EXT_MEMORY_BUDGET_EXTENSION_NAME = 'VK_EXT_memory_budget'; type P_VkPhysicalDeviceMemoryBudgetPropertiesEXT = ^VkPhysicalDeviceMemoryBudgetPropertiesEXT; VkPhysicalDeviceMemoryBudgetPropertiesEXT = record sType :VkStructureType; pNext :P_void; heapBudget :array [ 0..VK_MAX_MEMORY_HEAPS-1 ] of VkDeviceSize; heapUsage :array [ 0..VK_MAX_MEMORY_HEAPS-1 ] of VkDeviceSize; end; const VK_EXT_memory_priority = 1; const VK_EXT_MEMORY_PRIORITY_SPEC_VERSION = 1; const VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME = 'VK_EXT_memory_priority'; type P_VkPhysicalDeviceMemoryPriorityFeaturesEXT = ^VkPhysicalDeviceMemoryPriorityFeaturesEXT; VkPhysicalDeviceMemoryPriorityFeaturesEXT = record sType :VkStructureType; pNext :P_void; memoryPriority :VkBool32; end; type P_VkMemoryPriorityAllocateInfoEXT = ^VkMemoryPriorityAllocateInfoEXT; VkMemoryPriorityAllocateInfoEXT = record sType :VkStructureType; pNext :P_void; priority :T_float; end; const VK_NV_dedicated_allocation_image_aliasing = 1; const VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_SPEC_VERSION = 1; const VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_EXTENSION_NAME = 'VK_NV_dedicated_allocation_image_aliasing'; type P_VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV = ^VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV; VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV = record sType :VkStructureType; pNext :P_void; dedicatedAllocationImageAliasing :VkBool32; end; const VK_EXT_buffer_device_address = 1; const VK_EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION = 2; const VK_EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME = 'VK_EXT_buffer_device_address'; type P_VkPhysicalDeviceBufferDeviceAddressFeaturesEXT = ^VkPhysicalDeviceBufferDeviceAddressFeaturesEXT; VkPhysicalDeviceBufferDeviceAddressFeaturesEXT = record sType :VkStructureType; pNext :P_void; bufferDeviceAddress :VkBool32; bufferDeviceAddressCaptureReplay :VkBool32; bufferDeviceAddressMultiDevice :VkBool32; end; type P_VkPhysicalDeviceBufferAddressFeaturesEXT = ^VkPhysicalDeviceBufferAddressFeaturesEXT; VkPhysicalDeviceBufferAddressFeaturesEXT = VkPhysicalDeviceBufferDeviceAddressFeaturesEXT; type P_VkBufferDeviceAddressInfoEXT = ^VkBufferDeviceAddressInfoEXT; VkBufferDeviceAddressInfoEXT = VkBufferDeviceAddressInfo; type P_VkBufferDeviceAddressCreateInfoEXT = ^VkBufferDeviceAddressCreateInfoEXT; VkBufferDeviceAddressCreateInfoEXT = record sType :VkStructureType; pNext :P_void; deviceAddress :VkDeviceAddress; end; type PFN_vkGetBufferDeviceAddressEXT = function( device_:VkDevice; const pInfo_:P_VkBufferDeviceAddressInfo ) :VkDeviceAddress; {$IFNDEF VK_NO_PROTOTYPES } function vkGetBufferDeviceAddressEXT( device_:VkDevice; pInfo_:P_VkBufferDeviceAddressInfo ) :VkDeviceAddress; stdcall; external DLLNAME; {$ENDIF} const VK_EXT_tooling_info = 1; const VK_EXT_TOOLING_INFO_SPEC_VERSION = 1; const VK_EXT_TOOLING_INFO_EXTENSION_NAME = 'VK_EXT_tooling_info'; type P_VkToolPurposeFlagBitsEXT = ^VkToolPurposeFlagBitsEXT; VkToolPurposeFlagBitsEXT = ( VK_TOOL_PURPOSE_VALIDATION_BIT_EXT = $00000001, VK_TOOL_PURPOSE_PROFILING_BIT_EXT = $00000002, VK_TOOL_PURPOSE_TRACING_BIT_EXT = $00000004, VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT_EXT = $00000008, VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT_EXT = $00000010, VK_TOOL_PURPOSE_DEBUG_REPORTING_BIT_EXT = $00000020, VK_TOOL_PURPOSE_DEBUG_MARKERS_BIT_EXT = $00000040, VK_TOOL_PURPOSE_FLAG_BITS_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkToolPurposeFlagsEXT = ^VkToolPurposeFlagsEXT; VkToolPurposeFlagsEXT = VkFlags; type P_VkPhysicalDeviceToolPropertiesEXT = ^VkPhysicalDeviceToolPropertiesEXT; VkPhysicalDeviceToolPropertiesEXT = record sType :VkStructureType; pNext :P_void; name :array [ 0..VK_MAX_EXTENSION_NAME_SIZE-1 ] of T_char; version :array [ 0..VK_MAX_EXTENSION_NAME_SIZE-1 ] of T_char; purposes :VkToolPurposeFlagsEXT; description :array [ 0..VK_MAX_DESCRIPTION_SIZE-1 ] of T_char; layer :array [ 0..VK_MAX_EXTENSION_NAME_SIZE-1 ] of T_char; end; type PFN_vkGetPhysicalDeviceToolPropertiesEXT = function( physicalDevice_:VkPhysicalDevice; pToolCount_:P_uint32_t; pToolProperties_:P_VkPhysicalDeviceToolPropertiesEXT ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetPhysicalDeviceToolPropertiesEXT( physicalDevice_:VkPhysicalDevice; pToolCount_:P_uint32_t; pToolProperties_:P_VkPhysicalDeviceToolPropertiesEXT ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_EXT_separate_stencil_usage = 1; const VK_EXT_SEPARATE_STENCIL_USAGE_SPEC_VERSION = 1; const VK_EXT_SEPARATE_STENCIL_USAGE_EXTENSION_NAME = 'VK_EXT_separate_stencil_usage'; type P_VkImageStencilUsageCreateInfoEXT = ^VkImageStencilUsageCreateInfoEXT; VkImageStencilUsageCreateInfoEXT = VkImageStencilUsageCreateInfo; const VK_EXT_validation_features = 1; const VK_EXT_VALIDATION_FEATURES_SPEC_VERSION = 4; const VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME = 'VK_EXT_validation_features'; type P_VkValidationFeatureEnableEXT = ^VkValidationFeatureEnableEXT; VkValidationFeatureEnableEXT = ( VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT = 0, VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT = 1, VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT = 2, VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT = 3, VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT = 4, VK_VALIDATION_FEATURE_ENABLE_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkValidationFeatureDisableEXT = ^VkValidationFeatureDisableEXT; VkValidationFeatureDisableEXT = ( VK_VALIDATION_FEATURE_DISABLE_ALL_EXT = 0, VK_VALIDATION_FEATURE_DISABLE_SHADERS_EXT = 1, VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT = 2, VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT = 3, VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT = 4, VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT = 5, VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT = 6, VK_VALIDATION_FEATURE_DISABLE_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkValidationFeaturesEXT = ^VkValidationFeaturesEXT; VkValidationFeaturesEXT = record sType :VkStructureType; pNext :P_void; enabledValidationFeatureCount :T_uint32_t; pEnabledValidationFeatures :P_VkValidationFeatureEnableEXT; disabledValidationFeatureCount :T_uint32_t; pDisabledValidationFeatures :P_VkValidationFeatureDisableEXT; end; const VK_NV_cooperative_matrix = 1; const VK_NV_COOPERATIVE_MATRIX_SPEC_VERSION = 1; const VK_NV_COOPERATIVE_MATRIX_EXTENSION_NAME = 'VK_NV_cooperative_matrix'; type P_VkComponentTypeNV = ^VkComponentTypeNV; VkComponentTypeNV = ( VK_COMPONENT_TYPE_FLOAT16_NV = 0, VK_COMPONENT_TYPE_FLOAT32_NV = 1, VK_COMPONENT_TYPE_FLOAT64_NV = 2, VK_COMPONENT_TYPE_SINT8_NV = 3, VK_COMPONENT_TYPE_SINT16_NV = 4, VK_COMPONENT_TYPE_SINT32_NV = 5, VK_COMPONENT_TYPE_SINT64_NV = 6, VK_COMPONENT_TYPE_UINT8_NV = 7, VK_COMPONENT_TYPE_UINT16_NV = 8, VK_COMPONENT_TYPE_UINT32_NV = 9, VK_COMPONENT_TYPE_UINT64_NV = 10, VK_COMPONENT_TYPE_MAX_ENUM_NV = $7FFFFFFF ); type P_VkScopeNV = ^VkScopeNV; VkScopeNV = ( VK_SCOPE_DEVICE_NV = 1, VK_SCOPE_WORKGROUP_NV = 2, VK_SCOPE_SUBGROUP_NV = 3, VK_SCOPE_QUEUE_FAMILY_NV = 5, VK_SCOPE_MAX_ENUM_NV = $7FFFFFFF ); type P_VkCooperativeMatrixPropertiesNV = ^VkCooperativeMatrixPropertiesNV; VkCooperativeMatrixPropertiesNV = record sType :VkStructureType; pNext :P_void; MSize :T_uint32_t; NSize :T_uint32_t; KSize :T_uint32_t; AType :VkComponentTypeNV; BType :VkComponentTypeNV; CType :VkComponentTypeNV; DType :VkComponentTypeNV; scope :VkScopeNV; end; type P_VkPhysicalDeviceCooperativeMatrixFeaturesNV = ^VkPhysicalDeviceCooperativeMatrixFeaturesNV; VkPhysicalDeviceCooperativeMatrixFeaturesNV = record sType :VkStructureType; pNext :P_void; cooperativeMatrix :VkBool32; cooperativeMatrixRobustBufferAccess :VkBool32; end; type P_VkPhysicalDeviceCooperativeMatrixPropertiesNV = ^VkPhysicalDeviceCooperativeMatrixPropertiesNV; VkPhysicalDeviceCooperativeMatrixPropertiesNV = record sType :VkStructureType; pNext :P_void; cooperativeMatrixSupportedStages :VkShaderStageFlags; end; type PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV = function( physicalDevice_:VkPhysicalDevice; pPropertyCount_:P_uint32_t; pProperties_:P_VkCooperativeMatrixPropertiesNV ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetPhysicalDeviceCooperativeMatrixPropertiesNV( physicalDevice_:VkPhysicalDevice; pPropertyCount_:P_uint32_t; pProperties_:P_VkCooperativeMatrixPropertiesNV ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_NV_coverage_reduction_mode = 1; const VK_NV_COVERAGE_REDUCTION_MODE_SPEC_VERSION = 1; const VK_NV_COVERAGE_REDUCTION_MODE_EXTENSION_NAME = 'VK_NV_coverage_reduction_mode'; type P_VkCoverageReductionModeNV = ^VkCoverageReductionModeNV; VkCoverageReductionModeNV = ( VK_COVERAGE_REDUCTION_MODE_MERGE_NV = 0, VK_COVERAGE_REDUCTION_MODE_TRUNCATE_NV = 1, VK_COVERAGE_REDUCTION_MODE_MAX_ENUM_NV = $7FFFFFFF ); type P_VkPipelineCoverageReductionStateCreateFlagsNV = ^VkPipelineCoverageReductionStateCreateFlagsNV; VkPipelineCoverageReductionStateCreateFlagsNV = VkFlags; type P_VkPhysicalDeviceCoverageReductionModeFeaturesNV = ^VkPhysicalDeviceCoverageReductionModeFeaturesNV; VkPhysicalDeviceCoverageReductionModeFeaturesNV = record sType :VkStructureType; pNext :P_void; coverageReductionMode :VkBool32; end; type P_VkPipelineCoverageReductionStateCreateInfoNV = ^VkPipelineCoverageReductionStateCreateInfoNV; VkPipelineCoverageReductionStateCreateInfoNV = record sType :VkStructureType; pNext :P_void; flags :VkPipelineCoverageReductionStateCreateFlagsNV; coverageReductionMode :VkCoverageReductionModeNV; end; type P_VkFramebufferMixedSamplesCombinationNV = ^VkFramebufferMixedSamplesCombinationNV; VkFramebufferMixedSamplesCombinationNV = record sType :VkStructureType; pNext :P_void; coverageReductionMode :VkCoverageReductionModeNV; rasterizationSamples :VkSampleCountFlagBits; depthStencilSamples :VkSampleCountFlags; colorSamples :VkSampleCountFlags; end; type PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV = function( physicalDevice_:VkPhysicalDevice; pCombinationCount_:P_uint32_t; pCombinations_:P_VkFramebufferMixedSamplesCombinationNV ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV( physicalDevice_:VkPhysicalDevice; pCombinationCount_:P_uint32_t; pCombinations_:P_VkFramebufferMixedSamplesCombinationNV ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_EXT_fragment_shader_interlock = 1; const VK_EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION = 1; const VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME = 'VK_EXT_fragment_shader_interlock'; type P_VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT = ^VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT; VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT = record sType :VkStructureType; pNext :P_void; fragmentShaderSampleInterlock :VkBool32; fragmentShaderPixelInterlock :VkBool32; fragmentShaderShadingRateInterlock :VkBool32; end; const VK_EXT_ycbcr_image_arrays = 1; const VK_EXT_YCBCR_IMAGE_ARRAYS_SPEC_VERSION = 1; const VK_EXT_YCBCR_IMAGE_ARRAYS_EXTENSION_NAME = 'VK_EXT_ycbcr_image_arrays'; type P_VkPhysicalDeviceYcbcrImageArraysFeaturesEXT = ^VkPhysicalDeviceYcbcrImageArraysFeaturesEXT; VkPhysicalDeviceYcbcrImageArraysFeaturesEXT = record sType :VkStructureType; pNext :P_void; ycbcrImageArrays :VkBool32; end; const VK_EXT_headless_surface = 1; const VK_EXT_HEADLESS_SURFACE_SPEC_VERSION = 1; const VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME = 'VK_EXT_headless_surface'; type P_VkHeadlessSurfaceCreateFlagsEXT = ^VkHeadlessSurfaceCreateFlagsEXT; VkHeadlessSurfaceCreateFlagsEXT = VkFlags; type P_VkHeadlessSurfaceCreateInfoEXT = ^VkHeadlessSurfaceCreateInfoEXT; VkHeadlessSurfaceCreateInfoEXT = record sType :VkStructureType; pNext :P_void; flags :VkHeadlessSurfaceCreateFlagsEXT; end; type PFN_vkCreateHeadlessSurfaceEXT = function( instance_:VkInstance; const pCreateInfo_:P_VkHeadlessSurfaceCreateInfoEXT; const pAllocator_:P_VkAllocationCallbacks; pSurface_:P_VkSurfaceKHR ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkCreateHeadlessSurfaceEXT( instance_:VkInstance; pCreateInfo_:P_VkHeadlessSurfaceCreateInfoEXT; pAllocator_:P_VkAllocationCallbacks; pSurface_:P_VkSurfaceKHR ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_EXT_line_rasterization = 1; const VK_EXT_LINE_RASTERIZATION_SPEC_VERSION = 1; const VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME = 'VK_EXT_line_rasterization'; type P_VkLineRasterizationModeEXT = ^VkLineRasterizationModeEXT; VkLineRasterizationModeEXT = ( VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT = 0, VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT = 1, VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT = 2, VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT = 3, VK_LINE_RASTERIZATION_MODE_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkPhysicalDeviceLineRasterizationFeaturesEXT = ^VkPhysicalDeviceLineRasterizationFeaturesEXT; VkPhysicalDeviceLineRasterizationFeaturesEXT = record sType :VkStructureType; pNext :P_void; rectangularLines :VkBool32; bresenhamLines :VkBool32; smoothLines :VkBool32; stippledRectangularLines :VkBool32; stippledBresenhamLines :VkBool32; stippledSmoothLines :VkBool32; end; type P_VkPhysicalDeviceLineRasterizationPropertiesEXT = ^VkPhysicalDeviceLineRasterizationPropertiesEXT; VkPhysicalDeviceLineRasterizationPropertiesEXT = record sType :VkStructureType; pNext :P_void; lineSubPixelPrecisionBits :T_uint32_t; end; type P_VkPipelineRasterizationLineStateCreateInfoEXT = ^VkPipelineRasterizationLineStateCreateInfoEXT; VkPipelineRasterizationLineStateCreateInfoEXT = record sType :VkStructureType; pNext :P_void; lineRasterizationMode :VkLineRasterizationModeEXT; stippledLineEnable :VkBool32; lineStippleFactor :T_uint32_t; lineStipplePattern :T_uint16_t; end; type PFN_vkCmdSetLineStippleEXT = procedure( commandBuffer_:VkCommandBuffer; lineStippleFactor_:T_uint32_t; lineStipplePattern_:T_uint16_t ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdSetLineStippleEXT( commandBuffer_:VkCommandBuffer; lineStippleFactor_:T_uint32_t; lineStipplePattern_:T_uint16_t ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_shader_atomic_float = 1; const VK_EXT_SHADER_ATOMIC_FLOAT_SPEC_VERSION = 1; const VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME = 'VK_EXT_shader_atomic_float'; type P_VkPhysicalDeviceShaderAtomicFloatFeaturesEXT = ^VkPhysicalDeviceShaderAtomicFloatFeaturesEXT; VkPhysicalDeviceShaderAtomicFloatFeaturesEXT = record sType :VkStructureType; pNext :P_void; shaderBufferFloat32Atomics :VkBool32; shaderBufferFloat32AtomicAdd :VkBool32; shaderBufferFloat64Atomics :VkBool32; shaderBufferFloat64AtomicAdd :VkBool32; shaderSharedFloat32Atomics :VkBool32; shaderSharedFloat32AtomicAdd :VkBool32; shaderSharedFloat64Atomics :VkBool32; shaderSharedFloat64AtomicAdd :VkBool32; shaderImageFloat32Atomics :VkBool32; shaderImageFloat32AtomicAdd :VkBool32; sparseImageFloat32Atomics :VkBool32; sparseImageFloat32AtomicAdd :VkBool32; end; const VK_EXT_host_query_reset = 1; const VK_EXT_HOST_QUERY_RESET_SPEC_VERSION = 1; const VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME = 'VK_EXT_host_query_reset'; type P_VkPhysicalDeviceHostQueryResetFeaturesEXT = ^VkPhysicalDeviceHostQueryResetFeaturesEXT; VkPhysicalDeviceHostQueryResetFeaturesEXT = VkPhysicalDeviceHostQueryResetFeatures; type PFN_vkResetQueryPoolEXT = procedure( device_:VkDevice; queryPool_:VkQueryPool; firstQuery_:T_uint32_t; queryCount_:T_uint32_t ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkResetQueryPoolEXT( device_:VkDevice; queryPool_:VkQueryPool; firstQuery_:T_uint32_t; queryCount_:T_uint32_t ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_index_type_uint8 = 1; const VK_EXT_INDEX_TYPE_UINT8_SPEC_VERSION = 1; const VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME = 'VK_EXT_index_type_uint8'; type P_VkPhysicalDeviceIndexTypeUint8FeaturesEXT = ^VkPhysicalDeviceIndexTypeUint8FeaturesEXT; VkPhysicalDeviceIndexTypeUint8FeaturesEXT = record sType :VkStructureType; pNext :P_void; indexTypeUint8 :VkBool32; end; const VK_EXT_extended_dynamic_state = 1; const VK_EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION = 1; const VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME = 'VK_EXT_extended_dynamic_state'; type P_VkPhysicalDeviceExtendedDynamicStateFeaturesEXT = ^VkPhysicalDeviceExtendedDynamicStateFeaturesEXT; VkPhysicalDeviceExtendedDynamicStateFeaturesEXT = record sType :VkStructureType; pNext :P_void; extendedDynamicState :VkBool32; end; type PFN_vkCmdSetCullModeEXT = procedure( commandBuffer_:VkCommandBuffer; cullMode_:VkCullModeFlags ); type PFN_vkCmdSetFrontFaceEXT = procedure( commandBuffer_:VkCommandBuffer; frontFace_:VkFrontFace ); type PFN_vkCmdSetPrimitiveTopologyEXT = procedure( commandBuffer_:VkCommandBuffer; primitiveTopology_:VkPrimitiveTopology ); type PFN_vkCmdSetViewportWithCountEXT = procedure( commandBuffer_:VkCommandBuffer; viewportCount_:T_uint32_t; const pViewports_:P_VkViewport ); type PFN_vkCmdSetScissorWithCountEXT = procedure( commandBuffer_:VkCommandBuffer; scissorCount_:T_uint32_t; const pScissors_:P_VkRect2D ); type PFN_vkCmdBindVertexBuffers2EXT = procedure( commandBuffer_:VkCommandBuffer; firstBinding_:T_uint32_t; bindingCount_:T_uint32_t; const pBuffers_:P_VkBuffer; const pOffsets_:P_VkDeviceSize; const pSizes_:P_VkDeviceSize; const pStrides_:P_VkDeviceSize ); type PFN_vkCmdSetDepthTestEnableEXT = procedure( commandBuffer_:VkCommandBuffer; depthTestEnable_:VkBool32 ); type PFN_vkCmdSetDepthWriteEnableEXT = procedure( commandBuffer_:VkCommandBuffer; depthWriteEnable_:VkBool32 ); type PFN_vkCmdSetDepthCompareOpEXT = procedure( commandBuffer_:VkCommandBuffer; depthCompareOp_:VkCompareOp ); type PFN_vkCmdSetDepthBoundsTestEnableEXT = procedure( commandBuffer_:VkCommandBuffer; depthBoundsTestEnable_:VkBool32 ); type PFN_vkCmdSetStencilTestEnableEXT = procedure( commandBuffer_:VkCommandBuffer; stencilTestEnable_:VkBool32 ); type PFN_vkCmdSetStencilOpEXT = procedure( commandBuffer_:VkCommandBuffer; faceMask_:VkStencilFaceFlags; failOp_:VkStencilOp; passOp_:VkStencilOp; depthFailOp_:VkStencilOp; compareOp_:VkCompareOp ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdSetCullModeEXT( commandBuffer_:VkCommandBuffer; cullMode_:VkCullModeFlags ); stdcall; external DLLNAME; procedure vkCmdSetFrontFaceEXT( commandBuffer_:VkCommandBuffer; frontFace_:VkFrontFace ); stdcall; external DLLNAME; procedure vkCmdSetPrimitiveTopologyEXT( commandBuffer_:VkCommandBuffer; primitiveTopology_:VkPrimitiveTopology ); stdcall; external DLLNAME; procedure vkCmdSetViewportWithCountEXT( commandBuffer_:VkCommandBuffer; viewportCount_:T_uint32_t; pViewports_:P_VkViewport ); stdcall; external DLLNAME; procedure vkCmdSetScissorWithCountEXT( commandBuffer_:VkCommandBuffer; scissorCount_:T_uint32_t; pScissors_:P_VkRect2D ); stdcall; external DLLNAME; procedure vkCmdBindVertexBuffers2EXT( commandBuffer_:VkCommandBuffer; firstBinding_:T_uint32_t; bindingCount_:T_uint32_t; pBuffers_:P_VkBuffer; pOffsets_:P_VkDeviceSize; pSizes_:P_VkDeviceSize; pStrides_:P_VkDeviceSize ); stdcall; external DLLNAME; procedure vkCmdSetDepthTestEnableEXT( commandBuffer_:VkCommandBuffer; depthTestEnable_:VkBool32 ); stdcall; external DLLNAME; procedure vkCmdSetDepthWriteEnableEXT( commandBuffer_:VkCommandBuffer; depthWriteEnable_:VkBool32 ); stdcall; external DLLNAME; procedure vkCmdSetDepthCompareOpEXT( commandBuffer_:VkCommandBuffer; depthCompareOp_:VkCompareOp ); stdcall; external DLLNAME; procedure vkCmdSetDepthBoundsTestEnableEXT( commandBuffer_:VkCommandBuffer; depthBoundsTestEnable_:VkBool32 ); stdcall; external DLLNAME; procedure vkCmdSetStencilTestEnableEXT( commandBuffer_:VkCommandBuffer; stencilTestEnable_:VkBool32 ); stdcall; external DLLNAME; procedure vkCmdSetStencilOpEXT( commandBuffer_:VkCommandBuffer; faceMask_:VkStencilFaceFlags; failOp_:VkStencilOp; passOp_:VkStencilOp; depthFailOp_:VkStencilOp; compareOp_:VkCompareOp ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_shader_demote_to_helper_invocation = 1; const VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_SPEC_VERSION = 1; const VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_EXTENSION_NAME = 'VK_EXT_shader_demote_to_helper_invocation'; type P_VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT = ^VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT; VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT = record sType :VkStructureType; pNext :P_void; shaderDemoteToHelperInvocation :VkBool32; end; const VK_NV_device_generated_commands = 1; type P_VkIndirectCommandsLayoutNV = ^VkIndirectCommandsLayoutNV; VkIndirectCommandsLayoutNV = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_NV_DEVICE_GENERATED_COMMANDS_SPEC_VERSION = 3; const VK_NV_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME = 'VK_NV_device_generated_commands'; type P_VkIndirectCommandsTokenTypeNV = ^VkIndirectCommandsTokenTypeNV; VkIndirectCommandsTokenTypeNV = ( VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV = 0, VK_INDIRECT_COMMANDS_TOKEN_TYPE_STATE_FLAGS_NV = 1, VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NV = 2, VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NV = 3, VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV = 4, VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NV = 5, VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NV = 6, VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV = 7, VK_INDIRECT_COMMANDS_TOKEN_TYPE_MAX_ENUM_NV = $7FFFFFFF ); type P_VkIndirectStateFlagBitsNV = ^VkIndirectStateFlagBitsNV; VkIndirectStateFlagBitsNV = ( VK_INDIRECT_STATE_FLAG_FRONTFACE_BIT_NV = $00000001, VK_INDIRECT_STATE_FLAG_BITS_MAX_ENUM_NV = $7FFFFFFF ); type P_VkIndirectStateFlagsNV = ^VkIndirectStateFlagsNV; VkIndirectStateFlagsNV = VkFlags; type P_VkIndirectCommandsLayoutUsageFlagBitsNV = ^VkIndirectCommandsLayoutUsageFlagBitsNV; VkIndirectCommandsLayoutUsageFlagBitsNV = ( VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EXPLICIT_PREPROCESS_BIT_NV = $00000001, VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NV = $00000002, VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NV = $00000004, VK_INDIRECT_COMMANDS_LAYOUT_USAGE_FLAG_BITS_MAX_ENUM_NV = $7FFFFFFF ); type P_VkIndirectCommandsLayoutUsageFlagsNV = ^VkIndirectCommandsLayoutUsageFlagsNV; VkIndirectCommandsLayoutUsageFlagsNV = VkFlags; type P_VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV = ^VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV; VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV = record sType :VkStructureType; pNext :P_void; maxGraphicsShaderGroupCount :T_uint32_t; maxIndirectSequenceCount :T_uint32_t; maxIndirectCommandsTokenCount :T_uint32_t; maxIndirectCommandsStreamCount :T_uint32_t; maxIndirectCommandsTokenOffset :T_uint32_t; maxIndirectCommandsStreamStride :T_uint32_t; minSequencesCountBufferOffsetAlignment :T_uint32_t; minSequencesIndexBufferOffsetAlignment :T_uint32_t; minIndirectCommandsBufferOffsetAlignment :T_uint32_t; end; type P_VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV = ^VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV; VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV = record sType :VkStructureType; pNext :P_void; deviceGeneratedCommands :VkBool32; end; type P_VkGraphicsShaderGroupCreateInfoNV = ^VkGraphicsShaderGroupCreateInfoNV; VkGraphicsShaderGroupCreateInfoNV = record sType :VkStructureType; pNext :P_void; stageCount :T_uint32_t; pStages :P_VkPipelineShaderStageCreateInfo; pVertexInputState :P_VkPipelineVertexInputStateCreateInfo; pTessellationState :P_VkPipelineTessellationStateCreateInfo; end; type P_VkGraphicsPipelineShaderGroupsCreateInfoNV = ^VkGraphicsPipelineShaderGroupsCreateInfoNV; VkGraphicsPipelineShaderGroupsCreateInfoNV = record sType :VkStructureType; pNext :P_void; groupCount :T_uint32_t; pGroups :P_VkGraphicsShaderGroupCreateInfoNV; pipelineCount :T_uint32_t; pPipelines :P_VkPipeline; end; type P_VkBindShaderGroupIndirectCommandNV = ^VkBindShaderGroupIndirectCommandNV; VkBindShaderGroupIndirectCommandNV = record groupIndex :T_uint32_t; end; type P_VkBindIndexBufferIndirectCommandNV = ^VkBindIndexBufferIndirectCommandNV; VkBindIndexBufferIndirectCommandNV = record bufferAddress :VkDeviceAddress; size :T_uint32_t; indexType :VkIndexType; end; type P_VkBindVertexBufferIndirectCommandNV = ^VkBindVertexBufferIndirectCommandNV; VkBindVertexBufferIndirectCommandNV = record bufferAddress :VkDeviceAddress; size :T_uint32_t; stride :T_uint32_t; end; type P_VkSetStateFlagsIndirectCommandNV = ^VkSetStateFlagsIndirectCommandNV; VkSetStateFlagsIndirectCommandNV = record data :T_uint32_t; end; type P_VkIndirectCommandsStreamNV = ^VkIndirectCommandsStreamNV; VkIndirectCommandsStreamNV = record buffer :VkBuffer; offset :VkDeviceSize; end; type P_VkIndirectCommandsLayoutTokenNV = ^VkIndirectCommandsLayoutTokenNV; VkIndirectCommandsLayoutTokenNV = record sType :VkStructureType; pNext :P_void; tokenType :VkIndirectCommandsTokenTypeNV; stream :T_uint32_t; offset :T_uint32_t; vertexBindingUnit :T_uint32_t; vertexDynamicStride :VkBool32; pushconstantPipelineLayout :VkPipelineLayout; pushconstantShaderStageFlags :VkShaderStageFlags; pushconstantOffset :T_uint32_t; pushconstantSize :T_uint32_t; indirectStateFlags :VkIndirectStateFlagsNV; indexTypeCount :T_uint32_t; pIndexTypes :P_VkIndexType; pIndexTypeValues :P_uint32_t; end; type P_VkIndirectCommandsLayoutCreateInfoNV = ^VkIndirectCommandsLayoutCreateInfoNV; VkIndirectCommandsLayoutCreateInfoNV = record sType :VkStructureType; pNext :P_void; flags :VkIndirectCommandsLayoutUsageFlagsNV; pipelineBindPoint :VkPipelineBindPoint; tokenCount :T_uint32_t; pTokens :P_VkIndirectCommandsLayoutTokenNV; streamCount :T_uint32_t; pStreamStrides :P_uint32_t; end; type P_VkGeneratedCommandsInfoNV = ^VkGeneratedCommandsInfoNV; VkGeneratedCommandsInfoNV = record sType :VkStructureType; pNext :P_void; pipelineBindPoint :VkPipelineBindPoint; pipeline :VkPipeline; indirectCommandsLayout :VkIndirectCommandsLayoutNV; streamCount :T_uint32_t; pStreams :P_VkIndirectCommandsStreamNV; sequencesCount :T_uint32_t; preprocessBuffer :VkBuffer; preprocessOffset :VkDeviceSize; preprocessSize :VkDeviceSize; sequencesCountBuffer :VkBuffer; sequencesCountOffset :VkDeviceSize; sequencesIndexBuffer :VkBuffer; sequencesIndexOffset :VkDeviceSize; end; type P_VkGeneratedCommandsMemoryRequirementsInfoNV = ^VkGeneratedCommandsMemoryRequirementsInfoNV; VkGeneratedCommandsMemoryRequirementsInfoNV = record sType :VkStructureType; pNext :P_void; pipelineBindPoint :VkPipelineBindPoint; pipeline :VkPipeline; indirectCommandsLayout :VkIndirectCommandsLayoutNV; maxSequencesCount :T_uint32_t; end; type PFN_vkGetGeneratedCommandsMemoryRequirementsNV = procedure( device_:VkDevice; const pInfo_:P_VkGeneratedCommandsMemoryRequirementsInfoNV; pMemoryRequirements_:P_VkMemoryRequirements2 ); type PFN_vkCmdPreprocessGeneratedCommandsNV = procedure( commandBuffer_:VkCommandBuffer; const pGeneratedCommandsInfo_:P_VkGeneratedCommandsInfoNV ); type PFN_vkCmdExecuteGeneratedCommandsNV = procedure( commandBuffer_:VkCommandBuffer; isPreprocessed_:VkBool32; const pGeneratedCommandsInfo_:P_VkGeneratedCommandsInfoNV ); type PFN_vkCmdBindPipelineShaderGroupNV = procedure( commandBuffer_:VkCommandBuffer; pipelineBindPoint_:VkPipelineBindPoint; pipeline_:VkPipeline; groupIndex_:T_uint32_t ); type PFN_vkCreateIndirectCommandsLayoutNV = function( device_:VkDevice; const pCreateInfo_:P_VkIndirectCommandsLayoutCreateInfoNV; const pAllocator_:P_VkAllocationCallbacks; pIndirectCommandsLayout_:P_VkIndirectCommandsLayoutNV ) :VkResult; type PFN_vkDestroyIndirectCommandsLayoutNV = procedure( device_:VkDevice; indirectCommandsLayout_:VkIndirectCommandsLayoutNV; const pAllocator_:P_VkAllocationCallbacks ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkGetGeneratedCommandsMemoryRequirementsNV( device_:VkDevice; pInfo_:P_VkGeneratedCommandsMemoryRequirementsInfoNV; pMemoryRequirements_:P_VkMemoryRequirements2 ); stdcall; external DLLNAME; procedure vkCmdPreprocessGeneratedCommandsNV( commandBuffer_:VkCommandBuffer; pGeneratedCommandsInfo_:P_VkGeneratedCommandsInfoNV ); stdcall; external DLLNAME; procedure vkCmdExecuteGeneratedCommandsNV( commandBuffer_:VkCommandBuffer; isPreprocessed_:VkBool32; pGeneratedCommandsInfo_:P_VkGeneratedCommandsInfoNV ); stdcall; external DLLNAME; procedure vkCmdBindPipelineShaderGroupNV( commandBuffer_:VkCommandBuffer; pipelineBindPoint_:VkPipelineBindPoint; pipeline_:VkPipeline; groupIndex_:T_uint32_t ); stdcall; external DLLNAME; function vkCreateIndirectCommandsLayoutNV( device_:VkDevice; pCreateInfo_:P_VkIndirectCommandsLayoutCreateInfoNV; pAllocator_:P_VkAllocationCallbacks; pIndirectCommandsLayout_:P_VkIndirectCommandsLayoutNV ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyIndirectCommandsLayoutNV( device_:VkDevice; indirectCommandsLayout_:VkIndirectCommandsLayoutNV; pAllocator_:P_VkAllocationCallbacks ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_texel_buffer_alignment = 1; const VK_EXT_TEXEL_BUFFER_ALIGNMENT_SPEC_VERSION = 1; const VK_EXT_TEXEL_BUFFER_ALIGNMENT_EXTENSION_NAME = 'VK_EXT_texel_buffer_alignment'; type P_VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT = ^VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT; VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT = record sType :VkStructureType; pNext :P_void; texelBufferAlignment :VkBool32; end; type P_VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT = ^VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT; VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT = record sType :VkStructureType; pNext :P_void; storageTexelBufferOffsetAlignmentBytes :VkDeviceSize; storageTexelBufferOffsetSingleTexelAlignment :VkBool32; uniformTexelBufferOffsetAlignmentBytes :VkDeviceSize; uniformTexelBufferOffsetSingleTexelAlignment :VkBool32; end; const VK_QCOM_render_pass_transform = 1; const VK_QCOM_RENDER_PASS_TRANSFORM_SPEC_VERSION = 1; const VK_QCOM_RENDER_PASS_TRANSFORM_EXTENSION_NAME = 'VK_QCOM_render_pass_transform'; type P_VkRenderPassTransformBeginInfoQCOM = ^VkRenderPassTransformBeginInfoQCOM; VkRenderPassTransformBeginInfoQCOM = record sType :VkStructureType; pNext :P_void; transform :VkSurfaceTransformFlagBitsKHR; end; type P_VkCommandBufferInheritanceRenderPassTransformInfoQCOM = ^VkCommandBufferInheritanceRenderPassTransformInfoQCOM; VkCommandBufferInheritanceRenderPassTransformInfoQCOM = record sType :VkStructureType; pNext :P_void; transform :VkSurfaceTransformFlagBitsKHR; renderArea :VkRect2D; end; const VK_EXT_device_memory_report = 1; const VK_EXT_DEVICE_MEMORY_REPORT_SPEC_VERSION = 2; const VK_EXT_DEVICE_MEMORY_REPORT_EXTENSION_NAME = 'VK_EXT_device_memory_report'; type P_VkDeviceMemoryReportEventTypeEXT = ^VkDeviceMemoryReportEventTypeEXT; VkDeviceMemoryReportEventTypeEXT = ( VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_ALLOCATE_EXT = 0, VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_FREE_EXT = 1, VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_IMPORT_EXT = 2, VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_UNIMPORT_EXT = 3, VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_ALLOCATION_FAILED_EXT = 4, VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkDeviceMemoryReportFlagsEXT = ^VkDeviceMemoryReportFlagsEXT; VkDeviceMemoryReportFlagsEXT = VkFlags; type P_VkPhysicalDeviceDeviceMemoryReportFeaturesEXT = ^VkPhysicalDeviceDeviceMemoryReportFeaturesEXT; VkPhysicalDeviceDeviceMemoryReportFeaturesEXT = record sType :VkStructureType; pNext :P_void; deviceMemoryReport :VkBool32; end; type P_VkDeviceMemoryReportCallbackDataEXT = ^VkDeviceMemoryReportCallbackDataEXT; VkDeviceMemoryReportCallbackDataEXT = record sType :VkStructureType; pNext :P_void; flags :VkDeviceMemoryReportFlagsEXT; type_ :VkDeviceMemoryReportEventTypeEXT; memoryObjectId :T_uint64_t; size :VkDeviceSize; objectType :VkObjectType; objectHandle :T_uint64_t; heapIndex :T_uint32_t; end; type PFN_vkDeviceMemoryReportCallbackEXT = procedure( pCallbackData_:P_VkDeviceMemoryReportCallbackDataEXT; pUserData_:P_void ); type P_VkDeviceDeviceMemoryReportCreateInfoEXT = ^VkDeviceDeviceMemoryReportCreateInfoEXT; VkDeviceDeviceMemoryReportCreateInfoEXT = record sType :VkStructureType; pNext :P_void; flags :VkDeviceMemoryReportFlagsEXT; pfnUserCallback :PFN_vkDeviceMemoryReportCallbackEXT; pUserData :P_void; end; const VK_EXT_robustness2 = 1; const VK_EXT_ROBUSTNESS_2_SPEC_VERSION = 1; const VK_EXT_ROBUSTNESS_2_EXTENSION_NAME = 'VK_EXT_robustness2'; type P_VkPhysicalDeviceRobustness2FeaturesEXT = ^VkPhysicalDeviceRobustness2FeaturesEXT; VkPhysicalDeviceRobustness2FeaturesEXT = record sType :VkStructureType; pNext :P_void; robustBufferAccess2 :VkBool32; robustImageAccess2 :VkBool32; nullDescriptor :VkBool32; end; type P_VkPhysicalDeviceRobustness2PropertiesEXT = ^VkPhysicalDeviceRobustness2PropertiesEXT; VkPhysicalDeviceRobustness2PropertiesEXT = record sType :VkStructureType; pNext :P_void; robustStorageBufferAccessSizeAlignment :VkDeviceSize; robustUniformBufferAccessSizeAlignment :VkDeviceSize; end; const VK_EXT_custom_border_color = 1; const VK_EXT_CUSTOM_BORDER_COLOR_SPEC_VERSION = 12; const VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME = 'VK_EXT_custom_border_color'; type P_VkSamplerCustomBorderColorCreateInfoEXT = ^VkSamplerCustomBorderColorCreateInfoEXT; VkSamplerCustomBorderColorCreateInfoEXT = record sType :VkStructureType; pNext :P_void; customBorderColor :VkClearColorValue; format :VkFormat; end; type P_VkPhysicalDeviceCustomBorderColorPropertiesEXT = ^VkPhysicalDeviceCustomBorderColorPropertiesEXT; VkPhysicalDeviceCustomBorderColorPropertiesEXT = record sType :VkStructureType; pNext :P_void; maxCustomBorderColorSamplers :T_uint32_t; end; type P_VkPhysicalDeviceCustomBorderColorFeaturesEXT = ^VkPhysicalDeviceCustomBorderColorFeaturesEXT; VkPhysicalDeviceCustomBorderColorFeaturesEXT = record sType :VkStructureType; pNext :P_void; customBorderColors :VkBool32; customBorderColorWithoutFormat :VkBool32; end; const VK_GOOGLE_user_type = 1; const VK_GOOGLE_USER_TYPE_SPEC_VERSION = 1; const VK_GOOGLE_USER_TYPE_EXTENSION_NAME = 'VK_GOOGLE_user_type'; const VK_EXT_private_data = 1; type P_VkPrivateDataSlotEXT = ^VkPrivateDataSlotEXT; VkPrivateDataSlotEXT = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_EXT_PRIVATE_DATA_SPEC_VERSION = 1; const VK_EXT_PRIVATE_DATA_EXTENSION_NAME = 'VK_EXT_private_data'; type P_VkPrivateDataSlotCreateFlagBitsEXT = ^VkPrivateDataSlotCreateFlagBitsEXT; VkPrivateDataSlotCreateFlagBitsEXT = ( VK_PRIVATE_DATA_SLOT_CREATE_FLAG_BITS_MAX_ENUM_EXT = $7FFFFFFF ); type P_VkPrivateDataSlotCreateFlagsEXT = ^VkPrivateDataSlotCreateFlagsEXT; VkPrivateDataSlotCreateFlagsEXT = VkFlags; type P_VkPhysicalDevicePrivateDataFeaturesEXT = ^VkPhysicalDevicePrivateDataFeaturesEXT; VkPhysicalDevicePrivateDataFeaturesEXT = record sType :VkStructureType; pNext :P_void; privateData :VkBool32; end; type P_VkDevicePrivateDataCreateInfoEXT = ^VkDevicePrivateDataCreateInfoEXT; VkDevicePrivateDataCreateInfoEXT = record sType :VkStructureType; pNext :P_void; privateDataSlotRequestCount :T_uint32_t; end; type P_VkPrivateDataSlotCreateInfoEXT = ^VkPrivateDataSlotCreateInfoEXT; VkPrivateDataSlotCreateInfoEXT = record sType :VkStructureType; pNext :P_void; flags :VkPrivateDataSlotCreateFlagsEXT; end; type PFN_vkCreatePrivateDataSlotEXT = function( device_:VkDevice; const pCreateInfo_:P_VkPrivateDataSlotCreateInfoEXT; const pAllocator_:P_VkAllocationCallbacks; pPrivateDataSlot_:P_VkPrivateDataSlotEXT ) :VkResult; type PFN_vkDestroyPrivateDataSlotEXT = procedure( device_:VkDevice; privateDataSlot_:VkPrivateDataSlotEXT; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkSetPrivateDataEXT = function( device_:VkDevice; objectType_:VkObjectType; objectHandle_:T_uint64_t; privateDataSlot_:VkPrivateDataSlotEXT; data_:T_uint64_t ) :VkResult; type PFN_vkGetPrivateDataEXT = procedure( device_:VkDevice; objectType_:VkObjectType; objectHandle_:T_uint64_t; privateDataSlot_:VkPrivateDataSlotEXT; pData_:P_uint64_t ); {$IFNDEF VK_NO_PROTOTYPES } function vkCreatePrivateDataSlotEXT( device_:VkDevice; pCreateInfo_:P_VkPrivateDataSlotCreateInfoEXT; pAllocator_:P_VkAllocationCallbacks; pPrivateDataSlot_:P_VkPrivateDataSlotEXT ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyPrivateDataSlotEXT( device_:VkDevice; privateDataSlot_:VkPrivateDataSlotEXT; pAllocator_:P_VkAllocationCallbacks ); stdcall; external DLLNAME; function vkSetPrivateDataEXT( device_:VkDevice; objectType_:VkObjectType; objectHandle_:T_uint64_t; privateDataSlot_:VkPrivateDataSlotEXT; data_:T_uint64_t ) :VkResult; stdcall; external DLLNAME; procedure vkGetPrivateDataEXT( device_:VkDevice; objectType_:VkObjectType; objectHandle_:T_uint64_t; privateDataSlot_:VkPrivateDataSlotEXT; pData_:P_uint64_t ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_pipeline_creation_cache_control = 1; const VK_EXT_PIPELINE_CREATION_CACHE_CONTROL_SPEC_VERSION = 3; const VK_EXT_PIPELINE_CREATION_CACHE_CONTROL_EXTENSION_NAME = 'VK_EXT_pipeline_creation_cache_control'; type P_VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT = ^VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT; VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT = record sType :VkStructureType; pNext :P_void; pipelineCreationCacheControl :VkBool32; end; const VK_NV_device_diagnostics_config = 1; const VK_NV_DEVICE_DIAGNOSTICS_CONFIG_SPEC_VERSION = 1; const VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME = 'VK_NV_device_diagnostics_config'; type P_VkDeviceDiagnosticsConfigFlagBitsNV = ^VkDeviceDiagnosticsConfigFlagBitsNV; VkDeviceDiagnosticsConfigFlagBitsNV = ( VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_DEBUG_INFO_BIT_NV = $00000001, VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_RESOURCE_TRACKING_BIT_NV = $00000002, VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_AUTOMATIC_CHECKPOINTS_BIT_NV = $00000004, VK_DEVICE_DIAGNOSTICS_CONFIG_FLAG_BITS_MAX_ENUM_NV = $7FFFFFFF ); type P_VkDeviceDiagnosticsConfigFlagsNV = ^VkDeviceDiagnosticsConfigFlagsNV; VkDeviceDiagnosticsConfigFlagsNV = VkFlags; type P_VkPhysicalDeviceDiagnosticsConfigFeaturesNV = ^VkPhysicalDeviceDiagnosticsConfigFeaturesNV; VkPhysicalDeviceDiagnosticsConfigFeaturesNV = record sType :VkStructureType; pNext :P_void; diagnosticsConfig :VkBool32; end; type P_VkDeviceDiagnosticsConfigCreateInfoNV = ^VkDeviceDiagnosticsConfigCreateInfoNV; VkDeviceDiagnosticsConfigCreateInfoNV = record sType :VkStructureType; pNext :P_void; flags :VkDeviceDiagnosticsConfigFlagsNV; end; const VK_QCOM_render_pass_store_ops = 1; const VK_QCOM_render_pass_store_ops_SPEC_VERSION = 2; const VK_QCOM_render_pass_store_ops_EXTENSION_NAME = 'VK_QCOM_render_pass_store_ops'; const VK_NV_fragment_shading_rate_enums = 1; const VK_NV_FRAGMENT_SHADING_RATE_ENUMS_SPEC_VERSION = 1; const VK_NV_FRAGMENT_SHADING_RATE_ENUMS_EXTENSION_NAME = 'VK_NV_fragment_shading_rate_enums'; type P_VkFragmentShadingRateTypeNV = ^VkFragmentShadingRateTypeNV; VkFragmentShadingRateTypeNV = ( VK_FRAGMENT_SHADING_RATE_TYPE_FRAGMENT_SIZE_NV = 0, VK_FRAGMENT_SHADING_RATE_TYPE_ENUMS_NV = 1, VK_FRAGMENT_SHADING_RATE_TYPE_MAX_ENUM_NV = $7FFFFFFF ); type P_VkFragmentShadingRateNV = ^VkFragmentShadingRateNV; VkFragmentShadingRateNV = ( VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_PIXEL_NV = 0, VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_1X2_PIXELS_NV = 1, VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X1_PIXELS_NV = 4, VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X2_PIXELS_NV = 5, VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X4_PIXELS_NV = 6, VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_4X2_PIXELS_NV = 9, VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_4X4_PIXELS_NV = 10, VK_FRAGMENT_SHADING_RATE_2_INVOCATIONS_PER_PIXEL_NV = 11, VK_FRAGMENT_SHADING_RATE_4_INVOCATIONS_PER_PIXEL_NV = 12, VK_FRAGMENT_SHADING_RATE_8_INVOCATIONS_PER_PIXEL_NV = 13, VK_FRAGMENT_SHADING_RATE_16_INVOCATIONS_PER_PIXEL_NV = 14, VK_FRAGMENT_SHADING_RATE_NO_INVOCATIONS_NV = 15, VK_FRAGMENT_SHADING_RATE_MAX_ENUM_NV = $7FFFFFFF ); type P_VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV = ^VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV; VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV = record sType :VkStructureType; pNext :P_void; fragmentShadingRateEnums :VkBool32; supersampleFragmentShadingRates :VkBool32; noInvocationFragmentShadingRates :VkBool32; end; type P_VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV = ^VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV; VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV = record sType :VkStructureType; pNext :P_void; maxFragmentShadingRateInvocationCount :VkSampleCountFlagBits; end; type P_VkPipelineFragmentShadingRateEnumStateCreateInfoNV = ^VkPipelineFragmentShadingRateEnumStateCreateInfoNV; VkPipelineFragmentShadingRateEnumStateCreateInfoNV = record sType :VkStructureType; pNext :P_void; shadingRateType :VkFragmentShadingRateTypeNV; shadingRate :VkFragmentShadingRateNV; combinerOps :array [ 0..2-1 ] of VkFragmentShadingRateCombinerOpKHR; end; type PFN_vkCmdSetFragmentShadingRateEnumNV = procedure( commandBuffer_:VkCommandBuffer; shadingRate_:VkFragmentShadingRateNV; const combinerOps_:T_combinerOps ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdSetFragmentShadingRateEnumNV( commandBuffer_:VkCommandBuffer; shadingRate_:VkFragmentShadingRateNV; const combinerOps_:T_combinerOps ); stdcall; external DLLNAME; {$ENDIF} const VK_EXT_fragment_density_map2 = 1; const VK_EXT_FRAGMENT_DENSITY_MAP_2_SPEC_VERSION = 1; const VK_EXT_FRAGMENT_DENSITY_MAP_2_EXTENSION_NAME = 'VK_EXT_fragment_density_map2'; type P_VkPhysicalDeviceFragmentDensityMap2FeaturesEXT = ^VkPhysicalDeviceFragmentDensityMap2FeaturesEXT; VkPhysicalDeviceFragmentDensityMap2FeaturesEXT = record sType :VkStructureType; pNext :P_void; fragmentDensityMapDeferred :VkBool32; end; type P_VkPhysicalDeviceFragmentDensityMap2PropertiesEXT = ^VkPhysicalDeviceFragmentDensityMap2PropertiesEXT; VkPhysicalDeviceFragmentDensityMap2PropertiesEXT = record sType :VkStructureType; pNext :P_void; subsampledLoads :VkBool32; subsampledCoarseReconstructionEarlyAccess :VkBool32; maxSubsampledArrayLayers :T_uint32_t; maxDescriptorSetSubsampledSamplers :T_uint32_t; end; const VK_QCOM_rotated_copy_commands = 1; const VK_QCOM_ROTATED_COPY_COMMANDS_SPEC_VERSION = 0; const VK_QCOM_ROTATED_COPY_COMMANDS_EXTENSION_NAME = 'VK_QCOM_rotated_copy_commands'; type P_VkCopyCommandTransformInfoQCOM = ^VkCopyCommandTransformInfoQCOM; VkCopyCommandTransformInfoQCOM = record sType :VkStructureType; pNext :P_void; transform :VkSurfaceTransformFlagBitsKHR; end; const VK_EXT_image_robustness = 1; const VK_EXT_IMAGE_ROBUSTNESS_SPEC_VERSION = 1; const VK_EXT_IMAGE_ROBUSTNESS_EXTENSION_NAME = 'VK_EXT_image_robustness'; type P_VkPhysicalDeviceImageRobustnessFeaturesEXT = ^VkPhysicalDeviceImageRobustnessFeaturesEXT; VkPhysicalDeviceImageRobustnessFeaturesEXT = record sType :VkStructureType; pNext :P_void; robustImageAccess :VkBool32; end; const VK_EXT_4444_formats = 1; const VK_EXT_4444_FORMATS_SPEC_VERSION = 1; const VK_EXT_4444_FORMATS_EXTENSION_NAME = 'VK_EXT_4444_formats'; type P_VkPhysicalDevice4444FormatsFeaturesEXT = ^VkPhysicalDevice4444FormatsFeaturesEXT; VkPhysicalDevice4444FormatsFeaturesEXT = record sType :VkStructureType; pNext :P_void; formatA4R4G4B4 :VkBool32; formatA4B4G4R4 :VkBool32; end; const VK_NV_acquire_winrt_display = 1; const VK_NV_ACQUIRE_WINRT_DISPLAY_SPEC_VERSION = 1; const VK_NV_ACQUIRE_WINRT_DISPLAY_EXTENSION_NAME = 'VK_NV_acquire_winrt_display'; type PFN_vkAcquireWinrtDisplayNV = function( physicalDevice_:VkPhysicalDevice; display_:VkDisplayKHR ) :VkResult; type PFN_vkGetWinrtDisplayNV = function( physicalDevice_:VkPhysicalDevice; deviceRelativeId_:T_uint32_t; pDisplay_:P_VkDisplayKHR ) :VkResult; {$IFNDEF VK_NO_PROTOTYPES } function vkAcquireWinrtDisplayNV( physicalDevice_:VkPhysicalDevice; display_:VkDisplayKHR ) :VkResult; stdcall; external DLLNAME; function vkGetWinrtDisplayNV( physicalDevice_:VkPhysicalDevice; deviceRelativeId_:T_uint32_t; pDisplay_:P_VkDisplayKHR ) :VkResult; stdcall; external DLLNAME; {$ENDIF} const VK_VALVE_mutable_descriptor_type = 1; const VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_SPEC_VERSION = 1; const VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME = 'VK_VALVE_mutable_descriptor_type'; type P_VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE = ^VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE; VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE = record sType :VkStructureType; pNext :P_void; mutableDescriptorType :VkBool32; end; type P_VkMutableDescriptorTypeListVALVE = ^VkMutableDescriptorTypeListVALVE; VkMutableDescriptorTypeListVALVE = record descriptorTypeCount :T_uint32_t; pDescriptorTypes :P_VkDescriptorType; end; type P_VkMutableDescriptorTypeCreateInfoVALVE = ^VkMutableDescriptorTypeCreateInfoVALVE; VkMutableDescriptorTypeCreateInfoVALVE = record sType :VkStructureType; pNext :P_void; mutableDescriptorTypeListCount :T_uint32_t; pMutableDescriptorTypeLists :P_VkMutableDescriptorTypeListVALVE; end; const VK_KHR_acceleration_structure = 1; type P_VkAccelerationStructureKHR = ^VkAccelerationStructureKHR; VkAccelerationStructureKHR = VK_DEFINE_NON_DISPATCHABLE_HANDLE; const VK_KHR_ACCELERATION_STRUCTURE_SPEC_VERSION = 11; const VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME = 'VK_KHR_acceleration_structure'; type P_VkBuildAccelerationStructureModeKHR = ^VkBuildAccelerationStructureModeKHR; VkBuildAccelerationStructureModeKHR = ( VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR = 0, VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR = 1, VK_BUILD_ACCELERATION_STRUCTURE_MODE_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkAccelerationStructureBuildTypeKHR = ^VkAccelerationStructureBuildTypeKHR; VkAccelerationStructureBuildTypeKHR = ( VK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_KHR = 0, VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR = 1, VK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_OR_DEVICE_KHR = 2, VK_ACCELERATION_STRUCTURE_BUILD_TYPE_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkAccelerationStructureCompatibilityKHR = ^VkAccelerationStructureCompatibilityKHR; VkAccelerationStructureCompatibilityKHR = ( VK_ACCELERATION_STRUCTURE_COMPATIBILITY_COMPATIBLE_KHR = 0, VK_ACCELERATION_STRUCTURE_COMPATIBILITY_INCOMPATIBLE_KHR = 1, VK_ACCELERATION_STRUCTURE_COMPATIBILITY_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkAccelerationStructureCreateFlagBitsKHR = ^VkAccelerationStructureCreateFlagBitsKHR; VkAccelerationStructureCreateFlagBitsKHR = ( VK_ACCELERATION_STRUCTURE_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = $00000001, VK_ACCELERATION_STRUCTURE_CREATE_FLAG_BITS_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkAccelerationStructureCreateFlagsKHR = ^VkAccelerationStructureCreateFlagsKHR; VkAccelerationStructureCreateFlagsKHR = VkFlags; type P_VkDeviceOrHostAddressKHR = ^VkDeviceOrHostAddressKHR; VkDeviceOrHostAddressKHR = record case Byte of 0:( deviceAddress :VkDeviceAddress ); 1:( hostAddress :P_void ); end; type P_VkDeviceOrHostAddressConstKHR = ^VkDeviceOrHostAddressConstKHR; VkDeviceOrHostAddressConstKHR = record case Byte of 0:( deviceAddress :VkDeviceAddress ); 1:( hostAddress :P_void ); end; type PP_VkAccelerationStructureBuildRangeInfoKHR = ^P_VkAccelerationStructureBuildRangeInfoKHR; P_VkAccelerationStructureBuildRangeInfoKHR = ^VkAccelerationStructureBuildRangeInfoKHR; VkAccelerationStructureBuildRangeInfoKHR = record primitiveCount :T_uint32_t; primitiveOffset :T_uint32_t; firstVertex :T_uint32_t; transformOffset :T_uint32_t; end; type P_VkAccelerationStructureGeometryTrianglesDataKHR = ^VkAccelerationStructureGeometryTrianglesDataKHR; VkAccelerationStructureGeometryTrianglesDataKHR = record sType :VkStructureType; pNext :P_void; vertexFormat :VkFormat; vertexData :VkDeviceOrHostAddressConstKHR; vertexStride :VkDeviceSize; maxVertex :T_uint32_t; indexType :VkIndexType; indexData :VkDeviceOrHostAddressConstKHR; transformData :VkDeviceOrHostAddressConstKHR; end; type P_VkAccelerationStructureGeometryAabbsDataKHR = ^VkAccelerationStructureGeometryAabbsDataKHR; VkAccelerationStructureGeometryAabbsDataKHR = record sType :VkStructureType; pNext :P_void; data :VkDeviceOrHostAddressConstKHR; stride :VkDeviceSize; end; type P_VkAccelerationStructureGeometryInstancesDataKHR = ^VkAccelerationStructureGeometryInstancesDataKHR; VkAccelerationStructureGeometryInstancesDataKHR = record sType :VkStructureType; pNext :P_void; arrayOfPointers :VkBool32; data :VkDeviceOrHostAddressConstKHR; end; type P_VkAccelerationStructureGeometryDataKHR = ^VkAccelerationStructureGeometryDataKHR; VkAccelerationStructureGeometryDataKHR = record case Byte of 0:( triangles :VkAccelerationStructureGeometryTrianglesDataKHR ); 1:( aabbs :VkAccelerationStructureGeometryAabbsDataKHR ); 2:( instances :VkAccelerationStructureGeometryInstancesDataKHR ); end; type PP_VkAccelerationStructureGeometryKHR = ^P_VkAccelerationStructureGeometryKHR; P_VkAccelerationStructureGeometryKHR = ^VkAccelerationStructureGeometryKHR; VkAccelerationStructureGeometryKHR = record sType :VkStructureType; pNext :P_void; geometryType :VkGeometryTypeKHR; geometry :VkAccelerationStructureGeometryDataKHR; flags :VkGeometryFlagsKHR; end; type P_VkAccelerationStructureBuildGeometryInfoKHR = ^VkAccelerationStructureBuildGeometryInfoKHR; VkAccelerationStructureBuildGeometryInfoKHR = record sType :VkStructureType; pNext :P_void; type_ :VkAccelerationStructureTypeKHR; flags :VkBuildAccelerationStructureFlagsKHR; mode :VkBuildAccelerationStructureModeKHR; srcAccelerationStructure :VkAccelerationStructureKHR; dstAccelerationStructure :VkAccelerationStructureKHR; geometryCount :T_uint32_t; pGeometries :P_VkAccelerationStructureGeometryKHR; ppGeometries :PP_VkAccelerationStructureGeometryKHR; scratchData :VkDeviceOrHostAddressKHR; end; type P_VkAccelerationStructureCreateInfoKHR = ^VkAccelerationStructureCreateInfoKHR; VkAccelerationStructureCreateInfoKHR = record sType :VkStructureType; pNext :P_void; createFlags :VkAccelerationStructureCreateFlagsKHR; buffer :VkBuffer; offset :VkDeviceSize; size :VkDeviceSize; type_ :VkAccelerationStructureTypeKHR; deviceAddress :VkDeviceAddress; end; type P_VkWriteDescriptorSetAccelerationStructureKHR = ^VkWriteDescriptorSetAccelerationStructureKHR; VkWriteDescriptorSetAccelerationStructureKHR = record sType :VkStructureType; pNext :P_void; accelerationStructureCount :T_uint32_t; pAccelerationStructures :P_VkAccelerationStructureKHR; end; type P_VkPhysicalDeviceAccelerationStructureFeaturesKHR = ^VkPhysicalDeviceAccelerationStructureFeaturesKHR; VkPhysicalDeviceAccelerationStructureFeaturesKHR = record sType :VkStructureType; pNext :P_void; accelerationStructure :VkBool32; accelerationStructureCaptureReplay :VkBool32; accelerationStructureIndirectBuild :VkBool32; accelerationStructureHostCommands :VkBool32; descriptorBindingAccelerationStructureUpdateAfterBind :VkBool32; end; type P_VkPhysicalDeviceAccelerationStructurePropertiesKHR = ^VkPhysicalDeviceAccelerationStructurePropertiesKHR; VkPhysicalDeviceAccelerationStructurePropertiesKHR = record sType :VkStructureType; pNext :P_void; maxGeometryCount :T_uint64_t; maxInstanceCount :T_uint64_t; maxPrimitiveCount :T_uint64_t; maxPerStageDescriptorAccelerationStructures :T_uint32_t; maxPerStageDescriptorUpdateAfterBindAccelerationStructures :T_uint32_t; maxDescriptorSetAccelerationStructures :T_uint32_t; maxDescriptorSetUpdateAfterBindAccelerationStructures :T_uint32_t; minAccelerationStructureScratchOffsetAlignment :T_uint32_t; end; type P_VkAccelerationStructureDeviceAddressInfoKHR = ^VkAccelerationStructureDeviceAddressInfoKHR; VkAccelerationStructureDeviceAddressInfoKHR = record sType :VkStructureType; pNext :P_void; accelerationStructure :VkAccelerationStructureKHR; end; type P_VkAccelerationStructureVersionInfoKHR = ^VkAccelerationStructureVersionInfoKHR; VkAccelerationStructureVersionInfoKHR = record sType :VkStructureType; pNext :P_void; pVersionData :P_uint8_t; end; type P_VkCopyAccelerationStructureToMemoryInfoKHR = ^VkCopyAccelerationStructureToMemoryInfoKHR; VkCopyAccelerationStructureToMemoryInfoKHR = record sType :VkStructureType; pNext :P_void; src :VkAccelerationStructureKHR; dst :VkDeviceOrHostAddressKHR; mode :VkCopyAccelerationStructureModeKHR; end; type P_VkCopyMemoryToAccelerationStructureInfoKHR = ^VkCopyMemoryToAccelerationStructureInfoKHR; VkCopyMemoryToAccelerationStructureInfoKHR = record sType :VkStructureType; pNext :P_void; src :VkDeviceOrHostAddressConstKHR; dst :VkAccelerationStructureKHR; mode :VkCopyAccelerationStructureModeKHR; end; type P_VkCopyAccelerationStructureInfoKHR = ^VkCopyAccelerationStructureInfoKHR; VkCopyAccelerationStructureInfoKHR = record sType :VkStructureType; pNext :P_void; src :VkAccelerationStructureKHR; dst :VkAccelerationStructureKHR; mode :VkCopyAccelerationStructureModeKHR; end; type P_VkAccelerationStructureBuildSizesInfoKHR = ^VkAccelerationStructureBuildSizesInfoKHR; VkAccelerationStructureBuildSizesInfoKHR = record sType :VkStructureType; pNext :P_void; accelerationStructureSize :VkDeviceSize; updateScratchSize :VkDeviceSize; buildScratchSize :VkDeviceSize; end; type PFN_vkCreateAccelerationStructureKHR = function( device_:VkDevice; const pCreateInfo_:P_VkAccelerationStructureCreateInfoKHR; const pAllocator_:P_VkAllocationCallbacks; pAccelerationStructure_:P_VkAccelerationStructureKHR ) :VkResult; type PFN_vkDestroyAccelerationStructureKHR = procedure( device_:VkDevice; accelerationStructure_:VkAccelerationStructureKHR; const pAllocator_:P_VkAllocationCallbacks ); type PFN_vkCmdBuildAccelerationStructuresKHR = procedure( commandBuffer_:VkCommandBuffer; infoCount_:T_uint32_t; const pInfos_:P_VkAccelerationStructureBuildGeometryInfoKHR; const ppBuildRangeInfos_:PP_VkAccelerationStructureBuildRangeInfoKHR ); type PFN_vkCmdBuildAccelerationStructuresIndirectKHR = procedure( commandBuffer_:VkCommandBuffer; infoCount_:T_uint32_t; const pInfos_:P_VkAccelerationStructureBuildGeometryInfoKHR; const pIndirectDeviceAddresses_:P_VkDeviceAddress; const pIndirectStrides_:P_uint32_t; const ppMaxPrimitiveCounts_:PP_uint32_t ); type PFN_vkBuildAccelerationStructuresKHR = function( device_:VkDevice; deferredOperation_:VkDeferredOperationKHR; infoCount_:T_uint32_t; const pInfos_:P_VkAccelerationStructureBuildGeometryInfoKHR; const ppBuildRangeInfos_:PP_VkAccelerationStructureBuildRangeInfoKHR ) :VkResult; type PFN_vkCopyAccelerationStructureKHR = function( device_:VkDevice; deferredOperation_:VkDeferredOperationKHR; const pInfo_:P_VkCopyAccelerationStructureInfoKHR ) :VkResult; type PFN_vkCopyAccelerationStructureToMemoryKHR = function( device_:VkDevice; deferredOperation_:VkDeferredOperationKHR; const pInfo_:P_VkCopyAccelerationStructureToMemoryInfoKHR ) :VkResult; type PFN_vkCopyMemoryToAccelerationStructureKHR = function( device_:VkDevice; deferredOperation_:VkDeferredOperationKHR; const pInfo_:P_VkCopyMemoryToAccelerationStructureInfoKHR ) :VkResult; type PFN_vkWriteAccelerationStructuresPropertiesKHR = function( device_:VkDevice; accelerationStructureCount_:T_uint32_t; const pAccelerationStructures_:P_VkAccelerationStructureKHR; queryType_:VkQueryType; dataSize_:T_size_t; pData_:P_void; stride_:T_size_t ) :VkResult; type PFN_vkCmdCopyAccelerationStructureKHR = procedure( commandBuffer_:VkCommandBuffer; const pInfo_:P_VkCopyAccelerationStructureInfoKHR ); type PFN_vkCmdCopyAccelerationStructureToMemoryKHR = procedure( commandBuffer_:VkCommandBuffer; const pInfo_:P_VkCopyAccelerationStructureToMemoryInfoKHR ); type PFN_vkCmdCopyMemoryToAccelerationStructureKHR = procedure( commandBuffer_:VkCommandBuffer; const pInfo_:P_VkCopyMemoryToAccelerationStructureInfoKHR ); type PFN_vkGetAccelerationStructureDeviceAddressKHR = function( device_:VkDevice; const pInfo_:P_VkAccelerationStructureDeviceAddressInfoKHR ) :VkDeviceAddress; type PFN_vkCmdWriteAccelerationStructuresPropertiesKHR = procedure( commandBuffer_:VkCommandBuffer; accelerationStructureCount_:T_uint32_t; const pAccelerationStructures_:P_VkAccelerationStructureKHR; queryType_:VkQueryType; queryPool_:VkQueryPool; firstQuery_:T_uint32_t ); type PFN_vkGetDeviceAccelerationStructureCompatibilityKHR = procedure( device_:VkDevice; const pVersionInfo_:P_VkAccelerationStructureVersionInfoKHR; pCompatibility_:P_VkAccelerationStructureCompatibilityKHR ); type PFN_vkGetAccelerationStructureBuildSizesKHR = procedure( device_:VkDevice; buildType_:VkAccelerationStructureBuildTypeKHR; const pBuildInfo_:P_VkAccelerationStructureBuildGeometryInfoKHR; const pMaxPrimitiveCounts_:P_uint32_t; pSizeInfo_:P_VkAccelerationStructureBuildSizesInfoKHR ); {$IFNDEF VK_NO_PROTOTYPES } function vkCreateAccelerationStructureKHR( device_:VkDevice; pCreateInfo_:P_VkAccelerationStructureCreateInfoKHR; pAllocator_:P_VkAllocationCallbacks; pAccelerationStructure_:P_VkAccelerationStructureKHR ) :VkResult; stdcall; external DLLNAME; procedure vkDestroyAccelerationStructureKHR( device_:VkDevice; accelerationStructure_:VkAccelerationStructureKHR; pAllocator_:P_VkAllocationCallbacks ); stdcall; external DLLNAME; procedure vkCmdBuildAccelerationStructuresKHR( commandBuffer_:VkCommandBuffer; infoCount_:T_uint32_t; pInfos_:P_VkAccelerationStructureBuildGeometryInfoKHR; ppBuildRangeInfos_:PP_VkAccelerationStructureBuildRangeInfoKHR ); stdcall; external DLLNAME; procedure vkCmdBuildAccelerationStructuresIndirectKHR( commandBuffer_:VkCommandBuffer; infoCount_:T_uint32_t; pInfos_:P_VkAccelerationStructureBuildGeometryInfoKHR; pIndirectDeviceAddresses_:P_VkDeviceAddress; pIndirectStrides_:P_uint32_t; ppMaxPrimitiveCounts_:PP_uint32_t ); stdcall; external DLLNAME; function vkBuildAccelerationStructuresKHR( device_:VkDevice; deferredOperation_:VkDeferredOperationKHR; infoCount_:T_uint32_t; pInfos_:P_VkAccelerationStructureBuildGeometryInfoKHR; ppBuildRangeInfos_:PP_VkAccelerationStructureBuildRangeInfoKHR ) :VkResult; stdcall; external DLLNAME; function vkCopyAccelerationStructureKHR( device_:VkDevice; deferredOperation_:VkDeferredOperationKHR; pInfo_:P_VkCopyAccelerationStructureInfoKHR ) :VkResult; stdcall; external DLLNAME; function vkCopyAccelerationStructureToMemoryKHR( device_:VkDevice; deferredOperation_:VkDeferredOperationKHR; pInfo_:P_VkCopyAccelerationStructureToMemoryInfoKHR ) :VkResult; stdcall; external DLLNAME; function vkCopyMemoryToAccelerationStructureKHR( device_:VkDevice; deferredOperation_:VkDeferredOperationKHR; pInfo_:P_VkCopyMemoryToAccelerationStructureInfoKHR ) :VkResult; stdcall; external DLLNAME; function vkWriteAccelerationStructuresPropertiesKHR( device_:VkDevice; accelerationStructureCount_:T_uint32_t; pAccelerationStructures_:P_VkAccelerationStructureKHR; queryType_:VkQueryType; dataSize_:T_size_t; pData_:P_void; stride_:T_size_t ) :VkResult; stdcall; external DLLNAME; procedure vkCmdCopyAccelerationStructureKHR( commandBuffer_:VkCommandBuffer; pInfo_:P_VkCopyAccelerationStructureInfoKHR ); stdcall; external DLLNAME; procedure vkCmdCopyAccelerationStructureToMemoryKHR( commandBuffer_:VkCommandBuffer; pInfo_:P_VkCopyAccelerationStructureToMemoryInfoKHR ); stdcall; external DLLNAME; procedure vkCmdCopyMemoryToAccelerationStructureKHR( commandBuffer_:VkCommandBuffer; pInfo_:P_VkCopyMemoryToAccelerationStructureInfoKHR ); stdcall; external DLLNAME; function vkGetAccelerationStructureDeviceAddressKHR( device_:VkDevice; pInfo_:P_VkAccelerationStructureDeviceAddressInfoKHR ) :VkDeviceAddress; stdcall; external DLLNAME; procedure vkCmdWriteAccelerationStructuresPropertiesKHR( commandBuffer_:VkCommandBuffer; accelerationStructureCount_:T_uint32_t; pAccelerationStructures_:P_VkAccelerationStructureKHR; queryType_:VkQueryType; queryPool_:VkQueryPool; firstQuery_:T_uint32_t ); stdcall; external DLLNAME; procedure vkGetDeviceAccelerationStructureCompatibilityKHR( device_:VkDevice; pVersionInfo_:P_VkAccelerationStructureVersionInfoKHR; pCompatibility_:P_VkAccelerationStructureCompatibilityKHR ); stdcall; external DLLNAME; procedure vkGetAccelerationStructureBuildSizesKHR( device_:VkDevice; buildType_:VkAccelerationStructureBuildTypeKHR; pBuildInfo_:P_VkAccelerationStructureBuildGeometryInfoKHR; pMaxPrimitiveCounts_:P_uint32_t; pSizeInfo_:P_VkAccelerationStructureBuildSizesInfoKHR ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_ray_tracing_pipeline = 1; const VK_KHR_RAY_TRACING_PIPELINE_SPEC_VERSION = 1; const VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME = 'VK_KHR_ray_tracing_pipeline'; type P_VkShaderGroupShaderKHR = ^VkShaderGroupShaderKHR; VkShaderGroupShaderKHR = ( VK_SHADER_GROUP_SHADER_GENERAL_KHR = 0, VK_SHADER_GROUP_SHADER_CLOSEST_HIT_KHR = 1, VK_SHADER_GROUP_SHADER_ANY_HIT_KHR = 2, VK_SHADER_GROUP_SHADER_INTERSECTION_KHR = 3, VK_SHADER_GROUP_SHADER_MAX_ENUM_KHR = $7FFFFFFF ); type P_VkRayTracingShaderGroupCreateInfoKHR = ^VkRayTracingShaderGroupCreateInfoKHR; VkRayTracingShaderGroupCreateInfoKHR = record sType :VkStructureType; pNext :P_void; type_ :VkRayTracingShaderGroupTypeKHR; generalShader :T_uint32_t; closestHitShader :T_uint32_t; anyHitShader :T_uint32_t; intersectionShader :T_uint32_t; pShaderGroupCaptureReplayHandle :P_void; end; type P_VkRayTracingPipelineInterfaceCreateInfoKHR = ^VkRayTracingPipelineInterfaceCreateInfoKHR; VkRayTracingPipelineInterfaceCreateInfoKHR = record sType :VkStructureType; pNext :P_void; maxPipelineRayPayloadSize :T_uint32_t; maxPipelineRayHitAttributeSize :T_uint32_t; end; type P_VkRayTracingPipelineCreateInfoKHR = ^VkRayTracingPipelineCreateInfoKHR; VkRayTracingPipelineCreateInfoKHR = record sType :VkStructureType; pNext :P_void; flags :VkPipelineCreateFlags; stageCount :T_uint32_t; pStages :P_VkPipelineShaderStageCreateInfo; groupCount :T_uint32_t; pGroups :P_VkRayTracingShaderGroupCreateInfoKHR; maxPipelineRayRecursionDepth :T_uint32_t; pLibraryInfo :P_VkPipelineLibraryCreateInfoKHR; pLibraryInterface :P_VkRayTracingPipelineInterfaceCreateInfoKHR; pDynamicState :P_VkPipelineDynamicStateCreateInfo; layout :VkPipelineLayout; basePipelineHandle :VkPipeline; basePipelineIndex :T_int32_t; end; type P_VkPhysicalDeviceRayTracingPipelineFeaturesKHR = ^VkPhysicalDeviceRayTracingPipelineFeaturesKHR; VkPhysicalDeviceRayTracingPipelineFeaturesKHR = record sType :VkStructureType; pNext :P_void; rayTracingPipeline :VkBool32; rayTracingPipelineShaderGroupHandleCaptureReplay :VkBool32; rayTracingPipelineShaderGroupHandleCaptureReplayMixed :VkBool32; rayTracingPipelineTraceRaysIndirect :VkBool32; rayTraversalPrimitiveCulling :VkBool32; end; type P_VkPhysicalDeviceRayTracingPipelinePropertiesKHR = ^VkPhysicalDeviceRayTracingPipelinePropertiesKHR; VkPhysicalDeviceRayTracingPipelinePropertiesKHR = record sType :VkStructureType; pNext :P_void; shaderGroupHandleSize :T_uint32_t; maxRayRecursionDepth :T_uint32_t; maxShaderGroupStride :T_uint32_t; shaderGroupBaseAlignment :T_uint32_t; shaderGroupHandleCaptureReplaySize :T_uint32_t; maxRayDispatchInvocationCount :T_uint32_t; shaderGroupHandleAlignment :T_uint32_t; maxRayHitAttributeSize :T_uint32_t; end; type P_VkStridedDeviceAddressRegionKHR = ^VkStridedDeviceAddressRegionKHR; VkStridedDeviceAddressRegionKHR = record deviceAddress :VkDeviceAddress; stride :VkDeviceSize; size :VkDeviceSize; end; type P_VkTraceRaysIndirectCommandKHR = ^VkTraceRaysIndirectCommandKHR; VkTraceRaysIndirectCommandKHR = record width :T_uint32_t; height :T_uint32_t; depth :T_uint32_t; end; type PFN_vkCmdTraceRaysKHR = procedure( commandBuffer_:VkCommandBuffer; const pRaygenShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; const pMissShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; const pHitShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; const pCallableShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; width_:T_uint32_t; height_:T_uint32_t; depth_:T_uint32_t ); type PFN_vkCreateRayTracingPipelinesKHR = function( device_:VkDevice; deferredOperation_:VkDeferredOperationKHR; pipelineCache_:VkPipelineCache; createInfoCount_:T_uint32_t; const pCreateInfos_:P_VkRayTracingPipelineCreateInfoKHR; const pAllocator_:P_VkAllocationCallbacks; pPipelines_:P_VkPipeline ) :VkResult; type PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR = function( device_:VkDevice; pipeline_:VkPipeline; firstGroup_:T_uint32_t; groupCount_:T_uint32_t; dataSize_:T_size_t; pData_:P_void ) :VkResult; type PFN_vkCmdTraceRaysIndirectKHR = procedure( commandBuffer_:VkCommandBuffer; const pRaygenShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; const pMissShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; const pHitShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; const pCallableShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; indirectDeviceAddress_:VkDeviceAddress ); type PFN_vkGetRayTracingShaderGroupStackSizeKHR = function( device_:VkDevice; pipeline_:VkPipeline; group_:T_uint32_t; groupShader_:VkShaderGroupShaderKHR ) :VkDeviceSize; type PFN_vkCmdSetRayTracingPipelineStackSizeKHR = procedure( commandBuffer_:VkCommandBuffer; pipelineStackSize_:T_uint32_t ); {$IFNDEF VK_NO_PROTOTYPES } procedure vkCmdTraceRaysKHR( commandBuffer_:VkCommandBuffer; pRaygenShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; pMissShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; pHitShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; pCallableShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; width_:T_uint32_t; height_:T_uint32_t; depth_:T_uint32_t ); stdcall; external DLLNAME; function vkCreateRayTracingPipelinesKHR( device_:VkDevice; deferredOperation_:VkDeferredOperationKHR; pipelineCache_:VkPipelineCache; createInfoCount_:T_uint32_t; pCreateInfos_:P_VkRayTracingPipelineCreateInfoKHR; pAllocator_:P_VkAllocationCallbacks; pPipelines_:P_VkPipeline ) :VkResult; stdcall; external DLLNAME; function vkGetRayTracingCaptureReplayShaderGroupHandlesKHR( device_:VkDevice; pipeline_:VkPipeline; firstGroup_:T_uint32_t; groupCount_:T_uint32_t; dataSize_:T_size_t; pData_:P_void ) :VkResult; stdcall; external DLLNAME; procedure vkCmdTraceRaysIndirectKHR( commandBuffer_:VkCommandBuffer; pRaygenShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; pMissShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; pHitShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; pCallableShaderBindingTable_:P_VkStridedDeviceAddressRegionKHR; indirectDeviceAddress_:VkDeviceAddress ); stdcall; external DLLNAME; function vkGetRayTracingShaderGroupStackSizeKHR( device_:VkDevice; pipeline_:VkPipeline; group_:T_uint32_t; groupShader_:VkShaderGroupShaderKHR ) :VkDeviceSize; stdcall; external DLLNAME; procedure vkCmdSetRayTracingPipelineStackSizeKHR( commandBuffer_:VkCommandBuffer; pipelineStackSize_:T_uint32_t ); stdcall; external DLLNAME; {$ENDIF} const VK_KHR_ray_query = 1; const VK_KHR_RAY_QUERY_SPEC_VERSION = 1; const VK_KHR_RAY_QUERY_EXTENSION_NAME = 'VK_KHR_ray_query'; type P_VkPhysicalDeviceRayQueryFeaturesKHR = ^VkPhysicalDeviceRayQueryFeaturesKHR; VkPhysicalDeviceRayQueryFeaturesKHR = record sType :VkStructureType; pNext :P_void; rayQuery :VkBool32; end; implementation //############################################################### ■ function VK_MAKE_VERSION( const major_,minor_,patch_:T_uint32_t ) :T_uint32_t; begin Result := ( major_ shl 22 ) or ( minor_ shl 12 ) or patch_; end; //------------------------------------------------------------------------------ function VK_VERSION_MAJOR( const version_:T_uint32_t ) :T_uint32_t; begin Result := version_ shr 22; end; function VK_VERSION_MINOR( const version_:T_uint32_t ) :T_uint32_t; begin Result := ( version_ shr 12 ) and $3ff; end; function VK_VERSION_PATCH( const version_:T_uint32_t ) :T_uint32_t; begin Result := version_ and $fff; end; end. //######################################################################### ■
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, fasthtmlparser; type TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; bGetElementByID: TButton; procedure bGetElementByIDClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.bGetElementByIDClick(Sender: TObject); var s: string; Hp: THtmlParser; InnerHtml, Tag, TagEnd: string; begin s := '<html><head></head><body><div>some text</div><div id="divbox1">text about <b>something</b></div></body></html>'; Hp := THtmlParser.Create(s); InnerHtml := Hp.GetElementById('divbox1', Tag, TagEnd); Memo1.Lines.Add('Element name: divbox1'); Memo1.Lines.Add('Element Inner HTML: '); Memo1.Lines.Add(InnerHtml); Memo1.Lines.Add('Tag: '); Memo1.Lines.Add(Tag); Hp.Free; Hp := nil; end; end.
unit ATxUserTools; interface uses Classes, Controls; type TATUserTool = record FCaption: string; FCommand: WideString; FParams: WideString; FActions: string; end; TATUserTools = array[1..8] of TATUserTool; procedure ClearUserTool(var Tool: TATUserTool); procedure ClearUserTools(var Tools: TATUserTools); procedure CopyUserTools(const Src: TATUserTools; var Dest: TATUserTools); procedure DeleteUserTool(var Tools: TATUserTools; N: integer); procedure SwapUserTools(var Src, Dest: TATUserTool); function NumOfUserTools(const Tools: TATUserTools): integer; procedure AddUserTool(var Tools: TATUserTools; const Tool: TATUserTool); function ConfigureUserTool(var Tool: TATUserTool; Owner: TComponent): boolean; function UserToolHasAction(const Tool: TATUserTool; const Action: string): boolean; procedure UserToolAddAction(var Tool: TATUserTool; const Action: string); function AddCommandIcon(const Command: WideString; ImageList: TImageList): integer; implementation uses Windows, ShellAPI, SysUtils, Graphics, Consts, CommCtrl, ATxFProc, UFormViewToolParams; const cActionSep = ','; procedure ClearUserTool(var Tool: TATUserTool); begin Tool.FCaption:= ''; Tool.FCommand:= ''; Tool.FParams:= ''; Tool.FActions:= ''; end; procedure ClearUserTools(var Tools: TATUserTools); var i: integer; begin for i:= Low(TATUserTools) to High(TATUserTools) do ClearUserTool(Tools[i]); end; procedure CopyUserTool(const Src: TATUserTool; var Dest: TATUserTool); begin Dest.FCaption:= Src.FCaption; Dest.FCommand:= Src.FCommand; Dest.FParams:= Src.FParams; Dest.FActions:= Src.FActions; end; procedure CopyUserTools(const Src: TATUserTools; var Dest: TATUserTools); var i: integer; begin for i:= Low(TATUserTools) to High(TATUserTools) do CopyUserTool(Src[i], Dest[i]); end; procedure SwapUserTools(var Src, Dest: TATUserTool); var Tool: TATUserTool; begin CopyUserTool(Src, Tool); CopyUserTool(Dest, Src); CopyUserTool(Tool, Dest); end; procedure DeleteUserTool(var Tools: TATUserTools; N: integer); var i: integer; begin if (N>=Low(TATUserTools)) and (N<=High(TATUserTools)) then begin for i:= N to High(TATUserTools)-1 do CopyUserTool(Tools[i+1], Tools[i]); ClearUserTool(Tools[High(TATUserTools)]); end; end; function NumOfUserTools(const Tools: TATUserTools): integer; var i: integer; begin Result:= 0; for i:= High(TATUserTools) downto Low(TATUserTools) do if Tools[i].FCaption<>'' then begin Result:= i; Break end; end; procedure AddUserTool(var Tools: TATUserTools; const Tool: TATUserTool); var N: integer; begin N:= NumOfUserTools(Tools); if N<High(TATUserTools) then CopyUserTool(Tool, Tools[N+1]); end; function ConfigureUserTool(var Tool: TATUserTool; Owner: TComponent): boolean; const cSelectAll = 'SelectAll'; cCopy = 'Copy'; cExit = 'Exit'; begin with TFormViewToolParams.Create(Owner) do try edCaption.Text:= Tool.FCaption; edCommand.Text:= Tool.FCommand; edParams.Text:= Tool.FParams; chkSelectAll.Checked:= UserToolHasAction(Tool, cSelectAll); chkCopy.Checked:= UserToolHasAction(Tool, cCopy); chkExit.Checked:= UserToolHasAction(Tool, cExit); Result:= (ShowModal=mrOk) and (edCaption.Text<>''); if Result then begin Tool.FCaption:= edCaption.Text; Tool.FCommand:= edCommand.Text; Tool.FParams:= edParams.Text; Tool.FActions:= ''; if chkSelectAll.Checked then UserToolAddAction(Tool, cSelectAll); if chkCopy.Checked then UserToolAddAction(Tool, cCopy); if chkExit.Checked then UserToolAddAction(Tool, cExit); end; finally Release; end; end; function UserToolHasAction(const Tool: TATUserTool; const Action: string): boolean; begin Result:= Pos( cActionSep + Action + cActionSep, cActionSep + Tool.FActions + cActionSep) > 0; end; procedure UserToolAddAction(var Tool: TATUserTool; const Action: string); begin with Tool do FActions:= FActions + Action + cActionSep; end; var _TempIcon: TIcon = nil; function AddCommandIcon(const Command: WideString; ImageList: TImageList): integer; var hdIcon: HICON; Icons1, Icons2: HICON; begin Result:= -1; if not IsFileExist(Command) then Exit; //AddIcon exception on 29x35: if (ImageList.Height > 32) or (ImageList.Width > 32) then Exit; if Win32Platform = VER_PLATFORM_WIN32_NT then hdIcon:= ExtractIconExW(PWChar(Command), 0, Icons1, Icons2, 1) else hdIcon:= ExtractIconExA(PAnsiChar(AnsiString(Command)), 0, Icons1, Icons2, 1); if (hdIcon <> 0) and (hdIcon <> 1) then try //if ImageList has size>=32, get large icon, otherwise get small: if (ImageList.Height >= 32) or (ImageList.Width >= 32) then _TempIcon.Handle:= Icons1 else _TempIcon.Handle:= Icons2; if _TempIcon.Handle > 0 then Result:= ImageList.AddIcon(_TempIcon); except end; end; initialization _TempIcon:= TIcon.Create; finalization FreeAndNil(_TempIcon); end.
unit srvMJDService; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.SvcMgr, Vcl.Dialogs, uServidorThread; type TMJDService = class(TService) procedure ServiceStart(Sender: TService; var Started: Boolean); procedure ServiceStop(Sender: TService; var Stopped: Boolean); private Servidor: TServidorThread; public function GetServiceController: TServiceController; override; { Public declarations } end; var MJDService: TMJDService; implementation {$R *.DFM} procedure ServiceController(CtrlCode: DWord); stdcall; begin MJDService.Controller(CtrlCode); end; function TMJDService.GetServiceController: TServiceController; begin Result := ServiceController; end; procedure TMJDService.ServiceStart(Sender: TService; var Started: Boolean); begin Servidor := TServidorThread.Create(True); Servidor.FreeOnTerminate := True; Servidor.Start(); end; procedure TMJDService.ServiceStop(Sender: TService; var Stopped: Boolean); begin Servidor.Terminate(); end; end.
unit Constants; interface uses SysUtils; const // Metrik MET_FIELD_SPACE = 3; MET_FIELD_SIZE = 37; MET_HALFTAB_SIZE = (MET_FIELD_SIZE+MET_FIELD_SPACE) div 2; // 20 MET_PREVIEW_SIZE_RATIO = 0.30; MET_PERCENT_PNL_TIME = 0.28; MET_PERCENT_PNL_STONES = 0.47; MET_OUTER_MARGIN = 8; MET_SHAPE_MARGIN = 3; // Field type worth WORTH_RED = 30; WORTH_YELLOW = 20; WORTH_GREEN = 10; // Resourcennamen RES_JUMP = 'Jump'; RES_UNDO = 'Undo'; RES_WIN1 = 'Win1'; RES_WIN2 = 'Win2'; RES_LOSE = 'Lose'; RES_EMPTY = 'EmptyField'; RES_GREEN = 'GreenStone'; RES_YELLOW = 'YellowStone'; RES_RED = 'RedStone'; // Registry REG_KEY = 'Software\ViaThinkSoft\PegSolitaire\'; REG_SOUND = 'Sound'; REG_PLAYERNAME = 'LastPlayerName'; REG_REPLAY = 'Replay'; // Levels LVL_EXT = '.brd'; LVL_PATH = 'Boards' + PathDelim; LVL_FILE = LVL_PATH + '%s' + LVL_EXT; // Journal JNL_EXT = '.jnl'; JNL_PATH = 'Journal' + PathDelim; JNL_FILE = JNL_PATH + '%s' + JNL_EXT; JNL_SEP = '|'; JNL_ENTRY = '%s' + JNL_SEP + '%s' + JNL_SEP + '%d' + JNL_SEP + '%d' + JNL_SEP + '%d' + JNL_SEP + '%d'; resourcestring LNG_POINTS = 'Score: %d'; LNG_TIME = 'Time: %s'; LNG_COULD_NOT_CREATE_DIR = 'Warning: Could not create directory "%s".'; implementation end.
{******************************************************************************* 作者: dmzn@163.com 2011-11-30 描述: 查看会员信息 *******************************************************************************} unit UFormMemberView; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, USkinFormBase, UGridPainter, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit, cxTextEdit, Grids, UGridExPainter, StdCtrls, ExtCtrls, UImageButton; type TfFormMemberView = class(TSkinFormBase) Panel1: TPanel; BtnOK: TImageButton; Panel2: TPanel; LabelHint: TLabel; GridList: TDrawGridEx; Label1: TLabel; EditID: TcxTextEdit; Label2: TLabel; EditName: TcxTextEdit; Label3: TLabel; EditSex: TcxTextEdit; Label4: TLabel; EditPhone: TcxTextEdit; Label5: TLabel; EditBAddr: TcxTextEdit; Label6: TLabel; EditAddr: TcxTextEdit; Label7: TLabel; EditKZ: TcxTextEdit; procedure FormCreate(Sender: TObject); procedure BtnExitClick(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Panel1Resize(Sender: TObject); procedure BtnOKClick(Sender: TObject); private { Private declarations } FPainter: TGridPainter; //绘制对象 procedure LoadMemberInfo(const nMemberID: string); //载入信息 public { Public declarations } class function FormSkinID: string; override; end; function ShowMemberInfoForm(const nMember: string): Boolean; //查看会员 implementation {$R *.dfm} uses ULibFun, DB, UFormCtrl, USysDB, USysConst, USysFun, UDataModule; function ShowMemberInfoForm(const nMember: string): Boolean; begin with TfFormMemberView.Create(Application) do begin LoadMemberInfo(nMember); Result := ShowModal = mrOk; Free; end; end; class function TfFormMemberView.FormSkinID: string; begin Result := 'FormDialog'; end; procedure TfFormMemberView.FormCreate(Sender: TObject); var nIdx: Integer; begin for nIdx:=ComponentCount-1 downto 0 do if Components[nIdx] is TImageButton then LoadFixImageButton(TImageButton(Components[nIdx])); //xxxxx FPainter := TGridPainter.Create(GridList); with FPainter do begin HeaderFont.Style := HeaderFont.Style + [fsBold]; //粗体 AddHeader('序号', 50); AddHeader('购物名称', 50); AddHeader('件数', 50); AddHeader('金额', 50); AddHeader('优惠', 50); AddHeader('购物时间', 50); end; LoadFormConfig(Self); LoadDrawGridConfig(Name, GridList); end; procedure TfFormMemberView.FormClose(Sender: TObject; var Action: TCloseAction); begin SaveFormConfig(Self); SaveDrawGridConfig(Name, GridList); FPainter.Free; end; procedure TfFormMemberView.BtnExitClick(Sender: TObject); begin Close; end; //Desc: 调整按钮位置 procedure TfFormMemberView.Panel1Resize(Sender: TObject); begin BtnOk.Left := Trunc((Panel1.Width - BtnOK.Width) / 2); end; //Desc: 读取会员信息 procedure TfFormMemberView.LoadMemberInfo(const nMemberID: string); var nStr,nHint: string; nDS: TDataSet; nMon,nDebt,nVal: Double; nIdx,nInt,nNum: Integer; nData: TGridDataArray; begin nStr := 'Select mb.*,Address From $MB mb ' + ' Left Join $TM tm On tm.TerminalID=mb.M_TerminalID ' + 'Where M_ID=''$ID'''; nStr := MacroValue(nStr, [MI('$MB', sTable_Member), MI('$TM', sTable_Terminal), MI('$ID', nMemberID)]); //xxxxx nDS := FDM.LockDataSet(nStr, nHint); try if (not Assigned(nDS)) or (nDS.RecordCount < 1) then begin ShowMsg('读取会员信息失败', sHint); Exit; end; with nDS do begin First; EditID.Text := FieldByName('M_ID').AsString; EditName.Text := FieldByName('M_Name').AsString; if FieldByName('M_Sex').AsString = sFlag_Male then EditSex.Text := '男' else EditSex.Text := '女'; EditPhone.Text := FieldByName('M_Phone').AsString; EditBAddr.Text := FieldByName('Address').AsString; EditAddr.Text := FieldByName('M_Addr').AsString; if FieldByName('M_Limit').AsString = sFlag_Yes then EditKZ.Text := '本店使用' else EditKZ.Text := '所有连锁店均可'; end; finally FDM.ReleaseDataSet(nDS); end; //---------------------------------------------------------------------------- nStr := 'Select dt.*,StyleName,ColorName,SizeName,S_Date From $DT dt ' + ' Left Join $PT pt On pt.ProductID=dt.D_Product ' + ' Left Join $ST st On st.StyleID=pt.StyleID ' + ' Left Join $CR cr On cr.ColorID=pt.ColorID ' + ' Left Join $SZ sz On sz.SizeID=pt.SizeID ' + ' Left Join $SL sl On sl.S_ID=dt.D_SaleID ' + 'Where D_Member=''$ID'' Order By S_Date DESC'; nStr := MacroValue(nStr, [MI('$DT', sTable_SaleDtl), MI('$PT', sTable_DL_Product), MI('$ST', sTable_DL_Style), MI('$CR', sTable_DL_Color), MI('$SZ', sTable_DL_Size), MI('$SL', sTable_Sale), MI('$ID', nMemberID)]); //xxxxx nDS := FDM.LockDataSet(nStr, nHint); try if not Assigned(nDS) then begin ShowDlg(nHint, sWarn); Exit; end; FPainter.ClearData; if nDS.RecordCount < 1 then Exit; with nDS do begin nNum := 0; nMon := 0; nDebt := 0; nInt := 1; First; while not Eof do begin SetLength(nData, 6); for nIdx:=Low(nData) to High(nData) do begin nData[nIdx].FText := ''; nData[nIdx].FCtrls := nil; nData[nIdx].FAlign := taCenter; end; nData[0].FText := IntToStr(nInt); Inc(nInt); nStr := Format('%s_%s_%s', [FieldByName('StyleName').AsString, FieldByName('ColorName').AsString, FieldByName('SizeName').AsString]); nData[1].FText := nStr; nData[2].FText := FieldByName('D_Number').AsString; nNum := nNum + FieldByName('D_Number').AsInteger; nVal := FieldByName('D_Price').AsFloat; nVal := Float2Float(nVal * FieldByName('D_Number').AsInteger, 100); nData[3].FText := Format('%.2f', [nVal]); nMon := nMon + nVal; nData[4].FText := Format('%.2f', [FieldByName('D_DeMoney').AsFloat]); nDebt := nDebt + FieldByName('D_DeMoney').AsFloat; nData[5].FText := DateTime2Str(FieldByName('S_Date').AsDateTime); FPainter.AddData(nData); Next; end; end; SetLength(nData, 6); for nIdx:=Low(nData) to High(nData) do begin nData[nIdx].FText := ''; nData[nIdx].FCtrls := nil; nData[nIdx].FAlign := taCenter; end; nData[0].FText := '总计:'; nData[2].FText := Format('%d件', [nNum]); nData[3].FText := Format('%.2f元', [nMon]); nData[4].FText := Format('%.2f元', [nDebt]); FPainter.AddData(nData); finally FDM.ReleaseDataSet(nDS); end; end; procedure TfFormMemberView.BtnOKClick(Sender: TObject); begin Close; end; end.
unit MMO.ServerClient; interface uses IdContext, MMO.Packet, Classes, MMO.Types; type TServerClient<ClientType> = class abstract private var m_context: TIdContext; protected var m_sessionId: TSessionId; public constructor Create(AContext: TIdContext); destructor Destroy; override; property SessionId: TSessionId read m_sessionId; procedure Send(const packet: TPacket); var Data: ClientType; end; implementation constructor TServerClient<ClientType>.Create(AContext: TIdContext); begin inherited Create; m_context := AContext; end; destructor TServerClient<ClientType>.Destroy; begin inherited; end; procedure TServerClient<ClientType>.Send(const packet: TPacket); var memoryStream: TMemoryStream; dataSize: UInt32; memory: Pointer; packetHeader: TPacketHeader; begin dataSize := packet.GetSize; if dataSize = 0 then begin Exit; end; packetHeader.Size := dataSize; memory := packet.Memory; memoryStream := TMemoryStream.Create; memoryStream.Write(packetHeader, SizeOfTPacketHeader); memoryStream.Write(memory^, dataSize); m_context.Connection.IOHandler.Write(memoryStream); memoryStream.Free; end; end.
{ ***************************************************************************** } { * ini,section text library,writen by QQ 600585@qq.com * } { * https://github.com/PassByYou888/CoreCipher * } (* https://github.com/PassByYou888/ZServer4D *) { ***************************************************************************** } (* update history 2017-12-6 performance optimization *) unit TextDataEngine; {$I zDefine.inc} interface uses SysUtils, Variants, // Hash ListEngine, CoreClasses, MemoryStream64, PascalStrings; type TSectionTextData = class; THashTextEngine = TSectionTextData; TSectionTextData = class(TCoreClassObject) private FComment : TCoreClassStrings; FSectionTextList, FSectionVariantList: THashObjectList; FAutoUpdateDefaultValue : Boolean; FMaxHashBlock : Integer; function GetNames(aName: SystemString): TCoreClassStrings; procedure SetNames(aName: SystemString; const Value: TCoreClassStrings); function GetHit(aSectionName, _VariantName: SystemString): Variant; procedure SetHit(aSectionName, _VariantName: SystemString; const Value: Variant); function GetVariantList(aName: SystemString): THashVariantList; procedure SetVariantList(aName: SystemString; const Value: THashVariantList); // return override state procedure AddDataSection(aSection: SystemString; TextList: TCoreClassStrings); public constructor Create; overload; constructor Create(AHashBlock: Integer); overload; destructor Destroy; override; procedure ReBuildList; procedure Clear; procedure Delete(aName: SystemString); function Exists(aName: SystemString): Boolean; function GetDefaultValue(const SectionName, KeyName: SystemString; const DefaultValue: Variant): Variant; procedure SetDefaultValue(const SectionName, KeyName: SystemString; const Value: Variant); // import section function DataImport(TextList: TCoreClassStrings): Boolean; // export section procedure DataExport(TextList: TCoreClassStrings); procedure Merge(sour: TSectionTextData); procedure Assign(sour: TSectionTextData); function Same(sour: TSectionTextData): Boolean; procedure LoadFromStream(Stream: TCoreClassStream); procedure SaveToStream(Stream: TCoreClassStream); procedure LoadFromFile(FileName: SystemString); procedure SaveToFile(FileName: SystemString); function GetAsText: SystemString; procedure SetAsText(const Value: SystemString); property AsText: SystemString read GetAsText write SetAsText; procedure GetSectionList(Dest: TCoreClassStrings); overload; procedure GetSectionList(Dest: TListString); overload; procedure GetSectionList(Dest: TListPascalString); overload; function GetSectionObjectName(_Obj: THashVariantList): SystemString; property AutoUpdateDefaultValue: Boolean read FAutoUpdateDefaultValue write FAutoUpdateDefaultValue; property Comment: TCoreClassStrings read FComment write FComment; property Hit[aSectionName, _VariantName: SystemString]: Variant read GetHit write SetHit; default; property Names[aName: SystemString]: TCoreClassStrings read GetNames write SetNames; property Texts[aName: SystemString]: TCoreClassStrings read GetNames write SetNames; property Strings[aName: SystemString]: TCoreClassStrings read GetNames write SetNames; property VariantList[aName: SystemString]: THashVariantList read GetVariantList write SetVariantList; end; implementation uses UnicodeMixedLib; function TSectionTextData.GetNames(aName: SystemString): TCoreClassStrings; var h: THashVariantTextStream; begin if not FSectionTextList.Exists(aName) then FSectionTextList[aName] := TCoreClassStringList.Create; if FSectionVariantList.Exists(aName) then begin Result := TCoreClassStringList.Create; h := THashVariantTextStream.Create(THashVariantList(FSectionVariantList[aName])); h.DataExport(Result); DisposeObject(h); FSectionTextList[aName] := Result; end; Result := TCoreClassStrings(FSectionTextList[aName]); end; procedure TSectionTextData.SetNames(aName: SystemString; const Value: TCoreClassStrings); var ns: TCoreClassStrings; begin ns := TCoreClassStringList.Create; ns.Assign(Value); FSectionTextList[aName] := ns; FSectionVariantList.Delete(aName); end; function TSectionTextData.GetHit(aSectionName, _VariantName: SystemString): Variant; var nsl: TCoreClassStrings; vl : THashVariantList; vt : THashVariantTextStream; begin Result := NULL; vl := THashVariantList(FSectionVariantList[aSectionName]); if vl = nil then begin nsl := Names[aSectionName]; if nsl = nil then Exit; if nsl.Count = 0 then Exit; vl := THashVariantList.Create(FMaxHashBlock); vl.AutoUpdateDefaultValue := AutoUpdateDefaultValue; vt := THashVariantTextStream.Create(vl); vt.DataImport(nsl); DisposeObject(vt); FSectionVariantList[aSectionName] := vl; end; Result := vl[_VariantName]; end; procedure TSectionTextData.SetHit(aSectionName, _VariantName: SystemString; const Value: Variant); var nsl: TCoreClassStrings; vl : THashVariantList; vt : THashVariantTextStream; begin vl := THashVariantList(FSectionVariantList[aSectionName]); if vl = nil then begin vl := THashVariantList.Create(FMaxHashBlock); vl.AutoUpdateDefaultValue := AutoUpdateDefaultValue; nsl := Names[aSectionName]; if nsl <> nil then begin vt := THashVariantTextStream.Create(vl); vt.DataImport(nsl); DisposeObject(vt); end; FSectionVariantList[aSectionName] := vl; end; vl[_VariantName] := Value; end; function TSectionTextData.GetVariantList(aName: SystemString): THashVariantList; var nsl: TCoreClassStrings; vt : THashVariantTextStream; begin Result := THashVariantList(FSectionVariantList[aName]); if Result = nil then begin Result := THashVariantList.Create(FMaxHashBlock); Result.AutoUpdateDefaultValue := FAutoUpdateDefaultValue; nsl := Names[aName]; if nsl <> nil then begin vt := THashVariantTextStream.Create(Result); vt.DataImport(nsl); DisposeObject(vt); end; FSectionVariantList[aName] := Result; end; end; procedure TSectionTextData.SetVariantList(aName: SystemString; const Value: THashVariantList); var h: THashVariantTextStream; begin FSectionVariantList[aName] := Value; if not FSectionTextList.Exists(aName) then FSectionTextList[aName] := TCoreClassStringList.Create; h := THashVariantTextStream.Create(Value); TCoreClassStrings(FSectionTextList[aName]).Clear; h.DataExport(TCoreClassStrings(FSectionTextList[aName])); DisposeObject(h); end; procedure TSectionTextData.AddDataSection(aSection: SystemString; TextList: TCoreClassStrings); begin while (TextList.Count > 0) and (TextList[0] = '') do TextList.Delete(0); while (TextList.Count > 0) and (TextList[TextList.Count - 1] = '') do TextList.Delete(TextList.Count - 1); FSectionTextList.Add(aSection, TextList); end; constructor TSectionTextData.Create; begin inherited Create; FMaxHashBlock := 10; FComment := TCoreClassStringList.Create; FSectionTextList := THashObjectList.Create(True, FMaxHashBlock); FSectionVariantList := THashObjectList.Create(True, FMaxHashBlock); FAutoUpdateDefaultValue := False; end; constructor TSectionTextData.Create(AHashBlock: Integer); begin inherited Create; FMaxHashBlock := AHashBlock; FComment := TCoreClassStringList.Create; FSectionTextList := THashObjectList.Create(True, FMaxHashBlock); FSectionVariantList := THashObjectList.Create(True, FMaxHashBlock); FAutoUpdateDefaultValue := False; end; destructor TSectionTextData.Destroy; begin Clear; DisposeObject(FSectionTextList); DisposeObject(FSectionVariantList); DisposeObject(FComment); inherited Destroy; end; procedure TSectionTextData.ReBuildList; var i : Integer; tmpSecLst: TListString; nsl : TCoreClassStrings; h : THashVariantTextStream; begin tmpSecLst := TListString.Create; FSectionVariantList.GetListData(tmpSecLst); if tmpSecLst.Count > 0 then for i := 0 to tmpSecLst.Count - 1 do begin nsl := TCoreClassStringList.Create; h := THashVariantTextStream.Create(THashVariantList(tmpSecLst.Objects[i])); h.DataExport(nsl); DisposeObject(h); FSectionTextList[tmpSecLst[i]] := nsl; end; FSectionVariantList.Clear; DisposeObject(tmpSecLst); end; procedure TSectionTextData.Clear; begin FSectionTextList.Clear; FSectionVariantList.Clear; FComment.Clear; end; procedure TSectionTextData.Delete(aName: SystemString); begin FSectionTextList.Delete(aName); FSectionVariantList.Delete(aName); end; function TSectionTextData.Exists(aName: SystemString): Boolean; begin Result := FSectionTextList.Exists(aName) or FSectionVariantList.Exists(aName); end; function TSectionTextData.GetDefaultValue(const SectionName, KeyName: SystemString; const DefaultValue: Variant): Variant; begin Result := VariantList[SectionName].GetDefaultValue(KeyName, DefaultValue); end; procedure TSectionTextData.SetDefaultValue(const SectionName, KeyName: SystemString; const Value: Variant); begin Hit[SectionName, KeyName] := Value; end; function TSectionTextData.DataImport(TextList: TCoreClassStrings): Boolean; var i : Integer; ln : umlString; nsect : SystemString; ntLst : TCoreClassStrings; tmpSecLst: TListString; nsl : TCoreClassStrings; vt : THashVariantTextStream; begin // merge section tmpSecLst := TListString.Create; FSectionVariantList.GetListData(tmpSecLst); if tmpSecLst.Count > 0 then for i := 0 to tmpSecLst.Count - 1 do begin vt := THashVariantTextStream.Create(THashVariantList(tmpSecLst.Objects[i])); nsl := TCoreClassStringList.Create; FSectionTextList[tmpSecLst[i]] := nsl; vt.DataExport(nsl); DisposeObject(vt); end; DisposeObject(tmpSecLst); FSectionVariantList.Clear; // import new section ntLst := nil; nsect := ''; Result := False; if Assigned(TextList) then begin if TextList.Count > 0 then begin i := 0; while i < TextList.Count do begin ln := umlTrimChar(TextList[i], ' '); if (ln.len > 0) and (ln.First = '[') and (ln.Last = ']') then begin if Result then AddDataSection(nsect, ntLst); ntLst := TCoreClassStringList.Create; nsect := umlGetFirstStr(ln, '[]').Text; Result := True; end else if Result then begin ntLst.Append(ln); end else begin if ln.len > 0 then FComment.Append(ln); end; Inc(i); end; if Result then AddDataSection(nsect, ntLst); end; while (FComment.Count > 0) and (FComment[0] = '') do FComment.Delete(0); while (FComment.Count > 0) and (FComment[FComment.Count - 1] = '') do FComment.Delete(FComment.Count - 1); end; end; procedure TSectionTextData.DataExport(TextList: TCoreClassStrings); var i : Integer; tmpSecLst: TListString; nsl : TCoreClassStrings; vt : THashVariantTextStream; begin TextList.AddStrings(FComment); if FComment.Count > 0 then TextList.Append(''); tmpSecLst := TListString.Create; FSectionVariantList.GetListData(tmpSecLst); if tmpSecLst.Count > 0 then for i := 0 to tmpSecLst.Count - 1 do begin vt := THashVariantTextStream.Create(THashVariantList(tmpSecLst.Objects[i])); nsl := TCoreClassStringList.Create; FSectionTextList[tmpSecLst[i]] := nsl; vt.DataExport(nsl); DisposeObject(vt); end; FSectionTextList.GetListData(tmpSecLst); if tmpSecLst.Count > 0 then for i := 0 to tmpSecLst.Count - 1 do if (tmpSecLst.Objects[i] is TCoreClassStrings) then begin nsl := TCoreClassStrings(tmpSecLst.Objects[i]); if nsl <> nil then begin TextList.Append('[' + tmpSecLst[i] + ']'); TextList.AddStrings(nsl); TextList.Append(''); end; end; DisposeObject(tmpSecLst); end; procedure TSectionTextData.Merge(sour: TSectionTextData); var ns: TCoreClassStringList; begin try ReBuildList; ns := TCoreClassStringList.Create; sour.ReBuildList; sour.DataExport(ns); DataImport(ns); DisposeObject(ns); ReBuildList; except end; end; procedure TSectionTextData.Assign(sour: TSectionTextData); var ns: TCoreClassStringList; begin try ns := TCoreClassStringList.Create; sour.ReBuildList; sour.DataExport(ns); Clear; DataImport(ns); DisposeObject(ns); except end; end; function TSectionTextData.Same(sour: TSectionTextData): Boolean; var i : Integer; ns: TCoreClassStringList; n : SystemString; begin Result := False; ReBuildList; sour.ReBuildList; // if Comment.Text <> sour.Comment.Text then // Exit; if FSectionTextList.Count <> sour.FSectionTextList.Count then Exit; ns := TCoreClassStringList.Create; for i := 0 to ns.Count - 1 do begin n := ns[i]; if not sour.Exists(n) then begin DisposeObject(ns); Exit; end; end; for i := 0 to ns.Count - 1 do begin n := ns[i]; if not SameText(Strings[n].Text, sour.Strings[n].Text) then begin DisposeObject(ns); Exit; end; end; DisposeObject(ns); Result := True; end; procedure TSectionTextData.LoadFromStream(Stream: TCoreClassStream); var n: TCoreClassStrings; begin Clear; n := TCoreClassStringList.Create; {$IFDEF FPC} n.LoadFromStream(Stream); {$ELSE} n.LoadFromStream(Stream, TEncoding.UTF8); {$ENDIF} DataImport(n); DisposeObject(n); end; procedure TSectionTextData.SaveToStream(Stream: TCoreClassStream); var n: TCoreClassStrings; begin n := TCoreClassStringList.Create; DataExport(n); {$IFDEF FPC} n.SaveToStream(Stream); {$ELSE} n.SaveToStream(Stream, TEncoding.UTF8); {$ENDIF} DisposeObject(n); end; procedure TSectionTextData.LoadFromFile(FileName: SystemString); var ns: TMemoryStream64; begin try ns := TMemoryStream64.Create; ns.LoadFromFile(FileName); except DisposeObject(ns); Exit; end; try LoadFromStream(ns); finally DisposeObject(ns); end; end; procedure TSectionTextData.SaveToFile(FileName: SystemString); var ns: TMemoryStream64; begin ns := TMemoryStream64.Create; try SaveToStream(ns); ns.SaveToFile(FileName); finally DisposeObject(ns); end; end; function TSectionTextData.GetAsText: SystemString; var ns: TCoreClassStringList; begin ns := TCoreClassStringList.Create; DataExport(ns); Result := ns.Text; DisposeObject(ns); end; procedure TSectionTextData.SetAsText(const Value: SystemString); var ns: TCoreClassStringList; begin Clear; ns := TCoreClassStringList.Create; ns.Text := Value; DataImport(ns); DisposeObject(ns); end; procedure TSectionTextData.GetSectionList(Dest: TCoreClassStrings); var i : Integer; tmpSecLst: TListString; nsl : TCoreClassStrings; vt : THashVariantTextStream; begin tmpSecLst := TListString.Create; FSectionVariantList.GetListData(tmpSecLst); if tmpSecLst.Count > 0 then for i := 0 to tmpSecLst.Count - 1 do begin vt := THashVariantTextStream.Create(THashVariantList(tmpSecLst.Objects[i])); nsl := TCoreClassStringList.Create; FSectionTextList[tmpSecLst[i]] := nsl; vt.DataExport(nsl); DisposeObject(vt); end; DisposeObject(tmpSecLst); FSectionTextList.GetListData(Dest); end; procedure TSectionTextData.GetSectionList(Dest: TListString); var i : Integer; tmpSecLst: TListString; nsl : TCoreClassStrings; vt : THashVariantTextStream; begin tmpSecLst := TListString.Create; FSectionVariantList.GetListData(tmpSecLst); if tmpSecLst.Count > 0 then for i := 0 to tmpSecLst.Count - 1 do begin vt := THashVariantTextStream.Create(THashVariantList(tmpSecLst.Objects[i])); nsl := TCoreClassStringList.Create; FSectionTextList[tmpSecLst[i]] := nsl; vt.DataExport(nsl); DisposeObject(vt); end; DisposeObject(tmpSecLst); FSectionTextList.GetNameList(Dest); end; procedure TSectionTextData.GetSectionList(Dest: TListPascalString); var i : Integer; tmpSecLst: TListString; nsl : TCoreClassStrings; vt : THashVariantTextStream; begin tmpSecLst := TListString.Create; FSectionVariantList.GetListData(tmpSecLst); if tmpSecLst.Count > 0 then for i := 0 to tmpSecLst.Count - 1 do begin vt := THashVariantTextStream.Create(THashVariantList(tmpSecLst.Objects[i])); nsl := TCoreClassStringList.Create; FSectionTextList[tmpSecLst[i]] := nsl; vt.DataExport(nsl); DisposeObject(vt); end; DisposeObject(tmpSecLst); FSectionTextList.GetNameList(Dest); end; function TSectionTextData.GetSectionObjectName(_Obj: THashVariantList): SystemString; begin Result := FSectionVariantList.GetObjAsName(_Obj); end; end.
unit xpr.opcodes; { Author: Jarl K. Holta License: GNU Lesser GPL (http://www.gnu.org/licenses/lgpl.html) stuff } {$I express.inc} interface uses SysUtils; type EBytecode = ( LOAD_CONST, LOAD, STORE_FAST, DISCARD_TOP, COPY_FAST, JMP_IF_FALSE, JMP_IF_TRUE, JUMP, {ALIASES:} __CONTINUE, __BREAK, __FUNC, JMP_BACK, JMP_FORWARD, ASGN, RASGN, BUILD_LIST, UNARY_PREINC, UNARY_PREDEC, UNARY_POSTINC, UNARY_POSTDEC, INPLACE_ADD, INPLACE_SUB, INPLACE_DIV, INPLACE_MUL, UNARY_SUB, UNARY_NOT, UNARY_BINV, BIN_ADD, BIN_SUB, BIN_MUL, BIN_FDIV, BIN_DIV, BIN_MOD, BIN_EQ, BIN_NE, BIN_LT, BIN_GT, BIN_LE, BIN_GE, BIN_AND, BIN_OR, BIN_BAND, BIN_BOR, BIN_BXOR, CALL, GET_ITEM, SET_ITEM, PRINT, TIMENOW, RETURN ); TOperation = record code: EBytecode; arg : Int32; end; TOperationArray = array of TOperation; implementation end.
$LENGTH 44 $TITLE INDCOM User command processor for INDENT module INDCOM; (*$Y20 $HEADER INDCOM.HDR *) $PAGE GLOBAL declarations for program (*$X10 $OPTIONS NOSOURCE *) $INCLUDE INDENT.TYP (*$X10 $OPTIONS SOURCE *) public var LINE: TEXTLINE; (* processed input line *) THIS_TOKEN, (* current token type *) NEXT_TOKEN: TOKENTYPE; (* lookahead--may be comment *) CURSTART, CUREND, (* start and finish or current tok *) TOK_IND, (* offset of curtok from start of line *) ORIG_IND, (* original indent of line *) OUT_IND, (* final indent from FORMAT *) CUR_IND, (* current minimum from FORMAT *) LIN_INDENT, (* out_ind for this line *) TOK_LEN, (* length of text of current token *) OUT_MAX, (* maximum output column *) COM_COL, (* column to which to align comments *) COM_IND, (* column for stand-alones to start *) EOL_CT, (* num of end-of-lines after this *) QUANTUM: LINE_IDX; (* current indent quantum *) OPTIONS: OPTIONSET; (* current options in effect *) TOK_BEFORES, TOK_AFTERS: TOKSET; (* set of before/after spacing -- token *) SYM_BEFORES, SYM_AFTERS: SYMSET; (* set of same -- but for symbols *) WORD_CASE, (* case selection for reserved words *) TEXT_CASE: CASE_TYPE; (* and for normal text *) ALIGN_COM, (* true if comments to be aligned *) SPREAD: boolean; (* true if SPREAD option in effect *) INFILE, OUTFILE: text; (* output file id *) static var (* the default settings for params *) DEF_COM_COL: LINE_IDX := 41; (* comment column setting *) DEF_QUAN: LINE_IDX := 2; (* quantum of indentation *) DEF_OPTIONS: OPTIONSET := []; (* default options -- none *) DEF_S_BEFORES: SYMSET := []; (* space before symbols *) DEF_S_AFTERS: SYMSET := []; (* space after symbols *) DEF_T_BEFORES: TOKSET := []; (* space before reserved words *) DEF_T_AFTERS: TOKSET := []; (* space after reserved words *) DEF_W_CASE: CASE_TYPE := NO_CHANGE; (* reserved word case *) DEF_T_CASE: CASE_TYPE := NO_CHANGE; (* case for program text *) DEF_AL_COM: boolean := false; (* column alignment of comments *) DEF_SPREAD: boolean := false; (* spread option *) DEF_OUT_MAX: LINE_IDX := 100; (* maximum output column *) type (* a few extras for command process *) FNSTR = string[30]; (* for file descriptors *) COM_LINE = string[255]; (* for command lines *) FILE_IDX = 0..3; (* indication of active files *) OPT_TOK = ( (* scalar for user option selection *) NOT_GOOD, SPR_TOK, NOSPR_TOK, IND_TOK, COL_TOK, WID_TOK, BEF_TOK, AFT_TOK, WORD_TOK, TEXT_TOK, UP_TOK, DOWN_TOK, MIXED_TOK, NONE_TOK, QUAN_TOK ); OPT_TEXT = packed array [1..10] of char; OPT_TABL = array [OPT_TOK] of OPT_TEXT; (* the lookup table *) OPT_SET = set of OPT_TOK; (* for valid options *) SYM_SUBRANGE = '!'..'_'; SYM_TAB_TYPE = array[SYM_SUBRANGE] of SYMBOLS; const ALL_OPT: OPT_SET := [SPR_TOK..QUAN_TOK]; (* all interesting tokens *) NEEDPARENS: OPT_SET := (* set of options taking parens *) [ IND_TOK..TEXT_TOK, QUAN_TOK]; var OPT_TABLE: OPT_TABL = ( (* text table for lookup routine *) '', 'SPREAD', 'NOSPREAD', 'INDENT', 'COLUMN', 'WIDTH', 'BEFORE', 'AFTER', 'WORD', 'TEXT', 'UP', 'DOWN', 'MIXED', 'NONE', 'QUANTUM' ); static var (* file administration vars *) WHICH: FILE_IDX := 0; (* zero level of indirect to start *) INFNAME, (* name of input file *) OUTFNAME, (* name of output file *) PRI_FNAME, (* names of primary, secondary,... *) SEC_FNAME, (* and tertiary command files *) TER_FNAME: FNSTR; PRI_FILE, (* and the file variables *) SEC_FILE, TER_FILE: text; USRLINE: COM_LINE; LPTR: LINE_IDX; ERROR: boolean; external function WORD_LOOKUP (COM_LINE): TOKENTYPE; external function SYM_LOOKUP (COM_LINE): SYMBOLS; external const (* from reader *) SYM_TABLE: SYM_TAB_TYPE; $PAGE READLINE read a command line from where get_line wants it function READLINE (var F: text): COM_LINE; (* READLINE merely commonizes the functions of reading input lines from either command files or from TTY:. Since the file identifier is passed to us, we don't care where it comes from. Functions of READLINE also include removal of all blanks from input line, and conversion of vertical bars to exclamation points so the lookup routines in DO_RES_SYM will find them. *) var TEMP: packed array[1..LINLEN] of char; TIDX: LINE_IDX; begin TIDX := 0; READLINE := ''; if eoln (F) then readln(F); (* may not be if RESET and not OPEN *) while not eoln(F) and not eof(F) do begin if F^ <> ' ' then begin (* fill up the packed array *) TIDX := TIDX + 1; TEMP [TIDX] := uppercase(F^) end; get (F) end; READLINE := TEMP[1: TIDX]; (* Now eliminate vertical bars if any *) loop TIDX := index (READLINE, '|'); exit if TIDX = 0; READLINE[TIDX] := '!' end end (* function READLINE *); $PAGE GET_LINE get a command line function GET_LINE: COM_LINE; (* GET_LINE returns the string form of the next command line to be executed. It hides the details of secondary and tertiary command files internally. Upon reading a null line from the primary source (either 'TTY:' or '###IND.TMP'), GET_LINE executes a STOP. *) var DONE: boolean; (* used to kick out of loop *) begin DONE := false; GET_LINE := ''; while not DONE do case WHICH of (* case on 'active' indirect level *) 0: begin (* nothing open yet *) WHICH := 1; PRI_FNAME := '###IND.TMP'; (* try to open temp file first *) reset (PRI_FILE, PRI_FNAME); if eof (PRI_FILE) then (* no temp file to be had *) begin (* so get 'TTY:' *) PRI_FNAME := 'TTY:'; open (PRI_FILE, PRI_FNAME); (* which hopefully will never fail *) writeln(tty, 'INDENT 1.2 ', compdate); break(tty) end end (* initial call *); 1: begin if PRI_FNAME = 'TTY:' then (* must prompt for input *) begin write (tty, '*'); break (tty) end; GET_LINE := READLINE (PRI_FILE); (* get the input line *) if eof (PRI_FILE) or (GET_LINE = '') then begin if PRI_FNAME <> 'TTY:' then (* we're done. delete IND.TMP file *) rewrite(PRI_FILE); stop (* and halt the program *) end; if GET_LINE[1] = '@' then (* kick up to indirect level two *) begin SEC_FNAME := substr (GET_LINE, 2, length(GET_LINE) - 1); open (SEC_FILE, '.CMD ' || SEC_FNAME); (* try to open *) if eof (SEC_FILE) then (* can't find file *) writeln(tty, 'Can''t open secondary file ', SEC_FNAME) else WHICH := 2 (* got it -- hit loop again for line *) end else DONE := true (* otherwise we got a command line *) end (* level one *); 2: begin GET_LINE := READLINE (SEC_FILE); if eof (SEC_FILE) then WHICH := 1 (* back to level one if eof *) else if GET_LINE[1] = '@' then begin (* tertiary level of indirect *) TER_FNAME := substr (GET_LINE, 2, length (GET_LINE) - 1); open (TER_FILE, '.CMD '||TER_FNAME); if eof (TER_FILE) then writeln( tty, 'Can''t open tertiary file ', TER_FNAME) else WHICH := 3 end else DONE := (GET_LINE <> '') (* don't bother returning null line *) end (* secondary read *); 3: begin GET_LINE := READLINE (TER_FILE); if eof (TER_FILE) then WHICH := 2 else if GET_LINE[1] = '@' then writeln (tty, 'Level of indirection exceeded.') else DONE := (GET_LINE <> '') end (* tertiary read *) end (* case and while *) end (* function GET_LINE *); $PAGE SETDEFAULT to set default pars procedure SETDEFAULT; (* SETDEFAULT places the contents of the appropriate default parameter cells into the cells used by the rest of the INDENT program. Thus a single command may override the default settings, with those defaults being restored after the execution of the command. *) begin COM_COL := DEF_COM_COL; QUANTUM := DEF_QUAN; OPTIONS := DEF_OPTIONS; SYM_BEFORES := DEF_S_BEFORES; SYM_AFTERS := DEF_S_AFTERS; TOK_BEFORES := DEF_T_BEFORES; TOK_AFTERS := DEF_T_AFTERS; WORD_CASE := DEF_W_CASE; TEXT_CASE := DEF_T_CASE; ALIGN_COM := DEF_AL_COM; SPREAD := DEF_SPREAD; OUT_MAX := DEF_OUT_MAX end (* procedure SETDEFAULT *); $PAGE NEWDEFAULT to change default pars procedure NEWDEFAULT; (* NEWDEFAULT is called to move the program parameters in the normal locations into the default save locations. It is called when a list of options has been processed, and these options comprise the new default settings. The option processor (below) places all new values into the normal locations. *) begin DEF_COM_COL := COM_COL; DEF_QUAN := QUANTUM; DEF_OPTIONS := OPTIONS; DEF_S_BEFORES := SYM_BEFORES; DEF_S_AFTERS := SYM_AFTERS; DEF_T_BEFORES := TOK_BEFORES; DEF_T_AFTERS := TOK_AFTERS; DEF_W_CASE := WORD_CASE; DEF_T_CASE := TEXT_CASE; F_AL_COM := ALIGN_COM; DEF_SPREAD := SPREAD; DEF_OUT_MAX := OUT_MAX end (* procedure NEWDEFAULT *); $PAGE GETCMDHEADER header and error routine public procedure GETCMD; (* GETCMD is the boss of this module, and directs the parsing of user input lines. Parsing routines within which errors may occur are defined within the scope of GETCMD so that an out-of-scope GOTO may be performed by the error routine to restart things. Following are the error routine and the other parsing routines. *) label 1; procedure ERROR (MSG: COM_LINE); begin writeln(tty, MSG, '.'); goto 1 end (* procedure ERROR *); $PAGE DO_INT simple routine to return integer value of input text function DO_INT: LINE_IDX; begin DO_INT := 0; while (length(USRLINE) >= LPTR) andif (USRLINE[LPTR] in ['0'..'9']) do begin DO_INT := (DO_INT * 10) + ord(USRLINE[LPTR]) - ord('0'); LPTR := LPTR + 1 end end (* function DO_INT *); $PAGE DO_OPT_LOOK to lookup user selected options function DO_OPT_LOOK: OPT_TOK; (* DO_OPT_LOOK munches alphabetic characters in USRLINE starting at LPTR to identify a selected option. The search will terminate when either the alphabetic characters have been exhausted (found a non-alpha) or if the characters already scanned cannot form one of the OPT_TOK keywords. If a non-alpha (or end-of-line) was encountered, DO_OPT_LOOK will return the token found, or NOT_GOOD if the characters scanned do not form a non-ambiguous substring of one of the tokens. *) var OPT_IDX: OPT_TOK; (* for walking the table *) OPT_VALID: OPT_SET; (* set of tokens still valid *) OPT_V_CARD: LINE_IDX; (* cardinality of above set *) TAB_IDX: LINE_IDX; (* index of characters in table *) begin OPT_VALID := ALL_OPT; OPT_V_CARD := ord (maximum(OPT_TOK)); (* actually one less than size *) TAB_IDX := 1; (* start at the first char *) repeat for OPT_IDX := SPR_TOK to QUAN_TOK do (* walk the token list *) if OPT_IDX in OPT_VALID then (* don't bother if already excluded *) if OPT_TABLE[OPT_IDX,TAB_IDX] <> USRLINE[LPTR] then begin (* no longer possible to match this *) OPT_VALID := OPT_VALID - [OPT_IDX]; (* remove from set *) OPT_V_CARD := OPT_V_CARD - 1 (* and decrem. running cardinality *) end else DO_OPT_LOOK := OPT_IDX; (* use funct. val. to keep track *) LPTR := LPTR + 1; (* onto next source character *) TAB_IDX := TAB_IDX + 1 (* and next table character *) until ((LPTR > length(USRLINE)) orif not (USRLINE[LPTR] in ['A'..'Z'])) or (OPT_V_CARD = 0); (* until no more, or nothing possible *) if OPT_V_CARD <> 1 then (* either ambiguous or nonsense *) DO_OPT_LOOK := NOT_GOOD (* If the cardinality of the valid set is exactly one, then DO_OPT_LOOK will have been set in the above FOR loop to the correct token. *) end (* function DO_OPT_LOOK *); $PAGE DO_RES_SYM process a list of BEFORE/AFTER options procedure DO_RES_SYM ( var TOKS: TOKSET; var SYMS: SYMSET ); (* DO_RES_SYM processes the list of quoted special symbols and (quoted) reserved words in a BEFORE/AFTER list. It calls the lookup routines in READER to identify them. The two parameters are either the BEFORE or AFTER spacing sets (we don't care which), and the routine adds each identified element to the appropriate set. If the option list is null, the sets are cleared. *) var TMPTOK: TOKENTYPE; (* returned by WORD_LOOKUP *) TMPSYM: SYMBOLS; (* and SYM_LOOKUP or SYM_TABLE *) GOT_ONE: boolean; (* true if not null list *) TMPSTR: string[20]; (* temp for specialsym/ resword *) DELIM: char; (* delim for quotes, either ' or " *) begin GOT_ONE := false; while (LPTR <= length(USRLINE)) do begin TMPSTR := ''; if USRLINE[LPTR] in ['''','"'] then begin (* quoted string, strip off quotes *) DELIM := USRLINE[LPTR]; LPTR := LPTR + 1; (* skip first one *) while (LPTR <= length(USRLINE)) andif (USRLINE[LPTR] <> DELIM) do (* tack on chars while within quotes *) begin TMPSTR := TMPSTR || USRLINE[LPTR]; LPTR := LPTR + 1 end; if LPTR > length(USRLINE) then (* no close quote found *) ERROR ('No close quote found in BEFORE/AFTER item'); LPTR := LPTR + 1 (* else skip past close *) end else (* non-quoted, just munch chars *) while (LPTR <= length(USRLINE)) andif not (USRLINE[LPTR] in [',',')']) do begin (* take chars while not delimiter *) TMPSTR := TMPSTR || USRLINE[LPTR]; LPTR := LPTR + 1 end; if TMPSTR <> '' then (* we have something *) begin GOT_ONE := true; (* if not already *) if TMPSTR[1] in ['A'..'Z'] then begin (* alphabetic, lookup as resword *) TMPSYM := NO_GOOD; TMPTOK := WORD_LOOKUP (TMPSTR) end else begin (* must be special symbol *) TMPTOK := ETC; if length(TMPSTR) = 1 then (* lookup in single char array *) TMPSYM := SYM_TABLE[ TMPSTR[1] ] else TMPSYM := SYM_LOOKUP (TMPSTR) end; if (TMPSYM in [NO_GOOD,OPEN_COM_OP,CLOSE_COM_OP]) and(TMPTOK = ETC) then (* all failed, comments no good *) ERROR ('Unrecognized reserved word or symbol -- "'||TMPSTR||'"'); if TMPSYM = NO_GOOD then TOKS := TOKS + [TMPTOK] (* otherwise is one or the other *) else SYMS := SYMS + [TMPSYM] end (* got something *); if LPTR > length (USRLINE) then ERROR ('Incomplete BEFORE/AFTER list'); exit if USRLINE [LPTR] <> ','; (* else we're done *) LPTR := LPTR + 1 end (* while *); if not GOT_ONE then begin (* null list, reset sets *) SYMS := []; TOKS := [] end end (* procedure DO_RES_SYM *); $PAGE DO_IND_OPT to process INDENT(1,2,3...) option list procedure DO_IND_OPT; (* DO_IND_OPT processes numbers in a list following the keyword INDENT, and, if acceptable, places them into the set OPTIONS. *) var TMP: LINE_IDX; begin OPTIONS := []; (* in case we find nothing *) while (LPTR <= length(USRLINE)) andif (USRLINE[LPTR] <> ')' ) do begin TMP := DO_INT; (* try to get a number *) if (TMP > 0) and (TMP <= MAX_OPT) then OPTIONS := OPTIONS + [TMP] else ERROR ('Invalid INDENT() option number'); if (LPTR <= length(USRLINE)) andif (USRLINE[LPTR] = ',') then LPTR := LPTR + 1 end end (* procedure DO_IND_OPT *); $PAGE DO_OPTIONS to decode and process option list procedure DO_OPTIONS; (* DO_OPTIONS processes a list of options separated by commas. It is assumed that the slash has been removed before the option list. *) var CASE_OPT, (* temp for case conversion keyword *) WHAT: OPT_TOK; (* the current option token *) CASE_TMP: CASE_TYPE; (* temp for case conversion scalar *) begin loop WHAT := DO_OPT_LOOK; (* get the option keyword *) if WHAT in NEEDPARENS then (* most keywords require parens *) begin if (LPTR > length(USRLINE)) (* at end of line, no paren *) orif (USRLINE[LPTR] <> '(') then (* orif no paren *) ERROR ('Option requires open paren') else LPTR := LPTR + 1 (* otherwise tick past it *) end; case WHAT of SPR_TOK, NOSPR_TOK: (* one of the SPREAD tokens *) SPREAD := (WHAT = SPR_TOK); (* set SPREAD accordingly *) IND_TOK: (* 'INDENT' option keyword *) DO_IND_OPT; (* easy, call slave routine *) COL_TOK: begin (* comment alignment column *) COM_COL := DO_INT; (* get integer within parens *) if COM_COL > LINLEN then (* an absurd specification *) ERROR ('Invalid column specification'); ALIGN_COM := (COM_COL <> 0); (* zero implies no comment alignment *) COM_COL := COM_COL - 1 end; WID_TOK: (* maximum output width specif. *) begin OUT_MAX := DO_INT; (* get the integer *) if (OUT_MAX <= 0) or (* check for 'range' *) (OUT_MAX > LINLEN) then ERROR ('Invalid width specification') end; BEF_TOK: (* list of 'BEFORE' spacings *) DO_RES_SYM (TOK_BEFORES, SYM_BEFORES); AFT_TOK: (* and of 'AFTER' spacings *) DO_RES_SYM (TOK_AFTERS, SYM_AFTERS); QUAN_TOK: (* QUANTUM specification *) begin QUANTUM := DO_INT; (* get the number *) if (QUANTUM <= 0) or (QUANTUM > 20) then (* absurd quantum spec. *) ERROR ('Invalid quantum specification') end; TEXT_TOK, WORD_TOK: (* case conversion specs *) begin CASE_OPT := DO_OPT_LOOK; (* get case keyword *) if CASE_OPT = NONE_TOK then (* now cascade down possibilities *) CASE_TMP := NO_CHANGE else if CASE_OPT = UP_TOK then CASE_TMP := CAP else if CASE_OPT = DOWN_TOK then CASE_TMP := DECAP else if CASE_OPT = MIXED_TOK then CASE_TMP := MIXED else ERROR ('Invalid case conversion option'); if WHAT = WORD_TOK then (* anything OK for reserved words *) WORD_CASE := CASE_TMP else if CASE_TMP = MIXED then (* but mixed not OK for text *) ERROR ('''MIXED'' not allowed for ''TEXT''') else TEXT_CASE := CASE_TMP end; OTHERS: (* 'NOT_GOOD' *) ERROR ('Unrecognizable option keyword') end (* case *); if WHAT in NEEDPARENS then (* now get the closeparen *) if (LPTR > length(USRLINE)) orif (USRLINE[LPTR] <> ')') then ERROR ('Need close paren for option') else LPTR := LPTR + 1; (* tick past it if found *) exit if LPTR >= length(USRLINE); (* we're done, successful *) exit if (USRLINE[LPTR] <> ',') do (* something there, not a comma *) if length(USRLINE) <> LPTR then ERROR ('Extraneous characters follow option list'); LPTR := LPTR + 1; (* else tick past comma *) exit if LPTR > length(USRLINE) (* OK if terminal comma (null option)*) end (* loop *) end (* procedure DO_OPTIONS *); $PAGE GETCMD extract info from command line (* GETCMD tries to make a useful interpretation of an input line. It calls GET_LINE for a line to parse, and goes to work. It will not return until we are ready to process (i.e. input and output files are open). *) var EQ_IDX, (* for index of equalsign if found *) SL_IDX: LINE_IDX; (* and for slash if found *) begin; 1: (* come here after error *) SETDEFAULT; (* restore default settings *) USRLINE := GET_LINE; (* get an input line *) EQ_IDX := index (USRLINE, '='); (* find interesting characters *) SL_IDX := index (USRLINE, '/'); if SL_IDX <> 0 then begin (* there's an option list there *) LPTR := SL_IDX + 1; (* set cursor for DO_OPTIONS et.al. *) DO_OPTIONS; (* if it returns, all went well *) if SL_IDX = 1 then begin (* first on line, new default info *) NEWDEFAULT; (* put them in default cells *) goto 1 (* and back to the top *) end end (* option processing *); if (EQ_IDX <> 0) and (* equals sign -- output filespec *) ((SL_IDX = 0) or (SL_IDX > EQ_IDX)) (* if not within option list!! *) then begin OUTFNAME := substr (USRLINE, 1, EQ_IDX - 1); (* we have an explicit output file now. There must be in input spec also, terminated either by end of line, or by option slash. *) if SL_IDX = 0 then INFNAME := substr (USRLINE, EQ_IDX + 1) else INFNAME := substr(USRLINE, EQ_IDX + 1, SL_IDX - EQ_IDX - 1) end else begin (* no output filespec *) if SL_IDX = 0 then INFNAME := USRLINE (* no options also -- inputspec only *) else INFNAME := substr (USRLINE, 1, SL_IDX - 1); OUTFNAME := INFNAME || '.NEW[,]'; (* enforce .NEW on output file *) end; (* now let's open the files. If OK, return to caller, else just call ERROR, which will kick us back to the top. *) open (INFILE, '.PAS '||INFNAME); if eof(INFILE) then ERROR ('Can''t open input file'); rewrite (OUTFILE, '.NEW '||OUTFNAME); if not eof(OUTFILE) then ERROR ('Can''t rewrite output file') (* if we got here, all is ready for the coroutines to rip. *) end (* procedure GETCMD and module INDCOM *). )h6j
{ *********************************************************** } { * TForge Library * } { * Copyright (c) Sergey Kasandrov 1997, 2017 * } { *********************************************************** } unit tfAlgServ; interface {$I TFL.inc} {$R-} uses tfRecords, tfTypes, tfByteVectors; (* type TAlgGetter = function(var A: IInterface): TF_RESULT; {$IFDEF TFL_STDCALL}stdcall;{$ENDIF} *) type PAlgItem = ^TAlgItem; { TAlgItem = record public const NAME_SIZE = 16; private FName: array[0..NAME_SIZE - 1] of Byte; FGetter: Pointer; end; } TAlgItem = record private FAlgID: TF_AlgID; FName: PAnsiChar; // actually UTF8 end; type PAlgServer = ^TAlgServer; TAlgServer = record public FVTable: PPointer; FCapacity: Integer; // set in derived classes FCount: Integer; // FAlgTable: array[0..TABLE_SIZE - 1] of TAlgItem; FAlgTable: array[0..0] of TAlgItem; // var size public (* class function AddTableItem(Inst: Pointer; const AName: RawByteString; AGetter: Pointer): Boolean; static; class function GetByName(Inst: Pointer; AName: Pointer; CharSize: Integer; var Alg: IInterface): TF_RESULT; {$IFDEF TFL_STDCALL}stdcall;{$ENDIF} static; class function GetByIndex(Inst: Pointer; Index: Integer; var Alg: IInterface): TF_RESULT; {$IFDEF TFL_STDCALL}stdcall;{$ENDIF} static; class function GetName(Inst: Pointer; Index: Integer; var Name: PByteVector): TF_RESULT; {$IFDEF TFL_STDCALL}stdcall;{$ENDIF} static; class function GetCount(Inst: Pointer): Integer; {$IFDEF TFL_STDCALL}stdcall;{$ENDIF} static; *) class function AddTableItem(Inst: Pointer; AName: Pointer; AAlgID: TF_AlgID): Boolean; static; class function GetID(Inst: Pointer; Index: Integer; var AlgID: TF_AlgID): TF_RESULT; {$IFDEF TFL_STDCALL}stdcall;{$ENDIF} static; class function GetName(Inst: Pointer; Index: Integer; var Name: Pointer): TF_RESULT; {$IFDEF TFL_STDCALL}stdcall;{$ENDIF} static; class function GetCount(Inst: Pointer): Integer; {$IFDEF TFL_STDCALL}stdcall;{$ENDIF} static; class function GetIDByName(Inst: Pointer; AName: Pointer; CharSize: Integer; var AlgID: TF_AlgID): TF_RESULT; {$IFDEF TFL_STDCALL}stdcall;{$ENDIF} static; class function GetNameByID(Inst: Pointer; AlgID: TF_AlgID; var AName: Pointer): TF_RESULT; {$IFDEF TFL_STDCALL}stdcall;{$ENDIF} static; end; implementation // AName should be uppecase string //function TAlgServer.AddTableItem(const AName: RawByteString; AGetter: Pointer): Boolean; (* class function TAlgServer.AddTableItem(Inst: Pointer; const AName: RawByteString; AGetter: Pointer): Boolean; var P: PAlgItem; L: Integer; begin with PAlgServer(Inst)^ do if FCount < FCapacity then begin P:= @FAlgTable[FCount]; FillChar(P^.FName, SizeOf(P^.FName), 0); L:= Length(AName); if L > SizeOf(P^.FName) then L:= SizeOf(P^.FName); Move(Pointer(AName)^, P^.FName, L); P^.FGetter:= AGetter; Inc(FCount); Result:= True; end else Result:= False; end; class function TAlgServer.GetByName(Inst: Pointer; AName: Pointer; CharSize: Integer; var Alg: IInterface): TF_RESULT; const ANSI_a = Ord('a'); var I: Integer; PItem, Sentinel: PAlgItem; P1, P2: PByte; Found: Boolean; UP2: Byte; begin PItem:= @PAlgServer(Inst).FAlgTable; Sentinel:= PItem; Inc(Sentinel, PAlgServer(Inst).FCount); while PItem <> Sentinel do begin P1:= @PItem.FName; P2:= AName; Found:= True; I:= SizeOf(PItem.FName); repeat UP2:= P2^; if UP2 >= ANSI_a then UP2:= UP2 and not $20; { upcase } if P1^ <> UP2 then begin Found:= False; Break; end; if P1^ = 0 then Break; Inc(P1); Inc(P2, CharSize); Dec(I); until I = 0; if Found then begin Result:= TAlgGetter(PItem.FGetter)(Alg); Exit; end; Inc(PItem); end; Result:= TF_E_INVALIDARG; end; class function TAlgServer.GetByIndex(Inst: Pointer; Index: Integer; var Alg: IInterface): TF_RESULT; begin if Cardinal(Index) >= Cardinal(PAlgServer(Inst).FCount) then Result:= TF_E_INVALIDARG else Result:= TAlgGetter(PAlgServer(Inst).FAlgTable[Index].FGetter)(Alg); end; class function TAlgServer.GetName(Inst: Pointer; Index: Integer; var Name: PByteVector): TF_RESULT; var Tmp: PByteVector; P, P1: PByte; I: Integer; begin if Cardinal(Index) >= Cardinal(PAlgServer(Inst).FCount) then Result:= TF_E_INVALIDARG else begin P:= @PAlgServer(Inst).FAlgTable[Index].FName; P1:= P; I:= 0; repeat if P1^ = 0 then Break; Inc(P1); Inc(I); until I = 16; if I = 0 then Result:= TF_E_UNEXPECTED else begin Tmp:= nil; Result:= ByteVectorAlloc(Tmp, I); if Result = TF_S_OK then begin Move(P^, Tmp.FData, I); tfFreeInstance(Name); //if Name <> nil then TtfRecord.Release(Name); Name:= Tmp; end; end; end; end; *) class function TAlgServer.AddTableItem(Inst: Pointer; AName: Pointer; AAlgID: TF_AlgID): Boolean; var P: PAlgItem; L: Integer; begin with PAlgServer(Inst)^ do if FCount < FCapacity then begin P:= @FAlgTable[FCount]; P^.FAlgID:= AAlgID; P^.FName:= AName; Inc(FCount); Result:= True; end else Result:= False; end; class function TAlgServer.GetIDByName(Inst: Pointer; AName: Pointer; CharSize: Integer; var AlgID: TF_AlgID): TF_RESULT; const ANSI_a = Ord('a'); ANSI_z = Ord('z'); var PItem, Sentinel: PAlgItem; P1, P2: PByte; Found: Boolean; Ch: Byte; LCharSize: Integer; begin PItem:= @PAlgServer(Inst).FAlgTable; Sentinel:= PItem; Inc(Sentinel, PAlgServer(Inst).FCount); while PItem <> Sentinel do begin P1:= PByte(PItem.FName); P2:= PByte(AName); Found:= False; repeat if (P1^ = 0) then begin Found:= P2^ = 0; Break; end; Ch:= P2^; if (Ch >= ANSI_a) and (Ch <= ANSI_z) then PByte(@Ch)^:= Byte(Ch) and not $20; { upcase } if P1^ <> Ch then begin Found:= False; Break; end; Inc(P1); // Inc(P2, CharSize); Inc(P2); if CharSize > 1 then begin LCharSize:= CharSize - 1; repeat if (P2^ <> 0) then begin Found:= False; Break; end; Inc(P2); Dec(LCharSize); until LCharSize = 0; end; until False; if Found then begin AlgID:= PItem^.FAlgID; Result:= TF_S_OK; Exit; end; Inc(PItem); end; Result:= TF_E_INVALIDARG; end; class function TAlgServer.GetNameByID(Inst: Pointer; AlgID: TF_AlgID; var AName: Pointer): TF_RESULT; var PItem, Sentinel: PAlgItem; begin PItem:= @PAlgServer(Inst).FAlgTable; Sentinel:= PItem; Inc(Sentinel, PAlgServer(Inst).FCount); while PItem <> Sentinel do begin if PItem^.FAlgID = AlgID then begin AName:= PItem^.FName; Result:= TF_S_OK; Exit; end; Inc(PItem); end; Result:= TF_E_INVALIDARG; end; class function TAlgServer.GetID(Inst: Pointer; Index: Integer; var AlgID: TF_AlgID): TF_RESULT; begin if Cardinal(Index) >= Cardinal(PAlgServer(Inst).FCount) then Result:= TF_E_INVALIDARG else begin AlgID:= PAlgServer(Inst).FAlgTable[Index].FAlgID; Result:= TF_S_OK; end; end; class function TAlgServer.GetCount(Inst: Pointer): Integer; begin Result:= PAlgServer(Inst).FCount; end; class function TAlgServer.GetName(Inst: Pointer; Index: Integer; var Name: Pointer): TF_RESULT; begin if Cardinal(Index) >= Cardinal(PAlgServer(Inst).FCount) then Result:= TF_E_INVALIDARG else begin Name:= PAlgServer(Inst).FAlgTable[Index].FName; Result:= TF_S_OK; end; end; end.
unit FFSReportProgress; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, FFSColorLabel, extctrls, ffsTypes, ffsUtils; type TProgressFinishEvent = procedure(Sender: TObject) of object; TStatusProc = function(ID: integer):TFFSReportStatus of object; TFFSReportProgress = class(TFFSColorLabel) private FTimer : TTimer; FProcessID : integer; FOnFinish: TProgressFinishEvent; FPTimer : TNotifyEvent; FCall : TStatusProc; FrptStatus : TFFSReportStatus; procedure ProcessTimer(Sender: TObject); procedure MsgFFSColorChange(var Msg: TMessage); message Msg_FFSColorChange; procedure Loaded; override; protected { Protected declarations } public procedure MonitorProgress(ID: integer; FDaapiCall : TStatusProc); procedure Abort; constructor create(AOwner:TComponent);override; destructor Destroy; override; property rptStatus : TFFSReportStatus read FrptStatus; published property OnFinish: TProgressFinishEvent read FOnFinish write FOnFinish; end; procedure Register; implementation procedure Register; begin RegisterComponents('FFS Controls', [TFFSReportProgress]); end; { TFFSReportProgress } procedure TFFSReportProgress.Abort; begin FTimer.Enabled := False; Caption := 'User Aborted.'; end; constructor TFFSReportProgress.Create(AOwner:TComponent); begin inherited; FTimer := TTimer.Create(self); // FTimer.Interval := 500; FTimer.Enabled := False; FPTimer := ProcessTimer; FTimer.OnTimer := FPTimer; Caption := ''; font.color := FFSColor[fcsActionText]; end; destructor TFFSReportProgress.Destroy; begin FTimer.Free; inherited; end; procedure TFFSReportProgress.Loaded; begin inherited; Caption := ''; end; procedure TFFSReportProgress.MonitorProgress(ID: integer;FDaapiCall : TStatusProc); begin FCall := FDaapiCall; FProcessID := ID; FTimer.Enabled := True; Caption := ''; end; procedure TFFSReportProgress.MsgFFSColorChange(var Msg: TMessage); begin font.color := FFSColor[fcsActionText]; end; procedure TFFSReportProgress.ProcessTimer(Sender: TObject); var status : string; begin FTimer.Enabled := False; try FrptStatus := FCall(FProcessID); case rptStatus.Control of rcProblem : status := 'Problem occurred.'; rcScan : status := 'Processing ' + inttostr(FrptStatus.PercentComp) + ' %'; rcReport : status := 'Generating ' + inttostr(FrptStatus.PercentComp) + ' %'; rcNone : status := ''; rcDone : status := 'Completed Processing.'; end; Caption := iif(empty(FrptStatus.ScanMsg), status, FrptStatus.ScanMsg); if not empty(FRptStatus.UserMsg) then Caption := Caption + ' ' + FRptStatus.UserMsg; Update; finally if (rptStatus.Control in [rcDone,rcProblem]) then begin if assigned(FOnFinish) then FOnFinish(self); end else FTimer.enabled := True; end; end; end.
{ CoreGraphics - CGContext.h * Copyright (c) 2000-2003 Apple Computer, Inc. * All rights reserved. } { Pascal Translation Updated: Peter N Lewis, <peter@stairways.com.au>, August 2005 } { Modified for use with Free Pascal Version 210 Please report any bugs to <gpc@microbizz.nl> } {$mode macpas} {$packenum 1} {$macro on} {$inline on} {$calling mwpascal} unit CGContext; interface {$setc UNIVERSAL_INTERFACES_VERSION := $0342} {$setc GAP_INTERFACES_VERSION := $0210} {$ifc not defined USE_CFSTR_CONSTANT_MACROS} {$setc USE_CFSTR_CONSTANT_MACROS := TRUE} {$endc} {$ifc defined CPUPOWERPC and defined CPUI386} {$error Conflicting initial definitions for CPUPOWERPC and CPUI386} {$endc} {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN} {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN} {$endc} {$ifc not defined __ppc__ and defined CPUPOWERPC} {$setc __ppc__ := 1} {$elsec} {$setc __ppc__ := 0} {$endc} {$ifc not defined __i386__ and defined CPUI386} {$setc __i386__ := 1} {$elsec} {$setc __i386__ := 0} {$endc} {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__} {$error Conflicting definitions for __ppc__ and __i386__} {$endc} {$ifc defined __ppc__ and __ppc__} {$setc TARGET_CPU_PPC := TRUE} {$setc TARGET_CPU_X86 := FALSE} {$elifc defined __i386__ and __i386__} {$setc TARGET_CPU_PPC := FALSE} {$setc TARGET_CPU_X86 := TRUE} {$elsec} {$error Neither __ppc__ nor __i386__ is defined.} {$endc} {$setc TARGET_CPU_PPC_64 := FALSE} {$ifc defined FPC_BIG_ENDIAN} {$setc TARGET_RT_BIG_ENDIAN := TRUE} {$setc TARGET_RT_LITTLE_ENDIAN := FALSE} {$elifc defined FPC_LITTLE_ENDIAN} {$setc TARGET_RT_BIG_ENDIAN := FALSE} {$setc TARGET_RT_LITTLE_ENDIAN := TRUE} {$elsec} {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.} {$endc} {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE} {$setc CALL_NOT_IN_CARBON := FALSE} {$setc OLDROUTINENAMES := FALSE} {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE} {$setc OPAQUE_UPP_TYPES := TRUE} {$setc OTCARBONAPPLICATION := TRUE} {$setc OTKERNEL := FALSE} {$setc PM_USE_SESSION_APIS := TRUE} {$setc TARGET_API_MAC_CARBON := TRUE} {$setc TARGET_API_MAC_OS8 := FALSE} {$setc TARGET_API_MAC_OSX := TRUE} {$setc TARGET_CARBON := TRUE} {$setc TARGET_CPU_68K := FALSE} {$setc TARGET_CPU_MIPS := FALSE} {$setc TARGET_CPU_SPARC := FALSE} {$setc TARGET_OS_MAC := TRUE} {$setc TARGET_OS_UNIX := FALSE} {$setc TARGET_OS_WIN32 := FALSE} {$setc TARGET_RT_MAC_68881 := FALSE} {$setc TARGET_RT_MAC_CFM := FALSE} {$setc TARGET_RT_MAC_MACHO := TRUE} {$setc TYPED_FUNCTION_POINTERS := TRUE} {$setc TYPE_BOOL := FALSE} {$setc TYPE_EXTENDED := FALSE} {$setc TYPE_LONGLONG := TRUE} uses MacTypes,CFBase,CGGeometry,CGBase,CFDictionary,CGAffineTransforms,CGColorSpace,CGFont,CGImage,CGPDFDocument,CGPath,CGColor,CGShading,CGPDFPage; {$ALIGN POWER} type CGContextRef = ^SInt32; { an opaque 32-bit type } { Line join styles. } type CGLineJoin = SInt32; const kCGLineJoinMiter = 0; kCGLineJoinRound = 1; kCGLineJoinBevel = 2; { Line cap styles. } type CGLineCap = SInt32; const kCGLineCapButt = 0; kCGLineCapRound = 1; kCGLineCapSquare = 2; { Drawing modes for paths. } type CGPathDrawingMode = SInt32; const kCGPathFill = 0; kCGPathEOFill = 1; kCGPathStroke = 2; kCGPathFillStroke = 3; kCGPathEOFillStroke = 4; { Drawing modes for text. } type CGTextDrawingMode = SInt32; const kCGTextFill = 0; kCGTextStroke = 1; kCGTextFillStroke = 2; kCGTextInvisible = 3; kCGTextFillClip = 4; kCGTextStrokeClip = 5; kCGTextFillStrokeClip = 6; kCGTextClip = 7; { Text encodings. } type CGTextEncoding = SInt32; const kCGEncodingFontSpecific = 0; kCGEncodingMacRoman = 1; { Interpolation quality. } type CGInterpolationQuality = SInt32; const kCGInterpolationDefault = 0; { Let the context decide. } kCGInterpolationNone = 1; { Never interpolate. } kCGInterpolationLow = 2; { Faster, lower quality. } kCGInterpolationHigh = 3; { Slower, higher quality. } { Blend modes. } type CGBlendMode = SInt32; const kCGBlendModeNormal = 0; kCGBlendModeMultiply = 1; kCGBlendModeScreen = 2; kCGBlendModeOverlay = 3; kCGBlendModeDarken = 4; kCGBlendModeLighten = 5; kCGBlendModeColorDodge = 6; kCGBlendModeColorBurn = 7; kCGBlendModeSoftLight = 8; kCGBlendModeHardLight = 9; kCGBlendModeDifference = 10; kCGBlendModeExclusion = 11; kCGBlendModeHue = 12; kCGBlendModeSaturation = 13; kCGBlendModeColor = 14; kCGBlendModeLuminosity = 15; { Available in Mac OS X 10.4 & later. } { Return the CFTypeID for CGContextRefs. } function CGContextGetTypeID: CFTypeID; external name '_CGContextGetTypeID'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *) {* Graphics state functions. *} { Push a copy of the current graphics state onto the graphics state * stack. Note that the path is not considered part of the gstate, and is * not saved. } procedure CGContextSaveGState( c: CGContextRef ); external name '_CGContextSaveGState'; { Restore the current graphics state from the one on the top of the * graphics state stack, popping the graphics state stack in the * process. } procedure CGContextRestoreGState( c: CGContextRef ); external name '_CGContextRestoreGState'; {* Coordinate space transformations. *} { Scale the current graphics state's transformation matrix (the CTM) by * `(sx, sy)'. } procedure CGContextScaleCTM( c: CGContextRef; sx: Float32; sy: Float32 ); external name '_CGContextScaleCTM'; { Translate the current graphics state's transformation matrix (the CTM) * by `(tx, ty)'. } procedure CGContextTranslateCTM( c: CGContextRef; tx: Float32; ty: Float32 ); external name '_CGContextTranslateCTM'; { Rotate the current graphics state's transformation matrix (the CTM) by * `angle' radians. } procedure CGContextRotateCTM( c: CGContextRef; angle: Float32 ); external name '_CGContextRotateCTM'; { Concatenate the current graphics state's transformation matrix (the CTM) * with the affine transform `transform'. } procedure CGContextConcatCTM( c: CGContextRef; transform: CGAffineTransform ); external name '_CGContextConcatCTM'; { Return the current graphics state's transformation matrix. } function CGContextGetCTM( c: CGContextRef ): CGAffineTransform; external name '_CGContextGetCTM'; {* Drawing attribute functions. *} { Set the line width in the current graphics state to `width'. } procedure CGContextSetLineWidth( c: CGContextRef; width: Float32 ); external name '_CGContextSetLineWidth'; { Set the line cap in the current graphics state to `cap'. } procedure CGContextSetLineCap( c: CGContextRef; cap: CGLineCap ); external name '_CGContextSetLineCap'; { Set the line join in the current graphics state to `join'. } procedure CGContextSetLineJoin( c: CGContextRef; join: CGLineJoin ); external name '_CGContextSetLineJoin'; { Set the miter limit in the current graphics state to `limit'. } procedure CGContextSetMiterLimit( c: CGContextRef; limit: Float32 ); external name '_CGContextSetMiterLimit'; { Set the line dash patttern in the current graphics state of `c'. } procedure CGContextSetLineDash( c: CGContextRef; phase: Float32; {const} lengths: {variable-size-array} Float32Ptr; count: size_t ); external name '_CGContextSetLineDash'; { Set the path flatness parameter in the current graphics state of `c' to * `flatness'. } procedure CGContextSetFlatness( c: CGContextRef; flatness: Float32 ); external name '_CGContextSetFlatness'; { Set the alpha value in the current graphics state of `c' to `alpha'. } procedure CGContextSetAlpha( c: CGContextRef; alpha: Float32 ); external name '_CGContextSetAlpha'; { Set the blend mode of `context' to `mode'. } procedure CGContextSetBlendMode( context: CGContextRef; mode: CGBlendMode ); external name '_CGContextSetBlendMode'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) {* Path construction functions. *} { Note that a context has a single path in use at any time: a path is not * part of the graphics state. } { Begin a new path. The old path is discarded. } procedure CGContextBeginPath( c: CGContextRef ); external name '_CGContextBeginPath'; { Start a new subpath at point `(x, y)' in the context's path. } procedure CGContextMoveToPoint( c: CGContextRef; x: Float32; y: Float32 ); external name '_CGContextMoveToPoint'; { Append a straight line segment from the current point to `(x, y)'. } procedure CGContextAddLineToPoint( c: CGContextRef; x: Float32; y: Float32 ); external name '_CGContextAddLineToPoint'; { Append a cubic Bezier curve from the current point to `(x,y)', with * control points `(cp1x, cp1y)' and `(cp2x, cp2y)'. } procedure CGContextAddCurveToPoint( c: CGContextRef; cp1x: Float32; cp1y: Float32; cp2x: Float32; cp2y: Float32; x: Float32; y: Float32 ); external name '_CGContextAddCurveToPoint'; { Append a quadratic curve from the current point to `(x, y)', with * control point `(cpx, cpy)'. } procedure CGContextAddQuadCurveToPoint( c: CGContextRef; cpx: Float32; cpy: Float32; x: Float32; y: Float32 ); external name '_CGContextAddQuadCurveToPoint'; { Close the current subpath of the context's path. } procedure CGContextClosePath( c: CGContextRef ); external name '_CGContextClosePath'; {* Path construction convenience functions. *} { Add a single rect to the context's path. } procedure CGContextAddRect( c: CGContextRef; rect: CGRect ); external name '_CGContextAddRect'; { Add a set of rects to the context's path. } procedure CGContextAddRects( c: CGContextRef; {const} rects: {variable-size-array} CGRectPtr; count: size_t ); external name '_CGContextAddRects'; { Add a set of lines to the context's path. } procedure CGContextAddLines( c: CGContextRef; {const} points: {variable-size-array} CGPointPtr; count: size_t ); external name '_CGContextAddLines'; { Add an ellipse inside `rect' to the current path of `context'. See the * function `CGPathAddEllipseInRect' for more information on how the path * for the ellipse is constructed. } procedure CGContextAddEllipseInRect( context: CGContextRef; rect: CGRect ); external name '_CGContextAddEllipseInRect'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) { Add an arc of a circle to the context's path, possibly preceded by a * straight line segment. `(x, y)' is the center of the arc; `radius' is * its radius; `startAngle' is the angle to the first endpoint of the arc; * `endAngle' is the angle to the second endpoint of the arc; and * `clockwise' is 1 if the arc is to be drawn clockwise, 0 otherwise. * `startAngle' and `endAngle' are measured in radians. } procedure CGContextAddArc( c: CGContextRef; x: Float32; y: Float32; radius: Float32; startAngle: Float32; endAngle: Float32; clockwise: SInt32 ); external name '_CGContextAddArc'; { Add an arc of a circle to the context's path, possibly preceded by a * straight line segment. `radius' is the radius of the arc. The arc is * tangent to the line from the current point to `(x1, y1)', and the line * from `(x1, y1)' to `(x2, y2)'. } procedure CGContextAddArcToPoint( c: CGContextRef; x1: Float32; y1: Float32; x2: Float32; y2: Float32; radius: Float32 ); external name '_CGContextAddArcToPoint'; { Add `path' to the path of context. The points in `path' are transformed * by the CTM of context before they are added. } procedure CGContextAddPath( context: CGContextRef; path: CGPathRef ); external name '_CGContextAddPath'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *) {* Path stroking. *} { Replace the path in context with the stroked version of the path, using * the parameters of `context' to calculate the stroked path. The * resulting path is created such that filling it with the appropriate * color will produce the same results as stroking the original path. You * can use this path in the same way you can use the path of any context; * for example, you can clip to the stroked version of a path by calling * this function followed by a call to "CGContextClipPath". } procedure CGContextReplacePathWithStrokedPath( c: CGContextRef ); external name '_CGContextReplacePathWithStrokedPath'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) {* Path information functions. *} { Return true if the context's path contains no elements, false otherwise. } function CGContextIsPathEmpty( c: CGContextRef ): CBool; external name '_CGContextIsPathEmpty'; { Return the current point of the current subpath of the context's * path. } function CGContextGetPathCurrentPoint( c: CGContextRef ): CGPoint; external name '_CGContextGetPathCurrentPoint'; { Return the bounding box of the context's path. The bounding box is the * smallest rectangle completely enclosing all points in the path, * including control points for Bezier and quadratic curves. } function CGContextGetPathBoundingBox( c: CGContextRef ): CGRect; external name '_CGContextGetPathBoundingBox'; { Return true if `point' is contained in the current path of `context'. A * point is contained within a context's path if it is inside the painted * region when the path is stroked or filled with opaque colors using the * path drawing mode `mode'. `point' is specified is user space. } function CGContextPathContainsPoint( context: CGContextRef; point: CGPoint; mode: CGPathDrawingMode ): CBool; external name '_CGContextPathContainsPoint'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) {* Path drawing functions. *} { Draw the context's path using drawing mode `mode'. } procedure CGContextDrawPath( c: CGContextRef; mode: CGPathDrawingMode ); external name '_CGContextDrawPath'; {* Path drawing convenience functions. *} { Fill the context's path using the winding-number fill rule. Any open * subpath of the path is implicitly closed. } procedure CGContextFillPath( c: CGContextRef ); external name '_CGContextFillPath'; { Fill the context's path using the even-odd fill rule. Any open subpath * of the path is implicitly closed. } procedure CGContextEOFillPath( c: CGContextRef ); external name '_CGContextEOFillPath'; { Stroke the context's path. } procedure CGContextStrokePath( c: CGContextRef ); external name '_CGContextStrokePath'; { Fill `rect' with the current fill color. } procedure CGContextFillRect( c: CGContextRef; rect: CGRect ); external name '_CGContextFillRect'; { Fill `rects', an array of `count' CGRects, with the current fill * color. } procedure CGContextFillRects( c: CGContextRef; {const} rects: {variable-size-array} CGRectPtr; count: size_t ); external name '_CGContextFillRects'; { Stroke `rect' with the current stroke color and the current linewidth. } procedure CGContextStrokeRect( c: CGContextRef; rect: CGRect ); external name '_CGContextStrokeRect'; { Stroke `rect' with the current stroke color, using `width' as the the * line width. } procedure CGContextStrokeRectWithWidth( c: CGContextRef; rect: CGRect; width: Float32 ); external name '_CGContextStrokeRectWithWidth'; { Clear `rect' (that is, set the region within the rect to * transparent). } procedure CGContextClearRect( c: CGContextRef; rect: CGRect ); external name '_CGContextClearRect'; { Fill an ellipse (an oval) inside `rect'. } procedure CGContextFillEllipseInRect( context: CGContextRef; rect: CGRect ); external name '_CGContextFillEllipseInRect'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) { Stroke an ellipse (an oval) inside `rect'. } procedure CGContextStrokeEllipseInRect( context: CGContextRef; rect: CGRect ); external name '_CGContextStrokeEllipseInRect'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) { Stroke a sequence of line segments one after another in `context'. The * line segments are specified by `points', an array of `count' CGPoints. * This function is equivalent to * CGContextBeginPath(context); * for (k = 0; k < count; k += 2) begin * CGContextMoveToPoint(context, s[k].x, s[k].y); * CGContextAddLineToPoint(context, s[k+1].x, s[k+1].y); * end; * CGContextStrokePath(context); } procedure CGContextStrokeLineSegments( c: CGContextRef; {const} points: {variable-size-array} CGPointPtr; count: size_t ); external name '_CGContextStrokeLineSegments'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) {* Clipping functions. *} { Intersect the context's path with the current clip path and use the * resulting path as the clip path for subsequent rendering operations. * Use the winding-number fill rule for deciding what's inside the path. } procedure CGContextClip( c: CGContextRef ); external name '_CGContextClip'; { Intersect the context's path with the current clip path and use the * resulting path as the clip path for subsequent rendering operations. * Use the even-odd fill rule for deciding what's inside the path. } procedure CGContextEOClip( c: CGContextRef ); external name '_CGContextEOClip'; { Add `mask' transformed to `rect' to the clipping area of `context'. The * mask, which may be either an image mask or an image, is mapped into the * specified rectangle and intersected with the current clipping area of * the context. * * If `mask' is an image mask, then it clips in a manner identical to the * behavior if it were used with "CGContextDrawImage": it indicates an area * to be masked out (left unchanged) when drawing. The source samples of * the image mask determine which points of the clipping area are changed, * acting as an "inverse alpha": if the value of a source sample in the * image mask is S, then the corresponding point in the current clipping * area will be multiplied by an alpha of (1-S). (For example, if S is 1, * then the point in the clipping area becomes clear, while if S is 0, the * point in the clipping area is unchanged. * * If `mask' is an image, then it serves as alpha mask and is blended with * the current clipping area. The source samples of mask determine which * points of the clipping area are changed: if the value of the source * sample in mask is S, then the corresponding point in the current * clipping area will be multiplied by an alpha of S. (For example, if S * is 0, then the point in the clipping area becomes clear, while if S is * 1, the point in the clipping area is unchanged. * * If `mask' is an image, then it must be in the DeviceGray color space, * may not have alpha, and may not be masked by an image mask or masking * color. } procedure CGContextClipToMask( c: CGContextRef; rect: CGRect; mask: CGImageRef ); external name '_CGContextClipToMask'; { Return the bounding box of the clip path of `c' in user space. The * bounding box is the smallest rectangle completely enclosing all points * in the clip. } function CGContextGetClipBoundingBox( c: CGContextRef ): CGRect; external name '_CGContextGetClipBoundingBox'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) {* Clipping convenience functions. *} { Intersect the current clipping path with `rect'. Note that this * function resets the context's path to the empty path. } procedure CGContextClipToRect( c: CGContextRef; rect: CGRect ); external name '_CGContextClipToRect'; { Intersect the current clipping path with the clipping region formed by * creating a path consisting of all rects in `rects'. Note that this * function resets the context's path to the empty path. } procedure CGContextClipToRects( c: CGContextRef; {const} rects: {variable-size-array} CGRectPtr; count: size_t ); external name '_CGContextClipToRects'; {* Primitive color functions. *} { Set the current fill color in the context `c' to `color'. } procedure CGContextSetFillColorWithColor( c: CGContextRef; color: CGColorRef ); external name '_CGContextSetFillColorWithColor'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) { Set the current stroke color in the context `c' to `color'. } procedure CGContextSetStrokeColorWithColor( c: CGContextRef; color: CGColorRef ); external name '_CGContextSetStrokeColorWithColor'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) {* Colorspace functions. *} { Set the current fill colorspace in the context `c' to `colorspace'. As * a side-effect, set the fill color to a default value appropriate for the * colorspace. } procedure CGContextSetFillColorSpace( c: CGContextRef; colorspace: CGColorSpaceRef ); external name '_CGContextSetFillColorSpace'; { Set the current stroke colorspace in the context `c' to `colorspace'. * As a side-effect, set the stroke color to a default value appropriate * for the colorspace. } procedure CGContextSetStrokeColorSpace( c: CGContextRef; colorspace: CGColorSpaceRef ); external name '_CGContextSetStrokeColorSpace'; {* Color functions. *} { Set the components of the current fill color in the context `c' to the * values specifed by `components'. The number of elements in `components' * must be one greater than the number of components in the current fill * colorspace (N color components + 1 alpha component). The current fill * colorspace must not be a pattern colorspace. } procedure CGContextSetFillColor( c: CGContextRef; {const} components: {variable-size-array} Float32Ptr ); external name '_CGContextSetFillColor'; { Set the components of the current stroke color in the context `c' to the * values specifed by `components'. The number of elements in `components' * must be one greater than the number of components in the current stroke * colorspace (N color components + 1 alpha component). The current stroke * colorspace must not be a pattern colorspace. } procedure CGContextSetStrokeColor( c: CGContextRef; {const} components: {variable-size-array} Float32Ptr ); external name '_CGContextSetStrokeColor'; {* Pattern functions. *} { Set the components of the current fill color in the context `c' to the * values specifed by `components', and set the current fill pattern to * `pattern'. The number of elements in `components' must be one greater * than the number of components in the current fill colorspace (N color * components + 1 alpha component). The current fill colorspace must be a * pattern colorspace. } procedure CGContextSetFillPattern( c: CGContextRef; pattern: CGPatternRef; {const} components: {variable-size-array} Float32Ptr ); external name '_CGContextSetFillPattern'; { Set the components of the current stroke color in the context `c' to the * values specifed by `components', and set the current stroke pattern to * `pattern'. The number of elements in `components' must be one greater * than the number of components in the current stroke colorspace (N color * components + 1 alpha component). The current stroke colorspace must be * a pattern colorspace. } procedure CGContextSetStrokePattern( c: CGContextRef; pattern: CGPatternRef; {const} components: {variable-size-array} Float32Ptr ); external name '_CGContextSetStrokePattern'; { Set the pattern phase in the current graphics state of the context `c' * to `phase'. } procedure CGContextSetPatternPhase( c: CGContextRef; phase: CGSize ); external name '_CGContextSetPatternPhase'; {* Color convenience functions. *} { Set the current fill colorspace in the context `c' to `DeviceGray' and * set the components of the current fill color to `(gray, alpha)'. } procedure CGContextSetGrayFillColor( c: CGContextRef; gray: Float32; alpha: Float32 ); external name '_CGContextSetGrayFillColor'; { Set the current stroke colorspace in the context `c' to `DeviceGray' and * set the components of the current stroke color to `(gray, alpha)'. } procedure CGContextSetGrayStrokeColor( c: CGContextRef; gray: Float32; alpha: Float32 ); external name '_CGContextSetGrayStrokeColor'; { Set the current fill colorspace in the context `c' to `DeviceRGB' and * set the components of the current fill color to `(red, green, blue, * alpha)'. } procedure CGContextSetRGBFillColor( c: CGContextRef; red: Float32; green: Float32; blue: Float32; alpha: Float32 ); external name '_CGContextSetRGBFillColor'; { Set the current stroke colorspace in the context `c' to `DeviceRGB' and * set the components of the current stroke color to `(red, green, blue, * alpha)'. } procedure CGContextSetRGBStrokeColor( c: CGContextRef; red: Float32; green: Float32; blue: Float32; alpha: Float32 ); external name '_CGContextSetRGBStrokeColor'; { Set the current fill colorspace in the context `c' to `DeviceCMYK' and * set the components of the current fill color to `(cyan, magenta, yellow, * black, alpha)'. } procedure CGContextSetCMYKFillColor( c: CGContextRef; cyan: Float32; magenta: Float32; yellow: Float32; black: Float32; alpha: Float32 ); external name '_CGContextSetCMYKFillColor'; { Set the current stroke colorspace in the context `c' to `DeviceCMYK' and * set the components of the current stroke color to `(cyan, magenta, * yellow, black, alpha)'. } procedure CGContextSetCMYKStrokeColor( c: CGContextRef; cyan: Float32; magenta: Float32; yellow: Float32; black: Float32; alpha: Float32 ); external name '_CGContextSetCMYKStrokeColor'; {* Rendering intent. *} { Set the rendering intent in the current graphics state of context `c' to * `intent'. } procedure CGContextSetRenderingIntent( c: CGContextRef; intent: CGColorRenderingIntent ); external name '_CGContextSetRenderingIntent'; {* Image functions. *} { Draw `image' in the rectangular area specified by `rect' in the context * `c'. The image is scaled, if necessary, to fit into `rect'. } procedure CGContextDrawImage( c: CGContextRef; rect: CGRect; image: CGImageRef ); external name '_CGContextDrawImage'; { Return the interpolation quality for image rendering of the context `c'. * The interpolation quality is a gstate-parameter which controls the level * of interpolation performed when an image is interpolated (for example, * when scaling the image). Note that it is merely a hint to the context: * not all contexts support all interpolation quality levels. } function CGContextGetInterpolationQuality( c: CGContextRef ): CGInterpolationQuality; external name '_CGContextGetInterpolationQuality'; { Set the interpolation quality of the context `c' to `quality'. } procedure CGContextSetInterpolationQuality( c: CGContextRef; quality: CGInterpolationQuality ); external name '_CGContextSetInterpolationQuality'; {* Shadow support. *} { Set the shadow parameters in `context'. `offset' specifies a * translation in base-space; `blur' is a non-negative number specifying * the amount of blur; `color' specifies the color of the shadow, which may * contain a non-opaque alpha value. If `color' is NULL, it's equivalent * to specifying a fully transparent color. The shadow is a gstate * parameter. After a shadow is specified, all objects drawn subsequently * will be shadowed. To turn off shadowing, set the shadow color to a * fully transparent color (or pass NULL as the color), or use the standard * gsave/grestore mechanism. } procedure CGContextSetShadowWithColor( context: CGContextRef; offset: CGSize; blur: Float32; color: CGColorRef ); external name '_CGContextSetShadowWithColor'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) { Equivalent to calling * CGContextSetShadowWithColor(context, offset, blur, color) * where color is black with 1/3 alpha (i.e., RGBA = (0, 0, 0, 1.0/3.0)) in * the DeviceRGB colorspace. } procedure CGContextSetShadow( context: CGContextRef; offset: CGSize; blur: Float32 ); external name '_CGContextSetShadow'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) {* Shading functions. *} { Fill the current clipping region of `c' with `shading'. } procedure CGContextDrawShading( c: CGContextRef; shading: CGShadingRef ); external name '_CGContextDrawShading'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *) {* Text functions. *} { Set the current character spacing in the context `c' to `spacing'. The * character spacing is added to the displacement between the origin of one * character and the origin of the next. } procedure CGContextSetCharacterSpacing( c: CGContextRef; spacing: Float32 ); external name '_CGContextSetCharacterSpacing'; { Set the user-space point at which text will be drawn in the context `c' * to `(x, y)'. } procedure CGContextSetTextPosition( c: CGContextRef; x: Float32; y: Float32 ); external name '_CGContextSetTextPosition'; { Return the user-space point at which text will be drawn in the context * `c'. } function CGContextGetTextPosition( c: CGContextRef ): CGPoint; external name '_CGContextGetTextPosition'; { Set the text matrix in the context `c' to `t'. } procedure CGContextSetTextMatrix( c: CGContextRef; t: CGAffineTransform ); external name '_CGContextSetTextMatrix'; { Return the text matrix in the context `c'. } function CGContextGetTextMatrix( c: CGContextRef ): CGAffineTransform; external name '_CGContextGetTextMatrix'; { Set the text drawing mode in the current graphics state of the context * `c' to `mode'. } procedure CGContextSetTextDrawingMode( c: CGContextRef; mode: CGTextDrawingMode ); external name '_CGContextSetTextDrawingMode'; { Set the font in the current graphics state of the context `c' to * `font'. } procedure CGContextSetFont( c: CGContextRef; font: CGFontRef ); external name '_CGContextSetFont'; { Set the font size in the current graphics state of the context `c' to * `size'. } procedure CGContextSetFontSize( c: CGContextRef; size: Float32 ); external name '_CGContextSetFontSize'; { Attempts to find the font named `name' and, if successful, sets it as * the font in the current graphics state of `c' and sets the font size in * the current graphics state to `size'. `textEncoding' specifies how to * translate from bytes to glyphs when displaying text. } procedure CGContextSelectFont( c: CGContextRef; name: ConstCStringPtr; size: Float32; textEncoding: CGTextEncoding ); external name '_CGContextSelectFont'; { Draw `string', a string of `length' bytes, at the point specified by the * text matrix in the context `c'. Each byte of the string is mapped * through the encoding vector of the current font to obtain the glyph to * display. } procedure CGContextShowText( c: CGContextRef; strng: ConstCStringPtr; length: size_t ); external name '_CGContextShowText'; { Draw the glyphs pointed to by `g', an array of `count' glyphs, at the * point specified by the text matrix in the context `c'. } procedure CGContextShowGlyphs( c: CGContextRef; {const} g: {variable-size-array} CGGlyphPtr; count: size_t ); external name '_CGContextShowGlyphs'; { Draw `glyphs', an array of `count' CGGlyphs, at the current point * specified by the text matrix. Each element of `advances' specifies the * offset from the previous glyph's origin to the origin of the associated * glyph; the advances are specified in user space. } procedure CGContextShowGlyphsWithAdvances( c: CGContextRef; {const} glyphs: {variable-size-array} CGGlyphPtr; {const} advances: {variable-size-array} CGSizePtr; count: size_t ); external name '_CGContextShowGlyphsWithAdvances'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) {* Text convenience functions. *} { Draw `string', a string of `length' bytes, at the point `(x, y)', * specified in user space, in the context `c'. Each byte of the string is * mapped through the encoding vector of the current font to obtain the * glyph to display. } procedure CGContextShowTextAtPoint( c: CGContextRef; x: Float32; y: Float32; strng: ConstCStringPtr; length: size_t ); external name '_CGContextShowTextAtPoint'; { Display the glyphs pointed to by `glyphs', an array of `count' glyphs, * at at the point `(x, y)', specified in user space, in the context * `c'. } procedure CGContextShowGlyphsAtPoint( c: CGContextRef; x: Float32; y: Float32; {const} glyphs: {variable-size-array} CGGlyphPtr; count: size_t ); external name '_CGContextShowGlyphsAtPoint'; {* PDF functions. *} { Draw `page' in the current user space of the context `c'. } procedure CGContextDrawPDFPage( c: CGContextRef; page: CGPDFPageRef ); external name '_CGContextDrawPDFPage'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) { DEPRECATED; use the CGPDFPage API instead. * Draw `page' in `document' in the rectangular area specified by `rect' in * the context `c'. The media box of the page is scaled, if necessary, to * fit into `rect'. } procedure CGContextDrawPDFDocument( c: CGContextRef; rect: CGRect; document: CGPDFDocumentRef; page: SInt32 ); external name '_CGContextDrawPDFDocument'; {* Output page functions. *} { Begin a new page. } procedure CGContextBeginPage( c: CGContextRef; const (*var*) mediaBox: CGRect ); external name '_CGContextBeginPage'; { End the current page. } procedure CGContextEndPage( c: CGContextRef ); external name '_CGContextEndPage'; {* Context functions. *} { Equivalent to `CFRetain(c)'. } function CGContextRetain( c: CGContextRef ): CGContextRef; external name '_CGContextRetain'; { Equivalent to `CFRelease(c)'. } procedure CGContextRelease( c: CGContextRef ); external name '_CGContextRelease'; { Flush all drawing to the destination. } procedure CGContextFlush( c: CGContextRef ); external name '_CGContextFlush'; { Synchronized drawing. } procedure CGContextSynchronize( c: CGContextRef ); external name '_CGContextSynchronize'; {* Antialiasing functions. *} { Turn on antialiasing if `shouldAntialias' is true; turn it off * otherwise. This parameter is part of the graphics state. } procedure CGContextSetShouldAntialias( c: CGContextRef; shouldAntialias: CBool ); external name '_CGContextSetShouldAntialias'; { Allow antialiasing in context `c' if `allowsAntialiasing' is true; don't * allow it otherwise. This parameter is not part of the graphics state. A * context will perform antialiasing if both `allowsAntialiasing' and the * graphics state parameter `shouldAntialias' are true. } procedure CGContextSetAllowsAntialiasing( context: CGContextRef; allowsAntialiasing: CBool ); external name '_CGContextSetAllowsAntialiasing'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) {* Font smoothing functions. *} { Turn on font smoothing if `shouldSmoothFonts' is true; turn it off * otherwise. This parameter is part of the graphics state. Note that this * doesn't guarantee that font smoothing will occur: not all destination * contexts support font smoothing. } procedure CGContextSetShouldSmoothFonts( c: CGContextRef; shouldSmoothFonts: CBool ); external name '_CGContextSetShouldSmoothFonts'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *) {* Transparency layer support. *} { Begin a transparency layer. All subsequent drawing operations until a * corresponding CGContextEndTransparencyLayer are composited into a fully * transparent backdrop (which is treated as a separate destination buffer * from the context); after a call to CGContextEndTransparencyLayer, the * result is composited into the context using the global alpha and shadow * state of the context. This operation respects the clipping region of * the context. After a call to this function, all of the parameters in * the graphics state remain unchanged with the exception of the following: * The global alpha is set to 1. * The shadow is turned off. * Ending the transparency layer restores these parameters to the values * they had before CGContextBeginTransparencyLayer was called. * Transparency layers may be nested. } procedure CGContextBeginTransparencyLayer( context: CGContextRef; auxiliaryInfo: CFDictionaryRef ); external name '_CGContextBeginTransparencyLayer'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) { End a tranparency layer. } procedure CGContextEndTransparencyLayer( context: CGContextRef ); external name '_CGContextEndTransparencyLayer'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) {* User space to device space tranformations. *} { Return the affine transform mapping the user space (abstract * coordinates) of `context' to device space (pixels). } function CGContextGetUserSpaceToDeviceSpaceTransform( c: CGContextRef ): CGAffineTransform; external name '_CGContextGetUserSpaceToDeviceSpaceTransform'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) { Transform `point' from the user space of `context' to device space. } function CGContextConvertPointToDeviceSpace( c: CGContextRef; point: CGPoint ): CGPoint; external name '_CGContextConvertPointToDeviceSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) { Transform `point' from device space to the user space of `context'. } function CGContextConvertPointToUserSpace( c: CGContextRef; point: CGPoint ): CGPoint; external name '_CGContextConvertPointToUserSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) { Transform `size' from the user space of `context' to device space. } function CGContextConvertSizeToDeviceSpace( c: CGContextRef; size: CGSize ): CGSize; external name '_CGContextConvertSizeToDeviceSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) { Transform `size' from device space to the user space of `context'. } function CGContextConvertSizeToUserSpace( c: CGContextRef; size: CGSize ): CGSize; external name '_CGContextConvertSizeToUserSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) { Transform `rect' from the user space of `context' to device space. Since * affine transforms do not preserve rectangles in general, this function * returns the smallest rectangle which contains the transformed corner * points of `rect'. } function CGContextConvertRectToDeviceSpace( c: CGContextRef; rect: CGRect ): CGRect; external name '_CGContextConvertRectToDeviceSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) { Transform `rect' from device space to the user space of `context'. Since * affine transforms do not preserve rectangles in general, this function * returns the smallest rectangle which contains the transformed corner * points of `rect'. } function CGContextConvertRectToUserSpace( c: CGContextRef; rect: CGRect ): CGRect; external name '_CGContextConvertRectToUserSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) end.
{ GDAX/Coinbase-Pro client library Copyright (c) 2018 mr-highball Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. } unit gdax.api.book; {$i gdax.inc} interface uses Classes, SysUtils, gdax.api, gdax.api.consts, gdax.api.types; type TGDAXBookImpl = class(TGDAXRestApi,IGDAXBook) private FAskList: TGDAXBookEntryList; FBidList: TGDAXBookEntryList; FLevel: TGDAXBookLevel; FProduct: IGDAXProduct; FMarketType: TMarketType; FAskSize: Single; FBidSize: Single; protected function GetLevel: TGDAXBookLevel; procedure SetLevel(Const Value: TGDAXBookLevel); function GetProduct: IGDAXProduct; procedure SetProduct(Const Value: IGDAXProduct); function GetAskList: TGDAXBookEntryList; function GetBidList: TGDAXBookEntryList; procedure ClearMetaData; function GetMarketType: TMarketType; function GetAskSize: Single; function GetBidSize: Single; protected function DoLoadFromJSON(Const AJSON: string; out Error: string): Boolean; override; function GetEndpoint(Const AOperation: TRestOperation): string; override; function DoGet(Const AEndpoint: string; Const AHeaders: TStrings; out Content: string; out Error: string): Boolean; override; function DoGetSupportedOperations: TRestOperations; override; public property Level: TGDAXBookLevel read GetLevel write SetLevel; property Product: IGDAXProduct read GetProduct write SetProduct; property AskList: TGDAXBookEntryList read GetAskList; property BidList: TGDAXBookEntryList read GetBidList; property MarketType: TMarketType read GetMarketType; property AskSize: Single read GetAskSize; property BidSize: Single read GetBidSize; constructor Create; override; destructor Destroy; override; end; implementation uses fpjson, jsonparser; { TGDAXBookImpl } procedure TGDAXBookImpl.ClearMetaData; begin FAskList.Clear; FBidList.Clear; FMarketType := mtUnknown; FBidSize:=0; FAskSize:=0; end; constructor TGDAXBookImpl.Create; begin inherited; FAskList := TGDAXBookEntryList.Create; FBidList := TGDAXBookEntryList.Create; FLevel := blOne; end; destructor TGDAXBookImpl.Destroy; begin FAskList.Free; FBidList.Free; inherited; end; function TGDAXBookImpl.DoGet(Const AEndpoint: string; Const AHeaders: TStrings; out Content, Error: string): Boolean; begin Result := False; if not Assigned(FProduct) then begin Error := Format(E_UNKNOWN,['OrderProduct',Self.ClassName]); Exit; end; Result := inherited; end; function TGDAXBookImpl.DoGetSupportedOperations: TRestOperations; begin Result:=[roGet]; end; function TGDAXBookImpl.DoLoadFromJSON(Const AJSON: string; out Error: string): Boolean; var LJSON : TJSONObject; LAsks, LBids : TJSONArray; LEntry:TBookEntry; I: Integer; const ENTRY_ASK='asks'; ENTRY_BID='bids'; PR_IX = 0; SZ_IX = 1; OTHER_IX = 2; begin Result := False; try LEntry := nil; FAskList.Clear; FBidList.Clear; ClearMetaData; LJSON := TJSONObject(GetJSON(AJSON)); if not Assigned(LJSON) then raise Exception.Create(E_BADJSON); try if LJSON.Find(ENTRY_BID) = nil then begin Error := Format(E_BADJSON_PROP,[ENTRY_BID]); Exit; end; if LJSON.Find(ENTRY_ASK) = nil then begin Error := Format(E_BADJSON_PROP,[ENTRY_ASK]); Exit; end; LBids := LJSON.Arrays[ENTRY_BID]; LAsks := LJSON.Arrays[ENTRY_ASK]; //fill out book for bids for I:=0 to Pred(LBids.Count) do begin case FLevel of blOne,blTwo: begin LEntry := TAggregatedEntry.create( TJSONArray(LBids.Items[I]).Items[PR_IX].AsFloat, TJSONArray(LBids.Items[I]).Items[SZ_IX].AsFloat, TJSONArray(LBids.Items[I]).Items[OTHER_IX].AsInt64 ); FBidList.Add(LEntry); end; blThree: begin LEntry := TFullEntry.create( TJSONArray(LBids.Items[I]).Items[PR_IX].AsFloat, TJSONArray(LBids.Items[I]).Items[SZ_IX].AsFloat, TJSONArray(LBids.Items[I]).Items[OTHER_IX].AsString ); FBidList.Add(LEntry); end; end; LEntry.Side := osBuy; FBidSize := FBidSize+LEntry.Size; end; //fill out book for asks for I:=0 to Pred(LAsks.Count) do begin case FLevel of blOne,blTwo: begin LEntry := TAggregatedEntry.create( TJSONArray(LAsks.Items[I]).Items[PR_IX].AsFloat, TJSONArray(LAsks.Items[I]).Items[SZ_IX].AsFloat, TJSONArray(LAsks.Items[I]).Items[OTHER_IX].AsInt64 ); FAskList.Add(LEntry); end; blThree: begin LEntry := TFullEntry.create( TJSONArray(LAsks.Items[I]).Items[PR_IX].AsFloat, TJSONArray(LAsks.Items[I]).Items[SZ_IX].AsFloat, TJSONArray(LAsks.Items[I]).Items[OTHER_IX].AsString ); FAskList.Add(LEntry); end; end; LEntry.Side := osSell; FAskSize := FAskSize+LEntry.Size; end; //more buying than selling means its a sellers market if FBidSize > FAskSize then FMarketType := mtSellers else if FBidSize < FAskSize then FMarketType := mtBuyers else FMarketType := mtUnknown; Result := True; finally LJSON.Free; end; except on E: Exception do Error := E.Message; end; end; function TGDAXBookImpl.GetAskList: TGDAXBookEntryList; begin Result := FAskList; end; function TGDAXBookImpl.GetAskSize: Single; begin Result := FAskSize; end; function TGDAXBookImpl.GetBidList: TGDAXBookEntryList; begin Result := FBidList; end; function TGDAXBookImpl.GetBidSize: Single; begin Result := FBidSize; end; function TGDAXBookImpl.GetEndpoint(Const AOperation: TRestOperation): string; begin if AOperation=roGet then Result := Format(GDAX_END_API_BOOK,[FProduct.ID,Ord(FLevel)]); end; function TGDAXBookImpl.GetLevel: TGDAXBookLevel; begin Result := FLevel; end; function TGDAXBookImpl.GetMarketType: TMarketType; begin Result := FMarketType; end; function TGDAXBookImpl.GetProduct: IGDAXProduct; begin Result := FProduct; end; procedure TGDAXBookImpl.SetLevel(Const Value: TGDAXBookLevel); begin ClearMetaData; FLevel := Value; end; procedure TGDAXBookImpl.SetProduct(Const Value: IGDAXProduct); begin ClearMetaData; FProduct := Value; end; end.
unit mp_utils; {$mode objfpc}{$H+} interface uses SysUtils; type {IP Address record} TIPAdresse = record { IP address bytes} Oct1, Oct2, Oct3, Oct4:Byte; end; { -- Converts string to IP address record} function StrToIP(const Value:String):TIPAdresse; { -- Converts IP Address record to string} function IPToStr(const Adresse:TIPAdresse):String; { -- Converts IP Address record to Cardnal} function IPToCardinal(const Adresse:TIPAdresse):Cardinal; { -- Converts cardianl to IP Address record} function CardinalToIP(const Value:Cardinal):TIPAdresse; { -- Returns @True if @bold(Value) string is IP address } function IsIPAdress(const Value:String):Boolean; function Eq(aValue1, aValue2: string): boolean; implementation function IPToCardinal(const Adresse:TIPAdresse):Cardinal; begin Result := (Adresse.Oct1*16777216) +(Adresse.Oct2*65536) +(Adresse.Oct3*256) +(Adresse.Oct4); end; function CardinalToIP(const Value:Cardinal):TIPAdresse; begin Result.Oct1 := Value div 16777216; Result.Oct2 := Value div 65536; Result.Oct3 := Value div 256; Result.Oct4 := Value mod 256; end; function IPToStr(const Adresse:TIPAdresse):String; begin Result := IntToStr(Adresse.Oct1) + '.' + IntToStr(Adresse.Oct2) + '.' + IntToStr(Adresse.Oct3) + '.' + IntToStr(Adresse.Oct4); end; function StrToIP(const Value:String):TIPAdresse; var n,x: Integer; Posi:Array[1..4]of Integer; Oktet:Array[1..4]of String; begin x := 0; for n := 1 to Length(Value) do begin if Value[n] = '.' then begin Inc(x); Posi[x] := n; end else Oktet[x+1] := Oktet[x+1] + Value[n]; end; Result.Oct1 := StrToInt(Oktet[1]); Result.Oct2 := StrToInt(Oktet[2]); Result.Oct3 := StrToInt(Oktet[3]); Result.Oct4 := StrToInt(Oktet[4]); end; function IsIPAdress(const Value:String):Boolean; var n,x,i: Integer; Posi:Array[1..4]of Integer; Oktet:Array[1..4]of String; begin Result := true; x := 0; for n := 1 to Length(Value) do if not (Value[n] in ['0'..'9','.']) then begin Result := false; break; end else begin if Value[n] = '.' then begin Inc(x); Posi[x] := n; end else begin Oktet[x+1] := Oktet[x+1] + Value[n]; end; end; for i := 1 to 4 do if (StrToInt(Oktet[i])>255)then Result := false; if x <> 3 then begin Result := false; end; end; function Eq(aValue1, aValue2: string): boolean; //-------------------------------------------------------- begin Result := AnsiCompareText(Trim(aValue1),Trim(aValue2))=0; end; end.
Program Aufgabe8; {$codepage utf8} Var Zahl: Integer; Fakultaet: Integer = 1; I: Integer; Begin Write('Bitte gib deine Zahl ein: '); Read(Zahl); If Zahl < 0 Then WriteLn('Die Fakultät von negativen Zahlen ist nicht definiert!') Else If Zahl = 0 Then Begin WriteLn('Eigentlich ist 0! = 1, aber laut Aufgabenstellung soll es'); WriteLn('eine Fehlermeldung geben. Also: Böse böse!'); End Else Begin For I := 1 To Zahl Do Fakultaet *= I; WriteLn('Die Fakultät von ', Zahl, ' ist ', Fakultaet, '.'); End End.
unit sdBessel; {Double precision special functions: Bessel functions and related} interface {$i std.inc} {$ifdef BIT16} {$N+} {$endif} {$ifdef NOBASM} {$undef BASM} {$endif} (************************************************************************* DESCRIPTION : Double precision Bessel functions and related REQUIREMENTS : BP7, D1-D7/D9-D10/D12/D17-D18, FPC, VP, WDOSX EXTERNAL DATA : --- MEMORY USAGE : --- DISPLAY MODE : --- REMARK : --- REFERENCES : References used in this unit, main index in damath_info.txt/references [1] [HMF]: M. Abramowitz, I.A. Stegun. Handbook of Mathematical Functions, New York, 1970 http://www.math.sfu.ca/~cbm/aands/ [7] Cephes Mathematical Library, Version 2.8 http://www.moshier.net/#Cephes or http://www.netlib.org/cephes/ [13] [NR]: W.H. Press et al, Numerical Recipes in C, 2nd ed., Cambridge, 1992, http://www.nrbook.com/a/bookcpdf.html [14] SLATEC Common Mathematical Library, Version 4.1, July 1993 (general purpose mathematical and statistical routines written in Fortran 77) http://www.netlib.org/slatec [19] Boost C++ Libraries, Release 1.42.0, 2010. http://www.boost.org/ [20] Special functions by Wayne Fullerton, http://www.netlib.org/fn Almost identical to the FNLIB subset of SLATEC [14] [22] A.J. MacLeod, MISCFUN: A software package to compute uncommon special functions. ACM Trans. on Math. Soft. 22 (1996), pp.288-301. Fortran source: http://netlib.org/toms/757 [30] [NIST]: F.W.J. Olver, D.W. Lozier, R.F. Boisvert, C.W. Clark, NIST Handbook of Mathematical Functions, Cambridge, 2010. Online resource: NIST Digital Library of Mathematical Functions, http://dlmf.nist.gov/ [51] N.M. Temme, On the Numerical Evaluation of the Ordinary Bessel Function of the Second Kind. J. Comput. Phys., 21(3): 343-350 (1976), section 2. Available as http://oai.cwi.nl/oai/asset/10710/10710A.pdf [52] N.M. Temme, On the Numerical Evaluation of the Modified Bessel Function of the Third Kind, 2nd edition. Preprint, available as http://oai.cwi.nl/oai/asset/7885/7885A.pdf Version Date Author Modification ------- -------- ------- ------------------------------------------ 1.00.00 12.02.13 W.Ehrhardt Initial BP7 version from AMath.sfbessel 1.00.01 12.02.13 we Constant IvMaxX in sfd_iv 1.00.02 12.02.13 we sfd_i0 1.00.03 12.02.13 we sfd_j0, sfd_y0, bess_m0p0 1.00.04 13.02.13 we sfd_j1, sfd_y1, bess_m1p1 1.00.05 13.02.13 we sfd_in 1.00.06 13.02.13 we fix two near overflow cases in bessel_jy 1.00.07 14.02.13 we Airy functions 1.00.08 14.02.13 we Kelvin functions 1.00.09 14.02.13 we Struve functions 1.00.10 01.03.13 we Chebyshev degrees reduced in bess_??_small, sfd_??e, ker_kei_med 1.00.11 02.02.13 we Fixed value of IvMaxX in sfd_iv 1.03.00 09.05.13 we Airy/Scorer functions sfd_airy_gi/hi 1.04.00 15.06.13 we Fix typo in h1v_large 1.04.01 15.06.13 we sfd_bess_kv2 1.04.02 28.06.13 we Check overflow / return INF in bessel_jy 1.06.00 25.09.13 we use const one_d 1.09.00 28.03.14 we sfd_yn with LnPi from DAMath 1.13.00 11.08.14 we Iv := PosInf_d if Kv,Kv1=0 in bessel_ik or if x >= IvMaxX in sfd_iv 1.18.00 10.06.15 we new IJ_series replaces Jv_series 1.18.01 10.06.15 we rewrite of sfc_in: use IJ_series and CF1_I 1.18.02 10.06.15 we improved bess_m0p0/bess_m1p1 with rem_2pi_sym and Kahan summation 1.18.03 10.06.15 we sfd_struve_l/h, sfd_struve_l0/1 use sfd_struve_l 1.18.04 14.06.15 we sfd_struve_h/l with real v >= 0 1.18.05 19.06.15 we scaled Airy functions sfd_airy_ais, sfd_airy_bis ***************************************************************************) (*------------------------------------------------------------------------- (C) Copyright 2009-2015 Wolfgang Ehrhardt This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. ----------------------------------------------------------------------------*) (*------------------------------------------------------------------------- This Pascal code uses material and ideas from open source and public domain libraries, see the file '3rdparty.ama' for the licenses. ---------------------------------------------------------------------------*) function sfd_i0(x: double): double; {-Return I0(x), the modified Bessel function of the 1st kind, order zero} function sfd_i0e(x: double): double; {-Return I0(x)*exp(-|x|), the exponentially scaled modified Bessel function of the 1st kind, order zero} function sfd_i1(x: double): double; {-Return I1(x), the modified Bessel function of the 1st kind, order one} function sfd_i1e(x: double): double; {-Return I1(x)*exp(-|x|), the exponentially scaled modified Bessel function of the 1st kind, order one} function sfd_in(n: integer; x: double): double; {-Return I_n(x), the modified Bessel function of the 1st kind, order n.} function sfd_j0(x: double): double; {-Return J0(x), the Bessel function of the 1st kind, order zero} function sfd_j1(x: double): double; {-Return J1(x), the Bessel function of the 1st kind, order one} function sfd_jn(n: integer; x: double): double; {-Return J_n(x), the Bessel function of the 1st kind, order n; not suitable for large n or x.} function sfd_k0(x: double): double; {-Return K0(x), the modified Bessel function of the 2nd kind, order zero, x>0} function sfd_k0e(x: double): double; {-Return K0(x)*exp(x), the exponentially scaled modified Bessel function of the 2nd kind, order zero, x>0} function sfd_k1(x: double): double; {-Return K1(x), the modified Bessel function of the 2nd kind, order one, x>0} function sfd_k1e(x: double): double; {-Return K1(x)*exp(x), the exponentially scaled modified Bessel function of the 2nd kind, order one, x>0} function sfd_kn(n: integer; x: double): double; {-Return K_n(x), the modified Bessel function of the 2nd kind, order n, x>0, not suitable for large n} function sfd_y0(x: double): double; {-Return Y0(x), the Bessel function of the 2nd kind, order zero; x>0} function sfd_y1(x: double): double; {-Return Y1(x), the Bessel function of the 2nd kind, order one; x>0} function sfd_yn(n: integer; x: double): double; {-Return Y_n(x), the Bessel function of the 2nd kind, order n, x>0, not suitable for large n or x} function sfd_jv(v, x: double): double; {-Return J_v(x), the Bessel function of the 1st kind, order v; not suitable for large v.} function sfd_yv(v, x: double): double; {-Return Y_v(x), the Bessel function of the 2nd kind, order v; x > 0; not suitable for large v.} function sfd_iv(v, x: double): double; {-Return I_v(x), the modified Bessel function of the 1st kind, order v.} function sfd_kv(v, x: double): double; {-Return K_v(x), the modified Bessel function of the 2nd kind, order v, x>0} function sfd_ive(v, x: double): double; {-Return I_v(x)*exp(-|x|), the exponentially scaled modified Bessel function of the 1st kind, order v.} function sfd_kve(v, x: double): double; {-Return K_v(x)*exp(x), the exponentially scaled modified Bessel function of the 2nd kind, order v, x>0} procedure sfd_bess_ikv(v,x: double; var Iv,Kv: double); {-Return I_v(x) and K_v(x), no checks, x>0, |v| < MaxLongint} procedure sfd_bess_jyv(v,x: double; var Jv,Yv: double); {-Return J_v(x) and Y_v(x), no checks, x>0, |v| < MaxLongint} procedure sfd_bess_kv2(v,x: double; var Kv, Kv1: double); {-Return K(v,x) and K(v+1,x), no checks, x>0, |v| < MaxLongint} function sfd_sph_jn(n: integer; x: double): double; {-Return j_n(x), the spherical Bessel function of the 1st kind, order n} function sfd_sph_yn(n: integer; x: double): double; {-Return y_n(x), the spherical Bessel function of the 2nd kind, order n >=0 , x<>0} function sfd_sph_in(n: integer; x: double): double; {-Return i_n(x), the modified spherical Bessel function of the 1st/2nd kind, order n} function sfd_sph_ine(n: integer; x: double): double; {-Return i_n(x)*exp(-|x|), the exponentially scaled modified spherical Bessel function of the 1st/2nd kind, order n} function sfd_sph_kn(n: integer; x: double): double; {-Return k_n(x), the modified spherical Bessel function of the 3rd kind, order n, x>0} function sfd_sph_kne(n: integer; x: double): double; {-Return k_n(x)*exp(x), the exponentially scaled modified spherical Bessel function of the 3rd kind, order n, x>0} function sfd_airy_ai(x: double): double; {-Return the Airy function Ai(x)} function sfd_airy_aip(x: double): double; {-Return the Airy function Ai'(x)} function sfd_airy_ais(x: double): double; {-Return the scaled Airy function Ai(x) if x <= 0, Ai(x)*exp(2/3*x^1.5) for x > 0} function sfd_airy_bi(x: double): double; {-Return the Airy function Bi(x)} function sfd_airy_bip(x: double): double; {-Return the Airy function Bi'(x)} function sfd_airy_bis(x: double): double; {-Return the scaled Airy function Bi(x) if x <= 0, Bi(x)*exp(-2/3*x^1.5) for x > 0} function sfd_airy_gi(x: double): double; {-Return the Airy/Scorer function Gi(x) = 1/Pi*integral(sin(x*t+t^3/3), t=0..INF)} function sfd_airy_hi(x: double): double; {-Return the Airy/Scorer function Hi(x) = 1/Pi*integral(exp(x*t-t^3/3), t=0..INF)} function sfd_ber(x: double): double; {-Return the Kelvin function ber(x)} function sfd_bei(x: double): double; {-Return the Kelvin function bei(x)} function sfd_ker(x: double): double; {-Return the Kelvin function ker(x), x > 0} function sfd_kei(x: double): double; {-Return the Kelvin function kei(x), x >= 0} procedure sfd_ker_kei(x: double; var kr, ki: double); {-Return the Kelvin functions kr=ker(x), ki=kei(x), x > 0} procedure sfd_ber_bei(x: double; var br, bi: double); {-Return the Kelvin functions br=ber(x), bi=bei(x)} function sfd_struve_h0(x: double): double; {-Return H0(x), the Struve function of order 0} function sfd_struve_h1(x: double): double; {-Return H1(x), the Struve function of order 1} function sfd_struve_h(v,x: double): double; {-Return H_v(x), the Struve function of order v >= 0, x < 0 only if v is an integer.} function sfd_struve_l0(x: double): double; {-Return L0(x), the modified Struve function of order 0} function sfd_struve_l1(x: double): double; {-Return L1(x), the modified Struve function of order 1} function sfd_struve_l(v, x: double): double; {-Return L_v(x), the modified Struve function of order v >= 0, x < 0 only if v is an integer.} implementation uses DAMath, sdBasic, {Basic common code} sdGamma; {Gamma function and related} {---------------------------------------------------------------------------} function IJ_series(v,x: double; CalcJv: boolean): double; {-Power series for Bessel J_v(x), 0 <= v < MAXGAMD-1, |x|<1 or v > x^2/4} var f,s,t: double; n: integer; begin f := 0.5*x; t := power(f,v)/sfd_gamma(v+1.0); if CalcJv then f := -f*f else f := f*f; s := t; n := 0; repeat inc(n); t := t*f/n/(v+n); s := s + t; until abs(t) <= 0.5*eps_d*abs(s); IJ_series := s; end; {---------------------------------------------------------------------------} procedure CF1_j(v,x: double; var fv: double; var s: integer); {-Return J_(v+1)(x) / J_v(x), efficient only if |x| <= |v|} var c,d,f,b,t,tiny,tol: double; k: longint; const MAXIT = longint(32000)*100; {see note below} begin s := 1; {Evaluate HMF [1], 9.1.73 using modified Lentz's method. s keeps track } {of sign changes in the denominator. Ref: NR [13] (6.7.2) and p. 244, } {function bessjy and Boost [19] file bessel_jy.hpp, function CF1_jy. } {Note that CF1_j needs about O(|x|) iterations if |x| > |v|. But unless} {there is a better implementation below the asymptotic range, CF1_j is} {is used in the last resort branch of bessel_jy. If a better algorithm } {(like Olver/Temme uniform Airy type asymptotic expansion) is available} {the factor 100 in the MAXIT declaration should be removed.} tol := 2.0*eps_d; tiny := Sqrt_MinDbl; c := tiny; f := tiny; d := 0.0; for k:=1 to MAXIT do begin b := 2.0*(v + k)/x; c := b - 1.0/c; d := b - d; if c=0.0 then c := tiny; if d=0.0 then d := tiny; d := 1.0/d; t := c * d; f := f*t; if d<0 then s := -s; if abs(t-1.0) < tol then begin fv := -f; exit; end; end; {No convergence} if RTE_NoConvergence>0 then RunError(byte(RTE_NoConvergence)); fv := -f; end; {---------------------------------------------------------------------------} procedure CF1_I(v,x: double; var fv: double); {-Return I_(v+1)(x) / I_v(x), use only if |x| <= |v|} var c,d,f,b,t,tiny,tol: double; k: integer; const MAXIT = 30000; begin {Evaluate NIST[30], 10.33.1 using modified Lentz's method.} {Ref: NR [13] (6.7.21) and p.248, function bessik } {and Boost [19] file bessel_ik.hpp, function CF1_Ik } {If |x| <= |v|, CF1_I converges rapidly but if |x| > |v| } {then CF1_I needs O(|x|) iterations to converge! } tol := 2.0*eps_d; tiny := Sqrt_MinDbl; c := tiny; f := tiny; d := 0.0; for k:=1 to MAXIT do begin b := 2.0*(v + k)/x; c := b + 1.0/c; d := b + d; if c=0.0 then c := tiny; if d=0.0 then d := tiny; d := 1.0/d; t := c * d; f := f*t; if abs(t-1.0) < tol then begin fv := f; exit; end; end; {No convergence} if RTE_NoConvergence>0 then RunError(byte(RTE_NoConvergence)); fv := f; end; {---------------------------------------------------------------------------} procedure h1v_large(v, x: double; var mv,tmx: double); {-Return modulus and (phase - x) of the Hankel function H1_v(x), x > 0 large} var s,m,m2,y: double; const c56 = 5.0/6.0; begin {Modulus Mv: asymptotic expansion from HMF[1] 9.2.28} y := sqr(0.5/x); m := 4.0*sqr(v); m2 := sqr(m); s := 1.0 + 0.5*y*(m-1.0)*(1.0 + 0.75*y*(m-9.0)*(1.0 + c56*y*(m-25.0))); mv := sqrt(2.0*s/(Pi*x)); {Phase theta_v - x: asymptotic expansion from HMF[1] 9.2.29} y := 0.25*y; s := (5.0*m*m2 - 1535.0*m2 + 54703.0*m - 375733.0)/14.0; s := s*y + (m2 - 114.0*m + 1073)/5.0; s := s*y + (m-25.0)/6.0; tmx:= (m-1.0)*(s*y + 0.5)/(4.0*x) - Pi*(0.5*v+0.25) end; {---------------------------------------------------------------------------} function bessj_large(v, x: double): double; {-Return J_v(x) via modulus/phase asymptotic expansion, x large} var mv,tv,st,ct,sx,cx: double; begin h1v_large(v,x,mv,tv); sincos(tv,st,ct); sincos(x,sx,cx); {J_v := mv*cos(x+tv); cos(x+tv) = cos(x)cos(tv) - sin(x)sin(tv)} bessj_large := mv*(cx*ct - sx*st); end; {---------------------------------------------------------------------------} function bessy_large(v, x: double): double; {-Return Y_v(x) via modulus/phase asymptotic expansion, x large} var mv,tv,st,ct,sx,cx: double; begin h1v_large(v,x,mv,tv); sincos(tv,st,ct); sincos(x,sx,cx); {Y_v := mv*sin(x+tv); sin(x+tv) = cos(x)sin(tv) + sin(x)cos(tv)} bessy_large := mv*(st*cx + ct*sx); end; {---------------------------------------------------------------------------} procedure bess_m0p0(x: double; var m0,p0: double); {-Modulus and phase for J0(x) and Y0(x), x >= 9.0} var y,z,s: double; const m0nhex: array[0..7] of THexDblW = ( ($6E79,$0EA9,$5470,$3F81), { 8.461833426898867839659E-3} ($98CD,$B6E9,$2244,$3FB7), { 9.036664453160200052296E-2} ($9C1A,$F42E,$EBCC,$3FE6), { 7.162842530423205720962E-1} ($CBD6,$4E89,$BD84,$4006), { 2.842537511425216145635E0 } ($75EC,$377C,$812B,$401E), { 7.626141421290849630523E0 } ($CE76,$CA24,$6D69,$4024), { 1.021369773577974343844E1 } ($CC67,$7234,$756F,$401B), { 6.864682945702134624126E0 } ($AA51,$471E,$43A7,$3FD9)); { 3.947542376069224461532E-1} m0dhex: array[0..7] of THexDblW = ( ($7011,$07C3,$B840,$3F85), { 1.060533546154121770442E-2} ($39BE,$7586,$FE76,$3FBC), { 1.132577931332212304986E-1} ($1BB0,$9BF7,$BFA0,$3FEC), { 8.983920141407590632423E-1} ($6F2F,$B383,$8EAF,$400C), { 3.569671060989910901903E0 } ($0EB7,$7806,$39DB,$4023), { 9.613002539386213788182E0 } ($BE8C,$0916,$0653,$402A), { 1.301235226061478261481E1 } ($A549,$7F67,$3BFE,$4022), { 9.117176038171821115904E0 } ($0000,$0000,$0000,$3FF0)); { 1.000000000000000000000E0 } p0nhex: array[0..5] of THexDblW = ( ($BB0A,$3865,$CBAF,$BE9C), {-4.290885090773112963542E-7} ($4BDC,$75E6,$A6B1,$BF13), {-7.496317036829964150970E-5} ($0CDD,$B531,$6124,$BF70), {-3.998893155826990642730E-3} ($9CF2,$7AB0,$CEBB,$BFB3), {-7.737323518141516881715E-2} ($9B44,$ED20,$0156,$BFE0), {-5.001635199922493694706E-1} ($54CA,$BA42,$8AA9,$BFE7)); {-7.356766355393571519038E-1} p0dhex: array[0..6] of THexDblW = ( ($BB0A,$3865,$CBAF,$3ECC), { 3.432708072618490390095E-6} ($00D6,$E129,$B5B0,$3F43), { 6.014932317342190404134E-4} ($9907,$73FF,$8973,$3FA0), { 3.229866782185025048457E-2} ($52AE,$B8C5,$50A5,$3FE4), { 6.348446472935245102890E-1} ($F0E9,$63E7,$23E2,$4011), { 4.285043297797736118069E0 } ($54BE,$CA56,$82EC,$401D), { 7.377856408614376072745E0 } ($0000,$0000,$0000,$3FF0)); { 1.000000000000000000000E0 } var m0n: array[0..7] of double absolute m0nhex; m0d: array[0..7] of double absolute m0dhex; p0n: array[0..5] of double absolute p0nhex; p0d: array[0..6] of double absolute p0dhex; begin {Ref: Cephes [7], file ldouble\j0l.c} {See also HMF[1], sections 9.2.17 .. 9.2.31} {Calculate the modulus m0(x) = sqrt(J0(x)^2 + Y0(x)^2) and the} {phase p0(x) = arctan(Y0(x)/J0(x)) with rational approximations} {For x>=9: J0(x) = m0(x)*cos(p0(x)) and Y0(x) = m0(x)*sin(p0(x))} z := sqr(1.0/x); y := abs(x); s := rem_2pi_sym(y); p0 := PolEval(z,p0n,6)/PolEval(z,p0d,7)/y; z := 1.0/y; m0 := PolEval(z,m0n,8)/PolEval(z,m0d,8)/sqrt(y); {Compute p0 := rem_2pi_sym(y) - Pi_4 + p0 with optimized Kahan} {summation. Without rem_p2pi and Kahan we get a relative error} {of 1.4e-18 for J0(18), with this code it is 5.4e-20.} {Note that this improves only J0/Y0 for arguments x near the } {zeroes. With the recurrence relations for Jn/Yn only absolute} {(NOT relative) accuracies of order eps_x can be achieved! } z := -Pi_4; y := s + z; z := (y - s) - z; p0 := y + (p0 - z); end; {---------------------------------------------------------------------------} function sfd_j0(x: double): double; {-Return J0(x), the Bessel function of the 1st kind, order zero} var y,z: double; const {Squares of first three roots of J0, calculated with Maple and t_rcalc/xh} j1h: THexDblW = ($2BBB,$8046,$21FB,$4017); {5.78318596294678452117599575847} j2h: THexDblW = ($DD6F,$A621,$78A4,$403E); {30.4712623436620863990781631750} j3h: THexDblW = ($5768,$B821,$B8C4,$4052); {74.8870067906951834448890413101} var jz1: double absolute j1h; jz2: double absolute j2h; jz3: double absolute j3h; const j0nhex: array[0..7] of THexDblW = ( ($90D7,$72B8,$E8FF,$C3A3), {-7.173386747526788067407E17} ($A4C8,$3755,$C86E,$434C), { 1.620335009643150402368E16} ($6623,$5BAC,$EA6F,$C2E0), {-1.487926133645291056388E14} ($36F3,$D94D,$32C6,$4265), { 7.283696461857171054941E11} ($6C00,$232F,$F25A,$C1DE), {-2.076797068740966813173E9 } ($C120,$0536,$A069,$414A), { 3.490002040733471400107E6 } ($C575,$651C,$4E67,$C0A9), {-3.239201943301299801018E3 } ($411F,$7AC8,$BFE4,$3FF4)); { 1.296848754518641770562E0 } j0dhex: array[0..8] of THexDblW = ( ($6560,$EC5F,$096D,$4480), { 9.466475654163919450528E21} ($9960,$DB14,$1705,$4411), { 7.881340554308432241892E19} ($AAA8,$1C3D,$20A4,$4392), { 3.265560832845194013669E17} ($96C1,$48D1,$3C6B,$4309), { 8.879132373286001289461E14} ($0DC0,$84A1,$8146,$4279), { 1.752689035792859338860E12} ($7FCD,$EC52,$6F20,$41E3), { 2.608400226578100610991E9 } ($47FC,$6B92,$3459,$4146), { 2.910386840401647706984E6 } ($0658,$73F9,$D3EB,$40A1), { 2.281959869176887763845E3 } ($0000,$0000,$0000,$3FF0)); { 1.000000000000000000000E0 } var j0n: array[0..7] of double absolute j0nhex; j0d: array[0..8] of double absolute j0dhex; begin {Ref: Cephes [7], file ldouble\j0l.c} x := abs(x); if x < 9.0 then begin {In the interval [0,9) a rational approximation of the form } {J0(x) = (x^2 - r^2) (x^2 - s^2) (x^2 - t^2) P7(x^2)/Q8(x^2)} {is used, where r, s, t are the first three zeros of J0.} z := sqr(x); y := (z - jz1)*(z - jz2)*(z - jz3); sfd_j0 := y*PolEval(z,j0n,8)/PolEval(z,j0d,9); end else begin {For x>=9 the common rational approximations to modulus} {and phase are used J0(x) = modulus * cos(phase).} if x >= 500.0 then sfd_j0 := bessj_large(0,x) else begin bess_m0p0(x,y,z); sfd_j0 := y*cos(z); end; end; end; {---------------------------------------------------------------------------} function sfd_y0(x: double): double; {-Return Y0(x), the Bessel function of the 2nd kind, order zero; x>0} var y, z: double; const {The first four roots of Y0, calculated with Maple and t_rcalc/xh} y1h: THexDblW = ($569C,$4D98,$A953,$400F); {3.957678419314857868376} y2h: THexDblW = ($2103,$C4E7,$581D,$401C); {7.086051060301772697624} y3h: THexDblW = ($7D58,$35A4,$71D7,$4024); {10.22234504349641701900} y4h: THexDblW = ($E74A,$C4A1,$B8E1,$402A); {13.36109747387276347827} var y0z1: double absolute y1h; y0z2: double absolute y2h; y0z3: double absolute y3h; y0z4: double absolute y4h; const y0nhex: array[0..7] of THexDblW = ( ($2E2C,$6B40,$6802,$C350), {-1.847183690384811186958E16} ($4C8A,$BE8C,$A2F7,$4363), { 4.421767595991969611983E16} ($6524,$488D,$9928,$C328), {-3.461898868011666236539E15} ($F756,$2846,$E3EA,$42D3), { 8.747842804834934784972E13} ($6868,$D936,$8BE8,$C26C), {-9.808510181632626683952E11} ($64E6,$5309,$3879,$41F4), { 5.427926320587133391307E9 } ($72A6,$2FEF,$EE05,$C16B), {-1.464324149797947303151E7 } ($17C2,$8FE4,$688C,$40CE)); { 1.556909814120445353691E4 } y0dhex: array[0..7] of THexDblW = ( ($E565,$5351,$C96C,$438B), { 2.502813268068711844040E17} ($C521,$C3B4,$821A,$4326), { 3.167750475899536301562E15} ($836D,$B571,$7098,$42B2), { 2.027480766502742538763E13} ($B90B,$D2A9,$1870,$4234), { 8.630939306572281881328E10} ($1F53,$FD32,$0394,$41B0), { 2.686702051957904669677E8 } ($D65B,$3B16,$17CE,$4123), { 6.256391154086099882302E5 } ($E4B2,$36EF,$432B,$4090), { 1.040792201755841697889E3 } ($0000,$0000,$0000,$3FF0)); { 1.000000000000000000000E0 } y059nh: array[0..9] of THexDblW = ( ($A21F,$7D26,$FCE1,$C120), {-5.566567444353735925323E5 } ($5FE0,$4476,$6FC1,$C0FC), {-1.164760792144532266855E5 } ($3C72,$37C5,$E202,$4123), { 6.515211089266670755622E5 } ($6A49,$55FF,$D140,$4107), { 1.951120419910720443331E5 } ($689D,$4729,$8B69,$40BB), { 7.051411242092171161986E3 } ($4B6C,$9678,$E245,$C0B1), {-4.578271827238477598563E3 } ($CE7B,$CB3E,$5189,$4053), { 7.727403527387097461580E1 } ($6B4B,$3F40,$428B,$4039), { 2.525993724177105060507E1 } ($DD42,$7B68,$9118,$BFF7), {-1.472923738545276751402E0 } ($68B3,$16D5,$4172,$3F98)); { 2.368715538373384869796E-2} y059dh: array[0..9] of THexDblW = ( ($4167,$1A3D,$7AF7,$41D1), { 1.173085288957116938494E9} ($8C7A,$BB66,$36AB,$41EA), { 3.518324187204647941098E9} ($D73C,$A14E,$FF64,$C1C4), {-7.045635226159434678833E8} ($5245,$AF19,$D427,$4199), { 1.083335477747278958468E8} ($D2FE,$BBC8,$E85B,$C164), {-1.096162986826467060921E7} ($E0BD,$523A,$C59B,$412A), { 8.772616606054526158657E5} ($AC74,$33EA,$EBDA,$C0E8), {-5.103881883748705381186E4} ($CD56,$A051,$6194,$40A1), { 2.224790285641017194158E3} ($8D1C,$4AB4,$2D71,$C04F), {-6.235501989189125881723E1} ($0000,$0000,$0000,$3FF0)); { 1.000000000000000000000E0} var y059n: array[0..9] of double absolute y059nh; y059d: array[0..9] of double absolute y059dh; y0n: array[0..7] of double absolute y0nhex; y0d: array[0..7] of double absolute y0dhex; begin {Ref: Cephes [7], file ldouble\j0l.c} if x<=0.0 then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_y0 := NaN_d; exit; end; if x < 9.0 then begin z := sqr(x); if z < 20.25 then begin {In the interval [0,4.5) a rational approximation of the} {form Y0(x) = P7(x)/Q7(x) + 2/Pi*ln(x)*J0(x) is used. } y := ln(x)*sfd_j0(x)/Pi_2; sfd_y0 := y + PolEval(z,y0n,8)/PolEval(z,y0d,8); end else begin {In the interval [4.5,9) a rational approximation of the} {form Y0(x) = (x - p)(x - q)(x - r)(x - s)P9(x)/Q9(x) is} {is used where p, q, r, s are first four zeros of Y0(x).} y := (x - y0z1)*(x - y0z2)*(x - y0z3)*(x - y0z4); sfd_y0 := y * PolEval(x,y059n,10)/PolEval(x,y059d,10); end; end else begin {For x>=9 the common rational approximations to modulus} {and phase are used Y0(x) = modulus * sin(phase).} if x >= 1600 then sfd_y0 := bessy_large(0,x) else begin bess_m0p0(x,y,z); sfd_y0 := y*sin(z); end; end; end; {---------------------------------------------------------------------------} procedure bess_m1p1(x: double; var m1,p1: double); {-Modulus and phase for J1(x) and Y1(x), x >= 9.0} var y,z,s: double; const m1nhex: array[0..7] of THexDblW = ( ($BF75,$2020,$5926,$3F90), { 1.596507617085714650238E-2} ($F5CE,$C4D1,$12FF,$3FC0), { 1.255798064266130869132E-1} ($CAE6,$CE18,$3C17,$3FF0), { 1.014671139779858141347E0 } ($14AE,$4A71,$E041,$4006), { 2.859499532295180940060E0 } ($229D,$410D,$B047,$401C), { 7.172146812845906480743E0 } ($7190,$04BB,$385D,$4004), { 2.527521168680500659056E0 } ($C746,$4C30,$1407,$3FD9), { 3.918474430130242177355E-1} ($B308,$77F6,$2ABE,$C014)); {-5.041742205078442098874E0 } m1dhex: array[0..8] of THexDblW = ( ($8D82,$6AD9,$7D4E,$3F94), { 2.000925566825407466160E-2} ($5900,$F480,$2562,$3FC4), { 1.573909467558180942219E-1} ($35C7,$E2AF,$4985,$3FF4), { 1.267949948774331531237E0 } ($9C4F,$0346,$6F4A,$400C), { 3.554340386955608261463E0 } ($8D60,$060E,$829A,$4021), { 8.755081357265851765640E0 } ($F9CD,$C892,$4111,$4004), { 2.531772200570435289832E0 } ($E5AF,$D7F1,$7C36,$BFED), {-9.214128701852838347002E-1} ($81C5,$B1AC,$EEAF,$C018), {-6.233092094568239317498E0 } ($0000,$0000,$0000,$3FF0)); { 1.000000000000000000000E0 } p1nhex: array[0..5] of THexDblW = ( ($3AAB,$12D8,$A9F6,$3EBC), { 1.708502235134706284899E-6} ($D0FF,$CFB7,$E82F,$3F32), { 2.884976126715926258586E-4} ($9475,$8C1E,$2885,$3F8E), { 1.472572645054468815027E-2} ($173D,$96E5,$2B8F,$3FD1), { 2.682837461073751055565E-1} ($154C,$A013,$65E6,$3FF9), { 1.587378144541918176658E0 } ($A0DD,$25EA,$156A,$4000)); { 2.010456367705144783933E0 } p1dhex: array[0..6] of THexDblW = ( ($7C72,$61E5,$1BF9,$3ED3), { 4.556005960359216767984E-6} ($BF75,$8F2A,$464D,$3F49), { 7.713202197319040439861E-4} ($C213,$86BA,$46A7,$3FA4), { 3.960155028960712309814E-2} ($9198,$8513,$6CAA,$3FE7), { 7.320149039410806471101E-1} ($1A56,$56BC,$130B,$4012), { 4.518597941618813112665E0 } ($259E,$A865,$3CC1,$401B), { 6.809332495854873089362E0 } ($0000,$0000,$0000,$3FF0)); { 1.000000000000000000000E0 } var m1n: array[0..7] of double absolute m1nhex; m1d: array[0..8] of double absolute m1dhex; p1n: array[0..5] of double absolute p1nhex; p1d: array[0..6] of double absolute p1dhex; begin {Ref: Cephes [7], file ldouble\j1l.c} {Calculate the modulus m1(x) = sign(x)*sqrt(J1(x)^2 + Y1(x)^2) and } {the phase p1(x) = arctan(Y1(x)/J1(x)) with rational approximations} {For x>=9: J1(x) = m1(x)*cos(p1(x)) and Y1(x) = m1(x)*sin(p1(x))} z := sqr(1.0/x); y := abs(x); s := rem_2pi_sym(y); p1 := PolEval(z,p1n,6)/PolEval(z,p1d,7)/y; z := 1.0/y; m1 := PolEval(z,m1n,8)/PolEval(z,m1d,9)/sqrt(y); if x<0.0 then m1 := -m1; {Compute p1 := rem_2pi_sym(y) - 3Pi_4 + p1 with optimized Kahan summation} z := -3.0*Pi_4; y := s + z; z := (y - s) - z; p1 := y + (p1 - z); end; {---------------------------------------------------------------------------} function sfd_j1(x: double): double; {-Return J1(x), the Bessel function of the 1st kind, order one} var y,z: double; const {Squares of first three roots of J1, calculated with Maple and t_rcalc/xh} j1h: THexDblW = ($822C,$4189,$5D2B,$402D); {14.6819706421238932572197777686} j2h: THexDblW = ($A432,$6072,$9BF6,$4048); {49.2184563216946036702670828464} j3h: THexDblW = ($5E2C,$0D78,$DFF7,$4059); {103.499453895136580332223632536} var jz1: double absolute j1h; jz2: double absolute j2h; jz3: double absolute j3h; const j1nhex: array[0..8] of THexDblW = ( ($623B,$FA4E,$F494,$C392), {-3.41470097444474566748E17 } ($1E1A,$0A5F,$289F,$4338), { 6.80006297997263446982E15 } ($A52C,$EE29,$D773,$C2C9), {-5.68263073022183470933E13 } ($A460,$FF57,$9394,$424E), { 2.626500686552841932403E11} ($04A3,$9399,$16C7,$C1C6), {-7.41183271195454042842E8 } ($E567,$4B9E,$2441,$4134), { 1.32000129539331214495E6 } ($2D65,$A989,$DB34,$C096), {-1.46280142797793933909E3 } ($0A0E,$12D9,$CD74,$3FED), { 9.31329762279632791262E-1 } ($199F,$1643,$444A,$BF31)); {-2.63469779622127762897E-4 } j1dhex: array[0..8] of THexDblW = ( ($B67C,$A45E,$A1E0,$44A5), { 5.10779045516141578461E22} ($2F0D,$85D6,$5EE4,$4433), { 3.57325874689695599524E20} ($E4BD,$AAD4,$1EE7,$43B1), { 1.23367806884831151194E18} ($D800,$5DEA,$ADDE,$4323), { 2.76959756375961607085E15} ($BAB7,$13DF,$41C4,$4290), { 4.46866213886267829490E12} ($3FCC,$1219,$066D,$41F4), { 5.37544732957807543920E9 } ($2C4D,$D0DC,$4309,$4152), { 4.78723926343829674773E6 } ($8DD7,$EA02,$115B,$40A7), { 2.95267951972943745733E3 } ($0000,$0000,$0000,$3FF0)); { 1.00000000000000000000E0 } var j1n: array[0..8] of double absolute j1nhex; j1d: array[0..8] of double absolute j1dhex; begin {Ref: Cephes [7], file ldouble\j1l.c} z := abs(x); if z < 9.0 then begin z := sqr(x); {In the interval [0,9) a rational approximation of the form } {J1(x) = x*(x^2 - r^2)*(x^2 - s^2)*(x^2 - t^2)*P8(x^2)/Q8(x^2)} {is used, where r, s, t are the first three zeros of J1.} y := x*(z - jz1)*(z - jz2)*(z - jz3); sfd_j1 := y*PolEval(z,j1n,9)/PolEval(z,j1d,9); end else begin {For x>=9 the common rational approximations to modulus} {and phase are used J1(x) = modulus * cos(phase).} if z >= 500.0 then begin y := bessj_large(1,z); if x<0.0 then sfd_j1 := -y else sfd_j1 := y; end else begin bess_m1p1(x,y,z); sfd_j1 := y*cos(z); end; end; end; {---------------------------------------------------------------------------} function sfd_y1(x: double): double; {-Return Y1(x), the Bessel function of the 2nd kind, order one; x>0} var y, z: double; const {The first four roots of Y1, calculated with Maple and t_rcalc/xh} y1h: THexDblW = ($F243,$D4DF,$93BE,$4001); {2.19714132603101703515} y2h: THexDblW = ($B02E,$4E87,$B7FE,$4015); {5.42968104079413513277} y3h: THexDblW = ($69B4,$AE61,$3127,$4021); {8.59600586833116892643} y4h: THexDblW = ($3206,$38D4,$7F91,$4027); {11.7491548308398812434} var y1z1: double absolute y1h; y1z2: double absolute y2h; y1z3: double absolute y3h; y1z4: double absolute y4h; const y1nhex: array[0..6] of THexDblW = ( ($0907,$2601,$2CAB,$C353), {-2.158855258453711703120E16} ($EAF0,$B7A8,$32CE,$4334), { 5.685362960165615942886E15} ($484D,$C5A2,$CEBE,$C2EB), {-2.445982226888344140154E14} ($4D6B,$3CB5,$C58F,$428C), { 3.954354656937677136266E12} ($D0EF,$E154,$1255,$C21B), {-2.906793378120403577274E10} ($298A,$DF43,$A337,$4197), { 9.914315981558815369372E7 } ($FF0B,$AFDE,$77A1,$C0FF)); {-1.288901054372751879531E5 } y1dhex: array[0..7] of THexDblW = ( ($236E,$CFD7,$733B,$4378), { 1.101136026928555260168E17} ($2FD2,$2C67,$AF41,$4315), { 1.525917240904692387994E15} ($8575,$1306,$94BA,$42A3), { 1.076474894829072923244E13} ($B24B,$1523,$B332,$4227), { 5.089532584184822833416E10} ($2F62,$DAC2,$2946,$41A5), { 1.775133253792677466651E8 } ($3DE5,$C605,$9040,$411C), { 4.679841933793707979659E5 } ($71DC,$6E67,$E515,$408B), { 8.926354644853231136073E2 } ($0000,$0000,$0000,$3FF0)); { 1.000000000000000000000E0 } y159nh: array[0..9] of THexDblW = ( ($60AA,$7B1E,$FED8,$4112), { 3.112221202330688509818E5 } ($2D1F,$8CDB,$A2B1,$C131), {-1.155761550219364178627E6 } ($7B47,$27F4,$8488,$C13B), {-1.803400156074242435454E6 } ($EA1A,$2305,$2E42,$C13B), {-1.781314136808997406109E6 } ($4534,$AC30,$3F82,$C0FE), {-1.238961670382216747944E5 } ($52D6,$B5E8,$7A2C,$40D4), { 2.096869860275353982829E4 } ($4D7C,$C6E4,$1B2F,$40B8), { 6.171186628598134035237E3 } ($90DD,$D7B0,$D861,$C08C), {-9.230477746767243316014E2 } ($3CC0,$7D68,$8889,$4045), { 4.306669585790359450532E1 } ($6857,$CCF7,$C7FE,$BFE5)); {-6.806634906054210550896E-1} y159dh: array[0..10] of THexDblW = ( ($5614,$2A4D,$B64F,$4199), { 1.078445545755236785692E8} ($8DB6,$E0E3,$7501,$C1D1), {-1.171523459555524458808E9} ($2912,$567C,$E88B,$41EF), { 4.282669747880013349981E9} ($4E75,$81E0,$6B17,$C1C8), {-8.193431077523942651173E8} ($F2EE,$4396,$CD7D,$419C), { 1.208072488974110742912E8} ($2E5D,$0C68,$9411,$C166), {-1.183757638771741974521E7} ($88C8,$005B,$20F7,$412C), { 9.217235006983512475118E5} ($5AB8,$B427,$83A5,$C0E9), {-5.225317824142187494326E4} ($90FA,$3804,$7C60,$40A1), { 2.238187927382180589099E3} ($9263,$2543,$E84C,$C04E), {-6.181482377814679766978E1} ($0000,$0000,$0000,$3FF0)); { 1.000000000000000000000E0} var y159n: array[0..9] of double absolute y159nh; y159d: array[0..10] of double absolute y159dh; y1n: array[0..6] of double absolute y1nhex; y1d: array[0..7] of double absolute y1dhex; begin {Ref: Cephes [7], file ldouble\j1l.c} if x<=0.0 then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_y1 := NaN_d; exit; end; if x < 9.0 then begin z := sqr(x); if z < 20.25 then begin {In the interval [0,4.5) a rational approximation of the form} {Y1(x) = x*P6(x)/Q7(x) + 2/Pi*(ln(x)*J1(x) - 1/x) is used.} y := (ln(x)*sfd_j1(x) - 1.0/x)/Pi_2; sfd_y1 := y + x*PolEval(z,y1n,7)/PolEval(z,y1d,8); end else begin {In the interval [4.5,9) a rational approximation of the form} {Y1(x) = (x - p)*(x - q)*(x - r)*(x - s)*P9(x)/Q10(x) is used} {where p, q, r, s are first four zeros of Y1(x).} y := (x - y1z1)*(x - y1z2)*(x - y1z3)*(x - y1z4); sfd_y1 := y * PolEval(x,y159n,10)/PolEval(x,y159d,11); end; end else begin {For x>=9 the common rational approximations to modulus} {and phase are used Y1(x) = modulus * sin(phase).} if x >= 1600 then sfd_y1 := bessy_large(1,x) else begin bess_m1p1(x,y,z); sfd_y1 := y*sin(z); end; end; end; {---------------------------------------------------------------------------} function sfd_jn(n: integer; x: double): double; {-Return J_n(x), the Bessel function of the 1st kind, order n; not suitable for large n or x.} var curr,prev,q,temp,init,xh: double; k: integer; neg: boolean; const small = 1.703183936E-108; {~ cbrt(succd(0))} lnsml = ln_succd0; begin {Based on boost_1_42_0\boost\math\special_functions\detail\bessel_jn.hpp [19]} {Copyright 2006 Xiaogang Zhang, see 3rdparty.ama for Boost license} init := Sqrt_MinDbl; {Flag to negate result for |n|} neg := (n<0) and odd(n); n := abs(n); if n=0 then curr := sfd_j0(x) else if n=1 then curr := sfd_j1(x) else if abs(x) <= small then begin if (x=0.0) or (n>2) then curr := 0.0 else curr := 0.125*sqr(x); end else begin xh := 0.5*x; if abs(x) > n then begin {forward recurrence} prev := sfd_j0(x); curr := sfd_j1(x); for k:=1 to n-1 do begin temp := curr*k/xh - prev; prev := curr; curr := temp; end; end else begin {Quick check if |J_n(x)| < succd(0) from HMF[1] 9.1.63} {solution of z*exp(sqrt(1-z^2))=1 is z = 0.39989.. } q := abs(x/n); if n<=50 then temp := 1e-6 else if n<180 then temp := 1e-2 else if n<1000 then temp := 0.2 else temp := 0.3999; if q < temp then begin {Jn(x) <= [q*exp(sqrt(1-q^2))/(1+sqrt(1-q^2))]^n} temp := sqrt(1.0 - q*q); temp := ln(q/(1.0+temp)) + temp; if temp < lnsml/n then begin sfd_jn := 0.0; exit; end; end; {set overflow threshold for iteration} q := 0.5*MaxDouble*q; {backward recurrence} CF1_j(n,x,prev,k); prev := prev*init; curr := init; for k:=n downto 1 do begin if abs(curr) > q then begin {prevent overflow and set result to zero} sfd_jn := 0.0; exit; end; temp := curr*k/xh - prev; prev := curr; curr := temp; end; curr := (init/curr)*sfd_j0(x); end; end; if neg then sfd_jn := -curr else sfd_jn := curr; end; {---------------------------------------------------------------------------} function sfd_yn(n: integer; x: double): double; {-Return Y_n(x), the Bessel function of the 2nd kind, order n, x>0, not suitable for large n or x} var yn,yn1,t: double; k: integer; neg: boolean; begin {Flag to negate result for |n|} neg := (n<0) and odd(n); n := abs(n); if x<=0.0 then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_yn := NaN_d; exit; end; if n=0 then yn := sfd_y0(x) else if n=1 then yn := sfd_y1(x) else if (n>MAXGAMD) and (x<=2.0) then yn := NegInf_d else begin if x<1.0 then begin {NIST[30] 10.7.4} t := sfd_lnfac(n-1) - n*ln(0.5*x) - lnpi; if t > ln_MaxDbl then begin if neg then sfd_yn := PosInf_d else sfd_yn := NegInf_d; exit; end; end; {forward recurrence} yn1 := sfd_y0(x); yn := sfd_y1(x); x := 0.5*x; for k:=1 to n-1 do begin t := yn*k/x - yn1; yn1:= yn; yn := t; end; end; if neg then sfd_yn := -yn else sfd_yn := yn; end; {---------------------------------------------------------------------------} function bess_i0_small(x: double): double; {-Return Bessel function I0(x) for abs(x)<=3, x assumed >= 0} const xsml = 0.298023223876953125e-7; {sqrt(4*eps_d)} const nbi0 = 12; bi0h : array[0..nbi0-1] of THexDblW = ( ($3DC8,$8F34,$9C6A,$BFB3), {-0.7660547252839144951081894976243285e-1 } ($E329,$528B,$D660,$3FFE), {+0.1927337953993808269952408750881196e+1 } ($F0D7,$1075,$37C5,$3FCD), {+0.2282644586920301338937029292330415e+0 } ($6D77,$ADF2,$B963,$3F8A), {+0.1304891466707290428079334210691888e-1 } ($35CC,$24F7,$787A,$3F3C), {+0.4344270900816487451378682681026107e-3 } ($093E,$3617,$C2C0,$3EE3), {+0.9422657686001934663923171744118766e-5 } ($EADA,$458D,$3F35,$3E83), {+0.1434006289510691079962091878179957e-6 } ($9403,$8466,$B9C8,$3E1B), {+0.1613849069661749069915419719994611e-8 } ($45DB,$D6A4,$B670,$3DAE), {+0.1396650044535669699495092708142522e-10} ($278A,$F187,$F6B8,$3D3A), {+0.9579451725505445344627523171893333e-13} ($5237,$DB96,$37BA,$3CC3), {+0.5333981859862502131015107744000000e-15} ($9483,$AE63,$AD7A,$3C46)); {+0.2458716088437470774696785919999999e-17} { ($DEA3,$25A0,$83F7,$3BC6);} {+0.9535680890248770026944341333333333e-20} var bi0: array[0..nbi0-1] of double absolute bi0h; begin {Ref: W. Fullerton [14] and [20], files dbesi0.f and dbsi0e.f} {Hex Chebyshev values calculated with mp_arith/t_rcalc} if x<=xsml then bess_i0_small := 1.0 else bess_i0_small := 2.75 + CSEvalD(x*x/4.5-1.0,bi0,nbi0); end; {---------------------------------------------------------------------------} function sfd_i0e(x: double): double; {-Return I0(x)*exp(-|x|), the exponentially scaled modified Bessel function of the 1st kind, order zero} const xsml = 0.23283064365386962891e-9; {sqrt(0.5*eps_d)} const nai0 = 24; ai0: array[0..nai0-1] of double = ( +0.7575994494023795942729872037438e-1, +0.7591380810823345507292978733204e-2, +0.4153131338923750501863197491382e-3, +0.1070076463439073073582429702170e-4, -0.7901179979212894660750319485730e-5, -0.7826143501438752269788989806909e-6, +0.2783849942948870806381185389857e-6, +0.8252472600612027191966829133198e-8, -0.1204463945520199179054960891103e-7, +0.1559648598506076443612287527928e-8, +0.2292556367103316543477254802857e-9, -0.1191622884279064603677774234478e-9, +0.1757854916032409830218331247743e-10, +0.1128224463218900517144411356824e-11, -0.1146848625927298877729633876982e-11, +0.2715592054803662872643651921606e-12, -0.2415874666562687838442475720281e-13, -0.6084469888255125064606099639224e-14, +0.3145705077175477293708360267303e-14, -0.7172212924871187717962175059176e-15, +0.7874493403454103396083909603327e-16, +0.1004802753009462402345244571839e-16, -0.7566895365350534853428435888810e-17, +0.2150380106876119887812051287845e-17); { -0.3754858341830874429151584452608e-18, +0.2354065842226992576900757105322e-19, +0.1114667612047928530226373355110e-19, -0.5398891884396990378696779322709e-20);} const nai2 = 27; ai02: array[0..nai2-1] of double = ( +0.5449041101410883160789609622680e-1, +0.3369116478255694089897856629799e-2, +0.6889758346916823984262639143011e-4, +0.2891370520834756482966924023232e-5, +0.2048918589469063741827605340931e-6, +0.2266668990498178064593277431361e-7, +0.3396232025708386345150843969523e-8, +0.4940602388224969589104824497835e-9, +0.1188914710784643834240845251963e-10, -0.3149916527963241364538648629619e-10, -0.1321581184044771311875407399267e-10, -0.1794178531506806117779435740269e-11, +0.7180124451383666233671064293469e-12, +0.3852778382742142701140898017776e-12, +0.1540086217521409826913258233397e-13, -0.4150569347287222086626899720156e-13, -0.9554846698828307648702144943125e-14, +0.3811680669352622420746055355118e-14, +0.1772560133056526383604932666758e-14, -0.3425485619677219134619247903282e-15, -0.2827623980516583484942055937594e-15, +0.3461222867697461093097062508134e-16, +0.4465621420296759999010420542843e-16, -0.4830504485944182071255254037954e-17, -0.7233180487874753954562272409245e-17, +0.9921475412173698598880460939810e-18, +0.1193650890845982085504399499242e-17); { -0.2488709837150807235720544916602e-18, -0.1938426454160905928984697811326e-18, +0.6444656697373443868783019493949e-19, +0.2886051596289224326481713830734e-19, -0.1601954907174971807061671562007e-19, -0.3270815010592314720891935674859e-20);} begin {Ref: W. Fullerton [14] and [20], file dbsi0e.f} x := abs(x); if x<=3.0 then begin {Note that there is bug in dbsi0e.f from [20] for small x. We use the} {Taylor series for I(0,x)*exp(-x) = 1 - x + 3/4*x^2 -5/12*x^3 + O(x^4)} if x<=xsml then sfd_i0e := 1 - x else sfd_i0e := exp(-x)*bess_i0_small(x); end else if x<=8.0 then begin sfd_i0e := (0.375 + CSEvalD((48.0/x-11.0)/5.0, ai0, nai0))/sqrt(x); end else begin sfd_i0e := (0.375 + CSEvalD(16.0/x-1.0, ai02, nai2))/sqrt(x); end; end; {---------------------------------------------------------------------------} function sfd_i0(x: double): double; {-Return I0(x), the modified Bessel function of the 1st kind, order zero} begin x := abs(x); if x<=3.0 then sfd_i0 := bess_i0_small(x) else if x>ln_MaxDbl then sfd_i0 := PosInf_d else sfd_i0 := sfd_i0e(x)*exp(x); end; {---------------------------------------------------------------------------} function bess_i1_small(x: double): double; {-Return Bessel function I1(x) for abs(x)<=3} var y: double; const xsml = 0.105367121277235e-7; {sqrt(0.5*eps_d)} const nbi1 = 11; bi1: array[0..nbi1-1] of double = ( -0.19717132610998597316138503218149e-2, +0.40734887667546480608155393652014e+0, +0.34838994299959455866245037783787e-1, +0.15453945563001236038598401058489e-2, +0.41888521098377784129458832004120e-4, +0.76490267648362114741959703966069e-6, +0.10042493924741178689179808037238e-7, +0.99322077919238106481371298054863e-10, +0.76638017918447637275200171681349e-12, +0.47414189238167394980388091948160e-14, +0.24041144040745181799863172032000e-16); { +0.10171505007093713649121100799999e-18);} begin {Ref: W. Fullerton [14] and [20], files dbesi1.f and dbsi1e.f} y := abs(x); if y=0.0 then bess_i1_small := 0.0 else if y<=xsml then bess_i1_small := 0.5*x else bess_i1_small := x*(0.875 + CSEvalD(x*x/4.5-1.0,bi1,nbi1)); end; {---------------------------------------------------------------------------} function sfd_i1e(x: double): double; {-Return I1(x)*exp(-|x|), the exponentially scaled modified Bessel function of the 1st kind, order one} var y: double; const nai1 = 24; ai1: array[0..nai1-1] of double = ( -0.2846744181881478674100372468307e-1, -0.1922953231443220651044448774979e-1, -0.6115185857943788982256249917785e-3, -0.2069971253350227708882823777979e-4, +0.8585619145810725565536944673138e-5, +0.1049498246711590862517453997860e-5, -0.2918338918447902202093432326697e-6, -0.1559378146631739000160680969077e-7, +0.1318012367144944705525302873909e-7, -0.1448423418183078317639134467815e-8, -0.2908512243993142094825040993010e-9, +0.1266388917875382387311159690403e-9, -0.1664947772919220670624178398580e-10, -0.1666653644609432976095937154999e-11, +0.1242602414290768265232168472017e-11, -0.2731549379672432397251461428633e-12, +0.2023947881645803780700262688981e-13, +0.7307950018116883636198698126123e-14, -0.3332905634404674943813778617133e-14, +0.7175346558512953743542254665670e-15, -0.6982530324796256355850629223656e-16, -0.1299944201562760760060446080587e-16, +0.8120942864242798892054678342860e-17, -0.2194016207410736898156266643783e-17); { +0.3630516170029654848279860932334e-18, -0.1695139772439104166306866790399e-19, -0.1288184829897907807116882538222e-19, +0.5694428604967052780109991073109e-20);} const nai2 = 27; ai12: array[0..nai2-1] of double = ( +0.2857623501828012047449845948469e-1, -0.9761097491361468407765164457302e-2, -0.1105889387626237162912569212775e-3, -0.3882564808877690393456544776274e-5, -0.2512236237870208925294520022121e-6, -0.2631468846889519506837052365232e-7, -0.3835380385964237022045006787968e-8, -0.5589743462196583806868112522229e-9, -0.1897495812350541234498925033238e-10, +0.3252603583015488238555080679949e-10, +0.1412580743661378133163366332846e-10, +0.2035628544147089507224526136840e-11, -0.7198551776245908512092589890446e-12, -0.4083551111092197318228499639691e-12, -0.2101541842772664313019845727462e-13, +0.4272440016711951354297788336997e-13, +0.1042027698412880276417414499948e-13, -0.3814403072437007804767072535396e-14, -0.1880354775510782448512734533963e-14, +0.3308202310920928282731903352405e-15, +0.2962628997645950139068546542052e-15, -0.3209525921993423958778373532887e-16, -0.4650305368489358325571282818979e-16, +0.4414348323071707949946113759641e-17, +0.7517296310842104805425458080295e-17, -0.9314178867326883375684847845157e-18, -0.1242193275194890956116784488697e-17); { +0.2414276719454848469005153902176e-18, +0.2026944384053285178971922860692e-18, -0.6394267188269097787043919886811e-19, -0.3049812452373095896084884503571e-19, +0.1612841851651480225134622307691e-19, +0.3560913964309925054510270904620e-20);} begin {Ref: W. Fullerton [14] and [20], file dbsi1e.f} y := abs(x); if y<=3.0 then sfd_i1e := exp(-y)*bess_i1_small(x) else begin if y<=8.0 then begin y := (0.375 + CSEvalD((48.0/y-11.0)/5.0, ai1, nai1))/sqrt(y) end else begin y := (0.375 + CSEvalD(16.0/y-1.0, ai12, nai2))/sqrt(y); end; if x>0 then sfd_i1e := y else sfd_i1e := -y; end; end; {---------------------------------------------------------------------------} function sfd_i1(x: double): double; {-Return I1(x), the modified Bessel function of the 1st kind, order one} var y: double; begin y := abs(x); if y<=3.0 then sfd_i1 := bess_i1_small(x) else if x>ln_MaxDbl then sfd_i1 := PosInf_d else sfd_i1 := sfd_i1e(x)*exp(y); end; {---------------------------------------------------------------------------} function bess_k0_small(x: double): double; {-Return Bessel function K0(x) for 0 < x <= 2} var y: double; const xsml = 0.21073424255447e-7; {sqrt(2*eps_d)} const nbk0 = 10; bk0: array[0..nbk0-1] of double = ( -0.353273932339027687201140060063153e-1, +0.344289899924628486886344927529213e+0, +0.359799365153615016265721303687231e-1, +0.126461541144692592338479508673447e-2, +0.228621210311945178608269830297585e-4, +0.253479107902614945730790013428354e-6, +0.190451637722020885897214059381366e-8, +0.103496952576336245851008317853089e-10, +0.425981614279108257652445327170133e-13, +0.137446543588075089694238325440000e-15); { +0.357089652850837359099688597333333e-18, +0.763164366011643737667498666666666e-21);} begin {Ref: W. Fullerton [14] and [20], files dbesk0.f and dbsk0e.f} if x>xsml then y := x*x else begin if x=0.0 then begin bess_k0_small := PosInf_d; exit; end else y := 0.0; end; bess_k0_small := -ln(0.5*x)*bess_i0_small(x) - 0.25 + CSEvalD(0.5*y-1.0,bk0,nbk0); end; {---------------------------------------------------------------------------} function sfd_k0e(x: double): double; {-Return K0(x)*exp(x), the exponentially scaled modified Bessel function of the 2nd kind, order zero, x>0} const nak0 = 19; ak0: array[0..nak0-1] of double = ( -0.7643947903327941424082978270088e-1, -0.2235652605699819052023095550791e-1, +0.7734181154693858235300618174047e-3, -0.4281006688886099464452146435416e-4, +0.3081700173862974743650014826660e-5, -0.2639367222009664974067448892723e-6, +0.2563713036403469206294088265742e-7, -0.2742705549900201263857211915244e-8, +0.3169429658097499592080832873403e-9, -0.3902353286962184141601065717962e-10, +0.5068040698188575402050092127286e-11, -0.6889574741007870679541713557984e-12, +0.9744978497825917691388201336831e-13, -0.1427332841884548505389855340122e-13, +0.2156412571021463039558062976527e-14, -0.3349654255149562772188782058530e-15, +0.5335260216952911692145280392601e-16, -0.8693669980890753807639622378837e-17, +0.1446404347862212227887763442346e-17); { -0.2452889825500129682404678751573e-18, +0.4233754526232171572821706342400e-19, -0.7427946526454464195695341294933e-20);} const nak2 = 16; ak02: array[0..nak2-1] of double = ( -0.1201869826307592239839346212452e-1, -0.9174852691025695310652561075713e-2, +0.1444550931775005821048843878057e-3, -0.4013614175435709728671021077879e-5, +0.1567831810852310672590348990333e-6, -0.7770110438521737710315799754460e-8, +0.4611182576179717882533130529586e-9, -0.3158592997860565770526665803309e-10, +0.2435018039365041127835887814329e-11, -0.2074331387398347897709853373506e-12, +0.1925787280589917084742736504693e-13, -0.1927554805838956103600347182218e-14, +0.2062198029197818278285237869644e-15, -0.2341685117579242402603640195071e-16, +0.2805902810643042246815178828458e-17, -0.3530507631161807945815482463573e-18); { +0.4645295422935108267424216337066e-19, -0.6368625941344266473922053461333e-20);} begin {Ref: W. Fullerton [14] and [20], file dbsk0e.f} if x<=2.0 then sfd_k0e := exp(x)*bess_k0_small(x) else if x<=8.0 then begin sfd_k0e := (1.25 + CSEvalD((16.0/x-5.0)/3.0, ak0, nak0))/sqrt(x); end else begin sfd_k0e := (1.25 + CSEvalD(16.0/x-1.0, ak02, nak2))/sqrt(x); end; end; {---------------------------------------------------------------------------} function sfd_k0(x: double): double; {-Return K0(x), the modified Bessel function of the 2nd kind, order zero, x>0} begin if x<=2.0 then sfd_k0 := bess_k0_small(x) else sfd_k0 := sfd_k0e(x)*exp(-x); end; {---------------------------------------------------------------------------} function bess_k1_small(x: double): double; {-Return Bessel function K1(x) for 0 < x <= 2} var y: double; const xsml = 0.46566128730773925781e-9; {sqrt(2*eps_d)} const nbk1 = 11; bk1: array[0..nbk1-1] of double = ( +0.25300227338947770532531120868533e-1, -0.35315596077654487566723831691801e+0, -0.12261118082265714823479067930042e+0, -0.69757238596398643501812920296083e-2, -0.17302889575130520630176507368979e-3, -0.24334061415659682349600735030164e-5, -0.22133876307347258558315252545126e-7, -0.14114883926335277610958330212608e-9, -0.66669016941993290060853751264373e-12, -0.24274498505193659339263196864853e-14, -0.70238634793862875971783797120000e-17); { -0.16543275155100994675491029333333e-19);} begin {Ref: W. Fullerton [14] and [20], files dbesk1.f and dbsk1e.f} if x>xsml then y := x*x else begin if x=0.0 then begin bess_k1_small := PosInf_d; exit; end else y := 0.0; end; bess_k1_small := ln(0.5*x)*bess_i1_small(x) + (0.75 + CSEvalD(0.5*y-1.0,bk1,nbk1))/x; end; {---------------------------------------------------------------------------} function sfd_k1e(x: double): double; {-Return K1(x)*exp(x), the exponentially scaled modified Bessel function of the 2nd kind, order one, x>0} const nak1 = 19; ak1: array[0..nak1-1] of double = ( +0.27443134069738829695257666227266e+0, +0.75719899531993678170892378149290e-1, -0.14410515564754061229853116175625e-2, +0.66501169551257479394251385477036e-4, -0.43699847095201407660580845089167e-5, +0.35402774997630526799417139008534e-6, -0.33111637792932920208982688245704e-7, +0.34459775819010534532311499770992e-8, -0.38989323474754271048981937492758e-9, +0.47208197504658356400947449339005e-10, -0.60478356628753562345373591562890e-11, +0.81284948748658747888193837985663e-12, -0.11386945747147891428923915951042e-12, +0.16540358408462282325972948205090e-13, -0.24809025677068848221516010440533e-14, +0.38292378907024096948429227299157e-15, -0.60647341040012418187768210377386e-16, +0.98324256232648616038194004650666e-17, -0.16284168738284380035666620115626e-17); { +0.27501536496752623718284120337066e-18, -0.47289666463953250924281069568000e-19, +0.82681500028109932722392050346666e-20);} const nak2 = 16; ak12: array[0..nak2-1] of double = ( +0.6379308343739001036600488534102e-1, +0.2832887813049720935835030284708e-1, -0.2475370673905250345414545566732e-3, +0.5771972451607248820470976625763e-5, -0.2068939219536548302745533196552e-6, +0.9739983441381804180309213097887e-8, -0.5585336140380624984688895511129e-9, +0.3732996634046185240221212854731e-10, -0.2825051961023225445135065754928e-11, +0.2372019002484144173643496955486e-12, -0.2176677387991753979268301667938e-13, +0.2157914161616032453939562689706e-14, -0.2290196930718269275991551338154e-15, +0.2582885729823274961919939565226e-16, -0.3076752641268463187621098173440e-17, +0.3851487721280491597094896844799e-18); { -0.5044794897641528977117282508800e-19, +0.6888673850418544237018292223999e-20);} begin {Ref: W. Fullerton [14] and [20], file dbsk1e.f} if x<=2.0 then sfd_k1e := exp(x)*bess_k1_small(x) else if x<=8.0 then begin sfd_k1e := (1.25 + CSEvalD((16.0/x-5.0)/3.0, ak1, nak1))/sqrt(x); end else begin sfd_k1e := (1.25 + CSEvalD(16.0/x-1.0, ak12, nak2))/sqrt(x); end; end; {---------------------------------------------------------------------------} function sfd_k1(x: double): double; {-Return K1(x), the modified Bessel function of the 2nd kind, order one, x>0} begin if x<=2.0 then sfd_k1 := bess_k1_small(x) else sfd_k1 := sfd_k1e(x)*exp(-x); end; {---------------------------------------------------------------------------} function sfd_in(n: integer; x: double): double; {-Return I_n(x), the modified Bessel function of the 1st kind, order n} var curr,prev,temp,init,y: double; k: integer; const NMax = 160; XMax = 512.0; begin {HMF[1], 9.6.6: I(-n,x) = I(n,x)} n := abs(n); if n=0 then sfd_in := sfd_i0(x) else if n=1 then sfd_in := sfd_i1(x) else if x=0.0 then sfd_in := 0.0 else begin y := abs(x); {If n or x are not small then use real order function} if (n>NMax) or (y>XMax) then sfd_in := sfd_iv(n,x) else begin {Simplified calculation for I_n only with existing functions} if y <= 2.0 then begin curr := IJ_series(n,y,false); end else begin {I_(n+1)(y)/I_n(y) using continued fraction and recurse backwards} CF1_I(n,y,temp); y := 0.5*y; init := Sqrt_MinDbl; curr := init; prev := init*temp; for k:=n downto 1 do begin temp := curr*k/y + prev; prev := curr; curr := temp; end; curr := (init/curr)*sfd_i0(x); end; {Adjust sign} if (x<0.0) and odd(n) then curr := -curr; sfd_in := curr; end; end; end; {---------------------------------------------------------------------------} function sfd_kn(n: integer; x: double): double; {-Return K_n(x), the modified Bessel function of the 2nd kind, order n, x>0, not suitable for large n} var kn,knm1,knm2: double; k: integer; begin {HMF[1], 9.6.6: K(-n,x) = K(n,x)} n := abs(n); {Range error for x<=0 is generated in k0 or k1} if n=0 then kn := sfd_k0(x) else if n=1 then kn := sfd_k1(x) else begin {$ifdef Delphi} {avoid false warning "Variable 'kn' might not have been initialized"} kn := 0.0; {$endif} {forward recurrence, K(n+1,x) = 2n/x*K(n,x) + K(n-1,x)} knm2 := sfd_k0(x); knm1 := sfd_k1(x); x := 0.5*x; for k:=1 to n-1 do begin kn := knm1*k/x + knm2; knm2 := knm1; knm1 := kn; end; end; sfd_kn := kn; end; {---------------------------------------------------------------------------} {-------------------- Bessel functions of real order -----------------------} {---------------------------------------------------------------------------} {---------------------------------------------------------------------------} procedure temme_y(v,x: double; var Y,Y1: double); {-Calculate Y(v, x) and Y(v+1, x) by Temme's method for small |x|} var k,g,h,p,q,f,c,d,s,s1,tol,a,e: double; g1,g2,gp,gm,v2: double; const MAXIT = 30000; begin {$ifdef debug} if (abs(v) > 0.5) or (abs(x) > 2) then begin if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); end; {$endif} {N.M.Temme [51], On the Numerical Evaluation of the Ordinary} {Bessel Function of the Second Kind, Section 2.} gp := sfd_gamma1pm1(v); gm := sfd_gamma1pm1(-v); a := ln(0.5*x); s := -a*v; if abs(v) < eps_d then begin e := 0.5*v*sqr(Pi); d := 1.0/Pi; end else begin e := 2.0*sqr(sinpi(0.5*v))/v; d := v/sinpi(v); end; if v=0.0 then g1 := -EulerGamma else g1 := 0.5*(gp-gm)/((1.0+gp)*(1.0+gm)*v); g2 := 0.5*(2.0+gp+gm)/((1.0+gp)*(1.0+gm)); f := 2.0*(g1*cosh(s) - g2*a*sinhc(s))*d; c := power(0.5*x, v); p := d/(c*(1.0 + gm)); q := d*c/(1.0 + gp); g := f + e*q; c := 1.0; s := c*g; s1:= c*p; v2 := v*v; d := -0.25*x*x; {series summation} tol := 0.5*eps_d; {use double k because otherwise k*k may overflow} k := 1.0; while k <= MAXIT do begin c := c*d/k; f := (k*f + p + q) / (k*k - v2); p := p/(k - v); q := q/(k + v); g := f + e*q; h := p - k*g; s := s + c*g; s1:= s1 + c*h; if abs(c*g) < abs(s)*tol then begin Y := -s; Y1 := -2.0*s1/x; exit; end; k := k + 1.0; end; {No convergence} if RTE_NoConvergence>0 then RunError(byte(RTE_NoConvergence)); Y := -s; Y1 := -2.0*s1/x; end; {---------------------------------------------------------------------------} procedure CF2_jy(v,x: double; var p,q: double); {-Return the continued fraction p + i*q = (J' + iY') / (J + iY)} var a,br,bi,cr,ci,dr,di,er,ei,fr,fi,t: double; i: integer; const MAXIT = 30000; begin {Ref: Numerical Recipes [13], ch. 6.7, p.244, function bessjy} {Evaluate the continued fraction p + iq = (J' + iY') / (J + iY)} {NR [13] (6.7.3) using the (complex) modified Lentz's method.} {$ifdef debug} if abs(x) < 1.0 then begin if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); end; {$endif} t := 1.0/x; a := 0.25-v*v; fr := -0.5*t; fi := 1.0; br := 2.0*x; bi := 2.0; t := a*t/(fr*fr+fi*fi); cr := br+t*fi; ci := bi+t*fr; t := br*br+bi*bi; dr := +br/t; di := -bi/t; er := cr*dr-ci*di; ei := cr*di+ci*dr; t := fr*er-fi*ei; fi := fr*ei+fi*er; fr := t; for i:=1 to MAXIT do begin a := a + 2.0*i; bi := bi + 2.0; dr := a*dr+br; di := a*di+bi; if abs(dr)+abs(di) = 0.0 then dr := Sqrt_MinDbl; t := a/(cr*cr+ci*ci); cr := br+t*cr; ci := bi-t*ci; if abs(cr)+abs(ci) = 0.0 then cr := Sqrt_MinDbl; t := dr*dr+di*di; dr := +dr/t; di := -di/t; er := cr*dr-ci*di; ei := cr*di+ci*dr; t := fr*er-fi*ei; fi := fr*ei+fi*er; fr := t; if abs(er-1.0)+abs(ei) < 8*eps_d then begin p := fr; q := fi; exit; end; end; {No convergence} if RTE_NoConvergence>0 then RunError(byte(RTE_NoConvergence)); p := fr; q := fi; end; {---------------------------------------------------------------------------} function Yv_series(v,x: double): double; {-Series for Yv for 'small' x < 1; frac(v)<>0} var h,k,v1,v2,t1,t2,xx,Yv: double; const hsmall = 0.177065751663e-308; { ~ 1/(MaxDouble*Pi)} begin {Use Yv(x) = ( Jv(v,x)cos(vx) - Jv(-v,x) )/sin(vx) } {and Gamma reflection to sum the two series for Jv } if v<MAXGAMD then h := power(0.5*x, v)/sfd_gamma(v) else h := exp(v*ln(0.5*x) - sfd_lngamma(v)); if h <= hsmall then begin {1.0/(h*Pi) will overflow} Yv_series := NegInf_d; exit; end; sincosPi(v, v1, v2); t2 := 1.0/(h*Pi); t1 := h*(v2/(v*v1)); Yv := t1-t2; xx := 0.25*x*x; v2 := v; v1 := v; k := 0.0; repeat k := k + 1.0; v1 := v1 + 1.0; v2 := v2 - 1.0; t1 := -t1*xx/(k*v1); t2 := t2*xx/(k*v2); h := t1 - t2; Yv := Yv + h; until (abs(h)<eps_d*abs(Yv)); Yv_series := Yv; end; {---------------------------------------------------------------------------} const BT_J = 1; BT_Y = 2; {---------------------------------------------------------------------------} procedure bessel_jy(v,x: double; BT: byte; var Jv,Yv: double); {-Return J_v(x) and/or Y_v(x) depending on BT, x>0, |v| < MaxLongint, INF if overflow} var n,k: longint; u, Ju, Yv1, Yu, Yu1, fv, fu: double; w, p, q, g, curr, prev, next, init, t, x2: double; reflect: boolean; s: integer; const lnepsh = -36.7368005696771013991133024373; {--------------------------------------------} function rec_overflow(a,b: double): boolean; {-Test if a*b overflows, if yes set Yv and Jv = PosInf_d} begin if (abs(a) > 1.0) and (abs(b) >= MaxDouble/abs(a)) then begin rec_overflow := true; Jv := PosInf_d; Yv := PosInf_d; end else rec_overflow := false; end; begin {Ref: Boost [19] file bessel_jy.hpp, function bessel_jy} {and NR [13], Ch.6.7, section Ordinary Bessel Functions} {For x < 0 the functions Jv and Yv are in general complex; and Yv} {is singular for x=0. |v| < MaxLongint is assumed, so we can work} {with longint in the recurrence iterative, but these routines are} {are not suitable for large v values anyway.} reflect := v < 0.0; if reflect then begin v := -v; BT := BT_J + BT_Y; {J and Y needed for reflection formula} end; x2 := 0.5*x; n := round(v); u := v-n; w := 2.0/(Pi*x); {Wronskian} if x<=2.0 then begin if v>MAXGAMD then begin Yv := PosInf_d; if reflect then Jv := PosInf_d else Jv := 0.0; exit; end else begin {Check very 'small' x and v case with (near) overflow for Yv} if (x<1.0) and (u<>0.0) and (lnepsh > v*ln(0.25*sqr(x)/v)) then begin if BT and BT_J <> 0 then Jv := IJ_series(v, x, true); if BT and BT_Y <> 0 then Yv := Yv_series(v, x); end else begin temme_y(u, x, Yu,Yu1); if n=0 then begin Yv := Yu; Yv1 := Yu1; end else begin prev := Yu; curr := Yu1; {skip last next calculation if J is not needed: it} {overflows in rare cases like bessel_yv(170.9, 2).} for k:=1 to n-1 do begin {forward recurrence for Y} t := (u+k)/x2; if rec_overflow(t,curr) then exit; next := t*curr - prev; prev := curr; curr := next; end; Yv := curr; if BT and BT_J = 0 then Yv1 := 0.0 {keep some compilers quiet!} else Yv1 := ((u+n)/x2)*curr - prev; end; if BT and BT_J <> 0 then begin CF1_j(v, x, fv, s); Jv := w/(Yv*fv - Yv1); {Wronskian relation} end; end; end; end else begin {calculate the lower limit t=t(v) for asymptotic range} if BT=BT_Y then t:= 1552 else begin t := maxd(3.0, v*v)*121.0; if BT and BT_Y <> 0 then t := maxd(t,1552); end; if x>t then begin {Use asymptotic expansion of Hankel function H1v(x)} if BT and BT_J <> 0 then Jv := bessj_large(v, x); if BT and BT_Y <> 0 then begin Yu := bessy_large(u, x); Yu1 := bessy_large(u + 1, x); end; end else begin CF1_j(v, x, fv, s); {tiny initial value to prevent overflow} init := Sqrt_MinDbl; curr := s*init; prev := fv*curr; for k:=n downto 1 do begin {backward recurrence for J} t := (u+k)/x2; if rec_overflow(t,curr) then exit; next := t*curr - prev; prev := curr; curr := next; end; CF2_jy(u, x, p, q); fu := prev/curr; t := u/x - fu; {t = J'/J} g := (p-t)/q; Ju := sqrt(w/(q + g*(p-t))); if curr<0.0 then Ju := -Ju; Jv := s*Ju*(init/curr); {normalization} Yu := g*Ju; Yu1:= Yu*(u/x - p - q/g); end; if BT and BT_Y <> 0 then begin prev := Yu; curr := Yu1; if n=0 then Yv := prev else begin for k:=1 to n-1 do begin {forward recurrence for Y} t := (u+k)/x2; if rec_overflow(t,curr) then exit; next := t*curr - prev; prev := curr; curr := next; end; Yv := curr; end; end; end; if reflect then begin {For negative v use reflection formula NR [13], 6.7.19} {J(-v,x) = cos(Pi*v)*J(v,x) - sin(Pi*v)*Y(v,x)} {Y(-v,x) = sin(Pi*v)*J(v,x) + cos(Pi*v)*Y(v,x)} sincosPi(v,p,q); t := q*Jv - p*Yv; Yv := p*Jv + q*Yv; Jv := t; end; end; {---------------------------------------------------------------------------} procedure sfd_bess_jyv(v,x: double; var Jv,Yv: double); {-Return J_v(x) and Y_v(x), no checks, x>0, |v| < MaxLongint} begin bessel_jy(v,x, BT_J + BT_Y, jv,yv); end; {---------------------------------------------------------------------------} function sfd_jv(v, x: double): double; {-Return J_v(x), the Bessel function of the 1st kind, order v; not suitable for large v.} var r,n: double; begin if IsNaNorInfD(x) or IsNaNorInfD(v) then begin sfd_jv := NaN_d; exit; end; n := int(v); if x<0.0 then begin if n=v then begin r := sfd_jv(v, -x); if frac(0.5*v)<>0 then r := -r; sfd_jv := r; end else begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_jv := NaN_d; end; end else if x=0.0 then begin if v=0.0 then sfd_jv := 1.0 else if v>0.0 then sfd_jv := 0.0 else begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_jv := NaN_d; end; end else begin {here x > 0} if n=v then begin {integer order} if abs(n)<200.0 then begin if x > maxd(3.0, v*v)*121.0 then begin r := bessj_large(abs(v),x); if frac(0.5*v)<0.0 then r := -r; sfd_jv := r; end else sfd_jv := sfd_jn(round(n),x); exit; end; end; {Here v no integer or |v| > 200} if ((v >= 0.0) and (v<MAXGAMD-1)) and ((x < 1.0) or (v > 0.25*x*x)) then begin sfd_jv := IJ_series(v, x, true); end else begin bessel_jy(v,x,BT_J,r,n); sfd_jv := r; end; end; end; {---------------------------------------------------------------------------} function sfd_yv(v, x: double): double; {-Return Y_v(x), the Bessel function of the 2nd kind, order v; x > 0; not suitable for large v.} var r,n: double; begin if IsNaNorInfD(x) or IsNaNorInfD(v) then begin sfd_yv := NaN_d; exit; end; if x<=0.0 then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_yv := NaN_d; exit; end; r := abs(v); if frac(v) = -0.5 then begin {Reflection would be used but cos(Pi*v)=0: Y(v,x) = sin(Pi*v)*J(-v,x)} sfd_yv := sinPi(r)*sfd_jv(-v,x); exit; end; n := int(v); if n=v then begin {integer order} if (x>1552.0) and (x>5.0*abs(v)) then begin r := bessy_large(abs(v),x); if frac(0.5*v)<0.0 then r := -r; sfd_yv := r; end else if abs(n)<2000 then begin sfd_yv := sfd_yn(round(n),x); end else begin {Call general routine but avoid Jv calculation for v<0} bessel_jy(abs(v),x,BT_Y,n,r); if frac(0.5*v)<0.0 then r := -r; sfd_yv := r; end; exit; end; bessel_jy(v,x,BT_Y,n,r); sfd_yv := r; end; {---------------------------------------------------------------------------} procedure temme_k(v,x: double; var K0,K1: double); {-Calculate K(v, x) and K(v+1, x) by Temme's method for small |x|} var k,h,p,q,f,c,d,s,s1,tol,a: double; g1,g2,gp,gm: double; const MAXIT = 30000; begin {$ifdef debug} if (abs(v) > 0.5) or (abs(x) > 2.0) then begin if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); end; {$endif} {N.M. Temme [52], On the numerical evaluation of the } {modified Bessel function of the third kind. See also} {Boost [19], file bessel_ik.hpp / function temme_ik } gp := sfd_gamma1pm1(v); gm := sfd_gamma1pm1(-v); a := ln(0.5*x); s := -a*v; h := exp(a*v); if abs(v) < eps_d then begin c := 1.0; g1 := -EulerGamma; end else begin c := sinPi(v)/(v*Pi); g1 := (0.5*c/v)*(gp-gm); end; g2 := 0.5*c*(2.0+gp+gm); {initial values} p := 0.5*(1.0+gp)/h; q := 0.5*(1.0+gm)*h; f := (g1*cosh(s) - a*g2*sinhc(s))/c; h := p; c := 1.0; s := c*f; s1:= c*h; a := v*v; d := 0.25*x*x; {series summation} tol := 0.5*eps_d; k := 1.0; while k <= MAXIT do begin f := (k*f + p + q) / (k*k - a); p := p/(k - v); q := q/(k + v); h := p - k*f; c := c*d/k; s := s + c*f; s1:= s1 + c*h; if abs(c*f) < abs(s)*tol then begin K0 := s; K1 := 2.0*s1/x; exit; end; k := k + 1.0; end; {No convergence} if RTE_NoConvergence>0 then RunError(byte(RTE_NoConvergence)); K0 := s; K1 := 2.0*s1/x; end; {---------------------------------------------------------------------------} procedure CF2_K(v,x: double; escale: boolean; var K0,K1: double); {-Compute K(v,x) and K(v+1,x) via continued fraction, |v| <= 0.5, |x| > 1} { If escale=true the values are multiplied by exp(x)} var a,a1,b,c,d,dh,ds,h,q,q1,q2,s,t: double; k: integer; const MAXIT = 30000; label done; begin {Ref: Numerical Recipes [13], Ch. 6.7, section Modified Bessel Functions} {and p.249, function bessik. It is based on I.J. Thompson, A.R. Barnett,} {1987, Computer Physics Communications, vol. 47, pp. 245-257. } {$ifdef debug} if (abs(v) > 0.5) or (abs(x) <= 1.0) then begin if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); end; {$endif} b := 2.0*(1.0+x); d := 1.0/b; h := d; dh := d; q1 := 0.0; q2 := 1.0; a := v*v - 0.25; a1 := -a; q := a1; c := a1; s := 1.0+q*dh; for k:=2 to MAXIT do begin a := a - 2*(k-1); c := -a*c/k; t := (q1-b*q2)/a; q1 := q2; q2 := t; q := q + c*t; b := b + 2.0; d := 1.0/(b+a*d); dh := (b*d-1.0)*dh; h := h + dh; ds := q*dh; s := s + ds; if abs(ds) < abs(s)*eps_d then goto done end; {No convergence} if RTE_NoConvergence>0 then RunError(byte(RTE_NoConvergence)); done: K0 := sqrt(Pi_2/x)/s; if not escale then K0 := K0*exp(-x); K1 := K0*(v+x+0.5-a1*h)/x; end; {---------------------------------------------------------------------------} function bess_i_large(v,x: double; var Ivs: double): boolean; {-Compute I_v(x) for large x >= 100, sqrt(x) >= 2v. Return true} { if 'convergence' within 50 iterations, Ivs = I_v(x)*exp(-x)*sqrt(2Pix)} var s,t,u,w: double; k: integer; begin {Hankel expansion of Iv, NIST[30], 10.40.1 and 10.17.1} u := 4.0*sqr(v); w := 8.0*x; {Typical values: w >= 800, u/w < 1/8} t := 1.0; s := 1.0; bess_i_large := false; for k:=1 to 50 do begin t := t*(sqr(2*k-1)-u)/k/w; s := s + t; if abs(t)<eps_d then begin bess_i_large := true; Ivs := s; exit; end; end; Ivs := s; end; {---------------------------------------------------------------------------} procedure bessel_ik(v,x: double; CalcI, escale: boolean; var Iv,Kv: double); {-Return I_v(x) and/or K_v(x) depending on CalcI, x>0, |v| < MaxLongint} { If escale=true the values are exponentially scaled.} var n,k: longint; u, Kv1, Ku, Ku1, fv: double; w, curr, prev, next, t, x2: double; reflect,OK,kzero: boolean; begin {Ref: Boost [19] file bessel_ik.hpp, function bessel_ik} {and NR [13], Ch.6.7, section Modified Bessel Functions} reflect := v < 0.0; v := abs(v); x2 := 0.5*x; n := round(v); u := v-n; if x <= 2.0 then begin temme_k(u, x, Ku, Ku1); if escale then begin fv := exp(x); Ku := Ku*fv; Ku1:= Ku1*fv; end; end else CF2_K(u, x, escale, Ku, Ku1); kzero := (abs(Ku1)+abs(Ku))=0.0; if not kzero then begin prev := Ku; curr := Ku1; for k:=1 to n do begin {forward recurrence for K} t := (u+k)/x2; if (t > 1.0) and (curr >= MaxDouble/t) then begin Kv := PosInf_d; if CalcI then begin if Reflect then Iv := PosInf_d else Iv := 0.0; end; exit; end; next := t*curr + prev; prev := curr; curr := next; end; Kv := prev; Kv1 := curr; kzero := (abs(Kv1)+abs(Kv))=0.0; end else begin Kv := 0.0; Kv1 := 0.0; end; if CalcI then begin if (x >= 100.0) and (2.0*v <= sqrt(x)) then begin {Asymptotic expansion HMF[1], 9.7.1 or NIST[30], 10.40.4} OK := bess_i_large(v,x,t); if not escale then begin {Even if no convergence the result is used for ovrflow check} if (t <= 0.0) or (x+ln(t)-0.5*ln(TwoPi*x) >= ln_MaxDbl) then begin Iv := PosInf_d; exit; end; end; if OK then begin if escale then Iv := t/sqrt(TwoPi*x) else begin u := exp(0.5*x); Iv := u*(u*(t/sqrt(TwoPi*x))); end; end; end else begin if kzero then begin Iv := PosInf_d; exit; end; CF1_I(v, x, fv); w := 1.0/x; Iv := w/(Kv*fv + Kv1); {Wronskian relation} end; if reflect then begin {Kv contribution to reflection} t := sinPi(v)*Kv/Pi_2; {Note: Kv is scaled with exp(|x|), so we have to multiply with exp(-2|x|)} if escale then t := t*exp(-2.0*abs(x)); Iv := Iv + t; end; end; end; {---------------------------------------------------------------------------} function sfd_iv(v, x: double): double; {-Return I_v(x), the modified Bessel function of the 1st kind, order v.} var r,t: double; const IvMaxX = 713.987083862762618541896578221; begin if IsNaNorInfD(x) or IsNaNorInfD(v) then begin sfd_iv := NaN_d; exit; end; if x<0.0 then begin {if v is not an integer I(v, x) is complex} if frac(v)=0.0 then begin r := sfd_iv(v,-x); if frac(0.5*v)<>0 then r := -r; sfd_iv := r; end else begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_iv := NaN_d; end; end else if abs(v)=0.5 then begin {NIST[30] 10.39.1: I(0.5,x)=sinh(x)/R, I(-0.5,x)=cosh(x)/R, R=sqrt(Pi*x/2)} if x >= ln_MaxDbl then begin if x >= IvMaxX then sfd_iv := PosInf_d else begin {Avoid overflow for x in range 709.78 .. 713.987} r := exp(0.5*x); sfd_iv := r*(r/sqrt(TwoPi*x)); end; end else begin r := sqrt(Pi_2*x); if v<0.0 then sfd_iv := cosh(x)/r else sfd_iv := sinh(x)/r; end; end else if x=0.0 then begin if v=0.0 then sfd_iv := 1.0 else sfd_iv := 0.0; end else begin {x>0} if v=0.0 then sfd_iv := sfd_i0(x) else if abs(v)=1.0 then sfd_iv := sfd_i1(x) else if x >= IvMaxX then sfd_iv := PosInf_d else begin bessel_ik(v,x,true,false,r,t); sfd_iv := r; end; end; end; {---------------------------------------------------------------------------} function sfd_kv(v, x: double): double; {-Return K_v(x), the modified Bessel function of the 2nd kind, order v, x>0} var r,t: double; begin if IsNaNorInfD(x) or IsNaNorInfD(v) then begin sfd_kv := NaN_d; exit; end; if (frac(v)=0.0) and (v<MaxInt) then sfd_kv := sfd_kn(round(v),x) else if x<=0.0 then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_kv := NaN_d; end else begin if abs(v)=0.5 then begin {NIST[30] 10.39.2: K(0.5,x) = K(-0.5,x) = exp(-x)*sqrt(Pi/2/x)} sfd_kv := exp(-x)*sqrt(Pi_2/x); end else begin bessel_ik(v, x, false, false, t, r); sfd_kv := r; end; end; end; {---------------------------------------------------------------------------} procedure sfd_bess_kv2(v,x: double; var Kv, Kv1: double); {-Return K(v,x) and K(v+1,x), no checks, x>0, |v| < MaxLongint} var n,k: longint; u, Ku, Ku1: double; curr, prev, next, t, x2: double; begin {Ref: Boost [19] file bessel_ik.hpp, function bessel_ik} {and NR [13], Ch.6.7, section Modified Bessel Functions} u := v; if v < -0.5 then u := abs(u) - 1.0; x2 := 0.5*x; n := round(u); u := u-n; if x <= 2.0 then temme_k(u, x, Ku, Ku1) else CF2_K(u, x, false, Ku, Ku1); prev := Ku; curr := Ku1; for k:=1 to n do begin {forward recurrence for K} t := (u+k)/x2; if (t > 1.0) and (curr >= MaxDouble/t) then begin Kv := PosInf_d; Kv1 := PosInf_d; exit; end; next := t*curr + prev; prev := curr; curr := next; end; if v < -0.5 then begin Kv1 := prev; Kv := curr; end else begin Kv := prev; Kv1 := curr; end; end; {---------------------------------------------------------------------------} function sfd_ive(v, x: double): double; {-Return I_v(x)*exp(-|x|), the exponentially scaled modified Bessel function of the 1st kind, order v.} var r,t: double; begin if IsNaNorInfD(x) or IsNaNorInfD(v) then begin sfd_ive := NaN_d; exit; end; if x<0.0 then begin {if v is not an integer I(v, x) is complex} if frac(v)=0.0 then begin r := sfd_ive(v,-x); if frac(0.5*v)<>0 then r := -r; sfd_ive := r; end else begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_ive := NaN_d; end; end else if x=0.0 then begin if v=0.0 then sfd_ive := 1.0 else sfd_ive := 0.0; end else begin {x>0} if v=0.0 then sfd_ive := sfd_i0e(x) else if abs(v)=1.0 then sfd_ive := sfd_i1e(x) else begin bessel_ik(v,x,true,true,r,t); sfd_ive := r; end; end; end; {---------------------------------------------------------------------------} function sfd_kve(v, x: double): double; {-Return K_v(x)*exp(x), the exponentially scaled modified Bessel function of the 2nd kind, order v, x>0} var r,t: double; begin if IsNaNorInfD(x) or IsNaNorInfD(v) then begin sfd_kve := NaN_d; exit; end; if x<=0.0 then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_kve := NaN_d; end else begin v := abs(v); if v=0.0 then sfd_kve := sfd_k0e(x) else if v=1.0 then sfd_kve := sfd_k1e(x) else if abs(v)=0.5 then begin {NIST[30] 10.39.1: K(0.5,x) = K(-0.5,x) = exp(-x)*sqrt(Pi/2/x)} sfd_kve := sqrt(Pi_2/x); end else begin bessel_ik(v, x, false, true, t, r); sfd_kve := r; end; end; end; {---------------------------------------------------------------------------} procedure sfd_bess_ikv(v,x: double; var Iv,Kv: double); {-Return I_v(x) and K_v(x), no checks, x>0, |v| < MaxLongint} begin bessel_ik(v,x,true,false,Iv,Kv); end; {---------------------------------------------------------------------------} function sfd_sph_jn(n: integer; x: double): double; {-Return j_n(x), the spherical Bessel function of the 1st kind, order n} var r,z: double; begin if IsNaNorInfD(x) then begin sfd_sph_jn := NaN_d; exit; end; if n=0 then sfd_sph_jn := sinc(x) else begin if x=0.0 then sfd_sph_jn := 0.0 else begin z := abs(x); r := sqrt(Pi_2/z)*sfd_jv(0.5+n,z); if (x<0.0) and odd(n) then r := -r; {NIST 10.47.14} sfd_sph_jn := r; end; end; end; {---------------------------------------------------------------------------} function sfd_sph_yn(n: integer; x: double): double; {-Return y_n(x), the spherical Bessel function of the 2nd kind, order n >=0 , x<>0} var r,z: double; begin if IsNaNorInfD(x) then begin sfd_sph_yn := NaN_d; exit; end; z := abs(x); if x=0.0 then r := NegInf_d else r := sqrt(Pi_2/z)*sfd_yv(0.5+n,z); if (x<0.0) and odd(n+1) then r := -r; {NIST 10.47.14} sfd_sph_yn := r; end; {---------------------------------------------------------------------------} function sfd_sph_in(n: integer; x: double): double; {-Return i_n(x), the modified spherical Bessel function of the 1st/2nd kind, order n} var r: double; begin if IsNaNorInfD(x) then begin sfd_sph_in := NaN_d; exit; end; if n=0 then sfd_sph_in := sinhc(x) {i_0 = sinh(x)/x} else begin if x=0.0 then begin if n>0 then sfd_sph_in := 0.0 else if odd(n) then sfd_sph_in := PosInf_d else sfd_sph_in := NegInf_d end else begin r := abs(x); r := sqrt(Pi_2/r)*sfd_iv(0.5+n,r); if (x<0.0) and odd(n) then r := -r; {NIST 10.47.16} sfd_sph_in := r; end; end; end; {---------------------------------------------------------------------------} function sfd_sph_ine(n: integer; x: double): double; {-Return i_n(x)*exp(-|x|), the exponentially scaled modified spherical Bessel function of the 1st/2nd kind, order n} var r,z: double; begin if IsNaNorInfD(x) then begin sfd_sph_ine := NaN_d; exit; end; z := abs(x); if n=0 then begin {i_0e = exp(-z)*sinh(z)/z} if z<=0.5e-8 then begin {exp(-z)*sinh(z)/z = 1 - z + 2/3*z^2 - 1/3*z^3 + 2/15*z^4 + O(z^5)} sfd_sph_ine := 1.0 - z; end else begin {exp(-z)*sinh(z)/z = -0.5*(exp(-2z)-1)/z} if z>=19 then sfd_sph_ine := 0.5/z else sfd_sph_ine := (-0.5)*expm1(-2.0*z)/z; end; end else begin if x=0.0 then begin if n>0 then sfd_sph_ine := 0.0 else if odd(n) then sfd_sph_ine := PosInf_d else sfd_sph_ine := NegInf_d end else begin r := sqrt(Pi_2/z)*sfd_ive(0.5+n,z); if (x<0.0) and odd(n) then r := -r; {NIST 10.47.16} sfd_sph_ine := r; end; end; end; {---------------------------------------------------------------------------} function sfd_sph_kn(n: integer; x: double): double; {-Return k_n(x), the modified spherical Bessel function of the 3rd kind, order n, x>0} begin if IsNaNorInfD(x) then begin sfd_sph_kn := NaN_d; exit; end; if x<0.0 then begin sfd_sph_kn := NaN_d; {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} exit; end; if n<0 then n := -n-1; {NIST 10.47.9} if n=0 then sfd_sph_kn := Pi_2*exp(-x)/x else sfd_sph_kn := sqrt(Pi_2/x)*sfd_kv(0.5+n,x); end; {---------------------------------------------------------------------------} function sfd_sph_kne(n: integer; x: double): double; {-Return k_n(x)*exp(x), the exponentially scaled modified spherical Bessel function of the 3rd kind, order n, x>0} begin if IsNaNorInfD(x) then begin sfd_sph_kne := NaN_d; exit; end; if x<0.0 then begin sfd_sph_kne := NaN_d; {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} exit; end; if n<0 then n := -n-1; {NIST 10.47.9} if n=0 then sfd_sph_kne := Pi_2/x else sfd_sph_kne := sqrt(Pi_2/x)*sfd_kve(0.5+n,x); end; {---------------------------------------------------------------------------} {---------------------------------------------------------------------------} {---------------------------------------------------------------------------} function Airy_small(x,f0,f1: double): double; {-Compute Ai(x) or Bi(x) via Maclaurin series, x small, f0=f(0), f1=f'(0)} var ai,da,t1,t2,x3: double; k: integer; const MAXIT3 = 120; begin {Maclaurin series NIST[30], 9.4.1/9.4.3} t1 := f0; t2 := f1*x; ai := t1 + t2; x3 := x*sqr(x); k := 3; while k<MAXIT3 do begin t1 := t1*x3/(k*(k-1)); t2 := t2*x3/(k*(k+1)); da := t1 + t2; ai := ai + da; if abs(da) < abs(ai)*eps_d then begin Airy_small := ai; exit; end; inc(k,3); end; {No convergence} if RTE_NoConvergence>0 then RunError(byte(RTE_NoConvergence)); Airy_small := ai; end; const { Ai(0) = 0.35502805388781723926 = 3^(-2/3)/gamma(2/3) NIST[30], 9.2.3} { Ai'(0) = -0.25881940379280679840 = -3^(-1/3)/gamma(1/3) NIST[30], 9.2.4} { Bi(0) = 0.61492662744600073516 = 3^(-1/6)/gamma(2/3) NIST[30], 9.2.5} { Bi'(0) = 0.44828835735382635789 = 3^(+1/6)/gamma(1/3) NIST[30], 9.2.6} rt3h: THexDblW = ($4CAA,$E858,$B67A,$3FFB); { 1.73205080756888} ai0h: THexDblW = ($15B8,$9627,$B8C7,$3FD6); {+3.5502805388781721874E-1} ai1h: THexDblW = ($0F8B,$42B7,$907F,$BFD0); {-2.5881940379280682363E-1} bi0h: THexDblW = ($3EA9,$9B4A,$AD7A,$3FE3); {+6.1492662744600068425E-1} bi1h: THexDblW = ($C8A1,$A680,$B0C1,$3FDC); {+4.4828835735382638328E-1} var rt3: double absolute rt3h; { = 3^0.5 } ai0: double absolute ai0h; { = Ai(0) } ai1: double absolute ai1h; { = Ai'(0) } bi0: double absolute bi0h; { = Bi(0) } bi1: double absolute bi1h; { = Bi'(0) } {---------------------------------------------------------------------------} function sfd_airy_ai(x: double): double; {-Return the Airy function Ai(x)} var z,Jv,Yv: double; begin if IsNaNorInfD(x) then begin sfd_airy_ai := NaN_d; exit; end; if (x <= 1.0) and (x >= -2.0) then begin sfd_airy_ai := Airy_small(x,ai0,ai1); end else begin z := abs(x); z := 2.0*z*sqrt(z)/3.0; if x>0.0 then begin {NR[13], 6.7.41} z := sfd_kv(1.0/3.0, z); sfd_airy_ai := sqrt(x/3.0)*z/Pi; end else begin {NR[13], 6.7.46} sfd_bess_jyv(1.0/3.0, z, Jv, Yv); z := Jv - Yv/rt3; sfd_airy_ai := 0.5*sqrt(-x)*z; end; end; end; {---------------------------------------------------------------------------} function sfd_airy_bi(x: double): double; {-Return the Airy function Bi(x)} var z,bij,bky: double; begin if IsNaNorInfD(x) then begin sfd_airy_bi := NaN_d; exit; end; z := abs(x); if z < 1.0 then begin sfd_airy_bi := Airy_small(x,bi0,bi1); end else begin z := 2.0*z*sqrt(z)/3.0; if x>0.0 then begin {NR[13], 6.7.44} sfd_bess_ikv(1.0/3.0,z,bij,bky); z := 2.0*bij/rt3 + bky/Pi; sfd_airy_bi := sqrt(x)*z; end else begin {NR[13], 6.7.46} sfd_bess_jyv(1.0/3.0, z, bij, bky); z := bij/rt3 + bky; sfd_airy_bi := (-0.5)*sqrt(-x)*z; end; end; end; {---------------------------------------------------------------------------} function sfd_airy_ais(x: double): double; {-Return the scaled Airy function Ai(x) if x <= 0, Ai(x)*exp(2/3*x^1.5) for x > 0} var z: double; const xs = 1.0; { if x<=xs use Ai(x) else BesselK} xl = 17179869184.0; {> (3d_1/eps)^(2/3)} begin if IsNaNorInfD(x) then begin sfd_airy_ais := NaN_d; exit; end; if x<=0.0 then sfd_airy_ais := sfd_airy_ai(x) else if x < xl then begin z := 2.0*x*sqrt(x)/THREE; if x<=xs then begin z := exp(z); sfd_airy_ais := sfd_airy_ai(x)*z; end else begin z := sfd_kve(1.0/3.0, z); sfd_airy_ais := sqrt(x/THREE)*z/Pi; end; end else begin {HMF[1], 10.4.59} z := sqrt(x); sfd_airy_ais := 0.5/sqrtPi/sqrt(z); end; end; {---------------------------------------------------------------------------} function sfd_airy_bis(x: double): double; {-Return the scaled Airy function Bi(x) if x <= 0, Bi(x)*exp(-2/3*x^1.5) for x > 0} var z,bij,bky: double; const xt = 1e-20; {for 0<=x<xt, exp(..)=1 } xk = 9.5; {K(1/3,..) negligible if x>xk } xl = 17179869184.0; {> (3d_1/eps)^(2/3)} begin if IsNaNorInfD(x) then begin sfd_airy_bis := NaN_d; exit; end; if x<=xt then sfd_airy_bis := sfd_airy_bi(x) else if x<xl then begin z := 2.0*x*sqrt(x)/THREE; bessel_ik(1.0/3.0,z,true,true,bij,bky); bij := 2.0*bij/rt3; if x<xk then bij := bij + bky/Pi*exp(-2*z); sfd_airy_bis := sqrt(x)*bij; end else begin z := sqrt(x); sfd_airy_bis := 1.0/sqrtPi/sqrt(z); end; end; {---------------------------------------------------------------------------} function AiryP_small(x,f0,f1: double): double; {-Compute Ai'(x) or Bi'(x) via Maclaurin series, x small, f0=f(0), f1=f'(0)} var ai,da,t1,t2,x3: double; k: integer; const MAXIT3 = 120; begin {Maclaurin series NIST[30], 9.4.2/9.4.4} t1 := f1; t2 := 0.5*f0*x*x; ai := t1 + t2; x3 := x*sqr(x); k := 3; while k<MAXIT3 do begin t1 := t1*x3/(k*(k-2)); t2 := t2*x3/(k*(k+2)); da := t1 + t2; ai := ai + da; if abs(da) < abs(ai)*eps_d then begin AiryP_small := ai; exit; end; inc(k,3); end; AiryP_small := ai; end; {---------------------------------------------------------------------------} function sfd_airy_aip(x: double): double; {-Return the Airy function Ai'(x)} var z,Jv,Yv: double; begin if IsNaNorInfD(x) then begin sfd_airy_aip := NaN_d; exit; end; z := abs(x); if z <= 1.0 then begin sfd_airy_aip := AiryP_small(x,ai0,ai1); end else begin z := 2.0*z*sqrt(z)/3.0; if x>0.0 then begin {NR[13], 6.7.45} z := sfd_kv(2.0/3.0, z); sfd_airy_aip := -x/rt3*z/Pi; end else begin {NR[13], 6.7.46} sfd_bess_jyv(2.0/3.0, z, Jv, Yv); z := Jv + Yv/rt3; sfd_airy_aip := (-0.5)*x*z; end; end; end; {---------------------------------------------------------------------------} function sfd_airy_bip(x: double): double; {-Return the Airy function Bi'(x)} var z,bij,bky: double; begin if IsNaNorInfD(x) then begin sfd_airy_bip := NaN_d; exit; end; z := abs(x); if z <= 1.0 then begin sfd_airy_bip := AiryP_small(x,bi0,bi1); end else begin z := 2.0*z*sqrt(z)/3.0; if x>0.0 then begin {NR[13], 6.7.45} sfd_bess_ikv(2.0/3.0,z,bij,bky); z := 2.0*bij/rt3 + bky/Pi; sfd_airy_bip := x*z; end else begin {NR[13], 6.7.46} sfd_bess_jyv(2.0/3.0, z, bij, bky); z := bij/rt3 - bky; sfd_airy_bip := (-0.5)*x*z; end; end; end; {---------------------------------------------------------------------------} function gipos7(x: double): double; {-Return Airy/Scorer Gi(x) for x >= 7} const ntip2 = 23; argip2: array[0..ntip2-1] of double = ( 2.00473712275801486391e0, 0.294184139364406724e-2, 0.71369249006340167e-3, 0.17526563430502267e-3, 0.4359182094029882e-4, 0.1092626947604307e-4, 0.272382418399029e-5, 0.66230900947687e-6, 0.15425323370315e-6, 0.3418465242306e-7, 0.728157724894e-8, 0.151588525452e-8, 0.30940048039e-9, 0.6149672614e-10, 0.1202877045e-10, 0.233690586e-11, 0.43778068e-12, 0.7996447e-13, 0.1494075e-13, 0.246790e-14, 0.37672e-15, 0.7701e-16, 0.354e-17); { -0.49e-18, 0.62e-18, -0.40e-18, -0.1e-19, 0.2e-19, -0.3e-19, 0.1e-19);} const xmax = 208063.8307; {> cbrt(2/eps_d)} var x3, t: double; begin {Ref: MacLeod's [22], MISCFUN, function airy_gi} gipos7 := 0.0; if x<7.0 then exit else if x <= xmax then begin x3 := x*x*x; t := (1200.0 - x3)/(514.0 + x3); t := CSEvalD(t, argip2, ntip2); gipos7 := t/x/Pi; end else gipos7 := 1.0/Pi/x; end; {---------------------------------------------------------------------------} function hineg8(x: double): double; {-Return Airy/Scorer Hi(x) for x <= -8} var x3, t: double; const xmin = -208063.831; {< cbrt(2/eps_d)} const ntin2 = 16; arhin2: array[0..ntin2-1] of double = ( 1.99647720399779650525e0, -0.187563779407173213e-2, -0.12186470897787339e-3, -0.814021609659287e-5, -0.55050925953537e-6, -0.3763008043303e-7, -0.258858362365e-8, -0.17931829265e-9, -0.1245916873e-10, -0.87171247e-12, -0.6084943e-13, -0.431178e-14, -0.29787e-15, -0.2210e-16, -0.136e-17, -0.14e-18); begin {Ref: MacLeod's [22], MISCFUN, function airy_hi} hineg8 := 0.0; if x > -8.0 then exit; if x <= xmin then hineg8 := (-1.0)/Pi/x else begin x3 := x*x*x; t := (x3 + 1200.0)/(176.0 - x3); t := CSEvalD(t, arhin2, ntin2); hineg8 := -t/Pi/x; end; end; {---------------------------------------------------------------------------} function sfd_airy_hi(x: double): double; {-Return the Airy/Scorer function Hi(x) = 1/Pi*integral(exp(x*t-t^3/3), t=0..INF)} const hizero = 0.4099510849640004901; {Hi(0) = 2/Gamma(2/3)/3^(7/6)} var t: double; const ntin4 = 20; arhin1: array[0..ntin4-1] of double = ( 0.31481017206423404116e0, -0.16414499216588964341e0, 0.6176651597730913071e-1, -0.1971881185935933028e-1, 0.536902830023331343e-2, -0.124977068439663038e-2, 0.24835515596994933e-3, -0.4187024096746630e-4, 0.590945437979124e-5, -0.68063541184345e-6, 0.6072897629164e-7, -0.367130349242e-8, 0.7078017552e-10, 0.1187894334e-10, -0.120898723e-11, 0.1189656e-13, 0.594128e-14, -0.32257e-15, -0.2290e-16, 0.253e-17); { 0.9e-19, -0.2e-19);} const ntip1 = 30; arhip : array[0..ntip1-1] of double = ( 1.24013562561762831114, 0.64856341973926535804, 0.55236252592114903246, 0.20975122073857566794, 0.12025669118052373568, 0.3768224931095393785e-1, 0.1651088671548071651e-1, 0.455922755211570993e-2, 0.161828480477635013e-2, 0.40841282508126663e-3, 0.12196479721394051e-3, 0.2865064098657610e-4, 0.742221556424344e-5, 0.163536231932831e-5, 0.37713908188749e-6, 0.7815800336008e-7, 0.1638447121370e-7, 0.319857665992e-8, 0.61933905307e-9, 0.11411161191e-9, 0.2064923454e-10, 0.360018664e-11, 0.61401849e-12, 0.10162125e-12, 0.1643701e-13, 0.259084e-14, 0.39931e-15, 0.6014e-16, 0.886e-17, 0.128e-17); { 0.18e-18, 0.3e-19);} const xmax: double = 104.4362038448; {overflow threshold} begin {Pascal port of A.J. MacLeod's [22] MISCFUN function airy_hi. } {AMath uses airy_bi instead of another Chebyshev approximation} if x < 0.0 then begin if x > -eps_d then sfd_airy_hi := hizero else if x <= -8.0 then sfd_airy_hi := hineg8(x) else begin t := (4.0*x + 12.0)/(x - 12.0); sfd_airy_hi := CSEvalD(t,arhin1, ntin4); end end else begin if x < eps_d then sfd_airy_hi := hizero else if x > 7.0 then begin if x>xmax then sfd_airy_hi := PosInf_d else begin t := gipos7(x); sfd_airy_hi := sfd_airy_bi(x) - t; end; end else begin t := 2.0*x/7.0 - 1.0; t := CSEvalD(t,arhip, ntip1); sfd_airy_hi := t*exp(1.5*x); end; end; end; {---------------------------------------------------------------------------} function sfd_airy_gi(x: double): double; {-Return the Airy/Scorer function Gi(x) = 1/Pi*integral(sin(x*t+t^3/3), t=0..INF)} const ntin3 = 40; argin1: array[0..ntin3-1] of double = ( -0.20118965056732089130e0, -0.7244175303324530499e-1, 0.4505018923894780120e-1, -0.24221371122078791099e0, 0.2717884964361678294e-1, -0.5729321004818179697e-1, -0.18382107860337763587e0, 0.7751546082149475511e-1, 0.18386564733927560387e0, 0.2921504250185567173e-1, -0.6142294846788018811e-1, -0.2999312505794616238e-1, 0.585937118327706636e-2, 0.822221658497402529e-2, 0.132579817166846893e-2, -0.96248310766565126e-3, -0.45065515998211807e-3, 0.772423474325474e-5, 0.5481874134758052e-4, 0.1245898039742876e-4, -0.246196891092083e-5, -0.169154183545285e-5, -0.16769153169442e-6, 0.9636509337672e-7, 0.3253314928030e-7, 0.5091804231e-10, -0.209180453553e-8, -0.41237387870e-9, 0.4163338253e-10, 0.3032532117e-10, 0.340580529e-11, -0.88444592e-12, -0.31639612e-12, -0.1505076e-13, 0.1104148e-13, 0.246508e-14, -0.3107e-16, -0.9851e-16, -0.1453e-16, 0.118e-17); { 0.67e-18, 0.6e-19, -0.1e-19);} const ntip1 = 28; argip1: array[0..ntip1-1] of double = ( 0.26585770795022745082e0, -0.10500333097501922907e0, 0.841347475328454492e-2, 0.2021067387813439541e-1, -0.1559576113863552234e-1, 0.564342939043256481e-2, -0.59776844826655809e-3, -0.42833850264867728e-3, 0.22605662380909027e-3, -0.3608332945592260e-4, -0.785518988788901e-5, 0.473252480746370e-5, -0.59743513977694e-6, -0.15917609165602e-6, 0.6336129065570e-7, -0.276090232648e-8, -0.256064154085e-8, 0.47798676856e-9, 0.4488131863e-10, -0.2346508882e-10, 0.76839085e-12, 0.73227985e-12, -0.8513687e-13, -0.1630201e-13, 0.356769e-14, 0.25001e-15, -0.10859e-15, -0.158e-17); { 0.275e-17, -0.5e-19, -0.6e-19);} const gizero = 0.204975542482000245050307456365; {Gi(0) = 1/Gamma(2/3)/3^(7/6)} var t: double; begin {Pascal port of A.J. MacLeod's [22] MISCFUN function airy_gi. } {AMath uses airy_bi instead of another Chebyshev approximation} if x < -8.0 then begin t := hineg8(x); sfd_airy_gi := sfd_airy_bi(x) - t; end else if x <= -eps_d then begin t := -(x+4.0)/4.0; sfd_airy_gi := CSEvalD(t,argin1, ntin3); end else if x < eps_d then begin {abs(x) < eps_d} sfd_airy_gi := gizero; end else if x < 7.0 then begin t := (9.0*x - 28.0)/(x + 28.0); sfd_airy_gi := CSEvalD(t,argip1,ntip1); end else begin {x > 7} sfd_airy_gi := gipos7(x); end; end; {---------------------------------------------------------------------------} {---------------------------------------------------------------------------} {---------------------------------------------------------------------------} function ber_sm(x: double): double; {-Return the Kelvin function ber(x), 0<=x<20} var f,s,t,x4: double; k: integer; begin {Ref: HMF [1], 9.9.10} k := 1; s := 1.0; t := 1.0; x4:= -0.0625*sqr(sqr(x)); repeat f := sqr(2*k); f := f*sqr(2*k-1); t := t/f*x4; s := s+t; k := k+1; until abs(t) < eps_d*abs(s); ber_sm := s; end; {---------------------------------------------------------------------------} function bei_sm(x: double): double; {-Return the Kelvin function bei(x), 0<=x<20} var f,s,t,x4: double; k: integer; begin {Ref: HMF [1], 9.9.10} k := 1; t := 0.25*sqr(x); s := t; x4:= -sqr(t); repeat f := sqr(2*k); f := f*sqr(2*k+1); t := t/f*x4; s := s+t; k := k+1; until abs(t) < eps_d*abs(s); bei_sm := s; end; {---------------------------------------------------------------------------} function ker_sm(x: double): double; {-Return the Kelvin function ker(x), 0<x<3} var f,h,s,t,x4: double; k: integer; begin {Ref: HMF [1], 9.9.12} k := 1; h := 0.0; t := 1.0; x := abs(x); x4:= -0.0625*sqr(sqr(x)); s := Pi_4*bei_sm(x); f := ln(0.5*x) + EulerGamma; {bei/ber are accurate, but the cancellation for s is too large for x>3} s := s - f*ber_sm(x); repeat f := sqr(2*k); f := f*sqr(2*k-1); t := t/f*x4; h := h + (one_d/(2*k) + one_d/(2*k-1)); f := t*h; s := s+f; k := k+1; until abs(f) < eps_d*abs(s); ker_sm := s; end; {---------------------------------------------------------------------------} function kei_sm(x: double): double; {-Return the Kelvin function kei(x), 0<x<3} var f,h,s,t,x4: double; k: integer; begin {Ref: HMF [1], 9.9.12} k := 1; h := 1.0; t := 0.25*sqr(x); x := abs(x); x4:= -sqr(t); f := ln(0.5*x) + EulerGamma; s := t - Pi_4*ber_sm(x); {bei/ber are accurate, but the cancellation for s is too large for x>3} s := s - f*bei_sm(x); repeat f := sqr(2*k); f := f*sqr(2*k+1); t := t/f*x4; h := h + (one_d/(2*k) + one_d/(2*k+1)); f := t*h; s := s+f; k := k+1; until abs(f) < eps_d*abs(s); kei_sm := s; end; {---------------------------------------------------------------------------} procedure kelvin_large(x: double; cb: boolean; var br, bi, kr, ki: double); {-Return all four Kelvin functions for x >= 20 using asymptotic expansions} { ker/kei are always calculated, ber/bei only if cb=true} var f0p, {f0(+x)} f0n, {f0(-x)} g0p, {g0(+x)} g0n, {g0(-x)} tk, {term k} tc, {cos() term} ts, {sin() term} fac,xt: double; k: integer; cbp, {calc f0p,f0p} ckn: boolean; {calc f0n,g0n} const kmax = 40; {Note: for k > 2*x the terms are increasing} xlarge = 1003.7843389; {>~ ln_MaxDbl*sqrt(2)} const skp4hx: array[0..7] of THexDblW = ( { sin(k*Pi/4), k=0..7 } ($0000,$0000,$0000,$0000), {+0.0000000000000000000 } ($3BCD,$667F,$A09E,$3FE6), {+0.70710678118654757274} ($0000,$0000,$0000,$3FF0), {+1.0000000000000000000 } ($3BCD,$667F,$A09E,$3FE6), {+0.70710678118654757274} ($0000,$0000,$0000,$0000), {+0.0000000000000000000 } ($3BCD,$667F,$A09E,$BFE6), {-0.70710678118654757274} ($0000,$0000,$0000,$BFF0), {-1.0000000000000000000 } ($3BCD,$667F,$A09E,$BFE6)); {-0.70710678118654757274} var sinkp4: array[0..7] of double absolute skp4hx; begin if x > xlarge then begin kr := 0.0; ki := 0.0; if cb then begin {may NaN_d?} br := PosInf_d; bi := PosInf_d; end; exit; end; {The functions are calculated using formula from HMF[1], section 9.10} {with nu=0 and x >= 20.} f0p := 1.0; {k=0 term of sum for function f0(+x): 9.10.6} f0n := 1.0; {k=0 term of sum for function f0(-x): 9.10.6} g0p := 0.0; {k=0 term of sum for function g0(+x): 9.10.7} g0n := 0.0; {k=0 term of sum for function g0(-x): 9.10.7} tk := 1.0; {term k of sum = prod(2j-1, j=1..k)/k!/(8x)^k} fac := 1.0; {factor (+-)^k} cbp := cb; {calc ber/bei} ckn := true; {calc ker/kei} xt := 8.0*x; k := 0; while (k<kmax) and (cbp or ckn) do begin fac := -fac; inc(k); tk := tk*sqr(2*k-1)/xt/k; {term k = prod(2j-1, j=1..k)/k!/(8x)^k} tc := tk*sinkp4[(k+2) and 7]; {tk*cos(k*Pi/4)} ts := tk*sinkp4[k and 7]; {tk*sin(k*Pi/4)} if ckn then begin f0n := f0n + fac*tc; {update and conv check f0(-x), g0(-x)} g0n := g0n + fac*ts; ckn := tk >= eps_d*mind(abs(f0n), abs(g0n)); end; if cbp then begin f0p := f0p + tc; {update and conv check f0(+x), g0(+x)} g0p := g0p + ts; cbp := tk >= eps_d*mind(abs(f0p),abs(g0p)); end; end; xt := x/sqrt(2.0); if xt>=ln_MaxDbl then tk := PosInf_d else tk := exp(xt); {get sin(beta), cos(beta), beta = x/sqrt(2) + Pi/8, HMF 9.10.5} sincos(xt + 0.125*Pi, ts, tc); fac := sqrt(Pi_2/x)/tk; kr := fac*(f0n*tc - g0n*ts); {HMF 9.10.3} ki := -fac*(f0n*ts + g0n*tc); {HMF 9.10.4} if cb then begin {get sin(alpha), cos(alpha), alpha = x/sqrt(2) - Pi/8, HMF 9.10.5} sincos(xt - 0.125*Pi, ts, tc); fac := tk/sqrt(TwoPi*x); br := fac*(f0p*tc + g0p*ts) - ki/Pi; {HMF 9.10.1} bi := fac*(f0p*ts - g0p*tc) + kr/Pi; {HMF 9.10.2} end; end; {---------------------------------------------------------------------------} procedure ker_kei_med(x: double; var kr, ki: double); {-Return Kelvin function kr=ker(x), ki=kei(x), 3<=x<=20} var fac,ts,tc,f0,g0,z: double; const csfh: array[0..22] of THexDblW = ( ($C04A,$5098,$4C28,$BFC6), {-1.7419914183983770261E-1} ($B127,$B921,$57F3,$3F5A), {+1.6078834637723389439E-3} ($4377,$1064,$51B7,$3F31), {+2.6427001320521815227E-4} ($698F,$2A53,$0BCA,$BF09), {-4.7771555992520623486E-5} ($2A55,$CEE7,$54A8,$3EDA), {+6.2777282736162430502E-6} ($2C87,$2D00,$225A,$BEA8), {-7.1925486544564774167E-7} ($6E0A,$2300,$FF00,$3E71), {+6.7040681229020080687E-8} ($ECEF,$CF02,$C320,$BE26), {-2.6498710934646215641E-9} ($9120,$8D49,$B2D2,$BE10), {-9.7198209650154837839E-10} ($7CBC,$2077,$7F40,$3DFB), {+4.0013506437635697668E-10} ($8509,$BEDF,$2A95,$BDDD), {-1.0610655385424269996E-10} ($9DB5,$94AC,$13D6,$3DBA), {+2.3717341712233160606E-11} ($79AB,$951F,$9973,$BD94), {-4.6837658144710679937E-12} ($605A,$0E80,$13C8,$3D6C), {+7.9800404853834490867E-13} ($C572,$4674,$8F29,$BD3C), {-1.0146274419705259356E-13} ($A5B4,$0E9E,$E14A,$3CD6), {+1.2700971536601990071E-15} ($5DCD,$5F41,$F7F8,$3CF7), {+5.3221057799364269748E-15} ($CA08,$E4CE,$4992,$BCE7), {-2.5854205078178475222E-15} ($A386,$5612,$5440,$3CD0), {+9.0644751109753703700E-16} ($88D8,$6EBA,$BE83,$BCB3), {-2.7400572090870253519E-16} ($CDBA,$2896,$86FC,$3C95), {+7.4687773792482686324E-17} ($95E9,$EFC6,$3F6A,$BC75), {-1.8429464094897889406E-17} ($540D,$56CE,$67AE,$3C52)); {+3.9909490541622123671E-18} (* ($1EC1,$5D56,$E272,$BC28), {-6.7449728433925005994E-19} ($EA4E,$857E,$3FC1,$3BE6), {+3.7691351120612689369E-20} ($4C61,$1C8C,$3954,$3BE6)); {+3.7648818270236777832E-20} *) const csgh: array[0..22] of THexDblW = ( ($9306,$B82F,$1F46,$BFC4), {-1.5720447534035757322E-1} ($3083,$F78E,$D1DB,$3F82), {+9.1893372462197369193E-3} ($EBAB,$C263,$91B8,$BF42), {-5.6668778850565061864E-4} ($A996,$BCE4,$DA66,$3EFF), {+3.0377512126347748295E-5} ($1700,$202A,$721A,$BE8A), {-1.9703590233373688640E-7} ($16B1,$6792,$EC85,$BE98), {-3.7139520931598000832E-7} ($BE82,$6625,$D21D,$3E79), {+9.6189830799939401844E-8} ($BF8F,$06C4,$D6C9,$BE53), {-1.8476513139939364061E-8} ($668E,$CDA3,$527C,$3E2A), {+3.0643093454233132330E-9} ($AA49,$DA51,$FBA3,$BDFD), {-4.3630962238885554609E-10} ($1584,$33AF,$1CC4,$3DC9), {+4.5679132751061958419E-11} ($3B94,$3CD8,$C9BA,$3D3A), {+9.5170086962745579158E-14} ($A98E,$7079,$9E74,$BD81), {-2.0030443265088914950E-12} ($9816,$AF58,$9B88,$3D6C), {+8.1307559857898340689E-13} ($6D25,$1572,$2BAB,$BD51), {-2.4400860754197408382E-13} ($E764,$60D2,$D560,$3D31), {+6.3357326016347255195E-14} ($8A2A,$82BE,$96B9,$BD10), {-1.4733785897064301269E-14} ($944F,$C8D9,$4931,$3CEB), {+3.0293452082666044179E-15} ($CE9D,$5193,$4D06,$BCC2), {-5.0795139386674074074E-16} ($6924,$6579,$0168,$3C8A), {+4.5112349988246225192E-17} ($766C,$3E3B,$231D,$3C6F), {+1.3503592759696792310E-17} ($A631,$01D4,$16BC,$BC68), {-1.0446854432502786340E-17} ($51DB,$0CB6,$D987,$3C54)); {+4.5210616813281396687E-18} (* ($954A,$0257,$C3BE,$BC3D), {-1.6135431781668171227E-18} ($0540,$41D2,$FD8F,$3C22), {+5.1473764432777121521E-19} ($CE28,$3698,$2AD3,$BC06), {-1.5021136840019478519E-19} ($7BDB,$FB50,$9A05,$3BE7)); {+3.9982756711602287398E-20} *) var csf0: array[0..22] of double absolute csfh; csg0: array[0..22] of double absolute csgh; begin {Medium range ker/kei: 3 <= x <= 20. The series for small x become} {inaccurate for x >= 3 due to the difference of the ber/bei terms.} z := x/sqrt(2.0); {get sin(beta), cos(beta), beta = x/sqrt(2) + Pi/8} sincos(z + 0.125*Pi, ts, tc); fac:= sqrt(Pi_2/x)*exp(-z); {get (asymptotic functions) f0,g0 via Chebyshev expansions} z := 6.0/x - 1.0; f0 := 1.0 + CSEvalD(z,csf0,23)/x; g0 := CSEvalD(z,csg0,23)/x; kr := fac*(f0*tc - g0*ts); ki := -fac*(f0*ts + g0*tc); end; {---------------------------------------------------------------------------} procedure sfd_ker_kei(x: double; var kr, ki: double); {-Return the Kelvin functions kr=ker(x), ki=kei(x), x > 0} var br, bi: double; const Omg = 0.422784335098467139393488; {1-gamma} begin if IsNaND(x) or (x<=0.0) then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} kr := NaN_d; ki := NaN_d; end else if x<=1e-10 then begin kr := -(ln(0.5*x)+EulerGamma); ki := -Pi_4; end else if x<=1e-5 then begin {ker(x) = -gamma - ln(x/2) + 1/16*(Pi-3/8*x^2)*x^2 } {kei(x) = 0.25*(-Pi + (1-gamma-ln(x/2))*x^2) } br := ln(0.5*x); x := sqr(x); kr := -Eulergamma - br + 0.0625*(Pi-0.375*x)*x; ki := 0.25*((Omg - br)*x - Pi); end else if x<3.0 then begin kr := ker_sm(x); ki := kei_sm(x); end else if x<=20.0 then ker_kei_med(x,kr,ki) else kelvin_large(x,false,br,bi,kr,ki); end; {---------------------------------------------------------------------------} procedure sfd_ber_bei(x: double; var br, bi: double); {-Return the Kelvin functions br=ber(x), bi=bei(x)} var kr, ki: double; begin if IsNaNorInfD(x) then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} br := NaN_d; bi := NaN_d; end else begin x := abs(x); if x<=1e-5 then begin br := 1.0; bi := 0.25*sqr(x); end else if x<20.0 then begin br := ber_sm(x); bi := bei_sm(x); end else kelvin_large(x,true,br,bi,kr,ki); end; end; {---------------------------------------------------------------------------} function sfd_ber(x: double): double; {-Return the Kelvin function ber(x)} var br,bi,kr,ki: double; begin if IsNaNorInfD(x) then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_ber := NaN_d; end else begin x := abs(x); if x<=1e-5 then sfd_ber := 1.0 else if x<20.0 then sfd_ber := ber_sm(x) else begin kelvin_large(x,true,br,bi,kr,ki); sfd_ber := br; end; end; end; {---------------------------------------------------------------------------} function sfd_bei(x: double): double; {-Return the Kelvin function bei(x)} var br,bi,kr,ki: double; begin if IsNaNorInfD(x) then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_bei := NaN_d; end else begin x := abs(x); if x<=1e-5 then sfd_bei := 0.25*sqr(x) else if x<20.0 then sfd_bei := bei_sm(x) else begin kelvin_large(x,true,br,bi,kr,ki); sfd_bei := bi; end; end; end; {---------------------------------------------------------------------------} function sfd_ker(x: double): double; {-Return the Kelvin function ker(x), x > 0} var kr, ki: double; begin if IsNaND(x) or (x<=1e-5) or (x>=3.0) then begin sfd_ker_kei(x,kr,ki); sfd_ker := kr; end else sfd_ker := ker_sm(x); end; {---------------------------------------------------------------------------} function sfd_kei(x: double): double; {-Return the Kelvin function kei(x), x >= 0} var kr, ki: double; begin if IsNaND(x) or (x<=1e-5) or (x>=3.0) then begin if x=0.0 then sfd_kei := -Pi_4 else begin sfd_ker_kei(x,kr,ki); sfd_kei := ki; end; end else sfd_kei := kei_sm(x); end; {---------------------------------------------------------------------------} {---------------------------------------------------------------------------} {---------------------------------------------------------------------------} function sfd_struve_h0(x: double): double; {-Return H0(x), the Struve function of order 0} var t,y: double; const xlow = 0.3161013638317052384022e-7; {3*sqrt(eps_d/2)} const nh0 = 19; arrh0: array[0..nh0-1] of double = ( +0.28696487399013225740e0, -0.25405332681618352305e0, +0.20774026739323894439e0, -0.20364029560386585140e0, +0.12888469086866186016e0, -0.4825632815622261202e-1, +0.1168629347569001242e-1, -0.198118135642418416e-2, +0.24899138512421286e-3, -0.2418827913785950e-4, +0.187437547993431e-5, -0.11873346074362e-6, +0.626984943346e-8, -0.28045546793e-9, +0.1076941205e-10, -0.35904793e-12, +0.1049447e-13, -0.27119e-15, +0.624e-17); {-0.13e-18);} const nh0a = 16; arrh0a: array[0..nh0a-1] of double = ( +1.99291885751992305515e0, -0.384232668701456887e-2, -0.32871993712353050e-3, -0.2941181203703409e-4, -0.267315351987066e-5, -0.24681031075013e-6, -0.2295014861143e-7, -0.215682231833e-8, -0.20303506483e-9, -0.1934575509e-10, -0.182773144e-11, -0.17768424e-12, -0.1643296e-13, -0.171569e-14, -0.13368e-15, -0.2077e-16); { +0.2e-19, -0.55e-18, +0.10e-18, -0.4e-19, +0.1e-19);} begin if IsNaND(x) then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_struve_h0 := NaN_d; exit; end; {See MISCFUN [22], function STRVH0 for Chebyshev coefficients and hints. } {As pointed out the phase of Y0(x) is very sensitive for |x| > 1/eps_d. } {Therefore in high accuracy tests x must have exactly the same value in } {both calculations. My implementation uses Y0, [22] has two other series.} t := abs(x); if t <= 11.0 then begin if t<xlow then begin {H0(x) = 2/Pi*x*(1-1/9*x^2+1/225*x^4+O(x^5))} sfd_struve_h0 := x/Pi_2; end else begin t := sqr(x)/60.5 - 1.0; t := CSEvalD(t,arrh0,nh0); sfd_struve_h0 := 2.0*x*t/Pi; end; end else begin y := sfd_y0(t); {Correct sign if x<0 since H0 is an odd function} if x<0.0 then y := -y; if t >= 1e10 then begin {Avoid squaring overflow and/or unnecessary calculations} {H0(x) = Y0(x) + 2/Pi/x*(1 - 1/x^2 + ..} sfd_struve_h0 := y + 2.0/Pi/x; end else begin t := sqr(x); t := (302.5 - t) / (60.5 + t); t := CSEvalD(t,arrh0a,nh0a); t := t/Pi_2/x; sfd_struve_h0 := y + t; end; end; end; {---------------------------------------------------------------------------} function sfd_struve_h1(x: double): double; {-Return H1(x), the Struve function of order 1} var t,y: double; const xlow = 0.9017492053581906681e-9; {sqrt(15*eps_d/2)} const nh1 = 16; arrh1: array[0..nh1-1] of double = ( +0.17319061083675439319e0, -0.12606917591352672005e0, 0.7908576160495357500e-1, -0.3196493222321870820e-1, 0.808040581404918834e-2, -0.136000820693074148e-2, 0.16227148619889471e-3, -0.1442352451485929e-4, 0.99219525734072e-6, -0.5441628049180e-7, 0.243631662563e-8, -0.9077071338e-10, 0.285926585e-11, -0.7716975e-13, 0.180489e-14, -0.3694e-16); { 0.67e-18, -0.1e-19);} const nh1a = 18; arrh1a: array[0..nh1a-1] of double = ( +2.01083504951473379407e0, 0.592218610036099903e-2, 0.55274322698414130e-3, 0.5269873856311036e-4, 0.506374522140969e-5, 0.49028736420678e-6, 0.4763540023525e-7, 0.465258652283e-8, 0.45465166081e-9, 0.4472462193e-10, 0.437308292e-11, 0.43568368e-12, 0.4182190e-13, 0.441044e-14, 0.36391e-15, 0.5558e-16, -0.4e-19, 0.163e-17); { -0.34e-18, 0.13e-18, -0.4e-19, 0.1e-19);} begin if IsNaND(x) then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_struve_h1 := NaN_d; exit; end; {See MISCFUN [22], function STRVH1 for Chebyshev coefficients and hints.} {As pointed out the phase of Y1(x) is very sensitive for |x| > 1/eps_d. } {Therefore in high accuracy tests x must have exactly the same value in } {both calculations; for |x| > 1/eps_d^2 the uncertainty vanishes and the} {value of H1 is 2/Pi to machine precision, not 0 as in [22]. My function} {uses Y1, whereas MISCFUN has two other Chebyshev series.} t := abs(x); if t <= 9.0 then begin y := sqr(t); if t < xlow then begin {H1(x) = 2/Pi*x^2*(1/3 - 1/45*x^2 + O(x^4))} {Note that the factor 1/3 is missing in [22], but xlow is correct} sfd_struve_h1 := y/3.0/Pi_2; end else begin t := y/40.5 - 1.0; t := CSEvalD(t,arrh1,nh1); sfd_struve_h1 := y*t/Pi_2; end; end else begin if t >= 1e40 then begin {Avoid squaring overflow and/or unnecessary calculations} {H1(x) = Y1(x) + 2/Pi(1 - 1/x^2 + ...) } {H1(x) = 2/Pi - (2/Pi)^(1/2)*sin(x+Pi/4)*(1/x)^(1/2) + O((1/x)^(3/2))} sfd_struve_h1 := 2.0/Pi; end else begin y := sfd_y1(t); t := sqr(t); t := (202.5 - t) / (40.5 + t); t := CSEvalD(t,arrh1a,nh1a); sfd_struve_h1 := y + t/Pi_2; end; end; end; {---------------------------------------------------------------------------} function strv_sum(c, x: double; var err: double): double; {-Sum from Struve power series: sum(x^k/((1.5)_k*(c)_k)} var bn,cn,max,z,sum,t: double; e,y,w: double; n: integer; const NMAX = 200; label done; begin n := 0; t := 1.0; e := 0.0; bn := 1.5; cn := c; sum := 1.0; max := 0.0; {Kahan summation} while n<NMAX do begin z := bn*cn; t := t*(x/z); w := t - e; y := sum + w; e := (y - sum) - w; sum := y; z := abs(t); if z>max then max := z; if z <= eps_d*abs(sum) then goto done; bn := bn+1.0; cn := cn+1.0; inc(n); end; done: if n>=NMAX then begin {No convergence} if RTE_NoConvergence>0 then RunError(byte(RTE_NoConvergence)); end; err := max*eps_d/abs(sum); strv_sum := sum; end; {---------------------------------------------------------------------------} function strv_ae(v,x: double): double; {-Asymptotic expansion for H_v and L_v, x large (about 40 for H_v, 30 for L_v)} var s,b,c,max,z,sum,conv,conv1: double; k: integer; const KMAX = 1000; label done; begin k := 0; b := 0.5; c := 0.5-v; s := 1.0; sum := 1.0; max := 0.0; conv := Maxdouble; conv1 := conv; while k<KMAX do begin s := s*b*c*x; sum := sum + s; z := abs(s); if z > max then max := z else if (z >= conv) and (z > conv1) then goto done; if z <= eps_d*abs(sum) then goto done; conv1 := conv; conv := z; b := b+1.0; c := c+1.0; k := k+1; end; done: if k>=KMAX then begin {No convergence} if RTE_NoConvergence>0 then RunError(byte(RTE_NoConvergence)); end; strv_ae := sum; end; {---------------------------------------------------------------------------} procedure strv_int(v, x: double; var result,abserr: double; var ier: integer); {-Compute integral(e^(-xt)(1+t^2)^(v-0.5), t=0..INF) with custom version of } { AMTools.fdidei: Automatic quadrature over (a,INF) using Double Exponential.} const mmax = 2*64; efs = 0.1; hoff = 11.0; var eps: double; neval: longint; function f(t: double): double; var d,z: double; begin z := -t*x; if z >= ln_MinDbl then begin inc(neval); d := exp(z); z := power(1+t*t,v-0.5); f := d*z; end else f := 0; end; var m: integer; var epsln,epsh,h0,ehp,ehm,epst,ir,iv,h,iback,irback, t,ep,em,xp,xm,fp,fm,err,errt,errh,errd: double; begin result := 0.0; abserr := 0.0; neval := 0; ier := 0; eps := 8*eps_d; epsln := 1.0 - ln(efs*eps); epsh := sqrt(efs*eps); h0 := hoff/epsln; ehp := exp(h0); ehm := 1.0/ehp; epst := exp(-ehm*epsln); ir := f(1.0); neval := 1; iv := ir*pi_2; err := abs(iv)*epst; errh := 0.0; h := 2.0*h0; m := 1; repeat iback := iv; irback := ir; t := 0.5*h; repeat em := exp(t); ep := pi_4*em; em := pi_4/em; repeat xp := exp(ep-em); xm := 1.0/xp; fp := f(xp); fm := f(xm); fp := fp*xp; fm := fm*xm; ir := ir + (fp+fm); iv := iv + (fp+fm)*(ep+em); errt:= (abs(fp) + abs(fm))*(ep+em); if m=1 then err := err + errt*epst; ep := ep*ehp; em := em*ehm; until (errt <= err) and (xm <= epsh); t := t + h; until t >= h0; if m=1 then begin errh := (err/epst)*epsh*h0; errd := 1.0 + 2.0*errh; end else errd := h*(abs(iv - 2.0*iback) + 4.0*abs(ir - 2.0*irback)); h := 0.5*h; m := m+m; until (errd <= errh) or (m >= mmax); result := h*iv; if errd > errh then begin ier := 3; abserr := errd*m; end else abserr := 0.5*errh*epsh*m/efs; end; {---------------------------------------------------------------------------} function sfd_struve_h(v,x: double): double; {-Return H_v(x), the Struve function of order v >= 0, x < 0 only if v is an integer.} var g,p,f,y,z,err: double; ier: integer; begin if IsNaNorInfD(x) or (v<0.0) or ((x<0.0) and (frac(v)<>0.0)) then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_struve_h := NaN_d; exit; end; if x=0.0 then sfd_struve_h := 0.0 else if v=0.0 then sfd_struve_h := sfd_struve_h0(x) else if v=1.0 then sfd_struve_h := sfd_struve_h1(x) else if v=0.5 then sfd_struve_h := vers(x)/sqrt(Pi_2*x) {HMF[1],12.1.16} else begin {First compute H_v for |x|} z := abs(x); p := power(0.5*z, v-1.0); if (z>=maxd(20,v)) or (z >= maxd(4,3*v)) then begin g := sfd_gamma(v+0.5); if z < maxd(40, 1.5*v) then begin strv_int(v,z,f,err,ier); f := z*f*p/(sqrtPI*g); end else begin f := strv_ae(v, -sqr(2.0/z)); f := f*p/(sqrtPI*g); end; y := sfd_yv(v,z); f := f + y; end else begin y := 0.25*z*z; f := strv_sum(1.5+v, -y, err); g := sfd_gamma(v + 1.5); f := y*p*f/(0.5*sqrtPI*g); end; if (x<0.0) and (f<>0.0) and (frac(0.5*v)=0.0) then f := -f; sfd_struve_h := f; end; end; {---------------------------------------------------------------------------} function sfd_struve_l(v, x: double): double; {-Return L_v(x), the modified Struve function of order v >= 0, x < 0 only if v is an integer.} var f,g,z,p,err: double; begin if IsNaNorInfD(x) or (v<0.0) or ((x<0.0) and (frac(v)<>0.0)) then begin {$ifopt R+} if RTE_ArgumentRange>0 then RunError(byte(RTE_ArgumentRange)); {$endif} sfd_struve_l := NaN_d; exit; end; if x=0.0 then sfd_struve_l := 0.0 else if v=0.5 then sfd_struve_l := coshm1(x)/sqrt(Pi_2*x) {NIST[30],11.4.7} else begin z := abs(x); p := power(0.5*z, v-1.0); if z >= maxd(30,1.5*v) then begin g := sfd_gamma(v+0.5); f := strv_ae(v,sqr(2.0/z)); f := f*p/(sqrtPI*g); z := sfd_iv(-v,z); f := z - f; end else begin g := sfd_gamma(v + 1.5); z := sqr(0.5*z); f := strv_sum(1.5+v, z, err); f := f*p*z/(0.5*SqrtPi*g); end; if (x<0.0) and (f<>0.0) and (frac(0.5*v)=0.0) then f := -f; sfd_struve_l := f; end; end; {---------------------------------------------------------------------------} function sfd_struve_l0(x: double): double; {-Return L0(x), the modified Struve function of order 0} begin sfd_struve_l0 := sfd_struve_l(0,x); end; {---------------------------------------------------------------------------} function sfd_struve_l1(x: double): double; {-Return L1(x), the modified Struve function of order 1} begin sfd_struve_l1 := sfd_struve_l(1,x); end; end.
{Demo to illustrate the use of the OnStreamRequest and OnImageRequest events with TFrameViewer. For the purpose of this demo, the streams are obtained from existing files, the demo.htm files in the C:\THTML(Demo) directory (assiming the default installation is used). Usage: Enter the Base path where the demo.htm files are located in the TEdit control and press "Load Demo.htm". } unit Unit1; {$IFDEF FPC} {$MODE Delphi} {$ENDIF} interface uses {$IFNDEF FPC} Windows, {$ELSE} LCLIntf, LCLType, LMessages, {$ENDIF} Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, FramView, ReadHTML; type TForm1 = class(TForm) FrameViewer: TFrameViewer; Panel1: TPanel; LoadButton: TButton; Edit1: TEdit; Label1: TLabel; procedure LoadButtonClick(Sender: TObject); procedure FrameViewerStreamRequest(Sender: TObject; const SRC: String; var Stream: TStream); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure FrameViewerImageRequest(Sender: TObject; const SRC: String; var Stream: TMemoryStream); private { Private declarations } AStream: TMemoryStream; Base: string; public { Public declarations } end; var Form1: TForm1; implementation {$IFNDEF FPC} {$R *.dfm} {$ELSE} {$R *.lfm} {$ENDIF} procedure TForm1.FormCreate(Sender: TObject); begin {create general purpose Stream} AStream := TMemoryStream.Create; end; procedure TForm1.FormDestroy(Sender: TObject); begin AStream.Free; end; procedure TForm1.LoadButtonClick(Sender: TObject); begin {read the Base} Base := Edit1.Text; {start with the "Load" method} FrameViewer.Load('Demo.htm'); end; procedure TForm1.FrameViewerStreamRequest(Sender: TObject; const SRC: String; var Stream: TStream); {this is the OnStreamRequest handler} var Name: string; S: AnsiString; begin if Pos(':', Src) = 0 then {don't add Base if filename already complete} Name := Base+Src else Name := Src; try AStream.LoadFromFile(Name); except S := 'Cannot load '+Name; AStream.Clear; AStream.Write(S[1], Length(S)); end; Stream := AStream; end; procedure TForm1.FrameViewerImageRequest(Sender: TObject; const SRC: String; var Stream: TMemoryStream); {this is the OnImageRequest handler} var Name: string; begin if Pos(':', Src) = 0 then {don't add Base if filename already complete} Name := Base+Src else Name := Src; try AStream.LoadFromFile(Base+Src); Stream := AStream; except Stream := Nil; end; end; end.
(* TOPOLOGICAL SORT from Wirth's Book *) PROGRAM topsort(input,output); TYPE lref = ^leader; tref = ^trailer; leader = RECORD key : INTEGER; count: INTEGER; trail: tref; next : lref; END; trailer = RECORD id : lref; next : tref END; VAR head,tail,p,q: lref; t: tref; z: INTEGER; x,y: INTEGER; FUNCTION L(w: INTEGER): lref; (* reference to leader with key w *) VAR h : lref; BEGIN h := head; tail^.key := w; (*sentinel*) WHILE h^.key <> w DO H := h^.next; IF h = tail THEN BEGIN (* no element with key w in the list *) new(tail); z := z + 1; h^.count := 0; h^.trail := NIL; h^.next := tail END; L := h END (*L*); BEGIN (*initialize list of leaders with a dummy *) New(head); tail := head; z := 0; (* input phase *) Read(x); WHILE x <> 0 DO BEGIN Read(y); Writeln(x,y); p := L(x); q := L(y); New(t); t^.id := q; t^.next := p^.trail; p^.trail := t; q^.count := q^.count + 1; Read(x) END; (* search for leaders with count = 0 *) p := head; head := NIL; WHILE p <> tail DO BEGIN q := p; p := p^.next; IF q^.count = 0 THEN BEGIN q^.next := head; head := q END END; (* output phase *) q := head; WHILE q <> NIL DO BEGIN Writeln(q^.key); z := z - 1; t := q^.trail; q := q^.next; WHILE t <> NIL DO BEGIN p:= t^.id; p^.count := p^.count - 1; IF p^.count = 0 THEN BEGIN (* insert p^ in q-list *) p^.next := q; q := p END; t:= t^.next END END; IF z <> 0 THEN Writeln('This Set is NOT partially Ordered') END.
unit mod_tappymath; {$mode objfpc}{$H+} interface uses Classes, SysUtils, Types, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, // LCL ExtCtrls, LCLIntf, LCLType, // TappyTux tappyconfig, tappydrawer, tappymodules; type { TTappyMath } TTappyMath = class(TTappyModule) private gameScore : Integer; gameLives : Integer; gameLevel : Integer; gameSLevel : Integer; gameSndFX : Boolean; gameMusic : Boolean; gameQuestionList : TStringList; questionType : array[1..3] of Integer; questionAnswer : array[1..5] of Integer; count : Integer; timerMath : TTimer; procedure HandleOnTimer(Sender: TObject); public constructor Create; override; destructor Destroy; override; procedure TranslateTextsToEnglish; override; procedure TranslateTextsToPortuguese; override; procedure StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer); override; procedure CreateQuestion(); override; function GetFallingDurationFromLevel: Integer; procedure Answered(AText: string); override; procedure EndGame(); override; procedure GameWon(); override; procedure GameLost(); override; procedure ProcessFallingTextEnd(); override; procedure ProcessSpriteEnd(AUserData: TObject; APosition: TPoint); override; end; implementation { TTappyMath } procedure TTappyMath.HandleOnTimer(Sender: TObject); var i: Integer; j: Integer; frequency: Integer; snowmanWrong: TFallingText; lAnimation: TTappyTuxAnimation; begin frequency := 60; count := count + 1; if count >= frequency then begin count := 0; CreateQuestion(); end; vTappyTuxDrawer.HandleAnimationOnTimer(timerMath.Interval); end; constructor TTappyMath.Create; begin inherited Create; timerMath := TTimer.Create(nil); timerMath.Enabled := False; timerMath.Interval := 1000; timerMath.OnTimer := @HandleOnTimer; end; destructor TTappyMath.Destroy; begin timerMath.Free; inherited Destroy; end; procedure TTappyMath.TranslateTextsToEnglish; begin ShortDescription := 'TappyMath'; LongDescription := 'A game to learn arithmetics'; end; procedure TTappyMath.TranslateTextsToPortuguese; begin ShortDescription := 'TappyMath'; LongDescription := 'Um jogo para aprender aritmética'; end; procedure TTappyMath.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer); var i: Integer; lTuxAnimation: TTappySpriteAnimation; begin count := 0; timerMath.Enabled := True; timerMath.Interval:= 100; gameScore := 0; gameLives := 5; gameLevel := Level+1; if (Level < 0) then gameLevel := 1; if (SndFX <= 0) then gameSndFX := true; if (SndFX = 1) then gameSndFX := false; if (Music <= 0) then gameMusic := true; if (Music = 1) then gameMusic := false; gameSLevel := gameLevel; UpdateLevel(gameLevel); UpdateScore(gameScore); UpdateLives(gameLives); // Animations Creation lTuxAnimation := TTappySpriteAnimation.Create; lTuxAnimation.IsInfinite := True; lTuxAnimation.StartPoint := Point(250, 328); lTuxAnimation.EndPoint := lTuxAnimation.StartPoint; SetLength(lTuxAnimation.Images, 6); lTuxAnimation.LoadImageFromPng(0, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_1.png'); lTuxAnimation.LoadImageFromPng(1, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_2.png'); lTuxAnimation.LoadImageFromPng(2, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_3.png'); lTuxAnimation.LoadImageFromPng(3, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_4.png'); lTuxAnimation.LoadImageFromPng(4, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_3.png'); lTuxAnimation.LoadImageFromPng(5, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_2.png'); vTappyTuxDrawer.AddAnimation(lTuxAnimation); for i:= 1 to 5 do begin CreateQuestion; end end; procedure TTappyMath.CreateQuestion; var i: Integer; j: Integer; xAux: Integer; yAux: Integer; heightAux: array [0..4] of integer; existenceAux: array [0..4] of boolean; snowmanAnimation: TFallingText; begin for i:= 0 to 4 do begin existenceAux[i]:= False; heightAux[i] := 500; end; xAux:=5; yAux:=5; snowmanAnimation := TFallingText.Create; for i:= 0 to vTappyTuxDrawer.GetAnimationCount - 1 do begin if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then begin for j:= 0 to 4 do begin if vTappyTuxDrawer.GetAnimation(i).StartPoint.X = 5+(103*j) then begin existenceAux[j] := True; if vTappyTuxDrawer.GetAnimation(i).Position.Y < heightAux[j] then heightAux[j] := vTappyTuxDrawer.GetAnimation(i).Position.Y; end; end; end; end; for i:= 0 to 4 do begin if heightAux[i] > yAux then begin yAux := heightAux[i]; xAux := 5 + i*103; end; end; if existenceAux[0] = false then xAux := 5 else begin if existenceAux[1] = false then xAux := 108 else begin if existenceAux[2] = false then xAux := 211 else begin if existenceAux[3] = false then xAux := 314 else begin if existenceAux[4] = false then xAux := 417 end; end; end; end; snowmanAnimation.StartPoint := Point(xAux, 5); snowmanAnimation.EndPoint := Point(xAux, 270); snowmanAnimation.StepCount := GetFallingDurationFromLevel(); snowmanAnimation.IsInfinite:= false; snowmanAnimation.LoadImageFromPng(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowman.png'); //snowmanAnimation.caption:= gameQuestionList[random(gameQuestionList.Count - 1)]; questionType[1] := random(3); Case questionType[1] of 0: begin questionType[2] := random(21); questionType[3] := random(21); snowmanAnimation.value := (questionType[2] + questionType[3]); snowmanAnimation.caption := IntToStr(questionType[2])+' + ' +IntToStr(questionType[3]); end; 1: begin questionType[2] := random(21); questionType[3] := random(questionType[2]); snowmanAnimation.value := (questionType[2] - questionType[3]); snowmanAnimation.caption := IntToStr(questionType[2])+' - ' +IntToStr(questionType[3]); end; 2: begin questionType[2] := random(11); questionType[3] := random(11); snowmanAnimation.value := (questionType[2] * questionType[3]); snowmanAnimation.caption := IntToStr(questionType[2])+' x ' +IntToStr(questionType[3]); end; end; vTappyTuxDrawer.AddAnimation(snowmanAnimation); end; function TTappyMath.GetFallingDurationFromLevel: Integer; begin case gameLevel of 1: Result := 25000; 2: Result := 20000; 3: Result := 15000; 4: Result := 10000; else Result := 7000; end; end; procedure TTappyMath.Answered(AText: string); var i: Integer; j: Integer; lAnimation: TTappyTuxAnimation; hammer: TTappySpriteAnimation; begin i:= 0; j:= vTappyTuxDrawer.GetAnimationCount - 1; while (i<= j) do begin lAnimation := vTappyTuxDrawer.GetAnimation(i); if lAnimation is TFallingText then begin if TFallingText(lAnimation).value = StrToInt(AText) then begin gameScore := gameScore +1; gameLevel := (gameScore div 20) + gameSLevel; UpdateScore(gameScore); UpdateLevel(gameLevel); lAnimation.Stopped := True; hammer := TTappySpriteAnimation.Create; hammer.IsInfinite := False; hammer.StartPoint := Point(250, 328); hammer.EndPoint := lAnimation.Position; hammer.StepCount := 1000; hammer.SpriteChangeInterval := 200; SetLength(hammer.Images, 4); hammer.LoadImageFromPng(0, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'hammer_1.png'); hammer.LoadImageFromPng(1, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'hammer_2.png'); hammer.LoadImageFromPng(2, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'hammer_3.png'); hammer.LoadImageFromPng(3, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'hammer_4.png'); hammer.UserData := lAnimation; hammer.UserPosition := lAnimation.Position; vTappyTuxDrawer.AddAnimation(hammer); end; end; i := i + 1; j := vTappyTuxDrawer.GetAnimationCount - 1; end; end; procedure TTappyMath.EndGame; var i : Integer; j : Integer; gameOverScreen: TTappySpriteAnimation; continueBtn: TButton; exitBtn: TButton; begin timerMath.Enabled := False; i:= 0; j:= vTappyTuxDrawer.GetAnimationCount - 1; while (i<= j) do begin vTappyTuxDrawer.RemoveAnimation(i); j := vTappyTuxDrawer.GetAnimationCount - 1; end; GoToConfigForm(); end; procedure TTappyMath.GameWon; var lRes: Integer; begin timerMath.Enabled := False; // Now check what the user desires to do lRes := Application.MessageBox( 'Congratulations, you have won the game =D Would you like to play again?', '', MB_YESNO); if lRes = ID_YES then RestartGame() else EndGame(); end; procedure TTappyMath.GameLost; var lRes: Integer; begin timerMath.Enabled := False; // Now check what the user desires to do lRes := Application.MessageBox( 'Unfortunately you have lost =P Would you like to play again?', '', MB_YESNO); if lRes = ID_YES then RestartGame() else EndGame(); end; procedure TTappyMath.ProcessFallingTextEnd; begin gameLives := gameLives - 1; UpdateLives(gameLives); if gameLives <= 0 then GameLost(); end; procedure TTappyMath.ProcessSpriteEnd(AUserData: TObject; APosition: TPoint); var snowmanRight: TFallingText; lIndex: Integer; begin snowmanRight := TFallingText.Create; snowmanRight.IsInfinite := False; snowmanRight.StartPoint := APosition; snowmanRight.EndPoint := APosition; snowmanRight.Position := APosition; snowmanRight.StepCount := 2000; snowmanRight.LoadImageFromPng(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowmanright.png'); snowmanRight.caption:= 'OK!'; snowmanRight.ProcessOnEnd := False; vTappyTuxDrawer.AddAnimation(snowmanRight); lIndex := vTappyTuxDrawer.GetAnimationIndex(TTappyTuxAnimation(AUserData)); if lIndex >= 0 then vTappyTuxDrawer.RemoveAnimation(lIndex); end; initialization AddModule(TTappyMath.Create); end.
program lil2; {$mode objfpc}{$H+} { QEMU VersatilePB Application } { Add your program code below, add additional units to the "uses" section if } { required and create new units by selecting File, New Unit from the menu. } { } { To compile your program select Run, Compile (or Run, Build) from the menu. } uses QEMUVersatilePB, GlobalConfig, GlobalConst, GlobalTypes, Platform, Threads, SysUtils, Classes, Console, Shell, GraphicsConsole, Framebuffer, Services, FileSystem, {Include the file system core and interfaces} FATFS, {Include the FAT file system driver} MMC, {Include the MMC/SD core to access our SD card} FPimage, FPReadPNG, FPReadJPEG, FPReadBMP, FPReadTIFF, FPReadGIF, FPReadTGA, FPReadPCX, FPReadPSD, uCanvas, freetypeh, fplil, Ultibo { Add additional units here }; const BACK_COLOUR = $FF055A93; var Running: Boolean = True; Console1 : TWindowHandle; Console2 : TWindowHandle; BGnd : TCanvas; aCanvas : TCanvas; anImage : TFPCustomImage; DefFrameBuff : PFrameBufferDevice; Properties : TWindowProperties; function FncWriteChar(LIL: TLIL; Args: TLILFunctionProcArgs): TLILValue; begin if Length(Args)=0 then exit(nil); Write(Chr(Args[0].IntegerValue)); Result:=nil; end; function FncReadLine(LIL: TLIL; Args: TLILFunctionProcArgs): TLILValue; var Line: string; begin Readln(Line); Result:=TLIL.AllocString(Line); end; procedure REPL; var Command: string; LIL: TLIL; RetVal: TLILValue; begin LIL:=TLIL.Create(nil); LIL.Register('writechar', @FncWriteChar); LIL.Register('readline', @FncReadLine); while Running do begin Write('# '); ReadLn(Command); if Command='' then continue; RetVal:=LIL.Parse(Command); if LIL.Error then begin WriteLn('Error: ' + LIL.ErrorMessage); end; if RetVal <> nil then begin if (not LIL.Error) and (RetVal.Length > 0) then WriteLn(RetVal.StringValue); RetVal.Free; end; end; LIL.Free; end; procedure NonInteractive; var LIL: TLIL; FileName: string; ArgList: TLILList; Args, Result: TLILValue; TmpCode: string; i: Integer; begin LIL:=TLIL.Create(nil); LIL.Register('writechar', @FncWriteChar); LIL.Register('readline', @FncReadLine); FileName:=ParamStr(1); ArgList:=TLILList.Create; for i:=2 to ParamCount do ArgList.AddString(ParamStr(i)); Args:=ArgList.ToValue; FreeAndNil(ArgList); LIL.SetVar('argv', Args, lsvlGlobal); FreeAndNil(Args); TmpCode:='set __lilmain:code__ [read {' + FileName + '}]'#10'if [streq $__lilmain:code__ ''] {print There is no code in the file or the file does not exist} {eval $__lilmain:code__}'#10; Result:=LIL.Parse(TmpCode); FreeAndNil(Result); if LIL.Error then WriteLn('lil: error at ', LIL.ErrorHead, ': ', LIL.ErrorMessage); FreeAndNil(LIL); end; begin Console1 := ConsoleWindowCreate (ConsoleDeviceGetDefault, CONSOLE_POSITION_LEFT, true); Console2 := GraphicsWindowCreate(ConsoleDeviceGetDefault,CONSOLE_POSITION_RIGHT); GraphicsWindowSetBackcolor (Console2, BACK_COLOUR); GraphicsWindowClear (Console2); DefFrameBuff := FramebufferDeviceGetDefault; aCanvas := TCanvas.Create; if GraphicsWindowGetProperties (Console2, @Properties) = ERROR_SUCCESS then begin aCanvas.Left := Properties.X1; aCanvas.Top := Properties.Y1; aCanvas.SetSize (Properties.X2 - Properties.X1, Properties.Y2 - Properties.Y1 , COLOR_FORMAT_ARGB32); end; aCanvas.Fill (BACK_COLOUR); aCanvas.Flush (DefFrameBuff); // renamed draw to flush if ParamCount=0 then begin ConsoleWindowWriteLn(Console1,'FreePascal implementation of LIL'); ConsoleWindowWriteLn(Console1,'Type "exit" to exit'); ConsoleWindowWriteLn(Console1,' '); REPL; //ConsoleWindowWriteLn(Console1,'Exited LIL'); end else NonInteractive; ThreadHalt (0); end.
unit CustomersServices; interface uses System.Generics.Collections, Customer, CustomersTDGU, System.SysUtils, Commons; type TServiceBase = class abstract strict protected FDM: TCustomersTDG; public constructor Create(DM: TCustomersTDG); virtual; procedure Commit; procedure Rollback; procedure StartTransaction; end; TCustomersService = class(TServiceBase) public function GetAll: TObjectList<TCustomer>; function GetByID(const AID: Integer): TCustomer; procedure Delete(Customer: TCustomer); procedure Add(Customer: TCustomer); procedure Update(Customer: TCustomer); end; implementation uses ObjectsMappers, FireDAC.Stan.Option, FireDAC.Comp.Client, FireDAC.Stan.Param; { TArticoliService } procedure TCustomersService.Add(Customer: TCustomer); var Cmd: TFDCustomCommand; begin Customer.CheckInsert; Cmd := FDM.updCustomers.Commands[arInsert]; Mapper.ObjectToFDParameters(Cmd.Params, Customer, 'NEW_'); Cmd.OpenOrExecute; end; procedure TCustomersService.Delete(Customer: TCustomer); var Cmd: TFDCustomCommand; begin Customer.CheckDelete; Cmd := FDM.updCustomers.Commands[arDelete]; Mapper.ObjectToFDParameters(Cmd.Params, Customer, 'OLD_'); Cmd.Execute; end; function TCustomersService.GetAll: TObjectList<TCustomer>; begin FDM.dsCustomers.Open('SELECT * FROM CUSTOMERS ORDER BY ID'); Result := FDM.dsCustomers.AsObjectList<TCustomer>; FDM.dsCustomers.Close; end; function TCustomersService.GetByID(const AID: Integer): TCustomer; begin Result := nil; FDM.dsCustomers.Open('SELECT * FROM CUSTOMERS WHERE ID = :ID', [AID]); try if not FDM.dsCustomers.Eof then Result := FDM.dsCustomers.AsObject<TCustomer> else raise EServiceException.Create('Customer not found'); finally FDM.dsCustomers.Close; end; end; procedure TCustomersService.Update(Customer: TCustomer); var Cmd: TFDCustomCommand; begin Customer.CheckUpdate; Cmd := FDM.updCustomers.Commands[arUpdate]; Mapper.ObjectToFDParameters(Cmd.Params, Customer, 'NEW_'); Cmd.ParamByName('OLD_ID').AsInteger := Customer.ID; Cmd.Execute; if Cmd.RowsAffected <> 1 then raise Exception.Create('Customer not found'); end; { TServiceBase } procedure TServiceBase.Commit; begin FDM.fdConnection1.Commit; end; constructor TServiceBase.Create(DM: TCustomersTDG); begin inherited Create; FDM := DM; end; procedure TServiceBase.Rollback; begin FDM.fdConnection1.Rollback; end; procedure TServiceBase.StartTransaction; begin FDM.fdConnection1.StartTransaction; end; end.
unit galivan_hw; interface uses {$IFDEF WINDOWS}windows,{$ENDIF} nz80,main_engine,controls_engine,gfx_engine,dac,rom_engine,pal_engine, sound_engine,timer_engine,ym_3812; function iniciar_galivan:boolean; implementation const galivan_rom:array[0..2] of tipo_roms=( (n:'1.1b';l:$8000;p:0;crc:$1e66b3f8),(n:'2.3b';l:$4000;p:$8000;crc:$a45964f1), (n:'gv3.4b';l:$4000;p:$c000;crc:$82f0c5e6)); galivan_sound:array[0..1] of tipo_roms=( (n:'gv11.14b';l:$4000;p:0;crc:$05f1a0e3),(n:'gv12.15b';l:$8000;p:$4000;crc:$5b7a0d6d)); galivan_char:tipo_roms=(n:'gv4.13d';l:$4000;p:0;crc:$162490b4); galivan_fondo:array[0..3] of tipo_roms=( (n:'gv7.14f';l:$8000;p:0;crc:$eaa1a0db),(n:'gv8.15f';l:$8000;p:$8000;crc:$f174a41e), (n:'gv9.17f';l:$8000;p:$10000;crc:$edc60f5d),(n:'gv10.19f';l:$8000;p:$18000;crc:$41f27fca)); galivan_sprites:array[0..1] of tipo_roms=( (n:'gv14.4f';l:$8000;p:0;crc:$03e2229f),(n:'gv13.1f';l:$8000;p:$8000;crc:$bca9e66b)); galivan_bg_tiles:array[0..1] of tipo_roms=( (n:'gv6.19d';l:$4000;p:0;crc:$da38168b),(n:'gv5.17d';l:$4000;p:$4000;crc:$22492d2a)); galivan_pal:array[0..4] of tipo_roms=( (n:'mb7114e.9f';l:$100;p:0;crc:$de782b3e),(n:'mb7114e.10f';l:$100;p:$100;crc:$0ae2a857), (n:'mb7114e.11f';l:$100;p:$200;crc:$7ba8b9d1),(n:'mb7114e.2d';l:$100;p:$300;crc:$75466109), (n:'mb7114e.7f';l:$100;p:$400;crc:$06538736)); galivan_dip_a:array [0..6] of def_dip=( (mask:$3;name:'Lives';number:4;dip:((dip_val:$3;dip_name:'3'),(dip_val:$2;dip_name:'4'),(dip_val:$1;dip_name:'5'),(dip_val:$0;dip_name:'6'),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$c;name:'Bonus Life';number:4;dip:((dip_val:$c;dip_name:'20K 60K+'),(dip_val:$8;dip_name:'50K 60K+'),(dip_val:$4;dip_name:'20K 90K+'),(dip_val:$0;dip_name:'50K 90K+'),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$10;name:'Demo Sounds';number:2;dip:((dip_val:$0;dip_name:'Off'),(dip_val:$10;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$20;name:'Cabinet';number:2;dip:((dip_val:$0;dip_name:'Upright'),(dip_val:$20;dip_name:'Cocktail'),(),(),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$40;name:'Power Invulnerability';number:2;dip:((dip_val:$40;dip_name:'Off'),(dip_val:$0;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$80;name:'Life Invulnerability';number:2;dip:((dip_val:$80;dip_name:'Off'),(dip_val:$0;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),()); galivan_dip_b:array [0..4] of def_dip=( (mask:$3;name:'Coin A';number:4;dip:((dip_val:$1;dip_name:'2C 1C'),(dip_val:$3;dip_name:'1C 1C'),(dip_val:$2;dip_name:'1C 2C'),(dip_val:$0;dip_name:'Free Play'),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$c;name:'Coin B';number:4;dip:((dip_val:$0;dip_name:'3C 1C'),(dip_val:$4;dip_name:'2C 3C'),(dip_val:$c;dip_name:'1C 3C'),(dip_val:$8;dip_name:'1C 6C'),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$10;name:'Difficulty';number:2;dip:((dip_val:$10;dip_name:'Easy'),(dip_val:$0;dip_name:'Hard'),(),(),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$20;name:'Flip Screen';number:2;dip:((dip_val:$20;dip_name:'Off'),(dip_val:$0;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),()); dangar_rom:array[0..2] of tipo_roms=( (n:'8.1b';l:$8000;p:0;crc:$fe4a3fd6),(n:'9.3b';l:$4000;p:$8000;crc:$809d280f), (n:'10.4b';l:$4000;p:$c000;crc:$99a3591b)); dangar_sound:array[0..1] of tipo_roms=( (n:'13.b14';l:$4000;p:0;crc:$3e041873),(n:'14.b15';l:$8000;p:$4000;crc:$488e3463)); dangar_char:tipo_roms=(n:'5.13d';l:$4000;p:0;crc:$40cb378a); dangar_fondo:array[0..3] of tipo_roms=( (n:'1.14f';l:$8000;p:0;crc:$d59ed1f1),(n:'2.15f';l:$8000;p:$8000;crc:$dfdb931c), (n:'3.17f';l:$8000;p:$10000;crc:$6954e8c3),(n:'4.19f';l:$8000;p:$18000;crc:$4af6a8bf)); dangar_sprites:array[0..1] of tipo_roms=( (n:'12.f4';l:$8000;p:0;crc:$55711884),(n:'11.f1';l:$8000;p:$8000;crc:$8cf11419)); dangar_bg_tiles:array[0..1] of tipo_roms=( (n:'7.19d';l:$4000;p:0;crc:$6dba32cf),(n:'6.17d';l:$4000;p:$4000;crc:$6c899071)); dangar_pal:array[0..4] of tipo_roms=( (n:'82s129.9f';l:$100;p:0;crc:$b29f6a07),(n:'82s129.10f';l:$100;p:$100;crc:$c6de5ecb), (n:'82s129.11f';l:$100;p:$200;crc:$a5bbd6dc),(n:'82s129.2d';l:$100;p:$300;crc:$a4ac95a5), (n:'82s129.7f';l:$100;p:$400;crc:$29bc6216)); dangar_dip_a:array [0..5] of def_dip=( (mask:$3;name:'Lives';number:4;dip:((dip_val:$3;dip_name:'3'),(dip_val:$2;dip_name:'4'),(dip_val:$1;dip_name:'5'),(dip_val:$0;dip_name:'6'),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$c;name:'Bonus Life';number:4;dip:((dip_val:$c;dip_name:'20K 60K+'),(dip_val:$8;dip_name:'50K 60K+'),(dip_val:$4;dip_name:'20K 90K+'),(dip_val:$0;dip_name:'50K 90K+'),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$10;name:'Demo Sounds';number:2;dip:((dip_val:$0;dip_name:'Off'),(dip_val:$10;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$20;name:'Cabinet';number:2;dip:((dip_val:$0;dip_name:'Upright'),(dip_val:$20;dip_name:'Cocktail'),(),(),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$80;name:'Alternate Enemies';number:2;dip:((dip_val:$80;dip_name:'Off'),(dip_val:$0;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),()); dangar_dip_b:array [0..5] of def_dip=( (mask:$3;name:'Coin A';number:4;dip:((dip_val:$1;dip_name:'2C 1C'),(dip_val:$3;dip_name:'1C 1C'),(dip_val:$2;dip_name:'1C 2C'),(dip_val:$0;dip_name:'Free Play'),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$c;name:'Coin B';number:4;dip:((dip_val:$4;dip_name:'2C 1C'),(dip_val:$c;dip_name:'1C 1C'),(dip_val:$0;dip_name:'2C 3C'),(dip_val:$8;dip_name:'1C 2C'),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$10;name:'Difficulty';number:2;dip:((dip_val:$10;dip_name:'Easy'),(dip_val:$0;dip_name:'Hard'),(),(),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$20;name:'Flip Screen';number:2;dip:((dip_val:$20;dip_name:'Off'),(dip_val:$0;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())), (mask:$c0;name:'Allow Continue';number:4;dip:((dip_val:$c0;dip_name:'No'),(dip_val:$80;dip_name:'3 Times'),(dip_val:$40;dip_name:'5 Times'),(dip_val:$0;dip_name:'99 Times'),(),(),(),(),(),(),(),(),(),(),(),())),()); var scroll_x,scroll_y:word; rom_mem:array[0..1,0..$1fff] of byte; spritebank:array[0..$ff] of byte; layers,rom_bank,sound_latch:byte; procedure draw_sprites; var atrib,color,f:byte; x,y,nchar:word; begin for f:=0 to $3f do begin atrib:=buffer_sprites[(f*4)+2]; nchar:=buffer_sprites[(f*4)+1]+((atrib and $6) shl 7); y:=240-(buffer_sprites[(f*4)+3]-$80+((atrib and 1) shl 8)); x:=240-(buffer_sprites[f*4] and $ff); color:=((atrib and $3c) shr 2)+16*(spritebank[nchar shr 2] and $f); put_gfx_sprite(nchar and $1ff,color shl 4,(atrib and $80)<>0,(atrib and $40)<>0,2); actualiza_gfx_sprite(x,y,4,2); end; end; procedure update_video_galivan; var f,color,x,y,nchar:word; atrib:byte; begin //background if (layers and $40)<>0 then fill_full_screen(4,$100) else scroll_x_y(1,4,scroll_x,(1792-scroll_y) and $7ff); //Text if (layers and $80)=0 then begin for f:=$0 to $3ff do begin if gfx[0].buffer[f] then begin x:=f mod 32; y:=31-(f div 32); atrib:=memoria[$dc00+f]; nchar:=memoria[$d800+f] or ((atrib and 1) shl 8); color:=(atrib and $78) shl 1; put_gfx_trans(x*8,y*8,nchar,color,2,0); if (atrib and 8)<>0 then put_gfx_block_trans(x*8,y*8,3,8,8) else put_gfx_trans(x*8,y*8,nchar,color,3,0); gfx[0].buffer[f]:=false; end; end; end; if (layers and $20)<>0 then begin if (layers and $80)=0 then actualiza_trozo(0,0,256,256,2,0,0,256,256,4); draw_sprites; if (layers and $80)=0 then actualiza_trozo(0,0,256,256,3,0,0,256,256,4); end else begin if (layers and $80)=0 then actualiza_trozo(0,0,256,256,3,0,0,256,256,4); draw_sprites; if (layers and $80)=0 then actualiza_trozo(0,0,256,256,2,0,0,256,256,4); end; actualiza_trozo_final(16,0,224,256,4); end; procedure eventos_galivan; begin if event.arcade then begin //P1 if arcade_input.up[0] then marcade.in1:=(marcade.in1 and $fe) else marcade.in1:=(marcade.in1 or 1); if arcade_input.down[0] then marcade.in1:=(marcade.in1 and $fd) else marcade.in1:=(marcade.in1 or 2); if arcade_input.left[0] then marcade.in1:=(marcade.in1 and $fb) else marcade.in1:=(marcade.in1 or 4); if arcade_input.right[0] then marcade.in1:=(marcade.in1 and $f7) else marcade.in1:=(marcade.in1 or 8); if arcade_input.but0[0] then marcade.in1:=(marcade.in1 and $ef) else marcade.in1:=(marcade.in1 or $10); if arcade_input.but1[0] then marcade.in1:=(marcade.in1 and $df) else marcade.in1:=(marcade.in1 or $20); if arcade_input.but2[0] then marcade.in1:=(marcade.in1 and $7f) else marcade.in1:=(marcade.in1 or $80); //P2 if arcade_input.up[1] then marcade.in2:=(marcade.in2 and $fe) else marcade.in2:=(marcade.in2 or 1); if arcade_input.down[1] then marcade.in2:=(marcade.in2 and $fd) else marcade.in2:=(marcade.in2 or 2); if arcade_input.left[1] then marcade.in2:=(marcade.in2 and $fb) else marcade.in2:=(marcade.in2 or 4); if arcade_input.right[1] then marcade.in2:=(marcade.in2 and $f7) else marcade.in2:=(marcade.in2 or 8); if arcade_input.but0[1] then marcade.in2:=(marcade.in2 and $ef) else marcade.in2:=(marcade.in2 or $10); if arcade_input.but1[1] then marcade.in2:=(marcade.in2 and $df) else marcade.in2:=(marcade.in2 or $20); if arcade_input.but2[1] then marcade.in2:=(marcade.in2 and $7f) else marcade.in2:=(marcade.in2 or $80); //SYSTEM if arcade_input.coin[0] then marcade.in0:=(marcade.in0 and $fb) else marcade.in0:=(marcade.in0 or 4); if arcade_input.coin[1] then marcade.in0:=(marcade.in0 and $f7) else marcade.in0:=(marcade.in0 or 8); if arcade_input.start[0] then marcade.in0:=(marcade.in0 and $fe) else marcade.in0:=(marcade.in0 or 1); if arcade_input.start[1] then marcade.in0:=(marcade.in0 and $fd) else marcade.in0:=(marcade.in0 or 2); end; end; procedure galivan_principal; var frame_m,frame_s:single; f:byte; begin init_controls(false,false,false,true); frame_m:=z80_0.tframes; frame_s:=z80_1.tframes; while EmuStatus=EsRuning do begin for f:=0 to $ff do begin //main z80_0.run(frame_m); frame_m:=frame_m+z80_0.tframes-z80_0.contador; //sound z80_1.run(frame_s); frame_s:=frame_s+z80_1.tframes-z80_1.contador; if f=239 then begin update_video_galivan; copymemory(@buffer_sprites,@memoria[$e000],$100); z80_0.change_irq(ASSERT_LINE); end; end; eventos_galivan; video_sync; end; end; function galivan_getbyte(direccion:word):byte; begin case direccion of 0..$bfff,$e000..$ffff:galivan_getbyte:=memoria[direccion]; $c000..$dfff:galivan_getbyte:=rom_mem[rom_bank,direccion and $1fff]; end; end; procedure galivan_putbyte(direccion:word;valor:byte); begin case direccion of 0..$d7ff:; $d800..$dfff:if memoria[direccion]<>valor then begin memoria[direccion]:=valor; gfx[0].buffer[direccion and $3ff]:=true; end; $e000..$ffff:memoria[direccion]:=valor; end; end; function galivan_inbyte(puerto:word):byte; begin case (puerto and $ff) of 0:galivan_inbyte:=marcade.in1; //p1 1:galivan_inbyte:=marcade.in2; //p2 2:galivan_inbyte:=marcade.in0; //system 3:galivan_inbyte:=marcade.dswa; //dsw1 4:galivan_inbyte:=marcade.dswb; //dsw2 $c0:galivan_inbyte:=$58; end; end; procedure galivan_outbyte(puerto:word;valor:byte); begin case (puerto and $ff) of $40:begin rom_bank:=(valor and $80) shr 7; main_screen.flip_main_screen:=(valor and $4)<>0; end; $41:scroll_y:=(scroll_y and $700) or valor; $42:begin scroll_y:=(scroll_y and $ff) or ((valor and $7) shl 8); layers:=valor and $e0; end; $43:scroll_x:=(scroll_x and $700) or valor; $44:scroll_x:=(scroll_x and $ff) or ((valor and $7) shl 8); $45:sound_latch:=((valor and $7f) shl 1) or 1; $47:z80_0.change_irq(CLEAR_LINE); end; end; function galivan_snd_getbyte(direccion:word):byte; begin galivan_snd_getbyte:=mem_snd[direccion]; end; procedure galivan_snd_putbyte(direccion:word;valor:byte); begin case direccion of 0..$bfff:; $c000..$c7ff:mem_snd[direccion]:=valor; end; end; procedure galivan_snd_timer; begin z80_1.change_irq(HOLD_LINE); end; function galivan_snd_inbyte(puerto:word):byte; begin case (puerto and $ff) of 4:sound_latch:=0; 6:galivan_snd_inbyte:=sound_latch; end; end; procedure galivan_snd_outbyte(puerto:word;valor:byte); begin case (puerto and $ff) of $0:ym3812_0.control(valor); $1:ym3812_0.write(valor); $2:dac_0.signed_data8_w(valor); $3:dac_1.signed_data8_w(valor); end; end; procedure galivan_sound_update; begin ym3812_0.update; dac_0.update; dac_1.update; end; //Main procedure reset_galivan; begin z80_0.reset; z80_1.reset; ym3812_0.reset; dac_0.reset; dac_1.reset; reset_audio; marcade.in0:=$ff; marcade.in1:=$ff; marcade.in2:=$ff; scroll_x:=0; scroll_y:=0; sound_latch:=0; layers:=0; rom_bank:=0; end; function iniciar_galivan:boolean; var colores:tpaleta; f:word; tempb:byte; memoria_temp:array[0..$1ffff] of byte; bg_temp:array[0..$7fff] of byte; const pc_x:array[0..7] of dword=(1*4, 0*4, 3*4, 2*4, 5*4, 4*4, 7*4, 6*4); ps_x:array[0..15] of dword=(4, 0, 4+$8000*8, 0+$8000*8, 12, 8, 12+$8000*8, 8+$8000*8, 20, 16, 20+$8000*8, 16+$8000*8, 28, 24, 28+$8000*8, 24+$8000*8); ps_y:array[0..15] of dword=(0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32); pf_x:array[0..15] of dword=(4, 0, 12, 8, 20, 16, 28, 24, 32+4, 32+0, 32+12, 32+8, 32+20, 32+16, 32+28, 32+24); pf_y:array[0..15] of dword=(0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64); procedure convert_chars; begin init_gfx(0,8,8,$200); gfx[0].trans[15]:=true; gfx_set_desc_data(4,0,32*8,0,1,2,3); convert_gfx(0,0,@memoria_temp,@pc_x,@ps_y,false,true); end; procedure convert_fg; begin init_gfx(1,16,16,$400); gfx_set_desc_data(4,0,64*16,0,1,2,3); convert_gfx(1,0,@memoria_temp,@pf_x,@pf_y,false,true); end; procedure convert_sprites; begin init_gfx(2,16,16,$200); gfx[2].trans[15]:=true; gfx_set_desc_data(4,0,32*16,0,1,2,3); convert_gfx(2,0,@memoria_temp,@ps_x,@ps_y,false,true); end; procedure put_bg; var f,nchar:word; x,y,atrib,color:byte; begin for f:=$0 to $3fff do begin x:=f div 128; y:=127-(f mod 128); atrib:=bg_temp[f+$4000]; nchar:=bg_temp[f] or ((atrib and $3) shl 8); color:=(atrib and $78) shl 1; put_gfx(x*16,y*16,nchar,color,1,1); end; end; begin llamadas_maquina.bucle_general:=galivan_principal; llamadas_maquina.reset:=reset_galivan; iniciar_galivan:=false; iniciar_audio(false); screen_init(1,2048,2048); screen_mod_scroll(1,2048,2048,2047,2048,2048,2047); screen_init(2,256,256,true); screen_init(3,256,256,true); screen_init(4,256,512,false,true); iniciar_video(224,256); //Main CPU z80_0:=cpu_z80.create(6000000,256); z80_0.change_io_calls(galivan_inbyte,galivan_outbyte); z80_0.change_ram_calls(galivan_getbyte,galivan_putbyte); //Sound CPU z80_1:=cpu_z80.create(4000000,256); z80_1.change_ram_calls(galivan_snd_getbyte,galivan_snd_putbyte); z80_1.change_io_calls(galivan_snd_inbyte,galivan_snd_outbyte); z80_1.init_sound(galivan_sound_update); case main_vars.tipo_maquina of 266:begin //Galivan //cargar roms if not(roms_load(@memoria_temp,galivan_rom)) then exit; copymemory(@memoria[0],@memoria_temp[0],$c000); copymemory(@rom_mem[0,0],@memoria_temp[$c000],$2000); copymemory(@rom_mem[1,0],@memoria_temp[$e000],$2000); //cargar sonido if not(roms_load(@mem_snd,galivan_sound)) then exit; //Sound Chips ym3812_0:=ym3812_chip.create(YM3526_FM,4000000,0.3); //convertir chars if not(roms_load(@memoria_temp,galivan_char)) then exit; convert_chars; //convertir fondo if not(roms_load(@memoria_temp,galivan_fondo)) then exit; convert_fg; //convertir sprites if not(roms_load(@memoria_temp,galivan_sprites)) then exit; convert_sprites; //tiles de bg y lo pongo en la pantalla 1 if not(roms_load(@bg_temp,galivan_bg_tiles)) then exit; //DIP marcade.dswa:=$df; marcade.dswa_val:=@galivan_dip_a; marcade.dswb:=$ff; marcade.dswb_val:=@galivan_dip_b; //poner la paleta if not(roms_load(@memoria_temp,galivan_pal)) then exit; copymemory(@spritebank,@memoria_temp[$400],$100); end; 267:begin //Dangar //cargar roms if not(roms_load(@memoria_temp,dangar_rom)) then exit; copymemory(@memoria[0],@memoria_temp[0],$c000); copymemory(@rom_mem[0,0],@memoria_temp[$c000],$2000); copymemory(@rom_mem[1,0],@memoria_temp[$e000],$2000); //cargar sonido if not(roms_load(@mem_snd,dangar_sound)) then exit; //Sound Chips ym3812_0:=ym3812_chip.create(YM3526_FM,4000000,0.3); //convertir chars if not(roms_load(@memoria_temp,dangar_char)) then exit; convert_chars; //convertir fondo if not(roms_load(@memoria_temp,dangar_fondo)) then exit; convert_fg; //convertir sprites if not(roms_load(@memoria_temp,dangar_sprites)) then exit; convert_sprites; //tiles de bg y lo pongo en la pantalla 1 if not(roms_load(@bg_temp,dangar_bg_tiles)) then exit; //DIP marcade.dswa:=$df; marcade.dswa_val:=@dangar_dip_a; marcade.dswb:=$7f; marcade.dswb_val:=@dangar_dip_b; //poner la paleta if not(roms_load(@memoria_temp,dangar_pal)) then exit; copymemory(@spritebank,@memoria_temp[$400],$100); end; end; dac_0:=dac_chip.Create(0.5); dac_1:=dac_chip.Create(0.5); timers.init(z80_1.numero_cpu,4000000/(4000000/512),galivan_snd_timer,nil,true); for f:=0 to $ff do begin colores[f].r:=pal4bit(memoria_temp[f]); colores[f].g:=pal4bit(memoria_temp[f+$100]); colores[f].b:=pal4bit(memoria_temp[f+$200]); //lookup de chars if (f and 8)<>0 then gfx[0].colores[f]:=(f and $0f) or ((f shr 2) and $30) else gfx[0].colores[f]:=(f and $0f)or ((f shr 0) and $30); //color lookup de fondo if (f and 8)<>0 then gfx[1].colores[f]:=$c0 or (f and $0f) or ((f shr 2) and $30) else gfx[1].colores[f]:=$c0 or (f and $0f) or ((f shr 0) and $30); end; //color lookup de sprites for f:=0 to $fff do begin if (f and $8)<>0 then tempb:=$80 or ((f shl 2) and $30) or (memoria_temp[$300+(f shr 4)] and $f) else tempb:=$80 or ((f shl 4) and $30) or (memoria_temp[$300+(f shr 4)] and $f); gfx[2].colores[((f and $f) shl 8) or ((f and $ff0) shr 4)]:=tempb; end; set_pal(colores,$100); //Despues de poner la paleta, pongo el fondo... put_bg; //final reset_galivan; iniciar_galivan:=true; end; end.
//============================================================================= // sgGraphics.pas //============================================================================= // // The Graphics unit is responsible for all of the drawing of anything to the // screen or other surfaces. The ...OnScreen routines draw directly onto the // screen ignoring the camera settings. The standard draw routines draw to the // screen using the camera settings. Finally the overloaded drawing methods // with a destination Bitmap will draw onto the supplied bitmap. // // Change History: // // Version 3.0: // - 2010-02-02: Aaron : Added PushClip,PopClip,SetClip,ResetClip // - 2010-01-13: Aaron : Made all Draw Shapes draw with an offset and made those that does not have a destination Bitmap have an offset of cameraX and cameraY // - 2010-01-04: Andrew : Added PutPixel // - 2009-12-10: Andrew : Moved out remaining bitmap function // - 2009-11-06: Andrew : Moved out bitmap function // - 2009-10-16: Andrew : Added shapes and shape prototypes // - 2009-07-14: Andrew : Removed loading and freeing code. // - 2009-07-10: Andrew : Fixed missing const modifier on struct parameters // - 2009-06-29: Andrew : Using circle // - 2009-06-24: Andrew : Moved Sprite routines to Sprites. // - 2009-06-23: Clinton: Comment format/cleanup // - 2009-06-05: Andrew : Using sgShared // // Version 2.0: // - 2008-12-17: Andrew : Moved all integers to LongInt // - 2008-12-10: Andrew : Moved primitive drawing to SDL_gfx // : Added rotation and zoom to Sprite + Sprite Drawing // : Added RotateZoomBitmap // : Added MakeOpaque and MakeTransparent to allow multiple blending // : Added extra triangle drawing code // - 2008-12-09: Andrew : Started transition to SDL_gfx // // Version 1.1: // - 2008-04-08: Stephen: Added DrawTriangle() // - 2008-04-02: Andrew : Fixed issues related to freeing images // : Fixed transparent pixels for non 32bit images // - 2008-03-09: Andrew : Fixed DrawSprite with Offset // - 2008-02-16: Andrew : Added GetPixel and GetPixelFromScreen // - 2008-01-31: Andrew : Fixed Line Drawing Issue // - 2008-01-30: Andrew : Fixed DrawRectangle // - 2008-01-25: Andrew : Fixed compiler hints for pointer use // - 2008-01-24: Andrew : Added Clipping // - 2008-01-24: James : Version 1.1 overloads // - 2008-01-21: Aki : 40 overloads added for Point2D and // - 2008-01-17: Aki + Andrew: Refactor Rectangle support // // Version 1.0: // - Various //============================================================================= /// The graphics code of SwinGame is used to draw primitive shapes to the screen /// or onto bitmaps. /// /// @module Graphics /// @static unit sgGraphics; //============================================================================= interface uses sgTypes; //============================================================================= //--------------------------------------------------------------------------- // Circle drawing code //--------------------------------------------------------------------------- /// Draw a circle onto a destination (filled or outline). /// /// @lib DrawOrFillPtCircleOnto /// @sn drawOnto:%s color:%s filled:%s circleX:%s y:%s radius:%s procedure DrawCircle(dest: Bitmap; clr: Color; filled: Boolean; xc, yc: Single; radius: LongInt); overload; /// Draw a circle onto a destination. /// /// @lib DrawOrFillPtCircleOnto(dest, clr, False, xc, yc, radius) /// @uname DrawPtCircleOnto /// @sn drawOnto:%s color:%s circleX:%s y:%s radius:%s procedure DrawCircle(dest: Bitmap; clr: Color; xc, yc: Single; radius: LongInt); overload; /// Fill a circle onto a destination. /// /// @lib DrawOrFillPtCircleOnto(dest, clr, True, xc, yc, radius) /// @uname FillPtCircleOnto /// @sn fillOnto:%s color:%s circleX:%s y:%s radius:%s procedure FillCircle(dest: Bitmap; clr: Color; xc, yc: Single; radius: LongInt); overload; /// Draw a circle onto a destination (filled or outline). /// /// @lib DrawOrFillPtCircleAtPointOnto /// @sn drawOnto:%s color:%s filled:%s circle:%s radius:%s procedure DrawCircle(dest: Bitmap; clr: Color; filled: Boolean; const point: Point2D; radius: LongInt); overload; /// Draw a circle onto a bitmap. /// /// @lib DrawOrFillPtCircleAtPointOnto(dest, clr, False, point, radius) /// @uname DrawCircleAtPointOnto /// @sn drawOnto:%s color:%s circle:%s radius:%s procedure DrawCircle(dest: Bitmap; clr: Color; const point: Point2D; radius: LongInt); overload; /// Fill a circle onto a destination bitmap. /// /// @lib DrawOrFillPtCircleAtPointOnto(dest, clr, True, point, radius) /// @uname FillCircleAtPointOnto /// @sn fillOnto:%s color:%s circle:%s radius:%s procedure FillCircle(dest: Bitmap; clr: Color; const point: Point2D; radius: LongInt); overload; /// Draw a circle onto a bitmap (filled or outline). /// /// @lib DrawOrFillCircleOnto /// @sn drawOnto:%s color:%s filled:%s circle:%s procedure DrawCircle(dest: Bitmap; clr: Color; filled: Boolean; const c: Circle); overload; /// Draw a circle onto a bitmap. /// /// @lib DrawOrFillCircleOnto(dest, clr, False, c) /// @uname DrawCircleOnto /// @sn drawOnto:%s color:%s circle:%s procedure DrawCircle(dest: Bitmap; clr: Color; const c: Circle); overload; /// Fill a circle onto a destination. /// /// @lib DrawOrFillCircleOnto(dest, clr, True, c) /// @uname FillCircleOnto /// @sn fillOnto:%s color:%s circle:%s procedure FillCircle(dest: Bitmap; clr: Color; const c: Circle); overload; /// Draw a circle in the game (filled or outline). /// /// @lib DrawOrFillPtCircle /// @sn draw:%s filled:%s circleX:%s y:%s radius:%s procedure DrawCircle(clr: Color; filled: Boolean; xc, yc: Single; radius: LongInt); overload; /// Draw a circle in the game. /// /// @lib DrawOrFillPtCircle(clr, False, xc, yc, radius) /// @uname DrawPtCircle /// @sn draw:%s circleX:%s y:%s radius:%s procedure DrawCircle(clr: Color; xc, yc: Single; radius: LongInt); overload; /// Fill a circle in the game. /// /// @lib DrawOrFillPtCircle(clr, True, xc, yc, radius) /// @uname FillPtCircle /// @sn fill:%s circleX:%s y:%s radius:%s procedure FillCircle(clr: Color; xc, yc: Single; radius: LongInt); overload; /// Draw a circle in the game (filled or outline). /// /// @lib DrawOrFillPtCircleAtPoint /// @sn draw:%s filled:%s circle:%s radius:%s procedure DrawCircle(clr: Color; filled: Boolean; const position: Point2D; radius: LongInt); overload; /// Draw circle in the game. /// /// @lib DrawOrFillPtCircleAtPoint(clr, False, position, radius) /// @uname DrawPtCircleAtPoint /// @sn draw:%s circle:%s radius:%s procedure DrawCircle(clr: Color; const position: Point2D; radius: LongInt); overload; /// Fill a circle in the game. /// /// @lib DrawOrFillPtCircleAtPoint(clr, True, position, radius) /// @uname FillPtCircleAtPoint /// @sn fill:%s circle:%s radius:%s procedure FillCircle(clr: Color; const position: Point2D; radius: LongInt); overload; /// Draw a circle in the game (filled or outline). /// /// @lib DrawOrFillCircle /// @sn draw:%s filled:%s circle:%s procedure DrawCircle(clr: Color; filled: Boolean; const c: Circle); overload; /// Draw a circle in the game. /// /// @lib DrawOrFillCircle(clr, False, c) /// @uname DrawCircle /// @sn draw:%s circle:%s procedure DrawCircle(clr: Color; const c: Circle); overload; /// Fill a circle in the game. /// /// @lib DrawOrFillCircle(clr, True, c) /// @uname FillCircle /// @sn fill:%s circle:%s procedure FillCircle(clr: Color; const c: Circle); overload; /// Draw a circle on the screen (filled or outline). /// /// @lib DrawOrFillPtCircleOnScreen /// @sn draw:%s filled:%s circleOnScreenX:%s y:%s radius:%s procedure DrawCircleOnScreen(clr: Color; filled: Boolean; xc, yc: Single; radius: LongInt); overload; /// Draw a circle on the screen. /// /// @lib DrawOrFillPtCircleOnScreen(clr, False, xc, yc, radius) /// @uname DrawCirclePtOnScreen /// @sn draw:%s circleOnScreenX:%s y:%s radius:%s procedure DrawCircleOnScreen(clr: Color; xc, yc: Single; radius: LongInt); overload; /// Fill a circle on the screen. /// /// @lib DrawOrFillPtCircleOnScreen(clr, True, xc, yc, radius) /// @uname FillCirclePtOnScreen /// @sn fill:%s circleOnScreenX:%s y:%s radius:%s procedure FillCircleOnScreen(clr: Color; xc, yc: Single; radius: LongInt); overload; /// Draw a circle onto the screen (filled or outline). /// /// Draw a circle onto the screen /// @lib DrawOrFillCircleAtPointOnScreen /// @sn draw:%s filled:%s circleOnScreen:%s radius:%s procedure DrawCircleOnScreen(clr: Color; filled: Boolean; const position: Point2D; radius: LongInt); overload; /// Draw a circle onto the screen. /// /// @lib DrawOrFillCircleAtPointOnScreen(clr, False, position, radius) /// @uname DrawCircleAtPointOnScreen /// @sn draw:%s circleOnScreen:%s radius:%s procedure DrawCircleOnScreen(clr: Color; const position: Point2D; radius: LongInt); overload; /// Fills a circle onto the screen. /// /// @lib DrawOrFillCircleAtPointOnScreen(clr, True, position, radius) /// @uname FillCircleAtPointOnScreen /// @sn fill:%s circleOnScreen:%s radius:%s procedure FillCircleOnScreen(clr: Color; const position: Point2D; radius: LongInt); overload; /// Draw a circle on the screen (filled or outline) /// /// @lib DrawOrFillCircleOnScreen /// @sn draw:%s filled:%s circleOnScreen:%s procedure DrawCircleOnScreen(clr: Color; filled: Boolean; const c: Circle); overload; /// Draw the circel onto the screen. /// /// @lib DrawOrFillCircleOnScreen(clr, False, c) /// @uname DrawCircleOnScreen /// @sn draw:%s circleOnScreen:%s procedure DrawCircleOnScreen(clr: Color; const c: Circle); overload; /// Fill the circle onto the screen. /// /// @lib DrawOrFillCircleOnScreen(clr, True, c) /// @uname FillCircleOnScreen /// @sn fill:%s circleOnScreen:%s procedure FillCircleOnScreen(clr: Color; const c: Circle); overload; //--------------------------------------------------------------------------- // Triangle drawing code //--------------------------------------------------------------------------- /// Draw the triangle onto the destination (filled or outline). /// /// @lib DrawOrFillTriangleOnto /// @sn drawOnto:%s color:%s filled:%s triangle:%s procedure DrawTriangle(dest: Bitmap; clr: Color; filled: Boolean; const tri: Triangle); overload; /// Draw the triangle onto the destination. /// /// @lib DrawOrFillTriangleOnto(dest, clr, False, tri) /// @uname DrawTriangleOnto /// @sn drawOnto:%s color:%s triangle:%s procedure DrawTriangle(dest: Bitmap; clr: Color; const tri: Triangle); overload; /// Fill the triangle onto the destination. /// /// @lib DrawOrFillTriangleOnto(dest, clr, True, tri) /// @uname FillTriangleOnto /// @sn fillOnto:%s color:%s triangle:%s procedure FillTriangle(dest: Bitmap; clr: Color; const tri: Triangle); overload; /// Draw the triangle onto the destination. /// /// @lib DrawTriangleFromPointsOnto /// @sn drawOnto:%s color:%s triangleX1:%s y1:%s x2:%s y2:%s x3:%s y3:%s procedure DrawTriangle(dest: Bitmap; clr: Color; x1, y1, x2, y2, x3, y3: Single); overload; /// Fill the triangle onto the destination. /// /// @lib FillTriangleFromPointsOnto /// @sn fillOnto:%s color:%s triangleX1:%s y1:%s x2:%s y2:%s x3:%s y3:%s procedure FillTriangle(dest: Bitmap; clr: Color; x1, y1, x2, y2, x3, y3: Single); overload; /// Draw a triangle in the game. /// /// @lib DrawOrFillTriangle /// @sn draw:%s filled:%s triangle:%s procedure DrawTriangle(clr: Color; filled: Boolean; const tri: Triangle); overload; /// Draw a triangle in the game. /// /// @lib DrawOrFillTriangle(clr, False, tri) /// @uname DrawTriangle /// @sn draw:%s triangle:%s procedure DrawTriangle(clr: Color; const tri: Triangle); overload; /// Fill a triangle in the game. /// /// @lib DrawOrFillTriangle(clr, True, tri) /// @uname FillTriangle /// @sn fill:%s triangle:%s procedure FillTriangle(clr: Color; const tri: Triangle); overload; /// Draw a triangle in the game. /// /// @lib DrawTriangleFromPoints /// @sn draw:%s triangleX1:%s y1:%s x2:%s y2:%s x3:%s y3:%s procedure DrawTriangle(clr: Color; x1, y1, x2, y2, x3, y3: Single); overload; /// Fill a triangle in the game. /// /// @lib FillTriangleFromPoints /// @sn fill:%s triangleX1:%s y1:%s x2:%s y2:%s x3:%s y3:%s procedure FillTriangle(clr: Color; x1, y1, x2, y2, x3, y3: Single); overload; /// Draw a triangle (filled or outline) onto the screen. /// /// @lib DrawOrFillTriangleOnScreen /// @sn draw:%s filled:%s triangleOnScreen:%s procedure DrawTriangleOnScreen(clr: Color; filled: Boolean; const tri: Triangle); overload; /// Draw a triangle onto the screen. /// /// @lib DrawOrFillTriangleOnScreen(clr, False, tri) /// @uname DrawTriangleOnScreen /// @sn draw:%s triangleOnScreen:%s procedure DrawTriangleOnScreen(clr: Color; const tri: Triangle); overload; /// Fills a triangle on the screen. /// /// @lib DrawOrFillTriangleOnScreen(clr, True, tri) /// @uname FillTriangleOnScreen /// @sn fill:%s triangleOnScreen:%s procedure FillTriangleOnScreen(clr: Color; const tri: Triangle); overload; /// Draws the outline of a triangle on the screen. /// /// @lib DrawTriangleFromPointsOnScreen /// @sn draw:%s triangleOnScreenX1:%s y1:%s x2:%s y2:%s x3:%s y3:%s procedure DrawTriangleOnScreen(clr: Color; x1, y1, x2, y2, x3, y3: Single); overload; /// Fills a triangle on the screen. /// /// @lib FillTriangleFromPointsOnScreen /// @sn fill:%s triangleOnScreenX1:%s y1:%s x2:%s y2:%s x3:%s y3:%s procedure FillTriangleOnScreen(clr: Color; x1, y1, x2, y2, x3, y3: Single); overload; //--------------------------------------------------------------------------- // Shape drawing code //--------------------------------------------------------------------------- /// Draw the Shape s onto the destination bitmap. The filled boolean indicates /// if the Shape should be filled. /// /// @lib DrawOrFillShapeOnto /// @sn drawOnto:%s shape:%s filled:%s /// /// @class Shape /// @overload Draw DrawOrFillOnto /// @self 2 /// @csn drawOnto:%s filled:%s procedure DrawShape(dest: Bitmap; s: Shape; filled: Boolean); overload; /// Draw the Shape s onto the destination bitmap. /// /// @lib DrawShapeOnto /// @sn drawOnto:%s shape:%s /// /// @class Shape /// @overload Draw DrawOnto /// @self 2 /// @csn drawOnto:%s procedure DrawShape(dest: Bitmap; s: Shape); overload; /// Fill the Shape s onto the destination bitmap. /// /// @lib FillShapeOnto /// @sn fillOnto:%s shape:%s /// /// @class Shape /// @overload Fill FillOnto /// @self 2 /// @csn fillOnto:%s procedure FillShape(dest: Bitmap; s: Shape); overload; /// Draw or fill the Shape s onto the screen at the /// shapes game coordinates. /// /// @lib DrawOrFillShape /// @sn drawShape:%s filled:%s /// /// @class Shape /// @overload Draw DrawOrFill /// @csn drawFilled:%s procedure DrawShape(s: Shape; filled: Boolean); overload; /// Draw the Shape s onto the screen at the /// shapes game coordinates. /// /// @lib DrawShape /// /// @class Shape /// @method Draw procedure DrawShape(s: Shape); overload; /// Fill the Shape s. /// /// @lib FillShape /// /// @class Shape /// @method Fill procedure FillShape(s: Shape); overload; /// Draw or fill the Shape s onto the screen using the /// Shape's location as screen coordinates. /// /// @lib DrawOrFillShapeOnScreen /// @sn drawShapeOnScreen:%s filled:%s /// /// @class Shape /// @overload DrawOnScreen DrawOrFillOnScreen /// @csn drawOnScreenFilled:%s procedure DrawShapeOnScreen(s: Shape; filled: Boolean); overload; /// Draw the Shape s onto the screen using the /// Shape's location as screen coordinates. /// /// @lib DrawShapeOnScreen /// /// @class Shape /// @method DrawOnScreen procedure DrawShapeOnScreen(s: Shape); overload; /// Fill the Shape s onto the screen using the /// Shape's location as screen coordinates. /// /// @lib FillShapeOnScreen /// /// @class Shape /// @method FillOnScreen procedure FillShapeOnScreen(s: Shape); overload; /// Draw the passed in shape to the specified bitmap. If filled the shape /// is drawn with a fill rather than drawn as a series of lines. This version /// Draws the first point of the shape as a pixel. /// /// @lib /// @sn drawOnto:%s pointShape:%s filled:%s offset:%s /// /// @class Shape /// @method DrawAsPoint /// @self 2 /// @csn drawPointOnto:%s filled:%s offset:%s procedure DrawShapeAsPoint(dest: Bitmap; s:Shape; filled: Boolean; const offset:Point2D); overload; /// Draw the passed in shape to the specified bitmap. If filled the shape /// is drawn with a fill rather than drawn as a series of lines. This version /// draws the shape as a circle, centered on the first point with a radius defined /// by the distance to the second point. /// /// @lib /// @sn drawOnto:%s circleShape:%s filled:%s offset:%s /// /// @class Shape /// @method DrawAsCircle /// @self 2 /// @csn drawCircleOnto:%s filled:%s offset:%s procedure DrawShapeAsCircle(dest: Bitmap; s:Shape; filled: Boolean; const offset:Point2D); overload; // /// Draw the passed in shape to the specified bitmap. If filled the shape // /// is drawn with a fill rather than drawn as a series of lines. // /// // /// @lib // /// @class Shape // /// @method DrawAsEllipse // /// @self 2 // procedure DrawShapeAsEllipse(dest: Bitmap; s:Shape; filled: Boolean); overload; /// Draw the passed in shape to the specified bitmap. If filled the shape /// is drawn with a fill rather than drawn as a series of lines. This version /// draws a line from the first point of the shape to the second point. /// /// @lib /// @sn drawOnto:%s lineShape:%s filled:%s offset:%s /// /// @class Shape /// @method DrawAsLine /// @self 2 /// @csn drawLineOnto:%s filled:%s offset:%s procedure DrawShapeAsLine(dest: Bitmap; s:Shape; filled: Boolean; const offset:Point2D); overload; /// Draw the passed in shape to the specified bitmap. If filled the shape /// is drawn with a fill rather than drawn as a series of lines. This version /// draws the shape as a triangle based on the first three points of the shape. /// /// @lib /// @sn drawOnto:%s triangleShape:%s filled:%s offset:%s /// /// @class Shape /// @method DrawAsTriangle /// @self 2 /// @csn drawTriangleOnto:%s filled:%s offset:%s procedure DrawShapeAsTriangle(dest: Bitmap; s:Shape; filled: Boolean; const offset:Point2D); overload; /// Draw the passed in shape to the specified bitmap. If filled the shape /// is drawn with a fill rather than drawn as a series of lines. This version /// draws the points as a list of lines. A shape with 4 points has two lines in its /// list. If an odd numer of points are supplied then the extra point will be skipped. /// In this way a shape with 5 points also has 2 lines. /// /// @lib /// @sn drawOnto:%s lineListShape:%s filled:%s offset:%s /// /// @class Shape /// @method DrawAsLineList /// @self 2 /// @csn drawLineListOnto:%s filled:%s offset:%s procedure DrawShapeAsLineList(dest: Bitmap; s: Shape; filled: Boolean; const offset:Point2D); /// Draw the passed in shape to the specified bitmap. If filled the shape /// is drawn with a fill rather than drawn as a series of lines. This version /// draws the shape as a line strip. A shape with three points has two lines, one /// from pt[0] to pt[1] and a second from pt[1] to pt[2]. /// /// @lib /// @sn drawOnto:%s lineStripShape:%s filled:%s offset:%s /// /// @class Shape /// @method DrawAsLineStrip /// @self 2 /// @csn drawLineStripOnto:%s filled:%s offset:%s procedure DrawShapeAsLineStrip(dest: Bitmap; s: Shape; filled: Boolean; const offset:Point2D); // / Draw the passed in shape to the specified bitmap. If filled the shape // / is drawn with a fill rather than drawn as a series of lines. This draws // / as a polygon where each point is connected to its neighbour and the // / first point is reconnected to the last point. // / // / @lib // / @sn drawOnto:%s polygonShape:%s filled:%s offset:%s // / // / @class Shape // / @method DrawAsPolygon // / @self 2 // / @csn drawPolygonOnto:%s filled:%s offset:%s //procedure DrawShapeAsPolygon(dest: Bitmap; s: Shape; filled: Boolean; const offset:Point2D); /// Draw the passed in shape to the specified bitmap. If filled the shape /// is drawn with a fill rather than drawn as a series of lines. This version /// draws the shape as a tan of triangles where each triangle is made up of /// the first point and two neighbouring points from the shape. /// /// @lib /// @sn drawOnto:%s triangleFanShape:%s filled:%s offset:%s /// /// @class Shape /// @method DrawAsTriangleFan /// @self 2 /// @csn drawTriangleFonOnto:%s filled:%s offset:%s procedure DrawShapeAsTriangleFan(dest: Bitmap; s: Shape; filled: Boolean; const offset:Point2D); /// Draw the passed in shape to the specified bitmap. If filled the shape /// is drawn with a fill rather than drawn as a series of lines. This version /// draws as a strip of triangles where each triangle is made up of the /// three neighbouring points. In this way 4 points gives two triangles. /// /// @lib /// @sn drawOnto:%s triangleStripShape:%s filled:%s offset:%s /// /// @class Shape /// @method DrawAsTriangleStrip /// @self 2 /// @csn drawTriangleStripOnto:%s filled:%s offset:%s procedure DrawShapeAsTriangleStrip(dest: Bitmap; s: Shape; filled: Boolean; const offset:Point2D); /// Draw the passed in shape to the specified bitmap. If filled the shape /// is drawn with a fill rather than drawn as a series of lines. This version /// draws as a triangle list, where each set of three points is drawn as an /// individual triangle and extra points are ignored. So 6, 7, and 8 points /// all create 2 triangles (pt[0] + pt[1] + pt[2] and pt[3] + pt[4] + pt[5]). /// /// @lib /// @sn drawOnto:%s triangleListShape:%s filled:%s offset:%s /// /// @class Shape /// @method DrawAsTriangleList /// @self 2 /// @csn drawTriangleListOnto:%s filled:%s offset:%s procedure DrawShapeAsTriangleList(dest: Bitmap; s: Shape; filled: Boolean; const offset:Point2D); //--------------------------------------------------------------------------- // Screen clearing routines //--------------------------------------------------------------------------- /// Clear the screen black. /// /// @lib ClearScreenToBlack /// @sn clearScreen procedure ClearScreen(); overload; /// Clear the screen to a specified color. /// /// @lib ClearScreenWithColor /// @sn clearScreen:%s procedure ClearScreen(toColor : Color); overload; //--------------------------------------------------------------------------- // Pixel drawing //--------------------------------------------------------------------------- /// Sets the color of the pixel to the specified value. /// /// @lib /// @sn bitmap:%s putPixelX:%s y:%s color:%s procedure PutPixel(bmp: Bitmap; value: Color; x, y: LongInt); /// Draw a pixel onto a destination. /// /// @lib DrawPixelOnto /// @sn drawOnto:%s color:%s pixelX:%s y:%s procedure DrawPixel(dest: Bitmap; clr: Color; x, y: LongInt); overload; /// Draw a pixel onto a destination. /// /// @lib DrawPixelAtPointOnto /// @sn drawOnto:%s color:%s pixel:%s procedure DrawPixel(dest: Bitmap; clr: Color; const position: Point2D); overload; /// Draw a pixel in the game. /// /// @lib /// @sn draw:%s pixelX:%s y:%s procedure DrawPixel(clr: Color; x, y: Single); overload; /// Draw a pixel in the game. /// /// @lib DrawPixelAtPoint /// @sn draw:%s pixelAt:%s procedure DrawPixel(clr: Color; const position: Point2D); overload; /// Draw a pixel on the screen. /// /// @lib /// @sn draw:%s pixelOnScreenX:%s y:%s procedure DrawPixelOnScreen(clr: Color; x, y: LongInt); overload; /// Draw a pixel on the screen. /// /// @lib DrawPixelAtPointOnScreen /// @sn draw:%s pixelOnScreenAt:%s procedure DrawPixelOnScreen(clr: Color; const position: Point2D); overload; //--------------------------------------------------------------------------- // Rectangle drawing //--------------------------------------------------------------------------- /// Draw a rectangle onto a destination. /// /// @lib DrawOrFillRectangleOnto /// @sn drawOnto:%s color:%s filled:%s rectangleX:%s y:%s width:%s height:%s procedure DrawRectangle(dest: Bitmap; clr : Color; filled : Boolean; xPos, yPos, width, height : LongInt); overload; /// Draw a rectangle onto a destination (filled or outline). /// /// @lib DrawOrFillRectangleRectOnto /// @sn drawOnto:%s color:%s filled:%s rectangle:%s procedure DrawRectangle(dest: Bitmap; clr : Color; filled : Boolean; const source: Rectangle); overload; /// Draw a rectangle onto a destination. /// /// @lib DrawOrFillRectangleOnto(dest, clr, False, xPos, yPos, width, height) /// @uname DrawRectangleOnto /// @sn drawOnto:%s color:%s rectangleX:%s y:%s width:%s height:%s procedure DrawRectangle(dest: Bitmap; clr : Color; xPos, yPos, width, height: LongInt); overload; /// Draw a rectangle onto a destination. /// /// @lib DrawOrFillRectangleRectOnto(dest, clr, False, source) /// @uname DrawRectangleRectOnto /// @sn drawOnto:%s color:%s rectangle:%s procedure DrawRectangle(dest: Bitmap; clr : Color; const source: Rectangle); overload; /// Fill a rectangle onto a destination. /// /// @lib DrawOrFillRectangleOnto(dest, clr, True, xPos, yPos, width, height) /// @uname FillRectangleOnto /// @sn fillOnto:%s color:%s rectangleX:%s y:%s width:%s height:%s procedure FillRectangle(dest: Bitmap; clr : Color; xPos, yPos, width, height : LongInt); overload; /// Fill a rectangle onto a destination. /// /// @lib DrawOrFillRectangleRectOnto(dest, clr, True, source) /// @uname FillRectangleRectOnto /// @sn drawOnto:%s color:%s rectangle:%s procedure FillRectangle(dest: Bitmap; clr : Color; const source: Rectangle); overload; /// Draw a rectangle in the game (filled or outline). /// /// @lib DrawOrFillRectangle /// @sn draw:%s filled:%s rectangleX:%s y:%s width:%s height:%s procedure DrawRectangle(clr: Color; filled: Boolean; xPos, yPos: Single; width, height: LongInt); overload; /// Draw a rectangle in the game (filled or outline). /// /// @lib DrawOrFillRectangleRect /// @sn draw:%s filled:%s rectangle:%s procedure DrawRectangle(clr: Color; filled: Boolean; const source: Rectangle); overload; /// Draw a rectangle in the game. /// /// @lib DrawOrFillRectangle(clr, False, xPos, yPos, width, height) /// @uname DrawRectangle /// @sn draw:%s rectangleX:%s y:%s width:%s height:%s procedure DrawRectangle(clr: Color; xPos, yPos: Single; width, height: LongInt); overload; /// Draw rectangle in the game. /// /// @lib DrawOrFillRectangleRect(clr, False, source) /// @uname DrawRectangleRect /// @sn draw:%s rectangle:%s procedure DrawRectangle(clr: Color; const source: Rectangle); overload; /// Fill rectangle. /// /// @lib DrawOrFillRectangle(clr, True, xPos, yPos, width, height) /// @uname FillRectangle /// @sn fill:%s rectangleX:%s y:%s width:%s height:%s procedure FillRectangle(clr: Color; xPos, yPos: Single; width, height: LongInt); overload; /// Fill a rectangle in the game. /// /// @lib DrawOrFillRectangleRect(clr, True, source) /// @uname FillRectangleRect /// @sn fill:%s rectangle:%s procedure FillRectangle(clr: Color; const source: Rectangle); overload; /// Draw a rectangle on the screen (filled or outline). /// /// @lib DrawOrFillRectangleOnScreen /// @sn draw:%s filled:%s rectangleOnScreenX:%s y:%s width:%s height:%s procedure DrawRectangleOnScreen(clr : Color; filled : Boolean; xPos, yPos, width, height : LongInt); overload; /// Draw a rectangle on the screen. /// /// @lib DrawOrFillRectangleOnScreen(clr, False, xPos, yPos, width, height) /// @uname DrawRectangleOnScreen /// @sn draw:%s rectangleOnScreenX:%s y:%s width:%s height:%s procedure DrawRectangleOnScreen(clr : Color; xPos, yPos, width, height : LongInt); overload; /// Fill a rectangle on the screen. /// /// @lib DrawOrFillRectangleOnScreen(clr, True, xPos, yPos, width, height) /// @uname FillRectangleOnScreen /// @sn fill:%s rectangleOnScreenX:%s y:%s width:%s height:%s procedure FillRectangleOnScreen(clr : Color; xPos, yPos, width, height : LongInt); overload; /// Draw a rectangle on the screen (fill or outline). /// /// @lib DrawOrFillRectangleRectOnScreen /// @sn draw:%s filled:%s rectangle:%s procedure DrawRectangleOnScreen(clr : Color; filled : Boolean; const source : Rectangle); overload; /// Draw a rectangle on the screen. /// /// @lib DrawOrFillRectangleRectOnScreen(clr, False, source) /// @uname DrawRectangleRectOnScreen /// @sn draw:%s rectangle:%s procedure DrawRectangleOnScreen(clr : Color; const source : Rectangle); overload; /// Fill a rectangle on the screen. /// /// @lib DrawOrFillRectangleRectOnScreen(clr, True, source) /// @uname FillRectangleRectOnScreen /// @sn fill:%s rectangleOnScreen:%s procedure FillRectangleOnScreen(clr : Color; const source : Rectangle); overload; //--------------------------------------------------------------------------- // Line drawing //--------------------------------------------------------------------------- /// Draw a line onto a destination bitmap. /// /// @lib DrawLineOnto /// @sn drawOnto:%s color:%s lineX1:%s y1:%s x2:%s y2:%s procedure DrawLine(dest: Bitmap; clr: Color; xPosStart, yPosStart, xPosEnd, yPosEnd: LongInt); overload; /// Draw a line onto a destination bitmap. /// /// @lib DrawLineSegmentOnto /// @sn drawOnto:%s color:%s line:%s procedure DrawLine(dest: Bitmap; clr: Color; const line: LineSegment); overload; /// Draw a line onto a destination. /// /// @lib DrawLinePtsOnto /// @sn drawOnto:%s color:%s lineFromPt:%s toPt:%s procedure DrawLine(dest: Bitmap; clr: Color; const startPt, endPt: Point2D); overload; /// Draw a horizontal line onto a destination. /// /// @lib DrawHorizontalLineOnto /// @sn drawOnto:%s color:%s horizontalLineY:%s x1:%s x2:%s procedure DrawHorizontalLine(dest: Bitmap; clr: Color; y, x1, x2: LongInt); overload; /// Draw a vertical line onto a destination. /// /// @lib DrawVerticalLineOnto /// @sn drawOnto:%s color:%s verticalLineX:%s y1:%s y2:%s procedure DrawVerticalLine(dest: Bitmap; clr: Color; x, y1, y2: LongInt); overload; /// Draw a collection of lines. /// /// @lib DrawLineSegments /// @sn draw:%s lines:%s procedure DrawLines(clr: Color; const lines: LinesArray); //overload; /// Draw a line in the game. /// /// @lib /// @sn draw:%s lineX1:%s y1:%s x2:%s y2:%s procedure DrawLine(clr: Color; xPosStart, yPosStart, xPosEnd, yPosEnd: Single); overload; /// Draw a line in the game. /// /// @lib DrawLineSegment /// @sn draw:%s line:%s procedure DrawLine(clr: Color; const line: LineSegment); overload; /// Draw a line in the game. /// /// @lib DrawLinePts /// @sn draw:%s lineFromPt:%s toPt:%s procedure DrawLine(clr: Color; const startPt, endPt: Point2D); overload; /// Draw a horizontal line. /// /// @lib /// @sn draw:%s horizontalLineY:%s x1:%s x2:%s procedure DrawHorizontalLine(clr: Color; y, x1, x2: Single); overload; /// Draw a vertical line in the game. /// /// @lib /// @sn draw:%s verticalLineX:%s y1:%s y2:%s procedure DrawVerticalLine(clr: Color; x, y1, y2: Single); overload; /// Draw a line on the screen. /// /// @lib /// @sn draw:%s onScreenX1:%s y1:%s x2:%s y2:%s procedure DrawLineOnScreen(clr: Color; xPosStart, yPosStart, xPosEnd, yPosEnd: LongInt); overload; /// Draw a line on the screen. /// /// @lib DrawLineSegmentOnScreen /// @sn draw:%s lineOnScreen:%s procedure DrawLineOnScreen(clr: Color; const line: LineSegment); overload; /// Draw a line on the screen. /// /// @lib DrawLinePtsOnScreen /// @sn draw:%s lineOnScreenFromPt:%s toPt:%s procedure DrawLineOnScreen(clr: Color; const startPt, endPt: Point2D); overload; /// Draw a horizontal line on the screen between x1, x2 /// /// @lib /// @sn draw:%s horizontalLineOnScreenY:%s x1:%s x2:%s procedure DrawHorizontalLineOnScreen(clr: Color; y, x1, x2: LongInt); /// Draw a vertical line on the screen between y1 and y2. /// /// @lib /// @sn draw:%s verticalLineOnScreenX:%s y1:%s y2:%s procedure DrawVerticalLineOnScreen(clr: Color; x, y1, y2: LongInt); //--------------------------------------------------------------------------- // Ellipse drawing //--------------------------------------------------------------------------- /// Draw the ellipse onto the destination. /// /// @lib DrawOrFillEllipseOnto /// @sn drawOnto:%s color:%s filled:%s ellipseX:%s y:%s width:%s height:%s procedure DrawEllipse(dest: Bitmap; clr: Color; filled: Boolean; xPos, yPos, width, height: LongInt); overload; /// Draw the ellipse onto the destination (filled or outline). /// /// @lib DrawOrFillEllipseInRectOnto /// @sn drawOnto:%s color:%s filled:%s ellipse:%s procedure DrawEllipse(dest: Bitmap; clr: Color; filled: Boolean; const source: Rectangle); overload; /// Drawthe ellipse onto the destination. /// /// @lib DrawOrFillEllipseOnto(dest, clr, False, xPos, yPos, width, height) /// @uname DrawEllipseOnto /// @sn drawOnto:%s color:%s ellipseX:%s y:%s width:%s height:%s procedure DrawEllipse(dest: Bitmap; clr: Color; xPos, yPos, width, height: LongInt); overload; /// Draw the ellipse onto the destination. /// /// @lib DrawOrFillEllipseInRectOnto(dest, clr, False, source) /// @uname DrawEllipseInRectOnto /// @sn drawOnto:%s color:%s ellipse:%s procedure DrawEllipse(dest: Bitmap; clr: Color; const source: Rectangle); overload; /// Fill the ellipse onto the destination. /// /// @lib DrawOrFillEllipseOnto(dest, clr, True, xPos, yPos, width, height) /// @uname FillEllipseOnto /// @sn fillOnto:%s color:%s ellipseX:%s y:%s width:%s height:%s procedure FillEllipse(dest: Bitmap; clr: Color; xPos, yPos, width, height: LongInt); overload; /// Fill the ellipse onto the destination. /// /// @lib DrawOrFillEllipseInRectOnto(dest, clr, True, source) /// @uname FillEllipseInRectOnto /// @sn fillOnto:%s color:%s ellipse:%s procedure FillEllipse(dest: Bitmap; clr: Color; const source: Rectangle); overload; /// Draw an ellipse in the game (filled or outline). /// /// @lib DrawOrFillEllipse /// @sn draw:%s filled:%s x:%s y:%s width:%s height:%s procedure DrawEllipse(clr: Color; filled: Boolean; xPos, yPos: Single; width, height: LongInt); overload; /// Draw an ellipse in the game (filled or outline). /// /// @lib DrawOrFillEllipseInRect /// @sn draw:%s filled:%s ellipse:%s procedure DrawEllipse(clr: Color; filled: Boolean; const source: Rectangle); overload; /// Draw an ellipse on the screen. /// /// @lib DrawOrFillEllipse(clr, False, xPos, yPos, width, height) /// @uname DrawEllipse /// @sn draw:%s x:%s y:%s width:%s height:%s procedure DrawEllipse(clr: Color; xPos, yPos: Single; width, height: LongInt); overload; /// Draw an ellipse in the game. /// /// @lib DrawOrFillEllipseInRect(clr, False, source) /// @uname DrawEllipseInRect /// @sn draw:%s ellipse:%s procedure DrawEllipse(clr: Color; const source: Rectangle); overload; /// Fill a ellipse in the game. /// /// @lib DrawOrFillEllipse(clr, True, xPos, yPos, width, height) /// @uname FillEllipse /// @sn fill:%s x:%s y:%s width:%s height:%s procedure FillEllipse(clr: Color; xPos, yPos: Single; width, height: LongInt); overload; /// Fill a ellipse in the game. /// /// @lib DrawOrFillEllipseInRect(clr, True, source) /// @uname FillEllipseInRect /// @sn fill:%s ellipse:%s procedure FillEllipse(clr: Color; const source: Rectangle); overload; /// Draw an ellipse on the screen (filled or outline). /// /// @lib DrawOrFillEllipseOnScreen /// @sn draw:%s filled:%s ellipseOnScreenX:%s y:%s width:%s height:%s procedure DrawEllipseOnScreen(clr: Color; filled: Boolean; xPos, yPos, width, height: LongInt); overload; /// Draw an ellipse on screen. /// /// @lib DrawOrFillEllipseOnScreen(clr, False, xPos, yPos, width, height) /// @uname DrawEllipseOnScreen /// @sn draw:%s ellipseOnScreenX:%s y:%s width:%s height:%s procedure DrawEllipseOnScreen(clr: Color; xPos, yPos, width, height: LongInt); overload; /// Fills an ellipse on the screen. /// /// @lib DrawOrFillEllipseOnScreen(clr, True, xPos, yPos, width, height) /// @uname FillEllipseOnScreen /// @sn fill:%s ellipseOnScreenX:%s y:%s width:%s height:%s procedure FillEllipseOnScreen(clr: Color; xPos, yPos, width, height: LongInt); overload; /// Draw an ellpse on the screen (filled or outline). /// /// @lib DrawOrFillEllipseInRectOnScreen /// @sn draw:%s filled:%s ellipseOnScreen:%s procedure DrawEllipseOnScreen(clr: Color; filled: Boolean; const source: Rectangle); overload; /// Draw an ellipse on the screen. /// /// @lib DrawOrFillEllipseInRectOnScreen(clr, False, source) /// @uname DrawEllipseInRectOnScreen /// @sn draw:%s ellipseOnScreen:%s procedure DrawEllipseOnScreen(clr: Color; const source: Rectangle); overload; /// Fills the ellipse on screen. /// /// @lib DrawOrFillEllipseInRectOnScreen(clr, True, source) /// @uname FillEllipseInRectOnScreen /// @sn fill:%s ellipseOnScreen:%s procedure FillEllipseOnScreen(clr: Color; const source: Rectangle); overload; //--------------------------------------------------------------------------- // Clipping //--------------------------------------------------------------------------- /// Push a clip rectangle to the screen. This can be undone using PopClip. /// /// @lib PushClipXY /// @sn pushClipX:%s y:%s width:%s height:%s procedure PushClip(x, y, w, h: LongInt); overload; /// Push a clip rectangle to the screen. This can be undone using PopClip. /// /// @lib PushClipRect /// @sn pushClip:%s procedure PushClip(const r: Rectangle); overload; /// Add the clipping rectangle of a bitmap and uses the intersect between the new rectangle and previous clip. /// /// @lib PushClipRectForBitmap /// @sn bitmap:%s PushClipRect:%s /// /// @class Bitmap /// @overload PushClip PushClipRect /// @csn pushClip:%s procedure PushClip(bmp: Bitmap; const r: Rectangle); overload; /// Reset the clipping rectangle of the screen. /// /// @lib procedure ResetClip(); overload; /// Reset the clipping rectangle on a bitmap. /// /// @lib ResetClipForBitmap /// /// @class Bitmap /// @method ResetClip procedure ResetClip(bmp: Bitmap); overload; /// Set the clip rectangle of the bitmap. /// /// @lib SetBmpClip /// @sn bitmap:%s setClip:%s /// /// @class Bitmap /// @method SetClip procedure SetClip(bmp: Bitmap; const r: Rectangle); overload; /// Set the clip rectangle of the screen. /// /// @lib SetClip /// @sn setClip:%s procedure SetClip(const r: Rectangle); overload; /// Set the clip rectangle of the screen. /// /// @lib SetClipXY /// @sn setClipX:%s y:%s width:%s height:%s procedure SetClip(x, y, w, h: LongInt); overload; /// Set the clip rectangle of the bitmap. /// /// @lib SetBmpClipXY /// @sn bitmap:%s setClipX:%s y:%s width:%s height:%s /// /// @class Bitmap /// @overload SetClip SetClipXY /// @csn setClipX:%s y:%s width:%s height:%s procedure SetClip(bmp: Bitmap; x, y, w, h: LongInt); overload; /// Pop the clip rectangle of the screen. /// /// @lib PopClipScreen procedure PopClip(); overload; /// Pop the clipping rectangle of a bitmap. /// /// @lib PopClipBmp /// @sn PopClipBitmap:%s /// /// @class Bitmap /// @method PopClip procedure PopClip(bmp: Bitmap); overload; /// Returns the rectangle of the currentl clip of bitmap /// /// @lib CurrentBmpClip /// @sn currentClip:%s /// /// @class Bitmap /// @getter CurrentClip function CurrentClip(bmp: Bitmap): Rectangle; overload; /// Returns the rectangle of the currentl clip of bitmap /// /// @lib CurrentScreenClip /// function CurrentClip(): Rectangle; overload; //--------------------------------------------------------------------------- // Pixel reading functions //--------------------------------------------------------------------------- /// Returns the color of the pixel at the x,y location on /// the supplied bitmap. /// /// @lib /// @sn bitmap:%s colorAtX:%s y:%s /// /// @class Bitmap /// @method GetPixel /// @csn colorAtX:%s y:%s function GetPixel(bmp: Bitmap; x, y: LongInt): Color; /// Returns the color of the pixel at the given x,y location. /// /// @lib /// @sn colorOnScreenAtX:%s y:%s function GetPixelFromScreen(x, y: LongInt): Color; //============================================================================= implementation //============================================================================= uses Classes, SysUtils, // system SDL_gfx, SDL, SDL_Image, // sdl sgCamera, sgPhysics, sgShared, sgCore, sgGeometry, sgResources, sgImages; /// Clears the surface of the screen to the passed in color. /// /// @param toColor: The colour to clear the bitmap to /// /// Side Effects: /// - Screen's surface is set to the toColor procedure ClearScreen(toColor : Color); overload; begin ClearSurface(screen, toColor); end; /// Clears the screen to Black. /// /// Side Effects: /// - screen's surface is set to black procedure ClearScreen(); overload; begin ClearScreen(ColorBlack); end; function GetPixel(bmp: Bitmap; x, y: LongInt): Color; begin if not Assigned(bmp) then begin RaiseException('No bitmap supplied'); exit; end; if (x < 0) or (x >= bmp^.width) or (y < 0) or (y >= bmp^.height) then begin result := 0; exit; end; result := GetPixel32(bmp^.surface, x, y); end; function GetPixelFromScreen(x, y: LongInt): Color; begin result := GetPixel(screen, x, y); end; procedure PutPixel(bmp: Bitmap; value: Color; x, y: LongInt); var clr: Color; p: ^Color; bpp: LongInt; begin if not assigned(bmp) then exit; clr := ColorFrom(bmp, value); bpp := bmp^.surface^.format^.BytesPerPixel; // Here p is the address to the pixel we want to set p := bmp^.surface^.pixels + y * bmp^.surface^.pitch + x * bpp; if bpp <> 4 then RaiseException('PutPixel only supported on 32bit images.'); p^ := clr; end; /// Draws a pixel onto the screen. /// /// @param clr: The color to draw the pixel /// @param x,y: The x,y location to draw the pixel at /// /// Side Effects: /// - Sets one pixel on the screen procedure DrawPixelOnScreen(clr: Color; x, y: LongInt); begin DrawPixel(screen, clr, x, y); end; procedure DrawPixel(clr: Color; x, y: Single); overload; begin DrawPixelOnScreen(clr, sgCamera.ToScreenX(x), sgCamera.ToScreenY(y)); end; /// Draws a rectangle on the screen. /// /// @param clr: The color to draw the rectangle /// @param filled: True to draw a filled rectangle, false for outline /// @param xPos,yPos: The x,y location to draw the rectangle at /// @param width,height: The width and height of the rectangle /// /// Side Effects: /// - Draws a rectangle in the dest bitmap procedure DrawRectangleOnScreen(clr : Color; filled : Boolean; xPos, yPos, width, height : LongInt); overload; begin DrawRectangle(screen, clr, filled, xPos, yPos, width, height); end; procedure DrawRectangle(clr : Color; filled : Boolean; xPos, yPos: Single; width, height : LongInt); overload; begin DrawRectangle(screen, clr, filled, sgCamera.ToScreenX(xPos), sgCamera.ToScreenY(yPos), width, height); end; /// Draws the outline of a rectangle on the screen. /// /// @param clr: The color to draw the rectangle /// @param xPos,yPos: The x,y location to draw the rectangle at /// @param width,height: The width and height of the rectangle /// /// Side Effects: /// - Draws a rectangle on the screen procedure DrawRectangleOnScreen(clr : Color; xPos, yPos, width, height : LongInt); overload; begin DrawRectangle(screen, clr, xPos, yPos, width, height); end; procedure DrawRectangle(clr: Color; xPos, yPos: Single; width, height : LongInt); overload; begin DrawRectangle(screen, clr, sgCamera.ToScreenX(xPos), sgCamera.ToScreenY(yPos), width, height); end; /// Draws a filled rectangle on the screen. /// /// @param clr: The color to draw the rectangle /// @param xPos,yPos: The x,y location to draw the rectangle at /// @param width,height: The width and height of the rectangle /// /// Side Effects: /// - Draws a rectangle on the screen procedure FillRectangleOnScreen(clr : Color; xPos, yPos, width, height : LongInt); overload; begin FillRectangle(screen, clr, xPos, yPos, width, height); end; procedure FillRectangle(clr : Color; xPos, yPos: Single; width, height : LongInt); overload; begin FillRectangle(screen, clr, sgCamera.ToScreenX(xPos), sgCamera.ToScreenY(yPos), width, height); end; /// Draws a line on the screen. /// /// @param clr: The color to draw the line /// @param xPosStart,yPosStart: The x,y location to start the line at /// @param xPosEnd, yPosEnd: The x,y location to end the line at /// /// Side Effects: /// - Draws a line in the screen procedure DrawLineOnScreen(clr: Color; xPosStart, yPosStart, xPosEnd, yPosEnd: LongInt); overload; begin DrawLine(screen, clr, xPosStart, yPosStart, xPosEnd, yPosEnd); end; procedure DrawLine(clr: Color; xPosStart, yPosStart, xPosEnd, yPosEnd: Single); overload; begin DrawLine(screen, clr, sgCamera.ToScreenX(xPosStart), sgCamera.ToScreenY(yPosStart), sgCamera.ToScreenX(xPosEnd), sgCamera.ToScreenY(yPosEnd)); end; procedure DrawLine(clr: Color; const line: LineSegment); overload; begin DrawLine(clr, line.startPoint.x, line.startPoint.y, line.endPoint.x, line.endPoint.y); end; procedure DrawLine(clr: Color; const startPt, endPt: Point2D); overload; begin DrawLine(clr, startPt.x, startPt.y, endPt.x, endPt.y); end; procedure DrawLine(dest: Bitmap; clr: Color; const line: LineSegment); overload; begin DrawLine(dest, clr, Round(line.startPoint.x), Round(line.startPoint.y), Round(line.endPoint.x), Round(line.endPoint.y)); end; procedure DrawLine(dest: Bitmap; clr: Color; const startPt, endPt: Point2D); overload; begin DrawLine(dest, clr, Round(startPt.x), Round(startPt.y), Round(endPt.x), Round(endPt.y)); end; procedure DrawTriangle(clr: Color; filled: Boolean; const tri: Triangle); overload; begin if filled then FillTriangle(clr, tri) else DrawTriangle(clr, tri); end; procedure DrawTriangle(dest: Bitmap; clr: Color; filled: Boolean; const tri: Triangle); overload; begin if filled then FillTriangle(dest, clr, tri) else DrawTriangle(dest, clr, tri); end; procedure DrawTriangle(dest: Bitmap; clr: Color; const tri: Triangle); overload; begin DrawTriangle(dest, clr, tri[0].x, tri[0].y, tri[1].x, tri[1].y, tri[2].x, tri[2].y); end; procedure DrawTriangleOnScreen(clr: Color; filled: Boolean; const tri: Triangle); overload; begin if filled then FillTriangleOnScreen(clr, tri) else DrawTriangleOnScreen(clr, tri); end; procedure DrawTriangleOnScreen(clr: Color; const tri: Triangle); overload; begin DrawTriangle(screen, clr, tri[0].x, tri[0].y, tri[1].x, tri[1].y, tri[2].x, tri[2].y); end; procedure DrawTriangle(clr: Color; const tri: Triangle); overload; begin DrawTriangle(clr, tri[0].x, tri[0].y, tri[1].x, tri[1].y, tri[2].x, tri[2].y); end; procedure DrawTriangle(clr: Color; x1, y1, x2, y2, x3, y3: Single); overload; begin DrawTriangle(screen, clr, sgCamera.ToScreenX(x1), sgCamera.ToScreenY(y1), sgCamera.ToScreenX(x2), sgCamera.ToScreenY(y2), sgCamera.ToScreenX(x3), sgCamera.ToScreenY(y3)); end; procedure DrawTriangleOnScreen(clr: Color; x1, y1, x2, y2, x3, y3: Single); overload; begin DrawTriangle(screen, clr, x1, y1, x2, y2, x3, y3); end; procedure DrawTriangle(dest: Bitmap; clr: Color; x1, y1, x2, y2, x3, y3: Single); overload; begin trigonColor(dest^.surface, Round(x1), Round(y1), Round(x2), Round(y2), Round(x3), Round(y3), ToGfxColor(clr)); end; procedure FillTriangle(dest: Bitmap; clr: Color; const tri: Triangle); overload; begin FillTriangle(dest, clr, tri[0].x, tri[0].y, tri[1].x, tri[1].y, tri[2].x, tri[2].y); end; procedure FillTriangle(clr: Color; const tri: Triangle); overload; begin FillTriangle(clr, tri[0].x, tri[0].y, tri[1].x, tri[1].y, tri[2].x, tri[2].y); end; procedure FillTriangle(clr: Color; x1, y1, x2, y2, x3, y3: Single); overload; begin FillTriangle(screen, clr, sgCamera.ToScreenX(x1), sgCamera.ToScreenY(y1), sgCamera.ToScreenX(x2), sgCamera.ToScreenY(y2), sgCamera.ToScreenX(x3), sgCamera.ToScreenY(y3)); end; procedure FillTriangleOnScreen(clr: Color; const tri: Triangle); overload; begin FillTriangle(screen, clr, tri[0].x, tri[0].y, tri[1].x, tri[1].y, tri[2].x, tri[2].y); end; procedure FillTriangleOnScreen(clr: Color; x1, y1, x2, y2, x3, y3: Single); overload; begin FillTriangle(screen, clr, x1, y1, x2, y2, x3, y3); end; procedure FillTriangle(dest: Bitmap; clr: Color; x1, y1, x2, y2, x3, y3: Single); overload; begin filledTrigonColor(dest^.surface, Round(x1), Round(y1), Round(x2), Round(y2), Round(x3), Round(y3), ToGfxColor(clr)); end; //============================================================================= procedure DrawHorizontalLineOnScreen(clr: Color; y, x1, x2: LongInt); overload; begin DrawHorizontalLine(screen, clr, y, x1, x2); end; procedure DrawHorizontalLine(clr: Color; y, x1, x2: Single); overload; begin DrawHorizontalLine(screen, clr, sgCamera.ToScreenY(y), sgCamera.ToScreenX(x1), sgCamera.ToScreenX(x2)); end; procedure DrawVerticalLineOnScreen(clr: Color; x, y1, y2: LongInt); overload; begin DrawVerticalLine(screen, clr, x, y1, y2); end; procedure DrawVerticalLine(clr: Color; x, y1, y2: Single); overload; begin DrawVerticalLine(screen, clr, sgCamera.ToScreenX(x), sgCamera.ToScreenY(y1), sgCamera.ToScreenY(y2)); end; //============================================================================= procedure DrawCircleOnScreen(clr: Color; filled: Boolean; xc, yc: Single; radius: LongInt); overload; begin DrawCircle(screen, clr, filled, xc, yc, radius); end; procedure DrawCircle(clr: Color; filled: Boolean; xc, yc: Single; radius: LongInt); overload; begin DrawCircle(screen, clr, filled, sgCamera.ToScreenX(xc), sgCamera.ToScreenY(yc), radius); end; procedure DrawCircleOnScreen(clr: Color; xc, yc: Single; radius: LongInt); overload; begin DrawCircle(screen, clr, xc, yc, radius); end; procedure DrawCircle(clr: Color; xc, yc: Single; radius: LongInt); overload; begin DrawCircle(screen, clr, sgCamera.ToScreenX(xc), sgCamera.ToScreenY(yc), radius); end; procedure FillCircleOnScreen(clr: Color; xc, yc: Single; radius: LongInt); overload; begin FillCircle(screen, clr, xc, yc, radius); end; procedure FillCircle(clr: Color; xc, yc: Single; radius: LongInt); overload; begin FillCircle(screen, clr, sgCamera.ToScreenX(xc), sgCamera.ToScreenY(yc), radius); end; procedure DrawCircle(dest: Bitmap; clr: Color; filled: Boolean; xc, yc: Single; radius: LongInt); overload; begin if filled then FillCircle(dest, clr, xc, yc, radius) else DrawCircle(dest, clr, xc, yc, radius); end; procedure DrawCircle(dest: Bitmap; clr: Color; xc, yc: Single; radius: LongInt); overload; begin aacircleColor(dest^.surface, Round(xc), Round(yc), Abs(radius), ToGfxColor(clr)); end; procedure FillCircle(dest: Bitmap; clr: Color; xc, yc: Single; radius: LongInt); begin filledCircleColor(dest^.surface, Round(xc), Round(yc), Abs(radius), ToGfxColor(clr)); end; procedure DrawCircle(dest: Bitmap; clr: Color; filled: Boolean; const c: Circle); overload; begin DrawCircle(dest, clr, filled, c.center.x, c.center.y, c.radius); end; procedure DrawCircle(dest: Bitmap; clr: Color; const c: Circle); overload; begin DrawCircle(dest, clr, False, c.center.x, c.center.y, c.radius) end; procedure FillCircle(dest: Bitmap; clr: Color; const c: Circle); overload; begin DrawCircle(dest, clr, True, c.center.x, c.center.y, c.radius) end; procedure DrawCircle(clr: Color; filled: Boolean; const c: Circle); overload; begin DrawCircle(screen, clr, filled, sgCamera.ToScreenX(c.center.x), sgCamera.ToScreenY(c.center.y), c.radius); end; procedure DrawCircle(clr: Color; const c: Circle); overload; begin DrawCircle(screen, clr, False, sgCamera.ToScreenX(c.center.x), sgCamera.ToScreenY(c.center.y), c.radius); end; procedure FillCircle(clr: Color; const c: Circle); overload; begin DrawCircle(screen, clr, True, sgCamera.ToScreenX(c.center.x), sgCamera.ToScreenY(c.center.y), c.radius); end; procedure DrawCircleOnScreen(clr: Color; filled: Boolean; const c: Circle); overload; begin DrawCircle(screen, clr, filled, c.center.x, c.center.y, c.radius); end; procedure DrawCircleOnScreen(clr: Color; const c: Circle); overload; begin DrawCircle(screen, clr, False, c.center.x, c.center.y, c.radius); end; procedure FillCircleOnScreen(clr: Color; const c: Circle); overload; begin DrawCircle(screen, clr, True, c.center.x, c.center.y, c.radius); end; //============================================================================= procedure DrawEllipseOnScreen(clr: Color; filled: Boolean; xPos, yPos, width, height: LongInt); overload; begin DrawEllipse(screen, clr, filled, xPos, yPos, width, height); end; procedure DrawEllipse(clr: Color; filled: Boolean; xPos, yPos: Single; width, height: LongInt); overload; begin DrawEllipse(screen, clr, filled, sgCamera.ToScreenX(xPos), sgCamera.ToScreenY(yPos), width, height); end; procedure DrawEllipseOnScreen(clr: Color; xPos, yPos, width, height: LongInt); overload; begin DrawEllipse(screen, clr, xPos, yPos, width, height); end; procedure DrawEllipse(clr: Color; xPos, yPos: Single; width, height: LongInt); overload; begin DrawEllipse(screen, clr, sgCamera.ToScreenX(xPos), sgCamera.ToScreenY(yPos), width, height); end; procedure FillEllipseOnScreen(clr: Color; xPos, yPos, width, height: LongInt); overload; begin FillEllipse(screen, clr, xPos, yPos, width, height); end; procedure FillEllipse(clr: Color; xPos, yPos: Single; width, height: LongInt); overload; begin FillEllipse(screen, clr, sgCamera.ToScreenX(xPos), sgCamera.ToScreenY(yPos), width, height); end; procedure DrawEllipse(dest: Bitmap; clr: Color; filled: Boolean; xPos, yPos, width, height: LongInt); overload; begin if filled then FillEllipse(dest, clr, xPos, yPos, width, height) else DrawEllipse(dest, clr, xPos, yPos, width, height); end; procedure DrawEllipse(dest: Bitmap; clr: Color; xPos, yPos, width, height: LongInt); overload; var halfWidth, halfHeight: Sint16; begin if width < 0 then begin xPos += width; width := -width; end; if height < 0 then begin yPos += height; height := -height; end; halfWidth := width div 2; halfHeight := height div 2; aaellipseColor(dest^.surface, xPos + halfWidth, yPos + halfHeight, halfWidth, halfHeight, ToGfxColor(clr)); end; procedure FillEllipse(dest: Bitmap; clr: Color; xPos, yPos, width, height: LongInt); var halfWidth, halfHeight: Sint16; begin if width < 0 then begin xPos += width; width := -width; end; if height < 0 then begin yPos += height; height := -height; end; halfWidth := width div 2; halfHeight := height div 2; filledEllipseColor(dest^.surface, xPos + halfWidth, yPos + halfHeight, halfWidth, halfHeight, ToGfxColor(clr)); end; //============================================================================= procedure DrawRectangle(dest: Bitmap; clr: Color; filled : Boolean; xPos, yPos, width, height : LongInt); overload; begin if filled then FillRectangle(dest, clr, xPos, yPos, width, height) else DrawRectangle(dest, clr, xPos, yPos, width, height); end; procedure DrawRectangle(dest: Bitmap; clr : Color; xPos, yPos, width, height : LongInt); overload; begin if dest = nil then begin RaiseException('No destination bitmap supplied'); exit; end; rectangleColor(dest^.surface, xPos, yPos, xPos + width - 1, yPos + height - 1, ToGfxColor(clr)); end; procedure FillRectangle(dest: Bitmap; clr : Color; xPos, yPos, width, height : LongInt); var rect: SDL_Rect; begin if dest = nil then begin RaiseException('No destination bitmap supplied'); exit; end; if width < 0 then begin rect.x := xPos + width; //move back by width width := -width; end else rect.x := xPos; if height < 0 then begin rect.y := yPos + height; //move up by height height := -height; end else rect.y := yPos; rect.w := width; rect.h := height; //SDL_FillRect(dest^.surface, @rect, clr); boxColor(dest^.surface, rect.x, rect.y, rect.x + width - 1, rect.y + height - 1, ToGfxColor(clr)); end; /// Draws a vertical line on the destination bitmap. /// /// @param dest: The destination bitmap - not optimised! /// @param clr: The color to draw the line /// @param x: The x location of the line /// @param y1, y2: The starting and ending y value of the line /// /// Side Effects: /// - Draws a line in the dest bitmap procedure DrawVerticalLine(dest: Bitmap; clr: Color; x, y1, y2: LongInt); begin if dest = nil then begin RaiseException('The destination bitmap to draw a vertical line is nil'); exit; end; vlineColor(dest^.surface, x, y1, y2, ToGfxColor(clr)); end; /// Draws a horizontal line on the destination bitmap. /// /// @param dest: The destination bitmap - not optimised! /// @param clr: The color to draw the line /// @param y: The y location of the line /// @param x1, x2: The starting and ending x value of the line /// /// Side Effects: /// - Draws a line in the dest bitmap procedure DrawHorizontalLine(dest: Bitmap; clr: Color; y, x1, x2: LongInt); begin if dest = nil then begin RaiseException('The destination bitmap to draw a vertical line is nil'); exit; end; hlineColor(dest^.surface, x1, x2, y, ToGfxColor(clr)); end; /// Draws a line on the destination bitmap. /// /// @param dest: The destination bitmap - not optimised! /// @param clr: The color to draw the line /// @param xPosStart,yPosStart: The x,y location to start the line at /// @param xPosEnd, yPosEnd: The x,y location to end the line at /// /// Side Effects: /// - Draws a line in the dest bitmap procedure DrawLine(dest: Bitmap; clr: Color; xPosStart, yPosStart, xPosEnd, yPosEnd: LongInt); begin aalineColor(dest^.surface, xPosStart, yPosStart, xPosEnd, yPosEnd, ToGfxColor(clr)); end; /// Draws a pixel onto the destination bitmap. /// /// @param dest: The destination bitmap - not optimised! /// @param clr: The color to draw the pixel /// @param x,y: The x,y location to draw the pixel at /// /// Side Effects: /// - Sets one pixel on the destination bitmap procedure DrawPixel(dest: Bitmap; clr: Color; x, y: LongInt); overload; begin if dest = nil then begin RaiseException('The destination bitmap to draw a pixel is nil'); exit; end; if (x < 0) or (x >= dest^.surface^.w) or (y < 0) or (y >= dest^.surface^.h) then exit; //if SDL_MUSTLOCK(dest^.surface) then SDL_LockSurface(dest^.surface); pixelColor(dest^.surface, x, y, ToGfxColor(clr)); //if SDL_MUSTLOCK(dest^.surface) then SDL_UnlockSurface(dest^.surface); end; procedure DrawPixel(dest: Bitmap; clr: Color; const position : Point2D); overload; begin DrawPixel(dest, clr, Round(position.x), Round(position.y)); end; procedure DrawRectangle(dest: Bitmap; clr : Color; filled : Boolean; const source: Rectangle); overload; begin DrawRectangle(dest, clr, filled, Round(source.x), Round(source.y), source.width, source.height); end; procedure DrawRectangle(dest: Bitmap; clr : Color; const source: Rectangle); overload; begin DrawRectangle(dest, clr, Round(source.x), Round(source.y), source.width, source.height); end; procedure FillRectangle(dest: Bitmap; clr : Color; const source: Rectangle); overload; begin FillRectangle(dest, clr, Round(source.x), Round(source.y), source.width, source.height); end; procedure DrawCircle(dest: Bitmap; clr: Color; filled: Boolean; const point: Point2D; radius: LongInt); overload; begin DrawCircle(dest, clr, filled, Round(point.x), Round(point.y), radius); end; procedure DrawCircle(dest: Bitmap; clr: Color; const point: Point2D; radius: LongInt); overload; begin DrawCircle(dest, clr, Round(point.x), Round(point.y), radius); end; procedure FillCircle(dest: Bitmap; clr: Color; const point: Point2D; radius: LongInt); overload; begin FillCircle(dest, clr, Round(point.x), Round(point.y), radius); end; procedure DrawEllipse(dest: Bitmap; clr: Color; filled: Boolean; const source: Rectangle); overload; begin DrawEllipse(dest, clr, filled, Round(source.x), Round(source.y), source.width, source.height); end; procedure DrawEllipse(dest: Bitmap; clr: Color; const source: Rectangle); overload; begin DrawEllipse(dest, clr, Round(source.x), Round(source.y), source.width, source.height); end; procedure FillEllipse(dest: Bitmap; clr: Color; const source: Rectangle); overload; begin FillEllipse(dest, clr, Round(source.x), Round(source.y), source.width, source.height); end; procedure DrawPixel(clr: Color; const position: Point2D); overload; begin DrawPixel(clr, Round(position.x), Round(position.y)); end; procedure DrawRectangle(clr : Color; filled : Boolean; const source : Rectangle); overload; begin DrawRectangle(clr, filled, Round(source.x), Round(source.y), source.width, source.height); end; procedure DrawRectangle(clr : Color; const source : Rectangle); overload; begin DrawRectangle(clr, Round(source.x), Round(source.y), source.width, source.height); end; procedure FillRectangle(clr : Color; const source : Rectangle); overload; begin FillRectangle(clr, Round(source.x), Round(source.y), source.width, source.height); end; procedure DrawCircle(clr: Color; filled: Boolean; const position: Point2D; radius: LongInt); overload; begin DrawCircle(clr, filled, Round(position.x), Round(position.y), radius); end; procedure DrawCircle(clr: Color; const position: Point2D; radius: LongInt); overload; begin DrawCircle(clr, Round(position.x), Round(position.y), radius); end; procedure FillCircle(clr: Color; const position: Point2D; radius: LongInt); overload; begin FillCircle(clr, position.x, position.y, radius); end; procedure DrawEllipse(clr: Color; filled: Boolean; const source: Rectangle); overload; begin DrawEllipse(clr, filled, Round(source.x), Round(source.y), source.width, source.height); end; procedure DrawEllipse(clr: Color; const source: Rectangle); overload; begin DrawEllipse(clr, Round(source.x), Round(source.y), source.width, source.height); end; procedure FillEllipse(clr: Color; const source: Rectangle); overload; begin FillEllipse(clr, Round(source.x), Round(source.y), source.width, source.height); end; procedure DrawPixelOnScreen(clr: Color; const position: Point2D); overload; begin DrawPixelOnScreen(clr, Round(position.x), Round(position.y)); end; procedure DrawRectangleOnScreen(clr : Color; filled : Boolean; const source : Rectangle); overload; begin DrawRectangleOnScreen(clr, filled, Round(source.x), Round(source.y), source.width, source.height); end; procedure DrawRectangleOnScreen(clr : Color; const source : Rectangle); overload; begin DrawRectangleOnScreen(clr, Round(source.x), Round(source.y), source.width, source.height); end; procedure FillRectangleOnScreen(clr : Color; const source : Rectangle); overload; begin FillRectangleOnScreen(clr, Round(source.x), Round(source.y), source.width, source.height); end; procedure DrawLineOnScreen(clr: Color; const line: LineSegment); overload; begin DrawLineOnScreen(clr, Round(line.startPoint.x), Round(line.startPoint.y), Round(line.endPoint.x), Round(line.endPoint.y)); end; procedure DrawLineOnScreen(clr: Color; const startPt, endPt: Point2D); overload; begin DrawLineOnScreen(clr, Round(startPt.x), Round(startPt.y), Round(endPt.x), Round(endPt.y)); end; procedure DrawCircleOnScreen(clr: Color; filled: Boolean; const position: Point2D; radius: LongInt); overload; begin DrawCircleOnScreen(clr, filled, Round(position.x), Round(position.y), radius); end; procedure DrawCircleOnScreen(clr: Color; const position: Point2D; radius: LongInt); overload; begin DrawCircleOnScreen(clr, Round(position.x), Round(position.y), radius); end; procedure FillCircleOnScreen(clr: Color; const position: Point2D; radius: LongInt); overload; begin FillCircleOnScreen(clr, Round(position.x), Round(position.y), radius); end; procedure DrawEllipseOnScreen(clr: Color; filled: Boolean; const source: Rectangle); overload; begin DrawEllipseOnScreen(clr, filled, Round(source.x), Round(source.y), source.width, source.height); end; procedure DrawEllipseOnScreen(clr: Color; const source: Rectangle); overload; begin DrawEllipseOnScreen(clr, Round(source.x), Round(source.y), source.width, source.height); end; procedure FillEllipseOnScreen(clr: Color; const source: Rectangle); overload; begin FillEllipseOnScreen(clr, Round(source.x), Round(source.y), source.width, source.height); end; procedure ResetClip(bmp: Bitmap); overload; begin if bmp = nil then exit; SetLength(bmp^.clipStack, 0); SDL_SetClipRect(bmp^.surface, nil); end; procedure ResetClip(); overload; begin ResetClip(screen); end; procedure DoSetClip(bmp: Bitmap; const r: Rectangle); overload; var rect: SDL_Rect; begin if bmp = nil then begin RaiseException('Cannot set clip, bmp must not be nil'); exit; end; rect := NewSDLRect(Round(r.x), Round(r.y), r.width, r.height); SDL_SetClipRect(bmp^.surface, @rect); end; procedure PushClip(bmp: Bitmap; const r: Rectangle); overload; begin SetLength(bmp^.clipStack, Length(bmp^.clipStack) + 1); if Length(bmp^.clipStack) > 1 then begin // WriteLn('Adding clip ', RectangleToString(r)); // WriteLn('Was ', RectangleToString(bmp^.clipStack[High(bmp^.clipStack) - 1])); bmp^.clipStack[high(bmp^.clipStack)] := Intersection(r, bmp^.clipStack[High(bmp^.clipStack) - 1]); // WriteLn('Now ', RectangleToString(bmp^.clipStack[High(bmp^.clipStack)])); end else bmp^.clipStack[high(bmp^.clipStack)] := r; DoSetClip(bmp, bmp^.clipStack[high(bmp^.clipStack)]); end; procedure SetClip(x, y, w, h: LongInt); overload; begin SetClip(screen, RectangleFrom(x, y, w, h)); end; procedure SetClip(bmp: Bitmap; x, y, w, h: LongInt); overload; begin SetClip(bmp, RectangleFrom(x, y, w, h)); end; procedure PushClip(x, y, w, h: LongInt); overload; begin PushClip(screen, RectangleFrom(x, y, w, h)); end; procedure PushClip(const r: Rectangle); overload; begin PushClip(screen, r); end; procedure SetClip(bmp: Bitmap; const r: Rectangle); overload; begin SetLength(bmp^.clipStack, 0); PushClip(bmp, r); end; procedure SetClip(const r: Rectangle); overload; begin SetClip(screen, r); end; procedure PopClip(); overload; begin PopClip(screen); end; procedure PopClip(bmp: Bitmap); overload; begin Setlength(bmp^.clipStack, Length(bmp^.clipStack)-1); if Length(bmp^.clipStack) > 0 then DoSetClip(bmp, bmp^.clipStack[High(bmp^.clipStack)]) else ResetClip(bmp); end; function CurrentClip(bmp: Bitmap): Rectangle; overload; begin if Length(bmp^.clipStack) <> 0 then result:= bmp^.clipStack[high(bmp^.clipStack)] else result:=BitmapRectangle(0, 0, bmp); end; function CurrentClip(): Rectangle; overload; begin result := CurrentClip(screen); end; //============================================================================= procedure DrawLines(clr: Color; const lines: LinesArray); //TODO: overload; var i: LongInt; begin for i := 0 to High(lines) do begin DrawLine(clr, lines[i]); end; end; //============================================================================= procedure DrawShapeAsPoint(dest: Bitmap; s:Shape; filled: Boolean; const offset: Point2D); overload; var pts: Point2DArray; begin pts := ShapePoints(s); if length(pts) = 0 then exit; DrawPixel(dest, s^.color, PointAdd(pts[0], offset)); end; procedure DrawShapeAsCircle(dest: Bitmap; s:Shape; filled: Boolean; const offset: point2D); overload; var // r: Single; // pts: Point2DArray; c: Circle; begin c := ShapeCircle(s); //pts := ShapePoints(s); //if length(pts) < 2 then exit; //r := PointPointDistance(pts[0], pts[1]); DrawCircle(dest, s^.color, filled, c); //PointAdd(pts[0], offset), Round(r)); end; // procedure DrawShapeAsEllipse(dest: Bitmap; s:Shape; filled: Boolean; const offset: Point2D); overload; // var // pts: Point2DArray; // begin // pts := ShapePoints(s); // if length(pts) < 2 then exit; // // DrawEllipse(dest, s^.color, filled, // Round(pts[0].x+offset.X), // Round(pts[0].y+offset.Y), // Round(pts[1].x) - Round(pts[0].x), // Round(pts[1].y) - Round(pts[0].y)); // end; procedure DrawShapeAsLine(dest: Bitmap; s:Shape; filled: Boolean; const offset: Point2D); overload; var //pts: Point2DArray; ln: LineSegment; begin ln := ShapeLine(s); // pts := ShapePoints(s); // if length(pts) < 2 then exit; DrawLine(dest, s^.color, ln); //PointAdd(pts[0], offset), PointAdd(pts[1], offset)); end; procedure _DrawTriangles(dest: Bitmap; s: Shape; filled: Boolean; const offset: Point2D; kind: ShapeKind); var i: LongInt; tri: TriangleArray; begin tri := ShapeTriangles(s, kind); for i := 0 to High(tri) do begin if filled then FillTriangle(s^.color, tri[i]) else DrawTriangle(s^.color, tri[i]); end; end; procedure DrawShapeAsTriangle(dest: Bitmap; s:Shape; filled: Boolean; const offset: Point2D); overload; // var // //pts: Point2DArray; // tri: Triangle; begin _DrawTriangles(dest, s, filled, offset, pkTriangle); // tri := ShapeTriangle(s); // // // pts := ShapePoints(s); // // if length(pts) < 3 then exit; // // if filled then // FillTriangle(dest, s^.color, tri) // //FillTriangle(dest, s^.color, pts[0].x+offset.X, pts[0].y+offset.Y, pts[1].x+offset.X, pts[1].y+offset.Y, pts[2].x+offset.X, pts[2].y+offset.Y) // else // DrawTriangle(dest, s^.color, tri); // //DrawTriangle(dest, s^.color, pts[0].x+offset.X, pts[0].y+offset.Y, pts[1].x+offset.X, pts[1].y+offset.Y, pts[2].x+offset.X, pts[2].y+offset.Y); end; procedure _DrawLines(dest: Bitmap; s: Shape; const offset: Point2D; kind: ShapeKind); var lines: LinesArray; i: LongInt; begin lines := ShapeLines(s, kind, offset); for i := 0 to High(lines) do begin DrawLine(dest, s^.color, lines[i]); end; end; procedure DrawShapeAsLineList(dest: Bitmap; s: Shape; filled: Boolean; const offset: Point2D); begin _DrawLines(dest, s, offset, pkLineList); end; // var // i: LongInt; // pts: Point2DArray; // begin // pts := ShapePoints(s); // // for i := 0 to Length(pts) div 2 - 1 do // begin // DrawLine(dest, s^.color, PointAdd(pts[i * 2], offset), PointAdd(pts[i * 2 + 1], offset)); // end; // end; procedure DrawShapeAsLineStrip(dest: Bitmap; s: Shape; filled: Boolean; const offset: Point2D); begin _DrawLines(dest, s, offset, pkLineStrip); end; // var // i: LongInt; // pts: Point2DArray; // begin // pts := ShapePoints(s); // // for i := 0 to Length(pts) - 2 do // begin // DrawLine(dest, s^.color, PointAdd(pts[i], offset), PointAdd(pts[i+ 1], offset)); // end; // end; {procedure DrawShapeAsPolygon(dest: Bitmap; s: Shape; filled: Boolean; const offset: Point2D); var i, l: LongInt; pts: Point2DArray; begin pts := ShapePoints(s); if Length(pts) < 3 then exit; l := Length(pts); if filled then begin for i := 0 to Length(pts) - 3 do begin FillTriangle(dest, s^.color, pts[i].x,pts[i].y, pts[i + 1].x, pts[i + 1].y, pts[(i + 2) mod l].x, pts[(i + 2) mod l].y); end; end else begin for i := 0 to Length(pts) - 2 + 1 do begin DrawLine(dest, s^.color, pts[i], pts[(i+ 1) mod l]); end; end; end;} // procedure DrawTriangleFan(dest: Bitmap; s: Shape; const offset: Point2D); // // var // // i: LongInt; // // pts: Point2DArray; // begin // DrawTriangleFan(dest, s, false, offset); // // pts := ShapePoints(s); // // // // for i := 0 to Length(pts) - 3 do // // begin // // DrawTriangle(dest, s^.color, // // pts[0].x+offset.X,pts[0].y+offset.Y, // // pts[i + 1].x+offset.X, pts[i + 1].y+offset.Y, // // pts[i + 2].x+offset.X, pts[i + 2].y+offset.Y); // // end; // end; // // procedure FillTriangleFan(dest: Bitmap; s: Shape; const offset: Point2D); // // var // // i: LongInt; // // pts: Point2DArray; // begin // DrawTriangleFan(dest, s, true, offset); // // pts := ShapePoints(s); // // // // for i := 0 to Length(pts) - 3 do // // begin // // FillTriangle(dest, s^.color, // // pts[0].x+offset.X,pts[0].y+offset.Y, // // pts[i + 1].x+offset.X, pts[i + 1].y+offset.Y, // // pts[i + 2].x+offset.X, pts[i + 2].y+offset.Y); // // end; // end; procedure DrawShapeAsTriangleFan(dest: Bitmap; s: Shape; filled: Boolean; const offset: Point2D); begin //if filled then FillTriangleFan(dest, s, offset) else DrawTriangleFan(dest, s, offset); _DrawTriangles(dest, s, filled, offset, pkTriangleFan); end; // procedure DrawTriangleStrip(dest: Bitmap; s: Shape; const offset: Point2D); // begin // DrawTriangleStrip(dest, s, false, offset); // end; // // var // // i: LongInt; // // pts: Point2DArray; // // begin // // pts := ShapePoints(s); // // // // for i := 0 to Length(pts) - 3 do // // begin // // DrawTriangle(dest, s^.color, // // pts[i].x+offset.X,pts[i].y+offset.Y, // // pts[i + 1].x+offset.X, pts[i + 1].y+offset.Y, // // pts[i + 2].x+offset.X, pts[i + 2].y+offset.Y); // // end; // // end; // // procedure FillTriangleStrip(dest: Bitmap; s: Shape; const offset: Point2D); // begin // DrawTriangleStrip(dest, s, true, offset); // end; // // // var // // i: LongInt; // // pts: Point2DArray; // // begin // // pts := ShapePoints(s); // // // // for i := 0 to Length(pts) - 3 do // // begin // // FillTriangle(dest, s^.color, // // pts[i].x+offset.X,pts[i].y+offset.Y, // // pts[i + 1].x+offset.X, pts[i + 1].y+offset.Y, // // pts[i + 2].x+offset.X, pts[i + 2].y+offset.Y); // // end; // // end; procedure DrawShapeAsTriangleStrip(dest: Bitmap; s: Shape; filled: Boolean; const offset: Point2D); begin _DrawTriangles(dest, s, filled, offset, pkTriangleStrip); //if filled then FillTriangleStrip(dest, s, offset) else DrawTriangleStrip(dest, s, offset); end; // procedure DrawTriangleList(dest: Bitmap; s: Shape; const offset: Point2D); // begin // DrawTriangleList(dest, s, false, offset); // end; // // var // // i: LongInt; // // pts: Point2DArray; // // begin // // pts := ShapePoints(s); // // // // for i := 0 to Length(pts) div 3 - 1 do // // begin // // DrawTriangle(dest, s^.color, // // pts[i * 3].x+offset.X, pts[i * 3].y+offset.Y, // // pts[i * 3 + 1].x+offset.X, pts[i * 3 + 1].y+offset.Y, // // pts[i * 3 + 2].x+offset.X, pts[i * 3 + 2].y+offset.Y); // // end; // // end; // // procedure FillTriangleList(dest: Bitmap; s: Shape; const offset: Point2D); // begin // DrawTriangleList(dest, s, true, offset); // end; // // var // // i: LongInt; // // pts: Point2DArray; // // begin // // pts := ShapePoints(s); // // // // for i := 0 to Length(pts) div 3 - 1 do // // begin // // FillTriangle(dest, s^.color, // // pts[i * 3].x+offset.X, pts[i * 3].y+offset.Y, // // pts[i * 3 + 1].x+offset.X, pts[i * 3 + 1].y+offset.Y, // // pts[i * 3 + 2].x+offset.X, pts[i * 3 + 2].y+offset.Y); // // end; // // end; procedure DrawShapeAsTriangleList(dest: Bitmap; s: Shape; filled: Boolean; const offset: Point2D); begin _DrawTriangles(dest, s, filled, offset, pkTriangleList); //if filled then FillTriangleList(dest, s, offset) else DrawTriangleList(dest, s, offset); end; procedure DrawShape(dest: Bitmap; s: Shape; filled: Boolean; const offset: Point2D); overload; var i: LongInt; begin s^.prototype^.drawWith(dest, s, filled, offset); for i := 0 to High(s^.subShapes) do begin DrawShape(dest, s^.subShapes[i], filled, offset); end; end; procedure DrawShape(dest: Bitmap; s: Shape; filled: Boolean); overload; begin DrawShape(dest, s, filled, PointAt(0,0)); end; procedure DrawShape(dest: Bitmap; s: Shape); overload; begin DrawShape(dest, s, false, PointAt(0,0)); end; procedure FillShape(dest: Bitmap; s: Shape); overload; begin DrawShape(dest, s, true, PointAt(0,0)); end; procedure DrawShape(s: Shape; filled: Boolean); overload; begin DrawShape(screen, s, filled, PointAt(-CameraX(), -CameraY())); end; procedure DrawShape(s: Shape); overload; begin DrawShape(screen, s, false, PointAt(-CameraX(), -CameraY())); end; procedure FillShape(s: Shape); overload; begin DrawShape(screen, s, true, PointAt(-CameraX, -CameraY)); end; procedure DrawShapeOnScreen(s: Shape; filled: Boolean); overload; begin DrawShape(screen, s, filled); end; procedure DrawShapeOnScreen(s: Shape); overload; begin DrawShapeOnScreen(s, false); end; procedure FillShapeOnScreen(s: Shape); overload; begin DrawShapeOnScreen(s, true); end; //============================================================================= initialization begin InitialiseSwinGame(); end; end.
unit Mobile.Component; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, System.IniFiles, IdCoderMIME, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, FMX.Controls.Presentation, FMX.ListBox, FMX.Objects, FMX.TabControl, FMX.ImgList, FMX.ListView.Types, FMX.ListView, FMX.Layouts, FMX.Media, FMX.Surfaces; type TMobileComponent = class class procedure TabControlPicture(LTabControl: TTabControl; LocalBitmap: TImage); class procedure TabControlPictureStream(LTabControl: TTabControl; LocalStream: TBytesStream); class procedure ListBoxGroupHeaderDyn(LListBox: TListBox; value: string); class procedure ListBoxItemsDyn(LListBox: TListBox; Str1: string); class procedure ListBoxFooterDyn(LListBox: TListBox; fString: string); { ObjectList } class procedure OLHeaderDyn(LListBox: TListBox; value: string); class procedure OLItemDyn(LListBox: TListBox; value: string); class procedure OLFooterDyn(LListBox: TListBox; value: string); class procedure ListViewFavorite(LListView: TListView; LocalCounter: integer; IL: TImageList; ImageIndex: integer); class function Reverse(Str: string): string; class function IntToBin(value: cardinal): string; class function Encrypt(StrValue: string): string; { MultiMedia File } class function ImageToBase64(fImage: TImage): string; class procedure ImageSaveToPNG(PathImage: String; fImage: TImage); class function ImageBMPBase64(fImage: TImage): string; end; const VarAcak = '===String Untuk MenEncrypt, ===' + 'Dapat Menggunakan String Sesuai keinginan anda' + 'Contoh : Lyric Lagu "My Sacrifice" dari Creed ' + 'Hello my friend we meet again ' + 'It"s been awhile where should we begin ' + 'Feels like forever ... ' + 'Within my heart are memories ' + 'Of perfect love that you gave to me ' + 'Oh I remember... ' + 'CHORUS: ' + 'When you are with me ' + 'Im Free, Im Careless, I Believe .. ' + 'Above all the others We"ll fly This brings tears ' + 'To my eyes.., My sacrifice... ' + 'We"ve seen our share of ups and downs ' + 'Oh...how quickly life can turn around ' + 'In an instant It feels so good to reunite ' + 'Within yourself and within your mind ' + 'Let"s find peace there... '; implementation { TMobileComponent } uses Container, ObjectBase; class function TMobileComponent.Encrypt(StrValue: string): string; var i, j : integer; CharFromStr: String; TempResult : string; begin Result := ''; // proses encrypt karakter for i := 1 to length(StrValue) do begin CharFromStr := copy(StrValue, i, 1); for j := 1 to length(VarAcak) do begin CharFromStr := chr((ord(CharFromStr[1]) xor ord(VarAcak[j]))); if j = length(VarAcak) then Result := Result + CharFromStr; end; end; TempResult := Result; Result := ''; for i := 1 to length(TempResult) do begin // menjadikan karakter hasil encrypt menjadu biner,dan // dipisahkan dengan tanda | Result := Result + IntToBin(ord(TempResult[i])) + '|'; end; end; class function TMobileComponent.ImageBMPBase64(fImage: TImage): string; var Stream: TMemoryStream; Surf : TBitmapSurface; aFile : string; begin // Compress Image with fImage.Bitmap do begin if Width > 1024 then begin // ScaleFactor := ImageContainer.Width / 1024; // Resize(Round(Width / ScaleFactor), Round(Height / ScaleFactor)); Resize(Round(Width / 2), Round(Height / 2)); end; end; // Comparison save file as BMP Stream := TMemoryStream.Create; try Surf := TBitmapSurface.Create; Stream.Position := 0; try Surf.Assign(fImage.Bitmap); // use the codec to save Surface to stream if not TBitmapCodecManager.SaveToStream(Stream, Surf, '.png') then raise EBitmapSavingFailed.Create('Error saving Bitmap to png'); finally Surf.Free; end; // do something with the png stream image Stream.Position := 0; // Convert Stream to Base64 Result := TIdEncoderMIME.EncodeStream(Stream); finally Stream.Free; end; end; class procedure TMobileComponent.ImageSaveToPNG(PathImage: String; fImage: TImage); var Stream: TMemoryStream; Surf : TBitmapSurface; begin Stream := TMemoryStream.Create; try Stream.Position := 0; Surf := TBitmapSurface.Create; try Surf.Assign(fImage.Bitmap); // use the codec to save Surface to stream if not TBitmapCodecManager.SaveToStream(Stream, Surf, '.png') then raise EBitmapSavingFailed.Create('Error saving Bitmap to png'); finally Surf.Free; end; // do something with the png stream image Stream.Position := 0; Stream.SaveToFile(PathImage + '.png'); finally Stream.Free; end; end; class function TMobileComponent.ImageToBase64(fImage: TImage): string; var A4198E65D : TMemoryStream; ScaleFactor: Single; begin try with fImage.Bitmap do begin // if Width > 1024 then // begin // ScaleFactor := fImage.Width / 1024; // Resize(Round(Width / ScaleFactor), Round(Height / ScaleFactor)); Resize(Round(Width / 2), Round(Height / 2)); // end; end; A4198E65D := TMemoryStream.Create; fImage.Bitmap.SaveToStream(A4198E65D); A4198E65D.Position := 0; Result := TIdEncoderMIME.EncodeStream(A4198E65D); finally A4198E65D.Free; end; end; class function TMobileComponent.IntToBin(value: cardinal): string; var i: integer; begin SetLength(Result, 32); for i := 1 to 32 do begin if ((value shl (i - 1)) shr 31) = 0 then Result[i] := '0' { do not localize } else Result[i] := '1'; { do not localize } end; end; class procedure TMobileComponent.ListBoxFooterDyn(LListBox: TListBox; fString: string); var LocalListBoxItem: TListBoxItem; begin LListBox.BeginUpdate; LocalListBoxItem := TListBoxGroupFooter.Create(LListBox); LocalListBoxItem.Parent := LListBox; LocalListBoxItem.TextSettings.Font.Family := 'Calibri'; LocalListBoxItem.TextSettings.Font.Style := [TFontStyle.fsBold]; LocalListBoxItem.TextSettings.FontColor := TalphaColors.Blue; LocalListBoxItem.TextSettings.WordWrap := True; LocalListBoxItem.TextSettings.HorzAlign := TTextAlign(1); LocalListBoxItem.Text := fString; LListBox.EndUpdate; end; class procedure TMobileComponent.ListBoxGroupHeaderDyn(LListBox: TListBox; value: string); var LocalListBoxGroupHeader: TListBoxGroupHeader; begin LListBox.BeginUpdate; LocalListBoxGroupHeader := TListBoxGroupHeader.Create(LListBox); LocalListBoxGroupHeader.Parent := LListBox; // LocalListBoxGroupHeader.Name := 'LLBGH'; LocalListBoxGroupHeader.Text := value; LListBox.EndUpdate; end; class procedure TMobileComponent.ListBoxItemsDyn(LListBox: TListBox; Str1: string); var LocalListBoxItem: TListBoxItem; begin LListBox.BeginUpdate; LocalListBoxItem := TListBoxItem.Create(LListBox); LocalListBoxItem.Parent := LListBox; LocalListBoxItem.TextSettings.Font.Family := 'Calibri'; LocalListBoxItem.TextSettings.Font.Size := 14; LocalListBoxItem.TextSettings.WordWrap := True; LocalListBoxItem.TextSettings.HorzAlign := TTextAlign(2); LocalListBoxItem.Text := Str1; LListBox.EndUpdate; end; class procedure TMobileComponent.ListViewFavorite(LListView: TListView; LocalCounter: integer; IL: TImageList; ImageIndex: integer); var LImage: TListItemImage; begin with LListView do begin BeginUpdate; LImage := TListItemImage.Create(LListView.Items.Item[LocalCounter]); LImage.Name := 'IL' + IntToStr(LocalCounter); LImage.Align := TListItemAlign.Leading; LImage.VertAlign := TListItemAlign.Center; LImage.PlaceOffset.Y := -25; LImage.PlaceOffset.X := 295; LImage.Width := 20; LImage.Height := 20; LImage.OwnsBitmap := False; Images := IL; LImage.ImageIndex := ImageIndex; EndUpdate; end; end; class procedure TMobileComponent.OLFooterDyn(LListBox: TListBox; value: string); var Element: TElement; begin LListBox.BeginUpdate; Element := TElement.Create(nil); Element.Left := 5; Element.Right := 5; Element.Width := 2; Element.Height := 2; Element.Fontsize := 20; Element.Text := value; Element.FontName := 'Calibri'; Element.ObjectName := 'Items' + random(10000).ToString + '_' + random(10000).ToString; Element.ObjectType := 'TListBoxGroupFooter'; DataList.Add(Element); { CreateObject } Element.ObjectInstance := TListBoxGroupFooter.Create(LListBox); ObjectList.Add(Element.ObjectInstance); with TListBoxGroupFooter(Element.ObjectInstance) do begin Parent := LListBox; Text := Element.Text; OnClick := Element.GetObjectName; TextSettings.Font.Style := [TFontStyle.fsBold]; end; LListBox.EndUpdate; end; class procedure TMobileComponent.OLHeaderDyn(LListBox: TListBox; value: string); var Element: TElement; begin LListBox.BeginUpdate; Element := TElement.Create(nil); Element.Left := 5; Element.Right := 5; Element.Width := 2; Element.Height := 2; Element.Fontsize := 14; Element.Text := value; Element.FontName := 'Cambria'; Element.ObjectName := 'Items' + random(10000).ToString + '_' + random(10000).ToString; Element.ObjectType := 'TListBoxGroupHeader'; DataList.Add(Element); { CreateObject } Element.ObjectInstance := TListBoxGroupHeader.Create(LListBox); ObjectList.Add(Element.ObjectInstance); with TListBoxGroupHeader(Element.ObjectInstance) do begin Parent := LListBox; Text := Element.Text; TextSettings.Font.Style := [TFontStyle.fsBold]; OnClick := Element.GetObjectName; end; LListBox.EndUpdate; end; class procedure TMobileComponent.OLItemDyn(LListBox: TListBox; value: string); var Element: TElement; begin LListBox.BeginUpdate; Element := TElement.Create(nil); Element.Left := 5; Element.Right := 5; Element.Width := 2; Element.Height := 2; Element.Fontsize := 8; Element.Text := value; Element.FontName := 'Calibri'; Element.ObjectName := 'Items' + random(10000).ToString + '_' + random(10000).ToString; Element.ObjectType := 'TListBoxItem'; DataList.Add(Element); { CreateObject } Element.ObjectInstance := TListBoxItem.Create(LListBox); ObjectList.Add(Element.ObjectInstance); with TListBoxItem(Element.ObjectInstance) do begin Parent := LListBox; Text := Element.Text; OnClick := Element.GetObjectName; // TextSettings.Font.Style := [TFontStyle.fsBold]; end; LListBox.EndUpdate; end; class function TMobileComponent.Reverse(Str: string): string; var i: integer; begin Result := ''; for i := length(Str) downto 1 do begin Result := Result + Str[i]; end; end; class procedure TMobileComponent.TabControlPictureStream(LTabControl: TTabControl; LocalStream: TBytesStream); var LocalTabItem: TTabItem; LocalImage : TImage; begin /// Item Image LocalTabItem := TTabItem.Create(LTabControl); LocalTabItem.Parent := LTabControl; Sleep(1000); /// Image LocalImage := TImage.Create(LocalTabItem); LocalImage.Align := TAlignLayout(9); LocalImage.Bitmap.LoadFromStream(LocalStream); end; class procedure TMobileComponent.TabControlPicture(LTabControl: TTabControl; LocalBitmap: TImage); var LocalTabItem: TTabItem; LocalImage : TImage; begin /// Item Image LocalTabItem := TTabItem.Create(LTabControl); LocalTabItem.Parent := LTabControl; Sleep(1000); /// Image LocalImage := TImage.Create(LocalTabItem); LocalImage.Align := TAlignLayout(9); LocalImage.Bitmap := LocalBitmap.Bitmap; end; end.
unit module; interface uses types; {$L ./module_asm.obj} {сортировка вставками} procedure sort( var head: ref_list ); pascal; external name 'sort'; {одноточечное скрещивание} function crossing_one( osob1, osob2: word ) : longword; pascal; external name 'crossing_one'; {двухточечное скрещивание} function crossing_two( osob1, osob2: word ) : longword; pascal; external name 'crossing_two'; {универсальное скрещивание} function crossing_universal( osob1, osob2: word; universal_chance: word ) : longword; pascal; external name 'crossing_universal'; {однородное скрещивание} function crossing_odnor( osob1, osob2: word ): word; pascal; external name 'crossing_odnor'; {мутация заменой} function mutation_change ( osob: word; change_chance: word ) : word; pascal; external name 'mutation_change'; {мутация перестановкой} function mutation_swap( osob: word ) : word; pascal; external name 'mutation_swap'; {мутация реверсом} function mutation_reverse( osob: word ) : word; pascal; external name 'mutation_reverse'; implementation (* {сортировка вставками} procedure sort( var head: ref_list ); var i, j: ref_list; begin i := head^.next; while i <> nil do begin j := i; while ( j <> head ) and ( j^.prev^.quality > i^.quality ) do j := j^.prev; insert( j^.prev, i, head, tail ); i := i^.next; end; end; {одноточечное скрещивание} function crossing_one( osob1, osob2: word ) : longword; var n: byte; {точка} mask_x, mask_y, new_osob: word; begin n := random( 15 ) + 1; {выбор точки} mask_y := stepen_2( n ) - 1; mask_x := max_word - mask_y; new_osob := ( osob1 and mask_x ) + ( osob2 and mask_y ); //add_tail( tail, new_osob ); new_osob := ( osob2 and mask_x ) + ( osob1 and mask_y ); //add_tail( tail, new_osob ); end; {двухточечное скрещивание} function crossing_two( osob1, osob2: word ) : longword; var n1, n2: byte; {точки} mask_x, mask_y, new_osob: word; begin n2 := random( m - 2 ) + 1; {выбор точек} n1 := n2 + random( m - n2 ) + 1; mask_y := stepen_2( n1 ) - stepen_2( n2 ); mask_x := max_word - stepen_2( n1 ) + stepen_2( n2 ); new_osob := ( osob1 and mask_x ) + ( osob2 and mask_y ); //add_tail( tail, new_osob ); new_osob := ( osob2 and mask_x ) + ( osob1 and mask_y ); //add_tail( tail, new_osob ); end; {универсальное скрещивание} function crossing_universal( osob1, osob2: word; universal_chance: word ) : longword; var i, shot: byte; new1, new2: word; begin new1 := 0; new2 := 0; for i := 1 to m do begin shot := random( 100 ) + 1; if ( universal_chance ) > shot then {есть попадание} begin new2 := new2 + ( osob1 and stepen_2( i - 1 ) ); new1 := new1 + ( osob2 and stepen_2( i - 1 ) ); end else begin new2 := new2 + ( osob2 and stepen_2( i - 1 ) ); new1 := new1 + ( osob1 and stepen_2( i - 1 ) ); end; end; //add_tail( tail, new1 ); //add_tail( tail, new2 ); end; {однородное скрещивание} function crossing_odnor( osob1, osob2: word ) : word; var mask, new_osob: word; begin mask := random( max_word + 1 ); {случайная маска} new_osob := ( osob1 and mask ) {единичные из первой} + ( osob2 and (not mask) ); {нулевые из второй} //add_tail( tail, new_osob ); end; {мутация заменой} function mutation_change ( osob: word; change_chance: word ) : word; var new_osob: word; shot, i: byte; begin new_osob := 0; for i := 1 to m do begin shot := random( 100 ) + 1; if ( 100 * change_chance ) > shot then {есть попадание} new_osob := new_osob + ( osob xor stepen_2( i - 1 ) ) else new_osob := new_osob + ( osob and stepen_2( i - 1 ) ); end; //add_tail( tail, new_osob ); end; {мутация перестановкой} function mutation_swap( osob: word ) : word; var new_osob: word; a, b: byte; {биты для swap} begin a := random( m ) + 1; b := random( m ) + 1; while b = a do b := random( m ) + 1; new_osob := swap( osob, a, b ); //add_tail( tail, new_osob ); end; {мутация реверсом} function mutation_reverse( osob: word ) : word; var new_osob: word; a, b: byte; begin new_osob := osob; a := random( m - 1 ) + 2; {точка реверсии} b := 1; while a > b do begin new_osob := swap( new_osob, a, b ); a := a - 1; b := b + 1; end; //add_tail( tail, new_osob ); end; *) begin end.
unit GX_CodeOpt; interface uses Classes, Controls, Forms, StdCtrls, ExtCtrls, ComCtrls, GX_BaseForm; type TfmCodeOptions = class(TfmBaseForm) btnOK: TButton; btnCancel: TButton; pgeCodeOpt: TPageControl; tabPaths: TTabSheet; tabLayout: TTabSheet; tabFonts: TTabSheet; lblStoragePath: TLabel; edPath: TEdit; sbBrowse: TButton; rbSide: TRadioButton; pnlSideSide: TPanel; shpLeft: TShape; shpRight: TShape; rbTop: TRadioButton; pnlTopBottom: TPanel; shpTop: TShape; shpBottom: TShape; lblTreeView: TLabel; lblEditor: TLabel; fcTreeview: TComboBox; fcEditor: TComboBox; lblSize: TLabel; udTreeview: TUpDown; udEditor: TUpDown; eTreeview: TEdit; eEditor: TEdit; procedure sbBrowseClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure eNumericKeyPress(Sender: TObject; var Key: Char); private procedure edPathOnFilesDropped(_Sender: TObject; _Files: TStrings); public constructor Create(_Owner: TComponent); override; end; implementation {$R *.dfm} uses SysUtils, GX_GenericUtils, GX_dzVclUtils; procedure TfmCodeOptions.sbBrowseClick(Sender: TObject); var Temp: string; begin Temp := edPath.Text; if GetDirectory(Temp) then edPath.Text := Temp; end; procedure TfmCodeOptions.FormCreate(Sender: TObject); begin fcTreeview.Items.Assign(Screen.Fonts); fcEditor.Items.Assign(Screen.Fonts); end; constructor TfmCodeOptions.Create(_Owner: TComponent); begin inherited; TControl_SetMinConstraints(Self); Constraints.MaxHeight := Height; TWinControl_ActivateDropFiles(edPath, edPathOnFilesDropped); TEdit_ActivateAutoComplete(edPath, [acsFileSystem], [actSuggest]); end; procedure TfmCodeOptions.eNumericKeyPress(Sender: TObject; var Key: Char); begin if not IsCharNumeric(Key) or IsCharTab(Key) then Key := #0; end; procedure TfmCodeOptions.edPathOnFilesDropped(_Sender: TObject; _Files: TStrings); begin edPath.Text := _Files[0]; end; end.
unit DAO.VerbaCEP; interface uses DAO.Base, Model.VerbaCEP, Generics.Collections, System.Classes; type TVerbaCEPDAO = class(TDAO) public function Insert(aVerbas: Model.VerbaCEP.TVerbaCEP): Boolean; function Update(aVerbas: Model.VerbaCEP.TVerbaCEP): Boolean; function Delete(sFiltro: String): Boolean; function FindVerba(sFiltro: String): TObjectList<Model.VerbaCEP.TVerbaCEP>; end; const TABLENAME = 'tbverbacep'; implementation uses System.SysUtils, FireDAC.Comp.Client, Data.DB; function TVerbaCEPDAO.Insert(aVerbas: Model.VerbaCEP.TVerbaCEP): Boolean; var sSQL : System.string; begin Result := False; aVerbas.ID := GetKeyValue(TABLENAME,'ID_VERBA'); sSQL := 'INSERT INTO ' + TABLENAME + ' '+ '(ID_VERBA, NUM_CEP_INICIAL, NUM_CEP_FINAL, VAL_VERBA, COD_GRUPO, ID_FAIXA, DES_LOG) ' + 'VALUES ' + '(:ID, :INICIO, :FINAL, :VERBA, :GRUPO, :FAIXA, :LOG);'; Connection.ExecSQL(sSQL,[aVerbas.ID, aVerbas.CEPInicial, aVerbas.CEPFinal, aVerbas.Verba, aVerbas.Grupo, aVerbas.Faixa, aVerbas.Log], [ftInteger, ftString, ftString, ftFloat, ftInteger, ftInteger, ftString]); Result := True; end; function TVerbaCEPDAO.Update(aVerbas: Model.VerbaCEP.TVerbaCEP): Boolean; var sSQL: System.string; begin Result := False; sSQL := 'UPDATE ' + TABLENAME + ' ' + 'SET ' + 'NUM_CEP_INICIAL = :INICIO, NUM_CEP_FINAL = :FINAL, VAL_VERBA = :VERBA, COD_GRUPO = :GRUPO, ID_FAIXA = :FAIXA, ' + 'DES_LOG = :LOG ' + 'WHERE ID_VERBA = :ID;'; Connection.ExecSQL(sSQL,[aVerbas.CEPInicial, aVerbas.CEPFinal, aVerbas.Verba, aVerbas.Grupo, aVerbas.Faixa, aVerbas.Log, aVerbas.ID],[ftString, ftString, ftFloat, ftInteger, ftInteger, ftString, ftInteger]); Result := True; end; function TVerbaCEPDAO.Delete(sFiltro: string): Boolean; var sSQL : String; begin Result := False; sSQL := 'DELETE FROM ' + TABLENAME + ' '; if not sFiltro.IsEmpty then begin sSQl := sSQL + sFiltro; end else begin Exit; end; Connection.ExecSQL(sSQL); Result := True; end; function TVerbaCEPDAO.FindVerba(sFiltro: string): TObjectList<Model.VerbaCEP.TVerbaCEP>; var FDQuery: TFDQuery; verbas: TObjectList<Model.VerbaCEP.TVerbaCEP>; begin FDQuery := TFDQuery.Create(nil); try FDQuery.Connection := Connection; FDQuery.SQL.Clear; FDQuery.SQL.Add('SELECT * FROM ' + TABLENAME); if not sFiltro.IsEmpty then begin FDQuery.SQL.Add(sFiltro); end; FDQuery.Open(); verbas := TObjectList<Model.VerbaCEP.TVerbaCEP>.Create(); while not FDQuery.Eof do begin verbas.Add(TVerbaCEP.Create(FDQuery.FieldByName('ID_VERBA').AsInteger, FDQuery.FieldByName('NUM_CEP_INICIAL').AsString, FDQuery.FieldByName('NUM_CEP_FINAL').AsString, FDQuery.FieldByName('VAL_VERBA').AsFloat, FDQuery.FieldByName('COD_GRUPO').AsInteger, FDQuery.FieldByName('ID_FAIXA').AsInteger, FDQuery.FieldByName('DES_LOG').AsString)); FDQuery.Next; end; Result := verbas; finally FDQuery.Free; end; end; end.
unit Tests.Rtti.Util; {$mode objfpc}{$H+} interface uses TypInfo, Rtti; {$ifndef fpc} type CodePointer = Pointer; TValueHelper = record helper for TValue function AsUnicodeString: UnicodeString; function AsAnsiString: AnsiString; function AsChar: Char; inline; function AsAnsiChar: AnsiChar; function AsWideChar: WideChar; end; {$endif} const {$if defined(cpui386) or defined(cpux86_64) or defined(cpum68k)} DefaultCC = ccReg; {$else} DefaultCC = ccStdCall; {$endif} function CopyValue({$ifdef fpc}constref{$else}const [ref]{$endif} aValue: TValue): TValue; function EqualValues({$ifdef fpc}constref{$else}const [ref]{$endif} aValue1, aValue2: TValue): Boolean; function TypeKindToStr(aTypeKind: TTypeKind): String; inline; function GetInstValue(aValue: TObject): TValue; function GetPointerValue(aValue: Pointer): TValue; function GetIntValue(aValue: SizeInt): TValue; function GetAnsiString(const aValue: AnsiString): TValue; function GetShortString(const aValue: ShortString): TValue; function GetSingleValue(aValue: Single): TValue; function GetDoubleValue(aValue: Double): TValue; function GetExtendedValue(aValue: Extended): TValue; function GetCompValue(aValue: Comp): TValue; function GetCurrencyValue(aValue: Currency): TValue; function GetArray(const aArg: array of SizeInt): TValue; implementation uses SysUtils, Math; {$ifndef fpc} function TValueHelper.AsUnicodeString: UnicodeString; begin Result := UnicodeString(AsString); end; function TValueHelper.AsAnsiString: AnsiString; begin Result := AnsiString(AsString); end; function TValue.AsWideChar: WideChar; begin if Kind <> tkWideChar then raise EInvalidCast.Create('Invalid cast'); Result := WideChar(Word(AsOrdinal)); end; function TValue.AsAnsiChar: AnsiChar; begin if Kind <> tkChar then raise EInvalidCast.Create('Invalid cast'); Result := AnsiChar(Byte(AsOrdinal)); end; function TValue.AsChar: Char; begin Result := AsWideChar; end; {$endif} function CopyValue({$ifdef fpc}constref{$else}const [ref]{$endif} aValue: TValue): TValue; var arrptr: Pointer; len, i: SizeInt; begin if aValue.Kind = tkDynArray then begin { we need to decouple the source reference, so we're going to be a bit cheeky here } len := aValue.GetArrayLength; arrptr := Nil; DynArraySetLength(arrptr, aValue.TypeInfo, 1, @len); TValue.Make(@arrptr, aValue.TypeInfo, Result); for i := 0 to len - 1 do Result.SetArrayElement(i, aValue.GetArrayElement(i)); end else TValue.Make(aValue.GetReferenceToRawData, aValue.TypeInfo, Result); end; function EqualValues({$ifdef fpc}constref{$else}const [ref]{$endif} aValue1, aValue2: TValue): Boolean; var td1, td2: PTypeData; i: SizeInt; begin {$ifdef debug} Writeln('Empty: ', aValue1.IsEmpty, ' ', aValue2.IsEmpty); Writeln('Kind: ', aValue1.Kind, ' ', aValue2.Kind); Writeln('Array: ', aValue1.IsArray, ' ', aValue2.IsArray); {$endif} if aValue1.IsEmpty and aValue2.IsEmpty then Result := True else if aValue1.IsEmpty and not aValue2.IsEmpty then Result := False else if not aValue1.IsEmpty and aValue2.IsEmpty then Result := False else if aValue1.IsArray and aValue2.IsArray then begin if aValue1.GetArrayLength = aValue2.GetArrayLength then begin Result := True; for i := 0 to aValue1.GetArrayLength - 1 do if not EqualValues(aValue1.GetArrayElement(i), aValue2.GetArrayElement(i)) then begin {$ifdef debug} Writeln('Element ', i, ' differs: ', HexStr(aValue1.GetArrayElement(i).AsOrdinal, 4), ' ', HexStr(aValue2.GetArrayElement(i).AsOrdinal, 4)); {$endif} Result := False; Break; end; end else Result := False; end else if aValue1.Kind = aValue2.Kind then begin td1 := aValue1.TypeData; td2 := aValue2.TypeData; case aValue1.Kind of tkBool: Result := aValue1.AsBoolean xor not aValue2.AsBoolean; tkSet: if td1^.SetSize = td2^.SetSize then if td1^.SetSize < SizeOf(SizeInt) then Result := aValue1.AsOrdinal = aValue2.AsOrdinal else Result := CompareMem(aValue1.GetReferenceToRawData, aValue2.GetReferenceToRawData, td1^.SetSize) else Result := False; tkEnumeration, tkChar, tkWChar, tkUChar, tkInt64, tkInteger: Result := aValue1.AsOrdinal = aValue2.AsOrdinal; tkQWord: Result := aValue1.AsUInt64 = aValue2.AsUInt64; tkFloat: if td1^.FloatType <> td2^.FloatType then Result := False else begin case td1^.FloatType of ftSingle: Result := SameValue(Single(aValue1.AsExtended), Single(aValue2.AsExtended)); ftDouble: Result := SameValue(Double(aValue1.AsExtended), Double(aValue2.AsExtended)); ftExtended: Result := SameValue(aValue1.AsExtended, aValue2.AsExtended); ftComp: Result := aValue1.AsInt64 = aValue2.AsInt64; ftCurr: Result := aValue1.AsCurrency = aValue2.AsCurrency; end; end; tkSString, tkUString, tkAString, tkWString: Result := aValue1.AsString = aValue2.AsString; tkDynArray, tkArray: if aValue1.GetArrayLength = aValue2.GetArrayLength then begin Result := True; for i := 0 to aValue1.GetArrayLength - 1 do if not EqualValues(aValue1.GetArrayElement(i), aValue2.GetArrayElement(i)) then begin Result := False; Break; end; end else Result := False; tkClass, tkClassRef, tkInterface, tkInterfaceRaw, tkPointer: Result := PPointer(aValue1.GetReferenceToRawData)^ = PPointer(aValue2.GetReferenceToRawData)^; tkProcVar: Result := PCodePointer(aValue1.GetReferenceToRawData)^ = PCodePointer(aValue2.GetReferenceToRawData)^; tkRecord, tkObject, tkMethod, tkVariant: begin if aValue1.DataSize = aValue2.DataSize then Result := CompareMem(aValue1.GetReferenceToRawData, aValue2.GetReferenceToRawData, aValue1.DataSize) else Result := False; end else Result := False; end; end else Result := False; end; function TypeKindToStr(aTypeKind: TTypeKind): String; begin {$ifdef fpc} Str(aTypeKind, Result); {$else} Result := GetEnumName(TypeInfo(TTypeKind), Ord(aTypeKind)); {$endif} end; function GetInstValue(aValue: TObject): TValue; begin Result := TValue.{$ifdef fpc}specialize{$endif}From<TObject>(aValue); end; function GetPointerValue(aValue: Pointer): TValue; begin Result := TValue.{$ifdef fpc}specialize{$endif}From<Pointer>(aValue); end; function GetIntValue(aValue: SizeInt): TValue; begin Result := TValue.{$ifdef fpc}specialize{$endif}From<SizeInt>(aValue); end; function GetAnsiString(const aValue: AnsiString): TValue; begin Result := TValue.{$ifdef fpc}specialize{$endif}From<AnsiString>(aValue); end; function GetShortString(const aValue: ShortString): TValue; begin Result := TValue.{$ifdef fpc}specialize{$endif}From<ShortString>(aValue); end; function GetSingleValue(aValue: Single): TValue; begin Result := TValue.{$ifdef fpc}specialize{$endif}From<Single>(aValue); end; function GetDoubleValue(aValue: Double): TValue; begin Result := TValue.{$ifdef fpc}specialize{$endif}From<Double>(aValue); end; function GetExtendedValue(aValue: Extended): TValue; begin Result := TValue.{$ifdef fpc}specialize{$endif}From<Extended>(aValue); end; function GetCompValue(aValue: Comp): TValue; begin Result := TValue.{$ifdef fpc}specialize{$endif}From<Comp>(aValue); end; function GetCurrencyValue(aValue: Currency): TValue; begin Result := TValue.{$ifdef fpc}specialize{$endif}From<Currency>(aValue); end; {$ifdef fpc} function GetArray(const aArg: array of SizeInt): TValue; begin Result := specialize OpenArrayToDynArrayValue<SizeInt>(aArg); end; {$endif} end.
{ Copyright (C) 2013-2019 Tim Sinaeve tim.sinaeve@gmail.com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. } unit LogViewer.ValueList.View; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, DDuce.DynamicRecord, DDuce.Components.ValueList; type TfrmValueList = class(TForm) pnlTop : TPanel; pnlBottom : TPanel; splHorizontal : TSplitter; private FFieldView : TValueList; FPropertyView : TValueList; FData : IDynamicRecord; {$REGION 'property access methods'} function GetFields: IDynamicRecord; function GetProperties: IDynamicRecord; procedure SetFields(const Value: IDynamicRecord); procedure SetProperties(const Value: IDynamicRecord); function GetData: IDynamicRecord; procedure SetData(const Value: IDynamicRecord); {$ENDREGION} protected procedure UpdateData; public procedure AfterConstruction; override; destructor Destroy; override; procedure Clear; property Data: IDynamicRecord read GetData write SetData; property Fields: IDynamicRecord read GetFields write SetFields; property Properties: IDynamicRecord read GetProperties write SetProperties; end; implementation {$R *.dfm} {$REGION 'construction and destruction'} procedure TfrmValueList.AfterConstruction; begin inherited AfterConstruction; FFieldView := TValueList.Create(Self); FFieldView.Parent := pnlTop; FFieldView.Align := alClient; FFieldView.ShowHeader := False; FFieldView.Editable := False; FPropertyView := TValueList.Create(Self); FPropertyView.Parent := pnlBottom; FPropertyView.Align := alClient; FPropertyView.ShowHeader := False; FPropertyView.Editable := False; end; destructor TfrmValueList.Destroy; begin FData := nil; FPropertyView.Data := nil; FFieldView.Data := nil; inherited Destroy; end; {$ENDREGION} {$REGION 'property access methods'} procedure TfrmValueList.Clear; begin FFieldView.Clear; FPropertyView.Clear; end; function TfrmValueList.GetData: IDynamicRecord; begin Result := FData; end; procedure TfrmValueList.SetData(const Value: IDynamicRecord); begin Clear; FData := Value; UpdateData; end; function TfrmValueList.GetFields: IDynamicRecord; begin Result := FFieldView.Data; end; procedure TfrmValueList.SetFields(const Value: IDynamicRecord); begin FFieldView.Data := Value; end; function TfrmValueList.GetProperties: IDynamicRecord; begin Result := FPropertyView.Data; end; procedure TfrmValueList.SetProperties(const Value: IDynamicRecord); begin FPropertyView.Data := Value; end; procedure TfrmValueList.UpdateData; var LFieldData : DynamicRecord; LPropertyData : DynamicRecord; F : IDynamicField; B : Boolean; begin if Assigned(Data) then begin if Data.ContainsField('') then begin B := False; for F in Data do begin if F.Name = '' then B := True else begin if B then LPropertyData[F.Name] := F.Value else LFieldData[F.Name] := F.Value; end; end; FFieldView.Data := LFieldData; FPropertyView.Data := LPropertyData; splHorizontal.Visible := True; FPropertyView.Visible := True; end else begin FFieldView.Data := FData; splHorizontal.Visible := False; FPropertyView.Visible := False; end; end; end; {$ENDREGION} end.
unit f2SaveLoadManager; interface uses furqContext; const cMaxSlotsNum = 7; type Tf2SaveLoadManager = class private f_SaveNameBase: string; f_SavePath: string; f_SaveNames: array [0..cMaxSlotsNum] of string; function GetSaveExt(aIdx: Integer): string; function pm_GetIsAnySaveExists: Boolean; function pm_GetIsOnlyAutoSaveExists: Boolean; function pm_GetSaveName(aIndex: Integer): string; procedure pm_SetSaveNameBase(const Value: string); procedure pm_SetSavePath(const Value: string); procedure RebuildSaveNames; public function GetAutoDesc(aSlotNum: Integer = 0): string; procedure GetSaveInfo(aIndex: Integer; out theCaption: string; out theDateTime: TDateTime); procedure LoadGame(aContext: TFURQContext; aSlotNum: Integer = 0; aIgnoreHash: Boolean = False); procedure SaveGame(aContext: TFURQContext; const aLocation: string; aDesc: string = ''; aSlotNum: Integer = 0); procedure SetSaveBase(const aContext: TFURQContext); property SavePath: string read f_SavePath write pm_SetSavePath; property IsAnySaveExists: Boolean read pm_GetIsAnySaveExists; property IsOnlyAutoSaveExists: Boolean read pm_GetIsOnlyAutoSaveExists; property SaveName[aIndex: Integer]: string read pm_GetSaveName; property SaveNameBase: string read f_SaveNameBase write pm_SetSaveNameBase; end; implementation uses SysUtils, f2Types; function Tf2SaveLoadManager.GetAutoDesc(aSlotNum: Integer = 0): string; begin if aSlotNum = 0 then Result := 'Автосохранение' else Result := 'Сохранение'; end; function Tf2SaveLoadManager.GetSaveExt(aIdx: Integer): string; begin if aIdx = 0 then Result := '.sav' else Result := Format('.s%.2d', [aIdx]); end; procedure Tf2SaveLoadManager.LoadGame(aContext: TFURQContext; aSlotNum: Integer = 0; aIgnoreHash: Boolean = False); begin SetSaveBase(aContext); if FileExists(SaveName[aSlotNum]) then aContext.LoadFromFile(SaveName[aSlotNum], aIgnoreHash); end; function Tf2SaveLoadManager.pm_GetIsAnySaveExists: Boolean; var I: Integer; begin Result := False; for I := 0 to cMaxSlotsNum do if FileExists(f_SaveNames[I]) then begin Result := True; Break; end; end; function Tf2SaveLoadManager.pm_GetIsOnlyAutoSaveExists: Boolean; var I: Integer; begin Result := False; if not FileExists(SaveName[0]) then Exit; for I := 1 to cMaxSlotsNum do if FileExists(SaveName[I]) then Exit; Result := True; end; procedure Tf2SaveLoadManager.GetSaveInfo(aIndex: Integer; out theCaption: string; out theDateTime: TDateTime); begin theCaption := ''; theDateTime := 0; if FileExists(f_SaveNames[aIndex]) then FURQReadSaveInfo(f_SaveNames[aIndex], theCaption, theDateTime); { begin DateTimeToString(l_DTS, 'd mmm yyyy, hh:nn:ss', l_DateTime); Result := Format('%s (%s)', [l_Desc, l_DTS]); end else Result := ''; end else Result := '';} end; function Tf2SaveLoadManager.pm_GetSaveName(aIndex: Integer): string; begin Result := f_SaveNames[aIndex]; end; procedure Tf2SaveLoadManager.pm_SetSaveNameBase(const Value: string); begin if f_SaveNameBase <> Value then begin f_SaveNameBase := Value; RebuildSaveNames; end; end; procedure Tf2SaveLoadManager.pm_SetSavePath(const Value: string); var I: Integer; begin f_SavePath := IncludeTrailingPathDelimiter(Value); RebuildSaveNames; end; procedure Tf2SaveLoadManager.RebuildSaveNames; var I: Integer; begin for I := 0 to cMaxSlotsNum do f_SaveNames[I] := f_SavePath + f_SaveNameBase + GetSaveExt(I); end; procedure Tf2SaveLoadManager.SaveGame(aContext: TFURQContext; const aLocation: string; aDesc: string = ''; aSlotNum: Integer = 0); begin SetSaveBase(aContext); if aDesc = '' then if aSlotNum = 0 then aDesc := 'Автосохранение' else aDesc := 'Сохранение'; aContext.SaveToFile(SaveName[aSlotNum], aLocation, aDesc); end; procedure Tf2SaveLoadManager.SetSaveBase(const aContext: TFURQContext); begin SaveNameBase := aContext.Variables[c_SaveNameBase]; end; end.
(*-------------------------------------------------------------*) (* Neuhold Michael *) (* Some initial tests with standard string Function *) (*-------------------------------------------------------------*) PROGRAM TestStringFunction; VAR s,s2: STRING; str2Insert: STRING; pos2Insert, len: INTEGER; i, code: INTEGER; r: REAL; FUNCTION SubString(s: String; start: INTEGER; len: INTEGER): STRING; BEGIN SubString := Copy(s,start,len); END; PROCEDURE InsertAt(VAR s: STRING; s2Insert: STRING; at: INTEGER); BEGIN s := SubString(s,1,at-1) + s2Insert + SubString(s, at, Length(s) - at + 1); END; BEGIN s := Concat('Das ist ein ','sehr schöner langer Test für die Standardfunktion',' concat'); s := Concat(s,s,s,s,s,s); (* zu viele Zeichen bricht dann nach 255 Zeichen einfach ab *); s2 := 'Das ist ein sehr schöner' + ' Test für die Standardfunktion'; WriteLn('s: ',s); WriteLn('s länge: ', length(s)); WriteLn('s2: ',s2); str2Insert := 'sehr, '; (* before 'sehr' *) pos2Insert := Pos('sehr', s2); len := Length(s2); //s2 := SubString(s,1,pos2Insert-1) + str2Insert + SubString(s2, pos2Insert, len - pos2Insert + 1); //InsertAt(s2,str2Insert,pos2Insert); Insert(str2Insert,s2,pos2Insert); FOR i := 1 TO length(s2) DO BEGIN Write(UpCase(s2[i])); END; WriteLn; Str(123.44:5:1,s2); WriteLn(s2); Val('1.23', r, code); WriteLn(r,', ', code); //WriteLn(UpCase(s2)); //WriteLn(s2); WriteLn; WriteLn('Zufallszahlen'); Randomize; FOR i := 1 TO 10 DO BEGIN WriteLn(Random:5:4); END; Randomize; FOR i := 1 TO 10 DO BEGIN WriteLn(Random(10)); END; END.
unit vcmDropDownMenuForChromeLike; interface uses Classes, Controls, Messages, Menus, Graphics, Types, Windows, vcmMainMenuForChromeLikeTypes, vcmBaseMenuForChromeLike, vcmMenuForChromeLikeItems; type TvcmDropDownMenuForChromeLike = class(TvcmBaseMenuForChromeLike) private f_Closing: Boolean; f_InShowing: Boolean; f_ItemHoveredTickCount: Cardinal; f_SubmenuItem: TvcmMenuForChromeLikeItem; f_ShowingSubmenu: Boolean; f_NeedDisplayShadow: Boolean; f_IsSubmenu: Boolean; f_OpenedSubmenu: TvcmDropDownMenuForChromeLike; f_OpenedSubmenuToClose: TvcmDropDownMenuForChromeLike; f_OpenedSubmenuCloseRequestedTickCount: Cardinal; f_DoNotOpenSubmenuOnHover: Boolean; f_BorderColor: TColor; f_SubMenuExpandDelay: Cardinal; f_SubMenuCollapseDelay: Cardinal; f_LastMouseDown: Cardinal; f_NeedSelectFirstItem: Boolean; f_NeedOpenHoveredAfterClosingItem: Boolean; f_IsDragging: Boolean; private procedure ExpandHoveredItemIfNeeded; {-} procedure CloseSubmenuAndExpandAnother(const anItem: TvcmMenuForChromeLikeItem); {-} protected function NeedAddItem(aRootItem: TMenuItem; anItem: TMenuItem; anIndex: Integer): Boolean; override; {-} procedure CloseCurrentOpenedSubmenu; override; {-} function GetItemSizeForAlign(const aTotalSize: TSize; anItem: TMenuItem): TSize; override; {-} function pm_GetMenuOrientation: TvcmBaseMenuForChromeLikeOrientation; override; {-} function pm_GetMenuItemMargins: TRect; override; {-} function CanHoverItem: Boolean; override; {-} procedure DoOnMenuClosed(aClosedMenu: TvcmBaseMenuForChromeLike; aClosedMenuResult: TvcmMenuShowingResult); override; {-} procedure ExecuteMenuItem(const anItem: TvcmMenuForChromeLikeItem; aByKeyboard: Boolean); override; {-} procedure ShowSubmenu(const anItem: TvcmMenuForChromeLikeItem; const aPoint: TPoint; aByKeyboard: Boolean); override; {-} function CheckPopupPoint(const aPoint: TPoint): TPoint; {-} procedure WMMouseActivate(var aMessage: TWMMouseActivate); message WM_MOUSEACTIVATE; {-} procedure CMCancelMode(var aMessage: TMessage); message CM_CANCELMODE; {-} procedure CMShowingChanged(var aMessage: TMessage); message CM_SHOWINGCHANGED; {-} procedure vcmMsgShowMenu(var aMessage: TMessage); message vcm_msgShowMenu; {-} procedure MouseDown(aButton: TMouseButton; aShift: TShiftState; aX: Integer; aY: Integer); override; {-} procedure CreateParams(var aParams: TCreateParams); override; {-} function GetSubmenuDropDownPoint(const anItem: TvcmMenuForChromeLikeItem): TPoint; override; {-} function pm_GetIsTopLevelMenu: Boolean; override; {-} function pm_GetCurrentOpenedSubmenu: TvcmBaseMenuForChromeLike; override; {-} procedure PaintItem(const anItem: TvcmMenuForChromeLikeItem; aState: TOwnerDrawState); override; {-} procedure DoAfterItemsPainted; override; {-} procedure SelectedItemChanged(const aPrevSelected: TvcmMenuForChromeLikeItem; const aNewSelected: TvcmMenuForChromeLikeItem; aByKeyboard: Boolean); override; {-} procedure HoveredItemChanged(const aPrevHovered: TvcmMenuForChromeLikeItem; const aNewHovered: TvcmMenuForChromeLikeItem); override; {-} procedure BeforeEnterMenuLoop; override; {-} procedure DoBeforePeekMessage; override; {-} procedure ProcessMouseMessage(var aMessage: TMsg); override; {-} function ProcessKeyPressed(aKey: Word; aActiveMenu: TvcmBaseMenuForChromeLike): Boolean; override; {-} procedure MouseMovedOverEmptyArea(aShift: TShiftState; const aPoint: TPoint); override; {-} procedure ActiveChanged(aIsActive: Boolean); override; {-} public procedure ShowMenu(const aPoint: TPoint; aNeedSelectFirstItem: Boolean); {-} procedure CloseMenu(aResult: TvcmMenuShowingResult); override; {-} procedure CloseOpenedSubmenuIfNeeded; override; {-} constructor Create(aOwner: TComponent; aParentMenu: TvcmBaseMenuForChromeLike); {-} property SubMenuExpandDelay: Cardinal read f_SubMenuExpandDelay write f_SubMenuExpandDelay; {-} property SubMenuCollapseDelay: Cardinal read f_SubMenuCollapseDelay write f_SubMenuCollapseDelay; {-} end; implementation uses ActnList, l3Base, SysUtils, MultiMon, UxTheme, Forms, afwFacade; type THackCustomForm = class(TCustomForm); const cBackgroundColor = $00F9F8FA; cDropDownMenuBorderColor = $00A0A0A0; cComboArrowFromTopItemEdgeDistance = 5; cComboArrowFromRightItemEdgeDistance = 6; cComboArrowHeight = 6; cComboArrowWidth = 3; cSubmenuExpandDelay: Cardinal = 200; cSubmenuCollapseDelay: Cardinal = 200; cMenuMargins: TRect = (Left: 3; Top: 3; Right: 3; Bottom: 3); procedure TvcmDropDownMenuForChromeLike.ExpandHoveredItemIfNeeded; var l_TickCount: Cardinal; begin l_TickCount := GetTickCount; if (not f_DoNotOpenSubmenuOnHover) and f_SubMenuItem.IsNull and (not HoveredItem.IsNull) and (HoveredItem.rItem.Count > 0) and ((l_TickCount - f_ItemHoveredTickCount) >= SubmenuExpandDelay) then begin f_OpenedSubmenuCloseRequestedTickCount := 0; ExecuteMenuItem(HoveredItem, False); end; end; procedure TvcmDropDownMenuForChromeLike.CloseSubmenuAndExpandAnother(const anItem: TvcmMenuForChromeLikeItem); begin // http://mdp.garant.ru/pages/viewpage.action?pageId=585407141 f_NeedOpenHoveredAfterClosingItem := True; CloseCurrentOpenedSubmenu; end; function TvcmDropDownMenuForChromeLike.NeedAddItem(aRootItem: TMenuItem; anItem: TMenuItem; anIndex: Integer): Boolean; var l_NextItem: TMenuItem; begin Result := (not anItem.IsLine) and inherited NeedAddItem(aRootItem, anItem, anIndex); if anItem.IsLine then if (anIndex < Pred(aRootItem.Count)) then begin l_NextItem := aRootItem.Items[Succ(anIndex)]; Result := (not l_NextItem.IsLine) and l_NextItem.Visible; end; end; procedure TvcmDropDownMenuForChromeLike.CloseCurrentOpenedSubmenu; begin if (not f_SubMenuItem.IsNull) and (f_OpenedSubmenu <> nil) and (not f_OpenedSubmenu.f_InShowing) then begin f_OpenedSubmenuToClose := f_OpenedSubmenu; f_OpenedSubmenuCloseRequestedTickCount := GetTickCount; end; end; function TvcmDropDownMenuForChromeLike.GetItemSizeForAlign(const aTotalSize: TSize; anItem: TMenuItem): TSize; begin Result := GetItemSize(anItem); Result.cx := aTotalSize.cx; end; function TvcmDropDownMenuForChromeLike.pm_GetMenuOrientation: TvcmBaseMenuForChromeLikeOrientation; begin Result := vcm_moVertical; end; function TvcmDropDownMenuForChromeLike.pm_GetMenuItemMargins: TRect; var l_Rect: TRect; l_AdjustedRect: TRect; begin if IsAppThemed then Result := cMenuMargins else begin l_Rect := Rect(0, 0, 12, 12); l_AdjustedRect := l_Rect; DrawEdge(Canvas.Handle, l_AdjustedRect, BDR_RAISEDINNER or BDR_RAISEDOUTER, BF_RECT or BF_ADJUST); Result.Top := l_AdjustedRect.Top - l_Rect.Top + 1; Result.Bottom := l_Rect.Bottom - l_AdjustedRect.Bottom + 1; Result.Left := l_AdjustedRect.Left - l_Rect.Left + 1; Result.Right := l_Rect.Right - l_AdjustedRect.Right + 1; end; end; function TvcmDropDownMenuForChromeLike.CanHoverItem: Boolean; begin Result := inherited CanHoverItem; end; procedure TvcmDropDownMenuForChromeLike.DoOnMenuClosed(aClosedMenu: TvcmBaseMenuForChromeLike; aClosedMenuResult: TvcmMenuShowingResult); begin f_ItemHoveredTickCount := 0; f_DoNotOpenSubmenuOnHover := True; f_OpenedSubmenu := nil; f_SubmenuItem := cNullMenuForChromeLikeItem; inherited; if f_NeedOpenHoveredAfterClosingItem then begin // - Нужно после закрытия текущего подменю открыть новое, то, которое выделено // http://mdp.garant.ru/pages/viewpage.action?pageId=585407141 f_DoNotOpenSubmenuOnHover := False; ExpandHoveredItemIfNeeded; f_NeedOpenHoveredAfterClosingItem := False; end; end; procedure TvcmDropDownMenuForChromeLike.ExecuteMenuItem(const anItem: TvcmMenuForChromeLikeItem; aByKeyboard: Boolean); var l_SubMenuResult: TvcmMenuShowingResult; l_Pt: TPoint; begin anItem.rItem.CallInitiateActions; if IsActiveItem(anItem) then begin if (anItem.rItem.Count = 0) then begin Visible := False; CloseMenu(vcm_msrExecuted); ClickMenuItem(anItem); end//if (anItem.rItem.Count = 0) else begin l_Pt := GetSubmenuDropDownPoint(anItem); ShowSubmenu(anItem, l_Pt, aByKeyboard); end;//if (not anItem.EQ(f_SubmenuItem)) end; end; procedure TvcmDropDownMenuForChromeLike.ShowSubmenu(const anItem: TvcmMenuForChromeLikeItem; const aPoint: TPoint; aByKeyboard: Boolean); var l_MenuItem: TMenuItem; l_OpenedSubmenu: TvcmBaseMenuForChromeLike; begin l_MenuItem := nil; if (f_OpenedSubmenu <> nil) then begin l_MenuItem := f_OpenedSubmenu.MenuItem; l_OpenedSubmenu := f_OpenedSubmenu; f_OpenedSubmenu := nil; f_SubmenuItem := cNullMenuForChromeLikeItem; f_DoNotOpenSubmenuOnHover := True; f_ShowingSubmenu := False; l_OpenedSubmenu.CloseMenu(vcm_msrClosed); end else if (l_MenuItem <> anItem.rItem) then begin f_SubmenuItem := anItem; f_OpenedSubmenu := TvcmDropDownMenuForChromeLike.Create(Owner, Self); f_DoNotOpenSubmenuOnHover := False; f_OpenedSubmenu.MenuItem := anItem.rItem; f_OpenedSubmenu.Parent := Parent; f_OpenedSubmenu.f_IsSubMenu := True; f_ShowingSubmenu := True; f_OpenedSubmenu.ShowMenu(aPoint, aByKeyboard); end; end; function TvcmDropDownMenuForChromeLike.CheckPopupPoint(const aPoint: TPoint): TPoint; function lp_GetMonitorRect(aMonitor: HMONITOR): TRect; var l_MonitorRect: TRect; l_MI: TMonitorInfoA; begin l3FillChar(Result, SizeOf(Result), 0); l3FillChar(l_MI, SizeOf(l_MI), 0); if (aMonitor <> 0) then begin l_MI.cbSize := SizeOf(l_MI); GetMonitorInfo(aMonitor, @l_MI); Result := l_MI.rcWork; end;//if (l_Monitor <> 0)... end;//lp_GetMonitorRect function lp_PlacePointToSingleMonitor(const aPoint: TPoint; const aMenuWndSize: TSize; const aFormMonitorRect: TRect; const aPointMonitorRect: TRect; aSameMonitor: Boolean): TPoint; var l_ParentItemCRect: TRect; l_ParentItemSRect: TRect; l_RightPoint: TPoint; l_CenterPoint: TPoint; l_DecidedMonitorRect: TRect; begin Result := aPoint; l_ParentItemCRect := ParentMenu.GetMenuParentItem(Self).rRect; l_ParentItemSRect.TopLeft := ParentMenu.ClientToScreen(l_ParentItemCRect.TopLeft); l_ParentItemSRect.BottomRight := ParentMenu.ClientToScreen(l_ParentItemCRect.BottomRight); l_CenterPoint := CenterPoint(l_ParentItemSRect); if PtInRect(aPointMonitorRect, l_CenterPoint) then begin if ((Result.X + aMenuWndSize.cx) > aPointMonitorRect.Right) then Result.X := aPointMonitorRect.Right - aMenuWndSize.cx; end else begin if (not aSameMonitor) and (ParentMenu = RootMenu) then begin Result := Point(aFormMonitorRect.Left, aPoint.Y); if ((Result.X + aMenuWndSize.cx) > aFormMonitorRect.Right) then Result.X := aFormMonitorRect.Right - aMenuWndSize.cx end else begin if (l_ParentItemSRect.Right > aFormMonitorRect.Right) and (ParentMenu = RootMenu) then Result.X := aFormMonitorRect.Right - aMenuWndSize.cx; end; end; if (MonitorFromPoint(Result, MONITOR_DEFAULTTONULL) = 0) then begin if (Result.X < aFormMonitorRect.Left) then Result.X := aFormMonitorRect.Left else if (Result.X > aFormMonitorRect.Right) then Result.X := aFormMonitorRect.Right - aMenuWndSize.cx; end; end; var l_Size: TSize; l_ParentForm: TCustomForm; l_ParentFormMonitor: HMONITOR; l_PointMonitor: HMONITOR; l_ParentFormMonitorRect: TRect; l_PointMonitorRect: TRect; l_PtOnAnotherMonitor: Boolean; l_MenuOnTwoMonitors: Boolean; begin l_PtOnAnotherMonitor := False; l_MenuOnTwoMonitors := False; l_ParentForm := GetParentForm(RootMenu); l_Size := TotalSize; CorrectBounds; Result := aPoint; l_ParentFormMonitor := MonitorFromWindow(l_ParentForm.Handle, MONITOR_DEFAULTTONEAREST); // - монитор, на котором расположена большая часть формы l_ParentFormMonitorRect := lp_GetMonitorRect(l_ParentFormMonitor); l_PointMonitor := MonitorFromPoint(aPoint, MONITOR_DEFAULTTONEAREST); // - монитор, в который попала точка aPoint l_PointMonitorRect := lp_GetMonitorRect(l_PointMonitor); Result := lp_PlacePointToSingleMonitor(aPoint, l_Size, l_ParentFormMonitorRect, l_PointMonitorRect, (l_PointMonitor = l_ParentFormMonitor)); end; procedure TvcmDropDownMenuForChromeLike.WMMouseActivate(var aMessage: TWMMouseActivate); begin aMessage.Result := MA_NOACTIVATE; end; procedure TvcmDropDownMenuForChromeLike.CMCancelMode(var aMessage: TMessage); begin inherited; CloseMenu(vcm_msrClosed); end; procedure TvcmDropDownMenuForChromeLike.CMShowingChanged(var aMessage: TMessage); begin if Showing then ShowWindow(Handle, SW_SHOWNOACTIVATE) else inherited; end; procedure TvcmDropDownMenuForChromeLike.vcmMsgShowMenu(var aMessage: TMessage); var l_Point: TPoint; l_ActualPoint: TPoint; begin if (not f_Closing) then begin f_InShowing := True; Assert(not (csDestroying in ComponentState)); Assert(not f_Closing); l_Point := Point(aMessage.WParam, aMessage.LParam); l_ActualPoint := CheckPopupPoint(l_Point); Left := l_ActualPoint.X; Top := l_ActualPoint.Y; Show; f_InShowing := False; Assert(not f_Closing); Assert(ParentMenu <> nil); if f_NeedSelectFirstItem then begin SelectFirstItem(True); f_NeedSelectFirstItem := False; end; if (not InMenuLoop) then EnterMenuLoop; end; end; procedure TvcmDropDownMenuForChromeLike.MouseDown(aButton: TMouseButton; aShift: TShiftState; aX: Integer; aY: Integer); var l_ItemUnderMouse: TvcmMenuForChromeLikeItem; begin l_ItemUnderMouse := GetItemAtPoint(Point(aX, aY)); if (aButton = mbLeft) and IsActiveItem(l_ItemUnderMouse) and ((GetTickCount - f_LastMouseDown) > cMouseUpInterval) then begin f_LastMouseDown := GetTickCount; ExecuteMenuItem(l_ItemUnderMouse, False); end; end; procedure TvcmDropDownMenuForChromeLike.CreateParams(var aParams: TCreateParams); begin inherited; if f_NeedDisplayShadow then aParams.WindowClass.Style := aParams.WindowClass.Style or CS_DROPSHADOW; aParams.Style := WS_POPUP and (not WS_VISIBLE); aParams.ExStyle := WS_EX_TOOLWINDOW or WS_EX_TOPMOST or WS_EX_NOACTIVATE; end; function TvcmDropDownMenuForChromeLike.GetSubmenuDropDownPoint(const anItem: TvcmMenuForChromeLikeItem): TPoint; var l_cPt: TPoint; begin l_cPt := Point(anItem.rRect.Right, anItem.rRect.Top); Result := ClientToScreen(l_cPt); end; function TvcmDropDownMenuForChromeLike.pm_GetIsTopLevelMenu: Boolean; begin Result := (f_OpenedSubmenu = nil); end; function TvcmDropDownMenuForChromeLike.pm_GetCurrentOpenedSubmenu: TvcmBaseMenuForChromeLike; begin Result := f_OpenedSubmenu; end; procedure TvcmDropDownMenuForChromeLike.PaintItem(const anItem: TvcmMenuForChromeLikeItem; aState: TOwnerDrawState); procedure lp_DrawArrow(const anItemRect: TRect; aIsHighlighted: Boolean); (* - рисует стрелку ">" для пунктов с подменю *) const cArrowColors: array[Boolean] of TColor = (clMenuText, clWhite); (* Для невыделенного пункта цвет стрелки - цвет текста меню, для выделенного - белый *) var l_Rect: TRect; l_Points: array[0..2] of TPoint; l_BrushRecall: TBrushRecall; l_PenRecall: TPenRecall; l_ArrowColor: TColor; begin with l_Rect do begin Right := anItemRect.Right - cComboArrowFromRightItemEdgeDistance; Left := l_Rect.Right - cComboArrowWidth; Top := anItemRect.Top + cComboArrowFromTopItemEdgeDistance; Bottom := l_Rect.Top + cComboArrowHeight; end;//with l_Rect l_Points[0] := Point(l_Rect.Left, l_Rect.Top); l_Points[1] := Point(l_Rect.Right, l_Rect.Top + (cComboArrowHeight div 2)); l_Points[2] := Point(l_Rect.Left, l_Rect.Bottom); l_BrushRecall := TBrushRecall.Create(Canvas.Brush); try l_PenRecall := TPenRecall.Create(Canvas.Pen); try l_ArrowColor := cArrowColors[aIsHighLighted]; with Canvas do begin Brush.Style := bsSolid; Brush.Color := l_ArrowColor; Pen.Style := psSolid; Pen.Color := l_ArrowColor; end;//with aCanvas Polygon(Canvas.Handle, l_Points[0], 3); // - Рисуем стрелку finally FreeAndNil(l_PenRecall); end;//try..finally finally FreeAndNil(l_BrushRecall); end;//try..finally end;//lp_DrawArrow begin inherited; if HasSubItems(anItem) and IsActiveItem(anItem) then lp_DrawArrow(anItem.rRect, (([odSelected, odFocused] * aState) <> [])); end; procedure TvcmDropDownMenuForChromeLike.DoAfterItemsPainted; var l_Styles: UINT; l_EdgesRect: TRect; l_AdditionalRect: TRect; begin if IsAppThemed then with Canvas do begin Brush.Style := bsClear; Pen.Style := psSolid; Pen.Width := 1; Pen.Color := cDropDownMenuBorderColor; Rectangle(ClientRect); end//with Canvas else begin l_Styles := BDR_RAISEDINNER or BDR_RAISEDOUTER; l_EdgesRect := ClientRect; DrawEdge(Canvas.Handle, l_EdgesRect, l_Styles, BF_RECT); l_AdditionalRect := ContentRect; InflateRect(l_AdditionalRect, 1, 1); with Canvas do begin Pen.Color := clBtnFace; Pen.Style := psSolid; Pen.Width := 1; Rectangle(l_AdditionalRect); end;//with Canvas end; end; procedure TvcmDropDownMenuForChromeLike.SelectedItemChanged(const aPrevSelected: TvcmMenuForChromeLikeItem; const aNewSelected: TvcmMenuForChromeLikeItem; aByKeyboard: Boolean); begin inherited; if (not aPrevSelected.EQ(aNewSelected)) and (not aByKeyboard) then f_DoNotOpenSubmenuOnHover := False; end; procedure TvcmDropDownMenuForChromeLike.HoveredItemChanged(const aPrevHovered: TvcmMenuForChromeLikeItem; const aNewHovered: TvcmMenuForChromeLikeItem); begin f_DoNotOpenSubmenuOnHover := False; if (not SelectedItem.IsNull) and (not SelectedItem.EQ(aNewHovered)) then SelectedItem := aNewHovered; Invalidate; f_ItemHoveredTickCount := GetTickCount; if (not f_SubmenuItem.IsNull) and (not f_SubmenuItem.EQ(HoveredItem)) then CloseSubmenuAndExpandAnother(aNewHovered); // - Нужно закрыть текущее меню и открыть то, которое под мышью end; procedure TvcmDropDownMenuForChromeLike.BeforeEnterMenuLoop; begin f_OpenedSubmenuCloseRequestedTickCount := 0; f_ItemHoveredTickCount := 0; Assert(not f_Closing); end; procedure TvcmDropDownMenuForChromeLike.DoBeforePeekMessage; begin inherited; if (f_OpenedSubmenuCloseRequestedTickCount = 0) then ExpandHoveredItemIfNeeded; CloseOpenedSubmenuIfNeeded; end; procedure TvcmDropDownMenuForChromeLike.ProcessMouseMessage(var aMessage: TMsg); function lp_GetMousePt: TPoint; begin Result.X := SmallInt(aMessage.LParam and $FFFF); Result.Y := SmallInt((aMessage.LParam shr 16) and $FFFF); end;//lp_GetMousePt var l_MousePt: TPoint; l_Form: TForm; l_MouseSPt: TPoint; l_MouseCPt: TPoint; l_MousePPt: TPoint; l_Control: TWinControl; l_ParentRect: TRect; l_IsClickInParentItem: Boolean; l_ShiftState: TShiftState; l_WasDragging: Boolean; l_Message: TMsg; begin l_MousePt := lp_GetMousePt; l_Control := FindControl(aMessage.hwnd); l_ShiftState := KeysToShiftState(Word(aMessage.WParam)); l_WasDragging := f_IsDragging; case aMessage.message of WM_MBUTTONDOWN, WM_RBUTTONDOWN, WM_RBUTTONDBLCLK, WM_LBUTTONDOWN, WM_LBUTTONDBLCLK, WM_LBUTTONUP: if (not Closing) and IsActive then begin if (aMessage.message = WM_LBUTTONUP) and (not f_IsDragging) then begin DispatchMessage(aMessage); Exit; end; f_IsDragging := False; // - http://mdp.garant.ru/pages/viewpage.action?pageId=586683697 l_ParentRect := ParentMenu.BoundsRect; GetCursorPos(l_MouseSPt); l_MouseCPt := ScreenToClient(l_MouseSPt); if (not PtInRect(ClientRect, l_MouseCPt)) then begin l_MousePPt := Parent.ScreenToClient(l_MouseSPt); l_IsClickInParentItem := ((l_Control <> nil) and (l_Control = ParentMenu) and (ParentMenu <> RootMenu) and (ParentMenu.GetItemAtPoint(l_MousePt).rItem = Self.MenuItem)); if (not l_IsClickInParentItem) then begin if (l_Control = nil) or (not (l_Control Is TvcmDropDownMenuForChromeLike)) and (l_Control <> RootMenu) and (not PtInRect(l_ParentRect, l_MouseSPt)) then // - Иначе при клике на пункте с подпунктами при открытом подменю // оно закроется. http://mdp.garant.ru/pages/viewpage.action?pageId=578889012 begin Visible := False; RootMenu.CloseMenuAndExecute(Self, vcm_msrClosedRecursive, MakeDispatchMessageCommand(aMessage)); Exit; end else begin DispatchMessage(aMessage); CloseMenu(vcm_msrClosed); Exit; end; DispatchMessage(aMessage); end; end//if (not PtInRect(ClientRect, l_MouseCPt)) else begin if ((aMessage.message = WM_LBUTTONUP) and l_WasDragging) then MouseDown(mbLeft, l_ShiftState, l_MouseCPt.X, l_MouseCPt.Y) else if (aMessage.message = WM_LBUTTONDOWN) then begin while true do if PeekMessage(l_Message, 0, WM_LBUTTONUP, WM_LBUTTONUP, PM_REMOVE) then begin MouseDown(mbLeft, l_ShiftState, l_MouseCPt.X, l_MouseCPt.Y); Break; // - http://mdp.garant.ru/pages/viewpage.action?pageId=588040332 end; end else DispatchMessage(aMessage); end; end; WM_MOUSEMOVE: begin if (l_Control <> nil) then begin l_MouseSPt := l_Control.ClientToScreen(lp_GetMousePt); l_MouseCPt := ScreenToClient(l_MouseSPt); if PtInRect(ClientRect, l_MouseCPt) then begin if ((aMessage.WParam and MK_LBUTTON) <> 0) then f_IsDragging := True; MouseMove(l_ShiftState, l_MouseCPt.X, l_MouseCPt.Y) // - http://mdp.garant.ru/pages/viewpage.action?pageId=586683697 end else DispatchMessage(aMessage); end else DispatchMessage(aMessage); end; else DispatchMessage(aMessage); end;//case aMessage.message end; function TvcmDropDownMenuForChromeLike.ProcessKeyPressed(aKey: Word; aActiveMenu: TvcmBaseMenuForChromeLike): Boolean; var l_CanProcessInParent: Boolean; begin l_CanProcessInParent := (aActiveMenu = Self) and (ParentMenu <> nil); Result := True; case aKey of VK_ESCAPE: begin if (aActiveMenu = Self) then begin CloseMenu(vcm_msrClosed); ParentMenu.NotifyKeyPressedInSubmenu(aKey, Self); end; end; VK_UP: begin f_DoNotOpenSubmenuOnHover := True; SelectPrevItem(True); end; VK_DOWN: begin f_DoNotOpenSubmenuOnHover := True; SelectNextItem(True); end; VK_RIGHT: begin if (not HasSelectedItem) and HasHoveredItem then SelectedItem := HoveredItem; if HasSelectedItem and (SelectedItem.rItem.Count > 0) and SelectedItem.rItem.Enabled then ExecuteMenuItem(SelectedItem, True) else if l_CanProcessInParent then ParentMenu.NotifyKeyPressedInSubmenu(aKey, Self); end; VK_LEFT: if f_IsSubMenu then CloseMenu(vcm_msrClosed) else if l_CanProcessInParent then ParentMenu.NotifyKeyPressedInSubmenu(aKey, Self); VK_RETURN, VK_SPACE: begin if HasSelectedItem then ExecuteMenuItem(SelectedItem, True); end;//VK_RETURN else Result := False; end;//case l_KeyDownMessage.CharCode end; procedure TvcmDropDownMenuForChromeLike.MouseMovedOverEmptyArea(aShift: TShiftState; const aPoint: TPoint); begin inherited; if (ssLeft in aShift) then begin ResetSelection; Invalidate; end;//if (ssLeft in aShift) end; procedure TvcmDropDownMenuForChromeLike.ActiveChanged(aIsActive: Boolean); begin if (not aIsActive) and InMenuLoop then begin if IsTopLevelMenu then CloseMenu(vcm_msrClosedRecursive) else f_OpenedSubmenu.IsActive := aIsActive; end; end; procedure TvcmDropDownMenuForChromeLike.ShowMenu(const aPoint: TPoint; aNeedSelectFirstItem: Boolean); begin UpdateItems; Assert(not f_Closing); Handle; f_NeedSelectFirstItem := aNeedSelectFirstItem; PostMessage(Handle, vcm_msgShowMenu, aPoint.X, aPoint.Y); end; procedure TvcmDropDownMenuForChromeLike.CloseMenu(aResult: TvcmMenuShowingResult); var l_ParentForm: TCustomForm; begin Assert(not f_InShowing); CloseCurrentOpenedSubmenu; f_Closing := True; InMenuLoop := False; Visible := False; inherited; l_ParentForm := GetParentForm(Self); if (l_ParentForm <> nil) then UpdateWindow(l_ParentForm.Handle); // - http://mdp.garant.ru/pages/viewpage.action?pageId=589874760 end; procedure TvcmDropDownMenuForChromeLike.CloseOpenedSubmenuIfNeeded; var l_TickCount: Cardinal; begin l_TickCount := GetTickCount; if (not f_SubMenuItem.IsNull) and (f_OpenedSubmenu <> nil) and (f_OpenedSubmenuCloseRequestedTickCount <> 0) and (f_OpenedSubmenu = f_OpenedSubmenuToClose) and ((l_TickCount - f_OpenedSubmenuCloseRequestedTickCount) > SubmenuCollapseDelay) then begin f_OpenedSubmenu.CloseMenu(vcm_msrClosed); f_OpenedSubmenuCloseRequestedTickCount := 0; f_OpenedSubmenuToClose := nil; end;//if (not f_SubMenuItem.IsNull)... if (ParentMenu <> nil) and (not (csDestroying in ParentMenu.ComponentState)) then ParentMenu.CloseOpenedSubmenuIfNeeded; end; constructor TvcmDropDownMenuForChromeLike.Create(aOwner: TComponent; aParentMenu: TvcmBaseMenuForChromeLike); var l_DisplayShadow: BOOL; begin if SystemParametersInfo(SPI_GETDROPSHADOW, 0, @l_DisplayShadow, 0) then f_NeedDisplayShadow := l_DisplayShadow; ParentMenu := aParentMenu; f_OpenedSubmenu := nil; inherited Create(aOwner); Visible := False; f_BorderColor := cDropDownMenuBorderColor; f_SubMenuExpandDelay := cSubmenuExpandDelay; f_SubMenuCollapseDelay := cSubmenuCollapseDelay end; initialization InitThemeLibrary; finalization FreeThemeLibrary; end.
unit UCommon; interface uses Classes, uImage; type TObjList = class(TList) private FOwns: Boolean; protected function GetItem(Index: Integer): TObject; procedure SetItem(Index: Integer; const Value: TObject); procedure Notify(Ptr: Pointer; Action: TListNotification); override; public //** Конструктор. constructor Create(AOwns: Boolean = True); destructor Destroy(); override; procedure FreeClear(); property Items[Index: Integer]: TObject read GetItem write SetItem; default; property Owns:Boolean read FOwns write FOwns; end; // HOD hierarchy main object, all objects programmed must be its descendants THODObject = class(TObject) public constructor Create; end; THiddenCreateObject = class(THODObject) protected // hide the constructor constructor Create; end; const TimerTick = 50; var VV: TImage; PP: TImages; implementation uses uUtils; constructor TObjList.Create(AOwns: Boolean = True); begin inherited Create; FOwns := AOwns; end; destructor TObjList.Destroy; begin // if FOwns then // FreeClear; inherited; end; procedure TObjList.FreeClear; var j: Integer; begin // for j := 0 to Count - 1 do // TObject(Items[j]).Free; Clear; end; function TObjList.GetItem(Index: Integer): TObject; begin Result := TObject(inherited Get(Index)); end; procedure TObjList.Notify(Ptr: Pointer; Action: TListNotification); begin inherited; if (Action = lnDeleted) and FOwns and Assigned(Ptr) then TObject(Ptr).Free(); end; procedure TObjList.SetItem(Index: Integer; const Value: TObject); begin inherited Put(Index, Value); end; var W: Byte; { THiddenCreateObject } constructor THiddenCreateObject.Create; begin inherited Create; end; { THODObject } constructor THODObject.Create; begin inherited; end; initialization VV := TImage.Create; VV.Split(Path + 'Data\Images\GUI\NPCTradeTypeIcons.bmp', PP, 8, True); finalization if (High(PP) > 0) then for W := Low(PP) to High(PP) do PP[W].Free; VV.Free; end.
unit Providers.Mascara.CNPJ; interface uses Providers.Mascaras.Intf, System.MaskUtils, System.SysUtils; type TMascaraCNPJ = class(TInterfacedObject, IMascaras) private procedure RemovePontoTracoBarra(var Value: string); public function ExecMask(Value: string): string; end; implementation { TMascaraCNPJ } function TMascaraCNPJ.ExecMask(Value: string): string; begin RemovePontoTracoBarra(Value); Result := FormatMaskText('00\.000\.000\/0000\-00;0;', Value); end; procedure TMascaraCNPJ.RemovePontoTracoBarra(var Value: string); begin Delete(Value, AnsiPos('.', Value), 1); Delete(Value, AnsiPos('.', Value), 1); Delete(Value, AnsiPos('-', Value), 1); Delete(Value, AnsiPos('/', Value), 1); Delete(Value, AnsiPos('(', Value), 1); Delete(Value, AnsiPos(')', Value), 1); end; end.
unit DdhAppX; interface uses SysUtils, Windows, Messages, Classes, Graphics, Controls, Forms, Dialogs, ShellApi, Menus; type TDdhAppExt = class(TComponent) private // design time clone or runtime Application CurrApp: TApplication; // window procedures OldWndProc, NewWndProc: Pointer; // tray support fTrayIconActive: Boolean; fTrayIcon: TIcon; fTrayPopup: TPopupMenu; nid: TNotifyIconData; fOnTrayDefault: TNotifyEvent; fOnLBtnDown: TNotifyEvent; WM_TaskbarCreated:Cardinal; procedure IconTrayWndProc (var Msg: TMessage); protected // property and event access methods function GetIcon: TIcon; procedure SetIcon (Value: TIcon); function GetTitle: string; procedure SetTitle(Value: string); function GetHelpFile: string; procedure SetHelpFile(Value: string); function GetHintColor: TColor; procedure SetHintColor(Value: TColor); function GetHintPause: Integer; procedure SetHintPause(Value: Integer); function GetHintShortPause: Integer; procedure SetHintShortPause(Value: Integer); function GetHintHidePause: Integer; procedure SetHintHidePause(Value: Integer); function GetShowHint: Boolean; procedure SetShowHint(Value: Boolean); function GetOnActivate: TNotifyEvent; procedure SetOnActivate(Value: TNotifyEvent); function GetOnDeactivate: TNotifyEvent; procedure SetOnDeactivate(Value: TNotifyEvent); function GetOnException: TExceptionEvent; procedure SetOnException(Value: TExceptionEvent); function GetOnIdle: TIdleEvent; procedure SetOnIdle(Value: TIdleEvent); function GetOnHelp: THelpEvent; procedure SetOnHelp(Value: THelpEvent); function GetOnHint: TNotifyEvent; procedure SetOnHint(Value: TNotifyEvent); function GetOnMessage: TMessageEvent; procedure SetOnMessage(Value: TMessageEvent); function GetOnMinimize: TNotifyEvent; procedure SetOnMinimize(Value: TNotifyEvent); function GetOnRestore: TNotifyEvent; procedure SetOnRestore(Value: TNotifyEvent); function GetOnShowHint: TShowHintEvent; procedure SetOnShowHint(Value: TShowHintEvent); procedure SetTrayIconActive (Value: Boolean); procedure SetTrayIcon (Value: TIcon); procedure IconChange (Sender: TObject); procedure SetTrayHint (Value: string); function GetTrayHint: string; procedure SetTrayPopup (Value: TPopupMenu); procedure Notification(AComponent: TComponent; Operation: TOperation); override; public constructor Create (AOwner: TComponent); override; destructor Destroy; override; published // TApplication properties property Icon: TIcon read GetIcon write SetIcon ; property Title: string read GetTitle write SetTitle; property HelpFile: string read GetHelpFile write SetHelpFile; property HintColor: TColor read GetHintColor write SetHintColor default clInfoBk; property HintPause: Integer read GetHintPause write SetHintPause default 500; property HintShortPause: Integer read GetHintShortPause write SetHintShortPause default 50; property HintHidePause: Integer read GetHintHidePause write SetHintHidePause default 2500; property ShowHint: Boolean read GetShowHint write SetShowHint default False; // tray icon properties property TrayIconActive: Boolean read fTrayIconActive write SetTrayIconActive default False; property TrayIcon: TIcon read fTrayIcon write SetTrayIcon; property TrayHint: string read GetTrayHint write SetTrayHint; property TrayPopup: TPopupMenu read fTrayPopup write SetTrayPopup; property OnTrayDefault: TNotifyEvent read fOnTrayDefault write fOnTrayDefault; property OnLBtnDown: TNotifyEvent read fOnLBtnDown write fOnLBtnDown; // TApplication events property OnActivate: TNotifyEvent read GetOnActivate write SetOnActivate; property OnDeactivate: TNotifyEvent read GetOnDeactivate write SetOnDeactivate; property OnException: TExceptionEvent read GetOnException write SetOnException; property OnIdle: TIdleEvent read GetOnIdle write SetOnIdle; property OnHelp: THelpEvent read GetOnHelp write SetOnHelp; property OnHint: TNotifyEvent read GetOnHint write SetOnHint; property OnMessage: TMessageEvent read GetOnMessage write SetOnMessage; property OnMinimize: TNotifyEvent read GetOnMinimize write SetOnMinimize; property OnRestore: TNotifyEvent read GetOnRestore write SetOnRestore; property OnShowHint: TShowHintEvent read GetOnShowHint write SetOnShowHint; end; procedure Register; const WM_TrayIconMsg = wm_User; implementation var AppCompCounter: Integer; constructor TDdhAppExt.Create(AOwner: TComponent); begin // check if already created Inc (AppCompCounter); if AppCompCounter > 1 then raise Exception.Create('Duplicated DdhAppExt component'); inherited Create(AOwner); // application object initialization if csDesigning in ComponentState then begin CurrApp := TApplication.Create (nil); CurrApp.Icon := nil; CurrApp.Title := ''; CurrApp.HelpFile := ''; end else CurrApp := Application; // tray icon initialization fTrayIconActive := False; fTrayIcon := TIcon.Create; fTrayIcon.OnChange := IconChange; nid.cbSize := sizeof (nid); nid.wnd := CurrApp.Handle; nid.uID := 1; // icon ID nid.uCallBackMessage := WM_TrayIconMsg; nid.hIcon := CurrApp.Icon.Handle; StrLCopy (nid.szTip, PChar('Tip'), 64); nid.uFlags := nif_Message or nif_Icon or nif_Tip; // subclass the application if not (csDesigning in ComponentState) then begin NewWndProc := MakeObjectInstance(IconTrayWndProc); OldWndProc := Pointer( SetWindowLong ( CurrApp.Handle, gwl_WndProc, Longint (NewWndProc))); end else begin // default values NewWndProc := nil; OldWndPRoc := nil; end; WM_TaskbarCreated:=RegisterWindowMessage('TaskbarCreated'); end; destructor TDdhAppExt.Destroy; begin // remove the application window procedure if not (csDesigning in ComponentState) then begin // re-install the original window procedure SetWindowLong (CurrApp.Handle, gwl_WndProc, Longint (OldWndProc)); // free the object instance if Assigned (NewWndProc) then FreeObjectInstance (NewWndProc); end; Dec (AppCompCounter); // remove the tray icon if fTrayIconActive then Shell_NotifyIcon (NIM_DELETE, @nid); fTrayIcon.Free; // default destructor inherited Destroy; end; procedure TDdhAppExt.Notification(AComponent: TComponent; Operation: TOperation); begin inherited Notification (AComponent, Operation); if (Operation = opRemove) and (AComponent = fTrayPopup) then fTrayPopup := nil; end; // property access methods function TDdhAppExt.GetIcon : TIcon; begin Result := CurrApp.Icon ; end; procedure TDdhAppExt.SetIcon (Value: TIcon); begin CurrApp.Icon := Value; end; function TDdhAppExt.GetTitle: string; begin Result := CurrApp.Title; end; procedure TDdhAppExt.SetTitle(Value: string); begin CurrApp.Title := Value; end; function TDdhAppExt.GetHelpFile: string; begin Result := CurrApp.HelpFile; end; procedure TDdhAppExt.SetHelpFile(Value: string); begin CurrApp.HelpFile := Value; end; function TDdhAppExt.GetHintColor: TColor; begin Result := CurrApp.HintColor; end; procedure TDdhAppExt.SetHintColor(Value: TColor); begin CurrApp.HintColor := Value; end; function TDdhAppExt.GetHintPause: Integer; begin Result := CurrApp.HintPause; end; procedure TDdhAppExt.SetHintPause(Value: Integer); begin CurrApp.HintPause := Value; end; function TDdhAppExt.GetHintShortPause: Integer; begin Result := CurrApp.HintShortPause; end; procedure TDdhAppExt.SetHintShortPause(Value: Integer); begin CurrApp.HintShortPause := Value; end; function TDdhAppExt.GetHintHidePause: Integer; begin Result := CurrApp.HintHidePause; end; procedure TDdhAppExt.SetHintHidePause(Value: Integer); begin CurrApp.HintHidePause := Value; end; function TDdhAppExt.GetShowHint: Boolean; begin Result := CurrApp.ShowHint; end; procedure TDdhAppExt.SetShowHint(Value: Boolean); begin CurrApp.ShowHint := Value; end; function TDdhAppExt.GetOnActivate: TNotifyEvent; begin Result := CurrApp.OnActivate; end; procedure TDdhAppExt.SetOnActivate(Value: TNotifyEvent); begin CurrApp.OnActivate := Value; end; function TDdhAppExt.GetOnDeactivate: TNotifyEvent; begin Result := CurrApp.OnDeactivate; end; procedure TDdhAppExt.SetOnDeactivate(Value: TNotifyEvent); begin CurrApp.OnDeactivate := Value; end; function TDdhAppExt.GetOnException: TExceptionEvent; begin Result := CurrApp.OnException; end; procedure TDdhAppExt.SetOnException(Value: TExceptionEvent); begin CurrApp.OnException := Value; end; function TDdhAppExt.GetOnIdle: TIdleEvent; begin Result := CurrApp.OnIdle; end; procedure TDdhAppExt.SetOnIdle(Value: TIdleEvent); begin CurrApp.OnIdle := Value; end; function TDdhAppExt.GetOnHelp: THelpEvent; begin Result := CurrApp.OnHelp; end; procedure TDdhAppExt.SetOnHelp(Value: THelpEvent); begin CurrApp.OnHelp := Value; end; function TDdhAppExt.GetOnHint: TNotifyEvent; begin Result := CurrApp.OnHint; end; procedure TDdhAppExt.SetOnHint(Value: TNotifyEvent); begin CurrApp.OnHint := Value; end; function TDdhAppExt.GetOnMessage: TMessageEvent; begin Result := CurrApp.OnMessage; end; procedure TDdhAppExt.SetOnMessage(Value: TMessageEvent); begin CurrApp.OnMessage := Value; end; function TDdhAppExt.GetOnMinimize: TNotifyEvent; begin Result := CurrApp.OnMinimize; end; procedure TDdhAppExt.SetOnMinimize(Value: TNotifyEvent); begin CurrApp.OnMinimize := Value; end; function TDdhAppExt.GetOnRestore: TNotifyEvent; begin Result := CurrApp.OnRestore; end; procedure TDdhAppExt.SetOnRestore(Value: TNotifyEvent); begin CurrApp.OnRestore := Value; end; function TDdhAppExt.GetOnShowHint: TShowHintEvent; begin Result := CurrApp.OnShowHint; end; procedure TDdhAppExt.SetOnShowHint(Value: TShowHintEvent); begin CurrApp.OnShowHint := Value; end; // tray icon support procedure TDdhAppExt.SetTrayIconActive (Value: Boolean); begin if Value <> fTrayIconActive then begin fTrayIconActive := Value; if not (csDesigning in ComponentState) then begin if fTrayIconActive then Shell_NotifyIcon (NIM_ADD, @nid) else Shell_NotifyIcon (NIM_DELETE, @nid); end; end; end; procedure TDdhAppExt.SetTrayIcon (Value: TIcon); begin fTrayIcon.Assign (Value); end; procedure TDdhAppExt.IconChange (Sender: TObject); begin if not (fTrayIcon.Empty) then nid.hIcon := fTrayIcon.Handle else nid.hIcon := CurrApp.MainForm.Icon.Handle; if fTrayIconActive and not (csDesigning in ComponentState) then Shell_NotifyIcon (NIM_MODIFY, @nid); end; function TDdhAppExt.GetTrayHint: string; begin Result := string (nid.szTip); end; procedure TDdhAppExt.SetTrayHint (Value: string); begin StrLCopy (nid.szTip, PChar(Value), 64); if fTrayIconActive and not (csDesigning in ComponentState) then Shell_NotifyIcon (NIM_MODIFY, @nid); end; procedure TDdhAppExt.SetTrayPopup (Value: TPopupMenu); begin if Value <> fTrayPopup then begin fTrayPopup := Value; if Assigned(fTrayPopup) then fTrayPopup.FreeNotification(Self); end; end; procedure TDdhAppExt.IconTrayWndProc (var Msg: TMessage); var Pt: TPoint; begin if Msg.Msg = WM_TaskbarCreated then begin // reinstall tray icon fTrayIconActive:=False; TrayIconActive:=True; exit; end; if (Msg.Msg = WM_TrayIconMsg) then case Msg.lParam of WM_RButtonDown: if Assigned(fTrayPopup) then begin if CurrApp<>nil then SetForegroundWindow(CurrApp.MainForm.Handle); GetCursorPos(Pt); fTrayPopup.Popup(Pt.x, Pt.y); exit; end; WM_LButtonDown: if Assigned(fOnLBtnDown) then begin fOnLBtnDown(Self); exit; end; WM_LButtonDblClk: if Assigned(fOnTrayDefault) then begin if CurrApp<>nil then SetForegroundWindow(CurrApp.MainForm.Handle); fOnTrayDefault (self); exit; end; end; // original window procedure if CurrApp<>nil then begin if Msg.Msg=WM_TrayIconMsg then PostMessage(CurrApp.MainForm.Handle,Msg.Msg,Msg.WParam,Msg.LParam) else Msg.Result := CallWindowProc (OldWndProc, CurrApp.Handle, Msg.Msg, Msg.WParam, Msg.LParam); end; end; // component registration procedure Register; begin RegisterComponents('DDHB', [TDdhAppExt]); end; initialization AppCompCounter := 0; end.
program MINMAX(input, output); const MAX_NUMBER = 25; var size, i, number, min, max : integer; list : array[0..MAX_NUMBER] of integer; procedure read_list(); begin write('Enter the numbers, input 1 to indicate termination: '); size := 0; number := 1; while number <> 0 do begin read(number); list[size] := number; size := size + 1; end; size := size - 2; end; procedure bounds(var min, max : integer); begin min := 999; max := -999; for i := 0 to size do begin number := list[i]; if number < min then min := number; if number > max then max := number end; end; begin read_list(); min := 0; max := 0; bounds(min, max); writeln('MIN: ', min); writeln('MAX: ', max) end.
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uAudioFH, MMSystem, Vcl.StdCtrls, math, ltc, ltcDecoder, GradProgress, Vcl.Menus, Vcl.ComCtrls, DateUtils; const Buffers = 4; BufferLengthInt = 8192; DtmfFreq: array[0..7] of Double = (697, 770, 852, 941, 1209, 1336, 1477, 1633); BUFFER_SIZE = 1024; type TForm1 = class(TForm) Memo1: TMemo; OpenDialog1: TOpenDialog; GroupBox1: TGroupBox; ComboBox1: TComboBox; ComboBox2: TComboBox; Button1: TButton; Button2: TButton; GroupBox2: TGroupBox; GradProgress1: TGradProgress; Label1: TLabel; StatusBar1: TStatusBar; MainMenu1: TMainMenu; exit1: TMenuItem; N1: TMenuItem; exit2: TMenuItem; GroupBox3: TGroupBox; Label2: TLabel; Button3: TButton; procedure Button1Click(Sender: TObject); procedure AudioFHOnDataBuffer(Data: Pointer; Size: Longint); procedure Button2Click(Sender: TObject); procedure LTCDecoderOnDebug(const S: string); procedure LTCDecoderOnRead(Sender: TObject; timecode : TDateTime); procedure FormCreate(Sender: TObject); Procedure WaveInOnError(Sender: TObject); procedure WaveInOnVolume(const PeakLevel :TPeakLevel); procedure FormDestroy(Sender: TObject); procedure ComboBox1Change(Sender: TObject); procedure ComboBox2Change(Sender: TObject); procedure exit2Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Button3Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; FAudioFH : TAudioFH; AudioFHInfo : TAudioFHInfo; WFormat : TWaveFormatEx; LTCDecoder : TLTCDecoder; prevframe: word; tFreeRun : UINT; //идентификатор таймера lastPeriod : cardinal; FreeRunDate : TDateTime; LTCDate : TDateTime; differenceDate : TDateTime; FAvgFirstMax: Integer; FAvgFirstTime: Cardinal; FAvgSecondMax: Integer; FAvgSecondTime: Cardinal; CritSect : TRTLCriticalSection; implementation {$R *.dfm} function timeGetMinPeriod(): DWORD; var time: TTimeCaps; begin timeGetDevCaps(Addr(time), SizeOf(time)); timeGetMinPeriod := time.wPeriodMin; end; function timeGetMaxPeriod(): Cardinal; var time: TTimeCaps; begin timeGetDevCaps(Addr(time), SizeOf(time)); timeGetMaxPeriod := time.wPeriodMax; end; function timeSetTimerPeriod(period: Cardinal): Boolean; begin if timeBeginPeriod(period) = TIMERR_NOERROR then begin //Сохраним значение для восстановления состояния таймера lastPeriod := period; timeSetTimerPeriod := True; end else//Неудача timeSetTimerPeriod := False; end; function timeRestoreTimerPeriod(): Boolean; begin lastPeriod := timeEndPeriod(TIMERR_NOERROR); end; procedure TimerProc(uTimerID, uMessage: UINT; dwUser, dw1, dw2: DWORD) stdcall; var curPos: TPoint; delta:real; h, m, s, ms, f : word; begin // EnterCriticalSection(CritSect); FreeRunDate:= IncMilliSecond(FreeRunDate, 40); decodetime(FreeRunDate, h,m,s,ms); try f:=ms div 40; except f:=0; end; // Form1.label2.Caption:= format('%02.2d:%02.2d:%02.2d:%02.2d',[h,m,s,f]); //LeaveCriticalSection(CritSect); end; procedure TForm1.WaveInOnError(Sender: TObject); begin Application.MessageBox(PChar(FAudioFH.LastErrorText), 'Ошибка', MB_ICONERROR); end; procedure TForm1.WaveInOnVolume(const PeakLevel :TPeakLevel); begin form1.GradProgress1.Position:= PeakLevel.DB_CH[0]; end; procedure TForm1.Button1Click(Sender: TObject); begin { with WFormat do begin wFormatTag := WAVE_FORMAT_PCM; wBitsPerSample := 16; nChannels := 1; nSamplesPerSec := 44100; nBlockAlign := (nChannels * wBitsPerSample) div 8; nAvgBytesPerSec := (nChannels * nSamplesPerSec * wBitsPerSample) div 8; cbSize := 0; end;} LTCDecoder:=TLTCDecoder.Create(WFormat.nSamplesPerSec div 25, 32); LTCDecoder.OnRead:=LTCDecoderOnRead; try FAudioFH.SetWaveFormat(addr(WFormat)); FAudioFH.OnError:=WaveInOnError; FAudioFH.BufferLength:=BUFFER_SIZE; if FAudioFH.open(combobox1.ItemIndex) then begin FAudioFH.OnVolume:=WaveInOnVolume; FAudioFH.OnDataBuffer:=AudioFHOnDataBuffer; //FAudioFH.OnDTMF:=WaveInOnDTMF; // FAudioFH.OpenDTMFDetect(1024,false); end; except on E: Exception do begin Application.MessageBox(PChar('procedure FormCreate:'#13#10 + E.Message), 'Ошибка', MB_ICONERROR); end; end; end; procedure TForm1.Button2Click(Sender: TObject); begin // FAudioFH.CloseDTMFDetect; FAudioFH.Close; LTCDecoder.Destroy; end; procedure TForm1.Button3Click(Sender: TObject); var h,m,s,ms, f : word; _ltc, _freerun: TDateTime; begin _ltc:=LTCDate; _freerun:=FreeRunDate; DecodeTime(differenceDate, h,m,s,ms); try f:=ms div 40; except f:=0; end; memo1.Lines.Add(format('Difference LTC and FreeRun: %02.2d:%02.2d:%02.2d:%02.2d',[h,m,s,f])); DecodeTime(abs(_ltc-_freerun), h,m,s,ms); try f:=ms div 40; except f:=0; end; memo1.Lines.Add(format('Compare result: %02.2d:%02.2d:%02.2d:%02.2d',[h,m,s,f])); DecodeTime(abs(_ltc-_freerun-differenceDate), h,m,s,ms); try f:=ms div 40; except f:=0; end; memo1.Lines.Add(format('Compare result with diff: %02.2d:%02.2d:%02.2d:%02.2d',[h,m,s,f])); DecodeTime(_ltc, h,m,s,ms); try f:=ms div 40; except f:=0; end; memo1.Lines.Add(format('LTC: %02.2d:%02.2d:%02.2d:%02.2d',[h,m,s,f])); DecodeTime(_freerun, h,m,s,ms); try f:=ms div 40; except f:=0; end; memo1.Lines.Add(format('FreeRun: %02.2d:%02.2d:%02.2d:%02.2d',[h,m,s,f])); memo1.Lines.Add(''); end; procedure TForm1.LTCDecoderOnDebug(const S: string); begin memo1.Lines.Add(s); end; procedure TForm1.LTCDecoderOnRead(Sender: TObject; timecode : TDateTime); var h,m,s,ms,f : word; begin if differenceDate=0 then differenceDate:=abs(timecode-FreeRunDate); LTCDate:=timecode; decodetime(timecode, h,m,s,ms); try f:=ms div 40; except f:=0; end; if ((f-prevframe=1) or (f=0)) then begin label1.Caption:= format('%02.2d:%02.2d:%02.2d:%02.2d',[h,m,s,f]); end else begin memo1.Lines.Add(''); memo1.Lines.Add(format('%s - %02.2d:%02.2d:%02.2d:%02.2d',[formatdatetime('yyyy-mm-dd hh:mm:ss.zzz', now),h,m,s,f])); memo1.Lines.Add(format('%s - %02.2d:%02.2d:%02.2d:%02.2d',[formatdatetime('yyyy-mm-dd hh:mm:ss.zzz', now),h,m,s, prevframe])); memo1.Lines.Add(''); end; prevframe:=f; end; procedure TForm1.ComboBox1Change(Sender: TObject); var i: integer; WaveDeviceInFormat: TWaveDeviceFormats; begin combobox2.Items.Clear; WaveDeviceInFormat:= AudioFHInfo.GetInDeviceFormats(ComboBox1.ItemIndex); for i := 0 to Length(GetPCMFormat)-1 do if GetPCMFormat[i] in WaveDeviceInFormat then combobox2.Items.Add(GetPCMFormatToStr[i]); combobox2.ItemIndex:=0; combobox2.OnChange(self); end; procedure TForm1.ComboBox2Change(Sender: TObject); begin FAudioFH.SetPCMAudioFormatS(addr(WFormat),StrToPCMFormat(combobox2.Items.Strings[combobox2.ItemIndex])); end; procedure TForm1.exit2Click(Sender: TObject); begin close; end; function ConvertU16ToS8BIT(const sample: word): ShortInt; begin result:=((sample div 256) - 128) and $FF; end; function ConvertS16ToS8BIT(const sample: SmallInt): ShortInt; begin result:=(sample div 256) and $FF; end; function ConvertS16ToU8BIT(const sample: SmallInt): byte; begin result:=((sample div 256) + 128) and $FF; end; function ConvertU16ToU8BIT(const sample: word): byte; begin result:=(sample div 256) and $FF; end; procedure TForm1.AudioFHOnDataBuffer(Data: Pointer; Size: Longint); var total : int64; sound : array[0..BUFFER_SIZE-1] of ltcsnd_sample_t; buffU8BIT : array of Byte; buffU16BIT : array of Word; i,n : integer; PCMFormat : TPCMFormat; bytePerSample : integer; sampleCount : integer; begin PCMFormat:=FAudioFH.GetPCMAudioFormat(addr(WFormat)); case PCMFormat of Mono8Bit8000Hz, Stereo8bit8000Hz, Mono8bit11025Hz, Stereo8bit11025Hz, Mono8bit22050Hz, Stereo8bit22050Hz, Mono8bit44100Hz, Stereo8bit44100Hz, Mono8bit48000Hz : bytePerSample:=1; Mono16bit8000Hz, Stereo16bit8000Hz, Mono16bit11025Hz, Stereo16bit11025Hz, Mono16bit22050Hz, Stereo16bit22050Hz, Mono16bit44100Hz, Stereo16bit44100Hz, Mono16bit48000Hz, Stereo16bit48000Hz : bytePerSample:=2; end; if size>0 then sampleCount:=Size div bytePerSample; SetLength(buffU8BIT, sampleCount); case bytePerSample of 2: begin SetLength(buffU16BIT, sampleCount); move(pByte(Data)[0], buffU16BIT[0], Size); for I := 0 to sampleCount-1 do buffU8BIT[i]:=ConvertU16ToU8BIT(buffU16BIT[i]); end; 1: begin move(pByte(Data)[0], buffU8BIT[0], Size); end; end; total:=0; n:=0; for I := 0 to (sampleCount-1) div BUFFER_SIZE do begin try if sampleCount-total< BUFFER_SIZE then n:=sampleCount-total else n:=BUFFER_SIZE; move(buffU8BIT[total], sound[0], n); LTCDecoder.Write(sound, n, total); finally inc(total, n); end; end { total:=0; n:=0; for I := 0 to (size-1) div BUFFER_SIZE do begin try if Size-total< BUFFER_SIZE then n:=Size-total else n:=BUFFER_SIZE; copymemory(@sound, @pByte(Data)[total], n); LTCDecoder.Write(sound, n, total); finally inc(total, n); end; end;} end; procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin timeKillEvent(tFreeRun); end; procedure TForm1.FormCreate(Sender: TObject); var i : integer; begin FAudioFH:= TAudioFH.Create; combobox1.Clear; for I := 0 to AudioFHInfo.GetNumInDevs-1 do begin combobox1.Items.Add(AudioFHInfo.GetInDeviceName(i)); end; combobox1.ItemIndex:=0; combobox1.OnChange(self); differenceDate:=0; (* Start freerun timer *) timeSetTimerPeriod(40); FreeRunDate:=0; tFreeRun:=timeSetEvent(40, timeGetMinPeriod, @TimerProc, 0, TIME_CALLBACK_FUNCTION or TIME_PERIODIC); end; procedure TForm1.FormDestroy(Sender: TObject); begin FAudioFH.Destroy; end; initialization InitializeCriticalSection(CritSect); finalization DeleteCriticalSection(CritSect); end.
unit zsHelperForm; interface uses Windows, Messages, SysUtils, Classes, Controls, Forms, StdCtrls, ExtCtrls, BaseForm, zsHelperMessage, zsHelperDefine; type TZSHelperFormData = record ZsHelperCmdWnd: HWND; end; TfrmZSHelper = class(TfrmBase) btnbuy: TButton; mmo1: TMemo; btnlaunch: TButton; edStock: TEdit; edPrice: TEdit; edMoney: TEdit; edNum: TEdit; btnSale: TButton; btnUnlock: TButton; btnLogin: TButton; edtUserId: TEdit; edtPassword: TEdit; procedure btnMainClick(Sender: TObject); procedure btnlaunchClick(Sender: TObject); procedure btnbuyClick(Sender: TObject); procedure btnConfirmDealClick(Sender: TObject); procedure btnConfirmPwdClick(Sender: TObject); procedure btnUnlockClick(Sender: TObject); procedure btnCheckMoneyClick(Sender: TObject); procedure btnSaleClick(Sender: TObject); procedure btnCheckDealPanelSizeClick(Sender: TObject); procedure btnLoginClick(Sender: TObject); protected fZSHelperFormData: TZSHelperFormData; function FindZsHelperCmdWnd: Boolean; function GetBuyPriceStep1(APrice: double): double; function GetBuyPriceStep2(APrice: double): double; procedure SaveBuyConfig; procedure LoadBuyConfig; procedure CreateParams(var Params: TCreateParams); override; public constructor Create(Owner: TComponent); override; end; implementation {$R *.dfm} uses UtilsWindows, CommCtrl, IniFiles, UtilsApplication; constructor TfrmZSHelper.Create(Owner: TComponent); begin inherited; FillChar(fZSHelperFormData, SizeOf(fZSHelperFormData), 0); LoadBuyConfig; end; procedure TfrmZSHelper.CreateParams(var Params: TCreateParams); begin inherited; Params.WinClassName := 'WndZSHelper'; Params.Caption := ''; Self.Caption := ''; end; function TfrmZSHelper.FindZsHelperCmdWnd: Boolean; begin if not IsWindow(fZSHelperFormData.ZsHelperCmdWnd) then begin fZSHelperFormData.ZsHelperCmdWnd := Windows.FindWindow(zsHelperCmdExecApp_AppCmdWndClassName, ''); end; Result := IsWindow(fZSHelperFormData.ZsHelperCmdWnd); end; procedure TfrmZSHelper.btnMainClick(Sender: TObject); begin (*// if FindZSMainWindow(@GZsDealSession) then begin CheckZSMainWindow(@GZsDealSession.MainWindow); if nil <> GZsDealSession.MainWindow.HostWindowPtr then begin mmo1.Lines.Add('main wnd:' + IntToHex(GZsDealSession.MainWindow.HostWindowPtr.WindowHandle, 2)); end; mmo1.Lines.Add('tree wnd:' + IntToHex(GZsDealSession.MainWindow.WndFunctionTree, 2)); ClickMenuOrderMenuItem(@GZsDealSession.MainWindow); end; //*) end; function TfrmZSHelper.GetBuyPriceStep1(APrice: double): double; begin Result := 0; if APrice < 10 then begin Result := APrice * 0.995; exit; end; if APrice < 20 then begin Result := APrice * 0.993; // 0.002 exit; end; if APrice < 30 then begin Result := APrice * 0.990; // 0.003 exit; end; if APrice < 40 then begin Result := APrice * 0.986; // 0.004 exit; end; if APrice < 50 then begin Result := APrice * 0.981; // 0.005 exit; end; end; function TfrmZSHelper.GetBuyPriceStep2(APrice: double): double; begin Result := 0; if APrice < 10 then begin Result := APrice * 0.985; Exit; end; if APrice < 20 then begin Result := APrice * 0.982; // 0.003 exit; end; if APrice < 30 then begin Result := APrice * 0.979; // 0.003 exit; end; if APrice < 40 then begin Result := APrice * 0.975; // 0.004 exit; end; if APrice < 50 then begin Result := APrice * 0.970; // 0.005 exit; end; if APrice < 60 then begin Result := APrice * 0.960; // 0.01 exit; end; end; (*// procedure TfrmZSHelper.WMStockBuy_XueQiu(var Message: TMessage); var tmpNewPrice: double; tmpPrice: double; begin if 0 <> Message.WParam then begin tmpPrice := Message.LParam / 1000; tmpNewPrice := GetBuyPriceStep1(tmpPrice); if 0 < tmpNewPrice then PostMessage(Handle, WM_C2S_StockBuy_Mode_1, Message.WParam, Trunc(tmpNewPrice * 1000)); tmpNewPrice := GetBuyPriceStep2(tmpPrice); if 0 < tmpNewPrice then PostMessage(Handle, WM_C2S_StockBuy_Mode_1, Message.WParam, Trunc(tmpNewPrice * 1000)); end; end; //*) procedure TfrmZSHelper.LoadBuyConfig; var tmpIni: TIniFile; begin tmpIni := TIniFile.Create(ChangeFileExt(ParamStr(0), '.ini')); try edStock.Text := tmpIni.ReadString('Test', 'Stock', ''); edPrice.Text := tmpIni.ReadString('Test', 'Price', '0.00'); edMoney.Text := tmpIni.ReadString('Test', 'Money', '5000'); finally tmpIni.Free; end; end; procedure TfrmZSHelper.SaveBuyConfig; var tmpIni: TIniFile; begin tmpIni := TIniFile.Create(ChangeFileExt(ParamStr(0), '.ini')); try tmpIni.WriteString('Test', 'Stock', Trim(edStock.Text)); tmpIni.WriteString('Test', 'Price', FormatFloat('0.00', StrToFloatDef(Trim(edPrice.Text), 0))); tmpIni.WriteString('Test', 'Money', IntToStr(StrToIntDef(Trim(edMoney.Text), 5000))); finally tmpIni.Free; end; end; procedure TfrmZSHelper.btnCheckDealPanelSizeClick(Sender: TObject); begin inherited; (*// if nil = GZsDealSession.MainWindow.HostWindowPtr then begin if not FindZSMainWindow(@GZsDealSession) then exit; end; CheckZSMainWindow(@GZsDealSession.MainWindow); CheckDealPanelSize(@GZsDealSession.MainWindow); //*) end; procedure TfrmZSHelper.btnCheckMoneyClick(Sender: TObject); begin (*// if nil = GZsDealSession.MainWindow.HostWindowPtr then begin if not FindZSMainWindow(@GZsDealSession) then exit; end; CheckZSMoneyWindow(@GZsDealSession.MainWindow); //*) end; procedure TfrmZSHelper.btnConfirmDealClick(Sender: TObject); //var // tmpWnd: HWND; begin (*// FindZSDealConfirmDialogWindow(@GZsDealSession); if nil <> GZsDealSession.DealConfirmDialog then begin CheckZSDialogWindow(GZsDealSession.DealConfirmDialog); if IsWindow(GZsDealSession.DealConfirmDialog.OKButton) then begin tmpWnd := GZsDealSession.DealConfirmDialog.WindowHandle; if IsWindow(tmpWnd) then begin ForceBringFrontWindow(tmpWnd); SleepWait(20); ForceBringFrontWindow(tmpWnd); SleepWait(20); end; ClickButtonWnd(GZsDealSession.DealConfirmDialog.OKButton); end; end; //*) end; procedure TfrmZSHelper.btnConfirmPwdClick(Sender: TObject); //var // tmpWnd: HWND; // tmpIsChecked: Integer; begin { 各种可能出现的 对话框 } (*// if nil = GZsDealSession.MainWindow.HostWindowPtr then begin if not FindZSMainWindow(@GZsDealSession) then exit; end; FindZSPasswordConfirmDialogWindow(@GZsDealSession); if nil <> GZsDealSession.DealPasswordConfirmDialogWindow.HostWindowPtr then begin CheckZSPasswordConfirmDialogWindow(@GZsDealSession.DealPasswordConfirmDialogWindow); tmpWnd := GZsDealSession.DealPasswordConfirmDialogWindow.WndNoInputNextCheck; if IsWindow(tmpWnd) then begin tmpIsChecked := SendMessage(tmpWnd, BM_GETCHECK, 0, 0); if 0 = tmpIsChecked then begin ClickButtonWnd(tmpWnd); end; end; tmpWnd := GZsDealSession.DealPasswordConfirmDialogWindow.WndPasswordEdit; if IsWindow(tmpWnd) then begin InputEditWnd(tmpWnd, '111111'); end; tmpWnd := GZsDealSession.DealPasswordConfirmDialogWindow.HostWindowPtr.OKButton; if IsWindow(tmpWnd) then begin ClickButtonWnd(tmpWnd); end; end; //*) end; procedure TfrmZSHelper.btnlaunchClick(Sender: TObject); begin //AutoLogin(@GZsDealSession); if FindZsHelperCmdWnd then begin PostMessage(fZSHelperFormData.ZsHelperCmdWnd, WM_C2S_LaunchProgram, 0, 0); end; end; procedure TfrmZSHelper.btnLoginClick(Sender: TObject); var tmpPassword: integer; tmpNewOneId: Integer; begin if FindZsHelperCmdWnd then begin tmpPassword := StrToIntDef(edtPassword.Text, 0); if 0 < tmpPassword then begin tmpNewOneId := StrToIntDef(edtUserId.Text, 0); if 0 = tmpNewOneId then tmpNewOneId := 39008990; PostMessage(fZSHelperFormData.ZsHelperCmdWnd, WM_C2S_LoginUser, tmpNewOneId, tmpPassword); end; end; end; procedure TfrmZSHelper.btnUnlockClick(Sender: TObject); var tmpPassword: integer; begin if FindZsHelperCmdWnd then begin tmpPassword := StrToIntDef(edtPassword.Text, 0); if 0 < tmpPassword then begin PostMessage(fZSHelperFormData.ZsHelperCmdWnd, WM_C2S_Unlock, 0, tmpPassword); end; end; { 各种可能出现的 对话框 } (*// if nil = GZsDealSession.MainWindow.HostWindowPtr then begin if not FindZSMainWindow(@GZsDealSession) then exit; end; FindZSLockPanelWindow(@GZsDealSession); //*) end; procedure TfrmZSHelper.btnbuyClick(Sender: TObject); var tmpStock: AnsiString; tmpStockId: Integer; tmpPrice: double; dealBuyParam: TWMDeal_LParam; begin SaveBuyConfig(); if FindZsHelperCmdWnd then begin tmpStock := Trim(edStock.Text); tmpStockId := StrToIntDef(tmpStock, 0); if 0 < tmpStockId then begin tmpPrice := StrToFloatDef(Trim(edPrice.Text), 0); if 0 < tmpPrice then begin dealBuyParam.Price := Trunc(tmpPrice * 100); dealBuyParam.Hand := Trunc(StrToIntDef(edNum.Text, 0) / 100); if 0 < dealBuyParam.Hand then begin PostMessage(fZSHelperFormData.ZsHelperCmdWnd, WM_C2S_StockBuy_Mode_1, tmpStockId, Integer(dealBuyParam)); end; end; end; end; (*// if BuyStock(@GZsDealSession, tmpStock, tmpPrice, StrToIntDef(edMoney.Text, 5000)) then begin // 出错 可能未 开通创业板权限 ConfirmDeal(@GZsDealSession); end; //*) end; procedure TfrmZSHelper.btnSaleClick(Sender: TObject); var tmpStock: AnsiString; tmpStockId: Integer; tmpPrice: double; dealSaleParam: TWMDeal_LParam; begin SaveBuyConfig(); if FindZsHelperCmdWnd then begin tmpStock := Trim(edStock.Text); tmpStockId := StrToIntDef(tmpStock, 0); if 0 < tmpStockId then begin tmpPrice := StrToFloatDef(Trim(edPrice.Text), 0); if 0 < tmpPrice then begin dealSaleParam.Price := Trunc(tmpPrice * 100); dealSaleParam.Hand := Trunc(StrToIntDef(edNum.Text, 0) / 100); if 0 < dealSaleParam.Hand then begin PostMessage(fZSHelperFormData.ZsHelperCmdWnd, WM_C2S_StockSale_Mode_1, tmpStockId, Integer(dealSaleParam)); end; end; end; end; (*// if SaleStock(@GZsDealSession, tmpStock, tmpPrice, tmpNum) then begin // 出错 非交易时间内 下单 ConfirmDeal(@GZsDealSession); end; //*) end; end.
unit uCadCliente; interface uses System.Classes, Vcl.Controls, Vcl.ExtCtrls, Vcl.Dialogs, ZAbstractConnection, ZConnection, ZAbstractRODataset, ZAbstractDataset, ZDataset, System.SysUtils; type TCadCliente = class private ConexaoDB:TZConnection; F_clienteId:Integer; //Int F_nome:String; //VarChar F_endereco: string; F_cidade:String; F_bairro: String; F_estado: string; F_cep: String; F_telefone1: string; F_email: string; F_dataNascimento: TDateTime; F_telefone2: string; public constructor Create(aConexao:TZConnection); destructor Destroy; override; function Inserir:Boolean; function Atualizar:Boolean; function Apagar:Boolean; function Selecionar(id:Integer):Boolean; published property codigo :Integer read F_clienteId write F_clienteId; property nome :string read F_nome write F_nome; property endereco :string read F_endereco write F_endereco; property cidade :string read F_cidade write F_cidade; property bairro :string read F_bairro write F_bairro; property estado :string read F_estado write F_Estado; property cep :string read F_cep write F_Cep; property telefone1 :string read F_telefone1 write F_telefone1; property telefone2 :string read F_telefone2 write F_telefone2; property email :string read F_email write F_email; property dataNascimento:TDateTime read F_dataNascimento write F_dataNascimento; end; implementation { TCategoria } {$region 'Constructor and Destructor'} constructor TCadCliente.Create(aConexao:TZConnection); begin ConexaoDB:=aConexao; end; destructor TCadCliente.Destroy; begin inherited; end; {$endRegion} {$region 'CRUD'} function TCadCliente.Apagar: Boolean; var Qry:TZQuery; begin if MessageDlg('Apagar o Registro: '+#13+#13+ 'Código: '+IntToStr(F_clienteId)+#13+ 'Descrição: '+F_nome,mtConfirmation,[mbYes, mbNo],0)=mrNo then begin Result:=false; abort; end; try Result:=true; Qry:=TZQuery.Create(nil); Qry.Connection:=ConexaoDB; Qry.SQL.Clear; Qry.SQL.Add('DELETE FROM clientes '+ ' WHERE Cli_Cod=:Cli_Cod '); Qry.ParamByName('Cli_Cod').AsInteger :=F_clienteId; Try ConexaoDB.StartTransaction; Qry.ExecSQL; ConexaoDB.Commit; Except ConexaoDB.Rollback; Result:=false; End; finally if Assigned(Qry) then FreeAndNil(Qry); end; end; function TCadCliente.Atualizar: Boolean; var Qry:TZQuery; begin try Result:=true; Qry:=TZQuery.Create(nil); Qry.Connection:=ConexaoDB; Qry.SQL.Clear; Qry.SQL.Add('UPDATE clientes '+ ' SET Cli_Nome =:nome '+ ' ,Cli_Logradouro =:endereco '+ ' ,Cli_Cidade =:cidade '+ ' ,Cli_Bairro =:bairro '+ ' ,Cli_UF =:estado '+ ' ,Cli_Cep =:cep '+ ' ,Cli_Telefone1 =:telefone1 '+ ' ,Cli_Telefone2 =:telefone2 '+ ' ,Cli_Email =:email '+ ' ,Cli_DataNascimento =:dataNascimento '+ ' WHERE Cli_Cod=:Cli_Cod '); Qry.ParamByName('Cli_Cod').AsInteger :=Self.F_clienteId; Qry.ParamByName('nome').AsString :=Self.F_nome; Qry.ParamByName('endereco').AsString :=Self.F_endereco; Qry.ParamByName('cidade').AsString :=Self.F_cidade; Qry.ParamByName('bairro').AsString :=Self.F_bairro; Qry.ParamByName('estado').AsString :=Self.F_estado; Qry.ParamByName('cep').AsString :=Self.F_cep; Qry.ParamByName('telefone1').AsString :=Self.F_telefone1; Qry.ParamByName('telefone2').AsString :=Self.F_telefone2; Qry.ParamByName('email').AsString :=Self.F_email; Qry.ParamByName('dataNascimento').AsDateTime :=Self.F_dataNascimento; Try ConexaoDB.StartTransaction; Qry.ExecSQL; ConexaoDB.Commit; Except ConexaoDB.Rollback; Result:=false; End; finally if Assigned(Qry) then FreeAndNil(Qry); end; end; function TCadCliente.Inserir: Boolean; var Qry:TZQuery; begin try Result:=true; Qry:=TZQuery.Create(nil); Qry.Connection:=ConexaoDB; Qry.SQL.Clear; Qry.SQL.Add('INSERT INTO clientes (Cli_Nome, '+ ' cli_Logradouro, '+ ' Cli_Cidade, '+ ' Cli_Bairro, '+ ' Cli_UF, '+ ' Cli_Cep, '+ ' Cli_Telefone1, '+ ' Cli_Telefone2, '+ ' Cli_Email, '+ ' Cli_DataNascimento) '+ ' VALUES (:nome, '+ ' :endereco, '+ ' :cidade, '+ ' :bairro, '+ ' :estado, '+ ' :cep, '+ ' :telefone1, '+ ' :telefone2, '+ ' :email, '+ ' :datanascimento)' ); Qry.ParamByName('nome').AsString :=Self.F_nome; Qry.ParamByName('endereco').AsString :=Self.F_endereco; Qry.ParamByName('cidade').AsString :=Self.F_cidade; Qry.ParamByName('bairro').AsString :=Self.F_bairro; Qry.ParamByName('estado').AsString :=Self.F_estado; Qry.ParamByName('cep').AsString :=Self.F_cep; Qry.ParamByName('telefone1').AsString :=Self.F_telefone1; Qry.ParamByName('Telefone2').AsString := Self.F_telefone2; Qry.ParamByName('email').AsString :=Self.F_email; Qry.ParamByName('dataNascimento').AsDateTime :=Self.F_dataNascimento; Try ConexaoDB.StartTransaction; Qry.ExecSQL; ConexaoDB.Commit; Except ConexaoDB.Rollback; Result:=false; End; finally if Assigned(Qry) then FreeAndNil(Qry); end; end; function TCadCliente.Selecionar(id: Integer): Boolean; var Qry:TZQuery; begin try Result:=true; Qry:=TZQuery.Create(nil); Qry.Connection:=ConexaoDB; Qry.SQL.Clear; Qry.SQL.Add('SELECT Cli_Cod,'+ ' Cli_Nome, '+ ' Cli_Logradouro, '+ ' Cli_Cidade, '+ ' Cli_Bairro, '+ ' Cli_UF, '+ ' Cli_Cep, '+ ' Cli_Telefone1, '+ ' Cli_Telefone2, '+ ' Cli_Email, '+ ' Cli_DataNascimento '+ ' FROM clientes '+ ' WHERE Cli_Cod=:Cli_Cod'); Qry.ParamByName('Cli_Cod').AsInteger:=id; Try Qry.Open; Self.F_clienteId := Qry.FieldByName('Cli_Cod').AsInteger; Self.F_nome := Qry.FieldByName('Cli_Nome').AsString; Self.F_endereco := Qry.FieldByName('Cli_Logradouro').AsString; Self.F_cidade := Qry.FieldByName('Cli_Cidade').AsString; Self.F_bairro := Qry.FieldByName('Cli_Bairro').AsString; Self.F_estado := Qry.FieldByName('Cli_UF').AsString; Self.F_cep := Qry.FieldByName('Cli_Cep').AsString; Self.F_telefone1 := Qry.FieldByName('Cli_Telefone1').AsString; Self.F_telefone2 := Qry.FieldByName('Cli_Telefone2').AsString; Self.F_email := Qry.FieldByName('Cli_Email').AsString; Self.F_dataNascimento:= Qry.FieldByName('Cli_DataNascimento').AsDateTime; Except Result:=false; End; finally if Assigned(Qry) then FreeAndNil(Qry); end; end; {$endregion} end.
unit MFichas.Model.Impressao.Constantes; interface const FONTE_12PX = chr(27) + chr(33) + chr(1); FONTE_14PX = chr(27) + chr(33) + chr(0); QUEBRADELINHA = chr(10); PULAR_1LINHA_ANTESDOPROXIMOTEXTO = chr(27) + chr(100) + chr(1); ALINHAR_CENTRO = chr(27) + chr(97) + chr(49); implementation end.
{ *********************************************************************************** } { * CryptoLib Library * } { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * } { * Github Repository <https://github.com/Xor-el> * } { * Distributed under the MIT software license, see the accompanying file LICENSE * } { * or visit http://www.opensource.org/licenses/mit-license.php. * } { * Acknowledgements: * } { * * } { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * } { * development of this library * } { * ******************************************************************************* * } (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) unit ClpDerExternal; {$I ..\Include\CryptoLib.inc} interface uses Classes, SysUtils, ClpCryptoLibTypes, ClpAsn1Object, ClpIAsn1TaggedObject, ClpDerTaggedObject, ClpAsn1Tags, ClpDerOutputStream, ClpIAsn1EncodableVector, ClpIDerTaggedObject, ClpIProxiedInterface, ClpIDerObjectIdentifier, ClpIDerInteger, ClpIDerExternal; resourcestring SInvalidEncoding = 'Invalid Encoding Value: %d'; SFewObject = 'Too Few Objects in Input Vector, "v"'; SVectorTooLarge = 'Input Vector too Large", "vector"'; SNoTaggedObjectFound = 'No Tagged Object Found in Vector. Structure Doesn ''t Seem to be of Type External, "Vector"'; SInvalidEncodingValue = 'Invalid Encoding Value'; type /// <summary> /// Class representing the DER-type External /// </summary> TDerExternal = class(TAsn1Object, IDerExternal) strict private var FdirectReference: IDerObjectIdentifier; FindirectReference: IDerInteger; FdataValueDescriptor, FexternalContent: IAsn1Object; Fencoding: Int32; function GetDataValueDescriptor: IAsn1Object; function GetDirectReference: IDerObjectIdentifier; /// <summary> /// <para> /// The encoding of the content. Valid values are /// </para> /// <para> /// &lt;ul&gt; <br />&lt;li&gt;&lt;code&gt;0&lt;/code&gt; /// single-ASN1-type&lt;/li&gt; <br /> /// &lt;li&gt;&lt;code&gt;1&lt;/code&gt; OCTET STRING&lt;/li&gt; <br /> /// &lt;li&gt;&lt;code&gt;2&lt;/code&gt; BIT STRING&lt;/li&gt; <br /> /// &lt;/ul&gt; /// </para> /// </summary> function GetEncoding: Int32; function GetExternalContent: IAsn1Object; function GetIndirectReference: IDerInteger; procedure SetDataValueDescriptor(const Value: IAsn1Object); procedure SetDirectReference(const Value: IDerObjectIdentifier); procedure SetEncoding(const Value: Int32); procedure SetExternalContent(const Value: IAsn1Object); procedure SetIndirectReference(const Value: IDerInteger); class function GetObjFromVector(const v: IAsn1EncodableVector; index: Int32) : IAsn1Object; static; inline; class procedure WriteEncodable(ms: TMemoryStream; const e: IAsn1Encodable); static; inline; strict protected function Asn1GetHashCode(): Int32; override; function Asn1Equals(const asn1Object: IAsn1Object): Boolean; override; public constructor Create(const vector: IAsn1EncodableVector); overload; /// <summary> /// Creates a new instance of DerExternal <br />See X.690 for more /// informations about the meaning of these parameters /// </summary> /// <param name="directReference"> /// The direct reference or &lt;code&gt;null&lt;/code&gt; if not set. /// </param> /// <param name="indirectReference"> /// The indirect reference or &lt;code&gt;null&lt;/code&gt; if not set. /// </param> /// <param name="dataValueDescriptor"> /// The data value descriptor or &lt;code&gt;null&lt;/code&gt; if not /// set. /// </param> /// <param name="externalData"> /// The external data in its encoded form. /// </param> constructor Create(const directReference: IDerObjectIdentifier; const indirectReference: IDerInteger; const dataValueDescriptor: IAsn1Object; const externalData: IDerTaggedObject); overload; constructor Create(const directReference: IDerObjectIdentifier; const indirectReference: IDerInteger; const dataValueDescriptor: IAsn1Object; encoding: Int32; const externalData: IAsn1Object); overload; procedure Encode(const derOut: TStream); override; property dataValueDescriptor: IAsn1Object read GetDataValueDescriptor write SetDataValueDescriptor; property directReference: IDerObjectIdentifier read GetDirectReference write SetDirectReference; property encoding: Int32 read GetEncoding write SetEncoding; property ExternalContent: IAsn1Object read GetExternalContent write SetExternalContent; property indirectReference: IDerInteger read GetIndirectReference write SetIndirectReference; end; implementation { TDerExternal } class function TDerExternal.GetObjFromVector(const v: IAsn1EncodableVector; index: Int32): IAsn1Object; var val: IAsn1Encodable; begin if (v.Count <= index) then begin raise EArgumentCryptoLibException.CreateRes(@SFewObject); end; val := v[index]; result := val.ToAsn1Object(); end; class procedure TDerExternal.WriteEncodable(ms: TMemoryStream; const e: IAsn1Encodable); var bs: TCryptoLibByteArray; begin if (e <> Nil) then begin bs := e.GetDerEncoded(); ms.Write(bs[0], System.Length(bs)); end; end; function TDerExternal.Asn1Equals(const asn1Object: IAsn1Object): Boolean; var other: IDerExternal; begin if (Self.Equals(asn1Object)) then begin result := true; Exit; end; if (not Supports(asn1Object, IDerExternal, other)) then begin result := false; Exit; end; result := directReference.Equals(other.directReference) and indirectReference.Equals(other.indirectReference) and dataValueDescriptor.Equals(other.dataValueDescriptor) and ExternalContent.Equals(other.ExternalContent); end; function TDerExternal.Asn1GetHashCode: Int32; var ret: Int32; begin ret := ExternalContent.GetHashCode(); if (directReference <> Nil) then begin ret := ret xor directReference.GetHashCode(); end; if (indirectReference <> Nil) then begin ret := ret xor indirectReference.GetHashCode(); end; if (dataValueDescriptor <> Nil) then begin ret := ret xor dataValueDescriptor.GetHashCode(); end; result := ret; end; constructor TDerExternal.Create(const directReference: IDerObjectIdentifier; const indirectReference: IDerInteger; const dataValueDescriptor: IAsn1Object; encoding: Int32; const externalData: IAsn1Object); begin Inherited Create(); FdirectReference := directReference; FindirectReference := indirectReference; FdataValueDescriptor := dataValueDescriptor; Fencoding := encoding; FexternalContent := externalData.ToAsn1Object(); end; constructor TDerExternal.Create(const vector: IAsn1EncodableVector); var offset: Int32; enc: IAsn1Object; derObjectIdentifier: IDerObjectIdentifier; derInteger: IDerInteger; obj: IAsn1TaggedObject; begin Inherited Create(); offset := 0; enc := GetObjFromVector(vector, offset); if (Supports(enc, IDerObjectIdentifier, derObjectIdentifier)) then begin directReference := derObjectIdentifier; System.Inc(offset); enc := GetObjFromVector(vector, offset); end; if (Supports(enc, IDerInteger, derInteger)) then begin indirectReference := derInteger; System.Inc(offset); enc := GetObjFromVector(vector, offset); end; if (not(Supports(enc, IAsn1TaggedObject))) then begin dataValueDescriptor := enc; System.Inc(offset); enc := GetObjFromVector(vector, offset); end; if (vector.Count <> (offset + 1)) then begin raise EArgumentCryptoLibException.CreateRes(@SVectorTooLarge); end; if (not(Supports(enc, IAsn1TaggedObject, obj))) then begin raise EArgumentCryptoLibException.CreateRes(@SNoTaggedObjectFound); end; // Use property accessor to include check on value encoding := obj.TagNo; if ((Fencoding < 0) or (Fencoding > 2)) then begin raise EInvalidOperationCryptoLibException.CreateRes(@SInvalidEncodingValue); end; FexternalContent := obj.GetObject(); end; constructor TDerExternal.Create(const directReference: IDerObjectIdentifier; const indirectReference: IDerInteger; const dataValueDescriptor: IAsn1Object; const externalData: IDerTaggedObject); begin Create(directReference, indirectReference, dataValueDescriptor, externalData.TagNo, externalData.ToAsn1Object()); end; procedure TDerExternal.Encode(const derOut: TStream); var ms: TMemoryStream; Buffer: TCryptoLibByteArray; begin ms := TMemoryStream.Create(); try WriteEncodable(ms, directReference); WriteEncodable(ms, indirectReference); WriteEncodable(ms, dataValueDescriptor); WriteEncodable(ms, TDerTaggedObject.Create(TAsn1Tags.External, ExternalContent)); System.SetLength(Buffer, ms.Size); ms.Position := 0; ms.Read(Buffer[0], ms.Size); (derOut as TDerOutputStream).WriteEncoded(TAsn1Tags.Constructed, TAsn1Tags.External, Buffer); finally ms.Free; end; end; function TDerExternal.GetDataValueDescriptor: IAsn1Object; begin result := FdataValueDescriptor; end; function TDerExternal.GetDirectReference: IDerObjectIdentifier; begin result := FdirectReference; end; function TDerExternal.GetEncoding: Int32; begin result := Fencoding; end; function TDerExternal.GetExternalContent: IAsn1Object; begin result := FexternalContent; end; function TDerExternal.GetIndirectReference: IDerInteger; begin result := FindirectReference; end; procedure TDerExternal.SetDataValueDescriptor(const Value: IAsn1Object); begin FdataValueDescriptor := Value; end; procedure TDerExternal.SetDirectReference(const Value: IDerObjectIdentifier); begin FdirectReference := Value; end; procedure TDerExternal.SetEncoding(const Value: Int32); begin if ((Fencoding < 0) or (Fencoding > 2)) then begin raise EInvalidOperationCryptoLibException.CreateResFmt (@SInvalidEncoding, [Value]); end; Fencoding := Value; end; procedure TDerExternal.SetExternalContent(const Value: IAsn1Object); begin FexternalContent := Value; end; procedure TDerExternal.SetIndirectReference(const Value: IDerInteger); begin FindirectReference := Value; end; end.
unit Unit_GDSClasses; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, math, generics.collections, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Unit_GDSdatatypes; type TReadBuffer = record BufferBytes: array of Byte; procedure clear; end; type TRecordLength = record B1, B2: Byte; procedure clear; end; type TRecordType = record B1, B2: Byte; procedure clear; end; Type TGDSToken = class private public FData: TReadBuffer; FID: Word; FDataType: Byte; function BufferByteAsString: String; function getName: String; function getDataType: String; property ID: Word read FID write FID; property DataType: Byte read FDataType write FDataType; property Data: TReadBuffer read FData write FData; property Name: String read getName; property GDSDataType: String read getDataType; property DataString: String read BufferByteAsString; end; type TTokenList = class(TObjectlist<TGDSToken>) procedure parseGDSfile(afilename: String); end; function GetRecordlength(var fs: TFileStream; var mystreamposition: integer): Word; function GetTokenInfo(var fs: TFileStream; var mystreamposition: integer; var TokenType: Word; var TokenDataType: Byte): boolean; function BytestoWord(B1, B2: Byte): Word; function BytestoReal(B0, B1, B2, B3, B4, B5, B6, B7: Byte): Double; function ByteToHex(InByte: Byte): shortstring; function BytestoString(BytesBuffer: TReadBuffer): AnsiString; function BytestoSmallInt(B0, B1: Byte): SmallInt; function BytestoLongInt(var B0, B1, B2, B3: Byte): LongInt; procedure ReadDataBytes(var fs: TFileStream; var ReadBuffer: TReadBuffer; n: integer; var mystreamposition: integer); implementation procedure TReadBuffer.clear; begin BufferBytes := nil; end; procedure TRecordLength.clear; begin Self := Default (TRecordLength); end; procedure TRecordType.clear; begin Self := Default (TRecordType); end; function GetRecordlength(var fs: TFileStream; var mystreamposition: integer): Word; var TotalRecordLengh: integer; Templength: Word; RecordLength: TRecordLength; begin fs.ReadBuffer(RecordLength, SizeOf(RecordLength)); mystreamposition := fs.Position; Templength := RecordLength.B1; Templength := Templength shl 8; TotalRecordLengh := Templength + RecordLength.B2; // this gave the total length of records to be read from the stream. if TotalRecordLengh >= 2 then begin Result := TotalRecordLengh - 2; end else begin Result := 0; end; RecordLength.clear; end; function GetTokenInfo(var fs: TFileStream; var mystreamposition: integer; var TokenType: Word; var TokenDataType: Byte): boolean; var ReturnType: Word; RecordType: TRecordType; begin fs.ReadBuffer(RecordType, SizeOf(RecordType)); ReturnType := RecordType.B1; ReturnType := ReturnType shl 8; TokenType := ReturnType + RecordType.B2; TokenDataType := RecordType.B2; mystreamposition := fs.Position; RecordType.clear; end; function BytestoSmallInt(B0, B1: Byte): SmallInt; var Number: SmallInt; small: array [0 .. 1] of Byte absolute Number; begin small[0] := B1; small[1] := B0; Result := Number; end; function BytestoLongInt(var B0, B1, B2, B3: Byte): LongInt; var returnInt: LongInt; pointer: ^LongInt; Longbyte: Array [0 .. 3] of Byte absolute returnInt; begin pointer := @returnInt; Longbyte[0] := B3; // $40;// Longbyte[1] := B2; // $f6;// Longbyte[2] := B1; // $f1;// Longbyte[3] := B0; // $ff;// Result := pointer^; end; function BytestoString(BytesBuffer: TReadBuffer): AnsiString; var arraylength: integer; s: AnsiString; begin arraylength := high(BytesBuffer.BufferBytes) + 1; SetString(s, PAnsiChar(@BytesBuffer.BufferBytes[0]), arraylength); Result := s; end; function BytestoReal(B0, B1, B2, B3, B4, B5, B6, B7: Byte): Double; var RealBytes: Array [0 .. 6] of Byte; sign, temp: Byte; exp: ShortInt; i: integer; n: int64; begin n := 0; temp := B0 and $7F; exp := temp - $40; sign := B0 and $80; RealBytes[0] := B1; RealBytes[1] := B2; RealBytes[2] := B3; RealBytes[3] := B4; RealBytes[4] := B5; RealBytes[5] := B6; RealBytes[6] := B7; for i := 0 to 6 do begin n := 256 * n + RealBytes[i]; end; if sign <> 0 then begin n := -n; end; Result := (n / (System.math.power(2, 56))) * System.math.power(16, (exp)); end; function BytestoWord(B1, B2: Byte): Word; var ReturnWord: Word; begin ReturnWord := B1; ReturnWord := ReturnWord shl 8; ReturnWord := ReturnWord + B2; Result := ReturnWord; end; procedure ReadDataBytes(var fs: TFileStream; var ReadBuffer: TReadBuffer; n: integer; var mystreamposition: integer); var i: integer; begin SetLength(ReadBuffer.BufferBytes, n); for i := 0 to high(ReadBuffer.BufferBytes) do begin fs.ReadBuffer(ReadBuffer.BufferBytes[i], SizeOf(ReadBuffer.BufferBytes[i])); end; mystreamposition := fs.Position; end; function ByteToHex(InByte: Byte): shortstring; const Digits: array [0 .. 15] of char = '0123456789ABCDEF'; begin Result := Digits[InByte shr 4] + Digits[InByte and $0F]; end; { TGDSToken } function TGDSToken.BufferByteAsString: String; var len: integer; j: integer; tempLine: String; begin case FDataType of $00: begin Result := 'no data record'; end; $01: begin Result := 'BITARRAY '; end; $02: begin tempLine := ''; for j := low(Self.FData.BufferBytes) to High(Self.FData.BufferBytes) - 1 do begin tempLine := tempLine + IntToStr(BytestoSmallInt(Self.FData.BufferBytes[j], Self.FData.BufferBytes[j + 1])) + ';' end; Result := tempLine; end; $03: begin tempLine := ''; for j := low(Self.FData.BufferBytes) to High(Self.FData.BufferBytes) - 1 do begin tempLine := tempLine + IntToStr(BytestoLongInt(Self.FData.BufferBytes[j], Self.FData.BufferBytes[j + 1], Self.FData.BufferBytes[j + 2], Self.FData.BufferBytes[j + 3])) + ';' end; Result := tempLine; end; $04: begin tempLine := ''; for j := low(Self.FData.BufferBytes) to High(Self.FData.BufferBytes) - 1 do begin tempLine := tempLine + FloatToStr(BytestoReal(Self.FData.BufferBytes[j], Self.FData.BufferBytes[j + 1], Self.FData.BufferBytes[j + 2], Self.FData.BufferBytes[j + 3], Self.FData.BufferBytes[j + 4], Self.FData.BufferBytes[j + 5], Self.FData.BufferBytes[j + 6], Self.FData.BufferBytes[j + 7])) + ';' end; Result := tempLine; end; $05: begin tempLine := 'not yet'; Result := tempLine; end; $06: begin Result := String(BytestoString(Self.FData)); end; else Result := 'INVALID DATATYPE '; end; end; function TGDSToken.getDataType: String; var i: integer; begin Result := 'no valid data type name'; for i := 0 to 6 do begin if (GDSDataTypes[i].ID = Self.DataType) then begin Result := GDSDataTypes[i].Name; exit; end; end; end; function TGDSToken.getName: String; var i: integer; begin Result := 'no valid token name'; for i := 0 to gdsrecordtypes do begin if (GDSTokens[i].ID = Self.ID) then begin Result := GDSTokens[i].Name; exit end; end; end; { TTokenList } procedure TTokenList.parseGDSfile(afilename: String); var fs: TFileStream; mystreamposition: integer; GDSToken: TGDSToken; ReadBuffer: TReadBuffer; RecordType, RecordLength: Word; begin mystreamposition := 1; fs := TFileStream.Create(afilename, fmOpenRead); while mystreamposition < fs.size do begin RecordLength := GetRecordlength(fs, mystreamposition); if RecordLength = 0 then begin Break; end else begin GDSToken := TGDSToken.Create; try GetTokenInfo(fs, mystreamposition, GDSToken.FID, GDSToken.FDataType); RecordLength := RecordLength - 2; ReadDataBytes(fs, GDSToken.FData, RecordLength, mystreamposition); finally Self.Add(GDSToken); end; end; end; end; end.
unit serial1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, TAGraph, TASeries, Forms, Controls, Graphics, Dialogs, StdCtrls, Grids; type { TForm1 } TForm1 = class(TForm) BtnLoad: TButton; BtnSave: TButton; Button1: TButton; OpenDialog1: TOpenDialog; SaveDialog1: TSaveDialog; StringGrid1: TStringGrid; procedure BtnLoadClick(Sender: TObject); procedure BtnSaveClick(Sender: TObject); procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure StringGrid1ValidateEntry(sender: TObject; aCol, aRow: Integer; const OldValue: string; var NewValue: String); private { private declarations } public { public declarations } end; var Form1: TForm1; columSize:integer = 5; rowSize:integer = 5; a,b:double; implementation uses grafico; {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject); begin rowSize:=StringGrid1.RowCount; columSize:=StringGrid1.ColCount; end; procedure TForm1.BtnSaveClick(Sender: TObject); begin if SaveDialog1.Execute then begin StringGrid1.SaveToCSVFile(SaveDialog1.FileName + '.csv', ';'); end; end; procedure TForm1.Button1Click(Sender: TObject); var xySum,xsqrSum:Real; x,y:Double; i:integer; o:integer; xSum,ySum:double; arraysize:integer=0; chartArray:array [0..3] of TLineSeries; labelEquation:array[0..3] of TLabel; labelhysteresis:array[0..3] of TLabel; labelprecision:array[0..3] of TLabel; maxDiference1:real; maxDiference2:real; NextCollum:real; FSO:real; begin Form2.Chart1LineSeries1.Clear; chartArray[0] := Form2.Chart1LineSeries1; chartArray[1] := Form2.Chart1LineSeries2; chartArray[2] := Form2.Chart1LineSeries3; chartArray[3] := Form2.Chart1LineSeries4; labelEquation[0] := Form2.LblEq1; labelEquation[1] := Form2.LblEq2; labelEquation[2] := Form2.LblEq3; labelEquation[3] := Form2.LblEq4; //escolher a cor das linhas if(TryStrToFloat(StringGrid1.Cells[1,rowSize-1],FSO)) then else ShowMessage('Valores do eixo x não reconhecidos'); for o:= 2 to 5 do begin for I:=0 to rowSize-1 do begin if(TryStrToFloat(StringGrid1.Cells[1,i],x)) AND (TryStrToFloat(StringGrid1.Cells[o,i],y)) then begin arraysize:=arraysize+1; xsqrSum := xsqrSum + x*x; xySum:= xySum + x*y; xsum:=xsum+x; ysum:=ysum+y; chartArray[o-2].AddXY(x,y,'',clRed); if(o mod 2 = 0) then begin if(TryStrToFloat(StringGrid1.Cells[o+1,i],NextCollum)) then begin if(NextCollum - y > maxDiference1) and (o=2) then begin maxDiference1:= NextCollum-y; end; if(NextCollum - y > maxDiference2) and (o=4) then begin maxDiference2:= NextCollum-y; end; end; end; end; end; if(arraysize>1)then begin a:=(arraysize*xySum-(xsum*ySum))/((arraysize*xsqrSum-(xSum*xSum))); b:=(ySum-a*xSum)/arraysize; Form2.LblHis.Caption := FloatToStr(maxDiference1/fso*100)+'%'; Form2.LblHis2.Caption := FloatToStr(maxDiference2/fso*100)+'%'; labelEquation[o-2].Caption:= 'Equação ' + IntToStr(o-1) + ': ' + 'a: ' + FormatFloat('0.###',a) + ' b: ' + FormatFloat('0.###',b); Form2.Show; end; end; end; procedure TForm1.BtnLoadClick(Sender: TObject); begin if OpenDialog1.Execute then begin StringGrid1.LoadFromCSVFile(OpenDialog1.FileName,';'); end; end; procedure TForm1.StringGrid1ValidateEntry(sender: TObject; aCol, aRow: Integer; const OldValue: string; var NewValue: String); var tempFloat:Double; begin if (TryStrToFloat(NewValue,tempFloat))then StringGrid1.Cells[aCol,aRow]:=NewValue else StringGrid1.Cells[aCol,aRow]:= OldValue; if(aRow = StringGrid1.RowCount-1) then begin rowSize:= rowSize + 1; StringGrid1.RowCount:=rowSize; end; end; end.
unit UTLInformation; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, dcDateEditBtn, RxCurrEdit, dcCalcEditBtn, StdCtrls, Mask, RxToolEdit, dcEditbtn, DataBuf, TTSUTLTable, DataController, dcMemo, Buttons, dcLabel, sBitBtn, sLabel, sMaskEdit, sCustomComboEdit, sTooledit, DcNewDateEditBtn, dcNDateEditBtn; type TfrmUTLInformation = class(TForm) bufUtl: TTTSUTLBuffer; lblLoan: TsLabel; edtLoanNumber: TdcEditBtn; Label5: TsLabel; lblAgnt: TsLabel; edtAgent: TdcEditBtn; edtName1: TdcEditBtn; dcEditBtn1: TdcEditBtn; Label1: TsLabel; dcEditBtn2: TdcEditBtn; Label4: TsLabel; dcCalcEditBtn1: TdcCalcEditBtn; Label8: TsLabel; dcCalcEditBtn2: TdcCalcEditBtn; lblDescription: TsLabel; lblReference: TsLabel; lblExpireDate: TsLabel; lblCat: TsLabel; lblCategory: TsLabel; edtDescription: TdcEditBtn; edtReference: TdcEditBtn; edtCategory: TdcEditBtn; Label9: TsLabel; Label10: TsLabel; Label11: TsLabel; Label13: TsLabel; dcUtl: TDataController; lblAgent: TsLabel; dcEditBtn3: TdcEditBtn; dcEditBtn4: TdcEditBtn; dcEditBtn5: TdcEditBtn; dcEditBtn6: TdcEditBtn; lblDocNum: TsLabel; edtDocNum: TdcEditBtn; lblUserID: TsLabel; lblDateTime: TsLabel; lbldcUser: TdcLabel; lbldcDateStamp: TdcLabel; EditBtnZip: TdcEditBtn; EditBtnSt: TdcEditBtn; EditBtnCity: TdcEditBtn; lbPayeeCode: TsLabel; lbPremium: TsLabel; lbPremDue: TsLabel; lbCoverage: TsLabel; edtPremium: TdcCalcEditBtn; edtCoverage: TdcCalcEditBtn; edtPayeeCode: TdcEditBtn; lblPayee: TsLabel; btnClose: TsBitBtn; btnCancel: TsBitBtn; btnOk: TsBitBtn; btnDelete: TsBitBtn; edtExpireDate: TdcNDateEditBtn; edtPremDue: TdcNDateEditBtn; procedure dcUtlStartEdit(Sender: TObject); procedure edtCategoryButtonClick(Sender: TObject); procedure edtAgentButtonClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormShow(Sender: TObject); procedure btnDeleteClick(Sender: TObject); procedure btnOkClick(Sender: TObject); procedure dcUtlWriteData(Sender: TObject); procedure edtCategoryExit(Sender: TObject); procedure edtAgentExit(Sender: TObject); procedure dcUtlBeforePost(Sender: TObject); procedure edtPayeeCodeButtonClick(Sender: TObject); procedure edtPayeeCodeExit(Sender: TObject); private GoodCat : boolean; FCityStZipOption: boolean; procedure DisplayCategoryDesc; procedure DisplayAgentDesc; procedure SetCityStZipOption(const Value: boolean); procedure DisplayPayeeDesc; { Private declarations } public { Public declarations } property CityStZipOption : boolean read FCityStZipOption write SetCityStZipOption; end; procedure OpenUtlScreen(AUTLNumber:string); procedure CreateUtl; implementation uses datamod, ffsutils, TicklerGlobals, SelectCategory, TTSTrakTable, SelectBOD, TicklerTypes, TTSCodeTable; {$R *.DFM} procedure CreateUtl; var UTLInfo: TfrmUTLInformation; NewNumber : string; begin UTLInfo := TfrmUTLInformation.Create(application); try UTLInfo.dcUtl.ClearData; fillchar(UTLInfo.bufUtl.Data, sizeof(UTLInfo.bufUtl.Data),0); UTLInfo.bufUtl.Data.PUtlNumber := rjust('NEW UTL',20); UTLInfo.bufUtl.data.PUserName := CurrentUser.PUserName; UTLInfo.bufUtl.data.PDateStamp := DateTimeStamp; UTLInfo.dcUtl.ReadData; UTLInfo.edtDocNum.Text := GetDocID; UTLInfo.dcUtl.StartEdit; if UTLInfo.ShowModal = mrOk then begin UTLInfo.dcUtl.WriteData; UTLInfo.bufUtl.Data.PLenderNum := currentLend.Number; NewNumber := daapi.UtlAddRecord(UTLInfo.bufUtl.Data); if NewNumber = '0' then TrMsgInformation('There was an error creating the UTL') else begin TrMsgInformation(format('UTL #%s has been added',[trim(NewNumber)])); SetDocID(UtlInfo.edtDocNum.Text); end; end; finally UTLInfo.free; end; end; procedure OpenUtlScreen(AUTLNumber:string); var UTLInfo: TfrmUTLInformation; UtlRec : TTTSUTLRecord; utlmsg : string; begin UtlRec := daapi.UTLGetRecord(CurrentLend.Number, AUTLNumber); if UtlRec.PUtlNumber <> AUTLNumber then begin TrMsgInformation('UTL Record Not Found'); exit; end; if UtlRec.PApplied then begin utlmsg := 'UTL #'+trim(UtlRec.PUtlNumber) + ' was applied to '; if utlrec.PAppCifFlag = 'Y' then utlmsg := utlmsg + CurrentLend.capCif else utlmsg := utlmsg + CurrentLend.capLoan; utlmsg := utlmsg + ' #' + trim(UtlRec.PAppLoanNum); TrMsgInformation(utlmsg); exit; end; UTLInfo := TfrmUTLInformation.Create(application); try UTLInfo.dcUtl.ClearData; UTLInfo.bufUtl.Data := UtlRec; UTLInfo.dcUtl.ReadData; if UTLInfo.ShowModal = mrOk then begin UTLInfo.dcUtl.WriteData; daapi.UtlUpdateRecord(UTLInfo.bufUtl.Data); end; finally UTLInfo.free; end; end; procedure TfrmUTLInformation.SetCityStZipOption(const Value: boolean); begin FCityStZipOption := Value; EditBtnCity.Visible := Value; EditBtnSt.Visible := Value; EditBtnZip.Visible := Value; dcEditBtn5.Visible := not Value; end; procedure TfrmUTLInformation.dcUtlStartEdit(Sender: TObject); begin btnOk.Visible := true; btnCancel.Visible := true; end; procedure TfrmUTLInformation.DisplayCategoryDesc; var trec : TTTSTrakRecord; begin trec := Daapi.TrakGetRecord(CurrentLend.Number, padnumeric(edtCategory.text,8)); if trec.PTrackCode = '' then lblCategory.caption := 'Category Not Found' else begin GoodCat := true; lblCategory.Caption := trec.PDescription; end; end; procedure TfrmUTLInformation.edtCategoryButtonClick(Sender: TObject); begin DlgSelectCategory(sender as TdcEditBtn); DisplayCategoryDesc; end; procedure TfrmUTLInformation.DisplayAgentDesc; var code : TTTSCodeRecord; begin code := Daapi.CodeGetRecord(CurrentLend.Number, tcAgent, trim(edtAgent.Text)); lblAgent.Caption := iif(empty(code.PPrimary), 'Agent Not Found', code.PData1); end; procedure TfrmUTLInformation.DisplayPayeeDesc; var code : TTTSCodeRecord; begin code := Daapi.CodeGetRecord(CurrentLend.Number, tcPayee, trim(edtPayeeCode.Text)); lblPayee.Caption := iif(empty(code.PPrimary), 'Payee Not Found', code.PData1); end; procedure TfrmUTLInformation.edtAgentButtonClick(Sender: TObject); var retval : shortstring; begin if DlgSelectBOD(lookAgent, retval) then edtAgent.Text := retval; DisplayAgentDesc; end; procedure TfrmUTLInformation.FormCreate(Sender: TObject); begin GoodCat := false; if CurrentLend.DocIDEnabled then begin height := height + 20; lblUserID.Top := lblUserID.Top + 20; lbldcUser.Top := lbldcUser.Top + 20; lblDateTime.Top := lblDateTime.Top + 20; lbldcDateStamp.top := lbldcDateStamp.top + 20; edtAgent.Top := edtAgent.Top + 20; lblAgent.Top := lblAgent.Top + 20; lblAgnt.Top := lblAgnt.Top + 20; edtExpireDate.Top := edtExpireDate.Top + 20; lblExpireDate.Top := lblExpireDate.Top + 20; edtReference.Top := edtReference.Top + 20; lblReference.Top := lblReference.Top + 20; edtDescription.Top := edtDescription.Top + 20; lblDescription.Top := lblDescription.Top + 20; edtCategory.Top := edtCategory.Top + 20; lblCategory.Top := lblCategory.Top + 20; lblCat.Top := lblCat.Top + 20; edtDocNum.top := 248; edtDocNum.Left := 84; edtDocNum.Visible := true; edtDocNum.Enabled := true; lblDocNum.Top := 251; lblDocNum.Left := 18; lblDocNum.Visible := true; end; edtAgent.Visible := CurrentLend.AgentEnabled; lblAgnt.visible := CurrentLend.AgentEnabled; lblAgent.Visible := CurrentLend.AgentEnabled; if CurrentLend.EscrowEnabled then begin if CurrentLend.AgentEnabled then lbPayeeCode.Top := edtAgent.Top + 21 else lbPayeeCode.Top := edtExpireDate.Top + 21; lbPayeeCode.Left := 4; lbPayeeCode.Visible := True; lblPayee.visible := True; lblPayee.Top := lbPayeeCode.Top; lbPremium.Top := lbPayeeCode.Top + 21; lbPremium.Left := 4; lbPremium.Visible := True; lbPremDue.top := lbPremium.Top + 21; lbPremDue.left := 4; lbPremDue.Visible := True; lbCoverage.Top := lbPremDue.Top + 21; lbCoverage.Left := 4; lbCoverage.Visible := True; edtPayeeCode.Top := lbPayeeCode.Top; edtPayeeCode.Left := edtExpireDate.Left; edtPayeeCode.Visible := True; lblPayee.Left := edtPayeeCode.Width + edtPayeeCode.Left + 5; edtPremium.Top := edtPayeeCode.Top + 21; edtPremium.Left := edtPayeeCode.Left; edtPremium.Visible := True; edtPremDue.Top := edtPremium.Top + 21; edtPremDue.Left := edtPremium.Left; edtPremDue.Visible := True; edtCoverage.Top := edtPremDue.Top + 21; edtCoverage.Left := edtPremDue.Left; edtCoverage.Visible := True; lblUserID.Top := lbCoverage.Top + 21; lbldcUser.Top := lbCoverage.Top + 21; lblDateTime.Top := lbCoverage.Top + 21; lbldcDateStamp.top := lbCoverage.Top + 21; Height := Height + 84; end; edtExpireDate.EditMask := ''; edtPremDue.EditMask := ''; end; procedure TfrmUTLInformation.FormShow(Sender: TObject); var canedit : boolean; begin CityStZipOption := CurrentLend.FloodEnabled or TicklerSetup.MPSEnabled; DisplayCategoryDesc; DisplayAgentDesc; DisplayPayeeDesc; btnDelete.Visible := UsrRights(tpUTLDelete) and (trim(bufUtl.Data.PUtlNumber) <> 'NEW UTL'); canedit := UsrRights(tpUTLModify); dcUtl.ReadOnly := not canEdit; Label4.Caption := CurrentLend.capValue1; end; procedure TfrmUTLInformation.btnDeleteClick(Sender: TObject); begin if TrMsgConfirmation('Delete this UTL?') = idyes then begin daapi.UtlDelete(CurrentLend.Number, bufUtl.Data.PUtlNumber, CurrentUser.PUserName); modalresult := mrCancel; end; end; procedure TfrmUTLInformation.btnOkClick(Sender: TObject); begin if FCityStZipOption then begin dcEditBtn5.Text := Trim(EditBtnCity.Text)+','+Trim(EditBtnSt.Text)+' '+Trim(EditBtnZip.Text); if Trim(dcEditBtn5.Text)=',' then dcEditBtn5.Text:=''; end; DisplayCategoryDesc; if GoodCat then begin // Check for valid entry in date field if edtExpireDate.Text = '' then edtExpireDate.Date := GetglSystemDate; ModalResult := mrOk; end else MsgAsterisk('Please enter a valid category.'); end; procedure TfrmUTLInformation.dcUtlWriteData(Sender: TObject); begin bufUtl.Data.PCategory := padnumeric(bufUtl.Data.PCategory, 8); end; procedure TfrmUTLInformation.edtCategoryExit(Sender: TObject); begin DisplayCategoryDesc; end; procedure TfrmUTLInformation.edtAgentExit(Sender: TObject); begin DisplayAgentDesc; end; procedure TfrmUTLInformation.dcUtlBeforePost(Sender: TObject); begin if not CurrentLend.DocIDEnabled then bufUtl.Data.PDocumentID := ''; end; procedure TfrmUTLInformation.edtPayeeCodeButtonClick(Sender: TObject); var retval : shortstring; begin if DlgSelectBOD(lookPayee, retval) then edtPayeeCode.Text := retval; DisplayPayeeDesc; end; procedure TfrmUTLInformation.edtPayeeCodeExit(Sender: TObject); begin DisplayPayeeDesc; end; end.
unit ItfwScriptEngineWordsPack; // Модуль: "w:\common\components\rtl\Garant\ScriptEngine\ItfwScriptEngineWordsPack.pas" // Стереотип: "ScriptKeywordsPack" // Элемент модели: "ItfwScriptEngineWordsPack" MUID: (559BD7E00278) {$Include w:\common\components\rtl\Garant\ScriptEngine\seDefine.inc} interface {$If NOT Defined(NoScripts)} uses l3IntfUses , l3Interfaces , tfwTypeInfo , tfwScriptingInterfaces , Types , l3Variant , tfwDictionaryPrim , TypInfo ; {$IfEnd} // NOT Defined(NoScripts) implementation {$If NOT Defined(NoScripts)} uses l3ImplUses , tfwClassLike , tfwDictionaryEx , tfwDictionaryExWordsPack , SysUtils , TtfwTypeRegistrator_Proxy , tfwScriptingTypes //#UC START# *559BD7E00278impl_uses* //#UC END# *559BD7E00278impl_uses* ; type TkwPopScriptEngineAsKeywordFinder = {final} class(TtfwClassLike) {* Слово скрипта pop:ScriptEngine:AsKeywordFinder } private function AsKeywordFinder(const aCtx: TtfwContext; const aScriptEngine: ItfwScriptEngine): TtfwKeywordFinder; {* Реализация слова скрипта pop:ScriptEngine:AsKeywordFinder } protected class function GetWordNameForRegister: AnsiString; override; procedure DoDoIt(const aCtx: TtfwContext); override; public function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override; function GetAllParamsCount(const aCtx: TtfwContext): Integer; override; function ParamsTypes: PTypeInfoArray; override; end;//TkwPopScriptEngineAsKeywordFinder TkwPopScriptEngineAddInitialization = {final} class(TtfwClassLike) {* Слово скрипта pop:ScriptEngine:AddInitialization } private procedure AddInitialization(const aCtx: TtfwContext; const aScriptEngine: ItfwScriptEngine; aWord: TtfwWord); {* Реализация слова скрипта pop:ScriptEngine:AddInitialization } protected class function GetWordNameForRegister: AnsiString; override; procedure DoDoIt(const aCtx: TtfwContext); override; public function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override; function GetAllParamsCount(const aCtx: TtfwContext): Integer; override; function ParamsTypes: PTypeInfoArray; override; end;//TkwPopScriptEngineAddInitialization TkwPopScriptEngineCurrentCompilingDictionary = {final} class(TtfwClassLike) {* Слово скрипта pop:ScriptEngine:CurrentCompilingDictionary } private function CurrentCompilingDictionary(const aCtx: TtfwContext; const aScriptEngine: ItfwScriptEngine): TtfwDictionaryEx; {* Реализация слова скрипта pop:ScriptEngine:CurrentCompilingDictionary } protected class function GetWordNameForRegister: AnsiString; override; procedure DoDoIt(const aCtx: TtfwContext); override; public function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override; function GetAllParamsCount(const aCtx: TtfwContext): Integer; override; function ParamsTypes: PTypeInfoArray; override; end;//TkwPopScriptEngineCurrentCompilingDictionary TkwPopScriptEngineDisableForHelp = {final} class(TtfwClassLike) {* Слово скрипта pop:ScriptEngine:DisableForHelp } private procedure DisableForHelp(const aCtx: TtfwContext; const aScriptEngine: ItfwScriptEngine; aWord: TtfwWord); {* Реализация слова скрипта pop:ScriptEngine:DisableForHelp } protected class function GetWordNameForRegister: AnsiString; override; procedure DoDoIt(const aCtx: TtfwContext); override; public function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override; function GetAllParamsCount(const aCtx: TtfwContext): Integer; override; function ParamsTypes: PTypeInfoArray; override; end;//TkwPopScriptEngineDisableForHelp function TkwPopScriptEngineAsKeywordFinder.AsKeywordFinder(const aCtx: TtfwContext; const aScriptEngine: ItfwScriptEngine): TtfwKeywordFinder; {* Реализация слова скрипта pop:ScriptEngine:AsKeywordFinder } //#UC START# *559BD88103B1_559BD88103B1_4DB008DD01BD_Word_var* //#UC END# *559BD88103B1_559BD88103B1_4DB008DD01BD_Word_var* begin //#UC START# *559BD88103B1_559BD88103B1_4DB008DD01BD_Word_impl* Result := aScriptEngine.KeywordFinder(aCtx); //#UC END# *559BD88103B1_559BD88103B1_4DB008DD01BD_Word_impl* end;//TkwPopScriptEngineAsKeywordFinder.AsKeywordFinder class function TkwPopScriptEngineAsKeywordFinder.GetWordNameForRegister: AnsiString; begin Result := 'pop:ScriptEngine:AsKeywordFinder'; end;//TkwPopScriptEngineAsKeywordFinder.GetWordNameForRegister function TkwPopScriptEngineAsKeywordFinder.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; begin Result := TypeInfo(TtfwKeywordFinder); end;//TkwPopScriptEngineAsKeywordFinder.GetResultTypeInfo function TkwPopScriptEngineAsKeywordFinder.GetAllParamsCount(const aCtx: TtfwContext): Integer; begin Result := 1; end;//TkwPopScriptEngineAsKeywordFinder.GetAllParamsCount function TkwPopScriptEngineAsKeywordFinder.ParamsTypes: PTypeInfoArray; begin Result := OpenTypesToTypes([TypeInfo(ItfwScriptEngine)]); end;//TkwPopScriptEngineAsKeywordFinder.ParamsTypes procedure TkwPopScriptEngineAsKeywordFinder.DoDoIt(const aCtx: TtfwContext); var l_aScriptEngine: ItfwScriptEngine; begin try l_aScriptEngine := ItfwScriptEngine(aCtx.rEngine.PopIntf(ItfwScriptEngine)); except on E: Exception do begin RunnerError('Ошибка при получении параметра aScriptEngine: ItfwScriptEngine : ' + E.Message, aCtx); Exit; end;//on E: Exception end;//try..except aCtx.rEngine.PushObj(AsKeywordFinder(aCtx, l_aScriptEngine)); end;//TkwPopScriptEngineAsKeywordFinder.DoDoIt procedure TkwPopScriptEngineAddInitialization.AddInitialization(const aCtx: TtfwContext; const aScriptEngine: ItfwScriptEngine; aWord: TtfwWord); {* Реализация слова скрипта pop:ScriptEngine:AddInitialization } //#UC START# *55A3DFCE00D9_55A3DFCE00D9_4DB008DD01BD_Word_var* //#UC END# *55A3DFCE00D9_55A3DFCE00D9_4DB008DD01BD_Word_var* begin //#UC START# *55A3DFCE00D9_55A3DFCE00D9_4DB008DD01BD_Word_impl* aCtx.rEngine.AddInitialization(aCtx, aWord); //#UC END# *55A3DFCE00D9_55A3DFCE00D9_4DB008DD01BD_Word_impl* end;//TkwPopScriptEngineAddInitialization.AddInitialization class function TkwPopScriptEngineAddInitialization.GetWordNameForRegister: AnsiString; begin Result := 'pop:ScriptEngine:AddInitialization'; end;//TkwPopScriptEngineAddInitialization.GetWordNameForRegister function TkwPopScriptEngineAddInitialization.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; begin Result := @tfw_tiVoid; end;//TkwPopScriptEngineAddInitialization.GetResultTypeInfo function TkwPopScriptEngineAddInitialization.GetAllParamsCount(const aCtx: TtfwContext): Integer; begin Result := 2; end;//TkwPopScriptEngineAddInitialization.GetAllParamsCount function TkwPopScriptEngineAddInitialization.ParamsTypes: PTypeInfoArray; begin Result := OpenTypesToTypes([TypeInfo(ItfwScriptEngine), TypeInfo(TtfwWord)]); end;//TkwPopScriptEngineAddInitialization.ParamsTypes procedure TkwPopScriptEngineAddInitialization.DoDoIt(const aCtx: TtfwContext); var l_aScriptEngine: ItfwScriptEngine; var l_aWord: TtfwWord; begin try l_aScriptEngine := ItfwScriptEngine(aCtx.rEngine.PopIntf(ItfwScriptEngine)); except on E: Exception do begin RunnerError('Ошибка при получении параметра aScriptEngine: ItfwScriptEngine : ' + E.Message, aCtx); Exit; end;//on E: Exception end;//try..except try l_aWord := TtfwWord(aCtx.rEngine.PopObjAs(TtfwWord)); except on E: Exception do begin RunnerError('Ошибка при получении параметра aWord: TtfwWord : ' + E.Message, aCtx); Exit; end;//on E: Exception end;//try..except AddInitialization(aCtx, l_aScriptEngine, l_aWord); end;//TkwPopScriptEngineAddInitialization.DoDoIt function TkwPopScriptEngineCurrentCompilingDictionary.CurrentCompilingDictionary(const aCtx: TtfwContext; const aScriptEngine: ItfwScriptEngine): TtfwDictionaryEx; {* Реализация слова скрипта pop:ScriptEngine:CurrentCompilingDictionary } //#UC START# *55AE5A4303B3_55AE5A4303B3_4DB008DD01BD_Word_var* //#UC END# *55AE5A4303B3_55AE5A4303B3_4DB008DD01BD_Word_var* begin //#UC START# *55AE5A4303B3_55AE5A4303B3_4DB008DD01BD_Word_impl* Result := aScriptEngine.CurrentCompilingDictionary As TtfwDictionaryEx; //#UC END# *55AE5A4303B3_55AE5A4303B3_4DB008DD01BD_Word_impl* end;//TkwPopScriptEngineCurrentCompilingDictionary.CurrentCompilingDictionary class function TkwPopScriptEngineCurrentCompilingDictionary.GetWordNameForRegister: AnsiString; begin Result := 'pop:ScriptEngine:CurrentCompilingDictionary'; end;//TkwPopScriptEngineCurrentCompilingDictionary.GetWordNameForRegister function TkwPopScriptEngineCurrentCompilingDictionary.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; begin Result := TypeInfo(TtfwDictionaryEx); end;//TkwPopScriptEngineCurrentCompilingDictionary.GetResultTypeInfo function TkwPopScriptEngineCurrentCompilingDictionary.GetAllParamsCount(const aCtx: TtfwContext): Integer; begin Result := 1; end;//TkwPopScriptEngineCurrentCompilingDictionary.GetAllParamsCount function TkwPopScriptEngineCurrentCompilingDictionary.ParamsTypes: PTypeInfoArray; begin Result := OpenTypesToTypes([TypeInfo(ItfwScriptEngine)]); end;//TkwPopScriptEngineCurrentCompilingDictionary.ParamsTypes procedure TkwPopScriptEngineCurrentCompilingDictionary.DoDoIt(const aCtx: TtfwContext); var l_aScriptEngine: ItfwScriptEngine; begin try l_aScriptEngine := ItfwScriptEngine(aCtx.rEngine.PopIntf(ItfwScriptEngine)); except on E: Exception do begin RunnerError('Ошибка при получении параметра aScriptEngine: ItfwScriptEngine : ' + E.Message, aCtx); Exit; end;//on E: Exception end;//try..except aCtx.rEngine.PushObj(CurrentCompilingDictionary(aCtx, l_aScriptEngine)); end;//TkwPopScriptEngineCurrentCompilingDictionary.DoDoIt procedure TkwPopScriptEngineDisableForHelp.DisableForHelp(const aCtx: TtfwContext; const aScriptEngine: ItfwScriptEngine; aWord: TtfwWord); {* Реализация слова скрипта pop:ScriptEngine:DisableForHelp } //#UC START# *55AFBAE40273_55AFBAE40273_4DB008DD01BD_Word_var* //#UC END# *55AFBAE40273_55AFBAE40273_4DB008DD01BD_Word_var* begin //#UC START# *55AFBAE40273_55AFBAE40273_4DB008DD01BD_Word_impl* aScriptEngine.DisableForHelp(aWord); //#UC END# *55AFBAE40273_55AFBAE40273_4DB008DD01BD_Word_impl* end;//TkwPopScriptEngineDisableForHelp.DisableForHelp class function TkwPopScriptEngineDisableForHelp.GetWordNameForRegister: AnsiString; begin Result := 'pop:ScriptEngine:DisableForHelp'; end;//TkwPopScriptEngineDisableForHelp.GetWordNameForRegister function TkwPopScriptEngineDisableForHelp.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; begin Result := @tfw_tiVoid; end;//TkwPopScriptEngineDisableForHelp.GetResultTypeInfo function TkwPopScriptEngineDisableForHelp.GetAllParamsCount(const aCtx: TtfwContext): Integer; begin Result := 2; end;//TkwPopScriptEngineDisableForHelp.GetAllParamsCount function TkwPopScriptEngineDisableForHelp.ParamsTypes: PTypeInfoArray; begin Result := OpenTypesToTypes([TypeInfo(ItfwScriptEngine), TypeInfo(TtfwWord)]); end;//TkwPopScriptEngineDisableForHelp.ParamsTypes procedure TkwPopScriptEngineDisableForHelp.DoDoIt(const aCtx: TtfwContext); var l_aScriptEngine: ItfwScriptEngine; var l_aWord: TtfwWord; begin try l_aScriptEngine := ItfwScriptEngine(aCtx.rEngine.PopIntf(ItfwScriptEngine)); except on E: Exception do begin RunnerError('Ошибка при получении параметра aScriptEngine: ItfwScriptEngine : ' + E.Message, aCtx); Exit; end;//on E: Exception end;//try..except try l_aWord := TtfwWord(aCtx.rEngine.PopObjAs(TtfwWord)); except on E: Exception do begin RunnerError('Ошибка при получении параметра aWord: TtfwWord : ' + E.Message, aCtx); Exit; end;//on E: Exception end;//try..except DisableForHelp(aCtx, l_aScriptEngine, l_aWord); end;//TkwPopScriptEngineDisableForHelp.DoDoIt initialization TkwPopScriptEngineAsKeywordFinder.RegisterInEngine; {* Регистрация pop_ScriptEngine_AsKeywordFinder } TkwPopScriptEngineAddInitialization.RegisterInEngine; {* Регистрация pop_ScriptEngine_AddInitialization } TkwPopScriptEngineCurrentCompilingDictionary.RegisterInEngine; {* Регистрация pop_ScriptEngine_CurrentCompilingDictionary } TkwPopScriptEngineDisableForHelp.RegisterInEngine; {* Регистрация pop_ScriptEngine_DisableForHelp } TtfwTypeRegistrator.RegisterType(TypeInfo(ItfwScriptEngine)); {* Регистрация типа ItfwScriptEngine } TtfwTypeRegistrator.RegisterType(TypeInfo(TtfwKeywordFinder)); {* Регистрация типа TtfwKeywordFinder } TtfwTypeRegistrator.RegisterType(TypeInfo(TtfwDictionaryEx)); {* Регистрация типа TtfwDictionaryEx } TtfwTypeRegistrator.RegisterType(TypeInfo(TtfwWord)); {* Регистрация типа TtfwWord } {$IfEnd} // NOT Defined(NoScripts) end.
unit csProcessTask; interface uses Classes, CsDataPipe, ddProgressObj, ddServerTask, l3LongintList, CsTaskTypes, DT_types, DT_UserConst; type TddProcessTask = class; TddTaskRunProc = procedure (aSelf: TddProcessTask; aProgressor: TddProgressObject) of object; TddProcessTask = class(TddTaskItem) private f_Aborted: Boolean; f_Comment: ShortString; f_DocumentIDList: Tl3LongintList; f_ReplyAddress: String; f_RunProc : TddTaskRunProc; f_Status: TcsTaskStatus; function pm_GetDelayed: Boolean; function pm_GetDelivering: Boolean; function pm_GetEnabled: Boolean; procedure pm_SetComment(const Value: ShortString); procedure pm_SetDelayed(const Value: Boolean); procedure pm_SetDocumentIDList(const Value: Tl3LongintList); procedure pm_SetEnabled(const Value: Boolean); procedure pm_SetStatus(const Value: TcsTaskStatus); protected procedure Cleanup; override; procedure DoRun(aProgressor: TddProgressObject); virtual; procedure DoBeforeRun; virtual; procedure DoAfterRun; virtual; procedure LoadFrom(aStream: TStream; aIsPipe: Boolean); override; public constructor Create(aOwner: TObject; aUserID: TUserID); override; constructor Make(aTaskType: TcsTaskType; aUserID: TUserID = usServerService; const aDescription: String = ''; aRunProc: TddTaskRunProc = nil); procedure Abort; virtual; procedure Clear; virtual; procedure Delivery; procedure Done; procedure Error; procedure Run(aProgressor: TddProgressObject); procedure SaveTo(aStream: TStream; aIsPipe: Boolean); override; procedure SaveToPipe(aPipe: TCsDataPipe); override; procedure WriteResult(aStream: TStream); overload; virtual; procedure WriteResult(aPipe: TcsDataPipe); overload; virtual; property Aborted: Boolean read f_Aborted write f_Aborted; property Comment: ShortString read f_Comment write pm_SetComment; property Delayed: Boolean read pm_GetDelayed write pm_SetDelayed; property Delivering: Boolean read pm_GetDelivering; property DocumentIDList: Tl3LongintList read f_DocumentIDList write pm_SetDocumentIDList; property Enabled: Boolean read pm_GetEnabled write pm_SetEnabled; property ReplyAddress: String read f_ReplyAddress write f_ReplyAddress; property Status: TcsTaskStatus read f_Status write pm_SetStatus; end; implementation uses l3Base, SysUtils, l3FileUtils, l3Types; { ******************************** TddProcessTask ******************************** } constructor TddProcessTask.Create(aOwner: TObject; aUserID: TUserID); begin inherited; f_DocumentIDList := Tl3LongintList.Make; f_Status := cs_tsNone; end; constructor TddProcessTask.Make(aTaskType: TcsTaskType; aUserID: TUserID = usServerService; const aDescription: String = ''; aRunProc: TddTaskRunProc = nil); begin Create(nil, aUserID); TaskType := aTaskType; UserID := aUserID; Description:= aDescription; f_RunProc:= aRunProc; end; procedure TddProcessTask.Abort; begin f_Aborted:= True; end; procedure TddProcessTask.Cleanup; begin l3Free(f_DocumentIDList); inherited; end; procedure TddProcessTask.Clear; begin (* if (Status = cs_tsDone) and (TaskFolder <> '') and DirectoryExists(TaskFolder) then DelDir(TaskFolder); *) end; procedure TddProcessTask.Delivery; begin f_Comment := 'Ожидает доставки пользователю'; Status := cs_tsDelivery; end; procedure TddProcessTask.Done; begin Clear; // раз задача выполнена, никакая информация уже не нужна f_Comment := 'выполнено'; Status := cs_tsDone; end; procedure TddProcessTask.DoBeforeRun; begin // do nothing end; procedure TddProcessTask.DoAfterRun; begin // do nothing end; procedure TddProcessTask.DoRun(aProgressor: TddProgressObject); begin if Assigned(f_RunProc) then f_RunProc(Self, aProgressor) else l3System.Msg2Log('Не перекрыт метод %s.DoRun', [ClassName], l3_msgLevel3); end; procedure TddProcessTask.Error; begin f_Comment:= 'Выполнение завершилось ошибкой'; Status:= cs_tsError; end; procedure TddProcessTask.LoadFrom(aStream: TStream; aIsPipe: Boolean); var l_S: ansistring; begin inherited; with aStream do begin Read(f_Status, SizeOf(f_Status)); ReadString(aStream, l_S); f_Comment := l_S; end; // with f_DocumentIDList.Load(aStream); end; function TddProcessTask.pm_GetDelayed: Boolean; begin Result := Status = cs_tsDelayed; end; function TddProcessTask.pm_GetDelivering: Boolean; begin Result := Status = cs_tsDelivery; end; function TddProcessTask.pm_GetEnabled: Boolean; begin Result := Status = cs_tsQuery; end; procedure TddProcessTask.pm_SetComment(const Value: ShortString); begin if f_Comment <> Value then begin f_Comment := Value; Changed(cs_tsNone); end; end; procedure TddProcessTask.pm_SetDelayed(const Value: Boolean); begin Status:= cs_tsDelayed; end; procedure TddProcessTask.pm_SetDocumentIDList(const Value: Tl3LongintList); begin if f_DocumentIDList <> Value then f_DocumentIDList.Assign(Value); end; procedure TddProcessTask.pm_SetEnabled(const Value: Boolean); begin if(Status in [cs_tsQuery, cs_tsFrozen]) then begin if Value then Status := cs_tsQuery else Status := cs_tsFrozen; end; end; procedure TddProcessTask.Run(aProgressor: TddProgressObject); begin Status := cs_tsRun; DoBeforeRun; try DoRun(aProgressor); except Status:= cs_tsError; end; DoAfterRun; end; procedure TddProcessTask.SaveTo(aStream: TStream; aIsPipe: Boolean); begin f_Aborted:= False; inherited; with aStream do begin Write(f_Status, SizeOf(f_Status)); WriteString(aStream, Comment); end; f_DocumentIDList.Save(aStream); end; procedure TddProcessTask.SaveToPipe(aPipe: TCsDataPipe); begin inherited; //Index := aPipe.ReadInteger; end; procedure TddProcessTask.pm_SetStatus(const Value: TcsTaskStatus); var l_PrevStatus: TcsTaskStatus; begin if f_Status <> Value then begin l_PrevStatus := f_Status; f_Status := Value; Changed(l_PrevStatus); end; end; procedure TddProcessTask.WriteResult(aStream: TStream); begin end; procedure TddProcessTask.WriteResult(aPipe: TcsDataPipe); begin end; end.
unit ColumnsOptionPart; interface uses Classes, SearchOption_Intf, FMX.ListBox, FMX.Controls, UIWappedPartUnit; type TColumnsOptionPart = class(TAbsUIWrappedPart) private FListBox: TListBox; FBtnAllSelect: TButton; FBtnClear: TButton; protected FDBMSName: String; //FColumns: TStringList; FDatetimeColumn: String; FNormalQuery: String; FGroupQuery: String; procedure SetTemplateQuery; function DistinctDatetime(cols: TStringList): TStringList; procedure BtnAllSel_OnClick(Sender: TObject); procedure BtnClear_OnClick(Sender: TObject); procedure SetAllSelect(val: Boolean); public //constructor Create(dbmsName: String); overload; constructor Create(owner: TExpander; listBox: TListBox; btnAllSel, btnClear: TButton ); procedure SetDatetimeColumn(col: String); procedure SetColumns(cols: TStringList); function GetColumns: TStringList; function InsertPartToQuery(tagQuery, key: String; currIndex: Integer): String; override; function GetValues(key: String): String; override; procedure SetValues(key, val: String); override; function GetSelectedItems: TStringList; end; implementation uses SysUtils, QueryReader, Const_SearchOptionUnit, StrUtils; { TColumnsOptionPart } procedure TColumnsOptionPart.BtnAllSel_OnClick(Sender: TObject); begin SetAllSelect( true ); end; procedure TColumnsOptionPart.BtnClear_OnClick(Sender: TObject); begin SetAllSelect( false ); end; constructor TColumnsOptionPart.Create(owner: TExpander; listBox: TListBox; btnAllSel, btnClear: TButton ); begin Init( owner ); FListBox := listBox; FBtnAllSelect := btnAllSel; FBtnClear := btnClear; FBtnAllSelect.OnClick := BtnAllSel_OnClick; FBtnClear.OnClick := BtnClear_OnClick; FDBMSName := 'firebird'; SetTemplateQuery; end; function TColumnsOptionPart.GetColumns: TStringList; var sList: TStringList; i: Integer; begin sList := TStringList.Create; sList.AddStrings( FListBox.Items ); result := sList; end; function TColumnsOptionPart.GetSelectedItems: TStringList; var sList: TStringList; i: Integer; begin sList := TStringList.Create; for i := 0 to FListBox.Count - 1 do begin if FListBox.ListItems[ i ].IsChecked = true then begin sList.Add( FListBox.ListItems[ i ].Text ); end; end; result := sList; end; function TColumnsOptionPart.GetValues(key: String): String; begin if key = 'columns.datetime' then begin result := FDatetimeColumn; end else if FListBox.Items = Nil then begin exit; end; result := FListBox.Items[ StrToInt( key ) ]; end; function TColumnsOptionPart.InsertPartToQuery(tagQuery, key: String; currIndex: Integer): String; var sbQuery: TStringBuilder; sTempCols: String; sAppendedCols: String; i: Integer; sListCols: TStringList; begin sbQuery := TStringBuilder.Create; sListCols := GetSelectedItems; if key = 'columns.normal' then sTempCols := FNormalQuery else if key = 'columns.group' then sTempCols := FGroupQuery; if key = 'columns.datetime' then begin result := StringReplace( tagQuery, '{' + IntToStr( currIndex ) + '}', FDatetimeColumn, [ rfReplaceAll, rfIgnoreCase ] ); exit; end else begin for i := 0 to sListCols.Count - 1 do begin sbQuery.Append( StringReplace( sTempCols, '{0}', sListCols[ i ], [ rfReplaceAll, rfIgnoreCase ] ) ); end; sAppendedCols := sbQuery.ToString; end; result := StringReplace( tagQuery, '{' + IntToStr( currIndex ) + '}', sAppendedCols, [ rfReplaceAll, rfIgnoreCase ] ); end; procedure TColumnsOptionPart.SetAllSelect(val: Boolean); var i: Integer; begin for i := 0 to FListBox.Count - 1 do begin FListBox.ListItems[ i ].IsChecked := val; end; end; procedure TColumnsOptionPart.SetColumns(cols: TStringList); begin //FColumns := cols; FListBox.Items.Clear; FListBox.Items.AddStrings( DistinctDatetime( cols ) ); end; procedure TColumnsOptionPart.SetDatetimeColumn(col: String); begin FDatetimeColumn := col; end; procedure TColumnsOptionPart.SetTemplateQuery; var queryReader: TQueryReader; begin queryReader := TQueryReader.Create( FDBMSName, 'insightviewer' ); FNormalQuery := queryReader.GetQuery( 'template.column.normal' ); FGroupQuery := queryReader.GetQuery( 'template.column.group' ); queryReader.Free; end; procedure TColumnsOptionPart.SetValues(key, val: String); var iKey: Integer; begin if key = 'dbms' then begin FDBMSName := val; SetTemplateQuery; exit; end; if FListBox.Items = Nil then exit; iKey := StrToInt( key ); if FListBox.Count <= iKey then exit; FListBox.Items.Add( val ) end; function TColumnsOptionPart.DistinctDatetime(cols: TStringList): TStringList; var i, j: Integer; isMatch: Boolean; sList: TStringList; begin isMatch := false; sList := TStringList.Create; FDatetimeColumn := ''; for i := 0 to cols.Count - 1 do begin for j := 0 to High( DATETIME_COLUMN_PATTERN ) do begin if ( ContainsStr( LowerCase( cols[ i ] ), DATETIME_COLUMN_PATTERN[ j ] ) = true ) then begin isMatch := true; break; end //else isMatch := isMatch or false; else isMatch := false; end; if ( FDatetimeColumn = '' ) and ( isMatch = true ) then FDatetimeColumn := cols[ i ] else if isMatch = false then sList.Add( cols[ i ] ); end; result := sList; end; end.
unit StockDetailData_Get_163; interface uses BaseApp, Sysutils, UtilsHttp, StockDayDataAccess, define_dealitem, win.iobuffer; type TDealDetailDataHeadName_163 = ( headNone, headDealTime, headDealPrice, headDealPriceOffset, headDealVolume, headDealAmount, headDealType); PRT_DealDetailData_HeaderSina = ^TRT_DealDetailData_HeaderSina; TRT_DealDetailData_HeaderSina = record IsReady : Byte; DateFormat_163 : Sysutils.TFormatSettings; HeadNameIndex : array[TDealDetailDataHeadName_163] of SmallInt; end; const // 获取代码为sh600900,在2011-07-08的成交明细,数据为xls格式 // http://quotes.money.163.com/cjmx/2016/20160216/1002414.xls Base163DetailUrl1 = 'http://quotes.money.163.com/cjmx/'; DealDetailDataHeadNames_163: array[TDealDetailDataHeadName_163] of string = ('', '成交时间', '成交价', '价格变动', '成交量', '成交额', '性质'); function GetStockDataDetail_163(App: TBaseApp; AStockDayAccess: TStockDayDataAccess; AHttpClientSession: PHttpClientSession): Boolean; implementation uses Classes, nexcel, define_price, define_deal, define_datetime, UtilsLog, UtilsDateTime, StockDetailDataAccess, StockDetailData_Save, define_stock_quotes, define_dealstore_file, define_datasrc; {$IFNDEF RELEASE} const LOGTAG = 'StockDetailData_Get_163.pas'; {$ENDIF} function GetCellText(ASheet: IXLSWorkSheet; ARowIndex, AColIndex: integer): WideString; var tmpCell: IXLSRange; begin Result := ''; tmpCell := ASheet.Cells.Item[ARowIndex, AColIndex]; if nil <> tmpCell then begin Result := tmpCell.Value; end; end; function DataParse_DetailData_163(App: TBaseApp; ADetailData: TStockDetailDataAccess; ADataStream: TStream): Boolean; var tmpXls: TXLSWorkbook; tmpSheet: IXLSWorkSheet; tmpRowIdx: integer; tmpColIdx: integer; tmpParse163: TRT_DealDetailData_HeaderSina; tmp163head: TDealDetailDataHeadName_163; tmpText: WideString; tmpStockDateTime: TDateTimeStock; tmpDetailData: PRT_Quote_Detail; tmpDealVolume: integer; tmpDealAmount: integer; tmpPrice: double; begin Result := false; tmpXls := TXLSWorkbook.Create; try //tmpXls.Open(AFileUrl); tmpXls.Open(ADataStream); if nil = tmpXls.WorkSheets then exit; if 1 > tmpXls.WorkSheets.Count then exit; try tmpSheet := tmpXls.WorkSheets.Entries[1]; if nil = tmpSheet then exit; if '' = tmpSheet.Name then exit; if 1 > tmpSheet._RowInfo.RowCount then exit; if nil = tmpSheet.Cells then exit; FillChar(tmpParse163, SizeOf(tmpParse163), 0); for tmpRowIdx := 1 to tmpSheet._RowInfo.RowCount do begin if 0 = tmpParse163.IsReady then begin for tmpColIdx := 1 to 6{tmpSheet._ColumnInfo.ColCount - 1} do begin tmpText := GetCellText(tmpSheet, tmpRowIdx, tmpColIdx); if '' <> tmpText then begin for tmp163head := Low(TDealDetailDataHeadName_163) to High(TDealDetailDataHeadName_163) do begin if 0 < Pos(DealDetailDataHeadNames_163[tmp163head], tmpText) then begin tmpParse163.HeadNameIndex[tmp163head] := tmpColIdx; tmpParse163.IsReady := 1; end; end; end; end; end else begin tmpText := GetCellText(tmpSheet, tmpRowIdx, tmpParse163.HeadNameIndex[headDealTime]); Time2TimeStock(ParseDateTime(tmpText), @tmpStockDateTime.Time); // := GetDetailTimeIndex(tmpText); if 0 < tmpStockDateTime.Time.Value then begin tmptext := GetCellText(tmpSheet, tmpRowIdx, tmpParse163.HeadNameIndex[headDealVolume]); tmpDealVolume := StrToIntDef(tmptext, 0); tmptext := GetCellText(tmpSheet, tmpRowIdx, tmpParse163.HeadNameIndex[headDealAmount]); tmpDealAmount := StrToIntDef(tmptext, 0); if (0 < tmpDealVolume) and (0 < tmpDealAmount) then begin if 0 < ADetailData.FirstDealDate then begin if ADetailData.FirstDealDate = ADetailData.LastDealDate then begin Result := true; tmpStockDateTime.Date.Value := ADetailData.FirstDealDate; tmpDetailData := ADetailData.NewDetail(tmpStockDateTime); if nil <> tmpDetailData then begin tmpText := GetCellText(tmpSheet, tmpRowIdx, tmpParse163.HeadNameIndex[headDealPrice]); //tmpText := '18.9'; TryStrToFloat(tmptext, tmpPrice); //tmpText := formatFloat('0.00',tmpText); SetRTPricePack(@tmpDetailData.Price, tmpPrice); tmpDetailData.DealVolume := tmpDealVolume; tmpDetailData.DealAmount := tmpDealAmount; tmpText := GetCellText(tmpSheet, tmpRowIdx, tmpParse163.HeadNameIndex[headDealType]); if Pos('卖', tmpText) > 0 then begin tmpDetailData.DealType := DealType_Sale; end else begin if Pos('买', tmpText) > 0 then begin tmpDetailData.DealType := DealType_Buy; end else begin tmpDetailData.DealType := DealType_Neutral; end; end; end; end; end; end; end; end; end; except end; finally tmpXls.Free; end; end; function GetStockDayDetailData_163(App: TBaseApp; AStockItem: PRT_DealItem; AHttpClientSession: PHttpClientSession; ADealDay: Word): Boolean; var tmpUrl: string; tmpHttpData: PIOBuffer; tmpFilePathRoot: AnsiString; tmpFilePathYear: AnsiString; tmpFileName: AnsiString; tmpFileExt: AnsiString; tmpHttpHeadParse: THttpHeadParseSession; tmpStream: TMemoryStream; tmpDetailData: TStockDetailDataAccess; begin Result := false; tmpFilePathYear := App.Path.GetFilePath(AStockItem.DBType, DataType_DetailData, DataSrc_163, ADealDay, AStockItem); tmpFileName := App.Path.GetFileName(DataType_DetailData, DataSrc_163, ADealDay, AStockItem, ''); if FileExists(tmpFilePathYear + tmpFileName) then begin Result := true; exit; end; tmpFilePathRoot := App.Path.GetFilePath(AStockItem.DBType, DataType_DetailData, DataSrc_163, 0, AStockItem); tmpFileExt := ExtractFileExt(tmpFileName); //ADealDay := Trunc(EncodeDate(2016, 6, 6)); // 2016/20160216/1002414.xls tmpUrl := Base163DetailUrl1 + FormatDateTime('yyyy', ADealDay) + '/' + FormatDateTime('yyyymmdd', ADealDay) + '/' + GetStockCode_163(AStockItem) + '.xls'; //Log('', 'Get Stock Detail:' + tmpUrl); tmpHttpData := GetHttpUrlData(tmpUrl, AHttpClientSession, nil); if nil <> tmpHttpData then begin try FillChar(tmpHttpHeadParse, SizeOf(tmpHttpHeadParse), 0); HttpBufferHeader_Parser(tmpHttpData, @tmpHttpHeadParse); if (199 < tmpHttpHeadParse.RetCode) and (300 > tmpHttpHeadParse.RetCode) then begin if 0 < tmpHttpHeadParse.HeadEndPos then begin tmpStream := TMemoryStream.Create; tmpDetailData := TStockDetailDataAccess.Create(AStockItem, Src_163); try tmpDetailData.FirstDealDate := ADealDay; tmpDetailData.LastDealDate := ADealDay; tmpStream.WriteBuffer(tmpHttpData.Data[tmpHttpHeadParse.HeadEndPos + 1], tmpHttpData.BufferHead.BufDataLength - tmpHttpHeadParse.HeadEndPos); try Result := DataParse_DetailData_163(App, tmpDetailData, tmpStream); except end; tmpStream.Clear; if 0 < tmpDetailData.RecordCount then begin tmpDetailData.Sort; //Log('', 'GetStockDayDetailData_Sina ok' + AStockItem.sCode + ':' + FormatDateTime('yyyymmdd', ADealDay)); SaveStockDetailData(App, tmpDetailData); Result := True; end; finally tmpStream.Free; tmpDetailData.Free; end; { tmpUrl := 'e:\' + GetStockCode_163(AStockItem) + '.xls'; SaveHttpResponseToFile(tmpHttpData, @tmpHttpHeadParse, tmpUrl); if FileExists(tmpUrl) then begin Parser_163Xls(App, AStockItem, tmpUrl); end; } end; end; finally CheckInIOBuffer(tmpHttpData); end; end; end; function GetStockDataDetail_163(App: TBaseApp; AStockDayAccess: TStockDayDataAccess; AHttpClientSession: PHttpClientSession): Boolean; var i: integer; tmpFilePathYear: string; tmpFileName: string; tmpFileUrl: string; tmpLastDealDate: integer; tmpYear, tmpMonth, tmpDay: Word; tmpDealDay: PRT_Quote_Day; tmpCount: integer; begin Result := false; // Parser_163Xls('e:\0600000.xls'); // Exit; //Log('', 'Get Stock Detail:' + AStockDayAccess.StockItem.sCode + ' last:' + FormatDateTime('yyyymmdd', AStockDayAccess.LastDealDate)); if 0 < AStockDayAccess.LastDealDate then begin AStockDayAccess.Sort; tmpCount :=0; tmpLastDealDate := 0; for i := AStockDayAccess.RecordCount - 1 downto 0 do begin tmpDealDay := AStockDayAccess.RecordItem[i]; if 1 > tmpDealDay.DealVolume then Continue; if 1 > tmpDealDay.DealAmount then Continue; if 5 < tmpCount then Break; DecodeDate(tmpDealDay.DealDate.Value, tmpYear, tmpMonth, tmpDay); if 2016 > tmpYear then Break; if 0 = tmpLastDealDate then begin tmpLastDealDate := tmpDealDay.DealDate.Value; end else begin if 14 < tmpLastDealDate - tmpDealDay.DealDate.Value then Break; end; tmpFilePathYear := App.Path.GetFilePath(AStockDayAccess.StockItem.DBType, DataType_DetailData, DataSrc_163, tmpDealDay.DealDate.Value, AStockDayAccess.StockItem); tmpFileName := App.Path.GetFileName(DataType_DetailData, DataSrc_163, tmpDealDay.DealDate.Value, AStockDayAccess.StockItem, ''); if '' <> tmpFileName then begin if not FileExists(tmpFilePathYear + tmpFileName) then begin tmpFileUrl := ChangeFileExt(tmpFilePathYear + tmpFileName, '.sdet'); if not FileExists(tmpFileUrl) then begin //Log('', 'Get Stock Detail:' + tmpFileUrl); if GetStockDayDetailData_163(App, AStockDayAccess.StockItem, AHttpClientSession, tmpDealDay.DealDate.Value) then begin if not Result then Result := True; end; Inc(tmpCount); end else begin Inc(tmpCount); Continue; end; end else begin Inc(tmpCount); Continue; end; end else begin Inc(tmpCount); Continue; end; end; end; end; end.