The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Interface of SDL_SDLBase

const
{$IFDEF PAIDVERS}
  SDLVersionInfo = 'sdlbase_r1200_full';
  IsLightEd = false;
{$ELSE}
  SDLVersionInfo = 'sdlbase_r1200_lighted';
  IsLightEd = true;
{$ENDIF}
  Release = 1200;

type
  TShapeKind = (skRectangle, skEllipse, skCircle, skRing);
  TBkgFill = (bfSimple, bfStretch, bfTile);
  TBoundingBox = (bbNone, bbFrame, bbFaces);
  TColorScheme = (csBWG, csSystem);
  TDecPSep = (dsSystem, dsDot, dsComma, dsBoth);
  TFigType = (ftNoFigs, ftNum, ftTime, ftDateTime, ftUserText);
  TScaleType = (sctXB, sctXT, sctYL, sctYR);
  TVerticalAlignment = (vaTop, vaCenter, vaBottom);
  TYearLength = (ylNone, ylYY, ylYYYY);
  TDateOrder = (doMMDDYY, doDDMMYY, doYYMMDD);
  TDateForTime = (dtNone, dtOnePerChart, dtOnePerDay, dtAllTicks);
  TShadowStyle = (ssFlying, ssBox);
  TFrameStyle = (fsNone, fsSimple, fsLowered, fsRaised, fsEmbossed, fsEngraved);
  TDistMode = (dmJaccard, dmManhattan, dmEuclid, dmEuclidSqr, dmDice, dmUserDef);
  TTimeFormat = (tfHHMMSS,tfHHhMM,tfAMPM);
  TDirection = (dirUpward, dirDownward, dirLeftward, dirRightward);
  TOrientation = (orVert, orHoriz);
  TApplyColRow = (apColumns, apRows);
  TEdgeOp = (eopMin, eopMax, eopSum, eopMean, eopStdDev);
  TAxis = (atXAxis, atYAxis, atZAxis);
  TDims = (dimX, dimY, dimL, dimT);
  TTriState = (tsFalse, tsTrue, tsUndefined);
  TCrossHMode = (chOff, chHoriz, chVert, chBoth, chCrossBox, chBox);
  TTxtLblAttachMode = (tlamNone, tlamXOnly, tlamYOnly, tlamBoth);
  TTxtLblMode = (tlOff, tlsimple, tlBox, tlUnderline, tlShadow);
  TDegreeFormat = (dfDeg, dfDegMin, dfDegMinSec, dfNumeric);
  TCSVDelimiters = (csvUnknown, csvBlank, csvSemicolon, csvComma, csvColon, csvTab);
  TZoomPanMode = (zpmPan, zpmColZoomLeft, zpmColZoomRight);

  TColoredPoint = record
                     X    : double;
                     Y    : double;
                     Flag : word;
                     Color: TColor;
                   end;
  TPointDouble = record
                   X : double;
                   Y : double;
                 end;
  TCellPosition4D = record
                      X : integer;
                      Y : integer;
                      L : integer;
                      T : integer;
                    end;
  TPDblArray = array of TPointDouble;
  TPIntArray = array of TPoint;
  TSingleArray = array of single;
  TDoubleArray = array of double;
  TDouble2DArray = array of array of double;
  TDouble3DArray = array of array of array of double;
  TDouble4DArray = array of array of array of array of double;
  TIntArray = array of integer;
  TInt2DArray = array of array of integer;
  TInt3DArray = array of array of array of integer;
  TInt4DArray = array of array of array of array of integer;
  TBoolArray = array of boolean;
  TBool2DArray = array of array of boolean;
  TStrArray = array of string;
  TStr2DArray = array of array of string;
  TVariantArray = array of variant;
  TSortExchgEvent = procedure (Sender: TObject; ExchgWhat: byte;
                               index1, index2, first, last: longint) of object;
                                  { event when exchange of rows/columns occurs }
  TExportTextEvent = procedure (Sender: TObject; mode, index: integer;
                                var OutText: string) of object;
  TLanguage = (lgUnknown, lgEnglish, lgGerman, lgFrench, lgSpanish);
  TQuad = array[1..4] of TPoint;
  TRescaleMode = (sctMeanCenter, sctStandardize, sctConstSum, sctConstSquaredSum,
                  sctMaxAbs, sctRange, sctQNormalize, sctSquash, sctUndefined);
  TRectDouble = record
                case Integer of
                  0: (Left, Top, Right, Bottom: double);
                  1: (TopLeft, BottomRight: TPointDouble);
                end;
  TVarKind = (rnum,dnum,snum,inum,lnum,Bool,strg);
  FeedBackProcType = procedure (StateCnt: double);
                                { general procedure type for callback routines }
  TMouseBoxState = (msNormal, msFirstCorner, msRectDraw, msFinished);
  TMouseActMode = (maNone, maPan, maPanHoriz, maPanVert, maPanGrid, maRubberBand,
                   maZoom, maZoomWind, maZoomWindPos,
                   maZoomDrag, maDragCrossH, maDragLabel,
                   maRotate, maRotAndZoom, maRotXOnly, maRotZOnly,
                   maSelectRect, maDrawMTrace, maZoomPanColors);
  TZoomState = (zsNormal, zsDrawWin);
  TZoomPanEvent = procedure (Sender: TObject) of object;
  TSelectRectEvent = procedure (Sender: TObject; Layer: integer;
                                LoX, LoY, HiX, HiY: double) of object;
  TOnPercentDoneEvent = procedure (Sender: TObject; PercentDone: integer) of object;
  TOnCheckAbortEvent = procedure (Sender: TObject; var Abort: boolean) of object;
  TOnRubberBandActionEvent = procedure (Sender: TObject; APoint: TPoint) of object;
  TFeedbackProc = procedure (Sender: TObject; StateCnt: double;
                             PercentDone: double);
  ESDLError = class(Exception);    { general exception type to indicate errors }

  TDTLabel = class (TPersistent)               { parameters of DateTime labels }
             private
               FTimeFormat   : TTimeFormat;
               FDateSeparator: char;
               FTimeSeparator: char;
               FYearLength   : TYearLength;
               FMonthName    : boolean;
               FDateOrder    : TDateOrder;
               FDateForTime  : TDateForTime;
               FOnChange     : TNotifyEvent;
               procedure SetTimeFormat (Value: TTimeFormat);
               procedure SetDateForTime (value: TDateForTime);
               procedure SetDateSeparator (Value: char);
               procedure SetTimeSeparator (Value: char);
               procedure SetYearLength (value: TYearLength);
               procedure SetMonthName (value: boolean);
               procedure SetDAteOrder (value: TDateOrder);
             protected
               constructor Create;
               destructor Destroy; override;
               procedure AssignTo (Dest: TPersistent); override;
             public
               procedure Assign(Source: TPersistent); override;
               procedure Changed;
             published
               property TimeFormat: TTimeFormat
                            read FTimeFormat write SetTimeFormat;
               property DateSeparator: char
                            read FDateSeparator write SetDateSeparator;
               property TimeSeparator: char
                            read FTimeSeparator write SetTimeSeparator;
               property YearLength: TYearLength
                            read FYearLength write SetYearLength;
               property MonthName: boolean
                            read FMonthName write SetMonthName;
               property DateOrder: TDateOrder
                            read FDateOrder write SetDateOrder;
               property DateForTime: TDateForTime
                            read FDateForTime write SetDateForTime;
               property OnChange: TNotifyEvent
                            read FOnChange write FOnChange;
             end;
