
{ Dimarker's Software 1991.  Forms for TVision }

unit Forms;

{$F+,O+,S-,X+}

interface

uses Objects, Views, Dialogs, Drivers;

const

  CForm : string[31] = #32#33#34#35#36#37#47#17#21#41#42#43#44#45#46#47 +
                       #48#49#50#51#52#53#54#55#56#57#58#59#60#61#62#63;

type

 ESet = set of char;

 PForm = ^TForm;
 TForm = object(TWindow)
   FormPalette : string[31];
   constructor Init(var Bounds: TRect; ATitle: TTitleStr;
                    ANumber: Integer);
   constructor Load(var S: TStream);
   procedure Store(var S: TStream);
   function  GetPalette: PPalette; virtual;
   procedure   HandleEvent(var Event: TEvent); virtual;
 end;

 PLString = ^LString;
 LString  = object(TInputLine)
   Id      : char;
   EditSet : ESet;
   constructor Init(var Bounds: TRect; AMaxLen: Integer);
   constructor Load(var S: TStream);
   procedure   Store(var S:TStream);
   procedure HandleEvent(var Event: TEvent); virtual;
   procedure Beep;
 end;

 PLByte     = ^LByte;
 LByte      = object(LString)
   constructor Init(var Bounds: TRect);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLWord  = ^LWord;
 LWord   = object(LString)
   constructor Init(var Bounds: TRect);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLShort  = ^LShort;
 LShort   = object(LString)
   constructor Init(var Bounds: TRect);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLInteger  = ^LInteger;
 LInteger   = object(LString)
   constructor Init(var Bounds: TRect);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLLongint  = ^LLongint;
 LLongint   = object(LString)
   constructor Init(var Bounds: TRect);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLSingle  = ^LSingle;
 LSingle   = object(LString)
   Len, Decm : byte;
   constructor Init(var Bounds: TRect; RLen, RDec : byte);
   constructor Load(var S: TStream);
   procedure Store(var S: TStream);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLReal  = ^LReal;
 LReal   = object(LString)
   Len, Decm : byte;
   constructor Init(var Bounds: TRect; RLen, RDec : byte);
   constructor Load(var S: TStream);
   procedure Store(var S: TStream);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLDouble  = ^LDouble;
 LDouble   = object(LString)
   Len, Decm : byte;
   constructor Init(var Bounds: TRect; RLen, RDec : byte);
   constructor Load(var S: TStream);
   procedure Store(var S: TStream);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLExtended  = ^LExtended;
 LExtended   = object(LString)
   Len, Decm : byte;
   constructor Init(var Bounds: TRect; RLen, RDec : byte);
   constructor Load(var S: TStream);
   procedure Store(var S: TStream);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLComplex  = ^LComplex;
 LComplex   = object(LString)
   Len, Decm : byte;
   constructor Init(var Bounds: TRect; RLen, RDec : byte);
   constructor Load(var S: TStream);
   procedure Store(var S: TStream);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLDate  = ^LDate;
 LDate   = object(LString)
   constructor Init(var Bounds: TRect);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLChar  = ^LChar;
 LChar   = object(LString)
   constructor Init(var Bounds: TRect);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLBoolean  = ^LBoolean;
 LBoolean   = object(LString)
   constructor Init(var Bounds: TRect);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

 PLMemo  = ^LMemo;
 LMemo   = object(LString)
   Block : longint;
   constructor Init(var Bounds: TRect);
   function DataSize: word; virtual;
   procedure SetData(var Rec); virtual;
   procedure GetData(var Rec); virtual;
   function  Valid(Command: word): boolean; virtual;
 end;

const
  RTForm: TStreamRec = (
    ObjType: 1000;
    VmtLink: Ofs(TypeOf(TForm)^);
    Load: @TForm.Load;
    Store: @TForm.Store);

  RLString: TStreamRec = (
    ObjType: 1001;
    VmtLink: Ofs(TypeOf(LString)^);
    Load: @LString.Load;
    Store: @LString.Store);

  RLByte: TStreamRec = (
    ObjType: 1002;
    VmtLink: Ofs(TypeOf(LByte)^);
    Load: @LByte.Load;
    Store: @LByte.Store);

  RLWord: TStreamRec = (
    ObjType: 1003;
    VmtLink: Ofs(TypeOf(LWord)^);
    Load: @LWord.Load;
    Store: @LWord.Store);

  RLShort: TStreamRec = (
    ObjType: 1004;
    VmtLink: Ofs(TypeOf(LShort)^);
    Load: @LShort.Load;
    Store: @LShort.Store);

  RLInteger: TStreamRec = (
    ObjType: 1005;
    VmtLink: Ofs(TypeOf(LInteger)^);
    Load: @LInteger.Load;
    Store: @LInteger.Store);

  RLLongint: TStreamRec = (
    ObjType: 1006;
    VmtLink: Ofs(TypeOf(LLongint)^);
    Load: @LLongint.Load;
    Store: @LLongint.Store);

  RLSingle: TStreamRec = (
    ObjType: 1007;
    VmtLink: Ofs(TypeOf(LSingle)^);
    Load: @LSingle.Load;
    Store: @LSingle.Store);

  RLReal: TStreamRec = (
    ObjType: 1008;
    VmtLink: Ofs(TypeOf(LReal)^);
    Load: @LReal.Load;
    Store: @LReal.Store);

  RLDouble: TStreamRec = (
    ObjType: 1009;
    VmtLink: Ofs(TypeOf(LDouble)^);
    Load: @LDouble.Load;
    Store: @LDouble.Store);

  RLExtended: TStreamRec = (
    ObjType: 1010;
    VmtLink: Ofs(TypeOf(LExtended)^);
    Load: @LExtended.Load;
    Store: @LExtended.Store);

  RLComplex: TStreamRec = (
    ObjType: 1011;
    VmtLink: Ofs(TypeOf(LComplex)^);
    Load: @LComplex.Load;
    Store: @LComplex.Store);

  RLDate: TStreamRec = (
    ObjType: 1012;
    VmtLink: Ofs(TypeOf(LDate)^);
    Load: @LDate.Load;
    Store: @LDate.Store);

  RLChar: TStreamRec = (
    ObjType: 1013;
    VmtLink: Ofs(TypeOf(LChar)^);
    Load: @LChar.Load;
    Store: @LChar.Store);

  RLBoolean: TStreamRec = (
    ObjType: 1014;
    VmtLink: Ofs(TypeOf(LBoolean)^);
    Load: @LBoolean.Load;
    Store: @LBoolean.Store);

  RLMemo: TStreamRec = (
    ObjType: 1015;
    VmtLink: Ofs(TypeOf(LMemo)^);
    Load: @LMemo.Load;
    Store: @LMemo.Store);

 procedure RegisterForms;

