hexsha
stringlengths 40
40
| size
int64 3
1.05M
| ext
stringclasses 163
values | lang
stringclasses 53
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
112
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
listlengths 1
10
| max_stars_count
float64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
113
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
listlengths 1
10
| max_issues_count
float64 1
116k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
113
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
listlengths 1
10
| max_forks_count
float64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 3
1.05M
| avg_line_length
float64 1
966k
| max_line_length
int64 1
977k
| alphanum_fraction
float64 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4768f54ecf57ce1f49d05f9994a6c92439f25625 | 2,833 | pas | Pascal | HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/CryptoLib/src/Interfaces/ClpIBlockCipherPadding.pas | devilking6105/HODLER-Open-Source-Multi-Asset-Wallet | 2554bce0ad3e3e08e4617787acf93176243ce758 | [
"Unlicense"
]
| 148 | 2018-02-08T23:36:43.000Z | 2022-03-16T01:33:20.000Z | HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/CryptoLib/src/Interfaces/ClpIBlockCipherPadding.pas | Ecoent/HODLER-Open-Source-Multi-Asset-Wallet | a8c54ecfc569d0ee959b6f0e7826c4ee4b5c4848 | [
"Unlicense"
]
| 85 | 2018-10-23T17:09:20.000Z | 2022-01-12T07:12:54.000Z | HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/CryptoLib/src/Interfaces/ClpIBlockCipherPadding.pas | Ecoent/HODLER-Open-Source-Multi-Asset-Wallet | a8c54ecfc569d0ee959b6f0e7826c4ee4b5c4848 | [
"Unlicense"
]
| 46 | 2018-03-18T17:25:59.000Z | 2022-02-07T16:52:15.000Z | { *********************************************************************************** }
{ * 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 ClpIBlockCipherPadding;
{$I ..\Include\CryptoLib.inc}
interface
uses
ClpISecureRandom,
ClpCryptoLibTypes;
type
/// <remarks>Block cipher padders are expected to conform to this interface.</remarks>
IBlockCipherPadding = interface(IInterface)
['{BF2886A5-1020-4270-B8E5-3BA9FDB9DA56}']
/// <summary>
/// Initialise the padder.
/// </summary>
/// <param name="random">
/// param parameters, if any required.
/// </param>
procedure Init(const random: ISecureRandom);
/// <returns>
/// return the name of the algorithm the cipher implements.
/// </returns>
function GetPaddingName: String;
/// <summary>
/// Return the name of the algorithm the cipher implements.
/// </summary>
property PaddingName: String read GetPaddingName;
/// <summary>
/// add the pad bytes to the passed in block, returning the number of
/// bytes added.
/// </summary>
/// <param name="input">
/// input block to pad
/// </param>
/// <param name="inOff">
/// offset to start the padding from in the block
/// </param>
/// <returns>
/// returns number of bytes added
/// </returns>
function AddPadding(const input: TCryptoLibByteArray; inOff: Int32): Int32;
/// <summary>
/// return the number of pad bytes present in the block.
/// </summary>
/// <param name="input">
/// block to count pad bytes in
/// </param>
/// <returns>
/// the number of pad bytes present in the block.
/// </returns>
/// <exception cref="EInvalidCipherTextCryptoLibException">
/// if the padding is badly formed or invalid.
/// </exception>
function PadCount(const input: TCryptoLibByteArray): Int32;
end;
implementation
end.
| 33.329412 | 88 | 0.499118 |
83afca01df23269fdfefa8fc23421b50b5f70c93 | 1,890 | pas | Pascal | src/afuxml/uxmldtd.pas | Arteev/afudf | d669397901fb8b3c3d428dc9cf02596169e3752a | [
"MIT"
]
| null | null | null | src/afuxml/uxmldtd.pas | Arteev/afudf | d669397901fb8b3c3d428dc9cf02596169e3752a | [
"MIT"
]
| null | null | null | src/afuxml/uxmldtd.pas | Arteev/afudf | d669397901fb8b3c3d428dc9cf02596169e3752a | [
"MIT"
]
| 1 | 2021-03-10T10:27:29.000Z | 2021-03-10T10:27:29.000Z | {
This file is part of the AF UDF library for Firebird 1.0 or high.
Copyright (c) 2007-2009 by Arteev Alexei, OAO Pharmacy Tyumen.
See the file COPYING.TXT, 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.
email: alarteev@yandex.ru, arteev@pharm-tmn.ru, support@pharm-tmn.ru
**********************************************************************}
unit uxmldtd;
{$mode objfpc}
{$H+}
interface
uses
Classes, SysUtils, DOM,XMLRead;
Type
{ TXmlDTD }
TXmlDTD = class
private
FWasError : Boolean;
FTextError : String;
procedure ErrorHandler(E: EXMLReadError);
public
function CreateXmlDocFromStreamDTD(AStream:TStream; Out XmlDoc:TXMLDocument;
Out Error: string):Boolean;
end;
implementation
{ TXmlDTD }
procedure TXmlDTD.ErrorHandler(E: EXMLReadError);
begin
if E.Severity = esError then
begin
FWasError:=true;
if FTextError<>'' then
FTextError:=FTextError+LineEnding
else
FTextError:='ERROR:';
FTextError:=FTextError+E.Message;
end;
end;
function TXmlDTD.CreateXmlDocFromStreamDTD(AStream: TStream; out
XmlDoc: TXMLDocument; out Error: string): Boolean;
var
Parser: TDOMParser;
Src: TXMLInputSource;
begin
Parser := TDOMParser.Create;
FWasError:=false;
FTextError:='';
try
Src := TXMLInputSource.Create(AStream);
Parser.Options.Validate := True;
Parser.OnError := @ErrorHandler;
Parser.Parse(Src, XmlDoc);
if FWasError then
begin
Error:= FTextError;
if XmlDoc<> nil then
XmlDoc.Free;
exit(false);
end;
Error := '';
exit(true);
finally
if Assigned(Src) then
Src.Free;
Parser.Free;
end;
end;
end.
| 21.235955 | 80 | 0.666138 |
83c910f9efa60443a2883f4c6ab8b2c56529ec47 | 1,139 | pas | Pascal | sources/normali/18.pas | prgpascal/programmi-pascal | fd71bd671d0d6be169b47c5bfa40f9b97588196f | [
"Apache-2.0"
]
| null | null | null | sources/normali/18.pas | prgpascal/programmi-pascal | fd71bd671d0d6be169b47c5bfa40f9b97588196f | [
"Apache-2.0"
]
| null | null | null | sources/normali/18.pas | prgpascal/programmi-pascal | fd71bd671d0d6be169b47c5bfa40f9b97588196f | [
"Apache-2.0"
]
| null | null | null | (*
* Copyright (C) 2008 Riccardo Leschiutta
*
* 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.
*)
(*Esercizio 18*)
PROGRAM equaz_retta;
VAR
xp1:real;
xp2:real;
yp1:real;
yp2:real;
n:real;
q:real;
risp:char;
BEGIN
repeat
writeln('Inserire le coordinate del primo punto: ');
write('x: ');
readln(xp1);
write('y: ');
readln(yp1);
writeln('Inserire le coordinate del secondo punto: ');
write('x: ');
readln(xp2);
write('y: ');
readln(yp2);
n:=(yp2-yp1)/(xp2-xp1);
q:=yp1-(n*xp1);
writeln('La "m" calcolata e'': ',n:7:2);
writeln('La "q" calcolata e'': ',q:7:2);
write('Vuoi continuare(s/n)?: ');
readln(risp)
until risp='n'
end.
| 24.234043 | 75 | 0.693591 |
f1277de39e5d2813e31c629e8c6cf22a966c31b0 | 738 | pas | Pascal | RDTPSpamPacketHelpers.pas | randydom/commonx | 2315f1acf41167bd77ba4d040b3f5b15a5c5b81a | [
"MIT"
]
| 48 | 2018-11-19T22:13:00.000Z | 2021-11-02T17:25:41.000Z | RDTPSpamPacketHelpers.pas | jpluimers/commonx | c49e51b4edcc61b2b51e78590a5168d574b66282 | [
"MIT"
]
| 6 | 2018-11-24T17:15:29.000Z | 2019-05-15T14:59:56.000Z | RDTPSpamPacketHelpers.pas | jpluimers/commonx | c49e51b4edcc61b2b51e78590a5168d574b66282 | [
"MIT"
]
| 12 | 2018-11-20T15:15:44.000Z | 2021-09-14T10:12:43.000Z | unit RDTPSpamPacketHelpers;
interface
uses packet;
type
TSpamActions = integer;
const
saHandled = 1;
saMark = 2;
saBlacklist = 4;
saDivert = 8;
saDelete = 16;
const
saGeorgeBush = saDivert+saMark+saBlacklist+saDelete;
saCritical = saDivert+saMark+saBlacklist;
saModerate = saMark;
procedure WriteTSpamActionsToPacket(packet: TRDTPPacket; act: TSpamActions);
procedure ReadTSpamACtionsFromPAcket(Packet: TRDTPPacket; out act: TSpamACtions);
implementation
procedure WriteTSpamActionsToPacket(packet: TRDTPPacket; act: TSpamActions);
var
c: cardinal;
begin
packet.Addlong(act);
end;
procedure ReadTSpamACtionsFromPAcket(Packet: TRDTPPacket; out act: TSpamACtions);
begin
act := packet.SeqRead;
end;
end.
| 17.571429 | 81 | 0.772358 |
61d547dad99a248820440da1a968899782a75284 | 101,610 | pas | Pascal | source/uWVBrowserBase.pas | flexifi/WebView4Delphi | 6a0169aa0e8c0280f93ec7f874abe95e38dd9e5a | [
"MIT"
]
| 1 | 2021-12-04T09:32:36.000Z | 2021-12-04T09:32:36.000Z | source/uWVBrowserBase.pas | flexifi/WebView4Delphi | 6a0169aa0e8c0280f93ec7f874abe95e38dd9e5a | [
"MIT"
]
| null | null | null | source/uWVBrowserBase.pas | flexifi/WebView4Delphi | 6a0169aa0e8c0280f93ec7f874abe95e38dd9e5a | [
"MIT"
]
| null | null | null | unit uWVBrowserBase;
{$IFDEF FPC}{$MODE Delphi}{$ENDIF}
interface
uses
{$IFDEF FPC}
Windows, Classes, Types, SysUtils, Graphics, ActiveX,
{$ELSE}
Winapi.Windows, System.Classes, System.Types, System.UITypes, System.SysUtils, Winapi.ActiveX,
{$ENDIF}
uWVTypes, uWVConstants, uWVTypeLibrary, uWVLibFunctions, uWVLoader,
uWVInterfaces, uWVEvents, uWVCoreWebView2, uWVCoreWebView2Settings,
uWVCoreWebView2Environment, uWVCoreWebView2Controller,
uWVCoreWebView2PrintSettings, uWVCoreWebView2CompositionController,
uWVCoreWebView2CookieManager;
type
TWVBrowserBase = class(TComponent, IWVBrowserEvents)
protected
FCoreWebView2PrintSettings : TCoreWebView2PrintSettings;
FCoreWebView2Settings : TCoreWebView2Settings;
FCoreWebView2Environment : TCoreWebView2Environment;
FCoreWebView2Controller : TCoreWebView2Controller;
FCoreWebView2CompositionController : TCoreWebView2CompositionController;
FCoreWebView2 : TCoreWebView2;
FWindowParentHandle : THandle;
FUseDefaultEnvironment : boolean;
FUseCompositionController : boolean;
FDefaultURL : wvstring;
FBrowserExecPath : wvstring;
FUserDataFolder : wvstring;
FAdditionalBrowserArguments : wvstring;
FLanguage : wvstring;
FTargetCompatibleBrowserVersion : wvstring;
FAllowSingleSignOnUsingOSPrimaryAccount : boolean;
FIgnoreCertificateErrors : boolean;
FZoomStep : byte;
FOffline : boolean;
FOnInitializationError : TOnInitializationErrorEvent;
FOnEnvironmentCompleted : TNotifyEvent;
FOnControllerCompleted : TNotifyEvent;
FOnAfterCreated : TNotifyEvent;
FOnExecuteScriptCompleted : TOnExecuteScriptCompletedEvent;
FOnCapturePreviewCompleted : TOnCapturePreviewCompletedEvent;
FOnNavigationStarting : TOnNavigationStartingEvent;
FOnNavigationCompleted : TOnNavigationCompletedEvent;
FOnFrameNavigationStarting : TOnNavigationStartingEvent;
FOnFrameNavigationCompleted : TOnNavigationCompletedEvent;
FOnSourceChanged : TOnSourceChangedEvent;
FOnHistoryChanged : TNotifyEvent;
FOnContentLoading : TOnContentLoadingEvent;
FOnDocumentTitleChanged : TNotifyEvent;
FOnNewWindowRequested : TOnNewWindowRequestedEvent;
FOnWebResourceRequested : TOnWebResourceRequestedEvent;
FOnScriptDialogOpening : TOnScriptDialogOpeningEvent;
FOnPermissionRequested : TOnPermissionRequestedEvent;
FOnProcessFailed : TOnProcessFailedEvent;
FOnWebMessageReceived : TOnWebMessageReceivedEvent;
FOnContainsFullScreenElementChanged : TNotifyEvent;
FOnWindowCloseRequested : TNotifyEvent;
FOnDevToolsProtocolEventReceived : TOnDevToolsProtocolEventReceivedEvent;
FOnZoomFactorChanged : TNotifyEvent;
FOnMoveFocusRequested : TOnMoveFocusRequestedEvent;
FOnAcceleratorKeyPressed : TOnAcceleratorKeyPressedEvent;
FOnGotFocus : TNotifyEvent;
FOnLostFocus : TNotifyEvent;
FOnCursorChanged : TNotifyEvent;
FOnBrowserProcessExited : TOnBrowserProcessExitedEvent;
FOnRasterizationScaleChanged : TNotifyEvent;
FOnWebResourceResponseReceived : TOnWebResourceResponseReceivedEvent;
FOnDOMContentLoaded : TOnDOMContentLoadedEvent;
FOnWebResourceResponseViewGetContentCompleted : TOnWebResourceResponseViewGetContentCompletedEvent;
FOnGetCookiesCompleted : TOnGetCookiesCompletedEvent;
FOnTrySuspendCompleted : TOnTrySuspendCompletedEvent;
FOnFrameCreated : TOnFrameCreatedEvent;
FOnDownloadStarting : TOnDownloadStartingEvent;
FOnClientCertificateRequested : TOnClientCertificateRequestedEvent;
FOnPrintToPdfCompleted : TOnPrintToPdfCompletedEvent;
FOnBytesReceivedChanged : TOnBytesReceivedChangedEvent;
FOnEstimatedEndTimeChanged : TOnEstimatedEndTimeChangedEvent;
FOnDownloadStateChanged : TOnDownloadStateChangedEvent;
FOnFrameNameChanged : TOnFrameNameChangedEvent;
FOnFrameDestroyed : TOnFrameDestroyedEvent;
FOnCompositionControllerCompleted : TNotifyEvent;
FOnCallDevToolsProtocolMethodCompleted : TOnCallDevToolsProtocolMethodCompletedEvent;
FOnAddScriptToExecuteOnDocumentCreatedCompleted : TOnAddScriptToExecuteOnDocumentCreatedCompletedEvent;
function GetBrowserProcessID : cardinal;
function GetBrowserVersionInfo : wvstring;
function GetCanGoBack : boolean;
function GetCanGoForward : boolean;
function GetContainsFullScreenElement : boolean;
function GetDocumentTitle : wvstring;
function GetSource : wvstring;
function GetCookieManager : ICoreWebView2CookieManager;
function GetInitialized : boolean;
function GetZoomFactor : double;
function GetZoomPct : double;
function GetBuiltInErrorPageEnabled : boolean;
function GetDefaultContextMenusEnabled : boolean;
function GetDefaultScriptDialogsEnabled : boolean;
function GetDevToolsEnabled : boolean;
function GetScriptEnabled : boolean;
function GetStatusBarEnabled : boolean;
function GetWebMessageEnabled : boolean;
function GetZoomControlEnabled : boolean;
function GetIsVisible : boolean;
function GetBounds : TRect;
function GetParentWindow : THandle;
function GetDefaultBackgroundColor : TColor;
function GetRasterizationScale : double;
function GetShouldDetectMonitorScaleChanges : boolean;
function GetBoundsMode : TWVBoundsMode;
function GetAreHostObjectsAllowed : boolean;
function GetUserAgent : wvstring;
function GetAreBrowserAcceleratorKeysEnabled : boolean;
function GetIsPasswordAutosaveEnabled : boolean;
function GetIsGeneralAutofillEnabled : boolean;
function GetIsPinchZoomEnabled : boolean;
function GetIsSwipeNavigationEnabled : boolean;
function GetIsSuspended: boolean;
function GetUserDataFolder: wvstring;
procedure SetBuiltInErrorPageEnabled(const Value: boolean);
procedure SetDefaultContextMenusEnabled(const Value: boolean);
procedure SetDefaultScriptDialogsEnabled(const Value: boolean);
procedure SetDevToolsEnabled(const Value: boolean);
procedure SetScriptEnabled(const Value: boolean);
procedure SetStatusBarEnabled(const Value: boolean);
procedure SetWebMessageEnabled(const Value: boolean);
procedure SetZoomControlEnabled(const Value: boolean);
procedure SetZoomFactor(const Value: Double);
procedure SetZoomPct(const aValue : double);
procedure SetZoomStep(aValue : byte);
procedure SetIsVisible(const aValue : boolean);
procedure SetBounds(aValue : TRect);
procedure SetParentWindow(aValue : THandle);
procedure SetDefaultBackgroundColor(const aValue : TColor);
procedure SetRasterizationScale(const aValue : double);
procedure SetShouldDetectMonitorScaleChanges(aValue : boolean);
procedure SetBoundsMode(aValue : TWVBoundsMode);
procedure SetAreHostObjectsAllowed(aValue : boolean);
procedure SetUserAgent(const aValue : wvstring);
procedure SetAreBrowserAcceleratorKeysEnabled(aValue : boolean);
procedure SetIsPasswordAutosaveEnabled(aValue : boolean);
procedure SetIsGeneralAutofillEnabled(aValue : boolean);
procedure SetIsPinchZoomEnabled(aValue : boolean);
procedure SetIsSwipeNavigationEnabled(aValue : boolean);
procedure SetOffline(aValue : boolean);
procedure SetIgnoreCertificateErrors(aValue : boolean);
function CreateEnvironment : boolean;
procedure DestroyEnvironment;
procedure DestroyController;
procedure DestroyCompositionController;
procedure DestroyWebView;
procedure DestroySettings;
procedure DestroyPrintSettings;
procedure UpdateZoomStep(aInc : boolean);
procedure UpdateZoomPct(const aValue : double);
function EnvironmentCompletedHandler_Invoke(errorCode: HRESULT; const createdEnvironment: ICoreWebView2Environment): HRESULT;
function ControllerCompletedHandler_Invoke(errorCode: HRESULT; const createdController: ICoreWebView2Controller): HRESULT;
function ExecuteScriptCompletedHandler_Invoke(errorCode: HRESULT; resultObjectAsJson: PWideChar; aExecutionID : integer): HRESULT;
function CapturePreviewCompletedHandler_Invoke(errorCode: HRESULT): HRESULT;
function NavigationStartingEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2NavigationStartingEventArgs): HRESULT;
function NavigationCompletedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2NavigationCompletedEventArgs): HRESULT;
function FrameNavigationStartingEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2NavigationStartingEventArgs): HRESULT;
function FrameNavigationCompletedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2NavigationCompletedEventArgs): HRESULT;
function SourceChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2SourceChangedEventArgs): HRESULT;
function HistoryChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT;
function ContentLoadingEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2ContentLoadingEventArgs): HRESULT;
function DocumentTitleChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT;
function NewWindowRequestedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2NewWindowRequestedEventArgs): HRESULT;
function WebResourceRequestedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2WebResourceRequestedEventArgs): HRESULT;
function ScriptDialogOpeningEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2ScriptDialogOpeningEventArgs): HRESULT;
function PermissionRequestedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2PermissionRequestedEventArgs): HRESULT;
function ProcessFailedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2ProcessFailedEventArgs): HRESULT;
function WebMessageReceivedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2WebMessageReceivedEventArgs): HRESULT;
function ContainsFullScreenElementChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT;
function WindowCloseRequestedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT;
function DevToolsProtocolEventReceivedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2DevToolsProtocolEventReceivedEventArgs; const aEventName : wvstring; aEventID : integer): HRESULT;
function ZoomFactorChangedEventHandler_Invoke(const sender: ICoreWebView2Controller; const args: IUnknown): HRESULT;
function MoveFocusRequestedEventHandler_Invoke(const sender: ICoreWebView2Controller; const args: ICoreWebView2MoveFocusRequestedEventArgs): HRESULT;
function AcceleratorKeyPressedEventHandler_Invoke(const sender: ICoreWebView2Controller; const args: ICoreWebView2AcceleratorKeyPressedEventArgs): HRESULT;
function GotFocusEventHandler_Invoke(const sender: ICoreWebView2Controller; const args: IUnknown): HRESULT;
function LostFocusEventHandler_Invoke(const sender: ICoreWebView2Controller; const args: IUnknown): HRESULT;
function CreateCoreWebView2CompositionControllerCompletedHandler_Invoke(errorCode: HResult; const webView: ICoreWebView2CompositionController): HRESULT;
function CursorChangedEventHandler_Invoke(const sender: ICoreWebView2CompositionController; const args: IUnknown): HRESULT;
function BrowserProcessExitedEventHandler_Invoke(const sender: ICoreWebView2Environment; const args: ICoreWebView2BrowserProcessExitedEventArgs): HRESULT;
function RasterizationScaleChangedEventHandler_Invoke(const sender: ICoreWebView2Controller; const args: IUnknown): HRESULT;
function WebResourceResponseReceivedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2WebResourceResponseReceivedEventArgs): HRESULT;
function DOMContentLoadedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2DOMContentLoadedEventArgs): HRESULT;
function WebResourceResponseViewGetContentCompletedHandler_Invoke(errorCode: HResult; const Content: IStream): HRESULT;
function GetCookiesCompletedHandler_Invoke(aResult : HResult; const aCookieList : ICoreWebView2CookieList): HRESULT;
function TrySuspendCompletedHandler_Invoke(errorCode: HResult; isSuccessful: Integer): HRESULT;
function FrameCreatedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2FrameCreatedEventArgs): HRESULT;
function DownloadStartingEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2DownloadStartingEventArgs): HRESULT;
function ClientCertificateRequestedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2ClientCertificateRequestedEventArgs): HRESULT;
function PrintToPdfCompletedHandler_Invoke(errorCode: HResult; isSuccessful: Integer): HRESULT;
function BytesReceivedChangedEventHandler_Invoke(const sender: ICoreWebView2DownloadOperation; const args: IUnknown; aDownloadID : integer): HRESULT;
function EstimatedEndTimeChangedEventHandler_Invoke(const sender: ICoreWebView2DownloadOperation; const args: IUnknown; aDownloadID : integer): HRESULT;
function StateChangedEventHandler_Invoke(const sender: ICoreWebView2DownloadOperation; const args: IUnknown; aDownloadID : integer): HRESULT;
function FrameNameChangedEventHandler_Invoke(const sender: ICoreWebView2Frame; const args: IUnknown; aFrameID : integer): HRESULT;
function FrameDestroyedEventHandler_Invoke(const sender: ICoreWebView2Frame; const args: IUnknown; aFrameID : integer): HRESULT;
function CallDevToolsProtocolMethodCompletedHandler_Invoke(errorCode: HResult; returnObjectAsJson: PWideChar; aExecutionID : integer): HRESULT;
function AddScriptToExecuteOnDocumentCreatedCompletedHandler_Invoke(errorCode: HResult; id: PWideChar): HRESULT;
procedure doOnInitializationError(aErrorCode: HRESULT; const aErrorMessage: wvstring); virtual;
procedure doOnEnvironmentCompleted; virtual;
procedure doOnControllerCompleted; virtual;
procedure doOnAfterCreated; virtual;
procedure doOnExecuteScriptCompleted(aErrorCode: HRESULT; const aResultObjectAsJson: wvstring; aExecutionID : integer); virtual;
procedure doCapturePreviewCompleted(aErrorCode: HRESULT); virtual;
procedure doOnNavigationStarting(const sender: ICoreWebView2; const args: ICoreWebView2NavigationStartingEventArgs); virtual;
procedure doOnNavigationCompleted(const sender: ICoreWebView2; const args: ICoreWebView2NavigationCompletedEventArgs); virtual;
procedure doOnFrameNavigationStarting(const sender: ICoreWebView2; const args: ICoreWebView2NavigationStartingEventArgs); virtual;
procedure doOnFrameNavigationCompleted(const sender: ICoreWebView2; const args: ICoreWebView2NavigationCompletedEventArgs); virtual;
procedure doOnSourceChanged(const sender: ICoreWebView2; const args: ICoreWebView2SourceChangedEventArgs); virtual;
procedure doOnHistoryChanged(const sender: ICoreWebView2); virtual;
procedure doOnContentLoading(const sender: ICoreWebView2; const args: ICoreWebView2ContentLoadingEventArgs); virtual;
procedure doOnDocumentTitleChanged(const sender: ICoreWebView2); virtual;
procedure doOnNewWindowRequested(const sender: ICoreWebView2; const args: ICoreWebView2NewWindowRequestedEventArgs); virtual;
procedure doOnWebResourceRequested(const sender: ICoreWebView2; const args: ICoreWebView2WebResourceRequestedEventArgs); virtual;
procedure doOnScriptDialogOpening(const sender: ICoreWebView2; const args: ICoreWebView2ScriptDialogOpeningEventArgs); virtual;
procedure doOnPermissionRequested(const sender: ICoreWebView2; const args: ICoreWebView2PermissionRequestedEventArgs); virtual;
procedure doOnProcessFailed(const sender: ICoreWebView2; const args: ICoreWebView2ProcessFailedEventArgs); virtual;
procedure doOnWebMessageReceived(const sender: ICoreWebView2; const args: ICoreWebView2WebMessageReceivedEventArgs); virtual;
procedure doOnContainsFullScreenElementChanged(const sender: ICoreWebView2); virtual;
procedure doOnWindowCloseRequested(const sender: ICoreWebView2); virtual;
procedure doOnDevToolsProtocolEventReceived(const sender: ICoreWebView2; const args: ICoreWebView2DevToolsProtocolEventReceivedEventArgs; const aEventName : wvstring; aEventID : integer); virtual;
procedure doOnZoomFactorChanged(const sender: ICoreWebView2Controller); virtual;
procedure doOnMoveFocusRequested(const sender: ICoreWebView2Controller; const args: ICoreWebView2MoveFocusRequestedEventArgs); virtual;
procedure doOnAcceleratorKeyPressed(const sender: ICoreWebView2Controller; const args: ICoreWebView2AcceleratorKeyPressedEventArgs); virtual;
procedure doOnGotFocus(const sender: ICoreWebView2Controller); virtual;
procedure doOnLostFocus(const sender: ICoreWebView2Controller); virtual;
procedure doOnCompositionControllerCompleted; virtual;
procedure doOnCursorChangedEvent(const sender: ICoreWebView2CompositionController); virtual;
procedure doOnBrowserProcessExitedEvent(const sender: ICoreWebView2Environment; const args: ICoreWebView2BrowserProcessExitedEventArgs); virtual;
procedure doOnRasterizationScaleChangedEvent(const sender: ICoreWebView2Controller); virtual;
procedure doOnWebResourceResponseReceivedEvent(const sender: ICoreWebView2; const args: ICoreWebView2WebResourceResponseReceivedEventArgs); virtual;
procedure doOnDOMContentLoadedEvent(const sender: ICoreWebView2; const args: ICoreWebView2DOMContentLoadedEventArgs); virtual;
procedure doOnWebResourceResponseViewGetContentCompletedEvent(errorCode: HResult; const Content: IStream); virtual;
procedure doOnGetCookiesCompletedEvent(aResult : HResult; const aCookieList : ICoreWebView2CookieList); virtual;
procedure doOnTrySuspendCompletedEvent(errorCode: HResult; isSuccessful: Integer); virtual;
procedure doOnFrameCreatedEvent(const sender: ICoreWebView2; const args: ICoreWebView2FrameCreatedEventArgs); virtual;
procedure doOnDownloadStartingEvent(const sender: ICoreWebView2; const args: ICoreWebView2DownloadStartingEventArgs); virtual;
procedure doOnClientCertificateRequestedEvent(const sender: ICoreWebView2; const args: ICoreWebView2ClientCertificateRequestedEventArgs); virtual;
procedure doOnPrintToPdfCompletedEvent(errorCode: HResult; isSuccessful: Integer); virtual;
procedure doOnBytesReceivedChangedEventEvent(const sender: ICoreWebView2DownloadOperation; const args: IUnknown; aDownloadID : integer); virtual;
procedure doOnEstimatedEndTimeChangedEvent(const sender: ICoreWebView2DownloadOperation; const args: IUnknown; aDownloadID : integer); virtual;
procedure doOnStateChangedEvent(const sender: ICoreWebView2DownloadOperation; const args: IUnknown; aDownloadID : integer); virtual;
procedure doOnFrameNameChangedEvent(const sender: ICoreWebView2Frame; const args: IUnknown; aFrameID : integer); virtual;
procedure doOnFrameDestroyedEvent(const sender: ICoreWebView2Frame; const args: IUnknown; aFrameID : integer); virtual;
procedure doOnCallDevToolsProtocolMethodCompletedEvent(aErrorCode: HRESULT; const aReturnObjectAsJson: wvstring; aExecutionID : integer); virtual;
procedure doOnAddScriptToExecuteOnDocumentCreatedCompletedEvent(aErrorCode: HRESULT; const aID : wvstring); virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function CreateBrowser(aHandle : THandle; aUseDefaultEnvironment : boolean = True) : boolean; overload;
function CreateBrowser(aHandle : THandle; const aEnvironment : ICoreWebView2Environment) : boolean; overload;
function CreateWindowlessBrowser(aHandle : THandle; aUseDefaultEnvironment : boolean = True) : boolean; overload;
function CreateWindowlessBrowser(aHandle : THandle; const aEnvironment : ICoreWebView2Environment) : boolean; overload;
function GoBack : boolean;
function GoForward : boolean;
function Refresh : boolean;
function Stop : boolean;
function Navigate(const aURI : wvstring) : boolean;
function NavigateToString(const aHTMLContent: wvstring) : boolean;
function NavigateWithWebResourceRequest(const aRequest : ICoreWebView2WebResourceRequest) : boolean;
function SubscribeToDevToolsProtocolEvent(const aEventName : wvstring; aEventID : integer = 0) : boolean;
function CallDevToolsProtocolMethod(const aMethodName, aParametersAsJson : wvstring; aExecutionID : integer = 0) : boolean;
function SetFocus : boolean;
function FocusNext : boolean;
function FocusPrevious : boolean;
function ExecuteScript(const aJavaScript : wvstring; aExecutionID : integer = 0) : boolean;
function CapturePreview(aImageFormat: TWVCapturePreviewImageFormat; const aImageStream: IStream) : boolean;
function NotifyParentWindowPositionChanged : boolean;
function TrySuspend : boolean;
function Resume : boolean;
function SetVirtualHostNameToFolderMapping(const aHostName, aFolderPath : wvstring; aAccessKind : TWVHostResourceAcccessKind): boolean;
function ClearVirtualHostNameToFolderMapping(const aHostName : wvstring) : boolean;
function Print : boolean;
function PrintToPdf(const aResultFilePath : wvstring) : boolean;
function OpenDevToolsWindow : boolean;
function OpenTaskManagerWindow : boolean;
function PostWebMessageAsJson(const aWebMessageAsJson : wvstring) : boolean;
function PostWebMessageAsString(const aWebMessageAsString : wvstring) : boolean;
function AddWebResourceRequestedFilter(const aURI: wvstring; aResourceContext: TWVWebResourceContext) : boolean;
function RemoveWebResourceRequestedFilter(const aURI: wvstring; aResourceContext: TWVWebResourceContext) : boolean;
function AddHostObjectToScript(const aName : wvstring; const aObject : OleVariant): boolean;
function RemoveHostObjectFromScript(const aName : wvstring) : boolean;
function AddScriptToExecuteOnDocumentCreated(const JavaScript : wvstring) : boolean;
function RemoveScriptToExecuteOnDocumentCreated(const aID : wvstring) : boolean;
function CreateCookie(const aName, aValue, aDomain, aPath : wvstring) : ICoreWebView2Cookie;
function CopyCookie(const aCookie : ICoreWebView2Cookie) : ICoreWebView2Cookie;
function GetCookies(const aURI : wvstring = ''): boolean;
function AddOrUpdateCookie(const aCookie : ICoreWebView2Cookie): boolean;
function DeleteCookie(const aCookie : ICoreWebView2Cookie): boolean;
function DeleteCookies(const aName, aURI : wvstring): boolean;
function DeleteCookiesWithDomainAndPath(const aName, aDomain, aPath : wvstring): boolean;
function DeleteAllCookies : boolean;
function ClearCache : boolean;
function ClearDataForOrigin(const aOrigin : wvstring; aStorageTypes : TWVClearDataStorageTypes = cdstAll) : boolean;
procedure MoveFormTo(const x, y: Integer); virtual; abstract;
procedure MoveFormBy(const x, y: Integer); virtual; abstract;
procedure ResizeFormWidthTo(const x : Integer); virtual; abstract;
procedure ResizeFormHeightTo(const y : Integer); virtual; abstract;
procedure SetFormLeftTo(const x : Integer); virtual; abstract;
procedure SetFormTopTo(const y : Integer); virtual; abstract;
procedure IncZoomStep;
procedure DecZoomStep;
procedure ResetZoom;
function SetBoundsAndZoomFactor(aBounds: TRect; const aZoomFactor: double) : boolean;
property Initialized : boolean read GetInitialized;
property CoreWebView2PrintSettings : TCoreWebView2PrintSettings read FCoreWebView2PrintSettings;
property CoreWebView2Settings : TCoreWebView2Settings read FCoreWebView2Settings;
property CoreWebView2Environment : TCoreWebView2Environment read FCoreWebView2Environment;
property CoreWebView2Controller : TCoreWebView2Controller read FCoreWebView2Controller;
property CoreWebView2CompositionController : TCoreWebView2CompositionController read FCoreWebView2CompositionController;
property CoreWebView2 : TCoreWebView2 read FCoreWebView2;
property BrowserVersionInfo : wvstring read GetBrowserVersionInfo;
property BrowserProcessID : cardinal read GetBrowserProcessID;
property CanGoBack : boolean read GetCanGoBack;
property CanGoForward : boolean read GetCanGoForward;
property ContainsFullScreenElement : boolean read GetContainsFullScreenElement;
property DocumentTitle : wvstring read GetDocumentTitle;
property Source : wvstring read GetSource;
property CookieManager : ICoreWebView2CookieManager read GetCookieManager;
property ZoomFactor : double read GetZoomFactor write SetZoomFactor;
property ZoomPct : double read GetZoomPct write SetZoomPct;
property ZoomStep : byte read FZoomStep write SetZoomStep;
property Offline : boolean read FOffline write SetOffline;
property IsVisible : boolean read GetIsVisible write SetIsVisible;
property BuiltInErrorPageEnabled : boolean read GetBuiltInErrorPageEnabled write SetBuiltInErrorPageEnabled;
property DefaultContextMenusEnabled : boolean read GetDefaultContextMenusEnabled write SetDefaultContextMenusEnabled;
property DefaultScriptDialogsEnabled : boolean read GetDefaultScriptDialogsEnabled write SetDefaultScriptDialogsEnabled;
property DevToolsEnabled : boolean read GetDevToolsEnabled write SetDevToolsEnabled;
property ScriptEnabled : boolean read GetScriptEnabled write SetScriptEnabled;
property StatusBarEnabled : boolean read GetStatusBarEnabled write SetStatusBarEnabled;
property WebMessageEnabled : boolean read GetWebMessageEnabled write SetWebMessageEnabled;
property ZoomControlEnabled : boolean read GetZoomControlEnabled write SetZoomControlEnabled;
property AreHostObjectsAllowed : boolean read GetAreHostObjectsAllowed write SetAreHostObjectsAllowed;
property UserAgent : wvstring read GetUserAgent write SetUserAgent;
property AreBrowserAcceleratorKeysEnabled : boolean read GetAreBrowserAcceleratorKeysEnabled write SetAreBrowserAcceleratorKeysEnabled;
property IsPasswordAutosaveEnabled : boolean read GetIsPasswordAutosaveEnabled write SetIsPasswordAutosaveEnabled;
property IsGeneralAutofillEnabled : boolean read GetIsGeneralAutofillEnabled write SetIsGeneralAutofillEnabled;
property IsPinchZoomEnabled : boolean read GetIsPinchZoomEnabled write SetIsPinchZoomEnabled;
property IsSwipeNavigationEnabled : boolean read GetIsSwipeNavigationEnabled write SetIsSwipeNavigationEnabled;
property Bounds : TRect read GetBounds write SetBounds;
property ParentWindow : THandle read GetParentWindow write SetParentWindow;
property DefaultBackgroundColor : TColor read GetDefaultBackgroundColor write SetDefaultBackgroundColor;
property RasterizationScale : double read GetRasterizationScale write SetRasterizationScale;
property ShouldDetectMonitorScaleChanges : boolean read GetShouldDetectMonitorScaleChanges write SetShouldDetectMonitorScaleChanges;
property BoundsMode : TWVBoundsMode read GetBoundsMode write SetBoundsMode;
property BrowserExecPath : wvstring read FBrowserExecPath write FBrowserExecPath;
property UserDataFolder : wvstring read GetUserDataFolder write FUserDataFolder;
property DefaultURL : wvstring read FDefaultURL write FDefaultURL;
property AdditionalBrowserArguments : wvstring read FAdditionalBrowserArguments write FAdditionalBrowserArguments;
property Language : wvstring read FLanguage write FLanguage;
property TargetCompatibleBrowserVersion : wvstring read FTargetCompatibleBrowserVersion write FTargetCompatibleBrowserVersion;
property AllowSingleSignOnUsingOSPrimaryAccount : boolean read FAllowSingleSignOnUsingOSPrimaryAccount write FAllowSingleSignOnUsingOSPrimaryAccount;
property IsSuspended : boolean read GetIsSuspended;
property IgnoreCertificateErrors : boolean read FIgnoreCertificateErrors write SetIgnoreCertificateErrors;
property OnInitializationError : TOnInitializationErrorEvent read FOnInitializationError write FOnInitializationError;
property OnEnvironmentCompleted : TNotifyEvent read FOnEnvironmentCompleted write FOnEnvironmentCompleted;
property OnControllerCompleted : TNotifyEvent read FOnControllerCompleted write FOnControllerCompleted;
property OnAfterCreated : TNotifyEvent read FOnAfterCreated write FOnAfterCreated;
property OnExecuteScriptCompleted : TOnExecuteScriptCompletedEvent read FOnExecuteScriptCompleted write FOnExecuteScriptCompleted;
property OnCapturePreviewCompleted : TOnCapturePreviewCompletedEvent read FOnCapturePreviewCompleted write FOnCapturePreviewCompleted;
property OnNavigationStarting : TOnNavigationStartingEvent read FOnNavigationStarting write FOnNavigationStarting;
property OnNavigationCompleted : TOnNavigationCompletedEvent read FOnNavigationCompleted write FOnNavigationCompleted;
property OnFrameNavigationStarting : TOnNavigationStartingEvent read FOnFrameNavigationStarting write FOnFrameNavigationStarting;
property OnFrameNavigationCompleted : TOnNavigationCompletedEvent read FOnFrameNavigationCompleted write FOnFrameNavigationCompleted;
property OnSourceChanged : TOnSourceChangedEvent read FOnSourceChanged write FOnSourceChanged;
property OnHistoryChanged : TNotifyEvent read FOnHistoryChanged write FOnHistoryChanged;
property OnContentLoading : TOnContentLoadingEvent read FOnContentLoading write FOnContentLoading;
property OnDocumentTitleChanged : TNotifyEvent read FOnDocumentTitleChanged write FOnDocumentTitleChanged;
property OnNewWindowRequested : TOnNewWindowRequestedEvent read FOnNewWindowRequested write FOnNewWindowRequested;
property OnWebResourceRequested : TOnWebResourceRequestedEvent read FOnWebResourceRequested write FOnWebResourceRequested;
property OnScriptDialogOpening : TOnScriptDialogOpeningEvent read FOnScriptDialogOpening write FOnScriptDialogOpening;
property OnPermissionRequested : TOnPermissionRequestedEvent read FOnPermissionRequested write FOnPermissionRequested;
property OnProcessFailed : TOnProcessFailedEvent read FOnProcessFailed write FOnProcessFailed;
property OnWebMessageReceived : TOnWebMessageReceivedEvent read FOnWebMessageReceived write FOnWebMessageReceived;
property OnContainsFullScreenElementChanged : TNotifyEvent read FOnContainsFullScreenElementChanged write FOnContainsFullScreenElementChanged;
property OnWindowCloseRequested : TNotifyEvent read FOnWindowCloseRequested write FOnWindowCloseRequested;
property OnDevToolsProtocolEventReceived : TOnDevToolsProtocolEventReceivedEvent read FOnDevToolsProtocolEventReceived write FOnDevToolsProtocolEventReceived;
property OnZoomFactorChanged : TNotifyEvent read FOnZoomFactorChanged write FOnZoomFactorChanged;
property OnMoveFocusRequested : TOnMoveFocusRequestedEvent read FOnMoveFocusRequested write FOnMoveFocusRequested;
property OnAcceleratorKeyPressed : TOnAcceleratorKeyPressedEvent read FOnAcceleratorKeyPressed write FOnAcceleratorKeyPressed;
property OnGotFocus : TNotifyEvent read FOnGotFocus write FOnGotFocus;
property OnLostFocus : TNotifyEvent read FOnLostFocus write FOnLostFocus;
property OnCursorChanged : TNotifyEvent read FOnCursorChanged write FOnCursorChanged;
property OnBrowserProcessExited : TOnBrowserProcessExitedEvent read FOnBrowserProcessExited write FOnBrowserProcessExited;
property OnRasterizationScaleChanged : TNotifyEvent read FOnRasterizationScaleChanged write FOnRasterizationScaleChanged;
property OnWebResourceResponseReceived : TOnWebResourceResponseReceivedEvent read FOnWebResourceResponseReceived write FOnWebResourceResponseReceived;
property OnDOMContentLoaded : TOnDOMContentLoadedEvent read FOnDOMContentLoaded write FOnDOMContentLoaded;
property OnWebResourceResponseViewGetContentCompleted : TOnWebResourceResponseViewGetContentCompletedEvent read FOnWebResourceResponseViewGetContentCompleted write FOnWebResourceResponseViewGetContentCompleted;
property OnGetCookiesCompleted : TOnGetCookiesCompletedEvent read FOnGetCookiesCompleted write FOnGetCookiesCompleted;
property OnTrySuspendCompleted : TOnTrySuspendCompletedEvent read FOnTrySuspendCompleted write FOnTrySuspendCompleted;
property OnFrameCreated : TOnFrameCreatedEvent read FOnFrameCreated write FOnFrameCreated;
property OnDownloadStarting : TOnDownloadStartingEvent read FOnDownloadStarting write FOnDownloadStarting;
property OnClientCertificateRequested : TOnClientCertificateRequestedEvent read FOnClientCertificateRequested write FOnClientCertificateRequested;
property OnPrintToPdfCompleted : TOnPrintToPdfCompletedEvent read FOnPrintToPdfCompleted write FOnPrintToPdfCompleted;
property OnBytesReceivedChanged : TOnBytesReceivedChangedEvent read FOnBytesReceivedChanged write FOnBytesReceivedChanged;
property OnEstimatedEndTimeChanged : TOnEstimatedEndTimeChangedEvent read FOnEstimatedEndTimeChanged write FOnEstimatedEndTimeChanged;
property OnDownloadStateChanged : TOnDownloadStateChangedEvent read FOnDownloadStateChanged write FOnDownloadStateChanged;
property OnFrameNameChanged : TOnFrameNameChangedEvent read FOnFrameNameChanged write FOnFrameNameChanged;
property OnFrameDestroyed : TOnFrameDestroyedEvent read FOnFrameDestroyed write FOnFrameDestroyed;
property OnCompositionControllerCompleted : TNotifyEvent read FOnCompositionControllerCompleted write FOnCompositionControllerCompleted;
property OnCallDevToolsProtocolMethodCompleted : TOnCallDevToolsProtocolMethodCompletedEvent read FOnCallDevToolsProtocolMethodCompleted write FOnCallDevToolsProtocolMethodCompleted;
property OnAddScriptToExecuteOnDocumentCreatedCompleted : TOnAddScriptToExecuteOnDocumentCreatedCompletedEvent read FOnAddScriptToExecuteOnDocumentCreatedCompleted write FOnAddScriptToExecuteOnDocumentCreatedCompleted;
end;
implementation
uses
uWVMiscFunctions, uWVCoreWebView2Delegates, uWVCoreWebView2EnvironmentOptions;
constructor TWVBrowserBase.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FCoreWebView2PrintSettings := nil;
FCoreWebView2Settings := nil;
FCoreWebView2Environment := nil;
FCoreWebView2Controller := nil;
FCoreWebView2CompositionController := nil;
FCoreWebView2 := nil;
FAdditionalBrowserArguments := '';
FLanguage := '';
FUseDefaultEnvironment := False;
FUseCompositionController := False;
FTargetCompatibleBrowserVersion := LowestChromiumVersion;
FAllowSingleSignOnUsingOSPrimaryAccount := False;
FZoomStep := ZOOM_STEP_DEF;
FOffline := False;
FOnInitializationError := nil;
FOnEnvironmentCompleted := nil;
FOnControllerCompleted := nil;
FOnAfterCreated := nil;
FOnExecuteScriptCompleted := nil;
FOnCapturePreviewCompleted := nil;
FOnNavigationStarting := nil;
FOnNavigationCompleted := nil;
FOnFrameNavigationStarting := nil;
FOnFrameNavigationCompleted := nil;
FOnSourceChanged := nil;
FOnHistoryChanged := nil;
FOnContentLoading := nil;
FOnDocumentTitleChanged := nil;
FOnNewWindowRequested := nil;
FOnWebResourceRequested := nil;
FOnScriptDialogOpening := nil;
FOnPermissionRequested := nil;
FOnProcessFailed := nil;
FOnWebMessageReceived := nil;
FOnContainsFullScreenElementChanged := nil;
FOnWindowCloseRequested := nil;
FOnDevToolsProtocolEventReceived := nil;
FOnZoomFactorChanged := nil;
FOnMoveFocusRequested := nil;
FOnAcceleratorKeyPressed := nil;
FOnGotFocus := nil;
FOnLostFocus := nil;
FOnCursorChanged := nil;
FOnBrowserProcessExited := nil;
FOnRasterizationScaleChanged := nil;
FOnWebResourceResponseReceived := nil;
FOnDOMContentLoaded := nil;
FOnWebResourceResponseViewGetContentCompleted := nil;
FOnGetCookiesCompleted := nil;
FOnTrySuspendCompleted := nil;
FOnFrameCreated := nil;
FOnDownloadStarting := nil;
FOnClientCertificateRequested := nil;
FOnPrintToPdfCompleted := nil;
FOnBytesReceivedChanged := nil;
FOnEstimatedEndTimeChanged := nil;
FOnDownloadStateChanged := nil;
FOnFrameNameChanged := nil;
FOnFrameDestroyed := nil;
FOnCompositionControllerCompleted := nil;
FOnCallDevToolsProtocolMethodCompleted := nil;
FOnAddScriptToExecuteOnDocumentCreatedCompleted := nil;
end;
destructor TWVBrowserBase.Destroy;
begin
try
DestroyPrintSettings;
DestroySettings;
DestroyEnvironment;
DestroyWebView;
DestroyController;
DestroyCompositionController;
finally
inherited Destroy;
end;
end;
procedure TWVBrowserBase.DestroyEnvironment;
begin
if assigned(FCoreWebView2Environment) then
FreeAndNil(FCoreWebView2Environment);
end;
procedure TWVBrowserBase.DestroyController;
begin
if assigned(FCoreWebView2Controller) then
FreeAndNil(FCoreWebView2Controller);
end;
procedure TWVBrowserBase.DestroyCompositionController;
begin
if assigned(FCoreWebView2CompositionController) then
FreeAndNil(FCoreWebView2CompositionController);
end;
procedure TWVBrowserBase.DestroyWebView;
begin
if assigned(FCoreWebView2) then
FreeAndNil(FCoreWebView2);
end;
procedure TWVBrowserBase.DestroySettings;
begin
if assigned(FCoreWebView2Settings) then
FreeAndNil(FCoreWebView2Settings);
end;
procedure TWVBrowserBase.DestroyPrintSettings;
begin
if assigned(FCoreWebView2PrintSettings) then
FreeAndNil(FCoreWebView2PrintSettings);
end;
function TWVBrowserBase.AddWebResourceRequestedFilter(const aURI: wvstring; aResourceContext: TWVWebResourceContext) : boolean;
begin
Result := Initialized and
FCoreWebView2.AddWebResourceRequestedFilter(aURI, aResourceContext);
end;
function TWVBrowserBase.RemoveWebResourceRequestedFilter(const aURI: wvstring; aResourceContext: TWVWebResourceContext) : boolean;
begin
Result := Initialized and
FCoreWebView2.RemoveWebResourceRequestedFilter(aURI, aResourceContext);
end;
function TWVBrowserBase.CapturePreview(aImageFormat: TWVCapturePreviewImageFormat; const aImageStream: IStream) : boolean;
begin
Result := Initialized and
FCoreWebView2.CapturePreview(aImageFormat, aImageStream, self);
end;
function TWVBrowserBase.EnvironmentCompletedHandler_Invoke(errorCode: HRESULT; const createdEnvironment: ICoreWebView2Environment): HRESULT;
var
TempResult : boolean;
TempError : wvstring;
begin
Result := S_OK;
if succeeded(errorCode) and assigned(createdEnvironment) then
begin
DestroyEnvironment;
FCoreWebView2Environment := TCoreWebView2Environment.Create(createdEnvironment);
doOnEnvironmentCompleted;
if FUseCompositionController then
TempResult := FCoreWebView2Environment.CreateCoreWebView2CompositionController(FWindowParentHandle, self)
else
TempResult := FCoreWebView2Environment.CreateCoreWebView2Controller(FWindowParentHandle, self);
if not(TempResult) then
doOnInitializationError(E_FAIL, 'There was an error creating the controller');
end
else
begin
TempError := 'There was a problem initializing the browser environment.' + CRLF + CRLF +
'Error code : 0x' +
{$IFDEF FPC}
UTF8Decode(inttohex(errorCode, 8))
{$ELSE}
inttohex(errorCode, 8)
{$ENDIF}
+ CRLF + EnvironmentCreationErrorToString(errorCode);
doOnInitializationError(errorCode, TempError);
end;
end;
function TWVBrowserBase.ControllerCompletedHandler_Invoke(errorCode: HRESULT; const createdController: ICoreWebView2Controller): HRESULT;
var
TempSettings : ICoreWebView2Settings;
TempPrintSettings : ICoreWebView2PrintSettings;
TempCoreWebView2 : ICoreWebView2;
begin
Result := S_OK;
try
if succeeded(errorCode) and assigned(createdController) then
begin
DestroyController;
FCoreWebView2Controller := TCoreWebView2Controller.Create(createdController);
doOnControllerCompleted;
TempCoreWebView2 := FCoreWebView2Controller.CoreWebView2;
if assigned(TempCoreWebView2) then
begin
DestroyWebView;
FCoreWebView2 := TCoreWebView2.Create(TempCoreWebView2);
TempSettings := FCoreWebView2.Settings;
if assigned(TempSettings) then
begin
DestroySettings;
FCoreWebView2Settings := TCoreWebView2Settings.Create(TempSettings);
if FCoreWebView2Environment.CreatePrintSettings(TempPrintSettings) then
begin
DestroyPrintSettings;
FCoreWebView2PrintSettings := TCoreWebView2PrintSettings.Create(TempPrintSettings);
end;
if not(FUseDefaultEnvironment) then
FCoreWebView2Environment.AddAllBrowserEvents(self);
FCoreWebView2.AddAllBrowserEvents(self);
FCoreWebView2Controller.AddAllBrowserEvents(self);
if assigned(FCoreWebView2CompositionController) then
FCoreWebView2CompositionController.AddAllBrowserEvents(self);
doOnAfterCreated;
if (Length(FDefaultURL) > 0) then
Navigate(FDefaultURL);
end
else
doOnInitializationError(E_FAIL, 'There was an error getting the browser settings.');
end
else
doOnInitializationError(E_FAIL, 'There was an error getting the browser webview.');
end
else
doOnInitializationError(errorCode, 'There was an error creating the controller.');
finally
TempSettings := nil;
TempCoreWebView2 := nil;
end;
end;
function TWVBrowserBase.NavigationStartingEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2NavigationStartingEventArgs): HRESULT;
begin
Result := S_OK;
doOnNavigationStarting(sender, args);
end;
function TWVBrowserBase.NavigationCompletedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2NavigationCompletedEventArgs): HRESULT;
begin
Result := S_OK;
doOnNavigationCompleted(sender, args);
end;
function TWVBrowserBase.SourceChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2SourceChangedEventArgs): HRESULT;
begin
Result := S_OK;
doOnSourceChanged(sender, args);
end;
function TWVBrowserBase.HistoryChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT;
begin
Result := S_OK;
doOnHistoryChanged(sender);
end;
function TWVBrowserBase.ContentLoadingEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2ContentLoadingEventArgs): HRESULT;
begin
Result := S_OK;
doOnContentLoading(sender, args);
end;
function TWVBrowserBase.DocumentTitleChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT;
begin
Result := S_OK;
doOnDocumentTitleChanged(sender);
end;
function TWVBrowserBase.NewWindowRequestedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2NewWindowRequestedEventArgs): HRESULT;
begin
Result := S_OK;
doOnNewWindowRequested(sender, args);
end;
function TWVBrowserBase.FrameNavigationStartingEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2NavigationStartingEventArgs): HRESULT;
begin
Result := S_OK;
doOnFrameNavigationStarting(sender, args);
end;
function TWVBrowserBase.FrameNavigationCompletedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2NavigationCompletedEventArgs): HRESULT;
begin
Result := S_OK;
doOnFrameNavigationCompleted(sender, args);
end;
function TWVBrowserBase.WebResourceRequestedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2WebResourceRequestedEventArgs): HRESULT;
begin
Result := S_OK;
doOnWebResourceRequested(sender, args);
end;
function TWVBrowserBase.ScriptDialogOpeningEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2ScriptDialogOpeningEventArgs): HRESULT;
begin
Result := S_OK;
doOnScriptDialogOpening(sender, args);
end;
function TWVBrowserBase.PermissionRequestedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2PermissionRequestedEventArgs): HRESULT;
begin
Result := S_OK;
doOnPermissionRequested(sender, args);
end;
function TWVBrowserBase.ProcessFailedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2ProcessFailedEventArgs): HRESULT;
begin
Result := S_OK;
doOnProcessFailed(sender, args);
end;
function TWVBrowserBase.WebMessageReceivedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2WebMessageReceivedEventArgs): HRESULT;
begin
Result := S_OK;
doOnWebMessageReceived(sender, args);
end;
function TWVBrowserBase.ContainsFullScreenElementChangedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT;
begin
Result := S_OK;
doOnContainsFullScreenElementChanged(sender);
end;
function TWVBrowserBase.WindowCloseRequestedEventHandler_Invoke(const sender: ICoreWebView2; const args: IUnknown): HRESULT;
begin
Result := S_OK;
doOnWindowCloseRequested(sender);
end;
function TWVBrowserBase.ZoomFactorChangedEventHandler_Invoke(const sender: ICoreWebView2Controller; const args: IUnknown): HRESULT;
begin
Result := S_OK;
doOnZoomFactorChanged(sender);
end;
function TWVBrowserBase.MoveFocusRequestedEventHandler_Invoke(const sender: ICoreWebView2Controller; const args: ICoreWebView2MoveFocusRequestedEventArgs): HRESULT;
begin
Result := S_OK;
doOnMoveFocusRequested(sender, args);
end;
function TWVBrowserBase.AcceleratorKeyPressedEventHandler_Invoke(const sender: ICoreWebView2Controller; const args: ICoreWebView2AcceleratorKeyPressedEventArgs): HRESULT;
begin
Result := S_OK;
doOnAcceleratorKeyPressed(sender, args);
end;
function TWVBrowserBase.GotFocusEventHandler_Invoke(const sender: ICoreWebView2Controller; const args: IUnknown): HRESULT;
begin
Result := S_OK;
doOnGotFocus(sender);
end;
function TWVBrowserBase.LostFocusEventHandler_Invoke(const sender: ICoreWebView2Controller; const args: IUnknown): HRESULT;
begin
Result := S_OK;
doOnLostFocus(sender);
end;
function TWVBrowserBase.CreateCoreWebView2CompositionControllerCompletedHandler_Invoke(errorCode: HResult; const webView: ICoreWebView2CompositionController): HRESULT;
var
TempControllerIntf : ICoreWebView2Controller;
begin
Result := S_OK;
if succeeded(errorCode) and assigned(webView) then
begin
DestroyCompositionController;
FCoreWebView2CompositionController := TCoreWebView2CompositionController.Create(webView);
doOnCompositionControllerCompleted;
if succeeded(webView.QueryInterface(IID_ICoreWebView2Controller, TempControllerIntf)) then
Result := ControllerCompletedHandler_Invoke(errorCode, TempControllerIntf)
else
doOnInitializationError(E_FAIL, 'There was an error creating the controller.');
end
else
doOnInitializationError(E_FAIL, 'There was an error creating the composition controller.');
end;
function TWVBrowserBase.CursorChangedEventHandler_Invoke(const sender: ICoreWebView2CompositionController; const args: IUnknown): HRESULT;
begin
Result := S_OK;
doOnCursorChangedEvent(sender);
end;
function TWVBrowserBase.BrowserProcessExitedEventHandler_Invoke(const sender : ICoreWebView2Environment;
const args : ICoreWebView2BrowserProcessExitedEventArgs): HRESULT;
begin
Result := S_OK;
doOnBrowserProcessExitedEvent(sender, args);
end;
function TWVBrowserBase.RasterizationScaleChangedEventHandler_Invoke(const sender: ICoreWebView2Controller; const args: IUnknown): HRESULT;
begin
Result := S_OK;
doOnRasterizationScaleChangedEvent(sender);
end;
function TWVBrowserBase.WebResourceResponseReceivedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2WebResourceResponseReceivedEventArgs): HRESULT;
begin
Result := S_OK;
doOnWebResourceResponseReceivedEvent(sender, args);
end;
function TWVBrowserBase.DOMContentLoadedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2DOMContentLoadedEventArgs): HRESULT;
begin
Result := S_OK;
doOnDOMContentLoadedEvent(sender, args);
end;
function TWVBrowserBase.WebResourceResponseViewGetContentCompletedHandler_Invoke(errorCode: HResult; const Content: IStream): HRESULT;
begin
Result := S_OK;
doOnWebResourceResponseViewGetContentCompletedEvent(errorCode, Content);
end;
function TWVBrowserBase.GetCookiesCompletedHandler_Invoke(aResult : HResult; const aCookieList : ICoreWebView2CookieList): HRESULT;
begin
Result := S_OK;
doOnGetCookiesCompletedEvent(aResult, aCookieList);
end;
function TWVBrowserBase.TrySuspendCompletedHandler_Invoke(errorCode: HResult; isSuccessful: Integer): HRESULT;
begin
Result := S_OK;
doOnTrySuspendCompletedEvent(errorCode, isSuccessful);
end;
function TWVBrowserBase.FrameCreatedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2FrameCreatedEventArgs): HRESULT;
begin
Result := S_OK;
doOnFrameCreatedEvent(sender, args);
end;
function TWVBrowserBase.DownloadStartingEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2DownloadStartingEventArgs): HRESULT;
begin
Result := S_OK;
doOnDownloadStartingEvent(sender, args);
end;
function TWVBrowserBase.ClientCertificateRequestedEventHandler_Invoke(const sender: ICoreWebView2; const args: ICoreWebView2ClientCertificateRequestedEventArgs): HRESULT;
begin
Result := S_OK;
doOnClientCertificateRequestedEvent(sender, args);
end;
function TWVBrowserBase.PrintToPdfCompletedHandler_Invoke(errorCode: HResult; isSuccessful: Integer): HRESULT;
begin
Result := S_OK;
doOnPrintToPdfCompletedEvent(errorCode, isSuccessful);
end;
function TWVBrowserBase.BytesReceivedChangedEventHandler_Invoke(const sender: ICoreWebView2DownloadOperation; const args: IUnknown; aDownloadID : integer): HRESULT;
begin
Result := S_OK;
doOnBytesReceivedChangedEventEvent(sender, args, aDownloadID);
end;
function TWVBrowserBase.EstimatedEndTimeChangedEventHandler_Invoke(const sender: ICoreWebView2DownloadOperation; const args: IUnknown; aDownloadID : integer): HRESULT;
begin
Result := S_OK;
doOnEstimatedEndTimeChangedEvent(sender, args, aDownloadID);
end;
function TWVBrowserBase.StateChangedEventHandler_Invoke(const sender: ICoreWebView2DownloadOperation; const args: IUnknown; aDownloadID : integer): HRESULT;
begin
Result := S_OK;
doOnStateChangedEvent(sender, args, aDownloadID);
end;
function TWVBrowserBase.FrameNameChangedEventHandler_Invoke(const sender: ICoreWebView2Frame; const args: IUnknown; aFrameID : integer): HRESULT;
begin
Result := S_OK;
doOnFrameNameChangedEvent(sender, args, aFrameID);
end;
function TWVBrowserBase.FrameDestroyedEventHandler_Invoke(const sender: ICoreWebView2Frame; const args: IUnknown; aFrameID : integer): HRESULT;
begin
Result := S_OK;
doOnFrameDestroyedEvent(sender, args, aFrameID);
end;
function TWVBrowserBase.CallDevToolsProtocolMethodCompletedHandler_Invoke(errorCode: HResult; returnObjectAsJson: PWideChar; aExecutionID : integer): HRESULT;
begin
Result := S_OK;
doOnCallDevToolsProtocolMethodCompletedEvent(errorCode, wvstring(returnObjectAsJson), aExecutionID);
end;
function TWVBrowserBase.AddScriptToExecuteOnDocumentCreatedCompletedHandler_Invoke(errorCode: HResult; id: PWideChar): HRESULT;
begin
Result := S_OK;
doOnAddScriptToExecuteOnDocumentCreatedCompletedEvent(errorCode, wvstring(id));
end;
function TWVBrowserBase.ExecuteScriptCompletedHandler_Invoke(errorCode: HRESULT; resultObjectAsJson: PWideChar; aExecutionID : integer): HRESULT;
begin
Result := S_OK;
doOnExecuteScriptCompleted(errorCode, wvstring(resultObjectAsJson), aExecutionID);
end;
function TWVBrowserBase.DevToolsProtocolEventReceivedEventHandler_Invoke(const sender : ICoreWebView2;
const args : ICoreWebView2DevToolsProtocolEventReceivedEventArgs;
const aEventName : wvstring;
aEventID : integer): HRESULT;
begin
Result := S_OK;
doOnDevToolsProtocolEventReceived(sender, args, aEventName, aEventID);
end;
function TWVBrowserBase.CapturePreviewCompletedHandler_Invoke(errorCode: HRESULT): HRESULT;
begin
Result := S_OK;
doCapturePreviewCompleted(errorCode);
end;
function TWVBrowserBase.CreateBrowser(aHandle : THandle; aUseDefaultEnvironment : boolean) : boolean;
begin
if aUseDefaultEnvironment and assigned(GlobalWebView2Loader) then
Result := CreateBrowser(aHandle, GlobalWebView2Loader.Environment)
else
Result := CreateBrowser(aHandle, nil);
end;
function TWVBrowserBase.CreateBrowser(aHandle : THandle; const aEnvironment : ICoreWebView2Environment) : boolean;
begin
Result := False;
if (aHandle = 0) or
(GlobalWebView2Loader = nil) or
not(GlobalWebView2Loader.Initialized) or
Initialized then
exit;
FWindowParentHandle := aHandle;
if assigned(aEnvironment) then
begin
DestroyEnvironment;
FUseDefaultEnvironment := True;
FCoreWebView2Environment := TCoreWebView2Environment.Create(aEnvironment);
Result := FCoreWebView2Environment.CreateCoreWebView2Controller(FWindowParentHandle, self);
end
else
Result := CreateEnvironment;
end;
function TWVBrowserBase.CreateWindowlessBrowser(aHandle : THandle; aUseDefaultEnvironment : boolean) : boolean;
begin
if aUseDefaultEnvironment and assigned(GlobalWebView2Loader) then
Result := CreateWindowlessBrowser(aHandle, GlobalWebView2Loader.Environment)
else
Result := CreateWindowlessBrowser(aHandle, nil);
end;
function TWVBrowserBase.CreateWindowlessBrowser(aHandle : THandle; const aEnvironment : ICoreWebView2Environment) : boolean;
begin
Result := False;
if (aHandle = 0) or
(GlobalWebView2Loader = nil) or
not(GlobalWebView2Loader.Initialized) or
Initialized then
exit;
FWindowParentHandle := aHandle;
FUseCompositionController := True;
if assigned(aEnvironment) then
begin
DestroyEnvironment;
FUseDefaultEnvironment := True;
FCoreWebView2Environment := TCoreWebView2Environment.Create(aEnvironment);
if FCoreWebView2Environment.SupportsCompositionController then
Result := FCoreWebView2Environment.CreateCoreWebView2CompositionController(FWindowParentHandle, self);
end
else
Result := CreateEnvironment;
end;
function TWVBrowserBase.ExecuteScript(const aJavaScript : wvstring; aExecutionID : integer) : boolean;
begin
Result := Initialized and
FCoreWebView2.ExecuteScript(aJavaScript, aExecutionID, self);
end;
function TWVBrowserBase.GetBrowserProcessID: cardinal;
begin
if Initialized then
Result := FCoreWebView2.BrowserProcessID
else
Result := 0;
end;
function TWVBrowserBase.GetBrowserVersionInfo: wvstring;
begin
if Initialized then
Result := FCoreWebView2Environment.BrowserVersionInfo
else
Result := '';
end;
function TWVBrowserBase.GetUserDataFolder: wvstring;
begin
if Initialized then
Result := FCoreWebView2Environment.UserDataFolder
else
Result := FUserDataFolder;
end;
function TWVBrowserBase.GetCanGoBack: boolean;
begin
Result := Initialized and
FCoreWebView2.CanGoBack;
end;
function TWVBrowserBase.GetIsSuspended: boolean;
begin
Result := Initialized and
FCoreWebView2.IsSuspended;
end;
function TWVBrowserBase.GetCanGoForward: boolean;
begin
Result := Initialized and
FCoreWebView2.CanGoForward;
end;
function TWVBrowserBase.GetContainsFullScreenElement: boolean;
begin
Result := Initialized and
FCoreWebView2.ContainsFullScreenElement;
end;
function TWVBrowserBase.GetBuiltInErrorPageEnabled: boolean;
begin
Result := Initialized and
FCoreWebView2Settings.IsBuiltInErrorPageEnabled;
end;
function TWVBrowserBase.GetDefaultContextMenusEnabled: boolean;
begin
Result := Initialized and
FCoreWebView2Settings.AreDefaultContextMenusEnabled;
end;
function TWVBrowserBase.GetDefaultScriptDialogsEnabled: boolean;
begin
Result := Initialized and
FCoreWebView2Settings.AreDefaultScriptDialogsEnabled;
end;
function TWVBrowserBase.GetDevToolsEnabled: boolean;
begin
Result := Initialized and
FCoreWebView2Settings.AreDevToolsEnabled;
end;
function TWVBrowserBase.GetDocumentTitle: wvstring;
begin
if Initialized then
Result := FCoreWebView2.DocumentTitle
else
Result := '';
end;
function TWVBrowserBase.GetSource: wvstring;
begin
if Initialized then
Result := FCoreWebView2.Source
else
Result := '';
end;
function TWVBrowserBase.GetCookieManager : ICoreWebView2CookieManager;
begin
if Initialized then
Result := FCoreWebView2.CookieManager
else
Result := nil;
end;
function TWVBrowserBase.GetScriptEnabled: boolean;
begin
Result := Initialized and
FCoreWebView2Settings.IsScriptEnabled;
end;
function TWVBrowserBase.GetStatusBarEnabled: boolean;
begin
Result := Initialized and
FCoreWebView2Settings.IsStatusBarEnabled;
end;
function TWVBrowserBase.GetWebMessageEnabled: boolean;
begin
Result := Initialized and
FCoreWebView2Settings.IsWebMessageEnabled;
end;
function TWVBrowserBase.GetInitialized: boolean;
begin
Result := (FCoreWebView2Environment <> nil) and FCoreWebView2Environment.Initialized and
(FCoreWebView2 <> nil) and FCoreWebView2.Initialized and
(FCoreWebView2Settings <> nil) and FCoreWebView2Settings.Initialized and
(FCoreWebView2Controller <> nil) and FCoreWebView2Controller.Initialized and
(not(FUseCompositionController) or ((FCoreWebView2CompositionController <> nil) and FCoreWebView2CompositionController.Initialized));
end;
function TWVBrowserBase.GetZoomControlEnabled: boolean;
begin
Result := Initialized and
FCoreWebView2Settings.IsZoomControlEnabled;
end;
function TWVBrowserBase.GetIsVisible : boolean;
begin
Result := Initialized and
FCoreWebView2Controller.IsVisible;
end;
function TWVBrowserBase.GetBounds : TRect;
begin
if Initialized then
Result := FCoreWebView2Controller.Bounds
else
Result := rect(0, 0, 0, 0);
end;
function TWVBrowserBase.GetParentWindow : THandle;
begin
if Initialized then
Result := FCoreWebView2Controller.ParentWindow
else
Result := 0;
end;
function TWVBrowserBase.GetDefaultBackgroundColor : TColor;
begin
if Initialized then
Result := FCoreWebView2Controller.DefaultBackgroundColor
else
{$IFDEF FPC}
Result := clNone;
{$ELSE}
Result := TColors.SysNone; // clNone
{$ENDIF}
end;
function TWVBrowserBase.GetRasterizationScale : double;
begin
if Initialized then
Result := FCoreWebView2Controller.RasterizationScale
else
Result := 0;
end;
function TWVBrowserBase.GetShouldDetectMonitorScaleChanges : boolean;
begin
Result := Initialized and
FCoreWebView2Controller.ShouldDetectMonitorScaleChanges;
end;
function TWVBrowserBase.GetBoundsMode : TWVBoundsMode;
begin
if Initialized then
Result := FCoreWebView2Controller.BoundsMode
else
Result := 0;
end;
function TWVBrowserBase.GetAreHostObjectsAllowed : boolean;
begin
Result := Initialized and
FCoreWebView2Settings.AreHostObjectsAllowed;
end;
function TWVBrowserBase.GetUserAgent : wvstring;
begin
if Initialized then
Result := FCoreWebView2Settings.UserAgent
else
Result := '';
end;
function TWVBrowserBase.GetAreBrowserAcceleratorKeysEnabled : boolean;
begin
Result := Initialized and
FCoreWebView2Settings.AreBrowserAcceleratorKeysEnabled;
end;
function TWVBrowserBase.GetIsPasswordAutosaveEnabled : boolean;
begin
Result := Initialized and
FCoreWebView2Settings.IsPasswordAutosaveEnabled;
end;
function TWVBrowserBase.GetIsGeneralAutofillEnabled : boolean;
begin
Result := Initialized and
FCoreWebView2Settings.IsGeneralAutofillEnabled;
end;
function TWVBrowserBase.GetIsPinchZoomEnabled : boolean;
begin
Result := Initialized and
FCoreWebView2Settings.IsPinchZoomEnabled;
end;
function TWVBrowserBase.GetIsSwipeNavigationEnabled : boolean;
begin
Result := Initialized and
FCoreWebView2Settings.IsSwipeNavigationEnabled;
end;
function TWVBrowserBase.GetZoomFactor: Double;
begin
if Initialized then
Result := FCoreWebView2Controller.ZoomFactor
else
Result := 0;
end;
function TWVBrowserBase.GetZoomPct : double;
begin
Result := ZoomFactor * 100;
end;
function TWVBrowserBase.GoBack : boolean;
begin
Result := Initialized and
FCoreWebView2.GoBack;
end;
function TWVBrowserBase.GoForward : boolean;
begin
Result := Initialized and
FCoreWebView2.GoForward;
end;
function TWVBrowserBase.CreateEnvironment : boolean;
var
TempOptions : ICoreWebView2EnvironmentOptions;
TempHandler : ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler;
begin
try
TempHandler := TCoreWebView2EnvironmentCompletedHandler.Create(self);
TempOptions := TCoreWebView2EnvironmentOptions.Create(FAdditionalBrowserArguments,
FLanguage,
FTargetCompatibleBrowserVersion,
FAllowSingleSignOnUsingOSPrimaryAccount);
Result := succeeded(CreateCoreWebView2EnvironmentWithOptions(PWideChar(FBrowserExecPath),
PWideChar(FUserDataFolder),
TempOptions,
TempHandler));
finally
TempOptions := nil;
TempHandler := nil;
end;
end;
function TWVBrowserBase.Navigate(const aURI : wvstring): boolean;
begin
Result := Initialized and
FCoreWebView2.Navigate(aURI);
end;
function TWVBrowserBase.NavigateToString(const aHTMLContent: wvstring): boolean;
begin
Result := Initialized and
FCoreWebView2.NavigateToString(PWideChar(aHTMLContent));
end;
function TWVBrowserBase.NavigateWithWebResourceRequest(const aRequest : ICoreWebView2WebResourceRequest) : boolean;
begin
Result := Initialized and
FCoreWebView2.NavigateWithWebResourceRequest(aRequest);
end;
function TWVBrowserBase.Refresh : boolean;
begin
Result := Initialized and
FCoreWebView2.Reload;
end;
procedure TWVBrowserBase.SetBounds(aValue : TRect);
begin
if Initialized then
FCoreWebView2Controller.Bounds := aValue;
end;
procedure TWVBrowserBase.SetParentWindow(aValue : THandle);
begin
if Initialized then
FCoreWebView2Controller.ParentWindow := aValue;
end;
procedure TWVBrowserBase.SetDefaultBackgroundColor(const aValue : TColor);
begin
if Initialized then
FCoreWebView2Controller.DefaultBackgroundColor := aValue;
end;
procedure TWVBrowserBase.SetRasterizationScale(const aValue : double);
begin
if Initialized then
FCoreWebView2Controller.RasterizationScale := aValue;
end;
procedure TWVBrowserBase.SetShouldDetectMonitorScaleChanges(aValue : boolean);
begin
if Initialized then
FCoreWebView2Controller.ShouldDetectMonitorScaleChanges := aValue;
end;
procedure TWVBrowserBase.SetBoundsMode(aValue : TWVBoundsMode);
begin
if Initialized then
FCoreWebView2Controller.BoundsMode := aValue;
end;
procedure TWVBrowserBase.SetAreHostObjectsAllowed(aValue : boolean);
begin
if Initialized then
FCoreWebView2Settings.AreHostObjectsAllowed := aValue;
end;
procedure TWVBrowserBase.SetUserAgent(const aValue : wvstring);
begin
if Initialized then
FCoreWebView2Settings.UserAgent := aValue;
end;
procedure TWVBrowserBase.SetAreBrowserAcceleratorKeysEnabled(aValue : boolean);
begin
if Initialized then
FCoreWebView2Settings.AreBrowserAcceleratorKeysEnabled := aValue;
end;
procedure TWVBrowserBase.SetIsPasswordAutosaveEnabled(aValue : boolean);
begin
if Initialized then
FCoreWebView2Settings.IsPasswordAutosaveEnabled := aValue;
end;
procedure TWVBrowserBase.SetIsGeneralAutofillEnabled(aValue : boolean);
begin
if Initialized then
FCoreWebView2Settings.IsGeneralAutofillEnabled := aValue;
end;
procedure TWVBrowserBase.SetIsPinchZoomEnabled(aValue : boolean);
begin
if Initialized then
FCoreWebView2Settings.IsPinchZoomEnabled := aValue;
end;
procedure TWVBrowserBase.SetIsSwipeNavigationEnabled(aValue : boolean);
begin
if Initialized then
FCoreWebView2Settings.IsSwipeNavigationEnabled := aValue;
end;
procedure TWVBrowserBase.SetBuiltInErrorPageEnabled(const Value: boolean);
begin
if Initialized then
FCoreWebView2Settings.IsBuiltInErrorPageEnabled := Value;
end;
procedure TWVBrowserBase.SetDefaultContextMenusEnabled(const Value: boolean);
begin
if Initialized then
FCoreWebView2Settings.AreDefaultContextMenusEnabled := Value;
end;
procedure TWVBrowserBase.SetDefaultScriptDialogsEnabled(const Value: boolean);
begin
if Initialized then
FCoreWebView2Settings.AreDefaultScriptDialogsEnabled := Value;
end;
procedure TWVBrowserBase.SetDevToolsEnabled(const Value: boolean);
begin
if Initialized then
FCoreWebView2Settings.AreDevToolsEnabled := Value;
end;
function TWVBrowserBase.SetFocus : boolean;
begin
Result := Initialized and
FCoreWebView2Controller.MoveFocus(COREWEBVIEW2_MOVE_FOCUS_REASON_PROGRAMMATIC);
end;
function TWVBrowserBase.FocusNext : boolean;
begin
Result := Initialized and
FCoreWebView2Controller.MoveFocus(COREWEBVIEW2_MOVE_FOCUS_REASON_NEXT);
end;
function TWVBrowserBase.FocusPrevious : boolean;
begin
Result := Initialized and
FCoreWebView2Controller.MoveFocus(COREWEBVIEW2_MOVE_FOCUS_REASON_PREVIOUS);
end;
function TWVBrowserBase.SetBoundsAndZoomFactor(aBounds: TRect; const aZoomFactor: double) : boolean;
begin
Result := Initialized and
FCoreWebView2Controller.SetBoundsAndZoomFactor(aBounds, aZoomFactor);
end;
function TWVBrowserBase.NotifyParentWindowPositionChanged : boolean;
begin
Result := Initialized and
FCoreWebView2Controller.NotifyParentWindowPositionChanged;
end;
function TWVBrowserBase.TrySuspend : boolean;
var
TempHandler : ICoreWebView2TrySuspendCompletedHandler;
begin
Result := False;
if Initialized then
try
TempHandler := TCoreWebView2TrySuspendCompletedHandler.Create(self);
Result := FCoreWebView2.TrySuspend(TempHandler);
finally
TempHandler := nil;
end;
end;
function TWVBrowserBase.Resume : boolean;
begin
Result := Initialized and
FCoreWebView2.Resume;
end;
function TWVBrowserBase.SetVirtualHostNameToFolderMapping(const aHostName, aFolderPath : wvstring; aAccessKind : TWVHostResourceAcccessKind): boolean;
begin
Result := Initialized and
FCoreWebView2.SetVirtualHostNameToFolderMapping(aHostName, aFolderPath, aAccessKind);
end;
function TWVBrowserBase.ClearVirtualHostNameToFolderMapping(const aHostName : wvstring) : boolean;
begin
Result := Initialized and
FCoreWebView2.ClearVirtualHostNameToFolderMapping(aHostName);
end;
function TWVBrowserBase.OpenTaskManagerWindow : boolean;
begin
Result := Initialized and
FCoreWebView2.OpenTaskManagerWindow;
end;
function TWVBrowserBase.Print : boolean;
begin
Result := ExecuteScript('window.print();');
end;
function TWVBrowserBase.PrintToPdf(const aResultFilePath : wvstring) : boolean;
var
TempHandler : ICoreWebView2PrintToPdfCompletedHandler;
begin
Result := False;
if Initialized and
assigned(FCoreWebView2PrintSettings) and
FCoreWebView2PrintSettings.Initialized then
try
TempHandler := TCoreWebView2PrintToPdfCompletedHandler.Create(self);
Result := FCoreWebView2.PrintToPdf(aResultFilePath, FCoreWebView2PrintSettings.BaseIntf, TempHandler);
finally
TempHandler := nil;
end;
end;
function TWVBrowserBase.OpenDevToolsWindow : boolean;
begin
Result := Initialized and
FCoreWebView2.OpenDevToolsWindow;
end;
function TWVBrowserBase.PostWebMessageAsJson(const aWebMessageAsJson : wvstring) : boolean;
begin
Result := Initialized and
FCoreWebView2.PostWebMessageAsJson(aWebMessageAsJson);
end;
function TWVBrowserBase.PostWebMessageAsString(const aWebMessageAsString : wvstring) : boolean;
begin
Result := Initialized and
FCoreWebView2.PostWebMessageAsString(aWebMessageAsString);
end;
function TWVBrowserBase.CallDevToolsProtocolMethod(const aMethodName, aParametersAsJson : wvstring; aExecutionID : integer) : boolean;
begin
Result := Initialized and
FCoreWebView2.CallDevToolsProtocolMethod(aMethodName, aParametersAsJson, aExecutionID, self);
end;
function TWVBrowserBase.AddHostObjectToScript(const aName : wvstring; const aObject : OleVariant): boolean;
begin
Result := Initialized and
FCoreWebView2.AddHostObjectToScript(aName, aObject);
end;
function TWVBrowserBase.RemoveHostObjectFromScript(const aName : wvstring) : boolean;
begin
Result := Initialized and
FCoreWebView2.RemoveHostObjectFromScript(aName);
end;
function TWVBrowserBase.AddScriptToExecuteOnDocumentCreated(const JavaScript : wvstring) : boolean;
begin
Result := Initialized and
FCoreWebView2.AddScriptToExecuteOnDocumentCreated(JavaScript, self);
end;
function TWVBrowserBase.RemoveScriptToExecuteOnDocumentCreated(const aID : wvstring) : boolean;
begin
Result := Initialized and
FCoreWebView2.RemoveScriptToExecuteOnDocumentCreated(aID);
end;
function TWVBrowserBase.CreateCookie(const aName, aValue, aDomain, aPath : wvstring) : ICoreWebView2Cookie;
var
TempManager : TCoreWebView2CookieManager;
begin
Result := nil;
if Initialized then
try
TempManager := TCoreWebView2CookieManager.Create(FCoreWebView2.CookieManager);
Result := TempManager.CreateCookie(aName, aValue, aDomain, aPath);
finally
FreeAndNil(TempManager);
end;
end;
function TWVBrowserBase.CopyCookie(const aCookie : ICoreWebView2Cookie) : ICoreWebView2Cookie;
var
TempManager : TCoreWebView2CookieManager;
begin
Result := nil;
if Initialized then
try
TempManager := TCoreWebView2CookieManager.Create(FCoreWebView2.CookieManager);
Result := TempManager.CopyCookie(aCookie);
finally
FreeAndNil(TempManager);
end;
end;
function TWVBrowserBase.GetCookies(const aURI : wvstring): boolean;
var
TempHandler : ICoreWebView2GetCookiesCompletedHandler;
TempManager : TCoreWebView2CookieManager;
begin
Result := False;
if Initialized then
try
TempManager := TCoreWebView2CookieManager.Create(FCoreWebView2.CookieManager);
TempHandler := TCoreWebView2GetCookiesCompletedHandler.Create(self);
Result := TempManager.GetCookies(aURI, TempHandler);
finally
TempHandler := nil;
FreeAndNil(TempManager);
end;
end;
function TWVBrowserBase.AddOrUpdateCookie(const aCookie : ICoreWebView2Cookie): boolean;
var
TempManager : TCoreWebView2CookieManager;
begin
Result := False;
if Initialized then
try
TempManager := TCoreWebView2CookieManager.Create(FCoreWebView2.CookieManager);
Result := TempManager.AddOrUpdateCookie(aCookie);
finally
FreeAndNil(TempManager);
end;
end;
function TWVBrowserBase.DeleteCookie(const aCookie : ICoreWebView2Cookie): boolean;
var
TempManager : TCoreWebView2CookieManager;
begin
Result := False;
if Initialized then
try
TempManager := TCoreWebView2CookieManager.Create(FCoreWebView2.CookieManager);
Result := TempManager.DeleteCookie(aCookie);
finally
FreeAndNil(TempManager);
end;
end;
function TWVBrowserBase.DeleteCookies(const aName, aURI : wvstring): boolean;
var
TempManager : TCoreWebView2CookieManager;
begin
Result := False;
if Initialized then
try
TempManager := TCoreWebView2CookieManager.Create(FCoreWebView2.CookieManager);
Result := TempManager.DeleteCookies(aName, aURI);
finally
FreeAndNil(TempManager);
end;
end;
function TWVBrowserBase.DeleteCookiesWithDomainAndPath(const aName, aDomain, aPath : wvstring): boolean;
var
TempManager : TCoreWebView2CookieManager;
begin
Result := False;
if Initialized then
try
TempManager := TCoreWebView2CookieManager.Create(FCoreWebView2.CookieManager);
Result := TempManager.DeleteCookiesWithDomainAndPath(aName, aDomain, aPath);
finally
FreeAndNil(TempManager);
end;
end;
function TWVBrowserBase.DeleteAllCookies : boolean;
var
TempManager : TCoreWebView2CookieManager;
begin
Result := False;
if Initialized then
try
TempManager := TCoreWebView2CookieManager.Create(FCoreWebView2.CookieManager);
Result := TempManager.DeleteAllCookies;
finally
FreeAndNil(TempManager);
end;
end;
function TWVBrowserBase.ClearCache : boolean;
begin
Result := CallDevToolsProtocolMethod('Network.clearBrowserCache', '{}');
end;
function TWVBrowserBase.ClearDataForOrigin(const aOrigin : wvstring; aStorageTypes : TWVClearDataStorageTypes) : boolean;
var
TempParams : wvstring;
begin
TempParams := '{"origin": "' + aOrigin + '", ';
case aStorageTypes of
cdstAppCache : TempParams := TempParams + '"storageTypes": "appcache"}';
cdstCookies : TempParams := TempParams + '"storageTypes": "cookies"}';
cdstFileSystems : TempParams := TempParams + '"storageTypes": "file_systems"}';
cdstIndexeddb : TempParams := TempParams + '"storageTypes": "indexeddb"}';
cdstLocalStorage : TempParams := TempParams + '"storageTypes": "local_storage"}';
cdstShaderCache : TempParams := TempParams + '"storageTypes": "shader_cache"}';
cdstWebsql : TempParams := TempParams + '"storageTypes": "websql"}';
cdstServiceWorkers : TempParams := TempParams + '"storageTypes": "service_workers"}';
cdstCacheStorage : TempParams := TempParams + '"storageTypes": "cache_storage"}';
else TempParams := TempParams + '"storageTypes": "all"}';
end;
Result := CallDevToolsProtocolMethod('Storage.clearDataForOrigin', TempParams);
end;
procedure TWVBrowserBase.SetOffline(aValue : boolean);
var
TempParams : wvstring;
begin
if (FOffline <> aValue) then
begin
FOffline := aValue;
TempParams := '{"offline": ' +
{$IFDEF FPC}
UTF8Decode(lowercase(BoolToStr(FOffline, True)))
{$ELSE}
lowercase(BoolToStr(FOffline, True))
{$ENDIF}
+ ', "latency": 0, "downloadThroughput": 0, "uploadThroughput": 0}';
CallDevToolsProtocolMethod('Network.emulateNetworkConditions', TempParams);
end;
end;
procedure TWVBrowserBase.SetIgnoreCertificateErrors(aValue : boolean);
var
TempParams : wvstring;
begin
if (FIgnoreCertificateErrors <> aValue) then
begin
FIgnoreCertificateErrors := aValue;
TempParams := '{"ignore": ' +
{$IFDEF FPC}
UTF8Decode(lowercase(BoolToStr(FIgnoreCertificateErrors, True)))
{$ELSE}
lowercase(BoolToStr(FIgnoreCertificateErrors, True))
{$ENDIF}
+ '}';
CallDevToolsProtocolMethod('Security.setIgnoreCertificateErrors', TempParams);
end;
end;
procedure TWVBrowserBase.IncZoomStep;
begin
UpdateZoomStep(True);
end;
procedure TWVBrowserBase.DecZoomStep;
begin
UpdateZoomStep(False);
end;
procedure TWVBrowserBase.ResetZoom;
begin
ZoomStep := ZOOM_STEP_DEF;
end;
procedure TWVBrowserBase.SetScriptEnabled(const Value: boolean);
begin
if Initialized then
FCoreWebView2Settings.IsScriptEnabled := Value;
end;
procedure TWVBrowserBase.SetStatusBarEnabled(const Value: boolean);
begin
if Initialized then
FCoreWebView2Settings.IsStatusBarEnabled := Value;
end;
procedure TWVBrowserBase.SetWebMessageEnabled(const Value: boolean);
begin
if Initialized then
FCoreWebView2Settings.IsWebMessageEnabled := Value;
end;
procedure TWVBrowserBase.SetZoomControlEnabled(const Value: boolean);
begin
if Initialized then
FCoreWebView2Settings.IsZoomControlEnabled := Value;
end;
procedure TWVBrowserBase.SetZoomFactor(const Value: Double);
begin
if Initialized then
FCoreWebView2Controller.ZoomFactor := Value;
end;
procedure TWVBrowserBase.SetZoomPct(const aValue : double);
var
TempZoom : double;
i : integer;
begin
if not(Initialized) then exit;
if (aValue >= ZoomStepValues[ZOOM_STEP_MIN]) and
(aValue <= ZoomStepValues[ZOOM_STEP_MAX]) then
begin
UpdateZoomPct(aValue);
TempZoom := ZoomPct;
for i := ZOOM_STEP_MIN to ZOOM_STEP_MAX do
if (TempZoom = ZoomStepValues[i]) then break;
FZoomStep := i;
end;
end;
procedure TWVBrowserBase.SetZoomStep(aValue : byte);
begin
if not(Initialized) then exit;
if (aValue in [ZOOM_STEP_MIN..ZOOM_STEP_MAX]) then
begin
FZoomStep := aValue;
UpdateZoomPct(ZoomStepValues[aValue]);
end;
end;
procedure TWVBrowserBase.SetIsVisible(const aValue : boolean);
begin
if Initialized then
FCoreWebView2Controller.IsVisible := aValue;
end;
function TWVBrowserBase.Stop : boolean;
begin
Result := Initialized and
FCoreWebView2.Stop;
end;
function TWVBrowserBase.SubscribeToDevToolsProtocolEvent(const aEventName : wvstring; aEventID : integer) : boolean;
begin
Result := Initialized and
FCoreWebView2.SubscribeToDevToolsProtocolEvent(aEventName, aEventID, self);
end;
procedure TWVBrowserBase.doOnInitializationError(aErrorCode: HRESULT; const aErrorMessage: wvstring);
begin
if assigned(FOnInitializationError) then
FOnInitializationError(self, aErrorCode, aErrorMessage);
end;
procedure TWVBrowserBase.doOnEnvironmentCompleted;
begin
if assigned(FOnEnvironmentCompleted) then
FOnEnvironmentCompleted(self);
end;
procedure TWVBrowserBase.doOnControllerCompleted;
begin
if assigned(FOnControllerCompleted) then
FOnControllerCompleted(self);
end;
procedure TWVBrowserBase.doOnAfterCreated;
begin
if assigned(FOnAfterCreated) then
FOnAfterCreated(self);
end;
procedure TWVBrowserBase.doOnExecuteScriptCompleted(aErrorCode: HRESULT; const aResultObjectAsJson: wvstring; aExecutionID : integer);
begin
if assigned(FOnExecuteScriptCompleted) then
FOnExecuteScriptCompleted(self, aErrorCode, aResultObjectAsJson, aExecutionID);
end;
procedure TWVBrowserBase.doCapturePreviewCompleted(aErrorCode: HRESULT);
begin
if assigned(FOnCapturePreviewCompleted) then
FOnCapturePreviewCompleted(self, aErrorCode);
end;
procedure TWVBrowserBase.doOnNavigationStarting(const sender: ICoreWebView2; const args: ICoreWebView2NavigationStartingEventArgs);
begin
if assigned(FOnNavigationStarting) then
FOnNavigationStarting(self, sender, args);
end;
procedure TWVBrowserBase.doOnNavigationCompleted(const sender: ICoreWebView2; const args: ICoreWebView2NavigationCompletedEventArgs);
begin
if assigned(FOnNavigationCompleted) then
FOnNavigationCompleted(self, sender, args);
end;
procedure TWVBrowserBase.doOnFrameNavigationStarting(const sender: ICoreWebView2; const args: ICoreWebView2NavigationStartingEventArgs);
begin
if assigned(FOnFrameNavigationStarting) then
FOnFrameNavigationStarting(self, sender, args);
end;
procedure TWVBrowserBase.doOnFrameNavigationCompleted(const sender: ICoreWebView2; const args: ICoreWebView2NavigationCompletedEventArgs);
begin
if assigned(FOnFrameNavigationCompleted) then
FOnFrameNavigationCompleted(self, sender, args);
end;
procedure TWVBrowserBase.doOnSourceChanged(const sender: ICoreWebView2; const args: ICoreWebView2SourceChangedEventArgs);
begin
if assigned(FOnSourceChanged) then
FOnSourceChanged(self, sender, args);
end;
procedure TWVBrowserBase.doOnHistoryChanged(const sender: ICoreWebView2);
begin
if assigned(FOnHistoryChanged) then
FOnHistoryChanged(self);
end;
procedure TWVBrowserBase.doOnContentLoading(const sender: ICoreWebView2; const args: ICoreWebView2ContentLoadingEventArgs);
begin
if assigned(FOnContentLoading) then
FOnContentLoading(self, sender, args);
end;
procedure TWVBrowserBase.doOnDocumentTitleChanged(const sender: ICoreWebView2);
begin
if assigned(FOnDocumentTitleChanged) then
FOnDocumentTitleChanged(self);
end;
procedure TWVBrowserBase.doOnNewWindowRequested(const sender: ICoreWebView2; const args: ICoreWebView2NewWindowRequestedEventArgs);
begin
if assigned(FOnNewWindowRequested) then
FOnNewWindowRequested(self, sender, args);
end;
procedure TWVBrowserBase.doOnWebResourceRequested(const sender: ICoreWebView2; const args: ICoreWebView2WebResourceRequestedEventArgs);
begin
if assigned(FOnWebResourceRequested) then
FOnWebResourceRequested(self, sender, args);
end;
procedure TWVBrowserBase.doOnScriptDialogOpening(const sender: ICoreWebView2; const args: ICoreWebView2ScriptDialogOpeningEventArgs);
begin
if assigned(FOnScriptDialogOpening) then
FOnScriptDialogOpening(self, sender, args);
end;
procedure TWVBrowserBase.doOnPermissionRequested(const sender: ICoreWebView2; const args: ICoreWebView2PermissionRequestedEventArgs);
begin
if assigned(FOnPermissionRequested) then
FOnPermissionRequested(self, sender, args);
end;
procedure TWVBrowserBase.doOnProcessFailed(const sender: ICoreWebView2; const args: ICoreWebView2ProcessFailedEventArgs);
begin
if assigned(FOnProcessFailed) then
FOnProcessFailed(self, sender, args);
end;
procedure TWVBrowserBase.doOnWebMessageReceived(const sender: ICoreWebView2; const args: ICoreWebView2WebMessageReceivedEventArgs);
begin
if assigned(FOnWebMessageReceived) then
FOnWebMessageReceived(self, sender, args);
end;
procedure TWVBrowserBase.doOnContainsFullScreenElementChanged(const sender: ICoreWebView2);
begin
if assigned(FOnContainsFullScreenElementChanged) then
FOnContainsFullScreenElementChanged(self);
end;
procedure TWVBrowserBase.doOnWindowCloseRequested(const sender: ICoreWebView2);
begin
if assigned(FOnWindowCloseRequested) then
FOnWindowCloseRequested(self);
end;
procedure TWVBrowserBase.doOnDevToolsProtocolEventReceived(const sender: ICoreWebView2; const args: ICoreWebView2DevToolsProtocolEventReceivedEventArgs; const aEventName : wvstring; aEventID : integer);
begin
if assigned(FOnDevToolsProtocolEventReceived) then
FOnDevToolsProtocolEventReceived(self, sender, args, aEventName, aEventID);
end;
procedure TWVBrowserBase.doOnZoomFactorChanged(const sender: ICoreWebView2Controller);
begin
if assigned(FOnZoomFactorChanged) then
FOnZoomFactorChanged(self);
end;
procedure TWVBrowserBase.doOnMoveFocusRequested(const sender: ICoreWebView2Controller; const args: ICoreWebView2MoveFocusRequestedEventArgs);
begin
if assigned(FOnMoveFocusRequested) then
FOnMoveFocusRequested(self, sender, args);
end;
procedure TWVBrowserBase.doOnAcceleratorKeyPressed(const sender: ICoreWebView2Controller; const args: ICoreWebView2AcceleratorKeyPressedEventArgs);
begin
if assigned(FOnAcceleratorKeyPressed) then
FOnAcceleratorKeyPressed(self, sender, args);
end;
procedure TWVBrowserBase.doOnGotFocus(const sender: ICoreWebView2Controller);
begin
if assigned(FOnGotFocus) then
FOnGotFocus(self);
end;
procedure TWVBrowserBase.doOnLostFocus(const sender: ICoreWebView2Controller);
begin
if assigned(FOnLostFocus) then
FOnLostFocus(self);
end;
procedure TWVBrowserBase.doOnCompositionControllerCompleted;
begin
if assigned(FOnCompositionControllerCompleted) then
FOnCompositionControllerCompleted(self);
end;
procedure TWVBrowserBase.doOnCursorChangedEvent(const sender: ICoreWebView2CompositionController);
begin
if assigned(FOnCursorChanged) then
FOnCursorChanged(self);
end;
procedure TWVBrowserBase.doOnBrowserProcessExitedEvent(const sender: ICoreWebView2Environment; const args: ICoreWebView2BrowserProcessExitedEventArgs);
begin
if assigned(FOnBrowserProcessExited) then
FOnBrowserProcessExited(self, sender, args);
end;
procedure TWVBrowserBase.doOnRasterizationScaleChangedEvent(const sender: ICoreWebView2Controller);
begin
if assigned(FOnRasterizationScaleChanged) then
FOnRasterizationScaleChanged(self);
end;
procedure TWVBrowserBase.doOnWebResourceResponseReceivedEvent(const sender: ICoreWebView2; const args: ICoreWebView2WebResourceResponseReceivedEventArgs);
begin
if assigned(FOnWebResourceResponseReceived) then
FOnWebResourceResponseReceived(self, sender, args);
end;
procedure TWVBrowserBase.doOnDOMContentLoadedEvent(const sender: ICoreWebView2; const args: ICoreWebView2DOMContentLoadedEventArgs);
begin
if assigned(FOnDOMContentLoaded) then
FOnDOMContentLoaded(self, sender, args);
end;
procedure TWVBrowserBase.doOnWebResourceResponseViewGetContentCompletedEvent(errorCode: HResult; const Content: IStream);
begin
if assigned(FOnWebResourceResponseViewGetContentCompleted) then
FOnWebResourceResponseViewGetContentCompleted(self, errorCode, Content);
end;
procedure TWVBrowserBase.doOnGetCookiesCompletedEvent(aResult : HResult; const aCookieList : ICoreWebView2CookieList);
begin
if assigned(FOnGetCookiesCompleted) then
FOnGetCookiesCompleted(self, aResult, aCookieList);
end;
procedure TWVBrowserBase.doOnTrySuspendCompletedEvent(errorCode: HResult; isSuccessful: Integer);
begin
if assigned(FOnTrySuspendCompleted) then
FOnTrySuspendCompleted(self, errorCode, (isSuccessful <> 0));
end;
procedure TWVBrowserBase.doOnFrameCreatedEvent(const sender: ICoreWebView2; const args: ICoreWebView2FrameCreatedEventArgs);
begin
if assigned(FOnFrameCreated) then
FOnFrameCreated(self, sender, args);
end;
procedure TWVBrowserBase.doOnDownloadStartingEvent(const sender: ICoreWebView2; const args: ICoreWebView2DownloadStartingEventArgs);
begin
if assigned(FOnDownloadStarting) then
FOnDownloadStarting(self, sender, args);
end;
procedure TWVBrowserBase.doOnClientCertificateRequestedEvent(const sender: ICoreWebView2; const args: ICoreWebView2ClientCertificateRequestedEventArgs);
begin
if assigned(FOnClientCertificateRequested) then
FOnClientCertificateRequested(self, sender, args);
end;
procedure TWVBrowserBase.doOnPrintToPdfCompletedEvent(errorCode: HResult; isSuccessful: Integer);
begin
if assigned(FOnPrintToPdfCompleted) then
FOnPrintToPdfCompleted(self, errorCode, (isSuccessful <> 0));
end;
procedure TWVBrowserBase.doOnBytesReceivedChangedEventEvent(const sender: ICoreWebView2DownloadOperation; const args: IUnknown; aDownloadID : integer);
begin
if assigned(FOnBytesReceivedChanged) then
FOnBytesReceivedChanged(self, sender, aDownloadID);
end;
procedure TWVBrowserBase.doOnEstimatedEndTimeChangedEvent(const sender: ICoreWebView2DownloadOperation; const args: IUnknown; aDownloadID : integer);
begin
if assigned(FOnEstimatedEndTimeChanged) then
FOnEstimatedEndTimeChanged(self, sender, aDownloadID);
end;
procedure TWVBrowserBase.doOnStateChangedEvent(const sender: ICoreWebView2DownloadOperation; const args: IUnknown; aDownloadID : integer);
begin
if assigned(FOnDownloadStateChanged) then
FOnDownloadStateChanged(self, sender, aDownloadID);
end;
procedure TWVBrowserBase.doOnFrameNameChangedEvent(const sender: ICoreWebView2Frame; const args: IUnknown; aFrameID : integer);
begin
if assigned(FOnFrameNameChanged) then
FOnFrameNameChanged(self, sender, aFrameID);
end;
procedure TWVBrowserBase.doOnFrameDestroyedEvent(const sender: ICoreWebView2Frame; const args: IUnknown; aFrameID : integer);
begin
if assigned(FOnFrameDestroyed) then
FOnFrameDestroyed(self, sender, aFrameID);
end;
procedure TWVBrowserBase.doOnCallDevToolsProtocolMethodCompletedEvent(aErrorCode: HRESULT; const aReturnObjectAsJson: wvstring; aExecutionID : integer);
begin
if assigned(FOnCallDevToolsProtocolMethodCompleted) then
FOnCallDevToolsProtocolMethodCompleted(self, aErrorCode, aReturnObjectAsJson, aExecutionID);
end;
procedure TWVBrowserBase.doOnAddScriptToExecuteOnDocumentCreatedCompletedEvent(aErrorCode: HRESULT; const aID : wvstring);
begin
if assigned(FOnAddScriptToExecuteOnDocumentCreatedCompleted) then
FOnAddScriptToExecuteOnDocumentCreatedCompleted(self, aErrorCode, aID);
end;
procedure TWVBrowserBase.UpdateZoomStep(aInc : boolean);
var
TempPct, TempPrev, TempNext : double;
i : integer;
begin
if not(Initialized) then exit;
if (FZoomStep in [ZOOM_STEP_MIN..ZOOM_STEP_MAX]) then
begin
if aInc then
begin
if (FZoomStep < ZOOM_STEP_MAX) then
begin
inc(FZoomStep);
UpdateZoomPct(ZoomStepValues[FZoomStep]);
end;
end
else
if (FZoomStep > ZOOM_STEP_MIN) then
begin
dec(FZoomStep);
UpdateZoomPct(ZoomStepValues[FZoomStep]);
end;
end
else
begin
TempPct := ZoomPct;
TempPrev := 0;
i := ZOOM_STEP_MIN;
repeat
if (i <= ZOOM_STEP_MAX) then
TempNext := ZoomStepValues[i]
else
TempNext := ZoomStepValues[ZOOM_STEP_MAX] * 2;
if (TempPct > TempPrev) and (TempPct < TempNext) then
begin
if aInc then
begin
if (i <= ZOOM_STEP_MAX) then
begin
FZoomStep := i;
UpdateZoomPct(ZoomStepValues[FZoomStep]);
end;
end
else
if (i > ZOOM_STEP_MIN) then
begin
FZoomStep := pred(i);
UpdateZoomPct(ZoomStepValues[FZoomStep]);
end;
i := ZOOM_STEP_MAX + 2;
end
else
begin
TempPrev := TempNext;
inc(i);
end;
until (i > succ(ZOOM_STEP_MAX));
end;
end;
procedure TWVBrowserBase.UpdateZoomPct(const aValue : double);
begin
if (aValue > 0) then
ZoomFactor := aValue / 100;
end;
end.
| 45.77027 | 227 | 0.706554 |
478ef0dc0be82450c793ad2e9169fb289d7133b5 | 5,861 | pas | Pascal | Components/JVCL/archive/JvgCGI.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | Components/JVCL/archive/JvgCGI.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | Components/JVCL/archive/JvgCGI.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| 1 | 2019-12-24T08:39:18.000Z | 2019-12-24T08:39:18.000Z | {-----------------------------------------------------------------------------
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/MPL-1.1.html
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: JvgCGI.PAS, released on 2003-01-15.
The Initial Developer of the Original Code is Andrey V. Chudin, [chudin att yandex dott ru]
Portions created by Andrey V. Chudin are Copyright (C) 2003 Andrey V. Chudin.
All Rights Reserved.
Contributor(s):
Michael Beck [mbeck att bigfoot dott com].
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.sourceforge.net
Known Issues:
-----------------------------------------------------------------------------}
// $Id: JvgCGI.pas,v 1.1 2005/09/09 09:43:29 marquardt Exp $
unit JvgCGI;
{$I jvcl.inc}
interface
uses
{$IFDEF USEJVCL}
{$IFDEF UNITVERSIONING}
JclUnitVersioning,
{$ENDIF UNITVERSIONING}
{$ENDIF USEJVCL}
Windows, SysUtils, Classes;
type
TJvgCGI = class(TObject)
private
FAutoHeaderAndFooter: Boolean;
procedure Split(const S: string);
procedure Decode(sl: TStringList);
public
// Names: TStringList;
// Values: TStringList;
Val: array [0..500] of Char;
Params: TStringList;
constructor Create(AutoHeaderAndFooter: Boolean);
destructor Destroy; override;
procedure InsertHeader;
procedure InsertFooter;
function ParamNameIndex(const Str: string): Integer; //...returns -1 if Name doesn't exist
function ParamValueIndex(const Str: string): Integer; //...returns -1 if Name doesn't exist
end;
{$IFDEF USEJVCL}
{$IFDEF UNITVERSIONING}
const
UnitVersioning: TUnitVersionInfo = (
RCSfile: '$RCSfile: JvgCGI.pas,v $';
Revision: '$Revision: 1.1 $';
Date: '$Date: 2005/09/09 09:43:29 $';
LogPath: 'JVCL\run'
);
{$ENDIF UNITVERSIONING}
{$ENDIF USEJVCL}
implementation
{$IFDEF USEJVCL}
uses
JvTypes;
{$ENDIF USEJVCL}
{$IFNDEF USEJVCL}
type
EJVCLException = class(Exception);
{$ENDIF !USEJVCL}
constructor TJvgCGI.Create(AutoHeaderAndFooter: Boolean);
//var
// sMsg: string;
begin
inherited Create;
if not IsConsole then
EJVCLException.Create('TJvgCGI not allowed in GUI application');
FillChar(Val, SizeOf(Val), #0);
Reset(Input);
// GET METHOD
GetEnvironmentVariable('QUERY_STRING', @Val, SizeOf(Val));
// POST METHOD
// if Val='' then
// begin Read(Input,Val); sMsg := 'Post'; end
// else sMsg := 'Get';
// MessageBox(0,Val, PChar(sMsg+' method detected.'),MB_OK); //exit;
FAutoHeaderAndFooter := AutoHeaderAndFooter;
if FAutoHeaderAndFooter then
InsertHeader;
Val := ' ';
//Val := 'order&p=5&u=55&c=98';
// Val := 'EDITION=Piter&?AUTHOR=&TITLE=%DF%E7%FB%EA+%EF%F0%EE%E3%F0%E0%EC%EC%E8%F0%EE%E2%E0%ED%E8%FF+%D4%EE%F0%F2&PB_ADD=%C4%EE%E1%E0%E2%E8%F2%FC';
// Names := TStringList.Create;
// Values := TStringList.Create;
Params := TStringList.Create;
if Length(string(Val)) > 0 then
begin
Split(Val);
// Decode( Values );
Decode(Params);
end;
end;
destructor TJvgCGI.Destroy;
begin
if FAutoHeaderAndFooter then
InsertFooter;
// Names.Free;
// Values.Free;
Params.Free;
inherited Destroy;
end;
procedure TJvgCGI.InsertHeader;
begin
Writeln('HTTP/1.0 200 OK');
Writeln('Date: Thursday, 12-Jan-96 16:04:30 GMT');
Writeln('Server: WebSite 1.0');
Writeln('Content-type: text/html');
Writeln('Last-modified: Thursday, 25-Jan-96 16:04:30 GMT');
Writeln('Content-length: 5000');
Writeln('');
end;
procedure TJvgCGI.InsertFooter;
begin
Writeln('Debug: ' + Val); //...debug
Writeln('<META IDENTITY CONTENT="' + IntToStr(Random(100000)) + '">');
Writeln('</BODY>');
Writeln('</HTML>');
end;
procedure TJvgCGI.Split(const S: string);
var
I, LastI: Integer;
procedure Extract(LastI, I: Integer);
// var
// J: Integer;
begin
{ J := LastI;
while (S[J]<>'=')and(S[J]<>#0) do inc(J);
Names.Add( Copy( S, LastI, J-LastI ) );
Values.Add( Copy( S, J+1, I-J-1 ) );}
Params.Add(Copy(S, LastI, I - LastI + 1));
end;
begin
I := 1;
LastI := 1;
while I < Length(S) do
begin
if (S[I] = '&') or (S[I] = '?') then
begin
Extract(LastI, I - 1);
LastI := I + 1;
end;
Inc(I);
end;
Extract(LastI, I + 1);
end;
procedure TJvgCGI.Decode(sl: TStringList);
var
I, J: Integer;
S: string;
begin
for I := 0 to sl.Count - 1 do
begin
S := sl[I];
for J := 1 to Length(S) do
if S[J] = '+' then
S[J] := ' '
else
if S[J] = '%' then
try
S := Copy(S, 0, J - 1) + Char(StrToInt('$' + Copy(S, J + 1, 2))) + Copy(S, J + 3, Length(S) - J - 2);
except
end;
if S[1] = '?' then
S := Copy(S, 2, Length(S) - 1);
sl[I] := S;
end;
end;
function TJvgCGI.ParamNameIndex(const Str: string): Integer;
var
I: Integer;
begin
for I := 0 to Params.Count - 1 do
if AnsiCompareText(Params.Names[I], Str) = 0 then
begin
Result := I;
Exit;
end;
Result := -1;
end;
function TJvgCGI.ParamValueIndex(const Str: string): Integer;
//var
// I: Integer;
begin
{ for I:=0 to Params.Count-1 do
if AnsiCompareText( Params.Values[I], Str ) = 0 then exit;
begin Result := I; exit; end;}
Result := -1;
end;
{$IFDEF USEJVCL}
{$IFDEF UNITVERSIONING}
initialization
RegisterUnitVersion(HInstance, UnitVersioning);
finalization
UnregisterUnitVersion(HInstance);
{$ENDIF UNITVERSIONING}
{$ENDIF USEJVCL}
end.
| 24.523013 | 151 | 0.632486 |
8525a0e80fb6661438435c925c991f3618d959f0 | 7,197 | dfm | Pascal | uFrameListsWordlist.dfm | Rootmarm/sentry-2.0 | f660c31c64b280758ee6a3d83234b1d9d9ea3dc1 | [
"MIT"
]
| 19 | 2018-01-06T14:41:59.000Z | 2022-02-09T14:26:09.000Z | uFrameListsWordlist.dfm | Rootmarm/sentry-2.0 | f660c31c64b280758ee6a3d83234b1d9d9ea3dc1 | [
"MIT"
]
| null | null | null | uFrameListsWordlist.dfm | Rootmarm/sentry-2.0 | f660c31c64b280758ee6a3d83234b1d9d9ea3dc1 | [
"MIT"
]
| 6 | 2018-03-17T22:19:50.000Z | 2021-01-25T14:02:21.000Z | object frmListsWordlist: TfrmListsWordlist
Left = 0
Top = 0
Width = 574
Height = 360
TabOrder = 0
DesignSize = (
574
360)
object cmdLoadWordlist: TSpeedButton
Left = 200
Top = 16
Width = 25
Height = 25
Hint = 'Open a Combo List'
Anchors = [akTop, akRight]
Flat = True
Glyph.Data = {
36030000424D3603000000000000360000002800000010000000100000000100
18000000000000030000CE0E0000D80E00000000000000000000FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF000000000000
000000000000000000000000000000000000000000000000000000FF00FFFF00
FFFF00FFFF00FFFF00FF00000000000000808000808000808000808000808000
8080008080008080008080000000FF00FFFF00FFFF00FFFF00FF00000000FFFF
0000000080800080800080800080800080800080800080800080800080800000
00FF00FFFF00FFFF00FF000000FFFFFF00FFFF00000000808000808000808000
8080008080008080008080008080008080000000FF00FFFF00FF00000000FFFF
FFFFFF00FFFF0000000080800080800080800080800080800080800080800080
80008080000000FF00FF000000FFFFFF00FFFFFFFFFF00FFFF00000000000000
000000000000000000000000000000000000000000000000000000000000FFFF
FFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFF000000FF00FFFF00
FFFF00FFFF00FFFF00FF000000FFFFFF00FFFFFFFFFF00FFFFFFFFFF00FFFFFF
FFFF00FFFFFFFFFF000000FF00FFFF00FFFF00FFFF00FFFF00FF00000000FFFF
FFFFFF00FFFF000000000000000000000000000000000000000000FF00FFFF00
FFFF00FFFF00FFFF00FFFF00FF000000000000000000FF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FF000000000000000000FF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF000000000000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FF000000FF00FFFF00FFFF00FF000000FF00FF000000FF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF000000000000000000FF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF}
ParentShowHint = False
ShowHint = True
OnClick = cmdLoadWordlistClick
end
object cmdWordlistClear: TSpeedButton
Left = 200
Top = 49
Width = 25
Height = 25
Hint = 'Clear current Combo List'
Anchors = [akTop, akRight]
Flat = True
Glyph.Data = {
36030000424D3603000000000000360000002800000010000000100000000100
18000000000000030000CE0E0000D80E00000000000000000000FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF000080000080808080FF00FFFF
00FFFF00FFFF00FFFF00FFFF00FF808080808080FF00FFFF00FFFF00FFFF00FF
000080000080000080000080808080FF00FFFF00FFFF00FFFF00FFFF00FF0000
80808080FF00FFFF00FFFF00FFFF00FFFF00FF00008000008000008000008080
8080FF00FFFF00FFFF00FF000080000080FF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FF000080000080000080808080808080FF00FF0000800000808080
80FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF00008000008000
0080808080808080000080000080FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FF000080000080000080000080000080FF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF80808000
0080000080000080808080FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FF808080808080000080000080000080000080808080808080FF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF80808000008000008000008000
0080FF00FF000080000080808080808080FF00FFFF00FFFF00FFFF00FFFF00FF
FF00FF000080000080000080FF00FFFF00FFFF00FFFF00FF0000800000808080
80808080FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FF000080000080FF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF}
ParentShowHint = False
ShowHint = True
OnClick = cmdWordlistClearClick
end
object GroupBox3: TGroupBox
Left = 248
Top = 8
Width = 145
Height = 105
Anchors = [akTop, akRight]
Caption = 'Set Length'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
TabOrder = 0
object Label3: TLabel
Left = 6
Top = 44
Width = 51
Height = 13
Caption = 'Username:'
end
object Label4: TLabel
Left = 91
Top = 44
Width = 9
Height = 13
Caption = 'to'
end
object Label6: TLabel
Left = 91
Top = 74
Width = 9
Height = 13
Caption = 'to'
end
object Label5: TLabel
Left = 8
Top = 76
Width = 49
Height = 13
Caption = 'Password:'
end
object chkLengthFilter: TCheckBox
Left = 8
Top = 16
Width = 119
Height = 17
Caption = 'Enable Length Filter'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
TabOrder = 0
end
object txtUsernameStart: TEdit
Left = 63
Top = 40
Width = 25
Height = 21
Ctl3D = True
ParentCtl3D = False
TabOrder = 1
Text = '6'
end
object txtUsernameEnd: TEdit
Left = 104
Top = 40
Width = 25
Height = 21
Ctl3D = True
ParentCtl3D = False
TabOrder = 2
Text = '8'
end
object txtPasswordEnd: TEdit
Left = 104
Top = 70
Width = 25
Height = 21
Ctl3D = True
ParentCtl3D = False
TabOrder = 3
Text = '8'
end
object txtPasswordStart: TEdit
Left = 63
Top = 70
Width = 25
Height = 21
Ctl3D = True
ParentCtl3D = False
TabOrder = 4
Text = '6'
end
end
object GroupBox1: TGroupBox
Left = 8
Top = 8
Width = 177
Height = 289
Anchors = [akLeft, akTop, akRight, akBottom]
Caption = 'Wordlist'
TabOrder = 1
DesignSize = (
177
289)
object lstCCombos: TListView
Left = 8
Top = 16
Width = 161
Height = 265
Anchors = [akLeft, akTop, akRight, akBottom]
Columns = <
item
AutoSize = True
Caption = 'Wordlist'
end>
OwnerData = True
ReadOnly = True
RowSelect = True
ShowColumnHeaders = False
TabOrder = 0
ViewStyle = vsReport
OnData = lstCCombosData
end
end
end
| 33.165899 | 71 | 0.711824 |
f1650b697c79b7e4d94ea08991e0cf572b419cba | 5,144 | pas | Pascal | crossinstallers/m_any_to_openbsdx64.pas | Moehre2/fpcupdeluxe | a427ed6e3b503b8ba295f8a818ca909c5a5bb34f | [
"zlib-acknowledgement"
]
| 198 | 2018-12-12T04:32:15.000Z | 2022-03-10T03:37:09.000Z | crossinstallers/m_any_to_openbsdx64.pas | djwisdom/fpcupdeluxe | 07a9ab12480f4c619e968d7f899ca2e13dade32b | [
"zlib-acknowledgement"
]
| 425 | 2018-11-13T12:53:45.000Z | 2022-03-29T14:39:59.000Z | crossinstallers/m_any_to_openbsdx64.pas | djwisdom/fpcupdeluxe | 07a9ab12480f4c619e968d7f899ca2e13dade32b | [
"zlib-acknowledgement"
]
| 55 | 2018-11-20T12:03:11.000Z | 2022-03-28T06:34:08.000Z | unit m_any_to_openbsdx64;
{ Cross compiles from any platform with correct binutils to openbsd ix64
Copyright (C) 2013 Reinier Olislagers
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version with the following modification:
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,and
to copy and distribute the resulting executable under terms of your choice,
provided that you also meet, for each linked independent module, the terms
and conditions of the license of that module. An independent module is a
module which is not derived from or based on this library. If you modify
this library, you may extend this exception to your version of the library,
but you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
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. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
m_crossinstaller;
implementation
type
{ TAny_OpenBSDx64 }
TAny_OpenBSDx64 = class(TCrossInstaller)
private
FAlreadyWarned: boolean; //did we warn user about errors and fixes already?
public
function GetLibs(Basepath:string):boolean;override;
{$ifndef FPCONLY}
function GetLibsLCL(LCL_Platform:string; Basepath:string):boolean;override;
{$endif}
function GetBinUtils(Basepath:string):boolean;override;
constructor Create;
destructor Destroy; override;
end;
{ TAny_OpenBSDx64 }
function TAny_OpenBSDx64.GetLibs(Basepath:string): boolean;
const
LibName='libc.so.95.0';
begin
result:=FLibsFound;
if result then exit;
// begin simple: check presence of library file in basedir
result:=SearchLibrary(Basepath,LibName);
// first search local paths based on libbraries provided for or adviced by fpc itself
if not result then
result:=SimpleSearchLibrary(BasePath,DirName,LibName);
SearchLibraryInfo(result);
if result then
begin
FLibsFound:=true;
//todo: check if -XR is needed for fpc root dir Prepend <x> to all linker search paths
//todo: implement -Xr for other platforms if this setup works
AddFPCCFGSnippet('-Xd'); {buildfaq 3.4.1 do not pass parent /lib etc dir to linker}
AddFPCCFGSnippet('-Fl'+IncludeTrailingPathDelimiter(FLibsPath)); {buildfaq 1.6.4/3.3.1: the directory to look for the target libraries}
//AddFPCCFGSnippet('-XR'+IncludeTrailingPathDelimiter(FLibsPath));
AddFPCCFGSnippet('-k--allow-shlib-undefined');
AddFPCCFGSnippet('-k--allow-multiple-definition');
AddFPCCFGSnippet('-Xr/usr/lib'); {buildfaq 3.3.1: makes the linker create the binary so that it searches in the specified directory on the target system for libraries}
end;
end;
{$ifndef FPCONLY}
function TAny_OpenBSDx64.GetLibsLCL(LCL_Platform: string; Basepath: string): boolean;
begin
// todo: get gtk at least, add to FFPCCFGSnippet
ShowInfo('Implement lcl libs path from basepath '+BasePath+' for platform '+LCL_Platform,etDebug);
result:=inherited;
end;
{$endif}
function TAny_OpenBSDx64.GetBinUtils(Basepath:string): boolean;
var
AsFile: string;
BinPrefixTry: string;
begin
result:=inherited;
if result then exit;
// Start with any names user may have given
AsFile:=FBinUtilsPrefix+'as'+GetExeExt;
result:=SearchBinUtil(BasePath,AsFile);
if not result then
result:=SimpleSearchBinUtil(BasePath,DirName,AsFile);
// Also allow for crossbinutils without prefix
if not result then
begin
BinPrefixTry:='';
AsFile:=BinPrefixTry+'as'+GetExeExt;
result:=SearchBinUtil(BasePath,AsFile);
if not result then result:=SimpleSearchBinUtil(BasePath,DirName,AsFile);
if result then FBinUtilsPrefix:=BinPrefixTry;
end;
SearchBinUtilsInfo(result);
if result then
begin
FBinsFound:=true;
// Configuration snippet for FPC
AddFPCCFGSnippet('-FD'+IncludeTrailingPathDelimiter(FBinUtilsPath)); {search this directory for compiler utilities}
AddFPCCFGSnippet('-XP'+FBinUtilsPrefix); {Prepend the binutils names}
end;
end;
constructor TAny_OpenBSDx64.Create;
begin
inherited Create;
FTargetCPU:=TCPU.x86_64;
FTargetOS:=TOS.openbsd;
Reset;
FAlreadyWarned:=false;
ShowInfo;
end;
destructor TAny_OpenBSDx64.Destroy;
begin
inherited Destroy;
end;
var
Any_OpenBSDx64:TAny_OpenBSDx64;
initialization
Any_OpenBSDx64:=TAny_OpenBSDx64.Create;
RegisterCrossCompiler(Any_OpenBSDx64.RegisterName,Any_OpenBSDx64);
finalization
Any_OpenBSDx64.Destroy;
end.
| 31.950311 | 171 | 0.773134 |
472aae307f27490d8d15531752b70a632423411e | 2,208 | pas | Pascal | headers_fmx/super_io_def.inc.pas | Dennis1000/c256-pasdev-units | d770322c50114ee33d33300df42699b967506a8b | [
"MIT"
]
| null | null | null | headers_fmx/super_io_def.inc.pas | Dennis1000/c256-pasdev-units | d770322c50114ee33d33300df42699b967506a8b | [
"MIT"
]
| null | null | null | headers_fmx/super_io_def.inc.pas | Dennis1000/c256-pasdev-units | d770322c50114ee33d33300df42699b967506a8b | [
"MIT"
]
| null | null | null | //Super IO Registers
const
PME_STS_REG = $AF1100;
PME_EN_REG = $AF1102;
PME_STS1_REG = $AF1104;
PME_STS2_REG = $AF1105;
PME_STS3_REG = $AF1106;
PME_STS4_REG = $AF1107;
PME_STS5_REG = $AF1108;
PME_EN1_REG = $AF110A;
PME_EN2_REG = $AF110B;
PME_EN3_REG = $AF110C;
PME_EN4_REG = $AF110D;
PME_EN5_REG = $AF110E;
SMI_STS1_REG = $AF1110;
SMI_STS2_REG = $AF1111;
SMI_STS3_REG = $AF1112;
SMI_STS4_REG = $AF1113;
SMI_STS5_REG = $AF1114;
SMI_EN1_REG = $AF1116;
SMI_EN2_REG = $AF1117;
SMI_EN3_REG = $AF1118;
SMI_EN4_REG = $AF1119;
SMI_EN5_REG = $AF111A;
MSC_ST_REG = $AF111C;
FORCE_DISK_CHANGE = $AF111E;
FLOPPY_DATA_RATE = $AF111F;
UART1_FIFO_CTRL_SHDW = $AF1120;
UART2_FIFO_CTRL_SHDW = $AF1121;
DEV_DISABLE_REG = $AF1122;
GP10_REG = $AF1123;
GP11_REG = $AF1124;
GP12_REG = $AF1125;
GP13_REG = $AF1126;
GP14_REG = $AF1127;
GP15_REG = $AF1128;
GP16_REG = $AF1129;
GP17_REG = $AF112A;
GP20_REG = $AF112B;
GP21_REG = $AF112C;
GP22_REG = $AF112D;
GP24_REG = $AF112F;
GP25_REG = $AF1130;
GP26_REG = $AF1131;
GP27_REG = $AF1132;
GP30_REG = $AF1133;
GP31_REG = $AF1134;
GP32_REG = $AF1135;
GP33_REG = $AF1136;
GP34_REG = $AF1137;
GP35_REG = $AF1138;
GP36_REG = $AF1139;
GP37_REG = $AF113A;
GP40_REG = $AF113B;
GP41_REG = $AF113C;
GP42_REG = $AF113D;
GP43_REG = $AF113E;
GP50_REG = $AF113F;
GP51_REG = $AF1140;
GP52_REG = $AF1141;
GP53_REG = $AF1142;
GP54_REG = $AF1143;
GP55_REG = $AF1144;
GP56_REG = $AF1145;
GP57_REG = $AF1146;
GP60_REG = $AF1147;
GP61_REG = $AF1148;
GP1_REG = $AF114B;
GP2_REG = $AF114C;
GP3_REG = $AF114D;
GP4_REG = $AF114E;
GP5_REG = $AF114F;
GP6_REG = $AF1150;
FAN1_REG = $AF1156;
FAN2_REG = $AF1157;
FAN_CTRL_REG = $AF1158;
FAN1_TACH_REG = $AF1159;
FAN2_TACH_REG = $AF115A;
FAN1_PRELOAD_REG = $AF115B;
FAN2_PRELOAD_REG = $AF115C;
LED1_REG = $AF115D;
LED2_REG = $AF115E;
KEYBOARD_SCAN_CODE = $AF115F;
| 26.285714 | 36 | 0.595109 |
f18e5ac4a6e6177ec54e442126f630c48ec504f7 | 1,731 | pas | Pascal | Source/PXL.Sysfs.ADC.pas | ultibohub/Asphyre | fae5a358774bc41a94df6080b302316589322407 | [
"Intel"
]
| 5 | 2018-08-23T02:58:11.000Z | 2021-02-28T05:10:08.000Z | Source/PXL.Sysfs.ADC.pas | amikey/asphyre | aed59514d5687184ada034d9c3776e0b7130644c | [
"Intel"
]
| 1 | 2017-09-03T06:53:03.000Z | 2017-09-03T06:53:03.000Z | Source/PXL.Sysfs.ADC.pas | amikey/asphyre | aed59514d5687184ada034d9c3776e0b7130644c | [
"Intel"
]
| 4 | 2016-10-31T09:49:17.000Z | 2021-06-09T00:40:43.000Z | unit PXL.Sysfs.ADC;
{
This file is part of Asphyre Framework, also known as Platform eXtended Library (PXL).
Copyright (c) 2000 - 2016 Yuriy Kotsarenko
The contents of this file are subject to the Mozilla Public 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.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.
}
interface
{$INCLUDE PXL.Config.inc}
uses
PXL.TypeDef, PXL.Sysfs.Types, PXL.Boards.Types;
type
TSysfsADC = class(TCustomADC)
private const
MaximumSupportedChannels = 64;
private
FSystemPath: StdString;
protected
function GetRawValue(const Channel: Integer): Integer; override;
public
constructor Create(const ASystemPath: StdString);
end;
EADCGeneric = class(ESysfsGeneric);
EADCInvalidChannel = class(EADCGeneric);
resourcestring
SADCSpecifiedChannelInvalid = 'The specified ADC channel <%d> is invalid.';
implementation
uses
SysUtils;
constructor TSysfsADC.Create(const ASystemPath: StdString);
begin
inherited Create;
FSystemPath := ASystemPath;
end;
function TSysfsADC.GetRawValue(const Channel: Integer): Integer;
begin
if (Channel < 0) or (Channel > MaximumSupportedChannels) then
raise EADCInvalidChannel.Create(Format(SADCSpecifiedChannelInvalid, [Channel]));
Result := StrToInt(Trim(ReadTextFromFile(FSystemPath + '/in_voltage' + IntToStr(Channel) + '_raw')));
end;
end.
| 28.377049 | 104 | 0.732525 |
476621fcb5a56ea98d0748477f463a5c623d2701 | 513 | pas | Pascal | touchcontrols_vcl.pas | randydom/commonx | 2315f1acf41167bd77ba4d040b3f5b15a5c5b81a | [
"MIT"
]
| 1 | 2020-08-25T00:02:54.000Z | 2020-08-25T00:02:54.000Z | touchcontrols_vcl.pas | wkfff/commonx | 787b9a4a1e7c02f55d81d2236b0cc9f332b38f53 | [
"MIT"
]
| null | null | null | touchcontrols_vcl.pas | wkfff/commonx | 787b9a4a1e7c02f55d81d2236b0cc9f332b38f53 | [
"MIT"
]
| 1 | 2020-08-25T00:02:55.000Z | 2020-08-25T00:02:55.000Z | unit touchcontrols_vcl;
interface
uses
stdctrls,windows,messages, classes;
type
TTouchButton = class(TButton)
public
constructor Create(aowner: TComponent);override;
procedure touch(var msg: TMessage);message WM_TOUCH;
end;
implementation
{ TTouchButton }
constructor TTouchButton.Create(aowner: TComponent);
begin
inherited;
end;
procedure TTouchButton.touch(var msg: TMessage);
begin
raise ECritical.create('unimplemented');
//TODO -cunimplemented: unimplemented block
end;
end.
| 14.657143 | 56 | 0.766082 |
8397ebbd62243abccbd4e426131515184c33e2c1 | 274 | dpr | Pascal | fontes/GrafanaLokiDelphi.dpr | GlerystonMatos/grafana-loki-delphi | 68490acdbe1e68e6f5006d4fd2aea341eac0e95f | [
"MIT"
]
| null | null | null | fontes/GrafanaLokiDelphi.dpr | GlerystonMatos/grafana-loki-delphi | 68490acdbe1e68e6f5006d4fd2aea341eac0e95f | [
"MIT"
]
| null | null | null | fontes/GrafanaLokiDelphi.dpr | GlerystonMatos/grafana-loki-delphi | 68490acdbe1e68e6f5006d4fd2aea341eac0e95f | [
"MIT"
]
| null | null | null | program GrafanaLokiDelphi;
uses
Vcl.Forms,
uPrincipal in 'uPrincipal.pas' {frmPrincipal};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TfrmPrincipal, frmPrincipal);
Application.Run;
end.
| 18.266667 | 55 | 0.722628 |
47763127e09f007ea078478622e68af85350790a | 20,390 | pas | Pascal | histogram2d.pas | PAmcconnell/MRIcroGL | 3dc8fe7c1318981c7e11aa286cc08d96a3908ceb | [
"BSD-2-Clause"
]
| 51 | 2016-02-21T20:09:59.000Z | 2021-02-28T16:53:56.000Z | histogram2d.pas | PAmcconnell/MRIcroGL | 3dc8fe7c1318981c7e11aa286cc08d96a3908ceb | [
"BSD-2-Clause"
]
| 37 | 2015-11-08T22:00:40.000Z | 2021-01-01T18:50:07.000Z | histogram2d.pas | PAmcconnell/MRIcroGL | 3dc8fe7c1318981c7e11aa286cc08d96a3908ceb | [
"BSD-2-Clause"
]
| 21 | 2016-02-21T20:10:08.000Z | 2021-02-23T20:32:10.000Z | unit histogram2d;
{$IFDEF FPC}{$mode objfpc}{$H+} {$ENDIF}
{$D-,L-,O+,Q-,R-,Y-,S-}
{$include opts.inc}
interface
uses
{$IFNDEF FPC}windows, {$ENDIF}
{$IFDEF USETRANSFERTEXTURE}texture_3d_unit_transfertexture, {$ELSE} texture_3d_unit,{$ENDIF}
{$IFDEF DGL} dglOpenGL, {$ELSE DGL} {$IFDEF COREGL}glcorearb, {$ELSE} gl, {$ENDIF} {$ENDIF DGL}
clut, define_types, Forms, Classes, Controls, prefs;
function ColorBoxPixels(WINDOW_HEIGHT,WINDOW_WIDTH: integer): integer;
procedure DrawNodes(WINDOW_HEIGHT,WINDOW_WIDTH: integer; Tex: TTexture; var lPrefs: TPrefs);
procedure ClutMouseDown(Button: TMouseButton; Shift: TShiftState; aX, aY: Integer);
procedure CLUTMouseMove(Shift: TShiftState; aX, aY: Integer);
function AddColorNode (lIntensity: byte) : integer;
implementation
uses raycast_common, mainunit
{$IFDEF COREGL} ,gl_2d, gl_core_matrix, slices2d{$ENDIF};
type
TChart2d = record
Left,Bottom,Height,Width: single;
rgba,historgba, backcolor: TGLRGBQuad;
end;
function ColorBoxPixels(WINDOW_HEIGHT,WINDOW_WIDTH: integer): integer;
begin
//ColorBoxSize(gRayCast.WINDOW_HEIGHT,gRayCast.WINDOW_WIDTH);
if (WINDOW_WIDTH >= 1536) and (WINDOW_HEIGHT >= 1024) then
result := 512
else
result := 256;
end;
procedure InterpolateRGBA(var lC1,lC2,lMix: TGLRGBQuad);
begin
lMix.rgbRed := (lC1.rgbRed + lC2.rgbRed) shr 1;
lMix.rgbGreen := (lC1.rgbGreen + lC2.rgbGreen) shr 1;
lMix.rgbBlue := (lC1.rgbBlue + lC2.rgbBlue) shr 1;
end;
procedure DeleteScrnNode (lSelectedNode: integer);
var
lN: integer;
begin
if (lSelectedNode = 0) or (lSelectedNode >= (gCLUTrec.numnodes-1)) then
exit; //out of range or edge node...
dec(gCLUTrec.numnodes); //if 3 now only 2...
if lSelectedNode < (gCLUTrec.numnodes) then begin
for lN := lSelectedNode to (gCLUTrec.numnodes-1) do
gCLUTrec.nodes[lN] := gCLUTrec.nodes[lN+1];
end;
end;
function AddColorNode (lIntensity: byte) : integer;
var
lP,lI,lInten: integer;
begin
lInten := lIntensity;
result := -1;//error
if (lInten <= gCLUTrec.nodes[0].intensity) then
exit;
if (lInten >= gCLUTrec.nodes[gCLUTrec.numnodes-1].intensity) then
exit;
lP := gCLUTrec.numnodes-1;
while lInten < gCLUTrec.nodes[lP].intensity do
dec(lP);
if abs(gCLUTrec.nodes[lP].intensity-gCLUTrec.nodes[lP+1].intensity) < 2 then
exit;
if lInten = gCLUTrec.nodes[lP].intensity then
lInten := gCLUTrec.nodes[lP].intensity+1;
if lInten = gCLUTrec.nodes[lP+1].intensity then
lInten := gCLUTrec.nodes[lP+1].intensity-1;
inc(lP);//location of new node
inc(gCLUTrec.numNodes);
for lI := (gCLUTrec.numnodes-1) downto (lP+1) do
gCLUTrec.nodes[lI] := gCLUTrec.nodes[lI-1];
gCLUTrec.nodes[lP].intensity := lInten;
result := lP;
end;
procedure AddScrnNode(lPt: TPoint);
var
lP: integer;
begin
if gCLUTrec.numnodes < 2 then exit;
if gCLUTrec.numnodes >= 255 then
exit;
//only add node between min and max - not more extreme!
if (lPt.X <= gCLUTrec.nodes[0].intensity) then
exit;
if (lPt.X >= gCLUTrec.nodes[gCLUTrec.numnodes-1].intensity) then
exit;
lP := AddColorNode(lPt.X);
if lP < 0 then
exit;
gCLUTrec.nodes[lP].rgba.rgbreserved := lPt.Y;
InterpolateRGBA(gCLUTrec.nodes[lP-1].rgba,gCLUTrec.nodes[lP+1].rgba,gCLUTrec.nodes[lP].rgba);
end;
procedure CLUTMouseMove(Shift: TShiftState; aX, aY: Integer);
var
x,y, lX,lY: integer;
begin
if not (SSLeft in Shift) then
exit;
y := ColorBoxPixels(gRayCast.WINDOW_HEIGHT,gRayCast.WINDOW_WIDTH);
x := round(aX * (256/y));
y := round(aY * (256/y));
if (gCLUTrec.numNodes < 1) or (gSelectedNode < 0) or (gCLUTrec.numnodes <= gSelectedNode ) then
exit;
lY := 255-Y;
if lY < 0 then lY := 0; if lY > 255 then lY := 255;
gCLUTrec.nodes[gSelectedNode].rgba.rgbReserved := lY;
if (gSelectedNode > 0) and (gSelectedNode <(gCLUTrec.numnodes-1)) then begin
lX := X;
if gSelectedNode > 0 then begin
if lX <= gCLUTrec.nodes[gSelectedNode-1].intensity then
lX := gCLUTrec.nodes[gSelectedNode-1].intensity+1;
end;
if gSelectedNode < (gCLUTrec.numnodes-1) then begin
if lX >= gCLUTrec.nodes[gSelectedNode+1].intensity then
lX := gCLUTrec.nodes[gSelectedNode+1].intensity-1;
end;
gCLUTrec.nodes[gSelectedNode].intensity := lX;
end;//node not first or last (min node must be zero, max node must be 255)
end;
procedure ClutMouseDown(Button: TMouseButton; Shift: TShiftState; aX, aY: Integer);
var
lI,lB,x,y: integer;
lDx,lDx2: single;
lPt: TPoint;
begin
y := ColorBoxPixels(gRayCast.WINDOW_HEIGHT,gRayCast.WINDOW_WIDTH);
x := round(aX * (256/y));
y := round(aY * (256/y));
gSelectedNode := 0;
if gCLUTrec.numNodes < 2 then
exit;
lPt := Point(X,255-Y);
if (SSCtrl in Shift) then begin //remove node
AddScrnNode(lPt);
gSelectedNode := -1;
GLForm1.UpdateTimer.Enabled:=true;
exit;
end;
lB := lPt.X;
lDx := (lB - gCLUTrec.nodes[0].intensity);
for lI := 1 to (gCLUTrec.numnodes-1) do begin
lDx2 := (lB - gCLUTrec.nodes[lI].intensity);
if abs(lDx2) < abs(lDx) then begin
gSelectedNode := lI;
lDx := lDx2;
end;
end; //check each node...
if (SSShift in Shift) then begin //remove node
DeleteScrnNode(gSelectedNode);
gSelectedNode := -1;
GLForm1.UpdateTimer.Enabled:=true;
end;
end;
{$IFDEF COREGL}
procedure SetColor (rgba: TGLRGBQuad);
begin
nglColor4ub(rgba.rgbRed,rgba.rgbGreen,rgba.rgbBlue,rgba.rgbReserved);
end;
procedure SetColorOpaque (rgba: TGLRGBQuad);
begin
nglColor4ub(rgba.rgbRed,rgba.rgbGreen,rgba.rgbBlue,255);
end;
procedure SetColorA (rgba: TGLRGBQuad; A: byte);
begin
nglColor4ub(rgba.rgbRed,rgba.rgbGreen,rgba.rgbBlue,A);
end;
procedure ShowHistogram (H: HistoRA; C: TChart2d; xC, yC: single);
var
ysum : double;
ny,xprev,x,y,i: integer;
procedure glVert(a,b, c: single);
begin
nglVertex3f(a+xC, b+yC, 0);
end;
begin
xprev := -666;
ny := 0;
ysum := 0;
nglBegin (GL_TRIANGLE_STRIP);
for i := 0 to (kHistoBins) do begin
x := round(i/kHistoBins*C.Width);
if x > (xprev+1) then begin
y := round( ((ysum+H[i])/(ny+1)) /kHistoBins*C.Height);
glVert (x, y, 0);
glVert (x, 0, 0);
xprev := x;
ny := 0;
ysum := 0;
end else begin
ysum := ysum + H[i];
inc(ny);
end;
end;
nglEnd;
end;
procedure ShowNodes (lCLUTrec: TCLUTrec; var C: TChart2d; Tex: TTexture);
const
kGridThick = 1;
kThick = 4;
ngrid = 4;
var
xC, yC,nsz,nsz2,x,y, linewid: single;
Cx: TChart2d;
i: integer;
procedure glVert(a,b, c: single);
begin
nglVertex3f(a+xC, b+yC, 0);
end;
begin
if lCLUTrec.numnodes < 2 then
exit;
nglPushMatrix; //?? save pixelspace scale
xC := C.Left;
yC := C.Bottom;
//nglTranslatef(C.Left,C.Bottom,0.0);//pixelspace space
//glScalef(C.Width,C.Height,0);//scaled...
glDisable(GL_DEPTH_TEST);
{$IFNDEF USETRANSFERTEXTURE}
x := abs(Tex.WindowScaledMax-Tex.WindowScaledMin);//range
if x = 0 then x := 1; //aoid divide by zero
nsz := (lCLUTrec.min-Tex.WindowScaledMin)/x*C.Width;
nsz2 := (lCLUTrec.max-Tex.WindowScaledMin)/x*C.Width;
if (lCLUTrec.min > lCLUTrec.max) then begin
y := nsz;
nsz := nsz2;
nsz2 := y;
end;
SetColor(C.rgba);
linewid := kGridThick*2;
nglBegin(GL_TRIANGLE_STRIP);
glVert (0+linewid, 0, 0);
glVert (nsz+linewid, -30, 0);
glVert (0, 0, 0);
glVert (nsz, -30, 0);
nglEnd;
nglBegin(GL_TRIANGLE_STRIP);
glVert (256, 0, 0);
glVert (nsz2, -30, 0);
glVert (256-linewid, 0, 0);
glVert (nsz2-linewid, -30, 0);
nglEnd;
{$ENDIF}
nsz := kThick+(2*kGridThick);//0.02*C.Width;
nsz2 := kThick;//0.01 * C.Width;
//dark background
SetColor(C.backcolor);//glColor4f(0,0,0,0.2);
nglBegin (GL_TRIANGLE_STRIP);
glVert(0, 0, 0);
glVert(C.Width, 0, 0);
glVert(0, C.Height, 0);
glVert(C.Width, C.Height, 0);
nglEnd;
//draw histogram
SetColor(C.historgba);
ShowHistogram(Tex.WindowHisto,C,xC, yC);
//frame
//glBlendFunc (GL_SRC_ALPHA, GL_ONE);//additive with colors beneath, does not look good with bright background
linewid := kGridThick;
//glLineWidth(kGridThick);
SetColor(C.rgba);
nglBegin (GL_LINE_STRIP);
glVert(0, 0, 0);
glVert(0+linewid, 0, 0);
glVert(0, C.Height, 0);
glVert(0+linewid, C.Height-LineWid, 0);
glVert(C.Width, C.Height, 0);
glVert(C.Width-LineWid, C.Height-LineWid, 0);
glVert(C.Width, 0, 0);
glVert(C.Width-LineWid, LineWid, 0);
glVert(LineWid, 0, 0);
glVert(LineWid, LineWid, 0);
nglEnd;
//grid
linewid := kGridThick/2;
SetColor(C.rgba);
if ngrid > 0 then begin
for i := 1 to ngrid do begin
x := C.Width* i/(ngrid+1);
nglBegin (GL_LINE_STRIP);
glVert(x-linewid, 0, 0);
glVert(x-linewid, C.Height, 0);
glVert(x+linewid, 0, 0);
glVert(x+linewid, C.Height, 0);
nglEnd;
nglBegin (GL_LINE_STRIP);
glVert(0, x-linewid, 0);
glVert(C.Width, x-linewid, 0);
glVert(0, x+linewid, 0);
glVert(C.Width, x+linewid, 0);
nglEnd;
end;
end;
//glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);//if historgram was additive, return to standard mode
//vertical bar
nglBegin (GL_LINE_STRIP);
SetColorA(C.rgba,0);
glVert(C.Width, 0, 0);
glVert(C.Width*1.05, 0, 0);
SetColorA(C.rgba,255);
glVert(C.Width, C.Height, 0);
glVert(C.Width*1.05, C.Height, 0);
nglEnd;
//horizontal bar
nglBegin (GL_LINE_STRIP);
nglColor4f(0,0,0,1);
glVert(0, 0, 0);
glVert(0, C.Height*-0.05, 0);
nglColor4f(1,1,1,1);
glVert(C.Width, 0, 0);
glVert(C.Width, C.Height*-0.05, 0);
nglEnd;
//lines between nodes
SetColor(C.rgba);
//glLineWidth(kThick*2);
linewid := kGridThick * 2;
nglBegin (GL_LINE_STRIP);
for i := 0 to (lCLUTrec.numnodes-1) do begin
x := C.Width*lCLUTrec.nodes[i].intensity/255;
y := C.Height * lCLUTrec.nodes[i].rgba.rgbReserved/255;
//glColor4f (x, x, x,0.7);
glVert(x, y+linewid, 0);
glVert(x, y-linewid, 0);
end;
nglEnd;
//now with node colors... inset
glLineWidth(kThick);
nglBegin (GL_LINE_STRIP);
for i := 0 to (lCLUTrec.numnodes-1) do begin
SetColorOpaque(lCLUTrec.nodes[i].rgba);
x := C.Width* lCLUTrec.nodes[i].intensity/255;
y := C.Height* lCLUTrec.nodes[i].rgba.rgbReserved/255;
//glColor4f (x, x, x,0.7);
glVert(x, y+linewid, 0);
glVert(x, y-linewid, 0);
end;
nglEnd;
//nodes
for i := 0 to (lCLUTrec.numnodes-1) do begin
x := C.Width*lCLUTrec.nodes[i].intensity/255;
y := C.Height* lCLUTrec.nodes[i].rgba.rgbReserved/255;
nglBegin (GL_LINE_STRIP);
//node borders
SetColor(C.rgba);
glVert(x-nsz, y-nsz, 0);
glVert(x-nsz, y+nsz, 0);
glVert(x+nsz, y-nsz, 0);
glVert(x+nsz, y+nsz, 0);
nglEnd;
//node centers
nglBegin (GL_LINE_STRIP);
SetColorOpaque(lCLUTrec.nodes[i].rgba);
glVert(x-nsz2, y-nsz2, 0);
glVert(x-nsz2, y+nsz2, 0);
glVert(x+nsz2, y-nsz2, 0);
glVert(x+nsz2, y+nsz2, 0);
nglEnd;
end;
glLineWidth(1);
{$IFNDEF USETRANSFERTEXTURE}
//nglTranslatef(0,-100,0.0);
yC := yC - 100;
Cx := C;
Cx.Height := 70;
x := abs(Tex.WindowScaledMax-Tex.WindowScaledMin);//range
if x = 0 then x := 1; //aoid divide by zero
nsz := (lCLUTrec.min-Tex.WindowScaledMin)/x*Cx.Width;
nsz2 := (lCLUTrec.max-Tex.WindowScaledMin)/x*Cx.Width;
SetColor(Cx.rgba);
nglBegin (GL_LINE_STRIP);
glVert(nsz, -2, 0);
glVert(nsz, Cx.Height, 0);
glVert(nsz2, -2, 0);
glVert(nsz2, Cx.Height, 0);
//glVertex3f (nsz, 0, 0);
nglEnd;
SetColor(Cx.historgba);
ShowHistogram(Tex.UnscaledHisto,Cx, xC, yC);
nglPopMatrix;
{$ENDIF}
end;
procedure DrawNodes(WINDOW_HEIGHT,WINDOW_WIDTH: integer; Tex: TTexture; var lPrefs: TPrefs);
var
C: TChart2d;
begin
Enter2D ;
StartDraw2D;
glEnable (GL_BLEND); //blend transparency bar with background
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_DEPTH_TEST);
C.rgba := lPrefs.GridAndBorder; //RGBA(96,96,128,196);
C.historgba := lPrefs.HistogramColor;// RGBA(96,48,96,196);
C.backcolor := lPrefs.HistogramBack;
C.Left := 1;
C.Bottom := WINDOW_HEIGHT-257;
C.Height := 256;
C.Width := 256;
ShowNodes(gCLUTrec,C, Tex);
EndDraw2D;
//glDisable (GL_BLEND); //blend transparency bar with background
end;
{$ELSE}
procedure SetColor (rgba: TGLRGBQuad);
begin
glColor4ub(rgba.rgbRed,rgba.rgbGreen,rgba.rgbBlue,rgba.rgbReserved);
end;
procedure SetColorOpaque (rgba: TGLRGBQuad);
begin
glColor4ub(rgba.rgbRed,rgba.rgbGreen,rgba.rgbBlue,255);
end;
procedure SetColorA (rgba: TGLRGBQuad; A: byte);
begin
glColor4ub(rgba.rgbRed,rgba.rgbGreen,rgba.rgbBlue,A);
end;
procedure ShowHistogram (H: HistoRA; C: TChart2d);
var
ysum : double;
ny,xprev,x,y,i: integer;
begin
xprev := -666;
ny := 0;
ysum := 0;
glBegin (GL_TRIANGLE_STRIP);
for i := 0 to (kHistoBins) do begin
x := round(i/kHistoBins*C.Width);
if x > (xprev+1) then begin
y := round( ((ysum+H[i])/(ny+1)) /kHistoBins*C.Height);
glVertex3f (x, y, 0);
glVertex3f (x, 0, 0);
xprev := x;
ny := 0;
ysum := 0;
end else begin
ysum := ysum + H[i];
inc(ny);
end;
end;
glEnd;
//glEnable(GL_MULTISAMPLE_ARB); //some NVidia cards have problems making consistent transparency when multisampling enabled
end;
procedure ShowNodes (lCLUTrec: TCLUTrec; var C: TChart2d; Tex: TTexture);
const
ngrid = 4;
var
nsz,nsz2,x,y, colorbarHeight: single;
Cx: TChart2d;
thick, gridThick,i: integer;
begin
if lCLUTrec.numnodes < 2 then
exit;
glPushMatrix; //?? save pixelspace scale
glTranslatef(C.Left,C.Bottom,0.0);//pixelspace space
//glScalef(C.Width,C.Height,0);//scaled...
glDisable(GL_DEPTH_TEST);
{$IFNDEF USETRANSFERTEXTURE}
x := abs(Tex.WindowScaledMax-Tex.WindowScaledMin);//range
if x = 0 then x := 1; //aoid divide by zero
nsz := (lCLUTrec.min-Tex.WindowScaledMin)/x*C.Width;
nsz2 := (lCLUTrec.max-Tex.WindowScaledMin)/x*C.Width;
if (lCLUTrec.min > lCLUTrec.max) then begin
y := nsz;
nsz := nsz2;
nsz2 := y;
end;
SetColor(C.rgba);
if C.Height > 320 then begin
gridThick := 2;
thick := 5;
end else begin
gridThick := 1;
thick := 4;
end;
glLineWidth(gridThick);
colorbarHeight :=C.Height*0.05;
glBegin(GL_LINES);
glVertex3f (0, -colorbarHeight, 0);
glVertex3f (nsz, - 2 * colorbarHeight, 0);
glVertex3f (C.Width, -colorbarHeight, 0);
glVertex3f (nsz2, -2 * colorbarHeight, 0);
glEnd;
{$ENDIF}
nsz := thick+(2*gridThick);//0.02*C.Width;
nsz2 := thick;//0.01 * C.Width;
//dark background
SetColor(C.backcolor);//glColor4f(0,0,0,0.2);
glBegin (GL_QUADS);
glVertex3f (0, thick, 0);
glVertex3f (C.Width, thick, 0);
glVertex3f (C.Width, C.Height+thick, 0);
glVertex3f (0, C.Height+thick, 0);
glEnd;
//draw histogram
SetColor(C.historgba);
ShowHistogram(Tex.WindowHisto,C);
//frame
//glBlendFunc (GL_SRC_ALPHA, GL_ONE);//additive with colors beneath, does not look good with bright background
glLineWidth(1);
SetColor(C.rgba);
glBegin (GL_LINE_STRIP);
//glColor4f (1, 1, 1,1);
glVertex3f (0, 0, 0);
glVertex3f (0, C.Height, 0);
glVertex3f (C.Width, C.Height, 0);
glVertex3f (C.Width, 0, 0);
//glVertex3f (0, 0, 0);
glEnd;
//grid
SetColor(C.rgba);
if ngrid > 0 then begin
for i := 1 to ngrid do begin
x := C.Width* i/(ngrid+1);
glBegin (GL_LINES);
glVertex3f (x, 0, 0);
glVertex3f (x, C.Height, 0);
glVertex3f (0, x, 0);
glVertex3f (C.Width, x, 0);
glEnd;
end;
end;
//glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);//if historgram was additive, return to standard mode
//vertical bar
glBegin (GL_QUADS);
SetColorA(C.rgba,0);
glVertex3f (C.Width, 0, 0);
glVertex3f (C.Width+colorbarHeight, 0, 0);
SetColorA(C.rgba,255);
glVertex3f (C.Width+colorbarHeight, C.Height, 0);
glVertex3f (C.Width, C.Height, 0);
glEnd;
//horizontal bar
glBegin (GL_QUADS);
glColor4f(0,0,0,1);
glVertex3f (0, 0, 0);
glVertex3f (0, -colorbarHeight, 0);
glColor4f(1,1,1,1);
glVertex3f (C.Width, -colorbarHeight, 0);
glVertex3f (C.Width, 0, 0);
glEnd;
//lines between nodes
SetColor(C.rgba);
glLineWidth(thick*2);
glBegin (GL_LINE_STRIP);
for i := 0 to (lCLUTrec.numnodes-1) do begin
x := C.Width*lCLUTrec.nodes[i].intensity/255;
y := C.Height * lCLUTrec.nodes[i].rgba.rgbReserved/255;
//glColor4f (x, x, x,0.7);
glVertex3f (x, y, 0);
end;
glEnd;
//now with node colors... inset
glLineWidth(thick);
glBegin (GL_LINE_STRIP);
for i := 0 to (lCLUTrec.numnodes-1) do begin
SetColorOpaque(lCLUTrec.nodes[i].rgba);
x := C.Width* lCLUTrec.nodes[i].intensity/255;
y := C.Height* lCLUTrec.nodes[i].rgba.rgbReserved/255;
//glColor4f (x, x, x,0.7);
glVertex3f (x, y, 0);
end;
glEnd;
//nodes
for i := 0 to (lCLUTrec.numnodes-1) do begin
x := C.Width*lCLUTrec.nodes[i].intensity/255;
y := C.Height* lCLUTrec.nodes[i].rgba.rgbReserved/255;
glBegin (GL_QUADS);
//node borders
SetColor(C.rgba);
glVertex3f (x-nsz, y-nsz, 0);
glVertex3f (x-nsz, y+nsz, 0);
glVertex3f (x+nsz, y+nsz, 0);
glVertex3f (x+nsz, y-nsz, 0);
glEnd;
//node centers
glBegin (GL_QUADS);
SetColorOpaque(lCLUTrec.nodes[i].rgba);
glVertex3f (x-nsz2, y-nsz2, 0);
glVertex3f (x-nsz2, y+nsz2, 0);
glVertex3f (x+nsz2, y+nsz2, 0);
glVertex3f (x+nsz2, y-nsz2, 0);
glEnd;
end;
glLineWidth(1);
{$IFNDEF USETRANSFERTEXTURE}
//glTranslatef(0,-100,0.0);
Cx := C;
//Cx.Height := 70;
Cx.Height := C.Height / 4;
//glTranslatef(0, -2*colorbarHeight,0.0);
glTranslatef(0, -Cx.Height-2*colorbarHeight,0.0);
x := abs(Tex.WindowScaledMax-Tex.WindowScaledMin);//range
if x = 0 then x := 1; //aoid divide by zero
nsz := (lCLUTrec.min-Tex.WindowScaledMin)/x*Cx.Width;
nsz2 := (lCLUTrec.max-Tex.WindowScaledMin)/x*Cx.Width;
SetColor(Cx.rgba);
glBegin (GL_QUADS);
glVertex3f (nsz, -2, 0);
glVertex3f (nsz, Cx.Height, 0);
glVertex3f (nsz2, Cx.Height, 0);
glVertex3f (nsz2, -2, 0);
//glVertex3f (nsz, 0, 0);
glEnd;
SetColor(Cx.historgba);
ShowHistogram(Tex.UnscaledHisto,Cx);
glPopMatrix;
{$ENDIF}
end;
procedure DrawNodes(WINDOW_HEIGHT,WINDOW_WIDTH: integer; Tex: TTexture; var lPrefs: TPrefs);
var
C: TChart2d;
begin
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho (0, WINDOW_WIDTH,0, WINDOW_HEIGHT, -1, 1); //gluOrtho2D (0, WINDOW_WIDTH,0, WINDOW_HEIGHT); https://www.opengl.org/sdk/docs/man2/xhtml/gluOrtho2D.xml
glEnable (GL_BLEND); //blend transparency bar with background
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
C.rgba := lPrefs.GridAndBorder; //RGBA(96,96,128,196);
C.historgba := lPrefs.HistogramColor;// RGBA(96,48,96,196);
C.backcolor := lPrefs.HistogramBack;
C.Height := ColorBoxPixels(WINDOW_HEIGHT,WINDOW_WIDTH);
C.Width := C.Height;
C.Left := 1;
C.Bottom := WINDOW_HEIGHT-C.Height-1;
ShowNodes(gCLUTrec,C, Tex);
end;
{$ENDIF}
end.
| 30.118168 | 162 | 0.615007 |
47054253170351c1bd4f9a2a0cad306193174fc5 | 12,309 | pas | Pascal | src/dependencies/cwRuntime/src/tests/cwVectors/testcase.cwvectors.evector2.pas | atkins126/cwVirtualMachine | c3ef2095a07402b16685adb4dc4243b9b519b90a | [
"BSD-3-Clause"
]
| null | null | null | src/dependencies/cwRuntime/src/tests/cwVectors/testcase.cwvectors.evector2.pas | atkins126/cwVirtualMachine | c3ef2095a07402b16685adb4dc4243b9b519b90a | [
"BSD-3-Clause"
]
| null | null | null | src/dependencies/cwRuntime/src/tests/cwVectors/testcase.cwvectors.evector2.pas | atkins126/cwVirtualMachine | c3ef2095a07402b16685adb4dc4243b9b519b90a | [
"BSD-3-Clause"
]
| null | null | null | {$ifdef license}
(*
Copyright 2020 ChapmanWorld LLC ( https://chapmanworld.com )
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be
used to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*)
{$endif}
unit testcase.cwvectors.evector2;
{$ifdef fpc}
{$mode delphiunicode}
{$modeswitch advancedrecords+}
{$modeswitch ArrayOperators-}
{$endif}
{$M+}
interface
uses
cwTest
, cwVectors
;
type
TTestVector2Extended = class(TTestCase)
published
/// <summary>
/// Tests addition in which the left term is a vector and the right
/// term is an array of float. (Returns result as a vector)
/// </summary>
procedure AddVA;
/// <summary>
/// Tests addition in which the left term is an array of float and the
/// right term is a vector. (Returns result as a vector)
/// </summary>
procedure AddAV;
/// <summary>
/// Tests addition in which the left term is a vector and the right
/// term is an array of float. (Returns result as a vector)
/// </summary>
procedure SubtractVA;
/// <summary>
/// Tests addition in which the left term is an array of float and the
/// right term is a vector. (Returns result as a vector)
/// </summary>
procedure SubtractAV;
/// <summary>
/// Tests addition in which the left term is a vector and the right
/// term is an array of float. (Returns result as a vector)
/// </summary>
procedure MultiplyVA;
/// <summary>
/// Tests addition in which the left term is an array of float and the
/// right term is a vector. (Returns result as a vector)
/// </summary>
procedure MultiplyAV;
/// <summary>
/// Tests addition in which the left term is a vector and the right
/// term is an array of float. (Returns result as a vector)
/// </summary>
procedure DivideVA;
/// <summary>
/// Tests addition in which the left term is an array of float and the
/// right term is a vector. (Returns result as a vector)
/// </summary>
procedure DivideAV;
/// <summary>
/// Tests the assignment of an array of floats to a vector.
/// </summary>
procedure ArrayAssign;
/// <summary>
/// Test addition of two Vector2 vectors.
/// </summary>
procedure Add;
/// <summary>
/// Test the addition of a float to a Vector2
/// </summary>
procedure AddF;
/// <summary>
/// Test subtraction of a Vector2 from a Vector2
/// </summary>
procedure Subtract;
/// <summary>
/// Test subtraction of a float from a Vector2
/// </summary>
procedure SubtractF;
/// <summary>
/// Test the multiplication of a Vector2 by another Vector2
/// (Hadamard multiplication)
/// </summary>
procedure Multiply;
/// <summary>
/// Test the multiplication of a Vector2 by a float.
/// </summary>
procedure MultiplyF;
/// <summary>
/// Test the division of a Vector2 by another Vector2.
/// (element-wise)
/// </summary>
procedure Divide;
/// <summary>
/// Test the division of a Vector2 by a float.
/// </summary>
procedure DivideF;
/// <summary>
/// Test the create method to create a Vector2 assigned from two
/// floats passed as X and Y.
/// </summary>
procedure CreateXY;
/// <summary>
/// Test the dotProduct calculation of a Vector2 with a Vector2.
/// </summary>
procedure dot;
/// <summary>
/// Test the Normalized calculation of a Vector2 (create unit vector)
/// </summary>
procedure Normalized;
/// <summary>
/// Test the magnitude calculation of a Vector2.
/// </summary>
procedure Magnitude;
end;
implementation
uses
cwTest.Standard
;
procedure TTestVector2Extended.Add;
var
V1, V2, V3: eVector2;
begin
// Arrange:
V1 := eVector2.Create(5,6);
V2 := eVector2.Create(2,3);
// Act:
V3 := V1 + V2;
// Assert:
TTest.IsTrue( ((V3.X > 6.99 ) and (V3.X < 7.01)) );
TTest.IsTrue( ((V3.Y > 8.99 ) and (V3.Y < 9.01)) );
end;
procedure TTestVector2Extended.AddAV;
var
V: eVector2;
R: eVector2;
begin
// Arrange:
V := [ 2, 3 ]; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Act:
R := [ 4, 6 ];
R := R + V; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Assert:
TTest.IsTrue( ((R.X > 5.99 ) and (R.X < 6.01)) );
TTest.IsTrue( ((R.Y > 8.99 ) and (R.Y < 9.01)) );
end;
procedure TTestVector2Extended.AddF;
var
V1, V2: eVector2;
begin
// Arrange:
V1 := eVector2.Create(5,6);
// Act:
V2 := V1 + 2;
// Assert:
TTest.IsTrue( ((V2.X > 6.99 ) and (V2.X < 7.01)) );
TTest.IsTrue( ((V2.Y > 7.99 ) and (V2.Y < 8.01)) );
end;
procedure TTestVector2Extended.AddVA;
var
V: eVector2;
R: eVector2;
begin
// Arrange:
V := [ 2, 3 ]; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Act:
R := [ 4, 6 ];
R := V + R; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Assert:
TTest.IsTrue( ((R.X > 5.99 ) and (R.X < 6.01)) );
TTest.IsTrue( ((R.Y > 8.99 ) and (R.Y < 9.01)) );
end;
procedure TTestVector2Extended.ArrayAssign;
var
V: eVector2;
begin
// Arrange:
// Act:
V := [1,2]; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Assert:
TTest.IsTrue( ((V.X > 0.99 ) and (V.X < 1.01)) );
TTest.IsTrue( ((V.Y > 1.99 ) and (V.Y < 2.01)) );
end;
procedure TTestVector2Extended.CreateXY;
var
V1: eVector2;
begin
// Arrange:
// Act:
V1 := eVector2.Create(5,6);
// Assert:
TTest.IsTrue( ((V1.X > 4.99 ) and (V1.X < 5.01)) );
TTest.IsTrue( ((V1.Y > 5.99 ) and (V1.Y < 6.01)) );
end;
procedure TTestVector2Extended.Divide;
var
V1, V2, V3: eVector2;
begin
// Arrange:
V1 := eVector2.Create(5,6);
V2 := eVector2.Create(2,3);
// Act:
V3 := V1 / V2;
// Assert:
TTest.IsTrue( ((V3.X > 2.49 ) and (V3.X < 2.51)) );
TTest.IsTrue( ((V3.Y > 1.99 ) and (V3.Y < 2.01)) );
end;
procedure TTestVector2Extended.DivideAV;
var
V: eVector2;
R: eVector2;
begin
// Arrange:
V := [ 2, 3 ]; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Act:
R := [ 4, 3 ];
R := R / V; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Assert:
TTest.IsTrue( ((R.X > 1.99 ) and (R.X < 2.01)) );
TTest.IsTrue( ((R.Y > 0.99 ) and (R.Y < 1.01)) );
end;
procedure TTestVector2Extended.DivideF;
var
V1, V2: eVector2;
begin
// Arrange:
V1 := eVector2.Create(5,6);
// Act:
V2 := V1 / 2;
// Assert:
TTest.IsTrue( ((V2.X > 2.49 ) and (V2.X < 2.51)) );
TTest.IsTrue( ((V2.Y > 2.99 ) and (V2.Y < 3.01)) );
end;
procedure TTestVector2Extended.DivideVA;
var
V: eVector2;
R: eVector2;
begin
// Arrange:
V := [ 4, 3 ]; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Act:
R := [ 2, 3 ];
R := V / R; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Assert:
TTest.IsTrue( ((R.X > 1.99 ) and (R.X < 2.01)) );
TTest.IsTrue( ((R.Y > 0.99 ) and (R.Y < 1.01)) );
end;
procedure TTestVector2Extended.dot;
var
V1, V2: eVector2;
F: extended;
begin
// Arrange:
V1 := eVector2.Create(5,6);
V2 := eVector2.Create(2,3);
// Act:
F := V1.dot(V2);
// Assert:
TTest.IsTrue((F > 27.99 ) and (F < 28.01));
end;
procedure TTestVector2Extended.Magnitude;
var
V1: eVector2;
F: extended;
begin
// Arrange:
V1 := eVector2.Create(2,5);
// Act:
F := V1.magnitude;
// Assert:
TTest.IsTrue((F > 5.37) and (F < 5.39));
end;
procedure TTestVector2Extended.Multiply;
var
V1, V2, V3: eVector2;
begin
// Arrange:
V1 := eVector2.Create(5,6);
V2 := eVector2.Create(7,2);
// Act:
V3 := V1 * V2;
// Assert:
TTest.IsTrue((V3.X > 34.99) and (V3.X < 35.01));
TTest.IsTrue((V3.Y > 11.99) and (V3.Y < 12.01));
end;
procedure TTestVector2Extended.MultiplyAV;
var
V: eVector2;
R: eVector2;
begin
// Arrange:
V := [ 4, 3 ]; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Act:
R := [ 2, 3 ];
R := R * V; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Assert:
TTest.IsTrue( ((R.X > 7.99 ) and (R.X < 8.01)) );
TTest.IsTrue( ((R.Y > 8.99 ) and (R.Y < 9.01)) );
end;
procedure TTestVector2Extended.MultiplyF;
var
V1, V2: eVector2;
begin
// Arrange:
V1 := eVector2.Create( 5, 6 );
// Act:
V2 := V1 * 3;
// Assert:
TTest.IsTrue((V2.X > 14.99) and (V2.X < 15.01));
TTest.IsTrue((V2.Y > 17.99) and (V2.Y < 18.01));
end;
procedure TTestVector2Extended.MultiplyVA;
var
V: eVector2;
R: eVector2;
begin
// Arrange:
V := [ 4, 3 ]; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Act:
R := [ 2, 3 ];
R := V * R; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Assert:
TTest.IsTrue( ((R.X > 7.99 ) and (R.X < 8.01)) );
TTest.IsTrue( ((R.Y > 8.99 ) and (R.Y < 9.01)) );
end;
procedure TTestVector2Extended.Normalized;
var
V1, V2: eVector2;
begin
// Arrange:
V1 := eVector2.Create( 2, 5 );
// Act:
V2 := V1.normalized;
// Assert:
TTest.IsTrue((V2.X > 0.36) and (V2.X < 0.372));
TTest.IsTrue((V2.Y > 0.91) and (V2.Y < 0.930));
end;
procedure TTestVector2Extended.Subtract;
var
V1, V2, V3: eVector2;
begin
// Arrange:
V1 := eVector2.Create( 8, 6 );
V2 := eVector2.Create( 4, 2 );
// Act:
V3 := V1 - V2;
// Assert:
TTest.IsTrue((V3.X > 3.99) and (V3.X < 4.01));
TTest.IsTrue((V3.Y > 3.99) and (V3.Y < 4.01));
end;
procedure TTestVector2Extended.SubtractAV;
var
V: eVector2;
R: eVector2;
begin
// Arrange:
V := [ 2, 3 ]; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Act:
R := [ 4, 6 ];
R := R - V; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Assert:
TTest.IsTrue( ((R.X > 1.99 ) and (R.X < 2.01)) );
TTest.IsTrue( ((R.Y > 2.99 ) and (R.Y < 3.01)) );
end;
procedure TTestVector2Extended.SubtractF;
var
V1, V2: eVector2;
begin
// Arrange:
V1 := eVector2.Create( 8, 6 );
// Act:
V2 := V1 - 2;
// Assert:
TTest.IsTrue((V2.X > 5.99) and (V2.X < 6.01));
TTest.IsTrue((V2.Y > 3.99) and (V2.Y < 4.01));
end;
procedure TTestVector2Extended.SubtractVA;
var
V: eVector2;
R: eVector2;
begin
// Arrange:
V := [ 4, 6 ]; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Act:
R := [ 2, 3 ];
R := V - R; // FPC Bug [0035061] https://bugs.freepascal.org/view.php?id=35061 RESOLVED
// Assert:
TTest.IsTrue( ((R.X > 1.99 ) and (R.X < 2.01)) );
TTest.IsTrue( ((R.Y > 2.99 ) and (R.Y < 3.01)) );
end;
initialization
TestSuite.RegisterTestCase(TTestVector2Extended);
end.
| 26.245203 | 99 | 0.615728 |
83e8c8a724484ac105fc76e60c30c8585360af1e | 334 | dpr | Pascal | Capitulo3/8.ClassHelper/ClassHelper.dpr | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 10 | 2017-08-02T00:44:41.000Z | 2021-10-13T21:11:28.000Z | Capitulo3/8.ClassHelper/ClassHelper.dpr | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 10 | 2019-12-30T04:09:37.000Z | 2022-03-02T06:06:19.000Z | Capitulo3/8.ClassHelper/ClassHelper.dpr | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 9 | 2017-04-29T16:12:21.000Z | 2020-11-11T22:16:32.000Z | program ClassHelper;
uses
Vcl.Forms,
Form.Principal in 'Form.Principal.pas' {frmPrincipal},
Classe.Helper.ForEach.DataSet in 'Classe.Helper.ForEach.DataSet.pas';
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TfrmPrincipal, frmPrincipal);
Application.Run;
end.
| 20.875 | 71 | 0.763473 |
474f309495e007296810d6e1dc0e65505f1f4e04 | 17,054 | pas | Pascal | lazarus/lcl/interfaces/gtk2/gtk2cellrenderer.pas | rarnu/golcl-liblcl | 6f238af742857921062365656a1b13b44b2330ce | [
"Apache-2.0"
]
| null | null | null | lazarus/lcl/interfaces/gtk2/gtk2cellrenderer.pas | rarnu/golcl-liblcl | 6f238af742857921062365656a1b13b44b2330ce | [
"Apache-2.0"
]
| null | null | null | lazarus/lcl/interfaces/gtk2/gtk2cellrenderer.pas | rarnu/golcl-liblcl | 6f238af742857921062365656a1b13b44b2330ce | [
"Apache-2.0"
]
| null | null | null | { $Id: gtk2wsstdctrls.pp 9520 2006-06-28 21:26:52Z mattias $}
{
*****************************************************************************
* Gtk2CellRenderer.pas *
* -------------------- *
* *
* *
*****************************************************************************
*****************************************************************************
This file is part of the Lazarus Component Library (LCL)
See the file COPYING.modifiedLGPL.txt, included in this distribution,
for details about the license.
*****************************************************************************
An extended gtk_cell_renderer, to provide hooks for the LCL.
For example for custom drawing.
}
unit Gtk2CellRenderer;
{$mode objfpc}{$H+}
interface
uses
// RTL
Classes, SysUtils,
gtk2, gdk2, glib2,
// LCL
LCLType, LCLProc, Controls, StdCtrls, ComCtrls, LMessages,
Gtk2Int, Gtk2Proc, Gtk2Def;
type
PLCLIntfCellRenderer = ^TLCLIntfCellRenderer;
TLCLIntfCellRenderer = record
// ! the TextRenderer must be the first attribute of this record !
TextRenderer: TGtkCellRendererText;
Index: integer;
ColumnIndex: Integer; // for TListView
end;
PLCLIntfCellRendererClass = ^TLCLIntfCellRendererClass;
TLCLIntfCellRendererClass = record
ParentClass: TGtkCellRendererTextClass;
DefaultGtkGetSize: procedure(cell: PGtkCellRenderer;
widget: PGtkWidget;
cell_area: PGdkRectangle;
x_offset: pgint;
y_offset: pgint;
width: pgint;
height: pgint); cdecl;
DefaultGtkRender: procedure(cell: PGtkCellRenderer;
window: PGdkWindow;
widget: PGtkWidget;
background_area: PGdkRectangle;
cell_area: PGdkRectangle;
expose_area:PGdkRectangle;
flags: TGtkCellRendererState); cdecl;
end;
function LCLIntfCellRenderer_GetType: TGtkType;
function LCLIntfCellRenderer_New: PGtkCellRenderer;
procedure LCLIntfCellRenderer_CellDataFunc(cell_layout:PGtkCellLayout;
cell: PGtkCellRenderer;
tree_model: PGtkTreeModel;
iter: PGtkTreeIter;
data: gpointer); cdecl;
implementation
uses
Gtk2Extra;
type
TCustomListViewAccess = class(TCustomListView);
function GetControl(cell: PGtkCellRenderer; Widget: PGtkWidget): TWinControl;
var
WidgetInfo: PWidgetInfo;
LCLObject: TObject;
MainWidget: PGtkWidget;
begin
Result := nil;
MainWidget := GetMainWidget(Widget);
if MainWidget = nil then
exit;
WidgetInfo := GetWidgetInfo(MainWidget);
if WidgetInfo = nil then
WidgetInfo := GetWidgetInfo(cell);
if WidgetInfo = nil then
exit;
LCLObject := WidgetInfo^.LCLObject; // the listbox or combobox
Result := LCLObject as TWinControl;
end;
function GetItemIndex(cell: PLCLIntfCellRenderer; {%H-}widget: PGtkWidget): Integer;
begin
Result:=cell^.Index;
end;
procedure LCLIntfCellRenderer_GetSize(cell: PGtkCellRenderer; widget: PGtkWidget;
cell_area: PGdkRectangle; x_offset, y_offset, width, height: pgint); cdecl;
var
CellClass: PLCLIntfCellRendererClass;
AWinControl: TWinControl;
ItemIndex: Integer;
Msg: TLMMeasureItem;
MeasureItemStruct: TMeasureItemStruct;
begin
CellClass:=PLCLIntfCellRendererClass(gtk_object_get_class(cell));
CellClass^.DefaultGtkGetSize(cell, Widget, cell_area, x_offset, y_offset,
width, height);
// DebugLn(['LCLIntfCellRenderer_GetSize ',GetWidgetDebugReport(Widget)]);
AWinControl := GetControl(cell, widget);
if [csDestroying,csLoading]*AWinControl.ComponentState<>[] then exit;
if AWinControl is TCustomListbox then
if TCustomListbox(AWinControl).Style < lbOwnerDrawFixed then
exit;
if AWinControl is TCustomCombobox then
if not TCustomCombobox(AWinControl).Style.IsVariable then
exit;
ItemIndex := GetItemIndex(PLCLIntfCellRenderer(cell), Widget);
if ItemIndex < 0 then
ItemIndex := 0;
MeasureItemStruct.itemID := UINT(ItemIndex);
MeasureItemStruct.itemWidth := UINT(width^);
MeasureItemStruct.itemHeight := UINT(height^);
Msg.Msg := LM_MEASUREITEM;
Msg.MeasureItemStruct := @MeasureItemStruct;
DeliverMessage(AWinControl, Msg);
width^ := gint(MeasureItemStruct.itemWidth);
height^ := gint(MeasureItemStruct.itemHeight);
end;
function GtkCellRendererStateToListViewDrawState(CellState: TGtkCellRendererState): TCustomDrawState;
begin
Result := [];
if CellState and GTK_CELL_RENDERER_SELECTED > 0 then Result := Result + [cdsSelected];
if CellState and GTK_CELL_RENDERER_PRELIT > 0 then Result := Result + [cdsHot];
if CellState and GTK_CELL_RENDERER_INSENSITIVE > 0 then Result := Result + [cdsDisabled, cdsGrayed];
if CellState and GTK_CELL_RENDERER_FOCUSED > 0 then Result := Result + [cdsFocused];
end;
procedure LCLIntfCellRenderer_Render(cell: PGtkCellRenderer; Window: PGdkWindow;
Widget: PGtkWidget; background_area: PGdkRectangle; cell_area: PGdkRectangle;
expose_area: PGdkRectangle; flags: TGtkCellRendererState); cdecl;
var
CellClass: PLCLIntfCellRendererClass;
AWinControl: TWinControl;
ItemIndex: Integer;
ColumnIndex: Integer;
AreaRect: TRect;
State: TOwnerDrawState;
Msg: TLMDrawListItem;
DCWidget: PGtkWidget;
LVTarget: TCustomDrawTarget;
LVStage: TCustomDrawStage;
LVState: TCustomDrawState;
LVSubItem: Integer;
TmpDC1,
TmpDC2: HDC;
SkipDefaultPaint: Boolean;
OwnerDrawnListView: Boolean;
begin
{DebugLn(['LCLIntfCellRenderer_Render cell=',dbgs(cell),
' ',GetWidgetDebugReport(Widget),' ',
' background_area=',dbgGRect(background_area),
' cell_area=',dbgGRect(cell_area),
' expose_area=',dbgGRect(expose_area)]);}
ColumnIndex := PLCLIntfCellRenderer(cell)^.ColumnIndex;
AWinControl := GetControl(cell, widget);
if (ColumnIndex = -1) and (AWinControl <> nil) and
(AWinControl.FCompStyle = csListView) then
ColumnIndex := 0;
OwnerDrawnListView := False;
if ColumnIndex > -1 then // listview
begin
OwnerDrawnListView := TCustomListViewAccess(AWinControl).OwnerDraw and
(TCustomListViewAccess(AWinControl).ViewStyle = vsReport);
AreaRect := Bounds(background_area^.x, background_area^.y,
background_area^.Width, background_area^.Height);
ItemIndex := GetItemIndex(PLCLIntfCellRenderer(cell), Widget);
if ItemIndex < 0 then
ItemIndex := 0;
if ColumnIndex > 0 then
LVTarget := dtSubItem
else
LVTarget := dtItem;
if AWinControl.FCompStyle = csListView then
LVSubItem := ColumnIndex
else
LVSubItem := ColumnIndex - 1;
LVStage := cdPrePaint;
LVState := GtkCellRendererStateToListViewDrawState(flags);
DCWidget:=Widget;
TmpDC1:=GTK2WidgetSet.CreateDCForWidget(DCWidget,Window,false);
TmpDC2 := TCustomListViewAccess(AWinControl).Canvas.Handle;
TCustomListViewAccess(AWinControl).Canvas.Handle := TmpDC1;
// paint
SkipDefaultPaint := cdrSkipDefault in TCustomListViewAccess(AWinControl).IntfCustomDraw(LVTarget, LVStage, ItemIndex, LVSubItem, LVState, @AreaRect);
if SkipDefaultPaint then
begin
GTK2WidgetSet.ReleaseDC(HWnd({%H-}PtrUInt(Widget)),TmpDC1);
TCustomListViewAccess(AWinControl).Canvas.Handle := TmpDC2;
if not OwnerDrawnListView then
Exit;
end;
end;
// draw default
CellClass := PLCLIntfCellRendererClass(gtk_object_get_class(cell));
// do not call DefaultGtkRender when we are custom drawn listbox.issue #23093
if ColumnIndex < 0 then
begin
if [csDestroying,csLoading,csDesigning]*AWinControl.ComponentState<>[] then
AWinControl := nil;
if AWinControl is TCustomListbox then
if TCustomListbox(AWinControl).Style = lbStandard then
AWinControl := nil;
if AWinControl is TCustomCombobox then
AWinControl := nil;
end;
// do default draw only if we are not customdrawn.
if (ColumnIndex > -1) or ((ColumnIndex < 0) and (AWinControl = nil)) then
begin
if not OwnerDrawnListView then
CellClass^.DefaultGtkRender(cell, Window, Widget, background_area, cell_area,
expose_area, flags);
end;
if ColumnIndex < 0 then // is a listbox or combobox
begin
// send LM_DrawListItem message
AWinControl := GetControl(cell, widget);
if [csDestroying,csLoading]*AWinControl.ComponentState<>[] then exit;
// check if the LCL object wants item paint messages
if AWinControl is TCustomListbox then
if TCustomListbox(AWinControl).Style = lbStandard then
exit;
if AWinControl is TCustomCombobox then
if not TCustomCombobox(AWinControl).Style.IsOwnerDrawn then
exit;
// get itemindex and area
AreaRect := Bounds(background_area^.x, background_area^.y,
background_area^.Width, background_area^.Height);
ItemIndex := GetItemIndex(PLCLIntfCellRenderer(cell), Widget);
if ItemIndex < 0 then
ItemIndex := 0;
// collect state flags
State:=[odBackgroundPainted];
if (flags and GTK_CELL_RENDERER_SELECTED)>0 then
Include(State, odSelected);
if not GTK_WIDGET_SENSITIVE(Widget) then
Include(State, odInactive);
if GTK_WIDGET_HAS_DEFAULT(Widget) then
Include(State, odDefault);
if (flags and GTK_CELL_RENDERER_FOCUSED) <> 0 then
Include(State, odFocused);
if AWinControl is TCustomCombobox then begin
if TCustomComboBox(AWinControl).DroppedDown
and ((flags and GTK_CELL_RENDERER_PRELIT)>0) then
Include(State,odSelected);
end;
end
else // is a listview
begin
LVStage := cdPostPaint;
// paint
TCustomListViewAccess(AWinControl).IntfCustomDraw(LVTarget, LVStage, ItemIndex, LVSubItem, LVState, @AreaRect);
TCustomListViewAccess(AWinControl).Canvas.Handle := TmpDC2;
GTK2WidgetSet.ReleaseDC(HWnd({%H-}PtrUInt(Widget)),TmpDC1);
if not OwnerDrawnListView then
Exit;
end;
// ListBox and ComboBox
// create message and deliverFillChar(Msg,SizeOf(Msg),0);
if OwnerDrawnListView then
begin
// we are TListView (GtkTreeView) with OwnerDraw + vsReport
Msg.Msg := CN_DRAWITEM;
// collect state flags
State := [];
if (flags and GTK_CELL_RENDERER_SELECTED)>0 then
Include(State, odSelected);
if not GTK_WIDGET_SENSITIVE(Widget) then
Include(State, odInactive);
if GTK_WIDGET_HAS_DEFAULT(Widget) then
Include(State, odDefault);
if (flags and GTK_CELL_RENDERER_FOCUSED) <> 0 then
Include(State, odFocused);
AreaRect := Bounds(expose_area^.x, expose_area^.y,
expose_area^.Width, expose_area^.Height);
if gtk_tree_view_get_headers_visible(PGtkTreeView(Widget)) then
begin
inc(AreaRect.Top, background_area^.height);
inc(AreaRect.Bottom, background_area^.height);
end;
end else
Msg.Msg:=LM_DrawListItem;
New(Msg.DrawListItemStruct);
try
FillChar(Msg.DrawListItemStruct^,SizeOf(TDrawListItemStruct),0);
with Msg.DrawListItemStruct^ do
begin
ItemID:=UINT(ItemIndex);
Area:=AreaRect;
// DebugLn(['LCLIntfCellRenderer_Render Widget=',GetWidgetDebugReport(Widget^.parent),' Area=',dbgs(Area)]);
DCWidget:=Widget;
if (DCWidget^.parent<>nil) and
(GtkWidgetIsA(DCWidget^.parent,gtk_menu_item_get_type)) then
begin
// the Widget is a sub widget of a menu item
// -> allow the LCL to paint over the whole menu item
DCWidget := DCWidget^.parent;
Area:=Rect(0,0,DCWidget^.allocation.width,DCWidget^.allocation.height);
end;
DC := GTK2WidgetSet.CreateDCForWidget(DCWidget,Window,false);
ItemState:=State;
end;
DeliverMessage(AWinControl, Msg);
GTK2WidgetSet.ReleaseDC(HWnd({%H-}PtrUInt(Widget)),Msg.DrawListItemStruct^.DC);
finally
Dispose(Msg.DrawListItemStruct);
end;
//DebugLn(['LCLIntfCellRenderer_Render END ',DbgSName(LCLObject)]);
end;
procedure LCLIntfCellRenderer_ClassInit(aClass: Pointer); cdecl;
//aClass: PLCLIntfCellRendererClass
var
LCLClass: PLCLIntfCellRendererClass;
RendererClass: PGtkCellRendererClass;
begin
//DebugLn(['LCLIntfCellRenderer_ClassInit ']);
LCLClass := PLCLIntfCellRendererClass(aClass);
RendererClass := GTK_CELL_RENDERER_CLASS(aClass);
LCLClass^.DefaultGtkGetSize := RendererClass^.get_size;
LCLClass^.DefaultGtkRender := RendererClass^.render;
RendererClass^.get_size := @LCLIntfCellRenderer_GetSize;
RendererClass^.render := @LCLIntfCellRenderer_Render;
end;
procedure LCLIntfCellRenderer_Init({%H-}Instance:PGTypeInstance;
{%H-}theClass: Pointer); cdecl;
// Instance: PLCLIntfCellRenderer;
// theClass: PLCLIntfCellRendererClass
begin
//DebugLn(['LCLIntfCellRenderer_Init ']);
end;
function LCLIntfCellRenderer_GetType: TGtkType;
const
CR_NAME = 'LCLIntfCellRenderer';
crType: TGtkType = 0;
crInfo: TGTKTypeInfo = (
type_name: CR_NAME;
object_size: SizeOf(TLCLIntfCellRenderer)+100; // a TLCLIntfCellRenderer
class_size: SizeOf(TLCLIntfCellRendererClass)+100;
class_init_func: @LCLIntfCellRenderer_ClassInit;
object_init_func : @LCLIntfCellRenderer_Init;
reserved_1: nil;
reserved_2: nil;
base_class_init_func: nil;
);
var
IID: TGUID;
S: AnsiString;
begin
if (crType = 0)
then begin
// patch by tk: in case of shared library we must create unique name
if CreateGUID(IID) = 0 then
S := Format('LCL%d%d%d', [Word(IID.time_low), Word(IID.time_low shr 16), IID.time_mid]);
crType := gtk_type_from_name(PAnsiChar(S));
if crType = 0 then begin
crInfo.type_name:=PAnsiChar(S);
crType := gtk_type_unique(gtk_cell_renderer_text_get_type, @crInfo);
end;
end;
Result := crType;
end;
function LCLIntfCellRenderer_New: PGtkCellRenderer;
begin
Result := g_object_new(LCLIntfCellRenderer_GetType, nil,[]);
end;
procedure LCLIntfCellRenderer_CellDataFunc(cell_layout:PGtkCellLayout;
cell: PGtkCellRenderer; tree_model: PGtkTreeModel; iter: PGtkTreeIter;
data: gpointer); cdecl;
var
LCLCellRenderer: PLCLIntfCellRenderer absolute cell;
WidgetInfo: PWidgetInfo;
APath: PGtkTreePath;
Str: String;
ListColumn: TListColumn;
ListItem: TListItem;
Value: TGValue;
begin
if G_IS_OBJECT(cell) = false then
exit;
FillByte(Value{%H-},SizeOf(Value),0);
APath := gtk_tree_model_get_path(tree_model,iter);
LCLCellRenderer^.Index := gtk_tree_path_get_indices(APath)^;
LCLCellRenderer^.ColumnIndex := -1;
gtk_tree_path_free(APath);
WidgetInfo := PWidgetInfo(data);
// DebugLn(['LCLIntfCellRenderer_CellDataFunc stamp=',iter^.stamp,' tree_model=',dbgs(tree_model),' cell=',dbgs(cell),' WidgetInfo=',WidgetInfo <> nil,' Time=',TimeToStr(Now)]);
if (WidgetInfo <> nil) and
(WidgetInfo^.LCLObject is TCustomComboBox) and
not (TCustomComboBox(WidgetInfo^.LCLObject).Style.HasEditBox) and
not (TCustomComboBox(WidgetInfo^.LCLObject).DroppedDown) then
begin
g_value_init(@value, G_TYPE_UINT);
g_value_set_uint(@value, 0);
g_object_get_property(PgObject(cell), 'ypad', @Value);
g_value_set_uint(@value, 0);
g_object_set_property(PGObject(cell), 'ypad', @Value);
g_value_unset(@value);
end else
if (WidgetInfo <> nil) and (WidgetInfo^.LCLObject.InheritsFrom(TCustomListView)) then
begin
// DebugLn(['LCLIntfCellRenderer_CellDataFunc stamp=',iter^.stamp,' tree_model=',dbgs(tree_model),' cell=',dbgs(cell),' WidgetInfo=',WidgetInfo <> nil,' Time=',TimeToStr(Now)]);
gtk_tree_model_get(tree_model, iter, [0, @ListItem, -1]);
if (ListItem = nil) and TCustomListView(WidgetInfo^.LCLObject).OwnerData then
ListItem := TCustomListView(WidgetInfo^.LCLObject).Items[LCLCellRenderer^.Index];
if ListItem = nil then
Exit;
ListColumn := TListColumn(g_object_get_data(G_OBJECT(cell_layout), 'TListColumn'));
if ListColumn = nil then
LCLCellRenderer^.ColumnIndex := -1
else
LCLCellRenderer^.ColumnIndex := ListColumn.Index;
if LCLCellRenderer^.ColumnIndex <= 0 then
Str := ListItem.Caption
else
if ListColumn.Index-1 <= ListItem.SubItems.Count-1 then
Str := ListItem.SubItems.Strings[LCLCellRenderer^.ColumnIndex-1];
g_value_init(@value, G_TYPE_STRING);
g_value_set_string(@value, PChar(Str));
g_object_set_property(PGObject(cell), 'text', @Value);
g_value_unset(@value);
end;
// DebugLn(['LCLIntfCellRenderer_CellDataFunc ItemIndex=',LCLCellRenderer^.Index]);
end;
end.
| 35.381743 | 181 | 0.681072 |
f1cc3d05feb9c7e22f5ba187e46be849a9851c89 | 258,059 | pas | Pascal | GDIPAPI.pas | h0lmes/terry | 60ea4cc6a2fcff0ab488452cabce490171472970 | [
"MIT"
]
| 8 | 2015-01-10T07:27:00.000Z | 2022-03-29T06:53:13.000Z | Docklets/SysMeters/GDIPAPI.pas | h0lmes/terry | 60ea4cc6a2fcff0ab488452cabce490171472970 | [
"MIT"
]
| 1 | 2021-12-07T21:37:04.000Z | 2021-12-07T21:37:04.000Z | GDIPAPI.pas | h0lmes/tdock | 99fc4197edd9e740a2a69c350aff25d6c3300b11 | [
"MIT"
]
| 2 | 2016-07-16T02:10:43.000Z | 2020-08-14T08:39:31.000Z | {******************************************************************}
{ GDI+ API }
{ }
{ home page : http://www.progdigy.com }
{ email : hgourvest@progdigy.com }
{ }
{ date : 15-02-2002 }
{ }
{ The contents of this file are used with permission, 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/MPL-1.1.html }
{ }
{ 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. }
{ }
{ *****************************************************************}
unit GDIPAPI;
{$ALIGN ON}
{$MINENUMSIZE 4}
interface
(**************************************************************************\
*
* GDI+ public header file
*
\**************************************************************************)
uses
Windows,
ActiveX,
DirectDraw,
Math;
type
INT16 = type Smallint;
UINT16 = type Word;
PUINT16 = ^UINT16;
UINT32 = type Cardinal;
TSingleDynArray = array of Single;
(**************************************************************************\
*
* GDI+ Private Memory Management APIs
*
\**************************************************************************)
//----------------------------------------------------------------------------
// Memory Allocation APIs
//----------------------------------------------------------------------------
{$EXTERNALSYM GdipAlloc}
function GdipAlloc(size: ULONG): pointer; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFree}
procedure GdipFree(ptr: pointer); stdcall; external 'gdiplus.dll';
(**************************************************************************\
*
* GDI+ base memory allocation class
*
\**************************************************************************)
type
TGdiplusBase = class
public
class function NewInstance: TObject; override;
procedure FreeInstance; override;
end;
(**************************************************************************\
*
* GDI+ Enumeration Types
*
\**************************************************************************)
//--------------------------------------------------------------------------
// Default bezier flattening tolerance in device pixels.
//--------------------------------------------------------------------------
const
{$EXTERNALSYM FlatnessDefault}
FlatnessDefault = 0.25;
//--------------------------------------------------------------------------
// Graphics and Container State cookies
//--------------------------------------------------------------------------
type
{$EXTERNALSYM GraphicsState}
GraphicsState = UINT;
{$EXTERNALSYM GraphicsContainer}
GraphicsContainer = UINT;
//--------------------------------------------------------------------------
// Fill mode constants
//--------------------------------------------------------------------------
{$EXTERNALSYM FillMode}
FillMode = (
FillModeAlternate, // 0
FillModeWinding // 1
);
TFillMode = FillMode;
//--------------------------------------------------------------------------
// Quality mode constants
//--------------------------------------------------------------------------
{$EXTERNALSYM QualityMode}
QualityMode = (
QualityModeInvalid = -1,
QualityModeDefault = 0,
QualityModeLow = 1, // Best performance
QualityModeHigh = 2 // Best rendering quality
);
TQualityMode = QualityMode;
//--------------------------------------------------------------------------
// Alpha Compositing mode constants
//--------------------------------------------------------------------------
{$EXTERNALSYM CompositingMode}
CompositingMode = (
CompositingModeSourceOver, // 0
CompositingModeSourceCopy // 1
);
TCompositingMode = CompositingMode;
//--------------------------------------------------------------------------
// Alpha Compositing quality constants
//--------------------------------------------------------------------------
{$EXTERNALSYM CompositingQuality}
CompositingQuality = (
CompositingQualityInvalid = ord(QualityModeInvalid),
CompositingQualityDefault = ord(QualityModeDefault),
CompositingQualityHighSpeed = ord(QualityModeLow),
CompositingQualityHighQuality = ord(QualityModeHigh),
CompositingQualityGammaCorrected,
CompositingQualityAssumeLinear
);
TCompositingQuality = CompositingQuality;
//--------------------------------------------------------------------------
// Unit constants
//--------------------------------------------------------------------------
// {$EXTERNALSYM Unit}
Unit_ = (
UnitWorld, // 0 -- World coordinate (non-physical unit)
UnitDisplay, // 1 -- Variable -- for PageTransform only
UnitPixel, // 2 -- Each unit is one device pixel.
UnitPoint, // 3 -- Each unit is a printer's point, or 1/72 inch.
UnitInch, // 4 -- Each unit is 1 inch.
UnitDocument, // 5 -- Each unit is 1/300 inch.
UnitMillimeter // 6 -- Each unit is 1 millimeter.
);
TUnit = Unit_;
//--------------------------------------------------------------------------
// MetafileFrameUnit
//
// The frameRect for creating a metafile can be specified in any of these
// units. There is an extra frame unit value (MetafileFrameUnitGdi) so
// that units can be supplied in the same units that GDI expects for
// frame rects -- these units are in .01 (1/100ths) millimeter units
// as defined by GDI.
//--------------------------------------------------------------------------
{$EXTERNALSYM MetafileFrameUnit}
MetafileFrameUnit = (
MetafileFrameUnitPixel = ord(UnitPixel),
MetafileFrameUnitPoint = ord(UnitPoint),
MetafileFrameUnitInch = ord(UnitInch),
MetafileFrameUnitDocument = ord(UnitDocument),
MetafileFrameUnitMillimeter = ord(UnitMillimeter),
MetafileFrameUnitGdi // GDI compatible .01 MM units
);
TMetafileFrameUnit = MetafileFrameUnit;
//--------------------------------------------------------------------------
// Coordinate space identifiers
//--------------------------------------------------------------------------
{$EXTERNALSYM CoordinateSpace}
CoordinateSpace = (
CoordinateSpaceWorld, // 0
CoordinateSpacePage, // 1
CoordinateSpaceDevice // 2
);
TCoordinateSpace = CoordinateSpace;
//--------------------------------------------------------------------------
// Various wrap modes for brushes
//--------------------------------------------------------------------------
{$EXTERNALSYM WrapMode}
WrapMode = (
WrapModeTile, // 0
WrapModeTileFlipX, // 1
WrapModeTileFlipY, // 2
WrapModeTileFlipXY, // 3
WrapModeClamp // 4
);
TWrapMode = WrapMode;
//--------------------------------------------------------------------------
// Various hatch styles
//--------------------------------------------------------------------------
{$EXTERNALSYM HatchStyle}
HatchStyle = (
HatchStyleHorizontal = 0,
HatchStyleVertical = 1,
HatchStyleForwardDiagonal = 2,
HatchStyleBackwardDiagonal = 3,
HatchStyleCross = 4,
HatchStyleDiagonalCross = 5,
HatchStyle05Percent = 6,
HatchStyle10Percent = 7,
HatchStyle20Percent = 8,
HatchStyle25Percent = 9,
HatchStyle30Percent = 10,
HatchStyle40Percent = 11,
HatchStyle50Percent = 12,
HatchStyle60Percent = 13,
HatchStyle70Percent = 14,
HatchStyle75Percent = 15,
HatchStyle80Percent = 16,
HatchStyle90Percent = 17,
HatchStyleLightDownwardDiagonal = 18,
HatchStyleLightUpwardDiagonal = 19,
HatchStyleDarkDownwardDiagonal = 20,
HatchStyleDarkUpwardDiagonal = 21,
HatchStyleWideDownwardDiagonal = 22,
HatchStyleWideUpwardDiagonal = 23,
HatchStyleLightVertical = 24,
HatchStyleLightHorizontal = 25,
HatchStyleNarrowVertical = 26,
HatchStyleNarrowHorizontal = 27,
HatchStyleDarkVertical = 28,
HatchStyleDarkHorizontal = 29,
HatchStyleDashedDownwardDiagonal = 30,
HatchStyleDashedUpwardDiagonal = 31,
HatchStyleDashedHorizontal = 32,
HatchStyleDashedVertical = 33,
HatchStyleSmallConfetti = 34,
HatchStyleLargeConfetti = 35,
HatchStyleZigZag = 36,
HatchStyleWave = 37,
HatchStyleDiagonalBrick = 38,
HatchStyleHorizontalBrick = 39,
HatchStyleWeave = 40,
HatchStylePlaid = 41,
HatchStyleDivot = 42,
HatchStyleDottedGrid = 43,
HatchStyleDottedDiamond = 44,
HatchStyleShingle = 45,
HatchStyleTrellis = 46,
HatchStyleSphere = 47,
HatchStyleSmallGrid = 48,
HatchStyleSmallCheckerBoard = 49,
HatchStyleLargeCheckerBoard = 50,
HatchStyleOutlinedDiamond = 51,
HatchStyleSolidDiamond = 52,
HatchStyleTotal = 53,
HatchStyleLargeGrid = HatchStyleCross, // 4
HatchStyleMin = HatchStyleHorizontal,
HatchStyleMax = HatchStyleTotal - 1
);
THatchStyle = HatchStyle;
//--------------------------------------------------------------------------
// Dash style constants
//--------------------------------------------------------------------------
{$EXTERNALSYM DashStyle}
DashStyle = (
DashStyleSolid, // 0
DashStyleDash, // 1
DashStyleDot, // 2
DashStyleDashDot, // 3
DashStyleDashDotDot, // 4
DashStyleCustom // 5
);
TDashStyle = DashStyle;
//--------------------------------------------------------------------------
// Dash cap constants
//--------------------------------------------------------------------------
{$EXTERNALSYM DashCap}
DashCap = (
DashCapFlat = 0,
DashCapRound = 2,
DashCapTriangle = 3
);
TDashCap = DashCap;
//--------------------------------------------------------------------------
// Line cap constants (only the lowest 8 bits are used).
//--------------------------------------------------------------------------
{$EXTERNALSYM LineCap}
LineCap = (
LineCapFlat = 0,
LineCapSquare = 1,
LineCapRound = 2,
LineCapTriangle = 3,
LineCapNoAnchor = $10, // corresponds to flat cap
LineCapSquareAnchor = $11, // corresponds to square cap
LineCapRoundAnchor = $12, // corresponds to round cap
LineCapDiamondAnchor = $13, // corresponds to triangle cap
LineCapArrowAnchor = $14, // no correspondence
LineCapCustom = $ff, // custom cap
LineCapAnchorMask = $f0 // mask to check for anchor or not.
);
TLineCap = LineCap;
//--------------------------------------------------------------------------
// Custom Line cap type constants
//--------------------------------------------------------------------------
{$EXTERNALSYM CustomLineCapType}
CustomLineCapType = (
CustomLineCapTypeDefault = 0,
CustomLineCapTypeAdjustableArrow = 1
);
TCustomLineCapType = CustomLineCapType;
//--------------------------------------------------------------------------
// Line join constants
//--------------------------------------------------------------------------
{$EXTERNALSYM LineJoin}
LineJoin = (
LineJoinMiter = 0,
LineJoinBevel = 1,
LineJoinRound = 2,
LineJoinMiterClipped = 3
);
TLineJoin = LineJoin;
//--------------------------------------------------------------------------
// Path point types (only the lowest 8 bits are used.)
// The lowest 3 bits are interpreted as point type
// The higher 5 bits are reserved for flags.
//--------------------------------------------------------------------------
{$Z1}
{$EXTERNALSYM PathPointType}
PathPointType = (
PathPointTypeStart = $00, // move
PathPointTypeLine = $01, // line
PathPointTypeBezier = $03, // default Bezier (= cubic Bezier)
PathPointTypePathTypeMask = $07, // type mask (lowest 3 bits).
PathPointTypeDashMode = $10, // currently in dash mode.
PathPointTypePathMarker = $20, // a marker for the path.
PathPointTypeCloseSubpath = $80, // closed flag
// Path types used for advanced path.
PathPointTypeBezier3 = $03 // cubic Bezier
);
TPathPointType = PathPointType;
{$Z4}
//--------------------------------------------------------------------------
// WarpMode constants
//--------------------------------------------------------------------------
{$EXTERNALSYM WarpMode}
WarpMode = (
WarpModePerspective, // 0
WarpModeBilinear // 1
);
TWarpMode = WarpMode;
//--------------------------------------------------------------------------
// LineGradient Mode
//--------------------------------------------------------------------------
{$EXTERNALSYM LinearGradientMode}
LinearGradientMode = (
LinearGradientModeHorizontal, // 0
LinearGradientModeVertical, // 1
LinearGradientModeForwardDiagonal, // 2
LinearGradientModeBackwardDiagonal // 3
);
TLinearGradientMode = LinearGradientMode;
//--------------------------------------------------------------------------
// Region Comine Modes
//--------------------------------------------------------------------------
{$EXTERNALSYM CombineMode}
CombineMode = (
CombineModeReplace, // 0
CombineModeIntersect, // 1
CombineModeUnion, // 2
CombineModeXor, // 3
CombineModeExclude, // 4
CombineModeComplement // 5 (Exclude From)
);
TCombineMode = CombineMode;
//--------------------------------------------------------------------------
// Image types
//--------------------------------------------------------------------------
{$EXTERNALSYM ImageType}
ImageType = (
ImageTypeUnknown, // 0
ImageTypeBitmap, // 1
ImageTypeMetafile // 2
);
TImageType = ImageType;
//--------------------------------------------------------------------------
// Interpolation modes
//--------------------------------------------------------------------------
{$EXTERNALSYM InterpolationMode}
InterpolationMode = (
InterpolationModeInvalid = ord(QualityModeInvalid),
InterpolationModeDefault = ord(QualityModeDefault),
InterpolationModeLowQuality = ord(QualityModeLow),
InterpolationModeHighQuality = ord(QualityModeHigh),
InterpolationModeBilinear,
InterpolationModeBicubic,
InterpolationModeNearestNeighbor,
InterpolationModeHighQualityBilinear,
InterpolationModeHighQualityBicubic
);
TInterpolationMode = InterpolationMode;
//--------------------------------------------------------------------------
// Pen types
//--------------------------------------------------------------------------
{$EXTERNALSYM PenAlignment}
PenAlignment = (
PenAlignmentCenter = 0,
PenAlignmentInset = 1
);
TPenAlignment = PenAlignment;
//--------------------------------------------------------------------------
// Brush types
//--------------------------------------------------------------------------
{$EXTERNALSYM BrushType}
BrushType = (
BrushTypeSolidColor = 0,
BrushTypeHatchFill = 1,
BrushTypeTextureFill = 2,
BrushTypePathGradient = 3,
BrushTypeLinearGradient = 4
);
TBrushType = BrushType;
//--------------------------------------------------------------------------
// Pen's Fill types
//--------------------------------------------------------------------------
{$EXTERNALSYM PenType}
PenType = (
PenTypeSolidColor = ord(BrushTypeSolidColor),
PenTypeHatchFill = ord(BrushTypeHatchFill),
PenTypeTextureFill = ord(BrushTypeTextureFill),
PenTypePathGradient = ord(BrushTypePathGradient),
PenTypeLinearGradient = ord(BrushTypeLinearGradient),
PenTypeUnknown = -1
);
TPenType = PenType;
//--------------------------------------------------------------------------
// Matrix Order
//--------------------------------------------------------------------------
{$EXTERNALSYM MatrixOrder}
MatrixOrder = (
MatrixOrderPrepend = 0,
MatrixOrderAppend = 1
);
TMatrixOrder = MatrixOrder;
//--------------------------------------------------------------------------
// Generic font families
//--------------------------------------------------------------------------
{$EXTERNALSYM GenericFontFamily}
GenericFontFamily = (
GenericFontFamilySerif,
GenericFontFamilySansSerif,
GenericFontFamilyMonospace
);
TGenericFontFamily = GenericFontFamily;
//--------------------------------------------------------------------------
// FontStyle: face types and common styles
//--------------------------------------------------------------------------
type
{$EXTERNALSYM FontStyle}
FontStyle = Integer;
const
FontStyleRegular = Integer(0);
FontStyleBold = Integer(1);
FontStyleItalic = Integer(2);
FontStyleBoldItalic = Integer(3);
FontStyleUnderline = Integer(4);
FontStyleStrikeout = Integer(8);
Type
TFontStyle = FontStyle;
//---------------------------------------------------------------------------
// Smoothing Mode
//---------------------------------------------------------------------------
{$EXTERNALSYM SmoothingMode}
SmoothingMode = (
SmoothingModeInvalid = ord(QualityModeInvalid),
SmoothingModeDefault = ord(QualityModeDefault),
SmoothingModeHighSpeed = ord(QualityModeLow),
SmoothingModeHighQuality = ord(QualityModeHigh),
SmoothingModeNone,
SmoothingModeAntiAlias
);
TSmoothingMode = SmoothingMode;
//---------------------------------------------------------------------------
// Pixel Format Mode
//---------------------------------------------------------------------------
{$EXTERNALSYM PixelOffsetMode}
PixelOffsetMode = (
PixelOffsetModeInvalid = Ord(QualityModeInvalid),
PixelOffsetModeDefault = Ord(QualityModeDefault),
PixelOffsetModeHighSpeed = Ord(QualityModeLow),
PixelOffsetModeHighQuality = Ord(QualityModeHigh),
PixelOffsetModeNone, // No pixel offset
PixelOffsetModeHalf // Offset by -0.5, -0.5 for fast anti-alias perf
);
TPixelOffsetMode = PixelOffsetMode;
//---------------------------------------------------------------------------
// Text Rendering Hint
//---------------------------------------------------------------------------
{$EXTERNALSYM TextRenderingHint}
TextRenderingHint = (
TextRenderingHintSystemDefault = 0, // Glyph with system default rendering hint
TextRenderingHintSingleBitPerPixelGridFit, // Glyph bitmap with hinting
TextRenderingHintSingleBitPerPixel, // Glyph bitmap without hinting
TextRenderingHintAntiAliasGridFit, // Glyph anti-alias bitmap with hinting
TextRenderingHintAntiAlias, // Glyph anti-alias bitmap without hinting
TextRenderingHintClearTypeGridFit // Glyph CT bitmap with hinting
);
TTextRenderingHint = TextRenderingHint;
//---------------------------------------------------------------------------
// Metafile Types
//---------------------------------------------------------------------------
{$EXTERNALSYM MetafileType}
MetafileType = (
MetafileTypeInvalid, // Invalid metafile
MetafileTypeWmf, // Standard WMF
MetafileTypeWmfPlaceable, // Placeable WMF
MetafileTypeEmf, // EMF (not EMF+)
MetafileTypeEmfPlusOnly, // EMF+ without dual, down-level records
MetafileTypeEmfPlusDual // EMF+ with dual, down-level records
);
TMetafileType = MetafileType;
//---------------------------------------------------------------------------
// Specifies the type of EMF to record
//---------------------------------------------------------------------------
{$EXTERNALSYM EmfType}
EmfType = (
EmfTypeEmfOnly = Ord(MetafileTypeEmf), // no EMF+, only EMF
EmfTypeEmfPlusOnly = Ord(MetafileTypeEmfPlusOnly), // no EMF, only EMF+
EmfTypeEmfPlusDual = Ord(MetafileTypeEmfPlusDual) // both EMF+ and EMF
);
TEmfType = EmfType;
//---------------------------------------------------------------------------
// EMF+ Persistent object types
//---------------------------------------------------------------------------
{$EXTERNALSYM ObjectType}
ObjectType = (
ObjectTypeInvalid,
ObjectTypeBrush,
ObjectTypePen,
ObjectTypePath,
ObjectTypeRegion,
ObjectTypeImage,
ObjectTypeFont,
ObjectTypeStringFormat,
ObjectTypeImageAttributes,
ObjectTypeCustomLineCap,
ObjectTypeMax = ObjectTypeCustomLineCap,
ObjectTypeMin = ObjectTypeBrush
);
TObjectType = ObjectType;
function ObjectTypeIsValid(type_: ObjectType): BOOL;
//---------------------------------------------------------------------------
// EMF+ Records
//---------------------------------------------------------------------------
// We have to change the WMF record numbers so that they don't conflict with
// the EMF and EMF+ record numbers.
const
GDIP_EMFPLUS_RECORD_BASE = $00004000;
{$EXTERNALSYM GDIP_EMFPLUS_RECORD_BASE}
GDIP_WMF_RECORD_BASE = $00010000;
{$EXTERNALSYM GDIP_WMF_RECORD_BASE}
// macros
function GDIP_WMF_RECORD_TO_EMFPLUS(n: integer): Integer;
function GDIP_EMFPLUS_RECORD_TO_WMF(n: integer): Integer;
function GDIP_IS_WMF_RECORDTYPE(n: integer): BOOL;
const
// Metafile Functions
META_SETBKCOLOR = $0201;
{$EXTERNALSYM META_SETBKCOLOR}
META_SETBKMODE = $0102;
{$EXTERNALSYM META_SETBKMODE}
META_SETMAPMODE = $0103;
{$EXTERNALSYM META_SETMAPMODE}
META_SETROP2 = $0104;
{$EXTERNALSYM META_SETROP2}
META_SETRELABS = $0105;
{$EXTERNALSYM META_SETRELABS}
META_SETPOLYFILLMODE = $0106;
{$EXTERNALSYM META_SETPOLYFILLMODE}
META_SETSTRETCHBLTMODE = $0107;
{$EXTERNALSYM META_SETSTRETCHBLTMODE}
META_SETTEXTCHAREXTRA = $0108;
{$EXTERNALSYM META_SETTEXTCHAREXTRA}
META_SETTEXTCOLOR = $0209;
{$EXTERNALSYM META_SETTEXTCOLOR}
META_SETTEXTJUSTIFICATION = $020A;
{$EXTERNALSYM META_SETTEXTJUSTIFICATION}
META_SETWINDOWORG = $020B;
{$EXTERNALSYM META_SETWINDOWORG}
META_SETWINDOWEXT = $020C;
{$EXTERNALSYM META_SETWINDOWEXT}
META_SETVIEWPORTORG = $020D;
{$EXTERNALSYM META_SETVIEWPORTORG}
META_SETVIEWPORTEXT = $020E;
{$EXTERNALSYM META_SETVIEWPORTEXT}
META_OFFSETWINDOWORG = $020F;
{$EXTERNALSYM META_OFFSETWINDOWORG}
META_SCALEWINDOWEXT = $0410;
{$EXTERNALSYM META_SCALEWINDOWEXT}
META_OFFSETVIEWPORTORG = $0211;
{$EXTERNALSYM META_OFFSETVIEWPORTORG}
META_SCALEVIEWPORTEXT = $0412;
{$EXTERNALSYM META_SCALEVIEWPORTEXT}
META_LINETO = $0213;
{$EXTERNALSYM META_LINETO}
META_MOVETO = $0214;
{$EXTERNALSYM META_MOVETO}
META_EXCLUDECLIPRECT = $0415;
{$EXTERNALSYM META_EXCLUDECLIPRECT}
META_INTERSECTCLIPRECT = $0416;
{$EXTERNALSYM META_INTERSECTCLIPRECT}
META_ARC = $0817;
{$EXTERNALSYM META_ARC}
META_ELLIPSE = $0418;
{$EXTERNALSYM META_ELLIPSE}
META_FLOODFILL = $0419;
{$EXTERNALSYM META_FLOODFILL}
META_PIE = $081A;
{$EXTERNALSYM META_PIE}
META_RECTANGLE = $041B;
{$EXTERNALSYM META_RECTANGLE}
META_ROUNDRECT = $061C;
{$EXTERNALSYM META_ROUNDRECT}
META_PATBLT = $061D;
{$EXTERNALSYM META_PATBLT}
META_SAVEDC = $001E;
{$EXTERNALSYM META_SAVEDC}
META_SETPIXEL = $041F;
{$EXTERNALSYM META_SETPIXEL}
META_OFFSETCLIPRGN = $0220;
{$EXTERNALSYM META_OFFSETCLIPRGN}
META_TEXTOUT = $0521;
{$EXTERNALSYM META_TEXTOUT}
META_BITBLT = $0922;
{$EXTERNALSYM META_BITBLT}
META_STRETCHBLT = $0B23;
{$EXTERNALSYM META_STRETCHBLT}
META_POLYGON = $0324;
{$EXTERNALSYM META_POLYGON}
META_POLYLINE = $0325;
{$EXTERNALSYM META_POLYLINE}
META_ESCAPE = $0626;
{$EXTERNALSYM META_ESCAPE}
META_RESTOREDC = $0127;
{$EXTERNALSYM META_RESTOREDC}
META_FILLREGION = $0228;
{$EXTERNALSYM META_FILLREGION}
META_FRAMEREGION = $0429;
{$EXTERNALSYM META_FRAMEREGION}
META_INVERTREGION = $012A;
{$EXTERNALSYM META_INVERTREGION}
META_PAINTREGION = $012B;
{$EXTERNALSYM META_PAINTREGION}
META_SELECTCLIPREGION = $012C;
{$EXTERNALSYM META_SELECTCLIPREGION}
META_SELECTOBJECT = $012D;
{$EXTERNALSYM META_SELECTOBJECT}
META_SETTEXTALIGN = $012E;
{$EXTERNALSYM META_SETTEXTALIGN}
META_CHORD = $0830;
{$EXTERNALSYM META_CHORD}
META_SETMAPPERFLAGS = $0231;
{$EXTERNALSYM META_SETMAPPERFLAGS}
META_EXTTEXTOUT = $0a32;
{$EXTERNALSYM META_EXTTEXTOUT}
META_SETDIBTODEV = $0d33;
{$EXTERNALSYM META_SETDIBTODEV}
META_SELECTPALETTE = $0234;
{$EXTERNALSYM META_SELECTPALETTE}
META_REALIZEPALETTE = $0035;
{$EXTERNALSYM META_REALIZEPALETTE}
META_ANIMATEPALETTE = $0436;
{$EXTERNALSYM META_ANIMATEPALETTE}
META_SETPALENTRIES = $0037;
{$EXTERNALSYM META_SETPALENTRIES}
META_POLYPOLYGON = $0538;
{$EXTERNALSYM META_POLYPOLYGON}
META_RESIZEPALETTE = $0139;
{$EXTERNALSYM META_RESIZEPALETTE}
META_DIBBITBLT = $0940;
{$EXTERNALSYM META_DIBBITBLT}
META_DIBSTRETCHBLT = $0b41;
{$EXTERNALSYM META_DIBSTRETCHBLT}
META_DIBCREATEPATTERNBRUSH = $0142;
{$EXTERNALSYM META_DIBCREATEPATTERNBRUSH}
META_STRETCHDIB = $0f43;
{$EXTERNALSYM META_STRETCHDIB}
META_EXTFLOODFILL = $0548;
{$EXTERNALSYM META_EXTFLOODFILL}
META_SETLAYOUT = $0149;
{$EXTERNALSYM META_SETLAYOUT}
META_DELETEOBJECT = $01f0;
{$EXTERNALSYM META_DELETEOBJECT}
META_CREATEPALETTE = $00f7;
{$EXTERNALSYM META_CREATEPALETTE}
META_CREATEPATTERNBRUSH = $01F9;
{$EXTERNALSYM META_CREATEPATTERNBRUSH}
META_CREATEPENINDIRECT = $02FA;
{$EXTERNALSYM META_CREATEPENINDIRECT}
META_CREATEFONTINDIRECT = $02FB;
{$EXTERNALSYM META_CREATEFONTINDIRECT}
META_CREATEBRUSHINDIRECT = $02FC;
{$EXTERNALSYM META_CREATEBRUSHINDIRECT}
META_CREATEREGION = $06FF;
{$EXTERNALSYM META_CREATEREGION}
// Enhanced metafile record types.
EMR_HEADER = 1;
{$EXTERNALSYM EMR_HEADER}
EMR_POLYBEZIER = 2;
{$EXTERNALSYM EMR_POLYBEZIER}
EMR_POLYGON = 3;
{$EXTERNALSYM EMR_POLYGON}
EMR_POLYLINE = 4;
{$EXTERNALSYM EMR_POLYLINE}
EMR_POLYBEZIERTO = 5;
{$EXTERNALSYM EMR_POLYBEZIERTO}
EMR_POLYLINETO = 6;
{$EXTERNALSYM EMR_POLYLINETO}
EMR_POLYPOLYLINE = 7;
{$EXTERNALSYM EMR_POLYPOLYLINE}
EMR_POLYPOLYGON = 8;
{$EXTERNALSYM EMR_POLYPOLYGON}
EMR_SETWINDOWEXTEX = 9;
{$EXTERNALSYM EMR_SETWINDOWEXTEX}
EMR_SETWINDOWORGEX = 10;
{$EXTERNALSYM EMR_SETWINDOWORGEX}
EMR_SETVIEWPORTEXTEX = 11;
{$EXTERNALSYM EMR_SETVIEWPORTEXTEX}
EMR_SETVIEWPORTORGEX = 12;
{$EXTERNALSYM EMR_SETVIEWPORTORGEX}
EMR_SETBRUSHORGEX = 13;
{$EXTERNALSYM EMR_SETBRUSHORGEX}
EMR_EOF = 14;
{$EXTERNALSYM EMR_EOF}
EMR_SETPIXELV = 15;
{$EXTERNALSYM EMR_SETPIXELV}
EMR_SETMAPPERFLAGS = 16;
{$EXTERNALSYM EMR_SETMAPPERFLAGS}
EMR_SETMAPMODE = 17;
{$EXTERNALSYM EMR_SETMAPMODE}
EMR_SETBKMODE = 18;
{$EXTERNALSYM EMR_SETBKMODE}
EMR_SETPOLYFILLMODE = 19;
{$EXTERNALSYM EMR_SETPOLYFILLMODE}
EMR_SETROP2 = 20;
{$EXTERNALSYM EMR_SETROP2}
EMR_SETSTRETCHBLTMODE = 21;
{$EXTERNALSYM EMR_SETSTRETCHBLTMODE}
EMR_SETTEXTALIGN = 22;
{$EXTERNALSYM EMR_SETTEXTALIGN}
EMR_SETCOLORADJUSTMENT = 23;
{$EXTERNALSYM EMR_SETCOLORADJUSTMENT}
EMR_SETTEXTCOLOR = 24;
{$EXTERNALSYM EMR_SETTEXTCOLOR}
EMR_SETBKCOLOR = 25;
{$EXTERNALSYM EMR_SETBKCOLOR}
EMR_OFFSETCLIPRGN = 26;
{$EXTERNALSYM EMR_OFFSETCLIPRGN}
EMR_MOVETOEX = 27;
{$EXTERNALSYM EMR_MOVETOEX}
EMR_SETMETARGN = 28;
{$EXTERNALSYM EMR_SETMETARGN}
EMR_EXCLUDECLIPRECT = 29;
{$EXTERNALSYM EMR_EXCLUDECLIPRECT}
EMR_INTERSECTCLIPRECT = 30;
{$EXTERNALSYM EMR_INTERSECTCLIPRECT}
EMR_SCALEVIEWPORTEXTEX = 31;
{$EXTERNALSYM EMR_SCALEVIEWPORTEXTEX}
EMR_SCALEWINDOWEXTEX = 32;
{$EXTERNALSYM EMR_SCALEWINDOWEXTEX}
EMR_SAVEDC = 33;
{$EXTERNALSYM EMR_SAVEDC}
EMR_RESTOREDC = 34;
{$EXTERNALSYM EMR_RESTOREDC}
EMR_SETWORLDTRANSFORM = 35;
{$EXTERNALSYM EMR_SETWORLDTRANSFORM}
EMR_MODIFYWORLDTRANSFORM = 36;
{$EXTERNALSYM EMR_MODIFYWORLDTRANSFORM}
EMR_SELECTOBJECT = 37;
{$EXTERNALSYM EMR_SELECTOBJECT}
EMR_CREATEPEN = 38;
{$EXTERNALSYM EMR_CREATEPEN}
EMR_CREATEBRUSHINDIRECT = 39;
{$EXTERNALSYM EMR_CREATEBRUSHINDIRECT}
EMR_DELETEOBJECT = 40;
{$EXTERNALSYM EMR_DELETEOBJECT}
EMR_ANGLEARC = 41;
{$EXTERNALSYM EMR_ANGLEARC}
EMR_ELLIPSE = 42;
{$EXTERNALSYM EMR_ELLIPSE}
EMR_RECTANGLE = 43;
{$EXTERNALSYM EMR_RECTANGLE}
EMR_ROUNDRECT = 44;
{$EXTERNALSYM EMR_ROUNDRECT}
EMR_ARC = 45;
{$EXTERNALSYM EMR_ARC}
EMR_CHORD = 46;
{$EXTERNALSYM EMR_CHORD}
EMR_PIE = 47;
{$EXTERNALSYM EMR_PIE}
EMR_SELECTPALETTE = 48;
{$EXTERNALSYM EMR_SELECTPALETTE}
EMR_CREATEPALETTE = 49;
{$EXTERNALSYM EMR_CREATEPALETTE}
EMR_SETPALETTEENTRIES = 50;
{$EXTERNALSYM EMR_SETPALETTEENTRIES}
EMR_RESIZEPALETTE = 51;
{$EXTERNALSYM EMR_RESIZEPALETTE}
EMR_REALIZEPALETTE = 52;
{$EXTERNALSYM EMR_REALIZEPALETTE}
EMR_EXTFLOODFILL = 53;
{$EXTERNALSYM EMR_EXTFLOODFILL}
EMR_LINETO = 54;
{$EXTERNALSYM EMR_LINETO}
EMR_ARCTO = 55;
{$EXTERNALSYM EMR_ARCTO}
EMR_POLYDRAW = 56;
{$EXTERNALSYM EMR_POLYDRAW}
EMR_SETARCDIRECTION = 57;
{$EXTERNALSYM EMR_SETARCDIRECTION}
EMR_SETMITERLIMIT = 58;
{$EXTERNALSYM EMR_SETMITERLIMIT}
EMR_BEGINPATH = 59;
{$EXTERNALSYM EMR_BEGINPATH}
EMR_ENDPATH = 60;
{$EXTERNALSYM EMR_ENDPATH}
EMR_CLOSEFIGURE = 61;
{$EXTERNALSYM EMR_CLOSEFIGURE}
EMR_FILLPATH = 62;
{$EXTERNALSYM EMR_FILLPATH}
EMR_STROKEANDFILLPATH = 63;
{$EXTERNALSYM EMR_STROKEANDFILLPATH}
EMR_STROKEPATH = 64;
{$EXTERNALSYM EMR_STROKEPATH}
EMR_FLATTENPATH = 65;
{$EXTERNALSYM EMR_FLATTENPATH}
EMR_WIDENPATH = 66;
{$EXTERNALSYM EMR_WIDENPATH}
EMR_SELECTCLIPPATH = 67;
{$EXTERNALSYM EMR_SELECTCLIPPATH}
EMR_ABORTPATH = 68;
{$EXTERNALSYM EMR_ABORTPATH}
EMR_GDICOMMENT = 70;
{$EXTERNALSYM EMR_GDICOMMENT}
EMR_FILLRGN = 71;
{$EXTERNALSYM EMR_FILLRGN}
EMR_FRAMERGN = 72;
{$EXTERNALSYM EMR_FRAMERGN}
EMR_INVERTRGN = 73;
{$EXTERNALSYM EMR_INVERTRGN}
EMR_PAINTRGN = 74;
{$EXTERNALSYM EMR_PAINTRGN}
EMR_EXTSELECTCLIPRGN = 75;
{$EXTERNALSYM EMR_EXTSELECTCLIPRGN}
EMR_BITBLT = 76;
{$EXTERNALSYM EMR_BITBLT}
EMR_STRETCHBLT = 77;
{$EXTERNALSYM EMR_STRETCHBLT}
EMR_MASKBLT = 78;
{$EXTERNALSYM EMR_MASKBLT}
EMR_PLGBLT = 79;
{$EXTERNALSYM EMR_PLGBLT}
EMR_SETDIBITSTODEVICE = 80;
{$EXTERNALSYM EMR_SETDIBITSTODEVICE}
EMR_STRETCHDIBITS = 81;
{$EXTERNALSYM EMR_STRETCHDIBITS}
EMR_EXTCREATEFONTINDIRECTW = 82;
{$EXTERNALSYM EMR_EXTCREATEFONTINDIRECTW}
EMR_EXTTEXTOUTA = 83;
{$EXTERNALSYM EMR_EXTTEXTOUTA}
EMR_EXTTEXTOUTW = 84;
{$EXTERNALSYM EMR_EXTTEXTOUTW}
EMR_POLYBEZIER16 = 85;
{$EXTERNALSYM EMR_POLYBEZIER16}
EMR_POLYGON16 = 86;
{$EXTERNALSYM EMR_POLYGON16}
EMR_POLYLINE16 = 87;
{$EXTERNALSYM EMR_POLYLINE16}
EMR_POLYBEZIERTO16 = 88;
{$EXTERNALSYM EMR_POLYBEZIERTO16}
EMR_POLYLINETO16 = 89;
{$EXTERNALSYM EMR_POLYLINETO16}
EMR_POLYPOLYLINE16 = 90;
{$EXTERNALSYM EMR_POLYPOLYLINE16}
EMR_POLYPOLYGON16 = 91;
{$EXTERNALSYM EMR_POLYPOLYGON16}
EMR_POLYDRAW16 = 92;
{$EXTERNALSYM EMR_POLYDRAW16}
EMR_CREATEMONOBRUSH = 93;
{$EXTERNALSYM EMR_CREATEMONOBRUSH}
EMR_CREATEDIBPATTERNBRUSHPT = 94;
{$EXTERNALSYM EMR_CREATEDIBPATTERNBRUSHPT}
EMR_EXTCREATEPEN = 95;
{$EXTERNALSYM EMR_EXTCREATEPEN}
EMR_POLYTEXTOUTA = 96;
{$EXTERNALSYM EMR_POLYTEXTOUTA}
EMR_POLYTEXTOUTW = 97;
{$EXTERNALSYM EMR_POLYTEXTOUTW}
EMR_SETICMMODE = 98;
{$EXTERNALSYM EMR_SETICMMODE}
EMR_CREATECOLORSPACE = 99;
{$EXTERNALSYM EMR_CREATECOLORSPACE}
EMR_SETCOLORSPACE = 100;
{$EXTERNALSYM EMR_SETCOLORSPACE}
EMR_DELETECOLORSPACE = 101;
{$EXTERNALSYM EMR_DELETECOLORSPACE}
EMR_GLSRECORD = 102;
{$EXTERNALSYM EMR_GLSRECORD}
EMR_GLSBOUNDEDRECORD = 103;
{$EXTERNALSYM EMR_GLSBOUNDEDRECORD}
EMR_PIXELFORMAT = 104;
{$EXTERNALSYM EMR_PIXELFORMAT}
EMR_RESERVED_105 = 105;
{$EXTERNALSYM EMR_RESERVED_105}
EMR_RESERVED_106 = 106;
{$EXTERNALSYM EMR_RESERVED_106}
EMR_RESERVED_107 = 107;
{$EXTERNALSYM EMR_RESERVED_107}
EMR_RESERVED_108 = 108;
{$EXTERNALSYM EMR_RESERVED_108}
EMR_RESERVED_109 = 109;
{$EXTERNALSYM EMR_RESERVED_109}
EMR_RESERVED_110 = 110;
{$EXTERNALSYM EMR_RESERVED_110}
EMR_COLORCORRECTPALETTE = 111;
{$EXTERNALSYM EMR_COLORCORRECTPALETTE}
EMR_SETICMPROFILEA = 112;
{$EXTERNALSYM EMR_SETICMPROFILEA}
EMR_SETICMPROFILEW = 113;
{$EXTERNALSYM EMR_SETICMPROFILEW}
EMR_ALPHABLEND = 114;
{$EXTERNALSYM EMR_ALPHABLEND}
EMR_SETLAYOUT = 115;
{$EXTERNALSYM EMR_SETLAYOUT}
EMR_TRANSPARENTBLT = 116;
{$EXTERNALSYM EMR_TRANSPARENTBLT}
EMR_RESERVED_117 = 117;
{$EXTERNALSYM EMR_RESERVED_117}
EMR_GRADIENTFILL = 118;
{$EXTERNALSYM EMR_GRADIENTFILL}
EMR_RESERVED_119 = 119;
{$EXTERNALSYM EMR_RESERVED_119}
EMR_RESERVED_120 = 120;
{$EXTERNALSYM EMR_RESERVED_120}
EMR_COLORMATCHTOTARGETW = 121;
{$EXTERNALSYM EMR_COLORMATCHTOTARGETW}
EMR_CREATECOLORSPACEW = 122;
{$EXTERNALSYM EMR_CREATECOLORSPACEW}
type
{$EXTERNALSYM EmfPlusRecordType}
EmfPlusRecordType = (
// Since we have to enumerate GDI records right along with GDI+ records,
// We list all the GDI records here so that they can be part of the
// same enumeration type which is used in the enumeration callback.
WmfRecordTypeSetBkColor = (META_SETBKCOLOR or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetBkMode = (META_SETBKMODE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetMapMode = (META_SETMAPMODE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetROP2 = (META_SETROP2 or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetRelAbs = (META_SETRELABS or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetPolyFillMode = (META_SETPOLYFILLMODE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetStretchBltMode = (META_SETSTRETCHBLTMODE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetTextCharExtra = (META_SETTEXTCHAREXTRA or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetTextColor = (META_SETTEXTCOLOR or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetTextJustification = (META_SETTEXTJUSTIFICATION or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetWindowOrg = (META_SETWINDOWORG or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetWindowExt = (META_SETWINDOWEXT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetViewportOrg = (META_SETVIEWPORTORG or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetViewportExt = (META_SETVIEWPORTEXT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeOffsetWindowOrg = (META_OFFSETWINDOWORG or GDIP_WMF_RECORD_BASE),
WmfRecordTypeScaleWindowExt = (META_SCALEWINDOWEXT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeOffsetViewportOrg = (META_OFFSETVIEWPORTORG or GDIP_WMF_RECORD_BASE),
WmfRecordTypeScaleViewportExt = (META_SCALEVIEWPORTEXT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeLineTo = (META_LINETO or GDIP_WMF_RECORD_BASE),
WmfRecordTypeMoveTo = (META_MOVETO or GDIP_WMF_RECORD_BASE),
WmfRecordTypeExcludeClipRect = (META_EXCLUDECLIPRECT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeIntersectClipRect = (META_INTERSECTCLIPRECT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeArc = (META_ARC or GDIP_WMF_RECORD_BASE),
WmfRecordTypeEllipse = (META_ELLIPSE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeFloodFill = (META_FLOODFILL or GDIP_WMF_RECORD_BASE),
WmfRecordTypePie = (META_PIE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeRectangle = (META_RECTANGLE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeRoundRect = (META_ROUNDRECT or GDIP_WMF_RECORD_BASE),
WmfRecordTypePatBlt = (META_PATBLT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSaveDC = (META_SAVEDC or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetPixel = (META_SETPIXEL or GDIP_WMF_RECORD_BASE),
WmfRecordTypeOffsetClipRgn = (META_OFFSETCLIPRGN or GDIP_WMF_RECORD_BASE),
WmfRecordTypeTextOut = (META_TEXTOUT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeBitBlt = (META_BITBLT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeStretchBlt = (META_STRETCHBLT or GDIP_WMF_RECORD_BASE),
WmfRecordTypePolygon = (META_POLYGON or GDIP_WMF_RECORD_BASE),
WmfRecordTypePolyline = (META_POLYLINE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeEscape = (META_ESCAPE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeRestoreDC = (META_RESTOREDC or GDIP_WMF_RECORD_BASE),
WmfRecordTypeFillRegion = (META_FILLREGION or GDIP_WMF_RECORD_BASE),
WmfRecordTypeFrameRegion = (META_FRAMEREGION or GDIP_WMF_RECORD_BASE),
WmfRecordTypeInvertRegion = (META_INVERTREGION or GDIP_WMF_RECORD_BASE),
WmfRecordTypePaintRegion = (META_PAINTREGION or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSelectClipRegion = (META_SELECTCLIPREGION or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSelectObject = (META_SELECTOBJECT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetTextAlign = (META_SETTEXTALIGN or GDIP_WMF_RECORD_BASE),
WmfRecordTypeDrawText = ($062F or GDIP_WMF_RECORD_BASE), // META_DRAWTEXT
WmfRecordTypeChord = (META_CHORD or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetMapperFlags = (META_SETMAPPERFLAGS or GDIP_WMF_RECORD_BASE),
WmfRecordTypeExtTextOut = (META_EXTTEXTOUT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetDIBToDev = (META_SETDIBTODEV or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSelectPalette = (META_SELECTPALETTE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeRealizePalette = (META_REALIZEPALETTE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeAnimatePalette = (META_ANIMATEPALETTE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetPalEntries = (META_SETPALENTRIES or GDIP_WMF_RECORD_BASE),
WmfRecordTypePolyPolygon = (META_POLYPOLYGON or GDIP_WMF_RECORD_BASE),
WmfRecordTypeResizePalette = (META_RESIZEPALETTE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeDIBBitBlt = (META_DIBBITBLT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeDIBStretchBlt = (META_DIBSTRETCHBLT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeDIBCreatePatternBrush = (META_DIBCREATEPATTERNBRUSH or GDIP_WMF_RECORD_BASE),
WmfRecordTypeStretchDIB = (META_STRETCHDIB or GDIP_WMF_RECORD_BASE),
WmfRecordTypeExtFloodFill = (META_EXTFLOODFILL or GDIP_WMF_RECORD_BASE),
WmfRecordTypeSetLayout = ($0149 or GDIP_WMF_RECORD_BASE), // META_SETLAYOUT
WmfRecordTypeResetDC = ($014C or GDIP_WMF_RECORD_BASE), // META_RESETDC
WmfRecordTypeStartDoc = ($014D or GDIP_WMF_RECORD_BASE), // META_STARTDOC
WmfRecordTypeStartPage = ($004F or GDIP_WMF_RECORD_BASE), // META_STARTPAGE
WmfRecordTypeEndPage = ($0050 or GDIP_WMF_RECORD_BASE), // META_ENDPAGE
WmfRecordTypeAbortDoc = ($0052 or GDIP_WMF_RECORD_BASE), // META_ABORTDOC
WmfRecordTypeEndDoc = ($005E or GDIP_WMF_RECORD_BASE), // META_ENDDOC
WmfRecordTypeDeleteObject = (META_DELETEOBJECT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeCreatePalette = (META_CREATEPALETTE or GDIP_WMF_RECORD_BASE),
WmfRecordTypeCreateBrush = ($00F8 or GDIP_WMF_RECORD_BASE), // META_CREATEBRUSH
WmfRecordTypeCreatePatternBrush = (META_CREATEPATTERNBRUSH or GDIP_WMF_RECORD_BASE),
WmfRecordTypeCreatePenIndirect = (META_CREATEPENINDIRECT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeCreateFontIndirect = (META_CREATEFONTINDIRECT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeCreateBrushIndirect = (META_CREATEBRUSHINDIRECT or GDIP_WMF_RECORD_BASE),
WmfRecordTypeCreateBitmapIndirect = ($02FD or GDIP_WMF_RECORD_BASE), // META_CREATEBITMAPINDIRECT
WmfRecordTypeCreateBitmap = ($06FE or GDIP_WMF_RECORD_BASE), // META_CREATEBITMAP
WmfRecordTypeCreateRegion = (META_CREATEREGION or GDIP_WMF_RECORD_BASE),
EmfRecordTypeHeader = EMR_HEADER,
EmfRecordTypePolyBezier = EMR_POLYBEZIER,
EmfRecordTypePolygon = EMR_POLYGON,
EmfRecordTypePolyline = EMR_POLYLINE,
EmfRecordTypePolyBezierTo = EMR_POLYBEZIERTO,
EmfRecordTypePolyLineTo = EMR_POLYLINETO,
EmfRecordTypePolyPolyline = EMR_POLYPOLYLINE,
EmfRecordTypePolyPolygon = EMR_POLYPOLYGON,
EmfRecordTypeSetWindowExtEx = EMR_SETWINDOWEXTEX,
EmfRecordTypeSetWindowOrgEx = EMR_SETWINDOWORGEX,
EmfRecordTypeSetViewportExtEx = EMR_SETVIEWPORTEXTEX,
EmfRecordTypeSetViewportOrgEx = EMR_SETVIEWPORTORGEX,
EmfRecordTypeSetBrushOrgEx = EMR_SETBRUSHORGEX,
EmfRecordTypeEOF = EMR_EOF,
EmfRecordTypeSetPixelV = EMR_SETPIXELV,
EmfRecordTypeSetMapperFlags = EMR_SETMAPPERFLAGS,
EmfRecordTypeSetMapMode = EMR_SETMAPMODE,
EmfRecordTypeSetBkMode = EMR_SETBKMODE,
EmfRecordTypeSetPolyFillMode = EMR_SETPOLYFILLMODE,
EmfRecordTypeSetROP2 = EMR_SETROP2,
EmfRecordTypeSetStretchBltMode = EMR_SETSTRETCHBLTMODE,
EmfRecordTypeSetTextAlign = EMR_SETTEXTALIGN,
EmfRecordTypeSetColorAdjustment = EMR_SETCOLORADJUSTMENT,
EmfRecordTypeSetTextColor = EMR_SETTEXTCOLOR,
EmfRecordTypeSetBkColor = EMR_SETBKCOLOR,
EmfRecordTypeOffsetClipRgn = EMR_OFFSETCLIPRGN,
EmfRecordTypeMoveToEx = EMR_MOVETOEX,
EmfRecordTypeSetMetaRgn = EMR_SETMETARGN,
EmfRecordTypeExcludeClipRect = EMR_EXCLUDECLIPRECT,
EmfRecordTypeIntersectClipRect = EMR_INTERSECTCLIPRECT,
EmfRecordTypeScaleViewportExtEx = EMR_SCALEVIEWPORTEXTEX,
EmfRecordTypeScaleWindowExtEx = EMR_SCALEWINDOWEXTEX,
EmfRecordTypeSaveDC = EMR_SAVEDC,
EmfRecordTypeRestoreDC = EMR_RESTOREDC,
EmfRecordTypeSetWorldTransform = EMR_SETWORLDTRANSFORM,
EmfRecordTypeModifyWorldTransform = EMR_MODIFYWORLDTRANSFORM,
EmfRecordTypeSelectObject = EMR_SELECTOBJECT,
EmfRecordTypeCreatePen = EMR_CREATEPEN,
EmfRecordTypeCreateBrushIndirect = EMR_CREATEBRUSHINDIRECT,
EmfRecordTypeDeleteObject = EMR_DELETEOBJECT,
EmfRecordTypeAngleArc = EMR_ANGLEARC,
EmfRecordTypeEllipse = EMR_ELLIPSE,
EmfRecordTypeRectangle = EMR_RECTANGLE,
EmfRecordTypeRoundRect = EMR_ROUNDRECT,
EmfRecordTypeArc = EMR_ARC,
EmfRecordTypeChord = EMR_CHORD,
EmfRecordTypePie = EMR_PIE,
EmfRecordTypeSelectPalette = EMR_SELECTPALETTE,
EmfRecordTypeCreatePalette = EMR_CREATEPALETTE,
EmfRecordTypeSetPaletteEntries = EMR_SETPALETTEENTRIES,
EmfRecordTypeResizePalette = EMR_RESIZEPALETTE,
EmfRecordTypeRealizePalette = EMR_REALIZEPALETTE,
EmfRecordTypeExtFloodFill = EMR_EXTFLOODFILL,
EmfRecordTypeLineTo = EMR_LINETO,
EmfRecordTypeArcTo = EMR_ARCTO,
EmfRecordTypePolyDraw = EMR_POLYDRAW,
EmfRecordTypeSetArcDirection = EMR_SETARCDIRECTION,
EmfRecordTypeSetMiterLimit = EMR_SETMITERLIMIT,
EmfRecordTypeBeginPath = EMR_BEGINPATH,
EmfRecordTypeEndPath = EMR_ENDPATH,
EmfRecordTypeCloseFigure = EMR_CLOSEFIGURE,
EmfRecordTypeFillPath = EMR_FILLPATH,
EmfRecordTypeStrokeAndFillPath = EMR_STROKEANDFILLPATH,
EmfRecordTypeStrokePath = EMR_STROKEPATH,
EmfRecordTypeFlattenPath = EMR_FLATTENPATH,
EmfRecordTypeWidenPath = EMR_WIDENPATH,
EmfRecordTypeSelectClipPath = EMR_SELECTCLIPPATH,
EmfRecordTypeAbortPath = EMR_ABORTPATH,
EmfRecordTypeReserved_069 = 69, // Not Used
EmfRecordTypeGdiComment = EMR_GDICOMMENT,
EmfRecordTypeFillRgn = EMR_FILLRGN,
EmfRecordTypeFrameRgn = EMR_FRAMERGN,
EmfRecordTypeInvertRgn = EMR_INVERTRGN,
EmfRecordTypePaintRgn = EMR_PAINTRGN,
EmfRecordTypeExtSelectClipRgn = EMR_EXTSELECTCLIPRGN,
EmfRecordTypeBitBlt = EMR_BITBLT,
EmfRecordTypeStretchBlt = EMR_STRETCHBLT,
EmfRecordTypeMaskBlt = EMR_MASKBLT,
EmfRecordTypePlgBlt = EMR_PLGBLT,
EmfRecordTypeSetDIBitsToDevice = EMR_SETDIBITSTODEVICE,
EmfRecordTypeStretchDIBits = EMR_STRETCHDIBITS,
EmfRecordTypeExtCreateFontIndirect = EMR_EXTCREATEFONTINDIRECTW,
EmfRecordTypeExtTextOutA = EMR_EXTTEXTOUTA,
EmfRecordTypeExtTextOutW = EMR_EXTTEXTOUTW,
EmfRecordTypePolyBezier16 = EMR_POLYBEZIER16,
EmfRecordTypePolygon16 = EMR_POLYGON16,
EmfRecordTypePolyline16 = EMR_POLYLINE16,
EmfRecordTypePolyBezierTo16 = EMR_POLYBEZIERTO16,
EmfRecordTypePolylineTo16 = EMR_POLYLINETO16,
EmfRecordTypePolyPolyline16 = EMR_POLYPOLYLINE16,
EmfRecordTypePolyPolygon16 = EMR_POLYPOLYGON16,
EmfRecordTypePolyDraw16 = EMR_POLYDRAW16,
EmfRecordTypeCreateMonoBrush = EMR_CREATEMONOBRUSH,
EmfRecordTypeCreateDIBPatternBrushPt = EMR_CREATEDIBPATTERNBRUSHPT,
EmfRecordTypeExtCreatePen = EMR_EXTCREATEPEN,
EmfRecordTypePolyTextOutA = EMR_POLYTEXTOUTA,
EmfRecordTypePolyTextOutW = EMR_POLYTEXTOUTW,
EmfRecordTypeSetICMMode = 98, // EMR_SETICMMODE,
EmfRecordTypeCreateColorSpace = 99, // EMR_CREATECOLORSPACE,
EmfRecordTypeSetColorSpace = 100, // EMR_SETCOLORSPACE,
EmfRecordTypeDeleteColorSpace = 101, // EMR_DELETECOLORSPACE,
EmfRecordTypeGLSRecord = 102, // EMR_GLSRECORD,
EmfRecordTypeGLSBoundedRecord = 103, // EMR_GLSBOUNDEDRECORD,
EmfRecordTypePixelFormat = 104, // EMR_PIXELFORMAT,
EmfRecordTypeDrawEscape = 105, // EMR_RESERVED_105,
EmfRecordTypeExtEscape = 106, // EMR_RESERVED_106,
EmfRecordTypeStartDoc = 107, // EMR_RESERVED_107,
EmfRecordTypeSmallTextOut = 108, // EMR_RESERVED_108,
EmfRecordTypeForceUFIMapping = 109, // EMR_RESERVED_109,
EmfRecordTypeNamedEscape = 110, // EMR_RESERVED_110,
EmfRecordTypeColorCorrectPalette = 111, // EMR_COLORCORRECTPALETTE,
EmfRecordTypeSetICMProfileA = 112, // EMR_SETICMPROFILEA,
EmfRecordTypeSetICMProfileW = 113, // EMR_SETICMPROFILEW,
EmfRecordTypeAlphaBlend = 114, // EMR_ALPHABLEND,
EmfRecordTypeSetLayout = 115, // EMR_SETLAYOUT,
EmfRecordTypeTransparentBlt = 116, // EMR_TRANSPARENTBLT,
EmfRecordTypeReserved_117 = 117, // Not Used
EmfRecordTypeGradientFill = 118, // EMR_GRADIENTFILL,
EmfRecordTypeSetLinkedUFIs = 119, // EMR_RESERVED_119,
EmfRecordTypeSetTextJustification = 120, // EMR_RESERVED_120,
EmfRecordTypeColorMatchToTargetW = 121, // EMR_COLORMATCHTOTARGETW,
EmfRecordTypeCreateColorSpaceW = 122, // EMR_CREATECOLORSPACEW,
EmfRecordTypeMax = 122,
EmfRecordTypeMin = 1,
// That is the END of the GDI EMF records.
// Now we start the list of EMF+ records. We leave quite
// a bit of room here for the addition of any new GDI
// records that may be added later.
EmfPlusRecordTypeInvalid = GDIP_EMFPLUS_RECORD_BASE,
EmfPlusRecordTypeHeader,
EmfPlusRecordTypeEndOfFile,
EmfPlusRecordTypeComment,
EmfPlusRecordTypeGetDC,
EmfPlusRecordTypeMultiFormatStart,
EmfPlusRecordTypeMultiFormatSection,
EmfPlusRecordTypeMultiFormatEnd,
// For all persistent objects
EmfPlusRecordTypeObject,
// Drawing Records
EmfPlusRecordTypeClear,
EmfPlusRecordTypeFillRects,
EmfPlusRecordTypeDrawRects,
EmfPlusRecordTypeFillPolygon,
EmfPlusRecordTypeDrawLines,
EmfPlusRecordTypeFillEllipse,
EmfPlusRecordTypeDrawEllipse,
EmfPlusRecordTypeFillPie,
EmfPlusRecordTypeDrawPie,
EmfPlusRecordTypeDrawArc,
EmfPlusRecordTypeFillRegion,
EmfPlusRecordTypeFillPath,
EmfPlusRecordTypeDrawPath,
EmfPlusRecordTypeFillClosedCurve,
EmfPlusRecordTypeDrawClosedCurve,
EmfPlusRecordTypeDrawCurve,
EmfPlusRecordTypeDrawBeziers,
EmfPlusRecordTypeDrawImage,
EmfPlusRecordTypeDrawImagePoints,
EmfPlusRecordTypeDrawString,
// Graphics State Records
EmfPlusRecordTypeSetRenderingOrigin,
EmfPlusRecordTypeSetAntiAliasMode,
EmfPlusRecordTypeSetTextRenderingHint,
EmfPlusRecordTypeSetTextContrast,
EmfPlusRecordTypeSetInterpolationMode,
EmfPlusRecordTypeSetPixelOffsetMode,
EmfPlusRecordTypeSetCompositingMode,
EmfPlusRecordTypeSetCompositingQuality,
EmfPlusRecordTypeSave,
EmfPlusRecordTypeRestore,
EmfPlusRecordTypeBeginContainer,
EmfPlusRecordTypeBeginContainerNoParams,
EmfPlusRecordTypeEndContainer,
EmfPlusRecordTypeSetWorldTransform,
EmfPlusRecordTypeResetWorldTransform,
EmfPlusRecordTypeMultiplyWorldTransform,
EmfPlusRecordTypeTranslateWorldTransform,
EmfPlusRecordTypeScaleWorldTransform,
EmfPlusRecordTypeRotateWorldTransform,
EmfPlusRecordTypeSetPageTransform,
EmfPlusRecordTypeResetClip,
EmfPlusRecordTypeSetClipRect,
EmfPlusRecordTypeSetClipPath,
EmfPlusRecordTypeSetClipRegion,
EmfPlusRecordTypeOffsetClip,
EmfPlusRecordTypeDrawDriverString,
EmfPlusRecordTotal,
EmfPlusRecordTypeMax = EmfPlusRecordTotal-1,
EmfPlusRecordTypeMin = EmfPlusRecordTypeHeader
);
TEmfPlusRecordType = EmfPlusRecordType;
//---------------------------------------------------------------------------
// StringFormatFlags
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// String format flags
//
// DirectionRightToLeft - For horizontal text, the reading order is
// right to left. This value is called
// the base embedding level by the Unicode
// bidirectional engine.
// For vertical text, columns are read from
// right to left.
// By default, horizontal or vertical text is
// read from left to right.
//
// DirectionVertical - Individual lines of text are vertical. In
// each line, characters progress from top to
// bottom.
// By default, lines of text are horizontal,
// each new line below the previous line.
//
// NoFitBlackBox - Allows parts of glyphs to overhang the
// bounding rectangle.
// By default glyphs are first aligned
// inside the margines, then any glyphs which
// still overhang the bounding box are
// repositioned to avoid any overhang.
// For example when an italic
// lower case letter f in a font such as
// Garamond is aligned at the far left of a
// rectangle, the lower part of the f will
// reach slightly further left than the left
// edge of the rectangle. Setting this flag
// will ensure the character aligns visually
// with the lines above and below, but may
// cause some pixels outside the formatting
// rectangle to be clipped or painted.
//
// DisplayFormatControl - Causes control characters such as the
// left-to-right mark to be shown in the
// output with a representative glyph.
//
// NoFontFallback - Disables fallback to alternate fonts for
// characters not supported in the requested
// font. Any missing characters will be
// be displayed with the fonts missing glyph,
// usually an open square.
//
// NoWrap - Disables wrapping of text between lines
// when formatting within a rectangle.
// NoWrap is implied when a point is passed
// instead of a rectangle, or when the
// specified rectangle has a zero line length.
//
// NoClip - By default text is clipped to the
// formatting rectangle. Setting NoClip
// allows overhanging pixels to affect the
// device outside the formatting rectangle.
// Pixels at the end of the line may be
// affected if the glyphs overhang their
// cells, and either the NoFitBlackBox flag
// has been set, or the glyph extends to far
// to be fitted.
// Pixels above/before the first line or
// below/after the last line may be affected
// if the glyphs extend beyond their cell
// ascent / descent. This can occur rarely
// with unusual diacritic mark combinations.
//---------------------------------------------------------------------------
{$EXTERNALSYM StringFormatFlags}
StringFormatFlags = Integer;
const
StringFormatFlagsDirectionRightToLeft = $00000001;
StringFormatFlagsDirectionVertical = $00000002;
StringFormatFlagsNoFitBlackBox = $00000004;
StringFormatFlagsDisplayFormatControl = $00000020;
StringFormatFlagsNoFontFallback = $00000400;
StringFormatFlagsMeasureTrailingSpaces = $00000800;
StringFormatFlagsNoWrap = $00001000;
StringFormatFlagsLineLimit = $00002000;
StringFormatFlagsNoClip = $00004000;
Type
TStringFormatFlags = StringFormatFlags;
//---------------------------------------------------------------------------
// StringTrimming
//---------------------------------------------------------------------------
{$EXTERNALSYM StringTrimming}
StringTrimming = (
StringTrimmingNone = 0,
StringTrimmingCharacter = 1,
StringTrimmingWord = 2,
StringTrimmingEllipsisCharacter = 3,
StringTrimmingEllipsisWord = 4,
StringTrimmingEllipsisPath = 5
);
TStringTrimming = StringTrimming;
//---------------------------------------------------------------------------
// National language digit substitution
//---------------------------------------------------------------------------
{$EXTERNALSYM StringDigitSubstitute}
StringDigitSubstitute = (
StringDigitSubstituteUser = 0, // As NLS setting
StringDigitSubstituteNone = 1,
StringDigitSubstituteNational = 2,
StringDigitSubstituteTraditional = 3
);
TStringDigitSubstitute = StringDigitSubstitute;
PStringDigitSubstitute = ^TStringDigitSubstitute;
//---------------------------------------------------------------------------
// Hotkey prefix interpretation
//---------------------------------------------------------------------------
{$EXTERNALSYM HotkeyPrefix}
HotkeyPrefix = (
HotkeyPrefixNone = 0,
HotkeyPrefixShow = 1,
HotkeyPrefixHide = 2
);
THotkeyPrefix = HotkeyPrefix;
//---------------------------------------------------------------------------
// String alignment flags
//---------------------------------------------------------------------------
{$EXTERNALSYM StringAlignment}
StringAlignment = (
// Left edge for left-to-right text,
// right for right-to-left text,
// and top for vertical
StringAlignmentNear = 0,
StringAlignmentCenter = 1,
StringAlignmentFar = 2
);
TStringAlignment = StringAlignment;
//---------------------------------------------------------------------------
// DriverStringOptions
//---------------------------------------------------------------------------
{$EXTERNALSYM DriverStringOptions}
DriverStringOptions = Integer;
const
DriverStringOptionsCmapLookup = 1;
DriverStringOptionsVertical = 2;
DriverStringOptionsRealizedAdvance = 4;
DriverStringOptionsLimitSubpixel = 8;
type
TDriverStringOptions = DriverStringOptions;
//---------------------------------------------------------------------------
// Flush Intention flags
//---------------------------------------------------------------------------
{$EXTERNALSYM FlushIntention}
FlushIntention = (
FlushIntentionFlush = 0, // Flush all batched rendering operations
FlushIntentionSync = 1 // Flush all batched rendering operations
// and wait for them to complete
);
TFlushIntention = FlushIntention;
//---------------------------------------------------------------------------
// Image encoder parameter related types
//---------------------------------------------------------------------------
{$EXTERNALSYM EncoderParameterValueType}
EncoderParameterValueType = Integer;
const
EncoderParameterValueTypeByte : Integer = 1; // 8-bit unsigned int
EncoderParameterValueTypeASCII : Integer = 2; // 8-bit byte containing one 7-bit ASCII
// code. NULL terminated.
EncoderParameterValueTypeShort : Integer = 3; // 16-bit unsigned int
EncoderParameterValueTypeLong : Integer = 4; // 32-bit unsigned int
EncoderParameterValueTypeRational : Integer = 5; // Two Longs. The first Long is the
// numerator, the second Long expresses the
// denomintor.
EncoderParameterValueTypeLongRange : Integer = 6; // Two longs which specify a range of
// integer values. The first Long specifies
// the lower end and the second one
// specifies the higher end. All values
// are inclusive at both ends
EncoderParameterValueTypeUndefined : Integer = 7; // 8-bit byte that can take any value
// depending on field definition
EncoderParameterValueTypeRationalRange : Integer = 8; // Two Rationals. The first Rational
// specifies the lower end and the second
// specifies the higher end. All values
// are inclusive at both ends
type
TEncoderParameterValueType = EncoderParameterValueType;
//---------------------------------------------------------------------------
// Image encoder value types
//---------------------------------------------------------------------------
{$EXTERNALSYM EncoderValue}
EncoderValue = (
EncoderValueColorTypeCMYK,
EncoderValueColorTypeYCCK,
EncoderValueCompressionLZW,
EncoderValueCompressionCCITT3,
EncoderValueCompressionCCITT4,
EncoderValueCompressionRle,
EncoderValueCompressionNone,
EncoderValueScanMethodInterlaced,
EncoderValueScanMethodNonInterlaced,
EncoderValueVersionGif87,
EncoderValueVersionGif89,
EncoderValueRenderProgressive,
EncoderValueRenderNonProgressive,
EncoderValueTransformRotate90,
EncoderValueTransformRotate180,
EncoderValueTransformRotate270,
EncoderValueTransformFlipHorizontal,
EncoderValueTransformFlipVertical,
EncoderValueMultiFrame,
EncoderValueLastFrame,
EncoderValueFlush,
EncoderValueFrameDimensionTime,
EncoderValueFrameDimensionResolution,
EncoderValueFrameDimensionPage
);
TEncoderValue = EncoderValue;
//---------------------------------------------------------------------------
// Conversion of Emf To WMF Bits flags
//---------------------------------------------------------------------------
{$EXTERNALSYM EmfToWmfBitsFlags}
EmfToWmfBitsFlags = (
EmfToWmfBitsFlagsDefault = $00000000,
EmfToWmfBitsFlagsEmbedEmf = $00000001,
EmfToWmfBitsFlagsIncludePlaceable = $00000002,
EmfToWmfBitsFlagsNoXORClip = $00000004
);
TEmfToWmfBitsFlags = EmfToWmfBitsFlags;
(**************************************************************************\
*
* GDI+ Types
*
\**************************************************************************)
//--------------------------------------------------------------------------
// Callback functions
//--------------------------------------------------------------------------
{$EXTERNALSYM ImageAbort}
ImageAbort = function: BOOL; stdcall;
{$EXTERNALSYM DrawImageAbort}
DrawImageAbort = ImageAbort;
{$EXTERNALSYM GetThumbnailImageAbort}
GetThumbnailImageAbort = ImageAbort;
// Callback for EnumerateMetafile methods. The parameters are:
// recordType WMF, EMF, or EMF+ record type
// flags (always 0 for WMF/EMF records)
// dataSize size of the record data (in bytes), or 0 if no data
// data pointer to the record data, or NULL if no data
// callbackData pointer to callbackData, if any
// This method can then call Metafile::PlayRecord to play the
// record that was just enumerated. If this method returns
// FALSE, the enumeration process is aborted. Otherwise, it continues.
{$EXTERNALSYM EnumerateMetafileProc}
EnumerateMetafileProc = function(recordType: EmfPlusRecordType; flags: UINT;
dataSize: UINT; data: PBYTE; callbackData: pointer): BOOL; stdcall;
//--------------------------------------------------------------------------
// Primitive data types
//
// NOTE:
// Types already defined in standard header files:
// INT8
// UINT8
// INT16
// UINT16
// INT32
// UINT32
// INT64
// UINT64
//
// Avoid using the following types:
// LONG - use INT
// ULONG - use UINT
// DWORD - use UINT32
//--------------------------------------------------------------------------
const
{ from float.h }
FLT_MAX = 3.402823466e+38; // max value
FLT_MIN = 1.175494351e-38; // min positive value
REAL_MAX = FLT_MAX;
{$EXTERNALSYM REAL_MAX}
REAL_MIN = FLT_MIN;
{$EXTERNALSYM REAL_MIN}
REAL_TOLERANCE = (FLT_MIN * 100);
{$EXTERNALSYM REAL_TOLERANCE}
REAL_EPSILON = 1.192092896e-07; // FLT_EPSILON
{$EXTERNALSYM REAL_EPSILON}
//--------------------------------------------------------------------------
// Status return values from GDI+ methods
//--------------------------------------------------------------------------
type
{$EXTERNALSYM Status}
Status = (
Ok,
GenericError,
InvalidParameter,
OutOfMemory,
ObjectBusy,
InsufficientBuffer,
NotImplemented,
Win32Error,
WrongState,
Aborted,
FileNotFound,
ValueOverflow,
AccessDenied,
UnknownImageFormat,
FontFamilyNotFound,
FontStyleNotFound,
NotTrueTypeFont,
UnsupportedGdiplusVersion,
GdiplusNotInitialized,
PropertyNotFound,
PropertyNotSupported
);
TStatus = Status;
//--------------------------------------------------------------------------
// Represents a dimension in a 2D coordinate system (floating-point coordinates)
//--------------------------------------------------------------------------
type
PSizeF = ^TSizeF;
TSizeF = packed record
Width : Single;
Height : Single;
end;
function MakeSize(Width, Height: Single): TSizeF; overload;
//--------------------------------------------------------------------------
// Represents a dimension in a 2D coordinate system (integer coordinates)
//--------------------------------------------------------------------------
type
PSize = ^TSize;
TSize = packed record
Width : Integer;
Height : Integer;
end;
function MakeSize(Width, Height: Integer): TSize; overload;
//--------------------------------------------------------------------------
// Represents a location in a 2D coordinate system (floating-point coordinates)
//--------------------------------------------------------------------------
type
PPointF = ^TPointF;
TPointF = packed record
X : Single;
Y : Single;
end;
TPointFDynArray = array of TPointF;
function MakePoint(X, Y: Single): TPointF; overload;
//--------------------------------------------------------------------------
// Represents a location in a 2D coordinate system (integer coordinates)
//--------------------------------------------------------------------------
type
PPoint = ^TPoint;
TPoint = packed record
X : Integer;
Y : Integer;
end;
TPointDynArray = array of TPoint;
function MakePoint(X, Y: Integer): TPoint; overload;
//--------------------------------------------------------------------------
// Represents a rectangle in a 2D coordinate system (floating-point coordinates)
//--------------------------------------------------------------------------
type
PRectF = ^TRectF;
TRectF = packed record
X : Single;
Y : Single;
Width : Single;
Height: Single;
end;
TRectFDynArray = array of TRectF;
function MakeRect(x, y, width, height: Single): TRectF; overload;
function MakeRect(location: TPointF; size: TSizeF): TRectF; overload;
type
PRect = ^TRect;
TRect = packed record
X : Integer;
Y : Integer;
Width : Integer;
Height: Integer;
end;
TRectDynArray = array of TRect;
function MakeRect(x, y, width, height: Integer): TRect; overload;
function MakeRect(location: TPoint; size: TSize): Trect; overload;
type
TPathData = packed class
public
Count : Integer;
Points : PPointF;
Types : PBYTE;
constructor Create;
destructor destroy; override;
end;
PCharacterRange = ^TCharacterRange;
TCharacterRange = packed record
First : Integer;
Length : Integer;
end;
function MakeCharacterRange(First, Length: Integer): TCharacterRange;
(**************************************************************************
*
* GDI+ Startup and Shutdown APIs
*
**************************************************************************)
type
{$EXTERNALSYM DebugEventLevel}
DebugEventLevel = (
DebugEventLevelFatal,
DebugEventLevelWarning
);
TDebugEventLevel = DebugEventLevel;
// Callback function that GDI+ can call, on debug builds, for assertions
// and warnings.
{$EXTERNALSYM DebugEventProc}
DebugEventProc = procedure(level: DebugEventLevel; message: PChar); stdcall;
// Notification functions which the user must call appropriately if
// "SuppressBackgroundThread" (below) is set.
{$EXTERNALSYM NotificationHookProc}
NotificationHookProc = function(out token: ULONG): Status; stdcall;
{$EXTERNALSYM NotificationUnhookProc}
NotificationUnhookProc = procedure(token: ULONG); stdcall;
// Input structure for GdiplusStartup
{$EXTERNALSYM GdiplusStartupInput}
GdiplusStartupInput = packed record
GdiplusVersion : Cardinal; // Must be 1
DebugEventCallback : DebugEventProc; // Ignored on free builds
SuppressBackgroundThread: BOOL; // FALSE unless you're prepared to call
// the hook/unhook functions properly
SuppressExternalCodecs : BOOL; // FALSE unless you want GDI+ only to use
end; // its internal image codecs.
TGdiplusStartupInput = GdiplusStartupInput;
PGdiplusStartupInput = ^TGdiplusStartupInput;
// Output structure for GdiplusStartup()
{$EXTERNALSYM GdiplusStartupOutput}
GdiplusStartupOutput = packed record
// The following 2 fields are NULL if SuppressBackgroundThread is FALSE.
// Otherwise, they are functions which must be called appropriately to
// replace the background thread.
//
// These should be called on the application's main message loop - i.e.
// a message loop which is active for the lifetime of GDI+.
// "NotificationHook" should be called before starting the loop,
// and "NotificationUnhook" should be called after the loop ends.
NotificationHook : NotificationHookProc;
NotificationUnhook: NotificationUnhookProc;
end;
TGdiplusStartupOutput = GdiplusStartupOutput;
PGdiplusStartupOutput = ^TGdiplusStartupOutput;
// GDI+ initialization. Must not be called from DllMain - can cause deadlock.
//
// Must be called before GDI+ API's or constructors are used.
//
// token - may not be NULL - accepts a token to be passed in the corresponding
// GdiplusShutdown call.
// input - may not be NULL
// output - may be NULL only if input->SuppressBackgroundThread is FALSE.
{$EXTERNALSYM GdiplusStartup}
function GdiplusStartup(out token: ULONG; input: PGdiplusStartupInput;
output: PGdiplusStartupOutput): Status; stdcall; external 'gdiplus.dll';
// GDI+ termination. Must be called before GDI+ is unloaded.
// Must not be called from DllMain - can cause deadlock.
//
// GDI+ API's may not be called after GdiplusShutdown. Pay careful attention
// to GDI+ object destructors.
{$EXTERNALSYM GdiplusShutdown}
procedure GdiplusShutdown(token: ULONG); stdcall; external 'gdiplus.dll';
(**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
* Module Name:
* Gdiplus Pixel Formats
* Abstract:
* GDI+ Pixel Formats
*
\**************************************************************************)
type
PARGB = ^ARGB;
ARGB = DWORD;
{$EXTERNALSYM ARGB}
ARGB64 = Int64;
{$EXTERNALSYM ARGB64}
const
ALPHA_SHIFT = 24;
{$EXTERNALSYM ALPHA_SHIFT}
RED_SHIFT = 16;
{$EXTERNALSYM RED_SHIFT}
GREEN_SHIFT = 8;
{$EXTERNALSYM GREEN_SHIFT}
BLUE_SHIFT = 0;
{$EXTERNALSYM BLUE_SHIFT}
ALPHA_MASK = (ARGB($ff) shl ALPHA_SHIFT);
{$EXTERNALSYM ALPHA_MASK}
// In-memory pixel data formats:
// bits 0-7 = format index
// bits 8-15 = pixel size (in bits)
// bits 16-23 = flags
// bits 24-31 = reserved
type
PixelFormat = Integer;
{$EXTERNALSYM PixelFormat}
TPixelFormat = PixelFormat;
const
PixelFormatIndexed = $00010000; // Indexes into a palette
{$EXTERNALSYM PixelFormatIndexed}
PixelFormatGDI = $00020000; // Is a GDI-supported format
{$EXTERNALSYM PixelFormatGDI}
PixelFormatAlpha = $00040000; // Has an alpha component
{$EXTERNALSYM PixelFormatAlpha}
PixelFormatPAlpha = $00080000; // Pre-multiplied alpha
{$EXTERNALSYM PixelFormatPAlpha}
PixelFormatExtended = $00100000; // Extended color 16 bits/channel
{$EXTERNALSYM PixelFormatExtended}
PixelFormatCanonical = $00200000;
{$EXTERNALSYM PixelFormatCanonical}
PixelFormatUndefined = 0;
{$EXTERNALSYM PixelFormatUndefined}
PixelFormatDontCare = 0;
{$EXTERNALSYM PixelFormatDontCare}
PixelFormat1bppIndexed = (1 or ( 1 shl 8) or PixelFormatIndexed or PixelFormatGDI);
{$EXTERNALSYM PixelFormat1bppIndexed}
PixelFormat4bppIndexed = (2 or ( 4 shl 8) or PixelFormatIndexed or PixelFormatGDI);
{$EXTERNALSYM PixelFormat4bppIndexed}
PixelFormat8bppIndexed = (3 or ( 8 shl 8) or PixelFormatIndexed or PixelFormatGDI);
{$EXTERNALSYM PixelFormat8bppIndexed}
PixelFormat16bppGrayScale = (4 or (16 shl 8) or PixelFormatExtended);
{$EXTERNALSYM PixelFormat16bppGrayScale}
PixelFormat16bppRGB555 = (5 or (16 shl 8) or PixelFormatGDI);
{$EXTERNALSYM PixelFormat16bppRGB555}
PixelFormat16bppRGB565 = (6 or (16 shl 8) or PixelFormatGDI);
{$EXTERNALSYM PixelFormat16bppRGB565}
PixelFormat16bppARGB1555 = (7 or (16 shl 8) or PixelFormatAlpha or PixelFormatGDI);
{$EXTERNALSYM PixelFormat16bppARGB1555}
PixelFormat24bppRGB = (8 or (24 shl 8) or PixelFormatGDI);
{$EXTERNALSYM PixelFormat24bppRGB}
PixelFormat32bppRGB = (9 or (32 shl 8) or PixelFormatGDI);
{$EXTERNALSYM PixelFormat32bppRGB}
PixelFormat32bppARGB = (10 or (32 shl 8) or PixelFormatAlpha or PixelFormatGDI or PixelFormatCanonical);
{$EXTERNALSYM PixelFormat32bppARGB}
PixelFormat32bppPARGB = (11 or (32 shl 8) or PixelFormatAlpha or PixelFormatPAlpha or PixelFormatGDI);
{$EXTERNALSYM PixelFormat32bppPARGB}
PixelFormat48bppRGB = (12 or (48 shl 8) or PixelFormatExtended);
{$EXTERNALSYM PixelFormat48bppRGB}
PixelFormat64bppARGB = (13 or (64 shl 8) or PixelFormatAlpha or PixelFormatCanonical or PixelFormatExtended);
{$EXTERNALSYM PixelFormat64bppARGB}
PixelFormat64bppPARGB = (14 or (64 shl 8) or PixelFormatAlpha or PixelFormatPAlpha or PixelFormatExtended);
{$EXTERNALSYM PixelFormat64bppPARGB}
PixelFormatMax = 15;
{$EXTERNALSYM PixelFormatMax}
{$EXTERNALSYM GetPixelFormatSize}
function GetPixelFormatSize(pixfmt: PixelFormat): UINT;
{$EXTERNALSYM IsIndexedPixelFormat}
function IsIndexedPixelFormat(pixfmt: PixelFormat): BOOL;
{$EXTERNALSYM IsAlphaPixelFormat}
function IsAlphaPixelFormat(pixfmt: PixelFormat): BOOL;
{$EXTERNALSYM IsExtendedPixelFormat}
function IsExtendedPixelFormat(pixfmt: PixelFormat): BOOL;
//--------------------------------------------------------------------------
// Determine if the Pixel Format is Canonical format:
// PixelFormat32bppARGB
// PixelFormat32bppPARGB
// PixelFormat64bppARGB
// PixelFormat64bppPARGB
//--------------------------------------------------------------------------
{$EXTERNALSYM IsCanonicalPixelFormat}
function IsCanonicalPixelFormat(pixfmt: PixelFormat): BOOL;
type
{$EXTERNALSYM PaletteFlags}
PaletteFlags = (
PaletteFlagsHasAlpha = $0001,
PaletteFlagsGrayScale = $0002,
PaletteFlagsHalftone = $0004
);
TPaletteFlags = PaletteFlags;
{$EXTERNALSYM ColorPalette}
ColorPalette = packed record
Flags : UINT ; // Palette flags
Count : UINT ; // Number of color entries
Entries: array [0..0] of ARGB ; // Palette color entries
end;
TColorPalette = ColorPalette;
PColorPalette = ^TColorPalette;
(**************************************************************************\
*
* GDI+ Color Object
*
\**************************************************************************)
//----------------------------------------------------------------------------
// Color mode
//----------------------------------------------------------------------------
{$EXTERNALSYM ColorMode}
ColorMode = (
ColorModeARGB32 = 0,
ColorModeARGB64 = 1
);
TColorMode = ColorMode;
//----------------------------------------------------------------------------
// Color Channel flags
//----------------------------------------------------------------------------
{$EXTERNALSYM ColorChannelFlags}
ColorChannelFlags = (
ColorChannelFlagsC = 0,
ColorChannelFlagsM,
ColorChannelFlagsY,
ColorChannelFlagsK,
ColorChannelFlagsLast
);
TColorChannelFlags = ColorChannelFlags;
//----------------------------------------------------------------------------
// Color
//----------------------------------------------------------------------------
// Common color constants
const
aclAliceBlue = $FFF0F8FF;
aclAntiqueWhite = $FFFAEBD7;
aclAqua = $FF00FFFF;
aclAquamarine = $FF7FFFD4;
aclAzure = $FFF0FFFF;
aclBeige = $FFF5F5DC;
aclBisque = $FFFFE4C4;
aclBlack = $FF000000;
aclBlanchedAlmond = $FFFFEBCD;
aclBlue = $FF0000FF;
aclBlueViolet = $FF8A2BE2;
aclBrown = $FFA52A2A;
aclBurlyWood = $FFDEB887;
aclCadetBlue = $FF5F9EA0;
aclChartreuse = $FF7FFF00;
aclChocolate = $FFD2691E;
aclCoral = $FFFF7F50;
aclCornflowerBlue = $FF6495ED;
aclCornsilk = $FFFFF8DC;
aclCrimson = $FFDC143C;
aclCyan = $FF00FFFF;
aclDarkBlue = $FF00008B;
aclDarkCyan = $FF008B8B;
aclDarkGoldenrod = $FFB8860B;
aclDarkGray = $FFA9A9A9;
aclDarkGreen = $FF006400;
aclDarkKhaki = $FFBDB76B;
aclDarkMagenta = $FF8B008B;
aclDarkOliveGreen = $FF556B2F;
aclDarkOrange = $FFFF8C00;
aclDarkOrchid = $FF9932CC;
aclDarkRed = $FF8B0000;
aclDarkSalmon = $FFE9967A;
aclDarkSeaGreen = $FF8FBC8B;
aclDarkSlateBlue = $FF483D8B;
aclDarkSlateGray = $FF2F4F4F;
aclDarkTurquoise = $FF00CED1;
aclDarkViolet = $FF9400D3;
aclDeepPink = $FFFF1493;
aclDeepSkyBlue = $FF00BFFF;
aclDimGray = $FF696969;
aclDodgerBlue = $FF1E90FF;
aclFirebrick = $FFB22222;
aclFloralWhite = $FFFFFAF0;
aclForestGreen = $FF228B22;
aclFuchsia = $FFFF00FF;
aclGainsboro = $FFDCDCDC;
aclGhostWhite = $FFF8F8FF;
aclGold = $FFFFD700;
aclGoldenrod = $FFDAA520;
aclGray = $FF808080;
aclGreen = $FF008000;
aclGreenYellow = $FFADFF2F;
aclHoneydew = $FFF0FFF0;
aclHotPink = $FFFF69B4;
aclIndianRed = $FFCD5C5C;
aclIndigo = $FF4B0082;
aclIvory = $FFFFFFF0;
aclKhaki = $FFF0E68C;
aclLavender = $FFE6E6FA;
aclLavenderBlush = $FFFFF0F5;
aclLawnGreen = $FF7CFC00;
aclLemonChiffon = $FFFFFACD;
aclLightBlue = $FFADD8E6;
aclLightCoral = $FFF08080;
aclLightCyan = $FFE0FFFF;
aclLightGoldenrodYellow = $FFFAFAD2;
aclLightGray = $FFD3D3D3;
aclLightGreen = $FF90EE90;
aclLightPink = $FFFFB6C1;
aclLightSalmon = $FFFFA07A;
aclLightSeaGreen = $FF20B2AA;
aclLightSkyBlue = $FF87CEFA;
aclLightSlateGray = $FF778899;
aclLightSteelBlue = $FFB0C4DE;
aclLightYellow = $FFFFFFE0;
aclLime = $FF00FF00;
aclLimeGreen = $FF32CD32;
aclLinen = $FFFAF0E6;
aclMagenta = $FFFF00FF;
aclMaroon = $FF800000;
aclMediumAquamarine = $FF66CDAA;
aclMediumBlue = $FF0000CD;
aclMediumOrchid = $FFBA55D3;
aclMediumPurple = $FF9370DB;
aclMediumSeaGreen = $FF3CB371;
aclMediumSlateBlue = $FF7B68EE;
aclMediumSpringGreen = $FF00FA9A;
aclMediumTurquoise = $FF48D1CC;
aclMediumVioletRed = $FFC71585;
aclMidnightBlue = $FF191970;
aclMintCream = $FFF5FFFA;
aclMistyRose = $FFFFE4E1;
aclMoccasin = $FFFFE4B5;
aclNavajoWhite = $FFFFDEAD;
aclNavy = $FF000080;
aclOldLace = $FFFDF5E6;
aclOlive = $FF808000;
aclOliveDrab = $FF6B8E23;
aclOrange = $FFFFA500;
aclOrangeRed = $FFFF4500;
aclOrchid = $FFDA70D6;
aclPaleGoldenrod = $FFEEE8AA;
aclPaleGreen = $FF98FB98;
aclPaleTurquoise = $FFAFEEEE;
aclPaleVioletRed = $FFDB7093;
aclPapayaWhip = $FFFFEFD5;
aclPeachPuff = $FFFFDAB9;
aclPeru = $FFCD853F;
aclPink = $FFFFC0CB;
aclPlum = $FFDDA0DD;
aclPowderBlue = $FFB0E0E6;
aclPurple = $FF800080;
aclRed = $FFFF0000;
aclRosyBrown = $FFBC8F8F;
aclRoyalBlue = $FF4169E1;
aclSaddleBrown = $FF8B4513;
aclSalmon = $FFFA8072;
aclSandyBrown = $FFF4A460;
aclSeaGreen = $FF2E8B57;
aclSeaShell = $FFFFF5EE;
aclSienna = $FFA0522D;
aclSilver = $FFC0C0C0;
aclSkyBlue = $FF87CEEB;
aclSlateBlue = $FF6A5ACD;
aclSlateGray = $FF708090;
aclSnow = $FFFFFAFA;
aclSpringGreen = $FF00FF7F;
aclSteelBlue = $FF4682B4;
aclTan = $FFD2B48C;
aclTeal = $FF008080;
aclThistle = $FFD8BFD8;
aclTomato = $FFFF6347;
aclTransparent = $00FFFFFF;
aclTurquoise = $FF40E0D0;
aclViolet = $FFEE82EE;
aclWheat = $FFF5DEB3;
aclWhite = $FFFFFFFF;
aclWhiteSmoke = $FFF5F5F5;
aclYellow = $FFFFFF00;
aclYellowGreen = $FF9ACD32;
// Shift count and bit mask for A, R, G, B components
AlphaShift = 24;
{$EXTERNALSYM AlphaShift}
RedShift = 16;
{$EXTERNALSYM RedShift}
GreenShift = 8;
{$EXTERNALSYM GreenShift}
BlueShift = 0;
{$EXTERNALSYM BlueShift}
AlphaMask = $ff000000;
{$EXTERNALSYM AlphaMask}
RedMask = $00ff0000;
{$EXTERNALSYM RedMask}
GreenMask = $0000ff00;
{$EXTERNALSYM GreenMask}
BlueMask = $000000ff;
{$EXTERNALSYM BlueMask}
type
{ TColor = class
protected
Argb: ARGB;
public
constructor Create; overload;
constructor Create(r, g, b: Byte); overload;
constructor Create(a, r, g, b: Byte); overload;
constructor Create(Value: ARGB); overload;
function GetAlpha: BYTE;
function GetA: BYTE;
function GetRed: BYTE;
function GetR: BYTE;
function GetGreen: Byte;
function GetG: Byte;
function GetBlue: Byte;
function GetB: Byte;
function GetValue: ARGB;
procedure SetValue(Value: ARGB);
procedure SetFromCOLORREF(rgb: COLORREF);
function ToCOLORREF: COLORREF;
function MakeARGB(a, r, g, b: Byte): ARGB;
end; }
PColor = ^TColor;
TColor = ARGB;
TColorDynArray = array of TColor;
function MakeColor(r, g, b: Byte): ARGB; overload;
function MakeColor(a, r, g, b: Byte): ARGB; overload;
function GetAlpha(color: ARGB): BYTE;
function GetRed(color: ARGB): BYTE;
function GetGreen(color: ARGB): BYTE;
function GetBlue(color: ARGB): BYTE;
function ColorRefToARGB(rgb: COLORREF): ARGB;
function ARGBToColorRef(Color: ARGB): COLORREF;
(**************************************************************************\
*
* GDI+ Metafile Related Structures
*
\**************************************************************************)
type
{ from Windef.h }
RECTL = Windows.Trect;
SIZEL = Windows.TSize;
{$EXTERNALSYM ENHMETAHEADER3}
ENHMETAHEADER3 = packed record
iType : DWORD; // Record type EMR_HEADER
nSize : DWORD; // Record size in bytes. This may be greater
// than the sizeof(ENHMETAHEADER).
rclBounds : RECTL; // Inclusive-inclusive bounds in device units
rclFrame : RECTL; // Inclusive-inclusive Picture Frame .01mm unit
dSignature : DWORD; // Signature. Must be ENHMETA_SIGNATURE.
nVersion : DWORD; // Version number
nBytes : DWORD; // Size of the metafile in bytes
nRecords : DWORD; // Number of records in the metafile
nHandles : WORD; // Number of handles in the handle table
// Handle index zero is reserved.
sReserved : WORD; // Reserved. Must be zero.
nDescription : DWORD; // Number of chars in the unicode desc string
// This is 0 if there is no description string
offDescription : DWORD; // Offset to the metafile description record.
// This is 0 if there is no description string
nPalEntries : DWORD; // Number of entries in the metafile palette.
szlDevice : SIZEL; // Size of the reference device in pels
szlMillimeters : SIZEL; // Size of the reference device in millimeters
end;
TENHMETAHEADER3 = ENHMETAHEADER3;
PENHMETAHEADER3 = ^TENHMETAHEADER3;
// Placeable WMFs
// Placeable Metafiles were created as a non-standard way of specifying how
// a metafile is mapped and scaled on an output device.
// Placeable metafiles are quite wide-spread, but not directly supported by
// the Windows API. To playback a placeable metafile using the Windows API,
// you will first need to strip the placeable metafile header from the file.
// This is typically performed by copying the metafile to a temporary file
// starting at file offset 22 (0x16). The contents of the temporary file may
// then be used as input to the Windows GetMetaFile(), PlayMetaFile(),
// CopyMetaFile(), etc. GDI functions.
// Each placeable metafile begins with a 22-byte header,
// followed by a standard metafile:
{$EXTERNALSYM PWMFRect16}
PWMFRect16 = packed record
Left : INT16;
Top : INT16;
Right : INT16;
Bottom : INT16;
end;
TPWMFRect16 = PWMFRect16;
PPWMFRect16 = ^TPWMFRect16;
{$EXTERNALSYM WmfPlaceableFileHeader}
WmfPlaceableFileHeader = packed record
Key : UINT32; // GDIP_WMF_PLACEABLEKEY
Hmf : INT16; // Metafile HANDLE number (always 0)
BoundingBox : PWMFRect16; // Coordinates in metafile units
Inch : INT16; // Number of metafile units per inch
Reserved : UINT32; // Reserved (always 0)
Checksum : INT16; // Checksum value for previous 10 WORDs
end;
TWmfPlaceableFileHeader = WmfPlaceableFileHeader;
PWmfPlaceableFileHeader = ^TWmfPlaceableFileHeader;
// Key contains a special identification value that indicates the presence
// of a placeable metafile header and is always 0x9AC6CDD7.
// Handle is used to stored the handle of the metafile in memory. When written
// to disk, this field is not used and will always contains the value 0.
// Left, Top, Right, and Bottom contain the coordinates of the upper-left
// and lower-right corners of the image on the output device. These are
// measured in twips.
// A twip (meaning "twentieth of a point") is the logical unit of measurement
// used in Windows Metafiles. A twip is equal to 1/1440 of an inch. Thus 720
// twips equal 1/2 inch, while 32,768 twips is 22.75 inches.
// Inch contains the number of twips per inch used to represent the image.
// Normally, there are 1440 twips per inch; however, this number may be
// changed to scale the image. A value of 720 indicates that the image is
// double its normal size, or scaled to a factor of 2:1. A value of 360
// indicates a scale of 4:1, while a value of 2880 indicates that the image
// is scaled down in size by a factor of two. A value of 1440 indicates
// a 1:1 scale ratio.
// Reserved is not used and is always set to 0.
// Checksum contains a checksum value for the previous 10 WORDs in the header.
// This value can be used in an attempt to detect if the metafile has become
// corrupted. The checksum is calculated by XORing each WORD value to an
// initial value of 0.
// If the metafile was recorded with a reference Hdc that was a display.
const
GDIP_EMFPLUSFLAGS_DISPLAY = $00000001;
{$EXTERNALSYM GDIP_EMFPLUSFLAGS_DISPLAY}
type
TMetafileHeader = packed class
public
Type_ : TMetafileType;
Size : UINT; // Size of the metafile (in bytes)
Version : UINT; // EMF+, EMF, or WMF version
EmfPlusFlags : UINT;
DpiX : Single;
DpiY : Single;
X : Integer; // Bounds in device units
Y : Integer;
Width : Integer;
Height : Integer;
Header : record
case integer of
0: (WmfHeader: TMETAHEADER;);
1: (EmfHeader: TENHMETAHEADER3);
end;
EmfPlusHeaderSize : Integer; // size of the EMF+ header in file
LogicalDpiX : Integer; // Logical Dpi of reference Hdc
LogicalDpiY : Integer; // usually valid only for EMF+
public
property GetType: TMetafileType read Type_;
property GetMetafileSize: UINT read Size;
// If IsEmfPlus, this is the EMF+ version; else it is the WMF or EMF ver
property GetVersion: UINT read Version;
// Get the EMF+ flags associated with the metafile
property GetEmfPlusFlags: UINT read EmfPlusFlags;
property GetDpiX: Single read DpiX;
property GetDpiY: Single read DpiY;
procedure GetBounds(out Rect: Trect);
// Is it any type of WMF (standard or Placeable Metafile)?
function IsWmf: BOOL;
// Is this an Placeable Metafile?
function IsWmfPlaceable: BOOL;
// Is this an EMF (not an EMF+)?
function IsEmf: BOOL;
// Is this an EMF or EMF+ file?
function IsEmfOrEmfPlus: BOOL;
// Is this an EMF+ file?
function IsEmfPlus: BOOL;
// Is this an EMF+ dual (has dual, down-level records) file?
function IsEmfPlusDual: BOOL;
// Is this an EMF+ only (no dual records) file?
function IsEmfPlusOnly: BOOL;
// If it's an EMF+ file, was it recorded against a display Hdc?
function IsDisplay: BOOL;
// Get the WMF header of the metafile (if it is a WMF)
function GetWmfHeader: PMetaHeader;
// Get the EMF header of the metafile (if it is an EMF)
function GetEmfHeader: PENHMETAHEADER3;
end;
(**************************************************************************\
*
* GDI+ Imaging GUIDs
*
\**************************************************************************)
//---------------------------------------------------------------------------
// Image file format identifiers
//---------------------------------------------------------------------------
const
ImageFormatUndefined : TGUID = '{b96b3ca9-0728-11d3-9d7b-0000f81ef32e}';
{$EXTERNALSYM ImageFormatUndefined}
ImageFormatMemoryBMP : TGUID = '{b96b3caa-0728-11d3-9d7b-0000f81ef32e}';
{$EXTERNALSYM ImageFormatMemoryBMP}
ImageFormatBMP : TGUID = '{b96b3cab-0728-11d3-9d7b-0000f81ef32e}';
{$EXTERNALSYM ImageFormatBMP}
ImageFormatEMF : TGUID = '{b96b3cac-0728-11d3-9d7b-0000f81ef32e}';
{$EXTERNALSYM ImageFormatEMF}
ImageFormatWMF : TGUID = '{b96b3cad-0728-11d3-9d7b-0000f81ef32e}';
{$EXTERNALSYM ImageFormatWMF}
ImageFormatJPEG : TGUID = '{b96b3cae-0728-11d3-9d7b-0000f81ef32e}';
{$EXTERNALSYM ImageFormatJPEG}
ImageFormatPNG : TGUID = '{b96b3caf-0728-11d3-9d7b-0000f81ef32e}';
{$EXTERNALSYM ImageFormatPNG}
ImageFormatGIF : TGUID = '{b96b3cb0-0728-11d3-9d7b-0000f81ef32e}';
{$EXTERNALSYM ImageFormatGIF}
ImageFormatTIFF : TGUID = '{b96b3cb1-0728-11d3-9d7b-0000f81ef32e}';
{$EXTERNALSYM ImageFormatTIFF}
ImageFormatEXIF : TGUID = '{b96b3cb2-0728-11d3-9d7b-0000f81ef32e}';
{$EXTERNALSYM ImageFormatEXIF}
ImageFormatIcon : TGUID = '{b96b3cb5-0728-11d3-9d7b-0000f81ef32e}';
{$EXTERNALSYM ImageFormatIcon}
//---------------------------------------------------------------------------
// Predefined multi-frame dimension IDs
//---------------------------------------------------------------------------
FrameDimensionTime : TGUID = '{6aedbd6d-3fb5-418a-83a6-7f45229dc872}';
{$EXTERNALSYM FrameDimensionTime}
FrameDimensionResolution : TGUID = '{84236f7b-3bd3-428f-8dab-4ea1439ca315}';
{$EXTERNALSYM FrameDimensionResolution}
FrameDimensionPage : TGUID = '{7462dc86-6180-4c7e-8e3f-ee7333a7a483}';
{$EXTERNALSYM FrameDimensionPage}
//---------------------------------------------------------------------------
// Property sets
//---------------------------------------------------------------------------
FormatIDImageInformation : TGUID = '{e5836cbe-5eef-4f1d-acde-ae4c43b608ce}';
{$EXTERNALSYM FormatIDImageInformation}
FormatIDJpegAppHeaders : TGUID = '{1c4afdcd-6177-43cf-abc7-5f51af39ee85}';
{$EXTERNALSYM FormatIDJpegAppHeaders}
//---------------------------------------------------------------------------
// Encoder parameter sets
//---------------------------------------------------------------------------
EncoderCompression : TGUID = '{e09d739d-ccd4-44ee-8eba-3fbf8be4fc58}';
{$EXTERNALSYM EncoderCompression}
EncoderColorDepth : TGUID = '{66087055-ad66-4c7c-9a18-38a2310b8337}';
{$EXTERNALSYM EncoderColorDepth}
EncoderScanMethod : TGUID = '{3a4e2661-3109-4e56-8536-42c156e7dcfa}';
{$EXTERNALSYM EncoderScanMethod}
EncoderVersion : TGUID = '{24d18c76-814a-41a4-bf53-1c219cccf797}';
{$EXTERNALSYM EncoderVersion}
EncoderRenderMethod : TGUID = '{6d42c53a-229a-4825-8bb7-5c99e2b9a8b8}';
{$EXTERNALSYM EncoderRenderMethod}
EncoderQuality : TGUID = '{1d5be4b5-fa4a-452d-9cdd-5db35105e7eb}';
{$EXTERNALSYM EncoderQuality}
EncoderTransformation : TGUID = '{8d0eb2d1-a58e-4ea8-aa14-108074b7b6f9}';
{$EXTERNALSYM EncoderTransformation}
EncoderLuminanceTable : TGUID = '{edb33bce-0266-4a77-b904-27216099e717}';
{$EXTERNALSYM EncoderLuminanceTable}
EncoderChrominanceTable : TGUID = '{f2e455dc-09b3-4316-8260-676ada32481c}';
{$EXTERNALSYM EncoderChrominanceTable}
EncoderSaveFlag : TGUID = '{292266fc-ac40-47bf-8cfc-a85b89a655de}';
{$EXTERNALSYM EncoderSaveFlag}
CodecIImageBytes : TGUID = '{025d1823-6c7d-447b-bbdb-a3cbc3dfa2fc}';
{$EXTERNALSYM CodecIImageBytes}
type
{$EXTERNALSYM IImageBytes}
IImageBytes = Interface(IUnknown)
['{025D1823-6C7D-447B-BBDB-A3CBC3DFA2FC}']
// Return total number of bytes in the IStream
function CountBytes(out pcb: UINT): HRESULT; stdcall;
// Locks "cb" bytes, starting from "ulOffset" in the stream, and returns the
// pointer to the beginning of the locked memory chunk in "ppvBytes"
function LockBytes(cb: UINT; ulOffset: ULONG; out ppvBytes: pointer): HRESULT; stdcall;
// Unlocks "cb" bytes, pointed by "pvBytes", starting from "ulOffset" in the
// stream
function UnlockBytes(pvBytes: pointer; cb: UINT; ulOffset: ULONG): HRESULT; stdcall;
end;
//--------------------------------------------------------------------------
// ImageCodecInfo structure
//--------------------------------------------------------------------------
{$EXTERNALSYM ImageCodecInfo}
ImageCodecInfo = packed record
Clsid : TGUID;
FormatID : TGUID;
CodecName : PWCHAR;
DllName : PWCHAR;
FormatDescription : PWCHAR;
FilenameExtension : PWCHAR;
MimeType : PWCHAR;
Flags : DWORD;
Version : DWORD;
SigCount : DWORD;
SigSize : DWORD;
SigPattern : PBYTE;
SigMask : PBYTE;
end;
TImageCodecInfo = ImageCodecInfo;
PImageCodecInfo = ^TImageCodecInfo;
//--------------------------------------------------------------------------
// Information flags about image codecs
//--------------------------------------------------------------------------
{$EXTERNALSYM ImageCodecFlags}
ImageCodecFlags = (
ImageCodecFlagsEncoder = $00000001,
ImageCodecFlagsDecoder = $00000002,
ImageCodecFlagsSupportBitmap = $00000004,
ImageCodecFlagsSupportVector = $00000008,
ImageCodecFlagsSeekableEncode = $00000010,
ImageCodecFlagsBlockingDecode = $00000020,
ImageCodecFlagsBuiltin = $00010000,
ImageCodecFlagsSystem = $00020000,
ImageCodecFlagsUser = $00040000
);
TImageCodecFlags = ImageCodecFlags;
//---------------------------------------------------------------------------
// Access modes used when calling Image::LockBits
//---------------------------------------------------------------------------
{$EXTERNALSYM ImageLockMode}
ImageLockMode = Integer;
const
ImageLockModeRead = $0001;
ImageLockModeWrite = $0002;
ImageLockModeUserInputBuf = $0004;
type
TImageLockMode = ImageLockMode;
//---------------------------------------------------------------------------
// Information about image pixel data
//---------------------------------------------------------------------------
{$EXTERNALSYM BitmapData}
BitmapData = packed record
Width : UINT;
Height : UINT;
Stride : Integer;
PixelFormat : PixelFormat;
Scan0 : Pointer;
Reserved : UINT;
end;
TBitmapData = BitmapData;
PBitmapData = ^TBitmapData;
//---------------------------------------------------------------------------
// Image flags
//---------------------------------------------------------------------------
{$EXTERNALSYM ImageFlags}
ImageFlags = (
ImageFlagsNone = 0,
// Low-word: shared with SINKFLAG_x
ImageFlagsScalable = $0001,
ImageFlagsHasAlpha = $0002,
ImageFlagsHasTranslucent = $0004,
ImageFlagsPartiallyScalable = $0008,
// Low-word: color space definition
ImageFlagsColorSpaceRGB = $0010,
ImageFlagsColorSpaceCMYK = $0020,
ImageFlagsColorSpaceGRAY = $0040,
ImageFlagsColorSpaceYCBCR = $0080,
ImageFlagsColorSpaceYCCK = $0100,
// Low-word: image size info
ImageFlagsHasRealDPI = $1000,
ImageFlagsHasRealPixelSize = $2000,
// High-word
ImageFlagsReadOnly = $00010000,
ImageFlagsCaching = $00020000
);
TImageFlags = ImageFlags;
{$EXTERNALSYM RotateFlipType}
RotateFlipType = (
RotateNoneFlipNone = 0,
Rotate90FlipNone = 1,
Rotate180FlipNone = 2,
Rotate270FlipNone = 3,
RotateNoneFlipX = 4,
Rotate90FlipX = 5,
Rotate180FlipX = 6,
Rotate270FlipX = 7,
RotateNoneFlipY = Rotate180FlipX,
Rotate90FlipY = Rotate270FlipX,
Rotate180FlipY = RotateNoneFlipX,
Rotate270FlipY = Rotate90FlipX,
RotateNoneFlipXY = Rotate180FlipNone,
Rotate90FlipXY = Rotate270FlipNone,
Rotate180FlipXY = RotateNoneFlipNone,
Rotate270FlipXY = Rotate90FlipNone
);
TRotateFlipType = RotateFlipType;
//---------------------------------------------------------------------------
// Encoder Parameter structure
//---------------------------------------------------------------------------
{$EXTERNALSYM EncoderParameter}
EncoderParameter = packed record
Guid : TGUID; // GUID of the parameter
NumberOfValues : ULONG; // Number of the parameter values
Type_ : ULONG; // Value type, like ValueTypeLONG etc.
Value : Pointer; // A pointer to the parameter values
end;
TEncoderParameter = EncoderParameter;
PEncoderParameter = ^TEncoderParameter;
//---------------------------------------------------------------------------
// Encoder Parameters structure
//---------------------------------------------------------------------------
{$EXTERNALSYM EncoderParameters}
EncoderParameters = packed record
Count : UINT; // Number of parameters in this structure
Parameter : array[0..0] of TEncoderParameter; // Parameter values
end;
TEncoderParameters = EncoderParameters;
PEncoderParameters = ^TEncoderParameters;
//---------------------------------------------------------------------------
// Property Item
//---------------------------------------------------------------------------
{$EXTERNALSYM PropertyItem}
PropertyItem = record // NOT PACKED !!
id : PROPID; // ID of this property
length : ULONG; // Length of the property value, in bytes
type_ : WORD; // Type of the value, as one of TAG_TYPE_XXX
value : Pointer; // property value
end;
TPropertyItem = PropertyItem;
PPropertyItem = ^TPropertyItem;
//---------------------------------------------------------------------------
// Image property types
//---------------------------------------------------------------------------
const
PropertyTagTypeByte : Integer = 1;
{$EXTERNALSYM PropertyTagTypeByte}
PropertyTagTypeASCII : Integer = 2;
{$EXTERNALSYM PropertyTagTypeASCII}
PropertyTagTypeShort : Integer = 3;
{$EXTERNALSYM PropertyTagTypeShort}
PropertyTagTypeLong : Integer = 4;
{$EXTERNALSYM PropertyTagTypeLong}
PropertyTagTypeRational : Integer = 5;
{$EXTERNALSYM PropertyTagTypeRational}
PropertyTagTypeUndefined : Integer = 7;
{$EXTERNALSYM PropertyTagTypeUndefined}
PropertyTagTypeSLONG : Integer = 9;
{$EXTERNALSYM PropertyTagTypeSLONG}
PropertyTagTypeSRational : Integer = 10;
{$EXTERNALSYM PropertyTagTypeSRational}
//---------------------------------------------------------------------------
// Image property ID tags
//---------------------------------------------------------------------------
PropertyTagExifIFD = $8769;
{$EXTERNALSYM PropertyTagExifIFD}
PropertyTagGpsIFD = $8825;
{$EXTERNALSYM PropertyTagGpsIFD}
PropertyTagNewSubfileType = $00FE;
{$EXTERNALSYM PropertyTagNewSubfileType}
PropertyTagSubfileType = $00FF;
{$EXTERNALSYM PropertyTagSubfileType}
PropertyTagImageWidth = $0100;
{$EXTERNALSYM PropertyTagImageWidth}
PropertyTagImageHeight = $0101;
{$EXTERNALSYM PropertyTagImageHeight}
PropertyTagBitsPerSample = $0102;
{$EXTERNALSYM PropertyTagBitsPerSample}
PropertyTagCompression = $0103;
{$EXTERNALSYM PropertyTagCompression}
PropertyTagPhotometricInterp = $0106;
{$EXTERNALSYM PropertyTagPhotometricInterp}
PropertyTagThreshHolding = $0107;
{$EXTERNALSYM PropertyTagThreshHolding}
PropertyTagCellWidth = $0108;
{$EXTERNALSYM PropertyTagCellWidth}
PropertyTagCellHeight = $0109;
{$EXTERNALSYM PropertyTagCellHeight}
PropertyTagFillOrder = $010A;
{$EXTERNALSYM PropertyTagFillOrder}
PropertyTagDocumentName = $010D;
{$EXTERNALSYM PropertyTagDocumentName}
PropertyTagImageDescription = $010E;
{$EXTERNALSYM PropertyTagImageDescription}
PropertyTagEquipMake = $010F;
{$EXTERNALSYM PropertyTagEquipMake}
PropertyTagEquipModel = $0110;
{$EXTERNALSYM PropertyTagEquipModel}
PropertyTagStripOffsets = $0111;
{$EXTERNALSYM PropertyTagStripOffsets}
PropertyTagOrientation = $0112;
{$EXTERNALSYM PropertyTagOrientation}
PropertyTagSamplesPerPixel = $0115;
{$EXTERNALSYM PropertyTagSamplesPerPixel}
PropertyTagRowsPerStrip = $0116;
{$EXTERNALSYM PropertyTagRowsPerStrip}
PropertyTagStripBytesCount = $0117;
{$EXTERNALSYM PropertyTagStripBytesCount}
PropertyTagMinSampleValue = $0118;
{$EXTERNALSYM PropertyTagMinSampleValue}
PropertyTagMaxSampleValue = $0119;
{$EXTERNALSYM PropertyTagMaxSampleValue}
PropertyTagXResolution = $011A; // Image resolution in width direction
{$EXTERNALSYM PropertyTagXResolution}
PropertyTagYResolution = $011B; // Image resolution in height direction
{$EXTERNALSYM PropertyTagYResolution}
PropertyTagPlanarConfig = $011C; // Image data arrangement
{$EXTERNALSYM PropertyTagPlanarConfig}
PropertyTagPageName = $011D;
{$EXTERNALSYM PropertyTagPageName}
PropertyTagXPosition = $011E;
{$EXTERNALSYM PropertyTagXPosition}
PropertyTagYPosition = $011F;
{$EXTERNALSYM PropertyTagYPosition}
PropertyTagFreeOffset = $0120;
{$EXTERNALSYM PropertyTagFreeOffset}
PropertyTagFreeByteCounts = $0121;
{$EXTERNALSYM PropertyTagFreeByteCounts}
PropertyTagGrayResponseUnit = $0122;
{$EXTERNALSYM PropertyTagGrayResponseUnit}
PropertyTagGrayResponseCurve = $0123;
{$EXTERNALSYM PropertyTagGrayResponseCurve}
PropertyTagT4Option = $0124;
{$EXTERNALSYM PropertyTagT4Option}
PropertyTagT6Option = $0125;
{$EXTERNALSYM PropertyTagT6Option}
PropertyTagResolutionUnit = $0128; // Unit of X and Y resolution
{$EXTERNALSYM PropertyTagResolutionUnit}
PropertyTagPageNumber = $0129;
{$EXTERNALSYM PropertyTagPageNumber}
PropertyTagTransferFuncition = $012D;
{$EXTERNALSYM PropertyTagTransferFuncition}
PropertyTagSoftwareUsed = $0131;
{$EXTERNALSYM PropertyTagSoftwareUsed}
PropertyTagDateTime = $0132;
{$EXTERNALSYM PropertyTagDateTime}
PropertyTagArtist = $013B;
{$EXTERNALSYM PropertyTagArtist}
PropertyTagHostComputer = $013C;
{$EXTERNALSYM PropertyTagHostComputer}
PropertyTagPredictor = $013D;
{$EXTERNALSYM PropertyTagPredictor}
PropertyTagWhitePoint = $013E;
{$EXTERNALSYM PropertyTagWhitePoint}
PropertyTagPrimaryChromaticities = $013F;
{$EXTERNALSYM PropertyTagPrimaryChromaticities}
PropertyTagColorMap = $0140;
{$EXTERNALSYM PropertyTagColorMap}
PropertyTagHalftoneHints = $0141;
{$EXTERNALSYM PropertyTagHalftoneHints}
PropertyTagTileWidth = $0142;
{$EXTERNALSYM PropertyTagTileWidth}
PropertyTagTileLength = $0143;
{$EXTERNALSYM PropertyTagTileLength}
PropertyTagTileOffset = $0144;
{$EXTERNALSYM PropertyTagTileOffset}
PropertyTagTileByteCounts = $0145;
{$EXTERNALSYM PropertyTagTileByteCounts}
PropertyTagInkSet = $014C;
{$EXTERNALSYM PropertyTagInkSet}
PropertyTagInkNames = $014D;
{$EXTERNALSYM PropertyTagInkNames}
PropertyTagNumberOfInks = $014E;
{$EXTERNALSYM PropertyTagNumberOfInks}
PropertyTagDotRange = $0150;
{$EXTERNALSYM PropertyTagDotRange}
PropertyTagTargetPrinter = $0151;
{$EXTERNALSYM PropertyTagTargetPrinter}
PropertyTagExtraSamples = $0152;
{$EXTERNALSYM PropertyTagExtraSamples}
PropertyTagSampleFormat = $0153;
{$EXTERNALSYM PropertyTagSampleFormat}
PropertyTagSMinSampleValue = $0154;
{$EXTERNALSYM PropertyTagSMinSampleValue}
PropertyTagSMaxSampleValue = $0155;
{$EXTERNALSYM PropertyTagSMaxSampleValue}
PropertyTagTransferRange = $0156;
{$EXTERNALSYM PropertyTagTransferRange}
PropertyTagJPEGProc = $0200;
{$EXTERNALSYM PropertyTagJPEGProc}
PropertyTagJPEGInterFormat = $0201;
{$EXTERNALSYM PropertyTagJPEGInterFormat}
PropertyTagJPEGInterLength = $0202;
{$EXTERNALSYM PropertyTagJPEGInterLength}
PropertyTagJPEGRestartInterval = $0203;
{$EXTERNALSYM PropertyTagJPEGRestartInterval}
PropertyTagJPEGLosslessPredictors = $0205;
{$EXTERNALSYM PropertyTagJPEGLosslessPredictors}
PropertyTagJPEGPointTransforms = $0206;
{$EXTERNALSYM PropertyTagJPEGPointTransforms}
PropertyTagJPEGQTables = $0207;
{$EXTERNALSYM PropertyTagJPEGQTables}
PropertyTagJPEGDCTables = $0208;
{$EXTERNALSYM PropertyTagJPEGDCTables}
PropertyTagJPEGACTables = $0209;
{$EXTERNALSYM PropertyTagJPEGACTables}
PropertyTagYCbCrCoefficients = $0211;
{$EXTERNALSYM PropertyTagYCbCrCoefficients}
PropertyTagYCbCrSubsampling = $0212;
{$EXTERNALSYM PropertyTagYCbCrSubsampling}
PropertyTagYCbCrPositioning = $0213;
{$EXTERNALSYM PropertyTagYCbCrPositioning}
PropertyTagREFBlackWhite = $0214;
{$EXTERNALSYM PropertyTagREFBlackWhite}
PropertyTagICCProfile = $8773; // This TAG is defined by ICC
{$EXTERNALSYM PropertyTagICCProfile}
// for embedded ICC in TIFF
PropertyTagGamma = $0301;
{$EXTERNALSYM PropertyTagGamma}
PropertyTagICCProfileDescriptor = $0302;
{$EXTERNALSYM PropertyTagICCProfileDescriptor}
PropertyTagSRGBRenderingIntent = $0303;
{$EXTERNALSYM PropertyTagSRGBRenderingIntent}
PropertyTagImageTitle = $0320;
{$EXTERNALSYM PropertyTagImageTitle}
PropertyTagCopyright = $8298;
{$EXTERNALSYM PropertyTagCopyright}
// Extra TAGs (Like Adobe Image Information tags etc.)
PropertyTagResolutionXUnit = $5001;
{$EXTERNALSYM PropertyTagResolutionXUnit}
PropertyTagResolutionYUnit = $5002;
{$EXTERNALSYM PropertyTagResolutionYUnit}
PropertyTagResolutionXLengthUnit = $5003;
{$EXTERNALSYM PropertyTagResolutionXLengthUnit}
PropertyTagResolutionYLengthUnit = $5004;
{$EXTERNALSYM PropertyTagResolutionYLengthUnit}
PropertyTagPrintFlags = $5005;
{$EXTERNALSYM PropertyTagPrintFlags}
PropertyTagPrintFlagsVersion = $5006;
{$EXTERNALSYM PropertyTagPrintFlagsVersion}
PropertyTagPrintFlagsCrop = $5007;
{$EXTERNALSYM PropertyTagPrintFlagsCrop}
PropertyTagPrintFlagsBleedWidth = $5008;
{$EXTERNALSYM PropertyTagPrintFlagsBleedWidth}
PropertyTagPrintFlagsBleedWidthScale = $5009;
{$EXTERNALSYM PropertyTagPrintFlagsBleedWidthScale}
PropertyTagHalftoneLPI = $500A;
{$EXTERNALSYM PropertyTagHalftoneLPI}
PropertyTagHalftoneLPIUnit = $500B;
{$EXTERNALSYM PropertyTagHalftoneLPIUnit}
PropertyTagHalftoneDegree = $500C;
{$EXTERNALSYM PropertyTagHalftoneDegree}
PropertyTagHalftoneShape = $500D;
{$EXTERNALSYM PropertyTagHalftoneShape}
PropertyTagHalftoneMisc = $500E;
{$EXTERNALSYM PropertyTagHalftoneMisc}
PropertyTagHalftoneScreen = $500F;
{$EXTERNALSYM PropertyTagHalftoneScreen}
PropertyTagJPEGQuality = $5010;
{$EXTERNALSYM PropertyTagJPEGQuality}
PropertyTagGridSize = $5011;
{$EXTERNALSYM PropertyTagGridSize}
PropertyTagThumbnailFormat = $5012; // 1 = JPEG, 0 = RAW RGB
{$EXTERNALSYM PropertyTagThumbnailFormat}
PropertyTagThumbnailWidth = $5013;
{$EXTERNALSYM PropertyTagThumbnailWidth}
PropertyTagThumbnailHeight = $5014;
{$EXTERNALSYM PropertyTagThumbnailHeight}
PropertyTagThumbnailColorDepth = $5015;
{$EXTERNALSYM PropertyTagThumbnailColorDepth}
PropertyTagThumbnailPlanes = $5016;
{$EXTERNALSYM PropertyTagThumbnailPlanes}
PropertyTagThumbnailRawBytes = $5017;
{$EXTERNALSYM PropertyTagThumbnailRawBytes}
PropertyTagThumbnailSize = $5018;
{$EXTERNALSYM PropertyTagThumbnailSize}
PropertyTagThumbnailCompressedSize = $5019;
{$EXTERNALSYM PropertyTagThumbnailCompressedSize}
PropertyTagColorTransferFunction = $501A;
{$EXTERNALSYM PropertyTagColorTransferFunction}
PropertyTagThumbnailData = $501B; // RAW thumbnail bits in
{$EXTERNALSYM PropertyTagThumbnailData}
// JPEG format or RGB format
// depends on
// PropertyTagThumbnailFormat
// Thumbnail related TAGs
PropertyTagThumbnailImageWidth = $5020; // Thumbnail width
{$EXTERNALSYM PropertyTagThumbnailImageWidth}
PropertyTagThumbnailImageHeight = $5021; // Thumbnail height
{$EXTERNALSYM PropertyTagThumbnailImageHeight}
PropertyTagThumbnailBitsPerSample = $5022; // Number of bits per
{$EXTERNALSYM PropertyTagThumbnailBitsPerSample}
// component
PropertyTagThumbnailCompression = $5023; // Compression Scheme
{$EXTERNALSYM PropertyTagThumbnailCompression}
PropertyTagThumbnailPhotometricInterp = $5024; // Pixel composition
{$EXTERNALSYM PropertyTagThumbnailPhotometricInterp}
PropertyTagThumbnailImageDescription = $5025; // Image Tile
{$EXTERNALSYM PropertyTagThumbnailImageDescription}
PropertyTagThumbnailEquipMake = $5026; // Manufacturer of Image
{$EXTERNALSYM PropertyTagThumbnailEquipMake}
// Input equipment
PropertyTagThumbnailEquipModel = $5027; // Model of Image input
{$EXTERNALSYM PropertyTagThumbnailEquipModel}
// equipment
PropertyTagThumbnailStripOffsets = $5028; // Image data location
{$EXTERNALSYM PropertyTagThumbnailStripOffsets}
PropertyTagThumbnailOrientation = $5029; // Orientation of image
{$EXTERNALSYM PropertyTagThumbnailOrientation}
PropertyTagThumbnailSamplesPerPixel = $502A; // Number of components
{$EXTERNALSYM PropertyTagThumbnailSamplesPerPixel}
PropertyTagThumbnailRowsPerStrip = $502B; // Number of rows per strip
{$EXTERNALSYM PropertyTagThumbnailRowsPerStrip}
PropertyTagThumbnailStripBytesCount = $502C; // Bytes per compressed
{$EXTERNALSYM PropertyTagThumbnailStripBytesCount}
// strip
PropertyTagThumbnailResolutionX = $502D; // Resolution in width
{$EXTERNALSYM PropertyTagThumbnailResolutionX}
// direction
PropertyTagThumbnailResolutionY = $502E; // Resolution in height
{$EXTERNALSYM PropertyTagThumbnailResolutionY}
// direction
PropertyTagThumbnailPlanarConfig = $502F; // Image data arrangement
{$EXTERNALSYM PropertyTagThumbnailPlanarConfig}
PropertyTagThumbnailResolutionUnit = $5030; // Unit of X and Y
{$EXTERNALSYM PropertyTagThumbnailResolutionUnit}
// Resolution
PropertyTagThumbnailTransferFunction = $5031; // Transfer function
{$EXTERNALSYM PropertyTagThumbnailTransferFunction}
PropertyTagThumbnailSoftwareUsed = $5032; // Software used
{$EXTERNALSYM PropertyTagThumbnailSoftwareUsed}
PropertyTagThumbnailDateTime = $5033; // File change date and
{$EXTERNALSYM PropertyTagThumbnailDateTime}
// time
PropertyTagThumbnailArtist = $5034; // Person who created the
{$EXTERNALSYM PropertyTagThumbnailArtist}
// image
PropertyTagThumbnailWhitePoint = $5035; // White point chromaticity
{$EXTERNALSYM PropertyTagThumbnailWhitePoint}
PropertyTagThumbnailPrimaryChromaticities = $5036;
{$EXTERNALSYM PropertyTagThumbnailPrimaryChromaticities}
// Chromaticities of
// primaries
PropertyTagThumbnailYCbCrCoefficients = $5037; // Color space transforma-
{$EXTERNALSYM PropertyTagThumbnailYCbCrCoefficients}
// tion coefficients
PropertyTagThumbnailYCbCrSubsampling = $5038; // Subsampling ratio of Y
{$EXTERNALSYM PropertyTagThumbnailYCbCrSubsampling}
// to C
PropertyTagThumbnailYCbCrPositioning = $5039; // Y and C position
{$EXTERNALSYM PropertyTagThumbnailYCbCrPositioning}
PropertyTagThumbnailRefBlackWhite = $503A; // Pair of black and white
{$EXTERNALSYM PropertyTagThumbnailRefBlackWhite}
// reference values
PropertyTagThumbnailCopyRight = $503B; // CopyRight holder
{$EXTERNALSYM PropertyTagThumbnailCopyRight}
PropertyTagLuminanceTable = $5090;
{$EXTERNALSYM PropertyTagLuminanceTable}
PropertyTagChrominanceTable = $5091;
{$EXTERNALSYM PropertyTagChrominanceTable}
PropertyTagFrameDelay = $5100;
{$EXTERNALSYM PropertyTagFrameDelay}
PropertyTagLoopCount = $5101;
{$EXTERNALSYM PropertyTagLoopCount}
PropertyTagPixelUnit = $5110; // Unit specifier for pixel/unit
{$EXTERNALSYM PropertyTagPixelUnit}
PropertyTagPixelPerUnitX = $5111; // Pixels per unit in X
{$EXTERNALSYM PropertyTagPixelPerUnitX}
PropertyTagPixelPerUnitY = $5112; // Pixels per unit in Y
{$EXTERNALSYM PropertyTagPixelPerUnitY}
PropertyTagPaletteHistogram = $5113; // Palette histogram
{$EXTERNALSYM PropertyTagPaletteHistogram}
// EXIF specific tag
PropertyTagExifExposureTime = $829A;
{$EXTERNALSYM PropertyTagExifExposureTime}
PropertyTagExifFNumber = $829D;
{$EXTERNALSYM PropertyTagExifFNumber}
PropertyTagExifExposureProg = $8822;
{$EXTERNALSYM PropertyTagExifExposureProg}
PropertyTagExifSpectralSense = $8824;
{$EXTERNALSYM PropertyTagExifSpectralSense}
PropertyTagExifISOSpeed = $8827;
{$EXTERNALSYM PropertyTagExifISOSpeed}
PropertyTagExifOECF = $8828;
{$EXTERNALSYM PropertyTagExifOECF}
PropertyTagExifVer = $9000;
{$EXTERNALSYM PropertyTagExifVer}
PropertyTagExifDTOrig = $9003; // Date & time of original
{$EXTERNALSYM PropertyTagExifDTOrig}
PropertyTagExifDTDigitized = $9004; // Date & time of digital data generation
{$EXTERNALSYM PropertyTagExifDTDigitized}
PropertyTagExifCompConfig = $9101;
{$EXTERNALSYM PropertyTagExifCompConfig}
PropertyTagExifCompBPP = $9102;
{$EXTERNALSYM PropertyTagExifCompBPP}
PropertyTagExifShutterSpeed = $9201;
{$EXTERNALSYM PropertyTagExifShutterSpeed}
PropertyTagExifAperture = $9202;
{$EXTERNALSYM PropertyTagExifAperture}
PropertyTagExifBrightness = $9203;
{$EXTERNALSYM PropertyTagExifBrightness}
PropertyTagExifExposureBias = $9204;
{$EXTERNALSYM PropertyTagExifExposureBias}
PropertyTagExifMaxAperture = $9205;
{$EXTERNALSYM PropertyTagExifMaxAperture}
PropertyTagExifSubjectDist = $9206;
{$EXTERNALSYM PropertyTagExifSubjectDist}
PropertyTagExifMeteringMode = $9207;
{$EXTERNALSYM PropertyTagExifMeteringMode}
PropertyTagExifLightSource = $9208;
{$EXTERNALSYM PropertyTagExifLightSource}
PropertyTagExifFlash = $9209;
{$EXTERNALSYM PropertyTagExifFlash}
PropertyTagExifFocalLength = $920A;
{$EXTERNALSYM PropertyTagExifFocalLength}
PropertyTagExifMakerNote = $927C;
{$EXTERNALSYM PropertyTagExifMakerNote}
PropertyTagExifUserComment = $9286;
{$EXTERNALSYM PropertyTagExifUserComment}
PropertyTagExifDTSubsec = $9290; // Date & Time subseconds
{$EXTERNALSYM PropertyTagExifDTSubsec}
PropertyTagExifDTOrigSS = $9291; // Date & Time original subseconds
{$EXTERNALSYM PropertyTagExifDTOrigSS}
PropertyTagExifDTDigSS = $9292; // Date & TIme digitized subseconds
{$EXTERNALSYM PropertyTagExifDTDigSS}
PropertyTagExifFPXVer = $A000;
{$EXTERNALSYM PropertyTagExifFPXVer}
PropertyTagExifColorSpace = $A001;
{$EXTERNALSYM PropertyTagExifColorSpace}
PropertyTagExifPixXDim = $A002;
{$EXTERNALSYM PropertyTagExifPixXDim}
PropertyTagExifPixYDim = $A003;
{$EXTERNALSYM PropertyTagExifPixYDim}
PropertyTagExifRelatedWav = $A004; // related sound file
{$EXTERNALSYM PropertyTagExifRelatedWav}
PropertyTagExifInterop = $A005;
{$EXTERNALSYM PropertyTagExifInterop}
PropertyTagExifFlashEnergy = $A20B;
{$EXTERNALSYM PropertyTagExifFlashEnergy}
PropertyTagExifSpatialFR = $A20C; // Spatial Frequency Response
{$EXTERNALSYM PropertyTagExifSpatialFR}
PropertyTagExifFocalXRes = $A20E; // Focal Plane X Resolution
{$EXTERNALSYM PropertyTagExifFocalXRes}
PropertyTagExifFocalYRes = $A20F; // Focal Plane Y Resolution
{$EXTERNALSYM PropertyTagExifFocalYRes}
PropertyTagExifFocalResUnit = $A210; // Focal Plane Resolution Unit
{$EXTERNALSYM PropertyTagExifFocalResUnit}
PropertyTagExifSubjectLoc = $A214;
{$EXTERNALSYM PropertyTagExifSubjectLoc}
PropertyTagExifExposureIndex = $A215;
{$EXTERNALSYM PropertyTagExifExposureIndex}
PropertyTagExifSensingMethod = $A217;
{$EXTERNALSYM PropertyTagExifSensingMethod}
PropertyTagExifFileSource = $A300;
{$EXTERNALSYM PropertyTagExifFileSource}
PropertyTagExifSceneType = $A301;
{$EXTERNALSYM PropertyTagExifSceneType}
PropertyTagExifCfaPattern = $A302;
{$EXTERNALSYM PropertyTagExifCfaPattern}
PropertyTagGpsVer = $0000;
{$EXTERNALSYM PropertyTagGpsVer}
PropertyTagGpsLatitudeRef = $0001;
{$EXTERNALSYM PropertyTagGpsLatitudeRef}
PropertyTagGpsLatitude = $0002;
{$EXTERNALSYM PropertyTagGpsLatitude}
PropertyTagGpsLongitudeRef = $0003;
{$EXTERNALSYM PropertyTagGpsLongitudeRef}
PropertyTagGpsLongitude = $0004;
{$EXTERNALSYM PropertyTagGpsLongitude}
PropertyTagGpsAltitudeRef = $0005;
{$EXTERNALSYM PropertyTagGpsAltitudeRef}
PropertyTagGpsAltitude = $0006;
{$EXTERNALSYM PropertyTagGpsAltitude}
PropertyTagGpsGpsTime = $0007;
{$EXTERNALSYM PropertyTagGpsGpsTime}
PropertyTagGpsGpsSatellites = $0008;
{$EXTERNALSYM PropertyTagGpsGpsSatellites}
PropertyTagGpsGpsStatus = $0009;
{$EXTERNALSYM PropertyTagGpsGpsStatus}
PropertyTagGpsGpsMeasureMode = $00A;
{$EXTERNALSYM PropertyTagGpsGpsMeasureMode}
PropertyTagGpsGpsDop = $000B; // Measurement precision
{$EXTERNALSYM PropertyTagGpsGpsDop}
PropertyTagGpsSpeedRef = $000C;
{$EXTERNALSYM PropertyTagGpsSpeedRef}
PropertyTagGpsSpeed = $000D;
{$EXTERNALSYM PropertyTagGpsSpeed}
PropertyTagGpsTrackRef = $000E;
{$EXTERNALSYM PropertyTagGpsTrackRef}
PropertyTagGpsTrack = $000F;
{$EXTERNALSYM PropertyTagGpsTrack}
PropertyTagGpsImgDirRef = $0010;
{$EXTERNALSYM PropertyTagGpsImgDirRef}
PropertyTagGpsImgDir = $0011;
{$EXTERNALSYM PropertyTagGpsImgDir}
PropertyTagGpsMapDatum = $0012;
{$EXTERNALSYM PropertyTagGpsMapDatum}
PropertyTagGpsDestLatRef = $0013;
{$EXTERNALSYM PropertyTagGpsDestLatRef}
PropertyTagGpsDestLat = $0014;
{$EXTERNALSYM PropertyTagGpsDestLat}
PropertyTagGpsDestLongRef = $0015;
{$EXTERNALSYM PropertyTagGpsDestLongRef}
PropertyTagGpsDestLong = $0016;
{$EXTERNALSYM PropertyTagGpsDestLong}
PropertyTagGpsDestBearRef = $0017;
{$EXTERNALSYM PropertyTagGpsDestBearRef}
PropertyTagGpsDestBear = $0018;
{$EXTERNALSYM PropertyTagGpsDestBear}
PropertyTagGpsDestDistRef = $0019;
{$EXTERNALSYM PropertyTagGpsDestDistRef}
PropertyTagGpsDestDist = $001A;
{$EXTERNALSYM PropertyTagGpsDestDist}
(**************************************************************************\
*
* GDI+ Color Matrix object, used with Graphics.DrawImage
*
\**************************************************************************)
//----------------------------------------------------------------------------
// Color matrix
//----------------------------------------------------------------------------
type
{$EXTERNALSYM ColorMatrix}
ColorMatrix = packed array[0..4, 0..4] of Single;
TColorMatrix = ColorMatrix;
PColorMatrix = ^TColorMatrix;
//----------------------------------------------------------------------------
// Color Matrix flags
//----------------------------------------------------------------------------
{$EXTERNALSYM ColorMatrixFlags}
ColorMatrixFlags = (
ColorMatrixFlagsDefault = 0,
ColorMatrixFlagsSkipGrays = 1,
ColorMatrixFlagsAltGray = 2
);
TColorMatrixFlags = ColorMatrixFlags;
//----------------------------------------------------------------------------
// Color Adjust Type
//----------------------------------------------------------------------------
{$EXTERNALSYM ColorAdjustType}
ColorAdjustType = (
ColorAdjustTypeDefault,
ColorAdjustTypeBitmap,
ColorAdjustTypeBrush,
ColorAdjustTypePen,
ColorAdjustTypeText,
ColorAdjustTypeCount,
ColorAdjustTypeAny // Reserved
);
TColorAdjustType = ColorAdjustType;
//----------------------------------------------------------------------------
// Color Map
//----------------------------------------------------------------------------
{$EXTERNALSYM ColorMap}
ColorMap = packed record
oldColor: TColor;
newColor: TColor;
end;
TColorMap = ColorMap;
PColorMap = ^TColorMap;
//---------------------------------------------------------------------------
// Private GDI+ classes for internal type checking
//---------------------------------------------------------------------------
GpGraphics = Pointer;
GpBrush = Pointer;
GpTexture = Pointer;
GpSolidFill = Pointer;
GpLineGradient = Pointer;
GpPathGradient = Pointer;
GpHatch = Pointer;
GpPen = Pointer;
GpCustomLineCap = Pointer;
GpAdjustableArrowCap = Pointer;
GpImage = Pointer;
GpBitmap = Pointer;
GpMetafile = Pointer;
GpImageAttributes = Pointer;
GpPath = Pointer;
GpRegion = Pointer;
GpPathIterator = Pointer;
GpFontFamily = Pointer;
GpFont = Pointer;
GpStringFormat = Pointer;
GpFontCollection = Pointer;
GpCachedBitmap = Pointer;
GpStatus = TStatus;
GpFillMode = TFillMode;
GpWrapMode = TWrapMode;
GpUnit = TUnit;
GpCoordinateSpace = TCoordinateSpace;
GpPointF = PPointF;
GpPoint = PPoint;
GpRectF = PRectF;
GpRect = PRect;
GpSizeF = PSizeF;
GpHatchStyle = THatchStyle;
GpDashStyle = TDashStyle;
GpLineCap = TLineCap;
GpDashCap = TDashCap;
GpPenAlignment = TPenAlignment;
GpLineJoin = TLineJoin;
GpPenType = TPenType;
GpMatrix = Pointer;
GpBrushType = TBrushType;
GpMatrixOrder = TMatrixOrder;
GpFlushIntention = TFlushIntention;
GpPathData = TPathData;
// LOGFONT //
PLogFontA = ^TLogFontA;
tagLOGFONTA = record
lfHeight: LONG;
lfWidth: LONG;
lfEscapement: LONG;
lfOrientation: LONG;
lfWeight: LONG;
lfItalic: BYTE;
lfUnderline: BYTE;
lfStrikeOut: BYTE;
lfCharSet: BYTE;
lfOutPrecision: BYTE;
lfClipPrecision: BYTE;
lfQuality: BYTE;
lfPitchAndFamily: BYTE;
lfFaceName: array [0..LF_FACESIZE - 1] of CHAR;
end;
{$EXTERNALSYM tagLOGFONTA}
LOGFONTA = tagLOGFONTA;
{$EXTERNALSYM LOGFONTA}
LPLOGFONTA = ^LOGFONTA;
{$EXTERNALSYM LPLOGFONTA}
NPLOGFONTA = ^LOGFONTA;
{$EXTERNALSYM NPLOGFONTA}
TLogFontA = LOGFONTA;
PLogFontW = ^TLogFontW;
tagLOGFONTW = record
lfHeight: LONG;
lfWidth: LONG;
lfEscapement: LONG;
lfOrientation: LONG;
lfWeight: LONG;
lfItalic: BYTE;
lfUnderline: BYTE;
lfStrikeOut: BYTE;
lfCharSet: BYTE;
lfOutPrecision: BYTE;
lfClipPrecision: BYTE;
lfQuality: BYTE;
lfPitchAndFamily: BYTE;
lfFaceName: array [0..LF_FACESIZE - 1] of WCHAR;
end;
{$EXTERNALSYM tagLOGFONTW}
LOGFONTW = tagLOGFONTW;
{$EXTERNALSYM LOGFONTW}
LPLOGFONTW = ^LOGFONTW;
{$EXTERNALSYM LPLOGFONTW}
NPLOGFONTW = ^LOGFONTW;
{$EXTERNALSYM NPLOGFONTW}
TLogFontW = LOGFONTW;
{$IFDEF UNICODE}
LOGFONT = LOGFONTW;
{$EXTERNALSYM LOGFONT}
PLOGFONT = PLOGFONTW;
{$EXTERNALSYM PLOGFONT}
NPLOGFONT = NPLOGFONTW;
{$EXTERNALSYM NPLOGFONT}
LPLOGFONT = LPLOGFONTW;
{$EXTERNALSYM LPLOGFONT}
TLogFont = TLogFontW;
{$ELSE}
LOGFONT = LOGFONTA;
{$EXTERNALSYM LOGFONT}
PLOGFONT = PLOGFONTA;
{$EXTERNALSYM PLOGFONT}
NPLOGFONT = NPLOGFONTA;
{$EXTERNALSYM NPLOGFONT}
LPLOGFONT = LPLOGFONTA;
{$EXTERNALSYM LPLOGFONT}
TLogFont = TLogFontA;
{$ENDIF UNICODE}
(**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
* Module Name:
* GdiplusFlat.h
* Abstract:
* Private GDI+ header file.
*
\**************************************************************************)
function GdipCreatePath(brushMode: GPFILLMODE;
out path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreatePath}
function GdipCreatePath2(v1: GPPOINTF; v2: PBYTE; v3: Integer; v4: GPFILLMODE;
out path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreatePath2}
function GdipCreatePath2I(v1: GPPOINT; v2: PBYTE; v3: Integer; v4: GPFILLMODE;
out path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreatePath2I}
function GdipClonePath(path: GPPATH;
out clonePath: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipClonePath}
function GdipDeletePath(path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeletePath}
function GdipResetPath(path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipResetPath}
function GdipGetPointCount(path: GPPATH;
out count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPointCount}
function GdipGetPathTypes(path: GPPATH; types: PBYTE;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathTypes}
function GdipGetPathPoints(v1: GPPATH; points: GPPOINTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathPoints}
function GdipGetPathPointsI(v1: GPPATH; points: GPPOINT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathPointsI}
function GdipGetPathFillMode(path: GPPATH;
var fillmode: GPFILLMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathFillMode}
function GdipSetPathFillMode(path: GPPATH;
fillmode: GPFILLMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathFillMode}
function GdipGetPathData(path: GPPATH;
pathData: Pointer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathData}
function GdipStartPathFigure(path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipStartPathFigure}
function GdipClosePathFigure(path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipClosePathFigure}
function GdipClosePathFigures(path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipClosePathFigures}
function GdipSetPathMarker(path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathMarker}
function GdipClearPathMarkers(path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipClearPathMarkers}
function GdipReversePath(path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipReversePath}
function GdipGetPathLastPoint(path: GPPATH;
lastPoint: GPPOINTF): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathLastPoint}
function GdipAddPathLine(path: GPPATH;
x1, y1, x2, y2: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathLine}
function GdipAddPathLine2(path: GPPATH; points: GPPOINTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathLine2}
function GdipAddPathArc(path: GPPATH; x, y, width, height, startAngle,
sweepAngle: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathArc}
function GdipAddPathBezier(path: GPPATH;
x1, y1, x2, y2, x3, y3, x4, y4: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathBezier}
function GdipAddPathBeziers(path: GPPATH; points: GPPOINTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathBeziers}
function GdipAddPathCurve(path: GPPATH; points: GPPOINTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathCurve}
function GdipAddPathCurve2(path: GPPATH; points: GPPOINTF; count: Integer;
tension: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathCurve2}
function GdipAddPathCurve3(path: GPPATH; points: GPPOINTF; count: Integer;
offset: Integer; numberOfSegments: Integer;
tension: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathCurve3}
function GdipAddPathClosedCurve(path: GPPATH; points: GPPOINTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathClosedCurve}
function GdipAddPathClosedCurve2(path: GPPATH; points: GPPOINTF;
count: Integer; tension: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathClosedCurve2}
function GdipAddPathRectangle(path: GPPATH; x: Single; y: Single;
width: Single; height: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathRectangle}
function GdipAddPathRectangles(path: GPPATH; rects: GPRECTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathRectangles}
function GdipAddPathEllipse(path: GPPATH; x: Single; y: Single;
width: Single; height: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathEllipse}
function GdipAddPathPie(path: GPPATH; x: Single; y: Single; width: Single;
height: Single; startAngle: Single; sweepAngle: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathPie}
function GdipAddPathPolygon(path: GPPATH; points: GPPOINTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathPolygon}
function GdipAddPathPath(path: GPPATH; addingPath: GPPATH;
connect: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathPath}
function GdipAddPathString(path: GPPATH; string_: PWCHAR; length: Integer;
family: GPFONTFAMILY; style: Integer; emSize: Single; layoutRect: PRECTF;
format: GPSTRINGFORMAT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathString}
function GdipAddPathStringI(path: GPPATH; string_: PWCHAR; length: Integer;
family: GPFONTFAMILY; style: Integer; emSize: Single; layoutRect: PRECT;
format: GPSTRINGFORMAT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathStringI}
function GdipAddPathLineI(path: GPPATH; x1: Integer; y1: Integer; x2: Integer;
y2: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathLineI}
function GdipAddPathLine2I(path: GPPATH; points: GPPOINT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathLine2I}
function GdipAddPathArcI(path: GPPATH; x: Integer; y: Integer; width: Integer;
height: Integer; startAngle: Single; sweepAngle: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathArcI}
function GdipAddPathBezierI(path: GPPATH; x1: Integer; y1: Integer;
x2: Integer; y2: Integer; x3: Integer; y3: Integer; x4: Integer;
y4: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathBezierI}
function GdipAddPathBeziersI(path: GPPATH; points: GPPOINT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathBeziersI}
function GdipAddPathCurveI(path: GPPATH; points: GPPOINT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathCurveI}
function GdipAddPathCurve2I(path: GPPATH; points: GPPOINT; count: Integer;
tension: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathCurve2I}
function GdipAddPathCurve3I(path: GPPATH; points: GPPOINT; count: Integer;
offset: Integer; numberOfSegments: Integer;
tension: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathCurve3I}
function GdipAddPathClosedCurveI(path: GPPATH; points: GPPOINT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathClosedCurveI}
function GdipAddPathClosedCurve2I(path: GPPATH; points: GPPOINT;
count: Integer; tension: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathClosedCurve2I}
function GdipAddPathRectangleI(path: GPPATH; x: Integer; y: Integer;
width: Integer; height: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathRectangleI}
function GdipAddPathRectanglesI(path: GPPATH; rects: GPRECT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathRectanglesI}
function GdipAddPathEllipseI(path: GPPATH; x: Integer; y: Integer;
width: Integer; height: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathEllipseI}
function GdipAddPathPieI(path: GPPATH; x: Integer; y: Integer; width: Integer;
height: Integer; startAngle: Single; sweepAngle: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathPieI}
function GdipAddPathPolygonI(path: GPPATH; points: GPPOINT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipAddPathPolygonI}
function GdipFlattenPath(path: GPPATH; matrix: GPMATRIX;
flatness: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFlattenPath}
function GdipWindingModeOutline(path: GPPATH; matrix: GPMATRIX;
flatness: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipWindingModeOutline}
function GdipWidenPath(nativePath: GPPATH; pen: GPPEN; matrix: GPMATRIX;
flatness: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipWidenPath}
function GdipWarpPath(path: GPPATH; matrix: GPMATRIX; points: GPPOINTF;
count: Integer; srcx: Single; srcy: Single; srcwidth: Single;
srcheight: Single; warpMode: WARPMODE; flatness: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipWarpPath}
function GdipTransformPath(path: GPPATH; matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTransformPath}
function GdipGetPathWorldBounds(path: GPPATH; bounds: GPRECTF;
matrix: GPMATRIX; pen: GPPEN): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathWorldBounds}
function GdipGetPathWorldBoundsI(path: GPPATH; bounds: GPRECT;
matrix: GPMATRIX; pen: GPPEN): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathWorldBoundsI}
function GdipIsVisiblePathPoint(path: GPPATH; x: Single; y: Single;
graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsVisiblePathPoint}
function GdipIsVisiblePathPointI(path: GPPATH; x: Integer; y: Integer;
graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsVisiblePathPointI}
function GdipIsOutlineVisiblePathPoint(path: GPPATH; x: Single; y: Single;
pen: GPPEN; graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsOutlineVisiblePathPoint}
function GdipIsOutlineVisiblePathPointI(path: GPPATH; x: Integer; y: Integer;
pen: GPPEN; graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsOutlineVisiblePathPointI}
//----------------------------------------------------------------------------
// PathIterator APIs
//----------------------------------------------------------------------------
function GdipCreatePathIter(out iterator: GPPATHITERATOR;
path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreatePathIter}
function GdipDeletePathIter(iterator: GPPATHITERATOR): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeletePathIter}
function GdipPathIterNextSubpath(iterator: GPPATHITERATOR;
var resultCount: Integer; var startIndex: Integer; var endIndex: Integer;
out isClosed: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPathIterNextSubpath}
function GdipPathIterNextSubpathPath(iterator: GPPATHITERATOR;
var resultCount: Integer; path: GPPATH;
out isClosed: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPathIterNextSubpathPath}
function GdipPathIterNextPathType(iterator: GPPATHITERATOR;
var resultCount: Integer; pathType: PBYTE; var startIndex: Integer;
var endIndex: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPathIterNextPathType}
function GdipPathIterNextMarker(iterator: GPPATHITERATOR;
var resultCount: Integer; var startIndex: Integer;
var endIndex: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPathIterNextMarker}
function GdipPathIterNextMarkerPath(iterator: GPPATHITERATOR;
var resultCount: Integer; path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPathIterNextMarkerPath}
function GdipPathIterGetCount(iterator: GPPATHITERATOR;
out count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPathIterGetCount}
function GdipPathIterGetSubpathCount(iterator: GPPATHITERATOR;
out count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPathIterGetSubpathCount}
function GdipPathIterIsValid(iterator: GPPATHITERATOR;
out valid: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPathIterIsValid}
function GdipPathIterHasCurve(iterator: GPPATHITERATOR;
out hasCurve: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPathIterHasCurve}
function GdipPathIterRewind(iterator: GPPATHITERATOR): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPathIterRewind}
function GdipPathIterEnumerate(iterator: GPPATHITERATOR;
var resultCount: Integer; points: GPPOINTF; types: PBYTE;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPathIterEnumerate}
function GdipPathIterCopyData(iterator: GPPATHITERATOR;
var resultCount: Integer; points: GPPOINTF; types: PBYTE;
startIndex: Integer; endIndex: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPathIterCopyData}
//----------------------------------------------------------------------------
// Matrix APIs
//----------------------------------------------------------------------------
function GdipCreateMatrix(out matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateMatrix}
function GdipCreateMatrix2(m11: Single; m12: Single; m21: Single; m22: Single;
dx: Single; dy: Single; out matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateMatrix2}
function GdipCreateMatrix3(rect: GPRECTF; dstplg: GPPOINTF;
out matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateMatrix3}
function GdipCreateMatrix3I(rect: GPRECT; dstplg: GPPOINT;
out matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateMatrix3I}
function GdipCloneMatrix(matrix: GPMATRIX;
out cloneMatrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCloneMatrix}
function GdipDeleteMatrix(matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeleteMatrix}
function GdipSetMatrixElements(matrix: GPMATRIX; m11: Single; m12: Single;
m21: Single; m22: Single; dx: Single; dy: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetMatrixElements}
function GdipMultiplyMatrix(matrix: GPMATRIX; matrix2: GPMATRIX;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipMultiplyMatrix}
function GdipTranslateMatrix(matrix: GPMATRIX; offsetX: Single;
offsetY: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTranslateMatrix}
function GdipScaleMatrix(matrix: GPMATRIX; scaleX: Single; scaleY: Single;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipScaleMatrix}
function GdipRotateMatrix(matrix: GPMATRIX; angle: Single;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRotateMatrix}
function GdipShearMatrix(matrix: GPMATRIX; shearX: Single; shearY: Single;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipShearMatrix}
function GdipInvertMatrix(matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipInvertMatrix}
function GdipTransformMatrixPoints(matrix: GPMATRIX; pts: GPPOINTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTransformMatrixPoints}
function GdipTransformMatrixPointsI(matrix: GPMATRIX; pts: GPPOINT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTransformMatrixPointsI}
function GdipVectorTransformMatrixPoints(matrix: GPMATRIX; pts: GPPOINTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipVectorTransformMatrixPoints}
function GdipVectorTransformMatrixPointsI(matrix: GPMATRIX; pts: GPPOINT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipVectorTransformMatrixPointsI}
function GdipGetMatrixElements(matrix: GPMATRIX;
matrixOut: PSingle): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetMatrixElements}
function GdipIsMatrixInvertible(matrix: GPMATRIX;
out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsMatrixInvertible}
function GdipIsMatrixIdentity(matrix: GPMATRIX;
out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsMatrixIdentity}
function GdipIsMatrixEqual(matrix: GPMATRIX; matrix2: GPMATRIX;
out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsMatrixEqual}
//----------------------------------------------------------------------------
// Region APIs
//----------------------------------------------------------------------------
function GdipCreateRegion(out region: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateRegion}
function GdipCreateRegionRect(rect: GPRECTF;
out region: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateRegionRect}
function GdipCreateRegionRectI(rect: GPRECT;
out region: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateRegionRectI}
function GdipCreateRegionPath(path: GPPATH;
out region: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateRegionPath}
function GdipCreateRegionRgnData(regionData: PBYTE; size: Integer;
out region: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateRegionRgnData}
function GdipCreateRegionHrgn(hRgn: HRGN;
out region: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateRegionHrgn}
function GdipCloneRegion(region: GPREGION;
out cloneRegion: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCloneRegion}
function GdipDeleteRegion(region: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeleteRegion}
function GdipSetInfinite(region: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetInfinite}
function GdipSetEmpty(region: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetEmpty}
function GdipCombineRegionRect(region: GPREGION; rect: GPRECTF;
combineMode: COMBINEMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCombineRegionRect}
function GdipCombineRegionRectI(region: GPREGION; rect: GPRECT;
combineMode: COMBINEMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCombineRegionRectI}
function GdipCombineRegionPath(region: GPREGION; path: GPPATH;
combineMode: COMBINEMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCombineRegionPath}
function GdipCombineRegionRegion(region: GPREGION; region2: GPREGION;
combineMode: COMBINEMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCombineRegionRegion}
function GdipTranslateRegion(region: GPREGION; dx: Single;
dy: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTranslateRegion}
function GdipTranslateRegionI(region: GPREGION; dx: Integer;
dy: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTranslateRegionI}
function GdipTransformRegion(region: GPREGION;
matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTransformRegion}
function GdipGetRegionBounds(region: GPREGION; graphics: GPGRAPHICS;
rect: GPRECTF): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetRegionBounds}
function GdipGetRegionBoundsI(region: GPREGION; graphics: GPGRAPHICS;
rect: GPRECT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetRegionBoundsI}
function GdipGetRegionHRgn(region: GPREGION; graphics: GPGRAPHICS;
out hRgn: HRGN): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetRegionHRgn}
function GdipIsEmptyRegion(region: GPREGION; graphics: GPGRAPHICS;
out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsEmptyRegion}
function GdipIsInfiniteRegion(region: GPREGION; graphics: GPGRAPHICS;
out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsInfiniteRegion}
function GdipIsEqualRegion(region: GPREGION; region2: GPREGION;
graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsEqualRegion}
function GdipGetRegionDataSize(region: GPREGION;
out bufferSize: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetRegionDataSize}
function GdipGetRegionData(region: GPREGION; buffer: PBYTE;
bufferSize: UINT; sizeFilled: PUINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetRegionData}
function GdipIsVisibleRegionPoint(region: GPREGION; x: Single; y: Single;
graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsVisibleRegionPoint}
function GdipIsVisibleRegionPointI(region: GPREGION; x: Integer; y: Integer;
graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsVisibleRegionPointI}
function GdipIsVisibleRegionRect(region: GPREGION; x: Single; y: Single;
width: Single; height: Single; graphics: GPGRAPHICS;
out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsVisibleRegionRect}
function GdipIsVisibleRegionRectI(region: GPREGION; x: Integer; y: Integer;
width: Integer; height: Integer; graphics: GPGRAPHICS;
out result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsVisibleRegionRectI}
function GdipGetRegionScansCount(region: GPREGION; out count: UINT;
matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetRegionScansCount}
function GdipGetRegionScans(region: GPREGION; rects: GPRECTF;
out count: Integer; matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetRegionScans}
function GdipGetRegionScansI(region: GPREGION; rects: GPRECT;
out count: Integer; matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetRegionScansI}
//----------------------------------------------------------------------------
// Brush APIs
//----------------------------------------------------------------------------
function GdipCloneBrush(brush: GPBRUSH;
out cloneBrush: GPBRUSH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCloneBrush}
function GdipDeleteBrush(brush: GPBRUSH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeleteBrush}
function GdipGetBrushType(brush: GPBRUSH;
out type_: GPBRUSHTYPE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetBrushType}
//----------------------------------------------------------------------------
// HatchBrush APIs
//----------------------------------------------------------------------------
function GdipCreateHatchBrush(hatchstyle: Integer; forecol: ARGB;
backcol: ARGB; out brush: GPHATCH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateHatchBrush}
function GdipGetHatchStyle(brush: GPHATCH;
out hatchstyle: GPHATCHSTYLE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetHatchStyle}
function GdipGetHatchForegroundColor(brush: GPHATCH;
out forecol: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetHatchForegroundColor}
function GdipGetHatchBackgroundColor(brush: GPHATCH;
out backcol: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetHatchBackgroundColor}
//----------------------------------------------------------------------------
// TextureBrush APIs
//----------------------------------------------------------------------------
function GdipCreateTexture(image: GPIMAGE; wrapmode: GPWRAPMODE;
var texture: GPTEXTURE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateTexture}
function GdipCreateTexture2(image: GPIMAGE; wrapmode: GPWRAPMODE;
x: Single; y: Single; width: Single; height: Single;
out texture: GPTEXTURE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateTexture2}
function GdipCreateTextureIA(image: GPIMAGE;
imageAttributes: GPIMAGEATTRIBUTES; x: Single; y: Single; width: Single;
height: Single; out texture: GPTEXTURE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateTextureIA}
function GdipCreateTexture2I(image: GPIMAGE; wrapmode: GPWRAPMODE; x: Integer;
y: Integer; width: Integer; height: Integer;
out texture: GPTEXTURE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateTexture2I}
function GdipCreateTextureIAI(image: GPIMAGE;
imageAttributes: GPIMAGEATTRIBUTES; x: Integer; y: Integer; width: Integer;
height: Integer; out texture: GPTEXTURE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateTextureIAI}
function GdipGetTextureTransform(brush: GPTEXTURE;
matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetTextureTransform}
function GdipSetTextureTransform(brush: GPTEXTURE;
matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetTextureTransform}
function GdipResetTextureTransform(brush: GPTEXTURE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipResetTextureTransform}
function GdipMultiplyTextureTransform(brush: GPTEXTURE; matrix: GPMATRIX;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipMultiplyTextureTransform}
function GdipTranslateTextureTransform(brush: GPTEXTURE; dx: Single;
dy: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTranslateTextureTransform}
function GdipScaleTextureTransform(brush: GPTEXTURE; sx: Single; sy: Single;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipScaleTextureTransform}
function GdipRotateTextureTransform(brush: GPTEXTURE; angle: Single;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRotateTextureTransform}
function GdipSetTextureWrapMode(brush: GPTEXTURE;
wrapmode: GPWRAPMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetTextureWrapMode}
function GdipGetTextureWrapMode(brush: GPTEXTURE;
var wrapmode: GPWRAPMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetTextureWrapMode}
function GdipGetTextureImage(brush: GPTEXTURE;
out image: GPIMAGE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetTextureImage}
//----------------------------------------------------------------------------
// SolidBrush APIs
//----------------------------------------------------------------------------
function GdipCreateSolidFill(color: ARGB;
out brush: GPSOLIDFILL): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateSolidFill}
function GdipSetSolidFillColor(brush: GPSOLIDFILL;
color: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetSolidFillColor}
function GdipGetSolidFillColor(brush: GPSOLIDFILL;
out color: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetSolidFillColor}
//----------------------------------------------------------------------------
// LineBrush APIs
//----------------------------------------------------------------------------
function GdipCreateLineBrush(point1: GPPOINTF; point2: GPPOINTF; color1: ARGB;
color2: ARGB; wrapMode: GPWRAPMODE;
out lineGradient: GPLINEGRADIENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateLineBrush}
function GdipCreateLineBrushI(point1: GPPOINT; point2: GPPOINT; color1: ARGB;
color2: ARGB; wrapMode: GPWRAPMODE;
out lineGradient: GPLINEGRADIENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateLineBrushI}
function GdipCreateLineBrushFromRect(rect: GPRECTF; color1: ARGB;
color2: ARGB; mode: LINEARGRADIENTMODE; wrapMode: GPWRAPMODE;
out lineGradient: GPLINEGRADIENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateLineBrushFromRect}
function GdipCreateLineBrushFromRectI(rect: GPRECT; color1: ARGB;
color2: ARGB; mode: LINEARGRADIENTMODE; wrapMode: GPWRAPMODE;
out lineGradient: GPLINEGRADIENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateLineBrushFromRectI}
function GdipCreateLineBrushFromRectWithAngle(rect: GPRECTF; color1: ARGB;
color2: ARGB; angle: Single; isAngleScalable: Bool; wrapMode: GPWRAPMODE;
out lineGradient: GPLINEGRADIENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateLineBrushFromRectWithAngle}
function GdipCreateLineBrushFromRectWithAngleI(rect: GPRECT; color1: ARGB;
color2: ARGB; angle: Single; isAngleScalable: Bool; wrapMode: GPWRAPMODE;
out lineGradient: GPLINEGRADIENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateLineBrushFromRectWithAngleI}
function GdipSetLineColors(brush: GPLINEGRADIENT; color1: ARGB;
color2: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetLineColors}
function GdipGetLineColors(brush: GPLINEGRADIENT;
colors: PARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLineColors}
function GdipGetLineRect(brush: GPLINEGRADIENT;
rect: GPRECTF): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLineRect}
function GdipGetLineRectI(brush: GPLINEGRADIENT;
rect: GPRECT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLineRectI}
function GdipSetLineGammaCorrection(brush: GPLINEGRADIENT;
useGammaCorrection: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetLineGammaCorrection}
function GdipGetLineGammaCorrection(brush: GPLINEGRADIENT;
out useGammaCorrection: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLineGammaCorrection}
function GdipGetLineBlendCount(brush: GPLINEGRADIENT;
out count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLineBlendCount}
function GdipGetLineBlend(brush: GPLINEGRADIENT; blend: PSingle;
positions: PSingle; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLineBlend}
function GdipSetLineBlend(brush: GPLINEGRADIENT; blend: PSingle;
positions: PSingle; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetLineBlend}
function GdipGetLinePresetBlendCount(brush: GPLINEGRADIENT;
out count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLinePresetBlendCount}
function GdipGetLinePresetBlend(brush: GPLINEGRADIENT; blend: PARGB;
positions: PSingle; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLinePresetBlend}
function GdipSetLinePresetBlend(brush: GPLINEGRADIENT; blend: PARGB;
positions: PSingle; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetLinePresetBlend}
function GdipSetLineSigmaBlend(brush: GPLINEGRADIENT; focus: Single;
scale: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetLineSigmaBlend}
function GdipSetLineLinearBlend(brush: GPLINEGRADIENT; focus: Single;
scale: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetLineLinearBlend}
function GdipSetLineWrapMode(brush: GPLINEGRADIENT;
wrapmode: GPWRAPMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetLineWrapMode}
function GdipGetLineWrapMode(brush: GPLINEGRADIENT;
out wrapmode: GPWRAPMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLineWrapMode}
function GdipGetLineTransform(brush: GPLINEGRADIENT;
matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLineTransform}
function GdipSetLineTransform(brush: GPLINEGRADIENT;
matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetLineTransform}
function GdipResetLineTransform(brush: GPLINEGRADIENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipResetLineTransform}
function GdipMultiplyLineTransform(brush: GPLINEGRADIENT; matrix: GPMATRIX;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipMultiplyLineTransform}
function GdipTranslateLineTransform(brush: GPLINEGRADIENT; dx: Single;
dy: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTranslateLineTransform}
function GdipScaleLineTransform(brush: GPLINEGRADIENT; sx: Single; sy: Single;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipScaleLineTransform}
function GdipRotateLineTransform(brush: GPLINEGRADIENT; angle: Single;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRotateLineTransform}
//----------------------------------------------------------------------------
// PathGradientBrush APIs
//----------------------------------------------------------------------------
function GdipCreatePathGradient(points: GPPOINTF; count: Integer;
wrapMode: GPWRAPMODE; out polyGradient: GPPATHGRADIENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreatePathGradient}
function GdipCreatePathGradientI(points: GPPOINT; count: Integer;
wrapMode: GPWRAPMODE; out polyGradient: GPPATHGRADIENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreatePathGradientI}
function GdipCreatePathGradientFromPath(path: GPPATH;
out polyGradient: GPPATHGRADIENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreatePathGradientFromPath}
function GdipGetPathGradientCenterColor(brush: GPPATHGRADIENT;
out colors: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientCenterColor}
function GdipSetPathGradientCenterColor(brush: GPPATHGRADIENT;
colors: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientCenterColor}
function GdipGetPathGradientSurroundColorsWithCount(brush: GPPATHGRADIENT;
color: PARGB; var count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientSurroundColorsWithCount}
function GdipSetPathGradientSurroundColorsWithCount(brush: GPPATHGRADIENT;
color: PARGB; var count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientSurroundColorsWithCount}
function GdipGetPathGradientPath(brush: GPPATHGRADIENT;
path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientPath}
function GdipSetPathGradientPath(brush: GPPATHGRADIENT;
path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientPath}
function GdipGetPathGradientCenterPoint(brush: GPPATHGRADIENT;
points: GPPOINTF): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientCenterPoint}
function GdipGetPathGradientCenterPointI(brush: GPPATHGRADIENT;
points: GPPOINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientCenterPointI}
function GdipSetPathGradientCenterPoint(brush: GPPATHGRADIENT;
points: GPPOINTF): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientCenterPoint}
function GdipSetPathGradientCenterPointI(brush: GPPATHGRADIENT;
points: GPPOINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientCenterPointI}
function GdipGetPathGradientRect(brush: GPPATHGRADIENT;
rect: GPRECTF): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientRect}
function GdipGetPathGradientRectI(brush: GPPATHGRADIENT;
rect: GPRECT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientRectI}
function GdipGetPathGradientPointCount(brush: GPPATHGRADIENT;
var count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientPointCount}
function GdipGetPathGradientSurroundColorCount(brush: GPPATHGRADIENT;
var count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientSurroundColorCount}
function GdipSetPathGradientGammaCorrection(brush: GPPATHGRADIENT;
useGammaCorrection: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientGammaCorrection}
function GdipGetPathGradientGammaCorrection(brush: GPPATHGRADIENT;
var useGammaCorrection: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientGammaCorrection}
function GdipGetPathGradientBlendCount(brush: GPPATHGRADIENT;
var count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientBlendCount}
function GdipGetPathGradientBlend(brush: GPPATHGRADIENT;
blend: PSingle; positions: PSingle; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientBlend}
function GdipSetPathGradientBlend(brush: GPPATHGRADIENT;
blend: PSingle; positions: PSingle; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientBlend}
function GdipGetPathGradientPresetBlendCount(brush: GPPATHGRADIENT;
var count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientPresetBlendCount}
function GdipGetPathGradientPresetBlend(brush: GPPATHGRADIENT;
blend: PARGB; positions: PSingle; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientPresetBlend}
function GdipSetPathGradientPresetBlend(brush: GPPATHGRADIENT;
blend: PARGB; positions: PSingle; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientPresetBlend}
function GdipSetPathGradientSigmaBlend(brush: GPPATHGRADIENT;
focus: Single; scale: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientSigmaBlend}
function GdipSetPathGradientLinearBlend(brush: GPPATHGRADIENT;
focus: Single; scale: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientLinearBlend}
function GdipGetPathGradientWrapMode(brush: GPPATHGRADIENT;
var wrapmode: GPWRAPMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientWrapMode}
function GdipSetPathGradientWrapMode(brush: GPPATHGRADIENT;
wrapmode: GPWRAPMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientWrapMode}
function GdipGetPathGradientTransform(brush: GPPATHGRADIENT;
matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientTransform}
function GdipSetPathGradientTransform(brush: GPPATHGRADIENT;
matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientTransform}
function GdipResetPathGradientTransform(
brush: GPPATHGRADIENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipResetPathGradientTransform}
function GdipMultiplyPathGradientTransform(brush: GPPATHGRADIENT;
matrix: GPMATRIX; order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipMultiplyPathGradientTransform}
function GdipTranslatePathGradientTransform(brush: GPPATHGRADIENT;
dx: Single; dy: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTranslatePathGradientTransform}
function GdipScalePathGradientTransform(brush: GPPATHGRADIENT;
sx: Single; sy: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipScalePathGradientTransform}
function GdipRotatePathGradientTransform(brush: GPPATHGRADIENT;
angle: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRotatePathGradientTransform}
function GdipGetPathGradientFocusScales(brush: GPPATHGRADIENT;
var xScale: Single; var yScale: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPathGradientFocusScales}
function GdipSetPathGradientFocusScales(brush: GPPATHGRADIENT;
xScale: Single; yScale: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPathGradientFocusScales}
//----------------------------------------------------------------------------
// Pen APIs
//----------------------------------------------------------------------------
function GdipCreatePen1(color: ARGB; width: Single; unit_: GPUNIT;
out pen: GPPEN): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreatePen1}
function GdipCreatePen2(brush: GPBRUSH; width: Single; unit_: GPUNIT;
out pen: GPPEN): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreatePen2}
function GdipClonePen(pen: GPPEN; out clonepen: GPPEN): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipClonePen}
function GdipDeletePen(pen: GPPEN): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeletePen}
function GdipSetPenWidth(pen: GPPEN; width: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenWidth}
function GdipGetPenWidth(pen: GPPEN; out width: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenWidth}
function GdipSetPenUnit(pen: GPPEN; unit_: GPUNIT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenUnit}
function GdipGetPenUnit(pen: GPPEN; var unit_: GPUNIT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenUnit}
function GdipSetPenLineCap197819(pen: GPPEN; startCap: GPLINECAP;
endCap: GPLINECAP; dashCap: GPDASHCAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenLineCap197819}
function GdipSetPenStartCap(pen: GPPEN;
startCap: GPLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenStartCap}
function GdipSetPenEndCap(pen: GPPEN; endCap: GPLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenEndCap}
function GdipSetPenDashCap197819(pen: GPPEN;
dashCap: GPDASHCAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenDashCap197819}
function GdipGetPenStartCap(pen: GPPEN;
out startCap: GPLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenStartCap}
function GdipGetPenEndCap(pen: GPPEN;
out endCap: GPLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenEndCap}
function GdipGetPenDashCap197819(pen: GPPEN;
out dashCap: GPDASHCAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenDashCap197819}
function GdipSetPenLineJoin(pen: GPPEN;
lineJoin: GPLINEJOIN): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenLineJoin}
function GdipGetPenLineJoin(pen: GPPEN;
var lineJoin: GPLINEJOIN): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenLineJoin}
function GdipSetPenCustomStartCap(pen: GPPEN;
customCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenCustomStartCap}
function GdipGetPenCustomStartCap(pen: GPPEN;
out customCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenCustomStartCap}
function GdipSetPenCustomEndCap(pen: GPPEN;
customCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenCustomEndCap}
function GdipGetPenCustomEndCap(pen: GPPEN;
out customCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenCustomEndCap}
function GdipSetPenMiterLimit(pen: GPPEN;
miterLimit: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenMiterLimit}
function GdipGetPenMiterLimit(pen: GPPEN;
out miterLimit: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenMiterLimit}
function GdipSetPenMode(pen: GPPEN;
penMode: GPPENALIGNMENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenMode}
function GdipGetPenMode(pen: GPPEN;
var penMode: GPPENALIGNMENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenMode}
function GdipSetPenTransform(pen: GPPEN;
matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenTransform}
function GdipGetPenTransform(pen: GPPEN;
matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenTransform}
function GdipResetPenTransform(pen: GPPEN): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipResetPenTransform}
function GdipMultiplyPenTransform(pen: GPPEN; matrix: GPMATRIX;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipMultiplyPenTransform}
function GdipTranslatePenTransform(pen: GPPEN; dx: Single; dy: Single;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTranslatePenTransform}
function GdipScalePenTransform(pen: GPPEN; sx: Single; sy: Single;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipScalePenTransform}
function GdipRotatePenTransform(pen: GPPEN; angle: Single;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRotatePenTransform}
function GdipSetPenColor(pen: GPPEN; argb: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenColor}
function GdipGetPenColor(pen: GPPEN; out argb: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenColor}
function GdipSetPenBrushFill(pen: GPPEN; brush: GPBRUSH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenBrushFill}
function GdipGetPenBrushFill(pen: GPPEN;
out brush: GPBRUSH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenBrushFill}
function GdipGetPenFillType(pen: GPPEN;
out type_: GPPENTYPE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenFillType}
function GdipGetPenDashStyle(pen: GPPEN;
out dashstyle: GPDASHSTYLE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenDashStyle}
function GdipSetPenDashStyle(pen: GPPEN;
dashstyle: GPDASHSTYLE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenDashStyle}
function GdipGetPenDashOffset(pen: GPPEN;
out offset: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenDashOffset}
function GdipSetPenDashOffset(pen: GPPEN; offset: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenDashOffset}
function GdipGetPenDashCount(pen: GPPEN;
var count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenDashCount}
function GdipSetPenDashArray(pen: GPPEN; dash: PSingle;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenDashArray}
function GdipGetPenDashArray(pen: GPPEN; dash: PSingle;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenDashArray}
function GdipGetPenCompoundCount(pen: GPPEN;
out count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenCompoundCount}
function GdipSetPenCompoundArray(pen: GPPEN; dash: PSingle;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPenCompoundArray}
function GdipGetPenCompoundArray(pen: GPPEN; dash: PSingle;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPenCompoundArray}
//----------------------------------------------------------------------------
// CustomLineCap APIs
//----------------------------------------------------------------------------
function GdipCreateCustomLineCap(fillPath: GPPATH; strokePath: GPPATH;
baseCap: GPLINECAP; baseInset: Single;
out customCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateCustomLineCap}
function GdipDeleteCustomLineCap(
customCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeleteCustomLineCap}
function GdipCloneCustomLineCap(customCap: GPCUSTOMLINECAP;
out clonedCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCloneCustomLineCap}
function GdipGetCustomLineCapType(customCap: GPCUSTOMLINECAP;
var capType: CUSTOMLINECAPTYPE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetCustomLineCapType}
function GdipSetCustomLineCapStrokeCaps(customCap: GPCUSTOMLINECAP;
startCap: GPLINECAP; endCap: GPLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetCustomLineCapStrokeCaps}
function GdipGetCustomLineCapStrokeCaps(customCap: GPCUSTOMLINECAP;
var startCap: GPLINECAP; var endCap: GPLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetCustomLineCapStrokeCaps}
function GdipSetCustomLineCapStrokeJoin(customCap: GPCUSTOMLINECAP;
lineJoin: GPLINEJOIN): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetCustomLineCapStrokeJoin}
function GdipGetCustomLineCapStrokeJoin(customCap: GPCUSTOMLINECAP;
var lineJoin: GPLINEJOIN): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetCustomLineCapStrokeJoin}
function GdipSetCustomLineCapBaseCap(customCap: GPCUSTOMLINECAP;
baseCap: GPLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetCustomLineCapBaseCap}
function GdipGetCustomLineCapBaseCap(customCap: GPCUSTOMLINECAP;
var baseCap: GPLINECAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetCustomLineCapBaseCap}
function GdipSetCustomLineCapBaseInset(customCap: GPCUSTOMLINECAP;
inset: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetCustomLineCapBaseInset}
function GdipGetCustomLineCapBaseInset(customCap: GPCUSTOMLINECAP;
var inset: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetCustomLineCapBaseInset}
function GdipSetCustomLineCapWidthScale(customCap: GPCUSTOMLINECAP;
widthScale: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetCustomLineCapWidthScale}
function GdipGetCustomLineCapWidthScale(customCap: GPCUSTOMLINECAP;
var widthScale: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetCustomLineCapWidthScale}
//----------------------------------------------------------------------------
// AdjustableArrowCap APIs
//----------------------------------------------------------------------------
function GdipCreateAdjustableArrowCap(height: Single;
width: Single;
isFilled: Bool;
out cap: GPADJUSTABLEARROWCAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateAdjustableArrowCap}
function GdipSetAdjustableArrowCapHeight(cap: GPADJUSTABLEARROWCAP;
height: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetAdjustableArrowCapHeight}
function GdipGetAdjustableArrowCapHeight(cap: GPADJUSTABLEARROWCAP;
var height: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetAdjustableArrowCapHeight}
function GdipSetAdjustableArrowCapWidth(cap: GPADJUSTABLEARROWCAP;
width: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetAdjustableArrowCapWidth}
function GdipGetAdjustableArrowCapWidth(cap: GPADJUSTABLEARROWCAP;
var width: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetAdjustableArrowCapWidth}
function GdipSetAdjustableArrowCapMiddleInset(cap: GPADJUSTABLEARROWCAP;
middleInset: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetAdjustableArrowCapMiddleInset}
function GdipGetAdjustableArrowCapMiddleInset(cap: GPADJUSTABLEARROWCAP;
var middleInset: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetAdjustableArrowCapMiddleInset}
function GdipSetAdjustableArrowCapFillState(cap: GPADJUSTABLEARROWCAP;
fillState: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetAdjustableArrowCapFillState}
function GdipGetAdjustableArrowCapFillState(cap: GPADJUSTABLEARROWCAP;
var fillState: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetAdjustableArrowCapFillState}
//----------------------------------------------------------------------------
// Image APIs
//----------------------------------------------------------------------------
function GdipLoadImageFromStream(stream: ISTREAM;
out image: GPIMAGE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipLoadImageFromStream}
function GdipLoadImageFromFile(filename: PWCHAR;
out image: GPIMAGE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipLoadImageFromFile}
function GdipLoadImageFromStreamICM(stream: ISTREAM;
out image: GPIMAGE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipLoadImageFromStreamICM}
function GdipLoadImageFromFileICM(filename: PWCHAR;
out image: GPIMAGE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipLoadImageFromFileICM}
function GdipCloneImage(image: GPIMAGE;
out cloneImage: GPIMAGE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCloneImage}
function GdipDisposeImage(image: GPIMAGE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDisposeImage}
function GdipSaveImageToFile(image: GPIMAGE;
filename: PWCHAR;
clsidEncoder: PGUID;
encoderParams: PENCODERPARAMETERS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSaveImageToFile}
function GdipSaveImageToStream(image: GPIMAGE;
stream: ISTREAM;
clsidEncoder: PGUID;
encoderParams: PENCODERPARAMETERS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSaveImageToStream}
function GdipSaveAdd(image: GPIMAGE;
encoderParams: PENCODERPARAMETERS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSaveAdd}
function GdipSaveAddImage(image: GPIMAGE;
newImage: GPIMAGE;
encoderParams: PENCODERPARAMETERS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSaveAddImage}
function GdipGetImageGraphicsContext(image: GPIMAGE;
out graphics: GPGRAPHICS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageGraphicsContext}
function GdipGetImageBounds(image: GPIMAGE;
srcRect: GPRECTF;
var srcUnit: GPUNIT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageBounds}
function GdipGetImageDimension(image: GPIMAGE;
var width: Single;
var height: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageDimension}
function GdipGetImageType(image: GPIMAGE;
var type_: IMAGETYPE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageType}
function GdipGetImageWidth(image: GPIMAGE;
var width: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageWidth}
function GdipGetImageHeight(image: GPIMAGE;
var height: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageHeight}
function GdipGetImageHorizontalResolution(image: GPIMAGE;
var resolution: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageHorizontalResolution}
function GdipGetImageVerticalResolution(image: GPIMAGE;
var resolution: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageVerticalResolution}
function GdipGetImageFlags(image: GPIMAGE;
var flags: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageFlags}
function GdipGetImageRawFormat(image: GPIMAGE;
format: PGUID): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageRawFormat}
function GdipGetImagePixelFormat(image: GPIMAGE;
out format: TPIXELFORMAT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImagePixelFormat}
function GdipGetImageThumbnail(image: GPIMAGE; thumbWidth: UINT;
thumbHeight: UINT; out thumbImage: GPIMAGE;
callback: GETTHUMBNAILIMAGEABORT; callbackData: Pointer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageThumbnail}
function GdipGetEncoderParameterListSize(image: GPIMAGE;
clsidEncoder: PGUID; out size: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetEncoderParameterListSize}
function GdipGetEncoderParameterList(image: GPIMAGE; clsidEncoder: PGUID;
size: UINT; buffer: PENCODERPARAMETERS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetEncoderParameterList}
function GdipImageGetFrameDimensionsCount(image: GPIMAGE;
var count: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipImageGetFrameDimensionsCount}
function GdipImageGetFrameDimensionsList(image: GPIMAGE; dimensionIDs: PGUID;
count: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipImageGetFrameDimensionsList}
function GdipImageGetFrameCount(image: GPIMAGE; dimensionID: PGUID;
var count: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipImageGetFrameCount}
function GdipImageSelectActiveFrame(image: GPIMAGE; dimensionID: PGUID;
frameIndex: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipImageSelectActiveFrame}
function GdipImageRotateFlip(image: GPIMAGE;
rfType: ROTATEFLIPTYPE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipImageRotateFlip}
function GdipGetImagePalette(image: GPIMAGE; palette: PCOLORPALETTE;
size: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImagePalette}
function GdipSetImagePalette(image: GPIMAGE;
palette: PCOLORPALETTE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetImagePalette}
function GdipGetImagePaletteSize(image: GPIMAGE;
var size: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImagePaletteSize}
function GdipGetPropertyCount(image: GPIMAGE;
var numOfProperty: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPropertyCount}
function GdipGetPropertyIdList(image: GPIMAGE; numOfProperty: UINT;
list: PPROPID): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPropertyIdList}
function GdipGetPropertyItemSize(image: GPIMAGE; propId: PROPID;
var size: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPropertyItemSize}
function GdipGetPropertyItem(image: GPIMAGE; propId: PROPID; propSize: UINT;
buffer: PPROPERTYITEM): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPropertyItem}
function GdipGetPropertySize(image: GPIMAGE; var totalBufferSize: UINT;
var numProperties: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPropertySize}
function GdipGetAllPropertyItems(image: GPIMAGE; totalBufferSize: UINT;
numProperties: UINT; allItems: PPROPERTYITEM): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetAllPropertyItems}
function GdipRemovePropertyItem(image: GPIMAGE;
propId: PROPID): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRemovePropertyItem}
function GdipSetPropertyItem(image: GPIMAGE;
item: PPROPERTYITEM): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPropertyItem}
function GdipImageForceValidation(image: GPIMAGE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipImageForceValidation}
//----------------------------------------------------------------------------
// Bitmap APIs
//----------------------------------------------------------------------------
function GdipCreateBitmapFromStream(stream: ISTREAM;
out bitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateBitmapFromStream}
function GdipCreateBitmapFromFile(filename: PWCHAR;
out bitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateBitmapFromFile}
function GdipCreateBitmapFromStreamICM(stream: ISTREAM;
out bitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateBitmapFromStreamICM}
function GdipCreateBitmapFromFileICM(filename: PWCHAR;
var bitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateBitmapFromFileICM}
function GdipCreateBitmapFromScan0(width: Integer; height: Integer;
stride: Integer; format: PIXELFORMAT; scan0: PBYTE;
out bitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateBitmapFromScan0}
function GdipCreateBitmapFromGraphics(width: Integer; height: Integer;
target: GPGRAPHICS; out bitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateBitmapFromGraphics}
function GdipCreateBitmapFromDirectDrawSurface(surface: IDIRECTDRAWSURFACE7;
out bitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateBitmapFromDirectDrawSurface}
function GdipCreateBitmapFromGdiDib(gdiBitmapInfo: PBitmapInfo;
gdiBitmapData: Pointer; out bitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateBitmapFromGdiDib}
function GdipCreateBitmapFromHBITMAP(hbm: HBITMAP; hpal: HPALETTE;
out bitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateBitmapFromHBITMAP}
function GdipCreateHBITMAPFromBitmap(bitmap: GPBITMAP; out hbmReturn: HBITMAP;
background: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateHBITMAPFromBitmap}
function GdipCreateBitmapFromHICON(hicon: HICON;
out bitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateBitmapFromHICON}
function GdipCreateHICONFromBitmap(bitmap: GPBITMAP;
out hbmReturn: HICON): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateHICONFromBitmap}
function GdipCreateBitmapFromResource(hInstance: HMODULE;
lpBitmapName: PWCHAR; out bitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateBitmapFromResource}
function GdipCloneBitmapArea(x: Single; y: Single; width: Single;
height: Single; format: PIXELFORMAT; srcBitmap: GPBITMAP;
out dstBitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCloneBitmapArea}
function GdipCloneBitmapAreaI(x: Integer; y: Integer; width: Integer;
height: Integer; format: PIXELFORMAT; srcBitmap: GPBITMAP;
out dstBitmap: GPBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCloneBitmapAreaI}
function GdipBitmapLockBits(bitmap: GPBITMAP; rect: GPRECT; flags: UINT;
format: PIXELFORMAT; lockedBitmapData: PBITMAPDATA): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipBitmapLockBits}
function GdipBitmapUnlockBits(bitmap: GPBITMAP;
lockedBitmapData: PBITMAPDATA): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipBitmapUnlockBits}
function GdipBitmapGetPixel(bitmap: GPBITMAP; x: Integer; y: Integer;
var color: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipBitmapGetPixel}
function GdipBitmapSetPixel(bitmap: GPBITMAP; x: Integer; y: Integer;
color: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipBitmapSetPixel}
function GdipBitmapSetResolution(bitmap: GPBITMAP; xdpi: Single;
ydpi: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipBitmapSetResolution}
//----------------------------------------------------------------------------
// ImageAttributes APIs
//----------------------------------------------------------------------------
function GdipCreateImageAttributes(
out imageattr: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateImageAttributes}
function GdipCloneImageAttributes(imageattr: GPIMAGEATTRIBUTES;
out cloneImageattr: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCloneImageAttributes}
function GdipDisposeImageAttributes(
imageattr: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDisposeImageAttributes}
function GdipSetImageAttributesToIdentity(imageattr: GPIMAGEATTRIBUTES;
type_: COLORADJUSTTYPE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetImageAttributesToIdentity}
function GdipResetImageAttributes(imageattr: GPIMAGEATTRIBUTES;
type_: COLORADJUSTTYPE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipResetImageAttributes}
function GdipSetImageAttributesColorMatrix(imageattr: GPIMAGEATTRIBUTES;
type_: COLORADJUSTTYPE; enableFlag: Bool; colorMatrix: PCOLORMATRIX;
grayMatrix: PCOLORMATRIX; flags: COLORMATRIXFLAGS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetImageAttributesColorMatrix}
function GdipSetImageAttributesThreshold(imageattr: GPIMAGEATTRIBUTES;
type_: COLORADJUSTTYPE; enableFlag: Bool;
threshold: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetImageAttributesThreshold}
function GdipSetImageAttributesGamma(imageattr: GPIMAGEATTRIBUTES;
type_: COLORADJUSTTYPE; enableFlag: Bool; gamma: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetImageAttributesGamma}
function GdipSetImageAttributesNoOp(imageattr: GPIMAGEATTRIBUTES;
type_: COLORADJUSTTYPE; enableFlag: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetImageAttributesNoOp}
function GdipSetImageAttributesColorKeys(imageattr: GPIMAGEATTRIBUTES;
type_: COLORADJUSTTYPE; enableFlag: Bool; colorLow: ARGB;
colorHigh: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetImageAttributesColorKeys}
function GdipSetImageAttributesOutputChannel(imageattr: GPIMAGEATTRIBUTES;
type_: COLORADJUSTTYPE; enableFlag: Bool;
channelFlags: COLORCHANNELFLAGS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetImageAttributesOutputChannel}
function GdipSetImageAttributesOutputChannelColorProfile(imageattr: GPIMAGEATTRIBUTES;
type_: COLORADJUSTTYPE; enableFlag: Bool;
colorProfileFilename: PWCHAR): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetImageAttributesOutputChannelColorProfile}
function GdipSetImageAttributesRemapTable(imageattr: GPIMAGEATTRIBUTES;
type_: COLORADJUSTTYPE; enableFlag: Bool; mapSize: UINT;
map: PCOLORMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetImageAttributesRemapTable}
function GdipSetImageAttributesWrapMode(imageAttr: GPIMAGEATTRIBUTES;
wrap: WRAPMODE; argb: ARGB; clamp: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetImageAttributesWrapMode}
function GdipSetImageAttributesICMMode(imageAttr: GPIMAGEATTRIBUTES;
on_: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetImageAttributesICMMode}
function GdipGetImageAttributesAdjustedPalette(imageAttr: GPIMAGEATTRIBUTES;
colorPalette: PCOLORPALETTE;
colorAdjustType: COLORADJUSTTYPE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageAttributesAdjustedPalette}
//----------------------------------------------------------------------------
// Graphics APIs
//----------------------------------------------------------------------------
function GdipFlush(graphics: GPGRAPHICS;
intention: GPFLUSHINTENTION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFlush}
function GdipCreateFromHDC(hdc: HDC;
out graphics: GPGRAPHICS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateFromHDC}
function GdipCreateFromHDC2(hdc: HDC; hDevice: THandle;
out graphics: GPGRAPHICS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateFromHDC2}
function GdipCreateFromHWND(hwnd: HWND;
out graphics: GPGRAPHICS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateFromHWND}
function GdipCreateFromHWNDICM(hwnd: HWND;
out graphics: GPGRAPHICS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateFromHWNDICM}
function GdipDeleteGraphics(graphics: GPGRAPHICS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeleteGraphics}
function GdipGetDC(graphics: GPGRAPHICS; var hdc: HDC): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetDC}
function GdipReleaseDC(graphics: GPGRAPHICS; hdc: HDC): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipReleaseDC}
function GdipSetCompositingMode(graphics: GPGRAPHICS;
compositingMode: COMPOSITINGMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetCompositingMode}
function GdipGetCompositingMode(graphics: GPGRAPHICS;
var compositingMode: COMPOSITINGMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetCompositingMode}
function GdipSetRenderingOrigin(graphics: GPGRAPHICS; x: Integer;
y: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetRenderingOrigin}
function GdipGetRenderingOrigin(graphics: GPGRAPHICS; var x: Integer;
var y: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetRenderingOrigin}
function GdipSetCompositingQuality(graphics: GPGRAPHICS;
compositingQuality: COMPOSITINGQUALITY): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetCompositingQuality}
function GdipGetCompositingQuality(graphics: GPGRAPHICS;
var compositingQuality: COMPOSITINGQUALITY): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetCompositingQuality}
function GdipSetSmoothingMode(graphics: GPGRAPHICS;
smoothingMode: SMOOTHINGMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetSmoothingMode}
function GdipGetSmoothingMode(graphics: GPGRAPHICS;
var smoothingMode: SMOOTHINGMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetSmoothingMode}
function GdipSetPixelOffsetMode(graphics: GPGRAPHICS;
pixelOffsetMode: PIXELOFFSETMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPixelOffsetMode}
function GdipGetPixelOffsetMode(graphics: GPGRAPHICS;
var pixelOffsetMode: PIXELOFFSETMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPixelOffsetMode}
function GdipSetTextRenderingHint(graphics: GPGRAPHICS;
mode: TEXTRENDERINGHINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetTextRenderingHint}
function GdipGetTextRenderingHint(graphics: GPGRAPHICS;
var mode: TEXTRENDERINGHINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetTextRenderingHint}
function GdipSetTextContrast(graphics: GPGRAPHICS;
contrast: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetTextContrast}
function GdipGetTextContrast(graphics: GPGRAPHICS;
var contrast: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetTextContrast}
function GdipSetInterpolationMode(graphics: GPGRAPHICS;
interpolationMode: INTERPOLATIONMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetInterpolationMode}
function GdipGetInterpolationMode(graphics: GPGRAPHICS;
var interpolationMode: INTERPOLATIONMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetInterpolationMode}
function GdipSetWorldTransform(graphics: GPGRAPHICS;
matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetWorldTransform}
function GdipResetWorldTransform(graphics: GPGRAPHICS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipResetWorldTransform}
function GdipMultiplyWorldTransform(graphics: GPGRAPHICS; matrix: GPMATRIX;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipMultiplyWorldTransform}
function GdipTranslateWorldTransform(graphics: GPGRAPHICS; dx: Single;
dy: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTranslateWorldTransform}
function GdipScaleWorldTransform(graphics: GPGRAPHICS; sx: Single; sy: Single;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipScaleWorldTransform}
function GdipRotateWorldTransform(graphics: GPGRAPHICS; angle: Single;
order: GPMATRIXORDER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRotateWorldTransform}
function GdipGetWorldTransform(graphics: GPGRAPHICS;
matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetWorldTransform}
function GdipResetPageTransform(graphics: GPGRAPHICS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipResetPageTransform}
function GdipGetPageUnit(graphics: GPGRAPHICS;
var unit_: GPUNIT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPageUnit}
function GdipGetPageScale(graphics: GPGRAPHICS;
var scale: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetPageScale}
function GdipSetPageUnit(graphics: GPGRAPHICS;
unit_: GPUNIT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPageUnit}
function GdipSetPageScale(graphics: GPGRAPHICS;
scale: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetPageScale}
function GdipGetDpiX(graphics: GPGRAPHICS;
var dpi: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetDpiX}
function GdipGetDpiY(graphics: GPGRAPHICS;
var dpi: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetDpiY}
function GdipTransformPoints(graphics: GPGRAPHICS;
destSpace: GPCOORDINATESPACE; srcSpace: GPCOORDINATESPACE;
points: GPPOINTF; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTransformPoints}
function GdipTransformPointsI(graphics: GPGRAPHICS;
destSpace: GPCOORDINATESPACE; srcSpace: GPCOORDINATESPACE;
points: GPPOINT; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTransformPointsI}
function GdipGetNearestColor(graphics: GPGRAPHICS;
argb: PARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetNearestColor}
// Creates the Win9x Halftone Palette (even on NT) with correct Desktop colors
function GdipCreateHalftonePalette: HPALETTE; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateHalftonePalette}
function GdipDrawLine(graphics: GPGRAPHICS; pen: GPPEN; x1: Single;
y1: Single; x2: Single; y2: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawLine}
function GdipDrawLineI(graphics: GPGRAPHICS; pen: GPPEN; x1: Integer;
y1: Integer; x2: Integer; y2: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawLineI}
function GdipDrawLines(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawLines}
function GdipDrawLinesI(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawLinesI}
function GdipDrawArc(graphics: GPGRAPHICS; pen: GPPEN; x: Single; y: Single;
width: Single; height: Single; startAngle: Single;
sweepAngle: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawArc}
function GdipDrawArcI(graphics: GPGRAPHICS; pen: GPPEN; x: Integer;
y: Integer; width: Integer; height: Integer; startAngle: Single;
sweepAngle: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawArcI}
function GdipDrawBezier(graphics: GPGRAPHICS; pen: GPPEN; x1: Single;
y1: Single; x2: Single; y2: Single; x3: Single; y3: Single; x4: Single;
y4: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawBezier}
function GdipDrawBezierI(graphics: GPGRAPHICS; pen: GPPEN; x1: Integer;
y1: Integer; x2: Integer; y2: Integer; x3: Integer; y3: Integer;
x4: Integer; y4: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawBezierI}
function GdipDrawBeziers(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawBeziers}
function GdipDrawBeziersI(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawBeziersI}
function GdipDrawRectangle(graphics: GPGRAPHICS; pen: GPPEN; x: Single;
y: Single; width: Single; height: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawRectangle}
function GdipDrawRectangleI(graphics: GPGRAPHICS; pen: GPPEN; x: Integer;
y: Integer; width: Integer; height: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawRectangleI}
function GdipDrawRectangles(graphics: GPGRAPHICS; pen: GPPEN; rects: GPRECTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawRectangles}
function GdipDrawRectanglesI(graphics: GPGRAPHICS; pen: GPPEN; rects: GPRECT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawRectanglesI}
function GdipDrawEllipse(graphics: GPGRAPHICS; pen: GPPEN; x: Single;
y: Single; width: Single; height: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawEllipse}
function GdipDrawEllipseI(graphics: GPGRAPHICS; pen: GPPEN; x: Integer;
y: Integer; width: Integer; height: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawEllipseI}
function GdipDrawPie(graphics: GPGRAPHICS; pen: GPPEN; x: Single; y: Single;
width: Single; height: Single; startAngle: Single;
sweepAngle: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawPie}
function GdipDrawPieI(graphics: GPGRAPHICS; pen: GPPEN; x: Integer;
y: Integer; width: Integer; height: Integer; startAngle: Single;
sweepAngle: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawPieI}
function GdipDrawPolygon(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawPolygon}
function GdipDrawPolygonI(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawPolygonI}
function GdipDrawPath(graphics: GPGRAPHICS; pen: GPPEN;
path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawPath}
function GdipDrawCurve(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINTF;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawCurve}
function GdipDrawCurveI(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINT;
count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawCurveI}
function GdipDrawCurve2(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINTF;
count: Integer; tension: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawCurve2}
function GdipDrawCurve2I(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINT;
count: Integer; tension: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawCurve2I}
function GdipDrawCurve3(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINTF;
count: Integer; offset: Integer; numberOfSegments: Integer;
tension: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawCurve3}
function GdipDrawCurve3I(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINT;
count: Integer; offset: Integer; numberOfSegments: Integer;
tension: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawCurve3I}
function GdipDrawClosedCurve(graphics: GPGRAPHICS; pen: GPPEN;
points: GPPOINTF; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawClosedCurve}
function GdipDrawClosedCurveI(graphics: GPGRAPHICS; pen: GPPEN;
points: GPPOINT; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawClosedCurveI}
function GdipDrawClosedCurve2(graphics: GPGRAPHICS; pen: GPPEN;
points: GPPOINTF; count: Integer; tension: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawClosedCurve2}
function GdipDrawClosedCurve2I(graphics: GPGRAPHICS; pen: GPPEN;
points: GPPOINT; count: Integer; tension: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawClosedCurve2I}
function GdipGraphicsClear(graphics: GPGRAPHICS;
color: ARGB): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGraphicsClear}
function GdipFillRectangle(graphics: GPGRAPHICS; brush: GPBRUSH; x: Single;
y: Single; width: Single; height: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillRectangle}
function GdipFillRectangleI(graphics: GPGRAPHICS; brush: GPBRUSH; x: Integer;
y: Integer; width: Integer; height: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillRectangleI}
function GdipFillRectangles(graphics: GPGRAPHICS; brush: GPBRUSH;
rects: GPRECTF; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillRectangles}
function GdipFillRectanglesI(graphics: GPGRAPHICS; brush: GPBRUSH;
rects: GPRECT; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillRectanglesI}
function GdipFillPolygon(graphics: GPGRAPHICS; brush: GPBRUSH;
points: GPPOINTF; count: Integer; fillMode: GPFILLMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillPolygon}
function GdipFillPolygonI(graphics: GPGRAPHICS; brush: GPBRUSH;
points: GPPOINT; count: Integer; fillMode: GPFILLMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillPolygonI}
function GdipFillPolygon2(graphics: GPGRAPHICS; brush: GPBRUSH;
points: GPPOINTF; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillPolygon2}
function GdipFillPolygon2I(graphics: GPGRAPHICS; brush: GPBRUSH;
points: GPPOINT; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillPolygon2I}
function GdipFillEllipse(graphics: GPGRAPHICS; brush: GPBRUSH; x: Single;
y: Single; width: Single; height: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillEllipse}
function GdipFillEllipseI(graphics: GPGRAPHICS; brush: GPBRUSH; x: Integer;
y: Integer; width: Integer; height: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillEllipseI}
function GdipFillPie(graphics: GPGRAPHICS; brush: GPBRUSH; x: Single;
y: Single; width: Single; height: Single; startAngle: Single;
sweepAngle: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillPie}
function GdipFillPieI(graphics: GPGRAPHICS; brush: GPBRUSH; x: Integer;
y: Integer; width: Integer; height: Integer; startAngle: Single;
sweepAngle: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillPieI}
function GdipFillPath(graphics: GPGRAPHICS; brush: GPBRUSH;
path: GPPATH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillPath}
function GdipFillClosedCurve(graphics: GPGRAPHICS; brush: GPBRUSH;
points: GPPOINTF; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillClosedCurve}
function GdipFillClosedCurveI(graphics: GPGRAPHICS; brush: GPBRUSH;
points: GPPOINT; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillClosedCurveI}
function GdipFillClosedCurve2(graphics: GPGRAPHICS; brush: GPBRUSH;
points: GPPOINTF; count: Integer; tension: Single;
fillMode: GPFILLMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillClosedCurve2}
function GdipFillClosedCurve2I(graphics: GPGRAPHICS; brush: GPBRUSH;
points: GPPOINT; count: Integer; tension: Single;
fillMode: GPFILLMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillClosedCurve2I}
function GdipFillRegion(graphics: GPGRAPHICS; brush: GPBRUSH;
region: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFillRegion}
function GdipDrawImage(graphics: GPGRAPHICS; image: GPIMAGE; x: Single;
y: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawImage}
function GdipDrawImageI(graphics: GPGRAPHICS; image: GPIMAGE; x: Integer;
y: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawImageI}
function GdipDrawImageRect(graphics: GPGRAPHICS; image: GPIMAGE; x: Single;
y: Single; width: Single; height: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawImageRect}
function GdipDrawImageRectI(graphics: GPGRAPHICS; image: GPIMAGE; x: Integer;
y: Integer; width: Integer; height: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawImageRectI}
function GdipDrawImagePoints(graphics: GPGRAPHICS; image: GPIMAGE;
dstpoints: GPPOINTF; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawImagePoints}
function GdipDrawImagePointsI(graphics: GPGRAPHICS; image: GPIMAGE;
dstpoints: GPPOINT; count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawImagePointsI}
function GdipDrawImagePointRect(graphics: GPGRAPHICS; image: GPIMAGE;
x: Single; y: Single; srcx: Single; srcy: Single; srcwidth: Single;
srcheight: Single; srcUnit: GPUNIT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawImagePointRect}
function GdipDrawImagePointRectI(graphics: GPGRAPHICS; image: GPIMAGE;
x: Integer; y: Integer; srcx: Integer; srcy: Integer; srcwidth: Integer;
srcheight: Integer; srcUnit: GPUNIT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawImagePointRectI}
function GdipDrawImageRectRect(graphics: GPGRAPHICS; image: GPIMAGE;
dstx: Single; dsty: Single; dstwidth: Single; dstheight: Single;
srcx: Single; srcy: Single; srcwidth: Single; srcheight: Single;
srcUnit: GPUNIT; imageAttributes: GPIMAGEATTRIBUTES;
callback: DRAWIMAGEABORT; callbackData: Pointer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawImageRectRect}
function GdipDrawImageRectRectI(graphics: GPGRAPHICS; image: GPIMAGE;
dstx: Integer; dsty: Integer; dstwidth: Integer; dstheight: Integer;
srcx: Integer; srcy: Integer; srcwidth: Integer; srcheight: Integer;
srcUnit: GPUNIT; imageAttributes: GPIMAGEATTRIBUTES;
callback: DRAWIMAGEABORT; callbackData: Pointer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawImageRectRectI}
function GdipDrawImagePointsRect(graphics: GPGRAPHICS; image: GPIMAGE;
points: GPPOINTF; count: Integer; srcx: Single; srcy: Single;
srcwidth: Single; srcheight: Single; srcUnit: GPUNIT;
imageAttributes: GPIMAGEATTRIBUTES; callback: DRAWIMAGEABORT;
callbackData: Pointer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawImagePointsRect}
function GdipDrawImagePointsRectI(graphics: GPGRAPHICS; image: GPIMAGE;
points: GPPOINT; count: Integer; srcx: Integer; srcy: Integer;
srcwidth: Integer; srcheight: Integer; srcUnit: GPUNIT;
imageAttributes: GPIMAGEATTRIBUTES; callback: DRAWIMAGEABORT;
callbackData: Pointer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawImagePointsRectI}
function GdipEnumerateMetafileDestPoint(graphics: GPGRAPHICS;
metafile: GPMETAFILE; destPoint: PPOINTF; callback: ENUMERATEMETAFILEPROC;
callbackData: Pointer;
imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEnumerateMetafileDestPoint}
function GdipEnumerateMetafileDestPointI(graphics: GPGRAPHICS;
metafile: GPMETAFILE; destPoint: PPOINT; callback: ENUMERATEMETAFILEPROC;
callbackData: Pointer;
imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEnumerateMetafileDestPointI}
function GdipEnumerateMetafileDestRect(graphics: GPGRAPHICS;
metafile: GPMETAFILE; destRect: PRECTF; callback: ENUMERATEMETAFILEPROC;
callbackData: Pointer;
imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEnumerateMetafileDestRect}
function GdipEnumerateMetafileDestRectI(graphics: GPGRAPHICS;
metafile: GPMETAFILE; destRect: PRECT; callback: ENUMERATEMETAFILEPROC;
callbackData: Pointer;
imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEnumerateMetafileDestRectI}
function GdipEnumerateMetafileDestPoints(graphics: GPGRAPHICS;
metafile: GPMETAFILE; destPoints: PPOINTF; count: Integer;
callback: ENUMERATEMETAFILEPROC; callbackData: Pointer;
imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEnumerateMetafileDestPoints}
function GdipEnumerateMetafileDestPointsI(graphics: GPGRAPHICS;
metafile: GPMETAFILE; destPoints: PPOINT; count: Integer;
callback: ENUMERATEMETAFILEPROC; callbackData: Pointer;
imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEnumerateMetafileDestPointsI}
function GdipEnumerateMetafileSrcRectDestPoint(graphics: GPGRAPHICS;
metafile: GPMETAFILE; destPoint: PPOINTF; srcRect: PRECTF; srcUnit: TUNIT;
callback: ENUMERATEMETAFILEPROC; callbackData: Pointer;
imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEnumerateMetafileSrcRectDestPoint}
function GdipEnumerateMetafileSrcRectDestPointI(graphics: GPGRAPHICS;
metafile: GPMETAFILE; destPoint: PPOINT; srcRect: PRECT; srcUnit: TUNIT;
callback: ENUMERATEMETAFILEPROC; callbackData: Pointer;
imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEnumerateMetafileSrcRectDestPointI}
function GdipEnumerateMetafileSrcRectDestRect(graphics: GPGRAPHICS;
metafile: GPMETAFILE; destRect: PRECTF; srcRect: PRECTF; srcUnit: TUNIT;
callback: ENUMERATEMETAFILEPROC; callbackData: Pointer;
imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEnumerateMetafileSrcRectDestRect}
function GdipEnumerateMetafileSrcRectDestRectI(graphics: GPGRAPHICS;
metafile: GPMETAFILE; destRect: PRECT; srcRect: PRECT; srcUnit: TUNIT;
callback: ENUMERATEMETAFILEPROC; callbackData: Pointer;
imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEnumerateMetafileSrcRectDestRectI}
function GdipEnumerateMetafileSrcRectDestPoints(graphics: GPGRAPHICS;
metafile: GPMETAFILE; destPoints: PPOINTF; count: Integer; srcRect: PRECTF;
srcUnit: TUNIT; callback: ENUMERATEMETAFILEPROC; callbackData: Pointer;
imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEnumerateMetafileSrcRectDestPoints}
function GdipEnumerateMetafileSrcRectDestPointsI(graphics: GPGRAPHICS;
metafile: GPMETAFILE; destPoints: PPOINT; count: Integer; srcRect: PRECT;
srcUnit: TUNIT; callback: ENUMERATEMETAFILEPROC; callbackData: Pointer;
imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEnumerateMetafileSrcRectDestPointsI}
function GdipPlayMetafileRecord(metafile: GPMETAFILE;
recordType: EMFPLUSRECORDTYPE; flags: UINT; dataSize: UINT;
data: PBYTE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPlayMetafileRecord}
function GdipSetClipGraphics(graphics: GPGRAPHICS; srcgraphics: GPGRAPHICS;
combineMode: COMBINEMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetClipGraphics}
function GdipSetClipRect(graphics: GPGRAPHICS; x: Single; y: Single;
width: Single; height: Single; combineMode: COMBINEMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetClipRect}
function GdipSetClipRectI(graphics: GPGRAPHICS; x: Integer; y: Integer;
width: Integer; height: Integer;
combineMode: COMBINEMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetClipRectI}
function GdipSetClipPath(graphics: GPGRAPHICS; path: GPPATH;
combineMode: COMBINEMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetClipPath}
function GdipSetClipRegion(graphics: GPGRAPHICS; region: GPREGION;
combineMode: COMBINEMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetClipRegion}
function GdipSetClipHrgn(graphics: GPGRAPHICS; hRgn: HRGN;
combineMode: COMBINEMODE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetClipHrgn}
function GdipResetClip(graphics: GPGRAPHICS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipResetClip}
function GdipTranslateClip(graphics: GPGRAPHICS; dx: Single;
dy: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTranslateClip}
function GdipTranslateClipI(graphics: GPGRAPHICS; dx: Integer;
dy: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipTranslateClipI}
function GdipGetClip(graphics: GPGRAPHICS;
region: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetClip}
function GdipGetClipBounds(graphics: GPGRAPHICS;
rect: GPRECTF): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetClipBounds}
function GdipGetClipBoundsI(graphics: GPGRAPHICS;
rect: GPRECT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetClipBoundsI}
function GdipIsClipEmpty(graphics: GPGRAPHICS;
result: PBool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsClipEmpty}
function GdipGetVisibleClipBounds(graphics: GPGRAPHICS;
rect: GPRECTF): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetVisibleClipBounds}
function GdipGetVisibleClipBoundsI(graphics: GPGRAPHICS;
rect: GPRECT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetVisibleClipBoundsI}
function GdipIsVisibleClipEmpty(graphics: GPGRAPHICS;
var result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsVisibleClipEmpty}
function GdipIsVisiblePoint(graphics: GPGRAPHICS; x: Single; y: Single;
var result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsVisiblePoint}
function GdipIsVisiblePointI(graphics: GPGRAPHICS; x: Integer; y: Integer;
var result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsVisiblePointI}
function GdipIsVisibleRect(graphics: GPGRAPHICS; x: Single; y: Single;
width: Single; height: Single; var result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsVisibleRect}
function GdipIsVisibleRectI(graphics: GPGRAPHICS; x: Integer; y: Integer;
width: Integer; height: Integer; var result: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsVisibleRectI}
function GdipSaveGraphics(graphics: GPGRAPHICS;
var state: GRAPHICSSTATE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSaveGraphics}
function GdipRestoreGraphics(graphics: GPGRAPHICS;
state: GRAPHICSSTATE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRestoreGraphics}
function GdipBeginContainer(graphics: GPGRAPHICS; dstrect: GPRECTF;
srcrect: GPRECTF; unit_: GPUNIT;
var state: GRAPHICSCONTAINER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipBeginContainer}
function GdipBeginContainerI(graphics: GPGRAPHICS; dstrect: GPRECT;
srcrect: GPRECT; unit_: GPUNIT;
var state: GRAPHICSCONTAINER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipBeginContainerI}
function GdipBeginContainer2(graphics: GPGRAPHICS;
var state: GRAPHICSCONTAINER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipBeginContainer2}
function GdipEndContainer(graphics: GPGRAPHICS;
state: GRAPHICSCONTAINER): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEndContainer}
function GdipGetMetafileHeaderFromWmf(hWmf: HMETAFILE;
wmfPlaceableFileHeader: PWMFPLACEABLEFILEHEADER;
header: Pointer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetMetafileHeaderFromWmf}
function GdipGetMetafileHeaderFromEmf(hEmf: HENHMETAFILE;
header: Pointer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetMetafileHeaderFromEmf}
function GdipGetMetafileHeaderFromFile(filename: PWCHAR;
header: Pointer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetMetafileHeaderFromFile}
function GdipGetMetafileHeaderFromStream(stream: ISTREAM;
header: Pointer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetMetafileHeaderFromStream}
function GdipGetMetafileHeaderFromMetafile(metafile: GPMETAFILE;
header: Pointer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetMetafileHeaderFromMetafile}
function GdipGetHemfFromMetafile(metafile: GPMETAFILE;
var hEmf: HENHMETAFILE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetHemfFromMetafile}
function GdipCreateStreamOnFile(filename: PWCHAR; access: UINT;
out stream: ISTREAM): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateStreamOnFile}
function GdipCreateMetafileFromWmf(hWmf: HMETAFILE; deleteWmf: Bool;
wmfPlaceableFileHeader: PWMFPLACEABLEFILEHEADER;
out metafile: GPMETAFILE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateMetafileFromWmf}
function GdipCreateMetafileFromEmf(hEmf: HENHMETAFILE; deleteEmf: Bool;
out metafile: GPMETAFILE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateMetafileFromEmf}
function GdipCreateMetafileFromFile(file_: PWCHAR;
out metafile: GPMETAFILE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateMetafileFromFile}
function GdipCreateMetafileFromWmfFile(file_: PWCHAR;
wmfPlaceableFileHeader: PWMFPLACEABLEFILEHEADER;
out metafile: GPMETAFILE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateMetafileFromWmfFile}
function GdipCreateMetafileFromStream(stream: ISTREAM;
out metafile: GPMETAFILE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateMetafileFromStream}
function GdipRecordMetafile(referenceHdc: HDC; type_: EMFTYPE;
frameRect: GPRECTF; frameUnit: METAFILEFRAMEUNIT;
description: PWCHAR; out metafile: GPMETAFILE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRecordMetafile}
function GdipRecordMetafileI(referenceHdc: HDC; type_: EMFTYPE;
frameRect: GPRECT; frameUnit: METAFILEFRAMEUNIT; description: PWCHAR;
out metafile: GPMETAFILE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRecordMetafileI}
function GdipRecordMetafileFileName(fileName: PWCHAR; referenceHdc: HDC;
type_: EMFTYPE; frameRect: GPRECTF; frameUnit: METAFILEFRAMEUNIT;
description: PWCHAR; out metafile: GPMETAFILE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRecordMetafileFileName}
function GdipRecordMetafileFileNameI(fileName: PWCHAR; referenceHdc: HDC;
type_: EMFTYPE; frameRect: GPRECT; frameUnit: METAFILEFRAMEUNIT;
description: PWCHAR; out metafile: GPMETAFILE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRecordMetafileFileNameI}
function GdipRecordMetafileStream(stream: ISTREAM; referenceHdc: HDC;
type_: EMFTYPE; frameRect: GPRECTF; frameUnit: METAFILEFRAMEUNIT;
description: PWCHAR; out metafile: GPMETAFILE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRecordMetafileStream}
function GdipRecordMetafileStreamI(stream: ISTREAM; referenceHdc: HDC;
type_: EMFTYPE; frameRect: GPRECT; frameUnit: METAFILEFRAMEUNIT;
description: PWCHAR; out metafile: GPMETAFILE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipRecordMetafileStreamI}
function GdipSetMetafileDownLevelRasterizationLimit(metafile: GPMETAFILE;
metafileRasterizationLimitDpi: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetMetafileDownLevelRasterizationLimit}
function GdipGetMetafileDownLevelRasterizationLimit(metafile: GPMETAFILE;
var metafileRasterizationLimitDpi: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetMetafileDownLevelRasterizationLimit}
function GdipGetImageDecodersSize(out numDecoders: UINT;
out size: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageDecodersSize}
function GdipGetImageDecoders(numDecoders: UINT; size: UINT;
decoders: PIMAGECODECINFO): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageDecoders}
function GdipGetImageEncodersSize(out numEncoders: UINT;
out size: UINT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageEncodersSize}
function GdipGetImageEncoders(numEncoders: UINT; size: UINT;
encoders: PIMAGECODECINFO): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetImageEncoders}
function GdipComment(graphics: GPGRAPHICS; sizeData: UINT;
data: PBYTE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipComment}
//----------------------------------------------------------------------------
// FontFamily APIs
//----------------------------------------------------------------------------
function GdipCreateFontFamilyFromName(name: PWCHAR;
fontCollection: GPFONTCOLLECTION;
out FontFamily: GPFONTFAMILY): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateFontFamilyFromName}
function GdipDeleteFontFamily(FontFamily: GPFONTFAMILY): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeleteFontFamily}
function GdipCloneFontFamily(FontFamily: GPFONTFAMILY;
out clonedFontFamily: GPFONTFAMILY): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCloneFontFamily}
function GdipGetGenericFontFamilySansSerif(
out nativeFamily: GPFONTFAMILY): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetGenericFontFamilySansSerif}
function GdipGetGenericFontFamilySerif(
out nativeFamily: GPFONTFAMILY): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetGenericFontFamilySerif}
function GdipGetGenericFontFamilyMonospace(
out nativeFamily: GPFONTFAMILY): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetGenericFontFamilyMonospace}
function GdipGetFamilyName(family: GPFONTFAMILY; name: PWideChar;
language: LANGID): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetFamilyName}
function GdipIsStyleAvailable(family: GPFONTFAMILY; style: Integer;
var IsStyleAvailable: Bool): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipIsStyleAvailable}
function GdipFontCollectionEnumerable(fontCollection: GPFONTCOLLECTION;
graphics: GPGRAPHICS; var numFound: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFontCollectionEnumerable}
function GdipFontCollectionEnumerate(fontCollection: GPFONTCOLLECTION;
numSought: Integer; gpfamilies: array of GPFONTFAMILY;
var numFound: Integer; graphics: GPGRAPHICS): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipFontCollectionEnumerate}
function GdipGetEmHeight(family: GPFONTFAMILY; style: Integer;
out EmHeight: UINT16): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetEmHeight}
function GdipGetCellAscent(family: GPFONTFAMILY; style: Integer;
var CellAscent: UINT16): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetCellAscent}
function GdipGetCellDescent(family: GPFONTFAMILY; style: Integer;
var CellDescent: UINT16): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetCellDescent}
function GdipGetLineSpacing(family: GPFONTFAMILY; style: Integer;
var LineSpacing: UINT16): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLineSpacing}
//----------------------------------------------------------------------------
// Font APIs
//----------------------------------------------------------------------------
function GdipCreateFontFromDC(hdc: HDC; out font: GPFONT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateFontFromDC}
function GdipCreateFontFromLogfontA(hdc: HDC; logfont: PLOGFONTA;
out font: GPFONT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateFontFromLogfontA}
function GdipCreateFontFromLogfontW(hdc: HDC; logfont: PLOGFONTW;
out font: GPFONT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateFontFromLogfontW}
function GdipCreateFont(fontFamily: GPFONTFAMILY; emSize: Single;
style: Integer; unit_: Integer; out font: GPFONT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateFont}
function GdipCloneFont(font: GPFONT;
out cloneFont: GPFONT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCloneFont}
function GdipDeleteFont(font: GPFONT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeleteFont}
function GdipGetFamily(font: GPFONT;
out family: GPFONTFAMILY): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetFamily}
function GdipGetFontStyle(font: GPFONT;
var style: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetFontStyle}
function GdipGetFontSize(font: GPFONT; var size: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetFontSize}
function GdipGetFontUnit(font: GPFONT; var unit_: TUNIT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetFontUnit}
function GdipGetFontHeight(font: GPFONT; graphics: GPGRAPHICS;
var height: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetFontHeight}
function GdipGetFontHeightGivenDPI(font: GPFONT; dpi: Single;
var height: Single): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetFontHeightGivenDPI}
function GdipGetLogFontA(font: GPFONT; graphics: GPGRAPHICS;
var logfontA: LOGFONTA): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLogFontA}
function GdipGetLogFontW(font: GPFONT; graphics: GPGRAPHICS;
var logfontW: LOGFONTW): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetLogFontW}
function GdipNewInstalledFontCollection(
out fontCollection: GPFONTCOLLECTION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipNewInstalledFontCollection}
function GdipNewPrivateFontCollection(
out fontCollection: GPFONTCOLLECTION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipNewPrivateFontCollection}
function GdipDeletePrivateFontCollection(
out fontCollection: GPFONTCOLLECTION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeletePrivateFontCollection}
function GdipGetFontCollectionFamilyCount(fontCollection: GPFONTCOLLECTION;
var numFound: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetFontCollectionFamilyCount}
function GdipGetFontCollectionFamilyList(fontCollection: GPFONTCOLLECTION;
numSought: Integer; gpfamilies: GPFONTFAMILY;
var numFound: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetFontCollectionFamilyList}
function GdipPrivateAddFontFile(fontCollection: GPFONTCOLLECTION;
filename: PWCHAR): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPrivateAddFontFile}
function GdipPrivateAddMemoryFont(fontCollection: GPFONTCOLLECTION;
memory: Pointer; length: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipPrivateAddMemoryFont}
//----------------------------------------------------------------------------
// Text APIs
//----------------------------------------------------------------------------
function GdipDrawString(graphics: GPGRAPHICS; string_: PWCHAR;
length: Integer; font: GPFONT; layoutRect: PRECTF;
stringFormat: GPSTRINGFORMAT; brush: GPBRUSH): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawString}
function GdipMeasureString(graphics: GPGRAPHICS; string_: PWCHAR;
length: Integer; font: GPFONT; layoutRect: PRECTF;
stringFormat: GPSTRINGFORMAT; boundingBox: PRECTF;
codepointsFitted: PInteger; linesFilled: PInteger): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipMeasureString}
function GdipMeasureCharacterRanges(graphics: GPGRAPHICS; string_: PWCHAR;
length: Integer; font: GPFONT; layoutRect: PRECTF;
stringFormat: GPSTRINGFORMAT; regionCount: Integer;
const regions: GPREGION): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipMeasureCharacterRanges}
function GdipDrawDriverString(graphics: GPGRAPHICS; const text: PUINT16;
length: Integer; const font: GPFONT; const brush: GPBRUSH;
const positions: PPOINTF; flags: Integer;
const matrix: GPMATRIX): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawDriverString}
function GdipMeasureDriverString(graphics: GPGRAPHICS; text: PUINT16;
length: Integer; font: GPFONT; positions: PPOINTF; flags: Integer;
matrix: GPMATRIX; boundingBox: PRECTF): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipMeasureDriverString}
//----------------------------------------------------------------------------
// String format APIs
//----------------------------------------------------------------------------
function GdipCreateStringFormat(formatAttributes: Integer; language: LANGID;
out format: GPSTRINGFORMAT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateStringFormat}
function GdipStringFormatGetGenericDefault(
out format: GPSTRINGFORMAT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipStringFormatGetGenericDefault}
function GdipStringFormatGetGenericTypographic(
out format: GPSTRINGFORMAT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipStringFormatGetGenericTypographic}
function GdipDeleteStringFormat(format: GPSTRINGFORMAT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeleteStringFormat}
function GdipCloneStringFormat(format: GPSTRINGFORMAT;
out newFormat: GPSTRINGFORMAT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCloneStringFormat}
function GdipSetStringFormatFlags(format: GPSTRINGFORMAT;
flags: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetStringFormatFlags}
function GdipGetStringFormatFlags(format: GPSTRINGFORMAT;
out flags: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetStringFormatFlags}
function GdipSetStringFormatAlign(format: GPSTRINGFORMAT;
align: STRINGALIGNMENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetStringFormatAlign}
function GdipGetStringFormatAlign(format: GPSTRINGFORMAT;
out align: STRINGALIGNMENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetStringFormatAlign}
function GdipSetStringFormatLineAlign(format: GPSTRINGFORMAT;
align: STRINGALIGNMENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetStringFormatLineAlign}
function GdipGetStringFormatLineAlign(format: GPSTRINGFORMAT;
out align: STRINGALIGNMENT): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetStringFormatLineAlign}
function GdipSetStringFormatTrimming(format: GPSTRINGFORMAT;
trimming: STRINGTRIMMING): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetStringFormatTrimming}
function GdipGetStringFormatTrimming(format: GPSTRINGFORMAT;
out trimming: STRINGTRIMMING): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetStringFormatTrimming}
function GdipSetStringFormatHotkeyPrefix(format: GPSTRINGFORMAT;
hotkeyPrefix: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetStringFormatHotkeyPrefix}
function GdipGetStringFormatHotkeyPrefix(format: GPSTRINGFORMAT;
out hotkeyPrefix: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetStringFormatHotkeyPrefix}
function GdipSetStringFormatTabStops(format: GPSTRINGFORMAT;
firstTabOffset: Single; count: Integer;
tabStops: PSingle): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetStringFormatTabStops}
function GdipGetStringFormatTabStops(format: GPSTRINGFORMAT;
count: Integer; firstTabOffset: PSingle;
tabStops: PSingle): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetStringFormatTabStops}
function GdipGetStringFormatTabStopCount(format: GPSTRINGFORMAT;
out count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetStringFormatTabStopCount}
function GdipSetStringFormatDigitSubstitution(format: GPSTRINGFORMAT;
language: LANGID;
substitute: STRINGDIGITSUBSTITUTE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetStringFormatDigitSubstitution}
function GdipGetStringFormatDigitSubstitution(format: GPSTRINGFORMAT;
language: PUINT; substitute: PSTRINGDIGITSUBSTITUTE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetStringFormatDigitSubstitution}
function GdipGetStringFormatMeasurableCharacterRangeCount(format: GPSTRINGFORMAT;
out count: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipGetStringFormatMeasurableCharacterRangeCount}
function GdipSetStringFormatMeasurableCharacterRanges(format: GPSTRINGFORMAT;
rangeCount: Integer; ranges: PCHARACTERRANGE): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipSetStringFormatMeasurableCharacterRanges}
//----------------------------------------------------------------------------
// Cached Bitmap APIs
//----------------------------------------------------------------------------
function GdipCreateCachedBitmap(bitmap: GPBITMAP; graphics: GPGRAPHICS;
out cachedBitmap: GPCACHEDBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipCreateCachedBitmap}
function GdipDeleteCachedBitmap(
cachedBitmap: GPCACHEDBITMAP): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDeleteCachedBitmap}
function GdipDrawCachedBitmap(graphics: GPGRAPHICS;
cachedBitmap: GPCACHEDBITMAP; x: Integer;
y: Integer): GPSTATUS; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipDrawCachedBitmap}
function GdipEmfToWmfBits(hemf: HENHMETAFILE; cbData16: UINT; pData16: PBYTE;
iMapMode: Integer; eFlags: Integer): UINT; stdcall; external 'gdiplus.dll';
{$EXTERNALSYM GdipEmfToWmfBits}
implementation
// -----------------------------------------------------------------------------
// TGdiplusBase class
// -----------------------------------------------------------------------------
class function TGdiplusBase.NewInstance: TObject;
begin
Result := InitInstance(GdipAlloc(ULONG(instanceSize)));
end;
procedure TGdiplusBase.FreeInstance;
begin
CleanupInstance;
GdipFree(Self);
end;
// -----------------------------------------------------------------------------
// macros
// -----------------------------------------------------------------------------
function ObjectTypeIsValid(type_: ObjectType): BOOL;
begin
result := ((type_ >= ObjectTypeMin) and (type_ <= ObjectTypeMax));
end;
function GDIP_WMF_RECORD_TO_EMFPLUS(n: integer): Integer;
begin
result := (n or GDIP_WMF_RECORD_BASE);
end;
function GDIP_EMFPLUS_RECORD_TO_WMF(n: integer): Integer;
begin
result := n and (not GDIP_WMF_RECORD_BASE);
end;
function GDIP_IS_WMF_RECORDTYPE(n: integer): BOOL;
begin
result := ((n and GDIP_WMF_RECORD_BASE) <> 0);
end;
//--------------------------------------------------------------------------
// TPoint Util
//--------------------------------------------------------------------------
function MakePoint(X, Y: Integer): TPoint;
begin
result.X := X;
result.Y := Y;
end;
function MakePoint(X, Y: Single): TPointF;
begin
Result.X := X;
result.Y := Y;
end;
//--------------------------------------------------------------------------
// TSize Util
//--------------------------------------------------------------------------
function MakeSize(Width, Height: Single): TSizeF;
begin
result.Width := Width;
result.Height := Height;
end;
function MakeSize(Width, Height: Integer): TSize;
begin
result.Width := Width;
result.Height := Height;
end;
//--------------------------------------------------------------------------
// TCharacterRange Util
//--------------------------------------------------------------------------
function MakeCharacterRange(First, Length: Integer): TCharacterRange;
begin
result.First := First;
result.Length := Length;
end;
// -----------------------------------------------------------------------------
// RectF class
// -----------------------------------------------------------------------------
function MakeRect(x, y, width, height: Single): TRectF; overload;
begin
Result.X := x;
Result.Y := y;
Result.Width := width;
Result.Height := height;
end;
function MakeRect(location: TPointF; size: TSizeF): TRectF; overload;
begin
Result.X := location.X;
Result.Y := location.Y;
Result.Width := size.Width;
Result.Height := size.Height;
end;
// -----------------------------------------------------------------------------
// Rect class
// -----------------------------------------------------------------------------
function MakeRect(x, y, width, height: Integer): TRect; overload;
begin
Result.X := x;
Result.Y := y;
Result.Width := width;
Result.Height := height;
end;
function MakeRect(location: TPoint; size: TSize): Trect; overload;
begin
Result.X := location.X;
Result.Y := location.Y;
Result.Width := size.Width;
Result.Height := size.Height;
end;
// -----------------------------------------------------------------------------
// PathData class
// -----------------------------------------------------------------------------
constructor TPathData.Create;
begin
Count := 0;
Points := nil;
Types := nil;
end;
destructor TPathData.destroy;
begin
if assigned(Points) then freemem(Points);
if assigned(Types) then freemem(Types);
end;
function GetPixelFormatSize(pixfmt: PixelFormat): UINT;
begin
result := (pixfmt shr 8) and $ff;
end;
function IsIndexedPixelFormat(pixfmt: PixelFormat): BOOL;
begin
result := (pixfmt and PixelFormatIndexed) <> 0;
end;
function IsAlphaPixelFormat(pixfmt: PixelFormat): BOOL;
begin
result := (pixfmt and PixelFormatAlpha) <> 0;
end;
function IsExtendedPixelFormat(pixfmt: PixelFormat): BOOL;
begin
result := (pixfmt and PixelFormatExtended) <> 0;
end;
function IsCanonicalPixelFormat(pixfmt: PixelFormat): BOOL;
begin
result := (pixfmt and PixelFormatCanonical) <> 0;
end;
// -----------------------------------------------------------------------------
// Color class
// -----------------------------------------------------------------------------
{ constructor TColor.Create;
begin
Argb := DWORD(Black);
end;
// Construct an opaque Color object with
// the specified Red, Green, Blue values.
//
// Color values are not premultiplied.
constructor TColor.Create(r, g, b: Byte);
begin
Argb := MakeARGB(255, r, g, b);
end;
constructor TColor.Create(a, r, g, b: Byte);
begin
Argb := MakeARGB(a, r, g, b);
end;
constructor TColor.Create(Value: ARGB);
begin
Argb := Value;
end;
function TColor.GetAlpha: BYTE;
begin
result := BYTE(Argb shr AlphaShift);
end;
function TColor.GetA: BYTE;
begin
result := GetAlpha;
end;
function TColor.GetRed: BYTE;
begin
result := BYTE(Argb shr RedShift);
end;
function TColor.GetR: BYTE;
begin
result := GetRed;
end;
function TColor.GetGreen: Byte;
begin
result := BYTE(Argb shr GreenShift);
end;
function TColor.GetG: Byte;
begin
result := GetGreen;
end;
function TColor.GetBlue: Byte;
begin
result := BYTE(Argb shr BlueShift);
end;
function TColor.GetB: Byte;
begin
result := GetBlue;
end;
function TColor.GetValue: ARGB;
begin
result := Argb;
end;
procedure TColor.SetValue(Value: ARGB);
begin
Argb := Value;
end;
procedure TColor.SetFromCOLORREF(rgb: COLORREF);
begin
Argb := MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
end;
function TColor.ToCOLORREF: COLORREF;
begin
result := RGB(GetRed, GetGreen, GetBlue);
end;
function TColor.MakeARGB(a, r, g, b: Byte): ARGB;
begin
result := ((DWORD(b) shl BlueShift) or
(DWORD(g) shl GreenShift) or
(DWORD(r) shl RedShift) or
(DWORD(a) shl AlphaShift));
end; }
function MakeColor(r, g, b: Byte): ARGB; overload;
begin
result := MakeColor(255, r, g, b);
end;
function MakeColor(a, r, g, b: Byte): ARGB; overload;
begin
result := ((DWORD(b) shl BlueShift) or
(DWORD(g) shl GreenShift) or
(DWORD(r) shl RedShift) or
(DWORD(a) shl AlphaShift));
end;
function GetAlpha(color: ARGB): BYTE;
begin
result := BYTE(color shr AlphaShift);
end;
function GetRed(color: ARGB): BYTE;
begin
result := BYTE(color shr RedShift);
end;
function GetGreen(color: ARGB): BYTE;
begin
result := BYTE(color shr GreenShift);
end;
function GetBlue(color: ARGB): BYTE;
begin
result := BYTE(color shr BlueShift);
end;
function ColorRefToARGB(rgb: COLORREF): ARGB;
begin
result := MakeColor(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
end;
function ARGBToColorRef(Color: ARGB): COLORREF;
begin
result := RGB(GetRed(Color), GetGreen(Color), GetBlue(Color));
end;
// -----------------------------------------------------------------------------
// MetafileHeader class
// -----------------------------------------------------------------------------
procedure TMetafileHeader.GetBounds(out Rect: Trect);
begin
rect.X := X;
rect.Y := Y;
rect.Width := Width;
rect.Height := Height;
end;
function TMetafileHeader.IsWmf: BOOL;
begin
result := ((Type_ = MetafileTypeWmf) or (Type_ = MetafileTypeWmfPlaceable));
end;
function TMetafileHeader.IsWmfPlaceable: BOOL;
begin
result := (Type_ = MetafileTypeWmfPlaceable);
end;
function TMetafileHeader.IsEmf: BOOL;
begin
result := (Type_ = MetafileTypeEmf);
end;
function TMetafileHeader.IsEmfOrEmfPlus: BOOL;
begin
result := (Type_ >= MetafileTypeEmf);
end;
function TMetafileHeader.IsEmfPlus: BOOL;
begin
result := (Type_ >= MetafileTypeEmfPlusOnly)
end;
function TMetafileHeader.IsEmfPlusDual: BOOL;
begin
result := (Type_ = MetafileTypeEmfPlusDual)
end;
function TMetafileHeader.IsEmfPlusOnly: BOOL;
begin
result := (Type_ = MetafileTypeEmfPlusOnly)
end;
function TMetafileHeader.IsDisplay: BOOL;
begin
result := (IsEmfPlus and ((EmfPlusFlags and GDIP_EMFPLUSFLAGS_DISPLAY) <> 0));
end;
function TMetafileHeader.GetWmfHeader: PMetaHeader;
begin
if IsWmf then result := @Header.WmfHeader
else result := nil;
end;
function TMetafileHeader.GetEmfHeader: PENHMETAHEADER3;
begin
if IsEmfOrEmfPlus then result := @Header.EmfHeader
else result := nil;
end;
end.
| 40.974754 | 117 | 0.66484 |
83544377dd3dda066a7466b1e54249da7cbaf268 | 9,803 | pas | Pascal | pas/bridge.pas | tdmurtmub/quick_bridge_win32 | 116faca9de7ebfe6bce343ff9c74a0dc23c9cdbb | [
"MIT"
]
| null | null | null | pas/bridge.pas | tdmurtmub/quick_bridge_win32 | 116faca9de7ebfe6bce343ff9c74a0dc23c9cdbb | [
"MIT"
]
| null | null | null | pas/bridge.pas | tdmurtmub/quick_bridge_win32 | 116faca9de7ebfe6bce343ff9c74a0dc23c9cdbb | [
"MIT"
]
| null | null | null | // (C) 2005 Wesley Steiner
{$MODE FPC}
unit bridge;
{$I std.inc}
interface
uses
std;
const
NORTH=0;
EAST=1;
SOUTH=2;
WEST=3;
NOT_DOUBLED=0;
DOUBLED=1;
REDOUBLED=2;
type
teamId=(WE,THEY);
gameIndex=1..3;
playerType=NORTH..WEST;
trumptype=(TTCLUB,TTDIAMOND,TTHEART,TTSPADE,TTNT);
doublingStatus=NOT_DOUBLED..REDOUBLED;
contractLevel=1..7;
lengthtype=0..13;
type
ScoreType=record
GameRecord:array[gameIndex] of integer;
OverLine:integer;
m_nGamesWon:integer; { not persisted }
end;
ScoreKeeper=object
constructor Construct;
constructor ConstructFromData(data:ansistring);
function IsBlank:boolean;
function CurrentGameIndex:gameIndex;
function GameOver:boolean;
function GamesPlayed:word;
function GameScore(team:teamId;n:gameIndex):word;
function GamesWon(team:teamId):word;
function OverLineScoreCount(team:teamId):quantity;
function OverlineTotal(team:teamId):word;
function TeamTotal(team:teamId):word;
function ToString:ansistring;
function WonRubber(team:teamId):boolean;
procedure AddResult(team:teamId;level:contractLevel;trump:trumpType;doubling:doublingStatus;nMade:lengthType);
procedure Clear;
procedure FromData(data:ansistring);
procedure OnCleared; virtual;
procedure OnAdded; virtual;
test_private
my_data:array[teamId] of ScoreType;
as_string:ansistring;
function GameWon(aGameIndex:gameIndex):boolean;
procedure DoAddResult(team:teamId;level:contractLevel;trump:trumpType;doubling:doublingStatus;nMade:lengthType);
procedure DoClear;
end;
implementation
uses
{$ifdef TEST} bridgeTests, {$endif}
sysutils,strutils;
const
BOOK_SIZE=6;
MINOR_TRICK_POINTS=20;
MAJOR_TRICK_POINTS=30;
FIRST_NT_TRICK_POINTS=40;
NEXT_NT_TRICK_POINTS=30;
GAME_POINTS=100;
procedure ScoreKeeper.DoClear;
begin
FillChar(my_data,SizeOf(my_data),chr(0));
as_string:='';
end;
procedure ScoreKeeper.Clear;
begin
DoClear;
OnCleared;
end;
procedure ScoreKeeper.OnCleared;
begin
PlaceHolder;
end;
function ScoreKeeper.IsBlank:boolean;
begin
IsBlank:=(TeamTotal(WE)=0) and (TeamTotal(THEY)=0);
end;
function ScoreKeeper.OverlineTotal(team:teamId):word;
begin
OverlineTotal:=my_data[team].Overline
end;
function ScoreKeeper.GameScore(team:teamId;n:gameIndex):word;
begin
GameScore:=my_data[team].GameRecord[n]
end;
function ScoreKeeper.GamesWon(team:teamId):word;
var
aCount:word;
aGameIndex:gameIndex;
begin
aCount:= 0;
for aGameIndex:=Low(gameIndex) to High(gameIndex) do if GameScore(team, aGameIndex)>=100 then Inc(aCount);
GamesWon:=aCount;
end;
function ScoreKeeper.GameWon(aGameIndex:gameIndex):boolean;
begin
GameWon:=
(my_data[WE].GameRecord[aGameIndex] >= GAME_POINTS)
or
(my_data[THEY].GameRecord[aGameIndex] >= GAME_POINTS);
end;
function ScoreKeeper.GamesPlayed:word;
var
aGameIndex:gameIndex;
aPlayedCount:word;
begin
aPlayedCount:= 0;
for aGameIndex:= Low(gameIndex) to High(gameIndex) do begin
if GameWon(aGameIndex) then Inc(aPlayedCount);
end;
GamesPlayed:= aPlayedCount;
end;
function ScoreKeeper.CurrentGameIndex:gameIndex;
begin
CurrentGameIndex:=GamesPlayed+1;
end;
function ScoreKeeper.GameOver:boolean;
begin
GameOver:= (GamesWon(WE) > 1) or (GamesWon(THEY) > 1);
end;
function ScoreKeeper.TeamTotal(team:teamId):word;
function GameTotal(team:teamId):word;
begin
GameTotal:= GameScore(team, 1) + GameScore(team, 2) + GameScore(team, 3);
end;
begin
TeamTotal:= OverlineTotal(team) + GameTotal(team);
end;
constructor ScoreKeeper.Construct;
begin
DoClear;
end;
function ScoreKeeper.WonRubber(team:teamId):boolean;
begin
WonRubber:=GamesWon(team)>1;
end;
procedure CalculateScore(var aScoreKeeper:ScoreKeeper;nMade,level:word;double:DoublingStatus;trump:TrumpType;dummy:playerType);
var
aDeclarer, aDefender:ScoreType;
function DefenderPts(vulnerable:boolean;aDblStatus:DoublingStatus):word;
function UnderTricks(nOddTricks:word; nTricksWon:word):integer;
begin
UnderTricks:=BOOK_SIZE+nOddTricks-nTricksWon;
end;
function OverlinePts(aDblStatus:DoublingStatus; nUnderTricks:integer;nNotDbld,nDbldFirst,nDbldNext:word):word;
begin
if aDblStatus=NOT_DOUBLED then
OverlinePts:=nNotDbld*nUnderTricks
else
OverlinePts:=(nDbldFirst+nDbldNext*(nUnderTricks-1))*aDblStatus;
end;
begin
DefenderPts:=OverlinePts(aDblStatus,UnderTricks(level,nMade),Q(vulnerable,100,50), Q(vulnerable,200,100), Q(vulnerable,300,200))
end;
procedure CaseAssign(fromSrc:boolean; var declarer,defender:ScoreType;dummy:playerType);
begin
if fromSrc then case Dummy of
North, South: begin
declarer:= aScoreKeeper.my_data[WE];
defender:= aScoreKeeper.my_data[THEY];
end;
East, West: begin
declarer:= aScoreKeeper.my_data[THEY];
defender:= aScoreKeeper.my_data[WE];
end;
end else case Dummy of
North, South: begin
aScoreKeeper.my_data[WE]:= declarer;
aScoreKeeper.my_data[THEY]:= defender;
end;
East, West: begin
aScoreKeeper.my_data[THEY]:= declarer;
aScoreKeeper.my_data[WE]:= defender;
end;
end;
end;
procedure CalcVulnerabilityPnts(vulnerable:boolean;aTricksWon:word;var W:ScoreType);
begin
if vulnerable then begin
if level=6 then Inc(W.OverLine,750)
else if level=7 then Inc(W.OverLine,1500)
else if double>0 then W.OverLine:=W.OverLine+50+(((aTricksWon-(level+BOOK_SIZE))*100)*(double*2));
end
else begin
if level=6 then Inc(W.OverLine,500)
else if level=7 then Inc(W.OverLine,1000)
else if double>0 then W.OverLine:=W.OverLine+50+(((aTricksWon-(level+BOOK_SIZE))*50)*(double*2));
end;
end;
procedure CalculatePoints(vulnerable:boolean;var W:ScoreType;CurGame:integer);
procedure CaseCalc(Value,CurGame:integer);
begin
if double=0 then begin
W.GameRecord[CurGame]:=W.GameRecord[CurGame] + (level*Value);
W.OverLine:=W.OverLine+((nMade-(level+6)) * Value);
end
else
W.GameRecord[CurGame]:=W.GameRecord[CurGame]+((level*Value)*(double*2));
end;
begin
case Trump of
TTCLUB,TTDIAMOND:CaseCalc(MINOR_TRICK_POINTS, CurGame);
TTHEART,TTSPADE:CaseCalc(MAJOR_TRICK_POINTS, CurGame);
else { No_Trump }
if double=0 then begin
W.GameRecord[CurGame]:=W.GameRecord[CurGame]+FIRST_NT_TRICK_POINTS+((level-1)*NEXT_NT_TRICK_POINTS);
W.OverLine:=W.OverLine+((nMade-6-level)*NEXT_NT_TRICK_POINTS);
end
else begin
W.GameRecord[CurGame]:=W.GameRecord[CurGame]+((FIRST_NT_TRICK_POINTS+((level-1)*NEXT_NT_TRICK_POINTS)) * (double*2));
end
end;
CalcVulnerabilityPnts(vulnerable,nMade,W);
if W.GameRecord[CurGame]>=GAME_POINTS then W.m_nGamesWon:=W.m_nGamesWon+1;
end;
function IsVulnerable(var declarer:ScoreType):boolean;
begin
IsVulnerable:=(declarer.m_nGamesWon>0);
end;
begin { CalculateScore }
CaseAssign(true,aDeclarer,aDefender,dummy);
if nMade>=(BOOK_SIZE+level)
then CalculatePoints(IsVulnerable(aDeclarer),aDeclarer,aScoreKeeper.CurrentGameIndex)
else Inc(aDefender.Overline,DefenderPts(IsVulnerable(aDeclarer), double));
CaseAssign(false,aDeclarer,aDefender,dummy);
if aDeclarer.m_nGamesWon>1 then begin
case aScoreKeeper.GamesPlayed of
2:Inc(aDeclarer.Overline,700);
3:Inc(aDeclarer.Overline,500);
end;
CaseAssign(false,aDeclarer,aDefender,dummy);
end;
end;
procedure ScoreKeeper.DoAddResult(team:teamId;level:contractLevel;trump:trumpType;doubling:doublingStatus;nMade:lengthType);
begin
CalculateScore(self,nMade,level,doubling,trump,Q(team=WE,NORTH,WEST));
if Length(as_string)>0 then as_string:=as_string+',';
as_string:=as_string+IntToStr(Ord(team))+','+IntToStr(level)+','+IntToStr(Ord(trump))+','+IntToStr(doubling)+','+IntToStr(nMade);
end;
procedure ScoreKeeper.AddResult(team:teamId;level:contractLevel;trump:trumpType;doubling:doublingStatus;nMade:lengthType);
begin
DoAddResult(team,level,trump,doubling,nMade);
OnAdded;
end;
function ScoreKeeper.ToString:ansistring;
begin
ToString:=as_string;
end;
procedure ScoreKeeper.OnAdded;
begin
PlaceHolder;
end;
procedure ScoreKeeper.FromData(data:ansistring);
var
n,val:integer;
s:ansistring;
team:teamId;
bid:contractLevel;
trump:trumpType;
doubling:doublingStatus;
function CheckRange(minVal,maxVal:integer):boolean;
var
b:boolean;
begin
b:=(val<minVal) or (val>maxVal);
if b then Clear;
CheckRange:=b;
end;
begin //WriteLn('ScoreKeeper.ConstructFromData("',data,'")');
n:=1;
s:=ExtractDelimited(n,data,[',']);
while Length(s)>0 do begin
val:=StrToIntDef(s,-1);
if CheckRange(0,1) then Exit;
team:=teamId(val);
Inc(n);
val:=StrToIntDef(ExtractDelimited(n,data,[',']),-1);
if CheckRange(Low(ContractLevel),High(contractLevel)) then Exit;
bid:=contractLevel(val);
Inc(n);
val:=StrToIntDef(ExtractDelimited(n,data,[',']),-1);
if CheckRange(Ord(Low(trumpType)),Ord(High(trumpType))) then Exit;
trump:=trumpType(val);
Inc(n);
val:=StrToIntDef(ExtractDelimited(n,data,[',']),-1);
if CheckRange(Low(doublingStatus),High(doublingStatus)) then Exit;
doubling:=val;
Inc(n);
val:=StrToIntDef(ExtractDelimited(n,data,[',']),-1);
if CheckRange(Low(lengthtype),High(lengthtype)) then Exit;
DoAddResult(team,bid,trump,doubling,val);
Inc(n);
s:=ExtractDelimited(n,data,[',']);
end;
end;
constructor ScoreKeeper.ConstructFromData(data:ansistring);
begin //WriteLn('ScoreKeeper.ConstructFromData("',data,'")');
Construct;
FromData(data);
end;
function ScoreKeeper.OverLineScoreCount(team:teamId):quantity;
begin
OverLineScoreCount:=0;
end;
end.
| 26.494595 | 131 | 0.727022 |
83bdf40c2c8ea9c31860601bc2b27c7b6479ba72 | 280 | pas | Pascal | HelloWorld.pas | RosembergDeLima/Pascal | b263ac0c8b884518b515e3ac60ca9b5bbd775db7 | [
"MIT"
]
| null | null | null | HelloWorld.pas | RosembergDeLima/Pascal | b263ac0c8b884518b515e3ac60ca9b5bbd775db7 | [
"MIT"
]
| null | null | null | HelloWorld.pas | RosembergDeLima/Pascal | b263ac0c8b884518b515e3ac60ca9b5bbd775db7 | [
"MIT"
]
| null | null | null | // -------------------------------------------------------------
// ESTE PROGRAMA IMPLEMENTA A FRASE "HELLO WORLD" :)
// -------------------------------------------------------------
Program HelloWorld;
Begin
{Printa a frase Hello World}
write('Hello World!');
End.
| 28 | 64 | 0.357143 |
83e3196967a9379e0c511144e2123c384948bba8 | 12,135 | pas | Pascal | Import/Indy9/IdAbout.pas | pavkam/wow-protocol | 2adc5df4cb15f29009dd6536fec18df5a8881ebb | [
"MIT"
]
| 2 | 2018-01-09T16:49:35.000Z | 2021-07-17T06:47:53.000Z | Import/Indy9/IdAbout.pas | pavkam/wow-protocol | 2adc5df4cb15f29009dd6536fec18df5a8881ebb | [
"MIT"
]
| null | null | null | Import/Indy9/IdAbout.pas | pavkam/wow-protocol | 2adc5df4cb15f29009dd6536fec18df5a8881ebb | [
"MIT"
]
| 2 | 2017-01-20T10:47:56.000Z | 2021-07-17T06:47:54.000Z | { $HDR$}
{**********************************************************************}
{ Unit archived using Team Coherence }
{ Team Coherence is Copyright 2002 by Quality Software Components }
{ }
{ For further information / comments, visit our WEB site at }
{ http://www.TeamCoherence.com }
{**********************************************************************}
{}
{ $Log: 10061: IdAbout.pas
{
{ Rev 1.4 6/5/2003 06:45:36 AM JPMugaas
{ Bas's name was omitted.
}
{
{ Rev 1.3 6/5/2003 06:26:46 AM JPMugaas
{ Noted other personell changes.
}
{
{ Rev 1.2 6/5/2003 06:18:02 AM JPMugaas
{ Noted J. Berg resignation.
}
{
{ Rev 1.1 6/5/2003 06:10:08 AM JPMugaas
{ Rune resigned.
}
{
{ Rev 1.0 2002.11.12 10:29:44 PM czhower
}
unit IdAbout;
interface
uses
{$IFDEF LINUX}
QStdCtrls, QForms, QExtCtrls, QControls, QComCtrls, QGraphics, Types, Qt,
{$ELSE}
Windows, Messages, StdCtrls, Buttons, ExtCtrls, Graphics, Controls, ComCtrls, Forms,
{$ENDIF}
Classes, SysUtils;
type
TformAbout = class(TForm)
private
{ Private declarations }
imgLogo: TImage;
{$IFDEF LINUX}
CreditList:TTextViewer;
TextStrm : TStream;
{$ELSE}
CreditList: TRichEdit;
{$ENDIF}
Panel1: TPanel;
Panel2: TPanel;
btnOk: TButton;
lblCopyright: TLabel;
lblVersion: TLabel;
lblName: TLabel;
lblPleaseVisitUs : TLabel;
lblURL : TLabel;
procedure BeginUpdate;
procedure AddHeader(const AHeader : String);
procedure AddEntry(const AName : String; const ACompany: String = '');
procedure EndUpdate;
public
{ Public declarations }
constructor Create(AOwner : TComponent); override;
{$IFDEF LINUX}
//workaround for problem - form position does not work like in VCL
procedure CenterForm;
{$ELSE}
procedure lblURLClick(Sender: TObject);
{$ENDIF}
end;
var
formAbout: TformAbout;
Procedure ShowAboutBox(const AProductName, AProductVersion : String);
Procedure ShowDlg;
implementation
uses
{$IFNDEF Linux}ShellApi,{$ENDIF}
IdGlobal, IdResourceStrings;
{$R IdCreditsBitmap.res}
Procedure ShowDlg;
begin
ShowAboutBox(RSAAboutBoxCompName, gsIdVersion);
end;
{$IFDEF LINUX}
procedure StrToStream(const AStr : String; AStream : TStream);
begin
if AStr <> '' then
begin
AStream.Write(AStr[1],Length(AStr));
end;
end;
{$ENDIF}
Procedure ShowAboutBox(const AProductName, AProductVersion : String);
begin
with TformAbout.Create(Application) do
try
lblName.Caption := AProductName;
lblVersion.Caption := Format ( RSAAboutBoxVersion, [ AProductVersion ] );
ShowModal;
finally
Free;
end;
end;
{ TformAbout }
procedure TformAbout.AddEntry(const AName : String; const ACompany: String = '');
begin
{$IFDEF LINUX}
StrToStream(Format('<P>%s',[AName]),TextStrm);
if ACompany = '' then
begin
StrToStream('</P>',TextStrm);
end
else
begin
StrToStream(Format('<BR>%s</P>',[ACompany]),TextStrm);
end;
{$ELSE}
CreditList.Lines.Add(AName);
if ACompany <> '' then
begin
CreditList.Lines.Add(ACompany);
end;
CreditList.Lines.Add('');
{$ENDIF}
end;
procedure TformAbout.AddHeader(const AHeader: String);
begin
{$IFDEF LINUX}
StrToStream(Format('<H1>%s</H1>',[AHeader]),TextStrm);
{$ELSE}
CreditList.SelAttributes.Size := 14;
CreditList.SelAttributes.Style := [fsBold];
CreditList.Lines.Add(AHeader);
{$ENDIF}
end;
procedure TformAbout.BeginUpdate;
begin
{$IFDEF LINUX}
CreditList.TextColor := clBlack;
CreditList.Paper.Color := clWhite;
TextStrm := TMemoryStream.Create;
StrToStream('<HTML><BODY><CENTER>',TextStrm);
{$ELSE}
CreditList.Color := clWHite;
CreditList.Clear;
CreditList.Paragraph.Alignment := taCenter;
CreditList.DefAttributes.Name := 'Arial';
CreditList.DefAttributes.Color := clBlack;
CreditList.DefAttributes.Size := 10;
CreditList.DefAttributes.Style := [];
{$ENDIF}
end;
{$IFDEF LINUX}
procedure TformAbout.CenterForm;
//workaround for problem - form position does not work like in VCL
begin
Left := (Screen.Width - Width) div 2;
Top := (Screen.Height - Height) div 2;
end;
{$ENDIF}
constructor TformAbout.Create(AOwner: TComponent);
begin
inherited CreateNew(AOwner);
BorderIcons := [biSystemMenu];
ClientHeight := 384;
ClientWidth := 435;
Position := poScreenCenter;
Color := clGray;
Font.Color := clBlack;
Font.Height := -11;
{$IFNDEF LINUX}
Font.Charset := DEFAULT_CHARSET;
Font.Name := 'MS Sans Serif'; {Do not Localize}
BorderStyle := bsDialog;
{$ELSE}
Font.Name := 'helvetica'; {Do not Localize}
BorderStyle := fbsDialog;
CenterForm;
{$ENDIF}
Constraints.MaxHeight := Height;
Constraints.MaxWidth := Width;
Constraints.MinHeight := Height;
Constraints.MinWidth := Width;
Caption := RSAAboutFormCaption;
ClientWidth := 435;
PixelsPerInch := 96;
Font.Style := [];
imgLogo := TImage.Create(Self);
imgLogo.Parent := Self;
imgLogo.Picture.Bitmap.LoadFromResourceName(HInstance, 'TIDABOUTPICTURE'); {Do not Localize}
imgLogo.AutoSize := True;
imgLogo.Top := 8;
imgLogo.Height := 8;
imgLogo.Left := 8;
Panel1 := TPanel.Create(Self);
Panel1.Parent := Self;
Panel1.BevelOuter := bvNone;
Panel1.BevelInner := bvNone;
Panel1.ParentColor := True;
Panel1.ParentFont := True;
Panel1.Left := 224;
Panel1.Top := 8;
Panel1.Width := 203;
Panel1.Height := 137;
Panel1.Anchors := [akLeft,akTop,akRight];
lblCopyright:= TLabel.Create(Self);
lblCopyright.Parent := Panel1;
lblCopyright.Left := 6;
lblCopyright.Top := 80;
lblCopyright.Width := 193;
lblCopyright.Height := 75;
lblCopyright.Alignment := taCenter;
lblCopyright.Anchors := [akLeft, akTop, akRight];
lblCopyright.AutoSize := False;
lblCopyright.Caption := RSAAboutBoxCopyright;
{$IFNDEF LINUX}
lblCopyright.Font.Charset := DEFAULT_CHARSET;
{$ENDIF}
lblCopyright.Font.Height := -11;
lblCopyright.Font.Style := [];
lblCopyright.ParentFont := False;
lblCopyright.Transparent := True;
lblCopyright.WordWrap := True;
lblVersion := TLabel.Create(Self);
lblVersion.Parent := Panel1;
lblVersion.Left := 6;
lblVersion.Top := 56;
lblVersion.Width := 193;
lblVersion.Height := 26;
lblVersion.Alignment := taCenter;
lblVersion.Anchors := [akLeft, akTop, akRight];
lblVersion.AutoSize := False;
{$IFNDEF LINUX}
lblVersion.Font.Charset := DEFAULT_CHARSET;
{$ENDIF}
lblVersion.Font.Height := -13;
lblVersion.Font.Name := 'Times New Roman'; {Do not Localize}
lblVersion.Font.Style := [fsBold];
lblVersion.ParentFont := False;
lblVersion.Transparent := True;
lblName:= TLabel.Create(Self);
lblName.Parent := Panel1;
lblName.Left := 6;
lblName.Top := 16;
lblName.Width := 193;
lblName.Height := 49;
lblName.Alignment := taCenter;
lblName.Anchors := [akLeft, akTop, akRight];
lblName.AutoSize := False;
{$IFNDEF LINUX}
lblName.Font.Charset := DEFAULT_CHARSET;
{$ENDIF}
lblName.Font.Height := -19;
lblName.Font.Name := 'Times New Roman'; {Do not Localize}
lblName.Font.Style := [fsBold];
lblName.ParentFont := False;
lblName.Transparent := True;
//bottum panel owned controls
Panel2 := TPanel.Create(Self);
Panel2.Parent := Self;
Panel2.Height := 40;
Panel2.BevelInner := bvNone;
Panel2.Align := alBottom;
Panel2.ParentColor := True;
Panel2.ParentFont := True;
Panel2.BevelOuter := bvNone;
Panel2.BevelInner := bvNone;
{Panel1 owned-controls}
lblPleaseVisitUs:= TLabel.Create(Self);
lblPleaseVisitUs.Parent := Panel2;
lblPleaseVisitUs.Left := 8;
lblPleaseVisitUs.Top := 4;
lblPleaseVisitUs.Width := 337; //304;
lblPleaseVisitUs.Height := 17;
lblPleaseVisitUs.Alignment := taCenter;
lblPleaseVisitUs.Anchors := [akLeft, akTop, akRight];
lblPleaseVisitUs.AutoSize := False;
{$IFNDEF LINUX}
lblPleaseVisitUs.Font.Charset := DEFAULT_CHARSET;
{$ENDIF}
lblPleaseVisitUs.Font.Height := -11;
lblPleaseVisitUs.Font.Style := [];
lblPleaseVisitUs.ParentFont := False;
lblPleaseVisitUs.Transparent := True;
lblPleaseVisitUs.Caption := RSAAboutBoxPleaseVisit;
lblURL:= TLabel.Create(Self);
lblURL.Parent := Panel2;
lblURL.AutoSize := False;
lblURL.Left := 8;
lblURL.Top := 20;
lblURL.Width := 304;
lblURL.Height := 13;
lblURL.Anchors := [akLeft, akTop, akRight];
{$IFNDEF LINUX}
lblURL.Cursor := crHandPoint;
lblURL.Font.Color := clRed; //clBtnHighlight;
lblURL.OnClick := lblURLClick;
lblURL.Font.Style := [fsUnderline];
lblURL.Font.Charset := DEFAULT_CHARSET;
{$ENDIF}
lblURL.Alignment := taCenter;
lblURL.Anchors := [akLeft, akTop, akRight];
lblURL.AutoSize := False;
lblURL.Font.Height := -11;
lblURL.ParentFont := False;
lblURL.Transparent := True;
lblURL.Caption := RSAAboutBoxIndyWebsite;
btnOk := TButton.Create(Panel2);
btnOk.Parent := Panel2;
btnOk.Left := 352;
btnOk.Top := 8;
btnOk.Width := 75;
btnOk.Height := 25;
btnOk.Anchors := [akTop, akRight];
btnOk.Cancel := True;
btnOk.Caption := RSAAboutOk;
btnOk.Default := True;
btnOk.ModalResult := 1;
btnOk.TabOrder := 0;
{$IFDEF LINUX}
CreditList := TTextViewer.Create(Self);
{$ELSE}
CreditList := TRichEdit.Create(Self);
CreditList.ReadOnly := True;
CreditList.ScrollBars := ssVertical;
{$ENDIF}
CreditList.Parent := Self;
CreditList.Left := 8;
CreditList.Top := 152;
CreditList.Width := 419;
CreditList.Height := 192;
CreditList.Anchors := [akLeft,akTop,akRight,akBottom];
BeginUpdate;
AddHeader(RSAAboutCreditsCoordinator);
AddEntry('Kudzu (Chad Z. Hower)','Atozed Software');
AddHeader(RSAAboutCreditsCoCordinator);
AddEntry('Hadi Hariri','Atozed Software');
AddHeader('The Indy Pit Crew');
AddEntry('Allen Bauer','Borland Software Corporation');
AddEntry('Allen O''Neill','Springboard Technologies Ltd');
AddEntry('Andrew Cumming');
AddEntry('Andrew Neillans','ABCC Computers');
AddEntry('Andrew Peter Mee');
AddEntry('Andrew P.Rybin');
AddEntry('Bas Gooijen');
AddEntry('Ciaran Costelloe');
AddEntry('Colin Wilson');
AddEntry('Darren Kosinski','Borland Software Corporation');
AddEntry('Dave Nottage');
AddEntry('Dennies Chang');
AddEntry('Don Siders');
AddEntry('Doychin Bondzhev','Atozed Software');
AddEntry('Grahame Grieve','Kestral Computing');
AddEntry('Gregor Ibic','Intelicom d.o.o.');
AddEntry('Idan Cohen');
AddEntry('J. Peter Mugaas');
AddEntry('Jan Pedersen','JPSoft DK');
AddEntry('Jim Gunkel','Nevrona Designs');
AddEntry('Mark Holmes');
AddEntry('Remy Lebeau');
AddEntry('Slaven Radic','Poco Systems');
AddEntry('Stephane Grobety');
AddEntry('Sergio Perry');
AddEntry('Tommi Prami');
AddEntry('Vladimir Vassiliev');
AddHeader(RSAAboutCreditsDocumentation);
AddEntry('Don Siders');
AddHeader(RSAAboutCreditsDemos);
AddEntry('Allen O''Neill','Springboard Technologies Ltd');
AddHeader(RSAAboutCreditsDistribution);
AddEntry('J. Peter Mugaas');
AddHeader(RSAAboutCreditsRetiredPast);
AddEntry('Charles Stack');
AddEntry('Chuck Smith');
AddEntry('Johannes Berg');
AddEntry('Rune Moberg');
EndUpdate;
end;
procedure TformAbout.EndUpdate;
begin
{$IFDEF LINUX}
StrToStream('</CENTER></BODY></HTML>',TextStrm);
CreditList.LoadFromStream(TextStrm);
FreeAndNil(TextStrm);
{$ELSE}
CreditList.SelStart := 0;
{$ENDIF}
end;
{$IFNDEF LINUX}
procedure TformAbout.lblURLClick(Sender: TObject);
begin
ShellAPI.shellExecute((Self as TControl).Handle,PChar('open'),PChar(lblURL.Caption),nil,nil, 0); {Do not Localize}
end;
{$ENDIF}
end.
| 28.025404 | 120 | 0.651998 |
f11d3e9511efb31188b7273a5d4d173142af690f | 48,410 | pas | Pascal | windows/src/ext/jedi/jwa/branches/2.3/Win32API/JwaMsiDefs.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | vendor/JWA/API/JwaMsiDefs.pas | Sholtee/libjson | 550254d835442db30709679446aabbf95fa3d97e | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | vendor/JWA/API/JwaMsiDefs.pas | Sholtee/libjson | 550254d835442db30709679446aabbf95fa3d97e | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | {******************************************************************************}
{ }
{ Windows Installer API interface Unit for Object Pascal }
{ }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
{ Corporation. All Rights Reserved. }
{ }
{ The original file is: msidefs.h, released June 2000. The original Pascal }
{ code is: MsiDefs.pas, released June 2001. The initial developer of the }
{ Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
{ }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
{ Marcel van Brakel. All Rights Reserved. }
{ }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project JEDI }
{ APILIB home page, located at http://jedi-apilib.sourceforge.net }
{ }
{ The contents of this file are used with permission, 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/MPL-1.1.html }
{ }
{ 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. }
{ }
{ Alternatively, the contents of this file may be used under the terms of the }
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
{ provisions of the LGPL License are applicable instead of those above. }
{ If you wish to allow use of your version of this file only under the terms }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting the provisions above and }
{ replace them with the notice and other provisions required by the LGPL }
{ License. If you do not delete the provisions above, a recipient may use }
{ your version of this file under either the MPL or the LGPL License. }
{ }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ }
{******************************************************************************}
// $Id: JwaMsiDefs.pas,v 1.8 2007/09/05 11:58:51 dezipaitor Exp $
{$IFNDEF JWA_OMIT_SECTIONS}
unit JwaMsiDefs;
{$WEAKPACKAGEUNIT}
{$ENDIF JWA_OMIT_SECTIONS}
{$HPPEMIT ''}
{$HPPEMIT '#include "msidefs.h"'}
{$HPPEMIT ''}
{$IFNDEF JWA_OMIT_SECTIONS}
{$I ..\Includes\JediAPILib.inc}
interface
uses
JwaWinType;
{$ENDIF JWA_OMIT_SECTIONS}
{$IFNDEF JWA_IMPLEMENTATIONSECTION}
//------------------------------------------------------------------------------
// INSTALLER PROPERTY DEFINITIONS
//------------------------------------------------------------------------------
const
// Required properties: set in Property table
IPROPNAME_PRODUCTNAME = TEXT('ProductName'); // name registered for display
{$EXTERNALSYM IPROPNAME_PRODUCTNAME}
IPROPNAME_PRODUCTCODE = TEXT('ProductCode'); // unique string GUID for product
{$EXTERNALSYM IPROPNAME_PRODUCTCODE}
IPROPNAME_PRODUCTVERSION = TEXT('ProductVersion'); // string product version
{$EXTERNALSYM IPROPNAME_PRODUCTVERSION}
IPROPNAME_INSTALLLANGUAGE = TEXT('ProductLanguage'); // install language of product, use to load resources
{$EXTERNALSYM IPROPNAME_INSTALLLANGUAGE}
IPROPNAME_MANUFACTURER = TEXT('Manufacturer'); // name of manufacturer
{$EXTERNALSYM IPROPNAME_MANUFACTURER}
// Customization properties: set in Property table
IPROPNAME_UPGRADECODE = TEXT('UpgradeCode'); // unique string GUID for product family
{$EXTERNALSYM IPROPNAME_UPGRADECODE}
IPROPNAME_PIDTEMPLATE = TEXT('PIDTemplate'); // drives Product ID processing
{$EXTERNALSYM IPROPNAME_PIDTEMPLATE}
IPROPNAME_DISKPROMPT = TEXT('DiskPrompt'); // prompt for CD
{$EXTERNALSYM IPROPNAME_DISKPROMPT}
IPROPNAME_LEFTUNIT = TEXT('LeftUnit'); // name of unit placed to left of number instead of right
{$EXTERNALSYM IPROPNAME_LEFTUNIT}
IPROPNAME_ADMIN_PROPERTIES = TEXT('AdminProperties'); // properties to stuff in admin package
{$EXTERNALSYM IPROPNAME_ADMIN_PROPERTIES}
IPROPNAME_DEFAULTUIFONT = TEXT('DefaultUIFont'); // the font used in the UI if no other font is specified
{$EXTERNALSYM IPROPNAME_DEFAULTUIFONT}
IPROPNAME_ALLOWEDPROPERTIES = TEXT('SecureCustomProperties');
{$EXTERNALSYM IPROPNAME_ALLOWEDPROPERTIES}
IPROPNAME_ENABLEUSERCONTROL = TEXT('EnableUserControl'); // allows user to specify any public property
{$EXTERNALSYM IPROPNAME_ENABLEUSERCONTROL}
IPROPNAME_HIDDEN_PROPERTIES = TEXT('MsiHiddenProperties'); // properties that should not be dumped into the log file
{$EXTERNALSYM IPROPNAME_HIDDEN_PROPERTIES}
// Customization properties: set on command-line or in Property table
IPROPNAME_USERNAME = TEXT('USERNAME');
{$EXTERNALSYM IPROPNAME_USERNAME}
IPROPNAME_COMPANYNAME = TEXT('COMPANYNAME');
{$EXTERNALSYM IPROPNAME_COMPANYNAME}
IPROPNAME_PIDKEY = TEXT('PIDKEY'); // used with PIDTemplate to form ProductID
{$EXTERNALSYM IPROPNAME_PIDKEY}
IPROPNAME_PATCH = TEXT('PATCH'); // patch package to apply - SET BY INSTALLER
{$EXTERNALSYM IPROPNAME_PATCH}
IPROPNAME_TARGETDIR = TEXT('TARGETDIR'); // target location - defaults to ROOTDRIVE
{$EXTERNALSYM IPROPNAME_TARGETDIR}
IPROPNAME_ACTION = TEXT('ACTION'); // top-level action to perform - default to INSTALL
{$EXTERNALSYM IPROPNAME_ACTION}
IPROPNAME_LIMITUI = TEXT('LIMITUI'); // limit ui level to Basic
{$EXTERNALSYM IPROPNAME_LIMITUI}
IPROPNAME_LOGACTION = TEXT('LOGACTION'); // log only these actions
{$EXTERNALSYM IPROPNAME_LOGACTION}
IPROPNAME_ALLUSERS = TEXT('ALLUSERS'); // install for all users
{$EXTERNALSYM IPROPNAME_ALLUSERS}
IPROPNAME_INSTALLLEVEL = TEXT('INSTALLLEVEL');
{$EXTERNALSYM IPROPNAME_INSTALLLEVEL}
IPROPNAME_REBOOT = TEXT('REBOOT'); // force or suppress reboot
{$EXTERNALSYM IPROPNAME_REBOOT}
IPROPNAME_REBOOTPROMPT = TEXT('REBOOTPROMPT'); // allow or suppress reboot prompt
{$EXTERNALSYM IPROPNAME_REBOOTPROMPT}
IPROPNAME_EXECUTEMODE = TEXT('EXECUTEMODE'); // NONE or SCRIPT
{$EXTERNALSYM IPROPNAME_EXECUTEMODE}
IPROPVALUE_EXECUTEMODE_NONE = TEXT('NONE'); // do not update system
{$EXTERNALSYM IPROPVALUE_EXECUTEMODE_NONE}
IPROPVALUE_EXECUTEMODE_SCRIPT = TEXT('SCRIPT'); // default - run script to update system
{$EXTERNALSYM IPROPVALUE_EXECUTEMODE_SCRIPT}
IPROPNAME_EXECUTEACTION = TEXT('EXECUTEACTION'); // run action on server side
{$EXTERNALSYM IPROPNAME_EXECUTEACTION}
IPROPNAME_SOURCELIST = TEXT('SOURCELIST');
{$EXTERNALSYM IPROPNAME_SOURCELIST}
IPROPNAME_ROOTDRIVE = TEXT('ROOTDRIVE'); // default drive to install - SET BY INSTALLER
{$EXTERNALSYM IPROPNAME_ROOTDRIVE}
IPROPNAME_TRANSFORMS = TEXT('TRANSFORMS'); // transforms to apply
{$EXTERNALSYM IPROPNAME_TRANSFORMS}
IPROPNAME_TRANSFORMSATSOURCE = TEXT('TRANSFORMSATSOURCE'); // transforms can be found at source
{$EXTERNALSYM IPROPNAME_TRANSFORMSATSOURCE}
IPROPNAME_TRANSFORMSSECURE = TEXT('TRANSFORMSSECURE'); // file transforms are secured
{$EXTERNALSYM IPROPNAME_TRANSFORMSSECURE}
IPROPNAME_SEQUENCE = TEXT('SEQUENCE'); // sequence table to run with SEQUENCE action
{$EXTERNALSYM IPROPNAME_SEQUENCE}
IPROPNAME_SHORTFILENAMES = TEXT('SHORTFILENAMES'); // force short file names
{$EXTERNALSYM IPROPNAME_SHORTFILENAMES}
IPROPNAME_PRIMARYFOLDER = TEXT('PRIMARYFOLDER'); // Folder on the volume the author wants costing info for
{$EXTERNALSYM IPROPNAME_PRIMARYFOLDER}
IPROPNAME_AFTERREBOOT = TEXT('AFTERREBOOT'); // install is after a ForceReboot triggered reboot
{$EXTERNALSYM IPROPNAME_AFTERREBOOT}
IPROPNAME_NOCOMPANYNAME = TEXT('NOCOMPANYNAME');
{$EXTERNALSYM IPROPNAME_NOCOMPANYNAME}
IPROPNAME_NOUSERNAME = TEXT('NOUSERNAME');
{$EXTERNALSYM IPROPNAME_NOUSERNAME}
IPROPNAME_DISABLEROLLBACK = TEXT('DISABLEROLLBACK'); // disable rollback for this install
{$EXTERNALSYM IPROPNAME_DISABLEROLLBACK}
IPROPNAME_AVAILABLEFREEREG = TEXT('AVAILABLEFREEREG'); // set up the free space in the registry before commencing the install
{$EXTERNALSYM IPROPNAME_AVAILABLEFREEREG}
IPROPNAME_DISABLEADVTSHORTCUTS = TEXT('DISABLEADVTSHORTCUTS'); // disable creating darwin shortcuts even if supported
{$EXTERNALSYM IPROPNAME_DISABLEADVTSHORTCUTS}
IPROPNAME_PATCHNEWPACKAGECODE = TEXT('PATCHNEWPACKAGECODE'); // added to property table by patch transforms - used to update
{$EXTERNALSYM IPROPNAME_PATCHNEWPACKAGECODE}
// PackageCode of admin packages when patching admin installs
IPROPNAME_PATCHNEWSUMMARYSUBJECT = TEXT('PATCHNEWSUMMARYSUBJECT'); // added to property table by patch transforms - used to update
{$EXTERNALSYM IPROPNAME_PATCHNEWSUMMARYSUBJECT}
// Subject summary info property of admin packages when patching admin installs
IPROPNAME_PATCHNEWSUMMARYCOMMENTS = TEXT('PATCHNEWSUMMARYCOMMENTS'); // added to property table by patch transforms - used to update
{$EXTERNALSYM IPROPNAME_PATCHNEWSUMMARYCOMMENTS}
// Comments summary info property of admin packages when patching admin installs
IPROPNAME_PRODUCTLANGUAGE = TEXT('PRODUCTLANGUAGE'); // requested language, must be one in summary information list, selects language transform
{$EXTERNALSYM IPROPNAME_PRODUCTLANGUAGE}
IPROPNAME_CHECKCRCS = TEXT('MSICHECKCRCS'); // requests Darwin to check CRCs after copying, moving, patching & duplicating files.
{$EXTERNALSYM IPROPNAME_CHECKCRCS}
IPROPNAME_MSINODISABLEMEDIA = TEXT('MSINODISABLEMEDIA'); // if set, DISABLEMEDIA won't be set in the AdminProperties stream during an admin install of
{$EXTERNALSYM IPROPNAME_MSINODISABLEMEDIA} // a package with compressed source
// property used for URT bootstrapping
IPROPNAME_CARRYINGNDP = TEXT('CARRYINGNDP');
{$EXTERNALSYM IPROPNAME_CARRYINGNDP}
IPROPVALUE__CARRYINGNDP_URTREINSTALL = TEXT('URTREINSTALL'); // reinstalling/ uninstalling core URT files
{$EXTERNALSYM IPROPVALUE__CARRYINGNDP_URTREINSTALL}
IPROPVALUE__CARRYINGNDP_URTUPGRADE = TEXT('URTUPGRADE'); // upgrading core URT files
{$EXTERNALSYM IPROPVALUE__CARRYINGNDP_URTUPGRADE}
// property used for multiple instance support
IPROPNAME_MSINEWINSTANCE = TEXT('MSINEWINSTANCE');
{$EXTERNALSYM IPROPNAME_MSINEWINSTANCE}
IPROPNAME_MSIINSTANCEGUID = TEXT('MSIINSTANCEGUID');
{$EXTERNALSYM IPROPNAME_MSIINSTANCEGUID}
// properties used for URL download reduction for admins
IPROPNAME_MSIPACKAGEDOWNLOADLOCALCOPY = TEXT('MSIPACKAGEDOWNLOADLOCALCOPY');
{$EXTERNALSYM IPROPNAME_MSIPACKAGEDOWNLOADLOCALCOPY}
IPROPNAME_MSIPATCHDOWNLOADLOCALCOPY = TEXT('MSIPATCHDOWNLOADLOCALCOPY');
{$EXTERNALSYM IPROPNAME_MSIPATCHDOWNLOADLOCALCOPY}
// Properties used to populate Add/Remove Control Panel values
IPROPNAME_ARPAUTHORIZEDCDFPREFIX = TEXT('ARPAUTHORIZEDCDFPREFIX');
{$EXTERNALSYM IPROPNAME_ARPAUTHORIZEDCDFPREFIX}
IPROPNAME_ARPCOMMENTS = TEXT('ARPCOMMENTS');
{$EXTERNALSYM IPROPNAME_ARPCOMMENTS}
IPROPNAME_ARPCONTACT = TEXT('ARPCONTACT');
{$EXTERNALSYM IPROPNAME_ARPCONTACT}
IPROPNAME_ARPHELPLINK = TEXT('ARPHELPLINK');
{$EXTERNALSYM IPROPNAME_ARPHELPLINK}
IPROPNAME_ARPHELPTELEPHONE = TEXT('ARPHELPTELEPHONE');
{$EXTERNALSYM IPROPNAME_ARPHELPTELEPHONE}
IPROPNAME_ARPINSTALLLOCATION = TEXT('ARPINSTALLLOCATION');
{$EXTERNALSYM IPROPNAME_ARPINSTALLLOCATION}
IPROPNAME_ARPNOMODIFY = TEXT('ARPNOMODIFY');
{$EXTERNALSYM IPROPNAME_ARPNOMODIFY}
IPROPNAME_ARPNOREMOVE = TEXT('ARPNOREMOVE');
{$EXTERNALSYM IPROPNAME_ARPNOREMOVE}
IPROPNAME_ARPNOREPAIR = TEXT('ARPNOREPAIR');
{$EXTERNALSYM IPROPNAME_ARPNOREPAIR}
IPROPNAME_ARPREADME = TEXT('ARPREADME');
{$EXTERNALSYM IPROPNAME_ARPREADME}
IPROPNAME_ARPSIZE = TEXT('ARPSIZE');
{$EXTERNALSYM IPROPNAME_ARPSIZE}
IPROPNAME_ARPSYSTEMCOMPONENT = TEXT('ARPSYSTEMCOMPONENT');
{$EXTERNALSYM IPROPNAME_ARPSYSTEMCOMPONENT}
IPROPNAME_ARPURLINFOABOUT = TEXT('ARPURLINFOABOUT');
{$EXTERNALSYM IPROPNAME_ARPURLINFOABOUT}
IPROPNAME_ARPURLUPDATEINFO = TEXT('ARPURLUPDATEINFO');
{$EXTERNALSYM IPROPNAME_ARPURLUPDATEINFO}
IPROPNAME_ARPPRODUCTICON = TEXT('ARPPRODUCTICON');
{$EXTERNALSYM IPROPNAME_ARPPRODUCTICON}
// Dynamic properties set by installer during install
IPROPNAME_INSTALLED = TEXT('Installed'); // product already installed
{$EXTERNALSYM IPROPNAME_INSTALLED}
IPROPNAME_PRODUCTSTATE = TEXT('ProductState'); // state of product (installed,advertised,etc...)
{$EXTERNALSYM IPROPNAME_PRODUCTSTATE}
IPROPNAME_PRESELECTED = TEXT('Preselected'); // selections made on command line
{$EXTERNALSYM IPROPNAME_PRESELECTED}
IPROPNAME_RESUME = TEXT('RESUME'); // resuming suspended install
{$EXTERNALSYM IPROPNAME_RESUME}
IPROPNAME_UPDATESTARTED = TEXT('UpdateStarted'); // have begun to update system
{$EXTERNALSYM IPROPNAME_UPDATESTARTED}
IPROPNAME_PRODUCTID = TEXT('ProductID'); // the complete validated Product ID
{$EXTERNALSYM IPROPNAME_PRODUCTID}
IPROPNAME_OUTOFDISKSPACE = TEXT('OutOfDiskSpace');
{$EXTERNALSYM IPROPNAME_OUTOFDISKSPACE}
IPROPNAME_OUTOFNORBDISKSPACE = TEXT('OutOfNoRbDiskSpace');
{$EXTERNALSYM IPROPNAME_OUTOFNORBDISKSPACE}
IPROPNAME_COSTINGCOMPLETE = TEXT('CostingComplete');
{$EXTERNALSYM IPROPNAME_COSTINGCOMPLETE}
IPROPNAME_SOURCEDIR = TEXT('SourceDir'); // source location - SET BY INSTALLER
{$EXTERNALSYM IPROPNAME_SOURCEDIR}
IPROPNAME_REPLACEDINUSEFILES = TEXT('ReplacedInUseFiles'); // need reboot to completely install one or more files
{$EXTERNALSYM IPROPNAME_REPLACEDINUSEFILES}
IPROPNAME_PRIMARYFOLDER_PATH = TEXT('PrimaryVolumePath');
{$EXTERNALSYM IPROPNAME_PRIMARYFOLDER_PATH}
IPROPNAME_PRIMARYFOLDER_SPACEAVAILABLE = TEXT('PrimaryVolumeSpaceAvailable');
{$EXTERNALSYM IPROPNAME_PRIMARYFOLDER_SPACEAVAILABLE}
IPROPNAME_PRIMARYFOLDER_SPACEREQUIRED = TEXT('PrimaryVolumeSpaceRequired');
{$EXTERNALSYM IPROPNAME_PRIMARYFOLDER_SPACEREQUIRED}
IPROPNAME_PRIMARYFOLDER_SPACEREMAINING = TEXT('PrimaryVolumeSpaceRemaining');
{$EXTERNALSYM IPROPNAME_PRIMARYFOLDER_SPACEREMAINING}
IPROPNAME_ISADMINPACKAGE = TEXT('IsAdminPackage');
{$EXTERNALSYM IPROPNAME_ISADMINPACKAGE}
IPROPNAME_ROLLBACKDISABLED = TEXT('RollbackDisabled');
{$EXTERNALSYM IPROPNAME_ROLLBACKDISABLED}
IPROPNAME_RESTRICTEDUSERCONTROL = TEXT('RestrictedUserControl');
{$EXTERNALSYM IPROPNAME_RESTRICTEDUSERCONTROL}
// Dynamic properties evaluated upon use
IPROPNAME_TIME = TEXT('Time');
{$EXTERNALSYM IPROPNAME_TIME}
IPROPNAME_DATE = TEXT('Date');
{$EXTERNALSYM IPROPNAME_DATE}
IPROPNAME_DATETIME = TEXT('DateTime');
{$EXTERNALSYM IPROPNAME_DATETIME}
// Hardware properties: set by installer at initialization
IPROPNAME_INTEL = TEXT('Intel');
{$EXTERNALSYM IPROPNAME_INTEL}
//#if (_WIN32_MSI >= 150)
IPROPNAME_AMD64 = TEXT('AMD64');
{$EXTERNALSYM IPROPNAME_AMD64}
IPROPNAME_INTEL64 = TEXT('Intel64');
{$EXTERNALSYM IPROPNAME_INTEL64}
//#else // (_WIN32_MSI >= 150)
IPROPNAME_IA64 = TEXT('IA64');
{$EXTERNALSYM IPROPNAME_IA64}
//#endif // (_WIN32_MSI >= 150)
IPROPNAME_TEXTHEIGHT = TEXT('TextHeight');
{$EXTERNALSYM IPROPNAME_TEXTHEIGHT}
IPROPNAME_SCREENX = TEXT('ScreenX');
{$EXTERNALSYM IPROPNAME_SCREENX}
IPROPNAME_SCREENY = TEXT('ScreenY');
{$EXTERNALSYM IPROPNAME_SCREENY}
IPROPNAME_CAPTIONHEIGHT = TEXT('CaptionHeight');
{$EXTERNALSYM IPROPNAME_CAPTIONHEIGHT}
IPROPNAME_BORDERTOP = TEXT('BorderTop');
{$EXTERNALSYM IPROPNAME_BORDERTOP}
IPROPNAME_BORDERSIDE = TEXT('BorderSide');
{$EXTERNALSYM IPROPNAME_BORDERSIDE}
IPROPNAME_COLORBITS = TEXT('ColorBits');
{$EXTERNALSYM IPROPNAME_COLORBITS}
IPROPNAME_PHYSICALMEMORY = TEXT('PhysicalMemory');
{$EXTERNALSYM IPROPNAME_PHYSICALMEMORY}
IPROPNAME_VIRTUALMEMORY = TEXT('VirtualMemory');
{$EXTERNALSYM IPROPNAME_VIRTUALMEMORY}
IPROPNAME_TEXTHEIGHT_CORRECTION = TEXT('TextHeightCorrection');
{$EXTERNALSYM IPROPNAME_TEXTHEIGHT_CORRECTION}
// Operating System properties: set by installer at initialization
IPROPNAME_VERSIONNT = TEXT('VersionNT');
{$EXTERNALSYM IPROPNAME_VERSIONNT}
IPROPNAME_VERSION9X = TEXT('Version9X');
{$EXTERNALSYM IPROPNAME_VERSION9X}
IPROPNAME_VERSIONNT64 = TEXT('VersionNT64');
{$EXTERNALSYM IPROPNAME_VERSIONNT64}
IPROPNAME_WINDOWSBUILD = TEXT('WindowsBuild');
{$EXTERNALSYM IPROPNAME_WINDOWSBUILD}
IPROPNAME_SERVICEPACKLEVEL = TEXT('ServicePackLevel');
{$EXTERNALSYM IPROPNAME_SERVICEPACKLEVEL}
IPROPNAME_SERVICEPACKLEVELMINOR = TEXT('ServicePackLevelMinor');
{$EXTERNALSYM IPROPNAME_SERVICEPACKLEVELMINOR}
IPROPNAME_SHAREDWINDOWS = TEXT('SharedWindows');
{$EXTERNALSYM IPROPNAME_SHAREDWINDOWS}
IPROPNAME_COMPUTERNAME = TEXT('ComputerName');
{$EXTERNALSYM IPROPNAME_COMPUTERNAME}
IPROPNAME_SHELLADVTSUPPORT = TEXT('ShellAdvtSupport');
{$EXTERNALSYM IPROPNAME_SHELLADVTSUPPORT}
IPROPNAME_OLEADVTSUPPORT = TEXT('OLEAdvtSupport');
{$EXTERNALSYM IPROPNAME_OLEADVTSUPPORT}
IPROPNAME_SYSTEMLANGUAGEID = TEXT('SystemLanguageID');
{$EXTERNALSYM IPROPNAME_SYSTEMLANGUAGEID}
IPROPNAME_TTCSUPPORT = TEXT('TTCSupport');
{$EXTERNALSYM IPROPNAME_TTCSUPPORT}
IPROPNAME_TERMSERVER = TEXT('TerminalServer');
{$EXTERNALSYM IPROPNAME_TERMSERVER}
IPROPNAME_REMOTEADMINTS = TEXT('RemoteAdminTS');
{$EXTERNALSYM IPROPNAME_REMOTEADMINTS}
IPROPNAME_REDIRECTEDDLLSUPPORT = TEXT('RedirectedDllSupport');
{$EXTERNALSYM IPROPNAME_REDIRECTEDDLLSUPPORT}
IPROPNAME_NTPRODUCTTYPE = TEXT('MsiNTProductType');
{$EXTERNALSYM IPROPNAME_NTPRODUCTTYPE}
IPROPNAME_NTSUITEBACKOFFICE = TEXT('MsiNTSuiteBackOffice');
{$EXTERNALSYM IPROPNAME_NTSUITEBACKOFFICE}
IPROPNAME_NTSUITEDATACENTER = TEXT('MsiNTSuiteDataCenter');
{$EXTERNALSYM IPROPNAME_NTSUITEDATACENTER}
IPROPNAME_NTSUITEENTERPRISE = TEXT('MsiNTSuiteEnterprise');
{$EXTERNALSYM IPROPNAME_NTSUITEENTERPRISE}
IPROPNAME_NTSUITESMALLBUSINESS = TEXT('MsiNTSuiteSmallBusiness');
{$EXTERNALSYM IPROPNAME_NTSUITESMALLBUSINESS}
IPROPNAME_NTSUITESMALLBUSINESSRESTRICTED = TEXT('MsiNTSuiteSmallBusinessRestricted');
{$EXTERNALSYM IPROPNAME_NTSUITESMALLBUSINESSRESTRICTED}
IPROPNAME_NTSUITEPERSONAL = TEXT('MsiNTSuitePersonal');
{$EXTERNALSYM IPROPNAME_NTSUITEPERSONAL}
IPROPNAME_NTSUITEWEBSERVER = TEXT('MsiNTSuiteWebServer');
{$EXTERNALSYM IPROPNAME_NTSUITEWEBSERVER}
IPROPNAME_NETASSEMBLYSUPPORT = TEXT('MsiNetAssemblySupport');
{$EXTERNALSYM IPROPNAME_NETASSEMBLYSUPPORT}
IPROPNAME_WIN32ASSEMBLYSUPPORT = TEXT('MsiWin32AssemblySupport');
{$EXTERNALSYM IPROPNAME_WIN32ASSEMBLYSUPPORT}
// User properties: set by installer at initialization
IPROPNAME_LOGONUSER = TEXT('LogonUser');
{$EXTERNALSYM IPROPNAME_LOGONUSER}
IPROPNAME_USERSID = TEXT('UserSID');
{$EXTERNALSYM IPROPNAME_USERSID}
IPROPNAME_ADMINUSER = TEXT('AdminUser');
{$EXTERNALSYM IPROPNAME_ADMINUSER}
IPROPNAME_USERLANGUAGEID = TEXT('UserLanguageID');
{$EXTERNALSYM IPROPNAME_USERLANGUAGEID}
IPROPNAME_PRIVILEGED = TEXT('Privileged');
{$EXTERNALSYM IPROPNAME_PRIVILEGED}
// System folder properties: set by installer at initialization
IPROPNAME_WINDOWS_FOLDER = TEXT('WindowsFolder');
{$EXTERNALSYM IPROPNAME_WINDOWS_FOLDER}
IPROPNAME_SYSTEM_FOLDER = TEXT('SystemFolder');
{$EXTERNALSYM IPROPNAME_SYSTEM_FOLDER}
IPROPNAME_SYSTEM16_FOLDER = TEXT('System16Folder');
{$EXTERNALSYM IPROPNAME_SYSTEM16_FOLDER}
IPROPNAME_WINDOWS_VOLUME = TEXT('WindowsVolume');
{$EXTERNALSYM IPROPNAME_WINDOWS_VOLUME}
IPROPNAME_TEMP_FOLDER = TEXT('TempFolder');
{$EXTERNALSYM IPROPNAME_TEMP_FOLDER}
IPROPNAME_PROGRAMFILES_FOLDER = TEXT('ProgramFilesFolder');
{$EXTERNALSYM IPROPNAME_PROGRAMFILES_FOLDER}
IPROPNAME_COMMONFILES_FOLDER = TEXT('CommonFilesFolder');
{$EXTERNALSYM IPROPNAME_COMMONFILES_FOLDER}
IPROPNAME_SYSTEM64_FOLDER = TEXT('System64Folder');
{$EXTERNALSYM IPROPNAME_SYSTEM64_FOLDER}
IPROPNAME_PROGRAMFILES64_FOLDER = TEXT('ProgramFiles64Folder');
{$EXTERNALSYM IPROPNAME_PROGRAMFILES64_FOLDER}
IPROPNAME_COMMONFILES64_FOLDER = TEXT('CommonFiles64Folder');
{$EXTERNALSYM IPROPNAME_COMMONFILES64_FOLDER}
IPROPNAME_STARTMENU_FOLDER = TEXT('StartMenuFolder');
{$EXTERNALSYM IPROPNAME_STARTMENU_FOLDER}
IPROPNAME_PROGRAMMENU_FOLDER = TEXT('ProgramMenuFolder');
{$EXTERNALSYM IPROPNAME_PROGRAMMENU_FOLDER}
IPROPNAME_STARTUP_FOLDER = TEXT('StartupFolder');
{$EXTERNALSYM IPROPNAME_STARTUP_FOLDER}
IPROPNAME_NETHOOD_FOLDER = TEXT('NetHoodFolder');
{$EXTERNALSYM IPROPNAME_NETHOOD_FOLDER}
IPROPNAME_PERSONAL_FOLDER = TEXT('PersonalFolder');
{$EXTERNALSYM IPROPNAME_PERSONAL_FOLDER}
IPROPNAME_SENDTO_FOLDER = TEXT('SendToFolder');
{$EXTERNALSYM IPROPNAME_SENDTO_FOLDER}
IPROPNAME_DESKTOP_FOLDER = TEXT('DesktopFolder');
{$EXTERNALSYM IPROPNAME_DESKTOP_FOLDER}
IPROPNAME_TEMPLATE_FOLDER = TEXT('TemplateFolder');
{$EXTERNALSYM IPROPNAME_TEMPLATE_FOLDER}
IPROPNAME_FONTS_FOLDER = TEXT('FontsFolder');
{$EXTERNALSYM IPROPNAME_FONTS_FOLDER}
IPROPNAME_FAVORITES_FOLDER = TEXT('FavoritesFolder');
{$EXTERNALSYM IPROPNAME_FAVORITES_FOLDER}
IPROPNAME_RECENT_FOLDER = TEXT('RecentFolder');
{$EXTERNALSYM IPROPNAME_RECENT_FOLDER}
IPROPNAME_APPDATA_FOLDER = TEXT('AppDataFolder');
{$EXTERNALSYM IPROPNAME_APPDATA_FOLDER}
IPROPNAME_PRINTHOOD_FOLDER = TEXT('PrintHoodFolder');
{$EXTERNALSYM IPROPNAME_PRINTHOOD_FOLDER}
IPROPNAME_ADMINTOOLS_FOLDER = TEXT('AdminToolsFolder');
{$EXTERNALSYM IPROPNAME_ADMINTOOLS_FOLDER}
IPROPNAME_COMMONAPPDATA_FOLDER = TEXT('CommonAppDataFolder');
{$EXTERNALSYM IPROPNAME_COMMONAPPDATA_FOLDER}
IPROPNAME_LOCALAPPDATA_FOLDER = TEXT('LocalAppDataFolder');
{$EXTERNALSYM IPROPNAME_LOCALAPPDATA_FOLDER}
IPROPNAME_MYPICTURES_FOLDER = TEXT('MyPicturesFolder');
{$EXTERNALSYM IPROPNAME_MYPICTURES_FOLDER}
// Feature/Component installation properties: set on command-line
IPROPNAME_FEATUREADDLOCAL = TEXT('ADDLOCAL');
{$EXTERNALSYM IPROPNAME_FEATUREADDLOCAL}
IPROPNAME_FEATUREADDSOURCE = TEXT('ADDSOURCE');
{$EXTERNALSYM IPROPNAME_FEATUREADDSOURCE}
IPROPNAME_FEATUREADDDEFAULT = TEXT('ADDDEFAULT');
{$EXTERNALSYM IPROPNAME_FEATUREADDDEFAULT}
IPROPNAME_FEATUREREMOVE = TEXT('REMOVE');
{$EXTERNALSYM IPROPNAME_FEATUREREMOVE}
IPROPNAME_FEATUREADVERTISE = TEXT('ADVERTISE');
{$EXTERNALSYM IPROPNAME_FEATUREADVERTISE}
IPROPVALUE_FEATURE_ALL = TEXT('ALL');
{$EXTERNALSYM IPROPVALUE_FEATURE_ALL}
IPROPNAME_COMPONENTADDLOCAL = TEXT('COMPADDLOCAL');
{$EXTERNALSYM IPROPNAME_COMPONENTADDLOCAL}
IPROPNAME_COMPONENTADDSOURCE = TEXT('COMPADDSOURCE');
{$EXTERNALSYM IPROPNAME_COMPONENTADDSOURCE}
IPROPNAME_COMPONENTADDDEFAULT = TEXT('COMPADDDEFAULT');
{$EXTERNALSYM IPROPNAME_COMPONENTADDDEFAULT}
IPROPNAME_FILEADDLOCAL = TEXT('FILEADDLOCAL');
{$EXTERNALSYM IPROPNAME_FILEADDLOCAL}
IPROPNAME_FILEADDSOURCE = TEXT('FILEADDSOURCE');
{$EXTERNALSYM IPROPNAME_FILEADDSOURCE}
IPROPNAME_FILEADDDEFAULT = TEXT('FILEADDDEFAULT');
{$EXTERNALSYM IPROPNAME_FILEADDDEFAULT}
IPROPNAME_REINSTALL = TEXT('REINSTALL');
{$EXTERNALSYM IPROPNAME_REINSTALL}
IPROPNAME_REINSTALLMODE = TEXT('REINSTALLMODE');
{$EXTERNALSYM IPROPNAME_REINSTALLMODE}
IPROPNAME_PROMPTROLLBACKCOST = TEXT('PROMPTROLLBACKCOST');
{$EXTERNALSYM IPROPNAME_PROMPTROLLBACKCOST}
IPROPVALUE_RBCOST_PROMPT = TEXT('P');
{$EXTERNALSYM IPROPVALUE_RBCOST_PROMPT}
IPROPVALUE_RBCOST_SILENT = TEXT('D');
{$EXTERNALSYM IPROPVALUE_RBCOST_SILENT}
IPROPVALUE_RBCOST_FAIL = TEXT('F');
{$EXTERNALSYM IPROPVALUE_RBCOST_FAIL}
// Property for custom actions to communicate
IPROPNAME_CUSTOMACTIONDATA = TEXT('CustomActionData');
{$EXTERNALSYM IPROPNAME_CUSTOMACTIONDATA}
//------------------------------------------------------------------------------
// TOP-LEVEL ACTION NAMES
//------------------------------------------------------------------------------
IACTIONNAME_INSTALL = TEXT('INSTALL');
{$EXTERNALSYM IACTIONNAME_INSTALL}
IACTIONNAME_ADVERTISE = TEXT('ADVERTISE');
{$EXTERNALSYM IACTIONNAME_ADVERTISE}
IACTIONNAME_ADMIN = TEXT('ADMIN');
{$EXTERNALSYM IACTIONNAME_ADMIN}
IACTIONNAME_SEQUENCE = TEXT('SEQUENCE');
{$EXTERNALSYM IACTIONNAME_SEQUENCE}
IACTIONNAME_COLLECTUSERINFO = TEXT('CollectUserInfo');
{$EXTERNALSYM IACTIONNAME_COLLECTUSERINFO}
IACTIONNAME_FIRSTRUN = TEXT('FirstRun');
{$EXTERNALSYM IACTIONNAME_FIRSTRUN}
//------------------------------------------------------------------------------
// SummaryInformation property stream property IDs
//------------------------------------------------------------------------------
// standard property definitions, from OLE2 documentation
PID_DICTIONARY = 0; // integer count + array of entries
{$EXTERNALSYM PID_DICTIONARY}
PID_CODEPAGE = 1; // short integer
{$EXTERNALSYM PID_CODEPAGE}
PID_TITLE = 2; // string
{$EXTERNALSYM PID_TITLE}
PID_SUBJECT = 3; // string
{$EXTERNALSYM PID_SUBJECT}
PID_AUTHOR = 4; // string
{$EXTERNALSYM PID_AUTHOR}
PID_KEYWORDS = 5; // string
{$EXTERNALSYM PID_KEYWORDS}
PID_COMMENTS = 6; // string
{$EXTERNALSYM PID_COMMENTS}
PID_TEMPLATE = 7; // string
{$EXTERNALSYM PID_TEMPLATE}
PID_LASTAUTHOR = 8; // string
{$EXTERNALSYM PID_LASTAUTHOR}
PID_REVNUMBER = 9; // string
{$EXTERNALSYM PID_REVNUMBER}
PID_EDITTIME = 10; // datatime
{$EXTERNALSYM PID_EDITTIME}
PID_LASTPRINTED = 11; // datetime
{$EXTERNALSYM PID_LASTPRINTED}
PID_CREATE_DTM = 12; // datetime
{$EXTERNALSYM PID_CREATE_DTM}
PID_LASTSAVE_DTM = 13; // datetime
{$EXTERNALSYM PID_LASTSAVE_DTM}
PID_PAGECOUNT = 14; // integer
{$EXTERNALSYM PID_PAGECOUNT}
PID_WORDCOUNT = 15; // integer
{$EXTERNALSYM PID_WORDCOUNT}
PID_CHARCOUNT = 16; // integer
{$EXTERNALSYM PID_CHARCOUNT}
PID_THUMBNAIL = 17; // clipboard format + metafile/bitmap (not supported)
{$EXTERNALSYM PID_THUMBNAIL}
PID_APPNAME = 18; // string
{$EXTERNALSYM PID_APPNAME}
PID_SECURITY = 19; // integer
{$EXTERNALSYM PID_SECURITY}
// PIDs given specific meanings for Installer
PID_MSIVERSION = PID_PAGECOUNT; // integer, Installer version number (major*100+minor)
{$EXTERNALSYM PID_MSIVERSION}
PID_MSISOURCE = PID_WORDCOUNT; // integer, type of file image, short/long, media/tree
{$EXTERNALSYM PID_MSISOURCE}
PID_MSIRESTRICT = PID_CHARCOUNT; // integer, transform restrictions
{$EXTERNALSYM PID_MSIRESTRICT}
//------------------------------------------------------------------------------
// INSTALLER DATABASE INTEGER COLUMN DEFINITIONS
//------------------------------------------------------------------------------
// BBControl.Attributes
// Control.Attributes
type
msidbControlAttributes = DWORD;
{$EXTERNALSYM msidbControlAttributes}
const
msidbControlAttributesVisible = $00000001;
{$EXTERNALSYM msidbControlAttributesVisible}
msidbControlAttributesEnabled = $00000002;
{$EXTERNALSYM msidbControlAttributesEnabled}
msidbControlAttributesSunken = $00000004;
{$EXTERNALSYM msidbControlAttributesSunken}
msidbControlAttributesIndirect = $00000008;
{$EXTERNALSYM msidbControlAttributesIndirect}
msidbControlAttributesInteger = $00000010;
{$EXTERNALSYM msidbControlAttributesInteger}
msidbControlAttributesRTLRO = $00000020;
{$EXTERNALSYM msidbControlAttributesRTLRO}
msidbControlAttributesRightAligned = $00000040;
{$EXTERNALSYM msidbControlAttributesRightAligned}
msidbControlAttributesLeftScroll = $00000080;
{$EXTERNALSYM msidbControlAttributesLeftScroll}
msidbControlAttributesBiDi = msidbControlAttributesRTLRO or
msidbControlAttributesRightAligned or msidbControlAttributesLeftScroll;
{$EXTERNALSYM msidbControlAttributesBiDi}
// Text controls
msidbControlAttributesTransparent = $00010000;
{$EXTERNALSYM msidbControlAttributesTransparent}
msidbControlAttributesNoPrefix = $00020000;
{$EXTERNALSYM msidbControlAttributesNoPrefix}
msidbControlAttributesNoWrap = $00040000;
{$EXTERNALSYM msidbControlAttributesNoWrap}
msidbControlAttributesFormatSize = $00080000;
{$EXTERNALSYM msidbControlAttributesFormatSize}
msidbControlAttributesUsersLanguage = $00100000;
{$EXTERNALSYM msidbControlAttributesUsersLanguage}
// Edit controls
msidbControlAttributesMultiline = $00010000;
{$EXTERNALSYM msidbControlAttributesMultiline}
msidbControlAttributesPasswordInput = $00200000;
{$EXTERNALSYM msidbControlAttributesPasswordInput}
// ProgressBar controls
msidbControlAttributesProgress95 = $00010000;
{$EXTERNALSYM msidbControlAttributesProgress95}
// VolumeSelectCombo and DirectoryCombo controls
msidbControlAttributesRemovableVolume = $00010000;
{$EXTERNALSYM msidbControlAttributesRemovableVolume}
msidbControlAttributesFixedVolume = $00020000;
{$EXTERNALSYM msidbControlAttributesFixedVolume}
msidbControlAttributesRemoteVolume = $00040000;
{$EXTERNALSYM msidbControlAttributesRemoteVolume}
msidbControlAttributesCDROMVolume = $00080000;
{$EXTERNALSYM msidbControlAttributesCDROMVolume}
msidbControlAttributesRAMDiskVolume = $00100000;
{$EXTERNALSYM msidbControlAttributesRAMDiskVolume}
msidbControlAttributesFloppyVolume = $00200000;
{$EXTERNALSYM msidbControlAttributesFloppyVolume}
// VolumeCostList controls
msidbControlShowRollbackCost = $00400000;
{$EXTERNALSYM msidbControlShowRollbackCost}
// ListBox and ComboBox controls
msidbControlAttributesSorted = $00010000;
{$EXTERNALSYM msidbControlAttributesSorted}
msidbControlAttributesComboList = $00020000;
{$EXTERNALSYM msidbControlAttributesComboList}
// picture button controls
msidbControlAttributesImageHandle = $00010000;
{$EXTERNALSYM msidbControlAttributesImageHandle}
msidbControlAttributesPushLike = $00020000;
{$EXTERNALSYM msidbControlAttributesPushLike}
msidbControlAttributesBitmap = $00040000;
{$EXTERNALSYM msidbControlAttributesBitmap}
msidbControlAttributesIcon = $00080000;
{$EXTERNALSYM msidbControlAttributesIcon}
msidbControlAttributesFixedSize = $00100000;
{$EXTERNALSYM msidbControlAttributesFixedSize}
msidbControlAttributesIconSize16 = $00200000;
{$EXTERNALSYM msidbControlAttributesIconSize16}
msidbControlAttributesIconSize32 = $00400000;
{$EXTERNALSYM msidbControlAttributesIconSize32}
msidbControlAttributesIconSize48 = $00600000;
{$EXTERNALSYM msidbControlAttributesIconSize48}
// RadioButton controls
msidbControlAttributesHasBorder = $01000000;
{$EXTERNALSYM msidbControlAttributesHasBorder}
// CompLocator.Type
// IniLocator.Type
// RegLocator.Type
type
msidbLocatorType = DWORD;
{$EXTERNALSYM msidbLocatorType}
const
msidbLocatorTypeDirectory = $00000000;
{$EXTERNALSYM msidbLocatorTypeDirectory}
msidbLocatorTypeFileName = $00000001;
{$EXTERNALSYM msidbLocatorTypeFileName}
msidbLocatorTypeRawValue = $00000002;
{$EXTERNALSYM msidbLocatorTypeRawValue}
msidbLocatorType64bit = $00000010;
{$EXTERNALSYM msidbLocatorType64bit}
// Component.Attributes
type
msidbComponentAttributes = DWORD;
{$EXTERNALSYM msidbComponentAttributes}
const
msidbComponentAttributesLocalOnly = $00000000;
{$EXTERNALSYM msidbComponentAttributesLocalOnly}
msidbComponentAttributesSourceOnly = $00000001;
{$EXTERNALSYM msidbComponentAttributesSourceOnly}
msidbComponentAttributesOptional = $00000002; // local or source
{$EXTERNALSYM msidbComponentAttributesOptional}
msidbComponentAttributesRegistryKeyPath = $00000004; // KeyPath is key to Registry table
{$EXTERNALSYM msidbComponentAttributesRegistryKeyPath}
msidbComponentAttributesSharedDllRefCount = $00000008; // increment SharedDll count
{$EXTERNALSYM msidbComponentAttributesSharedDllRefCount}
msidbComponentAttributesPermanent = $00000010; // never uninstall component
{$EXTERNALSYM msidbComponentAttributesPermanent}
msidbComponentAttributesODBCDataSource = $00000020; // KeyFile is key to ODBCDataSource table
{$EXTERNALSYM msidbComponentAttributesODBCDataSource}
msidbComponentAttributesTransitive = $00000040; // Can transition to/from installed/uninstalled based on changing conditional
{$EXTERNALSYM msidbComponentAttributesTransitive}
msidbComponentAttributesNeverOverwrite = $00000080; // dont stomp over existing component if key path exists (file/ regkey)
{$EXTERNALSYM msidbComponentAttributesNeverOverwrite}
msidbComponentAttributes64bit = $00000100; // designates a 64-bit component; 32-bit if missing.
{$EXTERNALSYM msidbComponentAttributes64bit}
// Assembly.Attributes
type
msidbAssemblyAttributes = DWORD;
{$EXTERNALSYM msidbAssemblyAttributes}
const
msidbAssemblyAttributesURT = $00000000;
{$EXTERNALSYM msidbAssemblyAttributesURT}
msidbAssemblyAttributesWin32 = $00000001;
{$EXTERNALSYM msidbAssemblyAttributesWin32}
// CustomAction.Type
type
msidbCustomActionType = DWORD;
{$EXTERNALSYM msidbCustomActionType}
const
// executable types
msidbCustomActionTypeDll = $00000001; // Target = entry point name
{$EXTERNALSYM msidbCustomActionTypeDll}
msidbCustomActionTypeExe = $00000002; // Target = command line args
{$EXTERNALSYM msidbCustomActionTypeExe}
msidbCustomActionTypeTextData = $00000003; // Target = text string to be formatted and set into property
{$EXTERNALSYM msidbCustomActionTypeTextData}
msidbCustomActionTypeJScript = $00000005; // Target = entry point name, null if none to call
{$EXTERNALSYM msidbCustomActionTypeJScript}
msidbCustomActionTypeVBScript = $00000006; // Target = entry point name, null if none to call
{$EXTERNALSYM msidbCustomActionTypeVBScript}
msidbCustomActionTypeInstall = $00000007; // Target = property list for nested engine initialization
{$EXTERNALSYM msidbCustomActionTypeInstall}
// source of code
msidbCustomActionTypeBinaryData = $00000000; // Source = Binary.Name, data stored in stream
{$EXTERNALSYM msidbCustomActionTypeBinaryData}
msidbCustomActionTypeSourceFile = $00000010; // Source = File.File, file part of installation
{$EXTERNALSYM msidbCustomActionTypeSourceFile}
msidbCustomActionTypeDirectory = $00000020; // Source = Directory.Directory, folder containing existing file
{$EXTERNALSYM msidbCustomActionTypeDirectory}
msidbCustomActionTypeProperty = $00000030; // Source = Property.Property, full path to executable
{$EXTERNALSYM msidbCustomActionTypeProperty}
// return processing // default is syncronous execution, process return code
msidbCustomActionTypeContinue = $00000040; // ignore action return status, continue running
{$EXTERNALSYM msidbCustomActionTypeContinue}
msidbCustomActionTypeAsync = $00000080; // run asynchronously
{$EXTERNALSYM msidbCustomActionTypeAsync}
// execution scheduling flags // default is execute whenever sequenced
msidbCustomActionTypeFirstSequence = $00000100; // skip if UI sequence already run
{$EXTERNALSYM msidbCustomActionTypeFirstSequence}
msidbCustomActionTypeOncePerProcess = $00000200; // skip if UI sequence already run in same process
{$EXTERNALSYM msidbCustomActionTypeOncePerProcess}
msidbCustomActionTypeClientRepeat = $00000300; // run on client only if UI already run on client
{$EXTERNALSYM msidbCustomActionTypeClientRepeat}
msidbCustomActionTypeInScript = $00000400; // queue for execution within script
{$EXTERNALSYM msidbCustomActionTypeInScript}
msidbCustomActionTypeRollback = $00000100; // in conjunction with InScript: queue in Rollback script
{$EXTERNALSYM msidbCustomActionTypeRollback}
msidbCustomActionTypeCommit = $00000200; // in conjunction with InScript: run Commit ops from script on success
{$EXTERNALSYM msidbCustomActionTypeCommit}
// security context flag, default to impersonate as user, valid only if InScript
msidbCustomActionTypeNoImpersonate = $00000800; // no impersonation, run in system context
{$EXTERNALSYM msidbCustomActionTypeNoImpersonate}
//#if (_WIN32_MSI >= 150)
msidbCustomActionTypeTSAware = $00004000; // impersonate for per-machine installs on TS machines
{$EXTERNALSYM msidbCustomActionTypeTSAware}
//#endif // (_WIN32_MSI >= 150)
// script requires 64bit process
msidbCustomActionType64BitScript = $00001000; // script should run in 64bit process
{$EXTERNALSYM msidbCustomActionType64BitScript}
// don't record the contents of the Target field in the log file.
msidbCustomActionTypeHideTarget = $00002000;
{$EXTERNALSYM msidbCustomActionTypeHideTarget}
// Dialog.Attributes
type
msidbDialogAttributes = DWORD;
{$EXTERNALSYM msidbDialogAttributes}
const
msidbDialogAttributesVisible = $00000001;
{$EXTERNALSYM msidbDialogAttributesVisible}
msidbDialogAttributesModal = $00000002;
{$EXTERNALSYM msidbDialogAttributesModal}
msidbDialogAttributesMinimize = $00000004;
{$EXTERNALSYM msidbDialogAttributesMinimize}
msidbDialogAttributesSysModal = $00000008;
{$EXTERNALSYM msidbDialogAttributesSysModal}
msidbDialogAttributesKeepModeless = $00000010;
{$EXTERNALSYM msidbDialogAttributesKeepModeless}
msidbDialogAttributesTrackDiskSpace = $00000020;
{$EXTERNALSYM msidbDialogAttributesTrackDiskSpace}
msidbDialogAttributesUseCustomPalette = $00000040;
{$EXTERNALSYM msidbDialogAttributesUseCustomPalette}
msidbDialogAttributesRTLRO = $00000080;
{$EXTERNALSYM msidbDialogAttributesRTLRO}
msidbDialogAttributesRightAligned = $00000100;
{$EXTERNALSYM msidbDialogAttributesRightAligned}
msidbDialogAttributesLeftScroll = $00000200;
{$EXTERNALSYM msidbDialogAttributesLeftScroll}
msidbDialogAttributesBiDi = msidbDialogAttributesRTLRO or
msidbDialogAttributesRightAligned or msidbDialogAttributesLeftScroll;
{$EXTERNALSYM msidbDialogAttributesBiDi}
msidbDialogAttributesError = $00010000;
{$EXTERNALSYM msidbDialogAttributesError}
// Feature.Attributes
type
msidbFeatureAttributes = DWORD;
{$EXTERNALSYM msidbFeatureAttributes}
const
msidbFeatureAttributesFavorLocal = $00000000;
{$EXTERNALSYM msidbFeatureAttributesFavorLocal}
msidbFeatureAttributesFavorSource = $00000001;
{$EXTERNALSYM msidbFeatureAttributesFavorSource}
msidbFeatureAttributesFollowParent = $00000002;
{$EXTERNALSYM msidbFeatureAttributesFollowParent}
msidbFeatureAttributesFavorAdvertise = $00000004;
{$EXTERNALSYM msidbFeatureAttributesFavorAdvertise}
msidbFeatureAttributesDisallowAdvertise = $00000008;
{$EXTERNALSYM msidbFeatureAttributesDisallowAdvertise}
msidbFeatureAttributesUIDisallowAbsent = $00000010;
{$EXTERNALSYM msidbFeatureAttributesUIDisallowAbsent}
msidbFeatureAttributesNoUnsupportedAdvertise = $00000020;
{$EXTERNALSYM msidbFeatureAttributesNoUnsupportedAdvertise}
// File.Attributes
type
msidbFileAttributes = DWORD;
{$EXTERNALSYM msidbFileAttributes}
const
msidbFileAttributesReadOnly = $00000001;
{$EXTERNALSYM msidbFileAttributesReadOnly}
msidbFileAttributesHidden = $00000002;
{$EXTERNALSYM msidbFileAttributesHidden}
msidbFileAttributesSystem = $00000004;
{$EXTERNALSYM msidbFileAttributesSystem}
msidbFileAttributesReserved0 = $00000008; // Internal use only - must be 0
{$EXTERNALSYM msidbFileAttributesReserved0}
msidbFileAttributesReserved1 = $00000040; // Internal use only - must be 0
{$EXTERNALSYM msidbFileAttributesReserved1}
msidbFileAttributesReserved2 = $00000080; // Internal use only - must be 0
{$EXTERNALSYM msidbFileAttributesReserved2}
msidbFileAttributesReserved3 = $00000100; // Internal use only - must be 0
{$EXTERNALSYM msidbFileAttributesReserved3}
msidbFileAttributesVital = $00000200;
{$EXTERNALSYM msidbFileAttributesVital}
msidbFileAttributesChecksum = $00000400;
{$EXTERNALSYM msidbFileAttributesChecksum}
msidbFileAttributesPatchAdded = $00001000; // Internal use only - set by patches
{$EXTERNALSYM msidbFileAttributesPatchAdded}
msidbFileAttributesNoncompressed = $00002000;
{$EXTERNALSYM msidbFileAttributesNoncompressed}
msidbFileAttributesCompressed = $00004000;
{$EXTERNALSYM msidbFileAttributesCompressed}
msidbFileAttributesReserved4 = $00008000; // Internal use only - must be 0
{$EXTERNALSYM msidbFileAttributesReserved4}
// IniFile.Action
// RemoveIniFile.Action
type
msidbIniFileAction = DWORD;
{$EXTERNALSYM msidbIniFileAction}
const
msidbIniFileActionAddLine = $00000000;
{$EXTERNALSYM msidbIniFileActionAddLine}
msidbIniFileActionCreateLine = $00000001;
{$EXTERNALSYM msidbIniFileActionCreateLine}
msidbIniFileActionRemoveLine = $00000002;
{$EXTERNALSYM msidbIniFileActionRemoveLine}
msidbIniFileActionAddTag = $00000003;
{$EXTERNALSYM msidbIniFileActionAddTag}
msidbIniFileActionRemoveTag = $00000004;
{$EXTERNALSYM msidbIniFileActionRemoveTag}
// MoveFile.Options
type
msidbMoveFileOptions = DWORD;
{$EXTERNALSYM msidbMoveFileOptions}
const
msidbMoveFileOptionsMove = $00000001;
{$EXTERNALSYM msidbMoveFileOptionsMove}
// ODBCDataSource.Registration
type
msidbODBCDataSourceRegistration = DWORD;
{$EXTERNALSYM msidbODBCDataSourceRegistration}
const
msidbODBCDataSourceRegistrationPerMachine = $00000000;
{$EXTERNALSYM msidbODBCDataSourceRegistrationPerMachine}
msidbODBCDataSourceRegistrationPerUser = $00000001;
{$EXTERNALSYM msidbODBCDataSourceRegistrationPerUser}
// Class.Attributes
type
msidbClassAttributes = DWORD;
{$EXTERNALSYM msidbClassAttributes}
const
msidbClassAttributesRelativePath = $00000001;
{$EXTERNALSYM msidbClassAttributesRelativePath}
// Patch.Attributes
type
msidbPatchAttributes = DWORD;
{$EXTERNALSYM msidbPatchAttributes}
const
msidbPatchAttributesNonVital = $00000001;
{$EXTERNALSYM msidbPatchAttributesNonVital}
// Registry.Root
// RegLocator.Root
// RemoveRegistry.Root
type
msidbRegistryRoot = DWORD;
{$EXTERNALSYM msidbRegistryRoot}
const
msidbRegistryRootClassesRoot = 0;
{$EXTERNALSYM msidbRegistryRootClassesRoot}
msidbRegistryRootCurrentUser = 1;
{$EXTERNALSYM msidbRegistryRootCurrentUser}
msidbRegistryRootLocalMachine = 2;
{$EXTERNALSYM msidbRegistryRootLocalMachine}
msidbRegistryRootUsers = 3;
{$EXTERNALSYM msidbRegistryRootUsers}
// RemoveFile.InstallMode
type
msidbRemoveFileInstallMode = DWORD;
{$EXTERNALSYM msidbRemoveFileInstallMode}
const
msidbRemoveFileInstallModeOnInstall = $00000001;
{$EXTERNALSYM msidbRemoveFileInstallModeOnInstall}
msidbRemoveFileInstallModeOnRemove = $00000002;
{$EXTERNALSYM msidbRemoveFileInstallModeOnRemove}
msidbRemoveFileInstallModeOnBoth = $00000003;
{$EXTERNALSYM msidbRemoveFileInstallModeOnBoth}
// ServiceControl.Event
type
msidbServiceControlEvent = DWORD;
{$EXTERNALSYM msidbServiceControlEvent}
const
msidbServiceControlEventStart = $00000001;
{$EXTERNALSYM msidbServiceControlEventStart}
msidbServiceControlEventStop = $00000002;
{$EXTERNALSYM msidbServiceControlEventStop}
msidbServiceControlEventDelete = $00000008;
{$EXTERNALSYM msidbServiceControlEventDelete}
msidbServiceControlEventUninstallStart = $00000010;
{$EXTERNALSYM msidbServiceControlEventUninstallStart}
msidbServiceControlEventUninstallStop = $00000020;
{$EXTERNALSYM msidbServiceControlEventUninstallStop}
msidbServiceControlEventUninstallDelete = $00000080;
{$EXTERNALSYM msidbServiceControlEventUninstallDelete}
// ServiceInstall.ErrorControl
type
msidbServiceInstallErrorControl = DWORD;
{$EXTERNALSYM msidbServiceInstallErrorControl}
const
msidbServiceInstallErrorControlVital = $00008000;
{$EXTERNALSYM msidbServiceInstallErrorControlVital}
// TextStyle.StyleBits
type
msidbTextStyleStyleBits = DWORD;
{$EXTERNALSYM msidbTextStyleStyleBits}
const
msidbTextStyleStyleBitsBold = $00000001;
{$EXTERNALSYM msidbTextStyleStyleBitsBold}
msidbTextStyleStyleBitsItalic = $00000002;
{$EXTERNALSYM msidbTextStyleStyleBitsItalic}
msidbTextStyleStyleBitsUnderline = $00000004;
{$EXTERNALSYM msidbTextStyleStyleBitsUnderline}
msidbTextStyleStyleBitsStrike = $00000008;
{$EXTERNALSYM msidbTextStyleStyleBitsStrike}
// Upgrade.Attributes
type
msidbUpgradeAttributes = DWORD;
{$EXTERNALSYM msidbUpgradeAttributes}
const
msidbUpgradeAttributesMigrateFeatures = $00000001;
{$EXTERNALSYM msidbUpgradeAttributesMigrateFeatures}
msidbUpgradeAttributesOnlyDetect = $00000002;
{$EXTERNALSYM msidbUpgradeAttributesOnlyDetect}
msidbUpgradeAttributesIgnoreRemoveFailure = $00000004;
{$EXTERNALSYM msidbUpgradeAttributesIgnoreRemoveFailure}
msidbUpgradeAttributesVersionMinInclusive = $00000100;
{$EXTERNALSYM msidbUpgradeAttributesVersionMinInclusive}
msidbUpgradeAttributesVersionMaxInclusive = $00000200;
{$EXTERNALSYM msidbUpgradeAttributesVersionMaxInclusive}
msidbUpgradeAttributesLanguagesExclusive = $00000400;
{$EXTERNALSYM msidbUpgradeAttributesLanguagesExclusive}
//------------------------------------------------------------------------------
// SUMMARY INFORMATION PROPERTY DEFINITIONS
//------------------------------------------------------------------------------
type
msidbSumInfoSourceType = DWORD;
{$EXTERNALSYM msidbSumInfoSourceType}
const
msidbSumInfoSourceTypeSFN = $00000001; // source uses short filenames
{$EXTERNALSYM msidbSumInfoSourceTypeSFN}
msidbSumInfoSourceTypeCompressed = $00000002; // source is compressed
{$EXTERNALSYM msidbSumInfoSourceTypeCompressed}
msidbSumInfoSourceTypeAdminImage = $00000004; // source is an admin image
{$EXTERNALSYM msidbSumInfoSourceTypeAdminImage}
{$ENDIF JWA_IMPLEMENTATIONSECTION}
{$IFNDEF JWA_OMIT_SECTIONS}
implementation
//uses ...
{$ENDIF JWA_OMIT_SECTIONS}
{$IFNDEF JWA_INTERFACESECTION}
//your implementation here
{$ENDIF JWA_INTERFACESECTION}
{$IFNDEF JWA_OMIT_SECTIONS}
end.
{$ENDIF JWA_OMIT_SECTIONS}
| 44.576427 | 153 | 0.735468 |
8398a82c97b23833078d41c27e45fcf6473089f3 | 39,128 | pas | Pascal | Source/JvDockVSNetStyleSpTBX.pas | YWtheGod/pyscripter | 0f9807ea188a049dda099f97fe03b2e12b0ec4b3 | [
"MIT"
]
| 1 | 2022-03-22T16:32:27.000Z | 2022-03-22T16:32:27.000Z | Source/JvDockVSNetStyleSpTBX.pas | YWtheGod/pyscripter | 0f9807ea188a049dda099f97fe03b2e12b0ec4b3 | [
"MIT"
]
| null | null | null | Source/JvDockVSNetStyleSpTBX.pas | YWtheGod/pyscripter | 0f9807ea188a049dda099f97fe03b2e12b0ec4b3 | [
"MIT"
]
| null | null | null | {-----------------------------------------------------------------------------
Unit Name: TJvDockVSNETTBX
Author: Kiriakos Vlahos
Date: 01-May-2009
Purpose: SpTBX themed TJvDockVSNETTree docking style for JvDocking
History:
-----------------------------------------------------------------------------}
unit JvDockVSNetStyleSpTBX;
{$I jvcl.inc}
interface
uses
Winapi.Messages,
Winapi.Windows,
System.SysUtils,
System.Classes,
Vcl.Controls,
Vcl.Graphics,
Vcl.ComCtrls,
Vcl.ExtCtrls,
SpTBXSkins,
JvDockTree,
JvDockControlForm,
JvDockSupportControl,
JvDockVSNetStyle;
Type
TJvDockVSNETSpTBXConjoinServerOption = class(TJvDockVSNETConjoinServerOption)
protected
procedure UpdateDefaultSystemCaptionInfo; override;
procedure Changed; override;
public
constructor Create(ADockStyle: TJvDockObservableStyle); override;
published
property GrabbersSize stored IsNotSystemInfo;
property SplitterWidth stored IsNotSystemInfo;
end;
TJvDockVSNETTreeSpTBX = class(TJvDockVSNETTree)
protected
procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE;
procedure DrawDockGrabber(Control: TWinControl; const ARect: TRect); override;
procedure DrawAutoHideButton(Zone: TJvDockZone;
Left, Top: Integer); override;
procedure DrawCloseButton(Canvas: TCanvas;
Zone: TJvDockZone; Left, Top: Integer); override;
//procedure GetCaptionRect(var Rect: TRect); override;
procedure DrawSplitterRect(const ARect: TRect); override;
procedure SyncWithStyle; override;
public
constructor Create(DockSite: TWinControl; DockZoneClass: TJvDockZoneClass;
ADockStyle: TJvDockObservableStyle); override;
destructor Destroy; override;
end;
TJvDockVSNETTabPanelSpTBX = class(TJvDockVSNETTabPanel)
protected
procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE;
procedure Paint; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
TJvDockVSNETTabSheetSpTBX = class(TJvDockVSNETTabSheet)
private
procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND;
protected
procedure AdjustClientRect(var Rect: TRect); override;
end;
TJvDockVSNETTabPageControlSpTBX = class(TJvDockVSNETTabPageControl)
private
procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE;
protected
procedure CreatePanel; override;
procedure AdjustClientRect(var Rect: TRect); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
TJvDockVSNETPanelSpTBX = class(TJvDockVSNETPanel)
protected
procedure AddDockServer(ADockServer: TJvDockServer); override;
procedure OnPaintSplitter(Sender : TObject);
public
constructor Create(AOwner: TComponent); override;
end;
TJvDockVSChannelSpTBX = class(TJvDockVSChannel)
protected
procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE;
procedure Paint; override;
procedure PopupPaneChanged; override;
procedure ResetFontAngle; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
TMouseLoc = (mlNone, mlOver, mlDown);
TJvDockVSNETSplitterSpTBX = class(TJvDockVSNETSplitter)
private
FMouseLoc: TMouseLoc;
FMouseOver: boolean;
FMouseDown: boolean;
protected
procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure Paint; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property ResizeStyle default rsUpdate;
end;
TJvDockVSNetStyleSpTBX = class(TJvDockVSNetStyle)
protected
procedure CreateServerOption; override; { AfterConstruction }
public
constructor Create(AOwner: TComponent); override;
procedure SetDockBaseControl(IsCreate: Boolean; DockBaseControl: TJvDockBaseControl); override;
end;
procedure Register;
implementation
Uses
Winapi.CommCtrl,
System.Math,
System.Types,
Vcl.Forms,
Vcl.Themes,
JvDockVIDStyle,
SpTBXDkPanels,
SpTBXItem,
JvDockGlobals,
JvDockSupportProc,
SpTBXTabs,
TB2Common,
TB2Item;
procedure Register;
begin
RegisterComponents('PyScripter Custom', [TJvDockVSNetStyleSpTBX]);
end;
const
TabSheetBorderSize = 2; // to match SpTBX TabSheet border size
procedure ResizeBitmap(Bitmap: TBitmap; const NewWidth, NewHeight: integer);
var
buffer: TBitmap;
begin
buffer := TBitmap.Create;
try
buffer.SetSize(NewWidth, NewHeight);
buffer.Canvas.StretchDraw(Rect(0, 0, NewWidth, NewHeight), Bitmap);
Bitmap.SetSize(NewWidth, NewHeight);
Bitmap.Canvas.Draw(0, 0, buffer);
finally
buffer.Free;
end;
end;
procedure DrawGlyphPattern(DC: HDC; const R: TRect; Width, Height: Integer;
const PatternBits; PatternColor: TColor);
const
ROP_DSPDxax = $00E20746;
var
B: TBitmap;
OldTextColor, OldBkColor: Longword;
OldBrush, Brush: HBrush;
BitmapWidth, BitmapHeight: Integer;
begin
OldTextColor := SetTextColor(DC, clBlack);
OldBkColor := SetBkColor(DC, clWhite);
B := TBitmap.Create;
try
BitmapWidth := 8;
// if Width > BitmapWidth then BitmapWidth := Width;
BitmapHeight := 8;
// if Height > BitmapHeight then BitmapHeight := Height;
B.Handle := CreateBitmap(BitmapWidth, BitmapHeight, 1, 1, @PatternBits);
if (Width > 8) or (Height > 8) then
ResizeBitmap(B, Max(Width, Height), Max(Width, Height));
if PatternColor < 0 then Brush := GetSysColorBrush(PatternColor and $FF)
else Brush := CreateSolidBrush(PatternColor);
OldBrush := SelectObject(DC, Brush);
BitBlt(DC, (R.Left + R.Right + 1 - Width) div 2, (R.Top + R.Bottom + 1 - Height) div 2,
Width, Height, B.Canvas.Handle, 0, 0, ROP_DSPDxax);
SelectObject(DC, OldBrush);
if PatternColor >= 0 then DeleteObject(Brush);
finally
SetTextColor(DC, OldTextColor);
SetBkColor(DC, OldBkColor);
B.Free;
end;
end;
{ TJvDockVSNETTreeSpTBX }
constructor TJvDockVSNETTreeSpTBX.Create(DockSite: TWinControl;
DockZoneClass: TJvDockZoneClass; ADockStyle: TJvDockObservableStyle);
begin
inherited Create(DockSite, DockZoneClass, ADockStyle);;
GrabberSize := 22;
SplitterWidth := 5;
ButtonHeight := 14;
ButtonWidth := 14; //15
LeftOffset := 0; //0
RightOffset := 3;
TopOffset := 2; //4
BottomOffset := 2;
ButtonSplitter := 2;
CaptionLeftOffset := 5;
CaptionRightOffset := 5;
GrabberBottomEdgeColor := clNone;
SkinManager.AddSkinNotification(Self);
end;
Type
TCrackJvDockVSNETZone = class(TJvDockVSNETZone)
end;
TCrackJvDockVSBlock = class(TJvDockVSBlock)
end;
destructor TJvDockVSNETTreeSpTBX.Destroy;
begin
SkinManager.RemoveSkinNotification(Self);
inherited;
end;
procedure TJvDockVSNETTreeSpTBX.DrawAutoHideButton(Zone: TJvDockZone; Left,
Top: Integer);
const
AutoHidePattern1: array [0..15] of Byte = ($3E, 0, $26, 0, $26, 0, $26, 0, $7F, 0, $08, 0, $08, 0, $08, 0);
AutoHidePattern2: array [0..15] of Byte = ($10, 0, $1F, 0, $11, 0, $F1, 0, $F1, 0, $1F, 0, $1F, 0, $10, 0);
var
AZone: TCrackJvDockVSNETZone;
ADockClient: TJvDockClient;
PatternColor: TColor;
SkinState : TSpTBXSkinStatesType;
R : TRect;
begin
if Zone <> nil then
begin
ADockClient := FindDockClient(Zone.ChildControl);
if (ADockClient <> nil) and not ADockClient.EnableCloseButton then
Left := Left + ButtonWidth; // move the auto hide button to the Close Button's location
AZone := TCrackJvDockVSNETZone(Zone);
R := Rect(Left, Top, Left + ButtonWidth, Top + ButtonHeight);
if AZone.AutoHideBtnState = bsDown then
R.Offset(PPIScale(1), PPIScale(1));
if AZone.AutoHideBtnState = TJvDockBtnState.bsNormal then begin
PatternColor := CurrentSkin.GetTextColor(nil, skncDockablePanelTitleBar, sknsNormal);
if PatternColor = clNone then
PatternColor := CurrentSkin.GetTextColor(nil, skncToolbarItem, sknsNormal);
if PatternColor = clNone then
PatternColor := clCaptionText;
end else begin
SkinState := CurrentSkin.GetState(True, AZone.AutoHideBtnState = bsDown, AZone.AutoHideBtnState = bsUp, False);
//CurrentSkin.PaintBackground(Canvas, R, skncToolbarItem, SkinState, True, True);
SpDrawXPToolbarButton(nil, Canvas, R, SkinState, cpNone, FCurrentPPI);
PatternColor := CurrentSkin.GetTextColor(nil, skncToolbarItem, SkinState);
end;
if DockSite.Align in [alLeft, alRight, alTop, alBottom] then
DrawGlyphPattern(Canvas.Handle, R, PPIScale(8),
PPIScale(8), AutoHidePattern1[0], PatternColor)
else if DockSite.Align in [alNone] then
DrawGlyphPattern(Canvas.Handle, R, PPIScale(8),
PPIScale(8), AutoHidePattern2[0], PatternColor);
end;
end;
procedure TJvDockVSNETTreeSpTBX.DrawCloseButton(Canvas: TCanvas;
Zone: TJvDockZone; Left, Top: Integer);
var
AZone: TCrackJvDockVSNETZone;
ADockClient: TJvDockClient;
AForm: TForm;
PatternColor: TColor;
SkinState : TSpTBXSkinStatesType;
R : TRect;
begin
if Zone <> nil then
begin
ADockClient := FindDockClient(Zone.ChildControl);
if (ADockClient <> nil) and not ADockClient.EnableCloseButton then
Exit;
if Zone.ChildControl is TJvDockTabHostForm then
begin
AForm := TJvDockTabHostForm(Zone.ChildControl).GetActiveDockForm;
if AForm <> nil then
begin
ADockClient := FindDockClient(AForm);
if (ADockClient <> nil) and not ADockClient.EnableCloseButton then
Exit;
end;
end;
AZone := TCrackJvDockVSNETZone(Zone);
R := Rect(Left, Top, Left + ButtonWidth, Top + ButtonHeight);
if AZone.CloseBtnState = bsDown then
R.Offset(PPIScale(1), PPIScale(1));
if AZone.CloseBtnState = TJvDockBtnState.bsNormal then begin
PatternColor := CurrentSkin.GetTextColor(nil, skncDockablePanelTitleBar, sknsNormal);
if PatternColor = clNone then
PatternColor := CurrentSkin.GetTextColor(nil, skncToolbarItem, sknsNormal);
if PatternColor = clNone then
PatternColor := clCaptionText;
end else begin
SkinState := CurrentSkin.GetState(True, AZone.CloseBtnState = bsDown, AZone.CloseBtnState = bsUp, False);
SpDrawXPToolbarButton(nil, Canvas, R, SkinState, cpNone, FCurrentPPI);
//CurrentSkin.PaintBackground(Canvas, R, skncToolbarItem, SkinState, True, True);
PatternColor := CurrentSkin.GetTextColor(nil, skncToolbarItem, SkinState);
end;
SpDrawGlyphPattern(Canvas, R, gptClose, PatternColor, FCurrentPPI);
end;
end;
procedure TJvDockVSNETTreeSpTBX.DrawDockGrabber(Control: TWinControl;
const ARect: TRect);
var
DrawRect: TRect;
// IsActive : boolean;
PanelCaption: string;
CRect: TRect;
ShowCloseButtonOnGrabber: Boolean;
TabServerOption:TJvDockVIDTabServerOption;
State : TSpTBXSkinStatesType;
TextColor: TColor;
begin
Assert(Assigned(Control));
ShowCloseButtonOnGrabber := True;
if Assigned(DockStyle) then
if Control is TJvDockTabHostForm then
begin
TabServerOption := TJvDockVIDTabServerOption(TJvDockBasicStyle(DockStyle).TabServerOption);
ShowCloseButtonOnGrabber := TabServerOption.ShowCloseButtonOnGrabber;
end;
// Defaults should work if DockStyle is not set!
// -> Assert(DontAssume(Assigned(DockStyle)));
// IsActive := Assigned(Screen.ActiveControl) and Screen.ActiveControl.Focused and
// Control.ContainsControl(Screen.ActiveControl);
if GrabbersPosition <> gpTop then
begin
{$IFDEF JVDOCK_DEBUG}
OutputDebugString('Not supported GrabbersPosition');
{$ENDIF JVDOCK_DEBUG}
Exit;
end;
DrawRect := ARect;
Inc(DrawRect.Top, PPIScale(1));
DrawRect.Bottom := DrawRect.Top + GrabberSize - PPIScale(2);
CRect := DrawRect;
// Draw Background
SpDrawXPDock(nil, Canvas, ARect, False, FCurrentPPI);
SpDrawXPDockablePanelTitleBar(nil, Canvas, DrawRect, False, False, FCurrentPPI);
if ShowCloseButtonOnGrabber then
DrawCloseButton(Canvas, FindControlZone(Control),
ARect.Right - RightOffset - ButtonWidth - PPIScale(1),
ARect.Top + TopOffset);
if DockSite.Align <> alClient then
begin
DrawAutoHideButton(FindControlZone(Control),
ARect.Right - RightOffset - 2 * ButtonWidth - ButtonSplitter,
ARect.Top + TopOffset)
end;
// Now Draw Caption
Canvas.Font.Assign(ToolbarFont); // was SmCaptionFont
Canvas.Font.Height := MulDiv(ToolbarFont.Height, FCurrentPPI, ToolbarFont.PixelsPerInch);
GetCaptionRect( CRect );
PanelCaption := TForm(Control).Caption;
Canvas.Brush.Style := bsClear; // body already painted
State := CurrentSkin.GetState(True, False, False, False);
TextColor := CurrentSkin.GetTextColor(nil, skncDockablePanelTitleBar, State);
if TextColor = clNone then
TextColor := CurrentSkin.GetTextColor(nil, skncToolbarItem, State);
if TextColor = clNone then
TextColor := clCaptionText;
Canvas.Font.Color := TextColor;
JvDrawTextWithMiddleEllipsis(Canvas, PanelCaption,
CRect, DT_VCENTER or DT_SINGLELINE or DT_NOPREFIX);
// DrawText(Canvas.Handle, PChar(PanelCaption), Length(PanelCaption), CRect,
// DT_VCENTER or DT_SINGLELINE or DT_NOPREFIX or DT_END_ELLIPSIS);
end;
procedure PaintSplitterFrame(Canvas : TCanvas; IsVertical: Boolean; var R: TRect);
var
FrameBrush: HBRUSH;
begin
//Exit;
if IsVertical then
InflateRect(R, -1, 2)
else
InflateRect(R, 2, -1);
OffsetRect(R, 1, 1);
FrameBrush := CreateSolidBrush(ColorToRGB(StyleServices.GetSystemColor(clBtnHighlight)));
FrameRect(Canvas.Handle, R, FrameBrush);
DeleteObject(FrameBrush);
OffsetRect(R, -2, -2);
FrameBrush := CreateSolidBrush(ColorToRGB(StyleServices.GetSystemColor(clBtnShadow)));
FrameRect(Canvas.Handle, R, FrameBrush);
DeleteObject(FrameBrush);
end;
procedure TJvDockVSNETTreeSpTBX.DrawSplitterRect(const ARect: TRect);
function GetGripRect(R : TRect; IsVertical : Boolean) : TRect;
const
GripSize = 50;
begin
Result := R;
if IsVertical then
Result := Bounds(R.Left, (R.Bottom - R.Top - GripSize) div 2, R.Right - R.Left, GripSize)
else
Result := Bounds((R.Right - R.Left - GripSize) div 2, R.Top, GripSize, R.Bottom - R.Top);
end;
var
IsVertical: Boolean;
R, DragHandleR : TRect;
C1, C2 : TColor;
begin
IsVertical := ARect.Right - ARect.Left < ARect.Bottom - ARect.Top;
// Paint background
Canvas.Brush.Color := StyleServices.GetSystemColor(clBtnFace);
Canvas.FillRect(ARect);
PaintSplitterFrame(Canvas, IsVertical, R);
// Paint grip
R := GetGripRect(ARect, IsVertical);
DragHandleR := R;
if IsVertical then
InflateRect(DragHandleR, -1, -10)
else
InflateRect(DragHandleR, -10, -1);
C1 := StyleServices.GetSystemColor(clBtnShadow);
C2 := StyleServices.GetSystemColor(clWindow);
SpDrawXPGrip(Canvas, DragHandleR, C1, C2, FCurrentPPI);
end;
procedure TJvDockVSNETTreeSpTBX.SyncWithStyle;
begin
inherited;
TopOffset := (GrabberSize - ButtonHeight) div 2;
end;
{
procedure TJvDockVSNETTreeSpTBX.GetCaptionRect(var Rect: TRect);
var
ADockClient: TJvDockClient;
begin
if DockSite.Align = alClient then
inherited GetCaptionRect(Rect)
else
begin
Inc(Rect.Left, 2 + CaptionLeftOffset);
ADockClient := FindDockClient(DockSite);
Inc(Rect.Top, 1);
if (ADockClient = nil) or ADockClient.EnableCloseButton then
Dec(Rect.Right, 3 * ButtonWidth + ButtonSplitter + CaptionRightOffset - 1)
else
Dec(Rect.Right, 2 * ButtonWidth + ButtonSplitter + CaptionRightOffset - 1);
Dec(Rect.Bottom, 2);
end;
end;
}
procedure TJvDockVSNETTreeSpTBX.WMSpSkinChange(var Message: TMessage);
begin
UpdateAll;
DockSite.Invalidate;
end;
{ TJvDockVSNetStyleSpTBX }
constructor TJvDockVSNetStyleSpTBX.Create(AOwner: TComponent);
begin
inherited;
ConjoinPanelTreeClass := TJvDockVSNETTreeSpTBX;
DockPanelTreeClass := TJvDockVSNETTreeSpTBX;
TabDockClass := TJvDockVSNETTabPageControlSpTBX;
DockPanelClass := TJvDockVSNETPanelSpTBX;
DockSplitterClass := TJvDockVSNETSplitterSpTBX;
ConjoinServerOptionClass := TJvDockVSNETSpTBXConjoinServerOption;
end;
procedure TJvDockVSNetStyleSpTBX.CreateServerOption;
begin
inherited;
TabServerOption.HotTrack := True;
ChannelOption.ActivePaneSize := 250;
end;
procedure TJvDockVSNetStyleSpTBX.SetDockBaseControl(IsCreate: Boolean;
DockBaseControl: TJvDockBaseControl);
Var
DP : TJvDockPosition;
begin
inherited;
if DockBaseControl is TJvDockServer then begin
for DP := Low(TJvDockPosition) to High(TJvDockPosition) do begin
TJvDockServer(DockBaseControl).SplitterStyle[DP].Size := 5;
TJvDockServer(DockBaseControl).SplitterStyle[DP].ResizeStyle := rsUpdate;
end;
end;
end;
{ TJvDockVSNETTabPageControlSpTBX }
procedure TJvDockVSNETTabPageControlSpTBX.AdjustClientRect(var Rect: TRect);
begin
Rect := ClientRect;
if (Parent is TJvDockTabHostForm) and (VisibleDockClientCount = 1) then
Exit;
case TabPosition of
tpTop:
Inc(Rect.Top, (Panel as TJvDockVSNETTabPanelSpTBX).TabHeight);
tpBottom:
Dec(Rect.Bottom, (Panel as TJvDockVSNETTabPanelSpTBX).TabHeight);
tpLeft:
Inc(Rect.Left, (Panel as TJvDockVSNETTabPanelSpTBX).TabHeight);
tpRight:
Dec(Rect.Right, (Panel as TJvDockVSNETTabPanelSpTBX).TabHeight);
end;
end;
constructor TJvDockVSNETTabPageControlSpTBX.Create(AOwner: TComponent);
begin
inherited;
TabPanelClass := TJvDockVSNETTabPanelSpTBX;
TabSheetClass := TJvDockVSNETTabSheetSpTBX;
if Assigned(Images) then
Images.SetSize(PPIScale(20), PPIScale(20));
SkinManager.AddSkinNotification(Self);
end;
procedure TJvDockVSNETTabPageControlSpTBX.CreatePanel;
begin
inherited;
with Panel as TJvDockVSNETTabPanelSpTBX do begin
TabBottomOffset := 2;; // changed from 3
TabTopOffset := 2;
TabLeftOffset := 2;
TabRightOffset := 2;
TabSplitterWidth := 0;
Canvas.Font.Assign(ToolbarFont);
TabHeight :=
Max(MulDiv(Abs(ToolbarFont.Height), 96, ToolbarFont.PixelsPerInch) + 10, 29);
end;
end;
destructor TJvDockVSNETTabPageControlSpTBX.Destroy;
begin
SkinManager.RemoveSkinNotification(Self);
inherited;
end;
procedure TJvDockVSNETTabPageControlSpTBX.WMSpSkinChange(var Message: TMessage);
begin
if Assigned(ActivePage) then begin
ActivePage.Invalidate;
ActivePage.Realign;
end;
for var I := 0 to Count - 1 do
begin
var Page := Pages[i];
if (Page.Controls[0] is TForm) and TForm(Page.Controls[0]).Icon.HandleAllocated
and (Page.ImageIndex >= 0) then
begin
ImageList_ReplaceIcon(Images.Handle, Page.ImageIndex,
CopyIcon(TForm(Page.Controls[0]).Icon.Handle));
end;
end;
Panel.Invalidate;
end;
{ TJvDockVSNETTabPanelSpTBX }
Type
TCrackJvDockVIDTabSheet = class(TJvDockVIDTabSheet)
end;
constructor TJvDockVSNETTabPanelSpTBX.Create(AOwner: TComponent);
begin
inherited;
BevelInner := bvNone;
BevelOuter := bvNone;
BevelEdges := [];
BorderWidth := 0;
CaptionTopOffset := 5;
CaptionLeftOffset := 5;
CaptionRightOffset := 5;
SkinManager.AddSkinNotification(Self);
ControlStyle := ControlStyle + [csOpaque];
DoubleBuffered := True; // To avoid flicker
TabLeftOffset := 2;
end;
destructor TJvDockVSNETTabPanelSpTBX.Destroy;
begin
SkinManager.RemoveSkinNotification(Self);
inherited;
end;
procedure TJvDockVSNETTabPanelSpTBX.Paint;
var
ARect, R, BgRect, DockRect : TRect;
CurrTabWidth: Integer;
I, CompleteWidth: Integer;
ImageWidth: Integer;
CaptionString: string;
// Edge: TSpTBXTabEdge;
Position: TSpTBXTabPosition;
IsActive, IsHot : Boolean;
State: TSpTBXSkinStatesType;
TextColor: TColor;
Format: UINT;
FontHeight : Integer;
TM: TTextMetric;
ShowImage: Boolean;
begin
if Page = nil then
Exit;
if (Page.Images <> nil) and (Page.ShowTabImages) then
ImageWidth := Page.Images.Width
else
ImageWidth := 0;
// Paint the background of the panel
Assert(Page.TabPosition in [tpTop, tpBottom], RsEDockCannotSetTabPosition);
ARect := Rect(0, 0, PanelWidth, PanelHeight);
BgRect := ARect;
DockRect := ARect;
if Page.TabPosition = tpBottom then begin
Position := ttpBottom;
BgRect.Bottom := TabSheetBorderSize;
Dec(BgRect.Top); // This is needed for SpDrawXPTabControlBackground to work
DockRect.Top := TabSheetBorderSize;
end else begin
Position := ttpTop;
BgRect.Top := ARect.Bottom - TabSheetBorderSize;
Inc(BgRect.Bottom); // This is needed for SpDrawXPTabControlBackground to work
Dec(DockRect.Bottom, TabSheetBorderSize);
end;
// Set and scale Canvas font
Canvas.Font.Height := MulDiv(ToolbarFont.Height, FCurrentPPI, ToolbarFont.PixelsPerInch);
if GetTextMetrics(Canvas.Handle, TM) then
FontHeight := TM.tmHeight
else begin
FontHeight := Abs(Canvas.Font.Height);
if Canvas.Font.Height < 0 then
Inc(FontHeight, Page.PPIScale(3)); //tmInternalLeading
end;
// Paint the toolbar background
SpDrawXPTabControlBackground(nil, Canvas, DockRect, clBtnFace, Position = ttpBottom);
CompleteWidth := TabLeftOffset;
// Paint all the tabs
// Edge := tedLeft; // Only for the first visible tab
for I := 0 to Page.Count - 1 do
begin
if not Page.Pages[I].TabVisible then
Continue;
CurrTabWidth := TCrackJvDockVIDTabSheet(Page.Pages[I]).ShowTabWidth;
ShowImage := ShowTabImages and (Page.Images <> nil) and
(Page.Pages[I].ImageIndex >= 0) and
(CurrTabWidth > ImageWidth + 2 * CaptionLeftOffset);
// Calculate Button area
case Page.TabPosition of
tpTop:
R := Rect(CompleteWidth, TabTopOffset,
CompleteWidth + CurrTabWidth, PanelHeight - TabBottomOffset);
tpBottom:
R := Rect(CompleteWidth, TabBottomOffset,
CompleteWidth + CurrTabWidth, PanelHeight - TabTopOffset);
end;
IsActive := Page.ActivePageIndex = I;
IsHot := Page.HotTrack and (FSelectHotIndex = I);
// Button overflows into the Tabsheet area;
case Position of
ttpTop:
begin
Inc(R.Bottom, Page.PPIScale(4));
// maintain background border
if IsActive then begin
SpDrawXPTab(nil, Canvas, R, True, IsActive, False, False, Position, FCurrentPPI);
ExcludeClipRect(Canvas.Handle, R.Left + 1, ARect.Bottom - TabSheetBorderSize, R.Right - 1, ARect.Bottom);
end;
Dec(R.Bottom, Page.PPIScale(3));
end;
ttpBottom:
begin
Dec(R.Top, Page.PPIScale(4));
if IsActive then begin
SpDrawXPTab(nil, Canvas, R, True, IsActive, False, False, Position, FCurrentPPI);
ExcludeClipRect(Canvas.Handle, R.Left + 1, 0, R.Right - 1, TabSheetBorderSize);
end;
Inc(R.Top, Page.PPIScale(3));
end;
end;
if not IsActive then
case Position of
ttpTop: Inc(R.Top, Page.PPIScale(TabSheetBorderSize));
ttpBottom: Dec(R.Bottom, Page.PPIScale(TabSheetBorderSize));
end;
SpDrawXPTab(nil, Canvas, R, True, IsActive, IsHot, False, Position, FCurrentPPI);
// now paint the caption
Format := DT_LEFT or DT_SINGLELINE{ or DT_END_ELLIPSIS};
case Page.TabPosition of
tpTop:
begin
R := Rect(CompleteWidth + CaptionLeftOffset +
Integer(ShowImage) * (ImageWidth + CaptionLeftOffset),
TabTopOffset + CaptionTopOffset,
CompleteWidth + CurrTabWidth - CaptionRightOffset,
PanelHeight);
if IsActive then OffsetRect(R, 0, - Page.PPIScale(2));
Format := Format or DT_TOP;
end;
tpBottom:
begin
R := Rect(CompleteWidth + CaptionLeftOffset +
Integer(ShowImage) * (ImageWidth + CaptionLeftOffset),
0, CompleteWidth + CurrTabWidth - CaptionRightOffset,
PanelHeight - TabTopOffset - CaptionTopOffset);
if IsActive then OffsetRect(R, 0, Page.PPIScale(2));
Format := Format or DT_BOTTOM;
end;
end;
CaptionString := Page.Pages[I].Caption;
State := CurrentSkin.GetState(True, False, IsHot, IsActive);
TextColor := CurrentSkin.GetTextColor(nil, skncTab, State);
if TextColor = clNone then
TextColor := clBtnText;
Canvas.Font.Color := TextColor;
Canvas.Brush.Style := bsClear;
// DrawText(Canvas.Handle, PChar(CaptionString), Length(CaptionString),
// R, Format);
JvDrawTextWithMiddleEllipsis(Canvas, CaptionString, R, Format);
// finally paint the image
if ShowImage then
begin
case Page.TabPosition of
tpTop:
begin
R := Rect(CompleteWidth + CaptionLeftOffset,
TabTopOffset + CaptionTopOffset,
CompleteWidth + CaptionLeftOffset + ImageWidth,
TabTopOffset + CaptionTopOffset + FontHeight);
if IsActive then OffsetRect(R, 0, - Page.PPIScale(2));
end;
tpBottom:
begin
R := Rect(CompleteWidth + CaptionLeftOffset,
PanelHeight - TabTopOffset - CaptionTopOffset - FontHeight + 1,
CompleteWidth + CaptionLeftOffset + ImageWidth,
PanelHeight - TabTopOffset - CaptionTopOffset);
if IsActive then OffsetRect(R, 0, Page.PPIScale(2));
end;
end;
R := SpCenterRectVert(R, Page.Images.Height);
SpDrawVirtualImageList(Canvas, R, Page.Images, Page.Pages[I].ImageIndex, True);
end;
Inc(CompleteWidth, CurrTabWidth + TabSplitterWidth);
end;
// Paint one side of the TabSheet background after drawing the tabs;
SpDrawXPTabControlBackground(nil, Canvas, BgRect, Color, Page.TabPosition = tpBottom);
end;
procedure TJvDockVSNETTabPanelSpTBX.WMSpSkinChange(var Message: TMessage);
begin
Invalidate;
end;
{ TJvDockVSNETPanelSpTBX }
procedure TJvDockVSNETPanelSpTBX.AddDockServer(ADockServer: TJvDockServer);
begin
inherited;
if Assigned(VSChannel) then begin
VSChannel.VSPopupPanelSplitter.ResizeStyle := rsUpdate;
VSChannel.VSPopupPanelSplitter.SplitWidth := PPIScale(5);
VSChannel.VSPopupPanelSplitter.OnPaint := OnPaintSplitter;
end;
end;
constructor TJvDockVSNETPanelSpTBX.Create(AOwner: TComponent);
begin
inherited;
VSChannelClass := TJvDockVSChannelSpTBX;
end;
procedure TJvDockVSNETPanelSpTBX.OnPaintSplitter(Sender: TObject);
Var
R : TRect;
IsVertical : Boolean;
begin
if Assigned(Sender) and (Sender is TJvDockVSPopupPanelSplitter) then
with TJvDockVSPopupPanelSplitter(Sender) do begin
R := ClientRect;
IsVertical := R.Right - R.Left < R.Bottom - R.Top;
// Paint background
Canvas.Brush.Color := StyleServices.GetSystemColor(clBtnFace);
Canvas.FillRect(R);
PaintSplitterFrame(Canvas, IsVertical, R);
end;
end;
{ TJvDockVSChannelSpTBX }
constructor TJvDockVSChannelSpTBX.Create(AOwner: TComponent);
begin
inherited;
FBlockImageListSize := 20;
FInactiveBlockWidth := 28;
ControlStyle := ControlStyle + [csParentBackground];
DoubleBuffered := True;
SkinManager.AddSkinNotification(Self);
Canvas.Font.Assign(ToolbarFont);
ChannelWidth := // unscaled
Max(MulDiv(Abs(ToolbarFont.Height), 96, ToolbarFont.PixelsPerInch) + 10, 26);
end;
destructor TJvDockVSChannelSpTBX.Destroy;
begin
SkinManager.RemoveSkinNotification(Self);
inherited;
end;
procedure TJvDockVSChannelSpTBX.Paint;
var
I: Integer;
IsVertical : Boolean;
FontHeight : Integer;
TM: TTextMetric;
procedure DrawSingleBlock(Block: TJvDockVSBlock);
var
DrawRect, R: TRect;
I: Integer;
OldGraphicsMode: Integer;
VisiblePaneCount: Integer;
State : TSpTBXSkinStatesType;
TextColor: TColor;
IsChecked, IsHot: Boolean;
Flags : Integer;
procedure AdjustImagePos;
begin
R := DrawRect;
if Align in [alLeft, alRight] then begin
Inc(R.Top, PPIScale(4));
R.Bottom := R.Top + Block.ImageList.Height;
R := SpCenterRectHoriz(R, Block.ImageList.Width);
end else begin
Inc(R.Left, PPIScale(4));
R.Right := R.Left + Block.ImageList.Width;
R := SpCenterRectVert(R, Block.ImageList.Height);
end;
// if Align = alLeft then
// begin
// Inc(DrawRect.Left, 3);
// Inc(DrawRect.Top, 4);
// end
// else
// if Align = alTop then
// begin
// Inc(DrawRect.Left, 4);
// Inc(DrawRect.Top, 2);
// end
// else
// if Align = alRight then
// begin
// Inc(DrawRect.Left, 4);
// Inc(DrawRect.Top, 4);
// end
// else
// if Align = alBottom then
// begin
// Inc(DrawRect.Left, 4);
// Inc(DrawRect.Top, 3);
// end;
end;
begin
VisiblePaneCount := 0;
for I := 0 to Block.VSPaneCount - 1 do
begin
if not Block.VSPane[I].Visible then
Continue;
GetBlockRect(Block, I, DrawRect);
IsHot := TCrackJvDockVSBlock(Block).ActiveDockControl = Block.VSPane[I].DockForm;
IsChecked := Block.VSPane[I].Active;
State := CurrentSkin.GetState(True, False, IsHot, IsChecked);
SpDrawXPButton(nil, Canvas, DrawRect, True, False, IsHot, IsChecked, False, False, FCurrentPPI);
AdjustImagePos;
SpDrawVirtualImageList(Canvas, R, Block.ImageList, I, True);
if IsHot then
begin
Flags := DT_END_ELLIPSIS or DT_NOCLIP or DT_SINGLELINE;
// draw the Caption
if Align in [alTop, alBottom] then begin
Inc(DrawRect.Left, PPIScale(2) + TCrackJvDockVSBlock(Block).InactiveBlockWidth);
Dec(DrawRect.Right, PPIScale(2));
Flags := Flags or DT_VCENTER;
end else
if Align in [alLeft, alRight] then
begin
Inc(DrawRect.Top, PPIScale(2) + TCrackJvDockVSBlock(Block).InactiveBlockWidth);
DrawRect.Left := DrawRect.Right + PPIScale(1) - ((ChannelWidth - FontHeight) div 2);
Dec(DrawRect.Bottom, PPIScale(2));
DrawRect.Right := DrawRect.Left + (DrawRect.Bottom - DrawRect.Top);
end;
OldGraphicsMode := SetGraphicsMode(Canvas.Handle, GM_ADVANCED);
Canvas.Brush.Style := bsClear;
TextColor := CurrentSkin.GetTextColor(nil, skncButton, State);
if TextColor = clNone then
TextColor := clBtnText;
Canvas.Font.Color := TextColor;
DrawText(Canvas.Handle, PChar(Block.VSPane[I].DockForm.Caption), -1,
DrawRect, Flags);
SetGraphicsMode(Canvas.Handle, OldGraphicsMode);
end;
Inc(VisiblePaneCount);
end;
if VisiblePaneCount > 0 then
CurrentPos := CurrentPos + BlockInterval;
end;
begin
// Scale Canvas font
Canvas.Font.Height := MulDiv(ToolbarFont.Height, FCurrentPPI, ToolbarFont.PixelsPerInch);
if GetTextMetrics(Canvas.Handle, TM) then
FontHeight := TM.tmHeight
else begin
FontHeight := Abs(Canvas.Font.Height);
if Canvas.Font.Height < 0 then
Inc(FontHeight, PPIScale(3)); //tmInternalLeading
end;
IsVertical := Align in [alLeft, alRight];
SpDrawXPDock(nil, Canvas, ClientRect, IsVertical, FCurrentPPI);
CurrentSkin.PaintBackground(Canvas, ClientRect, skncDock, sknsNormal, True, True, IsVertical);
CurrentPos := BlockStartOffset;
for I := 0 to BlockCount - 1 do
DrawSingleBlock(Block[I]);
end;
procedure TJvDockVSChannelSpTBX.PopupPaneChanged;
begin
inherited;
Invalidate;
end;
procedure TJvDockVSChannelSpTBX.ResetFontAngle;
begin
if Align in [alLeft, alRight] then
Canvas.Font.Handle := SpCreateRotatedFont(Canvas.Handle);
end;
procedure TJvDockVSChannelSpTBX.WMSpSkinChange(var Message: TMessage);
begin
for var I := 0 to BlockCount - 1 do
begin
var Block := Block[I];
for var J := 0 to Block.VSPaneCount - 1 do
begin
var VSPane := Block.VSPane[J];
if TForm(VSPane.DockForm).Icon.HandleAllocated then
ImageList_ReplaceIcon(Block.ImageList.Handle, J,
CopyIcon(TForm(VSPane.DockForm).Icon.Handle));
end;
end;
Invalidate;
end;
{ TJvDockVSNETSplitterSpTBX }
constructor TJvDockVSNETSplitterSpTBX.Create(AOwner: TComponent);
begin
inherited;
ResizeStyle := rsUpdate;
Width := 5;
FMouseLoc := mlNone;
FMouseOver := false;
FMouseDown := false;
ControlStyle := ControlStyle + [csOpaque];
//DoubleBuffered := True;
SkinManager.AddSkinNotification(Self);
end;
procedure TJvDockVSNETSplitterSpTBX.CMMouseLeave(var Message: TMessage);
begin
FMouseOver := false;
if not FMouseDown then
begin
FMouseLoc := mlNone;
Invalidate;
end;
end;
procedure TJvDockVSNETSplitterSpTBX.MouseUp(Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
FMouseDown := false;
if FMouseOver then
FMouseLoc := mlOver
else
FMouseLoc := mlNone;
inherited;
Invalidate;
end;
procedure TJvDockVSNETSplitterSpTBX.CMMouseEnter(var Message: TMessage);
begin
if not FMouseDown then
begin
FMouseOver := true;
FMouseLoc := mlOver;
Invalidate;
end;
end;
destructor TJvDockVSNETSplitterSpTBX.Destroy;
begin
SkinManager.RemoveSkinNotification(Self);
inherited;
end;
procedure TJvDockVSNETSplitterSpTBX.MouseDown(Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
FMouseDown := true;
FMouseLoc := mlDown;
inherited;
Invalidate;
end;
procedure TJvDockVSNETSplitterSpTBX.Paint;
function GetGripRect(IsVertical : Boolean) : TRect;
const
GripSize = 50;
begin
Result := Rect(0, 0, 0, 0);
if IsVertical then
Result := Bounds(0, (Height - PPIScale(GripSize)) div 2, Width, PPIScale(GripSize))
else
Result := Bounds((Width - PPIScale(GripSize)) div 2, 0, PPIScale(GripSize), Height);
end;
var
R, DragHandleR : TRect;
IsVertical : Boolean;
C1, C2 : TColor;
begin
IsVertical := Align in [alLeft, alRight];
// Paint background
Canvas.Brush.Color := StyleServices.GetSystemColor(clBtnFace);
Canvas.FillRect(ClientRect);
PaintSplitterFrame(Canvas, IsVertical, R);
// Paint grip
R := GetGripRect(IsVertical);
DragHandleR := R;
if IsVertical then
InflateRect(DragHandleR, -PPIScale(1), -PPIScale(10))
else
InflateRect(DragHandleR, -PPIScale(10), -PPIScale(1));
C1 := StyleServices.GetSystemColor(clBtnShadow);
C2 := StyleServices.GetSystemColor(clWindow);
SpDrawXPGrip(Canvas, DragHandleR, C1, C2, FCurrentPPI);
// //uncomment this is you want the dotted frame drawn at designtime
// if csDesigning in ComponentState then
// with Canvas do
// begin
// ExcludeClipRect(Canvas.Handle, 1, 1, Width - 1, Height - 1);
// FMouseLoc := mlNone;
// Pen.Style := psDot;
// Pen.Mode := pmXor;
// Pen.Color := $00FFD8CE;
// Brush.Style := bsClear;
// Rectangle(ClientRect);
// end;
if Assigned(OnPaint) then
OnPaint(Self);
end;
procedure TJvDockVSNETSplitterSpTBX.WMSpSkinChange(var Message: TMessage);
begin
Invalidate;
end;
{ TJvDockVSNETSpTBXConjoinServerOption }
procedure TJvDockVSNETSpTBXConjoinServerOption.Changed;
// Hack to call the grandfather version
// This is to avoid reseting the SystemInfo property. Bad design...
Var
GrandFatherChange : procedure of object;
begin
TMethod(GrandFatherChange).Code := @TJvDockBasicServerOption.Changed;
TMethod(GrandFatherChange).Data := Self;
GrandFatherChange;
TJvDockVSNetStyleSpTBX(DockStyle).DoSystemInfoChange(SystemInfo);
end;
constructor TJvDockVSNETSpTBXConjoinServerOption.Create(
ADockStyle: TJvDockObservableStyle);
begin
inherited;
end;
procedure TJvDockVSNETSpTBXConjoinServerOption.UpdateDefaultSystemCaptionInfo;
var
NonClientMetrics: TNonClientMetrics;
begin
inherited;
SplitterWidth := 5;
NonClientMetrics.cbSize := SizeOf(NonClientMetrics);
if (TOSVersion.Major >= 10) and (TOSVersion.Build >= 14393) and
SystemParametersInfoForDpi(SPI_GETNONCLIENTMETRICS,
NonClientMetrics.cbSize, @NonClientMetrics, 0, 96)
then
GrabbersSize := Max(Abs(NonClientMetrics.lfSmCaptionFont.lfHeight) + 12, 28)
else
GrabbersSize := 28;
end;
{ TJvDockVSNETTabSheetSpTBX }
procedure TJvDockVSNETTabSheetSpTBX.AdjustClientRect(var Rect: TRect);
begin
if Assigned(PageControl) then begin
InflateRect(Rect, -TabSheetBorderSize, -TabSheetBorderSize);
if (PageControl as TJvDockVSNETTabPageControlSpTBX).TabPosition = tpBottom then
Inc(Rect.Bottom, TabSheetBorderSize)
else
Dec(Rect.Top, TabSheetBorderSize);
end else
inherited AdjustClientRect(Rect);
end;
procedure TJvDockVSNETTabSheetSpTBX.WMEraseBkgnd(var Message: TMessage);
var
R: TRect;
ACanvas: TCanvas;
begin
if not DoubleBuffered or (Message.wParam = WPARAM(Message.lParam)) then begin
if not (csDestroying in ComponentState) then begin
if Assigned(PageControl) and Visible then begin
ACanvas := TCanvas.Create;
ACanvas.Handle := TWMEraseBkgnd(Message).DC;
try
R := ClientRect;
ACanvas.Brush.Color := clWindow;
ACanvas.FillRect(R);
// Part of the background will be painted by the TabPanel, since we want the
// tabs to be "merged" into the background
if (PageControl as TJvDockVSNETTabPageControlSpTBX).TabPosition = tpBottom then
Inc(R.Bottom, TabSheetBorderSize)
else
Dec(R.Top, TabSheetBorderSize);
SpDrawXPTabControlBackground(nil, ACanvas, R, Color, (PageControl as TJvDockVSNETTabPageControlSpTBX).TabPosition = tpBottom);
finally
ACanvas.Handle := 0;
ACanvas.Free;
end;
end;
end;
end;
Message.Result := 1;
end;
end.
| 31.352564 | 137 | 0.684855 |
8586d693a58b93c13068e6074b8f390250bc2217 | 3,069 | pas | Pascal | Games/Source/asteroids/uKeys.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 11 | 2017-06-17T05:13:45.000Z | 2021-07-11T13:18:48.000Z | Games/Source/asteroids/uKeys.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 2 | 2019-03-05T12:52:40.000Z | 2021-12-03T12:34:26.000Z | Games/Source/asteroids/uKeys.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 6 | 2017-09-07T09:10:09.000Z | 2022-02-19T20:19:58.000Z | Unit uKeys;
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
Interface
Uses Controls, Forms, Classes,
{$IFDEF FPC}
LCLIntf, LCLType,
{$ELSE} ComCtrls,
{$ENDIF}StdCtrls, ExtCtrls, SysUtils;
Type tKeys = Class(tForm)
Label_KeyLeft: tLabel;
Label_KeyRight: tLabel;
Label_KeyAccel: tLabel;
Label_KeyFire: tLabel;
Panel_KeyLeft: tPanel;
Panel_KeyRight: tPanel;
Panel_KeyAccel: tPanel;
Panel_KeyFire: tPanel;
Edit_KeyLeft: tEdit;
Edit_KeyRight: tEdit;
Edit_KeyAccel: tEdit;
Edit_KeyFire: tEdit;
Procedure Form_Show(Sender: tObject);
Procedure Edit_Change(Sender: tObject);
Procedure Edit_KeyDown(Sender: tObject; Var Key: Word; Shift: tShiftState);
Procedure Edit_KeyUp(Sender: tObject; Var Key: Word; Shift: tShiftState);
private
public
LastKey: Word;
End;
Var Keys: tKeys;
Implementation
Uses {$IFDEF MSWINDOWS} windows, {$ELSE} {$ENDIF} uSettings;
{$IFDEF FPC}
{$R *.lfm}
{$ELSE}
{$R *.dfm}
{$ENDIF}
{Tools}
Function GetKeyName(Key: Cardinal): String;
Var tmpStr: ShortString;
Begin
{$IFDEF MSWINDOWS}
tmpStr[0] := #255;
Key := MapVirtualKey(Key, 0) Shl 16;
GetKeyNameText(Key, @tmpStr[1], 255);
Result := Copy(tmpStr, 1, Pos(#0, tmpStr) - 1);
{$ELSE}
Result := '';
{$ENDIF}
End;
{Key}
Procedure tKeys.Form_Show(Sender: tObject);
Begin
With Settings Do
Begin
LastKey := KeyLeft;
Edit_Change(Edit_KeyLeft); {put key values into edit boxes}
LastKey := KeyRight;
Edit_Change(Edit_KeyRight);
LastKey := KeyAccel;
Edit_Change(Edit_KeyAccel);
LastKey := KeyFire;
Edit_Change(Edit_KeyFire);
End;
End;
Procedure tKeys.Edit_Change(Sender: tObject);
Var tmpStr: String;
Begin
With tEdit(Sender) Do
Begin {update value and select it}
tmpStr := IntToStr(LastKey);
While (Length(tmpStr) < 3) Do
tmpStr := '0' + tmpStr;
tmpStr := tmpStr + ' = ' + GetKeyName(LastKey);
Text := tmpStr;
SelStart := 0;
SelLength := Length(Text);
End;
If (Sender = Edit_KeyLeft) Then
Edit_KeyRight.SetFocus
Else {select next value} If (Sender = Edit_KeyRight) Then
Edit_KeyAccel.SetFocus
Else If (Sender = Edit_KeyAccel) Then
Edit_KeyFire.SetFocus
Else If (Sender = Edit_KeyFire) Then
Edit_KeyLeft.SetFocus;
With Settings Do
If (Sender = Edit_KeyLeft) Then
KeyLeft := LastKey
Else {update keys} If (Sender = Edit_KeyRight) Then
KeyRight := LastKey
Else If (Sender = Edit_KeyAccel) Then
KeyAccel := LastKey
Else If (Sender = Edit_KeyFire) Then
KeyFire := LastKey;
End;
Procedure tKeys.Edit_KeyDown(Sender: tObject; Var Key: Word; Shift:
tShiftState);
Begin
If (Key = VK_Escape) Then
Exit; {don't use ESC as key}
LastKey := Key;
Edit_Change(Sender);
End;
Procedure tKeys.Edit_KeyUp(Sender: tObject; Var Key: Word; Shift: tShiftState);
Begin
If (Key = VK_Escape) Then
Close;
End;
End.
| 24.165354 | 80 | 0.642229 |
f1fe1077cba6cd1d9beb4fb20b5ae35c1a3b4746 | 2,294 | pas | Pascal | Source/Services/SimpleNotificationService/Base/Transform/AWS.SNS.Transform.KMSAccessDeniedExceptionUnmarshaller.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 67 | 2021-07-28T23:47:09.000Z | 2022-03-15T11:48:35.000Z | Source/Services/SimpleNotificationService/Base/Transform/AWS.SNS.Transform.KMSAccessDeniedExceptionUnmarshaller.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 5 | 2021-09-01T09:31:16.000Z | 2022-03-16T18:19:21.000Z | Source/Services/SimpleNotificationService/Base/Transform/AWS.SNS.Transform.KMSAccessDeniedExceptionUnmarshaller.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 13 | 2021-07-29T02:41:16.000Z | 2022-03-16T10:22:38.000Z | unit AWS.SNS.Transform.KMSAccessDeniedExceptionUnmarshaller;
interface
uses
AWS.Transform.IErrorResponseUnmarshaller,
AWS.Transform.UnmarshallerContext,
AWS.SNS.Model.KMSAccessDeniedException,
AWS.Internal.ErrorResponse;
type
IKMSAccessDeniedExceptionUnmarshaller = IErrorResponseUnmarshaller<EKMSAccessDeniedException, TXmlUnmarshallerContext>;
TKMSAccessDeniedExceptionUnmarshaller = class(TInterfacedObject, IErrorResponseUnmarshaller<EKMSAccessDeniedException, TXmlUnmarshallerContext>)
strict private
class var FInstance: IKMSAccessDeniedExceptionUnmarshaller;
class constructor Create;
public
function Unmarshall(AContext: TXmlUnmarshallerContext): EKMSAccessDeniedException; overload;
function Unmarshall(AContext: TXmlUnmarshallerContext; AErrorResponse: TErrorResponse): EKMSAccessDeniedException; overload;
class function Instance: IKMSAccessDeniedExceptionUnmarshaller; static;
end;
implementation
{ TKMSAccessDeniedExceptionUnmarshaller }
function TKMSAccessDeniedExceptionUnmarshaller.Unmarshall(AContext: TXmlUnmarshallerContext): EKMSAccessDeniedException;
var
ErrorResponse: TErrorResponse;
begin
ErrorResponse := TErrorResponse.Create;
try
Result := Unmarshall(AContext, ErrorResponse);
finally
ErrorResponse.Free;
end;
end;
function TKMSAccessDeniedExceptionUnmarshaller.Unmarshall(AContext: TXmlUnmarshallerContext; AErrorResponse: TErrorResponse): EKMSAccessDeniedException;
var
OriginalDepth: Integer;
Response: EKMSAccessDeniedException;
begin
Response := EKMSAccessDeniedException.Create(AErrorResponse.Message, AErrorResponse.InnerException, AErrorResponse.ErrorType, AErrorResponse.Code, AErrorResponse.RequestId, AErrorResponse.StatusCode);
try
OriginalDepth := AContext.CurrentDepth;
while AContext.ReadAtDepth(OriginalDepth) do
if AContext.IsStartElement or AContext.IsAttribute then
begin
end;
Result := Response;
Response := nil;
finally
Response.Free;
end;
end;
class constructor TKMSAccessDeniedExceptionUnmarshaller.Create;
begin
FInstance := TKMSAccessDeniedExceptionUnmarshaller.Create;
end;
class function TKMSAccessDeniedExceptionUnmarshaller.Instance: IKMSAccessDeniedExceptionUnmarshaller;
begin
Result := FInstance;
end;
end.
| 32.771429 | 202 | 0.826504 |
475722b2be752e118e884170246ecdcccf9f162e | 233 | lpr | Pascal | Desenvolvimento/fontes/pinpad_lib/backup/pinpad_lib.lpr | MichelPereiraSeicon/OpenTef | 50b7d0e840d879ca03636bf288bcf52a98950566 | [
"MIT"
]
| null | null | null | Desenvolvimento/fontes/pinpad_lib/backup/pinpad_lib.lpr | MichelPereiraSeicon/OpenTef | 50b7d0e840d879ca03636bf288bcf52a98950566 | [
"MIT"
]
| null | null | null | Desenvolvimento/fontes/pinpad_lib/backup/pinpad_lib.lpr | MichelPereiraSeicon/OpenTef | 50b7d0e840d879ca03636bf288bcf52a98950566 | [
"MIT"
]
| null | null | null | library pinpad_lib;
{$mode objfpc}{$H+}
uses
Interfaces, Classes, pinpad, indylaz, rxnew, funcoes, def;
exports
PinPadCarrega,
PinPadDescarrega,
PinPadConectar,
PinPadDesconectar,
PinPadComando;
begin
end.
| 14.5625 | 62 | 0.708155 |
83c784e0ff5c654898614be81374f9420d009835 | 3,967 | pas | Pascal | dos/0041.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 11 | 2015-12-12T05:13:15.000Z | 2020-10-14T13:32:08.000Z | dos/0041.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| null | null | null | dos/0041.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 8 | 2017-05-05T05:24:01.000Z | 2021-07-03T20:30:09.000Z | {
some days ago, Bryan Ellis (gt6918b@prism.gatech.edu)
asked how one could, in TP, check whether a disk in a
drive is formatted or not. I did not see any answer on
this posted to the list, so here comes an 'extract' from
code of mine which might help.
{ The following two procedures were extracted from old file
copy programs of mine; Therefore they should be 'cleaned-up'
and fixed up before being included in somebody's code.
The purpose of the first one is to ensure that:
a) the target disk (to be written to) is indeed
present in the drive;
b) the target disk is a formatted one. If it is
not, then opportunity is provided for formatting by
shelling to DOS (rather clumsy, but you get the idea ;-)).
The purpose of the second procedure is partly redundant
with that of the first one. It checks whether the disk
is present in the drive, and it also warns when the disk
is write protected.
Calls to ancillary procedures for putting the cursor onto
the right column and row on the screen, or to clean up
the display, save and restore the screen, or warning noises
etc., were removed, which explains the somewhat desultory
code, which I had no time to rewrite :-( }
{ uses DOS,CRT; }
Procedure CheckDriv(driv : string; var OK:boolean;
var cc:char );
{* driv is the string holding the letter of the drive; *}
{* OK is a global boolean var which must be true in order for *}
{* the rest of the program to proceed. *}
{* cc : checks input by the user *}
{***************************************************************}
var IOR : integer;
jk,dr : char;
S : string;
CmdLine: PathStr;
begin
OK := TRUE;
IOR := 0;
{$I-}
ChDir(driv); { make the target drive current }
{ the original current drive letter should be saved in order}
{ to be restored afterwards }
dr := upcase(driv[1]);
IOR := IOresult;
if IOR = 152 then begin
OK := FALSE;
writeln('No disk in ',copy(driv,1,2));
writeln(' (Insert a disk or press ESC)');
repeat until keypressed;
cc := readkey
end
else
if IOR = 162 then begin
OK := FALSE;
writeln('Unformatted disk in ',copy(driv,1,2));
writeln('Press ESC to cancel...');
writeln('...or press ''*'' to format...');
repeat until keypressed;
cc := readkey;
{ here, for security sake, only drives A and B were taken
into account for writing }
if ((cc = '*') AND ((dr = 'A') OR (dd = 'B'))) then
begin
cc := chr(27);
{ now, your Format.com file had better be in the path! }
S := FSearch('FORMAT.COM', GetEnv('PATH'));
S := FExpand(S);
CmdLine := copy(driv,1,2);
SwapVectors;
Exec(S,CmdLine);
SwapVectors;
If DosError <> 0 then
write('Dos error #',DosError)
else
write('Press any key...');
repeat until keypressed;
jk := readkey;
end
end
end;
{$I+}
Procedure CheckWrite(var FF: file;
var OK: boolean;
var cc: char);
{* Tests for presence of disk in drive and write protect tab, *}
{* to allow opening of untyped file for write: this file has *}
{* of course been assigned before, elsewhere in the program *}
{****************************************************************}
{$I-}
var riteprot : boolean;
DiskAbsent : boolean;
error : integer;
begin
riteprot := TRUE;
DiskAbsent := TRUE;
rewrite(FF);
error := IOResult;
riteprot := error = 150;
DiskAbsent := error = 152;
if riteprot then begin
writeln('Disk is write protected!');
writeln('Correct the situation and press any key...');
repeat until keypressed;
cc := readkey
end;
if DiskAbsent then begin
writeln('No disk in the drive!');
writeln('Insert disk into drive, then press any key...');
repeat until keypressed;
cc := readkey
end;
OK := (Not(riteprot)) AND (Not(DiskAbsent))
end;
{$I+}
| 32.785124 | 67 | 0.616587 |
4764aeb84e8ca8ab4898ad2d885cf02f86ac0ca9 | 3,385 | pas | Pascal | Source/Services/LexRuntimeV2/Base/Model/AWS.LexRuntimeV2.Model.DeleteSessionRequest.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 67 | 2021-07-28T23:47:09.000Z | 2022-03-15T11:48:35.000Z | Source/Services/LexRuntimeV2/Base/Model/AWS.LexRuntimeV2.Model.DeleteSessionRequest.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 5 | 2021-09-01T09:31:16.000Z | 2022-03-16T18:19:21.000Z | Source/Services/LexRuntimeV2/Base/Model/AWS.LexRuntimeV2.Model.DeleteSessionRequest.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 13 | 2021-07-29T02:41:16.000Z | 2022-03-16T10:22:38.000Z | unit AWS.LexRuntimeV2.Model.DeleteSessionRequest;
interface
uses
Bcl.Types.Nullable,
AWS.LexRuntimeV2.Model.Request;
type
TDeleteSessionRequest = class;
IDeleteSessionRequest = interface
function GetBotAliasId: string;
procedure SetBotAliasId(const Value: string);
function GetBotId: string;
procedure SetBotId(const Value: string);
function GetLocaleId: string;
procedure SetLocaleId(const Value: string);
function GetSessionId: string;
procedure SetSessionId(const Value: string);
function Obj: TDeleteSessionRequest;
function IsSetBotAliasId: Boolean;
function IsSetBotId: Boolean;
function IsSetLocaleId: Boolean;
function IsSetSessionId: Boolean;
property BotAliasId: string read GetBotAliasId write SetBotAliasId;
property BotId: string read GetBotId write SetBotId;
property LocaleId: string read GetLocaleId write SetLocaleId;
property SessionId: string read GetSessionId write SetSessionId;
end;
TDeleteSessionRequest = class(TAmazonLexRuntimeV2Request, IDeleteSessionRequest)
strict private
FBotAliasId: Nullable<string>;
FBotId: Nullable<string>;
FLocaleId: Nullable<string>;
FSessionId: Nullable<string>;
function GetBotAliasId: string;
procedure SetBotAliasId(const Value: string);
function GetBotId: string;
procedure SetBotId(const Value: string);
function GetLocaleId: string;
procedure SetLocaleId(const Value: string);
function GetSessionId: string;
procedure SetSessionId(const Value: string);
strict protected
function Obj: TDeleteSessionRequest;
public
function IsSetBotAliasId: Boolean;
function IsSetBotId: Boolean;
function IsSetLocaleId: Boolean;
function IsSetSessionId: Boolean;
property BotAliasId: string read GetBotAliasId write SetBotAliasId;
property BotId: string read GetBotId write SetBotId;
property LocaleId: string read GetLocaleId write SetLocaleId;
property SessionId: string read GetSessionId write SetSessionId;
end;
implementation
{ TDeleteSessionRequest }
function TDeleteSessionRequest.Obj: TDeleteSessionRequest;
begin
Result := Self;
end;
function TDeleteSessionRequest.GetBotAliasId: string;
begin
Result := FBotAliasId.ValueOrDefault;
end;
procedure TDeleteSessionRequest.SetBotAliasId(const Value: string);
begin
FBotAliasId := Value;
end;
function TDeleteSessionRequest.IsSetBotAliasId: Boolean;
begin
Result := FBotAliasId.HasValue;
end;
function TDeleteSessionRequest.GetBotId: string;
begin
Result := FBotId.ValueOrDefault;
end;
procedure TDeleteSessionRequest.SetBotId(const Value: string);
begin
FBotId := Value;
end;
function TDeleteSessionRequest.IsSetBotId: Boolean;
begin
Result := FBotId.HasValue;
end;
function TDeleteSessionRequest.GetLocaleId: string;
begin
Result := FLocaleId.ValueOrDefault;
end;
procedure TDeleteSessionRequest.SetLocaleId(const Value: string);
begin
FLocaleId := Value;
end;
function TDeleteSessionRequest.IsSetLocaleId: Boolean;
begin
Result := FLocaleId.HasValue;
end;
function TDeleteSessionRequest.GetSessionId: string;
begin
Result := FSessionId.ValueOrDefault;
end;
procedure TDeleteSessionRequest.SetSessionId(const Value: string);
begin
FSessionId := Value;
end;
function TDeleteSessionRequest.IsSetSessionId: Boolean;
begin
Result := FSessionId.HasValue;
end;
end.
| 26.24031 | 82 | 0.780502 |
83e921b6e45707584766edac742303745525007c | 246 | pas | Pascal | org/test_org.pas | sabren/b4 | 23fc3f269a7f11d5e464cd3368b387f6b15cf148 | [
"Unlicense"
]
| 9 | 2015-03-18T15:22:44.000Z | 2022-02-04T11:11:49.000Z | org/test_org.pas | sabren/b4 | 23fc3f269a7f11d5e464cd3368b387f6b15cf148 | [
"Unlicense"
]
| 1 | 2015-04-14T17:26:24.000Z | 2021-09-10T20:33:13.000Z | org/test_org.pas | sabren/b4 | 23fc3f269a7f11d5e464cd3368b387f6b15cf148 | [
"Unlicense"
]
| 1 | 2016-11-07T16:54:55.000Z | 2016-11-07T16:54:55.000Z | {$i test_org.def }
implementation uses org;
var
doc : org_node;
procedure test_parse;
begin
assign( input, 'test.org');
reset( input );
chk.that( org.parse( input, doc ),
'failed to parse test.org' );
end;
end.
| 14.470588 | 38 | 0.601626 |
47802615f36f229cff020ba2be0dba4767f8ed6a | 3,924 | pas | Pascal | Unit1.pas | bravesoftdz/SlidePhoto | 95fe396e51e14413255ab36e70848c4dc7177f5d | [
"MIT"
]
| 6 | 2020-12-19T10:20:09.000Z | 2022-01-29T00:02:30.000Z | Unit1.pas | HemulGM/SlidePhoto | 95fe396e51e14413255ab36e70848c4dc7177f5d | [
"MIT"
]
| null | null | null | Unit1.pas | HemulGM/SlidePhoto | 95fe396e51e14413255ab36e70848c4dc7177f5d | [
"MIT"
]
| 2 | 2021-01-27T03:37:35.000Z | 2021-06-08T06:06:57.000Z | unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects,
FMX.Layouts, FMX.Ani, FMX.Effects, FMX.Controls.Presentation, FMX.StdCtrls;
type
TForm1 = class(TForm)
Rectangle1: TRectangle;
LayoutSwipeFrame: TLayout;
FloatAnimationSObjX: TFloatAnimation;
FloatAnimationSObjY: TFloatAnimation;
FloatAnimationSObjR: TFloatAnimation;
ShadowEffectSwipe: TShadowEffect;
Rectangle2: TRectangle;
ShadowEffect1: TShadowEffect;
Rectangle3: TRectangle;
Label1: TLabel;
procedure Rectangle1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
procedure LayoutSwipeFrameMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single);
procedure LayoutSwipeFrameMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
procedure FormCreate(Sender: TObject);
procedure FloatAnimationSObjRProcess(Sender: TObject);
procedure LayoutSwipeFrameMouseLeave(Sender: TObject);
private
FSwipeObject: TRectangle;
FSwipe: Boolean;
FSwipePos: TPointF;
FSwipeDirTop: Boolean;
procedure ResetSwipeObject(const SObject: TRectangle);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
Math;
{$R *.fmx}
procedure TForm1.FloatAnimationSObjRProcess(Sender: TObject);
begin
ShadowEffectSwipe.UpdateParentEffects;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ResetSwipeObject(Rectangle1);
end;
procedure TForm1.LayoutSwipeFrameMouseLeave(Sender: TObject);
begin
LayoutSwipeFrameMouseUp(Sender, TMouseButton.mbLeft, [], 0, 0);
end;
procedure TForm1.LayoutSwipeFrameMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single);
var
A: Single;
begin
if FSwipe and Assigned(FSwipeObject) then
begin
FSwipeObject.Position.Point := TPointF.Create(FSwipeObject.Position.Point.X + (Screen.MousePos.X - FSwipePos.X), FSwipeObject.Position.Point.Y + (Screen.MousePos.Y - FSwipePos.Y));
A := ((LayoutSwipeFrame.Width / 2) - (FSwipeObject.Position.X + FSwipeObject.Width / 2));
if FSwipeDirTop then
A := -0.2 * A
else
A := 0.2 * A;
FSwipeObject.RotationAngle := Min(Max(-30, A), 30); //-90..90
ShadowEffectSwipe.UpdateParentEffects;
FSwipePos := Screen.MousePos;
end;
end;
procedure TForm1.ResetSwipeObject(const SObject: TRectangle);
begin
FloatAnimationSObjX.Enabled := False;
FloatAnimationSObjY.Enabled := False;
FloatAnimationSObjR.Enabled := False;
FloatAnimationSObjX.Parent := SObject;
FloatAnimationSObjY.Parent := SObject;
FloatAnimationSObjR.Parent := SObject;
FloatAnimationSObjX.StopValue := (LayoutSwipeFrame.Width / 2) - (SObject.Width / 2);
FloatAnimationSObjY.StopValue := (LayoutSwipeFrame.Height / 2) - (SObject.Height / 2);
FloatAnimationSObjX.Enabled := True;
FloatAnimationSObjY.Enabled := True;
FloatAnimationSObjR.Enabled := True;
end;
procedure TForm1.LayoutSwipeFrameMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
begin
if FSwipe then
begin
FSwipe := False;
if Assigned(FSwipeObject) then
begin
FSwipeObject.HitTest := True;
ResetSwipeObject(FSwipeObject);
FSwipeObject := nil;
end;
FSwipePos := Screen.MousePos;
LayoutSwipeFrame.HitTest := False;
end;
end;
procedure TForm1.Rectangle1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
begin
FSwipeObject := (Sender as TRectangle);
FSwipePos := Screen.MousePos;
FSwipe := True;
FSwipeObject.HitTest := False;
FSwipeDirTop := Y < FSwipeObject.Height / 2;
if FSwipeDirTop then
FSwipeObject.RotationCenter.Point := TPointF.Create(0.5, 1)
else
FSwipeObject.RotationCenter.Point := TPointF.Create(0.5, 0);
LayoutSwipeFrame.HitTest := True;
end;
end.
| 29.954198 | 184 | 0.739297 |
f1ad8db44e082ee0b4cea1783b8f9628e7c799d7 | 2,879 | pas | Pascal | Demo/Unit1.pas | BakasuraRCE/TEditableListView | 84677c662ef9b28da18847800c253afe99633c0b | [
"MIT"
]
| 2 | 2019-01-07T08:51:37.000Z | 2020-01-14T20:53:53.000Z | Demo/Unit1.pas | BakasuraRCE/TEditableListView | 84677c662ef9b28da18847800c253afe99633c0b | [
"MIT"
]
| null | null | null | Demo/Unit1.pas | BakasuraRCE/TEditableListView | 84677c662ef9b28da18847800c253afe99633c0b | [
"MIT"
]
| 3 | 2018-04-03T22:56:40.000Z | 2020-12-18T14:04:10.000Z | unit Unit1;
interface
uses
System.Classes,
System.SysUtils,
Vcl.Forms,
Vcl.ComCtrls,
Vcl.StdCtrls,
Vcl.Menus,
Vcl.ExtCtrls,
Vcl.Controls,
UnitEditableListView;
type
TForm1 = class(TForm)
ListView1: TListView;
PopupMenu1: TPopupMenu;
Edit1: TMenuItem;
Remove1: TMenuItem;
Create1: TMenuItem;
N1: TMenuItem;
Panel1: TPanel;
LabelTitle: TLabel;
ComboBox1: TComboBox;
procedure FormCreate(Sender: TObject);
procedure Edit1Click(Sender: TObject);
procedure Remove1Click(Sender: TObject);
procedure Create1Click(Sender: TObject);
procedure ListView1Edited(Sender: TObject; Item: TListItem; var S: string);
procedure ListView1Editing(Sender: TObject; Item: TListItem;
var AllowEdit: Boolean);
procedure Button1Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
Winapi.Windows;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ListView1.Parent := nil;
ListView1.Parent := Self;
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
ListView1.ViewStyle := TViewStyle(ComboBox1.ItemIndex);
end;
procedure TForm1.Create1Click(Sender: TObject);
var
Item: TListItem;
begin
Item := ListView1.Items.Add;
Item.Caption := 'a';
Item.SubItems.Add('b');
Item.SubItems.Add('c');
Item.SubItems.Add('d');
Item.SubItems.Add('e');
Item.Selected := true;
ListView1.Scroll(0, ListView1.Selected.Top - (ListView1.Height div 2));
end;
procedure TForm1.Edit1Click(Sender: TObject);
begin
if ListView1.SelCount = 0 then
Exit;
ListView1.EditCaptionAt(ListView1.ScreenToClient(PopupMenu1.PopupPoint));
end;
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
Item: TListItem;
begin
for I := 0 to 50 do
begin
Item := ListView1.Items.Add;
Item.Caption := Format('%d.%d', [I, 1]);
Item.SubItems.Add(Format('%d.%d', [I, 2]));
Item.SubItems.Add(Format('%d.%d', [I, 3]));
Item.SubItems.Add(Format('%d.%d', [I, 4]));
Item.SubItems.Add(Format('%d.%d', [I, 5]));
end;
end;
procedure TForm1.ListView1Edited(Sender: TObject; Item: TListItem; var S: string);
begin
if Application.MessageBox('Var "S" only take effect on caption', 'Override caption? ', MB_YESNO) = IDYES then
S := 'Override!';
end;
procedure TForm1.ListView1Editing(Sender: TObject; Item: TListItem; var AllowEdit: Boolean);
begin
AllowEdit := Application.MessageBox(PChar(Item.Caption), 'Can edit?', MB_YESNO) = IDYES;
end;
procedure TForm1.Remove1Click(Sender: TObject);
begin
if ListView1.SelCount = 0 then
Exit;
ListView1.Selected.Delete;
end;
end.
| 22.492188 | 112 | 0.668982 |
4733217c9275dc3cfb16e0fe7e8eb17311ec0f86 | 9,094 | pas | Pascal | Source/Services/SQS/Base/Model/AWS.SQS.Model.ReceiveMessageRequest.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 67 | 2021-07-28T23:47:09.000Z | 2022-03-15T11:48:35.000Z | Source/Services/SQS/Base/Model/AWS.SQS.Model.ReceiveMessageRequest.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 5 | 2021-09-01T09:31:16.000Z | 2022-03-16T18:19:21.000Z | Source/Services/SQS/Base/Model/AWS.SQS.Model.ReceiveMessageRequest.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 13 | 2021-07-29T02:41:16.000Z | 2022-03-16T10:22:38.000Z | unit AWS.SQS.Model.ReceiveMessageRequest;
interface
uses
System.Generics.Collections,
Bcl.Types.Nullable,
AWS.SQS.Model.Request;
type
TReceiveMessageRequest = class;
IReceiveMessageRequest = interface
function GetAttributeNames: TList<string>;
procedure SetAttributeNames(const Value: TList<string>);
function GetKeepAttributeNames: Boolean;
procedure SetKeepAttributeNames(const Value: Boolean);
function GetMaxNumberOfMessages: Integer;
procedure SetMaxNumberOfMessages(const Value: Integer);
function GetMessageAttributeNames: TList<string>;
procedure SetMessageAttributeNames(const Value: TList<string>);
function GetKeepMessageAttributeNames: Boolean;
procedure SetKeepMessageAttributeNames(const Value: Boolean);
function GetQueueUrl: string;
procedure SetQueueUrl(const Value: string);
function GetReceiveRequestAttemptId: string;
procedure SetReceiveRequestAttemptId(const Value: string);
function GetVisibilityTimeout: Integer;
procedure SetVisibilityTimeout(const Value: Integer);
function GetWaitTimeSeconds: Integer;
procedure SetWaitTimeSeconds(const Value: Integer);
function Obj: TReceiveMessageRequest;
function IsSetAttributeNames: Boolean;
function IsSetMaxNumberOfMessages: Boolean;
function IsSetMessageAttributeNames: Boolean;
function IsSetQueueUrl: Boolean;
function IsSetReceiveRequestAttemptId: Boolean;
function IsSetVisibilityTimeout: Boolean;
function IsSetWaitTimeSeconds: Boolean;
property AttributeNames: TList<string> read GetAttributeNames write SetAttributeNames;
property KeepAttributeNames: Boolean read GetKeepAttributeNames write SetKeepAttributeNames;
property MaxNumberOfMessages: Integer read GetMaxNumberOfMessages write SetMaxNumberOfMessages;
property MessageAttributeNames: TList<string> read GetMessageAttributeNames write SetMessageAttributeNames;
property KeepMessageAttributeNames: Boolean read GetKeepMessageAttributeNames write SetKeepMessageAttributeNames;
property QueueUrl: string read GetQueueUrl write SetQueueUrl;
property ReceiveRequestAttemptId: string read GetReceiveRequestAttemptId write SetReceiveRequestAttemptId;
property VisibilityTimeout: Integer read GetVisibilityTimeout write SetVisibilityTimeout;
property WaitTimeSeconds: Integer read GetWaitTimeSeconds write SetWaitTimeSeconds;
end;
TReceiveMessageRequest = class(TAmazonSQSRequest, IReceiveMessageRequest)
strict private
FAttributeNames: TList<string>;
FKeepAttributeNames: Boolean;
FMaxNumberOfMessages: Nullable<Integer>;
FMessageAttributeNames: TList<string>;
FKeepMessageAttributeNames: Boolean;
FQueueUrl: Nullable<string>;
FReceiveRequestAttemptId: Nullable<string>;
FVisibilityTimeout: Nullable<Integer>;
FWaitTimeSeconds: Nullable<Integer>;
function GetAttributeNames: TList<string>;
procedure SetAttributeNames(const Value: TList<string>);
function GetKeepAttributeNames: Boolean;
procedure SetKeepAttributeNames(const Value: Boolean);
function GetMaxNumberOfMessages: Integer;
procedure SetMaxNumberOfMessages(const Value: Integer);
function GetMessageAttributeNames: TList<string>;
procedure SetMessageAttributeNames(const Value: TList<string>);
function GetKeepMessageAttributeNames: Boolean;
procedure SetKeepMessageAttributeNames(const Value: Boolean);
function GetQueueUrl: string;
procedure SetQueueUrl(const Value: string);
function GetReceiveRequestAttemptId: string;
procedure SetReceiveRequestAttemptId(const Value: string);
function GetVisibilityTimeout: Integer;
procedure SetVisibilityTimeout(const Value: Integer);
function GetWaitTimeSeconds: Integer;
procedure SetWaitTimeSeconds(const Value: Integer);
strict protected
function Obj: TReceiveMessageRequest;
public
constructor Create; overload;
destructor Destroy; override;
constructor Create(const AQueueUrl: string); overload;
function IsSetAttributeNames: Boolean;
function IsSetMaxNumberOfMessages: Boolean;
function IsSetMessageAttributeNames: Boolean;
function IsSetQueueUrl: Boolean;
function IsSetReceiveRequestAttemptId: Boolean;
function IsSetVisibilityTimeout: Boolean;
function IsSetWaitTimeSeconds: Boolean;
property AttributeNames: TList<string> read GetAttributeNames write SetAttributeNames;
property KeepAttributeNames: Boolean read GetKeepAttributeNames write SetKeepAttributeNames;
property MaxNumberOfMessages: Integer read GetMaxNumberOfMessages write SetMaxNumberOfMessages;
property MessageAttributeNames: TList<string> read GetMessageAttributeNames write SetMessageAttributeNames;
property KeepMessageAttributeNames: Boolean read GetKeepMessageAttributeNames write SetKeepMessageAttributeNames;
property QueueUrl: string read GetQueueUrl write SetQueueUrl;
property ReceiveRequestAttemptId: string read GetReceiveRequestAttemptId write SetReceiveRequestAttemptId;
property VisibilityTimeout: Integer read GetVisibilityTimeout write SetVisibilityTimeout;
property WaitTimeSeconds: Integer read GetWaitTimeSeconds write SetWaitTimeSeconds;
end;
implementation
{ TReceiveMessageRequest }
constructor TReceiveMessageRequest.Create;
begin
inherited;
FAttributeNames := TList<string>.Create;
FMessageAttributeNames := TList<string>.Create;
end;
destructor TReceiveMessageRequest.Destroy;
begin
MessageAttributeNames := nil;
AttributeNames := nil;
inherited;
end;
function TReceiveMessageRequest.Obj: TReceiveMessageRequest;
begin
Result := Self;
end;
constructor TReceiveMessageRequest.Create(const AQueueUrl: string);
begin
inherited Create;
QueueUrl := AQueueUrl;
end;
function TReceiveMessageRequest.GetAttributeNames: TList<string>;
begin
Result := FAttributeNames;
end;
procedure TReceiveMessageRequest.SetAttributeNames(const Value: TList<string>);
begin
if FAttributeNames <> Value then
begin
if not KeepAttributeNames then
FAttributeNames.Free;
FAttributeNames := Value;
end;
end;
function TReceiveMessageRequest.GetKeepAttributeNames: Boolean;
begin
Result := FKeepAttributeNames;
end;
procedure TReceiveMessageRequest.SetKeepAttributeNames(const Value: Boolean);
begin
FKeepAttributeNames := Value;
end;
function TReceiveMessageRequest.IsSetAttributeNames: Boolean;
begin
Result := (FAttributeNames <> nil) and (FAttributeNames.Count > 0);
end;
function TReceiveMessageRequest.GetMaxNumberOfMessages: Integer;
begin
Result := FMaxNumberOfMessages.ValueOrDefault;
end;
procedure TReceiveMessageRequest.SetMaxNumberOfMessages(const Value: Integer);
begin
FMaxNumberOfMessages := Value;
end;
function TReceiveMessageRequest.IsSetMaxNumberOfMessages: Boolean;
begin
Result := FMaxNumberOfMessages.HasValue;
end;
function TReceiveMessageRequest.GetMessageAttributeNames: TList<string>;
begin
Result := FMessageAttributeNames;
end;
procedure TReceiveMessageRequest.SetMessageAttributeNames(const Value: TList<string>);
begin
if FMessageAttributeNames <> Value then
begin
if not KeepMessageAttributeNames then
FMessageAttributeNames.Free;
FMessageAttributeNames := Value;
end;
end;
function TReceiveMessageRequest.GetKeepMessageAttributeNames: Boolean;
begin
Result := FKeepMessageAttributeNames;
end;
procedure TReceiveMessageRequest.SetKeepMessageAttributeNames(const Value: Boolean);
begin
FKeepMessageAttributeNames := Value;
end;
function TReceiveMessageRequest.IsSetMessageAttributeNames: Boolean;
begin
Result := (FMessageAttributeNames <> nil) and (FMessageAttributeNames.Count > 0);
end;
function TReceiveMessageRequest.GetQueueUrl: string;
begin
Result := FQueueUrl.ValueOrDefault;
end;
procedure TReceiveMessageRequest.SetQueueUrl(const Value: string);
begin
FQueueUrl := Value;
end;
function TReceiveMessageRequest.IsSetQueueUrl: Boolean;
begin
Result := FQueueUrl.HasValue;
end;
function TReceiveMessageRequest.GetReceiveRequestAttemptId: string;
begin
Result := FReceiveRequestAttemptId.ValueOrDefault;
end;
procedure TReceiveMessageRequest.SetReceiveRequestAttemptId(const Value: string);
begin
FReceiveRequestAttemptId := Value;
end;
function TReceiveMessageRequest.IsSetReceiveRequestAttemptId: Boolean;
begin
Result := FReceiveRequestAttemptId.HasValue;
end;
function TReceiveMessageRequest.GetVisibilityTimeout: Integer;
begin
Result := FVisibilityTimeout.ValueOrDefault;
end;
procedure TReceiveMessageRequest.SetVisibilityTimeout(const Value: Integer);
begin
FVisibilityTimeout := Value;
end;
function TReceiveMessageRequest.IsSetVisibilityTimeout: Boolean;
begin
Result := FVisibilityTimeout.HasValue;
end;
function TReceiveMessageRequest.GetWaitTimeSeconds: Integer;
begin
Result := FWaitTimeSeconds.ValueOrDefault;
end;
procedure TReceiveMessageRequest.SetWaitTimeSeconds(const Value: Integer);
begin
FWaitTimeSeconds := Value;
end;
function TReceiveMessageRequest.IsSetWaitTimeSeconds: Boolean;
begin
Result := FWaitTimeSeconds.HasValue;
end;
end.
| 33.806691 | 117 | 0.814053 |
83b7e74f0a70531dd296185a6d8fb1bdb592e1a8 | 2,450 | pas | Pascal | src/Tasks/Implementations/Csrf/CreateCsrfMiddlewareDependenciesTaskImpl.pas | atkins126/fano-cli | 29db4dfba28b164d3acf6de33075f88753731eaf | [
"MIT"
]
| 10 | 2018-11-10T22:58:49.000Z | 2022-03-09T23:36:18.000Z | src/Tasks/Implementations/Csrf/CreateCsrfMiddlewareDependenciesTaskImpl.pas | atkins126/fano-cli | 29db4dfba28b164d3acf6de33075f88753731eaf | [
"MIT"
]
| 8 | 2019-09-24T03:30:27.000Z | 2021-09-14T02:15:06.000Z | src/Tasks/Implementations/Csrf/CreateCsrfMiddlewareDependenciesTaskImpl.pas | atkins126/fano-cli | 29db4dfba28b164d3acf6de33075f88753731eaf | [
"MIT"
]
| 2 | 2020-07-06T12:35:11.000Z | 2021-11-30T05:35:09.000Z | (*!------------------------------------------------------------
* Fano CLI Application (https://fanoframework.github.io)
*
* @link https://github.com/fanoframework/fano-cli
* @copyright Copyright (c) 2018 - 2020 Zamrony P. Juhara
* @license https://github.com/fanoframework/fano-cli/blob/master/LICENSE (MIT)
*------------------------------------------------------------- *)
unit CreateCsrfMiddlewareDependenciesTaskImpl;
interface
{$MODE OBJFPC}
{$H+}
uses
TaskOptionsIntf,
TaskIntf,
TextFileCreatorIntf,
ContentModifierIntf,
FileContentAppenderIntf,
CreateFileTaskImpl;
type
(*!--------------------------------------
* task that add CSRF middleware to project
*---------------------------------------------
* @author Zamrony P. Juhara <zamronypj@yahoo.com>
*---------------------------------------*)
TCreateCsrfMiddlewareDependenciesTask = class(TCreateFileTask)
protected
fFileAppender : IFileContentAppender;
procedure createDependencies(const dir : string);
public
constructor create(
const txtFileCreator : ITextFileCreator;
const contentModifier : IContentModifier;
const fAppend : IFileContentAppender
);
function run(
const opt : ITaskOptions;
const longOpt : shortstring
) : ITask; override;
end;
implementation
constructor TCreateCsrfMiddlewareDependenciesTask.create(
const txtFileCreator : ITextFileCreator;
const contentModifier : IContentModifier;
const fAppend : IFileContentAppender
);
begin
inherited create(txtFileCreator, contentModifier);
fFileAppender := fAppend;
end;
procedure TCreateCsrfMiddlewareDependenciesTask.createDependencies(const dir : string);
var
{$INCLUDE src/Tasks/Implementations/Csrf/Includes/csrf.dependencies.inc}
begin
fFileAppender.append(
dir + DirectorySeparator + 'middlewares.dependencies.inc',
strCsrfDependencies
);
end;
function TCreateCsrfMiddlewareDependenciesTask.run(
const opt : ITaskOptions;
const longOpt : shortstring
) : ITask;
begin
//need to call parent run() so baseDirectory can be initialized
inherited run(opt, longOpt);
createDependencies(baseDirectory + '/src/Dependencies');
result := self;
end;
end.
| 30.246914 | 91 | 0.603265 |
f13287d0c7de49f85204eda190ab283aa75f4195 | 71,643 | pas | Pascal | sources/MVCFramework.JSONRPC.pas | marcelojaloto/delphimvcframework | c069a618f633902106a4e40ed337876b54006bc5 | [
"Apache-2.0"
]
| null | null | null | sources/MVCFramework.JSONRPC.pas | marcelojaloto/delphimvcframework | c069a618f633902106a4e40ed337876b54006bc5 | [
"Apache-2.0"
]
| null | null | null | sources/MVCFramework.JSONRPC.pas | marcelojaloto/delphimvcframework | c069a618f633902106a4e40ed337876b54006bc5 | [
"Apache-2.0"
]
| null | null | null | // ***************************************************************************
//
// Delphi MVC Framework
//
// Copyright (c) 2010-2022 Daniele Teti and the DMVCFramework Team
//
// https://github.com/danieleteti/delphimvcframework
//
// ***************************************************************************
//
// 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 MVCFramework.JSONRPC;
{
JSON-RPC over HTTP implemented as described here
https://www.jsonrpc.org/historical/json-rpc-over-http.html
}
interface
uses
System.Classes,
Data.DB,
System.SysUtils,
jsondataobjects,
MVCFramework,
MVCFramework.Commons,
System.Rtti,
System.Generics.Collections,
MVCFramework.Serializer.Commons,
MVCFramework.Serializer.jsondataobjects;
const
JSONRPC_VERSION = '2.0';
JSONRPC_HEADER = 'jsonrpc';
JSONRPC_METHOD = 'method';
JSONRPC_PARAMS = 'params';
JSONRPC_ID = 'id';
JSONRPC_RESULT = 'result';
JSONRPC_ERROR = 'error';
JSONRPC_CODE = 'code';
JSONRPC_MESSAGE = 'message';
JSONRPC_DATA = 'data';
const
JSONRPC_HOOKS_ON_BEFORE_ROUTING = 'OnBeforeRoutingHook';
JSONRPC_HOOKS_ON_BEFORE_CALL = 'OnBeforeCallHook';
JSONRPC_HOOKS_ON_AFTER_CALL = 'OnAfterCallHook';
JSONRPC_HOOKS_METHOD_NAMES: array [0 .. 2] of string = (JSONRPC_HOOKS_ON_BEFORE_ROUTING, JSONRPC_HOOKS_ON_BEFORE_CALL,
JSONRPC_HOOKS_ON_AFTER_CALL);
{
http://www.jsonrpc.org/historical/json-rpc-over-http.html#response-codes
HTTP Status code message
500 -32700 Parse error.
400 -32600 Invalid Request.
404 -32601 Method not found.
500 -32602 Invalid params.
500 -32603 Internal error.
500 -32099..-32000 Server error.
}
JSONRPC_ERR_PARSE_ERROR = -32700;
JSONRPC_ERR_INVALID_REQUEST = -32600;
JSONRPC_ERR_METHOD_NOT_FOUND = -32601;
JSONRPC_ERR_INVALID_PARAMS = -32602;
JSONRPC_ERR_INTERNAL_ERROR = -32603;
JSONRPC_ERR_SERVER_ERROR_LOWERBOUND = -32099;
JSONRPC_ERR_SERVER_ERROR_UPPERBOUND = -32000;
JSONRPC_USER_ERROR = JSONRPC_ERR_SERVER_ERROR_LOWERBOUND;
type
TJSONRPCHTTPVerb = (jrpcDefault, jrpcGET, jrpcPOST);
MVCJSONRPCAllowGET = class(TCustomAttribute)
end;
IMVCJSONRPCMessage = interface
['{73B8D463-75E1-404B-8437-EF4B3C950D2F}']
function AsJSONRPCMessage: string;
end;
TMVCJSONRPCMessage = class abstract(TInterfacedObject, IMVCJSONRPCMessage)
private
fJSON: TJDOJsonObject;
protected
class procedure CheckVersion(const aJSON: TJDOJsonObject);
class procedure CheckMethod(const aJSON: TJDOJsonObject);
class procedure CheckID(const aJSON: TJDOJsonObject; out aIsNotification: Boolean);
constructor Create; overload;
procedure Build(const aJSON: TJDOJsonObject); virtual; abstract;
{ IMVCJSONRPCMessage }
function AsJSONRPCMessage: string;
function AsJSON: TJDOJsonObject; virtual;
end;
IJSONRPCObject = interface
['{98E161EE-B106-4023-8722-3C2CB1B4CE87}']
procedure SetJsonString(const Value: string);
function GetJSONString: string;
function GetJSON: TJDOJsonObject;
function ToString(const Compact: Boolean): string;
procedure SetJSON(const Value: TJDOJsonObject);
property AsJSON: TJDOJsonObject read GetJSON write SetJSON;
property AsJSONString: string read GetJSONString write SetJsonString;
end;
TJSONRPCObject = class(TInterfacedObject, IJSONRPCObject)
protected
procedure SetJsonString(const Value: string); virtual;
function GetJSONString: string; virtual;
function ToString(const Compact: Boolean): string; reintroduce; virtual;
function GetJSON: TJDOJsonObject; virtual;
procedure SetJSON(const Value: TJDOJsonObject); virtual;
property AsJSON: TJDOJsonObject read GetJSON write SetJSON;
property AsJSONString: string read GetJSONString write SetJsonString;
public
constructor Create; virtual;
end;
TJSONRPCParamDataType = (pdtString, pdtInteger, pdtLongInteger, pdTJDOJsonObject, pdtJSONArray, pdtBoolean, pdtDate,
pdtTime, pdtDateTime, pdtFloat, pdtObject);
TJSONRPCRequestParams = class
private
function GetItem(const Index: Integer): TValue;
function GetItemDataType(const Index: Integer): TJSONRPCParamDataType;
protected
fParamValues: TList<TValue>;
fParamNames: TList<string>;
fParamTypes: TList<TJSONRPCParamDataType>;
private
procedure CheckNotNames;
procedure CheckBalancedParams;
function GetItemName(const Index: Integer): string;
public
constructor Create; virtual;
destructor Destroy; override;
procedure Clear;
function Count: Integer;
property Items[const index: Integer]: TValue read GetItem; default;
property ItemsType[const index: Integer]: TJSONRPCParamDataType read GetItemDataType;
property ItemsName[const index: Integer]: string read GetItemName;
function ToArray: TArray<TValue>;
procedure Add(const Value: string); overload;
procedure Add(const Value: Integer); overload;
procedure Add(const Value: TJDOJsonObject); overload;
procedure Add(const Value: TJDOJsonArray); overload;
procedure Add(const Value: Boolean); overload;
procedure Add(const Value: TDate); overload;
procedure Add(const Value: TTime); overload;
procedure Add(const Value: TDateTime); overload;
procedure Add(const Value: Double); overload;
procedure Add(const Value: TValue; const ParamType: TJSONRPCParamDataType); overload;
procedure AddByName(const Name: string; const Value: string); overload;
procedure AddByName(const Name: string; const Value: Integer); overload;
procedure AddByName(const Name: string; const Value: TJDOJsonObject); overload;
procedure AddByName(const Name: string; const Value: TJDOJsonArray); overload;
procedure AddByName(const Name: string; const Value: Boolean); overload;
procedure AddByName(const Name: string; const Value: TDate); overload;
procedure AddByName(const Name: string; const Value: TTime); overload;
procedure AddByName(const Name: string; const Value: TDateTime); overload;
procedure AddByName(const Name: string; const Value: Double); overload;
procedure AddByName(const Name: string; const Value: TValue; const ParamType: TJSONRPCParamDataType); overload;
end;
IJSONRPCNotification = interface(IJSONRPCObject)
['{FAA65A29-3305-4303-833E-825BDBD3FF7F}']
procedure SetMethod(const Value: string);
procedure FillParameters(const JSON: TJDOJsonObject; const RTTIMethod: TRTTIMethod);
function GetMethod: string;
function GetParams: TJSONRPCRequestParams;
property Method: string read GetMethod write SetMethod;
property Params: TJSONRPCRequestParams read GetParams;
end;
TJSONRPCNotification = class(TJSONRPCObject, IJSONRPCObject, IJSONRPCNotification)
protected
FMethod: string;
FParams: TJSONRPCRequestParams;
procedure FillParameters(const JSON: TJDOJsonObject; const RTTIMethod: TRTTIMethod);
procedure SetMethod(const Value: string);
function GetMethod: string;
function GetParams: TJSONRPCRequestParams;
function GetJSON: TJDOJsonObject; override;
property Method: string read GetMethod write SetMethod;
property Params: TJSONRPCRequestParams read GetParams;
public
constructor Create; overload; override;
constructor Create(const aMethod: string); reintroduce; overload;
destructor Destroy; override;
end;
{$SCOPEDENUMS ON}
TJSONRPCRequestType = (Request, Notification);
IJSONRPCRequest = interface(IJSONRPCNotification)
['{D8318032-0261-4273-B99D-121899AD52FB}']
function GetRequestType: TJSONRPCRequestType;
function GetID: TValue;
procedure SetID(const Value: TValue);
property RequestType: TJSONRPCRequestType read GetRequestType;
property RequestID: TValue read GetID write SetID;
end;
TJSONRPCRequest = class(TJSONRPCNotification, IJSONRPCRequest)
private
FID: TValue;
function GetRequestType: TJSONRPCRequestType;
function GetID: TValue;
protected
procedure SetJSON(const JSON: TJDOJsonObject); override;
function GetJSON: TJDOJsonObject; override;
procedure SetID(const Value: TValue);
property RequestType: TJSONRPCRequestType read GetRequestType;
property RequestID: TValue read GetID write SetID;
public
constructor Create(const aID: TValue; const aMethod: string); overload; virtual;
constructor Create(const aID: TValue); overload; virtual;
constructor Create; reintroduce; overload; virtual;
destructor Destroy; override;
end;
TJSONRPCResponseError = class
private
FCode: Integer;
FMessage: string;
FData: TValue;
procedure SetCode(const Value: Integer);
procedure SetMessage(const Value: string);
procedure SetData(const Value: TValue);
public
constructor Create; virtual;
destructor Destroy; override;
property Code: Integer read FCode write SetCode;
property ErrMessage: string read FMessage write SetMessage;
property Data: TValue read fData write SetData;
end;
IJSONRPCResponse = interface(IJSONRPCObject)
['{69B43409-14DC-4A36-9E12-425A1626FF3C}']
function GetID: TValue;
procedure SetID(const Value: TValue);
function GetResult: TValue;
procedure SetResult(const Value: TValue);
function GetError: TJSONRPCResponseError;
procedure SetError(const Value: TJSONRPCResponseError);
function IsError: Boolean;
function ResultAsJSONObject: TJDOJsonObject;
function ResultAsJSONArray: TJDOJsonArray;
property Result: TValue read GetResult write SetResult;
property Error: TJSONRPCResponseError read GetError write SetError;
property RequestID: TValue read GetID write SetID;
end;
TJSONRPCResponse = class(TJSONRPCObject, IJSONRPCResponse)
private
FResult: TValue;
FError: TJSONRPCResponseError;
FID: TValue;
protected
function GetResult: TValue;
function GetJSON: TJDOJsonObject; override;
procedure SetJSON(const JSON: TJDOJsonObject); override;
procedure SetID(const Value: TValue);
procedure SetResult(const Value: TValue);
procedure SetError(const Value: TJSONRPCResponseError);
function GetError: TJSONRPCResponseError;
function GetID: TValue;
function ResultAsJSONObject: TJDOJsonObject;
function ResultAsJSONArray: TJDOJsonArray;
function IsError: Boolean;
property Result: TValue read GetResult write SetResult;
property Error: TJSONRPCResponseError read GetError write SetError;
property RequestID: TValue read GetID write SetID;
public
constructor Create; override;
destructor Destroy; override;
end;
TJSONRPCNullResponse = class(TJSONRPCObject, IJSONRPCResponse)
private
FError: TJSONRPCResponseError;
procedure RaiseErrorForNullObject;
protected
function ToString(const Compact: Boolean): string; override;
function GetJSONString: string; override;
procedure SetJsonString(const Value: string); override;
function GetJSON: TJDOJsonObject; override;
procedure SetJSON(const JSON: TJDOJsonObject); override;
procedure SetID(const Value: TValue);
procedure SetResult(const Value: TValue);
procedure SetError(const Value: TJSONRPCResponseError);
function GetError: TJSONRPCResponseError;
function GetID: TValue;
function GetResult: TValue;
function ResultAsJSONObject: TJDOJsonObject;
function ResultAsJSONArray: TJDOJsonArray;
function IsError: Boolean;
property Result: TValue read GetResult write SetResult;
property Error: TJSONRPCResponseError read GetError write SetError;
property RequestID: TValue read GetID write SetID;
end;
EMVCJSONRPCInvalidVersion = class(Exception)
end;
EMVCJSONRPCException = class(Exception)
end;
EMVCJSONRPCRemoteException = class(EMVCJSONRPCException)
private
fErrData: TValue;
fErrCode: Integer;
fErrMessage: String;
public
constructor Create(const ErrCode: Integer; const ErrMessage: String; const ErrData: TValue); overload;
constructor Create(const ErrCode: Integer; const ErrMessage: String); overload;
property Data: TValue read fErrData;
property ErrCode: Integer read fErrCode;
property ErrMessage: String read fErrMessage;
end;
EMVCJSONRPCErrorResponse = class abstract(Exception)
protected
fJSONRPCErrorCode: Integer;
fJSONRPCErrorData: TValue;
public
property JSONRPCErrorCode: Integer read fJSONRPCErrorCode;
property JSONRPCErrorData: TValue read fJSONRPCErrorData;
end;
EMVCJSONRPCError = class(EMVCJSONRPCErrorResponse)
public
constructor Create(const ErrCode: Integer; const ErrMsg: string); overload;
constructor Create(const ErrCode: Integer; const ErrMsg: string; const Data: TValue); overload;
constructor CreateFmt(const ErrCode: Integer; const ErrMsg: string; const Args: array of const);
end;
EMVCJSONRPCParseError = class(EMVCJSONRPCErrorResponse)
public
constructor Create;
procedure AfterConstruction; override;
end;
EMVCJSONRPCInvalidRequest = class(EMVCJSONRPCErrorResponse)
public
constructor Create(const Message: string = ''); overload;
procedure AfterConstruction; override;
end;
EMVCJSONRPCMethodNotFound = class(EMVCJSONRPCErrorResponse)
public
constructor Create(const MethodName: string);
procedure AfterConstruction; override;
end;
EMVCJSONRPCInvalidParams = class(EMVCJSONRPCErrorResponse)
public
constructor Create(const Message: string);
procedure AfterConstruction; override;
end;
EMVCJSONRPCInternalError = class(EMVCJSONRPCErrorResponse)
public
constructor Create;
procedure AfterConstruction; override;
end;
{ -32000 to -32099 Server error Reserved for implementation-defined server-errors. }
EMVCJSONRPCServerError = class(EMVCJSONRPCErrorResponse)
public
constructor Create(const JSONRPCError: Integer; const Message: string);
end;
TMVCJSONObject = TJDOJsonObject;
TMVCJSONArray = TJDOJsonArray;
TMVCJSONRPCController = class(TMVCController)
private
fExceptionHandler: TMVCJSONRPCExceptionHandlerProc;
fSerializer: TMVCJsonDataObjectsSerializer;
fRPCInstance: TObject;
fOwsRPCInstance: Boolean;
function GetSerializer: TMVCJsonDataObjectsSerializer;
function GetDeclaredMethod(lMethod: string; lRTTIType: TRttiType): TRTTIMethod;
function GetInheritedMethod(lMethod: string; lRTTIType: TRttiType): TRTTIMethod;
protected
function CreateError(const RequestID: TValue; const ErrorCode: Integer;
const Message: string): TJDOJsonObject; overload;
function CreateError(const RequestID: TValue; const ErrorCode: Integer;
const Message: string; const Data: TValue): TJDOJsonObject; overload;
function CreateResponse(const RequestID: TValue; const Value: TValue): TJSONRPCResponse;
function CreateRequest(const JSON: TJDOJsonObject): IJSONRPCRequest;
function JSONObjectAs<T: class, constructor>(const JSON: TJDOJsonObject): T;
function CanBeRemotelyInvoked(const RTTIMethod: TRTTIMethod): Boolean;
procedure ForEachInvokableMethod(const aProc: TProc<TRTTIMethod>);
procedure TryToCallMethod(const aRTTIType: TRttiType; const MethodName: string; const Parameter: TJDOJsonObject);
function GetJSONRPCPayload(const Request: TMVCWebRequest): TJsonObject;
public
[MVCPath]
[MVCHTTPMethods([httpPOST, httpGET])]
[MVCConsumes(TMVCMediaType.APPLICATION_JSON)]
[MVCProduces(TMVCMediaType.APPLICATION_JSON)]
procedure Index; virtual;
[MVCPath('/describe')]
[MVCHTTPMethods([httpGET])]
procedure GetPublishedMethodList; virtual;
[MVCPath('/proxy')]
[MVCHTTPMethods([httpGET])]
procedure GetProxyCode; virtual;
constructor Create; overload; override;
destructor Destroy; override;
end;
TMVCJSONRPCPublisher = class(TMVCJSONRPCController)
public
constructor Create(const RPCInstance: TObject; const Owns: Boolean = True; ExceptionHandler: TMVCJSONRPCExceptionHandlerProc = nil);
reintroduce; overload;
end;
TJSONRPCProxyGenerator = class abstract
public
constructor Create; virtual;
procedure StartGeneration(const aClassName: string); virtual;
procedure EndGeneration; virtual;
procedure VisitMethod(const aRTTIMethod: TRTTIMethod); virtual; abstract;
function GetCode: string; virtual; abstract;
end;
TJSONRPCProxyGeneratorClass = class of TJSONRPCProxyGenerator;
procedure RegisterJSONRPCProxyGenerator(const aLanguage: string; const aClass: TJSONRPCProxyGeneratorClass);
implementation
uses
MVCFramework.Serializer.Intf,
MVCFramework.Logger,
System.TypInfo,
MVCFramework.Rtti.Utils,
MVCFramework.DuckTyping,
MVCFramework.Serializer.jsondataobjects.CustomTypes;
const
CALL_TYPE: array [mkProcedure .. mkFunction] of string = ('PROCEDURE', 'FUNCTION');
var
GProxyGeneratorsRegister: TDictionary<string, TJSONRPCProxyGeneratorClass>;
function IsReservedMethodName(const MethodName: string): Boolean;
var
lMethod: string;
begin
Result := False;
for lMethod in JSONRPC_HOOKS_METHOD_NAMES do
begin
if SameText(MethodName, lMethod) then
begin
Exit(True);
end;
end;
end;
procedure AppendTValueToJsonArray(const Value: TValue; const ParamType: TJSONRPCParamDataType;
const JSONArr: TJDOJsonArray);
var
lSer: TMVCJsonDataObjectsSerializer;
lJArr: TJDOJsonArray;
LJObj: TJDOJsonObject;
lOrdinalValue: Int64;
begin
case ParamType of
pdtInteger:
begin
JSONArr.Add(Value.AsInteger);
end;
pdtFloat:
begin
JSONArr.Add(Value.AsExtended);
end;
pdtDateTime:
begin
JSONArr.Add(DateTimeToISOTimeStamp(FloatToDateTime(Value.AsExtended)));
end;
pdtDate:
begin
JSONArr.Add(DateToISODate(FloatToDateTime(Value.AsExtended)));
end;
pdtTime:
begin
JSONArr.Add(TimeToISOTime(FloatToDateTime(Value.AsExtended)));
end;
pdtString:
begin
JSONArr.Add(Value.AsString);
end;
pdtLongInteger:
begin
JSONArr.Add(Value.AsInt64);
end;
pdtBoolean:
begin
if not Value.TryAsOrdinal(lOrdinalValue) then
begin
raise EMVCException.Create('Invalid ordinal parameter');
end;
JSONArr.Add(lOrdinalValue = 1);
end;
pdTJDOJsonObject:
begin
JSONArr.Add((Value.AsObject as TJDOJsonObject).Clone as TJDOJsonObject);
end;
pdtJSONArray:
begin
JSONArr.Add((Value.AsObject as TJDOJsonArray).Clone as TJDOJsonArray);
end;
pdtObject:
begin
if Value.AsObject is TDataSet then
begin
lSer := TMVCJsonDataObjectsSerializer.Create;
try
lJArr := TJDOJsonArray.Create;
JSONArr.Add(lJArr);
lSer.DataSetToJsonArray(TDataSet(Value.AsObject), lJArr, TMVCNameCase.ncLowerCase, []);
finally
lSer.Free;
end
end
else
begin
lSer := TMVCJsonDataObjectsSerializer.Create;
try
LJObj := lSer.SerializeObjectToJSON(Value.AsObject, TMVCSerializationType.stProperties, [], nil);
JSONArr.Add(LJObj);
finally
lSer.Free;
end;
end;
end;
else
raise EMVCException.Create('Invalid type');
end;
end;
procedure AppendTValueToJsonObject(const Value: TValue; const Name: string; const ParamType: TJSONRPCParamDataType;
const JSONObj: TJDOJsonObject);
var
lSer: TMVCJsonDataObjectsSerializer;
lOrdinalValue: Int64;
begin
case ParamType of
pdtInteger:
begin
JSONObj.I[name] := Value.AsInteger;
end;
pdtFloat:
begin
JSONObj.F[name] := Value.AsExtended;
end;
pdtDateTime:
begin
JSONObj.S[name] := DateTimeToISOTimeStamp(FloatToDateTime(Value.AsExtended));
end;
pdtDate:
begin
JSONObj.S[name] := DateToISODate(FloatToDateTime(Value.AsExtended));
end;
pdtTime:
begin
JSONObj.S[name] := TimeToISOTime(FloatToDateTime(Value.AsExtended));
end;
pdtString:
begin
JSONObj.S[name] := Value.AsString;
end;
pdtLongInteger:
begin
JSONObj.L[name] := Value.AsInt64;
end;
pdtBoolean:
begin
if not Value.TryAsOrdinal(lOrdinalValue) then
begin
raise EMVCException.Create('Invalid ordinal parameter');
end;
JSONObj.B[name] := lOrdinalValue = 1;
end;
pdTJDOJsonObject:
begin
JSONObj.O[name] := (Value.AsObject as TJDOJsonObject).Clone as TJDOJsonObject;
end;
pdtJSONArray:
begin
JSONObj.A[name] := (Value.AsObject as TJDOJsonArray).Clone as TJDOJsonArray;
end;
pdtObject:
begin
if Value.AsObject is TDataSet then
begin
lSer := TMVCJsonDataObjectsSerializer.Create;
try
lSer.DataSetToJsonArray(TDataSet(Value.AsObject), JSONObj.A[name], TMVCNameCase.ncLowerCase, []);
finally
lSer.Free;
end
end
else
begin
lSer := TMVCJsonDataObjectsSerializer.Create;
try
JSONObj.O[name] := lSer.SerializeObjectToJSON(Value.AsObject, TMVCSerializationType.stProperties, [], nil);
finally
lSer.Free;
end;
end;
end;
else
raise EMVCException.Create('Invalid type');
end;
end;
function JSONDataValueToTValue(const JSONDataValue: TJsonDataValueHelper): TValue; overload;
begin
case JSONDataValue.Typ of
jdtString:
begin
Result := JSONDataValue.Value;
end;
jdtFloat:
begin
Result := JSONDataValue.FloatValue;
end;
jdtBool:
begin
Result := JSONDataValue.BoolValue;
end;
jdtArray:
begin
Result := JSONDataValue.ArrayValue.Clone as TJDOJsonArray;
end;
jdtObject:
begin
if JSONDataValue.IsNull then
Result := nil
else
Result := JSONDataValue.ObjectValue.Clone as TJDOJsonObject;
end;
jdtInt:
begin
Result := JSONDataValue.IntValue;
end;
jdtLong:
begin
Result := JSONDataValue.LongValue;
end;
jdtULong:
begin
Result := JSONDataValue.ULongValue;
end;
else
raise EMVCJSONRPCException.CreateFmt('Invalid parameter type [%d]', [Ord(JSONDataValue.Typ)]);
end;
end;
function BuildDeclaration(const RTTIParameter: TRttiParameter): string;
begin
Result := RTTIParameter.Name + ': ' + RTTIParameter.ParamType.Name;
end;
procedure JSONDataValueToTValueParam(const JSONDataValue: TJsonDataValueHelper; const RTTIParameter: TRttiParameter;
const JSONRPCRequestParams: TJSONRPCRequestParams);
begin
case RTTIParameter.ParamType.TypeKind of
tkString, tkUString {$IF CompilerVersion > 28}, tkAnsiString {$ENDIF}:
begin
if JSONDataValue.Typ <> jdtString then
begin
raise EMVCJSONRPCInvalidParams.Create('Invalid param type for [' + BuildDeclaration(RTTIParameter) + ']');
end;
JSONRPCRequestParams.Add(JSONDataValue.Value);
end;
tkFloat:
begin
if SameText(RTTIParameter.ParamType.Name, 'TDate') then
begin
JSONRPCRequestParams.Add(ISODateToDate(JSONDataValue.Value), pdtDate);
end
else if SameText(RTTIParameter.ParamType.Name, 'TDateTime') then
begin
if JSONDataValue.Value.Contains('T') then
JSONRPCRequestParams.Add(JSONDataValue.UtcDateTimeValue, pdtDateTime)
else
JSONRPCRequestParams.Add(ISOTimeStampToDateTime(JSONDataValue.Value), pdtDateTime);
end
else if SameText(RTTIParameter.ParamType.Name, 'TTime') then
begin
JSONRPCRequestParams.Add(ISOTimeToTime(JSONDataValue.Value), pdtTime);
end
else
begin
// handle integer types passed where a float is expected
// FIX https://github.com/danieleteti/delphimvcframework/issues/270
case JSONDataValue.Typ of
jdtInt:
JSONRPCRequestParams.Add(JSONDataValue.IntValue, pdtFloat);
jdtLong:
JSONRPCRequestParams.Add(JSONDataValue.LongValue, pdtFloat);
jdtULong:
JSONRPCRequestParams.Add(JSONDataValue.ULongValue, pdtFloat);
else
begin
if JSONDataValue.Typ <> jdtFloat then
begin
raise EMVCJSONRPCInvalidRequest.Create(BuildDeclaration(RTTIParameter));
end;
JSONRPCRequestParams.Add(JSONDataValue.FloatValue, pdtFloat);
end;
end;
end
end;
tkEnumeration:
begin
if JSONDataValue.Typ <> jdtBool then
begin
raise EMVCJSONRPCInvalidRequest.Create(BuildDeclaration(RTTIParameter));
end;
JSONRPCRequestParams.Add(JSONDataValue.BoolValue, pdtBoolean);
end;
tkClass:
begin
if (SameText(RTTIParameter.ParamType.Name, TJDOJsonArray.ClassName)) then
begin
JSONRPCRequestParams.Add(JSONDataValue.ArrayValue.Clone, pdtJSONArray);
end
else if SameText(RTTIParameter.ParamType.Name, TJDOJsonObject.ClassName) then
begin
JSONRPCRequestParams.Add(JSONDataValue.ObjectValue.Clone as TJDOJsonObject, pdTJDOJsonObject);
end
else
begin
{ TODO -oDanieleT -cGeneral : Automatically inject the dseserialized version of arbitrary object? }
raise EMVCJSONRPCInvalidRequest.Create(BuildDeclaration(RTTIParameter));
end;
end;
tkInteger:
begin
if JSONDataValue.Typ <> jdtInt then
begin
raise EMVCJSONRPCInvalidRequest.Create(BuildDeclaration(RTTIParameter));
end;
JSONRPCRequestParams.Add(JSONDataValue.IntValue, pdtInteger);
end;
tkInt64:
begin
if JSONDataValue.Typ = jdtInt then
begin
JSONRPCRequestParams.Add(JSONDataValue.IntValue, pdtInteger);
end
else if JSONDataValue.Typ = jdtLong then
begin
JSONRPCRequestParams.Add(JSONDataValue.LongValue, pdtLongInteger);
end
else if JSONDataValue.Typ = jdtULong then
begin
JSONRPCRequestParams.Add(JSONDataValue.ULongValue, pdtLongInteger);
end
else
begin
raise EMVCJSONRPCInvalidRequest.Create(BuildDeclaration(RTTIParameter));
end;
end;
else
begin
raise EMVCJSONRPCInvalidRequest.CreateFmt('Invalid parameter type for [%s]', [BuildDeclaration(RTTIParameter)]);
end;
end;
end;
{ TMVCJSONRPCMessage }
function TMVCJSONRPCMessage.AsJSON: TJDOJsonObject;
begin
Result := TMVCJSONObject.Create;
Result.S[JSONRPC_HEADER] := JSONRPC_VERSION;
end;
function TMVCJSONRPCMessage.AsJSONRPCMessage: string;
begin
Result := fJSON.ToJSON();
end;
class procedure TMVCJSONRPCMessage.CheckID(const aJSON: TMVCJSONObject; out aIsNotification: Boolean);
begin
{
id
An identifier established by the Client that MUST contain a String, Number, or NULL value if included.
If it is not included it is assumed to be a notification.
The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]
}
aIsNotification := not aJSON.Contains(JSONRPC_ID);
if not aIsNotification then
begin
if not(aJSON.Types[JSONRPC_ID] in [jdtString, jdtInt, jdtLong, jdtULong, jdtNone]) then
raise EMVCJSONRPCException.Create('Message is not a notification but its ''id'' property is not valid');
end;
end;
class procedure TMVCJSONRPCMessage.CheckMethod(const aJSON: TMVCJSONObject);
begin
if (aJSON.Types[JSONRPC_METHOD] <> jdtString) then
raise EMVCJSONRPCException.Create('Invalid ''method''');
end;
class procedure TMVCJSONRPCMessage.CheckVersion(const aJSON: TMVCJSONObject);
begin
if not Assigned(aJSON) then
raise EMVCJSONRPCException.Create('JSON not assigned');
if aJSON.S[JSONRPC_HEADER] <> JSONRPC_VERSION then
raise EMVCJSONRPCInvalidVersion.Create(JSONRPC_HEADER + ' must be "2.0"');
end;
constructor TMVCJSONRPCMessage.Create;
begin
inherited Create;
end;
{ TMVCJSONRPCController }
constructor TMVCJSONRPCPublisher.Create(const RPCInstance: TObject; const Owns: Boolean = True; ExceptionHandler:
TMVCJSONRPCExceptionHandlerProc = nil);
begin
inherited Create;
fRPCInstance := RPCInstance;
fOwsRPCInstance := Owns;
fExceptionHandler := ExceptionHandler;
end;
// procedure TMVCJSONRPCController.CheckInputParametersTypes(aRTTIMethod: TRTTIMethod);
// var
// lParam: TRttiParameter;
// begin
// for lParam in aRTTIMethod.GetParameters do
// begin
// if lParam.ParamType.TypeKind in [tkClass] then
// begin
// if not(SameText(lParam.ParamType.QualifiedName, 'JsonDataObjects.TJDOJsonObject') or
// SameText(lParam.ParamType.QualifiedClassName, 'JsonDataObjects.TJDOJsonArray')) then
// begin
// raise EMVCJSONRPCException.Create('Parameter [' + lParam.Name + ': ' + lParam.ParamType.QualifiedName +
// '] is not allowed as input parameter');
// end;
// end;
// end;
//
// end;
function TMVCJSONRPCController.CanBeRemotelyInvoked(const RTTIMethod: TRTTIMethod): Boolean;
begin
Result := (RTTIMethod.Visibility = mvPublic) and (RTTIMethod.MethodKind in [mkProcedure, mkFunction]);
Result := Result and not IsReservedMethodName(RTTIMethod.Name);
end;
constructor TMVCJSONRPCController.Create;
begin
inherited Create;
fRPCInstance := Self;
fOwsRPCInstance := False;
end;
function TMVCJSONRPCController.CreateError(const RequestID: TValue; const ErrorCode: Integer; const Message: string)
: TJDOJsonObject;
begin
Result := CreateError(RequestID, ErrorCode, Message, TValue.Empty);
end;
function TMVCJSONRPCController.CreateError(const RequestID: TValue; const ErrorCode: Integer; const Message: string; const Data: TValue)
: TJDOJsonObject;
var
lErrResp: TJSONRPCResponse;
begin
lErrResp := TJSONRPCResponse.Create;
try
lErrResp.RequestID := RequestID;
lErrResp.Error := TJSONRPCResponseError.Create;
lErrResp.Error.Code := ErrorCode;
lErrResp.Error.ErrMessage := message;
if not Data.IsEmpty then
begin
lErrResp.Error.Data := Data;
end;
Result := lErrResp.AsJSON;
finally
lErrResp.Free;
end;
end;
function TMVCJSONRPCController.CreateRequest(const JSON: TJDOJsonObject): IJSONRPCRequest;
var
lReqID: TValue;
lMethodName: string;
begin
if JSON.Types[JSONRPC_ID] = jdtString then
lReqID := JSON.S[JSONRPC_ID]
else if JSON.Types[JSONRPC_ID] = jdtInt then
lReqID := JSON.I[JSONRPC_ID]
else if JSON.Types[JSONRPC_ID] = jdtLong then
lReqID := JSON.L[JSONRPC_ID]
else if JSON.Types[JSONRPC_ID] = jdtULong then
lReqID := JSON.U[JSONRPC_ID]
else
lReqID := TValue.Empty;
lMethodName := JSON.S[JSONRPC_METHOD];
Result := TJSONRPCRequest.Create(lReqID, lMethodName);
{
if JSON.Types[JSONRPC_PARAMS] = jdtArray then
begin
lParams := JSON.A[JSONRPC_PARAMS];
for I := 0 to lParams.Count - 1 do
begin
Result.Params.Add(JSONDataValueToTValue(lParams[I]));
end;
end
else if JSON.Types[JSONRPC_PARAMS] <> jdtNone then
begin
raise EMVCJSONRPCException.Create('Params must be a JSON array or null');
end;
}
end;
function TMVCJSONRPCController.CreateResponse(const RequestID: TValue; const Value: TValue): TJSONRPCResponse;
begin
Result := TJSONRPCResponse.Create;
Result.RequestID := RequestID;
Result.Result := Value;
end;
destructor TMVCJSONRPCController.Destroy;
begin
if Assigned(fRPCInstance) and fOwsRPCInstance then
begin
fRPCInstance.Free;
end;
fSerializer.Free;
inherited;
end;
function TMVCJSONRPCController.GetDeclaredMethod(lMethod: string; lRTTIType: TRttiType): TRTTIMethod;
var
lRTTIDeclaredMethods: TArray<TRTTIMethod>;
I: Integer;
begin
Result := nil;
lRTTIDeclaredMethods := lRTTIType.GetDeclaredMethods;
for I := 0 to Length(lRTTIType.GetDeclaredMethods) - 1 do
begin
if SameText(lRTTIDeclaredMethods[I].Name, lMethod) then
begin
Result := lRTTIDeclaredMethods[I];
Break;
end;
end;
end;
function TMVCJSONRPCController.GetInheritedMethod(lMethod: string; lRTTIType: TRttiType): TRTTIMethod;
var
lRTTIMethod: TRTTIMethod;
begin
Result := nil;
lRTTIMethod := lRTTIType.GetMethod(lMethod);
if Assigned(lRTTIMethod) then
begin
if TMVCSerializerHelper.HasAttribute<MVCInheritableAttribute>(lRTTIMethod) then
begin
Result := lRTTIMethod;
end;
end;
end;
function TMVCJSONRPCController.GetJSONRPCPayload(const Request: TMVCWebRequest): TJsonObject;
var
lParams: string;
lJ: TJsonBaseObject;
begin
// https://www.simple-is-better.org/json-rpc/transport_http.html#get-request
// http get :8080/jsonrpc jsonrpc==2 method==subtract params=={\"Value1\":10,\"Value2\":3} id==1234
// http get :8080/jsonrpc jsonrpc==2 id==1234 method==subtract params==[10,3]
Result := TJsonObject.Create;
try
Result.S['jsonrpc'] := Request.QueryStringParam('jsonrpc');
Result.S['method'] := Request.QueryStringParam('method');
if Request.QueryStringParamExists('id') then
begin
Result.S['id'] := Request.QueryStringParam('id');
end;
lParams := Request.QueryStringParam('params');
lJ := TJsonObject.Parse(lParams);
if lJ is TJsonArray then
Result.A['params'] := TJsonArray(lJ)
else
Result.O['params'] := TJsonObject(lJ);
except
Result.Free;
raise
end;
end;
procedure TMVCJSONRPCController.ForEachInvokableMethod(const aProc: TProc<TRTTIMethod>);
var
lRTTI: TRTTIContext;
lRTTIType: TRttiType;
lRTTIMethodList: TArray<TRTTIMethod>;
lRTTIMethod: TRTTIMethod;
lGeneratedMethods: TList<String>;
function MethodSign(const RTTIMethod: TRTTIMethod): String;
begin
Result := RTTIMethod.ToString.ToLower;
end;
begin
lGeneratedMethods := TList<String>.Create;
try
lRTTI := TRTTIContext.Create;
try
lRTTIType := lRTTI.GetType(fRPCInstance.ClassType);
lRTTIMethodList := lRTTIType.GetDeclaredMethods;
for lRTTIMethod in lRTTIMethodList do
begin
if CanBeRemotelyInvoked(lRTTIMethod) then
begin
aProc(lRTTIMethod);
lGeneratedMethods.Add(MethodSign(lRTTIMethod));
end;
end;
lRTTIMethodList := lRTTIType.BaseType.GetMethods;
for lRTTIMethod in lRTTIMethodList do
begin
if TMVCSerializerHelper.HasAttribute<MVCInheritableAttribute>(lRTTIMethod) and CanBeRemotelyInvoked(lRTTIMethod)
and (not lGeneratedMethods.Contains(MethodSign(lRTTIMethod))) then
begin
aProc(lRTTIMethod);
end;
end;
finally
lRTTI.Free;
end;
finally
lGeneratedMethods.Free;
end;
end;
procedure TMVCJSONRPCController.GetProxyCode;
var
lLanguage: string;
lClass: TJSONRPCProxyGeneratorClass;
lGenerator: TJSONRPCProxyGenerator;
lRTTI: TRTTIContext;
lContentType: string;
begin
lLanguage := Context.Request.Params['language'].ToLower;
if lLanguage.IsEmpty then
begin
lLanguage := 'delphi';
end;
if Context.Request.QueryStringParamExists('content-type') then
begin
lContentType := Context.Request.Params['content-type'];
end
else
begin
lContentType := 'text/plain';
end;
if not Assigned(GProxyGeneratorsRegister) then
begin
raise EMVCJSONRPCException.Create
('No Proxy Generators have been registered. [HINT] Use RegisterJSONRPCProxyGenerator function');
end;
if not GProxyGeneratorsRegister.TryGetValue(lLanguage, lClass) then
begin
raise EMVCJSONRPCException.CreateFmt('Unknown language [%s]', [lLanguage]);
end;
lGenerator := lClass.Create;
try
lRTTI := TRTTIContext.Create;
try
lGenerator.StartGeneration(fRPCInstance.ClassType.ClassName);
ForEachInvokableMethod(
procedure(aRTTIMethod: TRTTIMethod)
begin
lGenerator.VisitMethod(aRTTIMethod);
end);
lGenerator.EndGeneration();
Context.Response.ContentType := lContentType;
Render(lGenerator.GetCode);
finally
lRTTI.Free;
end;
finally
lGenerator.Free;
end;
end;
procedure TMVCJSONRPCController.GetPublishedMethodList;
begin
ResponseStream.AppendLine('// ' + StringOfChar('*', 80));
ResponseStream.AppendLine('// Generated by ' + DMVCFRAMEWORK_VERSION + ' at ' +
FormatDateTime('yyyy-mm-dd hh:nn:ss', Now));
ResponseStream.AppendLine('// ' + StringOfChar('*', 80));
ResponseStream.AppendLine('');
ForEachInvokableMethod(
procedure(aRTTIMethod: TRTTIMethod)
var
lAtt: MVCDocAttribute;
lLines: TArray<String>;
lLine: String;
begin
if IsReservedMethodName(aRTTIMethod.Name) then
begin
Exit;
end;
lAtt := TRTTIUtils.GetAttribute<MVCDocAttribute>(aRTTIMethod);
if Assigned(lAtt) then
begin
lLines := lAtt.Value.Split([sLineBreak]);
for lLine in lLines do
begin
ResponseStream.AppendLine('// ' + lLine);
end;
end;
ResponseStream.AppendLine(aRTTIMethod.ToString + ';');
end);
RenderResponseStream;
end;
function TMVCJSONRPCController.GetSerializer: TMVCJsonDataObjectsSerializer;
begin
if not Assigned(fSerializer) then
fSerializer := TMVCJsonDataObjectsSerializer.Create;
Result := fSerializer;
end;
procedure TMVCJSONRPCController.Index;
var
lJSONRPCReq: IJSONRPCRequest;
lMethod: string;
lRTTI: TRTTIContext;
lRTTIType: TRttiType;
lRTTIMethod: TRTTIMethod;
lRes: TValue;
lJSONRPCResponse: IJSONRPCResponse;
lParamsToInject: TArray<TValue>;
lReqID: TValue;
lJSON: TJDOJsonObject;
lJSONResp: TJDOJsonObject;
lBeforeCallHookHasBeenInvoked: Boolean;
lAfterCallHookHasBeenInvoked: Boolean;
lTypeAttrs: TArray<TCustomAttribute>;
lHTTPVerb: TMVCHTTPMethodType;
lAllMethodsCallableWithGET: Boolean;
lExceptionHandled: Boolean;
lJSONRespErrorInfo: TMVCJSONRPCExceptionErrorInfo;
begin
lBeforeCallHookHasBeenInvoked := False;
lAfterCallHookHasBeenInvoked := False;
lAllMethodsCallableWithGET := False;
lRTTIType := nil;
lReqID := TValue.Empty;
SetLength(lParamsToInject, 0);
lRTTI := TRTTIContext.Create;
try
try
lHTTPVerb := Context.Request.HTTPMethod;
case lHTTPVerb of
httpGET:
begin
lJSON := GetJSONRPCPayload(Context.Request);
end;
httpPOST:
begin
lJSON := StrToJSONObject(Context.Request.Body);
end;
else
raise EMVCJSONRPCInvalidRequest.Create('Only POST and GET Allowed');
end;
try
if not Assigned(lJSON) then
begin
raise EMVCJSONRPCParseError.Create;
end;
lRTTIType := lRTTI.GetType(fRPCInstance.ClassType);
if lHTTPVerb = httpGET then
begin
lTypeAttrs := lRTTIType.GetAttributes;
lAllMethodsCallableWithGET := (Length(lTypeAttrs) > 0) and
TMVCSerializerHelper.AttributeExists<MVCJSONRPCAllowGET>(lTypeAttrs);
end;
lJSONRPCReq := CreateRequest(lJSON);
lMethod := lJSONRPCReq.Method;
if IsReservedMethodName(lMethod) then
begin
raise EMVCJSONRPCInvalidRequest.CreateFmt
('Requested method name [%s] is reserved and cannot be called remotely', [lMethod]);
end;
TryToCallMethod(lRTTIType, JSONRPC_HOOKS_ON_BEFORE_ROUTING, lJSON);
if lJSONRPCReq.RequestType = TJSONRPCRequestType.Request then
begin
if lJSONRPCReq.RequestID.IsEmpty then
raise EMVCJSONRPCInvalidRequest.Create;
lReqID := lJSONRPCReq.RequestID;
end;
lRTTIMethod := GetDeclaredMethod(lMethod, lRTTIType);
if not Assigned(lRTTIMethod) then
begin
lRTTIMethod := GetInheritedMethod(lMethod, lRTTIType);
end;
if Assigned(lRTTIMethod) then
begin
if (lJSONRPCReq.RequestType = TJSONRPCRequestType.Request) and (lRTTIMethod.MethodKind <> mkFunction) then
begin
raise EMVCJSONRPCInvalidParams.Create
('Cannot call a procedure using a JSON-RPC request. [HINT] Use requests for functions and notifications for procedures');
end;
if (lJSONRPCReq.RequestType = TJSONRPCRequestType.Notification) and (lRTTIMethod.MethodKind <> mkProcedure)
then
begin
raise EMVCJSONRPCInvalidParams.Create
('Cannot call a function using a JSON-RPC notification. [HINT] Use requests for functions and notifications for procedures');
end;
if not CanBeRemotelyInvoked(lRTTIMethod) then
begin
LogW(Format('Method [%s] cannot remotely invoked. Only public functions or procedures can be called.',
[lMethod]));
raise EMVCJSONRPCMethodNotFound.Create(lMethod);
end;
if (lHTTPVerb = httpGET) and (not lAllMethodsCallableWithGET) then
begin
lTypeAttrs := lRTTIMethod.GetAttributes;
if (Length(lTypeAttrs) = 0) or (not TMVCSerializerHelper.AttributeExists<MVCJSONRPCAllowGET>(lTypeAttrs))
then
begin
raise EMVCJSONRPCError.Create(JSONRPC_ERR_INVALID_REQUEST, 'Method callable with POST only');
end;
end;
try
lJSONRPCReq.FillParameters(lJSON, lRTTIMethod);
except
on Ex: EMVCJSONRPCErrorResponse do
begin
raise EMVCJSONRPCInvalidParams.Create('Cannot map all parameters to remote method. ' + Ex.Message);
end;
end;
lJSONResp := nil;
// try
TryToCallMethod(lRTTIType, JSONRPC_HOOKS_ON_BEFORE_CALL, lJSON);
lBeforeCallHookHasBeenInvoked := True;
try
LogD('[JSON-RPC][CALL][' + CALL_TYPE[lRTTIMethod.MethodKind] + '][' + fRPCInstance.ClassName + '.' +
lRTTIMethod.Name + ']');
lRes := lRTTIMethod.Invoke(fRPCInstance, lJSONRPCReq.Params.ToArray);
except
on E: EInvalidCast do
begin
raise EMVCJSONRPCInvalidParams.Create('Check your input parameters types');
end;
on Ex: EMVCJSONRPCInvalidRequest do
begin
raise EMVCJSONRPCInvalidParams.Create(Ex.Message);
end;
end;
case lJSONRPCReq.RequestType of
TJSONRPCRequestType.Notification:
begin
ResponseStatus(HTTP_STATUS.NoContent);
end;
TJSONRPCRequestType.Request:
begin
lJSONRPCResponse := CreateResponse(lJSONRPCReq.RequestID, lRes);
ResponseStatus(200);
lJSONResp := lJSONRPCResponse.AsJSON;
end;
else
raise EMVCJSONRPCException.Create('Invalid RequestType');
end;
// finally
// if lBeforeCallHookHasBeenInvoked then
// begin
// TryToCallMethod(lRTTIType, JSONRPC_HOOKS_ON_AFTER_CALL, lJSONResp);
// lAfterCallHookHasBeenInvoked := True;
// end;
// if lJSONResp <> nil then
// begin
// try
// Render(lJSONResp);
// except
// try
// lJSONResp.Free;
// except
// // do nothing
// end;
// end;
// end;
// end;
end
else
begin
LogW(Format('Method "%s" has not be found in %s. Only public methods can be invoked.',
[lMethod, fRPCInstance.QualifiedClassName]));
raise EMVCJSONRPCMethodNotFound.Create(lMethod);
end;
finally
FreeAndNil(lJSON);
end;
except
on E: EMVCJSONRPCErrorResponse do
begin
{
http://www.jsonrpc.org/historical/json-rpc-over-http.html#response-codes
HTTP Status code message
500 -32700 Parse error.
400 -32600 Invalid Request.
404 -32601 Method not found.
500 -32602 Invalid params.
500 -32603 Internal error.
500 -32099..-32000 Server error.
}
case E.JSONRPCErrorCode of
JSONRPC_ERR_PARSE_ERROR:
ResponseStatus(500);
JSONRPC_ERR_INVALID_REQUEST:
ResponseStatus(400);
JSONRPC_ERR_METHOD_NOT_FOUND:
ResponseStatus(404);
JSONRPC_ERR_INVALID_PARAMS:
ResponseStatus(500);
JSONRPC_ERR_INTERNAL_ERROR:
ResponseStatus(500);
JSONRPC_ERR_SERVER_ERROR_LOWERBOUND .. JSONRPC_ERR_SERVER_ERROR_UPPERBOUND:
ResponseStatus(500);
end;
lJSONResp := CreateError(lReqID, E.JSONRPCErrorCode, E.Message, E.JSONRPCErrorData);
LogE(Format('[JSON-RPC][CLS %s][ERR %d][MSG "%s"]', [E.ClassName, E.JSONRPCErrorCode, E.Message]));
end;
on Ex: Exception do // use another name for exception variable, otherwise E is nil!!
begin
//lJSONResp := CreateError(lReqID, 0, Ex.Message);
LogE(Format('[JSON-RPC][CLS %s][MSG "%s"]', [Ex.ClassName, Ex.Message]));
if Assigned(fExceptionHandler) then
begin
lExceptionHandled := False;
lJSONRespErrorInfo.Code := 0;
lJSONRespErrorInfo.Msg := Ex.Message;
lJSONRespErrorInfo.Data := nil;
fExceptionHandler(Ex, Context, lJSONRespErrorInfo, lExceptionHandled);
try
if not lExceptionHandled then
begin
lJSONResp := CreateError(lReqID, 0, Ex.Message);
end
else
begin
lJSONResp := CreateError(lReqID, lJSONRespErrorInfo.Code,
lJSONRespErrorInfo.Msg, lJSONRespErrorInfo.Data);
end;
finally
if not lJSONRespErrorInfo.Data.IsEmpty then
begin
if lJSONRespErrorInfo.Data.IsObjectInstance then
begin
lJSONRespErrorInfo.Data.AsObject.Free;
end;
end;
end;
end
else
begin
lJSONResp := CreateError(lReqID, 0, Ex.Message);
end;
end;
end; // except
if lBeforeCallHookHasBeenInvoked and (not lAfterCallHookHasBeenInvoked) then
begin
try
TryToCallMethod(lRTTIType, JSONRPC_HOOKS_ON_AFTER_CALL, lJSONResp);
except
on E: Exception do
begin
FreeAndNil(lJSONResp);
if E is EMVCJSONRPCErrorResponse then
lJSONResp := CreateError(lReqID, EMVCJSONRPCErrorResponse(E).JSONRPCErrorCode, E.Message)
else
lJSONResp := CreateError(lReqID, 0, E.Message);
end;
end;
end;
Render(lJSONResp, True);
finally
lRTTI.Free;
end;
end;
function TMVCJSONRPCController.JSONObjectAs<T>(const JSON: TJDOJsonObject): T;
begin
Result := T.Create;
try
GetSerializer.JsonObjectToObject(JSON, Result, TMVCSerializationType.stProperties, []);
except
Result.Free;
raise;
end;
end;
procedure TMVCJSONRPCController.TryToCallMethod(const aRTTIType: TRttiType; const MethodName: string;
const Parameter: TJDOJsonObject);
var
lHookMethod: TRTTIMethod;
lHookSecondParam: TRttiParameter;
lHookSecondParamType: string;
lHookFirstParam: TRttiParameter;
lHookFirstParamType: string;
begin
if not Assigned(aRTTIType) then
begin
Exit;
end;
lHookMethod := aRTTIType.GetMethod(MethodName);
if Assigned(lHookMethod) then
begin
if (Length(lHookMethod.GetParameters) <> 2) then
begin
raise EMVCJSONRPCException.CreateFmt('Invalid signature for [%s] Hook method [HINT: procedure ' +
'%s.%s(const Context: TWebContext; const Value: TJDOJsonObject)',
[MethodName, fRPCInstance.ClassName, MethodName]);
end;
lHookFirstParam := lHookMethod.GetParameters[0];
lHookSecondParam := lHookMethod.GetParameters[1];
lHookFirstParamType := lHookFirstParam.ParamType.ToString.ToLower;
lHookSecondParamType := lHookSecondParam.ParamType.ToString.ToLower;
if (lHookMethod.MethodKind <> mkProcedure) then
raise EMVCJSONRPCException.CreateFmt
('Invalid signature for [%s] Hook method [HINT: Hook methods MUST have the following signature "procedure ' +
'%s.%s(const Context: TWebContext; const Value: TJDOJsonObject)"',
[MethodName, fRPCInstance.ClassName, MethodName]);
if ((lHookSecondParamType <> 'tjdojsonobject') and (lHookSecondParamType <> 'tjsonobject')) or
(lHookSecondParam.Flags * [pfConst, pfAddress] <> [pfConst, pfAddress]) then
raise EMVCJSONRPCException.CreateFmt('Invalid signature for [%s] Hook method [HINT: procedure ' +
'%s.%s(const Context: TWebContext; const Value: TJDOJsonObject)',
[MethodName, fRPCInstance.ClassName, MethodName]);
if (lHookFirstParamType <> 'twebcontext') or (lHookFirstParam.Flags * [pfConst, pfAddress] <> [pfConst, pfAddress])
then
raise EMVCJSONRPCException.CreateFmt('Invalid signature for [%s] Hook method [HINT: procedure ' +
'%s.%s(const Context: TWebContext; const Value: TJDOJsonObject)',
[MethodName, fRPCInstance.ClassName, MethodName]);
LogD('[JSON-RPC][HOOK][' + fRPCInstance.ClassName + '.' + MethodName + ']');
lHookMethod.Invoke(fRPCInstance, [Self.Context, Parameter])
end;
end;
{ EMVCJSONRPCParseError }
procedure EMVCJSONRPCParseError.AfterConstruction;
begin
inherited;
fJSONRPCErrorCode := JSONRPC_ERR_PARSE_ERROR;
end;
constructor EMVCJSONRPCParseError.Create;
begin
inherited Create
('Parse error. Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text');
end;
{ EMVCJSONRPCInvalidRequest }
procedure EMVCJSONRPCInvalidRequest.AfterConstruction;
begin
inherited;
fJSONRPCErrorCode := JSONRPC_ERR_INVALID_REQUEST;
end;
constructor EMVCJSONRPCInvalidRequest.Create(const Message: string);
var
lMsg: string;
begin
lMsg := 'Invalid Request. The JSON sent is not a valid Request object.';
if not message.IsEmpty then
begin
lMsg := lMsg + ' [HINT] ' + message;
end;
inherited Create(lMsg);
end;
{ EMVCJSONRPCMethodNotFound }
procedure EMVCJSONRPCMethodNotFound.AfterConstruction;
begin
inherited;
fJSONRPCErrorCode := JSONRPC_ERR_METHOD_NOT_FOUND;
end;
constructor EMVCJSONRPCMethodNotFound.Create(const MethodName: string);
begin
inherited CreateFmt('Method [%s] not found. The method does not exist or is not available.', [MethodName]);
end;
{ EMVCJSONRPCInvalidParams }
procedure EMVCJSONRPCInvalidParams.AfterConstruction;
begin
inherited;
fJSONRPCErrorCode := JSONRPC_ERR_INVALID_PARAMS;
end;
constructor EMVCJSONRPCInvalidParams.Create(const Message: string);
begin
inherited Create('Invalid params. [hint: ' + message + ']');
end;
{ EMVCJSONRPCInternalError }
procedure EMVCJSONRPCInternalError.AfterConstruction;
begin
inherited;
fJSONRPCErrorCode := JSONRPC_ERR_INTERNAL_ERROR;
end;
constructor EMVCJSONRPCInternalError.Create;
begin
inherited Create('Internal JSON-RPC error');
end;
{ EMVCJSONRPCServerError }
constructor EMVCJSONRPCServerError.Create(const JSONRPCError: Integer; const Message: string);
begin
inherited Create(message);
fJSONRPCErrorCode := JSONRPCError;
end;
{ TJSONRPCRequest }
constructor TJSONRPCRequest.Create(const aID: TValue; const aMethod: string);
begin
inherited Create(aMethod);
SetID(aID);
end;
constructor TJSONRPCRequest.Create(const aID: TValue);
begin
inherited Create;
SetID(aID);
end;
constructor TJSONRPCRequest.Create;
begin
inherited Create;
Self.FID := TValue.Empty;
end;
destructor TJSONRPCRequest.Destroy;
begin
inherited;
end;
function TJSONRPCRequest.GetRequestType: TJSONRPCRequestType;
begin
if FID.IsEmpty then
Result := TJSONRPCRequestType.Notification
else
Result := TJSONRPCRequestType.Request;
end;
procedure TJSONRPCRequest.SetJSON(const JSON: TJDOJsonObject);
begin
if JSON.Types[JSONRPC_ID] = jdtString then
RequestID := JSON.S[JSONRPC_ID]
else if JSON.Types[JSONRPC_ID] = jdtInt then
RequestID := JSON.I[JSONRPC_ID]
else if JSON.Types[JSONRPC_ID] = jdtLong then
RequestID := JSON.L[JSONRPC_ID]
else if JSON.Types[JSONRPC_ID] = jdtULong then
RequestID := JSON.U[JSONRPC_ID]
else
RequestID := TValue.Empty;
Method := JSON.S[JSONRPC_METHOD];
Params.Clear;
end;
constructor TJSONRPCNotification.Create(const aMethod: string);
begin
Create;
Method := aMethod;
end;
destructor TJSONRPCNotification.Destroy;
begin
FParams.Free;
inherited;
end;
procedure TJSONRPCNotification.FillParameters(const JSON: TJDOJsonObject; const RTTIMethod: TRTTIMethod);
var
lRTTIMethodParams: TArray<TRttiParameter>;
lRTTIMethodParam: TRttiParameter;
lJSONParams: TJDOJsonArray;
lJSONNamedParams: TJDOJsonObject;
I: Integer;
lUseNamedParams: Boolean;
function GetJsonDataValueHelper(const JSONNamedParams: TJsonObject; const JsonPropName: string): TJsonDataValueHelper;
var
I: Integer;
lName: string;
begin
for I := 0 to JSONNamedParams.Count - 1 do
begin
lName := JSONNamedParams.Names[I];
if SameText(lName, JsonPropName) then
begin
Exit(JSONNamedParams.Values[lName]);
end;
end;
raise EJsonException.CreateFmt('Cannot find parameter [%s] in params object', [JsonPropName]);
end;
begin
lUseNamedParams := False;
lJSONParams := nil;
lJSONNamedParams := nil;
Params.Clear;
if JSON.Types[JSONRPC_PARAMS] = jdtArray then
begin
lJSONParams := JSON.A[JSONRPC_PARAMS];
lUseNamedParams := False;
end
else if JSON.Types[JSONRPC_PARAMS] = jdtObject then
begin
lJSONNamedParams := JSON.O[JSONRPC_PARAMS];
lUseNamedParams := True;
end
else if JSON.Types[JSONRPC_PARAMS] <> jdtNone then
begin
raise EMVCJSONRPCException.Create('Params must be a JSON array or null');
end;
lRTTIMethodParams := RTTIMethod.GetParameters;
if lUseNamedParams then
begin
if (Length(lRTTIMethodParams) > 0) and (not Assigned(lJSONNamedParams)) then
raise EMVCJSONRPCInvalidParams.CreateFmt('Wrong parameters count. Expected [%d] got [%d].',
[Length(lRTTIMethodParams), 0]);
if Assigned(lJSONNamedParams) and (Length(lRTTIMethodParams) <> lJSONNamedParams.Count) then
raise EMVCJSONRPCInvalidParams.CreateFmt('Wrong parameters count. Expected [%d] got [%d].',
[Length(lRTTIMethodParams), lJSONNamedParams.Count]);
end
else
begin
if (Length(lRTTIMethodParams) > 0) and (not Assigned(lJSONParams)) then
raise EMVCJSONRPCInvalidParams.CreateFmt('Wrong parameters count. Expected [%d] got [%d].',
[Length(lRTTIMethodParams), 0]);
if Assigned(lJSONParams) and (Length(lRTTIMethodParams) <> lJSONParams.Count) then
raise EMVCJSONRPCInvalidParams.CreateFmt('Wrong parameters count. Expected [%d] got [%d].',
[Length(lRTTIMethodParams), lJSONParams.Count]);
end;
for lRTTIMethodParam in lRTTIMethodParams do
begin
if lRTTIMethodParam.Flags * [pfVar, pfOut, pfArray, pfReference] <> [] then
raise EMVCJSONRPCInvalidParams.CreateFmt
('Parameter modifier not supported for formal parameter [%s]. Only const and value modifiers are allowed.',
[lRTTIMethodParam.Name]);
end;
// scroll json params and rttimethod params and find the best match
if Assigned(lJSONParams) then
begin
// positional params
for I := 0 to lJSONParams.Count - 1 do
begin
JSONDataValueToTValueParam(lJSONParams[I], lRTTIMethodParams[I], Params);
end;
end
else if Assigned(lJSONNamedParams) then
begin
// named params
for I := 0 to lJSONNamedParams.Count - 1 do
begin
JSONDataValueToTValueParam(GetJsonDataValueHelper(lJSONNamedParams, lRTTIMethodParams[I].Name.ToLower),
{ lJSONNamedParams.Values[lRTTIMethodParams[I].Name.ToLower], }
lRTTIMethodParams[I], Params);
end;
end;
end;
function TJSONRPCNotification.GetJSON: TJDOJsonObject;
var
I: Integer;
begin
if FMethod.IsEmpty then
raise EMVCJSONRPCException.Create('JSON-RPC "Method" cannot be empty');
Result := inherited;
Result.S[JSONRPC_METHOD] := FMethod;
if FParams.Count > 0 then
begin
if FParams.fParamNames.Count = 0 then
begin // positional params
for I := 0 to FParams.Count - 1 do
begin
AppendTValueToJsonArray(FParams.fParamValues[I], FParams.fParamTypes[I], Result.A[JSONRPC_PARAMS]);
end;
end
else
begin // named params
for I := 0 to FParams.Count - 1 do
begin
AppendTValueToJsonObject(FParams.fParamValues[I], FParams.fParamNames[I], FParams.fParamTypes[I],
Result.O[JSONRPC_PARAMS]);
end;
end;
end;
end;
function TJSONRPCNotification.GetMethod: string;
begin
Result := FMethod;
end;
function TJSONRPCNotification.GetParams: TJSONRPCRequestParams;
begin
Result := FParams;
end;
procedure TJSONRPCNotification.SetMethod(const Value: string);
begin
FMethod := Value;
end;
{ TJSONRCPResponse }
constructor TJSONRPCResponse.Create;
begin
inherited;
FError := nil;
end;
destructor TJSONRPCResponse.Destroy;
begin
FreeAndNil(FError);
if FResult.IsObject then
FResult.AsObject.Free;
inherited;
end;
function TJSONRPCResponse.GetError: TJSONRPCResponseError;
begin
Result := FError;
end;
function TJSONRPCResponse.GetID: TValue;
begin
Result := FID;
end;
function TJSONRPCResponse.GetJSON: TJDOJsonObject;
var
lSer: TMVCJsonDataObjectsSerializer;
begin
Result := inherited;
// Must generate something like the following:
// {"jsonrpc": "2.0", "error": {"code": -32601, "message": "Method not found"}, "id": "1"}
if FID.IsEmpty then
begin
Result.Values[JSONRPC_ID] := jdtNone;
end
else if FID.IsType<string> then
begin
Result.S[JSONRPC_ID] := FID.AsString;
end
else if FID.IsType<Int32> then
begin
Result.I[JSONRPC_ID] := FID.AsInteger;
end
else if FID.IsType<Int64> then
begin
Result.I[JSONRPC_ID] := FID.AsInt64;
end
else
raise EMVCJSONRPCException.Create('ID can be only Int32, Int64 or String');
try
if Assigned(FError) then
begin
Result.O[JSONRPC_ERROR].I[JSONRPC_CODE] := FError.Code;
Result.O[JSONRPC_ERROR].S[JSONRPC_MESSAGE] := FError.ErrMessage;
if not FError.Data.IsEmpty then
begin
TValueToJSONObjectProperty(FError.Data, Result.O[JSONRPC_ERROR], JSONRPC_DATA);
end;
end
else
begin
lSer := TMVCJsonDataObjectsSerializer.Create;
try
lSer.TValueToJsonObjectProperty(Result, JSONRPC_RESULT, FResult, TMVCSerializationType.stDefault, [], nil);
finally
lSer.Free;
end;
end;
except
Result.Free;
raise;
end;
end;
function TJSONRPCResponse.GetResult: TValue;
begin
Result := FResult;
end;
function TJSONRPCResponse.IsError: Boolean;
begin
Result := Assigned(FError);
end;
function TJSONRPCResponse.ResultAsJSONArray: TJDOJsonArray;
begin
Result := Self.Result.AsObject as TJDOJsonArray;
end;
function TJSONRPCResponse.ResultAsJSONObject: TJDOJsonObject;
begin
// self.AsJSON
if Self.Result.IsEmpty then
Result := nil
else
Result := Self.Result.AsObject as TJDOJsonObject;
end;
procedure TJSONRPCResponse.SetError(const Value: TJSONRPCResponseError);
begin
FError := Value;
end;
procedure TJSONRPCResponse.SetID(const Value: TValue);
begin
FID := Value;
end;
procedure TJSONRPCResponse.SetJSON(const JSON: TJDOJsonObject);
begin
if JSON.Types[JSONRPC_ID] = jdtString then
RequestID := JSON.S[JSONRPC_ID]
else if JSON.Types[JSONRPC_ID] = jdtInt then
RequestID := JSON.I[JSONRPC_ID]
else if JSON.Types[JSONRPC_ID] = jdtLong then
RequestID := JSON.L[JSONRPC_ID]
else if JSON.Types[JSONRPC_ID] = jdtULong then
RequestID := JSON.U[JSONRPC_ID]
else
RequestID := TValue.Empty;
if JSON.Contains(JSONRPC_RESULT) then
begin
FreeAndNil(FError);
FResult := JSONDataValueToTValue(JSON.Values[JSONRPC_RESULT]);
end
else
begin
FResult := TValue.Empty;
if JSON.Contains(JSONRPC_ERROR) then
begin
FError := TJSONRPCResponseError.Create;
FError.Code := JSON.O[JSONRPC_ERROR].I[JSONRPC_CODE];
FError.ErrMessage := JSON.O[JSONRPC_ERROR].S[JSONRPC_MESSAGE];
if JSON.O[JSONRPC_ERROR].Contains(JSONRPC_DATA) then
begin
try
FError.Data := JSONDataValueToTValue(JSON.O[JSONRPC_ERROR].Path[JSONRPC_DATA]);
except
FError.Data := JSON.O[JSONRPC_ERROR].Path[JSONRPC_DATA].Value;
end;
end;
end
else
begin
raise EMVCJSONRPCException.Create('Response message must have ''result'' or ''error''.' + sLineBreak +
'Raw message is: ' + sLineBreak + JSON.ToJSON());
end;
end;
end;
procedure TJSONRPCResponse.SetResult(const Value: TValue);
begin
FResult := Value;
end;
{ TJSONRPCNotification }
constructor TJSONRPCNotification.Create;
begin
inherited;
FParams := TJSONRPCRequestParams.Create;
end;
constructor TJSONRPCObject.Create;
begin
inherited;
end;
function TJSONRPCObject.GetJSON: TJDOJsonObject;
begin
Result := TJDOJsonObject.Create;
Result.S[JSONRPC_HEADER] := JSONRPC_VERSION;
end;
function TJSONRPCObject.GetJSONString: string;
begin
Result := ToString(True);
end;
procedure TJSONRPCRequest.SetID(const Value: TValue);
begin
FID := Value;
end;
procedure TJSONRPCObject.SetJSON(const Value: TJDOJsonObject);
begin
// not implemented
raise Exception.Create('This method must be overwritten by child');
end;
procedure TJSONRPCObject.SetJsonString(const Value: string);
var
lJSON: TJDOJsonObject;
begin
try
lJSON := TJDOJsonObject.Parse(Value) as TJDOJsonObject;
except
raise EMVCJSONRPCParseError.Create;
end;
try
AsJSON := lJSON;
finally
lJSON.Free;
end;
end;
function TJSONRPCObject.ToString(const Compact: Boolean): string;
var
lJSON: TJDOJsonObject;
begin
lJSON := GetJSON;
try
Result := lJSON.ToJSON(Compact);
finally
lJSON.Free;
end;
end;
{ TJSONRPCResponseError }
constructor TJSONRPCResponseError.Create;
begin
inherited;
FData := TValue.Empty;
end;
destructor TJSONRPCResponseError.Destroy;
begin
if not FData.IsEmpty then
begin
if FData.IsObjectInstance then
begin
FData.AsObject.Free;
end;
end;
inherited;
end;
procedure TJSONRPCResponseError.SetCode(const Value: Integer);
begin
FCode := Value;
end;
procedure TJSONRPCResponseError.SetData(const Value: TValue);
begin
fData := Value;
end;
procedure TJSONRPCResponseError.SetMessage(const Value: string);
begin
FMessage := Value;
end;
{ TJSONRPCMessage }
function TJSONRPCRequest.GetID: TValue;
begin
Result := FID;
end;
function TJSONRPCRequest.GetJSON: TJDOJsonObject;
begin
Result := inherited GetJSON;
try
if not FID.IsEmpty then
begin
if FID.IsType<string> then
begin
Result.S[JSONRPC_ID] := FID.AsString;
end
else if FID.IsType<Int32> then
begin
Result.I[JSONRPC_ID] := FID.AsInteger;
end
else if FID.IsType<Int64> then
begin
Result.I[JSONRPC_ID] := FID.AsInt64;
end
else
raise EMVCJSONRPCException.Create('ID can be only Int32, Int64 or String');
end
else
begin
raise EMVCJSONRPCException.Create('ID cannot be empty in a JSON-RPC request');
end;
except
Result.Free;
raise;
end;
end;
{ TJSONRPCProxyGenerator }
constructor TJSONRPCProxyGenerator.Create;
begin
inherited;
end;
procedure RegisterJSONRPCProxyGenerator(const aLanguage: string; const aClass: TJSONRPCProxyGeneratorClass);
begin
if not Assigned(GProxyGeneratorsRegister) then
begin
GProxyGeneratorsRegister := TDictionary<string, TJSONRPCProxyGeneratorClass>.Create();
end;
GProxyGeneratorsRegister.AddOrSetValue(aLanguage.ToLower, aClass);
end;
procedure TJSONRPCProxyGenerator.EndGeneration;
begin
// do nothing
end;
procedure TJSONRPCProxyGenerator.StartGeneration(const aClassName: string);
begin
// do nothing
end;
{ TJSONRPCRequestParams }
procedure TJSONRPCRequestParams.Add(const Value: TJDOJsonArray);
begin
Add(Value, pdtJSONArray);
end;
procedure TJSONRPCRequestParams.Add(const Value: TJDOJsonObject);
begin
Add(Value, pdTJDOJsonObject);
end;
procedure TJSONRPCRequestParams.Add(const Value: Integer);
begin
Add(Value, pdtInteger);
end;
procedure TJSONRPCRequestParams.Add(const Value: string);
begin
Add(Value, pdtString);
end;
procedure TJSONRPCRequestParams.Add(const Value: Boolean);
begin
Add(Value, pdtBoolean);
end;
procedure TJSONRPCRequestParams.Add(const Value: Double);
begin
Add(Value, pdtFloat);
end;
procedure TJSONRPCRequestParams.Add(const Value: TDateTime);
begin
Add(Value, pdtDateTime);
end;
procedure TJSONRPCRequestParams.Add(const Value: TTime);
begin
Add(Value, pdtTime);
end;
procedure TJSONRPCRequestParams.Add(const Value: TDate);
begin
Add(Value, pdtDate);
end;
procedure TJSONRPCRequestParams.CheckBalancedParams;
begin
if fParamNames.Count <> fParamValues.Count then
begin
raise EMVCJSONRPCException.Create('Cannot mix positional with named parameters');
end;
end;
procedure TJSONRPCRequestParams.CheckNotNames;
begin
if fParamNames.Count > 0 then
begin
raise EMVCJSONRPCException.Create('Cannot mix positional with named parameters');
end;
end;
procedure TJSONRPCRequestParams.Clear;
begin
fParamValues.Clear;
fParamTypes.Clear;
fParamNames.Clear;
end;
function TJSONRPCRequestParams.Count: Integer;
begin
Result := fParamValues.Count;
end;
constructor TJSONRPCRequestParams.Create;
begin
inherited Create;
fParamValues := TList<TValue>.Create;
fParamTypes := TList<TJSONRPCParamDataType>.Create;
fParamNames := TList<string>.Create;
end;
destructor TJSONRPCRequestParams.Destroy;
var
lValue: TValue;
begin
for lValue in fParamValues do
begin
if lValue.IsObject then
lValue.AsObject.Free;
end;
fParamValues.Free;
fParamTypes.Free;
fParamNames.Free;
inherited;
end;
function TJSONRPCRequestParams.GetItem(const Index: Integer): TValue;
begin
Result := fParamValues[index];
end;
function TJSONRPCRequestParams.GetItemDataType(const Index: Integer): TJSONRPCParamDataType;
begin
Result := fParamTypes[index];
end;
function TJSONRPCRequestParams.GetItemName(const Index: Integer): string;
begin
Result := fParamNames[index];
end;
function TJSONRPCRequestParams.ToArray: TArray<TValue>;
begin
Result := fParamValues.ToArray;
end;
procedure TJSONRPCRequestParams.Add(const Value: TValue; const ParamType: TJSONRPCParamDataType);
begin
CheckNotNames;
fParamValues.Add(Value);
fParamTypes.Add(ParamType);
end;
procedure TJSONRPCRequestParams.AddByName(const Name: string; const Value: Boolean);
begin
AddByName(name, Value, TJSONRPCParamDataType.pdtBoolean);
end;
procedure TJSONRPCRequestParams.AddByName(const Name: string; const Value: TJDOJsonArray);
begin
AddByName(name, Value, TJSONRPCParamDataType.pdtJSONArray);
end;
procedure TJSONRPCRequestParams.AddByName(const Name: string; const Value: TJDOJsonObject);
begin
AddByName(name, Value, TJSONRPCParamDataType.pdTJDOJsonObject);
end;
procedure TJSONRPCRequestParams.AddByName(const Name: string; const Value: Integer);
begin
AddByName(name, Value, TJSONRPCParamDataType.pdtInteger);
end;
procedure TJSONRPCRequestParams.AddByName(const Name, Value: string);
begin
AddByName(name, Value, TJSONRPCParamDataType.pdtString);
end;
procedure TJSONRPCRequestParams.AddByName(const Name: string; const Value: TValue;
const ParamType: TJSONRPCParamDataType);
begin
CheckBalancedParams;
fParamNames.Add(LowerCase(name));
fParamValues.Add(Value);
fParamTypes.Add(ParamType);
end;
procedure TJSONRPCRequestParams.AddByName(const Name: string; const Value: Double);
begin
AddByName(name, Value, TJSONRPCParamDataType.pdtFloat);
end;
procedure TJSONRPCRequestParams.AddByName(const Name: string; const Value: TDateTime);
begin
AddByName(name, Value, TJSONRPCParamDataType.pdtDateTime);
end;
procedure TJSONRPCRequestParams.AddByName(const Name: string; const Value: TTime);
begin
AddByName(name, Value, TJSONRPCParamDataType.pdtTime);
end;
procedure TJSONRPCRequestParams.AddByName(const Name: string; const Value: TDate);
begin
AddByName(name, Value, TJSONRPCParamDataType.pdtDate);
end;
{ EMVCJSONRPCException }
constructor EMVCJSONRPCError.Create(const ErrCode: Integer; const ErrMsg: string);
begin
inherited Create(ErrMsg);
fJSONRPCErrorCode := ErrCode;
end;
{ TJSONRPCNullResponse }
function TJSONRPCNullResponse.GetError: TJSONRPCResponseError;
begin
Result := FError;
end;
function TJSONRPCNullResponse.GetID: TValue;
begin
RaiseErrorForNullObject;
end;
function TJSONRPCNullResponse.GetJSON: TJDOJsonObject;
begin
Result := nil;
RaiseErrorForNullObject;
end;
function TJSONRPCNullResponse.GetJSONString: string;
begin
RaiseErrorForNullObject;
end;
function TJSONRPCNullResponse.GetResult: TValue;
begin
RaiseErrorForNullObject;
end;
function TJSONRPCNullResponse.IsError: Boolean;
begin
Result := False;
end;
procedure TJSONRPCNullResponse.RaiseErrorForNullObject;
begin
raise EMVCJSONRPCException.Create('Invalid Call for NULL object');
end;
function TJSONRPCNullResponse.ResultAsJSONArray: TJDOJsonArray;
begin
Result := nil;
RaiseErrorForNullObject;
end;
function TJSONRPCNullResponse.ResultAsJSONObject: TJDOJsonObject;
begin
Result := nil;
RaiseErrorForNullObject;
end;
procedure TJSONRPCNullResponse.SetError(const Value: TJSONRPCResponseError);
begin
FError := Value;
end;
procedure TJSONRPCNullResponse.SetID(const Value: TValue);
begin
RaiseErrorForNullObject;
end;
procedure TJSONRPCNullResponse.SetJSON(const JSON: TJDOJsonObject);
begin
RaiseErrorForNullObject;
end;
procedure TJSONRPCNullResponse.SetJsonString(const Value: string);
begin
RaiseErrorForNullObject;
end;
procedure TJSONRPCNullResponse.SetResult(const Value: TValue);
begin
RaiseErrorForNullObject;
end;
function TJSONRPCNullResponse.ToString(const Compact: Boolean): string;
begin
Result := '';
end;
constructor EMVCJSONRPCError.Create(const ErrCode: Integer; const ErrMsg: string; const Data: TValue);
begin
Create(ErrCode, ErrMsg);
fJSONRPCErrorData := Data;
end;
constructor EMVCJSONRPCError.CreateFmt(const ErrCode: Integer; const ErrMsg: string; const Args: array of const);
begin
inherited CreateFmt(ErrMsg, Args);
fJSONRPCErrorCode := ErrCode;
end;
{ EMVCJSONRPCRemoteException }
constructor EMVCJSONRPCRemoteException.Create(const ErrCode: Integer; const ErrMessage: String);
begin
Create(ErrCode, ErrMessage);
end;
constructor EMVCJSONRPCRemoteException.Create(const ErrCode: Integer; const ErrMessage: String;
const ErrData: TValue);
begin
inherited Create(Format('[REMOTE EXCEPTION - CODE: %d] %s', [ErrCode, ErrMessage]));
fErrData := ErrData;
fErrCode := ErrCode;
fErrMessage := ErrMessage;
end;
initialization
finalization
FreeAndNil(GProxyGeneratorsRegister);
end.
| 29.690427 | 139 | 0.713775 |
f1785af4aedcfeb690f275aee7bef99fa9b4fd46 | 28,872 | pas | Pascal | source/uWVMiscFunctions.pas | atkins126/WebView4Delphi | 4c00ff7821e866f61eaf50b5c6edb23babf03991 | [
"MIT"
]
| null | null | null | source/uWVMiscFunctions.pas | atkins126/WebView4Delphi | 4c00ff7821e866f61eaf50b5c6edb23babf03991 | [
"MIT"
]
| null | null | null | source/uWVMiscFunctions.pas | atkins126/WebView4Delphi | 4c00ff7821e866f61eaf50b5c6edb23babf03991 | [
"MIT"
]
| null | null | null | unit uWVMiscFunctions;
{$IFDEF FPC}{$MODE Delphi}{$ENDIF}
{$I webview2.inc}
interface
uses
{$IFDEF FPC}
Windows, Classes, ActiveX, SysUtils, Graphics, Math, Controls, StrUtils,
{$ELSE}
Winapi.Windows, System.Classes, System.UITypes, Winapi.ActiveX, System.SysUtils, System.Math, System.StrUtils,
{$ENDIF}
uWVConstants, uWVTypeLibrary, uWVTypes;
const
SHLWAPIDLL = 'shlwapi.dll';
function AllocCoTaskMemStr(const aString : wvstring): PWideChar;
function LowestChromiumVersion : wvstring;
function LowestLoaderDLLVersion : wvstring;
function EnvironmentCreationErrorToString(aErrorCode : HRESULT) : wvstring;
function ControllerCreationErrorToString(aErrorCode : HRESULT) : wvstring;
function CompositionControllerCreationErrorToString(aErrorCode : HRESULT) : wvstring;
function GetScreenDPI : integer;
function GetDeviceScaleFactor : single;
function EditingCommandToString(aEditingCommand : TWV2EditingCommand): wvstring;
function DeleteDirContents(const aDirectory : string; const aExcludeFiles : TStringList = nil) : boolean;
function SystemCursorIDToDelphiCursor(aSystemCursorID : cardinal) : TCursor;
function LoggedQueryInterface(const aBaseIntf: IInterface; const aGUID: TGUID; out Obj): boolean;
procedure OutputDebugMessage(const aMessage : string);
function CustomExceptionHandler(const aFunctionName : string; const aException : exception) : boolean;
procedure LogMouseEvent(aEventKind : TWVMouseEventKind; aVirtualKeys : TWVMouseEventVirtualKeys; aMouseData : cardinal; aPoint : TPoint);
function CoreWebViewColorToDelphiColor(const aColor : COREWEBVIEW2_COLOR) : TColor;
function DelphiColorToCoreWebViewColor(const aColor : TColor) : COREWEBVIEW2_COLOR;
function TryIso8601BasicToDate(const Str: string; out Date: TDateTime): Boolean;
function JSONUnescape(const Source: wvstring): wvstring;
function JSONEscape(const Source: wvstring): wvstring;
function CustomPathIsRelative(const aPath : wvstring) : boolean;
function CustomPathCanonicalize(const aOriginalPath : wvstring; var aCanonicalPath : wvstring) : boolean;
function CustomAbsolutePath(const aPath : wvstring; aMustExist : boolean = False) : wvstring;
function CustomPathIsURL(const aPath : wvstring) : boolean;
function CustomPathIsUNC(const aPath : wvstring) : boolean;
function GetModulePath : wvstring;
function EscapeCommandLineParameter(const aParameter : wvstring) : wvstring;
function PathIsRelativeAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeA';
function PathIsRelativeUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeW';
function PathCanonicalizeAnsi(pszBuf: LPSTR; pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathCanonicalizeA';
function PathCanonicalizeUnicode(pszBuf: LPWSTR; pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathCanonicalizeW';
function PathIsUNCAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsUNCA';
function PathIsUNCUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsUNCW';
function PathIsURLAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLA';
function PathIsURLUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLW';
implementation
uses
uWVLoader;
function AllocCoTaskMemStr(const aString : wvstring): PWideChar;
var
TempLen : integer;
TempString : wvstring;
begin
TempLen := Length(aString);
if (TempLen > 0) then
begin
TempLen := succ(TempLen) * SizeOf(WideChar);
TempString := aString + #0;
Result := CoTaskMemAlloc(TempLen);
Move(TempString[1], Result^, TempLen);
end
else
Result := nil;
end;
function LowestChromiumVersion : wvstring;
begin
Result := wvstring(inttostr(CHROMIUM_VERSION_MAJOR) + '.' +
inttostr(CHROMIUM_VERSION_MINOR) + '.' +
inttostr(CHROMIUM_VERSION_RELEASE) + '.' +
inttostr(CHROMIUM_VERSION_BUILD));
end;
function LowestLoaderDLLVersion : wvstring;
begin
Result := wvstring(inttostr(WEBVIEW2LOADERLIB_VERSION_MAJOR) + '.' +
inttostr(WEBVIEW2LOADERLIB_VERSION_MINOR) + '.' +
inttostr(WEBVIEW2LOADERLIB_VERSION_RELEASE) + '.' +
inttostr(WEBVIEW2LOADERLIB_VERSION_BUILD));
end;
function EnvironmentCreationErrorToString(aErrorCode : HRESULT) : wvstring;
const
// Undefined GetLastError error values
ERROR_INVALID_STATE = 5023;
ERROR_PRODUCT_UNINSTALLED = 1614;
begin
case aErrorCode of
CO_E_NOTINITIALIZED : Result := 'CoInitializeEx was not called.';
RPC_E_CHANGED_MODE : Result := 'CoInitializeEx was previously called with COINIT_MULTITHREADED.';
E_ACCESSDENIED : Result := 'Unable to create user data folder, Access Denied.';
E_FAIL : Result := 'Edge runtime unable to start.';
else
if (aErrorCode = HResultFromWin32(ERROR_NOT_SUPPORTED)) then
Result := '\Edge\Application path used in browserExecutableFolder.'
else
if (aErrorCode = HResultFromWin32(ERROR_INVALID_STATE)) then
Result := 'Specified options do not match the options of the WebViews that are currently running in the shared browser process.'
else
if (aErrorCode = HResultFromWin32(ERROR_DISK_FULL)) then
Result := 'There are too many previous WebView2 Runtime versions.'
else
if (aErrorCode = HResultFromWin32(ERROR_PRODUCT_UNINSTALLED)) then
Result := 'Webview depends upon an installed WebView2 Runtime version and it is uninstalled.'
else
if (aErrorCode = HResultFromWin32(ERROR_FILE_NOT_FOUND)) then
Result := 'Could not find Edge installation.'
else
if (aErrorCode = HResultFromWin32(ERROR_FILE_EXISTS)) then
Result := 'User data folder cannot be created because a file with the same name already exists.'
else
Result := 'Unexpected error result.';
end;
end;
function ControllerCreationErrorToString(aErrorCode : HRESULT) : wvstring;
const
// Undefined GetLastError error values
ERROR_INVALID_STATE = 5023;
begin
case aErrorCode of
E_ABORT : Result := 'The parent window was destroyed before the controller creation was finished.';
else
if (aErrorCode = HResultFromWin32(ERROR_INVALID_STATE)) then
Result := 'Another browser is using the same user data folder.'
else
Result := 'Unexpected error result.';
end;
end;
function CompositionControllerCreationErrorToString(aErrorCode : HRESULT) : wvstring;
const
// Undefined GetLastError error values
ERROR_INVALID_STATE = 5023;
begin
case aErrorCode of
E_ABORT : Result := 'The parent window was destroyed before the composition controller creation was finished.';
else
if (aErrorCode = HResultFromWin32(ERROR_INVALID_STATE)) then
Result := 'Another browser is using the same user data folder.'
else
Result := 'Unexpected error result.';
end;
end;
function CoreWebViewColorToDelphiColor(const aColor : COREWEBVIEW2_COLOR) : TColor;
begin
Result := (aColor.R or (aColor.G shl 8) or (aColor.B shl 16) or (aColor.A shl 24));
end;
function DelphiColorToCoreWebViewColor(const aColor : TColor) : COREWEBVIEW2_COLOR;
begin
Result.R := byte(aColor and $000000FF);
Result.G := byte((aColor and $0000FF00) shr 8);
Result.B := byte((aColor and $00FF0000) shr 16);
Result.A := byte(aColor shr 24);
end;
function GetScreenDPI : integer;
var
TempDC : HDC;
begin
TempDC := GetDC(0);
Result := GetDeviceCaps(TempDC, LOGPIXELSX);
ReleaseDC(0, TempDC);
end;
function GetDeviceScaleFactor : single;
begin
Result := GetScreenDPI / USER_DEFAULT_SCREEN_DPI;
end;
procedure OutputDebugMessage(const aMessage : string);
begin
{$IFDEF DEBUG}
OutputDebugString({$IFDEF FPC}PAnsiChar{$ELSE}PWideChar{$ENDIF}(aMessage + #0));
{$ENDIF}
end;
function CustomExceptionHandler(const aFunctionName : string; const aException : exception) : boolean;
begin
OutputDebugMessage(aFunctionName + ' error : ' + aException.message);
Result := (GlobalWebView2Loader <> nil) and GlobalWebView2Loader.ReRaiseExceptions;
end;
procedure LogMouseEvent(aEventKind : TWVMouseEventKind; aVirtualKeys : TWVMouseEventVirtualKeys; aMouseData : cardinal; aPoint : TPoint);
begin
OutputDebugMessage('aEventKind: $' + IntToHex(integer(aEventKind), 4) + ', ' +
'aVirtualKeys: $' + IntToHex(Integer(aVirtualKeys), 2) + ', ' +
'aMouseData: ' + IntToStr(integer(aMouseData)) + ', ' +
'aPoint: (' + IntToStr(aPoint.x) + ',' + IntToStr(aPoint.y) + ')');
end;
// Basic ISO8601ToDate alternative written by David Heffernan
// https://stackoverflow.com/questions/24108718/is-there-a-delphi-rtl-function-that-can-convert-the-iso-8601-basic-date-format-t
// Use ISO8601ToDate in Delphi XE6 or later versions.
function TryIso8601BasicToDate(const Str: string; out Date: TDateTime): Boolean;
var
Year, Month, Day: Integer;
begin
Assert(Length(Str)=8);
Result := TryStrToInt(Copy(Str, 1, 4), Year);
if not Result then
exit;
Result := TryStrToInt(Copy(Str, 5, 2), Month);
if not Result then
exit;
Result := TryStrToInt(Copy(Str, 7, 2), Day);
if not Result then
exit;
Result := TryEncodeDate(Year, Month, Day, Date);
end;
// This function is a modified version of the JSONUnescape function created by Olvin Roght in stackoverflow :
// https://stackoverflow.com/questions/9713491/delphi-decode-json-utf8-escaped-text
function JSONUnescape(const Source: wvstring): wvstring;
const
ESCAPE_CHAR = '\';
QUOTE_CHAR = '"';
var
EscapeCharPos, TempPos: Integer;
Temp: string;
IsQuotedString: Boolean;
begin
result := '';
IsQuotedString := (Source[1] = QUOTE_CHAR) and
(Source[Length(Source)] = QUOTE_CHAR);
EscapeCharPos := Pos(ESCAPE_CHAR, Source);
TempPos := 1;
while EscapeCharPos > 0 do
begin
result := result + Copy(Source, TempPos, EscapeCharPos - TempPos);
TempPos := EscapeCharPos;
if EscapeCharPos < Length(Source) - Integer(IsQuotedString) then
case Source[EscapeCharPos + 1] of
't':
Temp := #9;
'n':
Temp := #10;
'r':
Temp := #13;
'\':
Temp := '\';
'"':
Temp := '"';
'u':
begin
if EscapeCharPos + 4 < Length(Source) - Integer(IsQuotedString) then
Temp := Chr(StrToInt('$' + Copy(Source, EscapeCharPos + 2, 4)));
Inc(TempPos, 4);
end;
end;
Inc(TempPos, 2);
result := result + Temp;
EscapeCharPos := PosEx(ESCAPE_CHAR, Source, TempPos);
end;
result := result + Copy(Source, TempPos, Length(Source) - TempPos + 1);
end;
function JSONEscape(const Source: wvstring): wvstring;
const
CHAR_DBLQUOTE = #34;
CHAR_BACKWARDSSLASH = #92;
CHAR_FORWARDSSLASH = #47;
CHAR_BACKSPACE = #8;
CHAR_FORMFEED = #12;
CHAR_LINEFEED = #10;
CHAR_CARRIAGERETURN = #13;
CHAR_HORIZONTALTAB = #9;
var
i, TempLen : integer;
begin
Result := '';
TempLen := length(Source);
i := 1;
while (i <= TempLen) do
begin
case Source[i] of
CHAR_DBLQUOTE,
CHAR_BACKWARDSSLASH,
CHAR_FORWARDSSLASH : Result := Result + '\' + Source[i];
CHAR_BACKSPACE : Result := Result + '\b';
CHAR_FORMFEED : Result := Result + '\f';
CHAR_LINEFEED : Result := Result + '\n';
CHAR_CARRIAGERETURN : Result := Result + '\r';
CHAR_HORIZONTALTAB : Result := Result + '\t';
else
if (ord(Source[i]) < 32) or (ord(Source[i]) > 126) then
Result := Result + '\u' + IntToHex(ord(Source[i]), 4)
else
Result := Result + Source[i];
end;
inc(i);
end;
end;
function EditingCommandToString(aEditingCommand : TWV2EditingCommand): wvstring;
begin
case aEditingCommand of
ecAlignCenter : Result := 'AlignCenter';
ecAlignJustified : Result := 'AlignJustified';
ecAlignLeft : Result := 'AlignLeft';
ecAlignRight : Result := 'AlignRight';
ecBackColor : Result := 'BackColor';
ecBackwardDelete : Result := 'BackwardDelete';
ecBold : Result := 'Bold';
ecCopy : Result := 'Copy';
ecCreateLink : Result := 'CreateLink';
ecCut : Result := 'Cut';
ecDefaultParagraphSeparator : Result := 'DefaultParagraphSeparator';
ecDelete : Result := 'Delete';
ecDeleteBackward : Result := 'DeleteBackward';
ecDeleteBackwardByDecomposingPreviousCharacter : Result := 'DeleteBackwardByDecomposingPreviousCharacter';
ecDeleteForward : Result := 'DeleteForward';
ecDeleteToBeginningOfLine : Result := 'DeleteToBeginningOfLine';
ecDeleteToBeginningOfParagraph : Result := 'DeleteToBeginningOfParagraph';
ecDeleteToEndOfLine : Result := 'DeleteToEndOfLine';
ecDeleteToEndOfParagraph : Result := 'DeleteToEndOfParagraph';
ecDeleteToMark : Result := 'DeleteToMark';
ecDeleteWordBackward : Result := 'DeleteWordBackward';
ecDeleteWordForward : Result := 'DeleteWordForward';
ecFindString : Result := 'FindString';
ecFontName : Result := 'FontName';
ecFontSize : Result := 'FontSize';
ecFontSizeDelta : Result := 'FontSizeDelta';
ecForeColor : Result := 'ForeColor';
ecFormatBlock : Result := 'FormatBlock';
ecForwardDelete : Result := 'ForwardDelete';
ecHiliteColor : Result := 'HiliteColor';
ecIgnoreSpelling : Result := 'IgnoreSpelling';
ecIndent : Result := 'Indent';
ecInsertBacktab : Result := 'InsertBacktab';
ecInsertHorizontalRule : Result := 'InsertHorizontalRule';
ecInsertHTML : Result := 'InsertHTML';
ecInsertImage : Result := 'InsertImage';
ecInsertLineBreak : Result := 'InsertLineBreak';
ecInsertNewline : Result := 'InsertNewline';
ecInsertNewlineInQuotedContent : Result := 'InsertNewlineInQuotedContent';
ecInsertOrderedList : Result := 'InsertOrderedList';
ecInsertParagraph : Result := 'InsertParagraph';
ecInsertTab : Result := 'InsertTab';
ecInsertText : Result := 'InsertText';
ecInsertUnorderedList : Result := 'InsertUnorderedList';
ecItalic : Result := 'Italic';
ecJustifyCenter : Result := 'JustifyCenter';
ecJustifyFull : Result := 'JustifyFull';
ecJustifyLeft : Result := 'JustifyLeft';
ecJustifyNone : Result := 'JustifyNone';
ecJustifyRight : Result := 'JustifyRight';
ecMakeTextWritingDirectionLeftToRight : Result := 'MakeTextWritingDirectionLeftToRight';
ecMakeTextWritingDirectionNatural : Result := 'MakeTextWritingDirectionNatural';
ecMakeTextWritingDirectionRightToLeft : Result := 'MakeTextWritingDirectionRightToLeft';
ecMoveBackward : Result := 'MoveBackward';
ecMoveBackwardAndModifySelection : Result := 'MoveBackwardAndModifySelection';
ecMoveDown : Result := 'MoveDown';
ecMoveDownAndModifySelection : Result := 'MoveDownAndModifySelection';
ecMoveForward : Result := 'MoveForward';
ecMoveForwardAndModifySelection : Result := 'MoveForwardAndModifySelection';
ecMoveLeft : Result := 'MoveLeft';
ecMoveLeftAndModifySelection : Result := 'MoveLeftAndModifySelection';
ecMovePageDown : Result := 'MovePageDown';
ecMovePageDownAndModifySelection : Result := 'MovePageDownAndModifySelection';
ecMovePageUp : Result := 'MovePageUp';
ecMovePageUpAndModifySelection : Result := 'MovePageUpAndModifySelection';
ecMoveParagraphBackward : Result := 'MoveParagraphBackward';
ecMoveParagraphBackwardAndModifySelection : Result := 'MoveParagraphBackwardAndModifySelection';
ecMoveParagraphForward : Result := 'MoveParagraphForward';
ecMoveParagraphForwardAndModifySelection : Result := 'MoveParagraphForwardAndModifySelection';
ecMoveRight : Result := 'MoveRight';
ecMoveRightAndModifySelection : Result := 'MoveRightAndModifySelection';
ecMoveToBeginningOfDocument : Result := 'MoveToBeginningOfDocument';
ecMoveToBeginningOfDocumentAndModifySelection : Result := 'MoveToBeginningOfDocumentAndModifySelection';
ecMoveToBeginningOfLine : Result := 'MoveToBeginningOfLine';
ecMoveToBeginningOfLineAndModifySelection : Result := 'MoveToBeginningOfLineAndModifySelection';
ecMoveToBeginningOfParagraph : Result := 'MoveToBeginningOfParagraph';
ecMoveToBeginningOfParagraphAndModifySelection : Result := 'MoveToBeginningOfParagraphAndModifySelection';
ecMoveToBeginningOfSentence : Result := 'MoveToBeginningOfSentence';
ecMoveToBeginningOfSentenceAndModifySelection : Result := 'MoveToBeginningOfSentenceAndModifySelection';
ecMoveToEndOfDocument : Result := 'MoveToEndOfDocument';
ecMoveToEndOfDocumentAndModifySelection : Result := 'MoveToEndOfDocumentAndModifySelection';
ecMoveToEndOfLine : Result := 'MoveToEndOfLine';
ecMoveToEndOfLineAndModifySelection : Result := 'MoveToEndOfLineAndModifySelection';
ecMoveToEndOfParagraph : Result := 'MoveToEndOfParagraph';
ecMoveToEndOfParagraphAndModifySelection : Result := 'MoveToEndOfParagraphAndModifySelection';
ecMoveToEndOfSentence : Result := 'MoveToEndOfSentence';
ecMoveToEndOfSentenceAndModifySelection : Result := 'MoveToEndOfSentenceAndModifySelection';
ecMoveToLeftEndOfLine : Result := 'MoveToLeftEndOfLine';
ecMoveToLeftEndOfLineAndModifySelection : Result := 'MoveToLeftEndOfLineAndModifySelection';
ecMoveToRightEndOfLine : Result := 'MoveToRightEndOfLine';
ecMoveToRightEndOfLineAndModifySelection : Result := 'MoveToRightEndOfLineAndModifySelection';
ecMoveUp : Result := 'MoveUp';
ecMoveUpAndModifySelection : Result := 'MoveUpAndModifySelection';
ecMoveWordBackward : Result := 'MoveWordBackward';
ecMoveWordBackwardAndModifySelection : Result := 'MoveWordBackwardAndModifySelection';
ecMoveWordForward : Result := 'MoveWordForward';
ecMoveWordForwardAndModifySelection : Result := 'MoveWordForwardAndModifySelection';
ecMoveWordLeft : Result := 'MoveWordLeft';
ecMoveWordLeftAndModifySelection : Result := 'MoveWordLeftAndModifySelection';
ecMoveWordRight : Result := 'MoveWordRight';
ecMoveWordRightAndModifySelection : Result := 'MoveWordRightAndModifySelection';
ecOutdent : Result := 'Outdent';
ecOverWrite : Result := 'OverWrite';
ecPaste : Result := 'Paste';
ecPasteAndMatchStyle : Result := 'PasteAndMatchStyle';
ecPasteGlobalSelection : Result := 'PasteGlobalSelection';
ecPrint : Result := 'Print';
ecRedo : Result := 'Redo';
ecRemoveFormat : Result := 'RemoveFormat';
ecScrollLineDown : Result := 'ScrollLineDown';
ecScrollLineUp : Result := 'ScrollLineUp';
ecScrollPageBackward : Result := 'ScrollPageBackward';
ecScrollPageForward : Result := 'ScrollPageForward';
ecScrollToBeginningOfDocument : Result := 'ScrollToBeginningOfDocument';
ecScrollToEndOfDocument : Result := 'ScrollToEndOfDocument';
ecSelectAll : Result := 'SelectAll';
ecSelectLine : Result := 'SelectLine';
ecSelectParagraph : Result := 'SelectParagraph';
ecSelectSentence : Result := 'SelectSentence';
ecSelectToMark : Result := 'SelectToMark';
ecSelectWord : Result := 'SelectWord';
ecSetMark : Result := 'SetMark';
ecStrikethrough : Result := 'Strikethrough';
ecStyleWithCSS : Result := 'StyleWithCSS';
ecSubscript : Result := 'Subscript';
ecSuperscript : Result := 'Superscript';
ecSwapWithMark : Result := 'SwapWithMark';
ecToggleBold : Result := 'ToggleBold';
ecToggleItalic : Result := 'ToggleItalic';
ecToggleUnderline : Result := 'ToggleUnderline';
ecTranspose : Result := 'Transpose';
ecUnderline : Result := 'Underline';
ecUndo : Result := 'Undo';
ecUnlink : Result := 'Unlink';
ecUnscript : Result := 'Unscript';
ecUnselect : Result := 'Unselect';
ecUseCSS : Result := 'UseCSS';
ecYank : Result := 'Yank';
ecYankAndSelect : Result := 'YankAndSelect';
else Result := '';
end;
end;
function DeleteDirContents(const aDirectory : string; const aExcludeFiles : TStringList) : boolean;
var
TempRec : TSearchRec;
TempPath : string;
TempIdx : integer;
begin
Result := True;
try
if (length(aDirectory) > 0) and
DirectoryExists(aDirectory) and
(FindFirst(aDirectory + '\*', faAnyFile, TempRec) = 0) then
try
repeat
TempPath := aDirectory + PathDelim + TempRec.Name;
if ((TempRec.Attr and faDirectory) <> 0) then
begin
if (TempRec.Name <> '.') and (TempRec.Name <> '..') then
begin
if DeleteDirContents(TempPath, aExcludeFiles) then
Result := RemoveDir(TempPath) and Result
else
Result := False;
end;
end
else
if (aExcludeFiles <> nil) then
begin
TempIdx := aExcludeFiles.IndexOf(TempRec.Name);
Result := ((TempIdx >= 0) or
((TempIdx < 0) and DeleteFile(TempPath))) and
Result;
end
else
Result := DeleteFile(TempPath) and Result;
until (FindNext(TempRec) <> 0) or not(Result);
finally
FindClose(TempRec);
end;
except
on e : exception do
if CustomExceptionHandler('DeleteDirContents', e) then raise;
end;
end;
function SystemCursorIDToDelphiCursor(aSystemCursorID : cardinal) : TCursor;
begin
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadcursorw
case aSystemCursorId of
32650 : Result := crAppStart;
32512 : Result := crArrow;
32515 : Result := crCross;
32649 : Result := crHandPoint;
32651 : Result := crHelp;
32513 : Result := crIBeam;
32648 : Result := crNoDrop;
32640,
32646 : Result := crSizeAll;
32643 : Result := crSizeNESW;
32645 : Result := crSizeNS;
32642 : Result := crSizeNWSE;
32644 : Result := crSizeWE;
32516 : Result := crUpArrow;
32514 : Result := crHourGlass;
else Result := crDefault;
end;
end;
function LoggedQueryInterface(const aBaseIntf: IInterface; const aGUID: TGUID; out Obj): boolean;
var
TempResult : HRESULT;
TempMessage : wvstring;
begin
TempResult := aBaseIntf.QueryInterface(aGUID, Obj);
Result := succeeded(TempResult);
if not(Result) then
begin
TempMessage := 'The QueryInterface call for ' + aGUID.ToString + ' failed. ' +
'Error code : 0x' + {$IFDEF FPC}UTF8Decode({$ENDIF}inttohex(cardinal(TempResult), 8){$IFDEF FPC}){$ENDIF};
GlobalWebView2Loader.AppendErrorLog(TempMessage);
end;
end;
function CustomPathIsRelative(const aPath : wvstring) : boolean;
begin
Result := PathIsRelativeUnicode(PWideChar(aPath));
end;
function CustomPathIsURL(const aPath : wvstring) : boolean;
begin
Result := PathIsURLUnicode(PWideChar(aPath + #0));
end;
function CustomPathIsUNC(const aPath : wvstring) : boolean;
begin
Result := PathIsUNCUnicode(PWideChar(aPath + #0));
end;
function CustomPathCanonicalize(const aOriginalPath : wvstring; var aCanonicalPath : wvstring) : boolean;
var
TempBuffer: array [0..pred(MAX_PATH)] of WideChar;
begin
Result := False;
aCanonicalPath := '';
if (length(aOriginalPath) > MAX_PATH) or
(Copy(aOriginalPath, 1, 4) = '\\?\') or
CustomPathIsUNC(aOriginalPath) then
exit;
FillChar(TempBuffer, MAX_PATH * SizeOf(WideChar), 0);
if PathCanonicalizeUnicode(@TempBuffer[0], PWideChar(aOriginalPath + #0)) then
begin
aCanonicalPath := TempBuffer;
Result := True;
end;
end;
function CustomAbsolutePath(const aPath : wvstring; aMustExist : boolean) : wvstring;
var
TempNewPath, TempOldPath : wvstring;
begin
if (length(aPath) > 0) then
begin
if CustomPathIsRelative(aPath) then
TempOldPath := GetModulePath + aPath
else
TempOldPath := aPath;
if not(CustomPathCanonicalize(TempOldPath, TempNewPath)) then
TempNewPath := TempOldPath;
if aMustExist and not(DirectoryExists(TempNewPath)) then
Result := ''
else
Result := TempNewPath;
end
else
Result := '';
end;
function GetModulePath : wvstring;
begin
{$IFDEF FPC}
Result := UTF8Decode(IncludeTrailingPathDelimiter(ExtractFileDir(GetModuleName(HINSTANCE))));
{$ELSE}
Result := IncludeTrailingPathDelimiter(ExtractFileDir(GetModuleName(HINSTANCE)));
{$ENDIF}
end;
function EscapeCommandLineParameter(const aParameter : wvstring) : wvstring;
const
RESERVEDCHARS = ['`', '~', '!', '#', '$', '&', '*', '(', ')', #9, '{', '[', '|', '\', ';', #39, '"', #10, '<', '>', '?', ' '];
var
i : integer;
begin
i := 1;
while (i <= length(aParameter)) do
begin
if CharInSet(aParameter[i], RESERVEDCHARS) then
Result := Result + '\' + aParameter[i]
else
Result := Result + aParameter[i];
inc(i);
end;
end;
end.
| 45.1125 | 138 | 0.604323 |
f1ff41f6ef7b2a3d8b9a1a678ba982b5cfc1c419 | 15,344 | dfm | Pascal | source/demos/faq/unit1.dfm | fenglinyushu/dewebsdk | 6f45b6bef96e4b431ad6a0071320e5f613be778b | [
"BSD-2-Clause"
]
| 2 | 2021-05-12T00:33:07.000Z | 2021-09-01T06:54:17.000Z | source/demos/faq/unit1.dfm | fenglinyushu/dewebsdk | 6f45b6bef96e4b431ad6a0071320e5f613be778b | [
"BSD-2-Clause"
]
| null | null | null | source/demos/faq/unit1.dfm | fenglinyushu/dewebsdk | 6f45b6bef96e4b431ad6a0071320e5f613be778b | [
"BSD-2-Clause"
]
| null | null | null | object Form1: TForm1
Left = 0
Top = 0
Hint = '{"type":"primary"}'
AutoSize = True
BorderStyle = bsNone
Caption = 'Hello,World!'
ClientHeight = 1659
ClientWidth = 438
Color = clWhite
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = #24494#36719#38597#40657
Font.Style = []
OldCreateOrder = False
OnMouseUp = FormMouseUp
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 20
object Panel_00_Title: TPanel
Left = 0
Top = 0
Width = 438
Height = 58
Align = alTop
BevelKind = bkSoft
BevelOuter = bvNone
Color = clWhite
ParentBackground = False
TabOrder = 0
ExplicitWidth = 374
object Label_Title: TLabel
AlignWithMargins = True
Left = 74
Top = 3
Width = 357
Height = 48
Margins.Left = 20
Align = alClient
AutoSize = False
Caption = 'Frequently Asked Questions'
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -27
Font.Name = 'Verdana'
Font.Style = []
ParentFont = False
Layout = tlCenter
ExplicitLeft = 0
ExplicitTop = 8
ExplicitWidth = 527
ExplicitHeight = 65
end
object Image1: TImage
AlignWithMargins = True
Left = 3
Top = 3
Width = 48
Height = 48
Hint = '{"src":"/media/images/logo.png"}'
Align = alLeft
Picture.Data = {
0954506E67496D61676589504E470D0A1A0A0000000D49484452000000300000
003008060000005702F9870000065E4944415478DAD5594D561B391096DA6ABF
C9B0809C20649784459C13604E10E70498136096137B1ECD1B9859C69C20F609
3027009F00676160379E13C45EC064E876D794BA5BB6A45677CB76320C7A8F67
FA4FAAAF7EBE2A952879E2833EB6004F06C09B13FF9010A85342378140E7DE77
0F461E1DFF6F00BCFA03364BD3E9F6B454EADFFE42479AF01E2E74A87C00E472
D872771E150017DA09B96649956B96DF9B8664E7F657F75205F07085CF2BFAF7
40488F00ED5CB7D8F97F0AE0D56F7ED571601785AAEBCF4C00B64E7C7EBD9D35
1FBAD48882E30D5BACFB43016C7AB0B1C68243FCAA61783C2100BD69C9F57417
7AFD7B507300CE0A1740B722941D0C9B74F0DD016C9D4005887F265C65BE2874
0975DB458B721034C420A6640397EDDCF9A5DE33E663509306A5F485FC6E48A0
71D32C9F7E37005B27411D25FDAC0B6ED2F632E3F5F143C3A1D4C37FD767D323
535D37CB7B2B0330083F0929ADDF7C64BDA26F7990F35F1B9011214C83365AE8
FD5C49C54C950B20253CC017D47ACD24108F0FC1EB6F8EFD9E2288245048A107
8E7B9E056AEBF8A14328DD9D7F926F894C00DCE70909AE64E1EF02B7AA271F2E
F8CF6EB04F81348092CB7B9F458BAD31641E4ADF66CDCF29941276648A1D5D71
F8EED175D3F5AC01C442F91733EECE103E629710178A0273A6B10166D91D2B10
40CEC3126B98AC81D4DBC69F7D716DA2E74C00DAC793A9C32AFA22BAA955EDCE
41A0751A14301628AD913848FB82856485C82E2886EC8A7C4E74A5778500A292
200CFE945ED91B3659C75678699C0E9B6E439D976C0897E1D734F4DF3B80C028
A90AD03AA835371825C08DAE9402A009D74721AA8A564C758D6184000737AD72
5BBEC7057AE6FA98C149DD5C5AA4412414FB29793E422BBCCC04A06B5FF7BB54
60E701A0F4834EB5C67C924201DD61AB5C579476FC309A273BD523140032DA55
B49FC51A96AE97529C6605251614006AD195F6FD422190ADB0ACA8733F8FAC05
C12ED636DD3B9F8CB85B58592096524960492C7C15D7773E7B2EDC8CDABC2404
472A6D4482984048A637594A6815BF1DE451EBEC7D87BD94994F56AEEC9E3300
BC442E39E44268128599059900C7CD173AEE073E715C619646B170C106172ED9
1F9C9902546855592767E824A02965C670D4F482EEC38AE9818CD12D76F40C9A
B8CC859CD45242259A538332732831A8019F3DB302A0BB84292B6A04601E8915
6C6241A7CC420072F6D5CDA7A7F52C8EC7D2A15DC432B35838F1797CADE7BD8B
42EA240309BA312AE2B90E806B74DBA4E1F496506528AE1DC2D888C746BCB9F7
3DA974D0541B07BB0DA56602909ECD5D482981550195C58400DC0D00E27B580A
2466EF60901F712051D6CDD871F1C56D92E262006C6220A94AD75CB29917B011
90907685151361EB005043301BA2382CB2820C40068CF3FC75DD2A6F2A009420
D4D2F93CE8D83B9E94B0D4BE4AED8DCD4046A88CF6DFBEDBCD6A626506B446E5
8541ACE601C217EB60A01CF0CB64D3D2E056D103DA7A20034D811C996A7A9B51
98073204534B62CB24943126C85E9ECE5E625E522220DFBBFDE8F6E5EBC24CBC
75EC7F4DF9B444579116EC12903A05FA2BA58E67AAAB0C9A151F29EEC387DCB9
30D64226E1E46089DC88F9036B005161E7B485E071378FECE3823539C84D5D3B
53292E645873A73563396DCAA47AC2B2ECB029AEC283144878A8073DDF0F5FB7
DC9A6E0171DFD6C2EA7E20E99E451339B463D2425E10F3C5EF0356E7E64DFAA7
9F8C855D3C2226516A7DB4F87DE0561669BB2FD5DC35F0F7ACD99530D667EE2A
45F3709E97886182345D1545229FE7A772F0F6DB03FB920768E9F6BA04A28F89
A93E2BB1B5368B15000A6DB111E2F7D3EE6CDE5CAD04205A0805165ACFE95AE7
03C0DAE9DB3F642CB49C5562E81B1C6B00D22106C96AF12581C8855F2F9A4F1A
A93DB734576ADFBD50636B26BC96B8F2CEB604C545F50E891A59A66D234F4EE8
26AC93D58E470067A6F859DA028666EB8012776F9143089B91B71D35ED3FAC01
44200CD48979DFBBF7D9E9AA278D71FC4CB18CE781AC04FF29AE31A684F5F294
B5C0094D54357220733FC752032869870EEB2E7AD02177B535C127E8EF35DBA2
6F21164A3A771D623AB0C36A93B7D743FC33717774D801C10B0A5011FD50C312
7DAC736A3F3C91C5193B6C2F5AD8E58C3E6ADD5BA6D45EED9C384E42759B76A1
61C4A79A403BCBEE115606A083C16AB38AAE54894F2225378B2A533A86A8A744
064581F928001E6B3C7900FF026484B86D9717D4A50000000049454E44AE4260
82}
ExplicitTop = 2
end
end
object Panel_01_Line: TPanel
Left = 0
Top = 58
Width = 438
Height = 1
Align = alTop
BevelOuter = bvNone
TabOrder = 1
ExplicitWidth = 374
end
object Panel_02_Content: TPanel
Left = 0
Top = 59
Width = 438
Height = 1600
Align = alTop
BevelKind = bkSoft
BevelOuter = bvNone
Color = clWhite
ParentBackground = False
TabOrder = 2
ExplicitWidth = 374
object PageControl: TPageControl
Tag = 4
AlignWithMargins = True
Left = 5
Top = 15
Width = 424
Height = 1578
HelpType = htKeyword
HelpKeyword = 'timeline'
Margins.Left = 5
Margins.Top = 15
Margins.Right = 5
ActivePage = TabSheet1
Align = alClient
TabOrder = 0
ExplicitWidth = 360
object TabSheet1: TTabSheet
Tag = 1
Hint = '{"color":"#FF0000"}'
Caption = '1. '#20160#20040#26159'DeWeb?'
ExplicitLeft = 0
ExplicitWidth = 400
object Label2: TLabel
AlignWithMargins = True
Left = 3
Top = 3
Width = 410
Height = 30
Align = alTop
AutoSize = False
Caption = 'DeWeb'#26159#19968#20010#21487#20197#30452#25509#23558'Delphi'#31243#24207#24555#36895#36716#25442#20026#32593#39029#24212#29992#30340#24037#20855#65281' '
Layout = tlCenter
ExplicitWidth = 569
end
object Label3: TLabel
AlignWithMargins = True
Left = 3
Top = 39
Width = 410
Height = 30
Align = alTop
AutoSize = False
Caption = #20351#29992'DeWeb, '#24320#21457#32773#19981#38656#35201#23398#20064'HTML'#12289'JavaScript'#12289'Java'#12289'PHP'#12289'ASP'#12289'C#'#31561#26032#30693#35782','#29992'Delphi'#25630#23450#19968#20999
Layout = tlCenter
ExplicitTop = 75
ExplicitWidth = 569
end
object Label5: TLabel
AlignWithMargins = True
Left = 3
Top = 75
Width = 410
Height = 30
Align = alTop
AutoSize = False
Caption = 'DeWeb'#24320#21457#30340#32593#39029#25903#25345#25152#26377#23458#25143#31471#65292#21253#25324#25163#26426#12289#24179#26495#31561#12290
Layout = tlCenter
ExplicitTop = 179
ExplicitWidth = 569
end
end
object TabSheet2: TTabSheet
Tag = 2
Hint = '{"color":"#00FF00"}'
Caption = '2. '#22312#21738#37324#21487#20197#19979#36733#21040'DeWeb'#36164#26009#65311
ExplicitWidth = 352
object Label6: TLabel
AlignWithMargins = True
Left = 3
Top = 3
Width = 410
Height = 30
Align = alTop
AutoSize = False
Caption = 'DeWeb'#24320#21457#24179#21488#65288#21253#25324#24320#21457#24179#21488#21644#26696#20363#28304#30721#65289
Layout = tlCenter
ExplicitLeft = 6
ExplicitTop = 11
ExplicitWidth = 569
end
object Label7: TLabel
AlignWithMargins = True
Left = 3
Top = 39
Width = 410
Height = 30
Align = alTop
AutoSize = False
Caption =
'<a href="https://gitee.com/xamh/dewebsdk">https://gitee.com/xamh' +
'/dewebsdk</a>'
Layout = tlCenter
ExplicitLeft = 6
ExplicitTop = 47
ExplicitWidth = 569
end
end
object TabSheet3: TTabSheet
Tag = 3
Hint = '{"color":"#00FF00"}'
Caption = '3. DeWeb'#19982'Unigui'#30340#21306#21035#65311
ExplicitWidth = 352
object Label4: TLabel
AlignWithMargins = True
Left = 3
Top = 3
Width = 410
Height = 30
Align = alTop
AutoSize = False
Caption = '<b>'#30456#21516#28857#65306'</b>'
Layout = tlCenter
ExplicitLeft = 6
ExplicitTop = 11
ExplicitWidth = 559
end
object Label8: TLabel
AlignWithMargins = True
Left = 3
Top = 39
Width = 410
Height = 30
Align = alTop
AutoSize = False
Caption = #37117#26159#37319#29992'Delphi'#24320#21457#32593#39029#30340#24179#21488
Layout = tlCenter
ExplicitLeft = 6
ExplicitTop = 47
ExplicitWidth = 559
end
object Label9: TLabel
AlignWithMargins = True
Left = 3
Top = 75
Width = 410
Height = 30
Align = alTop
AutoSize = False
Caption = '<b>'#19981#21516#28857#65306'</b>'
Layout = tlCenter
ExplicitLeft = 6
ExplicitTop = 83
ExplicitWidth = 559
end
object Label11: TLabel
AlignWithMargins = True
Left = 3
Top = 111
Width = 410
Height = 30
Align = alTop
AutoSize = False
Caption = '1 DeWeb'#19981#38656#35201#23433#35013#25511#20214#65292' '#32780'Unigui'#38656#35201#23433#35013#33258#24049#30340#25511#20214
Layout = tlCenter
ExplicitTop = 311
ExplicitWidth = 559
end
object Label12: TLabel
AlignWithMargins = True
Left = 3
Top = 147
Width = 410
Height = 30
Align = alTop
AutoSize = False
Caption = '2 DeWeb'#26080#38656#35201#23398#20064'HTML/CSS/JavaScript, '#32780'Unigui'#38656#35201#23398#20064
Layout = tlCenter
ExplicitTop = 311
ExplicitWidth = 559
end
object Label10: TLabel
AlignWithMargins = True
Left = 3
Top = 183
Width = 410
Height = 30
Align = alTop
AutoSize = False
Caption = '3 DeWeb'#20026#22269#20135#33258#20027#30740#21457#65307'Unigui'#20026#22269#22806#20135#21697
Layout = tlCenter
ExplicitTop = 275
ExplicitWidth = 559
end
end
object TabSheet4: TTabSheet
Tag = 4
Caption = '4. '#22914#20309#24471#21040'URL'#20013#38468#24102#30340#21442#25968#65311
ImageIndex = 3
ExplicitWidth = 352
object Label1: TLabel
Left = 24
Top = 32
Width = 666
Height = 20
Caption = #21487#20197#22312'TForm'#30340'OnShow'#20107#20214#20013#36890#36807'dwGetProp(Self,'#39'params'#39')'#24471#21040'URL'#20013#30340#21442#25968#65292#36820#22238#20540#20026'String'
end
end
object TabSheet5: TTabSheet
Tag = 5
Caption = '5. '#22914#20309#24471#21040#23458#25143#31471#30340#35774#22791#31867#22411#21644#20998#36776#29575#31561#21442#25968#65311
ImageIndex = 4
ExplicitWidth = 352
object Label13: TLabel
Left = 0
Top = 0
Width = 416
Height = 20
Align = alTop
Caption = #23458#25143#31471#35774#22791#31867#22411#21644#23631#24149#21442#25968#31561#20449#24687#22312'OnMouseUp'#20013
ExplicitWidth = 347
end
object Label14: TLabel
Left = 0
Top = 20
Width = 416
Height = 20
Align = alTop
Caption = 'X,Y'#20998#21035#34920#31034#24403#21069#35774#22791#30340'Width/Height'#65307
ExplicitWidth = 273
end
object Label15: TLabel
Left = 0
Top = 140
Width = 416
Height = 20
Align = alTop
Caption = 'innerHeight'#21487#20197#36890#36807'dwGetProp(Self,'#39'innerheight'#39')'#24471#21040#65307
ExplicitWidth = 408
end
object Label16: TLabel
Left = 0
Top = 40
Width = 416
Height = 20
Align = alTop
Caption = 'Button : mbLeft : '#23631#24149#32437#21521', mbRight:'#23631#24149#27178#21521#65307
ExplicitWidth = 335
end
object Label17: TLabel
Left = 0
Top = 120
Width = 416
Height = 20
Align = alTop
Caption = 'innerWidth'#21487#20197#36890#36807'dwGetProp(Self,'#39'innerwidth'#39')'#24471#21040#65307
ExplicitWidth = 396
end
object Label18: TLabel
Left = 0
Top = 60
Width = 416
Height = 20
Align = alTop
Caption =
'Shift'#65306'ssShift, ssAlt, ssCtrl,ssLeft, ssRight,'#20998#21035#23545#24212'0:'#26410#30693'/1:PC/2:And' +
'roid/3:iPhone/4:Tablet'
ExplicitWidth = 651
end
object Label19: TLabel
Left = 0
Top = 100
Width = 416
Height = 20
Align = alTop
Caption = 'screenHeight'#21487#20197#36890#36807'dwGetProp(Self,'#39'screenheight'#39')'#24471#21040#65307
ExplicitWidth = 430
end
object Label20: TLabel
Left = 0
Top = 80
Width = 416
Height = 20
Align = alTop
Caption = 'screenWidth'#21487#20197#36890#36807'dwGetProp(Self,'#39'screenwidth'#39')'#24471#21040#65307
ExplicitWidth = 418
end
object Label21: TLabel
Left = 0
Top = 160
Width = 416
Height = 20
Align = alTop
Caption = 'clientWidth'#21487#20197#36890#36807'dwGetProp(Self,'#39'clientwidth'#39')'#24471#21040#65307
ExplicitWidth = 402
end
object Label22: TLabel
Left = 0
Top = 180
Width = 416
Height = 20
Align = alTop
Caption = 'clientHeight'#21487#20197#36890#36807'dwGetProp(Self,'#39'clientheight'#39')'#24471#21040#65307
ExplicitWidth = 414
end
end
end
end
end
| 34.793651 | 222 | 0.630214 |
838886cafe5dc0224d94563f25967ec5e4b46305 | 256 | dpr | Pascal | Demos/OSInfo/OSInfoDemo.dpr | barlone/Kastri | fb12d9eba242e67efd87eb1cb7acd123601a58ed | [
"MIT"
]
| 259 | 2020-05-27T03:15:19.000Z | 2022-03-24T16:35:02.000Z | Demos/OSInfo/OSInfoDemo.dpr | barlone/Kastri | fb12d9eba242e67efd87eb1cb7acd123601a58ed | [
"MIT"
]
| 95 | 2020-06-16T09:46:06.000Z | 2022-03-28T00:27:07.000Z | Demos/OSInfo/OSInfoDemo.dpr | barlone/Kastri | fb12d9eba242e67efd87eb1cb7acd123601a58ed | [
"MIT"
]
| 56 | 2020-06-04T19:32:40.000Z | 2022-03-26T15:32:47.000Z | program OSInfoDemo;
{$R 'Data.res' 'Data.rc'}
uses
System.StartUpCopy,
FMX.Forms,
MainFrm in 'MainFrm.pas' {frmMain};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TfrmMain, frmMain);
Application.Run;
end.
| 15.058824 | 45 | 0.660156 |
f1cb9082790441be65ed16040f0a4482af166944 | 87 | pas | Pascal | Test/FunctionsString/tocsstext.pas | jomael/DWScript | 560797ff8dbed6b2508a561af6dadd7fba058a4e | [
"Condor-1.1"
]
| 79 | 2015-03-18T10:46:13.000Z | 2022-03-17T18:05:11.000Z | Test/FunctionsString/tocsstext.pas | jomael/DWScript | 560797ff8dbed6b2508a561af6dadd7fba058a4e | [
"Condor-1.1"
]
| 6 | 2016-03-29T14:39:00.000Z | 2020-09-14T10:04:14.000Z | Test/FunctionsString/tocsstext.pas | jomael/DWScript | 560797ff8dbed6b2508a561af6dadd7fba058a4e | [
"Condor-1.1"
]
| 25 | 2016-05-04T13:11:38.000Z | 2021-09-29T13:34:31.000Z | var s := '"}';
PrintLn(s.ToCSSText);
s := "hello'world";
PrintLn(s.ToCSSText); | 12.428571 | 22 | 0.563218 |
8332724e40bb8a506a65c8d7b4e99974d644392e | 15,327 | dfm | Pascal | Win11_Delphi11/NumberBoxDemo/NumberBoxDemo_Unit1.dfm | marcocantu/DelphiSessions | c3fe2ab2eb8619343179b8474ae728c8b0f305db | [
"MIT"
]
| 44 | 2017-05-30T20:54:06.000Z | 2022-02-25T16:44:23.000Z | Win11_Delphi11/NumberBoxDemo/NumberBoxDemo_Unit1.dfm | marcocantu/DelphiSessions | c3fe2ab2eb8619343179b8474ae728c8b0f305db | [
"MIT"
]
| null | null | null | Win11_Delphi11/NumberBoxDemo/NumberBoxDemo_Unit1.dfm | marcocantu/DelphiSessions | c3fe2ab2eb8619343179b8474ae728c8b0f305db | [
"MIT"
]
| 19 | 2017-07-25T10:03:13.000Z | 2021-10-17T11:40:38.000Z | object NumBoxDemo: TNumBoxDemo
Left = 0
Top = 0
Caption = 'TNumberBox Demo'
ClientHeight = 403
ClientWidth = 594
Color = clBtnFace
Constraints.MinHeight = 462
Constraints.MinWidth = 610
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Menu = MainMenu1
OldCreateOrder = False
OnCreate = FormCreate
DesignSize = (
594
403)
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 8
Top = 215
Width = 36
Height = 13
Caption = 'Decimal'
end
object Label2: TLabel
Left = 8
Top = 242
Width = 52
Height = 13
Caption = 'Large Step'
end
object Label3: TLabel
Left = 8
Top = 296
Width = 40
Height = 13
Caption = 'Max Len'
end
object Label4: TLabel
Left = 8
Top = 269
Width = 49
Height = 13
Caption = 'Small Step'
end
object Label5: TLabel
Left = 8
Top = 323
Width = 49
Height = 13
Caption = 'Max Value'
end
object Label6: TLabel
Left = 8
Top = 350
Width = 45
Height = 13
Caption = 'Min Value'
end
object Label7: TLabel
Left = 150
Top = 279
Width = 25
Height = 13
Anchors = [akLeft, akBottom]
Caption = 'Color'
end
object Label15: TLabel
Left = 8
Top = 189
Width = 44
Height = 13
Caption = 'Currency'
end
object Label16: TLabel
Left = 8
Top = 377
Width = 44
Height = 13
Caption = 'Font Size'
end
object Label17: TLabel
Left = 228
Top = 201
Width = 100
Height = 13
Caption = 'Example Expressions'
end
object NumberBox1: TNumberBox
Left = 168
Top = 128
Width = 225
Height = 38
AcceptExpressions = True
Alignment = taCenter
Anchors = [akLeft, akTop, akRight]
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = 30
Font.Name = 'Tahoma'
Font.Style = []
MaxLength = 1
ParentDoubleBuffered = False
ParentFont = False
TabOrder = 0
Value = -100.000000000000000000
SpinButtonOptions.ButtonWidth = 24
SpinButtonOptions.Placement = nbspInline
SpinButtonOptions.ArrowHotColor = clHotLight
SpinButtonOptions.ArrowPressedColor = clBtnHighlight
end
object CheckBox1: TCheckBox
Left = 8
Top = 8
Width = 129
Height = 17
Caption = 'Accept Expressions'
Checked = True
State = cbChecked
TabOrder = 1
end
object CheckBox2: TCheckBox
Left = 8
Top = 54
Width = 97
Height = 17
Caption = 'Autosize'
Checked = True
State = cbChecked
TabOrder = 2
end
object GroupBox1: TGroupBox
Left = 408
Top = 8
Width = 185
Height = 336
Anchors = [akTop, akRight]
Caption = 'Spin Button Options'
TabOrder = 3
object Label8: TLabel
Left = 10
Top = 142
Width = 63
Height = 13
Caption = 'Button Width'
end
object Label9: TLabel
Left = 10
Top = 118
Width = 60
Height = 13
Caption = 'Arrow Width'
end
object Label10: TLabel
Left = 10
Top = 169
Width = 76
Height = 13
Caption = 'Repeat Interval'
end
object Label11: TLabel
Left = 10
Top = 246
Width = 17
Height = 13
Caption = 'Hot'
end
object Label12: TLabel
Left = 10
Top = 274
Width = 38
Height = 13
Caption = 'Pressed'
end
object Label13: TLabel
Left = 10
Top = 302
Width = 40
Height = 13
Caption = 'Disabled'
end
object Label14: TLabel
Left = 10
Top = 219
Width = 29
Height = 13
Caption = 'Arrow'
end
object rdoPlacement: TRadioGroup
Left = 9
Top = 25
Width = 155
Height = 81
Caption = 'Placement'
TabOrder = 0
OnClick = rdoPlacementClick
end
object NumberBox9: TNumberBox
Left = 92
Top = 112
Width = 80
Height = 21
Alignment = taCenter
TabOrder = 1
SpinButtonOptions.Placement = nbspCompact
end
object NumberBox8: TNumberBox
Left = 92
Top = 139
Width = 80
Height = 21
Alignment = taCenter
TabOrder = 2
Value = 24.000000000000000000
SpinButtonOptions.Placement = nbspCompact
end
object NumberBox10: TNumberBox
Left = 92
Top = 166
Width = 80
Height = 21
Alignment = taCenter
TabOrder = 3
Value = 100.000000000000000000
SpinButtonOptions.Placement = nbspCompact
end
object CheckBox5: TCheckBox
Left = 11
Top = 193
Width = 129
Height = 17
Caption = 'Show Inline Dividers'
Checked = True
State = cbChecked
TabOrder = 4
end
object ColorBox1: TColorBox
Left = 64
Top = 243
Width = 110
Height = 22
Selected = clHotLight
TabOrder = 5
end
object ColorBox2: TColorBox
Left = 64
Top = 271
Width = 110
Height = 22
Selected = clBtnHighlight
TabOrder = 6
end
object ColorBox3: TColorBox
Left = 64
Top = 299
Width = 110
Height = 22
Selected = clGrayText
TabOrder = 7
end
object ColorBox4: TColorBox
Left = 64
Top = 216
Width = 110
Height = 22
Selected = clWindowText
TabOrder = 8
end
end
object ColorListBox1: TColorListBox
Left = 150
Top = 298
Width = 139
Height = 97
Selected = clWindow
Anchors = [akLeft, akRight, akBottom]
TabOrder = 4
end
object CheckBox3: TCheckBox
Left = 8
Top = 31
Width = 97
Height = 17
Caption = 'AutoSelect'
Checked = True
State = cbChecked
TabOrder = 5
end
object rdoMode: TRadioGroup
Left = 168
Top = 8
Width = 105
Height = 90
Caption = 'Mode'
TabOrder = 6
OnClick = rdoModeClick
end
object rdoCurrencyFormat: TRadioGroup
Left = 295
Top = 295
Width = 106
Height = 100
Anchors = [akRight, akBottom]
Caption = 'Currency Format'
ItemIndex = 0
Items.Strings = (
'$0.00'
'0.00$'
'$ 0.00'
'0.00 $')
TabOrder = 7
OnClick = rdoCurrencyFormatClick
end
object NumberBox2: TNumberBox
Left = 64
Top = 212
Width = 80
Height = 21
Alignment = taCenter
TabOrder = 8
Value = 2.000000000000000000
SpinButtonOptions.Placement = nbspCompact
end
object NumberBox3: TNumberBox
Left = 64
Top = 239
Width = 80
Height = 21
Alignment = taCenter
TabOrder = 9
Value = 10.000000000000000000
SpinButtonOptions.Placement = nbspCompact
end
object NumberBox4: TNumberBox
Left = 64
Top = 293
Width = 80
Height = 21
Alignment = taCenter
TabOrder = 10
Value = 1.000000000000000000
SpinButtonOptions.Placement = nbspCompact
end
object NumberBox5: TNumberBox
Left = 64
Top = 266
Width = 80
Height = 21
Alignment = taCenter
TabOrder = 11
Value = 1.000000000000000000
SpinButtonOptions.Placement = nbspCompact
end
object NumberBox6: TNumberBox
Left = 64
Top = 320
Width = 80
Height = 21
Alignment = taCenter
TabOrder = 12
SpinButtonOptions.Placement = nbspCompact
end
object NumberBox7: TNumberBox
Left = 64
Top = 347
Width = 80
Height = 21
Alignment = taCenter
TabOrder = 13
SpinButtonOptions.Placement = nbspCompact
end
object CheckBox4: TCheckBox
Left = 8
Top = 75
Width = 97
Height = 17
Caption = 'ReadOnly'
TabOrder = 14
end
object rdoAlign: TRadioGroup
Left = 287
Top = 8
Width = 106
Height = 90
Caption = 'Align'
TabOrder = 15
OnClick = rdoAlignClick
end
object CheckBox6: TCheckBox
Left = 8
Top = 98
Width = 116
Height = 17
Caption = 'Use Mouse Wheel'
TabOrder = 16
end
object CheckBox7: TCheckBox
Left = 8
Top = 121
Width = 116
Height = 17
Caption = 'Use NaN Value'
TabOrder = 17
end
object CheckBox8: TCheckBox
Left = 8
Top = 144
Width = 116
Height = 17
Caption = 'Use Up Down Keys'
Checked = True
State = cbChecked
TabOrder = 18
end
object CheckBox9: TCheckBox
Left = 8
Top = 167
Width = 116
Height = 17
Caption = 'Wrap'
TabOrder = 19
end
object ComboBox1: TComboBox
Left = 64
Top = 185
Width = 80
Height = 21
TabOrder = 20
OnChange = ComboBox1Change
Items.Strings = (
'$'
#163
#8364
#165
#8361
#8358
#8369
#8381
#8360
#3647
#402
'R$'
#8353
#162
#8362)
end
object NumberBox11: TNumberBox
Left = 64
Top = 374
Width = 80
Height = 21
Alignment = taCenter
TabOrder = 21
Value = 30.000000000000000000
SpinButtonOptions.Placement = nbspCompact
end
object ComboBox2: TComboBox
Left = 208
Top = 220
Width = 145
Height = 21
Style = csDropDownList
TabOrder = 22
OnChange = ComboBox2Change
Items.Strings = (
'20*42'
'1+2+3+4+5'
'10/33'
'8-2'
'10/(2+5*3)*25')
end
object BindingsList1: TBindingsList
Methods = <>
OutputConverters = <>
Left = 124
Top = 69
object LinkControlToPropertyAcceptExpressions: TLinkControlToProperty
Category = 'Quick Bindings'
Control = CheckBox1
Track = True
Component = NumberBox1
ComponentProperty = 'AcceptExpressions'
end
object LinkControlToPropertyAutoSize: TLinkControlToProperty
Category = 'Quick Bindings'
Control = CheckBox2
Track = True
Component = NumberBox1
ComponentProperty = 'AutoSize'
end
object LinkControlToPropertyColor: TLinkControlToProperty
Category = 'Quick Bindings'
Control = ColorListBox1
Track = True
Component = NumberBox1
ComponentProperty = 'Color'
end
object LinkControlToPropertyAutoSelect: TLinkControlToProperty
Category = 'Quick Bindings'
Control = CheckBox3
Track = True
Component = NumberBox1
ComponentProperty = 'AutoSelect'
end
object LinkControlToPropertyDecimal: TLinkControlToProperty
Category = 'Quick Bindings'
Control = NumberBox2
Track = True
Component = NumberBox1
ComponentProperty = 'Decimal'
end
object LinkControlToPropertyMaxLength: TLinkControlToProperty
Category = 'Quick Bindings'
Control = NumberBox4
Track = True
Component = NumberBox1
ComponentProperty = 'MaxLength'
end
object LinkControlToPropertySmallStep: TLinkControlToProperty
Category = 'Quick Bindings'
Control = NumberBox5
Track = True
Component = NumberBox1
ComponentProperty = 'SmallStep'
end
object LinkControlToPropertyMaxValue: TLinkControlToProperty
Category = 'Quick Bindings'
Control = NumberBox6
Track = True
Component = NumberBox1
ComponentProperty = 'MaxValue'
end
object LinkControlToPropertyMinValue: TLinkControlToProperty
Category = 'Quick Bindings'
Control = NumberBox7
Track = True
Component = NumberBox1
ComponentProperty = 'MinValue'
end
object LinkControlToPropertyReadOnly: TLinkControlToProperty
Category = 'Quick Bindings'
Control = CheckBox4
Track = True
Component = NumberBox1
ComponentProperty = 'ReadOnly'
end
object LinkControlToPropertySpinButtonOptionsButtonWidth: TLinkControlToProperty
Category = 'Quick Bindings'
Control = NumberBox8
Track = True
Component = NumberBox1
ComponentProperty = 'SpinButtonOptions.ButtonWidth'
end
object LinkControlToPropertySpinButtonOptionsArrowWidth: TLinkControlToProperty
Category = 'Quick Bindings'
Control = NumberBox9
Track = True
Component = NumberBox1
ComponentProperty = 'SpinButtonOptions.ArrowWidth'
end
object LinkControlToPropertySpinButtonOptionsRepeatTimerInterval: TLinkControlToProperty
Category = 'Quick Bindings'
Control = NumberBox10
Track = True
Component = NumberBox1
ComponentProperty = 'SpinButtonOptions.RepeatTimerInterval'
end
object LinkControlToPropertySpinButtonOptionsShowInlineDividers: TLinkControlToProperty
Category = 'Quick Bindings'
Control = CheckBox5
Track = True
Component = NumberBox1
ComponentProperty = 'SpinButtonOptions.ShowInlineDividers'
end
object LinkControlToPropertyUseMouseWheel: TLinkControlToProperty
Category = 'Quick Bindings'
Control = CheckBox6
Track = True
Component = NumberBox1
ComponentProperty = 'UseMouseWheel'
end
object LinkControlToPropertyUseNaNValue: TLinkControlToProperty
Category = 'Quick Bindings'
Control = CheckBox7
Track = True
Component = NumberBox1
ComponentProperty = 'UseNaNValue'
end
object LinkControlToPropertyUseUpDownKeys: TLinkControlToProperty
Category = 'Quick Bindings'
Control = CheckBox8
Track = True
Component = NumberBox1
ComponentProperty = 'UseUpDownKeys'
end
object LinkControlToPropertyWrap: TLinkControlToProperty
Category = 'Quick Bindings'
Control = CheckBox9
Track = True
Component = NumberBox1
ComponentProperty = 'Wrap'
end
object LinkControlToPropertySpinButtonOptionsArrowColor: TLinkControlToProperty
Category = 'Quick Bindings'
Control = ColorBox4
Track = True
Component = NumberBox1
ComponentProperty = 'SpinButtonOptions.ArrowColor'
end
object LinkControlToPropertySpinButtonOptionsArrowHotColor: TLinkControlToProperty
Category = 'Quick Bindings'
Control = ColorBox1
Track = True
Component = NumberBox1
ComponentProperty = 'SpinButtonOptions.ArrowHotColor'
end
object LinkControlToPropertySpinButtonOptionsArrowPressedColor: TLinkControlToProperty
Category = 'Quick Bindings'
Control = ColorBox2
Track = True
Component = NumberBox1
ComponentProperty = 'SpinButtonOptions.ArrowPressedColor'
end
object LinkControlToPropertySpinButtonOptionsArrowDisabledColor: TLinkControlToProperty
Category = 'Quick Bindings'
Control = ColorBox3
Track = True
Component = NumberBox1
ComponentProperty = 'SpinButtonOptions.ArrowDisabledColor'
end
object LinkControlToPropertyLargeStep: TLinkControlToProperty
Category = 'Quick Bindings'
Control = NumberBox3
Track = True
Component = NumberBox1
ComponentProperty = 'LargeStep'
end
object LinkControlToPropertyFontHeight: TLinkControlToProperty
Category = 'Quick Bindings'
Control = NumberBox11
Track = True
Component = NumberBox1
ComponentProperty = 'Font.Height'
end
end
object MainMenu1: TMainMenu
Left = 128
Top = 16
object Exit1: TMenuItem
Caption = 'Exit'
OnClick = Exit1Click
end
object mnuStyle: TMenuItem
Caption = 'Style'
end
end
end
| 23.082831 | 92 | 0.630848 |
f1827e90aa100714fbe078525a8670eb26a2d6c1 | 5,780 | pas | Pascal | Source/AggScanlineBin.pas | kant/AggPasMod | 6acc4502e9108ae105b55992800d0a3a505fb033 | [
"OLDAP-2.4",
"OLDAP-2.3"
]
| 69 | 2015-06-07T10:45:24.000Z | 2022-02-17T06:47:12.000Z | Source/AggScanlineBin.pas | kant/AggPasMod | 6acc4502e9108ae105b55992800d0a3a505fb033 | [
"OLDAP-2.4",
"OLDAP-2.3"
]
| 15 | 2015-08-28T07:28:58.000Z | 2020-04-10T22:16:57.000Z | Source/AggScanlineBin.pas | kant/AggPasMod | 6acc4502e9108ae105b55992800d0a3a505fb033 | [
"OLDAP-2.4",
"OLDAP-2.3"
]
| 28 | 2015-06-11T05:04:57.000Z | 2021-05-28T10:52:15.000Z | unit AggScanLineBin;
////////////////////////////////////////////////////////////////////////////////
// //
// Anti-Grain Geometry (modernized Pascal fork, aka 'AggPasMod') //
// Maintained by Christian-W. Budde (Christian@pcjv.de) //
// Copyright (c) 2012-2020 //
// //
// Based on: //
// Pascal port by Milan Marusinec alias Milano (milan@marusinec.sk) //
// Copyright (c) 2005-2006, see http://www.aggpas.org //
// //
// Original License: //
// Anti-Grain Geometry - Version 2.4 (Public License) //
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) //
// Contact: McSeem@antigrain.com / McSeemAgg@yahoo.com //
// //
// Permission to copy, use, modify, sell and distribute this software //
// is granted provided this copyright notice appears in all copies. //
// This software is provided "as is" without express or implied //
// warranty, and with no claim as to its suitability for any purpose. //
// //
////////////////////////////////////////////////////////////////////////////////
interface
{$I AggCompiler.inc}
uses
AggBasics,
AggScanLine;
type
PAggSpanBin = ^TAggSpanBin;
TAggSpanBin = record
X, Len: Int16;
end;
// This is binary scaline container which supports the interface
// used in the Rasterizer::render(). See description of AggScanlineUnpacked8
// for details.
TAggScanLineBin = class(TAggCustomScanLine)
private
type
TConstIterator = class(TAggCustomSpan)
private
FSpan: PAggSpanBin;
protected
function GetX: Integer; override;
function GetLength: Integer; override;
public
constructor Create(aScanline: TAggScanLineBin);
procedure IncOperator; override;
end;
private
FMaxLength: Cardinal;
FLastX, FY: Integer;
FSpans, FCurrentSpan: PAggSpanBin;
protected
function GetY: Integer; override;
function GetNumSpans: Cardinal; override;
//function GetSizeOfSpan: Cardinal; override;
//function GetIsPlainSpan: Boolean; override;
public
constructor Create;
destructor Destroy; override;
procedure Reset(MinX, MaxX: Integer); override;
procedure ResetSpans; override;
procedure Finalize(Y: Integer); override;
procedure AddCell(X: Integer; Cover: Cardinal); override;
procedure AddSpan(X: Integer; Len, Cover: Cardinal); override;
function GetBegin: TAggCustomSpan; override;
end;
implementation
{ TAggScanLineBin.TConstIterator }
constructor TAggScanLineBin.TConstIterator.Create(aScanline: TAggScanLineBin);
begin
inherited Create;
FSpan := PAggSpanBin(PtrComp(aScanline.FSpans) + SizeOf(TAggSpanBin));
end;
function TAggScanLineBin.TConstIterator.GetLength: Integer;
begin
Result := FSpan.Len;
end;
function TAggScanLineBin.TConstIterator.GetX: Integer;
begin
Result := FSpan.X;
end;
procedure TAggScanLineBin.TConstIterator.IncOperator;
begin
Inc(PtrComp(FSpan), SizeOf(TAggSpanBin));
end;
{ TAggScanLineBin }
constructor TAggScanLineBin.Create;
begin
FMaxLength := 0;
FLastX := $7FFFFFF0;
FSpans := nil;
FCurrentSpan := nil;
end;
destructor TAggScanLineBin.Destroy;
begin
AggFreeMem(Pointer(FSpans), FMaxLength * SizeOf(TAggSpanBin));
inherited;
end;
procedure TAggScanLineBin.Reset(MinX, MaxX: Integer);
var
MaxLength: Cardinal;
begin
MaxLength := MaxX - MinX + 3;
if MaxLength > FMaxLength then
begin
AggFreeMem(Pointer(FSpans), FMaxLength * SizeOf(TAggSpanBin));
AggGetMem(Pointer(FSpans), MaxLength * SizeOf(TAggSpanBin));
FMaxLength := MaxLength;
end;
FLastX := $7FFFFFF0;
FCurrentSpan := FSpans;
end;
procedure TAggScanLineBin.ResetSpans;
begin
FLastX := $7FFFFFF0;
FCurrentSpan := FSpans;
end;
procedure TAggScanLineBin.Finalize(Y: Integer);
begin
FY := Y;
end;
procedure TAggScanLineBin.AddCell(X: Integer; Cover: Cardinal);
begin
if X = FLastX + 1 then
Inc(FCurrentSpan.Len)
else
begin
Inc(PtrComp(FCurrentSpan), SizeOf(TAggSpanBin));
FCurrentSpan.X := Int16(X);
FCurrentSpan.Len := 1;
end;
FLastX := X;
end;
procedure TAggScanLineBin.AddSpan(X: Integer; Len, Cover: Cardinal);
begin
if X = FLastX + 1 then
FCurrentSpan.Len := Int16(FCurrentSpan.Len + Len)
else
begin
Inc(PtrComp(FCurrentSpan), SizeOf(TAggSpanBin));
FCurrentSpan.X := Int16(X);
FCurrentSpan.Len := Int16(Len);
end;
FLastX := X + Len - 1;
end;
function TAggScanLineBin.GetY: Integer;
begin
Result := FY
end;
function TAggScanLineBin.GetNumSpans: Cardinal;
begin
Result := (PtrComp(FCurrentSpan) - PtrComp(FSpans)) div SizeOf(TAggSpanBin);
end;
function TAggScanLineBin.GetBegin: TAggCustomSpan;
begin
Result := TConstIterator.Create(Self);
end;
{function TAggScanLineBin.GetIsPlainSpan: Boolean;
begin
Result := False;
end;}
{function TAggScanLineBin.GetSizeOfSpan: Cardinal;
begin
Result := SizeOf(TAggSpanBin);
end;}
end.
| 27.788462 | 81 | 0.581661 |
f10566d343735cfc7bf18ac3d572c3664a494b4f | 4,314 | pas | Pascal | unittests/general/TestServer/WebModuleUnit.pas | juliosenha/delphimvcframework | f22ff8c99df2873a98195b9d0fc8a27f952c1141 | [
"Apache-2.0"
]
| null | null | null | unittests/general/TestServer/WebModuleUnit.pas | juliosenha/delphimvcframework | f22ff8c99df2873a98195b9d0fc8a27f952c1141 | [
"Apache-2.0"
]
| null | null | null | unittests/general/TestServer/WebModuleUnit.pas | juliosenha/delphimvcframework | f22ff8c99df2873a98195b9d0fc8a27f952c1141 | [
"Apache-2.0"
]
| null | null | null | // ***************************************************************************
//
// Delphi MVC Framework
//
// Copyright (c) 2010-2022 Daniele Teti and the DMVCFramework Team
//
// https://github.com/danieleteti/delphimvcframework
//
// ***************************************************************************
//
// 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 WebModuleUnit;
interface
uses
System.SysUtils,
System.Classes,
Web.HTTPApp,
MVCFramework,
FireDAC.Stan.StorageJSON
{$IFDEF MSWINDOWS}
,MVCFramework.Serializer.JsonDataObjects.OptionalCustomTypes
{$ENDIF}
;
type
TMainWebModule = class(TWebModule)
FDStanStorageJSONLink1: TFDStanStorageJSONLink;
procedure WebModuleCreate(Sender: TObject);
private
MVCEngine: TMVCEngine;
end;
var
WebModuleClass: TComponentClass = TMainWebModule;
implementation
{$R *.dfm}
uses
TestServerControllerU,
TestServerControllerExceptionU,
SpeedMiddlewareU,
MVCFramework.Middleware.Authentication,
System.Generics.Collections,
MVCFramework.Commons,
TestServerControllerPrivateU,
AuthHandlersU,
TestServerControllerJSONRPCU,
{$IFNDEF LINUX}
MVCFramework.View.Renderers.Mustache,
{$ENDIF}
MVCFramework.Middleware.Compression,
MVCFramework.Middleware.StaticFiles;
procedure TMainWebModule.WebModuleCreate(Sender: TObject);
begin
MVCEngine := TMVCEngine.Create(self,
procedure(Config: TMVCConfig)
begin
// no config here
Config[TMVCConfigKey.SessionTimeout] := '0'; // setting cookie
Config[TMVCConfigKey.PathPrefix] := '';
Config[TMVCConfigKey.ViewPath] := '..\templates';
Config[TMVCConfigKey.DefaultViewFileExtension] := 'html';
end, nil);
MVCEngine
.AddController(TTestServerController)
.AddController(TTestPrivateServerController)
.AddController(TTestServerControllerExceptionAfterCreate)
.AddController(TTestServerControllerExceptionBeforeDestroy)
.AddController(TTestServerControllerActionFilters)
.AddController(TTestPrivateServerControllerCustomAuth)
.AddController(TTestMultiPathController)
.AddController(TTestJSONRPCController, '/jsonrpc')
.AddController(TTestJSONRPCControllerWithGet, '/jsonrpcwithget')
.PublishObject(
function: TObject
begin
Result := TTestJSONRPCClass.Create
end, '/jsonrpcclass')
.PublishObject(
function: TObject
begin
Result := TTestJSONRPCClassWithGET.Create
end, '/jsonrpcclasswithget')
.PublishObject(
function: TObject
begin
Result := TTestJSONRPCHookClass.Create
end, '/jsonrpcclass1')
.PublishObject(
function: TObject
begin
Result := TTestJSONRPCHookClassWithGet.Create
end, '/jsonrpcclass1withget')
.AddController(TTestFaultController) // this will raise an exception
.AddController(TTestFault2Controller,
function: TMVCController
begin
Result := TTestFault2Controller.Create; // this will raise an exception
end)
.AddMiddleware(TMVCSpeedMiddleware.Create)
.AddMiddleware(TMVCCustomAuthenticationMiddleware.Create(TCustomAuthHandler.Create, '/system/users/logged'))
.AddMiddleware(TMVCStaticFilesMiddleware.Create('/static', 'www', 'index.html', False))
.AddMiddleware(TMVCStaticFilesMiddleware.Create('/spa', 'www', 'index.html', True))
// .AddMiddleware(TMVCStaticFilesMiddleware.Create('/', 'www', 'index.html', False))
.AddMiddleware(TMVCBasicAuthenticationMiddleware.Create(TBasicAuthHandler.Create))
.AddMiddleware(TMVCCompressionMiddleware.Create);
{$IFDEF MSWINDOWS}
MVCEngine.SetViewEngine(TMVCMustacheViewEngine);
RegisterOptionalCustomTypesSerializers(MVCEngine.Serializers[TMVCMediaType.APPLICATION_JSON]);
{$ENDIF}
end;
end.
| 32.19403 | 112 | 0.715809 |
4795a5c3d4e2a2d8713e91e3ef867a7577831957 | 24,003 | pas | Pascal | source/common/ServiceControlU.pas | littleearth/net-reflector | 5de5ef92e2177fef0758340f62370e2b69618c15 | [
"Apache-2.0"
]
| 8 | 2017-11-20T19:55:36.000Z | 2021-06-10T14:12:24.000Z | source/common/ServiceControlU.pas | littleearth/net-reflector | 5de5ef92e2177fef0758340f62370e2b69618c15 | [
"Apache-2.0"
]
| null | null | null | source/common/ServiceControlU.pas | littleearth/net-reflector | 5de5ef92e2177fef0758340f62370e2b69618c15 | [
"Apache-2.0"
]
| 5 | 2017-11-21T03:54:29.000Z | 2021-06-13T08:55:19.000Z | unit ServiceControlU;
interface
uses
Dialogs, SysUtils, Windows, Messages, WinSvc, SvcMgr, Classes;
type
TNTServiceStatus = (svStopped, svRunning, svPaused, svStartPending,
svStopPending, svContinuePending, svPausePending, svUnknown);
type
TNTServiceFailureAction = (sfaNone = integer(SC_ACTION_NONE),
sfaRestart = integer(SC_ACTION_RESTART),
sfaReboot = integer(SC_ACTION_REBOOT),
sfaRunCommand = integer(SC_ACTION_RUN_COMMAND));
type
TNTServiceControl = class(TComponent)
private
FMachineName: string;
FServiceName: string;
FNTServiceStatus: TNTServiceStatus;
FStopDependencies: boolean;
FStartDependencies: boolean;
protected
procedure UpdateServiceStatus;
function GetServiceStatusString: string;
function GetServiceStatus: TNTServiceStatus;
procedure SetServiceName(AValue: string);
procedure SetMachineName(AValue: string);
function GetServiceDependencies(AServer: String; AServiceName: string;
ADependencies: TStrings): boolean;
function StopService(AServer: string; AServiceName: string): boolean;
function StartService(AServer: string; AServiceName: string): boolean;
public
constructor Create(AOwner: TComponent); reintroduce;
function Start: boolean;
function Stop: boolean;
function Resume: boolean;
function Pause: boolean;
function IsInstalled: boolean;
function IsRunning: boolean;
function Install(ADisplayName: string; AFileName: TFileName;
AServiceStartName: string = ''; AServicePassword: string = '';
AInteractiveService: boolean = False): boolean;
function Uninstall: boolean;
function GetServiceList(AServiceList: TStrings): boolean;
function GetDependencies(AList: TStrings): boolean;
function SetServiceFailureActions
(Action1: TNTServiceFailureAction = sfaNone; Action1Delay: Cardinal = 0;
Action2: TNTServiceFailureAction = sfaNone; Action2Delay: Cardinal = 0;
Action3: TNTServiceFailureAction = sfaNone; Action3Delay: Cardinal = 0;
AResetPeriod: Cardinal = 0; ACommand: string = ''): boolean;
published
property ServiceName: string Read FServiceName Write SetServiceName;
property MachineName: string Read FMachineName Write SetMachineName;
property NTServiceStatus: TNTServiceStatus Read GetServiceStatus;
property Status: string Read GetServiceStatusString;
property StopDependencies: boolean read FStopDependencies
write FStopDependencies;
property StartDependencies: boolean read FStartDependencies
write FStartDependencies;
end;
implementation
constructor TNTServiceControl.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FNTServiceStatus := svUnknown;
FStopDependencies := False;
FStartDependencies := False;
end;
procedure TNTServiceControl.UpdateServiceStatus;
var
schm: SC_Handle; // service control manager handle
schs: SC_Handle; // service handle
ss: TServiceStatus; // service status
dwStat: DWord; // current service status
begin
dwStat := 0;
// connect to the service control manager
schm := OpenSCManager(PChar(FMachineName), nil, SC_MANAGER_CONNECT);
// if successful...
if (schm > 0) then
begin
// open a handle to the specified service
// we want to query service status
schs := OpenService(schm, PChar(FServiceName), SERVICE_QUERY_STATUS);
// if successful...
if (schs > 0) then
begin
// retrieve the current status
// of the specified service
if (QueryServiceStatus(schs, ss)) then
begin
dwStat := ss.dwCurrentState;
end;
// close service handle
CloseServiceHandle(schs);
end;
// close service control manager handle
CloseServiceHandle(schm);
end;
case dwStat of
SERVICE_STOPPED:
FNTServiceStatus := svStopped;
SERVICE_RUNNING:
FNTServiceStatus := svRunning;
SERVICE_PAUSED:
FNTServiceStatus := svPaused;
SERVICE_START_PENDING:
FNTServiceStatus := svStartPending;
SERVICE_STOP_PENDING:
FNTServiceStatus := svStopPending;
SERVICE_CONTINUE_PENDING:
FNTServiceStatus := svContinuePending;
SERVICE_PAUSE_PENDING:
FNTServiceStatus := svPausePending;
else
FNTServiceStatus := svUnknown;
end;
end;
procedure TNTServiceControl.SetServiceName(AValue: string);
begin
FServiceName := AValue;
UpdateServiceStatus;
end;
procedure TNTServiceControl.SetMachineName(AValue: string);
begin
FMachineName := AValue;
end;
function TNTServiceControl.GetServiceStatus: TNTServiceStatus;
begin
UpdateServiceStatus;
Result := FNTServiceStatus;
end;
function TNTServiceControl.GetServiceStatusString: string;
var
s: string;
begin
case GetServiceStatus of
svStopped:
s := 'STOPPED';
svRunning:
s := 'RUNNING';
svPaused:
s := 'PAUSED';
svStartPending:
s := 'START/PENDING';
svStopPending:
s := 'STOP/PENDING';
svContinuePending:
s := 'CONTINUE/PENDING';
svPausePending:
s := 'PAUSE/PENDING';
else
s := 'UNKNOWN';
end;
Result := s;
end;
function TNTServiceControl.Pause: boolean;
var
schm: SC_Handle; // service control manager handle
schs: SC_Handle; // service handle
ss: TServiceStatus; // service status
dwChkP: DWord; // check point
begin
// connect to the service control manager
schm := OpenSCManager(PChar(FMachineName), nil, SC_MANAGER_ALL_ACCESS);
// if successful...
if (schm > 0) then
begin
// open a handle to the specified service
// we want to query service status
schs := OpenService(schm, PChar(FServiceName), SERVICE_ALL_ACCESS);
// if successful...
if (schs > 0) then
begin
if ControlService(schs, SERVICE_CONTROL_PAUSE, ss) then
begin
// check status
if (QueryServiceStatus(schs, ss)) then
begin
while (SERVICE_PAUSED <> ss.dwCurrentState) do
begin
// dwCheckPoint contains a value that the
// service increments periodically to
// report its progress during a
// lengthy operation. Save current value
dwChkP := ss.dwCheckPoint;
// wait a bit before checking status again
// dwWaitHint is the estimated amount of
// time the calling program should wait
// before calling QueryServiceStatus()
// again. Idle events should be
// handled here...
Sleep(ss.dwWaitHint);
if not QueryServiceStatus(schs, ss) then
begin
// couldn't check status break from the
// loop
break;
end;
if ss.dwCheckPoint < dwChkP then
begin
// QueryServiceStatus didn't increment
// dwCheckPoint as it should have.
// Avoid an infinite loop by breaking
break;
end;
end;
end;
end
else
RaiseLastOsError;
// close service handle
CloseServiceHandle(schs);
end;
// close service control manager handle
CloseServiceHandle(schm);
end;
Result := SERVICE_PAUSED = ss.dwCurrentState;
end;
function TNTServiceControl.Resume: boolean;
var
schm: SC_Handle; // service control manager handle
schs: SC_Handle; // service handle
ss: TServiceStatus; // service status
dwChkP: DWord; // check point
begin
// connect to the service control manager
schm := OpenSCManager(PChar(FMachineName), nil, SC_MANAGER_ALL_ACCESS);
// if successful...
if (schm > 0) then
begin
// open a handle to the specified service
// we want to query service status
schs := OpenService(schm, PChar(FServiceName), SERVICE_ALL_ACCESS);
// if successful...
if (schs > 0) then
begin
if ControlService(schs, SERVICE_CONTROL_CONTINUE, ss) then
begin
// check status
if (QueryServiceStatus(schs, ss)) then
begin
while (SERVICE_RUNNING <> ss.dwCurrentState) do
begin
// dwCheckPoint contains a value that the
// service increments periodically to
// report its progress during a
// lengthy operation. Save current value
dwChkP := ss.dwCheckPoint;
// wait a bit before checking status again
// dwWaitHint is the estimated amount of
// time the calling program should wait
// before calling QueryServiceStatus()
// again. Idle events should be
// handled here...
Sleep(ss.dwWaitHint);
if not QueryServiceStatus(schs, ss) then
begin
// couldn't check status break from the
// loop
break;
end;
if ss.dwCheckPoint < dwChkP then
begin
// QueryServiceStatus didn't increment
// dwCheckPoint as it should have.
// Avoid an infinite loop by breaking
break;
end;
end;
end;
end
else
RaiseLastOsError;
// close service handle
CloseServiceHandle(schs);
end;
// close service control manager handle
CloseServiceHandle(schm);
end;
Result := SERVICE_RUNNING = ss.dwCurrentState;
end;
function TNTServiceControl.Start: boolean;
var
Dependencies: TStringList;
Idx: integer;
begin
Dependencies := TStringList.Create;
try
Result := StartService(FMachineName, FServiceName);
if Result and FStartDependencies then
begin
// Log(Format('Starting %s', [FServiceName]));
GetServiceDependencies(FMachineName, FServiceName, Dependencies);
for Idx := 0 to Pred(Dependencies.Count) do
begin
// Log(Format('Starting Dependency %s (%s)', [Dependencies.Names[Idx],
// Dependencies.ValueFromIndex[Idx]]));
try
StartService(FMachineName, Dependencies.Names[Idx]);
except
on E: Exception do
begin
// Error(E);
end;
end;
end;
end;
finally
FreeAndNil(Dependencies);
end;
end;
function TNTServiceControl.GetServiceDependencies(AServer: String;
AServiceName: string; ADependencies: TStrings): boolean;
var
schm, schs: SC_Handle;
Services, s: PEnumServiceStatus;
BytesNeeded, ServicesReturned: DWord;
i: integer;
begin
Result := False;
ADependencies.Clear;
schm := OpenSCManager(PChar(AServer), nil, SC_MANAGER_CONNECT);
Services := nil;
// if successful...
if schm > 0 then
begin
// open a handle to the specified service
// we want to stop the service and
// query service status
schs := OpenService(schm, PChar(AServiceName),
SERVICE_ENUMERATE_DEPENDENTS);
if schs > 0 then
begin
if EnumDependentServices(schs, SERVICE_ACTIVE + SERVICE_INACTIVE,
Services, 0, BytesNeeded, ServicesReturned) then
begin
GetMem(Services, BytesNeeded);
try
if EnumDependentServices(schs, SERVICE_ACTIVE + SERVICE_INACTIVE,
Services, BytesNeeded, BytesNeeded, ServicesReturned) then
begin
// Now process it...
s := Services;
for i := 0 to Pred(ServicesReturned) do
begin
ADependencies.Add(s^.lpServiceName + '=' + s^.lpDisplayName);
Inc(s);
end;
Result := True;
end;
finally
FreeMem(Services);
end;
// WinSvc.QueryServiceConfig(schs, nil, 0, R);
// GetMem(ServiceConfig, R + 1);
// if WinSvc.QueryServiceConfig(schs, ServiceConfig, R + 1, R) then
// begin
// Debug('GetServiceDependencies', ServiceConfig.lpDisplayName);
// Debug('GetServiceDependencies', ServiceConfig.lpServiceStartName);
// Debug('GetServiceDependencies', ServiceConfig.lpDependencies);
// DepList := ServiceConfig.lpDependencies;
// if Assigned(DepList) then
// begin
// while DepList[0] <> #0 do
// begin
// Dep := DepList;
// ADependencies.Add(Dep);
// Inc(DepList, StrLen(DepList) + 1)
// end;
// end;
// FreeMem(ServiceConfig);
// Result := True;
end;
CloseServiceHandle(schs);
end;
end;
CloseServiceHandle(schm);
end;
function TNTServiceControl.StopService(AServer: string;
AServiceName: string): boolean;
var
schm, schs: SC_Handle;
ss: TServiceStatus;
dwChkP: DWord;
begin
// connect to the service control manager
schm := OpenSCManager(PChar(AServer), nil, SC_MANAGER_CONNECT);
// if successful...
if schm > 0 then
begin
// open a handle to the specified service
// we want to stop the service and
// query service status
schs := OpenService(schm, PChar(AServiceName), SERVICE_STOP or
SERVICE_QUERY_STATUS);
// if successful...
if schs > 0 then
begin
if ControlService(schs, SERVICE_CONTROL_STOP, ss) then
begin
// check status
if (QueryServiceStatus(schs, ss)) then
begin
while (SERVICE_STOPPED <> ss.dwCurrentState) do
begin
// dwCheckPoint contains a value that the
// service increments periodically to
// report its progress during a lengthy
// operation. Save current value
dwChkP := ss.dwCheckPoint;
// Wait a bit before checking status again.
// dwWaitHint is the estimated amount of
// time the calling program should wait
// before calling QueryServiceStatus()
// again. Idle events should be
// handled here...
Sleep(ss.dwWaitHint);
if (not QueryServiceStatus(schs, ss)) then
begin
// couldn't check status
// break from the loop
break;
end;
if (ss.dwCheckPoint < dwChkP) then
begin
// QueryServiceStatus didn't increment
// dwCheckPoint as it should have.
// Avoid an infinite loop by breaking
break;
end;
end;
end;
end;
// close service handle
CloseServiceHandle(schs);
end;
// close service control manager handle
CloseServiceHandle(schm);
end;
// return TRUE if the service status is stopped
Result := SERVICE_STOPPED = ss.dwCurrentState;
end;
function TNTServiceControl.StartService(AServer: string;
AServiceName: string): boolean;
var
schm, schs: SC_Handle;
ss: TServiceStatus;
psTemp: PChar;
dwChkP: DWord; // check point
begin
// connect to the service control manager
schm := OpenSCManager(PChar(AServer), nil, SC_MANAGER_CONNECT);
// if successful...
if (schm > 0) then
begin
// open a handle to the specified service
// we want to start the service and query service
// status
schs := OpenService(schm, PChar(AServiceName), SERVICE_START or
SERVICE_QUERY_STATUS);
// if successful...
if (schs > 0) then
begin
psTemp := nil;
if (WinSvc.StartService(schs, 0, psTemp)) then
begin
// check status
if (QueryServiceStatus(schs, ss)) then
begin
while (SERVICE_RUNNING <> ss.dwCurrentState) do
begin
// dwCheckPoint contains a value that the
// service increments periodically to
// report its progress during a
// lengthy operation. Save current value
dwChkP := ss.dwCheckPoint;
// wait a bit before checking status again
// dwWaitHint is the estimated amount of
// time the calling program should wait
// before calling QueryServiceStatus()
// again. Idle events should be
// handled here...
Sleep(ss.dwWaitHint);
if not QueryServiceStatus(schs, ss) then
begin
// couldn't check status break from the
// loop
break;
end;
if ss.dwCheckPoint < dwChkP then
begin
// QueryServiceStatus didn't increment
// dwCheckPoint as it should have.
// Avoid an infinite loop by breaking
break;
end;
end;
end;
end;
// close service handle
CloseServiceHandle(schs);
end;
// close service control manager handle
CloseServiceHandle(schm);
end;
// Return TRUE if the service status is running
Result := GetServiceStatus = svRunning;
end;
function TNTServiceControl.SetServiceFailureActions
(Action1: TNTServiceFailureAction = sfaNone; Action1Delay: Cardinal = 0;
Action2: TNTServiceFailureAction = sfaNone; Action2Delay: Cardinal = 0;
Action3: TNTServiceFailureAction = sfaNone; Action3Delay: Cardinal = 0;
AResetPeriod: Cardinal = 0; ACommand: string = ''): boolean;
var
schm, schs: SC_Handle;
sfa: SERVICE_FAILURE_ACTIONS;
actions: array [0 .. 2] of SC_ACTION;
function GetActionTypes(ANTServiceFailureAction: TNTServiceFailureAction)
: SC_ACTION_TYPE;
begin
case ANTServiceFailureAction of
sfaRestart:
Result := SC_ACTION_RESTART;
sfaReboot:
Result := SC_ACTION_REBOOT;
sfaRunCommand:
Result := SC_ACTION_RUN_COMMAND
else
Result := SC_ACTION_NONE;
end;
end;
begin
Result := False;
schm := OpenSCManager(PChar(FMachineName), nil, SC_MANAGER_ALL_ACCESS);
if (schm > 0) then
begin
schs := OpenService(schm, PChar(FServiceName), SERVICE_ALL_ACCESS);
if (schs > 0) then
begin
try
try
sfa.dwResetPeriod := AResetPeriod;
sfa.lpCommand := PChar(ACommand);
sfa.lpRebootMsg := Nil;
sfa.cActions := 3;
actions[0].&Type := GetActionTypes(Action1);
actions[0].Delay := Action1Delay;
actions[1].&Type := GetActionTypes(Action2);
actions[1].Delay := Action2Delay;
actions[2].&Type := GetActionTypes(Action3);
actions[2].Delay := Action3Delay;
sfa.lpsaActions := @actions;
Result := ChangeServiceConfig2(schs,
SERVICE_CONFIG_FAILURE_ACTIONS, @sfa);
except
on E: Exception do
begin
// Error(E);
end;
end;
finally
CloseServiceHandle(schs);
end;
end;
CloseServiceHandle(schm);
end;
end;
// Return TRUE if successful
function TNTServiceControl.Stop: boolean;
var
Dependencies: TStringList;
Idx: integer;
begin
Dependencies := TStringList.Create;
try
if FStopDependencies then
begin
GetServiceDependencies(FMachineName, FServiceName, Dependencies);
for Idx := 0 to Pred(Dependencies.Count) do
begin
// Log(Format('Stopping Dependency %s (%s)', [Dependencies.Names[Idx],
// Dependencies.ValueFromIndex[Idx]]));
try
StopService(FMachineName, Dependencies.Names[Idx]);
except
on E: Exception do
begin
// Error(E);
end;
end;
end;
end;
// Log(Format('Stopping %s', [FServiceName]));
Result := StopService(FMachineName, FServiceName);
finally
FreeAndNil(Dependencies);
end;
end;
function TNTServiceControl.GetServiceList(AServiceList: TStrings): boolean;
var
hSCM: THandle;
pEnumStatus: PEnumServiceStatusW;
dwByteNeeded: DWord;
dwNumOfService: DWord;
dwResumeHandle: DWord;
nI: integer;
begin
pEnumStatus := nil;
dwByteNeeded := 0;
dwResumeHandle := 0;
try
hSCM := OpenSCManager(PChar(FMachineName), nil, SC_MANAGER_ALL_ACCESS);
if not EnumServicesStatus(hSCM, SERVICE_WIN32 or SERVICE_DRIVER,
SERVICE_ACTIVE or SERVICE_INACTIVE, pEnumStatus, 0, dwByteNeeded,
dwNumOfService, dwResumeHandle) then
begin
if GetLastError = ERROR_MORE_DATA then
begin
GetMem(pEnumStatus, dwByteNeeded);
if not EnumServicesStatus(hSCM, SERVICE_WIN32 or SERVICE_DRIVER,
SERVICE_ACTIVE or SERVICE_INACTIVE, pEnumStatus, dwByteNeeded,
dwByteNeeded, dwNumOfService, dwResumeHandle) then
begin
Result := False;
Exit;
end;
end
else
begin
Result := False;
Exit;
end;
end;
AServiceList.Clear;
for nI := 0 to dwNumOfService - 1 do
begin
AServiceList.Add(TEnumServiceStatus(PEnumServiceStatus(PChar(pEnumStatus)
+ nI * SizeOf(TEnumServiceStatus))^).lpServiceName);
end;
CloseServiceHandle(hSCM);
Result := True;
finally
if Assigned(pEnumStatus) then
FreeMem(pEnumStatus);
end;
end;
function TNTServiceControl.GetDependencies(AList: TStrings): boolean;
begin
Result := GetServiceDependencies(FMachineName, FServiceName, AList);
end;
function TNTServiceControl.IsInstalled: boolean;
var
hSCM: THandle;
schs: THandle;
begin
hSCM := OpenSCManager(PChar(FMachineName), nil, SC_MANAGER_CONNECT);
Result := False;
if hSCM <> 0 then
begin
schs := OpenService(hSCM, PChar(FServiceName), SERVICE_QUERY_CONFIG);
if schs <> 0 then
begin
Result := True;
CloseServiceHandle(schs);
end;
CloseServiceHandle(hSCM);
end;
end;
function TNTServiceControl.IsRunning: boolean;
begin
case GetServiceStatus of
svStopped:
Result := False;
svRunning:
Result := True;
svPaused:
Result := True;
svStartPending:
Result := True;
svStopPending:
Result := True;
svContinuePending:
Result := True;
svPausePending:
Result := True;
else
Result := False;
end;
end;
function TNTServiceControl.Install(ADisplayName: string; AFileName: TFileName;
AServiceStartName: string = ''; AServicePassword: string = '';
AInteractiveService: boolean = False): boolean;
var
schm: SC_Handle;
schs: SC_Handle;
ServiceType: Cardinal;
ServiceStartName: PChar;
ServicePassword: PChar;
begin
Result := False;
schm := OpenSCManager(PChar(FMachineName), nil, SC_MANAGER_ALL_ACCESS);
if (schm > 0) then
begin
try
ServiceStartName := nil;
ServicePassword := nil;
if AInteractiveService then
begin
ServiceType := SERVICE_WIN32_OWN_PROCESS + SERVICE_INTERACTIVE_PROCESS;
end
else
begin
ServiceType := SERVICE_WIN32_OWN_PROCESS;
if Trim(AServiceStartName) <> '' then
begin
ServiceStartName := PChar(AServiceStartName);
ServicePassword := PChar(AServicePassword);
end
else
begin
end;
end;
schs := CreateService(schm, PChar(FServiceName), PChar(ADisplayName),
SERVICE_ALL_ACCESS, ServiceType, SERVICE_AUTO_START,
SERVICE_ERROR_NORMAL, PChar(AFileName), '', nil, '', ServiceStartName,
ServicePassword);
if (schs = 0) then
begin
RaiseLastOsError;
end
else
begin
Result := True;
end;
if schs <> 0 then
CloseServiceHandle(schs);
finally
CloseServiceHandle(schm);
end;
end;
end;
function TNTServiceControl.Uninstall: boolean;
var
SCMHandle: longword;
ServiceHandle: longword;
begin
Result := False;
SCMHandle := OpenSCManager(PChar(FMachineName), nil, SC_MANAGER_ALL_ACCESS);
if SCMHandle <> 0 then
begin
try
ServiceHandle := OpenService(SCMHandle, PChar(FServiceName),
SERVICE_ALL_ACCESS);
if ServiceHandle <> 0 then
begin
try
if DeleteService(ServiceHandle) then
begin
Result := True;
end
else
begin
RaiseLastOsError;
end;
finally
if ServiceHandle <> 0 then
CloseServiceHandle(ServiceHandle);
end;
end;
finally
if SCMHandle <> 0 then
CloseServiceHandle(SCMHandle);
end;
end;
end;
end.
| 29.307692 | 79 | 0.640795 |
474afbfe2712707e789bed93fcdba539a2d51855 | 391 | dpr | Pascal | 01-LifeCycle-Windows-macOS-Linux/Project1.dpr | DeveloppeurPascal/SauvegarderEtRestaurerLEtatDesApplicationsMobiles | 425d3597365854838d1c3759ac440ead74512827 | [
"MIT"
]
| 1 | 2021-06-23T13:51:56.000Z | 2021-06-23T13:51:56.000Z | 04-LifeCycle-FMX/Project1.dpr | DeveloppeurPascal/SauvegarderEtRestaurerLEtatDesApplicationsMobiles | 425d3597365854838d1c3759ac440ead74512827 | [
"MIT"
]
| null | null | null | 04-LifeCycle-FMX/Project1.dpr | DeveloppeurPascal/SauvegarderEtRestaurerLEtatDesApplicationsMobiles | 425d3597365854838d1c3759ac440ead74512827 | [
"MIT"
]
| 1 | 2021-04-05T03:00:11.000Z | 2021-04-05T03:00:11.000Z | program Project1;
uses
System.StartUpCopy,
FMX.Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2},
fLog in 'fLog.pas' {frmLog},
Unit3 in 'Unit3.pas';
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.CreateForm(TfrmLog, frmLog);
Application.Run;
end.
| 19.55 | 43 | 0.672634 |
470e6b71628ed5c2854c67e3912a851494100a64 | 3,606 | pas | Pascal | utils.pas | vhanla/MonitorSettings | b5baea7d9ef7f2701e05855c441ea261e45da516 | [
"MIT"
]
| 13 | 2020-06-05T06:13:46.000Z | 2021-07-16T00:29:56.000Z | utils.pas | vhanla/MonitorSettings | b5baea7d9ef7f2701e05855c441ea261e45da516 | [
"MIT"
]
| null | null | null | utils.pas | vhanla/MonitorSettings | b5baea7d9ef7f2701e05855c441ea261e45da516 | [
"MIT"
]
| 4 | 2020-06-05T06:13:47.000Z | 2022-01-21T15:42:32.000Z | unit utils;
interface
uses
Windows, Forms, Classes, TLHelp32, PsAPI, SysUtils, Registry, Graphics, DWMAPI,
OleAcc, Variants, DirectDraw, ActiveX, ShellAPI;
function IsDirectXAppRunningFullScreen: Boolean;
function DetectFullScreen3D: Boolean;
function DetectFullScreenApp(AHandle: HWND = 0): Boolean;
function IsDesktopWindow(AHandle: HWND): Boolean;
implementation
function GetShellWindow:HWND;stdcall;
external user32 Name 'GetShellWindow';
function IsDirectXAppRunningFullScreen: Boolean;
var
LSPI: Boolean;
begin
Result := False;
if SystemParametersInfo(SPI_GETCURSORSHADOW, 0, @LSPI, 0) and not LSPI then
begin
if SystemParametersInfo(SPI_GETHOTTRACKING, 0, @LSPI, 0) and not LSPI then
begin
Result := DetectFullScreen3D;
end;
end;
end;
function DetectFullScreen3D: Boolean;
var
DW: IDirectDraw7;
HR: HRESULT;
begin
Result := False;
HR := coinitialize(nil);
if Succeeded(HR) then
begin
HR := DirectDrawCreateEx(PGUID(DDCREATE_EMULATIONONLY), DW, IDirectDraw7, nil);
if HR = DD_OK then
begin
HR := DW.TestCooperativeLevel;
if HR = DDERR_EXCLUSIVEMODEALREADYSET then
Result := True;
end;
end;
CoUninitialize;
end;
function DetectFullScreenApp(AHandle: HWND = 0): Boolean;
var
curwnd: HWND;
wndPlm: WINDOWPLACEMENT;
R: TRect;
Mon: TMonitor;
begin
Result := False;
if AHandle = 0 then
curwnd := GetForegroundWindow
else
curwnd := AHandle;
if curwnd <= 0 then Exit;
// ignore maximized windows with caption bar
if GetWindowLong(curwnd, GWL_STYLE) and WS_CAPTION = WS_CAPTION then
Exit;
if not IsWindow(curwnd) then Exit;
if IsDesktopWindow(curwnd) then Exit;
Mon := Screen.MonitorFromWindow(curwnd);
GetWindowRect(curwnd, R);
GetWindowPlacement(curwnd, wndPlm);
if (wndPlm.showCmd and SW_SHOWMAXIMIZED) = SW_SHOWMAXIMIZED then
begin
if (Mon.BoundsRect.Width = R.Width) and (Mon.BoundsRect.Height = R.Height) then
Result := True;
end
else
begin
// some applications do not set SW_SHOWMAXIMIZED flag e.g. MPC-HC media player
// ignore maximized when workarearect is similar (i.e. taskbar is on top, might not be the same on secondary monitor)
// if IsTaskbarAlwaysOnTop then
// begin
// if (Screen.MonitorCount > 1) and (Mon.Handle =
// if ((Screen.MonitorCount > 1) and (FindWindow('Shell_SecondaryTrayWnd', nil)<>0) and (Mon.WorkareaRect <> Mon.BoundsRect))
// // if there is another monitor without taskbar then
// or ((Screen.MonitorCount > 1) and (FindWindow('Shell_SecondaryTrayWnd', nil)=0) and (Mon.WorkareaRect = Mon.BoundsRect))
// then
begin
if (Mon.BoundsRect.Width = R.Width) and (Mon.BoundsRect.Height = R.Height) then
Result := True;
// end;
end;
end;
end;
// detect desktop is present
// those are different on specific conditions, like slideshow, win10 special features, and maybe third party tools installed for desktop handling
function IsDesktopWindow(AHandle: HWND): Boolean;
var
AppClassName: array[0..255] of char;
ChildHwnd: HWND;
begin
Result := False;
if AHandle = GetDesktopWindow then Result := True
else if AHandle = GetShellWindow then Result := True
else
begin
GetClassName(AHandle, AppClassName, 255);
if AppClassName = 'WorkerW' then
begin
// it should have a children with 'SHELLDLL_DefView' present
ChildHwnd := FindWindowEx(AHandle, 0, 'SHELLDLL_DefView', nil);
if ChildHwnd <> 0 then
begin
//if DetectFullScreenApp(AHandle) then
Result := True;
end;
end;
end;
end;
end.
| 27.738462 | 145 | 0.708819 |
f1c943fe9f5a7c2017300d327a1fcce40b98bbb2 | 14,932 | pas | Pascal | Chapter 7/OmniThreadLibrary/tests/33_BlockingCollection/test_33_BlockingCollection.pas | PacktPublishing/Delphi-High-Performance | bcb84190e8660a28cbc0caada2e1bed3b8adfe42 | [
"MIT"
]
| 45 | 2018-04-08T07:01:13.000Z | 2022-02-18T17:28:10.000Z | Chapter 7/OmniThreadLibrary/tests/33_BlockingCollection/test_33_BlockingCollection.pas | anomous/Delphi-High-Performance | 051a8f7d7460345b60cb8d2a10a974ea8179ea41 | [
"MIT"
]
| null | null | null | Chapter 7/OmniThreadLibrary/tests/33_BlockingCollection/test_33_BlockingCollection.pas | anomous/Delphi-High-Performance | 051a8f7d7460345b60cb8d2a10a974ea8179ea41 | [
"MIT"
]
| 17 | 2018-03-21T11:22:15.000Z | 2022-03-16T05:55:54.000Z | unit test_33_BlockingCollection;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Contnrs, Spin,
DSiWin32,
GpLists,
GpStuff,
OtlCommon,
OtlComm,
OtlTask,
OtlTaskControl,
OtlContainers,
OtlCollections,
OtlEventMonitor;
const
MSG_ERR = WM_USER + 1;
type
TfrmTestOmniBlockingCollection = class(TForm)
btn1to1 : TButton;
btn1to7 : TButton;
btn2to2 : TButton;
btn3to3 : TButton;
btn4to4 : TButton;
btn7to1 : TButton;
btn8to8 : TButton;
btnTest : TButton;
btnTestIntf : TButton;
cbRepeat : TCheckBox;
inpNumCPU : TSpinEdit;
lblNumCPU : TLabel;
lbLog : TListBox;
rgCollectionType: TRadioGroup;
cbTestFinalized: TCheckBox;
btnRaiseExceptions: TButton;
OtlMonitor: TOmniEventMonitor;
procedure FormCreate(Sender: TObject);
procedure btn1to7Click(Sender: TObject);
procedure btn7to1Click(Sender: TObject);
procedure btnRaiseExceptionsClick(Sender: TObject);
procedure btnTestClick(Sender: TObject);
procedure btnTestIntfClick(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure inpNumCPUChange(Sender: TObject);
procedure OtlMonitorTaskMessage(const task: IOmniTaskControl; const msg: TOmniMessage);
procedure OtlMonitorTaskTerminated(const task: IOmniTaskControl);
procedure StartTest(Sender: TObject);
private
FChanCollection: TOmniBlockingCollection;
FDstCollection : TOmniBlockingCollection;
FForwarders : array of IOmniTaskControl;
FNumWorkers : TOmniAlignedInt32;
FReaders : array of IOmniTaskControl;
FSrcCollection : TOmniBlockingCollection;
FStartTime : int64;
procedure CheckResult;
procedure Log(const msg: string); overload;
procedure Log(const msg: string; const params: array of const); overload;
procedure PrepareForwarders(numForwarders: integer);
procedure PrepareReaders(numReaders: integer);
procedure PrepareTest(numForwarders, numReaders: integer);
procedure StopForwarders;
procedure StopReaders;
procedure StopWorkers;
function UseTryTake: boolean;
procedure WMRestartTest(var msg: TMessage); message WM_USER;
end; { TfrmTestOtlCollections }
var
frmTestOmniBlockingCollection: TfrmTestOmniBlockingCollection;
implementation
const
CCountThreadedTest = 1000000;
CCountSingleTest = 100000;
var
GForwardersCount: TOmniAlignedInt32;
GReadersCount : TOmniAlignedInt32;
GStopForwarders : boolean;
GStopReaders : boolean;
{$R *.dfm}
procedure ForwarderWorker(const task: IOmniTask);
var
chanColl : TOmniBlockingCollection;
isFinalized : boolean;
srcColl : TOmniBlockingCollection;
testIsFinalized: boolean;
useTryTake : boolean;
value : TOmniValue;
function MyTake: boolean;
begin
repeat
if srcColl.TryTake(value) then begin
Result := true;
Exit;
end
else if srcColl.IsCompleted then begin
Result := false;
Exit;
end
else
DSiYield;
until false;
end; { MyTake }
begin
value := task.Param['Source']; srcColl := TOmniBlockingCollection(value.AsObject);
value := task.Param['Channel']; chanColl := TOmniBlockingCollection(value.AsObject);
useTryTake := task.Param['UseTryTake'];
testIsFinalized := task.Param['TestIsFinalized'];
isFinalized := true;
repeat
if testIsFinalized then
isFinalized := srcColl.IsFinalized;
if useTryTake then begin
if not MyTake then
break //repeat
end
else if not srcColl.Take(value) then
break; //repeat
if testIsFinalized and isFinalized then
task.Comm.Send(MSG_ERR, Format('Forwarder: Queue was empty before reading element %d', [value.AsInteger]));
chanColl.Add(value);
if GForwardersCount.Increment = CCountThreadedTest then begin
GStopForwarders := true;
chanColl.CompleteAdding;
break; //repeat
end;
until false;
if testIsFinalized and (not srcColl.IsFinalized) then
task.Comm.Send(MSG_ERR, 'Forwarder: Queue was not empty at the end');
end; { ForwarderWorker }
procedure ReaderWorker(const task: IOmniTask);
var
chanColl : TOmniBlockingCollection;
dstColl : TOmniBlockingCollection;
isFinalized : boolean;
testIsFinalized: boolean;
useTryTake : boolean;
value : TOmniValue;
function MyTake: boolean;
begin
repeat
if chanColl.TryTake(value) then begin
Result := true;
Exit;
end
else if chanColl.IsCompleted then begin
Result := false;
Exit;
end
else
DSiYield;
until false;
end; { MyTake }
begin
value := task.Param['Channel']; chanColl := TOmniBlockingCollection(value.AsObject);
value := task.Param['Destination']; dstColl := TOmniBlockingCollection(value.AsObject);
useTryTake := task.Param['UseTryTake'];
testIsFinalized := task.Param['TestIsFinalized'];
isFinalized := true;
repeat
if testIsFinalized then
chanColl.IsFinalized; // can be anythings
if useTryTake then begin
if not MyTake then
break; //repeat
end
else if not chanColl.Take(value) then
break; //repeat
dstColl.Add(value);
if GReadersCount.Increment = CCountThreadedTest then begin
GStopReaders := true;
dstColl.CompleteAdding;
break; //while
end;
until false;
if testIsFinalized and (not chanColl.IsFinalized) then
task.Comm.Send(MSG_ERR, 'Reader: Queue was not empty at the end');
end; { ReaderWorker }
{ TfrmTestOtlCollections }
procedure TfrmTestOmniBlockingCollection.FormCreate(Sender: TObject);
begin
inpNumCPU.MaxValue := Environment.Process.Affinity.Count;
inpNumCPU.Value := inpNumCPU.MaxValue;
end; { TfrmTestOmniBlockingCollection.FormCreate }
procedure TfrmTestOmniBlockingCollection.btn1to7Click(Sender: TObject);
begin
PrepareTest(1, 7);
end; { TfrmTestOtlCollections.btn1to7Click }
procedure TfrmTestOmniBlockingCollection.btn7to1Click(Sender: TObject);
begin
PrepareTest(7, 1);
end; { TfrmTestOtlCollections.btn7to1Click }
procedure TfrmTestOmniBlockingCollection.btnRaiseExceptionsClick(Sender: TObject);
var
coll : IOmniBlockingCollection;
value: TOmniValue;
begin
coll := TOmniBlockingCollection.Create;
coll.Add(Exception.Create('test exception'));
//no exception in next line
coll.Take(value);
Assert(value.IsException);
value.AsException.Free;
coll.Add(Exception.Create('test exception'));
coll.ReraiseExceptions;
//exception is raised in next line
try
coll.Take(value);
except
on E: Exception do
Log(E.Message);
end;
end; { TfrmTestOmniBlockingCollection.btnRaiseExceptionsClick }
procedure TfrmTestOmniBlockingCollection.btnTestClick(Sender: TObject);
var
coll : TOmniBlockingCollection;
i : integer;
loop : integer;
qi : TOmniValue;
time : int64;
value: TOmniValue;
begin
time := DSiTimeGetTime64;
for loop := 1 to 10 do begin
coll := TOmniBlockingCollection.Create;
try
for i := 1 to CCountSingleTest do
coll.Add(i);
coll.CompleteAdding;
for i := 1 to CCountSingleTest do begin
if not coll.Take(qi) then
raise Exception.CreateFmt('Take failed at element %d', [i]);
if qi.AsInteger <> i then
raise Exception.CreateFmt('Expected %d', [i]);
end;
if coll.TryTake(value) then
raise Exception.Create('Collection is not empty at the end');
finally FreeAndNil(coll); end;
end;
time := DSiTimeGetTime64 - time;
Log('TOmniBlockingCollection, 10x (%d enqueues and %0:d dequeues), %d ms', [CCountSingleTest, time]);
end; { TfrmTestOtlCollections.btnTestClick }
procedure TfrmTestOmniBlockingCollection.btnTestIntfClick(Sender: TObject);
var
coll : TOmniBlockingCollection;
i : integer;
loop : integer;
qi : TOmniValue;
time : int64;
value: TOmniValue;
begin
time := DSiTimeGetTime64;
for loop := 1 to 10 do begin
coll := TOmniBlockingCollection.Create;
try
for i := 1 to CCountSingleTest do
coll.Add(CreateCounter(i));
coll.CompleteAdding;
for i := 1 to CCountSingleTest do begin
if not coll.Take(qi) then
raise Exception.CreateFmt('Take failed at element %d', [i]);
if (qi.AsInterface as IOmniCounter).Value <> i then
raise Exception.CreateFmt('Expected %d', [i]);
end;
if coll.TryTake(value) then
raise Exception.Create('Collection is not empty at the end');
finally FreeAndNil(coll); end;
end; //for loop
time := DSiTimeGetTime64 - time;
Log('TOmniBlockingCollection, 10x (%d enqueues and %0:d dequeues), %d ms', [CCountSingleTest, time]);
end; { TfrmTestOtlCollections.btnTestIntfClick }
procedure TfrmTestOmniBlockingCollection.CheckResult;
var
i: integer;
testList: TGpIntegerList;
value: TOmniValue;
begin
try
testList := TGpIntegerList.Create;
try
Assert(not FDstCollection.IsFinalized);
while FDstCollection.Take(value) do
testList.Add(value.AsInteger);
Assert(FDstCollection.IsFinalized);
testList.Sorted := true;
if testList.Count <> CCountThreadedTest then
raise Exception.CreateFmt('Expected %d items, got %d', [CCountThreadedTest, testList.Count]);
for i := 1 to CCountThreadedTest do
if testList[i-1] <> i then
raise Exception.CreateFmt('Got value %d at position %d', [testList[i], i-1]);
finally FreeAndNil(testList); end;
finally StopWorkers; end;
end; { TfrmTestOtlCollections.CheckResult }
procedure TfrmTestOmniBlockingCollection.FormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
StopWorkers;
end; { TfrmTestOtlCollections.FormCloseQuery }
procedure TfrmTestOmniBlockingCollection.inpNumCPUChange(Sender: TObject);
begin
Environment.Process.Affinity.Count := inpNumCPU.Value;
end; { TfrmTestOmniBlockingCollection.inpNumCPUChange }
procedure TfrmTestOmniBlockingCollection.Log(const msg: string);
begin
lbLog.ItemIndex := lbLog.Items.Add(FormatDateTime('[hh:nn:ss] ', Now) + msg);
end; { TfrmTestOtlCollections.Log }
procedure TfrmTestOmniBlockingCollection.Log(const msg: string; const params: array of const);
begin
Log(Format(msg, params));
end; { TfrmTestOtlCollections.Log }
procedure TfrmTestOmniBlockingCollection.OtlMonitorTaskMessage(const task:
IOmniTaskControl; const msg: TOmniMessage);
begin
if msg.MsgID = MSG_ERR then
Log(msg.MsgData);
end; { TfrmTestOmniBlockingCollection.OtlMonitorTaskMessage }
procedure TfrmTestOmniBlockingCollection.OtlMonitorTaskTerminated(const task: IOmniTaskControl);
var
time: int64;
begin
if FNumWorkers.Decrement = 0 then begin
time := DSiTimeGetTime64 - FStartTime;
Log('All worker threads terminated, execution time = %d', [time]);
CheckResult;
if cbRepeat.Checked then
PostMessage(Handle, WM_USER, 0, 0);
end;
end; { TfrmTestOtlCollections.OtlMonitorTaskTerminated }
procedure TfrmTestOmniBlockingCollection.PrepareForwarders(numForwarders: integer);
var
iForwarder: integer;
begin
SetLength(FForwarders, numForwarders);
for iForwarder := Low(FForwarders) to High(FForwarders) do begin
FForwarders[iForwarder] :=
CreateTask(ForwarderWorker, Format('Forwarder %d', [iForwarder]))
.SetParameter('Source', FSrcCollection)
.SetParameter('Channel', FChanCollection)
.SetParameter('UseTryTake', UseTryTake)
.SetParameter('TestIsFinalized', cbTestFinalized.Checked)
.MonitorWith(OtlMonitor)
.Run;
end;
end; { TfrmTestOtlCollections.PrepareForwarders }
procedure TfrmTestOmniBlockingCollection.PrepareReaders(numReaders: integer);
var
iReader: integer;
begin
SetLength(FReaders, numReaders);
for iReader := Low(FReaders) to High(FReaders) do begin
FReaders[iReader] :=
CreateTask(ReaderWorker, Format('Reader %d', [iReader]))
.SetParameter('Channel', FChanCollection)
.SetParameter('Destination', FDstCollection)
.SetParameter('UseTryTake', UseTryTake)
.SetParameter('TestIsFinalized', cbTestFinalized.Checked)
.MonitorWith(OtlMonitor)
.Run;
end;
end; { TfrmTestOtlCollections.PrepareReaders }
procedure TfrmTestOmniBlockingCollection.PrepareTest(numForwarders, numReaders: integer);
var
i: integer;
begin
StopForwarders;
StopReaders;
GStopForwarders := false;
GStopReaders := false;
GForwardersCount.Value := 0;
GReadersCount.Value := 0;
Log('%d -> %d', [numForwarders, numReaders]);
FSrcCollection := TOmniBlockingCollection.Create;
FDstCollection := TOmniBlockingCollection.Create;
FChanCollection := TOmniBlockingCollection.Create;
FNumWorkers.Value := numForwarders + numReaders;
Assert(not FSrcCollection.IsCompleted);
Assert(not FSrcCollection.IsFinalized);
for i := 1 to CCountThreadedTest do
FSrcCollection.Add(i);
Assert(not FSrcCollection.IsCompleted);
Assert(not FSrcCollection.IsFinalized);
FSrcCollection.CompleteAdding;
Assert(FSrcCollection.IsCompleted);
Assert(not FSrcCollection.IsFinalized);
FStartTime := DSiTimeGetTime64;
PrepareReaders(numReaders);
PrepareForwarders(numForwarders);
end; { TfrmTestOtlCollections.PrepareTest }
procedure TfrmTestOmniBlockingCollection.StartTest(Sender: TObject);
begin
PrepareTest(TButton(Sender).Tag, TButton(Sender).Tag);
end; { TfrmTestOtlCollections.StartTest }
procedure TfrmTestOmniBlockingCollection.StopForwarders;
var
iForwarder: integer;
begin
for iForwarder := Low(FForwarders) to High(FForwarders) do
if assigned(FForwarders[iForwarder]) then begin
FForwarders[iForwarder].Terminate;
FForwarders[iForwarder] := nil;
end;
SetLength(FForwarders, 0);
end; { TfrmTestOtlCollections.StopForwarders }
procedure TfrmTestOmniBlockingCollection.StopReaders;
var
iReader: integer;
begin
for iReader := Low(FReaders) to High(FReaders) do
if assigned(FReaders[iReader]) then begin
FReaders[iReader].Terminate;
FReaders[iReader] := nil;
end;
SetLength(FReaders, 0);
end; { TfrmTestOtlCollections.StopReaders }
procedure TfrmTestOmniBlockingCollection.StopWorkers;
begin
StopForwarders;
StopReaders;
FreeAndNil(FSrcCollection);
FreeAndNil(FDstCollection);
FreeAndNil(FChanCollection);
end; { TfrmTestOtlCollections.StopWorkers }
function TfrmTestOmniBlockingCollection.UseTryTake: boolean;
begin
if rgCollectionType.ItemIndex = 0 then
Result := false
else if rgCollectionType.ItemIndex = 1 then
Result := true
else
Result := Random(2) = 1;
end; { TfrmTestOmniBlockingCollection.UseTryTake }
procedure TfrmTestOmniBlockingCollection.WMRestartTest(var msg: TMessage);
begin
PrepareTest(Random(8)+1, Random(8)+1);
end; { TfrmTestOtlCollections.WMRestartTest }
end.
| 31.50211 | 113 | 0.723078 |
474245ea1b2cb10fba39b6993dad076449e32b09 | 2,296 | pas | Pascal | Program/UtilsImpl/unit_ExportToDevice.pas | aleXela17/MyHomeLib | 7c1c7596b2bd1f1186aae4b213de27b7fc440b33 | [
"MIT"
]
| 80 | 2019-05-08T15:26:06.000Z | 2022-03-18T17:53:13.000Z | Program/UtilsImpl/unit_ExportToDevice.pas | alex80/MyHomeLib | 00b22041449ee243759e76f6130839bc9cd74953 | [
"MIT"
]
| 7 | 2019-07-17T07:26:13.000Z | 2021-09-01T19:00:19.000Z | Program/UtilsImpl/unit_ExportToDevice.pas | alex80/MyHomeLib | 00b22041449ee243759e76f6130839bc9cd74953 | [
"MIT"
]
| 40 | 2019-06-02T10:23:13.000Z | 2022-03-29T08:58:46.000Z | (* *****************************************************************************
*
* MyHomeLib
*
* Copyright (C) 2008-2019 Oleksiy Penkov (aka Koreec)
*
* Authors Aleksey Penkov alex.penkov@gmail.com
* Nick Rymanov nrymanov@gmail.com
*
****************************************************************************** *)
unit unit_ExportToDevice;
interface
uses
Controls,
Forms,
Dialogs,
Windows,
unit_Globals;
procedure ExportToDevice(
const DeviceDir: string;
const IdList: TBookIdList;
const Mode: TExportMode;
const ExtractOnly: Boolean;
out ProcessedFiles:string
);
procedure DownloadBooks(const IdList: TBookIdList);
implementation
uses
unit_ExportToDeviceThread,
frm_ExportToDeviceProgressForm,
unit_DownloadBooksThread,
frm_DownloadProgressForm;
resourcestring
rstrSendToDevice = 'Отправка на устройство';
rstrDownloadingBooks = 'Скачивание книг';
procedure ExportToDevice(
const DeviceDir: string;
const IdList: TBookIdList;
const Mode: TExportMode;
const ExtractOnly: Boolean;
out ProcessedFiles: string
);
var
worker: TExportToDeviceThread;
frmProgress: TExportToDeviceProgressForm;
begin
worker := TExportToDeviceThread.Create;
try
worker.DeviceDir := DeviceDir;
worker.BookIdList := IdList;
worker.ExportMode := Mode;
worker.ExtractOnly := ExtractOnly;
frmProgress := TExportToDeviceProgressForm.Create(Application);
try
frmProgress.Caption := rstrSendToDevice;
frmProgress.WorkerThread := worker;
frmProgress.ShowModal;
ProcessedFiles := worker.ProcessedFiles;
finally
frmProgress.Free;
end;
finally
worker.Free;
end;
end;
procedure DownloadBooks(const IdList: TBookIdList);
var
worker: TDownloadBooksThread;
frmProgress: TDownloadProgressForm;
begin
worker := TDownloadBooksThread.Create;
try
worker.BookIdList := IdList;
frmProgress := TDownloadProgressForm.Create(Application);
try
frmProgress.Caption := rstrDownloadingBooks;
frmProgress.WorkerThread := worker;
frmProgress.ShowModal;
finally
frmProgress.Free;
end;
finally
worker.Free;
end;
end;
end.
| 22.96 | 84 | 0.645906 |
4785bfbaefa39d3f096a4e8a1b8dfdeea47972c5 | 31,279 | dfm | Pascal | Cj_Fast_Panel/fpu.dfm | delphi-pascal-archive/cj-fast-panel | 9848f598c0dc8cb02f8ff392a5064eac256e6164 | [
"Unlicense"
]
| null | null | null | Cj_Fast_Panel/fpu.dfm | delphi-pascal-archive/cj-fast-panel | 9848f598c0dc8cb02f8ff392a5064eac256e6164 | [
"Unlicense"
]
| null | null | null | Cj_Fast_Panel/fpu.dfm | delphi-pascal-archive/cj-fast-panel | 9848f598c0dc8cb02f8ff392a5064eac256e6164 | [
"Unlicense"
]
| null | null | null | object Form1: TForm1
Left = 231
Top = 128
BorderStyle = bsNone
Caption = 'Cj Fast Panel'
ClientHeight = 496
ClientWidth = 450
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -14
Font.Name = 'MS Sans Serif'
Font.Style = []
FormStyle = fsStayOnTop
OldCreateOrder = False
OnActivate = FormActivate
OnCloseQuery = FormCloseQuery
PixelsPerInch = 120
TextHeight = 16
object ScrollBox1: TScrollBox
Left = 0
Top = 0
Width = 450
Height = 496
VertScrollBar.Tracking = True
Align = alClient
TabOrder = 0
object Image1: TImage
Left = 295
Top = 286
Width = 32
Height = 32
AutoSize = True
Picture.Data = {
07544269746D6170360C0000424D360C00000000000036000000280000002000
0000200000000100180000000000000C0000130B0000130B0000000000000000
0000FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FDFD01F4F401FAFA01FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00F9F901EDED01D0D001AFAF01C4C401E5E501F6F601FFFF
01FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF01F6F601E4E401BABA017C7C0748481A46460D565601727201A8A801D8D8
01F0F001FAFA01FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FDFD01F0F001
D9D901A8A801606012535339888888A69F9F8E7A7A544E463D3D174C4C046060
018F8F01C1C101E5E501F4F401FDFD01FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00F7F701EBEB01CDCD018E8E05
54541B67675D959595DCDCDCD7D7D7ACA3A37B6C6C544C4C7E6D6D695D5D4442
2A45450E565601717101A0A001D0D001EDED01F9F901FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF01F4F401E2E201B2B2017878095757357D7D78
C9C9C9DADADA474747BDBDBD818181786F6F6D63633434343434343434347666
666D60606F625A3B3B1A4A4A085D5D01878701BABA01E4E401F4F401FDFD01FF
FF00FFFF00FFFF01F0F001D6D601A2A20163631D5F5F4AA5A5A5D3D3D3D9D9D9
D3D3D39A9A9A6262626D6D6D929292A19B9B635C5C4B4B4B6464647070706A6A
6A6C6C6C6967678A7D7D6E6060514A36424211545401717101A0A001D0D001F4
F401FFFF01E1E10190900759592A7D7D73B9B9B9DCDCDCD7D7D7BABABA7D7D7D
656565909090B2B2B2B4B4B4AFAFAF8D8B8B5653534B4B4B6464647070707777
777F7F7F8787877E7E7E4D4D4D7F6F6F83707075665E4845244A4A08656501AF
AF01EDED078383419A9A9ACCCCCCDBDBDBC6C6C69B9B9B6F6F6F808080AFAFAF
B9B9B9B2B2B2ACACACA7A7A7B4B4B4A3A3A35858584A4A4A6464647070707777
777F7F7F878787787878343434343434474141BE9D9DEABDBDB1929244441597
9701B2B22AC7C7C7909090AFAFAF8181817979799E9E9EBCBCBCB6B6B6B0B0B0
AAAAAAB0B0B0D3D3D3EAEAEAD8D8D8848484CDCDCDABABAB8282826161616565
657B7B7B878787787878343434343434343434AB9090E0B7B7EBBFBF40401A94
9401AAAA319696967D7D7D979797B9B9B9BABABAB4B4B4AFAFAFB2B2B2C6C6C6
E2E2E2EAEAEAE3E3E3DEDEDEDCDCDCDADADAD8D8D8D6D6D6D5D5D5D3D3D3B4B4
B48D8B8B6D6C6C6564644D4D4D3B3A3A3434349A8585C7A7A7D5B0B040401A94
9401ABAB32B2B2B2BEBEBEBABABAB2B2B2B1B1B1C2C2C2DBDBDBEDEDEDEBEBEB
E7E7E7E0E0E0D0D0D0C9C9C9C7C7C7CECECECACACABFBFBFB8B8B8BCBCBCBDBD
BDACACACC0BABAB6ADAD8C8787797272695B5B877979AF9797BB9F9F40401A97
9701ACAC33B7B7B7B1B1B1C1C1C1D2D2D2E0E0E0DEDEDEE3E3E3E2E2E2D8D8D8
CFCFCFD3D3D3E5E5E5F1F1F1F9F9F9FFFFFFF6F6F6EEEEEEE6E6E6DDDDDDE8E8
E8F3F3F3F8F8F8E7E0E0E1CCCCE5C8C8BAB6B6AEA8A8988C8CA48F8F50501AB1
B101B3B334CBCBCBE2E2E2E0E0E0E7E7E7D6D6D6A3A3A3CFCFCFEAEAEAE8E8E8
DDDDDDE3E3E3EBEBEBF1F1F1F9F9F9FFFFFFF6F6F6EEEEEEE6E6E6DDDDDDE8E8
E8F3F3F3FDFDFDF5F5F5E8E8E8E9D4D4DDD0D08787879A9A9A89897DA2A214F7
F701F6F607C6C647BBBB8DC5C5C5F5F5F5A6A6A67474744141414C4C4C787878
A8A8A8D8D8D8EBEBEBF1F1F1F9F9F9FFFFFFF6F6F6EEEEEEE6E6E6DDDDDDE8E8
E8F3F3F3FDFDFDF5F5F5E7E7E7B4ACAC999971A1A13BC3C30EFAFA01FFFF00FF
FF00FFFF00FFFF00FFFF00F6F607CECE20B7B75AB7B799D6D6D6C5C5C58E8E8E
A8A8A8D8D8D8EBEBEBF1F1F1F9F9F9FFFFFFF6F6F6EEEEEEE6E6E6DDDDDDE8E8
E8DBDBDBBEBEB1B5B55FB7B721DFDF08FDFD01FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00ECEC0DB6B629B1B164
B2B2A3CDCDCDECECECF1F1F1F9F9F9FFFFFFF6F6F6E4E4E4B4B4B4A3A37AABAB
36D2D20DFCFC01FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00E0E011B3B336B8B87BBABABABBBBADB3B35BB3B31DECEC05FFFF01FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00}
Transparent = True
Visible = False
end
object Image2: TImage
Left = 335
Top = 286
Width = 32
Height = 32
AutoSize = True
Picture.Data = {
07544269746D6170360C0000424D360C00000000000036000000280000002000
0000200000000100180000000000000C0000130B0000130B0000000000000000
0000FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00F7F701E5E501C1C101B5B501E1E101F3F301FDFD
01FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF01F4F401E1E101AFAF0164640E494914515101696901999901CFCF
01EBEB01F9F901FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FCFC01
F0F001D6D601A0A00158581637372D9D9D9D8E7F7F5E55513A3A1D4949085C5C
01818101B8B801E4E401F4F401FDFD01FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00F9F901EAEA01C7C701
8B8B054E4E1F797974B4B4B47D7D7DD5D5D55F5656857E7E8575757E6D6D4E48
38414111545401717101A0A001D0D001EEEE01FAFA01FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF01F7F701E4E401B8B80176760E565634
848484C9C9C98787878383835A5A5AC8C8C86C6262A3A3A3ABABAB8A8A8A9D8E
8E816F6F6F625A3B3B1A4A4A085F5F018F8F01C1C101E5E501F7F701FFFF01FF
FF00FFFF00FFFF00FFFF01F3F301DBDB01AEAE016868195F5F4AA4A4A4D3D3D3
D8D8D8D3D3D3C3C3C3BDBDBD575757BBBBBB665F5FC7C7C7CDCDCDB6B6B6B3B3
B3A9A9A99A94948C7C7C7A6969514C3445450E565601747401AEAE01DBDB01F6
F601FFFF00FFFF01E2E2019B9B06616120737369B0B0B0DCDCDCD7D7D7D1D1D1
CCCCCCC5C5C5BFBFBFBABABA545454ADADAD7872727971717E7878A6A3A3D1D1
D1D5D5D5BFBFBFC2C2C2A4A4A4A99B9B7D6B6B74655D3E3E145050056C6C01BA
BA01FFFF00EBEB078B8B368A8A84CCCCCCDBDBDBD7D7D7D0D0D0CACACAC4C4C4
BEBEBEB8B8B8B1B1B1ACACAC515151BFBFBF6969696D6B6B7A7474857C7C867A
7A817B7BB3B0B0D1D1D1DBDBDBCFCFCFC8C8C8A7A4A4938383826E6A444414A3
A301FFFF00A9A930B5B5B59B9B9BD5D5D5CFCFCFC9C9C9C4C4C4BCBCBCB6B6B6
B0B0B0AAAAAAB0B0B0D4D4D4C5C5C5949494B6B6B6ABABAB8C8C8C7370707B74
74887E7E9485858B7D7D958B8BC1BFBFE0E0E0E1E1E1DADADA8D828240401AA0
A001FFFF00AAAA31D3D3D3C3C3C3C7C7C7C2C2C2BBBBBBB5B5B5B0B0B0ADADAD
C6C6C6E3E3E3EBEBEBE2E2E2DCDCDCC5C5C59A9A9A9292928F8F8FB4B4B4ABAA
AA9390908079798A7F7F968686A28E8E8E7E7EA49A9AB8B7B781787840401AA0
A001FFFF00ABAB32C6C6C6C0C0C0BABABAB4B4B4AEAEAEBEBEBED7D7D7EDEDED
EAEAEAE6E6E6E3E3E3E2E2E2E0E0E0D7D7D7C1C1C1CDCDCDD7D7D7BDBDBD9292
928E8E8EB3B3B3ACAAAA9C96968B8181978787A48F8F2C4F3661736040401AA2
A201FFFF00ACAC33BABABAB2B2B2B7B7B7CFCFCFE8E8E8EFEFEFEFEFEFEDEDED
EBEBEBEAEAEAD8D8D8B6B6B6A4A4A49D9D9D929292AAAAAABDBDBDC8C8C8D5D5
D5DBDBDBC8C8C8A6A6A6989898B2B2B2AEACACA39A9A596F5C5D65584C4C1BB2
B201FFFF00B0B034C2C2C2DDDDDDF0F0F0F7F7F7F7F7F7F5F5F5F3F3F3F1F1F1
DEDEDE888888837E7EB3A6A6D9C9C9CFC3C3B3ACAC838181787878AAAAAAB9B9
B9C5C5C5D1D1D1D9D9D9DDDDDDC8C8C8A6A6A6828282B0B0B09390908C8C17F3
F301FFFF00DADA1BBEBE70C4C4B5EAEAEAFCFCFCFBFBFBF9F9F9F7F7F7BFBFBF
827E7ED9BDBDFFDFDFFFE3E3FFE7E7FFEBEBFFF0F0FFF4F4D9D4D4838383AAAA
AADEDEDEDDDDDDDBDBDBD8D8D8CDCDCDA2A2A290904C9C9C17DDDD07FDFD01FF
FF00FFFF00FFFF00FFFF00FFFF00D9D91AB8B84BC1C193CACACACCCCCC837A7A
F5CACAFFD5D5FFDADAFFDFDFFFE3E3FFE7E7FFEBEBFFF0F0FFFAFAFFFFFF9F9F
9F9C9C9CC1C1C19C9C939E9E4CB6B611ECEC04FFFF01FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00D8D813706D6DECC1C1
FFCDCDFFD1D1FFD5D5FFDADAFFDFDFFFE3E3FFE7E7FFECECFFFFFFFFFFFFFFFF
FF8C8C8C4D4D2D696901D9D901FFFF01FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00A6A634BCA5A5FFD2D2
FFCFCFFFCDCDFFD1D1FFD5D5FFDADAFFDFDFFFE3E3FFF1F1FFFFFFFFFFFFFFFF
FFF5F5F56E6E6A515107A8A801F6F601FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FCFC01777568F5D3D3FFD7D7
FFD2D2FFCFCFFFCDCDFFD1D1FFD5D8FFD7E3FFDFDFFFFBFBFFFFFFFFFFFFFFFF
FFFFFFFFB3B3B354542E727201E8E801FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00DCDC149F9494FFDEDEFFDADA
FFD7D7FFD2D2FFCFCFFFDDE9FFD9FFFFCFFFFFDDFDFFF8FFFFFFFFFFFFFFFFFF
FFFFFFFFF5E2E262625A595901D6D601FDFD01FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00BFBF27B3A6A6FFE3E3FFDEDE
FFDADAFFD7D7FFE0E3FFECFFECC7D6C6A8B1ECD6E7FFF0FFFFFDFFFFF5F5FFDF
DFFFCFCFFFCCCC96868656560EC3C301FAFA01FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00ADAD34D9C9C9FFE7E7FFE3E3
FFDEDEFFDADAFFEFF3FFE4EE6E6B6770703477776AECDEE6FFF0F2FFCCCCFFCC
CCFFCCCCFFCCCCB3999954541AACAC01F6F601FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00AFAF34D9B3B3FFCCCCFFCCCC
FFCDCDFFD0D0FFF0F3D9C6CC5B5B475D5D01808034D9BDC0FFF6F9FFCCCCFFCC
CCFFCCCCFFCCCCC6A6A659592EA8A801F4F401FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00C2C227B39999FFCCCCFFCCCC
FFCCCCFFCCCCFFE9ECFFE9F2777773505027636354E2CBCFFFF4F7FFD6D6FFDB
DBFFDFDFFFDEDEBCA9A95D5D34C0C001FAFA01FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00DADA1B9F8C8CFFCCCCFFCCCC
FFD9D9FFECECFFF9FCFFECFFECDDECB39F9FD9BAC2FFEEFCFFE4E6FFD1D1FFD6
D6FFDBDBFFDFDFB3A4A45A5A1AD0D001FCFC01FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00797667FFE2E2FFF9F9
FFFFFFFFFFFFFFFFFFFFF6FFFFD9FFFFCFFFFFDEFFFFE9F7FFD0D1FFCDCDFFD1
D1FFD6D6FFDBDB968B8B6F6F14E7E701FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF009F9F40C6C6C6FFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFE6EBFFDAE6FFDCE4FFD6D6FFD2D2FFCECEFFCD
CDFFD1D1FFD6D66E6B61A2A201F4F401FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00EDED0E7A7A7AF5F5F5
FFFFFFFFFFFFFFFFFFFFFBFBFFE6E6FFE2E2FFDEDEFFDADAFFD6D6FFD2D2FFCE
CEFFCDCDC6A9A96A6A34D8D801FFFF01FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00B3B3349F9F9F
FFFFFFFFFFFFFFFFFFFFF5F5FFEAEAFFE6E6FFE2E2FFDEDEFFDADAFFD6D6FFD2
D2F5C7C7706D67AFAF07F7F701FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00979747
9F9F9FFFFFFFFFFFFFFFF2F2FFEEEEFFEAEAFFE6E6FFE2E2FFDEDEFFDADAF5CE
CE837B7B969621F0F001FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00F6F607
A0A040969696ECEAEAFFF7F7FFF2F2FFEEEEFFEAEAFFE6E6FFE2E2ECCFCF837D
7D9B9B27F1F101FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00C6C62779795A9F9D9DCFC9C9D9CECED9CCCCCFC0C09F969673735AC7C7
1BFAFA01FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00D0D021B0B0349393479A9A40ACAC34D9D914FCFC01FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00}
Transparent = True
Visible = False
end
object Image3: TImage
Left = 295
Top = 325
Width = 32
Height = 32
AutoSize = True
Picture.Data = {
07544269746D6170360C0000424D360C00000000000036000000280000002000
0000200000000100180000000000000C0000130B0000130B0000000000000000
0000FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF01FAFA01F6F601FBFB01FFFF01FFFF01
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00F9F901DFDF01C6C602CDCD01DCDC01E6E601
F0F001F9F901FFFF01FFFF01FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00D3E61A7FAE4170790F6D6D03808003959502
AFAF02C7C701D9D901E4E401EDED01F7F701FEFE01FFFF01FFFF01FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF0194CD4E2EAED920A8D90D88A61D7B80346D4E
51641B6969037B7B038E8E02A8A802C0C001D4D401E1E101EBEB01F5F501FDFD
01FFFF01FFFF01FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF0176C3675CC3E67FD9FF6DD2FF53C5F238B6E6
24ACDC1092B617818D2E715B496629646402717103878702A1A102BCBC02D2D2
01DEDE01E8E801F2F201F9F901FFFF01FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF0176C36753BEE283DCFF72D7FF72D7FF72D7FF
72D7FF72D7FF5DCBF548C0EC2CB1DF0FA1D21284992773684268346161026F6F
038282029B9B02B5B502C8C801DBDB01ECEC01FCFC01FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF0175C26731AED995E3FF76DBFF76DBFF76DBFF
76DBFF76DBFF76DBFF76DBFF76DBFF76DBFF68D3F952C7EF35B7E218A6D60D88
A62277743B6B4252661C6A6A03818103B2B202EDED01FFFF01FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF0172BF6732AFD99EE7FF7BE0FF7BE0FF7BE0FF
7BE0FF7BE0FF7BE0FF7BE0FF7BE0FF7BE0FF7BE0FF7BE0FF7BE0FF7BE0FF7BE0
FF5DCEF23FBDE620ABD9098EB3287468858502DFDF01FFFF01FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF0139AB9933AFD9A2EAFF7EE3FF7EE3FF7EE3FF
7EE3FF7EE3FF7EE3FF7EE3FF7EE3FF7EE3FF7EE3FF7EE3FF7EE3FF7EE3FF7EE3
FF7EE3FF7EE3FF7EE3FF73D8FF0D88A6717103D6D601FFFF01FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF0139AB9927AAD6A7EDFF83E9FF83E9FF83E9FF
83E9FF83E9FF83E9FF83E9FF83E9FF83E9FF83E9FF83E9FF83E9FF83E9FF83E9
FF83E9FF83E9FF83E9FF75DAFF1BA6D9696903CCCC01FCFC01FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF015EBCA60A9DCFBCF0FF86ECFF86ECFF86ECFF
86ECFF86ECFF86ECFF86ECFF86ECFF86ECFF86ECFF86ECFF86ECFF86ECFF86EC
FF86ECFF86ECFF86ECFF77DCFF1BA6D95D670FBFBF02F6F601FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF015FBBA628AAD9C1F2FF8BF1FF8BF1FF8BF1FF
8BF1FF8BF1FF8BF1FF8BF1FF8BF1FF8BF1FF8BF1FF8BF1FF8BF1FF8BF1FF8BF1
FF8BF1FF8BF1FF8BF1FF79DEFF45BFE6476D35B2B202F1F101FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF0151B7B32AABD9C5F4FF8FF5FF8FF5FF8FF5FF
8FF5FF8FF5FF8FF5FF8FF5FF8FF5FF8FF5FF8FF5FF8FF5FF8FF5FF8FF5FF8FF5
FF8FF5FF8FF5FF8FF5FF7CE1FF48BFE63D6D41A3A302ECEC01FFFF01FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF012CACD92CACD9BBF0FC94FAFF94FAFF94FAFF
94FAFF94FAFF94FAFF94FAFF94FAFF94FAFF94FAFF94FAFF94FAFF94FAFF94FA
FF94FAFF94FAFF94FAFF7EE3FF78D9F22A7667949402E6E601FFFF01FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF0144B5DF38B1DCA7DFF298FEFF98FEFF98FEFF
98FEFF98FEFF98FEFF98FEFF98FEFF98FEFF98FEFF98FEFF98FEFF98FEFF98FE
FF98FEFF98FEFF98FEFF80E5FF7DD9F21E7D81878702E1E101FFFF01FFFF00FF
FF00FFFF00FFFF00FFFF00FEFE015EC1E65EC1E6ABE0F29EFFFF9EFFFF9EFFFF
9EFFFF9EFFFF9EFFFF9EFFFF9EFFFF9EFFFF9EFFFF9EFFFF9EFFFF9EFFFF9EFF
FF9EFFFF9EFFFF9EFFFF82E6FFB2F2FF13869A7A7A03DBDB01FFFF01FFFF00FF
FF00FFFF00FFFF00FFFF00FAFA0161C1E661C1E6ADE0F2ACFFFFACFFFFACFFFF
ACFFFFACFFFFACFFFFACFFFFACFFFFACFFFFACFFFFACFFFFACFFFFACFFFFACFF
FFACFFFFACFFFFACFFFF89E6FFB8F2FF1795B66E6E03D5D501FEFE01FFFF00FF
FF00FFFF00FFFF00FFFF00D7EA1A65C3E668C7E976C9E6E1FAFFD1FCFFCBFDFF
C5FEFFBCFFFFBAFFFFBAFFFFBAFFFFBAFFFFBAFFFFBAFFFFBAFFFFBAFFFFBAFF
FFBAFFFFBAFFFFBAFFFF90E6FFBDF2FF37B3D9676702C9C901FAFA01FFFF00FF
FF00FFFF00FFFF00FFFF00B8DE3468C4E68FE7FC34B9DF27AAD63CB1D978C9E6
95D5ECB3E2F2EBFAFFE0FCFFC7FFFFC5FFFFC5FFFFC5FFFFC5FFFFC5FFFFC5FF
FFC5FFFFC5FFFFC5FFFF95E6FFC3F2FF48B9DC55681BBCBC02F5F501FFFF00FF
FF00FFFF00FFFF00FFFF00B8DE34A0DBF2A1F4FF8FF5FF8FF5FF7FEAF96DDFF2
49C8E638BCDF1DABD66BC4E2EDFCFFD5FFFFD3FFFFD3FFFFD3FFFFD3FFFFD3FF
FFD3FFFFD3FFFFD3FFFF9DE6FFCAF2FF76CCE6456C35AFAF02F0F001FFFF00FF
FF00FFFF00FFFF00FFFF00B9DF34A6DDF2A8FAFF96FCFF96FCFF96FCFF96FCFF
96FCFF96FCFF96FCFF30B9DC7CCBE6F3FDFFECFEFFEBFEFFE6FFFFE3FFFFE1FF
FFE1FFFFE1FFFFE1FFFFA3E6FFCFF2FF89D2E938714FA2A202EBEB01FFFF01FF
FF00FFFF00FFFF00FFFF00BCE234AADEF2ACFDFF99FFFF99FFFF99FFFF99FFFF
99FFFF99FFFF99FFFF8FF9FC3ABFDF24ACD640B2D95FBFDF7ECCE6ACDEEFBCE5
F2F8FEFFF8FEFFF4FFFFC0ECFFDEF5FFBBE5F2348068A6A602EBEB01FFFF01FF
FF00FFFF00FFFF00FFFF00DFF21B76C9E6CCFBFF99FFFF99FFFF99FFFF99FFFF
99FFFF99FFFF9EFFFFD2FBFFD7FBFFC3FCFFBDFCFF91EAF57EE5F24ECCE63ABF
DF27B3D91AA6D240B2D970C5E280CCE68FD2E9409F80D1D101F6F601FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF006CC283E3F4FCA4FFFF99FFFF99FFFF99FFFF
99FFFF99FFFFD7FCFF97D6EC63B1A564BCB37ACAE688D0E9B5E2F2C4E8F5DCFC
FFD7FCFFC6FDFFB6FEFF55C5E2438F6862AF67BDDA27F7F701FEFE01FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00DFF21B5EBEDFECFDFFE1FDFFCAFEFFCAFEFF
B1FFFFC9FEFFC9EAF5579A6BD3D301F9F901FFFF01DFF21BBCE2348ACD5A77C4
675ABAA068BFB35DBEDF4EB8DCB4D127F3F301FEFE01FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF007ECB676BC1A34EB8CC71C6E281CCE6
9FD9ECBFE6F255B4B0CBD50EF6F601FFFF01FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF01FFFF01FFFF01FFFF01FFFF01FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF01FFFF01DFF21B
BCE234B9DF34E8F20EFCFC01FFFF01FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00}
Transparent = True
Visible = False
end
object Image4: TImage
Left = 335
Top = 325
Width = 32
Height = 32
AutoSize = True
Picture.Data = {
07544269746D6170360C0000424D360C00000000000036000000280000002000
0000200000000100180000000000000C0000130B0000130B0000000000000000
0000FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FEFE01F5F501E4E401D8D801D6D601DDDD01E6E601F0F0
01F9F901FFFF01FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FCFC01EFEF01DADA01BCBC019898017E7E017B7B018989019B9B01AEAE
01C4C401D9D901EBEB01F8F801FFFF01FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF01F9F901
EAEA01D1D101AEAE017A7A0B4949224A4A4762625F52524346462553531E5D5D
0A6E6E01868601A5A501C4C401DEDE01F3F301FDFD01FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FDFD01F3F301E1E101C6C601
A2A20164641656563E9D9D9D8887888F8F8F6D6D6D6767678282828282827D7C
7C61615557552B5C5C0D707001909001B7B701DBDB01F5F501FFFF01FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FCFC01EEEE01D7D701B8B8018F8F05595921
7D7D72B5B5B5DDDDDDD7D7D78382828484843434343434343434343434344242
425E5E5E7B7B7A8685856C6B555B5B1E6969018F8F01BFBF01E6E601FAFA01FF
FF00FFFF00FFFF01F7F701E8E801CFCF01ACAC017777135D5D36919191CACACA
DCDCDCD5D5D5A0A0A06868687372728989893434343434343434343434343434
343434343434343C3C3C6969698988887B7A68585812717101A2A201D7D701F8
F801FFFF00F3F301CCCC01A0A0016C6C20767664A6A6A6DDDDDDDADADAC2C2C2
818181626262848484A9A9A99291919494943434343434343434343434343434
3434343434343434343434343434343469696997979670704D5F5F01989801DD
DD01FFFF00CCCC0C7C7C35898983C3C3C3DDDDDDCFCFCFA1A1A16D6D6D757575
A5A5A5B7B7B7AFAFAFA9A9A99897979F9F9F9999998B8B8B7474745454543C3C
3C3434343434343434343434343434343434343C3C3C89898990907F6E6E01C2
C201FFFF008C8C7FD5D5D5DCDCDCB8B8B88686867E7E7E949494BABABAB5B5B5
ACACACA8A8A8B1B1B1D1D1D1E9E9E9CECECDB7B7B7B1B1B1A9A9A8A8A8A8B3B3
B3A7A7A77F7F7F5F5F5F343434343434343434343434343434A9A9A979792EB9
B901FFFF008F8F8F9F9F9F7C7C7C8E8E8EB0B0B0B9B9B9B1B1B1ABABABB0B0B0
C5C5C5E1E1E1EDEDEDE4E4E4E0E0E0DEDEDEDCDCDCDBDBDBDADADAD4D4D4C8C8
C8BDBDBDB7B7B7BABBBBB5B6B68C8C8C5858583434343434349494947C7C31B9
B901FFFF007E7E7EAAAAAABCBCBCB7B7B7B0B0B0AEAEAEC3C3C3DBDBDBEEEEEE
EDEDEDE9E9E9E6E6E6E5E5E5E3E3E3E1E1E1E0E0E0DFDFDFDCDCDCDBDBDBDADA
DAD7D7D7D6D6D6D2D2D2C9C9C9C5C6C6C8C9C9A3A3A35A5A5A8888887F8034BD
BD01FFFF008F8F8FB5B5B5ADADADC0C0C0D4D4D4EDEDEDF1F1F1F1F1F1F0F0F0
EEEEEEECECECEBEBEBEAEAEAE7E7E7E5E5E5E4E4E4E1E1E1E0E0E0DFDFDFDDDD
DDDBDBDBDADADAD8D8D8D6D6D6D5D5D5D1D2D2CFD0D0D2D3D4D0D0D19F9F39D3
D301FFFF00929292CACACAE7E7E7F3F3F3FAFAFAF8F8F8F6F6F6F5F5F5F4F4F4
F1F1F1F0F0F0EFEFEFECECECEBEBEBEAEAEAE7E7E7E5E5E5E4E4E4E2E2E2E0E0
E0DFDFDFDDDDDDDBDBDBDADADAD8D8D8D6D6D6D5D5D5D4D4D5B0B2B3D3D30FF2
F201FFFF00BFBF43C0C094CECECEF5F5F5FDFDFDFBFBFBFAFAFAF9F9F9F6F6F6
F5F5F5F4F4F4F1F1F1F0F0F0EFEFEFEDEDEDEBEBEBEAEAEAE7E7E7E5E5E5E4E4
E4E2E2E2E0E0E0DFDFDFDDDDDDBCBCBCA2A28A999949ADAD11E5E504FBFB01FF
FF01FFFF00FFFF00FFFF00F5F507C1C126BEBE64BFBFA3D6D6D6FBFBFBFAFAFA
F9F9F9F7F7F7F5F5F5F4F4F4F2F2F2F0F0F0EFEFEFEDEDEDEBEBEBEAEAEAE7E7
E7DADADAA5A5A5A6A666AAAA2ED5D507F8F801FFFF01FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00E0E013BCBC33BBBB71
B4B4B4E5E5E5F9F9F9F7F7F7F5F5F5F4F4F4F2F2F2F0F0F0C5C5C5A7A78FA2A2
44B0B014F3F301FCFC01FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00D3D316B0B045ADAD82C5C5C5B7B7B7ACAC6AA7A72BD8D80AF8F801FFFF
01FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00F4F406FFFF01FFFF01FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00}
Transparent = True
Visible = False
end
object Label1: TLabel
Left = 98
Top = 138
Width = 48
Height = 16
Caption = '00:00:00'
end
object Button1: TButton
Left = 128
Top = 10
Width = 21
Height = 21
Caption = 'X'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 98
Top = 10
Width = 21
Height = 21
Caption = 'i'
TabOrder = 1
OnClick = Button2Click
end
end
object DarkThreadTimer1: TDarkThreadTimer
OnTimer = DarkThreadTimer1Timer
Enabled = True
Interval = 100
ThreadPriority = tpNormal
Left = 32
Top = 112
end
object XPManifest1: TXPManifest
Left = 272
Top = 32
end
end
| 62.184891 | 73 | 0.841299 |
470d82ebfd46105b1e6d6891af04229770b69be8 | 2,703 | pas | Pascal | src/forms/fDebug.pas | kmzbrnoI/hJOPpanel | 17752ed3da5cf423375250113ce2df6b96c019a2 | [
"Apache-2.0"
]
| 3 | 2016-02-17T20:15:23.000Z | 2018-05-24T20:12:38.000Z | src/forms/fDebug.pas | kmzbrnoI/hJOPpanel | 17752ed3da5cf423375250113ce2df6b96c019a2 | [
"Apache-2.0"
]
| 45 | 2016-04-15T18:21:06.000Z | 2021-09-22T09:54:20.000Z | src/forms/fDebug.pas | kmzbrnoI/hJOPpanel | 17752ed3da5cf423375250113ce2df6b96c019a2 | [
"Apache-2.0"
]
| 1 | 2021-11-16T14:15:33.000Z | 2021-11-16T14:15:33.000Z | unit fDebug;
{
Debug window (show network log).
}
interface
uses
Windows, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, StrUtils;
type
TF_Debug = class(TForm)
CHB_DataLogging: TCheckBox;
LV_Log: TListView;
M_Data: TMemo;
B_ClearLog: TButton;
GB_SendData: TGroupBox;
E_Send: TEdit;
B_Send: TButton;
Label1: TLabel;
L_len: TLabel;
Label2: TLabel;
CHB_PingLogging: TCheckBox;
procedure B_ClearLogClick(Sender: TObject);
procedure LV_LogChange(Sender: TObject; Item: TListItem; Change: TItemChange);
procedure LV_LogCustomDrawItem(Sender: TCustomListView; Item: TListItem; State: TCustomDrawState;
var DefaultDraw: Boolean);
procedure B_SendClick(Sender: TObject);
procedure E_SendKeyPress(Sender: TObject; var Key: Char);
procedure M_DataChange(Sender: TObject);
private
{ Private declarations }
public
procedure Log(msg: string);
end;
var
F_Debug: TF_Debug;
implementation
uses Sounds, fPotvrSekv, BottomErrors, TCPClientPanel;
{$R *.dfm}
procedure TF_Debug.B_ClearLogClick(Sender: TObject);
begin
Self.M_Data.Clear();
Self.LV_Log.Clear();
end;
procedure TF_Debug.LV_LogChange(Sender: TObject; Item: TListItem; Change: TItemChange);
begin
if (Assigned(Self.LV_Log.Selected)) then
Self.M_Data.Text := Self.LV_Log.Selected.SubItems.Strings[0]
else
Self.M_Data.Text := '';
end;
procedure TF_Debug.LV_LogCustomDrawItem(Sender: TCustomListView; Item: TListItem; State: TCustomDrawState;
var DefaultDraw: Boolean);
begin
if (LeftStr(Item.SubItems.Strings[0], 3) = 'GET') then
Self.LV_Log.Canvas.Brush.Color := $FFEEEE;
if (LeftStr(Item.SubItems.Strings[0], 4) = 'SEND') then
Self.LV_Log.Canvas.Brush.Color := $EEFFEE;
end;
procedure TF_Debug.M_DataChange(Sender: TObject);
var len: Cardinal;
begin
if (Length(Self.M_Data.Text) >= 5) then
len := Length(Self.M_Data.Text) - 5
else
len := Length(Self.M_Data.Text);
Self.L_len.Caption := IntToStr(len div 1000) + ' ' + IntToStr(len mod 1000);
end;
procedure TF_Debug.B_SendClick(Sender: TObject);
begin
PanelTCPClient.SendLn(Self.E_Send.Text);
Self.E_Send.Text := '';
end;
procedure TF_Debug.E_SendKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = #13) then
Self.B_SendClick(Self);
end;
procedure TF_Debug.Log(msg: string);
begin
if (not Self.CHB_DataLogging.Checked) then
Exit();
if ((not Self.CHB_PingLogging.Checked) and ((ContainsStr(msg, '-;PING')) or (ContainsStr(msg, '-;PONG')))) then
Exit();
var LI := Self.LV_Log.Items.Insert(0);
LI.Caption := FormatDateTime('hh:nn:ss,zzz', Now);
LI.SubItems.Add(msg);
end;
end.// unit
| 25.261682 | 113 | 0.711802 |
477abb2fbcbcd96967753693bc0536967227dba7 | 31,949 | pas | Pascal | Source/cxBoldExtLookupComboBox.pas | RI-L/BoldDevEx | e9e9a8bcc54a2c9ab0752ce3ad3b9fcb67378274 | [
"MIT"
]
| null | null | null | Source/cxBoldExtLookupComboBox.pas | RI-L/BoldDevEx | e9e9a8bcc54a2c9ab0752ce3ad3b9fcb67378274 | [
"MIT"
]
| null | null | null | Source/cxBoldExtLookupComboBox.pas | RI-L/BoldDevEx | e9e9a8bcc54a2c9ab0752ce3ad3b9fcb67378274 | [
"MIT"
]
| null | null | null | unit cxBoldExtLookupComboBox;
{$I cxVer.inc}
interface
uses
{$IFDEF DELPHI6}
Variants,
{$ENDIF}
Windows, Classes, Controls,
Graphics, Messages, SysUtils, cxClasses,
cxContainer, cxControls, cxCustomData,
cxBoldLookupEdit,
cxEditConsts, cxGrid, cxGridCustomTableView, cxEdit,
cxGridCustomView, cxGridStrs, cxGridTableView, cxLookAndFeels, cxLookupEdit,
BoldElements,
cxBoldEditors,
cxGridBoldSupportUnit,
BoldControlPack,
BoldHandles,
BoldComponentValidator;
type
{ TcxBoldExtLookupGrid }
TcxBoldExtLookupGrid = class(TcxGrid)
private
FEditable: Boolean;
FMousePos: TPoint;
FPopupMouseMoveLocked: Boolean;
FPrevOnKeyDown: TKeyEvent;
FPrevOnMouseDown: TMouseEvent;
FPrevOnMouseMove: TMouseMoveEvent;
FPrevOnMouseUp: TMouseEvent;
FRowPressed: Boolean;
FOnCloseUp: TcxLookupGridCloseUpEvent;
function GetView: TcxCustomGridTableView;
procedure ViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure ViewMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ViewMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure ViewMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
protected
procedure DoCancelMode; override;
procedure DoCloseUp(AAccept: Boolean); virtual;
function IsDataRow(AHitTest: TcxCustomGridHitTest): Boolean;
property Editable: Boolean read FEditable write FEditable;
property PopupMouseMoveLocked: Boolean read FPopupMouseMoveLocked write FPopupMouseMoveLocked;
property OnCloseUp: TcxLookupGridCloseUpEvent read FOnCloseUp write FOnCloseUp;
public
property View: TcxCustomGridTableView read GetView;
end;
{ TcxCustomBoldExtLookupComboBoxProperties }
TcxCustomBoldExtLookupComboBoxProperties = class(TcxCustomBoldLookupEditProperties);
{ TcxBoldExtLookupComboBoxProperties }
TcxBoldExtLookupComboBoxProperties = class(TcxCustomBoldExtLookupComboBoxProperties)
private
FAutoSearchOnPopup: Boolean;
FDestroying: Boolean;
FFocusPopup: Boolean;
FGrid: TcxBoldExtLookupGrid;
FInCheckListFieldItem: Boolean;
FListFieldItem: TcxCustomGridTableItem;
FPrevColumnFiltering: Boolean;
FPrevColumnsQuickCustomization: Boolean;
FPrevPullFocusing: Boolean;
FPrevImmediateEditor: Boolean;
FPrevIncSearch: Boolean;
FPrevMultiSelect: Boolean;
FView: TcxCustomGridTableView;
function GetGrid: TcxBoldExtLookupGrid;
// function GetGridMode: Boolean;
function GetListFieldIndex: Integer;
function GetListFieldItem: TcxCustomGridTableItem;
// procedure SetGridMode(Value: Boolean);
procedure SetListFieldItem(Value: TcxCustomGridTableItem);
procedure SetView(Value: TcxCustomGridTableView);
protected
// IcxBoldEditProperties
procedure SetStoredValue(aValue: Variant; aBoldHandle: TBoldElementHandle; aEdit: TcxCustomEdit; aFollower: TBoldFollower; var aDone: boolean); override;
function CanEdit(aBoldHandle: TBoldElementHandle; aFollower: TBoldFollower): boolean; override;
procedure CheckListFieldItem;
procedure DeinitializeDataController; override;
procedure FreeNotification(Sender: TComponent); override;
function GetIncrementalFiltering: Boolean; override;
function GetListIndex: Integer; override;
procedure InitializeDataController; override;
procedure LinkView(AView: TcxCustomGridTableView);
function PopupWindowCapturesFocus: Boolean; override;
procedure UnlinkView(AView: TcxCustomGridTableView);
// LookupGrid methods
function GetLookupGridActiveControl: TWinControl; override;
function GetLookupGridCanResize: Boolean; override;
function GetLookupGridColumnCount: Integer; override;
function GetLookupGridControl: TWinControl; override;
function GetLookupGridDataController: TcxCustomDataController; override;
function GetLookupGridVisualAreaPreferredWidth: Integer; override;
function GetLookupGridNearestPopupHeight(AHeight: Integer): Integer; override;
function GetLookupGridPopupHeight(ADropDownRowCount: Integer): Integer; override;
function IsLookupGridMouseOverList(const P: TPoint): Boolean; override;
procedure LookupGridDeinitialize; override;
procedure LookupGridDroppedDown(const AFindStr: string); override;
procedure LookupGridInitEvents(AOnClick, AOnFocusedRowChanged: TNotifyEvent;
AOnCloseUp: TcxLookupGridCloseUpEvent); override;
procedure LookupGridInitialize; override;
procedure LookupGridInitLookAndFeel(ALookAndFeel: TcxLookAndFeel;
AColor: TColor; AFont: TFont); override;
procedure LookupGridLockMouseMove; override;
procedure LookupGridMakeFocusedRowVisible; override;
procedure LookupGridUnlockMouseMove; override;
procedure BoldLookupGridBeginUpdate; override;
procedure BoldLookupGridEndUpdate; override;
// DBLookupGrid methods
{
procedure DBLookupGridBeginUpdate; override;
procedure DBLookupGridCheckColumnByFieldName(const AFieldName: string); override;
procedure DBLookupGridCreateColumnsByFieldNames(const AFieldNames: string); override;
procedure DBLookupGridEndUpdate; override;
function GetDBLookupGridColumnField(AIndex: Integer): TField; override;
function GetDBLookupGridColumnFieldName(AIndex: Integer): string; override;
function GetDBLookupGridColumnIndexByFieldName(const AFieldName: string): Integer; override;
}
function GetBoldLookupGridDataController: TcxBoldDataController; override;
public
constructor Create(AOwner: TPersistent); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
class function GetContainerClass: TcxContainerClass; override;
class function IsViewSupported(Value: TcxCustomGridTableView): Boolean;
property Grid: TcxBoldExtLookupGrid read GetGrid;
property ListFieldIndex: Integer read GetListFieldIndex;
published
property BoldSelectChangeAction;
property BoldSetValueExpression;
property Alignment;
property AssignedValues;
property AutoSearchOnPopup: Boolean read FAutoSearchOnPopup write FAutoSearchOnPopup default True;
property AutoSelect;
property ButtonGlyph;
property CaseSensitiveSearch;
property CharCase;
property ClearKey;
property DropDownAutoSize;
property DropDownHeight;
property DropDownListStyle;
property DropDownRows;
property DropDownSizeable;
property DropDownWidth;
property FocusPopup: Boolean read FFocusPopup write FFocusPopup default False;
// property GridMode: Boolean read GetGridMode write SetGridMode default False;
property HideSelection;
property ImeMode;
property ImeName;
property ImmediateDropDown;
// property ImmediatePost;
property IncrementalFiltering;
property View: TcxCustomGridTableView read FView write SetView; // before
// property KeyFieldNames;
property ListFieldItem: TcxCustomGridTableItem read GetListFieldItem write SetListFieldItem;
property MaxLength;
property OEMConvert;
property PopupAlignment;
property PostPopupValueOnTab;
property ReadOnly;
property Revertable;
property UseLeftAlignmentOnEditing;
property ValidateOnEnter;
property OnChange;
property OnCloseUp;
property OnEditValueChanged;
property OnInitPopup;
property OnNewLookupDisplayText;
property OnPopup;
property OnValidate;
end;
{ TcxCustomBoldExtLookupComboBox }
TcxCustomBoldExtLookupComboBox = class(TcxCustomBoldLookupEdit)
private
function GetActiveProperties: TcxBoldExtLookupComboBoxProperties;
function GetProperties: TcxBoldExtLookupComboBoxProperties;
procedure SetProperties(Value: TcxBoldExtLookupComboBoxProperties);
protected
function CanDropDown: Boolean; override;
public
class function GetPropertiesClass: TcxCustomEditPropertiesClass; override;
property ActiveProperties: TcxBoldExtLookupComboBoxProperties
read GetActiveProperties;
property EditValue;
property Properties: TcxBoldExtLookupComboBoxProperties read GetProperties
write SetProperties;
property Text;
end;
{ TcxBoldNBExtLookupComboBox }
TcxBoldNBExtLookupComboBox = class(TcxCustomBoldExtLookupComboBox)
published
property Anchors;
property AutoSize;
property BeepOnEnter;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property ImeMode;
property ImeName;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property Properties;
property EditValue;
property ShowHint;
property Style;
property StyleDisabled;
property StyleFocused;
property StyleHot;
property TabOrder;
property TabStop;
property Visible;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnEditing;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
end;
{ TcxBoldExtLookupComboBox }
TcxBoldExtLookupComboBox = class(TcxCustomBoldExtLookupComboBox, IBoldValidateableComponent, IBoldOCLComponent)
private
function GetDataBinding: TcxBoldTextEditDataBinding;
procedure SetDataBinding(Value: TcxBoldTextEditDataBinding);
// procedure CMGetDataLink(var Message: TMessage); message CM_GETDATALINK;
protected
class function GetDataBindingClass: TcxEditDataBindingClass; override;
procedure Initialize; override;
procedure Paint; override;
published
property Anchors;
property AutoSize;
property BeepOnEnter;
property Constraints;
property DragCursor;
property DragKind;
property DataBinding: TcxBoldTextEditDataBinding read GetDataBinding write SetDataBinding implements IBoldValidateableComponent, IBoldOCLComponent;
property DragMode;
property Enabled;
property ImeMode;
property ImeName;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property Properties;
property ShowHint;
property Style;
property StyleDisabled;
property StyleFocused;
property StyleHot;
property TabOrder;
property TabStop;
property Visible;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnEditing;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
end;
{ TcxEditRepositoryExtLookupComboBoxItem }
TcxEditRepositoryExtLookupComboBoxItem = class(TcxEditRepositoryItem)
private
function GetProperties: TcxBoldExtLookupComboBoxProperties;
procedure SetProperties(Value: TcxBoldExtLookupComboBoxProperties);
public
class function GetEditPropertiesClass: TcxCustomEditPropertiesClass; override;
published
property Properties: TcxBoldExtLookupComboBoxProperties read GetProperties write SetProperties;
end;
implementation
uses
cxGridFilterHelpers,
BoldSystem,
cxDropDownEdit;
type
TcxCustomGridTableOptionsBehaviorAccess = class(TcxCustomGridTableOptionsBehavior);
TcxCustomGridTableOptionsViewAccess = class(TcxCustomGridTableOptionsView);
{ TcxBoldExtLookupGrid }
procedure TcxBoldExtLookupGrid.DoCancelMode;
begin
FRowPressed := False;
inherited;
end;
procedure TcxBoldExtLookupGrid.DoCloseUp(AAccept: Boolean);
begin
if AAccept then
View.DataController.SyncSelected(True);
if Assigned(FOnCloseUp) then FOnCloseUp(Self, AAccept);
end;
function TcxBoldExtLookupGrid.IsDataRow(AHitTest: TcxCustomGridHitTest): Boolean;
begin
Result := (AHitTest is TcxGridRecordHitTest) and
TcxGridRecordHitTest(AHitTest).GridRecord.IsData;
end;
function TcxBoldExtLookupGrid.GetView: TcxCustomGridTableView;
begin
Result := Levels[0].GridView as TcxCustomGridTableView;
end;
procedure TcxBoldExtLookupGrid.ViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Assigned(FPrevOnKeyDown) then
FPrevOnKeyDown(Self, Key, Shift);
if (View = nil) then Exit;
case Key of
VK_RETURN:
if not Editable or not View.OptionsData.Editing or (ssCtrl in Shift) then
begin
if View.DataController.IsEditing then
View.DataController.Post;
DoCloseUp(View.DataController.FocusedRowIndex <> -1);
end;
VK_ESCAPE:
if Editable and not View.DataController.IsEditing then
DoCloseUp(False);
end;
end;
procedure TcxBoldExtLookupGrid.ViewMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
AHitTest: TcxCustomGridHitTest;
begin
if Assigned(FPrevOnMouseDown) then
FPrevOnMouseDown(Sender, Button, Shift, X, Y);
AHitTest := View.ViewInfo.GetHitTest(X, Y);
if (Button = mbLeft) and IsDataRow(AHitTest) then
begin
if Editable then
begin
if ssDouble in Shift then
DoCloseUp(True);
end
else
FRowPressed := True;
end;
end;
procedure TcxBoldExtLookupGrid.ViewMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var
AHitTest: TcxCustomGridHitTest;
begin
if Assigned(FPrevOnMouseMove) then
FPrevOnMouseMove(Sender, Shift, X, Y);
if not MouseCapture and PopupMouseMoveLocked then
begin
PopupMouseMoveLocked := False;
Exit;
end;
// Hot Track
if (View = nil) or Editable then Exit;
AHitTest := View.ViewInfo.GetHitTest(X, Y);
if IsDataRow(AHitTest) and ((FMousePos.X <> X) or (FMousePos.Y <> Y)) then
begin
FMousePos.X := X;
FMousePos.Y := Y;
TcxGridRecordHitTest(AHitTest).GridRecord.Focused := True;
end;
end;
procedure TcxBoldExtLookupGrid.ViewMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
AHitTest: TcxCustomGridHitTest;
begin
if Assigned(FPrevOnMouseUp) then
FPrevOnMouseUp(Sender, Button, Shift, X, Y);
AHitTest := View.ViewInfo.GetHitTest(X, Y);
if (Button = mbLeft) and FRowPressed then
DoCloseUp(IsDataRow(AHitTest));
FRowPressed := False;
end;
{ TcxBoldExtLookupComboBoxProperties }
constructor TcxBoldExtLookupComboBoxProperties.Create(AOwner: TPersistent);
begin
inherited Create(AOwner);
FAutoSearchOnPopup := True;
end;
destructor TcxBoldExtLookupComboBoxProperties.Destroy;
begin
FDestroying := True;
ListFieldItem := nil;
View := nil;
FreeAndNil(FGrid);
inherited Destroy;
end;
procedure TcxBoldExtLookupComboBoxProperties.Assign(Source: TPersistent);
begin
if Source is TcxBoldExtLookupComboBoxProperties then
begin
BeginUpdate;
try
AutoSearchOnPopup := TcxBoldExtLookupComboBoxProperties(Source).AutoSearchOnPopup;
FocusPopup := TcxBoldExtLookupComboBoxProperties(Source).FocusPopup;
View := nil; //?
// GridMode := TcxBoldExtLookupComboBoxProperties(Source).GridMode;
View := TcxBoldExtLookupComboBoxProperties(Source).View;
inherited Assign(Source);
ListFieldItem := TcxBoldExtLookupComboBoxProperties(Source).ListFieldItem;
finally
EndUpdate;
end
end
else
inherited Assign(Source);
end;
class function TcxBoldExtLookupComboBoxProperties.GetContainerClass: TcxContainerClass;
begin
Result := TcxBoldNBExtLookupComboBox;
end;
class function TcxBoldExtLookupComboBoxProperties.IsViewSupported(Value: TcxCustomGridTableView): Boolean;
begin
Result := Value.CanBeLookupList and
(TcxCustomGridView(Value).DataController is TcxBoldDataController);
end;
procedure TcxBoldExtLookupComboBoxProperties.CheckListFieldItem;
begin
FInCheckListFieldItem := True;
try
if (View <> nil) and (ListFieldItem <> nil) and
(View.IndexOfItem(ListFieldItem) = -1) then
ListFieldItem := nil;
finally
FInCheckListFieldItem := False;
end;
end;
procedure TcxBoldExtLookupComboBoxProperties.DeinitializeDataController;
begin
inherited DeinitializeDataController;
if DataController <> nil then
DataController.RemoveDataChangeRefCount;
end;
procedure TcxBoldExtLookupComboBoxProperties.FreeNotification(Sender: TComponent);
begin
inherited FreeNotification(Sender);
if Sender = ListFieldItem then
ListFieldItem := nil;
if Sender = View then
View := nil;
end;
function TcxBoldExtLookupComboBoxProperties.GetIncrementalFiltering: Boolean;
begin
if FocusPopup then
Result := False
else
Result := inherited GetIncrementalFiltering;
end;
function TcxBoldExtLookupComboBoxProperties.GetListIndex: Integer;
begin
Result := Self.ListFieldIndex;
end;
procedure TcxBoldExtLookupComboBoxProperties.InitializeDataController;
begin
inherited InitializeDataController;
if DataController <> nil then
DataController.AddDataChangeRefCount;
end;
procedure TcxBoldExtLookupComboBoxProperties.LinkView(AView: TcxCustomGridTableView);
begin
CheckListFieldItem;
FreeNotificator.AddSender(AView);
InitializeDataController;
end;
function TcxBoldExtLookupComboBoxProperties.PopupWindowCapturesFocus: Boolean;
begin
Result := FocusPopup;
end;
procedure TcxBoldExtLookupComboBoxProperties.UnlinkView(AView: TcxCustomGridTableView);
begin
DeinitializeDataController;
FreeNotificator.RemoveSender(AView);
end;
// LookupGrid methods
function TcxBoldExtLookupComboBoxProperties.GetLookupGridActiveControl: TWinControl;
begin
if View <> nil then
Result := View.Site
else
Result := inherited GetLookupGridActiveControl;
end;
function TcxBoldExtLookupComboBoxProperties.GetLookupGridCanResize: Boolean;
begin
if View <> nil then
Result := not TcxCustomGridTableOptionsViewAccess(View.OptionsView).CellAutoHeight
else
Result := False;
end;
function TcxBoldExtLookupComboBoxProperties.GetLookupGridColumnCount: Integer;
begin
if View <> nil then
Result := View.ItemCount
else
Result := 0;
end;
function TcxBoldExtLookupComboBoxProperties.GetLookupGridControl: TWinControl;
begin
Result := Grid;
end;
function TcxBoldExtLookupComboBoxProperties.GetLookupGridDataController: TcxCustomDataController;
begin
if View <> nil then
Result := View.DataController
else
Result := nil;
end;
function TcxBoldExtLookupComboBoxProperties.GetLookupGridVisualAreaPreferredWidth: Integer;
begin
Result := 0;
if View <> nil then
View.ViewInfo.GetWidth(Point(MaxInt, MaxInt), Result);
end;
function TcxBoldExtLookupComboBoxProperties.GetLookupGridNearestPopupHeight(AHeight: Integer): Integer;
begin
if View <> nil then
Result := View.ViewInfo.GetNearestPopupHeight(AHeight, FocusPopup)
else
Result := AHeight;
end;
function TcxBoldExtLookupComboBoxProperties.GetLookupGridPopupHeight(ADropDownRowCount: Integer): Integer;
begin
if View <> nil then
begin
if FocusPopup and (ADropDownRowCount < 2) then // TODO: Check New Item Row
ADropDownRowCount := 2;
Result := View.ViewInfo.GetPopupHeight(ADropDownRowCount);
end
else
Result := 0;
end;
function TcxBoldExtLookupComboBoxProperties.IsLookupGridMouseOverList(const P: TPoint): Boolean;
var
AHitTest: TcxCustomGridHitTest;
begin
Result := False;
if View <> nil then
begin
AHitTest := View.ViewInfo.GetHitTest(P);
Result := AHitTest is TcxGridRecordHitTest;
end;
end;
procedure TcxBoldExtLookupComboBoxProperties.LookupGridDeinitialize;
begin
Grid.Levels[0].GridView := nil;
// restore options
if (View <> nil) and not (csDestroying in View.ComponentState) then
begin
TcxCustomGridTableOptionsBehaviorAccess(View.OptionsBehavior).PullFocusing := FPrevPullFocusing;
View.OptionsSelection.MultiSelect := FPrevMultiSelect;
View.OptionsBehavior.ImmediateEditor := FPrevImmediateEditor;
if View is TcxGridTableView then
begin
TcxGridTableView(View).OptionsCustomize.ColumnFiltering := FPrevColumnFiltering;
TcxGridTableView(View).OptionsCustomize.ColumnsQuickCustomization := FPrevColumnsQuickCustomization;
end;
View.OptionsBehavior.IncSearch := FPrevIncSearch;
View.OnKeyDown := Grid.FPrevOnKeyDown;
View.OnMouseDown := Grid.FPrevOnMouseDown;
View.OnMouseMove := Grid.FPrevOnMouseMove;
View.OnMouseUp := Grid.FPrevOnMouseUp;
end;
end;
procedure TcxBoldExtLookupComboBoxProperties.LookupGridDroppedDown(const AFindStr: string);
begin
// Init Inc Search
// TODO: !!!
if FocusPopup and AutoSearchOnPopup and (ListFieldItem <> nil) then
begin
ListFieldItem.Focused := True;
View.DataController.Search.Locate(ListFieldItem.Index, AFindStr);
end;
end;
procedure TcxBoldExtLookupComboBoxProperties.LookupGridInitEvents(AOnClick, AOnFocusedRowChanged: TNotifyEvent;
AOnCloseUp: cxLookupEdit.TcxLookupGridCloseUpEvent);
begin
Grid.OnClick := AOnClick; // not impl
if View <> nil then
begin
// View.OnFocusedRecordChanged := AOnFocusedRowChanged;
Grid.OnCloseUp := AOnCloseUp;
end;
end;
procedure TcxBoldExtLookupComboBoxProperties.LookupGridInitialize;
begin
if View = nil then
Exit;
// save options
FPrevPullFocusing := TcxCustomGridTableOptionsBehaviorAccess(View.OptionsBehavior).PullFocusing;
TcxCustomGridTableOptionsBehaviorAccess(View.OptionsBehavior).PullFocusing := True;
FPrevMultiSelect := View.OptionsSelection.MultiSelect;
View.OptionsSelection.MultiSelect := False;
FPrevImmediateEditor := View.OptionsBehavior.ImmediateEditor;
View.OptionsBehavior.ImmediateEditor := False;
if View is TcxGridTableView then
begin
FPrevColumnFiltering := TcxGridTableView(View).OptionsCustomize.ColumnFiltering;
FPrevColumnsQuickCustomization := TcxGridTableView(View).OptionsCustomize.ColumnsQuickCustomization;
if not FocusPopup then
begin
TcxGridTableView(View).OptionsCustomize.ColumnFiltering := False;
TcxGridTableView(View).OptionsCustomize.ColumnsQuickCustomization := False;
end;
end;
Grid.FPrevOnKeyDown := View.OnKeyDown;
View.OnKeyDown := Grid.ViewKeyDown;
Grid.FPrevOnMouseDown := View.OnMouseDown;
View.OnMouseDown := Grid.ViewMouseDown;
Grid.FMousePos := Point(-1, -1);
Grid.FPrevOnMouseMove := View.OnMouseMove;
View.OnMouseMove := Grid.ViewMouseMove;
Grid.FPrevOnMouseUp := View.OnMouseUp;
View.OnMouseUp := Grid.ViewMouseUp;
Grid.Editable := FocusPopup;
Grid.Levels[0].GridView := View;
FPrevIncSearch := View.OptionsBehavior.IncSearch;
if FocusPopup and AutoSearchOnPopup then
View.OptionsBehavior.IncSearch := True;
View.DataController.Search.Cancel;
end;
procedure TcxBoldExtLookupComboBoxProperties.LookupGridInitLookAndFeel(ALookAndFeel: TcxLookAndFeel;
AColor: TColor; AFont: TFont);
begin
Grid.LookAndFeel.MasterLookAndFeel := ALookAndFeel;
Grid.Color := AColor;
Grid.Font := AFont;
end;
procedure TcxBoldExtLookupComboBoxProperties.LookupGridLockMouseMove;
begin
Grid.PopupMouseMoveLocked := True;
end;
procedure TcxBoldExtLookupComboBoxProperties.LookupGridMakeFocusedRowVisible;
begin
if View <> nil then
View.Controller.MakeFocusedRecordVisible;
end;
procedure TcxBoldExtLookupComboBoxProperties.LookupGridUnlockMouseMove;
begin
Grid.MouseCapture := False;
Grid.PopupMouseMoveLocked := False;
end;
// DBLookupGrid methods
{
procedure TcxBoldExtLookupComboBoxProperties.DBLookupGridBeginUpdate;
begin
if View <> nil then View.BeginUpdate;
end;
procedure TcxBoldExtLookupComboBoxProperties.DBLookupGridCheckColumnByFieldName(const AFieldName: string);
begin
if (View <> nil) and (DataController <> nil) then
begin
if (AFieldName <> '') and (DataController.GetItemByFieldName(AFieldName) = nil) then
with View.CreateItem do
begin
Index := 0;
DataController.ChangeFieldName(Index, AFieldName);
end;
end;
end;
procedure TcxBoldExtLookupComboBoxProperties.DBLookupGridCreateColumnsByFieldNames(const AFieldNames: string);
var
I: Integer;
AFieldNamesList: TStrings;
begin
if View <> nil then
begin
View.ClearItems;
AFieldNamesList := TStringList.Create;
try
GetFieldNames(AFieldNames, AFieldNamesList);
View.BeginUpdate;
try
for I := 0 to AFieldNamesList.Count - 1 do
DataController.ChangeFieldName(View.CreateItem.Index, AFieldNamesList[I]);
finally
View.EndUpdate;
end;
finally
AFieldNamesList.Free;
end;
end;
end;
procedure TcxBoldExtLookupComboBoxProperties.DBLookupGridEndUpdate;
begin
if View <> nil then View.EndUpdate;
end;
function TcxBoldExtLookupComboBoxProperties.GetDBLookupGridColumnField(AIndex: Integer): TField;
begin
if DataController <> nil then
Result := DataController.GetItemField(AIndex)
else
Result := nil;
end;
function TcxBoldExtLookupComboBoxProperties.GetDBLookupGridColumnFieldName(AIndex: Integer): string;
begin
if DataController <> nil then
Result := DataController.GetItemFieldName(AIndex)
else
Result := '';
end;
function TcxBoldExtLookupComboBoxProperties.GetDBLookupGridColumnIndexByFieldName(const AFieldName: string): Integer;
var
AItem: TcxCustomGridTableItem;
begin
if DataController <> nil then
begin
AItem := TcxCustomGridTableItem(DataController.GetItemByFieldName(AFieldName));
Result := AItem.Index;
end
else
Result := -1;
end;
function TcxBoldExtLookupComboBoxProperties.GetDBLookupGridDataController: TcxDBDataController;
begin
Result := TcxDBDataController(GetLookupGridDataController);
end;
}
function TcxBoldExtLookupComboBoxProperties.GetGrid: TcxBoldExtLookupGrid;
procedure CreateGrid;
begin
FGrid := TcxBoldExtLookupGrid.Create(nil);
FGrid.IsPopupControl := True;
FGrid.BorderStyle := cxcbsNone;
FGrid.Levels.Add;
end;
begin
if (FGrid = nil) and not FDestroying then
CreateGrid;
Result := FGrid;
end;
{function TcxBoldExtLookupComboBoxProperties.GetGridMode: Boolean;
begin
Result := inherited IsUseLookupList;
end;}
function TcxBoldExtLookupComboBoxProperties.GetListFieldIndex: Integer;
var
AItem: TcxCustomGridTableItem;
begin
if IsDefinedByLookup then
Result := GetDisplayColumnIndex
else
begin
AItem := ListFieldItem;
if AItem <> nil then
Result := AItem.Index
else
Result := -1;
end;
end;
function TcxBoldExtLookupComboBoxProperties.GetListFieldItem: TcxCustomGridTableItem;
begin
if IsDefinedByLookup then
Result := nil
else
Result := FListFieldItem;
end;
{procedure TcxBoldExtLookupComboBoxProperties.SetGridMode(Value: Boolean);
begin
inherited IsUseLookupList := Value;
end;}
procedure TcxBoldExtLookupComboBoxProperties.SetListFieldItem(Value: TcxCustomGridTableItem);
begin
if (View <> nil) and (View.IndexOfItem(Value) = -1) then
Value := nil;
if FListFieldItem <> Value then
begin
if FListFieldItem <> nil then
FreeNotificator.RemoveSender(FListFieldItem);
FListFieldItem := Value;
if FListFieldItem <> nil then
FreeNotificator.AddSender(FListFieldItem);
if not FInCheckListFieldItem then
Changed;
end;
end;
procedure TcxBoldExtLookupComboBoxProperties.SetView(Value: TcxCustomGridTableView);
begin
if (Value <> nil) and not IsViewSupported(Value) then Exit;
if FView <> Value then
begin
if FView <> nil then
UnlinkView(FView);
FView := Value;
if FView <> nil then
LinkView(FView);
Changed;
end;
end;
function TcxBoldExtLookupComboBoxProperties.GetBoldLookupGridDataController: TcxBoldDataController;
begin
Result := TcxBoldDataController(GetLookupGridDataController);
end;
procedure TcxBoldExtLookupComboBoxProperties.SetStoredValue(
aValue: Variant; aBoldHandle: TBoldElementHandle; aEdit: TcxCustomEdit; aFollower: TBoldFollower; var aDone: boolean);
var
lItemIndex: Integer;
lSelectedElement: TBoldElement;
begin
// inherited;
// Assert(aEdit is TcxCustomComboBox, 'TcxBoldLookupComboBoxProperties.SetStoredValue: aEdit is not TcxCustomComboBox;' + aEdit.classname);
// lItemIndex := (aEdit as TcxCustomComboBox).ItemIndex;
// if TcxCustomComboBox(aEdit).ILookupData.CurrentKey <> null then
if (not VarIsNull(aValue)) and (aValue <> -1) then
begin
lItemIndex := aValue; //TcxCustomComboBox(aEdit).ILookupData.CurrentKey;
lSelectedElement := GetBoldLookupGridDataController.BoldHandle.List[lItemIndex];
InternalComboSetValue(aBoldHandle, aFollower, lSelectedElement, BoldSelectChangeAction, BoldSetValueExpression, DataController.BoldHandle);
{
Assert(aEdit.EditingValue = aEdit.EditValue);
i := aEdit.EditingValue;
Assert(DataController.CurrentIndex = i);
// (DataController.Follower.Element as TBoldList)[i].
aFollower.Element.Assign(DataController.CurrentBoldObject);
}
end;
aDone := true;
end;
procedure TcxBoldExtLookupComboBoxProperties.BoldLookupGridBeginUpdate;
begin
if View <> nil then View.BeginUpdate;
end;
procedure TcxBoldExtLookupComboBoxProperties.BoldLookupGridEndUpdate;
begin
if View <> nil then View.EndUpdate;
end;
function TcxBoldExtLookupComboBoxProperties.CanEdit(
aBoldHandle: TBoldElementHandle; aFollower: TBoldFollower): boolean;
begin
result := GetBoldLookupGridDataController.RecordCount > 0;
end;
{ TcxCustomBoldExtLookupComboBox }
class function TcxCustomBoldExtLookupComboBox.GetPropertiesClass: TcxCustomEditPropertiesClass;
begin
Result := TcxBoldExtLookupComboBoxProperties;
end;
function TcxCustomBoldExtLookupComboBox.CanDropDown: Boolean;
begin
if ActiveProperties.FocusPopup then
Result := True
else
Result := inherited CanDropDown;
end;
function TcxCustomBoldExtLookupComboBox.GetActiveProperties: TcxBoldExtLookupComboBoxProperties;
begin
Result := TcxBoldExtLookupComboBoxProperties(InternalGetActiveProperties);
end;
function TcxCustomBoldExtLookupComboBox.GetProperties: TcxBoldExtLookupComboBoxProperties;
begin
Result := TcxBoldExtLookupComboBoxProperties(FProperties);
end;
procedure TcxCustomBoldExtLookupComboBox.SetProperties(Value: TcxBoldExtLookupComboBoxProperties);
begin
FProperties.Assign(Value);
end;
{ TcxBoldExtLookupComboBox }
class function TcxBoldExtLookupComboBox.GetDataBindingClass: TcxEditDataBindingClass;
begin
Result := TcxBoldLookupEditDataBinding;
end;
function TcxBoldExtLookupComboBox.GetDataBinding: TcxBoldTextEditDataBinding;
begin
Result := TcxBoldTextEditDataBinding(FDataBinding);
end;
procedure TcxBoldExtLookupComboBox.SetDataBinding(Value: TcxBoldTextEditDataBinding);
begin
FDataBinding.Assign(Value);
end;
{
procedure TcxBoldExtLookupComboBox.CMGetDataLink(var Message: TMessage);
begin
Message.Result := Integer(GetcxDBEditDataLink(Self));
end;
}
type
TcxBoldTextEditDataBindingAccess = class(TcxBoldTextEditDataBinding);
procedure TcxBoldExtLookupComboBox.Paint;
begin
inherited Paint;
if TcxBoldTextEditDataBindingAccess(DataBinding).ValueOrDefinitionInvalid then
Canvas.FrameRect(Bounds, clRed, 2 - Ord(IsNativeStyle));
end;
procedure TcxBoldExtLookupComboBox.Initialize;
begin
inherited;
if IsDesigning and not IsLoading then
begin
_ValidateEdit(self);
end;
end;
{ TcxEditRepositoryExtLookupComboBoxItem }
class function TcxEditRepositoryExtLookupComboBoxItem.GetEditPropertiesClass: TcxCustomEditPropertiesClass;
begin
Result := TcxBoldExtLookupComboBoxProperties;
end;
function TcxEditRepositoryExtLookupComboBoxItem.GetProperties: TcxBoldExtLookupComboBoxProperties;
begin
Result := inherited Properties as TcxBoldExtLookupComboBoxProperties;
end;
procedure TcxEditRepositoryExtLookupComboBoxItem.SetProperties(Value: TcxBoldExtLookupComboBoxProperties);
begin
inherited Properties := Value;
end;
// TODO: rename TcxEditRepositoryExtLookupComboBoxItem to something unique
{
initialization
RegisterClasses([TcxEditRepositoryExtLookupComboBoxItem]);
GetRegisteredEditProperties.Register(TcxBoldExtLookupComboBoxProperties,
cxSEditRepositoryExtLookupComboBoxItem);
finalization
GetRegisteredEditProperties.Unregister(TcxBoldExtLookupComboBoxProperties);
}
end.
| 30.749759 | 157 | 0.783937 |
477a541e4f5b131ee6606c4ce92b23ce09c3f388 | 227 | pas | Pascal | P1010.pas | Nydxy/VijosDGZX | 4669a313aa5d21f1e20c49f6943e2f6f7282e063 | [
"MIT"
]
| null | null | null | P1010.pas | Nydxy/VijosDGZX | 4669a313aa5d21f1e20c49f6943e2f6f7282e063 | [
"MIT"
]
| null | null | null | P1010.pas | Nydxy/VijosDGZX | 4669a313aa5d21f1e20c49f6943e2f6f7282e063 | [
"MIT"
]
| null | null | null | var x:longint;
begin
read(x);
case x of
0:writeln('Sunday');
1:writeln('Monday');
2:writeln('Tuesday');
3:writeln('Wednesday');
4:writeln('Thursday');
5:writeln('Friday');
6:writeln('Saturday');
end;
end. | 16.214286 | 25 | 0.61674 |
83ce7a7857bdaa6da9b0030ad0aed4baefedbade | 1,588 | dpr | Pascal | Samples/Source/2D/GUI/gui_link.dpr | RadiianArts/TERRA-Engine | 965184178dda836197c436ef47e048e1db5382af | [
"Apache-2.0"
]
| 104 | 2015-01-18T02:02:11.000Z | 2022-02-22T11:53:06.000Z | Samples/Source/2D/GUI/gui_link.dpr | maciej-izak-tests/TERRA-Engine | 7ef17e6b67968a40212fbb678135af0000246097 | [
"Apache-2.0"
]
| 13 | 2015-07-18T18:53:15.000Z | 2021-10-04T10:31:01.000Z | Samples/Source/2D/GUI/gui_link.dpr | maciej-izak-tests/TERRA-Engine | 7ef17e6b67968a40212fbb678135af0000246097 | [
"Apache-2.0"
]
| 47 | 2015-01-17T21:50:12.000Z | 2022-02-15T13:49:02.000Z | {$I terra.inc}
{$IFDEF MOBILE}Library{$ELSE}Program{$ENDIF} MaterialDemo;
uses
MemCheck,
TERRA_Object,
TERRA_MemoryManager,
TERRA_Application,
TERRA_DemoApplication,
TERRA_Engine,
TERRA_Utils,
TERRA_OS,
TERRA_Vector2D,
TERRA_Viewport,
TERRA_UIView,
TERRA_UIWidget,
TERRA_UITemplates,
TERRA_UIImage,
TERRA_UILabel,
TERRA_UITiledRect,
TERRA_UIDimension;
Type
MyDemo = Class(DemoApplication)
Public
Procedure OnCreate; Override;
End;
Const
Content = 'This is a [i]link[/i] [color=darkviolet]example[/color], try clicking here:'+CrLf+'[url=www.pascalgameengine.com]Linky![/url]'+CrLf+CrLf+'[w]Wavy[/w] text test!';
Var
MyWnd, MyText:UIWidget;
{ Game }
Procedure MyDemo.OnCreate;
Begin
Inherited;
UITemplates.AddTemplate(UIWindowTemplate.Create('wnd_template', Engine.Textures.GetItem('ui_window'), 45, 28, 147, 98));
UITemplates.AddTemplate(UIButtonTemplate.Create('btn_template', Engine.Textures.GetItem('ui_button2'), 25, 10, 220, 37));
MyWnd := UIInstancedWidget.Create('mywnd', Self.GUI, UIPixels(0), UIPixels(0), 10, UIPixels(643), UIPixels(231), 'wnd_template');
MyWnd.Draggable := True;
MyWnd.Align := UIAlign_Center;
// MyWnd.Rotation := 45*RAD;
MyText := UILabel.Create('mytext', MyWnd, UIPixels(0), UIPixels(0), 1, UIPercent(100), UIPercent(60), Content);
MyText.Align := UIAlign_Center;
// MyBtn.SetPropertyValue('caption', 'custom caption!');
// MyBtn.Rotation := 45*RAD;
End;
{$IFDEF IPHONE}
Procedure StartGame; cdecl; export;
{$ENDIF}
Begin
MyDemo.Create();
{$IFDEF IPHONE}
End;
{$ENDIF}
End.
| 23.701493 | 176 | 0.721662 |
835f70eb4cdb5f5412f8fdd8c2156158882bf572 | 495 | pas | Pascal | Chapter 09/TLayout/Unit3.pas | atkins126/Delphi-GUI-Programming-with-FireMonkey- | d92b32d143762eb274f05e237c4a1b1876592add | [
"MIT"
]
| 24 | 2020-10-29T20:58:47.000Z | 2022-01-12T13:49:09.000Z | Chapter 09/TLayout/Unit3.pas | atkins126/Delphi-GUI-Programming-with-FireMonkey- | d92b32d143762eb274f05e237c4a1b1876592add | [
"MIT"
]
| 1 | 2021-05-22T07:00:36.000Z | 2021-05-22T07:00:36.000Z | Chapter 09/TLayout/Unit3.pas | atkins126/Delphi-GUI-Programming-with-FireMonkey- | d92b32d143762eb274f05e237c4a1b1876592add | [
"MIT"
]
| 7 | 2020-11-06T20:01:18.000Z | 2021-11-06T14:31:06.000Z | unit Unit3;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Layouts;
type
TForm3 = class(TForm)
RightColumnLayout: TLayout;
TopLayout: TLayout;
BottomLayout: TLayout;
MainLayout: TLayout;
RelativeLayout: TLayout;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.fmx}
end.
| 16.5 | 81 | 0.707071 |
4724c60cbe8e63f6cd8e8d3fd187174d3f742e9f | 167 | pas | Pascal | input/test19.pas | junaaaaloo/CMPILER-FINAL-MP | f2ab1e79e6c008eb6b4423777e95fa473f78f29b | [
"MIT"
]
| null | null | null | input/test19.pas | junaaaaloo/CMPILER-FINAL-MP | f2ab1e79e6c008eb6b4423777e95fa473f78f29b | [
"MIT"
]
| null | null | null | input/test19.pas | junaaaaloo/CMPILER-FINAL-MP | f2ab1e79e6c008eb6b4423777e95fa473f78f29b | [
"MIT"
]
| null | null | null | program main;
function getTimesThree(Z:real):real;
begin
writeln(Z);
getTimesThree := Z * 3.5;
end;
var i:real;
begin
writeLn('HUH');;;;;;;;
end. | 13.916667 | 36 | 0.592814 |
4721a7134e9f5265e5a9d92e24e5ce414245e3ab | 9,548 | pas | Pascal | Components/zeosold/dbase/ZMsSqlStoredProc.pas | winsys/ms | d35137fd1f0a5142e03c47345cdb81509b6d96e5 | [
"MIT"
]
| null | null | null | Components/zeosold/dbase/ZMsSqlStoredProc.pas | winsys/ms | d35137fd1f0a5142e03c47345cdb81509b6d96e5 | [
"MIT"
]
| null | null | null | Components/zeosold/dbase/ZMsSqlStoredProc.pas | winsys/ms | d35137fd1f0a5142e03c47345cdb81509b6d96e5 | [
"MIT"
]
| null | null | null | {********************************************************}
{ }
{ Zeos Database Objects }
{ MS SQL property editors }
{ }
{ Copyright (c) 1999-2001 Zeos Development Group }
{ }
{********************************************************}
unit ZMsSqlStoredProc;
//
// Todo: Alles moet netter
// Todo: Kijken of alle buffers goed gezet worden
// Todo: Kijken of alle fielddefs onthouden c.q. weggegooid worden
// Todo: Field editor creert de velden niet
interface
{$R *.dcr}
uses
SysUtils, Windows, Db, Classes, ZDirSql, ZDirMsSql, DbCommon,
ZMsSqlCon, ZMsSqlTr, ZToken, ZLibMsSql, ZSqlExtra, ZQuery,
ZSqlTypes, ZSqlItems, ZStoredProc;
{$INCLUDE ..\Zeos.inc}
type
TZCustomMsSqlStoredProc = class(TZStoredProc)
private
FMustClose: Boolean;
function GetDatabase: TZMsSqlDatabase;
function GetTransact: TZMsSqlTransact;
procedure SetDatabase(const Value: TZMsSqlDatabase);
procedure SetTransact(const Value: TZMsSqlTransact);
protected
procedure QueryRecord; override;
procedure GetAllParams(const spName: String); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ExecProc; override;
procedure AddTableFields(Table: string; SqlFields: TSqlFields);override;
procedure AddTableIndices(Table: string; SqlFields: TSqlFields;
SqlIndices: TSqlIndices); override;
published
property Database: TZMsSqlDatabase read GetDatabase write SetDatabase;
property Transaction: TZMsSqlTransact read GetTransact write SetTransact;
end;
TZMsSqlStoredProc = class(TZCustomMsSqlStoredProc)
published
property Active;
property Database;
property Transaction;
property StoredProcName;
property Params;
property ParamBindMode;
end;
implementation
uses ZExtra, ZDBaseConst, ZBlobStream, Math;
procedure TZCustomMsSqlStoredProc.AddTableFields(Table: string;
SqlFields: TSqlFields);
begin
//
end;
procedure TZCustomMsSqlStoredProc.AddTableIndices(Table: string;
SqlFields: TSqlFields; SqlIndices: TSqlIndices);
begin
//
end;
constructor TZCustomMsSqlStoredProc.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
// Query := TDirMsSqlQuery.Create(nil, nil);
StoredProc := TDirMsSqlStoredProc.Create(nil,nil);
DatabaseType := dtMsSql;
end;
destructor TZCustomMsSqlStoredProc.Destroy;
begin
inherited;
end;
procedure TZCustomMsSqlStoredProc.ExecProc;
begin
FMustClose := false;
inherited ExecProc;
if FMustClose then
StoredProc.Close;
end;
procedure TZCustomMsSqlStoredProc.GetAllParams(const spName: String);
var
AQuery: TDirMsSqlQuery;
WasConnected: Boolean;
begin
if (spName<>'') and assigned(Database) and assigned(Database.Handle)
and assigned(Transaction) and assigned(Transaction.Handle) then
{ begin
WasConnected := Database.Connected;
Database.Connect;
Transaction.Connect;
StoredProc.ShowParams(spName);
while not StoredProc.Eof do
begin
Params.CreateParam(MsSqlToDelphiTypeDesc(StoredProc.FieldByName('TYPE_NAME')),
StoredProc.FieldByName('COLUMN_NAME'),
MsSqlToDelphiParamType(StrToInt(StoredProc.FieldByName('COLUMN_TYPE'))));
StoredProc.Next;
end;
StoredProc.Close;
if not wasConnected then
Database.Disconnect;
end;
}
begin
AQuery := TDirMsSqlQuery.Create(TDirMsSqlConnect(Database.Handle),
TDirMsSqlTransact(Transaction.Handle));
try
WasConnected := Database.Connected;
Database.Connect;
AQuery.Sql := 'sp_sproc_columns '''+StoredProcName+'''';
AQuery.Open;
Params.Clear;
while not AQuery.Eof do
begin
Params.CreateParam(MsSqlToDelphiTypeDesc(AQuery.FieldByName('TYPE_NAME')),
AQuery.FieldByName('COLUMN_NAME'),
MsSqlToDelphiParamType(StrToInt(AQuery.FieldByName('COLUMN_TYPE'))));
AQuery.Next;
end;
AQuery.Close;
if not wasConnected then
Database.Disconnect;
finally
AQuery.Free;
end;
end;
end;
function TZCustomMsSqlStoredProc.GetDatabase: TZMsSqlDatabase;
begin
Result := TZMsSqlDatabase(DatabaseObj);
end;
function TZCustomMsSqlStoredProc.GetTransact: TZMsSqlTransact;
begin
Result := TZMsSqlTransact(TransactObj);
end;
procedure TZCustomMsSqlStoredProc.QueryRecord;
var
I, Count: Integer;
RecordData: PRecordData;
FieldDesc: PFieldDesc;
TempSmall: SmallInt;
TempDouble: Double;
TempBool: WordBool;
TempDate: DBDATETIME;
DateRec: DBDATEREC;
TempTime: TDateTime;
TimeStamp: TTimeStamp;
BlobPtr: PRecordBlob;
Cancel: Boolean;
begin
Count := SqlBuffer.Count;
while not StoredProc.Eof and (Count = SqlBuffer.Count) do
begin
{ Go to the record }
if SqlBuffer.FillCount > 0 then
StoredProc.Next;
{ Invoke OnProgress event }
if Assigned(OnProgress) then
begin
Cancel := False;
OnProgress(Self, psRunning, ppFetching, StoredProc.RecNo+1,
MaxIntValue([StoredProc.RecNo+1, StoredProc.RecordCount]), Cancel);
if Cancel then StoredProc.Close;
end;
if StoredProc.EOF then Break;
{ Getting record }
RecordData := SqlBuffer.Add;
for I := 0 to SqlBuffer.SqlFields.Count - 1 do
begin
FieldDesc := SqlBuffer.SqlFields[I];
if FieldDesc.FieldNo < 0 then Continue;
if StoredProc.FieldIsNull(FieldDesc.FieldNo) and
not (FieldDesc.FieldType in [ftBlob, ftMemo]) then
Continue;
case FieldDesc.FieldType of
ftString, ftBytes:
begin
SqlBuffer.SetFieldDataLen(FieldDesc, StoredProc.FieldBuffer(FieldDesc.FieldNo),
RecordData, StoredProc.FieldSize(FieldDesc.FieldNo));
end;
ftSmallInt:
begin
case StoredProc.FieldType(FieldDesc.FieldNo) of
SQLINT1:
TempSmall := PByte(StoredProc.FieldBuffer(FieldDesc.FieldNo))^;
SQLINT2:
TempSmall := PSmallInt(StoredProc.FieldBuffer(FieldDesc.FieldNo))^;
end;
SqlBuffer.SetFieldData(FieldDesc, @TempSmall, RecordData);
end;
ftBoolean:
begin
TempBool := (PByte(StoredProc.FieldBuffer(FieldDesc.FieldNo))^ <> 0);
SqlBuffer.SetFieldData(FieldDesc, @TempBool, RecordData);
end;
ftInteger, ftAutoInc:
begin
SqlBuffer.SetFieldData(FieldDesc, StoredProc.FieldBuffer(FieldDesc.FieldNo),
RecordData);
end;
ftFloat, ftCurrency:
begin
dbconvert(TDirMsSqlTransact(StoredProc.Transact).Handle,
StoredProc.FieldType(FieldDesc.FieldNo),
PByte(StoredProc.FieldBuffer(FieldDesc.FieldNo)),
StoredProc.FieldSize(FieldDesc.FieldNo),
SQLFLT8, @TempDouble, SizeOf(TempDouble));
SqlBuffer.SetFieldData(FieldDesc, @TempDouble, RecordData);
end;
ftDateTime:
begin
dbconvert(TDirMsSqlTransact(StoredProc.Transact).Handle,
StoredProc.FieldType(FieldDesc.FieldNo),
PByte(StoredProc.FieldBuffer(FieldDesc.FieldNo)),
StoredProc.FieldSize(FieldDesc.FieldNo),
SQLDATETIME, @TempDate, SizeOf(TempDate));
dbdatecrack(TDirMsSqlTransact(StoredProc.Transact).Handle,
@DateRec, @TempDate);
TimeStamp := DateTimeToTimeStamp(EncodeDate(DateRec.year,
DateRec.month, DateRec.day) + EncodeTime(DateRec.hour,
DateRec.minute, DateRec.second, DateRec.millisecond));
TempTime := TimeStampToMSecs(TimeStamp);
SqlBuffer.SetFieldData(FieldDesc, @TempTime, RecordData);
end;
ftBlob, ftMemo:
begin
{ Initialize blob and memo fields }
BlobPtr := PRecordBlob(@RecordData.Bytes[FieldDesc.Offset+1]);
BlobPtr.BlobType := btInternal;
{ Fill not null fields }
if not StoredProc.FieldIsNull(FieldDesc.FieldNo) then
begin
RecordData.Bytes[FieldDesc.Offset] := 0;
BlobPtr.Size := StoredProc.FieldSize(FieldDesc.FieldNo);
BlobPtr.Data := AllocMem(BlobPtr.Size);
System.Move(StoredProc.FieldBuffer(FieldDesc.FieldNo)^, BlobPtr.Data^,
BlobPtr.Size);
end
{ Fill null fields }
else
begin
BlobPtr.Size := 0;
BlobPtr.Data := nil;
end;
end;
else
DatabaseError(SUnknownType + FieldDesc.Alias);
end;
end;
{ Filter received record }
SqlBuffer.FilterItem(SqlBuffer.Count-1);
end;
if StoredProc.Eof then //pas na getting result
FMustClose := true;
end;
procedure TZCustomMsSqlStoredProc.SetDatabase(
const Value: TZMsSqlDatabase);
begin
inherited SetDatabase(Value);
if assigned(Value) then
StoredProc.Connect := Value.Handle
else
StoredProc.Connect := nil;
end;
procedure TZCustomMsSqlStoredProc.SetTransact(
const Value: TZMsSqlTransact);
begin
inherited SetTransact(Value);
if Assigned(Value) then
StoredProc.Transact := Value.Handle
else
StoredProc.Transact := nil;
end;
end.
| 31.304918 | 100 | 0.647465 |
475091fe3d356422735c921b7ad54a951c2d8efb | 883 | pas | Pascal | OJs/HKOI/DSE Exercises/D107/squareAndTriangularNumbers.pas | sailinglove/personal-general | b2e932dcd7989bdf856d4852e38f96cbbfc9c907 | [
"MIT"
]
| 1 | 2020-06-19T11:47:23.000Z | 2020-06-19T11:47:23.000Z | OJs/HKOI/DSE Exercises/D107/squareAndTriangularNumbers.pas | SailorWontSink/personal-general | 664ccca1cf8308e764742b8f19d1b7e3ad42946c | [
"MIT"
]
| null | null | null | OJs/HKOI/DSE Exercises/D107/squareAndTriangularNumbers.pas | SailorWontSink/personal-general | 664ccca1cf8308e764742b8f19d1b7e3ad42946c | [
"MIT"
]
| null | null | null | program squareAndTriangularNumbers;
var
input : LongInt;
ifSq, ifTri : Boolean;
function chkSquare(num : LongInt) : Boolean;
var
i, t : LongInt;
begin
i := 0; chkSquare := False;
repeat
Inc(i);
t := i * i;
// WriteLn(t:3, num:3);
if t = num then
chkSquare := True;
until t >= num;
end;
function chkTri(num : LongInt) : Boolean;
var
i, t : LongInt;
begin
i := 0; t := 0; chkTri := False;
repeat
Inc(i);
t := t + i;
// WriteLn(t);
if t = num then
chkTri := True;
until t >= num;
end;
begin
ReadLn(input);
ifSq := chkSquare(input);
// WriteLn(ifSq);
ifTri := chkTri(input);
// WriteLn(ifTri);
if ifSq and ifTri then
WriteLn('Both');
if ifSq and not ifTri then
WriteLn('Square');
if ifTri and not ifSq then
WriteLn('Triangular');
if not ifSq and not ifTri then
WriteLn('Neither');
end. | 18.020408 | 44 | 0.592299 |
f1f5ccd2115131e8aedc204b695365196c011fe1 | 6,083 | pas | Pascal | zip.pas | adaloveless/commonx | ed37b239e925119c7ceb3ac7949eefb0259c7f77 | [
"MIT"
]
| 48 | 2018-11-19T22:13:00.000Z | 2021-11-02T17:25:41.000Z | zip.pas | adaloveless/commonx | ed37b239e925119c7ceb3ac7949eefb0259c7f77 | [
"MIT"
]
| 6 | 2018-11-24T17:15:29.000Z | 2019-05-15T14:59:56.000Z | zip.pas | adaloveless/commonx | ed37b239e925119c7ceb3ac7949eefb0259c7f77 | [
"MIT"
]
| 12 | 2018-11-20T15:15:44.000Z | 2021-09-14T10:12:43.000Z | unit zip;
{$I DelphiDefs.inc}
interface
uses
typex,
{$IFDEF WINDOWS}
activex,
comobj,
{$ENDIF}
commandprocessor, stringx, sysutils,zlib, classes, memoryfilestream, helpers_stream, systemx;
const
SHCONTCH_NOPROGRESSBOX = 4;
SHCONTCH_AUTORENAME = 8;
SHCONTCH_RESPONDYESTOALL = 16;
SHCONTF_INCLUDEHIDDEN = 128;
SHCONTF_FOLDERS = 32;
SHCONTF_NONFOLDERS = 64;
{$IFDEF WINDOWS}
function ShellUnzip(const zipfile, targetfolder: string; filter: string = ''): boolean;
{$ENDIF}
type
{$IFDEF WINDOWS}
Tcmd_ShellUnzip = class(TCommand)
private
FZipFile: string;
FTargetFolder: string;
public
procedure Initexpense;override;
procedure DoExecute;override;
property ZipFile: string read FZipFile write FZipFile;
property TargetFolder: string read FTargetFolder write FTargetFolder;
end;
{$ENDIF}
Tcmd_ZipRam = class(TCommand)
private
public
psource: pbyte;
pdest: pbyte;
sourcelen: nativeint;
destlen: nativeint;
resultlen: nativeint;
procedure DoExecute;override;
class function BeginZipRam(pSource, pDest: pbyte; sourcelen: nativeint; destlen: nativeint): Tcmd_ZipRam;
class function EndZipRam(c: Tcmd_ZipRam):nativeint;
end;
procedure ZZip(sSource, sDest: string);
procedure ZUnZip(sSource, sDest: string);
function ZipRam(pSource, pDest: pbyte; sourcelen: nativeint; destlen: nativeint; prog: PProgress): nativeint;
function UnZipRam(pSource, pDest: pbyte; sourcelen: nativeint; destlen: nativeint; prog: PProgress): nativeint;
function ZCompressStrA(const s: ansistring; level: TZCompressionLevel): TBytes; overload;
function ZDecompressStrA(const s: TBytes): ansistring;
implementation
{$IFDEF WINDOWS}
function ShellUnzip(const zipfile, targetfolder: string; filter: string = ''): boolean;
var
shellobj: olevariant;
srcfldr, destfldr: olevariant;
shellfldritems: olevariant;
vstr1, vstr2: olevariant;
begin
shellobj := CreateOleObject('Shell.Application');
vstr1 := CleanupParentsInPath(zipfile);
vstr2 := CleanupParentsInPath(targetfolder);
srcfldr := shellobj.NameSpace(vstr1);
forcedirectories(vstr2);
destfldr := shellobj.NameSpace(vstr2);
shellfldritems := srcfldr.Items;
if (filter <> '') then
shellfldritems.Filter(SHCONTF_INCLUDEHIDDEN or SHCONTF_NONFOLDERS or SHCONTF_FOLDERS,filter);
destfldr.CopyHere(shellfldritems, SHCONTCH_NOPROGRESSBOX or SHCONTCH_RESPONDYESTOALL);
result := true;
end;
{ Tcmd_ShellUnzip }
procedure Tcmd_ShellUnzip.DoExecute;
begin
inherited;
CoInitialize(nil);
ShellUnzip(zipfile, targetfolder);
end;
procedure Tcmd_ShellUnzip.Initexpense;
begin
inherited;
CpuExpense := 0.5;
end;
{$ENDIF}
function ZipRam(pSource, pDest: pbyte; sourcelen: nativeint; destlen: nativeint; prog: PProgress): nativeint;
var
cs: TCompressionStream;
ms: TMemoryStream;
begin
try
ms := TMemoryStream.Create;
try
cs := TCompressionStream.create(ms);
try
Stream_GuaranteeWrite(cs, pSource, sourcelen, prog);
finally
cs.free;
end;
{$IFDEF APPLE}
ms.Seek(int64(0),TSeekOrigin.soBeginning);
{$ELSE}
ms.Seek(0,0);
{$ENDIF}
if destlen >= ms.size then begin
movemem32(pDest, pbyte(ms.memory), ms.Size);
result := ms.Size;
end else begin
result := -1;
end;
finally
ms.Free;
end;
finally
end;
end;
function UnZipRam(pSource, pDest: pbyte; sourcelen: nativeint; destlen: nativeint; prog: PProgress): nativeint;
var
cs: TDeCompressionStream;
ms,ms2: TMemoryStream;
begin
try
ms := TMemoryStream.Create;
ms2 := TMemoryStream.Create;
try
cs := TDeCompressionStream.create(ms);
try
Stream_GuaranteeWrite(ms, pSource, sourcelen);
Stream_GuaranteeCopy(cs, ms2, prog, cs.Size);
finally
cs.free;
end;
ms2.Seek(int64(0),TSeekOrigin.soBeginning);
if destlen >= ms2.size then begin
movemem32(pDest, pbyte(ms2.memory), ms2.Size);
result := ms2.Size;
end else begin
result := 0-ms2.size;
end;
finally
ms.Free;
ms2.Free;
end;
finally
end;
end;
procedure ZZip(sSource, sDest: string);
var
cs: TCompressionStream;
s: TFileStream;
sTarget: TFileStream;
begin
s := TFileStream.create(sSource, fmOpenRead+fmShareDenyWrite);
try
sTarget := TFileStream.create(sDest, fmCreate);
try
cs := TCompressionStream.create(sTarget);
try
cs.CopyFrom(s, s.Size);
finally
cs.free;
end;
finally
sTarget.free;
end;
finally
s.free;
end;
end;
procedure ZunZip(sSource, sDest: string);
var
cs: TDeCompressionStream;
s: TFileStream;
sTarget: TFileStream;
begin
s := TFileStream.create(sSource, fmOpenRead+fmShareDenyWrite);
try
sTarget := TFileStream.create(sDest, fmCreate);
try
cs := TDeCompressionStream.create(s);
try
Stream_GuaranteeCopy(cs, sTarget);
// cs.CopyFrom(s, s.Size);
finally
cs.free;
end;
finally
sTarget.free;
end;
finally
s.free;
end;
end;
{ Tcmd_ZipRam }
class function Tcmd_ZipRam.BeginZipRam(pSource, pDest: pbyte; sourcelen,
destlen: nativeint): Tcmd_ZipRam;
begin
result := Tcmd_ZipRam.create;
result.psource := psource;
result.pdest := pdest;
result.sourcelen := sourcelen;
result.destlen := destlen;
result.start;
end;
procedure Tcmd_ZipRam.DoExecute;
begin
inherited;
resultlen := zipram(psource, pdest, sourcelen, destlen, @self.volatile_progress);
end;
class function Tcmd_ZipRam.EndZipRam(c: Tcmd_ZipRam): nativeint;
begin
c.waitfor;
result := c.resultlen;
c.detachandfree;
c := nil;
end;
function ZCompressStrA(const s: ansistring; level: TZCompressionLevel): TBytes; overload;
var
b: TBytes;
begin
b := AnsiStringToTBytes(s);
setlength(result, length(b)*3);
system.zlib.ZCompress(b, result, level);
end;
function ZDecompressStrA(const s: TBytes): ansistring;
var
b: TBytes;
begin
system.zlib.ZDeCompress(s, b);
result := BytesToAnsiString(b);
end;
end.
| 22.363971 | 111 | 0.699326 |
470ec6db561414d9afb6420f7c26afafa01dbdfd | 1,274 | pas | Pascal | src/libraries/cryptolib4pascal/ClpIXSalsa20Engine.pas | rabarbers/PascalCoin | 7a87031bc10a3e1d9461dfed3c61036047ce4fb0 | [
"MIT"
]
| 384 | 2016-07-16T10:07:28.000Z | 2021-12-29T11:22:56.000Z | src/libraries/cryptolib4pascal/ClpIXSalsa20Engine.pas | rabarbers/PascalCoin | 7a87031bc10a3e1d9461dfed3c61036047ce4fb0 | [
"MIT"
]
| 165 | 2016-09-11T11:06:04.000Z | 2021-12-05T23:31:55.000Z | src/libraries/cryptolib4pascal/ClpIXSalsa20Engine.pas | rabarbers/PascalCoin | 7a87031bc10a3e1d9461dfed3c61036047ce4fb0 | [
"MIT"
]
| 210 | 2016-08-26T14:49:47.000Z | 2022-02-22T18:06:33.000Z | { *********************************************************************************** }
{ * 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 ClpIXSalsa20Engine;
{$I CryptoLib.inc}
interface
uses
ClpISalsa20Engine;
type
IXSalsa20Engine = interface(ISalsa20Engine)
['{D95969E8-EAB0-4D2D-8542-40B55925F68D}']
end;
implementation
end.
| 34.432432 | 87 | 0.357143 |
f1b4eef0643a4cdfa2c2f16d6178c97782a905a0 | 4,341 | pas | Pascal | sources/MVCFramework.Middleware.Compression.pas | segovoni/delphimvcframework | f48fddecbf31b9bed4456bd44a9aaba813cfaa7f | [
"Apache-2.0"
]
| null | null | null | sources/MVCFramework.Middleware.Compression.pas | segovoni/delphimvcframework | f48fddecbf31b9bed4456bd44a9aaba813cfaa7f | [
"Apache-2.0"
]
| null | null | null | sources/MVCFramework.Middleware.Compression.pas | segovoni/delphimvcframework | f48fddecbf31b9bed4456bd44a9aaba813cfaa7f | [
"Apache-2.0"
]
| null | null | null | // ***************************************************************************
//
// Delphi MVC Framework
//
// Copyright (c) 2010-2019 Daniele Teti and the DMVCFramework Team
//
// https://github.com/danieleteti/delphimvcframework
//
// ***************************************************************************
//
// 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 MVCFramework.Middleware.Compression;
{$I dmvcframework.inc}
interface
uses
MVCFramework,
MVCFramework.Logger;
type
TMVCCompressionMiddleware = class(TInterfacedObject, IMVCMiddleware)
private
fCompressionThreshold: Integer;
protected
procedure OnAfterControllerAction(Context: TWebContext; const AActionNAme: string;
const Handled: Boolean);
procedure OnBeforeRouting(Context: TWebContext; var Handled: Boolean);
procedure OnBeforeControllerAction(Context: TWebContext;
const AControllerQualifiedClassName: string; const AActionNAme: string; var Handled: Boolean);
public
constructor Create(aCompressionThreshold: Integer = 1024); virtual;
end;
implementation
uses
System.SysUtils,
System.ZLib,
System.Classes,
MVCFramework.Commons;
{ TMVCSalutationMiddleware }
constructor TMVCCompressionMiddleware.Create(aCompressionThreshold: Integer);
begin
inherited Create;
fCompressionThreshold := aCompressionThreshold;
end;
procedure TMVCCompressionMiddleware.OnAfterControllerAction(Context: TWebContext;
const AActionNAme: string; const Handled: Boolean);
var
lMemStream: TMemoryStream;
lContentStream: TStream;
lAcceptEncoding: string;
lEncodings: TArray<string>;
lItem: string;
lZStream: TZCompressionStream;
lRespCompressionType: TMVCCompressionType;
lTmpItem: string;
begin
lContentStream := Context.Response.RawWebResponse.ContentStream;
if (lContentStream = nil) or (lContentStream is TFileStream) or (lContentStream.Size <= fCompressionThreshold) then
Exit;
lAcceptEncoding := Context.Request.Headers['Accept-Encoding'];
if lAcceptEncoding.IsEmpty then
begin
Exit;
end;
lAcceptEncoding := lAcceptEncoding.Trim.ToLower;
lRespCompressionType := TMVCCompressionType.ctNone;
lEncodings := lAcceptEncoding.Split([',']);
for lItem in lEncodings do
begin
lTmpItem := lItem.Trim;
if lTmpItem = 'gzip' then
begin
lRespCompressionType := TMVCCompressionType.ctGZIP;
break;
end
else if lTmpItem = 'deflate' then
begin
lRespCompressionType := TMVCCompressionType.ctDeflate;
break;
end;
end;
if lRespCompressionType = TMVCCompressionType.ctNone then
Exit;
lContentStream.Position := 0;
lMemStream := TMemoryStream.Create;
try
{TODO -oDanieleT -cGeneral : Use directly lContentStream?}
lZStream := TZCompressionStream.Create(lMemStream, TZCompressionLevel.zcMax, MVC_COMPRESSION_ZLIB_WINDOW_BITS[lRespCompressionType]);
try
lZStream.CopyFrom(lContentStream, 0);
finally
lZStream.Free;
end;
lMemStream.Position := 0;
Context.Response.Content := '';
lContentStream.Size := 0;
lContentStream.CopyFrom(lMemStream, 0);
{$IF Defined(SeattleOrBetter)}
Context.Response.RawWebResponse.ContentEncoding := MVC_COMPRESSION_TYPE_AS_STRING[lRespCompressionType];
{$ELSE}
Context.Response.RawWebResponse.ContentEncoding := AnsiString(MVC_COMPRESSION_TYPE_AS_STRING[lRespCompressionType]);
{$ENDIF}
finally
lMemStream.Free;
end;
end;
procedure TMVCCompressionMiddleware.OnBeforeControllerAction(Context: TWebContext;
const AControllerQualifiedClassName, AActionNAme: string; var Handled: Boolean);
begin
// do nothing
end;
procedure TMVCCompressionMiddleware.OnBeforeRouting(Context: TWebContext; var Handled: Boolean);
begin
// do nothing
end;
end.
| 29.937931 | 137 | 0.720802 |
475ccb855db9f8efb2af0e7a2eb0ebb50c64b8a5 | 20,590 | dfm | Pascal | HWSserver/source/uadm_vlrModaux.dfm | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| 1 | 2022-02-28T11:28:18.000Z | 2022-02-28T11:28:18.000Z | HWSserver/source/uadm_vlrModaux.dfm | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| null | null | null | HWSserver/source/uadm_vlrModaux.dfm | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| null | null | null | object adm_vlrModaux: Tadm_vlrModaux
Left = 187
Top = 195
BorderStyle = bsNone
ClientHeight = 392
ClientWidth = 735
Color = 16119285
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnClose = FormClose
OnCreate = FormCreate
OnMouseDown = FormMouseDown
OnMouseMove = FormMouseMove
OnMouseUp = FormMouseUp
OnResize = FormResize
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 0
Top = 20
Width = 735
Height = 355
Align = alClient
BevelInner = bvRaised
BevelOuter = bvLowered
BorderStyle = bsSingle
Color = 16119285
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -9
Font.Name = 'Verdana'
Font.Style = []
ParentFont = False
TabOrder = 0
object PageControl1: TPageControl
Left = 2
Top = 2
Width = 382
Height = 347
Align = alClient
Style = tsFlatButtons
TabOrder = 0
end
object GroupBox1: TGroupBox
Left = 384
Top = 2
Width = 345
Height = 347
Align = alRight
Caption = 'Ficha:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -9
Font.Name = 'Verdana'
Font.Style = []
ParentFont = False
TabOrder = 1
object ScrollBox1: TScrollBox
Left = 2
Top = 14
Width = 341
Height = 302
Align = alClient
BevelInner = bvNone
BevelOuter = bvNone
BorderStyle = bsNone
TabOrder = 0
object Panel2: TPanel
Left = 0
Top = 0
Width = 325
Height = 289
BevelOuter = bvNone
Color = 16119285
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -9
Font.Name = 'Verdana'
Font.Style = []
ParentFont = False
TabOrder = 0
object Label1: TLabel
Left = 76
Top = 86
Width = 94
Height = 12
Caption = 'Selecione a Moeda'
end
object lbcp1: TLabeledEdit
Left = 7
Top = 21
Width = 135
Height = 20
TabStop = False
Color = 16119285
EditLabel.Width = 35
EditLabel.Height = 12
EditLabel.Caption = 'C'#243'digo'
ReadOnly = True
TabOrder = 0
end
object lbcp2: TLabeledEdit
Left = 8
Top = 62
Width = 316
Height = 20
TabStop = False
Color = 16119285
EditLabel.Width = 51
EditLabel.Height = 12
EditLabel.Caption = 'Descri'#231#227'o'
MaxLength = 255
ReadOnly = True
TabOrder = 1
end
object lbcp3: TLabeledEdit
Left = 9
Top = 100
Width = 65
Height = 20
CharCase = ecUpperCase
EditLabel.Width = 25
EditLabel.Height = 12
EditLabel.Caption = 'Sigla'
MaxLength = 3
TabOrder = 2
OnChange = lbcp3Change
end
object lbcp4: TComboBox
Left = 75
Top = 100
Width = 248
Height = 20
ItemHeight = 12
MaxLength = 255
TabOrder = 3
OnChange = lbcp4Change
end
object lbcp5: TLabeledEdit
Left = 9
Top = 148
Width = 160
Height = 20
CharCase = ecUpperCase
EditLabel.Width = 84
EditLabel.Height = 12
EditLabel.Caption = 'Valor Instala'#231#227'o'
TabOrder = 4
OnKeyPress = NumKeyPress
end
object lbcp6: TLabeledEdit
Left = 9
Top = 188
Width = 160
Height = 20
CharCase = ecUpperCase
EditLabel.Width = 66
EditLabel.Height = 12
EditLabel.Caption = 'Valor Mensal'
TabOrder = 5
OnKeyPress = NumKeyPress
end
end
end
object ToolBar1: TToolBar
Left = 2
Top = 316
Width = 341
Height = 29
Align = alBottom
Caption = 'ToolBar1'
TabOrder = 1
object bt_prior: TSpeedButton
Left = 0
Top = 2
Width = 24
Height = 22
Hint = 'Registro anterior'
Flat = True
Glyph.Data = {
9E030000424D9E03000000000000360200002800000012000000120000000100
08000000000068010000120B0000120B00008000000000000000905D4900D88D
660000FF0000F8C2A400A4878000B0836100E7A88200B4ABA700FFEDDE00B562
4600C8846100D4997200F7AC8600FFF8F5009B6A5A00FED7C100C0C1BF00C080
6200BD714D00E49C7400AC978800FFE0D300FCB58F0092706000C3936900A786
7D00AA715800E5AC8500C7775A00D7946D00E3A57C00E09F7800FFF3E700A47C
7000F9B48C00FFDCCF00A7948500BFC4C200A68A6B00CF886300F0AF8900BAB1
AD00DD926C00B17F6300B59F8D00CE9772008C615200AA927E009E7B5900FFF7
FF00E39E7D00C08E6A00FDB69400FEE8DD00EEA78100F7B08B00FDDEC900FFF0
E700BDC2C000B0A18E00F0B18500E1977300BD765100BD6D4E00C28C6B00E9B3
8A00AA8E83008C6B5200D1856800A1756400EBA37B00D88C6800B58B6100FEE4
D600977C6800DD9D7400FFFFFF00E1A77D00BBB6AD00AD9B8A00CC996600C5C5
C500EB9F7B00C2755500E6A58C00C37C5A00D6947300FFD8C600FEF5F200AF98
8200AA868000D1835F00FDFCF800C2BFBB0096634F00C2C3BF00ECB48B00FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000616161616161
616161616161616161616161000061616161610704172E434A24296161616161
000061616110191A2D4D4D1F0B2D2B4F3A616161000061615D2111601E1D2A2A
2A4B4B332F256161000061615A40414B3E3F231B012A1313404F616100006107
1A1B4B12093857572A3D13524B054E6100006119561F530957235C01012A3D46
36182C610000610E1E0A0957235C53531C1C44520C322661000061001F555757
4949352020202020282830610000615E4B272038155C5C4C4C4C4C1537373061
000061450B2A5B5835353D46360C3716160626610000614240132A470D393936
0C373434342D2C61000061292B1313133D310808373434343C334E6100006161
144032363636080316161616183B6161000061615F2F33320C0C223434342818
595161610000616161514F0518322222062D482C51616161000061616161614E
4F263030263B4E61616161610000616161616161616161616161616161616161
0000}
ParentShowHint = False
ShowHint = True
OnClick = bt_priorClick
end
object bt_next: TSpeedButton
Left = 24
Top = 2
Width = 24
Height = 22
Hint = 'Pr'#243'ximo registro'
Flat = True
Glyph.Data = {
9E030000424D9E03000000000000360200002800000012000000120000000100
08000000000068010000120B0000120B00008000000000000000905D4900D88D
660000FF0000F8C2A400A4878000B0836100E7A88200B4ABA700FFEDDE00B562
4600C8846100D4997200F7AC8600FFF8F5009B6A5A00FED7C100C0C1BF00C080
6200BD714D00E49C7400AC978800FFE0D300FCB58F0092706000C3936900A786
7D00AA715800E5AC8500C7775A00D7946D00E3A57C00E09F7800FFF3E700A47C
7000F9B48C00FFDCCF00A7948500BFC4C200A68A6B00CF886300F0AF8900BAB1
AD00DD926C00B17F6300B59F8D00CE9772008C615200AA927E009E7B5900FFF7
FF00E39E7D00C08E6A00FDB69400FEE8DD00EEA78100F7B08B00FDDEC900FFF0
E700BDC2C000B0A18E00F0B18500E1977300BD765100BD6D4E00C28C6B00E9B3
8A00AA8E83008C6B5200D1856800A1756400EBA37B00D88C6800B58B6100FEE4
D600977C6800DD9D7400FFFFFF00E1A77D00BBB6AD00AD9B8A00CC996600C5C5
C500EB9F7B00C2755500E6A58C00C37C5A00D6947300FFD8C600FEF5F200AF98
8200AA868000D1835F00FDFCF800C2BFBB0096634F00C2C3BF00ECB48B00FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000616161616161
6161616161616161616161610000616161616129244A432E1704076161616161
00006161613A4F2B2D0B1F4D4D2D1A191061616100006161252F334B4B2A2A2A
1D1E6011215D6161000061614F4013132A011B233F3E4B41405A61610000614E
054B52133D2A57573809124B1B1A07610000612C1836463D2A01015C23570953
1F56196100006126320C52441C1C53535C2357090A1E0E610000613028282020
2020203549495757551F0061000061303737154C4C4C4C5C5C153820274B5E61
00006126061616370C36463D3535585B2A0B45610000612C2D343434370C3639
390D472A134042610000614E333C343434370808313D1313132B296100006161
3B1816161616030836363632401461610000616151591828343434220C0C3233
2F5F61610000616161512C482D0622223218054F51616161000061616161614E
3B263030264F4E61616161610000616161616161616161616161616161616161
0000}
ParentShowHint = False
ShowHint = True
OnClick = bt_nextClick
end
object Panel3: TPanel
Left = 48
Top = 2
Width = 180
Height = 22
BevelOuter = bvNone
ParentColor = True
TabOrder = 0
end
object bt_save: TSpeedButton
Left = 228
Top = 2
Width = 111
Height = 22
Hint = 'Gravar dados do regsistro'
Caption = 'Gravar'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
Glyph.Data = {
1E020000424D1E02000000000000B60000002800000014000000120000000100
08000000000068010000120B0000120B00002000000000000000FFFFFF00FFF9
EC00EDEDED00F7ECD800F2E7D300F0E4D000EBD8B600D9C8AB00C7B49200C2AF
8D00BFAC8A00BAA78500B7A48200B4A17F0099999900AF9C7A00A18E6C008673
5100A06C4800806D4B006D5A38006E502F005C4927004E392100140D0000FFFF
FF00000000000000000000000000000000000000000000000000191919191919
1919191919191919191919191919191919191919190E0E0E0E0E0E0E0E0E0E0E
0E191919191919191217171515151515151717170E19191919191919120B0F00
0202020202160C170E19191919191919120B0F00130A000202160C170E191919
190E0E0E120A0D001413000202160C170E1919191217171512090D0000000000
00160C170E191919120B0F001208080C0C0C0C0C0C0C0C170E191919120B0F00
120801030303030405110C170E191919120A0D00120801030303030405110717
0E19191912090D001208010303030304051810170E1919191208080C12060101
0101010101140B170E1919191208010312121212121212121212121219191919
1208010303030304051107170E19191919191919120801030303030405181017
0E19191919191919120601010101010101140B170E1919191919191912121212
1212121212121212191919191919191919191919191919191919191919191919
1919}
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = bt_saveClick
end
end
end
object GroupBox2: TGroupBox
Left = 2
Top = 2
Width = 382
Height = 347
Align = alClient
Caption = 'Lista de registros:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -9
Font.Name = 'Verdana'
Font.Style = []
ParentFont = False
TabOrder = 2
object DBGrid1: TDBGrid
Left = 2
Top = 47
Width = 378
Height = 269
Align = alClient
Color = clWhite
DataSource = dm.source_sql
FixedColor = 15066597
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -9
Font.Name = 'Verdana'
Font.Style = []
Options = [dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgRowSelect, dgConfirmDelete, dgCancelOnExit]
ParentFont = False
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clBlack
TitleFont.Height = -9
TitleFont.Name = 'Verdana'
TitleFont.Style = []
OnCellClick = DBGrid1CellClick
OnKeyDown = DBGrid1KeyDown
OnKeyUp = DBGrid1KeyUp
end
object Panel_search: TPanel
Left = 2
Top = 14
Width = 378
Height = 33
Align = alTop
BevelOuter = bvNone
Color = 16119285
TabOrder = 1
object Label3: TLabel
Left = 6
Top = 0
Width = 49
Height = 12
Caption = 'Localizar:'
end
object Label4: TLabel
Left = 221
Top = -1
Width = 39
Height = 12
Caption = 'Campo:'
end
object bt_search: TSpeedButton
Left = 352
Top = 10
Width = 24
Height = 22
Hint = 'Localizar'
Flat = True
Glyph.Data = {
8A020000424D8A02000000000000360100002800000011000000110000000100
08000000000054010000120B0000120B0000400000000000000060412A00FFB3
7800A4988F0085695200DED8D300D5C4B200F5DDBF006E554300BEB2A9008C78
6A00FFDCAE00FFEDD600B7ABA200EEEEEE008B746400CCCCCC009D979200FCEA
D40080604500D5BB9E00FFE4C100C6C6C600FFF6EA00E7E7E700FFC78E00FFF7
C500BF9D780077615100BBBBBB0086706000997C6100FFDDB20098847600F5EC
E100FFE8CB00D4D4D400DEDEDE00705745007B685800FCDFBC00FFF1DF00FFE3
AE00B6B6B600D5C8BC0080624800FFE6C4007A645300856D5A00D5BCA100BFA0
800091847B00FBF4EB00755E4E00F9E1C300FFFFFF0000000000000000000000
000000000000000000000000000000000000000000000000000036360D363636
36363636363636363636360000003623150F2436363636363636363636363600
00001D0007101C24363636363636363636363600000000191900101C24363636
363636363636360000002E29292900100F17360D0D0D36363636360000000400
181818072A0F0F1515150F240D3636000000360400010100321B25000034321C
230D360000003636042E00012F2B3333332B2F261C2436000000363636360C2F
212828282828212F320F36000000363636361D050B000B0B0B000B0534150D00
0000363636362E112200222222002211001C1700000036363636002D2D2C1E1E
1E2C141400150D00000036363636002D2731002700312735000F360000003636
36360E301F1F121F121F1F302E2436000000363636360803350A1A001A0A0603
020D360000003636363636200313270A271303090D3636000000363636363636
080E0000001D0C36363636000000}
ParentShowHint = False
ShowHint = True
OnClick = bt_searchClick
end
object Edit_search: TEdit
Left = 3
Top = 12
Width = 214
Height = 20
MaxLength = 255
TabOrder = 0
OnChange = Edit_searchChange
OnKeyPress = Edit_searchKeyPress
end
object ComboBox_search: TComboBox
Left = 219
Top = 12
Width = 132
Height = 20
ItemHeight = 12
MaxLength = 255
TabOrder = 1
OnChange = ComboBox_searchChange
end
end
object ToolBar2: TToolBar
Left = 2
Top = 316
Width = 378
Height = 29
Align = alBottom
Caption = 'ToolBar1'
TabOrder = 2
object Label5: TLabel
Left = 0
Top = 2
Width = 106
Height = 22
Alignment = taRightJustify
AutoSize = False
Caption = 'Total de Registros: '
Layout = tlCenter
end
object Lb_countreg: TLabel
Left = 106
Top = 2
Width = 91
Height = 22
AutoSize = False
Caption = '0'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -9
Font.Name = 'Verdana'
Font.Style = [fsBold]
ParentFont = False
Layout = tlCenter
end
end
end
end
object pn_tit: TPanel
Left = 0
Top = 0
Width = 735
Height = 20
Align = alTop
Color = 14540253
TabOrder = 1
object Image3: TImage
Left = 1
Top = 1
Width = 733
Height = 18
Align = alClient
Stretch = True
OnMouseDown = FormMouseDown
end
object bt_fechar: TSpeedButton
Left = 718
Top = 3
Width = 14
Height = 14
Hint = 'Fechar janela'
Caption = 'X'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = [fsBold]
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = bt_fecharClick
end
object bt_sobre: TSpeedButton
Left = 672
Top = 3
Width = 14
Height = 14
Hint = 'Sobre'
Caption = '?'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Verdana'
Font.Style = [fsBold]
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = bt_sobreClick
end
object YuSoftLabel2: TYuSoftLabel
Left = 28
Top = 3
Width = 265
Height = 13
Cursor = crHandPoint
Hint = 'Website'
Alignment = taCenter
Caption = 'Lista de pre'#231'os para m'#243'dulos Administradores'
DragCursor = crHandPoint
Font.Charset = DEFAULT_CHARSET
Font.Color = 5979648
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = YuSoftLabel2Click
OnMouseEnterState.Active = True
OnMouseEnterState.BorderColor = clBtnHighlight
OnMouseEnterState.BorderWidth = 1
OnMouseEnterState.TextStyle = tsNone
OnMouseEnterState.ShadowColor = clBtnShadow
OnMouseEnterState.ShadowWidth = 0
OnClickState.Active = False
OnClickState.BorderColor = clBtnHighlight
OnClickState.BorderWidth = 0
OnClickState.TextStyle = tsNone
OnClickState.ShadowColor = clBtnShadow
OnClickState.ShadowWidth = 0
OnExtendedState.Active = True
OnExtendedState.BorderColor = clBtnHighlight
OnExtendedState.BorderWidth = 0
OnExtendedState.TextStyle = tsNone
OnExtendedState.ShadowColor = clBtnShadow
OnExtendedState.ShadowWidth = 0
Transparent = True
end
object biSystemMenu: TImage
Left = 4
Top = 3
Width = 15
Height = 14
Proportional = True
Stretch = True
Transparent = True
end
object bt_minimize: TSpeedButton
Left = 687
Top = 3
Width = 14
Height = 14
Hint = 'Minimizar janela'
Caption = '-'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Verdana'
Font.Style = [fsBold]
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = bt_minimizeClick
end
object bt_maximiza: TSpeedButton
Left = 703
Top = 3
Width = 14
Height = 14
Hint = 'Maximizar'
Caption = #143
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = [fsBold]
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = bt_maximizaClick
end
end
object pn_status: TPanel
Left = 0
Top = 375
Width = 735
Height = 17
Align = alBottom
BorderStyle = bsSingle
Color = 14540253
TabOrder = 2
object Image4: TImage
Left = 1
Top = 1
Width = 729
Height = 11
Align = alClient
Stretch = True
end
end
object XPManifest1: TXPManifest
Left = 533
Top = 71
end
end
| 32.996795 | 135 | 0.633171 |
f1ff364463832575081062ff34b11640f6c5da66 | 1,162 | pas | Pascal | md5/backup/unit1.pas | gebony/Gebo-hash | 1b13103804fab48f1a1a5fd6f31ac11d982d0d72 | [
"BSD-2-Clause"
]
| null | null | null | md5/backup/unit1.pas | gebony/Gebo-hash | 1b13103804fab48f1a1a5fd6f31ac11d982d0d72 | [
"BSD-2-Clause"
]
| null | null | null | md5/backup/unit1.pas | gebony/Gebo-hash | 1b13103804fab48f1a1a5fd6f31ac11d982d0d72 | [
"BSD-2-Clause"
]
| 1 | 2022-02-14T09:18:31.000Z | 2022-02-14T09:18:31.000Z | unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,md5,about;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Edit1: TEdit;
Edit2: TEdit;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
filepath:String;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button2Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
filepath:=OpenDialog1.FileName;
Edit1.text:=MD5Print(MD5File(filepath));
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
about.Form2.ShowModal;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
if (Edit1.text=Edit2.text) then
Application.MessageBox('It''s the same','message')
else
ShowMessage('It''s not the same');
end;
end.
| 16.366197 | 76 | 0.70568 |
83bc07bd51bddd708ddb02291c6ebda7e39ac15c | 11,161 | dfm | Pascal | Packages/Order Entry Results Reporting/CPRS/CPRS-Chart/fxBrokerSearch.dfm | josephsnyder/VistA | 07cabf4302675991dd453aea528f79f875358d58 | [
"Apache-2.0"
]
| 1 | 2021-01-01T01:16:44.000Z | 2021-01-01T01:16:44.000Z | CPRSChart/OR_30_423_SRC/CPRS-chart/fxBrokerSearch.dfm | VHAINNOVATIONS/Transplant | a6c000a0df4f46a17330cec95ff25119fca1f472 | [
"Apache-2.0"
]
| null | null | null | CPRSChart/OR_30_423_SRC/CPRS-chart/fxBrokerSearch.dfm | VHAINNOVATIONS/Transplant | a6c000a0df4f46a17330cec95ff25119fca1f472 | [
"Apache-2.0"
]
| null | null | null | object frmBokerSearch: TfrmBokerSearch
Left = 0
Top = 0
Caption = 'Broker Search'
ClientHeight = 284
ClientWidth = 322
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poOwnerFormCenter
OnCreate = FormCreate
OnDestroy = FormDestroy
OnResize = FormResize
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 0
Top = 0
Width = 322
Height = 51
Align = alTop
BevelOuter = bvNone
TabOrder = 0
object Label1: TLabel
AlignWithMargins = True
Left = 5
Top = 3
Width = 69
Height = 13
Margins.Left = 5
Align = alTop
Caption = 'Search Criteria'
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object Panel4: TPanel
Left = 0
Top = 19
Width = 322
Height = 32
Align = alClient
BevelOuter = bvNone
TabOrder = 0
ExplicitTop = 22
ExplicitHeight = 35
object SearchTerm: TEdit
AlignWithMargins = True
Left = 10
Top = 3
Width = 199
Height = 26
Margins.Left = 10
Margins.Right = 10
Align = alClient
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
TabOrder = 0
OnChange = SearchTermChange
ExplicitHeight = 21
end
object btnSearch: TButton
AlignWithMargins = True
Left = 222
Top = 3
Width = 90
Height = 26
Margins.Right = 10
Align = alRight
Caption = 'Search'
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
TabOrder = 1
OnClick = btnSearchClick
ExplicitHeight = 20
end
end
end
object Panel2: TPanel
Left = 0
Top = 51
Width = 322
Height = 192
Align = alClient
BevelOuter = bvNone
TabOrder = 1
ExplicitTop = 48
ExplicitHeight = 195
object Label2: TLabel
AlignWithMargins = True
Left = 5
Top = 3
Width = 72
Height = 13
Margins.Left = 5
Align = alTop
Caption = 'Search Results'
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object ResultList: TListView
AlignWithMargins = True
Left = 10
Top = 22
Width = 302
Height = 160
Margins.Left = 10
Margins.Right = 10
Margins.Bottom = 10
Align = alClient
Columns = <
item
Caption = 'Index'
end
item
Caption = 'RPC Name'
Width = 200
end>
ColumnClick = False
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ReadOnly = True
RowSelect = True
ParentFont = False
TabOrder = 0
ViewStyle = vsReport
OnSelectItem = ResultListSelectItem
ExplicitTop = 25
end
end
object Panel3: TPanel
Left = 0
Top = 243
Width = 322
Height = 41
Align = alBottom
TabOrder = 2
Visible = False
object btnOk: TBitBtn
Left = 208
Top = 6
Width = 75
Height = 25
Caption = 'Ok'
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Glyph.Data = {
42080000424D4208000000000000420000002800000020000000100000000100
20000300000000080000130B0000130B00000000000000000000000000FF0000
FF0000FF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4A4A4AFF69
6969FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9D9D9DFF9D
9D9DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF414141FF000000FF00
0000FF646464FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9D9D9DFFDBDBDBFFDB
DBDBFF9D9D9DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF454545FF000000FF000000FF00
0000FF000000FF636363FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9D9D9DFFDBDBDBFFDBDBDBFFDB
DBDBFFDBDBDBFF636363FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF585858FF000000FF000000FF000000FF00
0000FF000000FF000000FF6C6C6CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9D9D9DFFDBDBDBFFDBDBDBFFDBDBDBFFDB
DBDBFFDBDBDBFFDBDBDBFF9D9D9DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFF5A5A5AFF000000FF000000FF000000FF6E6E6EFF53
5353FF000000FF000000FF000000FF616161FFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFF9D9D9DFFDBDBDBFFDBDBDBFFDBDBDBFF6E6E6EFF53
5353FFDBDBDBFFDBDBDBFFDBDBDBFF9D9D9DFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFF686868FF000000FF000000FF000000FF7A7A7AFFFFFFFFFFFF
FFFFFF5A5A5AFF000000FF000000FF000000FF606060FFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFF9D9D9DFFDBDBDBFFDBDBDBFFDBDBDBFF7A7A7AFFFFFFFFFFFF
FFFFFF9D9D9DFFDBDBDBFFDBDBDBFFDBDBDBFF606060FFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFF3E3E3EFF000000FF000000FF747474FFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFF5C5C5CFF000000FF000000FF000000FF5F5F5FFFFFFFFFFFFF
FFFFFFFFFFFFFF9D9D9DFFDBDBDBFFDBDBDBFF747474FFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFF9D9D9DFFDBDBDBFFDBDBDBFFDBDBDBFF9D9D9DFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFF5A5A5AFF767676FFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFF5D5D5DFF000000FF000000FF000000FF5D5D5DFFFF
FFFFFFFFFFFFFFFFFFFFFF9D9D9DFF9D9D9DFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFF9D9D9DFFDBDBDBFFDBDBDBFFDBDBDBFF9D9D9DFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF545454FF000000FF000000FF000000FF69
6969FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9D9D9DFFDBDBDBFFDBDBDBFFDBDBDBFF9D
9D9DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF616161FF000000FF000000FF00
0000FF606060FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9D9D9DFFDBDBDBFFDBDBDBFFDB
DBDBFF606060FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF626262FF000000FF00
0000FF454545FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9D9D9DFFDBDBDBFFDB
DBDBFF9D9D9DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF666666FF46
4646FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF666666FF9D
9D9DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFF}
ModalResult = 1
NumGlyphs = 2
ParentFont = False
TabOrder = 1
OnClick = btnOkClick
end
object btnCancel: TBitBtn
Left = 24
Top = 6
Width = 75
Height = 25
Caption = 'Cancel'
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Glyph.Data = {
36030000424D3603000000000000360000002800000010000000100000000100
1800000000000003000000000000000000000000000000000000FFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF767676767676FFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFF767676767676FFFFFFFFFFFFFFFFFF767676
000000000000767676FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7676760000
00000000767676FFFFFFFFFFFF7E7E7E0000000000000000007E7E7EFFFFFFFF
FFFFFFFFFFFFFFFF7E7E7E0000000000000000007E7E7EFFFFFFFFFFFFFFFFFF
7E7E7E0000000000000000007E7E7EFFFFFFFFFFFF7E7E7E0000000000000000
007E7E7EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF87878700000000000000000076
7676767676000000000000000000878787FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFF7E7E7E0000000000000000000000000000000000007E7E7EFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF87878700000000
0000000000000000878787FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFF7E7E7E0000000000000000000000007E7E7EFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7E7E7E00000000000000
00000000000000000000007E7E7EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFF7676760000000000000000008787878787870000000000000000007676
76FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7E7E7E0000000000000000007E7E7EFF
FFFFFFFFFF7E7E7E0000000000000000007E7E7EFFFFFFFFFFFFFFFFFF767676
000000000000000000878787FFFFFFFFFFFFFFFFFFFFFFFF8787870000000000
00000000767676FFFFFFFFFFFF7E7E7E0000000000007E7E7EFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFF7E7E7E0000000000007E7E7EFFFFFFFFFFFFFFFFFF
878787878787FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8787
87878787FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
ModalResult = 2
ParentFont = False
TabOrder = 0
end
end
end
| 38.222603 | 72 | 0.748141 |
83f660f4d93c60cfcc751fe8814810c9d604b9f0 | 7,187 | dfm | Pascal | UMostrarCliente.dfm | Douhgrax/Projeto | 03c32d69c89c3c9b4b14f2940e067d47374769d3 | [
"Unlicense"
]
| null | null | null | UMostrarCliente.dfm | Douhgrax/Projeto | 03c32d69c89c3c9b4b14f2940e067d47374769d3 | [
"Unlicense"
]
| null | null | null | UMostrarCliente.dfm | Douhgrax/Projeto | 03c32d69c89c3c9b4b14f2940e067d47374769d3 | [
"Unlicense"
]
| null | null | null | object fMostrarCliente: TfMostrarCliente
Left = 5
Top = 5
Caption = 'Mostrar Cliente'
ClientHeight = 627
ClientWidth = 712
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poDesigned
PixelsPerInch = 96
TextHeight = 13
object Label6: TLabel
Left = 141
Top = 114
Width = 74
Height = 13
HelpType = htKeyword
Caption = 'Dados Pessoais'
StyleName = 'sss'
end
object Label1: TLabel
Left = 32
Top = 143
Width = 60
Height = 13
Caption = 'Raz'#227'o Social'
end
object lNomeFantasia: TLabel
Left = 224
Top = 141
Width = 71
Height = 13
Caption = 'Nome Fantasia'
end
object lCnpj: TLabel
Left = 32
Top = 189
Width = 25
Height = 13
Caption = 'CNPJ'
end
object lCpf: TLabel
Left = 224
Top = 189
Width = 19
Height = 13
Caption = 'CPF'
end
object Label4: TLabel
Left = 32
Top = 237
Width = 87
Height = 13
Caption = 'Inscri'#231#227'o Estadual'
end
object Label2: TLabel
Left = 224
Top = 237
Width = 14
Height = 13
Caption = 'RG'
end
object Label3: TLabel
Left = 141
Top = 293
Width = 96
Height = 13
Caption = 'Data de Nascimento'
end
object Label13: TLabel
Left = 524
Top = 114
Width = 45
Height = 13
HelpType = htKeyword
Caption = 'Endere'#231'o'
StyleName = 'sss'
end
object Label7: TLabel
Left = 466
Top = 143
Width = 13
Height = 13
Caption = 'UF'
end
object Label8: TLabel
Left = 576
Top = 143
Width = 33
Height = 13
Caption = 'Cidade'
end
object Label9: TLabel
Left = 466
Top = 189
Width = 19
Height = 13
Caption = 'CEP'
end
object Label10: TLabel
Left = 634
Top = 189
Width = 19
Height = 13
Caption = 'Pa'#237's'
end
object Label11: TLabel
Left = 466
Top = 247
Width = 45
Height = 13
Caption = 'Endere'#231'o'
end
object Label12: TLabel
Left = 464
Top = 293
Width = 28
Height = 13
Caption = 'Bairro'
end
object Label14: TLabel
Left = 176
Top = 370
Width = 39
Height = 13
HelpType = htKeyword
Caption = 'Contato'
StyleName = 'sss'
end
object Label15: TLabel
Left = 488
Top = 370
Width = 41
Height = 13
HelpType = htKeyword
Caption = 'Empresa'
StyleName = 'sss'
end
object Label16: TLabel
Left = 32
Top = 405
Width = 37
Height = 13
HelpType = htKeyword
Caption = 'N'#250'mero'
StyleName = 'sss'
end
object Label18: TLabel
Left = 224
Top = 405
Width = 42
Height = 13
HelpType = htKeyword
Caption = 'Telefone'
StyleName = 'sss'
end
object Label17: TLabel
Left = 176
Top = 477
Width = 28
Height = 13
HelpType = htKeyword
Caption = 'E-mail'
StyleName = 'sss'
end
object Label20: TLabel
Left = 464
Top = 405
Width = 105
Height = 13
HelpType = htKeyword
Caption = 'Empresa que trabalha'
StyleName = 'sss'
end
object Label21: TLabel
Left = 464
Top = 477
Width = 44
Height = 13
HelpType = htKeyword
Caption = 'Profiss'#227'o'
StyleName = 'sss'
end
object pClienteCadastro: TPanel
Left = 176
Top = 16
Width = 393
Height = 57
Caption = 'Cadastro Cliente'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = 40
Font.Name = 'Yu Gothic Medium'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 0
end
object dbeRazaoSocial: TDBEdit
Left = 24
Top = 162
Width = 153
Height = 21
DataField = 'CLIENTE'
DataSource = DataM.DTSCliente
TabOrder = 1
end
object dbeNomeFantasia: TDBEdit
Left = 216
Top = 162
Width = 153
Height = 21
DataField = 'FANTASIA'
DataSource = DataM.DTSCliente
TabOrder = 2
end
object dbeCnpj: TDBEdit
Left = 24
Top = 208
Width = 153
Height = 21
DataField = 'CNPJ'
DataSource = DataM.DTSCliente
TabOrder = 3
end
object dbeCPF: TDBEdit
Left = 216
Top = 208
Width = 153
Height = 21
DataField = 'CPF'
DataSource = DataM.DTSCliente
TabOrder = 4
end
object dbeInscriçaoEstadual: TDBEdit
Left = 24
Top = 256
Width = 153
Height = 21
DataField = 'IE'
DataSource = DataM.DTSCliente
TabOrder = 5
end
object dbeRG: TDBEdit
Left = 216
Top = 256
Width = 153
Height = 21
DataField = 'RG'
DataSource = DataM.DTSCliente
TabOrder = 6
end
object dbeDataNascimento: TDBEdit
Left = 113
Top = 312
Width = 153
Height = 21
DataField = 'DATANASCIMENTO'
DataSource = DataM.DTSCliente
TabOrder = 7
end
object dbeUf: TDBEdit
Left = 452
Top = 162
Width = 40
Height = 21
DataField = 'UF'
DataSource = DataM.DTSCliente
TabOrder = 8
end
object dbeCidade: TDBEdit
Left = 551
Top = 162
Width = 153
Height = 21
DataField = 'CIDADE'
DataSource = DataM.DTSCliente
TabOrder = 9
end
object dbeCep: TDBEdit
Left = 452
Top = 208
Width = 85
Height = 21
DataField = 'CEP'
DataSource = DataM.DTSCliente
TabOrder = 10
end
object dbePais: TDBEdit
Left = 592
Top = 208
Width = 112
Height = 21
DataField = 'PAIS'
DataSource = DataM.DTSCliente
TabOrder = 11
end
object dbeEndereco: TDBEdit
Left = 452
Top = 266
Width = 252
Height = 21
DataField = 'ENDERECO'
DataSource = DataM.DTSCliente
TabOrder = 12
end
object dbeBairro: TDBEdit
Left = 452
Top = 312
Width = 153
Height = 21
DataField = 'BAIRRO'
DataSource = DataM.DTSCliente
TabOrder = 13
end
object dbeNumero: TDBEdit
Left = 24
Top = 424
Width = 153
Height = 21
DataField = 'CELULAR'
DataSource = DataM.DTSCliente
TabOrder = 14
end
object dbeTelefone: TDBEdit
Left = 216
Top = 424
Width = 153
Height = 21
DataField = 'TELEFONE'
DataSource = DataM.DTSCliente
TabOrder = 15
end
object dbeEmail: TDBEdit
Left = 120
Top = 496
Width = 153
Height = 21
DataField = 'EMAIL'
DataSource = DataM.DTSCliente
TabOrder = 16
end
object dbeEmpresa: TDBEdit
Left = 452
Top = 424
Width = 153
Height = 21
DataField = 'EMPRESAQUETRABALHA'
DataSource = DataM.DTSCliente
TabOrder = 17
end
object dbeprofissao: TDBEdit
Left = 452
Top = 496
Width = 153
Height = 21
DataField = 'PROFISSAO'
DataSource = DataM.DTSCliente
TabOrder = 18
end
object btnAlterarClienteMostrar: TButton
Left = 576
Top = 561
Width = 105
Height = 49
Caption = 'Alterar'
TabOrder = 19
OnClick = btnAlterarClienteMostrarClick
end
object btnCancelarCliente: TButton
Left = 32
Top = 561
Width = 105
Height = 49
Caption = 'Cancelar'
TabOrder = 20
OnClick = btnCancelarClienteClick
end
end
| 18.716146 | 43 | 0.596355 |
85c8e8d31fc482bb20232e209152f667bc590d9c | 10,588 | pas | Pascal | Server/lib/sgDriverSDL2.pas | sardap/NumbersOrDie | d5cc5caf6c96746689bfaf0a19883708cd292dab | [
"MIT"
]
| null | null | null | Server/lib/sgDriverSDL2.pas | sardap/NumbersOrDie | d5cc5caf6c96746689bfaf0a19883708cd292dab | [
"MIT"
]
| null | null | null | Server/lib/sgDriverSDL2.pas | sardap/NumbersOrDie | d5cc5caf6c96746689bfaf0a19883708cd292dab | [
"MIT"
]
| 1 | 2019-03-30T16:33:07.000Z | 2019-03-30T16:33:07.000Z | unit sgDriverSDL2;
//=============================================================================
// sgDriverSDL2.pas
//=============================================================================
//
//
//
//
//
// Notes:
// - Pascal PChar is equivalent to a C-type string
// - Pascal Word is equivalent to a Uint16
// - Pascal LongWord is equivalent to a Uint32
// - Pascal SmallInt is equivalent to Sint16
//
//=============================================================================
interface
procedure LoadSDL2Driver();
implementation
uses sgDriver, sgShared, SysUtils, sgTrace, sgTypes, sgDriverSDL2Types, sgDriverInput, sgMinSDL2;
var
_Initialised : Boolean = False;
//TODO: Move the array to SwinGame - init it from driver
_KeyCode : array[0..327] of LongInt;
procedure InitKeyCodes();
begin
_KeyCode[LongInt(UnknownKey)] := LongInt(SDLK_UNKNOWN);
_KeyCode[LongInt(BackspaceKey)] := LongInt(SDLK_BACKSPACE); //Hopeful
_KeyCode[LongInt(TabKey)] := LongInt(SDLK_TAB); //Hopeful
_KeyCode[LongInt(ClearKey)] := LongInt(SDLK_CLEAR);
_KeyCode[LongInt(ReturnKey)] := LongInt(SDLK_RETURN); //Hopeful
_KeyCode[LongInt(PauseKey)] := LongInt(SDLK_PAUSE);
_KeyCode[LongInt(EscapeKey)] := LongInt(SDLK_ESCAPE);
_KeyCode[LongInt(SpaceKey)] := LongInt(SDLK_SPACE);
_KeyCode[LongInt(ExclaimKey)] := LongInt(SDLK_EXCLAIM);
_KeyCode[LongInt(DoubleQuoteKey)] := LongInt(SDLK_QUOTEDBL);
_KeyCode[LongInt(HashKey)] := LongInt(SDLK_HASH);
_KeyCode[LongInt(DollarKey)] := LongInt(SDLK_DOLLAR);
_KeyCode[LongInt(AmpersandKey)] := LongInt(SDLK_AMPERSAND);
_KeyCode[LongInt(QuoteKey)] := LongInt(SDLK_QUOTE);
_KeyCode[LongInt(LeftParenKey)] := LongInt(SDLK_LEFTPAREN);
_KeyCode[LongInt(RightParenKey)] := LongInt(SDLK_RIGHTPAREN);
_KeyCode[LongInt(AsteriskKey)] := LongInt(SDLK_ASTERISK);
_KeyCode[LongInt(PlusKey)] := LongInt(SDLK_PLUS);
_KeyCode[LongInt(CommaKey)] := LongInt(SDLK_COMMA);
_KeyCode[LongInt(MinusKey)] := LongInt(SDLK_MINUS);
_KeyCode[LongInt(PeriodKey)] := LongInt(SDLK_PERIOD);
_KeyCode[LongInt(SlashKey)] := LongInt(SDLK_SLASH);
_KeyCode[LongInt(Key0)] := LongInt(SDLK_0);
_KeyCode[LongInt(Key1)] := LongInt(SDLK_1);
_KeyCode[LongInt(Key2)] := LongInt(SDLK_2);
_KeyCode[LongInt(Key3)] := LongInt(SDLK_3);
_KeyCode[LongInt(Key4)] := LongInt(SDLK_4);
_KeyCode[LongInt(Key5)] := LongInt(SDLK_5);
_KeyCode[LongInt(Key6)] := LongInt(SDLK_6);
_KeyCode[LongInt(Key7)] := LongInt(SDLK_7);
_KeyCode[LongInt(Key8)] := LongInt(SDLK_8);
_KeyCode[LongInt(Key9)] := LongInt(SDLK_9);
_KeyCode[LongInt(ColonKey)] := LongInt(SDLK_COLON);
_KeyCode[LongInt(SemicolonKey)] := LongInt(SDLK_SEMICOLON);
_KeyCode[LongInt(LessKey)] := LongInt(SDLK_LESS);
_KeyCode[LongInt(EqualsKey)] := LongInt(SDLK_EQUALS);
_KeyCode[LongInt(GreaterKey)] := LongInt(SDLK_GREATER);
_KeyCode[LongInt(QuestionKey)] := LongInt(SDLK_QUESTION);
_KeyCode[LongInt(AtKey)] := LongInt(SDLK_AT);
// Skip uppercase letters
_KeyCode[LongInt(LeftBracketKey)] := LongInt(SDLK_LEFTBRACKET);
_KeyCode[LongInt(BackSlashKey)] := LongInt(SDLK_BACKSLASH); //Hopeful
_KeyCode[LongInt(RightBracketKey)] := LongInt(SDLK_RIGHTBRACKET);
_KeyCode[LongInt(CaretKey)] := LongInt(SDLK_CARET);
_KeyCode[LongInt(UnderscoreKey)] := LongInt(SDLK_UNDERSCORE);
_KeyCode[LongInt(BackquoteKey)] := LongInt(SDLK_BACKQUOTE);
_KeyCode[LongInt(AKey)] := LongInt(SDLK_a);
_KeyCode[LongInt(BKey)] := LongInt(SDLK_b);
_KeyCode[LongInt(CKey)] := LongInt(SDLK_c);
_KeyCode[LongInt(DKey)] := LongInt(SDLK_d);
_KeyCode[LongInt(EKey)] := LongInt(SDLK_e);
_KeyCode[LongInt(FKey)] := LongInt(SDLK_f);
_KeyCode[LongInt(GKey)] := LongInt(SDLK_g);
_KeyCode[LongInt(HKey)] := LongInt(SDLK_h);
_KeyCode[LongInt(IKey)] := LongInt(SDLK_i);
_KeyCode[LongInt(JKey)] := LongInt(SDLK_j);
_KeyCode[LongInt(KKey)] := LongInt(SDLK_k);
_KeyCode[LongInt(LKey)] := LongInt(SDLK_l);
_KeyCode[LongInt(MKey)] := LongInt(SDLK_m);
_KeyCode[LongInt(NKey)] := LongInt(SDLK_n);
_KeyCode[LongInt(OKey)] := LongInt(SDLK_o);
_KeyCode[LongInt(PKey)] := LongInt(SDLK_p);
_KeyCode[LongInt(QKey)] := LongInt(SDLK_q);
_KeyCode[LongInt(RKey)] := LongInt(SDLK_r);
_KeyCode[LongInt(SKey)] := LongInt(SDLK_s);
_KeyCode[LongInt(TKey)] := LongInt(SDLK_t);
_KeyCode[LongInt(UKey)] := LongInt(SDLK_u);
_KeyCode[LongInt(VKey)] := LongInt(SDLK_v);
_KeyCode[LongInt(WKey)] := LongInt(SDLK_w);
_KeyCode[LongInt(XKey)] := LongInt(SDLK_x);
_KeyCode[LongInt(YKey)] := LongInt(SDLK_y);
_KeyCode[LongInt(ZKey)] := LongInt(SDLK_z);
_KeyCode[LongInt(DeleteKey)] := LongInt(SDLK_DELETE);
// End of ASCII mapped keysyms
// Numeric keypad
_KeyCode[LongInt(KeyPad0)] := LongInt(SDLK_KP_0);
_KeyCode[LongInt(KeyPad1)] := LongInt(SDLK_KP_1);
_KeyCode[LongInt(KeyPad2)] := LongInt(SDLK_KP_2);
_KeyCode[LongInt(KeyPad3)] := LongInt(SDLK_KP_3);
_KeyCode[LongInt(KeyPAd4)] := LongInt(SDLK_KP_4);
_KeyCode[LongInt(KeyPAd5)] := LongInt(SDLK_KP_5);
_KeyCode[LongInt(KeyPad6)] := LongInt(SDLK_KP_6);
_KeyCode[LongInt(KeyPad7)] := LongInt(SDLK_KP_7);
_KeyCode[LongInt(KeyPAd8)] := LongInt(SDLK_KP_8);
_KeyCode[LongInt(KeyPad9)] := LongInt(SDLK_KP_9);
_KeyCode[LongInt(KeyPadPeriod)] := LongInt(SDLK_KP_PERIOD);
_KeyCode[LongInt(KeyPadDivide)] := LongInt(SDLK_KP_DIVIDE);
_KeyCode[LongInt(KeyPadMultiply)] := LongInt(SDLK_KP_MULTIPLY);
_KeyCode[LongInt(KeyPadMinus)] := LongInt(SDLK_KP_MINUS);
_KeyCode[LongInt(KeyPadPlus)] := LongInt(SDLK_KP_PLUS);
_KeyCode[LongInt(KeyPadEnter)] := LongInt(SDLK_KP_ENTER);
_KeyCode[LongInt(KeyPadEquals)] := LongInt(SDLK_KP_EQUALS);
// Arrows + Home/End pad
_KeyCode[LongInt(UpKey)] := LongInt(SDLK_UP);
_KeyCode[LongInt(DownKey)] := LongInt(SDLK_DOWN);
_KeyCode[LongInt(RightKey)] := LongInt(SDLK_RIGHT);
_KeyCode[LongInt(LeftKey)] := LongInt(SDLK_LEFT);
_KeyCode[LongInt(InsertKey)] := LongInt(SDLK_INSERT);
_KeyCode[LongInt(HomeKey)] := LongInt(SDLK_HOME);
_KeyCode[LongInt(EndKey)] := LongInt(SDLK_END);
_KeyCode[LongInt(PageUpKey)] := LongInt(SDLK_PAGEUP);
_KeyCode[LongInt(PageDownKey)] := LongInt(SDLK_PAGEDOWN);
// Function keys
_KeyCode[LongInt(F1Key)] := LongInt(SDLK_F1);
_KeyCode[LongInt(F2Key)] := LongInt(SDLK_F2);
_KeyCode[LongInt(F3Key)] := LongInt(SDLK_F3);
_KeyCode[LongInt(F4Key)] := LongInt(SDLK_F4);
_KeyCode[LongInt(F5Key)] := LongInt(SDLK_F5);
_KeyCode[LongInt(F6Key)] := LongInt(SDLK_F6);
_KeyCode[LongInt(F7Key)] := LongInt(SDLK_F7);
_KeyCode[LongInt(F8Key)] := LongInt(SDLK_F8);
_KeyCode[LongInt(F9Key)] := LongInt(SDLK_F9);
_KeyCode[LongInt(F10Key)] := LongInt(SDLK_F10);
_KeyCode[LongInt(F11Key)] := LongInt(SDLK_F11);
_KeyCode[LongInt(F12Key)] := LongInt(SDLK_F12);
_KeyCode[LongInt(F13Key)] := LongInt(SDLK_F13);
_KeyCode[LongInt(F14Key)] := LongInt(SDLK_F14);
_KeyCode[LongInt(F15Key)] := LongInt(SDLK_F15);
// Key state modifier keys
_KeyCode[LongInt(NumLockKey)] := LongInt(SDLK_NUMLOCKCLEAR);
_KeyCode[LongInt(CapsLockKey)] := LongInt(SDLK_CAPSLOCK);
_KeyCode[LongInt(ScrollLockKey)] := LongInt(SDLK_SCROLLLOCK);
_KeyCode[LongInt(RightShiftKey)] := LongInt(SDLK_RSHIFT);
_KeyCode[LongInt(LeftShiftKey)] := LongInt(SDLK_LSHIFT);
_KeyCode[LongInt(RightCtrlKey)] := LongInt(SDLK_RCTRL);
_KeyCode[LongInt(LeftCtrlKey)] := LongInt(SDLK_LCTRL);
_KeyCode[LongInt(RightAltKey)] := LongInt(SDLK_RALT);
_KeyCode[LongInt(LeftAltKey)] := LongInt(SDLK_LALT);
_KeyCode[LongInt(RightMetaKey)] := LongInt(SDLK_RMETA);
_KeyCode[LongInt(LeftMetaKey)] := LongInt(SDLK_LMETA);
_KeyCode[LongInt(LeftSuperKey)] := LongInt(SDLK_LSUPER); // Left "Windows" key
_KeyCode[LongInt(RightSuperKey)] := LongInt(SDLK_RSUPER); // Right "Windows" key
_KeyCode[LongInt(ModeKey)] := LongInt(SDLK_MODE); // "Alt Gr" key
// Miscellaneous function keys
_KeyCode[LongInt(HelpKey)] := LongInt(SDLK_HELP);
_KeyCode[LongInt(SysReqKey)] := LongInt(SDLK_SYSREQ);
_KeyCode[LongInt(MenuKey)] := LongInt(SDLK_MENU);
_KeyCode[LongInt(PowerKey)] := LongInt(SDLK_POWER); // Power Macintosh power key
_KeyCode[LongInt(ShiftKey)] := LongInt(SDLK_LSHIFT);
_KeyCode[LongInt(CtrlKey)] := LongInt(SDLK_LCTRL);
_KeyCode[LongInt(AltKey)] := LongInt(SDLK_LALT);
_KeyCode[LongInt(CommandKey)] := LongInt(SDLK_LSUPER);
_KeyCode[LongInt(SuperKey)] := LongInt(SDLK_LSUPER);
_KeyCode[LongInt(WindowsKey)] := LongInt(SDLK_LSUPER);
_KeyCode[LongInt(OptionKey)] := LongInt(SDLK_LALT);
end;
//TODO: move this to SwinGame
function GetKeyCodeProcedure(val : LongInt) : LongInt;
begin
result := _KeyCode[val];
end;
function GetErrorProcedure() : PChar;
begin
result := 'ERROR TEXT'; //TODO: add this
end;
procedure QuitProcedure();
begin
//TODO: add this
end;
procedure InitProcedure();
begin
if _Initialised then exit;
_Initialised := true;
InitKeyCodes();
// WriteLn('pre init');
_sg_functions^.init();
// WriteLn('post init');
end;
procedure LoadSDL2Driver();
var
callbacks: sg_input_callbacks;
begin
Driver.GetError := @GetErrorProcedure;
Driver.GetKeyCode := @GetKeyCodeProcedure;
Driver.Quit := @QuitProcedure;
Driver.Init := @InitProcedure;
callbacks := GetInputCallbackFunction();
_sg_functions := sg_load(callbacks);
// WriteLn('Size of functions Pascal: ', sizeof(sg_interface));
// WriteLn('Network port Pascal: ', HexStr(_sg_functions^.network.network_port));
end;
end.
| 45.637931 | 98 | 0.630431 |
831c434196cd2b4c2660fd3a8e8048107899be65 | 50,989 | pas | Pascal | Units/DX12.D3DX12.pas | viniciusfbb/DelphiDX12 | d1561bc6cb9bba7519e298bd4fa730fc22f6e19b | [
"Apache-2.0"
]
| 1 | 2021-02-10T22:15:03.000Z | 2021-02-10T22:15:03.000Z | Units/DX12.D3DX12.pas | viniciusfbb/DelphiDX12 | d1561bc6cb9bba7519e298bd4fa730fc22f6e19b | [
"Apache-2.0"
]
| null | null | null | Units/DX12.D3DX12.pas | viniciusfbb/DelphiDX12 | d1561bc6cb9bba7519e298bd4fa730fc22f6e19b | [
"Apache-2.0"
]
| 1 | 2020-04-16T09:11:40.000Z | 2020-04-16T09:11:40.000Z | unit DX12.D3DX12;
//*********************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//*********************************************************
{$IFDEF FPC}
{$mode delphi}
//{$mode objfpc}
{$MODESWITCH ADVANCEDRECORDS}
{$MODESWITCH TYPEHELPERS}
{$macro on}
{$ELSE}
{$POINTERMATH ON}
{$ENDIF}
interface
{$IFDEF MSWINDOWS}
uses
Windows, Classes, SysUtils,
DX12.D3DCommon,
DX12.D3D12, DX12.DXGI;
const
UINT_MAX: UINT = $ffffffff;
{$IFDEF WIN32}
SIZE_MAX: UINT32 = $ffffffff;
{$ELSE}
SIZE_MAX: UINT64 = $ffffffffffffffff;
{$ENDIF}
MaxSubresources: UINT = 100; // ToDo
type
TD3DX12_HEAP_PROPERTIES = TD3D12_HEAP_PROPERTIES;
TD3DX12_RESOURCE_DESC = TD3D12_RESOURCE_DESC;
TD3DX12_RESOURCE_BARRIER = TD3D12_RESOURCE_BARRIER;
TD3DX12_DESCRIPTOR_RANGE = TD3D12_DESCRIPTOR_RANGE;
TD3DX12_ROOT_PARAMETER = TD3D12_ROOT_PARAMETER;
TD3DX12_ROOT_DESCRIPTOR_TABLE = TD3D12_ROOT_DESCRIPTOR_TABLE;
TD3DX12_ROOT_SIGNATURE_DESC = TD3D12_ROOT_SIGNATURE_DESC;
TD3DX12_DEPTH_STENCIL_DESC1 = TD3D12_DEPTH_STENCIL_DESC1;
TD3DX12_VIEW_INSTANCING_DESC= TD3D12_VIEW_INSTANCING_DESC;
TD3DX12_RASTERIZER_DESC = TD3D12_RASTERIZER_DESC;
TD3DX12_BLEND_DESC = TD3D12_BLEND_DESC;
TD3DX12_DEPTH_STENCIL_DESC = TD3D12_DEPTH_STENCIL_DESC;
TD3DX12_TEXTURE_COPY_LOCATION = TD3D12_TEXTURE_COPY_LOCATION;
TD3DX12_RANGE = TD3D12_RANGE;
//------------------------------------------------------------------------------------------------
{ TD3DX12_CPU_DESCRIPTOR_HANDLE }
{$IFDEF FPC}
TD3DX12_CPU_DESCRIPTOR_HANDLE = type helper for TD3D12_CPU_DESCRIPTOR_HANDLE
// class operator Explicit(a:TD3D12_CPU_DESCRIPTOR_HANDLE): TD3DX12_CPU_DESCRIPTOR_HANDLE;
// class operator initialize(var aRec:TD3DX12_CPU_DESCRIPTOR_HANDLE);
procedure Offset(offsetScaledByIncrementSize: integer); overload;
procedure Offset(offsetInDescriptors: integer; descriptorIncrementSize: UINT); overload;
end;
{$ENDIF}
{ TD3DX12_PIPELINE_STATE_STREAM_FLAGS }
TD3DX12_PIPELINE_STATE_STREAM_FLAGS = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE;// D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS;
_Inner:TD3D12_PIPELINE_STATE_FLAGS;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_FLAGS);
{$ENDIF}
constructor Create(i:TD3D12_PIPELINE_STATE_FLAGS);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_NODE_MASK }
TD3DX12_PIPELINE_STATE_STREAM_NODE_MASK = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK;
_Inner:UINT;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_NODE_MASK);
{$ENDIF}
constructor Create(i:UINT);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE }
TD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:ID3D12RootSignature;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE);
{$ENDIF}
constructor Create(i:ID3D12RootSignature);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_INPUT_LAYOUT }
TD3DX12_PIPELINE_STATE_STREAM_INPUT_LAYOUT = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3D12_INPUT_LAYOUT_DESC;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_INPUT_LAYOUT);
{$ENDIF}
constructor Create(i:TD3D12_INPUT_LAYOUT_DESC);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_IB_STRIP_CUT_VALUE }
TD3DX12_PIPELINE_STATE_STREAM_IB_STRIP_CUT_VALUE = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3D12_INDEX_BUFFER_STRIP_CUT_VALUE;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_IB_STRIP_CUT_VALUE);
{$ENDIF}
constructor Create(i:TD3D12_INDEX_BUFFER_STRIP_CUT_VALUE);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_PRIMITIVE_TOPOLOGY }
TD3DX12_PIPELINE_STATE_STREAM_PRIMITIVE_TOPOLOGY = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3D12_PRIMITIVE_TOPOLOGY_TYPE;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_PRIMITIVE_TOPOLOGY);
{$ENDIF}
constructor Create(i:TD3D12_PRIMITIVE_TOPOLOGY_TYPE);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_VS }
TD3DX12_PIPELINE_STATE_STREAM_VS = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3D12_SHADER_BYTECODE;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_VS);
{$ENDIF}
constructor Create(i:TD3D12_SHADER_BYTECODE);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_GS }
TD3DX12_PIPELINE_STATE_STREAM_GS = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3D12_SHADER_BYTECODE;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_GS);
{$ENDIF}
constructor Create(i:TD3D12_SHADER_BYTECODE);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_STREAM_OUTPUT }
TD3DX12_PIPELINE_STATE_STREAM_STREAM_OUTPUT = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3D12_STREAM_OUTPUT_DESC;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_STREAM_OUTPUT);
{$ENDIF}
constructor Create(i:TD3D12_STREAM_OUTPUT_DESC);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_HS }
TD3DX12_PIPELINE_STATE_STREAM_HS = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3D12_SHADER_BYTECODE;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_HS);
{$ENDIF}
constructor Create(i:TD3D12_SHADER_BYTECODE);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_DS }
TD3DX12_PIPELINE_STATE_STREAM_DS = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3D12_SHADER_BYTECODE;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_DS);
{$ENDIF}
constructor Create(i:TD3D12_SHADER_BYTECODE);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_PS }
TD3DX12_PIPELINE_STATE_STREAM_PS = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3D12_SHADER_BYTECODE;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_PS);
{$ENDIF}
constructor Create(i:TD3D12_SHADER_BYTECODE);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_CS }
TD3DX12_PIPELINE_STATE_STREAM_CS = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3D12_SHADER_BYTECODE;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_CS);
{$ENDIF}
constructor Create(i:TD3D12_SHADER_BYTECODE);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_BLEND_DESC }
TD3DX12_PIPELINE_STATE_STREAM_BLEND_DESC = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3DX12_BLEND_DESC;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_BLEND_DESC);
{$ENDIF}
constructor Create(i:TD3DX12_BLEND_DESC { ToDo ,TD3DX12_DEFAULT});
end;
{ TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL }
TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3DX12_DEPTH_STENCIL_DESC;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL);
{$ENDIF}
constructor Create(i:TD3DX12_DEPTH_STENCIL_DESC);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL1 }
TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL1 = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3DX12_DEPTH_STENCIL_DESC1;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL1);
{$ENDIF}
constructor Create(i:TD3DX12_DEPTH_STENCIL_DESC1);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL_FORMAT }
TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL_FORMAT = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TDXGI_FORMAT;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL_FORMAT);
{$ENDIF}
constructor Create(i:TDXGI_FORMAT);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_RASTERIZER }
TD3DX12_PIPELINE_STATE_STREAM_RASTERIZER = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3DX12_RASTERIZER_DESC;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_RASTERIZER);
{$ENDIF}
constructor Create(i:TD3DX12_RASTERIZER_DESC);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_RENDER_TARGET_FORMATS }
TD3DX12_PIPELINE_STATE_STREAM_RENDER_TARGET_FORMATS = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3D12_RT_FORMAT_ARRAY;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_RENDER_TARGET_FORMATS);
{$ENDIF}
constructor Create(i:TD3D12_RT_FORMAT_ARRAY);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_DESC }
TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_DESC = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TDXGI_SAMPLE_DESC;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_DESC);
{$ENDIF}
constructor Create(i:TDXGI_SAMPLE_DESC);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_MASK }
TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_MASK = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:UINT;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_MASK);
{$ENDIF}
constructor Create(i:UINT);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_CACHED_PSO }
TD3DX12_PIPELINE_STATE_STREAM_CACHED_PSO = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3D12_CACHED_PIPELINE_STATE;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_CACHED_PSO);
{$ENDIF}
constructor Create(i:TD3D12_CACHED_PIPELINE_STATE);
end;
{ TD3DX12_PIPELINE_STATE_STREAM_VIEW_INSTANCING }
TD3DX12_PIPELINE_STATE_STREAM_VIEW_INSTANCING = record
_Type:TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE; // D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
_Inner:TD3DX12_VIEW_INSTANCING_DESC;
{$IFDEF FPC}
class operator Initialize(var A: TD3DX12_PIPELINE_STATE_STREAM_VIEW_INSTANCING);
{$ENDIF}
constructor Create(i:TD3DX12_VIEW_INSTANCING_DESC);
end;
// TD3DX12_PIPELINE_STATE_STREAM works on RS2+ but does not support new subobject(s) added in RS3+.
// See TD3DX12_PIPELINE_STATE_STREAM1 for instance.
TD3DX12_PIPELINE_STATE_STREAM = record
Flags: TD3DX12_PIPELINE_STATE_STREAM_FLAGS;
NodeMask: TD3DX12_PIPELINE_STATE_STREAM_NODE_MASK;
pRootSignature: TD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE;
InputLayout: TD3DX12_PIPELINE_STATE_STREAM_INPUT_LAYOUT;
IBStripCutValue: TD3DX12_PIPELINE_STATE_STREAM_IB_STRIP_CUT_VALUE;
PrimitiveTopologyType: TD3DX12_PIPELINE_STATE_STREAM_PRIMITIVE_TOPOLOGY;
VS: TD3DX12_PIPELINE_STATE_STREAM_VS;
GS: TD3DX12_PIPELINE_STATE_STREAM_GS;
StreamOutput: TD3DX12_PIPELINE_STATE_STREAM_STREAM_OUTPUT;
HS: TD3DX12_PIPELINE_STATE_STREAM_HS;
DS: TD3DX12_PIPELINE_STATE_STREAM_DS;
PS: TD3DX12_PIPELINE_STATE_STREAM_PS;
CS: TD3DX12_PIPELINE_STATE_STREAM_CS;
BlendState: TD3DX12_PIPELINE_STATE_STREAM_BLEND_DESC;
DepthStencilState: TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL1;
DSVFormat: TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL_FORMAT;
RasterizerState: TD3DX12_PIPELINE_STATE_STREAM_RASTERIZER;
RTVFormats: TD3DX12_PIPELINE_STATE_STREAM_RENDER_TARGET_FORMATS;
SampleDesc: TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_DESC;
SampleMask: TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_MASK;
CachedPSO: TD3DX12_PIPELINE_STATE_STREAM_CACHED_PSO;
end;
TErrorUnknownSubobject = procedure(UnknownTypeValue: UINT);
ID3DX12PipelineParserCallbacks = object
procedure FlagsCb (flag: PD3D12_PIPELINE_STATE_FLAGS); virtual; abstract;
procedure NodeMaskCb(NodeMaskCb: PUINT); virtual; abstract;
procedure RootSignatureCb (RootSignatureCb: PID3D12RootSignature); virtual; abstract;
procedure InputLayoutCb(const Desc: PD3D12_INPUT_LAYOUT_DESC); virtual; abstract;
procedure IBStripCutValueCb(CutValue: PD3D12_INDEX_BUFFER_STRIP_CUT_VALUE); virtual; abstract;
procedure PrimitiveTopologyTypeCb(_Type: PD3D12_PRIMITIVE_TOPOLOGY_TYPE); virtual; abstract;
procedure VSCb(const ByteCode:PD3D12_SHADER_BYTECODE); virtual; abstract;
procedure GSCb(const ByteCode:PD3D12_SHADER_BYTECODE); virtual; abstract;
procedure StreamOutputCb(const Desc: PD3D12_STREAM_OUTPUT_DESC); virtual; abstract;
procedure HSCb(const ByteCode:PD3D12_SHADER_BYTECODE); virtual; abstract;
procedure DSCb(const ByteCode:PD3D12_SHADER_BYTECODE); virtual; abstract;
procedure PSCb(const ByteCode:PD3D12_SHADER_BYTECODE); virtual; abstract;
procedure CSCb(const ByteCode:PD3D12_SHADER_BYTECODE); virtual; abstract;
procedure BlendStateCb(const Desc: PD3D12_BLEND_DESC); virtual; abstract;
procedure DepthStencilStateCb(const Desc:PD3D12_DEPTH_STENCIL_DESC); virtual; abstract;
procedure DepthStencilState1Cb(const Desc:PD3D12_DEPTH_STENCIL_DESC1); virtual; abstract;
procedure DSVFormatCb(Format:PDXGI_FORMAT); virtual; abstract;
procedure RasterizerStateCb(const Desc: PD3D12_RASTERIZER_DESC); virtual; abstract;
procedure RTVFormatsCb(const PD3D12_RT_FORMAT_ARRAY); virtual; abstract;
procedure SampleDescCb(const Desc:PDXGI_SAMPLE_DESC) ; virtual; abstract;
procedure SampleMaskCb(Mask: PUINT); virtual; abstract;
procedure ViewInstancingCb(const Desc: PD3D12_VIEW_INSTANCING_DESC); virtual; abstract;
procedure CachedPSOCb(const State: PD3D12_CACHED_PIPELINE_STATE); virtual; abstract;
// Error Callbacks
procedure ErrorBadInputParameter (ParameterIndex: UINT); virtual; abstract;
procedure ErrorDuplicateSubobject (DuplicateType: TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE); virtual; abstract;
procedure ErrorUnknownSubobject (UnknownTypeValue: UINT); virtual; abstract;
end;
function UpdateSubresources(pCmdList: ID3D12GraphicsCommandList; pDestinationResource: ID3D12Resource;
pIntermediate: ID3D12Resource; FirstSubresource: UINT; // n_range_(0;D3D12_REQ_SUBRESOURCES)
NumSubresources: UINT; // _In_range_(0;D3D12_REQ_SUBRESOURCES-FirstSubresource)
RequiredSize: UINT64; const pLayouts: PD3D12_PLACED_SUBRESOURCE_FOOTPRINT{NumSubresources}; const pNumRows: PUINT;
const pRowSizesInBytes: PUINT64; const pSrcData: PD3D12_SUBRESOURCE_DATA): UINT64; overload;
function UpdateSubresources(MaxSubresources: UINT; pCmdList: ID3D12GraphicsCommandList; pDestinationResource: ID3D12Resource;
pIntermediate: ID3D12Resource; IntermediateOffset: UINT64; FirstSubresource: UINT; NumSubresources: UINT;
pSrcData: PD3D12_SUBRESOURCE_DATA{NumSubresources}): UINT64; overload;
//------------------------------------------------------------------------------------------------
// Heap-allocating UpdateSubresources implementation
function UpdateSubresources(pCmdList: ID3D12GraphicsCommandList; pDestinationResource: ID3D12Resource;
pIntermediate: ID3D12Resource; IntermediateOffset: UINT64; FirstSubresource: UINT; NumSubresources: UINT;
pSrcData: PD3D12_SUBRESOURCE_DATA{NumSubresources}): UINT64; overload;
//------------------------------------------------------------------------------------------------
// Returns required size of a buffer to be used for data upload
function GetRequiredIntermediateSize(pDestinationResource: ID3D12Resource; FirstSubresource: UINT; NumSubresources: UINT): UINT64;{ inline;}
function D3D12IsLayoutOpaque(Layout: TD3D12_TEXTURE_LAYOUT): boolean;
//------------------------------------------------------------------------------------------------
// D3D12 exports a new method for serializing root signatures in the Windows 10 Anniversary Update.
// To help enable root signature 1.1 features when they are available and not require maintaining
// two code paths for building root signatures; this helper method reconstructs a 1.0 signature when
// 1.1 is not supported.
function D3DX12SerializeVersionedRootSignature(const pRootSignatureDesc: TD3D12_VERSIONED_ROOT_SIGNATURE_DESC;
MaxVersion: TD3D_ROOT_SIGNATURE_VERSION; out ppBlob;
{out} ppErrorBlob: PID3DBlob): HRESULT; {inline}
function D3DX12GetBaseSubobjectType(SubobjectType: TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE): TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE;{inline}
function D3DX12ParsePipelineStream(const Desc: TD3D12_PIPELINE_STATE_STREAM_DESC; pCallbacks: ID3DX12PipelineParserCallbacks): HRESULT; {inline}
implementation
//------------------------------------------------------------------------------------------------
// Row-by-row memcpy
{$POINTERMATH ON}
procedure MemcpySubresource(const pDest: PD3D12_MEMCPY_DEST; const pSrc: TD3D12_SUBRESOURCE_DATA; RowSizeInBytes: SIZE_T;
NumRows: UINT; NumSlices: UINT);
var
z, y: UINT;
pDestSlice: PByte;
pSrcSlice: PBYTE;
p1, p2: PBYTE;
begin
for z := 0 to NumSlices - 1 do
begin
pDestSlice := PByte(pDest^.pData) + pDest.SlicePitch * z;
pSrcSlice := PByte(pSrc.pData) + pSrc.SlicePitch * z;
for y := 0 to NumRows - 1 do
begin
move((pSrcSlice + pSrc.RowPitch * y)^,(pDestSlice + pDest^.RowPitch * y)^,RowSizeInBytes);
end;
end;
end;
//------------------------------------------------------------------------------------------------
// All arrays must be populated (e.g. by calling GetCopyableFootprints)
function UpdateSubresources(pCmdList: ID3D12GraphicsCommandList; pDestinationResource: ID3D12Resource;
pIntermediate: ID3D12Resource; FirstSubresource: UINT; NumSubresources: UINT; RequiredSize: UINT64;
const pLayouts: PD3D12_PLACED_SUBRESOURCE_FOOTPRINT{NumSubresources}; const pNumRows: PUINT; const pRowSizesInBytes: PUINT64;
const pSrcData: PD3D12_SUBRESOURCE_DATA): UINT64; {inline;} {overload;}
var
pData: PByte;
hr: HResult;
i: UINT;
IntermediateDesc: TD3D12_RESOURCE_DESC;
DestinationDesc: TD3D12_RESOURCE_DESC;
DestData: TD3D12_MEMCPY_DEST;
lLayouts: array of TD3D12_PLACED_SUBRESOURCE_FOOTPRINT absolute pLayouts;
lNumRows: array of UINT absolute pNumRows;
lRowSizesInBytes: array of UINT64 absolute pRowSizesInBytes;
lSrcData: array of TD3D12_SUBRESOURCE_DATA absolute pSrcData;
SrcBox: TD3D12_BOX;
Dst: TD3D12_TEXTURE_COPY_LOCATION;
Src: TD3D12_TEXTURE_COPY_LOCATION;
begin
Result := 0;
// Minor validation
IntermediateDesc := pIntermediate.GetDesc();
DestinationDesc := pDestinationResource.GetDesc();
if ((IntermediateDesc.Dimension <> D3D12_RESOURCE_DIMENSION_BUFFER) or (IntermediateDesc.Width < RequiredSize + lLayouts[0].Offset) or
(RequiredSize > SIZE_T(-1)) or ((DestinationDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER) and
((FirstSubresource <> 0) or (NumSubresources <> 1)))) then
Exit;
hr := pIntermediate.Map(0, nil, pData);
if (FAILED(hr)) then
Exit;
for i := 0 to NumSubresources - 1 do
begin
if (lRowSizesInBytes[i] > SIZE_T(-1)) then
Exit;
DestData.pData := pData + lLayouts[i].Offset;
DestData.RowPitch := lLayouts[i].Footprint.RowPitch;
DestData.SlicePitch := lLayouts[i].Footprint.RowPitch * lNumRows[i];
MemcpySubresource(@DestData, lSrcData[i], lRowSizesInBytes[i], lNumRows[i], lLayouts[i].Footprint.Depth);
end;
pIntermediate.Unmap(0, nil);
if (DestinationDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER) then
begin
SrcBox := TD3D12_BOX.Create(UINT(lLayouts[0].Offset), UINT(lLayouts[0].Offset + lLayouts[0].Footprint.Width));
pCmdList.CopyBufferRegion(
pDestinationResource, 0, pIntermediate, lLayouts[0].Offset, lLayouts[0].Footprint.Width);
end
else
begin
for i := 0 to NumSubresources - 1 do
begin
Dst := TD3D12_TEXTURE_COPY_LOCATION.Create(pDestinationResource, i + FirstSubresource);
Src := TD3D12_TEXTURE_COPY_LOCATION.Create(pIntermediate, lLayouts[i]);
pCmdList.CopyTextureRegion(@Dst, 0, 0, 0, @Src, nil);
end;
end;
Result := RequiredSize;
end;
//------------------------------------------------------------------------------------------------
// Stack-allocating UpdateSubresources implementation
//template <UINT >
function UpdateSubresources(MaxSubresources: UINT; pCmdList: ID3D12GraphicsCommandList; pDestinationResource: ID3D12Resource;
pIntermediate: ID3D12Resource; IntermediateOffset: UINT64; FirstSubresource: UINT; NumSubresources: UINT;
pSrcData: PD3D12_SUBRESOURCE_DATA{NumSubresources}): UINT64;
var
RequiredSize: UINT64;
Layouts: array {[0..MaxSubresources - 1]} of TD3D12_PLACED_SUBRESOURCE_FOOTPRINT;
NumRows: array {[0..MaxSubresources - 1]} of UINT;
RowSizesInBytes: array { [0..MaxSubresources - 1]} of UINT64;
Desc: TD3D12_RESOURCE_DESC;
pDevice: ID3D12Device;
begin
RequiredSize := 0;
SetLength(Layouts, MaxSubresources);
SetLength(NumRows, MaxSubresources);
SetLength(RowSizesInBytes, MaxSubresources);
Desc := pDestinationResource.GetDesc();
pDestinationResource.GetDevice(IID_ID3D12Device, pDevice);
pDevice.GetCopyableFootprints(Desc, FirstSubresource, NumSubresources, IntermediateOffset, @Layouts[0], @NumRows[0],
@RowSizesInBytes[0], RequiredSize);
pDevice := nil;
Result := UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources,
RequiredSize, @Layouts[0], @NumRows[0], @RowSizesInBytes[0], pSrcData);
SetLength(Layouts, 0);
SetLength(NumRows, 0);
SetLength(RowSizesInBytes, 0);
end;
//------------------------------------------------------------------------------------------------
// Heap-allocating UpdateSubresources implementation
function UpdateSubresources(pCmdList: ID3D12GraphicsCommandList; pDestinationResource: ID3D12Resource;
pIntermediate: ID3D12Resource; IntermediateOffset: UINT64; FirstSubresource: UINT; NumSubresources: UINT;
pSrcData: PD3D12_SUBRESOURCE_DATA{NumSubresources}): UINT64; overload;
var
RequiredSize: UINT64;
MemToAlloc: UINT64;
Desc: TD3D12_RESOURCE_DESC;
pDevice: ID3D12Device;
pMem: pointer;
pLayouts: PD3D12_PLACED_SUBRESOURCE_FOOTPRINT;
pRowSizesInBytes: PUINT64;
pNumRows: PUINT;
begin
Result := 0;
RequiredSize:=0;
MemToAlloc := (sizeof(TD3D12_PLACED_SUBRESOURCE_FOOTPRINT) + sizeof(UINT) + sizeof(UINT64)) * NumSubresources;
if (MemToAlloc > SIZE_MAX) then
Exit;
pMem := HeapAlloc(GetProcessHeap(), 0, MemToAlloc);
if (pMem = nil) then
Exit;
pLayouts := pMem;
pRowSizesInBytes := PUINT64(pLayouts) + SizeOf(TD3D12_PLACED_SUBRESOURCE_FOOTPRINT) * NumSubresources;
pNumRows := PUINT(pRowSizesInBytes) + Sizeof(UINT64) * NumSubresources;
Desc := pDestinationResource.GetDesc();
pDestinationResource.GetDevice(IID_ID3D12Device, pDevice);
pDevice.GetCopyableFootprints(@Desc, FirstSubresource, NumSubresources, IntermediateOffset, pLayouts, pNumRows, pRowSizesInBytes, RequiredSize);
pDevice := nil;
Result := UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources,
RequiredSize, pLayouts, pNumRows, pRowSizesInBytes, pSrcData);
HeapFree(GetProcessHeap(), 0, pMem);
end;
function GetRequiredIntermediateSize(pDestinationResource: ID3D12Resource; FirstSubresource: UINT; NumSubresources: UINT): UINT64;
var
Desc: TD3D12_RESOURCE_DESC;
RequiredSize: UINT64;
pDevice: ID3D12Device;
begin
RequiredSize := 0;
Desc := pDestinationResource.GetDesc();
pDestinationResource.GetDevice(IID_ID3D12Device, pDevice);
pDevice.GetCopyableFootprints(Desc, FirstSubresource, NumSubresources, 0, nil, nil, nil, RequiredSize);
pDevice := nil;
Result := RequiredSize;
end;
function D3D12IsLayoutOpaque(Layout: TD3D12_TEXTURE_LAYOUT): boolean;
begin
Result := (Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN) or (Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE);
end;
function D3DX12SerializeVersionedRootSignature(const pRootSignatureDesc: TD3D12_VERSIONED_ROOT_SIGNATURE_DESC;
MaxVersion: TD3D_ROOT_SIGNATURE_VERSION; out ppBlob;
{out} ppErrorBlob: PID3DBlob): HRESULT; {inline}
var
hr: HResult;
desc_1_1: TD3D12_ROOT_SIGNATURE_DESC1;
ParametersSize: SIZE_T;
pParameters: pointer;
pParameters_1_0: TD3D12_ROOT_PARAMETER_ARRAY;
n: UINT;
table_1_1: TD3D12_ROOT_DESCRIPTOR_TABLE1;
DescriptorRangesSize: SIZE_T;
pDescriptorRanges: pointer;
pDescriptorRanges_1_0: TD3D12_DESCRIPTOR_RANGE_ARRAY;
x: uint;
table_1_0: TD3D12_ROOT_DESCRIPTOR_TABLE;
desc_1_0: TD3DX12_ROOT_SIGNATURE_DESC;
begin
Result := E_INVALIDARG;
if (ppErrorBlob <> nil) then
ppErrorBlob := nil;
case (MaxVersion) of
D3D_ROOT_SIGNATURE_VERSION_1_0:
case (pRootSignatureDesc.Version) of
D3D_ROOT_SIGNATURE_VERSION_1_0:
begin
Result := D3D12SerializeRootSignature(pRootSignatureDesc.Desc_1_0, D3D_ROOT_SIGNATURE_VERSION_1,
ID3D10Blob(ppBlob), ppErrorBlob);
end;
D3D_ROOT_SIGNATURE_VERSION_1_1:
begin
hr := S_OK;
desc_1_1 := pRootSignatureDesc.Desc_1_1;
ParametersSize := sizeof(TD3D12_ROOT_PARAMETER) * desc_1_1.NumParameters;
if (ParametersSize > 0) then
pParameters := HeapAlloc(GetProcessHeap(), 0, ParametersSize)
else
pParameters := nil;
if (ParametersSize > 0) and (pParameters = nil) then
begin
hr := E_OUTOFMEMORY;
end;
pParameters_1_0 := TD3D12_ROOT_PARAMETER_ARRAY(pParameters);
if (SUCCEEDED(hr)) then
begin
for n := 0 to desc_1_1.NumParameters - 1 do
begin
//?? __analysis_assume(ParametersSize = sizeof(TD3D12_ROOT_PARAMETER) * desc_1_1.NumParameters);
pParameters_1_0[n].ParameterType := desc_1_1.GetParameter(n).ParameterType;
pParameters_1_0[n].ShaderVisibility := desc_1_1.GetParameter(n).ShaderVisibility;
case (desc_1_1.GetParameter(n).ParameterType) of
D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS:
begin
pParameters_1_0[n].Constants.Num32BitValues := desc_1_1.GetParameter(n).Constants.Num32BitValues;
pParameters_1_0[n].Constants.RegisterSpace := desc_1_1.GetParameter(n).Constants.RegisterSpace;
pParameters_1_0[n].Constants.ShaderRegister := desc_1_1.GetParameter(n).Constants.ShaderRegister;
end;
D3D12_ROOT_PARAMETER_TYPE_CBV,
D3D12_ROOT_PARAMETER_TYPE_SRV,
D3D12_ROOT_PARAMETER_TYPE_UAV:
begin
pParameters_1_0[n].Descriptor.RegisterSpace := desc_1_1.GetParameter(n).Descriptor.RegisterSpace;
pParameters_1_0[n].Descriptor.ShaderRegister := desc_1_1.GetParameter(n).Descriptor.ShaderRegister;
end;
D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
begin
table_1_1 := desc_1_1.GetParameter(n).DescriptorTable;
DescriptorRangesSize := sizeof(TD3D12_DESCRIPTOR_RANGE) * table_1_1.NumDescriptorRanges;
if ((DescriptorRangesSize > 0) and SUCCEEDED(hr)) then
pDescriptorRanges := HeapAlloc(GetProcessHeap(), 0, DescriptorRangesSize)
else
pDescriptorRanges := nil;
if ((DescriptorRangesSize > 0) and (pDescriptorRanges = nil)) then
begin
hr := E_OUTOFMEMORY;
end;
pDescriptorRanges_1_0 := TD3D12_DESCRIPTOR_RANGE_ARRAY(pDescriptorRanges);
if (SUCCEEDED(hr)) then
begin
for x := 0 to table_1_1.NumDescriptorRanges - 1 do
begin
//?? __analysis_assume(DescriptorRangesSize = sizeof(TD3D12_DESCRIPTOR_RANGE) * table_1_1.NumDescriptorRanges);
pDescriptorRanges_1_0[x].BaseShaderRegister := table_1_1.GetDescriptorRange(x).BaseShaderRegister;
pDescriptorRanges_1_0[x].NumDescriptors := table_1_1.GetDescriptorRange(x).NumDescriptors;
pDescriptorRanges_1_0[x].OffsetInDescriptorsFromTableStart :=
table_1_1.GetDescriptorRange(x).OffsetInDescriptorsFromTableStart;
pDescriptorRanges_1_0[x].RangeType := table_1_1.GetDescriptorRange(x).RangeType;
pDescriptorRanges_1_0[x].RegisterSpace := table_1_1.GetDescriptorRange(x).RegisterSpace;
end;
end;
table_1_0 := pParameters_1_0[n].DescriptorTable;
table_1_0.NumDescriptorRanges := table_1_1.NumDescriptorRanges;
table_1_0.pDescriptorRanges := @pDescriptorRanges_1_0[0];
end;
end;
end;
if (SUCCEEDED(hr)) then
begin
desc_1_0.Create(desc_1_1.NumParameters, @pParameters_1_0[0], desc_1_1.NumStaticSamplers,
desc_1_1.pStaticSamplers, desc_1_1.Flags);
hr := D3D12SerializeRootSignature(desc_1_0, D3D_ROOT_SIGNATURE_VERSION_1, ID3DBlob(ppBlob), ppErrorBlob);
end;
if (pParameters <> nil) then
begin
for n := 0 to desc_1_1.NumParameters - 1 do
begin
if (desc_1_1.GetParameter(n).ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE) then
begin
HeapFree(GetProcessHeap(), 0, pParameters_1_0[n].DescriptorTable.pDescriptorRanges);
end;
end;
HeapFree(GetProcessHeap(), 0, pParameters);
end;
Result := hr;
end;
end;
end;
D3D_ROOT_SIGNATURE_VERSION_1_1:
begin
Result := D3D12SerializeVersionedRootSignature(pRootSignatureDesc, PID3DBlob(ppBlob), ppErrorBlob);
end;
end;
end;
function D3DX12GetBaseSubobjectType(SubobjectType: TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE): TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE;
begin
case (SubobjectType) of
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1:
Result := D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL;
else
Result := SubobjectType;
end;
end;
function D3DX12ParsePipelineStream(const Desc: TD3D12_PIPELINE_STATE_STREAM_DESC; pCallbacks: ID3DX12PipelineParserCallbacks): HRESULT;
var
CurOffset: SIZE_T;
SizeOfSubobject: SIZE_T; // ??? TODO
pStream: PBYTE;
SubobjectSeen: array [0..ord(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MAX_VALID) - 1] of longbool;
SubobjectType: TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE;
begin
if ((Desc.SizeInBytes = 0) or (Desc.pPipelineStateSubobjectStream = nil)) then
begin
pCallbacks.ErrorBadInputParameter(1); // first parameter issue
Result := E_INVALIDARG;
Exit;
end;
if (@pCallbacks = nil) then
begin
pCallbacks.ErrorBadInputParameter(2); // second parameter issue
Result := E_INVALIDARG;
Exit;
end;
CurOffset := 0;
while CurOffset < Desc.SizeInBytes do
// for CurOffset := 0 to ; SizeOfSubobject := 0; CurOffset < Desc.SizeInBytes; CurOffset += SizeOfSubobject)
begin
SizeOfSubobject := 0;
pStream := PBYTE(Desc.pPipelineStateSubobjectStream) + CurOffset;
// auto SubobjectType := *reinterpret_cast<TD3D12_PIPELINE_STATE_SUBOBJECT_TYPE*>(pStream);
if (SubobjectType >= D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MAX_VALID) then
begin
pCallbacks.ErrorUnknownSubobject(Ord(SubobjectType));
Result := E_INVALIDARG;
Exit;
end;
if (SubobjectSeen[Ord(D3DX12GetBaseSubobjectType(SubobjectType))]) then
begin
pCallbacks.ErrorDuplicateSubobject(SubobjectType);
Result := E_INVALIDARG; // disallow subobject duplicates in a stream
exit;
end;
SubobjectSeen[Ord(SubobjectType)] := True;
case (SubobjectType) of
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE:
begin
pCallbacks.RootSignatureCb(PID3D12RootSignature(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VS:
begin
pCallbacks.VSCb(PD3D12_SHADER_BYTECODE(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_VS);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PS:
begin
pCallbacks.PSCb(PD3D12_SHADER_BYTECODE(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_PS);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DS:
begin
pCallbacks.DSCb( PD3D12_SHADER_BYTECODE(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_DS);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_HS:
begin
pCallbacks.HSCb( PD3D12_SHADER_BYTECODE(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_HS);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_GS:
begin
pCallbacks.GSCb (PD3D12_SHADER_BYTECODE(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_GS);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CS:
begin
pCallbacks.CSCb( PD3D12_SHADER_BYTECODE(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_CS);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_STREAM_OUTPUT:
begin
pCallbacks.StreamOutputCb( PD3D12_STREAM_OUTPUT_DESC(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_STREAM_OUTPUT);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_BLEND:
begin
pCallbacks.BlendStateCb( PD3D12_BLEND_DESC(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_BLEND_DESC);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_MASK:
begin
pCallbacks.SampleMaskCb( PUINT(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_MASK);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER:
begin
pCallbacks.RasterizerStateCb( PD3D12_RASTERIZER_DESC(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_RASTERIZER);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL:
begin
pCallbacks.DepthStencilStateCb( PD3D12_DEPTH_STENCIL_DESC(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1:
begin
pCallbacks.DepthStencilState1Cb( PD3D12_DEPTH_STENCIL_DESC1(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL1);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT:
begin
pCallbacks.InputLayoutCb( PD3D12_INPUT_LAYOUT_DESC(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_INPUT_LAYOUT);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_IB_STRIP_CUT_VALUE:
begin
pCallbacks.IBStripCutValueCb( PD3D12_INDEX_BUFFER_STRIP_CUT_VALUE(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_IB_STRIP_CUT_VALUE);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY:
begin
pCallbacks.PrimitiveTopologyTypeCb( PD3D12_PRIMITIVE_TOPOLOGY_TYPE(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_PRIMITIVE_TOPOLOGY);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS:
begin
pCallbacks.RTVFormatsCb( PD3D12_RT_FORMAT_ARRAY(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_RENDER_TARGET_FORMATS);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT:
begin
pCallbacks.DSVFormatCb( PDXGI_FORMAT(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL_FORMAT);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_DESC:
begin
pCallbacks.SampleDescCb( PDXGI_SAMPLE_DESC(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_DESC);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK:
begin
pCallbacks.NodeMaskCb( PUINT(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_NODE_MASK);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CACHED_PSO:
begin
pCallbacks.CachedPSOCb( PD3D12_CACHED_PIPELINE_STATE(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_CACHED_PSO);
end;
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS:
begin
pCallbacks.FlagsCb( PD3D12_PIPELINE_STATE_FLAGS(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM_FLAGS);
end;
(*
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING:
begin
pCallbacks.ViewInstancingCb( PD3D12_VIEW_INSTANCING_DESC(pStream));
SizeOfSubobject := sizeof(TD3DX12_PIPELINE_STATE_STREAM1.ViewInstancingDesc);
end;
*)
else
begin
pCallbacks.ErrorUnknownSubobject(ord(SubobjectType));
Result := E_INVALIDARG;
Exit;
end;
end;
CurOffset := CurOffset + SizeOfSubobject;
end;
Result := S_OK;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_CACHED_PSO }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_CACHED_PSO.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_CACHED_PSO);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CACHED_PSO;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_CACHED_PSO.Create(
i: TD3D12_CACHED_PIPELINE_STATE);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_MASK }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_MASK.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_MASK);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_MASK; // ToDo DefaultSampleMask;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_MASK.Create(i: UINT);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_DESC }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_DESC.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_DESC);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_DESC; // ToDo DefaultSampleDesc;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_SAMPLE_DESC.Create(
i: TDXGI_SAMPLE_DESC);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_RENDER_TARGET_FORMATS }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_RENDER_TARGET_FORMATS.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_RENDER_TARGET_FORMATS);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_RENDER_TARGET_FORMATS.Create(
i: TD3D12_RT_FORMAT_ARRAY);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_RASTERIZER }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_RASTERIZER.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_RASTERIZER);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER; // TD3DX12_DEFAULT
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_RASTERIZER.Create(
i: TD3DX12_RASTERIZER_DESC);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL_FORMAT }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL_FORMAT.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL_FORMAT);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL_FORMAT.Create(
i: TDXGI_FORMAT);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_VIEW_INSTANCING }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_VIEW_INSTANCING.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_VIEW_INSTANCING);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING; // ToDo TD3DX12_DEFAULT
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_VIEW_INSTANCING.Create(
i: TD3DX12_VIEW_INSTANCING_DESC);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL1 }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL1.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL1);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1; // ToDo TD3DX12_DEFAULT
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL1.Create(
i: TD3DX12_DEPTH_STENCIL_DESC1);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL; // ToDo TD3DX12_DEFAULT
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL.Create(
i: TD3DX12_DEPTH_STENCIL_DESC);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_BLEND_DESC }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_BLEND_DESC.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_BLEND_DESC);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_BLEND;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_BLEND_DESC.Create(
i: TD3DX12_BLEND_DESC);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_CS }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_CS.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_CS);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CS;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_CS.Create(i: TD3D12_SHADER_BYTECODE);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_PS }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_PS.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_PS);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PS;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_PS.Create(i: TD3D12_SHADER_BYTECODE);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_DS }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_DS.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_DS);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DS;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_DS.Create(i: TD3D12_SHADER_BYTECODE);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_HS }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_HS.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_HS);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_HS;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_HS.Create(i: TD3D12_SHADER_BYTECODE);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_STREAM_OUTPUT }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_STREAM_OUTPUT.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_STREAM_OUTPUT);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_STREAM_OUTPUT;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_STREAM_OUTPUT.Create(
i: TD3D12_STREAM_OUTPUT_DESC);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_GS }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_GS.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_GS);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_GS;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_GS.Create(i: TD3D12_SHADER_BYTECODE);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_VS }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_VS.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_VS);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VS;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_VS.Create(i: TD3D12_SHADER_BYTECODE);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_PRIMITIVE_TOPOLOGY }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_PRIMITIVE_TOPOLOGY.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_PRIMITIVE_TOPOLOGY);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_PRIMITIVE_TOPOLOGY.Create(
i: TD3D12_PRIMITIVE_TOPOLOGY_TYPE);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_IB_STRIP_CUT_VALUE }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_IB_STRIP_CUT_VALUE.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_IB_STRIP_CUT_VALUE);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_IB_STRIP_CUT_VALUE;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_IB_STRIP_CUT_VALUE.Create(
i: TD3D12_INDEX_BUFFER_STRIP_CUT_VALUE);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_INPUT_LAYOUT }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_INPUT_LAYOUT.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_INPUT_LAYOUT);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_INPUT_LAYOUT.Create(
i: TD3D12_INPUT_LAYOUT_DESC);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE.Create(
i: ID3D12RootSignature);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_NODE_MASK }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_NODE_MASK.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_NODE_MASK);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_NODE_MASK.Create(i: UINT);
begin
_Inner:=i;
end;
{ TD3DX12_PIPELINE_STATE_STREAM_FLAGS }
{$IFDEF FPC}
class operator TD3DX12_PIPELINE_STATE_STREAM_FLAGS.Initialize(
var A: TD3DX12_PIPELINE_STATE_STREAM_FLAGS);
begin
a._Type:=D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS;
end;
{$ENDIF}
constructor TD3DX12_PIPELINE_STATE_STREAM_FLAGS.Create(
i: TD3D12_PIPELINE_STATE_FLAGS);
begin
_Inner:=i;
end;
{ TD3DX12_CPU_DESCRIPTOR_HANDLE }
{$IFDEF FPC}
procedure TD3DX12_CPU_DESCRIPTOR_HANDLE.Offset(offsetScaledByIncrementSize: integer);
begin
Self.ptr := Self.ptr + offsetScaledByIncrementSize;
end;
procedure TD3DX12_CPU_DESCRIPTOR_HANDLE.Offset(offsetInDescriptors: integer; descriptorIncrementSize: UINT);
begin
Self.ptr := Self.ptr + offsetInDescriptors * descriptorIncrementSize;
end;
{$ENDIF}
{$ELSE}
implementation
{$ENDIF}
end.
| 37.5195 | 155 | 0.712016 |
838f22a142d0e6ded9a64cdaea72dbec2dbab62f | 1,903 | pas | Pascal | turtle/lottrp01.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 11 | 2015-12-12T05:13:15.000Z | 2020-10-14T13:32:08.000Z | turtle/lottrp01.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| null | null | null | turtle/lottrp01.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 8 | 2017-05-05T05:24:01.000Z | 2021-07-03T20:30:09.000Z | (* ┌───────────────────────────────────────────────────────────┐
│ Programated by Vladimir Zahoransky │
│ Vladko software │
│ Contact : zahoran@cezap.ii.fmph.uniba.sk │
│ Program tema : Draw circles ! │
└───────────────────────────────────────────────────────────┘ *)
{
This is first program useing oVelaKor. This program draw the
circles. All circles have good middle of circle. The relation
for this is for x-coordinate = 8*i-180. It is linear relation.
We define the turtles left - right and for rotation we change
the angle. And we draw the circle and then is this effekt.
The constants 8,180,60 are defined just for good effekt.
}
Uses oKor, oVelaKor;
Const n=60;
Var All:VelaKor;
i:integer;
Begin
Randomize;
With All do Begin
Init;
For i:=1 to n do Begin
UrobKor(8*i-180,0,12*i);
k[i].ZmenFP(random(15)+1);
End;
With k[1] do Begin
PH;
PresunXY(-300,200);
Pis('Key <space> turn on/off of step mode all turtles.');
Domov;
PD;
End;
Ukaz;
CakajKlaves;
for i:=1 to 360 do Begin
Dopredu(1);
Vlavo(1);
If Klaves=32 Then Begin
If k[1].ukazana Then Skry
Else Ukaz;
Klaves:=0;
End;
End;
CakajKlaves;
Koniec;
End;
End.
| 32.810345 | 77 | 0.377824 |
8524be951f038bead787185f6fb5666228ace3bf | 2,783 | pas | Pascal | code/ooFS.Directory.Make.pas | VencejoSoftware/ooFileSystem | fd1e8937326e648bfb371f7d9f13edcb0bad4ad6 | [
"BSD-3-Clause"
]
| null | null | null | code/ooFS.Directory.Make.pas | VencejoSoftware/ooFileSystem | fd1e8937326e648bfb371f7d9f13edcb0bad4ad6 | [
"BSD-3-Clause"
]
| null | null | null | code/ooFS.Directory.Make.pas | VencejoSoftware/ooFileSystem | fd1e8937326e648bfb371f7d9f13edcb0bad4ad6 | [
"BSD-3-Clause"
]
| 2 | 2019-11-21T03:19:12.000Z | 2021-01-26T04:52:12.000Z | {$REGION 'documentation'}
{
Copyright (c) 2016, Vencejo Software
Distributed under the terms of the Modified BSD License
The full license is distributed with this software
}
{
Command to create a directory
@created(10/02/2016)
@author Vencejo Software <www.vencejosoft.com>
}
{$ENDREGION}
unit ooFS.Directory.Make;
interface
uses
Windows, SysUtils,
{$IFNDEF fpc}
IOUtils,
{$ENDIF}
ooFS.Command.Delay,
ooFS.Directory,
ooFS.Command.Intf;
type
{$REGION 'documentation'}
{
@abstract(Implementation of command to create a directory)
Create a directory in the filesystem
}
{$ENDREGION}
IFSDirectoryMake = interface(IFSCommand<Boolean>)
['{E8F685BD-4F83-41C1-8C36-836724876205}']
end;
{$REGION 'documentation'}
{
@abstract(Implementation of @link(IFSDirectoryMake))
@member(
TryMake Try to make directory until success or max tries are reached
@param(Tries Actual try number to increment if not success)
@return(@true if success, @false if fail)
)
@member(
Execute Run make directory command
@return(@true if can create the directory, @false if not)
)
@member(
Create Object constructor
@param(Directory @link(IFSDirectory Path))
@param(MaxTries Max tries for make fail)
)
@member(
New Create a new @classname as interface
@param(Directory @link(IFSDirectory Path))
@param(MaxTries Max tries for make fail)
)
}
{$ENDREGION}
TFSDirectoryMake = class sealed(TInterfacedObject, IFSDirectoryMake)
strict private
const
DELAY_IN_TRY = 200;
strict private
_Directory: IFSDirectory;
_MaxTries: Byte;
private
function TryMake(const Tries: Byte): Boolean;
public
function Execute: Boolean;
constructor Create(const Directory: IFSDirectory; const MaxTries: Byte = 10);
class function New(const Directory: IFSDirectory; const MaxTries: Byte = 10): IFSDirectoryMake;
end;
implementation
function TFSDirectoryMake.TryMake(const Tries: Byte): Boolean;
begin
{$IFDEF fpc}
CreateDir(_Directory.Path);
{$ELSE}
TDirectory.CreateDirectory(_Directory.Path);
{$ENDIF}
Result := DirectoryExists(_Directory.Path);
if not Result and (Tries < _MaxTries) then
begin
TFSCommandDelay.New(DELAY_IN_TRY).Execute;
Result := TryMake(Tries + 1);
end;
end;
function TFSDirectoryMake.Execute: Boolean;
begin
if not DirectoryExists(_Directory.Path) then
Result := TryMake(0)
else
Result := False;
end;
constructor TFSDirectoryMake.Create(const Directory: IFSDirectory; const MaxTries: Byte = 10);
begin
_Directory := Directory;
_MaxTries := MaxTries;
end;
class function TFSDirectoryMake.New(const Directory: IFSDirectory; const MaxTries: Byte = 10): IFSDirectoryMake;
begin
Result := TFSDirectoryMake.Create(Directory, MaxTries);
end;
end.
| 24.628319 | 112 | 0.733741 |
f1ec2c7046fe890b8f01aedfb349e9b8cbcce242 | 2,932 | pas | Pascal | Examples/trunk/canvas_test/drawtest.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 11 | 2017-06-17T05:13:45.000Z | 2021-07-11T13:18:48.000Z | Examples/trunk/canvas_test/drawtest.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 2 | 2019-03-05T12:52:40.000Z | 2021-12-03T12:34:26.000Z | Examples/trunk/canvas_test/drawtest.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 6 | 2017-09-07T09:10:09.000Z | 2022-02-19T20:19:58.000Z | unit drawtest;
{$mode objfpc}
interface
uses
Classes, Forms, Graphics;
type
{ TfrmDraw }
TfrmDraw = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
public
end;
var
frmDraw: TfrmDraw;
implementation
{$R *.lfm}
{ TfrmDraw }
procedure TfrmDraw.FormPaint(Sender: TObject);
var
Bmp: TBitmap;
begin
Bmp := TBitmap.Create;
Bmp.Width := 50;
Bmp.Height := 50;
Bmp.Canvas.Brush.Color := clBlue;
Bmp.Canvas.Rectangle(0, 0, 50, 50);
Canvas.CopyMode := cmSrcCopy;
// BrushCopy
Canvas.TextOut(50, 30, 'CopyBrush simple');
Canvas.Brush.Color := clYellow;
Canvas.BrushCopy(Bounds(50, 50, 50, 50), Bmp, Bounds(0, 0, 50, 50), clBlue);
Canvas.TextOut(200, 30, 'CopyBrush stretch');
Canvas.Brush.Color := clYellow;
Canvas.BrushCopy(Bounds(200, 50, 20, 20), Bmp, Bounds(0, 0, 50, 50), clBlue);
Canvas.TextOut(350, 30, 'CopyBrush SrcRect');
Canvas.Brush.Color := clYellow;
Canvas.BrushCopy(Bounds(350, 50, 20, 20), Bmp, Bounds(30, 30, 20, 20), clBlue);
// CopyMode
Canvas.TextOut(50, 130, 'cmBlackness');
Canvas.CopyMode := cmBlackness;
Canvas.Draw(50, 150, Bmp);
Canvas.TextOut(150, 130, 'cmDstInvert');
Canvas.CopyMode := cmDstInvert;
Canvas.Draw(150, 150, Bmp);
Canvas.TextOut(250, 130, 'cmMergeCopy');
Canvas.CopyMode := cmMergeCopy;
Canvas.Draw(250, 150, Bmp);
Canvas.TextOut(350, 130, 'cmMergePaint');
Canvas.CopyMode := cmMergePaint;
Canvas.Draw(350, 150, Bmp);
Canvas.TextOut(450, 130, 'cmNotSrcCopy');
Canvas.CopyMode := cmNotSrcCopy;
Canvas.Draw(450, 150, Bmp);
// CopyMode line 2
Canvas.TextOut(50, 230, 'cmNotSrcErase');
Canvas.CopyMode := cmNotSrcErase;
Canvas.Draw(50, 250, Bmp);
Canvas.TextOut(150, 230, 'cmPatCopy');
Canvas.CopyMode := cmPatCopy;
Canvas.Draw(150, 250, Bmp);
Canvas.TextOut(250, 230, 'cmPatInvert');
Canvas.CopyMode := cmPatInvert;
Canvas.Draw(250, 250, Bmp);
Canvas.TextOut(350, 230, 'cmPatPaint');
Canvas.CopyMode := cmPatPaint;
Canvas.Draw(350, 250, Bmp);
Canvas.TextOut(450, 230, 'cmSrcAnd');
Canvas.CopyMode := cmSrcAnd;
Canvas.Draw(450, 250, Bmp);
// CopyMode line 3
Canvas.TextOut(50, 330, 'cmSrcCopy');
Canvas.CopyMode := cmSrcCopy;
Canvas.Draw(50, 350, Bmp);
Canvas.TextOut(150, 330, 'cmSrcErase');
Canvas.CopyMode := cmSrcErase;
Canvas.Draw(150, 350, Bmp);
Canvas.TextOut(250, 330, 'cmSrcInvert');
Canvas.CopyMode := cmSrcInvert;
Canvas.Draw(250, 350, Bmp);
Canvas.TextOut(350, 330, 'cmSrcPaint');
Canvas.CopyMode := cmSrcPaint;
Canvas.Draw(350, 350, Bmp);
Canvas.TextOut(450, 330, 'cmWhiteness');
Canvas.CopyMode := cmWhiteness;
Canvas.Draw(450, 350, Bmp);
Bmp.Free;
end;
procedure TfrmDraw.FormCreate(Sender: TObject);
begin
end;
end.
| 22.212121 | 82 | 0.646658 |
8347447b7e1835a5b2a8dffe7db14dc59aa08dd2 | 51,564 | pas | Pascal | AH-Server/src/net.pas | Cooler2/ApusEngineExamples | 9ab7e75635e4a790aff58d364168ac511b76d735 | [
"BSD-3-Clause"
]
| 33 | 2020-03-06T09:14:48.000Z | 2022-03-08T14:54:46.000Z | AH-Server/src/net.pas | Cooler2/ApusEngineExamples | 9ab7e75635e4a790aff58d364168ac511b76d735 | [
"BSD-3-Clause"
]
| null | null | null | AH-Server/src/net.pas | Cooler2/ApusEngineExamples | 9ab7e75635e4a790aff58d364168ac511b76d735 | [
"BSD-3-Clause"
]
| 10 | 2020-03-06T16:51:00.000Z | 2022-03-08T19:16:04.000Z | // Универсальная сетевая часть сервера: реализация HTTP на overlapped-сокетов TCP/IP
// Copyright (C) Ivan Polyacov, ivan@apus-software.com, cooler@tut.by
{$R+}
unit net;
interface
type
// аттрибуты соединения
TConAttr=(caIP, // IP-адрес
caCountry); // Страна, соответствующая IP
// состояние соединения
TConStatus=(csNone=0,
csReading=1, // идет чтение из сети (ожидание) входящего запроса
csWaiting=2, // ждем когда будет готов ответ на запрос
csWriting=3, // идет запись (отправка в сеть) ответа
csClosing=4); // соединение нуждается в закрытии
TConInfo=record
ID:integer;
cometUserID:cardinal; // если соединение ожидает данных для юзера - здесь userID
remIP:cardinal;
remPort:word;
clientType:byte; // 0 - browser
country:string[3];
status:TConStatus;
keepAlive:boolean;
opened,lastRequestTime:TDateTime;
timeout:integer;
end;
TConInfoArray=array of TConInfo;
var
loopCounter:int64;
netThreadTimestamp:TDateTime;
acceptIncomingMessages:boolean=true; // разрешить входящие запросы
procedure StartNetwork;
procedure DoneNetwork;
function FormatResponse(body:UTF8String;dontCompress:boolean=false;mime:UTF8String='';cacheControl:UTF8String=''):UTF8String;
function FormatError(status,query:UTF8String):UTF8String;
// записать данные сообщения в исходящий буфер соединения (либо отправить)
// msg - без заголовков! (может добавляться к уже накопленным сообщениям)
procedure SendMsg(con:integer;msg:UTF8String;urgency:byte=0);
// Получить параметр запроса, который обрабатывается в соединении con по его имени
// idx желательно получать через TConnection.GetTarget
function Param(CRID:integer;name:UTF8String):UTF8String;
// Получить cookie запроса, который обрабатывается в соединении con по его имени
// idx желательно получать через TConnection.GetTarget
function Cookie(CRID:integer;name:UTF8String):UTF8String;
// Возвращает запрашиваемый аттрибут соединения по его индексу
function GetConnAttr(con:integer;attr:TConAttr):UTF8String;
function GetConnInfo(con:integer):TConInfo;
// Увеличивает счетчик бана по IP
procedure UseIP(con:integer;value:integer);
function GetConnectionsList:TConInfoArray;
function GetConCount:integer;
procedure CheckConIndex(var con:integer);
procedure CloseUserConnections(userID:integer);
implementation
uses windows,SysUtils,classes,logging,WinSock2,MyServis,structs,globals,
GeoIP,serverLogic,customLogic,workers, gameData,ZLibEx;
const
ERR400 = '400 Bad request ';
ERR403 = '403 Forbidden ';
ERR404 = '404 Not Found ';
ERR500 = '500 Internal Server Error ';
ERR503 = '503 Service Unavailable ';
type
TNetworkThread=class(TThread)
procedure Execute; override;
end;
TConnection=record
selfID:integer; // ID данного соединения
socket:TSocket;
cometUserID:integer; // если соединение ожидает данных для юзера - здесь userID
remIP:cardinal;
remPort:word;
country:string[3];
status:TConStatus;
keepAlive:boolean;
inBuf:UTF8String; // буфер для входящих данных
inPos:integer; // текущая позиция - номер первого незанятого байта
headersParsed:boolean; // заголовки были получены и обработаны?
bodySize,bodyPos:integer; // размер и расположение тела (для запроса POST)
requestRnd:byte; // случайное число, обновляющееся с каждым новым запросом
rTypeGet:boolean; // тип запроса
rURI:UTF8String; // что запрашивается
query:UTF8String; // часть запроса после '?'
contentType:UTF8String; // тип тела запроса POST
body:UTF8String; // тело запроса (POST)
userAgent:UTF8String;
cookies:UTF8String; // куки из заголовка
dontCompress:boolean;
outBuf:UTF8String; // исходящие данные
overlapped:TOverlapped;
opened,lastRequestTime:TDateTime;
timeOut:int64; // момент после которого нужно закрыть соединение по таймауту (MyTickCount)
closeReason:byte; // 1 - not keep-alive, 2 - receive error, 3 - error, 5 - graceful termination, 7 - закрыто сервером за ненадобностью
parNames,parValues:AStringArr;
function RequestReceived(bytesReceived:integer):boolean;
function ParseHeaders(size:integer):boolean; // возвращает false если запрос некорректный
procedure HandleRequest;
procedure SendResponse(context:integer=0);
procedure ExtractParameters; // заполняет массивы имен и значений параметров
procedure HandleLogin;
procedure HandleLogout;
procedure HandleCheckValue;
procedure HandleNewAcc;
procedure HandleUserMsgs(userID,serial:integer;sign:UTF8String);
procedure HandleCometRequest(userID:integer;serial:cardinal;sign:UTF8String);
function Param(name:UTF8String):UTF8String;
function GetCRID:cardinal; // Target текущего запроса
procedure PrepareForNextRequest;
function FormatError(status:UTF8String):UTF8String;
function GetInfo:TConInfo;
end;
TStatistics=record
sentBytes,receivedBytes:int64;
requests,connections:int64;
end;
{ TBanItem=record
ip:cardinal;
value:integer;
end;}
TBadIP=record
ip:cardinal;
errors:integer;
end;
const
logError=logging.logError;
var
netThread:TNetworkThread;
//crSect:TMyCriticalSection;
sock:TSocket;
local_IP:cardinal=INADDR_ANY; // localhost
// Сокеты подключений клиентов
connections:array[1..MAX_CONNECTIONS_LIMIT] of TConnection;
// list of free connection indices
// freeCon:array[1..MAX_CONNECTIONS_LIMIT] of integer;
// conCount:integer=0; // кол-во занятых соединений
{ // список соединений, в которых есть данные для отправки
notifications:array[1..MAX_CONNECTIONS_LIMIT] of integer;
nCount:integer;}
// totalUrgency:integer;
event:THandle; // событие, связанное с выполнением какой-либо сетевой задачи
lastSecond,lastMinute,lastHour,lastDay:integer; // для таймера
firstTimer:boolean=true;
// Statistics
// stat:TStatistics;
// время до сброса лога
timeToFlush:integer;
// Temporary ban list
// Принцип работы: IP -> значение
// С каждым запросом значение растёт, с каждым ошибочным запросом значение растет сильно
// При достижении критического уровня (100) соединение закрывается, новые соединения с этого IP не принимаются
// Раз в секунду значение уменьшается на 10
banlist:array[0..$3FFFFF] of byte; // 4Mb table
badIP:array[0..7] of TBadIP; // проблемные IP - на такие сообщения отправляются чаще
function IPHash(ip:cardinal):cardinal; inline;
begin
result:=((ip shr 12) xor ip) and $3FFFFF;
end;
procedure UseIP(con:integer;value:integer);
var
ip:cardinal;
begin
ip:=connections[con and $FFFF].remIP;
ip:=IPhash(ip);
value:=banlist[ip]+value;
if value<0 then value:=0;
if value>250 then value:=250;
banlist[ip]:=value;
end;
procedure MarkIPAsBad(ip:cardinal);
var
i:integer;
begin
for i:=0 to high(badIP) do
if badIP[i].ip=ip then begin
inc(badIP[i].errors);
if badIP[i].errors=4 then LogMsg('IP '+IpToStr(ip)+' reached 4 errors',logDebug);
exit;
end;
for i:=high(badIP) downto 1 do
badIP[i]:=badIP[i-1];
badIP[0].ip:=ip;
badIP[0].errors:=1;
end;
function GetIPErrors(ip:cardinal):integer;
var
i:integer;
begin
result:=0;
for i:=0 to high(badIP) do
if badIP[i].ip=ip then result:=badIP[i].errors;
end;
function connectionstr(idx:integer):UTF8String;
begin
with connections[idx] do
result:=inttostr(idx)+' '+IpToStr(remIP)+':'+inttostr(remPort);
end;
// Format UTF8String with HTTP body (skip headers) in printable form
function DumpData(buf:PByte;size:integer):UTF8String;
var
c:integer;
hdr:string[120];
begin
c:=min2(size,120);
SetLength(hdr,c);
move(buf^,hdr[1],c);
if pos('deflate'#13#10,hdr)>0 then begin
result:='<compressed_data>'; exit;
end;
c:=0;
while size>0 do begin
if buf^ in [10,13] then inc(c)
else c:=0;
inc(buf); dec(size);
if c=4 then break;
end;
size:=min2(size,100);
if size=0 then begin
result:='<empty>'; exit;
end;
SetLength(result,size);
move(buf^,result[1],size);
result:=PrintableStr(result);
end;
function GetConnectionsList:TConInfoArray;
var
i,cnt:integer;
begin
cnt:=0;
EnterCriticalSection(gSect);
try
SetLength(result,high(connections));
for i:=1 to high(connections) do
if connections[i].status<>csNone then begin
result[cnt]:=connections[i].GetInfo;
inc(cnt);
end;
finally
LeaveCriticalSection(gSect);
end;
SetLength(result,cnt);
end;
function GetConCount:integer;
var
i:integer;
begin
result:=0;
for i:=1 to MAX_CONNECTIONS do
if connections[i].status<>csNone then inc(result);
// result:=conCount;
end;
procedure CheckConIndex(var con:integer);
var
rbyte:byte;
begin
rByte:=con shr 16;
con:=con and $FFFF;
if rByte=0 then rByte:=connections[con].requestRnd;
if (con<1) or (con>High(connections)) then exit;
if (connections[con].status<>csWaiting) or
(connections[con].requestRnd<>rByte) then
raise EWarning.Create('Connection is in wrong state (wrong ID?)');
end;
function Param(CRID:integer;name:UTF8String):UTF8String;
begin
result:='';
CheckConIndex(CRID);
result:=connections[CRID].Param(name);
end;
function Cookie(CRID:integer;name:UTF8String):UTF8String;
var
i,p:integer;
cookies:AStringArr;
cname:UTF8String;
begin
result:='';
CheckConIndex(CRID);
cookies:=splitA(';',connections[CRID].cookies);
name:=UpperCase(name);
for i:=0 to length(cookies)-1 do begin
p:=pos('=',cookies[i]);
if p>0 then begin
cname:=UpperCase(copy(cookies[i],1,p-1));
if name=chop(cname) then begin
result:=copy(cookies[i],p+1,length(cookies[i]));
exit;
end;
end;
end;
end;
function GetConnAttr(con:integer;attr:TConAttr):UTF8String;
begin
result:='!ERROR!';
CheckConIndex(con);
case attr of
caIP:result:=IpToStr(connections[con].remIP);
caCountry:result:=connections[con].country;
end;
end;
function GetConnInfo(con:integer):TConInfo;
begin
CheckConIndex(con);
result:=connections[con].GetInfo;
end;
function WSAError(dwError:cardinal):UTF8String;
begin
case (dwError mod 1000) of
4:result:='WSAEINTR';
9:result:='WSAEBADF';
13:result:='WSAEACCES';
14:result:='WSAEFAULT';
22:result:='WSAEINVAL';
24:result:='WSAEMFILE';
35:result:='WSAEWOULDBLOCK';
36:result:='WSAEINPROGRESS';
37:result:='WSAEALREADY';
38:result:='WSAENOTSOCK';
39:result:='WSAEDESTADDRREQ';
40:result:='WSAEMSGSIZE';
41:result:='WSAEPROTOTYPE';
42:result:='WSAENOPROTOOPT';
43:result:='WSAEPROTONOSUPPORT';
44:result:='WSAESOCKTNOSUPPORT';
45:result:='WSAEOPNOTSUPP';
46:result:='WSAEPFNOSUPPORT';
47:result:='WSAEAFNOSUPPORT';
48:result:='WSAEADDRINUSE';
49:result:='WSAEADDRNOTAVAIL';
50:result:='WSAENETDOWN';
51:result:='WSAENETUNREACH';
52:result:='WSAENETRESET';
53:result:='WSAECONNABORTED';
54:result:='WSAECONNRESET';
55:result:='WSAENOBUFS';
56:result:='WSAEISCONN';
57:result:='WSAENOTCONN';
58:result:='WSAESHUTDOWN';
59:result:='WSAETOOMANYREFS';
60:result:='WSAETIMEDOUT';
61:result:='WSAECONNREFUSED';
62:result:='WSAELOOP';
63:result:='WSAENAMETOOLONG';
64:result:='WSAEHOSTDOWN';
65:result:='WSAEHOSTUNREACH';
66:result:='WSAENOTEMPTY';
67:result:='WSAEPROCLIM';
68:result:='WSAEUSERS';
69:result:='WSAEDQUOT';
70:result:='WSAESTALE';
71:result:='WSAEREMOTE';
91:result:='WSASYSNOTREADY';
92:result:='WSAVERNOTSUPPORTED';
93:result:='WSANOTINITIALISED';
101:result:='WSAEDISCON';
102:result:='WSAENOMORE';
103:result:='WSAECANCELLED';
104:result:='WSAEINVALIDPROCTABLE';
105:result:='WSAEINVALIDPROVIDER';
106:result:='WSAEPROVIDERFAILEDINIT';
107:result:='WSASYSCALLFAILURE';
108:result:='WSASERVICE_NOT_FOUND';
109:result:='WSATYPE_NOT_FOUND';
110:result:='WSA_E_NO_MORE';
111:result:='WSA_E_CANCELLED';
112:result:='WSAEREFUSED';
else result:='UNKNOWN';
end;
result:=result+'('+inttostr(dwError)+')';
end;
procedure CloseUserConnections(userID:integer);
var
i:integer;
begin
for i:=1 to high(connections) do
if (connections[i].socket<>0) and (connections[i].cometUserID=userID) then
connections[i].status:=csClosing;
end;
procedure StartNetwork;
var
i:integer;
begin
ForceLogMessage('Init GeoIP');
InitGeoIP;
ForceLogMessage('Starting network thread');
for i:=1 to High(connections) do connections[i].selfID:=i;
event:=CreateEvent(nil,false,false,nil);
netThread:=TNetworkThread.Create(false);
end;
procedure DoneNetwork;
begin
netThread.Terminate;
CloseHandle(event);
end;
function FormatError(status,query:UTF8String):UTF8String;
var
html,q:UTF8String;
begin
q:=query;
inc(serverStat.httpErrors);
LogMsg('ERR: '+status+'; Query: '+q,logWarn,lgHTTP);
html:='<h2>'+status+'</h2>';
result:='HTTP/1.1 '+status+#13#10+
'Access-Control-Allow-Origin: *'#13#10+
'Connection: Close'#13#10+
'Content-type: text/html'#13#10+
'Content-Length: '+IntToStr(length(html))+#13#10#13#10+html;
end;
function TConnection.FormatError(status:UTF8String):UTF8String;
var
q:UTF8String;
begin
q:=rURI;
if query<>'' then q:=q+'?'+copy(query,1,100);
result:=net.FormatError(status,q);
end;
function FormatResponse(body:UTF8String;dontCompress:boolean=false;mime:UTF8String='';cacheControl:UTF8String=''):UTF8String;
var
st:UTF8String;
compress:boolean;
begin
if mime='' then mime:='text/plain';
compress:=(length(body)>2048) and (pos('text/',mime)>0);
if (mime='dontcompress') or (dontCompress) then begin
compress:=false;
mime:='text/plain';
end;
st:='';
compress:=false;
if compress then begin
st:=st+'Content-Encoding: deflate'#13#10;
ZSendToBrowser(RawByteString(body));
end;
if SEND_ACAO then st:=st+'Access-Control-Allow-Origin: *'#13#10;
if cacheControl='' then st:=st+'Cache-Control: no-cache'#13#10
else st:=st+'Cache-Control: '+cacheControl+#13#10;
{ if length(body)=0 then
result:='HTTP/1.1 204 NO CONTENT'#13#10+st+'Connection: Keep-Alive'#13#10#13#10
else}
if length(body)=0 then body:='empty';
result:='HTTP/1.1 200 OK'#13#10+
'Content-Type: '+mime+'; charset=utf-8'#13#10+
st+
'Connection: Keep-Alive'#13#10+
'Content-Length: '+inttostr(length(body))+#13#10#13#10+
body;
end;
procedure DeleteConnection(i:integer);
begin
try
with connections[i] do begin
if LOG_HTTP and (minLogMemLevel=0) then
LogMsg('Conn closed: #'+inttostr(i)+' '+
ipToStr(remIP)+':'+inttostr(remPort)+' rsn:'+inttostr(closeReason),logDebug,lgHTTP);
if socket<>0 then
CloseSocket(socket)
else
LogMsg('Socket=0 for closing connection '+inttostr(i),logWarn);
SetLength(inBuf,0);
SetLength(outBuf,0);
socket:=0;
cometUserID:=0;
status:=csNone;
end;
except
on e:exception do begin
ForceLogMessage('Error in DeleteConnection '+inttostr(i)+': '+ExceptionMsg(e));
sleep(20);
end;
end;
end;
// Проверяет на допустимость запрос файла.
// Запрос должен быть безопасным, а файл - существовать.
// Возвращает путь к файлу либо пустую строку
function ValidFileRequest(req:UTF8String):UTF8String;
var
i,c:integer;
begin
result:='';
if length(req)>60 then exit;
c:=0;
for i:=1 to length(req) do begin
if not (req[i] in ['A'..'Z','a'..'z','0'..'9','/','.','_','-']) then exit;
if req[i]='.' then inc(c);
if (req[i]='/') and (c>0) then exit; // точки допустимы только в имени файла
end;
if c>1 then exit; // более 1 точки нельзя
req:=StringReplace(req,'/','\',[rfReplaceAll]);
if not FileExists(HomeDir+req) then exit;
result:=HomeDir+req;
end;
// Формирует HTTP-ответ с телом указанного файла
// Файл должен существовать
function GetStaticFile(fname:UTF8String):UTF8String;
var
f:file;
st,mimetype,cache:UTF8String;
i:integer;
begin
result:='';
try
fname:=UpperCase(fname);
// Determine MIME type
mimetype:='';
for i:=0 to length(mimeTypes)-1 do
if pos(mimetypes[i].extension,fname)=length(fname)-length(mimetypes[i].extension)+1 then begin
mimetype:=mimetypes[i].mimeType;
break;
end;
if mimetype='' then begin
LogMsg('ERR: no MIME type for '+fname,logWarn,lgHTTP);
exit;
end;
// Cache options
cache:='';
for i:=0 to length(cacheRules)-1 do
if pos(cacheRules[i].pattern,fname)>0 then begin
cache:=cacheRules[i].value; break;
end;
assign(f,fname);
filemode:=fmOpenRead;
reset(f,1);
if filesize(f)<=MAX_LOCAL_FILESIZE then begin
setLength(st,filesize(f));
blockRead(f,st[1],filesize(f));
end else
st:=''; // too large
close(f);
result:=FormatResponse(st,false,mimetype,cache);
except
on e:exception do LogMsg('ERR: GetStaticFile('+fname+'): '+ExceptionMsg(e),logWarn,lgHTTP);
end;
filemode:=fmOpenReadWrite;
end;
function TConnection.GetCRID: cardinal;
begin
result:=SelfID+requestRnd shl 16;
end;
function TConnection.GetInfo: TConInfo;
begin
result.ID:=selfID;
result.cometUserID:=cometUserID;
result.remIP:=remIP;
result.remPort:=remPort;
result.country:=country;
result.status:=status;
result.keepAlive:=keepAlive;
result.opened:=opened;
result.lastRequestTime:=lastRequestTime;
result.clientType:=0;
result.timeout:=round((MyTickCount-timeOut)/1000);
if pos('ENGINE3_CLIENT',userAgent)>0 then result.clientType:=1;
end;
procedure TConnection.HandleNewAcc;
var
A:UTF8String;
begin
A:=param('A');
AddTask(0,GetCRID,['NEWACC',A]);
end;
procedure TConnection.HandleLogin;
var
rnd,userID:integer;
A,B,C,D:UTF8String;
begin
rnd:=StrToIntDef(query,0);
if rnd<>0 then begin
// Подключение без авторизации
userID:=CreateUser(true);
outBuf:=FormatResponse(IntToStr(userID),false,'text/plain');
exit;
end else
if length(parNames)=4 then begin
A:=param('A');
UserID:=StrToIntDef(A,0);
if IsValidUserID(userID) then begin
if LoginAllowed then begin
// попытка авторизации
B:=param('B'); C:=param('C'); D:=param('D');
AddTask(userID,GetCRID,['LOGIN',B,C,D]);
end else
outBuf:=FormatResponse('ERROR: Server does not allow login at this moment, please try again later',false);
end else
outBuf:=FormatError(ERR500+'(invalid UID)');
end else
if outbuf='' then outBuf:=FormatError(ERR500);
end;
procedure TConnection.HandleLogout;
var
userID:integer;
sign,extra:UTF8String;
i:integer;
begin
userID:=StrToIntDef(param('A'),0);
sign:=UpperCase(param('B'));
extra:=param('C');
if extra<>'' then extra:=DecodeHex(extra);
if IsValidUserID(userID,true) then begin
if sign<>ShortMD5(inttostr(userID)+users[userid].PwdHash) then begin
LogMsg('Bad signature ('+sign+') for: '+users[userid].name,logWarn);
outBuf:=FormatError(ERR403+' (#4 wrong signature)');
exit;
end;
LogMsg('Logout: '+users[userid].name,logNormal);
DeleteUser(userID,'Logout',extra);
for i:=1 to high(connections) do
if connections[i].cometUserID=userID then begin
connections[i].status:=csClosing;
connections[i].cometUserID:=0;
connections[i].closeReason:=6;
connections[i].keepAlive:=false;
connections[i].outBuf:='CLOSE';
end;
end;
outBuf:=FormatResponse('',false);
end;
procedure TConnection.HandleCheckValue;
var
st:UTF8String;
begin
st:=param('email');
if st<>'' then begin
AddTask(0,GetCRID,['CHECKEMAIL',st]);
exit;
end;
st:=param('name');
if st<>'' then begin
AddTask(0,GetCRID,['CHECKNAME',st]);
exit;
end;
outbuf:='';
end;
procedure TConnection.HandleUserMsgs(userID,serial:integer;sign:UTF8String);
var
i,n,l:integer;
whole,sign2:UTF8String;
sa:AStringArr;
begin
if not acceptIncomingMessages then begin
outBuf:=FormatError(ERR503+' (the server is going to be restarted, please retry in a few seconds)');
exit;
end;
with users[userID] do begin
if sign<>ShortMD5(IntToStr(UserID)+IntToStr(serial)+users[userID].PwdHash) then begin
outBuf:=FormatError(ERR500+' (#1.1)');
end else
if serial<lastPostSerial then begin
outBuf:=FormatError(ERR500+' (#1.2)');
LogMsg('Out of order POST request ignored '+IntToStr(serial),logInfo,lgHTTP);
end
else
if serial=lastPostSerial then begin // Нужно пересмотреть этот код, т.к. смысл POST и GET не соответствует POLL и PUSH
outBuf:=FormatResponse('IGNORED');
LogMsg('Duplicated request '+IntToStr(serial),logInfo,lgHTTP);
end else
if serial>lastPostSerial then begin
// Extract incoming messages
if pos('text/plain',contentType)>0 then begin
// text mode
sa:=splitA(#13#10,body);
for i:=1 to high(sa) do begin
sa[i]:=Unescape(sa[i]);
{ sa[i]:=StringReplace(sa[i],'\n',#13#10,[rfReplaceAll]);
sa[i]:=StringReplace(sa[i],'\\','\',[rfReplaceAll]);}
end;
end;
if pos('application/octet-stream',contentType)>0 then begin
// binary mode
SetLength(sa,15); // Up to 15 messages per request
for i:=0 to high(sa) do sa[i]:='';
n:=0;
i:=1; // текущая позиция в body
while i<length(body) do begin
if n>high(sa) then break;
l:=byte(body[i]); inc(i);
if l=255 then begin
l:=byte(body[i])+byte(body[i+1])*256+byte(body[i+2])*65536;
inc(i,3);
end;
SetLength(sa[n],l);
if i+l-1<=length(body) then begin
move(body[i],sa[n][1],l);
inc(n);
end;
inc(i,l);
end;
SetLength(sa,n);
end;
// Check signature
whole:='';
for i:=1 to high(sa) do
whole:=whole+sa[i];
sign2:=ShortMD5(whole+PwdHash);
if sign2<>sa[0] then begin
LogMsg('Invalid request sign from '+name+' ('+sign2+'): '+whole,logWarn);
outbuf:=FormatError(ERR500+' (#1.4)');
exit;
end;
// Response
lastPostSerial:=serial;
outbuf:=FormatResponse('OK');
users[userID].timeOut:=MyTickCount+USER_TIMEOUT;
// Execute
for i:=1 to high(sa) do
ExecUserRequest(userID,sa[i]);
end;
end;
end;
procedure TConnection.HandleCometRequest(UserID:integer;serial:cardinal;sign:UTF8String);
var
i,err:integer;
checkSign:UTF8String;
begin
with users[userID] do begin
checkSign:=ShortMD5(IntToStr(UserID)+IntToStr(serial)+users[userID].PwdHash);
if sign<>checkSign then begin
LogMsg('Bad sign from '+users[userid].name+' should be: '+checkSign,logWarn);
outBuf:=FormatError(ERR403+' (#2 wrong signature)');
end else
if serial=lastPollSerial then begin
LogMsg('Duplicated poll request '+IntToStr(serial),logInfo,lgHTTP);
if lastPollResponse=UNSENT_RESPONSE then begin
// ответ еще не был отправлен - поискать другое соединение для юзера
for i:=1 to high(connections) do
if connections[i].status<>csNone then
if (connections[i].cometUserID=userID) and (connections[i].status<>csClosing) then begin
LogMsg('Closing another poll connection #%d from user %s (%d)',[i,name,userID],logInfo,lgHTTP);
connections[i].status:=csClosing;
connections[i].closeReason:=7;
self.timeout:=connections[i].timeOut;
end;
cometUserID:=userID;
end else
outBuf:=FormatResponse(lastPollResponse,dontCompress); // already processed
end
else
if serial<lastPollSerial then begin
outBuf:=FormatResponse('WTF!? '+inttostr(lastPolLSerial)); // already processed
LogMsg('Invalid serial %d < %d',[serial,lastPollSerial],logNormal,lgHTTP);
end
else
if serial>lastPollSerial then begin
// отправим исходящие сообщения (если есть) и запомним ответ, либо поставим в ожидание
users[userid].timeout:=MyTickCount+USER_TIMEOUT;
lastPollSerial:=serial;
lastPollResponse:=GetUserMsgs(userID);
if lastPollResponse<>'' then
outBuf:=FormatResponse(lastPollResponse,dontCompress)
else begin
lastPollResponse:=UNSENT_RESPONSE;
cometUserID:=userID;
err:=1+GetIPErrors(remIP);
if err>4 then err:=4;
self.timeOut:=MyTickCount+DATA_TIMEOUT div err; // в это время будет отправлен пустой ответ, если только сообщения не поступят раньше
end;
end;
end;
end;
function TConnection.Param(name: UTF8String): UTF8String;
var
i:integer;
begin
result:='';
name:=lowercase(name);
for i:=0 to length(parNames)-1 do
if lowercase(parNames[i])=name then result:=parValues[i];
end;
procedure TConnection.ExtractParameters;
var
i,c,p:integer;
pairs:AStringArr;
ct,boundary,partHdr,partData,st:UTF8String;
parts:AStringArr;
begin
SetLength(parNames,0);
SetLength(parValues,0);
if not headersParsed then exit;
// POST?
if not rTypeGet then begin
ct:=LowerCase(contentType);
if pos('application/x-www-form-urlencoded',ct)>0 then
query:=body
else if pos('multipart/form-data;',ct)>0 then begin
// Parse multipart body
p:=pos('boundary=',ct);
boundary:=copy(contentType,p+9,200);
parts:=SplitA(boundary,body);
SetLength(parNames,100);
SetLength(parvalues,100);
c:=0;
for i:=0 to length(parts)-1 do begin
if c>=100 then break;
p:=pos(#13#10#13#10,parts[i]);
if p=0 then continue;
partHdr:=copy(parts[i],1,p-1);
partData:=copy(parts[i],p+4,length(parts[i])-p-4-3);
st:=lowercase(partHdr);
p:=pos('name="',st);
if p=0 then continue;
st:=copy(partHdr,p+6,250); // max parameter name
p:=pos('"',st);
if p=0 then continue;
SetLength(st,p-1);
parNames[c]:=st; // What if " occurs in par name? Maybe URLDecode is needed here...
parValues[c]:=partData;
inc(c);
end;
SetLength(parNames,c);
SetLength(parvalues,c);
exit;
end;
end; // POST
if query<>'' then begin
// Extract parameters from query UTF8String (GET)
pairs:=splitA('&',query);
c:=length(pairs);
SetLength(parNames,c);
SetLength(parvalues,c);
for i:=0 to c-1 do begin
p:=pos('=',pairs[i]);
if p>0 then begin
parNames[i]:=UrlDecode(copy(pairs[i],1,p-1));
parValues[i]:=UrlDecode(copy(pairs[i],p+1,length(pairs[i])));
end else begin
parNames[i]:=UrlDecode(pairs[i]);
parValues[i]:='TRUE';
end;
end;
end;
end;
// Во входящем буфере соединения полностью содержится запрос
// Нужно его обработать и сформировать ответ в исходящем буфере
procedure TConnection.HandleRequest;
var
i,level:integer;
req:AStringArr;
fname:UTF8String;
uID:integer;
serial:cardinal;
params:UTF8String;
begin
try
UseIP(selfID,2);
inc(serverStat.httpRequests);
if keepAlive then
timeOut:=MyTickCount+KEEP_ALIVE_TIMEOUT;
// Разделение запроса на части
i:=pos('?',rURI);
if i>0 then begin
query:=copy(rURI,i+1,length(rURI));
SetLength(rURI,i-1);
end else
query:='';
if bodySize>0 then body:=copy(inBuf,bodyPos,bodySize);
ExtractParameters;
rURI:=UpperCase(rURI);
// Логирование запросов
if LOG_HTTP then begin
params:='';
for i:=0 to length(parNames)-1 do
params:=params+parNames[i]+'='+parValues[i]+';';
if length(params)>100 then SetLength(params,100);
level:=logInfo;
if rTypeGet then begin
if pos('-',rURI) in [2..5] then level:=logDebug;
LogMsg('Con#'+inttoStr(selfID)+' GET '+rURI+' '+params,level,lgHTTP);
end else begin
if pos('text/plain',contentType)>0 then params:=copy(body,1,100);
if pos('application/octet-stream',contentType)>0 then params:='[Binary data '+inttostr(bodySize)+'b]';
if pos('-',rURI) in [2..5] then level:=logDebug;
LogMsg('Con#'+inttoStr(selfID)+' POST '+rURI+' '+params,level,lgHTTP);
end;
end;
// Сперва стандартные запросы
if rTypeGet then begin
// GET
if rURI='CMD' then begin
AddTask(0,GetCRID,['CMD',param('action'),param('sign'),param('player'),param('p1'),param('p2'),param('p3')]);
exit;
end;
if rURI='LOGIN' then begin
HandleLogin;
exit;
end;
if rURI='LOGOUT' then begin
HandleLogout;
exit;
end;
if rURI='CHECKVALUE' then begin // проверка допустимости значений аккаунта
HandleCheckValue;
exit;
end;
if rURI='GETVERSION' then begin // текущая версия игры
outBuf:=FormatResponse(GetAllowedVersions,false,'text/plain');
exit;
end;
// Запросы, требующие авторизации
if (rURI='ADMIN') or (rURI='LOG') then begin
if (length(accessToken)>3) and (Cookie(selfID,'AHSERVER_TOKEN')=AccessToken) then begin
if rURI='ADMIN' then begin
outBuf:=RequestAdmin(GetCRID);
exit;
end;
if rURI='LOG' then begin
outBuf:=RequestLog(GetCRID);
exit;
end;
end else begin
UseIP(selfID,30);
outBuf:=FormatResponse(StringReplace(loginPage,'#SERVER_NAME#',SERVER_NAME,[rfReplaceAll]),false,'text/html');
exit;
end;
end;
end else begin
// POST
if rURI='NEWACC' then begin
HandleNewAcc;
exit;
end;
if (length(accessToken)>3) and
((Cookie(selfID,'AHSERVER_TOKEN')=AccessToken) or (param('AHSERVER_TOKEN')=AccessToken)) then begin
// Требуется авторизация через cookie
if rURI='ADMINCMD' then begin
outBuf:=RequestAdminCmd(GetCRID);
exit;
end;
if rURI='CONTROL' then begin
outBuf:=FormatResponse(LoadFileAsString('HTML\control.htm'),false,'text/html');
exit;
end;
end;
end;
// Отправка/получение сообщений залогинившегося юзера?
i:=pos('-',rURI);
if i>0 then begin
req:=splitA('-',rURI);
uID:=StrToIntDef(req[0],0);
serial:=StrToIntDef(req[1],0);
if IsValidUserID(uID,true) and (length(req)=3) then begin
if bodySize>0 then
HandleUserMsgs(uID,serial,req[2]) // приём входящих сообщений юзера
else
HandleCometRequest(uID,serial,req[2]); // запрос исходящих сообщений
exit;
end;
end;
// если ни один вариант не подошел - попробуем запрос статического файла
if HomeDir<>'' then begin
fname:=ValidFileRequest(rURI);
if fname<>'' then outBuf:=GetStaticFile(fname)
else outBuf:=FormatError('404 Not Found');
if outBuf='' then outBuf:=FormatError('500 Internal Server Error');
exit;
end;
// если ничего не подошло - 404
outBuf:=FormatError('404 Not Found');
LogMsg('WARN! Request not handled',logNormal,lgHTTP);
except
on e:exception do begin
outBuf:=FormatError(ERR500+'(HandleRequest)');
LogMsg('Error: HandleRequest '+rURI+':'+ExceptionMsg(e),logError,lgHTTP);
end;
end;
end;
procedure StartRecv(idx:integer); forward;
procedure onSent(const dwError,cbTransferred:DWORD;
const lpOverlapped:LPWSAOVERLAPPED; const dwFlags:DWORD); stdcall;
var
idx:integer;
begin
idx:=-1;
if dwError<>0 then LogMsg('onSent error: '+WSAError(dwError),logNormal,lgHTTP);
EnterCriticalSection(gSect);
try
try
idx:=lpOverlapped.hEvent;
if (idx<1) or (idx>MAX_CONNECTIONS) then begin
LogMsg('ERROR2: invalid idx=#'+inttostr(idx),logNormal,lgHTTP);
exit;
end;
inc(serverStat.sentBytes,cbTransferred);
if connections[idx].status in [csNone,csClosing] then exit;
with connections[idx] do
if keepAlive and (banList[IPhash(connections[idx].remIP)]<=80) then begin
connections[idx].PrepareForNextRequest;
StartRecv(idx); // прием очередного запроса
end else begin
if banList[IPhash(connections[idx].remIP)]>80 then inc(serverStat.ipBanned);
if LOG_HTTP then begin
if keepAlive then
LogMsg('Closing connection '+inttostr(idx)+' rsn 8'+
inttostr(banList[IPhash(connections[idx].remIP)]),logInfo,lgHTTP)
else
if (minLogMemLevel=0) then
LogMsg('Closing connection '+inttostr(idx)+' rsn 1',logDebug,lgHTTP);
end;
status:=csClosing;
closeReason:=1; // not keep-alive
end;
except
on e:exception do LogMsg('onSent error (idx=#'+inttostr(idx)+'): '+ExceptionMsg(e),logWarn,lgHTTP);
end;
finally
LeaveCriticalSection(gSect);
end;
end;
procedure TConnection.SendResponse(context:integer=0);
var
buf:WSAbuf;
size:cardinal;
res:integer;
begin
inPos:=1; // сперва очистим входящий буфер
if length(outBuf)=0 then begin
LogMsg('Trying to send 0 bytes',logWarn,lgHTTP);
exit;
end;
headersParsed:=false;
buf.len:=length(outBuf);
buf.buf:=@outBuf[1];
overlapped.hEvent:=selfID;
status:=csWriting;
res:=WSASend(socket,@buf,1,size,0,@overlapped,onSent);
if res<>0 then begin
res:=WSAGetLastError;
if res<>WSA_IO_PENDING then begin
LogMsg('WSAsend code='+WSAError(res)+' on con#'+inttostr(selfID),logNormal,lgHTTP);
status:=csClosing;
exit;
end;
end;
if LOG_HTTP and (minLogMemLevel=0) then begin
LogMsg('SR'+inttostr(context)+' Sent to con#'+inttostr(selfID)+
': '+inttostr(size)+' bytes: '+DumpData(PByte(buf.buf),size),logDebug,lgHTTP);
end;
end;
// Парсит заголовки запроса
// - если это корректный запрос POST - определяет размер тела для чтения
// - если корректный запрос GET - устанавливает размер тела в 0
// - если запрос некорректный - формирует ошибку, устанавливает keepAlive=false, возвращает false
function TConnection.ParseHeaders(size:integer):boolean;
var
i,p:integer;
req:AStringArr;
par,value:UTF8String;
headers:UTF8String;
begin
result:=false;
headers:=copy(inBuf,1,size);
i:=pos(#13#10,headers);
req:=splitA(' ',copy(inBuf,1,i-1));
keepAlive:=false;
bodySize:=0;
// запрос должен содержать 3 поля
if (length(req)<>3) then begin
outBuf:=FormatError(ERR400);
result:=true; exit;
end;
// первое поле должно быть GET либо POST
req[0]:=UpperCase(req[0]);
if (req[0]<>'GET') and (req[0]<>'POST') then begin
outBuf:=FormatError('405 Method Not Allowed'#13#10'Allow: GET,POST');
result:=true; exit;
end;
rTypeGet:=req[0]='GET';
// проверка версии HTTP пока опущена...
// запрос должен начинаться с / и содержать хотя бы 1 символ после слэша
rURI:=req[1];
if (length(rURI)<2) or (rURI[1]<>'/') then begin
outBuf:=FormatError(ERR404);
result:=true; exit;
end;
delete(rURI,1,1); // Remove '/'
bodyPos:=size+5;
// if not rTypeGet then begin // POST?
req:=splitA(#13#10,headers);
for i:=1 to length(req)-1 do begin
p:=pos(':',req[i]);
if p=0 then continue;
par:=UpperCase(copy(req[i],1,p));
value:=copy(req[i],p+1,length(req[i]));
// размер тела запроса
if par='CONTENT-LENGTH:' then begin
bodySize:=StrToIntDef(value,0);
if bodyPos+bodySize>=Length(inBuf) then begin
outBuf:=FormatError('413 Request Entity Too Large');
result:=true; exit;
end;
end;
// тип содержимого тела
if par='CONTENT-TYPE:' then contentType:=lowercase(value);
if par='USER-AGENT:' then userAgent:=value;
if par='COOKIE:' then cookies:=value;
if par='X-DONT-COMPRESS:' then dontCompress:=true;
end;
// end;
headersParsed:=true;
keepAlive:=true;
result:=true;
end;
procedure TConnection.PrepareForNextRequest;
begin
status:=csReading;
outBuf:='';
body:='';
cookies:='';
dontCompress:=false;
userAgent:='';
query:='';
cometUserID:=0;
requestRnd:=1+random(255);
if keepAlive then
timeOut:=MyTickCount+KEEP_ALIVE_TIMEOUT
else
timeOut:=MyTickCount+REQUEST_TIMEOUT;
inPos:=1;
headersParsed:=false;
SetLength(parNames,0);
SetLength(parValues,0);
end;
// Проверяет наличие полностью принятого запроса во входящем буфере
// Возможные варианты:
// - запрос еще не получен, необходим дальнейший прием данных - выставляем csReading
// - получено нечто, что не может быть корректным запросом - дальнейший прием не имеет смысла - csClosing
// - запрос получен полностью и может быть обработан
function TConnection.RequestReceived(bytesReceived:integer):boolean;
var
i,crlf:integer;
begin
result:=false;
status:=csReading;
if inPos<12 then exit; // слишком мало данных принято
if not headersParsed then begin
// поиск \n\n
i:=inPos-bytesReceived-4;
if i<1 then i:=1;
crlf:=0;
while i<=inPos-4 do begin
if inBuf[i]=#13 then
if inBuf[i+1]=#10 then
if inBuf[i+2]=#13 then
if inBuf[i+3]=#10 then begin
crlf:=i; break;
end;
inc(i);
end;
if (crlf=0) or (crlf>3000) then begin
if (inPos>3000) or (crlf>3000) then status:=csClosing; // получена какая-то хрень!
exit;
end;
// Парсинг заголовков
if ParseHeaders(crlf-1) then begin
if rTypeGet then result:=true;
if inPos>=bodySize+bodyPos then result:=true;
end;
end else begin
// Заголовки уже обработаны - нужно лишь дождаться загрузки всего запроса
if inPos>=bodySize+bodyPos then result:=true;
end;
if result then inc(requestRnd);
end;
procedure onReceive(const dwError,cbTransferred:DWORD;
const lpOverlapped:LPWSAOVERLAPPED; const dwFlags:DWORD); stdcall;
var
idx:integer;
begin
//LogMsg('onRecv: '+inttostr(dwError)+' '+inttostr(cbTransferred));
idx:=-1;
EnterCriticalSection(gSect);
try
try
idx:=lpOverlapped.hEvent;
if (idx<1) or (idx>MAX_CONNECTIONS) then begin
LogMsg('ERROR: invalid idx=#'+inttostr(idx),logNormal,lgHTTP);
exit;
end;
// LogMsg(inttostr(idx)+' Received: '+inttostr(cbTransferred)+#13#10+connections[idx].inBuf);
with connections[idx] do begin
if status=csNone then exit; // соединение уже удалено
if status=csClosing then exit; // соединение уже закрывается - нечего тут делать
if dwerror<>0 then LogMsg('onRecv error '+WSAError(dwError)+' in con #'+inttostr(idx),logNormal,lgHTTP);
if (dwError=WSAENOTCONN) or
(dwError=WSAEDISCON) or
(dwError=WSAECONNABORTED) or
(dwError=WSAECONNRESET) or
((dwError=0) and (cbTransferred=0)) then begin // gracefull closed connection?
if LOG_HTTP and (minLogMemLevel=0) then
LogMsg('Closing connection '+inttostr(idx)+' rsn 2 '+WSAError(dwError),logDebug,lgHTTP);
status:=csClosing;
closeReason:=2; // receive error
if dwError=WSAECONNRESET then MarkIPAsBad(remIP);
exit;
end;
inc(inPos,cbTransferred);
inc(serverStat.recvBytes,cbTransferred);
// проверим, поступил ли запрос полностью
if RequestReceived(cbTransferred) then begin
lastRequestTime:=now;
status:=csWaiting;
if outBuf='' then HandleRequest;
// если сформирован ответ - отправить его
if outBuf<>'' then SendResponse(1);
end else begin
if status=csReading then StartRecv(idx); // слишком мало данных, продолжаем прием
// if outBuf<>'' then SendResponse; - что это за хрень!??
end;
end;
except
on e:exception do LogMsg('onReceive error (con#'+inttostr(idx)+'): '+ExceptionMsg(e),logWarn,lgHTTP);
end;
finally
LeaveCriticalSection(gSect);
end;
end;
// Инициируем прием/чтение данных из сокета соединения
procedure StartRecv(idx:integer);
var
buf:WSAbuf;
size:cardinal;
res:integer;
flags:cardinal;
begin
with connections[idx] do begin
if status in [csClosing,csNone] then begin
LogMsg('Can''t read from closed con#'+inttostr(idx),logInfo);
exit;
end;
buf.len:=length(inBuf)-inPos+1; // столько байтов еще можно прочитать в буфер
buf.buf:=@inBuf[inPos]; // тут range check error!
fillchar(overlapped,sizeof(overlapped),0);
overlapped.hEvent:=idx;
flags:=0;
res:=WSArecv(socket,@buf,1,size,flags,@overlapped,@onReceive);
if (res=0) and (size=0) then begin
status:=csClosing;
closeReason:=5; // graceful termination initiated by remote side
LogMsg('Closing connection '+inttostr(idx)+' rsn=5',logInfo,lgHTTP);
exit;
end;
if res=SOCKET_ERROR then begin
res:=WSAGetLastError;
if (res=WSAENOTCONN) or
(res=WSAEDISCON) or
(res=WSAECONNABORTED) or
(res=WSAECONNRESET) then begin
LogMsg('Closing connection '+inttostr(idx)+' rsn=3',logInfo,lgHTTP);
status:=csClosing;
closeReason:=3; // error
end;
end;
end;
end;
{ procedure PostNotification(idx:integer;urgency:byte);
begin
if nCount>=MAX_CONNECTIONS_LIMIT then
raise EError.Create('Notification buffer overflow!');
inc(nCount);
notifications[nCount]:=idx;
inc(totalUrgency,urgency);
if totalUrgency>MAX_URGENCY then
SetEvent(event);
end;}
procedure SendMsg(con:integer;msg:UTF8String;urgency:byte=0);
var
rnd:byte;
begin
ASSERT(msg<>'','Empty msg in SendMsg');
EnterCriticalSection(gSect);
try
rnd:=(con shr 16) and $FF;
con:=con and $FFFF;
if (con<1) or (con>High(connections)) then
raise EError.Create('SendMsg: wrong idx');
with connections[con] do begin
if status<>csWaiting then begin
LogMsg('SendMsg: status<>waiting',logWarn);
exit;
end;
if (rnd>0) and (rnd<>requestRnd) then begin
LogMsg('SendMsg: wrong request rnd',logWarn);
exit;
end;
if outBuf<>'' then outBuf:=outBuf+#13#10+msg
else outBuf:=msg;
// PostNotification(con,urgency);
end;
finally
LeaveCriticalSection(gSect);
end;
end;
// Callback
function AllowConnection(lpCallerId,lpCallerData:LPWSABUF;
lpSQOS,lpGQOS:LPQOS;
lpCalleeId,lpCalleeData:LPWSABUF;
g:GROUP; dwCallbackData:DWORD):integer; stdcall;
var
addr:sockaddr_in;
ip:cardinal;
begin
result:=CF_ACCEPT;
if (lpCallerID<>nil) and (lpCallerID.len=16) then begin
move(lpCallerID.buf^,addr,sizeof(addr));
ip:=addr.sin_addr.S_addr;
if banlist[IPhash(ip)]>40 then begin
result:=CF_REJECT; // 5 секунд после принудительного разрыва новое соединение установить нельзя
inc(serverStat.connDenied);
LogMsg('Connection not allowed from '+IpToStr(ip),logInfo,lgHTTP);
exit;
end;
end;
end;
{ TNetworkThread }
procedure TNetworkThread.Execute;
var
WSAdata:TWSAData;
i,j,res,addrLen:integer;
addr:sockaddr_in;
newSock:TSocket;
arg:cardinal;
time:TSystemTime;
t:int64;
begin
RegisterThread('Net');
ForceLogMessage('Hello from NET thread');
// Initialization
// conCount:=0;
// for i:=1 to high(freeCon) do freeCon[i]:=i;
res:=WSAStartup($0202, WSAData);
if res<>0 then raise EFatalError.Create('WSA Init failure: '+inttostr(res));
try
// create main socket
Sock:=socket(PF_INET,SOCK_STREAM,IPPROTO_IP);
if Sock=INVALID_SOCKET then
raise EFatalError.Create('Socket creation failure: '+inttostr(WSAGetLastError));
// bind
addr.sin_family:=PF_INET;
addr.sin_port:=htons(HTTP_PORT);
addr.sin_addr.S_addr:=htonl(local_IP);
ForceLogMessage(Format('Binding to %s:%d',[IpToStr(local_IP),HTTP_PORT]));
res:=bind(sock,@addr,sizeof(addr));
if res<>0 then raise EFatalError.Create('Bind failed: '+inttostr(WSAGetLastError));
arg:=1;
if ioctlsocket(sock,FIONBIO,arg)<>0 then
raise EFatalError.Create('Cannot make non-blocking socket');
res:=listen(sock,SOMAXCONN);
if res<>0 then raise EError.Create('Listen returned error '+inttostr(WSAGetLastError));
except
on e:exception do begin
ForceLogMessage('Error in NetThread init: '+ExceptionMsg(e));
exit;
end;
end;
ForceLogMessage('Starting NET loop...');
// Main loop
repeat
try
EnterCriticalSection(gSect);
try
inc(loopCounter);
try
// Send out data
j:=0;
for i:=1 to MAX_CONNECTIONS do
with connections[i] do
if (status=csWaiting) then begin
if (cometUserID>0) and (IsValidUserID(cometUserID,true)) and (outBuf='') then begin
if users[cometUserID].sendASAP then
outbuf:=GetUserMsgs(cometUserID);
end;
if outBuf<>'' then begin
users[cometUserID].lastPollResponse:=outBuf;
outBuf:=FormatResponse(outBuf,dontCompress);
inc(j,200+length(outBuf));
SendResponse(3);
if j>10000 then break; // слишком много сразу отправлять не будем
end;
end;
except
on e:exception do begin
ForceLogMessage('NET Error 1: '+ExceptionMsg(e));
sleep(100);
end;
end;
try
// Check for incoming connections
if {conCount<MAX_CONNECTIONS}true then begin
addrLen:=sizeof(addr);
newSock:=WSAAccept(sock,@addr,@addrlen,AllowConnection,0);
// newSock:=accept(sock,@addr,@addrLen);
if newSock=INVALID_SOCKET then begin
res:=WSAGetLastError;
if (res<>WSAEWOULDBLOCK) and (res<>WSAECONNREFUSED) then
ForceLogmessage('ACCEPT failed with '+inttostr(res));
end else begin
// new connection established
// inc(conCount);
// i:=freeCon[conCount];
i:=0;
for j:=1 to MAX_CONNECTIONS do
if connections[j].status=csNone then begin
i:=j; break;
end;
if i>0 then
with connections[i] do begin
ASSERT((status=csNone) and (socket=0),'New connection isn''t free! '+inttostr(ord(status))+' '+inttostr(socket));
socket:=newSock;
remIP:=cardinal(addr.sin_addr.S_addr);
remPort:=addr.sin_port;
country:=GetCountryByIP(remIP);
opened:=Now; lastRequestTime:=0;
closeReason:=0;
setLength(inBuf,INBUF_SIZE);
PrepareForNextRequest;
keepAlive:=true; // устанавливается ПОСЛЕ PrepareForNext... для правильного выбора таймаута
StartRecv(i);
if LOG_HTTP and (minLogMemLevel=0) then
LogMsg('Conn accepted: #'+connectionstr(i),logDebug,lgHTTP);
inc(serverStat.httpConnections);
end
else
CloseSocket(newSock);
end;
end;
except
on e:exception do begin
ForceLogMessage('NET Error 2: '+ExceptionMsg(e));
sleep(100);
end;
end;
try
// Timer (10 times per second)
GetSystemTime(time);
if firstTimer then begin
lastDay:=time.wDay;
lastHour:=time.wHour;
firstTimer:=false;
end;
// Если что-то надо делать ежеминутно
i:=time.wMinute;
if i<>lastMinute then begin
lastMinute:=i;
if lastMinute mod 10=1 then AddTask(0,0,['DB_MAINTENANCE']); // Раз в 10 минут обслуживать базу данных
MarkIPAsBad(i); // вытеснение проблемных IP со временем
end;
// Если что-то надо делать раз в час
i:=time.wHour;
if i<>lastHour then begin
lastHour:=i;
AddTask(0,0,['HOURLY_MAINTENANCE']); // Раз в час
end;
i:=time.wDay;
if i<>lastDay then begin
lastDay:=i;
AddTask(0,0,['DAILY_MAINTENANCE']); // Раз в сутки
end;
except
on e:exception do begin
ForceLogMessage('NET Error 3: '+ExceptionMsg(e));
sleep(100);
end;
end;
i:=time.wMilliseconds div 100;
if i<>LastSecond then begin
lastSecond:=i;
// обработка таймаутов
try
t:=MyTickCount;
for i:=1 to MAX_CONNECTIONS do
with connections[i] do
if (socket<>0) and (not (status in [csClosing,csWriting])) then begin
if t>timeOut then begin
// если ждем запроса а его все нет - закрыть соединение
if status in [csReading,csWriting] then begin
if LOG_HTTP and (minLogMemLevel=0) then
LogMsg('Timeout for con#'+inttostr(i)+': '+inttostr(t-timeOut),logDebug,lgHTTP);
status:=csClosing;
closeReason:=4; // request read timeout
end;
// если запрос был, а ответа все нет - отправить пустой ответ
if status=csWaiting then begin
if LOG_HTTP and (minLogMemLevel=0) then
LogMsg('Con#'+inttostr(i)+' timeout',logDebug,lgHTTP);
if outBuf='' then begin
if (cometUserID>0) and (IsValidUserID(cometUserID)) then begin
outbuf:=GetUserMsgs(cometUserID);
users[cometUserID].lastPollResponse:=outbuf; // возможно пустой ответ - признак того, что он был отправлен
if outbuf<>'' then outBuf:=FormatResponse(outbuf,dontCompress);
end;
end else
LogMsg('WARN: outbuf(%d) not sent until timeout',[length(outbuf)],logNormal,lgHTTP);
if outbuf='' then outBuf:=FormatResponse('');
SendResponse(5);
end;
end;
end;
// ban list (1 раз в секунду)
if lastSecond=0 then
for i:=0 to high(banlist) do
if banlist[i]>10 then dec(banlist[i],10)
else banlist[i]:=0;
except
on e:exception do LogMsg('Error in NET timer: '+ExceptionMsg(e),logError);
end;
if timeToFlush<=0 then begin
FlushLogs;
timeToFlush:=LOG_FLUSH_INTERVAL;
end else dec(timeToFlush);
// Таймеры сервера и логики
onTimer;
onCustomTimer;
end;
// Delete connections
for i:=1 to MAX_CONNECTIONS do
if //(connections[i].socket<>0) and
(connections[i].status=csClosing) then DeleteConnection(i);
finally
LeaveCriticalSection(gSect);
end;
except
on e:exception do begin
ForceLogMessage('Error in net loop: '+ExceptionMsg(e));
sleep(1000);
end;
end;
// Non-alterable delay
WaitForSingleObject(event,NET_LOOP_INTERVAL);
SleepEx(1,true); // позволяет выполняться APC
netThreadTimestamp:=Now;
until terminated;
ForceLogMessage('NET loop stopped.');
// Finalization
try
except
on e:exception do ForceLogMessage('Error in NetThread done: '+ExceptionMsg(e));
end;
ForceLogMessage('NET thread done.');
end;
end.
| 31.175333 | 140 | 0.646013 |
472c47633572df022f5ae4535812a865e8938f9b | 15,384 | pas | Pascal | Components/JVCL/common/ModuleLoader.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | Components/JVCL/common/ModuleLoader.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | Components/JVCL/common/ModuleLoader.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| 1 | 2019-12-24T08:39:18.000Z | 2019-12-24T08:39:18.000Z | {******************************************************************}
{ }
{ Project JEDI }
{ OS independent Dynamic Loading Helpers }
{ }
{ The initial developer of the this code is }
{ Robert Marquardt <robert_marquardt att gmx dott de) }
{ }
{ Copyright (C) 2000, 2001 Robert Marquardt. }
{ }
{ Obtained through: }
{ Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project }
{ JEDI home page, located at http://delphi-jedi.org }
{ }
{ The contents of this file are used with permission, 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/NPL/NPL-1_1Final.html }
{ }
{ 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. }
{ }
{******************************************************************}
unit ModuleLoader;
{$I jvcl.inc}
{$WEAKPACKAGEUNIT ON}
interface
{$IFDEF MSWINDOWS}
uses
Windows;
type
// Handle to a loaded DLL
TModuleHandle = HINST;
{$ENDIF MSWINDOWS}
{$IFDEF UNIX}
uses
Types, Libc;
type
// Handle to a loaded .so
TModuleHandle = Pointer;
{$ENDIF UNIX}
const
// Value designating an unassigned TModuleHandle or a failed loading
INVALID_MODULEHANDLE_VALUE = TModuleHandle(0);
function LoadModule(var Module: TModuleHandle; FileName: string): Boolean;
function LoadModuleEx(var Module: TModuleHandle; FileName: string; Flags: Cardinal): Boolean;
procedure UnloadModule(var Module: TModuleHandle);
function GetModuleSymbol(Module: TModuleHandle; SymbolName: string): Pointer;
function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: string; var Accu: Boolean): Pointer;
function ReadModuleData(Module: TModuleHandle; SymbolName: string; var Buffer; Size: Cardinal): Boolean;
function WriteModuleData(Module: TModuleHandle; SymbolName: string; var Buffer; Size: Cardinal): Boolean;
// (p3)
// Simple DLL loading class. The idea is to use it to dynamically load
// a DLL at run-time using the GetProcedure method. Another (better) use is to derive a
// new class for each DLL you are interested in and explicitly call GetProcedure for
// each function in an overriden Load method. You would then add procedure/function
// aliases to the new class that maps down to the internally managed function pointers.
// This class is built from an idea I read about in Delphi Magazine a while ago but
// I forget who was the originator. If you know, let me know and I'll put it in the credits
// NB!!!
// * Prepared for Kylix but not tested
// * Is GetLastError implemented on Kylix? RaiseLastOSError implies it is...
type
TModuleLoadMethod = (ltDontResolveDllReferences, ltLoadAsDataFile, ltAlteredSearchPath);
TModuleLoadMethods = set of TModuleLoadMethod;
TModuleLoader = class(TObject)
private
FHandle: TModuleHandle;
FDLLName: string;
function GetLoaded: Boolean;
protected
procedure Load(LoadMethods: TModuleLoadMethods); virtual;
procedure Unload; virtual;
procedure Error(ErrorCode: Cardinal); virtual;
public
// Check whether a DLL (and optionally a function) is available on the system
// To only check the DLL, leave ProcName empty
class function IsAvaliable(const ADLLName: string; const AProcName: string = ''): Boolean;
constructor Create(const ADLLName: string; LoadMethods: TModuleLoadMethods = []);
destructor Destroy; override;
// Get a pointer to a function in the DLL. Should be called as GetProcedure('Name',@FuncPointer);
// Returns True if the function was found. Note that a call to GetProcAddress is only executed if AProc = nil
function GetProcedure(const AName: string; var AProc: Pointer): Boolean;
// Returns a symbol exported from the DLL and puts it in Buffer.
// Make sure AName is actually a symbol and not a function or this will crash horribly!
function GetExportedSymbol(const AName: string; var Buffer; Size: Integer): Boolean;
// Changes a symbol exported from the DLL into the value in Buffer.
// The change is not persistent (it will get lost when the DLL is unloaded)
// Make sure AName is actually a symbol and not a function or this will crash horribly!
function SetExportedSymbol(const AName: string; var Buffer; Size: Integer): Boolean;
property Loaded: Boolean read GetLoaded;
property DLLName: string read FDLLName;
property Handle: TModuleHandle read FHandle;
end;
implementation
{$IFDEF MSWINDOWS}
// load the DLL file FileName
// the rules for FileName are those of LoadLibrary
// Returns: True = success, False = failure to load
// Assigns: the handle of the loaded DLL to Module
// Warning: if Module has any other value than INVALID_MODULEHANDLE_VALUE
// on entry the function will do nothing but returning success.
function LoadModule(var Module: TModuleHandle; FileName: string): Boolean;
begin
if Module = INVALID_MODULEHANDLE_VALUE then
Module := LoadLibrary(PChar(FileName));
Result := Module <> INVALID_MODULEHANDLE_VALUE;
end;
// load the DLL file FileName
// LoadLibraryEx is used to get better control of the loading
// for the allowed values for flags see LoadLibraryEx documentation.
function LoadModuleEx(var Module: TModuleHandle; FileName: string; Flags: Cardinal): Boolean;
begin
if Module = INVALID_MODULEHANDLE_VALUE then
Module := LoadLibraryEx(PChar(FileName), 0, Flags);
Result := Module <> INVALID_MODULEHANDLE_VALUE;
end;
// unload a DLL loaded with LoadModule or LoadModuleEx
// The procedure will not try to unload a handle with
// value INVALID_MODULEHANDLE_VALUE and assigns this value
// to Module after unload.
procedure UnloadModule(var Module: TModuleHandle);
begin
if Module <> INVALID_MODULEHANDLE_VALUE then
FreeLibrary(Module);
Module := INVALID_MODULEHANDLE_VALUE;
end;
// returns the pointer to the symbol named SymbolName
// if it is exported from the DLL Module
// nil is returned if the symbol is not available
function GetModuleSymbol(Module: TModuleHandle; SymbolName: string): Pointer;
begin
Result := nil;
if Module <> INVALID_MODULEHANDLE_VALUE then
Result := GetProcAddress(Module, PChar(SymbolName));
end;
// returns the pointer to the symbol named SymbolName
// if it is exported from the DLL Module
// nil is returned if the symbol is not available.
// as an extra the Boolean variable Accu is updated
// by anding in the success of the function.
// This is very handy for rendering a global result
// when accessing a long list of symbols.
function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: string; var Accu: Boolean): Pointer;
begin
Result := nil;
if Module <> INVALID_MODULEHANDLE_VALUE then
Result := GetProcAddress(Module, PChar(SymbolName));
Accu := Accu and (Result <> nil);
end;
// get the value of variables exported from a DLL Module
// Delphi cannot access variables in a DLL directly, so
// this function allows to copy the data from the DLL.
// Beware! You are accessing the DLL memory image directly.
// Be sure to access a variable not a function and be sure
// to read the correct amount of data.
function ReadModuleData(Module: TModuleHandle; SymbolName: string; var Buffer; Size: Cardinal): Boolean;
var
Sym: Pointer;
begin
Result := True;
Sym := GetModuleSymbolEx(Module, SymbolName, Result);
if Result then
Move(Sym^, Buffer, Size);
end;
// set the value of variables exported from a DLL Module
// Delphi cannot access variables in a DLL directly, so
// this function allows to copy the data to the DLL!
// BEWARE! You are accessing the DLL memory image directly.
// Be sure to access a variable not a function and be sure
// to write the correct amount of data.
// The changes are not persistent. They get lost when the
// DLL is unloaded.
function WriteModuleData(Module: TModuleHandle; SymbolName: string; var Buffer; Size: Cardinal): Boolean;
var
Sym: Pointer;
begin
Result := True;
Sym := GetModuleSymbolEx(Module, SymbolName, Result);
if Result then
Move(Buffer, Sym^, Size);
end;
{$ENDIF MSWINDOWS}
{$IFDEF UNIX}
const
TYPE_E_ELEMENTNOTFOUND = $8002802B;
// load the .so file FileName
// the rules for FileName are those of dlopen()
// Returns: True = success, False = failure to load
// Assigns: the handle of the loaded .so to Module
// Warning: if Module has any other value than INVALID_MODULEHANDLE_VALUE
// on entry the function will do nothing but returning success.
function LoadModule(var Module: TModuleHandle; FileName: string): Boolean;
begin
if Module = INVALID_MODULEHANDLE_VALUE then
Module := dlopen(PChar(FileName), RTLD_NOW);
Result := Module <> INVALID_MODULEHANDLE_VALUE;
end;
// load the .so file FileName
// dlopen() with flags is used to get better control of the loading
// for the allowed values for flags see "man dlopen".
function LoadModuleEx(var Module: TModuleHandle; FileName: string; Flags: Cardinal): Boolean;
begin
if Module = INVALID_MODULEHANDLE_VALUE then
Module := dlopen(PChar(FileName), Flags);
Result := Module <> INVALID_MODULEHANDLE_VALUE;
end;
// unload a .so loaded with LoadModule or LoadModuleEx
// The procedure will not try to unload a handle with
// value INVALID_MODULEHANDLE_VALUE and assigns this value
// to Module after unload.
procedure UnloadModule(var Module: TModuleHandle);
begin
if Module <> INVALID_MODULEHANDLE_VALUE then
dlclose(Module);
Module := INVALID_MODULEHANDLE_VALUE;
end;
// returns the pointer to the symbol named SymbolName
// if it is exported from the .so Module
// nil is returned if the symbol is not available
function GetModuleSymbol(Module: TModuleHandle; SymbolName: string): Pointer;
begin
Result := nil;
if Module <> INVALID_MODULEHANDLE_VALUE then
Result := dlsym(Module, PChar(SymbolName));
end;
// returns the pointer to the symbol named SymbolName
// if it is exported from the .so Module
// nil is returned if the symbol is not available.
// as an extra the Boolean variable Accu is updated
// by anding in the success of the function.
// This is very handy for rendering a global result
// when accessing a long list of symbols.
function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: string; var Accu: Boolean): Pointer;
begin
Result := nil;
if Module <> INVALID_MODULEHANDLE_VALUE then
Result := dlsym(Module, PChar(SymbolName));
Accu := Accu and (Result <> nil);
end;
// get the value of variables exported from a .so Module
// Delphi cannot access variables in a .so directly, so
// this function allows to copy the data from the .so.
// Beware! You are accessing the .so memory image directly.
// Be sure to access a variable not a function and be sure
// to read the correct amount of data.
function ReadModuleData(Module: TModuleHandle; SymbolName: string; var Buffer; Size: Cardinal): Boolean;
var
Sym: Pointer;
begin
Result := True;
Sym := GetModuleSymbolEx(Module, SymbolName, Result);
if Result then
Move(Sym^, Buffer, Size);
end;
// set the value of variables exported from a .so Module
// Delphi cannot access variables in a .so directly, so
// this function allows to copy the data to the .so!
// BEWARE! You are accessing the .so memory image directly.
// Be sure to access a variable not a function and be sure
// to write the correct amount of data.
// The changes are not persistent. They get lost when the
// .so is unloaded.
function WriteModuleData(Module: TModuleHandle; SymbolName: string; var Buffer; Size: Cardinal): Boolean;
var
Sym: Pointer;
begin
Result := True;
Sym := GetModuleSymbolEx(Module, SymbolName, Result);
if Result then
Move(Buffer, Sym^, Size);
end;
{$ENDIF UNIX}
//=== { TModuleLoader } ======================================================
constructor TModuleLoader.Create(const ADLLName: string; LoadMethods: TModuleLoadMethods = []);
begin
inherited Create;
FHandle := INVALID_MODULEHANDLE_VALUE;
FDLLName := ADLLName;
Load(LoadMethods);
end;
destructor TModuleLoader.Destroy;
begin
Unload;
inherited Destroy;
end;
procedure TModuleLoader.Error(ErrorCode: Cardinal);
begin
// overriden classes should handle this
end;
function TModuleLoader.GetExportedSymbol(const AName: string; var Buffer;
Size: Integer): Boolean;
var
ASymbol: Pointer;
begin
Result := GetProcedure(AName, ASymbol);
if Result then
Move(ASymbol^, Buffer, Size);
end;
function TModuleLoader.GetLoaded: Boolean;
begin
Result := Handle <> INVALID_MODULEHANDLE_VALUE;
end;
function TModuleLoader.GetProcedure(const AName: string; var AProc: Pointer): Boolean;
begin
Result := Loaded;
if Result and not Assigned(AProc) then
begin
AProc := GetModuleSymbol(Handle, AName);
Result := Assigned(AProc);
end;
if not Result then
begin
AProc := nil;
Error(DWORD(TYPE_E_ELEMENTNOTFOUND));
end;
end;
class function TModuleLoader.IsAvaliable(const ADLLName: string; const AProcName: string = ''): Boolean;
var
Module: TModuleHandle;
P: Pointer;
begin
Result := LoadModule(Module, ADLLName);
if Result then
begin
if AProcName <> '' then
begin
P := GetModuleSymbol(Module, AProcName);
Result := Assigned(P);
end;
UnloadModule(Module);
end;
end;
procedure TModuleLoader.Load(LoadMethods: TModuleLoadMethods);
const
cLoadMethods: array [TModuleLoadMethod] of DWORD =
{$IFDEF MSWINDOWS}
(DONT_RESOLVE_DLL_REFERENCES, LOAD_LIBRARY_AS_DATAFILE, LOAD_WITH_ALTERED_SEARCH_PATH);
{$ENDIF MSWINDOWS}
{$IFDEF UNIX}
(RTLD_LAZY, RTLD_LAZY, RTLD_LAZY); // there is not really a equivalent under Linux
{$ENDIF UNIX}
var
Flags: DWORD;
I: TModuleLoadMethod;
begin
Flags := 0;
for I := Low(TModuleLoadMethod) to High(TModuleLoadMethod) do
if I in LoadMethods then
Flags := Flags or cLoadMethods[I];
if FHandle = INVALID_MODULEHANDLE_VALUE then
LoadModuleEx(FHandle, DLLName, Flags);
if FHandle = INVALID_MODULEHANDLE_VALUE then
Error(GetLastError);
end;
function TModuleLoader.SetExportedSymbol(const AName: string; var Buffer;
Size: Integer): Boolean;
var
ASymbol: Pointer;
begin
Result := GetProcedure(AName, ASymbol);
if Result then
Move(Buffer, ASymbol^, Size);
end;
procedure TModuleLoader.Unload;
begin
if FHandle <> INVALID_MODULEHANDLE_VALUE then
UnloadModule(FHandle);
FHandle := INVALID_MODULEHANDLE_VALUE;
end;
end.
| 34.726862 | 113 | 0.697218 |
47a42834bb307dfa8ed6bf993b33946c8db113b2 | 5,240 | pas | Pascal | dependencies/Indy10/System/IdResourceStrings.pas | 17-years-old/fhirserver | 9575a7358868619311a5d1169edde3ffe261e558 | [
"BSD-3-Clause"
]
| 4 | 2021-07-14T20:14:18.000Z | 2022-02-25T04:28:12.000Z | dependencies/Indy10/System/IdResourceStrings.pas | 17-years-old/fhirserver | 9575a7358868619311a5d1169edde3ffe261e558 | [
"BSD-3-Clause"
]
| null | null | null | dependencies/Indy10/System/IdResourceStrings.pas | 17-years-old/fhirserver | 9575a7358868619311a5d1169edde3ffe261e558 | [
"BSD-3-Clause"
]
| 2 | 2021-03-16T11:37:49.000Z | 2022-02-17T06:17:41.000Z | {
$Project$
$Workfile$
$Revision$
$DateUTC$
$Id$
This file is part of the Indy (Internet Direct) project, and is offered
under the dual-licensing agreement described on the Indy website.
(http://www.indyproject.org/)
Copyright:
(c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
}
{
$Log$
}
{
Rev 1.2 2004.05.20 11:38:10 AM czhower
IdStreamVCL
}
{
Rev 1.1 2004.02.03 3:15:54 PM czhower
Updates to move to System.
}
{
Rev 1.0 2004.02.03 2:36:04 PM czhower
Move
}
unit IdResourceStrings;
interface
resourcestring
//IIdTextEncoding
RSInvalidSourceArray = 'Invalid source array';
RSInvalidDestinationArray = 'Invalid destination array';
RSCharIndexOutOfBounds = 'Character index out of bounds (%d)';
RSInvalidCharCount = 'Invalid count (%d)';
RSInvalidDestinationIndex = 'Invalid destination index (%d)';
RSInvalidCodePage = 'Invalid codepage (%d)';
RSInvalidCharSet = 'Invalid character set (%s)';
RSInvalidCharSetConv = 'Invalid character set conversion (%s <-> %s)';
RSInvalidCharSetConvWithFlags = 'Invalid character set conversion (%s <-> %s, %s)';
RSUnsupportedCodePage = 'Unsupported codepage (%d)';
RSUnsupportedCharSet = 'Unsupported character set (%s)';
//IdSys
RSFailedTimeZoneInfo = 'Failed attempting to retrieve time zone information.';
// Winsock
RSWinsockCallError = 'Error on call to Winsock2 library function %s';
RSWinsockLoadError = 'Error on loading Winsock2 library (%s)';
{CH RSWinsockInitializationError = 'Winsock Initialization Error.'; }
// Status
RSStatusResolving = 'Resolving hostname %s.';
RSStatusConnecting = 'Connecting to %s.';
RSStatusConnected = 'Connected.';
RSStatusDisconnecting = 'Disconnecting.';
RSStatusDisconnected = 'Disconnected.';
RSStatusText = '%s';
// Stack
RSStackError = 'Socket Error # %d' + #13#10 + '%s';
RSStackEINTR = 'Interrupted system call.';
RSStackEBADF = 'Bad file number.';
RSStackEACCES = 'Access denied.';
RSStackEFAULT = 'Buffer fault.';
RSStackEINVAL = 'Invalid argument.';
RSStackEMFILE = 'Too many open files.';
RSStackEWOULDBLOCK = 'Operation would block.';
RSStackEINPROGRESS = 'Operation now in progress.';
RSStackEALREADY = 'Operation already in progress.';
RSStackENOTSOCK = 'Socket operation on non-socket.';
RSStackEDESTADDRREQ = 'Destination address required.';
RSStackEMSGSIZE = 'Message too long.';
RSStackEPROTOTYPE = 'Protocol wrong type for socket.';
RSStackENOPROTOOPT = 'Bad protocol option.';
RSStackEPROTONOSUPPORT = 'Protocol not supported.';
RSStackESOCKTNOSUPPORT = 'Socket type not supported.';
RSStackEOPNOTSUPP = 'Operation not supported on socket.';
RSStackEPFNOSUPPORT = 'Protocol family not supported.';
RSStackEAFNOSUPPORT = 'Address family not supported by protocol family.';
RSStackEADDRINUSE = 'Address already in use.';
RSStackEADDRNOTAVAIL = 'Cannot assign requested address.';
RSStackENETDOWN = 'Network is down.';
RSStackENETUNREACH = 'Network is unreachable.';
RSStackENETRESET = 'Net dropped connection or reset.';
RSStackECONNABORTED = 'Software caused connection abort.';
RSStackECONNRESET = 'Connection reset by peer.';
RSStackENOBUFS = 'No buffer space available.';
RSStackEISCONN = 'Socket is already connected.';
RSStackENOTCONN = 'Socket is not connected.';
RSStackESHUTDOWN = 'Cannot send or receive after socket is closed.';
RSStackETOOMANYREFS = 'Too many references, cannot splice.';
RSStackETIMEDOUT = 'Connection timed out.';
RSStackECONNREFUSED = 'Connection refused.';
RSStackELOOP = 'Too many levels of symbolic links.';
RSStackENAMETOOLONG = 'File name too long.';
RSStackEHOSTDOWN = 'Host is down.';
RSStackEHOSTUNREACH = 'No route to host.';
RSStackENOTEMPTY = 'Directory not empty';
RSStackHOST_NOT_FOUND = 'Host not found.';
RSStackClassUndefined = 'Stack Class is undefined.';
RSStackAlreadyCreated = 'Stack already created.';
// Other
RSAntiFreezeOnlyOne = 'Only one TIdAntiFreeze can exist per application.';
RSCannotSetIPVersionWhenConnected = 'Cannot change IPVersion when connected';
RSCannotBindRange = 'Can not bind in port range (%d - %d)';
RSConnectionClosedGracefully = 'Connection Closed Gracefully.';
RSCorruptServicesFile = '%s is corrupt.';
RSCouldNotBindSocket = 'Could not bind socket. Address and port are already in use.';
RSInvalidPortRange = 'Invalid Port Range (%d - %d)';
RSInvalidServiceName = '%s is not a valid service.';
RSIPv6Unavailable = 'IPv6 unavailable';
RSInvalidIPv6Address = '%s is not a valid IPv6 address';
RSIPVersionUnsupported = 'The requested IPVersion / Address family is not supported.';
RSNotAllBytesSent = 'Not all bytes sent.';
RSPackageSizeTooBig = 'Package Size Too Big.';
RSSetSizeExceeded = 'Set Size Exceeded.';
RSNoEncodingSpecified = 'No encoding specified.';
{CH RSStreamNotEnoughBytes = 'Not enough bytes read from stream.'; }
RSEndOfStream = 'End of stream: Class %s at %d';
//DNS Resolution error messages
RSMaliciousPtrRecord = 'Malicious PTR Record';
implementation
end.
| 40 | 89 | 0.712977 |
f148541f6c9c30b828b2c489c5ab423ae117682f | 779 | pas | Pascal | Tools/TES5Edit/Edit Scripts/List used baseforms and statistics.pas | horkoborko/SkyrimFollowerMod | 0235daf44ddbd3a20b02447df517a40be755ba74 | [
"MIT"
]
| 10 | 2020-05-09T13:53:31.000Z | 2021-10-10T17:34:49.000Z | Tools/TES5Edit/Edit Scripts/List used baseforms and statistics.pas | horkoborko/SkyrimFollowerMod | 0235daf44ddbd3a20b02447df517a40be755ba74 | [
"MIT"
]
| null | null | null | Tools/TES5Edit/Edit Scripts/List used baseforms and statistics.pas | horkoborko/SkyrimFollowerMod | 0235daf44ddbd3a20b02447df517a40be755ba74 | [
"MIT"
]
| 4 | 2020-06-05T12:32:58.000Z | 2022-01-15T00:17:44.000Z | {
Counts how much baseforms are used in references
}
unit UserScript;
var
slForms: TStringList;
i: integer;
function Initialize: integer;
begin
slForms := TStringList.Create;
end;
function Process(e: IInterface): integer;
var
s: string;
begin
Result := 0;
s := Signature(e);
if (s <> 'REFR') and (s <> 'ACHR') and (s <> 'PHZD') and (s <> 'PGRD') then
Exit;
s := GetElementEditValues(e, 'NAME');
if s = '' then Exit;
i := slForms.IndexOf(s);
if i = -1 then
slForms.AddObject(s, 1)
else
slForms.Objects[i] := Integer(slForms.Objects[i]) + 1;
end;
function Finalize: integer;
begin
slForms.Sort;
for i := 0 to slForms.Count - 1 do
AddMessage(slForms[i] + ' ' + IntToStr(slForms.Objects[i]));
slForms.Free;
end;
end.
| 16.574468 | 77 | 0.627728 |
473e49d3c898125ea709ddff06384cd97564de64 | 63,999 | pas | Pascal | win-os2/0011.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 11 | 2015-12-12T05:13:15.000Z | 2020-10-14T13:32:08.000Z | win-os2/0011.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| null | null | null | win-os2/0011.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 8 | 2017-05-05T05:24:01.000Z | 2021-07-03T20:30:09.000Z |
{ PURPOSE : Demonstrate how to smoothly drag a bitmap across an application.
AUTHOR : Michael Vincze (mav@asd470.dseg.ti.com)
REFERENCE: Microsoft vendor note 4-10.zip (ftp.uu.net
/vendor/microsoft/developer-network)
DATE : 07/25/93
}
program DragBmp;
uses
DragUnit,
DragBmp_,
WinTypes,
WinProcs,
OWindows,
ODialogs;
{$R DragBmp }
const
ApplicationName: PChar = 'Bitmap Drag';
type
TDragBmpApplication = object (TApplication)
procedure InitMainWindow; virtual;
end;
PDragBmpWindow = ^TDragBmpWindow;
TDragBmpWindow = object (TWindow)
bImageDrawn: boolean; { has the image been drawn? }
bSelected : boolean; { has the image been selected? }
hbmImg : HBITMAP; { handles to image and backdrop }
hbmbk : HBITMAP;
constructor Init (AParent: PWindowsObject; ATitle: PChar);
procedure SetupWindow; virtual;
destructor Done; virtual;
procedure GetWindowClass (var AWndClass: TWndClass); virtual;
procedure WMLButtonDown (var Msg: TMessage); virtual wm_First + wm_LButtonDown;
procedure WMMouseMove (var Msg: TMessage); virtual wm_First + wm_MouseMove;
procedure WMLButtonUp (var Msg: TMessage); virtual wm_First + wm_LButtonUp;
procedure WMPaint (var Msg: TMessage); virtual wm_First + wm_Paint;
procedure CMDrawBmp (var Msg: TMessage); virtual cm_First + cm_DrawBmp;
procedure CMAbout (var Msg: TMessage); virtual cm_First + cm_About;
end;
procedure TDragBmpApplication.InitMainWindow;
begin
MainWindow := New (PDragBmpWindow, Init (nil, ApplicationName));
end;
constructor TDragBmpWindow.Init (AParent: PWindowsObject; ATitle: PChar);
begin
inherited Init (AParent, ATitle);
Attr.Menu := LoadMenu (hInstance, 'Main');
hbmImg := LoadBitmap (hInstance, 'Object');
hbmBk := LoadBitmap (hInstance, 'BackGround');
bImageDrawn := False;
bSelected := False;
end;
destructor TDragBmpWindow.Done;
begin
inherited Done;
if hbmImg <> 0 then
begin
if bImageDrawn = TRUE then
DeleteImage
else
DeleteObject (hbmImg);
end;
if hbmBk <> 0 then
DeleteObject (hbmBk);
end;
procedure TDragBmpWindow.GetWindowClass (var AWndClass : TWndClass);
begin
inherited GetWindowClass (AWndClass);
AWndClass.HIcon := LoadIcon (HInstance, ApplicationName);
end;
procedure TDragBmpWindow.SetupWindow;
begin
inherited SetupWindow;
end;
procedure TDragBmpWindow.WMLButtonDown (var Msg: TMessage);
begin
if bImageDrawn = TRUE then
begin
bSelected := IsSelected (LOWORD (Msg.lParam), HIWORD(Msg.lParam));
if bSelected = TRUE then
BeginDrag (HWindow, LOWORD (Msg.lParam), HIWORD (Msg.lParam));
end;
end;
procedure TDragBmpWindow.WMMouseMove (var Msg: TMessage);
begin
if bSelected = TRUE then
Drag (HWindow, LOWORD (Msg.lParam), HIWORD (Msg.lParam));
end;
procedure TDragBmpWindow.WMLButtonUp (var Msg: TMessage);
begin
if bSelected = TRUE then
begin
EndDrag (HWindow, LOWORD (Msg.lParam), HIWORD (Msg.lParam));
bSelected := FALSE;
end;
end;
procedure TDragBmpWindow.WMPaint (var Msg: TMessage);
var
ps: TPaintStruct;
begin
BeginPaint (hWindow, ps);
if hbmBk <> 0 then
DrawBackdrop (ps.hdc, hbmBk);
if bImageDrawn = TRUE then
DrawImage (ps.hdc);
EndPaint (hWindow, ps)
end;
procedure TDragBmpWindow.CMDrawBmp (var Msg: TMessage);
var
Menu: HMenu;
Rect : TRect;
begin
{ Initialize image info }
bImageDrawn := TRUE;
InitImageInfo (hWindow, hbmImg, 100, 100);
{ Once drawn, disable and gray this menuitem }
Menu := GetMenu (hWindow);
EnableMenuItem (Menu, cm_DrawBmp, MF_BYCOMMAND or MF_DISABLED or MF_GRAYED);
DrawMenuBar (hWindow);
end;
procedure TDragBmpWindow.CMAbout (var Msg: TMessage);
begin
Application^.ExecDialog (New (PDialog, Init (@Self, 'About')));
end;
var
Application:TDragBmpApplication;
begin
Application.Init (ApplicationName);
Application.Run;
Application.Done;
end.
---------- CUT HERE ---------- DRAGUNIT.PAS ----------
{ ****************************************************************************
File: DragUnit.pas
Purpose: Contains bitmap dragging routines.
Functions:
InitImageInfo()
DrawImage()
DeleteImage()
DrawBackdrop()
IsSelected()
BeginDrag()
Drag()
EndDrag()
Development Team:
Michael Vincze
Patrick Schreiber
Written by Vincze International.
Adopted from Microsoft Product Support Services, Windows Developer Support
COPYRIGHT:
(C) Copyright Vincze International, 1993.
(C) Copyright Microsoft Corp. 1993. All rights reserved.
You have a royalty-free right to use, modify, reproduce and
distribute the Sample Files (and/or any modified version) in
any way you find useful, provided that you agree that
Vincze International and Microsoft have no warranty obligations
or liability for any Sample Application Files which are modified.
**************************************************************************** }
unit DragUnit;
interface
uses
WinTypes,
WinProcs;
{ force C types }
type
POINT = TPoint;
RECT = TRect;
BITMAP = TBitmap;
BOOL = boolean;
procedure InitImageInfo (hWnd_: HWND; hbm: HBITMAP; nX, nY: integer);
procedure DeleteImage;
function IsSelected (nX, nY: integer): BOOL;
procedure BeginDrag (hWnd_: HWND; nX, nY: integer);
procedure Drag (hwnd_: HWND; nX, nY: integer);
procedure EndDrag (hwnd_: HWND; nX, nY: integer);
procedure DrawBackdrop (hdc_: HDC; hbm: HBITMAP);
procedure DrawImage (hdc_: HDC);
implementation
{ Image data structure }
type
IMAGE= record
bmX : integer; { Bitmap origin }
bmY : integer; { Bitmap origin }
bmWidth : integer; { Bitmap width }
bmHeight: integer; { Bitmap height }
hbmImage: HBITMAP; { Image's bitmap }
hbmBkg : HBITMAP; { What's behind our image }
end;
{ Global variables to this unit }
var
domino : IMAGE; { Image's info }
rcClient: RECT; { Client area bounding rectangle }
xPrev : integer; { Previous mouse position }
yPrev : integer;
{ ****************************************************************************
Function: InitImageInfo()
Purpose: Initialize info for our object.
Parameters:
HDC hdc_ - Handle to window dc
int nX - X-coordinate of object origin
int nY - Y-coordinate of object origin
Returns:
No return value.
Comments:
History: Date Author Reason
3/9/92 PES Created
7/23/93 MAV Corrected rect_.right and rect_.bottom to
reflect the actual update rectangle.
**************************************************************************** }
procedure InitImageInfo (hWnd_: HWND; hbm: HBITMAP; nX, nY: integer);
var
hdc_, { Handles to window and memory dcs }
hdcMem : HDC;
hbmNew, { Handles to bitmaps }
hbmPrev: HBITMAP;
bm : BITMAP; { BITMAP data structure }
rect_ : RECT; { Invalid rectangle }
begin
{ Get window and memory dcs }
hdc_ := GetDC (hWnd_);
hdcMem := CreateCompatibleDC (hdc_);
{ Get width and height of bitmap }
GetObject (hbm, sizeof (BITMAP), @bm);
{ Initialize image's info and store rect for updating }
rect_.left := nX;
rect_.top := nY;
rect_.right := nX + bm.bmWidth;
rect_.bottom := nY + bm.bmHeight;
domino.bmX := nX;
domino.bmY := nY;
domino.bmWidth := bm.bmWidth;
domino.bmHeight := bm.bmHeight;
domino.hbmImage := hbm;
{ Create and select a new bitmap to store our background }
hbmNew := CreateCompatibleBitmap (hdc_, bm.bmWidth, bm.bmHeight);
hbmPrev := SelectObject (hdcMem, hbmNew);
{ Get the background from the screen }
BitBlt (hdcMem, 0, 0, domino.bmWidth, domino.bmHeight,
hdc_, domino.bmX, domino.bmY, SRCCOPY);
{ Tidy up }
SelectObject (hdcMem, hbmPrev);
DeleteDC (hdcMem);
ReleaseDC (hWnd_, hdc_);
{ Store the new background bitmap }
domino.hbmBkg := hbmNew;
{ Update client area where image is }
InvalidateRect (hWnd_, @rect_, FALSE);
UpdateWindow (hWnd_);
end;
{****************************************************************************
Function: DeleteImage()
Purpose: Delete image and background bitmaps.
Parameters:
None.
Returns:
No return value.
Comments:
History: Date Author Reason
3/9/92 PES Created
**************************************************************************** }
procedure DeleteImage;
begin
if domino.hbmImage <> 0 then DeleteObject (domino.hbmImage);
if domino.hbmBkg <> 0 then DeleteObject (domino.hbmBkg);
end;
{ ****************************************************************************
Function: DrawImage()
Purpose: Draws image at it's current position.
Parameters:
HDC hdc_ - Handle to window dc
Returns:
No return value.
Comments:
History: Date Author Reason
3/9/92 PES Created
**************************************************************************** }
procedure DrawImage (hdc_: HDC);
var
hdcMem : HDC; { Handle to memory dc }
hbmPrev: HBITMAP; { Handle to previous bitmap }
begin
{ Create a memory dc and select our object's bitmap into it }
hdcMem := CreateCompatibleDC (hdc_);
hbmPrev := SelectObject (hdcMem, domino.hbmImage);
{ BitBlt it to the screen }
BitBlt (hdc_, domino.bmX, domino.bmY, domino.bmWidth, domino.bmHeight,
hdcMem, 0, 0, SRCCOPY);
{ Tidy up }
SelectObject (hdcMem, hbmPrev);
DeleteDC (hdcMem);
end;
{ ****************************************************************************
Function: DrawBackdrop()
Purpose: Draws the backdrop bitmap so we know this bitmap dragging
technique really works for any background.
Parameters:
HDC hdc_ - Handle to window dc
HBITMAP hbm - Handle to backdrop bitmap
Returns:
No return value.
Comments:
History: Date Author Reason
3/9/92 PES Created
**************************************************************************** }
procedure DrawBackdrop (hdc_: HDC; hbm: HBITMAP);
var
hdcMem : HDC; { Handle to memry dc }
hbmPrev: HBITMAP; { Handle to previous bitmap }
bm : BITMAP; { BITMAP data structure }
begin
{ Get dimensions of backdrop bitmap }
GetObject (hbm, sizeof (BITMAP), @bm);
{ Create a memory dc and select our backdrop's bitmap into it }
hdcMem := CreateCompatibleDC (hdc_);
hbmPrev := SelectObject (hdcMem, hbm);
{ BitBlt it to the upper-left part of client area }
BitBlt (hdc_, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
{ Tidy up }
SelectObject (hdcMem, hbmPrev);
DeleteDC (hdcMem);
end;
{ ****************************************************************************
Function: IsSelected()
Purpose: Specifies whether our image has been selected for dragging.
Parameters:
WORD wX - X-coordinate of mouse position
WORD wY - Y-coordinate of mouse position
Returns:
Returns TRUE if specified point is in object's bounding rectangle,
FALSE otherwise.
Comments:
History: Date Author Reason
3/9/92 PES Created
**************************************************************************** }
function IsSelected (nX, nY: integer): BOOL;
var
pt : POINT; { POINT data structure }
rect_: RECT; { RECT data structure }
begin
{ Current mouse position }
pt.x := nX;
pt.y := nY;
{ Current bitmap position }
rect_.left := domino.bmX;
rect_.top := domino.bmY;
rect_.right := domino.bmX + domino.bmWidth - 1;
rect_.bottom := domino.bmY + domino.bmHeight - 1;
{ Return TRUE if pt in rect of image }
IsSelected := PtInRect (rect_, pt);
end;
{ ****************************************************************************
Function: BeginDrag()
Purpose: Starts the bitmap dragging process.
Parameters:
HWND hWnd_ - Handle to window
int nX - X-coordinate of mouse position
int nY - Y-coordinate of mouse position
Returns:
No return value.
Comments:
History: Date Author Reason
3/9/92 PES Created
**************************************************************************** }
procedure BeginDrag (hWnd_: HWND; nX, nY: integer);
begin
{ Get all mouse messages }
SetCapture (hWnd_);
{ Save previous mouse position }
xPrev := nX;
yPrev := nY;
{ Get client area rect }
GetClientRect (hWnd_, rcClient);
end;
{ ****************************************************************************
Function: Drag()
Purpose: Perform the bitmap dragging.
Parameters:
HWND hWnd_ - Handle to window
int nX - X-coordinate of mouse position
int nY - Y-coordinate of mouse position
Returns:
No return value.
Comments:
History: Date Author Reason
3/9/92 PES Created
**************************************************************************** }
procedure Drag (hwnd_: HWND; nX, nY: integer);
var
hdc_, { Handles to dcs }
hdcMem : HDC;
hdcNewBkg, { Handles to dcs }
hdcOldBkg: HDC;
hbmNew, { Handles to bitmaps }
hbmNPrev : HBITMAP;
hbmOPrev, { Handles to bitmaps }
hbmPrev,
hbmTemp : HBITMAP;
dx, { Mouse delta x and delta y }
dy : integer;
begin
{ Get window and memory dcs for our BitBlt'ing }
hdc_ := GetDC (hWnd_);
hdcMem := CreateCompatibleDC (hdc_);
hdcNewBkg := CreateCompatibleDC (hdc_);
hdcOldBkg := CreateCompatibleDC (hdc_);
{ Create a temp bitmap for our new background }
hbmNew := CreateCompatibleBitmap (hdc_, domino.bmWidth, domino.bmHeight);
{ Select our bitmaps }
hbmPrev := SelectObject (hdcMem, domino.hbmImage);
hbmNPrev := SelectObject (hdcNewBkg, hbmNew);
hbmOPrev := SelectObject (hdcOldBkg, domino.hbmBkg);
{ Calculate delta x and delta y }
dx:= xPrev - nX;
dy:= yPrev - nY;
{ Save previous mouse position }
xPrev:= nX;
yPrev:= nY;
{ Update image's position }
dec (domino.bmX, dx);
dec (domino.bmY, dy);
{ Copy screen to new background }
BitBlt (hdcNewBkg, 0, 0, domino.bmWidth, domino.bmHeight,
hdc_, domino.bmX, domino.bmY, SRCCOPY);
{ Replace part of new bkg with old background }
BitBlt (hdcNewBkg, dx, dy, domino.bmWidth, domino.bmHeight,
hdcOldBkg, 0, 0, SRCCOPY);
{ Copy image to old background }
BitBlt (hdcOldBkg, -dx, -dy, domino.bmWidth, domino.bmHeight,
hdcMem, 0, 0, SRCCOPY);
{ Copy image to screen }
BitBlt (hdc_, domino.bmX, domino.bmY, domino.bmWidth, domino.bmHeight,
hdcMem, 0, 0, SRCCOPY);
{ Copy old background to screen }
BitBlt(hdc_, domino.bmX+dx, domino.bmY+dy, domino.bmWidth, domino.bmHeight,
hdcOldBkg, 0, 0, SRCCOPY);
{ Tidy up }
SelectObject (hdcMem, hbmPrev);
SelectObject (hdcNewBkg, hbmNPrev);
SelectObject (hdcOldBkg, hbmOPrev);
{ Swap old with new background }
hbmTemp := domino.hbmBkg;
domino.hbmBkg := hbmNew;
hbmNew := hbmTemp;
DeleteObject (hbmNew);
{ Tidy up some more }
DeleteDC (hdcMem);
DeleteDC (hdcNewBkg);
DeleteDC (hdcOldBkg);
ReleaseDC (hWnd_, hdc_);
end;
{ ****************************************************************************
Function: EndDrag()
Purpose: Ends the bitmap dragging process.
Parameters:
HWND hWnd_ - Handle to window
int nX - X-coordinate of mouse position
int nY - Y-coordinate of mouse position
Returns:
No return value.
Comments:
History: Date Author Reason
3/9/92 PES Created
3/12/92 PES Added code to restrict domino to visible
area of screen.
**************************************************************************** }
procedure EndDrag (hwnd_: HWND; nX, nY: integer);
var
hdc_, { Handles to dcs }
hdcMem: HDC;
hdcNewBkg, { Handles to dcs }
hdcOldBkg: HDC;
hbmNew, { Handles to bitmaps }
hbmNPrev : HBITMAP;
hbmOPrev, { Handles to dcs }
hbmPrev,
hbmTemp : HBITMAP;
dx, { Delta x and delta y of mouse }
dy : integer;
x, { X and y for position correction }
y : integer;
begin
{ Calculate delta x and delta y }
dx:= xPrev - nX;
dy:= yPrev - nY;
{ Check if we've moved since last time }
if (dx <> 0) or (dy <> 0) then
begin
{ Get window and memory dcs }
hdc_ := GetDC (hWnd_);
hdcMem := CreateCompatibleDC (hdc_);
hdcNewBkg := CreateCompatibleDC (hdc_);
hdcOldBkg := CreateCompatibleDC (hdc_);
{ Create a temp bitmap for our new background }
hbmNew := CreateCompatibleBitmap (hdc_, domino.bmWidth, domino.bmHeight);
{ Select our bitmaps }
hbmPrev := SelectObject (hdcMem, domino.hbmImage);
hbmNPrev := SelectObject (hdcNewBkg, hbmNew);
hbmOPrev := SelectObject (hdcOldBkg, domino.hbmBkg);
{ Update bitmap's position }
dec (domino.bmX, dx);
dec (domino.bmY, dy);
{ Copy screen to new background }
BitBlt (hdcNewBkg, 0, 0, domino.bmWidth, domino.bmHeight,
hdc_, domino.bmX, domino.bmY, SRCCOPY);
{ Replace part of new bkg with old background }
BitBlt (hdcNewBkg, dx, dy, domino.bmWidth, domino.bmHeight,
hdcOldBkg, 0, 0, SRCCOPY);
{ Copy image to old background }
BitBlt (hdcOldBkg, -dx, -dy, domino.bmWidth, domino.bmHeight,
hdcMem, 0, 0, SRCCOPY);
{ Copy image to screen }
BitBlt (hdc_, domino.bmX, domino.bmY, domino.bmWidth, domino.bmHeight,
hdcMem, 0, 0, SRCCOPY);
{ Copy old background to screen }
BitBlt (hdc_, domino.bmX + dx, domino.bmY + dy,
domino.bmWidth, domino.bmHeight,
hdcOldBkg, 0, 0, SRCCOPY);
{ Clean up }
SelectObject (hdcMem, hbmPrev);
SelectObject (hdcNewBkg, hbmNPrev);
SelectObject (hdcOldBkg, hbmOPrev);
{ Swap old with new background }
hbmTemp := domino.hbmBkg;
domino.hbmBkg := hbmNew;
hbmNew := hbmTemp;
DeleteObject (hbmNew);
{ Tidy up }
DeleteDC (hdcMem);
DeleteDC (hdcNewBkg);
DeleteDC (hdcOldBkg);
ReleaseDC (hWnd_, hdc_);
end;
{ Reset previous mouse position }
xPrev:= 0;
yPrev:= 0;
{ Release mouse capture }
ReleaseCapture;
{ Make sure our domino stays completely visible }
if domino.bmX < 0 then
x:= 0
else if domino.bmX + domino.bmWidth > rcClient.right then
x:= rcClient.right - domino.bmWidth
else
x:= domino.bmX;
if domino.bmY < 0 then
y:= 0
else if domino.bmY + domino.bmHeight > rcClient.bottom then
y:= rcClient.bottom - domino.bmHeight
else
y:= domino.bmY;
if (x <> domino.bmX) or (y <> domino.bmY) then
begin
xPrev:= domino.bmX;
yPrev:= domino.bmY;
Drag (hWnd_, x, y);
xPrev := 0;
yPrev := 0;
end;
end;
end.
---------- CUT HERE ---------- DRAGBMP_.PAS ----------
unit DragBmp_;
interface
{ menu IDs }
const
cm_DrawBmp = 101;
cm_About = 102;
implementation
end.
---------- CUT HERE ---------- DRAGBMP.RC ----------
BACKGROUND BITMAP
BEGIN
'42 4D BE 25 00 00 00 00 00 00 3E 00 00 00 28 00'
'00 00 40 01 00 00 F0 00 00 00 01 00 01 00 00 00'
'00 00 80 25 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 FF FF FF 00 48 55'
'48 95 56 BE B6 EB 6D AB 62 20 44 91 5B AE B7 6F'
'D7 FB 7B B6 B6 EF 5D 55 57 5A AB 6A 89 5A 4A 49'
'49 56 B6 D2 24 B5 92 84 92 6A AD E9 ED B6 9A 54'
'08 DA 91 24 F5 75 AD 5B 7D 56 D6 ED FF FE FB DA'
'DA B5 AD 4A 72 24 94 AA 92 A9 4A AC C9 4A 24 29'
'24 85 59 4F BB 65 75 D5 55 05 26 49 56 DB 76 F6'
'D7 FD BD BB 6D DD EE B5 B5 56 52 B4 85 49 4A 91'
'55 56 B5 52 12 B5 D1 4A 49 2A A7 7B 6E DD AA 5A'
'A2 54 48 92 B9 AE DB AD FE D7 77 6E FF BB DD EB'
'55 B5 AD 49 28 52 15 AA AA A9 56 AD 45 6B 02 10'
'92 49 5A D6 DB B7 55 A2 8C 95 52 24 67 75 AD 77'
'B5 BD ED DB DD F7 7B 56 AB 6A 5A B2 52 88 A8 25'
'55 55 55 52 AB 4A A4 A5 24 B4 A5 2D B6 6D 76 5D'
'51 22 84 88 DA DB 7B DD 6F 6B 5A AF 7B BF D6 DA'
'D6 8D B5 4C 85 23 2A DA AA AA AA AD 44 B5 09 09'
'49 01 5A DB 6D DB 4D E6 AD 4A 29 23 35 AE D6 97'
'FD DE EF FA F6 ED 7D 95 2D 72 AA B1 28 4C 45 25'
'55 55 56 A9 53 4D 52 52 24 56 A5 55 DB 76 F5 19'
'52 55 4A 48 6B 7B B5 FA AB 75 BD 6F DF FF EB 76'
'DA 8D 55 4A 53 11 12 D5 52 8A B5 56 A6 BA 88 94'
'89 91 5A AB 36 DD AA F6 AE 82 90 92 9A D6 6F 2F'
'FE EF 6B DD 7D AD DE AA B5 7A AA B4 84 24 6A 2A'
'AD 7D 4A AA C9 52 21 21 B2 25 26 AA ED AB 5B 45'
'51 55 25 24 2B B5 DA FB 6B D5 DE BB F7 FF B5 55'
'49 95 6D 49 29 69 89 55 52 81 B5 2D B6 AD 4A 4A'
'04 94 98 AB 5B 7E F6 BA AE A5 49 49 55 5F 77 56'
'DE BF 75 D7 6F 7D 6E D5 B6 6A D2 AA 4A 02 52 AA'
'AD 5E 4A DB 49 73 10 94 A9 22 63 AA B6 D5 AA CD'
'52 AA 92 12 2E EA DA F5 75 EA AF 7E FD EB D9 2E'
'49 AA AD 54 90 AD 25 55 52 A1 B5 35 B7 AE 45 21'
'24 48 94 55 6D BE ED 32 AD 55 B4 A5 5B BB B7 AF'
'EF 5D F5 D5 D7 DF 76 D1 B7 55 53 52 25 20 8A 4A'
'AD 5E A2 EB 49 55 28 4A 49 93 2A A2 CB 6B 9A ED'
'6A AA 42 88 35 6E ED 6A D5 F7 5F 7F FF 7E D9 2E'
'AA B5 AD 44 48 4A 28 B5 52 A1 5D 56 B7 6A 82 92'
'92 24 55 2D 3E DE F5 95 9B 55 B4 22 AA DB 9B 5D'
'BF 6D F5 EB 5E F5 AA D3 55 4B 5A A8 95 92 D2 8A'
'AA 8A A3 AD 6A AD 24 24 48 8A A9 52 D5 75 AB 6A'
'74 AA 49 54 57 B6 76 F7 75 DB 5F 5F FB DF 75 2E'
'AA B6 A5 51 20 24 05 55 25 55 5D 55 4D 55 49 49'
'13 34 92 49 2A AF 5A 55 8B 5D B4 81 2C D5 DD AD'
'EE B5 F5 F6 B7 76 D2 DA AA D5 5A 82 4A 92 AA 55'
'52 AA AB AA BB AD 92 5A 64 41 24 94 D5 F6 F5 DB'
'75 6A CA 34 5B 6F 6B 7B 5B EF 6F 5F FD DD A5 53'
'55 2A A7 24 94 49 6A AA AD 55 77 6D 64 5A A4 80'
'89 2A 89 21 2E AD 96 AA 96 95 3A 82 B5 BA DD D6'
'F6 BA DA F5 6F 77 4D AD 56 D5 5C 49 21 92 95 55'
'52 AA DE DA DF B5 09 2B 52 94 52 4A 51 5B 69 55'
'69 6A C5 68 2A 56 B7 35 5D DB B7 AF DD DD 55 56'
'A9 5A AB 12 4A 25 55 55 55 54 B5 95 A5 6B 52 48'
'24 41 14 98 AD 6E B6 AA 96 AD BA 95 4B B5 DA EE'
'F3 76 ED 7B BB 77 AB 59 56 A5 B4 A4 94 95 55 55'
'52 AB EF 7A BA AC 94 92 89 16 A9 23 43 5B CA DB'
'6A A9 4B 70 2C 66 B7 5B AE AD 5B D7 76 CE AA B7'
'6D 5B 4D 09 21 55 55 55 55 55 7A D6 D6 EB 21 24'
'52 68 22 48 3C D6 35 24 AD 56 B4 EA 93 DD 6A F6'
'FB FB F7 7E ED BD 56 D4 C9 6A B2 52 4A 2A AA AA'
'AA AA EF AB AB 55 4A 49 94 82 CC 95 43 2D EA DB'
'52 F9 AB F0 2C A5 BF 4D B6 AD 5E D7 DB 6D AD 2B'
'36 D5 48 88 92 AA AA D5 55 55 DA AE 5A D6 A4 92'
'22 55 11 21 1C D7 55 B6 DD 87 6D E5 5B 5D 6D FB'
'6B F7 F5 FE BD DB 5A DE CA AA B2 21 25 55 55 2A'
'A9 56 FF 59 E6 BB 11 24 89 24 4A 4A 61 2A AB 24'
'A3 79 4B D8 55 6A DB 2E DF 5D 6F DD F7 6E D5 31'
'35 55 84 96 52 AA AA D5 52 A9 B5 57 5D 65 44 49'
'34 89 B2 99 0B 5D B6 DB 5E 96 B7 B2 AA D5 B6 E9'
'AA F7 DF B7 DD B5 AA EE D6 AA 51 20 C5 55 55 2A'
'AD 57 FE DA 6A DF A9 92 42 52 04 22 54 5B 6A B6'
'A9 69 EF 68 B5 16 6D BF 7F AE FA FE BA DE AD 52'
'A9 52 84 95 2A AA AA D5 52 AB 7B 35 D5 A8 02 24'
'94 94 A9 48 A2 AA 95 A9 56 B7 1E F5 4A ED DB 65'
'D5 7D BF D5 F7 75 6A AD 56 AE 29 25 55 55 55 55'
'55 6E F6 EE AA 57 54 89 31 21 22 9B 15 95 6E 57'
'BA CA FB E8 B5 2A AE DD 7F DB F7 7F AD D6 D5 55'
'AA A0 42 48 4A AA AA AA AA 9B ED 59 57 DA 85 22'
'46 4A 4A 20 64 25 A9 DA 55 BD B7 DA 6A D5 59 B7'
'DA FF 6D EB 7B 6D AA EA 54 94 94 93 5A 95 55 55'
'55 57 BD D7 DA 35 28 4D 10 91 54 CA 89 9A 56 B5'
'AB 53 7F 74 95 AA B7 6D 77 BA FF 5E EE DA AD 15'
'AA A9 25 24 A5 55 55 AD 52 BE F6 9A 35 EB 52 90'
'6A 25 12 12 22 25 AD 56 B6 AE DE FD 65 2A AD DB'
'DE F7 DB FB DB B6 B2 EA B5 22 48 49 5A AA AA 52'
'AA 6D ED 75 D6 96 84 4A 82 C9 64 A4 D5 5A A9 AA'
'D5 59 7B EA 9A D5 55 36 BB ED BE B6 B6 6D 6D 2B'
'49 48 92 92 A5 55 55 AD 55 DB BF D6 B5 6D 51 12'
'54 12 09 92 04 8B 57 6D 5A B7 DF DE A5 2A AB EB'
'EF BF FB ED EB D2 D2 D4 B2 11 24 A5 5A AA AA 52'
'AA 37 FD 35 6A B3 0A 64 92 A5 52 24 A9 24 AA 9A'
'A5 D5 7F BD 5A D5 56 5F BD 7B 77 5B 5E AE AD AB'
'44 A2 49 0A A5 55 55 AE AB EF 6A DA D6 CE A0 89'
'24 94 A4 89 24 AB 5D 75 DF 2D DB 77 45 2B 2D D7'
'77 EE EE F5 F5 59 55 54 91 04 92 55 5A AA AA B1'
'54 3E FF B5 99 B9 09 22 49 21 09 32 49 05 62 AA'
'A8 DB 7F DE DA D4 EA BE EE DB FD AF AA D6 DA AB'
'46 49 25 2A AA AA AD 4E AB FB DD 6B 77 57 92 4C'
'92 4A 52 44 A4 6A 9D AB 57 2D DB FF A5 2B 15 6D'
'FB FF D7 7B 6D AB 55 54 98 92 48 A5 55 55 52 B1'
'55 6F BB 96 A9 AA 24 91 24 94 94 91 12 83 65 6D'
'5A F6 BF B5 54 D4 AA DB DF BA BD EE DB 54 B5 55'
'22 24 92 5A AA AA AD 4E AA DE FE 6D 57 75 49 4A'
'49 21 21 26 49 5C 9A 9A B5 4B FB 7F D5 29 55 77'
'B6 F7 F7 55 B6 AB 55 54 94 89 34 A5 55 55 69 B2'
'AA BD EB AA DA CD 92 24 92 4A 4A 48 A4 13 6B 75'
'6A BD 77 FF AA A2 2A DD 7F EE EE FF 69 56 AA A9'
'21 12 41 49 5A AA 96 4D 6B FB BE D5 B5 BB 24 91'
'24 92 92 92 49 6D 4A AA D5 D7 DF EB 54 4A D5 B7'
'EE BD DD AA D6 AC D5 52 4A 24 95 56 A5 55 69 B5'
'56 F7 FD AD 2B 52 89 26 49 24 24 45 12 82 B5 55'
'AB 34 BD DF EA 95 29 6F 7D F7 B5 7B A9 B3 5A A4'
'90 49 22 A9 5A AA 96 AA AD DF 6B 52 ED EE 12 48'
'92 49 51 2A 49 2D 4D 6B 56 EF F7 FF 95 35 56 BD'
'EF BE EF D6 B7 4E A5 49 24 92 4D 56 A5 55 6D 55'
'53 BE FE AD 55 19 24 92 24 92 4A 88 92 52 B5 96'
'AD 5A BD AF 68 44 A9 5B DE F5 B9 6D AA B4 DA 92'
'49 24 92 A9 5A AA A9 6A EF 75 ED 69 AA F7 49 24'
'C9 24 92 52 34 85 4A 6D 5A B5 F7 FE AE B3 56 BF'
'7D EF 6F BB 55 6B 29 24 92 49 25 46 AA B5 56 95'
'16 FF DD 96 B5 94 94 49 12 49 24 94 C1 2A B5 DA'
'B5 E7 6F BF D1 4C A9 76 FB BD DA ED 5A 94 D2 49'
'48 92 4A A9 55 4B 69 6A ED D6 FB 75 4B 6B 22 92'
'44 92 49 21 15 45 56 2B 6B 5D FE F6 AE 91 56 CF'
'EF FB 77 B6 B5 6B 24 92 22 26 95 56 AA B4 96 D5'
'5B 7F DE AA B6 9E 54 24 99 24 92 4A A4 9A A9 D4'
'D6 B7 6D FF D5 57 54 BE DF 56 AD 6D 6A D4 D9 24'
'89 48 2A AA AA AB 6A A5 D7 FD B5 55 55 71 02 C9'
'22 49 A4 92 49 29 56 5B AC ED DF B7 AA A8 2B 5D'
'FA FD FB D9 AD AB 22 49 22 25 54 A5 55 55 55 5E'
'1E EB FD AA AA AE 54 12 48 92 12 24 92 42 A9 B5'
'5B 9B 7B 7F 55 55 D4 AB DF EB AE B7 52 56 49 2A'
'4C 92 AB 5A AA AA AA A1 F5 DF EB 77 55 55 89 44'
'9B 24 A4 C9 24 95 56 A6 B5 76 B7 F6 BA AA 13 5F'
'BB 5F 75 EA AD A8 92 40 91 24 54 A5 55 55 55 5E'
'5F FF 5E A8 AD 6A 22 5A 20 49 89 12 49 24 AA D9'
'4A DD FE EF E6 D5 6C AB 7F F6 DF 55 5A 55 24 95'
'24 49 4B 5A AA AA A5 A1 AB BA F2 D7 55 AA 48 81'
'4A 92 34 A4 92 49 55 2E F5 B7 6F DF D9 AA 93 3F'
'F5 5D B6 EB 55 D4 49 24 49 55 54 A5 55 55 5A 5E'
'7F 77 DF 29 5A 55 11 2A 52 24 82 49 24 92 AA D1'
'97 6D DD FE B7 55 24 C7 6F FB 6C 96 AA 29 A2 49'
'92 84 95 4A AA AA A5 A1 D6 EF 7A F6 A5 AA A6 44'
'84 A9 28 92 49 25 55 2F 6C DB 7B AF EA AA AB 3E'
'FF D6 DB ED 55 C4 14 94 24 29 55 55 55 2B 5B 5F'
'7F FD F5 95 5A B5 08 99 2A 42 4B 24 92 49 2A D9'
'57 B6 DF 7E DD 55 54 4B DA BD B6 AA B2 29 41 22'
'89 4A AA AA AA D4 AA A2 D5 DB EF 6A B5 4A 52 22'
'49 16 90 49 24 92 55 36 DC ED BB FD B2 B5 52 B7'
'FF AB 6D 5B 44 8A 2B 48 B2 55 55 55 55 2B 55 5D'
'BF BF BA AA A5 B5 85 54 92 50 2A 92 49 24 8A D5'
'AB 96 F6 D7 EE A6 94 8B B5 76 B5 A4 A9 50 C8 12'
'84 AA AA AA AA D6 AA A5 7B 77 76 D6 DB 4A 28 49'
'24 A5 52 48 92 49 29 2A 55 7B AF FF B9 59 62 27'
'7F DD DD 5B 51 05 12 A4 A9 53 55 55 55 2C B5 5B'
'F7 FE DD AD 2A B5 42 92 49 09 24 93 24 92 52 EB'
'AD AD 7D BF 76 B6 9D 4A ED 77 76 B5 56 48 45 29'
'22 AC AA A5 5A D3 4A B6 EE D7 FB 5A D5 4A 2D 24'
'92 52 49 24 69 45 25 2C B7 6B D7 F7 E9 D5 62 BB'
'DF ED A9 AA A0 92 98 4A 55 53 55 5A A5 2C B5 AB'
'DB FE B6 D5 5A B5 40 49 24 94 A2 49 02 2A 5A DB'
'6C DD 7F 6E DF 2A 9D 45 FD 5B 77 55 55 24 A2 94'
'AA 96 B6 A5 5A D3 56 AF 7F B7 FD 35 65 4B 95 92'
'49 21 0C 92 AC C0 42 A5 AB B7 DD FF FA DD 61 2B'
'BB F6 4C AA A4 49 14 A5 55 6D 49 55 55 2D 69 5A'
'F6 FE FB EA 9A B6 24 24 92 4A 51 24 21 15 95 5D'
'5E ED 7B BF B7 32 8A 4B 77 EB FB 5A A9 22 49 1A'
'25 AA B6 AA AA DA 96 B7 EF B7 D6 95 65 69 49 49'
'22 42 19 25 59 80 85 4B 57 6F BB FF F5 BA C2 57'
'77 EC 99 55 48 92 29 4A AA DA 92 AA AA 5A D2 B5'
'ED FD F7 D5 35 6C 92 92 4C 94 A2 48 42 2B 2A BA'
'BD DA F7 7F 6E 65 14 96 EF D7 F6 B5 52 44 92 34'
'4B 55 6D 55 55 B5 2D 6F DF 6F AD 2A CA D3 24 49'
'21 25 88 92 94 88 45 56 D3 37 AF ED D9 DA 65 2D'
'BE BD 4A AA A5 29 44 AA B4 AA A9 55 6A AA D5 BD'
'BB FB 7A D5 B5 AE 49 12 4A 48 33 44 A1 32 AA A9'
'5E ED 7E DF F6 AA 88 57 7D D2 B5 55 48 42 29 48'
'4B 55 56 AA 95 55 55 5B F6 DF F7 AB 4B 51 92 A4'
'94 92 84 15 16 45 0A B7 B5 BB DD FF 6B 55 25 4D'
'DB FF D6 EA 92 98 8A 35 B6 AA A9 55 6A AA AB 77'
'BF F6 ED 56 B6 AE 24 49 21 24 52 A8 48 88 4A AA'
'6B 57 7B BE DD B5 52 97 36 AA 29 15 24 A2 11 6A'
'55 55 56 AA AA AA D6 DF 6D BF DA A9 55 55 49 12'
'4A 49 88 92 A2 32 95 6D D6 BE D7 7D F6 CA 88 2A'
'DF FD D6 EA 51 09 2E D5 AA AA A9 55 55 55 2D BE'
'FB EE F3 56 AA A9 92 54 90 92 33 24 94 C4 A5 4A'
'AD ED BF F7 AD BE B3 4B BB F7 4D 14 A6 54 52 AA'
'55 55 56 AA AA AA D5 75 DF 7D DE AD 6A B6 24 C2'
'23 24 84 49 25 11 0A BB 5B 5B 76 EF FB 51 44 55'
'6E AC BA F5 08 91 0D 55 AA AA A9 55 55 55 AB EF'
'B7 DF B5 6A DB 49 49 19 6C 49 29 12 48 56 6A D5'
'76 D7 ED BE AD EE A9 0A BF FB 55 0A 52 24 AA AB'
'55 55 56 AA AA AD 5D 5E FE FA F6 D5 24 B7 92 42'
'01 12 52 64 92 80 85 AA CD BE 5F FF FB 55 52 AB'
'5B F5 AA F4 A4 D1 35 56 AA AA A9 45 53 5A AB FB'
'ED B7 ED AA DB 6A 34 94 D2 66 A4 89 24 B5 2A AD'
'BB 6D FB 6D D6 DD A8 24 B7 6E 55 09 09 0A 4A B5'
'55 55 57 5A AC 55 55 B7 BF FF DA 55 55 55 41 29'
'14 88 49 52 49 04 4B 5B 56 DB 56 FF BD B2 43 4B'
'6E F9 AA F4 52 A0 B5 6A AA AA A8 A5 53 A9 6F 6F'
'7B 6E B5 D6 AA AB 2B 52 45 22 92 24 92 49 54 B5'
'6D B5 FD DB 6B 6D B4 2A AB EE B5 09 94 2A 5B 55'
'55 55 57 4A AC 56 DA FD F7 FD E6 99 55 54 44 24'
'A8 4D 24 8A 44 B2 8B 6A BB 5F 57 BF FE DB 4A D5'
'57 F9 4A F2 21 44 B6 AB 6A AA A9 55 53 AA 97 DF'
'EF 6F BD 66 AA B7 99 49 12 D0 49 50 99 04 2A AB'
'56 EA FE FE A9 76 A9 2A AD D6 B5 04 96 91 49 5A'
'95 55 56 AA A4 55 7D BB 5E FD EA 9A D5 68 A2 92'
'42 05 92 25 22 49 55 56 F5 BF AD F5 FF AD 5A 95'
'53 79 55 69 48 24 BF 65 6A AA A9 25 4B 2A AB F7'
'FB D7 9A B5 2D 4F 4C 24 AC AC 24 8A 48 B2 4B 6D'
'2F 55 7B DF AA F9 A5 6A 6E F6 D5 8A 22 89 4A DA'
'AA AA 96 C8 98 55 6E BE DF 7F 75 6A D2 B1 91 49'
'11 21 49 50 92 84 96 AA EA FF AE BA FE B7 5A 95'
'93 E9 2A 30 94 B2 B6 AB 55 55 69 13 65 AA DB ED'
'F5 FD DA D5 5D 6E 2A 22 42 4A 92 26 A5 29 29 5B'
'5D AA FB F7 AB ED B5 6A 6D 36 D1 45 49 05 4D D6'
'AA AA 95 74 94 15 6F FF DF D7 B5 AA A2 D2 A8 CC'
'AC 94 24 88 08 42 56 AA B7 7F AE BD 7E DB 6A AA'
'D6 E9 2A 91 22 52 BB 6D 55 54 AA 81 21 4A BF 5B'
'B7 BF 6B 56 DD AD 55 11 09 21 49 25 52 95 4A BB'
'6D DB 7D FB AD B6 DB 55 9D 55 55 26 4C 95 56 BA'
'BA AB 54 AA 4A 5A EA FF 7E FA DC A9 25 55 2A 4A'
'52 4A 24 48 94 A2 5D 65 5B 76 AB 76 FB 5D B4 AA'
'6A 94 AA A8 91 22 AC D5 65 54 A9 48 92 A5 BF FB'
'ED EF A3 56 DB 5B 54 A4 A4 98 C9 B3 21 14 AA DA'
'F6 ED FD ED 96 FB 6B 55 DA 23 2A 45 24 55 53 B6'
'DA A9 56 93 24 4D 77 D7 5F DF BE B5 55 64 AA 91'
'09 23 12 04 5A 49 52 AB 4D 97 57 7B 7D B6 DE AA'
'54 89 55 12 49 85 5D 6D AB 55 29 48 51 5A EE BE'
'FD BA 65 4A AA 9B 49 4A 52 48 44 AA 80 A2 5D 56'
'BB 7D FD F6 D7 6D B5 55 95 22 14 A8 92 2A E7 5B'
'6C AA 55 25 26 85 DD FB AB F7 DA B5 55 76 92 24'
'92 92 99 49 2B 49 A2 DA D6 D7 56 ED BD D7 6D AA'
'74 45 CA 93 25 57 1A EE AB 55 42 4A 48 3A BF D7'
'FF BE B5 55 69 A5 24 91 24 25 23 32 48 12 5D AB'
'5D BD FB D9 6A BE DB 55 89 08 15 44 48 28 EF 59'
'5A A8 AC 94 D2 CB FB BE AF 75 EA AA 97 5A 49 24'
'49 4C 94 84 92 E5 A5 5A B7 57 FF FF DF FF FE FF'
'FE 52 FE BD 12 D7 FF D7 B5 55 D1 21 E5 35 77 FF'
'FA EF 55 55 6D 53 12 49 B2 51 29 29 64 FA 5A B7'
'EC FD 7F FF EF FF FD FF FF 87 FF 9A 65 5F FF FA'
'6A AB E4 4A F2 CB FF FF DF BA EA AA A9 6E 64 92'
'4C 84 A2 52 09 E1 66 C9 FB 97 EE B5 4E A6 CA C4'
'55 5F EA FC 0A BF ED 7D D5 55 A1 92 E1 36 EF 6B'
'F6 EF AA AA D6 D2 09 26 91 2A 89 04 D4 EA 99 37'
'D6 FD 5B D6 A5 DD B6 19 AA 3F 41 5A 95 7F 5A D7'
'6A 8B 82 25 D8 CB F5 D5 6D BA 55 55 2A AD 52 48'
'22 49 36 69 2B F9 66 CF A9 AB F6 FB 42 B7 6C 22'
'28 F8 14 98 95 7A B7 5A 95 33 D0 89 E0 35 FA BE'
'DF FF EA AA D5 55 88 92 AC 92 40 92 C5 C4 59 BB'
'B9 7F 6D D6 01 DA D0 08 90 FA A0 23 25 F5 60 35'
'6A 47 A1 53 98 CB 6F 01 F9 6A B6 AD 5A AA 32 A5'
'21 24 95 44 19 BA 27 57 54 D6 DB 2C 03 37 A0 3B'
'48 E0 00 18 52 F6 C0 2A D4 AF 08 87 E4 35 FC 00'
'D8 FF E9 52 A6 B5 44 8C 4A 4D 24 29 A3 C4 58 AF'
'78 BD 6F F8 16 FD 40 4C 11 CA 80 BE A1 ED 00 D7'
'45 57 50 2B 98 57 F6 0F BC ED 56 AD 59 6B 91 32'
'A4 90 89 4A 17 94 27 57 A4 55 BB A4 2D B3 40 9E'
'D1 D0 01 59 59 DA 85 BC C4 86 94 4B 74 2B 6C 3B'
'FA 5B E9 5A B6 D6 26 84 92 25 32 A0 A7 6A 18 DE'
'DC 3A EF FC 3B 7E C5 2D 21 C2 0A 1E E5 B5 0B 7B'
'92 2F 20 97 4A 56 F8 37 D6 7E B6 D5 65 6A 48 29'
'21 4A 44 15 2F 95 27 BF 36 6F B7 68 6A F5 40 4E'
'D3 A4 00 BD 1B CB 06 9D 60 DE 48 2F B4 2F EC 6F'
'FE 2B EA AA DA 96 95 62 4A 59 11 45 57 AA 1A 2E'
'EC 1A DF 54 4F BE 82 9D 23 88 12 3A E3 B6 14 FE'
'81 0C 92 27 5B 15 D8 7B AA 3E D5 55 26 F5 21 0C'
'91 02 66 AA 27 55 95 DF 5B 37 77 F4 7A 75 84 AE'
'D3 50 04 5D 43 EC 17 AD 50 5D 24 4F 66 2F BC 5E'
'DE 1D AA AA DA 8D 4A 51 22 68 88 48 9F 2A 0A 5E'
'B6 3D DF EC 2D F2 45 1D 23 42 28 BA A3 4A 2A 6E'
'A0 9C 4A 1E 9D 1B F6 FF F6 37 F5 55 55 7A 99 24'
'94 8B 25 93 4E D5 85 BD 6D 0F 77 B4 57 72 80 AE'
'D3 94 01 3A C3 BC 2D DD 28 3A 99 0D 6D 0F 5F FA'
'AC 3D 4A AA AB A5 22 49 21 20 52 24 5D 2F 4B 5D'
'5F 1E DF EC 7D 7D 05 5D 23 40 2A 5D A3 A2 16 AD'
'40 7C AC 1E D6 96 FD F7 FC 37 F5 6A AC 5B D4 92'
'4A 4D 09 52 9E 52 8D 7B B5 9D F7 58 2A F2 42 AE'
'D3 94 00 BB 43 DE 1B 5C 90 B9 09 1D 25 8D F7 DD'
'58 6D 4A 95 7B EA 09 24 94 91 6A A5 3D B3 42 BE'
'67 0B DF 74 6D BC 85 5D B3 20 12 5E A3 34 34 BF'
'20 3A 4E 1A E7 4B DF FB 70 7B F5 6A C5 2B A2 49'
'21 24 11 2C 9A 63 45 7D C6 87 B7 A8 5B 71 04 DD'
'23 84 05 5A C3 EA 0B 6C 48 72 85 3D 43 4F BF 5F'
'A0 EF 4A 95 BA D6 2C 92 4C 8D A6 A2 3D 91 A2 F5'
'23 CF 7F EC 36 B4 43 3E D3 28 10 5A A3 96 36 DE'
'90 F4 46 BA A2 83 7B EA 81 DA F5 6B 4B 6D 41 24'
'92 50 10 49 7A 61 62 FA E3 46 EF 58 6D 7A 84 CD'
'53 80 22 BF 43 6A 0C AC 40 6A 87 76 C3 66 F7 5C'
'03 BF D2 AC B6 92 14 49 21 25 65 52 B5 81 C1 7B'
'43 C5 BF 34 5A B0 83 3E A1 2A 04 BA C3 DA 3B 5E'
'88 F1 02 7B 43 C5 FD F0 0D 76 AD 5B AD 7D A5 92'
'4C 89 0A 45 72 61 B3 E6 83 A7 FF EC 35 35 04 6E'
'D1 40 29 7D 23 94 14 DD 10 E4 87 B4 85 A3 6E A0'
'3B ED F2 A4 6A C2 28 24 91 32 52 AA 7D 81 C0 FD'
'45 C3 7F 58 5F FA 43 DD 21 88 02 DE E1 F6 2B BC'
'20 D5 0B 5B 03 A1 FB 80 7F BF 45 5B DB 3F 45 49'
'22 44 A4 45 72 42 F1 F2 83 F1 FF 94 77 F0 84 2E'
'C1 92 15 B9 82 D5 2D 7A 41 D2 05 AA 85 F3 77 03'
'FE FD F9 65 14 D2 A9 2A 4C 91 0A 94 F5 81 51 ED'
'05 B3 6D 7C 2F 25 23 DD 50 A0 13 5F 61 AD 1A BC'
'91 ED 0B 55 07 D1 FA 0E BC EB 42 9E FB AD 12 40'
'91 2A A9 53 F2 46 D1 D5 86 E1 FD D0 52 4A 54 3D'
'A1 4A 04 BC 82 DA 13 79 21 92 15 B6 0A D1 EF 0D'
'FA 3F F5 69 45 36 44 95 A2 A4 92 04 C5 85 ED AB'
'0B D8 DA DC 54 98 8B FD 40 00 4B FB 61 35 CD F4'
'43 AC 0B CD 07 F9 7B 9B EE 3D 49 56 BA E9 D9 24'
'16 49 24 B3 DD 01 7B DA 0E F9 FF B4 21 22 44 FA'
'90 AA BF D4 A2 EB 3F E1 3F D3 3F B9 8F D6 F7 7F'
'DC 2B F2 DA D7 56 02 49 40 92 49 45 E2 87 73 D3'
'19 F8 B4 6C 4A 44 83 A5 A0 00 2F AB C1 56 FF 94'
'3F AD 1D 56 9F FE BE DE B6 3F D5 55 AA AD 54 92'
'5D 24 92 AB AD 0C BD AE 17 74 7F D8 52 89 44 5A'
'41 49 55 2C A1 6C 8A A2 39 52 9B 65 5E DB AD B5'
'EA 2E AA B6 B5 52 92 44 81 49 29 27 D2 0B 5B B4'
'1D EC EE B4 24 32 83 B5 82 12 56 DB A2 DB 75 88'
'04 AD 45 9D 63 76 9B 7E BC 3D F5 4A D6 ED 24 92'
'52 52 45 4B A6 0A B5 54 2B 7C 7D AC 49 44 84 AA'
'00 80 2D 1D 21 A4 14 00 13 5A 82 AA C1 DD 8E EB'
'8A 2F CA B6 AA 95 49 24 95 08 94 A7 94 15 7A A8'
'16 FA 5B F8 52 50 83 40 00 2B 40 1A E1 5B 80 00'
'00 00 04 00 02 00 0B 80 00 3D B5 55 55 6A 92 49'
'20 B3 2A AF 4A 1B 5D 54 3B D6 7F 54 24 97 85 58'
'11 40 A8 1B 42 AD 50 01 58 00 02 00 01 00 06 A0'
'0E 3B 55 6A AB AB 24 92 4D 44 55 57 54 0A BD B4'
'6E BE 37 F5 49 50 2A B3 22 17 52 BE A1 D2 A4 92'
'44 B5 56 D5 DB 77 5D F7 5D EF EA 95 74 54 89 24'
'90 91 2A A7 4C 36 CF 50 5B FE 1F EA AA 25 52 AD'
'44 41 6E FD 62 2D AA 28 9B 4A AD AB 76 DD F7 BE'
'FB BA B5 6A AB AB 32 49 23 2A 95 4E A0 0A BE A8'
'36 BD 3F B5 50 CA AA B2 10 8E 91 9A C1 D5 50 83'
'2A B5 59 56 AB BB AE F5 B7 EF EA D6 D4 6C 44 93'
'48 44 6A AF 5C 3D 5D 50 6D DB 17 EC A5 12 4A AD'
'45 11 6F FD A2 55 AA 58 55 55 A7 54 EE F7 7B EF'
'EF 7D 95 A9 35 93 91 48 15 29 95 1D 40 52 FD 60'
'DB 7E 9F B2 59 4C AA B2 10 2E D2 FD 41 B5 41 02'
'AA AA 5A 6F BB AA D7 5B 5E DB 7B 56 DA 6D AA 92'
'B2 4A 52 BE 58 2D 9D 90 B6 DD 97 EC 22 31 45 68'
'82 55 AD D3 A3 4B 54 55 55 55 AD D5 6D 7F BE F6'
'FB F6 D4 AA A4 AA 52 A4 80 B2 AD 7D A0 53 7B 61'
'6D BF 0E 9A 09 46 AA 82 24 AA 56 EE 42 B6 81 12'
'AA AA B2 A5 D7 D6 ED DF AF BD AB 55 59 55 A4 89'
'2D 45 52 BA 50 AE BC 90 B6 FD CB EC 14 A9 4A A5'
'48 55 A9 79 A1 55 2A 45 55 55 4D 5E BD 7D DF 7D'
'FD 67 35 5A A5 55 89 32 49 15 95 FD AC 77 F3 6F'
'DB FF 77 40 25 24 95 48 01 B6 B6 B6 A2 AA 40 9A'
'AB 55 BB AB EB D7 7B F7 57 DC EE A5 5A 56 B2 44'
'92 6A 2B FA 5C CF FD 5F 6F FE D5 D0 0C 92 46 91'
'52 54 D5 69 41 55 15 25 54 AA 55 56 DF 7D D6 AD'
'FD 77 51 5A A5 29 45 11 24 95 55 D5 A2 2E DA AA'
'B7 ED B5 22 52 49 19 22 05 AB 2A 96 A2 A8 40 4A'
'AB 55 AA AD B6 CA BD FB D7 AD AE B5 5A 56 B4 B5'
'4A 22 AA AA 5D 0B 55 5D DC BB 6C DC 89 24 66 88'
'51 54 D5 69 A2 A5 14 95 54 AA 55 5B 6D BF F7 AF'
'BE FA B2 AA AA AA 49 02 11 4C 49 24 A5 16 AA EB'
'0B D6 D8 21 B4 92 8A 50 85 55 AA 96 41 48 41 2A'
'AB 55 B5 56 DB 55 5D FF 7B AB 6E D5 76 95 B2 58'
'AC 51 12 40 00 0A 80 00 0E 80 00 6A 01 24 54 82'
'2B 6B 55 69 A2 92 8A 55 55 5A 6D BD B6 FF F7 BA'
'EF 76 D5 2A 8A AA 04 A5 21 8A A4 90 00 15 00 00'
'05 E0 00 14 AA 4A 96 B4 0A 96 AA 96 42 A4 10 AA'
'AA A5 D3 6B 5D D5 BE F7 DE DD 2A D5 75 45 69 09'
'4A 24 2D 65 AB 6E D5 AF AF 5E D4 69 48 AA A9 80'
'55 6D 55 6D A2 A9 25 56 AD 5A AE DA F7 BF 7B DF'
'FD B2 F5 2A 96 AB 92 56 11 49 D2 14 55 49 2B 7D'
'7A E9 A9 54 95 55 56 68 96 D2 AA AA 52 42 49 29'
'52 AB 35 B7 AD 6D F7 7D 5B 6D 96 D5 6A D4 24 90'
'A2 5A 15 C5 AA B6 EC DB EF BF 2A 2B 22 AA AD 81'
'2D 2D 55 55 AD 28 92 56 AD 54 EB 6D 7B DB EF FB'
'F5 B5 69 2A D5 93 49 25 2C 81 64 2A AA B5 53 BE'
'BD 6A D8 AC AC 55 4A 2A 5A EA AA AA 52 42 24 A9'
'D2 AB AE DB AE BF BE EF DF 6B 56 D6 96 6C 24 4A'
'41 2A 95 45 55 BA AE F7 FB DB 65 13 51 AA BA 80'
'25 55 55 55 AC 94 89 56 2E AD 35 B6 FB F5 6D DE'
'BA D6 AA AD 69 DB 49 98 92 52 2A 95 56 C5 55 BE'
'F6 B6 94 2C AA 6B 52 28 DA AA B2 AA 51 21 24 A9'
'D1 5A ED 6D B6 AF FF BB F7 9A D5 2A 96 52 92 23'
'24 84 C0 35 6D 3A EB 6D AD ED 61 5B 55 AC AD 41'
'2A D5 4D 55 A4 94 49 56 AE EB 5B DB 6D FD DA FE'
'AD 75 36 D5 6D EE 34 88 49 2A 2B 42 92 C5 96 FF'
'FB 5A 8A 14 AA 53 54 0A 55 AA B1 56 4A 42 92 D5'
'51 9A B6 B6 DB BB 7F D7 FB 4A C9 5A A9 55 41 35'
'13 48 94 95 6E BB 6D DA B6 B6 B5 2B 55 AC B5 50'
'AB 55 46 AC 91 28 25 2A AF 66 ED ED 77 77 D7 7D'
'AE B5 B6 A5 57 DA 96 41 60 15 52 25 51 56 9B BF'
'ED ED 44 14 EA 53 54 04 5A AA A9 59 24 82 92 D5'
'52 5D 5B 5B DE EE FE FF 79 6B 4D 5A AA B3 50 AA'
'0D 69 24 94 AE A5 76 FB BB 5A 39 57 95 AC AA A8'
'ED 55 4A A2 4A 24 45 2D 2D A9 D6 D6 BB DD DD EB'
'D7 56 B2 A5 55 AE A5 09 51 02 49 63 D2 DA AD EF'
'6A D5 82 09 6A 53 58 01 93 6A 92 A8 91 49 1A DA'
'F5 57 3D BD F7 7F B7 DF 74 AD 4D 5A D7 75 54 52'
'42 55 2A 08 2D 35 5B BE DF BA 34 9E 95 AC D1 29'
'6D 52 A4 93 4A 22 A5 55 2A BA E7 6B 6E F5 FF BE'
'CB 72 B5 65 2D DB 69 A4 94 92 48 D5 D2 CA B6 FB'
'B5 65 4A 23 7A B3 2A 42 9A A5 0A A4 24 8A 4A AA'
'D3 55 BE DE DD EF DD 7B B6 CD 4A 8A DB 2E 94 09'
'29 24 93 22 2D B5 6B F7 6B 5A A8 8C A5 4C E0 89'
'6A AA B2 12 D1 24 95 55 6E D7 6D B5 BB DF BB F6'
'CD 32 B5 6B 56 F5 6A B2 42 49 24 4A D5 4A DF AE'
'DE E5 55 13 5A B3 0A 12 D5 A4 84 A4 04 51 2D 56'
'95 3A DB 6E EF BD 77 EF BA ED 4A 94 AD AD 55 44'
'90 92 4A 91 2A B5 B7 7D B5 9B 28 2A EB 4D 60 4D'
'AA 29 29 29 AA 8A 52 D9 6A D7 56 DB BB 7B EF 5B'
'55 53 5A AB 57 5B AA 91 2D 44 92 56 D5 4D 2E FB'
'6F 75 55 45 54 B5 04 91 55 D2 52 42 20 22 AD 26'
'D5 6C FD B6 EE F7 FE FE AA AC A5 56 BC F6 AA A6'
'41 29 4A A1 2A B2 F5 EF 5A AA 2A 12 AB 6A 49 2E'
'AA 24 84 94 8A 95 52 DA AD 9B 97 6D BB EF 5D EB'
'55 D3 52 55 6B AD 55 48 92 4A 24 4A AA AD 9F DA'
'F5 D4 D4 A5 D6 94 90 51 55 49 29 25 21 2A AD B5'
'53 76 FA D7 6F DE FB BE AB 2C 95 AA AD 6B BB 55'
'24 90 C9 52 55 73 7B BF 5F 2B 2A 0A 2D 75 22 AE'
'A4 92 4A 48 4C 55 55 26 AE AD AF BD DE BD EF 6D'
'56 D3 2B 56 DB 5D 64 B2 49 25 12 45 AA 8E B7 7A'
'EA D8 A8 A1 DA 94 84 51 49 24 90 92 A2 AA DA DA'
'B5 5B 75 6B 7D FB BD FA AD 2C AA AD B6 EB DB 4D'
'52 49 65 2A 55 68 EF F7 BB 52 2A 0A B5 6A 49 AA'
'95 49 25 24 09 55 25 B5 6A F6 AE DD D7 F7 F7 D5'
'5A D2 55 55 6D B6 A6 B5 40 92 08 49 AA B7 5D 6D'
'6E A4 D4 91 4A A9 10 55 21 24 49 49 56 AA DA 4A'
'AB 4D 7B B7 7F 5F 5F BA B5 55 AD 6D B7 6D 5D 4A'
'AD 24 A3 4A 95 59 6B FF DA A9 29 24 B5 54 41 15'
'4A 49 92 22 4D 55 15 B5 5D 7B D6 ED FE FA FA E5'
'55 94 52 9B 6C CB B2 BD 4A 49 4C 15 2A A6 BF ED'
'6D 92 55 49 55 52 92 69 14 92 24 88 BA AA EA AB'
'6A AD 7D BB ED EF EF D5 6A 2B AD F6 DB BE 6D 52'
'B0 D2 11 69 55 59 EF 5F DA 24 A8 12 AA D4 40 96'
'B1 24 89 22 A5 55 15 54 D5 EB D7 57 5B BF BF AA'
'95 54 6A 9D B6 D5 D5 AD 4E 08 A5 04 AA B6 9A FD'
'74 C9 5A A4 57 55 12 2A 46 49 34 89 5A AA AA AB'
'AB 3E BA FE FF FD 7A A5 6A AB D5 73 6D 6A 56 B3'
'B0 A5 88 51 55 45 77 FB A9 12 A4 91 2C A8 40 54'
'90 92 42 23 6B 55 55 55 36 E5 EF AD F7 6B F7 AA'
'D5 54 95 AE B5 DD AA AE 4D 52 35 A6 AA BA DF D6'
'F2 44 B9 24 AB 52 88 95 25 24 94 8A 54 AD 35 6A'
'EB 5F 55 7B AE FF DF 55 AA 5B 6E B5 DB 2A 5D 69'
'B2 08 82 09 45 4A AA BF A4 99 44 A9 15 54 11 55'
'4C 49 29 25 AB 52 CA 97 56 EA FF D7 7F EE BC AB'
'55 A5 55 6F 6D F5 6A D6 6D 55 28 B5 2A B5 BF FE'
'D1 22 B9 42 4E A1 20 08 91 92 42 4A 76 AD 35 6A'
'AD BF 55 BE DD DD FB AA AA 5A AD DA B7 4A D5 AD'
'D2 A1 4A 82 55 4B 57 F5 64 49 52 94 95 5A 42 53'
'24 24 94 95 C9 55 4A DA D7 6D FF 6D BB BF EE B5'
'55 2A DA B6 EC B5 5B 5A AA 8A 11 2C AA B4 BE AF'
'A8 92 A9 29 2A A0 84 94 49 49 2A 2A B6 AA B6 A3'
'5C DB 55 DA FF 7B BD 4A AA 56 B5 AD AB D6 AA 55'
'55 54 AA 41 55 4B 6D FE C1 25 72 52 65 4A 28 21'
'12 22 61 5B 4D 55 49 5E B3 B5 FE B7 DB F7 7A B5'
'54 A9 4B 76 DD 54 B5 B5 DB 51 25 1A AA 96 DB F5'
'92 4A AA A4 8A D0 80 8A 66 CD 0A 26 BA AA 36 A9'
'6E DF 5B ED B6 EE D5 4A A9 56 B6 CD B6 A9 CA 66'
'24 A6 48 A1 55 65 37 AF 24 12 D2 99 55 45 11 12'
'88 10 54 DA D5 6A C9 56 D5 72 F6 BB 6F DF F5 B6'
'AA 35 6D BB 69 AA 35 DD DB 50 92 16 A4 9A EF 7A'
'88 A5 29 22 15 10 22 24 52 A5 A1 2A AA A5 2A AB'
'5B DF AD D6 BD 7A AE A9 54 CA DB 6E DF 54 D6 AA'
'AD 55 25 69 5B 65 5A EF 21 0A F2 48 AA 45 40 49'
'24 94 0A DB 55 4D 55 54 B6 B5 7B 6B EB F7 D5 56'
'B1 35 B6 D5 B4 A9 6D 55 52 AA 48 02 44 9A B7 DA'
'4A 25 44 93 2A 88 05 12 89 21 55 B5 5B 5A AA AB'
'6D EF AE BE BF EF 7A E9 46 4E ED BD 6B 52 AA DA'
'BB 54 92 D4 95 45 6D B6 A0 4A B1 24 56 11 10 24'
'52 4A 49 56 E4 B5 55 AD DB BA FD D3 EA DE CB 16'
'B8 B5 9B 6B D5 54 55 35 D6 BB 25 2A AA B5 5B 6C'
'89 11 46 4A EC A2 24 AA 94 94 96 A9 1B AA AA 5A'
'B7 6F AB 7E BF BD B6 E9 42 4B 76 D6 AE A1 6A E6'
'AD 64 CA D5 55 35 77 DB 22 45 A8 B5 15 04 41 00'
'42 21 29 B7 F5 55 55 D5 AE D5 7E AB F6 EB 6D 56'
'94 BE DB 7D B5 4A 55 9D 52 DB 35 2A AA AA AD 74'
'88 0A D5 4A EC 50 88 2A 98 CA 57 6A 46 AA AA 57'
'7D BF D5 F6 AD 7E D2 A9 A5 55 B6 CA 6A A2 D5 69'
'BD A6 D6 D5 55 55 7F DA 21 51 42 B5 1A 02 11 42'
'23 12 AA AD BD 5B 55 AA DB 55 7F 5D DB EB AF 56'
'48 AB 6D BB D5 2C 2B 57 57 5D A8 95 4A A5 AB 74'
'8A 05 D5 4A F4 A4 42 14 C8 45 55 52 C9 A4 B5 5E'
'B6 FF D5 F7 76 BE B5 69 92 BE DB 56 AA C2 D6 DA'
'B4 6A 37 6A B5 5A 5F A9 20 AA A2 B5 28 08 84 22'
'15 9A B6 EF 36 5B 4A A9 ED 55 BE AA DD EB 6A 96'
'25 6B B6 F5 55 15 6D 55 63 D5 E9 55 4A A5 B6 F4'
'4A 01 C9 56 D2 A1 10 48 A4 25 4D 54 D5 B6 BB 57'
'5B FF 75 EF B7 BE CD 69 4A DA 6D AD AA AA 92 AA'
'DD 2B 56 AA B5 55 4F D1 10 AB B4 A9 54 04 24 8B'
'49 5A BA AB 6D 65 44 AA EE AA EF 5A ED 75 B5 96'
'15 B7 DB 55 55 55 6D 5D A2 D6 AA D5 4A AA B6 A4'
'4A 01 41 56 A9 48 81 10 13 25 55 DD 92 9A BB 6F'
'BB FF DA EF B7 E6 56 68 AB 6D 76 5A AA 85 D5 63'
'5D 6D 55 5A B6 A5 2D EA A0 AA D5 29 42 11 14 25'
'54 5A AA AA 6D 6A CA A9 6E B5 B5 BB 5D 5D D9 95'
'12 DB 4D EB 55 5A AA DE 6D A9 BA A5 6A D2 CB 58'
'0A 01 AB 56 99 42 21 49 2A A6 B3 55 D5 AB 35 5F'
'DD EF 5F 6E F7 EA 97 6A 2D B5 FA 54 AA A5 56 A9'
'D3 57 55 DA D5 2D 35 E2 A0 AA C4 A9 64 08 44 12'
'52 59 4E D6 9B 4C D6 B2 BA BA F5 DD 6E B5 74 A8'
'53 6F 2B AA AA 95 AD 56 95 6C B6 AA AA D2 D7 54'
'0A 01 AB 64 D1 51 09 45 14 A6 B5 2D 6A BB A9 6F'
'F7 D7 AF 7B DD 55 AB 22 AE DA EC D5 55 AA B2 D9'
'7A D3 65 55 56 AD 2A D1 50 96 CA 49 8A 02 50 08'
'A5 59 6A D9 55 54 56 DB AD 7A FA D5 7B EE 56 D4'
'55 B5 AB 29 6A 56 4D 37 A5 AD 5D 5B A9 4A D5 AA'
'02 21 95 92 20 54 02 B2 2A A7 55 56 D5 AB AA B7'
'7B EF AF BF EE B5 D5 21 2B 6F 55 D2 95 AD B2 C9'
'5A 56 D2 EA 76 B5 56 58 54 85 6A 49 44 81 54 84'
'AA 58 AA B5 AA B5 6D DE FF DD 7B 6A DD AA 2A 4A'
'56 DA AE 29 6A A9 6D B7 6D E9 6D 55 8D CA A9 A2'
'80 09 97 22 29 2A 00 29 55 A7 56 CA 57 4A 9B 6D'
'EE BB D6 BF BB 6D DA 91 5B AD 59 D3 5B 56 93 5A'
'52 96 9B DB 79 3D 56 A8 29 52 E8 56 82 40 A9 55'
'2A 5A B5 35 AC BB 76 BB DD EF 7E F5 76 AA 35 24'
'B6 FB B6 04 A4 AA 6C A5 DF 6D 6A 2A A6 D2 AD 52'
'82 05 AA 80 28 A9 02 28 55 A4 AA EA DB 56 AD D7'
'BB BE AD AF ED 5B EA 4D 2D 95 54 AB 5B 55 53 5A'
'95 6D DB 4D 5B 57 9A AA 22 0A D2 24 A0 81 48 57'
'95 2D 4A D6 9B 57 76 DF F7 BB 5F 7F B6 EA 55 24'
'15 A9 32 65 35 5A AE B7 76 D6 AD B9 6A A8 65 51'
'44 51 54 89 0A 14 12 AC 32 AA B5 A9 75 6C AD BB'
'6F 7F FA D5 6D 55 B4 49 FF 76 C4 8A C9 A5 51 64'
'AA A9 53 66 D6 D7 DE A4 08 84 E5 20 21 21 44 5B'
'4A 52 AB 56 AA AB DB 57 FE EB 6F BF DA AB 4A AA'
'2A AD 29 55 37 5A AE 9B 55 56 AE 99 95 2A 29 4A'
'A1 11 C8 05 44 4A 11 6E A5 AD 4A AD 52 DA 36 FE'
'ED DF FA EC B5 D6 B5 11 D6 EA E2 4A EA AB D1 6A'
'AD AA D9 77 7A F5 D6 91 04 22 B5 50 2A 90 A4 DA'
'9A 12 B5 59 6F A7 ED B7 DF BF 57 5B DB 2D 48 44'
'3D 95 0C 95 15 54 2F 56 DA 56 A6 AA A7 46 3A A4'
'48 85 C0 04 80 25 09 B5 42 ED 4B 56 D4 5D 5B 6D'
'BA FA FD FE B6 DA B5 A9 EB 6A A1 2A EA AB D2 D5'
'55 AD 5D D5 5A BD E5 49 11 10 AA A1 52 88 53 6B'
'A9 12 B5 69 AB B6 B2 DF FF F7 DF 55 ED 35 64 0A'
'B6 AD 14 95 55 56 AC 9A AA 5A AA AB 6A CA 5A 92'
'42 23 C0 04 04 22 84 D6 44 AD 4B 57 5D 6B AF 7B'
'77 AF 7A FD 5A EA 89 51 6D 59 65 2A 95 54 53 65'
'55 F5 55 5C D6 B5 AE A4 94 44 95 09 51 48 2B AD'
'AA 92 B6 AA 6B 4D 75 B7 EE FE F7 57 B3 55 72 4A'
'CA B2 08 55 6A EB AE DA DB 0A BB 6B AD D6 D1 49'
'40 89 C0 22 02 22 84 B5 49 2D 55 55 D4 76 AE EE'
'DD BD ED FA EE AA 84 91 BB 64 A2 AA AD 16 51 25'
'A4 F5 64 D5 59 2D 3E 93 15 11 0A 48 A4 84 1B DB'
'52 52 AA AE 97 DD D9 BF FF EB BF 6F 54 D4 AA 4B'
'54 C9 4C 95 52 ED 6E DB 5B 2A DB AA B6 DA E2 A4'
'40 22 D0 02 09 29 26 2A A4 8D 56 D9 6C B3 6F 7D'
'BB 7F 75 DA DB 55 A1 2A AB 92 11 35 6D 12 92 AA'
'A6 D5 95 56 A9 B5 9D 49 2A 85 02 50 52 42 49 D6'
'A9 32 55 56 DB 6E B5 EB F7 DB EF 77 AA AA 0A 4A'
'AD 24 A4 C2 92 ED 6D 55 5A AB 6A B9 D7 56 6A 92'
'80 10 A4 02 85 14 96 BA D2 4D AA A9 A5 55 DB 5F'
'BE FF 7A DD 55 49 52 9D 5A 49 4A 15 6D 12 55 AA'
'B5 5A AD 67 3A AD D5 54 54 45 08 A4 10 22 2D 55'
'A8 B2 5B 57 5E EE AE FF 77 AA EF B6 AA B2 54 35'
'54 92 24 AA 92 AD AA 56 A5 55 52 DA D5 6A 9A A2'
'80 90 52 00 A5 48 91 AA A5 8D A4 AD 69 5B 7B B5'
'ED FF DA ED D5 44 81 6A A9 24 89 55 6D 5A D5 A9'
'5A AA AD 55 B5 95 75 49 29 02 80 02 08 15 2F 6A'
'A8 22 5B 5A 96 AC D2 EF BF AD B7 BA 8A A9 2A AD'
'52 49 52 95 55 53 2A 56 A5 75 55 B6 AB 7D A5 54'
'42 28 14 54 51 20 52 95 B5 5D B6 B5 7B 77 AF BF'
'7B 7B 6D 6B 55 22 49 5A AC 92 14 2B AA AC D5 A9'
'5A 8A AA 55 6A A3 5A 92 88 41 20 80 82 4A AD 6B'
'61 25 25 65 94 AD 5B 7A F7 EF FF DE AA 89 12 B5'
'51 24 A2 D4 55 53 55 57 6B 75 55 EA D7 5E A6 A4'
'52 92 40 01 14 92 55 56 BA 5A DA 9B 6B DB B6 F7'
'EF 7A BA B5 55 24 69 55 24 49 49 2B AA A6 AA A8'
'94 AA AD 17 AC B5 59 49 80 00 85 14 21 24 AA AD'
'6A AA AB 76 AD 36 6D EF DE EF F7 ED 52 49 82 BB'
'59 93 12 54 AA AD 55 57 6B 55 5A EC 5B 6A B7 54'
'55 55 08 20 8A 49 55 69 54 55 56 A5 5A ED DB DE'
'BB DE AE DA AC 94 2A A4 42 24 66 AB 55 5A AB 59'
'54 A5 55 5B B4 DD 69 51 00 00 10 81 10 92 AA D6'
'ED 6A AD 5D 75 9B 6F BD FF 75 FD AA A1 21 49 7A'
'95 49 09 6A AD 55 54 A6 AB 5A AA A5 6B AA D6 AA'
'52 52 21 04 25 25 55 A9 99 15 B2 EA C6 76 DB 7B'
'EA FF 5B 5A AA 8A 92 A5 28 12 AA 95 52 AA D7 5A'
'D4 B5 55 5E B5 55 A9 54 C4 84 84 09 49 4A AB 57'
'6E 6A 6D 95 BD DD B6 EF 5F ED F6 F5 58 22 25 5A'
'42 B5 55 76 AD 55 A8 B5 2B 6A AA E9 EE B5 57 55'
'11 20 20 10 12 15 56 AA BA 95 D6 6B 52 53 6B FB'
'FD DB 5D AA C2 8C 8A EA 99 4A A5 89 55 5A 57 6A'
'D5 55 55 57 5A AB 59 54 44 45 01 25 44 AA AD 6D'
'55 76 99 DE AD BE DD DF 6B 7F F7 6D 14 51 35 50'
'42 B5 5A 76 AA A5 A9 55 36 AA AA AA D5 D6 B6 D5'
'91 08 44 00 11 25 5A 95 AE 89 77 28 B6 6B B7 B7'
'FF D6 DC D2 D1 04 45 55 15 4A A5 95 55 5B 56 AA'
'E9 55 56 DD BB 2D 6B 2A 24 51 08 2A A4 4A B5 6A'
'B5 76 CA D7 69 DA 6D 7E AE FD AB AD 04 52 D5 69'
'6A B5 5B 6A B6 AA AA D5 56 D6 AA A2 D6 FA D4 D4'
'89 04 00 80 09 95 2A AB 65 8D B5 5A D6 A7 DB ED'
'FD 57 7E D5 51 04 0A C2 15 4A A4 95 55 55 55 2A'
'AA 99 55 5F AD 8B 5B 55 22 10 21 2A A2 2A D5 56'
'9E 77 56 B5 2D 5D 76 FF FB FD D5 2A 82 29 AA 95'
'6A B5 5B 6A AA B5 AA D5 55 66 AA A5 5B 7A AA AA'
'48 40 44 00 09 55 56 ED 71 DD 6D 6A F5 AA AD DB'
'AE AA BA D4 24 4A 2A A4 95 4A AA 96 D5 4A 55 AA'
'AA 9A B5 5A B6 A6 D5 54 92 84 80 55 52 55 B9 2A'
'AF 57 5A D5 8A B5 EB BF 7D FF EF 55 4A 91 4A 89'
'6A B5 55 6D 2D B5 56 55 6A B5 4A A5 CD 5D 56 AB'
'44 08 04 80 04 AB 46 D5 52 BA F5 AB 7B 4B 5F 7B'
'DA AB 5A AA 10 24 2A B2 95 4A B7 5A DA 4B A9 AA'
'D5 6A B5 5B 7B B9 AD 52 11 20 89 15 29 5A BD AA'
'ED 6F AB 54 A6 B6 B6 F7 7F FE F5 55 45 49 55 04'
'6A B5 A8 A5 55 B6 56 AD AA D5 6A AA 95 67 5A AD'
'A4 09 10 20 42 A5 51 56 95 59 7E AF 59 55 6D EE'
'FB AB A6 A8 28 12 55 52 95 4B 57 5A AA AD'
END
OBJECT BITMAP
BEGIN
'42 4D 26 05 00 00 00 00 00 00 76 00 00 00 28 00'
'00 00 28 00 00 00 3C 00 00 00 01 00 04 00 00 00'
'00 00 B0 04 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 BF 00 00 BF'
'00 00 00 BF BF 00 BF 00 00 00 BF 00 BF 00 BF BF'
'00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
'00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 0B BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB B0 0B BB BB BB BB 00 00 BB BB BB BB BB BB BB'
'BB BB BB BB BB B0 0B BB BB BB B0 00 00 0B BB BB'
'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB 00 00'
'00 00 BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'
'BB B0 00 00 00 00 0B BB BB BB BB BB BB BB BB BB'
'BB B0 0B BB BB B0 00 00 00 00 0B BB BB BB BB BB'
'BB BB BB BB BB B0 0B BB BB B0 00 00 00 00 0B BB'
'BB BB BB BB BB BB BB BB BB B0 0B BB BB B0 00 00'
'00 00 0B BB BB BB BB BB BB BB BB BB BB B0 0B BB'
'BB BB 00 00 00 00 BB BB BB BB BB BB BB BB BB BB'
'BB B0 0B BB BB BB B0 00 00 0B BB BB BB BB BB BB'
'BB BB BB BB BB B0 0B BB BB BB BB 00 00 BB BB BB'
'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'
'BB BB BB 00 00 BB BB BB BB BB BB BB BB B0 0B BB'
'BB BB BB BB BB BB B0 00 00 0B BB BB BB BB BB BB'
'BB B0 0B BB BB BB BB BB BB BB 00 00 00 00 BB BB'
'BB BB BB BB BB B0 0B BB BB BB BB BB BB B0 00 00'
'00 00 0B BB BB BB BB BB BB B0 0B BB BB BB BB BB'
'BB B0 00 00 00 00 0B BB BB BB BB BB BB B0 0B BB'
'BB BB BB BB BB B0 00 00 00 00 0B BB BB BB BB BB'
'BB B0 0B BB BB BB BB BB BB B0 00 00 00 00 0B BB'
'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB 00 00'
'00 00 BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'
'BB BB B0 00 00 0B BB BB BB BB BB BB BB B0 0B BB'
'BB BB BB BB BB BB BB 00 00 BB BB BB BB BB BB BB'
'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB 00'
'00 BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'
'BB BB B0 00 00 0B BB BB BB B0 0B BB BB BB BB BB'
'BB BB BB BB BB BB 00 00 00 00 BB BB BB B0 0B BB'
'BB BB BB BB BB BB BB BB BB B0 00 00 00 00 0B BB'
'BB B0 0B BB BB BB BB BB BB BB BB BB BB B0 00 00'
'00 00 0B BB BB B0 0B BB BB BB BB BB BB BB BB BB'
'BB B0 00 00 00 00 0B BB BB B0 0B BB BB BB BB BB'
'BB BB BB BB BB B0 00 00 00 00 0B BB BB B0 0B BB'
'BB BB BB BB BB BB BB BB BB BB 00 00 00 00 BB BB'
'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB B0 00'
'00 0B BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'
'BB BB BB 00 00 BB BB BB BB B0 0B BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB B0 0B BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB BB BB BB BB B0 0B BB BB BB BB BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB B0 0B BB BB BB BB BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB B0 0B BB'
'BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB'
'BB B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00'
END
MAIN MENU
BEGIN
MENUITEM "&About...", 102
MENUITEM "Draw Image", 101
END
ABOUT DIALOG 41, 33, 146, 132
STYLE DS_LOCALEDIT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "Helv"
BEGIN
CONTROL "Bitmap Dragging Sample", -1, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE, 0, 6, 144, 8
CONTROL "Purpose: Demonstrates smooth bitmap dragging. Select ""Draw Image"" to draw the domino, then drag it around using the mouse.", 103, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 19, 136, 42
CONTROL "Written by: Michael Vincze", 101, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 65, 146, 9
CONTROL "Adapted from: Patrick Schreier of", -1, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE, 2, 75, 144, 8
CONTROL "Microsoft Windows Developer Support", -1, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE, 2, 85, 144, 8
CONTROL "Copyright \251 1993 Vincze International", 102, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 95, 146, 8
CONTROL "Portions Copyright \251 1992 Microsoft Corp.", 102, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 0, 105, 146, 8
CONTROL "OK", 1, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 57, 115, 32, 14
END
APPLICATION ICON
BEGIN
'00 00 01 00 01 00 20 20 10 00 00 00 00 00 E8 02'
'00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
'00 00 01 00 04 00 00 00 00 00 00 02 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 BF 00 00 BF 00 00 00 BF BF 00 BF 00'
'00 00 BF 00 BF 00 BF BF 00 00 C0 C0 C0 00 80 80'
'80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00'
'00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'BB BB BB BB BB BB BB BB BB BB 00 00 00 00 00 00'
'BB 30 00 0B BB BB BB BB BB BB 03 00 00 00 00 00'
'B3 00 00 00 BB BB BB BB BB BB 03 30 00 00 00 00'
'B3 00 00 00 BB BB BB BB BB BB 03 33 00 00 00 00'
'B3 00 00 00 BB BB BB BB BB BB 03 33 00 00 00 00'
'B3 00 00 00 BB BB BB BB BB BB 03 33 00 00 00 00'
'BB 30 00 03 BB BB BB BB BB BB 03 33 00 00 00 00'
'BB B3 33 3B BB BB BB BB BB BB 03 33 00 00 00 00'
'BB BB BB BB BB BB BB BB BB BB 03 33 00 00 00 00'
'BB BB BB BB BB BB BB BB BB BB 03 33 00 00 00 00'
'BB BB BB B3 00 00 BB BB BB BB 03 33 00 00 00 00'
'BB BB BB 30 00 00 0B BB BB BB 03 33 00 00 00 00'
'BB BB BB 30 00 00 0B BB BB BB 03 33 00 00 00 00'
'BB BB BB 30 00 00 0B BB BB BB 03 33 00 00 00 00'
'BB BB BB 30 00 00 0B BB BB BB 03 33 00 00 00 00'
'BB BB BB B3 00 00 3B BB BB BB 03 33 00 00 00 00'
'BB BB BB BB 33 33 BB BB BB BB 03 33 00 00 00 00'
'BB BB BB BB BB BB BB BB BB BB 03 33 00 00 00 00'
'BB BB BB BB BB BB BB BB BB BB 03 33 00 00 00 00'
'BB BB BB BB BB BB 30 00 0B BB 03 33 00 00 00 00'
'BB BB BB BB BB B3 00 00 00 BB 03 33 00 00 00 00'
'BB BB BB BB BB B3 00 00 00 BB 03 33 00 00 00 00'
'BB BB BB BB BB B3 00 00 00 BB 03 33 00 00 00 00'
'BB BB BB BB BB B3 00 00 00 BB 03 33 00 00 00 00'
'BB BB BB BB BB BB 30 00 03 BB 03 33 00 00 00 00'
'BB BB BB BB BB BB B3 33 3B BB 03 33 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 03 33 00 00 00 00'
'0B BB BB BB BB | 42.837349 | 219 | 0.557821 |
477c5c5455fe8951d5b3b7690bd000407813bbe8 | 26,825 | pas | Pascal | source/unit_mod_project.pas | uniho/BeBop | 611d6e40286df72941eb39879da88c35d2b74ce0 | [
"MIT"
]
| 5 | 2021-12-08T08:33:37.000Z | 2022-01-29T15:17:43.000Z | source/unit_mod_project.pas | uniho/BeBop | 611d6e40286df72941eb39879da88c35d2b74ce0 | [
"MIT"
]
| null | null | null | source/unit_mod_project.pas | uniho/BeBop | 611d6e40286df72941eb39879da88c35d2b74ce0 | [
"MIT"
]
| null | null | null | unit unit_mod_project;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, unit_js,
uCEFTypes, uCEFInterfaces;
function CreateRequest(const fileName: string): ICefRequest;
implementation
uses
Forms, unit1, LazFileUtils, unit_global, unit_thread,
uCEFConstants, uCEFv8Context, uCEFv8Value,
uCEFv8Accessor, uCEFRequest, uCEFPostData, uCEFPostDataElement, uCEFValue;
const
MODULE_NAME = PROJECT_NAME; //////////
type
{ TV8AccessorScreen }
TV8AccessorScreen = class(TCefV8AccessorOwn)
protected
function Get(const name: ustring; const object_: ICefv8Value; var retval : ICefv8Value; var exception: ustring): Boolean; override;
function Set_(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): Boolean; override;
end;
{ TV8AccessorMainform }
TV8AccessorMainform = class(TCefV8AccessorOwn)
protected
function Get(const name: ustring; const object_: ICefv8Value; var retval : ICefv8Value; var exception: ustring): Boolean; override;
function Set_(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): Boolean; override;
end;
{ TRequireThread }
TRequireThread = class(TPromiseThread)
protected
procedure ExecuteAct; override;
public
end;
//
function requireCreate(const name: ustring; const obj: ICefv8Value;
const arguments: TCefv8ValueArray; var retval: ICefv8Value;
var exception: ustring): Boolean;
var
v1, v2, g, gvar: ICefv8Value;
handler: ICefv8Handler;
acr: ICefV8Accessor;
begin
Result:= False;
g:= TCefv8ContextRef.Current.GetGlobal;
gvar:= g.GetValueByKey(G_VAR_IN_JS_NAME);
if not gvar.HasValueByKey(PROJECT_NAME) then begin
v2:= TCefv8ValueRef.NewObject(nil, nil);
handler:= TV8HandlerSafe.Create(UTF8Encode(name), 'app.showMessage');
v1:= TCefv8ValueRef.NewObject(nil, nil);
v1.SetValueByKey('showMessage',
TCefv8ValueRef.NewFunction('showMessage', handler), V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(UTF8Encode(name), 'app.terminate');
v1.SetValueByKey('terminate',
TCefv8ValueRef.NewFunction('terminate', handler), V8_PROPERTY_ATTRIBUTE_NONE);
v2.SetValueByKey('app', v1, V8_PROPERTY_ATTRIBUTE_NONE);
acr:= TV8AccessorScreen.Create;
v1:= TCefv8ValueRef.NewObject(acr, nil);
v1.SetValueByAccessor('workAreaWidth', V8_ACCESS_CONTROL_DEFAULT, V8_PROPERTY_ATTRIBUTE_NONE);
v1.SetValueByAccessor('workAreaHeight', V8_ACCESS_CONTROL_DEFAULT, V8_PROPERTY_ATTRIBUTE_NONE);
v2.SetValueByKey('screen', v1, V8_PROPERTY_ATTRIBUTE_NONE);
acr:= TV8AccessorMainform.Create;
v1:= TCefv8ValueRef.NewObject(acr, nil);
v1.SetValueByAccessor('left', V8_ACCESS_CONTROL_DEFAULT, V8_PROPERTY_ATTRIBUTE_NONE);
v1.SetValueByAccessor('top', V8_ACCESS_CONTROL_DEFAULT, V8_PROPERTY_ATTRIBUTE_NONE);
v1.SetValueByAccessor('width', V8_ACCESS_CONTROL_DEFAULT, V8_PROPERTY_ATTRIBUTE_NONE);
v1.SetValueByAccessor('height', V8_ACCESS_CONTROL_DEFAULT, V8_PROPERTY_ATTRIBUTE_NONE);
v1.SetValueByAccessor('caption', V8_ACCESS_CONTROL_DEFAULT, V8_PROPERTY_ATTRIBUTE_NONE);
v1.SetValueByAccessor('visible', V8_ACCESS_CONTROL_DEFAULT, V8_PROPERTY_ATTRIBUTE_NONE);
v1.SetValueByAccessor('set', V8_ACCESS_CONTROL_DEFAULT, V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(UTF8Encode(name), 'mainform.show');
v1.SetValueByKey('show',
TCefv8ValueRef.NewFunction('show', handler), V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(UTF8Encode(name), 'mainform.hide');
v1.SetValueByKey('hide',
TCefv8ValueRef.NewFunction('hide', handler), V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(UTF8Encode(name), 'mainform.close');
v1.SetValueByKey('close',
TCefv8ValueRef.NewFunction('close', handler), V8_PROPERTY_ATTRIBUTE_NONE);
v2.SetValueByKey('mainform', v1, V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(UTF8Encode(name), 'browser.reload');
v1:= TCefv8ValueRef.NewObject(nil, nil);
v1.SetValueByKey('reload',
TCefv8ValueRef.NewFunction('reload', handler), V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(UTF8Encode(name), 'browser.showDevTools');
v1.SetValueByKey('showDevTools',
TCefv8ValueRef.NewFunction('showDevTools', handler), V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(UTF8Encode(name), 'browser.loadURL');
v1.SetValueByKey('loadURL',
TCefv8ValueRef.NewFunction('loadURL', handler), V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(UTF8Encode(name), 'browser.goBack');
v1.SetValueByKey('goBack',
TCefv8ValueRef.NewFunction('goBack', handler), V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(UTF8Encode(name), 'browser.goForward');
v1.SetValueByKey('goForward',
TCefv8ValueRef.NewFunction('goForward', handler), V8_PROPERTY_ATTRIBUTE_NONE);
v2.SetValueByKey('browser', v1, V8_PROPERTY_ATTRIBUTE_NONE);
gvar.SetValueByKey(PROJECT_NAME, v2, V8_PROPERTY_ATTRIBUTE_NONE);
end;
retval:= gvar.GetValueByKey(PROJECT_NAME);
Result:= True;
end;
//
function requireExecute(const name: ustring; const obj: ICefv8Value;
const arguments: TCefv8ValueArray; var retval: ICefv8Value;
var exception: ustring): Boolean;
var
v1, g: ICefv8Value;
uuid: string;
begin
// (resolve, reject) => {...}
Result:= requireCreate(name, obj, arguments, retval, exception);
if not Result or (exception <> '') then Exit;
uuid:= StartPromiseThread(TRequireThread,
[], arguments[0], arguments[1], MODULE_NAME, 'require');
g:= TCefv8ContextRef.Current.GetGlobal;
v1:= g.GetValueByKey(G_VAR_IN_JS_NAME).GetValueByKey('_ipc').GetValueByKey(UTF8Decode(uuid));
v1.SetValueByKey('resolve_args', retval, V8_PROPERTY_ATTRIBUTE_NONE);
retval:= TCefv8ValueRef.NewNull;
Result:= True;
end;
{ TRequireThread }
procedure TRequireThread.ExecuteAct;
begin
// Nothing to do
CefResolve:= TCefValueRef.New;
end;
type
{ TV8HandlerCallback }
TV8HandlerCallback = class(TV8HandlerSafe)
protected
function Execute(const name: ustring; const obj: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; override;
end;
{ TAppShowMessageThread }
TAppShowMessageThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TAppTerminateThread }
TAppTerminateThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TBrowserReloadThread }
TBrowserReloadThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TBrowsershowDevToolsThread }
TBrowsershowDevToolsThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TBrowserLoadURLThread }
TBrowserLoadURLThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TBrowserGoBackThread }
TBrowserGoBackThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TBrowserGoForwardThread }
TBrowserGoForwardThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TScreenGetWorkAreaWidthThread }
TScreenGetWorkAreaWidthThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TScreenGetWorkAreaHeightThread }
TScreenGetWorkAreaHeightThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformGetLeftThread }
TMainformGetLeftThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformGetTopThread }
TMainformGetTopThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformGetWidthThread }
TMainformGetWidthThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformGetHeightThread }
TMainformGetHeightThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformGetCaptionThread }
TMainformGetCaptionThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformGetVisibleThread }
TMainformGetVisibleThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformSetLeftThread }
TMainformSetLeftThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformSetTopThread }
TMainformSetTopThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformSetWidthThread }
TMainformSetWidthThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformSetHeightThread }
TMainformSetHeightThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformSetCaptionThread }
TMainformSetCaptionThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformSetVisibleThread }
TMainformSetVisibleThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformShowThread }
TMainformShowThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
{ TMainformHideThread }
TMainformHideThread = class(TPromiseThread)
private
procedure doUnSafe;
protected
procedure ExecuteAct; override;
end;
//
function safeExecute(const handler: TV8HandlerSafe; const name: ustring;
const obj: ICefv8Value; const arguments: TCefv8ValueArray;
var retval: ICefv8Value; var exception: ustring): Boolean;
begin
Result:= False;
case handler.FuncName of
'app.showMessage',
'app.terminate',
'browser.reload',
'browser.showDevTools',
'browser.loadURL',
'browser.goBack',
'browser.goForward',
'screen.workAreaWidth',
'screen.workAreaHeight',
'mainform.left',
'mainform.top',
'mainform.width',
'mainform.height',
'mainform.caption',
'mainform.visible',
'mainform.set.left',
'mainform.set.top',
'mainform.set.width',
'mainform.set.height',
'mainform.set.caption',
'mainform.set.visible',
'mainform.show',
'mainform.hide',
'mainform.close': begin
// res = (arg, ...) => new Promise(resolve => {...})
retval:= NewV8Promise(name,
TV8HandlerCallback.Create(handler.ModuleName, handler.FuncName, arguments, obj));
end;
else
Exit;
end;
Result:= True;
end;
function TV8HandlerCallback.Execute(const name: ustring;
const obj: ICefv8Value; const arguments: TCefv8ValueArray;
var retval: ICefv8Value; var exception: ustring): Boolean;
begin
// (resolve, reject) => {...}
Result:= False;
case FuncName of
'app.showMessage': begin
StartPromiseThread(TAppShowMessageThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'app.terminate', 'mainform.close': begin
StartPromiseThread(TAppTerminateThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'browser.reload': begin
StartPromiseThread(TBrowserReloadThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'browser.showDevTools': begin
StartPromiseThread(TBrowserShowDevToolsThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'browser.loadURL': begin
StartPromiseThread(TBrowserLoadURLThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'browser.goBack': begin
StartPromiseThread(TBrowserGoBackThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'browser.goForward': begin
StartPromiseThread(TBrowserGoBackThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'screen.workAreaWidth': begin
StartPromiseThread(TScreenGetWorkAreaWidthThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'screen.workAreaHeight': begin
StartPromiseThread(TScreenGetWorkAreaHeightThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.left': begin
StartPromiseThread(TMainFormGetLeftThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.top': begin
StartPromiseThread(TMainFormGetTopThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.width': begin
StartPromiseThread(TMainFormGetWidthThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.height': begin
StartPromiseThread(TMainFormGetHeightThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.caption': begin
StartPromiseThread(TMainFormGetCaptionThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.visible': begin
StartPromiseThread(TMainFormGetVisibleThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.set.left': begin
StartPromiseThread(TMainFormSetLeftThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.set.top': begin
StartPromiseThread(TMainFormSetTopThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.set.width': begin
StartPromiseThread(TMainFormSetWidthThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.set.height': begin
StartPromiseThread(TMainFormSetHeightThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.set.caption': begin
StartPromiseThread(TMainFormSetCaptionThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.set.visible': begin
StartPromiseThread(TMainFormSetVisibleThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.show': begin
StartPromiseThread(TMainFormShowThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
'mainform.hide': begin
StartPromiseThread(TMainFormHideThread, Args, arguments[0], arguments[1], ModuleName, FuncName, CefObject);
end;
else
Exit;
end;
Result:= True;
end;
{ TAppShowMessageThread }
procedure TAppShowMessageThread.doUnSafe;
var
s: String;
begin
s:= '';
if Args.GetSize > 0 then s:= UTF8Encode(Args.GetString(0));
Application.MessageBox(PChar(s), PChar(PROJECT_NAME));
Form1.Chromium.SetFocus(True);
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(true);
end;
procedure TAppShowMessageThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TAppTerminateThread }
procedure TAppTerminateThread.doUnSafe;
begin
Application.Terminate;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(true);
end;
procedure TAppTerminateThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TBrowsershowDevToolsThread }
procedure TBrowsershowDevToolsThread.doUnSafe;
begin
Form1.Chromium.ShowDevTools(Point(0, 0));
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(true);
end;
procedure TBrowsershowDevToolsThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TBrowserReloadThread }
procedure TBrowserReloadThread.doUnSafe;
begin
Form1.Chromium.ReloadIgnoreCache;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(true);
end;
procedure TBrowserReloadThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TBrowserLoadURLThread }
procedure TBrowserLoadURLThread.doUnSafe;
var
s: String;
begin
NewFunction('console.warn("browser.loadURL() has been deprecated. Please use location.href = newURL instead.");');
if Args.GetSize > 0 then begin
s:= UTF8Encode(Args.GetString(0));
Form1.Chromium.LoadURL(UTF8Decode('http://0.0.0.0/' + s));
end;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(true);
end;
procedure TBrowserLoadURLThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TBrowserGoBackThread }
procedure TBrowserGoBackThread.doUnSafe;
begin
NewFunction('console.warn("browser.goBack() has been deprecated. Please use history.back() instead.");');
//Form1.Chromium.GoBack;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(true);
end;
procedure TBrowserGoBackThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TBrowserGoForwardThread }
procedure TBrowserGoForwardThread.doUnSafe;
begin
NewFunction('console.warn("browser.goForward() has been deprecated. Please use history.forward() instead.");');
//Form1.Chromium.GoForward;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(true);
end;
procedure TBrowserGoForwardThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformShowThread }
procedure TMainformShowThread.doUnSafe;
begin
Form1.Show;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(true);
end;
procedure TMainformShowThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformHideThread }
procedure TMainformHideThread.doUnSafe;
begin
Form1.Hide;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(true);
end;
procedure TMainformHideThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TV8AccessorScreen }
function TV8AccessorScreen.Get(const name: ustring; const object_: ICefv8Value;
var retval: ICefv8Value; var exception: ustring): Boolean;
var
func: ICefv8Value;
begin
func:= TCefv8ValueRef.NewFunction(name, TV8HandlerSafe.Create(PROJECT_NAME, 'screen.' + UTF8Encode(name)));
retval:= func.ExecuteFunction(nil, nil);
Result:= True;
end;
function TV8AccessorScreen.Set_(const name: ustring; const object_,
value: ICefv8Value; var exception: ustring): Boolean;
begin
Result:= False;
end;
{ TScreenGetworkAreaWidthThread }
procedure TScreenGetworkAreaWidthThread.doUnSafe;
begin
CefResolve:= TCefValueRef.New;
CefResolve.SetInt(Screen.WorkAreaWidth);
end;
procedure TScreenGetworkAreaWidthThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TScreenGetworkAreaHeightThread }
procedure TScreenGetworkAreaHeightThread.doUnSafe;
begin
CefResolve:= TCefValueRef.New;
CefResolve.SetInt(Screen.WorkAreaHeight);
end;
procedure TScreenGetworkAreaHeightThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TV8AccessorMainform }
function TV8AccessorMainform.Get(const name: ustring;
const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring
): Boolean;
var
v1, func: ICefv8Value;
handler: ICefv8Handler;
begin
case name of
'set': begin
retval:= TCefv8ValueRef.NewObject(nil, nil);
handler:= TV8HandlerSafe.Create(PROJECT_NAME, 'mainform.set.left');
retval.SetValueByKey('left',
TCefv8ValueRef.NewFunction('left', handler), V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(PROJECT_NAME, 'mainform.set.top');
retval.SetValueByKey('top',
TCefv8ValueRef.NewFunction('top', handler), V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(PROJECT_NAME, 'mainform.set.width');
retval.SetValueByKey('width',
TCefv8ValueRef.NewFunction('width', handler), V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(PROJECT_NAME, 'mainform.set.height');
retval.SetValueByKey('height',
TCefv8ValueRef.NewFunction('height', handler), V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(PROJECT_NAME, 'mainform.set.caption');
retval.SetValueByKey('caption',
TCefv8ValueRef.NewFunction('caption', handler), V8_PROPERTY_ATTRIBUTE_NONE);
handler:= TV8HandlerSafe.Create(PROJECT_NAME, 'mainform.set.visible');
retval.SetValueByKey('visible',
TCefv8ValueRef.NewFunction('visible', handler), V8_PROPERTY_ATTRIBUTE_NONE);
end;
else begin
func:= TCefv8ValueRef.NewFunction(name, TV8HandlerSafe.Create(PROJECT_NAME, 'mainform.' + UTF8Encode(name)));
retval:= func.ExecuteFunction(nil, nil);
end;
end;
Result:= True;
end;
function TV8AccessorMainform.Set_(const name: ustring; const object_,
value: ICefv8Value; var exception: ustring): Boolean;
var
func: ICefv8Value;
begin
// Setters cannot return a value so it is impossible to return the promise.
// It means setters cannot wait finish this process.
// Use "await xxx.set.yyy()" if you want to wait.
func:= TCefv8ValueRef.NewFunction(name, TV8HandlerSafe.Create(PROJECT_NAME, 'mainform.set.' + UTF8Encode(name)));
func.ExecuteFunction(nil, [value]);
Result:= True;
end;
{ TMainformGetLeftThread }
procedure TMainformGetLeftThread.doUnSafe;
begin
CefResolve:= TCefValueRef.New;
CefResolve.SetInt(Form1.Left);
end;
procedure TMainformGetLeftThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformGetTopThread }
procedure TMainformGetTopThread.doUnSafe;
begin
CefResolve:= TCefValueRef.New;
CefResolve.SetInt(Form1.Top);
end;
procedure TMainformGetTopThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformGetWidthThread }
procedure TMainformGetWidthThread.doUnSafe;
begin
CefResolve:= TCefValueRef.New;
CefResolve.SetInt(Form1.Width);
end;
procedure TMainformGetWidthThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformGetHeightThread }
procedure TMainformGetHeightThread.doUnSafe;
begin
CefResolve:= TCefValueRef.New;
CefResolve.SetInt(Form1.Height);
end;
procedure TMainformGetHeightThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformGetCaptionThread }
procedure TMainformGetCaptionThread.doUnSafe;
begin
CefResolve:= TCefValueRef.New;
CefResolve.SetString(UTF8Decode(Form1.Caption));
end;
procedure TMainformGetCaptionThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformGetVisibleThread }
procedure TMainformGetVisibleThread.doUnSafe;
begin
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(Form1.Visible);
end;
procedure TMainformGetVisibleThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformSetLeftThread }
procedure TMainformSetLeftThread.doUnSafe;
begin
if Args.GetSize > 0 then begin
Form1.Left:= Args.GetInt(0);
end;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(True);
end;
procedure TMainformSetLeftThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformSetTopThread }
procedure TMainformSetTopThread.doUnSafe;
begin
if Args.GetSize > 0 then begin
Form1.Top:= Args.GetInt(0);
end;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(True);
end;
procedure TMainformSetTopThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformSetWidthThread }
procedure TMainformSetWidthThread.doUnSafe;
begin
if Args.GetSize > 0 then begin
Form1.Width:= Args.GetInt(0);
end;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(True);
end;
procedure TMainformSetWidthThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformSetHeightThread }
procedure TMainformSetHeightThread.doUnSafe;
begin
if Args.GetSize > 0 then begin
Form1.Height:= Args.GetInt(0);
end;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(True);
end;
procedure TMainformSetHeightThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformSetCaptionThread }
procedure TMainformSetCaptionThread.doUnSafe;
begin
if Args.GetSize > 0 then begin
Form1.Caption:= UTF8Encode(Args.GetString(0));
end;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(True);
end;
procedure TMainformSetCaptionThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
{ TMainformSetVisibleThread }
procedure TMainformSetVisibleThread.doUnSafe;
begin
if Args.GetSize > 0 then begin
Form1.Visible:= Args.GetBool(0);
end;
CefResolve:= TCefValueRef.New;
CefResolve.SetBool(True);
end;
procedure TMainformSetVisibleThread.ExecuteAct;
begin
Synchronize(@doUnSafe);
end;
// Maybe this function is unnecessary.
function CreateRequest(const fileName: string): ICefRequest;
var
s: string;
sl: TStringList;
p: ICefPostData;
e: ICefPostDataElement;
begin
sl:= TStringList.Create;
try
sl.LoadFromFile(dogRoot+fileName);
s:= sl.Text;
finally
sl.Free;
end;
Result:= TCefRequestRef.New;
Result.Url:= UTF8Decode('http://0.0.0.0/' + fileName);
p:= TCefPostDataRef.New;
e:= TCefPostDataElementRef.New;
e.SetToBytes(Length(s), PChar(s));
p.AddElement(e);
Result.PostData:= p;
end;
initialization
// Regist module handler
AddModuleHandler(MODULE_NAME, @requireCreate, @requireExecute, @safeExecute);
// Regist TPromiseThread class
AddPromiseThreadClass(MODULE_NAME, TRequireThread);
AddPromiseThreadClass(MODULE_NAME, TAppShowMessageThread);
AddPromiseThreadClass(MODULE_NAME, TAppTerminateThread);
AddPromiseThreadClass(MODULE_NAME, TBrowserReloadThread);
AddPromiseThreadClass(MODULE_NAME, TBrowserShowDevToolsThread);
AddPromiseThreadClass(MODULE_NAME, TBrowserLoadURLThread);
AddPromiseThreadClass(MODULE_NAME, TBrowserGoBackThread);
AddPromiseThreadClass(MODULE_NAME, TBrowserGoForwardThread);
AddPromiseThreadClass(MODULE_NAME, TScreenGetWorkAreaWidthThread);
AddPromiseThreadClass(MODULE_NAME, TScreenGetWorkAreaHeightThread);
AddPromiseThreadClass(MODULE_NAME, TMainFormGetLeftThread);
AddPromiseThreadClass(MODULE_NAME, TMainFormGetTopThread);
AddPromiseThreadClass(MODULE_NAME, TMainFormGetWidthThread);
AddPromiseThreadClass(MODULE_NAME, TMainFormGetHeightThread);
AddPromiseThreadClass(MODULE_NAME, TMainFormGetCaptionThread);
AddPromiseThreadClass(MODULE_NAME, TMainFormGetVisibleThread);
AddPromiseThreadClass(MODULE_NAME, TMainFormSetLeftThread);
AddPromiseThreadClass(MODULE_NAME, TMainFormSetTopThread);
AddPromiseThreadClass(MODULE_NAME, TMainFormSetWidthThread);
AddPromiseThreadClass(MODULE_NAME, TMainFormSetHeightThread);
AddPromiseThreadClass(MODULE_NAME, TMainFormSetCaptionThread);
AddPromiseThreadClass(MODULE_NAME, TMainFormSetVisibleThread);
AddPromiseThreadClass(MODULE_NAME, TMainformShowThread);
AddPromiseThreadClass(MODULE_NAME, TMainformHideThread);
end.
| 27.797927 | 169 | 0.758062 |
83a2423068f45377ca122c1b3ba3ca8633d388aa | 8,404 | pas | Pascal | src/libraries/hashlib4pascal/HlpSipHash.pas | skalogryz/PascalCoin | 4ad304ff133b06a5708f7f7f22300e58eb2f959e | [
"MIT"
]
| 1 | 2021-06-07T13:20:04.000Z | 2021-06-07T13:20:04.000Z | src/libraries/hashlib4pascal/HlpSipHash.pas | skalogryz/PascalCoin | 4ad304ff133b06a5708f7f7f22300e58eb2f959e | [
"MIT"
]
| null | null | null | src/libraries/hashlib4pascal/HlpSipHash.pas | skalogryz/PascalCoin | 4ad304ff133b06a5708f7f7f22300e58eb2f959e | [
"MIT"
]
| 1 | 2021-06-02T23:57:38.000Z | 2021-06-02T23:57:38.000Z | unit HlpSipHash;
{$I HashLib.inc}
interface
uses
{$IFDEF DELPHI2010}
SysUtils, // to get rid of compiler hint "not inlined" on Delphi 2010.
{$ENDIF DELPHI2010}
HlpHashLibTypes,
HlpConverters,
HlpIHashInfo,
HlpNullable,
HlpHash,
HlpIHash,
HlpHashResult,
HlpIHashResult,
HlpBits;
resourcestring
SInvalidKeyLength = 'KeyLength Must Be Equal to %d';
type
TSipHash = class abstract(THash, IHash64, IHashWithKey, ITransformBlock)
strict private
{$REGION 'Consts'}
const
V0 = UInt64($736F6D6570736575);
V1 = UInt64($646F72616E646F6D);
V2 = UInt64($6C7967656E657261);
V3 = UInt64($7465646279746573);
KEY0 = UInt64($0706050403020100);
KEY1 = UInt64($0F0E0D0C0B0A0908);
{$ENDREGION}
procedure Compress(); inline;
procedure CompressTimes(a_times: Int32); inline;
procedure ProcessBlock(a_m: UInt64); inline;
procedure ByteUpdate(a_b: Byte); inline;
procedure Finish();
function GetKeyLength(): TNullableInteger;
function GetKey: THashLibByteArray;
procedure SetKey(const value: THashLibByteArray);
strict protected
Fm_v0, Fm_v1, Fm_v2, Fm_v3, Fm_key0, Fm_key1, Fm_total_length: UInt64;
F_cr, F_fr, Fm_idx: Int32;
Fm_buf: THashLibByteArray;
public
constructor Create(a_compression_rounds: Int32 = 2;
a_finalization_rounds: Int32 = 4);
procedure Initialize(); override;
procedure TransformBytes(const a_data: THashLibByteArray;
a_index, a_length: Int32); override;
function TransformFinal: IHashResult; override;
property KeyLength: TNullableInteger read GetKeyLength;
property Key: THashLibByteArray read GetKey write SetKey;
end;
type
/// <summary>
/// SipHash 2 - 4 algorithm.
/// <summary>
TSipHash2_4 = class sealed(TSipHash)
public
constructor Create();
function Clone(): IHash; override;
end;
implementation
{ TSipHash2_4 }
function TSipHash2_4.Clone(): IHash;
var
HashInstance: TSipHash2_4;
begin
HashInstance := TSipHash2_4.Create();
HashInstance.Fm_v0 := Fm_v0;
HashInstance.Fm_v1 := Fm_v1;
HashInstance.Fm_v2 := Fm_v2;
HashInstance.Fm_v3 := Fm_v3;
HashInstance.Fm_key0 := Fm_key0;
HashInstance.Fm_key1 := Fm_key1;
HashInstance.Fm_total_length := Fm_total_length;
HashInstance.F_cr := F_cr;
HashInstance.F_fr := F_fr;
HashInstance.Fm_idx := Fm_idx;
HashInstance.Fm_buf := System.Copy(Fm_buf);
result := HashInstance as IHash;
result.BufferSize := BufferSize;
end;
constructor TSipHash2_4.Create;
begin
Inherited Create(2, 4);
end;
{ TSipHash }
procedure TSipHash.Compress;
begin
Fm_v0 := Fm_v0 + Fm_v1;
Fm_v2 := Fm_v2 + Fm_v3;
Fm_v1 := TBits.RotateLeft64(Fm_v1, 13);
Fm_v3 := TBits.RotateLeft64(Fm_v3, 16);
Fm_v1 := Fm_v1 xor Fm_v0;
Fm_v3 := Fm_v3 xor Fm_v2;
Fm_v0 := TBits.RotateLeft64(Fm_v0, 32);
Fm_v2 := Fm_v2 + Fm_v1;
Fm_v0 := Fm_v0 + Fm_v3;
Fm_v1 := TBits.RotateLeft64(Fm_v1, 17);
Fm_v3 := TBits.RotateLeft64(Fm_v3, 21);
Fm_v1 := Fm_v1 xor Fm_v2;
Fm_v3 := Fm_v3 xor Fm_v0;
Fm_v2 := TBits.RotateLeft64(Fm_v2, 32);
end;
procedure TSipHash.CompressTimes(a_times: Int32);
var
i: Int32;
begin
i := 0;
while i < a_times do
begin
Compress();
System.Inc(i);
end;
end;
procedure TSipHash.ProcessBlock(a_m: UInt64);
begin
Fm_v3 := Fm_v3 xor a_m;
CompressTimes(F_cr);
Fm_v0 := Fm_v0 xor a_m;
end;
procedure TSipHash.ByteUpdate(a_b: Byte);
var
ptr_Fm_buf: PByte;
m: UInt64;
begin
Fm_buf[Fm_idx] := a_b;
System.Inc(Fm_idx);
if Fm_idx >= 8 then
begin
ptr_Fm_buf := PByte(Fm_buf);
m := TConverters.ReadBytesAsUInt64LE(ptr_Fm_buf, 0);
ProcessBlock(m);
Fm_idx := 0;
end;
end;
constructor TSipHash.Create(a_compression_rounds, a_finalization_rounds: Int32);
begin
Inherited Create(8, 8);
Fm_key0 := KEY0;
Fm_key1 := KEY1;
F_cr := a_compression_rounds;
F_fr := a_finalization_rounds;
System.SetLength(Fm_buf, 8);
end;
procedure TSipHash.Finish;
var
b: UInt64;
begin
b := UInt64(Fm_total_length and $FF) shl 56;
if (Fm_idx <> 0) then
begin
case (Fm_idx) of
7:
begin
b := b or (UInt64(Fm_buf[6]) shl 48);
b := b or (UInt64(Fm_buf[5]) shl 40);
b := b or (UInt64(Fm_buf[4]) shl 32);
b := b or (UInt64(Fm_buf[3]) shl 24);
b := b or (UInt64(Fm_buf[2]) shl 16);
b := b or (UInt64(Fm_buf[1]) shl 8);
b := b or (UInt64(Fm_buf[0]));
end;
6:
begin
b := b or (UInt64(Fm_buf[5]) shl 40);
b := b or (UInt64(Fm_buf[4]) shl 32);
b := b or (UInt64(Fm_buf[3]) shl 24);
b := b or (UInt64(Fm_buf[2]) shl 16);
b := b or (UInt64(Fm_buf[1]) shl 8);
b := b or (UInt64(Fm_buf[0]));
end;
5:
begin
b := b or (UInt64(Fm_buf[4]) shl 32);
b := b or (UInt64(Fm_buf[3]) shl 24);
b := b or (UInt64(Fm_buf[2]) shl 16);
b := b or (UInt64(Fm_buf[1]) shl 8);
b := b or (UInt64(Fm_buf[0]));
end;
4:
begin
b := b or (UInt64(Fm_buf[3]) shl 24);
b := b or (UInt64(Fm_buf[2]) shl 16);
b := b or (UInt64(Fm_buf[1]) shl 8);
b := b or (UInt64(Fm_buf[0]));
end;
3:
begin
b := b or (UInt64(Fm_buf[2]) shl 16);
b := b or (UInt64(Fm_buf[1]) shl 8);
b := b or (UInt64(Fm_buf[0]));
end;
2:
begin
b := b or (UInt64(Fm_buf[1]) shl 8);
b := b or (UInt64(Fm_buf[0]));
end;
1:
begin
b := b or (UInt64(Fm_buf[0]));
end;
end;
end;
Fm_v3 := Fm_v3 xor b;
CompressTimes(F_cr);
Fm_v0 := Fm_v0 xor b;
Fm_v2 := Fm_v2 xor $FF;
CompressTimes(F_fr);
end;
function TSipHash.GetKey: THashLibByteArray;
var
LKey: THashLibByteArray;
begin
System.SetLength(LKey, KeyLength.value);
TConverters.ReadUInt64AsBytesLE(Fm_key0, LKey, 0);
TConverters.ReadUInt64AsBytesLE(Fm_key1, LKey, 8);
result := LKey;
end;
function TSipHash.GetKeyLength: TNullableInteger;
begin
result := 16;
end;
procedure TSipHash.Initialize;
begin
Fm_v0 := V0;
Fm_v1 := V1;
Fm_v2 := V2;
Fm_v3 := V3;
Fm_total_length := 0;
Fm_idx := 0;
Fm_v3 := Fm_v3 xor Fm_key1;
Fm_v2 := Fm_v2 xor Fm_key0;
Fm_v1 := Fm_v1 xor Fm_key1;
Fm_v0 := Fm_v0 xor Fm_key0;
end;
procedure TSipHash.SetKey(const value: THashLibByteArray);
begin
if (value = Nil) then
begin
Fm_key0 := KEY0;
Fm_key1 := KEY1;
end
else
begin
if System.Length(value) <> KeyLength.value then
raise EArgumentHashLibException.CreateResFmt(@SInvalidKeyLength,
[KeyLength.value]);
Fm_key0 := TConverters.ReadBytesAsUInt64LE(PByte(value), 0);
Fm_key1 := TConverters.ReadBytesAsUInt64LE(PByte(value), 8);
end;
end;
procedure TSipHash.TransformBytes(const a_data: THashLibByteArray;
a_index, a_length: Int32);
var
i, &length, iter, offset: Int32;
ptr_a_data, ptr_Fm_buf: PByte;
m: UInt64;
begin
{$IFDEF DEBUG}
System.Assert(a_index >= 0);
System.Assert(a_length >= 0);
System.Assert(a_index + a_length <= System.Length(a_data));
{$ENDIF DEBUG}
Length := a_length;
i := a_index;
ptr_a_data := PByte(a_data);
System.Inc(Fm_total_length, Length);
// consume last pending bytes
if ((Fm_idx <> 0) and (a_length <> 0)) then
begin
{$IFDEF DEBUG}
System.Assert(a_index = 0); // nothing would work anyways if a_index is !=0
{$ENDIF DEBUG}
while ((Fm_idx < 8) and (Length <> 0)) do
begin
Fm_buf[Fm_idx] := (ptr_a_data + a_index)^;
System.Inc(Fm_idx);
System.Inc(a_index);
System.Dec(Length);
end;
if (Fm_idx = 8) then
begin
ptr_Fm_buf := PByte(Fm_buf);
m := TConverters.ReadBytesAsUInt64LE(ptr_Fm_buf, 0);
ProcessBlock(m);
Fm_idx := 0;
end;
end
else
begin
i := 0;
end;
iter := Length shr 3;
// body
while i < iter do
begin
m := TConverters.ReadBytesAsUInt64LE(ptr_a_data, a_index + (i * 8));
ProcessBlock(m);
System.Inc(i);
end;
// save pending end bytes
offset := a_index + (i * 8);
while offset < (Length + a_index) do
begin
ByteUpdate(a_data[offset]);
System.Inc(offset);
end;
end;
function TSipHash.TransformFinal: IHashResult;
begin
Finish();
result := THashResult.Create(Fm_v0 xor Fm_v1 xor Fm_v2 xor Fm_v3);
Initialize();
end;
end.
| 21.942559 | 80 | 0.63684 |
4779101f1da72e603f88f6465fb1f027cb5d7c18 | 4,435 | pas | Pascal | EvilWorks.Vcl.FormSettings.pas | vedranvuk/EvilLibrary | 05b97e8689d47c2f97b3de510836f202130e2266 | [
"BSD-4-Clause"
]
| null | null | null | EvilWorks.Vcl.FormSettings.pas | vedranvuk/EvilLibrary | 05b97e8689d47c2f97b3de510836f202130e2266 | [
"BSD-4-Clause"
]
| null | null | null | EvilWorks.Vcl.FormSettings.pas | vedranvuk/EvilLibrary | 05b97e8689d47c2f97b3de510836f202130e2266 | [
"BSD-4-Clause"
]
| null | null | null | unit EvilWorks.VCL.FormSettings;
{ by lhaymehr@gmail.com, 2010. Part of EvilLibrary. Works with Delphi XE and up. }
interface
uses
WinApi.Windows, WinApi.Messages,
System.SysUtils, System.Classes, System.IniFiles,
Vcl.Forms;
type
{ TFormSettings }
TFormSettings = class(TComponent)
private const
CX: string = 'X';
CY: string = 'Y';
CCX: string = 'CX';
CCY: string = 'CY';
CState: string = 'State';
private
FSaveWndProc: TWndMethod;
private
FTempLeft: integer;
FTempTop : integer;
FLeft : integer;
FTop : integer;
FWidth : integer;
FHeight : integer;
FState : TWindowState;
protected
procedure SubclassOwnerForm(const aEnable: boolean);
procedure SubClassWndProc(var aMsg: TMessage);
procedure GetParentFormProperties;
procedure SetParentFormProperties;
public
constructor Create(aOwner: TComponent); override;
destructor Destroy; override;
procedure SaveToIni(const aFileName, aSectionName: string);
procedure LoadFromIni(const aFileName, aSectionName: string);
end;
implementation
{ TFormSettings }
constructor TFormSettings.Create(aOwner: TComponent);
begin
if not(aOwner is TCustomForm) then
raise Exception.Create('TFormSettings owner must be a TCustomForm descendant');
inherited;
SubclassOwnerForm(True);
GetParentFormProperties;
end;
destructor TFormSettings.Destroy;
begin
SubclassOwnerForm(False);
inherited;
end;
procedure TFormSettings.GetParentFormProperties;
begin
FLeft := TCustomForm(Owner).Left;
FTop := TCustomForm(Owner).Top;
FWidth := TCustomForm(Owner).Width;
FHeight := TCustomForm(Owner).Height;
FState := TCustomForm(Owner).WindowState;
end;
procedure TFormSettings.SetParentFormProperties;
var
tempState: TWindowState;
begin
tempState := FState;
SetWindowPos(TCustomForm(Owner).Handle, 0, FLeft, FTop, FWidth, FHeight, 0);
FState := tempState;
case FState of
wsMinimized:
ShowWindow(TCustomForm(Owner).Handle, SW_MINIMIZE);
wsMaximized:
ShowWindow(TCustomForm(Owner).Handle, SW_MAXIMIZE);
end;
end;
procedure TFormSettings.SubclassOwnerForm(const aEnable: boolean);
begin
if (aEnable) then
begin
FSaveWndProc := TCustomForm(Owner).WindowProc;
TCustomForm(Owner).WindowProc := SubClassWndProc;
end
else
begin
if (Assigned(FSaveWndProc) = False) then
Exit;
TCustomForm(Owner).WindowProc := FSaveWndProc;
FSaveWndProc := nil;
end;
end;
procedure TFormSettings.SubClassWndProc(var aMsg: TMessage);
var
r: TRect;
begin
case aMsg.Msg of
WM_DESTROY:
begin
SubclassOwnerForm(False);
end;
WM_SIZE:
begin
case aMsg.WParam of
SIZE_MAXIMIZED:
FState := wsMaximized;
SIZE_MINIMIZED:
FState := wsMinimized;
SIZE_RESTORED:
FState := wsNormal;
end;
GetWindowRect(TCustomForm(Owner).Handle, r);
if (aMsg.WParam = SIZE_RESTORED) then
begin
FWidth := r.Width;
FHeight := r.Height;
end
else
begin
FLeft := FTempLeft;
FTop := FTempTop;
end;
end;
WM_MOVE:
begin
GetWindowRect(TCustomForm(Owner).Handle, r);
FTempLeft := FLeft;
FTempTop := FTop;
FLeft := r.Left;
FTop := r.Top;
end;
end;
if (Assigned(FSaveWndProc)) then
FSaveWndProc(aMsg);
end;
procedure TFormSettings.SaveToIni(const aFileName, aSectionName: string);
var
ini: TIniFile;
begin
ForceDirectories(ExtractFilePath(aFileName));
ini := TIniFile.Create(aFileName);
try
ini.WriteInteger(aSectionName, CX, FLeft);
ini.WriteInteger(aSectionName, CY, FTop);
ini.WriteInteger(aSectionName, CCX, FWidth);
ini.WriteInteger(aSectionName, CCY, FHeight);
ini.WriteInteger(aSectionName, CState, integer(FState));
finally
ini.Free;
end;
end;
procedure TFormSettings.LoadFromIni(const aFileName, aSectionName: string);
var
ini: TIniFile;
begin
if (FileExists(aFileName) = False) then
begin
SaveToIni(aFileName, aSectionName);
Exit;
end;
ini := TIniFile.Create(aFileName);
try
FLeft := ini.ReadInteger(aSectionName, CX, TCustomForm(Owner).Left);
FTop := ini.ReadInteger(aSectionName, CY, TCustomForm(Owner).Top);
FWidth := ini.ReadInteger(aSectionName, CCX, TCustomForm(Owner).Width);
FHeight := ini.ReadInteger(aSectionName, CCY, TCustomForm(Owner).Height);
FState := TWindowState(ini.ReadInteger(aSectionName, CState, integer(TCustomForm(Owner).WindowState)));
SetParentFormProperties;
finally
ini.Free;
end;
end;
end.
| 22.286432 | 106 | 0.72469 |
611acf83beef352b0167d70f5fd8d5b5c587a232 | 1,267 | dpr | Pascal | project/midilib.dpr | aleksusklim/midilib | 43b8db68d6dda2a7c1c2926bdfcdf7e0f9339136 | [
"Unlicense"
]
| null | null | null | project/midilib.dpr | aleksusklim/midilib | 43b8db68d6dda2a7c1c2926bdfcdf7e0f9339136 | [
"Unlicense"
]
| null | null | null | project/midilib.dpr | aleksusklim/midilib | 43b8db68d6dda2a7c1c2926bdfcdf7e0f9339136 | [
"Unlicense"
]
| null | null | null | program midilib;
{$APPTYPE CONSOLE}
uses
SysUtils,
Classes,
UCachedList,
UMidiLib;
var
m: TMidiFile;
procedure my();
var
i, j: Integer;
track: TMidiTrack;
event: TMidiEvent;
begin
for i := 0 to m.Tracks.Count - 1 do
begin
track := m.Tracks[i] as TMidiTrack;
for j := 0 to track.Events.Count - 1 do
begin
event := track.Events[j] as TMidiEvent;
if event.DeltaTime <> 0 then
event.DeltaTime := event.DeltaTime div 2;
end;
end;
end;
function fil(event: TMidiEvent): Boolean;
begin
if event.IsSystem() or event.IsText() then
Result := False
else
Result := True;
if event.IsText() then
begin
Writeln(event.MoreData);
end
else if event.IsMeta() then
begin
Writeln(event.MetaType);
if event.MetaType = 81 then
begin
//track.RemoveEvent(index);
end;
end;
end;
begin
m := TMidiFile.Create();
(m.Open('midi.mid'));
// Writeln(m.CalcAbsolute());
// my();
// m.Tracks.Exchange(1, 2);
(m.Enum(fil));
(m.Enum());
m.UseRunning := False;
m.Save('save.mid');
m.Fix(True);
m.Save('fix.mid');
m.UseRunning := True;
m.Tracks.Exchange(0,1);
m.Save('run.mid');
m.Free();
end.
| 17.84507 | 50 | 0.5809 |
833841b727de6c5a78f3117264d6ab8accafeed1 | 1,911 | pas | Pascal | Oxygene/Echoes/Language/Object Pascal/AssemblyInfo.pas | remobjects/ElementsSamples | 744647f59424c18ccb06c0c776b2dcafdabb0513 | [
"MIT"
]
| 19 | 2016-04-09T12:40:27.000Z | 2022-02-22T12:15:03.000Z | Oxygene/Echoes/Language/Object Pascal/AssemblyInfo.pas | remobjects/ElementsSamples | 744647f59424c18ccb06c0c776b2dcafdabb0513 | [
"MIT"
]
| 3 | 2017-09-05T09:31:29.000Z | 2019-09-11T04:49:27.000Z | Oxygene/Echoes/Language/Object Pascal/AssemblyInfo.pas | remobjects/ElementsSamples | 744647f59424c18ccb06c0c776b2dcafdabb0513 | [
"MIT"
]
| 11 | 2016-12-29T19:30:39.000Z | 2021-08-31T12:20:27.000Z | namespace ObjectPascal;
interface
uses
System.Reflection;
[assembly: AssemblyTitle('')]
[assembly: AssemblyDescription('')]
[assembly: AssemblyConfiguration('')]
[assembly: AssemblyCompany('')]
[assembly: AssemblyProduct('')]
[assembly: AssemblyCopyright('')]
[assembly: AssemblyTrademark('')]
[assembly: AssemblyCulture('')]
[assembly: AssemblyVersion('1.0.0.1')]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory, which in Oxygene by default is the
// same as the project directory. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile('mykey.snk')]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile('')]
[assembly: AssemblyKeyName('')]
implementation
end.
| 38.22 | 85 | 0.703297 |
4749cfe6568a62040543eee2d631ae5823ad6173 | 8,980 | pas | Pascal | tests/Test.GeneratorClassMethods.pas | bogdanpolak/delphi-dataproxy | fef7a3a3c5256788ae9f52f105b7a1c1b841f466 | [
"MIT"
]
| 13 | 2019-01-25T06:08:45.000Z | 2022-01-26T07:56:09.000Z | tests/Test.GeneratorClassMethods.pas | bogdanpolak/delphi-dataproxy | fef7a3a3c5256788ae9f52f105b7a1c1b841f466 | [
"MIT"
]
| 70 | 2019-01-17T21:57:42.000Z | 2020-03-09T19:36:57.000Z | tests/Test.GeneratorClassMethods.pas | bogdanpolak/delphi-dataproxy | fef7a3a3c5256788ae9f52f105b7a1c1b841f466 | [
"MIT"
]
| 4 | 2019-08-02T14:24:19.000Z | 2020-11-11T02:56:42.000Z | unit Test.GeneratorClassMethods;
interface
uses
DUnitX.TestFramework,
System.Classes,
System.SysUtils,
System.Variants,
Data.DB,
FireDAC.Comp.Client,
Comp.Generator.DataProxy,
Helper.DUnitAssert;
{$TYPEINFO ON}
type
[TestFixture]
TestGeneratorClassMethods = class(TObject)
private
fOwner: TComponent;
fTemporaryFileName: string;
fStringList: TStringList;
public
[Setup]
procedure Setup;
[TearDown]
procedure TearDown;
published
// ---
procedure SaveToFile_IsFileExists;
procedure SaveToFile_CheckUnitName;
procedure SaveToFile_CheckAllUnit;
procedure SaveToFile_CheckIndetnationAndNamingStyle;
procedure SaveToFile_DiffrentUnitNameAndNameOfClass;
// ---
procedure SaveToClipboard_ClipboardNotEmpty;
procedure SaveToClipboard_CheckClipboardText;
procedure SaveToClipboard_IndetationAndNamingStyle;
end;
{$TYPEINFO OFF}
implementation
uses
System.IOUtils,
Vcl.Clipbrd;
// -----------------------------------------------------------------------
// Utulities
// -----------------------------------------------------------------------
function GivenDataSet_HistoricalEvents(aOwner: TComponent): TDataSet;
var
memTable: TFDMemTable;
begin
memTable := TFDMemTable.Create(aOwner);
with memTable do
begin
FieldDefs.Add('EventID', ftInteger);
FieldDefs.Add('Event', ftWideString, 50);
FieldDefs.Add('Date', ftDate);
FieldDefs.Add('Expirence', ftFloat);
FieldDefs.Add('Income', ftCurrency);
CreateDataSet;
AppendRecord([1, 'Liberation of Poland', EncodeDate(1989, 06, 04),
1.2, 120]);
AppendRecord([2, 'Battle of Vienna', EncodeDate(1683, 09, 12),
System.Variants.Null, Null]);
First;
end;
Result := memTable;
end;
function GivenDataSet_MiniHistoricalEvents(aOwner: TComponent): TDataSet;
var
memTable: TFDMemTable;
begin
memTable := TFDMemTable.Create(aOwner);
with memTable do
begin
FieldDefs.Add('EventID', ftInteger);
FieldDefs.Add('Event', ftWideString, 50);
FieldDefs.Add('Date', ftDate);
CreateDataSet;
AppendRecord([1, 'Liberation of Poland', EncodeDate(1989, 06, 04)]);
AppendRecord([2, 'Battle of Vienna', EncodeDate(1683, 09, 12)]);
First;
end;
Result := memTable;
end;
// -----------------------------------------------------------------------
// Setup and TearDown section
// -----------------------------------------------------------------------
procedure TestGeneratorClassMethods.Setup;
begin
fOwner := TComponent.Create(nil);
fStringList := TStringList.Create;
fTemporaryFileName := '';
Clipboard.Clear;
end;
procedure TestGeneratorClassMethods.TearDown;
begin
fStringList.Free;
fOwner.Free;
if (fTemporaryFileName <> '') and FileExists(fTemporaryFileName) then
DeleteFile(fTemporaryFileName);
end;
// -----------------------------------------------------------------------
// Tests: SaveToFile
// -----------------------------------------------------------------------
procedure TestGeneratorClassMethods.SaveToFile_IsFileExists;
begin
fTemporaryFileName := TPath.GetTempPath + 'HistoricalEvents1.pas';
TDataProxyGenerator.SaveToFile(
{} fTemporaryFileName,
{} GivenDataSet_MiniHistoricalEvents(fOwner),
{} 'HistoricalEvents');
Assert.IsTrue(FileExists(fTemporaryFileName),
Format('Expected temporary file is not exist (%s)', [fTemporaryFileName]));
end;
procedure TestGeneratorClassMethods.SaveToFile_CheckUnitName;
begin
fTemporaryFileName := TPath.GetTempPath + 'Proxy.HistoricalEvents.pas';
TDataProxyGenerator.SaveToFile(
{} fTemporaryFileName,
{} GivenDataSet_MiniHistoricalEvents(fOwner),
{} 'TEventsProxy');
fStringList.LoadFromFile(fTemporaryFileName);
Assert.AreEqual('unit Proxy.HistoricalEvents;', fStringList[0]);
end;
procedure TestGeneratorClassMethods.SaveToFile_CheckAllUnit;
begin
fTemporaryFileName := TPath.GetTempPath + 'Proxy.HistoricalEvents.pas';
TDataProxyGenerator.SaveToFile(
{} fTemporaryFileName,
{} GivenDataSet_MiniHistoricalEvents(fOwner),
{} 'THistoricalEventsProxy');
fStringList.LoadFromFile(fTemporaryFileName);
Assert.AreMemosEqual(
{} 'unit Proxy.HistoricalEvents;'#13 +
{} sLineBreak +
{} 'interface'#13 +
{} sLineBreak +
{} 'uses'#13 +
{} ' Data.DB,'#13 +
{} ' Data.DataProxy,'#13 +
{} ' System.SysUtils,'#13 +
{} ' System.Classes,'#13 +
{} ' FireDAC.Comp.Client;'#13 +
{} sLineBreak +
{} 'type'#13 +
{} ' THistoricalEventsProxy = class(TDatasetProxy)'#13 +
{} ' private'#13 +
{} ' FEventID :TIntegerField;'#13 +
{} ' FEvent :TWideStringField;'#13 +
{} ' FDate :TDateField;'#13 +
{} ' protected'#13 +
{} ' procedure ConnectFields; override;'#13 +
{} ' public'#13 +
{} ' property EventID :TIntegerField read FEventID;'#13 +
{} ' property Event :TWideStringField read FEvent;'#13 +
{} ' property Date :TDateField read FDate;'#13 +
{} ' end;'#13 +
{} sLineBreak +
{} 'implementation'#13 +
{} sLineBreak +
{} 'procedure THistoricalEventsProxy.ConnectFields;'#13 +
{} 'const'#13 +
{} ' ExpectedFieldCount = 3;'#13 +
{} 'begin'#13 +
{} ' FEventID := FDataSet.FieldByName(''EventID'') as TIntegerField;'#13 +
{} ' FEvent := FDataSet.FieldByName(''Event'') as TWideStringField;'#13 +
{} ' FDate := FDataSet.FieldByName(''Date'') as TDateField;'#13 +
{} ' Assert(FDataSet.Fields.Count = ExpectedFieldCount);'#13 +
{} 'end;'#13 +
{} sLineBreak +
{} 'end.'#13, fStringList.Text);
end;
procedure TestGeneratorClassMethods.SaveToFile_CheckIndetnationAndNamingStyle;
begin
fTemporaryFileName := TPath.GetTempPath + 'Proxy.HistoricalEvents.pas';
TDataProxyGenerator.SaveToFile(
{} fTemporaryFileName,
{} GivenDataSet_MiniHistoricalEvents(fOwner),
{} 'HistoricalEvents',
{} ' ',
{} fnsLowerCaseF);
fStringList.LoadFromFile(fTemporaryFileName);
Assert.AreEqual(' Data.DB,', fStringList[5]);
Assert.AreEqual(' fEventID :TIntegerField;', fStringList[14]);
Assert.AreEqual(' property EventID :TIntegerField read fEventID;',
fStringList[20]);
end;
procedure TestGeneratorClassMethods.SaveToFile_DiffrentUnitNameAndNameOfClass;
begin
fTemporaryFileName := TPath.GetTempPath + 'ProxyUnit.pas';
TDataProxyGenerator.SaveToFile(
{} fTemporaryFileName,
{} GivenDataSet_MiniHistoricalEvents(fOwner),
{} 'TFooProxy');
fStringList.LoadFromFile(fTemporaryFileName);
Assert.AreEqual('unit ProxyUnit;', fStringList[0]);
Assert.AreEqual(' TFooProxy = class(TDatasetProxy)', fStringList[12]);
Assert.AreEqual('procedure TFooProxy.ConnectFields;', fStringList[27]);
end;
// -----------------------------------------------------------------------
// Tests: SaveToClipboard
// -----------------------------------------------------------------------
procedure TestGeneratorClassMethods.SaveToClipboard_ClipboardNotEmpty;
begin
TDataProxyGenerator.SaveToClipboard(
{} GivenDataSet_MiniHistoricalEvents(fOwner),
{} 'TEventsProxy');
Assert.IsTrue(Clipboard.AsText.Length > 0,
'Expected proxy code, but the clipboard content is empty');
end;
procedure TestGeneratorClassMethods.SaveToClipboard_CheckClipboardText;
begin
TDataProxyGenerator.SaveToClipboard(
{} GivenDataSet_MiniHistoricalEvents(fOwner),
{} 'THistoricalEventsProxy');
Assert.AreMemosEqual(
{} 'type'#13 +
{} ' THistoricalEventsProxy = class(TDatasetProxy)'#13 +
{} ' private'#13 +
{} ' FEventID :TIntegerField;'#13 +
{} ' FEvent :TWideStringField;'#13 +
{} ' FDate :TDateField;'#13 +
{} ' protected'#13 +
{} ' procedure ConnectFields; override;'#13 +
{} ' public'#13 +
{} ' property EventID :TIntegerField read FEventID;'#13 +
{} ' property Event :TWideStringField read FEvent;'#13 +
{} ' property Date :TDateField read FDate;'#13 +
{} ' end;'#13 +
{} sLineBreak +
{} 'procedure THistoricalEventsProxy.ConnectFields;'#13 +
{} 'const'#13 +
{} ' ExpectedFieldCount = 3;'#13 +
{} 'begin'#13 +
{} ' FEventID := FDataSet.FieldByName(''EventID'') as TIntegerField;'#13 +
{} ' FEvent := FDataSet.FieldByName(''Event'') as TWideStringField;'#13 +
{} ' FDate := FDataSet.FieldByName(''Date'') as TDateField;'#13 +
{} ' Assert(FDataSet.Fields.Count = ExpectedFieldCount);'#13 +
{} 'end;'#13, Clipboard.AsText);
end;
procedure TestGeneratorClassMethods.SaveToClipboard_IndetationAndNamingStyle;
begin
TDataProxyGenerator.SaveToClipboard(
{} GivenDataSet_MiniHistoricalEvents(fOwner),
{} 'THistoricalEventsProxy',
{} ' ',
{} fnsLowerCaseF);
fStringList.Text := Clipboard.AsText;
Assert.AreEqual(' private', fStringList[2]);
Assert.AreEqual(' FDate :TDateField;', fStringList[5]);
Assert.AreEqual(' property Date :TDateField read FDate;',
fStringList[11]);
Assert.AreEqual(' FDate := FDataSet.FieldByName(''Date'') as TDateField;',
fStringList[20]);
end;
end.
| 30.033445 | 79 | 0.656125 |
4765f91f536aff236621006c491fb714330a00a8 | 605 | dpr | Pascal | FastMM-TomaszHutnik/Project20.dpr | bogdanpolak/zoom-meetings | f626107bd16d6f4695e601b100a3e7f6005ea838 | [
"MIT"
]
| 1 | 2020-11-11T02:54:08.000Z | 2020-11-11T02:54:08.000Z | FastMM-TomaszHutnik/Project20.dpr | bogdanpolak/zoom-meetings | f626107bd16d6f4695e601b100a3e7f6005ea838 | [
"MIT"
]
| null | null | null | FastMM-TomaszHutnik/Project20.dpr | bogdanpolak/zoom-meetings | f626107bd16d6f4695e601b100a3e7f6005ea838 | [
"MIT"
]
| 1 | 2020-11-11T02:54:09.000Z | 2020-11-11T02:54:09.000Z | // JCL_DEBUG_EXPERT_GENERATEJDBG OFF
// JCL_DEBUG_EXPERT_INSERTJDBG OFF
// JCL_DEBUG_EXPERT_DELETEMAPFILE OFF
library Project20;
uses
{$ifdef USEFASTMM}
FastMM4 in 'FastMM\FastMM4.pas',
FastMM4Messages in 'FastMM\FastMM4Messages.pas',
{$endif }
System.SysUtils,
System.Classes,
CommonInterfaces in 'CommonInterfaces.pas',
UnitDll in 'UnitDll.pas';
{$R *.res}
function EntryPoint(aExePart: IExePart; out aDllPart: IDllPart): Integer; stdcall;
begin
try
aDllPart := TDLLPart.Create(aExePart);
Result := 0;
except
Result := -1;
end;
end;
exports EntryPoint;
begin
end.
| 18.90625 | 82 | 0.732231 |
f1aa2a4438ef9aa9d32e7b290dadbf6dfbdcd2e1 | 1,221 | pas | Pascal | crypto/prng/t_rnd_44.pas | amikey/delphi-crypto | a79895f25bff69819f354e9bf27c19e2f00fed19 | [
"Unlicense"
]
| 6 | 2019-02-15T02:47:02.000Z | 2021-08-02T22:34:34.000Z | crypto/prng/t_rnd_44.pas | amikey/delphi-crypto | a79895f25bff69819f354e9bf27c19e2f00fed19 | [
"Unlicense"
]
| null | null | null | crypto/prng/t_rnd_44.pas | amikey/delphi-crypto | a79895f25bff69819f354e9bf27c19e2f00fed19 | [
"Unlicense"
]
| 7 | 2020-05-04T21:44:13.000Z | 2021-04-02T12:42:23.000Z | {Simple test for MT19937 unit, we Nov.2008}
program t_rnd_44;
{$i STD.INC}
{$ifdef BIT16}
{$N+}
{$endif}
{$ifdef win32}
{$ifndef VirtualPascal}
{$apptype console}
{$endif}
{$endif}
uses
{$ifdef WINCRT}
wincrt,
{$else}
crt,
{$endif}
mt19937,ministat;
const
NMAX = MaxLongint;
label
_break;
var
mx,sx,x,xmin,xmax: double;
n: longint;
stat: TStatX;
rng: mt19937_ctx;
begin
writeln('Test program for MT19937 unit, mean/sdev of prng_dword (c) 2008 W.Ehrhardt');
writeln('MT19937 selftest: ', mt19937_selftest);
writeln('Count':12, 'Mean':20, 'Min':20, 'Max':20);
stat1_init(stat);
mt19937_init(rng,1);
xmin := 1E50;
xmax :=-1E50;
for n:=1 to NMAX do begin
x := mt19937_dword(rng);
stat1_add(stat,x);
if x<xmin then xmin := x;
if x>xmax then xmax := x;
if n and $3FFFF = 0 then begin
stat1_result(stat,mx,sx);
if stat.Error<>0 then begin
writeln('Ministat error: ',stat.Error);
halt;
end;
writeln(n:12, mx:20:2, xmin:20:2, xmax:20:2);
if keypressed and (readkey=#27) then goto _break;
end;
end;
_break:
stat1_result(stat,mx,sx);
writeln(stat.Nn:12, mx:20:2, xmin:20:2, xmax:20:2);
end.
| 19.693548 | 91 | 0.619165 |
47696ebbc6b73094ed75877a38ceedfeecb72fd7 | 16,989 | pas | Pascal | Native/Delphi/Apps/Debugging/MemoryDebuggingDemo/SafeMM/SafeMM.pas | jpluimers/bo.codeplex | 787ef3b5a8c6ced0a985361243c48a6c76f5d655 | [
"BSD-3-Clause"
]
| 5 | 2017-05-12T08:03:54.000Z | 2022-02-15T08:23:27.000Z | Native/Delphi/Apps/Debugging/MemoryDebuggingDemo/SafeMM/SafeMM.pas | jpluimers/bo.codeplex | 787ef3b5a8c6ced0a985361243c48a6c76f5d655 | [
"BSD-3-Clause"
]
| null | null | null | Native/Delphi/Apps/Debugging/MemoryDebuggingDemo/SafeMM/SafeMM.pas | jpluimers/bo.codeplex | 787ef3b5a8c6ced0a985361243c48a6c76f5d655 | [
"BSD-3-Clause"
]
| null | null | null | (*
SafeMM Debug Memory Manager 0.4
(C) Ben Taylor
based on code from:
(C) 2000 Per B. Larsen & TurboPower Software Co.
All rights reserved.
Used with permission.
Description:
A "proof of concept" unit for using OS functionality to raise an
AV when an improper attempt is made to read or write memory.
Usage:
To use SafeMM as a replacement memory manager in a standalone application
add the SafeMMInstall as the first unit in the project uses clause.
Then run the application under the debugger. If an invalid
memory access is detected an Access Violation will be generated.
For applications using ShareMem, compile the borlndmm.dpr project
and copy the resulting borlndmm.dll into the application bin directory.
To use SafeMM with the IDE (BDS.exe), backup and replace the borlndmm.dll
file in the directory where BDS.exe is installed.
Notes:
- A problem is that many functions require/assume 4/8-byte
alignment. enabling alignment in the mm means that its guarding
ability is reduced.
- A typical app might experience 4x the normal memory usage.
Depending on how many small-block pools are preallocated, there may
also be a minimum memory usage of about 60Mb.
- When used with the IDE (version 8 or later), disable the exceptiondiag
IDE package to prevent an infinite loop if an unhandled exception is raised.
To do this, rename the exceptiondiagXXX.bpl file in the diretory with
bds.exe at the same time borlndmm.dll is replaced.
When the IDE is started, reply "yes" to the missing package prompt.
When restoring the original borlndmm.dll file, re-enable the exceptdiag
package by removing the registry entry under:
HKEY_CURRENT_USER\Software\CodeGear\BDS\X.0\Disabled IDE Packages
- Because of the increased memory requirements, when running the IDE,
it may be necessary to disable unused IDE personalities and features
to avoid out of memory errors. Out of memory errors may also occur
after running the application for a period of time.
Examples:
//with alignment=8
var
p:pchar;
begin
p:=AllocMem(2);
p[0]:='a';
p:=ReallocMem(p,3);
Assert(p[0]='a');
p[1]:='b';
//ideally should fail, but wont due to alignment
p[3]:='b';
//should give a write-av
p[10]:='c';
//should give a read-av
if p[10]='c' then ...
Small Block Layout:
64k is divided into 16 x 4k blocks:
info/g/mem1/g/mem2/g/mem3/g/mem4/g/mem5/g/mem6/g/mem7/g
info : contains info about allocation of the small blocks
g : guard blocks. these are always marked as NoAccess
memX : returned by the memory routines.
marked as NoAccess when not in use.
marked as ReadWrite when allocated
There are 7 info records in the info block.
This gives about 500bytes/record.
Good reason to not release pool back to os when empty is that you can
store info about data that was previously there.
Change log:
Version 0.1
- Initial release
Version 0.2
- Improved memory usage. Small blocks are now reused less frequently,
leading to a higher chance that improper memory usage is caught.
Version 0.3 (March 29, 2007)
- Added support for delaying reuse of large-blocks.
Version 0.4 (October 16, 2009)
- Mark Edington (Embarcadero): Fixed compilation with older RTL that does
not have TMemoryManagerEx defined.
Moved SafeMM_readme.txt contents into this file and added addition notes.
Todo (from Ben):
- Implement SafeMMMode again
- store stack traces for the memory alloc/free calls
- Add guard bytes to allow detection of modification in the area
not used due to alignment
- Implement data structures to allow better management of the
allocated memory. this would allow:
- walking a list of allocated large and small blocks
ideally these structures should be marked as NoAccess
unless being changed by the memory routines.
- Rewrite by someone who knows this better than i do :)
- Nice to have a callback like GetPointerInfo(p:pointer;info:pchar);
this would allow the rtl to ask the memory-manager for additional info
about the given pointer (eg stack trace), which can then be displayed
in an error message to the user.
*)
unit SafeMM;
{$ASSERTIONS ON}
interface
{$IF RTLVersion >= 18.0}
{$DEFINE MEMORY_MANAGER_EX}
{$IFEND}
type
TSafeProtect = (spReadWrite,spReadOnly,spNoAccess);
function SafeGetMem(Size: NativeInt): Pointer;
function SafeFreeMem(P: Pointer): Integer;
function SafeReallocMem(P: Pointer; Size: NativeInt): Pointer;
function SafeAllocMem(ASize: NativeInt): Pointer;
{
caller can specifically set protection on a block of memory.
this is useful eg if you have a block of memory that you know
shouldn't be written to.
}
procedure SafeMMProtect(const p:Pointer;const aProtect:TSafeProtect);
{
this preallocates a number of small-block pools.
this is done so that the same small-block isn't immediately
reused by the next memory request.
}
procedure SafeMMPrepare;
const
{$IFDEF MEMORY_MANAGER_EX}
SafeMemoryManager: TMemoryManagerEx = (
GetMem: SafeGetMem;
FreeMem: SafeFreeMem;
ReallocMem: SafeReallocMem;
AllocMem: SafeAllocMem;
RegisterExpectedMemoryLeak: nil;
UnregisterExpectedMemoryLeak: nil;
);
{$ELSE}
SafeMemoryManager: TMemoryManager = (
GetMem: SafeGetMem;
FreeMem: SafeFreeMem;
ReallocMem: SafeReallocMem;
);
type
TMemoryManagerEx = TMemoryManager; // Simple alias to avoid IFDEF in SafeMMInstall.
{$ENDIF}
type
{
selects how the returned block of memory is aligned inside its
guard pages.
eg header:
Guard|returned block|trailing space|guard
will protect against eg p[-1]:=nil;
footer:
Guard|leading space|returned block|guard
will protect against eg p[size+100]:=nil;
}
TSafeGuardMode = (
gmHeader, //mostly protect against access before block
gmFooter //mostly protect against access after block
);
var
//0=no alignment
SafeMMAlign:Integer;
SafeMMMode:TSafeGuardMode;
implementation
uses
Windows;
const
//how many 4k blocks in a 64k pool
cSubCount=7;
type
PPoolInfo = ^TPoolInfo;
TPoolInfo = record
Pool:pointer;
//is each subblock available?
//could be better to use 7 bits and bitwise ops?
//eg 01111111. then full=127,empty=0, inuse>0
avail:array[0..cSubCount-1] of boolean;
//helper routines
end;
PBlockInfo = ^TBlockInfo;
TBlockInfo = record
//indicate valid info
Magic:Cardinal;
//pool. nil=it was alloc seperately
Pool:PPoolInfo;
PoolIndex:integer;
//
Issued:Boolean;
//requested size
RequestSize:Cardinal;
//pointer to returned memory
Start:Pointer;
//use a fixed size list of pointers for a stack
//Stack:Pointer;
end;
const
//should read page size from system?
cPage=4*1024;
//used to indicate if we're located at a valid location
cMagic=123123;
//how many small-block pools are allowed
cMaxAvail=30000;
var
FHeap:cardinal;
FAvailCount:cardinal;
FAvailList:array[0..cMaxAvail] of PPoolInfo;
//used to decrease reuse of large blocks
//the larger the array, the better, but also increases ram usage
FLargeList:array[0..100] of PBlockInfo;
FLargeIndex:Integer;
FHoldStart:Cardinal;
FHoldEnd:Cardinal;
//no reason to keep full list unless mem leak checking
//FTotalList:array[1..32000] of PPoolInfo;
FCritical:TRTLCriticalSection;
function offset(const p:pointer;const b:integer):Pointer;
begin
Assert(p<>nil);
{$WARNINGS OFF}
result:=pointer(cardinal(p)+b);
{$WARNINGS ON}
end;
procedure PushAvail(const aPool:PPoolInfo);
begin
Assert(aPool<>nil);
Assert(FAvailList[fholdend]=nil);
FAvailList[fholdend]:=aPool;
inc(FAvailCount);
Inc(fholdend);
if fholdend=High(FAvailList) then fholdend:=Low(FAvailList);
end;
function PopAvail:PPoolInfo;
begin
Assert(fholdstart<>fholdend);//cant be empty
dec(FAvailCount);
Result:=FAvailList[fholdstart];
FAvailList[fholdstart]:=nil;
Assert(Result<>nil);
Inc(fholdstart);
if fholdstart=High(FAvailList) then fholdstart:=Low(FAvailList);
end;
function IsEmpty(const aPool:PPoolInfo): boolean;
var
i:integer;
begin
result:=True;
for i:=low(aPool.avail) to high(aPool.avail) do
if not aPool.avail[i] then
begin
result:=False;
exit;
end;
end;
function IsFull(const aPool:PPoolInfo): boolean;
var
i:integer;
begin
result:=True;
for i:=low(aPool.avail) to high(aPool.avail) do
if aPool.avail[i] then
begin
result:=False;
exit;
end;
end;
procedure CheckValid(const aBlock:PBlockInfo);
begin
Assert(aBlock<>nil);
Assert(aBlock.Magic=cMagic);
end;
procedure Init(const aBlock:PBlockInfo);
begin
aBlock.Magic:=cMagic;
aBlock.Issued:=False;
end;
procedure lock(const aBlock:PBlockInfo);
var
old:cardinal;
begin
//could also use PAGE_readonly here as a lower protection
VirtualProtect(aBlock.Start,aBlock.RequestSize,PAGE_NOACCESS,old);
end;
procedure unlock(const aBlock:PBlockInfo);
//unlock 1 4k page
var
old:cardinal;
aSuccess:Boolean;
begin
aSuccess:=VirtualProtect(aBlock.start,1,PAGE_READWRITE,old);
Assert(aSuccess);
end;
function PointerToBlock(const p:Pointer):PBlockInfo;
// info|guard|mem0|guard|mem1|guard...
var
aBase:Pointer;
aIndex:Cardinal;
begin
Assert(p<>nil);
aBase:=Pointer((Cardinal(p) div (64*1024))*(64*1024));
//which 4kblock are we in?
aIndex:=(Cardinal(p)-Cardinal(aBase)) div (4*1024);
//convert that to info index: 2=0,4=1,6=2
aIndex:=(aindex div 2)-1;
//then add that*infosize to the base
Result:=offset(aBase,aIndex*SizeOf(TBlockInfo));
Assert(Result.magic=cMagic);
end;
procedure InitPool(const aPool:PPoolInfo);
var
aSub:pointer;
old:cardinal;
i:integer;
aBlock:PBlockInfo;
aSuccess:Boolean;
begin
Assert(aPool<>nil);
//msdn: Memory allocated by VirtualAlloc is automatically
//initialized to zero, unless MEM_RESET is specified.
aPool.Pool:=VirtualAlloc(nil,64*1024,MEM_COMMIT, PAGE_NOACCESS);
if aPool.Pool=nil then exit;
//ensure 64k aligned. safemm routines depend on this.
assert(cardinal(aPool.Pool) mod (64*1024)=0);
for i:=Low(aPool.avail) to high(aPool.avail) do aPool.avail[i]:=True;
aSub:=aPool.Pool;
aSuccess:=VirtualProtect(aSub,4096,PAGE_READWRITE,old);
Assert(aSuccess);
//first block is info. init the 7
for i:=0 to cSubCount-1 do
begin
aBlock:=offset(aSub,i*SizeOf(TBlockInfo));
Init(aBlock);
aBlock.Pool:=aPool;
aBlock.PoolIndex:=i;
//0=2 1=4
aBlock.Start:=offset(aPool.Pool,(2+(i*2))*4096);
end;
end;
function GetLargeBlock(const aRequest:cardinal):PBlockInfo;
var
aActual:cardinal;
p:pointer;
Old:cardinal;
begin
aActual:=aRequest div 4096;
if aRequest mod 4096>0 then inc(aActual);
aActual:=aActual*4096;
result:=VirtualAlloc(nil,aActual+(3*4096),MEM_COMMIT, PAGE_READWRITE);
if result=nil then exit;
//setup info
Init(Result);
Result.RequestSize:=aRequest;
Result.Start:=offset(result,8*1024);
p:=offset(Result,4096);
VirtualProtect(p,1,PAGE_NOACCESS,old);
p:=offset(p,4096+aActual);
VirtualProtect(p,1,PAGE_NOACCESS,old);
end;
function FreeLargeBlock(const aBlock:PBlockInfo):integer;
//retain the block so it isn't immediately reallocated
var
p:PBlockInfo;
begin
Assert(ablock<>nil);
Result:=0;
lock(aBlock);
Assert(FLargeList[FLargeIndex]=nil);
FLargeList[FLargeIndex]:=ablock;
if FLargeIndex=high(FLargeList) then FLargeIndex:=Low(FLargeList)
else Inc(FLargeIndex);
p:=FLargeList[FLargeIndex];
if p<>nil then
begin
if VirtualFree(p, 0, MEM_RELEASE) then Result:=0
else Result:=-1;
FLargeList[FLargeIndex]:=nil;
end;
end;
function CreateInfo:PPoolInfo;
const
HEAP_ZERO_MEMORY = $00000008; // Was not defined in older Windows.pas files
begin
Result:=HeapAlloc(FHeap,HEAP_ZERO_MEMORY,sizeof(tpoolinfo));
InitPool(Result);
end;
function GetSmallBlock(const aSize:cardinal):PBlockInfo;
var
aPool:PPoolInfo;
i:integer;
begin
result:=nil;
EnterCriticalSection(fcritical);
try
assert(FAvailCount<cMaxAvail);
//is there an avail pool?
if FAvailCount>0 then
begin
aPool:=PopAvail;
end
else
begin
aPool:=createinfo;
if aPool.Pool=nil then Exit;
end;
Assert(aPool.pool<>nil);
//return a block
result:=nil;
for i:=Low(aPool.avail) to high(aPool.avail) do
begin
if aPool.avail[i] then
begin
result:=offset(aPool.Pool,i*sizeof(TBlockInfo));
aPool.avail[i]:=false;
break;
end;
end;
assert(result<>nil);
//if the pool is still avail then push
if not IsFull(aPool) then
begin
PushAvail(aPool);
end;
finally
LeaveCriticalSection(fcritical);
end;
//we've acquired small block, can now prepare it outside of lock
assert(result<>nil);
CheckValid(Result);
Result.RequestSize:=aSize;
unlock(result);
FillChar(Result.Start^,4096,0);
end;
function FreeSmallBlock(const aBlock:PBlockInfo):Integer;
var
aPool:PPoolInfo;
begin
assert(ablock<>nil);
result:=0;
CheckValid(aBlock);
//prevent further access. should clear here too?
//leave content means you could find out what was previously there when av happens?
lock(aBlock);
EnterCriticalSection(fcritical);
try
aPool:=aBlock.Pool;
//if pool was full then it goes back into avail list
if IsFull(aPool) then
begin
PushAvail(aPool);
end;
//tag the block as being available again
aPool.avail[ablock.PoolIndex]:=true;
//
if IsEmpty(aPool) then
begin
//either keep in avail list or delete based on count
//VirtualFree(aPool.Pool,0,MEM_RELEASE);
//also heapfree the pool info
end;
finally
LeaveCriticalSection(fcritical);
end;
end;
function BlockToPointer(const aBlock:PBlockInfo):pointer;
var
aPartial,aoffset:integer;
begin
Assert(ablock<>nil);
assert(ablock.Magic=cMagic);
//header align
//result:=aBlock.Start;
//footer aligned
aPartial:=(ablock.RequestSize mod cPage);
if aPartial=0 then aOffset:=0
else aOffset:=cPage-aPartial;
if SafeMMAlign>0 then aOffset:=(aOffset div SafeMMAlign)*SafeMMAlign;
Result:=offset(aBlock.Start,aoffset);
end;
function SafeGetMem(Size: NativeInt): Pointer;
var
aBlock:PBlockInfo;
begin
Assert(Size>0);
Result:=nil;
if size<=4*1024 then aBlock:=GetSmallBlock(size)
else aBlock:=GetLargeBlock(size);
if aBlock=nil then exit;
//setup
CheckValid(aBlock);
Assert(aBlock.Issued=false);
aBlock.Issued:=True;
//and quit
result:=BlockToPointer(aBlock);
end;
function SafeAllocMem(ASize: NativeInt): Pointer;
begin
Assert(aSize>0);
Result := SafeGetMem(ASize);
end;
function Min(const i1, i2: Integer): Integer;
begin
Result := i1;
if i2 < Result then Result := i2;
end;
function SafeReallocMem(P: Pointer; Size: NativeInt): Pointer;
//force-move realloc will help find invalid pointer usage
var
aActual:Integer;
aSource:PBlockInfo;
begin
Assert(p<>nil);
Assert(Size>0);
//find size of original block
aSource:=PointerToBlock(p);
//after checks have passed, get new block and copy
Result := SafeAllocMem(Size);
if result=nil then exit;
aActual:=min(aSource.RequestSize,Size);
Move(p^,Result^,aactual);
SafeFreeMem(p);
end;
function SafeFreeMem(P: Pointer): Integer;
var
aBlock:PBlockInfo;
begin
Assert(p<>nil);
//on free also check if it held a class. store classname as text in
//the info block, makes easier?
aBlock:=PointerToBlock(p);
CheckValid(aBlock);
Assert(aBlock.Issued);
aBlock.Issued:=False;
if aBlock.Pool=nil then
begin
Result:=FreeLargeBlock(aBlock);
end
else
begin
Result:=FreeSmallBlock(aBlock);
end;
end;
procedure SafeMMProtect(const p:Pointer;const aProtect:TSafeProtect);
var
old:Cardinal;
aBlock:PBlockInfo;
const
cProtect:array[TSafeProtect] of cardinal
= (PAGE_READWRITE,PAGE_READONLY,PAGE_NOACCESS);
begin
Assert(p<>nil);
aBlock:=PointerToBlock(p);
Assert(aBlock.Issued);
VirtualProtect(aBlock.Start,aBlock.RequestSize,cProtect[aProtect],old)
end;
procedure SafeMMPrepare;
var
aPool:PPoolInfo;
i:Integer;
begin
for i:=1 to 1000 do
begin
aPool:=createinfo;
PushAvail(aPool);
end;
end;
initialization
{$WARNINGS OFF}
//check that enough info can fit into 1 page
Assert(SizeOf(TBlockInfo)*(cSubCount+1)<=(4*1024));
{$WARNINGS ON}
FHoldStart:=0;
FHoldEnd:=0;
FLargeIndex:=0;
FAvailCount:=0;
SafeMMAlign:=8;
SafeMMMode:=gmFooter;
InitializeCriticalSection(fcritical);
FHeap:=GetProcessHeap;
finalization
DeleteCriticalSection(fcritical);
end.
| 24.097872 | 87 | 0.706516 |
834416bdb5306af5c03deef393a1844c8cb730c1 | 1,278 | pas | Pascal | samples/vclmessaging/ThirdFormU.pas | jfhyn/delphi-event-bus | ef51f7d5bf943403ec21ec6d92295a3a0b24a049 | [
"Apache-2.0"
]
| null | null | null | samples/vclmessaging/ThirdFormU.pas | jfhyn/delphi-event-bus | ef51f7d5bf943403ec21ec6d92295a3a0b24a049 | [
"Apache-2.0"
]
| null | null | null | samples/vclmessaging/ThirdFormU.pas | jfhyn/delphi-event-bus | ef51f7d5bf943403ec21ec6d92295a3a0b24a049 | [
"Apache-2.0"
]
| 1 | 2019-05-19T11:58:21.000Z | 2019-05-19T11:58:21.000Z | unit ThirdFormU;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, EventU, EventBus.Attributes,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;
type
TfrmThird = class(TForm)
PaintBox1: TPaintBox;
procedure PaintBox1Paint(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
FMessage: string;
{ Private declarations }
public
{ Public declarations }
[Subscribe]
procedure OnMemoChange(AEvent: TMemoChangeEvent);
end;
var
frmThird: TfrmThird;
implementation
uses
EventBus, Vcl.GraphUtil;
{$R *.dfm}
procedure TfrmThird.FormCreate(Sender: TObject);
begin
TEventBus.GetDefault.RegisterSubscriber(self);
end;
procedure TfrmThird.OnMemoChange(AEvent: TMemoChangeEvent);
begin
FMessage := AEvent.Text;
PaintBox1.Repaint;
AEvent.Free;
end;
procedure TfrmThird.PaintBox1Paint(Sender: TObject);
var
R: TRect;
begin
R := ClientRect;
GradientFillCanvas(PaintBox1.Canvas, clRed, clWhite, R,
TGradientDirection.gdVertical);
InflateRect(R, -5, -5);
PaintBox1.Canvas.Brush.Style := bsClear;
PaintBox1.Canvas.Font.Size := 18;
PaintBox1.Canvas.TextRect(R, FMessage, [TTextFormats.tfWordBreak,
TTextFormats.tfCenter]);
end;
end.
| 20.95082 | 68 | 0.743349 |
f14ec0bbec176a9a6b073e44b03e5ca787261cec | 50 | pas | Pascal | tests/pascal/test1.pas | mapron/PascalParser | f99d8578cbb6538f8d2f63a3226abc2290d69be1 | [
"Apache-2.0"
]
| 2 | 2019-06-22T15:53:53.000Z | 2019-09-11T10:14:20.000Z | tests/pascal/test1.pas | mapron/PascalParser | f99d8578cbb6538f8d2f63a3226abc2290d69be1 | [
"Apache-2.0"
]
| null | null | null | tests/pascal/test1.pas | mapron/PascalParser | f99d8578cbb6538f8d2f63a3226abc2290d69be1 | [
"Apache-2.0"
]
| 1 | 2019-09-11T10:14:22.000Z | 2019-09-11T10:14:22.000Z | program test;
begin
a:=b+c;
writeln(a);
end.
| 8.333333 | 14 | 0.6 |
471bdb516e6e93d5028bdf17076a74429da6389e | 1,215 | pas | Pascal | Modules/DelphiFMX/uMain.pas | shineworld/python4delphi | 7bba18fbf9201a7b378b38e56becfc2884f5c7e0 | [
"MIT"
]
| null | null | null | Modules/DelphiFMX/uMain.pas | shineworld/python4delphi | 7bba18fbf9201a7b378b38e56becfc2884f5c7e0 | [
"MIT"
]
| null | null | null | Modules/DelphiFMX/uMain.pas | shineworld/python4delphi | 7bba18fbf9201a7b378b38e56becfc2884f5c7e0 | [
"MIT"
]
| null | null | null | unit uMain;
interface
uses PythonEngine;
function PyInit_DelphiFMX: PPyObject; cdecl;
implementation
uses
System.SysUtils, WrapDelphi, WrapDelphiFMX;
var
gEngine : TPythonEngine;
gModule : TPythonModule;
gDelphiWrapper : TPyDelphiWrapper;
// This must match the pattern "PyInit_[ProjectName]"
// So if the project is named DelphiFMX then
// the function must be PyInit_DelphiFMX
function PyInit_DelphiFMX: PPyObject;
begin
try
gEngine := TPythonEngine.Create(nil);
gEngine.AutoFinalize := False;
gEngine.UseLastKnownVersion := true;
gModule := TPythonModule.Create(nil);
gModule.Engine := gEngine;
// This must match the ProjectName and the function name pattern
gModule.ModuleName := 'DelphiFMX';
gDelphiWrapper := TPyDelphiWrapper.Create(nil);
gDelphiWrapper.Engine := gEngine;
gDelphiWrapper.Module := gModule;
gEngine.LoadDllInExtensionModule();
except
on E: Exception do begin
WriteLn('An error has occurred: ' + E.Message);
end;
end;
Result := gModule.Module;
end;
initialization
gEngine := nil;
gModule := nil;
gDelphiWrapper := nil;
finalization
gEngine.Free;
gModule.Free;
gDelphiWrapper.Free;
end.
| 20.25 | 68 | 0.720165 |
83c0d38e77131205b8d70b663eb981c29fc935d0 | 15,299 | pas | Pascal | Source/Common/ConnectionHandlesCOM/BoldComServerHandles.pas | LenakeTech/BoldForDelphi | 3ef25517d5c92ebccc097c6bc2f2af62fc506c71 | [
"MIT"
]
| 121 | 2020-09-22T10:46:20.000Z | 2021-11-17T12:33:35.000Z | Source/Common/ConnectionHandlesCOM/BoldComServerHandles.pas | LenakeTech/BoldForDelphi | 3ef25517d5c92ebccc097c6bc2f2af62fc506c71 | [
"MIT"
]
| 8 | 2020-09-23T12:32:23.000Z | 2021-07-28T07:01:26.000Z | Source/Common/ConnectionHandlesCOM/BoldComServerHandles.pas | LenakeTech/BoldForDelphi | 3ef25517d5c92ebccc097c6bc2f2af62fc506c71 | [
"MIT"
]
| 42 | 2020-09-22T14:37:20.000Z | 2021-10-04T10:24:12.000Z | unit BoldComServerHandles;
interface
uses
Classes,
BoldBase,
BoldContainers,
BoldServerHandles,
BoldComServer;
type
{ forward declarations }
TBoldComClass = class;
TBoldComClasses = class;
TBoldComObjectProvider = class;
TBoldComServerHandle = class;
TBoldComExportHandle = class;
TBoldComServerObjectHandle = class;
{-- TBoldComClass --}
TBoldComClass = class(TCollectionItem)
private
FCLSID: string;
FDescription: string;
FActive: Boolean;
FName: string;
function IsDesignTime: Boolean;
function IsLoading: Boolean;
procedure SetCLSID(const Value: string);
procedure SetDescription(const Value: string);
procedure SetActive(Value: Boolean);
procedure SetName(const Value: string);
protected
function GetDisplayName: string; override;
public
constructor Create(Collection: TCollection); override;
procedure Assign(Source: TPersistent); override;
published
property CLSID: string read FCLSID write SetCLSID;
property Description: string read FDescription write SetDescription;
property Active: Boolean read FActive write SetActive default True;
property Name: string read FName write SetName;
end;
{-- TBoldComClasses --}
TBoldComClasses = class(TCollection)
private
FServerHandle: TBoldComServerHandle;
function ClassByName(const Name: string): TBoldComClass;
function ClassExists(const Name: string): Boolean;
function FirstClassName: string;
function GetItem(Index: Integer): TBoldComClass;
function GetUniqueName: string;
procedure SetItem(Index: Integer; Value: TBoldComClass);
protected
function GetOwner: TPersistent; override;
procedure Update(Item: TCollectionItem); override;
public
constructor Create(ServerHandle: TBoldComServerHandle);
function Add: TBoldComClass;
procedure GetClassNames(Strings: TStrings);
property Items[Index: Integer]: TBoldComClass read GetItem write SetItem; default;
end;
{-- TBoldComObjectProvider --}
TBoldComObjectProvider = class(TBoldNonRefCountedObject,IBoldComServerObjectProvider)
private
FCookie: Integer;
FHandles: TBoldObjectArray;
FServerHandle: TBoldComServerHandle;
procedure AddHandle(Handle: TBoldComExportHandle);
procedure RemoveHandle(Handle: TBoldComExportHandle);
property ServerHandle: TBoldComServerHandle read FServerHandle;
protected
{ IBoldComServerObjectProvider }
function CreateObject(const ClassId: TGUID; const ClassName: string): IUnknown;
function GetObject(const ClassId: TGUID; const ObjectName: string): IUnknown;
procedure GetObjectInfo(const ClassId: TGUID; ObjectNames, ClassNames: TStrings);
public
constructor Create(ServerHandle: TBoldComServerHandle);
destructor Destroy; override;
end;
{-- TBoldComServerHandle --}
TBoldComServerHandle = class(TBoldServerHandle)
private
FClasses: TBoldComClasses;
FObjectProvider: TBoldComObjectProvider;
function GetObjectProvider: TBoldComObjectProvider;
procedure SetClasses(Value: TBoldComClasses);
property ObjectProvider: TBoldComObjectProvider read GetObjectProvider;
protected
function GetHandledObject: TObject; override;
procedure Loaded; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Active;
property Classes: TBoldComClasses read FClasses write SetClasses;
end;
{-- TBoldComExportHandle --}
TBoldComExportHandle = class(TBoldExportHandle)
private
FServerClass: string;
FServerHandle: TBoldComServerHandle;
function GetEffectiveActive: Boolean;
function CanProvideThroughClass(const ClassId: TGUID): Boolean;
procedure RegisterHandle;
procedure RevokeHandle;
procedure SetServerClass(const Value: string);
procedure SetServerHandle(Value: TBoldComServerHandle);
procedure UpdateServerClass(Connect: Boolean);
protected
function GetComObject: IUnknown; virtual; abstract;
procedure Loaded; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure SetName(const NewName: TComponentName); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property ComObject: IUnknown read GetComObject;
property EffectiveActive: Boolean read GetEffectiveActive;
published
property Active;
property ObjectName;
property ServerClass: string read FServerClass write SetServerClass;
property ServerHandle: TBoldComServerHandle read FServerHandle write SetServerHandle;
end;
TBoldComGetComObjectEvent = procedure(Sender: TObject; out Obj: IUnknown) of object;
{-- TBoldComServerObjectHandle --}
TBoldComServerObjectHandle = class(TBoldComExportHandle)
private
FOnGetComObject: TBoldComGetComObjectEvent;
protected
function GetComObject: IUnknown; override;
function GetHandledObject: TObject; override;
published
property OnGetComObject: TBoldComGetComObjectEvent read FOnGetComObject write FOnGetComObject;
end;
implementation
uses
SysUtils,
BoldComConst,
ActiveX,
ComObj,
BoldHandle,
BoldComUtils,
BoldGUIDUtils;
const
DefaultClassName = 'BoldServer';
DefaultClassDescription = 'Bold Server Application';
{-- TBoldComClass ---------------------------------------------------------}
constructor TBoldComClass.Create(Collection: TCollection);
begin
inherited Create(Collection);
FActive := True;
if not IsLoading then
begin
FCLSID := BoldCreateGUIDAsString;
with Collection as TBoldComClasses do
FName := GetUniqueName;
end;
end;
procedure TBoldComClass.Assign(Source: TPersistent);
begin
if Source is TBoldComClass then
begin
Active := TBoldComClass(Source).Active;
CLSID := TBoldComClass(Source).CLSID;
Description := TBoldComClass(Source).Description;
Name := TBoldComClass(Source).Name;
end
else
inherited Assign(Source);
end;
function TBoldComClass.GetDisplayName: string;
begin
Result := Name;
if Result = '' then
Result := inherited GetDisplayName;
end;
function TBoldComClass.IsLoading: Boolean;
begin
with Collection as TBoldComClasses do
Result := (csLoading in FServerHandle.ComponentState);
end;
function TBoldComClass.IsDesignTime: Boolean;
begin
with Collection as TBoldComClasses do
Result := (csDesigning in FServerHandle.ComponentState);
end;
procedure TBoldComClass.SetCLSID(const Value: string);
var
GUID: TGUID;
begin
if FCLSID <> Value then
begin
if not IsLoading and not IsDesignTime then
if Active then
raise EBoldCom.CreateFmt(sCannotChangeCLSIDAtRT,[ClassName]);
try
GUID := StringToGUID(Value);
FCLSID := Value;
Changed(False);
except
on Exception do
raise EBoldCom.CreateFmt(sInvalidCLSID,[ClassName]);
end;
end;
end;
procedure TBoldComClass.SetDescription(const Value: string);
begin
if FDescription <> Value then
begin
if not IsLoading and not IsDesignTime then
raise EBoldCom.CreateFmt(sCannotChangeDescAtRT,[ClassName]);
FDescription := Value;
Changed(False);
end;
end;
procedure TBoldComClass.SetActive(Value: Boolean);
begin
if FActive <> Value then
FActive := Value;
end;
procedure TBoldComClass.SetName(const Value: string);
begin
if FName <> Value then
begin
if not IsLoading and not IsDesignTime then
raise EBoldCom.CreateFmt(sCannotChangeNameAtRT,[ClassName]);
if IsValidIdent(Value) then
begin
FName := Value;
Changed(False);
end
else
raise EBoldCom.CreateFmt(sInvalidName,[ClassName]);
end;
end;
{-- TBoldComClasses --------------------------------------------------------}
constructor TBoldComClasses.Create(ServerHandle: TBoldComServerHandle);
begin
inherited Create(TBoldComClass);
FServerHandle := ServerHandle;
end;
function TBoldComClasses.Add: TBoldComClass;
begin
Result := TBoldComClass(inherited Add);
end;
function TBoldComClasses.ClassByName(const Name: string): TBoldComClass;
var
I: Integer;
begin
Result := nil;
for I := 0 to Count - 1 do
begin
if AnsiCompareText(Name,Items[I].Name) = 0 then
begin
Result := Items[I];
Break;
end;
end;
end;
function TBoldComClasses.ClassExists(const Name: string): Boolean;
begin
Result := Assigned(ClassByName(Name));
end;
function TBoldComClasses.FirstClassName: string;
begin
if Count = 0 then
Result := ''
else
Result := Items[0].Name;
end;
function TBoldComClasses.GetItem(Index: Integer): TBoldComClass;
begin
Result := TBoldComClass(inherited GetItem(Index));
end;
procedure TBoldComClasses.GetClassNames(Strings: TStrings);
var
I: Integer;
begin
for I := 0 to Count - 1 do
Strings.Add(Items[I].Name);
end;
function TBoldComClasses.GetOwner: TPersistent;
begin
Result := FServerHandle;
end;
function TBoldComClasses.GetUniqueName: string;
var
I: Integer;
begin
I := 0;
repeat
Inc(I);
Result := Format('Class%d',[I]); // do not localize
until not ClassExists(Result);
end;
procedure TBoldComClasses.SetItem(Index: Integer; Value: TBoldComClass);
begin
inherited SetItem(Index, Value);
end;
procedure TBoldComClasses.Update(Item: TCollectionItem);
begin
if Item <> nil then
// updating item
else
// update all
end;
{-- TBoldComObjectProvider ----------------------------------------------------}
constructor TBoldComObjectProvider.Create(ServerHandle: TBoldComServerHandle);
begin
inherited Create;
FServerHandle := ServerHandle;
FHandles := TBoldObjectArray.Create(8,[]);
FCookie := TBoldComServer.Instance.RegisterObjectProvider(Self);
end;
destructor TBoldComObjectProvider.Destroy;
begin
TBoldComServer.Instance.RevokeObjectProvider(self, FCookie);
FHandles.Free;
inherited Destroy;
end;
procedure TBoldComObjectProvider.AddHandle(Handle: TBoldComExportHandle);
begin
FHandles.Add(Handle);
end;
function TBoldComObjectProvider.CreateObject(const ClassId: TGUID; const ClassName: string): IUnknown;
begin
Result := nil;
end;
function TBoldComObjectProvider.GetObject(const ClassId: TGUID; const ObjectName: string): IUnknown;
var
I: Integer;
Handle: TBoldComExportHandle;
begin
Result := nil;
if ServerHandle.Active then
begin
for I := 0 to FHandles.Count - 1 do
begin
Handle := FHandles[I] as TBoldComExportHandle;
if (AnsiCompareText(ObjectName,Handle.ObjectName) = 0) then
begin
if Handle.EffectiveActive and Handle.CanProvideThroughClass(ClassId) then
Result := Handle.ComObject;
Break;
end;
end;
end;
end;
procedure TBoldComObjectProvider.GetObjectInfo(const ClassId: TGUID; ObjectNames, ClassNames: TStrings);
var
I: Integer;
Handle: TBoldComExportHandle;
begin
if ServerHandle.Active then
begin
for I := 0 to FHandles.Count - 1 do
begin
Handle := FHandles[I] as TBoldComExportHandle;
if Handle.EffectiveActive and Handle.CanProvideThroughClass(ClassId) then
ObjectNames.Add(Handle.ObjectName);
end;
end;
end;
procedure TBoldComObjectProvider.RemoveHandle(Handle: TBoldComExportHandle);
begin
FHandles.Remove(Handle);
end;
{-- TBoldComServerHandle ------------------------------------------------------}
constructor TBoldComServerHandle.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FClasses := TBoldComClasses.Create(Self);
if (csDesigning in ComponentState) and
not (csLoading in ComponentState) then
with FClasses.Add do
begin
Name := DefaultClassName;
Description := DefaultClassDescription;
end;
end;
destructor TBoldComServerHandle.Destroy;
begin
if Assigned(FObjectProvider) then
FObjectProvider.Free;
FClasses.Free;
inherited Destroy;
end;
function TBoldComServerHandle.GetHandledObject: TObject;
begin
Result := TBoldComServer.Instance;
end;
function TBoldComServerHandle.GetObjectProvider: TBoldComObjectProvider;
begin
if not Assigned(FObjectProvider) then
FObjectProvider := TBoldComObjectProvider.Create(Self);
Result := FObjectProvider;
end;
procedure TBoldComServerHandle.Loaded;
begin
inherited;
end;
procedure TBoldComServerHandle.SetClasses(Value: TBoldComClasses);
begin
FClasses.Assign(Value);
end;
{-- TBoldComExportHandle ------------------------------------------------------}
constructor TBoldComExportHandle.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
end;
destructor TBoldComExportHandle.Destroy;
begin
RevokeHandle;
inherited;
end;
function TBoldComExportHandle.CanProvideThroughClass(const ClassId: TGUID): Boolean;
var
SClass: TBoldComClass;
begin
if (ServerClass = '') or IsEqualGUID(GUID_NULL,ClassId) then
Result := True
else
begin
SClass := ServerHandle.Classes.ClassByName(ServerClass);
Result := Assigned(SClass) and (CompareText(SClass.CLSID,GUIDToString(ClassId)) = 0);
end;
end;
function TBoldComExportHandle.GetEffectiveActive: Boolean;
var
SClass: TBoldComClass;
begin
Result := Assigned(ServerHandle) and ServerHandle.Active;
if Result then
begin
if ServerClass = '' then
Result := True
else
begin
SClass := ServerHandle.Classes.ClassByName(ServerClass);
Result := Assigned(SClass) and SClass.Active;
end;
if Result then
Result := Active;
end;
end;
procedure TBoldComExportHandle.Loaded;
begin
inherited;
RegisterHandle;
end;
procedure TBoldComExportHandle.Notification(AComponent: TComponent; Operation: TOperation);
begin
inherited;
if (Operation = opRemove) and (AComponent = FServerHandle) then
ServerHandle := nil;
end;
procedure TBoldComExportHandle.RegisterHandle;
begin
if Assigned(ServerHandle) and not (csLoading in ComponentState) then
begin
ServerHandle.ObjectProvider.AddHandle(Self);
ServerHandle.FreeNotification(Self);
end;
end;
procedure TBoldComExportHandle.RevokeHandle;
begin
if Assigned(ServerHandle) then
ServerHandle.ObjectProvider.RemoveHandle(Self);
end;
procedure TBoldComExportHandle.SetName(const NewName: TComponentName);
begin
inherited;
end;
procedure TBoldComExportHandle.SetServerClass(const Value: string);
begin
if Value <> FServerClass then
FServerClass := Value;
end;
procedure TBoldComExportHandle.SetServerHandle(Value: TBoldComServerHandle);
begin
if Value <> FServerHandle then
begin
RevokeHandle;
UpdateServerClass(False);
FServerHandle := Value;
RegisterHandle;
UpdateServerClass(True);
end;
end;
procedure TBoldComExportHandle.UpdateServerClass(Connect: Boolean);
begin
if Assigned(ServerHandle) and not (csLoading in ComponentState) then
begin
if Connect then
begin
if ServerClass = '' then
ServerClass := ServerHandle.Classes.FirstClassName;
end
else
begin
if ServerHandle.Classes.ClassExists(ServerClass) then
ServerClass := '';
end;
end;
end;
{-- TBoldComServerObjectHandle ------------------------------------------------}
function TBoldComServerObjectHandle.GetComObject: IUnknown;
begin
if Assigned(OnGetComObject) then
OnGetComObject(Self,Result)
else
Result := nil;
end;
function TBoldComServerObjectHandle.GetHandledObject: TObject;
begin
Result := nil;
end;
end.
| 26.107509 | 104 | 0.736453 |
4771bbe8790cdac91683f392cdae616159cacc39 | 6,362 | pas | Pascal | crossinstallers/m_any_to_embeddedaarch64.pas | Moehre2/fpcupdeluxe | a427ed6e3b503b8ba295f8a818ca909c5a5bb34f | [
"zlib-acknowledgement"
]
| 198 | 2018-12-12T04:32:15.000Z | 2022-03-10T03:37:09.000Z | crossinstallers/m_any_to_embeddedaarch64.pas | djwisdom/fpcupdeluxe | 07a9ab12480f4c619e968d7f899ca2e13dade32b | [
"zlib-acknowledgement"
]
| 425 | 2018-11-13T12:53:45.000Z | 2022-03-29T14:39:59.000Z | crossinstallers/m_any_to_embeddedaarch64.pas | djwisdom/fpcupdeluxe | 07a9ab12480f4c619e968d7f899ca2e13dade32b | [
"zlib-acknowledgement"
]
| 55 | 2018-11-20T12:03:11.000Z | 2022-03-28T06:34:08.000Z | unit m_any_to_embeddedaarch64;
{ Cross compiles from any platform with correct binutils to Embedded ARM
Copyright (C) 2017 Alf
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version with the following modification:
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,and
to copy and distribute the resulting executable under terms of your choice,
provided that you also meet, for each linked independent module, the terms
and conditions of the license of that module. An independent module is a
module which is not derived from or based on this library. If you modify
this library, you may extend this exception to your version of the library,
but you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
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. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
implementation
uses
FileUtil, m_crossinstaller, fpcuputil;
type
{ TAny_Embeddedaarch64 }
TAny_Embeddedaarch64 = class(TCrossInstaller)
private
FAlreadyWarned: boolean; //did we warn user about errors and fixes already?
public
function GetLibs(Basepath:string):boolean;override;
{$ifndef FPCONLY}
function GetLibsLCL(LCL_Platform:string; Basepath:string):boolean;override;
{$endif}
function GetBinUtils(Basepath:string):boolean;override;
constructor Create;
destructor Destroy; override;
end;
{ TAny_Embeddedaarch64 }
function TAny_Embeddedaarch64.GetLibs(Basepath:string): boolean;
const
LibName='libgcc.a'; // is this correct ??
begin
// Arm-embedded does not need libs by default, but user can add them.
result:=FLibsFound;
if result then exit;
if (FSubArch<>TSUBARCH.saNone) then
begin
ShowInfo('Cross-libs: We have a subarch: '+SubArchName);
end
else ShowInfo('Cross-libs: No subarch defined. Expect fatal errors.',etError);
// begin simple: check presence of library file in basedir
result:=SearchLibrary(Basepath,LibName);
// search local paths based on libraries provided for or adviced by fpc itself
if not result then
if (FSubArch<>TSUBARCH.saNone) then result:=SimpleSearchLibrary(BasePath,IncludeTrailingPathDelimiter(DirName)+SubArchName,LibName);
if not result then
result:=SimpleSearchLibrary(BasePath,DirName,LibName);
if result then
begin
FLibsFound:=True;
SearchLibraryInfo(true);
if PerformLibraryPathMagic then
begin
AddFPCCFGSnippet('-Fl'+IncludeTrailingPathDelimiter(FLibsPath));
end
else
begin
// If we do not have magic, add subarch to enclose
AddFPCCFGSnippet('#IFDEF CPU'+UpperCase(SubArchName));
AddFPCCFGSnippet('-Fl'+IncludeTrailingPathDelimiter(FLibsPath));
AddFPCCFGSnippet('#ENDIF CPU'+UpperCase(SubArchName));
end;
end;
if not result then
begin
//libs path is optional; it can be empty
ShowInfo('Libspath ignored; it is optional for this cross compiler.');
FLibsPath:='';
FLibsFound:=True;
result:=true;
end;
end;
{$ifndef FPCONLY}
function TAny_Embeddedaarch64.GetLibsLCL(LCL_Platform: string; Basepath: string): boolean;
begin
// todo: get gtk at least, add to FFPCCFGSnippet
ShowInfo('Todo: implement lcl libs path from basepath '+BasePath,etdebug);
result:=inherited;
end;
{$endif}
function TAny_Embeddedaarch64.GetBinUtils(Basepath:string): boolean;
var
AsFile: string;
BinPrefixTry: string;
{$ifdef unix}
i:integer;
{$endif unix}
begin
result:=inherited;
if result then exit;
// Start with any names user may have given
AsFile:=FBinUtilsPrefix+'as'+GetExeExt;
result:=SearchBinUtil(BasePath,AsFile);
if not result then result:=SimpleSearchBinUtil(BasePath,DirName,AsFile);
{$ifdef unix}
// User may also have placed them into their regular search path:
if not result then
begin
for i:=Low(UnixBinDirs) to High(UnixBinDirs) do
begin
result:=SearchBinUtil(IncludeTrailingPathDelimiter(UnixBinDirs[i])+DirName, AsFile);
if not result then result:=SearchBinUtil(UnixBinDirs[i], AsFile);
if result then break;
end;
end;
{$endif unix}
// Now also allow for arm-none-eabi- binutilsprefix (e.g. launchpadlibrarian)
if not result then
begin
BinPrefixTry:='aarch64-elf-';
AsFile:=BinPrefixTry+'as'+GetExeExt;
result:=SearchBinUtil(BasePath,AsFile);
if not result then result:=SimpleSearchBinUtil(BasePath,DirName,AsFile);
if result then FBinUtilsPrefix:=BinPrefixTry;
end;
// Now also allow for empty binutilsprefix in the right directory:
if not result then
begin
BinPrefixTry:='';
AsFile:=BinPrefixTry+'as'+GetExeExt;
result:=SearchBinUtil(BasePath,AsFile);
if not result then result:=SimpleSearchBinUtil(BasePath,DirName,AsFile);
if result then FBinUtilsPrefix:=BinPrefixTry;
end;
SearchBinUtilsInfo(result);
if not result then
begin
FAlreadyWarned:=true;
end
else
begin
FBinsFound:=true;
// Configuration snippet for FPC
AddFPCCFGSnippet('-FD'+IncludeTrailingPathDelimiter(FBinUtilsPath));
AddFPCCFGSnippet('-XP'+FBinUtilsPrefix); {Prepend the binutils names};
end;
end;
constructor TAny_Embeddedaarch64.Create;
begin
inherited Create;
FTargetCPU:=TCPU.aarch64;
FTargetOS:=TOS.embedded;
Reset;
FAlreadyWarned:=false;
ShowInfo;
end;
destructor TAny_Embeddedaarch64.Destroy;
begin
inherited Destroy;
end;
var
Any_Embeddedaarch64:TAny_Embeddedaarch64;
initialization
Any_Embeddedaarch64:=TAny_Embeddedaarch64.Create;
RegisterCrossCompiler(Any_Embeddedaarch64.RegisterName,Any_Embeddedaarch64);
finalization
Any_Embeddedaarch64.Destroy;
end.
| 30.009434 | 137 | 0.759352 |
47a2224cd44a1b268efe35fd0d74dc5da6a7da2b | 14,852 | pas | Pascal | Source/CE_DriveBar.pas | jaksco/cubicexplorer | 7bf2513700477d753fd8ea1c6226ddab0175df91 | [
"Condor-1.1"
]
| 1 | 2021-09-23T17:32:49.000Z | 2021-09-23T17:32:49.000Z | Source/CE_DriveBar.pas | jaksco/cubicexplorer | 7bf2513700477d753fd8ea1c6226ddab0175df91 | [
"Condor-1.1"
]
| null | null | null | Source/CE_DriveBar.pas | jaksco/cubicexplorer | 7bf2513700477d753fd8ea1c6226ddab0175df91 | [
"Condor-1.1"
]
| null | null | null | //******************************************************************************
// CubicExplorer
// Version: 0.90
//
// 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 CE_DriveBar.pas.
//
// The Initial Developer of the Original Code is Marko Savolainen (cubicreality@gmail.com).
// Portions created by Marko Savolainen Copyright (C) Marko Savolainen. All Rights Reserved.
//
//******************************************************************************
unit CE_DriveBar;
interface
uses
// CE Units
CE_GlobalCtrl, dCE_Actions, CE_VistaFuncs, dCE_Images, CE_Toolbar,
// Toolbar2K
TB2Item,
// SpTBXLib
SpTBXItem, SpTBXSkins,
// VSTools
MPCommonUtilities, MPCommonObjects, MPShellUtilities, VirtualShellNotifier,
VirtualResources,
// Tnt Ctrls
TntWideStrUtils,
// System Units
Classes, Graphics, ImgList, Windows, ShlObj, SysUtils, Controls, Messages,
ActiveX;
type
TCEShellToolbarItem = class(TSpTBXCustomItem)
private
fDriveLetter: WideString;
fIsDrive: Boolean;
fShortName: Boolean;
protected
procedure DoDrawCaption(ACanvas: TCanvas; ClientAreaRect: TRect; State:
TSpTBXSkinStatesType; var ACaption: WideString; var CaptionRect: TRect; var
CaptionFormat: Cardinal; IsTextRotated: Boolean; const PaintStage:
TSpTBXPaintStage; var PaintDefault: Boolean); override;
procedure DoDrawImage(ACanvas: TCanvas; State: TSpTBXSkinStatesType; const
PaintStage: TSpTBXPaintStage; var AImageList: TCustomImageList; var
AImageIndex: Integer; var ARect: TRect; var PaintDefault: Boolean);
override;
public
Namespace: TNamespace;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Click; override;
procedure LoadNamespacePIDL(APIDL: PItemIDList);
procedure LoadNamespace(Path: WideString);
property DriveLetter: WideString read fDriveLetter write fDriveLetter;
property IsDrive: Boolean read fIsDrive write fIsDrive;
property ShortName: Boolean read fShortName write fShortName;
end;
TCEDriceBarSettings = class;
TCEDriveToolbar = class(TCEToolbar)
protected
function CanItemClick(Item: TTBCustomItem; Button: TMouseButton; Shift:
TShiftState; X, Y: Integer): Boolean; override;
procedure DoItemClick(Item: TTBCustomItem; Button: TMouseButton; Shift:
TShiftState; X, Y: Integer); override;
procedure SetLargeImages(const Value: Boolean); override;
procedure WMShellNotify(var Msg: TMessage); message WM_SHELLNOTIFY;
public
Settings: TCEDriceBarSettings;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure HandleContextMenuCmd(Namespace: TNamespace; Verb: WideString;
MenuItemID: Integer; var Handled: Boolean);
procedure HandleContextMenuShow(Namespace: TNamespace; Menu: hMenu; var Allow:
Boolean);
procedure Populate;
end;
TCEDriceBarSettings = class(TPersistent)
private
fOpenInNewTab: Boolean;
published
property OpenInNewTab: Boolean read fOpenInNewTab write fOpenInNewTab;
end;
implementation
uses
fCE_FolderPanel, Main, CE_AppSettings;
{*------------------------------------------------------------------------------
Create an instance of TCEShellToolbarItem
-------------------------------------------------------------------------------}
constructor TCEShellToolbarItem.Create(AOwner: TComponent);
begin
inherited;
end;
{*------------------------------------------------------------------------------
Destroy an instance of TCEShellToolbarItem
-------------------------------------------------------------------------------}
destructor TCEShellToolbarItem.Destroy;
begin
if assigned(Namespace) then
FreeAndNil(Namespace);
inherited;
end;
{*------------------------------------------------------------------------------
Handle Click
-------------------------------------------------------------------------------}
procedure TCEShellToolbarItem.Click;
begin
inherited;
if assigned(Namespace) then
begin
if MainForm.DriveToolbar.Settings.OpenInNewTab then
OpenFolderInTab(self, Namespace.AbsolutePIDL, MainForm.TabSet.Settings.OpenTabSelect)
else
GlobalPathCtrl.ChangeGlobalPathPIDL(self.Owner,Namespace.AbsolutePIDL);
end;
end;
{*------------------------------------------------------------------------------
Get's called when Caption is drawn
-------------------------------------------------------------------------------}
procedure TCEShellToolbarItem.DoDrawCaption(ACanvas: TCanvas; ClientAreaRect:
TRect; State: TSpTBXSkinStatesType; var ACaption: WideString; var
CaptionRect: TRect; var CaptionFormat: Cardinal; IsTextRotated: Boolean;
const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean);
begin
// if assigned(Namespace) then
// begin
// if IsDrive and ShortName then
// Caption:= DriveLetter
// else
// Caption:= Namespace.NameNormal;
// end;
inherited;
end;
{*------------------------------------------------------------------------------
Get's called when Image is drawn
-------------------------------------------------------------------------------}
procedure TCEShellToolbarItem.DoDrawImage(ACanvas: TCanvas; State:
TSpTBXSkinStatesType; const PaintStage: TSpTBXPaintStage; var AImageList:
TCustomImageList; var AImageIndex: Integer; var ARect: TRect; var
PaintDefault: Boolean);
begin
if assigned(Namespace) then
AImageIndex:= Namespace.GetIconIndex(false,icSmall);
inherited;
end;
{*------------------------------------------------------------------------------
Load namespace from PIDL
-------------------------------------------------------------------------------}
procedure TCEShellToolbarItem.LoadNamespacePIDL(APIDL: PItemIDList);
begin
if assigned(Namespace) then
FreeAndNil(Namespace);
Namespace:= TNamespace.Create(APIDL,nil);
Caption:= Namespace.NameNormal;
ImageIndex:= Namespace.GetIconIndex(false,icSmall);
end;
{*------------------------------------------------------------------------------
Load namespace from path
-------------------------------------------------------------------------------}
procedure TCEShellToolbarItem.LoadNamespace(Path: WideString);
begin
if assigned(Namespace) then
FreeAndNil(Namespace);
Namespace:= TNamespace.CreateFromFileName(Path);
ImageIndex:= Namespace.GetIconIndex(false,icSmall);
end;
{##############################################################################}
{-------------------------------------------------------------------------------
Create an instance of TCEDriveToolbar
-------------------------------------------------------------------------------}
constructor TCEDriveToolbar.Create(AOwner: TComponent);
begin
inherited;
Customizable:= false;
SetVistaFont(Font);
Images:= SmallSysImages;
Settings:= TCEDriceBarSettings.Create;
GlobalAppSettings.AddItem('DriveBar', Settings, false);
ChangeNotifier.RegisterShellChangeNotify(Self);
end;
{-------------------------------------------------------------------------------
Destroy TCEDriveToolbar
-------------------------------------------------------------------------------}
destructor TCEDriveToolbar.Destroy;
begin
ChangeNotifier.UnRegisterShellChangeNotify(Self);
Settings.Free;
inherited;
end;
{*------------------------------------------------------------------------------
Can Item Click
-------------------------------------------------------------------------------}
function TCEDriveToolbar.CanItemClick(Item: TTBCustomItem; Button:
TMouseButton; Shift: TShiftState; X, Y: Integer): Boolean;
begin
if (Button = mbMiddle) or (Shift = [ssAlt,ssLeft]) or (Button = mbRight) then
Result:= false
else
Result:= true;
end;
{*------------------------------------------------------------------------------
Do Item Click
-------------------------------------------------------------------------------}
procedure TCEDriveToolbar.DoItemClick(Item: TTBCustomItem; Button:
TMouseButton; Shift: TShiftState; X, Y: Integer);
var
shitem: TCEShellToolbarItem;
begin
if (Button = mbMiddle) or (Shift = [ssAlt,ssLeft]) then
begin
if Item is TCEShellToolbarItem then
begin
shitem:= TCEShellToolbarItem(Item);
if assigned(shitem.Namespace) then
OpenFolderInTab(self,shitem.Namespace.AbsolutePIDL, MainForm.TabSet.Settings.OpenTabSelect);
end;
end
else if Button = mbRight then
begin
if Item is TCEShellToolbarItem then
begin
shitem:= TCEShellToolbarItem(Item);
if assigned(shitem.Namespace) then
shitem.Namespace.ShowContextMenu(Self, HandleContextMenuCmd, HandleContextMenuShow,nil);
end;
end;
end;
{-------------------------------------------------------------------------------
Handle ContextMenuCmd
-------------------------------------------------------------------------------}
procedure TCEDriveToolbar.HandleContextMenuCmd(Namespace: TNamespace; Verb:
WideString; MenuItemID: Integer; var Handled: Boolean);
begin
DoGlobalContextMenuCmd(Self, Namespace, Verb, MenuItemID, Handled);
end;
{-------------------------------------------------------------------------------
Handle ContextMenuShow
-------------------------------------------------------------------------------}
procedure TCEDriveToolbar.HandleContextMenuShow(Namespace: TNamespace; Menu:
hMenu; var Allow: Boolean);
begin
DoGlobalContextMenuShow(Self, Namespace, Menu, Allow);
end;
{*------------------------------------------------------------------------------
Populate Toolbar
-------------------------------------------------------------------------------}
procedure TCEDriveToolbar.Populate;
const
FLAGS = SHCONTF_FOLDERS;
var
Desktop, Folder: IShellFolder;
EnumIDList: IEnumIDList;
PIDL, SubPIDL: PItemIDList;
celtFetched: LongWord;
NS: TNamespace;
IsFloppy, IsDrive: Boolean;
//IsReadOnly: Boolean;
item: TCEShellToolbarItem;
begin
Self.BeginUpdate;
Self.Items.Clear;
try
SHGetDesktopFolder(Desktop);
SHGetSpecialFolderLocation(0, CSIDL_DRIVES, PIDL);
if Assigned(PIDL) then
begin
if Desktop.BindToObject(PIDL, nil, IShellFolder, Pointer(Folder)) = S_OK then
begin
if Folder.EnumObjects(0, FLAGS, EnumIDList) = NOERROR then
begin
while EnumIDList.Next(1, SubPIDL, celtFetched) = NOERROR do
begin
NS:= TNamespace.Create(PIDLMgr.AppendPIDL(PIDL, SubPIDL), nil);
IsDrive := WideIsDrive(NS.NameForParsing);
IsFloppy := IsDrive and (Char(NS.NameForParsing[1]) in ['A', 'B']);
//IsReadOnly := (not IsFloppy) and NS.ReadOnly;
if IsDrive and not IsFloppy then
begin
item:= TCEShellToolbarItem.Create(Self);
item.IsDrive:= true;
item.Namespace:= NS;
item.DriveLetter:= NS.NameForParsing[1];
item.ShortName:= true;
item.Caption:= item.DriveLetter;
item.Hint:= NS.NameInFolder;
item.ImageIndex:= item.Namespace.GetIconIndex(false,icSmall);
if LargeImages then
item.Images:= LargeSysImages
else
item.Images:= SmallSysImages;
item.DisplayMode:= nbdmImageAndText;
Self.Items.Add(item);
end
else
NS.Free;
CoTaskMemFree(SubPIDL);
end
end
end;
CoTaskMemFree(PIDL);
end;
finally
Self.Realign;
Self.EndUpdate;
end;
end;
{##############################################################################}
{-------------------------------------------------------------------------------
Set Large Images
-------------------------------------------------------------------------------}
procedure TCEDriveToolbar.SetLargeImages(const Value: Boolean);
var
i: Integer;
begin
Inherited;
for i:= 0 to Self.Items.Count - 1 do
begin
if Self.Items.Items[i] is TCEShellToolbarItem then
begin
if LargeImages then
TCEShellToolbarItem(Self.Items.Items[i]).Images:= LargeSysImages
else
TCEShellToolbarItem(Self.Items.Items[i]).Images:= SmallSysImages;
end;
end;
end;
{*------------------------------------------------------------------------------
Handle WMShellNotify messages
-------------------------------------------------------------------------------}
procedure TCEDriveToolbar.WMShellNotify(var Msg: TMessage);
var
ShellEventList: TVirtualShellEventList;
ShellEvent: TVirtualShellEvent;
List: TList;
i, Count: Integer;
begin
ShellEventList := TVirtualShellEventList( Msg.wParam);
List := ShellEventList.LockList;
try
Count := List.Count;
for i := 0 to Count - 1 do
begin
ShellEvent := TVirtualShellEvent(List.Items[i]);
case ShellEvent.ShellNotifyEvent of
vsneDriveAdd,vsneDriveAddGUI,vsneDriveRemoved,vsneUpdateImage,vsneUpdateDir: Populate;
end;
end;
finally
ShellEventList.UnlockList;
ShellEventList.Release;
end;
end;
end.
| 37.505051 | 102 | 0.520536 |
830d733fce16a52f37cf5cba685ce13470ceee6a | 465 | pas | Pascal | So17_Baitap8a.pas | BigBadWolf15/PascalBasic | de90560ecf9e77f8f87b61936034f97ac9092380 | [
"MIT"
]
| null | null | null | So17_Baitap8a.pas | BigBadWolf15/PascalBasic | de90560ecf9e77f8f87b61936034f97ac9092380 | [
"MIT"
]
| 1 | 2017-10-10T12:12:56.000Z | 2017-10-10T12:14:13.000Z | So17_Baitap8a.pas | BigBadWolf15/Pascal-Basic | de90560ecf9e77f8f87b61936034f97ac9092380 | [
"MIT"
]
| null | null | null | {
Created by Le Thanh Trung - 11 Ly 1 - 04/12/2020
}
program tam_a;
uses crt;
var a, b, n, i : longint;
flip: boolean;
begin
clrscr;
write('Nhap N: '); readln(n);
a:= 1;
write(a,' ');
if n < 2 then exit;
b:= 1;
write(b,' ');
if n < 3 then exit;
for i:= 3 to n do begin
if flip then begin
a:= a + b;
write(a,' ');
end else begin
b:= a + b;
write(b,' ');
end;
flip:= not(flip);
end;
readln;
end. | 13.676471 | 50 | 0.498925 |
475d25e124feb4e6fd170102a84c95f9fcea8202 | 527 | dfm | Pascal | Samples/Basic/JWTDemo.Form.Main.dfm | cchiele/delphi-jose-jwt | 0d6faf9d491a0cbe36780cf0edc448cb97f6ec89 | [
"Apache-2.0"
]
| 3 | 2021-02-18T19:44:17.000Z | 2021-06-29T17:45:38.000Z | Samples/Basic/JWTDemo.Form.Main.dfm | cchiele/delphi-jose-jwt | 0d6faf9d491a0cbe36780cf0edc448cb97f6ec89 | [
"Apache-2.0"
]
| null | null | null | Samples/Basic/JWTDemo.Form.Main.dfm | cchiele/delphi-jose-jwt | 0d6faf9d491a0cbe36780cf0edc448cb97f6ec89 | [
"Apache-2.0"
]
| null | null | null | object frmMain: TfrmMain
Left = 0
Top = 0
Caption = 'JWT Demo'
ClientHeight = 725
ClientWidth = 957
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object pgcMain: TPageControl
Left = 0
Top = 0
Width = 957
Height = 725
Align = alClient
Style = tsFlatButtons
TabOrder = 0
ExplicitWidth = 839
end
end
| 18.821429 | 32 | 0.656546 |
83af05d713c8a64ceee0b16332f29679ee4946fd | 428 | dpr | Pascal | Installer/OfflineInstaller.dpr | PassByYou888/zInstaller | 68c70a89f5c98834542f3417802a23bf0fb75638 | [
"MIT"
]
| 12 | 2019-10-05T12:37:30.000Z | 2021-09-03T12:06:51.000Z | Installer/OfflineInstaller.dpr | PassByYou888/zInstaller | 68c70a89f5c98834542f3417802a23bf0fb75638 | [
"MIT"
]
| null | null | null | Installer/OfflineInstaller.dpr | PassByYou888/zInstaller | 68c70a89f5c98834542f3417802a23bf0fb75638 | [
"MIT"
]
| 8 | 2019-10-09T06:50:59.000Z | 2021-02-06T07:57:12.000Z | program OfflineInstaller;
uses
System.StartUpCopy,
FMX.Forms,
OfflineInstallMainFrm in 'OfflineInstallMainFrm.pas' {OfflineInstallMainForm},
StyleModuleUnit in 'StyleModuleUnit.pas' {StyleDataModule: TDataModule};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TStyleDataModule, StyleDataModule);
Application.CreateForm(TOfflineInstallMainForm, OfflineInstallMainForm);
Application.Run;
end.
| 25.176471 | 80 | 0.810748 |
83b850c06e31e1ebf108c25c31a47ab18d4ec652 | 1,877 | dfm | Pascal | windows/src/ext/jedi/jvcl/jvcl/examples/JvDocking/VCDemo/Source/RegistersUnit.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/jvcl/examples/JvDocking/VCDemo/Source/RegistersUnit.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/jvcl/examples/JvDocking/VCDemo/Source/RegistersUnit.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | object RegistersForm: TRegistersForm
Left = 490
Top = 233
Width = 257
Height = 211
BorderStyle = bsSizeToolWin
Caption = 'Registers'
Color = clBtnFace
DockSite = True
DragKind = dkDock
DragMode = dmAutomatic
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Shell Dlg 2'
Font.Style = []
FormStyle = fsStayOnTop
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Memo1: TMemo
Left = 0
Top = 0
Width = 249
Height = 184
Align = alClient
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
Lines.Strings = (
' EAX = 004178D0 EBX = 7FFDF000'
' ECX = 004178D0 EDX = 001334F8'
' ESI = 00000000 EDI = 00000000'
' EIP = 5F4334D5 ESP = 0012FEF0'
' EBP = 0012FF08 EFL = 00000202 CS = 001B'
' DS = 0023 ES = 0023 SS = 0023 FS = 0038'
' GS = 0000 OV=0 UP=0 EI=1 PL=0 ZR=0 AC=0'
' PE=0 CY=0 ST0 = '
'+0.00000000000000000e+0000'
' ST1 = +0.00000000000000000e+0000'
' ST2 = +0.00000000000000000e+0000'
' ST3 = +0.00000000000000000e+0000'
' ST4 = +0.00000000000000000e+0000'
' ST5 = +0.00000000000000000e+0000'
' ST6 = +0.00000000000000000e+0000'
' ST7 = +0.00000000000000000e+0000'
' CTRL = 027F STAT = 0000 TAGS = FFFF'
' EIP = 00000000 CS = 0000 DS = 0000'
' EDO = 00000000')
ParentFont = False
TabOrder = 0
WordWrap = False
end
object lbDockClient1: TJvDockClient
OnFormShow = lbDockClient1FormShow
OnFormHide = lbDockClient1FormHide
LRDockWidth = 100
TBDockHeight = 100
DirectDrag = True
ShowHint = True
EnableCloseButton = True
EachOtherDock = False
DockStyle = MainForm.JvDockVCStyle1
Left = 176
Top = 64
end
end
| 26.814286 | 48 | 0.625999 |
4712068c6fa4acc00e8d269335dfbd39514ab4cc | 2,089 | dfm | Pascal | windows/src/ext/jedi/jvcl/jvcl/install/JVCLInstall/Debug/ExceptionDlg.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/jvcl/install/JVCLInstall/Debug/ExceptionDlg.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/jvcl/install/JVCLInstall/Debug/ExceptionDlg.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | object ExceptionDialog: TExceptionDialog
Left = 363
Top = 284
ActiveControl = OkBtn
AutoScroll = False
BorderIcons = [biSystemMenu]
Caption = 'ExceptionDialog'
ClientHeight = 255
ClientWidth = 432
Color = clBtnFace
Constraints.MinWidth = 200
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
KeyPreview = True
OldCreateOrder = False
Position = poScreenCenter
ShowHint = True
OnCreate = FormCreate
OnDestroy = FormDestroy
OnKeyDown = FormKeyDown
OnPaint = FormPaint
OnResize = FormResize
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object Bevel1: TBevel
Left = 3
Top = 91
Width = 428
Height = 9
Anchors = [akLeft, akTop, akRight]
Shape = bsTopLine
end
object OkBtn: TButton
Left = 352
Top = 4
Width = 75
Height = 25
Anchors = [akTop, akRight]
Caption = '&OK'
Default = True
ModalResult = 1
TabOrder = 1
end
object DetailsMemo: TMemo
Left = 4
Top = 101
Width = 424
Height = 150
Anchors = [akLeft, akTop, akRight, akBottom]
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentColor = True
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 3
WantReturns = False
WordWrap = False
end
object DetailsBtn: TButton
Left = 352
Top = 60
Width = 75
Height = 25
Hint = 'Show or hide additional information|'
Anchors = [akTop, akRight]
Caption = '&Details'
Enabled = False
TabOrder = 2
OnClick = DetailsBtnClick
end
object TextLabel: TMemo
Left = 56
Top = 8
Width = 281
Height = 75
Hint = 'Use Ctrl+C to copy the report to the clipboard'
Anchors = [akLeft, akTop, akRight]
BorderStyle = bsNone
Ctl3D = True
Lines.Strings = (
'TextLabel')
ParentColor = True
ParentCtl3D = False
ReadOnly = True
TabOrder = 0
WantReturns = False
end
end
| 21.536082 | 59 | 0.640019 |
476dc9c3ca1e56e58b2f141d7364d2d055dcd1ce | 449 | pas | Pascal | uZahl.pas | codingbott/DelphiFizzBuzzDecorator | caf99eeafcdaa0455d9ff61cc6c2d4f78e3adcba | [
"CC0-1.0"
]
| 1 | 2022-02-27T13:07:56.000Z | 2022-02-27T13:07:56.000Z | uZahl.pas | codingbott/DelphiFizzBuzzDecorator | caf99eeafcdaa0455d9ff61cc6c2d4f78e3adcba | [
"CC0-1.0"
]
| null | null | null | uZahl.pas | codingbott/DelphiFizzBuzzDecorator | caf99eeafcdaa0455d9ff61cc6c2d4f78e3adcba | [
"CC0-1.0"
]
| 1 | 2022-02-27T13:07:45.000Z | 2022-02-27T13:07:45.000Z | unit uZahl;
interface
uses
uiFizzBuzz;
type
TZahl = class(TInterfacedObject, IFizzBuzz)
private
fo: IFizzBuzz;
public
constructor Create(o: IFizzBuzz);
function DoIt(i: integer): String;
end;
implementation
uses
SysUtils;
{ TZahl }
constructor TZahl.Create(o: IFizzBuzz);
begin
fo:=o;
end;
function TZahl.DoIt(i: integer): String;
begin
result:=fo.DoIt(i);
if result='' then
result:=inttostr(i);
end;
end.
| 12.135135 | 45 | 0.685969 |
4710bcd15faea2145a0f4db416520f8a3687d66b | 5,134 | pas | Pascal | ThsFramework/BackEnd/Ths.Erp.Database.Table.AyarPrsCinsiyet.pas | 3ddark/Ths-Erp-Framewrok | c6569f7f64db10e423d6cc56e91c54184073a9b4 | [
"Unlicense"
]
| 6 | 2019-07-06T23:08:39.000Z | 2021-05-04T19:42:01.000Z | ThsFramework/BackEnd/Ths.Erp.Database.Table.AyarPrsCinsiyet.pas | 3ddark/Ths-Erp-Framewrok | c6569f7f64db10e423d6cc56e91c54184073a9b4 | [
"Unlicense"
]
| null | null | null | ThsFramework/BackEnd/Ths.Erp.Database.Table.AyarPrsCinsiyet.pas | 3ddark/Ths-Erp-Framewrok | c6569f7f64db10e423d6cc56e91c54184073a9b4 | [
"Unlicense"
]
| 4 | 2019-03-18T16:57:09.000Z | 2022-02-24T02:33:31.000Z | unit Ths.Erp.Database.Table.AyarPrsCinsiyet;
interface
{$I ThsERP.inc}
uses
SysUtils, Classes, Dialogs, Forms, Windows, Controls, Types, DateUtils,
FireDAC.Stan.Param, System.Variants, Data.DB,
Ths.Erp.Database,
Ths.Erp.Database.Table;
type
TAyarPrsCinsiyet = class(TTable)
private
FCinsiyet: TFieldDB;
FIsMan: TFieldDB;
protected
published
constructor Create(OwnerDatabase:TDatabase);override;
public
procedure SelectToDatasource(pFilter: string; pPermissionControl: Boolean=True); override;
procedure SelectToList(pFilter: string; pLock: Boolean; pPermissionControl: Boolean=True); override;
procedure Insert(out pID: Integer; pPermissionControl: Boolean=True); override;
procedure Update(pPermissionControl: Boolean=True); override;
function Clone():TTable;override;
Property Cinsiyet: TFieldDB read FCinsiyet write FCinsiyet;
Property IsMan: TFieldDB read FIsMan write FIsMan;
end;
implementation
uses
Ths.Erp.Constants,
Ths.Erp.Database.Singleton;
constructor TAyarPrsCinsiyet.Create(OwnerDatabase:TDatabase);
begin
TableName := 'ayar_prs_cinsiyet';
SourceCode := '1000';
inherited Create(OwnerDatabase);
FCinsiyet := TFieldDB.Create('cinsiyet', ftString, '', 0, False, False);
FIsMan := TFieldDB.Create('is_man', ftBoolean, False, 0, False, False);
end;
procedure TAyarPrsCinsiyet.SelectToDatasource(pFilter: string; pPermissionControl: Boolean=True);
begin
if IsAuthorized(ptRead, pPermissionControl) then
begin
with QueryOfDS do
begin
Close;
SQL.Clear;
SQL.Text := Database.GetSQLSelectCmd(TableName, [
TableName + '.' + Self.Id.FieldName,
getRawDataByLang(TableName, FCinsiyet.FieldName),
TableName + '.' + FIsMan.FieldName
]) +
'WHERE 1=1 ' + pFilter;
Open;
Active := True;
Self.DataSource.DataSet.FindField(Self.Id.FieldName).DisplayLabel := 'ID';
Self.DataSource.DataSet.FindField(FCinsiyet.FieldName).DisplayLabel := 'Cinsiyet';
Self.DataSource.DataSet.FindField(FIsMan.FieldName).DisplayLabel := 'Erkek?';
end;
end;
end;
procedure TAyarPrsCinsiyet.SelectToList(pFilter: string; pLock: Boolean; pPermissionControl: Boolean=True);
begin
if IsAuthorized(ptRead, pPermissionControl) then
begin
if (pLock) then
pFilter := pFilter + ' FOR UPDATE OF ' + TableName + ' NOWAIT';
with QueryOfList do
begin
Close;
SQL.Text := Database.GetSQLSelectCmd(TableName, [
TableName + '.' + Self.Id.FieldName,
getRawDataByLang(TableName, FCinsiyet.FieldName),
TableName + '.' + FIsMan.FieldName
]) +
'WHERE 1=1 ' + pFilter;
Open;
FreeListContent();
List.Clear;
while NOT EOF do
begin
Self.Id.Value := FormatedVariantVal(FieldByName(Self.Id.FieldName).DataType, FieldByName(Self.Id.FieldName).Value);
FCinsiyet.Value := FormatedVariantVal(FieldByName(FCinsiyet.FieldName).DataType, FieldByName(FCinsiyet.FieldName).Value);
FIsMan.Value := FormatedVariantVal(FieldByName(FIsMan.FieldName).DataType, FieldByName(FIsMan.FieldName).Value);
List.Add(Self.Clone());
Next;
end;
Close;
end;
end;
end;
procedure TAyarPrsCinsiyet.Insert(out pID: Integer; pPermissionControl: Boolean=True);
begin
if IsAuthorized(ptAddRecord, pPermissionControl) then
begin
{$IFDEF CRUD_MODE_SP}
SpInsert.ExecProc;
pID := SpInsert.ParamByName('result').AsInteger;
Self.Notify;
{$ELSE IFDEF CRUD_MODE_PURE_SQL}
with QueryOfInsert do
begin
Close;
SQL.Clear;
SQL.Text := Database.GetSQLInsertCmd(TableName, QUERY_PARAM_CHAR, [
FCinsiyet.FieldName,
FIsMan.FieldName
]);
NewParamForQuery(QueryOfInsert, FCinsiyet);
NewParamForQuery(QueryOfInsert, FIsMan);
Open;
if (Fields.Count > 0) and (not Fields.FieldByName(Self.Id.FieldName).IsNull) then
pID := Fields.FieldByName(Self.Id.FieldName).AsInteger
else
pID := 0;
EmptyDataSet;
Close;
end;
Self.Notify;
{$ENDIF}
end;
end;
procedure TAyarPrsCinsiyet.Update(pPermissionControl: Boolean=True);
begin
if IsAuthorized(ptUpdate, pPermissionControl) then
begin
{$IFDEF CRUD_MODE_SP}
SpUpdate.ExecProc;
Self.Notify;
{$ELSE IFDEF CRUD_MODE_PURE_SQL}
with QueryOfUpdate do
begin
Close;
SQL.Clear;
SQL.Text := Database.GetSQLUpdateCmd(TableName, QUERY_PARAM_CHAR, [
FCinsiyet.FieldName,
FIsMan.FieldName
]);
NewParamForQuery(QueryOfUpdate, FCinsiyet);
NewParamForQuery(QueryOfUpdate, FIsMan);
NewParamForQuery(QueryOfUpdate, Id);
ExecSQL;
Close;
end;
Self.Notify;
{$ENDIF}
end;
end;
function TAyarPrsCinsiyet.Clone():TTable;
begin
Result := TAyarPrsCinsiyet.Create(Database);
Self.Id.Clone(TAyarPrsCinsiyet(Result).Id);
FCinsiyet.Clone(TAyarPrsCinsiyet(Result).FCinsiyet);
FIsMan.Clone(TAyarPrsCinsiyet(Result).FIsMan);
end;
end.
| 27.602151 | 129 | 0.68621 |
834066b36e011138c30abc0d09d5d81ee12f95f8 | 1,015 | pas | Pascal | exemplos/StringGrid/Unit1.pas | vlademirolandim/delphi | 749a077e1339162defcfdeee944e4f0dbb72fcb5 | [
"Apache-2.0"
]
| 1 | 2021-08-18T19:59:30.000Z | 2021-08-18T19:59:30.000Z | exemplos/StringGrid/Unit1.pas | vlademirolandim/delphi | 749a077e1339162defcfdeee944e4f0dbb72fcb5 | [
"Apache-2.0"
]
| null | null | null | exemplos/StringGrid/Unit1.pas | vlademirolandim/delphi | 749a077e1339162defcfdeee944e4f0dbb72fcb5 | [
"Apache-2.0"
]
| 2 | 2021-06-01T07:15:24.000Z | 2021-08-18T19:59:31.000Z | unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Grids;
type
TForm1 = class(TForm)
grdNumeros: TStringGrid;
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
lblNegativos: TLabel;
Button1: TButton;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
l,c,n:integer;
x: Integer;
nContador:integer;
nSorteio:integer;
begin
grdNumeros.RowCount := 100;
grdNumeros.ColCount := 1;
nContador:=0;
for x := 1 to 100 do
begin
nSorteio := random( 100 ) - 50;
grdNumeros.Cells[ 0 , x-1 ] := inttostr( nSorteio );
if nSorteio < 0 then inc( nContador );
end;
lblNegativos.Caption := inttostr( nContador );
end;
end.
| 18.454545 | 98 | 0.678818 |
47856e18afd6634d5a4f904a7d100b3e05706b3d | 3,246 | pas | Pascal | src/libraries/cryptolib4pascal/ClpIDsaParametersGenerator.pas | O1OOO111/PascalCoin | a1725b674c45ebf380c2fb132454439e58f7119a | [
"MIT"
]
| 148 | 2018-02-08T23:36:43.000Z | 2022-03-16T01:33:20.000Z | HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/CryptoLib/src/Interfaces/ClpIDsaParametersGenerator.pas | Ecoent/HODLER-Open-Source-Multi-Asset-Wallet | a8c54ecfc569d0ee959b6f0e7826c4ee4b5c4848 | [
"Unlicense"
]
| 85 | 2018-10-23T17:09:20.000Z | 2022-01-12T07:12:54.000Z | HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/CryptoLib/src/Interfaces/ClpIDsaParametersGenerator.pas | Ecoent/HODLER-Open-Source-Multi-Asset-Wallet | a8c54ecfc569d0ee959b6f0e7826c4ee4b5c4848 | [
"Unlicense"
]
| 46 | 2018-03-18T17:25:59.000Z | 2022-02-07T16:52:15.000Z | { *********************************************************************************** }
{ * 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 ClpIDsaParametersGenerator;
{$I ..\Include\CryptoLib.inc}
interface
uses
ClpISecureRandom,
ClpIDsaParameters,
ClpIDsaParameterGenerationParameters;
type
IDsaParametersGenerator = interface(IInterface)
['{EB5A601B-2267-4485-A519-A80751FC39EA}']
/// <summary>
/// initialise the key generator.
/// </summary>
/// <param name="size">
/// size of the key (range 2^512 -&gt; 2^1024 - 64 bit increments)
/// </param>
/// <param name="certainty">
/// measure of robustness of prime (for FIPS 186-2 compliance this should
/// be at least 80).
/// </param>
/// <param name="random">
/// random byte source.
/// </param>
procedure Init(size, certainty: Int32;
const random: ISecureRandom); overload;
/// <summary>
/// initialise the key generator.
/// </summary>
/// <param name="size">
/// size of the key (range 2^512 -&gt; 2^1024 - 64 bit increments)
/// </param>
/// <param name="certainty">
/// measure of robustness of prime (for FIPS 186-2 compliance this should
/// be at least 80).
/// </param>
/// <param name="iterations">
/// iterations
/// </param>
/// <param name="random">
/// random byte source.
/// </param>
procedure Init(size, certainty, iterations: Int32;
const random: ISecureRandom); overload;
/// <summary>
/// <para>
/// Initialise the key generator for DSA 2.
/// </para>
/// <para>
/// Use this init method if you need to generate parameters for DSA 2
/// keys.
/// </para>
/// </summary>
/// <param name="params">
/// DSA 2 key generation parameters.
/// </param>
procedure Init(const params: IDsaParameterGenerationParameters); overload;
/// <summary>
/// <para>
/// which generates the p and g values from the given parameters,
/// returning the DSAParameters object.
/// </para>
/// <para>
/// Note: can take a while...
/// </para>
/// </summary>
/// <returns>
/// a generated DSA parameters object.
/// </returns>
function GenerateParameters(): IDsaParameters;
end;
implementation
end.
| 32.138614 | 87 | 0.492298 |
8522286517eb8c66559a9c39f007988a8c64a8d5 | 5,917 | pas | Pascal | windows/src/engine/kmcomapi/processes/keyboard/kpuninstallkeyboard.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/engine/kmcomapi/processes/keyboard/kpuninstallkeyboard.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/engine/kmcomapi/processes/keyboard/kpuninstallkeyboard.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | (*
Name: kpuninstallkeyboard
Copyright: Copyright (C) SIL International.
Documentation:
Description:
Create Date: 1 Aug 2006
Modified Date: 3 Feb 2015
Authors: mcdurdin
Related Files:
Dependencies:
Bugs:
Todo:
Notes:
History: 01 Aug 2006 - mcdurdin - Add AutoApplyKeyman call
03 May 2011 - mcdurdin - I2890 - Record diagnostic data when encountering registry errors
28 Nov 2012 - mcdurdin - I3599 - V9.0 - Refactor GetKeyboardIconFileName
28 Nov 2012 - mcdurdin - I3600 - V9.0 - Delete keyboard icon when uninstalling keyboard
01 Dec 2012 - mcdurdin - I3613 - V9.0 - System shadow keyboards obsolete, strip out remaining code
13 Dec 2012 - mcdurdin - I3663 - V9.0 - Uninstall of keyboard does not remove KMTIP entries
24 Apr 2014 - mcdurdin - I4173 - V9 Uninstalling a keyboard leaves the mnemonic recompiled layouts behind
01 May 2014 - mcdurdin - I4181 - V9.0 - Stop using DeleteFileAlways, MOVEFILE_DELAY_UNTIL_REBOOT
03 Feb 2015 - mcdurdin - I4574 - V9.0 - If any files are read-only, they need the read-only flag removed on install
*)
unit kpuninstallkeyboard;
interface
uses kpbase;
type
TKPUninstallOptions = set of (upPartOfPackage);
TKPUninstallKeyboard = class(TKPBase)
procedure Execute(KeyboardName: string; FOptions: TKPUninstallOptions);
end;
implementation
uses
Windows,
SysUtils,
keymancontext,
keymanerrorcodes,
Keyman.System.Process.KPUninstallKeyboardLanguage,
utildir,
utilkeyman,
utilsystem,
isadmin,
ErrorControlledRegistry,
RegistryKeys,
Variants;
procedure TKPUninstallKeyboard.Execute(KeyboardName: string; FOptions: TKPUninstallOptions);
var
FileName, VisualKeyboardFileName, KeyboardFullName, PackageName: string;
FInstByAdmin: Boolean;
Path, FIconFileName: string;
begin
KeyboardName := GetShortKeyboardName(KeyboardName);
if not KeyboardInstalled(KeyboardName, FInstByAdmin) then
ErrorFmt(KMN_E_Uninstall_InvalidKeyboard, VarArrayOf([KeyboardName]));
if FInstByAdmin
then KeyboardFullName := GetKeyboardFullName_LM(KeyboardName)
else KeyboardFullName := GetKeyboardFullName_CU(KeyboardName);
if not (upPartOfPackage in FOptions) and KeyboardIsPartOfPackage(KeyboardName, PackageName) then
ErrorFmt(KMN_E_Uninstall_KeyboardPartOfPackage, VarArrayOf([KeyboardFullName, PackageName]));
{ Check if keyboard was installed by administrator, and if user has permission to delete it }
if FInstByAdmin and not IsAdministrator then
ErrorFmt(KMN_E_Uninstall_AdminKeyboardInstalled, VarArrayOf([KeyboardFullName]));
{ Find install path }
with TRegistryErrorControlled.Create do // I2890
try
if FInstByAdmin then // as determined by where the keyboard was installed
begin
RootKey := HKEY_LOCAL_MACHINE;
Path := '\'+SRegKey_InstalledKeyboards_LM+'\'+KeyboardName;
end
else
begin
RootKey := HKEY_CURRENT_USER;
Path := '\'+SRegKey_InstalledKeyboards_CU+'\'+KeyboardName;
end;
if OpenKey(Path, False) and
ValueExists(SRegValue_KeymanFile) then
FileName := ReadString(SRegValue_KeymanFile)
else
ErrorFmt(KMN_E_Uninstall_InvalidKeyboard, VarArrayOf([KeyboardFullName]));
if ValueExists(SRegValue_VisualKeyboard)
then VisualKeyboardFileName := ReadString(SRegValue_VisualKeyboard)
else VisualKeyboardFileName := '';
finally
Free;
end;
{ Unregister language profiles }
with TKPUninstallKeyboardLanguage.Create(Context) do // I3663
try
UnregisterTip(KeyboardName);
finally
Free;
end;
{ Delete .kmx file }
if not FileExists(FileName) then
WarnFmt(KMN_W_UninstallFileNotFound, VarArrayOf([FileName]))
else if not DeleteFileCleanAttr(FileName) then // I4181 // I4574
begin
WarnFmt(KMN_W_UninstallFileInUse, VarArrayOf([FileName]));
end;
{ Delete .kvk file, if it exists }
if (VisualKeyboardFileName <> '') and FileExists(VisualKeyboardFileName) then // I4173
if not DeleteFileCleanAttr(VisualKeyboardFileName) then // I4181 // I4574
begin
WarnFmt(KMN_W_UninstallFileInUse, VarArrayOf([FileName]));
end;
FIconFileName := GetKeyboardIconFileName(FileName); // I3599
if FileExists(FIconFileName) then // I3600
if not DeleteFileCleanAttr(FIconFileName) then // I4181 // I4574
begin
WarnFmt(KMN_W_UninstallFileInUse, VarArrayOf([FIconFileName]));
end;
{ Delete kmx id from registry }
with TRegistryErrorControlled.Create do // I2890
try
{ Delete keyboards from active keyboard list for all users }
//RemoveActiveKeyboardInfo(KeyboardName); // runs through all users...
{ Delete kmx details from registry }
if FInstByAdmin then // as determined by where the keyboard was installed
begin
RootKey := HKEY_LOCAL_MACHINE;
Path := GetRegistryKeyboardInstallKey_LM(KeyboardName);
end
else
begin
RootKey := HKEY_CURRENT_USER;
Path := GetRegistryKeyboardInstallKey_CU(KeyboardName);
end;
// I3613
if not DeleteKey(Path) then
WarnFmt(KMN_W_UninstallError_UnableToDeleteKeyboardRegistrySetting,
VarArrayOf([KeyboardFullName, Path]));
finally
Free;
end;
{ Remove keyboard directory (if empty) -- it may be part of a package }
if not (upPartOfPackage in FOptions) then
begin
if not RecursiveDelete(ExtractFileDir(FileName)) then // I4173 // I4181
WarnFmt(KMN_W_UninstallError_UnableToRemoveDirectory,
VarArrayOf([KeyboardFullName, SysErrorMessage(GetLastError)]));
end;
{ No start menu entries to remove; No other files to remove; No packages to remove }
Context.Control.AutoApplyKeyman;
end;
end.
| 32.333333 | 135 | 0.710326 |
f13c166fe70ddee76b23dfb73c7656e7d2942888 | 3,159 | pas | Pascal | windows/src/ext/jedi/jvcl/tests/restructured/source/JvHighlighter.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/tests/restructured/source/JvHighlighter.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/tests/restructured/source/JvHighlighter.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | {-----------------------------------------------------------------------------
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/MPL-1.1.html
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: JvAlignListbox.PAS, released on 2000-11-22.
The Initial Developer of the Original Code is Peter Below <100113.1101@compuserve.com>
Portions created by Peter Below are Copyright (C) 2000 Peter Below.
All Rights Reserved.
Contributor(s): ______________________________________.
Last Modified: 2000-mm-dd
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.sourceforge.net
Known Issues:
-----------------------------------------------------------------------------}
{$I JVCL.INC}
unit JvHighlighter;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, JVCLVer;
type
TJvHighlighter = class(TGraphicControl)
private
{ Private declarations }
FFocusControl: TWinControl;
FExtraBorder: Integer;
FAboutJVCL: TJVCLAboutInfo;
protected
{ Protected declarations }
procedure SetFocusControl(value: TWinControl);
procedure SetExtraBorder(value: Integer);
public
{ Public declarations }
procedure Paint; override;
constructor Create(aOwner: TComponent); override;
published
{ Published declarations }
property AboutJVCL: TJVCLAboutInfo read FAboutJVCL write FAboutJVCL stored False;
property FocusControl: TWinControl read FFocusControl write SetFocusControl;
property Color;
property ExtraBorder: Integer read FExtraBorder write SetExtraBorder
default 4;
end;
implementation
{+-------------------------
| Methods of TJvHighlighter
+------------------------}
procedure TJvHighlighter.SetFocusControl(value: TWinControl);
begin
if value = FFocusControl then
Exit;
Hide;
if value <> nil then
begin
FFocusControl := value;
Parent := value.Parent;
SetBounds(value.Left - FExtraBorder,
value.Top - FExtraBorder,
value.Width + 2 * FExtraBorder,
value.Height + 2 * FExtraBorder);
Show;
end { If }
else
Parent := nil;
end; { TJvHighlighter.SetFocusControl }
procedure TJvHighlighter.SetExtraBorder(value: Integer);
begin
if value <> FExtraBorder then
begin
FExtraBorder := value;
Invalidate;
end; { If }
end; { TJvHighlighter.SetExtraBorder }
procedure TJvHighlighter.Paint;
begin
Canvas.Brush.Color := Color;
Canvas.Brush.Style := bsSolid;
Canvas.FillRect(ClientRect);
end; { TJvHighlighter.Paint }
constructor TJvHighlighter.Create(aOwner: TComponent);
begin
inherited Create(aOwner);
ControlStyle := ControlStyle + [csOpaque];
FExtraBorder := 4;
Width := 30;
Height := 30;
Color := clBlue;
end; { TJvHighlighter.Create }
end.
| 28.205357 | 86 | 0.696423 |
47062af21fbe2a20617ac7ddf65ef9d41d825dc0 | 337 | dpr | Pascal | windows/src/ext/jedi/jvcl/jvcl/examples/JvGIFAnimator/RxGIFAnm.dpr | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/jvcl/examples/JvGIFAnimator/RxGIFAnm.dpr | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/jvcl/examples/JvGIFAnimator/RxGIFAnm.dpr | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | program RxGIFAnm;
uses
Forms,
JvExceptionForm,
GifMain in 'GIFMAIN.PAS' {AnimatorForm},
GifPrvw in 'GIFPRVW.PAS' {PreviewForm},
GIFPal in 'GIFPal.pas' {PaletteForm};
{$R *.RES}
begin
JvErrorIntercept;
Application.Title := 'RX GIF Animator';
Application.CreateForm(TAnimatorForm, AnimatorForm);
Application.Run;
end.
| 18.722222 | 54 | 0.727003 |
8536b08c572d9d9aec862f7916762e96398e550e | 865 | pas | Pascal | src/ZapMQ.DataModule.pas | atkins126/ZapMQ | f144e04feda8681c6d1fdc897d8069a53773df40 | [
"MIT"
]
| 8 | 2021-02-18T11:55:26.000Z | 2021-05-14T00:18:43.000Z | src/ZapMQ.DataModule.pas | atkins126/ZapMQ | f144e04feda8681c6d1fdc897d8069a53773df40 | [
"MIT"
]
| null | null | null | src/ZapMQ.DataModule.pas | atkins126/ZapMQ | f144e04feda8681c6d1fdc897d8069a53773df40 | [
"MIT"
]
| 3 | 2021-02-19T06:15:21.000Z | 2021-03-05T08:40:33.000Z | unit ZapMQ.DataModule;
interface
uses
System.SysUtils, System.Classes, Datasnap.DSCommonServer, Datasnap.DSServer,
IPPeerServer, Datasnap.DSHTTP, IdHTTPWebBrokerBridge, Datasnap.DSHTTPWebBroker;
type
TZapDataModule = class(TDataModule)
Server: TDSServer;
Methods: TDSServerClass;
HTTPService: TDSHTTPService;
procedure MethodsGetClass(DSServerClass: TDSServerClass;
var PersistentClass: TPersistentClass);
private
public
{ Public declarations }
end;
var
ZapDataModule: TZapDataModule;
implementation
uses
ZapMQ.Methods, Datasnap.DSSession;
{%CLASSGROUP 'System.Classes.TPersistent'}
{$R *.dfm}
procedure TZapDataModule.MethodsGetClass(DSServerClass: TDSServerClass;
var PersistentClass: TPersistentClass);
begin
PersistentClass := ZapMQ.Methods.TZapMethods;
end;
end.
| 21.097561 | 82 | 0.744509 |
f1f00bc570d3aa2c42ee19fd7f471344fabf1978 | 12,539 | dpr | Pascal | toolkit/FHIRToolkitR4.dpr | atkins126/fhirserver | b6c2527f449ba76ce7c06d6b1c03be86cf4235aa | [
"BSD-3-Clause"
]
| 132 | 2015-02-02T00:22:40.000Z | 2021-08-11T12:08:08.000Z | toolkit/FHIRToolkitR4.dpr | atkins126/fhirserver | b6c2527f449ba76ce7c06d6b1c03be86cf4235aa | [
"BSD-3-Clause"
]
| 113 | 2015-03-20T01:55:20.000Z | 2021-10-08T16:15:28.000Z | toolkit/FHIRToolkitR4.dpr | atkins126/fhirserver | b6c2527f449ba76ce7c06d6b1c03be86cf4235aa | [
"BSD-3-Clause"
]
| 49 | 2015-04-11T14:59:43.000Z | 2021-03-30T10:29:18.000Z | {
Copyright (c) 2017+, Health Intersections Pty Ltd (http://www.healthintersections.com.au)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
}
program FHIRToolkitR4;
uses
{$IFNDEF MACOS}
FastMM4 in '..\dependencies\FMM\FastMM4.pas',
{$ENDIF }
SysUtils,
IdSSLOpenSSLHeaders,
FMX.Forms,
FHIR.Version.Client in '..\library\version\FHIR.Version.Client.pas',
FHIR.Support.Osx in '..\library\support\FHIR.Support.Osx.pas',
fsl_base in '..\library\support\fsl_base.pas',
fsl_stream in '..\library\support\fsl_stream.pas',
fsl_collections in '..\library\support\fsl_collections.pas',
fsl_utilities in '..\library\support\fsl_utilities.pas',
fsl_json in '..\library\support\fsl_json.pas',
FHIR.Version.Parser in '..\library\version\FHIR.Version.Parser.pas',
fhir4_xml in '..\library\r4\fhir4_xml.pas',
fhir_parser in '..\library\base\fhir_parser.pas',
fsl_xml in '..\library\support\fsl_xml.pas',
fsl_turtle in '..\library\support\fsl_turtle.pas',
fhir_objects in '..\library\base\fhir_objects.pas',
fhir4_utilities in '..\library\r4\fhir4_utilities.pas',
fsl_http in '..\library\web\fsl_http.pas',
fsl_fetcher in '..\library\web\fsl_fetcher.pas',
fhir4_context in '..\library\r4\fhir4_context.pas',
fhir4_types in '..\library\r4\fhir4_types.pas',
fhir4_resources in '..\library\r4\fhir4_resources.pas',
fsl_scim in '..\library\base\fsl_scim.pas',
fhir4_constants in '..\library\r4\fhir4_constants.pas',
fhir4_tags in '..\library\r4\fhir4_tags.pas',
FHIR.Base.Lang in '..\library\base\FHIR.Base.Lang.pas',
fhir_xhtml in '..\library\base\fhir_xhtml.pas',
fhir4_json in '..\library\r4\fhir4_json.pas',
fhir4_turtle in '..\library\r4\fhir4_turtle.pas',
fhir4_elementmodel in '..\library\r4\fhir4_elementmodel.pas',
fhir4_profiles in '..\library\r4\fhir4_profiles.pas',
fhir4_pathengine in '..\library\r4\fhir4_pathengine.pas',
MarkdownProcessor in '..\..\markdown\source\MarkdownProcessor.pas',
MarkdownDaringFireball in '..\..\markdown\source\MarkdownDaringFireball.pas',
MarkdownCommonMark in '..\..\markdown\source\MarkdownCommonMark.pas',
fhir_cdshooks in '..\library\cdshooks\fhir_cdshooks.pas',
FastMM4Messages in '..\dependencies\FMM\FastMM4Messages.pas',
OrganizationChooser in 'OrganizationChooser.pas' {OrganizationSelectionForm},
FHIRToolkitForm in 'FHIRToolkitForm.pas' {MasterToolsForm},
ServerForm in 'ServerForm.pas' {ServerFrameForm: TFrame},
BaseFrame in 'BaseFrame.pas',
ValueSetEditor in 'ValueSetEditor.pas' {ValueSetEditorFrame: TFrame},
SearchParameterCombinationEditor in 'SearchParameterCombinationEditor.pas' {SearchParameterCombinationEditorForm},
ListSelector in 'ListSelector.pas' {ListSelectorForm},
fhir4_indexinfo in '..\library\r4\fhir4_indexinfo.pas',
fhir_indexing in '..\library\tools\fhir_indexing.pas',
AddRestResourceDialog in 'AddRestResourceDialog.pas' {AddRestResourceForm},
SourceViewer in 'SourceViewer.pas' {SourceViewerForm},
BaseResourceFrame in 'BaseResourceFrame.pas',
BaseServerFrame in 'BaseServerFrame.pas',
CapabilityStatementEditor in 'CapabilityStatementEditor.pas' {CapabilityStatementEditorFrame: TFrame},
ValuesetExpansion in 'ValuesetExpansion.pas' {ValuesetExpansionForm},
HelpContexts in 'HelpContexts.pas',
ProcessForm in 'ProcessForm.pas' {ProcessingForm},
SettingsDialog in 'SettingsDialog.pas' {FHIR.Npp.Settings},
AboutDialog in 'AboutDialog.pas' {AboutForm},
FHIR.Ui.OSX in '..\library\ui\FHIR.Ui.OSX.pas',
ValuesetSelectDialog in 'ValuesetSelectDialog.pas' {ValuesetSelectForm},
MemoEditorDialog in 'MemoEditorDialog.pas' {MemoEditorForm},
fhir_client_registry in '..\library\client\fhir_client_registry.pas',
FHIR.Client.ServerDialogFMX in '..\library\client\FHIR.Client.ServerDialogFMX.pas' {EditRegisteredServerForm},
ToolkitSettings in 'ToolkitSettings.pas',
CodeSystemEditor in 'CodeSystemEditor.pas' {CodeSystemEditorFrame: TFrame},
CodeSystemConceptDialog in 'CodeSystemConceptDialog.pas' {CodeSystemConceptForm},
ResourceEditingSupport in 'ResourceEditingSupport.pas',
ToolKitUtilities in 'ToolKitUtilities.pas',
UpgradeNeededDialog in 'UpgradeNeededDialog.pas' {UpgradeNeededForm},
QuestionnaireEditor in 'QuestionnaireEditor.pas' {QuestionnaireEditorFrame: TFrame},
fhir_htmlgen in '..\library\web\fhir_htmlgen.pas',
QuestionnaireItemDialog in 'QuestionnaireItemDialog.pas' {QuestionnaireItemForm},
ProviderDirectoryForm in 'ProviderDirectoryForm.pas' {ProviderDirectoryFrame},
FHIR.Client.ClientDialogFMX in '..\library\client\FHIR.Client.ClientDialogFMX.pas' {RegisterClientForm},
QuestionnaireItemPanel in 'QuestionnaireItemPanel.pas',
QuestionnairePanel in 'QuestionnairePanel.pas',
VitalSignsGeneratorDialog in 'VitalSignsGeneratorDialog.pas' {VitalSignsGeneratorForm},
TranslationsEditorDialog in 'TranslationsEditorDialog.pas' {TranslationsEditorForm},
ResourceLanguageDialog in 'ResourceLanguageDialog.pas' {ResourceLanguageForm},
AddRestOperationDialog in 'AddRestOperationDialog.pas' {AddRestOperationForm},
RegistryForm in 'RegistryForm.pas' {RegistryFrame: TFrame},
FHIR.Ui.ComboFMX in '..\library\ui\FHIR.Ui.ComboFMX.pas',
PatientHomeForm in 'PatientHomeForm.pas' {PatientHomeFrame: TFrame},
FHIR.Support.Signatures in '..\library\support\FHIR.Support.Signatures.pas',
DocumentGenerationForm in 'DocumentGenerationForm.pas' {DocumentGeneratorForm},
LibraryEditor in 'LibraryEditor.pas' {LibraryEditorFrame: TFrame},
fsl_ucum in '..\library\ucum\fsl_ucum.pas',
fhir4_pathnode in '..\library\r4\fhir4_pathnode.pas',
fsl_logging in '..\library\support\fsl_logging.pas',
fhir4_questionnaire2 in '..\library\r4\fhir4_questionnaire2.pas',
fhir4_base in '..\library\r4\fhir4_base.pas',
fhir4_parserBase in '..\library\r4\fhir4_parserBase.pas',
fhir4_parser in '..\library\r4\fhir4_parser.pas',
fhir_client in '..\library\client\fhir_client.pas',
fhir_client_http in '..\library\client\fhir_client_http.pas',
fhir_client_threaded in '..\library\client\fhir_client_threaded.pas',
fhir4_client in '..\library\r4\fhir4_client.pas',
fsl_xml in '..\library\support\fsl_xml.pas',
fsl_wininet in '..\library\web\fsl_wininet.pas',
fsl_threads in '..\library\support\fsl_threads.pas',
FHIR.Support.Certs in '..\library\support\FHIR.Support.Certs.pas',
fsl_graphql in '..\library\web\fsl_graphql.pas',
BulkDataForm in 'BulkDataForm.pas' {BulkDataDialog},
UsageContextForm in 'UsageContextForm.pas' {UsageContextDialog},
fhir_factory in '..\library\base\fhir_factory.pas',
fhir_validator in '..\library\base\fhir_validator.pas',
fhir_common in '..\library\base\fhir_common.pas',
fhir_narrative in '..\library\base\fhir_narrative.pas',
fhir_pathengine in '..\library\base\fhir_pathengine.pas',
fhir4_common in '..\library\r4\fhir4_common.pas',
fhir4_factory in '..\library\r4\fhir4_factory.pas',
fhir4_narrative in '..\library\r4\fhir4_narrative.pas',
fhir4_validator in '..\library\r4\fhir4_validator.pas',
fhir_client_async in '..\library\client\fhir_client_async.pas',
fsl_npm_cache in '..\library\npm\fsl_npm_cache.pas',
TransformationFrame in 'TransformationFrame.pas' {TransformationEngineFrame: TFrame},
ValidationFrame in 'ValidationFrame.pas' {ValidationEngineFrame: TFrame},
PackageManagerFrame in 'PackageManagerFrame.pas' {PackageManagerFrame: TFrame},
FHIR.Tools.ValidationWrapper in '..\library\tools\FHIR.Tools.ValidationWrapper.pas',
PackageBrowser in 'PackageBrowser.pas' {PackageFinderForm},
fsl_fpc in '..\library\support\fsl_fpc.pas',
fhir_utilities in '..\library\base\fhir_utilities.pas',
fhir_oauth in '..\library\smart\fhir_oauth.pas',
FHIR.Smart.Login in '..\library\smart\FHIR.Smart.Login.pas',
fhir4_operations in '..\library\r4\fhir4_operations.pas',
fhir4_opbase in '..\library\r4\fhir4_opbase.pas',
OsxPopupmenuWorkaround in 'OsxPopupmenuWorkaround.pas' {PopupMenuWorkaroundForm},
fhir4_authmap in '..\library\r4\fhir4_authmap.pas',
{$IFNDEF OSX}
IGPublisher in 'IGPublisher.pas' {IGPublishForm},
{$ENDIF }
FDownloadForm in 'FDownloadForm.pas' {IGSettingsForm},
ImplementationGuideEditor in 'ImplementationGuideEditor.pas' {ImplementationGuideEditorFrame: TFrame},
FHIR.Support.Lang in '..\library\support\FHIR.Support.Lang.pas',
QuestionnaireContextDialog in 'QuestionnaireContextDialog.pas' {QuestionnaireContextForm},
FHIR.Ui.Graph in '..\library\ui\FHIR.Ui.Graph.pas',
FHIR.Tools.ObsGraph in '..\library\tools\FHIR.Tools.ObsGraph.pas',
DiffEngineFrame in 'DiffEngineFrame.pas' {DiffEngineEngineFrame: TFrame},
fhir_diff in '..\library\tools\fhir_diff.pas',
Import2html in 'Import2html.pas' {ContentImport},
ExampleScenarioEditor in 'ExampleScenarioEditor.pas' {exampleScenarioEditorFrame: TFrame},
ScenarioRendering in 'ScenarioRendering.pas' {ESPublishForm},
cda_narrative in '..\library\cda\cda_narrative.pas',
cda_types in '..\library\cda\cda_types.pas',
cda_base in '..\library\cda\cda_base.pas',
fhir_oids in '..\library\base\fhir_oids.pas',
fhir_elementmodel in '..\library\base\fhir_elementmodel.pas',
ResourceHistoryDialog in 'ResourceHistoryDialog.pas' {ResourceHistoryForm},
MarkdownHTMLEntities in '..\..\markdown\source\MarkdownHTMLEntities.pas',
FHIR.Ui.Fmx in '..\library\ui\FHIR.Ui.Fmx.pas',
ProjectFilesDialog in 'ProjectFilesDialog.pas' {ProjectDialog},
UTGMgmtFrame in 'UTGMgmtFrame.pas' {UTGManagementFrame: TFrame},
{$IFNDEF OSX}
uGitForDelphi in '..\dependencies\git\uGitForDelphi.pas',
FHIR.Web.Git in '..\library\web\FHIR.Web.Git.pas',
fsl_shell in '..\library\support\fsl_shell.pas',
{$ENDIF }
fhir4_organiser in '..\library\r4\fhir4_organiser.pas',
BaseFileFrame in 'BaseFileFrame.pas',
PackageEditorFrame in 'PackageEditorFrame.pas' {PackageEditorFrame: TFrame},
fsl_npm in '..\library\npm\fsl_npm.pas',
NamingSystemEditor in 'NamingSystemEditor.pas' {NamingSystemEditorFrame: TFrame},
FHIR.Npm.Client in '..\library\npm\FHIR.Npm.Client.pas',
fhir4_resources_canonical in '..\library\r4\fhir4_resources_canonical.pas',
fhir4_resources_base in '..\library\r4\fhir4_resources_base.pas',
fhir4_resources_admin in '..\library\r4\fhir4_resources_admin.pas',
fhir4_resources_other in '..\library\r4\fhir4_resources_other.pas',
fhir4_resources_medications in '..\library\r4\fhir4_resources_medications.pas',
fhir4_resources_financial in '..\library\r4\fhir4_resources_financial.pas',
fhir4_resources_clinical in '..\library\r4\fhir4_resources_clinical.pas',
MarkdownUnicodeUtils in '..\..\markdown\source\MarkdownUnicodeUtils.pas';
{$R *.res}
begin
{$IFDEF WINDOWS}
IdOpenSSLSetLibPath(extractFilePath(paramstr(0)));
{$ENDIF}
Application.Initialize;
Application.CreateForm(TMasterToolsForm, MasterToolsForm);
Application.CreateForm(TResourceHistoryForm, ResourceHistoryForm);
Application.CreateForm(TProjectDialog, ProjectDialog);
Application.Run;
end.
| 58.050926 | 117 | 0.767844 |
Subsets and Splits
HTML Code Excluding Scripts
The query retrieves a limited set of HTML content entries that are longer than 8 characters and do not contain script tags, offering only basic filtering with minimal analytical value.