const
  {$I ..\includefiles\inc_names.pas}  // contains various names
  {$I ..\includefiles\inc_xmltags.pas}  // defines text tags for XML processing

  CSVDELIMITERS : array [TCSVDelimiters] of char =
           (#0,' ',';',',',':',#9);
  CSVDELIMITERIDS : array[TCSVDelimiters] of string =
                        ('undefined', 'blank', 'semicolon', 'comma', 'colon', 'tab');
  SMALLPOSNUM = 1e-15;                  // small non-zero number
  IDS_RESCALEMODE : array[TRescaleMode] of string =
                  ('sctMeanCenter', 'sctStandardize', 'sctConstSum',
                   'sctConstSquaredSum', 'sctMaxAbs', 'sctRange',
                   'sctQNormalize', 'sctSquash', 'sctUndefined');
  IDS_APPLYCOLROW : array[TApplyColRow] of string =
                  ('apColumns', 'apRows');

  DistModeId : array[TDistMode] of string =
                  ('Jaccard coefficient', 'Manhattan', 'Euclidean',
                   'squared Euclidean', 'Dice coefficient', 'user defined');

  HTMLLat1Entities : array[160..255] of string[8] =
                (' ',   '¡',  '¢',   '£',  '¤',
                 '¥',    '¦', '§',   '¨',    '©',
                 'ª',   '«',  '¬',    '­',    '®',
                 '¯',   '°',    '±', '²',   '³',
                 '´',  'µ',  '¶',   '·', '¸',
                 '¹',   'º',   '»',  '¼', '½',
                 '¾', '¿', 'À', 'Á', 'Â',
                 'Ã', 'Ä',   'Å',  'Æ',  'Ç',
                 'È', 'É', 'Ê',  'Ë',   'Ì',
                 'Í', 'Î',  'Ï',   'Ð',    'Ñ',
                 'Ò', 'Ó', 'Ô',  'Õ', 'Ö',
                 '×',  'Ø', 'Ù', 'Ú', 'Û',
                 'Ü',   'Ý', 'Þ',  'ß',  'à',
                 'á', 'â',  'ã', 'ä',   'å',
                 'æ',  'ç', 'è', 'é', 'ê',
                 'ë',   'ì', 'í', 'î',  'ï',
                 'ð',    'ñ', 'ò', 'ó', 'ô',
                 'õ', 'ö',   '÷', 'ø', 'ù',
                 'ú', 'û',  'ü',   'ý', 'þ',
                 'ÿ');


  ISO639_2Char: array[TLanguage] of string[2] = ('??', 'en', 'de', 'fr', 'es');
  ISO639_3Char: array[TLanguage] of string[3] = ('???','eng','ger','fre','spa');

const
  LENGBUF4096 = 4096;
  LENGBUF16K = 16384;
  MAXCANVASMARKS = 51;
  LENGNAMESTR = 50;
{$IFDEF PAIDVERS}               // max. number of RChart layers
  MAXNUMRCLAYERS = 16;
{$ELSE}
  MAXNUMRCLAYERS = 2;
{$ENDIF}
  MAXMTRACE = 5000;             // max. number of vertices of a mouse trace

type
  TNameStr = string[LENGNAMESTR];
  TBuf4096 = array[1..LENGBUF4096] of byte; // 2^12 bytes
  TBuf16K  = array[1..LENGBUF16K] of byte;  // 2^14 bytes
  TDataBuffer = array[1..MaxInt] of byte;
{$IFNDEF DOTNET}
  TBytes = array of byte;  // required only for Win32
                           // TBytes is declared in (.net) Borland.Delphi.System
{$ENDIF}

{$IFDEF FIREMK}
                  // required as a dummy for FireMonkey - has no effect
   TPenStyle = (psSolid, psDash, psDot, psDashDot, psDashDotDot,
   		psClear, psInsideFrame, psUserStyle, psAlternate); 
{$ENDIF}

  TCrossHair = class (TPersistent)
               private
                 FPosX     : double;                    { crosshair x position }
                 FPosY     : double;                    { crosshair Y position }
                 FColor    : TColor;                      { color of crosshair }
                 FMode     : TCrossHMode;                  { mode of crosshair }
                 FLineType : TPenStyle;               { type of crosshair line }
                 FLineWid  : integer;                { width of crosshair line }
                 FLayer    : integer;                      { layer information }
                 FOnChange : TNotifyEvent;
                 procedure SetCrossHPosX (value: double);
                 procedure SetCrossHPosY (value: double);
                 procedure SetCrossHColor (value: TColor);
                 procedure SetCrossHMode (value: TCrossHMode);
                 procedure SetCrossHLineType (value: TPenStyle);
                 procedure SetCrossHLineWid (value: integer);
                 procedure SetCrossHLayer (value: integer);
               protected
                 procedure AssignTo (Dest: TPersistent); override;
               public
                 procedure Assign(Source: TPersistent); override;
                 procedure Changed;
                 procedure SetPos (xpos, ypos: double);
               published
                 property PosX: double
                              read FPosX write SetCrossHPosX;
                 property PosY: double
                              read FPosY write SetCrossHPosY;
                 property Color: TColor
                              read FColor write SetCRossHColor;
                 property Layer: integer
                              read FLayer write SetCrossHLayer;
                 property Mode: TCrossHMode
                              read FMode write SetCrossHMode;
                 property LineType: TPenStyle
                              read FLineType write SetCrossHLineType;
                 property LineWid: integer
                              read FLineWid write SetCrossHLineWid;
                 property OnChange: TNotifyEvent
                              read FOnChange write FOnChange;
               end;

  TCustomTextLabel = class (TPersistent)
               private
                 FPosX        : double;                 { crosshair x position }
                 FPosY        : double;                 { crosshair Y position }
                 FLayer       : integer;{layer where text label is attached to }
                 FXShadow     : integer;                  { dx of label shadow }
                 FYShadow     : integer;                  { dy of label shadow }
                 FColorShadow : TColor;                      { color of shadow }
                 FAlignment   : TAlignment;    { horizontal alignment of label }
                 FVertAlign   : TVerticalAlignment; { vert. alignment of label }
                 FAttachDat   : TTxtLblAttachMode;{determines whether position
                                                 is attached to screen or data }
                 FColorBkg    : TColor;                  { color of background }
                 FColorBrd    : TColor;                 { color of border line }
                 FTransPar    : boolean;            { TRUE: box is transparent }
                 FFont        : TFont;                             { text font }
                 FCaption     : string;                        { text of label }
                 FMode        : TTxtLblMode;      { display mode of text label }
                 FOnChange    : TNotifyEvent;
                 FVisible     : boolean;              { TRUE: label is visible }
                 procedure SetTxtLblAlignment (al: TAlignment);
                 procedure SetTxtLblVertAlignment (al: TVerticalAlignment);
                 procedure SetTxtLblPosX (value: double);
                 procedure SetTxtLblPosY (value: double);
                 procedure SetTxtLblColorBkg (value: TColor);
                 procedure SetTxtLblColorBrd (value: TColor);
                 procedure SetTxtLblColorShadow (value: TColor);
                 procedure SetTxtLblLayer (value: integer);
                 procedure SetTxtLblVisible (value: boolean);
                 procedure SetTxtLblTranspar (value: boolean);
                 procedure SetTxtLblMode (value: TTxtLblMode);
                 procedure SetTxtLblFont (value: TFont);
                 procedure SetTxtLblCaption (value: string);
                 procedure SetTxtLblScreenPos (value : TTxtLblAttachMode);
                 procedure SetTxtLblShadowDx (value: integer);
                 procedure SetTxtLblShadowDy (value: integer);
               protected
                 constructor Create;
                 destructor Destroy; override;
                 procedure AssignTo (Dest: TPersistent); override;
                 procedure Assign(Source: TPersistent); override;
                 procedure Changed;
                 property PosX: double
                              read FPosX write SetTxtLblPosX;
                 property PosY: double
                              read FPosY write SetTxtLblPosY;
                 property Layer: integer
                              read FLayer write SetTxtLblLayer;
                 property AttachToData: TTxtLblAttachMode
                              read FAttachDat write SetTxtLblScreenPos;
                 property ColorBkg: TColor
                              read FColorBkg write SetTxtLblColorBkg;
                 property ColorBorder: TColor
                              read FColorBrd write SetTxtLblColorBrd;
                 property ColorShadow: TColor
                              read FColorShadow write SetTxtLblColorShadow;
                 property ShadowDx: integer
                              read FXShadow write settxtlblshadowdx;
                 property ShadowDy: integer
                              read FYShadow write SetTxtLblShadowDy;
                 property Transparent: boolean
                              read FTransPar write SetTxtLblTransPar;
                 property Alignment: TAlignment
                              read FAlignment write SetTxtLblAlignment;
                 property VerticalAlignment: TVerticalAlignment
                              read FVertAlign write SetTxtLblVertAlignment;
                 property Font: TFont
                              read FFont write SetTxtLblFont;
                 property Mode: TTxtLblMode
                              read FMode write SetTxtLblMode;
                 property Caption: string
                              read FCaption write SetTxtLblCaption;
                 property Visible: boolean
                              read FVisible write SetTxtLblVisible;
                 property OnChange: TNotifyEvent
                              read FOnChange write FOnChange;
                 procedure WriteToOpenXMLFile (var OutFile: TextFile;
                              CreateHeader: boolean; DataID: string;
                              Indent: integer);
                 function ReadFromOpenXMLFile (var InFile: TextFile;
                              DataID: string): boolean;
               end;


var
  ProcStat         : double;                                { state of process }
  LastProcStat     : double;                    { process state at last update }
  AbortMathProc    : boolean;        { TRUE: signal abortion of math procedure }
  MathFeedBackProc : FeedBackProcType;        { global math feedback procedure }
                  { this callback procedure should be declared in the
                    application program which uses the time-consuming math
                    routines. It has to be of type 'FeedBackProcType' and gets
                    the value of variable 'ProcStat' passed. In its body this
                    routine uses the value of 'cnt' to display the status of a
                    math routine. The feedback routine can be switched off by
                    assigning a NIL pointer to it }

  function  CreateMarkAsBitmap (Mark: byte; FGColor, BGColor: TColor;
                Margin: integer): TBitMap;
  procedure DrawFrame (cv: TCanvas; fs: TFrameStyle; Left, Top, Right,
                Bottom: integer; White, Silver, Gray, Black, SimpleFCol: TColor);
  procedure DrawMarkOnCanvas (const canv: TCanvas; Mark: byte; x, y: integer);
  procedure DrawRectangle (const cv: TCanvas; Left, Top, Right, Bottom: integer);
  function  FontIsTrueType (FontName: string): boolean;
  procedure PrintBitmap (Bitmap: TBitmap; X, Y: integer);
  function  ResolveCSVDelimiter (Delimiter: char): TCSVDelimiters;
  procedure SetCanvasFontSizeScaled (const Canvas: TCanvas; FontSize: integer);






Last Update: 2023-Feb-06