You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
200 lines
4.9 KiB
Plaintext
200 lines
4.9 KiB
Plaintext
{
|
|
This file is part of R&Q.
|
|
Under same license
|
|
}
|
|
unit RDGlobal;
|
|
{$I ForRnQConfig.inc}
|
|
|
|
interface
|
|
|
|
uses
|
|
System.Types;
|
|
|
|
{$I NoRTTI.inc}
|
|
{ ************ common types used for compatibility between compilers and CPU }
|
|
|
|
{$IFNDEF FPC}
|
|
|
|
{ make cross-compiler and cross-CPU types available to Delphi }
|
|
type
|
|
|
|
/// a CPU-dependent unsigned integer type cast of a pointer / register
|
|
// - used for 64 bits compatibility, native under Free Pascal Compiler
|
|
{$IFDEF ISDELPHI2009}
|
|
PtrUInt = cardinal; { see http://synopse.info/forum/viewtopic.php?id=136 }
|
|
{$ELSE}
|
|
PtrUInt = {$IFDEF UNICODE}NativeUInt{$ELSE}cardinal{$ENDIF};
|
|
{$ENDIF}
|
|
/// a CPU-dependent unsigned integer type cast of a pointer of pointer
|
|
// - used for 64 bits compatibility, native under Free Pascal Compiler
|
|
PPtrUInt = ^PtrUInt;
|
|
|
|
/// a CPU-dependent signed integer type cast of a pointer / register
|
|
// - used for 64 bits compatibility, native under Free Pascal Compiler
|
|
PtrInt = {$IFDEF UNICODE}NativeInt{$ELSE}integer{$ENDIF};
|
|
/// a CPU-dependent signed integer type cast of a pointer of pointer
|
|
// - used for 64 bits compatibility, native under Free Pascal Compiler
|
|
PPtrInt = ^PtrInt;
|
|
|
|
/// unsigned Int64 doesn't exist under older Delphi, but is defined in FPC
|
|
QWord = {$IFDEF UNICODE}UInt64{$ELSE}Int64{$ENDIF};
|
|
{$ENDIF}
|
|
|
|
type
|
|
{$IFNDEF UNICODE}
|
|
RawByteString = AnsiString;
|
|
{$ENDIF UNICODE}
|
|
TPicName = String;
|
|
TPicNameW = WideString;
|
|
|
|
TStrObj = class(TObject)
|
|
public
|
|
str: String;
|
|
end;
|
|
|
|
TPStrObj = Class(TObject)
|
|
public
|
|
str: PAnsiChar;
|
|
end;
|
|
|
|
TPUStrObj = Class(TObject)
|
|
public
|
|
str: PChar;
|
|
end;
|
|
|
|
type
|
|
PGPPoint = ^TGPPoint;
|
|
|
|
TGPPoint = packed record
|
|
X: integer;
|
|
Y: integer;
|
|
end;
|
|
|
|
TPointDynArray = array of TGPPoint;
|
|
|
|
function MakePoint(p2: TPoint): TGPPoint; inline;
|
|
// function MakePoint(X, Y: Integer): TGPPoint; overload;
|
|
|
|
// --------------------------------------------------------------------------
|
|
// Represents a dimension in a 2D coordinate system (integer coordinates)
|
|
// --------------------------------------------------------------------------
|
|
|
|
type
|
|
PGPSize = ^TGPSize;
|
|
|
|
TGPSize = packed record
|
|
Width: integer;
|
|
Height: integer;
|
|
constructor Create(Width, Height: Integer);
|
|
end;
|
|
|
|
function MakeSize(sz2: TSize): TGPSize; inline;
|
|
function GetSize(sz1: TGPSize): TSize; inline;
|
|
// function MakeSize(Width, Height: Integer): TGPSize; overload;
|
|
|
|
type
|
|
PGPRect = ^TGPRect;
|
|
|
|
TGPRect = packed record
|
|
case integer of
|
|
0:
|
|
(X, Y, Width, Height: integer);
|
|
1:
|
|
(TopLeft: TGPPoint; size: TGPSize);
|
|
end;
|
|
|
|
TRectDynArray = array of TGPRect;
|
|
|
|
function MakeRect(X, Y, Width, Height: integer): TGPRect; overload; inline;
|
|
function MakeRect(location: TGPPoint; size: TGPSize): TGPRect; overload; inline;
|
|
function MakeRect(const Rect: TRect): TGPRect; overload; inline;
|
|
|
|
type
|
|
TMsgDlgType = (mtWarning, mtError, mtInformation, mtConfirmation, mtBuzz, mtCustom);
|
|
TMsgDlgTypes = set of TMsgDlgType;
|
|
TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mbNoToAll, mbYesToAll, mbHelp, mbClose);
|
|
TMsgDlgButtons = set of TMsgDlgBtn;
|
|
|
|
TGroupAction = (GA_None = 0, GA_Add, GA_Rename, GA_Remove);
|
|
|
|
const
|
|
CRLF = #13#10;
|
|
HexChars = ['A' .. 'F', 'a' .. 'f', '0' .. '9'];
|
|
yesno: array [boolean] of AnsiString = ('No', 'Yes');
|
|
Def_DateTimeFormat = 'DD.MM.YYYY HH:NN:SS';
|
|
Def_DateFormat = 'DD.MM.YYYY';
|
|
|
|
const
|
|
AlphaMask = $FF000000;
|
|
|
|
GByte = 1024 * 1024 * 1024;
|
|
MByte = 1024 * 1024;
|
|
|
|
cDefaultDPI = 96;
|
|
|
|
var
|
|
ShellVersion: cardinal;
|
|
|
|
const
|
|
PIC_EXCLAMATION = TPicName('exclamation');
|
|
PIC_HAND = TPicName('hand');
|
|
PIC_ASTERISK = TPicName('asterisk');
|
|
PIC_QUEST = TPicName('question');
|
|
|
|
implementation
|
|
|
|
uses
|
|
Winapi.Windows;
|
|
|
|
function MakePoint(p2: TPoint): TGPPoint;
|
|
begin
|
|
Result.X := p2.X;
|
|
Result.Y := p2.Y;
|
|
end;
|
|
|
|
function MakeSize(sz2: TSize): TGPSize;
|
|
begin
|
|
Result.Width := sz2.cx;
|
|
Result.Height := sz2.cy;
|
|
end;
|
|
|
|
function GetSize(sz1: TGPSize): TSize;
|
|
begin
|
|
Result.cx := sz1.Width;
|
|
Result.cy := sz1.Height;
|
|
end;
|
|
|
|
constructor TGPSize.Create(Width, Height: Integer);
|
|
begin
|
|
Self.Width := Width;
|
|
Self.Height := Height;
|
|
end;
|
|
|
|
function MakeRect(X, Y, Width, Height: integer): TGPRect; inline;
|
|
begin
|
|
Result.X := X;
|
|
Result.Y := Y;
|
|
Result.Width := Width;
|
|
Result.Height := Height;
|
|
end;
|
|
|
|
function MakeRect(location: TGPPoint; size: TGPSize): TGPRect; inline;
|
|
begin
|
|
// Result.X := location.X;
|
|
// Result.Y := location.Y;
|
|
Result.TopLeft := location;
|
|
// Result.Width := size.Width;
|
|
// Result.Height := size.Height;
|
|
Result.size := size;
|
|
end;
|
|
|
|
function MakeRect(const Rect: TRect): TGPRect; inline;
|
|
begin
|
|
Result.X := Rect.Left;
|
|
Result.Y := Rect.Top;
|
|
Result.Width := Rect.Right - Rect.Left;
|
|
Result.Height := Rect.Bottom - Rect.Top;
|
|
end;
|
|
|
|
end.
|