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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fc03dd83c1e8aa78c2000682fefb1248e4dd5b77 | 5,282 | pas | Pascal | library/fhir4b/tests/fhir4b_tests_liquid.pas | HealthIntersections/fhirserver | 759bf1a270bca48b3ef97385074cfc0b37fae0dc | [
"BSD-3-Clause"
]
| 5 | 2021-11-16T22:35:26.000Z | 2022-02-16T08:40:37.000Z | library/fhir4b/tests/fhir4b_tests_liquid.pas | HealthIntersections/fhirserver | 759bf1a270bca48b3ef97385074cfc0b37fae0dc | [
"BSD-3-Clause"
]
| 7 | 2021-11-01T06:27:37.000Z | 2022-02-08T19:55:52.000Z | library/fhir4b/tests/fhir4b_tests_liquid.pas | HealthIntersections/fhirserver | 759bf1a270bca48b3ef97385074cfc0b37fae0dc | [
"BSD-3-Clause"
]
| 2 | 2022-02-15T13:27:52.000Z | 2022-02-16T08:40:48.000Z | unit fhir4b_tests_liquid;
{
Copyright (c) 2011+, HL7 and 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.
}
{$I fhir.inc}
interface
uses
SysUtils, Classes, Generics.Collections,
fsl_testing, fsl_base, fsl_json, fsl_tests,
fhir4b_tests_worker,
fhir4b_resources, fhir4b_parser, fhir4b_liquid, fhir4b_pathengine, fhir4b_xml;
type
TLiquidEngineTest4 = Class (TFslTestSuiteCase)
private
engine : TFHIRLiquidEngine;
test : TJsonObject;
function findTest(name : String) : TJsonObject;
function FetchInclude(sender : TFHIRLiquidEngine; name : String; var content : String) : boolean;
function loadResource : TFhirResource;
Public
Procedure SetUp; override;
procedure TearDown; override;
Published
procedure TestCase(Name : String); override;
End;
TLiquidEngineTest4Suite = class (TFslTestSuite)
public
constructor Create; override;
end;
procedure registerTests;
implementation
var
gTestDoc : TJsonObject;
gResources : TFslMap<TFHIRResource>;
{ TLiquidEngineTest4Suite }
constructor TLiquidEngineTest4Suite.Create;
var
tests : TJsonArray;
test : TJsonObject;
i : integer;
begin
inherited Create;
if gResources = nil then
gResources := TFslMap<TFHIRResource>.create('resources');
if gTestDoc = nil then
gTestDoc := TJSONParser.ParseFile(TestSettings.fhirTestFile(['r4', 'liquid', 'liquid-tests.json']));
tests := gTestDoc.arr['tests'];
for i := 0 to tests.Count - 1 do
begin
test := tests[i] as TJsonObject;
AddTest(TLiquidEngineTest4.Create(test.str['name']));
end;
end;
{ TLiquidEngineTest4 }
function TLiquidEngineTest4.findTest(name: String): TJsonObject;
var
tests : TJsonArray;
test : TJsonObject;
i : integer;
begin
result := nil;
tests := gTestDoc.arr['tests'];
for i := 0 to tests.Count - 1 do
begin
test := tests[i] as TJsonObject;
if name = test.str['name'] then
exit(test);
end;
end;
function TLiquidEngineTest4.FetchInclude(sender : TFHIRLiquidEngine; name: String; var content: String): boolean;
begin
result := test.has('includes') and test.obj['includes'].has(name);
if result then
content := test.obj['includes'].str[name];
end;
function TLiquidEngineTest4.loadResource : TFhirResource;
var
fn : String;
p : TFHIRXmlParser;
f : TFileStream;
begin
if not gResources.ContainsKey(test.str['focus']) then
begin
fn := TestSettings.fhirTestFile(['r4', 'examples', test.str['focus'].replace('/', '-').toLower+'.xml']);
p := TFHIRXmlParser.create(TTestingWorkerContext4.Use, engine.engine.context.lang);
try
f := TFileStream.Create(fn, fmOpenRead);
try
p.source := f;
p.parse;
gResources.add(test.str['focus'], p.resource.link as TFhirResource);
finally
f.Free;
end;
finally
p.Free;
end;
end;
result := gResources[test.str['focus']];
end;
procedure TLiquidEngineTest4.Setup;
begin
engine := TFHIRLiquidEngine.Create(TFHIRPathEngine.Create(TTestingWorkerContext4.Use, nil));
engine.OnFetchInclude := FetchInclude;
end;
procedure TLiquidEngineTest4.TearDown;
begin
engine.Free;
end;
procedure TLiquidEngineTest4.TestCase(Name: String);
var
doc : TFHIRLiquidDocument;
output : String;
begin
test := findTest(name);
doc := engine.parse(test.str['template'], 'test-script');
try
output := engine.evaluate(doc, loadResource, nil);
assertTrue(test.str['output'] = output);
finally
doc.Free;
end;
end;
procedure registerTests;
begin
RegisterTest('R4', TLiquidEngineTest4Suite.create);
end;
initialization
finalization
gTestDoc.Free;
gResources.Free;
end.
| 29.674157 | 114 | 0.713366 |
fc4a982b3a9ec1a077be9557f42e008931c100f6 | 695 | pas | Pascal | DocumentTypeUnit.pas | naumovda/d-client | 4fa4be0d97962ad6166243fdd9b92b2269909151 | [
"Apache-2.0"
]
| null | null | null | DocumentTypeUnit.pas | naumovda/d-client | 4fa4be0d97962ad6166243fdd9b92b2269909151 | [
"Apache-2.0"
]
| null | null | null | DocumentTypeUnit.pas | naumovda/d-client | 4fa4be0d97962ad6166243fdd9b92b2269909151 | [
"Apache-2.0"
]
| null | null | null | unit DocumentTypeUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, FormAbsUnit, cxGraphics, cxControls, cxLookAndFeels,
cxLookAndFeelPainters, cxStyles, cxCustomData, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, dxBar, cxClasses, ActnList, ImgList,
cxGridLevel, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxGrid;
type
TDocumentType = class(TFormListAbs)
tvMainDocumentTypeName: TcxGridDBColumn;
private
{ Private declarations }
public
{ Public declarations }
end;
var
DocumentType: TDocumentType;
implementation
{$R *.dfm}
uses
DataModuleUnit
;
end.
| 20.441176 | 76 | 0.768345 |
fc4749011d091a64da6eeafa6a070c6952cdba6d | 71,720 | pas | Pascal | Demos/Other Demos/FrameBrowserUsingIndy10/FBUnitId10.pas | coassoftwaresystems/HtmlViewer | 0f605421b17c4246e6fff4a1fa26ac42f2f69646 | [
"MIT"
]
| 3 | 2015-03-31T13:32:10.000Z | 2017-10-13T07:51:58.000Z | Demos/Other Demos/FrameBrowserUsingIndy10/FBUnitId10.pas | VSoftTechnologies/HtmlViewer | ec25894dc9f447f294e877e2f5f43ee1d5b60270 | [
"MIT"
]
| null | null | null | Demos/Other Demos/FrameBrowserUsingIndy10/FBUnitId10.pas | VSoftTechnologies/HtmlViewer | ec25894dc9f447f294e877e2f5f43ee1d5b60270 | [
"MIT"
]
| 1 | 2021-05-03T14:12:10.000Z | 2021-05-03T14:12:10.000Z | {
Version 11.4
Copyright (c) 1995-2008 by L. David Baldwin
Copyright (c) 2008-2013 by HtmlViewer Team
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Note that the source modules HTMLGIF1.PAS and DITHERUNIT.PAS
are covered by separate copyright notices located in those modules.
}
unit FBUnitId10;
{$include htmlcons.inc}
{$include options.inc}
{A program to demonstrate the TFrameBrowser component}
interface
uses
WinTypes, WinProcs, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ShellAPI, Menus, StdCtrls, Buttons, ExtCtrls, htmlun2, CachUnitId,
URLSubs, htmlview, htmlsubs, Gauges, mmSystem,
{$ifdef UseOldPreviewForm}
PreviewForm,
{$else UseOldPreviewForm}
BegaHtmlPrintPreviewForm,
{$endif UseOldPreviewForm}
DownLoadId, IniFiles,
Readhtml, urlconId10, FramBrwz, FramView, MPlayer, IdBaseComponent,
IdAntiFreezeBase, IdAntiFreeze, IdGlobal, IdGlobalProtocols,
ImgList, ComCtrls, ToolWin, IdIntercept,
IdHTTP, IdComponent, IdIOHandler, IdIOHandlerSocket, IdSSLOpenSSL, IdCookie, IdCookieManager,
IdTCPConnection, IdTCPClient, IdAuthentication,
{$if CompilerVersion >= 15}
{$ifndef UseVCLStyles}
XpMan,
{$endif}
{$ifend}
{$ifdef UseVCLStyles}
Vcl.Styles,
Vcl.Themes,
Vcl.ActnPopup,
{$endif}
idLogfile,
HtmlGlobals;
const
(*UsrAgent = 'Mozilla/4.0 (compatible; Indy Library)';*)
UsrAgent = 'Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)';
// UsrAgent = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)';
MaxHistories = 15; {size of History list}
wm_LoadURL = wm_User+124;
wm_DownLoad = wm_User+125;
type
{$ifdef UseVCLStyles}
TPopupMenu=class(Vcl.ActnPopup.TPopupActionBar);
{$endif}
ImageRec = class(TObject)
public
Viewer: ThtmlViewer;
ID, URL: string;
Stream: TMemorystream;
end;
TImageHTTP = class(TComponent)
{an HTTP component with a few extra fields}
public
ImRec: ImageRec;
Url: String;
Connection : TURLConnection;
constructor CreateIt(AOwner: TComponent; IRec: TObject);
destructor Destroy; override;
procedure GetAsync;
end;
TModIdLogFile = class(TIdLogFile)
public
procedure LogWriteString(const AText: string); override;
end;
THTTPForm = class(TForm)
MainMenu1: TMainMenu;
HistoryMenuItem: TMenuItem;
Help1: TMenuItem;
File1: TMenuItem;
Openfile1: TMenuItem;
OpenDialog: TOpenDialog;
Timer: TTimer;
Options1: TMenuItem;
DeleteCache1: TMenuItem;
N1: TMenuItem;
Exit1: TMenuItem;
ShowImages: TMenuItem;
SaveDialog: TSaveDialog;
Edit1: TMenuItem;
Find1: TMenuItem;
Copy1: TMenuItem;
SelectAll1: TMenuItem;
N2: TMenuItem;
FindDialog: TFindDialog;
PopupMenu: TPopupMenu;
SaveImageAs: TMenuItem;
N3: TMenuItem;
OpenInNewWindow: TMenuItem;
FrameBrowser: TFrameBrowser;
PrintPreview: TMenuItem;
Print1: TMenuItem;
PrintDialog: TPrintDialog;
Proxy1: TMenuItem;
DemoInformation1: TMenuItem;
About1: TMenuItem;
Timer1: TTimer;
CoolBar1: TCoolBar;
ToolBar2: TToolBar;
BackButton: TToolButton;
FwdButton: TToolButton;
ToolButton1: TToolButton;
ReloadButton: TToolButton;
UrlComboBox: TComboBox;
Panel10: TPanel;
ToolBar1: TToolBar;
CancelButton: TToolButton;
SaveUrl: TToolButton;
ImageList1: TImageList;
Panel3: TPanel;
Animate1: TAnimate;
StatusBarMain: TStatusBar;
Gauge: TProgressBar;
PopupMenu1: TPopupMenu;
ViewImage: TMenuItem;
CopyImagetoclipboard: TMenuItem;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
View1: TMenuItem;
HTTPHeaders1: TMenuItem;
PageInfo1: TMenuItem;
N4: TMenuItem;
LibraryInformation1: TMenuItem;
Source1: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure GetButtonClick(Sender: TObject);
procedure HTTPHeaderData(Sender: TObject);
procedure CancelButtonClick(Sender: TObject);
procedure HistoryChange(Sender: TObject);
procedure BackButtonClick(Sender: TObject);
procedure FwdButtonClick(Sender: TObject);
procedure Openfile1Click(Sender: TObject);
procedure TimerTimer(Sender: TObject);
procedure DeleteCacheClick(Sender: TObject);
procedure Exit1Click(Sender: TObject);
procedure ShowImagesClick(Sender: TObject);
procedure ReloadClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Find1Click(Sender: TObject);
procedure FindDialogFind(Sender: TObject);
procedure Edit1Click(Sender: TObject);
procedure SelectAll1Click(Sender: TObject);
procedure Copy1Click(Sender: TObject);
procedure URLComboBoxKeyPress(Sender: TObject; var Key: Char);
procedure SaveImageAsClick(Sender: TObject);
procedure URLComboBoxClick(Sender: TObject);
procedure RightClick(Sender: TObject; Parameters: TRightClickParameters);
procedure OpenInNewWindowClick(Sender: TObject);
procedure SaveURLClick(Sender: TObject);
procedure HTTPDocData1(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Processing(Sender: TObject; ProcessingOn: Boolean);
procedure PrintPreviewClick(Sender: TObject);
procedure File1Click(Sender: TObject);
procedure Print1Click(Sender: TObject);
procedure PrintHeader(Sender: TObject; Canvas: TCanvas; NumPage, W, H: Integer; var StopPrinting: Boolean);
procedure PrintFooter(Sender: TObject; Canvas: TCanvas; NumPage, W, H: Integer; var StopPrinting: Boolean);
procedure About1Click(Sender: TObject);
procedure ViewerClear(Sender: TObject);
procedure Proxy1Click(Sender: TObject);
procedure DemoInformation1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FrameBrowserMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure AuthorizationEvent(Sender: TObject; Authentication: TIdAuthentication; var Handled: Boolean);
{$ifdef UNICODE}
procedure BlankWindowRequest(Sender: TObject; const Target, URL: String);
procedure FrameBrowserGetPostRequestEx(Sender: TObject; IsGet: Boolean;
const URL, Query, EncType, RefererX: String; Reload: Boolean;
var NewURL: String; var DocType: ThtmlFileType;
var Stream: TMemoryStream);
procedure GetImageRequest(Sender: TObject; const URL: String; var Stream: TStream);
procedure HotSpotTargetClick(Sender: TObject; const Target, URL: String; var Handled: Boolean);
procedure HotSpotTargetCovered(Sender: TObject; const Target, URL: String);
procedure FrameBrowserMeta(Sender: TObject; const HttpEq, Name, Content: string);
procedure FrameBrowserScript(Sender: TObject; const Name, ContentType, Src, Script: string);
{$else}
procedure BlankWindowRequest(Sender: TObject; const Target, URL: WideString);
procedure FrameBrowserGetPostRequestEx(Sender: TObject; IsGet: Boolean;
const URL, Query, EncType, RefererX: WideString; Reload: Boolean;
var NewURL: WideString; var DocType: ThtmlFileType;
var Stream: TMemoryStream);
procedure GetImageRequest(Sender: TObject; const URL: WideString; var Stream: TStream);
procedure HotSpotTargetClick(Sender: TObject; const Target, URL: WideString; var Handled: Boolean);
procedure HotSpotTargetCovered(Sender: TObject; const Target, URL: WideString);
procedure FrameBrowserMeta(Sender: TObject; const HttpEq, Name, Content: WideString);
procedure FrameBrowserScript(Sender: TObject; const Name, ContentType, Src, Script: WideString);
{$endif}
procedure StatusBarMainDrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
procedure HTTPHeaders1Click(Sender: TObject);
procedure PageInfo1Click(Sender: TObject);
procedure LibraryInformation1Click(Sender: TObject);
procedure Source1Click(Sender: TObject);
private
{ Private declarations }
URLBase: String;
Histories: array[0..MaxHistories-1] of TMenuItem;
Pending: TList; {a list of ImageRecs}
HTTPList: TList; {a list of the Image HTTPs currently existing}
DiskCache: TDiskCache;
NewLocation: string;
Redirect: boolean;
ARealm: string;
CurrentLocalFile,
DownLoadUrl: string;
Reloading: boolean;
CookieManager: TIdCookieManager;
FoundObject: TImageObj;
FoundObjectName: string;
NewWindowFile: string;
AnAbort: boolean;
NumImageTot, NumImageDone: integer;
AStream: TMemoryStream;
Connection: TURLConnection;
Proxy: string;
ProxyPort: string;
ProxyUser: string;
ProxyPassword: string;
TimerCount: integer;
OldTitle: ThtString;
HintWindow: ThtHintWindow;
HintVisible: boolean;
TitleViewer: ThtmlViewer;
Allow: string;
FHeaderRequestData : TStrings;
FHeaderResponseData : TStrings;
FMetaInfo : TStrings;
{$ifdef LogIt}
ShowDiagWindow: TMenuItem;
{$endif}
{$ifdef UseVCLStyles}
sepVCLStyles,
VCLStyles1 : TMenuItem;
procedure VCLStyleClick(Sender: TObject);
{$endif}
{$ifdef LogIt}
procedure ShowDiagWindowClick(Sender: TObject);
{$endif}
procedure EnableControls;
procedure DisableControls;
{$ifdef LogIt}
procedure LogTStrings(AStrings : TStrings);
{$endif}
procedure ImageRequestDone(Sender: TObject; RqType: THttpRequest; Error: Word);
procedure HistoryClick(Sender: TObject);
procedure WMLoadURL(var Message: TMessage); message WM_LoadURL;
procedure WMDownLoad(var Message: TMessage); message WM_DownLoad;
procedure CheckEnableControls;
procedure ClearProcessing;
procedure Progress(Num, Den: integer);
procedure wmDropFiles(var Message: TMessage); message wm_DropFiles;
procedure CheckException(Sender: TObject; E: Exception);
procedure HTTPRedirect(Sender: TObject; var Dest: String;
var NumRedirect: Integer; var Handled: boolean; var Method: TIdHTTPMethod);
procedure SaveCookies(ASender: TObject; ACookieCollection: TIdCookies);
procedure LoadCookies(ACookieCollection: TIdCookieManager);
procedure CloseHints;
procedure FrameBrowserFileBrowse(Sender, Obj: TObject; var S: ThtString);
public
{ Public declarations }
{$ifdef UseSSL}
SSL: TIdSSLIOHandlerSocketOpenSSL;
{$endif}
{$ifdef LogIt}
Log: TModIdLogFile;
{$endif}
FIniFilename: string;
{$ifdef LogIt}
procedure LogLine (S: string);
{$endif}
end;
EContentTypeError = class(Exception);
ESpecialException = class(Exception);
const
CookieFile = 'Cookies.ini';
var
HTTPForm: THTTPForm;
Mon: TextFile;
Monitor1: boolean;
Cache: string;
implementation
uses
InfoDlg,
{$ifdef LogIt}
logwin,
{$endif}
{$ifdef Compiler24_Plus}
System.Types,
{$endif}
{$ifdef HasSystemUITypes}
System.UITypes,
{$endif}
{$ifdef UseZLib}
IdZLibHeaders,
IdCTypes,
{$endif}
IdURI,
HTMLAbt, ProxyDlg, AuthUnit;
{$ifdef LCL}
{$R *.lfm}
{$else}
{$R *.dfm}
{$if CompilerVersion < 15}
{$R manifest.res}
{$ifend}
{$endif}
{$ifdef LogIt}
procedure THTTPForm.LogLine (S: string);
begin
// if NOT ShowDiagWindow.Checked then exit;
if NOT LogForm.Visible then LogForm.Visible := true;
LogForm.LogMemo.Lines.Add (S);
end;
{$endif}
{$ifdef UseVCLStyles}
procedure THTTPForm.VCLStyleClick(Sender: TObject);
var
s : String;
m : TMenuItem;
begin
m := (Sender as TMenuItem);
s := TStyleManager.StyleNames[m.Tag];
TStyleManager.SetStyle(s);
m.Checked := True;
end;
{$endif}
{$ifdef LogIt}
procedure THTTPForm.ShowDiagWindowClick(Sender: TObject);
begin
ShowDiagWindow.Checked := NOT ShowDiagWindow.Checked;
LogForm.Visible := ShowDiagWindow.Checked;
end;
{$endif}
{----------------THTTPForm.FormCreate}
procedure THTTPForm.FormCreate(Sender: TObject);
var
I, J: integer;
IniFile: TIniFile;
SL: TStringList;
ProgressBarStyle : LongInt;
{$ifdef UseVCLStyles}
m : TMenuItem;
{$endif}
begin
Self.OpenDialog.Filter := GetFileMask;
FMetaInfo := TStringList.Create;
{$ifdef has_StyleElements}
TStyleManager.AnimationOnControls := True;
{$Endif}
FHeaderRequestData := TStringList.Create;
FHeaderResponseData := TStringList.Create;
{$ifdef LogIt}
logwin.LogForm := TLogForm.Create(nil);
{$endif}
{$ifdef HasGestures}
FrameBrowser.Touch.InteractiveGestureOptions := [igoPanSingleFingerHorizontal, igoPanSingleFingerVertical, igoPanInertia];
FrameBrowser.Touch.InteractiveGestures := [igPan];
{$endif}
Top := Top div 2;
if Screen.Width <= 800 then {make window fit appropriately}
begin
Left := Left div 2;
Width := (Screen.Width * 9) div 10;
Height := (Screen.Height * 7) div 8;
end
else
begin
Width := 850;
Height := 600;
end;
Cache := ExtractFilePath(Application.ExeName)+'Cache\';
DiskCache := TDiskCache.Create(Cache);
Self.StatusBarMain.Panels[0].Text := '';
{Monitor1 will be set if this is the first instance opened}
Monitor1 := True;
try
AssignFile(Mon, Cache+'Monitor.txt'); {a monitor file for optional use}
Rewrite(Mon);
except
Monitor1 := False; {probably open in another instance}
end;
{$ifdef LogIt}
ShowDiagWindow:= TMenuItem.Create(Options1);
ShowDiagWindow.OnClick := ShowDiagWindowClick;
ShowDiagWindow.Caption := '&Diagnostic Window...';
Options1.Add(ShowDiagWindow);
{$endif}
{$ifdef UseVCLStyles}
sepVCLStyles := TMenuItem.Create(Options1);
sepVCLStyles.Caption := '-';
Options1.Add(sepVCLStyles);
VCLStyles1 := TMenuItem.Create(Options1);
VCLStyles1.Caption := '&VCL Styles';
Options1.Add(VCLStyles1);
if TStyleManager.Enabled then begin
for i := Low(TStyleManager.StyleNames) to High(TStyleManager.StyleNames) do begin
m := TMenuItem.Create(VCLStyles1);
m.Caption := TStyleManager.StyleNames[i];
m.Tag := i;
m.OnClick := VCLStyleClick;
m.RadioItem := True;
VCLStyles1.Add(m);
end;
end;
{$endif}
{$ifdef LogIt}
if Monitor1 then
begin
DeleteFile(Cache+'LogFile.txt');
Log := TModIdLogFile.Create(Self);
Log.Filename := Cache+'LogFile.txt';
Log.ReplaceCRLF := False;
Log.Active := True;
end;
{$endif}
CookieManager := TIdCookieManager.Create(Self);
LoadCookies(CookieManager);
CookieManager.OnDestroy := SaveCookies;
AStream := TMemoryStream.Create;
Pending := TList.Create;
HTTPList := TList.Create;
FrameBrowser.HistoryMaxCount := MaxHistories; {defines size of history list}
for I := 0 to MaxHistories-1 do
begin {create the MenuItems for the history list}
Histories[I] := TMenuItem.Create(HistoryMenuItem);
HistoryMenuItem.Insert(I, Histories[I]);
with Histories[I] do
begin
Visible := False;
OnClick := HistoryClick;
Tag := I;
end;
end;
{Load animation from resource}
Animate1.ResName := 'StarCross';
{$ifdef ver140} {delphi 6}
URLComboBox.AutoComplete := False;
{$endif}
I := Pos('.', Application.ExeName);
FIniFilename := Copy(Application.Exename, 1, I)+'ini';
ProxyPort := '80';
IniFile := TIniFile.Create(FIniFileName);
try
Top := IniFile.ReadInteger('HTTPForm', 'Top', Top);
Left := IniFile.ReadInteger('HTTPForm', 'Left', Left);
Width := IniFile.ReadInteger('HTTPForm', 'Width', Width);
Height := IniFile.ReadInteger('HTTPForm', 'Height', Height);
{$ifdef LogIt}
ShowDiagWindow.Checked := IniFile.ReadBool('HTTPForm', 'ShowDiagWindow', ShowDiagWindow.Checked);
{$endif}
Proxy := IniFile.ReadString('Proxy', 'ProxyHost', '');
ProxyPort := IniFile.ReadString('Proxy', 'ProxyPort', '80');
ProxyUser := IniFile.ReadString('Proxy', 'ProxyUsername', '');
ProxyPassword := IniFile.ReadString('Proxy', 'ProxyPassword', '');
SL := TStringList.Create;
try
IniFile.ReadSectionValues('favorites', SL);
for I := 0 to SL.Count-1 do
begin
J := Pos('=', SL[I]);
UrlCombobox.Items.Add(Copy(SL[I], J+1, 1000));
end;
finally
SL.Free;
end;
finally
IniFile.Free;
end;
DragAcceptFiles(Handle, True);
Application.OnException := CheckException;
{$ifdef M4Viewer}
ProtocolHandler := M4ProtocolHandler;
{$endif}
HintWindow := ThtHintWindow.Create(Self);
// HintWindow.Color := $C0FFFF;
FrameBrowser.OnFileBrowse := FrameBrowserFileBrowse;
Gauge.Parent := Self.StatusBarMain;
//remove progress bar border
ProgressBarStyle := GetWindowLong(Gauge.Handle,
GWL_EXSTYLE);
ProgressBarStyle := ProgressBarStyle
- WS_EX_STATICEDGE;
SetWindowLong(Gauge.Handle,
GWL_EXSTYLE,
ProgressBarStyle);
end;
{----------------THTTPForm.FormDestroy}
procedure THTTPForm.FormDestroy(Sender: TObject);
var
I: integer;
IniFile: TIniFile;
begin
{$ifdef UseSSL}
if Assigned(SSL) then
SSL.Free;
{$endif}
{$ifdef LogIt}
Log.Free;
{$endif}
AStream.Free;
Pending.Free;
for I := 0 to HTTPList.Count-1 do
TImageHTTP(HTTPList.Items[I]).Free;
HTTPList.Free;
if Monitor1 then
CloseFile(Mon);
DiskCache.Free;
CookieManager.Free;
if Assigned(Connection) then
begin
Connection.Free;
Connection := Nil;
end;
if Monitor1 then
begin {save only if this is the first instance}
IniFile := TIniFile.Create(FIniFileName);
try
IniFile.WriteInteger('HTTPForm', 'Top', Top);
IniFile.WriteInteger('HTTPForm', 'Left', Left);
IniFile.WriteInteger('HTTPForm', 'Width', Width);
IniFile.WriteInteger('HTTPForm', 'Height', Height);
{$ifdef LogIt}
IniFile.WriteBool('HTTPForm', 'ShowDiagWindow', ShowDiagWindow.Checked);
{$endif}
IniFile.WriteString('Proxy', 'ProxyHost', Proxy);
IniFile.WriteString('Proxy', 'ProxyPort', ProxyPort);
IniFile.WriteString('Proxy', 'ProxyUsername', ProxyUser);
IniFile.WriteString('Proxy', 'ProxyPassword', ProxyPassword);
IniFile.EraseSection('Favorites');
for I := 0 to UrlCombobox.Items.Count - 1 do
IniFile.WriteString('Favorites', 'Url'+IntToStr(I), UrlCombobox.Items[I]);
finally
IniFile.Free;
end;
end;
FHeaderRequestData.Free;
FHeaderResponseData.Free;
end;
{----------------THTTPForm.GetButtonClick}
procedure THTTPForm.GetButtonClick(Sender: TObject);
{initiate loading of a main document}
begin
URLBase := GetUrlBase(URLCombobox.Text);
DisableControls;
StatusBarMain.Panels[0].Text := '';
StatusBarMain.Panels[1].Style := psText;
StatusBarMain.Panels[1].Text := '';
try
FHeaderRequestData.Clear;
FHeaderResponseData.Clear;
{the following initiates one or more GetPostRequest's}
FrameBrowser.LoadURL(Normalize(URLCombobox.Text));
Reloading := False;
finally
CheckEnableControls;
FrameBrowser.SetFocus;
end;
end;
{----------------THTTPForm.FrameBrowserFileBrowse}
//This fires when the user hits a file-browse button on a form.
procedure THTTPForm.FrameBrowserFileBrowse(Sender, Obj: TObject; var S: ThtString);
var LFile : String;
begin
//
if PromptForFileName(LFile,'Any File |*.*','','Select File','',False) then begin
S := LFile;
end;
//
end;
{----------------THTTPForm.FrameBrowserGetPostRequestEx}
procedure THTTPForm.FrameBrowserGetPostRequestEx(Sender: TObject;
IsGet: Boolean; const URL, Query, EncType, RefererX: ThtString;
Reload: Boolean; var NewURL: ThtString; var DocType: ThtmlFileType;
var Stream: TMemoryStream);
{OnGetPostRequest handler.
URL is what to load.
IsGet is set for Get (as opposed to Post)
Query a possible query string
Reload set if don't want what's in cache
NewURL return in the document location has changed (happens quite frequently).
DocType is the type of document found -- HTMLType, TextType, or ImgType
Stream is the stream answer to the request}
const
MaxRedirect = 15;
var
S, URL1, FName, Query1, LastUrl: string;
Error, TryAgain, TryRealm: boolean;
RedirectCount: integer;
function GetAuthorization: boolean;
var
UName, PWord: string;
begin
with AuthForm do
begin
Result := GetAuthorization(TryRealm and (ARealm <> ''), ARealm, UName, PWord);
TryRealm := False; {only try it once}
if Result then
begin
Connection.UserName := UName;
Connection.Password := PWord;
Connection.InputStream.Clear; {delete any previous message sent}
Connection.BasicAuth := True;
end;
end;
end;
begin
CloseHints; {may be a hint window open}
Query1 := Query;
StatusBarMain.Panels[0].Text := '';
StatusBarMain.Panels[1].Text := '';
FName := '';
Error := False;
AnAbort := False;
NumImageTot := 0;
NumImageDone := 0;
Progress(0, 0);
Gauge.Visible := True;
URL1 := DecodeURL(Normalize(URL));
(*URLComboBox.Text := URL1; *) {Probably don't want this}
URLBase := GetUrlBase(URL1);
DisableControls;
NewLocation := ''; {will change if document referenced by URL has been relocated}
ARealm := '';
TryRealm := True;
AStream.Clear;
RedirectCount := 0;
if Reloading or Reload then
begin {don't want a cache file}
DiskCache.RemoveFromCache(URL1);
end
else
DiskCache.GetCacheFilename(URL1, FName, DocType, NewLocation); {if in cache already, get the cache filename}
if (FName = '') or not FileExists(FName) then
begin {it's not in cache}
If Connection <> nil Then
begin
Connection.Free;
Connection := Nil;
end;
If {$ifdef UseSSL}not Assigned(SSL) and{$endif} (GetProtocol(URL1) = 'https') then {guard against missing DLLs}
Connection := Nil
else
Connection := TURLConnection.GetConnection(URL1);
if connection <> nil then
begin
Connection.OnHeaderData := HTTPForm.HTTPHeaderData;
Connection.OnDocData := HTTPForm.HTTPDocData1;
Connection.Referer := RefererX;
LastURL := Url1;
Connection.OnRedirect := HTTPForm.HTTPRedirect;
Connection.Proxy := Proxy;
Connection.ProxyPort := ProxyPort;
Connection.ProxyUser := ProxyUser;
Connection.ProxyPassword := ProxyPassword;
Connection.UserAgent := UsrAgent;
Connection.CookieManager := CookieManager;
Connection.OnAuthorization := AuthorizationEvent;
try
repeat
TryAgain := False;
Redirect := False;
Inc(RedirectCount);
if Assigned(Connection.InputStream) then
Connection.InputStream.Clear;
try
if IsGet then
begin {Get}
if Query1 <> '' then begin
{$ifdef LogIt}
LogLine ('FrameBrowser Get: ' + URL1+'?'+Query1);
{$endif}
Connection.Get(URL1+'?'+Query1)
end else begin
{$ifdef LogIt}
LogLine ('FrameBrowser Get: ' + URL1);
{$endif}
Connection.Get(URL1);
end;
end
else {Post}
begin
Connection.SendStream := TMemoryStream.Create;
try
{$ifdef LogIt}
LogLine ('FrameBrowser Post: ' + URL1+', Data=' +
Copy (Query1, 1, 132) + ', EncType=' + EncType); // not too much data
{$endif}
Connection.SendStream.WriteBuffer(Query1[1], Length(Query1));
Connection.SendStream.Position := 0;
if EncType = '' then
Connection.ContentTypePost := 'application/x-www-form-urlencoded'
else
Connection.ContentTypePost := EncType;
Connection.Post(URL1);
finally
Connection.SendStream.Free;
end;
end;
if Connection.StatusCode = 401 then
TryAgain := GetAuthorization
else
if Redirect then
begin
Url1 := NewLocation;
if Connection.StatusCode = 303 then
begin
IsGet := True;
Query1 := '';
end;
TryAgain := True;
if {$ifdef UseSSL} not Assigned(SSL) and {$endif} (GetProtocol(NewLocation) = 'https') then
begin
TryAgain := False;
S := '<p>Unsupported protocol: https';
Connection.InputStream.Position := Connection.InputStream.Size;
Connection.InputStream.Write(S[1], Length(S));
end;
end;
except
case Connection.StatusCode of
401: TryAgain := GetAuthorization;
405: if not IsGet and (Pos('get', Allow) > 0) then
begin
IsGet := True;
TryAgain := True;
end;
301, 302:
if NewLocation <> '' then
begin
URL1 := NewLocation;
TryAgain := True;
end;
end;
if not TryAgain or (RedirectCount >= MaxRedirect) then
Raise;
end;
{$ifdef LogIt}
LogLine ('FrameBrowserGetPostRequestEx Done: Status ' + IntToStr (Connection.StatusCode));
{$endif}
until not TryAgain;
if FHeaderRequestData.Count > 0 then begin
FHeaderRequestData.Add('');
end;
FHeaderRequestData.Add( 'URL = "'+ URL +'"');
FHeaderRequestData.Add('');
FHeaderRequestData.AddStrings( Connection.HeaderRequestData );
if FHeaderResponseData.Count > 0 then begin
FHeaderResponseData.Add('');
end;
FHeaderResponseData.Add( 'URL = "'+ URL +'"');
FHeaderResponseData.Add('');
FHeaderResponseData.AddStrings( Connection.HeaderResponseData );
DocType := Connection.ContentType;
AStream.LoadFromStream(Connection.InputStream);
except
{$ifndef UseSSL}
On ESpecialException do
begin
{$ifdef LogIt}
LogLine ('FrameBrowserGetPostRequestEx: Special Exception');
{$endif}
Connection.Free; {needs to be reset}
Connection := Nil;
Raise;
end;
{$endif}
On E: Exception do
try
{$ifdef LogIt}
LogLine ('FrameBrowserGetPostRequestEx: Exception - ' + E.Message);
{$endif}
if AnAbort then
Raise(ESpecialException.Create('Abort on user request'));
Error := True;
if Connection is THTTPConnection then
with Connection do
begin
if InputStream.Size > 0 then {sometimes error messages come in RcvdStream}
AStream.LoadFromStream(InputStream)
else
begin
if RedirectCount >= MaxRedirect then
S := 'Excessive Redirects'
else
S := ReasonPhrase+'<p>Statuscode: '+IntToStr(StatusCode);
AStream.Write(S[1], Length(S));
end;
DocType := HTMLType;
end
else {other connection types}
begin
S := E.Message; {Delphi 1}
AStream.Write(S[1], Length(S));
end;
finally
Connection.Free; {needs to be reset}
Connection := Nil;
end;
end;
StatusBarMain.Panels[0].Text := 'Received ' + IntToStr(AStream.Size) + ' bytes';
FName := DiskCache.AddNameToCache(LastUrl, NewLocation, DocType, Error);
if FName <> '' then
try
AStream.SaveToFile(FName); {it's now in cache}
except
end;
end
else
begin { unsupported protocol }
S := 'Unsupported protocol: ' + GetProtocol(URL1);
if Sender is TFrameBrowser then {main document display}
Raise(ESpecialException.Create(S))
else {else other errors will get displayed as HTML file}
AStream.Write(S[1], Length(S));
{$ifdef LogIt}
LogLine (S);
{$endif}
end;
end
else
begin
AStream.LoadFromFile(FName);
{$ifdef LogIt}
LogLine ('FrameBrowserGetPostRequestEx: from Cache' + FName);
{$endif}
end;
NewURL := NewLocation; {in case location has been changed}
Stream := AStream;
end;
{----------------THTTPForm.GetImageRequest}
procedure THTTPForm.GetImageRequest(Sender: TObject; const URL: ThtString; var Stream: TStream);
{the OnImageRequest handler}
var
S: string;
IR: ImageRec;
DocType: ThtmlFileType;
ImHTTP: TImageHTTP;
Dummy: string;
begin
if Reloading then
begin
DiskCache.RemoveFromCache(URL);
S := '';
end
else
DiskCache.GetCacheFilename(URL, S, DocType, Dummy); {see if image is in cache file already}
if FileExists(S) and (DocType = ImgType) then
begin {yes, it is}
AStream.LoadFromFile(S);
Stream := AStream; {return image immediately}
{$ifdef LogIt}
LogLine ('GetImageRequest, from Cache: ' + S);
{$endif}
end
else
if not ((GetProtocol(URL) = 'http')
{$ifdef UseSSL}
or (GetProtocol(URL) = 'https')
{$endif}
) then
begin
if Assigned(Connection) then
Connection.Free;
Connection := TURLConnection.GetConnection(URL);
if connection <> nil then
begin
{$ifdef LogIt}
LogLine ('GetImageRequest Start: ' + URL);
{$endif}
try
Connection.Get(URL);
Stream := Connection.InputStream;
except
Stream := Nil;
end;
end
else
Stream := Nil;
end
else
begin {http protocol, the image will need to be downloaded}
Stream := WaitStream; {wait indicator}
IR := ImageRec.Create;
IR.Viewer := Sender as ThtmlViewer;
IR.URL := URL;
IR.ID := URL;
ImHTTP := TImageHTTP.CreateIt(Self, IR);
ImHTTP.Connection.Owner := ImHTTP;
ImHTTP.Connection.OnRequestDone := ImageRequestDone;
ImHTTP.Connection.Proxy := Proxy;
ImHTTP.Connection.ProxyPort := ProxyPort;
ImHTTP.Connection.ProxyUser := ProxyUser;
ImHTTP.Connection.ProxyPassword := ProxyPassword;
ImHTTP.Connection.UserAgent := UsrAgent;
DisableControls;
try
ImHTTP.GetAsync; {This call does not stall. When done getting the image,
processing will continue at ImageRequestDone}
HTTPList.Add(ImHTTP);
except
ImHTTP.Free;
Stream := Nil;
end;
Inc(NumImageTot);
Progress(NumImageDone, NumImageTot);
end;
end;
{----------------THTTPForm.ImageRequestDone}
procedure THTTPForm.ImageRequestDone(Sender: TObject; RqType: THttpRequest;
Error: Word);
{arrive here when ImHTTP.GetAsync has completed}
var
ImHTTP: TImageHTTP;
begin
try
ImHTTP := (Sender as TImageHTTP);
{$ifdef LogIt}
LogLine ('=====');
LogLine ('');
LogLine ('--- Request ---');
LogTStrings( ImHTTP.Connection.HeaderRequestData );
LogLine ('');
LogLine ('--- Response ---');
LogTStrings( ImHTTP.Connection.HeaderResponseData );
LogLine ('');
LogLine ('====');
{$endif}
if (RqType = httpGet) then
begin
if (Error = 0) then
begin {Add the image record to the Pending list to be inserted in the timer
loop at TimerTimer}
{$ifdef LogIt}
LogLine ('GetImageRequest Done OK');
{$endif}
Pending.Add(ImHTTP.ImRec);
ImHTTP.ImRec := Nil; {so it won't get free'd below}
Timer.Enabled := True;
end
else
{this code will cause Error Image to appear if error occured when downloading image}
begin {Add the image record to the Pending list to be inserted in the timer
loop at TimerTimer}
{$ifdef LogIt}
LogLine ('GetImageRequest Done - Error '+IntToStr(Error));
{$endif}
Pending.Add(ImHTTP.ImRec);
FreeAndNil(ImHTTP.ImRec.Stream);
ImHTTP.ImRec := Nil; {so it won't get free'd below}
Timer.Enabled := True;
end;
(*Optional code to just ignore the error
begin {an error occured, forget this image}
Inc(NumImageDone);
Progress(NumImageDone, NumImageTot);
end; *)
end;
HTTPList.Remove(ImHTTP);
ImHTTP.Free;
if NumImageDone >= NumImageTot then
CheckEnableControls;
except
end;
end;
{----------------THTTPForm.TimerTimer}
procedure THTTPForm.TimerTimer(Sender: TObject);
{Images cannot necessarily be inserted at the moment they become available since
the system may be busy with other things. Hence they are added to a Pending
list and this timing loop repeatedly trys to insert them}
var
FName: String;
begin
Timer.Enabled := False;
if Pending.Count > 0 then
with ImageRec(Pending[0]) do
if FrameBrowser.InsertImage(Viewer, ID, Stream) then
begin
if Assigned(Stream) then {Stream can be Nil}
begin
{save image in cache file}
FName := DiskCache.AddNameToCache(URL, '', ImgType, False);
if FName <> '' then
try
Stream.SaveToFile(FName);
except
end;
Stream.Free;
end;
Pending.Delete(0);
Free;
Inc(NumImageDone);
Progress(NumImageDone, NumImageTot);
end;
if (Pending.Count > 0) or (HTTPList.Count > 0) then
Timer.Enabled := True; {still have images to process}
CheckEnableControls;
end;
{----------------THTTPForm.CancelButtonClick}
procedure THTTPForm.CancelButtonClick(Sender: TObject);
begin
AnAbort := True;
If Assigned(Connection) then
Connection.Abort;
ClearProcessing;
CheckEnableControls;
end;
{----------------THTTPForm.HistoryChange}
procedure THTTPForm.HistoryChange(Sender: TObject);
{OnHistoryChange handler -- history list has changed}
var
I: integer;
Cap: string;
begin
with Sender as TFrameBrowser do
begin
{check to see which buttons are to be enabled}
FwdButton.Enabled := FwdButtonEnabled;
BackButton.Enabled := BackButtonEnabled;
{Enable and caption the appropriate history menuitems}
HistoryMenuItem.Visible := History.Count > 0;
for I := 0 to MaxHistories-1 do
with Histories[I] do
if I < History.Count then
Begin
Cap := History.Strings[I]; {keep local file name}
if TitleHistory[I] <> '' then
Cap := Cap + '--' + TitleHistory[I];
Caption := copy(Cap, 1, 80);
Visible := True;
Checked := I = HistoryIndex;
end
else
Histories[I].Visible := False;
Caption := DocumentTitle; {keep the Form caption updated}
FrameBrowser.SetFocus;
end;
end;
{----------------THTTPForm.HistoryClick}
procedure THTTPForm.HistoryClick(Sender: TObject);
{A history list menuitem got clicked on}
var
I: integer;
begin
{Changing the HistoryIndex loads and positions the appropriate document}
I := (Sender as TMenuItem).Tag;
URLBase := GetUrlBase(FrameBrowser.History.Strings[I]); {update URLBase for new document}
FrameBrowser.HistoryIndex := I;
end;
{----------------THTTPForm.WMLoadURL}
procedure THTTPForm.WMLoadURL(var Message: TMessage);
begin
GetButtonClick(Self);
end;
{----------------THTTPForm.Openfile1Click}
procedure THTTPForm.Openfile1Click(Sender: TObject);
{Open a local disk file}
begin
if CurrentLocalFile <> '' then
OpenDialog.InitialDir := ExtractFilePath(CurrentLocalFile)
else
OpenDialog.InitialDir := ExtractFilePath(ParamStr(0));
OpenDialog.FilterIndex := 1;
OpenDialog.Filename := '';
if OpenDialog.Execute then
begin
UrlComboBox.Text := 'file:///'+DosToHTMLNoSharp(OpenDialog.Filename);
GetButtonClick(Nil);
Caption := FrameBrowser.DocumentTitle;
CurrentLocalFile := FrameBrowser.CurrentFile;
end;
end;
{----------------THTTPForm.HotSpotTargetCovered}
procedure THTTPForm.HotSpotTargetCovered(Sender: TObject; const Target, URL: ThtString);
{mouse moved over or away from a hot spot. Change the status line}
begin
if URL = '' then
StatusBarMain.Panels[2].Text := ''
else
if Target <> '' then
StatusBarMain.Panels[2].Text := 'Target: '+Target+' URL: '+URL
else
StatusBarMain.Panels[2].Text := 'URL: '+URL
end;
{----------------THTTPForm.HotSpotTargetClick}
procedure THTTPForm.HotSpotTargetClick(Sender: TObject; const Target, URL: ThtString; var Handled: Boolean);
{a link was clicked. URL is a full url here have protocol and path added. If
you need the actual link string, it's available in the TFrameBrowser URL property}
const
snd_Async = $0001; { play asynchronously }
var
Protocol, Ext: string;
PC: array[0..255] of char;
S, Params: string;
K: integer;
Tmp: string;
begin
{$ifdef LogIt}
LogLine ('HotSpotTargetClick: ' + URL);
{$endif}
Protocol := GetProtocol(URL);
if Protocol = 'mailto' then
begin
Tmp := URL + #0; {for Delphi 1}
{call mail program}
{Note: ShellExecute causes problems when run from Delphi 4 IDE}
ShellExecute(Handle, nil, @Tmp[1], nil, nil, SW_SHOWNORMAL);
Handled := True;
Exit;
end;
{Note: it would be nice to handle ftp protocol here also as some downloads use
this protocol}
Ext := Lowercase(GetURLExtension(URL));
if Pos('http', Protocol) > 0 then
begin
if (CompareText(Ext, 'zip') = 0) or (CompareText(Ext, 'exe') = 0) then
begin
{download can't be done here. Post a message to do it later at WMDownload}
DownLoadURL := URL;
PostMessage(handle, wm_DownLoad, 0, 0);
Handled := True;
Exit;
end;
end;
if (Protocol = 'file') then
begin
S := URL;
K := Pos(' ', S); {look for parameters}
if K = 0 then
K := Pos('?', S); {could be '?x,y' , etc}
if K > 0 then
begin
Params := Copy(S, K+1, 255); {save any parameters}
setlength(S, K-1); {truncate S}
end
else
Params := '';
S := HTMLToDos(S);
if Ext = 'wav' then
begin
Handled := True;
sndPlaySound(StrPCopy(PC, S), snd_ASync);
end
else
if Ext = 'exe' then
begin
Handled := True;
ShellExecute(Handle, nil, PChar(S), PChar(Params), nil, sw_Show);
// WinExec(StrPCopy(PC, S+' '+Params), sw_Show);
end
else
if (Ext = 'mid') or (Ext = 'avi') then
begin
Handled := True;
ShellExecute(Handle, nil, PChar('MPlayer.exe'), PChar(' /play /close ' +Params), nil, sw_Show);
// WinExec(StrPCopy(PC, 'MPlayer.exe /play /close '+S), sw_Show);
end;
{else ignore other extensions}
UrlComboBox.Text := URL;
Exit;
end;
UrlComboBox.Text := URL; {other protocall}
end;
procedure THTTPForm.CheckEnableControls;
begin
if not FrameBrowser.Processing and
(not Assigned(Connection) or (Connection.State in [httpReady, httpNotConnected])) and
(HTTPList.Count = 0) then
begin
EnableControls;
StatusBarMain.Panels[1].Text := 'DONE';
end;
end;
procedure THTTPForm.ClearProcessing;
var
I: integer;
begin
for I := 0 to HTTPList.Count-1 do {free any Image HTTPs existing}
with TImageHTTP(HTTPList.Items[I]) do
begin
Free;
end;
HTTPList.Clear;
for I := 0 to Pending.Count-1 do
begin
ImageRec(Pending.Items[I]).Stream.Free;
ImageRec(Pending.Items[I]).Free;
end;
Pending.Clear;
end;
procedure THTTPForm.ViewerClear(Sender: TObject);
{A ThtmlViewer is about to be cleared. Cancel any image processing destined for it}
var
I: integer;
Vw: ThtmlViewer;
begin
Vw := Sender as ThtmlViewer;
for I := HTTPList.Count-1 downto 0 do
with TImageHTTP(HTTPList.Items[I]) do
if ImRec.Viewer = Vw then
begin
Free;
HTTPList.Delete(I);
end;
for I := Pending.Count-1 downto 0 do
with ImageRec(Pending.Items[I]) do
if Viewer = Vw then
begin
Stream.Free;
Free;
Pending.Delete(I);
end;
end;
procedure THTTPForm.DeleteCacheClick(Sender: TObject);
begin
DiskCache.EraseCache;
end;
procedure THTTPForm.wmDropFiles(var Message: TMessage);
{handles dragging of file into browser window}
var
S: string;
Count: integer;
begin
Count := DragQueryFile(Message.WParam, 0, @S[1], 200);
SetLength(S, Count);
DragFinish(Message.WParam);
if Count >0 then
begin
UrlComboBox.Text := 'file:///'+DosToHTMLNoSharp(S);
GetButtonClick(Nil);
CurrentLocalFile := FrameBrowser.CurrentFile;
end;
Message.Result := 0;
end;
procedure THTTPForm.Exit1Click(Sender: TObject);
begin
Close;
end;
procedure THTTPForm.ShowImagesClick(Sender: TObject);
begin
FrameBrowser.ViewImages := not FrameBrowser.ViewImages;
ShowImages.Checked := FrameBrowser.ViewImages;
end;
procedure THTTPForm.Source1Click(Sender: TObject);
begin
if Self.FrameBrowser.ActiveViewer <> nil then begin
with TInfoForm.Create(Application) do
try
Caption := 'HTTP Headers';
mmoInfo.Clear;
mmoInfo.Lines.Text := FrameBrowser.ActiveViewer.DocumentSource;
ShowModal;
finally
Free;
end;
end;
end;
procedure THTTPForm.ReloadClick(Sender: TObject);
{the Reload button was clicked}
begin
ReloadButton.Enabled := False;
Reloading := True;
FrameBrowser.Reload;
ReloadButton.Enabled := True;
FrameBrowser.SetFocus;
end;
procedure THTTPForm.WMDownLoad(var Message: TMessage);
{Handle download of file}
var
DownLoadForm: TDownLoadForm;
begin
SaveDialog.Filename := GetURLFilenameAndExt(DownLoadURL);
SaveDialog.InitialDir := Cache;
if SaveDialog.Execute then
begin
DownLoadForm := TDownLoadForm.Create(Self);
try
with DownLoadForm do
begin
Filename := SaveDialog.Filename;
DownLoadURL := Self.DownLoadURL;
Proxy := Self.Proxy;
ProxyPort := Self.ProxyPort;
UserAgent := UsrAgent;
ShowModal;
end;
finally
DownLoadForm.Free;
end;
end;
end;
procedure THTTPForm.FormShow(Sender: TObject);
{OnShow handler. Handles loading when a new instance is initiated by WinExec}
var
S: string;
I: integer;
{$ifdef UseSSL}
h1, h2: THandle;
{$endif}
begin
{$ifdef UseSSL} {check to see the DLLs for Secure Socket Layer can be found}
h1 := LoadLibrary('libeay32.dll');
h2 := LoadLibrary('ssleay32.dll');
if h2 = 0 then begin
{alternative name for mingw32 versions of OpenSSL}
h2 := LoadLibrary('libssl32.dll');
end;
if (h1 = 0) or (h2 = 0) then
begin
if Monitor1 then
ShowMessage('One or both Secure Socket Layer (SSL) DLLs cannot be found.'^M^J+
'See download information which follows.');
SSL := Nil;
end
else
begin
SSL := TIdSSLIOHandlerSocketOpenSSL.Create(Nil);
SSL.SSLOptions.Method := sslvSSLv23;
SSL.SSLOptions.Mode := sslmClient;
end;
FreeLibrary(h1);
FreeLibrary(h2);
{$else}
//SSL := Nil;
{$endif}
if (ParamCount >= 1) then
begin {Parameter is file to load}
S := CmdLine;
I := Pos('" ', S);
if I > 0 then
Delete(S, 1, I+1) {delete EXE name in quotes}
else
Delete(S, 1, Length(ParamStr(0))); {in case no quote marks}
I := Pos('"', S);
while I > 0 do {remove any quotes from parameter}
begin
Delete(S, I, 1);
I := Pos('"', S);
end;
S := Trim(S);
if not IsFullURL(S) then
S := 'file:///'+DosToHtml(S);
URLCombobox.Text := Trim(S); {Parameter is URL to load}
PostMessage(Handle, wm_LoadURL, 0, 0);
end
{$ifdef M4Viewer}
else
begin
SelectStartingMode;
If M4ConfigDeleteCache Then
DiskCache.EraseCache;
URLCombobox.Text := startfile;
SendMessage(Handle, wm_LoadURL, 0, 0);
end;
{$else}
else
begin
URLCombobox.Text := 'res:///page0.htm';
SendMessage(Handle, wm_LoadURL, 0, 0);
end;
{$endif}
end;
{----------------THTTPForm.BlankWindowRequest}
procedure THTTPForm.BlankWindowRequest(Sender: TObject; const Target, URL: ThtString);
{OnBlankWindowRequest handler. Either a Target of _blank or an unknown target
was called for. Load a new instance}
var
S: string;
begin
S := URL;
if not IsFullURL(S) then
S := CombineURL(URLBase, S);
ShellAPI.ShellExecute(Handle,nil,PChar(ParamStr(0)),PChar(S),nil,sw_show);
end;
procedure THTTPForm.Find1Click(Sender: TObject);
begin
FindDialog.Execute;
end;
procedure THTTPForm.FindDialogFind(Sender: TObject);
begin
with FindDialog do
begin
if not FrameBrowser.FindEx(FindText, frMatchCase in Options, not (frDown in Options)) then
MessageDlg('No further occurances of "'+FindText+'"', mtInformation, [mbOK], 0);
end;
end;
procedure THTTPForm.Edit1Click(Sender: TObject);
begin
with FrameBrowser do
begin
Copy1.Enabled := SelLength <> 0;
SelectAll1.Enabled := (ActiveViewer <> Nil) and (ActiveViewer.CurrentFile <> '');
Find1.Enabled := SelectAll1.Enabled;
end;
end;
procedure THTTPForm.SelectAll1Click(Sender: TObject);
begin
FrameBrowser.SelectAll;
end;
procedure THTTPForm.Copy1Click(Sender: TObject);
begin
FrameBrowser.CopyToClipboard;
end;
procedure THTTPForm.URLComboBoxKeyPress(Sender: TObject; var Key: Char);
{trap CR in combobox}
begin
if (Key = #13) and (URLComboBox.Text <> '') then
Begin
Key := #0;
GetButtonClick(Self);
end;
end;
procedure THTTPForm.URLComboBoxClick(Sender: TObject);
begin
if URLComboBox.Text <> '' then begin
FMetaInfo.Clear;
GetButtonClick(Self);
end;
end;
{----------------THTTPForm.RightClick}
procedure THTTPForm.RightClick(Sender: TObject;
Parameters: TRightClickParameters);
{OnRightClick handler. Bring up popup menu allowing saving of image or opening
a link in another window}
var
Pt: TPoint;
S, Dest: string;
I: integer;
Viewer: ThtmlViewer;
HintWindow: ThtHintWindow;
ARect: TRect;
begin
Viewer := Sender as ThtmlViewer;
with Parameters do
begin
FoundObject := Image;
if (FoundObject <> Nil) and (FoundObject.Bitmap <> Nil) then
begin
if not IsFullUrl(FoundObject.Source) then
FoundObjectName := CombineURL(FrameBrowser.GetViewerUrlBase(Viewer), FoundObject.Source)
else
FoundObjectName := FoundObject.Source;
SaveImageAs.Enabled := True;
end
else
SaveImageAs.Enabled := False;
if URL <> '' then
begin
S := URL;
I := Pos('#', S);
if I >= 1 then
begin
Dest := System.Copy(S, I, 255); {local destination}
S := System.Copy(S, 1, I-1); {the file name}
end
else
Dest := ''; {no local destination}
if S = '' then
S := Viewer.CurrentFile;
if IsFullUrl(S) then
NewWindowFile := S + Dest
else
NewWindowFile := CombineURL(FrameBrowser.GetViewerUrlBase(Viewer), S) + Dest;
OpenInNewWindow.Enabled := True;
end
else
OpenInNewWindow.Enabled := False;
GetCursorPos(Pt);
if Length(CLickWord) > 0 then
begin
HintWindow := ThtHintWindow.Create(Self);
try
ARect := Rect(0,0,0,0);
DrawText(HintWindow.Canvas.Handle, @ClickWord[1], Length(ClickWord), ARect, DT_CALCRECT);
with ARect do
HintWindow.ActivateHint(Rect(Pt.X+20, Pt.Y-(Bottom-Top)-15, Pt.x+30+Right, Pt.Y-15), ClickWord);
PopupMenu.Popup(Pt.X, Pt.Y);
finally
HintWindow.Free;
end;
end
else
PopupMenu.Popup(Pt.X, Pt.Y);
end;
end;
procedure THTTPForm.SaveImageAsClick(Sender: TObject);
{response to popup menu selection to save image}
var
Stream: TMemoryStream;
S: string;
DocType: ThtmlFileType;
AConnection: TURLConnection;
Dummy: string;
begin
SaveDialog.InitialDir := Cache;
SaveDialog.Filename := GetURLFilenameAndExt(FoundObjectName);
if SaveDialog.Execute then
begin
Stream := TMemoryStream.Create;
try
if DiskCache.GetCacheFilename(FoundObjectName, S, DocType, Dummy) then
begin
Stream.LoadFromFile(S);
Stream.SaveToFile(SaveDialog.Filename);
end
else
begin
AConnection := TURLConnection.GetConnection(FoundObjectName);
if AConnection <> nil then
try
AConnection.InputStream := Stream;
AConnection.Get(FoundObjectName);
Stream.SaveToFile(SaveDialog.Filename);
finally
AConnection.Free;
end;
end;
finally
Stream.Free;
end;
end;
end;
procedure THTTPForm.OpenInNewWindowClick(Sender: TObject);
begin
ShellAPI.ShellExecute(Handle,nil,PChar(ParamStr(0)),PChar('"'+NewWindowFile+'"'),nil,sw_show);
end;
procedure THTTPForm.SaveURLClick(Sender: TObject);
{put the entry in the combobox in the list. It will be saved on exit}
begin
with URLComboBox do
begin
if Items.IndexOf(Text) < 0 then
Items.Add(Text);
end;
end;
procedure THTTPForm.HTTPDocData1(Sender: TObject);
begin
StatusBarMain.Panels[0].Text := 'Text: ' + IntToStr(Connection.RcvdCount) + ' bytes';
Progress(Connection.RcvdCount, Connection.ContentLength);
end;
procedure THTTPForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if Assigned(Connection) then
Connection.Abort;
ClearProcessing;
{$ifdef LogIt}
FreeAndNil(logwin.LogForm);
{$endif}
end;
procedure THTTPForm.Progress(Num, Den: integer);
var
Percent: integer;
begin
if Den = 0 then
Percent := 0
else
Percent := (100*Num) div Den;
Gauge.Position := Percent;
Gauge.Max := 100;
StatusBarMain.Panels.Items[1].Style := psOwnerDraw;
end;
procedure THTTPForm.StatusBarMainDrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
begin
if Panel = StatusBar.Panels[1] then
with Gauge do begin
Top := Rect.Top;
Left := Rect.Left;
Width := Rect.Right - Rect.Left - 15;
Height := Rect.Bottom - Rect.Top;
end;
end;
Procedure THTTPForm.CheckException(Sender: TObject; E: Exception);
begin
if E is ESpecialException then
begin
ShowMessage(E.Message);
AnAbort := False;
end
else
begin
{$IFDEF LogIt}
if E is EIdHTTPProtocolException then begin
LogLine( IntToStr(EIdHTTPProtocolException(E).ErrorCode)+ ' - '+ EIdHTTPProtocolException(E).ErrorMessage );
end;
{$ENDIF}
Application.ShowException(E);
end;
end;
procedure THTTPForm.DisableControls;
begin
URLCombobox.Enabled:=false;
CancelButton.Enabled:=true;
ReloadButton.Enabled := False;
Animate1.Visible := True;
Animate1.Play(1, Animate1.FrameCount,0);
Gauge.Visible := True;
end;
procedure THTTPForm.EnableControls;
begin
URLCombobox.Enabled:=true;
CancelButton.Enabled:=false;
ReloadButton.Enabled := FrameBrowser.CurrentFile <> '';
Reloading := False;
Animate1.Active := False;
Animate1.Visible := False;
Gauge.Visible := False;
end;
procedure THTTPForm.HTTPHeaderData(Sender: TObject);
{Selected Header data comes here}
var
S: string;
I: integer;
begin
S := Connection.LastResponse;
{see if Authentication is required. If so, need the Realm string}
I := Pos('www-authenticate', Lowercase(S));
if I > 0 then
begin
I := Pos('realm', Lowercase(S));
if (I > 0) then
begin
S := Copy(S, I+5, Length(S));
I := Pos('=', S);
if I > 0 then
begin
S := Trim(Copy(S, I+1, Length(S)));
ARealm := S;
end;
end;
Exit;
end;
{see what's allowed for error 405}
I := Pos('allow:', LowerCase(S));
if (I > 0) then
begin
Allow := Lowercase(S);
Exit;
end;
end;
procedure THTTPForm.HTTPHeaders1Click(Sender: TObject);
begin
with TInfoForm.Create(Application) do
try
Caption := 'HTTP Headers';
mmoInfo.Clear;
mmoInfo.Lines.Add('Request');
mmoInfo.Lines.AddStrings( Self.FHeaderRequestData );
mmoInfo.Lines.Add('Response');
mmoInfo.Lines.AddStrings( Self.FHeaderResponseData );
ShowModal;
finally
Free;
end;
end;
procedure THTTPForm.BackButtonClick(Sender: TObject);
begin
FrameBrowser.GoBack;
CheckEnableControls;
end;
procedure THTTPForm.FwdButtonClick(Sender: TObject);
begin
FrameBrowser.GoFwd;
CheckEnableControls;
end;
{----------------TImageHTTP.CreateIt}
constructor TImageHTTP.CreateIt(AOwner: TComponent; IRec: TObject);
begin
inherited Create(AOwner);
ImRec := IRec as ImageRec;
ImRec.Stream := TMemoryStream.Create;
URL := ImRec.URL;
Connection := TURLConnection.GetConnection(URL);
Connection.InputStream := ImRec.Stream;
end;
{----------------TImageHTTP.GetAsync}
procedure TImageHTTP.GetAsync;
begin
Connection.GetAsync(URL);
end;
{----------------TImageHTTP.Destroy}
destructor TImageHTTP.Destroy;
begin
if Assigned(ImRec) then
begin
ImRec.Stream.Free;
ImRec.Free;
end;
Connection.Free;
inherited Destroy;
end;
{----------------THTTPForm.Processing}
procedure THTTPForm.Processing(Sender: TObject; ProcessingOn: Boolean);
begin
if ProcessingOn then
begin {disable various buttons and menuitems during processing}
FwdButton.Enabled := False;
BackButton.Enabled := False;
ReloadButton.Enabled := False;
end
else
begin
FwdButton.Enabled := FrameBrowser.FwdButtonEnabled;
BackButton.Enabled := FrameBrowser.BackButtonEnabled;
ReloadButton.Enabled := FrameBrowser.CurrentFile <> '';
CheckEnableControls;
{$ifdef LogIt}
LogLine ('Page Completed' + #13#10);
{$endif}
end;
end;
procedure THTTPForm.PrintPreviewClick(Sender: TObject);
var
{$ifdef UseOldPreviewForm}
pf: TPreviewForm;
{$else UseOldPreviewForm}
pf: TBegaHtmlPrintPreviewForm;
{$endif UseOldPreviewForm}
Viewer: ThtmlViewer;
Abort: boolean;
begin
Viewer := FrameBrowser.ActiveViewer;
if Assigned(Viewer) then
begin
{$ifdef UseOldPreviewForm}
pf := TPreviewForm.CreateIt(Self, Viewer, Abort);
{$else UseOldPreviewForm}
pf := TBegaHtmlPrintPreviewForm.Create(Self);
pf.FrameViewer := FrameBrowser;
Abort := False;
{$endif UseOldPreviewForm}
try
if not Abort then
pf.ShowModal;
finally
pf.Free;
end;
end;
end;
procedure THTTPForm.File1Click(Sender: TObject);
begin
Print1.Enabled := FrameBrowser.ActiveViewer <> Nil;
PrintPreview.Enabled := Print1.Enabled;
end;
procedure THTTPForm.PageInfo1Click(Sender: TObject);
begin
with TInfoForm.Create(Application) do
try
Caption := 'Page Info';
mmoInfo.Clear;
if FrameBrowser.UseQuirksMode then begin
mmoInfo.Lines.Add( FrameBrowser.DocumentTitle );
mmoInfo.Lines.Add( 'Render Mode: Quirks Mode');
end else begin
mmoInfo.Lines.Add( FrameBrowser.DocumentTitle );
mmoInfo.Lines.Add( 'Render Mode: Standards Mode');
end;
if Self.FMetaInfo.Count >0 then begin
mmoInfo.Lines.Add ( 'Meta Information');
mmoInfo.Lines.Add ( '---');
mmoInfo.Lines.AddStrings( Self.FMetaInfo );
mmoInfo.Lines.Add ( '---');
end;
ShowModal;
finally
Free;
end;
end;
procedure THTTPForm.Print1Click(Sender: TObject);
begin
with PrintDialog do
if Execute then
if PrintRange = prAllPages then
FrameBrowser.Print(1, 9999)
else
FrameBrowser.Print(FromPage, ToPage);
end;
procedure THTTPForm.PrintHeader(Sender: TObject; Canvas: TCanvas; NumPage,
W, H: Integer; var StopPrinting: Boolean);
var
AFont: TFont;
begin
AFont := TFont.Create;
AFont.Name := 'Arial';
AFont.Size := 8;
with Canvas do
begin
Font.Assign(AFont);
SetBkMode(Handle, Transparent);
SetTextAlign(Handle, TA_Bottom or TA_Left);
if FrameBrowser.ActiveViewer <> Nil then
begin
TextOut(50, H-5, FrameBrowser.ActiveViewer.DocumentTitle);
SetTextAlign(Handle, TA_Bottom or TA_Right);
TextOut(W-50, H-5, FrameBrowser.ActiveViewer.CurrentFile);
end;
end;
AFont.Free;
end;
procedure THTTPForm.PrintFooter(Sender: TObject; Canvas: TCanvas; NumPage,
W, H: Integer; var StopPrinting: Boolean);
var
AFont: TFont;
begin
AFont := TFont.Create;
AFont.Name := 'Arial';
AFont.Size := 8;
with Canvas do
begin
Font.Assign(AFont);
SetTextAlign(Handle, TA_Bottom or TA_Left);
TextOut(50, 20, DateToStr(Date));
SetTextAlign(Handle, TA_Bottom or TA_Right);
TextOut(W-50, 20, 'Page '+IntToStr(NumPage));
end;
AFont.Free;
end;
procedure THTTPForm.About1Click(Sender: TObject);
var
AboutBox: TAboutBox;
begin
AboutBox := TAboutBox.CreateIt(Self, 'FrameBrowser Indy Demo', 'TFrameBrowser');
try
AboutBox.ShowModal;
finally
AboutBox.Free;
end;
end;
procedure THTTPForm.Proxy1Click(Sender: TObject);
begin
ProxyForm := TProxyForm.Create(Self);
ProxyForm.ProxyEdit.Text := Proxy;
ProxyForm.PortEdit.Text := ProxyPort;
ProxyForm.ProxyUsername.Text := ProxyUser;
ProxyForm.ProxyPassword.Text := ProxyPassword;
try
if ProxyForm.ShowModal = mrOK then
begin
Proxy := ProxyForm.ProxyEdit.Text;
ProxyPort := ProxyForm.PortEdit.Text;
ProxyUser := ProxyForm.ProxyUsername.Text;
ProxyPassword := ProxyForm.ProxyPassword.Text;
end;
finally
ProxyForm.Free;
end;
end;
procedure THTTPForm.DemoInformation1Click(Sender: TObject);
begin
UrlComboBox.Text := 'res:///page0.htm';
GetButtonClick(Self);
end;
procedure THTTPForm.FrameBrowserMeta(Sender: TObject; const HttpEq, Name, Content: ThtString);
begin
{$ifdef LogIt}
LogLine ('FrameBrowserMeta, HttpEq=' + HttpEq + ', MetaName=' + Name + ', MetaContent=' + Content);
{$endif}
FMetaInfo.Add('HttpEq=' + HttpEq + ', MetaName=' + Name + ', MetaContent=' + Content);
end;
procedure THTTPForm.FrameBrowserMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
TitleStr: string;
begin
if not Timer1.Enabled and (Sender is ThtmlViewer) and Assigned(ActiveControl)
and ActiveControl.Focused then
begin
TitleViewer := ThtmlViewer(Sender);
TitleStr := TitleViewer.TitleAttr;
if TitleStr = '' then
OldTitle := ''
else
if TitleStr <> OldTitle then
begin
TimerCount := 0;
Timer1.Enabled := True;
OldTitle := TitleStr;
end;
end;
end;
procedure THTTPForm.CloseHints;
begin
Timer1.Enabled := False;
HintWindow.ReleaseHandle;
HintVisible := False;
TitleViewer := Nil;
end;
procedure THTTPForm.Timer1Timer(Sender: TObject);
const
StartCount = 2; {timer counts before hint window opens}
EndCount = 20; {after this many timer counts, hint window closes}
var
Pt, Pt1: TPoint;
ARect: TRect;
TitleStr: ThtString;
begin
if not Assigned(TitleViewer) then
begin
CloseHints;
Exit;
end;
Inc(TimerCount);
GetCursorPos(Pt);
try {in case TitleViewer becomes corrupted}
Pt1 := TitleViewer.ScreenToClient(Pt);
TitleStr := TitleViewer.TitleAttr;
if (TitleStr = '') or not PtInRect(TitleViewer.ClientRect, Pt1)then
begin
OldTitle := '';
CloseHints;
Exit;
end;
if TitleStr <> OldTitle then
begin
TimerCount := 0;
OldTitle := TitleStr;
HintWindow.ReleaseHandle;
HintVisible := False;
Exit;
end;
if TimerCount > EndCount then
CloseHints
else
if (TimerCount >= StartCount) and not HintVisible then
begin
ARect := HintWindow.CalcHintRect(300, TitleStr, Nil);
with ARect do
HintWindow.ActivateHint(Rect(Pt.X, Pt.Y+18, Pt.X+Right, Pt.Y+18+Bottom), TitleStr);
HintVisible := True;
end;
{note: this exception can occur when switching frames while TitleViewer is active. It is
adequately handled here and only appears in the IDE when "Stop on Delphi Exceptions" is
turned on}
except
CloseHints;
end;
end;
procedure THTTPForm.HTTPRedirect(Sender: TObject; var Dest: String;
var NumRedirect: Integer; var Handled: boolean; var Method: TIdHTTPMethod);
var
Proto: string;
FullUrl: boolean;
begin
FullURL := True;
Proto := GetProtocol(UrlBase);
if IsFullUrl(Dest) then {it's a full URL}
begin
Dest := Normalize(Dest);
NewLocation := Dest;
end
else
begin
NewLocation := CombineURL(URLBase, Dest);
FullURL := False;
end;
URLBase := GetUrlBase(NewLocation);
{The following is apparently no longer necessary}
if (Proto = 'https') or not FullURL or (GetProtocol(UrlBase) = 'https') then
begin
Handled := False; {we will handle it}
Redirect := True;
end
else
Handled := True; {IdHTTP will handle it}
end;
procedure THTTPForm.SaveCookies(ASender: TObject; ACookieCollection: TIdCookies);
var
M : TMemIniFile;
{$ifdef HasCookieCollectionPersistent}
i : Integer;
LU : TIdURI;
{$endif}
begin
if Monitor1 then {write only if first instance}
begin
M := TMemIniFile.Create(Cache+CookieFile );
try
m.Clear;
{$ifdef HasCookieCollectionPersistent}
LU := TIdURI.Create;
try
m.Clear;
for i := 0 to ACookieCollection.Count -1 do
begin
if ACookieCollection[i].Persistent then begin
LU.URI := '';
LU.Path := ACookieCollection[i].Path;
LU.Host := ACookieCollection[i].Domain;
if ACookieCollection[i].Secure then begin
LU.Protocol := 'https'
end else begin
LU.Protocol := 'http';
end;
m.WriteString(LU.URI,IntToStr(i),
LocalDateTimeToGMT( ACookieCollection[i].CreatedAt ) + '|' +
LocalDateTimeToGMT( ACookieCollection[i].LastAccessed ) + '|' +
ACookieCollection[i].ServerCookie );
end;
end;
finally
LU.Free;
end;
{$endif}
m.UpdateFile;
finally
m.Free;
end;
end;
end;
{NOTE about Cookies in Indy 10.
The cookie entine was completely rewritten in Indy 10.
The code does not load and save every cookie. I do not consider this a bug at all
because:
1) Cookies expire
2) Some cookies are session cookies that are meant to only last for your session.
Those cookies do not have expiration timestamps.
}
procedure ReadCookieValues(m : TMemIniFile;
AURI : TIdURI;
AValues : TStrings;
ACookieCollection: TIdCookieManager);
var i : Integer;
s, LC, LA : String;
LCookie : TIdCookie;
begin
for i := 0 to AValues.Count - 1 do begin
s := AValues[i];
Fetch(s,'=');
LC := Fetch(s,'|');
LA := Fetch(s,'|');
LCookie := ACookieCollection.CookieCollection.AddServerCookie(s,AURI);
if Assigned(LCookie) then begin
LCookie.CreatedAt := GMTToLocalDateTime(LC);
LCookie.LastAccessed := GMTToLocalDateTime(LA);
end;
end;
end;
procedure THTTPForm.LibraryInformation1Click(Sender: TObject);
var LId : TIdC_ULONG;
begin
//
with TInfoForm.Create(Application) do
try
Caption := 'Library Information';
mmoInfo.Lines.Clear;
//
// 1 - 1 - bit 0
// 2 - 2 - bit 1
// 4 - 4 - bit 2
// 8 - 8 - bit 3
// 10 - 16 - bit 4
// 20 - 32 - bit 5
// 40 - 64 - bit 6
// 80 - 128 - bit 7
// 100 - 256 - bit 8
// 200 - 512 - bit 9
// 400 - 1024 - bit 10
// 800 - 2048 - bit 11
// 1000 - 4096 - bit 12
// 2000 - 8192 - bit 13
// 4000 - 16384 - bit 14
// 8000 - 32768 - bit 15
// 10000 - 65536 - bit 16
// 20000 - 131072 - bit 17
// 40000 - 262144 - bit 18
// 80000 - 524288 - bit 19
// 100000 - 1048576 - bit 20
// 200000 - 2097152 - bit 21
// 400000 - 4194304 - bit 22
// 800000 - 8388608 - bit 23
// 1000000 - 16777216 - bit 24
// 2000000 - 33554432 - bit 25
// 4000000 - 67108864 - bit 26
// 8000000 - 134217728 - bit 27
//10000000 - 268435456 - bit 28
//20000000 - 536870912 - bit 29
//40000000 - 1073741824 - bit 30
//80000000 - 2147483648 - bit 31
{$ifdef UseZLib}
mmoInfo.Lines.Add('ZLib Version: '+ zlibVersion);
LId := zlibCompileFlags;
mmoInfo.Lines.Add('Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: ');
case LId and $03 of
0 : mmoInfo.Lines.Add( 'Size of uInt : 16-bit');
1 : mmoInfo.Lines.Add( 'Size of uInt : 32-Bit');
2 : mmoInfo.Lines.Add( 'Size of uInt : 64-Bit');
3 : mmoInfo.Lines.Add( 'Size of uInt : Other');
end;
case ((LId And $C) div $4) of
0 : mmoInfo.Lines.Add( 'Size of uLong : 16-bit');
1 : mmoInfo.Lines.Add( 'Size of uLong : 32-Bit');
2 : mmoInfo.Lines.Add( 'Size of uLong : 64-Bit');
3 : mmoInfo.Lines.Add( 'Size of uLong : Other');
end;
case ((LId And $30) div $10) of
0 : mmoInfo.Lines.Add( 'Size of voidpf : 16-bit');
1 : mmoInfo.Lines.Add( 'Size of voidpf : 32-Bit');
2 : mmoInfo.Lines.Add( 'Size of voidpf : 64-Bit');
3 : mmoInfo.Lines.Add( 'Size of voidpf : Other');
end;
case ((LId And $C0) div $40) of
0 : mmoInfo.Lines.Add( 'Size of z_off_t : 16-bit');
1 : mmoInfo.Lines.Add( 'Size of z_off_t : 32-Bit');
2 : mmoInfo.Lines.Add( 'Size of z_off_t : 64-Bit');
3 : mmoInfo.Lines.Add( 'Size of z_off_t : Other');
end;
// debug 8
mmoInfo.Lines.Add( 'Compiler, assembler, and debug options: ');
if LId and $100 > 0 then begin
mmoInfo.Lines.Add( 'DEBUG : True');
end else begin
// mmoInfo.Lines.Add( 'DEBUG : False');
end;
// asm 9
if LId and $200 > 0 then begin
mmoInfo.Lines.Add( 'ASMV or ASMINF - use ASM code : True');
end else begin
// mmoInfo.Lines.Add( 'ASMV or ASMINF - use ASM code : False');
end;
//winapi 10
if LId and $400 > 0 then begin
mmoInfo.Lines.Add( 'ZLIB_WINAPI - exported functions use the WINAPI calling convention : True');
end else begin
// mmoInfo.Lines.Add( 'ZLIB_WINAPI - exported functions use the WINAPI calling convention : False');
end;
//11
//12
mmoInfo.Lines.Add( 'One-time table building (smaller code, but not thread-safe if true): ');
if LId and $1000 > 0 then begin
mmoInfo.Lines.Add( 'BUILDFIXED - build static block decoding tables when needed : True');
end else begin
// mmoInfo.Lines.Add( 'BUILDFIXED - build static block decoding tables when needed : False');
end;
//13
if LId and $2000 > 0 then begin
mmoInfo.Lines.Add( 'DYNAMIC_CRC_TABLE - build CRC calculation tables when needed : True');
end else begin
// mmoInfo.Lines.Add( 'DYNAMIC_CRC_TABLE - build CRC calculation tables when needed : False');
end;
//14
//15
//16
if (LId and ($10000 +$20000)> 0) then begin
mmoInfo.Lines.Add('Library content (indicates missing functionality): ');
if LId and $10000 > 0 then begin
mmoInfo.Lines.Add( 'NO_GZCOMPRESS - gz* functions cannot compress (to avoid linking deflate code when not needed) : True');
end else begin
// mmoInfo.Lines.Add( 'NO_GZCOMPRESS - gz* functions cannot compress (to avoid linking deflate code when not needed) : False');
end;
//17
if LId and $20000 > 0 then begin
mmoInfo.Lines.Add( 'NO_GZIP - deflate can''t write gzip streams, and inflate can''t detect and decode gzip streams (to avoid linking crc code) : True');
end else begin
// mmoInfo.Lines.Add( 'NO_GZIP - deflate can''t write gzip streams, and inflate can''t detect and decode gzip streams (to avoid linking crc code) : False');
end;
end;
//20
if (LId and ($100000 + $200000) > 0) then begin
mmoInfo.Lines.Add('Operation variations (changes in library functionality): ');
if LId and $100000 > 0 then begin
mmoInfo.Lines.Add( 'PKZIP_BUG_WORKAROUND - slightly more permissive inflate : True');
end else begin
// mmoInfo.Lines.Add( 'PKZIP_BUG_WORKAROUND - slightly more permissive inflate : False');
end;
//21
if LId and $200000 > 0 then begin
mmoInfo.Lines.Add( 'FASTEST - deflate algorithm with only one, lowest compression level : True');
end else begin
// mmoInfo.Lines.Add( 'FASTEST - deflate algorithm with only one, lowest compression level : False');
end;
end;
//24
mmoInfo.Lines.Add('The sprintf variant used by gzprintf (zero is best): ');
if LId and $1000000 > 0 then begin
mmoInfo.Lines.Add( '0 = vs*, 1 = s* - 1 means limited to 20 arguments after the format : True');
end else begin
mmoInfo.Lines.Add( '0 = vs*, 1 = s* - 1 means limited to 20 arguments after the format : False');
end;
//25
if LId and $2000000 > 0 then begin
mmoInfo.Lines.Add( '0 = *nprintf, 1 = *printf - 1 means gzprintf() not secure! : True');
end else begin
mmoInfo.Lines.Add( '0 = *nprintf, 1 = *printf - 1 means gzprintf() not secure! : False');
end;
//26
if LId and $2000000 > 0 then begin
mmoInfo.Lines.Add( '0 = returns value, 1 = void - 1 means inferred string length returned : True');
end else begin
mmoInfo.Lines.Add( '0 = returns value, 1 = void - 1 means inferred string length returned : False');
end;
{$endif}
ShowModal;
finally
Free;
end;
end;
procedure THTTPForm.LoadCookies(ACookieCollection: TIdCookieManager);
var
M : TMemIniFile;
sects : TStringList;
CookieValues : TStringList;
i : Integer;
LU : TIdURI;
begin
if FileExists(Cache+CookieFile) then
begin
M := TMemIniFile.Create(Cache+CookieFile );
try
sects := TStringList.Create;
try
CookieValues := TStringList.Create;
LU := TIdURI.Create;
try
m.ReadSections(sects);
for i := 0 to sects.Count - 1 do begin
m.ReadSectionValues(sects[i],CookieValues);
LU.URI := sects[i];
ReadCookieValues(m, LU, CookieValues, ACookieCollection);
CookieValues.Clear;
end;
finally
LU.Free;
CookieValues.Free;
end;
finally
sects.Free;
end;
finally
m.Free;
end;
end;
end;
{$ifdef LogIt}
procedure THTTPForm.LogTStrings(AStrings: TStrings);
var i : Integer;
begin
for i := 0 to AStrings.Count -1 do begin
LogLine (AStrings[i]);
end;
end;
{$endif}
procedure THTTPForm.AuthorizationEvent(Sender: TObject;
Authentication: TIdAuthentication; var Handled: Boolean);
begin
if Authentication is TIdBasicAuthentication then
with TIdBasicAuthentication(Authentication) do
ARealm := Realm;
Handled := False;
end;
{ TModIdLogFile }
procedure TModIdLogFile.LogWriteString(const AText: string);
begin
if Active then
inherited;
end;
procedure THTTPForm.FrameBrowserScript(Sender: TObject; const Name, ContentType, Src, Script: ThtString);
begin
{$ifdef LogIt}
LogLine ('FrameBrowserScript, Name=' + Name + ', Src=' + Src + ', Script=' + Script);
{$endif}
end;
end.
| 29.550886 | 162 | 0.655438 |
4774c7edc3e125a63cead91d97a24f54a0ca2672 | 3,695 | pas | Pascal | fmLogin.pas | geoffsmith82/DelphiIntuitAccess | e9a5474ca3b1eaee972d3b5bde09b03012bddebf | [
"MIT"
]
| 3 | 2021-07-31T08:15:29.000Z | 2021-08-20T10:46:07.000Z | fmLogin.pas | geoffsmith82/DelphiIntuitAccess | e9a5474ca3b1eaee972d3b5bde09b03012bddebf | [
"MIT"
]
| null | null | null | fmLogin.pas | geoffsmith82/DelphiIntuitAccess | e9a5474ca3b1eaee972d3b5bde09b03012bddebf | [
"MIT"
]
| null | null | null | unit fmLogin;
interface
uses
Winapi.Windows
, Winapi.Messages
, Winapi.ActiveX
, System.SysUtils
, System.Variants
, System.Classes
, System.IniFiles
, Vcl.Graphics
, Vcl.Controls
, Vcl.Forms
, Vcl.Dialogs
, Vcl.OleCtrls
, Vcl.Edge
, SHDocVw
, WebView2
;
type
TfrmLogin = class(TForm)
EdgeBrowser1: TEdgeBrowser;
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure EdgeBrowser1NavigationCompleted(Sender: TCustomEdgeBrowser; IsSuccess: Boolean; WebErrorStatus: TOleEnum);
procedure EdgeBrowser1NavigationStarting(Sender: TCustomEdgeBrowser; Args: TNavigationStartingEventArgs);
private
{ Private declarations }
FIniFile : TIniFile;
public
{ Public declarations }
procedure Login(url:string);
function GetRefreshToken: string;
end;
implementation
{$R *.dfm}
uses
System.Net.URLClient
, fmIntuitDemo
, dmIntuit
;
procedure TfrmLogin.FormDestroy(Sender: TObject);
begin
FreeAndNil(FIniFile);
end;
function TfrmLogin.GetRefreshToken: string;
begin
Result := FIniFile.ReadString('Authentication', 'RefreshToken', '');
end;
procedure TfrmLogin.FormCreate(Sender: TObject);
var
iniPath : string;
begin
iniPath := ChangeFileExt(ParamStr(0), '.ini');
FIniFile := TIniFile.Create(iniPath);
end;
procedure TfrmLogin.EdgeBrowser1NavigationCompleted(Sender: TCustomEdgeBrowser;
IsSuccess: Boolean; WebErrorStatus: TOleEnum);
var
uri : TURI;
state : String;
code : String;
i : Integer;
codeExists : Boolean;
url : string;
begin
codeExists := False;
try
url := Sender.LocationURL;
if URL.StartsWith('about:') then Exit;
uri := TURI.Create(URL);
OutputDebugString(PChar('Browser: ' + uri.ToString));
for i := 0 to Length(uri.Params)-1 do
begin
if uri.Params[i].Name='code' then
begin
codeExists := True;
Break;
end;
end;
except
end;
if not codeExists then
Exit;
code := uri.ParameterByName['code'];
state := uri.ParameterByName['state'];
dmIntuitAPI.RealmId := uri.ParameterByName['realmId'];
dmIntuitAPI.OAuth2Authenticator1.AuthCode := code;
Form1.Memo1.Lines.Add('url:'+URL);
dmIntuitAPI.OAuth2Authenticator1.ChangeAuthCodeToAccesToken;
Form1.Memo1.Lines.Add('Access Granted');
Form1.Memo1.Lines.Add(dmIntuitAPI.OAuth2Authenticator1.AccessToken);
FIniFile.WriteString('Authentication', 'RefreshToken', dmIntuitAPI.OAuth2Authenticator1.RefreshToken);
Close;
end;
procedure TfrmLogin.EdgeBrowser1NavigationStarting(Sender: TCustomEdgeBrowser; Args: TNavigationStartingEventArgs);
var
uri : TURI;
state : String;
code : String;
i : Integer;
codeExists : Boolean;
url : string;
begin
codeExists := False;
try
url := Sender.LocationURL;
if URL.StartsWith('about:') then Exit;
uri := TURI.Create(URL);
OutputDebugString(PChar('Browser: ' + uri.ToString));
for i := 0 to Length(uri.Params)-1 do
begin
if uri.Params[i].Name='code' then
begin
codeExists := True;
Break;
end;
end;
except
end;
if not codeExists then
Exit;
code := uri.ParameterByName['code'];
state := uri.ParameterByName['state'];
dmIntuitAPI.RealmId := uri.ParameterByName['realmId'];
dmIntuitAPI.OAuth2Authenticator1.AuthCode := code;
Form1.Memo1.Lines.Add('url:'+URL);
dmIntuitAPI.OAuth2Authenticator1.ChangeAuthCodeToAccesToken;
Form1.Memo1.Lines.Add('Access Granted');
Form1.Memo1.Lines.Add(dmIntuitAPI.OAuth2Authenticator1.AccessToken);
Close;
end;
procedure TfrmLogin.Login(url: string);
begin
EdgeBrowser1.Navigate(url);
ShowModal;
end;
end.
| 22.668712 | 120 | 0.705277 |
f1c0a112d46e72d28def724564e0eedb73d62db9 | 665 | pas | Pascal | Pascal/test/cohadar/pascal/programs/concurrent/test05.pas | cohadar/parapascal | 863bc9b8d7f813dd3bbf8f6e7df36d70de8f5242 | [
"MIT"
]
| null | null | null | Pascal/test/cohadar/pascal/programs/concurrent/test05.pas | cohadar/parapascal | 863bc9b8d7f813dd3bbf8f6e7df36d70de8f5242 | [
"MIT"
]
| null | null | null | Pascal/test/cohadar/pascal/programs/concurrent/test05.pas | cohadar/parapascal | 863bc9b8d7f813dd3bbf8f6e7df36d70de8f5242 | [
"MIT"
]
| null | null | null | {* test region await *}
program test05;
type R = record
x, y : integer;
full : boolean;
end;
var
r : shared R;
procedure makepoints;
var i: integer;
begin
for i := 1 to 10 do begin
region r do begin
await (r.full = false);
r.x := i;
r.y := i * i;
r.full := true;
end;
end;
end;
procedure printpoints;
var i: integer;
begin
for i := 1 to 10 do begin
region r do begin
await (r.full = true);
debug(r.x, r.y);
r.full := false;
end;
end;
end;
begin
r.full := false;
cobegin
makepoints;
printpoints;
coend;
end.
| 15.833333 | 31 | 0.506767 |
47fcb052681f49d260935d639511096b6de4807c | 41,851 | dfm | Pascal | frmMain.dfm | trejder/delphi-folder-tree-builder | b4bddf07aa0e3e51fb60a1456afa4e9d20ee12bc | [
"MIT"
]
| 1 | 2020-05-22T09:03:35.000Z | 2020-05-22T09:03:35.000Z | frmMain.dfm | defunctdelphi/folder-tree-builder | b4bddf07aa0e3e51fb60a1456afa4e9d20ee12bc | [
"MIT"
]
| null | null | null | frmMain.dfm | defunctdelphi/folder-tree-builder | b4bddf07aa0e3e51fb60a1456afa4e9d20ee12bc | [
"MIT"
]
| null | null | null | object MainForm: TMainForm
Left = 232
Top = 108
Width = 704
Height = 546
Caption = 'FaFTB - Files and Folders Tree Builder 1.20'
Color = clBtnFace
Constraints.MinHeight = 532
Constraints.MinWidth = 704
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poDesktopCenter
OnCreate = FormCreate
DesignSize = (
688
508)
PixelsPerInch = 96
TextHeight = 13
object lblCopyright: TLabel
Left = 8
Top = 502
Width = 379
Height = 13
Anchors = [akLeft, akBottom]
Caption =
'Copyright '#169' 2006-2008 by Tomasz Trejderowski. All rights reserved'
end
object lblWeb: TLabel
Left = 529
Top = 502
Width = 160
Height = 13
Cursor = crHandPoint
Hint =
'Click to open author website'
Alignment = taRightJustify
Anchors = [akLeft, akRight, akBottom]
Caption = 'http://www.gaman.pl/'
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clBlue
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold, fsUnderline]
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = lblWebClick
end
object pcMain: TPageControl
Left = 8
Top = 8
Width = 529
Height = 463
ActivePage = tsTree
Anchors = [akLeft, akTop, akRight, akBottom]
MultiLine = True
TabOrder = 0
object tsTree: TTabSheet
Caption = 'Tree of folders and files'
DesignSize = (
521
435)
object tvShell: TTreeView
Left = 2
Top = 2
Width = 516
Height = 399
Anchors = [akLeft, akTop, akRight, akBottom]
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Tahoma'
Font.Style = []
Images = ilImages
Indent = 19
ParentFont = False
ReadOnly = True
RightClickSelect = True
TabOrder = 0
OnChange = tvShellChange
end
object btnExplore: TButton
Left = 421
Top = 408
Width = 98
Height = 25
Hint =
'Click to explore this folder in Windows Explorer'
Caption = 'Explore folder'
Enabled = False
ParentShowHint = False
ShowHint = True
TabOrder = 1
OnClick = btnExploreClick
end
object btnOpen: TButton
Left = 316
Top = 408
Width = 98
Height = 25
Hint =
'Click to open this folder in Windows Explorer'
Caption = 'Open folder'
Enabled = False
ParentShowHint = False
ShowHint = True
TabOrder = 2
OnClick = btnOpenClick
end
object btnFileDelete: TButton
Left = 211
Top = 408
Width = 98
Height = 25
Hint =
'Click to delete selected file. WARNING! This operation IS NOT using Recycle' +
'Bin, but permanently deletes file instantly! THERE IS NO GOING BACK!'
Caption = 'Delete file'
Enabled = False
ParentShowHint = False
ShowHint = True
TabOrder = 3
OnClick = btnFileDeleteClick
end
object btnFolderChangeName: TButton
Left = 106
Top = 408
Width = 98
Height = 25
Hint = 'Click to change name of selected file'
Caption = 'Rename'
Enabled = False
ParentShowHint = False
ShowHint = True
TabOrder = 4
OnClick = btnFolderChangeNameClick
end
object btnFileExecute: TButton
Left = 1
Top = 408
Width = 98
Height = 25
Hint =
'Click to run program selected to open this type of files'
Caption = 'Execute file'
Enabled = False
ParentShowHint = False
ShowHint = True
TabOrder = 5
OnClick = btnFileExecuteClick
end
end
end
object pnlStatus: TPanel
Left = 8
Top = 478
Width = 681
Height = 17
Alignment = taLeftJustify
Anchors = [akLeft, akRight, akBottom]
BevelOuter = bvLowered
Caption = ' Ready...'
TabOrder = 5
end
object gbStatistics: TGroupBox
Left = 544
Top = 310
Width = 140
Height = 68
Anchors = [akRight, akBottom]
Caption = ' Tree content '
Color = clBtnFace
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
TabOrder = 3
object pnlFolderCount: TLabel
Left = 8
Top = 16
Width = 59
Height = 13
Caption = '0 folders'
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
end
object pnlFilesCount: TLabel
Left = 8
Top = 32
Width = 46
Height = 13
Caption = '0 files'
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
end
object pnlSizeMB: TLabel
Left = 8
Top = 48
Width = 82
Height = 13
Caption = '0 MB (0,00 GB)'
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
end
end
object gbTools: TGroupBox
Left = 544
Top = 127
Width = 140
Height = 177
Anchors = [akTop, akRight]
Caption = ' Tree tools '
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 2
object btnExpandAll: TButton
Left = 8
Top = 16
Width = 124
Height = 25
Hint =
'Click to expand all nodes in current tree. WARNING! This operation can take even dozens' +
'of seconds and there is not way to interrupt it!'
Caption = 'Expand entire tree'
Enabled = False
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 0
OnClick = btnExpandAllClick
end
object btnCollapseAll: TButton
Left = 8
Top = 48
Width = 124
Height = 25
Hint =
'Click to collapse all nodes in current tree. WARNING! This operation can take even dozens' +
'of seconds and there is not way to interrupt it!'
Caption = 'Collapse entire tree'
Enabled = False
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 1
OnClick = btnCollapseAllClick
end
object btnClear: TButton
Left = 8
Top = 144
Width = 124
Height = 25
Hint = 'Clear entire tree (remove all nodes)'
Caption = 'Cleare tree'
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 4
OnClick = btnClearClick
end
object btnDoTextTree: TButton
Left = 8
Top = 80
Width = 124
Height = 25
Hint = 'Copy entire tree structure and contents to clipboard'
Caption = 'Copy contents'
Enabled = False
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 2
OnClick = btnDoTextTreeClick
end
object btnSaveAs: TButton
Left = 8
Top = 112
Width = 124
Height = 25
Hint = 'Save entire tree structure and contents to file'
Caption = 'Save to file'
Enabled = False
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 3
OnClick = btnSaveAsClick
end
end
object gbOptions: TGroupBox
Left = 544
Top = 384
Width = 140
Height = 86
Anchors = [akRight, akBottom]
Caption = ' Parameters '
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 4
DesignSize = (
140
86)
object chbFoldersOnly: TCheckBox
Left = 8
Top = 16
Width = 122
Height = 17
Hint =
'Add only folders to tree when refreshing'
Caption = 'Add only folders'
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 0
OnClick = chbFoldersOnlyClick
end
object chbCount: TCheckBox
Left = 8
Top = 32
Width = 110
Height = 17
Hint =
'Count files and folders and display results in tree'
Caption = 'Count files and folders'
Checked = True
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
State = cbChecked
TabOrder = 1
OnClick = chbCountClick
end
object chbShowInfoPanels: TCheckBox
Left = 8
Top = 48
Width = 122
Height = 17
Caption = 'Display tools panel'
Checked = True
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
State = cbChecked
TabOrder = 2
OnClick = chbShowInfoPanelsClick
end
object chbAskBeforeRun: TCheckBox
Left = 8
Top = 64
Width = 118
Height = 17
Hint =
'Require confirmation before deleting a file'
Anchors = [akRight, akBottom]
Caption = 'Require confirmation'
Checked = True
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
State = cbChecked
TabOrder = 3
OnClick = chbAskBeforeRunClick
end
end
object gbButtons: TGroupBox
Left = 544
Top = 8
Width = 140
Height = 113
Anchors = [akTop, akRight]
Caption = ' Program tools '
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 1
object btnPickUpFolder: TButton
Left = 8
Top = 16
Width = 124
Height = 25
Hint =
'Click to select a folder and build entire tree of its contents'
Caption = 'Select folder...'
Default = True
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 0
OnClick = btnPickUpFolderClick
end
object btnCancel: TButton
Left = 8
Top = 48
Width = 124
Height = 25
Hint =
'Click to stop current tree generation process'
Cancel = True
Caption = 'STOP generation'
Enabled = False
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 1
OnClick = btnCancelClick
end
object btnRefresh: TButton
Left = 8
Top = 80
Width = 124
Height = 25
Hint =
'Click to refresh tree of files and folders'
Caption = 'Refresh tree'
Enabled = False
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 2
OnClick = btnRefreshClick
end
end
object fdFolder: TFolderDialog
Title = 'Select folder'
BrowsType = btNone
SpecialFolder = sfNone
Left = 24
Top = 40
end
object ilImages: TImageList
Left = 56
Top = 40
Bitmap = {
494C010108000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000003000000001002000000000000030
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F000000000000000000000000007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000080808000FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00C0C0
C00000000000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF0000FFFF0000FFFF00007F7F00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF007F7F7F00FFFFFF00BFBFBF00BFBF
BF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00BFBFBF00BFBFBF00BFBF
BF00BFBFBF007F7F7F0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000008080800000000000C0C0
C00000000000C0C0C00000000000C0C0C00000000000C0C0C00000000000C0C0
C000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000FFFFFF000000000000000000000000000000
0000000000000000000000000000000000007F7F7F00FFFFFF0000FF0000007F
0000000000000000000000000000000000000000000000000000000000000000
0000BFBFBF007F7F7F0000000000000000000000000000000000000000000000
0000000000000000000080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000808080000000
0000808080000000000080808000000000008080800000000000808080000000
0000808080008080800000000000000000000000000000000000000000000000
00000000000000000000000000007F7F7F000000000000000000000000000000
0000000000000000000000000000000000007F7F7F00FFFFFF00BFBFBF00BFBF
BF00BFBFBF00BFBFBF00BFBFBF007F7F7F007F7F7F00BFBFBF00BFBFBF00BFBF
BF00000000000000000000000000000000000000000000000000000000000000
0000BFBFBF000000000000000000808080008080800000000000000000000000
000000000000000000000000000000000000000000000000000080808000C0C0
C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C0008080
8000C0C0C0008080800000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000007F7F7F00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF007F7F7F00BFBFBF00FFFFFF00BFBFBF00BFBFBF00BFBF
BF0000FF000000FFFF0000000000000000000000000000000000000000007F7F
7F00BFBFBF007F7F7F007F7F7F00000000000000000080808000808080000000
0000000000000000000000000000000000000000000000000000000000008080
8000000000000000000000000000000000000000000000000000000000000000
000080808000C0C0C00000000000000000007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F000000000000000000000000007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F00BFBFBF00BFBFBF00BFBFBF00FFFFFF00BFBFBF00BFBF
BF0000FFFF00FFFF0000FFFF00000000000000000000000000007F7F7F007F7F
7F0080808000BFBFBF00BFBFBF007F7F7F007F7F7F0000000000000000008080
8000808080000000000000000000000000000000000000000000000000008080
8000FFFFFF00C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C0008080
8000000000008080800080808000000000007F7F7F00BFBFBF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00BFBFBF007F7F7F007F7F7F00000000000000000000000000000000000000
0000000000007F7F7F00BFBFBF00BFBFBF00BFBFBF007F7F7F00000000007F7F
7F00FFFF0000BFBFBF00BFBFBF00000000007F7F7F00BFBFBF007F7F7F007F7F
7F00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF007F7F7F007F7F7F000000
0000000000008080800000000000000000000000000000000000000000008080
8000FFFFFF000000000080808000808080008080800080808000C0C0C0008080
8000808080000000000000000000000000007F7F7F00BFBFBF007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F00BFBFBF007F7F7F007F7F7F00000000000000000000000000000000000000
0000000000007F7F7F00BFBFBF00BFBFBF0000FF000000000000000000000000
0000BFBFBF00BFBFBF00BFBFBF00000000007F7F7F0080808000BFBFBF00BFBF
BF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF007F7F
7F007F7F7F000000000000000000000000000000000000000000000000008080
8000FFFFFF000000000080800000808000008080000080808000C0C0C0008080
8000808080000000000000000000000000007F7F7F00BFBFBF00BFBFBF00BFBF
BF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBF
BF00BFBFBF007F7F7F007F7F7F00000000000000000000000000000000000000
0000000000007F7F7F00BFBFBF0000FF000000FF00007F7F7F00000000007F7F
7F00FFFFFF00BFBFBF00BFBFBF00000000000000000000000000808080008080
8000BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBF
BF00BFBFBF007F7F7F007F7F7F00000000000000000000000000000000008080
8000FFFFFF0000000000FFFF0000808000008080000080808000C0C0C0008080
8000808080000000000000000000000000007F7F7F00BFBFBF00BFBFBF00BFBF
BF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00007F
0000BFBFBF007F7F7F007F7F7F00000000000000000000000000000000000000
0000000000007F7F7F0000FF000000FF0000FFFF000000FFFF0000FFFF00BFBF
BF00BFBFBF00FFFFFF00BFBFBF00000000000000000000000000000000000000
00008080800080808000BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBF
BF00BFBFBF00BFBFBF0000000000000000000000000000000000000000008080
8000FFFFFF000000000000000000000000000000000000000000C0C0C0008080
8000808080000000000000000000000000007F7F7F00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF007F7F7F007F7F7F00000000000000000000000000000000000000
000000000000000000007F7F7F00FFFF0000FFFF000000FFFF0000FFFF00BFBF
BF00BFBFBF00BFBFBF0000000000000000000000000000000000000000000000
000000000000000000008080800080808000BFBFBF00BFBFBF00BFBFBF00BFBF
BF00BFBFBF000000000000000000000000000000000000000000000000008080
8000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00C0C0C0008080
800080808000000000000000000000000000000000007F7F7F00BFBFBF00BFBF
BF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBF
BF00BFBFBF00BFBFBF007F7F7F00000000000000000000000000000000000000
00000000000000000000000000007F7F7F007F7F7F0000FFFF0000FFFF00BFBF
BF007F7F7F007F7F7F0000000000000000000000000000000000000000000000
0000000000000000000000000000000000008080800080808000BFBFBF00BFBF
BF00000000000000000000000000000000000000000000000000000000000000
000080808000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0C000C0C0
C0008080800000000000000000000000000000000000000000007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F00000000000000000000000000000000000000
000000000000000000000000000000000000000000007F7F7F007F7F7F007F7F
7F00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000008080800080808000808080008080800080808000808080008080
8000808080000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF0000FFFF00FFFF
FF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFF
FF0000FFFF00FFFFFF000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000FFFF00FFFFFF0000FF
FF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FF
FF00FFFFFF0000FFFF000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF000000000000000000000000007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F0000000000000000007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F00000000000000000000000000FFFFFF0000FFFF00FFFF
FF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFF
FF0000FFFF00FFFFFF000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF000000000000000000000000007F7F7F00BFBFBF00BFBFBF00BFBF
BF00BFBFBF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00BFBFBF00BFBFBF00BFBF
BF00BFBFBF007F7F7F007F7F7F00000000007F7F7F00BFBFBF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00BFBFBF007F7F7F007F7F7F00000000000000000000FFFF00FFFFFF0000FF
FF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FF
FF00FFFFFF0000FFFF000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF000000000000000000000000007F7F7F00BFBFBF007F7F7F007F7F
7F007F7F7F00000000000000000000000000000000007F7F7F007F7F7F007F7F
7F00BFBFBF007F7F7F007F7F7F00000000007F7F7F00BFBFBF007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F00BFBFBF007F7F7F007F7F7F000000000000000000FFFFFF0000FFFF00FFFF
FF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFF
FF0000FFFF00FFFFFF000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF000000000000000000000000007F7F7F00BFBFBF00BFBFBF00BFBF
BF00BFBFBF007F7F7F007F7F7F007F7F7F007F7F7F00BFBFBF00BFBFBF00BFBF
BF00BFBFBF007F7F7F007F7F7F00000000007F7F7F00BFBFBF00BFBFBF00BFBF
BF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBF
BF00BFBFBF007F7F7F007F7F7F00000000000000000000FFFF00FFFFFF0000FF
FF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FF
FF00FFFFFF0000FFFF000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF000000000000000000000000007F7F7F00BFBFBF00BFBFBF00BFBF
BF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF000000
FF00BFBFBF007F7F7F007F7F7F00000000007F7F7F00BFBFBF00BFBFBF00BFBF
BF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00007F
0000BFBFBF007F7F7F007F7F7F000000000000000000FFFFFF0000FFFF00FFFF
FF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFF
FF0000FFFF00FFFFFF000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF000000000000000000000000007F7F7F00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF007F7F7F007F7F7F00000000007F7F7F00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF007F7F7F007F7F7F00000000000000000000FFFF00FFFFFF0000FF
FF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FF
FF00FFFFFF0000FFFF000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00000000000000
000000000000000000000000000000000000000000007F7F7F00BFBFBF00BFBF
BF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBF
BF00BFBFBF00BFBFBF007F7F7F0000000000000000007F7F7F00BFBFBF00BFBF
BF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBFBF00BFBF
BF00BFBFBF00BFBFBF007F7F7F000000000000000000FFFFFF0000FFFF00FFFF
FF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFFFF0000FFFF00FFFF
FF0000FFFF00FFFFFF000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000000000000000000000
00000000000000000000000000000000000000000000000000007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F000000000000000000000000007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000000000FFFFFF00FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000FFFF00FFFF
FF0000FFFF00FFFFFF0000FFFF00000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000000000FFFFFF000000
0000000000008080800000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000000000000000000000
0000808080000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000300000000100010000000000800100000000000000000000
000000000000000000000000FFFFFF0000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFF8003FBFF000F
00000001FB7F000700000001F95F8003FEFF0001F057C001FEFF0001E015C001
800300014005E001000180000001E0010000F8000001E0030000F8200001E003
0000F8008001E0030000F800E001E0030000FC01F803E0038000FE03FE07F003
C001FF8FFF8FF807FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC003FFFFFFFF
0001C003FFFFFFFF0001C003800380030001C003000100010001C00300000000
0001C003000000000001C003000000000001C003000000000001C00300000000
0001C03B800080000001C003C001C0010003C00BFFFFFFFF80FFC013FFFFFFFF
C1FFC027FFFFFFFFFFFFC01FFFFFFFFF00000000000000000000000000000000
000000000000}
end
object sdDialog: TSaveDialog
DefaultExt = '*.txt'
Filter = 'Text Files (*.txt)|*.txt|All Files (*.*)|*.*'
Options = [ofOverwritePrompt, ofHideReadOnly, ofPathMustExist, ofNoReadOnlyReturn, ofEnableSizing]
Left = 152
Top = 40
end
end
| 44.856377 | 102 | 0.800387 |
47d2f700857df773e5ecc5e89a5159322168fd22 | 4,468 | dpr | Pascal | references/zeoslib/packages/kylix3/ZTestDbcAll.dpr | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 851 | 2018-02-05T09:54:56.000Z | 2022-03-24T23:13:10.000Z | references/zeoslib/packages/kylix3/ZTestDbcAll.dpr | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 200 | 2018-02-06T18:52:39.000Z | 2022-03-24T19:59:14.000Z | references/zeoslib/packages/kylix3/ZTestDbcAll.dpr | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 197 | 2018-03-20T20:49:55.000Z | 2022-03-21T17:38:14.000Z | {*********************************************************}
{ }
{ Zeos Database Objects }
{ Test Suite for Database Connectivity Classes }
{ }
{*********************************************************}
{@********************************************************}
{ Copyright (c) 1999-2006 Zeos Development Group }
{ }
{ License Agreement: }
{ }
{ This library is distributed in the hope that it will be }
{ useful, but WITHOUT ANY WARRANTY; without even the }
{ implied warranty of MERCHANTABILITY or FITNESS FOR }
{ A PARTICULAR PURPOSE. See the GNU Lesser General }
{ Public License for more details. }
{ }
{ The source code of the ZEOS Libraries and packages are }
{ distributed under the Library GNU General Public }
{ License (see the file COPYING / COPYING.ZEOS) }
{ 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. }
{ }
{ }
{ The project web site is located on: }
{ http://zeos.firmos.at (FORUM) }
{ http://zeosbugs.firmos.at (BUGTRACKER) }
{ svn://zeos.firmos.at/zeos/trunk (SVN Repository) }
{ }
{ http://www.sourceforge.net/projects/zeoslib. }
{ http://www.zeoslib.sourceforge.net }
{ }
{ }
{ }
{ Zeos Development Group. }
{********************************************************@}
program ZTestDbcAll;
{$IFNDEF TESTGUI}
{$APPTYPE CONSOLE}
{$ENDIF}
{$I ../../test/dbc/ZDbc.inc}
uses
TestFrameWork,
TextTestRunner,
ZTestConfig,
ZSqlTestCase,
ZTestDbcUtils in '../../test/dbc/ZTestDbcUtils.pas',
ZTestDbcCache in '../../test/dbc/ZTestDbcCache.pas',
ZTestDbcCachedResultSet in '../../test/dbc/ZTestDbcCachedResultSet.pas',
ZTestDbcResultSet in '../../test/dbc/ZTestDbcResultSet.pas',
ZTestDbcResultSetMetadata in '../../test/dbc/ZTestDbcResultSetMetadata.pas',
ZTestDbcResolver in '../../test/dbc/ZTestDbcResolver.pas',
ZTestDbcMetadata in '../../test/dbc/ZTestDbcMetadata.pas',
ZTestDbcGeneric in '../../test/dbc/ZTestDbcGeneric.pas',
ZTestDbcInterbaseMetadata in '../../test/dbc/ZTestDbcInterbaseMetadata.pas',
ZTestDbcInterbase in '../../test/dbc/ZTestDbcInterbase.pas',
ZTestDbcMySqlMetadata in '../../test/dbc/ZTestDbcMySqlMetadata.pas',
ZTestDbcMySql in '../../test/dbc/ZTestDbcMySql.pas',
ZTestDbcPostgreSqlMetadata in '../../test/dbc/ZTestDbcPostgreSqlMetadata.pas',
ZTestDbcPostgreSql in '../../test/dbc/ZTestDbcPostgreSql.pas',
ZTestDbcMsSql in '../../test/dbc/ZTestDbcMsSql.pas',
ZTestDbcOracle in '../../test/dbc/ZTestDbcOracle.pas',
ZTestDbcSqLite in '../../test/dbc/ZTestDbcSqLite.pas';
begin
TestGroup := DBC_TEST_GROUP;
RebuildTestDatabases;
{$IFDEF TESTGUI}
GUITestRunner.RunRegisteredTests;
{$ELSE}
TextTestRunner.RunRegisteredTests;
{$ENDIF}
end.
| 48.565217 | 81 | 0.512534 |
fc667d00eba75d7149b70825f422cdbf7f719fa8 | 771 | pas | Pascal | Samples/Oxygene/HTTP Responses/Properties/AssemblyInfo.pas | remobjects/internetpack | f323a96baf31cb7acf79b3f9c097c0ecde8863d3 | [
"BSD-2-Clause"
]
| 14 | 2015-01-29T14:09:53.000Z | 2020-08-04T05:19:00.000Z | Samples/Oxygene/HTTP Responses/Properties/AssemblyInfo.pas | remobjects/internetpack | f323a96baf31cb7acf79b3f9c097c0ecde8863d3 | [
"BSD-2-Clause"
]
| 1 | 2017-01-24T07:48:38.000Z | 2017-01-24T08:01:22.000Z | Samples/Oxygene/HTTP Responses/Properties/AssemblyInfo.pas | remobjects/internetpack | f323a96baf31cb7acf79b3f9c097c0ecde8863d3 | [
"BSD-2-Clause"
]
| 7 | 2016-11-15T21:13:31.000Z | 2021-05-19T20:27:19.000Z | namespace FtpSync;
interface
uses
System.Reflection,
System.Resources,
System.Runtime.InteropServices;
[assembly: AssemblyTitle('HTTP Responses Sample')]
[assembly: AssemblyDescription('')]
[assembly: AssemblyConfiguration('')]
[assembly: AssemblyCompany('RemObjects Software, LLC')]
[assembly: AssemblyProduct('Internet Pack for .NET')]
[assembly: AssemblyCopyright('Copyright RemObjects Software, LLC. 2002-2016 All Rights Reserved.')]
[assembly: AssemblyTrademark('')]
[assembly: AssemblyCulture('')]
[assembly: AssemblyVersion('2.0.0.0')]
[assembly: NeutralResourcesLanguage('')]
[assembly: ComVisible(false)]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile('')]
[assembly: AssemblyKeyName('')]
implementation
end. | 28.555556 | 100 | 0.741894 |
fc9b2b4c3520938422e78bf3cd854f99fe7b432a | 331 | pas | Pascal | test_cases/input012.pas | kjcolley7/PL0 | 4c3831cf5602ae74b58433ad3ddde2caaafef12b | [
"MIT"
]
| 7 | 2017-04-28T17:32:41.000Z | 2021-09-18T04:29:52.000Z | test_cases/input012.pas | kjcolley7/PL0 | 4c3831cf5602ae74b58433ad3ddde2caaafef12b | [
"MIT"
]
| 1 | 2018-02-06T23:24:24.000Z | 2018-02-06T23:53:22.000Z | test_cases/input012.pas | kjcolley7/PL0 | 4c3831cf5602ae74b58433ad3ddde2caaafef12b | [
"MIT"
]
| 1 | 2022-02-25T18:24:08.000Z | 2022-02-25T18:24:08.000Z | const m = 7, n = 85;
var i, x, y, z, q, r;
procedure mult();
var q, r; /*{Modification: procedure mult should use variables q and r from its own scope}*/
begin
q := x; r := y; z := 0;
while r > 0 do
begin
if odd r then z := z + q;
q := 2 * q;
r := r / 2;
end
end;
begin
x := m;
y := n;
call mult;
write z;
end.
| 16.55 | 93 | 0.531722 |
fc69d18934da1b38346faae923c086725d1d97c8 | 208 | pas | Pascal | windows/src/ext/jedi/jvcl/tests/restructured/examples/RALib/RaInterpreter/samples/sample - case statement.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/examples/RALib/RaInterpreter/samples/sample - case statement.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/examples/RALib/RaInterpreter/samples/sample - case statement.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | var
C: Integer;
begin
Result := 0;
C := 2;
case C of
1:
begin
Result := 1;
end;
1 + 1:
Result := 2;
else
Result := 9;
end;
Result := Result + 100;
end;
| 11.555556 | 25 | 0.427885 |
473af6bfaf3d17d2c839385484854d477f372a73 | 1,527 | pas | Pascal | source/Consul/Fido.Consul.Service.Intf.pas | atkins126/FidoLib | 219fb0e1b78599251248971234ddac0913c912b1 | [
"MIT"
]
| 27 | 2021-09-26T18:14:51.000Z | 2022-01-04T09:26:42.000Z | source/Consul/Fido.Consul.Service.Intf.pas | atkins126/FidoLib | 219fb0e1b78599251248971234ddac0913c912b1 | [
"MIT"
]
| 5 | 2021-11-08T19:20:29.000Z | 2022-01-29T18:50:23.000Z | source/Consul/Fido.Consul.Service.Intf.pas | atkins126/FidoLib | 219fb0e1b78599251248971234ddac0913c912b1 | [
"MIT"
]
| 7 | 2021-09-26T17:30:40.000Z | 2022-02-14T02:19:05.000Z | (*
* Copyright 2022 Mirko Bianco (email: writetomirko@gmail.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without Apiriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*)
unit Fido.Consul.Service.Intf;
interface
uses
Fido.Exceptions,
Fido.Consul.Types;
type
EConsulService = class(EFidoException);
IConsulService = interface(IInvokable)
['{4C8E3DED-C4CA-424D-B4A3-21461392B2A9}']
procedure Register(const ServiceName: string; const Port: Integer; const HealthEndpoint: string);
procedure Deregister;
end;
implementation
end.
| 33.933333 | 101 | 0.760969 |
fc6f34d21b402a22466d2151652c2e2e2f8380f5 | 19,540 | dfm | Pascal | Client/fSingleExpsFilter.dfm | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| null | null | null | Client/fSingleExpsFilter.dfm | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| null | null | null | Client/fSingleExpsFilter.dfm | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| 3 | 2021-06-30T10:11:17.000Z | 2021-07-01T09:13:29.000Z | inherited fmSingleExpsFilter: TfmSingleExpsFilter
Left = 240
Top = 144
Caption =
'%s '#1085#1072' '#1056#1077#1075#1080#1089#1090#1098#1088' '#1085#1072' '#1054#1088#1076#1077#1088#1080' '#1079#1072' '#1055#1088#1086#1094#1077#1089' '#1055#1088#1086#1076#1072#1078#1073#1080' '#1079#1072' %ProductClassAbbr' +
'ev% - '#1045#1076#1080#1085#1080#1095#1085#1080' '#1054#1055#1055' '#1087#1086' '#1045#1082#1089#1087#1077#1076#1080#1094#1080#1080
ClientHeight = 555
ClientWidth = 915
PixelsPerInch = 96
TextHeight = 13
inherited pnlBottomButtons: TPanel
Top = 520
Width = 915
TabOrder = 12
inherited pnlOKCancel: TPanel
Left = 647
end
inherited pnlClose: TPanel
Left = 558
end
inherited pnlApply: TPanel
Left = 826
end
end
object gbSaleID: TGroupBox [1]
Left = 8
Top = 80
Width = 513
Height = 65
Caption = ' ID '#1054#1055#1055' '
TabOrder = 3
object lblBranch: TLabel
Left = 232
Top = 16
Width = 51
Height = 13
Caption = #1058#1055' '#1043#1083'.'
end
object lblSaleNo: TLabel
Left = 296
Top = 16
Width = 34
Height = 13
Caption = #1053#1086#1084#1077#1088
end
object lblSaleType: TLabel
Left = 408
Top = 16
Width = 19
Height = 13
Caption = #1042#1080#1076
end
object lblShipmentNo: TLabel
Left = 368
Top = 16
Width = 13
Height = 13
Caption = #1056#1082
end
object lblSaleOrderType: TLabel
Left = 48
Top = 16
Width = 39
Height = 13
Caption = #1054#1055#1055' '#1087#1086
FocusControl = cbSaleOrderType
end
object cbSaleType: TJvDBLookupCombo
Left = 408
Top = 32
Width = 57
Height = 21
DataField = '_SALE_TYPE_ABBREV'
DataSource = dsData
DisplayEmpty = '< '#1074#1089'. >'
TabOrder = 4
end
object edtSaleNo: TDBEdit
Left = 296
Top = 32
Width = 65
Height = 21
DataField = 'SALE_NO'
DataSource = dsData
TabOrder = 2
end
object cbBranch: TJvDBLookupCombo
Left = 232
Top = 32
Width = 57
Height = 21
DataField = '_SALE_BRANCH_CODE_AND_NAME'
DataSource = dsData
DisplayEmpty = '< '#1074#1089'. >'
TabOrder = 1
end
object edtShipmentNo: TDBEdit
Left = 368
Top = 32
Width = 33
Height = 21
DataField = 'SALE_SHIPMENT_NO'
DataSource = dsData
TabOrder = 3
end
object cbSaleOrderType: TJvDBComboBox
Left = 48
Top = 32
Width = 161
Height = 21
DataField = 'SALE_ORDER_TYPE_CODE'
DataSource = dsData
Items.Strings = (
'< '#1074#1089#1080#1095#1082#1080' >'
#1047' - '#1047#1072#1076#1072#1085#1080#1077
#1058' - '#1058#1077#1082#1091#1097#1072' '#1053#1072#1083#1080#1095#1085#1086#1089#1090
#1041' - '#1041#1098#1076#1077#1097#1072' '#1053#1072#1083#1080#1095#1085#1086#1089#1090)
TabOrder = 0
Values.Strings = (
''
'1'
'6'
'7')
ListSettings.OutfilteredValueFont.Charset = DEFAULT_CHARSET
ListSettings.OutfilteredValueFont.Color = clRed
ListSettings.OutfilteredValueFont.Height = -11
ListSettings.OutfilteredValueFont.Name = 'Microsoft Sans Serif'
ListSettings.OutfilteredValueFont.Style = []
end
end
object gbInvoice: TGroupBox [2]
Left = 608
Top = 400
Width = 297
Height = 65
Caption = ' '#1060#1072#1082#1090#1091#1088#1072' '
TabOrder = 11
object lblInvoiceNo: TLabel
Left = 8
Top = 16
Width = 34
Height = 13
Caption = #1053#1086#1084#1077#1088
FocusControl = edtFromInvoiceNo
end
object lblInvoiceDateInterval: TLabel
Left = 144
Top = 16
Width = 26
Height = 13
Caption = #1044#1072#1090#1072
end
object edtInvoiceNoIntervalDelimiter: TLabel
Left = 60
Top = 36
Width = 9
Height = 13
Caption = '---'
end
object edtFromInvoiceNo: TDBEdit
Left = 8
Top = 32
Width = 49
Height = 21
DataField = 'FROM_INVOICE_NO'
DataSource = dsData
TabOrder = 0
end
object edtToInvoiceNo: TDBEdit
Left = 72
Top = 32
Width = 65
Height = 21
DataField = 'TO_INVOICE_NO'
DataSource = dsData
TabOrder = 1
end
inline frInvoiceDateInterval: TfrDateIntervalFrame
Left = 144
Top = 32
Width = 145
Height = 21
Constraints.MaxHeight = 21
Constraints.MaxWidth = 145
Constraints.MinHeight = 21
Constraints.MinWidth = 145
TabOrder = 2
TabStop = True
end
end
inline frParamProductFilter: TfrParamProductFilter [3]
Left = 528
Top = 8
Width = 377
Height = 241
ParentShowHint = False
ShowHint = True
TabOrder = 7
TabStop = True
inherited grpTreeNodeFilter: TGroupBox
Height = 241
inherited lblUsedBy: TLabel
Width = 61
end
inherited lblProductOrigin: TLabel
Width = 23
end
inherited lblCommonStatus: TLabel
Width = 45
end
inherited lblIsActive: TLabel
Width = 53
end
end
end
object gbDates: TGroupBox [4]
Left = 8
Top = 152
Width = 161
Height = 97
Caption = ' '#1042#1088#1084#1048#1085#1090' '#1085#1072' '#1045#1082#1089#1087#1077#1076#1080#1094#1080#1103' '
TabOrder = 4
inline frDateInterval: TfrDateIntervalFrame
Left = 8
Top = 24
Width = 145
Height = 21
Constraints.MaxHeight = 21
Constraints.MaxWidth = 145
Constraints.MinHeight = 21
Constraints.MinWidth = 145
TabOrder = 0
TabStop = True
end
end
object gbClient: TGroupBox [5]
Left = 8
Top = 256
Width = 593
Height = 257
Caption = ' '#1050#1083#1080#1077#1085#1090' '
TabOrder = 8
object lblCountry: TLabel
Left = 400
Top = 88
Width = 48
Height = 13
Caption = #1044#1098#1088#1078#1072#1074#1072
FocusControl = cbCountry
end
object lblReceivePlaceOffice: TLabel
Left = 400
Top = 16
Width = 33
Height = 13
Caption = #1058#1055
end
object cbCountry: TJvDBLookupCombo
Left = 400
Top = 104
Width = 185
Height = 21
DeleteKeyClear = False
DataField = '_COUNTRY_NAME'
DataSource = dsData
DisplayEmpty = '< '#1074#1089#1080#1095#1082#1080' >'
TabOrder = 2
end
object cbReceivePlaceOffice: TJvDBLookupCombo
Left = 400
Top = 32
Width = 185
Height = 21
DeleteKeyClear = False
DataField = '_RECEIVE_PLACE_OFFICE_NAME'
DataSource = dsData
DisplayEmpty = '< '#1074#1089#1080#1095#1082#1080' >'
TabOrder = 1
end
inline frClient: TfrCompanyFilter
Left = 8
Top = 16
Width = 377
Height = 233
ParentShowHint = False
ShowHint = True
TabOrder = 0
inherited grpTreeNodeFilter: TGroupBox
inherited pnlBottom: TPanel
inherited lblCommonStatus: TLabel
Width = 45
end
end
end
end
end
object gbSaleDealType: TGroupBox [6]
Left = 224
Top = 8
Width = 73
Height = 65
Caption = ' '#1058#1080#1087' '#1054#1055#1055' '
TabOrder = 1
DesignSize = (
73
65)
object cbSaleDealType: TJvDBLookupCombo
Left = 8
Top = 32
Width = 57
Height = 21
DropDownWidth = 240
DeleteKeyClear = False
DataField = '_SALE_DEAL_TYPE_SHOW_NAME'
DataSource = dsData
Anchors = [akLeft, akTop, akRight]
TabOrder = 0
end
end
object gbSaleShipmentState: TGroupBox [7]
Left = 8
Top = 8
Width = 209
Height = 65
Caption = ' '#1057#1090#1072#1090#1091#1089' '#1085#1072' '#1043#1088#1091#1087#1072' '#1054#1055#1055' '#1087#1086' '#1045#1082#1089#1087#1077#1076#1080#1094#1080#1103' '
TabOrder = 0
object lblDash1: TLabel
Left = 103
Top = 37
Width = 6
Height = 13
Caption = #8212
end
object cbMinSaleShipmentState: TDBComboBoxEh
Left = 8
Top = 33
Width = 89
Height = 21
DataField = 'MIN_SALE_SHIPMENT_STATE_CODE'
DataSource = dsData
DropDownBox.Rows = 13
DropDownBox.Width = 450
EditButtons = <>
TabOrder = 0
Visible = True
end
object cbMaxSaleShipmentState: TDBComboBoxEh
Left = 116
Top = 33
Width = 85
Height = 21
DataField = 'MAX_SALE_SHIPMENT_STATE_CODE'
DataSource = dsData
DropDownBox.Rows = 13
DropDownBox.Width = 450
EditButtons = <>
TabOrder = 1
Visible = True
end
end
object gbReceiveDateInterval: TGroupBox [8]
Left = 176
Top = 151
Width = 169
Height = 98
Caption = ' '#1042#1088#1084#1048#1085#1090' '#1085#1072' '#1055#1086#1083#1091#1095#1072#1074#1072#1085#1077' '
TabOrder = 5
object lblReceiveDateRsv: TLabel
Left = 8
Top = 48
Width = 24
Height = 13
Caption = #1088#1079#1088#1074
end
object lblDash2: TLabel
Left = 52
Top = 68
Width = 9
Height = 13
Caption = '---'
end
inline frReceiveDateInterval: TfrDateIntervalFrame
Left = 8
Top = 24
Width = 153
Height = 21
Constraints.MaxHeight = 21
Constraints.MaxWidth = 153
Constraints.MinHeight = 21
Constraints.MinWidth = 153
TabOrder = 0
TabStop = True
inherited edtInterval: TJvDBComboEdit
Width = 153
end
end
object edtReceiveDateBeginRsv: TDBEdit
Left = 8
Top = 64
Width = 41
Height = 21
DataField = 'RECEIVE_DATE_BEGIN_RSV'
DataSource = dsData
TabOrder = 1
end
object edtReceiveDateEndRsv: TDBEdit
Left = 64
Top = 64
Width = 41
Height = 21
DataField = 'RECEIVE_DATE_END_RSV'
DataSource = dsData
TabOrder = 2
end
end
object gbImportDateInterval: TGroupBox [9]
Left = 352
Top = 151
Width = 169
Height = 98
Caption = ' '#1042#1088#1084#1048#1085#1090' '#1085#1072' '#1042#1088#1098#1097#1072#1085#1077' '
TabOrder = 6
object lblImportDateRsv: TLabel
Left = 8
Top = 48
Width = 24
Height = 13
Caption = #1088#1079#1088#1074
end
object lblDash3: TLabel
Left = 52
Top = 68
Width = 9
Height = 13
Caption = '---'
end
inline frImportDateInterval: TfrDateIntervalFrame
Left = 8
Top = 24
Width = 153
Height = 21
Constraints.MaxHeight = 21
Constraints.MaxWidth = 153
Constraints.MinHeight = 21
Constraints.MinWidth = 153
TabOrder = 0
TabStop = True
inherited edtInterval: TJvDBComboEdit
Width = 153
end
end
object edtImportDateBeginRsv: TDBEdit
Left = 8
Top = 64
Width = 41
Height = 21
DataField = 'IMPORT_DATE_BEGIN_RSV'
DataSource = dsData
TabOrder = 1
end
object edtImportDateEndRsv: TDBEdit
Left = 64
Top = 64
Width = 41
Height = 21
DataField = 'IMPORT_DATE_END_RSV'
DataSource = dsData
TabOrder = 2
end
end
object pnlRightChangingGroupboxes: TPanel [10]
Left = 304
Top = 8
Width = 217
Height = 65
BevelOuter = bvNone
TabOrder = 2
object gbLeaseDateUnit: TGroupBox
Left = 0
Top = 0
Width = 217
Height = 65
Align = alTop
Caption = ' '#1053#1072#1077#1084#1085#1072' '#1057#1090#1098#1087#1082#1072' '
TabOrder = 0
object cbDateUnit: TJvDBLookupCombo
Left = 64
Top = 32
Width = 89
Height = 21
DeleteKeyClear = False
DataField = '_LEASE_DATE_UNIT_NAME'
DataSource = dsData
DisplayEmpty = '< '#1074#1089#1080#1095#1082#1080' >'
TabOrder = 0
end
end
object gbDelivery: TGroupBox
Left = 0
Top = 65
Width = 217
Height = 65
Align = alTop
Caption = ' '#1054#1073#1074#1098#1088#1079#1072#1085#1086#1089#1090' '#1089' '#1054#1055#1044' '
TabOrder = 1
object lblDCDBranch: TLabel
Left = 72
Top = 16
Width = 51
Height = 13
Caption = #1058#1055' '#1043#1083'.'
FocusControl = cbDCDBranch
end
object lblDCDCode: TLabel
Left = 128
Top = 16
Width = 43
Height = 13
Caption = #1055#1044#1044' No'
FocusControl = edtDCDCode
end
object lblDeliveryProjectCode: TLabel
Left = 176
Top = 16
Width = 14
Height = 13
Caption = 'No'
FocusControl = edtDCDCode
end
object cbHasSale: TJvDBComboBox
Left = 8
Top = 32
Width = 57
Height = 21
DataField = 'HAS_DELIVERY'
DataSource = dsData
Items.Strings = (
'< '#1074#1089'. >'
#1080#1084#1072
#1085#1103#1084#1072)
TabOrder = 0
Values.Strings = (
'0'
'1'
'2')
ListSettings.OutfilteredValueFont.Charset = DEFAULT_CHARSET
ListSettings.OutfilteredValueFont.Color = clRed
ListSettings.OutfilteredValueFont.Height = -11
ListSettings.OutfilteredValueFont.Name = 'Microsoft Sans Serif'
ListSettings.OutfilteredValueFont.Style = []
end
object cbDCDBranch: TJvDBLookupCombo
Left = 72
Top = 32
Width = 57
Height = 21
DataField = '_DCD_BRANCH'
DataSource = dsData
DisplayEmpty = '< '#1074#1089'. >'
TabOrder = 1
end
object edtDCDCode: TDBEdit
Left = 128
Top = 32
Width = 49
Height = 21
DataField = 'DCD_CODE'
DataSource = dsData
TabOrder = 2
end
object edtDeliveryProjectCode: TDBEdit
Left = 176
Top = 32
Width = 33
Height = 21
DataField = 'DELIVERY_PROJECT_CODE'
DataSource = dsData
TabOrder = 3
end
end
end
object gbExceptEventDamages: TGroupBox [11]
Left = 608
Top = 328
Width = 297
Height = 65
Caption = ' '#1053#1077#1076#1086#1087#1091#1089#1090#1080#1084#1080' '#1054#1090#1082#1083'. '
TabOrder = 10
object lblExceptEventDamages: TLabel
Left = 8
Top = 16
Width = 106
Height = 13
Caption = #1042#1077#1088#1080#1078#1085#1080' '#1055#1086#1088#1072#1078#1077#1085#1080#1103
end
object cbDamagesState: TJvDBLookupCombo
Left = 8
Top = 32
Width = 281
Height = 21
DropDownWidth = 300
DataField = 'DAMAGES_STATE_CODE'
DataSource = dsData
DisplayEmpty = '< '#1074#1089#1080#1095#1082#1080' >'
LookupField = 'STATE_CODE'
LookupDisplay = 'STATE_ABBREV;STATE_NAME'
LookupSource = dsDamageStates
TabOrder = 0
end
end
inline frMediator: TfrPartnerFieldEditFrameLabeled [12]
Left = 608
Top = 256
Width = 297
Height = 65
HorzScrollBar.Visible = False
VertScrollBar.Visible = False
Constraints.MaxHeight = 65
Constraints.MinHeight = 65
TabOrder = 9
inherited gbPartner: TGroupBox
Width = 297
Caption = ' '#1055#1086#1089#1088#1077#1076#1085#1080#1082' '
inherited pnlNameAndButtons: TPanel
Width = 208
inherited pnlRightButtons: TPanel
Left = 172
end
inherited pnlPartnerName: TPanel
Width = 172
inherited edtPartnerName: TDBEdit
Width = 173
end
inherited cbPartner: TJvDBLookupCombo
Width = 173
end
end
end
inherited pnlPaddingRight: TPanel
Left = 289
end
inherited pnlLabels: TPanel
Width = 293
inherited lblCode: TLabel
Width = 19
end
inherited lblName: TLabel
Width = 76
end
end
end
end
inherited alActions: TActionList [13]
Left = 440
Top = 65520
inherited actForm: TAction
Caption =
'%s '#1085#1072' '#1056#1077#1075#1080#1089#1090#1098#1088' '#1085#1072' '#1054#1088#1076#1077#1088#1080' '#1079#1072' '#1055#1088#1086#1094#1077#1089' '#1055#1088#1086#1076#1072#1078#1073#1080' '#1079#1072' %ProductClassAbbr' +
'ev% - '#1045#1076#1080#1085#1080#1095#1085#1080' '#1054#1055#1055' '#1087#1086' '#1045#1082#1089#1087#1077#1076#1080#1094#1080#1080
end
object actClearStartPeriodDate: TAction
Hint = #1048#1079#1095#1080#1089#1090#1074#1072#1085#1077' '#1085#1072' '#1085#1072#1095#1072#1083#1085#1072' '#1076#1072#1090#1072' '#1085#1072' '#1077#1082#1089#1087#1077#1076#1080#1094#1080#1103
ImageIndex = 26
end
object actClearEndPeriodDate: TAction
Hint = #1048#1079#1095#1080#1089#1090#1074#1072#1085#1077' '#1085#1072' '#1082#1088#1072#1081#1085#1072' '#1076#1072#1090#1072' '#1085#1072' '#1077#1082#1089#1087#1077#1076#1080#1094#1080#1103
ImageIndex = 26
end
object actClearStartInvoiceDate: TAction
Hint = #1048#1079#1095#1080#1089#1090#1074#1072#1085#1077' '#1085#1072' '#1085#1072#1095#1072#1083#1085#1072' '#1076#1072#1090#1072' '#1085#1072' '#1092#1072#1082#1090#1091#1088#1072
ImageIndex = 26
end
object actClearEndInvoiceDate: TAction
Hint = #1048#1079#1095#1080#1089#1090#1074#1072#1085#1077' '#1085#1072' '#1082#1088#1072#1081#1085#1072' '#1076#1072#1090#1072' '#1085#1072' '#1092#1072#1082#1090#1091#1088#1072
ImageIndex = 26
end
end
inherited dsData: TDataSource [14]
Left = 408
Top = 65520
end
inherited cdsData: TAbmesClientDataSet [15]
Left = 376
Top = 65520
end
inherited cdsFilterVariants: TAbmesClientDataSet [16]
Left = 248
Top = 504
end
inherited dsFilterVariants: TDataSource
Left = 280
Top = 504
end
inherited cdsFilterVariantFields: TAbmesClientDataSet
Left = 312
Top = 504
end
object cdsDamageStates: TAbmesClientDataSet
Aggregates = <>
Params = <>
Left = 752
Top = 352
object cdsDamageStatesSTATE_CODE: TAbmesFloatField
FieldName = 'STATE_CODE'
end
object cdsDamageStatesSTATE_ABBREV: TAbmesWideStringField
FieldName = 'STATE_ABBREV'
Size = 15
end
object cdsDamageStatesSTATE_NAME: TAbmesWideStringField
FieldName = 'STATE_NAME'
Size = 30
end
end
object dsDamageStates: TDataSource
DataSet = cdsDamageStates
Left = 784
Top = 352
end
end
| 27.101248 | 237 | 0.571801 |
85adb1805623d4815debc6fac78ad903bdca9862 | 10,198 | pas | Pascal | sound/0031.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 11 | 2015-12-12T05:13:15.000Z | 2020-10-14T13:32:08.000Z | sound/0031.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| null | null | null | sound/0031.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 8 | 2017-05-05T05:24:01.000Z | 2021-07-03T20:30:09.000Z | {===========================================================================
Date: 08-31-93 (22:24)
From: WIM VAN.VOLLENHOVEN
Subj: Sound Module
---------------------------------------------------------------------------
Well.. here is the source code i've found in a pascal toolbox (ECO)
which emulates the play function of qbasic :-)
{
call: play(string)
music_string --- the string containing the encoded music to be
played. the format is the same as that of the
microsoft basic play statement. the string
must be <= 254 characters in length.
calls: sound
getint (internal)
remarks: the characters accepted by this routine are:
a - g musical notes
# or + following a - g note, indicates sharp
- following a - g note, indicates flat
< move down one octave
> move up one octave
. dot previous note (extend note duration by 3/2)
mn normal duration (7/8 of interval between notes)
ms staccato duration
ml legato duration
ln length of note (n=1-64; 1=whole note,4=quarter note)
pn pause length (same n values as ln above)
tn tempo,n=notes/minute (n=32-255,default n=120)
on octave number (n=0-6,default n=4)
nn play note number n (n=0-84)
the following two commands are ignored by play:
mf complete note before continuing
mb another process may begin before speaker is
finished playing note
important --- setdefaultnotes must have been called at least once before
this routine is called.
}
unit u_play;
interface
uses
crt
;
const
note_octave : integer = 4; { current octave for note }
note_fraction : real = 0.875; { fraction of duration given to note }
note_duration : integer = 0; { duration of note ^^semi-legato }
note_length : real = 0.25; { length of note }
note_quarter : real = 500.0; { moderato pace (principal beat) }
procedure quitsound;
procedure startsound;
procedure errorbeep;
procedure warningbeep;
procedure smallbeep;
procedure setdefaultnotes;
procedure play(s: string);
procedure beep(h, l: word);
implementation
procedure quitsound;
var i: word;
begin
for i := 100 downto 1 do begin sound(i*10); delay(2) end;
for i := 1 to 800 do begin sound(i*10); delay(2) end;
nosound;
end;
procedure startsound;
var i: word;
begin
for i := 100 downto 1 do begin sound(i*15); delay(2) end;
for i := 1 to 100 do begin sound(i*15); delay(2) end; nosound;
delay(100); for i := 100 downto 1 do begin sound(i*10); delay(2) end;
nosound;
end;
procedure errorbeep;
begin
sound(2000); delay(75); sound(1000); delay(75); nosound;
end;
procedure warningbeep;
begin
sound(500); delay(500); nosound;
end;
procedure smallbeep;
begin
sound(300); delay(50); nosound;
end;
procedure setdefaultnotes;
begin
note_octave := 4; { default octave }
note_fraction := 0.875; { default sustain is semi-legato }
note_length := 0.25; { note is quarter note by default }
note_quarter := 500.0; { moderato pace by default }
end;
procedure play(s: string);
const
{ offsets in octave of natural notes }
note_offset : array[ 'A'..'G' ] of integer = (9,11,0,2,4,5,7);
{ frequencies for 7 octaves }
note_freqs: array[ 0 .. 84 ] of integer =
{
c c# d d# e f f# g g# a a# b
}
( 0,
65, 69, 73, 78, 82, 87, 92, 98, 104, 110, 116, 123,
131, 139, 147, 156, 165, 175, 185, 196, 208, 220, 233, 247,
262, 278, 294, 312, 330, 350, 370, 392, 416, 440, 466, 494,
524, 556, 588, 624, 660, 700, 740, 784, 832, 880, 932, 988,
1048,1112,1176,1248,1320,1400,1480,1568,1664,1760,1864,1976,
2096,2224,2352,2496,2640,2800,2960,3136,3328,3520,3728,3952,
4192,4448,4704,4992,5280,5600,5920,6272,6656,7040,7456,7904 );
quarter_note = 0.25; { length of a quarter note }
digits : set of '0'..'9' = ['0'..'9'];
var
play_freq : integer; { frequency of note to be played }
play_duration : integer; { duration to sound note }
rest_duration : integer; { duration of rest after a note }
i : integer; { offset in music string }
c : char; { current character in music string }
{ note frequencies }
freq : array[0..6,0..11] of integer absolute note_freqs;
n : integer;
xn : real;
k : integer;
function getint : integer;
var n: integer;
begin { getint }
n := 0;
while(s[i] in digits) do begin n := n*10+ord(s[i])-ord('0'); inc(i) end;
dec(i); getint := n;
end { getint };
begin
s := s + ' '; { append blank to end of music string }
i := 1; { point to first character in music }
while(i < length(s)) do begin { begin loop over music string }
c := upcase(s[i]); { get next character in music string }
case c of { interpret it }
'A'..'G' : begin { a note }
n := note_offset[ c ];
play_freq := freq[ note_octave ,n ];
xn := note_quarter * (note_length / quarter_note);
play_duration := trunc(xn * note_fraction);
rest_duration := trunc(xn * (1.0 - note_fraction));
{ check for sharp/flat }
if s[i+1] in ['#','+','-' ] then
begin
inc(i);
case s[i] of
'#',
'+' : play_freq :=
freq[ note_octave ,succ(n) ];
'-' : play_freq :=
freq[ note_octave ,pred(n) ];
else ;
end { case };
end;
{ check for note length }
if (s[i+1] in digits) then
begin
inc(i);
n := getint;
xn := (1.0 / n) / quarter_note;
play_duration :=
trunc(note_fraction * note_quarter * xn);
rest_duration :=
trunc((1.0 - note_fraction) *
xn * note_quarter);
end;
{ check for dotting }
if s[i+1] = '.' then
begin
xn := 1.0;
while(s[i+1] = '.') do
begin
xn := xn * 1.5;
inc(i);
end;
play_duration :=
trunc(play_duration * xn);
end;
{ play the note }
sound(play_freq);
delay(play_duration);
nosound;
delay(rest_duration);
end { a note };
'M' : begin { 'M' commands }
inc(i);
c := s[i];
case c of
'F' : ;
'B' : ;
'N' : note_fraction := 0.875;
'L' : note_fraction := 1.000;
'S' : note_fraction := 0.750;
else ;
end { case };
end { 'M' commands };
'O' : begin { set octave }
inc(i);
n := ord(s[i]) - ord('0');
if (n < 0) or (n > 6) then n := 4;
note_octave := n;
end { set octave };
'<' : begin { drop an octave }
if note_octave > 0 then dec(note_octave);
end { drop an octave };
'>' : begin { ascend an octave }
if note_octave < 6 then inc(note_octave);
end { ascend an octave };
'N' : begin { play note n }
inc(i); n := getint;
if (n > 0) and (n <= 84) then begin
play_freq := note_freqs[ n ];
xn := note_quarter * (note_length / quarter_note);
play_duration := trunc(xn * note_fraction);
rest_duration := trunc(xn * (1.0 - note_fraction));
end else if (n = 0) then begin
play_freq := 0; play_duration := 0;
rest_duration := trunc(note_fraction * note_quarter *
(note_length / quarter_note));
end;
sound(play_freq); delay(play_duration); nosound;
delay(rest_duration);
end { play note n };
'L' : begin { set length of notes }
inc(i); n := getint;
if n > 0 then note_length := 1.0 / n;
end { set length of notes };
'T' : begin { # of quarter notes in a minute }
inc(i); n := getint;
note_quarter := (1092.0 / 18.2 / n) * 1000.0;
end { # of quarter notes in a minute };
'P' : begin { pause }
inc(i); n := getint;
if (n < 1) then n := 1 else if (n > 64) then n := 64;
play_freq := 0; play_duration := 0;
rest_duration := trunc(((1.0 / n) / quarter_note) * note_quarter);
sound(play_freq); delay(play_duration); nosound;
delay(rest_duration);
end { pause };
else { ignore other stuff };
end { case };
inc(i);
end { interpret music };
nosound; { make sure sound turned off when through }
end;
procedure beep(h, l: word);
begin
sound(h); delay(l); nosound;
end;
end. { of unit }
| 31.968652 | 79 | 0.466268 |
f170dfdfa3df8c09472cb1c97ea21ca07da48533 | 254 | dpr | Pascal | arquivos/Componentes Nativos - iOS/Demos/DrawingNative/iOSDrawingN.dpr | leovieira/sistema-de-gerenciamento-de-eventos | 07262f670852db666b418d3bbdbfcf7800650481 | [
"MIT"
]
| null | null | null | arquivos/Componentes Nativos - iOS/Demos/DrawingNative/iOSDrawingN.dpr | leovieira/sistema-de-gerenciamento-de-eventos | 07262f670852db666b418d3bbdbfcf7800650481 | [
"MIT"
]
| null | null | null | arquivos/Componentes Nativos - iOS/Demos/DrawingNative/iOSDrawingN.dpr | leovieira/sistema-de-gerenciamento-de-eventos | 07262f670852db666b418d3bbdbfcf7800650481 | [
"MIT"
]
| null | null | null | Program iOSDrawingN;
uses
System.StartUpCopy,
FMX.Forms,
uMain in 'uMain.pas' {FDrawingNative};
{$I DPF.iOS.Defs.inc}
{$R *.res}
Begin
Application.Initialize;
Application.CreateForm(TFDrawingNative, FDrawingNative);
Application.Run;
End.
| 14.941176 | 58 | 0.73622 |
47584f39bed09abc3b72499c8dc40d9f7ec1751e | 1,068 | pas | Pascal | code/KSP/2. kolo/dohrajte_hru.pas | petak5/INF4 | 6be309583ae4b743b0906c8c2b75392532bf48a4 | [
"MIT"
]
| null | null | null | code/KSP/2. kolo/dohrajte_hru.pas | petak5/INF4 | 6be309583ae4b743b0906c8c2b75392532bf48a4 | [
"MIT"
]
| null | null | null | code/KSP/2. kolo/dohrajte_hru.pas | petak5/INF4 | 6be309583ae4b743b0906c8c2b75392532bf48a4 | [
"MIT"
]
| null | null | null | // Not working!!!
program dohrajte_hru;
uses sysutils;
var i, j, n, card_piles_count: integer;
f: text;
arr: array[1 .. 100, 1 .. 100] of integer;
lines: array[1 .. 100] of string;
temp: string;
begin
assign(f, 'dohrajte_hru.txt');
reset(f);
readln(f, card_piles_count);
for i := 1 to card_piles_count do readln(f, lines[i]);
close(f);
for i := 1 to card_piles_count do begin
n := 1;
temp := '';
for j := 1 to length(lines[i]) do begin
if lines[i, j] <> ' ' then temp := concat(temp, lines[i, j])
else begin
arr[i, n] := strtoint(temp);
temp := '';
inc(n, 1);
end;
end;
if temp <> '' then begin
arr[i, n] := strtoint(temp);
end;
end;
for i := 1 to card_piles_count do begin
for j := 1 to arr[i, 1] do begin
write(arr[i, j], ' ');
end;
writeln;
end;
writeln;
for i := 1 to card_piles_count do writeln(lines[i]);
end. | 22.723404 | 72 | 0.493446 |
4724efa1fd9619d89754afa4a545c4f66fc2e050 | 310 | dpr | Pascal | BrowserChooser.dpr | geoffsmith82/Browser | dc314b5a7a68405b968de31dacd013c63dad4be8 | [
"MIT"
]
| 3 | 2019-01-14T01:42:25.000Z | 2019-07-07T00:56:03.000Z | BrowserChooser.dpr | geoffsmith82/Browser | dc314b5a7a68405b968de31dacd013c63dad4be8 | [
"MIT"
]
| null | null | null | BrowserChooser.dpr | geoffsmith82/Browser | dc314b5a7a68405b968de31dacd013c63dad4be8 | [
"MIT"
]
| 1 | 2019-01-14T01:42:29.000Z | 2019-01-14T01:42:29.000Z | program BrowserChooser;
uses
System.StartUpCopy,
FMX.Forms,
frmOpenURL in 'frmOpenURL.pas' {frmBrowserChooser},
frmMain in 'frmMain.pas' {frmBrowserChooseDemo};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TfrmBrowserChooseDemo, frmBrowserChooseDemo);
Application.Run;
end.
| 19.375 | 70 | 0.774194 |
fcaf6ea56931169b67600316a207be72f2fd9606 | 37,815 | dfm | Pascal | source/uSystemSet.dfm | xieyunc/dmtjsglxt | 5160838122879e9773b30302442e5843724e9b90 | [
"Apache-2.0"
]
| null | null | null | source/uSystemSet.dfm | xieyunc/dmtjsglxt | 5160838122879e9773b30302442e5843724e9b90 | [
"Apache-2.0"
]
| null | null | null | source/uSystemSet.dfm | xieyunc/dmtjsglxt | 5160838122879e9773b30302442e5843724e9b90 | [
"Apache-2.0"
]
| null | null | null | object SystemSet: TSystemSet
Left = 0
Top = 0
ActiveControl = btn_Exit
BorderStyle = bsDialog
Caption = #31995#32479#35774#32622
ClientHeight = 390
ClientWidth = 586
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poMainFormCenter
OnClose = FormClose
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 14
object pgc1: TPageControl
Left = 0
Top = 0
Width = 586
Height = 345
ActivePage = ts2
Align = alClient
HotTrack = True
TabOrder = 0
ExplicitWidth = 455
ExplicitHeight = 267
object ts1: TTabSheet
Caption = #19978#35838#26102#38388#35774#32622
ExplicitWidth = 447
ExplicitHeight = 238
object lbl_11: TLabel
Left = 8
Top = 10
Width = 60
Height = 14
Caption = #24320#22987#26085#26399#65306
end
object lbl_12: TLabel
Left = 168
Top = 10
Width = 60
Height = 14
Caption = #24490#29615#27425#25968#65306
end
object lbl_2: TLabel
Left = 294
Top = 10
Width = 90
Height = 13
Caption = '(-1'#34920#31034#19981#38480#27425#25968')'
Font.Charset = DEFAULT_CHARSET
Font.Color = clMaroon
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
end
object DBDateTimeEditEh1: TDBDateTimeEditEh
Left = 66
Top = 7
Width = 87
Height = 22
DataField = #24320#22987#26085#26399
DataSource = DataSource1
EditButtons = <>
Kind = dtkDateEh
TabOrder = 0
Visible = True
end
object edt_1: TDBNumberEditEh
Left = 226
Top = 7
Width = 61
Height = 22
DataField = #27425#25968
DataSource = DataSource1
EditButtons = <>
MaxValue = 99999.000000000000000000
MinValue = -1.000000000000000000
TabOrder = 1
Visible = True
end
object DBGridEh1: TDBGridEh
Left = 8
Top = 41
Width = 558
Height = 164
Align = alCustom
AllowedOperations = [alopInsertEh, alopUpdateEh]
DataGrouping.GroupLevels = <>
DataSource = DataSource2
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Tahoma'
Font.Style = []
FooterColor = clWindow
FooterFont.Charset = DEFAULT_CHARSET
FooterFont.Color = clWindowText
FooterFont.Height = -12
FooterFont.Name = 'Tahoma'
FooterFont.Style = []
ImeMode = imDisable
Options = [dgEditing, dgTitles, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit]
OptionsEh = [dghFixed3D, dghHighlightFocus, dghClearSelection, dghRowHighlight, dghDialogFind, dghColumnResize, dghColumnMove, dghHotTrack]
ParentFont = False
RowDetailPanel.Color = clBtnFace
RowHeight = 45
TabOrder = 2
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -12
TitleFont.Name = 'Tahoma'
TitleFont.Style = []
UseMultiTitle = True
VertScrollBar.VisibleMode = sbNeverShowEh
Columns = <
item
Alignment = taCenter
EditButtons = <>
FieldName = 'id'
Footers = <>
Layout = tlCenter
Visible = False
Width = 29
end
item
Alignment = taCenter
EditButtons = <>
FieldName = #25945#23460
Footers = <>
Layout = tlCenter
Visible = False
end
item
Alignment = taCenter
EditButtons = <>
FieldName = #35828#26126
Footers = <>
Layout = tlCenter
Width = 45
end
item
Alignment = taCenter
EditButtons = <>
FieldName = #24320#22987#26102#38388
Footers = <>
Layout = tlCenter
Width = 58
end
item
Alignment = taCenter
EditButtons = <>
FieldName = #32467#26463#26102#38388
Footers = <>
Layout = tlCenter
Width = 58
end
item
Alignment = taCenter
EditButtons = <>
FieldName = #21608#26085
Footers = <>
Layout = tlCenter
Width = 55
end
item
Alignment = taCenter
EditButtons = <>
FieldName = #21608#19968
Footers = <>
Layout = tlCenter
Width = 55
end
item
Alignment = taCenter
EditButtons = <>
FieldName = #21608#20108
Footers = <>
Layout = tlCenter
Width = 55
end
item
Alignment = taCenter
EditButtons = <>
FieldName = #21608#19977
Footers = <>
Layout = tlCenter
Width = 55
end
item
Alignment = taCenter
EditButtons = <>
FieldName = #21608#22235
Footers = <>
Layout = tlCenter
Width = 55
end
item
Alignment = taCenter
EditButtons = <>
FieldName = #21608#20116
Footers = <>
Layout = tlCenter
Width = 55
end
item
Alignment = taCenter
EditButtons = <>
FieldName = #21608#20845
Footers = <>
Layout = tlCenter
Width = 55
end>
object RowDetailData: TRowDetailPanelControlEh
end
end
end
object ts2: TTabSheet
Caption = #25237#24433#25511#21046#35774#32622
ImageIndex = 1
ExplicitWidth = 447
ExplicitHeight = 238
object lbl1: TLabel
Left = 30
Top = 36
Width = 72
Height = 14
Caption = #24320#26426#25511#21046#30721#65306
end
object lbl2: TLabel
Left = 30
Top = 63
Width = 72
Height = 14
Caption = #20851#26426#25511#21046#30721#65306
end
object lbl3: TLabel
Left = 30
Top = 10
Width = 72
Height = 14
Caption = #25237#24433#26426#22411#21495#65306
FocusControl = dbedt1
end
object lbl4: TLabel
Left = 54
Top = 89
Width = 48
Height = 14
Caption = #20018#21475#21495#65306
FocusControl = cbb_Port
end
object lbl5: TLabel
Left = 54
Top = 115
Width = 48
Height = 14
Caption = #27874#29305#29575#65306
FocusControl = dbedt5
end
object lbl6: TLabel
Left = 30
Top = 141
Width = 72
Height = 14
Caption = #22855#20598#26657#39564#20301#65306
FocusControl = dbedt6
end
object lbl7: TLabel
Left = 54
Top = 168
Width = 48
Height = 14
Caption = #25968#25454#20301#65306
FocusControl = dbedt7
end
object lbl8: TLabel
Left = 54
Top = 194
Width = 48
Height = 14
Caption = #20572#27490#20301#65306
FocusControl = dbedt8
end
object btn1: TSpeedButton
Left = 532
Top = 35
Width = 23
Height = 22
Hint = #27979#35797
Glyph.Data = {
36060000424D3606000000000000360400002800000020000000100000000100
08000000000000020000520B0000520B00000001000000000000000000003300
00006600000099000000CC000000FF0000000033000033330000663300009933
0000CC330000FF33000000660000336600006666000099660000CC660000FF66
000000990000339900006699000099990000CC990000FF99000000CC000033CC
000066CC000099CC0000CCCC0000FFCC000000FF000033FF000066FF000099FF
0000CCFF0000FFFF000000003300330033006600330099003300CC003300FF00
330000333300333333006633330099333300CC333300FF333300006633003366
33006666330099663300CC663300FF6633000099330033993300669933009999
3300CC993300FF99330000CC330033CC330066CC330099CC3300CCCC3300FFCC
330000FF330033FF330066FF330099FF3300CCFF3300FFFF3300000066003300
66006600660099006600CC006600FF0066000033660033336600663366009933
6600CC336600FF33660000666600336666006666660099666600CC666600FF66
660000996600339966006699660099996600CC996600FF99660000CC660033CC
660066CC660099CC6600CCCC6600FFCC660000FF660033FF660066FF660099FF
6600CCFF6600FFFF660000009900330099006600990099009900CC009900FF00
990000339900333399006633990099339900CC339900FF339900006699003366
99006666990099669900CC669900FF6699000099990033999900669999009999
9900CC999900FF99990000CC990033CC990066CC990099CC9900CCCC9900FFCC
990000FF990033FF990066FF990099FF9900CCFF9900FFFF99000000CC003300
CC006600CC009900CC00CC00CC00FF00CC000033CC003333CC006633CC009933
CC00CC33CC00FF33CC000066CC003366CC006666CC009966CC00CC66CC00FF66
CC000099CC003399CC006699CC009999CC00CC99CC00FF99CC0000CCCC0033CC
CC0066CCCC0099CCCC00CCCCCC00FFCCCC0000FFCC0033FFCC0066FFCC0099FF
CC00CCFFCC00FFFFCC000000FF003300FF006600FF009900FF00CC00FF00FF00
FF000033FF003333FF006633FF009933FF00CC33FF00FF33FF000066FF003366
FF006666FF009966FF00CC66FF00FF66FF000099FF003399FF006699FF009999
FF00CC99FF00FF99FF0000CCFF0033CCFF0066CCFF0099CCFF00CCCCFF00FFCC
FF0000FFFF0033FFFF0066FFFF0099FFFF00CCFFFF00FFFFFF00000080000080
000000808000800000008000800080800000C0C0C00080808000191919004C4C
4C00B2B2B200E5E5E5005A1E1E00783C3C0096646400C8969600FFC8C800465F
82005591B9006EB9D7008CD2E600B4E6F000D8E9EC0099A8AC00646F7100E2EF
F100C56A31000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000EEEEEEEEEEAA
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE81EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAA
A2EEEEEEEEEEEEEEEEEEEEEEEEEEEE8181EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
AAA2EEEEEEEEEEEEEEEEEEEEEEEEEEEE8181EEEEEEEEEEEEEEEEEEEEEEEEEEEE
AAD5A2EEEEEEEEEEEEEEEEEEEEEEEEEE81E381EEEEEEEEEEEEEEEEEEEEEEAAA2
A2A2D4A2EEEEEEEEEEEEEEEEEEEE81818181AC81EEEEEEEEEEEEEEEEEEEEAAD5
D4D4D4D4A2EEEEEEEEEEEEEEEEEE81E3ACACACAC81EEEEEEEEEEEEEEEEEEEEAA
D5D4A2AAAAAAEEEEEEEEEEEEEEEEEE81E3AC81818181EEEEEEEEEEEEEEEEEEAA
D5D4D4A2EEEEEEEEEEEEEEEEEEEEEE81E3ACAC81EEEEEEEEEEEEEEEEAAA2A2A2
A2D5D4D4A2EEEEEEEEEEEEEE8181818181E3ACAC81EEEEEEEEEEEEEEAAD5D5D4
D4D4D4D4D4A2EEEEEEEEEEEE81E3E3ACACACACACAC81EEEEEEEEEEEEEEAAD5D5
D4D4A2AAAAAAEEEEEEEEEEEEEE81E3E3ACAC81818181EEEEEEEEEEEEEEAAD5D5
D5D4D4A2EEEEEEEEEEEEEEEEEE81E3E3E3ACAC81EEEEEEEEEEEEEEEEEEEEAAD5
D5D5D4D4A2EEEEEEEEEEEEEEEEEE81E3E3E3ACAC81EEEEEEEEEEEEEEEEEEAAD5
D5D5D4D4D4A2EEEEEEEEEEEEEEEE81E3E3E3ACACAC81EEEEEEEEEEEEEEEEEEAA
D5D5D5D4D4D4A2EEEEEEEEEEEEEEEE81E3E3E3ACACAC81EEEEEEEEEEEEEEEEAA
AAAAAAAAAAAAAAAAEEEEEEEEEEEEEE818181818181818181EEEE}
NumGlyphs = 2
ParentShowHint = False
ShowHint = True
OnClick = btn1Click
end
object btn2: TSpeedButton
Left = 532
Top = 60
Width = 23
Height = 22
Hint = #27979#35797
Glyph.Data = {
36060000424D3606000000000000360400002800000020000000100000000100
08000000000000020000520B0000520B00000001000000000000000000003300
00006600000099000000CC000000FF0000000033000033330000663300009933
0000CC330000FF33000000660000336600006666000099660000CC660000FF66
000000990000339900006699000099990000CC990000FF99000000CC000033CC
000066CC000099CC0000CCCC0000FFCC000000FF000033FF000066FF000099FF
0000CCFF0000FFFF000000003300330033006600330099003300CC003300FF00
330000333300333333006633330099333300CC333300FF333300006633003366
33006666330099663300CC663300FF6633000099330033993300669933009999
3300CC993300FF99330000CC330033CC330066CC330099CC3300CCCC3300FFCC
330000FF330033FF330066FF330099FF3300CCFF3300FFFF3300000066003300
66006600660099006600CC006600FF0066000033660033336600663366009933
6600CC336600FF33660000666600336666006666660099666600CC666600FF66
660000996600339966006699660099996600CC996600FF99660000CC660033CC
660066CC660099CC6600CCCC6600FFCC660000FF660033FF660066FF660099FF
6600CCFF6600FFFF660000009900330099006600990099009900CC009900FF00
990000339900333399006633990099339900CC339900FF339900006699003366
99006666990099669900CC669900FF6699000099990033999900669999009999
9900CC999900FF99990000CC990033CC990066CC990099CC9900CCCC9900FFCC
990000FF990033FF990066FF990099FF9900CCFF9900FFFF99000000CC003300
CC006600CC009900CC00CC00CC00FF00CC000033CC003333CC006633CC009933
CC00CC33CC00FF33CC000066CC003366CC006666CC009966CC00CC66CC00FF66
CC000099CC003399CC006699CC009999CC00CC99CC00FF99CC0000CCCC0033CC
CC0066CCCC0099CCCC00CCCCCC00FFCCCC0000FFCC0033FFCC0066FFCC0099FF
CC00CCFFCC00FFFFCC000000FF003300FF006600FF009900FF00CC00FF00FF00
FF000033FF003333FF006633FF009933FF00CC33FF00FF33FF000066FF003366
FF006666FF009966FF00CC66FF00FF66FF000099FF003399FF006699FF009999
FF00CC99FF00FF99FF0000CCFF0033CCFF0066CCFF0099CCFF00CCCCFF00FFCC
FF0000FFFF0033FFFF0066FFFF0099FFFF00CCFFFF00FFFFFF00000080000080
000000808000800000008000800080800000C0C0C00080808000191919004C4C
4C00B2B2B200E5E5E5005A1E1E00783C3C0096646400C8969600FFC8C800465F
82005591B9006EB9D7008CD2E600B4E6F000D8E9EC0099A8AC00646F7100E2EF
F100C56A31000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000EEEEEEEEEEAA
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE81EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAA
A2EEEEEEEEEEEEEEEEEEEEEEEEEEEE8181EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
AAA2EEEEEEEEEEEEEEEEEEEEEEEEEEEE8181EEEEEEEEEEEEEEEEEEEEEEEEEEEE
AAD5A2EEEEEEEEEEEEEEEEEEEEEEEEEE81E381EEEEEEEEEEEEEEEEEEEEEEAAA2
A2A2D4A2EEEEEEEEEEEEEEEEEEEE81818181AC81EEEEEEEEEEEEEEEEEEEEAAD5
D4D4D4D4A2EEEEEEEEEEEEEEEEEE81E3ACACACAC81EEEEEEEEEEEEEEEEEEEEAA
D5D4A2AAAAAAEEEEEEEEEEEEEEEEEE81E3AC81818181EEEEEEEEEEEEEEEEEEAA
D5D4D4A2EEEEEEEEEEEEEEEEEEEEEE81E3ACAC81EEEEEEEEEEEEEEEEAAA2A2A2
A2D5D4D4A2EEEEEEEEEEEEEE8181818181E3ACAC81EEEEEEEEEEEEEEAAD5D5D4
D4D4D4D4D4A2EEEEEEEEEEEE81E3E3ACACACACACAC81EEEEEEEEEEEEEEAAD5D5
D4D4A2AAAAAAEEEEEEEEEEEEEE81E3E3ACAC81818181EEEEEEEEEEEEEEAAD5D5
D5D4D4A2EEEEEEEEEEEEEEEEEE81E3E3E3ACAC81EEEEEEEEEEEEEEEEEEEEAAD5
D5D5D4D4A2EEEEEEEEEEEEEEEEEE81E3E3E3ACAC81EEEEEEEEEEEEEEEEEEAAD5
D5D5D4D4D4A2EEEEEEEEEEEEEEEE81E3E3E3ACACAC81EEEEEEEEEEEEEEEEEEAA
D5D5D5D4D4D4A2EEEEEEEEEEEEEEEE81E3E3E3ACACAC81EEEEEEEEEEEEEEEEAA
AAAAAAAAAAAAAAAAEEEEEEEEEEEEEE818181818181818181EEEE}
NumGlyphs = 2
ParentShowHint = False
ShowHint = True
OnClick = btn2Click
end
object lbl_Dir: TLabel
Left = 18
Top = 220
Width = 84
Height = 14
Caption = #25511#21046#31243#24207#25991#20214#65306
end
object lbl_13: TLabel
Left = 18
Top = 249
Width = 84
Height = 14
Caption = #31243#24207#26631#39064#25991#26412#65306
FocusControl = dbedt4
end
object btn3: TSpeedButton
Left = 532
Top = 218
Width = 23
Height = 22
Hint = #27979#35797
Caption = '...'
NumGlyphs = 2
ParentShowHint = False
ShowHint = True
OnClick = btn3Click
end
object btn_Open2: TSpeedButton
Left = 507
Top = 246
Width = 23
Height = 22
Hint = #27979#35797#25171#24320#25237#24433#26426
Glyph.Data = {
36060000424D3606000000000000360400002800000020000000100000000100
08000000000000020000520B0000520B00000001000000000000000000003300
00006600000099000000CC000000FF0000000033000033330000663300009933
0000CC330000FF33000000660000336600006666000099660000CC660000FF66
000000990000339900006699000099990000CC990000FF99000000CC000033CC
000066CC000099CC0000CCCC0000FFCC000000FF000033FF000066FF000099FF
0000CCFF0000FFFF000000003300330033006600330099003300CC003300FF00
330000333300333333006633330099333300CC333300FF333300006633003366
33006666330099663300CC663300FF6633000099330033993300669933009999
3300CC993300FF99330000CC330033CC330066CC330099CC3300CCCC3300FFCC
330000FF330033FF330066FF330099FF3300CCFF3300FFFF3300000066003300
66006600660099006600CC006600FF0066000033660033336600663366009933
6600CC336600FF33660000666600336666006666660099666600CC666600FF66
660000996600339966006699660099996600CC996600FF99660000CC660033CC
660066CC660099CC6600CCCC6600FFCC660000FF660033FF660066FF660099FF
6600CCFF6600FFFF660000009900330099006600990099009900CC009900FF00
990000339900333399006633990099339900CC339900FF339900006699003366
99006666990099669900CC669900FF6699000099990033999900669999009999
9900CC999900FF99990000CC990033CC990066CC990099CC9900CCCC9900FFCC
990000FF990033FF990066FF990099FF9900CCFF9900FFFF99000000CC003300
CC006600CC009900CC00CC00CC00FF00CC000033CC003333CC006633CC009933
CC00CC33CC00FF33CC000066CC003366CC006666CC009966CC00CC66CC00FF66
CC000099CC003399CC006699CC009999CC00CC99CC00FF99CC0000CCCC0033CC
CC0066CCCC0099CCCC00CCCCCC00FFCCCC0000FFCC0033FFCC0066FFCC0099FF
CC00CCFFCC00FFFFCC000000FF003300FF006600FF009900FF00CC00FF00FF00
FF000033FF003333FF006633FF009933FF00CC33FF00FF33FF000066FF003366
FF006666FF009966FF00CC66FF00FF66FF000099FF003399FF006699FF009999
FF00CC99FF00FF99FF0000CCFF0033CCFF0066CCFF0099CCFF00CCCCFF00FFCC
FF0000FFFF0033FFFF0066FFFF0099FFFF00CCFFFF00FFFFFF00000080000080
000000808000800000008000800080800000C0C0C00080808000191919004C4C
4C00B2B2B200E5E5E5005A1E1E00783C3C0096646400C8969600FFC8C800465F
82005591B9006EB9D7008CD2E600B4E6F000D8E9EC0099A8AC00646F7100E2EF
F100C56A31000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000EEEEEEEEEEAA
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE81EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAA
A2EEEEEEEEEEEEEEEEEEEEEEEEEEEE8181EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
AAA2EEEEEEEEEEEEEEEEEEEEEEEEEEEE8181EEEEEEEEEEEEEEEEEEEEEEEEEEEE
AAD5A2EEEEEEEEEEEEEEEEEEEEEEEEEE81E381EEEEEEEEEEEEEEEEEEEEEEAAA2
A2A2D4A2EEEEEEEEEEEEEEEEEEEE81818181AC81EEEEEEEEEEEEEEEEEEEEAAD5
D4D4D4D4A2EEEEEEEEEEEEEEEEEE81E3ACACACAC81EEEEEEEEEEEEEEEEEEEEAA
D5D4A2AAAAAAEEEEEEEEEEEEEEEEEE81E3AC81818181EEEEEEEEEEEEEEEEEEAA
D5D4D4A2EEEEEEEEEEEEEEEEEEEEEE81E3ACAC81EEEEEEEEEEEEEEEEAAA2A2A2
A2D5D4D4A2EEEEEEEEEEEEEE8181818181E3ACAC81EEEEEEEEEEEEEEAAD5D5D4
D4D4D4D4D4A2EEEEEEEEEEEE81E3E3ACACACACACAC81EEEEEEEEEEEEEEAAD5D5
D4D4A2AAAAAAEEEEEEEEEEEEEE81E3E3ACAC81818181EEEEEEEEEEEEEEAAD5D5
D5D4D4A2EEEEEEEEEEEEEEEEEE81E3E3E3ACAC81EEEEEEEEEEEEEEEEEEEEAAD5
D5D5D4D4A2EEEEEEEEEEEEEEEEEE81E3E3E3ACAC81EEEEEEEEEEEEEEEEEEAAD5
D5D5D4D4D4A2EEEEEEEEEEEEEEEE81E3E3E3ACACAC81EEEEEEEEEEEEEEEEEEAA
D5D5D5D4D4D4A2EEEEEEEEEEEEEEEE81E3E3E3ACACAC81EEEEEEEEEEEEEEEEAA
AAAAAAAAAAAAAAAAEEEEEEEEEEEEEE818181818181818181EEEE}
NumGlyphs = 2
ParentShowHint = False
ShowHint = True
OnClick = btn_Open2Click
end
object btn_Close2: TSpeedButton
Left = 532
Top = 246
Width = 23
Height = 22
Hint = #27979#35797#20851#38381#25237#24433#26426
Glyph.Data = {
36060000424D3606000000000000360400002800000020000000100000000100
08000000000000020000520B0000520B00000001000000000000000000003300
00006600000099000000CC000000FF0000000033000033330000663300009933
0000CC330000FF33000000660000336600006666000099660000CC660000FF66
000000990000339900006699000099990000CC990000FF99000000CC000033CC
000066CC000099CC0000CCCC0000FFCC000000FF000033FF000066FF000099FF
0000CCFF0000FFFF000000003300330033006600330099003300CC003300FF00
330000333300333333006633330099333300CC333300FF333300006633003366
33006666330099663300CC663300FF6633000099330033993300669933009999
3300CC993300FF99330000CC330033CC330066CC330099CC3300CCCC3300FFCC
330000FF330033FF330066FF330099FF3300CCFF3300FFFF3300000066003300
66006600660099006600CC006600FF0066000033660033336600663366009933
6600CC336600FF33660000666600336666006666660099666600CC666600FF66
660000996600339966006699660099996600CC996600FF99660000CC660033CC
660066CC660099CC6600CCCC6600FFCC660000FF660033FF660066FF660099FF
6600CCFF6600FFFF660000009900330099006600990099009900CC009900FF00
990000339900333399006633990099339900CC339900FF339900006699003366
99006666990099669900CC669900FF6699000099990033999900669999009999
9900CC999900FF99990000CC990033CC990066CC990099CC9900CCCC9900FFCC
990000FF990033FF990066FF990099FF9900CCFF9900FFFF99000000CC003300
CC006600CC009900CC00CC00CC00FF00CC000033CC003333CC006633CC009933
CC00CC33CC00FF33CC000066CC003366CC006666CC009966CC00CC66CC00FF66
CC000099CC003399CC006699CC009999CC00CC99CC00FF99CC0000CCCC0033CC
CC0066CCCC0099CCCC00CCCCCC00FFCCCC0000FFCC0033FFCC0066FFCC0099FF
CC00CCFFCC00FFFFCC000000FF003300FF006600FF009900FF00CC00FF00FF00
FF000033FF003333FF006633FF009933FF00CC33FF00FF33FF000066FF003366
FF006666FF009966FF00CC66FF00FF66FF000099FF003399FF006699FF009999
FF00CC99FF00FF99FF0000CCFF0033CCFF0066CCFF0099CCFF00CCCCFF00FFCC
FF0000FFFF0033FFFF0066FFFF0099FFFF00CCFFFF00FFFFFF00000080000080
000000808000800000008000800080800000C0C0C00080808000191919004C4C
4C00B2B2B200E5E5E5005A1E1E00783C3C0096646400C8969600FFC8C800465F
82005591B9006EB9D7008CD2E600B4E6F000D8E9EC0099A8AC00646F7100E2EF
F100C56A31000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000EEEEEEEEEEAA
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE81EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAA
A2EEEEEEEEEEEEEEEEEEEEEEEEEEEE8181EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
AAA2EEEEEEEEEEEEEEEEEEEEEEEEEEEE8181EEEEEEEEEEEEEEEEEEEEEEEEEEEE
AAD5A2EEEEEEEEEEEEEEEEEEEEEEEEEE81E381EEEEEEEEEEEEEEEEEEEEEEAAA2
A2A2D4A2EEEEEEEEEEEEEEEEEEEE81818181AC81EEEEEEEEEEEEEEEEEEEEAAD5
D4D4D4D4A2EEEEEEEEEEEEEEEEEE81E3ACACACAC81EEEEEEEEEEEEEEEEEEEEAA
D5D4A2AAAAAAEEEEEEEEEEEEEEEEEE81E3AC81818181EEEEEEEEEEEEEEEEEEAA
D5D4D4A2EEEEEEEEEEEEEEEEEEEEEE81E3ACAC81EEEEEEEEEEEEEEEEAAA2A2A2
A2D5D4D4A2EEEEEEEEEEEEEE8181818181E3ACAC81EEEEEEEEEEEEEEAAD5D5D4
D4D4D4D4D4A2EEEEEEEEEEEE81E3E3ACACACACACAC81EEEEEEEEEEEEEEAAD5D5
D4D4A2AAAAAAEEEEEEEEEEEEEE81E3E3ACAC81818181EEEEEEEEEEEEEEAAD5D5
D5D4D4A2EEEEEEEEEEEEEEEEEE81E3E3E3ACAC81EEEEEEEEEEEEEEEEEEEEAAD5
D5D5D4D4A2EEEEEEEEEEEEEEEEEE81E3E3E3ACAC81EEEEEEEEEEEEEEEEEEAAD5
D5D5D4D4D4A2EEEEEEEEEEEEEEEE81E3E3E3ACACAC81EEEEEEEEEEEEEEEEEEAA
D5D5D5D4D4D4A2EEEEEEEEEEEEEEEE81E3E3E3ACACAC81EEEEEEEEEEEEEEEEAA
AAAAAAAAAAAAAAAAEEEEEEEEEEEEEE818181818181818181EEEE}
NumGlyphs = 2
ParentShowHint = False
ShowHint = True
OnClick = btn_Close2Click
end
object dbedt1: TDBEdit
Left = 104
Top = 7
Width = 451
Height = 22
DataField = #25237#24433#26426#21517#31216
DataSource = DataSource3
TabOrder = 0
end
object dbedt2: TDBEdit
Left = 104
Top = 34
Width = 426
Height = 22
DataField = #24320#26426#25511#21046#30721
DataSource = DataSource3
TabOrder = 1
end
object dbedt3: TDBEdit
Left = 104
Top = 60
Width = 426
Height = 22
DataField = #20851#26426#25511#21046#30721
DataSource = DataSource3
TabOrder = 2
end
object cbb_Port: TDBComboBoxEh
Left = 104
Top = 87
Width = 144
Height = 22
Alignment = taLeftJustify
DataField = #20018#21475#21495
DataSource = DataSource3
EditButtons = <>
Items.Strings = (
'COM1'
'COM2'
'COM3'
'COM4'
'COM5'
'COM6'
'COM7'
'COM8'
'COM9')
TabOrder = 3
Visible = True
OnClick = cbb_PortClick
OnDropDown = cbb_PortDropDown
end
object dbedt5: TDBComboBoxEh
Left = 104
Top = 114
Width = 144
Height = 22
Alignment = taLeftJustify
DataField = #27874#29305#29575
DataSource = DataSource3
EditButtons = <>
Items.Strings = (
'1200'
'2400'
'4800'
'9600'
'19200'
'38400'
'57600'
'115200'
'230400'
'460800'
'921600')
TabOrder = 4
Visible = True
OnClick = cbb_PortClick
end
object dbedt6: TDBComboBoxEh
Left = 104
Top = 141
Width = 144
Height = 22
Alignment = taLeftJustify
DataField = #22855#20598#26657#39564#20301
DataSource = DataSource3
EditButtons = <>
Items.Strings = (
#26080
#22855#26657#39564
#20598#26657#39564
#26631#24535
#31354#26684)
KeyItems.Strings = (
'pNone'
'pOdd'
'pEven'
'pMark'
'pSpace')
TabOrder = 5
Visible = True
OnClick = cbb_PortClick
end
object dbedt7: TDBComboBoxEh
Left = 104
Top = 167
Width = 144
Height = 22
Alignment = taLeftJustify
DataField = #25968#25454#20301
DataSource = DataSource3
EditButtons = <>
Items.Strings = (
'5'
'6'
'7'
'8')
TabOrder = 6
Visible = True
OnClick = cbb_PortClick
end
object dbedt8: TDBComboBoxEh
Left = 104
Top = 194
Width = 144
Height = 22
Alignment = taLeftJustify
DataField = #20572#27490#20301
DataSource = DataSource3
EditButtons = <>
Items.Strings = (
'1'
'1.5'
'2')
TabOrder = 7
Visible = True
OnClick = cbb_PortClick
end
object dbedt4: TDBEdit
Left = 104
Top = 246
Width = 400
Height = 22
Hint = #24517#39035#20934#30830#30340#22635#20889#25237#24433#26426#25511#21046#31243#24207#30340#26631#39064#20869#23481
DataField = #31243#24207#26631#39064
DataSource = DataSource3
ParentShowHint = False
ShowHint = True
TabOrder = 9
end
object dbedt_Exe: TDBEdit
Left = 104
Top = 218
Width = 426
Height = 22
Hint = #24102#36335#36335#24452#30340#25237#24433#26426#25511#21046#31243#24207#25991#20214#20840#21517'(exe'#25991#20214')'
DataField = #25511#21046#31243#24207
DataSource = DataSource3
ParentShowHint = False
ShowHint = True
TabOrder = 8
end
end
end
object pnl1: TPanel
Left = 0
Top = 345
Width = 586
Height = 45
Align = alBottom
BevelOuter = bvNone
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
TabOrder = 1
ExplicitTop = 267
ExplicitWidth = 455
DesignSize = (
586
45)
object btn_Save: TBitBtn
Left = 395
Top = 10
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = #20445#23384
TabOrder = 0
OnClick = btn_SaveClick
Glyph.Data = {
36060000424D3606000000000000360400002800000020000000100000000100
08000000000000020000320B0000320B00000001000000000000000000003300
00006600000099000000CC000000FF0000000033000033330000663300009933
0000CC330000FF33000000660000336600006666000099660000CC660000FF66
000000990000339900006699000099990000CC990000FF99000000CC000033CC
000066CC000099CC0000CCCC0000FFCC000000FF000033FF000066FF000099FF
0000CCFF0000FFFF000000003300330033006600330099003300CC003300FF00
330000333300333333006633330099333300CC333300FF333300006633003366
33006666330099663300CC663300FF6633000099330033993300669933009999
3300CC993300FF99330000CC330033CC330066CC330099CC3300CCCC3300FFCC
330000FF330033FF330066FF330099FF3300CCFF3300FFFF3300000066003300
66006600660099006600CC006600FF0066000033660033336600663366009933
6600CC336600FF33660000666600336666006666660099666600CC666600FF66
660000996600339966006699660099996600CC996600FF99660000CC660033CC
660066CC660099CC6600CCCC6600FFCC660000FF660033FF660066FF660099FF
6600CCFF6600FFFF660000009900330099006600990099009900CC009900FF00
990000339900333399006633990099339900CC339900FF339900006699003366
99006666990099669900CC669900FF6699000099990033999900669999009999
9900CC999900FF99990000CC990033CC990066CC990099CC9900CCCC9900FFCC
990000FF990033FF990066FF990099FF9900CCFF9900FFFF99000000CC003300
CC006600CC009900CC00CC00CC00FF00CC000033CC003333CC006633CC009933
CC00CC33CC00FF33CC000066CC003366CC006666CC009966CC00CC66CC00FF66
CC000099CC003399CC006699CC009999CC00CC99CC00FF99CC0000CCCC0033CC
CC0066CCCC0099CCCC00CCCCCC00FFCCCC0000FFCC0033FFCC0066FFCC0099FF
CC00CCFFCC00FFFFCC000000FF003300FF006600FF009900FF00CC00FF00FF00
FF000033FF003333FF006633FF009933FF00CC33FF00FF33FF000066FF003366
FF006666FF009966FF00CC66FF00FF66FF000099FF003399FF006699FF009999
FF00CC99FF00FF99FF0000CCFF0033CCFF0066CCFF0099CCFF00CCCCFF00FFCC
FF0000FFFF0033FFFF0066FFFF0099FFFF00CCFFFF00FFFFFF00000080000080
000000808000800000008000800080800000C0C0C00080808000191919004C4C
4C00B2B2B200E5E5E5005A1E1E00783C3C0096646400C8969600FFC8C800465F
82005591B9006EB9D7008CD2E600B4E6F000D8E9EC0099A8AC00646F7100E2EF
F100C56A31000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000EEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE0909
EEEEEEEEEEEEEEEEEEEEEEEEEEEE8181EEEEEEEEEEEEEEEEEEEEEEEEEE091010
09EEEEEEEEEEEEEEEEEEEEEEEE81ACAC81EEEEEEEEEEEEEEEEEEEEEE09101010
1009EEEEEEEEEEEEEEEEEEEE81ACACACAC81EEEEEEEEEEEEEEEEEE0910101010
101009EEEEEEEEEEEEEEEE81ACACACACACAC81EEEEEEEEEEEEEEEE0910100909
10101009EEEEEEEEEEEEEE81ACAC8181ACACAC81EEEEEEEEEEEEEE091009EEEE
0910101009EEEEEEEEEEEE81AC81EEEE81ACACAC81EEEEEEEEEEEE0909EEEEEE
EE0910101009EEEEEEEEEE8181EEEEEEEE81ACACAC81EEEEEEEEEEEEEEEEEEEE
EEEE0910101009EEEEEEEEEEEEEEEEEEEEEE81ACACAC81EEEEEEEEEEEEEEEEEE
EEEEEE0910101009EEEEEEEEEEEEEEEEEEEEEE81ACACAC81EEEEEEEEEEEEEEEE
EEEEEEEE09101009EEEEEEEEEEEEEEEEEEEEEEEE81ACAC81EEEEEEEEEEEEEEEE
EEEEEEEEEE091009EEEEEEEEEEEEEEEEEEEEEEEEEE81AC81EEEEEEEEEEEEEEEE
EEEEEEEEEEEE0909EEEEEEEEEEEEEEEEEEEEEEEEEEEE8181EEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE}
NumGlyphs = 2
end
object btn_Exit: TBitBtn
Left = 486
Top = 10
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = #20851#38381
TabOrder = 1
OnClick = btn_ExitClick
Glyph.Data = {
36060000424D3606000000000000360400002800000020000000100000000100
08000000000000020000B40B0000B40B00000001000000000000000000003300
00006600000099000000CC000000FF0000000033000033330000663300009933
0000CC330000FF33000000660000336600006666000099660000CC660000FF66
000000990000339900006699000099990000CC990000FF99000000CC000033CC
000066CC000099CC0000CCCC0000FFCC000000FF000033FF000066FF000099FF
0000CCFF0000FFFF000000003300330033006600330099003300CC003300FF00
330000333300333333006633330099333300CC333300FF333300006633003366
33006666330099663300CC663300FF6633000099330033993300669933009999
3300CC993300FF99330000CC330033CC330066CC330099CC3300CCCC3300FFCC
330000FF330033FF330066FF330099FF3300CCFF3300FFFF3300000066003300
66006600660099006600CC006600FF0066000033660033336600663366009933
6600CC336600FF33660000666600336666006666660099666600CC666600FF66
660000996600339966006699660099996600CC996600FF99660000CC660033CC
660066CC660099CC6600CCCC6600FFCC660000FF660033FF660066FF660099FF
6600CCFF6600FFFF660000009900330099006600990099009900CC009900FF00
990000339900333399006633990099339900CC339900FF339900006699003366
99006666990099669900CC669900FF6699000099990033999900669999009999
9900CC999900FF99990000CC990033CC990066CC990099CC9900CCCC9900FFCC
990000FF990033FF990066FF990099FF9900CCFF9900FFFF99000000CC003300
CC006600CC009900CC00CC00CC00FF00CC000033CC003333CC006633CC009933
CC00CC33CC00FF33CC000066CC003366CC006666CC009966CC00CC66CC00FF66
CC000099CC003399CC006699CC009999CC00CC99CC00FF99CC0000CCCC0033CC
CC0066CCCC0099CCCC00CCCCCC00FFCCCC0000FFCC0033FFCC0066FFCC0099FF
CC00CCFFCC00FFFFCC000000FF003300FF006600FF009900FF00CC00FF00FF00
FF000033FF003333FF006633FF009933FF00CC33FF00FF33FF000066FF003366
FF006666FF009966FF00CC66FF00FF66FF000099FF003399FF006699FF009999
FF00CC99FF00FF99FF0000CCFF0033CCFF0066CCFF0099CCFF00CCCCFF00FFCC
FF0000FFFF0033FFFF0066FFFF0099FFFF00CCFFFF00FFFFFF00000080000080
000000808000800000008000800080800000C0C0C00080808000191919004C4C
4C00B2B2B200E5E5E5005A1E1E00783C3C0096646400C8969600FFC8C800465F
82005591B9006EB9D7008CD2E600B4E6F000D8E9EC0099A8AC00646F7100E2EF
F100C56A31000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000EEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE09EEEE
EEEEEEEEEEEEEEEE10EEEEEEEE81EEEEEEEEEEEEEEEEEEEEACEEEEEE091009EE
EEEEEEEEEEEEEEEEEEEEEEEE81AC81EEEEEEEEEEEEEEEEEEEEEEEEEE09101009
EEEEEEEEEEEEEE10EEEEEEEE81E3AC81EEEEEEEEEEEEEEACEEEEEEEEEE091009
EEEEEEEEEEEE10EEEEEEEEEEEE81E381EEEEEEEEEEEEACEEEEEEEEEEEEEE0910
09EEEEEEEE1009EEEEEEEEEEEEEE81AC81EEEEEEEEAC81EEEEEEEEEEEEEEEE09
1009EEEE1009EEEEEEEEEEEEEEEEEE81AC81EEEEAC81EEEEEEEEEEEEEEEEEEEE
0910091009EEEEEEEEEEEEEEEEEEEEEE81AC81AC81EEEEEEEEEEEEEEEEEEEEEE
EE091009EEEEEEEEEEEEEEEEEEEEEEEEEE81AC81EEEEEEEEEEEEEEEEEEEEEEEE
0910091009EEEEEEEEEEEEEEEEEEEEEE81AC818181EEEEEEEEEEEEEEEEEEEE09
1009EEEE1009EEEEEEEEEEEEEEEEEE81AC81EEEE8181EEEEEEEEEEEEEE091010
09EEEEEEEE1009EEEEEEEEEEEE81ACAC81EEEEEEEE8181EEEEEEEEEE09101009
EEEEEEEEEEEE1009EEEEEEEE81E3AC81EEEEEEEEEEEE8181EEEEEEEE090909EE
EEEEEEEEEEEEEEEE10EEEEEEAC81ACEEEEEEEEEEEEEEEEEE81EEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE}
NumGlyphs = 2
end
end
object DataSource1: TDataSource
DataSet = ADOQuery1
Left = 280
Top = 176
end
object DataSource2: TDataSource
DataSet = ADOQuery2
Left = 368
Top = 176
end
object ADOQuery1: TADOQuery
Connection = dm.conn_DB
CursorType = ctStatic
Parameters = <>
SQL.Strings = (
'select * from '#19978#35838#26085#26399#34920)
Left = 240
Top = 176
end
object ADOQuery2: TADOQuery
Connection = dm.conn_DB
CursorType = ctStatic
Parameters = <>
SQL.Strings = (
'select * from '#19978#35838#26102#38388#34920)
Left = 328
Top = 176
end
object AdoQuery3: TADOQuery
Connection = dm.conn_DB
CursorType = ctStatic
Parameters = <>
SQL.Strings = (
'select * from '#25237#24433#25511#21046#35774#32622#34920)
Left = 328
Top = 64
end
object DataSource3: TDataSource
DataSet = AdoQuery3
Left = 368
Top = 64
end
object dlgOpen1: TOpenDialog
DefaultExt = '*.exe'
Filter = #31243#24207#25991#20214'(*.exe)|*.exe|'#25152#26377#25991#20214'(*.*)|*.*'
Title = #25237#24433#26426#25511#21046#31243#24207
Left = 400
Top = 176
end
end
| 40.969664 | 147 | 0.720376 |
fc37f68d7f65fe6376d653082a75cb95b001d48f | 2,484 | pas | Pascal | Source/Persistence/Propagation/BoldIDAdder.pas | LenakeTech/BoldForDelphi | 3ef25517d5c92ebccc097c6bc2f2af62fc506c71 | [
"MIT"
]
| 121 | 2020-09-22T10:46:20.000Z | 2021-11-17T12:33:35.000Z | Source/Persistence/Propagation/BoldIDAdder.pas | LenakeTech/BoldForDelphi | 3ef25517d5c92ebccc097c6bc2f2af62fc506c71 | [
"MIT"
]
| 8 | 2020-09-23T12:32:23.000Z | 2021-07-28T07:01:26.000Z | Source/Persistence/Propagation/BoldIDAdder.pas | LenakeTech/BoldForDelphi | 3ef25517d5c92ebccc097c6bc2f2af62fc506c71 | [
"MIT"
]
| 42 | 2020-09-22T14:37:20.000Z | 2021-10-04T10:24:12.000Z | unit BoldIDAdder;
interface
uses
BoldPersistenceControllerPassthrough,
BoldID,
BoldUpdatePrecondition,
BoldCondition,
BoldValueSpaceInterfaces,
BoldListenerThread,
BoldDefs;
type
{ forward declarations }
TBoldIDAdder = class;
{ TBoldIDAdder }
TBoldIDAdder = class(TBoldPersistenceControllerPassthrough)
private
fListener: TBoldListenerThread;
function GetClientID: TBoldClientID;
public
constructor Create;
procedure PMFetch(ObjectIdList: TBoldObjectIdList; ValueSpace: IBoldValueSpace; MemberIdList: TBoldMemberIdList; FetchMode: Integer; BoldClientID: TBoldClientID); override;
procedure PMFetchIDListWithCondition(ObjectIdList: TBoldObjectIdList; ValueSpace: IBoldValueSpace; FetchMode: Integer; Condition: TBoldCondition; BoldClientID: TBoldClientID); override;
procedure PMUpdate(ObjectIdList: TBoldObjectIdList; ValueSpace: IBoldValueSpace; Old_Values: IBoldValueSpace; Precondition: TBoldUpdatePrecondition; TranslationList: TBoldIdTranslationList; var TimeStamp: TBoldTimeStampType; BoldClientID: TBoldClientID); override;
property BoldClientID: TBoldClientID read GetClientID;
property Listener: TBoldListenerThread read fListener write fListener;
end;
implementation
{ TBoldIDAdder }
constructor TBoldIDAdder.Create;
begin
inherited;
end;
function TBoldIDAdder.GetClientID: TBoldClientID;
begin
Result := Listener.BoldClientID;
end;
procedure TBoldIDAdder.PMFetch(ObjectIdList: TBoldObjectIdList;
ValueSpace: IBoldValueSpace; MemberIdList: TBoldMemberIdList;
FetchMode: Integer;
BoldClientID: TBoldClientID);
begin
if Listener.Suspended then
Listener.Resume;
BoldClientID := Self.BoldClientID;
inherited PMFetch(ObjectIdList, ValueSpace, MemberIdList, FetchMode, BoldClientID);
end;
procedure TBoldIDAdder.PMFetchIDListWithCondition(
ObjectIdList: TBoldObjectIdList; ValueSpace: IBoldValueSpace;
FetchMode: Integer; Condition: TBoldCondition;
BoldClientID: TBoldClientID);
begin
if Listener.Suspended then
Listener.Resume;
BoldClientID := Self.BoldClientID;
inherited;
end;
procedure TBoldIDAdder.PMUpdate(ObjectIdList: TBoldObjectIdList;
ValueSpace: IBoldValueSpace; Old_Values: IBoldValueSpace;
Precondition: TBoldUpdatePrecondition;
TranslationList: TBoldIdTranslationList; var TimeStamp: TBoldTimeStampType;
BoldClientID: TBoldClientID);
begin
if Listener.Suspended then
Listener.Resume;
BoldClientID := Self.BoldClientID;
inherited;
end;
end.
| 30.666667 | 268 | 0.811997 |
fc4ebffb214343418b7285f1c35200e3c33e04c0 | 16,154 | pas | Pascal | design/source/datagrid.pas | pascaldragon/Pas2JS_Widget | 42984d7e5d8bbcfd0d0c64f90cd4a1b60319ac90 | [
"MIT"
]
| 26 | 2020-05-09T13:07:34.000Z | 2022-02-20T04:29:17.000Z | design/source/datagrid.pas | GuvaCode/Pas2JS_Widget | bd817df72f052c10c35b6fde0a26b0609b59bdfd | [
"MIT"
]
| 24 | 2020-12-10T16:45:05.000Z | 2022-03-23T21:51:34.000Z | design/source/datagrid.pas | GuvaCode/Pas2JS_Widget | bd817df72f052c10c35b6fde0a26b0609b59bdfd | [
"MIT"
]
| 6 | 2020-06-27T03:02:12.000Z | 2022-01-10T12:54:34.000Z | {
MIT License
Copyright (c) 2018 Hélio S. Ribeiro and Anderson J. Gado da Silva
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
}
unit DataGrid;
{$mode objfpc}{$H+}
interface
uses
Classes,
SysUtils,
Types,
Graphics,
Controls;
type
/// Forward declaration
TCustomDataGrid = class;
TColumnFormat = (cfBoolean, cfDataTime, cfNumber, cfString);
{ TDataColumn }
TDataColumn = class(TCollectionItem)
private
FAlignment: TAlignment;
FColor: TColor;
FDisplayMask: string;
FFont: TFont;
FFormat: TColumnFormat;
FHint: string;
FName: string;
FTag: integer;
FTitle: string;
FUpdateCount: NativeInt;
FValueChecked: string;
FValueUnchecked: string;
FVisible: boolean;
FWidth: NativeInt;
function GetGrid: TCustomDataGrid;
procedure SetAlignment(AValue: TAlignment);
procedure SetColor(AValue: TColor);
procedure SetDisplayMask(AValue: string);
procedure SetFont(AValue: TFont);
procedure SetFormat(AValue: TColumnFormat);
procedure SetName(AValue: string);
procedure SetTitle(AValue: string);
procedure SetValueChecked(AValue: string);
procedure SetValueUnchecked(AValue: string);
procedure SetVisible(AValue: boolean);
procedure SetWidth(AValue: NativeInt);
protected
procedure ColumnChanged; virtual;
function GetDisplayName: string; override;
procedure FillDefaultFont; virtual;
procedure FontChanged(Sender: TObject); virtual;
function GetDefaultValueChecked: string; virtual;
function GetDefaultValueUnchecked: string; virtual;
public
constructor Create(ACollection: TCollection); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
procedure BeginUpdate; virtual;
procedure EndUpdate; virtual;
property Grid: TCustomDataGrid read GetGrid;
published
property Alignment: TAlignment read FAlignment write SetAlignment;
property Color: TColor read FColor write SetColor;
property DisplayMask: string read FDisplayMask write SetDisplayMask;
property Font: TFont read FFont write SetFont;
property Format: TColumnFormat read FFormat write SetFormat;
property Hint: string read FHint write FHint;
property Name: string read FName write SetName;
property Tag: integer read FTag write FTag;
property Title: string read FTitle write SetTitle;
property ValueChecked: string read FValueChecked write SetValueChecked;
property ValueUnchecked: string read FValueUnchecked write SetValueUnchecked;
property Visible: boolean read FVisible write SetVisible;
property Width: NativeInt read FWidth write SetWidth;
end;
{ TDataColumns }
TDataColumns = class(TCollection)
private
FGrid: TCustomDataGrid;
function GetColumn(AIndex: NativeInt): TDataColumn;
procedure SetColumn(AIndex: NativeInt; AValue: TDataColumn);
protected
function GetOwner: TPersistent; override;
procedure Update(AItem: TCollectionItem); override;
public
constructor Create(AGrid: TCustomDataGrid); reintroduce;
function Add: TDataColumn; reintroduce;
function HasIndex(const AIndex: integer): boolean;
property Grid: TCustomDataGrid read FGrid;
property Items[AIndex: NativeInt]: TDataColumn read GetColumn write SetColumn; default;
end;
TSortOrder = (soAscending, soDescending);
TOnClickEvent = procedure(ASender: TObject; ACol, ARow: NativeInt) of object;
TOnHeaderClick = procedure(ASender: TObject; ACol: NativeInt) of object;
{ TCustomDataGrid }
TCustomDataGrid = class(TCustomControl)
private
FAutoCreateColumns: boolean;
FColumnClickSorts: boolean;
FColumns: TDataColumns;
FDefColWidth: NativeInt;
FDefRowHeight: NativeInt;
FShowHeader: boolean;
FSortColumn: NativeInt;
FSortOrder: TSortOrder;
FOnCellClick: TOnClickEvent;
FOnHeaderClick: TOnHeaderClick;
procedure SetColumnClickSorts(AValue: boolean);
procedure SetColumns(AValue: TDataColumns);
procedure SetDefColWidth(AValue: NativeInt);
procedure SetDefRowHeight(AValue: NativeInt);
procedure SetShowHeader(AValue: boolean);
protected
procedure VisualChange; virtual;
procedure ColumnsChanged({%H-}AColumn: TDataColumn); virtual;
function CalcDefaultRowHeight: NativeInt; virtual;
procedure Paint; override;
protected
class function GetControlClassDefaultSize: TSize; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property AutoCreateColumns: boolean read FAutoCreateColumns write FAutoCreateColumns;
property Columns: TDataColumns read FColumns write SetColumns;
property ColumnClickSorts: boolean read FColumnClickSorts write SetColumnClickSorts;
property DefaultColWidth: NativeInt read FDefColWidth write SetDefColWidth;
property DefaultRowHeight: NativeInt read FDefRowHeight write SetDefRowHeight;
property SortColumn: NativeInt read FSortColumn;
property SortOrder: TSortOrder read FSortOrder;
property ShowHeader: boolean read FShowHeader write SetShowHeader;
property OnCellClick: TOnClickEvent read FOnCellClick write FOnCellClick;
property OnHeaderClick: TOnHeaderClick read FOnHeaderClick write FOnHeaderClick;
end;
TOnPageEvent = procedure(ASender: TObject; APage: NativeInt) of object;
{ TCustomPagination }
TCustomPagination = class(TCustomControl)
{ TODO: Add keys navigations }
private
FCurrentPage: NativeInt;
FOnPageClick: TOnPageEvent;
FRecordsPerPage: NativeInt;
FTotalPages: NativeInt;
FTotalRecords: NativeInt;
procedure SetCurrentPage(AValue: NativeInt);
procedure SetRecordsPerPage(AValue: NativeInt);
procedure SetTotalRecords(AValue: NativeInt);
protected
procedure Changed; virtual;
procedure CalculatePages; virtual;
procedure Paint; override;
protected
class function GetControlClassDefaultSize: TSize; override;
public
constructor Create(AOwner: TComponent); override;
property CurrentPage: NativeInt read FCurrentPage write SetCurrentPage;
property RecordsPerPage: NativeInt read FRecordsPerPage write SetRecordsPerPage;
property TotalPages: NativeInt read FTotalPages;
property TotalRecords: NativeInt read FTotalRecords write SetTotalRecords;
property OnPageClick: TOnPageEvent read FOnPageClick write FOnPageClick;
end;
implementation
uses
Math;
{ TDataColumn }
function TDataColumn.GetGrid: TCustomDataGrid;
begin
if (Collection is TDataColumns) then
begin
Result := TDataColumns(Collection).Grid;
end
else
begin
Result := nil;
end;
end;
procedure TDataColumn.SetAlignment(AValue: TAlignment);
begin
if (FAlignment <> AValue) then
begin
FAlignment := AValue;
ColumnChanged;
end;
end;
procedure TDataColumn.SetColor(AValue: TColor);
begin
if (FColor <> AValue) then
begin
FColor := AValue;
ColumnChanged;
end;
end;
procedure TDataColumn.SetDisplayMask(AValue: string);
begin
if (FDisplayMask <> AValue) then
begin
FDisplayMask := AValue;
ColumnChanged;
end;
end;
procedure TDataColumn.SetFont(AValue: TFont);
begin
if (not FFont.IsEqual(AValue)) then
begin
FFont.Assign(AValue);
end;
end;
procedure TDataColumn.SetFormat(AValue: TColumnFormat);
begin
if (FFormat <> AValue) then
begin
FFormat := AValue;
ColumnChanged;
end;
end;
procedure TDataColumn.SetName(AValue: string);
begin
if (FName <> AValue) then
begin
FName := AValue;
ColumnChanged;
end;
end;
procedure TDataColumn.SetTitle(AValue: string);
begin
if (FTitle <> AValue) then
begin
FTitle := AValue;
ColumnChanged;
end;
end;
procedure TDataColumn.SetValueChecked(AValue: string);
begin
if (FValueChecked <> AValue) then
begin
FValueChecked := AValue;
ColumnChanged;
end;
end;
procedure TDataColumn.SetValueUnchecked(AValue: string);
begin
if (FValueUnchecked <> AValue) then
begin
FValueUnchecked := AValue;
ColumnChanged;
end;
end;
procedure TDataColumn.SetVisible(AValue: boolean);
begin
if (FVisible <> AValue) then
begin
FVisible := AValue;
ColumnChanged;
end;
end;
procedure TDataColumn.SetWidth(AValue: NativeInt);
begin
if (FWidth <> AValue) then
begin
FWidth := AValue;
ColumnChanged;
end;
end;
procedure TDataColumn.ColumnChanged;
begin
if (FUpdateCount = 0) then
begin
Changed(False);
end;
end;
function TDataColumn.GetDisplayName: string;
begin
if (FTitle <> '') then
begin
Result := FTitle;
end
else
begin
Result := 'Column ' + IntToStr(Index);
end;
end;
procedure TDataColumn.FillDefaultFont;
begin
if (Assigned(Grid)) then
begin
FFont.Assign(Grid.Font);
end;
end;
procedure TDataColumn.FontChanged(Sender: TObject);
begin
ColumnChanged;
end;
function TDataColumn.GetDefaultValueChecked: string;
begin
Result := '1';
end;
function TDataColumn.GetDefaultValueUnchecked: string;
begin
Result := '0';
end;
constructor TDataColumn.Create(ACollection: TCollection);
begin
inherited Create(ACollection);
FFont := TFont.Create;
FFont.OnChange := @FontChanged;
FAlignment := taLeftJustify;
FColor := clWhite;
FDisplayMask := '';
FFormat := cfString;
FHint := '';
FName := '';
FTag := 0;
FTitle := '';
FUpdateCount := 0;
FValueChecked := GetDefaultValueChecked;
FValueUnchecked := GetDefaultValueUnchecked;
FVisible := True;
FWidth := 0;
FillDefaultFont;
end;
destructor TDataColumn.Destroy;
begin
FFont.Destroy;
FFont := nil;
inherited Destroy;
end;
procedure TDataColumn.Assign(Source: TPersistent);
var
VColumn: TDataColumn;
begin
if (Assigned(Source)) and (Source is TDataColumn) then
begin
BeginUpdate;
try
VColumn := TDataColumn(Source);
FAlignment := VColumn.Alignment;
FColor := VColumn.Color;
FDisplayMask := VColumn.DisplayMask;
FFont.Assign(VColumn.FFont);
FFormat := VColumn.Format;
FHint := VColumn.Hint;
FName := VColumn.Name;
FTag := VColumn.Tag;
FTitle := VColumn.Title;
FValueChecked := VColumn.ValueChecked;
FValueUnchecked := VColumn.ValueUnchecked;
FVisible := VColumn.Visible;
FWidth := VColumn.Width;
finally
EndUpdate;
end;
end
else
begin
inherited Assign(Source);
end;
end;
procedure TDataColumn.BeginUpdate;
begin
Inc(FUpdateCount);
end;
procedure TDataColumn.EndUpdate;
begin
if (FUpdateCount > 0) then
begin
Dec(FUpdateCount);
if (FUpdateCount = 0) then
begin
ColumnChanged;
end;
end;
end;
{ TDataColumns }
function TDataColumns.GetColumn(AIndex: NativeInt): TDataColumn;
begin
Result := TDataColumn(inherited Items[AIndex]);
end;
procedure TDataColumns.SetColumn(AIndex: NativeInt; AValue: TDataColumn);
begin
Items[AIndex].Assign(AValue);
end;
function TDataColumns.GetOwner: TPersistent;
begin
Result := FGrid;
end;
procedure TDataColumns.Update(AItem: TCollectionItem);
begin
FGrid.ColumnsChanged(TDataColumn(AItem));
end;
constructor TDataColumns.Create(AGrid: TCustomDataGrid);
begin
inherited Create(TDataColumn);
FGrid := AGrid;
end;
function TDataColumns.Add: TDataColumn;
begin
Result := TDataColumn(inherited Add);
end;
function TDataColumns.HasIndex(const AIndex: integer): boolean;
begin
Result := (Aindex > -1) and (AIndex < Count);
end;
{ TCustomDataGrid }
procedure TCustomDataGrid.SetColumnClickSorts(AValue: boolean);
begin
if (FColumnClickSorts <> AValue) then
begin
FColumnClickSorts := AValue;
end;
end;
procedure TCustomDataGrid.SetColumns(AValue: TDataColumns);
begin
FColumns.Assign(AValue);
end;
procedure TCustomDataGrid.SetDefColWidth(AValue: NativeInt);
begin
if (FDefColWidth <> AValue) then
begin
FDefColWidth := AValue;
end;
end;
procedure TCustomDataGrid.SetDefRowHeight(AValue: NativeInt);
begin
if (FDefRowHeight <> AValue) then
begin
FDefRowHeight := AValue;
end;
end;
procedure TCustomDataGrid.SetShowHeader(AValue: boolean);
begin
if (FShowHeader <> AValue) then
begin
FShowHeader := AValue;
end;
end;
procedure TCustomDataGrid.VisualChange;
begin
Invalidate;
end;
procedure TCustomDataGrid.ColumnsChanged(AColumn: TDataColumn);
begin
if (csDestroying in ComponentState) then
begin
exit;
end;
VisualChange;
end;
function TCustomDataGrid.CalcDefaultRowHeight: NativeInt;
begin
Result := Font.GetTextHeight('Fj') + 10;
end;
procedure TCustomDataGrid.Paint;
begin
inherited Paint;
if csDesigning in ComponentState then
begin
Canvas.Brush.Color := Color;
with Canvas do
begin
Pen.Style := psSolid;
Pen.Color := clBlack;
Brush.Style := bsClear;
Rectangle(0, 0, Self.Width - 1, Self.Height - 1);
Line(0, 0, Self.Width - 1, Self.Height - 1);
Line(Self.Width - 1, 0, 0, Self.Height - 1);
end;
Exit;
end;
end;
class function TCustomDataGrid.GetControlClassDefaultSize: TSize;
begin
Result.Cx := 200;
Result.Cy := 100;
end;
constructor TCustomDataGrid.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle - [csAcceptsControls];
with GetControlClassDefaultSize do
begin
SetInitialBounds(0, 0, CX, CY);
end;
FAutoCreateColumns := True;
FColumns := TDataColumns.Create(Self);
FColumnClickSorts := True;
FDefColWidth := -1;
FDefRowHeight := -1;
FShowHeader := True;
end;
destructor TCustomDataGrid.Destroy;
begin
FColumns.Destroy;
FColumns := nil;
inherited Destroy;
end;
{ TCustomPagination }
procedure TCustomPagination.SetCurrentPage(AValue: NativeInt);
begin
if (FCurrentPage <> AValue) then
begin
FCurrentPage := AValue;
Changed;
end;
end;
procedure TCustomPagination.SetRecordsPerPage(AValue: NativeInt);
begin
if (FRecordsPerPage <> AValue) then
begin
FRecordsPerPage := AValue;
Changed;
end;
end;
procedure TCustomPagination.SetTotalRecords(AValue: NativeInt);
begin
if (FTotalRecords <> AValue) then
begin
FTotalRecords := AValue;
Changed;
end;
end;
procedure TCustomPagination.Changed;
begin
CalculatePages;
end;
procedure TCustomPagination.CalculatePages;
begin
FTotalPages := Ceil64(FTotalRecords / FRecordsPerPage);
end;
procedure TCustomPagination.Paint;
begin
inherited Paint;
if csDesigning in ComponentState then
begin
Canvas.Brush.Color := Color;
with Canvas do
begin
Pen.Style := psSolid;
Pen.Color := clBlack;
Brush.Style := bsClear;
Rectangle(0, 0, Self.Width - 1, Self.Height - 1);
Line(0, 0, Self.Width - 1, Self.Height - 1);
Line(Self.Width - 1, 0, 0, Self.Height - 1);
end;
Exit;
end;
end;
class function TCustomPagination.GetControlClassDefaultSize: TSize;
begin
Result.Cx := 150;
Result.Cy := 30;
end;
constructor TCustomPagination.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle - [csAcceptsControls];
with GetControlClassDefaultSize do
begin
SetInitialBounds(0, 0, CX, CY);
end;
FCurrentPage := 1;
FRecordsPerPage := 10;
FTotalPages := 0;
FTotalRecords := 0;
end;
end.
| 24.512898 | 91 | 0.735236 |
8554b658c812a16a1bca4eb7db4eddf2400a9e80 | 53,437 | pas | Pascal | dependencies/Indy10/Protocols/IdFTPListOutput.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| null | null | null | dependencies/Indy10/Protocols/IdFTPListOutput.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| null | null | null | dependencies/Indy10/Protocols/IdFTPListOutput.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| null | null | null | {
$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.18 12/10/04 1:13:34 PM RLebeau
FormatDateTime() fixes. Was using 'mm' instead of 'nn' for minutes.
Rev 1.17 10/26/2004 9:36:26 PM JPMugaas
Updated ref.
Rev 1.16 10/26/2004 9:19:14 PM JPMugaas
Fixed references.
Rev 1.15 10/1/2004 6:17:12 AM JPMugaas
Removed some dead code.
Rev 1.14 6/27/2004 1:45:36 AM JPMugaas
Can now optionally support LastAccessTime like Smartftp's FTP Server could.
I also made the MLST listing object and parser support this as well.
Rev 1.13 6/11/2004 9:34:44 AM DSiders
Added "Do not Localize" comments.
Rev 1.12 4/19/2004 5:06:02 PM JPMugaas
Class rework Kudzu wanted.
Rev 1.11 2004.02.03 5:45:34 PM czhower
Name changes
Rev 1.10 24/01/2004 19:18:48 CCostelloe
Cleaned up warnings
Rev 1.9 1/4/2004 12:09:54 AM BGooijen
changed System.Delete to IdDelete
Rev 1.8 11/26/2003 6:23:44 PM JPMugaas
Quite a number of fixes for recursive dirs and a few other things that
slipped my mind.
Rev 1.7 10/19/2003 2:04:02 PM DSiders
Added localization comments.
Rev 1.6 3/11/2003 07:36:00 PM JPMugaas
Now reports permission denied in subdirs when doing recursive listts in Unix
export.
Rev 1.5 3/9/2003 12:01:26 PM JPMugaas
Now can report errors in recursive lists.
Permissions work better.
Rev 1.4 3/3/2003 07:18:34 PM JPMugaas
Now honors the FreeBSD -T flag and parses list output from a program using
it. Minor changes to the File System component.
Rev 1.3 2/26/2003 08:57:10 PM JPMugaas
Bug fix. The owner and group should be left-justified.
Rev 1.2 2/24/2003 07:24:00 AM JPMugaas
Now honors more Unix switches just like the old code and now work with the
NLIST command when emulating Unix. -A switch support added. Switches are
now in constants.
Rev 1.1 2/23/2003 06:19:42 AM JPMugaas
Now uses Classes instead of classes.
Rev 1.0 2/21/2003 06:51:46 PM JPMugaas
FTP Directory list output object for the FTP server.
}
unit IdFTPListOutput;
interface
{$i IdCompilerDefines.inc}
uses
Classes,
IdGlobal,
IdFTPList;
type
// we can't use the standard FTP MLSD option types in the FTP Server
// because we support some minimal things that the user can't set.
// We have the manditory items to make it harder for the user to mess up.
TIdFTPFactOutput = (ItemType, Modify, Size, Perm, Unique, UnixMODE, UnixOwner,
UnixGroup, CreateTime, LastAccessTime, WinAttribs,WinDriveType,WinDriveLabel);
TIdFTPFactOutputs = set of TIdFTPFactOutput;
TIdDirOutputFormat = (doUnix, doWin32, doEPLF);
TIdFTPListOutputItem = class(TIdFTPListItem)
protected
FLinkCount: Integer;
FGroupName: string;
FOwnerName : String;
FLinkedItemName : string;
FNumberBlocks : Integer;
FInode : Integer;
FLastAccessDate: TDateTime;
FLastAccessDateGMT: TDateTime;
FCreationDate: TDateTime;
FCreationDateGMT : TDateTime;
//Unique ID for an item to prevent yourself from downloading something twice
FUniqueID : String;
//MLIST things
FMLISTPermissions : String;
FUnixGroupPermissions: string;
FUnixOwnerPermissions: string;
FUnixOtherPermissions: string;
FUnixinode : Integer;
FWinAttribs : UInt32;
//an error has been reported in the DIR listing itself for an item
FDirError : Boolean;
FWinDriveType : Integer;
FWinDriveLabel : String;
public
constructor Create(AOwner: TCollection); override;
property NumberBlocks : Integer read FNumberBlocks write FNumberBlocks;
property Inode : Integer read FInode write FInode;
//Last Access time values are for MLSD data output and can be returned by the MLST command
property LastAccessDate: TDateTime read FLastAccessDate write FLastAccessDate;
property LastAccessDateGMT : TDateTime read FLastAccessDateGMT write FLastAccessDateGMT;
//Creation time values are for MLSD data output and can be returned by the MLST command
property CreationDate: TDateTime read FCreationDate write FCreationDate;
property CreationDateGMT : TDateTime read FCreationDateGMT write FCreationDateGMT;
// If this is not blank, you can use this as a unique identifier for an item to prevent
// yourself from downloading the same item twice (which is not easy to see with some
// some FTP sites where symbolic links or similar things are used.
//Valid only with EPLF and MLST
property UniqueID : string read FUniqueID write FUniqueID;
//Creation time values are for MLSD data output and can be returned by the
//the MLSD parser in some cases
property ModifiedDateGMT;
//Windows NT File Attributes (just like what is reported by RaidenFTPD
//BlackMoon FTP Server, and Serv-U
//On the server side, you deal with it as a number right from the Win32 FindFirst,
//FindNext functions. Easy
property WinAttribs : UInt32 read FWinAttribs write FWinAttribs;
property WinDriveType : Integer read FWinDriveType write FWinDriveType;
property WinDriveLabel : String read FWinDriveLabel write FWinDriveLabel;
//MLIST Permissions
property MLISTPermissions : string read FMLISTPermissions write FMLISTPermissions;
property UnixOwnerPermissions: string read FUnixOwnerPermissions write FUnixOwnerPermissions;
property UnixGroupPermissions: string read FUnixGroupPermissions write FUnixGroupPermissions;
property UnixOtherPermissions: string read FUnixOtherPermissions write FUnixOtherPermissions;
property LinkCount: Integer read FLinkCount write FLinkCount;
property OwnerName: string read FOwnerName write FOwnerName;
property GroupName: string read FGroupName write FGroupName;
property LinkedItemName : string read FLinkedItemName write FLinkedItemName;
property DirError : Boolean read FDirError write FDirError;
end;
TIdFTPListOutput = class(TCollection)
protected
FSwitches : String;
FOutput : String;
FDirFormat : TIdDirOutputFormat;
FExportTotalLine : Boolean;
function GetLocalModTime(AItem : TIdFTPListOutputItem) : TDateTime; virtual;
function HasSwitch(const ASwitch: String): Boolean;
function UnixItem(AItem : TIdFTPListOutputItem) : String; virtual;
function Win32Item(AItem : TIdFTPListOutputItem) : String; virtual;
function EPLFItem(AItem : TIdFTPListOutputItem) : String; virtual;
function NListItem(AItem : TIdFTPListOutputItem) : String; virtual;
function MListItem(AItem : TIdFTPListOutputItem; AMLstOpts : TIdFTPFactOutputs) : String; virtual;
procedure InternelOutputDir(AOutput : TStrings; ADetails : Boolean = True); virtual;
function UnixINodeOutput(AItem : TIdFTPListOutputItem) : String;
function UnixBlocksOutput(AItem : TIdFTPListOutputItem) : String;
function UnixGetOutputOwner(AItem : TIdFTPListOutputItem) : String;
function UnixGetOutputGroup(AItem : TIdFTPListOutputItem) : String;
function UnixGetOutputOwnerPerms(AItem : TIdFTPListOutputItem) : String;
function UnixGetOutputGroupPerms(AItem : TIdFTPListOutputItem) : String;
function UnixGetOutputOtherPerms(AItem : TIdFTPListOutputItem) : String;
function GetItems(AIndex: Integer): TIdFTPListOutputItem;
procedure SetItems(AIndex: Integer; const AValue: TIdFTPListOutputItem);
public
function Add: TIdFTPListOutputItem;
constructor Create; reintroduce;
function IndexOf(AItem: TIdFTPListOutputItem): Integer;
property Items[AIndex: Integer]: TIdFTPListOutputItem read GetItems write SetItems; default;
procedure LISTOutputDir(AOutput : TStrings); virtual;
procedure MLISTOutputDir(AOutput : TStrings; AMLstOpts : TIdFTPFactOutputs); virtual;
procedure NLISTOutputDir(AOutput : TStrings); virtual;
property DirFormat : TIdDirOutputFormat read FDirFormat write FDirFormat;
property Switches : String read FSwitches write FSwitches;
property Output : String read FOutput write FOutput;
property ExportTotalLine : Boolean read FExportTotalLine write FExportTotalLine;
end;
const
DEF_FILE_OWN_PERM = 'rw-'; {do not localize}
DEF_FILE_GRP_PERM = DEF_FILE_OWN_PERM;
DEF_FILE_OTHER_PERM = 'r--'; {do not localize}
DEF_DIR_OWN_PERM = 'rwx'; {do not localize}
DEF_DIR_GRP_PERM = DEF_DIR_OWN_PERM;
DEF_DIR_OTHER_PERM = 'r-x'; {do not localize}
DEF_OWNER = 'root'; {do not localize}
{NLIST and LIST switches - based on /bin/ls }
{
Note that the standard Unix form started simply by Unix
FTP deamons piping output from the /bin/ls program for both
the NLIST and LIST FTP commands. The standard /bin/ls
program has several standard switches that allow the output
to be customized. For our output, we wish to emulate this behavior.
Microsoft IIS even honors a subset of these switches dealing sort order
and recursive listings. It does not honor some sort-by-switches although
we honor those in Win32 (hey, we did MS one better, not that it says much though.
}
const
{format switches - used by Unix mode only}
SWITCH_COLS_ACCROSS = 'x';
SWITCH_COLS_DOWN = 'C';
SWITCH_ONE_COL = '1';
SWITCH_ONE_DIR = 'f';
SWITCH_COMMA_STREAM = 'm';
SWITCH_LONG_FORM = 'l';
{recursive for both Win32 and Unix forms}
SWITCH_RECURSIVE = 'R';
{sort switches - used both by Win32 and Unix forms}
SWITCH_SORT_REVERSE = 'r';
SWITCH_SORTBY_MTIME = 't';
SWITCH_SORTBY_CTIME = 'u';
SWITCH_SORTBY_EXT = 'X';
SWITCH_SORTBY_SIZE = 'S';
{Output switches for Unix mode only}
SWITCH_CLASSIFY = 'F';
//
{ -F Put aslash (/) aftereach filename if the file is a directory, an
asterisk (*) if the file is executable, an equal sign(=) if the
file is an AF_UNIX address family socket, andan ampersand (@) if
the file is asymbolic link.Unless the -H option isalso used,
symbolic links are followed to see ifthey might be adirectory; see
above.
From:
http://www.mcsr.olemiss.edu/cgi-bin/man-cgi?ls+1 }
SWITCH_SLASHDIR = 'p';
SWITCH_QUOTEDNAME = 'Q';
SWITCH_PRINT_BLOCKS = 's';
SWITCH_PRINT_INODE = 'i';
SWITCH_SHOW_ALLPERIOD = 'a'; //show all entries even ones with a pariod starting the filename/hidden
//note that anything starting with a period is shown except for the .. and . entries for security reasons
SWITCH_HIDE_DIRPOINT = 'A'; //hide the "." and ".." entries
SWITCH_BOTH_TIME_YEAR = 'T'; //This is used by FTP Voyager with a Serv-U FTP Server to both
//a time and year in the FTP list. Note that this does conflict with a ls -T flag used to specify a column size
//on Linux but in FreeBSD, the -T flag is also honored.
implementation
uses
//facilitate inlining only.
IdException,
{$IFDEF DOTNET}
{$IFDEF USE_INLINE}
System.IO,
{$ENDIF}
{$ENDIF}
{$IFDEF VCL_XE3_OR_ABOVE}
{$IFNDEF NEXTGEN}
System.Contnrs,
{$ENDIF}
System.Types,
{$ENDIF}
{$IFDEF USE_VCL_POSIX}
Posix.SysTime,
{$ENDIF}
IdContainers, IdFTPCommon, IdGlobalProtocols, IdStrings, SysUtils;
type
{$IFDEF HAS_GENERICS_TObjectList}
TDirEntry = class;
TDirEntryList = TIdObjectList<TDirEntry>;
{$ELSE}
// TODO: flesh out to match TIdObjectList<TDirEntry> for non-Generics compilers
TDirEntryList = TIdObjectList;
{$ENDIF}
TDirEntry = class(TObject)
protected
FPathName : String;
FDirListItem : TIdFTPListOutputItem;
FSubDirs : TDirEntryList;
FFileList : TIdBubbleSortStringList;
public
constructor Create(const APathName : String; ADirListItem : TIdFTPListOutputItem);
destructor Destroy; override;
// procedure Sort(ACompare: TIdSortCompare;const Recurse : Boolean = True);
procedure SortAscendFName;
procedure SortDescendFName;
procedure SortAscendMTime;
procedure SortDescendMTime;
procedure SortAscendSize;
procedure SortDescendSize;
procedure SortAscendFNameExt;
procedure SortDescendFNameExt;
function AddSubDir(const APathName : String; ADirEnt : TIdFTPListOutputItem) : Boolean;
function AddFileName(const APathName : String; ADirEnt : TIdFTPListOutputItem) : Boolean;
property SubDirs : TDirEntryList read FSubDirs;
property FileList : TIdBubbleSortStringList read FFileList;
property PathName : String read FPathName;
property DirListItem : TIdFTPListOutputItem read FDirListItem;
end;
function RawSortAscFName(AItem1, AItem2: TIdFTPListItem; const ASubDirs : Boolean = True): Integer;
var
{
> 0 (positive) Item1 is less than Item2
= 0 Item1 is equal to Item2
< 0 (negative) Item1 is greater than Item2
}
LTmpPath1, LTmpPath2 : String;
LPath1Dot, LPath2Dot : Boolean;
begin
LTmpPath1 := IndyGetFileName(AItem1.FileName);
LTmpPath2 := IndyGetFileName(AItem2.FileName);
//periods are always greater then letters in dir lists
LPath1Dot := TextStartsWith(LTmpPath1, '.');
LPath2Dot := TextStartsWith(LTmpPath2, '.');
if LPath1Dot and LPath2Dot then begin
if (LTmpPath1 = CUR_DIR) and (LTmpPath2 = PARENT_DIR) then begin
Result := 1;
Exit;
end;
if (LTmpPath2 = CUR_DIR) and (LTmpPath1 = PARENT_DIR) then begin
Result := -1;
Exit;
end;
if (LTmpPath2 = CUR_DIR) and (LTmpPath1 = CUR_DIR) then begin
Result := 0;
Exit;
end;
if (LTmpPath2 = PARENT_DIR) and (LTmpPath1 = PARENT_DIR) then begin
Result := 0;
Exit;
end;
end;
if LPath2Dot and (not LPath1Dot) then begin
Result := -1;
Exit;
end;
if LPath1Dot and (not LPath2Dot) then begin
Result := 1;
Exit;
end;
Result := -IndyCompareStr(LTmpPath1, LTmpPath2);
end;
function RawSortDescFName(AItem1, AItem2: TIdFTPListItem): Integer;
begin
Result := -RawSortAscFName(AItem1, AItem2);
end;
function RawSortAscFNameExt(AItem1, AItem2: TIdFTPListItem; const ASubDirs : Boolean = True): Integer;
var
{
> 0 (positive) Item1 is less than Item2
= 0 Item1 is equal to Item2
< 0 (negative) Item1 is greater than Item2
}
LTmpPath1, LTmpPath2 : String;
begin
LTmpPath1 := ExtractFileExt(AItem1.FileName);
LTmpPath2 := ExtractFileExt(AItem2.FileName);
Result := -IndyCompareStr(LTmpPath1, LTmpPath2);
if Result = 0 then begin
Result := RawSortAscFName(AItem1, AItem2);
end;
end;
function RawSortDescFNameExt(AItem1, AItem2: TIdFTPListItem): Integer;
begin
Result := -RawSortAscFNameExt(AItem1, AItem2, False);
end;
function RawSortAscMTime(AItem1, AItem2: TIdFTPListItem): Integer;
{
> 0 (positive) Item1 is less than Item2
0 Item1 is equal to Item2
< 0 (negative) Item1 is greater than Item2
}
begin
if AItem1.ModifiedDate < AItem2.ModifiedDate then begin
Result := -1;
end
else if AItem1.ModifiedDate > AItem2.ModifiedDate then begin
Result := 1;
end
else begin
Result := RawSortAscFName(AItem1, AItem2);
end;
end;
function RawSortDescMTime(AItem1, AItem2: TIdFTPListItem): Integer;
begin
Result := -RawSortAscMTime(AItem1, AItem2);
end;
function RawSortAscSize(AItem1, AItem2: TIdFTPListItem; const ASubDirs : Boolean = True): Integer;
var
LSize1, LSize2 : Int64;
{
> 0 (positive) Item1 is less than Item2
= 0 Item1 is equal to Item2
< 0 (negative) Item1 is greater than Item2
}
begin
LSize1 := AItem1.Size;
LSize2 := AItem2.Size;
if TIdFTPListOutput(AItem1.Collection).DirFormat = doUnix then begin
if AItem1.ItemType = ditDirectory then begin
LSize1 := UNIX_DIR_SIZE;
end;
if AItem2.ItemType = ditDirectory then begin
LSize2 := UNIX_DIR_SIZE;
end;
end;
if LSize1 < LSize2 then begin
Result := -1;
end
else if LSize1 > LSize2 then begin
Result := 1;
end else begin
Result := RawSortAscFName (AItem1, AItem2);
end;
end;
function RawSortDescSize(AItem1, AItem2: TIdFTPListItem): Integer;
begin
Result := -RawSortAscSize(AItem1, AItem2, False);
end;
{DirEntry objects}
function DESortAscFName(AItem1, AItem2: TDirEntry): Integer;
begin
Result := -IndyCompareStr(AItem1.PathName, AItem2.PathName);
end;
function DESortAscMTime(AItem1, AItem2: TDirEntry): Integer;
var
L1, L2 : TIdFTPListItem;
{
> 0 (positive) Item1 is less than Item2
= 0 Item1 is equal to Item2
< 0 (negative) Item1 is greater than Item2
}
begin
L1 := AItem1.DirListItem;
L2 := AItem2.DirListItem;
if L1.ModifiedDate > L2.ModifiedDate then begin
Result := -1;
end
else if L1.ModifiedDate < L2.ModifiedDate then begin
Result := 1;
end else begin
Result := DESortAscFName(AItem1, AItem2);
end;
end;
function DESortDescMTime(AItem1, AItem2: TDirEntry): Integer;
begin
Result := -DESortAscMTime(AItem1, AItem2);
end;
function DESortDescFName(AItem1, AItem2: TDirEntry): Integer;
begin
Result := -DESortAscFName(AItem1, AItem2);
end;
{stringlist objects}
function StrSortAscMTime(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := RawSortAscMTime(
TIdFTPListItem(List.Objects[Index1]),
TIdFTPListItem(List.Objects[Index2]));
end;
function StrSortDescMTime(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := RawSortDescMTime(
TIdFTPListItem(List.Objects[Index1]),
TIdFTPListItem(List.Objects[Index2]));
end;
function StrSortAscSize(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := RawSortAscSize(
TIdFTPListItem(List.Objects[Index1]),
TIdFTPListItem(List.Objects[Index2]));
end;
function StrSortDescSize(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := RawSortDescSize(
TIdFTPListItem(List.Objects[Index1]),
TIdFTPListItem(List.Objects[Index2]));
end;
function StrSortAscFName(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := RawSortAscFName(
TIdFTPListItem(List.Objects[Index1]),
TIdFTPListItem(List.Objects[Index2]));
end;
function StrSortDescFName(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := RawSortDescFName(
TIdFTPListItem(List.Objects[Index1]),
TIdFTPListItem(List.Objects[Index2]));
end;
function StrSortAscFNameExt(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := RawSortAscFNameExt(
TIdFTPListItem(List.Objects[Index1]),
TIdFTPListItem(List.Objects[Index2]));
end;
function StrSortDescFNameExt(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := RawSortDescFNameExt(
TIdFTPListItem(List.Objects[Index1]),
TIdFTPListItem(List.Objects[Index2]));
end;
{ TIdFTPListOutput }
function TIdFTPListOutput.Add: TIdFTPListOutputItem;
begin
Result := TIdFTPListOutputItem(inherited Add);
end;
constructor TIdFTPListOutput.Create;
begin
inherited Create(TIdFTPListOutputItem);
FDirFormat := doUnix;
end;
function TIdFTPListOutput.EPLFItem(AItem: TIdFTPListOutputItem): String;
var
LFileName : String;
begin
LFileName := IndyGetFileName(AItem.FileName);
if AItem.ModifiedDateGMT > EPLF_BASE_DATE then begin
Result := '+m' + GMTDateTimeToEPLFDate(AItem.ModifiedDateGMT);
end
else if AItem.ModifiedDate > EPLF_BASE_DATE then begin
Result := '+m'+LocalDateTimeToEPLFDate(AItem.ModifiedDate);
end else begin
Result := '';
end;
if AItem.ItemType = ditFile then begin
Result := Result + ',r';
end else begin
Result := Result + ',/';
end;
Result := Result + ',s' + IntToStr(AItem.Size);
Result := Result + #9 + LFileName;
end;
function TIdFTPListOutput.GetItems(AIndex: Integer): TIdFTPListOutputItem;
begin
Result := TIdFTPListOutputItem(inherited GetItem(AIndex));
end;
function TIdFTPListOutput.GetLocalModTime(AItem: TIdFTPListOutputItem): TDateTime;
begin
if AItem.ModifiedDateGMT <> 0 then begin
Result := AItem.ModifiedDateGMT - TimeZoneBias;
end else begin
Result := AItem.ModifiedDate;
end;
end;
function TIdFTPListOutput.HasSwitch(const ASwitch: String): Boolean;
begin
Result := IndyPos(ASwitch, Switches) > 0;
end;
function TIdFTPListOutput.IndexOf(AItem: TIdFTPListOutputItem): Integer;
var
i : Integer;
begin
Result := -1;
for i := 0 to Count - 1 do begin
if AItem = Items[i] then begin
Result := i;
Exit;
end;
end;
end;
procedure TIdFTPListOutput.InternelOutputDir(AOutput: TStrings; ADetails: Boolean);
type
TIdDirOutputType = (doColsAccross, doColsDown, doOneCol, doOnlyDirs, doComma, doLong);
var
i : Integer;
//note we use this for sorting pathes with recursive dirs
LRootPath : TDirEntry;
LShowNavSym : BOolean;
function DetermineOp : TIdDirOutputType;
//we do things this way because the last switch in a mutually exclusive set
//always takes precidence over the others.
var
LStopScan : Boolean;
li : Integer;
begin
if ADetails then begin
Result := doLong;
end else begin
Result := doOneCol;
end;
if DirFormat <> doUnix then begin
Exit;
end;
LStopScan := False;
for li := Length(Switches) downto 1 do begin
case Switches[li] of
SWITCH_COLS_ACCROSS :
begin
Result := doColsAccross;
LStopScan := True;
end;
SWITCH_COLS_DOWN :
begin
Result := doColsDown;
LStopScan := True;
end;
SWITCH_ONE_COL :
begin
Result := doOneCol;
LStopScan := True;
end;
SWITCH_ONE_DIR :
begin
Result := doOnlyDirs;
LStopScan := True;
end;
SWITCH_COMMA_STREAM :
begin
Result := doComma;
LStopScan := True;
end;
SWITCH_LONG_FORM :
begin
Result := doLong;
LStopScan := True;
end;
end;
if LStopScan then begin
Break;
end;
end;
end;
procedure PrintSubDirHeader(ARoot, ACurDir : TDirEntry; ALOutput : TStrings; const Recurse : Boolean = False);
var
LUnixPrependPath : Boolean;
begin
LUnixPrependPath := HasSwitch(SWITCH_SORT_REVERSE) or HasSwitch(SWITCH_SORTBY_MTIME) or (DetermineOp <> doLong);
if (ACurDir <> ARoot) or LUnixPrependPath then begin
//we don't want an empty line to start the list
if ACurDir <> ARoot then begin
ALOutput.Add('');
end;
if DirFormat = doWin32 then begin
ALOutput.Add(MS_DOS_CURDIR + UnixPathToDOSPath(ACurDir.PathName) + ':');
end
else if LUnixPrependPath then begin
if ACurDir = ARoot then begin
ALOutput.Add(CUR_DIR + ':');
end else begin
ALOutput.Add(UNIX_CURDIR + DOSPathToUnixPath(ACurDir.PathName) + ':');
end;
end else begin
ALOutput.Add(DOSPathToUnixPath(ACurDir.PathName) + ':');
end;
end;
end;
procedure ProcessOnePathCol(ARoot, ACurDir : TDirEntry; ALOutput : TStrings; const Recurse : Boolean = False);
var
li : Integer;
LCurItem : TIdFTPListOutputItem;
begin
if Recurse and Assigned(ACurDir.SubDirs) then begin
if Recurse then begin
PrintSubDirHeader(ARoot, ACurDir, ALOutput, Recurse);
end;
end;
for li := 0 to ACurDir.FileList.Count-1 do begin
ALOutput.Add(NListItem(TIdFTPListOutputItem(ACurDir.FileList.Objects[li])));
end;
if Recurse and Assigned(ACurDir.SubDirs) then begin
for li := 0 to ACurDir.SubDirs.Count-1 do begin
LCurItem := TDirEntry(ACurDir.SubDirs[li]).DirListItem;
if LCurItem.DirError then begin
if li = 0 then begin
ALOutput.Add('');
end;
ALOutput.Add(IndyFormat('/bin/ls: %s: Permission denied', [LCurItem.FileName])); {do not localize}
end else begin
ProcessOnePathCol(ARoot, TDirEntry(ACurDir.SubDirs[li]), ALOutput, Recurse);
end;
end;
end;
end;
function CalcMaxLen(ARoot, ACurDir : TDirEntry; ALOutput : TStrings; const Recurse : Boolean = False) : Integer;
var
LEntryMaxLen : Integer;
li : Integer;
begin
Result := 0;
for li := 0 to ACurDir.FileList.Count-1 do begin
LEntryMaxLen := Length(NListItem(TIdFTPListOutputItem(ACurDir.FileList.Objects[li])));
if LEntryMaxLen > Result then begin
Result := LEntryMaxLen;
end;
end;
if Recurse and Assigned(ACurDir.SubDirs) then begin
for li := 0 to ACurDir.SubDirs.Count-1 do begin
LEntryMaxLen := CalcMaxLen(ARoot, TDirEntry(ACurDir.SubDirs[li]), ALOutput, Recurse);
if LEntryMaxLen > Result then begin
Result := LEntryMaxLen;
end;
end;
end;
end;
procedure ProcessPathAccross(ARoot, ACurDir : TDirEntry; ALOutput : TStrings; const Recurse : Boolean = False);
var
li, j : Integer;
LTmp : String;
LMaxLen : Integer;
LCols : Integer;
LCurItem : TIdFTPListOutputItem;
begin
if ACurDir.FileList.Count = 0 then begin
Exit;
end;
//Note that we will assume a console width of 80 and we don't want something to wrap
//causing a blank line
LMaxLen := CalcMaxLen(ARoot, ACurDir, ALOutput, Recurse);
//if more than 39, we probably are going to exceed the width of the screen,
//just treat as one column
if LMaxLen > 39 then begin
ProcessOnePathCol(ARoot, ACurDir, ALOutput, Recurse);
Exit;
end;
if Recurse and Assigned(ACurDir.SubDirs) then begin
if Recurse then begin
PrintSubDirHeader(ARoot, ACurDir, ALOutput, Recurse);
end;
end;
LCols := 79 div (LMaxLen + 2);//2 spaces between columns
j := 0;
repeat
LTmp := '';
for li := 0 to LCols -1 do begin
LTmp := LTmp + PadString(NListItem(TIdFTPListOutputItem(ACurDir.FileList.Objects[j])), LMaxLen, ' ') + ' ';
Inc(j);
if j = ACurDir.FileList.Count then begin
Break;
end;
end;
ALOutput.Add(TrimRight(LTmp));
until j = ACurDir.FileList.Count;
if Recurse and Assigned(ACurDir.SubDirs) then begin
for li := 0 to ACurDir.SubDirs.Count-1 do begin
LCurItem := TDirEntry(ACurDir.SubDirs[li]).DirListItem;
if LCurItem.DirError then begin
if li = 0 then begin
ALOutput.Add('');
end;
ALOutput.Add(IndyFormat('/bin/ls: %s: Permission denied', [LCurItem.FileName])); {do not localize}
end else begin
ProcessPathAccross(ARoot, TDirEntry(ACurDir.SubDirs[li]), ALOutput, Recurse);
end;
end;
end;
end;
procedure ProcessPathDown(ARoot, ACurDir : TDirEntry; ALOutput : TStrings; const Recurse : Boolean = False);
var
li, j : Integer;
LTmp : String;
LMaxLen : Integer;
LCols : Integer;
LLines : Integer;
// LFrm : String;
LCurItem : TIdFTPListOutputItem;
begin
if ACurDir.FileList.Count = 0 then begin
Exit;
end;
//Note that we will assume a console width of 80 and we don't want something to wrap
//causing a blank line
LMaxLen := CalcMaxLen(ARoot, ACurDir, ALOutput, Recurse);
//if more than 39, we probably are going to exceed the width of the screen,
//just treat as one column
if LMaxLen > 39 then begin
ProcessOnePathCol(ARoot, ACurDir, ALOutput, Recurse);
Exit;
end;
if Recurse and Assigned(ACurDir.SubDirs) then begin
if Recurse then begin
PrintSubDirHeader(ARoot, ACurDir, ALOutput, Recurse);
end;
end;
LCols := 79 div (LMaxLen + 2);//2 spaces between columns
LLines := ACurDir.FileList.COunt div LCols;
//LFrm := '%' + IntToStr(LMaxLen+2) + 's';
if (ACurDir.FileList.COunt mod LCols) > 0 then begin
Inc(LLines);
end;
for li := 1 to LLines do begin
j := 0;
LTmp := '';
repeat
if ((li-1)+(LLInes*j)) < ACurDir.FileList.Count then begin
LTmp := LTmp + PadString(NListItem(TIdFTPListOutputItem(ACurDir.FileList.Objects[(li-1)+(LLInes*j)])), LMaxLen, ' ') + ' ';
end;
Inc(j);
until (j > LCols);
ALOutput.Add(TrimRight(LTmp));
end;
if Recurse and Assigned(ACurDir.SubDirs) then begin
for li := 0 to ACurDir.SubDirs.Count -1 do begin
LCurItem := TDirEntry(ACurDir.SubDirs[li]).DirListItem;
if LCurItem.DirError then begin
if li = 0 then begin
ALOutput.Add('');
end;
ALOutput.Add(IndyFormat('/bin/ls: %s: Permission denied', [LCurItem.FileName])); {do not localize}
end else begin
ProcessPathAccross(ARoot, TDirEntry(ACurDir.SubDirs[li]), ALOutput, Recurse);
end;
end;
end;
end;
procedure ProcessPathComma(ARoot, ACurDir : TDirEntry; ALOutput : TStrings; const Recurse : Boolean = False);
var
li : Integer;
LTmp : String;
LCurItem : TIdFTPListOutputItem;
begin
if Recurse then begin
PrintSubDirHeader(ARoot, ACurDir, ALOutput, Recurse);
end;
LTmp := '';
for li := 0 to ACurDir.FileList.Count -1 do begin
LTmp := LTmp + NListItem(TIdFTPListOutputItem(ACurDir.FileList.Objects[li])) + ', ';
end;
IdDelete(LTmp, Length(LTmp)-1, 2);
ALOutput.Text := ALOutput.Text + IndyWrapText(LTmp, EOL + ' ', LWS + ',' , 79); //79 good maxlen for text only terminals
if Recurse and Assigned(ACurDir.SubDirs) then begin
for li := 0 to ACurDir.SubDirs.Count -1 do begin
LCurItem := TDirEntry(ACurDir.SubDirs[li]).DirListItem;
if LCurItem.DirError then begin
if li = 0 then begin
ALOutput.Add('');
end;
ALOutput.Add(IndyFormat('/bin/ls: %s: Permission denied', [LCurItem.FileName])); {do not localize}
end else begin
ProcessPathComma(ARoot, TDirEntry(ACurDir.SubDirs[li]), ALOutput, Recurse);
end;
end;
end;
end;
procedure ProcessPathLong(ARoot, ACurDir : TDirEntry; ALOutput : TStrings; const Recurse : Boolean = False);
var
li : Integer;
LBlockCount : Integer;
LCurItem : TIdFTPListOutputItem;
begin
if Recurse then begin
PrintSubDirHeader(ARoot, ACurDir, ALOutput, Recurse);
end;
if (DirFormat = doUnix) and ExportTotalLine then begin
LBlockCount := 0;
for li := 0 to ACurDir.FileList.Count-1 do begin
LBlockCount := LBlockCount + TIdFTPListOutputItem(ACurDir.FileList.Objects[li]).NumberBlocks;
end;
ALOutput.Add(IndyFormat('total %d', [LBlockCount])); {Do not translate}
end;
for li := 0 to ACurDir.FileList.Count-1 do begin
LCurItem := TIdFTPListOutputItem(ACurDir.FileList.Objects[li]);
case DirFormat of
doEPLF : ALOutput.Add(EPLFItem(LCurItem));
doWin32 : ALOutput.Add(Win32Item(LCurItem));
else
ALOutput.Add(UnixItem(LCurItem));
end;
end;
if Recurse and Assigned(ACurDir.SubDirs) then begin
for li := 0 to ACurDir.SubDirs.Count-1 do begin
LCurItem := TDirEntry(ACurDir.SubDirs[li]).DirListItem;
if LCurItem.DirError then begin
if DirFormat = doUnix then begin
if li = 0 then begin
ALOutput.Add('');
end;
ALOutput.Add(IndyFormat('/bin/ls: %s: Permission denied', [LCurItem.FileName])); {do not localize}
end;
end;
ProcessPathLong(ARoot, TDirEntry(ACurDir.SubDirs[li]), ALOutput, Recurse);
end;
end;
end;
procedure DoUnixfParam(ARoot : TDirEntry; ALOutput : TStrings);
var
li : Integer;
LIt : TIdFTPListItem;
begin
for li := 0 to ARoot.FileList.Count -1 do begin
LIt := TIdFTPListItem(ARoot.FileList.Objects[li]);
if LIt.ItemType = ditDirectory then begin
ALOutput.Add(IndyGetFileName(LIt.FileName));
end;
end;
end;
begin
LShowNavSym := (DirFormat = doUnix) and HasSwitch(SWITCH_SHOW_ALLPERIOD);
if LShowNavSym then begin
LShowNavSym := not HasSwitch(SWITCH_HIDE_DIRPOINT);
end;
LRootPath := TDirEntry.Create('', nil);
try
for i := 0 to Count-1 do
begin
if Items[i].ItemType in [ditDirectory, ditSymbolicLinkDir] then begin
if not IsNavPath(StripInitPathDelim(IndyGetFileName(Items[i].FileName))) then begin
LRootPath.AddSubDir(StripInitPathDelim(Items[i].FileName), Items[i]);
end else begin
//if it's a "." or "..", we show it only in Unix mode and only with eht -a switch
if LShowNavSym then begin
LRootPath.AddFileName(StripInitPathDelim(Items[i].FileName), Items[i]);
end;
end;
end;
end;
//add the file names
for i := 0 to Count-1 do begin
if Items[i].ItemType in [ditFile, ditSymbolicLink] then begin
if IsNavPath(StripInitPathDelim(IndyGetFileName(Items[i].FileName))) then begin
if LShowNavSym then begin
LRootPath.AddFileName(StripInitPathDelim(Items[i].FileName), Items[i]);
end;
end else begin
LRootPath.AddFileName(StripInitPathDelim(Items[i].FileName), Items[i]);
end;
end;
end;
//Note that Indy does not support a Last Access time in some file systems
//so we use the u parameter to mean the same as the t parameter
if HasSwitch(SWITCH_SORT_REVERSE) then begin
if HasSwitch(SWITCH_SORTBY_MTIME) or HasSwitch(SWITCH_SORTBY_CTIME) then begin
LRootPath.SortDescendMTime;
end
else if HasSwitch(SWITCH_SORTBY_EXT) then begin
LRootPath.SortDescendFNameExt;
end
else if HasSwitch(SWITCH_SORTBY_SIZE) then begin
LRootPath.SortDescendSize;
end
else begin
LRootPath.SortDescendFName;
end;
end
else if HasSwitch(SWITCH_SORTBY_MTIME) or HasSwitch(SWITCH_SORTBY_CTIME) then begin
LRootPath.SortAscendMTime;
end
else if HasSwitch(SWITCH_SORTBY_EXT) then begin
LRootPath.SortAscendFNameExt;
end
else if HasSwitch(SWITCH_SORTBY_SIZE) then begin
LRootPath.SortAscendSize;
end
else begin
LRootPath.SortAscendFName;
end;
//select the operation
// do the selected output operation
case DetermineOp of
doColsAccross : ProcessPathAccross(LRootPath, LRootPath, AOutput, HasSwitch(SWITCH_RECURSIVE));
doColsDown : ProcessPathDown(LRootPath, LRootPath, AOutput, HasSwitch(SWITCH_RECURSIVE));
doOneCol : ProcessOnePathCol(LRootPath, LRootPath, AOutput, HasSwitch(SWITCH_RECURSIVE));
doOnlyDirs : DoUnixfParam(LRootPath, AOutput);
doComma : ProcessPathComma(LRootPath, LRootPath, AOutput, HasSwitch(SWITCH_RECURSIVE));
else
ProcessPathLong(LRootPath, LRootPath, AOutput, HasSwitch(SWITCH_RECURSIVE));
end;
finally
FreeAndNil(LRootPath);
end;
end;
procedure TIdFTPListOutput.LISTOutputDir(AOutput: TStrings);
begin
InternelOutputDir(AOutput, True);
end;
function TIdFTPListOutput.MListItem(AItem: TIdFTPListOutputItem; AMLstOpts: TIdFTPFactOutputs): String;
begin
Result := '';
if AMLstOpts = [] then begin
Result := AItem.FileName;
Exit;
end;
if (Size in AMLstOpts) and AItem.SizeAvail then begin
Result := 'size=' + IntToStr(AItem.Size) + ';'; {do not localize}
end;
if ItemType in AMLstOpts then begin
Result := Result + 'type='; {do not localize}
case AItem.ItemType of
ditFile :
begin
Result := Result + 'file;'; {do not localize}
end;
ditDirectory :
begin
if AItem.FileName = '..' then begin {do not localize}
Result := Result + 'pdir;'; {do not localize}
end
else if AItem.FileName = '.' then begin
Result := Result + 'cdir;'; {do not localize}
end
else begin
Result := Result + 'dir;'; {do not localize}
end;
end;
ditSymbolicLink :
begin
Result := Result + 'OS.unix=slink:' + AItem.FileName + ';'; {do not localize}
end;
end;
end;
if Perm in AMLstOpts then begin
Result := Result + 'perm=' + AItem.MLISTPermissions + ';'; {do not localize}
end;
if (winDriveType in AMLstOpts) and (AItem.WinDriveType<>-1) then begin
Result := Result + 'win32.dt='+IntToStr(AItem.WinDriveType )+';';
end;
if CreateTime in AMLstOpts then begin
if AItem.CreationDateGMT <> 0 then begin
Result := Result + 'create='+ FTPGMTDateTimeToMLS(AItem.CreationDateGMT) + ';'; {do not localize}
end
else if AItem.CreationDate <> 0 then begin
Result := Result + 'create='+ FTPLocalDateTimeToMLS(AItem.CreationDate) + ';'; {do not localize}
end;
end;
if (Modify in AMLstOpts) and AItem.ModifiedAvail then
begin
if AItem.ModifiedDateGMT <> 0 then begin
Result := Result + 'modify='+ FTPGMTDateTimeToMLS(AItem.ModifiedDateGMT) + ';'; {do not localize}
end
else if AItem.ModifiedDate <> 0 then begin
Result := Result + 'modify='+ FTPLocalDateTimeToMLS(AItem.ModifiedDate) + ';'; {do not localize}
end;
end;
if UnixMODE in AMLstOpts then begin
Result := Result + 'UNIX.mode='+ IndyFormat('%.4d', [PermsToChmodNo(UnixGetOutputOwnerPerms(AItem), UnixGetOutputGroupPerms(AItem), UnixGetOutputOtherPerms(AItem) )] ) + ';'; {do not localize}
end;
if UnixOwner in AMLstOpts then begin
Result := Result + 'UNIX.owner=' + UnixGetOutputOwner(AItem) + ';'; {do not localize}
end;
if UnixGroup in AMLstOpts then begin
Result := Result + 'UNIX.group=' + UnixGetOutputGroup(AItem) + ';'; {do not localize}
end;
if (Unique in AMLstOpts) and (AItem.UniqueID <> '') then begin
Result := Result + 'unique=' + AItem.UniqueID + ';'; {do not localize}
end;
if LastAccessTime in AMLstOpts then begin
if AItem.ModifiedDateGMT <> 0 then begin
Result := Result + 'windows.lastaccesstime=' + FTPGMTDateTimeToMLS(AItem.ModifiedDateGMT) + ';'; {do not localize}
end
else if AItem.ModifiedDate <> 0 then begin
Result := Result + 'windows.lastaccesstime=' + FTPLocalDateTimeToMLS(AItem.ModifiedDate) + ';'; {do not localize}
end;
end;
if WinAttribs in AMLstOpts then begin
Result := Result + 'win32.ea=0x' + IntToHex(AItem.WinAttribs, 8) + ';'; {do not localize}
end;
if (AItem.WinDriveType > -1) and (WinDriveType in AMLstOpts) then begin
Result := Result + 'Win32.dt='+IntToStr( AItem.WinDriveType ) + ';'; {do not localize}
end;
if (AItem.WinDriveLabel <> '') and (WinDriveLabel in AMLstOpts) then begin
Result := Result + 'Win32.dl='+AItem.WinDriveLabel + ';'; {do not localize}
end;
Result := Result + ' ' + AItem.FileName; {do not localize}
end;
procedure TIdFTPListOutput.MLISTOutputDir(AOutput : TStrings; AMLstOpts: TIdFTPFactOutputs);
var
i : Integer;
begin
AOutput.BeginUpdate;
try
AOutput.Clear;
for i := 0 to Count-1 do begin
AOutput.Add(MListItem(Items[i], AMLstOpts));
end;
finally
AOutput.EndUpdate;
end;
end;
function TIdFTPListOutput.NListItem(AItem: TIdFTPListOutputItem): String;
begin
Result := IndyGetFileName(AItem.FileName);
if DirFormat = doUnix then begin
if HasSwitch(SWITCH_QUOTEDNAME) then begin
Result := '"' + Result + '"';
end;
if HasSwitch(SWITCH_CLASSIFY) or HasSwitch(SWITCH_SLASHDIR) then begin
case AItem.ItemType of
ditDirectory :
Result := Result + PATH_SUBDIR_SEP_UNIX;
ditSymbolicLink, ditSymbolicLinkDir :
Result := Result + '@';
else
begin
if IsUnixExec(AItem.UnixOwnerPermissions, AItem.UnixGroupPermissions , AItem.UnixOtherPermissions) then begin
Result := Result + '*';
end;
end;
end;
end;
Result := UnixinodeOutput(AItem)+ UnixBlocksOutput(AItem) + Result;
end;
end;
procedure TIdFTPListOutput.NLISTOutputDir(AOutput: TStrings);
begin
InternelOutputDir(AOutput, False);
end;
procedure TIdFTPListOutput.SetItems(AIndex: Integer; const AValue: TIdFTPListOutputItem);
begin
inherited Items[AIndex] := AValue;
end;
function TIdFTPListOutput.UnixBlocksOutput(AItem: TIdFTPListOutputItem): String;
begin
if HasSwitch(SWITCH_PRINT_BLOCKS) then begin
Result := IndyFormat('%4d ', [AItem.NumberBlocks]);
end else begin
Result := '';
end;
end;
function TIdFTPListOutput.UnixGetOutputGroup(AItem: TIdFTPListOutputItem): String;
begin
if AItem.GroupName = '' then begin
Result := UnixGetOutputOwner(AItem);
end else begin
Result := AItem.GroupName;
end;
end;
function TIdFTPListOutput.UnixGetOutputGroupPerms(AItem: TIdFTPListOutputItem): String;
begin
if AItem.UnixOtherPermissions = '' then begin
if AItem.ItemType in [ditSymbolicLink, ditSymbolicLinkDir] then begin
Result := DEF_DIR_GRP_PERM;
end else begin
Result := DEF_FILE_GRP_PERM;
end;
end else begin
Result := AItem.UnixOtherPermissions;
end;
end;
function TIdFTPListOutput.UnixGetOutputOtherPerms(AItem: TIdFTPListOutputItem): String;
begin
if AItem.UnixOtherPermissions = '' then begin
if AItem.ItemType in [ditSymbolicLink, ditSymbolicLinkDir] then begin
Result := DEF_DIR_OTHER_PERM;
end else begin
Result := DEF_FILE_OTHER_PERM;
end;
end else begin
Result := AItem.UnixOtherPermissions;
end;
end;
function TIdFTPListOutput.UnixGetOutputOwner(AItem: TIdFTPListOutputItem): String;
begin
if AItem.OwnerName = '' then begin
Result := DEF_OWNER;
end else begin
Result := AItem.OwnerName;
end;
end;
function TIdFTPListOutput.UnixGetOutputOwnerPerms(AItem: TIdFTPListOutputItem): String;
begin
if AItem.UnixOwnerPermissions = '' then begin
if AItem.ItemType in [ditSymbolicLink, ditSymbolicLinkDir] then begin
Result := DEF_DIR_OWN_PERM;
end else begin
Result := DEF_FILE_OWN_PERM;
end;
end else begin
Result := AItem.UnixOwnerPermissions;
end;
end;
function TIdFTPListOutput.UnixINodeOutput(AItem: TIdFTPListOutputItem): String;
var
LInode : String;
begin
Result := '';
if HasSwitch(SWITCH_PRINT_INODE) then begin
LInode := IntToStr(Abs(AItem.Inode));
//should be no more than 10 digits
LInode := Copy(LInode, 1, 10);
Result := Result + IndyFormat('%10s ', [LInode]);
end;
end;
function TIdFTPListOutput.UnixItem(AItem: TIdFTPListOutputItem): String;
var
LSize, LTime: string;
l, month: Word;
LLinkNum : Integer;
LFileName : String;
LFormat : String;
LMTime : TDateTime;
begin
LFileName := IndyGetFileName(AItem.FileName);
Result := UnixINodeOutput(AItem) + UnixBlocksOutput(AItem);
case AItem.ItemType of
ditDirectory:
begin
AItem.Size := UNIX_DIR_SIZE;
LSize := 'd'; {Do not Localize}
end;
ditSymbolicLink:
begin
LSize := 'l'; {Do not Localize}
end;
else
begin
LSize := '-'; {Do not Localize}
end;
end;
if AItem.LinkCount = 0 then begin
LLinkNum := 1;
end else begin
LLinkNum := AItem.LinkCount;
end;
LFormat := '%3:3s%4:3s%5:3s %6:3d '; {Do not localize}
//g - surpress owner
//lrwxrwxrwx 1 other 7 Nov 16 2001 bin -> usr/bin
//where it would normally print
//lrwxrwxrwx 1 root other 7 Nov 16 2001 bin -> usr/bin
if not HasSwitch('g') then begin
LFormat := LFormat + '%1:-8s '; {Do not localize}
end;
//o - surpress group
//lrwxrwxrwx 1 root 7 Nov 16 2001 bin -> usr/bin
//where it would normally print
//lrwxrwxrwx 1 root other 7 Nov 16 2001 bin -> usr/bin
if not HasSwitch('o') then begin
LFormat := LFormat + '%2:-8s '; {Do not localize}
end;
LFormat := LFormat + '%0:8d'; {Do not localize}
LSize := LSize + IndyFormat(LFormat, [AItem.Size, UnixGetOutputOwner(AItem),
UnixGetOutputGroup(AItem), UnixGetOutputOwnerPerms(AItem),
UnixGetOutputGroupPerms(AItem), UnixGetOutputOtherPerms(AItem), LLinkNum]);
LMTime := GetLocalModTime(AItem);
DecodeDate(LMTime, l, month, l);
LTime := MonthNames[month] + FormatDateTime(' dd', LMTime); {Do not Localize}
if HasSwitch(SWITCH_BOTH_TIME_YEAR) then begin
LTime := LTime + FormatDateTime(' hh:nn:ss yyyy', LMTime); {Do not Localize}
end
else if IsIn6MonthWindow(LMTime) then begin {Do not Localize}
LTime := LTime + FormatDateTime(' hh:nn', LMTime); {Do not Localize}
end
else begin
LTime := LTime + FormatDateTime(' yyyy', LMTime); {Do not Localize}
end;
// A.Neillans, 20 Apr 2002, Fixed glitch, extra space in front of names.
// Result := LSize + ' ' + LTime + ' ' + FileName; {Do not Localize}
Result := Result + LSize + ' ' + LTime + ' ';
if HasSwitch(SWITCH_QUOTEDNAME) then begin
Result := Result + '"' + LFileName + '"'; {Do not Localize}
end else begin
Result := Result + LFileName;
end;
if AItem.ItemType in [ditSymbolicLink, ditSymbolicLinkDir] then begin
if HasSwitch(SWITCH_QUOTEDNAME) then begin
Result := Result + UNIX_LINKTO_SYM + '"' + AItem.LinkedItemName + '"'; {Do not Localize}
end else begin
Result := Result + UNIX_LINKTO_SYM + AItem.LinkedItemName;
end;
end;
if ((IndyPos(SWITCH_CLASSIFY,Switches)>0) or (IndyPos(SWITCH_SLASHDIR,Switches)>0)) and {Do not translate}
(AItem.ItemType in [ditDirectory, ditSymbolicLinkDir]) then
begin
Result := Result + PATH_SUBDIR_SEP_UNIX;
end;
if HasSwitch(SWITCH_CLASSIFY) and (AItem.ItemType = ditFile) and
IsUnixExec(UnixGetOutputOwnerPerms(AItem), UnixGetOutputGroupPerms(AItem), UnixGetOutputOtherPerms(AItem)) then
begin
//star is placed at the end of a file name
//like this:
//-r-xr-xr-x 1 0 1 17440 Aug 8 2000 ls*
Result := Result + '*';
end;
end;
function TIdFTPListOutput.Win32Item(AItem: TIdFTPListOutputItem): String;
var
LSize, LFileName : String;
begin
LFileName := IndyGetFileName(AItem.FileName);
if AItem.ItemType = ditDirectory then begin
LSize := ' <DIR>' + StringOfChar(' ', 9); {Do not Localize}
end else begin
LSize := StringOfChar(' ', 20 - Length(IntToStr(AItem.Size))) + IntToStr(AItem.Size); {Do not Localize}
end;
Result := FormatDateTime('mm-dd-yy hh:nnAM/PM', GetLocalModTime(AItem)) + ' ' + LSize + ' ' + LFileName; {Do not Localize}
end;
{ TDirEntry }
function TDirEntry.AddFileName(const APathName: String; ADirEnt: TIdFTPListOutputItem) : Boolean;
var
i : Integer;
LParentPart : String;
LDirEnt : TDirEntry;
begin
Result := False;
LParentPart := StripInitPathDelim(IndyGetFilePath(APathName));
if LParentPart = PathName then begin
if FFileList.IndexOf(APathName) = -1 then begin
FFileList.AddObject(APathName, ADirEnt);
end;
Result := True;
Exit;
end;
if Assigned(SubDirs) then begin
for i := 0 to SubDirs.Count-1 do begin
LDirEnt := TDirEntry(SubDirs[i]);
LParentPart := StripInitPathDelim(IndyGetFilePath(LDirEnt.FDirListItem.FileName));
if TextStartsWith(APathName, LParentPart) then begin
if TDirEntry(SubDirs[i]).AddFileName(APathName, ADirEnt) then begin
Result := True;
Break;
end;
end;
end;
end;
end;
function TDirEntry.AddSubDir(const APathName: String; ADirEnt: TIdFTPListOutputItem) : Boolean;
var
LDirEnt : TDirEntry;
i : Integer;
LParentPart : String;
begin
Result := False;
LParentPart := StripInitPathDelim(IndyGetFilePath(APathName));
if LParentPart = PathName then begin
if not Assigned(FSubDirs) then begin
FSubDirs := TDirEntryList.Create;
end;
LParentPart := StripInitPathDelim(IndyGetFilePath(APathName));
LParentPart := IndyGetFileName(LParentPart);
LDirEnt := TDirEntry.Create(APathName, ADirEnt);
try
FSubDirs.Add(LDirEnt);
except
LDirEnt.Free;
raise;
end;
AddFileName(APathName, ADirEnt);
Result := True;
Exit;
end;
if Assigned(SubDirs) then begin
for i := 0 to SubDirs.Count-1 do begin
LDirEnt := TDirEntry(SubDirs[i]);
LParentPart := StripInitPathDelim(IndyGetFilePath(LDirEnt.FDirListItem.FileName));
if TextStartsWith(APathName, LParentPart) then begin
if LDirEnt.AddSubDir(APathName, ADirEnt) then begin
Result := True;
Break;
end;
end;
end;
end;
end;
constructor TDirEntry.Create(const APathName : String; ADirListItem : TIdFTPListOutputItem);
begin
inherited Create;
FPathName := APathName;
FFileList := TIdBubbleSortStringList.Create;
FDirListItem := ADirListItem;
//create that only when necessary;
FSubDirs := TDirEntryList.Create;
end;
destructor TDirEntry.Destroy;
begin
FreeAndNil(FFileList);
FreeAndNil(FSubDirs);
inherited Destroy;
end;
procedure TDirEntry.SortAscendFName;
var
i : Integer;
LSubDir: TDirEntry;
begin
if Assigned(FFileList) then begin
FFileList.BubbleSort(StrSortAscFName);
end;
if Assigned(FSubDirs) then begin
FSubDirs.BubbleSort(
{$IFDEF HAS_GENERICS_TObjectList}
DESortAscFName
{$ELSE}
TIdSortCompare(@DESortAscFName)
{$ENDIF}
);
for i := 0 to FSubDirs.Count-1 do begin
LSubDir := {$IFDEF HAS_GENERICS_TObjectList}FSubDirs[i]{$ELSE}TDirEntry(FSubDirs[i]){$ENDIF};
LSubDir.SortAscendFName;
end;
end;
end;
procedure TDirEntry.SortAscendMTime;
var
i : Integer;
LSubDir: TDirEntry;
begin
if Assigned(FFileList) then begin
FFileList.BubbleSort(StrSortAscMTime);
end;
if Assigned(FSubDirs) then begin
FSubDirs.BubbleSort(
{$IFDEF HAS_GENERICS_TObjectList}
DESortAscMTime
{$ELSE}
TIdSortCompare(@DESortAscMTime)
{$ENDIF}
);
for i := 0 to FSubDirs.Count-1 do begin
LSubDir := {$IFDEF HAS_GENERICS_TObjectList}FSubDirs[i]{$ELSE}TDirEntry(FSubDirs[i]){$ENDIF};
LSubDir.SortAscendMTime;
end;
end;
end;
procedure TDirEntry.SortDescendMTime;
var
i : Integer;
LSubDir: TDirEntry;
begin
if Assigned(FFileList) then begin
FFileList.BubbleSort(StrSortDescMTime);
end;
if Assigned(FSubDirs) then begin
FSubDirs.BubbleSort(
{$IFDEF HAS_GENERICS_TObjectList}
DESortDescMTime
{$ELSE}
TIdSortCompare(@DESortDescMTime)
{$ENDIF}
);
for i := 0 to FSubDirs.Count -1 do begin
LSubDir := {$IFDEF HAS_GENERICS_TObjectList}FSubDirs[i]{$ELSE}TDirEntry(FSubDirs[i]){$ENDIF};
LSubDir.SortDescendMTime;
end;
end;
end;
procedure TDirEntry.SortDescendFName;
var
i : Integer;
LSubDir: TDirEntry;
begin
if Assigned(FSubDirs) then begin
FSubDirs.BubbleSort(
{$IFDEF HAS_GENERICS_TObjectList}
DESortDescFName
{$ELSE}
TIdSortCompare(@DESortDescFName)
{$ENDIF}
);
for i := 0 to FSubDirs.Count-1 do begin
LSubDir := {$IFDEF HAS_GENERICS_TObjectList}FSubDirs[i]{$ELSE}TDirEntry(FSubDirs[i]){$ENDIF};
LSubDir.SortDescendFName;
end;
end;
if Assigned(FFileList) then begin
FFileList.BubbleSort(StrSortDescFName);
end;
end;
procedure TDirEntry.SortAscendFNameExt;
var
i : Integer;
LSubDir: TDirEntry;
begin
if Assigned(FFileList) then begin
FFileList.BubbleSort(StrSortAscFNameExt);
end;
if Assigned(FSubDirs) then begin
FSubDirs.BubbleSort(
{$IFDEF HAS_GENERICS_TObjectList}
DESortAscFName
{$ELSE}
TIdSortCompare(@DESortAscFName)
{$ENDIF}
);
for i := 0 to FSubDirs.Count-1 do begin
LSubDir := {$IFDEF HAS_GENERICS_TObjectList}FSubDirs[i]{$ELSE}TDirEntry(FSubDirs[i]){$ENDIF};
LSubDir.SortAscendFNameExt;
end;
end;
end;
procedure TDirEntry.SortDescendFNameExt;
var
i : Integer;
LSubDir: TDirEntry;
begin
if Assigned(FFileList) then begin
FFileList.BubbleSort(StrSortDescFNameExt);
end;
if Assigned(FSubDirs) then begin
FSubDirs.BubbleSort(
{$IFDEF HAS_GENERICS_TObjectList}
DESortAscFName
{$ELSE}
TIdSortCompare(@DESortAscFName)
{$ENDIF}
);
for i := 0 to FSubDirs.Count-1 do begin
LSubDir := {$IFDEF HAS_GENERICS_TObjectList}FSubDirs[i]{$ELSE}TDirEntry(FSubDirs[i]){$ENDIF};
LSubDir.SortDescendFNameExt;
end;
end;
end;
procedure TDirEntry.SortAscendSize;
var
i : Integer;
LSubDir: TDirEntry;
begin
if Assigned(FFileList) then begin
FFileList.BubbleSort(StrSortAscSize);
end;
if Assigned(FSubDirs) then begin
FSubDirs.BubbleSort(
{$IFDEF HAS_GENERICS_TObjectList}
DESortAscMTime
{$ELSE}
TIdSortCompare(@DESortAscMTime)
{$ENDIF}
);
for i := 0 to FSubDirs.Count-1 do begin
LSubDir := {$IFDEF HAS_GENERICS_TObjectList}FSubDirs[i]{$ELSE}TDirEntry(FSubDirs[i]){$ENDIF};
LSubDir.SortAscendSize;
end;
end;
end;
procedure TDirEntry.SortDescendSize;
var
i : Integer;
LSubDir: TDirEntry;
begin
if Assigned(FFileList) then begin
FFileList.BubbleSort(StrSortDescSize);
end;
if Assigned(FSubDirs) then begin
FSubDirs.BubbleSort(
{$IFDEF HAS_GENERICS_TObjectList}
DESortDescFName
{$ELSE}
TIdSortCompare(@DESortDescFName)
{$ENDIF}
);
for i := 0 to FSubDirs.Count-1 do begin
LSubDir := {$IFDEF HAS_GENERICS_TObjectList}FSubDirs[i]{$ELSE}TDirEntry(FSubDirs[i]){$ENDIF};
LSubDir.SortDescendSize;
end;
end;
end;
{ TIdFTPListOutputItem }
constructor TIdFTPListOutputItem.Create(AOwner: TCollection);
begin
inherited Create(AOwner);
//indicate that this fact is not applicable
FWinDriveType := -1;
end;
end.
| 32.094294 | 197 | 0.687127 |
47109bfb368d953fbcc97d0e3490a46bb116243d | 203 | pas | Pascal | test/lex01.pas | tlemo/lpc | de4d7e389ae16736f3dbbf2c4a339145e2cc6e1d | [
"Apache-2.0"
]
| 2 | 2018-11-19T21:00:23.000Z | 2018-11-24T20:12:48.000Z | test/lex01.pas | tlemo/lpc | de4d7e389ae16736f3dbbf2c4a339145e2cc6e1d | [
"Apache-2.0"
]
| null | null | null | test/lex01.pas | tlemo/lpc | de4d7e389ae16736f3dbbf2c4a339145e2cc6e1d | [
"Apache-2.0"
]
| 1 | 2020-05-14T10:49:39.000Z | 2020-05-14T10:49:39.000Z |
{ comment 1 {) }
{ comment 2 *)
(* comment 3 }
Program X;
BEGIN
Write ( '', ' ''', ''' ', ' '' '' '''' ');
WriteLn('(*012}{3A][BC''!@#$%^&*()_+\<>,.:";`') ;
End.
(* '' ' { { { ' comment 2 *)
| 14.5 | 53 | 0.334975 |
fc6f2ac376fcf141e626b8e01c3a14d5fa7ec1f7 | 4,820 | pas | Pascal | Capitulo3/1.DS.Exemplo2/Server/Web.Module.pas | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 10 | 2017-08-02T00:44:41.000Z | 2021-10-13T21:11:28.000Z | Capitulo3/1.DS.Exemplo2/Server/Web.Module.pas | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 10 | 2019-12-30T04:09:37.000Z | 2022-03-02T06:06:19.000Z | Capitulo3/1.DS.Exemplo2/Server/Web.Module.pas | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 9 | 2017-04-29T16:12:21.000Z | 2020-11-11T22:16:32.000Z | unit Web.Module;
interface
uses
System.SysUtils, System.Classes, Web.HTTPApp, Datasnap.DSHTTPCommon,
Datasnap.DSHTTPWebBroker, Datasnap.DSServer,
Web.WebFileDispatcher, Web.HTTPProd,
DataSnap.DSAuth,
Datasnap.DSProxyJavaScript, IPPeerServer, Datasnap.DSMetadata,
Datasnap.DSServerMetadata, Datasnap.DSClientMetadata, Datasnap.DSCommonServer,
Datasnap.DSHTTP;
type
TWebModule1 = class(TWebModule)
DSHTTPWebDispatcher1: TDSHTTPWebDispatcher;
DSServer1: TDSServer;
DSServerClass1: TDSServerClass;
ServerFunctionInvoker: TPageProducer;
ReverseString: TPageProducer;
WebFileDispatcher1: TWebFileDispatcher;
DSProxyGenerator1: TDSProxyGenerator;
DSServerMetaDataProvider1: TDSServerMetaDataProvider;
procedure DSServerClass1GetClass(DSServerClass: TDSServerClass;
var PersistentClass: TPersistentClass);
procedure ServerFunctionInvokerHTMLTag(Sender: TObject; Tag: TTag;
const TagString: string; TagParams: TStrings; var ReplaceText: string);
procedure WebModuleDefaultAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
procedure WebModuleBeforeDispatch(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
procedure WebFileDispatcher1BeforeDispatch(Sender: TObject;
const AFileName: string; Request: TWebRequest; Response: TWebResponse;
var Handled: Boolean);
procedure WebModuleCreate(Sender: TObject);
private
{ Private declarations }
FServerFunctionInvokerAction: TWebActionItem;
function AllowServerFunctionInvoker: Boolean;
public
{ Public declarations }
end;
var
WebModuleClass: TComponentClass = TWebModule1;
implementation
{$R *.dfm}
uses ServerMethodsAcao, Web.WebReq;
procedure TWebModule1.DSServerClass1GetClass(
DSServerClass: TDSServerClass; var PersistentClass: TPersistentClass);
begin
PersistentClass := ServerMethodsAcao.TSMAcao;
end;
procedure TWebModule1.ServerFunctionInvokerHTMLTag(Sender: TObject; Tag: TTag;
const TagString: string; TagParams: TStrings; var ReplaceText: string);
begin
if SameText(TagString, 'urlpath') then
ReplaceText := string(Request.InternalScriptName)
else if SameText(TagString, 'port') then
ReplaceText := IntToStr(Request.ServerPort)
else if SameText(TagString, 'host') then
ReplaceText := string(Request.Host)
else if SameText(TagString, 'classname') then
ReplaceText := ServerMethodsAcao.TSMAcao.ClassName
else if SameText(TagString, 'loginrequired') then
if DSHTTPWebDispatcher1.AuthenticationManager <> nil then
ReplaceText := 'true'
else
ReplaceText := 'false'
else if SameText(TagString, 'serverfunctionsjs') then
ReplaceText := string(Request.InternalScriptName) + '/js/serverfunctions.js'
else if SameText(TagString, 'servertime') then
ReplaceText := DateTimeToStr(Now)
else if SameText(TagString, 'serverfunctioninvoker') then
if AllowServerFunctionInvoker then
ReplaceText :=
'<div><a href="' + string(Request.InternalScriptName) +
'/ServerFunctionInvoker" target="_blank">Server Functions</a></div>'
else
ReplaceText := '';
end;
procedure TWebModule1.WebModuleDefaultAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
if (Request.InternalPathInfo = '') or (Request.InternalPathInfo = '/')then
Response.Content := ReverseString.Content
else
Response.SendRedirect(Request.InternalScriptName + '/');
end;
procedure TWebModule1.WebModuleBeforeDispatch(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
if FServerFunctionInvokerAction <> nil then
FServerFunctionInvokerAction.Enabled := AllowServerFunctionInvoker;
end;
function TWebModule1.AllowServerFunctionInvoker: Boolean;
begin
Result := (Request.RemoteAddr = '127.0.0.1') or
(Request.RemoteAddr = '0:0:0:0:0:0:0:1') or (Request.RemoteAddr = '::1');
end;
procedure TWebModule1.WebFileDispatcher1BeforeDispatch(Sender: TObject;
const AFileName: string; Request: TWebRequest; Response: TWebResponse;
var Handled: Boolean);
var
D1, D2: TDateTime;
begin
Handled := False;
if SameFileName(ExtractFileName(AFileName), 'serverfunctions.js') then
if not FileExists(AFileName) or (FileAge(AFileName, D1) and FileAge(WebApplicationFileName, D2) and (D1 < D2)) then
begin
DSProxyGenerator1.TargetDirectory := ExtractFilePath(AFileName);
DSProxyGenerator1.TargetUnitName := ExtractFileName(AFileName);
DSProxyGenerator1.Write;
end;
end;
procedure TWebModule1.WebModuleCreate(Sender: TObject);
begin
FServerFunctionInvokerAction := ActionByName('ServerFunctionInvokerAction');
end;
initialization
finalization
Web.WebReq.FreeWebModules;
end.
| 34.927536 | 119 | 0.767842 |
fc91d9c30a91a42d77151b4b285381c820195e86 | 23,659 | dfm | Pascal | 2016.Database/Assignment3/src/delphi/UnitMain.dfm | primetong/LearningCollectionOfWitt | a15dc8ac80618a3995c2b930c634b87ed8f1f0af | [
"MIT"
]
| null | null | null | 2016.Database/Assignment3/src/delphi/UnitMain.dfm | primetong/LearningCollectionOfWitt | a15dc8ac80618a3995c2b930c634b87ed8f1f0af | [
"MIT"
]
| 14 | 2020-06-30T20:52:56.000Z | 2022-03-02T14:53:18.000Z | 2016.Database/Assignment3/src/delphi/UnitMain.dfm | primetong/LearningCollectionOfWitt | a15dc8ac80618a3995c2b930c634b87ed8f1f0af | [
"MIT"
]
| null | null | null | object FormMain: TFormMain
Left = 0
Top = 0
Caption = 'Process Monitor'
ClientHeight = 441
ClientWidth = 624
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Visible = True
PixelsPerInch = 96
TextHeight = 13
object MainToolBar: TToolBar
Left = 0
Top = 0
Width = 624
Height = 39
Margins.Left = 0
Margins.Top = 0
Margins.Right = 0
Margins.Bottom = 0
AutoSize = True
ButtonHeight = 39
ButtonWidth = 58
Caption = 'MainToolBar'
EdgeOuter = esRaised
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = []
Images = ImageList
ParentFont = False
ShowCaptions = True
TabOrder = 0
object ToolButtonTitle: TToolButton
Left = 0
Top = 0
Action = ActionSwitch2TabTitle
Caption = '&Title'
Grouped = True
ImageIndex = 0
Style = tbsCheck
end
object ToolButtonStatistics: TToolButton
Left = 58
Top = 0
Action = ActionSwitch2TabStatistics
Caption = '&Statistics'
Enabled = False
Grouped = True
ImageIndex = 1
Style = tbsCheck
end
object ToolButtonRecords: TToolButton
Left = 116
Top = 0
Action = ActionSwitch2TabRecords
Caption = '&Records'
Enabled = False
Grouped = True
ImageIndex = 2
Style = tbsCheck
end
object ToolButtonLogs: TToolButton
Left = 174
Top = 0
Action = ActionSwitch2TabLogs
Caption = '&Logs'
Enabled = False
Grouped = True
ImageIndex = 3
Style = tbsCheck
end
object ToolButtonControl: TToolButton
Left = 232
Top = 0
Action = ActionSwitch2TabSettings
Caption = '&Control'
Enabled = False
Grouped = True
ImageIndex = 4
Style = tbsCheck
end
object ToolButtonSeparator1: TToolButton
Left = 290
Top = 0
Width = 8
Caption = 'Separator'
ImageIndex = 0
Style = tbsSeparator
end
end
object PanelMain: TPanel
AlignWithMargins = True
Left = 0
Top = 39
Width = 624
Height = 402
Margins.Left = 0
Margins.Top = 0
Margins.Right = 0
Margins.Bottom = 0
Align = alClient
AutoSize = True
BevelOuter = bvLowered
TabOrder = 1
end
object ImageList: TImageList
Left = 584
Bitmap = {
494C010106000800880010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000002000000001002000000000000020
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0060CDA883FFC8A077FFF1E8DFD3000000000000000CDBC0A7F8E3CFBBF00000
00020000000000000000000000000000000000000000AFC759FFAFC759FFAFC7
59FF00000000000000000000000000000000D7E3ACFFD7E3ACFFD7E3ACFF0000
0000AFC759FFAFC759FFAFC759FF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000EBDB
CDDAB6804BFFB7814CFFC39568FF000000010000005EB57F49FFB7814CFF0000
00300000000000000000000000000000000000000000AFC759FFAFC759FF0000
000000000000000000000000000000000000D7E3ACFF00000000000000000000
000000000000AFC759FFAFC759FF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000EEE2
D6DEC9A079FFC9A17AFFD1AF8DFF000000020000005EB6804AFFB8824DFF0000
00310000000000000000000000000000000000000000AFC759FF000000000000
000000000000D7E3ACFF00000000000000000000000000000000000000000000
00000000000000000000AFC759FF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000E9DA
CBE0B7814CFFB8824DFFC29467FF000000030000005EB6804AFFB8824DFF0000
0031000000000000000000000000000000000000000000000000000000000000
000000000000D7E3ACFF00000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000E9DA
CBE0B7814CFFB8824DFFC29467FF000000030000005EB6804AFFB8824DFF0000
00310000000000000000000000000000000000000000D7E3ACFF000000000000
0000000000004C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFFD7E3
ACFFD7E3ACFF0000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000EDE0
D4D9BC8958FFBD8A59FFC89E76FF000000020000005EB6804AFFB8824DFF0000
00310000000000000000000000000000000000000000D7E3ACFF000000000000
0000000000004C4C4CFF000000000000000000000000000000004C4C4CFF0000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FBF9
F79BBC8A59FFBD8C5BFFE1CBB5FD000000000000005EB6804AFFB8824DFF0000
00310000000000000000000000000000000000000000D7E3ACFFD7E3ACFF0000
0000000000004C4C4CFF000000004C4C4CFF4C4C4CFF000000004C4C4CFF0000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FCFA
F89AD7BA9FFCBB8855FFF5EFE8C9000000000000005EB6804AFFB8824DFF0000
0031000000000000000000000000000000000000000000000000000000000000
0000000000004C4C4CFF000000004C4C4CFF4C4C4CFF000000004C4C4CFF0000
000000000000D7E3ACFFD7E3ACFF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000DFC8B1F1BC8A59FF0000000F000000000000005EB6804AFFB8824DFF0000
0031000000000000000000000000000000000000000000000000000000000000
0000000000004C4C4CFF000000000000000000000000000000004C4C4CFF0000
00000000000000000000D7E3ACFF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000DFC7B1F2BC8A59FF0000001000000000FBF9F7AAB6804AFFB7814BFF0000
008400000000000000000000000000000000000000000000000000000000D7E3
ACFFD7E3ACFF4C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFF0000
00000000000000000000D7E3ACFF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000DEC7B0F1BC8A59FF0000000EFBF9F790B7814BFFB8824DFFB8824DFFB984
51FF0000005F0000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000D7E3ACFF0000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000CCFAC89FEB98451FF00000081DBC0A5F7B8824DFFBC8A58FFBA8653FFB781
4CFFE9D9C9E000000000000000000000000000000000AFC759FF000000000000
0000000000000000000000000000000000000000000000000000D7E3ACFF0000
00000000000000000000AFC759FF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000D0AD8BFFB8824EFF0000002BE0CBB5F0B7804BFFF1E7DDC4E5D3C0E6B781
4CFFEEE2D6D300000000000000000000000000000000AFC759FFAFC759FF0000
0000000000000000000000000000D7E3ACFF0000000000000000000000000000
000000000000AFC759FFAFC759FF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000DABFA5F9BB8957FF0000001700000055BB8857FFF1E7DDC2E4D2BFE5C192
65FF0000002E00000000000000000000000000000000AFC759FFAFC759FFAFC7
59FF00000000D7E3ACFFD7E3ACFFD7E3ACFF0000000000000000000000000000
0000AFC759FFAFC759FFAFC759FF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000220000002D00000000000000000000004200000082FBF9F69F0000
002C000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
001E000000380000003800000038000000380000003800000038000000380000
0038000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0052BB8856FFB8824DFFB8824DFFB7814CFFB7814CFFB7814CFFB8824DFFE3CF
BBF100000000000000000000000000000000000000000000000000000000E5F4
FAD5FCFDFE9F000000000000000000000000000000000000000000000077D7ED
F8EF000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000052E5D3C1E0DCC2A9F1F4EC
E5B1000000090000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000001C0000002DF5EFE8C2B6804BFFC29367FF0000002D0000002C0000
0000000000000000000000000000000000000000000000000000000000000000
008A7AC5EBFFDBEFF9EE000000000000000000000000EAF5FBDC7FC7EBFFEEF7
FCBE000000000000000000000000000000000000000000000000000000000000
001C00000063000000810000006CF9F5F1A9E8D6C5FFDBC0A6FFFEFEFEFFEADA
CBFFD6B89BFF0000001000000000000000000000000000000087EDEDEDA7EDED
EDA7EDEDEDA7EEEEEEA7EDEDEDA7EEEEEEA7EDEDEDA7EEEEEEA7EDEDEDA7EEEE
EEA7EDEDEDA7F7F7F7A000000000000000000000000000000000000000000000
00000000000000000000F5EDE8B5B7814DFFC29469FF00000001000000000000
0000000000000000000000000000000000000000000000000000000000000000
000083C9ECFF7BC6EBFFA0D5F1FFFFFFFE92B0DDF3FF7BC6EBFF7BC6EBFF0000
0000000000000000000000000000000000000000000000000000DCEFF8E184C9
ECFF7CC6EBFF7CC6EBFF88CCEFFFDBBEA3FFDFC7B0FFD4B495FFD8BB9FFFC69B
72FFEEE1D5FFEBDCCED4000000000000000000000000DDDDDDCFFBFBFBFFDFDF
DFFFFBFBFBFFD7D7D7FFFBFBFBFFD1D1D1FFFBFBFBFFD1D1D1FFFBFBFBFFD3D2
D3FFFBFBFBFFC3C3C3F4000000000000000000000042C4986DFFC3976AFFC397
6AFFC3976AFFC3976AFFC3976AFFC4976BFFC3976BFFC29568FFC3976AFFC397
6AFFC3976AFFC3976BFFE7D7C6EB000000000000000000000000000000000000
0000B3DEF3FD7CC6EBFF7CC6EBFF7BC6EBFF7CC6EBFF7CC6EBFF9BD3F0FF0000
00000000000000000000000000000000000000000000000000357CC5EBFF7EC7
ECFF7EC7ECFF7EC7ECFFB4DCEFFFF1E7DDFFF1E6DCFFF8F4F0FFFAF6F3FFD8BB
9EFFF9F6F2FFD6B799FF000000000000000000000000DEDEDECFECECECFFD6D6
D6FFECECECFFD0D0D0FFECECECFFCBCBCBFFECECECFFCBCBCBFFECECECFFCDCC
CDFFECECECFFC3C3C3F400000000000000000000005EB88450FFE2E2EEFFEFED
E4FFF3F3F1FFFAF6F2FFFAF6F2FFF6F0E9FFF6F0E9FFF6F0E9FFF6F0E9FFF6F0
E9FFF6F0EBFFE5D1BEFFD8BB9FF9000000000000000000000000000000000000
0000EEF7FCBB7BC6EBFF7DC7ECFF7DC7ECFF7DC7ECFF7CC6EBFFD5ECF8E60000
00000000000000000000000000000000000000000000000000377CC6EBFF7EC7
ECFF7EC7ECFF7EC7ECFFAFDBF1FFF2E8DFFFF2E9E0FFF9F5F1FFFBF8F5FFD8BB
9FFFFAF7F4FFD7BA9EFE000000000000000000000000DDDDDDCFFFFFFFFFE2E2
E2FFFFFFFFFFDADADAFFFFFFFFFFD4D4D4FFFFFFFFFFD3D3D3FFFFFFFFFFD5D4
D5FFFFFFFFFFC3C3C3F400000000000000000000005EB98551FFD9E0F8FFEDF0
E9FFF4FAFDFFFFFFFFFFFFFFFFFFEEECEBFFF1F2F2FFF1F2F2FFF1F2F2FFF1F3
F4FFB6814BFFE5D2C0FFD8BB9FF9000000000000000000000000000000000000
0000B9E0F4FD7CC6EBFF7DC7ECFF7DC7ECFF7DC7ECFF7CC6EBFFA5D8F1FE0000
00000000000000000000000000000000000000000000000000377CC6EBFF7EC7
ECFF7EC7ECFF7EC7ECFF82C9EDFFD8B799FFD9BDA2FFD4B394FFDDC2AAFFC69A
70FFE5D1BEFFF4ECE4B8000000000000000000000000DEDEDECFE3E3E3FFD1D0
D1FFE3E3E3FFCCCBCCFFE3E3E3FFC8C7C8FFE6E6E5FF92B8F0FF99BDF1FF98BD
F1FFE5E4E4FFC3C3C3F400000000000000000000005EB98551FFFFFFFFFFF9F9
F9FFEBEBEBFFFFFFFFFFFFFFFFFFFDFCFBFFFDFCFBFFFDFCFBFFFDFCFCFFFDFC
FCFFFEFEFEFFE8D7C7FFD8BB9FF9000000000000000000000000FDFDFE958FCE
EEFF7CC6EBFF7DC7ECFF7DC7ECFF7DC7ECFF7DC7ECFF7DC7ECFF7CC6EBFF86CB
EDFFF8FCFDB800000000000000000000000000000000000000377CC6EBFF7EC7
ECFF7EC7ECFF7EC7ECFF7DC6EBFFB2DCF1FFDABC9FFFD3B393FFF9F5F1FFE5D2
C0FFE3CEBAF100000003000000000000000000000000DDDDDDCFFFFFFFFFE2E2
E2FFFFFFFFFFDADADAFFFFFFFFFFD4D4D4FFFFFFFFFFABC9F3FFFFFFFFFF9ABD
F1FFFFFFFFFFC4C4C4F400000000000000000000005EB98551FFF2F2F3FF7F80
80FF828180FFAEAEAEFFFFFFFFFFEDEBE8FFF0F0EFFFEAE3DDFFBE8B5AFFBF8C
5BFFBE8A59FFE5D2C0FFD8BB9FF90000000000000000E7F4FAE17CC6EBFF7BC6
EBFF7BC6EBFF7BC6EBFF7DC7ECFF7DC7ECFF7DC7ECFF7BC6EBFF7BC6EBFF7BC6
EBFF7AC5EBFFD6ECF9F3000000050000000000000000000000377CC6EBFF7EC7
ECFF7EC7ECFF7EC7ECFF7EC7ECFF7DC6EBFF8ACDEFFFF3F2EFD8F1E7DEBE0000
00650000000000000000000000000000000000000000DEDEDECFDBDADBFFCBCB
CBFFDBDADBFFC7C7C7FFDBDADBFFC4C3C4FFDFDEDDFF93B9F0FFD2E2F8FF8AB3
EFFFDCDBDBFFC2C2C2F400000000000000000000005EB98551FFCDCDCEFF8183
83FF7EBFE4FF879298FFFFFFFFFFF5F0ECFFF6F1EDFFF5F0EBFFF2E9E1FFF2E9
E1FFF2E9E1FFE7D6C5FFD8BB9FF9000000000000000000000000000000000000
007E00000086F3FAFDA87EC7ECFF7DC7ECFF7AC6EBFFF1F9FCBC0000008C0000
007E0000007E00000000000000050000000000000000000000377CC6EBFF7EC7
ECFF7EC7ECFF7EC7ECFF7EC7ECFF7EC7ECFF7CC6EBFF00000083000000000000
00000000000000000000000000000000000000000000DDDDDDCFFFFFFFFFE2E2
E2FFFFFFFFFFDADADAFFFFFFFFFFD4D4D4FFFFFFFFFFE1E0DFFFFFFFFFFFE2E1
E0FFFFFFFFFFC4C4C4F400000000000000000000005EB98551FFFCFCFCFF8586
86FF7DC4EDFF97CCEBFFFFFFFEFFEDE7E2FFEFEBE8FFEFEBE8FFF0EDEAFFC9A2
7CFFC8A079FFE5D2C0FFD8BB9FF9000000000000000000000000000000000000
00000000000000000000A7D9F1FE7CC6EBFF8FCEEEFF00000000000000000000
00000000000000000000000000000000000000000000000000377CC6EBFF7CC6
EBFF7BC5EBFF7CC6EBFF7BC5EBFF7CC6EBFF7BC5EAFF00000083000000000000
00000000000000000000000000000000000000000000DFDFDFCFA7A7A7FF9F9F
9FFFA8A8A8FF9C9C9CFFA8A8A8FF9A9A9AFFA8A8A8FF9A9A9AFFA8A8A8FF9B9B
9BFFA8A8A8FFC1C1C1F400000000000000000000005EB98551FFFFFFFFFFFFFF
FFFFEFF7FBFFFFFFFFFFFFFFFFFFF0EAE5FFF2EDE8FFF2EDE8FFF2EDE9FFE0CB
B7FFE0CAB5FFE7D5C4FFD8BB9FF9000000000000000000000000000000000000
00000000000000000000E7F4FAD07BC6EBFFCFEAF7F000000000000000000000
0000000000000000000000000000000000000000000000000037B2DDF3FFBEE2
F4FFA5D7F1FF9CD4F0FFA2D6F1FFB9E0F4FFBDE2F4FF00000083000000000000
00000000000000000000000000000000000000000000DFDFDFCF7E7E7EFF7F7F
7FFF7F7F7FFF7F7F7FFF7F7F7FFF7F7F7FFF7F7F7FFF7F7F7FFF7F7F7FFF7F7F
7FFF7F7F7FFFC0C0C0F4000000000000000000000057B6804BFFB7804BFFB780
4BFFB7804BFFB7804BFFB7804BFFB7804BFFB7804BFFB7804BFFB7804BFFB780
4BFFB7804BFFB7804BFFDBC1A7F9000000000000000000000000000000000000
00000000000000000000000000007BC6EBFF0000008100000000000000000000
00000000000000000000000000000000000000000000000000317DC6EBFF7DC7
ECFF7EC7ECFF7EC7ECFF7EC7ECFF7EC7ECFF79C5EAFF0000007B000000000000
00000000000000000000000000000000000000000000F8F8F89EE5E5E5C3E6E6
E6C3E6E6E6C3E6E6E6C3E6E6E6C3E6E6E6C3E6E6E6C3E6E6E6C3E6E6E6C3E6E6
E6C3E6E6E6C3F2F2F2BB00000000000000000000000000000035000000370000
0037000000370000003700000037000000370000003700000037000000370000
0037000000370000003700000012000000000000000000000000000000000000
0000000000000000000000000000B3DEF3FF0000000000000000000000000000
000000000000000000000000000000000000000000000000000000000061CEE9
F6E3A7D8F1FE9DD4F0FFA3D7F1FFC3E5F5EC0000008500000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000050000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000200000000100010000000000000100000000000000000000
000000000000000000000000FFFFFF00FFFF000000000000F19F000000000000
E19F000000000000E19F000000000000E19F000000000000E19F000000000000
E19F000000000000E19F000000000000E19F000000000000F39F000000000000
F31F000000000000F20F000000000000F207000000000000F207000000000000
F30F000000000000FFDF000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
F00FE7EFFF8FFFFFFC7FF38FFE07C003FC7FF01FC00380038001F01FC0038003
8001F01FC00380038001F01FC00380038001C007C007800380018003C01F8003
8001F83FC07F80038001FC7FC07F80038001FC7FC07F80038001FEFFC07F8003
FFFFFEFFE0FFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000
000000000000}
end
object ActionList: TActionList
Left = 528
object ActionSwitch2TabLogs: TAction
Caption = 'Logs'
OnExecute = ActionSwitch2TabLogsExecute
end
object ActionSwitch2TabSettings: TAction
Caption = 'Settings'
OnExecute = ActionSwitch2TabSettingsExecute
end
object ActionSwitch2TabTitle: TAction
Caption = 'ActionSwitch2TabTitle'
OnExecute = ActionSwitch2TabTitleExecute
end
object ActionSwitch2TabStatistics: TAction
Caption = 'ActionSwitch2TabStatistics'
OnExecute = ActionSwitch2TabStatisticsExecute
end
object ActionSwitch2TabRecords: TAction
Caption = 'ActionSwitch2TabRecords'
OnExecute = ActionSwitch2TabRecordsExecute
end
end
object Database: TADOConnection
CommandTimeout = 20
Connected = True
ConnectionString =
'Provider=SQLNCLI11.1;Integrated Security=SSPI;Persist Security I' +
'nfo=False;User ID="";Initial Catalog=Assignment_Three;Data Sourc' +
'e=.;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=' +
'4096;Workstation ID=DESKTOP-1PKOBJ8;Initial File Name="";Use Enc' +
'ryption for Data=False;Tag with column collation when possible=F' +
'alse;MARS Connection=False;DataTypeCompatibility=0;Trust Server ' +
'Certificate=False;Server SPN="";Application Intent=READWRITE'
ConnectionTimeout = 10
LoginPrompt = False
Provider = 'SQLNCLI11.1'
Left = 64
Top = 280
end
object ADOCommandInsertLog: TADOCommand
CommandText = 'EXEC InsertLog :Type, :Message'
Connection = Database
Parameters = <
item
Name = 'Type'
Attributes = [paNullable]
DataType = ftWord
Precision = 3
Size = 1
Value = Null
end
item
Name = 'Message'
Attributes = [paNullable]
DataType = ftString
NumericScale = 255
Precision = 255
Size = 512
Value = Null
end>
Left = 64
Top = 360
end
end
| 52.34292 | 74 | 0.849825 |
fc50155fc3ea7fb6f4906b636cbb366fcf8022b6 | 1,893 | pas | Pascal | engine/Lib/Collisions/tdpe.lib.collision.resolver.contract.pas | jomael/thundax-delphi-physics-engine | a86f38cdaba1f00c5ef5296a8ae67b816a59448e | [
"MIT"
]
| 56 | 2015-03-15T10:22:50.000Z | 2022-02-22T11:58:08.000Z | engine/Lib/Collisions/tdpe.lib.collision.resolver.contract.pas | jomael/thundax-delphi-physics-engine | a86f38cdaba1f00c5ef5296a8ae67b816a59448e | [
"MIT"
]
| 2 | 2016-07-10T07:57:05.000Z | 2019-10-14T15:49:06.000Z | engine/Lib/Collisions/tdpe.lib.collision.resolver.contract.pas | jomael/thundax-delphi-physics-engine | a86f38cdaba1f00c5ef5296a8ae67b816a59448e | [
"MIT"
]
| 18 | 2015-07-17T19:24:39.000Z | 2022-01-20T05:40:46.000Z | (*
* Copyright (c) 2010-2012 Thundax Delphi Physics Engine
* 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 'TDPE' 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 OWNER 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.
*)
unit tdpe.lib.collision.resolver.contract;
interface
uses
tdpe.lib.vector;
type
ICollisionResolver<T> = interface
procedure resolve(particleA, particleB: T; hitpoint, normal: ICustomVector<Double>; depth: double);
end;
implementation
end.
| 40.276596 | 108 | 0.742736 |
fc9342e54eca71d2544615380d240a33eb254d81 | 19,501 | pas | Pascal | Packages/Order Entry Results Reporting/CPRS/CPRS-Chart/fPrintLocation.pas | 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/fPrintLocation.pas | VHAINNOVATIONS/Transplant | a6c000a0df4f46a17330cec95ff25119fca1f472 | [
"Apache-2.0"
]
| null | null | null | CPRSChart/OR_30_423_SRC/CPRS-chart/fPrintLocation.pas | VHAINNOVATIONS/Transplant | a6c000a0df4f46a17330cec95ff25119fca1f472 | [
"Apache-2.0"
]
| null | null | null | unit fPrintLocation;
interface
uses
Windows, Messages, SysUtils, StrUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, fAutoSz, StdCtrls, ExtCtrls, ORCtrls,ORFn, rCore, uCore, oRNet, Math, fOrders, ORClasses, rOrders,
fMeds, rMeds, CheckLst, Grids, fFrame, fClinicWardMeds,
VA508AccessibilityManager;
type
TfrmPrintLocation = class(TfrmAutoSz)
pnlTop: TPanel;
pnlBottom: TORAutoPanel;
orderGrid: TStringGrid;
pnlOrder: TPanel;
btnOK: TButton;
lblText: TLabel;
btnClinic: TButton;
btnWard: TButton;
lblEncounter: TLabel;
cbolocation: TORComboBox;
ORpnlBottom: TORAutoPanel;
orpnlTopBottom: TORAutoPanel;
cboEncLoc: TComboBox;
procedure pnlFieldsResize(Sender: TObject);
procedure orderGridMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure OrderGridDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure orderGridKeyPress(Sender: TObject; var Key: Char);
procedure btnClinicClick(Sender: TObject);
procedure btnWardClick(Sender: TObject);
procedure cbolocationChange(Sender: TObject);
procedure cbolocationExit(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
CLoc,WLoc: string;
CIEN,WIEN: integer;
function ValFor(FieldID, ARow: Integer): string;
procedure ShowEditor(ACol, ARow: Integer; AChar: Char);
procedure ProcessClinicOrders(WardList, ClinicList: TStringList; WardIEN, ClinicIEN: integer; ContainsIMO: boolean);
procedure rpcChangeOrderLocation(pOrderList:TStringList; ContainsIMO: boolean);
function ClinicText(ALoc: integer): string;
public
{ Public declarations }
CloseOK: boolean;
DisplayOrders: boolean;
procedure PrintLocation(OrderLst: TStringList; pEncounterLoc: integer; pEncounterLocName, pEncounterLocText: string;
pEncounterDT: TFMDateTime; pEncounterVC: Char; var ClinicLst, WardLst: TStringList;
var wardIEN: integer; var wardLocation: string; ContainsIMOOrders: boolean; displayEncSwitch: boolean = false);
procedure SwitchEncounterLoction(pEncounterLoc: integer; pEncounterLocName, pEncounterLocText: string; pEncounterDT: TFMDateTime; pEncounterVC: Char);
function rpcIsPatientOnWard(Patient: string): string;
function rpcIsClinicOrder(IEN: string): string;
end;
var
frmPrintLocation: TfrmPrintLocation;
ClinicIEN, WardIen: integer;
ASvc, ClinicLocation, WardLocation: string;
ClinicArr: TStringList;
WardArr: TStringList;
implementation
{$R *.dfm}
//uses
//fFrame;
Const
COL_ORDERINFO = 0;
COL_ORDERTEXT = 1;
COL_LOCATION = 2;
TAB = #9;
LOCATION_CHANGE_1 = 'The patient is admitted to ward';
LOCATION_CHANGE_2 = 'You have the chart open to a clinic location of';
LOCATION_CHANGE_2W = 'You have the chart open with the patient still on ward';
LOCATION_CHANGE_3 = 'What Location are these orders associated with?';
LOCATION_CHANGE_4 = 'The patient has now been admitted to ward: ';
{ TfrmPrintLocation }
procedure TfrmPrintLocation.btnClinicClick(Sender: TObject);
var
i: integer;
begin
inherited;
for i := 1 to self.orderGrid.RowCount do
begin
self.orderGrid.Cells[COL_LOCATION,i] := frmPrintLocation.CLoc;
end;
end;
procedure TfrmPrintLocation.btnOKClick(Sender: TObject);
var
i: integer;
Action: TCloseAction;
begin
if ClinicArr = nil then ClinicArr := TStringList.Create;
if WardArr = nil then wardArr := TStringList.Create;
if (frmPrintLocation.cboEncLoc.Enabled = true) and (frmPrintLocation.cboEncLoc.ItemIndex = -1) then
begin
infoBox('A location must be selected to continue processing patient data', 'Warning', MB_OK);
exit;
end;
if frmPrintLocation.DisplayOrders = true then
begin
for i := 1 to self.orderGrid.RowCount-1 do
begin
if ValFor(COL_LOCATION, i) = '' then
begin
infoBox('Every order must have a location define.','Location error', MB_OK);
exit;
end;
if ValFor(COL_LOCATION, i) = frmPrintLocation.CLoc then ClinicArr.Add(ValFor(COL_ORDERINFO, i))
else if ValFor(COL_LOCATION, i) = frmPrintLocation.WLoc then WardArr.Add(ValFor(COL_ORDERINFO, i));
end;
end;
CloseOK := True;
Action := caFree;
frmPrintLocation.FormClose(frmPrintLocation, Action);
if Action = caFree then frmPrintLocation.Close;
end;
procedure TfrmPrintLocation.btnWardClick(Sender: TObject);
var
i: integer;
begin
inherited;
for i := 1 to self.orderGrid.RowCount do
begin
self.orderGrid.Cells[COL_LOCATION,i] := frmPrintLocation.WLoc;
end;
end;
procedure TfrmPrintLocation.cbolocationChange(Sender: TObject);
begin
self.orderGrid.Cells[COL_LOCATION, self.orderGrid.Row] := self.cbolocation.Text;
end;
procedure TfrmPrintLocation.cbolocationExit(Sender: TObject);
begin
cboLocation.Hide;
end;
procedure TfrmPrintLocation.FormClose(Sender: TObject;
var Action: TCloseAction);
var
i :Integer;
//Action1: TCloseAction;
begin
inherited;
if not CloseOK then
begin
if ClinicArr = nil then ClinicArr := TStringList.Create;
if WardArr = nil then wardArr := TStringList.Create;
if (frmPrintLocation.cboEncLoc.Enabled = true) and (frmPrintLocation.cboEncLoc.ItemIndex = -1) then
begin
infoBox('A location must be selected to continue processing patient data', 'Warning', MB_OK);
Action := caNone;
exit;
end;
for i := 1 to self.orderGrid.RowCount-1 do
begin
if ValFor(COL_LOCATION, i) = '' then
begin
infoBox('Every order must have a location define.','Location error', MB_OK);
Action := caNone;
exit;
end;
if ValFor(COL_LOCATION, i) = frmPrintLocation.CLoc then ClinicArr.Add(ValFor(COL_ORDERINFO, i))
else if ValFor(COL_LOCATION, i) = frmPrintLocation.WLoc then WardArr.Add(ValFor(COL_ORDERINFO, i));
end;
CloseOK := True;
end;
Action := caFree;
end;
procedure TfrmPrintLocation.FormDestroy(Sender: TObject);
begin
inherited;
frmPrintLocation := nil;
end;
procedure TfrmPrintLocation.FormResize(Sender: TObject);
begin
inherited;
pnlFieldsResize(Sender)
end;
function TfrmPrintLocation.ClinicText(ALoc: integer): string;
begin
if SCallV('ORIMO ISCLOC', [ALoc]) = '1' then Result := LOCATION_CHANGE_2
else Result := LOCATION_CHANGE_2W
end;
procedure TfrmPrintLocation.OrderGridDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
inherited;
OrderGrid.Canvas.TextRect(Rect, Rect.Left+2, Rect.Top+2,
Piece(OrderGrid.Cells[ACol, ARow], TAB, 1));
end;
procedure TfrmPrintLocation.orderGridKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
if CharInSet(Key, [#32..#127]) then ShowEditor(OrderGrid.Col, OrderGrid.Row, Key);
end;
procedure TfrmPrintLocation.orderGridMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
ACol, ARow: Integer;
begin
inherited;
OrderGrid.MouseToCell(X, Y, ACol, ARow);
if (ARow < 0) or (ACol < 0) then Exit;
if ACol > COL_ORDERINFO then ShowEditor(ACol, ARow, #0) else
begin
OrderGrid.Col := COL_ORDERTEXT;
OrderGrid.Row := ARow;
end;
//if OrderGrid.Col <> COL_ORDERTEXT then
//DropLastSequence;
end;
procedure TfrmPrintLocation.pnlFieldsResize(Sender: TObject);
Const
REL_ORDER = 0.85;
REL_LOCATION = 0.15;
var
i, center, diff, ht, RowCountShowing: Integer;
ColControl: TWinControl;
begin
inherited;
if frmPrintLocation = nil then exit;
with frmPrintLocation do
begin
if (frmPrintLocation.WLoc = '') and (frmPrintLocation.CLoc = '') then exit;
lblText.Caption := LOCATION_CHANGE_1 + ': ' + frmPrintLocation.WLoc + CRLF;
if frmPrintLocation.DisplayOrders = false then
begin
if frmPrintlocation.CLoc = '' then
begin
lblText.Caption := LOCATION_CHANGE_4 + frmPrintLocation.WLoc + CRLF;
cboEncLoc.Enabled := false;
lblEncounter.Enabled := false;
end
else lblText.Caption := lblText.Caption + ClinicText(frmPrintLocation.CIEN) + ': ' + frmPrintLocation.CLoc + CRLF;
btnClinic.Visible := false;
btnWard.Visible := false;
pnlTop.Height := lbltext.Top + lbltext.Height * 2;
pnlbottom.Top := pnltop.Top + pnltop.Height + 3;
ordergrid.Height := 1;
pnlBottom.Height := 1;
lblEncounter.Top := pnlBottom.Top + pnlBottom.Height;
cboEncLoc.Top := lblEncounter.Top;
cboEncLoc.Left := lblEncounter.Left + lblEncounter.Width + 4;
orpnlBottom.Top := cboEncLoc.Top + cboEncLoc.Height +10;
end
else
begin
lblText.Caption := lblText.Caption + ClinicText(frmPrintLocation.CIEN) + ': ' + frmPrintLocation.CLoc + CRLF + CRLF;
lblText.Caption := lblText.Caption + LOCATION_CHANGE_3;
//lblText.Caption := lblText.Caption + CRLF + 'One clinic location allowed; ' + frmPrintLocation.CLoc + ' will be used';
btnClinic.Caption := 'All ' + frmPrintLocation.CLoc;
btnWard.Caption := 'All ' + frmPrintLocation.WLoc;
btnClinic.Width := TextWidthByFont(btnClinic.Handle, btnClinic.Caption);
btnWard.Width := TextWidthByFont(btnWard.Handle, btnWard.Caption);
center := frmPrintLocation.Width div 2;
btnClinic.Left := center - (btnClinic.Width + 3);
btnWard.Left := center + 3;
end;
if pnlTop.Width > width then
begin
pnltop.Width := width - 8;
orpnlTopBottom.Width := pnltop.Width;
end;
if orpnlTopBottom.Width > pnltop.Width then orpnlTopBottom.Width := pnltop.Width;
if pnlBottom.Width > width then
begin
pnlBottom.Width := width - 8;
ordergrid.Width := pnlBottom.Width - 2;
end;
if orderGrid.Width > pnlBottom.Width then orderGrid.Width := pnlBottom.Width - 2;
if frmPrintLocation.DisplayOrders = true then
begin
i := OrderGrid.Width - 12;
i := i - GetSystemMetrics(SM_CXVSCROLL);
orderGrid.ColWidths[0] := 0;
orderGrid.ColWidths[1] := Round(REL_ORDER * i);
orderGrid.ColWidths[2] := Round(REL_LOCATION * i);
orderGrid.Cells[1,0] := 'Order';
orderGrid.Cells[2,0] := 'Location';
cboEncLoc.Left := lblEncounter.Left + lblEncounter.Width + 4;
ht := pnlBottom.Top - orderGrid.Top - 6;
ht := ht div (orderGrid.DefaultRowHeight+1);
ht := ht * (orderGrid.DefaultRowHeight+1);
Inc(ht, 3);
OrderGrid.Height := ht;
ColControl := nil;
Case OrderGrid.Col of
COL_ORDERTEXT:ColCOntrol := pnlOrder;
COL_LOCATION:ColControl := cboLocation;
End;
if assigned(ColControl) and ColControl.Showing then
begin
RowCountShowing := (Height - 25) div (orderGrid.defaultRowHeight+1);
if (OrderGrid.Row <= RowCountShowing) then
ShowEditor(OrderGrid.Col, orderGrid.Row, #0)
else
ColControl.Hide;
end;
end;
diff := frmPrintLocation.btnOK.top;
//diff := (frmPrintLocation.ORpnlBottom.Top + frmPrintlocation.btnOK.Top) - frmPrintLocation.ORpnlBottom.Top;
frmPrintLocation.ORpnlBottom.Height := frmPrintLocation.btnOK.Top + frmPrintLocation.btnOK.Height + diff;
frmprintLocation.Height := frmprintLocation.orpnlBottom.Top + frmprintLocation.orpnlBottom.Height + 25;
end;
end;
procedure TfrmPrintLocation.PrintLocation(OrderLst: TStringList; pEncounterLoc:integer; pEncounterLocName,
pEncounterLocText: string; pEncounterDT: TFMDateTime; pEncounterVC: Char;
var ClinicLst, WardLst: TStringList; var wardIEN: integer; var wardLocation: string;
ContainsIMOOrders: boolean; displayEncSwitch: boolean = false);
var
OrderInfo, OrderText: string;
cidx, i, widx, count: integer;
begin
frmPrintLocation := TfrmPrintLocation.Create(Application);
try
count := 0;
frmPrintLocation.DisplayOrders := true;
frmPrintLocation.CloseOK := false;
ClinicArr := TStringList.Create;
WardArr := TStringList.Create;
CurrentLocationForPatient(Patient.DFN, WardIEN, WardLocation, ASvc);
frmPrintLocation.lblEncounter.Enabled := displayEncSwitch;
frmPrintLocation.cboEncLoc.Enabled := displayEncSwitch;
frmPrintLocation.Cloc := pEncounterLocName;
frmPrintLocation.WLoc := WardLocation;
frmPrintLocation.CIEN := pEncounterLoc;
frmPrintLocation.WIEN := wardIEN;
ResizeAnchoredFormToFont(frmPrintLocation);
frmPrintLocation.orderGrid.DefaultRowHeight := frmPrintLocation.cbolocation.Height;
for i := 0 to OrderLst.Count - 1 do
begin
OrderInfo := Piece(OrderLst.Strings[i],':',1);
if frmPrintLocation.rpcIsClinicOrder(OrderInfo)='0' then
begin
count := count+1;
OrderText := AnsiReplaceText(Piece(OrderLst.Strings[i],':',2),CRLF,'');
frmPrintLocation.orderGrid.Cells[COL_ORDERINFO,count] := OrderInfo;
frmPrintLocation.orderGrid.Cells[COL_ORDERTEXT,count] := OrderText;
end
else
begin
ClinicLst.Add(OrderInfo);
end;
end;
frmPrintlocation.orderGrid.RowCount := count + 1;
frmPrintLocation.cbolocation.Items.Add(frmPrintLocation.CLoc);
frmPrintLocation.cbolocation.Items.Add(frmPrintLocation.WLoc);
if frmPrintLocation.cboEncLoc.Enabled = True then
begin
frmPrintLocation.cboEncLoc.Items.Add(frmPrintLocation.CLoc);
frmPrintLocation.cboEncLoc.Items.Add(frmPrintLocation.WLoc);
end;
if count>0 then frmPrintLocation.ShowModal;
if assigned(ClinicArr) then ClinicLst.AddStrings(ClinicArr);
if assigned(WardArr) then WardLst.AddStrings(WardArr);
ProcessClinicOrders(WardLst, ClinicLst, WardIEN, pEncounterLoc, ContainsIMOOrders);
cidx := frmPrintLocation.cboEncLoc.Items.IndexOf(frmPrintLocation.CLoc);
widx := frmPrintLocation.cboEncLoc.Items.IndexOf(frmPrintLocation.WLoc);
if frmPrintLocation.cboEncLoc.ItemIndex = cidx then
begin
uCore.Encounter.EncounterSwitch(pEncounterLoc, pEncounterLocName, pEncounterLocText, pEncounterDT, pEncounterVC);
fframe.frmFrame.DisplayEncounterText;
fframe.frmFrame.OrderPrintForm := True;
end
else if frmPrintLocation.cboEncLoc.ItemIndex = widx then
begin
uCore.Encounter.EncounterSwitch(WardIEN, WardLocation, WardLocation, Patient.AdmitTime, 'H');
fFrame.frmFrame.DisplayEncounterText;
end;
finally
frmPrintLocation.Destroy;
end;
end;
procedure TfrmPrintLocation.ProcessClinicOrders(WardList, ClinicList: TStringList;
WardIEN, ClinicIEN: integer; ContainsIMO: boolean);
var
i: integer;
OrderArr: TStringList;
begin
OrderArr := TStringList.Create;
for i := 0 to WardList.Count -1 do
begin
OrderArr.Add(WardList.Strings[i] + U + InttoStr(WardIen));
end;
for i := 0 to ClinicList.Count -1 do
begin
OrderArr.Add(ClinicList.Strings[i] + U + InttoStr(ClinicIen));
end;
rpcChangeOrderLocation(OrderArr, ContainsIMO);
WardArr.Free;
end;
procedure TfrmPrintLocation.rpcChangeOrderLocation(pOrderList:TStringList; ContainsIMO: boolean);
var
IMO: string;
begin
// OrderIEN^Location^ISIMO -- used to alter location if ward is selected.
if ContainsIMO = True then IMO := '1'
else IMO := '0';
CallV('ORWDX CHANGE',[pOrderList, Patient.DFN, IMO]);
end;
function TfrmPrintLocation.rpcIsPatientOnWard(Patient: string): string;
begin
//Ward Loction Name^Ward Location IEN
result := sCallV('ORWDX1 PATWARD',[Patient]);
end;
function TfrmPrintLocation.rpcIsClinicOrder(IEN: string): string;
begin
result := sCallV('ORUTL ISCLORD',[IEN]);
end;
procedure TfrmPrintLocation.ShowEditor(ACol, ARow: Integer; AChar: Char);
var
tmpText: string;
procedure PlaceControl(AControl: TWinControl);
var
ARect: TRect;
begin
with AControl do
begin
ARect := OrderGrid.CellRect(ACol, ARow);
SetBounds(ARect.Left + OrderGrid.Left + 1, ARect.Top + OrderGrid.Top + 1,
ARect.Right - ARect.Left + 1, ARect.Bottom - ARect.Top + 1);
Tag := ARow;
BringToFront;
Show;
SetFocus;
end;
end;
procedure SynchCombo(ACombo: TORComboBox; const ItemText, EditText: string);
var
i: Integer;
begin
ACombo.ItemIndex := -1;
for i := 0 to Pred(ACombo.Items.Count) do
if ACombo.Items[i] = ItemText then ACombo.ItemIndex := i;
if ACombo.ItemIndex < 0 then ACombo.Text := EditText;
end;
begin
inherited;
if ARow = 0 then Exit;
Case ACol of
COL_LOCATION: begin
TmpText := ValFor(COL_Location, ARow);
SynchCombo(cboLocation, tmpText, tmpText);
PlaceControl(cboLocation);
end;
end;
end;
procedure TfrmPrintLocation.SwitchEncounterLoction(pEncounterLoc: integer; pEncounterLocName, pEncounterLocText: string;
pEncounterDT: TFMDateTime; pEncounterVC: Char);
var
cidx, widx, WardIEN: integer;
Asvc, WardLocation: string;
begin
frmPrintLocation := TfrmPrintLocation.Create(Application);
try
frmPrintLocation.DisplayOrders := false;
frmPrintLocation.CloseOK := false;
CurrentLocationForPatient(Patient.DFN, WardIEN, WardLocation, ASvc);
frmPrintLocation.lblEncounter.Enabled := True;
frmPrintLocation.cboEncLoc.Enabled := True;
frmPrintLocation.Cloc := pEncounterLocName;
frmPrintLocation.WLoc := WardLocation;
frmPrintLocation.CIEN := pEncounterLoc;
frmPrintLocation.WIEN := wardIEN;
ResizeAnchoredFormToFont(frmPrintLocation);
frmPrintLocation.cboEncLoc.Items.Add(frmPrintLocation.CLoc);
frmPrintLocation.cboEncLoc.Items.Add(frmPrintLocation.WLoc);
frmPrintLocation.Caption := 'Refresh Encounter Location Form';
frmPrintLocation.ShowModal;
cidx := frmPrintLocation.cboEncLoc.Items.IndexOf(frmPrintLocation.CLoc);
widx := frmPrintLocation.cboEncLoc.Items.IndexOf(frmPrintLocation.WLoc);
if frmPrintLocation.cboEncLoc.Enabled = FALSE then frmPrintLocation.cboEncLoc.ItemIndex := widx;
if frmPrintLocation.cboEncLoc.ItemIndex = cidx then
begin
Encounter.Location := pEncounterLoc;
Encounter.LocationName := pEncounterLocName;
Encounter.LocationText := pEncounterLocText;
fframe.frmFrame.DisplayEncounterText;
end
else if frmPrintLocation.cboEncLoc.ItemIndex = widx then
begin
uCore.Encounter.EncounterSwitch(WardIEN, WardLocation, '', Patient.AdmitTime, 'H');
fFrame.frmFrame.DisplayEncounterText;
end;
finally
frmPrintLocation.Destroy;
end;
end;
function TfrmPrintLocation.ValFor(FieldID, ARow: Integer): string;
begin
Result := '';
if (ARow < 1) or (ARow >= OrderGrid.RowCount) then Exit;
with OrderGrid do
case FieldID of
COL_ORDERINFO : Result := Piece(Cells[COL_ORDERINFO, ARow], TAB, 1);
COL_ORDERTEXT : Result := Piece(Cells[COL_ORDERTEXT, ARow], TAB, 1);
COL_LOCATION : Result := Piece(Cells[COL_LOCATION, ARow], TAB, 1);
end;
end;
end.
| 35.716117 | 152 | 0.696477 |
47fc6e0fdcd715e4e338de33d535cc712bde68d1 | 1,526 | pas | Pascal | Grafik/Source/RenderImage/cls_RenderLightSource.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 11 | 2017-06-17T05:13:45.000Z | 2021-07-11T13:18:48.000Z | Grafik/Source/RenderImage/cls_RenderLightSource.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 2 | 2019-03-05T12:52:40.000Z | 2021-12-03T12:34:26.000Z | Grafik/Source/RenderImage/cls_RenderLightSource.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 6 | 2017-09-07T09:10:09.000Z | 2022-02-19T20:19:58.000Z | unit cls_RenderLightSource;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, cls_RenderBase, cls_RenderColor;
type
{ TRenderLightsource }
TRenderLightsource= Class(TRenderBaseObject)
Constructor Create(aPos:TRenderPoint);
Function ProjectedColor({%H-}Direction:TRenderVector):TRenderColor;virtual;
Function FalloffIntensity(Direction:TRenderVector):extended;virtual;
Function MaxIntensity(Direction:TRenderVector):extended;virtual;
function BoundaryTest({%H-}aRay: TRenderRay; out Distance: extended): boolean; override;
function HitTest({%H-}aRay: TRenderRay; out HitData: THitData): boolean; override;
end;
implementation
uses graphics;
{ TRenderLightsource }
constructor TRenderLightsource.Create(aPos: TRenderPoint);
begin
FPosition := aPos;
end;
function TRenderLightsource.ProjectedColor(Direction: TRenderVector
): TRenderColor;
begin
result := clWhite;
end;
function TRenderLightsource.FalloffIntensity(Direction: TRenderVector
): extended;
begin
result := 1.0/sqr(Direction.GLen);
end;
function TRenderLightsource.MaxIntensity(Direction: TRenderVector): extended;
begin
result := 1.0/sqr(Direction.GLen);
end;
function TRenderLightsource.BoundaryTest(aRay: TRenderRay; out
Distance: extended): boolean;
begin
Distance:=-1.0;
result :=false;
end;
function TRenderLightsource.HitTest(aRay: TRenderRay; out HitData: THitData
): boolean;
begin
result := false;
end;
end.
| 23.476923 | 95 | 0.7346 |
f1ffa96c4c5ce090546f418abb419ac0f04c549e | 1,621 | pas | Pascal | Units/BlaiseCoin/UStreamOp.pas | blaisecoin/blaisecoin | 4d769f2b4e79c8f232de9035d30c5cc0cb90f803 | [
"MIT"
]
| null | null | null | Units/BlaiseCoin/UStreamOp.pas | blaisecoin/blaisecoin | 4d769f2b4e79c8f232de9035d30c5cc0cb90f803 | [
"MIT"
]
| null | null | null | Units/BlaiseCoin/UStreamOp.pas | blaisecoin/blaisecoin | 4d769f2b4e79c8f232de9035d30c5cc0cb90f803 | [
"MIT"
]
| null | null | null | {
Copyright (c) 2016 by Albert Molina
Copyright (c) 2017 by BlaiseCoin developers
Distributed under the MIT software license, see the accompanying file LICENSE
or visit http://www.opensource.org/licenses/mit-license.php.
This unit is a part of BlaiseCoin, a P2P crypto-currency.
}
unit UStreamOp;
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
interface
uses
SysUtils, Classes;
type
TStreamOp = class
public
class function ReadAnsiString(Stream: TStream; var Value: AnsiString): Integer;
class function WriteAnsiString(Stream: TStream; Value: AnsiString): Integer;
end;
EStreamOp = class(Exception);
implementation
uses
ULog;
{ TStreamOp }
class function TStreamOp.ReadAnsiString(Stream: TStream; var Value: AnsiString): Integer;
var
l: Word;
begin
if Stream.Size - Stream.Position < 2 then
begin
// no size word
Value := '';
Result := -1;
exit;
end;
Stream.Read(l, 2);
if Stream.Size - Stream.Position < l then
begin
Stream.Position := Stream.Position - 2; // Go back!
Value := '';
Result := -2;
exit;
end;
SetLength(Value, l);
if l > 0 then
Stream.ReadBuffer(Value[1], l);
Result := l;
end;
class function TStreamOp.WriteAnsiString(Stream: TStream; Value: AnsiString): Integer;
var
n: Integer;
l: Word;
e: String;
begin
n := Length(Value);
if n > $FFFF then
begin
e := 'String too long to stream, length=' + IntToStr(n);
TLog.NewLog(lterror, ClassName, e);
raise EStreamOp.Create(e);
end;
l := n;
Stream.Write(l, 2);
if l > 0 then
Stream.WriteBuffer(Value[1], l);
Result := l;
end;
end.
| 19.297619 | 89 | 0.667489 |
47e9d5fad2c6a60bc8b1dab31540aa89eabcb419 | 247 | dpr | Pascal | Samples/dbDataComboZeos/dbDataComboZeos.dpr | callacius2009/Myloo_Components | 9cbf74c745c0527eebe03f98b04f213d2b27f5da | [
"Apache-2.0"
]
| null | null | null | Samples/dbDataComboZeos/dbDataComboZeos.dpr | callacius2009/Myloo_Components | 9cbf74c745c0527eebe03f98b04f213d2b27f5da | [
"Apache-2.0"
]
| null | null | null | Samples/dbDataComboZeos/dbDataComboZeos.dpr | callacius2009/Myloo_Components | 9cbf74c745c0527eebe03f98b04f213d2b27f5da | [
"Apache-2.0"
]
| null | null | null | program dbDataComboZeos;
uses
Vcl.Forms,
ufrmMain in 'ufrmMain.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
| 16.466667 | 41 | 0.692308 |
47d87d3037e8a15c671a4252702d6cdeb2680e9d | 3,671 | dpr | Pascal | references/mORMot/SQLite3/Samples/13 - StandAlone JSON SQL server/JSONSQLServer.dpr | juliomar/alcinoe | 4e59270f6a9258beed02676c698829e83e636b51 | [
"Apache-2.0"
]
| 851 | 2018-02-05T09:54:56.000Z | 2022-03-24T23:13:10.000Z | references/mORMot/SQLite3/Samples/13 - StandAlone JSON SQL server/JSONSQLServer.dpr | jonahzheng/alcinoe | be21f1d6b9e22aa3d75faed4027097c1f444ee6f | [
"Apache-2.0"
]
| 200 | 2018-02-06T18:52:39.000Z | 2022-03-24T19:59:14.000Z | references/mORMot/SQLite3/Samples/13 - StandAlone JSON SQL server/JSONSQLServer.dpr | jonahzheng/alcinoe | be21f1d6b9e22aa3d75faed4027097c1f444ee6f | [
"Apache-2.0"
]
| 197 | 2018-03-20T20:49:55.000Z | 2022-03-21T17:38:14.000Z | /// serve SQLite3 results from SQL using HTTP server
program JSONSQLServer;
{
This "13 - StandAlone JSON SQL server" sample's aim is to directly
serve SQLite3 JSON results from SQL using HTTP server.
It will expect the incoming SQL statement to be POSTED as HTTP body, which
will be executed and returned as JSON.
This default implementation will just serve the test.db3 file as generated
by our regression tests.
SETUP NOTE: Ensure you first copied in the sample exe folder the test.db3 file
as generated by TestSQL3.exe.
But it is a very rough mechanism:
- No security is included;
- You can make your process run out of memory if the request returns too much rows;
- All incoming inputs will not be checked;
- No statement cache is used;
- No test was performed;
- Consider using SynDBRemote unit instead, for remote SQL access.
Therefore, this method is much less efficient than the one implemented by mORMot.
This is just a rough sample - do not use it in production - you shall better
use the mORMot framework instead.
Using SynDB classes instead of directly SynSQLite3 will allow to use any other DB,
not only SQlite3.
see https://synopse.info/forum/viewtopic.php?id=607 for the initial request
}
{$APPTYPE CONSOLE}
uses
{$I SynDprUses.inc} // use FastMM4 on older Delphi, or set FPC threads
SysUtils,
Classes,
SynCommons,
SynZip,
SynDB,
SynDBSQLite3, SynSQLite3Static,
SynCrtSock;
type
TJSONServer = class
protected
fProps: TSQLDBConnectionProperties;
fServer: THttpApiServer;
function Process(Ctxt: THttpServerRequest): cardinal;
public
constructor Create(Props: TSQLDBConnectionProperties);
destructor Destroy; override;
end;
{ TJSONServer }
const
DEFAULT_PORT = {$ifdef LINUX} '8888' {$else} '888' {$endif};
constructor TJSONServer.Create(Props: TSQLDBConnectionProperties);
var Conn: TSQLDBConnection;
begin
fProps := Props;
Conn := fProps.ThreadSafeConnection;
if not Conn.Connected then
Conn.Connect; // ensure we can connect to the DB
fServer := THttpApiServer.Create(false);
fServer.AddUrl('root',DEFAULT_PORT,false,'+',true);
fServer.RegisterCompress(CompressDeflate); // our server will deflate JSON :)
fServer.OnRequest := Process;
fServer.Clone(31); // will use a thread pool of 32 threads in total
end;
destructor TJSONServer.Destroy;
begin
fServer.Free;
inherited;
end;
function TJSONServer.Process(Ctxt: THttpServerRequest): cardinal;
begin
try
if length(Ctxt.InContent)<5 then
raise ESynException.CreateUTF8('Invalid request % %',[Ctxt.Method,Ctxt.URL]);
Ctxt.OutContentType := JSON_CONTENT_TYPE;
Ctxt.OutContent := fProps.Execute(Ctxt.InContent,[]).FetchAllAsJSON(true);
result := 200;
except
on E: Exception do begin
Ctxt.OutContentType := TEXT_CONTENT_TYPE;
Ctxt.OutContent := StringToUTF8(E.ClassName+': '+E.Message)+#13#10+Ctxt.InContent;
result := 504;
end;
end;
end;
var Props: TSQLDBConnectionProperties;
begin
// copy in the sample exe folder the test.db3 file as generated by TestSQL3.exe
Props := TSQLDBSQLite3ConnectionProperties.Create('test.db3','','','');
try
with TJSONServer.Create(Props) do
try
write('Server is now running on http://localhost:',
DEFAULT_PORT,'/root'#13#10'and will serve ',
ExpandFileName(UTF8ToString(Props.ServerName)),
' content'#13#10#13#10'Press [Enter] to quit');
readln;
finally
Free;
end;
finally
Props.Free;
end;
end.
| 30.090164 | 89 | 0.699537 |
f1e7f9d6cd1c95bb4422e5a3452b23faaa180336 | 1,615 | lpr | Pascal | CryptoLib.Tests/FreePascal.Tests/CryptoLib.lpr | MarkG55/CryptoLib4Pascal | 740f1e7ac86ac9cf009a8010d4384368e7abe6fb | [
"MIT"
]
| 148 | 2018-02-08T23:36:43.000Z | 2022-03-16T01:33:20.000Z | CryptoLib.Tests/FreePascal.Tests/CryptoLib.lpr | tondrej/CryptoLib4Pascal | 33a540094aa24d22d84d502319e4d01f7c3e8163 | [
"MIT"
]
| 28 | 2018-08-09T04:14:18.000Z | 2022-03-31T05:23:51.000Z | CryptoLib.Tests/FreePascal.Tests/CryptoLib.lpr | tondrej/CryptoLib4Pascal | 33a540094aa24d22d84d502319e4d01f7c3e8163 | [
"MIT"
]
| 46 | 2018-03-18T17:25:59.000Z | 2022-02-07T16:52:15.000Z | program CryptoLib.Tests;
{$mode objfpc}{$H+}
uses
Interfaces,
Forms,
GuiTestRunner,
Asn1SequenceParserTests,
DerApplicationSpecificTests,
EqualsAndHashCodeTests,
OIDTests,
EnumeratedTests,
ParsingTests,
ParseTests,
StringTests,
TagTests,
BigIntegerTests,
ECAlgorithmsTests,
ECPointTests,
SecP256R1FieldTests,
SecP384R1FieldTests,
ECDsa5Tests,
ECTests,
NamedCurveTests,
ECSchnorrTests,
SignerUtilitiesTests,
SecureRandomTests,
DigestRandomNumberTests,
FixedPointTests,
AESTests,
BlockCipherVectorTests,
BlockCipherMonteCarloTests,
AESTestVectors,
BlowfishTestVectors,
SpeckTestVectors,
RijndaelTestVectors,
AESSICTests,
SPECKTests,
IESCipherTests,
MD5HMacTests,
SHA1HMacTests,
SHA224HMacTests,
SHA256HMacTests,
SHA384HMacTests,
SHA512HMacTests,
RIPEMD128HMacTests,
RIPEMD160HMacTests,
HMacTests,
Pkcs5Tests,
HkdfGeneratorTests,
ECIESTests,
PascalCoinECIESTests,
ECNRTests,
PaddingTests,
DSATests,
DeterministicDsaTests,
Salsa20Tests,
XSalsa20Tests,
ChaChaTests,
StreamCipherResetTests,
CTSTests,
X25519Tests,
Ed25519Tests,
X25519HigherLevelTests,
Ed25519HigherLevelTests,
ShortenedDigestTests,
Kdf1GeneratorTests,
Kdf2GeneratorTests,
Argon2Tests,
ScryptTests,
DigestTests,
DigestUtilitiesTests,
DHTests,
Asn1IntegerTests,
KMacTests,
CryptoLibTestBase,
ClpFixedSecureRandom,
ClpIFixedSecureRandom,
ClpShortenedDigest,
ClpIShortenedDigest;
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TGuiTestRunner, TestRunner);
Application.Run;
end.
| 17.747253 | 53 | 0.782043 |
47c0ba7ee968c73706d0964207913f923a8395f6 | 50,575 | dpr | Pascal | benchmarks/sadical/urq3b2.dpr | krobelus/rate | 58c19a71c44d30e352323ff501e516230e747208 | [
"MIT"
]
| 9 | 2018-12-05T19:24:05.000Z | 2021-04-02T16:47:55.000Z | benchmarks/sadical/urq3b2.dpr | krobelus/rate | 58c19a71c44d30e352323ff501e516230e747208 | [
"MIT"
]
| 90 | 2019-05-20T20:52:06.000Z | 2022-02-10T09:03:02.000Z | benchmarks/sadical/urq3b2.dpr | krobelus/rate | 58c19a71c44d30e352323ff501e516230e747208 | [
"MIT"
]
| null | null | null | -37 -43 -13 -22 -23 -26 -39 -40 -44 36 -37 -36 -41 44 40 39 26 -23 22 13 -3 43 -35 0
35 37 -23 35 -23 37 0
37 -23 37 -23 -35 0
-35 -23 -35 -23 -37 0
-23 -23 -37 35 0
-5 -30 -42 35 32 -19 0
d -5 -30 -42 35 23 32 -19 0
-37 -20 -9 2 -31 0
d -37 -20 -9 23 2 -31 0
-5 -19 30 42 -32 -35 0
d -5 -19 30 42 23 -32 -35 0
-37 2 -9 31 20 0
d -37 2 -9 31 20 23 0
42 19 -30 -35 5 32 0
d 42 19 -30 -35 5 23 32 0
35 -19 32 -30 42 5 0
d 35 -19 23 32 -30 42 5 0
42 -5 -30 -19 35 -32 0
d 42 -5 -30 -19 35 23 -32 0
35 32 19 -5 30 -42 0
d 35 32 19 23 -5 30 -42 0
-37 -31 9 20 2 0
d -37 -31 9 23 20 2 0
-5 -35 -30 -19 42 32 0
d -5 -35 -30 -19 42 23 32 0
-5 19 -32 -30 35 -42 0
d -5 19 -32 23 -30 35 -42 0
2 31 37 20 9 0
d 2 31 37 20 23 9 0
42 35 -5 -19 30 32 0
d 42 35 23 -5 -19 30 32 0
-32 -35 -19 -30 5 42 0
d -32 -35 23 -19 -30 5 42 0
5 -35 -32 -42 -30 19 0
d 5 -35 23 -32 -42 -30 19 0
5 19 32 30 42 35 0
d 5 19 23 32 30 42 35 0
5 32 -42 -30 -35 -19 0
d 5 32 -42 -30 -35 23 -19 0
31 -20 37 -9 2 0
d 31 -20 37 -9 23 2 0
19 35 -30 32 -5 42 0
d 19 35 -30 32 -5 42 23 0
42 30 -32 19 -35 5 0
d 42 30 -32 19 -35 23 5 0
5 19 -32 35 30 -42 0
d 5 19 23 -32 35 30 -42 0
5 -42 -30 32 19 35 0
d 5 -42 -30 32 19 23 35 0
31 9 -20 2 -37 0
d 31 9 -20 2 23 -37 0
-2 -37 31 -9 -20 0
d -2 -37 23 31 -9 -20 0
5 -35 32 19 30 -42 0
d 5 -35 32 19 30 -42 23 0
-2 -9 37 -31 -20 0
d -2 -9 37 -31 23 -20 0
5 30 -42 -19 -35 -32 0
d 5 30 -42 -19 -35 23 -32 0
-5 -30 -35 -32 -42 -19 0
d -5 -30 -35 -32 -42 -19 23 0
42 -5 30 -35 32 19 0
d 42 -5 30 -35 32 19 23 0
-2 -37 9 31 20 0
d -2 -37 23 9 31 20 0
-5 -32 19 -42 30 -35 0
d -5 -32 19 -42 30 -35 23 0
-5 32 -42 -35 -30 19 0
d -5 32 23 -42 -35 -30 19 0
42 -5 19 -30 -35 -32 0
d 42 -5 19 -30 -35 -32 23 0
2 -9 -31 37 20 0
d 2 -9 -31 37 20 23 0
5 32 -42 30 35 -19 0
d 5 32 -42 30 23 35 -19 0
-5 -42 -19 32 30 -35 0
d -5 -42 23 -19 32 30 -35 0
31 37 -20 9 -2 0
d 31 37 23 -20 9 -2 0
42 -32 19 -30 5 35 0
d 42 -32 23 19 -30 5 35 0
5 -42 -19 -30 -32 35 0
d 5 -42 23 -19 -30 -32 35 0
2 37 9 -20 -31 0
d 2 37 9 23 -20 -31 0
35 -5 -32 -42 30 -19 0
d 35 -5 -32 -42 30 23 -19 0
42 -19 30 32 -35 5 0
d 42 -19 30 23 32 -35 5 0
35 -5 -32 42 19 30 0
d 35 -5 -32 23 42 19 30 0
-2 -9 37 20 31 0
d -2 -9 37 20 31 23 0
5 -32 30 42 -19 35 0
d 5 -32 30 42 -19 35 23 0
-2 -31 9 -37 -20 0
d -2 -31 9 -37 -20 23 0
-2 20 9 -31 37 0
d -2 20 9 23 -31 37 0
-37 -31 -2 20 -9 0
d -37 -31 23 -2 20 -9 0
d 19 42 35 5 -32 30 -23 0
d -35 32 42 -19 30 -23 -5 0
d -35 -30 5 32 19 -23 -42 0
d -5 -19 35 -23 30 -32 42 0
d 19 32 42 35 30 -23 -5 0
d -30 19 -23 5 -32 -42 35 0
d 37 2 31 -23 20 -9 0
d 31 -9 20 -37 -2 -23 0
d -35 -32 42 -19 -30 -23 -5 0
d -35 -30 19 42 5 -23 -32 0
d -35 19 5 32 42 30 -23 0
d 2 -20 -31 -23 9 -37 0
d -35 -32 -42 -5 -23 -30 19 0
d -5 -30 35 -42 -23 -32 -19 0
d 31 9 -23 2 20 -37 0
d 30 42 32 35 -23 5 -19 0
d -32 -19 30 5 -42 -23 35 0
d -35 -30 -23 -19 -5 32 -42 0
d 37 20 -2 -31 -9 -23 0
d -35 -42 -32 -30 -23 5 -19 0
d -35 30 -23 -42 32 -5 19 0
d 37 31 9 -2 20 -23 0
d -35 -32 -23 -19 -42 30 -5 0
d 31 -20 -23 -2 -37 9 0
d -35 42 19 -5 -30 -23 32 0
d -35 -19 -23 5 42 -32 30 0
d 37 2 -31 -23 -20 -9 0
d 37 31 9 -23 -20 2 0
d -9 2 -23 -31 20 -37 0
d 37 -20 31 -23 -2 -9 0
d 19 32 35 -23 -42 -30 -5 0
d -32 42 -23 -19 35 -30 5 0
d 32 -5 -42 -23 35 -19 30 0
d -30 -5 -32 42 -23 35 19 0
d 2 -9 -23 -37 -20 31 0
d -35 -32 19 42 -5 30 -23 0
d -30 -5 -19 32 42 -23 35 0
d 32 19 -42 -23 30 35 5 0
d -42 19 -32 30 35 -23 -5 0
d 37 2 20 -31 -23 9 0
d 19 42 35 5 32 -30 -23 0
d -35 -42 5 19 30 -23 -32 0
d 37 9 -31 -23 -2 -20 0
d -35 -42 32 5 -19 30 -23 0
d 9 20 -2 -31 -37 -23 0
d -42 32 -19 35 5 -30 -23 0
d -35 -30 32 -19 42 -23 5 0
d -20 -9 -37 -2 -31 -23 0
d -13 -22 -37 -43 -23 -26 -39 -40 -44 36 0
d 35 37 -23 0
d 37 -23 0
d -35 -23 0
-37 -43 -11 -13 -34 -2 -5 -22 -26 -39 -40 -44 36 -37 -23 -36 -41 44 40 -39 26 22 5 -2 -34 -7 13 -3 11 -10 -43 35 0
37 -43 -34 -2 -39 37 -23 -39 -2 -34 -7 -43 0
-43 -34 -2 -39 -43 -23 -39 -2 -34 -7 -37 0
-37 -34 -2 -39 -37 -23 -39 -2 -34 -7 43 0
-34 -2 -39 -34 -23 -39 -2 -7 43 37 0
37 43 -2 -39 37 -23 -39 -2 34 7 43 0
43 -2 -39 43 -23 -39 -2 34 7 -37 0
-37 -2 -39 -37 -23 -39 -2 34 7 -43 0
-2 -39 -2 -23 -39 34 7 -43 37 0
37 -43 34 -39 37 -23 -39 2 34 -7 -43 0
-43 34 -39 -43 -23 -39 2 34 -7 -37 0
-37 34 -39 -37 -23 -39 2 34 -7 43 0
34 -39 34 -23 -39 2 -7 43 37 0
37 43 -39 37 -23 -39 2 -34 7 43 0
43 -39 43 -23 -39 2 -34 7 -37 0
-37 -39 -37 -23 -39 2 -34 7 -43 0
-39 -39 -23 2 -34 7 -43 37 0
25 8 -1 34 0
d 25 8 -1 39 34 0
-1 -25 34 -8 0
d -1 -25 34 -8 39 0
-25 34 1 8 0
d -25 34 39 1 8 0
-43 -21 -20 -38 0
d -43 -21 -20 -38 39 0
25 -34 1 8 0
d 25 -34 1 39 8 0
21 -20 -38 43 0
d 21 -20 -38 43 39 0
-21 -38 43 20 0
d -21 -38 43 20 39 0
-1 -25 8 -34 0
d -1 -25 8 -34 39 0
-21 20 38 -43 0
d -21 20 39 38 -43 0
1 25 34 -8 0
d 1 25 34 39 -8 0
21 -43 -20 38 0
d 21 -43 -20 38 39 0
-1 25 -34 -8 0
d -1 25 39 -34 -8 0
21 43 38 20 0
d 21 43 38 20 39 0
-21 -20 43 38 0
d -21 -20 43 39 38 0
-25 -34 -8 1 0
d -25 -34 -8 39 1 0
21 20 -38 -43 0
d 21 20 -38 -43 39 0
d 43 38 20 -21 -39 0
d 34 25 -39 -8 -1 0
d 34 1 -8 -25 -39 0
d 38 21 -43 20 -39 0
d 1 8 -34 -39 -25 0
d -8 25 -39 1 -34 0
d 43 -21 -38 -39 -20 0
d 38 -21 -20 -39 -43 0
d -8 -1 -25 -34 -39 0
d -21 -38 -39 20 -43 0
d 34 1 -39 25 8 0
d -38 -20 21 -43 -39 0
d 43 21 -39 -38 20 0
d -1 25 -39 -34 8 0
d 34 -25 -1 8 -39 0
d 43 38 -20 21 -39 0
d -2 -5 -13 -11 -43 -34 -37 -22 -26 -39 -40 -44 36 0
d -2 37 -43 -34 -39 0
d -2 -43 -34 -39 0
d -2 -37 -34 -39 0
d -34 -2 -39 0
d -2 37 43 -39 0
d 43 -2 -39 0
d -37 -2 -39 0
d -2 -39 0
d 34 37 -43 -39 0
d -43 34 -39 0
d -37 34 -39 0
d 34 -39 0
d 37 43 -39 0
d 43 -39 0
d -37 -39 0
-38 -43 -7 -13 -21 -22 -26 -40 -41 -42 -44 34 -38 -23 -39 -34 -44 42 41 36 40 26 22 21 13 -3 7 2 -43 -20 0
38 -43 -44 38 -23 -39 -44 -43 0
-43 -44 -43 -23 -39 -44 -38 0
-38 -44 -38 -23 -39 -44 43 0
-44 -44 -23 -39 43 38 0
16 -38 -19 6 9 0
d 16 -38 -19 6 44 9 0
43 -35 37 0
d 43 -35 37 44 0
-6 -9 38 -19 -16 0
d -6 -9 38 -19 44 -16 0
16 -9 38 -6 19 0
d 16 -9 44 38 -6 19 0
6 9 -16 -38 19 0
d 6 9 -16 -38 19 44 0
35 -43 37 0
d 35 -43 44 37 0
-16 -19 -6 9 -38 0
d -16 -19 -6 44 9 -38 0
-37 -35 -43 0
d -37 -35 44 -43 0
-6 38 -19 16 9 0
d -6 38 -19 16 44 9 0
19 -9 -38 6 16 0
d 19 -9 -38 44 6 16 0
-6 -38 -19 16 -9 0
d -6 -38 -19 16 44 -9 0
6 38 19 9 16 0
d 6 38 19 9 44 16 0
-38 -9 19 -16 -6 0
d -38 -9 19 -16 -6 44 0
-16 38 19 -6 9 0
d -16 38 19 44 -6 9 0
43 -37 35 0
d 43 -37 44 35 0
-6 9 16 -38 19 0
d -6 9 16 -38 44 19 0
-16 -9 -19 6 -38 0
d -16 -9 44 -19 6 -38 0
-16 38 -9 6 19 0
d -16 38 -9 6 19 44 0
6 38 -9 -19 16 0
d 6 38 -9 44 -19 16 0
-16 6 38 9 -19 0
d -16 6 44 38 9 -19 0
d -35 -37 43 -44 0
d -43 -35 -44 37 0
d -16 -6 -44 -9 19 38 0
d -38 -6 9 -19 -44 16 0
d -38 6 -44 -16 -19 9 0
d 19 9 -44 6 38 -16 0
d -9 -19 38 -44 -16 6 0
d -43 -37 -44 35 0
d -6 -19 38 -44 16 -9 0
d -38 -9 -44 -6 -16 -19 0
d -38 -19 -44 -9 16 6 0
d -38 19 -44 6 -9 -16 0
d -38 19 6 16 9 -44 0
d 37 35 43 -44 0
d 16 -19 9 6 38 -44 0
d -6 -19 38 9 -44 -16 0
d 19 16 -44 -9 6 38 0
d -38 -6 9 -44 19 -16 0
d -38 -9 -44 16 19 -6 0
d 9 16 38 -44 -6 19 0
d -43 -22 -13 -7 -38 -21 -26 -40 -41 -42 -44 34 0
d 38 -43 -44 0
d -43 -44 0
d -38 -44 0
-21 -38 -7 -13 -37 -16 -22 -26 -34 -40 -41 -42 43 -21 -23 -39 -44 -43 42 41 36 40 34 26 22 -16 37 35 13 -3 7 -2 -38 20 0
21 -38 -16 21 -23 -39 -44 -16 -38 0
-38 -16 -38 -23 -39 -44 -16 -21 0
-21 -16 -21 -23 -39 -44 -16 38 0
-16 -16 -23 -39 -44 38 21 0
9 -38 -19 6 0
d 9 -38 16 -19 6 0
15 -21 14 -25 0
d 15 -21 14 -25 16 0
-9 -6 38 19 0
d -9 -6 38 16 19 0
21 -14 15 -25 0
d 21 -14 15 16 -25 0
38 9 -6 -19 0
d 38 9 -6 -19 16 0
-9 -38 6 19 0
d -9 -38 16 6 19 0
-15 -21 -25 -14 0
d -15 -21 -25 16 -14 0
-9 -38 -19 -6 0
d -9 -38 16 -19 -6 0
-15 14 21 -25 0
d -15 14 21 -25 16 0
15 25 -21 -14 0
d 15 25 -21 16 -14 0
38 6 19 9 0
d 38 6 16 19 9 0
15 25 21 14 0
d 15 25 21 14 16 0
-15 -21 25 14 0
d -15 -21 25 14 16 0
9 -38 -6 19 0
d 9 -38 -6 16 19 0
38 -9 -19 6 0
d 38 -9 16 -19 6 0
-15 25 21 -14 0
d -15 25 16 21 -14 0
d -21 14 -25 -16 -15 0
d -6 -9 38 -19 -16 0
d -25 -15 21 -14 -16 0
d -21 -14 15 -16 -25 0
d -38 6 19 -16 9 0
d -38 -19 -6 9 -16 0
d 15 -14 25 21 -16 0
d -25 14 -16 21 15 0
d -38 -6 19 -9 -16 0
d -6 9 38 19 -16 0
d -15 14 25 -16 21 0
d -21 -14 -15 -16 25 0
d -21 14 15 25 -16 0
d -38 -19 -9 -16 6 0
d 6 19 -16 -9 38 0
d -19 9 6 38 -16 0
d -38 -37 -13 -7 -21 -16 -22 -26 -34 -40 -41 -42 43 0
d 21 -38 -16 0
d -38 -16 0
d -21 -16 0
-31 -7 -13 -37 -9 -22 -26 -34 -40 -41 -42 43 -31 -23 -39 -44 -16 43 42 41 36 40 34 26 -22 9 -37 35 -13 -3 -7 2 20 0
31 2 -7 -13 -37 -22 43 31 -23 -39 -44 -16 -43 -22 37 35 -13 -3 -7 2 34 0
-31 2 -7 -13 -22 -31 -23 -39 -44 -16 -22 -13 -3 -7 2 34 0
2 -7 -13 -22 2 -23 -39 -44 -16 -22 -13 -3 -7 34 31 0
31 -7 -13 -22 31 -23 -39 -44 -16 -22 -13 -3 -7 -2 -34 0
-7 -13 -22 -7 -23 -39 -44 -16 -22 -13 -3 -2 -34 -31 0
-31 -2 -13 -22 -31 -23 -39 -44 -16 -22 -13 -3 7 -2 34 0
-2 -13 -22 -2 -23 -39 -44 -16 -22 -13 -3 7 34 31 0
31 -13 -22 31 -23 -39 -44 -16 -22 -13 -3 7 2 -34 0
-13 -22 -13 -23 -39 -44 -16 -22 -3 7 2 -34 -31 0
-31 2 7 -22 -31 -23 -39 -44 -16 -22 13 3 7 2 -34 0
2 7 -22 2 -23 -39 -44 -16 -22 13 3 7 -34 31 0
31 7 -22 31 -23 -39 -44 -16 -22 13 3 7 -2 34 0
7 -22 7 -23 -39 -44 -16 -22 13 3 -2 34 -31 0
-31 -2 -22 -31 -23 -39 -44 -16 -22 13 3 -7 -2 -34 0
-2 -22 -2 -23 -39 -44 -16 -22 13 3 -7 -34 31 0
31 -22 31 -23 -39 -44 -16 -22 13 3 -7 2 34 0
-22 -22 -23 -39 -44 -16 13 3 -7 2 34 -31 0
7 -4 -33 12 17 0
d 7 -4 -33 12 17 22 0
13 -3 0
d 13 -3 22 0
-4 -12 -33 -7 17 0
d -4 -12 -33 -7 22 17 0
-4 33 -17 -12 -7 0
d -4 33 22 -17 -12 -7 0
7 -17 -12 -33 -4 0
d 7 -17 -12 -33 -4 22 0
-4 -7 12 -33 -17 0
d -4 -7 12 22 -33 -17 0
7 33 12 -17 -4 0
d 7 33 22 12 -17 -4 0
-13 3 0
d -13 3 22 0
12 -33 4 -7 17 0
d 12 -33 4 22 -7 17 0
-4 33 17 -7 12 0
d -4 33 17 -7 12 22 0
-12 4 33 17 -7 0
d -12 4 33 17 22 -7 0
7 -33 -17 12 4 0
d 7 -33 -17 12 4 22 0
7 33 -4 -12 17 0
d 7 33 -4 22 -12 17 0
12 -17 -7 33 4 0
d 12 -17 22 -7 33 4 0
4 -7 -17 -33 -12 0
d 4 -7 22 -17 -33 -12 0
7 17 -12 4 -33 0
d 7 17 -12 4 22 -33 0
7 -12 33 -17 4 0
d 7 -12 33 -17 4 22 0
7 4 33 12 17 0
d 7 4 22 33 12 17 0
d -17 33 -7 -22 -4 12 0
d 7 -33 12 -22 -17 -4 0
d -12 -33 -22 -17 -7 -4 0
d 17 -12 -22 -7 4 -33 0
d -12 33 4 -22 -17 -7 0
d -33 12 4 -7 -17 -22 0
d 7 -17 -12 33 -22 -4 0
d 7 -12 -22 17 4 33 0
d 7 33 12 17 -4 -22 0
d -33 17 -4 -22 -7 12 0
d 17 33 -7 4 12 -22 0
d 7 17 -33 -12 -22 -4 0
d 7 12 17 -22 -33 4 0
d 3 13 -22 0
d 33 -12 -4 17 -22 -7 0
d -3 -13 -22 0
d 7 12 33 -17 4 -22 0
d 7 -33 4 -22 -12 -17 0
d -13 -41 -9 -7 -37 -22 43 -42 -31 -26 -34 -40 0
d -13 43 31 -7 -37 -22 2 0
d -13 -31 2 -7 -22 0
d -13 2 -7 -22 0
d -13 31 -7 -22 0
d -7 -13 -22 0
d -13 -31 -2 -22 0
d -2 -13 -22 0
d 31 -13 -22 0
d -13 -22 0
d 7 -31 2 -22 0
d 2 7 -22 0
d 31 7 -22 0
d 7 -22 0
d -31 -2 -22 0
d -2 -22 0
d 31 -22 0
-37 -31 -7 -9 -26 -34 -40 -41 -42 43 -37 -23 -39 -44 -16 -22 43 42 41 36 40 34 26 9 35 7 -2 31 20 0
-20 -37 43 -20 -23 -39 -44 -16 -22 43 -37 35 0
-37 43 -37 -23 -39 -44 -16 -22 43 35 20 0
20 43 20 -23 -39 -44 -16 -22 43 37 -35 0
43 43 -23 -39 -44 -16 -22 37 -35 -20 0
-38 -21 -20 0
d -38 -21 -20 -43 0
35 37 0
d 35 37 -43 0
-21 20 38 0
d -21 20 -43 38 0
-35 -37 0
d -35 -37 -43 0
21 -20 38 0
d 21 -20 38 -43 0
-38 20 21 0
d -38 20 -43 21 0
d -35 37 43 0
d 21 -38 43 -20 0
d 20 -21 -38 43 0
d 20 38 21 43 0
d -21 38 -20 43 0
d -37 35 43 0
d -37 -26 -7 -31 -9 -34 -40 -41 -42 43 0
d -20 -37 43 0
d -37 43 0
d 20 43 0
38 -31 -7 -21 -26 -34 -37 -40 -41 -42 38 -23 -39 -44 -16 -22 43 42 41 36 40 37 -35 34 26 21 -20 7 -2 31 9 0
-9 -20 38 -9 -23 -39 -44 -16 -22 43 38 -20 21 0
-20 38 -20 -23 -39 -44 -16 -22 43 38 21 9 0
9 38 9 -23 -39 -44 -16 -22 43 38 20 -21 0
38 38 -23 -39 -44 -16 -22 43 20 -21 -9 0
6 -19 9 0
d 6 -19 -38 9 0
-21 -20 0
d -21 -20 -38 0
6 19 -9 0
d 6 19 -9 -38 0
-6 -19 -9 0
d -6 -19 -38 -9 0
20 21 0
d 20 21 -38 0
-6 19 9 0
d -6 19 -38 9 0
d 19 -6 38 -9 0
d -21 20 38 0
d 9 -6 -19 38 0
d 21 -20 38 0
d 9 19 6 38 0
d -19 6 -9 38 0
d -21 -26 -7 -31 -34 -37 -40 -41 -42 38 0
d -9 -20 38 0
d -20 38 0
d 9 38 0
-19 -31 -37 -7 -26 -34 -40 -41 -42 21 -19 -23 -39 -44 -16 -22 43 38 -21 20 42 41 36 40 34 26 7 -2 -37 35 31 9 6 0
19 9 -37 19 -23 -39 -44 -16 -22 43 38 -37 35 9 -6 0
9 -37 9 -23 -39 -44 -16 -22 43 38 -37 35 -19 6 0
-19 -37 -19 -23 -39 -44 -16 -22 43 38 -37 35 -9 -6 0
-37 -37 -23 -39 -44 -16 -22 43 38 35 -9 19 6 0
42 -32 -5 -19 30 0
d 42 -32 -5 -19 30 -35 0
-30 19 5 32 42 0
d -30 19 -35 5 32 42 0
-30 42 -5 32 -19 0
d -30 42 -5 -35 32 -19 0
20 31 2 9 0
d 20 31 2 9 37 0
5 -32 -30 42 -19 0
d 5 -32 -35 -30 42 -19 0
19 -30 -32 5 -42 0
d 19 -30 -32 5 -35 -42 0
-19 5 -42 -30 32 0
d -19 5 -42 -30 32 -35 0
-9 31 2 -20 0
d -9 31 2 -20 37 0
42 5 30 19 -32 0
d 42 5 30 19 -32 -35 0
5 19 32 -42 30 0
d 5 19 32 -35 -42 30 0
-2 -9 -20 -31 0
d -2 -9 37 -20 -31 0
5 30 -19 -32 -42 0
d 5 30 -19 -35 -32 -42 0
-5 -30 -19 -42 -32 0
d -5 -30 -19 -35 -42 -32 0
42 30 19 -5 32 0
d 42 30 19 -5 32 -35 0
-5 -42 19 -32 30 0
d -5 -42 19 -35 -32 30 0
-5 -42 -30 32 19 0
d -5 -42 -35 -30 32 19 0
-30 -5 19 42 -32 0
d -30 -5 19 42 -35 -32 0
20 2 -9 -31 0
d 20 2 -9 -31 37 0
-5 -42 -19 30 32 0
d -5 -42 -19 30 -35 32 0
9 -2 31 -20 0
d 9 -2 31 -20 37 0
9 -20 2 -31 0
d 9 -20 37 2 -31 0
42 -19 32 30 5 0
d 42 -19 32 -35 30 5 0
31 20 -2 -9 0
d 31 20 -2 37 -9 0
20 9 -2 -31 0
d 20 9 37 -2 -31 0
d -19 32 -42 35 -5 -30 0
d -20 2 -31 -37 -9 0
d 2 31 20 -37 -9 0
d -19 5 -30 35 32 42 0
d -19 -5 42 -30 35 -32 0
d -5 32 -42 35 30 19 0
d 9 -31 2 20 -37 0
d -30 -5 19 -42 35 -32 0
d -19 32 30 -5 35 42 0
d 35 37 0
d 32 42 5 30 35 19 0
d 32 42 35 -5 19 -30 0
d -35 -37 0
d 30 -32 5 35 19 -42 0
d 32 5 -30 -42 35 19 0
d 9 31 2 -20 -37 0
d 31 -20 -37 -9 -2 0
d 9 -2 31 20 -37 0
d -19 -42 32 35 5 30 0
d 42 -30 -32 19 35 5 0
d -19 -42 -30 35 5 -32 0
d -19 -42 30 35 -32 -5 0
d -5 30 19 42 -32 35 0
d -19 5 42 35 30 -32 0
d 9 -20 -37 -31 -2 0
d -2 20 -31 -9 -37 0
d -7 -19 -37 -34 -40 -31 -26 -41 -42 21 0
d 19 9 -37 0
d 9 -37 0
d -19 -37 0
-32 -19 -31 -7 -26 -34 -40 -41 -42 21 -32 -23 -39 -44 -16 -22 43 38 -37 35 -21 20 -42 -41 -36 40 34 26 7 -2 31 9 19 -6 0
32 -41 -42 32 -23 -39 -44 -16 -22 43 38 -37 35 -42 -41 -36 0
-41 -42 -41 -23 -39 -44 -16 -22 43 38 -37 35 -42 -36 -32 0
-32 -42 -32 -23 -39 -44 -16 -22 43 38 -37 35 -42 41 36 0
-42 -42 -23 -39 -44 -16 -22 43 38 -37 35 41 36 32 0
-27 29 36 12 0
d -27 29 36 12 42 0
-32 -5 -19 30 0
d -32 -5 42 -19 30 0
19 5 32 -30 0
d 19 5 42 32 -30 0
27 -12 29 36 0
d 27 -12 42 29 36 0
-30 -19 -5 32 0
d -30 -19 -5 32 42 0
5 -19 -30 -32 0
d 5 -19 -30 -32 42 0
-27 -36 12 -29 0
d -27 -36 12 42 -29 0
-36 27 -12 -29 0
d -36 27 -12 42 -29 0
5 30 19 -32 0
d 5 30 42 19 -32 0
29 -12 -27 -36 0
d 29 -12 -27 42 -36 0
-29 -12 36 -27 0
d -29 -12 36 -27 42 0
30 19 -5 32 0
d 30 19 42 -5 32 0
-5 -32 -30 19 0
d -5 -32 -30 19 42 0
27 12 -36 29 0
d 27 12 42 -36 29 0
-29 36 12 27 0
d -29 36 12 27 42 0
-19 5 32 30 0
d -19 5 32 30 42 0
d -27 -12 29 -42 36 0
d -36 27 -42 12 -29 0
d -32 -30 19 5 -42 0
d 5 -30 -42 32 -19 0
d 19 5 32 -42 30 0
d -36 12 -42 29 -27 0
d -36 -12 -42 -27 -29 0
d -32 30 -19 5 -42 0
d -32 -5 -30 -42 -19 0
d 12 -27 -29 36 -42 0
d -32 19 30 -5 -42 0
d -30 -5 19 -42 32 0
d -36 -12 29 -42 27 0
d -5 30 -42 -19 32 0
d -12 27 -29 -42 36 0
d 27 12 -42 29 36 0
d -41 -26 -7 -32 -19 -34 -40 -31 -42 21 0
d 32 -41 -42 0
d -41 -42 0
d -32 -42 0
-30 -32 -31 -9 -19 -21 -26 -34 -40 36 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -36 -41 -40 34 26 21 -20 -19 -9 -6 -31 2 -7 32 5 0
30 -31 -9 -19 -40 30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -19 -9 -6 -31 0
-31 -9 -19 -40 -31 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -19 -9 -6 -30 0
-30 -9 -19 -40 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -19 -9 -6 31 0
-9 -19 -40 -9 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -19 -6 31 30 0
30 31 -19 -40 30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -19 9 6 31 0
31 -19 -40 31 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -19 9 6 -30 0
-30 -19 -40 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -19 9 6 -31 0
-19 -40 -19 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 9 6 -31 30 0
30 -31 9 -40 30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 19 9 -6 -31 0
-31 9 -40 -31 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 19 9 -6 -30 0
-30 9 -40 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 19 9 -6 31 0
9 -40 9 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 19 -6 31 30 0
30 31 -40 30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 19 -9 6 31 0
31 -40 31 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 19 -9 6 -30 0
-30 -40 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 19 -9 6 -31 0
-40 -40 -23 -39 -44 -16 -22 43 38 -37 35 -42 19 -9 6 -31 30 0
-33 27 -18 10 -14 -30 0
d -33 27 -18 10 -14 -30 40 0
-33 -27 -30 10 -18 14 0
d -33 -27 40 -30 10 -18 14 0
33 27 -30 -18 14 10 0
d 33 27 -30 -18 14 10 40 0
-10 27 30 14 -18 33 0
d -10 27 30 14 -18 33 40 0
10 -33 30 -14 -27 -18 0
d 10 -33 30 -14 40 -27 -18 0
-10 -33 -14 18 -27 30 0
d -10 -33 -14 18 40 -27 30 0
10 27 33 30 -14 -18 0
d 10 27 33 40 30 -14 -18 0
10 -18 33 -14 -27 -30 0
d 10 -18 33 -14 40 -27 -30 0
-10 -18 27 -14 -30 33 0
d -10 -18 40 27 -14 -30 33 0
10 -14 -27 -33 18 -30 0
d 10 -14 -27 40 -33 18 -30 0
10 33 27 14 30 18 0
d 10 33 27 14 40 30 18 0
10 18 -33 14 -27 30 0
d 10 18 40 -33 14 -27 30 0
-10 33 -30 -27 18 -14 0
d -10 33 40 -30 -27 18 -14 0
-10 -30 -14 -33 27 18 0
d -10 -30 -14 -33 40 27 18 0
-1 -13 -24 -31 0
d -1 -13 -24 40 -31 0
1 31 24 13 0
d 1 31 40 24 13 0
10 -14 -30 18 33 27 0
d 10 -14 -30 18 33 27 40 0
-1 -13 24 31 0
d -1 -13 24 40 31 0
10 27 30 -33 -18 14 0
d 10 27 30 40 -33 -18 14 0
-10 -27 14 33 -18 -30 0
d -10 -27 14 33 -18 -30 40 0
-33 27 -14 -18 -10 30 0
d -33 27 -14 -18 40 -10 30 0
-10 27 18 -30 33 14 0
d -10 27 18 -30 33 14 40 0
-10 -27 -14 -18 -33 -30 0
d -10 -27 -14 -18 -33 -30 40 0
1 31 -24 -13 0
d 1 31 40 -24 -13 0
-10 -27 33 -14 30 -18 0
d -10 -27 33 -14 40 30 -18 0
10 -30 33 -27 18 14 0
d 10 -30 33 -27 18 40 14 0
-1 31 -24 13 0
d -1 31 -24 40 13 0
10 -14 33 18 30 -27 0
d 10 -14 33 18 40 30 -27 0
-1 -31 13 24 0
d -1 -31 40 13 24 0
-10 -30 14 -33 -18 27 0
d -10 -30 14 40 -33 -18 27 0
10 27 -33 18 -30 14 0
d 10 27 40 -33 18 -30 14 0
-10 -33 30 -18 14 -27 0
d -10 -33 30 -18 40 14 -27 0
-10 -30 14 -27 -33 18 0
d -10 -30 14 40 -27 -33 18 0
-33 30 -10 18 14 27 0
d -33 30 -10 18 14 27 40 0
10 27 -14 18 30 -33 0
d 10 27 -14 18 40 30 -33 0
1 -31 -24 13 0
d 1 -31 -24 40 13 0
10 -18 14 33 30 -27 0
d 10 -18 14 33 30 40 -27 0
-10 18 30 -14 33 27 0
d -10 18 30 -14 40 33 27 0
-10 18 14 -27 30 33 0
d -10 18 14 40 -27 30 33 0
1 -13 -31 24 0
d 1 -13 -31 24 40 0
d 13 1 -40 24 -31 0
d -30 14 -33 -10 18 27 -40 0
d 27 14 33 -40 10 30 -18 0
d -30 -14 -18 33 -40 -10 -27 0
d 27 14 30 -40 -33 10 18 0
d -33 10 -14 30 27 -40 -18 0
d -30 -27 33 -10 14 -40 18 0
d -30 27 14 -18 -33 10 -40 0
d -30 -27 -10 18 -40 -14 -33 0
d 27 33 18 -10 -40 30 14 0
d 31 1 -24 -40 13 0
d -30 -14 -18 33 27 -40 10 0
d 31 -1 -40 24 13 0
d 27 10 18 -40 30 -14 33 0
d 31 -1 -13 -24 -40 0
d 13 -1 -31 -24 -40 0
d -30 -27 10 -33 -40 14 18 0
d 31 1 24 -13 -40 0
d -30 -27 -14 10 -40 -18 -33 0
d -30 -27 33 -14 10 18 -40 0
d -30 -27 -18 -40 -10 -33 14 0
d -27 14 -18 30 -40 33 -10 0
d -27 -14 -40 -33 18 10 30 0
d -33 -10 -40 18 30 27 -14 0
d -14 33 -18 30 27 -40 -10 0
d -30 14 33 10 -40 -27 -18 0
d -30 18 10 27 -33 -40 -14 0
d -33 -10 -18 14 27 30 -40 0
d 1 -13 -40 -31 -24 0
d -14 -27 30 -10 -40 -33 -18 0
d -30 27 -40 -18 -33 -14 -10 0
d -30 27 18 10 14 -40 33 0
d 10 33 30 -27 18 14 -40 0
d -30 27 18 -14 33 -40 -10 0
d -27 -14 18 30 -10 -40 33 0
d -33 -27 14 18 -10 30 -40 0
d -30 33 -10 27 14 -18 -40 0
d -14 -27 -18 -40 30 10 33 0
d -33 -27 10 -18 30 14 -40 0
d 24 -1 -13 -40 -31 0
d -19 -34 -26 -21 -9 36 -31 -30 -40 -32 0
d -19 30 -31 -9 -40 0
d -19 -31 -9 -40 0
d -19 -9 -30 -40 0
d -9 -19 -40 0
d -19 31 30 -40 0
d 31 -19 -40 0
d -30 -19 -40 0
d -19 -40 0
d 9 30 -31 -40 0
d -31 9 -40 0
d -30 9 -40 0
d 9 -40 0
d 30 31 -40 0
d 31 -40 0
d -30 -40 0
-30 -32 -9 -19 -21 -26 -31 -33 -34 36 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -36 -41 34 -33 31 26 21 -20 -19 -9 -2 -6 7 32 5 0
30 7 -2 -9 -19 -33 30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 -9 -6 -2 7 34 0
7 -2 -9 -19 -33 7 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 -9 -6 -2 34 -30 0
-30 -2 -9 -19 -33 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 -9 -6 -2 -7 -34 0
-2 -9 -19 -33 -2 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 -9 -6 -7 -34 30 0
30 -7 -9 -19 -33 30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 -9 -6 2 -7 34 0
-7 -9 -19 -33 -7 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 -9 -6 2 34 -30 0
-30 -9 -19 -33 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 -9 -6 2 7 -34 0
-9 -19 -33 -9 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 -6 2 7 -34 30 0
30 7 2 -19 -33 30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 9 6 2 7 -34 0
7 2 -19 -33 7 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 9 6 2 -34 -30 0
-30 2 -19 -33 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 9 6 2 -7 34 0
2 -19 -33 2 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 9 6 -7 34 30 0
30 -7 -19 -33 30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 9 6 -2 -7 -34 0
-7 -19 -33 -7 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 9 6 -2 -34 -30 0
-30 -19 -33 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -19 9 6 -2 7 34 0
-19 -33 -19 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 9 6 -2 7 34 30 0
30 7 -2 9 -33 30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 9 -6 -2 7 34 0
7 -2 9 -33 7 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 9 -6 -2 34 -30 0
-30 -2 9 -33 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 9 -6 -2 -7 -34 0
-2 9 -33 -2 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 9 -6 -7 -34 30 0
30 -7 9 -33 30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 9 -6 2 -7 34 0
-7 9 -33 -7 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 9 -6 2 34 -30 0
-30 9 -33 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 9 -6 2 7 -34 0
9 -33 9 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 -6 2 7 -34 30 0
30 7 2 -33 30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 -9 6 2 7 -34 0
7 2 -33 7 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 -9 6 2 -34 -30 0
-30 2 -33 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 -9 6 2 -7 34 0
2 -33 2 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 -9 6 -7 34 30 0
30 -7 -33 30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 -9 6 -2 -7 -34 0
-7 -33 -7 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 -9 6 -2 -34 -30 0
-30 -33 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 19 -9 6 -2 7 34 0
-33 -33 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 19 -9 6 -2 7 34 30 0
-12 -4 -17 -7 0
d -12 -4 33 -17 -7 0
27 -30 -18 14 10 0
d 27 -30 33 -18 14 10 0
27 30 14 -18 -10 0
d 27 30 33 14 -18 -10 0
10 30 -14 27 -18 0
d 10 30 -14 33 27 -18 0
7 -4 -17 12 0
d 7 -4 -17 12 33 0
10 -14 -18 -27 -30 0
d 10 -14 -18 33 -27 -30 0
-14 27 -10 -18 -30 0
d -14 27 33 -10 -18 -30 0
10 18 27 14 30 0
d 10 18 27 14 30 33 0
-10 -27 -30 18 -14 0
d -10 -27 -30 33 18 -14 0
-4 17 12 -7 0
d -4 17 12 -7 33 0
-12 4 -7 17 0
d -12 4 -7 33 17 0
-30 27 -14 10 18 0
d -30 27 -14 10 18 33 0
14 -18 -27 -10 -30 0
d 14 -18 -27 -10 33 -30 0
-12 -4 17 7 0
d -12 -4 33 17 7 0
4 -7 -17 12 0
d 4 -7 33 -17 12 0
-30 14 -10 27 18 0
d -30 14 -10 27 18 33 0
-18 -14 -10 30 -27 0
d -18 -14 -10 33 30 -27 0
10 -27 -30 18 14 0
d 10 -27 -30 33 18 14 0
-27 18 10 30 -14 0
d -27 18 10 33 30 -14 0
-12 7 4 -17 0
d -12 7 4 33 -17 0
10 30 14 -18 -27 0
d 10 30 14 -18 33 -27 0
-10 18 30 27 -14 0
d -10 18 30 27 -14 33 0
-10 14 -27 18 30 0
d -10 14 33 -27 18 30 0
7 17 12 4 0
d 7 17 33 12 4 0
d -30 -14 -33 -18 10 27 0
d 12 17 7 -4 -33 0
d -7 -12 -4 -33 17 0
d -30 10 -27 14 -33 -18 0
d -12 -17 -4 7 -33 0
d -14 -27 -18 10 30 -33 0
d -7 12 -4 -17 -33 0
d -14 -27 -10 18 30 -33 0
d -30 18 10 -33 -14 -27 0
d -7 17 12 -33 4 0
d 10 14 -33 -27 18 30 0
d -30 -10 18 -33 27 -14 0
d 12 -17 -33 4 7 0
d 27 10 30 -33 -18 14 0
d -14 -10 -18 27 30 -33 0
d -30 -10 -27 -18 -33 -14 0
d -7 -17 -33 -12 4 0
d -30 -10 -18 -33 27 14 0
d -30 14 -33 10 27 18 0
d 17 -12 -33 7 4 0
d -10 -27 30 14 -18 -33 0
d -30 -10 -27 18 -33 14 0
d 14 27 -33 30 -10 18 0
d -14 10 18 27 30 -33 0
d -19 -21 -34 -9 -26 -30 -31 -33 -32 36 0
d -19 -9 7 -2 30 -33 0
d -19 7 -2 -9 -33 0
d -19 -2 -30 -9 -33 0
d -19 -2 -9 -33 0
d -19 -9 -7 30 -33 0
d -19 -9 -7 -33 0
d -19 -30 -9 -33 0
d -9 -19 -33 0
d -19 2 7 30 -33 0
d -19 2 7 -33 0
d -19 2 -30 -33 0
d 2 -19 -33 0
d -19 -7 30 -33 0
d -7 -19 -33 0
d -30 -19 -33 0
d -19 -33 0
d 9 7 30 -2 -33 0
d 9 7 -2 -33 0
d 9 -30 -2 -33 0
d -2 9 -33 0
d 9 -7 30 -33 0
d -7 9 -33 0
d -30 9 -33 0
d 9 -33 0
d 2 7 30 -33 0
d 7 2 -33 0
d -30 2 -33 0
d 2 -33 0
d 30 -7 -33 0
d -7 -33 0
d -30 -33 0
-11 -32 -19 -9 -21 -26 -30 -31 -34 36 -11 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -36 -41 34 31 -30 26 21 -20 9 2 -7 19 -6 -32 5 10 0
-10 11 -32 -30 -10 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 -32 11 5 19 0
-30 11 -32 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 32 -11 10 5 -19 0
10 5 -30 10 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 -5 11 32 19 0
10 -30 10 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 -5 11 0
-30 -11 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -10 11 5 0
-30 -30 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -10 11 32 5 -19 0
-5 -32 -19 0
d -5 -32 30 -19 0
27 -18 14 -10 0
d 27 -18 14 30 -10 0
10 -18 -14 27 0
d 10 -18 -14 27 30 0
10 27 14 18 0
d 10 27 30 14 18 0
5 -32 19 0
d 5 -32 30 19 0
-10 -14 -27 -18 0
d -10 -14 -27 -18 30 0
-5 32 19 0
d -5 32 30 19 0
-14 -27 18 10 0
d -14 -27 18 10 30 0
10 14 -18 -27 0
d 10 14 30 -18 -27 0
5 32 -19 0
d 5 32 -19 30 0
-10 27 18 -14 0
d -10 27 18 30 -14 0
-10 -27 14 18 0
d -10 -27 30 14 18 0
d 5 19 -30 32 0
d 10 27 -18 -30 14 0
d -19 -5 -30 32 0
d 10 -18 -14 -27 -30 0
d 27 -18 -10 -14 -30 0
d -19 -32 5 -30 0
d -27 -14 -30 18 -10 0
d 10 27 -30 18 -14 0
d -18 14 -10 -27 -30 0
d 27 14 -30 -10 18 0
d 10 14 -30 18 -27 0
d -5 -32 -30 19 0
d -9 -21 -19 -32 -11 -26 -30 -31 -34 36 0
d -32 11 -10 -30 0
d 11 -32 -30 0
d 5 10 -30 0
d 10 -30 0
d -11 -30 0
-32 -10 -21 -26 -31 -34 -41 19 -32 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 -19 41 36 34 31 26 21 -20 10 -5 11 0
13 -41 -31 7 -2 -9 -11 5 32 13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 5 -19 -11 10 -9 -6 2 -7 34 -31 -20 21 41 36 3 0
-13 -31 -9 -11 5 32 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 5 -19 -11 10 -9 -6 -31 -3 0
-31 -9 -11 5 32 -31 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 5 -19 -11 10 -9 -6 13 3 0
-11 -9 5 32 -11 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 5 -19 10 9 6 -31 0
-11 31 5 32 -11 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 5 -19 10 -9 -6 -31 0
13 -11 5 32 13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 5 -19 -11 10 9 -31 6 3 0
-11 5 32 -11 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 5 -19 10 9 -31 6 -13 -3 0
5 32 5 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 -19 11 -10 0
11 32 11 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 -5 19 10 0
32 32 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 -5 19 -11 -10 0
-19 -5 0
d -19 -5 -32 0
41 -17 28 11 -29 0
d 41 -17 28 11 -32 -29 0
41 11 29 -17 -28 0
d 41 11 29 -17 -28 -32 0
28 29 17 -11 -41 0
d 28 29 17 -11 -32 -41 0
41 -28 11 17 -29 0
d 41 -28 11 17 -29 -32 0
41 -28 -11 -17 -29 0
d 41 -28 -11 -17 -29 -32 0
41 -17 -11 28 29 0
d 41 -17 -32 -11 28 29 0
41 -28 29 17 -11 0
d 41 -28 29 -32 17 -11 0
-28 29 -17 -41 -11 0
d -28 29 -17 -32 -41 -11 0
-41 11 -17 -29 -28 0
d -41 11 -32 -17 -29 -28 0
5 19 0
d 5 19 -32 0
-29 -41 28 -17 -11 0
d -29 -41 -32 28 -17 -11 0
-28 -41 29 11 17 0
d -28 -41 29 11 17 -32 0
-41 11 28 -29 17 0
d -41 11 28 -29 17 -32 0
-29 17 -41 -28 -11 0
d -29 17 -41 -28 -11 -32 0
-41 28 29 11 -17 0
d -41 28 29 -32 11 -17 0
41 11 17 28 29 0
d 41 11 -32 17 28 29 0
17 28 -11 -29 41 0
d 17 28 -11 -32 -29 41 0
-10 -21 -26 -31 -34 -41 19 0
d -10 -21 -32 -26 -31 -34 -41 19 0
d 11 -17 29 41 28 32 0
d 11 29 -28 -41 32 -17 0
d -17 -28 -41 -11 32 -29 0
d -17 28 32 -11 -41 29 0
d -28 -29 41 -11 32 17 0
d 28 -29 -41 32 -11 17 0
d 11 -29 41 17 32 28 0
d 11 -29 -41 32 -17 28 0
d 29 -28 -41 -11 17 32 0
d 29 41 -11 28 17 32 0
d 11 29 -41 28 32 17 0
d 19 -5 32 0
d -17 -29 28 -11 41 32 0
d 11 -28 -29 17 32 -41 0
d 11 -29 -28 32 -17 41 0
d -19 5 32 0
d 11 17 32 41 29 -28 0
d -17 -28 -11 29 32 41 0
d 5 7 13 -41 -2 -31 -9 -11 32 0
d 5 -31 -13 -9 -11 32 0
d 5 -31 -9 -11 32 0
d 5 -9 -11 32 0
d 5 31 -11 32 0
d 5 13 -11 32 0
d -11 5 32 0
d 5 32 0
d 11 32 0
-34 -7 -20 -24 -25 -36 19 -34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 -19 5 36 41 -25 24 -20 21 7 2 0
-2 -11 -5 34 -20 -25 -2 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 -25 -20 21 34 7 5 -19 11 -10 0
-13 9 -5 -2 34 -20 -25 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 25 20 -21 -34 2 7 5 -19 -11 10 9 -31 6 -3 0
13 6 -31 9 13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -31 6 -19 5 3 0
6 -31 9 6 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -31 -19 5 -13 -3 0
-13 -31 9 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -31 -6 19 -5 -3 0
-31 9 -31 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -6 19 -5 13 3 0
13 -6 9 13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 31 -6 19 -5 3 0
-6 9 -6 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 31 19 -5 -13 -3 0
-13 -20 -25 9 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 31 6 -19 5 -3 25 20 -21 -2 0
-13 34 -25 9 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 31 6 -19 5 -3 25 -20 21 2 -34 7 0
-25 -13 9 -25 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 31 6 -19 5 -13 -3 20 -34 -21 -2 -7 0
-34 20 -13 9 -34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 31 6 -19 5 -13 -3 25 20 -21 -2 -7 0
-13 20 9 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 31 6 -19 5 -3 -25 -20 21 2 -34 7 0
-13 9 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 31 6 -19 5 -3 -25 20 -21 -2 0
9 -20 25 9 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 31 6 -19 5 13 3 -25 20 -21 -2 0
9 34 25 9 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 31 6 13 -19 3 5 -25 -20 21 2 -34 7 0
25 9 25 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 31 6 13 -19 3 5 20 -34 -21 -2 -7 0
-34 20 9 -34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 31 6 13 -19 3 5 -25 20 -21 -2 -7 0
9 20 9 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 31 6 13 -19 3 5 25 -20 21 2 -34 7 0
9 9 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 31 6 13 25 20 -19 3 -21 -2 5 0
2 -20 31 0
d 2 -20 31 -9 0
6 19 0
d 6 19 -9 0
-31 -20 -2 0
d -31 -20 -2 -9 0
-19 -6 0
d -19 -6 -9 0
20 -31 2 0
d 20 -31 -9 2 0
-2 31 20 0
d -2 31 20 -9 0
d -19 6 9 0
d 2 20 9 31 0
d -2 -20 31 9 0
d -31 -20 9 2 0
d 19 -6 9 0
d -31 -2 9 20 0
d -20 -2 9 34 -5 -25 -13 0
d -31 13 6 9 0
d 6 -31 9 0
d -13 -31 9 0
d -31 9 0
d 13 -6 9 0
d -6 9 0
d -13 -25 -20 9 0
d -13 34 -25 9 0
d -25 -13 9 0
d -13 -34 20 9 0
d 20 -13 9 0
d -13 9 0
d -20 25 9 0
d 34 25 9 0
d 25 9 0
d -34 20 9 0
d 20 9 0
-25 -31 -34 -2 -13 -15 -29 19 -25 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -19 5 6 29 15 13 3 -2 -34 -7 31 20 -21 -14 0
25 20 -34 -2 25 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -34 -7 20 -21 31 0
20 -34 -2 20 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -34 -7 -21 31 -25 0
-25 -34 -2 -25 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -34 -7 -20 21 -31 0
-34 -2 -34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -7 -20 21 -31 25 0
25 -20 -2 25 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 34 7 -20 21 -31 0
-20 -2 -20 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 34 7 21 -31 -25 0
-25 -2 -25 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 34 7 20 -21 31 0
-29 -41 11 -13 -6 -2 -29 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 34 7 20 -21 31 25 6 -19 5 13 3 -11 10 -41 -36 0
29 -41 -2 29 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 34 20 25 7 -21 31 -41 -36 0
-41 -2 -41 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 34 20 25 7 -21 31 -36 -29 0
-2 -2 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 34 20 25 7 -21 31 -41 -36 0
34 -7 0
d 34 -7 2 0
31 -20 0
d 31 -20 2 0
-31 20 0
d -31 20 2 0
7 -34 0
d 7 -34 2 0
d -7 -34 -2 0
d -31 -20 -2 0
d 7 34 -2 0
d 31 20 -2 0
d -20 -11 34 -25 -5 -2 0
d -34 -29 19 -2 -13 -15 -31 -25 0
d -34 20 25 -2 0
d 20 -34 -2 0
d -25 -34 -2 0
d -34 -2 0
d 25 -20 -2 0
d -20 -2 0
d -25 -2 0
d -41 -13 11 -6 -29 -2 0
d 29 -41 -2 0
d -41 -2 0
-25 -36 -20 -7 -13 -15 -29 19 -25 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -19 5 6 29 -15 13 3 7 34 20 -21 31 14 36 41 -24 1 -8 0
-8 -25 -15 -8 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -25 0
-25 -15 -25 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 8 0
-20 -34 8 -15 -20 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -25 8 34 7 -1 21 -31 -14 0
8 -15 8 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 25 0
-15 -1 -15 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 25 -8 1 -34 -7 0
20 -15 20 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -25 -8 1 34 7 -21 31 14 0
-15 -15 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -25 -8 1 34 7 -20 21 -31 -14 0
-25 -21 14 0
d -25 -21 14 15 0
-8 -26 -28 0
d -8 -26 15 -28 0
21 -25 -14 0
d 21 -25 15 -14 0
8 26 -28 0
d 8 26 15 -28 0
8 -26 28 0
d 8 -26 28 15 0
-14 -21 25 0
d -14 -21 25 15 0
21 14 25 0
d 21 14 15 25 0
-8 26 28 0
d -8 26 15 28 0
d 28 -26 -15 -8 0
d -25 -14 -21 -15 0
d -28 26 -15 -8 0
d -25 21 -15 14 0
d 8 26 28 -15 0
d 14 -21 -15 25 0
d 8 -28 -15 -26 0
d -14 21 25 -15 0
d -36 -25 -29 -20 -7 -15 -13 19 0
d -8 -25 -15 0
d -25 -15 0
d 8 -20 -34 -15 0
d 8 -15 0
d -1 -15 0
d 20 -15 0
-13 -20 -7 -8 -14 -29 19 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -19 5 6 29 14 -3 8 7 34 20 -21 31 -25 -1 -24 0
-24 -13 -24 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -13 -3 0
-25 -1 -8 -13 -25 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 13 3 -24 8 -1 -31 -20 21 34 -14 7 0
25 -31 -1 25 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 -31 -20 21 14 0
-31 -1 -31 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 -20 21 -25 -14 0
-25 -1 -25 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 31 20 -21 14 0
-1 -1 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 31 20 -21 25 -14 0
34 -25 8 0
d 34 -25 1 8 0
8 -34 25 0
d 8 -34 25 1 0
13 24 31 0
d 13 24 31 1 0
34 -8 25 0
d 34 -8 1 25 0
-24 -13 31 0
d -24 -13 1 31 0
-25 -8 -34 0
d -25 -8 1 -34 0
13 -31 -24 0
d 13 -31 1 -24 0
-31 -13 24 0
d -31 -13 1 24 0
d 34 8 -1 25 0
d -25 34 -1 -8 0
d -25 -34 -1 8 0
d -13 -24 -31 -1 0
d 24 -13 -1 31 0
d -8 -34 -1 25 0
d 13 -24 -1 31 0
d -31 24 13 -1 0
d -13 -8 -1 -25 0
d 25 -31 -1 0
d -31 -1 0
d -25 -1 0
-13 -7 -27 -28 19 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 -19 5 6 28 27 7 34 -3 24 -31 -20 21 0
-29 41 -8 25 24 13 -29 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 -13 -3 -24 31 20 -21 -25 14 8 34 7 41 36 0
29 41 29 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 0
41 41 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 36 -29 0
29 28 17 -11 0
d 29 28 17 -11 -41 0
29 -17 -28 -11 0
d 29 -17 -28 -11 -41 0
12 -29 -27 0
d 12 -29 -27 -36 0
27 -29 -12 0
d 27 -29 -12 -36 0
-17 11 -28 -29 0
d -17 11 -28 -41 -29 0
-11 -29 -17 28 0
d -11 -29 -17 28 -41 0
29 -12 -27 0
d 29 -12 -27 -36 0
11 17 -28 29 0
d 11 17 -41 -28 29 0
17 28 11 -29 0
d 17 28 11 -29 -41 0
-11 -29 17 -28 0
d -11 -29 17 -41 -28 0
29 28 11 -17 0
d 29 28 11 -17 -41 0
27 29 12 0
d 27 29 -36 12 0
-10 -31 -21 -34 -26 19 0
d -10 -31 -21 -41 -34 -26 19 0
-25 -24 -20 -7 -34 19 0
d -25 -24 -20 -36 -7 -34 19 0
d 29 12 36 -27 0
d 28 -17 -29 41 11 0
d -41 36 0
d 29 -17 11 41 -28 0
d 29 27 -12 36 0
d 11 -28 41 17 -29 0
d -28 -17 41 -29 -11 0
d 29 28 -17 -11 41 0
d 29 -28 -11 41 17 0
d -27 -12 36 -29 0
d -36 41 0
d 12 27 36 -29 0
d 29 28 17 41 11 0
d 28 -11 17 41 -29 0
d -8 25 41 -29 24 13 0
d 29 41 0
-13 -8 -17 19 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -19 5 6 17 8 -3 24 -31 -20 21 0
-6 11 -8 25 -29 24 13 -6 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -13 -3 -24 31 20 -21 29 25 -14 8 -34 -7 19 -5 -11 -10 0
10 13 -6 -34 -14 25 10 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -25 -14 21 -20 -31 34 7 8 -6 19 -5 11 -13 -3 24 0
-13 -31 0
10 -6 -14 -31 10 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 -13 21 -3 24 -14 -25 -6 19 -5 -34 11 -7 -8 0
-6 -14 -31 -6 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 -13 21 -3 24 -14 -25 19 -5 -10 -11 0
-10 -14 -31 -10 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 -13 21 -3 24 -14 -25 6 -19 5 11 0
-14 -31 -14 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 -13 21 -3 24 -25 6 -19 5 10 -11 0
10 6 -31 10 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 -13 21 -3 24 14 25 6 -19 5 -11 0
6 -31 6 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 -13 21 -3 24 14 25 -19 5 -10 11 0
-10 -31 -10 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 -13 21 -3 24 14 25 -6 19 -5 -11 0
-31 -31 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -20 13 21 3 -24 14 25 -6 19 -5 10 11 0
-25 14 0
d -25 14 -21 0
13 24 0
d 13 24 31 0
-13 -24 0
d -13 -24 31 0
-14 25 0
d -14 25 -21 0
d -21 -20 0
d -25 -14 21 0
d -20 31 0
d 20 -31 0
d 25 14 21 0
d -24 13 -31 0
d 21 20 0
d 24 -13 -31 0
d -10 -31 -21 -26 19 -34 0
d -24 -25 19 -20 -34 -7 0
d -13 -29 -14 -7 -20 19 -8 0
d -13 -31 0
d -14 10 -6 -31 0
d -6 -14 -31 0
d -10 -14 -31 0
d -14 -31 0
d 10 6 -31 0
d 6 -31 0
d -10 -31 0
-13 -7 -29 -25 19 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -19 5 6 25 14 29 7 34 -8 -3 24 0
-34 -29 10 -6 -14 13 -34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -13 -3 24 -14 -25 -6 19 -5 10 11 -7 -8 29 0
-34 13 10 -6 -14 -34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -6 19 -5 10 11 -7 -8 -13 -3 24 -29 0
-34 10 -6 -14 -34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -6 19 -5 10 11 -7 -8 -13 -3 24 -29 0
-13 10 -6 -14 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 14 25 6 -19 5 -10 11 -34 -7 8 -3 24 -17 0
10 29 -6 -14 13 10 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -13 -3 24 -14 -25 -6 19 -5 34 11 7 8 -29 0
10 -6 -14 10 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -6 19 -5 -13 34 11 29 -3 24 7 8 0
34 -29 13 -6 -14 34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -6 19 -5 -10 -11 7 8 -13 -3 24 29 0
34 13 -6 -14 34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -6 19 -10 -5 -11 7 8 -13 -3 24 -29 0
34 -6 -14 34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 6 -19 -10 5 11 7 8 -13 17 -3 24 0
-13 11 -10 -14 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 14 25 10 -11 5 -19 6 34 7 -8 -3 24 -29 0
17 11 -10 -14 13 17 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -13 -3 24 -14 -25 -10 11 5 -19 6 -34 -7 -8 0
11 -10 -14 11 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -10 -13 5 -17 -3 24 -19 6 -34 -7 -8 0
-34 -17 -10 -14 -34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -10 -11 -5 19 -6 -17 -7 -8 0
-17 -10 -14 -17 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -10 -11 -5 19 -6 34 7 8 0
34 -10 -14 34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -10 -11 -5 19 -6 17 7 8 0
-10 -14 -10 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -11 -5 19 -6 17 -34 -7 -8 0
-34 17 -14 -34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 10 -6 19 -5 11 17 -7 -8 0
17 -14 17 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 10 -6 19 -5 11 34 7 8 0
34 -14 34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 10 -6 19 -5 11 -17 7 8 0
-14 -14 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -25 10 -6 19 -5 11 -17 -34 -7 -8 0
27 -18 -10 0
d 27 -18 -10 14 0
8 -34 0
d 8 -34 25 0
27 10 18 0
d 27 10 14 18 0
-8 34 0
d -8 34 25 0
10 -18 -27 0
d 10 -18 14 -27 0
-10 -27 18 0
d -10 -27 18 14 0
-29 -8 -6 11 24 13 0
d -29 -8 -6 11 25 24 13 0
d -25 14 0
d 8 34 -25 0
d 27 -18 10 -14 0
d -10 -27 -18 -14 0
d 18 -27 -14 10 0
d -14 25 0
d -8 -34 -25 0
d -10 27 18 -14 0
d -14 25 13 -34 10 -6 0
d 19 -13 -7 -25 -29 0
d -6 10 13 -14 -29 -34 0
d -6 10 13 -34 -14 0
d -6 10 -34 -14 0
d -6 -13 10 -14 0
d -6 29 10 -14 13 0
d -6 10 -14 0
d -6 34 13 -29 -14 0
d -6 34 13 -14 0
d 34 -6 -14 0
d -10 -13 11 -14 0
d -10 17 11 -14 13 0
d 11 -10 -14 0
d -10 -17 -34 -14 0
d -17 -10 -14 0
d 34 -10 -14 0
d -10 -14 0
d -34 17 -14 0
d 17 -14 0
d 34 -14 0
-24 -29 34 -24 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -34 -7 -8 29 13 3 0
-29 34 -17 11 10 24 -29 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -24 13 3 10 -11 5 -19 6 -17 34 7 8 -28 26 0
5 29 34 -17 10 5 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -10 -19 11 6 17 -34 -7 -8 -29 -28 -26 0
34 -17 11 10 5 0
-29 24 -17 11 5 -29 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 -11 10 -17 34 7 8 -28 26 -24 13 3 0
-29 -17 10 5 -29 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 -10 11 17 34 7 8 -28 24 26 -13 -3 0
-17 29 11 5 -17 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 11 -10 -29 -34 28 -7 -8 26 0
26 -34 17 11 5 26 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 11 -10 -17 34 7 8 -28 29 0
28 17 -26 11 5 28 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 11 -10 -26 8 34 7 -17 -29 0
28 -26 10 5 11 0
-26 11 5 -26 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 -11 10 28 8 34 7 17 -29 24 -13 -3 0
5 8 10 5 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -19 6 -10 11 26 -8 -34 28 -7 -17 -29 0
10 5 0
-17 24 -8 26 5 -17 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 10 6 -11 -26 8 34 28 7 29 -24 13 3 0
-17 -8 26 5 -17 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 10 6 -11 -26 8 34 28 24 7 29 -13 -3 0
26 -17 5 26 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 10 6 -11 -17 8 34 -28 7 -29 0
8 -17 5 8 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 10 6 -11 17 26 34 -28 7 29 24 -13 -3 0
24 28 -8 5 24 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -5 19 10 -6 11 8 34 7 -28 26 -13 -3 0
28 -8 5 -24 28 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 24 -13 -3 5 -19 10 6 -11 8 34 7 -26 0
26 -28 5 26 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 10 6 -11 -28 -17 8 -29 34 7 0
-28 5 -28 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 10 6 -11 -26 -8 -34 -17 -7 -29 0
-8 28 5 0
5 5 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 -19 10 6 -11 -28 8 34 17 26 7 29 24 -13 -3 0
24 -18 26 4 3 0
d 24 -18 -6 26 4 3 0
24 4 -26 18 3 0
d 24 4 -26 18 -6 3 0
24 -26 3 -4 -18 0
d 24 -26 3 -6 -4 -18 0
-3 4 -24 -18 26 0
d -3 4 -24 -6 -18 26 0
4 -26 -3 18 -24 0
d 4 -26 -3 -6 18 -24 0
-11 -10 0
d -11 -10 -5 0
11 10 0
d 11 10 -5 0
24 -3 18 -26 -4 0
d 24 -3 18 -26 -4 -6 0
4 -26 3 -24 -18 0
d 4 -26 3 -24 -18 -6 0
-3 18 -4 26 -24 0
d -3 18 -6 -4 26 -24 0
-4 3 26 -24 -18 0
d -4 3 26 -24 -18 -6 0
24 -3 -18 -26 4 0
d 24 -3 -18 -26 4 -6 0
4 3 26 -24 18 0
d 4 3 26 -24 18 -6 0
24 -4 3 26 18 0
d 24 -4 3 -6 26 18 0
-18 26 24 -4 -3 0
d -18 26 24 -6 -4 -3 0
-3 -24 -4 -18 -26 0
d -3 -24 -4 -6 -18 -26 0
26 18 4 24 -3 0
d 26 18 4 24 -3 -6 0
18 3 -26 -4 -24 0
d 18 3 -26 -4 -6 -24 0
-13 -7 -27 -28 0
d -13 -7 -27 19 -28 0
-17 -8 -13 0
d -17 -8 -13 19 0
11 24 -29 13 -8 0
d 11 24 -29 13 -6 -8 0
d 3 4 6 18 26 24 0
d -19 -5 0
d 4 -18 6 24 -3 26 0
d -4 -24 -3 -26 18 6 0
d 11 -10 5 0
d 4 3 26 -24 6 -18 0
d 3 -24 -18 -26 -4 6 0
d -24 4 6 26 -3 18 0
d -24 -3 6 -26 4 -18 0
d 19 5 0
d 3 -4 26 24 -18 6 0
d 6 19 0
d -24 18 6 4 3 -26 0
d 18 3 -24 6 26 -4 0
d -6 -19 0
d -4 18 24 26 -3 6 0
d 3 -4 -26 24 18 6 0
d -3 -26 24 -18 6 -4 0
d 3 4 6 -26 -18 24 0
d -11 10 5 0
d -3 -26 24 18 4 6 0
d -24 -18 -4 -3 6 26 0
d 10 29 34 5 -17 0
d 11 34 -17 10 5 0
d 11 -29 24 -17 5 0
d 10 -29 -17 5 0
d 11 29 -17 5 0
d 11 17 -34 26 5 0
d 11 28 17 5 -26 0
d 11 28 10 5 -26 0
d 11 -26 5 0
d 8 10 5 0
d 10 5 0
d -17 -8 24 26 5 0
d -17 26 5 -8 0
d -17 26 5 0
d -17 8 5 0
d 24 -8 28 5 0
d -24 -8 5 28 0
d 26 -28 5 0
d -28 5 0
d -8 28 5 0
-11 -29 -13 -27 34 -11 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 27 -13 -3 24 10 18 29 12 0
18 -11 -13 34 18 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -13 -3 24 -11 10 27 29 12 0
29 -11 -13 34 29 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -13 -3 24 -11 10 18 27 12 0
-11 -13 34 -11 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -13 -3 24 10 18 27 29 12 0
-13 12 27 34 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -3 24 11 -10 -27 18 -12 29 0
-13 18 34 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -3 24 11 -10 -18 27 12 29 0
-13 29 34 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -3 24 11 18 -10 -27 -29 12 0
-13 34 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -3 24 11 -18 29 -10 27 12 0
34 -27 11 34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 7 8 -13 -3 24 29 -11 10 27 18 12 0
34 11 -12 34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 7 8 -13 -3 24 29 12 27 -11 10 18 0
27 34 27 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -13 -3 24 29 12 11 -10 -18 0
34 34 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 7 8 -13 -3 24 29 27 12 11 -10 -18 0
-12 -17 -4 0
d -12 -17 -7 -4 0
-28 -26 0
d -28 -26 -8 0
12 -4 17 0
d 12 -4 -7 17 0
-12 17 4 0
d -12 17 4 -7 0
12 -17 4 0
d 12 -17 -7 4 0
26 28 0
d 26 28 -8 0
-13 -27 -28 0
d -13 -27 -7 -28 0
-17 -13 0
d -17 -13 -8 0
13 -29 24 11 0
d 13 -29 -8 24 11 0
d -7 34 0
d -4 -17 12 7 0
d 8 -34 0
d 26 -28 8 0
d -26 28 8 0
d -12 17 -4 7 0
d -8 34 0
d -12 -17 7 4 0
d 7 -34 0
d 4 17 12 7 0
d -29 -24 34 0
d 11 10 -17 24 34 -29 0
d -29 -11 -13 -27 34 0
d -13 -11 18 34 0
d -13 -11 29 34 0
d -11 -13 34 0
d 12 -13 27 34 0
d 18 -13 34 0
d 29 -13 34 0
d -13 34 0
d 11 -27 34 0
d 11 -12 34 0
d 27 34 0
-13 -26 10 -13 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -10 11 -26 28 -3 24 17 29 0
-29 17 13 -26 -29 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -26 28 -13 -3 24 17 -11 10 0
17 13 29 -26 17 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -26 28 -29 -11 10 -13 -3 24 0
17 29 -26 17 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -26 28 -29 -11 -13 10 -3 24 0
17 -26 28 0
-29 -26 -29 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -26 28 17 -13 -3 24 -11 10 0
-26 -26 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 28 -17 -13 -3 24 29 -11 10 0
24 -18 3 4 0
d 24 -18 3 4 26 0
-3 -18 -24 4 0
d -3 -18 26 -24 4 0
-17 29 -11 0
d -17 29 -11 -28 0
11 -17 -29 0
d 11 -17 -28 -29 0
-3 18 -24 -4 0
d -3 18 -24 -4 26 0
-24 3 -4 -18 0
d -24 3 -4 -18 26 0
11 29 17 0
d 11 29 17 -28 0
-29 17 -11 0
d -29 17 -28 -11 0
4 3 -24 18 0
d 4 3 26 -24 18 0
18 -4 24 3 0
d 18 -4 26 24 3 0
-3 24 -4 -18 0
d -3 24 -4 -18 26 0
24 -3 4 18 0
d 24 -3 4 18 26 0
-27 -13 0
d -27 -13 -28 0
d 3 24 4 18 -26 0
d 3 24 -26 -4 -18 0
d 17 29 28 -11 0
d -24 -3 4 18 -26 0
d -26 -28 0
d -4 24 -3 18 -26 0
d -11 -29 -17 28 0
d 4 -18 3 -24 -26 0
d -3 -18 -26 4 24 0
d 17 -29 11 28 0
d 11 29 -17 28 0
d -24 -3 -4 -18 -26 0
d -4 18 -24 3 -26 0
d 28 26 0
d 10 -13 -26 0
d 13 -29 17 -26 0
d 13 17 29 -26 0
d 29 17 -26 0
d 17 -26 28 0
d -29 -26 0
-24 -12 11 -24 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -26 28 -11 10 13 3 12 0
29 -17 3 -24 0
-17 -24 -17 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -26 28 24 -13 -3 29 -11 10 0
-29 -24 3 17 0
-24 -24 -23 -39 -44 -16 -22 43 38 -37 35 -42 -40 -33 -30 32 9 -2 -15 -1 41 36 -31 -20 21 -14 -25 5 -19 6 34 7 8 -26 28 13 -17 3 29 -11 10 0
-18 -10 0
d -18 -10 27 0
18 10 0
d 18 10 27 0
-12 -29 0
d -12 -29 27 0
-4 12 0
d -4 12 17 0
4 -12 0
d 4 -12 17 0
11 29 0
d 11 29 17 0
-11 -29 0
d -11 -29 17 0
12 29 0
d 12 29 27 0
-4 -18 0
d -4 -18 24 -3 0
4 18 0
d 4 18 24 -3 0
d -18 3 24 4 0
d -18 4 -24 -3 0
d -3 13 0
d -17 -12 -4 0
d 3 -13 0
d -17 29 -11 0
d -27 -29 12 0
d -17 -29 11 0
d 13 24 0
d -4 18 -3 -24 0
d -27 -12 29 0
d -18 -4 -24 3 0
d -17 12 4 0
d -13 -24 0
d 4 18 -24 3 0
d -4 18 3 24 0
d -18 -27 10 0
d -27 -10 18 0
d -24 -13 0
d -27 -13 0
d -17 -13 0
d 13 24 -29 11 0
d -12 11 -24 0
d 29 -17 3 -24 0
d -17 -24 0
d -29 -24 3 17 0
29 0
0
| 30.782106 | 156 | 0.530381 |
fc9fdbbd4d316c4c87c4734f0e6e2652a67d2102 | 1,282 | dpr | Pascal | components/jcl/packages/d15/JclProjectAnalysisExpertDLL.dpr | padcom/delcos | dc9e8ac8545c0e6c0b4e963d5baf0dc7d72d2bf0 | [
"Apache-2.0"
]
| 15 | 2016-08-24T07:32:49.000Z | 2021-11-16T11:25:00.000Z | components/jcl/packages/d15/JclProjectAnalysisExpertDLL.dpr | CWBudde/delcos | 656384c43c2980990ea691e4e52752d718fb0277 | [
"Apache-2.0"
]
| 1 | 2016-08-24T19:00:34.000Z | 2016-08-25T19:02:14.000Z | components/jcl/packages/d15/JclProjectAnalysisExpertDLL.dpr | padcom/delcos | dc9e8ac8545c0e6c0b4e963d5baf0dc7d72d2bf0 | [
"Apache-2.0"
]
| 4 | 2015-11-06T12:15:36.000Z | 2018-10-08T15:17:17.000Z | Library JclProjectAnalysisExpertDLL;
{
-----------------------------------------------------------------------------
DO NOT EDIT THIS FILE, IT IS GENERATED BY THE PACKAGE GENERATOR
ALWAYS EDIT THE RELATED XML FILE (JclProjectAnalysisExpertDLL-L.xml)
Last generated: 07-08-2010 10:35:04 UTC
-----------------------------------------------------------------------------
}
{$R *.res}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO OFF}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS OFF}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO OFF}
{$SAFEDIVIDE OFF}
{$STACKFRAMES OFF}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST ON}
{$MINENUMSIZE 1}
{$IMAGEBASE $58060000}
{$DESCRIPTION 'JCL Project Analyzer'}
{$LIBSUFFIX '150'}
{$IMPLICITBUILD OFF}
{$DEFINE BCB}
{$DEFINE WIN32}
{$DEFINE CONDITIONALEXPRESSIONS}
{$DEFINE RELEASE}
uses
ToolsAPI,
JclProjectAnalyzerFrm in '..\..\experts\projectanalyzer\JclProjectAnalyzerFrm.pas' {ProjectAnalyzerForm},
JclProjectAnalyzerImpl in '..\..\experts\projectanalyzer\JclProjectAnalyzerImpl.pas'
;
exports
JCLWizardInit name WizardEntryPoint;
end.
| 24.653846 | 108 | 0.620905 |
fc18c4dd25ec452ffb35f7f7178f4f0add9a73af | 3,412 | pas | Pascal | Simulator/src/Options.pas | KoRiF/annsi | 735ecf91e5038b761fe3a3ca33b34ba9c2ca4aa4 | [
"MIT"
]
| null | null | null | Simulator/src/Options.pas | KoRiF/annsi | 735ecf91e5038b761fe3a3ca33b34ba9c2ca4aa4 | [
"MIT"
]
| null | null | null | Simulator/src/Options.pas | KoRiF/annsi | 735ecf91e5038b761fe3a3ca33b34ba9c2ca4aa4 | [
"MIT"
]
| 1 | 2022-01-27T09:12:23.000Z | 2022-01-27T09:12:23.000Z | unit Options;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, ComCtrls, StdCtrls;
type
Tsettings = class(TForm)
Label1: TLabel;
TrackBar1: TTrackBar;
Label2: TLabel;
Panel1: TPanel;
cld: TColorDialog;
Label3: TLabel;
Panel2: TPanel;
Panel3: TPanel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Button1: TButton;
Label10: TLabel;
Label11: TLabel;
procedure Panel1Click(Sender: TObject);
procedure Panel2Click(Sender: TObject);
procedure TrackBar1Change(Sender: TObject);
procedure Label5Click(Sender: TObject);
procedure Label8Click(Sender: TObject);
procedure Label6Click(Sender: TObject);
procedure Label7Click(Sender: TObject);
procedure Label9Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Label10Click(Sender: TObject);
procedure Label11Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
gridcolor:TColor;
bgcolor:TColor;
scrollspeed:integer;
nsel:TColor;
nin:TColor;
nout:TColor;
nmid:TColor;
conn:TColor;
sel:TColor;
font:tcolor;
end;
var
settings: Tsettings;
implementation
uses MainUnit;
{$R *.dfm}
procedure Tsettings.Panel1Click(Sender: TObject);
begin
if (cld.Execute) then
begin
Panel1.Color := cld.Color;
MainForm.Color := cld.Color;
end;
end;
procedure Tsettings.Panel2Click(Sender: TObject);
begin
if (cld.Execute) then
begin
Panel2.Color := cld.Color;
end;
end;
procedure Tsettings.TrackBar1Change(Sender: TObject);
begin
scrollspeed := TrackBar1.Position;
end;
procedure Tsettings.Label5Click(Sender: TObject);
begin
if (cld.Execute) then
begin
Label5.Color := cld.Color;
end;
end;
procedure Tsettings.Label8Click(Sender: TObject);
begin
if (cld.Execute) then
begin
Label8.Color := cld.Color;
end;
end;
procedure Tsettings.Label6Click(Sender: TObject);
begin
if (cld.Execute) then
begin
Label6.Color := cld.Color;
end;
end;
procedure Tsettings.Label7Click(Sender: TObject);
begin
if (cld.Execute) then
begin
Label7.Color := cld.Color;
end;
end;
procedure Tsettings.Label9Click(Sender: TObject);
begin
if (cld.Execute) then
begin
Label9.Color := cld.Color;
end;
end;
procedure Tsettings.Button1Click(Sender: TObject);
begin
conn := Label9.Color;
nout := Label7.Color;
nin := Label6.Color;
nmid := Label8.Color;
nsel := Label5.Color;
scrollspeed := TrackBar1.Position;
conn := Label9.Color;
gridcolor := Panel2.Color;
bgcolor := Panel1.Color;
sel := Label10.Color;
font:=Label11.color;
Close();
end;
procedure Tsettings.FormShow(Sender: TObject);
begin
Label9.Color := conn;
Label7.Color := nout;
Label6.Color := nin;
Label8.Color := nmid;
Label5.Color := nsel;
TrackBar1.Position := scrollspeed;
Label9.Color := conn;
Panel2.Color:=gridcolor;
Panel1.Color:=bgcolor;
Label10.Color := sel;
Label11.Color := font;
end;
procedure Tsettings.Label10Click(Sender: TObject);
begin
if (cld.Execute) then
begin
Label10.Color := cld.Color;
end;
end;
procedure Tsettings.Label11Click(Sender: TObject);
begin
if (cld.Execute) then
begin
Label11.Color := cld.Color;
end;
end;
end.
| 19.497143 | 76 | 0.701934 |
8571b56f049925db7c55cccd22606f0bc20f056d | 418 | pas | Pascal | src/TNsRestFramework.Infrastructure.Services.Logger.pas | turric4n/TNs_HTTPRestFramework | 9cdd7662db623281cc24c72177da16b4d9f7e008 | [
"Apache-2.0"
]
| 17 | 2018-05-09T13:33:30.000Z | 2022-01-04T19:04:24.000Z | src/TNsRestFramework.Infrastructure.Services.Logger.pas | exilon/TNs_HTTPRestFramework | 751405c7b8a93fbf51350b75fa8c9499d444f63d | [
"Apache-2.0"
]
| 3 | 2018-04-23T07:39:25.000Z | 2019-07-31T17:42:49.000Z | src/TNsRestFramework.Infrastructure.Services.Logger.pas | turric4n/TNs_HTTPRestFramework | 9cdd7662db623281cc24c72177da16b4d9f7e008 | [
"Apache-2.0"
]
| 6 | 2018-05-09T13:35:29.000Z | 2021-02-21T04:24:41.000Z | unit TNsRestFramework.Infrastructure.Services.Logger;
interface
uses
TNsRestFramework.Infrastructure.Interfaces.Logger,
TNsRestFramework.Infrastructure.LoggerFactory;
type
TServiceLogger = class
class procedure Init;
end;
var
Logger : ILogger;
implementation
{ TServiceLogger }
class procedure TServiceLogger.Init;
begin
if Logger = nil then Logger := TLoggerFactory.CreateLogger;
end;
end.
| 13.933333 | 61 | 0.784689 |
470924c154c7fe0057541b1b8d89c8b78db5f788 | 3,027 | pas | Pascal | ez/ezutil.pas | ludoza/Chee | d41b79b2acff37a098a00a5cb15d1902e945e383 | [
"MIT"
]
| 2 | 2019-08-07T20:10:01.000Z | 2019-08-08T02:45:56.000Z | ez/ezutil.pas | ludoza/Chee | d41b79b2acff37a098a00a5cb15d1902e945e383 | [
"MIT"
]
| null | null | null | ez/ezutil.pas | ludoza/Chee | d41b79b2acff37a098a00a5cb15d1902e945e383 | [
"MIT"
]
| null | null | null | unit ezutil;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, fpjson, FPTimer;
type
{ TWriteDebug }
TWriteDebug = function(const S: string): integer of object;
{ TDispatcherItem }
TDispatcherItem = class(TCollectionItem)
private
fName: string;
fAction: TBasicAction;
protected
function GetDisplayName: string; override;
procedure SetDisplayName(const Value: string); override;
public
property Action: TBasicAction read fAction write fAction;
end;
{ TDispatcher }
TDispatcher = class(TCollection)
public
constructor Create(AItemClass: TCollectionItemClass);
function Trigger(aDisplayName: string): Boolean;
function Trigger(aDisplayName: string; aObj: TObject): Boolean;
end;
function ObjectToTag(aObject: TObject): PtrInt;
function TagToObject(aTag: PtrInt): TObject;
function JSONToTag(aJSON: TJSONObject): PtrInt;
function TagToJSON(aTag: PtrInt): TJSONObject;
function NewTimer(Intr: integer; Proc: TNotifyEvent; AEnable: boolean = false): TFPTimer;
implementation
{ TDispatcherItem }
function TDispatcherItem.GetDisplayName: string;
begin
inherited GetDisplayName; // do we actually want to call this?
Result:= fName;
end;
procedure TDispatcherItem.SetDisplayName(const Value: string);
begin
inherited SetDisplayName(Value);
fName := Value;
end;
{ TDispatcher }
constructor TDispatcher.Create(AItemClass: TCollectionItemClass);
begin
inherited Create(AItemClass);
end;
function TDispatcher.Trigger(aDisplayName: string): Boolean;
begin
result := self.Trigger(aDisplayName, nil);
end;
function TDispatcher.Trigger(aDisplayName: string; aObj: TObject): Boolean;
var
i : Integer;
vItem: TDispatcherItem;
begin
Result := False;
for i:= 0 to self.Count -1 do
begin
vItem := TDispatcherItem(self.Items[i]);
if aDisplayName = vItem.DisplayName then
try
if (aObj <> nil) then
begin
if vItem.Action.Tag <> 0 then raise Exception(ClassName + '.Action.Tag must be 0 to pass action arguments.');
vItem.Action.Tag := ObjectToTag(aObj);
end;
if vItem.Action.Execute then
begin
Result := True;
end;
finally
if (aObj <> nil) then
begin
vItem.Action.Tag := 0;
end;
end;
end;
end;
function ObjectToTag(aObject: TObject): PtrInt;
begin
Result := PtrInt(aObject)
end;
function TagToObject(aTag: PtrInt): TObject;
begin
Result := TJSONObject(aTag)
end;
function JSONToTag(aJSON: TJSONObject): PtrInt;
begin
Result := PtrInt(aJSON)
end;
function TagToJSON(aTag: PtrInt): TJSONObject;
begin
Result := TJSONObject(aTag)
end;
function NewTimer(Intr: integer; Proc: TNotifyEvent; AEnable: boolean
): TFPTimer;
begin
Result := TFPTimer.Create(nil);
Result.UseTimerThread:=false;
Result.Interval := Intr;
Result.OnTimer := Proc;
Result.Enabled := AEnable;
end;
end.
| 23.10687 | 120 | 0.682524 |
fc9c80a66f72826805d052a55d1e6970d92c5303 | 10,966 | pas | Pascal | dependencies/Indy10/Protocols/IdDICT.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| null | null | null | dependencies/Indy10/Protocols/IdDICT.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| null | null | null | dependencies/Indy10/Protocols/IdDICT.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| null | null | null | {
$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.8 10/26/2004 8:59:34 PM JPMugaas
Updated with new TStrings references for more portability.
Rev 1.7 2004.10.26 11:47:54 AM czhower
Changes to fix a conflict with aliaser.
Rev 1.6 7/6/2004 4:55:22 PM DSiders
Corrected spelling of Challenge.
Rev 1.5 6/11/2004 9:34:08 AM DSiders
Added "Do not Localize" comments.
Rev 1.4 6/11/2004 6:16:44 AM DSiders
Corrected spelling in class names, properties, and methods.
Rev 1.3 3/8/2004 10:08:48 AM JPMugaas
IdDICT now compiles with new code. IdDICT now added to palette.
Rev 1.2 3/5/2004 7:23:56 AM JPMugaas
Fix for one server that does not send a feature list in the banner as RFC
2229 requires.
Rev 1.1 3/4/2004 3:55:02 PM JPMugaas
Untested work with SASL.
Fixed a problem with multiple entries using default. If AGetAll is true, a
"*" is used for all of the databases. "!" is for just the first database an
entry is found in.
Rev 1.0 3/4/2004 2:44:16 PM JPMugaas
RFC 2229 DICT client. This is a preliminary version that was tested at
dict.org
}
unit IdDICT;
interface
{$I IdCompilerDefines.inc}
uses
Classes,
IdAssignedNumbers, IdComponent,
IdDICTCommon, IdSASLCollection, IdTCPClient, IdTCPConnection;
// TODO: MIME should be integrated into this.
type
TIdDICTAuthenticationType = (datDefault, datSASL);
const
DICT_AUTHDEF = datDefault;
DEF_TRYMIME = False;
type
TIdDICT = class(TIdTCPClient)
protected
FTryMIME: Boolean;
FAuthType : TIdDICTAuthenticationType;
FSASLMechanisms : TIdSASLEntries;
FServer : String;
FClient : String;
//feature negotiation stuff
FCapabilities : TStrings;
procedure InitComponent; override;
function IsCapaSupported(const ACapa : String) : Boolean;
procedure SetClient(const AValue : String);
procedure InternalGetList(const ACmd : String; AENtries : TCollection);
procedure InternalGetStrs(const ACmd : String; AStrs : TStrings);
public
{$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
constructor Create(AOwner: TComponent); reintroduce; overload;
{$ENDIF}
destructor Destroy; override;
procedure Connect; override;
procedure DisconnectNotifyPeer; override;
procedure GetDictInfo(const ADict : String; AResults : TStrings);
procedure GetSvrInfo(AResults : TStrings);
procedure GetDBList(ADB : TIdDBList);
procedure GetStrategyList(AStrats : TIdStrategyList);
procedure Define(const AWord, ADBName : String; AResults : TIdDefinitions); overload;
procedure Define(const AWord : String; AResults : TIdDefinitions; const AGetAll : Boolean = True); overload;
procedure Match(const AWord, ADBName, AStrat : String; AResults : TIdMatchList); overload;
procedure Match(const AWord, AStrat : String; AResults : TIdMatchList; const AGetAll : Boolean = True); overload;
procedure Match(const AWord : String; AResults : TIdMatchList; const AGetAll : Boolean = True); overload;
property Capabilities : TStrings read FCapabilities;
property Server : String read FServer;
published
property TryMIME : Boolean read FTryMIME write FTryMIME default DEF_TRYMIME;
property Client : String read FClient write SetClient;
property AuthType : TIdDICTAuthenticationType read FAuthType write FAuthType default DICT_AUTHDEF;
property SASLMechanisms : TIdSASLEntries read FSASLMechanisms write FSASLMechanisms;
property Port default IdPORT_DICT;
property Username;
property Password;
end;
implementation
uses
IdFIPS,
IdGlobal, IdGlobalProtocols, IdHash, IdHashMessageDigest, SysUtils;
const
DEF_CLIENT_FMT = 'Indy Library %s'; {do not localize}
{ TIdDICT }
{$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
constructor TIdDICT.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
end;
{$ENDIF}
procedure TIdDICT.Connect;
var
LBuf : String;
LFeat : String;
s : String;
LMD5: TIdHashMessageDigest5;
begin
LBuf := '';
FCapabilities.Clear;
FServer := '';
try
inherited Connect;
IOHandler.DefStringEncoding := IndyTextEncoding_UTF8;
GetResponse(220);
if LastCmdResult.Text.Count > 0 then begin
// 220 pan.alephnull.com dictd 1.8.0/rf on Linux 2.4.18-14 <auth.mime> <258510.25288.1078409724@pan.alephnull.com>
LBuf := LastCmdResult.Text[0];
//server
FServer := TrimRight(Fetch(LBuf,'<'));
//feature negotiation
LFeat := Fetch(LBuf,'>');
//One server I tested with has no feature negotiation at all and it returns something
//like this:
//220 dict.org Ho Ngoc Duc's DICT server 2.2 <1078465742246@dict.org>
if (IndyPos('@',LFeat)=0) and (IndyPos('<',LBuf)>0) then begin
BreakApart ( LFeat, '.', FCapabilities );
end else begin
LBuf := '<'+LFeat+'>';
end;
//LBuf is now for the APOP3 like Challenge
LBuf := Trim(LBuf);
end;
SendCmd('CLIENT '+FClient); {do not localize}
if FAuthType = datDefault then begin
if IsCapaSupported('auth') then begin {do not localize}
// RLebeau: why does this require FIPS?
if GetFIPSMode and (FPassword <> '') and (FUserName <> '') then begin
LMD5 := TIdHashMessageDigest5.Create;
try
S := LowerCase(LMD5.HashStringAsHex(LBuf+Password));
finally
LMD5.Free;
end;//try
SendCmd('AUTH ' + Username + ' ' + S, 230); {do not localize}
end;
end;
end else begin
FSASLMechanisms.LoginSASL('SASLAUTH',FHost, 'dict', ['230'], ['330'], Self, FCapabilities, ''); {do not localize}
end;
if FTryMIME and IsCapaSupported('MIME') then begin {do not localize}
SendCmd('OPTION MIME'); {do not localize}
end;
except
Disconnect(False);
raise;
end;
end;
procedure TIdDICT.Define(const AWord, ADBName : String; AResults : TIdDefinitions);
var LDef : TIdDefinition;
LBuf : String;
begin
AResults.BeginUpdate;
try
AResults.Clear;
SendCmd('DEFINE '+ ADBName + ' ' + AWord); {do not localize}
repeat
if (LastCmdResult.NumericCode div 100) = 1 then begin
//Good, we got a response
LBuf := LastCmdResult.Text[0];
case LastCmdResult.NumericCode of
151 :
begin
LDef := AResults.Add;
//151 "Stuart" wn "WordNet (r) 2.0"
IOHandler.Capture(LDef.Definition);
//Word
Fetch(LBuf,'"');
LDef.Word := Fetch(LBuf,'"');
//db Name
Fetch(LBuf);
LDef.DB.Name := Fetch(LBuf);
//DB Description
Fetch(LBuf,'"');
LDef.DB.Desc := Fetch(LBuf,'"');
end;
150 :
begin
// not sure what to do with the number
//get the defintions
end;
end;
Self.GetInternalResponse;
end else begin
Break;
end;
until False;
finally
AResults.EndUpdate;
end;
end;
procedure TIdDICT.Define(const AWord : String; AResults : TIdDefinitions; const AGetAll : Boolean = True);
begin
if AGetAll then begin
Define(AWord,'*',AResults);
end else begin
Define(AWord,'!',AResults);
end;
end;
destructor TIdDICT.Destroy;
begin
FreeAndNil(FSASLMechanisms);
FreeAndNil(FCapabilities);
inherited Destroy;
end;
procedure TIdDICT.DisconnectNotifyPeer;
begin
inherited DisconnectNotifyPeer;
SendCmd('QUIT', 221); {Do not Localize}
end;
procedure TIdDICT.GetDBList(ADB: TIdDBList);
begin
InternalGetList('SHOW DB', ADB); {do not localize}
end;
procedure TIdDICT.GetDictInfo(const ADict: String; AResults: TStrings);
begin
InternalGetStrs('SHOW INFO ' + ADict, AResults); {do not localize}
end;
procedure TIdDICT.GetStrategyList(AStrats: TIdStrategyList);
begin
InternalGetList('SHOW STRAT', AStrats); {do not localize}
end;
procedure TIdDICT.GetSvrInfo(AResults: TStrings);
begin
InternalGetStrs('SHOW SERVER', AResults); {do not localize}
end;
procedure TIdDICT.InitComponent;
begin
inherited InitComponent;
FCapabilities := TStringList.create;
FSASLMechanisms := TIdSASLEntries.Create(Self);
FPort := IdPORT_DICT;
FAuthType := DICT_AUTHDEF;
FHost := 'dict.org'; {do not localize}
FClient := IndyFormat(DEF_CLIENT_FMT, [gsIdVersion]);
end;
procedure TIdDICT.InternalGetList(const ACmd: String; AENtries: TCollection);
var
LEnt : TIdGeneric;
LS : TStrings;
i : Integer;
s : String;
begin
AEntries.BeginUpdate;
try
AEntries.Clear;
LS := TStringList.Create;
try
InternalGetStrs(ACmd,LS);
for i := 0 to LS.Count - 1 do begin
LEnt := AENtries.Add as TIdGeneric;
s := LS[i];
LEnt.Name := Fetch(s);
Fetch(s, '"');
LEnt.Desc := Fetch(s, '"');
end;
finally
FreeAndNil(LS);
end;
finally
AEntries.EndUpdate;
end;
end;
procedure TIdDICT.InternalGetStrs(const ACmd: String; AStrs: TStrings);
begin
AStrs.BeginUpdate;
try
AStrs.Clear;
SendCmd(ACmd);
if (LastCmdResult.NumericCode div 100) = 1 then begin
IOHandler.Capture(AStrs);
GetInternalResponse;
end;
finally
AStrs.EndUpdate;
end;
end;
function TIdDICT.IsCapaSupported(const ACapa: String): Boolean;
var
i : Integer;
begin
Result := False;
for i := 0 to FCapabilities.Count-1 do begin
Result := TextIsSame(ACapa, FCapabilities[i]);
if Result then begin
Break;
end;
end;
end;
procedure TIdDICT.Match(const AWord, ADBName, AStrat: String;
AResults: TIdMatchList);
var
LS : TStrings;
i : Integer;
s : String;
LM : TIdMatchItem;
begin
AResults.BeginUpdate;
try
AResults.Clear;
LS := TStringList.Create;
try
InternalGetStrs('MATCH '+ADBName+' '+AStrat+' '+AWord,LS); {do not localize}
for i := 0 to LS.Count -1 do begin
s := LS[i];
LM := AResults.Add;
LM.DB := Fetch(s);
Fetch(s, '"');
LM.Word := Fetch(s, '"');
end;
finally
FreeAndNil(LS);
end;
finally
AResults.EndUpdate;
end;
end;
procedure TIdDICT.Match(const AWord, AStrat: String;
AResults: TIdMatchList; const AGetAll: Boolean);
begin
if AGetAll then begin
Match(AWord,'*','.',AResults);
end else begin
Match(AWord,'!','.',AResults);
end;
end;
procedure TIdDICT.Match(const AWord: String; AResults: TIdMatchList;
const AGetAll: Boolean);
begin
Match(AWord,'.',AResults,AGetAll);
end;
procedure TIdDICT.SetClient(const AValue: String);
//RFC 2229 says that a CLIENT command should always be
//sent immediately after connection.
begin
if AValue <> '' then begin
FClient := AValue;
end;
end;
end.
| 27.415 | 120 | 0.670345 |
47d46309c033a4e95aa3a254b99accef4cd362e0 | 10,143 | dfm | Pascal | Packages/SVGIconImageListEditorUnit.dfm | HemulGM/SVGIconImageList | ad68c7eb8a1c0c17a3094e6668738fd0069b3fd4 | [
"Apache-2.0"
]
| 2 | 2020-07-04T14:15:39.000Z | 2021-06-29T17:12:07.000Z | Packages/SVGIconImageListEditorUnit.dfm | HemulGM/SVGIconImageList | ad68c7eb8a1c0c17a3094e6668738fd0069b3fd4 | [
"Apache-2.0"
]
| null | null | null | Packages/SVGIconImageListEditorUnit.dfm | HemulGM/SVGIconImageList | ad68c7eb8a1c0c17a3094e6668738fd0069b3fd4 | [
"Apache-2.0"
]
| null | null | null | object SVGIconImageListEditor: TSVGIconImageListEditor
Left = 392
Top = 450
Caption = 'SVG Icon ImageList Editor %s - Copyright Ethea S.r.l.'
ClientHeight = 526
ClientWidth = 679
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = True
OnClose = FormClose
OnCreate = FormCreate
OnDestroy = FormDestroy
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object TopSplitter: TSplitter
Left = 0
Top = 183
Width = 679
Height = 4
Cursor = crVSplit
Align = alTop
Beveled = True
MinSize = 170
ExplicitLeft = 4
ExplicitTop = 23
ExplicitWidth = 675
end
object ImageListGroup: TGroupBox
Left = 0
Top = 187
Width = 679
Height = 306
Align = alClient
Caption = '%d Icons of Imagelist'
TabOrder = 1
object ImageView: TListView
Left = 2
Top = 15
Width = 675
Height = 289
Align = alClient
Columns = <>
DragMode = dmAutomatic
FullDrag = True
HideSelection = False
IconOptions.AutoArrange = True
MultiSelect = True
ReadOnly = True
TabOrder = 0
OnDragDrop = ImageViewDragDrop
OnDragOver = ImageViewDragOver
OnKeyDown = ImageViewKeyDown
OnSelectItem = ImageViewSelectItem
end
end
object paTop: TPanel
Left = 0
Top = 0
Width = 679
Height = 183
Align = alTop
BevelOuter = bvNone
TabOrder = 0
object paClient: TPanel
Left = 0
Top = 0
Width = 596
Height = 183
Align = alClient
BevelOuter = bvNone
TabOrder = 0
object ImageListGroupBox: TGroupBox
Left = 0
Top = 0
Width = 596
Height = 62
Align = alTop
Caption = 'Properties of ImageList'
TabOrder = 0
object SizeLabel: TLabel
Left = 8
Top = 15
Width = 80
Height = 13
AutoSize = False
Caption = 'Size (in pixel)'
Transparent = True
end
object WidthLabel: TLabel
Left = 94
Top = 15
Width = 80
Height = 13
AutoSize = False
Caption = 'Width (in pixel)'
Transparent = True
end
object HeightLabel: TLabel
Left = 181
Top = 15
Width = 80
Height = 13
AutoSize = False
Caption = 'Height (in pixel)'
Transparent = True
end
object OpacityLabel: TLabel
Left = 268
Top = 15
Width = 80
Height = 13
AutoSize = False
Caption = 'Opacity (255-0)'
Transparent = True
end
object FixedColorLabel: TLabel
Left = 354
Top = 15
Width = 63
Height = 13
AutoSize = False
Caption = 'Fixed Color'
Transparent = True
end
object SizeSpinEdit: TSpinEdit
Left = 8
Top = 30
Width = 81
Height = 22
Hint = 'Decimal value'
MaxValue = 0
MinValue = 0
TabOrder = 0
Value = 0
OnChange = SizeSpinEditChange
end
object StoreAsTextCheckBox: TCheckBox
Left = 505
Top = 13
Width = 85
Height = 17
Caption = 'StoreAsText'
TabOrder = 4
OnClick = StoreAsTextCheckBoxClick
end
object WidthSpinEdit: TSpinEdit
Left = 94
Top = 30
Width = 81
Height = 22
Hint = 'Decimal value'
MaxValue = 0
MinValue = 0
TabOrder = 1
Value = 0
OnChange = WidthSpinEditChange
end
object HeightSpinEdit: TSpinEdit
Left = 181
Top = 30
Width = 81
Height = 22
Hint = 'Decimal value'
MaxValue = 0
MinValue = 0
TabOrder = 2
Value = 0
OnChange = HeightSpinEditChange
end
object OpacitySpinEdit: TSpinEdit
Left = 268
Top = 30
Width = 81
Height = 22
Hint = 'Decimal value'
MaxValue = 255
MinValue = 0
TabOrder = 3
Value = 0
OnChange = OpacitySpinEditChange
end
object FixedColorComboBox: TComboBox
Left = 354
Top = 30
Width = 136
Height = 21
Style = csDropDownList
TabOrder = 5
OnSelect = FixedColorComboBoxSelect
end
object GrayScaleCheckBox: TCheckBox
Left = 505
Top = 32
Width = 85
Height = 17
Caption = 'GrayScale'
TabOrder = 6
OnClick = GrayScaleCheckBoxClick
end
end
object ItemGroupBox: TGroupBox
Left = 0
Top = 62
Width = 596
Height = 121
Align = alClient
Caption = 'Properties of Selected Icon n.%d'
TabOrder = 1
DesignSize = (
596
121)
object IconNameLabel: TLabel
Left = 94
Top = 19
Width = 87
Height = 13
AutoSize = False
Caption = 'IconName'
Transparent = True
end
object Label1: TLabel
Left = 94
Top = 55
Width = 63
Height = 13
AutoSize = False
Caption = 'Fixed Color'
Transparent = True
end
object IconPanel: TPanel
Left = 10
Top = 18
Width = 78
Height = 78
BevelOuter = bvNone
BorderWidth = 2
BorderStyle = bsSingle
Color = clWindow
Ctl3D = False
ParentCtl3D = False
TabOrder = 0
object IconImage: TSVGIconImage
Left = 2
Top = 2
Width = 72
Height = 72
AutoSize = False
Center = True
Proportional = False
Stretch = True
Opacity = 255
Scale = 1.000000000000000000
ImageIndex = -1
Align = alClient
end
end
object IconName: TEdit
Left = 94
Top = 34
Width = 136
Height = 21
Hint = 'Icon Name'
TabOrder = 1
OnExit = IconNameExit
end
object SVGText: TMemo
Left = 236
Top = 10
Width = 353
Height = 106
Hint = 'SVG Text'
Anchors = [akLeft, akTop, akRight, akBottom]
ScrollBars = ssBoth
TabOrder = 4
OnChange = SVGTextChange
end
object FixedColorItemComboBox: TComboBox
Left = 94
Top = 70
Width = 136
Height = 21
Style = csDropDownList
TabOrder = 2
OnSelect = FixedColorItemComboBoxSelect
end
object GrayScaleItemCheckBox: TCheckBox
Left = 94
Top = 97
Width = 85
Height = 17
Caption = 'GrayScale'
TabOrder = 3
OnClick = GrayScaleItemCheckBoxClick
end
end
end
object paButtons: TPanel
Left = 596
Top = 0
Width = 83
Height = 183
Align = alRight
BevelOuter = bvNone
TabOrder = 1
object OKButton: TButton
Left = 2
Top = 8
Width = 75
Height = 25
Caption = 'OK'
Default = True
ModalResult = 1
TabOrder = 0
OnClick = OkButtonClick
end
object CancelButton: TButton
Left = 2
Top = 34
Width = 75
Height = 25
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 1
end
object HelpButton: TButton
Left = 2
Top = 94
Width = 75
Height = 25
Caption = '&Help'
TabOrder = 3
OnClick = HelpButtonClick
end
object ApplyButton: TButton
Left = 2
Top = 68
Width = 75
Height = 25
Caption = '&Apply'
TabOrder = 2
OnClick = ApplyButtonClick
end
end
end
object BottomPanel: TPanel
Left = 0
Top = 493
Width = 679
Height = 33
Align = alBottom
BevelOuter = bvNone
TabOrder = 2
object AddButton: TButton
Left = 84
Top = 4
Width = 75
Height = 25
Caption = '&Add...'
TabOrder = 1
OnClick = AddButtonClick
end
object DeleteButton: TButton
Left = 246
Top = 4
Width = 75
Height = 25
Caption = '&Delete'
Enabled = False
TabOrder = 3
OnClick = DeleteButtonClick
end
object ClearAllButton: TButton
Left = 327
Top = 4
Width = 75
Height = 25
Caption = '&Clear all'
Enabled = False
TabOrder = 4
OnClick = ClearAllButtonClick
end
object ExportButton: TButton
Left = 408
Top = 4
Width = 75
Height = 25
Caption = '&Export...'
Enabled = False
TabOrder = 5
OnClick = ExportButtonClick
end
object ReplaceButton: TButton
Left = 165
Top = 4
Width = 75
Height = 25
Caption = '&Replace...'
TabOrder = 2
OnClick = ReplaceButtonClick
end
object NewButton: TButton
Left = 2
Top = 4
Width = 75
Height = 25
Caption = '&New'
TabOrder = 0
OnClick = NewButtonClick
end
end
object OpenDialog: TOpenPictureDialog
Filter = 'Scalable Vector Graphics (*.svg)|*.svg'
Options = [ofHideReadOnly, ofAllowMultiSelect, ofPathMustExist, ofFileMustExist, ofEnableSizing]
Left = 328
Top = 96
end
object SaveDialog: TSavePictureDialog
DefaultExt = 'svg'
Filter = 'Bitmaps (*.bmp)|*.bmp'
Options = [ofOverwritePrompt, ofPathMustExist, ofEnableSizing]
Left = 392
Top = 96
end
end
| 23.533643 | 100 | 0.510007 |
fc3567670b939ccacb6b159d7887336e7c77a8c1 | 9,244 | pas | Pascal | src/TeePEG_Grammar.pas | jpluimers/PEG | a1168ec12a931283f32643b11b420900280c406d | [
"MIT"
]
| 1 | 2021-02-21T20:30:28.000Z | 2021-02-21T20:30:28.000Z | src/TeePEG_Grammar.pas | jpluimers/PEG | a1168ec12a931283f32643b11b420900280c406d | [
"MIT"
]
| null | null | null | src/TeePEG_Grammar.pas | jpluimers/PEG | a1168ec12a931283f32643b11b420900280c406d | [
"MIT"
]
| null | null | null | // @davidberneda
// 2017
unit TeePEG_Grammar;
{
"Parsing Expression Grammars" (PEG)
Implementation for: Mr. Bryan Ford baford@mit.edu
http://bford.info/pub/lang/peg.pdf
}
interface
uses
TeePEG_Rules;
type
TGrammar=class
public
class procedure AddTo(var Items:TRuleArray);
end;
implementation
class procedure TGrammar.AddTo(var Items:TRuleArray);
var EndOfFile,
AnyCharacter,
LineFeed,
EndOfLine,
Space,
Comment,
SpaceOrComment,
Spacing,
NeedsSpacing,
DOT, CLOSE, OPEN, PLUS, STAR, QUESTION, _NOT, _AND, SLASH, LEFTARROW,
CharRule, Range, ClassRule,
Literal, IdentCont, IdentStart, Identifier,
Primary, Suffix, Prefix, Sequence, Expression, Definition, Grammar
: TRule;
Tab,
Return,
NewLine,
BackSlash,
LeftBracket,
RightBracket : TCharacter;
procedure Add(const ARule:TRule);
var L : Integer;
begin
L:=Length(Items);
SetLength(Items,L+1);
Items[L]:=ARule;
end;
procedure AddRules;
begin
Add(Grammar);
Add(Definition);
Add(Expression);
Add(Sequence);
Add(Prefix);
Add(Suffix);
Add(Primary);
Add(Identifier);
Add(IdentStart);
Add(IdentCont);
Add(Literal);
Add(ClassRule);
Add(Range);
Add(CharRule);
Add(DOT);
Add(CLOSE);
Add(OPEN);
Add(PLUS);
Add(STAR);
Add(QUESTION);
Add(_NOT);
Add(_AND);
Add(SLASH);
Add(LEFTARROW);
Add(NeedsSpacing);
Add(Spacing);
Add(SpaceOrComment);
Add(Comment);
Add(Space);
Add(EndOfLine);
Add(EndOfFile);
end;
function CharSpacing(const AName:String; const AChar:Char):TRule;
begin
result:=TNamedRule.Create(AName,TSequence.Create([TCharacter.Create(AChar),Spacing]));
end;
var
Escapable : TCharacterSet;
ParentExpression : TSequence;
begin
AnyCharacter:=TAnyCharacter.Create;
EndOfFile:=TNamedRule.Create('EndOfFile',TNotPredicate.Create(AnyCharacter));
Return:=TCharacter.Create(#13);
NewLine:=TCharacter.Create(#10);
Tab:=TCharacter.Create(#9);
LineFeed:=TString.Create(#13#10);
EndOfLine:=TNamedRule.Create('EndOfLine',TPrioritized.Create([LineFeed,NewLine,Return]));
Space:=TNamedRule.Create('Space',TPrioritized.Create([TCharacter.Create(' '),
Tab,
EndOfLine])
);
Comment:=TNamedRule.Create('Comment',
TSequence.Create([TCharacter.Create('#'),
TZeroOrMore.Create(
TSequence.Create(
[ TNotPredicate.Create(EndOfLine),
AnyCharacter ])
),
TPrioritized.Create([
EndOfLine,
EndOfFile
])
])
);
SpaceOrComment:=TNamedRule.Create('SpaceOrComment',TPrioritized.Create([Space,Comment]));
Spacing:=TNamedRule.Create('Spacing',TZeroOrMore.Create(SpaceOrComment));
NeedsSpacing:=TNamedRule.Create('NeedsSpacing',TOneOrMore.Create(SpaceOrComment));
DOT:=CharSpacing('DOT','.');
CLOSE:=CharSpacing('CLOSE',')');
OPEN:=CharSpacing('OPEN','(');
PLUS:=CharSpacing('PLUS','+');
STAR:=CharSpacing('STAR','*');
QUESTION:=CharSpacing('QUESTION','?');
_NOT:=CharSpacing('NOT','!');
_AND:=CharSpacing('AND','&');
SLASH:=CharSpacing('SLASH','/');
LEFTARROW:=TNamedRule.Create('LEFTARROW',TSequence.Create([TString.Create('<-'),Spacing]));
BackSlash:=TCharacter.Create('\');
LeftBracket:=TCharacter.Create('[');
RightBracket:=TCharacter.Create(']');
Escapable:=TCharacterSet.Create([
TCharacter.Create('n'),
TCharacter.Create('r'),
TCharacter.Create('t'),
TCharacter.Create(SingleQuote.Character),
TCharacter.Create(DoubleQuote.Character),
TCharacter.Create(LeftBracket.Character),
TCharacter.Create(RightBracket.Character),
TCharacter.Create(BackSlash.Character)
]);
CharRule:=TNamedRule.Create('Char',
TPrioritized.Create([
TSequence.Create([ BackSlash, Escapable ]),
TSequence.Create([ BackSlash,
TCharacterRange.Create('0','2'),
TCharacterRange.Create('0','7'),
TCharacterRange.Create('0','7') ]),
TSequence.Create([ BackSlash,
TCharacterRange.Create('0','7'),
TOptional.Create(
TCharacterRange.Create('0','7')
)
]),
TSequence.Create([ TNotPredicate.Create(BackSlash), AnyCharacter ])
])
);
Range:=TNamedRule.Create('Range',
TPrioritized.Create([
TSequence.Create([ CharRule, TCharacter.Create('-'), CharRule ]),
CharRule
])
);
ClassRule:=TNamedRule.Create('Class',
TSequence.Create([
LeftBracket,
TZeroOrMore.Create(
TSequence.Create(
[ TNotPredicate.Create(RightBracket), Range ]
)
),
RightBracket,
Spacing
])
);
Literal:=TNamedRule.Create('Literal',
TPrioritized.Create([
TSequence.Create([
SingleQuote,
TZeroOrMore.Create(
TSequence.Create([
TNotPredicate.Create(SingleQuote),
CharRule
])
),
SingleQuote,
Spacing
]),
TSequence.Create([
DoubleQuote,
TZeroOrMore.Create(
TSequence.Create([
TNotPredicate.Create(DoubleQuote),
CharRule
])
),
DoubleQuote,
Spacing
])
])
);
IdentStart:=TNamedRule.Create('IdentStart',
TCharacterSet.Create([
TCharacterRange.Create('a','z'),
TCharacterRange.Create('A','Z'),
TCharacter.Create('_')
])
);
IdentCont:=TNamedRule.Create('IdentCont',
TPrioritized.Create([
IdentStart,
TCharacterRange.Create('0','9')
])
);
Identifier:=TNamedRule.Create('Identifier',
TSequence.Create([
IdentStart,
TZeroOrMore.Create(IdentCont),
Spacing
])
);
ParentExpression:=TSequence.Create([OPEN, Expression, CLOSE] );
Primary:=TNamedRule.Create('Primary',
TPrioritized.Create([
TSequence.Create([ Identifier, TNotPredicate.Create(LEFTARROW) ]),
ParentExpression,
Literal,
ClassRule,
DOT
])
);
Suffix:=TNamedRule.Create('Suffix',
TSequence.Create([
Primary,
TOptional.Create(
TPrioritized.Create([
QUESTION,
STAR,
PLUS
])
)
])
);
Prefix:=TNamedRule.Create('Prefix',
TSequence.Create([
TOptional.Create( TPrioritized.Create([ _AND, _NOT ]) ),
Suffix
])
);
Sequence:=TNamedRule.Create('Sequence',
TSequence.Create([
Prefix,
TZeroOrMore.Create(Prefix)
])
);
Expression:=TNamedRule.Create('Expression',
TSequence.Create([
Sequence,
TZeroOrMore.Create(
TSequence.Create([
SLASH, Sequence
])
)
])
);
// Re-link "Expression"
ParentExpression.Items[1]:=Expression;
Definition:=TNamedRule.Create('Definition',
TSequence.Create([ Identifier, LEFTARROW, Expression ]));
Grammar:=TNamedRule.Create('Grammar',
TSequence.Create([
Spacing,
TOneOrMore.Create(Definition),
EndOfFile
])
);
AddRules;
end;
end.
| 28.097264 | 102 | 0.476742 |
fcb6886a2b61a7212f6795b613c6d5b3e3e5eb7e | 2,951 | dpr | Pascal | Test/X2UtStringsTest.dpr | atkins126/x2utils | a1839896c5ba73d86330aa5064e137334cfa573c | [
"Zlib"
]
| 4 | 2020-09-24T01:10:53.000Z | 2022-02-15T21:12:07.000Z | Test/X2UtStringsTest.dpr | atkins126/x2utils | a1839896c5ba73d86330aa5064e137334cfa573c | [
"Zlib"
]
| null | null | null | Test/X2UtStringsTest.dpr | atkins126/x2utils | a1839896c5ba73d86330aa5064e137334cfa573c | [
"Zlib"
]
| 2 | 2020-09-24T01:10:54.000Z | 2021-12-06T03:18:37.000Z | program X2UtStringsTest;
{$APPTYPE CONSOLE}
uses
SysUtils,
Windows,
FastStrings,
X2UtStrings;
var
GFreq: Int64;
GStart: Int64;
procedure TimeStart();
begin
QueryPerformanceFrequency(GFreq);
QueryPerformanceCounter(GStart);
end;
procedure TimeEnd();
var
iEnd: Int64;
begin
QueryPerformanceCounter(iEnd);
WriteLn(Format('%.6f seconds', [(iEnd - GStart) / GFreq]));
end;
procedure OldSplit(const ASource, ADelimiter: String; out ADest: TSplitArray);
var
iCount: Integer;
iPos: Integer;
iLength: Integer;
sTemp: String;
begin
sTemp := ASource;
iCount := 0;
iLength := Length(ADelimiter) - 1;
repeat
iPos := Pos(ADelimiter, sTemp);
if iPos = 0 then
break
else begin
Inc(iCount);
SetLength(ADest, iCount);
ADest[iCount - 1] := Copy(sTemp, 1, iPos - 1);
Delete(sTemp, 1, iPos + iLength);
end;
until False;
if Length(sTemp) > 0 then begin
Inc(iCount);
SetLength(ADest, iCount);
ADest[iCount - 1] := sTemp;
end;
end;
procedure OldFastStringsSplit(const ASource, ADelimiter: String; out ADest: TSplitArray);
const
BufferSize = 50;
var
iCount: Integer;
iSize: Integer;
iPos: Integer;
iDelimLength: Integer;
iLength: Integer;
iLastPos: Integer;
begin
iCount := 0;
iDelimLength := Length(ADelimiter);
iLength := Length(ASource);
iPos := 1;
iLastPos := 1;
iSize := BufferSize;
SetLength(ADest, iSize);
repeat
iPos := FastPos(ASource, ADelimiter, iLength, iDelimLength, iPos);
if iPos = 0 then
break
else begin
ADest[iCount] := Copy(ASource, iLastPos, iPos - iLastPos);
Inc(iPos, iDelimLength);
iLastPos := iPos;
Inc(iCount);
if iCount >= iSize then begin
Inc(iSize, BufferSize);
SetLength(ADest, iSize);
end;
end;
until False;
if iLastPos <= iLength then begin
ADest[iCount] := Copy(ASource, iLastPos, iLength - iLastPos + 1);
Inc(iCount);
end;
if iSize <> iCount then
SetLength(ADest, iCount);
end;
var
sTest: String;
iCount: Integer;
aSplit: TSplitArray;
begin
sTest := 'this|isateststring||';
for iCount := 0 to 7 do
sTest := sTest + sTest;
TimeStart();
Write('10.000 iterations of OldSplit: ');
for iCount := 0 to 9999 do
OldSplit(sTest, '|', aSplit);
TimeEnd();
TimeStart();
Write('10.000 iterations of OldFastStringsSplit: ');
for iCount := 0 to 9999 do
OldFastStringsSplit(sTest, '|', aSplit);
TimeEnd();
TimeStart();
Write('10.000 iterations of Split: ');
for iCount := 0 to 9999 do
Split(sTest, '||', aSplit);
TimeEnd();
ReadLn;
end.
| 20.351724 | 90 | 0.574382 |
fcac4cfda87b98a6e3ce71ff43b66e84fce410e3 | 913 | pas | Pascal | delphi/Controle Estudante/U_REL_HORARIOS.pas | vitorebatista/my-tests | 696b2290259d8179d0b3399569dd9e77e6eaa750 | [
"MIT"
]
| null | null | null | delphi/Controle Estudante/U_REL_HORARIOS.pas | vitorebatista/my-tests | 696b2290259d8179d0b3399569dd9e77e6eaa750 | [
"MIT"
]
| null | null | null | delphi/Controle Estudante/U_REL_HORARIOS.pas | vitorebatista/my-tests | 696b2290259d8179d0b3399569dd9e77e6eaa750 | [
"MIT"
]
| null | null | null | unit U_REL_HORARIOS;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, QuickRpt, ExtCtrls;
type
TFRM_REL_HORARIOS = class(TForm)
QuickRep1: TQuickRep;
QRBand1: TQRBand;
QRBand2: TQRBand;
QRBand3: TQRBand;
QRBand4: TQRBand;
QRLabel1: TQRLabel;
QRLabel2: TQRLabel;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
FRM_REL_HORARIOS: TFRM_REL_HORARIOS;
implementation
uses U_DM, U_HORARIOS, U_ATIVIDADES, U_AULA, U_DIAS, U_DISCIPLINA, U_MENU,
U_MENU_RELATORIOS, U_PROFESSOR, U_REL_DISCIPLINAS, U_REL_PROFESSORES,
U_REL_TAREFAS, U_TAREFAS;
{$R *.dfm}
end.
| 21.232558 | 77 | 0.691128 |
fc1141306921d450466d768d282cc0fa1e9ff563 | 312 | dpr | Pascal | LEA-128_Hash/File Example/LEA_Example2.dpr | delphi-pascal-archive/lea-128-hash | fdd97f4c573119a15c9bae28c39bcbceaee9396b | [
"Unlicense"
]
| null | null | null | LEA-128_Hash/File Example/LEA_Example2.dpr | delphi-pascal-archive/lea-128-hash | fdd97f4c573119a15c9bae28c39bcbceaee9396b | [
"Unlicense"
]
| null | null | null | LEA-128_Hash/File Example/LEA_Example2.dpr | delphi-pascal-archive/lea-128-hash | fdd97f4c573119a15c9bae28c39bcbceaee9396b | [
"Unlicense"
]
| null | null | null | program LEA_Example2;
uses
Forms,
Main in 'Main.pas' {MainForm},
LEA_Hash in 'LEA_Hash.pas',
Counters in 'Counters.pas';
{$R *.res}
begin
Application.Initialize;
Application.Title := 'LEA-128 et les fichiers';
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.
| 18.352941 | 50 | 0.676282 |
47338be7bf858cbbe3434c29b517762073401af8 | 281 | dpr | Pascal | Chapter10/LiveBindings/LiveBindingsFinished.dpr | PacktPublishing/Hands-On-Design-Patterns-with-Delphi | 30f6ab51e61d583f822be4918f4b088e2255cd82 | [
"MIT"
]
| 38 | 2019-02-28T06:22:52.000Z | 2022-03-16T12:30:43.000Z | Chapter10/LiveBindings/LiveBindingsFinished.dpr | alefragnani/Hands-On-Design-Patterns-with-Delphi | 3d29e5b2ce9e99e809a6a9a178c3f5e549a8a03d | [
"MIT"
]
| null | null | null | Chapter10/LiveBindings/LiveBindingsFinished.dpr | alefragnani/Hands-On-Design-Patterns-with-Delphi | 3d29e5b2ce9e99e809a6a9a178c3f5e549a8a03d | [
"MIT"
]
| 18 | 2019-03-29T08:36:14.000Z | 2022-03-30T00:31:28.000Z | program LiveBindingsFinished;
uses
System.StartUpCopy,
FMX.Forms,
LiveBindingsFinishedMain in 'LiveBindingsFinishedMain.pas' {frmLiveBindings};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TfrmLiveBindings, frmLiveBindings);
Application.Run;
end.
| 18.733333 | 79 | 0.793594 |
f18a23749484272f9681c61a978d3545ee821ff7 | 678 | dpr | Pascal | TemplateMethod/TemplateMethod.dpr | rafael-figueiredo-alves/Design_Patterns_em_Delphi | e840c540e6d0b35a5e0acc286ffab91ab2be2d45 | [
"MIT"
]
| 1 | 2022-01-20T01:07:59.000Z | 2022-01-20T01:07:59.000Z | TemplateMethod/TemplateMethod.dpr | rafael-figueiredo-alves/Design_Patterns_em_Delphi | e840c540e6d0b35a5e0acc286ffab91ab2be2d45 | [
"MIT"
]
| null | null | null | TemplateMethod/TemplateMethod.dpr | rafael-figueiredo-alves/Design_Patterns_em_Delphi | e840c540e6d0b35a5e0acc286ffab91ab2be2d45 | [
"MIT"
]
| null | null | null | program TemplateMethod;
uses
System.StartUpCopy,
FMX.Forms,
TemplateMethod.view.main in 'src\view\TemplateMethod.view.main.pas' {FormMain},
AbstractClass in 'src\model\AbstractClass.pas',
TemplateMethod.model.multiplicar in 'src\model\TemplateMethod.model.multiplicar.pas',
TemplateMethod.model.dividir in 'src\model\TemplateMethod.model.dividir.pas',
TemplateMethod.model.somar in 'src\model\TemplateMethod.model.somar.pas',
TemplateMethod.model.subtrair in 'src\model\TemplateMethod.model.subtrair.pas';
{$R *.res}
begin
ReportMemoryLeaksOnShutdown := true;
Application.Initialize;
Application.CreateForm(TFormMain, FormMain);
Application.Run;
end.
| 32.285714 | 87 | 0.789086 |
8315b44b867f63de760b1fc47ad40b85874172a1 | 374 | pas | Pascal | src/testsOk/test4.pas | LDiazN/pascal_interpreter | debe89cc107eddc2b780afd8d294ad02e5934a05 | [
"MIT"
]
| null | null | null | src/testsOk/test4.pas | LDiazN/pascal_interpreter | debe89cc107eddc2b780afd8d294ad02e5934a05 | [
"MIT"
]
| null | null | null | src/testsOk/test4.pas | LDiazN/pascal_interpreter | debe89cc107eddc2b780afd8d294ad02e5934a05 | [
"MIT"
]
| null | null | null | program SpecialExpressions;
var
a: real;
cosine :real;
sine :real;
square :real;
exponent :real;
lnFunc :real;
begin
cosine := cos(0.0);
sine := sin(0.0);
square := sqrt(4.0);
exponent := exp(0.0);
lnFunc := ln(1.0);
writeln(cosine);
writeln(sine);
writeln(square);
writeln(exponent);
writeln(lnFunc);
end. | 16.26087 | 27 | 0.564171 |
47efce103dc21af7d9cd952faebc9468a45fb93c | 2,160 | pas | Pascal | src/datadovidnik.pas | nerovnia/rayadm | 70772e07f1584da624eb51d93160db80491c3560 | [
"MIT"
]
| null | null | null | src/datadovidnik.pas | nerovnia/rayadm | 70772e07f1584da624eb51d93160db80491c3560 | [
"MIT"
]
| null | null | null | src/datadovidnik.pas | nerovnia/rayadm | 70772e07f1584da624eb51d93160db80491c3560 | [
"MIT"
]
| null | null | null | unit datadovidnik;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables;
type
TDataDovid = class(TDataModule)
srcGosp: TDataSource;
tblGosp: TTable;
srcVirob: TDataSource;
tblVirob: TTable;
srcZatrVir: TDataSource;
tblZatrVir: TTable;
srcFinrez: TDataSource;
tblFinRez: TTable;
srcZemlekorist: TDataSource;
tblZemlekorist: TTable;
srcObZvit: TDataSource;
qryObZvit: TQuery;
srcVirobAll: TDataSource;
tblVirobAll: TTable;
srcZatrVirAll: TDataSource;
tblZatrVirAll: TTable;
srcFinRezAll: TDataSource;
tblFinRezAll: TTable;
srcZemlekoristAll: TDataSource;
tblZemlekoristAll: TTable;
srGospAll: TDataSource;
tblGospAll: TTable;
procedure tblGospBeforeDelete(DataSet: TDataSet);
procedure tblGospAfterDelete(DataSet: TDataSet);
procedure tblGospNewRecord(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DataDovid: TDataDovid;
implementation
uses MainBase;
{$R *.DFM}
procedure TDataDovid.tblGospBeforeDelete(DataSet: TDataSet);
begin
with dataDovid.tblVirob do begin
First;
while not Eof do begin
Delete;
end;
ApplyUpdates;
Close; Open;
end;
with dataDovid.tblZatrVir do begin
First;
while not Eof do begin
Delete;
end;
ApplyUpdates;
Close; Open;
end;
with dataDovid.tblFinRez do begin
First;
while not Eof do begin
Delete;
end;
ApplyUpdates;
Close; Open;
end;
with dataDovid.tblZemlekorist do begin
First;
while not Eof do begin
Delete;
end;
ApplyUpdates;
Close; Open;
end;
end;
procedure TDataDovid.tblGospAfterDelete(DataSet: TDataSet);
begin
tblGosp.ApplyUpdates;
tblGosp.Close;
tblGosp.Open;
end;
procedure TDataDovid.tblGospNewRecord(DataSet: TDataSet);
begin
with tblGosp do begin
Edit;
FieldValues['CreateZvEkPok']:=True;
Post;
ApplyUpdates;
Close;
Open;
end;
end;
end.
| 20.186916 | 76 | 0.662037 |
f1911d34fd0d08cb455c3931225631a2100bd536 | 4,900 | pas | Pascal | theGame.pas | skykykykykykykykykykykys/pascal | 2d04aed9a7515bf9402c9328384f0b805646b662 | [
"MIT"
]
| null | null | null | theGame.pas | skykykykykykykykykykykys/pascal | 2d04aed9a7515bf9402c9328384f0b805646b662 | [
"MIT"
]
| null | null | null | theGame.pas | skykykykykykykykykykykys/pascal | 2d04aed9a7515bf9402c9328384f0b805646b662 | [
"MIT"
]
| null | null | null | (* Simple jeu réalise par Mohamed Aziz Knani
* Email : medazizknani@gmail.com
* Blog : http://mohamedazizknani.wordpress.com
* Sorry for the spaghetti code :v
*)
program theGame;
uses ncurses,strings;
{$H+}
type
Ship = record
posx : integer;
shape : string;
ammunition : integer;
ammupos : array [1..100] of byte; { contient la postion des missiles }
end;
Enemy = record
shape : char;
nbr : integer;
enepos : array[1..100] of byte; {contient la postion des ennemies}
end;
var
max_y, max_x : integer; { les resolutions de la fenetre }
BShip : Ship;
BEnemy : Enemy;
rk : integer;
SlowE, i, k, new_x, new_y : integer; { des compteurs pour ralentir }
dashboard, field : Pwindow;
Score : integer;
function newPos(Posi : char) : integer;
begin
if (Posi = 'L') and (3+BShip.posx <= max_x) then
newPos := 1+BShip.posx
else if (Posi = 'R') and (BShip.posx-2 >= 0) then
newPos := BShip.posx-1
else newPos := BShip.posx;
end;
procedure collision(var BShip : Ship; var BEnemy: Enemy; var score : integer);
var
j : integer;
begin
for j:=1 to max_x do
if (BShip.ammupos[j] = BEnemy.enepos[j]) and (BEnemy.enepos[j] <> 0) then begin
BShip.ammupos[j] := 0;
BEnemy.enepos[j] := 0;
Inc(Score);
end;
end;
procedure Enemys(var BEnemy : Enemy);
var
j : byte;
begin
{Affichage}
for j:=1 to max_x do begin
{un hack pour ralentir l'ennemi}
if (SlowE mod 100 =0) and (BEnemy.enepos[j] in [2..max_y-5]) then begin
Inc(BEnemy.enepos[j]);
mvprintw(BEnemy.enepos[j], j, 'X');
refresh;
SlowE := 0;
napms(15);
end
else if (BEnemy.enepos[j] > max_y) then BEnemy.enepos[j] := 0;
end;
end;
procedure init(var BShip : Ship; var BEnemy : Enemy);
var
i : integer;
begin
BShip.ammunition := 200;
{Initialisation des position des missiles par la derniere ligne (max_y)}
{for i:=1 to 50 do
BEnemy.enepos[i] := -1;}
BShip.posx := max_x div 2;
BShip.shape := 'O';
BEnemy.nbr := 15000;
end;
procedure Shoot(var BShip : Ship);
var
j : byte;
begin
for j:=1 to max_x do
{ un hack pour ralentir l'ennemi }
if (BShip.ammupos[j] in [1..max_y-5]) then begin
Dec(BShip.ammupos[j]);
mvprintw(BShip.ammupos[j], j, '|');
refresh();
{ralentir la missile pour un intervalle de 5 ms pour chaque une }
napms(5);
end;
end;
Function IntToStr (I : Longint) : String;
var
s : String;
begin
Str(I,S);
IntToStr:=s;
end;
procedure drawBox(win :PWINDOW);
var
x, y, i : integer;
begin
getmaxyx(win, y, x);
mvwprintw(win, 0, 0, '+');
mvwprintw(win, y - 1, 0, '+');
mvwprintw(win, 0, x - 1, '+');
mvwprintw(win, y - 1, x - 1, '+');
for i := 1 to (y - 2) do begin
mvwprintw(win, i, 0, '|');
mvwprintw(win, i, x - 1, '|');
end;
for i := 1 to (x - 2) do begin
mvwprintw(win, 0, i, '-');
mvwprintw(win, y - 1, i, '-');
end;
end;
BEGIN
initscr();
noecho();
curs_set(0);
{cbreak(); }
getmaxyx(stdscr, max_y, max_x); {stdscr est la fenetre par default}
{ des petits problemes sous les terminal linux (XFCE et Gnome)
un decalage d'un pixel (ou c'est juste moi) a essayer sous windows}
{Dec(max_y); Dec(max_x);}
init(BShip, BEnemy);
i := 0; k:=0;
{ la procedure permet de ne pas attendre l'utilisateur d'entrer une touche
par contre elle retourne ERR si il n'entre rien}
field := newwin(max_y-3, max_x, 0, 0);
dashboard := newwin(3, max_x, max_y - 3, 0);
mvwprintw(field, 0, 0, 'Field');
mvwprintw(dashboard, 0, 0, 'Score');
drawBox(field);
drawBox(dashboard);
refresh();
nodelay(stdscr, true);
nodelay(field, true);
while True do begin
Inc(i); Inc(k);
Inc(SlowE);
rk := getch();
case rk of
67 : BShip.posx :=newPos('L');
68 : BShip.posx :=newPos('R');
32 : begin
with BShip do
if ammunition > 0 then begin
ammupos[posx] := max_y-5;
Dec(ammunition);
end;
Shoot(BShip);
end;
end;
{ nettoyage la fenetre field }
//wclear(field);
//wclear(dashboard);
drawBox(field);
drawBox(dashboard);
//mvwprintw(field, 1, 1, 'Field');
// refresh each window
mvprintw(max_y-5, BShip.posx, 'O');
refresh;
if (BEnemy.nbr > 0) and (k = 100) then begin
randomize;
BEnemy.enepos[random(max_x)+1] := 2;
Dec(BEnemy.nbr);
k := 0;
end;
Shoot(BShip);
Enemys(BEnemy);
collision(BShip, BEnemy, Score);
mvwprintw(dashboard, 1, 1, PChar(concat('Score : ', IntToStr(Score))));
mvwprintw(dashboard, 1, max_x div 2 , PChar(concat('| Ammo : ', IntToStr(BShip.ammunition))));
wrefresh(field);
wrefresh(dashboard);
{un petit dodo pour 3 millisecondes}
//napms(5);
end;
endwin();
END.
| 25.520833 | 98 | 0.592041 |
47b3702282452ad3313ff72aab6e883102b9d703 | 955 | dpr | Pascal | Native/Delphi/Apps/MD5WithhDUnit/Delphi_MD5/MD5_Test.dpr | jpluimers/bo.codeplex | 787ef3b5a8c6ced0a985361243c48a6c76f5d655 | [
"BSD-3-Clause"
]
| 5 | 2017-05-12T08:03:54.000Z | 2022-02-15T08:23:27.000Z | Native/Delphi/Apps/MD5WithhDUnit/Delphi_MD5/MD5_Test.dpr | jpluimers/bo.codeplex | 787ef3b5a8c6ced0a985361243c48a6c76f5d655 | [
"BSD-3-Clause"
]
| null | null | null | Native/Delphi/Apps/MD5WithhDUnit/Delphi_MD5/MD5_Test.dpr | jpluimers/bo.codeplex | 787ef3b5a8c6ced0a985361243c48a6c76f5d655 | [
"BSD-3-Clause"
]
| null | null | null | Program MD5_Test;
{$APPTYPE CONSOLE}
Uses
Windows, SysUtils,
MD5;
Procedure Test (Const CorrectResult: String; Const Value: String);
var
s: string;
begin
s:= StringMD5Digest(Value);
Write('MD5(', Value, ') -> ', s);
if UpperCase(s)<>UpperCase(CorrectResult) then
Write(' ! fail, must be ', CorrectResult)
else
Write(' o.k.');
WriteLn
end;
procedure TestAll;
begin
Test('d41d8cd98f00b204e9800998ecf8427e', '');
Test('0cc175b9c0f1b6a831c399e269772661', 'a');
Test('900150983cd24fb0d6963f7d28e17f72', 'abc');
Test('f96b697d7cb7938d525a2f31aaf161d0', 'message digest');
Test('c3fcd3d76192e4007dfb496cca67e13b', 'abcdefghijklmnopqrstuvwxyz');
Test('d174ab98d277d9f5a5611c2c9f419d9f', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');
Test('57edf4a22be3c955ac49da2e2107b67a', '12345678901234567890123456789012345678901234567890123456789012345678901234567890');
end;
Begin
TestAll;
End.
| 27.285714 | 127 | 0.750785 |
47bd46bf30fa91b99ab74a6689eb1eb4bfa13c76 | 5,280 | dfm | Pascal | source/CdTanque.dfm | LGuilhermeNF/Posto-2.0 | 7783c8f50bd8f20bccf9325dbbd1014309ad605d | [
"Apache-2.0"
]
| null | null | null | source/CdTanque.dfm | LGuilhermeNF/Posto-2.0 | 7783c8f50bd8f20bccf9325dbbd1014309ad605d | [
"Apache-2.0"
]
| null | null | null | source/CdTanque.dfm | LGuilhermeNF/Posto-2.0 | 7783c8f50bd8f20bccf9325dbbd1014309ad605d | [
"Apache-2.0"
]
| null | null | null | inherited TanqueCdForm: TTanqueCdForm
Caption = 'Cadastro - Tanque de Combust'#237'vel'
ClientHeight = 431
ClientWidth = 693
ExplicitWidth = 699
ExplicitHeight = 460
PixelsPerInch = 96
TextHeight = 13
inherited pgcPrincipal: TPageControl
Width = 693
Height = 390
ExplicitWidth = 693
ExplicitHeight = 390
inherited tbPesq: TTabSheet
ExplicitWidth = 685
ExplicitHeight = 362
inherited pnlBtnsPesq: TPanel
Top = 321
Width = 685
ExplicitTop = 321
ExplicitWidth = 685
inherited btnNovo: TBitBtn
Left = 444
ExplicitLeft = 444
end
inherited btnDetalhar: TBitBtn
Left = 525
ExplicitLeft = 525
end
inherited btnExcluir: TBitBtn
Left = 606
OnClick = btnExcluirClick
ExplicitLeft = 606
end
end
inherited DBGrid1: TDBGrid
Width = 679
Height = 290
end
inherited pnlTopo: TPanel
Width = 685
ExplicitWidth = 685
end
end
inherited tbDados: TTabSheet
ExplicitWidth = 685
ExplicitHeight = 362
inherited pnlBtnsDados: TPanel
Top = 321
Width = 685
ExplicitTop = 321
ExplicitWidth = 685
inherited btnGravar: TBitBtn
Left = 524
ExplicitLeft = 524
end
inherited btnCancelar: TBitBtn
Left = 606
ExplicitLeft = 606
end
inherited btnListar: TBitBtn
Left = 361
ExplicitLeft = 361
end
inherited btnAlterar: TBitBtn
Left = 442
ExplicitLeft = 442
end
end
inherited pnlDados: TPanel
Width = 685
Height = 321
ExplicitWidth = 685
ExplicitHeight = 321
object lblVolume: TLabel
Left = 17
Top = 82
Width = 71
Height = 13
Caption = 'Volume (Litros)'
end
object lblCodigo: TLabel
Left = 17
Top = 26
Width = 33
Height = 13
Caption = 'C'#243'digo'
end
object lblDescricao: TLabel
Left = 111
Top = 26
Width = 46
Height = 13
Caption = 'Descri'#231#227'o'
end
object edtCodigo: TDBEdit
Left = 17
Top = 45
Width = 83
Height = 21
DataField = 'COD_TANQUE'
DataSource = dsCadastro
Enabled = False
TabOrder = 0
end
object edtDescricao: TDBEdit
Left = 106
Top = 45
Width = 353
Height = 21
CharCase = ecUpperCase
DataField = 'DES_TANQUE'
DataSource = dsCadastro
TabOrder = 1
end
object edtVolume: TDBEdit
Left = 17
Top = 101
Width = 121
Height = 21
DataField = 'QTD_VOLUME'
DataSource = dsCadastro
TabOrder = 2
end
end
end
end
inherited pnlRodape: TPanel
Top = 390
Width = 693
ExplicitTop = 390
ExplicitWidth = 693
inherited btnSair: TBitBtn
Left = 610
ExplicitLeft = 610
end
end
inherited fdQryCadastro: TFDQuery
UpdateOptions.AssignedValues = [uvFetchGeneratorsPoint, uvGeneratorName]
UpdateOptions.FetchGeneratorsPoint = gpImmediate
UpdateOptions.GeneratorName = 'GEN_TANQUE_ID'
UpdateOptions.AutoIncFields = 'COD_TANQUE'
SQL.Strings = (
'SELECT * FROM TANQUE')
Left = 289
Top = 190
ParamData = <
item
Name = 'Dat_Exclusao'
DataType = ftDateTime
end>
object fdQryCadastroCOD_TANQUE: TIntegerField
AutoGenerateValue = arAutoInc
DisplayLabel = 'C'#243'digo'
FieldName = 'COD_TANQUE'
Origin = 'COD_TANQUE'
ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
end
object fdQryCadastroDES_TANQUE: TStringField
DisplayLabel = 'Descri'#231#227'o'
FieldName = 'DES_TANQUE'
Origin = 'DES_TANQUE'
Required = True
end
object fdQryCadastroQTD_VOLUME: TIntegerField
DisplayLabel = 'Volume'
FieldName = 'QTD_VOLUME'
Origin = 'QTD_VOLUME'
Required = True
end
end
inherited fdTransaction: TFDTransaction
Left = 449
Top = 190
end
inherited dsCadastro: TDataSource
Left = 216
Top = 192
end
inherited dsAuxiliar: TDataSource
Left = 160
Top = 192
end
inherited fdUpdCadastro: TFDUpdateSQL
InsertSQL.Strings = (
'INSERT INTO TANQUE'
'(COD_TANQUE, DES_TANQUE, QTD_VOLUME)'
'VALUES (:NEW_COD_TANQUE, :NEW_DES_TANQUE, :NEW_QTD_VOLUME)')
ModifySQL.Strings = (
'UPDATE TANQUE'
'SET COD_TANQUE = :NEW_COD_TANQUE, DES_TANQUE = :NEW_DES_TANQUE, '
' QTD_VOLUME = :NEW_QTD_VOLUME'
'WHERE COD_TANQUE = :OLD_COD_TANQUE')
DeleteSQL.Strings = (
'DELETE FROM TANQUE'
'WHERE COD_TANQUE = :OLD_COD_TANQUE')
FetchRowSQL.Strings = (
'SELECT COD_TANQUE, DES_TANQUE, QTD_VOLUME'
'FROM TANQUE'
'WHERE COD_TANQUE = :COD_TANQUE')
Left = 369
Top = 190
end
inherited dsVenda: TDataSource
Left = 368
Top = 249
end
end
| 25.263158 | 76 | 0.577083 |
fcb3cf477dd061b151feb813bf351f1b95d56a3e | 10,717 | pas | Pascal | src/window.pas | cjbarter/ludwig | 6bd8ba997c67e0b1ae62f28dbb400975fa425851 | [
"MIT"
]
| 6 | 2021-10-02T19:59:39.000Z | 2021-12-03T11:05:27.000Z | src/window.pas | cjbarter/ludwig | 6bd8ba997c67e0b1ae62f28dbb400975fa425851 | [
"MIT"
]
| null | null | null | src/window.pas | cjbarter/ludwig | 6bd8ba997c67e0b1ae62f28dbb400975fa425851 | [
"MIT"
]
| null | null | null | {**********************************************************************}
{ }
{ L U U DDDD W W IIIII GGGG }
{ L U U D D W W I G }
{ L U U D D W ww W I G GG }
{ L U U D D W W I G G }
{ LLLLL UUU DDDD W W IIIII GGGG }
{ }
{**********************************************************************}
{ This source file by: }
{ }
{ Wayne N. Agutter (1979-80) }
{ Chris J. Barter (1979-89) }
{ Bevin R. Brett (1979-82) }
{ Kevin J. Maciunas (1980-84 ) }
{ Kelvin B. Nicolle (1981-90) }
{ Jeff Blows (1988-90,2020) }
{ }
{ Copyright 198-89 University of Adelaide }
{ }
{ Permission is hereby granted, free of charge, to any person }
{ obtaining a copy of this software and associated documentation }
{ files (the "Software"), to deal in the Software without }
{ restriction, including without limitation the rights to use, copy, }
{ modify, merge, publish, distribute, sublicense, and/or sell copies }
{ of the Software, and to permit persons to whom the Software is }
{ furnished to do so, subject to the following conditions: }
{ }
{ The above copyright notice and this permission notice shall be }
{ included in all copies or substantial portions of the Software. }
{ }
{ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, }
{ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF }
{ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND }
{ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS }
{ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN }
{ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN }
{ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE }
{ SOFTWARE. }
{**********************************************************************}
{++
! Name: WINDOW
!
! Description: Implement the window commands.
!
! $Header: /home/martin/src/ludwig/current/fpc/../RCS/window.pas,v 4.5 1990/01/18 16:55:05 ludwig Exp $
! $Author: ludwig $
! $Locker: $
! $Log: window.pas,v $
! Revision 4.5 1990/01/18 16:55:05 ludwig
! Entered into RCS at revision level 4.5
!
!
!
! Revision History:
! 4-001 Kelvin B. Nicolle 30-Sep-1988
! The EXEC module is too big for the Multimax pc compiler. Move
! the code for the window commands to a new module.
! 4-002 Jeff Blows Jul-1989
! IBM PC developments incorporated into main source code.
! 4-003 Kelvin B. Nicolle 12-Jul-1989
! VMS include files renamed from ".ext" to ".h", and from ".inc"
! to ".i". Remove the "/nolist" qualifiers.
! 4-004 Kelvin B. Nicolle 13-Sep-1989
! Add includes etc. for Tower version.
! 4-005 Kelvin B. Nicolle 25-Oct-1989
! Correct the includes for the Tower version.
!--}
{#if vms}
{##[ident('4-005'),}
{## overlaid]}
{##module window;}
{#elseif turbop}
unit window;
{#endif}
{#if vms}
{##%include 'const.i'}
{##%include 'type.i'}
{##%include 'var.i'}
{##}
{##%include 'window.fwd'}
{##%include 'frame.h'}
{##%include 'line.h'}
{##%include 'mark.h'}
{##%include 'screen.h'}
{##%include 'vdu.h'}
{##%include 'vdu_vms.h'}
{#elseif unix and not tower}
{####include "const.i"}
{####include "type.i"}
{####include "var.i"}
{##}
{####include "window.h"}
{####include "frame.h"}
{####include "line.h"}
{####include "mark.h"}
{####include "screen.h"}
{####include "vdu.h"}
{#elseif tower}
{###<$F=const.i#>}
{###<$F=type.i#>}
{###<$F=var.i#>}
{##}
{###<$F=window.h#>}
{###<$F=frame.h#>}
{###<$F=line.h#>}
{###<$F=mark.h#>}
{###<$F=screen.h#>}
{###<$F=vdu.h#>}
{#elseif turbop}
interface
uses value;
{$I window.i}
implementation
uses frame, line, mark, screen, vdu;
{#endif}
function window_command (
command : commands;
rept : leadparam;
count : integer;
tparam : tpar_ptr;
from_span : boolean)
: boolean;
label 99;
var
cmd_success : boolean;
new_line : line_ptr;
key : key_code_range;
i : integer;
line_nr,
line2_nr,
line3_nr : line_range;
begin {window_command}
cmd_success := false;
with current_frame^,dot^ do
begin
case command of
cmd_window_backward:
begin
if not line_to_number(line,line_nr) then goto 99;
if line_nr <= scr_height*count then
begin
if mark_create(first_group^.first_line,col,dot) then ;
end
else
begin
new_line := line;
for i := 1 to scr_height*count do
new_line := new_line^.blink;
if count = 1 then
begin
with line^ do
if scr_row_nr <> 0 then
if scr_row_nr > scr_height - margin_bottom then
screen_scroll(-2*scr_height+scr_row_nr+margin_bottom,true)
else
screen_scroll(-scr_height,true);
end
else
screen_unload;
if not mark_create(new_line,col,dot) then ;
end;
cmd_success := true;
end;
cmd_window_end:
cmd_success := mark_create(last_group^.last_line,col,dot);
cmd_window_forward:
begin
if not line_to_number(line,line_nr) then goto 99;
with last_group^ do
if line_nr+scr_height*count > first_line_nr+last_line^.offset_nr then
begin
if mark_create(last_line,col,dot) then ;
end
else
begin
new_line := line;
for i := 1 to scr_height*count do
new_line := new_line^.flink;
if count = 1 then
begin
with line^ do
if scr_row_nr <> 0 then
if scr_row_nr <= margin_top then
screen_scroll(scr_height+scr_row_nr-margin_top-1,true)
else
screen_scroll(scr_height,true);
end
else
screen_unload;
if not mark_create(new_line,col,dot) then ;
end;
cmd_success := true;
end;
cmd_window_left:
begin
cmd_success := true;
if scr_frame = current_frame then
begin
if rept = none then count := scr_width div 2;
if scr_offset < count then count := scr_offset;
screen_slide(-count);
if scr_offset+scr_width < col then col := scr_offset+scr_width;
end;
end;
cmd_window_middle:
begin
cmd_success := true;
if scr_frame = current_frame then
if line_to_number(line,line_nr) and
line_to_number(scr_top_line,line2_nr) and
line_to_number(scr_bot_line,line3_nr)
then
screen_scroll(line_nr-((line2_nr+line3_nr) div 2) ,true);
end;
cmd_window_new:
begin
cmd_success := true;
screen_redraw;
end;
cmd_window_right:
begin
cmd_success := true;
if scr_frame = current_frame then
begin
if rept = none then count := scr_width div 2;
if max_strlenp < (scr_offset+scr_width)+count then
count := max_strlenp-(scr_offset+scr_width);
screen_slide(count);
if col <= scr_offset then col := scr_offset+1;
end;
end;
cmd_window_scroll:
begin
cmd_success := true;
if current_frame = scr_frame then
begin
repeat
if rept = pindef then
begin
count := line^.scr_row_nr-1;
if count < 0 then count := 0;
end
else
if rept = nindef then
begin
count := line^.scr_row_nr - scr_height;
end;
if rept <> none then screen_scroll(count,true);
key := 0;
{ If the dot is still visible and the command is interactive }
{ then support stay-behind mode. }
if (not from_span)
and (line^.scr_row_nr <> 0)
and (scr_offset < col )
and (col <= scr_offset+scr_width)
then
begin
if not cmd_success then
begin
vdu_beep;
cmd_success := true;
end;
vdu_movecurs(col-scr_offset,line^.scr_row_nr);
key := vdu_get_key;
if tt_controlc then
key := 0
else
if lookup[key].command = cmd_up then
begin rept := pint; count := 1; end
else if lookup[key].command = cmd_down then
begin rept := nint; count := -1; end
else begin vdu_take_back_key(key); key := 0; end;
end;
until key = 0;
end;
end;
cmd_window_setheight:
begin
if rept = none then count := terminal_info.height;
cmd_success := frame_setheight(count,false);
end;
cmd_window_top:
cmd_success := mark_create(first_group^.first_line,col,dot);
cmd_window_update:
begin
cmd_success := true;
if ludwig_mode = ludwig_screen then
screen_fixup;
end;
end{case};
end{with};
99:
window_command := cmd_success;
end; {window_command}
{#if vms or turbop}
end.
{#endif}
| 33.282609 | 103 | 0.479239 |
fc7fcf3e88f7c32c911b8679b02f10dc9ab4727d | 30,712 | pas | Pascal | HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/CryptoLib/src/Crypto/Engines/ClpAesEngine.pas | devilking6105/HODLER-Open-Source-Multi-Asset-Wallet | 2554bce0ad3e3e08e4617787acf93176243ce758 | [
"Unlicense"
]
| 35 | 2018-11-04T12:02:34.000Z | 2022-02-15T06:00:19.000Z | HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/CryptoLib/src/Crypto/Engines/ClpAesEngine.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/Crypto/Engines/ClpAesEngine.pas | Ecoent/HODLER-Open-Source-Multi-Asset-Wallet | a8c54ecfc569d0ee959b6f0e7826c4ee4b5c4848 | [
"Unlicense"
]
| 34 | 2018-10-30T00:40:37.000Z | 2022-02-15T06:00: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 ClpAesEngine;
{$I ..\..\Include\CryptoLib.inc}
interface
uses
SysUtils,
ClpIAesEngine,
ClpIBlockCipher,
ClpICipherParameters,
ClpIKeyParameter,
ClpCheck,
ClpBits,
ClpConverters,
ClpCryptoLibTypes;
resourcestring
AESEngineNotInitialised = 'AES Engine not Initialised';
SInputBuffertooShort = 'Input Buffer too Short';
SOutputBuffertooShort = 'Output Buffer too Short';
SInvalidParameterAESInit = 'Invalid Parameter Passed to AES Init - "%s"';
SInvalidKeyLength = 'Key Length not 128/192/256 bits.';
SInvalidOperation = 'Should Never Get Here';
type
/// <summary>
/// <para>
/// an implementation of the AES (Rijndael), from FIPS-197.
/// </para>
/// <para>
/// For further details see: <see href="http://csrc.nist.gov/encryption/aes/" />
/// </para>
/// <para>
/// This implementation is based on optimizations from Dr. Brian
/// Gladman's paper and C code at <see href="http://fp.gladman.plus.com/cryptography_technology/rijndael/" />
/// </para>
/// <para>
/// This version uses only one 256 word table for each, for a total of
/// 2Kbytes, <br />adding 12 rotate operations per round to compute the
/// values contained in the other tables from <br />the contents of the
/// first.
/// </para>
/// <para>
/// This file contains the middle performance version with 2Kbytes of
/// static tables for round precomputation.
/// </para>
/// </summary>
TAesEngine = class sealed(TInterfacedObject, IAesEngine, IBlockCipher)
strict private
const
// multiply four bytes in GF(2^8) by 'x' {02} in parallel //
m1 = UInt32($80808080);
m2 = UInt32($7F7F7F7F);
m3 = UInt32($0000001B);
m4 = UInt32($C0C0C0C0);
m5 = UInt32($3F3F3F3F);
BLOCK_SIZE = Int32(16);
var
FROUNDS: Int32;
FWorkingKey: TCryptoLibMatrixUInt32Array;
FC0, FC1, FC2, FC3: UInt32;
FforEncryption: Boolean;
Fstate: TCryptoLibByteArray;
function GetAlgorithmName: String; virtual;
function GetIsPartialBlockOkay: Boolean; virtual;
function GetBlockSize(): Int32; virtual;
/// <summary>
/// <para>
/// Calculate the necessary round keys
/// </para>
/// <para>
/// The number of calculations depends on key size and block size
/// </para>
/// <para>
/// AES specified a fixed block size of 128 bits and key sizes
/// 128/192/256 bits
/// </para>
/// <para>
/// This code is written assuming those are the only possible values
/// </para>
/// </summary>
function GenerateWorkingKey(const key: TCryptoLibByteArray;
forEncryption: Boolean): TCryptoLibMatrixUInt32Array;
procedure UnPackBlock(const bytes: TCryptoLibByteArray; off: Int32); inline;
procedure PackBlock(const bytes: TCryptoLibByteArray; off: Int32); inline;
procedure EncryptBlock(const KW: TCryptoLibMatrixUInt32Array);
procedure DecryptBlock(const KW: TCryptoLibMatrixUInt32Array);
class var
Fs, FSi, Frcon: TCryptoLibByteArray;
FT0, FTinv0: TCryptoLibUInt32Array;
class function Shift(r: UInt32; Shift: Int32): UInt32; static; inline;
class function FFmulX(x: UInt32): UInt32; static; inline;
class function FFmulX2(x: UInt32): UInt32; static; inline;
// The following defines provide alternative definitions of FFmulX that might
// give improved performance if a fast 32-bit multiply is not available.
//
// private int FFmulX(int x) { int u = x & m1; u |= (u >> 1); return ((x & m2) << 1) ^ ((u >>> 3) | (u >>> 6)); }
// private static final int m4 = 0x1b1b1b1b;
// private int FFmulX(int x) { int u = x & m1; return ((x & m2) << 1) ^ ((u - (u >>> 7)) & m4); }
class function Inv_Mcol(x: UInt32): UInt32; static; inline;
class function SubWord(x: UInt32): UInt32; static; inline;
class constructor AesEngine();
public
/// <summary>
/// initialise an AES cipher.
/// </summary>
/// <param name="forEncryption">
/// whether or not we are for encryption.
/// </param>
/// <param name="parameters">
/// the parameters required to set up the cipher.
/// </param>
/// <exception cref="EArgumentCryptoLibException">
/// if the parameters argument is inappropriate.
/// </exception>
procedure Init(forEncryption: Boolean;
const parameters: ICipherParameters); virtual;
function ProcessBlock(const input: TCryptoLibByteArray; inOff: Int32;
const output: TCryptoLibByteArray; outOff: Int32): Int32; virtual;
procedure Reset(); virtual;
property AlgorithmName: String read GetAlgorithmName;
property IsPartialBlockOkay: Boolean read GetIsPartialBlockOkay;
class procedure Boot; static;
end;
implementation
{ TAesEngine }
class procedure TAesEngine.Boot;
begin
// The S box
Fs := TCryptoLibByteArray.Create(99, 124, 119, 123, 242, 107, 111, 197, 48, 1,
103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212,
162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165,
229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128,
226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179,
41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74,
76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60,
159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255,
243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25,
115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219,
224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231,
200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186,
120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112,
62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248,
152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161,
137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22);
// The inverse S-box
FSi := TCryptoLibByteArray.Create(82, 9, 106, 213, 48, 54, 165, 56, 191, 64,
163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142,
67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76,
149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162,
73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92,
204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70,
87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88,
5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1,
19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240,
180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28,
117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170,
24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120,
205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128,
236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201,
156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83,
153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85,
33, 12, 125);
// vector used in calculating key schedule (powers of x in GF(256))
Frcon := TCryptoLibByteArray.Create($01, $02, $04, $08, $10, $20, $40, $80,
$1B, $36, $6C, $D8, $AB, $4D, $9A, $2F, $5E, $BC, $63, $C6, $97, $35, $6A,
$D4, $B3, $7D, $FA, $EF, $C5, $91);
// precomputation tables of calculations for rounds
FT0 := TCryptoLibUInt32Array.Create($A56363C6, $847C7CF8, $997777EE,
$8D7B7BF6, $0DF2F2FF, $BD6B6BD6, $B16F6FDE, $54C5C591, $50303060, $03010102,
$A96767CE, $7D2B2B56, $19FEFEE7, $62D7D7B5, $E6ABAB4D, $9A7676EC, $45CACA8F,
$9D82821F, $40C9C989, $877D7DFA, $15FAFAEF, $EB5959B2, $C947478E, $0BF0F0FB,
$ECADAD41, $67D4D4B3, $FDA2A25F, $EAAFAF45, $BF9C9C23, $F7A4A453, $967272E4,
$5BC0C09B, $C2B7B775, $1CFDFDE1, $AE93933D, $6A26264C, $5A36366C, $413F3F7E,
$02F7F7F5, $4FCCCC83, $5C343468, $F4A5A551, $34E5E5D1, $08F1F1F9, $937171E2,
$73D8D8AB, $53313162, $3F15152A, $0C040408, $52C7C795, $65232346, $5EC3C39D,
$28181830, $A1969637, $0F05050A, $B59A9A2F, $0907070E, $36121224, $9B80801B,
$3DE2E2DF, $26EBEBCD, $6927274E, $CDB2B27F, $9F7575EA, $1B090912, $9E83831D,
$742C2C58, $2E1A1A34, $2D1B1B36, $B26E6EDC, $EE5A5AB4, $FBA0A05B, $F65252A4,
$4D3B3B76, $61D6D6B7, $CEB3B37D, $7B292952, $3EE3E3DD, $712F2F5E, $97848413,
$F55353A6, $68D1D1B9, $00000000, $2CEDEDC1, $60202040, $1FFCFCE3, $C8B1B179,
$ED5B5BB6, $BE6A6AD4, $46CBCB8D, $D9BEBE67, $4B393972, $DE4A4A94, $D44C4C98,
$E85858B0, $4ACFCF85, $6BD0D0BB, $2AEFEFC5, $E5AAAA4F, $16FBFBED, $C5434386,
$D74D4D9A, $55333366, $94858511, $CF45458A, $10F9F9E9, $06020204, $817F7FFE,
$F05050A0, $443C3C78, $BA9F9F25, $E3A8A84B, $F35151A2, $FEA3A35D, $C0404080,
$8A8F8F05, $AD92923F, $BC9D9D21, $48383870, $04F5F5F1, $DFBCBC63, $C1B6B677,
$75DADAAF, $63212142, $30101020, $1AFFFFE5, $0EF3F3FD, $6DD2D2BF, $4CCDCD81,
$140C0C18, $35131326, $2FECECC3, $E15F5FBE, $A2979735, $CC444488, $3917172E,
$57C4C493, $F2A7A755, $827E7EFC, $473D3D7A, $AC6464C8, $E75D5DBA, $2B191932,
$957373E6, $A06060C0, $98818119, $D14F4F9E, $7FDCDCA3, $66222244, $7E2A2A54,
$AB90903B, $8388880B, $CA46468C, $29EEEEC7, $D3B8B86B, $3C141428, $79DEDEA7,
$E25E5EBC, $1D0B0B16, $76DBDBAD, $3BE0E0DB, $56323264, $4E3A3A74, $1E0A0A14,
$DB494992, $0A06060C, $6C242448, $E45C5CB8, $5DC2C29F, $6ED3D3BD, $EFACAC43,
$A66262C4, $A8919139, $A4959531, $37E4E4D3, $8B7979F2, $32E7E7D5, $43C8C88B,
$5937376E, $B76D6DDA, $8C8D8D01, $64D5D5B1, $D24E4E9C, $E0A9A949, $B46C6CD8,
$FA5656AC, $07F4F4F3, $25EAEACF, $AF6565CA, $8E7A7AF4, $E9AEAE47, $18080810,
$D5BABA6F, $887878F0, $6F25254A, $722E2E5C, $241C1C38, $F1A6A657, $C7B4B473,
$51C6C697, $23E8E8CB, $7CDDDDA1, $9C7474E8, $211F1F3E, $DD4B4B96, $DCBDBD61,
$868B8B0D, $858A8A0F, $907070E0, $423E3E7C, $C4B5B571, $AA6666CC, $D8484890,
$05030306, $01F6F6F7, $120E0E1C, $A36161C2, $5F35356A, $F95757AE, $D0B9B969,
$91868617, $58C1C199, $271D1D3A, $B99E9E27, $38E1E1D9, $13F8F8EB, $B398982B,
$33111122, $BB6969D2, $70D9D9A9, $898E8E07, $A7949433, $B69B9B2D, $221E1E3C,
$92878715, $20E9E9C9, $49CECE87, $FF5555AA, $78282850, $7ADFDFA5, $8F8C8C03,
$F8A1A159, $80898909, $170D0D1A, $DABFBF65, $31E6E6D7, $C6424284, $B86868D0,
$C3414182, $B0999929, $772D2D5A, $110F0F1E, $CBB0B07B, $FC5454A8, $D6BBBB6D,
$3A16162C);
FTinv0 := TCryptoLibUInt32Array.Create($50A7F451, $5365417E, $C3A4171A,
$965E273A, $CB6BAB3B, $F1459D1F, $AB58FAAC, $9303E34B, $55FA3020, $F66D76AD,
$9176CC88, $254C02F5, $FCD7E54F, $D7CB2AC5, $80443526, $8FA362B5, $495AB1DE,
$671BBA25, $980EEA45, $E1C0FE5D, $02752FC3, $12F04C81, $A397468D, $C6F9D36B,
$E75F8F03, $959C9215, $EB7A6DBF, $DA595295, $2D83BED4, $D3217458, $2969E049,
$44C8C98E, $6A89C275, $78798EF4, $6B3E5899, $DD71B927, $B64FE1BE, $17AD88F0,
$66AC20C9, $B43ACE7D, $184ADF63, $82311AE5, $60335197, $457F5362, $E07764B1,
$84AE6BBB, $1CA081FE, $942B08F9, $58684870, $19FD458F, $876CDE94, $B7F87B52,
$23D373AB, $E2024B72, $578F1FE3, $2AAB5566, $0728EBB2, $03C2B52F, $9A7BC586,
$A50837D3, $F2872830, $B2A5BF23, $BA6A0302, $5C8216ED, $2B1CCF8A, $92B479A7,
$F0F207F3, $A1E2694E, $CDF4DA65, $D5BE0506, $1F6234D1, $8AFEA6C4, $9D532E34,
$A055F3A2, $32E18A05, $75EBF6A4, $39EC830B, $AAEF6040, $069F715E, $51106EBD,
$F98A213E, $3D06DD96, $AE053EDD, $46BDE64D, $B58D5491, $055DC471, $6FD40604,
$FF155060, $24FB9819, $97E9BDD6, $CC434089, $779ED967, $BD42E8B0, $888B8907,
$385B19E7, $DBEEC879, $470A7CA1, $E90F427C, $C91E84F8, $00000000, $83868009,
$48ED2B32, $AC70111E, $4E725A6C, $FBFF0EFD, $5638850F, $1ED5AE3D, $27392D36,
$64D90F0A, $21A65C68, $D1545B9B, $3A2E3624, $B1670A0C, $0FE75793, $D296EEB4,
$9E919B1B, $4FC5C080, $A220DC61, $694B775A, $161A121C, $0ABA93E2, $E52AA0C0,
$43E0223C, $1D171B12, $0B0D090E, $ADC78BF2, $B9A8B62D, $C8A91E14, $8519F157,
$4C0775AF, $BBDD99EE, $FD607FA3, $9F2601F7, $BCF5725C, $C53B6644, $347EFB5B,
$7629438B, $DCC623CB, $68FCEDB6, $63F1E4B8, $CADC31D7, $10856342, $40229713,
$2011C684, $7D244A85, $F83DBBD2, $1132F9AE, $6DA129C7, $4B2F9E1D, $F330B2DC,
$EC52860D, $D0E3C177, $6C16B32B, $99B970A9, $FA489411, $2264E947, $C48CFCA8,
$1A3FF0A0, $D82C7D56, $EF903322, $C74E4987, $C1D138D9, $FEA2CA8C, $360BD498,
$CF81F5A6, $28DE7AA5, $268EB7DA, $A4BFAD3F, $E49D3A2C, $0D927850, $9BCC5F6A,
$62467E54, $C2138DF6, $E8B8D890, $5EF7392E, $F5AFC382, $BE805D9F, $7C93D069,
$A92DD56F, $B31225CF, $3B99ACC8, $A77D1810, $6E639CE8, $7BBB3BDB, $097826CD,
$F418596E, $01B79AEC, $A89A4F83, $656E95E6, $7EE6FFAA, $08CFBC21, $E6E815EF,
$D99BE7BA, $CE366F4A, $D4099FEA, $D67CB029, $AFB2A431, $31233F2A, $3094A5C6,
$C066A235, $37BC4E74, $A6CA82FC, $B0D090E0, $15D8A733, $4A9804F1, $F7DAEC41,
$0E50CD7F, $2FF69117, $8DD64D76, $4DB0EF43, $544DAACC, $DF0496E4, $E3B5D19E,
$1B886A4C, $B81F2CC1, $7F516546, $04EA5E9D, $5D358C01, $737487FA, $2E410BFB,
$5A1D67B3, $52D2DB92, $335610E9, $1347D66D, $8C61D79A, $7A0CA137, $8E14F859,
$893C13EB, $EE27A9CE, $35C961B7, $EDE51CE1, $3CB1477A, $59DFD29C, $3F73F255,
$79CE1418, $BF37C773, $EACDF753, $5BAAFD5F, $146F3DDF, $86DB4478, $81F3AFCA,
$3EC468B9, $2C342438, $5F40A3C2, $72C31D16, $0C25E2BC, $8B493C28, $41950DFF,
$7101A839, $DEB30C08, $9CE4B4D8, $90C15664, $6184CB7B, $70B632D5, $745C6C48,
$4257B8D0);
end;
class constructor TAesEngine.AesEngine;
begin
TAesEngine.Boot;
end;
class function TAesEngine.Shift(r: UInt32; Shift: Int32): UInt32;
begin
// result := (r shr shift) or (r shl (32 - shift));
result := TBits.RotateRight32(r, Shift);
end;
class function TAesEngine.SubWord(x: UInt32): UInt32;
begin
result := UInt32(Fs[x and 255]) or (UInt32(Fs[(x shr 8) and 255]) shl 8) or
(UInt32(Fs[(x shr 16) and 255]) shl 16) or
(UInt32(Fs[(x shr 24) and 255]) shl 24);
end;
procedure TAesEngine.DecryptBlock(const KW: TCryptoLibMatrixUInt32Array);
var
lkw: TCryptoLibUInt32Array;
lt0, lt1, lt2, lr0, lr1, lr2, lr3: UInt32;
lr: Int32;
begin
lkw := KW[FROUNDS];
lt0 := FC0 xor lkw[0];
lt1 := FC1 xor lkw[1];
lt2 := FC2 xor lkw[2];
lr3 := FC3 xor lkw[3];
lr := FROUNDS - 1;
while (lr > 1) do
begin
lkw := KW[lr];
System.Dec(lr);
lr0 := FTinv0[lt0 and 255] xor Shift(FTinv0[(lr3 shr 8) and 255], 24)
xor Shift(FTinv0[(lt2 shr 16) and 255], 16)
xor Shift(FTinv0[(lt1 shr 24) and 255], 8) xor lkw[0];
lr1 := FTinv0[lt1 and 255] xor Shift(FTinv0[(lt0 shr 8) and 255], 24)
xor Shift(FTinv0[(lr3 shr 16) and 255], 16)
xor Shift(FTinv0[(lt2 shr 24) and 255], 8) xor lkw[1];
lr2 := FTinv0[lt2 and 255] xor Shift(FTinv0[(lt1 shr 8) and 255], 24)
xor Shift(FTinv0[(lt0 shr 16) and 255], 16)
xor Shift(FTinv0[(lr3 shr 24) and 255], 8) xor lkw[2];
lr3 := FTinv0[lr3 and 255] xor Shift(FTinv0[(lt2 shr 8) and 255], 24)
xor Shift(FTinv0[(lt1 shr 16) and 255], 16)
xor Shift(FTinv0[(lt0 shr 24) and 255], 8) xor lkw[3];
lkw := KW[lr];
System.Dec(lr);
lt0 := FTinv0[lr0 and 255] xor Shift(FTinv0[(lr3 shr 8) and 255], 24)
xor Shift(FTinv0[(lr2 shr 16) and 255], 16)
xor Shift(FTinv0[(lr1 shr 24) and 255], 8) xor lkw[0];
lt1 := FTinv0[lr1 and 255] xor Shift(FTinv0[(lr0 shr 8) and 255], 24)
xor Shift(FTinv0[(lr3 shr 16) and 255], 16)
xor Shift(FTinv0[(lr2 shr 24) and 255], 8) xor lkw[1];
lt2 := FTinv0[lr2 and 255] xor Shift(FTinv0[(lr1 shr 8) and 255], 24)
xor Shift(FTinv0[(lr0 shr 16) and 255], 16)
xor Shift(FTinv0[(lr3 shr 24) and 255], 8) xor lkw[2];
lr3 := FTinv0[lr3 and 255] xor Shift(FTinv0[(lr2 shr 8) and 255], 24)
xor Shift(FTinv0[(lr1 shr 16) and 255], 16)
xor Shift(FTinv0[(lr0 shr 24) and 255], 8) xor lkw[3];
end;
lkw := KW[1];
lr0 := FTinv0[lt0 and 255] xor Shift(FTinv0[(lr3 shr 8) and 255], 24)
xor Shift(FTinv0[(lt2 shr 16) and 255], 16)
xor Shift(FTinv0[(lt1 shr 24) and 255], 8) xor lkw[0];
lr1 := FTinv0[lt1 and 255] xor Shift(FTinv0[(lt0 shr 8) and 255], 24)
xor Shift(FTinv0[(lr3 shr 16) and 255], 16)
xor Shift(FTinv0[(lt2 shr 24) and 255], 8) xor lkw[1];
lr2 := FTinv0[lt2 and 255] xor Shift(FTinv0[(lt1 shr 8) and 255], 24)
xor Shift(FTinv0[(lt0 shr 16) and 255], 16)
xor Shift(FTinv0[(lr3 shr 24) and 255], 8) xor lkw[2];
lr3 := FTinv0[lr3 and 255] xor Shift(FTinv0[(lt2 shr 8) and 255], 24)
xor Shift(FTinv0[(lt1 shr 16) and 255], 16)
xor Shift(FTinv0[(lt0 shr 24) and 255], 8) xor lkw[3];
// the final round's table is a simple function of Si so we don't use a whole other four tables for it
lkw := KW[0];
FC0 := UInt32(FSi[lr0 and 255]) xor ((UInt32(Fstate[(lr3 shr 8) and 255]))
shl 8) xor ((UInt32(Fstate[(lr2 shr 16) and 255])) shl 16)
xor ((UInt32(FSi[(lr1 shr 24) and 255])) shl 24) xor lkw[0];
FC1 := UInt32(Fstate[lr1 and 255]) xor ((UInt32(Fstate[(lr0 shr 8) and 255]))
shl 8) xor ((UInt32(FSi[(lr3 shr 16) and 255])) shl 16)
xor ((UInt32(Fstate[(lr2 shr 24) and 255])) shl 24) xor lkw[1];
FC2 := UInt32(Fstate[lr2 and 255]) xor ((UInt32(FSi[(lr1 shr 8) and 255]))
shl 8) xor ((UInt32(FSi[(lr0 shr 16) and 255])) shl 16)
xor ((UInt32(Fstate[(lr3 shr 24) and 255])) shl 24) xor lkw[2];
FC3 := UInt32(FSi[lr3 and 255]) xor ((UInt32(Fstate[(lr2 shr 8) and 255]))
shl 8) xor ((UInt32(Fstate[(lr1 shr 16) and 255])) shl 16)
xor ((UInt32(Fstate[(lr0 shr 24) and 255])) shl 24) xor lkw[3];
end;
procedure TAesEngine.EncryptBlock(const KW: TCryptoLibMatrixUInt32Array);
var
lkw: TCryptoLibUInt32Array;
lt0, lt1, lt2, lr0, lr1, lr2, lr3: UInt32;
lr: Int32;
begin
lkw := KW[0];
lt0 := FC0 xor lkw[0];
lt1 := FC1 xor lkw[1];
lt2 := FC2 xor lkw[2];
lr3 := FC3 xor lkw[3];
lr := 1;
while (lr < (FROUNDS - 1)) do
begin
lkw := KW[lr];
System.Inc(lr);
lr0 := FT0[lt0 and 255] xor Shift(FT0[(lt1 shr 8) and 255], 24)
xor Shift(FT0[(lt2 shr 16) and 255], 16)
xor Shift(FT0[(lr3 shr 24) and 255], 8) xor lkw[0];
lr1 := FT0[lt1 and 255] xor Shift(FT0[(lt2 shr 8) and 255], 24)
xor Shift(FT0[(lr3 shr 16) and 255], 16)
xor Shift(FT0[(lt0 shr 24) and 255], 8) xor lkw[1];
lr2 := FT0[lt2 and 255] xor Shift(FT0[(lr3 shr 8) and 255], 24)
xor Shift(FT0[(lt0 shr 16) and 255], 16)
xor Shift(FT0[(lt1 shr 24) and 255], 8) xor lkw[2];
lr3 := FT0[lr3 and 255] xor Shift(FT0[(lt0 shr 8) and 255], 24)
xor Shift(FT0[(lt1 shr 16) and 255], 16)
xor Shift(FT0[(lt2 shr 24) and 255], 8) xor lkw[3];
lkw := KW[lr];
System.Inc(lr);
lt0 := FT0[lr0 and 255] xor Shift(FT0[(lr1 shr 8) and 255], 24)
xor Shift(FT0[(lr2 shr 16) and 255], 16)
xor Shift(FT0[(lr3 shr 24) and 255], 8) xor lkw[0];
lt1 := FT0[lr1 and 255] xor Shift(FT0[(lr2 shr 8) and 255], 24)
xor Shift(FT0[(lr3 shr 16) and 255], 16)
xor Shift(FT0[(lr0 shr 24) and 255], 8) xor lkw[1];
lt2 := FT0[lr2 and 255] xor Shift(FT0[(lr3 shr 8) and 255], 24)
xor Shift(FT0[(lr0 shr 16) and 255], 16)
xor Shift(FT0[(lr1 shr 24) and 255], 8) xor lkw[2];
lr3 := FT0[lr3 and 255] xor Shift(FT0[(lr0 shr 8) and 255], 24)
xor Shift(FT0[(lr1 shr 16) and 255], 16)
xor Shift(FT0[(lr2 shr 24) and 255], 8) xor lkw[3];
end;
lkw := KW[lr];
System.Inc(lr);
lr0 := FT0[lt0 and 255] xor Shift(FT0[(lt1 shr 8) and 255], 24)
xor Shift(FT0[(lt2 shr 16) and 255], 16)
xor Shift(FT0[(lr3 shr 24) and 255], 8) xor lkw[0];
lr1 := FT0[lt1 and 255] xor Shift(FT0[(lt2 shr 8) and 255], 24)
xor Shift(FT0[(lr3 shr 16) and 255], 16)
xor Shift(FT0[(lt0 shr 24) and 255], 8) xor lkw[1];
lr2 := FT0[lt2 and 255] xor Shift(FT0[(lr3 shr 8) and 255], 24)
xor Shift(FT0[(lt0 shr 16) and 255], 16)
xor Shift(FT0[(lt1 shr 24) and 255], 8) xor lkw[2];
lr3 := FT0[lr3 and 255] xor Shift(FT0[(lt0 shr 8) and 255], 24)
xor Shift(FT0[(lt1 shr 16) and 255], 16)
xor Shift(FT0[(lt2 shr 24) and 255], 8) xor lkw[3];
// the final round's table is a simple function of S so we don't use a whole other four tables for it
lkw := KW[lr];
FC0 := UInt32(Fs[lr0 and 255]) xor ((UInt32(Fs[(lr1 shr 8) and 255])) shl 8)
xor ((UInt32(Fstate[(lr2 shr 16) and 255])) shl 16)
xor ((UInt32(Fstate[(lr3 shr 24) and 255])) shl 24) xor lkw[0];
FC1 := UInt32(Fstate[lr1 and 255]) xor ((UInt32(Fs[(lr2 shr 8) and 255]))
shl 8) xor ((UInt32(Fs[(lr3 shr 16) and 255])) shl 16)
xor ((UInt32(Fstate[(lr0 shr 24) and 255])) shl 24) xor lkw[1];
FC2 := UInt32(Fstate[lr2 and 255]) xor ((UInt32(Fs[(lr3 shr 8) and 255]))
shl 8) xor ((UInt32(Fs[(lr0 shr 16) and 255])) shl 16)
xor ((UInt32(Fs[(lr1 shr 24) and 255])) shl 24) xor lkw[2];
FC3 := UInt32(Fstate[lr3 and 255]) xor ((UInt32(Fstate[(lr0 shr 8) and 255]))
shl 8) xor ((UInt32(Fstate[(lr1 shr 16) and 255])) shl 16)
xor ((UInt32(Fs[(lr2 shr 24) and 255])) shl 24) xor lkw[3];
end;
class function TAesEngine.FFmulX(x: UInt32): UInt32;
begin
result := ((x and m2) shl 1) xor (((x and m1) shr 7) * m3);
end;
class function TAesEngine.FFmulX2(x: UInt32): UInt32;
var
t0, t1: UInt32;
begin
t0 := (x and m5) shl 2;
t1 := (x and m4);
t1 := t1 xor (t1 shr 1);
result := t0 xor (t1 shr 2) xor (t1 shr 5);
end;
class function TAesEngine.Inv_Mcol(x: UInt32): UInt32;
var
t0, t1: UInt32;
begin
t0 := x;
t1 := t0 xor Shift(t0, 8);
t0 := t0 xor FFmulX(t1);
t1 := t1 xor FFmulX2(t0);
t0 := t0 xor (t1 xor Shift(t1, 16));
result := t0;
end;
function TAesEngine.GenerateWorkingKey(const key: TCryptoLibByteArray;
forEncryption: Boolean): TCryptoLibMatrixUInt32Array;
var
keyLen, KC, i, j: Int32;
smallw: TCryptoLibUInt32Array;
bigW: TCryptoLibMatrixUInt32Array;
u, rcon, t0, t1, t2, t3, t4, t5, t6, t7: UInt32;
begin
keyLen := System.Length(key);
if ((keyLen < 16) or (keyLen > 32) or ((keyLen and 7) <> 0)) then
begin
raise EArgumentCryptoLibException.CreateRes(@SInvalidKeyLength);
end;
KC := keyLen shr 2; // KC := keyLen div 4;
FROUNDS := KC + 6;
// This is not always true for the generalized Rijndael that allows larger block sizes
System.SetLength(bigW, FROUNDS + 1); // 4 words in a block
for i := 0 to FROUNDS do
begin
System.SetLength(bigW[i], 4);
end;
case KC of
4:
begin
t0 := TConverters.ReadBytesAsUInt32LE(PByte(key), 0);
bigW[0][0] := t0;
t1 := TConverters.ReadBytesAsUInt32LE(PByte(key), 4);
bigW[0][1] := t1;
t2 := TConverters.ReadBytesAsUInt32LE(PByte(key), 8);
bigW[0][2] := t2;
t3 := TConverters.ReadBytesAsUInt32LE(PByte(key), 12);
bigW[0][3] := t3;
for i := 1 to 10 do
begin
u := SubWord(Shift(t3, 8)) xor Frcon[i - 1];
t0 := t0 xor u;
bigW[i][0] := t0;
t1 := t1 xor t0;
bigW[i][1] := t1;
t2 := t2 xor t1;
bigW[i][2] := t2;
t3 := t3 xor t2;
bigW[i][3] := t3;
end;
end;
6:
begin
t0 := TConverters.ReadBytesAsUInt32LE(PByte(key), 0);
bigW[0][0] := t0;
t1 := TConverters.ReadBytesAsUInt32LE(PByte(key), 4);
bigW[0][1] := t1;
t2 := TConverters.ReadBytesAsUInt32LE(PByte(key), 8);
bigW[0][2] := t2;
t3 := TConverters.ReadBytesAsUInt32LE(PByte(key), 12);
bigW[0][3] := t3;
t4 := TConverters.ReadBytesAsUInt32LE(PByte(key), 16);
bigW[1][0] := t4;
t5 := TConverters.ReadBytesAsUInt32LE(PByte(key), 20);
bigW[1][1] := t5;
rcon := 1;
u := SubWord(Shift(t5, 8)) xor rcon;
rcon := rcon shl 1;
t0 := t0 xor u;
bigW[1][2] := t0;
t1 := t1 xor t0;
bigW[1][3] := t1;
t2 := t2 xor t1;
bigW[2][0] := t2;
t3 := t3 xor t2;
bigW[2][1] := t3;
t4 := t4 xor t3;
bigW[2][2] := t4;
t5 := t5 xor t4;
bigW[2][3] := t5;
i := 3;
while i < 12 do
begin
u := SubWord(Shift(t5, 8)) xor rcon;
rcon := rcon shl 1;
t0 := t0 xor u;
bigW[i][0] := t0;
t1 := t1 xor t0;
bigW[i][1] := t1;
t2 := t2 xor t1;
bigW[i][2] := t2;
t3 := t3 xor t2;
bigW[i][3] := t3;
t4 := t4 xor t3;
bigW[i + 1][0] := t4;
t5 := t5 xor t4;
bigW[i + 1][1] := t5;
u := SubWord(Shift(t5, 8)) xor rcon;
rcon := rcon shl 1;
t0 := t0 xor u;
bigW[i + 1][2] := t0;
t1 := t1 xor t0;
bigW[i + 1][3] := t1;
t2 := t2 xor t1;
bigW[i + 2][0] := t2;
t3 := t3 xor t2;
bigW[i + 2][1] := t3;
t4 := t4 xor t3;
bigW[i + 2][2] := t4;
t5 := t5 xor t4;
bigW[i + 2][3] := t5;
System.Inc(i, 3);
end;
u := SubWord(Shift(t5, 8)) xor rcon;
t0 := t0 xor u;
bigW[12][0] := t0;
t1 := t1 xor t0;
bigW[12][1] := t1;
t2 := t2 xor t1;
bigW[12][2] := t2;
t3 := t3 xor t2;
bigW[12][3] := t3;
end;
8:
begin
t0 := TConverters.ReadBytesAsUInt32LE(PByte(key), 0);
bigW[0][0] := t0;
t1 := TConverters.ReadBytesAsUInt32LE(PByte(key), 4);
bigW[0][1] := t1;
t2 := TConverters.ReadBytesAsUInt32LE(PByte(key), 8);
bigW[0][2] := t2;
t3 := TConverters.ReadBytesAsUInt32LE(PByte(key), 12);
bigW[0][3] := t3;
t4 := TConverters.ReadBytesAsUInt32LE(PByte(key), 16);
bigW[1][0] := t4;
t5 := TConverters.ReadBytesAsUInt32LE(PByte(key), 20);
bigW[1][1] := t5;
t6 := TConverters.ReadBytesAsUInt32LE(PByte(key), 24);
bigW[1][2] := t6;
t7 := TConverters.ReadBytesAsUInt32LE(PByte(key), 28);
bigW[1][3] := t7;
rcon := 1;
i := 2;
while i < 14 do
begin
u := SubWord(Shift(t7, 8)) xor rcon;
rcon := rcon shl 1;
t0 := t0 xor u;
bigW[i][0] := t0;
t1 := t1 xor t0;
bigW[i][1] := t1;
t2 := t2 xor t1;
bigW[i][2] := t2;
t3 := t3 xor t2;;
bigW[i][3] := t3;
u := SubWord(t3);
t4 := t4 xor u;
bigW[i + 1][0] := t4;
t5 := t5 xor t4;
bigW[i + 1][1] := t5;
t6 := t6 xor t5;
bigW[i + 1][2] := t6;
t7 := t7 xor t6;
bigW[i + 1][3] := t7;
System.Inc(i, 2);
end;
u := SubWord(Shift(t7, 8)) xor rcon;
t0 := t0 xor u;
bigW[14][0] := t0;
t1 := t1 xor t0;
bigW[14][1] := t1;
t2 := t2 xor t1;
bigW[14][2] := t2;
t3 := t3 xor t2;;
bigW[14][3] := t3;
end
else
begin
raise EInvalidOperationCryptoLibException.CreateRes(@SInvalidOperation);
end;
end;
if (not forEncryption) then
begin
for j := 1 to System.Pred(FROUNDS) do
begin
smallw := bigW[j];
for i := 0 to System.Pred(4) do
begin
smallw[i] := Inv_Mcol(smallw[i]);
end;
end;
end;
result := bigW;
end;
function TAesEngine.GetAlgorithmName: String;
begin
result := 'AES';
end;
function TAesEngine.GetBlockSize: Int32;
begin
result := BLOCK_SIZE;
end;
function TAesEngine.GetIsPartialBlockOkay: Boolean;
begin
result := false;
end;
procedure TAesEngine.Init(forEncryption: Boolean;
const parameters: ICipherParameters);
var
keyParameter: IKeyParameter;
begin
if not Supports(parameters, IKeyParameter, keyParameter) then
begin
raise EArgumentCryptoLibException.CreateResFmt(@SInvalidParameterAESInit,
[(parameters as TObject).ToString]);
end;
FWorkingKey := GenerateWorkingKey(keyParameter.GetKey(), forEncryption);
FforEncryption := forEncryption;
if forEncryption then
begin
Fstate := System.Copy(Fs);
end
else
begin
Fstate := System.Copy(FSi);
end;
end;
procedure TAesEngine.PackBlock(const bytes: TCryptoLibByteArray; off: Int32);
begin
TConverters.ReadUInt32AsBytesLE(FC0, bytes, off);
TConverters.ReadUInt32AsBytesLE(FC1, bytes, off + 4);
TConverters.ReadUInt32AsBytesLE(FC2, bytes, off + 8);
TConverters.ReadUInt32AsBytesLE(FC3, bytes, off + 12);
end;
procedure TAesEngine.UnPackBlock(const bytes: TCryptoLibByteArray; off: Int32);
begin
FC0 := TConverters.ReadBytesAsUInt32LE(PByte(bytes), off);
FC1 := TConverters.ReadBytesAsUInt32LE(PByte(bytes), off + 4);
FC2 := TConverters.ReadBytesAsUInt32LE(PByte(bytes), off + 8);
FC3 := TConverters.ReadBytesAsUInt32LE(PByte(bytes), off + 12);
end;
function TAesEngine.ProcessBlock(const input: TCryptoLibByteArray; inOff: Int32;
const output: TCryptoLibByteArray; outOff: Int32): Int32;
begin
if (FWorkingKey = Nil) then
begin
raise EInvalidOperationCryptoLibException.CreateRes
(@AESEngineNotInitialised);
end;
TCheck.DataLength(input, inOff, 16, SInputBuffertooShort);
TCheck.OutputLength(output, outOff, 16, SOutputBuffertooShort);
UnPackBlock(input, inOff);
if (FforEncryption) then
begin
EncryptBlock(FWorkingKey);
end
else
begin
DecryptBlock(FWorkingKey);
end;
PackBlock(output, outOff);
result := BLOCK_SIZE;
end;
procedure TAesEngine.Reset;
begin
// nothing to do.
end;
end.
| 38.680101 | 117 | 0.601003 |
fc86b041d3cb962f5afe66566aab3f26641f4b0d | 23,218 | pas | Pascal | Func/Meta.Data.pas | randydom/d-ORModel | 40a2c7b6191cd5a7805222f52d372719dedcaf4b | [
"Apache-2.0"
]
| 13 | 2015-08-02T21:08:41.000Z | 2021-02-27T05:57:13.000Z | Func/Meta.Data.pas | randydom/d-ORModel | 40a2c7b6191cd5a7805222f52d372719dedcaf4b | [
"Apache-2.0"
]
| 2 | 2015-07-28T11:22:42.000Z | 2018-05-31T09:03:18.000Z | Func/Meta.Data.pas | ultraware/d-ORModel | 40a2c7b6191cd5a7805222f52d372719dedcaf4b | [
"Apache-2.0"
]
| 12 | 2015-01-12T16:17:56.000Z | 2021-03-01T08:34:32.000Z | {***************************************************************************}
{ }
{ d'ORModel - Model based ORM for Delphi }
{ https://github.com/ultraware/d-ORModel }
{ Copyright (C) 2013-2014 www.ultraware.nl }
{ }
{***************************************************************************}
{ }
{ 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 Meta.Data;
interface
uses // Delphi
Types;
type
{$RTTI EXPLICIT METHODS([vcPublic, vcPublished]) PROPERTIES([vcPublished]) FIELDS([])}
//!vcPublic is needed for attribute constructor to be visible!
TMetaAttribute = class(TCustomAttribute)
protected
FRefCount: Integer;
public
procedure IncRef;
procedure DecRef;
property RefCount: Integer read FRefCount;
end;
TBaseTableAttribute = class;
TBaseTableAttributeClass = class of TBaseTableAttribute;
TTableMeta = class(TMetaAttribute)
private
function GetTable: string; virtual;
protected
FDatabase,
FTable: string;
public
constructor Create(const aTable: string; const aDBName: string = '');
//todo: specific "group" in case multiple DB's or other types (excel etc)?
destructor Destroy; override;
function Clone: TTableMeta;
procedure Assign(aSource: TTableMeta); virtual;
property DBName: string read FDatabase write FDatabase;
property Table : string read GetTable;
end;
TFunctionTableMeta = class(TTableMeta)
private
Parameters: array of Variant;
function GetTable: string; override;
public
constructor Create(const aTable: string; aParameterCount: Integer; const aDBName: string = '');
procedure SetParameter(const aValue: Variant; const Index: Integer);
end;
TBaseFieldMeta = class(TMetaAttribute);
TFieldType = (
ftFieldUnknown,
ftFieldID, //PK field (can be without autoinc!)
ftFieldString,
ftFieldBoolean,
ftFieldDouble,
ftFieldInteger,
ftFieldDateTime,
ftFieldCurrency
);
TKeyMetaField = class(TBaseFieldMeta);
TPKMetaField = class(TKeyMetaField)
private
FIsAutoInc: boolean;
public
constructor Create(const aIsAutoInc: Boolean = True);
property IsAutoInc: boolean read FIsAutoInc;
end;
TFKMetaField = class(TKeyMetaField)
private
FFKTable: string;
FFKField: string;
public
constructor Create(const aFKTable, aFKField: string);
property FKTable: string read FFKTable; // write FFKTable;
property FKField: string read FFKField; // write FFKField;
end;
TDefaultValueMeta = class(TBaseFieldMeta)
private
FDefaultValue: string;
public
constructor Create(const aDefaultValue: string);
property DefaultValue: string read FDefaultValue;
end;
TBaseTableField = class;
TBaseTableFieldClass = class of TBaseTableField;
TFieldConstraintMeta = class(TBaseFieldMeta)
private
FFKField: TBaseTableAttribute;
FTableField: TBaseTableAttribute;
FValueConstraints: TStringDynArray;
public
constructor Create(const aTableField: TBaseTableAttribute; const aValueConstraints: TStringDynArray); overload;
constructor Create(const aFKField, aTableField: TBaseTableAttribute; const aValueConstraints: TStringDynArray); overload;
constructor Create(const aFKTable: TBaseTableAttributeClass; const aFKField: TBaseTableFieldClass;
const aFKTable2: TBaseTableAttributeClass; const aFKField2: TBaseTableFieldClass;
const aValueConstraint: string); overload;
destructor Destroy; override;
function IsSameTableField(aTableField: TBaseTableAttribute): Boolean;
function IsValidLocalValue(aValue: string): Boolean;
procedure CheckLocalValue(aValue: string);
property FKField: TBaseTableAttribute read FFKField;
property TableField: TBaseTableAttribute read FTableField;
property ValueConstraints: TStringDynArray read FValueConstraints;
end;
TTypedMetaField = class(TBaseFieldMeta)
private
FFieldName : string;
FDisplayLabel : string;
FFieldType : TFieldType;
FRequired: Boolean;
FDefaultValue: TDefaultValueMeta;
FTableAttribute: TBaseTableAttribute;
FDisplayWidth: Integer;
FEditFormat: string;
FDisplayFormat: string;
FEditMask: string;
FMinValue: Double;
FMaxValue: Double;
FVisible: Boolean;
procedure SetDisplayLabel(const Value: string);
procedure SetDefaultValue(const Value: TDefaultValueMeta);
procedure SetRequired(const Value: Boolean);
procedure SetDisplayFormat(const Value: string);
procedure SetDisplayWidth(const Value: Integer);
procedure SetEditFormat(const Value: string);
procedure SetEditMask(const Value: string);
function GetDisplayLabel: string;
procedure SetMaxValue(const Value: Double);
procedure SetMinValue(const Value: Double);
procedure SetVisible(const Value: Boolean);
public
constructor Create(const aFieldName: string;
aFieldType: TFieldType;
aRequired: Boolean;
const aDisplayLabel: string;
//aStringSize: Integer = 0;
aMinValue: Double;
aMaxValue: Double;
const aDisplayFormat: string = '';
const aDisplayWidth: Integer = 0;
const aEditFormat: string = '';
const aEditMask: string = '';
const aVisible: Boolean = True
); overload;
//compatible with older metadata:
constructor Create(const aFieldName: string;
aFieldType: TFieldType;
aRequired: Boolean;
const aDisplayLabel: string;
aMaxValue: Integer = 0); overload;
destructor Destroy; override;
function Clone: TTypedMetaField;
procedure Assign(aSource: TTypedMetaField); virtual;
property TableAttribute: TBaseTableAttribute read FTableAttribute write FTableAttribute;
property DefaultValue : TDefaultValueMeta read FDefaultValue write SetDefaultValue;
property FieldName : string read FFieldName;
property DisplayLabel : string read GetDisplayLabel write SetDisplayLabel;
property FieldType : TFieldType read FFieldType;
property Required : Boolean read FRequired write SetRequired;
property MinValue : Double read FMinValue write SetMinValue;
property MaxValue : Double read FMaxValue write SetMaxValue;
property DisplayWidth : Integer read FDisplayWidth write SetDisplayWidth;
//floating point formats for data aware controls using FormatFloat: http://docwiki.embarcadero.com/Libraries/XE2/en/Data.DB.TNumericField.EditFormat
property DisplayFormat: string read FDisplayFormat write SetDisplayFormat;
property EditFormat : string read FEditFormat write SetEditFormat;
//generic editmask: http://docwiki.embarcadero.com/Libraries/XE5/en/Vcl.Mask.TCustomMaskEdit.EditMask
property EditMask : string read FEditMask write SetEditMask;
property Visible : Boolean read FVisible write SetVisible;
end;
TBaseTableField = class(TObject);
TBaseTableAttribute = class(TMetaAttribute)
private
FConstraintMeta: TFieldConstraintMeta;
procedure SetFieldMetaData(const Value: TTypedMetaField);
procedure SetTableMetaData(const Value: TTableMeta); //[RelatieStam(ID)]
protected
FField: TBaseTableFieldClass;
FTableMetaData: TTableMeta;
FFieldMetaData: TTypedMetaField;
FKeyMetaData : TKeyMetaField;
FDefaultMeta : TDefaultValueMeta;
public
constructor Create(const aField: TBaseTableFieldClass);
procedure AfterConstruction; override;
destructor Destroy; override;
function Clone: TBaseTableAttribute;
procedure Assign(aSource: TBaseTableAttribute); virtual;
property Field: TBaseTableFieldClass read FField;
property TableMetaData: TTableMeta read FTableMetaData write SetTableMetaData;
property FieldMetaData: TTypedMetaField read FFieldMetaData write SetFieldMetaData;
property KeyMetaData : TKeyMetaField read FKeyMetaData write FKeyMetaData;
property DefaultMeta : TDefaultValueMeta read FDefaultMeta;
property ConstraintMeta: TFieldConstraintMeta read FConstraintMeta write FConstraintMeta;
end;
TCustomTableAttribute = class(TBaseTableAttribute)
public
destructor Destroy; override;
end;
implementation
uses // Delphi
RTTI, System.StrUtils, Variants, System.SysUtils, GlobalRTTI, Data.Base,
// Shared
UltraUtilsBasic;
{ TTableMeta }
procedure TTableMeta.Assign(aSource: TTableMeta);
begin
Self.FDatabase := aSource.FDatabase;
Self.FTable := aSource.FTable;
end;
function TTableMeta.Clone: TTableMeta;
begin
Result := Self.ClassType.Create as TTableMeta;
Result.Assign(Self);
end;
constructor TTableMeta.Create(const aTable, aDBName: string);
begin
FDatabase := aDBName;
FTable := aTable;
end;
destructor TTableMeta.Destroy;
begin
inherited;
end;
function TTableMeta.GetTable: string;
begin
Result := FTable;
end;
{ TTypedMetaField }
procedure TTypedMetaField.Assign(aSource: TTypedMetaField);
begin
Self.TableAttribute := aSource.FTableAttribute;
Self.DefaultValue := aSource.FDefaultValue;
Self.FFieldName := aSource.FFieldName;
Self.FDisplayLabel := aSource.FDisplayLabel;
Self.FFieldType := aSource.FFieldType;
Self.FRequired := aSource.FRequired;
Self.FMinValue := aSource.FMinValue;
Self.FMaxValue := aSource.FMaxValue;
Self.FVisible := aSource.FVisible;
end;
function TTypedMetaField.Clone: TTypedMetaField;
begin
Result := Self.ClassType.Create as TTypedMetaField;
Result.Assign(Self);
end;
constructor TTypedMetaField.Create(const aFieldName: string;
aFieldType: TFieldType; aRequired: Boolean; const aDisplayLabel: string;
aMaxValue: Integer = 0);
begin
Create(aFieldName, aFieldType, aRequired, aDisplayLabel, 0, aMaxValue);
end;
constructor TTypedMetaField.Create(const aFieldName: string;
aFieldType: TFieldType; aRequired: Boolean; const aDisplayLabel: string;
aMinValue: Double; aMaxValue: Double;
const aDisplayFormat: string = ''; const aDisplayWidth: Integer = 0; const aEditFormat: string = '';
const aEditMask: string = ''; const aVisible: Boolean = True);
begin
FFieldName := aFieldName;
FFieldType := aFieldType;
FDisplayLabel := aDisplayLabel;
FRequired := aRequired;
FMinValue := aMinValue;
FMaxValue := aMaxValue;
FDisplayFormat := aDisplayFormat;
FDisplayWidth := aDisplayWidth;
FEditFormat := aEditFormat;
FEditMask := aEditMask;
FVisible := aVisible;
end;
destructor TTypedMetaField.Destroy;
begin
inherited Destroy;
end;
function TTypedMetaField.GetDisplayLabel: string;
begin
if (FDisplayLabel <> '') then
Result := _(FDisplayLabel) // translate
else
Result := '';
end;
procedure TTypedMetaField.SetDefaultValue(const Value: TDefaultValueMeta);
begin
if FDefaultValue = Value then Exit;
if FDefaultValue <> nil then
FDefaultValue.DecRef;
FDefaultValue := Value;
if FDefaultValue <> nil then
FDefaultValue.IncRef;
end;
procedure TTypedMetaField.SetDisplayFormat(const Value: string);
begin
FDisplayFormat := Value;
end;
procedure TTypedMetaField.SetDisplayLabel(const Value: string);
begin
//todo: clone object (copy on write/change)
FDisplayLabel := Value;
end;
procedure TTypedMetaField.SetDisplayWidth(const Value: Integer);
begin
FDisplayWidth := Value;
end;
procedure TTypedMetaField.SetEditFormat(const Value: string);
begin
FEditFormat := Value;
end;
procedure TTypedMetaField.SetEditMask(const Value: string);
begin
FEditMask := Value;
end;
procedure TTypedMetaField.SetMaxValue(const Value: Double);
begin
FMaxValue := Value;
end;
procedure TTypedMetaField.SetMinValue(const Value: Double);
begin
FMinValue := Value;
end;
procedure TTypedMetaField.SetRequired(const Value: Boolean);
begin
FRequired := Value;
end;
procedure TTypedMetaField.SetVisible(const Value: Boolean);
begin
FVisible := Value;
end;
{ TBaseTableAttribute }
procedure TBaseTableAttribute.AfterConstruction;
var
t: TRttiType;
aa: TArray<TCustomAttribute>;
a: TCustomAttribute;
begin
inherited;
//table meta data
t := RTTICache.GetType(Self.ClassType);
while Self.FTableMetaData = nil do
begin
aa := t.GetAttributes;
for a in aa do
begin
//example:
//meta:
// [TTableMeta('Tekst')]
// Tekst = class(TBaseTableAttribute)
// public
// constructor Create(const aField: TTekstFieldClass);
// end;
// [TTypedMetaField('ID', ftFieldID, True{required}, '')] ID = class(TTekstField);
//crud:
// [Tekst(ID)] property ID: TTypedTekst_IDField index 0 read GetTypedTekst_IDField;
if a is TFunctionTableMeta then
begin
Self.FTableMetaData := a as TFunctionTableMeta;
if Self.FTableMetaData.RefCount = 0 then
Self.FTableMetaData.IncRef; //rtti ref
Self.FTableMetaData.IncRef; //own ref
Break;
end
else if a is TTableMeta then
begin
Self.FTableMetaData := a as TTableMeta; //[TTableMeta('MainDB', 'RelatieStam')]
if Self.FTableMetaData.RefCount = 0 then
Self.FTableMetaData.IncRef; //rtti ref
Self.FTableMetaData.IncRef; //own ref
Break;
end;
end;
if FTableMetaData = nil then
t := t.AsInstance.BaseType;
if t = nil then Break;
end;
//field meta
if FField <> nil then
begin
t := RTTICache.GetType(FField);
aa := t.GetAttributes;
for a in aa do
begin
if a is TTypedMetaField then
begin
Self.FFieldMetaData := a as TTypedMetaField; //[TTypedMetaField('ID', ftFieldInteger, True{required}, 'ID')]
if Self.FFieldMetaData.RefCount = 0 then
Self.FFieldMetaData.IncRef; //rtti ref
Self.FFieldMetaData.IncRef; //own ref
FFieldMetaData.TableAttribute := Self; //back link for table name
if FDefaultMeta <> nil then
FFieldMetaData.DefaultValue := Self.FDefaultMeta;
end
else if a is TPKMetaField then
begin
Self.FKeyMetaData := a as TPKMetaField; //[TPKMetaField]
if Self.FKeyMetaData.RefCount = 0 then
Self.FKeyMetaData.IncRef; //rtti ref
Self.FKeyMetaData.IncRef; //own ref
end
else if a is TFKMetaField then
begin
Self.FKeyMetaData := a as TFKMetaField; //[TFKMetaField(table,field)]
if Self.FKeyMetaData.RefCount = 0 then
Self.FKeyMetaData.IncRef; //rtti ref
Self.FKeyMetaData.IncRef; //own ref
end
else if a is TDefaultValueMeta then
begin
Self.FDefaultMeta := a as TDefaultValueMeta; //[TDefaultValueMeta('0')]
if Self.FDefaultMeta.RefCount = 0 then
Self.FDefaultMeta.IncRef; //rtti ref
Self.FDefaultMeta.IncRef; //own ref
if FFieldMetaData <> nil then
FFieldMetaData.DefaultValue := Self.FDefaultMeta;
end
else if a is TFieldConstraintMeta then
begin
Self.FConstraintMeta := a as TFieldConstraintMeta; //[StamSoortConstraint('Adres type')]
if Self.FConstraintMeta.RefCount = 0 then
Self.FConstraintMeta.IncRef; //rtti ref
Self.FConstraintMeta.IncRef; //own ref
end
else
raise EUltraException.CreateFmt('Unhandles attribute "%s"', [a.ClassName]);
end;
end;
end;
procedure TBaseTableAttribute.Assign(aSource: TBaseTableAttribute);
begin
Self.FField := aSource.FField;
Self.TableMetaData := aSource.FTableMetaData;
Self.FieldMetaData := aSource.FFieldMetaData;
Self.FKeyMetaData := aSource.FKeyMetaData;
Self.FDefaultMeta := aSource.FDefaultMeta;
Self.ConstraintMeta := aSource.FConstraintMeta;
end;
function TBaseTableAttribute.Clone: TBaseTableAttribute;
begin
Result := Self.ClassType.Create as TBaseTableAttribute;
Result.Assign(Self);
end;
constructor TBaseTableAttribute.Create(const aField: TBaseTableFieldClass);
begin
FField := aField;
end;
destructor TBaseTableAttribute.Destroy;
begin
//note: owned by rtti, so no .DecRef here! (object are freed by rtti in DIFFERENT ORDER)
//if FTableMetaData <> nil then FTableMetaData.DecRef;
//if FFieldMetaData <> nil then FFieldMetaData.DecRef;
//if FKeyMetaData <> nil then FKeyMetaData.DecRef;
//if FDefaultMeta <> nil then FDefaultMeta.DecRef;
inherited Destroy;
end;
procedure TBaseTableAttribute.SetFieldMetaData(const Value: TTypedMetaField);
begin
if FFieldMetaData = Value then Exit;
if FFieldMetaData <> nil then
FFieldMetaData.DecRef;
FFieldMetaData := Value;
if FFieldMetaData <> nil then
FFieldMetaData.IncRef;
end;
procedure TBaseTableAttribute.SetTableMetaData(const Value: TTableMeta);
begin
if FTableMetaData = Value then Exit;
if FTableMetaData <> nil then
FTableMetaData.DecRef;
FTableMetaData := Value;
if FTableMetaData <> nil then
FTableMetaData.IncRef;
end;
{ TDefaultValueMeta }
constructor TDefaultValueMeta.Create(const aDefaultValue: string);
begin
FDefaultValue := aDefaultValue;
end;
{ TMetaAttribute }
procedure TMetaAttribute.DecRef;
begin
Dec(FRefCount);
if FRefCount <= 0 then
Self.Free;
end;
procedure TMetaAttribute.IncRef;
begin
Inc(FRefCount);
end;
{ TCustomTableAttribute }
destructor TCustomTableAttribute.Destroy;
begin
//we created this object, so safe to .DecRef here?
if FTableMetaData <> nil then FTableMetaData.DecRef;
if FFieldMetaData <> nil then FFieldMetaData.DecRef;
if FKeyMetaData <> nil then FKeyMetaData.DecRef;
if FDefaultMeta <> nil then FDefaultMeta.DecRef;
FTableMetaData := nil;
FFieldMetaData := nil;
FKeyMetaData := nil;
FDefaultMeta := nil;
inherited;
end;
{ TFieldConstraintMeta }
procedure TFieldConstraintMeta.CheckLocalValue(aValue: string);
begin
if not IsValidLocalValue(aValue) then
raise EDataException.Createfmt('Constraint error: "%s" is not allowed', [aValue]);
end;
constructor TFieldConstraintMeta.Create(const aTableField: TBaseTableAttribute;
const aValueConstraints: TStringDynArray);
begin
FTableField := aTableField;
FValueConstraints := aValueConstraints;
end;
constructor TFieldConstraintMeta.Create(const aFKField,
aTableField: TBaseTableAttribute; const aValueConstraints: TStringDynArray);
begin
FFKField := aFKField;
FTableField := aTableField;
FValueConstraints := aValueConstraints;
end;
function TFieldConstraintMeta.IsSameTableField(
aTableField: TBaseTableAttribute): Boolean;
begin
Result := (aTableField.FTableMetaData = Self.FTableField.FTableMetaData);
end;
function TFieldConstraintMeta.IsValidLocalValue(aValue: string): Boolean;
begin
Result := MatchText(aValue, Self.FValueConstraints);
end;
constructor TFieldConstraintMeta.Create(
const aFKTable: TBaseTableAttributeClass;
const aFKField: TBaseTableFieldClass;
const aFKTable2: TBaseTableAttributeClass;
const aFKField2: TBaseTableFieldClass; const aValueConstraint: string);
var
fkattr, fkattr2: TBaseTableAttribute;
sa: TStringDynArray;
begin
fkattr := aFKTable.Create(aFKField);
fkattr2 := aFKTable2.Create(aFKField2);
setLength(sa, 1);
sa[0] := aValueConstraint;
Create(fkattr, fkattr2, sa);
end;
destructor TFieldConstraintMeta.Destroy;
begin
if (FFKField <> nil) and (FFKField.FRefCount = 0) then
FFKField.Free;
if (FTableField <> nil) and (FTableField.FRefCount = 0) then
FTableField.Free;
inherited;
end;
{ TFKMetaField }
constructor TFKMetaField.Create(const aFKTable, aFKField: string);
begin
FFKTable := aFKTable;
FFKField := aFKField;
end;
{ TFunctionTableMeta }
constructor TFunctionTableMeta.Create(const aTable: string; aParameterCount: Integer; const aDBName: string);
begin
inherited Create(aTable, aDBName);
SetLength(Parameters, aParameterCount);
end;
function TFunctionTableMeta.GetTable: string;
var i: Integer;
parameter: Variant;
parametersStr, parameterStr: string;
begin
parametersStr := '';
for i := 0 to Length(Parameters) -1 do
begin
parameter := Parameters[i];
case VarType(parameter) of
varString, varUString, varWord, varLongWord:
parameterStr := QuotedStr(VarToStr(parameter));
varDate:
parameterStr := QryDateToStr(VarToDateTime(parameter));
else
parameterStr := VarToStr(parameter);
end;
if (parameterStr = '') then
parameterStr := 'null';
AddToCSVList(parameterStr, parametersStr)
end;
Result := FTable +'('+parametersStr+')';
end;
procedure TFunctionTableMeta.SetParameter(const aValue: Variant; const Index: Integer);
begin
Parameters[Index] := aValue;
end;
{ TPKMetaField }
constructor TPKMetaField.Create(const aIsAutoInc: Boolean);
begin
FIsAutoInc := aIsAutoInc;
end;
end.
| 32.84017 | 153 | 0.659445 |
fc87b45a3b7ffad5684cafe5ddb91e7f2c47270d | 27,976 | pas | Pascal | LIB/MIDI_Component/MIDIFile2.pas | oranke/mozart_minuet | b4ab1f2554bc2aa8ef08686d12daea3b7b6032ff | [
"MIT"
]
| 2 | 2017-11-03T04:06:25.000Z | 2020-10-14T02:27:15.000Z | LIB/MIDI_Component/MIDIFile2.pas | oranke/mozart_minuet | b4ab1f2554bc2aa8ef08686d12daea3b7b6032ff | [
"MIT"
]
| null | null | null | LIB/MIDI_Component/MIDIFile2.pas | oranke/mozart_minuet | b4ab1f2554bc2aa8ef08686d12daea3b7b6032ff | [
"MIT"
]
| null | null | null | { TMidiFile2
The component for MIDI File Reader.
You can get various information of MIDI file such as format type, number of tracks, playback
length and others, with this component.
note) The source units of Tnt Delphi UNICODE Controls are needed if you compile this unit
with Delphi 2007 or earlier version.
#### Copyright Notice ####
Copyright 2011 Silhwan Hyun, All Rights Reserved
This unit is free. It may be used both in commercial and non-commercial software either in
original or in modified form.
This unit can be freely distributed in any way and by any means provided this copyright
notice is preserved.
Author : Silhwan Hyun (e-mail addr : hyunsh@hanafos.com)
Author's comment : Please let me know if you have any idea to improve or to debug this unit.
Revision History
--------------------------
Ver 0.9.4 07 Apr 2012
- Added property LyricsTrack
- Added property SyncLyrics
Ver 0.9.3 27 Aug 2011
- Fixed bug : incorrect result of function Time2TickPos
- Added property Lyrics ( = whole lyrics in plain text)
note) You also can get the lyrics with time information from property RawLyrics of TMidiTrack.
Ver 0.9.2 09 Jul 2011
- Fixed incorrect result of function Time2TickPos
- Added function Tick2TimePos
Ver 0.9.1 26 Jun 2011
- Replaced data interface function "ReadMidiFile" with component "TMidiFile".
Ver 0.9.0 05 Jun 2011
- Initial release (function "ReadMidiFile" is used for data interface)
'----------------------------------------------------------------------------}
unit MidiFile2;
interface
uses Classes, SysUtils, Types, Windows {$IFNDEF UNICODE}, TntClasses{$ENDIF};
type
{$IFNDEF UNICODE}
UnicodeString = WideString;
{$ENDIF}
TMidiEvent = record
Event: Byte;
Data1: Byte;
Data2: Byte;
Msg: AnsiString;
Positon: LongWord;
end;
PMidiEvent = ^TMidiEvent;
TTempoData = record
TickPos: LongWord;
TimePos: LongWord;
Tempo: LongWord;
end;
PTempoData = ^TTempoData;
TRawLyric = record
Position: Integer;
Lyric: AnsiString;
end;
TRawLyrics = array of TRawLyric;
TMidiTrack = class(TObject)
private
FEventList: TList;
FRawLyrics: TRawLyrics;
FActive: Boolean;
FEndOfTrack: Boolean; // True : playing position reached the end of track
FTrackName: AnsiString;
FTrackKeyword: AnsiString;
FCopyright: AnsiString;
FInstrument: AnsiString;
FPlayPos: Integer;
protected
function GetEventCount: Integer;
public
constructor Create;
destructor Destroy; override;
procedure AddEvent(Event: PMidiEvent);
function GetEvent(Index: Integer): PMidiEvent;
// oranke가 임시
procedure DeleteEvent(Index: Integer; StubOnly: Boolean = false);
// function GetChannels(Index: Integer): Boolean;
published
property Active: Boolean read FActive write FActive;
property RawLyrics: TRawLyrics read FRawLyrics;
property EndOfTrack: Boolean read FEndOfTrack write FEndOfTrack;
property PlayPos: Integer read FPlayPos write FPlayPos;
property TrackKeyword: AnsiString read FTrackKeyword;
property TrackName: AnsiString read FTrackName;
property Copyright: AnsiString read FCopyright;
property Instrument: AnsiString read FInstrument;
property EventCount: Integer read GetEventCount;
// oranke가 임시 추가.
//property EventList: TList read FEventList;
end;
TMidiFileInfo = record
FileSize: Int64; { File size (bytes) }
Format: Word; { 0: single-track, 1: multiple tracks, synchronous, 2: multiple tracks, asynchronous }
Tracks: Word;
Tempos: Word;
TrackList: TList;
TempoList: TList;
TickUnit: Word; { 0: Ticks per quarter note, 1: Ticks per second }
Ticks: Word; { Ticks per quarter note or Ticks per second }
PlayTime: LongWord; { Play length in mili seconds }
PlayTicks: LongWord; { Play length in ticks }
end;
TMidiFile2 = class(TComponent)
private
FIsValid: Boolean;
FFormat: Word;
FTickUnit: Word;
FTicksPerQuarter: Word;
FTrackList: TList;
FTempoList: TList;
FTrackCount: word;
FTempoCount: word;
FDuration: LongWord;
FPlayTicks: LongWord;
FLyricsTrack: Integer; // ** Added at ver 0.9.4
FLyrics: AnsiString; // ** Added at ver 0.9.3
procedure ClearList;
function GetSyncLyrics: TRawLyrics; // ** Added at ver 0.9.4
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function ReadFromStream(Stream: TStream): Boolean; { Load data }
function ReadFromFile(const FileName: WideString): Boolean; { Load data }
property Valid: Boolean read FIsValid; { True if file valid }
property Format: Word read FFormat; { 0: single-track, 1: multiple tracks, synchronous, 2: multiple tracks, asynchronous }
property TickUnit: Word read FTickUnit; { 0: Ticks per quarter note, 1: Ticks per second }
property TicksPerQuarter: Word read FTicksPerQuarter;
property TrackCount: word read FTrackCount; { Number of tracks }
property TempoCount: word read FTempoCount; { Number of tempos }
function GetTrack(Index: Integer): TMidiTrack; { Gets an item of TMidiTrack }
function GetTempo(Index: Integer): PTempoData; { Gets an item of tempo data }
property Duration: LongWord read FDuration //; { Play length in milliseconds }
write FDuration;
property PlayTicks: LongWord read FPlayTicks //; { Play length in ticks }
write FPlayTicks;
property LyricsTrack: Integer read FLyricsTrack; { The track where lyrics is recorded }
property Lyrics: AnsiString read FLyrics; { The plain lyrics text }
property SyncLyrics: TRawLyrics read GetSyncLyrics; { The sync lyrics data }
function Time2TickPos(TimeVal: LongWord): LongWord; { Get position in ticks from position in time(milliseconds) }
function Tick2TimePos(TickVal: LongWord): LongWord; { Get position in time(milliseconds) from position in ticks }
end;
// function ReadMidiFile(const FileName: UnicodeString; var Info: TMidiFile2Info): Boolean;
procedure Register;
implementation
const
MIDI_ID = 'MThd';
TRACK_ID = 'MTrk';
// End_Of_Track = $FF2F00;
DefaultTempo = 500000; // 500000 microseconds per quarter note = 0.5 second per quarter note.
type
TFileID = array[1..4] of AnsiChar;
TTempoMap = array of TTempoData;
TTimeSig = packed record
Numer: byte; // numerator
Denom: byte; // denominator
Metro: byte; // metronome pulse
Notes: byte; // The number of 32nd notes per 24 MIDI clock signals
end;
{ TMidiTrack }
constructor TMidiTrack.Create;
begin
inherited Create;
FEventList := TList.Create;
FActive := true;
FEndOfTrack := False;
FTrackName := '';
FTrackKeyword := '';
FCopyright := '';
FInstrument := '';
FPlayPos := 0;
end;
destructor TMidiTrack.Destroy;
var
i: integer;
begin
for i := 0 to FEventList.Count - 1 do
Dispose(PMidiEvent(FEventList[i]));
FEventList.Free;
SetLength(FRawLyrics, 0); // **
inherited;
end;
procedure TMidiTrack.AddEvent(Event: PMidiEvent);
var
N: Integer;
begin
if (Event^.Event = $FF) then
begin
case Event^.Data1 of
$1: FTrackKeyword := FTrackKeyword + Event^.Msg;
$2: FCopyright := FCopyright + Event^.Msg;
$3: FTrackName := FTrackName + Event^.Msg;
$4: FInstrument := FInstrument + Event^.Msg;
$5: begin // **
N := High(FRawLyrics) + 1; // N : the number of recored lyrics
SetLength(FRawLyrics, N + 1);
FRawLyrics[N].Position := Event^.Positon;
FRawLyrics[N].Lyric := Event^.Msg;
end;
end;
end else
begin
{ case Event^.iEvent of
$B0..$BF, $C0..$CF: // control change, program change
FChannels[Event^.iEvent and $F] := True;
end; }
end;
FEventList.Add(Event);
end;
function TMidiTrack.GetEvent(Index: Integer): PMidiEvent;
begin
if (Index >= 0) and (Index < FEventList.Count) then
Result := PMidiEvent(FEventList[Index]) else
Result := nil;
end;
procedure TMidiTrack.DeleteEvent(Index: Integer; StubOnly: Boolean);
begin
if (Index >= 0) and (Index < FEventList.Count) then
begin
if not StubOnly then
Dispose(PMidiEvent(FEventList[Index]));
FEventList.Delete(Index);
end;
end;
function TMidiTrack.GetEventCount: Integer;
begin
Result := FEventList.Count;
end;
{function TMidiTrack.GetChannels(Index: Integer): Boolean;
begin
Result := FChannels[Index];
end; }
function GetInfo(SourceStream: TStream; var Info: TMidiFileInfo): Boolean; overload;
//function GetInfo(const FileName: UnicodeString; var Info: TMidiFileInfo): Boolean; overload;
var
{$IFNDEF UNICODE}
//SourceFile: TTntFileStream;
{$ELSE}
//SourceFile: TFileStream;
{$ENDIF}
//SourceStream: TStream;
FileID: TFileID;
TrackID: TFileID;
buf: array[1..4] of byte;
//TrackDataSize: integer;
I, N1: integer;
DeltaTime: LongWord;
Tempo: LongWord;
Len: word;
EndOfTrack: boolean;
DataBytes: integer;
Elapsed: LongWord;
ElapsedTime: array of LongWord;
MaxTime: LongWord;
Play_Time: double;
Status, RunningStatus: byte;
SysExContinue: boolean;
NextValue: byte;
str: AnsiString;
MidiTrack: TMidiTrack;
TempoCounter: word;
TempoMap: TTempoMap;
PTempo: PTempoData;
pEvent1: PMidiEvent;
function GetDelta(var Len_: word): LongWord;
var
m: LongWord;
n: integer;
b: byte;
LastByte: boolean;
begin
m := 0;
Len_ := 0;
LastByte := false;
for n := 0 to 4 do
begin
if SourceStream.Position >= (SourceStream.Size - 1) then
break;
SourceStream.Read(b, 1);
{ if (b = $FF) then
break; }
inc(Len_);
if (b and $80) = 0 then
LastByte := true;
m := (m shl 7) + (b and $7f);
if LastByte then
break;
end;
result := m;
end;
procedure AddDeltaTime(DeltaTime_: LongWord; Track_: byte; Adding: boolean; var Elapsed_: LongWord);
begin
if DeltaTime_ = 0 then
exit;
if Adding then
begin // Add
if Info.Format = 0 then
Elapsed_ := Elapsed_ + DeltaTime_
else begin
ElapsedTime[Track_] := ElapsedTime[Track_] + DeltaTime_;
Elapsed_ := ElapsedTime[Track_];
end;
end else
begin // Substract
if Info.Format = 0 then
Elapsed_ := Elapsed_ - DeltaTime_
else begin
ElapsedTime[Track_] := ElapsedTime[Track_] - DeltaTime_;
Elapsed_ := ElapsedTime[Track_];
end;
end;
end;
procedure SaveChannelEvents(Status_: byte; Elapsed_: LongWord);
var
MessageType: byte;
ChanData: array[1..2] of byte;
pEvent: PMidiEvent;
begin
MessageType := Status_ and $F0;
New(pEvent); // New event
pEvent^.Event := Status_;
pEvent^.Positon := Elapsed_;
// $80 : Note off, $90 : Note on, $A0 : Note After touch, $B0 : Control change
// $C0 : Program change, $D0 : Channel after touch, $E0 : Pitch wheel change
case MessageType of
$80, $90, $A0, $B0, $E0 : begin
SourceStream.Read(ChanData, 2);
pEvent^.Data1 := ChanData[1];
pEvent^.Data2 := ChanData[2];
end;
$C0, $D0 : begin
SourceStream.Read(ChanData, 1);
pEvent^.Data1 := ChanData[1];
end;
end;
MidiTrack.AddEvent(pEvent);
end;
procedure SaveMetaEvent(Status_: byte; Elapsed_: LongWord);
var
DataBytes_: word;
DataType: byte;
Len2: word;
pEvent: PMidiEvent;
str2: AnsiString;
begin
{ DataType Description
0 Set track’s sequence #
$01 User Text
$02 Copyright info.
$03 Track name
$04 Instrument Names
$05 Lyric
$06 Marker
$07 Cue Point
$08 Program Name
$09 Device Name
$20 MIDI channel prefix assignment
$21 MIDI port
$51 Set tempo (microseconds per quarter note)
$54 SMPTE Offset
$58 Time signature
$59 Key signature
$7f Sequencer specific
end; }
SourceStream.Read(DataType, 1); // Read type code of Meta event
DataBytes_ := GetDelta(Len2); // Read the length of data
SetLength(str2, DataBytes_);
SourceStream.Read(str2[1], DataBytes_); // Read text
if DataType = $2f then // End of Track ?
EndOfTrack := true
else if DataType = $51 then // Set tempo
begin
Tempo := (byte(str2[1]) shl 16) + (byte(str2[2]) shl 8) + byte(str2[3]);
if TempoCounter <> 0 then
if TempoMap[TempoCounter-1].TickPos = Elapsed then
exit;
inc(TempoCounter);
SetLength(TempoMap, TempoCounter);
TempoMap[TempoCounter-1].TickPos := Elapsed;
TempoMap[TempoCounter-1].Tempo := Tempo;
end;
New(pEvent);
pEvent^.Event := Status_;
pEvent^.Positon := Elapsed_;
pEvent^.Data1 := DataType;
pEvent^.Msg := str2;
MidiTrack.AddEvent(pEvent);
end;
procedure Raise_Exception(S: string);
begin
MessageBox(0, pChar(S), 'Confirm', MB_OK);
raise Exception.Create('');
end;
begin
{ Get info from file }
//Result := false;
//SourceStream := nil;
try
Result := false;
{$IFNDEF UNICODE}
//SourceStream := TTntFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
{$ELSE}
//SourceStream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
{$ENDIF}
Info.FileSize := SourceStream.Size;
SourceStream.Read(FileID, 4); // Read File ID. (should be 'MThd')
if FileID <> MIDI_ID then
Raise_Exception('File has invalid MIDI Header ID.');//#13#10#13#10 + ' => ' + FileName);
SourceStream.Read(buf, 4); // Read Header Length (should be $00000006)
if (buf[1] <> 0) or (buf[2] <> 0) or (buf[3] <> 0) or (buf[4] <> 6) then
Raise_Exception('File has invalid MIDI Header length.');//'#13#10#13#10 + ' => ' + FileName);
SourceStream.Read(buf, 2); // Read Format Type ($00 ~ $02)
Info.Format := buf[1] * 256 + buf[2];
SourceStream.Read(buf, 2); // Read number of tracks (1 ~ 65,535)
Info.Tracks := buf[1] * 256 + buf[2];
SourceStream.Read(buf, 2); // Read Time Division
Info.TickUnit := buf[1] shr 7; // Take MSB of buf[1]
if Info.TickUnit = 0 then // 0: Ticks per quarter note
Info.Ticks := buf[1] * 256 + buf[2]
else // none 0: Ticks per frame
Info.Ticks := (128 - (buf[1] and $7f)) * buf[2];
N1 := Info.Tracks;
Info.TrackList := TList.Create;
SetLength(ElapsedTime, Info.Tracks);
for I := 1 to Info.Tracks do
ElapsedTime[I-1] := 0;
Tempo:= DefaultTempo;
TempoCounter := 0;
for I := 0 to (N1 - 1) do
begin
SourceStream.Read(TrackID, 4); // Read Track ID. (should be 'MTrk')
if TrackID <> TRACK_ID then
Raise_Exception('File has invalid MIDI Track ID.');//#13#10#13#10 + ' => ' + FileName);
Elapsed := 0;
MidiTrack := TMidiTrack.Create;
Info.TrackList.Add(MidiTrack); // Add to track list
SourceStream.Read(buf, 4); // Read Track size
//TrackDataSize := (buf[1] shl 24) + (buf[2] shl 16) + (buf[3] shl 8) + buf[4];
// Info.TrackNames[I] := '';
EndOfTrack := false;
RunningStatus := 0; // the running status byte
SysExContinue := false; // whether we're in a multi-segment system exclusive message
repeat
DeltaTime := GetDelta(Len);
SourceStream.Read(NextValue, 1); // Read Status Byte
// Are we continuing a sys ex? If so, the next value should be $F7
if (SysExContinue and (NextValue <> $F7)) then
Raise_Exception(Format('Expected to find a system exclusive continue byte at,'#13#10#13#10 + '%d',
[SourceStream.Position]));
// Are we in running status? Determine whether we're running and what the current status byte is.
if ((NextValue and $80) = 0) then
begin
if (RunningStatus = 0) then
Raise_Exception(Format('Status byte required for running status at,'#13#10#13#10 + '%d',
[SourceStream.Position]));
// Keep the last iteration's status byte, and now we're in running mode
SourceStream.Position := SourceStream.Position - 1; // backward to 1 byte.
Status := RunningStatus;
end else
begin
// Running status is only implemented for Voice Category messages (ie, Status is $80 to $EF).
if (NextValue >= $80) and (NextValue <= $EF) then
RunningStatus := NextValue
// System Common Category messages (ie, Status of 0xF0 to 0xF7) cancel any running status.
// note) RealTime Category messages (ie, Status of 0xF8 to 0xFF) do not effect running status in any way.
else if (NextValue >= $F0) and (NextValue <= $F7) then
RunningStatus := 0;
Status := NextValue;
end;
AddDeltaTime(DeltaTime, I, true{Adding}, Elapsed);
if (Status >= $80) and (Status <= $EF) then // MIDI Channel Event ?
begin
// Handle channel events
SaveChannelEvents(Status, Elapsed);
end
else if (Status = $FF) then // Meta Event ?
begin
// Handle meta events
SaveMetaEvent(Status, Elapsed);
if EndOfTrack then // The DeltaTime at "End of Track" event should not be accounted.
AddDeltaTime(DeltaTime, I, false{Adding}, Elapsed);
end
else if (Status >= $F8) and (Status <= $FE) then // System Real-Time Message ?
begin
New(pEvent1);
pEvent1^.Event := Status;
pEvent1^.Positon := Elapsed;
MidiTrack.AddEvent(pEvent1);
end
else if (Status >= $F1) and (Status <= $F6) then // System Common Message ?
begin
New(pEvent1);
pEvent1^.Event := Status;
pEvent1^.Positon := Elapsed;
if (Status = $F1) or (Status = $F3) then
begin
SourceStream.Read(buf, 1);
pEvent1^.Data1 := buf[1];
end else
if (Status = $F2) then
begin
SourceStream.Read(buf, 2);
pEvent1^.Data1 := buf[1];
pEvent1^.Data2 := buf[2];
end;
MidiTrack.AddEvent(pEvent1);
end
else if (Status = $F0) or (Status = $F7) then // System Exclusive Message ?
begin
DataBytes := GetDelta(Len); // Read the length of data
if DataBytes = 0 then // ** Added for the case there is no data. (2012-04-16)
Continue;
SetLength(str, DataBytes);
SourceStream.Read(str[1], DataBytes); // Read data
if (Status = $F0) then
if (ord(str[DataBytes]) <> $F7) then // multi-segment Message ?
SysExContinue := true;
if (Status = $F7) then // Message continuations ?
if (ord(str[DataBytes]) = $F7) then // Found end marker ?
SysExContinue := false;
New(pEvent1);
pEvent1^.Event := Status;
pEvent1^.Positon := Elapsed;
pEvent1^.Msg := str;
MidiTrack.AddEvent(pEvent1);
end;
until EndOfTrack or (SourceStream.Position = (SourceStream.Size - 1));
if SourceStream.Position = (SourceStream.Size - 1) then
break;
end; // end of "for I := 1 to N do"
if Info.Format = 0 then
MaxTime := Elapsed
else begin
MaxTime := ElapsedTime[0];
for I := 1 to (Info.TrackList.Count - 1) do
if ElapsedTime[I] > MaxTime then
MaxTime := ElapsedTime[I];
end;
Info.PlayTicks := MaxTime;
if Info.TickUnit = 0 then {0: Ticks per quarter note, 1: Ticks per second}
begin
if TempoCounter = 0 then
Play_Time := (MaxTime / Info.Ticks) * (Tempo / 1000.0)
else if TempoCounter = 1 then
Play_Time := (MaxTime / Info.Ticks) * (TempoMap[0].Tempo / 1000.0)
else begin
if TempoMap[0].TickPos = 0 then
begin
Play_Time := 0;
TempoMap[0].TimePos := 0
end else begin
Play_Time := ((TempoMap[0].TickPos) / Info.Ticks) * (DefaultTempo / 1000.0);
TempoMap[0].TimePos := round(Play_Time);
end;
for I := 0 to TempoCounter - 2 do
begin
Play_Time := Play_Time
+ ((TempoMap[I+1].TickPos - TempoMap[I].TickPos) / Info.Ticks) * (TempoMap[I].Tempo / 1000.0);
TempoMap[I+1].TimePos := round(Play_Time);
end;
if MaxTime > TempoMap[TempoCounter - 1].TickPos then
Play_Time := Play_Time
+ ((MaxTime - TempoMap[TempoCounter - 1].TickPos) / Info.Ticks) * (TempoMap[TempoCounter - 1].Tempo / 1000.0);
end;
Info.PlayTime := round(Play_Time);
end else
Info.PlayTime := round((MaxTime / Info.Ticks) * 1000.0);
Info.TempoList := TList.Create;
if TempoCounter = 0 then
begin
Info.Tempos := 1;
new(PTempo);
PTempo^.TickPos := 0;
PTempo^.TimePos := 0;
PTempo^.Tempo := Tempo;
Info.TempoList.Add(PTempo);
end else
begin
Info.Tempos := TempoCounter;
for I := 0 to (TempoCounter - 1) do
begin
new(PTempo);
PTempo^.TickPos := TempoMap[I].TickPos;
PTempo^.TimePos := TempoMap[I].TimePos;
PTempo^.Tempo := TempoMap[I].Tempo;
Info.TempoList.Add(PTempo);
end;
end;
Result := true;
finally
//SourceStream.Free;
SetLength(ElapsedTime, 0);
SetLength(str, 0);
SetLength(TempoMap, 0);
end;
end;
(*
function GetInfo(const FileName: UnicodeString; var Info: TMidiFileInfo): Boolean; overload;
var
SourceStream: TStream;
begin
{$IFNDEF UNICODE}
SourceStream := TTntFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
{$ELSE}
SourceStream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
{$ENDIF}
try
Result := GetInfo(SourceStream, Info);
finally
SourceStream.Free;
end;
end;
(**)
{ function ReadMidiFile(const FileName: UnicodeString; var Info: TMidiFile2Info): Boolean;
begin
result := GetInfo(FileName, Info);
end; }
constructor TMidiFile2.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FTrackList := TList.Create;
FTempoList := TList.Create;
FLyricsTrack := -1;
end;
destructor TMidiFile2.Destroy;
begin
ClearList;
FTrackList.Free;
FTempoList.Free;
inherited;
end;
procedure TMidiFile2.ClearList;
var
i: Integer;
begin
for i := 0 to FTrackCount - 1 do
TMidiTrack(FTrackList[i]).Free;
FTrackList.Clear;
for i := 0 to FTempoCount - 1 do
Dispose(PTempoData(FTempoList[i]));
FTempoList.Clear;
end;
function TMidiFile2.ReadFromStream(Stream: TStream): Boolean;
var
FileInfo: TMidiFileInfo;
I, N: integer;
begin
FLyricsTrack := -1;
FLyrics := ''; // ** Added at 2012-04-07
try
FileInfo.TrackList := nil;
FileInfo.TempoList := nil;
//Stream.Position := 0;
FIsValid := GetInfo(Stream, FileInfo);
except
end;
if FIsValid then
begin
FFormat := FileInfo.Format;
FTickUnit := FileInfo.TickUnit;
FTicksPerQuarter := FileInfo.Ticks;
ClearList;
FTrackCount := FileInfo.Tracks;
FTempoCount := FileInfo.Tempos;
for I := 0 to FTrackCount - 1 do
begin
FTrackList.Add(FileInfo.TrackList[I]);
if High(TMidiTrack(FileInfo.TrackList[I]).FRawLyrics) <> - 1 then
FLyricsTrack := I;
end;
if FLyricsTrack <> -1 then
begin
N := High(TMidiTrack(FileInfo.TrackList[FLyricsTrack]).FRawLyrics);
for I := 0 to N do
FLyrics := FLyrics + TMidiTrack(FileInfo.TrackList[FLyricsTrack]).FRawLyrics[I].Lyric;
end;
for I := 0 to FTempoCount - 1 do
FTempoList.Add(FileInfo.TempoList[I]);
FDuration := FileInfo.PlayTime;
FPlayTicks := FileInfo.PlayTicks;
FIsValid := (FTrackCount > 0) and (FDuration > 0);
result := true;
end else
begin
FIsValid := false;
result := false;
end;
if FileInfo.TrackList <> nil then
begin
FileInfo.TrackList.Clear;
FileInfo.TrackList.Free;
end;
if FileInfo.TempoList <> nil then
begin
FileInfo.TempoList.Clear;
FileInfo.TempoList.Free;
end;
end;
function TMidiFile2.ReadFromFile(const FileName: WideString): Boolean;
var
SourceStream: TStream;
begin
{$IFNDEF UNICODE}
SourceStream := TTntFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
{$ELSE}
SourceStream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
{$ENDIF}
try
Result := ReadFromStream(SourceStream);
finally
SourceStream.Free;
end;
end;
function TMidiFile2.GetTrack(Index: Integer): TMidiTrack;
begin
if (Index >= 0) and (Index < FTrackList.Count) then
Result := TMidiTrack(FTrackList[Index]) else
Result := nil;
end;
function TMidiFile2.GetTempo(Index: Integer): PTempoData;
begin
if (Index >= 0) and (Index < FTempoList.Count) then
Result := PTempoData(FTempoList[Index]) else
Result := nil;
end;
function TMidiFile2.Time2TickPos(TimeVal: LongWord): LongWord; // milliseconds -> ticks
var
I, K: integer;
Residue: LongWord;
NumQuarter: double;
begin
if not FIsValid then
begin
result := 0;
exit;
end;
if TimeVal = 0 then
begin
result := 0;
exit;
end;
{ if Val > FDuration then
begin
result := FPlayTicks;
exit;
end; }
if FTickUnit = 1 then {0: Ticks per quarter note, 1: Ticks per second}
begin
result := round(TimeVal * FTicksPerQuarter / 1000.0);
exit;
end;
if FTempoCount = 1 then
begin
if PTempoData(FTempoList[0])^.TimePos = 0 then
result := round(TimeVal * FTicksPerQuarter / PTempoData(FTempoList[0])^.Tempo * 1000.0)
else if TimeVal < PTempoData(FTempoList[0])^.TimePos then
result := round(TimeVal * FTicksPerQuarter / DefaultTempo * 1000.0)
else begin
Residue := TimeVal - PTempoData(FTempoList[0])^.TimePos;
NumQuarter := (Residue * 1000.0) / PTempoData(FTempoList[0])^.Tempo;
result := round(PTempoData(FTempoList[0])^.TickPos + NumQuarter * FTicksPerQuarter);
end;
exit;
end;
K := (FTempoCount - 1);
for I := 1 to (FTempoCount - 1) do
if PTempoData(FTempoList[I])^.TimePos > TimeVal then
begin
K := I - 1;
break;
end;
if (K = 0) and (TimeVal < PTempoData(FTempoList[K])^.TimePos) then // ** Added
NumQuarter := (TimeVal * 1000.0) / DefaultTempo
else begin
Residue := TimeVal - PTempoData(FTempoList[K])^.TimePos;
NumQuarter := (Residue * 1000.0) / PTempoData(FTempoList[K])^.Tempo;
end;
result := round(PTempoData(FTempoList[K])^.TickPos + NumQuarter * FTicksPerQuarter);
end;
function TMidiFile2.Tick2TimePos(TickVal: LongWord): LongWord; // ticks -> milliseconds
var
I, K: integer;
begin
if not FIsValid then
begin
result := 0;
exit;
end;
if TickVal = 0 then
begin
result := 0;
exit;
end;
if FTickUnit = 0 then {0: Ticks per quarter note, 1: Ticks per second}
begin
K := FTempoCount - 1;
for I := (FTempoCount - 1) downto 0 do
begin
if TickVal < PTempoData(FTempoList[I])^.TickPos then
dec(K);
end;
if K < 0 then
result := round((TickVal / FTicksPerQuarter) * (DefaultTempo / 1000.0))
else
result := round(PTempoData(FTempoList[K])^.TimePos
+ ((TickVal - PTempoData(FTempoList[K])^.TickPos) / FTicksPerQuarter) * (PTempoData(FTempoList[K])^.Tempo / 1000.0));
end else
result := round((TickVal / FTicksPerQuarter) * 1000.0);
end;
function TMidiFile2.GetSyncLyrics: TRawLyrics;
begin
if FLyricsTrack <> -1 then
result := TMidiTrack(FTrackList[FLyricsTrack]).FRawLyrics
else
SetLength(result, 0);
end;
procedure Register;
begin
RegisterComponents('Synth', [TMidiFile2]);
end;
end.
| 29.541711 | 138 | 0.632363 |
fc5657477eff874fa67bb6dfab9a71b2b7cf1d38 | 814 | dfm | Pascal | Marquee_ProgressBar/Unit1.dfm | delphi-pascal-archive/marquee-progressbar | ab527c2fb7e079c16ae8a90932f45ce2619141c5 | [
"Unlicense"
]
| null | null | null | Marquee_ProgressBar/Unit1.dfm | delphi-pascal-archive/marquee-progressbar | ab527c2fb7e079c16ae8a90932f45ce2619141c5 | [
"Unlicense"
]
| null | null | null | Marquee_ProgressBar/Unit1.dfm | delphi-pascal-archive/marquee-progressbar | ab527c2fb7e079c16ae8a90932f45ce2619141c5 | [
"Unlicense"
]
| null | null | null | object Form1: TForm1
Left = 220
Top = 128
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'Marquee ProgressBar'
ClientHeight = 50
ClientWidth = 339
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -14
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 120
TextHeight = 16
object MarqueeProgressBar1: TMarqueeProgressBar
Left = 16
Top = 16
Width = 305
Height = 20
TabOrder = 0
Active = False
AnimationSpeed = 60
end
object XPManifest1: TXPManifest
Left = 224
Top = 8
end
object Timer1: TTimer
Interval = 50
OnTimer = Timer1Timer
Left = 96
Top = 8
end
end
| 20.871795 | 50 | 0.637592 |
fcc299f5a968203574b8895b8ff1195a43ce60ae | 6,932 | pas | Pascal | main.pas | Raf20076/Lazspell-2-version-2 | ec0c5f0a21786f8e497278c4086328f60ec88c38 | [
"CC0-1.0"
]
| null | null | null | main.pas | Raf20076/Lazspell-2-version-2 | ec0c5f0a21786f8e497278c4086328f60ec88c38 | [
"CC0-1.0"
]
| 1 | 2021-06-14T14:59:52.000Z | 2021-06-14T14:59:52.000Z | main.pas | Raf20076/Lazspell-2-version-2 | ec0c5f0a21786f8e497278c4086328f60ec88c38 | [
"CC0-1.0"
]
| null | null | null | {Unit Main License is https://creativecommons.org/publicdomain/zero/1.0/deed.en}
unit Main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls,
Menus,LazFileUtils, LCLProc, RichMemo, LazUtils, LazUtf8, Variants;
type
{ TMainForm }
TMainForm = class(TForm)
CheckButton: TButton;
ComboBoxDictionary: TComboBox;
LabelErrors: TLabel;
LabelSuggestions: TLabel;
ListBoxErrors: TListBox;
ListBoxSuggestions: TListBox;
MainMenu: TMainMenu;
mExit: TMenuItem;
mOpen: TMenuItem;
mNew: TMenuItem;
mAbout: TMenuItem;
mHelp: TMenuItem;
mTools: TMenuItem;
mFile: TMenuItem;
Memo: TRichMemo;
StatusBar: TStatusBar;
procedure CheckButtonClick(Sender: TObject);
procedure ComboBoxDictionaryChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure ListBoxErrorsClick(Sender: TObject);
procedure ListBoxSuggestionsClick(Sender: TObject);
procedure mAboutClick(Sender: TObject);
procedure SetDefaultDicPath();
function CheckForDict(): boolean;
function FindDictionary(const Dict : TStrings; const DPath : AnsiString) : boolean;
private
public
end;
var
MainForm: TMainForm;
implementation
uses Hunspell,Functions;//Hunspell.pas Functions.pas
var
SpellCheck: THunspell;
DictPath : AnsiString;
{$R *.lfm}
{ TMainForm }
//OnCreate
procedure TMainForm.FormCreate(Sender: TObject);
begin
SetDefaultDicPath();
SpellCheck := THunspell.Create(True);
if SpellCheck.ErrorMessage = '' then begin
StatusBar.SimpleText := 'Library Loaded =' + SpellCheck.LibraryFullName;
CheckButton.enabled := CheckForDict();
CheckForDict();
end else
StatusBar.SimpleText := (SpellCheck.ErrorMessage);
end;
//onDestroy
procedure TMainForm.FormDestroy(Sender: TObject);
begin
SpellCheck.free;
SpellCheck := nil;
end;
//OnClick CheckButton
procedure TMainForm.CheckButtonClick(Sender: TObject);
var
i : Integer;
MAX : Integer;
ArrayWordsList:TStringArray;
MemoString: String;
NoCharacters: String;
begin
ListBoxErrors.clear;
ListBoxErrors.Items.Clear;
MemoString := ReplaceCarriageReturn(Memo.Lines.Text); // replace carriage return with one space
NoCharacters := StripOffNonCharacter(MemoString);// remove all non characters
ArrayWordsList := NoCharacters.split(' '); // split string into words with ' ' one space
MAX := ArrayValueCount(ArrayWordsList); // give how many elements are in array
for i := 0 to MAX - 1 do
if not SpellCheck.Spell(ArrayWordsList[i]) then ListBoxErrors.Items.add(ArrayWordsList[i]);
Memo.SelectAll;
Memo.SetRangeParams(Memo.SelStart,Memo.SelLength,[tmm_Styles,tmm_Color],'',0,clBlack,[],[fsBold,fsUnderLine]);
end;
//onChange ComboBoxDictionary
procedure TMainForm.ComboBoxDictionaryChange(Sender: TObject);
begin
if ComboBoxDictionary.ItemIndex > -1 then
CheckButton.enabled := SpellCheck.SetDictionary( AppendPathDelim(DictPath) + ComboBoxDictionary.Items.Strings[ComboBoxDictionary.ItemIndex]);
if SpellCheck.ErrorMessage = '' then begin
StatusBar.SimpleText := 'Good To Go =' + booltostr(SpellCheck.GoodToGo, True);
StatusBar.SimpleText := 'Dictionary set to ' + AppendPathDelim(DictPath) + ComboBoxDictionary.Items.Strings[ComboBoxDictionary.ItemIndex];
end else
StatusBar.SimpleText := 'ERROR ' + SpellCheck.ErrorMessage;
end;
//onClick ListBoxErrors
procedure TMainForm.ListBoxErrorsClick(Sender: TObject);
var
Selected : AnsiString;
i: integer;
begin
if ListBoxErrors.ItemIndex >= 0 then begin
Selected := ListBoxErrors.Items.Strings[ListBoxErrors.ItemIndex];
FindInMemo(Memo,Selected,0+1); //Show an error in MemoText
SpellCheck.Suggest(Selected,ListBoxSuggestions.Items);
if ListBoxErrors.SelCount > 0 then begin
For i := ListBoxErrors.Items.Count - 1 downto 0 do
if ListBoxErrors.Selected [i] then
ListBoxErrors.Items.Delete (i);
end;
end;
end;
//onClick ListBoxSuggestions
procedure TMainForm.ListBoxSuggestionsClick(Sender: TObject);
var
Selected : AnsiString;
begin
if ListBoxSuggestions.ItemIndex >= 0 then begin
Selected := ListBoxSuggestions.Items.Strings[ListBoxSuggestions.ItemIndex];
Memo.SelText:= Selected;
Memo.SetRangeParams(Memo.SelStart,Memo.SelLength,[tmm_Styles,tmm_Color],'',0,clBlack,[],[fsBold,fsUnderLine]);
ListBoxSuggestions.Clear;
end;
end;
//onClick About
procedure TMainForm.mAboutClick(Sender: TObject);
begin
ShowMessage('Lazspell (by Raf20076, Poland 2020) - an example of speller. Lazspell uses hunspell.pas and hunspell.inc from https://github.com/davidbannon/hunspell4pas . Lazspell is under license: Unit Main License is https://creativecommons.org/publicdomain/zero/1.0/deed.en . Unit Functions License is https://creativecommons.org/publicdomain/zero/1.0/deed.en . Dictionaries coded in UTF-8 from https://github.com/wooorm/dictionaries/blob/master/license');
end;
//Begin Dictionary
function TMainForm.FindDictionary(const Dict : TStrings; const DPath : AnsiString) : boolean;
var
Info : TSearchRec;
begin
Dict.Clear;
if FindFirst(AppendPathDelim(DPath) + '*.dic', faAnyFile and faDirectory, Info)=0 then begin
repeat
Dict.Add(Info.Name);
until FindNext(Info) <> 0;
end;
FindClose(Info);
Result := Dict.Count >= 1;
end;
function TMainForm.CheckForDict(): boolean;
begin
Result := False;
DictPath := DictPath;
if not FindDictionary(ComboBoxDictionary.Items,DictPath) then
StatusBar.SimpleText := 'ERROR - no dictionaries found in ' + DictPath;
if ComboBoxDictionary.Items.Count = 1 then begin // Exactly one returned.
if not SpellCheck.SetDictionary(AppendPathDelim(DictPath) + ComboBoxDictionary.Items.Strings[0]) then
StatusBar.SimpleText := 'ERROR ' + SpellCheck.ErrorMessage
else
StatusBar.SimpleText := 'Dictionary set to ' + DictPath + ComboBoxDictionary.Items.Strings[0];
end;
Result := SpellCheck.GoodToGo; // only true if count was exactly one or FindDict failed and nothing changed
end;
procedure TMainForm.SetDefaultDicPath();
begin
{$ifdef LINUX}
DictPath := '/usr/share/hunspell/';
{$ENDIF}
{$ifdef WINDOWS}
DictPath := ExtractFilePath(Application.ExeName) + 'dict\'; // dictionaries in dict folder
{$ENDIF}
{$ifdef DARWIN}
//DictPath := '/Applications/Firefox.app/Contents/Resources/dictionaries/';
DictPathAlt := ExtractFilePath(Application.ExeName);
{$endif}
end;
//End Dictionary
end.
| 33.167464 | 462 | 0.701673 |
fc5b094e8d45a7ab35e7964fd3ba26f186b96fd4 | 5,029 | dfm | Pascal | theme/AMegaDemo/UnitTsOthers5.dfm | AbdelliNasredine/gestion_budjet | ada33c945092d0036ef75a13f34b15cb2ad367e4 | [
"MIT"
]
| null | null | null | theme/AMegaDemo/UnitTsOthers5.dfm | AbdelliNasredine/gestion_budjet | ada33c945092d0036ef75a13f34b15cb2ad367e4 | [
"MIT"
]
| null | null | null | theme/AMegaDemo/UnitTsOthers5.dfm | AbdelliNasredine/gestion_budjet | ada33c945092d0036ef75a13f34b15cb2ad367e4 | [
"MIT"
]
| null | null | null | inherited FrameTsOthers5: TFrameTsOthers5
Width = 956
Height = 605
Align = alClient
object sGroupBox1: TsGroupBox [0]
Left = 50
Top = 50
Width = 735
Height = 163
Caption = 'TsPathDialog dialogs'
TabOrder = 0
BoxStyle = bsCard
object sBitBtn1: TsBitBtn
Left = 391
Top = 48
Width = 103
Height = 29
Caption = 'Call dialog'
TabOrder = 1
OnClick = sBitBtn1Click
end
object sGroupBox3: TsGroupBox
Left = 520
Top = 24
Width = 185
Height = 121
Caption = '`DialogOptions`:'
TabOrder = 4
object sCheckBox1: TsCheckBox
Left = 24
Top = 32
Width = 140
Height = 18
Caption = '`sdAllowCreate`'
AutoSize = False
Checked = True
State = cbChecked
TabOrder = 0
OnClick = sCheckBox1Click
end
object sCheckBox2: TsCheckBox
Left = 24
Top = 60
Width = 140
Height = 18
Caption = '`sdPerformCreate`'
AutoSize = False
Checked = True
State = cbChecked
TabOrder = 1
OnClick = sCheckBox2Click
end
object sCheckBox3: TsCheckBox
Left = 24
Top = 88
Width = 140
Height = 18
Caption = '`sdPrompt`'
AutoSize = False
Checked = True
State = cbChecked
TabOrder = 2
OnClick = sCheckBox3Click
end
end
object sEdit1: TsEdit
Left = 80
Top = 48
Width = 305
Height = 29
AutoSize = False
TabOrder = 0
Text = 'c:\'
AddedGlyph.Images = FormData.CharList16
AddedGlyph.ImageIndex = 19
BoundLabel.Active = True
BoundLabel.Caption = '`Path`:'
Padding.Left = 4
VerticalAlignment = taVerticalCenter
end
object sComboBox1: TsComboBox
Left = 80
Top = 92
Width = 174
Height = 21
BoundLabel.Active = True
BoundLabel.Caption = '`Root`:'
VerticalAlignment = taVerticalCenter
Style = csDropDownList
ItemIndex = 0
TabOrder = 2
Text = 'rfDesktop'
OnChange = sComboBox1Change
Items.Strings = (
'rfDesktop'
'rfMyComputer'
'rfNetwork'
'rfRecycleBin'
'rfAppData'
'rfCommonDesktopDirectory'
'rfCommonPrograms'
'rfCommonStartMenu'
'rfCommonStartup'
'rfControlPanel'
'rfDesktopDirectory'
'rfFavorites'
'rfFonts'
'rfInternet'
'rfPersonal'
'rfPrinters'
'rfPrintHood'
'rfPrograms'
'rfRecent'
'rfSendTo'
'rfStartMenu'
'rfStartup'
'rfTemplates')
end
object sCheckBox4: TsCheckBox
Left = 274
Top = 95
Width = 108
Height = 17
Caption = '`ShowRootBtns`'
Checked = True
State = cbChecked
TabOrder = 3
OnClick = sCheckBox4Click
end
end
object sGroupBox2: TsGroupBox [1]
Left = 50
Top = 240
Width = 735
Height = 173
Caption = 'File dialogs'
TabOrder = 1
BoxStyle = bsCard
object sBitBtn2: TsBitBtn
Left = 26
Top = 35
Width = 165
Height = 29
Caption = 'TsOpenDialog'
TabOrder = 0
OnClick = sBitBtn2Click
end
object sBitBtn3: TsBitBtn
Left = 199
Top = 35
Width = 165
Height = 29
Caption = 'TsSaveDialog'
TabOrder = 1
OnClick = sBitBtn3Click
end
object sBitBtn4: TsBitBtn
Left = 545
Top = 35
Width = 165
Height = 29
Caption = 'TsSavePictureDialog'
TabOrder = 3
OnClick = sBitBtn4Click
end
object sBitBtn5: TsBitBtn
Left = 372
Top = 35
Width = 165
Height = 29
Caption = 'TsOpenPictureDialog'
TabOrder = 2
OnClick = sBitBtn5Click
end
object sGroupBox4: TsGroupBox
Left = 26
Top = 86
Width = 255
Height = 63
Caption = 'Zip files opening'
TabOrder = 4
object sRadioButton1: TsRadioButton
Left = 32
Top = 28
Width = 86
Height = 17
Caption = '`zsAsFolder`'
Checked = True
TabOrder = 0
TabStop = True
OnClick = sRadioButton1Click
end
object sRadioButton2: TsRadioButton
Tag = 1
Left = 152
Top = 28
Width = 72
Height = 17
Caption = '`zsAsFile`'
TabOrder = 1
OnClick = sRadioButton1Click
end
end
end
object sPathDialog1: TsPathDialog
Root = 'rfDesktop'
ShowRootBtns = True
Left = 292
Top = 64
end
object sOpenDialog1: TsOpenDialog
ZipShowing = zsAsFile
Left = 148
Top = 244
end
object sSaveDialog1: TsSaveDialog
Left = 336
Top = 244
end
object sOpenPictureDialog1: TsOpenPictureDialog
Left = 512
Top = 244
end
object sSavePictureDialog1: TsSavePictureDialog
Left = 692
Top = 244
end
end
| 21.960699 | 49 | 0.554782 |
f1c6da5e60b219b91ee9c02d2006be13f470fcab | 636 | pas | Pascal | Parte4_Utilizando_o_Browser/Unit1.pas | LeandroTeodoroRJ/CursoConcisoDelphiXE7 | a647c3efad1af29239942060f3638d71e18da3fb | [
"MIT"
]
| 2 | 2018-09-15T14:34:00.000Z | 2021-12-24T20:49:05.000Z | Parte4_Utilizando_o_Browser/Unit1.pas | LeandroTeodoroRJ/CursoConcisoDelphiXE7 | a647c3efad1af29239942060f3638d71e18da3fb | [
"MIT"
]
| null | null | null | Parte4_Utilizando_o_Browser/Unit1.pas | LeandroTeodoroRJ/CursoConcisoDelphiXE7 | a647c3efad1af29239942060f3638d71e18da3fb | [
"MIT"
]
| 1 | 2021-12-24T20:48:53.000Z | 2021-12-24T20:48:53.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.WebBrowser,
FMX.StdCtrls, FMX.Edit;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Button1: TButton;
WebBrowser1: TWebBrowser;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.Button1Click(Sender: TObject);
begin
webbrowser1.Navigate(edit1.Text);
end;
end.
| 17.189189 | 81 | 0.713836 |
6af11cec3555560d2c82eb4e4bca538efb2c17cd | 11,051 | pas | Pascal | app/source/usb.pas | pierrelouys/PSPdisp | b22e757d3f8f3e1279261e31e529440c0922b371 | [
"MS-PL",
"BSD-3-Clause"
]
| 2 | 2021-02-20T09:56:24.000Z | 2021-11-16T17:16:32.000Z | app/source/usb.pas | PSP-Archive/PSPdisp | b22e757d3f8f3e1279261e31e529440c0922b371 | [
"MS-PL",
"BSD-3-Clause"
]
| null | null | null | app/source/usb.pas | PSP-Archive/PSPdisp | b22e757d3f8f3e1279261e31e529440c0922b371 | [
"MS-PL",
"BSD-3-Clause"
]
| null | null | null | {
***************************************************
PSPdisp (c) 2008 - 2015 Jochen Schleu
usb.pas - functions dealing with usb transfer
This software is licensed under the BSD license.
See license.txt for details.
***************************************************
}
unit usb;
interface
uses
Windows, SysUtils, Classes, Messages, LibUsb;
procedure UsbInit();
procedure UsbTerm();
function UsbCheckForConnection(DoOpen: Boolean): Boolean;
function UsbCheckForLibusbDevice(DoOpen: Boolean): Boolean;
function UsbCheckForWinUsbDevice(DoOpen: Boolean): Boolean;
procedure UsbCloseConnection();
function UsbInitializeAsync(): Boolean;
function UsbSendBuffer(DataBuffer: Pointer; DataSize: Cardinal): Boolean;
function UsbReceiveData(Buffer: Pointer; BufferSize: LongWord): Boolean;
procedure UsbOnDeviceChange(var Msg: TMessage);
procedure UsbForceDetection();
function WUsb_GetDevicePath(guidString: PChar; devicePath: PChar): Integer; cdecl; external 'wusb.dll' name 'WUsb_GetDevicePath';
function WUsb_Initialize(DeviceHandle: THandle; var InterfaceHandle: THandle): Boolean; cdecl; external 'wusb.dll' name 'WUsb_Initialize';
function WUsb_Free(InterfaceHandle: THandle): Boolean; cdecl; external 'wusb.dll' name 'WUsb_Free';
function WUsb_SetPipePolicy(InterfaceHandle: THandle; PipeID: Byte; PolicyType: Cardinal; ValueLength: Cardinal; Value: Pointer): Boolean; cdecl; external 'wusb.dll' name 'WUsb_SetPipePolicy';
function WUsb_ReadPipe(InterfaceHandle: THandle; PipeID: Byte; Buffer: Pointer; BufferLength: Cardinal; var LengthTransferred: Cardinal; Overlapped: Pointer): Boolean; cdecl; external 'wusb.dll' name 'WUsb_ReadPipe';
function WUsb_WritePipe(InterfaceHandle: THandle; PipeID: Byte; Buffer: Pointer; BufferLength: Cardinal; var LengthTransferred: Cardinal; Overlapped: Pointer): Boolean; cdecl; external 'wusb.dll' name 'WUsb_WritePipe';
implementation
const
// Sony vendor and product ID
VendorId = $54C;
ProductId_Type_B = $1C9;
ProductId_Type_C = $1CA;
FrameHeaderSize = 16;
FrameHeaderMinusMagicSize = 12;
var
ScrapBuffer: Array[0..4096] of Char;
LibusbDeviceHandle: pusb_dev_handle;
WinUsbInterfaceHandle: Cardinal;
WinUsbDeviceHandle: THandle;
DeviceEventOccured: Boolean;
{
UsbInit
---------------------------------------------------
Start the USB functions.
---------------------------------------------------
}
procedure UsbInit();
begin
usb_init();
UsbForceDetection();
end;
{
UsbTerm
---------------------------------------------------
Shut down the USB functions.
---------------------------------------------------
}
procedure UsbTerm();
begin
end;
{
UsbForceDetection
---------------------------------------------------
Search for the USB devices even if no device
was recently plugged in.
---------------------------------------------------
}
procedure UsbForceDetection();
begin
DeviceEventOccured := True;
end;
{
UsbOnDeviceChange
---------------------------------------------------
Receives Windows device change messages.
---------------------------------------------------
}
procedure UsbOnDeviceChange(var Msg: TMessage);
const
DBT_DEVNODES_CHANGED: Integer = 7;
begin
if (Msg.WParam = DBT_DEVNODES_CHANGED) then
DeviceEventOccured := True;
end;
{
UsbCheckForConnection
---------------------------------------------------
Look for the PSP device.
---------------------------------------------------
Returns True if the PSP was found.
}
function UsbCheckForConnection(DoOpen: Boolean): Boolean;
begin
Result := (DeviceEventOccured and (UsbCheckForLibusbDevice(DoOpen) or UsbCheckForWinUsbDevice(DoOpen)));
DeviceEventOccured := False;
// Sleep(1000);
end;
{
usbCheckForLibusbDevice
---------------------------------------------------
Look for the PSP libusb device in the device tree.
---------------------------------------------------
Returns True if the PSP was found.
}
function UsbCheckForLibusbDevice(DoOpen: Boolean): Boolean;
var
Device: pusb_device;
Bus: pusb_bus;
begin
usb_find_busses();
usb_find_devices();
Bus := usb_get_busses();
while Assigned(Bus) do
begin
Device := Bus^.devices;
while Assigned(Device) do
begin
if ((Device^.descriptor.idVendor = VendorId) and
(Device^.descriptor.idProduct = ProductId_Type_B)) then
begin
// Device found
if (DoOpen) then
begin
LibusbDeviceHandle := usb_open(Device);
usb_set_configuration(LibusbDeviceHandle, 1);
usb_claim_interface(LibusbDeviceHandle, 0);
usb_set_altinterface(LibusbDeviceHandle, 0);
UsbInitializeAsync();
end;
Result := True;
Exit;
end;
Device := Device^.next;
end;
Bus := Bus^.next;
end;
LibUsbDeviceHandle := nil;
Result := False;
end;
{
usbCheckForWinusbDevice
---------------------------------------------------
Look for the PSP WinUSB device in the device tree.
---------------------------------------------------
Returns True if the PSP was found.
}
function usbCheckForWinusbDevice(DoOpen: Boolean): Boolean;
var
PathBuffer: Array[0..255] of AnsiChar;
GuidBuffer: Array[0..255] of Ansichar;
Timeout: Integer;
begin
GuidBuffer := '{9ef8fcc2-f024-4fbd-ad39-50fcdbb81a95}';
PathBuffer := '';
if (WUsb_GetDevicePath(@GuidBuffer, @PathBuffer) > 0) then
begin
if (DoOpen) then
begin
WinUsbDeviceHandle := CreateFile(PathBuffer, GENERIC_WRITE or GENERIC_READ, FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL or FILE_FLAG_OVERLAPPED, 0);
WUsb_Initialize(WinUsbDeviceHandle, WinUsbInterfaceHandle);
UsbInitializeAsync();
Timeout := 1000;
WUsb_SetPipePolicy(WinUsbInterfaceHandle, $02, 3, 4, @Timeout);
WUsb_SetPipePolicy(WinUsbInterfaceHandle, $81, 3, 4, @Timeout);
end;
Result := True;
Exit;
end;
WinUsbInterfaceHandle := 0;
WinUsbDeviceHandle := 0;
Result := False;
end;
{
UsbCloseConnection
---------------------------------------------------
Shutdown the usb mode.
---------------------------------------------------
}
procedure UsbCloseConnection();
begin
if (WinUsbInterfaceHandle <> 0) then
begin
WUsb_Free(WinUsbInterfaceHandle);
WinUsbInterfaceHandle := 0;
CloseHandle(WinUsbDeviceHandle);
end;
if (Assigned(LibusbDeviceHandle)) then
begin
usb_release_interface(LibusbDeviceHandle, 0);
usb_close(LibusbDeviceHandle);
LibusbDeviceHandle := nil;
end;
end;
{
UsbInitializeAsync
---------------------------------------------------
Do initialization procedure for usbhostfs.
Not sure what kind of data is transmitted,
this was found out by spying on the usb
transfer of PSPLINK.
---------------------------------------------------
Returns True if successfull.
}
function UsbInitializeAsync(): Boolean;
var
LengthTransferred: Cardinal;
Timeout: Cardinal;
begin
ScrapBuffer := #$12#$08#$2F#$78; // HOSTFS_MAGIC
Result := False;
if (WinUsbInterfaceHandle <> 0) then
begin
Timeout := 500;
WUsb_SetPipePolicy(WinUsbInterfaceHandle, $02, 3, 4, @Timeout);
WUsb_SetPipePolicy(WinUsbInterfaceHandle, $81, 3, 4, @Timeout);
WUsb_WritePipe(WinUsbInterfaceHandle, $02, @ScrapBuffer, 4, LengthTransferred, nil);
if (LengthTransferred <> 4) then
Exit;
// Without the wait, the next write may "succeed" even though it
// really doesn't
Sleep(500);
WUsb_WritePipe(WinUsbInterfaceHandle, $02, @ScrapBuffer, FrameHeaderMinusMagicSize, LengthTransferred, nil);
if (LengthTransferred = FrameHeaderMinusMagicSize) then
Exit;
WUsb_ReadPipe(WinUsbInterfaceHandle, $81, @ScrapBuffer, 12, LengthTransferred, nil);
if (LengthTransferred <> 12) then
Exit;
WUsb_WritePipe(WinUsbInterfaceHandle, $02, @ScrapBuffer, 12, LengthTransferred, nil);
if (LengthTransferred <> 12) then
Exit;
end
else if (Assigned(LibusbDeviceHandle)) then
begin
// Send magic
LengthTransferred := usb_bulk_write(LibusbDeviceHandle, $02, ScrapBuffer, 4, 500);
if (LengthTransferred <> 4) then
Exit;
// Try to send another 12 bytes to complete the frameHeader
// If the PSP is already initialized, this will succeed. Then there
// is no need to complete the rest of the initialization. The function
// readFrameInformation() on the PSP will discard this data because of
// a wrong magic.
LengthTransferred := usb_bulk_write(LibusbDeviceHandle, $02, ScrapBuffer, FrameHeaderMinusMagicSize, 500);
if (LengthTransferred = FrameHeaderMinusMagicSize) then
Exit;
// Receive hello response
LengthTransferred := usb_bulk_read(LibusbDeviceHandle, $81, ScrapBuffer, 12, 500);
if (LengthTransferred <> 12) then
Exit;
LengthTransferred := usb_bulk_write(LibusbDeviceHandle, $02, ScrapBuffer, 12, 500);
if (LengthTransferred <> 12) then
Exit;
end;
Result := True;
end;
{
UsbSendBuffer
---------------------------------------------------
Send a buffer over usb.
---------------------------------------------------
Returns TRUE on success.
}
function UsbSendBuffer(DataBuffer: Pointer; DataSize: Cardinal): Boolean;
var
Length: Cardinal;
SendLength: Cardinal;
Position: Cardinal;
DataPointer: PByte;
Success: Boolean;
begin
Success := False;
Position := 0;
DataPointer := DataBuffer;
while (Position < DataSize) do
begin
Length := DataSize - Position;
if (WinUsbInterfaceHandle <> 0) then
begin
Success := WUsb_WritePipe(WinUsbInterfaceHandle, $02, DataPointer, Length, SendLength, nil);
end
else if Assigned(LibusbDeviceHandle) then
begin
SendLength := usb_bulk_write(LibusbDeviceHandle, $02, DataPointer^, Length, 10000);
if (Integer(SendLength) < 0) then
begin
SendLength := 0;
Success := False;
end
else
Success := True;
end;
if not Success then
begin
Result := False;
Exit;
end;
Inc(DataPointer, SendLength);
Position := Position + SendLength;
end;
Result := True;
end;
{
UsbReceiveData
---------------------------------------------------
Read data from the usb port and store it into
the buffer. The function only returns after
bufferSize Bytes are read or the usb function
times out.
---------------------------------------------------
Returns the number of bytes read.
}
function UsbReceiveData(Buffer: Pointer; BufferSize: LongWord): Boolean;
var
LengthTransferred: Cardinal;
begin
if (WinUsbInterfaceHandle <> 0) then
begin
WUsb_ReadPipe(WinUsbInterfaceHandle, $81, Buffer, BufferSize, LengthTransferred, nil);
Result := (LengthTransferred = BufferSize);
Exit;
end;
if (Assigned(LibusbDeviceHandle)) then
begin
Result := (usb_bulk_read(LibusbDeviceHandle, $81, Buffer^, BufferSize, 300) = BufferSize);
Exit;
end;
Result := False;
end;
end. | 25.230594 | 218 | 0.633427 |
fcb8034eaadd0c94ccc2768917658922832f648f | 2,492 | pas | Pascal | src/validators/Validator.IsSSN.pas | dliocode/datavalidator | ff0ef7a51e6f33c162a13582ab96a313e80bbf44 | [
"MIT"
]
| 21 | 2021-06-25T20:08:59.000Z | 2022-03-03T23:43:49.000Z | src/validators/Validator.IsSSN.pas | dliocode/datavalidator | ff0ef7a51e6f33c162a13582ab96a313e80bbf44 | [
"MIT"
]
| null | null | null | src/validators/Validator.IsSSN.pas | dliocode/datavalidator | ff0ef7a51e6f33c162a13582ab96a313e80bbf44 | [
"MIT"
]
| 6 | 2021-06-26T01:36:30.000Z | 2021-07-29T03:51:06.000Z | {
********************************************************************************
Github - https://github.com/dliocode/datavalidator
********************************************************************************
MIT License
Copyright (c) 2021 Danilo Lucas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
********************************************************************************
}
unit Validator.IsSSN; // (EUA) Social Security Number
interface
uses
DataValidator.ItemBase,
System.SysUtils, System.RegularExpressions;
type
TValidatorIsSSN = class(TDataValidatorItemBase, IDataValidatorItem)
private
public
function Check: IDataValidatorResult;
constructor Create(const AMessage: string; const AExecute: TDataValidatorInformationExecute = nil);
end;
implementation
{ TValidatorIsSSN }
constructor TValidatorIsSSN.Create(const AMessage: string; const AExecute: TDataValidatorInformationExecute = nil);
begin
SetMessage(AMessage);
SetExecute(AExecute);
end;
function TValidatorIsSSN.Check: IDataValidatorResult;
var
LValue: string;
R: Boolean;
begin
LValue := GetValueAsString;
R := False;
if not Trim(LValue).IsEmpty then
R := TRegEx.IsMatch(LValue, '^(((?!666|000|9\d{2})\d{3}-(?!00)\d{2}-(?!0{4})\d{4})||((?!666|000|9\d{2})\d{3}(?!00)\d{2}(?!0{4})\d{4}))$');
if FIsNot then
R := not R;
Result := TDataValidatorResult.Create(R, TDataValidatorInformation.Create(LValue, GetMessage, FExecute));
end;
end.
| 32.363636 | 142 | 0.675361 |
4788a98b5fd93e881928a54944687a9022216449 | 6,815 | pas | Pascal | src/esicontacts.pas | seryal/laz-eve-esi | 6f03cc3467f62658c5f2ff4aa13c5f0c5ed112a1 | [
"MIT"
]
| 1 | 2022-01-16T20:12:00.000Z | 2022-01-16T20:12:00.000Z | src/esicontacts.pas | seryal/laz-eve-esi | 6f03cc3467f62658c5f2ff4aa13c5f0c5ed112a1 | [
"MIT"
]
| null | null | null | src/esicontacts.pas | seryal/laz-eve-esi | 6f03cc3467f62658c5f2ff4aa13c5f0c5ed112a1 | [
"MIT"
]
| null | null | null | {==============================================================================|
| Project : EVE Online ESI Library |
|==============================================================================|
| Copyright (c)2021, Yuri Serebrennikov |
| All rights reserved. |
|==============================================================================|
| The Initial Developer of the Original Code is Yuri Serebrennikov |
| All Rights Reserved. |
|==============================================================================|
| (Found at URL: https://github.com/seryal/laz-eve-esi/) |
|==============================================================================}
unit esicontacts;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, esibase, Generics.Collections, typinfo, fpjson;
type
TEVEContactLabelID = specialize TList<longint>;
{ TEVEContactAlliance }
TEVEContactAlliance = class(TCollectionItem)
private
Fcontact_id: integer;
Fcontact_type: string;
Flabel_ids: TEVEContactLabelID;
Fstanding: double;
public
constructor Create(ACollection: TCollection); override;
destructor Destroy; override;
published
property contact_id: integer read Fcontact_id write Fcontact_id;
property contact_type: string read Fcontact_type write Fcontact_type;
property label_ids: TEVEContactLabelID read Flabel_ids write Flabel_ids;
property standing: double read Fstanding write Fstanding;
end;
{ TEVEContactAllianceList }
TEVEContactAllianceList = class(TCollection)
private
function GetItems(Index: integer): TEVEContactAlliance;
public
property Items[Index: integer]: TEVEContactAlliance read GetItems;
end;
{ TEVEContactCharacter }
TEVEContactCharacter = class(TEVEContactAlliance)
private
Fis_blocked: boolean;
Fis_watched: boolean;
published
property contact_id: integer read Fcontact_id write Fcontact_id;
property contact_type: string read Fcontact_type write Fcontact_type;
property is_blocked: boolean read Fis_blocked write Fis_blocked;
property is_watched: boolean read Fis_watched write Fis_watched;
property label_ids: TEVEContactLabelID read Flabel_ids write Flabel_ids;
property standing: double read Fstanding write Fstanding;
end;
{ TEVEContactCharacterList }
TEVEContactCharacterList = class(TCollection)
private
function GetItems(Index: integer): TEVEContactCharacter;
public
property Items[Index: integer]: TEVEContactCharacter read GetItems;
end;
TEVEContactCorporation = class(TEVEContactCharacter);
{ TEVEContactCorporationList }
TEVEContactCorporationList = class(TCollection)
private
function GetItems(Index: integer): TEVEContactCorporation;
public
property Items[Index: integer]: TEVEContactCorporation read GetItems;
end;
{ TESIContacts }
TESIContacts = class(TESIBase)
private
Fproperty_name: string;
protected
procedure RestorePropertyNotify(Sender: TObject; AObject: TObject; Info: PPropInfo; AValue: TJSONData; var Handled: boolean); override;
public
function GetAllianceContacts(AAccessToken: string; AAllianceID, APage: integer): TEVEContactAllianceList;
//function GetAllianceContactLabels(AAccessToken: string; AAllianceID: integer): string;
//function DeleteCharacterContact(AAccessToken: string; AChatacterID: integer): string;
function GetCharacterContacts(AAccessToken: string; ACharacterID, APage: integer): TEVEContactCharacterList;
//function AddCharacterContact(AAccessToken: string; ACharacterID: integer): string;
//function GetCharacterContactLabels(AAccessToken: string; ACharacterID: integer): string;
function GetCorporationContacts(AAccessToken: string; ACorporationID, APage: integer): TEVEContactCorporationList;
//function GetCorporationContactLabels(AAccessToken: string; ACorporationID: integer): string;
end;
implementation
{ TEVEContactCorporationList }
function TEVEContactCorporationList.GetItems(Index: integer): TEVEContactCorporation;
begin
Result := TEVEContactCorporation(inherited Items[Index]);
end;
{ TEVEContactAlliance }
constructor TEVEContactAlliance.Create(ACollection: TCollection);
begin
inherited Create(ACollection);
Flabel_ids := TEVEContactLabelID.Create;
end;
destructor TEVEContactAlliance.Destroy;
begin
FreeAndNil(Flabel_ids);
inherited Destroy;
end;
{ TEVEContactCharacterList }
function TEVEContactCharacterList.GetItems(Index: integer): TEVEContactCharacter;
begin
Result := TEVEContactCharacter(inherited Items[Index]);
end;
{ TESIContacts }
procedure TESIContacts.RestorePropertyNotify(Sender: TObject; AObject: TObject; Info: PPropInfo; AValue: TJSONData; var Handled: boolean);
var
i: integer;
begin
if Info^.Name = Fproperty_name then
for i := 0 to TJSONArray(AValue).Count - 1 do
TEVEContactCharacter(AObject).label_ids.Add(TJSONArray(AValue).Items[i].AsInteger)
else
inherited RestorePropertyNotify(Sender, AObject, Info, AValue, Handled);
end;
function TESIContacts.GetAllianceContacts(AAccessToken: string; AAllianceID, APage: integer): TEVEContactAllianceList;
const
URL = 'https://esi.evetech.net/latest/alliances/%s/contacts/?datasource=%s&page=%d';
begin
Fproperty_name := 'label_ids';
Result := TEVEContactAllianceList.Create(TEVEContactAlliance);
DeStreamerArray(Get(AAccessToken, Format(URL, [AAllianceID.ToString, DataSource, APage])), TCollection(Result));
Fproperty_name := '';
end;
function TESIContacts.GetCharacterContacts(AAccessToken: string; ACharacterID, APage: integer): TEVEContactCharacterList;
const
URL = 'https://esi.evetech.net/latest/characters/%s/contacts/?datasource=%s&page=%d';
begin
Fproperty_name := 'label_ids';
Result := TEVEContactCharacterList.Create(TEVEContactCharacter);
DeStreamerArray(Get(AAccessToken, Format(URL, [ACharacterId.ToString, DataSource, APage])), TCollection(Result));
Fproperty_name := '';
end;
function TESIContacts.GetCorporationContacts(AAccessToken: string; ACorporationID, APage: integer): TEVEContactCorporationList;
const
URL = 'https://esi.evetech.net/latest/corporations/%s/contacts/?datasource=%s&page=%d';
begin
Fproperty_name := 'label_ids';
Result := TEVEContactCorporationList.Create(TEVEContactCorporation);
DeStreamerArray(Get(AAccessToken, Format(URL, [ACorporationID.ToString, DataSource, APage])), TCollection(Result));
Fproperty_name := '';
end;
{ TEVEContactAllianceList }
function TEVEContactAllianceList.GetItems(Index: integer): TEVEContactAlliance;
begin
Result := TEVEContactAlliance(inherited Items[Index]);
end;
end.
| 36.837838 | 139 | 0.709758 |
fcbc59868b3340d15e1a168c4069ad357c36973c | 20,667 | dfm | Pascal | source/uPrintLote.dfm | roneysousa/infomoda | 792066e243e406479ef7ab4eb017f1e336ada475 | [
"MIT"
]
| null | null | null | source/uPrintLote.dfm | roneysousa/infomoda | 792066e243e406479ef7ab4eb017f1e336ada475 | [
"MIT"
]
| null | null | null | source/uPrintLote.dfm | roneysousa/infomoda | 792066e243e406479ef7ab4eb017f1e336ada475 | [
"MIT"
]
| null | null | null | object frmPrintLote: TfrmPrintLote
Left = 192
Top = 114
Width = 544
Height = 375
Caption = 'Impress'#227'o de Lote'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
FormStyle = fsMDIChild
OldCreateOrder = False
Position = poScreenCenter
ShowHint = True
Visible = True
WindowState = wsMaximized
OnClose = FormClose
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Panel2: TPanel
Left = 0
Top = 0
Width = 536
Height = 26
Align = alTop
Alignment = taLeftJustify
Color = clBlue
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -19
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 0
end
object Panel1: TPanel
Left = 0
Top = 26
Width = 536
Height = 47
Align = alTop
TabOrder = 1
object lbl_NRLOTE: TLabel
Left = 8
Top = 14
Width = 30
Height = 13
Caption = '&Lote:'
FocusControl = edtNRLOTE
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
Transparent = True
end
object edtNRLOTE: TEdit
Left = 40
Top = 10
Width = 121
Height = 21
MaxLength = 7
TabOrder = 0
OnChange = edtNRLOTEChange
OnKeyPress = edtNRLOTEKeyPress
end
end
object pnlGrid: TPanel
Left = 0
Top = 73
Width = 536
Height = 186
Align = alClient
TabOrder = 2
object GridPedidos: TDBGrid
Left = 1
Top = 1
Width = 534
Height = 184
Align = alClient
DataSource = dsProdutosLote
Options = [dgTitles, dgIndicator, dgColLines, dgRowLines, dgTabs, dgRowSelect, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit]
ReadOnly = True
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
Columns = <
item
Alignment = taRightJustify
Expanded = False
FieldName = 'LOT_CDPROD'
Title.Caption = 'C'#211'DIGO'
Title.Font.Charset = DEFAULT_CHARSET
Title.Font.Color = clWindowText
Title.Font.Height = -11
Title.Font.Name = 'MS Sans Serif'
Title.Font.Style = [fsBold]
Width = 102
Visible = True
end
item
Expanded = False
FieldName = 'LOT_NMPRO2'
Title.Caption = 'PRODUTO'
Title.Font.Charset = DEFAULT_CHARSET
Title.Font.Color = clWindowText
Title.Font.Height = -11
Title.Font.Name = 'MS Sans Serif'
Title.Font.Style = [fsBold]
Width = 330
Visible = True
end
item
Alignment = taCenter
Expanded = False
FieldName = 'LOT_QTPROD'
Title.Caption = 'QUANTIDADE'
Title.Font.Charset = DEFAULT_CHARSET
Title.Font.Color = clWindowText
Title.Font.Height = -11
Title.Font.Name = 'MS Sans Serif'
Title.Font.Style = [fsBold]
Width = 123
Visible = True
end>
end
end
object Panel3: TPanel
Left = 0
Top = 259
Width = 536
Height = 41
Align = alBottom
TabOrder = 3
end
object Panel4: TPanel
Left = 0
Top = 300
Width = 536
Height = 41
Align = alBottom
TabOrder = 4
object btVisualizar: TBitBtn
Left = 608
Top = 8
Width = 75
Height = 25
Hint = 'Visualizar produto atual'
Caption = '&Visualizar'
TabOrder = 0
OnClick = btVisualizarClick
Glyph.Data = {
36030000424D3603000000000000360000002800000010000000100000000100
18000000000000030000120B0000120B00000000000000000000FF00FFFF00FF
A46769A46769A46769A46769A46769A46769A46769A46769A46769A46769A467
69A46769A46769FF00FFFF00FFFF00FF485360FEE9C7F4DAB5F3D5AAF2D0A0EF
CB96EFC68BEDC182EBC17FEBC180EBC180F2C782A46769FF00FFFF00FF4380B7
1F6FC2656B86F3DABCF2D5B1F0D0A7EECB9EEDC793EDC28BE9BD81E9BD7FE9BD
7FEFC481A46769FF00FFFF00FFFF00FF32A3FF1672D76B6A80F2DABCF2D5B2EF
D0A9EECB9EEDC796EBC28CE9BD82E9BD7FEFC481A46769FF00FFFF00FFFF00FF
A0675B34A1FF1572D45E6782F3DABBF2D5B1F0D0A6EECB9EEDC795EBC28AEABF
81EFC480A46769FF00FFFF00FFFF00FFA7756BFFFBF033A6FF4078AD8E675EAC
7F7597645EAC7D6FCAA083EDC695EBC28AEFC583A46769FF00FFFF00FFFF00FF
A7756BFFFFFCFAF0E6AD8A88B78F84D8BAA5EED5B6D7B298B58877CBA083EBC7
93F2C98CA46769FF00FFFF00FFFF00FFBC8268FFFFFFFEF7F2AF847FDAC0B4F7
E3CFF6E0C5FFFFF4D7B198AC7D6FEECC9EF3CE97A46769FF00FFFF00FFFF00FF
BC8268FFFFFFFFFEFC976560F6E9E0F7EADAF6E3CFFFFFEBEFD4B797645EF0D0
A6F6D3A0A46769FF00FFFF00FFFF00FFD1926DFFFFFFFFFFFFB08884DECAC4FA
EFE5F8EAD9FFFFD4D9B8A5AC7F74F4D8B1EBCFA4A46769FF00FFFF00FFFF00FF
D1926DFFFFFFFFFFFFD5BFBCBA9793DECAC4F6E9DEDAC0B4B78F84B28C7BDECE
B4B6AA93A46769FF00FFFF00FFFF00FFDA9D75FFFFFFFFFFFFFFFFFFD5BFBCB0
8884976560AF867FCAA79DA56B5FA56B5FA56B5FA46769FF00FFFF00FFFF00FF
DA9D75FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFBFFFEF7DAC1BAA56B5FE19E
55E68F31B56D4DFF00FFFF00FFFF00FFE7AB79FFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFDCC7C5A56B5FF8B55CBF7A5CFF00FFFF00FFFF00FFFF00FF
E7AB79FBF4F0FBF4EFFAF3EFFAF3EFF8F2EFF7F2EFF7F2EFD8C2C0A56B5FC183
6CFF00FFFF00FFFF00FFFF00FFFF00FFE7AB79D1926DD1926DD1926DD1926DD1
926DD1926DD1926DD1926DA56B5FFF00FFFF00FFFF00FFFF00FF}
end
object btFechar: TBitBtn
Left = 696
Top = 8
Width = 75
Height = 25
Hint = 'Fechar a janela atual'
Caption = '&Fechar'
TabOrder = 2
OnClick = btFecharClick
Glyph.Data = {
36030000424D3603000000000000360000002800000010000000100000000100
18000000000000030000120B0000120B00000000000000000000FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FF824B4B4E1E1FFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF824B4B824B4BA64B4BA9
4D4D4E1E1FFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
824B4B824B4BB64F50C24F50C54D4EB24D4E4E1E1F824B4B824B4B824B4B824B
4B824B4B824B4BFF00FFFF00FFFF00FF824B4BD45859CB5556C95455C95253B7
4F524E1E1FFE8B8CFB9A9CF8AAABF7B5B6F7B5B6824B4BFF00FFFF00FFFF00FF
824B4BD75C5DD05A5BCF595ACF5758BD53564E1E1F23B54A13C14816BD480CBC
41F7B5B6824B4BFF00FFFF00FFFF00FF824B4BDD6364D75F60D55E5FD55C5DC2
575A4E1E1F2AB44D1CBF4C1EBC4C13BC45F7B5B6824B4BFF00FFFF00FFFF00FF
824B4BE36869DD6566DA6364DE6667C6595B4E1E1F26B14916BC481BBB4910BB
43F7B5B6824B4BFF00FFFF00FFFF00FF824B4BEB6D6EE26768E67E7FFAD3D4CC
6E704E1E1FA5D89750D16F42C9662DC758F7B5B6824B4BFF00FFFF00FFFF00FF
824B4BF27374E96C6DEB8182FCD1D3CF6E704E1E1FFFF2CCFFFFD7FFFFD4E6FC
C7F7B5B6824B4BFF00FFFF00FFFF00FF824B4BF87879F07576EE7273F07374D1
65664E1E1FFCEFC7FFFFD5FFFFD3FFFFD7F7B5B6824B4BFF00FFFF00FFFF00FF
824B4BFE7F80F77A7BF6797AF77779D76B6B4E1E1FFCEFC7FFFFD5FFFFD3FFFF
D5F7B5B6824B4BFF00FFFF00FFFF00FF824B4BFF8384FC7F80FB7E7FFE7F80DA
6E6F4E1E1FFCEFC7FFFFD5FFFFD3FFFFD5F7B5B6824B4BFF00FFFF00FFFF00FF
824B4BFF8889FF8283FF8182FF8283E073744E1E1FFCEFC7FFFFD5FFFFD3FFFF
D5F7B5B6824B4BFF00FFFF00FFFF00FF824B4B824B4BE27576FE8182FF8687E5
76774E1E1FFAEBC5FCFBD1FCFBCFFCFBD1F7B5B6824B4BFF00FFFF00FFFF00FF
FF00FFFF00FF824B4B9C5657CB6C6DCF6E6E4E1E1F824B4B824B4B824B4B824B
4B824B4B824B4BFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF824B4B82
4B4B4E1E1FFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF}
end
object btImprimir: TBitBtn
Left = 16
Top = 8
Width = 100
Height = 25
Hint = 'Imprimi todos os produtos do lote atual'
Caption = '&Imprimir Todos'
TabOrder = 1
OnClick = btImprimirClick
Glyph.Data = {
36050000424D3605000000000000360400002800000010000000100000000100
0800000000000001000000000000000000000001000000000000000000004000
000080000000FF000000002000004020000080200000FF200000004000004040
000080400000FF400000006000004060000080600000FF600000008000004080
000080800000FF80000000A0000040A0000080A00000FFA0000000C0000040C0
000080C00000FFC0000000FF000040FF000080FF0000FFFF0000000020004000
200080002000FF002000002020004020200080202000FF202000004020004040
200080402000FF402000006020004060200080602000FF602000008020004080
200080802000FF80200000A0200040A0200080A02000FFA0200000C0200040C0
200080C02000FFC0200000FF200040FF200080FF2000FFFF2000000040004000
400080004000FF004000002040004020400080204000FF204000004040004040
400080404000FF404000006040004060400080604000FF604000008040004080
400080804000FF80400000A0400040A0400080A04000FFA0400000C0400040C0
400080C04000FFC0400000FF400040FF400080FF4000FFFF4000000060004000
600080006000FF006000002060004020600080206000FF206000004060004040
600080406000FF406000006060004060600080606000FF606000008060004080
600080806000FF80600000A0600040A0600080A06000FFA0600000C0600040C0
600080C06000FFC0600000FF600040FF600080FF6000FFFF6000000080004000
800080008000FF008000002080004020800080208000FF208000004080004040
800080408000FF408000006080004060800080608000FF608000008080004080
800080808000FF80800000A0800040A0800080A08000FFA0800000C0800040C0
800080C08000FFC0800000FF800040FF800080FF8000FFFF80000000A0004000
A0008000A000FF00A0000020A0004020A0008020A000FF20A0000040A0004040
A0008040A000FF40A0000060A0004060A0008060A000FF60A0000080A0004080
A0008080A000FF80A00000A0A00040A0A00080A0A000FFA0A00000C0A00040C0
A00080C0A000FFC0A00000FFA00040FFA00080FFA000FFFFA0000000C0004000
C0008000C000FF00C0000020C0004020C0008020C000FF20C0000040C0004040
C0008040C000FF40C0000060C0004060C0008060C000FF60C0000080C0004080
C0008080C000FF80C00000A0C00040A0C00080A0C000FFA0C00000C0C00040C0
C00080C0C000FFC0C00000FFC00040FFC00080FFC000FFFFC0000000FF004000
FF008000FF00FF00FF000020FF004020FF008020FF00FF20FF000040FF004040
FF008040FF00FF40FF000060FF004060FF008060FF00FF60FF000080FF004080
FF008080FF00FF80FF0000A0FF0040A0FF0080A0FF00FFA0FF0000C0FF0040C0
FF0080C0FF00FFC0FF0000FFFF0040FFFF0080FFFF00FFFFFF00DBDBDBDBDBDB
DBDBDBDBDBDBDBDBDBDBDBDB0000000000000000000000DBDBDBDB00DBDBDBDB
DBDBDBDBDB00DB00DBDB00000000000000000000000000DB00DB00DBDBDBDBDB
DBFCFCFCDBDB000000DB00DBDBDBDBDBDB929292DBDB00DB00DB000000000000
00000000000000DBDB0000DBDBDBDBDBDBDBDBDBDB00DB00DB00DB0000000000
0000000000DB00DB0000DBDB00FFFFFFFFFFFFFFFF00DB00DB00DBDBDB00FF00
00000000FF00000000DBDBDBDB00FFFFFFFFFFFFFFFF00DBDBDBDBDBDBDB00FF
0000000000FF00DBDBDBDBDBDBDB00FFFFFFFFFFFFFFFF00DBDBDBDBDBDBDB00
0000000000000000DBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDB}
end
object btRemessa: TBitBtn
Left = 168
Top = 8
Width = 75
Height = 25
Caption = '&Remessa'
TabOrder = 3
Visible = False
OnClick = btRemessaClick
Glyph.Data = {
F6000000424DF600000000000000760000002800000010000000100000000100
0400000000008000000000000000000000001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
7777777777777777777777700000000000777770FFFFFFFFF0777770F888888F
F0777770FFFFFFFFF0777770F8888888F0777770FFFFFFFFF0777770F000000F
F0777770FFFFFFFFF0777770F8888888F0777770FFFFFFFFF077777444444444
4477777444444444447777777777777777777777777777777777}
end
end
object dsProdutosLote: TDataSource
DataSet = qryLotes
OnDataChange = dsProdutosLoteDataChange
Left = 248
Top = 32
end
object qryLotes: TQuery
DatabaseName = 'InfoModa'
SQL.Strings = (
'Select * from SACLOT Where (LOT_NRLOTE=:pNRLOTE) '
'And (LOT_QTPROD>=:pQTMINI) order by LOT_CDPROD')
Left = 288
Top = 34
ParamData = <
item
DataType = ftString
Name = 'pNRLOTE'
ParamType = ptInput
Value = ''
end
item
DataType = ftFloat
Name = 'pQTMINI'
ParamType = ptInput
Value = 0.000000000000000000
end>
object qryLotesLOT_NRSEQU: TStringField
FieldName = 'LOT_NRSEQU'
Origin = 'INFOMODA."SACLOT.DB".LOT_NRSEQU'
Size = 10
end
object qryLotesLOT_NRLOTE: TStringField
FieldName = 'LOT_NRLOTE'
Origin = 'INFOMODA."SACLOT.DB".LOT_NRLOTE'
Size = 7
end
object qryLotesLOT_NRPEDI: TStringField
FieldName = 'LOT_NRPEDI'
Origin = 'INFOMODA."SACLOT.DB".LOT_NRPEDI'
Size = 7
end
object qryLotesLOT_CDPROD: TStringField
FieldName = 'LOT_CDPROD'
Origin = 'INFOMODA."SACLOT.DB".LOT_CDPROD'
Size = 13
end
object qryLotesLOT_NMPROD: TStringField
FieldName = 'LOT_NMPROD'
Origin = 'INFOMODA."SACLOT.DB".LOT_NMPROD'
Size = 40
end
object qryLotesLOT_QTPROD: TFloatField
FieldName = 'LOT_QTPROD'
Origin = 'INFOMODA."SACLOT.DB".LOT_QTPROD'
end
object qryLotesLOT_NMPRO2: TStringField
FieldKind = fkLookup
FieldName = 'LOT_NMPRO2'
LookupDataSet = dmInfoModa.qryProduto
LookupKeyFields = 'PRO_CDBARR'
LookupResultField = 'PRO_NMPROD'
KeyFields = 'LOT_CDPROD'
Size = 40
Lookup = True
end
end
object qryQUANTIDADE: TQuery
DatabaseName = 'InfoModa'
SQL.Strings = (
'Select SUM(ITP_QTPROD) TOTAL from SACITP'
'Where (ITP_NRPEDI=:fNRPEDI) And (ITP_CDPROD=:fCDPROD)')
Left = 320
Top = 34
ParamData = <
item
DataType = ftString
Name = 'fNRPEDI'
ParamType = ptInput
Value = ''
end
item
DataType = ftString
Name = 'fCDPROD'
ParamType = ptInput
Value = ''
end>
object qryQUANTIDADETOTAL: TFloatField
FieldName = 'TOTAL'
Origin = 'INFOMODA."SACITP.DB".ITP_QTPROD'
end
end
object qryLocalizar: TQuery
DatabaseName = 'InfoModa'
SQL.Strings = (
'Select * from SACLOT Where (LOT_NRLOTE=:pNRLOTE) '
'and (LOT_CDPROD=:pCDPROD) ')
Left = 352
Top = 34
ParamData = <
item
DataType = ftString
Name = 'pNRLOTE'
ParamType = ptInput
Value = ''
end
item
DataType = ftString
Name = 'pCDPROD'
ParamType = ptInput
Value = ''
end>
end
object qryQTCORES: TQuery
DatabaseName = 'InfoModa'
SQL.Strings = (
'Select SUM(GTM_QTPROD) GTM_TOQUAN from SACGTM Where (GTM_NRLOTE=' +
':pNRLOTE)'
'And (GTM_CDPROD=:pCDPROD)'
'and (GTM_CODCOR=:pCODCOR)')
Left = 432
Top = 34
ParamData = <
item
DataType = ftString
Name = 'pNRLOTE'
ParamType = ptInput
Value = ''
end
item
DataType = ftString
Name = 'pCDPROD'
ParamType = ptInput
Value = ''
end
item
DataType = ftString
Name = 'pCODCOR'
ParamType = ptInput
Value = ''
end>
object qryQTCORESGTM_TOQUAN: TFloatField
FieldName = 'GTM_TOQUAN'
Origin = 'INFOMODA."SACGTM.DB".GTM_QTPROD'
end
end
object qryQTNUMEROS: TQuery
DatabaseName = 'InfoModa'
SQL.Strings = (
'Select SUM(GTM_QTPROD) GTM_TOQUAN from SACGTM Where (GTM_NRLOTE=' +
':pNRLOTE)'
'And (GTM_CDPROD=:pCDPROD)'
'and (GTM_TAMANH=:pTAMANH)')
Left = 464
Top = 34
ParamData = <
item
DataType = ftUnknown
Name = 'pNRLOTE'
ParamType = ptUnknown
end
item
DataType = ftUnknown
Name = 'pCDPROD'
ParamType = ptUnknown
end
item
DataType = ftUnknown
Name = 'pTAMANH'
ParamType = ptUnknown
end>
end
object qryProdLote: TQuery
DatabaseName = 'InfoModa'
SQL.Strings = (
'Select * from SACGTM')
Left = 200
Top = 34
object qryProdLoteGTM_NRPEDI: TStringField
FieldName = 'GTM_NRPEDI'
Origin = 'INFOMODA."SACGTM.DB".GTM_NRPEDI'
Size = 7
end
object qryProdLoteGTM_NRLOTE: TStringField
FieldName = 'GTM_NRLOTE'
Origin = 'INFOMODA."SACGTM.DB".GTM_NRLOTE'
Size = 7
end
object qryProdLoteGTM_CDPROD: TStringField
FieldName = 'GTM_CDPROD'
Origin = 'INFOMODA."SACGTM.DB".GTM_CDPROD'
Size = 13
end
object qryProdLoteGTM_CDTAMA: TStringField
FieldName = 'GTM_CDTAMA'
Origin = 'INFOMODA."SACGTM.DB".GTM_CDTAMA'
Size = 2
end
object qryProdLoteGTM_CODCOR: TStringField
FieldName = 'GTM_CODCOR'
Origin = 'INFOMODA."SACGTM.DB".GTM_CODCOR'
Size = 3
end
object qryProdLoteGTM_TAMANH: TStringField
FieldName = 'GTM_TAMANH'
Origin = 'INFOMODA."SACGTM.DB".GTM_TAMANH'
Size = 2
end
object qryProdLoteGTM_QTPROD: TFloatField
FieldName = 'GTM_QTPROD'
Origin = 'INFOMODA."SACGTM.DB".GTM_QTPROD'
end
object qryProdLoteGTM_FLSITU: TStringField
FieldName = 'GTM_FLSITU'
Origin = 'INFOMODA."SACGTM.DB".GTM_FLSITU'
Size = 1
end
end
object qryIncItemRem: TQuery
DatabaseName = 'InfoModa'
SQL.Strings = (
'INSERT INTO SACRIT (RIT_CDPROD, RIT_CDTAMA, RIT_NRLOTE, RIT_CODC' +
'OR, RIT_QTPROD)'
'VALUES (:pCDPROD, :pCDTAMA, :pNRLOTE, :pCODCOR, :pQTPROD)')
Left = 344
Top = 308
ParamData = <
item
DataType = ftString
Name = 'pCDPROD'
ParamType = ptInput
Value = ''
end
item
DataType = ftString
Name = 'pCDTAMA'
ParamType = ptInput
Value = ''
end
item
DataType = ftString
Name = 'pNRLOTE'
ParamType = ptInput
Value = ''
end
item
DataType = ftString
Name = 'pCODCOR'
ParamType = ptInput
Value = ''
end
item
DataType = ftFloat
Name = 'pQTPROD'
ParamType = ptInput
Value = 0.000000000000000000
end>
end
object qryLocItem: TQuery
DatabaseName = 'InfoModa'
SQL.Strings = (
'Select RIT_CDPROD, RIT_CODCOR from SACRIT Where (RIT_CDPROD=:pCD' +
'PROD) And (RIT_CODCOR=:pCODCOR) '
'AND (RIT_CDTAMA=:pCDTAMA)')
Left = 384
Top = 308
ParamData = <
item
DataType = ftString
Name = 'pCDPROD'
ParamType = ptInput
Value = ''
end
item
DataType = ftString
Name = 'pCODCOR'
ParamType = ptInput
Value = ''
end
item
DataType = ftString
Name = 'pCDTAMA'
ParamType = ptInput
Value = ''
end>
end
object qryAtualizarItem: TQuery
DatabaseName = 'InfoModa'
SQL.Strings = (
'UpDate SACRIT SET RIT_QTPROD = RIT_QTPROD + :pQTPROD'
'Where (RIT_CDPROD=:pCDPROD) And (RIT_CODCOR=:pCODCOR)'
'And (RIT_CDTAMA=:pCDTAMA)'
'')
Left = 416
Top = 308
ParamData = <
item
DataType = ftFloat
Name = 'pQTPROD'
ParamType = ptInput
Value = 0.000000000000000000
end
item
DataType = ftString
Name = 'pCDPROD'
ParamType = ptInput
Value = ''
end
item
DataType = ftString
Name = 'pCODCOR'
ParamType = ptInput
Value = ''
end
item
DataType = ftString
Name = 'pCDTAMA'
ParamType = ptInput
Value = ''
end>
end
object qryRemessa: TQuery
DatabaseName = 'InfoModa'
Left = 448
Top = 308
end
object qryLimparRemessa: TQuery
DatabaseName = 'InfoModa'
SQL.Strings = (
'Delete from SACRIT')
Left = 488
Top = 308
end
object qryPedido: TQuery
DatabaseName = 'InfoModa'
SQL.Strings = (
'Select PED_NRPEDI, PED_NRLOTE from SACPED Where (PED_NRLOTE=:pNR' +
'LOTE) ')
Left = 312
Top = 275
ParamData = <
item
DataType = ftString
Name = 'pNRLOTE'
ParamType = ptInput
Value = ''
end>
end
end
| 31.795385 | 140 | 0.681424 |
af3c2948fb90b2b6d67443c2eb8309f96dc8ea1f | 5,871 | pas | Pascal | toolkit/SearchParameterCombinationEditor.pas | 17-years-old/fhirserver | 9575a7358868619311a5d1169edde3ffe261e558 | [
"BSD-3-Clause"
]
| null | null | null | toolkit/SearchParameterCombinationEditor.pas | 17-years-old/fhirserver | 9575a7358868619311a5d1169edde3ffe261e558 | [
"BSD-3-Clause"
]
| null | null | null | toolkit/SearchParameterCombinationEditor.pas | 17-years-old/fhirserver | 9575a7358868619311a5d1169edde3ffe261e558 | [
"BSD-3-Clause"
]
| null | null | null | unit SearchParameterCombinationEditor;
{
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.
}
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.ScrollBox,
FMX.Memo, FMX.ListBox, FMX.Edit, FMX.StdCtrls, FMX.Controls.Presentation,
FHIR.Support.Base,
FHIR.Base.Lang,
FHIR.Version.Types, FHIR.Version.Resources, FHIR.Version.Utilities,
FMX.Layouts;
type
TSearchParameterCombinationEditorForm = class(TForm)
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Label27: TLabel;
cbxConformance: TComboBox;
Label1: TLabel;
lbParameters: TListBox;
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
FExtension: TFhirExtension;
FParameters: TFhirCapabilityStatementRestResourceSearchParamList;
procedure SetExtension(const Value: TFhirExtension);
procedure SetParameters(const Value: TFhirCapabilityStatementRestResourceSearchParamList);
public
destructor Destroy; override;
property Parameters : TFhirCapabilityStatementRestResourceSearchParamList read FParameters write SetParameters;
property Extension : TFhirExtension read FExtension write SetExtension;
end;
var
SearchParameterCombinationEditorForm: TSearchParameterCombinationEditorForm;
implementation
{$R *.fmx}
uses
FHIR.Base.Utilities;
function IsValidSearchParam(s : String) : boolean;
begin
result := IsId(s);
end;
{ TForm1 }
procedure TSearchParameterCombinationEditorForm.Button1Click(Sender: TObject);
var
i, t : integer;
begin
t := 0;
for i := 0 to lbParameters.Items.Count - 1 do
if lbParameters.ListItems[i].IsChecked then
inc(t);
if t < 2 then
raise EFHIRException.create('At least 2 parameters must be selected');
FExtension.removeExtension('required');
for i := 0 to lbParameters.Items.Count - 1 do
if lbParameters.ListItems[i].IsChecked then
FExtension.addExtension('required', lbParameters.items[i]);
case cbxConformance.ItemIndex of
1: FExtension.setExtension('http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation', TFHIRCode.create('SHALL'));
2: FExtension.setExtension('http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation', TFHIRCode.create('SHOULD'));
3: FExtension.setExtension('http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation', TFHIRCode.create('MAY'));
4: FExtension.setExtension('http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation', TFHIRCode.create('SHALL NOT'));
else
FExtension.removeExtension('http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation')
end;
end;
destructor TSearchParameterCombinationEditorForm.Destroy;
begin
FParameters.Free;
FExtension.Free;
inherited;
end;
procedure TSearchParameterCombinationEditorForm.FormShow(Sender: TObject);
var
s : String;
p : TFhirCapabilityStatementRestResourceSearchParam;
exl : TFslList<TFHIRExtension>;
ex : TFhirExtension;
i : integer;
begin
lbParameters.Items.Clear;
for p in FParameters do
lbParameters.Items.Add(p.name);
exl := FExtension.listExtensions('required');
try
for ex in exl do
begin
for i := 0 to lbParameters.Items.Count - 1 do
if lbParameters.Items[i] = ex.value.primitiveValue then
lbParameters.ListItems[i].IsChecked := true;
end;
finally
exl.free;
end;
cbxConformance.ItemIndex := 0;
if Extension.hasExtension('http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation') then
begin
s := Extension.getExtensionString('http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation');
if s = 'SHALL' then
cbxConformance.ItemIndex := 1;
if s = 'SHOULD' then
cbxConformance.ItemIndex := 2;
if s = 'MAY' then
cbxConformance.ItemIndex := 3;
if s = 'SHALL NOT' then
cbxConformance.ItemIndex := 4;
end;
end;
procedure TSearchParameterCombinationEditorForm.SetExtension(const Value: TFhirExtension);
begin
FExtension.Free;
FExtension := Value;
end;
procedure TSearchParameterCombinationEditorForm.SetParameters(const Value: TFhirCapabilityStatementRestResourceSearchParamList);
begin
FParameters.Free;
FParameters := Value;
end;
end.
| 34.535294 | 138 | 0.765117 |
47225754bf98acd46e10eab3a549e6058a974d9b | 28,879 | pas | Pascal | lib/dubhFunctions.pas | CptMcSplody/xedit-scripts | eb0dc6563435d15a7d32801a0b6192d300d7f5db | [
"MIT"
]
| 31 | 2015-12-04T05:42:02.000Z | 2021-12-18T06:09:14.000Z | lib/dubhFunctions.pas | CptMcSplody/xedit-scripts | eb0dc6563435d15a7d32801a0b6192d300d7f5db | [
"MIT"
]
| 10 | 2016-11-08T07:20:36.000Z | 2017-03-06T14:35:59.000Z | lib/dubhFunctions.pas | CptMcSplody/xedit-scripts | eb0dc6563435d15a7d32801a0b6192d300d7f5db | [
"MIT"
]
| 20 | 2016-03-20T15:01:44.000Z | 2022-01-05T20:32:25.000Z | unit dubhFunctions;
uses mteFunctions;
// --------------------------------------------------------------------
// AddMessage
// --------------------------------------------------------------------
procedure Log(const s: String);
begin
AddMessage(s);
end;
// --------------------------------------------------------------------
// Returns x number of characters from left, or returns whole string
// if x number of characters exceed length of string
// --------------------------------------------------------------------
function LeftStr(s: String; i: Integer): String;
begin
if i > Length(s) then
Result := s
else
Result := Copy(s, 0, i);
end;
// --------------------------------------------------------------------
// Returns x number of characters from right, or returns whole string
// if x number of characters exceed length of string
// --------------------------------------------------------------------
function RightStr(s: String; i: Integer): String;
begin
if i > Length(s) then
Result := s
else
Result := Copy(s, Length(s) - (i - 1), i);
end;
// --------------------------------------------------------------------
// Returns cell reference from REFR/ACHR
// --------------------------------------------------------------------
function GetCell(e: IInterface): IInterface;
var
cell: IInterface;
begin
cell := ElementByName(e, 'Cell');
if not Assigned(cell) then
Result := nil
else
Result := LinksTo(cell);
end;
// --------------------------------------------------------------------
// Return whether a value is null
// --------------------------------------------------------------------
function IsNull(x: Variant): Boolean;
var
sDefType: String;
begin
if not CanContainFormIDs(x) then begin
sDefType := DefTypeString(x);
if sDefType = 'dtInteger' then
Result := (GetNativeValue(x) = 0)
else if sDefType = 'dtFloat' then
Result := (GetNativeValue(x) = 0.0);
exit;
end;
if CanContainFormIDs(x) then
Result := HasString('00000000', GetEditValue(x), False);
end;
// --------------------------------------------------------------------
// Return a hexadecimal form id with signature
// --------------------------------------------------------------------
function ShortFormID(x: IInterface): String;
begin
Result := '[' + Signature(x) + ':' + HexFormID(x) + ']';
end;
// --------------------------------------------------------------------
// Return whether a number is divisible by another into a whole number
// --------------------------------------------------------------------
function DivisibleBy(x, y: Real): Boolean;
begin
Result := (x mod y = 0);
end;
// --------------------------------------------------------------------
// Recursively add value of named field to list
// --------------------------------------------------------------------
procedure RecursiveAddToList(e: IInterface; elementName: String; results: TStringList);
var
i, c: Integer;
kFile: IwbFile;
kMainRecord, kChild: IInterface;
sFile: String;
begin
kMainRecord := ContainingMainRecord(e);
c := ElementCount(e);
if c > 0 then begin
for i := 0 to Pred(c) do begin
kChild := ElementByIndex(e, i);
if ElementCount(kChild) > 0 then
RecursiveAddToList(kChild, elementName, results)
else
if HasString(elementName, Name(kChild), False) then
results.Add(SmallNameEx(kMainRecord) + #9 + GetEditValue(kChild));
end;
end;
end;
// --------------------------------------------------------------------
// Recursively add key-value pairs to list
// --------------------------------------------------------------------
procedure RecursiveAddPairToList(e: IInterface; keyName, valueName: String; results: TStringList);
var
i, c: Integer;
kFile: IwbFile;
kMainRecord, kChild: IInterface;
sFile, sTempKey: String;
begin
results.NameValueSeparator := '=';
kMainRecord := ContainingMainRecord(e);
sTempKey := '';
c := ElementCount(e);
if c > 0 then begin
for i := 0 to Pred(c) do begin
kChild := ElementByIndex(e, i);
if ElementCount(kChild) > 0 then
RecursiveAddPairToList(kChild, keyName, valueName, results)
else
if HasString(keyName, Name(kChild), False) then
sTempKey := GetEditValue(kChild);
if HasString(valueName, Name(kChild), False) then begin
results.CommaText := '"' + sTempKey + '"=' + GetEditValue(kChild);
sTempKey := '';
end;
end;
end;
end;
// --------------------------------------------------------------------
// Return comma-separated list of hexadecimal form ids
// --------------------------------------------------------------------
function FlagsToHex(e: IInterface): String;
var
i: Integer;
ls: TStringList;
begin
ls := TStringList.Create;
ls.Add(IntToHex(GetNativeValue(e), 8));
for i := 0 to ElementCount(e) - 1 do
ls.Add(IntToHex(GetNativeValue(ElementByIndex(e, i)), 8));
Result := ls.CommaText;
end;
// --------------------------------------------------------------------
// Return comma-separated list of element names
// --------------------------------------------------------------------
function FlagsToNames(e: IInterface): String;
var
i: Integer;
ls: TStringList;
begin
if not Assigned(e) then
Result := '';
ls := TStringList.Create;
for i := 0 to ElementCount(e) - 1 do
ls.Add(Name(ElementByIndex(e, i)));
Result := ls.CommaText;
end;
// --------------------------------------------------------------------
// Return path without labels
// --------------------------------------------------------------------
function BasePath(x: IInterface): String;
var
sPath: String;
begin
//sPath := TrimChar(#32, RegExReplace('\s[-]\s[a-zA-Z0-9 ]+', '', Trim(Path(x))));
sPath := Path(x);
sPath := Trim(sPath);
sPath := RegExReplace('\h+[-]\h+[a-zA-Z0-9 ]+', '', sPath);
sPath := Trim(sPath);
sPath := RegExReplace('^[a-zA-Z0-9]{4}', '', sPath);
sPath := Trim(sPath);
sPath := RegExReplace('^[\\]', '', sPath);
sPath := Trim(sPath);
sPath := RegExReplace('\h*[\\]\h+', '\\', sPath);
sPath := Trim(sPath);
sPath := RegExReplace('\h+[-]$', '', sPath);
sPath := Trim(sPath);
Result := sPath;
//Result := TrimChar(#32, RegExReplace('\s[-]\s\w+\s', Trim(Path(x)), ''));
//Result := TrimChar(#32, RegExReplace('\b[a-zA-Z0-9]+\b\K\h[-]$|\b[a-zA-Z0-9]+\b\K\h[-](.*)$|\b[a-zA-Z0-9]+\b\K\h[-]\h\b[a-zA-Z0-9]+\b$', TrimRight(Path(x)), '#'));
end;
// --------------------------------------------------------------------
// A shorter way to replace strings without RegEx
// --------------------------------------------------------------------
function StrReplace(this, that, subj: String): String;
begin
Result := StringReplace(subj, this, that, [rfReplaceAll, rfIgnoreCase]);
end;
function EscapeSlashes(s: String): String;
begin
Result := StrReplace('\', '\\', s);
end;
// --------------------------------------------------------------------
// Replace a substring with a RegEx pattern and return the new string
// --------------------------------------------------------------------
function RegExReplace(const ptrn, repl, subj: String): String;
var
re: TPerlRegEx;
output: String;
begin
re := TPerlRegEx.Create;
try
re.RegEx := ptrn;
re.Options := [];
re.Subject := subj;
re.Replacement := repl;
re.ReplaceAll;
output := re.Subject;
finally
re.Free;
Result := output;
end;
end;
// --------------------------------------------------------------------
// Return a substring with a RegEx pattern
// --------------------------------------------------------------------
function RegExMatch(ptrn, subj: String): String;
var
re: TPerlRegEx;
output: String;
begin
output := nil;
re := TPerlRegEx.Create;
try
re.RegEx := ptrn;
re.Options := [];
re.Subject := subj;
if re.Match then
output := re.MatchedText;
finally
re.Free;
Result := output;
end;
end;
function RegExMatchAll(ptrn, subj: String): TStringList;
var
re: TPerlRegEx;
output: TStringList;
i: Integer;
begin
output := TStringList.Create;
re := TPerlRegEx.Create;
try
re.RegEx := ptrn;
re.Options := [];
re.Subject := subj;
if re.Match then begin
output.Add(re.MatchedText);
repeat
output.Add(re.MatchedText);
until not re.MatchAgain;
end;
finally
re.Free;
Result := output;
end;
end;
// --------------------------------------------------------------------
// Return whether a string matches a RegEx pattern
// --------------------------------------------------------------------
function RegExMatches(ptrn, subj: String): Boolean;
var
re: TPerlRegEx;
output: String;
begin
output := False;
re := TPerlRegEx.Create;
try
re.RegEx := ptrn;
re.Options := [];
re.Subject := subj;
if re.Match then
output := re.FoundMatch;
finally
re.Free;
Result := output;
end;
end;
function UnCamelCase(s: String): String;
var
output: String;
begin
output := RegExReplace('(\B[A-Z])', ' $1', s);
Result := RegExReplace('(\B[0-9]{2})', ' $1', output);
end;
// --------------------------------------------------------------------
// Apply Markdown formatting to TStringList
// --------------------------------------------------------------------
function Markdown(const ls: TStringList; const d: Char; const pre: Boolean): TStringList;
var
mds, mdb, mde, mdd: String;
i: Integer;
lsmd: TStringList;
begin
if pre then begin
mdb := '<pre>';
mde := '</pre>';
mdd := '</pre> | <pre>';
end;
if not pre then begin
mdb := '';
mde := '';
mdd := ' | ';
end;
lsmd := TStringList.Create;
for i := 0 to ls.Count - 1 do begin
mds := mdb + StringReplace(ls[i], d, mdd, [rfReplaceAll, rfIgnoreCase]) + mde;
lsmd.Add(mds);
end;
Result := lsmd;
end;
// --------------------------------------------------------------------
// GetEditValue
// --------------------------------------------------------------------
function gev(const s: String): String;
begin
Result := GetEditValue(s);
end;
// --------------------------------------------------------------------
// SetEditValue
// --------------------------------------------------------------------
procedure sev(const x: IInterface; const s: String);
begin
SetEditValue(x, s);
end;
// --------------------------------------------------------------------
// GetNativeValue
// --------------------------------------------------------------------
function gnv(const x: IInterface): Variant;
begin
Result := GetNativeValue(x);
end;
// --------------------------------------------------------------------
// SetNativeValue
// --------------------------------------------------------------------
procedure snv(const x: IInterface; const v: Variant);
begin
SetNativeValue(x, v);
end;
// --------------------------------------------------------------------
// Lowercases two strings, compares them, and returns value
// --------------------------------------------------------------------
function StringCompare(const this, that: String; cs: Boolean): Integer;
begin
if not cs then
Result := CompareStr(Lowercase(this), Lowercase(that));
else
Result := CompareStr(this, that);
end;
// --------------------------------------------------------------------
// Returns true/false if element is assigned by element's signature
// --------------------------------------------------------------------
function AssignedBySignature(const x: IInterface; const s: String): Boolean;
begin
Result := Assigned(GetElement(x, s));
end;
// --------------------------------------------------------------------
// Returns the string for a condition type
// --------------------------------------------------------------------
function GetConditionType(const val: String): String;
var
operators: String;
a, b, c, d, e: Boolean;
begin
if GetChar(val, 1) = '1' then a := True; // equal to
if GetChar(val, 2) = '1' then b := True; // greater than
if GetChar(val, 3) = '1' then c := True; // less than
if GetChar(val, 4) = '1' then d := True; // or
if val = '00000000' then e := True;
if e then Result := 'Not equal to';
if a and not b and not c and not d then Result := 'Equal to';
if b and not a and not c and not d then Result := 'Greater than';
if c and not a and not b and not d then Result := 'Less than';
if a and b and not c and not d then Result := 'Greater than or equal to';
if a and c and not b and not d then Result := 'Less than or equal to';
if a and d and not b and not c then Result := 'Equal to / Or';
if b and d and not a and not c then Result := 'Greater than / Or';
if c and d and not a and not b then Result := 'Less than / Or';
if a and b and d and not c then Result := 'Greater than or equal to / Or';
if a and c and d and not b then Result := 'Less than or equal to / Or';
end;
// --------------------------------------------------------------------
// Returns the string of a condition type but with comparison operators
// --------------------------------------------------------------------
function GetConditionOperator(const val: String): String;
var
a, b, c, d, e: Boolean;
begin
if GetChar(val, 1) = '1' then a := True; // equal to
if GetChar(val, 2) = '1' then b := True; // greater than
if GetChar(val, 3) = '1' then c := True; // less than
if GetChar(val, 4) = '1' then d := True; // or
if val = '00000000' then e := True;
if e then Result := '<>';
if a and not b and not c and not d then Result := '=='; // 1000
if b and not a and not c and not d then Result := '>'; // 0100
if c and not a and not b and not d then Result := '<'; // 0010
if a and b and not c and not d then Result := '>='; // 1100
if a and c and not b and not d then Result := '<='; // 1010
if a and d and not b and not c then Result := '== / Or'; // 1001
if not a and b and not c and d then Result := '> / Or'; // 0101
if not a and not b and c and d then Result := '< / Or'; // 0011
if a and b and d and not c then Result := '>= / Or'; // 1101
if a and c and d and not b then Result := '<= / Or'; // 1011
end;
// --------------------------------------------------------------------
// Returns a localized string as a string from a hexadecimal Form ID
// Note: Init LocalizationGetStringsFromFile() for performance gain
// --------------------------------------------------------------------
function GetLStringByFormID(const hex: String; const sl: TStringList): String;
var
idx: Integer;
begin
// add LocalizationGetStringsFromFile('fallout4_en.strings', stringListObj);
// to Initialize
idx := sl.IndexOfObject(TObject(StrToInt('$' + hex)));
if idx > -1 then
Result := sl[idx]
else
Result := 'String not found in lookup table';
end;
// --------------------------------------------------------------------
// Converts a string to a hexadecimal value
// --------------------------------------------------------------------
function StrToHex(const s: String): string;
var
i: Integer;
begin
Result := '';
for i := 1 to Length(s) do
Result := Result + IntToHex(Ord(s[i]), 2);
end;
// --------------------------------------------------------------------
// Reverses a byte array and returns a string
// --------------------------------------------------------------------
function ReverseHex(const s: String): String;
var
i: Integer;
slSource, slTarget: TStringList;
begin
slSource := TStringList.Create;
slSource.Delimiter := #32;
slTarget := TStringList.Create;
slTarget.Delimiter := #32;
slSource.DelimitedText := s;
for i := slSource.Count - 1 downto 0 do
slTarget.Add(slSource[i]);
Result := TrimChar(' ', slTarget.DelimitedText);
end;
// --------------------------------------------------------------------
// Return the number of times a character occurs in a string
// --------------------------------------------------------------------
function NumOfChar(const s: String; const c: Char): Integer;
var
i: Integer;
begin
Result := 0;
for i := 1 to Length(s) do
if s[i] = c then Inc(Result);
end;
// --------------------------------------------------------------------
// Trim character from string and return string
// --------------------------------------------------------------------
function TrimChar(const c: Char; const s: String): String;
begin
Result := StringReplace(s, c, '', [rfReplaceAll, rfIgnoreCase]);
end;
// --------------------------------------------------------------------
// Returns True if the x signature is in the y list of signatures
// --------------------------------------------------------------------
function InDelimitedList(x, y: String; const z: Char): Boolean;
var
i: Integer;
l: TStringList;
begin
i := -1;
try
l := TStringList.Create;
l.Delimiter := z;
l.DelimitedText := y;
i := l.IndexOf(x);
finally
FreeAndNil(l);
x := nil;
y := nil;
end;
Result := i > -1;
end;
// --------------------------------------------------------------------
// Returns true/false if a string is in a TStringList
// --------------------------------------------------------------------
function InStringList(const s: String; const l: TStringList): Boolean;
begin
Result := (l.IndexOf(s) <> -1);
end;
// --------------------------------------------------------------------
// Returns the number of duplicates of a string in a TStringList
// --------------------------------------------------------------------
function CountDuplicatesInTStringList(s: String; l: TStringList): Integer;
var
i, j: Integer;
begin
if not InStringList(s, l) then
Result := 0;
j := 0;
for i := 0 to l.Count - 1 do
if (s = l[i]) then
j := j + 1;
Result := j;
end;
// --------------------------------------------------------------------
// Returns true if the needle is in the haystack
// --------------------------------------------------------------------
function HasString(const asNeedle, asHaystack: String; const abCaseSensitive: Boolean): Boolean;
begin
if abCaseSensitive then
if Pos(asNeedle, asHaystack) > 0 then
Result := True
else
if Pos(Lowercase(asNeedle), Lowercase(asHaystack)) > 0 then
Result := True;
end;
// --------------------------------------------------------------------
// Returns any element from a string
// --------------------------------------------------------------------
function GetElement(const x: IInterface; const s: String): IInterface;
begin
if Length(s) > 0 then begin
if Pos('[', s) > 0 then
Result := ElementByIP(x, s)
else if Pos('\', s) > 0 then
Result := ElementByPath(x, s)
else if s = Uppercase(s) then
Result := ElementBySignature(x, s)
else
Result := ElementByName(x, s);
end;
end;
// --------------------------------------------------------------------
// Returns a master overriding record. Int parameter should be 1 or 2.
// --------------------------------------------------------------------
function OverrideMaster(const x: IInterface; i: Integer): IInterface;
var
o: IInterface;
begin
o := Master(x);
if not Assigned(o) then
o := MasterOrSelf(x);
if OverrideCount(o) > i - 1 then
o := OverrideByIndex(o, OverrideCount(o) - i);
Result := o;
end;
// --------------------------------------------------------------------
// Returns the last overriding record
// --------------------------------------------------------------------
function LastOverride(const x: IInterface): IInterface;
var
o: IInterface;
begin
o := Master(x);
if not Assigned(o) then
o := MasterOrSelf(x);
if OverrideCount(o) > 0 then
o := OverrideByIndex(o, OverrideCount(o) - 1);
Result := o;
end;
// --------------------------------------------------------------------
// Returns "NAME/EDID [SIG_:00000000]" as a String
// --------------------------------------------------------------------
function SmallNameEx(const e: IInterface): String;
var
sig: String;
begin
if Signature(e) <> 'REFR' then sig := 'EDID' else sig := 'NAME';
Result := Trim(GetElementEditValues(e, sig) + ' [' + Signature(e) + ':' + HexFormID(e) + ']');
end;
// --------------------------------------------------------------------
// Returns the sortkey with handling for .nif paths, and unknown/unused
// data. Also uses a better delimiter.
// --------------------------------------------------------------------
function SortKeyEx(const e: IInterface): String;
var
i: Integer;
kElement: IInterface;
begin
Result := Lowercase(GetEditValue(e));
for i := 0 to ElementCount(e) - 1 do
begin
kElement := ElementByIndex(e, i);
if (Pos('unknown', Lowercase(Name(kElement))) > 0)
or (Pos('unused', Lowercase(Name(kElement))) > 0) then
exit;
if Result <> '' then
Result := Result + ' ' + SortKeyEx(kElement)
else
Result := SortKeyEx(kElement);
end;
end;
// --------------------------------------------------------------------
// Returns values from a text file as a TStringList
// --------------------------------------------------------------------
function LoadFromCsv(const bSorted, bDuplicates, bDelimited: Boolean; const d: String = ';'): TStringList;
var
objFile: TOpenDialog;
lsLines: TStringList;
begin
lsLines := TStringList.Create;
if bSorted then
lsLines.Sorted;
if bDuplicates then
lsLines.Duplicates := dupIgnore;
if bDelimited then
if d <> '' then
lsLines.NameValueSeparator := d
else
lsLines.NameValueSeparator := #44;
objFile := TOpenDialog.Create(nil);
try
objFile.InitialDir := GetCurrentDir;
objFile.Options := [ofFileMustExist];
objFile.Filter := '*.csv';
objFile.FilterIndex := 1;
if objFile.Execute then
lsLines.LoadFromFile(objFile.FileName);
finally
objFile.Free;
end;
Result := lsLines;
end;
// --------------------------------------------------------------------
// Returns values from a text file as a TStringList
// --------------------------------------------------------------------
function LoadFromDelimitedList(const sDelimiter: String = ';'): TStringList;
var
objFile: TOpenDialog;
lsLines: TStringList;
begin
lsLines := TStringList.Create;
lsLines.Delimiter := sDelimiter;
objFile := TOpenDialog.Create(nil);
try
objFile.InitialDir := GetCurrentDir;
objFile.Options := [ofFileMustExist];
objFile.Filter := '*.csv';
objFile.FilterIndex := 1;
if objFile.Execute then
lsLines.LoadFromFile(objFile.FileName);
finally
objFile.Free;
end;
Result := lsLines;
end;
// --------------------------------------------------------------------
// Converts a Formlist or Leveled List to a TStringList
// --------------------------------------------------------------------
function ListObjectToTStringList(e: IInterface): TStringList;
var
aParent, aChild: IINterface;
lsResults: TStringList;
i: Integer;
begin
lsResults := TStringList.Create;
lsResults.Sorted := False;
lsResults.Duplicates := dupAccept;
aParent := ElementByName(e, 'Leveled List Entries');
if not Assigned(aParent) then
aParent := ElementByName(e, 'FormIDs');
if Name(aParent) = 'Leveled List Entries' then begin
for i := 0 to ElementCount(aParent) - 1 do begin
aChild := ElementBySignature(ElementByIndex(aParent, i), 'LVLO');
lsResults.Add(GetEditValue(ElementByIndex(aChild, 0)) + ',' + HexFormID(LinksTo(ElementByIndex(aChild, 2))) + ',' + GetEditValue(ElementByIndex(aChild, 3)));
end;
end else begin
for i := 0 to ElementCount(aParent) - 1 do begin
aChild := ElementByIndex(aParent, i);
lsResults.Add(GetEditValue(aChild));
end;
end;
Result := lsResults;
end;
// --------------------------------------------------------------------
// Returns a group by signature, or adds the group if needed
// --------------------------------------------------------------------
function AddGroupBySignature(const f: IwbFile; const s: String): IInterface;
begin
Result := GroupBySignature(f, s);
if not Assigned(Result) then
Result := Add(f, s, True);
end;
// --------------------------------------------------------------------
// Adds a new record to a group
// --------------------------------------------------------------------
function AddNewRecordToGroup(const g: IInterface; const s: String): IInterface;
begin
Result := Add(g, s, True);
if not Assigned(Result) then
Result := Add(g, s, True); // tries twice because
end;
// --------------------------------------------------------------------
// Returns an element by string, or adds the element if needed
// --------------------------------------------------------------------
function AddElementByString(const r: IInterface; const s: String): IInterface;
begin
Result := GetElement(r, s);
if not Assigned(Result) then
Result := Add(r, s, True);
end;
// --------------------------------------------------------------------
// Returns an element by string, or adds the element if needed
// --------------------------------------------------------------------
function AssignElementByString(const r: IInterface; const s: String): IInterface;
begin
Result := ElementAssign(GetElement(r, s), HighInteger, nil, False);
end;
function AppendElementByString(const r: IInterface; const s: String): IInterface;
begin
Result := ElementAssign(GetElement(r, s), LowInteger, nil, False);
end;
// --------------------------------------------------------------------
// Adds a form to a formlist
// --------------------------------------------------------------------
procedure AddRecordToFormList(const f, r: IInterface);
var
l: IInterface;
begin
l := ElementAssign(f, HighInteger, nil, True);
SetEditValue(l, IntToHex(FixedFormID(r), 8));
end;
// --------------------------------------------------------------------
// Int to Bin
// --------------------------------------------------------------------
function IntToBin(value: LongInt; sz: Integer): String;
var
i: Integer;
begin
Result := '';
for i := sz - 1 downto 0 do
if value and (1 shl i) <> 0 then
Result := Result + '1';
else
Result := Result + '0';
end;
// --------------------------------------------------------------------
// Bin to Int
// --------------------------------------------------------------------
function BinToInt(value: String): LongInt;
var
i, sz: Integer;
begin
Result := 0;
sz := Length(value);
for i := sz downto 1 do
if Copy(value, i, 1) = '1' then
Result := Result + (1 shl (sz - i));
end;
// --------------------------------------------------------------------
// Binary representation of float to integer
// --------------------------------------------------------------------
function FloatBinToInt(value: String): Real;
var
i, sz: Integer;
begin
Result := 0;
sz := Length(Value);
for i := sz downto 1 do
if Copy(value, i, 1) = '1' then
Result := Result + 1 / (1 shl i);
end;
// --------------------------------------------------------------------
// Hex to Bin
// --------------------------------------------------------------------
function HexToBin(h: String): String;
var
box: Array [0..15] of String;
i: Integer;
begin
box[0] := '0000';
box[1] := '0001';
box[2] := '0010';
box[3] := '0011';
box[4] := '0100';
box[5] := '0101';
box[6] := '0110';
box[7] := '0111';
box[8] := '1000';
box[9] := '1001';
box[10] := '1010';
box[11] := '1011';
box[12] := '1100';
box[13] := '1101';
box[14] := '1110';
box[15] := '1111';
for i := Length(h) downto 1 do
Result := box[StrToInt('$' + h[i])] + Result;
end;
// --------------------------------------------------------------------
// Hex to Float
// --------------------------------------------------------------------
function HexToFloat(s: String): Real;
var
e: Integer;
f: Real;
b: String;
begin
b := HexToBin(s);
e := BinToInt(Copy(b, 2,8)) - 127;
f := 1 + FloatBinToInt(Copy(b, 10, 23));
if Copy(b, 1,1) <> '0' then
Result := -Power(2, e) * f
else
Result := Power(2, e) * f;
end;
// --------------------------------------------------------------------
// zilav's hex array to string function
// --------------------------------------------------------------------
function HexToString(s: String): String;
var
c: Char;
i: Integer;
begin
Result := '';
i := 1;
while i < Length(s) do begin
if s <> ' ' then begin
c := Chr(StrToInt('$' + Copy(s, i, 2)));
if c = #0 then
exit;
Result := Result + c;
i := i + 3;
end else
i := i + 1;
end;
end;
end. | 31.186825 | 167 | 0.471 |
fc05ee1ea52772b9c191e2b9ac9445cff12f39d0 | 666 | dfm | Pascal | src/delphi/TConsoleUnit.dfm | ellotecnologia/log4delphi | 01e56d9a6c0b0edec4cb088657df7188e93f478c | [
"Apache-2.0"
]
| 1 | 2021-02-17T01:03:07.000Z | 2021-02-17T01:03:07.000Z | src/delphi/TConsoleUnit.dfm | ellotecnologia/log4delphi | 01e56d9a6c0b0edec4cb088657df7188e93f478c | [
"Apache-2.0"
]
| null | null | null | src/delphi/TConsoleUnit.dfm | ellotecnologia/log4delphi | 01e56d9a6c0b0edec4cb088657df7188e93f478c | [
"Apache-2.0"
]
| 2 | 2019-11-25T06:55:36.000Z | 2020-06-09T15:58:04.000Z | object TConsole: TTConsole
Left = 318
Top = 237
Width = 400
Height = 300
BorderStyle = bsSizeToolWin
Caption = 'Log4Delphi Console'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Memo1: TMemo
Left = 0
Top = 0
Width = 392
Height = 266
Align = alClient
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Andale Mono'
Font.Style = []
ParentFont = False
ScrollBars = ssBoth
TabOrder = 0
end
end
| 20.181818 | 32 | 0.648649 |
fc9be68a78925469978364a89a774162ee17dffa | 3,615 | pas | Pascal | units/udigamma.pas | BishopWolf/DelphiMath | bc03e918f2cbe6aad91e8153f5c7ae35abef75e2 | [
"Apache-2.0"
]
| 1 | 2019-11-20T02:18:47.000Z | 2019-11-20T02:18:47.000Z | units/udigamma.pas | BishopWolf/DelphiMath | bc03e918f2cbe6aad91e8153f5c7ae35abef75e2 | [
"Apache-2.0"
]
| null | null | null | units/udigamma.pas | BishopWolf/DelphiMath | bc03e918f2cbe6aad91e8153f5c7ae35abef75e2 | [
"Apache-2.0"
]
| 2 | 2017-05-14T03:56:55.000Z | 2019-11-20T02:18:48.000Z | { ******************************************************************
DiGamma and TriGamma functions.
Contributed by Philip Fletcher (FLETCHP@WESTAT.com)
****************************************************************** }
unit udigamma;
interface
uses
uConstants;
function DiGamma(X: Float): Float;
function TriGamma(X: Float): Float;
implementation
function DiGamma(X: Float): Float;
{ ------------------------------------------------------------------
Digamma calculates the Digamma or Psi function =
d ( LOG ( GAMMA ( X ) ) ) / dX
Reference:
J Bernardo,
Psi ( Digamma ) Function,
Algorithm AS 103,
Applied Statistics,
Volume 25, Number 3, pages 315-317, 1976.
Modified:
03 January 2000
Parameters:
Input, real X, the argument of the Digamma function.
0 < X.
Output, real Digamma, the value of the Digamma function at X.
------------------------------------------------------------------ }
const
c = 20;
d1 = -0.57721566490153286061; { DiGamma(1) }
s = 0.00001;
{ Sterling coefficient S(n) = B(n) / 2n
where B(n) = Bernoulli number }
const
S2 = 0.08333333333333333333; { B(2)/2 }
S4 = -0.83333333333333333333E-2; { B(4)/4 }
S6 = 0.39682539682539682541E-2; { B(6)/6 }
S8 = -0.41666666666666666666E-2; { B(8)/8 }
S10 = 0.75757575757575757576E-2; { B(10)/10 }
S12 = -0.21092796092796092796E-1; { B(12)/12 }
S14 = 0.83333333333333333335E-1; { B(14)/14 }
S16 = -0.44325980392156862745; { B(16)/16 }
var
dg, p, r, y: Float;
begin
if X <= 0.0 then
begin
DiGamma := DefaultVal(FSing, MaxNum);
Exit;
end;
SetErrCode(FOk);
if X = 1.0 then
begin
DiGamma := d1;
Exit;
end;
{ Use approximation if argument <= S }
if X <= s then
dg := d1 - 1.0 / X
else
{ Reduce the argument to dg(X + N) where (X + N) >= C }
begin
dg := 0.0;
y := X;
while y < c do
begin
dg := dg - 1.0 / y;
y := y + 1.0;
end;
{ Use Stirling's (actually de Moivre's) expansion if argument > C }
r := 1.0 / sqr(y);
p := (((((((S16 * r + S14) * r + S12) * r + S10) * r + S8) * r + S6) * r +
S4) * r + S2) * r;
dg := dg + ln(y) - 0.5 / y - p;
end;
DiGamma := dg;
end;
function TriGamma(X: Float): Float;
{ ------------------------------------------------------------------
Trigamma calculates the Trigamma or Psi Prime function =
d**2 ( LOG ( GAMMA ( X ) ) ) / dX**2
Reference:
Algorithm As121 Appl. Statist. (1978) vol 27, no. 1
******************************************************************** }
const
a = 1.0E-4;
b = 20;
zero = 0;
one = 1;
half = 0.5;
{ Bernoulli numbers }
const
B2 = 0.1666666666666667;
B4 = -3.333333333333333E-002;
B6 = 2.380952380952381E-002;
B8 = -3.333333333333333E-002;
B10 = 7.575757575757576E-002;
B12 = -0.2531135531135531;
var
y, z, Res: Float;
begin
if X <= 0.0 then
begin
TriGamma := DefaultVal(FSing, MaxNum);
Exit;
end;
SetErrCode(FOk);
Res := 0;
z := X;
if z <= a then { Use small value approximation }
begin
TriGamma := one / sqr(z);
Exit;
end;
while z < b do { Increase argument to (x+i) >= b }
begin
Res := Res + one / sqr(z);
z := z + one;
end;
{ Apply asymptotic formula where argument >= b }
y := one / sqr(z);
Res := Res + half * y +
(one + y * (B2 + y * (B4 + y * (B6 + y * (B8 + y * (B10 + y * B12)))))) / z;
TriGamma := Res;
end;
end.
| 21.140351 | 81 | 0.483264 |
47fdc6a658711fc869cd533eaf0c1b882e0bddad | 95,060 | pas | Pascal | Client/fSaleOrder.pas | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| null | null | null | Client/fSaleOrder.pas | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| null | null | null | Client/fSaleOrder.pas | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| 3 | 2021-06-30T10:11:17.000Z | 2021-07-01T09:13:29.000Z | unit fSaleOrder;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, fEditForm, DB, DBClient, AbmesClientDataSet, JvComponentBase,
JvCaptionButton, ActnList, StdCtrls, Buttons, ExtCtrls, AbmesFields,
JvExControls, JvComponent, JvDBLookup, Mask, DBCtrls, fBaseFrame, fDBFrame,
fFieldEditFrame, fDateFieldEditFrame, fPartnerFieldEditFrame,
fPartnerExFieldEditFrame, ToolWin, ComCtrls, fTreeNodeFieldEditFrame,
fProductFieldEditFrame, fProductFieldEditFrameBald, fEmployeeFieldEditFrame,
fEmployeeFieldEditFrameLabeled, fDeptFieldEditFrame, fDeptFieldEditFrameBald,
JvExMask, JvToolEdit, fDateIntervalFrame, uClientUtils, JvExStdCtrls,
JvDBCombobox, ParamDataSet, fProductExFieldEditFrame,
fStatusAbstract, fParRelProductStatus, uProducts, uClientTypes, dDocClient,
JvCombobox, uParRelProducts;
type
TfmSaleOrder= class(TEditForm)
cdsSaleDealTypes: TAbmesClientDataSet;
cdsSaleDealTypesSALE_DEAL_TYPE_CODE: TAbmesFloatField;
cdsSaleDealTypesSALE_DEAL_TYPE_NAME: TAbmesWideStringField;
cdsSaleDealTypesSALE_DEAL_TYPE_ABBREV: TAbmesWideStringField;
dsSaleDealTypes: TDataSource;
gbRequestSendAndRegisterDates: TGroupBox;
imgArrow1: TImage;
dbtRequestRegisterDateDiff: TDBText;
frRequestSendDate: TfrDateFieldEditFrame;
frRequestRegisterDate: TfrDateFieldEditFrame;
lblRequestSendDate: TLabel;
lblRequestRegisterDate: TLabel;
frClient: TfrPartnerExFieldEditFrame;
gbID: TGroupBox;
lblRequestBranch: TLabel;
lblRequestNo: TLabel;
lblRequestLineNo: TLabel;
lblClientRequestNo: TLabel;
lblAspectType: TLabel;
edtRequestBranch: TDBEdit;
edtRequestNo: TDBEdit;
edtRequestLineNo: TDBEdit;
cbAspectType: TJvDBLookupCombo;
edtClientRequestNo: TDBEdit;
gbDates: TGroupBox;
lblOfferSendPlanDate: TLabel;
lblOfferAnswerPlanDate: TLabel;
lblDecisionPlanDate: TLabel;
lblOfferSendDate: TLabel;
lblOfferAnswerDate: TLabel;
lblDecisionDate: TLabel;
lblOfferSendDateAxis1: TLabel;
lblOfferAnswerDateAxis1: TLabel;
lblDecisionDateAxis1: TLabel;
imgArrow2: TImage;
imgArrow4: TImage;
dbtOfferAnswerPlanDateDiff: TDBText;
dbtDecisionPlanDateDiff: TDBText;
imgArrow3: TImage;
dbtOfferAnswerDateDiff: TDBText;
imgArrow5: TImage;
dbtDecisionDateDiff: TDBText;
lblOfferSendDateAxis2: TLabel;
lblOfferAnswerDateAxis2: TLabel;
dbtOfferSendDateDeviation: TDBText;
dbtOfferAnswerDateDeviation: TDBText;
dbtDecisionDateDeviation: TDBText;
frOfferSendPlanDate: TfrDateFieldEditFrame;
frOfferSendDate: TfrDateFieldEditFrame;
frOfferAnswerPlanDate: TfrDateFieldEditFrame;
frOfferAnswerDate: TfrDateFieldEditFrame;
frDecisionPlanDate: TfrDateFieldEditFrame;
frDecisionDate: TfrDateFieldEditFrame;
lblDecisionDateAxis2: TLabel;
gbParRelProduct: TGroupBox;
btnParRelProduct: TButton;
frMediator: TfrPartnerFieldEditFrame;
gbDecision: TGroupBox;
cbDecisionType: TJvDBLookupCombo;
lblPlanPeriodDays: TLabel;
edtPlanPeriodDays: TDBEdit;
lblRealPeriodDays: TLabel;
edtRealPeriodDays: TDBEdit;
frDecisionEmployee: TfrEmployeeFieldEditFrameLabeled;
frManagerEmployee: TfrEmployeeFieldEditFrameLabeled;
pnlPrices: TPanel;
gbPricesSell: TGroupBox;
lblMarketPrice: TLabel;
edtMarketPrice: TDBEdit;
gbPricesLease: TGroupBox;
lblSaleLeaseSecondaryPrice: TLabel;
lblMinPrice2: TLabel;
lblMeasureAbbrev: TLabel;
lblSaleLeaseDateUnitCode: TLabel;
lblFor: TLabel;
edtSaleLeaseSecondaryPrice: TDBEdit;
edtMinPrice2: TDBEdit;
edtMeasureAbbrev: TDBEdit;
edtSaleLeaseDateUnitCode: TDBEdit;
lblMinPrice: TLabel;
edtMinPrice: TDBEdit;
gbReceiveConditions: TGroupBox;
frShipmentStore: TfrDeptFieldEditFrameBald;
lblShipmentStore: TLabel;
lblShipmentDays: TLabel;
edtShipmentDays: TDBEdit;
cdsCustomhouses: TAbmesClientDataSet;
cdsCustomhousesCUSTOMHOUSE_CODE: TAbmesFloatField;
cdsCustomhousesCUSTOMHOUSE_NAME: TAbmesWideStringField;
dsCustomhouses: TDataSource;
cdsShipmentTypes: TAbmesClientDataSet;
cdsShipmentTypesSHIPMENT_TYPE_CODE: TAbmesFloatField;
cdsShipmentTypesSHIPMENT_TYPE_ABBREV: TAbmesWideStringField;
cdsShipmentTypesSHIPMENT_TYPE_NAME: TAbmesWideStringField;
cdsShipmentTypesNOTES: TAbmesWideStringField;
dsShipmentTypes: TDataSource;
cdsBranches: TAbmesClientDataSet;
cdsBranchesBRANCH_CODE: TAbmesFloatField;
cdsBranchesBRANCH_NO: TAbmesFloatField;
cdsBranchesNAME: TAbmesWideStringField;
cdsBranchesBRANCH_IDENTIFIER: TAbmesWideStringField;
cdsBranchesBRANCH_CODE_AND_NAME: TAbmesWideStringField;
cdsBranchesIS_LOCAL_BRANCH: TAbmesFloatField;
cdsBranchesIS_INACTIVE: TAbmesFloatField;
dsBranches: TDataSource;
cdsData_REQUEST_BRANCH_IDENTIFIER: TAbmesWideStringField;
lblBaseCurrencyAbbrev: TLabel;
cdsDataSALE_OBJECT_BRANCH_CODE: TAbmesFloatField;
cdsDataSALE_OBJECT_CODE: TAbmesFloatField;
cdsDataSALE_GROUP_OBJECT_BRANCH_CODE: TAbmesFloatField;
cdsDataSALE_GROUP_OBJECT_CODE: TAbmesFloatField;
cdsDataSALE_ORDER_TYPE_CODE: TAbmesFloatField;
cdsDataREQUEST_BRANCH_CODE: TAbmesFloatField;
cdsDataREQUEST_NO: TAbmesFloatField;
cdsDataREQUEST_LINE_NO: TAbmesFloatField;
cdsDataCLIENT_COMPANY_CODE: TAbmesFloatField;
cdsDataCLIENT_REQUEST_NO: TAbmesWideStringField;
cdsDataREQUEST_SEND_DATE: TAbmesSQLTimeStampField;
cdsDataOFFER_SEND_PLAN_DATE: TAbmesSQLTimeStampField;
cdsDataREQUEST_REGISTER_DATE: TAbmesSQLTimeStampField;
cdsDataOFFER_SEND_DATE: TAbmesSQLTimeStampField;
cdsDataOFFER_ANSWER_PLAN_DATE: TAbmesSQLTimeStampField;
cdsDataOFFER_ANSWER_DATE: TAbmesSQLTimeStampField;
cdsDataDECISION_PLAN_DATE: TAbmesSQLTimeStampField;
cdsDataDECISION_DATE: TAbmesSQLTimeStampField;
cdsDataDECISION_TYPE_CODE: TAbmesFloatField;
cdsDataPRODUCT_CODE: TAbmesFloatField;
cdsDataPRODUCT_NAME: TAbmesWideStringField;
cdsDataPRODUCT_NO: TAbmesFloatField;
cdsDataPRODUCT_MEASURE_CODE: TAbmesFloatField;
cdsDataQUANTITY: TAbmesFloatField;
cdsDataOUR_OFFER_QUANTITY: TAbmesFloatField;
cdsDataCL_OFFER_QUANTITY: TAbmesFloatField;
cdsDataMANUFACTURE_QUANTITY: TAbmesFloatField;
cdsDataMANUFACTURE_DECISION_EXPECTED: TAbmesFloatField;
cdsDataSINGLE_WEIGHT: TAbmesFloatField;
cdsDataCURRENCY_CODE: TAbmesFloatField;
cdsDataSINGLE_PRICE: TAbmesFloatField;
cdsDataOUR_OFFER_SINGLE_PRICE: TAbmesFloatField;
cdsDataCL_OFFER_SINGLE_PRICE: TAbmesFloatField;
cdsDataRECEIVE_DATE: TAbmesSQLTimeStampField;
cdsDataCL_OFFER_RECEIVE_DATE: TAbmesSQLTimeStampField;
cdsDataOUR_OFFER_RECEIVE_DATE: TAbmesSQLTimeStampField;
cdsDataRECEIVE_PLACE_OFFICE_CODE: TAbmesFloatField;
cdsDataIS_VENDOR_TRANSPORT: TAbmesFloatField;
cdsDataSHIPMENT_TYPE_CODE: TAbmesFloatField;
cdsDataCUSTOMHOUSE_CODE: TAbmesFloatField;
cdsDataNOTES: TAbmesWideStringField;
cdsDataSALE_BRANCH_CODE: TAbmesFloatField;
cdsDataSALE_NO: TAbmesFloatField;
cdsDataSALE_TYPE_CODE: TAbmesFloatField;
cdsDataOKIDU_EMPLOYEE_CODE: TAbmesFloatField;
cdsDataSOS_OKIDU: TAbmesFloatField;
cdsDataSHIPMENT_DATE: TAbmesSQLTimeStampField;
cdsDataSHIPMENT_STORE_CODE: TAbmesFloatField;
cdsDataENTER_SH_STORE_PLAN_BEGIN_DATE: TAbmesSQLTimeStampField;
cdsDataENTER_SH_STORE_PLAN_END_DATE: TAbmesSQLTimeStampField;
cdsDataIS_ML_ENTRUSTED: TAbmesFloatField;
cdsDataIS_ML_NOT_NEEDED: TAbmesFloatField;
cdsDataANNUL_EMPLOYEE_CODE: TAbmesFloatField;
cdsDataANNUL_DATE: TAbmesSQLTimeStampField;
cdsDataANNUL_TIME: TAbmesSQLTimeStampField;
cdsDataFINISH_EMPLOYEE_CODE: TAbmesFloatField;
cdsDataFINISH_DATE: TAbmesSQLTimeStampField;
cdsDataFINISH_TIME: TAbmesSQLTimeStampField;
cdsDataCREATE_EMPLOYEE_CODE: TAbmesFloatField;
cdsDataCREATE_DATE: TAbmesSQLTimeStampField;
cdsDataCREATE_TIME: TAbmesSQLTimeStampField;
cdsDataCHANGE_EMPLOYEE_CODE: TAbmesFloatField;
cdsDataCHANGE_DATE: TAbmesSQLTimeStampField;
cdsDataCHANGE_TIME: TAbmesSQLTimeStampField;
cdsDataMANAGER_EMPLOYEE_CODE: TAbmesFloatField;
cdsDataDOC_BRANCH_CODE: TAbmesFloatField;
cdsDataDOC_CODE: TAbmesFloatField;
cdsDataTRANSIENT_STATUS_CODE: TAbmesFloatField;
cdsDataCLIENT_COUNTRY_ABBREV: TAbmesWideStringField;
cdsDataMODEL_DEVELOPMENT_TYPE_CODE: TAbmesFloatField;
cdsDataSALE_DEAL_TYPE_CODE: TAbmesFloatField;
cdsAspectTypes: TAbmesClientDataSet;
dsAspectTypes: TDataSource;
cdsAspectTypesASPECT_TYPE_CODE: TAbmesFloatField;
cdsAspectTypesASPECT_TYPE_ABBREV: TAbmesWideStringField;
cdsAspectTypesASPECT_TYPE_NAME: TAbmesWideStringField;
cdsData_REQUEST_REGISTER_DATE_DIFF: TAbmesFloatField;
cdsData_OFFER_SEND_PLAN_DATE_DIFF: TAbmesFloatField;
cdsData_OFFER_ANSWER_PLAN_DATE_DIFF: TAbmesFloatField;
cdsData_DECISION_PLAN_DATE_DIFF: TAbmesFloatField;
cdsData_OFFER_ANSWER_DATE_DIFF: TAbmesFloatField;
cdsData_DECISION_DATE_DIFF: TAbmesFloatField;
cdsData_DECISION_DATE_DEVIATION: TAbmesFloatField;
cdsData_OFFER_SEND_DATE_DEVIATION: TAbmesFloatField;
cdsData_OFFER_ANSWER_DATE_DEVIATION: TAbmesFloatField;
cdsDataACCOUNT_MEASURE_COEF: TAbmesFloatField;
cdsDataACCOUNT_QUANTITY: TAbmesFloatField;
cdsDataACCOUNT_OUR_OFFER_QUANTITY: TAbmesFloatField;
cdsDataACCOUNT_CL_OFFER_QUANTITY: TAbmesFloatField;
cdsDataPROGNOSIS_SALE_COUNT: TAbmesFloatField;
cdsDataREALIZATION_SALE_COUNT: TAbmesFloatField;
cdsDataASPECT_TYPE_CODE: TAbmesFloatField;
cdsCurrencies: TAbmesClientDataSet;
cdsCurrenciesCURRENCY_CODE: TAbmesFloatField;
cdsCurrenciesCURRENCY_ABBREV: TAbmesWideStringField;
cdsCurrenciesROUNDER: TAbmesFloatField;
cdsCurrenciesORDER_NO: TAbmesFloatField;
cdsSecondaryCurrencyRates: TAbmesClientDataSet;
cdsSecondaryCurrencyRatesCURRENCY_CODE: TAbmesFloatField;
cdsSecondaryCurrencyRatesRATE_DATE: TAbmesSQLTimeStampField;
cdsSecondaryCurrencyRatesFIXING: TAbmesFloatField;
cdsDataACCOUNT_MEASURE_CODE: TAbmesFloatField;
cdsMeasures: TAbmesClientDataSet;
cdsMeasuresMEASURE_CODE: TAbmesFloatField;
cdsMeasuresMEASURE_ABBREV: TAbmesWideStringField;
cdsMeasuresMEASURE_NAME: TAbmesWideStringField;
cdsData_MEASURE_ABBREV: TAbmesWideStringField;
cdsData_ACCOUNT_MEASURE_ABBREV: TAbmesWideStringField;
cdsData_SALE_TOTAL_PRICE: TAbmesFloatField;
cdsData_SALE_TOTAL_PRICE_SC: TAbmesFloatField;
cdsDataPROGNOSIS_BEGIN_DATE: TAbmesSQLTimeStampField;
cdsDataPROGNOSIS_END_DATE: TAbmesSQLTimeStampField;
cdsDecisionTypes: TAbmesClientDataSet;
cdsDecisionTypesDECISION_TYPE_CODE: TAbmesFloatField;
cdsDecisionTypesDECISION_TYPE_ABBREV: TAbmesWideStringField;
cdsDecisionTypesDECISION_TYPE_NAME: TAbmesWideStringField;
dsDecisionTypes: TDataSource;
cdsCompanyOffices: TAbmesClientDataSet;
cdsCompanyOfficesCOMPANY_CODE: TAbmesFloatField;
cdsCompanyOfficesOFFICE_CODE: TAbmesFloatField;
cdsCompanyOfficesOFFICE_NAME: TAbmesWideStringField;
dsCompanyOffices: TDataSource;
cdsData_RECEIVE_PLACE_OFFICE_NAME: TAbmesWideStringField;
cdsDataCOMMON_STATUS_CODE: TAbmesFloatField;
cdsDataCL_OFFER_CURRENCY_CODE: TAbmesFloatField;
cdsDataOUR_OFFER_CURRENCY_CODE: TAbmesFloatField;
cdsDataOUR_OFFER_LEASE_DATE_UNIT_QTY: TAbmesFloatField;
cdsDataOUR_OFFER_LEASE_DATE_UNIT_CODE: TAbmesFloatField;
cdsDataCL_OFFER_LEASE_DATE_UNIT_QTY: TAbmesFloatField;
cdsDataCL_OFFER_LEASE_DATE_UNIT_CODE: TAbmesFloatField;
cdsDataLEASE_DATE_UNIT_QTY: TAbmesFloatField;
cdsDataLEASE_DATE_UNIT_CODE: TAbmesFloatField;
cdsDateUnits: TAbmesClientDataSet;
cdsDateUnitsTHE_DATE_UNIT_CODE: TAbmesFloatField;
cdsDateUnitsTHE_DATE_UNIT_NAME: TAbmesWideStringField;
dsDateUnits: TDataSource;
cdsData_OUR_OFFER_CURRENCY_ABBREV: TAbmesWideStringField;
cdsData_CL_OFFER_CURRENCY_ABBREV: TAbmesWideStringField;
cdsData_OUR_OFFER_TOTAL_LEASE_QUANTITY: TAbmesFloatField;
cdsData_CL_OFFER_TOTAL_LEASE_QUANTITY: TAbmesFloatField;
cdsData_TOTAL_LEASE_QUANTITY: TAbmesFloatField;
cdsPriorities: TAbmesClientDataSet;
dsPriorities: TDataSource;
cdsPrioritiesPRIORITY_CODE: TAbmesFloatField;
cdsPrioritiesPRIORITY_NO: TAbmesFloatField;
cdsPrioritiesPRIORITY_NAME: TAbmesWideStringField;
cdsPrioritiesPRIORITY_COLOR: TAbmesFloatField;
cdsPrioritiesPRIORITY_BACKGROUND_COLOR: TAbmesFloatField;
dsSaleTypes: TDataSource;
cdsSaleTypes: TAbmesClientDataSet;
cdsSaleTypesSALE_TYPE_CODE: TAbmesFloatField;
cdsSaleTypesSALE_TYPE_ABBREV: TAbmesWideStringField;
cdsSaleTypesSALE_TYPE_NAME: TAbmesWideStringField;
cdsDataRETURN_DATE: TAbmesSQLTimeStampField;
cdsDataCL_OFFER_RETURN_DATE: TAbmesSQLTimeStampField;
actFinish: TAction;
actAnnul: TAction;
pnlFinishButton: TPanel;
pnlAnnulButton: TPanel;
btnFinish: TBitBtn;
btnAnnul: TBitBtn;
pnlAnnuled: TPanel;
chkAnnuled: TCheckBox;
pnlFinished: TPanel;
chkFinished: TCheckBox;
pnlDialog: TPanel;
gbPlanDialogSale: TGroupBox;
gbPlanDialogLease: TGroupBox;
gbRealDialogSale: TGroupBox;
gbRealDialogLease: TGroupBox;
gbReceiveDate: TGroupBox;
gbQuantity: TGroupBox;
lblReceiveDate: TLabel;
lblReceiveDateClientOffered: TLabel;
frReceiveDate: TfrDateFieldEditFrame;
frReceiveDateClientOffered: TfrDateFieldEditFrame;
lblQuantity: TLabel;
lblAccountQuantity: TLabel;
edtQuantity: TDBEdit;
edtAccountQuantity: TDBEdit;
gbPlanShipmentDate: TGroupBox;
frShipmentDate: TfrDateFieldEditFrame;
gbPrices: TGroupBox;
gbSale: TGroupBox;
dbtMeasure: TDBText;
dbtAccountMeasure: TDBText;
edtSinglePrice: TDBEdit;
lblSinglePrice: TLabel;
cbCurrency: TJvDBLookupCombo;
lblCurrency: TLabel;
lblTotalPrice2: TLabel;
edtTotalPrice: TDBEdit;
dbtCurrency: TDBText;
edtTotalPriceSC: TDBEdit;
lblSecondaryCurrencyAbbrev4: TLabel;
lblSaleDealType2: TLabel;
cbSaleDealType2: TJvDBLookupCombo;
lblSaleBranch: TLabel;
cbSaleBranch: TJvDBLookupCombo;
lblSaleNo: TLabel;
edtSaleNo: TDBEdit;
cbSaleTypeCode: TJvDBLookupCombo;
lblSaleTypeCode: TLabel;
lblPriority: TLabel;
cbPriority: TJvDBLookupCombo;
gbLeaseDates: TGroupBox;
lblLeaseDatesInterval: TLabel;
lblLeaseDatesIntervalClientOffered: TLabel;
frLeaseDatesInterval: TfrDateIntervalFrame;
frLeaseDatesIntervalClientOffered: TfrDateIntervalFrame;
gbContractedLeaseConditions: TGroupBox;
lblLeaseDateUnitQty: TLabel;
edtLeaseDateUnitQty: TDBEdit;
lblFor2: TLabel;
lblDateUnit: TLabel;
cbDateUnit: TJvDBLookupCombo;
lblTotalLeaseQuantity: TLabel;
edtTotalLeaseQuantity: TDBEdit;
gbContractedPrices: TGroupBox;
lblSinglePrice2: TLabel;
lblCurrency2: TLabel;
lblTotalPrice: TLabel;
dbtCurrency2: TDBText;
lblSecondaryCurrencyAbbrev5: TLabel;
edtSinglePrice2: TDBEdit;
cbCurrency2: TJvDBLookupCombo;
edtTotalPrice2: TDBEdit;
edtTotalPriceSC2: TDBEdit;
gbSaleShipmentDate: TGroupBox;
frShipmentDate2: TfrDateFieldEditFrame;
gbImportDate: TGroupBox;
frImportDate: TfrDateFieldEditFrame;
gbSale2: TGroupBox;
lblSaleDealType3: TLabel;
lblSaleBranch2: TLabel;
lblSaleNo2: TLabel;
lblSaleTypeCode2: TLabel;
lblPriority2: TLabel;
cbSaleDealType3: TJvDBLookupCombo;
cbSaleBranch2: TJvDBLookupCombo;
edtSaleNo2: TDBEdit;
cbSaleTypeCode2: TJvDBLookupCombo;
cbPriority2: TJvDBLookupCombo;
lblPrognosisInterval: TLabel;
frPrognosis: TfrDateIntervalFrame;
frPrognosis2: TfrDateIntervalFrame;
lblPrognosisInterval2: TLabel;
gbQuantitiesAndPrices: TGroupBox;
lblOfferQuantity: TLabel;
lblOfferAccountQuantity: TLabel;
edtOurOfferQuantity: TDBEdit;
edtClientOfferQuantity: TDBEdit;
edtQuantity3: TDBEdit;
edtOurOfferAccountQuantity: TDBEdit;
edtClientOfferAccountQuantity: TDBEdit;
edtAccountQuantity3: TDBEdit;
lblOfferSinglePrice: TLabel;
edtOurOfferSinglePrice: TDBEdit;
edtClientOfferSinglePrice: TDBEdit;
edtSinglePrice3: TDBEdit;
lblOfferCurrency: TLabel;
cbOurOfferCurrency: TJvDBLookupCombo;
cbClientOfferCurrency: TJvDBLookupCombo;
cbCurrency3: TJvDBLookupCombo;
gbTotalPrices: TGroupBox;
edtTotalPrice3: TDBEdit;
dbtCurrency3: TDBText;
edtTotalPriceSC3: TDBEdit;
lblSecondaryCurrencyAbbrev6: TLabel;
dbtMeasure3: TDBText;
dbtMeasure4: TDBText;
dbtMeasure5: TDBText;
dbtAccountMeasure2: TDBText;
dbtAccountMeasure3: TDBText;
dbtAccountMeasure4: TDBText;
lblOurOffer: TLabel;
lblClientOffer: TLabel;
lblCoherence: TLabel;
gbQuantitiesAndPrices2: TGroupBox;
lblOfferLeaseDateUnitQty: TLabel;
lblOfferSinglePrice2: TLabel;
lblOfferCurrency2: TLabel;
lblOurOffer2: TLabel;
lblClientOffer2: TLabel;
lblCoherence2: TLabel;
edtOurOfferLeaseDateUnitQty: TDBEdit;
edtClientOfferLeaseDateUnitQty: TDBEdit;
edtLeaseDateUnitQty2: TDBEdit;
edtOurOfferSinglePrice2: TDBEdit;
edtClientOfferSinglePrice2: TDBEdit;
edtSinglePrice4: TDBEdit;
cbOurOfferCurrency2: TJvDBLookupCombo;
cbClientOfferCurrency2: TJvDBLookupCombo;
cbCurrency4: TJvDBLookupCombo;
gbTotalPrices2: TGroupBox;
dbtCurrency4: TDBText;
lblSecondaryCurrencyAbbrev7: TLabel;
edtTotalPrice4: TDBEdit;
edtTotalPriceSC4: TDBEdit;
lblOfferLeaseDateUnit: TLabel;
lblOfferTotalLeaseQuantity: TLabel;
cbLeaseDateUnit: TJvDBLookupCombo;
edtTotalLeaseQuantity2: TDBEdit;
cbClientOfferLeaseDateUnit: TJvDBLookupCombo;
edtClientOfferTotalLeaseQuantity: TDBEdit;
cbOurOfferLeaseDateUnit: TJvDBLookupCombo;
edtOurOfferTotalLeaseQuantity: TDBEdit;
cdsDataIMPORT_DATE: TAbmesSQLTimeStampField;
cdsCompanyOfficesCOUNTRY_CODE: TAbmesFloatField;
cdsCountries: TAbmesClientDataSet;
cdsCountriesCOUNTRY_CODE: TAbmesFloatField;
cdsCountriesCOUNTRY_ABBREV: TAbmesWideStringField;
cdsCountriesCOUNTRY_NAME: TAbmesWideStringField;
cdsCompanyOffices_COUNTRY_NAME: TAbmesWideStringField;
cdsData_PLAN_PERIOD_DAYS: TAbmesFloatField;
cdsData_REAL_PERIOD_DAYS: TAbmesFloatField;
cdsDataSHIPMENT_DAYS: TAbmesFloatField;
pnlAccountPricesButton: TPanel;
btnSinglePrice: TSpeedButton;
btnAccountSinglePrice: TSpeedButton;
lblSlash7: TLabel;
lblCaption: TLabel;
lblMeasureAbbrev2: TLabel;
edtMeasureAbbrev2: TDBEdit;
cdsDataCLIENT_COMPANY_NAME: TAbmesWideStringField;
cdsData_CURRENCY_ABBREV: TAbmesWideStringField;
dsCurrencies: TDataSource;
actDocumentation: TAction;
tbDocButton: TToolBar;
btnDocs: TToolButton;
cdsData_COUNTRY_NAME: TAbmesWideStringField;
cdsDataSS_COUNT: TAbmesFloatField;
cdsData_SALE_BRANCH_IDENTIFIER: TAbmesWideStringField;
cdsData_STATUS_CODE: TAbmesFloatField;
lblStatus: TLabel;
edtStatus: TDBEdit;
cdsDataHAS_DOC_ITEMS: TAbmesFloatField;
cdsDataSRG_DOC_BRANCH_CODE: TAbmesFloatField;
cdsDataSRG_DOC_CODE: TAbmesFloatField;
cdsDataSRG_HAS_DOC_ITEMS: TAbmesFloatField;
actSRGDoc: TAction;
cdsData_SALE_DEAL_TYPE_ABBREV: TAbmesWideStringField;
cdsSaleOrderProductInfo: TAbmesClientDataSet;
cdsSaleOrderProductInfoSPEC_STATE_CODE: TAbmesFloatField;
dbtMarketPriceCurrencyAbbrev: TDBText;
dsSaleOrderProductInfo: TDataSource;
lblBaseCurrencyAbbrev2: TLabel;
dbtMarketPriceCurrencyAbbrev2: TDBText;
cdsSaleOrderProductInfo_SALE_LEASE_DATE_UNIT_NAME: TAbmesWideStringField;
cdsSaleOrderProductInfo_MARKET_PRICE_CURRENCY_ABBREV: TAbmesWideStringField;
cdsSaleOrderProductInfoMARKET_PRICE: TAbmesFloatField;
cdsSaleOrderProductInfoMARKET_PRICE_CURRENCY_CODE: TAbmesFloatField;
cdsSaleOrderProductInfoSALE_LEASE_PRICE: TAbmesFloatField;
cdsSaleOrderProductInfoSALE_LEASE_DATE_UNIT_CODE: TAbmesFloatField;
cdsSaleOrderProductInfoACC_MARKET_PRICE: TAbmesFloatField;
cdsSaleOrderProductInfoACC_SALE_LEASE_PRICE: TAbmesFloatField;
cdsSaleOrderProductInfoPRODUCT_PRIORITY_NO: TAbmesFloatField;
cdsSaleOrderProductInfoPRODUCT_PRIORITY_COLOR: TAbmesFloatField;
cdsSaleOrderProductInfoPRODUCT_PRIORITY_BK_COLOR: TAbmesFloatField;
cdsDataSALE_PRIORITY_CODE: TAbmesFloatField;
cdsDataCLIENT_PRIORITY_CODE: TAbmesFloatField;
cdsDataDECISION_EMPLOYEE_CODE: TAbmesFloatField;
lblSaleDealTypeAbbrev: TLabel;
edtSaleDealTypeAbbrev: TDBEdit;
lblRequestInitiator: TLabel;
edtRequestInitiator: TDBEdit;
lblSaleCount: TLabel;
lblRealizationSaleCount: TLabel;
lblPrognosisSaleCount: TLabel;
edtRealizationSaleCount: TDBEdit;
edtPrognosisSaleCount: TDBEdit;
actExceptEvents: TAction;
cdsSaleRequestGroup: TAbmesClientDataSet;
cdsSaleRequestGroupREQUEST_BRANCH_CODE: TAbmesFloatField;
cdsSaleRequestGroupREQUEST_NO: TAbmesFloatField;
cdsSaleRequestGroupSALE_ORDER_TYPE_CODE: TAbmesFloatField;
cdsSaleRequestGroupSALE_DEAL_TYPE_CODE: TAbmesFloatField;
cdsSaleRequestGroupDOC_BRANCH_CODE: TAbmesFloatField;
cdsSaleRequestGroupDOC_CODE: TAbmesFloatField;
cdsSaleRequestGroupHAS_DOC_ITEMS: TAbmesFloatField;
cdsSaleRequestGroupSTREAM_TYPE_CODE: TAbmesFloatField;
dsSaleRequestGroup: TDataSource;
btnSale: TButton;
gbDelivery: TGroupBox;
lblDCDBranch: TLabel;
cbDCDBranch: TJvDBLookupCombo;
lblDCDCode: TLabel;
edtDCDCode: TDBEdit;
btnDelivery: TButton;
lblDeliveryProjectCode: TLabel;
edtDeliveryProjectCode: TDBEdit;
cdsDataDELIVERY_OBJECT_BRANCH_CODE: TAbmesFloatField;
cdsDataDELIVERY_OBJECT_CODE: TAbmesFloatField;
cdsDataDCD_BRANCH_CODE: TAbmesFloatField;
cdsDataDCD_CODE: TAbmesFloatField;
cdsDataDELIVERY_PROJECT_CODE: TAbmesFloatField;
actSale: TAction;
actDelivery: TAction;
cdsDeliveryID: TAbmesClientDataSet;
btnSale2: TButton;
pdsDeliveryID: TParamDataSet;
pdsDeliveryIDDCD_BRANCH_CODE: TAbmesFloatField;
pdsDeliveryIDDCD_CODE: TAbmesFloatField;
pdsDeliveryIDDELIVERY_PROJECT_CODE: TAbmesFloatField;
dsDeliveryID: TDataSource;
cdsDataDCD_OBJECT_BRANCH_CODE: TAbmesFloatField;
cdsDataDCD_OBJECT_CODE: TAbmesFloatField;
cdsDeliveryIDDELIVERY_OBJECT_BRANCH_CODE: TAbmesFloatField;
cdsDeliveryIDDELIVERY_OBJECT_CODE: TAbmesFloatField;
cdsDeliveryIDDCD_OBJECT_BRANCH_CODE: TAbmesFloatField;
cdsDeliveryIDDCD_OBJECT_CODE: TAbmesFloatField;
cdsDeliveryIDDELIVERY_PROJECT_CODE: TAbmesFloatField;
pnlExceptEvents: TPanel;
btnExceptEvents: TButton;
frProduct: TfrProductExFieldEditFrame;
cdsDataACCOUNT_SINGLE_PRICE: TAbmesFloatField;
cdsDataACCOUNT_OUR_OFFER_SINGLE_PRICE: TAbmesFloatField;
cdsDataACCOUNT_CL_OFFER_SINGLE_PRICE: TAbmesFloatField;
lblSlash: TLabel;
dbtDisplayMeasure: TDBText;
lblSlash2: TLabel;
dbtDisplayMeasure2: TDBText;
lblSlash3: TLabel;
dbtDisplayMeasure3: TDBText;
lblSlash4: TLabel;
dbtDisplayMeasure4: TDBText;
lblSlash5: TLabel;
dbtDisplayMeasure5: TDBText;
lblSlash6: TLabel;
dbtDisplayMeasure6: TDBText;
lblSlash8: TLabel;
dbtDisplayMeasure7: TDBText;
lblSlash9: TLabel;
dbtDisplayMeasure8: TDBText;
pnlLeaseRealization: TPanel;
pnlLeaseRealizationWork: TPanel;
lblQuantity2: TLabel;
edtQuantity2: TDBEdit;
dbtMeasure2: TDBText;
pnlLeaseRealizationAccount: TPanel;
lblAccountQuantity2: TLabel;
dbtAccountMeasure5: TDBText;
edtAccountQuantity2: TDBEdit;
pnlLeaseEstimation: TPanel;
pnlLeaseEstimationWork: TPanel;
lblOfferQuantity2: TLabel;
dbtMeasure6: TDBText;
dbtMeasure7: TDBText;
dbtMeasure8: TDBText;
edtOurOfferQuantity2: TDBEdit;
edtClientOfferQuantity2: TDBEdit;
edtQuantity4: TDBEdit;
pnlLeaseEstimationAccount: TPanel;
lblAccountQuantity3: TLabel;
dbtAccountMeasure6: TDBText;
dbtAccountMeasure7: TDBText;
dbtAccountMeasure8: TDBText;
edtAccountOurOfferQuantity: TDBEdit;
edtAccountClientOfferQuantity: TDBEdit;
edtAccountQuantity4: TDBEdit;
cdsSaleOrderDefaults: TAbmesClientDataSet;
cdsSaleOrderDefaultsPARTNER_CODE: TAbmesFloatField;
cdsSaleOrderDefaultsPARTNER_OFFICE_CODE: TAbmesFloatField;
cdsSaleOrderDefaultsTRANSPORT_DURATION_DAYS: TAbmesFloatField;
cdsSaleOrderDefaultsSHIPMENT_TYPE_CODE: TAbmesFloatField;
cdsSaleOrderDefaultsIS_PARTNER_TRANSPORT: TAbmesFloatField;
cdsSaleOrderDefaultsCUSTOMHOUSE_CODE: TAbmesFloatField;
cdsSaleOrderDefaultsSTORE_CODE: TAbmesFloatField;
cdsSaleOrderDefaultsPRICE: TAbmesFloatField;
cdsSaleOrderDefaultsCURRENCY_CODE: TAbmesFloatField;
cdsSaleOrderDefaultsLEASE_DATE_UNIT_CODE: TAbmesFloatField;
cdsSaleDealTypesOBTAINMENT_TYPE_CODE: TAbmesFloatField;
cdsDataOBTAINMENT_TYPE_CODE: TAbmesFloatField;
frParRelProductStatus: TfrParRelProductStatus;
cdsDataBORDER_REL_TYPE_CODE: TAbmesFloatField;
cdsDataPARTNER_CODE: TAbmesFloatField;
actParRelProduct: TAction;
tlbParRelProductDocs: TToolBar;
btnParRelProductDocs: TToolButton;
actParRelProductDoc: TAction;
cdsSaleOrderProductInfoPRP_DOC_BRANCH_CODE: TAbmesFloatField;
cdsSaleOrderProductInfoPRP_DOC_CODE: TAbmesFloatField;
cdsSaleOrderProductInfoPRP_HAS_DOC: TAbmesFloatField;
lblStreamTypeAbbrev: TLabel;
edtStreamTypeAbbrev: TDBEdit;
cdsSaleRequestGroupSTREAM_TYPE_ABBREV: TAbmesWideStringField;
actNotes: TAction;
pnlNotes: TPanel;
btnNotes: TBitBtn;
cdsSaleRequestGroupMEDIATOR_COMPANY_CODE: TAbmesFloatField;
cdsSaleRequestGroupIS_ACTIVATED_BY_CLIENT: TAbmesFloatField;
cdsDecisionTypesDECISION_TYPE_NO: TAbmesFloatField;
cdsDecisionTypesALLOWS_SALE: TAbmesFloatField;
cdsDecisionTypesIS_ESTIMATION_BOUND: TAbmesFloatField;
cdsDecisionTypesIS_REALIZATION_BOUND: TAbmesFloatField;
cdsData_ALLOWS_SALE: TAbmesFloatField;
cdsDataFO_EXEC_DEPT_CODE: TAbmesFloatField;
cdsDataFO_PRIORITY_CODE: TAbmesFloatField;
cdsDataFO_WORK_FINANCIAL_PRODUCT_CODE: TAbmesFloatField;
cdsDataSPEC_FIN_MODEL_CODE: TAbmesFloatField;
cdsDecisionTypesREQUIRES_FINISHING: TAbmesFloatField;
cdsData_DECISION_TYPE_REQUIRES: TAbmesFloatField;
cdsDataUNFINISHED_SRG_SALE_COUNT: TAbmesFloatField;
cdsSaleRequestGroupPRODUCT_CLASS_CODE: TAbmesFloatField;
cdsDataMIN_BASE_PRICE: TAbmesFloatField;
cdsDataACCOUNT_MIN_BASE_PRICE: TAbmesFloatField;
cdsSaleOrderProductInfoSALE_LEASE_CURRENCY_CODE: TAbmesFloatField;
cdsSaleOrderProductInfo_SALE_LEASE_CURRENCY_ABBREV: TAbmesWideStringField;
tlbRequestDoc: TToolBar;
btnRequestDoc: TToolButton;
actRequestDoc: TAction;
actAcuirePrice: TAction;
pnlAcquirePriceButton: TPanel;
btnAcquirePrice: TSpeedButton;
actLeasePrice: TAction;
pnlLeasePriceButton: TPanel;
btnLeasePrice: TSpeedButton;
pnlReceiveConditionsNormal: TPanel;
lblReceivePlaceOfficeName: TLabel;
lblCountry: TLabel;
lblCustomhouse: TLabel;
lblShipmentType: TLabel;
lblTransportBy: TLabel;
cbReceivePlaceOfficeName: TJvDBLookupCombo;
edtCountry: TDBEdit;
cbCustomhouse: TJvDBLookupCombo;
cbShipmentType: TJvDBLookupCombo;
cbTransportBy: TJvDBComboBox;
cdsDataFO_BRANCH_CODE: TAbmesFloatField;
cdsDataFO_IS_COMPLETED: TAbmesFloatField;
cdsDataFO_CLOSE_REQUESTED: TAbmesFloatField;
cdsDataFIN_ORDER_CODE: TAbmesFloatField;
cdsDataFO_STATUS_CODE: TAbmesFloatField;
pnlIsDeliveryRequired: TPanel;
chkIsDeliveryRequired: TCheckBox;
actIsDeliveryRequired: TAction;
cdsDataFO_PARTNER_CODE: TAbmesFloatField;
cdsDataSSH_DOC_BRANCH_CODE: TAbmesFloatField;
cdsDataSSH_DOC_CODE: TAbmesFloatField;
procedure cdsDataDECISION_DATEChange(Sender: TField);
procedure cdsDataCalcFields(DataSet: TDataSet);
procedure actFormUpdate(Sender: TObject);
procedure cdsDataCLIENT_COMPANY_CODEChange(Sender: TField);
procedure cdsDataPRODUCT_CODEChange(Sender: TField);
procedure FormCreate(Sender: TObject);
procedure cdsDataNewRecord(DataSet: TDataSet);
procedure cdsDataCOMMON_STATUS_CODEGetText(Sender: TField; var Text: string;
DisplayText: Boolean);
procedure cdsDataBeforePost(DataSet: TDataSet);
procedure DatesOnValidate(Sender: TField);
procedure cdsDataSALE_BRANCH_CODEChange(Sender: TField);
procedure actFinishExecute(Sender: TObject);
procedure actFinishUpdate(Sender: TObject);
procedure actAnnulExecute(Sender: TObject);
procedure actAnnulUpdate(Sender: TObject);
procedure cdsDataCURRENCY_CODEChange(Sender: TField);
procedure actDocumentationExecute(Sender: TObject);
procedure cdsDataBeforeApplyUpdates(Sender: TObject;
var OwnerData: OleVariant);
procedure cdsDataAfterOpen(DataSet: TDataSet);
procedure cdsDataAfterApplyUpdates(Sender: TObject;
var OwnerData: OleVariant);
procedure actApplyUpdatesExecute(Sender: TObject);
procedure cdsData_STATUS_CODEGetText(Sender: TField; var Text: string;
DisplayText: Boolean);
procedure cdsSaleOrderProductInfoSPEC_STATE_CODEGetText(Sender: TField;
var Text: string; DisplayText: Boolean);
procedure cdsDataQUANTITYChange(Sender: TField);
procedure cdsDataACCOUNT_QUANTITYChange(Sender: TField);
procedure cdsDataOUR_OFFER_QUANTITYChange(Sender: TField);
procedure cdsDataACCOUNT_OUR_OFFER_QUANTITYChange(Sender: TField);
procedure cdsDataACCOUNT_CL_OFFER_QUANTITYChange(Sender: TField);
procedure cdsDataCL_OFFER_QUANTITYChange(Sender: TField);
procedure FormShow(Sender: TObject);
procedure actExceptEventsUpdate(Sender: TObject);
procedure actExceptEventsExecute(Sender: TObject);
procedure cdsDataBeforeOpen(DataSet: TDataSet);
procedure cdsDataAfterClose(DataSet: TDataSet);
procedure cbDCDBranchExit(Sender: TObject);
procedure edtDCDCodeExit(Sender: TObject);
procedure edtDeliveryProjectCodeExit(Sender: TObject);
procedure actDeliveryUpdate(Sender: TObject);
procedure actDeliveryExecute(Sender: TObject);
procedure actSaleExecute(Sender: TObject);
procedure actSaleUpdate(Sender: TObject);
procedure cdsDataSINGLE_PRICEChange(Sender: TField);
procedure cdsDataOUR_OFFER_SINGLE_PRICEChange(Sender: TField);
procedure cdsDataCL_OFFER_SINGLE_PRICEChange(Sender: TField);
procedure cdsDataACCOUNT_SINGLE_PRICEChange(Sender: TField);
procedure cdsDataACCOUNT_OUR_OFFER_SINGLE_PRICEChange(Sender: TField);
procedure cdsDataACCOUNT_CL_OFFER_SINGLE_PRICEChange(Sender: TField);
procedure cdsDataRECEIVE_DATEChange(Sender: TField);
procedure cdsDataASPECT_TYPE_CODEChange(Sender: TField);
procedure actParRelProductExecute(Sender: TObject);
procedure actParRelProductUpdate(Sender: TObject);
procedure actParRelProductDocExecute(Sender: TObject);
procedure actNotesExecute(Sender: TObject);
procedure cdsDataACCOUNT_MIN_BASE_PRICEChange(Sender: TField);
procedure cdsDataMIN_BASE_PRICEChange(Sender: TField);
procedure actRequestDocUpdate(Sender: TObject);
procedure actRequestDocExecute(Sender: TObject);
procedure actAcuirePriceExecute(Sender: TObject);
procedure actLeasePriceExecute(Sender: TObject);
procedure actAcuirePriceUpdate(Sender: TObject);
procedure actLeasePriceUpdate(Sender: TObject);
procedure actIsDeliveryRequiredExecute(Sender: TObject);
procedure actNotesUpdate(Sender: TObject);
private
FProductClass: TProductClass;
FOriginalFormCaption: string;
FOldCurrencyCode: Variant;
FOldSaleTotalPrice: Variant;
FOldSaleTotalPriceSC: Variant;
FQuantity: Double;
FShipmentDate: TDateTime;
FImportDate: TDateTime;
FReceiveDate: TDateTime;
FReturnDate: TDateTime;
FOlddmDocClientOnDataChanged: TNotifyEvent;
FCalculatingQuantity: Boolean;
FPricesChanging: Boolean;
FHasSaleOnOpen: Boolean;
FParRelProductExists: Boolean;
FHadSaleNo: Boolean;
FInitialFinOrderCode: Integer;
FFinalFinOrderCode: Integer;
procedure OpenSecondaryCurrencyRates;
procedure OpenCompanyOffices;
procedure ValidateDates;
procedure SetupReadOnly;
procedure dmDocClientOnDataChanged(Sender: TObject);
procedure CheckSomeRequiredFields;
procedure CheckAllRequiredFields;
procedure OpenSaleOrderProductInfo;
procedure LoadDeliveryID;
procedure LoadDefaults;
procedure CalcParRelProductExists;
procedure SetupDecisionTypesFilter;
procedure ShowProductPartnerPrice(AObtainmentType: TObtainmentType);
procedure PriceActionUpate(ASender: TObject);
protected
function GetOriginalFormCaption: string; override;
class function CanUseDocs: Boolean; override;
procedure OpenDataSets; override;
procedure CloseDataSets; override;
procedure SetDBFrameReadOnly(AFrame: TDBFrame); override;
procedure DoApplyUpdates; override;
function IsQuantityField(const AField: TAbmesFloatField): Boolean; override;
public
procedure Initialize; override;
procedure Finalize; override;
class function CanEditOuterDataSet: Boolean; override;
procedure SetDataParams(
AdmDocClient: TdmDocClient = nil;
ADataSet: TDataSet = nil;
AEditMode: TEditMode = emEdit;
ADefaultsOrigin: TDefaultsOrigin = doNone;
AProductClass: TProductClass = pcNone); reintroduce; virtual;
class function ShowForm(
AdmDocClient: TdmDocClient = nil;
ADataSet: TDataSet = nil;
AEditMode: TEditMode = emEdit;
ADefaultsOrigin: TDefaultsOrigin = doNone;
AProductClass: TProductClass = pcNone): Boolean;
procedure ReleaseForm; override;
end;
implementation
uses
uCompanyKinds, fTreeSelectForm, dMain, uUtils, uTreeClientUtils,
uCompanyClientUtils, Math, uSaleOrderTypes, uProductClientUtils, AbmesDialogs,
fBaseForm, uBorderRelTypes, fProductPeriods, uUserActivityConsts,
uSaleDealTypes, uDocClientUtils, dBaseDataModule, uDocUtils, uSalesClientUtils,
uColorConsts, uModelUtils, uAspectTypes, uStreamTypes, fDelivery, fSale,
fParRelProduct, fNotes, uProductionOrderTypes, fNewFinOrder,
uFinOrderRequirementClientUtils, fMain, uExceptEventClientUtils,
fExceptEvents, uClientDateTime, uComboBoxUtils, fProductPartnerPrice,
uFinanceClientUtils, fFinOrder;
{$R *.dfm}
resourcestring
SWrongDatesErrorMessage = ' трябва да е по-късна или равна на ';
SPriceMustBePositive = 'Договорената единична цена трябва да бъде положителна';
SConfirmFinish = 'Потвърдете Приключване на ОДК';
SConfirmAnnul = 'Потвърдете Анулиране на ОДК';
SCheckSaleShipments =
'По ОПП %s/%d съществува повече от едно разклонение.' +
'Количеството на първото разклонение е изравнено с текущото количество по ОДК. Моля, поправете разклоненията по този ОПП.';
SCheckLeaseShipments =
'По ОПП %s/%d съществува повече от едно разклонение.' +
'Датите на първото разклонение са изравнени с текущите по ОДК. Моля, поправете разклоненията по този ОПП.';
SSaleOrderSaved = 'ОДК е записан под номер %s/%d/%d';
SDeliveryNotFound = 'Не е намерен ОПД с тази идентификация';
SImportDateMustNotBeLessThanEndOfLeaseInterval = 'План. дата за Врщ. не трябва да е по-ранна от края на Договорен ВрмИнт на Наем';
SFinOrderRequired = 'За да създадете ОПП, трябва да създадете и ОПФ!';
SFinishingRequired = 'Решението изисква да приключите ОДК!';
SConfirmLastSaleRequestFinish =
'Приключвате последен Обособен Диалог в рамките на Пакет Диалози с Клиент, който също ще бъде приключен!';
procedure TfmSaleOrder.Finalize;
begin
inherited;
dmDocClient.OnDataChanged:= FOlddmDocClientOnDataChanged;
end;
procedure TfmSaleOrder.FormCreate(Sender: TObject);
begin
inherited;
frRequestSendDate.FieldNames:= 'REQUEST_SEND_DATE';
frRequestRegisterDate.FieldNames:= 'REQUEST_REGISTER_DATE';
frOfferSendPlanDate.FieldNames:= 'OFFER_SEND_PLAN_DATE';
frOfferSendDate.FieldNames:= 'OFFER_SEND_DATE';
frOfferAnswerPlanDate.FieldNames:= 'OFFER_ANSWER_PLAN_DATE';
frOfferAnswerDate.FieldNames:= 'OFFER_ANSWER_DATE';
frDecisionPlanDate.FieldNames:= 'DECISION_PLAN_DATE';
frDecisionDate.FieldNames:= 'DECISION_DATE';
frReceiveDateClientOffered.FieldNames:= 'CL_OFFER_RECEIVE_DATE';
frReceiveDate.FieldNames:= 'RECEIVE_DATE';
frPrognosis.FieldNames:= 'PROGNOSIS_BEGIN_DATE;PROGNOSIS_END_DATE';
frPrognosis2.FieldNames:= 'PROGNOSIS_BEGIN_DATE;PROGNOSIS_END_DATE';
frClient.FieldNames:= 'CLIENT_COMPANY_CODE';
frClient.CountryVisible:= True;
frClient.ParRelButtonVisible:= True;
frMediator.FieldNames:= 'MEDIATOR_COMPANY_CODE';
frShipmentStore.FieldNames:= 'SHIPMENT_STORE_CODE';
frDecisionEmployee.FieldNames:= 'DECISION_EMPLOYEE_CODE';
frManagerEmployee.FieldNames:= 'MANAGER_EMPLOYEE_CODE';
frLeaseDatesInterval.FieldNames:= 'RECEIVE_DATE;RETURN_DATE';
frLeaseDatesIntervalClientOffered.FieldNames:= 'CL_OFFER_RECEIVE_DATE;CL_OFFER_RETURN_DATE';
frShipmentDate.FieldNames:= 'SHIPMENT_DATE';
frShipmentDate2.FieldNames:= 'SHIPMENT_DATE';
frImportDate.FieldNames:= 'IMPORT_DATE';
frProduct.FieldNames:= 'PRODUCT_CODE;CLIENT_COMPANY_CODE';
frProduct.TreeDetailSelection:= tdsInstance;
frProduct.SpecStateVisible:= False;
frProduct.PriorityVisible:= False;
frProduct.MeasureVisible:= False;
frProduct.AccountMeasureVisible:= False;
frProduct.CommonStatusVisible:= False;
frProduct.ProductOriginVisible:= False;
frProduct.NotesVisible:= False;
frProduct.ProductPeriodsButtonVisible:= True;
lblBaseCurrencyAbbrev.Caption:= LoginContext.BaseCurrencyAbbrev;
lblBaseCurrencyAbbrev2.Caption:= LoginContext.BaseCurrencyAbbrev;
lblSecondaryCurrencyAbbrev4.Caption:= LoginContext.SecondaryCurrencyAbbrev;
lblSecondaryCurrencyAbbrev5.Caption:= LoginContext.SecondaryCurrencyAbbrev;
lblSecondaryCurrencyAbbrev6.Caption:= LoginContext.SecondaryCurrencyAbbrev;
lblSecondaryCurrencyAbbrev7.Caption:= LoginContext.SecondaryCurrencyAbbrev;
RegisterFieldsTextVisibility(
IsSalePriceVisible,
[ cdsData_OUR_OFFER_CURRENCY_ABBREV,
cdsData_CL_OFFER_CURRENCY_ABBREV,
cdsData_SALE_TOTAL_PRICE,
cdsData_SALE_TOTAL_PRICE_SC,
cdsDataSINGLE_PRICE,
cdsDataOUR_OFFER_SINGLE_PRICE,
cdsDataCL_OFFER_SINGLE_PRICE,
cdsData_CURRENCY_ABBREV,
cdsDataACCOUNT_SINGLE_PRICE,
cdsDataACCOUNT_OUR_OFFER_SINGLE_PRICE,
cdsDataACCOUNT_CL_OFFER_SINGLE_PRICE,
cdsDataMIN_BASE_PRICE,
cdsDataACCOUNT_MIN_BASE_PRICE,
cdsSaleOrderProductInfoMARKET_PRICE,
cdsSaleOrderProductInfoACC_MARKET_PRICE,
cdsSaleOrderProductInfoSALE_LEASE_PRICE,
cdsSaleOrderProductInfoACC_SALE_LEASE_PRICE,
cdsSaleOrderProductInfo_MARKET_PRICE_CURRENCY_ABBREV,
cdsSaleOrderProductInfo_SALE_LEASE_CURRENCY_ABBREV]);
end;
procedure TfmSaleOrder.FormShow(Sender: TObject);
begin
inherited;
actForm.Update;
CalcParRelProductExists;
end;
function TfmSaleOrder.GetOriginalFormCaption: string;
begin
Result:= FOriginalFormCaption;
end;
procedure TfmSaleOrder.Initialize;
var
MsgParams: TStrings;
begin
inherited;
FOlddmDocClientOnDataChanged:= dmDocClient.OnDataChanged;
dmDocClient.OnDataChanged:= dmDocClientOnDataChanged;
frProduct.ProductClass:= FProductClass;
frProduct.PartnerProductNamesVisible:= (FProductClass = pcNormal);
frShipmentStore.SelectStore:= (FProductClass = pcNormal);
frShipmentStore.SelectFinancialStore:= (FProductClass = pcFinancial);
MsgParams:= uProductClientUtils.CreateCommonMsgParams(LoginContext, FProductClass);
try
RecursivelyFormatCaptions(Self, MsgParams);
finally
FreeAndNil(MsgParams);
end;
MsgParams:=
uParRelProducts.CreateCommonMsgParams(
LoginContext,
FProductClass,
brtClient,
pobtSaleCover,
prpoProduct,
prpkQuantity,
prpspikNone,
prpdikNone,
False);
try
RecursivelyFormatCaptions(Self, MsgParams);
finally
FreeAndNil(MsgParams);
end;
FOriginalFormCaption:= actForm.Caption;
FHadSaleNo:= not cdsDataSALE_NO.IsNull;
frProduct.PartnerCode:= cdsDataCLIENT_COMPANY_CODE.AsInteger;
actIsDeliveryRequired.Checked:= (EditMode = emInsert) or not cdsDataDCD_OBJECT_BRANCH_CODE.IsNull;
FInitialFinOrderCode:= cdsDataFIN_ORDER_CODE.AsInteger;
if (EditMode = emInsert) then
dmDocClient.DSInitDoc(dotSale, cdsData);
end;
function TfmSaleOrder.IsQuantityField(const AField: TAbmesFloatField): Boolean;
begin
Result:= False;
end;
procedure TfmSaleOrder.LoadDefaults;
begin
if (cdsDataASPECT_TYPE_CODE.AsInteger <> AspectTypeToInt(atRealization)) then
Exit;
SetParams(cdsSaleOrderDefaults.Params, cdsData);
cdsSaleOrderDefaults.TempOpen/
procedure begin
if cdsSaleOrderDefaults.IsEmpty then
Exit;
if not cdsSaleOrderDefaultsPRICE.IsNull then
cdsDataSINGLE_PRICE.AsFloat:= RealRoundTo(cdsSaleOrderDefaultsPRICE.AsFloat, -2)
else
cdsDataSINGLE_PRICE.IfIsNullAssign(cdsSaleOrderDefaultsPRICE);
cdsDataCURRENCY_CODE.IfIsNullAssign(cdsSaleOrderDefaultsCURRENCY_CODE);
if (cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtLease) then
cdsDataLEASE_DATE_UNIT_CODE.IfIsNullAssign(cdsSaleOrderDefaultsLEASE_DATE_UNIT_CODE);
cdsDataRECEIVE_PLACE_OFFICE_CODE.Assign(cdsSaleOrderDefaultsPARTNER_OFFICE_CODE);
cdsDataSHIPMENT_STORE_CODE.Assign(cdsSaleOrderDefaultsSTORE_CODE);
cdsDataSHIPMENT_DAYS.Assign(cdsSaleOrderDefaultsTRANSPORT_DURATION_DAYS);
cdsDataSHIPMENT_TYPE_CODE.Assign(cdsSaleOrderDefaultsSHIPMENT_TYPE_CODE);
cdsDataIS_VENDOR_TRANSPORT.AsBoolean:= not cdsSaleOrderDefaultsIS_PARTNER_TRANSPORT.AsBoolean;
cdsDataCUSTOMHOUSE_CODE.Assign(cdsSaleOrderDefaultsCUSTOMHOUSE_CODE);
end;
end;
procedure TfmSaleOrder.LoadDeliveryID;
begin
if cdsData.ReadOnly or not cdsDataANNUL_EMPLOYEE_CODE.IsNull or not cdsDataFINISH_EMPLOYEE_CODE.IsNull then
Exit;
if not pdsDeliveryIDDCD_BRANCH_CODE.IsNull and
not pdsDeliveryIDDCD_CODE.IsNull and
not pdsDeliveryIDDELIVERY_PROJECT_CODE.IsNull then
begin
pdsDeliveryID.Post;
cdsDeliveryID.Open;
try
if cdsDeliveryID.BOF and cdsDeliveryID.EOF then
begin
CheckEditMode(cdsData);
cdsDataDELIVERY_OBJECT_BRANCH_CODE.Clear;
cdsDataDELIVERY_OBJECT_CODE.Clear;
CheckEditMode(pdsDeliveryID);
pdsDeliveryIDDCD_BRANCH_CODE.Clear;
pdsDeliveryIDDCD_CODE.Clear;
pdsDeliveryIDDELIVERY_PROJECT_CODE.Clear;
raise Exception.Create(SDeliveryNotFound);
end;
if (cdsDeliveryID.RecordCount > 1) then
raise Exception.Create('internal error in TfmSaleOrder.LoadDeliveryID');
CheckEditMode(cdsData);
AssignFields(cdsDeliveryId, cdsData);
finally
cdsDeliveryID.Close;
CheckEditMode(pdsDeliveryID);
end;
end;
end;
procedure TfmSaleOrder.OpenCompanyOffices;
begin
with cdsCompanyOffices do
begin
Close;
Params.ParamByName('COMPANY_CODE').Value:=
cdsDataCLIENT_COMPANY_CODE.AsVariant;
Open;
end;
end;
procedure TfmSaleOrder.OpenDataSets;
begin
cdsSaleDealTypes.Open;
cdsBranches.Open;
cdsAspectTypes.Open;
cdsCurrencies.Open;
cdsDateUnits.Open;
cdsCustomhouses.Open;
cdsShipmentTypes.Open;
cdsSaleTypes.Open;
cdsPriorities.Open;
cdsCountries.Open;
inherited;
cdsDecisionTypes.Open;
SetupDecisionTypesFilter;
OpenCompanyOffices;
OpenSecondaryCurrencyRates;
OpenSaleOrderProductInfo;
pdsDeliveryID.Open;
CheckEditMode(pdsDeliveryID);
AssignFields(cdsData, pdsDeliveryID);
// force calc fields
cdsData.First;
if (cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtExport) then
frClient.PriorityCompanyKind:= ckVendor
else
frClient.PriorityCompanyKind:= ckClient;
end;
procedure TfmSaleOrder.OpenSaleOrderProductInfo;
begin
with cdsSaleOrderProductInfo do
begin
if Active then
Close;
SetParams(Params, cdsData);
// workaround. ne bitriabvalo da stava 0, ama pri produkt 311110002 stava. de da znam zashto
if (Params.ParamByName('CURRENCY_CODE').AsInteger = 0) then
Params.ParamByName('CURRENCY_CODE').Clear;
Params.ParamByName('TO_DATE').Value:= cdsDataRECEIVE_DATE.AsVariant;
Open;
end;
end;
procedure TfmSaleOrder.OpenSecondaryCurrencyRates;
begin
with cdsSecondaryCurrencyRates do
begin
Close;
if cdsDataDECISION_DATE.IsNull then
Params.ParamByName('RATE_DATE').AsDateTime:= ContextDate
else
Params.ParamByName('RATE_DATE').AsDateTime:= cdsDataDECISION_DATE.AsDateTime;
Open;
end;
end;
procedure TfmSaleOrder.PriceActionUpate(ASender: TObject);
begin
(ASender as TAction).Enabled:=
(not cdsDataPRODUCT_CODE.IsNull) and
(not cdsDataCLIENT_COMPANY_CODE.IsNull) and
(not cdsDataRECEIVE_DATE.IsNull);
end;
procedure TfmSaleOrder.ReleaseForm;
var
FinOrderCode: Integer;
begin
if IsDataModified and
(FFinalFinOrderCode <> FInitialFinOrderCode) then
FinOrderCode:= FFinalFinOrderCode
else
FinOrderCode:= 0;
inherited;
if (FinOrderCode > 0) and
dmMain.LoginContext.OpenNewFinOrder and
dmMain.LoginContext.HasUserActivity(uaRealFinancialModelEdit) then
TfmFinOrder.ShowModel(FinOrderCode, emEdit);
end;
procedure TfmSaleOrder.SetDataParams(AdmDocClient: TdmDocClient;
ADataSet: TDataSet; AEditMode: TEditMode; ADefaultsOrigin: TDefaultsOrigin;
AProductClass: TProductClass);
begin
inherited SetDataParams(AdmDocClient, ADataSet, AEditMode, ADefaultsOrigin);
FProductClass:= AProductClass;
end;
procedure TfmSaleOrder.SetDBFrameReadOnly(AFrame: TDBFrame);
begin
if (AFrame = frRequestSendDate) or
(AFrame = frRequestRegisterDate) or
(AFrame = frClient) or
(AFrame = frMediator) or
(AFrame = frParRelProductStatus) then
AFrame.ReadOnly:= True
else
begin
if not cdsDataANNUL_EMPLOYEE_CODE.IsNull or not cdsDataFINISH_EMPLOYEE_CODE.IsNull then
AFrame.ReadOnly:= True
else
inherited;
end;
end;
procedure TfmSaleOrder.SetupReadOnly;
var
AReadOnly: Boolean;
begin
AReadOnly:= not cdsDataANNUL_EMPLOYEE_CODE.IsNull or not cdsDataFINISH_EMPLOYEE_CODE.IsNull;
SetControlReadOnly(
AReadOnly or not cdsDataSALE_BRANCH_CODE.IsNull or (cdsSaleRequestGroupSTREAM_TYPE_CODE.AsInteger = stReverse),
cbAspectType);
SetControlsReadOnly(
AReadOnly or not actIsDeliveryRequired.Checked,
[cbDCDBranch, edtDCDCode, edtDeliveryProjectCode]);
SetControlsReadOnly(AReadOnly or FHasSaleOnOpen, [cbSaleBranch, cbSaleBranch2]);
SetControlsReadOnly(AReadOnly or cdsDataSALE_BRANCH_CODE.IsNull, [cbPriority, cbPriority2]);
SetControlsReadOnly(AReadOnly, [
edtClientRequestNo,
edtMinPrice,
edtMinPrice2,
edtAccountQuantity,
edtAccountQuantity3,
edtOurOfferAccountQuantity,
edtClientOfferAccountQuantity,
edtQuantity,
edtQuantity2,
edtQuantity3,
edtQuantity4,
edtLeaseDateUnitQty,
cbDateUnit,
cbSaleTypeCode,
cbSaleTypeCode2,
edtOurOfferQuantity,
edtOurOfferQuantity2,
edtClientOfferQuantity,
edtClientOfferQuantity2,
edtOurOfferLeaseDateUnitQty,
edtClientOfferLeaseDateUnitQty,
edtLeaseDateUnitQty,
edtLeaseDateUnitQty2,
edtOurOfferSinglePrice,
edtOurOfferSinglePrice2,
edtClientOfferSinglePrice,
edtClientOfferSinglePrice2,
cbOurOfferCurrency,
cbOurOfferCurrency2,
cbClientOfferCurrency,
cbClientOfferCurrency2,
cbDecisionType,
edtShipmentDays,
cbReceivePlaceOfficeName,
cbCustomhouse,
cbShipmentType,
ReplacedDBComboBox(cbTransportBy)]
);
SetControlsReadOnly(
AReadOnly or not LoginContext.HasUserActivity(uaEditSalePrice), [
edtSinglePrice,
edtSinglePrice2,
edtSinglePrice3,
edtSinglePrice4,
cbCurrency,
cbCurrency2,
cbCurrency3,
cbCurrency4]
);
end;
class function TfmSaleOrder.ShowForm(AdmDocClient: TdmDocClient;
ADataSet: TDataSet; AEditMode: TEditMode; ADefaultsOrigin: TDefaultsOrigin;
AProductClass: TProductClass): Boolean;
var
f: TfmSaleOrder;
begin
f:= CreateEx;
try
f.SetDataParams(AdmDocClient, ADataSet, AEditMode, ADefaultsOrigin, AProductClass);
f.InternalShowForm;
Result:= f.IsDataModified;
finally
f.ReleaseForm;
end;
end;
procedure TfmSaleOrder.ShowProductPartnerPrice(
AObtainmentType: TObtainmentType);
begin
TfmProductPartnerPrice.ShowForm(dmDocClient, nil, emReadOnly, doNone,
cdsDataPRODUCT_CODE.AsInteger,
cdsDataCLIENT_COMPANY_CODE.AsInteger,
brtClient,
AObtainmentType,
cdsDataRECEIVE_DATE.AsDateTime);
end;
procedure TfmSaleOrder.ValidateDates;
begin
if (not cdsDataOFFER_SEND_PLAN_DATE.IsNull) and
(cdsDataREQUEST_REGISTER_DATE.AsDateTime > cdsDataOFFER_SEND_PLAN_DATE.AsDateTime) then
raise Exception.Create(cdsDataOFFER_SEND_PLAN_DATE.DisplayLabel +
SWrongDatesErrorMessage + cdsDataREQUEST_REGISTER_DATE.DisplayLabel);
if (not cdsDataOFFER_ANSWER_PLAN_DATE.IsNull) and
(cdsDataOFFER_SEND_PLAN_DATE.AsDateTime > cdsDataOFFER_ANSWER_PLAN_DATE.AsDateTime) then
raise Exception.Create(cdsDataOFFER_ANSWER_PLAN_DATE.DisplayLabel +
SWrongDatesErrorMessage + cdsDataOFFER_SEND_PLAN_DATE.DisplayLabel);
if (not cdsDataDECISION_PLAN_DATE.IsNull) and
(cdsDataOFFER_ANSWER_PLAN_DATE.AsDateTime > cdsDataDECISION_PLAN_DATE.AsDateTime) then
raise Exception.Create(cdsDataDECISION_PLAN_DATE.DisplayLabel +
SWrongDatesErrorMessage + cdsDataOFFER_ANSWER_PLAN_DATE.DisplayLabel);
if (not cdsDataOFFER_ANSWER_DATE.IsNull) and
(cdsDataOFFER_SEND_DATE.AsDateTime > cdsDataOFFER_ANSWER_DATE.AsDateTime) then
raise Exception.Create(cdsDataOFFER_ANSWER_DATE.DisplayLabel +
SWrongDatesErrorMessage + cdsDataOFFER_SEND_DATE.DisplayLabel);
if (not cdsDataDECISION_DATE.IsNull) and
(cdsDataOFFER_ANSWER_DATE.AsDateTime > cdsDataDECISION_DATE.AsDateTime) then
raise Exception.Create(cdsDataDECISION_DATE.DisplayLabel +
SWrongDatesErrorMessage + cdsDataOFFER_ANSWER_DATE.DisplayLabel);
end;
procedure TfmSaleOrder.actAcuirePriceUpdate(Sender: TObject);
begin
inherited;
PriceActionUpate(Sender);
end;
procedure TfmSaleOrder.actAnnulExecute(Sender: TObject);
begin
inherited;
CheckAllRequiredFields;
CheckSomeRequiredFields;
if (MessageDlgEx(SConfirmAnnul, mtConfirmation, [mbOK, mbCancel], 0) = mrOk) then
begin
CheckEditMode(cdsData);
cdsDataANNUL_EMPLOYEE_CODE.AsInteger:= LoginContext.UserCode;
end;
end;
procedure TfmSaleOrder.actAnnulUpdate(Sender: TObject);
begin
inherited;
pnlAnnulButton.Visible:=
(EditMode <> emReadOnly) and
cdsDataANNUL_EMPLOYEE_CODE.IsNull;
end;
procedure TfmSaleOrder.actApplyUpdatesExecute(Sender: TObject);
var
RequestLineNo: Integer;
begin
RequestLineNo:= cdsDataREQUEST_LINE_NO.AsInteger;
inherited;
if (RequestLineNo <> cdsDataREQUEST_LINE_NO.AsInteger) then
MessageDlgEx(
Format(SSaleOrderSaved, [cdsData_REQUEST_BRANCH_IDENTIFIER.AsString, cdsDataREQUEST_NO.AsInteger, cdsDataREQUEST_LINE_NO.AsInteger]),
mtInformation,
[mbOk],
0
);
end;
procedure TfmSaleOrder.actExceptEventsExecute(Sender: TObject);
var
em: TEditMode;
begin
inherited;
LoginContext.CheckUserActivity(uaExceptEvents);
if LoginContext.HasUserActivity(uaExceptEventsEdit) and (EditMode = emEdit) then
em:= emEdit
else
em:= emReadOnly;
TfmExceptEvents.ShowExceptEventsForGenerator(em, eegtSales, cdsData);
end;
procedure TfmSaleOrder.actExceptEventsUpdate(Sender: TObject);
begin
inherited;
(Sender as TAction).Enabled:=
(EditMode <> emInsert) and
(not (cdsData.State in dsEditModes)) and
(cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtSale) and
(cdsSaleRequestGroupSTREAM_TYPE_CODE.AsInteger = stReverse) and
(IntToProductClass(cdsSaleRequestGroupPRODUCT_CLASS_CODE.AsInteger) = pcNormal);
end;
procedure TfmSaleOrder.actDeliveryExecute(Sender: TObject);
begin
inherited;
TfmDelivery.ShowForm(nil, cdsData, emReadOnly);
end;
procedure TfmSaleOrder.actDeliveryUpdate(Sender: TObject);
begin
inherited;
(Sender as TAction).Enabled:= not cdsDataDELIVERY_OBJECT_BRANCH_CODE.IsNull;
end;
procedure TfmSaleOrder.actDocumentationExecute(Sender: TObject);
var
em: TEditMode;
begin
inherited;
em:= EditMode;
if not cdsDataANNUL_EMPLOYEE_CODE.IsNull or
not cdsDataFINISH_EMPLOYEE_CODE.IsNull then
em:= emReadOnly;
dmDocClient.DSOpenDoc(em, (Sender as TAction).ActionComponent as TControl, dotSale, cdsData);
end;
procedure TfmSaleOrder.actFinishExecute(Sender: TObject);
var
ConfirmMsg: string;
begin
inherited;
CheckAllRequiredFields;
CheckSomeRequiredFields;
ConfirmMsg:= SConfirmFinish;
if (cdsDataUNFINISHED_SRG_SALE_COUNT.AsInteger = 1) then
ConfirmMsg:= SConfirmLastSaleRequestFinish + SLineBreak + ConfirmMsg;
if (MessageDlgEx(ConfirmMsg, mtConfirmation, mbOkCancel, 0) <> mrOk) then
Abort;
if cdsDataFO_IS_COMPLETED.AsBoolean then
begin
ConfirmAction(SConfirmFinOrderClose);
CheckEditMode(cdsData);
cdsDataFO_CLOSE_REQUESTED.AsBoolean:= True;
end
else
CheckClosingWithFinOrder(cdsDataFO_STATUS_CODE.AsInteger);
CheckEditMode(cdsData);
cdsDataFINISH_EMPLOYEE_CODE.AsInteger:= LoginContext.UserCode;
end;
procedure TfmSaleOrder.actFinishUpdate(Sender: TObject);
begin
inherited;
pnlFinishButton.Visible:=
(EditMode <> emReadOnly) and
cdsDataANNUL_EMPLOYEE_CODE.IsNull and
cdsDataFINISH_EMPLOYEE_CODE.IsNull;
end;
procedure TfmSaleOrder.actFormUpdate(Sender: TObject);
const
DeviationWidth = 3;
DeviationColors: array [-1..1] of TColor = (clRed, clBlue, clGreen);
begin
inherited;
if cdsData_STATUS_CODE.IsNull then
edtStatus.Color:= clBtnFace
else
edtStatus.Color:= SaleOrderStatusColors[cdsData_STATUS_CODE.AsInteger];
gbPlanDialogSale.Visible:=
(cdsDataSALE_DEAL_TYPE_CODE.AsInteger in [sdtSale, sdtExport]) and (cdsDataASPECT_TYPE_CODE.AsInteger = AspectTypeToInt(atEstimation));
gbPlanDialogLease.Visible:=
(cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtLease) and (cdsDataASPECT_TYPE_CODE.AsInteger = AspectTypeToInt(atEstimation));
gbRealDialogSale.Visible:=
(cdsDataSALE_DEAL_TYPE_CODE.AsInteger in [sdtSale, sdtExport]) and (cdsDataASPECT_TYPE_CODE.AsInteger = AspectTypeToInt(atRealization));
gbRealDialogLease.Visible:=
(cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtLease) and (cdsDataASPECT_TYPE_CODE.AsInteger = AspectTypeToInt(atRealization));
gbPricesSell.Visible:= (cdsDataSALE_DEAL_TYPE_CODE.AsInteger in [sdtSale, sdtExport]);
gbPricesLease.Visible:= (cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtLease);
gbSale.Visible:= not cdsDataDECISION_TYPE_CODE.IsNull and cdsData_ALLOWS_SALE.AsBoolean;
gbSale2.Visible:= gbSale.Visible;
gbDelivery.Visible:= (cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtExport);
pnlIsDeliveryRequired.Visible:= (cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtExport);
with cdsData_OFFER_SEND_DATE_DEVIATION do
if IsNull then
begin
lblOfferSendDateAxis1.Visible:= False;
lblOfferSendDateAxis2.Visible:= False;
dbtOfferSendDateDeviation.Visible:= False;
frOfferSendDate.Left:= frOfferSendPlanDate.Left;
end
else
begin
lblOfferSendDateAxis1.Visible:= True;
lblOfferSendDateAxis1.Left:= Max(frOfferSendPlanDate.Left, frOfferSendDate.Left);
lblOfferSendDateAxis2.Visible:= True;
lblOfferSendDateAxis2.Left:= Min(frOfferSendPlanDate.Left, frOfferSendDate.Left) + frOfferSendPlanDate.Width - 2;
dbtOfferSendDateDeviation.Visible:= True;
dbtOfferSendDateDeviation.Left:= lblOfferSendDateAxis1.Left + 2;
dbtOfferSendDateDeviation.Font.Color:= DeviationColors[Sign(AsInteger)];
frOfferSendDate.Left:= frOfferSendPlanDate.Left - Sign(AsInteger)*DeviationWidth;
end;
lblOfferSendDate.Left:= frOfferSendDate.Left;
with cdsData_OFFER_ANSWER_DATE_DEVIATION do
if IsNull then
begin
lblOfferAnswerDateAxis1.Visible:= False;
lblOfferAnswerDateAxis2.Visible:= False;
dbtOfferAnswerDateDeviation.Visible:= False;
frOfferAnswerDate.Left:= frOfferAnswerPlanDate.Left;
end
else
begin
lblOfferAnswerDateAxis1.Visible:= True;
lblOfferAnswerDateAxis1.Left:= Max(frOfferAnswerPlanDate.Left, frOfferAnswerDate.Left);
lblOfferAnswerDateAxis2.Visible:= True;
lblOfferAnswerDateAxis2.Left:= Min(frOfferAnswerPlanDate.Left, frOfferAnswerDate.Left) + frOfferAnswerPlanDate.Width - 2;
dbtOfferAnswerDateDeviation.Visible:= True;
dbtOfferAnswerDateDeviation.Left:= lblOfferAnswerDateAxis1.Left + 2;
dbtOfferAnswerDateDeviation.Font.Color:= DeviationColors[Sign(AsInteger)];
frOfferAnswerDate.Left:= frOfferAnswerPlanDate.Left - Sign(AsInteger)*DeviationWidth;
end;
lblOfferAnswerDate.Left:= frOfferAnswerDate.Left;
with cdsData_DECISION_DATE_DEVIATION do
if IsNull then
begin
lblDecisionDateAxis1.Visible:= False;
lblDecisionDateAxis2.Visible:= False;
dbtDecisionDateDeviation.Visible:= False;
frDecisionDate.Left:= frDecisionPlanDate.Left;
end
else
begin
lblDecisionDateAxis1.Visible:= True;
lblDecisionDateAxis1.Left:= Max(frDecisionPlanDate.Left, frDecisionDate.Left);
lblDecisionDateAxis2.Visible:= True;
lblDecisionDateAxis2.Left:= Min(frDecisionPlanDate.Left, frDecisionDate.Left) + frDecisionPlanDate.Width - 2;
dbtDecisionDateDeviation.Visible:= True;
dbtDecisionDateDeviation.Left:= lblDecisionDateAxis1.Left + 2;
dbtDecisionDateDeviation.Font.Color:= DeviationColors[Sign(AsInteger)];
frDecisionDate.Left:= frDecisionPlanDate.Left - Sign(AsInteger)*DeviationWidth;
end;
lblDecisionDate.Left:= frDecisionDate.Left;
pnlFinished.Visible:= not cdsDataFINISH_EMPLOYEE_CODE.IsNull;
pnlAnnuled.Visible:= not cdsDataANNUL_EMPLOYEE_CODE.IsNull;
if btnSinglePrice.Down then
begin
edtSaleLeaseSecondaryPrice.DataField:= 'SALE_LEASE_PRICE';
edtMeasureAbbrev.DataField:= '_MEASURE_ABBREV';
edtMeasureAbbrev2.DataField:= '_MEASURE_ABBREV';
edtMarketPrice.DataField:= 'MARKET_PRICE';
edtSinglePrice.DataField:= 'SINGLE_PRICE';
edtSinglePrice2.DataField:= 'SINGLE_PRICE';
edtSinglePrice3.DataField:= 'SINGLE_PRICE';
edtSinglePrice4.DataField:= 'SINGLE_PRICE';
dbtDisplayMeasure.DataField:= '_MEASURE_ABBREV';
dbtDisplayMeasure2.DataField:= '_MEASURE_ABBREV';
dbtDisplayMeasure3.DataField:= '_MEASURE_ABBREV';
dbtDisplayMeasure4.DataField:= '_MEASURE_ABBREV';
dbtDisplayMeasure5.DataField:= '_MEASURE_ABBREV';
dbtDisplayMeasure6.DataField:= '_MEASURE_ABBREV';
dbtDisplayMeasure7.DataField:= '_MEASURE_ABBREV';
dbtDisplayMeasure8.DataField:= '_MEASURE_ABBREV';
edtOurOfferSinglePrice.DataField:= 'OUR_OFFER_SINGLE_PRICE';
edtOurOfferSinglePrice2.DataField:= 'OUR_OFFER_SINGLE_PRICE';
edtClientOfferSinglePrice.DataField:= 'CL_OFFER_SINGLE_PRICE';
edtClientOfferSinglePrice2.DataField:= 'CL_OFFER_SINGLE_PRICE';
edtMinPrice.DataField:= 'MIN_BASE_PRICE';
edtMinPrice2.DataField:= 'MIN_BASE_PRICE';
end
else
begin
edtSaleLeaseSecondaryPrice.DataField:= 'ACC_SALE_LEASE_PRICE';
edtMeasureAbbrev.DataField:= '_ACCOUNT_MEASURE_ABBREV';
edtMeasureAbbrev2.DataField:= '_ACCOUNT_MEASURE_ABBREV';
edtMarketPrice.DataField:= 'ACC_MARKET_PRICE';
edtSinglePrice.DataField:= 'ACCOUNT_SINGLE_PRICE';
edtSinglePrice2.DataField:= 'ACCOUNT_SINGLE_PRICE';
edtSinglePrice3.DataField:= 'ACCOUNT_SINGLE_PRICE';
edtSinglePrice4.DataField:= 'ACCOUNT_SINGLE_PRICE';
dbtDisplayMeasure.DataField:= '_ACCOUNT_MEASURE_ABBREV';
dbtDisplayMeasure2.DataField:= '_ACCOUNT_MEASURE_ABBREV';
dbtDisplayMeasure3.DataField:= '_ACCOUNT_MEASURE_ABBREV';
dbtDisplayMeasure4.DataField:= '_ACCOUNT_MEASURE_ABBREV';
dbtDisplayMeasure5.DataField:= '_ACCOUNT_MEASURE_ABBREV';
dbtDisplayMeasure6.DataField:= '_ACCOUNT_MEASURE_ABBREV';
dbtDisplayMeasure7.DataField:= '_ACCOUNT_MEASURE_ABBREV';
dbtDisplayMeasure8.DataField:= '_ACCOUNT_MEASURE_ABBREV';
edtOurOfferSinglePrice.DataField:= 'ACCOUNT_OUR_OFFER_SINGLE_PRICE';
edtOurOfferSinglePrice2.DataField:= 'ACCOUNT_OUR_OFFER_SINGLE_PRICE';
edtClientOfferSinglePrice.DataField:= 'ACCOUNT_CL_OFFER_SINGLE_PRICE';
edtClientOfferSinglePrice2.DataField:= 'ACCOUNT_CL_OFFER_SINGLE_PRICE';
edtMinPrice.DataField:= 'ACCOUNT_MIN_BASE_PRICE';
edtMinPrice2.DataField:= 'ACCOUNT_MIN_BASE_PRICE';
end;
pnlLeaseRealizationWork.Visible:= btnSinglePrice.Down;
pnlLeaseRealizationAccount.Visible:= not btnSinglePrice.Down;
pnlLeaseEstimationWork.Visible:= btnSinglePrice.Down;
pnlLeaseEstimationAccount.Visible:= not btnSinglePrice.Down;
btnDocs.ImageIndex:= cdsDataHAS_DOC_ITEMS.AsInteger;
btnParRelProductDocs.ImageIndex:= cdsSaleOrderProductInfoPRP_HAS_DOC.AsInteger;
SetupReadOnly;
pnlReceiveConditionsNormal.Visible:= (FProductClass = pcNormal);
end;
procedure TfmSaleOrder.actIsDeliveryRequiredExecute(Sender: TObject);
begin
inherited;
with (Sender as TAction) do
Checked:= not Checked;
CheckEditMode(cdsData);
cdsDataDELIVERY_OBJECT_BRANCH_CODE.Clear;
cdsDataDELIVERY_OBJECT_CODE.Clear;
CheckEditMode(pdsDeliveryID);
pdsDeliveryIDDCD_BRANCH_CODE.Clear;
pdsDeliveryIDDCD_CODE.Clear;
pdsDeliveryIDDELIVERY_PROJECT_CODE.Clear;
LoadDeliveryID;
end;
procedure TfmSaleOrder.actLeasePriceExecute(Sender: TObject);
begin
inherited;
ShowProductPartnerPrice(otLease);
end;
procedure TfmSaleOrder.actLeasePriceUpdate(Sender: TObject);
begin
inherited;
PriceActionUpate(Sender);
end;
procedure TfmSaleOrder.actNotesExecute(Sender: TObject);
begin
inherited;
if not cdsDataANNUL_EMPLOYEE_CODE.IsNull or
not cdsDataFINISH_EMPLOYEE_CODE.IsNull then
TfmNotes.EditNotesField(cdsDataNOTES, emReadOnly)
else
TfmNotes.EditNotesField(cdsDataNOTES, EditMode);
end;
procedure TfmSaleOrder.actNotesUpdate(Sender: TObject);
begin
inherited;
(Sender as TAction).ImageIndex:= IfThen(cdsDataNOTES.AsString = '', 207, 57);
end;
procedure TfmSaleOrder.actParRelProductDocExecute(Sender: TObject);
begin
inherited;
dmDocClient.DSOpenDoc(
emReadOnly,
(Sender as TAction).ActionComponent as TControl,
dotParRelProduct,
cdsSaleOrderProductInfoPRP_DOC_BRANCH_CODE,
cdsSaleOrderProductInfoPRP_DOC_CODE
);
end;
procedure TfmSaleOrder.actParRelProductExecute(Sender: TObject);
begin
inherited;
TfmParRelProduct.ShowForm(nil, cdsData, emReadOnly);
end;
procedure TfmSaleOrder.actParRelProductUpdate(Sender: TObject);
begin
inherited;
(Sender as TAction).Enabled:= FParRelProductExists;
end;
procedure TfmSaleOrder.actAcuirePriceExecute(Sender: TObject);
begin
inherited;
ShowProductPartnerPrice(otAcquire);
end;
procedure TfmSaleOrder.actRequestDocExecute(Sender: TObject);
begin
inherited;
dmDocClient.DSOpenDoc(
emReadOnly,
(Sender as TAction).ActionComponent as TControl,
dotSaleRequestGroup,
cdsData,
'SRG_DOC_BRANCH_CODE',
'SRG_DOC_CODE');
end;
procedure TfmSaleOrder.actRequestDocUpdate(Sender: TObject);
begin
inherited;
(Sender as Taction).ImageIndex:= Ord(cdsDataSRG_HAS_DOC_ITEMS.AsBoolean);
end;
procedure TfmSaleOrder.actSaleExecute(Sender: TObject);
begin
inherited;
TfmSale.ShowForm(nil, cdsData, emReadOnly, 0);
end;
procedure TfmSaleOrder.actSaleUpdate(Sender: TObject);
begin
inherited;
(Sender as TAction).Enabled:= FHasSaleOnOpen;
end;
procedure TfmSaleOrder.CalcParRelProductExists;
begin
FParRelProductExists:=
dmMain.SvrParRelProducts.ParRelProductExists(
cdsDataPARTNER_CODE.AsInteger,
cdsDataBORDER_REL_TYPE_CODE.AsInteger,
cdsDataPRODUCT_CODE.AsInteger);
end;
class function TfmSaleOrder.CanEditOuterDataSet: Boolean;
begin
Result:= False;
end;
procedure TfmSaleOrder.SetupDecisionTypesFilter;
begin
Assert(cdsDataASPECT_TYPE_CODE.IsNull or (IntToAspectType(cdsDataASPECT_TYPE_CODE.AsInteger) in [atRealization, atEstimation]));
if cdsDataASPECT_TYPE_CODE.IsNull then
cdsDecisionTypes.Filter := '(1 = 0)'
else
begin
if (cdsDataASPECT_TYPE_CODE.AsInteger = AspectTypeToInt(atRealization)) then
cdsDecisionTypes.Filter := '(IS_REALIZATION_BOUND = 1)'
else
cdsDecisionTypes.Filter := '(IS_ESTIMATION_BOUND = 1)';
end;
cdsDecisionTypes.Filtered := True;
end;
class function TfmSaleOrder.CanUseDocs: Boolean;
begin
Result:= True;
end;
procedure TfmSaleOrder.cbDCDBranchExit(Sender: TObject);
begin
inherited;
LoadDeliveryID;
end;
procedure TfmSaleOrder.cdsDataACCOUNT_CL_OFFER_QUANTITYChange(Sender: TField);
begin
inherited;
if FCalculatingQuantity or cdsDataACCOUNT_MEASURE_COEF.IsNull then
Exit;
FCalculatingQuantity:= True;
try
if Sender.IsNull then
cdsDataCL_OFFER_QUANTITY.Clear
else
cdsDataCL_OFFER_QUANTITY.AsFloat:= Sender.AsFloat / cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FCalculatingQuantity:= False;
end;
end;
procedure TfmSaleOrder.cdsDataACCOUNT_CL_OFFER_SINGLE_PRICEChange(
Sender: TField);
begin
inherited;
if not FPricesChanging then
begin
FPricesChanging:= True;
try
if cdsDataACCOUNT_CL_OFFER_SINGLE_PRICE.IsNull or (cdsDataACCOUNT_MEASURE_COEF.AsFloat = 0) then
cdsDataCL_OFFER_SINGLE_PRICE.Clear
else
cdsDataCL_OFFER_SINGLE_PRICE.AsFloat:=
cdsDataACCOUNT_CL_OFFER_SINGLE_PRICE.AsFloat * cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FPricesChanging:= False;
end; { try }
end;
end;
procedure TfmSaleOrder.cdsDataACCOUNT_MIN_BASE_PRICEChange(Sender: TField);
begin
inherited;
if not FPricesChanging then
begin
FPricesChanging:= True;
try
if cdsDataACCOUNT_MIN_BASE_PRICE.IsNull or (cdsDataACCOUNT_MEASURE_COEF.AsFloat = 0) then
cdsDataMIN_BASE_PRICE.Clear
else
cdsDataMIN_BASE_PRICE.AsFloat:=
cdsDataACCOUNT_MIN_BASE_PRICE.AsFloat * cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FPricesChanging:= False;
end; { try }
end;
end;
procedure TfmSaleOrder.cdsDataACCOUNT_OUR_OFFER_QUANTITYChange(Sender: TField);
begin
inherited;
if FCalculatingQuantity or cdsDataACCOUNT_MEASURE_COEF.IsNull then
Exit;
FCalculatingQuantity:= True;
try
if Sender.IsNull then
cdsDataOUR_OFFER_QUANTITY.Clear
else
cdsDataOUR_OFFER_QUANTITY.AsFloat:= Sender.AsFloat / cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FCalculatingQuantity:= False;
end;
end;
procedure TfmSaleOrder.cdsDataACCOUNT_OUR_OFFER_SINGLE_PRICEChange(
Sender: TField);
begin
inherited;
if not FPricesChanging then
begin
FPricesChanging:= True;
try
if cdsDataACCOUNT_OUR_OFFER_SINGLE_PRICE.IsNull or (cdsDataACCOUNT_MEASURE_COEF.AsFloat = 0) then
cdsDataOUR_OFFER_SINGLE_PRICE.Clear
else
cdsDataOUR_OFFER_SINGLE_PRICE.AsFloat:=
cdsDataACCOUNT_OUR_OFFER_SINGLE_PRICE.AsFloat * cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FPricesChanging:= False;
end; { try }
end;
end;
procedure TfmSaleOrder.cdsDataACCOUNT_QUANTITYChange(Sender: TField);
begin
inherited;
if FCalculatingQuantity or cdsDataACCOUNT_MEASURE_COEF.IsNull then
Exit;
FCalculatingQuantity:= True;
try
if Sender.IsNull then
cdsDataQUANTITY.Clear
else
cdsDataQUANTITY.AsFloat:= Sender.AsFloat / cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FCalculatingQuantity:= False;
end;
end;
procedure TfmSaleOrder.cdsDataACCOUNT_SINGLE_PRICEChange(Sender: TField);
begin
inherited;
if not FPricesChanging then
begin
FPricesChanging:= True;
try
if cdsDataACCOUNT_SINGLE_PRICE.IsNull or (cdsDataACCOUNT_MEASURE_COEF.AsFloat = 0) then
cdsDataSINGLE_PRICE.Clear
else
cdsDataSINGLE_PRICE.AsFloat:=
cdsDataACCOUNT_SINGLE_PRICE.AsFloat * cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FPricesChanging:= False;
end; { try }
end;
end;
procedure TfmSaleOrder.cdsDataAfterApplyUpdates(Sender: TObject;
var OwnerData: OleVariant);
begin
inherited;
if (EditMode = emEdit) and
not cdsDataSALE_BRANCH_CODE.IsNull and
(cdsDataSS_COUNT.AsInteger > 1) then
begin
if (cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtSale) and
(FQuantity <> cdsDataQUANTITY.AsFloat) then
MessageDlgEx(
Format(SCheckSaleShipments, [cdsData_SALE_BRANCH_IDENTIFIER.AsString, cdsDataSALE_NO.AsInteger]),
mtWarning,
[mbOK],
0
);
if (cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtLease) and
( (FShipmentDate <> cdsDataSHIPMENT_DATE.AsDateTime) or
(FImportDate <> cdsDataIMPORT_DATE.AsDateTime) or
(FReceiveDate <> cdsDataRECEIVE_DATE.AsDateTime) or
(FReturnDate <> cdsDataRETURN_DATE.AsDateTime)
) then
MessageDlgEx(
Format(SCheckLeaseShipments, [cdsData_SALE_BRANCH_IDENTIFIER.AsString, cdsDataSALE_NO.AsInteger]),
mtWarning,
[mbOK],
0
);
end;
end;
procedure TfmSaleOrder.cdsDataAfterClose(DataSet: TDataSet);
begin
inherited;
cdsSaleRequestGroup.Close;
end;
procedure TfmSaleOrder.cdsDataAfterOpen(DataSet: TDataSet);
begin
inherited;
FQuantity:= cdsDataQUANTITY.AsFloat;
FShipmentDate:= cdsDataSHIPMENT_DATE.AsDateTime;
FImportDate:= cdsDataIMPORT_DATE.AsDateTime;
FReceiveDate:= cdsDataRECEIVE_DATE.AsDateTime;
FReturnDate:= cdsDataRETURN_DATE.AsDateTime;
FHasSaleOnOpen:= not cdsDataSALE_BRANCH_CODE.IsNull;
end;
procedure TfmSaleOrder.cdsDataASPECT_TYPE_CODEChange(Sender: TField);
begin
inherited;
LoadDefaults;
SetupDecisionTypesFilter;
if ((IntToAspectType(cdsDataASPECT_TYPE_CODE.AsInteger) = atRealization) <> actIsDeliveryRequired.Checked) then
actIsDeliveryRequired.Execute;
end;
procedure TfmSaleOrder.cdsDataBeforeApplyUpdates(Sender: TObject;
var OwnerData: OleVariant);
begin
inherited;
OwnerData:= VarArrayOf([DocsDelta, ProductClassToInt(FProductClass)]);
end;
procedure TfmSaleOrder.cdsDataBeforeOpen(DataSet: TDataSet);
begin
inherited;
if Assigned(OuterDataSet) then
SetParams(cdsSaleRequestGroup.Params, OuterDataSet);
cdsSaleRequestGroup.Open;
end;
procedure TfmSaleOrder.cdsDataBeforePost(DataSet: TDataSet);
begin
inherited;
CheckSomeRequiredFields;
if cdsData_DECISION_TYPE_REQUIRES.AsBoolean and
cdsDataFINISH_EMPLOYEE_CODE.IsNull then
raise Exception.Create(SFinishingRequired);
end;
procedure TfmSaleOrder.cdsDataCalcFields(DataSet: TDataSet);
var
v, v1, v2: Variant;
begin
inherited;
// status
if not cdsDataANNUL_EMPLOYEE_CODE.IsNull then
cdsData_STATUS_CODE.AsInteger:= 11
else
begin
if not cdsDataFINISH_EMPLOYEE_CODE.IsNull then
cdsData_STATUS_CODE.AsInteger:= 10
else
begin
if not cdsDataSALE_BRANCH_CODE.IsNull then
cdsData_STATUS_CODE.AsInteger:= 9
else
begin
if not cdsDataDECISION_DATE.IsNull then
cdsData_STATUS_CODE.AsInteger:= 8
else
begin
if not cdsDataOFFER_ANSWER_DATE.IsNull then
begin
if cdsDataDECISION_PLAN_DATE.IsNull then
cdsData_STATUS_CODE.AsInteger:= 6
else
begin
if (ContextDate > cdsDataDECISION_PLAN_DATE.AsDateTime) then
cdsData_STATUS_CODE.AsInteger:= 7
else
cdsData_STATUS_CODE.AsInteger:= 6
end;
end
else
begin
if not cdsDataOFFER_SEND_DATE.IsNull then
begin
if cdsDataOFFER_ANSWER_PLAN_DATE.IsNull then
cdsData_STATUS_CODE.AsInteger:= 4
else
begin
if (ContextDate > cdsDataOFFER_ANSWER_PLAN_DATE.AsDateTime) then
cdsData_STATUS_CODE.AsInteger:= 5
else
cdsData_STATUS_CODE.AsInteger:= 4
end;
end
else
begin
if not cdsDataOFFER_SEND_PLAN_DATE.IsNull then
begin
if (ContextDate > cdsDataOFFER_SEND_PLAN_DATE.AsDateTime) then
cdsData_STATUS_CODE.AsInteger:= 3
else
cdsData_STATUS_CODE.AsInteger:= 2
end
else
cdsData_STATUS_CODE.AsInteger:= 1;
end;
end;
end;
end;
end;
end;
// prices
v1:= cdsDataQUANTITY.AsVariant;
if VarIsNull(v1) then
v1:= cdsDataCL_OFFER_QUANTITY.AsVariant;
if VarIsNull(v1) then
v1:= cdsDataOUR_OFFER_QUANTITY.AsVariant;
if (cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtLease) then
begin
if not cdsDataLEASE_DATE_UNIT_QTY.IsNull then
v1:= v1 * cdsDataLEASE_DATE_UNIT_QTY.AsInteger
else
begin
if not cdsDataCL_OFFER_LEASE_DATE_UNIT_QTY.IsNull then
v1:= v1 * cdsDataCL_OFFER_LEASE_DATE_UNIT_QTY.AsInteger
else
v1:= v1 * cdsDataOUR_OFFER_LEASE_DATE_UNIT_QTY.AsVariant;
end;
end;
v2:= cdsDataSINGLE_PRICE.AsVariant;
if VarIsNull(v2) then
v2:= cdsDataOUR_OFFER_SINGLE_PRICE.AsVariant;
if VarIsNull(v2) then
v2:= cdsDataCL_OFFER_SINGLE_PRICE.AsVariant;
if VarIsNull(v1) or VarIsNull(v2) then
cdsData_SALE_TOTAL_PRICE.Clear
else
cdsData_SALE_TOTAL_PRICE.AsFloat:= v1 * v2;
if ( (FOldCurrencyCode <> cdsDataCURRENCY_CODE.AsVariant) or
(FOldSaleTotalPrice <> cdsData_SALE_TOTAL_PRICE.AsVariant) ) and
cdsSecondaryCurrencyRates.Active then
with cdsSecondaryCurrencyRates do
begin
FOldCurrencyCode:= cdsDataCURRENCY_CODE.AsVariant;
FOldSaleTotalPrice:= cdsData_SALE_TOTAL_PRICE.AsVariant;
v:= Lookup('CURRENCY_CODE', cdsDataCURRENCY_CODE.AsInteger, 'FIXING');
if VarIsNull(v) or cdsData_SALE_TOTAL_PRICE.IsNull then
cdsData_SALE_TOTAL_PRICE_SC.Clear
else
cdsData_SALE_TOTAL_PRICE_SC.AsFloat:= cdsData_SALE_TOTAL_PRICE.AsFloat * v;
FOldSaleTotalPriceSC:= cdsData_SALE_TOTAL_PRICE_SC.AsVariant;
end
else
cdsData_SALE_TOTAL_PRICE_SC.AsVariant:= FOldSaleTotalPriceSC;
// quantities
cdsData_OUR_OFFER_TOTAL_LEASE_QUANTITY.AsVariant:=
cdsDataOUR_OFFER_QUANTITY.AsVariant * cdsDataOUR_OFFER_LEASE_DATE_UNIT_QTY.AsVariant;
cdsData_CL_OFFER_TOTAL_LEASE_QUANTITY.AsVariant:=
cdsDataCL_OFFER_QUANTITY.AsVariant * cdsDataCL_OFFER_LEASE_DATE_UNIT_QTY.AsVariant;
cdsData_TOTAL_LEASE_QUANTITY.AsVariant:=
cdsDataQUANTITY.AsVariant * cdsDataLEASE_DATE_UNIT_QTY.AsVariant;
// dates
if cdsDataREQUEST_SEND_DATE.IsNull or cdsDataREQUEST_REGISTER_DATE.IsNull then
cdsData_REQUEST_REGISTER_DATE_DIFF.Clear
else
cdsData_REQUEST_REGISTER_DATE_DIFF.AsInteger:= Trunc(
cdsDataREQUEST_REGISTER_DATE.AsDateTime - cdsDataREQUEST_SEND_DATE.AsDateTime);
if cdsDataREQUEST_REGISTER_DATE.IsNull or cdsDataOFFER_SEND_PLAN_DATE.IsNull then
cdsData_OFFER_SEND_PLAN_DATE_DIFF.Clear
else
cdsData_OFFER_SEND_PLAN_DATE_DIFF.AsInteger:= Trunc(
cdsDataOFFER_SEND_PLAN_DATE.AsDateTime - cdsDataREQUEST_REGISTER_DATE.AsDateTime);
if cdsDataOFFER_SEND_PLAN_DATE.IsNull or cdsDataOFFER_ANSWER_PLAN_DATE.IsNull then
cdsData_OFFER_ANSWER_PLAN_DATE_DIFF.Clear
else
cdsData_OFFER_ANSWER_PLAN_DATE_DIFF.AsInteger:= Trunc(
cdsDataOFFER_ANSWER_PLAN_DATE.AsDateTime - cdsDataOFFER_SEND_PLAN_DATE.AsDateTime);
if cdsDataOFFER_ANSWER_PLAN_DATE.IsNull or cdsDataDECISION_PLAN_DATE.IsNull then
cdsData_DECISION_PLAN_DATE_DIFF.Clear
else
cdsData_DECISION_PLAN_DATE_DIFF.AsInteger:= Trunc(
cdsDataDECISION_PLAN_DATE.AsDateTime - cdsDataOFFER_ANSWER_PLAN_DATE.AsDateTime);
if cdsDataOFFER_SEND_DATE.IsNull or cdsDataOFFER_ANSWER_DATE.IsNull then
cdsData_OFFER_ANSWER_DATE_DIFF.Clear
else
cdsData_OFFER_ANSWER_DATE_DIFF.AsInteger:= Trunc(
cdsDataOFFER_ANSWER_DATE.AsDateTime - cdsDataOFFER_SEND_DATE.AsDateTime);
if cdsDataOFFER_ANSWER_DATE.IsNull or cdsDataDECISION_DATE.IsNull then
cdsData_DECISION_DATE_DIFF.Clear
else
cdsData_DECISION_DATE_DIFF.AsInteger:= Trunc(
cdsDataDECISION_DATE.AsDateTime - cdsDataOFFER_ANSWER_DATE.AsDateTime);
if cdsDataOFFER_SEND_PLAN_DATE.IsNull then
cdsData_OFFER_SEND_DATE_DEVIATION.Clear
else
begin
if cdsDataOFFER_SEND_DATE.IsNull then
cdsData_OFFER_SEND_DATE_DEVIATION.AsInteger:=
Trunc(cdsDataOFFER_SEND_PLAN_DATE.AsDateTime - ContextDate)
else
cdsData_OFFER_SEND_DATE_DEVIATION.AsInteger:=
Trunc(cdsDataOFFER_SEND_PLAN_DATE.AsDateTime - cdsDataOFFER_SEND_DATE.AsDateTime);
end;
if cdsDataOFFER_ANSWER_PLAN_DATE.IsNull then
cdsData_OFFER_ANSWER_DATE_DEVIATION.Clear
else
begin
if cdsDataOFFER_ANSWER_DATE.IsNull then
cdsData_OFFER_ANSWER_DATE_DEVIATION.AsInteger:=
Trunc(cdsDataOFFER_ANSWER_PLAN_DATE.AsDateTime - ContextDate)
else
cdsData_OFFER_ANSWER_DATE_DEVIATION.AsInteger:=
Trunc(cdsDataOFFER_ANSWER_PLAN_DATE.AsDateTime - cdsDataOFFER_ANSWER_DATE.AsDateTime);
end;
if cdsDataDECISION_PLAN_DATE.IsNull then
cdsData_DECISION_DATE_DEVIATION.Clear
else
begin
if cdsDataDECISION_DATE.IsNull then
cdsData_DECISION_DATE_DEVIATION.AsInteger:=
Trunc(cdsDataDECISION_PLAN_DATE.AsDateTime - ContextDate)
else
cdsData_DECISION_DATE_DEVIATION.AsInteger:=
Trunc(cdsDataDECISION_PLAN_DATE.AsDateTime - cdsDataDECISION_DATE.AsDateTime);
end;
// days
if cdsDataDECISION_PLAN_DATE.isNull or cdsDataREQUEST_REGISTER_DATE.IsNull then
cdsData_PLAN_PERIOD_DAYS.Clear
else
cdsData_PLAN_PERIOD_DAYS.AsInteger:= RealRound(cdsDataDECISION_PLAN_DATE.AsDateTime - cdsDataREQUEST_REGISTER_DATE.AsDateTime);
if cdsDataDECISION_DATE.isNull or cdsDataREQUEST_REGISTER_DATE.IsNull then
cdsData_REAL_PERIOD_DAYS.Clear
else
cdsData_REAL_PERIOD_DAYS.AsInteger:= RealRound(cdsDataDECISION_DATE.AsDateTime - cdsDataREQUEST_REGISTER_DATE.AsDateTime);
// other
if cdsDataRECEIVE_PLACE_OFFICE_CODE.IsNull then
cdsData_COUNTRY_NAME.Clear
else
cdsData_COUNTRY_NAME.AsVariant:=
cdsCompanyOffices.Lookup(
'COMPANY_CODE; OFFICE_CODE',
VarArrayOf([cdsDataCLIENT_COMPANY_CODE.AsInteger, cdsDataRECEIVE_PLACE_OFFICE_CODE.AsInteger]),
'_COUNTRY_NAME'
);
cdsDataPARTNER_CODE.Assign(cdsDataCLIENT_COMPANY_CODE);
end;
procedure TfmSaleOrder.cdsDataCLIENT_COMPANY_CODEChange(Sender: TField);
begin
inherited;
GetCompanyInfo(cdsDataCLIENT_COMPANY_CODE,
cdsDataCLIENT_COMPANY_NAME,
nil, nil, nil, nil, nil);
cdsDataRECEIVE_PLACE_OFFICE_CODE.Clear;
OpenCompanyOffices;
end;
procedure TfmSaleOrder.cdsDataCL_OFFER_QUANTITYChange(Sender: TField);
begin
if FCalculatingQuantity or cdsDataACCOUNT_MEASURE_COEF.IsNull then
Exit;
FCalculatingQuantity:= True;
try
if Sender.IsNull then
cdsDataACCOUNT_CL_OFFER_QUANTITY.Clear
else
cdsDataACCOUNT_CL_OFFER_QUANTITY.AsFloat:= Sender.AsFloat * cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FCalculatingQuantity:= False;
end;
end;
procedure TfmSaleOrder.cdsDataCL_OFFER_SINGLE_PRICEChange(Sender: TField);
begin
inherited;
if not FPricesChanging then
begin
FPricesChanging:= True;
try
if cdsDataCL_OFFER_SINGLE_PRICE.IsNull or (cdsDataACCOUNT_MEASURE_COEF.AsFloat = 0) then
cdsDataACCOUNT_CL_OFFER_SINGLE_PRICE.Clear
else
cdsDataACCOUNT_CL_OFFER_SINGLE_PRICE.AsFloat:=
cdsDataCL_OFFER_SINGLE_PRICE.AsFloat / cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FPricesChanging:= False;
end; { try }
end;
end;
procedure TfmSaleOrder.cdsDataCOMMON_STATUS_CODEGetText(Sender: TField;
var Text: string; DisplayText: Boolean);
begin
inherited;
if not Sender.IsNull then
Text:= ProductCommonStatusAbbrevs[Sender.AsInteger];
end;
procedure TfmSaleOrder.cdsDataCURRENCY_CODEChange(Sender: TField);
begin
inherited;
// typ workaround, shtoto ne ebava kato se izchisti lookup poleto
dbtCurrency.DataSource:= nil;
dbtCurrency.DataSource:= dsData;
dbtCurrency2.DataSource:= nil;
dbtCurrency2.DataSource:= dsData;
dbtCurrency3.DataSource:= nil;
dbtCurrency3.DataSource:= dsData;
dbtCurrency4.DataSource:= nil;
dbtCurrency4.DataSource:= dsData;
OpenSaleOrderProductInfo;
end;
procedure TfmSaleOrder.cdsDataDECISION_DATEChange(Sender: TField);
begin
inherited;
OpenSecondaryCurrencyRates;
cdsDataDECISION_TYPE_CODE.Required:= not cdsDataDECISION_DATE.IsNull;
end;
procedure TfmSaleOrder.cdsDataMIN_BASE_PRICEChange(Sender: TField);
begin
inherited;
if not FPricesChanging then
begin
FPricesChanging:= True;
try
if cdsDataMIN_BASE_PRICE.IsNull or (cdsDataACCOUNT_MEASURE_COEF.AsFloat = 0) then
cdsDataACCOUNT_MIN_BASE_PRICE.Clear
else
cdsDataACCOUNT_MIN_BASE_PRICE.AsFloat:=
cdsDataMIN_BASE_PRICE.AsFloat / cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FPricesChanging:= False;
end; { try }
end;
end;
procedure TfmSaleOrder.cdsDataNewRecord(DataSet: TDataSet);
begin
inherited;
cdsDataSALE_ORDER_TYPE_CODE.AsInteger:= sotNormalSaleOrder;
cdsDataREQUEST_LINE_NO.AsInteger:=
dmMain.SvrSaleOrders.GetNewRequestLineNo(cdsDataREQUEST_BRANCH_CODE.AsInteger, cdsDataREQUEST_NO.AsInteger);
cdsDataSOS_OKIDU.AsBoolean:= False;
cdsDataIS_ML_ENTRUSTED.AsBoolean:= False;
cdsDataIS_ML_NOT_NEEDED.AsBoolean:= False;
cdsDataHAS_DOC_ITEMS.AsBoolean:= False;
if Assigned(OuterDataSet) then
begin
cdsDataSRG_DOC_BRANCH_CODE.Assign(OuterDataSet.FieldByName('DOC_BRANCH_CODE'));
cdsDataSRG_DOC_CODE.Assign(OuterDataSet.FieldByName('DOC_CODE'));
cdsDataSRG_HAS_DOC_ITEMS.Assign(OuterDataSet.FieldByName('HAS_DOCUMENTATION'));
end;
if (cdsSaleRequestGroupSTREAM_TYPE_CODE.AsInteger = stReverse) then
cdsDataASPECT_TYPE_CODE.AsInteger:= AspectTypeToInt(atRealization);
cdsDataDOC_BRANCH_CODE.Clear;
cdsDataDOC_CODE.Clear;
if (FProductClass = pcFinancial) then
cdsDataIS_VENDOR_TRANSPORT.AsBoolean:= False;
end;
procedure TfmSaleOrder.cdsDataOUR_OFFER_QUANTITYChange(Sender: TField);
begin
inherited;
if FCalculatingQuantity or cdsDataACCOUNT_MEASURE_COEF.IsNull then
Exit;
FCalculatingQuantity:= True;
try
if Sender.IsNull then
cdsDataACCOUNT_OUR_OFFER_QUANTITY.Clear
else
cdsDataACCOUNT_OUR_OFFER_QUANTITY.AsFloat:= Sender.AsFloat * cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FCalculatingQuantity:= False;
end;
end;
procedure TfmSaleOrder.cdsDataOUR_OFFER_SINGLE_PRICEChange(Sender: TField);
begin
inherited;
if not FPricesChanging then
begin
FPricesChanging:= True;
try
if cdsDataOUR_OFFER_SINGLE_PRICE.IsNull or (cdsDataACCOUNT_MEASURE_COEF.AsFloat = 0) then
cdsDataACCOUNT_OUR_OFFER_SINGLE_PRICE.Clear
else
cdsDataACCOUNT_OUR_OFFER_SINGLE_PRICE.AsFloat:=
cdsDataOUR_OFFER_SINGLE_PRICE.AsFloat / cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FPricesChanging:= False;
end; { try }
end;
end;
procedure TfmSaleOrder.cdsDataPRODUCT_CODEChange(Sender: TField);
begin
inherited;
DoProductFieldChanged(
Sender, cdsDataPRODUCT_NAME, cdsDataPRODUCT_NO,
cdsDataPRODUCT_MEASURE_CODE, cdsDataACCOUNT_MEASURE_CODE, cdsDataACCOUNT_MEASURE_COEF);
cdsDataQUANTITYChange(cdsDataQUANTITY);
cdsDataOUR_OFFER_QUANTITYChange(cdsDataOUR_OFFER_QUANTITY);
cdsDataCL_OFFER_QUANTITYChange(cdsDataCL_OFFER_QUANTITY);
OpenSaleOrderProductInfo;
LoadDefaults;
CalcParRelProductExists;
end;
procedure TfmSaleOrder.cdsDataQUANTITYChange(Sender: TField);
begin
inherited;
if FCalculatingQuantity or cdsDataACCOUNT_MEASURE_COEF.IsNull then
Exit;
FCalculatingQuantity:= True;
try
if Sender.IsNull then
cdsDataACCOUNT_QUANTITY.Clear
else
cdsDataACCOUNT_QUANTITY.AsFloat:= Sender.AsFloat * cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FCalculatingQuantity:= False;
end;
end;
procedure TfmSaleOrder.cdsDataRECEIVE_DATEChange(Sender: TField);
begin
inherited;
LoadDefaults;
OpenSaleOrderProductInfo;
end;
procedure TfmSaleOrder.cdsDataSALE_BRANCH_CODEChange(Sender: TField);
begin
inherited;
if Sender.IsNull then
begin
cdsDataSALE_NO.Clear;
cdsDataSALE_PRIORITY_CODE.Clear;
end
else
begin
cdsDataSALE_NO.AsInteger:=
dmMain.SvrSaleOrders.GetNewSaleNo(cdsDataSALE_BRANCH_CODE.AsInteger);
cdsDataSALE_PRIORITY_CODE.Assign(cdsDataCLIENT_PRIORITY_CODE);
end;
end;
procedure TfmSaleOrder.cdsDataSINGLE_PRICEChange(Sender: TField);
begin
inherited;
if not FPricesChanging then
begin
FPricesChanging:= True;
try
if cdsDataSINGLE_PRICE.IsNull or (cdsDataACCOUNT_MEASURE_COEF.AsFloat = 0) then
cdsDataACCOUNT_SINGLE_PRICE.Clear
else
cdsDataACCOUNT_SINGLE_PRICE.AsFloat:=
cdsDataSINGLE_PRICE.AsFloat / cdsDataACCOUNT_MEASURE_COEF.AsFloat;
finally
FPricesChanging:= False;
end; { try }
end;
end;
procedure TfmSaleOrder.cdsData_STATUS_CODEGetText(Sender: TField;
var Text: string; DisplayText: Boolean);
begin
inherited;
if Sender.IsNull then
Text:= ''
else
Text:= SaleOrderStatuses[Sender.AsInteger];
end;
procedure TfmSaleOrder.cdsSaleOrderProductInfoSPEC_STATE_CODEGetText(
Sender: TField; var Text: string; DisplayText: Boolean);
begin
inherited;
if (not Sender.IsNull) and
(Low(SpecNoQuantityStateAbbrevs) <= Sender.AsInteger) and
(Sender.AsInteger <= High(SpecNoQuantityStateAbbrevs)) then
Text:= SpecNoQuantityStateAbbrevs[Sender.AsInteger];
end;
procedure TfmSaleOrder.CheckAllRequiredFields;
var
i: Integer;
begin
for i:= 0 to cdsData.Fields.Count - 1 do
if cdsData.Fields[i].Required then
CheckRequiredField(cdsData.Fields[i]);
end;
procedure TfmSaleOrder.CheckSomeRequiredFields;
begin
ValidateDates;
if not cdsDataSINGLE_PRICE.IsNull and
(cdsDataSINGLE_PRICE.AsFloat <= 0) then
raise Exception.Create(SPriceMustBePositive);
if not cdsDataSALE_BRANCH_CODE.IsNull then
CheckRequiredFields([
cdsDataOFFER_SEND_PLAN_DATE,
cdsDataOFFER_SEND_DATE,
cdsDataOFFER_ANSWER_PLAN_DATE,
cdsDataOFFER_ANSWER_DATE,
cdsDataDECISION_PLAN_DATE,
cdsDataDECISION_DATE,
cdsDataQUANTITY,
cdsDataCURRENCY_CODE,
cdsDataSINGLE_PRICE,
cdsDataRECEIVE_DATE,
cdsDataSALE_BRANCH_CODE,
cdsDataSALE_NO,
cdsDataSALE_TYPE_CODE,
cdsDataDECISION_EMPLOYEE_CODE,
cdsDataSHIPMENT_DATE,
cdsDataSHIPMENT_STORE_CODE,
cdsDataSALE_PRIORITY_CODE,
cdsDataIS_VENDOR_TRANSPORT
]);
if cdsDataSALE_BRANCH_CODE.IsNull and
(cdsDataASPECT_TYPE_CODE.AsInteger = AspectTypeToInt(atRealization)) then
begin
CheckRequiredFields([
cdsDataQUANTITY,
cdsDataCL_OFFER_RECEIVE_DATE,
cdsDataSHIPMENT_STORE_CODE,
cdsDataSHIPMENT_DAYS
]);
if (cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtLease) then
CheckRequiredFields([
cdsDataLEASE_DATE_UNIT_QTY,
cdsDataCL_OFFER_RETURN_DATE
]);
end; { if }
if not cdsDataSALE_BRANCH_CODE.IsNull and
(cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtLease) then
begin
CheckRequiredFields([
cdsDataRECEIVE_DATE,
cdsDataRETURN_DATE,
cdsDataCL_OFFER_RECEIVE_DATE,
cdsDataCL_OFFER_RETURN_DATE,
cdsDataIMPORT_DATE
]);
end; { if }
if (cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtLease) and
not cdsDataIMPORT_DATE.IsNull and
not cdsDataRETURN_DATE.IsNull and
(cdsDataIMPORT_DATE.AsDateTime < cdsDataRETURN_DATE.AsDateTime) then
begin
raise Exception.Create(SImportDateMustNotBeLessThanEndOfLeaseInterval);
end; { if }
if not cdsDataDECISION_TYPE_CODE.IsNull or not cdsDataDECISION_EMPLOYEE_CODE.IsNull then
CheckRequiredFields([cdsDataDECISION_TYPE_CODE, cdsDataDECISION_EMPLOYEE_CODE]);
if not cdsDataLEASE_DATE_UNIT_QTY.IsNull or not cdsDataLEASE_DATE_UNIT_CODE.IsNull then
CheckRequiredFields([cdsDataLEASE_DATE_UNIT_QTY, cdsDataLEASE_DATE_UNIT_CODE]);
if not cdsDataCL_OFFER_LEASE_DATE_UNIT_QTY.IsNull or not cdsDataCL_OFFER_LEASE_DATE_UNIT_CODE.IsNull then
CheckRequiredFields([cdsDataCL_OFFER_LEASE_DATE_UNIT_QTY, cdsDataCL_OFFER_LEASE_DATE_UNIT_CODE]);
if not cdsDataOUR_OFFER_LEASE_DATE_UNIT_QTY.IsNull or not cdsDataOUR_OFFER_LEASE_DATE_UNIT_CODE.IsNull then
CheckRequiredFields([cdsDataOUR_OFFER_LEASE_DATE_UNIT_QTY, cdsDataOUR_OFFER_LEASE_DATE_UNIT_CODE]);
if (cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtExport) and
(cdsDataASPECT_TYPE_CODE.AsInteger = AspectTypeToInt(atRealization)) then
CheckRequiredFields([
cdsDataQUANTITY,
cdsDataCURRENCY_CODE,
cdsDataSINGLE_PRICE
]);
if (cdsDataSALE_DEAL_TYPE_CODE.AsInteger = sdtExport) and
(cdsDataASPECT_TYPE_CODE.AsInteger = AspectTypeToInt(atRealization)) and
(actIsDeliveryRequired.Checked) then
CheckRequiredFields([
cdsDataDELIVERY_OBJECT_BRANCH_CODE,
cdsDataDELIVERY_OBJECT_CODE
]);
end;
procedure TfmSaleOrder.CloseDataSets;
begin
pdsDeliveryID.Close;
cdsSaleOrderProductInfo.Close;
cdsSecondaryCurrencyRates.Close;
cdsCompanyOffices.Close;
inherited;
cdsCountries.Close;
cdsPriorities.Close;
cdsSaleTypes.Close;
cdsShipmentTypes.Close;
cdsCustomhouses.Close;
cdsDateUnits.Close;
cdsDecisionTypes.Close;
cdsCurrencies.Close;
cdsAspectTypes.Close;
cdsBranches.Close;
cdsSaleDealTypes.Close;
end;
procedure TfmSaleOrder.DatesOnValidate(Sender: TField);
begin
inherited;
ValidateDates;
end;
procedure TfmSaleOrder.dmDocClientOnDataChanged(Sender: TObject);
begin
dmDocClient.SetHasDocItemsField(cdsDataHAS_DOC_ITEMS);
end;
procedure TfmSaleOrder.DoApplyUpdates;
var
PartnerCode: Integer;
BaseDate: TDateTime;
begin
if (not FHadSaleNo) and
(not cdsDataSALE_NO.IsNull) and
cdsDataANNUL_EMPLOYEE_CODE.IsNull and
FinOrderNeeded then
begin
LoginContext.CheckUserActivity(uaNewFinancialOrder);
PartnerCode:= cdsDataCLIENT_COMPANY_CODE.AsInteger;
BaseDate:= cdsDataSHIPMENT_DATE.AsDateTime;
if not TfmNewFinOrder.ShowForm(nil, cdsData, emEdit, doNone, PartnerCode, brtClient, BaseDate, BaseDate, cdsDataSALE_BRANCH_CODE.AsInteger) and
(LoginContext.FinOrderRequirementCode = forcPrompt) then
Abort;
end;
CheckFinOrderField(cdsDataFO_EXEC_DEPT_CODE);
if (not FHadSaleNo) and
(not cdsDataSALE_NO.IsNull) and
cdsDataANNUL_EMPLOYEE_CODE.IsNull then
dmDocClient.DSInitDoc(dotSaleShipment, cdsDataSSH_DOC_BRANCH_CODE, cdsDataSSH_DOC_CODE);
inherited;
FFinalFinOrderCode:= cdsDataFIN_ORDER_CODE.AsInteger;
end;
procedure TfmSaleOrder.edtDCDCodeExit(Sender: TObject);
begin
inherited;
LoadDeliveryID;
end;
procedure TfmSaleOrder.edtDeliveryProjectCodeExit(Sender: TObject);
begin
inherited;
LoadDeliveryID;
end;
end.
| 35.709992 | 150 | 0.753713 |
47a6b8a3c059925486d62758b05040b180bf368a | 300 | dpr | Pascal | layoutsaver/demo/IniLayoutSaverDemo.dpr | atkins126/ccLib | 045a72af8417c6cdc541c34993a99bf109d4479a | [
"MIT"
]
| 7 | 2018-08-06T19:10:57.000Z | 2021-11-23T07:45:50.000Z | layoutsaver/demo/IniLayoutSaverDemo.dpr | atkins126/ccLib | 045a72af8417c6cdc541c34993a99bf109d4479a | [
"MIT"
]
| null | null | null | layoutsaver/demo/IniLayoutSaverDemo.dpr | atkins126/ccLib | 045a72af8417c6cdc541c34993a99bf109d4479a | [
"MIT"
]
| 2 | 2019-12-14T11:17:44.000Z | 2020-10-12T05:55:32.000Z | program IniLayoutSaverDemo;
uses
Vcl.Forms,
ufrmIniLayoutSaverDemo in 'ufrmIniLayoutSaverDemo.pas' {frmIniLayoutSaver};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TfrmIniLayoutSaver, frmIniLayoutSaver);
Application.Run;
end.
| 20 | 77 | 0.793333 |
fcc9677b776ffb5c8286d82b8d491765efd62b98 | 37,451 | pas | Pascal | src/libraries/hashlib4pascal/HlpCRC.pas | skalogryz/PascalCoin | 4ad304ff133b06a5708f7f7f22300e58eb2f959e | [
"MIT"
]
| 1 | 2021-06-07T13:20:04.000Z | 2021-06-07T13:20:04.000Z | src/libraries/hashlib4pascal/HlpCRC.pas | skalogryz/PascalCoin | 4ad304ff133b06a5708f7f7f22300e58eb2f959e | [
"MIT"
]
| null | null | null | src/libraries/hashlib4pascal/HlpCRC.pas | skalogryz/PascalCoin | 4ad304ff133b06a5708f7f7f22300e58eb2f959e | [
"MIT"
]
| 1 | 2021-06-02T23:57:38.000Z | 2021-06-02T23:57:38.000Z | unit HlpCRC;
// A vast majority if not all of the parameters for these CRC standards
// were gotten from http://reveng.sourceforge.net/crc-catalogue/.
{$I HashLib.inc}
interface
uses
{$IFDEF HAS_UNITSCOPE}
System.SysUtils,
System.TypInfo,
{$ELSE}
SysUtils,
TypInfo,
{$ENDIF HAS_UNITSCOPE}
HlpHashLibTypes,
HlpHash,
HlpIHash,
HlpIHashInfo,
HlpHashResult,
HlpIHashResult,
HlpICRC;
resourcestring
SUnSupportedCRCType = 'UnSupported CRC Type: "%s"';
SWidthOutOfRange = 'Width Must be Between 3 and 64. "%d"';
{$REGION 'CRC Standards'}
type
/// <summary>
/// Enum of all defined and implemented CRC standards.
/// </summary>
TCRCStandard = (
/// <summary>
/// CRC standard named "CRC3_GSM".
/// </summary>
CRC3_GSM,
/// <summary>
/// CRC standard named "CRC3_ROHC".
/// </summary>
CRC3_ROHC,
/// <summary>
/// CRC standard named "CRC4_INTERLAKEN".
/// </summary>
CRC4_INTERLAKEN,
/// <summary>
/// CRC standard named "CRC4_ITU".
/// </summary>
CRC4_ITU,
/// <summary>
/// CRC standard named "CRC5_EPC".
/// </summary>
CRC5_EPC,
/// <summary>
/// CRC standard named "CRC5_ITU".
/// </summary>
CRC5_ITU,
/// <summary>
/// CRC standard named "CRC5_USB".
/// </summary>
CRC5_USB,
/// <summary>
/// CRC standard named "CRC6_CDMA2000A".
/// </summary>
CRC6_CDMA2000A,
/// <summary>
/// CRC standard named "CRC6_CDMA2000B".
/// </summary>
CRC6_CDMA2000B,
/// <summary>
/// CRC standard named "CRC6_DARC".
/// </summary>
CRC6_DARC,
/// <summary>
/// CRC standard named "CRC6_GSM".
/// </summary>
CRC6_GSM,
/// <summary>
/// CRC standard named "CRC6_ITU".
/// </summary>
CRC6_ITU,
/// <summary>
/// CRC standard named "CRC7".
/// </summary>
CRC7,
/// <summary>
/// CRC standard named "CRC7_ROHC".
/// </summary>
CRC7_ROHC,
/// <summary>
/// CRC standard named "CRC7_UMTS".
/// </summary>
CRC7_UMTS,
/// <summary>
/// CRC standard named "CRC8".
/// </summary>
CRC8,
/// <summary>
/// CRC standard named "CRC8_AUTOSAR".
/// </summary>
CRC8_AUTOSAR,
/// <summary>
/// CRC standard named "CRC8_BLUETOOTH".
/// </summary>
CRC8_BLUETOOTH,
/// <summary>
/// CRC standard named "CRC8_CDMA2000".
/// </summary>
CRC8_CDMA2000,
/// <summary>
/// CRC standard named "CRC8_DARC".
/// </summary>
CRC8_DARC,
/// <summary>
/// CRC standard named "CRC8_DVBS2".
/// </summary>
CRC8_DVBS2,
/// <summary>
/// CRC standard named "CRC8_EBU".
/// </summary>
CRC8_EBU,
/// <summary>
/// CRC standard named "CRC8_GSMA".
/// </summary>
CRC8_GSMA,
/// <summary>
/// CRC standard named "CRC8_GSMB".
/// </summary>
CRC8_GSMB,
/// <summary>
/// CRC standard named "CRC8_ICODE".
/// </summary>
CRC8_ICODE,
/// <summary>
/// CRC standard named "CRC8_ITU".
/// </summary>
CRC8_ITU,
/// <summary>
/// CRC standard named "CRC8_LTE".
/// </summary>
CRC8_LTE,
/// <summary>
/// CRC standard named "CRC8_MAXIM".
/// </summary>
CRC8_MAXIM,
/// <summary>
/// CRC standard named "CRC8_OPENSAFETY".
/// </summary>
CRC8_OPENSAFETY,
/// <summary>
/// CRC standard named "CRC8_ROHC".
/// </summary>
CRC8_ROHC,
/// <summary>
/// CRC standard named "CRC8_SAEJ1850".
/// </summary>
CRC8_SAEJ1850,
/// <summary>
/// CRC standard named "CRC8_WCDMA".
/// </summary>
CRC8_WCDMA,
/// <summary>
/// CRC standard named "CRC10".
/// </summary>
CRC10,
/// <summary>
/// CRC standard named "CRC10_CDMA2000".
/// </summary>
CRC10_CDMA2000,
/// <summary>
/// CRC standard named "CRC10_GSM".
/// </summary>
CRC10_GSM,
/// <summary>
/// CRC standard named "CRC11".
/// </summary>
CRC11,
/// <summary>
/// CRC standard named "CRC11_UMTS".
/// </summary>
CRC11_UMTS,
/// <summary>
/// CRC standard named "CRC12_CDMA2000".
/// </summary>
CRC12_CDMA2000,
/// <summary>
/// CRC standard named "CRC12_DECT".
/// </summary>
CRC12_DECT,
/// <summary>
/// CRC standard named "CRC12_GSM".
/// </summary>
CRC12_GSM,
/// <summary>
/// CRC standard named "CRC12_UMTS".
/// </summary>
CRC12_UMTS,
/// <summary>
/// CRC standard named "CRC13_BBC".
/// </summary>
CRC13_BBC,
/// <summary>
/// CRC standard named "CRC14_DARC".
/// </summary>
CRC14_DARC,
/// <summary>
/// CRC standard named "CRC14_GSM".
/// </summary>
CRC14_GSM,
/// <summary>
/// CRC standard named "CRC15".
/// </summary>
CRC15,
/// <summary>
/// CRC standard named "CRC15_MPT1327".
/// </summary>
CRC15_MPT1327,
/// <summary>
/// CRC standard named "ARC".
/// </summary>
ARC,
/// <summary>
/// CRC standard named "CRC16_AUGCCITT".
/// </summary>
CRC16_AUGCCITT,
/// <summary>
/// CRC standard named "CRC16_BUYPASS".
/// </summary>
CRC16_BUYPASS,
/// <summary>
/// CRC standard named "CRC16_CCITTFALSE".
/// </summary>
CRC16_CCITTFALSE,
/// <summary>
/// CRC standard named "CRC16_CDMA2000".
/// </summary>
CRC16_CDMA2000,
/// <summary>
/// CRC standard named "CRC16_CMS".
/// </summary>
CRC16_CMS,
/// <summary>
/// CRC standard named "CRC16_DDS110".
/// </summary>
CRC16_DDS110,
/// <summary>
/// CRC standard named "CRC16_DECTR".
/// </summary>
CRC16_DECTR,
/// <summary>
/// CRC standard named "CRC16_DECTX".
/// </summary>
CRC16_DECTX,
/// <summary>
/// CRC standard named "CRC16_DNP".
/// </summary>
CRC16_DNP,
/// <summary>
/// CRC standard named "CRC16_EN13757".
/// </summary>
CRC16_EN13757,
/// <summary>
/// CRC standard named "CRC16_GENIBUS".
/// </summary>
CRC16_GENIBUS,
/// <summary>
/// CRC standard named "CRC16_GSM".
/// </summary>
CRC16_GSM,
/// <summary>
/// CRC standard named "CRC16_LJ1200".
/// </summary>
CRC16_LJ1200,
/// <summary>
/// CRC standard named "CRC16_MAXIM".
/// </summary>
CRC16_MAXIM,
/// <summary>
/// CRC standard named "CRC16_MCRF4XX".
/// </summary>
CRC16_MCRF4XX,
/// <summary>
/// CRC standard named "CRC16_OPENSAFETYA".
/// </summary>
CRC16_OPENSAFETYA,
/// <summary>
/// CRC standard named "CRC16_OPENSAFETYB".
/// </summary>
CRC16_OPENSAFETYB,
/// <summary>
/// CRC standard named "CRC16_PROFIBUS".
/// </summary>
CRC16_PROFIBUS,
/// <summary>
/// CRC standard named "CRC16_RIELLO".
/// </summary>
CRC16_RIELLO,
/// <summary>
/// CRC standard named "CRC16_T10DIF".
/// </summary>
CRC16_T10DIF,
/// <summary>
/// CRC standard named "CRC16_TELEDISK".
/// </summary>
CRC16_TELEDISK,
/// <summary>
/// CRC standard named "CRC16_TMS37157".
/// </summary>
CRC16_TMS37157,
/// <summary>
/// CRC standard named "CRC16_USB".
/// </summary>
CRC16_USB,
/// <summary>
/// CRC standard named "CRCA".
/// </summary>
CRCA,
/// <summary>
/// CRC standard named "KERMIT".
/// </summary>
KERMIT,
/// <summary>
/// CRC standard named "MODBUS".
/// </summary>
MODBUS,
/// <summary>
/// CRC standard named "X25".
/// </summary>
X25,
/// <summary>
/// CRC standard named "XMODEM".
/// </summary>
XMODEM,
/// <summary>
/// CRC standard named "CRC17_CANFD".
/// </summary>
CRC17_CANFD,
/// <summary>
/// CRC standard named "CRC21_CANFD".
/// </summary>
CRC21_CANFD,
/// <summary>
/// CRC standard named "CRC24".
/// </summary>
CRC24,
/// <summary>
/// CRC standard named "CRC24_BLE".
/// </summary>
CRC24_BLE,
/// <summary>
/// CRC standard named "CRC24_FLEXRAYA".
/// </summary>
CRC24_FLEXRAYA,
/// <summary>
/// CRC standard named "CRC24_FLEXRAYB".
/// </summary>
CRC24_FLEXRAYB,
/// <summary>
/// CRC standard named "CRC24_INTERLAKEN".
/// </summary>
CRC24_INTERLAKEN,
/// <summary>
/// CRC standard named "CRC24_LTEA".
/// </summary>
CRC24_LTEA,
/// <summary>
/// CRC standard named "CRC24_LTEB".
/// </summary>
CRC24_LTEB,
/// <summary>
/// CRC standard named "CRC30_CDMA".
/// </summary>
CRC30_CDMA,
/// <summary>
/// CRC standard named "CRC31_PHILIPS".
/// </summary>
CRC31_PHILIPS,
/// <summary>
/// CRC standard named "CRC32".
/// </summary>
CRC32,
/// <summary>
/// CRC standard named "CRC32_AUTOSAR".
/// </summary>
CRC32_AUTOSAR,
/// <summary>
/// CRC standard named "CRC32_BZIP2".
/// </summary>
CRC32_BZIP2,
/// <summary>
/// CRC standard named "CRC32C".
/// </summary>
CRC32C,
/// <summary>
/// CRC standard named "CRC32D".
/// </summary>
CRC32D,
/// <summary>
/// CRC standard named "CRC32_MPEG2".
/// </summary>
CRC32_MPEG2,
/// <summary>
/// CRC standard named "CRC32_POSIX".
/// </summary>
CRC32_POSIX,
/// <summary>
/// CRC standard named "CRC32Q".
/// </summary>
CRC32Q,
/// <summary>
/// CRC standard named "JAMCRC".
/// </summary>
JAMCRC,
/// <summary>
/// CRC standard named "XFER".
/// </summary>
XFER,
/// <summary>
/// CRC standard named "CRC40_GSM".
/// </summary>
CRC40_GSM,
/// <summary>
/// CRC standard named "CRC64".
/// </summary>
CRC64,
/// <summary>
/// CRC standard named "CRC64_GOISO".
/// </summary>
CRC64_GOISO,
/// <summary>
/// CRC standard named "CRC64_WE".
/// </summary>
CRC64_WE,
/// <summary>
/// CRC standard named "CRC64_XZ".
/// </summary>
CRC64_XZ);
{$ENDREGION}
type
TCRC = class sealed(THash, IChecksum, ICRC, ITransformBlock)
strict private
FNames: THashLibStringArray;
FWidth: Int32;
FPolynomial, FInitial, FOutputXor, FCheckValue, Fm_CRCMask,
Fm_CRCHighBitMask, Fm_hash: UInt64;
FIsInputReflected, FIsOutputReflected, FIsTableGenerated: Boolean;
Fm_CRCTable: THashLibUInt64Array;
const
Delta = Int32(7);
function GetNames: THashLibStringArray; inline;
procedure SetNames(const value: THashLibStringArray); inline;
function GetWidth: Int32; inline;
procedure SetWidth(value: Int32); inline;
function GetPolynomial: UInt64; inline;
procedure SetPolynomial(value: UInt64); inline;
function GetInitial: UInt64; inline;
procedure SetInitial(value: UInt64); inline;
function GetIsInputReflected: Boolean; inline;
procedure SetIsInputReflected(value: Boolean); inline;
function GetIsOutputReflected: Boolean; inline;
procedure SetIsOutputReflected(value: Boolean); inline;
function GetOutputXor: UInt64; inline;
procedure SetOutputXor(value: UInt64); inline;
function GetCheckValue: UInt64; inline;
procedure SetCheckValue(value: UInt64); inline;
procedure GenerateTable();
// tables work only for CRCs with width > 7
procedure CalculateCRCbyTable(a_data: PByte; a_data_length, a_index: Int32);
// fast bit by bit algorithm without augmented zero bytes.
// does not use lookup table, suited for polynomial orders between 1...32.
procedure CalculateCRCdirect(a_data: PByte; a_data_length, a_index: Int32);
// reflects the lower 'width' bits of 'value'
class function Reflect(a_value: UInt64; a_width: Int32): UInt64; static;
property Names: THashLibStringArray read GetNames write SetNames;
property Width: Int32 read GetWidth write SetWidth;
property Polynomial: UInt64 read GetPolynomial write SetPolynomial;
property Initial: UInt64 read GetInitial write SetInitial;
property IsInputReflected: Boolean read GetIsInputReflected
write SetIsInputReflected;
property IsOutputReflected: Boolean read GetIsOutputReflected
write SetIsOutputReflected;
property OutputXor: UInt64 read GetOutputXor write SetOutputXor;
property CheckValue: UInt64 read GetCheckValue write SetCheckValue;
strict protected
function GetName: String; override;
public
constructor Create(AWidth: Int32; APolynomial, AInitial: UInt64;
AIsInputReflected, AIsOutputReflected: Boolean;
AOutputXor, ACheckValue: UInt64; const ANames: THashLibStringArray);
procedure Initialize(); override;
procedure TransformBytes(const a_data: THashLibByteArray;
a_index, a_length: Int32); override;
function TransformFinal(): IHashResult; override;
function Clone(): IHash; override;
class function CreateCRCObject(a_value: TCRCStandard): ICRC; static;
end;
implementation
{ TCRC }
function TCRC.GetCheckValue: UInt64;
begin
result := FCheckValue;
end;
function TCRC.GetInitial: UInt64;
begin
result := FInitial;
end;
function TCRC.GetNames: THashLibStringArray;
begin
result := FNames;
end;
function TCRC.GetPolynomial: UInt64;
begin
result := FPolynomial;
end;
function TCRC.GetIsInputReflected: Boolean;
begin
result := FIsInputReflected;
end;
function TCRC.GetIsOutputReflected: Boolean;
begin
result := FIsOutputReflected;
end;
function TCRC.GetWidth: Int32;
begin
result := FWidth;
end;
function TCRC.GetOutputXor: UInt64;
begin
result := FOutputXor;
end;
procedure TCRC.SetCheckValue(value: UInt64);
begin
FCheckValue := value;
end;
procedure TCRC.SetInitial(value: UInt64);
begin
FInitial := value;
end;
procedure TCRC.SetNames(const value: THashLibStringArray);
begin
FNames := value;
end;
procedure TCRC.SetPolynomial(value: UInt64);
begin
FPolynomial := value;
end;
procedure TCRC.SetIsInputReflected(value: Boolean);
begin
FIsInputReflected := value;
end;
procedure TCRC.SetIsOutputReflected(value: Boolean);
begin
FIsOutputReflected := value;
end;
procedure TCRC.SetWidth(value: Int32);
begin
FWidth := value;
end;
procedure TCRC.SetOutputXor(value: UInt64);
begin
FOutputXor := value;
end;
function TCRC.GetName: String;
begin
result := Format('T%s', [(Self as ICRC).Names[0]]);
end;
procedure TCRC.CalculateCRCbyTable(a_data: PByte;
a_data_length, a_index: Int32);
var
&Length, i: Int32;
tmp: UInt64;
begin
&Length := a_data_length;
i := a_index;
tmp := Fm_hash;
if (IsInputReflected) then
begin
while Length > 0 do
begin
tmp := (tmp shr 8) xor Fm_CRCTable[Byte(tmp xor a_data[i])];
System.Inc(i);
System.Dec(Length);
end;
end
else
begin
while Length > 0 do
begin
tmp := (tmp shl 8) xor Fm_CRCTable
[Byte((tmp shr (Width - 8)) xor a_data[i])];
System.Inc(i);
System.Dec(Length);
end;
end;
Fm_hash := tmp;
end;
procedure TCRC.CalculateCRCdirect(a_data: PByte; a_data_length, a_index: Int32);
var
&Length, i: Int32;
c, bit, j: UInt64;
begin
&Length := a_data_length;
i := a_index;
while Length > 0 do
begin
c := UInt64(a_data[i]);
if (IsInputReflected) then
begin
c := Reflect(c, 8);
end;
j := $80;
while j > 0 do
begin
bit := Fm_hash and Fm_CRCHighBitMask;
Fm_hash := Fm_hash shl 1;
if ((c and j) > 0) then
bit := bit xor Fm_CRCHighBitMask;
if (bit > 0) then
Fm_hash := Fm_hash xor Polynomial;
j := j shr 1;
end;
System.Inc(i);
System.Dec(Length);
end;
end;
function TCRC.Clone(): IHash;
var
HashInstance: TCRC;
begin
HashInstance := TCRC.Create(Width, Polynomial, Initial, IsInputReflected,
IsOutputReflected, OutputXor, CheckValue, System.Copy(Names));
HashInstance.Fm_CRCMask := Fm_CRCMask;
HashInstance.Fm_CRCHighBitMask := Fm_CRCHighBitMask;
HashInstance.Fm_hash := Fm_hash;
HashInstance.FIsTableGenerated := FIsTableGenerated;
HashInstance.Fm_CRCTable := System.Copy(Fm_CRCTable);
result := HashInstance as IHash;
result.BufferSize := BufferSize;
end;
constructor TCRC.Create(AWidth: Int32; APolynomial, AInitial: UInt64;
AIsInputReflected, AIsOutputReflected: Boolean;
AOutputXor, ACheckValue: UInt64; const ANames: THashLibStringArray);
begin
if not(AWidth in [3 .. 64]) then
begin
raise EArgumentOutOfRangeHashLibException.CreateResFmt(@SWidthOutOfRange,
[AWidth]);
end;
FIsTableGenerated := False;
Inherited Create(-1, -1); // Dummy State
case AWidth of
0 .. 7:
begin
Self.HashSize := 1;
Self.BlockSize := 1;
end;
8 .. 16:
begin
Self.HashSize := 2;
Self.BlockSize := 1;
end;
17 .. 39:
begin
Self.HashSize := 4;
Self.BlockSize := 1;
end;
else
begin
Self.HashSize := 8;
Self.BlockSize := 1;
end;
end;
Names := ANames;
Width := AWidth;
Polynomial := APolynomial;
Initial := AInitial;
IsInputReflected := AIsInputReflected;
IsOutputReflected := AIsOutputReflected;
OutputXor := AOutputXor;
CheckValue := ACheckValue;
end;
{$REGION 'CRC Standards Implementation'}
class function TCRC.CreateCRCObject(a_value: TCRCStandard): ICRC;
begin
case a_value of
TCRCStandard.CRC3_GSM:
result := TCRC.Create(3, $3, $0, False, False, $7, $4,
THashLibStringArray.Create('CRC-3/GSM'));
TCRCStandard.CRC3_ROHC:
result := TCRC.Create(3, $3, $7, True, True, $0, $6,
THashLibStringArray.Create('CRC-3/ROHC'));
TCRCStandard.CRC4_INTERLAKEN:
result := TCRC.Create(4, $3, $F, False, False, $F, $B,
THashLibStringArray.Create('CRC-4/INTERLAKEN'));
TCRCStandard.CRC4_ITU:
result := TCRC.Create(4, $3, $0, True, True, $0, $7,
THashLibStringArray.Create('CRC-4/ITU'));
TCRCStandard.CRC5_EPC:
result := TCRC.Create(5, $9, $9, False, False, $00, $00,
THashLibStringArray.Create('CRC-5/EPC'));
TCRCStandard.CRC5_ITU:
result := TCRC.Create(5, $15, $00, True, True, $00, $07,
THashLibStringArray.Create('CRC-5/ITU'));
TCRCStandard.CRC5_USB:
result := TCRC.Create(5, $05, $1F, True, True, $1F, $19,
THashLibStringArray.Create('CRC-5/USB'));
TCRCStandard.CRC6_CDMA2000A:
result := TCRC.Create(6, $27, $3F, False, False, $00, $0D,
THashLibStringArray.Create('CRC-6/CDMA2000-A'));
TCRCStandard.CRC6_CDMA2000B:
result := TCRC.Create(6, $07, $3F, False, False, $00, $3B,
THashLibStringArray.Create('CRC-6/CDMA2000-B'));
TCRCStandard.CRC6_DARC:
result := TCRC.Create(6, $19, $00, True, True, $00, $26,
THashLibStringArray.Create('CRC-6/DARC'));
TCRCStandard.CRC6_GSM:
result := TCRC.Create(6, $2F, $00, False, False, $3F, $13,
THashLibStringArray.Create('CRC-6/GSM'));
TCRCStandard.CRC6_ITU:
result := TCRC.Create(6, $03, $00, True, True, $00, $06,
THashLibStringArray.Create('CRC-6/ITU'));
TCRCStandard.CRC7:
result := TCRC.Create(7, $09, $00, False, False, $00, $75,
THashLibStringArray.Create('CRC-7'));
TCRCStandard.CRC7_ROHC:
result := TCRC.Create(7, $4F, $7F, True, True, $00, $53,
THashLibStringArray.Create('CRC-7/ROHC'));
TCRCStandard.CRC7_UMTS:
result := TCRC.Create(7, $45, $00, False, False, $00, $61,
THashLibStringArray.Create('CRC-7/UMTS'));
TCRCStandard.CRC8:
result := TCRC.Create(8, $07, $00, False, False, $00, $F4,
THashLibStringArray.Create('CRC-8'));
TCRCStandard.CRC8_AUTOSAR:
result := TCRC.Create(8, $2F, $FF, False, False, $FF, $DF,
THashLibStringArray.Create('CRC-8/AUTOSAR'));
TCRCStandard.CRC8_BLUETOOTH:
result := TCRC.Create(8, $A7, $00, True, True, $00, $26,
THashLibStringArray.Create('CRC-8/BLUETOOTH'));
TCRCStandard.CRC8_CDMA2000:
result := TCRC.Create(8, $9B, $FF, False, False, $00, $DA,
THashLibStringArray.Create('CRC-8/CDMA2000'));
TCRCStandard.CRC8_DARC:
result := TCRC.Create(8, $39, $00, True, True, $00, $15,
THashLibStringArray.Create('CRC-8/DARC'));
TCRCStandard.CRC8_DVBS2:
result := TCRC.Create(8, $D5, $00, False, False, $00, $BC,
THashLibStringArray.Create('CRC-8/DVB-S2'));
TCRCStandard.CRC8_EBU:
result := TCRC.Create(8, $1D, $FF, True, True, $00, $97,
THashLibStringArray.Create('CRC-8/EBU', 'CRC-8/AES'));
TCRCStandard.CRC8_GSMA:
result := TCRC.Create(8, $1D, $00, False, False, $00, $37,
THashLibStringArray.Create('CRC-8/GSM-A'));
TCRCStandard.CRC8_GSMB:
result := TCRC.Create(8, $49, $00, False, False, $FF, $94,
THashLibStringArray.Create('CRC-8/GSM-B'));
TCRCStandard.CRC8_ICODE:
result := TCRC.Create(8, $1D, $FD, False, False, $00, $7E,
THashLibStringArray.Create('CRC-8/I-CODE'));
TCRCStandard.CRC8_ITU:
result := TCRC.Create(8, $07, $00, False, False, $55, $A1,
THashLibStringArray.Create('CRC-8/ITU'));
TCRCStandard.CRC8_LTE:
result := TCRC.Create(8, $9B, $00, False, False, $00, $EA,
THashLibStringArray.Create('CRC-8/LTE'));
TCRCStandard.CRC8_MAXIM:
result := TCRC.Create(8, $31, $00, True, True, $00, $A1,
THashLibStringArray.Create('CRC-8/MAXIM', 'DOW-CRC'));
TCRCStandard.CRC8_OPENSAFETY:
result := TCRC.Create(8, $2F, $00, False, False, $00, $3E,
THashLibStringArray.Create('CRC-8/OPENSAFETY'));
TCRCStandard.CRC8_ROHC:
result := TCRC.Create(8, $07, $FF, True, True, $00, $D0,
THashLibStringArray.Create('CRC-8/ROHC'));
TCRCStandard.CRC8_SAEJ1850:
result := TCRC.Create(8, $1D, $FF, False, False, $FF, $4B,
THashLibStringArray.Create('CRC-8/SAE-J1850'));
TCRCStandard.CRC8_WCDMA:
result := TCRC.Create(8, $9B, $00, True, True, $00, $25,
THashLibStringArray.Create('CRC-8/WCDMA'));
TCRCStandard.CRC10:
result := TCRC.Create(10, $233, $000, False, False, $000, $199,
THashLibStringArray.Create('CRC-10'));
TCRCStandard.CRC10_CDMA2000:
result := TCRC.Create(10, $3D9, $3FF, False, False, $000, $233,
THashLibStringArray.Create('CRC-10/CDMA2000'));
TCRCStandard.CRC10_GSM:
result := TCRC.Create(10, $175, $000, False, False, $3FF, $12A,
THashLibStringArray.Create('CRC-10/GSM'));
TCRCStandard.CRC11:
result := TCRC.Create(11, $385, $01A, False, False, $000, $5A3,
THashLibStringArray.Create('CRC-11'));
TCRCStandard.CRC11_UMTS:
result := TCRC.Create(11, $307, $000, False, False, $000, $061,
THashLibStringArray.Create('CRC-11/UMTS'));
TCRCStandard.CRC12_CDMA2000:
result := TCRC.Create(12, $F13, $FFF, False, False, $000, $D4D,
THashLibStringArray.Create('CRC-12/CDMA2000'));
TCRCStandard.CRC12_DECT:
result := TCRC.Create(12, $80F, $000, False, False, $000, $F5B,
THashLibStringArray.Create('CRC-12/DECT', 'X-CRC-12'));
TCRCStandard.CRC12_GSM:
result := TCRC.Create(12, $D31, $000, False, False, $FFF, $B34,
THashLibStringArray.Create('CRC-12/GSM'));
TCRCStandard.CRC12_UMTS:
result := TCRC.Create(12, $80F, $000, False, True, $000, $DAF,
THashLibStringArray.Create('CRC-12/UMTS', 'CRC-12/3GPP'));
TCRCStandard.CRC13_BBC:
result := TCRC.Create(13, $1CF5, $0000, False, False, $0000, $04FA,
THashLibStringArray.Create('CRC-13/BBC'));
TCRCStandard.CRC14_DARC:
result := TCRC.Create(14, $0805, $0000, True, True, $0000, $082D,
THashLibStringArray.Create('CRC-14/DARC'));
TCRCStandard.CRC14_GSM:
result := TCRC.Create(14, $202D, $0000, False, False, $3FFF, $30AE,
THashLibStringArray.Create('CRC-14/GSM'));
TCRCStandard.CRC15:
result := TCRC.Create(15, $4599, $0000, False, False, $0000, $059E,
THashLibStringArray.Create('CRC-15'));
TCRCStandard.CRC15_MPT1327:
result := TCRC.Create(15, $6815, $0000, False, False, $0001, $2566,
THashLibStringArray.Create('CRC-15/MPT1327'));
TCRCStandard.ARC:
result := TCRC.Create(16, $8005, $0000, True, True, $0000, $BB3D,
THashLibStringArray.Create('CRC-16', 'ARC', 'CRC-IBM', 'CRC-16/ARC',
'CRC-16/LHA'));
TCRCStandard.CRC16_AUGCCITT:
result := TCRC.Create(16, $1021, $1D0F, False, False, $0000, $E5CC,
THashLibStringArray.Create('CRC-16/AUG-CCITT', 'CRC-16/SPI-FUJITSU'));
TCRCStandard.CRC16_BUYPASS:
result := TCRC.Create(16, $8005, $0000, False, False, $0000, $FEE8,
THashLibStringArray.Create('CRC-16/BUYPASS', 'CRC-16/VERIFONE'));
TCRCStandard.CRC16_CCITTFALSE:
result := TCRC.Create(16, $1021, $FFFF, False, False, $0000, $29B1,
THashLibStringArray.Create('CRC-16/CCITT-FALSE'));
TCRCStandard.CRC16_CDMA2000:
result := TCRC.Create(16, $C867, $FFFF, False, False, $0000, $4C06,
THashLibStringArray.Create('CRC-16/CDMA2000'));
TCRCStandard.CRC16_CMS:
result := TCRC.Create(16, $8005, $FFFF, False, False, $0000, $AEE7,
THashLibStringArray.Create('CRC-16/CMS'));
TCRCStandard.CRC16_DDS110:
result := TCRC.Create(16, $8005, $800D, False, False, $0000, $9ECF,
THashLibStringArray.Create('CRC-16/DDS-110'));
TCRCStandard.CRC16_DECTR:
result := TCRC.Create(16, $0589, $0000, False, False, $0001, $007E,
THashLibStringArray.Create('CRC-16/DECT-R', 'R-CRC-16'));
TCRCStandard.CRC16_DECTX:
result := TCRC.Create(16, $0589, $0000, False, False, $0000, $007F,
THashLibStringArray.Create('CRC-16/DECT-X', 'X-CRC-16'));
TCRCStandard.CRC16_DNP:
result := TCRC.Create(16, $3D65, $0000, True, True, $FFFF, $EA82,
THashLibStringArray.Create('CRC-16/DNP'));
TCRCStandard.CRC16_EN13757:
result := TCRC.Create(16, $3D65, $0000, False, False, $FFFF, $C2B7,
THashLibStringArray.Create('CRC-16/EN13757'));
TCRCStandard.CRC16_GENIBUS:
result := TCRC.Create(16, $1021, $FFFF, False, False, $FFFF, $D64E,
THashLibStringArray.Create('CRC-16/GENIBUS', 'CRC-16/EPC',
'CRC-16/I-CODE', 'CRC-16/DARC'));
TCRCStandard.CRC16_GSM:
result := TCRC.Create(16, $1021, $0000, False, False, $FFFF, $CE3C,
THashLibStringArray.Create('CRC-16/GSM'));
TCRCStandard.CRC16_LJ1200:
result := TCRC.Create(16, $6F63, $0000, False, False, $0000, $BDF4,
THashLibStringArray.Create('CRC-16/LJ1200'));
TCRCStandard.CRC16_MAXIM:
result := TCRC.Create(16, $8005, $0000, True, True, $FFFF, $44C2,
THashLibStringArray.Create('CRC-16/MAXIM'));
TCRCStandard.CRC16_MCRF4XX:
result := TCRC.Create(16, $1021, $FFFF, True, True, $0000, $6F91,
THashLibStringArray.Create('CRC-16/MCRF4XX'));
TCRCStandard.CRC16_OPENSAFETYA:
result := TCRC.Create(16, $5935, $0000, False, False, $0000, $5D38,
THashLibStringArray.Create('CRC-16/OPENSAFETY-A'));
TCRCStandard.CRC16_OPENSAFETYB:
result := TCRC.Create(16, $755B, $0000, False, False, $0000, $20FE,
THashLibStringArray.Create('CRC-16/OPENSAFETY-B'));
TCRCStandard.CRC16_PROFIBUS:
result := TCRC.Create(16, $1DCF, $FFFF, False, False, $FFFF, $A819,
THashLibStringArray.Create('CRC-16/PROFIBUS', 'CRC-16/IEC-61158-2'));
TCRCStandard.CRC16_RIELLO:
result := TCRC.Create(16, $1021, $B2AA, True, True, $0000, $63D0,
THashLibStringArray.Create('CRC-16/RIELLO'));
TCRCStandard.CRC16_T10DIF:
result := TCRC.Create(16, $8BB7, $0000, False, False, $0000, $D0DB,
THashLibStringArray.Create('CRC-16/T10-DIF'));
TCRCStandard.CRC16_TELEDISK:
result := TCRC.Create(16, $A097, $0000, False, False, $0000, $0FB3,
THashLibStringArray.Create('CRC-16/TELEDISK'));
TCRCStandard.CRC16_TMS37157:
result := TCRC.Create(16, $1021, $89EC, True, True, $0000, $26B1,
THashLibStringArray.Create('CRC-16/TMS37157'));
TCRCStandard.CRC16_USB:
result := TCRC.Create(16, $8005, $FFFF, True, True, $FFFF, $B4C8,
THashLibStringArray.Create('CRC-16/USB'));
TCRCStandard.CRCA:
result := TCRC.Create(16, $1021, $C6C6, True, True, $0000, $BF05,
THashLibStringArray.Create('CRC-A'));
TCRCStandard.KERMIT:
result := TCRC.Create(16, $1021, $0000, True, True, $0000, $2189,
THashLibStringArray.Create('KERMIT', 'CRC-16/CCITT',
'CRC-16/CCITT-TRUE', 'CRC-CCITT'));
TCRCStandard.MODBUS:
result := TCRC.Create(16, $8005, $FFFF, True, True, $0000, $4B37,
THashLibStringArray.Create('MODBUS'));
TCRCStandard.X25:
result := TCRC.Create(16, $1021, $FFFF, True, True, $FFFF, $906E,
THashLibStringArray.Create('X-25', 'CRC-16/IBM-SDLC', 'CRC-16/ISO-HDLC',
'CRC-B'));
TCRCStandard.XMODEM:
result := TCRC.Create(16, $1021, $0000, False, False, $0000, $31C3,
THashLibStringArray.Create('XMODEM', 'ZMODEM', 'CRC-16/ACORN'));
TCRCStandard.CRC17_CANFD:
result := TCRC.Create(17, $1685B, $00000, False, False, $00000, $04F03,
THashLibStringArray.Create('CRC-17/CAN-FD'));
TCRCStandard.CRC21_CANFD:
result := TCRC.Create(21, $102899, $00000, False, False, $00000, $0ED841,
THashLibStringArray.Create('CRC-21/CAN-FD'));
TCRCStandard.CRC24:
result := TCRC.Create(24, $864CFB, $B704CE, False, False, $000000,
$21CF02, THashLibStringArray.Create('CRC-24', 'CRC-24/OPENPGP'));
TCRCStandard.CRC24_BLE:
result := TCRC.Create(24, $00065B, $555555, True, True, $000000, $C25A56,
THashLibStringArray.Create('CRC-24/BLE'));
TCRCStandard.CRC24_FLEXRAYA:
result := TCRC.Create(24, $5D6DCB, $FEDCBA, False, False, $000000,
$7979BD, THashLibStringArray.Create('CRC-24/FLEXRAY-A'));
TCRCStandard.CRC24_FLEXRAYB:
result := TCRC.Create(24, $5D6DCB, $ABCDEF, False, False, $000000,
$1F23B8, THashLibStringArray.Create('CRC-24/FLEXRAY-B'));
TCRCStandard.CRC24_INTERLAKEN:
result := TCRC.Create(24, $328B63, $FFFFFF, False, False, $FFFFFF,
$B4F3E6, THashLibStringArray.Create('CRC-24/INTERLAKEN'));
TCRCStandard.CRC24_LTEA:
result := TCRC.Create(24, $864CFB, $000000, False, False, $000000,
$CDE703, THashLibStringArray.Create('CRC-24/LTE-A'));
TCRCStandard.CRC24_LTEB:
result := TCRC.Create(24, $800063, $000000, False, False, $000000,
$23EF52, THashLibStringArray.Create('CRC-24/LTE-B'));
TCRCStandard.CRC30_CDMA:
result := TCRC.Create(30, $2030B9C7, $3FFFFFFF, False, False, $3FFFFFFF,
$04C34ABF, THashLibStringArray.Create('CRC-30/CDMA'));
TCRCStandard.CRC31_PHILIPS:
result := TCRC.Create(31, $04C11DB7, $7FFFFFFF, False, False, $7FFFFFFF,
$0CE9E46C, THashLibStringArray.Create('CRC-31/PHILLIPS'));
TCRCStandard.CRC32:
result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, True, True, $FFFFFFFF,
$CBF43926, THashLibStringArray.Create('CRC-32', 'CRC-32/ADCCP',
'PKZIP'));
TCRCStandard.CRC32_AUTOSAR:
result := TCRC.Create(32, $F4ACFB13, $FFFFFFFF, True, True, $FFFFFFFF,
$1697D06A, THashLibStringArray.Create('CRC-32/AUTOSAR'));
TCRCStandard.CRC32_BZIP2:
result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, False, False, $FFFFFFFF,
$FC891918, THashLibStringArray.Create('CRC-32/BZIP2', 'CRC-32/AAL5',
'CRC-32/DECT-B', 'B-CRC-32'));
TCRCStandard.CRC32C:
result := TCRC.Create(32, $1EDC6F41, $FFFFFFFF, True, True, $FFFFFFFF,
$E3069283, THashLibStringArray.Create('CRC-32C', 'CRC-32/ISCSI',
'CRC-32/CASTAGNOLI', 'CRC-32/INTERLAKEN'));
TCRCStandard.CRC32D:
result := TCRC.Create(32, $A833982B, $FFFFFFFF, True, True, $FFFFFFFF,
$87315576, THashLibStringArray.Create('CRC-32D'));
TCRCStandard.CRC32_MPEG2:
result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, False, False, $00000000,
$0376E6E7, THashLibStringArray.Create('CRC-32/MPEG-2'));
TCRCStandard.CRC32_POSIX:
result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, False, False, $00000000,
$0376E6E7, THashLibStringArray.Create('CRC-32/POSIX', 'CKSUM'));
TCRCStandard.CRC32Q:
result := TCRC.Create(32, $814141AB, $00000000, False, False, $00000000,
$3010BF7F, THashLibStringArray.Create('CRC-32Q'));
TCRCStandard.JAMCRC:
result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, True, True, $00000000,
$340BC6D9, THashLibStringArray.Create('JAMCRC'));
TCRCStandard.XFER:
result := TCRC.Create(32, $000000AF, $00000000, False, False, $00000000,
$BD0BE338, THashLibStringArray.Create('XFER'));
TCRCStandard.CRC40_GSM:
result := TCRC.Create(40, $0004820009, $0000000000, False, False,
$FFFFFFFFFF, $D4164FC646, THashLibStringArray.Create('CRC-40/GSM'));
TCRCStandard.CRC64:
result := TCRC.Create(64, $42F0E1EBA9EA3693, $0000000000000000, False,
False, $0000000000000000, $6C40DF5F0B497347,
THashLibStringArray.Create('CRC-64', 'CRC-64/ECMA-182'));
TCRCStandard.CRC64_GOISO:
result := TCRC.Create(64, $000000000000001B, UInt64($FFFFFFFFFFFFFFFF),
True, True, UInt64($FFFFFFFFFFFFFFFF), UInt64($B90956C775A41001),
THashLibStringArray.Create('CRC-64/GO-ISO'));
TCRCStandard.CRC64_WE:
result := TCRC.Create(64, $42F0E1EBA9EA3693, UInt64($FFFFFFFFFFFFFFFF),
False, False, UInt64($FFFFFFFFFFFFFFFF), $62EC59E3F1A4F00A,
THashLibStringArray.Create('CRC-64/WE'));
TCRCStandard.CRC64_XZ:
result := TCRC.Create(64, $42F0E1EBA9EA3693, UInt64($FFFFFFFFFFFFFFFF),
True, True, UInt64($FFFFFFFFFFFFFFFF), UInt64($995DC9BBDF1939FA),
THashLibStringArray.Create('CRC-64/XZ', 'CRC-64/GO-ECMA'))
else
raise EArgumentInvalidHashLibException.CreateResFmt(@SUnSupportedCRCType,
[GetEnumName(TypeInfo(TCRCStandard), Ord(a_value))]);
end;
end;
{$ENDREGION}
procedure TCRC.GenerateTable;
var
bit, crc: UInt64;
i, j: Int32;
begin
System.SetLength(Fm_CRCTable, 256);
i := 0;
while i < 256 do
begin
crc := UInt64(i);
if (IsInputReflected) then
begin
crc := Reflect(crc, 8);
end;
crc := crc shl (Width - 8);
j := 0;
while j < 8 do
begin
bit := crc and Fm_CRCHighBitMask;
crc := crc shl 1;
if (bit <> 0) then
crc := (crc xor Polynomial);
System.Inc(j);
end;
if (IsInputReflected) then
begin
crc := Reflect(crc, Width);
end;
crc := crc and Fm_CRCMask;
Fm_CRCTable[i] := crc;
System.Inc(i);
end;
FIsTableGenerated := True;
end;
procedure TCRC.Initialize;
begin
// initialize some bitmasks
Fm_CRCMask := (((UInt64(1) shl (Width - 1)) - 1) shl 1) or 1;
Fm_CRCHighBitMask := UInt64(1) shl (Width - 1);
Fm_hash := Initial;
if (Width > Delta) then // then use table
begin
if not FIsTableGenerated then
begin
GenerateTable();
end;
if (IsInputReflected) then
Fm_hash := Reflect(Fm_hash, Width);
end;
end;
class function TCRC.Reflect(a_value: UInt64; a_width: Int32): UInt64;
var
j, i: UInt64;
begin
j := 1;
result := 0;
i := UInt64(1) shl (a_width - 1);
while i <> 0 do
begin
if ((a_value and i) <> 0) then
begin
result := result or j;
end;
j := j shl 1;
i := i shr 1;
end;
end;
procedure TCRC.TransformBytes(const a_data: THashLibByteArray;
a_index, a_length: Int32);
var
i: Int32;
ptr_a_data: PByte;
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}
// table driven CRC reportedly only works for 8, 16, 24, 32 bits
// HOWEVER, it seems to work for everything > 7 bits, so use it
// accordingly
i := a_index;
ptr_a_data := PByte(a_data);
if (Width > Delta) then
begin
CalculateCRCbyTable(ptr_a_data, a_length, i);
end
else
begin
CalculateCRCdirect(ptr_a_data, a_length, i);
end;
end;
function TCRC.TransformFinal: IHashResult;
var
LUInt64: UInt64;
LUInt32: UInt32;
LUInt16: UInt16;
LUInt8: UInt8;
begin
if Width > Delta then
begin
if (IsInputReflected xor IsOutputReflected) then
begin
Fm_hash := Reflect(Fm_hash, Width);
end;
end
else
begin
if (IsOutputReflected) then
begin
Fm_hash := Reflect(Fm_hash, Width);
end;
end;
Fm_hash := Fm_hash xor OutputXor;
Fm_hash := Fm_hash and Fm_CRCMask;
if Width = 21 then // special case
begin
LUInt32 := UInt32(Fm_hash);
result := THashResult.Create(LUInt32);
Initialize();
Exit;
end;
case Width shr 3 of
0:
begin
LUInt8 := UInt8(Fm_hash);
result := THashResult.Create(LUInt8);
end;
1 .. 2:
begin
LUInt16 := UInt16(Fm_hash);
result := THashResult.Create(LUInt16);
end;
3 .. 4:
begin
LUInt32 := UInt32(Fm_hash);
result := THashResult.Create(LUInt32);
end
else
begin
LUInt64 := (Fm_hash);
result := THashResult.Create(LUInt64);
end;
end;
Initialize();
end;
end.
| 25.668951 | 80 | 0.621986 |
47841fa232e3c97011aac1f03195e7ee1614ba78 | 5,117 | dfm | Pascal | samples/DelphiXE5/TODOManager SQLite/MainForm.dfm | raelb/delphi-orm | 73e0caede84f2753550492deeaad35bf4191be30 | [
"Apache-2.0"
]
| null | null | null | samples/DelphiXE5/TODOManager SQLite/MainForm.dfm | raelb/delphi-orm | 73e0caede84f2753550492deeaad35bf4191be30 | [
"Apache-2.0"
]
| null | null | null | samples/DelphiXE5/TODOManager SQLite/MainForm.dfm | raelb/delphi-orm | 73e0caede84f2753550492deeaad35bf4191be30 | [
"Apache-2.0"
]
| null | null | null | object frmMain: TfrmMain
Left = 0
Top = 0
Caption = 'ToDo List - A Sample App using DORM'
ClientHeight = 424
ClientWidth = 716
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnClose = FormClose
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 15
object Panel1: TPanel
Left = 0
Top = 0
Width = 716
Height = 41
Align = alTop
TabOrder = 0
ExplicitWidth = 649
object Label1: TLabel
AlignWithMargins = True
Left = 4
Top = 4
Width = 493
Height = 33
Align = alLeft
Alignment = taCenter
AutoSize = False
Caption = 'My DORM TODO List'
Layout = tlCenter
end
object BitBtn2: TBitBtn
AlignWithMargins = True
Left = 481
Top = 4
Width = 74
Height = 33
Action = acNew
Align = alRight
Caption = 'New'
TabOrder = 0
ExplicitLeft = 414
end
object BitBtn3: TBitBtn
AlignWithMargins = True
Left = 640
Top = 4
Width = 72
Height = 33
Action = acDelete
Align = alRight
Caption = 'Delete'
TabOrder = 1
ExplicitLeft = 573
end
object BitBtn5: TBitBtn
AlignWithMargins = True
Left = 561
Top = 4
Width = 73
Height = 33
Action = acEdit
Align = alRight
Caption = 'Edit'
TabOrder = 2
ExplicitLeft = 494
end
end
object Panel2: TPanel
Left = 0
Top = 382
Width = 716
Height = 42
Align = alBottom
TabOrder = 1
ExplicitWidth = 649
object BitBtn4: TBitBtn
AlignWithMargins = True
Left = 95
Top = 4
Width = 90
Height = 34
Action = acPersist
Align = alLeft
Caption = 'Persist'
TabOrder = 0
end
object BitBtn1: TBitBtn
AlignWithMargins = True
Left = 4
Top = 4
Width = 85
Height = 34
Action = acRefresh
Align = alLeft
Caption = 'Refresh'
TabOrder = 1
end
object chkFilter: TCheckBox
AlignWithMargins = True
Left = 495
Top = 4
Width = 217
Height = 34
Align = alRight
Caption = 'Only not completed'
TabOrder = 2
OnClick = chkFilterClick
ExplicitLeft = 428
end
end
object StringGrid1: TStringGrid
Tag = 3
Left = 0
Top = 41
Width = 716
Height = 341
Align = alClient
ColCount = 3
DoubleBuffered = True
FixedCols = 0
RowCount = 201
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goColSizing, goRowSelect]
ParentDoubleBuffered = False
PopupMenu = PopupMenu1
TabOrder = 2
OnDblClick = StringGrid1DblClick
OnDrawCell = StringGrid1DrawCell
ExplicitWidth = 649
ColWidths = (
430
110
60)
end
object ActionList1: TActionList
Left = 192
Top = 208
object acRefresh: TAction
Caption = 'Refresh'
OnExecute = acRefreshExecute
end
object acNew: TAction
Caption = 'New'
OnExecute = acNewExecute
end
object acEdit: TAction
Caption = 'Edit'
OnExecute = acEditExecute
OnUpdate = acEditUpdate
end
object acPersist: TAction
Caption = 'Persist'
OnExecute = acPersistExecute
end
object acDelete: TAction
Caption = 'Delete'
OnExecute = acDeleteExecute
OnUpdate = acDeleteUpdate
end
object acCreateRandomData: TAction
Caption = 'Create some random data'
OnExecute = acCreateRandomDataExecute
end
end
object PopupMenu1: TPopupMenu
Left = 360
Top = 136
object Createsomerandomdata1: TMenuItem
Action = acCreateRandomData
end
end
object BindSourceTodos: TPrototypeBindSource
AutoActivate = True
AutoPost = False
FieldDefs = <
item
Name = 'Title'
Generator = 'LoremIpsum'
ReadOnly = True
end
item
Name = 'Description'
Generator = 'LoremIpsum'
ReadOnly = True
end
item
Name = 'DueDate'
FieldType = ftDate
Generator = 'Date'
ReadOnly = True
end
item
Name = 'Done'
FieldType = ftBoolean
Generator = 'Booleans'
ReadOnly = True
end>
ScopeMappings = <>
OnCreateAdapter = BindSourceTodosCreateAdapter
Left = 528
Top = 128
end
object BindingsList1: TBindingsList
Methods = <>
OutputConverters = <>
Left = 20
Top = 5
object LinkGridToDataSource1: TLinkGridToDataSource
Category = 'Quick Bindings'
DataSource = BindSourceTodos
GridControl = StringGrid1
Columns = <
item
MemberName = 'Title'
Width = 500
end
item
MemberName = 'DueDate'
Header = 'Due Date'
Width = 110
end
item
MemberName = 'Done'
Width = 60
CustomFormat = #39#39
end>
end
end
end
| 21.590717 | 98 | 0.583545 |
fcc83a24846e180d6ad15d31a06f29beae8da056 | 2,927 | pas | Pascal | source/SlPEsquisaCombustivel.pas | LGuilhermeNF/Posto-2.0 | 7783c8f50bd8f20bccf9325dbbd1014309ad605d | [
"Apache-2.0"
]
| null | null | null | source/SlPEsquisaCombustivel.pas | LGuilhermeNF/Posto-2.0 | 7783c8f50bd8f20bccf9325dbbd1014309ad605d | [
"Apache-2.0"
]
| null | null | null | source/SlPEsquisaCombustivel.pas | LGuilhermeNF/Posto-2.0 | 7783c8f50bd8f20bccf9325dbbd1014309ad605d | [
"Apache-2.0"
]
| null | null | null | unit SlPEsquisaCombustivel;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, SlPesquisaModelo, Data.DB,
FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf,
FireDAC.Stan.Async, FireDAC.DApt, FireDAC.Comp.DataSet, FireDAC.Comp.Client,
Vcl.Grids, Vcl.DBGrids, Vcl.Buttons, Vcl.StdCtrls, Vcl.ExtCtrls;
type
TCombustivelPesquisaSllForm = class(TPesquisaModeloSlForm)
fdQueryPesquisaCOD_COMBUSTIVEL: TIntegerField;
fdQueryPesquisaDES_COMBUSTIVEL: TStringField;
fdQueryPesquisaPRC_COMBUSTIVEL: TBCDField;
fdQueryPesquisaIMPOSTO: TBCDField;
procedure btnConfirmarClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure edtPesquisaExit(Sender: TObject);
private
FDescricao: String;
FCodigo: Integer;
FPreco: Double;
FImposto: Double;
{ Private declarations }
public
{ Public declarations }
property Codigo: Integer read FCodigo write FCodigo;
property Descricao: String read FDescricao write FDescricao;
property Preco: Double read FPreco write FPreco;
property Imposto: Double read FImposto write FImposto;
procedure PesquisaCodigo(aCodigo: Integer);
procedure PesquisaDescricao(aDescricao: String);
procedure PesquisaTodos;
end;
var
CombustivelPesquisaSllForm: TCombustivelPesquisaSllForm;
implementation
{$R *.dfm}
{ TCombustivelPesquisaSllForm }
procedure TCombustivelPesquisaSllForm.btnConfirmarClick(Sender: TObject);
begin
FCodigo := fdQueryPesquisaCOD_COMBUSTIVEL.AsInteger;
FDescricao := fdQueryPesquisaDES_COMBUSTIVEL.AsString;
FPreco := fdQueryPesquisaPRC_COMBUSTIVEL.AsFloat;
FImposto := fdQueryPesquisaIMPOSTO.AsFloat;
Close;
end;
procedure TCombustivelPesquisaSllForm.edtPesquisaExit(Sender: TObject);
begin
if SameText(edtPesquisa.Text, EmptyStr) then
PesquisaTodos
else
PesquisaDescricao(edtPesquisa.Text);
end;
procedure TCombustivelPesquisaSllForm.FormShow(Sender: TObject);
begin
PesquisaDescricao(FDescricao);
PesquisaCodigo(FCodigo);
end;
procedure TCombustivelPesquisaSllForm.PesquisaCodigo(aCodigo: Integer);
begin
if aCodigo > 0 then
fdQueryPesquisa.Open('select Cod_Combustivel, Des_Combustivel, Prc_Combustivel, Imposto from COMBUSTIVEL where Cod_Combustivel = ' + aCodigo.ToString);
end;
procedure TCombustivelPesquisaSllForm.PesquisaDescricao(aDescricao: String);
begin
if not SameText(aDescricao, EmptyStr) then
fdQueryPesquisa.Open('select Cod_Combustivel, Des_Combustivel, Prc_Combustivel, Imposto from COMBUSTIVEL where Des_Combustivel like ''%' + aDesCricao + ' %''');
end;
procedure TCombustivelPesquisaSllForm.PesquisaTodos;
begin
fdQueryPesquisa.Open('select Cod_Combustivel, Des_Combustivel, Prc_Combustivel, Imposto from COMBUSTIVEL');
end;
end.
| 32.88764 | 164 | 0.793645 |
fc7a832012259f2d3b072f9b3ee7fbfb512c45cd | 3,913 | pas | Pascal | turtle/graphp02.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 11 | 2015-12-12T05:13:15.000Z | 2020-10-14T13:32:08.000Z | turtle/graphp02.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| null | null | null | turtle/graphp02.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 : Points in coordinate system │
└───────────────────────────────────────────────────────────┘ *)
{
This program draw points in coordinate system. This program use
graphp01.pas. (here is graph01.pas, because there is defined just
coordinate system) This program init the point turtle (not in
Mygraph, because there we want to have metods for coordinate system)
and draw the coordinate lines to coordinates. (x,y) This metod is
very easy to undestand. Draw the parts in 20 point and finish line
to coordinate. In 20 points part are 15 points in Pd and 5 points in
Pd. (15 draw, 5 not draw) In math are all coordinate lines drawing to
coordinates. I draw parts (20 points) to coordinate and if for other
part is not space then draw the line of points to coordinate. (5 points
I drawed not in finish part, because they are in last part) Then I
make presunXY for writeing the name of point. I muth to modify presunXY,
because other situation is in quadrant 1 or quadrant 4. (this are if
constructions in draw_lines) In math are names capital letter. The
capital letter are only 26. This program can draw only 26 points to
coordinate system. (in this version are not in letters some index)
}
Uses Okor;
Type Mygraph=Object(kor)
Procedure Init;
Procedure Coordinate_system;
End;
Procedure Mygraph.Init;
Begin
kor.init(0,0,0);
End;
Procedure Mygraph.Coordinate_system;
Var i:integer;
Begin
ZmenFp(15);
PresunXY(-320,0);
ZmenXY(320,0);
PresunXY(315,5);
ZmenXY(320,0);
ZmenXY(315,-5);
PresunXY(310,-10);
Pis('x');
PresunXY(0,-240);;
ZmenXY(0,240);
PresunXY(-5,235);
ZmenXY(0,240);
ZmenXY(5,235);
PresunXY(8,230);
Pis('y');
For i:=0 to 32 do Begin
PresunXY(-320+20*i,-3);
ZmenXY(-320+20*i,3);
End;
For i:=0 to 23 do Begin
PresunXY(-3,-240+20*i);
ZmenXY(3,-240+20*i);
End;
End;
Type Point=Object(kor)
x,y:real;
ch:char;
Procedure Init(x1,y1:real; ch1:char);
Procedure Draw_lines;
End;
Procedure Point.Init(x1,y1:real; ch1:char);
Begin
x:=x1;
y:=y1;
ch:=ch1;
kor.init(x1,y1,0);
End;
Procedure Point.Draw_lines;
Var i:integer;
xp,yp:real;
Begin
If y>=0 Then Vlavo(180);
For i:=1 to round(abs(y)/20)-1 do Begin
Pd;
Dopredu(15);
Ph;
Dopredu(5);
End;
Pd;
Dopredu(abs(ysur-1));
Ph;
Domov;
If x>0 Then Vlavo(90)
Else Vpravo(90);
For i:=1 to round(abs(x)/20)-1 do Begin
Pd;
Dopredu(15);
Ph;
Dopredu(5);
End;
Pd;
Dopredu(abs(xsur-1));
Ph;
Domov;
If x>=0 Then if y>=0 Then PresunXY(x+8,y+8)
Else PresunXY(x+8,y-8)
Else if y>=0 Then PresunXY(x-8,y+8)
Else PresunXY(x-8,y-8);
Pis(ch);
End;
Var
Mg:Mygraph;
P:Point;
I:integer;
Begin
Randomize;
With Mg do Begin
Init;
Coordinate_system;
End;
For i:=1 to 10 do
With p do Begin
Init(-320+random(640),-240+random(480),chr(64+i));
ZmenFp(1+i mod 14);
Draw_lines;
CakajKlaves;
Koniec;
End;
End.
| 26.986207 | 75 | 0.517506 |
fca2ea85d06418c60139a111c6eaf3008f2e67c9 | 19,187 | pas | Pascal | package/Rx275D7/RX/Units/Animate.pas | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| 1 | 2022-02-28T11:28:18.000Z | 2022-02-28T11:28:18.000Z | package/Rx275D7/RX/Units/Animate.pas | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| null | null | null | package/Rx275D7/RX/Units/Animate.pas | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| null | null | null | {*******************************************************}
{ }
{ Delphi VCL Extensions (RX) }
{ }
{ Copyright (c) 1995, 1996 AO ROSNO }
{ Copyright (c) 1997, 1998 Master-Bank }
{ }
{*******************************************************}
unit Animate;
interface
{$I RX.INC}
uses Messages, {$IFDEF WIN32} Windows, {$ELSE} WinTypes, WinProcs, {$ENDIF}
SysUtils, Classes, Graphics, Controls, Forms, StdCtrls, Menus, RxTimer;
type
{ TRxImageControl }
TRxImageControl = class(TGraphicControl)
private
FDrawing: Boolean;
FPaintBuffered: Boolean;
{$IFDEF RX_D3}
FLock: TRTLCriticalSection;
{$ENDIF}
procedure WMPaint(var Message: TWMPaint); message WM_PAINT;
protected
FGraphic: TGraphic;
function DoPaletteChange: Boolean;
{$IFNDEF RX_D4}
procedure AdjustSize; virtual; abstract;
{$ENDIF}
procedure DoPaintImage; virtual; abstract;
procedure DoPaintControl;
procedure PaintDesignRect;
procedure PaintImage;
procedure PictureChanged;
procedure Lock;
procedure Unlock;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
{ TAnimatedImage }
TGlyphOrientation = (goHorizontal, goVertical);
TAnimatedImage = class(TRxImageControl)
private
FActive: Boolean;
FGlyph: TBitmap;
FImageWidth: Integer;
FImageHeight: Integer;
FInactiveGlyph: Integer;
FOrientation: TGlyphOrientation;
FTimer: TRxTimer;
FNumGlyphs: Integer;
FGlyphNum: Integer;
FCenter: Boolean;
FStretch: Boolean;
FTransparentColor: TColor;
FOpaque: Boolean;
FTimerRepaint: Boolean;
FOnFrameChanged: TNotifyEvent;
FOnStart: TNotifyEvent;
FOnStop: TNotifyEvent;
{$IFDEF RX_D3}
FAsyncDrawing: Boolean;
{$ENDIF}
{$IFNDEF RX_D4}
FAutoSize: Boolean;
procedure SetAutoSize(Value: Boolean);
{$ENDIF}
procedure DefineBitmapSize;
procedure ResetImageBounds;
function GetInterval: Cardinal;
procedure SetInterval(Value: Cardinal);
procedure SetActive(Value: Boolean);
{$IFDEF RX_D3}
procedure SetAsyncDrawing(Value: Boolean);
{$ENDIF}
procedure SetCenter(Value: Boolean);
procedure SetOrientation(Value: TGlyphOrientation);
procedure SetGlyph(Value: TBitmap);
procedure SetGlyphNum(Value: Integer);
procedure SetInactiveGlyph(Value: Integer);
procedure SetNumGlyphs(Value: Integer);
procedure SetStretch(Value: Boolean);
procedure SetTransparentColor(Value: TColor);
procedure SetOpaque(Value: Boolean);
procedure ImageChanged(Sender: TObject);
procedure UpdateInactive;
procedure TimerExpired(Sender: TObject);
function TransparentStored: Boolean;
procedure WMSize(var Message: TWMSize); message WM_SIZE;
protected
{$IFDEF RX_D4}
function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; override;
{$ENDIF}
function GetPalette: HPALETTE; override;
procedure AdjustSize; override;
procedure Loaded; override;
procedure Paint; override;
procedure DoPaintImage; override;
procedure FrameChanged; dynamic;
procedure Start; dynamic;
procedure Stop; dynamic;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Align;
{$IFDEF RX_D4}
property Anchors;
property Constraints;
property DragKind;
property AutoSize default True;
{$ELSE}
property AutoSize: Boolean read FAutoSize write SetAutoSize default True;
{$ENDIF}
{$IFDEF RX_D3}
property AsyncDrawing: Boolean read FAsyncDrawing write SetAsyncDrawing default False;
{$ENDIF}
property Active: Boolean read FActive write SetActive default False;
property Center: Boolean read FCenter write SetCenter default False;
property Orientation: TGlyphOrientation read FOrientation write SetOrientation
default goHorizontal;
property Glyph: TBitmap read FGlyph write SetGlyph;
property GlyphNum: Integer read FGlyphNum write SetGlyphNum default 0;
property Interval: Cardinal read GetInterval write SetInterval default 100;
property NumGlyphs: Integer read FNumGlyphs write SetNumGlyphs default 1;
property InactiveGlyph: Integer read FInactiveGlyph write SetInactiveGlyph default -1;
property TransparentColor: TColor read FTransparentColor write SetTransparentColor
stored TransparentStored;
property Opaque: Boolean read FOpaque write SetOpaque default False;
property Color;
property Cursor;
property DragCursor;
property DragMode;
property ParentColor default True;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Stretch: Boolean read FStretch write SetStretch default True;
property Visible;
property OnClick;
property OnDblClick;
property OnMouseMove;
property OnMouseDown;
property OnMouseUp;
property OnDragOver;
property OnDragDrop;
property OnEndDrag;
{$IFDEF WIN32}
property OnStartDrag;
{$ENDIF}
{$IFDEF RX_D4}
property OnEndDock;
property OnStartDock;
{$ENDIF}
{$IFDEF RX_D5}
property OnContextPopup;
{$ENDIF}
property OnFrameChanged: TNotifyEvent read FOnFrameChanged write FOnFrameChanged;
property OnStart: TNotifyEvent read FOnStart write FOnStart;
property OnStop: TNotifyEvent read FOnStop write FOnStop;
end;
{$IFDEF RX_D3}
procedure HookBitmap;
{$ENDIF}
implementation
uses RxConst, {$IFDEF RX_D3} RxHook, {$ENDIF} VCLUtils;
{$IFDEF RX_D3}
{ THackBitmap }
type
THackBitmap = class(TBitmap)
protected
procedure Draw(ACanvas: TCanvas; const Rect: TRect); override;
end;
procedure THackBitmap.Draw(ACanvas: TCanvas; const Rect: TRect);
begin
if not Empty then Canvas.Lock;
try
inherited Draw(ACanvas, Rect);
finally
if not Empty then Canvas.Unlock;
end;
end;
type
THack = class(TBitmap);
var
Hooked: Boolean = False;
procedure HookBitmap;
var
Index: Integer;
begin
if Hooked then Exit;
Index := FindVirtualMethodIndex(THack, @THack.Draw);
SetVirtualMethodAddress(TBitmap, Index, @THackBitmap.Draw);
Hooked := True;
end;
{$ENDIF RX_D3}
{ TRxImageControl }
constructor TRxImageControl.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
{$IFDEF RX_D3}
InitializeCriticalSection(FLock);
{$ENDIF}
ControlStyle := ControlStyle + [csClickEvents, csCaptureMouse, csOpaque,
{$IFDEF WIN32} csReplicatable, {$ENDIF} csDoubleClicks];
Height := 105;
Width := 105;
ParentColor := True;
end;
destructor TRxImageControl.Destroy;
begin
{$IFDEF RX_D3}
DeleteCriticalSection(FLock);
{$ENDIF}
inherited Destroy;
end;
procedure TRxImageControl.Lock;
begin
{$IFDEF RX_D3}
EnterCriticalSection(FLock);
{$ENDIF}
end;
procedure TRxImageControl.Unlock;
begin
{$IFDEF RX_D3}
LeaveCriticalSection(FLock);
{$ENDIF}
end;
procedure TRxImageControl.PaintImage;
var
Save: Boolean;
begin
with Canvas do begin
Brush.Color := Color;
FillRect(Bounds(0, 0, ClientWidth, ClientHeight));
end;
Save := FDrawing;
FDrawing := True;
try
DoPaintImage;
finally
FDrawing := Save;
end;
end;
procedure TRxImageControl.WMPaint(var Message: TWMPaint);
var
DC, MemDC: HDC;
MemBitmap, OldBitmap: HBITMAP;
begin
if FPaintBuffered then
inherited
else if Message.DC <> 0 then begin
{$IFDEF RX_D3}
Canvas.Lock;
try
{$ENDIF}
DC := Message.DC;
MemDC := GetDC(0);
MemBitmap := CreateCompatibleBitmap(MemDC, ClientWidth, ClientHeight);
ReleaseDC(0, MemDC);
MemDC := CreateCompatibleDC(0);
OldBitmap := SelectObject(MemDC, MemBitmap);
try
FPaintBuffered := True;
try
Message.DC := MemDC;
WMPaint(Message);
Message.DC := 0;
finally
FPaintBuffered := False;
end;
BitBlt(DC, 0, 0, ClientWidth, ClientHeight, MemDC, 0, 0, SRCCOPY);
finally
SelectObject(MemDC, OldBitmap);
DeleteDC(MemDC);
DeleteObject(MemBitmap);
end;
{$IFDEF RX_D3}
finally
Canvas.Unlock;
end;
{$ENDIF}
end;
end;
procedure TRxImageControl.PaintDesignRect;
begin
if csDesigning in ComponentState then
with Canvas do begin
Pen.Style := psDash;
Brush.Style := bsClear;
Rectangle(0, 0, Width, Height);
end;
end;
procedure TRxImageControl.DoPaintControl;
var
DC: HDC;
begin
{$IFDEF RX_D3}
if GetCurrentThreadID = MainThreadID then begin
Repaint;
Exit;
end;
{$ENDIF}
DC := GetDC(Parent.Handle);
try
IntersectClipRect(DC, Left, Top, Left + Width, Top + Height);
MoveWindowOrg(DC, Left, Top);
Perform(WM_PAINT, DC, 0);
finally
ReleaseDC(Parent.Handle, DC);
end;
end;
function TRxImageControl.DoPaletteChange: Boolean;
var
ParentForm: TCustomForm;
Tmp: TGraphic;
begin
Result := False;
Tmp := FGraphic;
if Visible and (not (csLoading in ComponentState)) and (Tmp <> nil)
{$IFDEF RX_D3} and (Tmp.PaletteModified) {$ENDIF} then
begin
if (GetPalette <> 0) then begin
ParentForm := GetParentForm(Self);
if Assigned(ParentForm) and ParentForm.Active and ParentForm.HandleAllocated then
begin
if FDrawing then
ParentForm.Perform(WM_QUERYNEWPALETTE, 0, 0)
else
PostMessage(ParentForm.Handle, WM_QUERYNEWPALETTE, 0, 0);
Result := True;
{$IFDEF RX_D3}
Tmp.PaletteModified := False;
{$ENDIF}
end;
end
{$IFDEF RX_D3}
else begin
Tmp.PaletteModified := False;
end;
{$ENDIF}
end;
end;
procedure TRxImageControl.PictureChanged;
begin
if not (csDestroying in ComponentState) then begin
AdjustSize;
if (FGraphic <> nil) then
if DoPaletteChange and FDrawing then Update;
if not FDrawing then Invalidate;
end;
end;
{ TAnimatedImage }
constructor TAnimatedImage.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FTimer := TRxTimer.Create(Self);
with FTimer do begin
Enabled := False;
Interval := 100;
end;
AutoSize := True;
FGlyph := TBitmap.Create;
FGraphic := FGlyph;
FGlyph.OnChange := ImageChanged;
FNumGlyphs := 1;
FInactiveGlyph := -1;
FTransparentColor := clNone;
FOrientation := goHorizontal;
FStretch := True;
end;
destructor TAnimatedImage.Destroy;
begin
Destroying;
FOnFrameChanged := nil;
FOnStart := nil;
FOnStop := nil;
FGlyph.OnChange := nil;
Active := False;
FGlyph.Free;
inherited Destroy;
end;
procedure TAnimatedImage.Loaded;
begin
inherited Loaded;
ResetImageBounds;
UpdateInactive;
end;
function TAnimatedImage.GetPalette: HPALETTE;
begin
Result := 0;
if not FGlyph.Empty then Result := FGlyph.Palette;
end;
procedure TAnimatedImage.ImageChanged(Sender: TObject);
begin
Lock;
try
FTransparentColor := FGlyph.TransparentColor and not PaletteMask;
finally
Unlock;
end;
DefineBitmapSize;
PictureChanged;
end;
procedure TAnimatedImage.UpdateInactive;
begin
if (not Active) and (FInactiveGlyph >= 0) and
(FInactiveGlyph < FNumGlyphs) and (FGlyphNum <> FInactiveGlyph) then
begin
Lock;
try
FGlyphNum := FInactiveGlyph;
finally
Unlock;
end;
end;
end;
function TAnimatedImage.TransparentStored: Boolean;
begin
Result := (FGlyph.Empty and (FTransparentColor <> clNone)) or
((FGlyph.TransparentColor and not PaletteMask) <>
FTransparentColor);
end;
procedure TAnimatedImage.SetOpaque(Value: Boolean);
begin
if Value <> FOpaque then begin
Lock;
try
FOpaque := Value;
finally
Unlock;
end;
PictureChanged;
end;
end;
procedure TAnimatedImage.SetTransparentColor(Value: TColor);
begin
if Value <> TransparentColor then begin
Lock;
try
FTransparentColor := Value;
finally
Unlock;
end;
PictureChanged;
end;
end;
procedure TAnimatedImage.SetOrientation(Value: TGlyphOrientation);
begin
if FOrientation <> Value then begin
Lock;
try
FOrientation := Value;
finally
Unlock;
end;
ImageChanged(FGlyph);
end;
end;
procedure TAnimatedImage.SetGlyph(Value: TBitmap);
begin
Lock;
try
FGlyph.Assign(Value);
finally
Unlock;
end;
end;
procedure TAnimatedImage.SetStretch(Value: Boolean);
begin
if Value <> FStretch then begin
Lock;
try
FStretch := Value;
finally
Unlock;
end;
PictureChanged;
if Active then Repaint;
end;
end;
procedure TAnimatedImage.SetCenter(Value: Boolean);
begin
if Value <> FCenter then begin
Lock;
try
FCenter := Value;
finally
Unlock;
end;
PictureChanged;
if Active then Repaint;
end;
end;
procedure TAnimatedImage.SetGlyphNum(Value: Integer);
begin
if Value <> FGlyphNum then begin
if (Value < FNumGlyphs) and (Value >= 0) then begin
Lock;
try
FGlyphNum := Value;
finally
Unlock;
end;
UpdateInactive;
FrameChanged;
PictureChanged;
end;
end;
end;
procedure TAnimatedImage.SetInactiveGlyph(Value: Integer);
begin
if Value < 0 then Value := -1;
if Value <> FInactiveGlyph then begin
if (Value < FNumGlyphs) or (csLoading in ComponentState) then begin
Lock;
try
FInactiveGlyph := Value;
UpdateInactive;
finally
Unlock;
end;
FrameChanged;
PictureChanged;
end;
end;
end;
procedure TAnimatedImage.SetNumGlyphs(Value: Integer);
begin
Lock;
try
FNumGlyphs := Value;
if FInactiveGlyph >= FNumGlyphs then begin
FInactiveGlyph := -1;
FGlyphNum := 0;
end
else UpdateInactive;
ResetImageBounds;
finally
Unlock;
end;
FrameChanged;
PictureChanged;
end;
procedure TAnimatedImage.DefineBitmapSize;
begin
Lock;
try
FNumGlyphs := 1;
FGlyphNum := 0;
FImageWidth := 0;
FImageHeight := 0;
if (FOrientation = goHorizontal) and (FGlyph.Height > 0) and
(FGlyph.Width mod FGlyph.Height = 0) then
FNumGlyphs := FGlyph.Width div FGlyph.Height
else if (FOrientation = goVertical) and (FGlyph.Width > 0) and
(FGlyph.Height mod FGlyph.Width = 0) then
FNumGlyphs := FGlyph.Height div FGlyph.Width;
ResetImageBounds;
finally
Unlock;
end;
end;
procedure TAnimatedImage.ResetImageBounds;
begin
if FNumGlyphs < 1 then FNumGlyphs := 1;
if FOrientation = goHorizontal then begin
FImageHeight := FGlyph.Height;
FImageWidth := FGlyph.Width div FNumGlyphs;
end
else {if Orientation = goVertical then} begin
FImageWidth := FGlyph.Width;
FImageHeight := FGlyph.Height div FNumGlyphs;
end;
end;
procedure TAnimatedImage.AdjustSize;
begin
if not (csReading in ComponentState) then begin
if AutoSize and (FImageWidth > 0) and (FImageHeight > 0) then
SetBounds(Left, Top, FImageWidth, FImageHeight);
end;
end;
procedure TAnimatedImage.DoPaintImage;
var
BmpIndex: Integer;
SrcRect, DstRect: TRect;
{Origin: TPoint;}
begin
if (not Active) and (FInactiveGlyph >= 0) and
(FInactiveGlyph < FNumGlyphs) then BmpIndex := FInactiveGlyph
else BmpIndex := FGlyphNum;
{ copy image from parent and back-level controls }
if not FOpaque then CopyParentImage(Self, Canvas);
if (FImageWidth > 0) and (FImageHeight > 0) then begin
if Orientation = goHorizontal then
SrcRect := Bounds(BmpIndex * FImageWidth, 0, FImageWidth, FImageHeight)
else {if Orientation = goVertical then}
SrcRect := Bounds(0, BmpIndex * FImageHeight, FImageWidth, FImageHeight);
if Stretch then DstRect := ClientRect
else if Center then
DstRect := Bounds((ClientWidth - FImageWidth) div 2,
(ClientHeight - FImageHeight) div 2, FImageWidth, FImageHeight)
else
DstRect := Rect(0, 0, FImageWidth, FImageHeight);
with DstRect do
StretchBitmapRectTransparent(Canvas, Left, Top, Right - Left,
Bottom - Top, SrcRect, FGlyph, FTransparentColor);
end;
end;
procedure TAnimatedImage.Paint;
begin
PaintImage;
if (not Opaque) or FGlyph.Empty then
PaintDesignRect;
end;
procedure TAnimatedImage.TimerExpired(Sender: TObject);
begin
{$IFDEF RX_D3}
if csPaintCopy in ControlState then Exit;
{$ENDIF}
if Visible and (FNumGlyphs > 1) and (Parent <> nil) and
Parent.HandleAllocated then
begin
Lock;
try
if FGlyphNum < FNumGlyphs - 1 then Inc(FGlyphNum)
else FGlyphNum := 0;
if (FGlyphNum = FInactiveGlyph) and (FNumGlyphs > 1) then begin
if FGlyphNum < FNumGlyphs - 1 then Inc(FGlyphNum)
else FGlyphNum := 0;
end;
{$IFDEF RX_D3}
Canvas.Lock;
try
FTimerRepaint := True;
if AsyncDrawing and Assigned(FOnFrameChanged) then
FTimer.Synchronize(FrameChanged)
else FrameChanged;
DoPaintControl;
finally
FTimerRepaint := False;
Canvas.Unlock;
end;
{$ELSE}
FTimerRepaint := True;
try
FrameChanged;
Repaint;
finally
FTimerRepaint := False;
end;
{$ENDIF}
finally
Unlock;
end;
end;
end;
procedure TAnimatedImage.FrameChanged;
begin
if Assigned(FOnFrameChanged) then FOnFrameChanged(Self);
end;
procedure TAnimatedImage.Stop;
begin
if not (csReading in ComponentState) then
if Assigned(FOnStop) then FOnStop(Self);
end;
procedure TAnimatedImage.Start;
begin
if not (csReading in ComponentState) then
if Assigned(FOnStart) then FOnStart(Self);
end;
{$IFNDEF RX_D4}
procedure TAnimatedImage.SetAutoSize(Value: Boolean);
begin
if Value <> FAutoSize then begin
FAutoSize := Value;
PictureChanged;
end;
end;
{$ENDIF}
{$IFDEF RX_D4}
function TAnimatedImage.CanAutoSize(var NewWidth, NewHeight: Integer): Boolean;
begin
Result := True;
if not (csDesigning in ComponentState) and (FImageWidth > 0) and
(FImageHeight > 0) then
begin
if Align in [alNone, alLeft, alRight] then
NewWidth := FImageWidth;
if Align in [alNone, alTop, alBottom] then
NewHeight := FImageHeight;
end;
end;
{$ENDIF}
procedure TAnimatedImage.SetInterval(Value: Cardinal);
begin
FTimer.Interval := Value;
end;
function TAnimatedImage.GetInterval: Cardinal;
begin
Result := FTimer.Interval;
end;
procedure TAnimatedImage.SetActive(Value: Boolean);
begin
if FActive <> Value then begin
if Value then begin
FTimer.OnTimer := TimerExpired;
FTimer.Enabled := True;
FActive := FTimer.Enabled;
Start;
end
else begin
FTimer.Enabled := False;
FTimer.OnTimer := nil;
FActive := False;
UpdateInactive;
FrameChanged;
Stop;
PictureChanged;
end;
end;
end;
{$IFDEF RX_D3}
procedure TAnimatedImage.SetAsyncDrawing(Value: Boolean);
begin
if FAsyncDrawing <> Value then begin
Lock;
try
if Value then HookBitmap;
if Assigned(FTimer) then FTimer.SyncEvent := not Value;
FAsyncDrawing := Value;
finally
Unlock;
end;
end;
end;
{$ENDIF}
procedure TAnimatedImage.WMSize(var Message: TWMSize);
begin
inherited;
{$IFNDEF RX_D4}
AdjustSize;
{$ENDIF}
end;
end. | 23.62931 | 90 | 0.685099 |
fc2dedd8c68188cf5f8fd4f4516c56f5b228e6be | 78,134 | pas | Pascal | source/UI.Frame.pas | jonahzheng/FMXUI | c59e718cfc82d738fe9f295e811d3da11aafecdb | [
"MIT"
]
| 211 | 2016-02-09T14:51:53.000Z | 2022-03-24T13:31:26.000Z | source/UI.Frame.pas | jonahzheng/FMXUI | c59e718cfc82d738fe9f295e811d3da11aafecdb | [
"MIT"
]
| 39 | 2017-03-27T05:49:25.000Z | 2022-03-25T01:32:12.000Z | source/UI.Frame.pas | jonahzheng/FMXUI | c59e718cfc82d738fe9f295e811d3da11aafecdb | [
"MIT"
]
| 81 | 2016-09-10T08:27:28.000Z | 2022-03-27T13:30:09.000Z | {*******************************************************}
{ }
{ FMX UI Frame 管理单元 }
{ }
{ 版权所有 (C) 2016 YangYxd }
{ }
{*******************************************************}
unit UI.Frame;
interface
uses
UI.Base, UI.Toast, UI.Dialog, UI.Ani,
System.NetEncoding,
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
System.Generics.Collections, System.Rtti, System.SyncObjs, System.Messaging,
{$IFDEF ANDROID}
FMX.Platform.Android,
FMX.VirtualKeyboard.Android,
{$ENDIF}
{$IFDEF POSIX}Posix.Signal, {$ENDIF}
FMX.Ani, FMX.VirtualKeyboard,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Platform, IOUtils;
type
TFrameView = class;
TFrameViewClass = class of TFrameView;
TNotifyEventA = UI.Ani.TNotifyEventA;
TFrameAniType = UI.Ani.TFrameAniType;
TFrameAnimator = UI.Ani.TFrameAnimator;
/// <summary>
/// Frame 参数
/// </summary>
TFrameParams = class(TDictionary<string, TValue>);
TFrameDataType = (fdt_Integer, fdt_Long, fdt_Int64, fdt_Float, fdt_String,
fdt_DateTime, fdt_Number, fdt_Boolean);
TFrameDataValue = record
DataType: TFrameDataType;
Value: TValue;
end;
/// <summary>
/// Frame 状态数据
/// </summary>
TFrameStateData = class(TDictionary<string, TFrameDataValue>);
TFrameStateDataHelper = class helper for TFrameStateData
function GetDataValue(DataType: TFrameDataType; const Value: TValue): TFrameDataValue;
function GetString(const Key: string): string;
function GetInt(const Key: string; const DefaultValue: Integer = 0): Integer;
function GetLong(const Key: string; const DefaultValue: Cardinal = 0): Cardinal;
function GetInt64(const Key: string; const DefaultValue: Int64 = 0): Int64;
function GetFloat(const Key: string; const DefaultValue: Double = 0): Double;
function GetDateTime(const Key: string; const DefaultValue: TDateTime = 0): TDateTime;
function GetNumber(const Key: string; const DefaultValue: NativeUInt = 0): NativeUInt;
function GetPointer(const Key: string): Pointer;
function GetBoolean(const Key: string; const DefaultValue: Boolean = False): Boolean;
function Put(const Key: string; const Value: string): TFrameStateData; overload; inline;
function Put(const Key: string; const Value: Integer): TFrameStateData; overload; inline;
function Put(const Key: string; const Value: Cardinal): TFrameStateData; overload; inline;
function Put(const Key: string; const Value: Int64): TFrameStateData; overload; inline;
function Put(const Key: string; const Value: Double): TFrameStateData; overload; inline;
function Put(const Key: string; const Value: NativeUInt): TFrameStateData; overload; inline;
function Put(const Key: string; const Value: Boolean): TFrameStateData; overload; inline;
function PutDateTime(const Key: string; const Value: TDateTime): TFrameStateData; inline;
end;
TFrameParamsHelper = class helper for TFrameParams
function GetString(const Key: string): string;
function GetInt(const Key: string; const DefaultValue: Integer = 0): Integer;
function GetLong(const Key: string; const DefaultValue: Cardinal = 0): Cardinal;
function GetInt64(const Key: string; const DefaultValue: Int64 = 0): Int64;
function GetFloat(const Key: string; const DefaultValue: Double = 0): Double;
function GetDateTime(const Key: string; const DefaultValue: TDateTime = 0): TDateTime;
function GetNumber(const Key: string; const DefaultValue: NativeUInt = 0): NativeUInt;
function GetPointer(const Key: string): Pointer;
function GetBoolean(const Key: string; const DefaultValue: Boolean = False): Boolean;
function Put(const Key: string; const Value: string): TFrameParams; overload;
function Put(const Key: string; const Value: Integer): TFrameParams; overload;
function Put(const Key: string; const Value: Cardinal): TFrameParams; overload;
function Put(const Key: string; const Value: Int64): TFrameParams; overload;
function Put(const Key: string; const Value: Double): TFrameParams; overload;
function Put(const Key: string; const Value: NativeUInt): TFrameParams; overload;
function Put(const Key: string; const Value: Boolean): TFrameParams; overload;
function PutDateTime(const Key: string; const Value: TDateTime): TFrameParams;
end;
/// <summary>
/// Frame 状态
/// </summary>
TFrameState = class(TObject)
private
[Weak] FOwner: TComponent;
FData: TFrameStateData;
FIsChange: Boolean;
FIsPublic: Boolean;
FIsLoad: Boolean;
FLocker: TCriticalSection;
function GetCount: Integer;
function GetStoragePath: string;
procedure SetStoragePath(const Value: string);
protected
procedure InitData;
procedure DoValueNotify(Sender: TObject; const Item: TFrameDataValue;
Action: TCollectionNotification);
function GetUniqueName: string;
function GetFileName(const FileName: string): string;
procedure Load();
public
constructor Create(AOwner: TComponent; IsPublic: Boolean);
destructor Destroy; override;
procedure Clear();
procedure Save();
function Exist(const Key: string): Boolean;
function ContainsKey(const Key: string): Boolean;
function GetString(const Key: string): string;
function GetInt(const Key: string; const DefaultValue: Integer = 0): Integer;
function GetLong(const Key: string; const DefaultValue: Cardinal = 0): Cardinal;
function GetInt64(const Key: string; const DefaultValue: Int64 = 0): Int64;
function GetFloat(const Key: string; const DefaultValue: Double = 0): Double;
function GetDateTime(const Key: string; const DefaultValue: TDateTime = 0): TDateTime;
function GetNumber(const Key: string; const DefaultValue: NativeUInt = 0): NativeUInt;
function GetBoolean(const Key: string; const DefaultValue: Boolean = False): Boolean;
procedure Put(const Key: string; const Value: string); overload;
procedure Put(const Key: string; const Value: Integer); overload;
procedure Put(const Key: string; const Value: Cardinal); overload;
procedure Put(const Key: string; const Value: Int64); overload;
procedure Put(const Key: string; const Value: Double); overload;
procedure Put(const Key: string; const Value: NativeUInt); overload;
procedure Put(const Key: string; const Value: Boolean); overload;
procedure PutDateTime(const Key: string; const Value: TDateTime);
/// <summary>
/// 保存文件流
/// </summary>
function SaveFile(const FileName: string; const Data: TStream): Boolean;
/// <summary>
/// 读取指定的文件流
/// </summary>
function ReadFile(const FileName: string; var OutData: TStream): Boolean;
property Data: TFrameStateData read FData;
property Count: Integer read GetCount;
property StoragePath: string read GetStoragePath write SetStoragePath;
end;
TCustomFormHelper = class Helper for TCustomForm
public
procedure SetFocus();
end;
/// <summary>
/// Frame 视图, Frame 切换处理
/// </summary>
[ComponentPlatformsAttribute(AllCurrentPlatforms)]
TFrameView = class(FMX.Forms.TFrame)
private
FDefaultAni: TFrameAniType;
FParams: TFrameParams;
FPrivateState: TFrameState;
FBackColor: TAlphaColor;
FStatusColor: TAlphaColor;
FStatusLight: Boolean;
FStatusTransparent: Boolean;
FUseDefaultBackColor: Boolean;
FUseDefaultStatusColor: Boolean;
FUseDefaultStatusLight: Boolean;
FUseDefaultStatusTransparent: Boolean;
FOnShow: TNotifyEvent;
FOnHide: TNotifyEvent;
FOnFinish: TNotifyEvent;
FOnReStart: TNotifyEvent;
FOnFree: TNotifyEvent;
FWaitDialog: TProgressDialog;
[weak] FToastManager: TToastManager;
FShowing: Boolean; // 正在显示中
FHideing: Boolean; // 正在隐藏中
FAnimateing: Boolean; // 动画执行中
FNeedFree: Boolean; // 需要释放
FNeedHide: Boolean; // 需要隐藏
FNeedFinish: Boolean; // 需要关闭
FNeedDoCreate: Boolean; // 需要执行DoCreate;
FResumed: Boolean;
procedure SetParams(const Value: TFrameParams);
function GetTitle: string;
procedure SetTitle(const Value: string);
function GetDataString: string;
procedure SetDataString(const Value: string);
function GetPreferences: TFrameState;
function GetSharedPreferences: TFrameState;
function GetParams: TFrameParams;
function GetDataAsPointer: Pointer;
function GetIsWaitDismiss: Boolean;
function GetStatusColor: TAlphaColor;
procedure SetStatusColor(const Value: TAlphaColor);
function GetStatusLight: Boolean;
procedure SetStatusLight(const Value: Boolean);
function GetStatusTransparent: Boolean;
procedure SetStatusTransparent(const Value: Boolean);
function GetParentForm: TCustomForm;
function GetBackColor: TAlphaColor;
procedure SetBackColor(const Value: TAlphaColor);
function GetIsDestroy: Boolean;
function FinishIsFreeApp: Boolean;
function GetActiveFrame: TFrameView;
protected
class var FActiveFrames: TDictionary<TCommonCustomForm, TFrameView>;
class procedure DoActivateMessage(const Sender: TObject; const M: TMessage);
protected
[Weak] FLastView: TFrameView;
[Weak] FNextView: TFrameView;
function MakeFrame(FrameClass: TFrameViewClass): TFrameView; overload;
/// <summary>
/// Frame 初始化时触发
/// </summary>
procedure DoCreate(); virtual;
/// <summary>
/// Frame 正在显示之前触发
/// </summary>
procedure DoShow(); virtual;
/// <summary>
/// Frame 隐藏显示时触发 (尽量使用 DoFinish )
/// </summary>
procedure DoHide(); virtual;
/// <summary>
/// 检测当前Frame是否允许关闭
/// </summary>
function DoCanFinish(): Boolean; virtual;
/// <summary>
/// 检测当前Frame是否允许被键盘关闭
/// </summary>
function DoCanKeyFinish(): Boolean; virtual;
/// <summary>
/// Frame 需要关闭时,在关闭之前触发
/// </summary>
procedure DoFinish(); virtual;
/// <summary>
/// Frame 在重新显示之前触发
/// </summary>
procedure DoReStart(); virtual;
/// <summary>
/// Frame 在释放时触发
/// </summary>
procedure DoFree(); virtual;
/// <summary>
/// 检测是否允许暂停
/// </summary>
function DoCanPause: Boolean; virtual;
/// <summary>
/// Frame 在前端时触发
/// </summary>
procedure DoResume; virtual;
/// <summary>
/// Frame 离开前端时触发
/// </summary>
procedure DoPause; virtual;
function GetData: TValue; override;
procedure SetData(const Value: TValue); override;
function GetToastManager: TToastManager; virtual;
/// <summary>
/// 检测是否允许释放
/// </summary>
function DoCanFree(): Boolean; virtual;
// 检查是否需要释放,如果需要,就释放掉
function CheckFree(): Boolean; virtual;
// 检查所属窗体是否还存在 Frame
function CheckChildern(): Boolean;
// 内部 Show 实现
procedure InternalShow(TriggerOnShow: Boolean; AOnFinish: TNotifyEventA = nil;
Ani: TFrameAniType = TFrameAniType.DefaultAni; SwitchFlag: Boolean = False);
procedure InternalHide();
protected
procedure Paint; override;
procedure SetParent(const Value: TFmxObject); override;
procedure AfterDialogKey(var Key: Word; Shift: TShiftState); override;
protected
/// <summary>
/// 播放动画
/// <param name="Ani">动画类型</param>
/// <param name="IsIn">是否是正要显示</param>
/// <param name="SwitchFlag">动画切换标志</param>
/// <param name="AEvent">动画播放完成事件</param>
/// </summary>
procedure AnimatePlay(Ani: TFrameAniType; IsIn, SwitchFlag: Boolean; AEvent: TNotifyEventA);
procedure OnFinishOrClose(Sender: TObject);
public
class constructor Create;
class destructor Destroy;
class function GetFormActiveFrame(AForm: TCommonCustomForm; var AFrame: TFrameView): Boolean;
class procedure SetFormActiveFrame(AForm: TCommonCustomForm; AFrame: TFrameView);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
/// <summary>
/// 终止APP
/// </summary>
class procedure AppTerminate();
/// <summary>
/// 设置 Frame 默认背景颜色
/// </summary>
class procedure SetDefaultBackColor(const Value: TAlphaColor);
/// <summary>
/// 设置 Frame 默认状态条颜色
/// </summary>
class procedure SetDefaultStatusColor(const Value: TAlphaColor);
/// <summary>
/// 设置 Frame 默认状态条透明
/// </summary>
class procedure SetDefaultStatusTransparent(const Value: Boolean);
/// <summary>
/// 设置 Frame 默认状态条黑色图标
/// </summary>
class procedure SetDefaultStatusLight(const Value: Boolean);
/// <summary>
/// 设置 Frame 状态栏透明新方法,浅色状态栏和全透明必须开启这个
/// </summary>
class procedure SetStatusTransparentNewMethod(const Value: Boolean);
/// <summary>
/// 更新状态栏
/// </summary>
class procedure UpdateStatusBar(const AForm: TCommonCustomForm; const AColor: TAlphaColor; const ATransparent: Boolean; const ALight: Boolean); overload;
class procedure UpdateStatusBar; overload;
/// <summary>
/// 刷新当前Frame状态栏
/// </summary>
procedure RefreshStatusBar;
/// <summary>
/// 流转化为 string
/// </summary>
function StreamToString(SrcStream: TStream; const CharSet: string = ''): string;
/// <summary>
/// 显示等待对话框
/// </summary>
procedure ShowWaitDialog(const AMsg: string; ACancelable: Boolean = True); overload;
procedure ShowWaitDialog(const AMsg: string; OnDismissListener: TOnDialogListener; ACancelable: Boolean = True); overload;
procedure ShowWaitDialog(const AMsg: string; OnDismissListener: TOnDialogListenerA; ACancelable: Boolean = True); overload;
/// <summary>
/// 更新等待对话框消息内容
/// </summary>
procedure UpdateWaitDialog(const AMsg: string);
/// <summary>
/// 隐藏等待对话框
/// </summary>
procedure HideWaitDialog();
/// <summary>
/// 显示 Frame
/// </summary>
class function ShowFrame(Parent: TFmxObject; Params: TFrameParams;
Ani: TFrameAniType = TFrameAniType.None; SwitchFlag: Boolean = False): TFrameView; overload;
/// <summary>
/// 显示 Frame
/// </summary>
class function ShowFrame(Parent: TFmxObject; const Title: string = ''; Ani: TFrameAniType = TFrameAniType.None;
SwitchFlag: Boolean = False): TFrameView; overload;
/// <summary>
/// 显示 Frame
/// </summary>
class function CreateFrame(Parent: TFmxObject; Params: TFrameParams): TFrameView; overload;
/// <summary>
/// 显示 Frame
/// </summary>
class function CreateFrame(Parent: TFmxObject; const Title: string = ''): TFrameView; overload;
/// <summary>
/// 开始一个视图,并隐藏当前视图
/// </summary>
function StartFrame(FrameClass: TFrameViewClass; Ani: TFrameAniType = TFrameAniType.DefaultAni): TFrameView; overload;
/// <summary>
/// 开始一个视图,并隐藏当前视图
/// </summary>
function StartFrame(FrameClass: TFrameViewClass; Params: TFrameParams; Ani: TFrameAniType = TFrameAniType.DefaultAni): TFrameView; overload;
/// <summary>
/// 开始一个视图,并隐藏当前视图
/// </summary>
function StartFrame(FrameClass: TFrameViewClass; const Title: string; Ani: TFrameAniType = TFrameAniType.DefaultAni): TFrameView; overload;
/// <summary>
/// 开始一个视图,并隐藏当前视图
/// </summary>
function StartFrame(FrameClass: TFrameViewClass; const Title: string; const Data: TValue; Ani: TFrameAniType = TFrameAniType.DefaultAni): TFrameView; overload;
/// <summary>
/// 开始一个视图,并隐藏当前视图
/// </summary>
function StartFrame(FrameClass: TFrameViewClass; const Title: string; const DataString: string; Ani: TFrameAniType = TFrameAniType.DefaultAni): TFrameView; overload;
/// <summary>
/// 显示一个提示消息
/// </summary>
procedure Hint(const Msg: string); overload;
procedure Hint(const Msg: Double); overload;
procedure Hint(const Msg: Int64); overload;
procedure Hint(const AFormat: string; const Args: array of const); overload;
/// <summary>
/// 延时执行任务
/// </summary>
procedure DelayExecute(ADelay: Single; AExecute: TNotifyEventA);
/// <summary>
/// 显示 Frame
/// </summary>
procedure Show(); overload; override;
procedure Show(Ani: TFrameAniType; AOnFinish: TNotifyEventA;
SwitchFlag: Boolean = False;
TriggerOnShow: Boolean = True); reintroduce; overload;
/// <summary>
/// 关闭 Frame
/// </summary>
procedure Close(); overload;
procedure Close(Ani: TFrameAniType); overload; virtual;
/// <summary>
/// 隐藏 Frame
/// </summary>
procedure Hide(); overload; override;
procedure Hide(Ani: TFrameAniType; SwitchFlag: Boolean = False); reintroduce; overload;
/// <summary>
/// 完成当前 Frame (返回上一个 Frame 或 关闭)
/// </summary>
procedure Finish(); overload; virtual;
procedure Finish(Ani: TFrameAniType); overload; virtual;
/// <summary>
/// 开始/重新开始当前Frame
/// </summary>
procedure Resume; virtual;
/// <summary>
/// 暂停当前Frame
/// </summary>
procedure Pause(AFinish: Boolean = False); virtual;
/// <summary>
/// 启动时的参数
/// </summary>
property Params: TFrameParams read GetParams write SetParams;
/// <summary>
/// 启动此Frame的Frame
/// </summary>
property Last: TFrameView read FLastView;
/// <summary>
/// 私有预设参数 (私有,非线程安全)
/// </summary>
property Preferences: TFrameState read GetPreferences;
/// <summary>
/// 共有预设参数 (全局,非线程安全)
/// </summary>
property SharedPreferences: TFrameState read GetSharedPreferences;
/// <summary>
/// 是否正在Show
/// </summary>
property Showing: Boolean read FShowing;
property DataAsPointer: Pointer read GetDataAsPointer;
/// <summary>
/// 当前 Frame 所绑定的 Form 对象
/// </summary>
property ParentForm: TCustomForm read GetParentForm;
/// <summary>
/// 当前 Frame 所绑定的 Form 对象对应的活动Frame
/// </summary>
property ActiveFrame: TFrameView read GetActiveFrame;
/// <summary>
/// 等待对话框是否被取消了
/// </summary>
property IsWaitDismiss: Boolean read GetIsWaitDismiss;
/// <summary>
/// 是否已经释放
/// </summary>
property IsDestroy: Boolean read GetIsDestroy;
/// <summary>
/// 是否使用了默认背景色
/// </summary>
property IsUseDefaultBackColor: Boolean read FUseDefaultBackColor;
/// <summary>
/// 是否在前台
/// </summary>
property IsResumed: Boolean read FResumed;
published
property Title: string read GetTitle write SetTitle;
property DataString: string read GetDataString write SetDataString;
/// <summary>
/// 背景颜色
/// </summary>
property BackColor: TAlphaColor read GetBackColor write SetBackColor;
/// <summary>
/// APP 顶部状态条颜色
/// </summary>
property StatusColor: TAlphaColor read GetStatusColor write SetStatusColor;
/// <summary>
/// APP 顶部状态条透明
/// </summary>
property StatusTransparent: Boolean read GetStatusTransparent write SetStatusTransparent;
/// <summary>
/// APP 顶部状态条黑色图标
/// </summary>
property StatusLight: Boolean read GetStatusLight write SetStatusLight;
property OnShow: TNotifyEvent read FOnShow write FOnShow;
property OnHide: TNotifyEvent read FOnHide write FOnHide;
property OnFinish: TNotifyEvent read FOnFinish write FOnFinish;
property OnReStart: TNotifyEvent read FOnReStart write FOnReStart;
property OnFree: TNotifyEvent read FOnFree write FOnFree;
end;
type
TFrame = class(TFrameView);
TFrameClass = type of TFrame;
const
CS_Title = 'cs_p_title';
CS_Data = 'cs_p_data';
CS_DataStr = 'cs_p_data_str';
var
/// <summary>
/// 默认过场动画
/// </summary>
DefaultAnimate: TFrameAniType = TFrameAniType.MoveInOut;
implementation
{$IFDEF ANDROID}
uses
{$IF CompilerVersion >= 34}
Androidapi.AppGlue,
Androidapi.NativeActivity,
{$ENDIF}
Androidapi.Helpers,
Androidapi.Jni,
//Androidapi.JNI.Media,
Androidapi.JNIBridge,
Androidapi.JNI.Embarcadero,
Androidapi.JNI.JavaTypes,
Androidapi.JNI.GraphicsContentViewText,
Androidapi.JNI.Util,
Androidapi.JNI.App,
Androidapi.JNI.Os,
FMX.Helpers.Android;
{$ENDIF}
var
/// <summary>
/// 公共状态数据
/// </summary>
FPublicState: TFrameState = nil;
FDefaultBackColor: TAlphaColor = 0;
FDefaultStatusColor: TAlphaColor = 0;
FDefaultStatusTransparent: Boolean = False;
FDefaultStatusLight: Boolean = True;
FStatusTransparentNewMethod: Boolean = False;
{$IFDEF ANDROID}
{$IF CompilerVersion >= 33}
type
// 感谢 谭钦
// 监听创建事件
TKSCListener = class(TJavaLocal, JOnKeyboardStateChangedListener)
public
{ JOnKeyboardStateChangedListener }
procedure onVirtualKeyboardWillShown; cdecl;
procedure onVirtualKeyboardFrameChanged(newFrame: JRect); cdecl;
procedure onVirtualKeyboardWillHidden; cdecl;
end;
var
FKSListener: TKSCListener = nil;
FSystemUiVisibility: Integer = -1;
{$ENDIF}
{$IF CompilerVersion >= 34}
type
TMyAndroidApplicationGlue = class(TAndroidApplicationGlue)
private
class var FOldonWindowFocusChanged: TOnWindowFocusChangedCallback;
/// <summary>Called when window changes focus</summary>
class procedure onWindowFocusChanged(activity: PANativeActivity; focused: Integer); cdecl; static;
class procedure BindCallbacks;
class function GetActivityCallbacks: PANativeActivityCallbacks;
end;
{$ENDIF}
// 解决有时返回键失效问题
var
FVKState: PByte = nil;
FFirstCreateFrame: Boolean = True;
procedure UpdateAndroidKeyboardServiceState;
var
ASvc: IFMXVirtualKeyboardService;
AContext: TRttiContext;
AType: TRttiType;
AField: TRttiField;
AInst: TVirtualKeyboardAndroid;
begin
Exit;
if not Assigned(FVKState) then begin
if (not Assigned(Screen.FocusControl)) and
TPlatformServices.Current.SupportsPlatformService
(IFMXVirtualKeyboardService, ASvc) then
begin
AInst := ASvc as TVirtualKeyboardAndroid;
AContext := TRttiContext.Create;
AType := AContext.GetType(TVirtualKeyboardAndroid);
AField := AType.GetField('FState');
if AField.GetValue(AInst).AsOrdinal <> 0 then
begin
FVKState := PByte(AInst);
Inc(FVKState, AField.Offset);
end;
end;
end;
if Assigned(FVKState) and (FVKState^ <> 0) then
FVKState^ := 0;
end;
function AlphaColorToJColor(const AColor: TAlphaColor): Integer;
begin
Result := TJColor.JavaClass.argb(TAlphaColorRec(AColor).A, TAlphaColorRec(AColor).R,
TAlphaColorRec(AColor).G, TAlphaColorRec(AColor).B);
end;
{$IF CompilerVersion >= 33}
{ TKSCListener }
procedure TKSCListener.onVirtualKeyboardFrameChanged(newFrame: JRect);
begin
// 底部导航栏隐藏显示,也会触发这里,说白了,这里是布局改变都会触发
TFrameView.UpdateStatusBar;
TThread.CreateAnonymousThread(procedure begin
TFrameView.UpdateStatusBar;
end).Start;
end;
procedure TKSCListener.onVirtualKeyboardWillHidden;
begin
TFrameView.UpdateStatusBar;
TThread.CreateAnonymousThread(procedure begin
TFrameView.UpdateStatusBar;
end).Start;
end;
procedure TKSCListener.onVirtualKeyboardWillShown;
begin
TFrameView.UpdateStatusBar;
end;
{$ENDIF}
{$IF CompilerVersion >= 34}
class procedure TMyAndroidApplicationGlue.onWindowFocusChanged(activity: PANativeActivity; focused: Integer); cdecl;
begin
if Assigned(FOldonWindowFocusChanged) then
FOldonWindowFocusChanged(activity, focused);
if focused <> 0 then
TFrameView.DoActivateMessage(nil, TApplicationEventMessage.Create(TApplicationEventData.Create(TApplicationEvent.BecameActive, nil)))
else
TFrameView.DoActivateMessage(nil, TApplicationEventMessage.Create(TApplicationEventData.Create(TApplicationEvent.WillBecomeInactive, nil)))
end;
class procedure TMyAndroidApplicationGlue.BindCallbacks;
begin
with GetActivityCallbacks^ do begin
FOldonWindowFocusChanged := onWindowFocusChanged;
onWindowFocusChanged := @TMyAndroidApplicationGlue.onWindowFocusChanged;
end;
end;
class function TMyAndroidApplicationGlue.GetActivityCallbacks: PANativeActivityCallbacks;
begin
Result := Current.NativeActivity.callbacks;
end;
{$ENDIF}
{$ENDIF}
{ TFrameView }
procedure TFrameView.AfterDialogKey(var Key: Word; Shift: TShiftState);
begin
// 如果按下了返回键,且允许取消对话框,则关闭对话框
if DoCanKeyFinish and (Key in [vkEscape, vkHardwareBack]) then begin
Key := 0;
Finish;
end else
inherited AfterDialogKey(Key, Shift);
end;
procedure TFrameView.AnimatePlay(Ani: TFrameAniType; IsIn, SwitchFlag: Boolean;
AEvent: TNotifyEventA);
// 淡入淡出
procedure DoFadeInOut();
var
NewValue: Single;
begin
if IsIn then begin
if SwitchFlag then begin
Self.Opacity := 1;
TFrameAnimator.DelayExecute(Self, AEvent, 0.2);
end else begin
NewValue := 1;
TFrameAnimator.AnimateFloat(Self, 'Opacity', NewValue, AEvent, 0.2);
end;
end else begin
if FinishIsFreeApp then begin
if Assigned(AEvent) then
AEvent(Self);
Exit;
end;
if SwitchFlag then begin
NewValue := 0;
TFrameAnimator.AnimateFloat(Self, 'Opacity', NewValue, AEvent, 0.2);
end else begin
TFrameAnimator.DelayExecute(Self, AEvent, 0.2);
end;
end;
end;
// 移入移出, 右边进入
procedure DoMoveInOut();
var
NewValue: Single;
begin
if IsIn then begin
Self.Opacity := 1;
if not SwitchFlag then begin
Self.Position.X := Self.Width - 1; //目标frame新显示
NewValue := 0;
end else begin
Self.Position.X := -Self.Width + 1; //目标frame返回显示
NewValue := 0;
end;
end else begin
if not SwitchFlag then
NewValue := -Self.Width + 1 //旧的frame向右返回
else
NewValue := Self.Width - 1; //旧的frame向左隐藏
if FinishIsFreeApp then begin
if Assigned(AEvent) then
AEvent(Self);
Exit;
end;
end;
TFrameAnimator.AnimateFloat(Self, 'Position.X', NewValue, AEvent);
end;
// 顶部移入移出, 右边进入
procedure DoTopMoveInOut();
var
LForm: TCustomForm;
Y: Single;
begin
if IsIn then begin
Self.Opacity := 1;
if not SwitchFlag then begin
Self.Position.Y := - Self.Height;
Y := 0;
LForm := Self.ParentForm;
if Assigned(LForm) then
Y := LForm.Padding.Top;
TFrameAnimator.AnimateFloat(Self, 'Position.Y', Y, AEvent);
end else if Assigned(AEvent) then
TFrameAnimator.DelayExecute(Self, AEvent, 0.2);
end else begin
if FinishIsFreeApp then begin
if Assigned(AEvent) then
AEvent(Self);
Exit;
end;
if SwitchFlag then
TFrameAnimator.AnimateFloat(Self, 'Position.Y', - Self.Height, AEvent, 0.1)
else if Assigned(AEvent) then
TFrameAnimator.DelayExecute(Self, AEvent, 0.65);
end;
end;
// 底部移入移出, 右边进入
procedure DoBottomMoveInOut();
var
LForm: TCustomForm;
Y: Single;
begin
if IsIn then begin
Self.Opacity := 1;
if not SwitchFlag then begin
Self.Position.Y := Self.Height;
Y := 0;
LForm := Self.ParentForm;
if Assigned(LForm) then
Y := LForm.Padding.Top;
TFrameAnimator.AnimateFloat(Self, 'Position.Y', Y, AEvent);
end else if Assigned(AEvent) then
TFrameAnimator.DelayExecute(Self, AEvent, 0.2);
end else begin
if FinishIsFreeApp then begin
if Assigned(AEvent) then
AEvent(Self);
Exit;
end;
if SwitchFlag then
TFrameAnimator.AnimateFloat(Self, 'Position.Y', Self.Height, AEvent, 0.1)
else if Assigned(AEvent) then
TFrameAnimator.DelayExecute(Self, AEvent, 0.65);
end;
end;
begin
if not Assigned(Self) or (csDestroying in ComponentState) then
Exit;
try
case Ani of
TFrameAniType.DefaultAni:
if not (DefaultAnimate in [TFrameAniType.None, TFrameAniType.DefaultAni]) then
AnimatePlay(DefaultAnimate, IsIn, SwitchFlag, AEvent)
else if Assigned(AEvent) then begin
if IsIn then
Self.Opacity := 1
else
Self.Opacity := 0;
AEvent(Self);
end;
TFrameAniType.FadeInOut:
DoFadeInOut;
TFrameAniType.MoveInOut:
DoMoveInOut;
TFrameAniType.TopMoveInOut:
DoTopMoveInOut;
TFrameAniType.BottomMoveInOut:
DoBottomMoveInOut;
else
begin
// 无动画效果
if Assigned(AEvent) then
AEvent(Self);
if IsIn then
Opacity := 1
else
Opacity := 0;
end;
end;
except
end;
end;
class procedure TFrameView.AppTerminate;
begin
try
{$IFDEF POSIX}
{$IFDEF DEBUG}
Application.Terminate;
{$ELSE}
Kill(0, SIGKILL);
{$ENDIF}
{$ELSE}
Application.Terminate;
{$ENDIF}
except
end;
end;
function TFrameView.CheckChildern: Boolean;
var
I: Integer;
begin
if (Parent is TForm) then begin
Result := True;
if Parent.ChildrenCount >= 2 then begin
for I := 0 to Parent.ChildrenCount - 1 do begin
if (Parent.Children[I] <> Self) and (Parent.Children[I] is FMX.Forms.TFrame) then begin
Result := False;
Exit;
end;
end;
end;
end else
Result := False;
end;
function TFrameView.CheckFree: Boolean;
var
LForm: TCustomForm;
LFrame: TFrameView;
begin
Result := False;
if Assigned(Parent) then begin
if (Parent is TForm) and DoCanFree then begin
{$IFDEF POSIX}
{$IFDEF DEBUG}
(Parent as TForm).Close;
{$ELSE}
Kill(0, SIGKILL);
{$ENDIF}
{$ELSE}
(Parent as TForm).Close;
{$ENDIF}
Result := True;
Exit;
end;
LForm := ParentForm;
{$IFDEF MSWINDOWS}
if Assigned(LForm) then
LForm.ReleaseCapture;
{$ENDIF}
if TFrameView.GetFormActiveFrame(LForm, LFrame) and (LFrame = Self) then
TFrameView.SetFormActiveFrame(LForm, nil);
{$IFDEF AUTOREFCOUNT}
Parent := nil;
if Assigned(Owner) then
Owner.RemoveComponent(Self);
Self.DisposeOf;
{$ELSE}
Self.Free;
{$ENDIF}
{$IFDEF ANDROID}
if (not Assigned(Screen.FocusControl)) and (Assigned(LForm)) then
LForm.SetFocus;
{$ENDIF}
end;
end;
procedure TFrameView.Close;
begin
Close(TFrameAniType.DefaultAni);
end;
procedure TFrameView.Close(Ani: TFrameAniType);
begin
// 如果正在显示中,设置需要Finish标识
if FShowing then begin
FNeedFinish := True;
Exit;
end;
// 动画执行中, 设置需要关闭的标识
FWaitDialog := nil;
if FAnimateing then
FNeedFree := True
else begin
FAnimateing := True;
AnimatePlay(Ani, False, True, OnFinishOrClose);
FAnimateing := False;
end;
end;
class function TFrameView.CreateFrame(Parent: TFmxObject;
Params: TFrameParams): TFrameView;
{$IFDEF ANDROID}
procedure DoUpdateParentFormState(Parent: TFmxObject);
begin
// 设置了状态条颜色,并且状态条高度大于0时,将父级Form的Padding.Top设为状态条高度
if (FDefaultStatusColor <> 0) and (TView.GetStatusHeight > 0) then begin
while Parent <> nil do begin
if (Parent is TCommonCustomForm) then begin
TCommonCustomForm(Parent).Padding.Top :=
TCommonCustomForm(Parent).Padding.Top + TView.GetStatusHeight;
//TCommonCustomForm(Parent).Padding.Bottom :=
// TCommonCustomForm(Parent).Padding.Bottom + TView.GetNavigationBarHeight;
Break;
end;
Parent := Parent.Parent;
end;
end;
end;
{$ENDIF}
var
Dlg: IDialog;
begin
Result := nil;
if (Assigned(Parent)) then begin
try
{$IFDEF ANDROID}
// 检测是否是第一次创建 Frame
if FFirstCreateFrame then begin
DoUpdateParentFormState(Parent);
FFirstCreateFrame := False;
end;
{$ENDIF}
// 检测是否是存在Dialog
if Parent is TControl then begin
Dlg := TDialog.GetDialog(Parent as TControl);
if Assigned(Dlg) then begin
Parent := Dlg.View;
while Parent <> nil do begin
if (Parent is TFrameView) or (Parent is TCustomForm) then begin
ShowFrame(Parent, Params);
Break;
end;
Parent := Parent.Parent;
end;
Dlg.Dismiss;
Exit;
end;
end;
Result := Create(Parent);
Result.Name := '';
Result.TagObject := Params;
Result.Parent := Parent;
Result.Align := TAlignLayout.Client;
Result.FLastView := nil;
except
if Assigned(Params) then
Params.Free;
raise;
end;
end else if Assigned(Params) then
Params.Free;
end;
constructor TFrameView.Create(AOwner: TComponent);
begin
try
inherited Create(AOwner);
except
Width := 200;
Height := 400;
end;
FDefaultAni := TFrameAniType(-1);
FBackColor := FDefaultBackColor;
FStatusColor := FDefaultStatusColor;
FStatusTransparent := FDefaultStatusTransparent;
FStatusLight := FDefaultStatusLight;
FUseDefaultBackColor := True;
FUseDefaultStatusColor := True;
FUseDefaultStatusLight := True;
FUseDefaultStatusTransparent := True;
FNeedDoCreate := True;
end;
class constructor TFrameView.Create;
begin
FActiveFrames := TDictionary<TCommonCustomForm, TFrameView>.Create;
{$IF CompilerVersion >= 31}
TMessageManager.DefaultManager.SubscribeToMessage(TFormActivateMessage, TFrameView.DoActivateMessage);
TMessageManager.DefaultManager.SubscribeToMessage(TFormDeactivateMessage, TFrameView.DoActivateMessage);
{$ENDIF}
{$IF Defined(ANDROID) or Defined(IOS)}
TMessageManager.DefaultManager.SubscribeToMessage(TApplicationEventMessage, TFrameView.DoActivateMessage);
{$ENDIF}
{$IFDEF ANDROID}
{$IF CompilerVersion >= 33}
TMessageManager.DefaultManager.SubscribeToMessage(TPermissionsRequestResultMessage, TFrameView.DoActivateMessage);
// 感谢 谭钦
// 增加一个键盘事件的监听 这是因为fmx.jar中的BUG引发的,原本应该是不需要这个监听的
FKSListener := TKSCListener.Create;
MainActivity.getVirtualKeyboard.addOnKeyboardStateChangedListener(FKSListener);
{$ENDIF}
{$IF CompilerVersion >= 34}
TMyAndroidApplicationGlue.BindCallbacks;
{$ENDIF}
{$ENDIF}
end;
class function TFrameView.CreateFrame(Parent: TFmxObject;
const Title: string): TFrameView;
begin
Result := CreateFrame(Parent, nil);
if Result <> nil then
Result.Title := Title;
end;
function TFrameView.MakeFrame(FrameClass: TFrameViewClass): TFrameView;
begin
if FAnimateing then
Result := nil
else begin
Result := FrameClass.Create(Parent);
Result.Name := '';
Result.Parent := Parent;
Result.Align := TAlignLayout.Client;
Result.FLastView := Self;
FNextView := Result;
end;
end;
procedure TFrameView.OnFinishOrClose(Sender: TObject);
begin
if not Assigned(Self) then
Exit;
FNeedFinish := False;
if FNeedHide then
InternalHide;
if CheckFree then Exit;
end;
procedure TFrameView.Paint;
var
R: TRectF;
begin
inherited Paint;
if (BackColor and $FF000000 > 0) then begin
R := LocalRect;
Canvas.Fill.Kind := TBrushKind.Solid;
Canvas.Fill.Color := BackColor;
Canvas.FillRect(R, 0, 0, AllCorners, AbsoluteOpacity);
end;
end;
procedure TFrameView.Pause(AFinish: Boolean);
var
[Weak] LFrame: TFrameView;
begin
if not DoCanPause then
Exit;
if not FResumed then
Exit;
FResumed := False;
if AFinish then begin
LFrame := ActiveFrame;
// Self not Active
if Assigned(LFrame) and (LFrame <> Self) and (LFrame.FLastView = Self) then
LFrame.FLastView := FLastView;
end;
DoPause;
if AFinish then begin
if LFrame = Self then
if Assigned(FLastView) and not FLastView.IsDestroy then
FLastView.Resume;
end;
end;
procedure TFrameView.RefreshStatusBar;
begin
TFrameView.UpdateStatusBar(ParentForm, StatusColor, StatusTransparent, StatusLight);
end;
class procedure TFrameView.UpdateStatusBar(const AForm: TCommonCustomForm; const AColor: TAlphaColor;
const ATransparent: Boolean; const ALight: Boolean);
{$IFDEF IOS}
procedure ExecuteIOS;
begin
if not Assigned(AForm) then
Exit;
if AForm is TCustomForm then
TCustomForm(AForm).Fill.Color := AColor;
end;
{$ENDIF}
{$IFDEF ANDROID}
procedure ExecuteAndroid;
{$IF CompilerVersion >= 33}
var
wnd: JWindow;
{$ENDIF}
begin
if TView.GetStatusHeight > 0 then begin
if not Assigned(AForm) then
Exit;
if AForm is TCustomForm then
TCustomForm(AForm).Fill.Color := AColor;
{$IF CompilerVersion >= 33} // Delphi 10.3 及之后的版本
if not FStatusTransparentNewMethod then
Exit;
wnd := TAndroidHelper.Activity.getWindow;
if (not Assigned(wnd)) then Exit;
CallInUiThread(
procedure
begin
if TJBuild_VERSION.JavaClass.SDK_INT >= 21 then begin
FSystemUiVisibility := wnd.getDecorView.getSystemUiVisibility;
// 是否为系统 view 预留空间
//wnd.getDecorView().setFitsSystemWindows(True);
// 需要设置这个 flag 才能调用 setStatusBarColor 来设置状态栏颜色
wnd.addFlags(TJWindowManager_LayoutParams.JavaClass.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if ATransparent then begin // 透明
// 设置颜色
wnd.setStatusBarColor(TJcolor.JavaClass.TRANSPARENT);
// 取消设置透明状态栏,使 ContentView 内容不再覆盖状态栏
wnd.clearFlags(TJWindowManager_LayoutParams.JavaClass.FLAG_TRANSLUCENT_STATUS);
with TJView.JavaClass do
FSystemUiVisibility := FSystemUiVisibility or SYSTEM_UI_FLAG_LAYOUT_STABLE or SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
// 亮色状态栏
if (TJBuild_VERSION.JavaClass.SDK_INT >= 23) then
if ALight then
FSystemUiVisibility := FSystemUiVisibility or TJView.JavaClass.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
else
FSystemUiVisibility := FSystemUiVisibility and not TJView.JavaClass.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
wnd.getDecorView().setSystemUiVisibility(FSystemUiVisibility);
end
else begin // 半透明
// 设置颜色
wnd.setStatusBarColor(AlphaColorToJColor(AColor));
wnd.addFlags(TJWindowManager_LayoutParams.JavaClass.FLAG_TRANSLUCENT_STATUS);
with TJView.JavaClass do
FSystemUiVisibility := FSystemUiVisibility or SYSTEM_UI_FLAG_LAYOUT_STABLE or SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
wnd.getDecorView().setSystemUiVisibility(FSystemUiVisibility);
end;
end
else begin
// 是否为系统 view 预留空间
wnd.getDecorView().setFitsSystemWindows(True);
wnd.addFlags(TJWindowManager_LayoutParams.JavaClass.FLAG_TRANSLUCENT_STATUS);
end;
end
);
{$ENDIF}
end;
end;
{$ENDIF}
begin
{$IFDEF IOS}
ExecuteIOS;
{$ENDIF}
{$IFDEF ANDROID}
ExecuteAndroid;
{$ENDIF}
end;
class procedure TFrameView.UpdateStatusBar;
begin
{$IFDEF ANDROID}
{$IF CompilerVersion >= 33} // Delphi 10.3 及之后的版本
if (not FStatusTransparentNewMethod) or (FSystemUiVisibility = -1) then
Exit;
CallInUiThread(procedure
var
wnd: JWindow;
begin
wnd := TAndroidHelper.Activity.getWindow;
if (not Assigned(wnd)) then Exit;
wnd.getDecorView().requestApplyInsets();
wnd.getDecorView().setSystemUiVisibility(FSystemUiVisibility);
wnd.getDecorView().requestApplyInsets();
end);
{$ENDIF}
{$ENDIF}
end;
procedure TFrameView.Resume;
var
[Weak] LFrame: TFrameView;
begin
if not DoCanPause then
Exit;
if FResumed then
Exit;
FResumed := True;
LFrame := ActiveFrame;
// Back from nextview
if (not Assigned(LFrame)) and Assigned(FLastView) then
FLastView := nil
else if (FLastView <> LFrame) and Assigned(LFrame) and (LFrame <> Self) and (LFrame.FLastView <> Self) then
FLastView := LFrame;
if LFrame <> Self then begin
if Assigned(LFrame) and (not LFrame.IsDestroy) then
LFrame.Pause;
TFrameView.SetFormActiveFrame(ParentForm, Self);
end;
DoResume;
end;
procedure TFrameView.DelayExecute(ADelay: Single; AExecute: TNotifyEventA);
begin
if not Assigned(AExecute) then
Exit;
TFrameAnimator.DelayExecute(Self, AExecute, ADelay);
end;
class destructor TFrameView.Destroy;
begin
{$IFDEF ANDROID}
{$IF CompilerVersion >= 33}
TMessageManager.DefaultManager.Unsubscribe(TPermissionsRequestResultMessage, TFrameView.DoActivateMessage);
MainActivity.getVirtualKeyboard.removeOnKeyboardStateChangedListener(FKSListener);
FreeAndNil(FKSListener);
{$ENDIF}
{$ENDIF}
{$IF Defined(ANDROID) or Defined(IOS)}
TMessageManager.DefaultManager.Unsubscribe(TApplicationEventMessage, TFrameView.DoActivateMessage);
{$ENDIF}
{$IF CompilerVersion >= 31}
TMessageManager.DefaultManager.Unsubscribe(TFormActivateMessage, TFrameView.DoActivateMessage);
TMessageManager.DefaultManager.Unsubscribe(TFormDeactivateMessage, TFrameView.DoActivateMessage);
{$ENDIF}
FreeAndNil(FActiveFrames);
end;
destructor TFrameView.Destroy;
var
Obj: TObject;
LFrame: TFrameView;
begin
if Assigned(ParentForm) and TFrameView.GetFormActiveFrame(ParentForm, LFrame) and (LFrame = Self) then
TFrameView.SetFormActiveFrame(ParentForm, nil);
if Assigned(Screen.ActiveForm) and TFrameView.GetFormActiveFrame(Screen.ActiveForm, LFrame) and (LFrame = Self) then
TFrameView.SetFormActiveFrame(Screen.ActiveForm, nil);
DoFree();
FWaitDialog := nil;
Obj := TagObject;
if Assigned(Obj) then
FreeAndNil(Obj);
if Assigned(FNextView) then
FNextView.FLastView := nil;
FLastView := nil;
FNextView := nil;
FreeAndNil(FParams);
FreeAndNil(FPrivateState);
inherited;
end;
class procedure TFrameView.DoActivateMessage(const Sender: TObject;
const M: TMessage);
procedure DealForm(AForm: TCommonCustomForm; AActivate: Boolean);
var
LFrame: TFrameView;
begin
if not Assigned(AForm) then
Exit;
if not TFrameView.GetFormActiveFrame(AForm, LFrame) then
Exit;
if (not Assigned(LFrame)) or LFrame.IsDestroy then
Exit;
if AActivate then
LFrame.Resume
else
LFrame.Pause;
end;
procedure DealFrame(AForm: TCommonCustomForm);
var
LFrame: TFrameView;
begin
if not Assigned(AForm) then
Exit;
if not TFrameView.GetFormActiveFrame(AForm, LFrame) then
Exit;
LFrame.RefreshStatusBar;
end;
begin
{$IF CompilerVersion >= 31}
if M is TFormActivateMessage then
DealForm(TFormActivateMessage(M).Value, True)
else if M is TFormDeactivateMessage then
DealForm(TFormActivateMessage(M).Value, False)
else
{$ENDIF}
{$IF Defined(ANDROID) and (CompilerVersion >= 33)}
if M is TPermissionsRequestResultMessage then begin
DealFrame(Screen.ActiveForm);
TThread.CreateAnonymousThread(procedure begin
TFrameView.UpdateStatusBar;
end).Start;
end
else
{$ENDIF}
if M is TApplicationEventMessage then
case TApplicationEventMessage(M).Value.Event of
TApplicationEvent.BecameActive: begin
{$IFDEF ANDROID}
// 感谢谭钦的u_Immerse.pas
TFrameView.UpdateStatusBar;
{$ENDIF}
DealForm(Screen.ActiveForm, True);
{$IFDEF ANDROID}
// 临时的方案,暂未深究原因
TThread.CreateAnonymousThread(procedure begin
Sleep(100);
TFrameView.UpdateStatusBar;
Sleep(100);
TFrameView.UpdateStatusBar;
Sleep(100);
TFrameView.UpdateStatusBar;
end).Start;
{$ENDIF}
end;
TApplicationEvent.WillBecomeInactive:
DealForm(Screen.ActiveForm, False);
end;
end;
function TFrameView.DoCanFinish: Boolean;
begin
Result := True;
end;
function TFrameView.DoCanKeyFinish: Boolean;
begin
Result := Assigned(Self) and Visible and Enabled;
end;
function TFrameView.DoCanFree: Boolean;
begin
Result := not Assigned(Parent.Parent) and CheckChildern();
end;
function TFrameView.DoCanPause: Boolean;
var
[Weak] V: TFmxObject;
begin
Result := False;
if not Assigned(Self) then
Exit;
if Owner is TFrameView then
Exit;
V := Parent;
while Assigned(V) do begin
if V is TFrameView then
Exit;
if V is TDialogView then
Exit;
if V.ClassName = 'TListViewEx' then
Exit;
V := V.Parent;
end;
Result := True;
end;
procedure TFrameView.DoCreate;
begin
end;
procedure TFrameView.DoFinish;
begin
Pause;
if Assigned(FOnFinish) then begin
FOnFinish(Self);
FOnFinish := nil;
end;
end;
procedure TFrameView.DoFree;
begin
if Assigned(FOnFree) then
FOnFree(Self);
end;
procedure TFrameView.DoHide;
begin
Pause;
if Assigned(FOnHide) then
FOnHide(Self);
end;
procedure TFrameView.DoPause;
begin
end;
procedure TFrameView.DoReStart;
begin
if Assigned(FOnReStart) then
FOnReStart(Self);
Resume;
end;
procedure TFrameView.DoResume;
begin
RefreshStatusBar;
TThread.CreateAnonymousThread(procedure begin
TFrameView.UpdateStatusBar;
end).Start;
end;
procedure TFrameView.DoShow;
begin
FToastManager := GetToastManager;
if Assigned(FOnShow) then
FOnShow(Self);
Resume;
end;
procedure TFrameView.Finish(Ani: TFrameAniType);
begin
if FShowing then begin
FNeedFinish := True;
Exit;
end;
DoFinish();
if Assigned(FNextView) then begin
FNextView.FLastView := FLastView;
FLastView := nil;
FNextView := nil;
end else if Assigned(FLastView) then begin
FLastView.InternalShow(False, nil, Ani, True);
FLastView.FNextView := nil;
FLastView := nil;
end;
Close(Ani);
end;
procedure TFrameView.Finish;
begin
if not DoCanFinish then
Exit;
if Ord(FDefaultAni) <> -1 then
Finish(FDefaultAni)
else
Finish(TFrameAniType.DefaultAni);
end;
class function TFrameView.GetFormActiveFrame(AForm: TCommonCustomForm; var AFrame: TFrameView): Boolean;
begin
Result := Assigned(AForm) and FActiveFrames.TryGetValue(AForm, AFrame) and Assigned(AFrame);
end;
function TFrameView.GetActiveFrame: TFrameView;
begin
TFrameView.GetFormActiveFrame(ParentForm, Result);
end;
function TFrameView.GetData: TValue;
begin
if (FParams = nil) or (not FParams.ContainsKey(CS_Data)) then
Result := nil
else
Result := FParams.Items[CS_Data];
end;
function TFrameView.GetDataAsPointer: Pointer;
var
V: TValue;
begin
V := Data;
if V.IsEmpty then
Result := nil
else
Result := V.AsVarRec.VPointer;
end;
function TFrameView.GetDataString: string;
begin
if (FParams = nil) or (not FParams.ContainsKey(CS_DataStr)) then
Result := ''
else
Result := FParams.Items[CS_DataStr].ToString;
end;
function TFrameView.GetIsDestroy: Boolean;
begin
Result := (not Assigned(Self)) or (csDestroying in ComponentState);
end;
function TFrameView.GetIsWaitDismiss: Boolean;
begin
Result := IsDestroy or (not Assigned(FWaitDialog)) or FWaitDialog.IsDismiss;
end;
function TFrameView.GetParams: TFrameParams;
begin
if FParams = nil then begin
if (TagObject <> nil) and (TagObject is TFrameParams) then begin
FParams := TagObject as TFrameParams;
TagObject := nil;
end else
FParams := TFrameParams.Create(9);
end;
Result := FParams;
end;
function TFrameView.GetParentForm: TCustomForm;
begin
Result := UI.Base.GetParentForm(Self);
end;
function TFrameView.GetPreferences: TFrameState;
begin
if not Assigned(FPrivateState) then begin
FPrivateState := TFrameState.Create(Self, False);
FPrivateState.Load;
end;
Result := FPrivateState;
end;
function TFrameView.GetSharedPreferences: TFrameState;
begin
Result := FPublicState;
end;
function TFrameView.GetBackColor: TAlphaColor;
begin
if FUseDefaultBackColor then
Result := FDefaultBackColor
else
Result := FBackColor;
end;
function TFrameView.GetStatusColor: TAlphaColor;
begin
if FUseDefaultStatusColor then
Result := FDefaultStatusColor
else
Result := FStatusColor;
end;
function TFrameView.GetStatusLight: Boolean;
begin
if FUseDefaultStatusLight then
Result := FDefaultStatusLight
else
Result := FStatusLight;
end;
function TFrameView.GetStatusTransparent: Boolean;
begin
if FUseDefaultStatusTransparent then
Result := FDefaultStatusTransparent
else
Result := FStatusTransparent;
end;
function TFrameView.GetTitle: string;
begin
if (FParams = nil) or (not FParams.ContainsKey(CS_Title)) then
Result := ''
else
Result := FParams.Items[CS_Title].ToString;
end;
function TFrameView.GetToastManager: TToastManager;
var
LForm: TCustomForm;
I: Integer;
begin
Result := nil;
LForm := GetParentForm;
if not Assigned(LForm) then
Exit;
for I := 0 to LForm.ComponentCount - 1 do
if LForm.Components[I] is TToastManager then begin
Result := TToastManager(LForm.Components[I]);
Exit;
end;
end;
procedure TFrameView.Hide;
begin
if FHideing then
Exit;
Hide(TFrameAniType.DefaultAni);
end;
procedure TFrameView.Hide(Ani: TFrameAniType; SwitchFlag: Boolean);
begin
if FAnimateing then
FNeedHide := True
else begin
FAnimateing := True;
AnimatePlay(Ani, False, SwitchFlag,
procedure (Sender: TObject) begin
if not FShowing then begin
InternalHide;
if FNeedFree then
OnFinishOrClose(Sender);
end;
FAnimateing := False;
end
);
end;
end;
procedure TFrameView.HideWaitDialog;
begin
TThread.Synchronize(TThread.CurrentThread, procedure begin
if not IsWaitDismiss then begin
FWaitDialog.Dismiss;
FWaitDialog := nil;
end;
end);
end;
procedure TFrameView.Hint(const Msg: string);
begin
if TThread.CurrentThread.ThreadID = MainThreadID then begin
if Assigned(FToastManager) then
FToastManager.Toast(Msg)
else
Toast(Msg);
end
else
TThread.Synchronize(TThread.CurrentThread, procedure begin
if Assigned(FToastManager) then
FToastManager.Toast(Msg)
else
Toast(Msg);
end);
end;
procedure TFrameView.Hint(const AFormat: string; const Args: array of const);
begin
Hint(Format(AFormat, Args));
end;
procedure TFrameView.Hint(const Msg: Double);
begin
Hint(FloatToStr(Msg));
end;
procedure TFrameView.Hint(const Msg: Int64);
begin
Hint(IntToStr(Msg));
end;
procedure TFrameView.InternalHide;
begin
DoHide;
FHideing := True;
Visible := False;
FHideing := False;
FNeedHide := False;
end;
procedure TFrameView.InternalShow(TriggerOnShow: Boolean;
AOnFinish: TNotifyEventA; Ani: TFrameAniType; SwitchFlag: Boolean);
begin
if FShowing then Exit;
FShowing := True;
if TriggerOnShow and (not SwitchFlag) then
FDefaultAni := Ani;
if Title <> '' then begin
Application.Title := Title;
if Assigned(Parent) and (Parent is TCustomForm) then
TCustomForm(Parent).Caption := Title;
end;
if TriggerOnShow then
DoShow()
else
DoReStart();
{$IFDEF ANDROID}
{$IF CompilerVersion < 32}
if (not Assigned(Screen.FocusControl)) and (Assigned(ParentForm)) then
ParentForm.SetFocus;
{$IFEND}
{$ENDIF}
Opacity := 0;
FHideing := True;
Visible := True;
AnimatePlay(Ani, True, SwitchFlag,
procedure (Sender: TObject) begin
FShowing := False;
if Assigned(AOnFinish) then
AOnFinish(Sender);
end
);
FHideing := False;
FNeedFree := False;
FNeedHide := False;
if FNeedFinish then begin
FShowing := False;
FNeedFinish := False;
Finish;
end;
end;
function TFrameView.FinishIsFreeApp: Boolean;
begin
Result := Assigned(Parent) and (not Assigned(Parent.Parent)) and
(Parent is TForm) and CheckChildern();
end;
procedure TFrameView.SetBackColor(const Value: TAlphaColor);
begin
if FBackColor <> Value then begin
FBackColor := Value;
FUseDefaultBackColor := False;
Repaint;
end;
end;
procedure TFrameView.SetData(const Value: TValue);
begin
if Params.ContainsKey(CS_Data) then
Params.Items[CS_Data] := Value
else
Params.Add(CS_Data, Value);
end;
procedure TFrameView.SetDataString(const Value: string);
begin
if Params.ContainsKey(CS_DataStr) then
Params.Items[CS_DataStr] := Value
else if Value <> '' then
Params.Add(CS_DataStr, Value);
end;
class procedure TFrameView.SetDefaultBackColor(const Value: TAlphaColor);
begin
FDefaultBackColor := Value;
end;
class procedure TFrameView.SetDefaultStatusColor(const Value: TAlphaColor);
begin
if FDefaultStatusColor <> Value then begin
FDefaultStatusColor := Value;
{$IF Defined(ANDROID) or Defined(IOS)}
// 在移动平台时,设置状态条颜色时,如果背景颜色为透明,且状态条高度>0时,
// 将背景颜色设为白色
if (Value and $FF000000 > 0) and (FDefaultBackColor = 0){$IFDEF ANDROID} and (TView.GetStatusHeight > 0){$ENDIF} then
FDefaultBackColor := $fff1f2f3;
{$ENDIF}
end;
end;
class procedure TFrameView.SetDefaultStatusLight(const Value: Boolean);
begin
if FDefaultStatusLight <> Value then
FDefaultStatusLight := Value;
end;
class procedure TFrameView.SetDefaultStatusTransparent(const Value: Boolean);
begin
if FDefaultStatusTransparent <> Value then
FDefaultStatusTransparent := Value;
end;
class procedure TFrameView.SetStatusTransparentNewMethod(const Value: Boolean);
begin
if FStatusTransparentNewMethod <> Value then
FStatusTransparentNewMethod := Value;
end;
class procedure TFrameView.SetFormActiveFrame(AForm: TCommonCustomForm; AFrame: TFrameView);
begin
if not Assigned(AForm) then
Exit;
FActiveFrames.AddOrSetValue(AForm, AFrame);
end;
procedure TFrameView.SetParams(const Value: TFrameParams);
begin
if Assigned(FParams) then
FParams.Free;
FParams := Value;
end;
procedure TFrameView.SetParent(const Value: TFmxObject);
begin
{$IF CompilerVersion >= 34}
if Value = nil then
Self.SetRoot(nil); // fix release error in 10.4
{$ENDIF}
inherited;
if FNeedDoCreate and Assigned(Parent) then begin
FNeedDoCreate := False;
if FUseDefaultBackColor and Assigned(TDialog.GetDialog(Self)) then
BackColor := 0; // 作为Dialog的子View时,不使用默认背景色
DoCreate();
end;
end;
procedure TFrameView.SetStatusColor(const Value: TAlphaColor);
begin
if FStatusColor <> Value then begin
FUseDefaultStatusColor := False;
FStatusColor := Value;
RefreshStatusBar;
end;
end;
procedure TFrameView.SetStatusLight(const Value: Boolean);
begin
if FStatusLight <> Value then begin
FUseDefaultStatusLight := False;
FStatusLight := Value;
RefreshStatusBar;
end;
end;
procedure TFrameView.SetStatusTransparent(const Value: Boolean);
begin
if FStatusTransparent <> Value then begin
FUseDefaultStatusTransparent := False;
FStatusTransparent := Value;
RefreshStatusBar;
end;
end;
procedure TFrameView.SetTitle(const Value: string);
begin
if Params.ContainsKey(CS_Title) then
Params.Items[CS_Title] := Value
else if Value <> '' then
Params.Add(CS_Title, Value);
end;
procedure TFrameView.Show(Ani: TFrameAniType; AOnFinish: TNotifyEventA;
SwitchFlag, TriggerOnShow: Boolean);
begin
InternalShow(TriggerOnShow, AOnFinish, Ani, SwitchFlag);
end;
procedure TFrameView.Show;
begin
if FHideing then
Exit;
Show(TFrameAniType.DefaultAni, nil);
end;
class function TFrameView.ShowFrame(Parent: TFmxObject;
const Title: string; Ani: TFrameAniType; SwitchFlag: Boolean): TFrameView;
begin
Result := CreateFrame(Parent, Title);
if Result <> nil then
Result.Show(Ani, nil, SwitchFlag);
end;
procedure TFrameView.ShowWaitDialog(const AMsg: string;
OnDismissListener: TOnDialogListener; ACancelable: Boolean);
begin
ShowWaitDialog(AMsg, ACancelable);
if Assigned(FWaitDialog) then
FWaitDialog.OnDismissListener := OnDismissListener;
end;
procedure TFrameView.ShowWaitDialog(const AMsg: string;
OnDismissListener: TOnDialogListenerA; ACancelable: Boolean);
begin
ShowWaitDialog(AMsg, ACancelable);
if Assigned(FWaitDialog) then
FWaitDialog.OnDismissListenerA := OnDismissListener;
end;
procedure TFrameView.ShowWaitDialog(const AMsg: string; ACancelable: Boolean);
begin
TThread.Synchronize(TThread.CurrentThread,
procedure
begin
if IsWaitDismiss then begin
FWaitDialog := nil;
FWaitDialog := TProgressDialog.Create(Self);
end;
FWaitDialog.Cancelable := ACancelable;
if not Assigned(FWaitDialog.RootView) then
FWaitDialog.InitView(AMsg)
else
FWaitDialog.Message := AMsg;
TDialog(FWaitDialog).Show();
end);
end;
function TFrameView.StartFrame(FrameClass: TFrameViewClass;
const Title: string; Ani: TFrameAniType): TFrameView;
begin
Result := MakeFrame(FrameClass);
if Assigned(Result) then begin
Result.Title := Title;
Hide(Ani);
Result.Show(Ani, nil);
end;
end;
function TFrameView.StartFrame(FrameClass: TFrameViewClass; const Title: string;
const Data: TValue; Ani: TFrameAniType): TFrameView;
begin
Result := MakeFrame(FrameClass);
if Assigned(Result) then begin
Result.Title := Title;
Result.Data := Data;
Hide(Ani);
Result.Show(Ani, nil);
end;
end;
function TFrameView.StartFrame(FrameClass: TFrameViewClass; const Title,
DataString: string; Ani: TFrameAniType): TFrameView;
begin
Result := MakeFrame(FrameClass);
if Assigned(Result) then begin
Result.Title := Title;
Result.DataString := DataString;
Hide(Ani);
Result.Show(Ani, nil);
end;
end;
function TFrameView.StreamToString(SrcStream: TStream; const CharSet: string): string;
var
LReader: TStringStream;
begin
if (CharSet <> '') and (string.CompareText(CharSet, 'utf-8') <> 0) then // do not translate
LReader := TStringStream.Create('', System.SysUtils.TEncoding.GetEncoding(CharSet), True)
else
LReader := TStringStream.Create('', System.SysUtils.TEncoding.UTF8, False);
try
LReader.CopyFrom(SrcStream, 0);
Result := LReader.DataString;
finally
LReader.Free;
end;
end;
procedure TFrameView.UpdateWaitDialog(const AMsg: string);
begin
TThread.Synchronize(TThread.CurrentThread,
procedure
begin
if IsWaitDismiss then
Exit;
if Assigned(FWaitDialog.RootView) then begin
FWaitDialog.Message := AMsg;
FWaitDialog.RootView.MessageView.Text := AMsg;
end;
end);
end;
function TFrameView.StartFrame(FrameClass: TFrameViewClass;
Params: TFrameParams; Ani: TFrameAniType): TFrameView;
begin
Result := MakeFrame(FrameClass);
if Assigned(Result) then begin
Result.Params := Params;
Hide(Ani);
Result.Show(Ani, nil);
end;
end;
function TFrameView.StartFrame(FrameClass: TFrameViewClass; Ani: TFrameAniType): TFrameView;
begin
Result := MakeFrame(FrameClass);
if Assigned(Result) then begin
Hide(Ani);
Result.Show(Ani, nil);
end;
end;
class function TFrameView.ShowFrame(Parent: TFmxObject;
Params: TFrameParams; Ani: TFrameAniType; SwitchFlag: Boolean): TFrameView;
begin
Result := CreateFrame(Parent, Params);
if Result <> nil then
Result.Show(Ani, nil, SwitchFlag);
end;
{ TFrameState }
procedure TFrameState.Clear;
begin
FLocker.Enter;
if FData <> nil then
FData.Clear;
FLocker.Leave;
end;
function TFrameState.ContainsKey(const Key: string): Boolean;
begin
FLocker.Enter;
Result := FData.ContainsKey(Key);
FLocker.Leave;
end;
constructor TFrameState.Create(AOwner: TComponent; IsPublic: Boolean);
begin
FOwner := AOwner;
FData := nil;
FIsChange := False;
FIsPublic := IsPublic;
FLocker := TCriticalSection.Create;
InitData;
{$IFNDEF MSWINDOWS}
StoragePath := TPath.GetDocumentsPath;
{$ENDIF}
end;
destructor TFrameState.Destroy;
begin
Save();
FreeAndNil(FData);
FreeAndNil(FLocker);
inherited;
end;
procedure TFrameState.DoValueNotify(Sender: TObject; const Item: TFrameDataValue;
Action: TCollectionNotification);
begin
if Action <> TCollectionNotification.cnExtracted then
FIsChange := True;
end;
function TFrameState.Exist(const Key: string): Boolean;
begin
FLocker.Enter;
Result := FData.ContainsKey(Key);
FLocker.Leave;
end;
function TFrameState.GetBoolean(const Key: string;
const DefaultValue: Boolean): Boolean;
begin
FLocker.Enter;
Result := FData.GetBoolean(Key, DefaultValue);
FLocker.Leave;
end;
function TFrameState.GetCount: Integer;
begin
if Assigned(FData) then
Result := FData.Count
else
Result := 0;
end;
function TFrameState.GetDateTime(const Key: string;
const DefaultValue: TDateTime): TDateTime;
begin
FLocker.Enter;
Result := FData.GetDateTime(Key, DefaultValue);
FLocker.Leave;
end;
function TFrameState.GetFileName(const FileName: string): string;
begin
Result := 'AF_' + FileName;
end;
function TFrameState.GetFloat(const Key: string;
const DefaultValue: Double): Double;
begin
FLocker.Enter;
Result := FData.GetFloat(Key, DefaultValue);
FLocker.Leave;
end;
function TFrameState.GetInt(const Key: string;
const DefaultValue: Integer): Integer;
begin
FLocker.Enter;
Result := FData.GetInt(Key, DefaultValue);
FLocker.Leave;
end;
function TFrameState.GetInt64(const Key: string;
const DefaultValue: Int64): Int64;
begin
FLocker.Enter;
Result := FData.GetInt64(Key, DefaultValue);
FLocker.Leave;
end;
function TFrameState.GetLong(const Key: string;
const DefaultValue: Cardinal): Cardinal;
begin
FLocker.Enter;
Result := FData.GetLong(Key, DefaultValue);
FLocker.Leave;
end;
function TFrameState.GetNumber(const Key: string;
const DefaultValue: NativeUInt): NativeUInt;
begin
FLocker.Enter;
Result := FData.GetNumber(Key, DefaultValue);
FLocker.Leave;
end;
function TFrameState.GetStoragePath: string;
var
SaveStateService: IFMXSaveStateService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXSaveStateService, SaveStateService) then
Result := SaveStateService.GetStoragePath
else
Result := '';
end;
function TFrameState.GetString(const Key: string): string;
begin
FLocker.Enter;
Result := FData.GetString(Key);
FLocker.Leave;
end;
function TFrameState.GetUniqueName: string;
const
UniqueNameSeparator = '_';
UniqueNamePrefix = 'FM';
UniqueNameExtension = '.Data';
var
B: TStringBuilder;
begin
if FIsPublic then
Result := 'AppPublicState.Data'
else begin
B := TStringBuilder.Create(Length(UniqueNamePrefix) + FOwner.ClassName.Length +
Length(UniqueNameSeparator) + Length(UniqueNameExtension));
try
B.Append(UniqueNamePrefix);
B.Append(UniqueNameSeparator);
B.Append(FOwner.ClassName);
B.Append(UniqueNameExtension);
Result := B.ToString;
finally
B.Free;
end;
end;
end;
procedure TFrameState.InitData;
begin
if FData <> nil then
FData.Clear
else begin
if FIsPublic then
FData := TFrameStateData.Create(97)
else
FData := TFrameStateData.Create(29);
FData.OnValueNotify := DoValueNotify;
end;
end;
procedure TFrameState.Load;
var
AStream: TMemoryStream;
SaveStateService: IFMXSaveStateService;
Reader: TBinaryReader;
ACount, I: Integer;
ASize: Int64;
AKey: string;
AType: TFrameDataType;
begin
FLocker.Enter;
if FIsLoad then begin
FLocker.Leave;
Exit;
end;
try
FData.Clear;
AStream := TMemoryStream.Create;
if TPlatformServices.Current.SupportsPlatformService(IFMXSaveStateService, SaveStateService) then
SaveStateService.GetBlock(GetUniqueName, AStream);
ASize := AStream.Size;
Reader := nil;
if AStream.Size > 0 then begin
AStream.Position := 0;
Reader := TBinaryReader.Create(AStream);
ACount := Reader.ReadInteger;
for I := 0 to ACount - 1 do begin
if AStream.Position >= ASize then
Break;
AType := TFrameDataType(Reader.ReadShortInt);
AKey := Reader.ReadString;
case AType of
fdt_Integer: FData.Put(AKey, Reader.ReadInt32);
fdt_Long: FData.Put(AKey, Reader.ReadCardinal);
fdt_Int64: FData.Put(AKey, Reader.ReadInt64);
fdt_Float: FData.Put(AKey, Reader.ReadDouble);
fdt_String: FData.Put(AKey, Reader.ReadString);
fdt_DateTime: FData.PutDateTime(AKey, Reader.ReadDouble);
fdt_Number: FData.Put(AKey, NativeUInt(Reader.ReadUInt64));
fdt_Boolean: FData.Put(AKey, Reader.ReadBoolean);
else
Break;
end;
end;
end;
finally
FreeAndNil(AStream);
FreeAndNil(Reader);
FIsChange := False;
FIsLoad := True;
FLocker.Leave;
end;
end;
procedure TFrameState.Put(const Key: string; const Value: Cardinal);
begin
FLocker.Enter;
FData.Put(Key, Value);
FLocker.Leave;
end;
procedure TFrameState.Put(const Key: string; const Value: Integer);
begin
FLocker.Enter;
FData.Put(Key, Value);
FLocker.Leave;
end;
procedure TFrameState.Put(const Key, Value: string);
begin
FLocker.Enter;
FData.Put(Key, Value);
FLocker.Leave;
end;
procedure TFrameState.Put(const Key: string; const Value: NativeUInt);
begin
FLocker.Enter;
FData.Put(Key, Value);
FLocker.Leave;
end;
procedure TFrameState.Put(const Key: string; const Value: Boolean);
begin
FLocker.Enter;
FData.Put(Key, Value);
FLocker.Leave;
end;
procedure TFrameState.Put(const Key: string; const Value: Int64);
begin
FLocker.Enter;
FData.Put(Key, Value);
FLocker.Leave;
end;
procedure TFrameState.Put(const Key: string; const Value: Double);
begin
FLocker.Enter;
FData.Put(Key, Value);
FLocker.Leave;
end;
procedure TFrameState.PutDateTime(const Key: string; const Value: TDateTime);
begin
FLocker.Enter;
FData.PutDateTime(Key, Value);
FLocker.Leave;
end;
function TFrameState.ReadFile(const FileName: string;
var OutData: TStream): Boolean;
var
SaveStateService: IFMXSaveStateService;
LastPosition: Int64;
begin
Result := False;
if not Assigned(OutData) then Exit;
if TPlatformServices.Current.SupportsPlatformService(IFMXSaveStateService, SaveStateService) then begin
LastPosition := OutData.Position;
Result := SaveStateService.GetBlock(GetFileName(ExtractFileName(FileName)), OutData);
OutData.Position := LastPosition;
end;
end;
procedure TFrameState.Save;
var
SaveStateService: IFMXSaveStateService;
AStream: TMemoryStream;
Writer: TBinaryWriter;
ACount: Integer;
Item: TPair<string, TFrameDataValue>;
ADoubleValue: Double;
begin
FLocker.Enter;
if not FIsChange then begin
FLocker.Leave;
Exit;
end;
try
AStream := TMemoryStream.Create;
Writer := TBinaryWriter.Create(AStream);
ACount := Count;
Writer.Write(ACount);
for Item in FData do begin
Writer.Write(ShortInt(Ord(Item.Value.DataType)));
Writer.Write(Item.Key);
case Item.Value.DataType of
fdt_Integer: Writer.Write(Item.Value.Value.AsInteger);
fdt_Long: Writer.Write(Cardinal(Item.Value.Value.AsInteger));
fdt_Int64: Writer.Write(Item.Value.Value.AsInt64);
fdt_Float, fdt_DateTime:
begin
ADoubleValue := Item.Value.Value.AsExtended;
Writer.Write(ADoubleValue);
end;
fdt_String: Writer.Write(Item.Value.Value.AsString);
fdt_Number: Writer.Write(Item.Value.Value.AsUInt64);
fdt_Boolean: Writer.Write(Item.Value.Value.AsBoolean);
end;
end;
if TPlatformServices.Current.SupportsPlatformService(IFMXSaveStateService, SaveStateService) then
SaveStateService.SetBlock(GetUniqueName, AStream);
finally
FreeAndNil(AStream);
FreeAndNil(Writer);
FIsChange := False;
FLocker.Leave;
end;
end;
function TFrameState.SaveFile(const FileName: string;
const Data: TStream): Boolean;
var
SaveStateService: IFMXSaveStateService;
LastPosition: Int64;
begin
Result := False;
if not Assigned(Data) then Exit;
if TPlatformServices.Current.SupportsPlatformService(IFMXSaveStateService, SaveStateService) then begin
LastPosition := Data.Position;
Data.Position := 0;
SaveStateService.SetBlock(GetFileName(ExtractFileName(FileName)), Data);
Data.Position := LastPosition;
Result := True;
end;
end;
procedure TFrameState.SetStoragePath(const Value: string);
var
SaveStateService: IFMXSaveStateService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXSaveStateService, SaveStateService) then
SaveStateService.SetStoragePath(Value);
end;
{ TFrameStateDataHelper }
function TFrameStateDataHelper.GetBoolean(const Key: string;
const DefaultValue: Boolean): Boolean;
begin
if ContainsKey(Key) then
Result := Items[Key].Value.AsBoolean
else
Result := DefaultValue;
end;
function TFrameStateDataHelper.GetDataValue(DataType: TFrameDataType;
const Value: TValue): TFrameDataValue;
begin
Result.DataType := DataType;
Result.Value := Value;
end;
function TFrameStateDataHelper.GetDateTime(const Key: string;
const DefaultValue: TDateTime): TDateTime;
begin
if ContainsKey(Key) then
Result := Items[Key].Value.AsExtended
else
Result := DefaultValue;
end;
function TFrameStateDataHelper.GetFloat(const Key: string;
const DefaultValue: Double): Double;
begin
if ContainsKey(Key) then
Result := Items[Key].Value.AsExtended
else
Result := DefaultValue;
end;
function TFrameStateDataHelper.GetInt(const Key: string;
const DefaultValue: Integer): Integer;
begin
if ContainsKey(Key) then
Result := Items[Key].Value.AsInteger
else
Result := DefaultValue;
end;
function TFrameStateDataHelper.GetInt64(const Key: string;
const DefaultValue: Int64): Int64;
begin
if ContainsKey(Key) then
Result := Items[Key].Value.AsInt64
else
Result := DefaultValue;
end;
function TFrameStateDataHelper.GetLong(const Key: string;
const DefaultValue: Cardinal): Cardinal;
begin
if ContainsKey(Key) then
Result := Items[Key].Value.AsInteger
else
Result := DefaultValue;
end;
function TFrameStateDataHelper.GetNumber(const Key: string;
const DefaultValue: NativeUInt): NativeUInt;
begin
if ContainsKey(Key) then
Result := Items[Key].Value.AsOrdinal
else
Result := DefaultValue;
end;
function TFrameStateDataHelper.GetPointer(const Key: string): Pointer;
begin
if ContainsKey(Key) then
Result := Items[Key].Value.AsVarRec.VPointer
else
Result := nil;
end;
function TFrameStateDataHelper.GetString(const Key: string): string;
begin
if ContainsKey(Key) then
Result := Items[Key].Value.ToString
else
Result := '';
end;
function TFrameStateDataHelper.Put(const Key: string; const Value: Cardinal): TFrameStateData;
begin
Result := Self;
AddOrSetValue(Key, GetDataValue(fdt_Long, Value));
end;
function TFrameStateDataHelper.Put(const Key: string; const Value: Integer): TFrameStateData;
begin
Result := Self;
AddOrSetValue(Key, GetDataValue(fdt_Integer, Value));
end;
function TFrameStateDataHelper.Put(const Key, Value: string): TFrameStateData;
begin
Result := Self;
AddOrSetValue(Key, GetDataValue(fdt_String, Value));
end;
function TFrameStateDataHelper.Put(const Key: string; const Value: NativeUInt): TFrameStateData;
begin
Result := Self;
AddOrSetValue(Key, GetDataValue(fdt_Number, Value));
end;
function TFrameStateDataHelper.Put(const Key: string; const Value: Boolean): TFrameStateData;
begin
Result := Self;
AddOrSetValue(Key, GetDataValue(fdt_Boolean, Value));
end;
function TFrameStateDataHelper.Put(const Key: string; const Value: Int64): TFrameStateData;
begin
Result := Self;
AddOrSetValue(Key, GetDataValue(fdt_Int64, Value));
end;
function TFrameStateDataHelper.Put(const Key: string; const Value: Double): TFrameStateData;
begin
Result := Self;
AddOrSetValue(Key, GetDataValue(fdt_Float, Value));
end;
function TFrameStateDataHelper.PutDateTime(const Key: string;
const Value: TDateTime): TFrameStateData;
begin
Result := Self;
AddOrSetValue(Key, GetDataValue(fdt_DateTime, Value));
end;
{ TFrameParamsHelper }
function TFrameParamsHelper.GetBoolean(const Key: string;
const DefaultValue: Boolean): Boolean;
begin
if ContainsKey(Key) then begin
Result := Items[Key].AsBoolean
end else
Result := DefaultValue;
end;
function TFrameParamsHelper.GetDateTime(const Key: string;
const DefaultValue: TDateTime): TDateTime;
begin
if ContainsKey(Key) then begin
Result := Items[Key].AsExtended
end else
Result := DefaultValue;
end;
function TFrameParamsHelper.GetFloat(const Key: string;
const DefaultValue: Double): Double;
begin
if ContainsKey(Key) then begin
Result := Items[Key].AsExtended
end else
Result := DefaultValue;
end;
function TFrameParamsHelper.GetInt(const Key: string;
const DefaultValue: Integer): Integer;
begin
if ContainsKey(Key) then begin
Result := Items[Key].AsInteger
end else
Result := DefaultValue;
end;
function TFrameParamsHelper.GetInt64(const Key: string;
const DefaultValue: Int64): Int64;
begin
if ContainsKey(Key) then begin
Result := Items[Key].AsInt64
end else
Result := DefaultValue;
end;
function TFrameParamsHelper.GetLong(const Key: string;
const DefaultValue: Cardinal): Cardinal;
begin
if ContainsKey(Key) then begin
Result := Items[Key].AsInteger
end else
Result := DefaultValue;
end;
function TFrameParamsHelper.GetNumber(const Key: string;
const DefaultValue: NativeUInt): NativeUInt;
begin
if ContainsKey(Key) then begin
Result := Items[Key].AsOrdinal
end else
Result := DefaultValue;
end;
function TFrameParamsHelper.GetPointer(const Key: string): Pointer;
begin
if ContainsKey(Key) then begin
Result := Items[Key].AsVarRec.VPointer
end else
Result := nil;
end;
function TFrameParamsHelper.GetString(const Key: string): string;
begin
if ContainsKey(Key) then begin
Result := Items[Key].ToString
end else
Result := '';
end;
function TFrameParamsHelper.Put(const Key: string; const Value: Integer): TFrameParams;
begin
Result := Self;
AddOrSetValue(Key, Value);
end;
function TFrameParamsHelper.Put(const Key, Value: string): TFrameParams;
begin
Result := Self;
AddOrSetValue(Key, Value);
end;
function TFrameParamsHelper.Put(const Key: string; const Value: Cardinal): TFrameParams;
begin
Result := Self;
AddOrSetValue(Key, Value);
end;
function TFrameParamsHelper.Put(const Key: string; const Value: NativeUInt): TFrameParams;
begin
Result := Self;
AddOrSetValue(Key, Value);
end;
function TFrameParamsHelper.Put(const Key: string; const Value: Boolean): TFrameParams;
begin
Result := Self;
AddOrSetValue(Key, Value);
end;
function TFrameParamsHelper.Put(const Key: string; const Value: Int64): TFrameParams;
begin
Result := Self;
AddOrSetValue(Key, Value);
end;
function TFrameParamsHelper.Put(const Key: string; const Value: Double): TFrameParams;
begin
Result := Self;
AddOrSetValue(Key, Value);
end;
function TFrameParamsHelper.PutDateTime(const Key: string;
const Value: TDateTime): TFrameParams;
begin
Result := Self;
AddOrSetValue(Key, Value);
end;
{ TCustomFormHelper }
procedure TCustomFormHelper.SetFocus;
var
LControl: IControl;
Item: TFmxObject;
Ctrl: TControl;
I: Integer;
begin
try
for I := 0 to Self.ChildrenCount - 1 do begin
Item := Children.Items[I];
if (Item is TControl) then begin
Ctrl := Item as TControl;
if (Ctrl.Visible) and (Ctrl.Enabled) and (Ctrl.CanFocus) then begin
LControl := Root.NewFocusedControl(Ctrl);
if LControl <> nil then begin
Root.SetFocused(LControl);
Break;
end;
end else if Ctrl.ControlsCount > 0 then begin
if Ctrl.SetFocusObject(Ctrl) then
Break;
end;
end;
end;
except
end;
end;
initialization
FPublicState := TFrameState.Create(nil, True);
FPublicState.Load;
finalization
FreeAndNil(FPublicState);
end.
| 28.288921 | 170 | 0.676748 |
fc31f257eda1f583ca0efb6500b34cf13b02ab68 | 7,831 | pas | Pascal | Libraries/Spring4D/Source/Base/Patches/Spring.Patches.RSP13589.pas | jomael/Concepts | 82d18029e41d55e897d007f826c021cdf63e53f8 | [
"Apache-2.0"
]
| 62 | 2016-01-20T16:26:25.000Z | 2022-02-28T14:25:52.000Z | Libraries/Spring4D/Source/Base/Patches/Spring.Patches.RSP13589.pas | jomael/Concepts | 82d18029e41d55e897d007f826c021cdf63e53f8 | [
"Apache-2.0"
]
| null | null | null | Libraries/Spring4D/Source/Base/Patches/Spring.Patches.RSP13589.pas | jomael/Concepts | 82d18029e41d55e897d007f826c021cdf63e53f8 | [
"Apache-2.0"
]
| 20 | 2016-09-08T00:15:22.000Z | 2022-01-26T13:13:08.000Z | {***************************************************************************}
{ }
{ Spring Framework for Delphi }
{ }
{ Copyright (c) 2009-2018 Spring4D Team }
{ }
{ http://www.spring4d.org }
{ }
{***************************************************************************}
{ }
{ 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. }
{ }
{***************************************************************************}
{$I Spring.inc}
unit Spring.Patches.RSP13589;
interface
implementation
{$IFNDEF DELPHIX_BERLIN_UP}{$IFDEF MSWINDOWS}
uses
RTLConsts,
Rtti,
SysConst,
SysUtils,
TypInfo,
Windows;
type
{$M+}
{$RTTI EXPLICIT METHODS([vcPublic, vcPublished])}
TRecordMethodHelper = record
procedure RecordMethod;
end;
{$M-}
TRttiMethodFix = class(TRttiMethod)
private
function RecordDispatchInvoke(Instance: TValue;
const Args: array of TValue): TValue;
end;
procedure TRecordMethodHelper.RecordMethod;
begin
end;
function PassByRef(TypeInfo: PTypeInfo; CC: TCallConv; IsConst: Boolean = False): Boolean;
{$IFDEF CPUARM64}
var
ctx: TRTTIContext;
{$ENDIF CPUARM64}
begin
if TypeInfo = nil then
Exit(False);
case TypeInfo^.Kind of
{$IF Defined(CPUX86)}
tkArray:
Result := GetTypeData(TypeInfo)^.ArrayData.Size > SizeOf(Pointer);
tkRecord:
if (CC in [ccCdecl, ccStdCall, ccSafeCall]) and not IsConst then
Result := False
else
Result := GetTypeData(TypeInfo)^.RecSize > SizeOf(Pointer);
tkVariant:
Result := IsConst or not (CC in [ccCdecl, ccStdCall, ccSafeCall]);
{$ELSEIF Defined(CPUX64)}
tkArray:
Result := GetTypeData(TypeInfo)^.ArrayData.Size > SizeOf(Pointer);
tkRecord:
Result := not (GetTypeData(TypeInfo)^.RecSize in [1,2,4,8]);
tkMethod,
tkVariant:
Result := True;
{$ELSEIF Defined(CPUARM32)}
tkArray,
tkRecord:
Result := CC in [ccReg, ccPascal];
tkMethod,
tkVariant:
Result := True;
{$ELSEIF Defined(CPUARM64)}
tkArray:
if ctx.GetType(TypeInfo).IsHFA then
Result := CC in [ccReg, ccPascal]
else
Result := (GetTypeData(TypeInfo)^.ArrayData.Size > 16) or (CC in [ccReg, ccPascal]);
tkRecord:
if ctx.GetType(TypeInfo).IsHFA then
Result := CC in [ccReg, ccPascal]
else
Result := (GetTypeData(TypeInfo)^.RecSize > 16) or (CC in [ccReg, ccPascal]);
tkMethod,
tkVariant:
Result := True;
{$IFEND CPUTYPE}
{$IFNDEF NEXTGEN}
tkString:
Result := GetTypeData(TypeInfo)^.MaxLength > SizeOf(Pointer);
{$ENDIF !NEXTGEN}
else
Result := False;
end;
end;
procedure PushSelfFirst(CC: TCallConv; var argList: TArray<TValue>;
var Index: Integer; const Value: TValue); inline;
begin
{$IFDEF CPUX86}
if CC = ccPascal then Exit;
{$ENDIF CPUX86}
argList[Index] := Value;
Inc(Index);
end;
procedure PushSelfLast(CC: TCallConv; var argList: TArray<TValue>;
var Index: Integer; const Value: TValue); inline;
begin
{$IFDEF CPUX86}
if CC <> ccPascal then Exit;
argList[Index] := Value;
{$ELSE !CPUX86}
{$ENDIF CPUX86}
end;
procedure PassArg(Par: TRttiParameter; const ArgSrc: TValue; var ArgDest: TValue; CC: TCallConv);
begin
if Par.ParamType = nil then
ArgDest := TValue.From<Pointer>(ArgSrc.GetReferenceToRawData)
else if Par.Flags * [pfVar, pfOut] <> [] then
begin
if Par.ParamType.Handle <> ArgSrc.TypeInfo then
raise EInvalidCast.CreateRes(@SByRefArgMismatch);
ArgDest := TValue.From<Pointer>(ArgSrc.GetReferenceToRawData);
end
else if (pfConst in Par.Flags) and
PassByRef(Par.ParamType.Handle, CC, True) then
begin
if TypeInfo(TValue) = Par.ParamType.Handle then
ArgDest := TValue.From(ArgSrc)
else
begin
if Par.ParamType.Handle <> ArgSrc.TypeInfo then
raise EInvalidCast.CreateRes(@SByRefArgMismatch);
ArgDest := TValue.From(ArgSrc.GetReferenceToRawData);
end
end
else
ArgDest := ArgSrc.Cast(Par.ParamType.Handle);
end;
function TRttiMethodFix.RecordDispatchInvoke(Instance: TValue;
const Args: array of TValue): TValue;
var
argList: TArray<TValue>;
parList: TArray<TRttiParameter>;
i, currArg: Integer;
inst: TValue;
begin
if not IsStatic then
if (Instance.Kind = tkPointer) and
(
(
(Instance.TypeData^.RefType <> nil) and
(Instance.TypeData^.RefType^ = Parent.Handle)
)
or
(
(Instance.TypeData^.RefType = nil) or
(Instance.TypeData^.RefType^ = nil)
)
) then
begin
inst := Instance;
end
else
begin
if Instance.TypeInfo <> Parent.Handle then
raise EInvalidCast.CreateRes(@SInvalidCast);
inst := TValue.From(Instance.GetReferenceToRawData);
end;
parList := GetParameters;
if Length(Args) <> Length(parList) then
raise EInvocationError.CreateRes(@SParameterCountMismatch);
if IsStatic then
SetLength(argList, Length(Args))
else
SetLength(argList, Length(Args) + 1);
currArg := 0;
if not IsStatic then
PushSelfFirst(CallingConvention, argList, currArg, inst);
for i := 0 to Length(Args) - 1 do
begin
PassArg(parList[i], Args[i], argList[currArg], CallingConvention);
Inc(currArg);
end;
if not IsStatic then
PushSelfLast(CallingConvention, argList, currArg, inst);
if ReturnType <> nil then
Result := System.Rtti.Invoke(CodeAddress, argList, CallingConvention, ReturnType.Handle, IsStatic)
else
Result := System.Rtti.Invoke(CodeAddress, argList, CallingConvention, nil);
end;
function GetVirtualMethod(AClass: TClass; const Index: Integer): Pointer;
begin
Result := PPointer(UINT_PTR(AClass) + UINT_PTR(Index * SizeOf(Pointer)))^;
end;
procedure RedirectFunction(OrgProc, NewProc: Pointer);
type
TJmpBuffer = packed record
Jmp: Byte;
Offset: Integer;
end;
var
n: UINT_PTR;
JmpBuffer: TJmpBuffer;
begin
JmpBuffer.Jmp := $E9;
JmpBuffer.Offset := PByte(NewProc) - (PByte(OrgProc) + 5);
if not WriteProcessMemory(GetCurrentProcess, OrgProc, @JmpBuffer, SizeOf(JmpBuffer), n) then
RaiseLastOSError;
end;
procedure ApplyPatch;
var
ctx: TRttiContext;
method: TRttiMethod;
begin
// Fix TRttiRecordMethod.DispatchInvoke
method := ctx.GetType(TypeInfo(TRecordMethodHelper)).GetMethod('RecordMethod');
RedirectFunction(GetVirtualMethod(method.ClassType, 13), @TRttiMethodFix.RecordDispatchInvoke);
end;
initialization
ApplyPatch;
{$ENDIF}{$ENDIF}
end.
| 30.119231 | 102 | 0.590474 |
fccfc3d3a488dbbad9fbffa93f3ad4fb209f3072 | 10,080 | pas | Pascal | src/Horse.Provider.VCL.pas | HashLoad/horse | 63fdf7a7cb976dcec8caad1b6219bb759d392d0a | [
"MIT"
]
| 633 | 2018-10-02T05:53:07.000Z | 2022-03-31T11:32:47.000Z | src/Horse.Provider.VCL.pas | brunoribeiroti/horse | 0b461be805670373027c20446fb755176c388b95 | [
"MIT"
]
| 99 | 2018-10-02T18:46:30.000Z | 2022-03-28T21:10:20.000Z | src/Horse.Provider.VCL.pas | brunoribeiroti/horse | 0b461be805670373027c20446fb755176c388b95 | [
"MIT"
]
| 191 | 2018-11-05T10:18:51.000Z | 2022-03-31T11:34:47.000Z | unit Horse.Provider.VCL;
interface
{$IF DEFINED(HORSE_VCL)}
uses
Horse.Provider.Abstract, Horse.Constants, Horse.Provider.IOHandleSSL,
IdHTTPWebBrokerBridge, IdSSLOpenSSL, IdContext,
System.Classes, System.SyncObjs, System.SysUtils;
type
THorseProvider<T: class> = class(THorseProviderAbstract<T>)
private
class var FPort: Integer;
class var FHost: string;
class var FRunning: Boolean;
class var FEvent: TEvent;
class var FMaxConnections: Integer;
class var FListenQueue: Integer;
class var FIdHTTPWebBrokerBridge: TIdHTTPWebBrokerBridge;
class var FHorseProviderIOHandleSSL: THorseProviderIOHandleSSL;
class function GetDefaultHTTPWebBroker: TIdHTTPWebBrokerBridge;
class function GetDefaultHorseProviderIOHandleSSL: THorseProviderIOHandleSSL;
class function GetDefaultEvent: TEvent;
class function HTTPWebBrokerIsNil: Boolean;
class procedure OnAuthentication(AContext: TIdContext; const AAuthType, AAuthData: string; var VUsername, VPassword: string; var VHandled: Boolean);
class procedure OnQuerySSLPort(APort: Word; var VUseSSL: Boolean);
class procedure SetListenQueue(const Value: Integer); static;
class procedure SetMaxConnections(const Value: Integer); static;
class procedure SetPort(const Value: Integer); static;
class procedure SetIOHandleSSL(const Value: THorseProviderIOHandleSSL); static;
class procedure SetHost(const Value: string); static;
class function GetListenQueue: Integer; static;
class function GetMaxConnections: Integer; static;
class function GetPort: Integer; static;
class function GetDefaultPort: Integer; static;
class function GetDefaultHost: string; static;
class function GetIOHandleSSL: THorseProviderIOHandleSSL; static;
class function GetHost: string; static;
class procedure InternalListen; virtual;
class procedure InternalStopListen; virtual;
class procedure InitServerIOHandlerSSLOpenSSL(AIdHTTPWebBrokerBridge: TIdHTTPWebBrokerBridge; FHorseProviderIOHandleSSL: THorseProviderIOHandleSSL);
public
constructor Create; reintroduce; overload;
constructor Create(APort: Integer); reintroduce; overload; deprecated 'Use Port method to set port';
class property Host: string read GetHost write SetHost;
class property Port: Integer read GetPort write SetPort;
class property MaxConnections: Integer read GetMaxConnections write SetMaxConnections;
class property ListenQueue: Integer read GetListenQueue write SetListenQueue;
class property IOHandleSSL: THorseProviderIOHandleSSL read GetIOHandleSSL write SetIOHandleSSL;
class procedure Listen; overload; override;
class procedure StopListen; override;
class procedure Listen(APort: Integer; const AHost: string = '0.0.0.0'; ACallback: TProc<T> = nil); reintroduce; overload; static;
class procedure Listen(APort: Integer; ACallback: TProc<T>); reintroduce; overload; static;
class procedure Listen(AHost: string; const ACallback: TProc<T> = nil); reintroduce; overload; static;
class procedure Listen(ACallback: TProc<T>); reintroduce; overload; static;
class procedure Start; deprecated 'Use Listen instead';
class procedure Stop; deprecated 'Use StopListen instead';
class function IsRunning: Boolean;
class destructor UnInitialize;
end;
{$ENDIF}
implementation
{$IF DEFINED(HORSE_VCL)}
uses
Web.WebReq, Horse.WebModule, IdCustomTCPServer;
{ THorseProvider<T> }
class function THorseProvider<T>.IsRunning: Boolean;
begin
Result := FRunning;
end;
class function THorseProvider<T>.GetDefaultHTTPWebBroker: TIdHTTPWebBrokerBridge;
begin
if HTTPWebBrokerIsNil then
begin
FIdHTTPWebBrokerBridge := TIdHTTPWebBrokerBridge.Create(nil);
FIdHTTPWebBrokerBridge.OnParseAuthentication := OnAuthentication;
FIdHTTPWebBrokerBridge.OnQuerySSLPort := OnQuerySSLPort;
end;
Result := FIdHTTPWebBrokerBridge;
end;
class function THorseProvider<T>.HTTPWebBrokerIsNil: Boolean;
begin
Result := FIdHTTPWebBrokerBridge = nil;
end;
class procedure THorseProvider<T>.OnQuerySSLPort(APort: Word; var VUseSSL: Boolean);
begin
VUseSSL := (FHorseProviderIOHandleSSL <> nil) and (FHorseProviderIOHandleSSL.Active);
end;
constructor THorseProvider<T>.Create(APort: Integer);
begin
inherited Create;
SetPort(APort);
end;
constructor THorseProvider<T>.Create;
begin
inherited Create;
end;
class function THorseProvider<T>.GetDefaultEvent: TEvent;
begin
if FEvent = nil then
FEvent := TEvent.Create;
Result := FEvent;
end;
class function THorseProvider<T>.GetDefaultHorseProviderIOHandleSSL: THorseProviderIOHandleSSL;
begin
if FHorseProviderIOHandleSSL = nil then
FHorseProviderIOHandleSSL := THorseProviderIOHandleSSL.Create;
Result := FHorseProviderIOHandleSSL;
end;
class function THorseProvider<T>.GetDefaultHost: string;
begin
Result := DEFAULT_HOST;
end;
class function THorseProvider<T>.GetDefaultPort: Integer;
begin
Result := DEFAULT_PORT;
end;
class function THorseProvider<T>.GetHost: string;
begin
Result := FHost;
end;
class function THorseProvider<T>.GetIOHandleSSL: THorseProviderIOHandleSSL;
begin
Result := GetDefaultHorseProviderIOHandleSSL;
end;
class function THorseProvider<T>.GetListenQueue: Integer;
begin
Result := FListenQueue;
end;
class function THorseProvider<T>.GetMaxConnections: Integer;
begin
Result := FMaxConnections;
end;
class function THorseProvider<T>.GetPort: Integer;
begin
Result := FPort;
end;
class procedure THorseProvider<T>.InitServerIOHandlerSSLOpenSSL(AIdHTTPWebBrokerBridge: TIdHTTPWebBrokerBridge; FHorseProviderIOHandleSSL: THorseProviderIOHandleSSL);
var
LIOHandleSSL: TIdServerIOHandlerSSLOpenSSL;
begin
LIOHandleSSL := TIdServerIOHandlerSSLOpenSSL.Create(AIdHTTPWebBrokerBridge);
LIOHandleSSL.SSLOptions.CertFile := FHorseProviderIOHandleSSL.CertFile;
LIOHandleSSL.SSLOptions.RootCertFile := FHorseProviderIOHandleSSL.RootCertFile;
LIOHandleSSL.SSLOptions.KeyFile := FHorseProviderIOHandleSSL.KeyFile;
LIOHandleSSL.SSLOptions.Method := FHorseProviderIOHandleSSL.Method;
LIOHandleSSL.SSLOptions.SSLVersions := FHorseProviderIOHandleSSL.SSLVersions;
LIOHandleSSL.OnGetPassword := FHorseProviderIOHandleSSL.OnGetPassword;
AIdHTTPWebBrokerBridge.IOHandler := LIOHandleSSL;
end;
class procedure THorseProvider<T>.InternalListen;
var
LAttach: string;
LIdHTTPWebBrokerBridge: TIdHTTPWebBrokerBridge;
begin
inherited;
if FPort <= 0 then
FPort := GetDefaultPort;
if FHost.IsEmpty then
FHost := GetDefaultHost;
LIdHTTPWebBrokerBridge := GetDefaultHTTPWebBroker;
WebRequestHandler.WebModuleClass := WebModuleClass;
try
if FMaxConnections > 0 then
begin
WebRequestHandler.MaxConnections := FMaxConnections;
GetDefaultHTTPWebBroker.MaxConnections := FMaxConnections;
end;
if FListenQueue = 0 then
FListenQueue := IdListenQueueDefault;
if FHorseProviderIOHandleSSL <> nil then
InitServerIOHandlerSSLOpenSSL(LIdHTTPWebBrokerBridge, GetDefaultHorseProviderIOHandleSSL);
LIdHTTPWebBrokerBridge.ListenQueue := FListenQueue;
LIdHTTPWebBrokerBridge.Bindings.Clear;
if FHost <> GetDefaultHost then
begin
LIdHTTPWebBrokerBridge.Bindings.Add;
LIdHTTPWebBrokerBridge.Bindings.Items[0].IP := FHost;
LIdHTTPWebBrokerBridge.Bindings.Items[0].Port := FPort;
end;
LIdHTTPWebBrokerBridge.DefaultPort := FPort;
LIdHTTPWebBrokerBridge.Active := True;
LIdHTTPWebBrokerBridge.StartListening;
FRunning := True;
DoOnListen;
except
raise;
end;
end;
class procedure THorseProvider<T>.InternalStopListen;
begin
if not HTTPWebBrokerIsNil then
begin
GetDefaultHTTPWebBroker.StopListening;
GetDefaultHTTPWebBroker.Active := False;
FRunning := False;
if FEvent <> nil then
GetDefaultEvent.SetEvent;
end
else
raise Exception.Create('Horse not listen');
end;
class procedure THorseProvider<T>.Start;
begin
Listen;
end;
class procedure THorseProvider<T>.Stop;
begin
StopListen;
end;
class procedure THorseProvider<T>.StopListen;
begin
InternalStopListen;
end;
class procedure THorseProvider<T>.Listen;
begin
InternalListen;
end;
class procedure THorseProvider<T>.Listen(APort: Integer; const AHost: string; ACallback: TProc<T>);
begin
SetPort(APort);
SetHost(AHost);
SetOnListen(ACallback);
InternalListen;
end;
class procedure THorseProvider<T>.Listen(AHost: string; const ACallback: TProc<T>);
begin
Listen(FPort, AHost, ACallback);
end;
class procedure THorseProvider<T>.Listen(ACallback: TProc<T>);
begin
Listen(FPort, FHost, ACallback);
end;
class procedure THorseProvider<T>.Listen(APort: Integer; ACallback: TProc<T>);
begin
Listen(APort, FHost, ACallback);
end;
class procedure THorseProvider<T>.OnAuthentication(AContext: TIdContext; const AAuthType, AAuthData: string; var VUsername, VPassword: string; var VHandled: Boolean);
begin
VHandled := True;
end;
class procedure THorseProvider<T>.SetHost(const Value: string);
begin
FHost := Value.Trim;
end;
class procedure THorseProvider<T>.SetIOHandleSSL(const Value: THorseProviderIOHandleSSL);
begin
FHorseProviderIOHandleSSL := Value;
end;
class procedure THorseProvider<T>.SetListenQueue(const Value: Integer);
begin
FListenQueue := Value;
end;
class procedure THorseProvider<T>.SetMaxConnections(const Value: Integer);
begin
FMaxConnections := Value;
end;
class procedure THorseProvider<T>.SetPort(const Value: Integer);
begin
FPort := Value;
end;
class destructor THorseProvider<T>.UnInitialize;
begin
FreeAndNil(FIdHTTPWebBrokerBridge);
if FEvent <> nil then
FreeAndNil(FEvent);
if FHorseProviderIOHandleSSL <> nil then
FreeAndNil(FHorseProviderIOHandleSSL);
end;
{$ENDIF}
end.
| 31.698113 | 167 | 0.757341 |
83f67e4c611027f7c78119271791ec0982513d14 | 1,158 | dpr | Pascal | Examples/SetPixel/SetPixel.dpr | amber8706/KolibriOS | fb945437226808d1d3faa4006ff7a6f94a080a7f | [
"BSD-2-Clause"
]
| null | null | null | Examples/SetPixel/SetPixel.dpr | amber8706/KolibriOS | fb945437226808d1d3faa4006ff7a6f94a080a7f | [
"BSD-2-Clause"
]
| null | null | null | Examples/SetPixel/SetPixel.dpr | amber8706/KolibriOS | fb945437226808d1d3faa4006ff7a6f94a080a7f | [
"BSD-2-Clause"
]
| null | null | null | program SetPixelApp;
uses
KolibriOS;
var
Left, Right, Top, Bottom: Integer;
X, Y: Integer;
begin
with GetScreenSize do
begin
Right := 180;
Bottom := 180;
Left := (Width - Right) div 2;
Top := (Height - Bottom) div 2;
end;
while True do
case WaitEvent of
REDRAW_EVENT:
begin
BeginDraw;
DrawWindow(Left, Top, Right, Bottom, 'Set Pixel', $00FFFFFF,
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
for Y := 0 to 50 do
for X := 0 to 50 do
if ((X mod 2) = 0) or ((Y mod 2) = 0) then
SetPixel(X, Y, $00FF0000);
for Y := 50 to 100 do
for X := 50 to 100 do
if ((X mod 3) = 0) or ((Y mod 3) = 0) then
SetPixel(X, Y, $00007F00);
for Y := 100 to 150 do
for X := 100 to 150 do
if ((X mod 4) = 0) or ((Y mod 4) = 0) then
SetPixel(X, Y, $000000FF);
EndDraw;
end;
KEY_EVENT:
GetKey;
BUTTON_EVENT:
if GetButton.ID = 1 then
TerminateThread;
end;
end.
| 22.269231 | 79 | 0.494819 |
f16bc8d92236aa73e8ec1f4e860c010fde9e8620 | 6,561 | pas | Pascal | idee/source/Crt/frm_TestDrawControl.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 11 | 2017-06-17T05:13:45.000Z | 2021-07-11T13:18:48.000Z | idee/source/Crt/frm_TestDrawControl.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 2 | 2019-03-05T12:52:40.000Z | 2021-12-03T12:34:26.000Z | idee/source/Crt/frm_TestDrawControl.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 6 | 2017-09-07T09:10:09.000Z | 2022-02-19T20:19:58.000Z | unit frm_TestDrawControl;
{$mode delphi}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
Buttons, Spin, StdCtrls;
type
{ TfrmTestDrawControl }
TfrmTestDrawControl = class(TForm)
btnTestCharColFkt: TBitBtn;
btnDrawTest1: TBitBtn;
btnCancel: TBitBtn;
btnClose: TBitBtn;
btnDrawLogo: TBitBtn;
btnDrawJC: TBitBtn;
btnDrawPlasma: TBitBtn;
btnNormalize2: TSpeedButton;
btnNormalize3: TSpeedButton;
btnNormalize4: TSpeedButton;
Memo1: TMemo;
PaintBox1: TPaintBox;
pnlConfig: TPanel;
pnlBottom: TPanel;
btnNormalize1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpinEdit1: TSpinEdit;
SpinEdit10: TSpinEdit;
SpinEdit11: TSpinEdit;
SpinEdit12: TSpinEdit;
SpinEdit13: TSpinEdit;
SpinEdit14: TSpinEdit;
SpinEdit15: TSpinEdit;
SpinEdit16: TSpinEdit;
SpinEdit2: TSpinEdit;
SpinEdit3: TSpinEdit;
SpinEdit4: TSpinEdit;
SpinEdit5: TSpinEdit;
SpinEdit6: TSpinEdit;
SpinEdit7: TSpinEdit;
SpinEdit8: TSpinEdit;
SpinEdit9: TSpinEdit;
procedure btnDrawPlasmaClick(Sender: TObject);
procedure btnTestCharColFct(Sender: TObject);
procedure btnDrawJCClick(Sender: TObject);
procedure btnDrawLogoClick(Sender: TObject);
procedure btnDrawTest1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure btnNormalizeClick(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpinEdit1Change(Sender: TObject);
private
procedure FlushScreen(Sender: Tobject);
public
end;
var
frmTestDrawControl: TfrmTestDrawControl;
implementation
uses unt_TestTCol01, paszlib;
{$R *.lfm}
{ TfrmTestDrawControl }
procedure TfrmTestDrawControl.btnDrawLogoClick(Sender: TObject);
begin
Execute(btnDrawLogo.Glyph);
end;
procedure TfrmTestDrawControl.btnDrawTest1Click(Sender: TObject);
begin
Execute(btnDrawTest1.Glyph);
end;
procedure TfrmTestDrawControl.FormCreate(Sender: TObject);
var
K, V: PtrInt;
i: integer;
lsp: TComponent;
begin
for i := 1 to 16 do
begin
lsp := FindComponent('SpinEdit' + IntToStr(i));
if assigned(lsp) then
begin
K := TWinControl(lsp).Tag div 5 + 1;
V := TWinControl(lsp).Tag mod 5 - 2;
TSpinEdit(lsp).Value := CComp[K, V];
end;
end;
onFlushScreen:=FlushScreen;
end;
procedure TfrmTestDrawControl.btnNormalizeClick(Sender: TObject);
var
Line, K, V: PtrInt;
Summ, i: Integer;
lsp: TComponent;
begin
Line := TWinControl(sender).tag;
Summ := 0;
for i := -2 to 2 do
summ := summ + CComp[line,i];
for i := -2 to 2 do
begin
CComp[line,i] := (CComp[line,i] *255) div summ;
lsp := FindComponent('SpinEdit' + IntToStr(line*4+ ((i-2) *4) div 5));
if assigned(lsp) then
begin
K := TWinControl(lsp).Tag div 5 + 1;
V := TWinControl(lsp).Tag mod 5 - 2;
TSpinEdit(lsp).Value := CComp[K, V];
end;
end;
end;
procedure TfrmTestDrawControl.SpeedButton2Click(Sender: TObject);
var
K, J: integer;
Line: string;
ts: TMemoryStream;
Buffer:array of byte;
complen: Cardinal;
bb:byte;
begin
PaintBox1.Canvas.Brush.Style := bsSolid;
memo1.Clear;
for K := 0 to 49 do
begin
Line := BoolToStr(K = 0, '((', '(');
for J := 0 to 79 do
begin
Line := line + '$' + IntTohex(chh[j, k], 4) + BoolToStr(J = 79, ')', ', ');
end;
memo1.Append(line + BoolToStr(K = 49, ');', ','));
end;
ts:=TMemoryStream.create;
setlength(Buffer,sizeof(chh));
compress(@Buffer[0],complen,@chh[0,0],SizeOf(chh));
setlength(Buffer,complen);
memo1.Append('Compr. length:'+inttostr(complen));
ts.WriteWord(word(complen));
ts.WriteBuffer(Buffer[0],complen);
ts.Position:=0;
line:=#9'(';
while ts.Position<ts.Size do
begin
bb:=ts.ReadByte;
line := line + '$'+inttohex(bb,2)+',';
if ts.Position mod 16=0 then
begin
memo1.Append(line);
line :=#9' ';
end;
end;
delete(line,length(line),1);
if length(line)>2 then
memo1.Append(line+');');
freeandnil(ts);
end;
procedure TfrmTestDrawControl.SpinEdit1Change(Sender: TObject);
var
K, V: PtrInt;
begin
K := TWinControl(Sender).Tag div 5 + 1;
V := TWinControl(Sender).Tag mod 5 - 2;
CComp[K, V] := TSpinEdit(Sender).Value;
end;
procedure TfrmTestDrawControl.FlushScreen(Sender: Tobject);
var
K, J: Integer;
bmp: TBitmap;
begin
bmp:=TBitmap.Create;
try
bmp.Width:=79;
bmp.Height:=99;
for K := 0 to 49 do
for J := 0 to 79 do
with bmp.Canvas do
begin
pen.Color := istcol[J, k].c;
line(J , k * 2, J , k * 2 + 2);
end;
PaintBox1.Canvas.StretchDraw(rect(0,0,159,199),bmp);
finally
freeandnil(bmp);
end;
Application.ProcessMessages;
end;
procedure TfrmTestDrawControl.btnDrawJCClick(Sender: TObject);
begin
Execute(btnDrawJC.Glyph);
end;
procedure TfrmTestDrawControl.btnTestCharColFct(Sender: TObject);
var
I, J, K: integer;
cc: TColorKmpn;
Line: string;
begin
PaintBox1.Canvas.Brush.Style := bsSolid;
for I := 0 to 15 do
for J := 0 to 15 do
for K := 4 downto 1 do
begin
cc := CalcTPxColor(i, j, CComp[K, -2], CComp[K, -1], CComp[K, 2], CComp[K, 1]);
PaintBox1.Canvas.Brush.Color := cc.c;
PaintBox1.Canvas.FillRect(I * 5 + ((k - 1) mod 2) * 80, j * 5 + ((k - 1) div 2) * 80, I * 5 + ((k - 1) mod 2) * 80 + 5, j * 5 + ((k - 1) div 2) * 80 + 5);
end;
memo1.Clear;
for K := 1 to 4 do
begin
Line := BoolToStr(K = 1, '((', '(');
for J := -2 to 2 do
Line := line + IntToStr(CComp[K, J]) + BoolToStr(J = 2, ')', ', ');
memo1.Append(line + BoolToStr(K = 4, ');', ','));
end;
end;
procedure TfrmTestDrawControl.btnDrawPlasmaClick(Sender: TObject);
begin
Execute2(false);
end;
end.
| 27 | 171 | 0.575065 |
fc86e96ff1a96e415fc2a4b954a81a8ae09dd7aa | 11,601 | dfm | Pascal | Relatorios/uRelVendaPorData.dfm | EdilanCF/ERP_Edilan | 101672d9d20fcbca547013bb701312b49016e86f | [
"MIT"
]
| 1 | 2022-02-02T03:30:09.000Z | 2022-02-02T03:30:09.000Z | Relatorios/uRelVendaPorData.dfm | EdilanCF/ERP_Edilan | 101672d9d20fcbca547013bb701312b49016e86f | [
"MIT"
]
| null | null | null | Relatorios/uRelVendaPorData.dfm | EdilanCF/ERP_Edilan | 101672d9d20fcbca547013bb701312b49016e86f | [
"MIT"
]
| null | null | null | object FrmRelVendaPorData: TFrmRelVendaPorData
Left = 0
Top = 0
Caption = 'FrmRelVendaPorData'
ClientHeight = 484
ClientWidth = 796
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnDestroy = FormDestroy
PixelsPerInch = 96
TextHeight = 13
object RLReport1: TRLReport
Left = -6
Top = -48
Width = 794
Height = 1123
DataSource = DtsVendaPorData
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -15
Font.Name = 'Arial'
Font.Style = []
Transparent = False
object RLBand1: TRLBand
Left = 38
Top = 38
Width = 718
Height = 59
BandType = btHeader
Transparent = False
object RLDraw1: TRLDraw
Left = 0
Top = 46
Width = 718
Height = 13
Align = faBottom
DrawKind = dkLine
Pen.Width = 2
Transparent = False
end
object RLLabel1: TRLLabel
Left = 202
Top = 0
Width = 314
Height = 46
Align = faCenter
Alignment = taCenter
Caption = 'Vendas Por Data'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -33
Font.Name = 'Arial Black'
Font.Style = []
ParentFont = False
Transparent = False
end
end
object Rodape: TRLBand
Left = 38
Top = 276
Width = 718
Height = 79
BandType = btFooter
Transparent = False
object RLPanel2: TRLPanel
Left = 0
Top = 41
Width = 718
Height = 17
Align = faCenter
Color = 13092783
ParentColor = False
Transparent = False
end
object RLDraw2: TRLDraw
Left = 0
Top = 0
Width = 718
Height = 21
Align = faTop
DrawKind = dkLine
Pen.Width = 2
Transparent = False
end
object RLSystemInfo1: TRLSystemInfo
Left = 0
Top = 17
Width = 72
Height = 18
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Arial'
Font.Style = []
Info = itFullDate
ParentFont = False
Text = ''
Transparent = False
end
object RLSystemInfo2: TRLSystemInfo
Left = 682
Top = 18
Width = 128
Height = 17
Info = itLastPageNumber
Text = ''
Transparent = False
end
object RLSystemInfo3: TRLSystemInfo
Left = 562
Top = 16
Width = 100
Height = 17
Alignment = taRightJustify
Info = itPageNumber
Text = ''
Transparent = False
end
object RLLabel2: TRLLabel
Left = 668
Top = 16
Width = 8
Height = 19
Caption = '/'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentFont = False
Transparent = False
end
object RLLabel3: TRLLabel
Left = 573
Top = 16
Width = 63
Height = 19
Caption = 'P'#225'gina:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentFont = False
Transparent = False
end
end
object BandaDoGrupo: TRLGroup
Left = 38
Top = 97
Width = 718
Height = 152
DataFields = 'datavenda'
Transparent = False
object RLBand4: TRLBand
Left = 0
Top = 0
Width = 718
Height = 25
BandType = btHeader
Color = 15527119
ParentColor = False
Transparent = False
object RLLabel4: TRLLabel
Left = 155
Top = 4
Width = 40
Height = 18
Caption = 'Data:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -15
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentFont = False
Transparent = False
end
object RLDBText1: TRLDBText
Left = 201
Top = 5
Width = 62
Height = 16
Alignment = taCenter
DataField = 'datavenda'
DataSource = DtsVendaPorData
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Text = ''
Transparent = False
end
end
object RLBand2: TRLBand
Left = 0
Top = 25
Width = 718
Height = 24
BandType = btColumnHeader
Color = clScrollBar
ParentColor = False
Transparent = False
object RLLabel5: TRLLabel
Left = 85
Top = 3
Width = 122
Height = 18
Caption = 'Nome do Cliente'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -15
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentFont = False
Transparent = False
end
object RLLabel8: TRLLabel
Left = 655
Top = 2
Width = 40
Height = 18
Caption = 'Valor'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -15
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentFont = False
Transparent = False
end
object RLLabel7: TRLLabel
Left = 9
Top = 2
Width = 63
Height = 18
Caption = 'VendaID'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -15
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentFont = False
Transparent = False
end
end
object RLBand3: TRLBand
Left = 0
Top = 49
Width = 718
Height = 24
Transparent = False
object RLDBText2: TRLDBText
Left = 86
Top = 6
Width = 36
Height = 16
DataField = 'nome'
DataSource = DtsVendaPorData
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Text = ''
Transparent = False
end
object RLDBText5: TRLDBText
Left = 649
Top = 6
Width = 66
Height = 16
Alignment = taRightJustify
DataField = 'totalVenda'
DataSource = DtsVendaPorData
DisplayMask = '#0.00'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Text = ''
Transparent = False
end
object RLDBText3: TRLDBText
Left = 9
Top = 6
Width = 49
Height = 16
DataField = 'vendaID'
DataSource = DtsVendaPorData
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Text = ''
Transparent = False
end
end
object RLBand5: TRLBand
Left = 0
Top = 73
Width = 718
Height = 62
BandType = btSummary
object RLDraw3: TRLDraw
Left = 480
Top = 6
Width = 235
Height = 9
DrawKind = dkLine
Pen.Width = 2
Transparent = False
end
object RLDraw4: TRLDraw
Left = 0
Top = 87
Width = 718
Height = 9
DrawKind = dkLine
Pen.Width = 2
Transparent = False
end
object RLDBResult1: TRLDBResult
Left = 641
Top = 21
Width = 117
Height = 17
DataField = 'totalVenda'
DataSource = DtsVendaPorData
Info = riSum
Text = ''
end
object RLLabel6: TRLLabel
Left = 494
Top = 20
Width = 110
Height = 17
Alignment = taCenter
Caption = 'Total venda Dia:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -15
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Transparent = False
end
end
end
object RLBand6: TRLBand
Left = 38
Top = 249
Width = 718
Height = 27
BandType = btSummary
object RLLabel9: TRLLabel
Left = 457
Top = 6
Width = 152
Height = 18
Alignment = taCenter
Caption = 'Total venda per'#237'odo:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -15
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentFont = False
Transparent = False
end
object RLDBResult2: TRLDBResult
Left = 615
Top = 4
Width = 117
Height = 17
DataField = 'totalVenda'
DataSource = DtsVendaPorData
Info = riSum
Text = ''
end
end
end
object QryVendaPorData: TFDQuery
Active = True
Connection = dtmConexao.conexaoDB
SQL.Strings = (
'select v.vendaID,'
' v.clienteID ,'
' c.nome ,'
' v.datavenda,'
' v.totalVenda'
'from vendas as v'
'inner join clientes c on c.clienteID = v.clienteID'
'where v.datavenda between :DataInicio and :DataFim'
'order by v.datavenda , v.clienteID')
Left = 456
Top = 8
ParamData = <
item
Name = 'DATAINICIO'
DataType = ftDate
ParamType = ptInput
Value = 44562d
end
item
Name = 'DATAFIM'
DataType = ftDate
ParamType = ptInput
Value = 44592d
end>
object QryVendaPorDatavendaID: TFDAutoIncField
FieldName = 'vendaID'
Origin = 'vendaID'
ProviderFlags = [pfInWhere, pfInKey]
end
object QryVendaPorDataclienteID: TIntegerField
FieldName = 'clienteID'
Origin = 'clienteID'
Required = True
end
object QryVendaPorDatanome: TStringField
AutoGenerateValue = arDefault
FieldName = 'nome'
Origin = 'nome'
ProviderFlags = []
ReadOnly = True
Size = 60
end
object QryVendaPorDatadatavenda: TDateTimeField
AutoGenerateValue = arDefault
FieldName = 'datavenda'
Origin = 'datavenda'
end
object QryVendaPorDatatotalVenda: TFMTBCDField
AutoGenerateValue = arDefault
FieldName = 'totalVenda'
Origin = 'totalVenda'
currency = True
Precision = 18
Size = 5
end
end
object DtsVendaPorData: TDataSource
DataSet = QryVendaPorData
Left = 504
Top = 8
end
object RLPDFFilter1: TRLPDFFilter
DocumentInfo.Creator =
'FortesReport Community Edition v4.0.0.1 \251 Copyright '#169' 1999-20' +
'21 Fortes Inform'#225'tica'
DisplayName = 'Documento PDF'
Left = 400
Top = 8
end
end
| 24.788462 | 79 | 0.515645 |
83c5f65ad251b09e354dba16a8c5621e2aa25018 | 6,509 | pas | Pascal | Scripts - PCB/IsPadCenterConnected/IsPadCenterConnected.pas | coffeenmusic/scripts-libraries | ce287ab0f21000befd4d48e5ca0b2f60f785dfc1 | [
"MIT"
]
| 345 | 2015-07-21T16:39:45.000Z | 2022-03-29T23:09:32.000Z | Scripts - PCB/IsPadCenterConnected/IsPadCenterConnected.pas | coffeenmusic/scripts-libraries | ce287ab0f21000befd4d48e5ca0b2f60f785dfc1 | [
"MIT"
]
| 54 | 2015-09-14T14:05:01.000Z | 2022-01-24T07:58:17.000Z | Scripts - PCB/IsPadCenterConnected/IsPadCenterConnected.pas | coffeenmusic/scripts-libraries | ce287ab0f21000befd4d48e5ca0b2f60f785dfc1 | [
"MIT"
]
| 205 | 2015-08-30T16:02:21.000Z | 2022-03-30T22:28:30.000Z | {..............................................................................}
{ Summary This script checks weather Pad has track in it's center. }
{ If not, pad is being selected. }
{ }
{ }
{ Created by: Petar Perisin }
{..............................................................................}
{..............................................................................}
Procedure IsPadCenterConnected;
Var
Board : IPCB_Board;
Track : IPCB_Track;
Pad : IPCB_Pad2;
TrackIteratorHandle : IPCB_SpatialIterator;
Component : IPCB_Component;
ComponentIteratorHandle : IPCB_BoardIterator;
PadIteratorHandle : IPCB_GroupIterator;
TheLayerStack : IPCB_LayerStack;
LayerObj : IPCB_LayerObject;
Rectangle : TCoordRect;
TrackFoundFlag : Integer;
LayerFlag : Integer;
Left : Integer;
Right : Integer;
Top : Integer;
Bottom : Integer;
k, c : Float;
i : Integer;
PointX, PointY : Integer;
aboveLine : Integer;
onLine : Integer;
belowLine : Integer;
Parameters : String;
Begin
Board := PCBServer.GetCurrentPCBBoard;
If Board = Nil Then Exit;
ResetParameters;
AddStringParameter('Scope', 'All');
RunProcess('PCB:DeSelect');
ComponentIteratorHandle := Board.BoardIterator_Create;
ComponentIteratorHandle.AddFilter_ObjectSet(MkSet(eComponentObject));
ComponentIteratorHandle.AddFilter_LayerSet(AllLayers);
ComponentIteratorHandle.AddFilter_Method(eProcessAll);
Component := ComponentIteratorHandle.FirstPCBObject;
While (Component <> Nil) Do
Begin
PadIteratorHandle := Component.GroupIterator_Create;
PadIteratorHandle.AddFilter_ObjectSet(MkSet(ePadObject));
Pad := PadIteratorHandle.FirstPCBObject;
While (Pad <> Nil) Do
Begin
if Pad.Innet then
begin
if Layer2String(Pad.Layer) = 'Multi Layer' then
begin
Pad.Selected := False;
TheLayerStack := Board.LayerStack;
LayerObj := TheLayerStack.FirstLayer;
While LayerObj <> nil do
begin
if ILayer.IsSignalLayer(LayerObj.V7_LayerID) then
begin
Rectangle := Pad.BoundingRectangleOnLayer(LayerObj.LayerID);
TrackIteratorHandle := Board.SpatialIterator_Create;
TrackIteratorHandle.AddFilter_ObjectSet(MkSet(eTrackObject));
TrackIteratorHandle.AddFilter_Area(Rectangle.Left, Rectangle.Bottom, Rectangle.Right, Rectangle.Top);
TrackIteratorHandle.AddFilter_LayerSet(MkSet(LayerObj.LayerID));
Track := TrackIteratorHandle.FirstPCBObject;
TrackFoundFlag := 0;
LayerFlag := 0;
While (Track <> Nil) Do
Begin
if Track.InNet and Pad.InNet then
If Track.Net.Name = Pad.Net.Name then
begin
if Board.PrimPrimDistance(Track, Pad) = 0 then
TrackFoundFlag := 1;
if (((Track.x1 = Pad.x) and (Track.y1 = Pad.y)) or ((Track.x2 = Pad.x) and (Track.y2 = Pad.y))) then
LayerFlag := 1;
end;
Track := TrackIteratorHandle.NextPCBObject;
End;
if (TrackFoundFlag = 1) and (LayerFlag = 0) then
Pad.Selected := True;
end;
LayerObj := TheLayerStack.NextLayer(LayerObj);
end;
end
else
begin
Pad.Selected := True;
Rectangle := Pad.BoundingRectangleOnLayer(Pad.Layer_V6);
TrackIteratorHandle := Board.SpatialIterator_Create;
TrackIteratorHandle.AddFilter_ObjectSet(MkSet(eTrackObject));
TrackIteratorHandle.AddFilter_Area(Rectangle.Left, Rectangle.Bottom, Rectangle.Right, Rectangle.Top);
if Layer2String(Pad.Layer) = 'Top Layer' then
TrackIteratorHandle.AddFilter_LayerSet(MkSet(eTopLayer))
else if Layer2String(Pad.Layer) = 'Bottom Layer' then
TrackIteratorHandle.AddFilter_LayerSet(MkSet(eBottomLayer));
Track := TrackIteratorHandle.FirstPCBObject;
while (Track <> Nil) Do
begin
if (((Track.x1 = Pad.x) and (Track.y1 = Pad.y)) or ((Track.x2 = Pad.x) and (Track.y2 = Pad.y))) then
Pad.Selected := False;
Track := TrackIteratorHandle.NextPCBObject;
end;
Board.SpatialIterator_Destroy(TrackIteratorHandle);
end;
end;
Pad := PadIteratorHandle.NextPCBObject;
End;
// fetch source designator of component
Component.GroupIterator_Destroy(PadIteratorHandle);
Component := ComponentIteratorHandle.NextPCBObject;
End;
Board.BoardIterator_Destroy(ComponentIteratorHandle);
Parameters := 'Apply=True|Expr=IsSelected|Index=1|Zoom=True|Select=True|Mask=True';
Client.PostMessage('PCB:RunQuery', Parameters, Length(Parameters), Client.CurrentView);
End;
{..............................................................................}
{..............................................................................}
| 41.724359 | 134 | 0.46428 |
4713f70b8aec75839709a24560972160837f9bed | 1,020 | pas | Pascal | crossinstallers/m_any_to_linuxaarch64.pas | Moehre2/fpcupdeluxe | a427ed6e3b503b8ba295f8a818ca909c5a5bb34f | [
"zlib-acknowledgement"
]
| 198 | 2018-12-12T04:32:15.000Z | 2022-03-10T03:37:09.000Z | crossinstallers/m_any_to_linuxaarch64.pas | djwisdom/fpcupdeluxe | 07a9ab12480f4c619e968d7f899ca2e13dade32b | [
"zlib-acknowledgement"
]
| 425 | 2018-11-13T12:53:45.000Z | 2022-03-29T14:39:59.000Z | crossinstallers/m_any_to_linuxaarch64.pas | djwisdom/fpcupdeluxe | 07a9ab12480f4c619e968d7f899ca2e13dade32b | [
"zlib-acknowledgement"
]
| 55 | 2018-11-20T12:03:11.000Z | 2022-03-28T06:34:08.000Z | unit m_any_to_linuxaarch64;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
implementation
uses
m_crossinstaller, m_any_to_linux_base;
type
Tany_linuxaarch64 = class(Tany_linux)
public
function GetLibs(Basepath:string):boolean;override;
function GetBinUtils(Basepath:string):boolean;override;
constructor Create;
destructor Destroy; override;
end;
{ Tany_linuxaarch64 }
function Tany_linuxaarch64.GetLibs(Basepath:string): boolean;
begin
result:=inherited;
end;
function Tany_linuxaarch64.GetBinUtils(Basepath:string): boolean;
begin
result:=inherited;
end;
constructor Tany_linuxaarch64.Create;
begin
inherited Create;
FTargetCPU:=TCPU.aarch64;
Reset;
ShowInfo;
end;
destructor Tany_linuxaarch64.Destroy;
begin
inherited Destroy;
end;
var
any_linuxaarch64:Tany_linuxaarch64;
initialization
any_linuxaarch64:=Tany_linuxaarch64.Create;
RegisterCrossCompiler(any_linuxaarch64.RegisterName,any_linuxaarch64);
finalization
any_linuxaarch64.Destroy;
end.
| 16.721311 | 72 | 0.794118 |
47dbbab3c30649d3dabd7ab1e22cbd1782072ea2 | 4,612 | dfm | Pascal | libs/bass24-win/delphi/netradio/Unit1.dfm | helgrima/shader-system | 3574862c8df97f91d8d5fc7e12848e85f92f1c1b | [
"Unlicense"
]
| 1 | 2020-03-18T23:13:35.000Z | 2020-03-18T23:13:35.000Z | libs/bass24-win/delphi/netradio/Unit1.dfm | tahtituho/shader-system | 1029f673892aacd8612b1d458773a37db067d2ac | [
"Unlicense"
]
| 29 | 2018-12-14T20:20:35.000Z | 2021-04-11T19:48:41.000Z | libs/bass24-win/delphi/netradio/Unit1.dfm | tahtituho/shader-system | 1029f673892aacd8612b1d458773a37db067d2ac | [
"Unlicense"
]
| null | null | null | object Form1: TForm1
Left = 192
Top = 109
BorderStyle = bsToolWindow
Caption = 'BASS internet radio tuner'
ClientHeight = 262
ClientWidth = 277
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
OnDestroy = FormDestroy
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 0
Top = 0
Width = 277
Height = 262
Align = alClient
TabOrder = 0
object GroupBox1: TGroupBox
Left = 8
Top = 0
Width = 265
Height = 73
Caption = 'Presets'
TabOrder = 0
object Label1: TLabel
Left = 8
Top = 24
Width = 52
Height = 13
Caption = 'Broadband'
end
object Label2: TLabel
Left = 8
Top = 48
Width = 35
Height = 13
Caption = 'Modem'
end
object Button1: TButton
Left = 64
Top = 14
Width = 33
Height = 25
Caption = '1'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Tag = 2
Left = 104
Top = 14
Width = 33
Height = 25
Caption = '2'
TabOrder = 1
OnClick = Button1Click
end
object Button3: TButton
Tag = 4
Left = 144
Top = 14
Width = 33
Height = 25
Caption = '3'
TabOrder = 2
OnClick = Button1Click
end
object Button4: TButton
Tag = 6
Left = 184
Top = 14
Width = 33
Height = 25
Caption = '4'
TabOrder = 3
OnClick = Button1Click
end
object Button5: TButton
Tag = 8
Left = 224
Top = 14
Width = 33
Height = 25
Caption = '5'
TabOrder = 4
OnClick = Button1Click
end
object Button6: TButton
Tag = 1
Left = 64
Top = 41
Width = 33
Height = 25
Caption = '1'
TabOrder = 5
OnClick = Button1Click
end
object Button7: TButton
Tag = 3
Left = 104
Top = 41
Width = 33
Height = 25
Caption = '2'
TabOrder = 6
OnClick = Button1Click
end
object Button8: TButton
Tag = 5
Left = 144
Top = 41
Width = 33
Height = 25
Caption = '3'
TabOrder = 7
OnClick = Button1Click
end
object Button9: TButton
Tag = 7
Left = 184
Top = 41
Width = 33
Height = 25
Caption = '4'
TabOrder = 8
OnClick = Button1Click
end
object Button10: TButton
Tag = 9
Left = 224
Top = 41
Width = 33
Height = 25
Caption = '5'
TabOrder = 9
OnClick = Button1Click
end
end
object GroupBox2: TGroupBox
Left = 8
Top = 76
Width = 265
Height = 101
Caption = 'Currently playing'
TabOrder = 1
object Label3: TLabel
Left = 11
Top = 16
Width = 245
Height = 25
Alignment = taCenter
AutoSize = False
ShowAccelChar = False
WordWrap = True
end
object Label4: TLabel
Left = 8
Top = 40
Width = 241
Height = 41
Alignment = taCenter
AutoSize = False
Caption = 'not playing'
ShowAccelChar = False
WordWrap = True
end
object Label5: TLabel
Left = 8
Top = 80
Width = 249
Height = 13
Alignment = taCenter
AutoSize = False
ShowAccelChar = False
WordWrap = True
end
end
object GroupBox3: TGroupBox
Left = 8
Top = 176
Width = 265
Height = 81
Caption = 'Proxy server'
TabOrder = 2
object Label6: TLabel
Left = 10
Top = 40
Width = 112
Height = 13
Caption = '(user:pass@]server:port'
end
object ed_ProxyServer: TEdit
Left = 8
Top = 16
Width = 249
Height = 21
MaxLength = 100
ParentShowHint = False
ShowHint = True
TabOrder = 0
end
object cbDirectConnection: TCheckBox
Left = 8
Top = 60
Width = 113
Height = 17
Caption = 'Direct connection'
TabOrder = 1
end
end
end
end
| 20.774775 | 43 | 0.489809 |
fc414e9f1814a13b4038def371233024415d1d01 | 117,726 | pas | Pascal | Units/DX12.D3DX10.pas | viniciusfbb/DelphiDX12 | d1561bc6cb9bba7519e298bd4fa730fc22f6e19b | [
"Apache-2.0"
]
| 1 | 2021-02-10T22:15:03.000Z | 2021-02-10T22:15:03.000Z | Units/DX12.D3DX10.pas | viniciusfbb/DelphiDX12 | d1561bc6cb9bba7519e298bd4fa730fc22f6e19b | [
"Apache-2.0"
]
| null | null | null | Units/DX12.D3DX10.pas | viniciusfbb/DelphiDX12 | d1561bc6cb9bba7519e298bd4fa730fc22f6e19b | [
"Apache-2.0"
]
| 1 | 2020-04-16T09:11:40.000Z | 2020-04-16T09:11:40.000Z | unit DX12.D3DX10;
{$IFDEF FPC}
{$MODE delphi}{$H+}
{$ENDIF}
interface
{$IFDEF MSWINDOWS}
{$Z4}
uses
Windows, Classes, SysUtils,
DX12.D3D10, DX12.D3DCommon, DX12.D3D10_1,
DX12.DXGI;
const
IID_ID3DXMatrixStack: TGUID = '{C7885BA7-F990-4fe7-922D-8515E477DD85}';
IID_ID3DX10BaseMesh: TGUID = '{7ED943DD-52E8-40b5-A8D8-76685C406330}';
IID_ID3DX10PMesh: TGUID = '{8875769A-D579-4088-AAEB-534D1AD84E96}';
IID_ID3DX10SPMesh: TGUID = '{667EA4C7-F1CD-4386-B523-7C0290B83CC5}';
IID_ID3DX10PatchMesh: TGUID = '{3CE6CC22-DBF2-44f4-894D-F9C34A337139}';
IID_ID3DX10MeshBuffer: TGUID = '{04B0D117-1041-46b1-AA8A-3952848BA22E}';
IID_ID3DX10Mesh: TGUID = '{4020E5C2-1403-4929-883F-E2E849FAC195}';
IID_ID3DX10SkinInfo: TGUID = '{420BD604-1C76-4a34-A466-E45D0658A32C}';
{$IFDEF DEBUG}
DLL_D3DX10 = 'd3dx10d_43.dll';
{$ELSE}
DLL_D3DX10 = 'd3dx10_43.dll';
{$ENDIF}
DLL_D3DX10_DIAG = 'd3dx10d_43.dll';
D3DX10_SDK_VERSION = 43;
D3DX10_DEFAULT = UINT(-1);
D3DX10_FROM_FILE = UINT(-3);
DXGI_FORMAT_FROM_FILE = TDXGI_FORMAT(-3);
_FACDD = $876;
MAKE_DDHRESULT = longword(1 shl 31) or longword(_FACDD shl 16);
D3DX10_ERR_CANNOT_MODIFY_INDEX_BUFFER = MAKE_DDHRESULT or 2900;
D3DX10_ERR_INVALID_MESH = MAKE_DDHRESULT or 2901;
D3DX10_ERR_CANNOT_ATTR_SORT = MAKE_DDHRESULT or 2902;
D3DX10_ERR_SKINNING_NOT_SUPPORTED = MAKE_DDHRESULT or 2903;
D3DX10_ERR_TOO_MANY_INFLUENCES = MAKE_DDHRESULT or 2904;
D3DX10_ERR_INVALID_DATA = MAKE_DDHRESULT or 2905;
D3DX10_ERR_LOADED_MESH_HAS_NO_DATA = MAKE_DDHRESULT or 2906;
D3DX10_ERR_DUPLICATE_NAMED_FRAGMENT = MAKE_DDHRESULT or 2907;
D3DX10_ERR_CANNOT_REMOVE_LAST_ITEM = MAKE_DDHRESULT or 2908;
_FACD3D = $876;
MAKE_D3DHRESULT = longword(1 shl 31) or longword(_FACD3D shl 16);
MAKE_D3DSTATUS = longword(0 shl 31) or longword(_FACD3D shl 16);
D3DERR_INVALIDCALL = MAKE_D3DHRESULT or 2156;
D3DERR_WASSTILLDRAWING = MAKE_D3DHRESULT or 540;
// D3DX10 and D3DX9 math look the same. You can include either one into your project.
// We are intentionally using the header define from D3DX9 math to prevent double-inclusion.
// ===========================================================================
// Type definitions from D3D9
// ===========================================================================
const
D3DX_PI = (3.14159265358979323846);
D3DX_1BYPI = (1.0 / D3DX_PI);
D3DX_16F_DIG = 3; // # of decimal digits of precision
D3DX_16F_EPSILON = 4.8875809E-4; // smallest such that 1.0 + epsilon != 1.0
D3DX_16F_MANT_DIG = 11; // # of bits in mantissa
D3DX_16F_MAX = 6.550400E+004; // max value
D3DX_16F_MAX_10_EXP = 4; // max decimal exponent
D3DX_16F_MAX_EXP = 15; // max binary exponent
D3DX_16F_MIN = 6.1035156E-5; // min positive value
D3DX_16F_MIN_10_EXP = (-4); // min decimal exponent
D3DX_16F_MIN_EXP = (-14); // min binary exponent
D3DX_16F_RADIX = 2; // exponent radix
D3DX_16F_ROUNDS = 1; // addition rounding: near
D3DX_16F_SIGN_MASK = $8000;
D3DX_16F_EXP_MASK = $7C00;
D3DX_16F_FRAC_MASK = $03FF;
const
// scaling modes for ID3DX10SkinInfo::Compact() & ID3DX10SkinInfo::UpdateMesh()
D3DX10_SKININFO_NO_SCALING = 0;
D3DX10_SKININFO_SCALE_TO_1 = 1;
D3DX10_SKININFO_SCALE_TO_TOTAL = 2;
type
{$IFNDEF FPC}
PHRESULT = ^HRESULT;
{$ENDIF}
TD3DVECTOR = record
x: single;
y: single;
z: single;
end;
TD3DMATRIX = record
case integer of
0: (_11, _12, _13, _14: single;
_21, _22, _23, _24: single;
_31, _32, _33, _34: single;
_41, _42, _43, _44: single;);
1: (m: array [0 .. 3, 0 .. 3] of single;);
end;
{ TD3DXFLOAT16 }
TD3DXFLOAT16 = record
Value: word;
class operator Equal(a, b: TD3DXFLOAT16): longbool;
class operator NotEqual(a, b: TD3DXFLOAT16): longbool;
class operator Implicit(a: single): TD3DXFLOAT16; // Implicit conversion of an FLOAT to type TD3DXFLOAT16
class operator Explicit(a: TD3DXFLOAT16): single;
constructor Create(f: single); overload;
constructor Create(f: TD3DXFLOAT16); overload;
end;
PD3DXFLOAT16 = ^TD3DXFLOAT16;
TD3DXFLOAT16ARRAY4 = array [0..3] of TD3DXFLOAT16;
TD3DXFLOAT16ARRAY3 = array [0..2] of TD3DXFLOAT16;
TD3DXFLOAT16ARRAY2 = array [0..1] of TD3DXFLOAT16;
PD3DXFLOAT16ARRAY4 = ^TD3DXFLOAT16ARRAY4;
PD3DXFLOAT16ARRAY3 = ^TD3DXFLOAT16ARRAY3;
PD3DXFLOAT16ARRAY2 = ^TD3DXFLOAT16ARRAY2;
{ TD3DXVECTOR2 }
TD3DXVECTOR2 = record
x, y: single;
constructor Create(ix, iy: single); overload;
constructor Create(pf: PFloatArray2); overload;
constructor Create(f: PD3DXFLOAT16); overload;
// assignment operators
class operator Add(a, b: TD3DXVECTOR2): TD3DXVECTOR2;
class operator Subtract(a, b: TD3DXVECTOR2): TD3DXVECTOR2;
class operator Multiply(a: TD3DXVECTOR2; b: single): TD3DXVECTOR2;
class operator Divide(a: TD3DXVECTOR2; b: single): TD3DXVECTOR2;
// unary operators
class operator Positive(a: TD3DXVECTOR2): TD3DXVECTOR2;
class operator Negative(a: TD3DXVECTOR2): TD3DXVECTOR2;
// binary operators
class operator Equal(a, b: TD3DXVECTOR2): longbool;
class operator NotEqual(a, b: TD3DXVECTOR2): longbool;
procedure Init(lx, ly: single);
end;
PD3DXVECTOR2 = ^TD3DXVECTOR2;
{ TD3DXVECTOR2_16F }
TD3DXVECTOR2_16F = record
x, y: TD3DXFLOAT16;
constructor CreateBySingle(pf: PFloatArray2); overload;
constructor CreateByFloat16(pf: PD3DXFLOAT16ARRAY2); overload;
constructor Create(ix, iy: TD3DXFLOAT16); overload;
// binary operators
class operator Equal(a, b: TD3DXVECTOR2_16F): longbool;
class operator NotEqual(a, b: TD3DXVECTOR2_16F): longbool;
end;
PD3DXVECTOR2_16F = ^TD3DXVECTOR2_16F;
{ TD3DXVECTOR3 }
TD3DXVECTOR3 = record
x: single;
y: single;
z: single;
constructor Create(fx, fy, fz: single); overload;
constructor CreateBySingle(f: PFloatArray3); overload;
constructor Create(v: TD3DXVECTOR3); overload;
constructor CreateByFloat16(pf: PD3DXFLOAT16);
// assignment operators
class operator Add(a, b: TD3DXVECTOR3): TD3DXVECTOR3;
class operator Subtract(a, b: TD3DXVECTOR3): TD3DXVECTOR3;
class operator Multiply(a: TD3DXVECTOR3; b: single): TD3DXVECTOR3;
class operator Divide(a: TD3DXVECTOR3; b: single): TD3DXVECTOR3;
// unary operators
class operator Positive(a: TD3DXVECTOR3): TD3DXVECTOR3;
class operator Negative(a: TD3DXVECTOR3): TD3DXVECTOR3;
// binary operators
class operator Equal(a, b: TD3DXVECTOR3): longbool;
class operator NotEqual(a, b: TD3DXVECTOR3): longbool;
procedure Init(lx, ly, lz: single);
end;
PD3DXVECTOR3 = ^TD3DXVECTOR3;
{ TD3DXVECTOR3_16F }
TD3DXVECTOR3_16F = record
x, y, z: TD3DXFLOAT16;
constructor CreateBySingle(pf: PFloatArray3); overload;
constructor Create(v: TD3DXVECTOR3); overload;
constructor CreateByFloat16(pf: PD3DXFLOAT16);
constructor Create(fx, fy, fz: TD3DXFLOAT16); overload;
// binary operators
class operator Equal(a, b: TD3DXVECTOR3_16F): longbool;
class operator NotEqual(a, b: TD3DXVECTOR3_16F): longbool;
end;
PD3DXVECTOR3_16F = ^TD3DXVECTOR3_16F;
{ TD3DXVECTOR4 }
TD3DXVECTOR4 = record
x, y, z, w: single;
constructor CreateBySingle(pf: PFloatArray4); overload;
constructor CreateByFloat16(pf: PD3DXFLOAT16);
constructor Create(v: TD3DXVECTOR3; fw: single); overload;
constructor Create(fx, fy, fz, fw: single); overload;
// assignment operators
class operator Add(a, b: TD3DXVECTOR4): TD3DXVECTOR4;
class operator Subtract(a, b: TD3DXVECTOR4): TD3DXVECTOR4;
class operator Multiply(a: TD3DXVECTOR4; b: single): TD3DXVECTOR4;
class operator Divide(a: TD3DXVECTOR4; b: single): TD3DXVECTOR4;
// unary operators
class operator Positive(a: TD3DXVECTOR4): TD3DXVECTOR4;
class operator Negative(a: TD3DXVECTOR4): TD3DXVECTOR4;
// binary operators
class operator Equal(a, b: TD3DXVECTOR4): longbool;
class operator NotEqual(a, b: TD3DXVECTOR4): longbool;
end;
PD3DXVECTOR4 = ^TD3DXVECTOR4;
{ TD3DXVECTOR4_16F }
TD3DXVECTOR4_16F = record
x, y, z, w: TD3DXFLOAT16;
constructor CreateBySingle(pf: PSingle); overload;
constructor CreateByFloat16(pf: PD3DXFLOAT16);
constructor Create(v: TD3DXVECTOR3_16F; fw: TD3DXFLOAT16); overload;
constructor Create(fx, fy, fz, fw: TD3DXFLOAT16); overload;
// binary operators
class operator Equal(a, b: TD3DXVECTOR4_16F): longbool;
class operator NotEqual(a, b: TD3DXVECTOR4_16F): longbool;
end;
PD3DXVECTOR4_16F = ^TD3DXVECTOR4_16F;
// ===========================================================================
// Matrices
// ===========================================================================
{ TD3DXMATRIX }
TD3DXMATRIX = record
constructor CreateBySingle(pf: PSingle);
constructor Create(m: TD3DMATRIX); overload;
constructor CreateByFloat16(pf: PD3DXFLOAT16);
constructor Create(f11, f12, f13, f14, f21, f22, f23, f24, f31, f32, f33, f34, f41, f42, f43, f44: single); overload;
// assignment operators
class operator Add(a, b: TD3DXMATRIX): TD3DXMATRIX;
class operator Subtract(a, b: TD3DXMATRIX): TD3DXMATRIX;
class operator Multiply(a: TD3DXMATRIX; b: TD3DXMATRIX): TD3DXMATRIX;
overload;
class operator Multiply(a: TD3DXMATRIX; b: single): TD3DXMATRIX;
overload;
class operator Divide(a: TD3DXMATRIX; b: single): TD3DXMATRIX;
// unary operators
class operator Positive(a: TD3DXMATRIX): TD3DXMATRIX;
class operator Negative(a: TD3DXMATRIX): TD3DXMATRIX;
// binary operators
class operator Equal(a, b: TD3DXMATRIX): longbool;
class operator NotEqual(a, b: TD3DXMATRIX): longbool;
procedure Identity;
case integer of
0: (_11, _12, _13, _14: single;
_21, _22, _23, _24: single;
_31, _32, _33, _34: single;
_41, _42, _43, _44: single;);
1: (m: array [0 .. 3, 0 .. 3] of single;);
end;
PD3DXMATRIX = ^TD3DXMATRIX;
// ===========================================================================
// Quaternions
// ===========================================================================
TD3DXQUATERNION = record
x, y, z, w: single;
constructor CreateBySingle(pf: PFloatArray4);
constructor CreateByFloat16(pf: PD3DXFLOAT16);
constructor Create(fx, fy, fz, fw: single);
// assignment operators
class operator Add(a, b: TD3DXQUATERNION): TD3DXQUATERNION;
class operator Subtract(a, b: TD3DXQUATERNION): TD3DXQUATERNION;
class operator Multiply(a: TD3DXQUATERNION; b: TD3DXQUATERNION): TD3DXQUATERNION;
overload;
class operator Multiply(a: TD3DXQUATERNION; b: single): TD3DXQUATERNION;
overload;
class operator Divide(a: TD3DXQUATERNION; b: single): TD3DXQUATERNION;
// unary operators
class operator Positive(a: TD3DXQUATERNION): TD3DXQUATERNION;
class operator Negative(a: TD3DXQUATERNION): TD3DXQUATERNION;
// binary operators
class operator Equal(a, b: TD3DXQUATERNION): longbool;
class operator NotEqual(a, b: TD3DXQUATERNION): longbool;
end;
PD3DXQUATERNION = ^TD3DXQUATERNION;
{ TD3DXPLANE }
TD3DXPLANE = record
a, b, c, d: single;
constructor CreateBySingle(pf: PFloatArray4);
constructor CreateByFloat16(pf: PD3DXFLOAT16);
constructor Create(fa, fb, fc, fd: single);
// assignment operators
class operator Multiply(a: TD3DXPLANE; b: single): TD3DXPLANE;
class operator Divide(a: TD3DXPLANE; b: single): TD3DXPLANE;
// unary operators
class operator Positive(a: TD3DXPLANE): TD3DXPLANE;
class operator Negative(a: TD3DXPLANE): TD3DXPLANE;
// binary operators
class operator Equal(a, b: TD3DXPLANE): longbool;
class operator NotEqual(a, b: TD3DXPLANE): longbool;
end;
PD3DXPLANE = ^TD3DXPLANE;
{ TD3DXCOLOR }
TD3DXCOLOR = record
r, g, b, a: single;
constructor Create(argb: UINT); overload;
constructor CreateBySingle(pf: PFloatArray4);
constructor CreateByFloat16(pf: PD3DXFLOAT16);
constructor Create(fr, fg, fb, fa: single); overload;
// type casting
function AsUINT: UINT;
// assignment operators
class operator Add(a, b: TD3DXCOLOR): TD3DXCOLOR;
class operator Subtract(a, b: TD3DXCOLOR): TD3DXCOLOR;
class operator Multiply(a: TD3DXCOLOR; b: single): TD3DXCOLOR;
class operator Multiply(b: single; a: TD3DXCOLOR): TD3DXCOLOR;
class operator Divide(a: TD3DXCOLOR; b: single): TD3DXCOLOR;
// unary operators
class operator Positive(a: TD3DXCOLOR): TD3DXCOLOR;
class operator Negative(a: TD3DXCOLOR): TD3DXCOLOR;
// binary operators
class operator Equal(a, b: TD3DXCOLOR): longbool;
class operator NotEqual(a, b: TD3DXCOLOR): longbool;
end;
PD3DXCOLOR = ^TD3DXCOLOR;
// ===========================================================================
// D3DX math functions:
// NOTE:
// * All these functions can take the same object as in and out parameters.
// * Out parameters are typically also returned as return values, so that
// the output of one function may be used as a parameter to another.
// ===========================================================================
// --------------------------
// Float16
// --------------------------
// Converts an array 32-bit floats to 16-bit floats
function D3DXFloat32To16Array(pOut: PD3DXFLOAT16; pIn: PSingle; n: UINT): PD3DXFLOAT16; stdcall; external DLL_D3DX10;
// Converts an array 16-bit floats to 32-bit floats
function D3DXFloat16To32Array(pOut: PSingle; pIn: PD3DXFLOAT16; n: UINT): PSingle; stdcall; external DLL_D3DX10;
// --------------------------
// 2D Vector
// --------------------------
// inline
function D3DXVec2Length(const pV: PD3DXVECTOR2): single;
function D3DXVec2LengthSq(const pV: PD3DXVECTOR2): single;
function D3DXVec2Dot(const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2): single;
// Z component of ((x1,y1,0) cross (x2,y2,0))
function D3DXVec2CCW(const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2): single;
function D3DXVec2Add(pOut: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2): PD3DXVECTOR2;
function D3DXVec2Subtract(pOut: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2): PD3DXVECTOR2;
// Minimize each component. x = min(x1, x2), y = min(y1, y2)
function D3DXVec2Minimize(pOut: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2): PD3DXVECTOR2;
// Maximize each component. x = max(x1, x2), y = max(y1, y2)
function D3DXVec2Maximize(pOut: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2): PD3DXVECTOR2;
function D3DXVec2Scale(pOut: PD3DXVECTOR2; const pV: PD3DXVECTOR2; s: single): PD3DXVECTOR2;
// Linear interpolation. V1 + s(V2-V1)
function D3DXVec2Lerp(pOut: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2; s: single): PD3DXVECTOR2;
// non-inline
function D3DXVec2Normalize(pOut: PD3DXVECTOR2; const pV: PD3DXVECTOR2): PD3DXVECTOR2; stdcall; external DLL_D3DX10;
// Hermite interpolation between position V1, tangent T1 (when s == 0)
// and position V2, tangent T2 (when s == 1).
function D3DXVec2Hermite(pOut: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pT1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2;
const pT2: PD3DXVECTOR2; s: single): PD3DXVECTOR2; stdcall; external DLL_D3DX10;
// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1)
function D3DXVec2CatmullRom(pOut: PD3DXVECTOR2; const pV0: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2;
const pV3: PD3DXVECTOR2; s: single): PD3DXVECTOR2; stdcall; external DLL_D3DX10;
// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1)
function D3DXVec2BaryCentric(pOut: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2; const pV3: PD3DXVECTOR2;
f, g: single): PD3DXVECTOR2;
stdcall; external DLL_D3DX10;
// Transform (x, y, 0, 1) by matrix.
function D3DXVec2Transform(pOut: PD3DXVECTOR4; const pV: PD3DXVECTOR2; const pM: PD3DXMATRIX): PD3DXVECTOR4; stdcall; external DLL_D3DX10;
// Transform (x, y, 0, 1) by matrix, project result back into w=1.
function D3DXVec2TransformCoord(pOut: PD3DXVECTOR2; const pV: PD3DXVECTOR2; const pM: PD3DXMATRIX): PD3DXVECTOR2; stdcall; external DLL_D3DX10;
// Transform (x, y, 0, 0) by matrix.
function D3DXVec2TransformNormal(pOut: PD3DXVECTOR2; const pV: PD3DXVECTOR2; const pM: PD3DXMATRIX): PD3DXVECTOR2; stdcall; external DLL_D3DX10;
// Transform Array (x, y, 0, 1) by matrix.
function D3DXVec2TransformArray(pOut: PD3DXVECTOR4; OutStride: UINT; const pV: PD3DXVECTOR2; VStride: UINT;
const pM: PD3DXMATRIX; n: UINT): PD3DXVECTOR4;
stdcall; external DLL_D3DX10;
// Transform Array (x, y, 0, 1) by matrix, project result back into w=1.
function D3DXVec2TransformCoordArray(pOut: PD3DXVECTOR2; OutStride: UINT; const pV: PD3DXVECTOR2; VStride: UINT;
const pM: PD3DXMATRIX; n: UINT): PD3DXVECTOR2;
stdcall; external DLL_D3DX10;
// Transform Array (x, y, 0, 0) by matrix.
function D3DXVec2TransformNormalArray(pOut: PD3DXVECTOR2; OutStride: UINT; const pV: PD3DXVECTOR2; VStride: UINT;
const pM: PD3DXMATRIX; n: UINT): PD3DXVECTOR2; stdcall; external DLL_D3DX10;
// --------------------------
// 3D Vector
// --------------------------
// inline
function D3DXVec3Length(const pV: PD3DXVECTOR3): single;
function D3DXVec3LengthSq(const pV: PD3DXVECTOR3): single;
function D3DXVec3Dot(const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): single;
function D3DXVec3Cross(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): PD3DXVECTOR3;
function D3DXVec3Add(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): PD3DXVECTOR3;
function D3DXVec3Subtract(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): PD3DXVECTOR3;
// Minimize each component. x = min(x1, x2), y = min(y1, y2), ...
function D3DXVec3Minimize(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): PD3DXVECTOR3;
// Maximize each component. x = max(x1, x2), y = max(y1, y2), ...
function D3DXVec3Maximize(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): PD3DXVECTOR3;
function D3DXVec3Scale(pOut: PD3DXVECTOR3; const pV: PD3DXVECTOR3; s: single): PD3DXVECTOR3;
// Linear interpolation. V1 + s(V2-V1)
function D3DXVec3Lerp(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3; s: single): PD3DXVECTOR3;
// non-inline
function D3DXVec3Normalize(pOut: PD3DXVECTOR3; const pV: PD3DXVECTOR3): PD3DXVECTOR3; stdcall; external DLL_D3DX10;
// Hermite interpolation between position V1, tangent T1 (when s == 0)
// and position V2, tangent T2 (when s == 1).
function D3DXVec3Hermite(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pT1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3;
const pT2: PD3DXVECTOR3; s: single): PD3DXVECTOR3; stdcall; external DLL_D3DX10;
// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1)
function D3DXVec3CatmullRom(pOut: PD3DXVECTOR3; const pV0: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3;
const pV3: PD3DXVECTOR3; s: single): PD3DXVECTOR3; stdcall; external DLL_D3DX10;
// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1)
function D3DXVec3BaryCentric(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3; const pV3: PD3DXVECTOR3;
f: single; g: single): PD3DXVECTOR3; stdcall; external DLL_D3DX10;
// Transform (x, y, z, 1) by matrix.
function D3DXVec3Transform(pOut: PD3DXVECTOR4; const pV: PD3DXVECTOR3; const pM: PD3DXMATRIX): PD3DXVECTOR4; stdcall; external DLL_D3DX10;
// Transform (x, y, z, 1) by matrix, project result back into w=1.
function D3DXVec3TransformCoord(pOut: PD3DXVECTOR3; const pV: PD3DXVECTOR3; const pM: PD3DXMATRIX): PD3DXVECTOR3; stdcall; external DLL_D3DX10;
// Transform (x, y, z, 0) by matrix. If you transforming a normal by a
// non-affine matrix, the matrix you pass to this function should be the
// transpose of the inverse of the matrix you would use to transform a coord.
function D3DXVec3TransformNormal(pOut: PD3DXVECTOR3; const pV: PD3DXVECTOR3; const pM: PD3DXMATRIX): PD3DXVECTOR3; stdcall; external DLL_D3DX10;
// Transform Array (x, y, z, 1) by matrix.
function D3DXVec3TransformArray(pOut: PD3DXVECTOR4; OutStride: UINT; const pV: PD3DXVECTOR3; VStride: UINT;
const pM: PD3DXMATRIX; n: UINT): PD3DXVECTOR4;
stdcall; external DLL_D3DX10;
// Transform Array (x, y, z, 1) by matrix, project result back into w=1.
function D3DXVec3TransformCoordArray(pOut: PD3DXVECTOR3; OutStride: UINT; const pV: PD3DXVECTOR3; VStride: UINT;
const pM: PD3DXMATRIX; n: UINT): PD3DXVECTOR3;
stdcall; external DLL_D3DX10;
// Transform (x, y, z, 0) by matrix. If you transforming a normal by a
// non-affine matrix, the matrix you pass to this function should be the
// transpose of the inverse of the matrix you would use to transform a coord.
function D3DXVec3TransformNormalArray(pOut: PD3DXVECTOR3; OutStride: UINT; const pV: PD3DXVECTOR3; VStride: UINT;
const pM: PD3DXMATRIX; n: UINT): PD3DXVECTOR3; stdcall; external DLL_D3DX10;
// Project vector from object space into screen space
function D3DXVec3Project(pOut: PD3DXVECTOR3; const pV: PD3DXVECTOR3; const pViewport: PD3D10_VIEWPORT;
const pProjection: PD3DXMATRIX; const pView: PD3DXMATRIX; const pWorld: PD3DXMATRIX): PD3DXVECTOR3; stdcall; external DLL_D3DX10;
// Project vector from screen space into object space
function D3DXVec3Unproject(pOut: PD3DXVECTOR3; const pV: PD3DXVECTOR3; const pViewport: PD3D10_VIEWPORT;
const pProjection: PD3DXMATRIX; const pView: PD3DXMATRIX; const pWorld: PD3DXMATRIX): PD3DXVECTOR3; stdcall; external DLL_D3DX10;
// Project vector Array from object space into screen space
function D3DXVec3ProjectArray(pOut: PD3DXVECTOR3; OutStride: UINT; const pV: PD3DXVECTOR3; VStride: UINT;
const pViewport: PD3D10_VIEWPORT; const pProjection: PD3DXMATRIX; const pView: PD3DXMATRIX; const pWorld: PD3DXMATRIX;
n: UINT): PD3DXVECTOR3; stdcall; external DLL_D3DX10;
// Project vector Array from screen space into object space
function D3DXVec3UnprojectArray(pOut: PD3DXVECTOR3; OutStride: UINT; const pV: PD3DXVECTOR3; VStride: UINT;
const pViewport: PD3D10_VIEWPORT; const pProjection: PD3DXMATRIX; const pView: PD3DXMATRIX; const pWorld: PD3DXMATRIX;
n: UINT): PD3DXVECTOR3; stdcall; external DLL_D3DX10;
// --------------------------
// 4D Vector
// --------------------------
// inline
function D3DXVec4Length(const pV: PD3DXVECTOR4): single;
function D3DXVec4LengthSq(const pV: PD3DXVECTOR4): single;
function D3DXVec4Dot(const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4): single;
function D3DXVec4Add(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4): PD3DXVECTOR4;
function D3DXVec4Subtract(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4): PD3DXVECTOR4;
// Minimize each component. x = min(x1, x2), y = min(y1, y2), ...
function D3DXVec4Minimize(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4): PD3DXVECTOR4;
// Maximize each component. x = max(x1, x2), y = max(y1, y2), ...
function D3DXVec4Maximize(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4): PD3DXVECTOR4;
function D3DXVec4Scale(pOut: PD3DXVECTOR4; const pV: PD3DXVECTOR4; s: single): PD3DXVECTOR4;
// Linear interpolation. V1 + s(V2-V1)
function D3DXVec4Lerp(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4; s: single): PD3DXVECTOR4;
// non-inline
// Cross-product in 4 dimensions.
function D3DXVec4Cross(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4; const pV3: PD3DXVECTOR4): PD3DXVECTOR4; stdcall;
external DLL_D3DX10;
function D3DXVec4Normalize(pOut: PD3DXVECTOR4; const pV: PD3DXVECTOR4): PD3DXVECTOR4; stdcall; external DLL_D3DX10;
// Hermite interpolation between position V1, tangent T1 (when s == 0)
// and position V2, tangent T2 (when s == 1).
function D3DXVec4Hermite(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pT1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4;
const pT2: PD3DXVECTOR4; s: single): PD3DXVECTOR4; stdcall; external DLL_D3DX10;
// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1)
function D3DXVec4CatmullRom(pOut: PD3DXVECTOR4; const pV0: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4;
const pV3: PD3DXVECTOR4; s: single): PD3DXVECTOR4; stdcall; external DLL_D3DX10;
// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1)
function D3DXVec4BaryCentric(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4; const pV3: PD3DXVECTOR4;
f: single; g: single): PD3DXVECTOR4; stdcall; external DLL_D3DX10;
// Transform vector by matrix.
function D3DXVec4Transform(pOut: PD3DXVECTOR4; const pV: PD3DXVECTOR4; const pM: PD3DXMATRIX): PD3DXVECTOR4; stdcall; external DLL_D3DX10;
// Transform vector array by matrix.
function D3DXVec4TransformArray(pOut: PD3DXVECTOR4; OutStride: UINT; const pV: PD3DXVECTOR4; VStride: UINT;
const pM: PD3DXMATRIX; n: UINT): PD3DXVECTOR4;
stdcall; external DLL_D3DX10;
// --------------------------
// Plane
// --------------------------
// inline
// ax + by + cz + dw
function D3DXPlaneDot(const pP: PD3DXPLANE; const pV: PD3DXVECTOR4): single;
// ax + by + cz + d
function D3DXPlaneDotCoord(const pP: PD3DXPLANE; const pV: PD3DXVECTOR3): single;
// ax + by + cz
function D3DXPlaneDotNormal(const pP: PD3DXPLANE; const pV: PD3DXVECTOR3): single;
function D3DXPlaneScale(pOut: PD3DXPLANE; const pP: PD3DXPLANE; s: single): PD3DXPLANE;
// non-inline
// Normalize plane (so that |a,b,c| == 1)
function D3DXPlaneNormalize(pOut: PD3DXPLANE; const pP: PD3DXPLANE): PD3DXPLANE; stdcall; external DLL_D3DX10;
// Find the intersection between a plane and a line. If the line is
// parallel to the plane, NULL is returned.
function D3DXPlaneIntersectLine(pOut: PD3DXVECTOR3; const pP: PD3DXPLANE; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): PD3DXVECTOR3; stdcall;
external DLL_D3DX10;
// Construct a plane from a point and a normal
function D3DXPlaneFromPointNormal(pOut: PD3DXPLANE; const pPoint: PD3DXVECTOR3; const pNormal: PD3DXVECTOR3): PD3DXPLANE;
stdcall; external DLL_D3DX10;
// Construct a plane from 3 points
function D3DXPlaneFromPoints(pOut: PD3DXPLANE; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3; const pV3: PD3DXVECTOR3): PD3DXPLANE; stdcall;
external DLL_D3DX10;
// Transform a plane by a matrix. The vector (a,b,c) must be normal.
// M should be the inverse transpose of the transformation desired.
function D3DXPlaneTransform(pOut: PD3DXPLANE; const pP: PD3DXPLANE; const pM: PD3DXMATRIX): PD3DXPLANE; stdcall; external DLL_D3DX10;
// Transform an array of planes by a matrix. The vectors (a,b,c) must be normal.
// M should be the inverse transpose of the transformation desired.
function D3DXPlaneTransformArray(pOut: PD3DXPLANE; OutStride: UINT; const pP: PD3DXPLANE; PStride: UINT;
const pM: PD3DXMATRIX; n: UINT): PD3DXPLANE; stdcall;
external DLL_D3DX10;
// --------------------------
// Color
// --------------------------
// inline
// (1-r, 1-g, 1-b, a)
function D3DXColorNegative(pOut: PD3DXCOLOR; const pC: PD3DXCOLOR): PD3DXCOLOR;
function D3DXColorAdd(pOut: PD3DXCOLOR; const pC1: PD3DXCOLOR; const pC2: PD3DXCOLOR): PD3DXCOLOR;
function D3DXColorSubtract(pOut: PD3DXCOLOR; const pC1: PD3DXCOLOR; const pC2: PD3DXCOLOR): PD3DXCOLOR;
function D3DXColorScale(pOut: PD3DXCOLOR; const pC: PD3DXCOLOR; s: single): PD3DXCOLOR;
// (r1*r2, g1*g2, b1*b2, a1*a2)
function D3DXColorModulate(pOut: PD3DXCOLOR; const pC1: PD3DXCOLOR; const pC2: PD3DXCOLOR): PD3DXCOLOR;
// Linear interpolation of r,g,b, and a. C1 + s(C2-C1)
function D3DXColorLerp(pOut: PD3DXCOLOR; const pC1: PD3DXCOLOR; const pC2: PD3DXCOLOR; s: single): PD3DXCOLOR;
// non-inline
// Interpolate r,g,b between desaturated color and color.
// DesaturatedColor + s(Color - DesaturatedColor)
function D3DXColorAdjustSaturation(pOut: PD3DXCOLOR; const pC: PD3DXCOLOR; s: single): PD3DXCOLOR; stdcall; external DLL_D3DX10;
// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey)
function D3DXColorAdjustContrast(pOut: PD3DXCOLOR; const pC: PD3DXCOLOR; c: single): PD3DXCOLOR; stdcall; external DLL_D3DX10;
// --------------------------
// 4D Matrix
// --------------------------
function D3DXMatrixIdentity(pOut: PD3DXMATRIX): PD3DXMATRIX;
function D3DXMatrixIsIdentity(pM: PD3DXMATRIX): longbool;
function D3DXMatrixDeterminant(const pM: PD3DXMATRIX): single; stdcall; external DLL_D3DX10;
function D3DXMatrixDecompose(pOutScale: PD3DXVECTOR3; pOutRotation: PD3DXQUATERNION; pOutTranslation: PD3DXVECTOR3;
pM: PD3DXMATRIX): HResult; stdcall;
external DLL_D3DX10;
function D3DXMatrixTranspose(pOut: PD3DXMATRIX; const pM: PD3DXMATRIX): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Matrix multiplication. The result represents the transformation M2
// followed by the transformation M1. (Out = M1 * M2)
function D3DXMatrixMultiply(pOut: PD3DXMATRIX; const pM1: PD3DXMATRIX; const pM2: PD3DXMATRIX): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2))
function D3DXMatrixMultiplyTranspose(pOut: PD3DXMATRIX; const pM1: PD3DXMATRIX; const pM2: PD3DXMATRIX): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Calculate inverse of matrix. Inversion my fail, in which case NULL will
// be returned. The determinant of pM is also returned it pfDeterminant
// is non-NULL.
function D3DXMatrixInverse(pOut: PD3DXMATRIX; pDeterminant: PSingle; const pM: PD3DXMATRIX): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a matrix which scales by (sx, sy, sz)
function D3DXMatrixScaling(pOut: PD3DXMATRIX; sx, sy, sz: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a matrix which translates by (x, y, z)
function D3DXMatrixTranslation(pOut: PD3DXMATRIX; x, y, z: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a matrix which rotates around the X axis
function D3DXMatrixRotationX(pOut: PD3DXMATRIX; Angle: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a matrix which rotates around the Y axis
function D3DXMatrixRotationY(pOut: PD3DXMATRIX; Angle: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a matrix which rotates around the Z axis
function D3DXMatrixRotationZ(pOut: PD3DXMATRIX; Angle: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a matrix which rotates around an arbitrary axis
function D3DXMatrixRotationAxis(pOut: PD3DXMATRIX; pV: PD3DXVECTOR3; Angle: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a matrix from a quaternion
function D3DXMatrixRotationQuaternion(pOut: PD3DXMATRIX; pQ: PD3DXQUATERNION): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Yaw around the Y axis, a pitch around the X axis,
// and a roll around the Z axis.
function D3DXMatrixRotationYawPitchRoll(pOut: PD3DXMATRIX; Yaw, Pitch, Roll: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build transformation matrix. NULL arguments are treated as identity.
// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt
function D3DXMatrixTransformation(pOut: PD3DXMATRIX; const pScalingCenter: PD3DXVECTOR3; const pScalingRotation: PD3DXQUATERNION;
const pScaling: PD3DXVECTOR3; const pRotationCenter: PD3DXVECTOR3; const pRotation: PD3DXQUATERNION;
const pTranslation: PD3DXVECTOR3): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build 2D transformation matrix in XY plane. NULL arguments are treated as identity.
// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt
function D3DXMatrixTransformation2D(pOut: PD3DXMATRIX; const pScalingCenter: PD3DXVECTOR2; ScalingRotation: single;
const pScaling: PD3DXVECTOR2; const pRotationCenter: PD3DXVECTOR2; Rotation: single; const pTranslation: PD3DXVECTOR2): PD3DXMATRIX;
stdcall; external DLL_D3DX10;
// Build affine transformation matrix. NULL arguments are treated as identity.
// Mout = Ms * Mrc-1 * Mr * Mrc * Mt
function D3DXMatrixAffineTransformation(pOut: PD3DXMATRIX; Scaling: single; const pRotationCenter: PD3DXVECTOR3;
const pRotation: PD3DXQUATERNION; const pTranslation: PD3DXVECTOR3): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build 2D affine transformation matrix in XY plane. NULL arguments are treated as identity.
// Mout = Ms * Mrc-1 * Mr * Mrc * Mt
function D3DXMatrixAffineTransformation2D(pOut: PD3DXMATRIX; Scaling: single; const pRotationCenter: PD3DXVECTOR2;
Rotation: single; const pTranslation: PD3DXVECTOR2): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a lookat matrix. (right-handed)
function D3DXMatrixLookAtRH(pOut: PD3DXMATRIX; const pEye: TD3DXVECTOR3; const pAt: TD3DXVECTOR3; const pUp: TD3DXVECTOR3): PD3DXMATRIX; stdcall;
external DLL_D3DX10;
// Build a lookat matrix. (left-handed)
function D3DXMatrixLookAtLH(pOut: PD3DXMATRIX; const pEye: TD3DXVECTOR3; const pAt: TD3DXVECTOR3; const pUp: TD3DXVECTOR3): PD3DXMATRIX; stdcall;
external DLL_D3DX10;
// Build a perspective projection matrix. (right-handed)
function D3DXMatrixPerspectiveRH(pOut: PD3DXMATRIX; w, h, zn, zf: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a perspective projection matrix. (left-handed)
function D3DXMatrixPerspectiveLH(pOut: PD3DXMATRIX; w, h, zn, zf: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a perspective projection matrix. (right-handed)
function D3DXMatrixPerspectiveFovRH(pOut: PD3DXMATRIX; fovy, Aspect, zn, zf: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a perspective projection matrix. (left-handed)
function D3DXMatrixPerspectiveFovLH(pOut: PD3DXMATRIX; fovy, Aspect, zn, zf: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a perspective projection matrix. (right-handed)
function D3DXMatrixPerspectiveOffCenterRH(pOut: PD3DXMATRIX; l, r, b, t, zn, zf: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a perspective projection matrix. (left-handed)
function D3DXMatrixPerspectiveOffCenterLH(pOut: PD3DXMATRIX; l, r, b, t, zn, zf: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build an ortho projection matrix. (right-handed)
function D3DXMatrixOrthoRH(pOut: PD3DXMATRIX; w, h, zn, zf: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build an ortho projection matrix. (left-handed)
function D3DXMatrixOrthoLH(pOut: PD3DXMATRIX; w, h, zn, zf: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build an ortho projection matrix. (right-handed)
function D3DXMatrixOrthoOffCenterRH(pOut: PD3DXMATRIX; l, r, b, t, zn, zf: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build an ortho projection matrix. (left-handed)
function D3DXMatrixOrthoOffCenterLH(pOut: PD3DXMATRIX; l, r, b, t, zn, zf: single): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a matrix which flattens geometry into a plane, as if casting
// a shadow from a light.
function D3DXMatrixShadow(pOut: PD3DXMATRIX; const pLight: PD3DXVECTOR4; const pPlane: PD3DXPLANE): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// Build a matrix which reflects the coordinate system about a plane
function D3DXMatrixReflect(pOut: PD3DXMATRIX; const pPlane: PD3DXPLANE): PD3DXMATRIX; stdcall; external DLL_D3DX10;
// --------------------------
// Quaternion
// --------------------------
function D3DXQuaternionLength(pQ: PD3DXQUATERNION): single;
// Length squared, or "norm"
function D3DXQuaternionLengthSq(pQ: PD3DXQUATERNION): single;
function D3DXQuaternionDot(pQ1: PD3DXQUATERNION; pQ2: PD3DXQUATERNION): single;
// (0, 0, 0, 1)
function D3DXQuaternionIdentity(pOut: PD3DXQUATERNION): PD3DXQUATERNION;
function D3DXQuaternionIsIdentity(pQ: PD3DXQUATERNION): longbool;
// (-x, -y, -z, w)
function D3DXQuaternionConjugate(pOut: PD3DXQUATERNION; pQ: PD3DXQUATERNION): PD3DXQUATERNION;
// Compute a quaternin's axis and angle of rotation. Expects unit quaternions.
procedure D3DXQuaternionToAxisAngle(pQ: PD3DXQUATERNION; pAxis: PD3DXVECTOR3; pAngle: PSingle); stdcall; external DLL_D3DX10;
// Build a quaternion from a rotation matrix.
function D3DXQuaternionRotationMatrix(pOut: PD3DXQUATERNION; pM: PD3DXMATRIX): PD3DXQUATERNION; stdcall; external DLL_D3DX10;
// Rotation about arbitrary axis.
function D3DXQuaternionRotationAxis(pOut: PD3DXQUATERNION; pV: PD3DXVECTOR3; Angle: PSingle): PD3DXQUATERNION; stdcall; external DLL_D3DX10;
// Yaw around the Y axis, a pitch around the X axis,
// and a roll around the Z axis.
function D3DXQuaternionRotationYawPitchRoll(pOut: PD3DXQUATERNION; Yaw, Pitch, Roll: single): PD3DXQUATERNION; stdcall; external DLL_D3DX10;
// Quaternion multiplication. The result represents the rotation Q2
// followed by the rotation Q1. (Out = Q2 * Q1)
function D3DXQuaternionMultiply(pOut: PD3DXQUATERNION; pQ1: PD3DXQUATERNION; pQ2: PD3DXQUATERNION): PD3DXQUATERNION; stdcall; external DLL_D3DX10;
function D3DXQuaternionNormalize(pOut: PD3DXQUATERNION; pQ: PD3DXQUATERNION): PD3DXQUATERNION; stdcall; external DLL_D3DX10;
// Conjugate and re-norm
function D3DXQuaternionInverse(pOut: PD3DXQUATERNION; pQ: PD3DXQUATERNION): PD3DXQUATERNION; stdcall; external DLL_D3DX10;
// Expects unit quaternions.
// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v)
function D3DXQuaternionLn(pOut: PD3DXQUATERNION; pQ: PD3DXQUATERNION): PD3DXQUATERNION; stdcall; external DLL_D3DX10;
// Expects pure quaternions. (w == 0) w is ignored in calculation.
// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v)
function D3DXQuaternionExp(pOut: PD3DXQUATERNION; pQ: PD3DXQUATERNION): PD3DXQUATERNION; stdcall; external DLL_D3DX10;
// Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1).
// Expects unit quaternions.
function D3DXQuaternionSlerp(pOut: PD3DXQUATERNION; pQ1: PD3DXQUATERNION; pQ2: PD3DXQUATERNION; t: single): PD3DXQUATERNION;
stdcall; external DLL_D3DX10;
// Spherical quadrangle interpolation.
// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t))
function D3DXQuaternionSquad(pOut: PD3DXQUATERNION; pQ1: PD3DXQUATERNION; pA: PD3DXQUATERNION; pB: PD3DXQUATERNION;
pC: PD3DXQUATERNION; t: single): PD3DXQUATERNION; stdcall; external DLL_D3DX10;
// Setup control points for spherical quadrangle interpolation
// from Q1 to Q2. The control points are chosen in such a way
// to ensure the continuity of tangents with adjacent segments.
procedure D3DXQuaternionSquadSetup(pAOut: PD3DXQUATERNION; pBOut: PD3DXQUATERNION; pCOut: PD3DXQUATERNION;
pQ0: PD3DXQUATERNION; pQ1: PD3DXQUATERNION; pQ2: PD3DXQUATERNION; pQ3: PD3DXQUATERNION); stdcall; external DLL_D3DX10;
// Barycentric interpolation.
// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g))
function D3DXQuaternionBaryCentric(pOut: PD3DXQUATERNION; pQ1: PD3DXQUATERNION; pQ2: PD3DXQUATERNION; pQ3: PD3DXQUATERNION;
f, g: single): PD3DXQUATERNION;
stdcall; external DLL_D3DX10;
// --------------------------
// Misc
// --------------------------
// Calculate Fresnel term given the cosine of theta (likely obtained by
// taking the dot of two normals), and the refraction index of the material.
function D3DXFresnelTerm(CosTheta, RefractionIndex: single): single; stdcall; external DLL_D3DX10;
// ===========================================================================
// Matrix Stack
// ===========================================================================
type
ID3DXMatrixStack = interface(IUnknown)
['{C7885BA7-F990-4fe7-922D-8515E477DD85}']
function Pop(): HResult; stdcall;
function Push(): HResult; stdcall;
function LoadIdentity(): HResult; stdcall;
function LoadMatrix(pM: PD3DXMATRIX): HResult; stdcall;
function MultMatrix(pM: PD3DXMATRIX): HResult; stdcall;
function MultMatrixLocal(pM: PD3DXMATRIX): HResult; stdcall;
function RotateAxis(pV: PD3DXVECTOR3; Angle: single): HResult; stdcall;
function RotateAxisLocal(pV: PD3DXVECTOR3; Angle: single): HResult; stdcall;
function RotateYawPitchRoll(Yaw, Pitch, Roll: single): HResult; stdcall;
function RotateYawPitchRollLocal(Yaw, Pitch, Roll: single): HResult; stdcall;
function Scale(x, y, z: single): HResult; stdcall;
function ScaleLocal(x, y, z: single): HResult; stdcall;
function Translate(x, y, z: single): HResult; stdcall;
function TranslateLocal(x, y, z: single): HResult; stdcall;
function GetTop(): PD3DXMATRIX; stdcall;
end;
PID3DXMatrixStack = ^ID3DXMatrixStack;
function D3DXCreateMatrixStack(Flags: UINT; out ppStack: ID3DXMatrixStack): HResult; stdcall; external DLL_D3DX10;
// ============================================================================
// Basic Spherical Harmonic math routines
// ============================================================================
const
D3DXSH_MINORDER = 2;
D3DXSH_MAXORDER = 6;
type
TD3DX_CPU_OPTIMIZATION = (D3DX_NOT_OPTIMIZED = 0, D3DX_3DNOW_OPTIMIZED, D3DX_SSE2_OPTIMIZED, D3DX_SSE_OPTIMIZED);
function D3DXSHEvalDirection(pOut: PSingle; Order: UINT; const pDir: PD3DXVECTOR3): PSingle; stdcall; external DLL_D3DX10;
function D3DXSHRotate(pOut: PSingle; Order: UINT; pMatrix: PD3DXMATRIX; pIn: PSingle): PSingle; stdcall; external DLL_D3DX10;
function D3DXSHRotateZ(pOut: PSingle; Order: UINT; Angle: single; pIn: PSingle): PSingle; stdcall; external DLL_D3DX10;
function D3DXSHAdd(pOut: PSingle; Order: UINT; pA: PSingle; pB: PSingle): PSingle; stdcall; external DLL_D3DX10;
function D3DXSHScale(pOut: PSingle; Order: UINT; pIn: PSingle; const Scale: single): PSingle; stdcall; external DLL_D3DX10;
function D3DXSHDot(Order: UINT; pA: PSingle; pB: PSingle): single; stdcall; external DLL_D3DX10;
function D3DXSHEvalDirectionalLight(Order: UINT; pDir: PD3DXVECTOR3; RIntensity, GIntensity, BIntensity: single;
pROut: PSingle; pGOut: PSingle; pBOut: PSingle): HResult; stdcall; external DLL_D3DX10;
function D3DXSHEvalSphericalLight(Order: UINT; pPos: PD3DXVECTOR3; Radius: single; RIntensity, GIntensity, BIntensity: single;
pROut: PSingle; pGOut: PSingle; pBOut: PSingle): HResult; stdcall; external DLL_D3DX10;
function D3DXSHEvalConeLight(Order: UINT; pDir: PD3DXVECTOR3; Radius: single; RIntensity, GIntensity, BIntensity: single;
pROut: PSingle; pGOut: PSingle; pBOut: PSingle): HResult; stdcall; external DLL_D3DX10;
function D3DXSHEvalHemisphereLight(Order: UINT; pDir: PD3DXVECTOR3; Top: TD3DXCOLOR; Bottom: TD3DXCOLOR; pROut: PSingle;
pGOut: PSingle; pBOut: PSingle): HResult; stdcall; external DLL_D3DX10;
// Math intersection functions
function D3DXIntersectTri(p0: PD3DXVECTOR3; // Triangle vertex 0 position
p1: PD3DXVECTOR3; // Triangle vertex 1 position
p2: PD3DXVECTOR3; // Triangle vertex 2 position
pRayPos: PD3DXVECTOR3; // Ray origin
pRayDir: PD3DXVECTOR3; // Ray direction
pU: PSingle; // Barycentric Hit Coordinates
pV: PSingle; // Barycentric Hit Coordinates
pDist: PSingle): longbool; stdcall; external DLL_D3DX10; // Ray-Intersection Parameter Distance
function D3DXSphereBoundProbe(pCenter: PD3DXVECTOR3; Radius: single; pRayPosition: PD3DXVECTOR3; pRayDirection: PD3DXVECTOR3): longbool; stdcall;
external DLL_D3DX10;
function D3DXBoxBoundProbe(pMin: PD3DXVECTOR3; pMax: PD3DXVECTOR3; pRayPosition: PD3DXVECTOR3; pRayDirection: PD3DXVECTOR3): longbool; stdcall;
external DLL_D3DX10;
function D3DXComputeBoundingSphere(pFirstPosition: PD3DXVECTOR3; // pointer to first position
NumVertices: DWORD; dwStride: DWORD; // count in bytes to subsequent position vectors
pCenter: PD3DXVECTOR3; pRadius: PSingle): HResult; stdcall; external DLL_D3DX10;
function D3DXComputeBoundingBox(pFirstPosition: PD3DXVECTOR3; // pointer to first position
NumVertices: DWORD; dwStride: DWORD; // count in bytes to subsequent position vectors
pMin: PD3DXVECTOR3; pMax: PD3DXVECTOR3): HResult; stdcall; external DLL_D3DX10;
function D3DXCpuOptimizations(Enable: longbool): TD3DX_CPU_OPTIMIZATION; stdcall; external DLL_D3DX10;
function D3DXSHMultiply2(pOut: PSingle; pF: PSingle; pG: PSingle): PSingle; stdcall; external DLL_D3DX10;
function D3DXSHMultiply3(pOut: PSingle; pF: PSingle; pG: PSingle): PSingle; stdcall; external DLL_D3DX10;
function D3DXSHMultiply4(pOut: PSingle; pF: PSingle; pG: PSingle): PSingle; stdcall; external DLL_D3DX10;
function D3DXSHMultiply5(pOut: PSingle; pF: PSingle; pG: PSingle): PSingle; stdcall; external DLL_D3DX10;
function D3DXSHMultiply6(pOut: PSingle; pF: PSingle; pG: PSingle): PSingle; stdcall; external DLL_D3DX10;
{ D3DX10Core.h}
const
IID_ID3DX10Sprite: TGUID = '{BA0B762D-8D28-43ec-B9DC-2F84443B0614}';
IID_ID3DX10ThreadPump: TGUID = '{C93FECFA-6967-478a-ABBC-402D90621FCB}';
IID_ID3DX10Font: TGUID = '{D79DBB70-5F21-4d36-BBC2-FF525C213CDC}';
type
TD3DX10_SPRITE_FLAG = (
D3DX10_SPRITE_SORT_TEXTURE = $01,
D3DX10_SPRITE_SORT_DEPTH_BACK_TO_FRONT = $02,
D3DX10_SPRITE_SORT_DEPTH_FRONT_TO_BACK = $04,
D3DX10_SPRITE_SAVE_STATE = $08,
D3DX10_SPRITE_ADDREF_TEXTURES = $10);
TD3DX10_SPRITE = record
matWorld: TD3DXMATRIX;
TexCoord: TD3DXVECTOR2;
TexSize: TD3DXVECTOR2;
ColorModulate: TD3DXCOLOR;
pTexture: ID3D10ShaderResourceView;
TextureIndex: UINT;
end;
PD3DX10_SPRITE = ^TD3DX10_SPRITE;
{$IFDEF FPC}
{$interfaces corba}
ID3DX10DataLoader = interface
function Load(): HResult; stdcall;
function Decompress(out ppData: pointer; out pcBytes: SIZE_T): HResult; stdcall;
function Destroy(): HResult; stdcall;
end;
ID3DX10DataProcessor = interface
function Process(pData: pointer; cBytes: SIZE_T): HResult; stdcall;
function CreateDeviceObject(out ppDataObject: pointer): HResult; stdcall;
function Destroy(): HResult; stdcall;
end;
{$interfaces com}
{$ELSE}
ID3DX10DataLoader = class // Cannot use 'interface'
function Load(): HResult; virtual; stdcall; abstract;
function Decompress(out ppData: pointer; out pcBytes: SIZE_T): HResult; virtual; stdcall; abstract;
function Destroy(): HResult; virtual; stdcall; abstract;
end;
ID3DX10DataProcessor = class // Cannot use 'interface'
function Process(pData: pointer; cBytes: SIZE_T): HResult; virtual; stdcall; abstract;
function CreateDeviceObject(out ppDataObject: pointer): HResult; virtual; stdcall; abstract;
function Destroy(): HResult; virtual; stdcall; abstract;
end;
{$ENDIF}
ID3DX10Sprite = interface(IUnknown)
['{BA0B762D-8D28-43ec-B9DC-2F84443B0614}']
function _Begin(flags: UINT): HResult; stdcall;
function DrawSpritesBuffered(pSprites: PD3DX10_SPRITE; cSprites: UINT): HResult; stdcall;
function Flush(): HResult; stdcall;
function DrawSpritesImmediate(pSprites: PD3DX10_SPRITE; cSprites: UINT; cbSprite: UINT; flags: UINT): HResult; stdcall;
function _End(): HResult; stdcall;
function GetViewTransform(out pViewTransform: TD3DXMATRIX): HResult; stdcall;
function SetViewTransform(pViewTransform: PD3DXMATRIX): HResult; stdcall;
function GetProjectionTransform(out pProjectionTransform: TD3DXMATRIX): HResult; stdcall;
function SetProjectionTransform(pProjectionTransform: PD3DXMATRIX): HResult; stdcall;
function GetDevice(out ppDevice: ID3D10Device): HResult; stdcall;
end;
PID3DX10Sprite = ^ID3DX10Sprite;
ID3DX10ThreadPump = interface(IUnknown)
['{C93FECFA-6967-478a-ABBC-402D90621FCB}']
function AddWorkItem(pDataLoader: ID3DX10DataLoader; pDataProcessor: ID3DX10DataProcessor; pHResult: PHRESULT;
out ppDeviceObject: Pointer): HResult; stdcall;
function GetWorkItemCount(): UINT; stdcall;
function WaitForAllItems(): HResult; stdcall;
function ProcessDeviceWorkItems(iWorkItemCount: UINT): HResult; stdcall;
function PurgeAllItems(): HResult; stdcall;
function GetQueueStatus(pIoQueue: PUINT; pProcessQueue: PUINT; pDeviceQueue: PUINT): HResult; stdcall;
end;
TD3DX10_FONT_DESCA = record
Height: integer;
Width: UINT;
Weight: UINT;
MipLevels: UINT;
Italic: longbool;
CharSet: byte;
OutputPrecision: byte;
Quality: byte;
PitchAndFamily: byte;
FaceName: array [0..LF_FACESIZE - 1] of AnsiChar;
end;
PD3DX10_FONT_DESCA = ^TD3DX10_FONT_DESCA;
TD3DX10_FONT_DESCW = record
Height: integer;
Width: UINT;
Weight: UINT;
MipLevels: UINT;
Italic: longbool;
CharSet: byte;
OutputPrecision: byte;
Quality: byte;
PitchAndFamily: byte;
FaceName: array [0..LF_FACESIZE - 1] of widechar;
end;
PD3DX10_FONT_DESCW = ^TD3DX10_FONT_DESCW;
ID3DX10Font = interface(IUnknown)
['{D79DBB70-5F21-4d36-BBC2-FF525C213CDC}']
function GetDevice(out ppDevice: ID3D10Device): HResult; stdcall;
function GetDescA(pDesc: TD3DX10_FONT_DESCA): HResult; stdcall;
function GetDescW(out pDesc: TD3DX10_FONT_DESCW): HResult; stdcall;
function GetTextMetricsA(out pTextMetrics: TTEXTMETRICA): longbool; stdcall;
function GetTextMetricsW(out pTextMetrics: TEXTMETRICW): longbool; stdcall;
function GetDC(): HDC; stdcall;
function GetGlyphData(Glyph: UINT; out ppTexture: ID3D10ShaderResourceView; out pBlackBox: TRECT; out pCellInc: TPOINT): HResult; stdcall;
function PreloadCharacters(First: UINT; Last: UINT): HResult; stdcall;
function PreloadGlyphs(First: UINT; Last: UINT): HResult; stdcall;
function PreloadTextA(pString: PAnsiChar; Count: integer): HResult; stdcall;
function PreloadTextW(pString: PWideChar; Count: integer): HResult; stdcall;
function DrawTextA(pSprite: ID3DX10SPRITE; pString: PAnsiChar; Count: integer; pRect: PRECT; Format: UINT;
Color: TD3DXCOLOR): integer; stdcall;
function DrawTextW(pSprite: ID3DX10SPRITE; pString: PWideChar; Count: integer; pRect: PRECT; Format: UINT;
Color: TD3DXCOLOR): integer; stdcall;
end;
{ D3DX10Tex.h }
TD3DX10_FILTER_FLAG = (
D3DX10_FILTER_NONE = (1 shl 0),
D3DX10_FILTER_POINT = (2 shl 0),
D3DX10_FILTER_LINEAR = (3 shl 0),
D3DX10_FILTER_TRIANGLE = (4 shl 0),
D3DX10_FILTER_BOX = (5 shl 0),
D3DX10_FILTER_MIRROR_U = (1 shl 16),
D3DX10_FILTER_MIRROR_V = (2 shl 16),
D3DX10_FILTER_MIRROR_W = (4 shl 16),
D3DX10_FILTER_MIRROR = (7 shl 16),
D3DX10_FILTER_DITHER = (1 shl 19),
D3DX10_FILTER_DITHER_DIFFUSION = (2 shl 19),
D3DX10_FILTER_SRGB_IN = (1 shl 21),
D3DX10_FILTER_SRGB_OUT = (2 shl 21),
D3DX10_FILTER_SRGB = (3 shl 21));
TD3DX10_NORMALMAP_FLAG = (
D3DX10_NORMALMAP_MIRROR_U = (1 shl 16),
D3DX10_NORMALMAP_MIRROR_V = (2 shl 16),
D3DX10_NORMALMAP_MIRROR = (3 shl 16),
D3DX10_NORMALMAP_INVERTSIGN = (8 shl 16),
D3DX10_NORMALMAP_COMPUTE_OCCLUSION = (16 shl 16));
TD3DX10_CHANNEL_FLAG = (
D3DX10_CHANNEL_RED = (1 shl 0),
D3DX10_CHANNEL_BLUE = (1 shl 1),
D3DX10_CHANNEL_GREEN = (1 shl 2),
D3DX10_CHANNEL_ALPHA = (1 shl 3),
D3DX10_CHANNEL_LUMINANCE = (1 shl 4));
TD3DX10_IMAGE_FILE_FORMAT = (
D3DX10_IFF_BMP = 0,
D3DX10_IFF_JPG = 1,
D3DX10_IFF_PNG = 3,
D3DX10_IFF_DDS = 4,
D3DX10_IFF_TIFF = 10,
D3DX10_IFF_GIF = 11,
D3DX10_IFF_WMP = 12,
D3DX10_IFF_FORCE_DWORD = $7fffffff
);
TD3DX10_SAVE_TEXTURE_FLAG = (
D3DX10_STF_USEINPUTBLOB = $0001);
TD3DX10_IMAGE_INFO = record
Width: UINT;
Height: UINT;
Depth: UINT;
ArraySize: UINT;
MipLevels: UINT;
MiscFlags: UINT;
Format: TDXGI_FORMAT;
ResourceDimension: TD3D10_RESOURCE_DIMENSION;
ImageFileFormat: TD3DX10_IMAGE_FILE_FORMAT;
end;
PD3DX10_IMAGE_INFO = ^TD3DX10_IMAGE_INFO;
{ TD3DX10_IMAGE_LOAD_INFO }
TD3DX10_IMAGE_LOAD_INFO = record
Width: UINT;
Height: UINT;
Depth: UINT;
FirstMipLevel: UINT;
MipLevels: UINT;
Usage: TD3D10_USAGE;
BindFlags: UINT;
CpuAccessFlags: UINT;
MiscFlags: UINT;
Format: TDXGI_FORMAT;
Filter: UINT;
MipFilter: UINT;
pSrcInfo: PD3DX10_IMAGE_INFO;
procedure Init;
end;
PD3DX10_IMAGE_LOAD_INFO = ^TD3DX10_IMAGE_LOAD_INFO;
{ TD3DX10_TEXTURE_LOAD_INFO }
TD3DX10_TEXTURE_LOAD_INFO = record
pSrcBox: pD3D10_BOX;
pDstBox: PD3D10_BOX;
SrcFirstMip: UINT;
DstFirstMip: UINT;
NumMips: UINT;
SrcFirstElement: UINT;
DstFirstElement: UINT;
NumElements: UINT;
Filter: UINT;
MipFilter: UINT;
procedure Init;
end;
PD3DX10_TEXTURE_LOAD_INFO = ^TD3DX10_TEXTURE_LOAD_INFO;
{D3DX10Mesh.h}
// Mesh options - lower 3 bytes only, upper byte used by _D3DX10MESHOPT option flags
TD3DX10_MESH = (
D3DX10_MESH_32_BIT = $001, // If set, then use 32 bit indices, if not set use 16 bit indices.
D3DX10_MESH_GS_ADJACENCY = $004 // If set, mesh contains GS adjacency info. Not valid on input.
);
TD3DX10_ATTRIBUTE_RANGE = record
AttribId: UINT;
FaceStart: UINT;
FaceCount: UINT;
VertexStart: UINT;
VertexCount: UINT;
end;
PD3DX10_ATTRIBUTE_RANGE = ^TD3DX10_ATTRIBUTE_RANGE;
TD3DX10_MESH_DISCARD_FLAGS = (
D3DX10_MESH_DISCARD_ATTRIBUTE_BUFFER = $01,
D3DX10_MESH_DISCARD_ATTRIBUTE_TABLE = $02,
D3DX10_MESH_DISCARD_POINTREPS = $04,
D3DX10_MESH_DISCARD_ADJACENCY = $08,
D3DX10_MESH_DISCARD_DEVICE_BUFFERS = $10);
TD3DX10_WELD_EPSILONS = record
Position: single; // NOTE: This does NOT replace the epsilon in GenerateAdjacency
// in general, it should be the same value or greater than the one passed to GeneratedAdjacency
BlendWeights: single;
Normal: single;
PSize: single;
Specular: single;
Diffuse: single;
Texcoord: array [0..7] of single;
Tangent: single;
Binormal: single;
TessFactor: single;
end;
PD3DX10_WELD_EPSILONS = ^TD3DX10_WELD_EPSILONS;
TD3DX10_INTERSECT_INFO = record
FaceIndex: UINT; // index of face intersected
U: single; // Barycentric Hit Coordinates
V: single; // Barycentric Hit Coordinates
Dist: single; // Ray-Intersection Parameter Distance
end;
PD3DX10_INTERSECT_INFO = TD3DX10_INTERSECT_INFO;
// ID3DX10Mesh::Optimize options - upper byte only, lower 3 bytes used from _D3DX10MESH option flags
TD3DX10_MESHOPT = (
D3DX10_MESHOPT_COMPACT = $01000000,
D3DX10_MESHOPT_ATTR_SORT = $02000000,
D3DX10_MESHOPT_VERTEX_CACHE = $04000000,
D3DX10_MESHOPT_STRIP_REORDER = $08000000,
D3DX10_MESHOPT_IGNORE_VERTS = $10000000, // optimize faces only, don't touch vertices
D3DX10_MESHOPT_DO_NOT_SPLIT = $20000000, // do not split vertices shared between attribute groups when attribute sorting
D3DX10_MESHOPT_DEVICE_INDEPENDENT = $00400000 // Only affects VCache. uses a static known good cache size for all cards
// D3DX10_MESHOPT_SHAREVB has been removed, please use D3DX10MESH_VB_SHARE instead
);
TD3DX10_SKINNING_CHANNEL = record
SrcOffset: UINT;
DestOffset: UINT;
IsNormal: longbool;
end;
PD3DX10_SKINNING_CHANNEL = ^TD3DX10_SKINNING_CHANNEL;
TD3DX10_ATTRIBUTE_WEIGHTS = record
Position: single;
Boundary: single;
Normal: single;
Diffuse: single;
Specular: single;
Texcoord: array [0..7] of single;
Tangent: single;
Binormal: single;
end;
PD3DX10_ATTRIBUTE_WEIGHTS = ^TD3DX10_ATTRIBUTE_WEIGHTS;
// ID3DX10MeshBuffer is used by D3DX10Mesh vertex and index buffers
ID3DX10MeshBuffer = interface(IUnknown)
['{04B0D117-1041-46b1-AA8A-3952848BA22E}']
function Map(out ppData: Pointer; out pSize: SIZE_T): HResult; stdcall;
function Unmap(): HResult; stdcall;
function GetSize(): SIZE_T; stdcall;
end;
ID3DX10Mesh = interface(IUnknown)
['{4020E5C2-1403-4929-883F-E2E849FAC195}']
function GetFaceCount(): UINT; stdcall;
function GetVertexCount(): UINT; stdcall;
function GetVertexBufferCount(): UINT; stdcall;
function GetFlags(): UINT; stdcall;
function GetVertexDescription(out ppDesc: PD3D10_INPUT_ELEMENT_DESC; pDeclCount: PUINT): HResult; stdcall;
function SetVertexData(iBuffer: UINT; pData: pointer): HResult; stdcall;
function GetVertexBuffer(iBuffer: UINT; out ppVertexBuffer: ID3DX10MeshBuffer): HResult; stdcall;
function SetIndexData(pData: pointer; cIndices: UINT): HResult; stdcall;
function GetIndexBuffer(out ppIndexBuffer: ID3DX10MeshBuffer): HResult; stdcall;
function SetAttributeData(pData: PUINT): HResult; stdcall;
function GetAttributeBuffer(out ppAttributeBuffer: ID3DX10MeshBuffer): HResult; stdcall;
function SetAttributeTable(pAttribTable: PD3DX10_ATTRIBUTE_RANGE; cAttribTableSize: UINT): HResult; stdcall;
function GetAttributeTable(pAttribTable: PD3DX10_ATTRIBUTE_RANGE; pAttribTableSize: PUINT): HResult; stdcall;
function GenerateAdjacencyAndPointReps(Epsilon: single): HResult; stdcall;
function GenerateGSAdjacency(): HResult; stdcall;
function SetAdjacencyData(pAdjacency: PUINT): HResult; stdcall;
function GetAdjacencyBuffer(out ppAdjacency: ID3DX10MeshBuffer): HResult; stdcall;
function SetPointRepData(pPointReps: PUINT): HResult; stdcall;
function GetPointRepBuffer(out ppPointReps: ID3DX10MeshBuffer): HResult; stdcall;
function Discard(dwDiscard: TD3DX10_MESH_DISCARD_FLAGS): HResult; stdcall;
function CloneMesh(Flags: UINT; pPosSemantic: PAnsiChar; pDesc: PD3D10_INPUT_ELEMENT_DESC; DeclCount: UINT;
out ppCloneMesh: ID3DX10Mesh): HResult; stdcall;
function Optimize(Flags: UINT; pFaceRemap: PUINT; out ppVertexRemap: PID3D10BLOB): HResult; stdcall;
function GenerateAttributeBufferFromTable(): HResult; stdcall;
function Intersect(pRayPos: PD3DXVECTOR3; pRayDir: PD3DXVECTOR3; pHitCount: PUINT; pFaceIndex: PUINT;
pU: PSingle; pV: PSingle; pDist: PSingle; out ppAllHits: ID3D10Blob): HResult; stdcall;
function IntersectSubset(AttribId: UINT; pRayPos: PD3DXVECTOR3; pRayDir: PD3DXVECTOR3; pHitCount: PUINT;
pFaceIndex: PUINT; pU: PSingle; pV: PSingle; pDist: PSingle; out ppAllHits: ID3D10Blob): HResult; stdcall;
// ID3DX10Mesh - Device functions
function CommitToDevice(): HResult; stdcall;
function DrawSubset(AttribId: UINT): HResult; stdcall;
function DrawSubsetInstanced(AttribId: UINT; InstanceCount: UINT; StartInstanceLocation: UINT): HResult; stdcall;
function GetDeviceVertexBuffer(iBuffer: UINT; out ppVertexBuffer: ID3D10Buffer): HResult; stdcall;
function GetDeviceIndexBuffer(out ppIndexBuffer: ID3D10Buffer): HResult; stdcall;
end;
ID3DX10SkinInfo = interface(IUnknown)
['{420BD604-1C76-4a34-A466-E45D0658A32C}']
function GetNumVertices(): UINT; stdcall;
function GetNumBones(): UINT; stdcall;
function GetMaxBoneInfluences(): UINT; stdcall;
function AddVertices(Count: UINT): HResult; stdcall;
function RemapVertices(NewVertexCount: UINT; pVertexRemap: PUINT): HResult; stdcall;
function AddBones(Count: UINT): HResult; stdcall;
function RemoveBone(Index: UINT): HResult; stdcall;
function RemapBones(NewBoneCount: UINT; pBoneRemap: PUINT): HResult; stdcall;
function AddBoneInfluences(BoneIndex: UINT; InfluenceCount: UINT; pIndices: UINT; pWeights: PSingle): HResult; stdcall;
function ClearBoneInfluences(BoneIndex: UINT): HResult; stdcall;
function GetBoneInfluenceCount(BoneIndex: UINT): UINT; stdcall;
function GetBoneInfluences(BoneIndex: UINT; Offset: UINT; Count: UINT; pDestIndices: PUINT;
pDestWeights: PSingle): HResult; stdcall;
function FindBoneInfluenceIndex(BoneIndex: UINT; VertexIndex: UINT; pInfluenceIndex: PUINT): HResult; stdcall;
function SetBoneInfluence(BoneIndex: UINT; InfluenceIndex: UINT; Weight: single): HResult; stdcall;
function GetBoneInfluence(BoneIndex: UINT; InfluenceIndex: UINT; pWeight: PSingle): HResult; stdcall;
function Compact(MaxPerVertexInfluences: UINT; ScaleMode: UINT; MinWeight: single): HResult; stdcall;
function DoSoftwareSkinning(StartVertex: UINT; VertexCount: UINT; pSrcVertices: Pointer; SrcStride: UINT;
pDestVertices: Pointer; DestStride: UINT; pBoneMatrices: PD3DXMATRIX; pInverseTransposeBoneMatrices: PD3DXMATRIX;
pChannelDescs: PD3DX10_SKINNING_CHANNEL; NumChannels: UINT): HResult; stdcall;
end;
function D3DX10CreateFontA(pDevice: ID3D10Device; Height: integer; Width: UINT; Weight: UINT; MipLevels: UINT;
Italic: longbool; CharSet: UINT; OutputPrecision: UINT; Quality: UINT; PitchAndFamily: UINT; pFaceName: PAnsiChar;
out ppFont: ID3DX10FONT): HResult; stdcall; external DLL_D3DX10;
function D3DX10CreateFontW(pDevice: ID3D10Device; Height: integer; Width: UINT; Weight: UINT; MipLevels: UINT;
Italic: longbool; CharSet: UINT; OutputPrecision: UINT; Quality: UINT; PitchAndFamily: UINT; pFaceName: PWideChar;
out ppFont: ID3DX10FONT): HResult; stdcall; external DLL_D3DX10;
function D3DX10CreateFontIndirectA(pDevice: ID3D10Device; pDesc: PD3DX10_FONT_DESCA; out ppFont: ID3DX10FONT): HResult;
stdcall; external DLL_D3DX10;
function D3DX10CreateFontIndirectW(pDevice: ID3D10Device; pDesc: PD3DX10_FONT_DESCW; out ppFont: ID3DX10FONT): HResult;
stdcall; external DLL_D3DX10;
function D3DX10UnsetAllDeviceObjects(pDevice: ID3D10Device): HResult; stdcall; external DLL_D3DX10;
function D3DX10CreateSprite(pDevice: ID3D10Device; cDeviceBufferSize: UINT; out ppSprite: ID3DX10Sprite): HResult; stdcall; external DLL_D3DX10;
function D3DX10CreateThreadPump(cIoThreads: UINT; cProcThreads: UINT; out ppThreadPump: ID3DX10ThreadPump): HResult; stdcall; external DLL_D3DX10;
function D3DX10CreateDevice(pAdapter: IDXGIAdapter; DriverType: TD3D10_DRIVER_TYPE; Software: HMODULE; Flags: UINT;
out ppDevice: ID3D10Device): HResult; stdcall; external DLL_D3DX10;
function D3DX10CreateDeviceAndSwapChain(pAdapter: IDXGIAdapter; DriverType: TD3D10_DRIVER_TYPE; Software: HMODULE;
Flags: UINT; pSwapChainDesc: PDXGI_SWAP_CHAIN_DESC; out ppSwapChain: IDXGISwapChain; out ppDevice: ID3D10Device): HResult;
stdcall; external DLL_D3DX10;
{ D3DX10Asycn.h}
function D3DX10CompileFromFileA(pSrcFile: pAnsiChar; pDefines: PD3D10_SHADER_MACRO; pInclude: PID3D10INCLUDE;
pFunctionName: pAnsiChar; pProfile: pAnsiChar; Flags1: UINT; Flags2: UINT; pPump: ID3DX10ThreadPump;
out ppShader: ID3D10Blob; out ppErrorMsgs: ID3D10Blob; out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CompileFromFileW(pSrcFile: PWideChar; pDefines: PD3D10_SHADER_MACRO; pInclude: PID3D10INCLUDE;
pFunctionName: pAnsiChar; pProfile: pAnsiChar; Flags1: UINT; Flags2: UINT; pPump: ID3DX10ThreadPump;
out ppShader: ID3D10Blob; out ppErrorMsgs: ID3D10Blob; out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CompileFromResourceA(hSrcModule: HMODULE; pSrcResource: pAnsiChar; pSrcFileName: pAnsiChar;
pDefines: PD3D10_SHADER_MACRO; pInclude: PID3D10INCLUDE; pFunctionName: pAnsiChar; pProfile: pAnsiChar;
Flags1: UINT; Flags2: UINT; pPump: ID3DX10ThreadPump; out ppShader: ID3D10Blob; out ppErrorMsgs: ID3D10Blob;
out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CompileFromResourceW(hSrcModule: HMODULE; pSrcResource: PWideChar; pSrcFileName: PWideChar;
pDefines: PD3D10_SHADER_MACRO; pInclude: PID3D10INCLUDE; pFunctionName: pAnsiChar; pProfile: pAnsiChar;
Flags1: UINT; Flags2: UINT; pPump: ID3DX10ThreadPump; out ppShader: ID3D10Blob; out ppErrorMsgs: ID3D10Blob;
out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CompileFromMemory(pSrcData: pAnsiChar; SrcDataLen: SIZE_T; pFileName: pAnsiChar; pDefines: PD3D10_SHADER_MACRO;
pInclude: PID3D10INCLUDE; pFunctionName: pAnsiChar; pProfile: pAnsiChar; Flags1: UINT; Flags2: UINT;
pPump: ID3DX10ThreadPump; out ppShader: ID3D10Blob; out ppErrorMsgs: ID3D10Blob; out pHResult: HRESULT): HRESULT;
stdcall; external DLL_D3DX10;
function D3DX10CreateEffectFromFileA(pFileName: pAnsiChar; pDefines: PD3D10_SHADER_MACRO; pInclude: ID3D10Include;
pProfile: pAnsiChar; HLSLFlags: UINT; FXFlags: UINT; pDevice: ID3D10Device; pEffectPool: ID3D10EffectPool;
pPump: ID3DX10ThreadPump; out ppEffect: ID3D10Effect; out ppErrors: ID3D10Blob; out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateEffectFromFileW(pFileName: PWideChar; pDefines: PD3D10_SHADER_MACRO; pInclude: ID3D10Include;
pProfile: pAnsiChar; HLSLFlags: UINT; FXFlags: UINT; pDevice: ID3D10Device; pEffectPool: ID3D10EffectPool;
pPump: ID3DX10ThreadPump; out ppEffect: ID3D10Effect; out ppErrors: ID3D10Blob; out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateEffectFromMemory(pData: Pointer; DataLength: SIZE_T; pSrcFileName: pAnsiChar; pDefines: PD3D10_SHADER_MACRO;
pInclude: ID3D10Include; pProfile: pAnsiChar; HLSLFlags: UINT; FXFlags: UINT; pDevice: ID3D10Device;
pEffectPool: ID3D10EffectPool; pPump: ID3DX10ThreadPump; out ppEffect: ID3D10Effect; out ppErrors: ID3D10Blob;
out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateEffectFromResourceA(hModule: HMODULE; pResourceName: pAnsiChar; pSrcFileName: pAnsiChar;
pDefines: PD3D10_SHADER_MACRO; pInclude: ID3D10Include; pProfile: pAnsiChar; HLSLFlags: UINT; FXFlags: UINT;
pDevice: ID3D10Device; pEffectPool: ID3D10EffectPool; pPump: ID3DX10ThreadPump; out ppEffect: ID3D10Effect;
out ppErrors: ID3D10Blob; out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateEffectFromResourceW(hModule: HMODULE; pResourceName: PWideChar; pSrcFileName: PWideChar;
pDefines: PD3D10_SHADER_MACRO; pInclude: ID3D10Include; pProfile: pAnsiChar; HLSLFlags: UINT; FXFlags: UINT;
pDevice: ID3D10Device; pEffectPool: ID3D10EffectPool; pPump: ID3DX10ThreadPump; out ppEffect: ID3D10Effect;
out ppErrors: ID3D10Blob; out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateEffectPoolFromFileA(pFileName: pAnsiChar; pDefines: PD3D10_SHADER_MACRO; pInclude: ID3D10Include;
pProfile: pAnsiChar; HLSLFlags: UINT; FXFlags: UINT; pDevice: ID3D10Device; pPump: ID3DX10ThreadPump;
out ppEffectPool: ID3D10EffectPool; out ppErrors: ID3D10Blob; out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateEffectPoolFromFileW(pFileName: pWideChar; pDefines: PD3D10_SHADER_MACRO; pInclude: ID3D10Include;
pProfile: pAnsiChar; HLSLFlags: UINT; FXFlags: UINT; pDevice: ID3D10Device; pPump: ID3DX10ThreadPump;
out ppEffectPool: ID3D10EffectPool; out ppErrors: ID3D10Blob; out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateEffectPoolFromMemory(pData: Pointer; DataLength: SIZE_T; pSrcFileName: pAnsiChar;
pDefines: PD3D10_SHADER_MACRO; pInclude: ID3D10Include; pProfile: pAnsiChar; HLSLFlags: UINT; FXFlags: UINT;
pDevice: ID3D10Device; pPump: ID3DX10ThreadPump; out ppEffectPool: ID3D10EffectPool; out ppErrors: ID3D10Blob;
out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateEffectPoolFromResourceA(hModule: HMODULE; pResourceName: pAnsiChar; pSrcFileName: pAnsiChar;
pDefines: PD3D10_SHADER_MACRO; pInclude: ID3D10Include; pProfile: pAnsiChar; HLSLFlags: UINT; FXFlags: UINT;
pDevice: ID3D10Device; pPump: ID3DX10ThreadPump; out ppEffectPool: ID3D10EffectPool; out ppErrors: ID3D10Blob;
out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateEffectPoolFromResourceW(hModule: HMODULE; pResourceName: pWideChar; pSrcFileName: pWideChar;
pDefines: PD3D10_SHADER_MACRO; pInclude: ID3D10Include; pProfile: pAnsiChar; HLSLFlags: UINT; FXFlags: UINT;
pDevice: ID3D10Device; pPump: ID3DX10ThreadPump; out ppEffectPool: ID3D10EffectPool; out ppErrors: ID3D10Blob;
out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10PreprocessShaderFromFileA(pFileName: pAnsiChar; pDefines: PD3D10_SHADER_MACRO; pInclude: PID3D10INCLUDE;
pPump: ID3DX10ThreadPump; out ppShaderText: ID3D10Blob; out ppErrorMsgs: ID3D10Blob; out pHResult: HRESULT): HRESULT;
stdcall; external DLL_D3DX10;
function D3DX10PreprocessShaderFromFileW(pFileName: pWideChar; pDefines: PD3D10_SHADER_MACRO; pInclude: PID3D10INCLUDE;
pPump: ID3DX10ThreadPump; out ppShaderText: ID3D10Blob; out ppErrorMsgs: ID3D10Blob; out pHResult: HRESULT): HRESULT;
stdcall; external DLL_D3DX10;
function D3DX10PreprocessShaderFromMemory(pSrcData: pAnsiChar; SrcDataSize: SIZE_T; pFileName: pAnsiChar;
pDefines: PD3D10_SHADER_MACRO; pInclude: PID3D10INCLUDE; pPump: ID3DX10ThreadPump; out ppShaderText: ID3D10Blob;
out ppErrorMsgs: ID3D10Blob; out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10PreprocessShaderFromResourceA(hModule: HMODULE; pResourceName: pAnsiChar; pSrcFileName: pAnsiChar;
pDefines: PD3D10_SHADER_MACRO; pInclude: PID3D10INCLUDE; pPump: ID3DX10ThreadPump; out ppShaderText: ID3D10Blob;
out ppErrorMsgs: ID3D10Blob; out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10PreprocessShaderFromResourceW(hModule: HMODULE; pResourceName: pWideChar; pSrcFileName: pWideChar;
pDefines: PD3D10_SHADER_MACRO; pInclude: PID3D10INCLUDE; pPump: ID3DX10ThreadPump; out ppShaderText: ID3D10Blob;
out ppErrorMsgs: ID3D10Blob; out pHResult: HRESULT): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateAsyncCompilerProcessor(pFileName: pAnsiChar; pDefines: PD3D10_SHADER_MACRO; pInclude: PID3D10INCLUDE;
pFunctionName: pAnsiChar; pProfile: pAnsiChar; Flags1: UINT; Flags2: UINT; out ppCompiledShader: ID3D10Blob;
out ppErrorBuffer: ID3D10Blob; out ppProcessor: ID3DX10DataProcessor): HRESULT;
stdcall; external DLL_D3DX10;
function D3DX10CreateAsyncEffectCreateProcessor(pFileName: pAnsiChar; pDefines: PD3D10_SHADER_MACRO; pInclude: PID3D10INCLUDE;
pProfile: pAnsiChar; Flags: UINT; FXFlags: UINT; pDevice: ID3D10Device; pPool: ID3D10EffectPool;
out ppErrorBuffer: ID3D10Blob; out ppProcessor: ID3DX10DataProcessor): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateAsyncEffectPoolCreateProcessor(pFileName: pAnsiChar; pDefines: PD3D10_SHADER_MACRO;
pInclude: PID3D10INCLUDE; pProfile: pAnsiChar; Flags: UINT; FXFlags: UINT; pDevice: ID3D10Device;
out ppErrorBuffer: ID3D10Blob; out ppProcessor: ID3DX10DataProcessor): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateAsyncShaderPreprocessProcessor(pFileName: pAnsiChar; pDefines: PD3D10_SHADER_MACRO;
pInclude: PID3D10INCLUDE; out ppShaderText: ID3D10Blob; out ppErrorBuffer: ID3D10Blob; out ppProcessor: ID3DX10DataProcessor): HRESULT;
stdcall; external DLL_D3DX10;
function D3DX10CreateAsyncFileLoaderW(pFileName: pWideChar; out ppDataLoader: ID3DX10DataLoader): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateAsyncFileLoaderA(pFileName: pAnsiChar; out ppDataLoader: ID3DX10DataLoader): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateAsyncMemoryLoader(pData: Pointer; cbData: SIZE_T; out ppDataLoader: ID3DX10DataLoader): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateAsyncResourceLoaderW(hSrcModule: HMODULE; pSrcResource: pWideChar; out ppDataLoader: ID3DX10DataLoader): HRESULT;
stdcall; external DLL_D3DX10;
function D3DX10CreateAsyncResourceLoaderA(hSrcModule: HMODULE; pSrcResource: pAnsiChar; out ppDataLoader: ID3DX10DataLoader): HRESULT;
stdcall; external DLL_D3DX10;
function D3DX10CreateAsyncTextureProcessor(pDevice: ID3D10Device; pLoadInfo: PD3DX10_IMAGE_LOAD_INFO;
out ppDataProcessor: ID3DX10DataProcessor): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10CreateAsyncTextureInfoProcessor(pImageInfo: PD3DX10_IMAGE_INFO; out ppDataProcessor: ID3DX10DataProcessor): HRESULT;
stdcall; external DLL_D3DX10;
function D3DX10CreateAsyncShaderResourceViewProcessor(pDevice: ID3D10Device; pLoadInfo: PD3DX10_IMAGE_LOAD_INFO;
out ppDataProcessor: ID3DX10DataProcessor): HRESULT; stdcall; external DLL_D3DX10;
function D3DX10GetImageInfoFromFileA(pSrcFile: PAnsiChar; pPump: ID3DX10ThreadPump; pSrcInfo: PD3DX10_IMAGE_INFO;
out pHResult: HRESULT): HResult; stdcall; external DLL_D3DX10;
function D3DX10GetImageInfoFromFileW(pSrcFile: PWideChar; pPump: ID3DX10ThreadPump; pSrcInfo: PD3DX10_IMAGE_INFO;
out pHResult: HRESULT): HResult; stdcall; external DLL_D3DX10;
function D3DX10GetImageInfoFromResourceA(hSrcModule: HMODULE; pSrcResource: PAnsiChar; pPump: ID3DX10ThreadPump;
pSrcInfo: PD3DX10_IMAGE_INFO; out pHResult: HRESULT): HResult; stdcall; external DLL_D3DX10;
function D3DX10GetImageInfoFromResourceW(hSrcModule: HMODULE; pSrcResource: PWideChar; pPump: ID3DX10ThreadPump;
pSrcInfo: PD3DX10_IMAGE_INFO; out pHResult: HRESULT): HResult; stdcall; external DLL_D3DX10;
function D3DX10GetImageInfoFromMemory(pSrcData: pointer; SrcDataSize: SIZE_T; pPump: ID3DX10ThreadPump;
pSrcInfo: PD3DX10_IMAGE_INFO; out pHResult: HRESULT): HResult; stdcall; external DLL_D3DX10;
function D3DX10CreateShaderResourceViewFromFileA(pDevice: ID3D10Device; pSrcFile: PAnsiChar; pLoadInfo: PD3DX10_IMAGE_LOAD_INFO;
pPump: ID3DX10ThreadPump; out ppShaderResourceView: ID3D10ShaderResourceView; out pHResult: HRESULT): HResult; stdcall; external DLL_D3DX10;
function D3DX10CreateShaderResourceViewFromFileW(pDevice: ID3D10Device; pSrcFile: PWideChar; pLoadInfo: PD3DX10_IMAGE_LOAD_INFO;
pPump: ID3DX10ThreadPump; out ppShaderResourceView: ID3D10ShaderResourceView; out pHResult: HRESULT): HResult; stdcall; external DLL_D3DX10;
function D3DX10CreateTextureFromFileA(pDevice: ID3D10Device; pSrcFile: PAnsiChar; pLoadInfo: PD3DX10_IMAGE_LOAD_INFO;
pPump: ID3DX10ThreadPump; out ppTexture: ID3D10Resource; out pHResult: HRESULT): HResult; stdcall; external DLL_D3DX10;
function D3DX10CreateTextureFromFileW(pDevice: ID3D10Device; pSrcFile: PWideChar; pLoadInfo: PD3DX10_IMAGE_LOAD_INFO;
pPump: ID3DX10ThreadPump; out ppTexture: ID3D10Resource; out pHResult: HRESULT): HResult; stdcall; external DLL_D3DX10;
// FromResource (resources in dll/exes)
function D3DX10CreateShaderResourceViewFromResourceA(pDevice: ID3D10Device; hSrcModule: HMODULE; pSrcResource: PAnsiChar;
pLoadInfo: PD3DX10_IMAGE_LOAD_INFO; pPump: ID3DX10ThreadPump; out ppShaderResourceView: ID3D10ShaderResourceView;
out pHResult: HRESULT): HResult;
stdcall; external DLL_D3DX10;
function D3DX10CreateShaderResourceViewFromResourceW(pDevice: ID3D10Device; hSrcModule: HMODULE; pSrcResource: PWideChar;
pLoadInfo: PD3DX10_IMAGE_LOAD_INFO; pPump: ID3DX10ThreadPump; out ppShaderResourceView: ID3D10ShaderResourceView;
out pHResult: HRESULT): HResult;
stdcall; external DLL_D3DX10;
function D3DX10CreateTextureFromResourceA(pDevice: ID3D10Device; hSrcModule: HMODULE; pSrcResource: PAnsiChar;
pLoadInfo: PD3DX10_IMAGE_LOAD_INFO; pPump: ID3DX10ThreadPump; out ppTexture: ID3D10Resource; out pHResult: HRESULT): HResult;
stdcall; external DLL_D3DX10;
function D3DX10CreateTextureFromResourceW(pDevice: ID3D10Device; hSrcModule: HMODULE; pSrcResource: PWideChar;
pLoadInfo: PD3DX10_IMAGE_LOAD_INFO; pPump: ID3DX10ThreadPump; out ppTexture: ID3D10Resource; out pHResult: HRESULT): HResult;
stdcall; external DLL_D3DX10;
// FromFileInMemory
function D3DX10CreateShaderResourceViewFromMemory(pDevice: ID3D10Device; pSrcData: pointer; SrcDataSize: SIZE_T;
pLoadInfo: PD3DX10_IMAGE_LOAD_INFO; pPump: ID3DX10ThreadPump; out ppShaderResourceView: ID3D10ShaderResourceView;
out pHResult: HRESULT): HResult;
stdcall; external DLL_D3DX10;
function D3DX10CreateTextureFromMemory(pDevice: ID3D10Device; pSrcData: pointer; SrcDataSize: SIZE_T;
pLoadInfo: PD3DX10_IMAGE_LOAD_INFO; pPump: ID3DX10ThreadPump; out ppTexture: ID3D10Resource; out pHResult: HRESULT): HResult;
stdcall; external DLL_D3DX10;
function D3DX10LoadTextureFromTexture(pSrcTexture: ID3D10Resource; pLoadInfo: PD3DX10_TEXTURE_LOAD_INFO; pDstTexture: ID3D10Resource): HResult;
stdcall; external DLL_D3DX10;
function D3DX10FilterTexture(pTexture: ID3D10Resource; SrcLevel: UINT; MipFilter: UINT): HResult; stdcall; external DLL_D3DX10;
function D3DX10SaveTextureToFileA(pSrcTexture: ID3D10Resource; DestFormat: TD3DX10_IMAGE_FILE_FORMAT; pDestFile: PAnsiChar): HResult;
stdcall; external DLL_D3DX10;
function D3DX10SaveTextureToFileW(pSrcTexture: ID3D10Resource; DestFormat: TD3DX10_IMAGE_FILE_FORMAT; pDestFile: PWideChar): HResult;
stdcall; external DLL_D3DX10;
function D3DX10SaveTextureToMemory(pSrcTexture: ID3D10Resource; DestFormat: TD3DX10_IMAGE_FILE_FORMAT;
ppDestBuf: PID3D10BLOB; Flags: UINT): HResult; stdcall; external DLL_D3DX10;
function D3DX10ComputeNormalMap(pSrcTexture: ID3D10Texture2D; Flags: UINT; Channel: UINT; Amplitude: single;
pDestTexture: ID3D10Texture2D): HResult; stdcall; external DLL_D3DX10;
function D3DX10SHProjectCubeMap(Order: UINT; pCubeMap: ID3D10Texture2D; out pROut: PSingle; out pGOut: PSingle;
out pBOut: PSingle): HResult; stdcall; external DLL_D3DX10;
function D3DX10CreateMesh(pDevice: ID3D10Device; pDeclaration: PD3D10_INPUT_ELEMENT_DESC; DeclCount: UINT;
pPositionSemantic: PAnsiChar; VertexCount: UINT; FaceCount: UINT; Options: UINT; out ppMesh: ID3DX10Mesh): HResult; stdcall; external DLL_D3DX10;
function D3DX10CreateSkinInfo(out ppSkinInfo: ID3DX10SKININFO): HResult; stdcall; external DLL_D3DX10;
{ D3D10_1 functions }
function D3DX10GetFeatureLevel1(pDevice: ID3D10Device; out ppDevice1: ID3D10Device1): HResult; stdcall; external DLL_D3DX10;
function D3DX10DebugMute(Mute: longbool): longbool; stdcall; external DLL_D3DX10_DIAG;
function D3DX10CheckVersion(D3DSdkVersion: UINT; D3DX10SdkVersion: UINT): HResult; stdcall; external DLL_D3DX10;
function D3DXToRadian(degree: single): single;
function D3DXToDegree(radian: single): single;
implementation
function D3DXToRadian(degree: single): single;
begin
Result := (degree * (D3DX_PI / 180.0));
end;
function D3DXToDegree(radian: single): single;
begin
Result := (radian * (180.0 / D3DX_PI));
end;
{ TD3DX10_TEXTURE_LOAD_INFO }
procedure TD3DX10_TEXTURE_LOAD_INFO.Init;
begin
pSrcBox := nil;
pDstBox := nil;
SrcFirstMip := 0;
DstFirstMip := 0;
NumMips := D3DX10_DEFAULT;
SrcFirstElement := 0;
DstFirstElement := 0;
NumElements := D3DX10_DEFAULT;
Filter := D3DX10_DEFAULT;
MipFilter := D3DX10_DEFAULT;
end;
{ TD3DX10_IMAGE_LOAD_INFO }
{$RANGECHECKS OFF}
procedure TD3DX10_IMAGE_LOAD_INFO.Init;
begin
Width := D3DX10_DEFAULT;
Height := D3DX10_DEFAULT;
Depth := D3DX10_DEFAULT;
FirstMipLevel := D3DX10_DEFAULT;
MipLevels := D3DX10_DEFAULT;
Usage := TD3D10_USAGE(D3DX10_DEFAULT);
BindFlags := D3DX10_DEFAULT;
CpuAccessFlags := D3DX10_DEFAULT;
MiscFlags := D3DX10_DEFAULT;
Format := (DXGI_FORMAT_FROM_FILE);
Filter := D3DX10_DEFAULT;
MipFilter := D3DX10_DEFAULT;
pSrcInfo := nil;
end;
{$RANGECHECKS ON}
{ TD3DXCOLOR }
constructor TD3DXCOLOR.Create(argb: UINT);
var
f: single;
begin
f := 1.0 / 255.0;
r := f * (argb shr 16);
g := f * (argb shr 8);
b := f * (argb shr 0);
a := f * (argb shr 24);
end;
constructor TD3DXCOLOR.CreateBySingle(pf: PFloatArray4);
var
lPF: array [0..3] of single;
begin
if pf = nil then
Exit;
{$IFDEF FPC}
r := pf[0];
g := pf[1];
b := pf[2];
a := pf[3];
{$ELSE}
r := pf^[0];
g := pf^[1];
b := pf^[2];
a := pf^[3];
{$ENDIF}
end;
constructor TD3DXCOLOR.CreateByFloat16(pf: PD3DXFLOAT16);
begin
if pf = nil then
Exit;
D3DXFloat16To32Array(@r, pf, 4);
end;
constructor TD3DXCOLOR.Create(fr, fg, fb, fa: single);
begin
r := fr;
g := fg;
b := fb;
a := fa;
end;
function TD3DXCOLOR.AsUINT: UINT;
var
dwR, dwG, dwB, dwA: UINT;
begin
if r >= 1.0 then
dwR := $FF
else if r <= 0.0 then
dwR := $00
else
dwR := Trunc(r * 255 + 0.5);
if g >= 1.0 then
dwG := $FF
else if g <= 0.0 then
dwG := $00
else
dwG := Trunc(g * 255 + 0.5);
if b >= 1.0 then
dwB := $FF
else if b <= 0.0 then
dwB := $00
else
dwB := Trunc(b * 255 + 0.5);
if a >= 1.0 then
dwA := $FF
else if a <= 0.0 then
dwA := $00
else
dwA := Trunc(a * 255 + 0.5);
Result := (dwA shl 24) or (dwR shl 16) or (dwG shl 8) or (dwB shl 0);
end;
class operator TD3DXCOLOR.Add(a, b: TD3DXCOLOR): TD3DXCOLOR;
begin
Result.r := a.r + b.r;
Result.g := a.g + b.g;
Result.b := a.b + b.b;
Result.a := a.a + b.a;
end;
class operator TD3DXCOLOR.Subtract(a, b: TD3DXCOLOR): TD3DXCOLOR;
begin
Result.r := a.r - b.r;
Result.g := a.g - b.g;
Result.b := a.b - b.b;
Result.a := a.a - b.a;
end;
class operator TD3DXCOLOR.Multiply(a: TD3DXCOLOR; b: single): TD3DXCOLOR;
begin
Result.r := a.r * b;
Result.g := a.g * b;
Result.b := a.b * b;
Result.a := a.a * b;
end;
class operator TD3DXCOLOR.Multiply(b: single; a: TD3DXCOLOR): TD3DXCOLOR;
begin
Result.r := a.r * b;
Result.g := a.g * b;
Result.b := a.b * b;
Result.a := a.a * b;
end;
class operator TD3DXCOLOR.Divide(a: TD3DXCOLOR; b: single): TD3DXCOLOR;
begin
Result.r := a.r / b;
Result.g := a.g / b;
Result.b := a.b / b;
Result.a := a.a / b;
end;
class operator TD3DXCOLOR.Positive(a: TD3DXCOLOR): TD3DXCOLOR;
begin
Result.r := a.r;
Result.g := a.g;
Result.b := a.b;
Result.a := a.a;
end;
class operator TD3DXCOLOR.Negative(a: TD3DXCOLOR): TD3DXCOLOR;
begin
Result.r := -a.r;
Result.g := -a.g;
Result.b := -a.b;
Result.a := -a.a;
end;
class operator TD3DXCOLOR.Equal(a, b: TD3DXCOLOR): longbool;
begin
Result := (a.r = b.r) and (a.g = b.g) and (a.b = b.b) and (a.a = b.a);
end;
class operator TD3DXCOLOR.NotEqual(a, b: TD3DXCOLOR): longbool;
begin
Result := (a.r <> b.r) or (a.g <> b.g) or (a.b <> b.b) or (a.a <> b.a);
end;
{ TD3DXPLANE }
constructor TD3DXPLANE.CreateBySingle(pf: PFloatArray4);
begin
if pf = nil then
Exit;
a := pf[0];
b := pf[1];
c := pf[2];
d := pf[3];
end;
constructor TD3DXPLANE.CreateByFloat16(pf: PD3DXFLOAT16);
begin
if pf = nil then
Exit;
D3DXFloat16To32Array(@a, pf, 4);
end;
constructor TD3DXPLANE.Create(fa, fb, fc, fd: single);
begin
a := fa;
b := fb;
c := fc;
d := fd;
end;
class operator TD3DXPLANE.Multiply(a: TD3DXPLANE; b: single): TD3DXPLANE;
begin
Result.a := a.a * b;
Result.b := a.b * b;
Result.c := a.c * b;
Result.d := a.d * b;
end;
class operator TD3DXPLANE.Divide(a: TD3DXPLANE; b: single): TD3DXPLANE;
begin
Result.a := a.a / b;
Result.b := a.b / b;
Result.c := a.c / b;
Result.d := a.d / b;
end;
class operator TD3DXPLANE.Positive(a: TD3DXPLANE): TD3DXPLANE;
begin
Result.a := a.a;
Result.b := a.b;
Result.c := a.c;
Result.d := a.d;
end;
class operator TD3DXPLANE.Negative(a: TD3DXPLANE): TD3DXPLANE;
begin
Result.a := -a.a;
Result.b := -a.b;
Result.c := -a.c;
Result.d := -a.d;
end;
class operator TD3DXPLANE.Equal(a, b: TD3DXPLANE): longbool;
begin
Result := (a.a = b.a) and (a.b = b.b) and (a.c = b.c) and (a.d = b.d);
end;
class operator TD3DXPLANE.NotEqual(a, b: TD3DXPLANE): longbool;
begin
Result := (a.a <> b.a) or (a.b <> b.b) or (a.c <> b.c) or (a.d <> b.d);
end;
{ TD3DXMATRIX }
constructor TD3DXMATRIX.Create(f11, f12, f13, f14, f21, f22, f23, f24, f31, f32, f33, f34, f41, f42, f43, f44: single);
begin
_11 := f11;
_12 := f12;
_13 := f13;
_14 := f14;
_21 := f21;
_22 := f22;
_23 := f23;
_24 := f24;
_31 := f31;
_32 := f32;
_33 := f33;
_34 := f34;
_41 := f41;
_42 := f42;
_43 := f43;
_44 := f44;
end;
constructor TD3DXMATRIX.CreateByFloat16(pf: PD3DXFLOAT16);
begin
if pf = nil then
Exit;
D3DXFloat16To32Array(@_11, pf, 16);
end;
constructor TD3DXMATRIX.Create(m: TD3DMATRIX);
begin
Move(m, _11, SizeOf(TD3DXMATRIX));
end;
constructor TD3DXMATRIX.CreateBySingle(pf: PSingle);
begin
if pf = nil then
Exit;
Move(pf^, _11, SizeOf(TD3DXMATRIX));
end;
class operator TD3DXMATRIX.Add(a, b: TD3DXMATRIX): TD3DXMATRIX;
begin
Result._11 := a._11 + b._11;
Result._12 := a._12 + b._12;
Result._13 := a._13 + b._13;
Result._14 := a._14 + b._14;
Result._21 := a._21 + b._21;
Result._22 := a._22 + b._22;
Result._23 := a._23 + b._23;
Result._24 := a._24 + b._24;
Result._31 := a._31 + b._31;
Result._32 := a._32 + b._32;
Result._33 := a._33 + b._33;
Result._34 := a._34 + b._34;
Result._41 := a._41 + b._41;
Result._42 := a._42 + b._42;
Result._43 := a._43 + b._43;
Result._44 := a._44 + b._44;
end;
class operator TD3DXMATRIX.Divide(a: TD3DXMATRIX; b: single): TD3DXMATRIX;
begin
Result._11 := a._11 / b;
Result._12 := a._12 / b;
Result._13 := a._13 / b;
Result._14 := a._14 / b;
Result._21 := a._21 / b;
Result._22 := a._22 / b;
Result._23 := a._23 / b;
Result._24 := a._24 / b;
Result._31 := a._31 / b;
Result._32 := a._32 / b;
Result._33 := a._33 / b;
Result._34 := a._34 / b;
Result._41 := a._41 / b;
Result._42 := a._42 / b;
Result._43 := a._43 / b;
Result._44 := a._44 / b;
end;
class operator TD3DXMATRIX.Equal(a, b: TD3DXMATRIX): longbool;
begin
{$IFDEF FPC}
Result := (0 = CompareByte(a, b, SizeOf(TD3DXMATRIX)));
{$ELSE}
{$MESSAGE 'Nicht implementiert'}
{$ENDIF}
end;
class operator TD3DXMATRIX.Multiply(a: TD3DXMATRIX; b: TD3DXMATRIX): TD3DXMATRIX;
begin
D3DXMatrixMultiply(@Result, @a, @b);
end;
class operator TD3DXMATRIX.Multiply(a: TD3DXMATRIX; b: single): TD3DXMATRIX;
begin
Result._11 := a._11 * b;
Result._12 := a._12 * b;
Result._13 := a._13 * b;
Result._14 := a._14 * b;
Result._21 := a._21 * b;
Result._22 := a._22 * b;
Result._23 := a._23 * b;
Result._24 := a._24 * b;
Result._31 := a._31 * b;
Result._32 := a._32 * b;
Result._33 := a._33 * b;
Result._34 := a._34 * b;
Result._41 := a._41 * b;
Result._42 := a._42 * b;
Result._43 := a._43 * b;
Result._44 := a._44 * b;
end;
class operator TD3DXMATRIX.Negative(a: TD3DXMATRIX): TD3DXMATRIX;
begin
Result._11 := -a._11;
Result._12 := -a._12;
Result._13 := -a._13;
Result._14 := -a._14;
Result._21 := -a._21;
Result._22 := -a._22;
Result._23 := -a._23;
Result._24 := -a._24;
Result._31 := -a._31;
Result._32 := -a._32;
Result._33 := -a._33;
Result._34 := -a._34;
Result._41 := -a._41;
Result._42 := -a._42;
Result._43 := -a._43;
Result._44 := -a._44;
end;
class operator TD3DXMATRIX.NotEqual(a, b: TD3DXMATRIX): longbool;
begin
{$IFDEF FPC}
Result := (0 <> CompareByte(a, b, SizeOf(TD3DXMATRIX)));
{$ELSE}
{$Message 'Nicht implementiert'}
{$ENDIF}
end;
procedure TD3DXMATRIX.Identity;
begin
ZeroMemory(@Self, sizeof(TD3DXMATRIX));
_11 := 1;
_22 := 1;
_33 := 1;
_44 := 1;
end;
class operator TD3DXMATRIX.Positive(a: TD3DXMATRIX): TD3DXMATRIX;
begin
Result._11 := a._11;
Result._12 := a._12;
Result._13 := a._13;
Result._14 := a._14;
Result._21 := a._21;
Result._22 := a._22;
Result._23 := a._23;
Result._24 := a._24;
Result._31 := a._31;
Result._32 := a._32;
Result._33 := a._33;
Result._34 := a._34;
Result._41 := a._41;
Result._42 := a._42;
Result._43 := a._43;
Result._44 := a._44;
end;
class operator TD3DXMATRIX.Subtract(a, b: TD3DXMATRIX): TD3DXMATRIX;
begin
Result._11 := a._11 - b._11;
Result._12 := a._12 - b._12;
Result._13 := a._13 - b._13;
Result._14 := a._14 - b._14;
Result._21 := a._21 - b._21;
Result._22 := a._22 - b._22;
Result._23 := a._23 - b._23;
Result._24 := a._24 - b._24;
Result._31 := a._31 - b._31;
Result._32 := a._32 - b._32;
Result._33 := a._33 - b._33;
Result._34 := a._34 - b._34;
Result._41 := a._41 - b._41;
Result._42 := a._42 - b._42;
Result._43 := a._43 - b._43;
Result._44 := a._44 - b._44;
end;
{ TD3DXVECTOR4_16F }
constructor TD3DXVECTOR4_16F.CreateBySingle(pf: PSingle);
begin
if pf = nil then
Exit;
D3DXFloat32To16Array(@x, pf, 4);
end;
constructor TD3DXVECTOR4_16F.CreateByFloat16(pf: PD3DXFLOAT16);
var
{$IFDEF FPC}
lTemp: array [0 .. 3] of TD3DXFLOAT16;
{$ELSE}
lTemp: PD3DXFLOAT16ARRAY4;
{$ENDIF}
begin
if (pf = nil) then
Exit;
{$IFDEF FPC}
lTemp := pf;
x.Value := UINT(lTemp[0].Value);
y.Value := UINT(lTemp[1].Value);
z.Value := UINT(lTemp[2].Value);
w.Value := UINT(lTemp[3].Value);
{$ELSE}
ltemp := PD3DXFLOAT16ARRAY4(pf);
x.Value := UINT(lTemp^[0].Value);
y.Value := UINT(lTemp[1].Value);
z.Value := UINT(lTemp[2].Value);
w.Value := UINT(lTemp[3].Value);
{$ENDIF}
end;
constructor TD3DXVECTOR4_16F.Create(v: TD3DXVECTOR3_16F; fw: TD3DXFLOAT16);
begin
x := v.x;
y := v.y;
z := v.z;
w := fw;
end;
constructor TD3DXVECTOR4_16F.Create(fx, fy, fz, fw: TD3DXFLOAT16);
begin
x := fx;
y := fy;
z := fz;
w := fw;
end;
class operator TD3DXVECTOR4_16F.Equal(a, b: TD3DXVECTOR4_16F): longbool;
begin
Result := (a.x = b.x) and (a.y = b.y) and (a.z = b.z) and (a.w = b.w);
end;
class operator TD3DXVECTOR4_16F.NotEqual(a, b: TD3DXVECTOR4_16F): longbool;
begin
Result := (a.x <> b.x) or (a.y <> b.y) or (a.z <> b.z) or (a.w <> b.w);
end;
{ TD3DXVECTOR4 }
constructor TD3DXVECTOR4.CreateBySingle(pf: PFloatArray4);
var
a: PFloatArray4;
begin
if pf = nil then
Exit;
x := pf^[0];
y := pf^[1];
z := pf^[2];
w := pf^[3];
end;
constructor TD3DXVECTOR4.CreateByFloat16(pf: PD3DXFLOAT16);
begin
if pf = nil then
Exit;
D3DXFloat16To32Array(@x, pf, 4);
end;
constructor TD3DXVECTOR4.Create(v: TD3DXVECTOR3; fw: single);
begin
x := v.x;
y := v.y;
z := v.z;
w := fw;
end;
constructor TD3DXVECTOR4.Create(fx, fy, fz, fw: single);
begin
x := fx;
y := fy;
z := fz;
w := fw;
end;
class operator TD3DXVECTOR4.Add(a, b: TD3DXVECTOR4): TD3DXVECTOR4;
begin
Result.x := a.x + b.x;
Result.y := a.y + b.y;
Result.z := a.z + b.z;
Result.w := a.w + b.w;
end;
class operator TD3DXVECTOR4.Subtract(a, b: TD3DXVECTOR4): TD3DXVECTOR4;
begin
Result.x := a.x - b.x;
Result.y := a.y - b.y;
Result.z := a.z - b.z;
Result.w := a.w - b.w;
end;
class operator TD3DXVECTOR4.Multiply(a: TD3DXVECTOR4; b: single): TD3DXVECTOR4;
begin
Result.x := a.x * b;
Result.y := a.y * b;
Result.z := a.z * b;
Result.w := a.w * b;
end;
class operator TD3DXVECTOR4.Divide(a: TD3DXVECTOR4; b: single): TD3DXVECTOR4;
begin
if b = 0 then
Exit;
Result.x := a.x / b;
Result.y := a.y / b;
Result.z := a.z / b;
Result.w := a.w / b;
end;
class operator TD3DXVECTOR4.Positive(a: TD3DXVECTOR4): TD3DXVECTOR4;
begin
Result.x := a.x;
Result.y := a.y;
Result.z := a.z;
Result.w := a.w;
end;
class operator TD3DXVECTOR4.Negative(a: TD3DXVECTOR4): TD3DXVECTOR4;
begin
Result.x := -a.x;
Result.y := -a.y;
Result.z := -a.z;
Result.w := -a.w;
end;
class operator TD3DXVECTOR4.Equal(a, b: TD3DXVECTOR4): longbool;
begin
Result := (a.x = b.x) and (a.y = b.y) and (a.z = b.z) and (a.w = b.w);
end;
class operator TD3DXVECTOR4.NotEqual(a, b: TD3DXVECTOR4): longbool;
begin
Result := (a.x <> b.x) or (a.y <> b.y) or (a.z <> b.z) or (a.w <> b.w);
end;
{ TD3DXVECTOR3_16F }
constructor TD3DXVECTOR3_16F.CreateBySingle(pf: PFloatArray3);
begin
if pf = nil then
Exit;
D3DXFloat32To16Array(@x, PSingle(pf), 3);
end;
constructor TD3DXVECTOR3_16F.Create(v: TD3DXVECTOR3);
begin
D3DXFloat32To16Array(@x, @v.x, 1);
D3DXFloat32To16Array(@y, @v.y, 1);
D3DXFloat32To16Array(@z, @v.z, 1);
end;
constructor TD3DXVECTOR3_16F.CreateByFloat16(pf: PD3DXFLOAT16);
var
{$IFDEF FPC}
lTemp: array [0 .. 2] of TD3DXFLOAT16;
{$ELSE}
lTemp: PD3DXFLOAT16ARRAY3;
{$ENDIF}
begin
if (pf = nil) then
Exit;
{$IFDEF FPC}
lTemp := pf;
x.Value := UINT(lTemp[0].Value);
y.Value := UINT(lTemp[1].Value);
z.Value := word(lTemp[2].Value);
{$ELSE}
lTemp := PD3DXFLOAT16ARRAY3(pf);
x.Value := UINT(lTemp^[0].Value);
y.Value := UINT(lTemp^[1].Value);
z.Value := word(lTemp^[2].Value);
{$ENDIF}
end;
constructor TD3DXVECTOR3_16F.Create(fx, fy, fz: TD3DXFLOAT16);
begin
x := fx;
y := fy;
z := fz;
end;
class operator TD3DXVECTOR3_16F.Equal(a, b: TD3DXVECTOR3_16F): longbool;
begin
Result := (a.x = b.y) and (a.y = b.y) and (a.z = b.z);
end;
class operator TD3DXVECTOR3_16F.NotEqual(a, b: TD3DXVECTOR3_16F): longbool;
begin
Result := (a.x <> b.y) or (a.y <> b.y) or (a.z <> b.z);
end;
{ TD3DXVECTOR2_16F }
constructor TD3DXVECTOR2_16F.CreateBySingle(pf: PFloatArray2);
begin
if pf = nil then
Exit;
D3DXFloat32To16Array(@x, PSingle(pf), 2);
end;
constructor TD3DXVECTOR2_16F.CreateByFloat16(pf: PD3DXFLOAT16ARRAY2);
begin
if (pf = nil) then
Exit;
x.Value := pf^[0].Value;
y.Value := pf^[1].Value;
end;
constructor TD3DXVECTOR2_16F.Create(ix, iy: TD3DXFLOAT16);
begin
x := ix;
y := iy;
end;
class operator TD3DXVECTOR2_16F.Equal(a, b: TD3DXVECTOR2_16F): longbool;
begin
Result := (a.x = b.x) and (a.y = b.y);
end;
class operator TD3DXVECTOR2_16F.NotEqual(a, b: TD3DXVECTOR2_16F): longbool;
begin
Result := (a.x <> b.x) or (a.y <> b.y);
end;
{ TD3DXVECTOR2 }
constructor TD3DXVECTOR2.Create(ix, iy: single);
begin
x := ix;
y := iy;
end;
constructor TD3DXVECTOR2.Create(pf: PFloatArray2);
begin
if pf = nil then
Exit;
x := pf^[0];
y := pf^[1];
end;
constructor TD3DXVECTOR2.Create(f: PD3DXFLOAT16);
begin
if f = nil then
Exit;
D3DXFloat16To32Array(@x, f, 2);
end;
class operator TD3DXVECTOR2.Add(a, b: TD3DXVECTOR2): TD3DXVECTOR2;
begin
Result.x := a.x + b.x;
Result.y := a.y + b.y;
end;
class operator TD3DXVECTOR2.Subtract(a, b: TD3DXVECTOR2): TD3DXVECTOR2;
begin
Result.x := a.x - b.x;
Result.y := a.y - b.y;
end;
class operator TD3DXVECTOR2.Multiply(a: TD3DXVECTOR2; b: single): TD3DXVECTOR2;
begin
Result.x := a.x * b;
Result.y := a.y * b;
end;
class operator TD3DXVECTOR2.Divide(a: TD3DXVECTOR2; b: single): TD3DXVECTOR2;
begin
if b = 0 then
Exit;
Result.x := a.x / b;
Result.y := a.y / b;
end;
class operator TD3DXVECTOR2.Positive(a: TD3DXVECTOR2): TD3DXVECTOR2;
begin
Result := a;
end;
class operator TD3DXVECTOR2.Negative(a: TD3DXVECTOR2): TD3DXVECTOR2;
begin
Result.x := -a.x;
Result.y := -a.y;
end;
class operator TD3DXVECTOR2.Equal(a, b: TD3DXVECTOR2): longbool;
begin
Result := (a.x = b.x) and (a.y = b.y);
end;
class operator TD3DXVECTOR2.NotEqual(a, b: TD3DXVECTOR2): longbool;
begin
Result := (a.x <> b.x) or (a.y <> b.y);
end;
procedure TD3DXVECTOR2.Init(lx, ly: single);
begin
x := lx;
y := ly;
end;
{ TD3DXVECTOR3 }
constructor TD3DXVECTOR3.Create(fx, fy, fz: single);
begin
x := fx;
y := fy;
z := fz;
end;
constructor TD3DXVECTOR3.CreateBySingle(f: PFloatArray3);
begin
if f = nil then
Exit;
x := f[0];
y := f[1];
z := f[2];
end;
constructor TD3DXVECTOR3.Create(v: TD3DXVECTOR3);
begin
x := v.x;
y := v.y;
z := v.z;
end;
constructor TD3DXVECTOR3.CreateByFloat16(pf: PD3DXFLOAT16);
begin
if (pf = nil) then
Exit;
D3DXFloat16To32Array(@x, pf, 3);
end;
class operator TD3DXVECTOR3.Add(a, b: TD3DXVECTOR3): TD3DXVECTOR3;
begin
Result.x := a.x + b.x;
Result.y := a.y + b.y;
Result.z := a.z + b.z;
end;
class operator TD3DXVECTOR3.Subtract(a, b: TD3DXVECTOR3): TD3DXVECTOR3;
begin
Result.x := a.x - b.x;
Result.y := a.y - b.y;
Result.z := a.z - b.z;
end;
class operator TD3DXVECTOR3.Multiply(a: TD3DXVECTOR3; b: single): TD3DXVECTOR3;
begin
Result.x := a.x * b;
Result.y := a.y * b;
Result.z := a.z * b;
end;
class operator TD3DXVECTOR3.Divide(a: TD3DXVECTOR3; b: single): TD3DXVECTOR3;
begin
if b = 0 then
Exit;
Result.x := a.x / b;
Result.y := a.y / b;
Result.z := a.z / b;
end;
class operator TD3DXVECTOR3.Positive(a: TD3DXVECTOR3): TD3DXVECTOR3;
begin
Result.x := a.x;
Result.y := a.y;
Result.z := a.z;
end;
class operator TD3DXVECTOR3.Negative(a: TD3DXVECTOR3): TD3DXVECTOR3;
begin
Result.x := -a.x;
Result.y := -a.y;
Result.z := -a.z;
end;
class operator TD3DXVECTOR3.Equal(a, b: TD3DXVECTOR3): longbool;
begin
Result := (a.x = b.x) and (a.y = b.y) and (a.z = b.z);
end;
class operator TD3DXVECTOR3.NotEqual(a, b: TD3DXVECTOR3): longbool;
begin
Result := (a.x <> b.x) or (a.y <> b.y) or (a.z <> b.z);
end;
procedure TD3DXVECTOR3.Init(lx, ly, lz: single);
begin
x := lx;
y := ly;
z := lz;
end;
{ TD3DXFLOAT16 }
class operator TD3DXFLOAT16.Equal(a, b: TD3DXFLOAT16): longbool;
begin
// At least one is NaN
if ((((a.Value and D3DX_16F_EXP_MASK) = D3DX_16F_EXP_MASK) and ((a.Value and D3DX_16F_FRAC_MASK) = D3DX_16F_FRAC_MASK)) or
(((b.Value and D3DX_16F_EXP_MASK) = D3DX_16F_EXP_MASK) and ((b.Value and D3DX_16F_FRAC_MASK) = D3DX_16F_FRAC_MASK))) then
Result := False
// +/- Zero
else if (((a.Value and not D3DX_16F_SIGN_MASK) = 0) and ((b.Value and not D3DX_16F_SIGN_MASK) = 0)) then
Result := True
else
Result := (a.Value = b.Value);
end;
class operator TD3DXFLOAT16.NotEqual(a, b: TD3DXFLOAT16): longbool;
begin
// At least one is NaN
if ((((a.Value and D3DX_16F_EXP_MASK) = D3DX_16F_EXP_MASK) and ((a.Value and D3DX_16F_FRAC_MASK) = D3DX_16F_FRAC_MASK)) or
(((b.Value and D3DX_16F_EXP_MASK) = D3DX_16F_EXP_MASK) and ((b.Value and D3DX_16F_FRAC_MASK) = D3DX_16F_FRAC_MASK))) then
Result := True
// +/- Zero
else if (((a.Value and not D3DX_16F_SIGN_MASK) = 0) and ((b.Value and not D3DX_16F_SIGN_MASK) = 0)) then
Result := False
else
Result := (a.Value <> b.Value);
end;
class operator TD3DXFLOAT16.Implicit(a: single): TD3DXFLOAT16;
begin
D3DXFloat32To16Array(@Result, @a, 1);
end;
class operator TD3DXFLOAT16.Explicit(a: TD3DXFLOAT16): single;
begin
D3DXFloat16To32Array(@Result, @a, 1);
end;
constructor TD3DXFLOAT16.Create(f: single);
begin
D3DXFloat32To16Array(@Value, @f, 1);
end;
constructor TD3DXFLOAT16.Create(f: TD3DXFLOAT16);
begin
Value := f.Value;
end;
{ TD3DXQUATERNION }
class operator TD3DXQUATERNION.Add(a, b: TD3DXQUATERNION): TD3DXQUATERNION;
begin
Result.x := a.x + b.x;
Result.y := a.y + b.y;
Result.z := a.z + b.z;
Result.w := a.w + b.w;
end;
constructor TD3DXQUATERNION.Create(fx, fy, fz, fw: single);
begin
x := fx;
y := fy;
z := fz;
w := fw;
end;
constructor TD3DXQUATERNION.CreateByFloat16(pf: PD3DXFLOAT16);
begin
if pf = nil then
Exit;
D3DXFloat16To32Array(@x, pf, 4);
end;
constructor TD3DXQUATERNION.CreateBySingle(pf: PFloatArray4);
begin
if pf = nil then
Exit;
x := pf^[0];
y := pf^[1];
z := pf^[2];
w := pf^[3];
end;
class operator TD3DXQUATERNION.Divide(a: TD3DXQUATERNION; b: single): TD3DXQUATERNION;
begin
Result.x := a.x / b;
Result.y := a.y / b;
Result.z := a.z / b;
Result.w := a.w / b;
end;
class operator TD3DXQUATERNION.Equal(a, b: TD3DXQUATERNION): longbool;
begin
Result := (a.x = b.x) and (a.y = b.y) and (a.z = b.z) and (a.w = b.w);
end;
class operator TD3DXQUATERNION.Multiply(a: TD3DXQUATERNION; b: single): TD3DXQUATERNION;
begin
Result.x := a.x * b;
Result.y := a.y * b;
Result.z := a.z * b;
Result.w := a.w * b;
end;
class operator TD3DXQUATERNION.Multiply(a, b: TD3DXQUATERNION): TD3DXQUATERNION;
begin
D3DXQuaternionMultiply(@Result, @a, @b);
end;
class operator TD3DXQUATERNION.Negative(a: TD3DXQUATERNION): TD3DXQUATERNION;
begin
Result.x := -a.x;
Result.y := -a.y;
Result.z := -a.z;
Result.w := -a.w;
end;
class operator TD3DXQUATERNION.NotEqual(a, b: TD3DXQUATERNION): longbool;
begin
Result := (a.x <> b.x) or (a.y <> b.y) or (a.z <> b.z) or (a.w <> b.w);
end;
class operator TD3DXQUATERNION.Positive(a: TD3DXQUATERNION): TD3DXQUATERNION;
begin
Result.x := a.x;
Result.y := a.y;
Result.z := a.z;
Result.w := a.w;
end;
class operator TD3DXQUATERNION.Subtract(a, b: TD3DXQUATERNION): TD3DXQUATERNION;
begin
Result.x := a.x - b.x;
Result.y := a.y - b.y;
Result.z := a.z - b.z;
Result.w := a.w - b.w;
end;
// --------------------------
// 4D Matrix
// --------------------------
function D3DXVec2Length(const pV: PD3DXVECTOR2): single;
begin
Result := 0.0;
if (pV = nil) then
Exit;
Result := sqrt(pV.x * pV.x + pV.y * pV.y);
end;
function D3DXVec2LengthSq(const pV: PD3DXVECTOR2): single;
begin
Result := 0.0;
if (pV = nil) then
Exit;
Result := pV.x * pV.x + pV.y * pV.y;
end;
function D3DXVec2Dot(const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2): single;
begin
Result := 0.0;
if (pV1 = nil) or (pV2 = nil) then
Exit;
Result := pV1.x * pV2.x + pV1.y * pV2.y;
end;
function D3DXVec2CCW(const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2): single;
begin
Result := 0.0;
if (pV1 = nil) or (pV2 = nil) then
Exit;
Result := pV1.x * pV2.y - pV1.y * pV2.x;
end;
function D3DXVec2Add(pOut: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2): PD3DXVECTOR2;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
pOut.x := pV1.x + pV2.x;
pOut.y := pV1.y + pV2.y;
Result := pOut;
end;
function D3DXVec2Subtract(pOut: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2): PD3DXVECTOR2;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
pOut.x := pV1.x - pV2.x;
pOut.y := pV1.y - pV2.y;
Result := pOut;
end;
function D3DXVec2Minimize(pOut: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2): PD3DXVECTOR2;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
if (pV1.x < pV2.x) then
pOut.x := pV1.x
else
pOut.x := pV2.x;
if (pV1.y < pV2.y) then
pOut.y := pV1.y
else
pOut.y := pV2.y;
Result := pOut;
end;
function D3DXVec2Maximize(pOut: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2): PD3DXVECTOR2;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
if (pV1.x > pV2.x) then
pOut.x := pV1.x
else
pOut.x := pV2.x;
if (pV1.y > pV2.y) then
pOut.y := pV1.y
else
pOut.y := pV2.y;
Result := pOut;
end;
function D3DXVec2Scale(pOut: PD3DXVECTOR2; const pV: PD3DXVECTOR2; s: single): PD3DXVECTOR2;
begin
Result := nil;
if (pOut = nil) or (pV = nil) then
Exit;
pOut.x := pV.x * s;
pOut.y := pV.y * s;
Result := pOut;
end;
function D3DXVec2Lerp(pOut: PD3DXVECTOR2; const pV1: PD3DXVECTOR2; const pV2: PD3DXVECTOR2; s: single): PD3DXVECTOR2;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
pOut.x := pV1.x + s * (pV2.x - pV1.x);
pOut.y := pV1.y + s * (pV2.y - pV1.y);
Result := pOut;
end;
function D3DXVec3Length(const pV: PD3DXVECTOR3): single;
begin
Result := 0.0;
if (pV = nil) then
Exit;
Result := sqrt(pV.x * pV.x + pV.y * pV.y + pV.z * pV.z);
end;
function D3DXVec3LengthSq(const pV: PD3DXVECTOR3): single;
begin
Result := 0.0;
if (pV = nil) then
Exit;
Result := pV.x * pV.x + pV.y * pV.y + pV.z * pV.z;
end;
function D3DXVec3Dot(const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): single;
begin
Result := 0.0;
if (pV1 = nil) or (pV2 = nil) then
Exit;
Result := pV1.x * pV2.x + pV1.y * pV2.y + pV1.z * pV2.z;
end;
function D3DXVec3Cross(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): PD3DXVECTOR3;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
pOut.x := pV1.y * pV2.z - pV1.z * pV2.y;
pOut.y := pV1.z * pV2.x - pV1.x * pV2.z;
pOut.z := pV1.x * pV2.y - pV1.y * pV2.x;
Result := pOut;
end;
function D3DXVec3Add(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): PD3DXVECTOR3;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
pOut.x := pV1.x + pV2.x;
pOut.y := pV1.y + pV2.y;
pOut.z := pV1.z + pV2.z;
Result := pOut;
end;
function D3DXVec3Subtract(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): PD3DXVECTOR3;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
pOut.x := pV1.x - pV2.x;
pOut.y := pV1.y - pV2.y;
pOut.z := pV1.z - pV2.z;
Result := pOut;
end;
function D3DXVec3Minimize(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): PD3DXVECTOR3;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
if (pV1.x < pV2.x) then
pOut.x := pV1.x
else
pOut.x := pV2.x;
if (pV1.y < pV2.y) then
pOut.y := pV1.y
else
pOut.y := pV2.y;
if (pV1.z < pV2.z) then
pOut.z := pV1.z
else
pOut.z := pV2.z;
Result := pOut;
end;
function D3DXVec3Maximize(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3): PD3DXVECTOR3;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
if (pV1.x > pV2.x) then
pOut.x := pV1.x
else
pOut.x := pV2.x;
if (pV1.y > pV2.y) then
pOut.y := pV1.y
else
pOut.y := pV2.y;
if (pV1.z > pV2.z) then
pOut.z := pV1.z
else
pOut.z := pV2.z;
Result := pOut;
end;
function D3DXVec3Scale(pOut: PD3DXVECTOR3; const pV: PD3DXVECTOR3; s: single): PD3DXVECTOR3;
begin
Result := nil;
if (pOut = nil) or (pV = nil) then
Exit;
pOut.x := pV.x * s;
pOut.y := pV.y * s;
pOut.z := pV.z * s;
Result := pOut;
end;
function D3DXVec3Lerp(pOut: PD3DXVECTOR3; const pV1: PD3DXVECTOR3; const pV2: PD3DXVECTOR3; s: single): PD3DXVECTOR3;
begin
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
Result := nil;
pOut.x := pV1.x + s * (pV2.x - pV1.x);
pOut.y := pV1.y + s * (pV2.y - pV1.y);
pOut.z := pV1.z + s * (pV2.z - pV1.z);
Result := pOut;
end;
function D3DXVec4Length(const pV: PD3DXVECTOR4): single;
begin
Result := 0.0;
if (pV = nil) then
Exit;
Result := sqrt(pV.x * pV.x + pV.y * pV.y + pV.z * pV.z + pV.w * pV.w);
end;
function D3DXVec4LengthSq(const pV: PD3DXVECTOR4): single;
begin
Result := 0.0;
if (pV = nil) then
Exit;
Result := pV.x * pV.x + pV.y * pV.y + pV.z * pV.z + pV.w * pV.w;
end;
function D3DXVec4Dot(const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4): single;
begin
Result := 0.0;
if (pV1 = nil) or (pV2 = nil) then
Exit;
Result := pV1.x * pV2.x + pV1.y * pV2.y + pV1.z * pV2.z + pV1.w * pV2.w;
end;
function D3DXVec4Add(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4): PD3DXVECTOR4;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
pOut.x := pV1.x + pV2.x;
pOut.y := pV1.y + pV2.y;
pOut.z := pV1.z + pV2.z;
pOut.w := pV1.w + pV2.w;
Result := pOut;
end;
function D3DXVec4Subtract(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4): PD3DXVECTOR4;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
pOut.x := pV1.x - pV2.x;
pOut.y := pV1.y - pV2.y;
pOut.z := pV1.z - pV2.z;
pOut.w := pV1.w - pV2.w;
Result := pOut;
end;
function D3DXVec4Minimize(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4): PD3DXVECTOR4;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
if (pV1.x < pV2.x) then
pOut.x := pV1.x
else
pOut.x := pV2.x;
if (pV1.y < pV2.y) then
pOut.y := pV1.y
else
pOut.y := pV2.y;
if (pV1.z < pV2.z) then
pOut.z := pV1.z
else
pOut.z := pV2.z;
if (pV1.w < pV2.w) then
pOut.w := pV1.w
else
pOut.w := pV2.w;
Result := pOut;
end;
function D3DXVec4Maximize(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4): PD3DXVECTOR4;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
if (pV1.x > pV2.x) then
pOut.x := pV1.x
else
pOut.x := pV2.x;
if (pV1.y > pV2.y) then
pOut.y := pV1.y
else
pOut.y := pV2.y;
if (pV1.z > pV2.z) then
pOut.z := pV1.z
else
pOut.z := pV2.z;
if (pV1.w > pV2.w) then
pOut.w := pV1.w
else
pOut.w := pV2.w;
Result := pOut;
end;
function D3DXVec4Scale(pOut: PD3DXVECTOR4; const pV: PD3DXVECTOR4; s: single): PD3DXVECTOR4;
begin
Result := nil;
if (pOut = nil) or (pV = nil) then
Exit;
pOut.x := pV.x * s;
pOut.y := pV.y * s;
pOut.z := pV.z * s;
pOut.w := pV.w * s;
Result := pOut;
end;
function D3DXVec4Lerp(pOut: PD3DXVECTOR4; const pV1: PD3DXVECTOR4; const pV2: PD3DXVECTOR4; s: single): PD3DXVECTOR4;
begin
Result := nil;
if (pOut = nil) or (pV1 = nil) or (pV2 = nil) then
Exit;
pOut.x := pV1.x + s * (pV2.x - pV1.x);
pOut.y := pV1.y + s * (pV2.y - pV1.y);
pOut.z := pV1.z + s * (pV2.z - pV1.z);
pOut.w := pV1.w + s * (pV2.w - pV1.w);
Result := pOut;
end;
function D3DXPlaneDot(const pP: PD3DXPLANE; const pV: PD3DXVECTOR4): single;
begin
Result := 0.0;
if (pP = nil) or (pV = nil) then
Exit;
Result := pP.a * pV.x + pP.b * pV.y + pP.c * pV.z + pP.d * pV.w;
end;
function D3DXPlaneDotCoord(const pP: PD3DXPLANE; const pV: PD3DXVECTOR3): single;
begin
Result := 0.0;
if (pP = nil) or (pV = nil) then
Exit;
Result := pP.a * pV.x + pP.b * pV.y + pP.c * pV.z + pP.d;
end;
function D3DXPlaneDotNormal(const pP: PD3DXPLANE; const pV: PD3DXVECTOR3): single;
begin
Result := 0.0;
if (pP = nil) or (pV = nil) then
Exit;
Result := pP.a * pV.x + pP.b * pV.y + pP.c * pV.z;
end;
function D3DXPlaneScale(pOut: PD3DXPLANE; const pP: PD3DXPLANE; s: single): PD3DXPLANE;
begin
Result := nil;
if (pOut = nil) or (pP = nil) then
Exit;
pOut.a := pP.a * s;
pOut.b := pP.b * s;
pOut.c := pP.c * s;
pOut.d := pP.d * s;
Result := pOut;
end;
function D3DXColorNegative(pOut: PD3DXCOLOR; const pC: PD3DXCOLOR): PD3DXCOLOR;
begin
Result := nil;
if (pOut = nil) or (pC = nil) then
Exit;
pOut.r := 1.0 - pC.r;
pOut.g := 1.0 - pC.g;
pOut.b := 1.0 - pC.b;
pOut.a := pC.a;
Result := pOut;
end;
function D3DXColorAdd(pOut: PD3DXCOLOR; const pC1: PD3DXCOLOR; const pC2: PD3DXCOLOR): PD3DXCOLOR;
begin
Result := nil;
if (pOut = nil) or (pC1 = nil) or (pC2 = nil) then
Exit;
pOut.r := pC1.r + pC2.r;
pOut.g := pC1.g + pC2.g;
pOut.b := pC1.b + pC2.b;
pOut.a := pC1.a + pC2.a;
Result := pOut;
end;
function D3DXColorSubtract(pOut: PD3DXCOLOR; const pC1: PD3DXCOLOR; const pC2: PD3DXCOLOR): PD3DXCOLOR;
begin
Result := nil;
if (pOut = nil) or (pC1 = nil) or (pC2 = nil) then
Exit;
pOut.r := pC1.r - pC2.r;
pOut.g := pC1.g - pC2.g;
pOut.b := pC1.b - pC2.b;
pOut.a := pC1.a - pC2.a;
Result := pOut;
end;
function D3DXColorScale(pOut: PD3DXCOLOR; const pC: PD3DXCOLOR; s: single): PD3DXCOLOR;
begin
Result := nil;
if (pOut = nil) or (pC = nil) then
Exit;
pOut.r := pC.r * s;
pOut.g := pC.g * s;
pOut.b := pC.b * s;
pOut.a := pC.a * s;
Result := pOut;
end;
function D3DXColorModulate(pOut: PD3DXCOLOR; const pC1: PD3DXCOLOR; const pC2: PD3DXCOLOR): PD3DXCOLOR;
begin
Result := nil;
if (pOut = nil) or (pC1 = nil) or (pC2 = nil) then
Exit;
pOut.r := pC1.r * pC2.r;
pOut.g := pC1.g * pC2.g;
pOut.b := pC1.b * pC2.b;
pOut.a := pC1.a * pC2.a;
Result := pOut;
end;
function D3DXColorLerp(pOut: PD3DXCOLOR; const pC1: PD3DXCOLOR; const pC2: PD3DXCOLOR; s: single): PD3DXCOLOR;
begin
Result := nil;
if (pOut = nil) or (pC1 = nil) or (pC2 = nil) then
Exit;
pOut.r := pC1.r + s * (pC2.r - pC1.r);
pOut.g := pC1.g + s * (pC2.g - pC1.g);
pOut.b := pC1.b + s * (pC2.b - pC1.b);
pOut.a := pC1.a + s * (pC2.a - pC1.a);
Result := pOut;
end;
function D3DXMatrixIdentity(pOut: PD3DXMATRIX): PD3DXMATRIX;
begin
Result := nil;
if (pOut = nil) then
Exit;
pOut.m[0, 1] := 0.0;
pOut.m[0, 2] := 0.0;
pOut.m[0, 3] := 0.0;
pOut.m[1, 0] := 0.0;
pOut.m[1, 2] := 0.0;
pOut.m[1, 3] := 0.0;
pOut.m[2, 0] := 0.0;
pOut.m[2, 1] := 0.0;
pOut.m[2, 3] := 0.0;
pOut.m[3, 0] := 0.0;
pOut.m[3, 1] := 0.0;
pOut.m[3, 2] := 0.0;
pOut.m[0, 0] := 1.0;
pOut.m[1, 1] := 1.0;
pOut.m[2, 2] := 1.0;
pOut.m[3, 3] := 1.0;
Result := pOut;
end;
function D3DXMatrixIsIdentity(pM: PD3DXMATRIX): longbool;
begin
Result := False;
if (pM = nil) then
Exit;
Result := (pM.m[0][0] = 1.0) and (pM.m[0][1] = 0.0) and (pM.m[0][2] = 0.0) and (pM.m[0][3] = 0.0) and
(pM.m[1][0] = 0.0) and (pM.m[1][1] = 1.0) and (pM.m[1][2] = 0.0) and (pM.m[1][3] = 0.0) and (pM.m[2][0] = 0.0) and
(pM.m[2][1] = 0.0) and (pM.m[2][2] = 1.0) and (pM.m[2][3] = 0.0) and (pM.m[3][0] = 0.0) and (pM.m[3][1] = 0.0) and
(pM.m[3][2] = 0.0) and (pM.m[3][3] = 1.0);
end;
// --------------------------
// Quaternion
// --------------------------
function D3DXQuaternionLength(pQ: PD3DXQUATERNION): single;
begin
Result := 0;
if (pQ = nil) then
Exit;
Result := sqrt(pQ.x * pQ.x + pQ.y * pQ.y + pQ.z * pQ.z + pQ.w * pQ.w);
end;
// Length squared, or "norm"
function D3DXQuaternionLengthSq(pQ: PD3DXQUATERNION): single;
begin
Result := 0;
if (pQ = nil) then
Exit;
Result := (pQ.x * pQ.x + pQ.y * pQ.y + pQ.z * pQ.z + pQ.w * pQ.w);
end;
function D3DXQuaternionDot(pQ1: PD3DXQUATERNION; pQ2: PD3DXQUATERNION): single;
begin
Result := 0;
if (pQ1 = nil) or (pQ2 = nil) then
Exit;
Result := pQ1.x * pQ2.x + pQ1.y * pQ2.y + pQ1.z * pQ2.z + pQ1.w * pQ2.w;
end;
// (0, 0, 0, 1)
function D3DXQuaternionIdentity(pOut: PD3DXQUATERNION): PD3DXQUATERNION;
begin
Result := nil;
if (pOut = nil) then
Exit;
pOut.x := 0.0;
pOut.y := 0.0;
pOut.z := 0.0;
pOut.w := 1.0;
Result := pOut;
end;
function D3DXQuaternionIsIdentity(pQ: PD3DXQUATERNION): longbool;
begin
Result := False;
if (pQ = nil) then
Exit;
Result := (pQ.x = 0.0) and (pQ.y = 0.0) and (pQ.z = 0.0) and (pQ.w = 1.0);
end;
// (-x, -y, -z, w)
function D3DXQuaternionConjugate(pOut: PD3DXQUATERNION; pQ: PD3DXQUATERNION): PD3DXQUATERNION;
begin
Result := nil;
if (pOut = nil) or (pQ = nil) then
Exit;
pOut.x := -pQ.x;
pOut.y := -pQ.y;
pOut.z := -pQ.z;
pOut.w := pQ.w;
Result := pOut;
end;
{$ELSE}
implementation
{$ENDIF}
end.
| 32.98571 | 149 | 0.681574 |
83fb7794d66e8555151c2f66f00ee152757b9188 | 18,563 | pas | Pascal | test3.pas | Vaddix1394/Tes5Edit-Scripting | 872cc2093f9085314042e421ffcd169212d13cfa | [
"MIT"
]
| 1 | 2018-04-12T13:35:09.000Z | 2018-04-12T13:35:09.000Z | test3.pas | Vaddix1394/Tes5Edit-Scripting | 872cc2093f9085314042e421ffcd169212d13cfa | [
"MIT"
]
| null | null | null | test3.pas | Vaddix1394/Tes5Edit-Scripting | 872cc2093f9085314042e421ffcd169212d13cfa | [
"MIT"
]
| null | null | null | {
New script template, only shows processed records
Assigning any nonzero value to Result will terminate script
}
unit userscript;
uses mteFunctions;
uses userUtilities;
const
target_filename = 'Angry Wenches.esp';
num_entries_in_lvln = 1;
no_faction_limit = True;
var
target_file : IInterface;
slMasters, slRaces, slFactions, slVampireKeywords, exemplarToFakerKey, slFactionsNoRestrictions : TStringList;
lvlList, exemplarToFakerValue, lvlListNoFactions : TList;
//---------------------------------------------------------------------------------------
// File IO
//---------------------------------------------------------------------------------------
procedure getUserFile;
begin
target_file := getOrCreateFile(target_filename);
if not Assigned(target_file) then begin
AddMessage('File not created or retrieved!');
Exit;
end;
AddMastersToFile(target_file, slMasters, True);
//AddMastersMine(target_file, slMasters);
end;
//---------------------------------------------------------------------------------------
// Tes5Edit Manipulation
//---------------------------------------------------------------------------------------
function getTargetFaction(npc : IInterface) : IInterface;
var
i, j : integer;
factions, faction : IInterface;
begin
factions := ElementByName(npc, 'Factions');
for i:= 0 to Pred(ElementCount(factions)) do begin
faction := ElementByIndex(factions, i);
faction := LinksTo(ElementByPath(faction, 'Faction'));
for j := 0 to slFactions.Count-1 do begin
if EditorID(faction) = slFactions[j] then
Result := slFactions[j];
end;
end;
end;
function getBaseRaceFromVampire(src: IInterface) : IInterface;
var
race_rec, race_rec2 : IInterface;
race, race2 : integer;
begin
// Sets npc's race to non-vampire race. Using keywords instead like Alva's record
race_rec: = LinksTo(ElementBySignature(src, 'RNAM'));
race := slRaces.IndexOf(EditorID(race_rec));
if race <> -1 then begin
AddMessage('Standard race: ' + EditorID(race_rec));
Exit;
end;
// Get non-vampire race record from morph race attribute
race_rec2 := LinksTo(ElementBySignature(race_rec, 'NAM8'));
race2 := slRaces.IndexOf(EditorID(race_rec2));
if race2 = -1 then begin
AddMessage('Not a vampire: '+ EditorID(race_rec) + ' : ' + EditorID(race_rec2));
Exit;
end;
Result := race_rec2;
end;
// Checks DW's leveled list overrides and returns the winning override before DW
// i.e. skyim | dragonborn | Deadly wenches
// returns ^
function getTargetLeveledListOverride(elem : IInterface): IInterface;
var
i : integer;
cur_ovr, next_ovr, m : IInterface;
s : string;
begin
if not Assigned(elem) then begin
AddMessage('getTargetLeveledListOverride: input "elem" not assigned.');
Exit;
end;
m := MasterOrSelf(elem);
cur_ovr := m;
//AddMessage(EditorID(elem));
for i := 0 to Pred(OverrideCount(m)) do begin
next_ovr := OverrideByIndex(m, i);
s := Name(GetFile(next_ovr));
if SameText(GetFileName(GetFile(next_ovr)), 'deadly wenches.esp') then
Break;
cur_ovr := next_ovr;
end;
Result := cur_ovr;
end;
//---------------------------------------------------------------------------------------
// Template Selection
//---------------------------------------------------------------------------------------
// Check if valid template (NPC must have all facegen entries to be a template)
function isValidFaceTemplate(npc : IInterface): boolean;
var
temp : boolean;
begin
temp := ElementExists(npc, 'Head Parts');
temp := ElementExists(npc, 'QNAM - Texture lighting') and temp;
temp := ElementExists(npc, 'NAM9 - Face morph') and temp;
temp := ElementExists(npc, 'NAMA - Face parts') and temp;
temp := ElementExists(npc, 'Tint Layers') and temp;
Result := temp;
end;
procedure createRaceFactionLists;
begin
if not no_faction_limit then begin
createRaceFactionListsWithFactionRestrictions;
end else begin
createRaceFactionListsWithNoFactionRestrictions;
end;
end;
procedure createRaceFactionListsWithFactionRestrictions;
var
i, j : integer;
lvln_rec : IInterface;
s : string;
begin
for i := 0 to slRaces.Count-1 do begin
for j := 0 to slFactions.Count-1 do begin
s := 'AW_lvln_' + slRaces[i] + '_' + slFactions[j];
lvln_rec := createLeveledList(target_file, s);
if not Assigned(lvln_rec) then begin
AddMessage('LVLN File not created: ' + slRaces[i] + ' | ' + slFactions[j]);
Exit;
end;
TList(lvlList[i]).Add(lvln_rec);
end;
end;
end;
procedure createRaceFactionListsWithNoFactionRestrictions;
var
i, j : integer;
lvln_rec : IInterface;
s : string;
begin
for i := 0 to slRaces.Count-1 do begin
for j := 0 to slFactionsNoRestrictions.Count-1 do begin
s := 'AW_lvln_' + slRaces[i] + '_' + slFactionsNoRestrictions[j];
lvln_rec := createLeveledList(target_file, s);
if not Assigned(lvln_rec) then begin
AddMessage('LVLN File not created: ' + slRaces[i] + ' | ' + slFactionsNoRestrictions[j]);
Exit;
end;
TList(lvlList[i]).Add(lvln_rec);
end;
end;
end;
procedure addTemplatesToRaceFactionLists;
var
i, race, faction : integer;
npcs, npc, template_npc : IInterface;
race_rec, lvln_rec : IInterface;
template_file : IInterface;
race_list : TList;
vampire : integer;
begin
template_file := getOrCreateFile('Deadly Wenches.esp');
npcs := GroupBySignature(template_file, 'NPC_');
for i := 0 to Pred(ElementCount(npcs)) do begin
npc := ElementByIndex(npcs, i);
template_npc := LinksTo(ElementByPath(npc, 'TPLT'));
if not Assigned(template_npc) then Continue;
//BuildRef(template_npc);
// skips records not from IW
if not SameText(Lowercase(GetFileName(GetFile(template_npc))), 'immersive wenches.esp') then
Continue;
// skip records without valid face templates
if not isValidFaceTemplate(template_npc) then Continue;
// Ignore non-target factions
faction := slFactions.IndexOf(getTargetFaction(npc));
if faction = -1 then Continue;
// Ignore non-target races
race := slRaces.IndexOf(EditorID(LinksTo(ElementBySignature(npc, 'RNAM'))));
//if faction = slFactions.IndexOf('VampireFaction') then begin
// race := slRaces.IndexOf(EditorID(getBaseRaceFromVampire(npc)));
//end;
if race = -1 then Continue;
// Get corresponding lvln record
race_list := TList(lvlList[race]);
if not no_faction_limit then begin
lvln_rec := ObjectToElement(race_list[faction]);
end else begin
if SameText(GetTargetFaction(npc), 'VampireFaction') then vampire := 1 else vampire := 0;
lvln_rec := ObjectToElement(race_list[vampire])
end;
if not Assigned(lvln_rec) then begin
AddMessage('addTemplatesToRaceFactionLists: Warning! Did not retrieve lvln record');
Exit;
end;
AddLeveledListEntry(lvln_rec, 1, template_npc, 1);
//AddMessage(EditorID(lvln_rec) + ' | ' + EditorID(npc) + ' | ' + EditorID(template_npc));
//AddMessage(EditorID(lvln_rec));
end;
end;
//---------------------------------------------------------------------------------------
// Exemplar Logic
//---------------------------------------------------------------------------------------
procedure getLevedListStats(lvln : IInterface);
var
llct : IInterface;
begin
llct := GetElementNativeValues(lvln, 'LLCT');
if llct = 0 then AddMessage('LVLN: ' + EditorID(lvln) + ' has 0 LLCT');
end;
function getLevedListForFaker(faker : IInterface) : IInterface;
var
faction, race, vampire : integer;
tar_lvln : IInterface;
race_lvlList : TList;
begin
if not Assigned(faker) then begin
AddMessage('Warning! Faker is unassigned.');
Exit;
end;
// Ignore non-target factions
faction := slFactions.IndexOf(getTargetFaction(faker));
if faction = -1 then Exit;
// Ignore non-target races
if SameText(getTargetFaction(faker), 'VampireFaction') then begin
race := slRaces.IndexOf(EditorID(getBaseRaceFromVampire(faker)));
end else begin
race := slRaces.IndexOf(EditorID(LinksTo(ElementBySignature(faker, 'RNAM'))));
end;
if race = -1 then Exit;
//getFakerStats(faker);
// Get leveled list
race_lvlList := TList(lvlList[race]);
//tar_lvln := ObjectToElement(race_lvlList[faction]);
if not no_faction_limit then begin
tar_lvln := ObjectToElement(race_lvlList[faction]);
end else begin
if SameText(GetTargetFaction(faker), 'VampireFaction') then vampire := 1 else vampire := 0;
tar_lvln := ObjectToElement(race_lvlList[vampire])
end;
if not Assigned(tar_lvln) then begin
AddMessage('tar_lvln is not assigned.');
Exit;
end;
getLevedListStats(tar_lvln);
Result := tar_lvln;
end;
procedure getFakerStats(faker : IInterface);
begin
AddMessage(EditorID(faker));
AddMessage('>>Faction: ' + getTargetFaction(faker));
AddMessage('>>RaceB: ' + EditorID(LinksTo(ElementBySignature(faker, 'RNAM'))));
AddMessage('>>RaceV: ' + EditorID(getBaseRaceFromVampire(faker)));
end;
procedure handleVampireFakers(faker : IInterface);
var
race_rec : IInterface;
s : string;
begin
if not Assigned(faker) then begin
AddMessage('Warning! Faker is unassigned.');
Exit;
end;
if not SameText(getTargetFaction(faker), 'VampireFaction') then Exit;
// Set race to non-vampire race
s := 'RNAM';
race_rec := getBaseRaceFromVampire(faker);
SetEditValue(ElementByPath(faker, s), Name(race_rec));
// Assign keywords to handle not being a "vampire" race
addKeyword(faker, slVampireKeywords);
end;
function getNameFromExemplarTemplate(exemplar : IInterface) : string;
var
cur_rec : IInterface;
hasParent : boolean;
begin
cur_rec := exemplar;
hasParent := false;
repeat
if Assigned(ElementBySignature(cur_rec, 'FULL')) then
Break;
hasParent := Assigned(ElementBySignature(cur_rec, 'TPLT'));
cur_rec := LinksTo(ElementBySignature(cur_rec, 'TPLT'));
until not hasParent;
if Assigned(ElementBySignature(cur_rec, 'FULL')) then
Result := GetElementEditValues(cur_rec, 'FULL');
end;
function createFakerFromExemplar(exemplar : IInterface) : IInterface;
var
faker, lvln : IInterface;
s : string;
begin
if not Assigned(exemplar) then begin
AddMessage('Warning! Exemplar is unassigned.');
Exit;
end;
faker := wbCopyElementToFile(exemplar, target_file, true, true);
if not Assigned(faker) then begin
AddMessage('Warning! Faker not copied from exemplar');
end;
s := 'EDID';
SetElementEditValues(faker, 'EDID', 'AW_' + GetElementEditValues(exemplar, 'EDID'));
s := 'FULL';
//SetElementEditValues(faker, 'FULL', getNameFromExemplarTemplate(exemplar));
SetElementEditValues(faker, 'FULL', 'AW_' + GetElementEditValues(exemplar, 'EDID'));
// Use only the traits (i.e. appearance) from the template
s := 'ACBS\Template Flags';
SetElementNativeValues(faker, s, $0001); // Only use leveled lists traits
// Set template to the lvln for "template" appearances
s := 'TPLT';
lvln := getLevedListForFaker(faker);
SetEditValue(ElementByPath(faker, s), Name(lvln));
// Handle Faction-related issues
handleVampireFakers(faker);
// Add faker to exemplarToFaker map
exemplarToFakerKey.Add(EditorID(exemplar));
//AddMessage('+++' + EditorID(exemplar));
exemplarToFakerValue.Add(faker);
Result := faker;
end;
function getFakerFromExemplar(exemplar : IInterface) : IInterface;
var
tar_index : integer;
faker : IInterface;
begin
if not Assigned(exemplar) then begin
AddMessage('Warning! Exemplar is unassigned.');
Exit;
end;
// Retrieve existing faker or create a new one if no fakers
tar_index := exemplarToFakerKey.IndexOf(EditorID(exemplar));
if tar_index=-1 then begin
//AddMessage('Creating Faker...');
faker := createFakerFromExemplar(exemplar);
end else begin
//AddMessage('Retrieving Faker...');
faker := ObjectToElement(exemplarToFakerValue[tar_index]);
end;
if not (SameText('AW_' + EditorID(exemplar), EditorID(faker))) then begin
AddMessage('Mismatch: ');
AddMessage('+Exemplar: ' + EditorID(exemplar));
AddMessage('+Faker : ' + EditorID(faker));
end;
Result := faker;
end;
procedure createExemplarsFromLeveledList(m : IInterface);
var
i, j : integer;
lvln_ents, lvln_ent, exemplar : IInterface;
new_override, faker : IInterface;
isEdited : boolean;
begin
// Iterate through all leveled list entries
isEdited := false;
lvln_ents := ElementByName(m, 'Leveled List Entries');
for i := 0 to Pred(ElementCount(lvln_ents)) do begin
lvln_ent := ElementByIndex(lvln_ents, i);
exemplar := LinksTo(ElementByPath(lvln_ent, 'LVLO\Reference'));
//AddMessage('===' + EditorID(exemplar) + '===');
// Only make exemplar from female NPCs
if Signature(exemplar) <> 'NPC_' then Continue;
if GetElementNativeValues(exemplar, 'ACBS\Flags') and 1 <> 1 then Continue;
// Create lvln override for new plugin
if not isEdited then begin
new_override := wbCopyElementToFile(m, target_file, False, True);
isEdited := true;
end;
//AddMessage('isExemplar!');
// Get Faker
faker := getFakerFromExemplar(exemplar);
if not Assigned(faker) then begin
AddMessage('Faker not retrieved');
AddMessage('>> Exemplar: ' + EditorID(exemplar));
Exit;
end;
if not (SameText('AW_' + EditorID(exemplar), EditorID(faker))) then begin
AddMessage('Mismatch: ');
AddMessage('+Exemplar: ' + EditorID(exemplar));
AddMessage('+Faker : ' + EditorID(faker));
end;
// For up to global constant, add a lvln entry to the lvln with the same fields as the exemplar
for j := 1 to num_entries_in_lvln do begin
AddLeveledListEntry(new_override, GetElementNativeValues(lvln_ent, 'LVLO\Level'), faker, GetElementNativeValues(lvln_ent, 'LVLO\Count'));
//AddMessage('New Entry:');
//AddMessage('>> LVLN : ' + EditorID(m));
//AddMessage('>> Level : ' + IntToStr(GetElementNativeValues(lvln_ent, 'LVLO\Level')));
//AddMessage('>> EditorID: ' + EditorID(faker));
//AddMessage('>> Count : ' + IntToStr(GetElementNativeValues(lvln_ent, 'LVLO\Count')));
//AddMessage('>> Exemplar: ' + EditorID(exemplar));
end;
end;
end;
procedure addFakers;
var
i : integer;
m_lvln, lvln, lvlns : IInterface;
begin
// Iterate through modified leveled lists from DW
lvlns := getFileElements('deadly wenches.esp', 'LVLN');
for i := 0 to Pred(ElementCount(lvlns)) do begin
lvln := ElementByIndex(lvlns, i);
// Only deal with LVLN that were modified
if IsMaster(lvln) then begin
//AddMessage('Skipped: ' + EditorID(lvln));
Continue;
end;
//AddMessage('Getting override');
m_lvln := getTargetLeveledListOverride(lvln);
//AddMessage('Creating exemplars');
createExemplarsFromLeveledList(m_lvln);
end;
end;
//---------------------------------------------------------------------------------------
// Setup
//---------------------------------------------------------------------------------------
procedure setupGlobalVariables;
var
i : integer;
begin
slMasters := TStringList.Create;
slMasters.Add('Skyrim.esm');
slMasters.Add('Update.esm');
slMasters.Add('Dawnguard.esm');
slMasters.Add('Dragonborn.esm');
slMasters.Add('Unofficial Skyrim Legendary Edition Patch.esp');
slMasters.Add('Immersive Wenches.esp');
slRaces := TStringList.Create;
slRaces.Add('DarkElfRace');
//slRaces.Add('ArgonianRace');
slRaces.Add('BretonRace');
slRaces.Add('HighElfRace');
slRaces.Add('ImperialRace');
//slRaces.Add('KhajiitRace');
slRaces.Add('NordRace');
//slRaces.Add('OrcRace');
slRaces.Add('RedguardRace');
slRaces.Add('WoodElfRace');
//slRaces.Add('NordRaceVampire');
slFactions := TStringList.Create;
slFactions.Add('VampireFaction');
slFactions.Add('BanditFaction');
slFactions.Add('ForswornFaction');
slFactions.Add('VigilantOfStendarrFaction');
slFactions.Add('CWImperialFaction');
slFactions.Add('CWSonsFaction');
// Dawnguard
//
//slFactions.Add('');
slVampireKeywords := TStringList.Create;
slVampireKeywords.Add('00013796'); //ActorTypeUndead
slVampireKeywords.Add('000A82BB'); //Vampire
slFactionsNoRestrictions := TStringList.Create;
slFactionsNoRestrictions.Add('NonVampire');
slFactionsNoRestrictions.Add('Vampire');
lvlList := TList.Create;
for i := 0 to slRaces.Count-1 do begin
lvlList.Add(TList.Create);
end;
lvlListNoFactions := TList.Create;
for i := 0 to slRaces.Count-1 do begin
lvlListNoFactions.Add(TList.Create);
end;
exemplarToFakerKey := TStringList.Create;
exemplarToFakerValue := TList.Create;
end;
procedure freeGlobalVariables;
var
i : integer;
begin
//printStringList(exemplarToFakerKey, 'exemplarToFakerKey');
// arrays first
for i := 0 to slRaces.Count-1 do begin
TList(lvlList[i]).Free;
end;
for i := 0 to slRaces.Count-1 do begin
TList(lvlListNoFactions[i]).Free;
end;
// single variables last
slMasters.Free;
slRaces.Free;
slFactions.Free;
lvlList.Free;
slVampireKeywords.Free;
slFactionsNoRestrictions.Free;
exemplarToFakerKey.Free;
exemplarToFakerValue.Free;
end;
//---------------------------------------------------------------------------------------
// Required Tes5Edit Script Functions
//---------------------------------------------------------------------------------------
// Called before processing
// You can remove it if script doesn't require initialization code
function Initialize: integer;
begin
setupGlobalVariables;
getUserFile;
createRaceFactionLists;
addTemplatesToRaceFactionLists;
addFakers;
Result := 0;
end;
// called for every record selected in xEdit
function Process(e: IInterface): integer;
begin
Result := 0;
// comment this out if you don't want those messages
//AddMessage('Processing: ' + FullPath(e));
// processing code goes here
end;
// Called after processing
// You can remove it if script doesn't require finalization code
function Finalize: integer;
begin
freeGlobalVariables;
Result := 0;
end;
end.
| 30.886855 | 144 | 0.64704 |
f1a96083b8bc84bb63df8e6cda163cf8fe6f1464 | 317 | pas | Pascal | PascalCompiler/Tests/SyntaxAnalyzer/Statements/16.pas | GoldFeniks/PascalCompiler | 4a7325c385c133dd360eaba06bebaedd30b4078d | [
"MIT"
]
| 2 | 2018-07-06T09:50:57.000Z | 2019-10-06T12:57:57.000Z | PascalCompiler/Tests/SyntaxAnalyzer/Statements/16.pas | GoldFeniks/PascalCompiler | 4a7325c385c133dd360eaba06bebaedd30b4078d | [
"MIT"
]
| null | null | null | PascalCompiler/Tests/SyntaxAnalyzer/Statements/16.pas | GoldFeniks/PascalCompiler | 4a7325c385c133dd360eaba06bebaedd30b4078d | [
"MIT"
]
| null | null | null | program test;
type
rec = record
a :Integer;
b : Real;
end;
arr = array [1..10] of Integer;
var
r, d: rec;
a, b: arr;
c, f: Integer;
begin
r.a := c;
r.a := 10;
r.b := 10.1;
r := d;
a[1] := 10;
a[2] := 20;
a[3] := c + f;
a[4] := r.a;
end. | 12.192308 | 35 | 0.378549 |
47d090a510a943ed5df9cc400ac4099c3cc4fea7 | 477 | dfm | Pascal | Ip_Maxtool_IAC500 (Exemplo)/Delphi 7/Codigo Fonte/Ulogcom.dfm | Maxtel-Tecnologia/Ip_maxtool_IAC500 | dbbe0b001b4e3f473be561646cecbc43d4398d97 | [
"MIT"
]
| null | null | null | Ip_Maxtool_IAC500 (Exemplo)/Delphi 7/Codigo Fonte/Ulogcom.dfm | Maxtel-Tecnologia/Ip_maxtool_IAC500 | dbbe0b001b4e3f473be561646cecbc43d4398d97 | [
"MIT"
]
| null | null | null | Ip_Maxtool_IAC500 (Exemplo)/Delphi 7/Codigo Fonte/Ulogcom.dfm | Maxtel-Tecnologia/Ip_maxtool_IAC500 | dbbe0b001b4e3f473be561646cecbc43d4398d97 | [
"MIT"
]
| null | null | null | object LogCom: TLogCom
Left = 676
Top = 298
Width = 504
Height = 497
Caption = 'LogCom'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poDesktopCenter
PixelsPerInch = 96
TextHeight = 13
object Memo1: TMemo
Left = 16
Top = 13
Width = 457
Height = 433
ScrollBars = ssVertical
TabOrder = 0
end
end
| 18.346154 | 32 | 0.651992 |
fcb8b63f810b8ed9fe82cb03be7472c4b07ad0b7 | 5,828 | dfm | Pascal | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/JvCsvDataSet/CsvDataSourceDemoFm.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/JvCsvDataSet/CsvDataSourceDemoFm.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/JvCsvDataSet/CsvDataSourceDemoFm.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | object CsvDataSourceForm: TCsvDataSourceForm
Left = 179
Top = 121
Width = 810
Height = 638
Caption = 'Comma Separated Variable File (TJvCsvDataSet) Demo'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnClose = FormClose
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Label2: TLabel
Left = 336
Top = 144
Width = 299
Height = 13
Caption = 'Date Display Format in Grid (does not affect saved CSV format):'
end
object DBNavigator1: TDBNavigator
Left = 24
Top = 136
Width = 240
Height = 25
DataSource = DataSource1
TabOrder = 0
end
object DBGrid1: TDBGrid
Left = 24
Top = 160
Width = 754
Height = 223
Anchors = [akLeft, akTop, akRight, akBottom]
DataSource = DataSource1
TabOrder = 1
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
Columns = <
item
Expanded = False
FieldName = 'NAME'
Width = 100
Visible = True
end
item
Expanded = False
FieldName = 'ADDRESS'
Width = 151
Visible = True
end
item
Expanded = False
FieldName = 'ADDRESS2'
Width = 140
Visible = True
end
item
Expanded = False
FieldName = 'TELEPHONE'
Width = 140
Visible = True
end
item
Expanded = False
FieldName = 'AGE'
Visible = True
end
item
Expanded = False
FieldName = 'LASTPHONECALL'
Visible = True
end
item
Expanded = False
FieldName = 'PRIVATENUMBER'
Visible = True
end>
end
object Button1: TButton
Left = 8
Top = 398
Width = 265
Height = 25
Anchors = [akLeft, akBottom]
Caption = 'JvCsvDataSet1.AssignToStrings(Memo1.Lines)'
TabOrder = 2
OnClick = Button1Click
end
object Button2: TButton
Left = 560
Top = 398
Width = 173
Height = 25
Anchors = [akLeft, akBottom]
Caption = 'Save Now. (aka Flush)'
TabOrder = 3
OnClick = Button2Click
end
object Memo1: TMemo
Left = 8
Top = 426
Width = 785
Height = 168
Anchors = [akLeft, akRight, akBottom]
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
Lines.Strings = (
'<Click the VIEW button to view the results as a CSV ascii file.>')
ParentFont = False
ScrollBars = ssBoth
TabOrder = 4
end
object Button3: TButton
Left = 280
Top = 398
Width = 265
Height = 25
Anchors = [akLeft, akBottom]
Caption = 'JvCsvDataSet1.AssignToStrings(Memo1.Lines)'
TabOrder = 5
OnClick = Button3Click
end
object ComboBox1: TComboBox
Left = 640
Top = 136
Width = 145
Height = 21
ItemHeight = 13
TabOrder = 6
OnChange = ComboBox1Change
Items.Strings = (
'yyyy-mm-dd hh:nn:ss'
'yyyy-mm-dd hh:nn:ss am/pm'
'mmm dd, yyyy hh:nn:ss am/pm'
'mm/ddd/yyyy hh:nn:ss'
'ddd mmm dd, yyyy hh:nn:ss'
'ddd mmm dd, yyyy hh:nn:ss am/pm')
end
object RichEdit1: TRichEdit
Left = 0
Top = 0
Width = 802
Height = 113
Align = alTop
BorderStyle = bsNone
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
Lines.Strings = (
'How to use the JvCsvDataSet: '
'(1) Drop a TJvCsvDataSource, the usual TDataSet, and your favor' +
'ite data-aware controls, and set up the usual properties. '
'(2) Set the filename, the CsvFieldDef field (click the '#39'...'#39' bu' +
'tton), then, if you want field objects, right click on the CSVDa' +
'taSet and add the '
'field objects in the usual way. This component does not rely on' +
' BDE, ADO, or any external DLL/OCX, so you can create simple dat' +
'abase '
'applications that run entirely from your EXE with no runtime req' +
'uirements (if you link the VCL runtime statically). '
''
'*** Comments or Questions? Check the Delphi JEDI VCL Support New' +
'sgroups. ***')
ParentFont = False
ReadOnly = True
TabOrder = 7
end
object DataSource1: TDataSource
DataSet = JvCsvDataSet1
Left = 52
Top = 216
end
object JvCsvDataSet1: TJvCsvDataSet
FileName = 'PhoneList.csv'
Changed = False
CsvFieldDef =
'NAME,ADDRESS,ADDRESS2,TELEPHONE,AGE:%,LASTPHONECALL:@,PRIVATENUM' +
'BER:!'
StoreDefs = True
Left = 124
Top = 196
object JvCsvDataSet1NAME: TStringField
FieldName = 'NAME'
Size = 80
end
object JvCsvDataSet1ADDRESS: TStringField
FieldName = 'ADDRESS'
Size = 80
end
object JvCsvDataSet1ADDRESS2: TStringField
FieldName = 'ADDRESS2'
Size = 80
end
object JvCsvDataSet1TELEPHONE: TStringField
FieldName = 'TELEPHONE'
Size = 80
end
object JvCsvDataSet1AGE: TIntegerField
FieldName = 'AGE'
end
object JvCsvDataSet1LASTPHONECALL: TDateTimeField
FieldName = 'LASTPHONECALL'
end
object JvCsvDataSet1PRIVATENUMBER: TBooleanField
FieldName = 'PRIVATENUMBER'
end
end
end
| 25.561404 | 85 | 0.58116 |
4708538e7bf81d009f7c9192bcaa01c77f16ff5c | 2,479 | pas | Pascal | Source/Services/SimpleEmail/Base/Transform/AWS.SES.Transform.PutConfigurationSetDeliveryOptionsRequestMarshaller.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 67 | 2021-07-28T23:47:09.000Z | 2022-03-15T11:48:35.000Z | Source/Services/SimpleEmail/Base/Transform/AWS.SES.Transform.PutConfigurationSetDeliveryOptionsRequestMarshaller.pas | gabrielbaltazar/aws-sdk-delphi | ea1713b227a49cbbc5a2e1bf04cbf2de1f9b611a | [
"Apache-2.0"
]
| 5 | 2021-09-01T09:31:16.000Z | 2022-03-16T18:19:21.000Z | Source/Services/SimpleEmail/Base/Transform/AWS.SES.Transform.PutConfigurationSetDeliveryOptionsRequestMarshaller.pas | gabrielbaltazar/aws-sdk-delphi | ea1713b227a49cbbc5a2e1bf04cbf2de1f9b611a | [
"Apache-2.0"
]
| 13 | 2021-07-29T02:41:16.000Z | 2022-03-16T10:22:38.000Z | unit AWS.SES.Transform.PutConfigurationSetDeliveryOptionsRequestMarshaller;
interface
uses
AWS.Internal.Request,
AWS.Transform.RequestMarshaller,
AWS.Runtime.Model,
AWS.SES.Model.PutConfigurationSetDeliveryOptionsRequest,
AWS.Internal.DefaultRequest,
AWS.Internal.StringUtils;
type
IPutConfigurationSetDeliveryOptionsRequestMarshaller = IMarshaller<IRequest, TAmazonWebServiceRequest>;
TPutConfigurationSetDeliveryOptionsRequestMarshaller = class(TInterfacedObject, IMarshaller<IRequest, TPutConfigurationSetDeliveryOptionsRequest>, IPutConfigurationSetDeliveryOptionsRequestMarshaller)
strict private
class var FInstance: IPutConfigurationSetDeliveryOptionsRequestMarshaller;
class constructor Create;
public
function Marshall(AInput: TAmazonWebServiceRequest): IRequest; overload;
function Marshall(PublicRequest: TPutConfigurationSetDeliveryOptionsRequest): IRequest; overload;
class function Instance: IPutConfigurationSetDeliveryOptionsRequestMarshaller; static;
end;
implementation
{ TPutConfigurationSetDeliveryOptionsRequestMarshaller }
function TPutConfigurationSetDeliveryOptionsRequestMarshaller.Marshall(AInput: TAmazonWebServiceRequest): IRequest;
begin
Result := Marshall(TPutConfigurationSetDeliveryOptionsRequest(AInput));
end;
function TPutConfigurationSetDeliveryOptionsRequestMarshaller.Marshall(PublicRequest: TPutConfigurationSetDeliveryOptionsRequest): IRequest;
var
Request: IRequest;
begin
Request := TDefaultRequest.Create(PublicRequest, 'Amazon.SimpleEmail');
Request.Parameters.Add('Action', 'PutConfigurationSetDeliveryOptions');
Request.Parameters.Add('Version', '2010-12-01');
if PublicRequest <> nil then
begin
if PublicRequest.IsSetConfigurationSetName then
Request.Parameters.Add('ConfigurationSetName', TStringUtils.Fromstring(PublicRequest.ConfigurationSetName));
if PublicRequest.IsSetDeliveryOptions then
if PublicRequest.DeliveryOptions.IsSetTlsPolicy then
Request.Parameters.Add('DeliveryOptions' + '.' + 'TlsPolicy', PublicRequest.DeliveryOptions.TlsPolicy.Value);
end;
Result := Request;
end;
class constructor TPutConfigurationSetDeliveryOptionsRequestMarshaller.Create;
begin
FInstance := TPutConfigurationSetDeliveryOptionsRequestMarshaller.Create;
end;
class function TPutConfigurationSetDeliveryOptionsRequestMarshaller.Instance: IPutConfigurationSetDeliveryOptionsRequestMarshaller;
begin
Result := FInstance;
end;
end.
| 38.734375 | 202 | 0.838241 |
fc5c48edd59114c2586a3bcac4809af42e03110d | 4,770 | pas | Pascal | Beyond.Bind.Json.pas | atkins126/LiveBindingsBeyond | 6b9799c143f41c8eae7094a840b43bc497c83583 | [
"MIT"
]
| null | null | null | Beyond.Bind.Json.pas | atkins126/LiveBindingsBeyond | 6b9799c143f41c8eae7094a840b43bc497c83583 | [
"MIT"
]
| null | null | null | Beyond.Bind.Json.pas | atkins126/LiveBindingsBeyond | 6b9799c143f41c8eae7094a840b43bc497c83583 | [
"MIT"
]
| null | null | null | unit Beyond.Bind.Json;
(*
* Beyond standard LiveBindings - JSON Parsing Utils
*)
interface
implementation
uses
System.SysUtils, System.TypInfo,
System.Bindings.Methods, System.Bindings.EvalProtocol,
System.Bindings.Consts, RTTI, JSON;
/// <summary>
/// JsonValue(JsonString)
/// </summary>
/// <remarks>
/// Example: example: JsonValue('{Id:1, Name:"John"}', 'Name') => 'John'
/// </remarks>
/// <returns>
/// string
/// </returns>
function MakeJsonValueMethod: IInvokable;
begin
Result := MakeInvokable(function(Args: TArray<IValue>): IValue
var
v1: IValue;
v2: IValue;
JsonStr: string;
NameStr: string;
begin
// Ensure exacty 2 arguments
if Length(Args) <> 2 then
raise EEvaluatorError.Create(Format(sUnexpectedArgCount, [2, Length(Args)]));
// verify both arguments are strings
v1 := Args[0];
v2 := Args[1];
if (not (v1.GetType.Kind in [tkString, tkUString, tkWString])) or
(not (v2.GetType.Kind in [tkString, tkUString, tkWString])) then
raise EEvaluatorError.Create('Both arguments to JsonValue must be String');
JsonStr := v1.GetValue.AsString;
NameStr := v2.GetValue.AsString;
try
var JsonVal: TJSONValue := TJSONObject.ParseJSONValue(JsonStr);
try
var s: string;
if JSONVal.TryGetValue<string>(NameStr, s) then
Result := TValueWrapper.Create(s)
else
Result := TValueWrapper.Create(EmptyStr);
finally
JSONVal.Free;
end;
except
on e:Exception do
raise EEvaluatorError.Create('Invalid JSON format in JsonValue: ' + JsonStr);
end;
end);
end;
/// <summary>
/// JsonArrayValToCSV(JsonString, FieldName)
/// </summary>
/// <remarks>
/// Example: example: JsonArrayValToCSV('[{"Id":1,"Name":"John"},{"Id":2,"Name":"Sue"}]', 'Name') => 'John, Sue'
/// </remarks>
/// <returns>
/// string
/// </returns>
function MakeJsonArrayValToCSVMethod: IInvokable;
begin
Result := MakeInvokable(function(Args: TArray<IValue>): IValue
var
v1, v2: IValue;
JsonStr: string;
NameStr: string;
ResultStr: string;
begin
// Ensure exacty 2 arguments
if Length(Args) <> 2 then
raise EEvaluatorError.Create(Format(sUnexpectedArgCount, [2, Length(Args)]));
// verify both arguments are strings
v1 := Args[0];
v2 := Args[1];
if (not (v1.GetType.Kind in [tkString, tkUString, tkWString])) or
(not (v2.GetType.Kind in [tkString, tkUString, tkWString])) then begin
var v1Kind: string := TRttiEnumerationType.GetName(v1.GetType.Kind);
raise EEvaluatorError.Create('The arguement to StrLen must be string; instead, got ' + v1Kind);
end;
// go through the array, looking for v2 values, return CSV result+
JsonStr := v1.GetValue.AsString;
NameStr := v2.GetValue.AsString;
try
ResultStr := EmptyStr;
var Item: string;
if JsonStr.Length > 0 then begin
var JsonVal: TJSONValue := TJSONObject.ParseJSONValue(JsonStr);
if JsonVal is TJSONArray then begin
for var i := 0 to TJSONArray(JsonVal).Count - 1 do begin
Item := TJSONArray(JsonVal)[i].P[NameStr].Value;
if Item.Length > 0 then begin
if ResultStr.Length > 0 then
ResultStr := ResultStr + ', ';
ResultStr := ResultStr + Item;
end;
end;
if ResultStr.Length = 0 then
ResultStr := JsonStr;
end;
end;
Result := TValueWrapper.Create(ResultStr);
except
Result := TValueWrapper.Create(JsonStr);
end;
end);
end;
const
sUnitName = 'Beyond.Bind.Json';
sJsonValueName = 'JsonValue';
sJsonArrayValToCSVName = 'JsonArrayValToCSV';
procedure RegisterMethods;
begin
TBindingMethodsFactory.RegisterMethod(
TMethodDescription.Create(MakeJsonValueMethod,
sJsonValueName, sJsonValueName, sUnitName, True,
'Get a JSON Value from the given Name', nil));
TBindingMethodsFactory.RegisterMethod(
TMethodDescription.Create(MakeJsonArrayValToCSVMethod,
sJsonArrayValToCSVName, sJsonArrayValToCSVName, sUnitName, True,
'Convert a JSON array to CSV of the named field', nil));
end;
procedure UnregisterMethods;
begin
TBindingMethodsFactory.UnRegisterMethod(sJsonValueName);
TBindingMethodsFactory.UnRegisterMethod(sJsonArrayValToCSVName);
end;
initialization
RegisterMethods;
finalization
UnregisterMethods;
end.
| 30.974026 | 114 | 0.618029 |
fc5ecbca423b09ee1e451e9c1c3063169305d70d | 1,564 | dfm | Pascal | ULexikonD.dfm | Aasvogel/dvt | 873d41a2da391b2635d8af8df161ca9f8adadd35 | [
"Unlicense"
]
| null | null | null | ULexikonD.dfm | Aasvogel/dvt | 873d41a2da391b2635d8af8df161ca9f8adadd35 | [
"Unlicense"
]
| null | null | null | ULexikonD.dfm | Aasvogel/dvt | 873d41a2da391b2635d8af8df161ca9f8adadd35 | [
"Unlicense"
]
| null | null | null | object LexikonD: TLexikonD
Left = 331
Top = 297
Width = 375
Height = 282
Caption = 'LexikonD'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Menu = MainMenu1
OldCreateOrder = False
OnActivate = FormActivate
PixelsPerInch = 96
TextHeight = 13
object LabSuchen: TLabel
Left = 23
Top = 238
Width = 59
Height = 22
Caption = 'Suche:'
Font.Charset = ANSI_CHARSET
Font.Color = clRed
Font.Height = -19
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Visible = False
end
object GridLexikon: TStringGrid
Left = 11
Top = 1
Width = 340
Height = 220
BiDiMode = bdLeftToRight
ColCount = 2
DefaultColWidth = 159
DragCursor = crDefault
FixedCols = 0
RowCount = 10
FixedRows = 0
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Comic Sans MS'
Font.Style = []
Options = [goVertLine, goHorzLine, goDrawFocusSelected, goThumbTracking]
ParentBiDiMode = False
ParentFont = False
ScrollBars = ssVertical
TabOrder = 0
OnKeyPress = GridLexikonKeyPress
end
object MainMenu1: TMainMenu
Left = 89
Top = 101
object MenSuchen: TMenuItem
Caption = '&Suchen'
OnClick = MenSuchenClick
end
object MenExit: TMenuItem
Caption = 'E&xit'
OnClick = MenExitClick
end
end
end
| 22.666667 | 77 | 0.61445 |
fc261a64d6c37452f0cfd5aef42652f181527fd5 | 569 | pas | Pascal | 01 - Estruturas de Sequencial/Prova03_08-10-2019/ProvaQuestao03.pas | AndreLucyo2/Algoritmos-Pascal_1SemIFPR | ca170be7b7bf0d8f5d5529ebf0908df1975f60c1 | [
"MIT"
]
| null | null | null | 01 - Estruturas de Sequencial/Prova03_08-10-2019/ProvaQuestao03.pas | AndreLucyo2/Algoritmos-Pascal_1SemIFPR | ca170be7b7bf0d8f5d5529ebf0908df1975f60c1 | [
"MIT"
]
| null | null | null | 01 - Estruturas de Sequencial/Prova03_08-10-2019/ProvaQuestao03.pas | AndreLucyo2/Algoritmos-Pascal_1SemIFPR | ca170be7b7bf0d8f5d5529ebf0908df1975f60c1 | [
"MIT"
]
| null | null | null | program Questao02;
uses crt;
var
horasEnt : integer;
semana : integer;
dias : integer;
horas : integer;
aux : integer;
begin
writeln('Entre com o tempo em horas');
readln(horasEnt);
semana := trunc(horasEnt / 168); //uma semana possui 168horas
aux := horasEnt mod 168; //Variavel auxiliar.
dias := trunc(aux / 24);
horas := aux mod 24;
writeln(horasEnt, ' horas iformado ',
semana, ' semana, ',
dias, ' dias e ',
horas, ' horas.');
writeln('Tecle ENTER para encerrar ...');
readln;
end. | 18.966667 | 63 | 0.59051 |
47fc6018e184e4a35aae6e7ef2e04f4d0ded726a | 3,870 | pas | Pascal | examples/Delphi/Compound/ProdStruct/dm1.pas | LenakeTech/BoldForDelphi | 3ef25517d5c92ebccc097c6bc2f2af62fc506c71 | [
"MIT"
]
| 121 | 2020-09-22T10:46:20.000Z | 2021-11-17T12:33:35.000Z | examples/Delphi/Compound/ProdStruct/dm1.pas | LenakeTech/BoldForDelphi | 3ef25517d5c92ebccc097c6bc2f2af62fc506c71 | [
"MIT"
]
| 8 | 2020-09-23T12:32:23.000Z | 2021-07-28T07:01:26.000Z | examples/Delphi/Compound/ProdStruct/dm1.pas | LenakeTech/BoldForDelphi | 3ef25517d5c92ebccc097c6bc2f2af62fc506c71 | [
"MIT"
]
| 42 | 2020-09-22T14:37:20.000Z | 2021-10-04T10:24:12.000Z | unit dm1;
interface
uses
SysUtils,
Classes,
Graphics,
Controls,
Forms,
BoldModel,
BoldControlPack,
BoldStringControlPack,
BoldSubscription,
BoldElements,
Boldhandles,
BoldSystemHandle, BoldHandle, BoldPersistenceHandle,
BoldPersistenceHandleDB, BoldActions, ActnList,
BoldHandleAction, BoldAbstractModel, DB, IBDatabase,
BoldAbstractDatabaseAdapter, BoldDatabaseAdapterIB,
BoldAbstractPersistenceHandleDB;
type
TdmMain = class(TDataModule)
BoldModel: TBoldModel;
BoldSystem: TBoldSystemHandle;
BoldProfitAsStringRenderer: TBoldAsStringRenderer;
BoldSystemTypeInfoHandle1: TBoldSystemTypeInfoHandle;
BoldPersistenceHandleDB1: TBoldPersistenceHandleDB;
BoldDatabaseAdapterIB1: TBoldDatabaseAdapterIB;
IBDatabase1: TIBDatabase;
function BoldProfitAsStringRendererGetAsString(element: TBoldElement;
representation: Integer; Expression: string): string;
procedure BoldProfitAsStringRendererSubscribe(element: TBoldElement;
representation: Integer; Expression: string;
Subscriber: TBoldSubscriber);
procedure BoldProfitAsStringRendererSetAsString(
Element: TBoldElement; Value: String; Representation: Integer;
Expression: String);
function BoldProfitAsStringRendererMayModify(
Element: TBoldElement; Representation: Integer;
Expression: String; Subscriber: TBoldSubscriber): Boolean;
private
{ Private declarations }
public
{ Public declarations }
end;
var
dmMain: TdmMain;
implementation
uses ProdStructClasses;
{$R *.DFM}
procedure TdmMain.BoldProfitAsStringRendererSubscribe(element: TBoldElement;
representation: Integer; Expression: string;
Subscriber: TBoldSubscriber);
begin
{You need to know when price and/or totalCost changes to correctly show the profit.
Element is assumed to be a Product.
The method SubscribeToExpression places subscriptions for the subscriber.
The subscriber comes from whoever uses the AsStringRenderer.
Resubscribe is false in most cases.}
if assigned(element) then
begin
element.SubscribeToExpression('price', subscriber, false);
element.SubscribeToExpression('totalCost', subscriber, false);
end;
end;
function TdmMain.BoldProfitAsStringRendererGetAsString(
element: TBoldElement; representation: Integer;
Expression: string): string;
begin
{This method is called whenever any of the elements you subscribe to changes.
Element is assumed to be a Product.
Calculate a string to show.}
Result := '';
if Assigned(Element) then
with element as TProduct do
if TotalCost <> 0 then
Result := Format('%d%%',[Round((Price / TotalCost - 1) * 100)])
else
Result := 'n/a';
end;
procedure TdmMain.BoldProfitAsStringRendererSetAsString(
Element: TBoldElement; Value: String; Representation: Integer;
Expression: String);
var
CleanedValue: string;
procedure CleanValue;
var
I: Integer;
begin
{Remove spaces and %}
I := 1;
while I<=Length(Value) do
begin
if Value[I] in ['0'..'9', DecimalSeparator ] then
CleanedValue := CleanedValue+Value[I];
Inc(I)
end;
end;
begin
{This method is called when you change the value in a control that uses this Renderer.}
CleanValue;
with Element as TProduct do
if (CleanedValue<>'') then
Price := TotalCost * (StrToFloat(CleanedValue)/100+1);
end;
function TdmMain.BoldProfitAsStringRendererMayModify(
Element: TBoldElement; Representation: Integer; Expression: String;
Subscriber: TBoldSubscriber): Boolean;
begin
{This method is called at the same time as the GetAsString event to render the ReadOnly value.
Result sets the ReadOnly property on the control using this Renderer.}
Result := False;
if Assigned(Element) then
with element as TProduct do
Result := TotalCost <> 0;
end;
end.
| 29.318182 | 96 | 0.747028 |
4769b3418204ec9b2b607feae274d148d798f93a | 214 | dpr | Pascal | Demos/CameraX/CameraX.dpr | atkins126/Playground | 6e90050a3247a28da1024ec4359785c1b261f342 | [
"MIT"
]
| 14 | 2021-12-30T08:03:49.000Z | 2022-03-17T19:33:24.000Z | Demos/CameraX/CameraX.dpr | atkins126/Playground | 6e90050a3247a28da1024ec4359785c1b261f342 | [
"MIT"
]
| 6 | 2022-01-01T21:56:18.000Z | 2022-03-01T22:23:56.000Z | Demos/CameraX/CameraX.dpr | atkins126/Playground | 6e90050a3247a28da1024ec4359785c1b261f342 | [
"MIT"
]
| 4 | 2022-01-04T13:25:08.000Z | 2022-01-13T09:58:32.000Z | program CameraX;
uses
System.StartUpCopy,
FMX.Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
| 14.266667 | 41 | 0.663551 |
fc709c59de8252ebe527dfe2b0b49368a454b590 | 991 | pas | Pascal | Repository/CommonBase/Client/Custom/UfrmSYS_CustomReportDialog.pas | iclinicadoleite/controle-ag5 | 2e315c4a7c9bcb841a8d2f2390ae9d7c2c2cb721 | [
"Apache-2.0"
]
| 1 | 2020-05-07T07:51:27.000Z | 2020-05-07T07:51:27.000Z | Repository/CommonBase/Client/Custom/UfrmSYS_CustomReportDialog.pas | iclinicadoleite/controle-ag5 | 2e315c4a7c9bcb841a8d2f2390ae9d7c2c2cb721 | [
"Apache-2.0"
]
| null | null | null | Repository/CommonBase/Client/Custom/UfrmSYS_CustomReportDialog.pas | iclinicadoleite/controle-ag5 | 2e315c4a7c9bcb841a8d2f2390ae9d7c2c2cb721 | [
"Apache-2.0"
]
| 3 | 2020-02-17T18:01:52.000Z | 2020-05-07T07:51:28.000Z | unit UfrmSYS_CustomReportDialog;
interface
uses
WinApi.Windows, WinApi.Messages, System.SysUtils, System.Variants, System.Classes, VCL.Graphics, VCL.Controls, VCL.Forms,
VCL.Dialogs, SysFormDialog, VCL.ActnList, VCL.ExtCtrls, VCL.StdCtrls,
VCL.Buttons, ReportTypes,
VCL.ComCtrls, JvExComCtrls, JvComCtrls, JvExExtCtrls, JvExtComponent, JvPanel,
Wrappers, SysFormReportDialog, JvImage ;
type
TSpecificReportParams = ReportTypes.TReportParams ;
TfrmCustomReportDialog = class(T_FormReportDialog)
private
{ Private declarations }
protected
{ Protected declarations }
procedure SetParameters (var Parameters : TReportParams ) ; override ;
public
{ Public declarations }
end;
implementation
{$R *.dfm}
{ TfrmCustomDialog }
procedure TfrmCustomReportDialog.SetParameters( var Parameters: TReportParams ) ;
begin
inherited ;
with TSpecificReportParams ( Parameters ) do
begin
// Param := FormControl ;
end ;
end;
end.
| 22.022222 | 123 | 0.742684 |
fc0c76697c37b959fe0572a03fde7d255c816663 | 1,441 | dpr | Pascal | Estandar.dpr | NetVaIT/Estandar | 1961b92ce444a133b340c8020720f1c7231b830a | [
"Apache-2.0"
]
| null | null | null | Estandar.dpr | NetVaIT/Estandar | 1961b92ce444a133b340c8020720f1c7231b830a | [
"Apache-2.0"
]
| null | null | null | Estandar.dpr | NetVaIT/Estandar | 1961b92ce444a133b340c8020720f1c7231b830a | [
"Apache-2.0"
]
| null | null | null | program Estandar;
uses
Vcl.Forms,
_AboutForm in '_AboutForm.pas' {_frmAbout},
_ConectionDmod in '_ConectionDmod.pas' {_dmConection: TDataModule},
_DualListDM in '_DualListDM.pas' {_dmDualList: TDataModule},
_DualListForm in '_DualListForm.pas' {_frmDualList},
_EditForm in '_EditForm.pas' {_frmEdit},
_GridForm in '_GridForm.pas' {_frmGrid},
_LoginForm in '_LoginForm.pas' {_frmLogin},
_MainForm in '_MainForm.pas' {_frmMain},
_MainRibbonForm in '_MainRibbonForm.pas' {_frmMainRibbon},
_ProgressForm in '_ProgressForm.pas' {_frmProgress},
_ProviderDMod in '_ProviderDMod.pas' {_dmProvider: TDataModule},
_ReportDMod in '_ReportDMod.pas' {_dmReport: TDataModule},
_ReportForm in '_ReportForm.pas' {_frmReport},
_SplashForm in '_SplashForm.pas' {_frmSplash},
_StandarDMod in '_StandarDMod.pas' {_dmStandar: TDataModule},
_StandarForm in '_StandarForm.pas' {_StandarFrm},
_StandarGridForm in '_StandarGridForm.pas' {_frmStandarGrid},
_Utils in '_Utils.pas',
MainForm in 'MainForm.pas' {frmMain};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TfrmMain, frmMain);
Application.CreateForm(T_dmConection, _dmConection);
Application.CreateForm(T_frmMain, _frmMain);
Application.CreateForm(T_frmMainRibbon, _frmMainRibbon);
Application.CreateForm(T_frmProgress, _frmProgress);
Application.Run;
end.
| 38.945946 | 70 | 0.752255 |
fc3469f924ff6fd117e3df51b422c0aec9d31c87 | 1,557 | dfm | Pascal | Fontes/UFrmPesquisaProdutos.dfm | roneysousa/fpopular | d2f0f22cbab5a7e26540659ca7a6bf6811652c17 | [
"MIT"
]
| null | null | null | Fontes/UFrmPesquisaProdutos.dfm | roneysousa/fpopular | d2f0f22cbab5a7e26540659ca7a6bf6811652c17 | [
"MIT"
]
| null | null | null | Fontes/UFrmPesquisaProdutos.dfm | roneysousa/fpopular | d2f0f22cbab5a7e26540659ca7a6bf6811652c17 | [
"MIT"
]
| null | null | null | inherited FrmPesquisaProdutos: TFrmPesquisaProdutos
Caption = 'Pesquisar Produtos'
OldCreateOrder = True
PixelsPerInch = 96
TextHeight = 13
inherited plnGrid: TPanel
inherited grdConsultar: TJvDBUltimGrid
Columns = <
item
Expanded = False
FieldName = 'pro_barras'
Title.Alignment = taCenter
Width = 90
Visible = True
end
item
Expanded = False
FieldName = 'pro_medicamento'
Title.Alignment = taCenter
Width = 421
Visible = True
end
item
Expanded = False
FieldName = 'pro_valorvenda'
Title.Alignment = taRightJustify
Visible = True
end>
end
end
inherited datasetConsultar: TSQLDataSet
CommandText = 'select pro_barras, pro_medicamento, pro_valorvenda from produtos'
MaxBlobSize = -1
SQLConnection = dmGerenciador.sqlConexao
end
inherited cdsConsultar: TClientDataSet
object cdsConsultarpro_barras: TStringField
Alignment = taCenter
DisplayLabel = 'C'#243'd.Barras'
FieldName = 'pro_barras'
Size = 13
end
object cdsConsultarpro_medicamento: TStringField
DisplayLabel = 'Descri'#231#227'o'
FieldName = 'pro_medicamento'
Size = 60
end
object cdsConsultarpro_valorvenda: TFMTBCDField
DisplayLabel = 'Valor'
FieldName = 'pro_valorvenda'
DisplayFormat = '###,##0.#0'
EditFormat = '###,##0.#0'
Precision = 15
Size = 8
end
end
end
| 26.844828 | 84 | 0.622993 |
cd9f7f9a7a9e5f58972482e14bc4871e59d92a92 | 620 | pas | Pascal | Test/HelpersPass/helper_as_overload.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 79 | 2015-03-18T10:46:13.000Z | 2022-03-17T18:05:11.000Z | Test/HelpersPass/helper_as_overload.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 6 | 2016-03-29T14:39:00.000Z | 2020-09-14T10:04:14.000Z | Test/HelpersPass/helper_as_overload.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 25 | 2016-05-04T13:11:38.000Z | 2021-09-29T13:34:31.000Z | type
Vec2 = array [0..1] of Float;
type
TVec2Helper = helper for Vec2
function Add(const v : Vec2) : Vec2; overload;
begin
Result:=[Self[0]+v[0], Self[1]+v[1]];
end;
function Add(const f : Float) : Vec2; overload;
begin
Result:=[Self[0]+f, Self[1]+f];
end;
end;
operator + (Vec2, Vec2) : Vec2 uses TVec2Helper.Add;
operator + (Vec2, Float) : Vec2 uses TVec2Helper.Add;
var v1 : Vec2 := [1, 2];
var v2 : Vec2 := [10, 20];
var v := v1 + v2;
PrintLn(v[0]);
PrintLn(v[1]);
v := v1 + 5.0;
PrintLn(v[0]);
PrintLn(v[1]);
| 20 | 54 | 0.522581 |
47b9399aeeae61511b9b0b3bf772983baddb522d | 56,028 | pas | Pascal | Delphi/Imports/SHDocVw_TLB.pas | tdebaets/common | d94411a3cc1902f4bb3c788ca9ee66a2d9664708 | [
"Apache-2.0"
]
| 4 | 2017-03-30T19:52:29.000Z | 2022-02-10T04:20:52.000Z | Delphi/Imports/SHDocVw_TLB.pas | tdebaets/common | d94411a3cc1902f4bb3c788ca9ee66a2d9664708 | [
"Apache-2.0"
]
| null | null | null | Delphi/Imports/SHDocVw_TLB.pas | tdebaets/common | d94411a3cc1902f4bb3c788ca9ee66a2d9664708 | [
"Apache-2.0"
]
| 3 | 2016-07-25T13:33:39.000Z | 2018-12-27T05:17:50.000Z | (****************************************************************************
*
* Copyright 2016 Tim De Baets
*
* 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.
*
****************************************************************************
*
* ActiveX import of webbrowser control (ieframe.dll)
*
****************************************************************************)
unit SHDocVw_TLB;
{ This file contains pascal declarations imported from a type library.
This file will be written during each import or refresh of the type
library editor. Changes to this file will be discarded during the
refresh process. }
{ Microsoft Internet Controls }
{ Version 1.1 }
{ Conversion log:
Warning: 'Type' is a reserved word. IWebBrowser.Type changed to Type_
Warning: 'Property' is a reserved word. Parameter 'Property' in DWebBrowserEvents.PropertyChange changed to 'Property_'
Warning: 'Property' is a reserved word. Parameter 'Property' in IWebBrowserApp.PutProperty changed to 'Property_'
Warning: 'Property' is a reserved word. Parameter 'Property' in IWebBrowserApp.GetProperty changed to 'Property_'
Warning: 'Type' is a reserved word. Parameter 'Type' in IShellUIHelper.AddDesktopComponent changed to 'Type_'
}
interface
uses Windows, ActiveX, Classes, Graphics, OleCtrls, StdVCL;
const
LIBID_SHDocVw: TGUID = '{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}';
const
{ Constants for WebBrowser CommandStateChange }
{ CommandStateChangeConstants }
CSC_UPDATECOMMANDS = -1;
CSC_NAVIGATEFORWARD = 1;
CSC_NAVIGATEBACK = 2;
{ OLECMDID }
OLECMDID_OPEN = 1;
OLECMDID_NEW = 2;
OLECMDID_SAVE = 3;
OLECMDID_SAVEAS = 4;
OLECMDID_SAVECOPYAS = 5;
OLECMDID_PRINT = 6;
OLECMDID_PRINTPREVIEW = 7;
OLECMDID_PAGESETUP = 8;
OLECMDID_SPELL = 9;
OLECMDID_PROPERTIES = 10;
OLECMDID_CUT = 11;
OLECMDID_COPY = 12;
OLECMDID_PASTE = 13;
OLECMDID_PASTESPECIAL = 14;
OLECMDID_UNDO = 15;
OLECMDID_REDO = 16;
OLECMDID_SELECTALL = 17;
OLECMDID_CLEARSELECTION = 18;
OLECMDID_ZOOM = 19;
OLECMDID_GETZOOMRANGE = 20;
OLECMDID_UPDATECOMMANDS = 21;
OLECMDID_REFRESH = 22;
OLECMDID_STOP = 23;
OLECMDID_HIDETOOLBARS = 24;
OLECMDID_SETPROGRESSMAX = 25;
OLECMDID_SETPROGRESSPOS = 26;
OLECMDID_SETPROGRESSTEXT = 27;
OLECMDID_SETTITLE = 28;
OLECMDID_SETDOWNLOADSTATE = 29;
OLECMDID_STOPDOWNLOAD = 30;
OLECMDID_ONTOOLBARACTIVATED = 31;
OLECMDID_FIND = 32;
OLECMDID_DELETE = 33;
OLECMDID_HTTPEQUIV = 34;
OLECMDID_HTTPEQUIV_DONE = 35;
OLECMDID_ENABLE_INTERACTION = 36;
OLECMDID_ONUNLOAD = 37;
OLECMDID_PROPERTYBAG2 = 38;
OLECMDID_PREREFRESH = 39;
OLECMDID_SHOWSCRIPTERROR = 40;
OLECMDID_SHOWMESSAGE = 41;
OLECMDID_SHOWFIND = 42;
OLECMDID_SHOWPAGESETUP = 43;
OLECMDID_SHOWPRINT = 44;
OLECMDID_CLOSE = 45;
OLECMDID_ALLOWUILESSSAVEAS = 46;
OLECMDID_DONTDOWNLOADCSS = 47;
{ OLECMDF }
OLECMDF_SUPPORTED = 1;
OLECMDF_ENABLED = 2;
OLECMDF_LATCHED = 4;
OLECMDF_NINCHED = 8;
OLECMDF_INVISIBLE = 16;
OLECMDF_DEFHIDEONCTXTMENU = 32;
{ OLECMDEXECOPT }
OLECMDEXECOPT_DODEFAULT = 0;
OLECMDEXECOPT_PROMPTUSER = 1;
OLECMDEXECOPT_DONTPROMPTUSER = 2;
OLECMDEXECOPT_SHOWHELP = 3;
{ tagREADYSTATE }
READYSTATE_UNINITIALIZED = 0;
READYSTATE_LOADING = 1;
READYSTATE_LOADED = 2;
READYSTATE_INTERACTIVE = 3;
READYSTATE_COMPLETE = 4;
{ Constants for ShellWindows registration }
{ ShellWindowTypeConstants }
SWC_EXPLORER = 0;
SWC_BROWSER = 1;
SWC_3RDPARTY = 2;
SWC_CALLBACK = 4;
{ Options for ShellWindows FindWindow }
{ ShellWindowFindWindowOptions }
SWFO_NEEDDISPATCH = 1;
SWFO_INCLUDEPENDING = 2;
SWFO_COOKIEPASSED = 4;
const
{ Component class GUIDs }
Class_WebBrowser_V1: TGUID = '{EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B}';
Class_WebBrowser: TGUID = '{8856F961-340A-11D0-A96B-00C04FD705A2}';
Class_InternetExplorer: TGUID = '{0002DF01-0000-0000-C000-000000000046}';
Class_ShellBrowserWindow: TGUID = '{C08AFD90-F2A1-11D1-8455-00A0C91F3880}';
Class_ShellWindows: TGUID = '{9BA05972-F6A8-11CF-A442-00A0C90A8F39}';
Class_ShellUIHelper: TGUID = '{64AB4BB7-111E-11D1-8F79-00C04FC2FBE1}';
Class_ShellFavoritesNameSpace: TGUID = '{55136805-B2DE-11D1-B9F2-00A0C98BC547}';
Class_CScriptErrorList: TGUID = '{EFD01300-160F-11D2-BB2E-00805FF7EFCA}';
Class_SearchAssistantOC: TGUID = '{B45FF030-4447-11D2-85DE-00C04FA35C89}';
type
{ Forward declarations: Interfaces }
IWebBrowser = interface;
IWebBrowserDisp = dispinterface;
DWebBrowserEvents = dispinterface;
IWebBrowserApp = interface;
IWebBrowserAppDisp = dispinterface;
IWebBrowser2 = interface;
IWebBrowser2Disp = dispinterface;
DWebBrowserEvents2 = dispinterface;
DShellWindowsEvents = dispinterface;
IShellWindows = interface;
IShellWindowsDisp = dispinterface;
IShellUIHelper = interface;
IShellUIHelperDisp = dispinterface;
_ShellFavoritesNameSpaceEvents = dispinterface;
IShellFavoritesNameSpace = interface;
IShellFavoritesNameSpaceDisp = dispinterface;
IScriptErrorList = interface;
IScriptErrorListDisp = dispinterface;
ISearch = interface;
ISearchDisp = dispinterface;
ISearches = interface;
ISearchesDisp = dispinterface;
ISearchAssistantOC = interface;
ISearchAssistantOCDisp = dispinterface;
ISearchAssistantOC2 = interface;
ISearchAssistantOC2Disp = dispinterface;
_SearchAssistantEvents = dispinterface;
{ Forward declarations: CoClasses }
WebBrowser_V1 = IWebBrowser;
WebBrowser = IWebBrowser2;
InternetExplorer = IWebBrowser2;
ShellBrowserWindow = IWebBrowser2;
ShellWindows = IShellWindows;
ShellUIHelper = IShellUIHelper;
ShellFavoritesNameSpace = IShellFavoritesNameSpace;
CScriptErrorList = IScriptErrorList;
SearchAssistantOC = ISearchAssistantOC2;
{ Forward declarations: Enums }
CommandStateChangeConstants = TOleEnum;
OLECMDID = TOleEnum;
OLECMDF = TOleEnum;
OLECMDEXECOPT = TOleEnum;
tagREADYSTATE = TOleEnum;
ShellWindowTypeConstants = TOleEnum;
ShellWindowFindWindowOptions = TOleEnum;
{ Web Browser interface }
IWebBrowser = interface(IDispatch)
['{EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B}']
procedure GoBack; safecall;
procedure GoForward; safecall;
procedure GoHome; safecall;
procedure GoSearch; safecall;
procedure Navigate(const URL: WideString; var Flags, TargetFrameName, PostData, Headers: OleVariant); safecall;
procedure Refresh; safecall;
procedure Refresh2(var Level: OleVariant); safecall;
procedure Stop; safecall;
function Get_Application: IDispatch; safecall;
function Get_Parent: IDispatch; safecall;
function Get_Container: IDispatch; safecall;
function Get_Document: IDispatch; safecall;
function Get_TopLevelContainer: WordBool; safecall;
function Get_Type_: WideString; safecall;
function Get_Left: Integer; safecall;
procedure Set_Left(Value: Integer); safecall;
function Get_Top: Integer; safecall;
procedure Set_Top(Value: Integer); safecall;
function Get_Width: Integer; safecall;
procedure Set_Width(Value: Integer); safecall;
function Get_Height: Integer; safecall;
procedure Set_Height(Value: Integer); safecall;
function Get_LocationName: WideString; safecall;
function Get_LocationURL: WideString; safecall;
function Get_Busy: WordBool; safecall;
property Application: IDispatch read Get_Application;
property Parent: IDispatch read Get_Parent;
property Container: IDispatch read Get_Container;
property Document: IDispatch read Get_Document;
property TopLevelContainer: WordBool read Get_TopLevelContainer;
property Type_: WideString read Get_Type_;
property Left: Integer read Get_Left write Set_Left;
property Top: Integer read Get_Top write Set_Top;
property Width: Integer read Get_Width write Set_Width;
property Height: Integer read Get_Height write Set_Height;
property LocationName: WideString read Get_LocationName;
property LocationURL: WideString read Get_LocationURL;
property Busy: WordBool read Get_Busy;
end;
{ DispInterface declaration for Dual Interface IWebBrowser }
IWebBrowserDisp = dispinterface
['{EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B}']
procedure GoBack; dispid 100;
procedure GoForward; dispid 101;
procedure GoHome; dispid 102;
procedure GoSearch; dispid 103;
procedure Navigate(const URL: WideString; var Flags, TargetFrameName, PostData, Headers: OleVariant); dispid 104;
procedure Refresh; dispid -550;
procedure Refresh2(var Level: OleVariant); dispid 105;
procedure Stop; dispid 106;
property Application: IDispatch readonly dispid 200;
property Parent: IDispatch readonly dispid 201;
property Container: IDispatch readonly dispid 202;
property Document: IDispatch readonly dispid 203;
property TopLevelContainer: WordBool readonly dispid 204;
property Type_: WideString readonly dispid 205;
property Left: Integer dispid 206;
property Top: Integer dispid 207;
property Width: Integer dispid 208;
property Height: Integer dispid 209;
property LocationName: WideString readonly dispid 210;
property LocationURL: WideString readonly dispid 211;
property Busy: WordBool readonly dispid 212;
end;
{ Web Browser Control Events (old) }
DWebBrowserEvents = dispinterface
['{EAB22AC2-30C1-11CF-A7EB-0000C05BAE0B}']
procedure BeforeNavigate(const URL: WideString; Flags: Integer; const TargetFrameName: WideString; var PostData: OleVariant; const Headers: WideString; var Cancel: WordBool); dispid 100;
procedure NavigateComplete(const URL: WideString); dispid 101;
procedure StatusTextChange(const Text: WideString); dispid 102;
procedure ProgressChange(Progress, ProgressMax: Integer); dispid 108;
procedure DownloadComplete; dispid 104;
procedure CommandStateChange(Command: Integer; Enable: WordBool); dispid 105;
procedure DownloadBegin; dispid 106;
procedure NewWindow(const URL: WideString; Flags: Integer; const TargetFrameName: WideString; var PostData: OleVariant; const Headers: WideString; var Processed: WordBool); dispid 107;
procedure TitleChange(const Text: WideString); dispid 113;
procedure FrameBeforeNavigate(const URL: WideString; Flags: Integer; const TargetFrameName: WideString; var PostData: OleVariant; const Headers: WideString; var Cancel: WordBool); dispid 200;
procedure FrameNavigateComplete(const URL: WideString); dispid 201;
procedure FrameNewWindow(const URL: WideString; Flags: Integer; const TargetFrameName: WideString; var PostData: OleVariant; const Headers: WideString; var Processed: WordBool); dispid 204;
procedure Quit(var Cancel: WordBool); dispid 103;
procedure WindowMove; dispid 109;
procedure WindowResize; dispid 110;
procedure WindowActivate; dispid 111;
procedure PropertyChange(const Property_: WideString); dispid 112;
end;
{ Web Browser Application Interface. }
IWebBrowserApp = interface(IWebBrowser)
['{0002DF05-0000-0000-C000-000000000046}']
procedure Quit; safecall;
procedure ClientToWindow(var pcx, pcy: SYSINT); safecall;
procedure PutProperty(const Property_: WideString; vtValue: OleVariant); safecall;
function GetProperty(const Property_: WideString): OleVariant; safecall;
function Get_Name: WideString; safecall;
function Get_HWND: Integer; safecall;
function Get_FullName: WideString; safecall;
function Get_Path: WideString; safecall;
function Get_Visible: WordBool; safecall;
procedure Set_Visible(Value: WordBool); safecall;
function Get_StatusBar: WordBool; safecall;
procedure Set_StatusBar(Value: WordBool); safecall;
function Get_StatusText: WideString; safecall;
procedure Set_StatusText(const Value: WideString); safecall;
function Get_ToolBar: SYSINT; safecall;
procedure Set_ToolBar(Value: SYSINT); safecall;
function Get_MenuBar: WordBool; safecall;
procedure Set_MenuBar(Value: WordBool); safecall;
function Get_FullScreen: WordBool; safecall;
procedure Set_FullScreen(Value: WordBool); safecall;
property Name: WideString read Get_Name;
property HWND: Integer read Get_HWND;
property FullName: WideString read Get_FullName;
property Path: WideString read Get_Path;
property Visible: WordBool read Get_Visible write Set_Visible;
property StatusBar: WordBool read Get_StatusBar write Set_StatusBar;
property StatusText: WideString read Get_StatusText write Set_StatusText;
property ToolBar: SYSINT read Get_ToolBar write Set_ToolBar;
property MenuBar: WordBool read Get_MenuBar write Set_MenuBar;
property FullScreen: WordBool read Get_FullScreen write Set_FullScreen;
end;
{ DispInterface declaration for Dual Interface IWebBrowserApp }
IWebBrowserAppDisp = dispinterface
['{0002DF05-0000-0000-C000-000000000046}']
procedure GoBack; dispid 100;
procedure GoForward; dispid 101;
procedure GoHome; dispid 102;
procedure GoSearch; dispid 103;
procedure Navigate(const URL: WideString; var Flags, TargetFrameName, PostData, Headers: OleVariant); dispid 104;
procedure Refresh; dispid -550;
procedure Refresh2(var Level: OleVariant); dispid 105;
procedure Stop; dispid 106;
property Application: IDispatch readonly dispid 200;
property Parent: IDispatch readonly dispid 201;
property Container: IDispatch readonly dispid 202;
property Document: IDispatch readonly dispid 203;
property TopLevelContainer: WordBool readonly dispid 204;
property Type_: WideString readonly dispid 205;
property Left: Integer dispid 206;
property Top: Integer dispid 207;
property Width: Integer dispid 208;
property Height: Integer dispid 209;
property LocationName: WideString readonly dispid 210;
property LocationURL: WideString readonly dispid 211;
property Busy: WordBool readonly dispid 212;
procedure Quit; dispid 300;
procedure ClientToWindow(var pcx, pcy: SYSINT); dispid 301;
procedure PutProperty(const Property_: WideString; vtValue: OleVariant); dispid 302;
function GetProperty(const Property_: WideString): OleVariant; dispid 303;
property Name: WideString readonly dispid 0;
property HWND: Integer readonly dispid -515;
property FullName: WideString readonly dispid 400;
property Path: WideString readonly dispid 401;
property Visible: WordBool dispid 402;
property StatusBar: WordBool dispid 403;
property StatusText: WideString dispid 404;
property ToolBar: SYSINT dispid 405;
property MenuBar: WordBool dispid 406;
property FullScreen: WordBool dispid 407;
end;
{ Web Browser Interface for IE4. }
IWebBrowser2 = interface(IWebBrowserApp)
['{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}']
procedure Navigate2(var URL, Flags, TargetFrameName, PostData, Headers: OleVariant); safecall;
function QueryStatusWB(cmdID: OLECMDID): OLECMDF; safecall;
procedure ExecWB(cmdID: OLECMDID; cmdexecopt: OLECMDEXECOPT; var pvaIn, pvaOut: OleVariant); safecall;
procedure ShowBrowserBar(var pvaClsid, pvarShow, pvarSize: OleVariant); safecall;
function Get_ReadyState: tagREADYSTATE; safecall;
function Get_Offline: WordBool; safecall;
procedure Set_Offline(Value: WordBool); safecall;
function Get_Silent: WordBool; safecall;
procedure Set_Silent(Value: WordBool); safecall;
function Get_RegisterAsBrowser: WordBool; safecall;
procedure Set_RegisterAsBrowser(Value: WordBool); safecall;
function Get_RegisterAsDropTarget: WordBool; safecall;
procedure Set_RegisterAsDropTarget(Value: WordBool); safecall;
function Get_TheaterMode: WordBool; safecall;
procedure Set_TheaterMode(Value: WordBool); safecall;
function Get_AddressBar: WordBool; safecall;
procedure Set_AddressBar(Value: WordBool); safecall;
function Get_Resizable: WordBool; safecall;
procedure Set_Resizable(Value: WordBool); safecall;
property ReadyState: tagREADYSTATE read Get_ReadyState;
property Offline: WordBool read Get_Offline write Set_Offline;
property Silent: WordBool read Get_Silent write Set_Silent;
property RegisterAsBrowser: WordBool read Get_RegisterAsBrowser write Set_RegisterAsBrowser;
property RegisterAsDropTarget: WordBool read Get_RegisterAsDropTarget write Set_RegisterAsDropTarget;
property TheaterMode: WordBool read Get_TheaterMode write Set_TheaterMode;
property AddressBar: WordBool read Get_AddressBar write Set_AddressBar;
property Resizable: WordBool read Get_Resizable write Set_Resizable;
end;
{ DispInterface declaration for Dual Interface IWebBrowser2 }
IWebBrowser2Disp = dispinterface
['{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}']
procedure GoBack; dispid 100;
procedure GoForward; dispid 101;
procedure GoHome; dispid 102;
procedure GoSearch; dispid 103;
procedure Navigate(const URL: WideString; var Flags, TargetFrameName, PostData, Headers: OleVariant); dispid 104;
procedure Refresh; dispid -550;
procedure Refresh2(var Level: OleVariant); dispid 105;
procedure Stop; dispid 106;
property Application: IDispatch readonly dispid 200;
property Parent: IDispatch readonly dispid 201;
property Container: IDispatch readonly dispid 202;
property Document: IDispatch readonly dispid 203;
property TopLevelContainer: WordBool readonly dispid 204;
property Type_: WideString readonly dispid 205;
property Left: Integer dispid 206;
property Top: Integer dispid 207;
property Width: Integer dispid 208;
property Height: Integer dispid 209;
property LocationName: WideString readonly dispid 210;
property LocationURL: WideString readonly dispid 211;
property Busy: WordBool readonly dispid 212;
procedure Quit; dispid 300;
procedure ClientToWindow(var pcx, pcy: SYSINT); dispid 301;
procedure PutProperty(const Property_: WideString; vtValue: OleVariant); dispid 302;
function GetProperty(const Property_: WideString): OleVariant; dispid 303;
property Name: WideString readonly dispid 0;
property HWND: Integer readonly dispid -515;
property FullName: WideString readonly dispid 400;
property Path: WideString readonly dispid 401;
property Visible: WordBool dispid 402;
property StatusBar: WordBool dispid 403;
property StatusText: WideString dispid 404;
property ToolBar: SYSINT dispid 405;
property MenuBar: WordBool dispid 406;
property FullScreen: WordBool dispid 407;
procedure Navigate2(var URL, Flags, TargetFrameName, PostData, Headers: OleVariant); dispid 500;
function QueryStatusWB(cmdID: OLECMDID): OLECMDF; dispid 501;
procedure ExecWB(cmdID: OLECMDID; cmdexecopt: OLECMDEXECOPT; var pvaIn, pvaOut: OleVariant); dispid 502;
procedure ShowBrowserBar(var pvaClsid, pvarShow, pvarSize: OleVariant); dispid 503;
property ReadyState: tagREADYSTATE readonly dispid -525;
property Offline: WordBool dispid 550;
property Silent: WordBool dispid 551;
property RegisterAsBrowser: WordBool dispid 552;
property RegisterAsDropTarget: WordBool dispid 553;
property TheaterMode: WordBool dispid 554;
property AddressBar: WordBool dispid 555;
property Resizable: WordBool dispid 556;
end;
{ Web Browser Control events interface }
DWebBrowserEvents2 = dispinterface
['{34A715A0-6587-11D0-924A-0020AFC7AC4D}']
procedure StatusTextChange(const Text: WideString); dispid 102;
procedure ProgressChange(Progress, ProgressMax: Integer); dispid 108;
procedure CommandStateChange(Command: Integer; Enable: WordBool); dispid 105;
procedure DownloadBegin; dispid 106;
procedure DownloadComplete; dispid 104;
procedure TitleChange(const Text: WideString); dispid 113;
procedure PropertyChange(const szProperty: WideString); dispid 112;
procedure BeforeNavigate2(pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool); dispid 250;
procedure NewWindow2(var ppDisp: IDispatch; var Cancel: WordBool); dispid 251;
procedure NavigateComplete2(pDisp: IDispatch; var URL: OleVariant); dispid 252;
procedure DocumentComplete(pDisp: IDispatch; var URL: OleVariant); dispid 259;
procedure OnQuit; dispid 253;
procedure OnVisible(Visible: WordBool); dispid 254;
procedure OnToolBar(ToolBar: WordBool); dispid 255;
procedure OnMenuBar(MenuBar: WordBool); dispid 256;
procedure OnStatusBar(StatusBar: WordBool); dispid 257;
procedure OnFullScreen(FullScreen: WordBool); dispid 258;
procedure OnTheaterMode(TheaterMode: WordBool); dispid 260;
end;
{ Event interface for IShellWindows }
DShellWindowsEvents = dispinterface
['{FE4106E0-399A-11D0-A48C-00A0C90A8F39}']
procedure WindowRegistered(lCookie: Integer); dispid 200;
procedure WindowRevoked(lCookie: Integer); dispid 201;
end;
{ Definition of interface IShellWindows }
IShellWindows = interface(IDispatch)
['{85CB6900-4D95-11CF-960C-0080C7F4EE85}']
function Get_Count: Integer; safecall;
function Item(index: OleVariant): IDispatch; safecall;
function _NewEnum: IUnknown; safecall;
procedure Register(pid: IDispatch; HWND: Integer; swClass: SYSINT; out plCookie: Integer); safecall;
procedure RegisterPending(lThreadId: Integer; var pvarloc, pvarlocRoot: OleVariant; swClass: SYSINT; out plCookie: Integer); safecall;
procedure Revoke(lCookie: Integer); safecall;
procedure OnNavigate(lCookie: Integer; var pvarloc: OleVariant); safecall;
procedure OnActivated(lCookie: Integer; fActive: WordBool); safecall;
function FindWindow(var pvarloc, pvarlocRoot: OleVariant; swClass: SYSINT; out pHWND: Integer; swfwOptions: SYSINT): IDispatch; safecall;
procedure OnCreated(lCookie: Integer; punk: IUnknown); safecall;
procedure ProcessAttachDetach(fAttach: WordBool); safecall;
property Count: Integer read Get_Count;
end;
{ DispInterface declaration for Dual Interface IShellWindows }
IShellWindowsDisp = dispinterface
['{85CB6900-4D95-11CF-960C-0080C7F4EE85}']
property Count: Integer readonly dispid 1610743808;
function Item(index: OleVariant): IDispatch; dispid 0;
function _NewEnum: IUnknown; dispid -4;
procedure Register(pid: IDispatch; HWND: Integer; swClass: SYSINT; out plCookie: Integer); dispid 1610743811;
procedure RegisterPending(lThreadId: Integer; var pvarloc, pvarlocRoot: OleVariant; swClass: SYSINT; out plCookie: Integer); dispid 1610743812;
procedure Revoke(lCookie: Integer); dispid 1610743813;
procedure OnNavigate(lCookie: Integer; var pvarloc: OleVariant); dispid 1610743814;
procedure OnActivated(lCookie: Integer; fActive: WordBool); dispid 1610743815;
function FindWindow(var pvarloc, pvarlocRoot: OleVariant; swClass: SYSINT; out pHWND: Integer; swfwOptions: SYSINT): IDispatch; dispid 1610743816;
procedure OnCreated(lCookie: Integer; punk: IUnknown); dispid 1610743817;
procedure ProcessAttachDetach(fAttach: WordBool); dispid 1610743818;
end;
{ Shell UI Helper Control Interface }
IShellUIHelper = interface(IDispatch)
['{729FE2F8-1EA8-11D1-8F85-00C04FC2FBE1}']
procedure ResetFirstBootMode; safecall;
procedure ResetSafeMode; safecall;
procedure RefreshOfflineDesktop; safecall;
procedure AddFavorite(const URL: WideString; var Title: OleVariant); safecall;
procedure AddChannel(const URL: WideString); safecall;
procedure AddDesktopComponent(const URL, Type_: WideString; var Left, Top, Width, Height: OleVariant); safecall;
function IsSubscribed(const URL: WideString): WordBool; safecall;
procedure NavigateAndFind(const URL, strQuery: WideString; var varTargetFrame: OleVariant); safecall;
procedure ImportExportFavorites(fImport: WordBool; const strImpExpPath: WideString); safecall;
procedure AutoCompleteSaveForm(var Form: OleVariant); safecall;
procedure AutoScan(const strSearch, strFailureUrl: WideString; var pvarTargetFrame: OleVariant); safecall;
procedure AutoCompleteAttach(var Reserved: OleVariant); safecall;
function ShowBrowserUI(const bstrName: WideString; var pvarIn: OleVariant): OleVariant; safecall;
end;
{ DispInterface declaration for Dual Interface IShellUIHelper }
IShellUIHelperDisp = dispinterface
['{729FE2F8-1EA8-11D1-8F85-00C04FC2FBE1}']
procedure ResetFirstBootMode; dispid 1;
procedure ResetSafeMode; dispid 2;
procedure RefreshOfflineDesktop; dispid 3;
procedure AddFavorite(const URL: WideString; var Title: OleVariant); dispid 4;
procedure AddChannel(const URL: WideString); dispid 5;
procedure AddDesktopComponent(const URL, Type_: WideString; var Left, Top, Width, Height: OleVariant); dispid 6;
function IsSubscribed(const URL: WideString): WordBool; dispid 7;
procedure NavigateAndFind(const URL, strQuery: WideString; var varTargetFrame: OleVariant); dispid 8;
procedure ImportExportFavorites(fImport: WordBool; const strImpExpPath: WideString); dispid 9;
procedure AutoCompleteSaveForm(var Form: OleVariant); dispid 10;
procedure AutoScan(const strSearch, strFailureUrl: WideString; var pvarTargetFrame: OleVariant); dispid 11;
procedure AutoCompleteAttach(var Reserved: OleVariant); dispid 12;
function ShowBrowserUI(const bstrName: WideString; var pvarIn: OleVariant): OleVariant; dispid 13;
end;
_ShellFavoritesNameSpaceEvents = dispinterface
['{55136806-B2DE-11D1-B9F2-00A0C98BC547}']
procedure FavoritesSelectionChange(cItems, hItem: Integer; const strName, strUrl: WideString; cVisits: Integer; const strDate: WideString; fAvailableOffline: Integer); dispid 1;
end;
{ IShellFavoritesNameSpace Interface }
IShellFavoritesNameSpace = interface(IDispatch)
['{55136804-B2DE-11D1-B9F2-00A0C98BC547}']
procedure MoveSelectionUp; safecall;
procedure MoveSelectionDown; safecall;
procedure ResetSort; safecall;
procedure NewFolder; safecall;
procedure Synchronize; safecall;
procedure Import; safecall;
procedure Export; safecall;
procedure InvokeContextMenuCommand(const strCommand: WideString); safecall;
procedure MoveSelectionTo; safecall;
function Get_FOfflinePackInstalled: WordBool; safecall;
function CreateSubscriptionForSelection: WordBool; safecall;
function DeleteSubscriptionForSelection: WordBool; safecall;
procedure SetRoot(const bstrFullPath: WideString); safecall;
property FOfflinePackInstalled: WordBool read Get_FOfflinePackInstalled;
end;
{ DispInterface declaration for Dual Interface IShellFavoritesNameSpace }
IShellFavoritesNameSpaceDisp = dispinterface
['{55136804-B2DE-11D1-B9F2-00A0C98BC547}']
procedure MoveSelectionUp; dispid 1;
procedure MoveSelectionDown; dispid 2;
procedure ResetSort; dispid 3;
procedure NewFolder; dispid 4;
procedure Synchronize; dispid 5;
procedure Import; dispid 6;
procedure Export; dispid 7;
procedure InvokeContextMenuCommand(const strCommand: WideString); dispid 8;
procedure MoveSelectionTo; dispid 9;
property FOfflinePackInstalled: WordBool readonly dispid 10;
function CreateSubscriptionForSelection: WordBool; dispid 11;
function DeleteSubscriptionForSelection: WordBool; dispid 12;
procedure SetRoot(const bstrFullPath: WideString); dispid 13;
end;
{ Script Error List Interface }
IScriptErrorList = interface(IDispatch)
['{F3470F24-15FD-11D2-BB2E-00805FF7EFCA}']
procedure advanceError; safecall;
procedure retreatError; safecall;
function canAdvanceError: Integer; safecall;
function canRetreatError: Integer; safecall;
function getErrorLine: Integer; safecall;
function getErrorChar: Integer; safecall;
function getErrorCode: Integer; safecall;
function getErrorMsg: WideString; safecall;
function getErrorUrl: WideString; safecall;
function getAlwaysShowLockState: Integer; safecall;
function getDetailsPaneOpen: Integer; safecall;
procedure setDetailsPaneOpen(fDetailsPaneOpen: Integer); safecall;
function getPerErrorDisplay: Integer; safecall;
procedure setPerErrorDisplay(fPerErrorDisplay: Integer); safecall;
end;
{ DispInterface declaration for Dual Interface IScriptErrorList }
IScriptErrorListDisp = dispinterface
['{F3470F24-15FD-11D2-BB2E-00805FF7EFCA}']
procedure advanceError; dispid 10;
procedure retreatError; dispid 11;
function canAdvanceError: Integer; dispid 12;
function canRetreatError: Integer; dispid 13;
function getErrorLine: Integer; dispid 14;
function getErrorChar: Integer; dispid 15;
function getErrorCode: Integer; dispid 16;
function getErrorMsg: WideString; dispid 17;
function getErrorUrl: WideString; dispid 18;
function getAlwaysShowLockState: Integer; dispid 23;
function getDetailsPaneOpen: Integer; dispid 19;
procedure setDetailsPaneOpen(fDetailsPaneOpen: Integer); dispid 20;
function getPerErrorDisplay: Integer; dispid 21;
procedure setPerErrorDisplay(fPerErrorDisplay: Integer); dispid 22;
end;
{ Enumerated Search }
ISearch = interface(IDispatch)
['{BA9239A4-3DD5-11D2-BF8B-00C04FB93661}']
function Get_Title: WideString; safecall;
function Get_Id: WideString; safecall;
function Get_URL: WideString; safecall;
property Title: WideString read Get_Title;
property Id: WideString read Get_Id;
property URL: WideString read Get_URL;
end;
{ DispInterface declaration for Dual Interface ISearch }
ISearchDisp = dispinterface
['{BA9239A4-3DD5-11D2-BF8B-00C04FB93661}']
property Title: WideString readonly dispid 1610743808;
property Id: WideString readonly dispid 1610743809;
property URL: WideString readonly dispid 1610743810;
end;
{ Searches Enum }
ISearches = interface(IDispatch)
['{47C922A2-3DD5-11D2-BF8B-00C04FB93661}']
function Get_Count: Integer; safecall;
function Get_Default: WideString; safecall;
function Item(index: OleVariant): ISearch; safecall;
function _NewEnum: IUnknown; safecall;
property Count: Integer read Get_Count;
property Default: WideString read Get_Default;
end;
{ DispInterface declaration for Dual Interface ISearches }
ISearchesDisp = dispinterface
['{47C922A2-3DD5-11D2-BF8B-00C04FB93661}']
property Count: Integer readonly dispid 1610743808;
property Default: WideString readonly dispid 1610743809;
function Item(index: OleVariant): ISearch; dispid 1610743810;
function _NewEnum: IUnknown; dispid -4;
end;
{ ISearchAssistantOC Interface }
ISearchAssistantOC = interface(IDispatch)
['{72423E8F-8011-11D2-BE79-00A0C9A83DA1}']
procedure AddNextMenuItem(const bstrText: WideString; idItem: Integer); safecall;
procedure SetDefaultSearchUrl(const bstrUrl: WideString); safecall;
procedure NavigateToDefaultSearch; safecall;
function IsRestricted(const bstrGuid: WideString): WordBool; safecall;
function Get_ShellFeaturesEnabled: WordBool; safecall;
function Get_SearchAssistantDefault: WordBool; safecall;
function Get_Searches: ISearches; safecall;
function Get_InWebFolder: WordBool; safecall;
procedure PutProperty(bPerLocale: WordBool; const bstrName, bstrValue: WideString); safecall;
function GetProperty(bPerLocale: WordBool; const bstrName: WideString): WideString; safecall;
procedure Set_EventHandled(Value: WordBool); safecall;
procedure ResetNextMenu; safecall;
procedure FindOnWeb; safecall;
procedure FindFilesOrFolders; safecall;
procedure FindComputer; safecall;
procedure FindPrinter; safecall;
procedure FindPeople; safecall;
function GetSearchAssistantURL(bSubstitute, bCustomize: WordBool): WideString; safecall;
procedure NotifySearchSettingsChanged; safecall;
procedure Set_ASProvider(const Value: WideString); safecall;
function Get_ASProvider: WideString; safecall;
procedure Set_ASSetting(Value: SYSINT); safecall;
function Get_ASSetting: SYSINT; safecall;
procedure NETDetectNextNavigate; safecall;
procedure PutFindText(const FindText: WideString); safecall;
function Get_Version: SYSINT; safecall;
function EncodeString(const bstrValue, bstrCharSet: WideString; bUseUTF8: WordBool): WideString; safecall;
property ShellFeaturesEnabled: WordBool read Get_ShellFeaturesEnabled;
property SearchAssistantDefault: WordBool read Get_SearchAssistantDefault;
property Searches: ISearches read Get_Searches;
property InWebFolder: WordBool read Get_InWebFolder;
property EventHandled: WordBool write Set_EventHandled;
property ASProvider: WideString read Get_ASProvider write Set_ASProvider;
property ASSetting: SYSINT read Get_ASSetting write Set_ASSetting;
property Version: SYSINT read Get_Version;
end;
{ DispInterface declaration for Dual Interface ISearchAssistantOC }
ISearchAssistantOCDisp = dispinterface
['{72423E8F-8011-11D2-BE79-00A0C9A83DA1}']
procedure AddNextMenuItem(const bstrText: WideString; idItem: Integer); dispid 1;
procedure SetDefaultSearchUrl(const bstrUrl: WideString); dispid 2;
procedure NavigateToDefaultSearch; dispid 3;
function IsRestricted(const bstrGuid: WideString): WordBool; dispid 4;
property ShellFeaturesEnabled: WordBool readonly dispid 5;
property SearchAssistantDefault: WordBool readonly dispid 6;
property Searches: ISearches readonly dispid 7;
property InWebFolder: WordBool readonly dispid 8;
procedure PutProperty(bPerLocale: WordBool; const bstrName, bstrValue: WideString); dispid 9;
function GetProperty(bPerLocale: WordBool; const bstrName: WideString): WideString; dispid 10;
property EventHandled: WordBool writeonly dispid 11;
procedure ResetNextMenu; dispid 12;
procedure FindOnWeb; dispid 13;
procedure FindFilesOrFolders; dispid 14;
procedure FindComputer; dispid 15;
procedure FindPrinter; dispid 16;
procedure FindPeople; dispid 17;
function GetSearchAssistantURL(bSubstitute, bCustomize: WordBool): WideString; dispid 18;
procedure NotifySearchSettingsChanged; dispid 19;
property ASProvider: WideString dispid 20;
property ASSetting: SYSINT dispid 21;
procedure NETDetectNextNavigate; dispid 22;
procedure PutFindText(const FindText: WideString); dispid 23;
property Version: SYSINT readonly dispid 24;
function EncodeString(const bstrValue, bstrCharSet: WideString; bUseUTF8: WordBool): WideString; dispid 25;
end;
{ ISearchAssistantOC2 Interface }
ISearchAssistantOC2 = interface(ISearchAssistantOC)
['{72423E8F-8011-11D2-BE79-00A0C9A83DA2}']
function Get_ShowFindPrinter: WordBool; safecall;
property ShowFindPrinter: WordBool read Get_ShowFindPrinter;
end;
{ DispInterface declaration for Dual Interface ISearchAssistantOC2 }
ISearchAssistantOC2Disp = dispinterface
['{72423E8F-8011-11D2-BE79-00A0C9A83DA2}']
procedure AddNextMenuItem(const bstrText: WideString; idItem: Integer); dispid 1;
procedure SetDefaultSearchUrl(const bstrUrl: WideString); dispid 2;
procedure NavigateToDefaultSearch; dispid 3;
function IsRestricted(const bstrGuid: WideString): WordBool; dispid 4;
property ShellFeaturesEnabled: WordBool readonly dispid 5;
property SearchAssistantDefault: WordBool readonly dispid 6;
property Searches: ISearches readonly dispid 7;
property InWebFolder: WordBool readonly dispid 8;
procedure PutProperty(bPerLocale: WordBool; const bstrName, bstrValue: WideString); dispid 9;
function GetProperty(bPerLocale: WordBool; const bstrName: WideString): WideString; dispid 10;
property EventHandled: WordBool writeonly dispid 11;
procedure ResetNextMenu; dispid 12;
procedure FindOnWeb; dispid 13;
procedure FindFilesOrFolders; dispid 14;
procedure FindComputer; dispid 15;
procedure FindPrinter; dispid 16;
procedure FindPeople; dispid 17;
function GetSearchAssistantURL(bSubstitute, bCustomize: WordBool): WideString; dispid 18;
procedure NotifySearchSettingsChanged; dispid 19;
property ASProvider: WideString dispid 20;
property ASSetting: SYSINT dispid 21;
procedure NETDetectNextNavigate; dispid 22;
procedure PutFindText(const FindText: WideString); dispid 23;
property Version: SYSINT readonly dispid 24;
function EncodeString(const bstrValue, bstrCharSet: WideString; bUseUTF8: WordBool): WideString; dispid 25;
property ShowFindPrinter: WordBool readonly dispid 26;
end;
_SearchAssistantEvents = dispinterface
['{1611FDDA-445B-11D2-85DE-00C04FA35C89}']
procedure OnNextMenuSelect(idItem: Integer); dispid 1;
procedure OnNewSearch; dispid 2;
end;
{ WebBrowser Control }
TWebBrowser_V1BeforeNavigate = procedure(Sender: TObject; const URL: WideString; Flags: Integer; const TargetFrameName: WideString; var PostData: OleVariant; const Headers: WideString; var Cancel: WordBool) of object;
TWebBrowser_V1NavigateComplete = procedure(Sender: TObject; const URL: WideString) of object;
TWebBrowser_V1StatusTextChange = procedure(Sender: TObject; const Text: WideString) of object;
TWebBrowser_V1ProgressChange = procedure(Sender: TObject; Progress, ProgressMax: Integer) of object;
TWebBrowser_V1CommandStateChange = procedure(Sender: TObject; Command: Integer; Enable: WordBool) of object;
TWebBrowser_V1NewWindow = procedure(Sender: TObject; const URL: WideString; Flags: Integer; const TargetFrameName: WideString; var PostData: OleVariant; const Headers: WideString; var Processed: WordBool) of object;
TWebBrowser_V1TitleChange = procedure(Sender: TObject; const Text: WideString) of object;
TWebBrowser_V1FrameBeforeNavigate = procedure(Sender: TObject; const URL: WideString; Flags: Integer; const TargetFrameName: WideString; var PostData: OleVariant; const Headers: WideString; var Cancel: WordBool) of object;
TWebBrowser_V1FrameNavigateComplete = procedure(Sender: TObject; const URL: WideString) of object;
TWebBrowser_V1FrameNewWindow = procedure(Sender: TObject; const URL: WideString; Flags: Integer; const TargetFrameName: WideString; var PostData: OleVariant; const Headers: WideString; var Processed: WordBool) of object;
TWebBrowser_V1Quit = procedure(Sender: TObject; var Cancel: WordBool) of object;
TWebBrowser_V1PropertyChange = procedure(Sender: TObject; const Property_: WideString) of object;
TWebBrowser_V1 = class(TOleControl)
private
FOnBeforeNavigate: TWebBrowser_V1BeforeNavigate;
FOnNavigateComplete: TWebBrowser_V1NavigateComplete;
FOnStatusTextChange: TWebBrowser_V1StatusTextChange;
FOnProgressChange: TWebBrowser_V1ProgressChange;
FOnDownloadComplete: TNotifyEvent;
FOnCommandStateChange: TWebBrowser_V1CommandStateChange;
FOnDownloadBegin: TNotifyEvent;
FOnNewWindow: TWebBrowser_V1NewWindow;
FOnTitleChange: TWebBrowser_V1TitleChange;
FOnFrameBeforeNavigate: TWebBrowser_V1FrameBeforeNavigate;
FOnFrameNavigateComplete: TWebBrowser_V1FrameNavigateComplete;
FOnFrameNewWindow: TWebBrowser_V1FrameNewWindow;
FOnQuit: TWebBrowser_V1Quit;
FOnWindowMove: TNotifyEvent;
FOnWindowResize: TNotifyEvent;
FOnWindowActivate: TNotifyEvent;
FOnPropertyChange: TWebBrowser_V1PropertyChange;
FIntf: IWebBrowser;
function GetControlInterface: IWebBrowser;
protected
procedure CreateControl;
procedure InitControlData; override;
function GetTOleEnumProp(Index: Integer): TOleEnum;
procedure SetTOleEnumProp(Index: Integer; Value: TOleEnum);
public
procedure GoBack;
procedure GoForward;
procedure GoHome;
procedure GoSearch;
procedure Navigate(const URL: WideString; var Flags, TargetFrameName, PostData, Headers: OleVariant);
procedure Refresh;
procedure Refresh2(var Level: OleVariant);
procedure Stop;
property ControlInterface: IWebBrowser read GetControlInterface;
property Application: IDispatch index 200 read GetIDispatchProp;
property Parent: IDispatch index 201 read GetIDispatchProp;
property Container: IDispatch index 202 read GetIDispatchProp;
property Document: IDispatch index 203 read GetIDispatchProp;
property TopLevelContainer: WordBool index 204 read GetWordBoolProp;
property Type_: WideString index 205 read GetWideStringProp;
property LocationName: WideString index 210 read GetWideStringProp;
property LocationURL: WideString index 211 read GetWideStringProp;
property Busy: WordBool index 212 read GetWordBoolProp;
published
property TabStop;
property Align;
property DragCursor;
property DragMode;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property Visible;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnStartDrag;
property OnBeforeNavigate: TWebBrowser_V1BeforeNavigate read FOnBeforeNavigate write FOnBeforeNavigate;
property OnNavigateComplete: TWebBrowser_V1NavigateComplete read FOnNavigateComplete write FOnNavigateComplete;
property OnStatusTextChange: TWebBrowser_V1StatusTextChange read FOnStatusTextChange write FOnStatusTextChange;
property OnProgressChange: TWebBrowser_V1ProgressChange read FOnProgressChange write FOnProgressChange;
property OnDownloadComplete: TNotifyEvent read FOnDownloadComplete write FOnDownloadComplete;
property OnCommandStateChange: TWebBrowser_V1CommandStateChange read FOnCommandStateChange write FOnCommandStateChange;
property OnDownloadBegin: TNotifyEvent read FOnDownloadBegin write FOnDownloadBegin;
property OnNewWindow: TWebBrowser_V1NewWindow read FOnNewWindow write FOnNewWindow;
property OnTitleChange: TWebBrowser_V1TitleChange read FOnTitleChange write FOnTitleChange;
property OnFrameBeforeNavigate: TWebBrowser_V1FrameBeforeNavigate read FOnFrameBeforeNavigate write FOnFrameBeforeNavigate;
property OnFrameNavigateComplete: TWebBrowser_V1FrameNavigateComplete read FOnFrameNavigateComplete write FOnFrameNavigateComplete;
property OnFrameNewWindow: TWebBrowser_V1FrameNewWindow read FOnFrameNewWindow write FOnFrameNewWindow;
property OnQuit: TWebBrowser_V1Quit read FOnQuit write FOnQuit;
property OnWindowMove: TNotifyEvent read FOnWindowMove write FOnWindowMove;
property OnWindowResize: TNotifyEvent read FOnWindowResize write FOnWindowResize;
property OnWindowActivate: TNotifyEvent read FOnWindowActivate write FOnWindowActivate;
property OnPropertyChange: TWebBrowser_V1PropertyChange read FOnPropertyChange write FOnPropertyChange;
end;
{ WebBrowser Control }
TWebBrowserStatusTextChange = procedure(Sender: TObject; const Text: WideString) of object;
TWebBrowserProgressChange = procedure(Sender: TObject; Progress, ProgressMax: Integer) of object;
TWebBrowserCommandStateChange = procedure(Sender: TObject; Command: Integer; Enable: WordBool) of object;
TWebBrowserTitleChange = procedure(Sender: TObject; const Text: WideString) of object;
TWebBrowserPropertyChange = procedure(Sender: TObject; const szProperty: WideString) of object;
TWebBrowserBeforeNavigate2 = procedure(Sender: TObject; pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool) of object;
TWebBrowserNewWindow2 = procedure(Sender: TObject; var ppDisp: IDispatch; var Cancel: WordBool) of object;
TWebBrowserNavigateComplete2 = procedure(Sender: TObject; pDisp: IDispatch; var URL: OleVariant) of object;
TWebBrowserDocumentComplete = procedure(Sender: TObject; pDisp: IDispatch; var URL: OleVariant) of object;
TWebBrowserOnVisible = procedure(Sender: TObject; Visible: WordBool) of object;
TWebBrowserOnToolBar = procedure(Sender: TObject; ToolBar: WordBool) of object;
TWebBrowserOnMenuBar = procedure(Sender: TObject; MenuBar: WordBool) of object;
TWebBrowserOnStatusBar = procedure(Sender: TObject; StatusBar: WordBool) of object;
TWebBrowserOnFullScreen = procedure(Sender: TObject; FullScreen: WordBool) of object;
TWebBrowserOnTheaterMode = procedure(Sender: TObject; TheaterMode: WordBool) of object;
TWebBrowser = class(TOleControl)
private
FOnStatusTextChange: TWebBrowserStatusTextChange;
FOnProgressChange: TWebBrowserProgressChange;
FOnCommandStateChange: TWebBrowserCommandStateChange;
FOnDownloadBegin: TNotifyEvent;
FOnDownloadComplete: TNotifyEvent;
FOnTitleChange: TWebBrowserTitleChange;
FOnPropertyChange: TWebBrowserPropertyChange;
FOnBeforeNavigate2: TWebBrowserBeforeNavigate2;
FOnNewWindow2: TWebBrowserNewWindow2;
FOnNavigateComplete2: TWebBrowserNavigateComplete2;
FOnDocumentComplete: TWebBrowserDocumentComplete;
FOnQuit: TNotifyEvent;
FOnVisible: TWebBrowserOnVisible;
FOnToolBar: TWebBrowserOnToolBar;
FOnMenuBar: TWebBrowserOnMenuBar;
FOnStatusBar: TWebBrowserOnStatusBar;
FOnFullScreen: TWebBrowserOnFullScreen;
FOnTheaterMode: TWebBrowserOnTheaterMode;
FIntf: IWebBrowser2;
function GetControlInterface: IWebBrowser2;
protected
procedure CreateControl;
procedure InitControlData; override;
function GetTOleEnumProp(Index: Integer): TOleEnum;
procedure SetTOleEnumProp(Index: Integer; Value: TOleEnum);
public
procedure GoBack;
procedure GoForward;
procedure GoHome;
procedure GoSearch;
procedure Navigate(const URL: WideString; var Flags, TargetFrameName, PostData, Headers: OleVariant);
procedure Refresh;
procedure Refresh2(var Level: OleVariant);
procedure Stop;
procedure Quit;
procedure ClientToWindow(var pcx, pcy: SYSINT);
procedure PutProperty(const Property_: WideString; vtValue: OleVariant);
function GetProperty(const Property_: WideString): OleVariant;
procedure Navigate2(var URL, Flags, TargetFrameName, PostData, Headers: OleVariant);
function QueryStatusWB(cmdID: OLECMDID): OLECMDF;
procedure ExecWB(cmdID: OLECMDID; cmdexecopt: OLECMDEXECOPT; var pvaIn, pvaOut: OleVariant);
procedure ShowBrowserBar(var pvaClsid, pvarShow, pvarSize: OleVariant);
property ControlInterface: IWebBrowser2 read GetControlInterface;
property Application: IDispatch index 200 read GetIDispatchProp;
property Parent: IDispatch index 201 read GetIDispatchProp;
property Container: IDispatch index 202 read GetIDispatchProp;
property Document: IDispatch index 203 read GetIDispatchProp;
property TopLevelContainer: WordBool index 204 read GetWordBoolProp;
property Type_: WideString index 205 read GetWideStringProp;
property LocationName: WideString index 210 read GetWideStringProp;
property LocationURL: WideString index 211 read GetWideStringProp;
property Busy: WordBool index 212 read GetWordBoolProp;
property Name: WideString index 0 read GetWideStringProp;
property HWND: Integer index -515 read GetIntegerProp;
property FullName: WideString index 400 read GetWideStringProp;
property Path: WideString index 401 read GetWideStringProp;
property ReadyState: tagREADYSTATE index -525 read GetTOleEnumProp;
published
property TabStop;
property Align;
property DragCursor;
property DragMode;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnStartDrag;
property Visible: WordBool index 402 read GetWordBoolProp write SetWordBoolProp stored False;
property StatusBar: WordBool index 403 read GetWordBoolProp write SetWordBoolProp stored False;
property StatusText: WideString index 404 read GetWideStringProp write SetWideStringProp stored False;
property ToolBar: SYSINT index 405 read GetIntegerProp write SetIntegerProp stored False;
property MenuBar: WordBool index 406 read GetWordBoolProp write SetWordBoolProp stored False;
property FullScreen: WordBool index 407 read GetWordBoolProp write SetWordBoolProp stored False;
property Offline: WordBool index 550 read GetWordBoolProp write SetWordBoolProp stored False;
property Silent: WordBool index 551 read GetWordBoolProp write SetWordBoolProp stored False;
property RegisterAsBrowser: WordBool index 552 read GetWordBoolProp write SetWordBoolProp stored False;
property RegisterAsDropTarget: WordBool index 553 read GetWordBoolProp write SetWordBoolProp stored False;
property TheaterMode: WordBool index 554 read GetWordBoolProp write SetWordBoolProp stored False;
property AddressBar: WordBool index 555 read GetWordBoolProp write SetWordBoolProp stored False;
property Resizable: WordBool index 556 read GetWordBoolProp write SetWordBoolProp stored False;
property OnStatusTextChange: TWebBrowserStatusTextChange read FOnStatusTextChange write FOnStatusTextChange;
property OnProgressChange: TWebBrowserProgressChange read FOnProgressChange write FOnProgressChange;
property OnCommandStateChange: TWebBrowserCommandStateChange read FOnCommandStateChange write FOnCommandStateChange;
property OnDownloadBegin: TNotifyEvent read FOnDownloadBegin write FOnDownloadBegin;
property OnDownloadComplete: TNotifyEvent read FOnDownloadComplete write FOnDownloadComplete;
property OnTitleChange: TWebBrowserTitleChange read FOnTitleChange write FOnTitleChange;
property OnPropertyChange: TWebBrowserPropertyChange read FOnPropertyChange write FOnPropertyChange;
property OnBeforeNavigate2: TWebBrowserBeforeNavigate2 read FOnBeforeNavigate2 write FOnBeforeNavigate2;
property OnNewWindow2: TWebBrowserNewWindow2 read FOnNewWindow2 write FOnNewWindow2;
property OnNavigateComplete2: TWebBrowserNavigateComplete2 read FOnNavigateComplete2 write FOnNavigateComplete2;
property OnDocumentComplete: TWebBrowserDocumentComplete read FOnDocumentComplete write FOnDocumentComplete;
property OnQuit: TNotifyEvent read FOnQuit write FOnQuit;
property OnVisible: TWebBrowserOnVisible read FOnVisible write FOnVisible;
property OnToolBar: TWebBrowserOnToolBar read FOnToolBar write FOnToolBar;
property OnMenuBar: TWebBrowserOnMenuBar read FOnMenuBar write FOnMenuBar;
property OnStatusBar: TWebBrowserOnStatusBar read FOnStatusBar write FOnStatusBar;
property OnFullScreen: TWebBrowserOnFullScreen read FOnFullScreen write FOnFullScreen;
property OnTheaterMode: TWebBrowserOnTheaterMode read FOnTheaterMode write FOnTheaterMode;
end;
procedure Register;
implementation
uses ComObj;
procedure TWebBrowser_V1.InitControlData;
const
CEventDispIDs: array[0..16] of Integer = (
$00000064, $00000065, $00000066, $0000006C, $00000068, $00000069,
$0000006A, $0000006B, $00000071, $000000C8, $000000C9, $000000CC,
$00000067, $0000006D, $0000006E, $0000006F, $00000070);
CControlData: TControlData = (
ClassID: '{EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B}';
EventIID: '{EAB22AC2-30C1-11CF-A7EB-0000C05BAE0B}';
EventCount: 17;
EventDispIDs: @CEventDispIDs;
LicenseKey: nil;
Flags: $00000000;
Version: 300);
begin
ControlData := @CControlData;
end;
procedure TWebBrowser_V1.CreateControl;
procedure DoCreate;
begin
FIntf := IUnknown(OleObject) as IWebBrowser;
end;
begin
if FIntf = nil then DoCreate;
end;
function TWebBrowser_V1.GetControlInterface: IWebBrowser;
begin
CreateControl;
Result := FIntf;
end;
function TWebBrowser_V1.GetTOleEnumProp(Index: Integer): TOleEnum;
begin
Result := GetIntegerProp(Index);
end;
procedure TWebBrowser_V1.SetTOleEnumProp(Index: Integer; Value: TOleEnum);
begin
SetIntegerProp(Index, Value);
end;
procedure TWebBrowser_V1.GoBack;
begin
CreateControl;
FIntf.GoBack;
end;
procedure TWebBrowser_V1.GoForward;
begin
CreateControl;
FIntf.GoForward;
end;
procedure TWebBrowser_V1.GoHome;
begin
CreateControl;
FIntf.GoHome;
end;
procedure TWebBrowser_V1.GoSearch;
begin
CreateControl;
FIntf.GoSearch;
end;
procedure TWebBrowser_V1.Navigate(const URL: WideString; var Flags, TargetFrameName, PostData, Headers: OleVariant);
begin
CreateControl;
FIntf.Navigate(URL, Flags, TargetFrameName, PostData, Headers);
end;
procedure TWebBrowser_V1.Refresh;
begin
CreateControl;
FIntf.Refresh;
end;
procedure TWebBrowser_V1.Refresh2(var Level: OleVariant);
begin
CreateControl;
FIntf.Refresh2(Level);
end;
procedure TWebBrowser_V1.Stop;
begin
CreateControl;
FIntf.Stop;
end;
procedure TWebBrowser.InitControlData;
const
CEventDispIDs: array[0..17] of Integer = (
$00000066, $0000006C, $00000069, $0000006A, $00000068, $00000071,
$00000070, $000000FA, $000000FB, $000000FC, $00000103, $000000FD,
$000000FE, $000000FF, $00000100, $00000101, $00000102, $00000104);
CControlData: TControlData = (
ClassID: '{8856F961-340A-11D0-A96B-00C04FD705A2}';
EventIID: '{34A715A0-6587-11D0-924A-0020AFC7AC4D}';
EventCount: 18;
EventDispIDs: @CEventDispIDs;
LicenseKey: nil;
Flags: $00000000;
Version: 300);
begin
ControlData := @CControlData;
end;
procedure TWebBrowser.CreateControl;
procedure DoCreate;
begin
FIntf := IUnknown(OleObject) as IWebBrowser2;
end;
begin
if FIntf = nil then DoCreate;
end;
function TWebBrowser.GetControlInterface: IWebBrowser2;
begin
CreateControl;
Result := FIntf;
end;
function TWebBrowser.GetTOleEnumProp(Index: Integer): TOleEnum;
begin
Result := GetIntegerProp(Index);
end;
procedure TWebBrowser.SetTOleEnumProp(Index: Integer; Value: TOleEnum);
begin
SetIntegerProp(Index, Value);
end;
procedure TWebBrowser.GoBack;
begin
CreateControl;
FIntf.GoBack;
end;
procedure TWebBrowser.GoForward;
begin
CreateControl;
FIntf.GoForward;
end;
procedure TWebBrowser.GoHome;
begin
CreateControl;
FIntf.GoHome;
end;
procedure TWebBrowser.GoSearch;
begin
CreateControl;
FIntf.GoSearch;
end;
procedure TWebBrowser.Navigate(const URL: WideString; var Flags, TargetFrameName, PostData, Headers: OleVariant);
begin
CreateControl;
FIntf.Navigate(URL, Flags, TargetFrameName, PostData, Headers);
end;
procedure TWebBrowser.Refresh;
begin
CreateControl;
FIntf.Refresh;
end;
procedure TWebBrowser.Refresh2(var Level: OleVariant);
begin
CreateControl;
FIntf.Refresh2(Level);
end;
procedure TWebBrowser.Stop;
begin
CreateControl;
FIntf.Stop;
end;
procedure TWebBrowser.Quit;
begin
CreateControl;
FIntf.Quit;
end;
procedure TWebBrowser.ClientToWindow(var pcx, pcy: SYSINT);
begin
CreateControl;
FIntf.ClientToWindow(pcx, pcy);
end;
procedure TWebBrowser.PutProperty(const Property_: WideString; vtValue: OleVariant);
begin
CreateControl;
FIntf.PutProperty(Property_, vtValue);
end;
function TWebBrowser.GetProperty(const Property_: WideString): OleVariant;
begin
CreateControl;
Result := FIntf.GetProperty(Property_);
end;
procedure TWebBrowser.Navigate2(var URL, Flags, TargetFrameName, PostData, Headers: OleVariant);
begin
CreateControl;
FIntf.Navigate2(URL, Flags, TargetFrameName, PostData, Headers);
end;
function TWebBrowser.QueryStatusWB(cmdID: OLECMDID): OLECMDF;
begin
CreateControl;
Result := FIntf.QueryStatusWB(cmdID);
end;
procedure TWebBrowser.ExecWB(cmdID: OLECMDID; cmdexecopt: OLECMDEXECOPT; var pvaIn, pvaOut: OleVariant);
begin
CreateControl;
FIntf.ExecWB(cmdID, cmdexecopt, pvaIn, pvaOut);
end;
procedure TWebBrowser.ShowBrowserBar(var pvaClsid, pvarShow, pvarSize: OleVariant);
begin
CreateControl;
FIntf.ShowBrowserBar(pvaClsid, pvarShow, pvarSize);
end;
procedure Register;
begin
RegisterComponents('ActiveX', [TWebBrowser_V1, TWebBrowser]);
end;
end.
| 43.5 | 224 | 0.777825 |
85888e06ab71bb996d46c015e4aac15c10bceb96 | 48,131 | pas | Pascal | HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/CryptoLib/src/Crypto/HlpTiger.pas | devilking6105/HODLER-Open-Source-Multi-Asset-Wallet | 2554bce0ad3e3e08e4617787acf93176243ce758 | [
"Unlicense"
]
| 35 | 2018-11-04T12:02:34.000Z | 2022-02-15T06:00:19.000Z | HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/CryptoLib/src/Crypto/HlpTiger.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/Crypto/HlpTiger.pas | Ecoent/HODLER-Open-Source-Multi-Asset-Wallet | a8c54ecfc569d0ee959b6f0e7826c4ee4b5c4848 | [
"Unlicense"
]
| 34 | 2018-10-30T00:40:37.000Z | 2022-02-15T06:00:15.000Z | unit HlpTiger;
{$I ..\Include\HashLib.inc}
interface
uses
{$IFDEF HAS_UNITSCOPE}
System.SysUtils,
{$ELSE}
SysUtils,
{$ENDIF HAS_UNITSCOPE}
{$IFDEF DELPHI}
HlpBitConverter,
HlpHashBuffer,
HlpHash,
{$ENDIF DELPHI}
HlpHashLibTypes,
HlpConverters,
HlpHashRounds,
HlpIHash,
HlpIHashInfo,
HlpHashCryptoNotBuildIn;
resourcestring
SInvalidTigerHashSize =
'Tiger HashSize Must be Either 128 bit(16 byte), 160 bit(20 byte) or 192 bit(24 byte)';
SInvalidHashRound = 'Specified HashRound Is Invalid or UnSupported "%d"';
type
TTiger = class abstract(TBlockHash, ICryptoNotBuildIn, ITransformBlock)
strict private
{$REGION 'Consts'}
const
C1 = UInt64($A5A5A5A5A5A5A5A5);
C2 = UInt64($0123456789ABCDEF);
s_T1: array [0 .. 255] of UInt64 = (UInt64($02AAB17CF7E90C5E),
UInt64($AC424B03E243A8EC), UInt64($72CD5BE30DD5FCD3),
UInt64($6D019B93F6F97F3A), UInt64($CD9978FFD21F9193),
UInt64($7573A1C9708029E2), UInt64($B164326B922A83C3),
UInt64($46883EEE04915870), UInt64($EAACE3057103ECE6),
UInt64($C54169B808A3535C), UInt64($4CE754918DDEC47C),
UInt64($0AA2F4DFDC0DF40C), UInt64($10B76F18A74DBEFA),
UInt64($C6CCB6235AD1AB6A), UInt64($13726121572FE2FF),
UInt64($1A488C6F199D921E), UInt64($4BC9F9F4DA0007CA),
UInt64($26F5E6F6E85241C7), UInt64($859079DBEA5947B6),
UInt64($4F1885C5C99E8C92), UInt64($D78E761EA96F864B),
UInt64($8E36428C52B5C17D), UInt64($69CF6827373063C1),
UInt64($B607C93D9BB4C56E), UInt64($7D820E760E76B5EA),
UInt64($645C9CC6F07FDC42), UInt64($BF38A078243342E0),
UInt64($5F6B343C9D2E7D04), UInt64($F2C28AEB600B0EC6),
UInt64($6C0ED85F7254BCAC), UInt64($71592281A4DB4FE5),
UInt64($1967FA69CE0FED9F), UInt64($FD5293F8B96545DB),
UInt64($C879E9D7F2A7600B), UInt64($860248920193194E),
UInt64($A4F9533B2D9CC0B3), UInt64($9053836C15957613),
UInt64($DB6DCF8AFC357BF1), UInt64($18BEEA7A7A370F57),
UInt64($037117CA50B99066), UInt64($6AB30A9774424A35),
UInt64($F4E92F02E325249B), UInt64($7739DB07061CCAE1),
UInt64($D8F3B49CECA42A05), UInt64($BD56BE3F51382F73),
UInt64($45FAED5843B0BB28), UInt64($1C813D5C11BF1F83),
UInt64($8AF0E4B6D75FA169), UInt64($33EE18A487AD9999),
UInt64($3C26E8EAB1C94410), UInt64($B510102BC0A822F9),
UInt64($141EEF310CE6123B), UInt64($FC65B90059DDB154),
UInt64($E0158640C5E0E607), UInt64($884E079826C3A3CF),
UInt64($930D0D9523C535FD), UInt64($35638D754E9A2B00),
UInt64($4085FCCF40469DD5), UInt64($C4B17AD28BE23A4C),
UInt64($CAB2F0FC6A3E6A2E), UInt64($2860971A6B943FCD),
UInt64($3DDE6EE212E30446), UInt64($6222F32AE01765AE),
UInt64($5D550BB5478308FE), UInt64($A9EFA98DA0EDA22A),
UInt64($C351A71686C40DA7), UInt64($1105586D9C867C84),
UInt64($DCFFEE85FDA22853), UInt64($CCFBD0262C5EEF76),
UInt64($BAF294CB8990D201), UInt64($E69464F52AFAD975),
UInt64($94B013AFDF133E14), UInt64($06A7D1A32823C958),
UInt64($6F95FE5130F61119), UInt64($D92AB34E462C06C0),
UInt64($ED7BDE33887C71D2), UInt64($79746D6E6518393E),
UInt64($5BA419385D713329), UInt64($7C1BA6B948A97564),
UInt64($31987C197BFDAC67), UInt64($DE6C23C44B053D02),
UInt64($581C49FED002D64D), UInt64($DD474D6338261571),
UInt64($AA4546C3E473D062), UInt64($928FCE349455F860),
UInt64($48161BBACAAB94D9), UInt64($63912430770E6F68),
UInt64($6EC8A5E602C6641C), UInt64($87282515337DDD2B),
UInt64($2CDA6B42034B701B), UInt64($B03D37C181CB096D),
UInt64($E108438266C71C6F), UInt64($2B3180C7EB51B255),
UInt64($DF92B82F96C08BBC), UInt64($5C68C8C0A632F3BA),
UInt64($5504CC861C3D0556), UInt64($ABBFA4E55FB26B8F),
UInt64($41848B0AB3BACEB4), UInt64($B334A273AA445D32),
UInt64($BCA696F0A85AD881), UInt64($24F6EC65B528D56C),
UInt64($0CE1512E90F4524A), UInt64($4E9DD79D5506D35A),
UInt64($258905FAC6CE9779), UInt64($2019295B3E109B33),
UInt64($F8A9478B73A054CC), UInt64($2924F2F934417EB0),
UInt64($3993357D536D1BC4), UInt64($38A81AC21DB6FF8B),
UInt64($47C4FBF17D6016BF), UInt64($1E0FAADD7667E3F5),
UInt64($7ABCFF62938BEB96), UInt64($A78DAD948FC179C9),
UInt64($8F1F98B72911E50D), UInt64($61E48EAE27121A91),
UInt64($4D62F7AD31859808), UInt64($ECEBA345EF5CEAEB),
UInt64($F5CEB25EBC9684CE), UInt64($F633E20CB7F76221),
UInt64($A32CDF06AB8293E4), UInt64($985A202CA5EE2CA4),
UInt64($CF0B8447CC8A8FB1), UInt64($9F765244979859A3),
UInt64($A8D516B1A1240017), UInt64($0BD7BA3EBB5DC726),
UInt64($E54BCA55B86ADB39), UInt64($1D7A3AFD6C478063),
UInt64($519EC608E7669EDD), UInt64($0E5715A2D149AA23),
UInt64($177D4571848FF194), UInt64($EEB55F3241014C22),
UInt64($0F5E5CA13A6E2EC2), UInt64($8029927B75F5C361),
UInt64($AD139FABC3D6E436), UInt64($0D5DF1A94CCF402F),
UInt64($3E8BD948BEA5DFC8), UInt64($A5A0D357BD3FF77E),
UInt64($A2D12E251F74F645), UInt64($66FD9E525E81A082),
UInt64($2E0C90CE7F687A49), UInt64($C2E8BCBEBA973BC5),
UInt64($000001BCE509745F), UInt64($423777BBE6DAB3D6),
UInt64($D1661C7EAEF06EB5), UInt64($A1781F354DAACFD8),
UInt64($2D11284A2B16AFFC), UInt64($F1FC4F67FA891D1F),
UInt64($73ECC25DCB920ADA), UInt64($AE610C22C2A12651),
UInt64($96E0A810D356B78A), UInt64($5A9A381F2FE7870F),
UInt64($D5AD62EDE94E5530), UInt64($D225E5E8368D1427),
UInt64($65977B70C7AF4631), UInt64($99F889B2DE39D74F),
UInt64($233F30BF54E1D143), UInt64($9A9675D3D9A63C97),
UInt64($5470554FF334F9A8), UInt64($166ACB744A4F5688),
UInt64($70C74CAAB2E4AEAD), UInt64($F0D091646F294D12),
UInt64($57B82A89684031D1), UInt64($EFD95A5A61BE0B6B),
UInt64($2FBD12E969F2F29A), UInt64($9BD37013FEFF9FE8),
UInt64($3F9B0404D6085A06), UInt64($4940C1F3166CFE15),
UInt64($09542C4DCDF3DEFB), UInt64($B4C5218385CD5CE3),
UInt64($C935B7DC4462A641), UInt64($3417F8A68ED3B63F),
UInt64($B80959295B215B40), UInt64($F99CDAEF3B8C8572),
UInt64($018C0614F8FCB95D), UInt64($1B14ACCD1A3ACDF3),
UInt64($84D471F200BB732D), UInt64($C1A3110E95E8DA16),
UInt64($430A7220BF1A82B8), UInt64($B77E090D39DF210E),
UInt64($5EF4BD9F3CD05E9D), UInt64($9D4FF6DA7E57A444),
UInt64($DA1D60E183D4A5F8), UInt64($B287C38417998E47),
UInt64($FE3EDC121BB31886), UInt64($C7FE3CCC980CCBEF),
UInt64($E46FB590189BFD03), UInt64($3732FD469A4C57DC),
UInt64($7EF700A07CF1AD65), UInt64($59C64468A31D8859),
UInt64($762FB0B4D45B61F6), UInt64($155BAED099047718),
UInt64($68755E4C3D50BAA6), UInt64($E9214E7F22D8B4DF),
UInt64($2ADDBF532EAC95F4), UInt64($32AE3909B4BD0109),
UInt64($834DF537B08E3450), UInt64($FA209DA84220728D),
UInt64($9E691D9B9EFE23F7), UInt64($0446D288C4AE8D7F),
UInt64($7B4CC524E169785B), UInt64($21D87F0135CA1385),
UInt64($CEBB400F137B8AA5), UInt64($272E2B66580796BE),
UInt64($3612264125C2B0DE), UInt64($057702BDAD1EFBB2),
UInt64($D4BABB8EACF84BE9), UInt64($91583139641BC67B),
UInt64($8BDC2DE08036E024), UInt64($603C8156F49F68ED),
UInt64($F7D236F7DBEF5111), UInt64($9727C4598AD21E80),
UInt64($A08A0896670A5FD7), UInt64($CB4A8F4309EBA9CB),
UInt64($81AF564B0F7036A1), UInt64($C0B99AA778199ABD),
UInt64($959F1EC83FC8E952), UInt64($8C505077794A81B9),
UInt64($3ACAAF8F056338F0), UInt64($07B43F50627A6778),
UInt64($4A44AB49F5ECCC77), UInt64($3BC3D6E4B679EE98),
UInt64($9CC0D4D1CF14108C), UInt64($4406C00B206BC8A0),
UInt64($82A18854C8D72D89), UInt64($67E366B35C3C432C),
UInt64($B923DD61102B37F2), UInt64($56AB2779D884271D),
UInt64($BE83E1B0FF1525AF), UInt64($FB7C65D4217E49A9),
UInt64($6BDBE0E76D48E7D4), UInt64($08DF828745D9179E),
UInt64($22EA6A9ADD53BD34), UInt64($E36E141C5622200A),
UInt64($7F805D1B8CB750EE), UInt64($AFE5C7A59F58E837),
UInt64($E27F996A4FB1C23C), UInt64($D3867DFB0775F0D0),
UInt64($D0E673DE6E88891A), UInt64($123AEB9EAFB86C25),
UInt64($30F1D5D5C145B895), UInt64($BB434A2DEE7269E7),
UInt64($78CB67ECF931FA38), UInt64($F33B0372323BBF9C),
UInt64($52D66336FB279C74), UInt64($505F33AC0AFB4EAA),
UInt64($E8A5CD99A2CCE187), UInt64($534974801E2D30BB),
UInt64($8D2D5711D5876D90), UInt64($1F1A412891BC038E),
UInt64($D6E2E71D82E56648), UInt64($74036C3A497732B7),
UInt64($89B67ED96361F5AB), UInt64($FFED95D8F1EA02A2),
UInt64($E72B3BD61464D43D), UInt64($A6300F170BDC4820),
UInt64($EBC18760ED78A77A));
s_T2: array [0 .. 255] of UInt64 = (UInt64($E6A6BE5A05A12138),
UInt64($B5A122A5B4F87C98), UInt64($563C6089140B6990),
UInt64($4C46CB2E391F5DD5), UInt64($D932ADDBC9B79434),
UInt64($08EA70E42015AFF5), UInt64($D765A6673E478CF1),
UInt64($C4FB757EAB278D99), UInt64($DF11C6862D6E0692),
UInt64($DDEB84F10D7F3B16), UInt64($6F2EF604A665EA04),
UInt64($4A8E0F0FF0E0DFB3), UInt64($A5EDEEF83DBCBA51),
UInt64($FC4F0A2A0EA4371E), UInt64($E83E1DA85CB38429),
UInt64($DC8FF882BA1B1CE2), UInt64($CD45505E8353E80D),
UInt64($18D19A00D4DB0717), UInt64($34A0CFEDA5F38101),
UInt64($0BE77E518887CAF2), UInt64($1E341438B3C45136),
UInt64($E05797F49089CCF9), UInt64($FFD23F9DF2591D14),
UInt64($543DDA228595C5CD), UInt64($661F81FD99052A33),
UInt64($8736E641DB0F7B76), UInt64($15227725418E5307),
UInt64($E25F7F46162EB2FA), UInt64($48A8B2126C13D9FE),
UInt64($AFDC541792E76EEA), UInt64($03D912BFC6D1898F),
UInt64($31B1AAFA1B83F51B), UInt64($F1AC2796E42AB7D9),
UInt64($40A3A7D7FCD2EBAC), UInt64($1056136D0AFBBCC5),
UInt64($7889E1DD9A6D0C85), UInt64($D33525782A7974AA),
UInt64($A7E25D09078AC09B), UInt64($BD4138B3EAC6EDD0),
UInt64($920ABFBE71EB9E70), UInt64($A2A5D0F54FC2625C),
UInt64($C054E36B0B1290A3), UInt64($F6DD59FF62FE932B),
UInt64($3537354511A8AC7D), UInt64($CA845E9172FADCD4),
UInt64($84F82B60329D20DC), UInt64($79C62CE1CD672F18),
UInt64($8B09A2ADD124642C), UInt64($D0C1E96A19D9E726),
UInt64($5A786A9B4BA9500C), UInt64($0E020336634C43F3),
UInt64($C17B474AEB66D822), UInt64($6A731AE3EC9BAAC2),
UInt64($8226667AE0840258), UInt64($67D4567691CAECA5),
UInt64($1D94155C4875ADB5), UInt64($6D00FD985B813FDF),
UInt64($51286EFCB774CD06), UInt64($5E8834471FA744AF),
UInt64($F72CA0AEE761AE2E), UInt64($BE40E4CDAEE8E09A),
UInt64($E9970BBB5118F665), UInt64($726E4BEB33DF1964),
UInt64($703B000729199762), UInt64($4631D816F5EF30A7),
UInt64($B880B5B51504A6BE), UInt64($641793C37ED84B6C),
UInt64($7B21ED77F6E97D96), UInt64($776306312EF96B73),
UInt64($AE528948E86FF3F4), UInt64($53DBD7F286A3F8F8),
UInt64($16CADCE74CFC1063), UInt64($005C19BDFA52C6DD),
UInt64($68868F5D64D46AD3), UInt64($3A9D512CCF1E186A),
UInt64($367E62C2385660AE), UInt64($E359E7EA77DCB1D7),
UInt64($526C0773749ABE6E), UInt64($735AE5F9D09F734B),
UInt64($493FC7CC8A558BA8), UInt64($B0B9C1533041AB45),
UInt64($321958BA470A59BD), UInt64($852DB00B5F46C393),
UInt64($91209B2BD336B0E5), UInt64($6E604F7D659EF19F),
UInt64($B99A8AE2782CCB24), UInt64($CCF52AB6C814C4C7),
UInt64($4727D9AFBE11727B), UInt64($7E950D0C0121B34D),
UInt64($756F435670AD471F), UInt64($F5ADD442615A6849),
UInt64($4E87E09980B9957A), UInt64($2ACFA1DF50AEE355),
UInt64($D898263AFD2FD556), UInt64($C8F4924DD80C8FD6),
UInt64($CF99CA3D754A173A), UInt64($FE477BACAF91BF3C),
UInt64($ED5371F6D690C12D), UInt64($831A5C285E687094),
UInt64($C5D3C90A3708A0A4), UInt64($0F7F903717D06580),
UInt64($19F9BB13B8FDF27F), UInt64($B1BD6F1B4D502843),
UInt64($1C761BA38FFF4012), UInt64($0D1530C4E2E21F3B),
UInt64($8943CE69A7372C8A), UInt64($E5184E11FEB5CE66),
UInt64($618BDB80BD736621), UInt64($7D29BAD68B574D0B),
UInt64($81BB613E25E6FE5B), UInt64($071C9C10BC07913F),
UInt64($C7BEEB7909AC2D97), UInt64($C3E58D353BC5D757),
UInt64($EB017892F38F61E8), UInt64($D4EFFB9C9B1CC21A),
UInt64($99727D26F494F7AB), UInt64($A3E063A2956B3E03),
UInt64($9D4A8B9A4AA09C30), UInt64($3F6AB7D500090FB4),
UInt64($9CC0F2A057268AC0), UInt64($3DEE9D2DEDBF42D1),
UInt64($330F49C87960A972), UInt64($C6B2720287421B41),
UInt64($0AC59EC07C00369C), UInt64($EF4EAC49CB353425),
UInt64($F450244EEF0129D8), UInt64($8ACC46E5CAF4DEB6),
UInt64($2FFEAB63989263F7), UInt64($8F7CB9FE5D7A4578),
UInt64($5BD8F7644E634635), UInt64($427A7315BF2DC900),
UInt64($17D0C4AA2125261C), UInt64($3992486C93518E50),
UInt64($B4CBFEE0A2D7D4C3), UInt64($7C75D6202C5DDD8D),
UInt64($DBC295D8E35B6C61), UInt64($60B369D302032B19),
UInt64($CE42685FDCE44132), UInt64($06F3DDB9DDF65610),
UInt64($8EA4D21DB5E148F0), UInt64($20B0FCE62FCD496F),
UInt64($2C1B912358B0EE31), UInt64($B28317B818F5A308),
UInt64($A89C1E189CA6D2CF), UInt64($0C6B18576AAADBC8),
UInt64($B65DEAA91299FAE3), UInt64($FB2B794B7F1027E7),
UInt64($04E4317F443B5BEB), UInt64($4B852D325939D0A6),
UInt64($D5AE6BEEFB207FFC), UInt64($309682B281C7D374),
UInt64($BAE309A194C3B475), UInt64($8CC3F97B13B49F05),
UInt64($98A9422FF8293967), UInt64($244B16B01076FF7C),
UInt64($F8BF571C663D67EE), UInt64($1F0D6758EEE30DA1),
UInt64($C9B611D97ADEB9B7), UInt64($B7AFD5887B6C57A2),
UInt64($6290AE846B984FE1), UInt64($94DF4CDEACC1A5FD),
UInt64($058A5BD1C5483AFF), UInt64($63166CC142BA3C37),
UInt64($8DB8526EB2F76F40), UInt64($E10880036F0D6D4E),
UInt64($9E0523C9971D311D), UInt64($45EC2824CC7CD691),
UInt64($575B8359E62382C9), UInt64($FA9E400DC4889995),
UInt64($D1823ECB45721568), UInt64($DAFD983B8206082F),
UInt64($AA7D29082386A8CB), UInt64($269FCD4403B87588),
UInt64($1B91F5F728BDD1E0), UInt64($E4669F39040201F6),
UInt64($7A1D7C218CF04ADE), UInt64($65623C29D79CE5CE),
UInt64($2368449096C00BB1), UInt64($AB9BF1879DA503BA),
UInt64($BC23ECB1A458058E), UInt64($9A58DF01BB401ECC),
UInt64($A070E868A85F143D), UInt64($4FF188307DF2239E),
UInt64($14D565B41A641183), UInt64($EE13337452701602),
UInt64($950E3DCF3F285E09), UInt64($59930254B9C80953),
UInt64($3BF299408930DA6D), UInt64($A955943F53691387),
UInt64($A15EDECAA9CB8784), UInt64($29142127352BE9A0),
UInt64($76F0371FFF4E7AFB), UInt64($0239F450274F2228),
UInt64($BB073AF01D5E868B), UInt64($BFC80571C10E96C1),
UInt64($D267088568222E23), UInt64($9671A3D48E80B5B0),
UInt64($55B5D38AE193BB81), UInt64($693AE2D0A18B04B8),
UInt64($5C48B4ECADD5335F), UInt64($FD743B194916A1CA),
UInt64($2577018134BE98C4), UInt64($E77987E83C54A4AD),
UInt64($28E11014DA33E1B9), UInt64($270CC59E226AA213),
UInt64($71495F756D1A5F60), UInt64($9BE853FB60AFEF77),
UInt64($ADC786A7F7443DBF), UInt64($0904456173B29A82),
UInt64($58BC7A66C232BD5E), UInt64($F306558C673AC8B2),
UInt64($41F639C6B6C9772A), UInt64($216DEFE99FDA35DA),
UInt64($11640CC71C7BE615), UInt64($93C43694565C5527),
UInt64($EA038E6246777839), UInt64($F9ABF3CE5A3E2469),
UInt64($741E768D0FD312D2), UInt64($0144B883CED652C6),
UInt64($C20B5A5BA33F8552), UInt64($1AE69633C3435A9D),
UInt64($97A28CA4088CFDEC), UInt64($8824A43C1E96F420),
UInt64($37612FA66EEEA746), UInt64($6B4CB165F9CF0E5A),
UInt64($43AA1C06A0ABFB4A), UInt64($7F4DC26FF162796B),
UInt64($6CBACC8E54ED9B0F), UInt64($A6B7FFEFD2BB253E),
UInt64($2E25BC95B0A29D4F), UInt64($86D6A58BDEF1388C),
UInt64($DED74AC576B6F054), UInt64($8030BDBC2B45805D),
UInt64($3C81AF70E94D9289), UInt64($3EFF6DDA9E3100DB),
UInt64($B38DC39FDFCC8847), UInt64($123885528D17B87E),
UInt64($F2DA0ED240B1B642), UInt64($44CEFADCD54BF9A9),
UInt64($1312200E433C7EE6), UInt64($9FFCC84F3A78C748),
UInt64($F0CD1F72248576BB), UInt64($EC6974053638CFE4),
UInt64($2BA7B67C0CEC4E4C), UInt64($AC2F4DF3E5CE32ED),
UInt64($CB33D14326EA4C11), UInt64($A4E9044CC77E58BC),
UInt64($5F513293D934FCEF), UInt64($5DC9645506E55444),
UInt64($50DE418F317DE40A), UInt64($388CB31A69DDE259),
UInt64($2DB4A83455820A86), UInt64($9010A91E84711AE9),
UInt64($4DF7F0B7B1498371), UInt64($D62A2EABC0977179),
UInt64($22FAC097AA8D5C0E));
s_T3: array [0 .. 255] of UInt64 = (UInt64($F49FCC2FF1DAF39B),
UInt64($487FD5C66FF29281), UInt64($E8A30667FCDCA83F),
UInt64($2C9B4BE3D2FCCE63), UInt64($DA3FF74B93FBBBC2),
UInt64($2FA165D2FE70BA66), UInt64($A103E279970E93D4),
UInt64($BECDEC77B0E45E71), UInt64($CFB41E723985E497),
UInt64($B70AAA025EF75017), UInt64($D42309F03840B8E0),
UInt64($8EFC1AD035898579), UInt64($96C6920BE2B2ABC5),
UInt64($66AF4163375A9172), UInt64($2174ABDCCA7127FB),
UInt64($B33CCEA64A72FF41), UInt64($F04A4933083066A5),
UInt64($8D970ACDD7289AF5), UInt64($8F96E8E031C8C25E),
UInt64($F3FEC02276875D47), UInt64($EC7BF310056190DD),
UInt64($F5ADB0AEBB0F1491), UInt64($9B50F8850FD58892),
UInt64($4975488358B74DE8), UInt64($A3354FF691531C61),
UInt64($0702BBE481D2C6EE), UInt64($89FB24057DEDED98),
UInt64($AC3075138596E902), UInt64($1D2D3580172772ED),
UInt64($EB738FC28E6BC30D), UInt64($5854EF8F63044326),
UInt64($9E5C52325ADD3BBE), UInt64($90AA53CF325C4623),
UInt64($C1D24D51349DD067), UInt64($2051CFEEA69EA624),
UInt64($13220F0A862E7E4F), UInt64($CE39399404E04864),
UInt64($D9C42CA47086FCB7), UInt64($685AD2238A03E7CC),
UInt64($066484B2AB2FF1DB), UInt64($FE9D5D70EFBF79EC),
UInt64($5B13B9DD9C481854), UInt64($15F0D475ED1509AD),
UInt64($0BEBCD060EC79851), UInt64($D58C6791183AB7F8),
UInt64($D1187C5052F3EEE4), UInt64($C95D1192E54E82FF),
UInt64($86EEA14CB9AC6CA2), UInt64($3485BEB153677D5D),
UInt64($DD191D781F8C492A), UInt64($F60866BAA784EBF9),
UInt64($518F643BA2D08C74), UInt64($8852E956E1087C22),
UInt64($A768CB8DC410AE8D), UInt64($38047726BFEC8E1A),
UInt64($A67738B4CD3B45AA), UInt64($AD16691CEC0DDE19),
UInt64($C6D4319380462E07), UInt64($C5A5876D0BA61938),
UInt64($16B9FA1FA58FD840), UInt64($188AB1173CA74F18),
UInt64($ABDA2F98C99C021F), UInt64($3E0580AB134AE816),
UInt64($5F3B05B773645ABB), UInt64($2501A2BE5575F2F6),
UInt64($1B2F74004E7E8BA9), UInt64($1CD7580371E8D953),
UInt64($7F6ED89562764E30), UInt64($B15926FF596F003D),
UInt64($9F65293DA8C5D6B9), UInt64($6ECEF04DD690F84C),
UInt64($4782275FFF33AF88), UInt64($E41433083F820801),
UInt64($FD0DFE409A1AF9B5), UInt64($4325A3342CDB396B),
UInt64($8AE77E62B301B252), UInt64($C36F9E9F6655615A),
UInt64($85455A2D92D32C09), UInt64($F2C7DEA949477485),
UInt64($63CFB4C133A39EBA), UInt64($83B040CC6EBC5462),
UInt64($3B9454C8FDB326B0), UInt64($56F56A9E87FFD78C),
UInt64($2DC2940D99F42BC6), UInt64($98F7DF096B096E2D),
UInt64($19A6E01E3AD852BF), UInt64($42A99CCBDBD4B40B),
UInt64($A59998AF45E9C559), UInt64($366295E807D93186),
UInt64($6B48181BFAA1F773), UInt64($1FEC57E2157A0A1D),
UInt64($4667446AF6201AD5), UInt64($E615EBCACFB0F075),
UInt64($B8F31F4F68290778), UInt64($22713ED6CE22D11E),
UInt64($3057C1A72EC3C93B), UInt64($CB46ACC37C3F1F2F),
UInt64($DBB893FD02AAF50E), UInt64($331FD92E600B9FCF),
UInt64($A498F96148EA3AD6), UInt64($A8D8426E8B6A83EA),
UInt64($A089B274B7735CDC), UInt64($87F6B3731E524A11),
UInt64($118808E5CBC96749), UInt64($9906E4C7B19BD394),
UInt64($AFED7F7E9B24A20C), UInt64($6509EADEEB3644A7),
UInt64($6C1EF1D3E8EF0EDE), UInt64($B9C97D43E9798FB4),
UInt64($A2F2D784740C28A3), UInt64($7B8496476197566F),
UInt64($7A5BE3E6B65F069D), UInt64($F96330ED78BE6F10),
UInt64($EEE60DE77A076A15), UInt64($2B4BEE4AA08B9BD0),
UInt64($6A56A63EC7B8894E), UInt64($02121359BA34FEF4),
UInt64($4CBF99F8283703FC), UInt64($398071350CAF30C8),
UInt64($D0A77A89F017687A), UInt64($F1C1A9EB9E423569),
UInt64($8C7976282DEE8199), UInt64($5D1737A5DD1F7ABD),
UInt64($4F53433C09A9FA80), UInt64($FA8B0C53DF7CA1D9),
UInt64($3FD9DCBC886CCB77), UInt64($C040917CA91B4720),
UInt64($7DD00142F9D1DCDF), UInt64($8476FC1D4F387B58),
UInt64($23F8E7C5F3316503), UInt64($032A2244E7E37339),
UInt64($5C87A5D750F5A74B), UInt64($082B4CC43698992E),
UInt64($DF917BECB858F63C), UInt64($3270B8FC5BF86DDA),
UInt64($10AE72BB29B5DD76), UInt64($576AC94E7700362B),
UInt64($1AD112DAC61EFB8F), UInt64($691BC30EC5FAA427),
UInt64($FF246311CC327143), UInt64($3142368E30E53206),
UInt64($71380E31E02CA396), UInt64($958D5C960AAD76F1),
UInt64($F8D6F430C16DA536), UInt64($C8FFD13F1BE7E1D2),
UInt64($7578AE66004DDBE1), UInt64($05833F01067BE646),
UInt64($BB34B5AD3BFE586D), UInt64($095F34C9A12B97F0),
UInt64($247AB64525D60CA8), UInt64($DCDBC6F3017477D1),
UInt64($4A2E14D4DECAD24D), UInt64($BDB5E6D9BE0A1EEB),
UInt64($2A7E70F7794301AB), UInt64($DEF42D8A270540FD),
UInt64($01078EC0A34C22C1), UInt64($E5DE511AF4C16387),
UInt64($7EBB3A52BD9A330A), UInt64($77697857AA7D6435),
UInt64($004E831603AE4C32), UInt64($E7A21020AD78E312),
UInt64($9D41A70C6AB420F2), UInt64($28E06C18EA1141E6),
UInt64($D2B28CBD984F6B28), UInt64($26B75F6C446E9D83),
UInt64($BA47568C4D418D7F), UInt64($D80BADBFE6183D8E),
UInt64($0E206D7F5F166044), UInt64($E258A43911CBCA3E),
UInt64($723A1746B21DC0BC), UInt64($C7CAA854F5D7CDD3),
UInt64($7CAC32883D261D9C), UInt64($7690C26423BA942C),
UInt64($17E55524478042B8), UInt64($E0BE477656A2389F),
UInt64($4D289B5E67AB2DA0), UInt64($44862B9C8FBBFD31),
UInt64($B47CC8049D141365), UInt64($822C1B362B91C793),
UInt64($4EB14655FB13DFD8), UInt64($1ECBBA0714E2A97B),
UInt64($6143459D5CDE5F14), UInt64($53A8FBF1D5F0AC89),
UInt64($97EA04D81C5E5B00), UInt64($622181A8D4FDB3F3),
UInt64($E9BCD341572A1208), UInt64($1411258643CCE58A),
UInt64($9144C5FEA4C6E0A4), UInt64($0D33D06565CF620F),
UInt64($54A48D489F219CA1), UInt64($C43E5EAC6D63C821),
UInt64($A9728B3A72770DAF), UInt64($D7934E7B20DF87EF),
UInt64($E35503B61A3E86E5), UInt64($CAE321FBC819D504),
UInt64($129A50B3AC60BFA6), UInt64($CD5E68EA7E9FB6C3),
UInt64($B01C90199483B1C7), UInt64($3DE93CD5C295376C),
UInt64($AED52EDF2AB9AD13), UInt64($2E60F512C0A07884),
UInt64($BC3D86A3E36210C9), UInt64($35269D9B163951CE),
UInt64($0C7D6E2AD0CDB5FA), UInt64($59E86297D87F5733),
UInt64($298EF221898DB0E7), UInt64($55000029D1A5AA7E),
UInt64($8BC08AE1B5061B45), UInt64($C2C31C2B6C92703A),
UInt64($94CC596BAF25EF42), UInt64($0A1D73DB22540456),
UInt64($04B6A0F9D9C4179A), UInt64($EFFDAFA2AE3D3C60),
UInt64($F7C8075BB49496C4), UInt64($9CC5C7141D1CD4E3),
UInt64($78BD1638218E5534), UInt64($B2F11568F850246A),
UInt64($EDFABCFA9502BC29), UInt64($796CE5F2DA23051B),
UInt64($AAE128B0DC93537C), UInt64($3A493DA0EE4B29AE),
UInt64($B5DF6B2C416895D7), UInt64($FCABBD25122D7F37),
UInt64($70810B58105DC4B1), UInt64($E10FDD37F7882A90),
UInt64($524DCAB5518A3F5C), UInt64($3C9E85878451255B),
UInt64($4029828119BD34E2), UInt64($74A05B6F5D3CECCB),
UInt64($B610021542E13ECA), UInt64($0FF979D12F59E2AC),
UInt64($6037DA27E4F9CC50), UInt64($5E92975A0DF1847D),
UInt64($D66DE190D3E623FE), UInt64($5032D6B87B568048),
UInt64($9A36B7CE8235216E), UInt64($80272A7A24F64B4A),
UInt64($93EFED8B8C6916F7), UInt64($37DDBFF44CCE1555),
UInt64($4B95DB5D4B99BD25), UInt64($92D3FDA169812FC0),
UInt64($FB1A4A9A90660BB6), UInt64($730C196946A4B9B2),
UInt64($81E289AA7F49DA68), UInt64($64669A0F83B1A05F),
UInt64($27B3FF7D9644F48B), UInt64($CC6B615C8DB675B3),
UInt64($674F20B9BCEBBE95), UInt64($6F31238275655982),
UInt64($5AE488713E45CF05), UInt64($BF619F9954C21157),
UInt64($EABAC46040A8EAE9), UInt64($454C6FE9F2C0C1CD),
UInt64($419CF6496412691C), UInt64($D3DC3BEF265B0F70),
UInt64($6D0E60F5C3578A9E));
s_T4: array [0 .. 255] of UInt64 = (UInt64($5B0E608526323C55),
UInt64($1A46C1A9FA1B59F5), UInt64($A9E245A17C4C8FFA),
UInt64($65CA5159DB2955D7), UInt64($05DB0A76CE35AFC2),
UInt64($81EAC77EA9113D45), UInt64($528EF88AB6AC0A0D),
UInt64($A09EA253597BE3FF), UInt64($430DDFB3AC48CD56),
UInt64($C4B3A67AF45CE46F), UInt64($4ECECFD8FBE2D05E),
UInt64($3EF56F10B39935F0), UInt64($0B22D6829CD619C6),
UInt64($17FD460A74DF2069), UInt64($6CF8CC8E8510ED40),
UInt64($D6C824BF3A6ECAA7), UInt64($61243D581A817049),
UInt64($048BACB6BBC163A2), UInt64($D9A38AC27D44CC32),
UInt64($7FDDFF5BAAF410AB), UInt64($AD6D495AA804824B),
UInt64($E1A6A74F2D8C9F94), UInt64($D4F7851235DEE8E3),
UInt64($FD4B7F886540D893), UInt64($247C20042AA4BFDA),
UInt64($096EA1C517D1327C), UInt64($D56966B4361A6685),
UInt64($277DA5C31221057D), UInt64($94D59893A43ACFF7),
UInt64($64F0C51CCDC02281), UInt64($3D33BCC4FF6189DB),
UInt64($E005CB184CE66AF1), UInt64($FF5CCD1D1DB99BEA),
UInt64($B0B854A7FE42980F), UInt64($7BD46A6A718D4B9F),
UInt64($D10FA8CC22A5FD8C), UInt64($D31484952BE4BD31),
UInt64($C7FA975FCB243847), UInt64($4886ED1E5846C407),
UInt64($28CDDB791EB70B04), UInt64($C2B00BE2F573417F),
UInt64($5C9590452180F877), UInt64($7A6BDDFFF370EB00),
UInt64($CE509E38D6D9D6A4), UInt64($EBEB0F00647FA702),
UInt64($1DCC06CF76606F06), UInt64($E4D9F28BA286FF0A),
UInt64($D85A305DC918C262), UInt64($475B1D8732225F54),
UInt64($2D4FB51668CCB5FE), UInt64($A679B9D9D72BBA20),
UInt64($53841C0D912D43A5), UInt64($3B7EAA48BF12A4E8),
UInt64($781E0E47F22F1DDF), UInt64($EFF20CE60AB50973),
UInt64($20D261D19DFFB742), UInt64($16A12B03062A2E39),
UInt64($1960EB2239650495), UInt64($251C16FED50EB8B8),
UInt64($9AC0C330F826016E), UInt64($ED152665953E7671),
UInt64($02D63194A6369570), UInt64($5074F08394B1C987),
UInt64($70BA598C90B25CE1), UInt64($794A15810B9742F6),
UInt64($0D5925E9FCAF8C6C), UInt64($3067716CD868744E),
UInt64($910AB077E8D7731B), UInt64($6A61BBDB5AC42F61),
UInt64($93513EFBF0851567), UInt64($F494724B9E83E9D5),
UInt64($E887E1985C09648D), UInt64($34B1D3C675370CFD),
UInt64($DC35E433BC0D255D), UInt64($D0AAB84234131BE0),
UInt64($08042A50B48B7EAF), UInt64($9997C4EE44A3AB35),
UInt64($829A7B49201799D0), UInt64($263B8307B7C54441),
UInt64($752F95F4FD6A6CA6), UInt64($927217402C08C6E5),
UInt64($2A8AB754A795D9EE), UInt64($A442F7552F72943D),
UInt64($2C31334E19781208), UInt64($4FA98D7CEAEE6291),
UInt64($55C3862F665DB309), UInt64($BD0610175D53B1F3),
UInt64($46FE6CB840413F27), UInt64($3FE03792DF0CFA59),
UInt64($CFE700372EB85E8F), UInt64($A7BE29E7ADBCE118),
UInt64($E544EE5CDE8431DD), UInt64($8A781B1B41F1873E),
UInt64($A5C94C78A0D2F0E7), UInt64($39412E2877B60728),
UInt64($A1265EF3AFC9A62C), UInt64($BCC2770C6A2506C5),
UInt64($3AB66DD5DCE1CE12), UInt64($E65499D04A675B37),
UInt64($7D8F523481BFD216), UInt64($0F6F64FCEC15F389),
UInt64($74EFBE618B5B13C8), UInt64($ACDC82B714273E1D),
UInt64($DD40BFE003199D17), UInt64($37E99257E7E061F8),
UInt64($FA52626904775AAA), UInt64($8BBBF63A463D56F9),
UInt64($F0013F1543A26E64), UInt64($A8307E9F879EC898),
UInt64($CC4C27A4150177CC), UInt64($1B432F2CCA1D3348),
UInt64($DE1D1F8F9F6FA013), UInt64($606602A047A7DDD6),
UInt64($D237AB64CC1CB2C7), UInt64($9B938E7225FCD1D3),
UInt64($EC4E03708E0FF476), UInt64($FEB2FBDA3D03C12D),
UInt64($AE0BCED2EE43889A), UInt64($22CB8923EBFB4F43),
UInt64($69360D013CF7396D), UInt64($855E3602D2D4E022),
UInt64($073805BAD01F784C), UInt64($33E17A133852F546),
UInt64($DF4874058AC7B638), UInt64($BA92B29C678AA14A),
UInt64($0CE89FC76CFAADCD), UInt64($5F9D4E0908339E34),
UInt64($F1AFE9291F5923B9), UInt64($6E3480F60F4A265F),
UInt64($EEBF3A2AB29B841C), UInt64($E21938A88F91B4AD),
UInt64($57DFEFF845C6D3C3), UInt64($2F006B0BF62CAAF2),
UInt64($62F479EF6F75EE78), UInt64($11A55AD41C8916A9),
UInt64($F229D29084FED453), UInt64($42F1C27B16B000E6),
UInt64($2B1F76749823C074), UInt64($4B76ECA3C2745360),
UInt64($8C98F463B91691BD), UInt64($14BCC93CF1ADE66A),
UInt64($8885213E6D458397), UInt64($8E177DF0274D4711),
UInt64($B49B73B5503F2951), UInt64($10168168C3F96B6B),
UInt64($0E3D963B63CAB0AE), UInt64($8DFC4B5655A1DB14),
UInt64($F789F1356E14DE5C), UInt64($683E68AF4E51DAC1),
UInt64($C9A84F9D8D4B0FD9), UInt64($3691E03F52A0F9D1),
UInt64($5ED86E46E1878E80), UInt64($3C711A0E99D07150),
UInt64($5A0865B20C4E9310), UInt64($56FBFC1FE4F0682E),
UInt64($EA8D5DE3105EDF9B), UInt64($71ABFDB12379187A),
UInt64($2EB99DE1BEE77B9C), UInt64($21ECC0EA33CF4523),
UInt64($59A4D7521805C7A1), UInt64($3896F5EB56AE7C72),
UInt64($AA638F3DB18F75DC), UInt64($9F39358DABE9808E),
UInt64($B7DEFA91C00B72AC), UInt64($6B5541FD62492D92),
UInt64($6DC6DEE8F92E4D5B), UInt64($353F57ABC4BEEA7E),
UInt64($735769D6DA5690CE), UInt64($0A234AA642391484),
UInt64($F6F9508028F80D9D), UInt64($B8E319A27AB3F215),
UInt64($31AD9C1151341A4D), UInt64($773C22A57BEF5805),
UInt64($45C7561A07968633), UInt64($F913DA9E249DBE36),
UInt64($DA652D9B78A64C68), UInt64($4C27A97F3BC334EF),
UInt64($76621220E66B17F4), UInt64($967743899ACD7D0B),
UInt64($F3EE5BCAE0ED6782), UInt64($409F753600C879FC),
UInt64($06D09A39B5926DB6), UInt64($6F83AEB0317AC588),
UInt64($01E6CA4A86381F21), UInt64($66FF3462D19F3025),
UInt64($72207C24DDFD3BFB), UInt64($4AF6B6D3E2ECE2EB),
UInt64($9C994DBEC7EA08DE), UInt64($49ACE597B09A8BC4),
UInt64($B38C4766CF0797BA), UInt64($131B9373C57C2A75),
UInt64($B1822CCE61931E58), UInt64($9D7555B909BA1C0C),
UInt64($127FAFDD937D11D2), UInt64($29DA3BADC66D92E4),
UInt64($A2C1D57154C2ECBC), UInt64($58C5134D82F6FE24),
UInt64($1C3AE3515B62274F), UInt64($E907C82E01CB8126),
UInt64($F8ED091913E37FCB), UInt64($3249D8F9C80046C9),
UInt64($80CF9BEDE388FB63), UInt64($1881539A116CF19E),
UInt64($5103F3F76BD52457), UInt64($15B7E6F5AE47F7A8),
UInt64($DBD7C6DED47E9CCF), UInt64($44E55C410228BB1A),
UInt64($B647D4255EDB4E99), UInt64($5D11882BB8AAFC30),
UInt64($F5098BBB29D3212A), UInt64($8FB5EA14E90296B3),
UInt64($677B942157DD025A), UInt64($FB58E7C0A390ACB5),
UInt64($89D3674C83BD4A01), UInt64($9E2DA4DF4BF3B93B),
UInt64($FCC41E328CAB4829), UInt64($03F38C96BA582C52),
UInt64($CAD1BDBD7FD85DB2), UInt64($BBB442C16082AE83),
UInt64($B95FE86BA5DA9AB0), UInt64($B22E04673771A93F),
UInt64($845358C9493152D8), UInt64($BE2A488697B4541E),
UInt64($95A2DC2DD38E6966), UInt64($C02C11AC923C852B),
UInt64($2388B1990DF2A87B), UInt64($7C8008FA1B4F37BE),
UInt64($1F70D0C84D54E503), UInt64($5490ADEC7ECE57D4),
UInt64($002B3C27D9063A3A), UInt64($7EAEA3848030A2BF),
UInt64($C602326DED2003C0), UInt64($83A7287D69A94086),
UInt64($C57A5FCB30F57A8A), UInt64($B56844E479EBE779),
UInt64($A373B40F05DCBCE9), UInt64($D71A786E88570EE2),
UInt64($879CBACDBDE8F6A0), UInt64($976AD1BCC164A32F),
UInt64($AB21E25E9666D78B), UInt64($901063AAE5E5C33C),
UInt64($9818B34448698D90), UInt64($E36487AE3E1E8ABB),
UInt64($AFBDF931893BDCB4), UInt64($6345A0DC5FBBD519),
UInt64($8628FE269B9465CA), UInt64($1E5D01603F9C51EC),
UInt64($4DE44006A15049B7), UInt64($BF6C70E5F776CBB1),
UInt64($411218F2EF552BED), UInt64($CB0C0708705A36A3),
UInt64($E74D14754F986044), UInt64($CD56D9430EA8280E),
UInt64($C12591D7535F5065), UInt64($C83223F1720AEF96),
UInt64($C3A0396F7363A51F));
{$ENDREGION}
strict protected
Fm_rounds: Int32;
Fm_hash: THashLibUInt64Array;
constructor Create(a_hash_size: Int32; a_rounds: THashRounds);
function GetName: String; override;
function GetResult(): THashLibByteArray; override;
procedure Finish(); override;
procedure TransformBlock(a_data: PByte; a_data_length: Int32;
a_index: Int32); override;
function GetHashRound(AHashRound: Int32): THashRounds; inline;
public
procedure Initialize(); override;
end;
type
TTiger_Base = class sealed(TTiger)
public
constructor Create(a_hash_size: Int32; a_rounds: THashRounds);
function Clone(): IHash; override;
end;
type
TTiger_128 = class sealed(TTiger)
public
constructor CreateRound3();
constructor CreateRound4();
constructor CreateRound5();
function Clone(): IHash; override;
end;
type
TTiger_160 = class sealed(TTiger)
public
constructor CreateRound3();
constructor CreateRound4();
constructor CreateRound5();
function Clone(): IHash; override;
end;
type
TTiger_192 = class sealed(TTiger)
public
constructor CreateRound3();
constructor CreateRound4();
constructor CreateRound5();
function Clone(): IHash; override;
end;
implementation
{ TTiger }
function TTiger.GetHashRound(AHashRound: Int32): THashRounds;
begin
case AHashRound of
3:
Result := THashRounds.hrRounds3;
4:
Result := THashRounds.hrRounds4;
5:
Result := THashRounds.hrRounds5;
8:
Result := THashRounds.hrRounds8
else
begin
raise EArgumentInvalidHashLibException.CreateResFmt(@SInvalidHashRound,
[AHashRound]);
end;
end;
end;
constructor TTiger.Create(a_hash_size: Int32; a_rounds: THashRounds);
begin
Inherited Create(a_hash_size, 64);
System.SetLength(Fm_hash, 3);
Fm_rounds := Int32(a_rounds);
end;
procedure TTiger.Finish;
var
bits: UInt64;
padindex: Int32;
pad: THashLibByteArray;
begin
bits := Fm_processed_bytes * 8;
if Fm_buffer.Pos < 56 then
padindex := 56 - Fm_buffer.Pos
else
padindex := 120 - Fm_buffer.Pos;
System.SetLength(pad, padindex + 8);
pad[0] := 1;
bits := TConverters.le2me_64(bits);
TConverters.ReadUInt64AsBytesLE(bits, pad, padindex);
padindex := padindex + 8;
TransformBytes(pad, 0, padindex);
end;
function TTiger.GetName: String;
begin
Result := Format('%s_%u_%u', [Self.ClassParent.ClassName, Fm_rounds,
Self.HashSize * 8]);
end;
function TTiger.GetResult: THashLibByteArray;
begin
System.SetLength(Result, HashSize);
TConverters.le64_copy(PUInt64(Fm_hash), 0, PByte(Result), 0,
System.Length(Result));
end;
procedure TTiger.Initialize;
begin
Fm_hash[0] := $0123456789ABCDEF;
Fm_hash[1] := UInt64($FEDCBA9876543210);
Fm_hash[2] := UInt64($F096A5B4C3B2E187);
Inherited Initialize();
end;
procedure TTiger.TransformBlock(a_data: PByte; a_data_length: Int32;
a_index: Int32);
var
a, b, c, temp_a: UInt64;
rounds: Int32;
data: array [0 .. 7] of UInt64;
begin
TConverters.le64_copy(a_data, a_index, @(data[0]), 0, a_data_length);
a := Fm_hash[0];
b := Fm_hash[1];
c := Fm_hash[2];
c := c xor data[0];
a := a - (s_T1[Byte(c)] xor s_T2[Byte(c shr 16)] xor s_T3[Byte(c shr 32)
] xor s_T4[Byte(c shr 48)]);
b := b + (s_T4[Byte(c shr 8) and $FF] xor s_T3[Byte(c shr 24)
] xor s_T2[Byte(c shr 40)] xor s_T1[Byte(c shr 56)]);
b := b * 5;
a := a xor data[1];
b := b - (s_T1[Byte(a)] xor s_T2[Byte(a shr 16)] xor s_T3[Byte(a shr 32)
] xor s_T4[Byte(a shr 48)]);
c := c + (s_T4[Byte(a shr 8)] xor s_T3[Byte(a shr 24)] xor s_T2[Byte(a shr 40)
] xor s_T1[Byte(a shr 56)]);
c := c * 5;
b := b xor data[2];
c := c - (s_T1[Byte(b)] xor s_T2[Byte(b shr 16)] xor s_T3[Byte(b shr 32)
] xor s_T4[Byte(b shr 48)]);
a := a + (s_T4[Byte(b shr 8)] xor s_T3[Byte(b shr 24)] xor s_T2[Byte(b shr 40)
] xor s_T1[Byte(b shr 56)]);
a := a * 5;
c := c xor data[3];
a := a - (s_T1[Byte(c)] xor s_T2[Byte(c shr 16)] xor s_T3[Byte(c shr 32)
] xor s_T4[Byte(c shr 48)]);
b := b + (s_T4[Byte(c shr 8) and $FF] xor s_T3[Byte(c shr 24)
] xor s_T2[Byte(c shr 40)] xor s_T1[Byte(c shr 56)]);
b := b * 5;
a := a xor data[4];
b := b - (s_T1[Byte(a)] xor s_T2[Byte(a shr 16)] xor s_T3[Byte(a shr 32)
] xor s_T4[Byte(a shr 48)]);
c := c + (s_T4[Byte(a shr 8)] xor s_T3[Byte(a shr 24)] xor s_T2[Byte(a shr 40)
] xor s_T1[Byte(a shr 56)]);
c := c * 5;
b := b xor data[5];
c := c - (s_T1[Byte(b)] xor s_T2[Byte(b shr 16)] xor s_T3[Byte(b shr 32)
] xor s_T4[Byte(b shr 48)]);
a := a + (s_T4[Byte(b shr 8)] xor s_T3[Byte(b shr 24)] xor s_T2[Byte(b shr 40)
] xor s_T1[Byte(b shr 56)]);
a := a * 5;
c := c xor data[6];
a := a - (s_T1[Byte(c)] xor s_T2[Byte(c shr 16)] xor s_T3[Byte(c shr 32)
] xor s_T4[Byte(c shr 48)]);
b := b + (s_T4[Byte(c shr 8) and $FF] xor s_T3[Byte(c shr 24)
] xor s_T2[Byte(c shr 40)] xor s_T1[Byte(c shr 56)]);
b := b * 5;
a := a xor data[7];
b := b - (s_T1[Byte(a)] xor s_T2[Byte(a shr 16)] xor s_T3[Byte(a shr 32)
] xor s_T4[Byte(a shr 48)]);
c := c + (s_T4[Byte(a shr 8)] xor s_T3[Byte(a shr 24)] xor s_T2[Byte(a shr 40)
] xor s_T1[Byte(a shr 56)]);
c := c * 5;
data[0] := data[0] - (data[7] xor C1);
data[1] := data[1] xor data[0];
data[2] := data[2] + data[1];
data[3] := data[3] - (data[2] xor (not data[1] shl 19));
data[4] := data[4] xor data[3];
data[5] := data[5] + data[4];
data[6] := data[6] - (data[5] xor (not data[4] shr 23));
data[7] := data[7] xor data[6];
data[0] := data[0] + data[7];
data[1] := data[1] - (data[0] xor (not data[7] shl 19));
data[2] := data[2] xor data[1];
data[3] := data[3] + data[2];
data[4] := data[4] - (data[3] xor (not data[2] shr 23));
data[5] := data[5] xor data[4];
data[6] := data[6] + data[5];
data[7] := data[7] - (data[6] xor C2);
b := b xor data[0];
c := c - (s_T1[Byte(b)] xor s_T2[Byte(b shr 16)] xor s_T3[Byte(b shr 32)
] xor s_T4[Byte(b shr 48)]);
a := a + (s_T4[Byte(b shr 8)] xor s_T3[Byte(b shr 24)] xor s_T2[Byte(b shr 40)
] xor s_T1[Byte(b shr 56)]);
a := a * 7;
c := c xor data[1];
a := a - (s_T1[Byte(c)] xor s_T2[Byte(c shr 16)] xor s_T3[Byte(c shr 32)
] xor s_T4[Byte(c shr 48)]);
b := b + (s_T4[Byte(c shr 8) and $FF] xor s_T3[Byte(c shr 24)
] xor s_T2[Byte(c shr 40)] xor s_T1[Byte(c shr 56)]);
b := b * 7;
a := a xor data[2];
b := b - (s_T1[Byte(a)] xor s_T2[Byte(a shr 16)] xor s_T3[Byte(a shr 32)
] xor s_T4[Byte(a shr 48)]);
c := c + (s_T4[Byte(a shr 8)] xor s_T3[Byte(a shr 24)] xor s_T2[Byte(a shr 40)
] xor s_T1[Byte(a shr 56)]);
c := c * 7;
b := b xor data[3];
c := c - (s_T1[Byte(b)] xor s_T2[Byte(b shr 16)] xor s_T3[Byte(b shr 32)
] xor s_T4[Byte(b shr 48)]);
a := a + (s_T4[Byte(b shr 8)] xor s_T3[Byte(b shr 24)] xor s_T2[Byte(b shr 40)
] xor s_T1[Byte(b shr 56)]);
a := a * 7;
c := c xor data[4];
a := a - (s_T1[Byte(c)] xor s_T2[Byte(c shr 16)] xor s_T3[Byte(c shr 32)
] xor s_T4[Byte(c shr 48)]);
b := b + (s_T4[Byte(c shr 8) and $FF] xor s_T3[Byte(c shr 24)
] xor s_T2[Byte(c shr 40)] xor s_T1[Byte(c shr 56)]);
b := b * 7;
a := a xor data[5];
b := b - (s_T1[Byte(a)] xor s_T2[Byte(a shr 16)] xor s_T3[Byte(a shr 32)
] xor s_T4[Byte(a shr 48)]);
c := c + (s_T4[Byte(a shr 8)] xor s_T3[Byte(a shr 24)] xor s_T2[Byte(a shr 40)
] xor s_T1[Byte(a shr 56)]);
c := c * 7;
b := b xor data[6];
c := c - (s_T1[Byte(b)] xor s_T2[Byte(b shr 16)] xor s_T3[Byte(b shr 32)
] xor s_T4[Byte(b shr 48)]);
a := a + (s_T4[Byte(b shr 8)] xor s_T3[Byte(b shr 24)] xor s_T2[Byte(b shr 40)
] xor s_T1[Byte(b shr 56)]);
a := a * 7;
c := c xor data[7];
a := a - (s_T1[Byte(c)] xor s_T2[Byte(c shr 16)] xor s_T3[Byte(c shr 32)
] xor s_T4[Byte(c shr 48)]);
b := b + (s_T4[Byte(c shr 8) and $FF] xor s_T3[Byte(c shr 24)
] xor s_T2[Byte(c shr 40)] xor s_T1[Byte(c shr 56)]);
b := b * 7;
data[0] := data[0] - (data[7] xor C1);
data[1] := data[1] xor data[0];
data[2] := data[2] + data[1];
data[3] := data[3] - (data[2] xor (not data[1] shl 19));
data[4] := data[4] xor data[3];
data[5] := data[5] + data[4];
data[6] := data[6] - (data[5] xor (not data[4] shr 23));
data[7] := data[7] xor data[6];
data[0] := data[0] + data[7];
data[1] := data[1] - (data[0] xor (not data[7] shl 19));
data[2] := data[2] xor data[1];
data[3] := data[3] + data[2];
data[4] := data[4] - (data[3] xor (not data[2] shr 23));
data[5] := data[5] xor data[4];
data[6] := data[6] + data[5];
data[7] := data[7] - (data[6] xor C2);
a := a xor data[0];
b := b - (s_T1[Byte(a)] xor s_T2[Byte(a shr 16)] xor s_T3[Byte(a shr 32)
] xor s_T4[Byte(a shr 48)]);
c := c + (s_T4[Byte(a shr 8)] xor s_T3[Byte(a shr 24)] xor s_T2[Byte(a shr 40)
] xor s_T1[Byte(a shr 56)]);
c := c * 9;
b := b xor data[1];
c := c - (s_T1[Byte(b)] xor s_T2[Byte(b shr 16)] xor s_T3[Byte(b shr 32)
] xor s_T4[Byte(b shr 48)]);
a := a + (s_T4[Byte(b shr 8)] xor s_T3[Byte(b shr 24)] xor s_T2[Byte(b shr 40)
] xor s_T1[Byte(b shr 56)]);
a := a * 9;
c := c xor data[2];
a := a - (s_T1[Byte(c)] xor s_T2[Byte(c shr 16)] xor s_T3[Byte(c shr 32)
] xor s_T4[Byte(c shr 48)]);
b := b + (s_T4[Byte(c shr 8) and $FF] xor s_T3[Byte(c shr 24)
] xor s_T2[Byte(c shr 40)] xor s_T1[Byte(c shr 56)]);
b := b * 9;
a := a xor data[3];
b := b - (s_T1[Byte(a)] xor s_T2[Byte(a shr 16)] xor s_T3[Byte(a shr 32)
] xor s_T4[Byte(a shr 48)]);
c := c + (s_T4[Byte(a shr 8)] xor s_T3[Byte(a shr 24)] xor s_T2[Byte(a shr 40)
] xor s_T1[Byte(a shr 56)]);
c := c * 9;
b := b xor data[4];
c := c - (s_T1[Byte(b)] xor s_T2[Byte(b shr 16)] xor s_T3[Byte(b shr 32)
] xor s_T4[Byte(b shr 48)]);
a := a + (s_T4[Byte(b shr 8)] xor s_T3[Byte(b shr 24)] xor s_T2[Byte(b shr 40)
] xor s_T1[Byte(b shr 56)]);
a := a * 9;
c := c xor data[5];
a := a - (s_T1[Byte(c)] xor s_T2[Byte(c shr 16)] xor s_T3[Byte(c shr 32)
] xor s_T4[Byte(c shr 48)]);
b := b + (s_T4[Byte(c shr 8) and $FF] xor s_T3[Byte(c shr 24)
] xor s_T2[Byte(c shr 40)] xor s_T1[Byte(c shr 56)]);
b := b * 9;
a := a xor data[6];
b := b - (s_T1[Byte(a)] xor s_T2[Byte(a shr 16)] xor s_T3[Byte(a shr 32)
] xor s_T4[Byte(a shr 48)]);
c := c + (s_T4[Byte(a shr 8)] xor s_T3[Byte(a shr 24)] xor s_T2[Byte(a shr 40)
] xor s_T1[Byte(a shr 56)]);
c := c * 9;
b := b xor data[7];
c := c - (s_T1[Byte(b)] xor s_T2[Byte(b shr 16)] xor s_T3[Byte(b shr 32)
] xor s_T4[Byte(b shr 48)]);
a := a + (s_T4[Byte(b shr 8)] xor s_T3[Byte(b shr 24)] xor s_T2[Byte(b shr 40)
] xor s_T1[Byte(b shr 56)]);
a := a * 9;
rounds := 3;
while rounds < Fm_rounds do
begin
data[0] := data[0] - (data[7] xor C1);
data[1] := data[1] xor data[0];
data[2] := data[2] + data[1];
data[3] := data[3] - (data[2] xor (not data[1] shl 19));
data[4] := data[4] xor data[3];
data[5] := data[5] + data[4];
data[6] := data[6] - (data[5] xor (not data[4] shr 23));
data[7] := data[7] xor data[6];
data[0] := data[0] + data[7];
data[1] := data[1] - (data[0] xor (not data[7] shl 19));
data[2] := data[2] xor data[1];
data[3] := data[3] + data[2];
data[4] := data[4] - (data[3] xor (not data[2] shr 23));
data[5] := data[5] xor data[4];
data[6] := data[6] + data[5];
data[7] := data[7] - (data[6] xor C2);
c := c xor data[0];
a := a - (s_T1[Byte(c)] xor s_T2[Byte(c shr 16)] xor s_T3[Byte(c shr 32)
] xor s_T4[Byte(c shr 48)]);
b := b + (s_T4[Byte(c shr 8) and $FF] xor s_T3[Byte(c shr 24)
] xor s_T2[Byte(c shr 40)] xor s_T1[Byte(c shr 56)]);
b := b * 9;
a := a xor data[1];
b := b - (s_T1[Byte(a)] xor s_T2[Byte(a shr 16)] xor s_T3[Byte(a shr 32)
] xor s_T4[Byte(a shr 48)]);
c := c + (s_T4[Byte(a shr 8)] xor s_T3[Byte(a shr 24)] xor s_T2
[Byte(a shr 40)] xor s_T1[Byte(a shr 56)]);
c := c * 9;
b := b xor data[2];
c := c - (s_T1[Byte(b)] xor s_T2[Byte(b shr 16)] xor s_T3[Byte(b shr 32)
] xor s_T4[Byte(b shr 48)]);
a := a + (s_T4[Byte(b shr 8)] xor s_T3[Byte(b shr 24)] xor s_T2
[Byte(b shr 40)] xor s_T1[Byte(b shr 56)]);
a := a * 9;
c := c xor data[3];
a := a - (s_T1[Byte(c)] xor s_T2[Byte(c shr 16)] xor s_T3[Byte(c shr 32)
] xor s_T4[Byte(c shr 48)]);
b := b + (s_T4[Byte(c shr 8) and $FF] xor s_T3[Byte(c shr 24)
] xor s_T2[Byte(c shr 40)] xor s_T1[Byte(c shr 56)]);
b := b * 9;
a := a xor data[4];
b := b - (s_T1[Byte(a)] xor s_T2[Byte(a shr 16)] xor s_T3[Byte(a shr 32)
] xor s_T4[Byte(a shr 48)]);
c := c + (s_T4[Byte(a shr 8)] xor s_T3[Byte(a shr 24)] xor s_T2
[Byte(a shr 40)] xor s_T1[Byte(a shr 56)]);
c := c * 9;
b := b xor data[5];
c := c - (s_T1[Byte(b)] xor s_T2[Byte(b shr 16)] xor s_T3[Byte(b shr 32)
] xor s_T4[Byte(b shr 48)]);
a := a + (s_T4[Byte(b shr 8)] xor s_T3[Byte(b shr 24)] xor s_T2
[Byte(b shr 40)] xor s_T1[Byte(b shr 56)]);
a := a * 9;
c := c xor data[6];
a := a - (s_T1[Byte(c)] xor s_T2[Byte(c shr 16)] xor s_T3[Byte(c shr 32)
] xor s_T4[Byte(c shr 48)]);
b := b + (s_T4[Byte(c shr 8) and $FF] xor s_T3[Byte(c shr 24)
] xor s_T2[Byte(c shr 40)] xor s_T1[Byte(c shr 56)]);
b := b * 9;
a := a xor data[7];
b := b - (s_T1[Byte(a)] xor s_T2[Byte(a shr 16)] xor s_T3[Byte(a shr 32)
] xor s_T4[Byte(a shr 48)]);
c := c + (s_T4[Byte(a shr 8)] xor s_T3[Byte(a shr 24)] xor s_T2
[Byte(a shr 40)] xor s_T1[Byte(a shr 56)]);
c := c * 9;
temp_a := a;
a := c;
c := b;
b := temp_a;
System.Inc(rounds);
end;
Fm_hash[0] := Fm_hash[0] xor a;
Fm_hash[1] := b - Fm_hash[1];
Fm_hash[2] := Fm_hash[2] + c;
System.FillChar(data, System.SizeOf(data), UInt64(0));
end;
{ TTiger_128 }
function TTiger_128.Clone(): IHash;
var
HashInstance: TTiger_128;
begin
HashInstance := TTiger_128.Create(HashSize, GetHashRound(Fm_rounds));
HashInstance.Fm_hash := System.Copy(Fm_hash);
HashInstance.Fm_buffer := Fm_buffer.Clone();
HashInstance.Fm_processed_bytes := Fm_processed_bytes;
Result := HashInstance as IHash;
Result.BufferSize := BufferSize;
end;
constructor TTiger_128.CreateRound3;
begin
Inherited Create(16, THashRounds.hrRounds3);
end;
constructor TTiger_128.CreateRound4;
begin
Inherited Create(16, THashRounds.hrRounds4);
end;
constructor TTiger_128.CreateRound5;
begin
Inherited Create(16, THashRounds.hrRounds5);
end;
{ TTiger_160 }
function TTiger_160.Clone(): IHash;
var
HashInstance: TTiger_160;
begin
HashInstance := TTiger_160.Create(HashSize, GetHashRound(Fm_rounds));
HashInstance.Fm_hash := System.Copy(Fm_hash);
HashInstance.Fm_buffer := Fm_buffer.Clone();
HashInstance.Fm_processed_bytes := Fm_processed_bytes;
Result := HashInstance as IHash;
Result.BufferSize := BufferSize;
end;
constructor TTiger_160.CreateRound3;
begin
Inherited Create(20, THashRounds.hrRounds3);
end;
constructor TTiger_160.CreateRound4;
begin
Inherited Create(20, THashRounds.hrRounds4);
end;
constructor TTiger_160.CreateRound5;
begin
Inherited Create(20, THashRounds.hrRounds5);
end;
{ TTiger_192 }
function TTiger_192.Clone(): IHash;
var
HashInstance: TTiger_192;
begin
HashInstance := TTiger_192.Create(HashSize, GetHashRound(Fm_rounds));
HashInstance.Fm_hash := System.Copy(Fm_hash);
HashInstance.Fm_buffer := Fm_buffer.Clone();
HashInstance.Fm_processed_bytes := Fm_processed_bytes;
Result := HashInstance as IHash;
Result.BufferSize := BufferSize;
end;
constructor TTiger_192.CreateRound3;
begin
Inherited Create(24, THashRounds.hrRounds3);
end;
constructor TTiger_192.CreateRound4;
begin
Inherited Create(24, THashRounds.hrRounds4);
end;
constructor TTiger_192.CreateRound5;
begin
Inherited Create(24, THashRounds.hrRounds5);
end;
{ TTiger_Base }
function TTiger_Base.Clone(): IHash;
var
HashInstance: TTiger_Base;
begin
HashInstance := TTiger_Base.Create(HashSize, GetHashRound(Fm_rounds));
HashInstance.Fm_hash := System.Copy(Fm_hash);
HashInstance.Fm_buffer := Fm_buffer.Clone();
HashInstance.Fm_processed_bytes := Fm_processed_bytes;
Result := HashInstance as IHash;
Result.BufferSize := BufferSize;
end;
constructor TTiger_Base.Create(a_hash_size: Int32; a_rounds: THashRounds);
begin
Inherited Create(a_hash_size, a_rounds);
end;
end.
| 42.897504 | 91 | 0.68781 |
fcc479b8e35b211619ed19d06f063b0f114514a6 | 1,300 | pas | Pascal | Demos/iOSGestureLag/Unit1.pas | barlone/Kastri | fb12d9eba242e67efd87eb1cb7acd123601a58ed | [
"MIT"
]
| 259 | 2020-05-27T03:15:19.000Z | 2022-03-24T16:35:02.000Z | Demos/iOSGestureLag/Unit1.pas | talentedexpert0057/Kastri | aacc0db96957ea850abb7b407be5a0722462eb5a | [
"MIT"
]
| 95 | 2020-06-16T09:46:06.000Z | 2022-03-28T00:27:07.000Z | Demos/iOSGestureLag/Unit1.pas | talentedexpert0057/Kastri | aacc0db96957ea850abb7b407be5a0722462eb5a | [
"MIT"
]
| 56 | 2020-06-04T19:32:40.000Z | 2022-03-26T15:32:47.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.Controls.Presentation, FMX.StdCtrls, FMX.Layouts, FMX.Objects;
type
TForm1 = class(TForm)
Layout1: TLayout;
Button1: TButton;
Rectangle1: TRectangle;
CheckBox1: TCheckBox;
procedure Button1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
procedure CheckBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
uses
DW.ScreenEdgeManager;
procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
begin
if Rectangle1.Tag = 0 then
begin
Rectangle1.Fill.Color := TAlphaColors.Red;
Rectangle1.Tag := 1;
end
else
begin
Rectangle1.Fill.Color := TAlphaColors.Green;
Rectangle1.Tag := 0;
end;
end;
procedure TForm1.CheckBox1Change(Sender: TObject);
begin
if CheckBox1.IsChecked then
TScreenEdgeManager.SetPreferredScreenEdges([TScreenEdge.Bottom])
else
TScreenEdgeManager.SetPreferredScreenEdges([]);
end;
end.
| 23.214286 | 132 | 0.702308 |
83a362f6e0107b6e4e82059731840c430097b0a2 | 2,967 | pas | Pascal | rwgif.pas | RetroNick2020/raster-master | a10f3739fe8a7e551ca4c3e729635b567438b502 | [
"MIT"
]
| 15 | 2021-05-31T23:36:48.000Z | 2022-01-30T01:56:38.000Z | rwgif.pas | RetroNick2020/raster-master | a10f3739fe8a7e551ca4c3e729635b567438b502 | [
"MIT"
]
| 5 | 2021-07-30T21:26:39.000Z | 2021-12-19T00:15:32.000Z | rwgif.pas | RetroNick2020/raster-master | a10f3739fe8a7e551ca4c3e729635b567438b502 | [
"MIT"
]
| 1 | 2021-09-20T01:18:11.000Z | 2021-09-20T01:18:11.000Z | unit rwgif;
{$mode TP}
{$PACKRECORDS 1}
interface
uses
rwgifcore,rmcore;
function WGif(x,y,x2,y2 : integer;filename : string) : integer;
function RGif(x,y,x2,y2,Lp,Pm : integer;filename : string) : integer;
implementation
type
LineBufType = Array[0..2047] of Byte;
var
GifXOffset : integer;
GifYOffset : integer;
GifX : integer;
GifY : integer;
GifWidth : integer;
GifHeight : integer;
function GetMaxColor : integer;
begin
GetMaxColor:=RMCoreBase.Palette.GetColorCount-1;
end;
function GetGifPixel : integer;
begin
if GifY = GifHeight then
begin
GetGifPixel:=-1;
exit;
end;
GetGifPixel:=RMCoreBase.GetPixel(GifX+GifXOffset,GifY+GifYoffset);
inc(GifX);
if GifX = GifWidth then
begin
Gifx:=0;
inc(GifY);
end;
end;
procedure GetGifLine(Var pixels; line, width : integer );
var
rmlinebuf : LineBufType;
i : integer;
mywidth : integer;
begin
if line > GifHeight then exit;
if GifWidth < width then myWidth:=GifWidth else myWidth:=width;
move(pixels,rmlinebuf,mywidth);
for i:=0 to mywidth-1 do
begin
RMCoreBase.PutPixel(GifXoffset+i,GifYOffset+line,rmlinebuf[i]);
end;
end;
function GetGifDepth : integer;
var
myNumCols : integer;
begin
myNumCols:=GetMaxColor+1;
case myNumCols of 2 : GetGifDepth:=1;
4 : GetGifDepth:=2;
8 : GetGifDepth:=3;
16 : GetGifDepth:=4;
32 : GetGifDepth:=5;
64 : GetGifDepth:=6;
128 : GetGifDepth:=7;
256 : GetGifDepth:=8;
end;
end;
function WGif(x,y,x2,y2 : integer;filename : string) : integer;
var
width,height : integer;
Gifpal : array[0..767] of byte;
i : integer;
myNumCols : integer;
begin
GifXOffset:=x;
GifYOffset:=y;
GifX:=0;
GifY:=0;
width:=x2-x+1;
height:=y2-y+1;
GifWidth:=width;
GifHeight:=height;
myNumCols:=GetMaxColor+1;
For i:=0 to myNumCols-1 do
begin
gifPal[i*3]:=RMCoreBase.palette.GetRed(i);
gifPal[i*3+1]:=RMCoreBase.palette.GetGreen(i);
gifPal[i*3+2]:=RMCoreBase.palette.GetBlue(i);
end;
WGif:=SaveGif(filename, width, height,GetGifDepth,Gifpal );
end;
function RGif(x,y,x2,y2,Lp,Pm : integer;filename : string) : integer;
var
width,height : integer;
i : integer;
myNumCols : integer;
error : integer;
cr : TRMColorRec;
begin
GifXOffset:=x;
GifYOffset:=y;
width:=x2-x+1;
height:=y2-y+1;
GifWidth:=width;
GifHeight:=height;
myNumCols:=GetMaxColor+1;
error:=LoadGif(filename);
if (error = 0) and (Lp = 1) and (pm <>PaletteModeMono ) and (pm<>PaletteModeCGA0) and (pm<>PaletteModeCGA1) and (pm<> PaletteModeEGA) then
begin
For i:=0 to myNumCols-1 do
begin
cr.r:=GifPalette[i*3];
cr.g:=GifPalette[i*3+1];
cr.b:=GifPalette[i*3+2];
RMCoreBase.Palette.SetColor(i,cr);
end;
end;
RGif:=error;
end;
procedure InitProcs;
begin
GifOutLineProc := GetGifLine;
GifInPixelProc := GetGifPixel;
end;
begin
InitProcs;
end.
| 20.321918 | 139 | 0.660263 |
fc24d11f71d5171ac1dd2e81a6203265ea5e59eb | 1,346 | dpr | Pascal | Packages/Order Entry Results Reporting/CPRS/CPRS-Chart/XE8/508/VA 508 JAWS Framework/Source/JAWS.dpr | rjwinchester/VistA | 6ada05a153ff670adcb62e1c83e55044a2a0f254 | [
"Apache-2.0"
]
| 72 | 2015-02-03T02:30:45.000Z | 2020-01-30T17:20:52.000Z | Packages/Order Entry Results Reporting/CPRS/CPRS-Chart/XE8/508/VA 508 JAWS Framework/Source/JAWS.dpr | rjwinchester/VistA | 6ada05a153ff670adcb62e1c83e55044a2a0f254 | [
"Apache-2.0"
]
| 80 | 2016-04-19T12:04:06.000Z | 2020-01-31T14:35:19.000Z | Packages/Order Entry Results Reporting/CPRS/CPRS-Chart/XE8/508/VA 508 JAWS Framework/Source/JAWS.dpr | rjwinchester/VistA | 6ada05a153ff670adcb62e1c83e55044a2a0f254 | [
"Apache-2.0"
]
| 67 | 2015-01-27T16:47:56.000Z | 2020-02-12T21:23:56.000Z | library JAWS;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
{$R *.dres}
uses
SysUtils,
Classes,
JAWSImplementation in 'JAWSImplementation.pas',
fVA508DispatcherHiddenWindow in 'fVA508DispatcherHiddenWindow.pas',
fVA508HiddenJawsMainWindow in 'fVA508HiddenJawsMainWindow.pas' {frmVA508HiddenJawsMainWindow},
fVA508HiddenJawsDataWindow in 'fVA508HiddenJawsDataWindow.pas' {frmVA508HiddenJawsDataWindow},
JAWSCommon in 'JAWSCommon.pas',
FSAPILib_TLB in 'FSAPILib_TLB.pas',
U_LogObject in 'U_LogObject.pas',
U_Splash in 'U_Splash.pas',
U_SplashScreen in 'U_SplashScreen.pas' {SplashScrn},
ORProcessUtilities in 'ORProcessUtilities.pas';
{$Ifdef VER180}
{$E SR}
{$Else}
{$E SR3}
{$EndIf}
{$R *.res}
begin
ReportMemoryLeaksOnShutdown := DebugHook <> 0;
end.
| 32.047619 | 96 | 0.77786 |
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.