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.
RnQ/for.RnQ/RTL/RDGlobal.pas

221 lines
5.6 KiB
Plaintext

{
This file is part of R&Q.
Under same license
}
unit RDGlobal;
{$I ForRnQConfig.inc}
{ $ DEFINE RNQ_PLAYER }
interface
uses
Classes, Messages, Types, Forms, ExtCtrls, Graphics;
{$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 = AnsiString;
// TPicName = String;
TStrObj = class(TObject)
public
str: String;
end;
TPStrObj = Class(TObject)
public
str: PAnsiChar;
end;
TPUStrObj = Class(TObject)
public
str: PChar;
end;
TRnQPntBox = class(TPaintBox)
protected
// procedure WMPaint(var Msg: TWMPaint); message WM_PAINT;
procedure WMEraseBkgnd(var Msg: TWmEraseBkgnd); message WM_ERASEBKGND;
public
constructor Create(AOwner: TComponent); override;
// procedure PaintImages;
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;
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;
const
CrLf = AnsiString(#13#10);
CrLfS = #13#10;
// CRLFA : AnsiString = AnsiString(#13#10);
CRLFCRLF = AnsiString(CrLf + CrLf);
// CRLFCRLF : AnsiString =AnsiString(CRLF+CRLF);
// CRLFCRLF : AnsiString = AnsiString(#13#10#13#10);
NL = #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;
var
// myPath : String;
ShellVersion: cardinal;
const
// Windows resourses!!!!!!!!
PIC_EXCLAMATION = TPicName('exclamation');
PIC_HAND = TPicName('hand');
PIC_ASTERISK = TPicName('asterisk');
PIC_QUEST = TPicName('question');
implementation
uses
Windows, Controls;
constructor TRnQPntBox.Create(AOwner: TComponent);
begin
inherited;
// ControlStyle := ControlStyle + [ csOpaque ] ;
end;
procedure TRnQPntBox.WMEraseBkgnd(var Msg: TWmEraseBkgnd);
Begin
// inherited;
// msg.Result := 1;
Msg.Result := LRESULT(False);
Msg.Msg := 0;
end;
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;
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.