Class TScreen (unit Emulvt)

Inherits from

TObject

TScreen is an object to hold an entire screen of line and handle } { Ansi escape sequences to update this virtual screen

Constructors


constructor Create;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


Functions

procedure BackSpace;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure CarriageReturn;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure ClearScreen;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure CursorDown;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure CursorLeft;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure CursorRight;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure CursorUp;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

destructor Destroy;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure Eol;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure Eop;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

function GetEscapeParam(From : Integer; var Value : Integer) : Integer;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure GotoXY(X, Y : Integer);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure InvalidEscape(EscCmd : Char);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure InvClear;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure InvRect(nRow, nCol : Integer);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure ProcessCSI_7;

Restore cursor location

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_8;

Save cursor location

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_A;

Terminal mode reset

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_at;

Cursor position report

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_B;

Cursor Up

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_C;

Cursor Down

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_D;

Cursor Right

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_H;

Restore cursor location

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_h_lc;

Set Cursor Position

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_I;

Restore Cursor

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { IBM character set operation (not part of the ANSI standard) } { [0I => Set IBM character set } { [1;nnnI => Literal mode for nnn next characters } { [2;onoffI => Switch carbon mode on (1) or off (0) } { [3;ch;cl;sh;slI => Receive carbon mode keyboard code } { [4I => Select ANSI character set


procedure ProcessCSI_J;

Select IBM char set

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_K;

Clear the screen

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_L;

Erase to End of Line

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_l_lc;

Terminal mode set

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_M;

Insert Line

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_m_lc;

Delete Line

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_n_lc;

Select Attributes

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_P;

Cursor Left

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_r_lc;

Insert character

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_S;

Delete Character

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_s_lc;

Scrolling margins

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_T;

Scroll up

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_u;

Next line

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_u_lc;

Save cursor location

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessEscape(EscCmd : Char);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure ProcessESC_D;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure ProcessESC_E;

Reverse index

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessESC_M;

Index

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Move cursor Up, scroll down if necessary


procedure process_charset_G0(EscCmd : Char);

Scroll down

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure process_charset_G1(EscCmd : Char);

G0 character set

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure process_charset_G2(EscCmd : Char);

G1 character set

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure process_charset_G3(EscCmd : Char);

G2 character set

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function ReadStr : String;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Read characters from the cursor to end of line

procedure ScrollDown;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure ScrollUp;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure SetAttr(Att : Char);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure UnimplementedEscape(EscCmd : Char);

G3 character set

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure WriteChar(Ch : Char);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Write a single character at current cursor location.

procedure WriteLiteralChar(Ch : Char);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure WriteStr(Str : String);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Write characters at current cursor location.

Properties

Events

event OnCursorVisible : TNotifyEvent


Variables

FAllInvalid : Boolean;


FAttribute : Byte;


FAutoCR : Boolean;


FAutoLF : Boolean;


FAutoWrap : Boolean;


FCarbonMode : Boolean;


FCharSetG0 : Char;


FCharSetG1 : Char;


FCharSetG2 : Char;


FCharSetG3 : Char;


FCKeyMode : Boolean;


FCntLiteral : Integer;


FCol : Integer;


FColCount : Integer;


FColSaved : Integer;


FCursorOff : Boolean;


FEscBuffer : String[80];


FEscFlag : Boolean;


FForceHighBit : Boolean;


FInvRect : TRect;


FLines : array [0..MAX_ROW] of TLine;


FNoXlat : Boolean;


FNoXlatInitial : Boolean;


Focused : Boolean;


FOnCursorVisible : TNotifyEvent;


FReverseVideo : Boolean;


FRow : Integer;


FRowCount : Integer;


FRowSaved : Integer;


FScrollRowBottom : Integer;


FScrollRowTop : Integer;


FUnderLine : Boolean;


FXlatInputTable : PXlatTable;


FXlatOutputTable : PXlatTable;



Constructors


constructor Create;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


Functions


procedure BackSpace;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure CarriageReturn;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ClearScreen;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure CursorDown;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure CursorLeft;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure CursorRight;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure CursorUp;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


destructor Destroy;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure Eol;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure Eop;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function GetEscapeParam(From : Integer; var Value : Integer) : Integer;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure GotoXY(X, Y : Integer);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InvalidEscape(EscCmd : Char);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InvClear;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure InvRect(nRow, nCol : Integer);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_7;

Restore cursor location

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_8;

Save cursor location

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_A;

Terminal mode reset

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_at;

Cursor position report

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_B;

Cursor Up

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_C;

Cursor Down

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_D;

Cursor Right

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_H;

Restore cursor location

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_h_lc;

Set Cursor Position

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_I;

Restore Cursor

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { IBM character set operation (not part of the ANSI standard) } { [0I => Set IBM character set } { [1;nnnI => Literal mode for nnn next characters } { [2;onoffI => Switch carbon mode on (1) or off (0) } { [3;ch;cl;sh;slI => Receive carbon mode keyboard code } { [4I => Select ANSI character set


procedure ProcessCSI_J;

Select IBM char set

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_K;

Clear the screen

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_L;

Erase to End of Line

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_l_lc;

Terminal mode set

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_M;

Insert Line

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_m_lc;

Delete Line

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_n_lc;

Select Attributes

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_P;

Cursor Left

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_r_lc;

Insert character

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_S;

Delete Character

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_s_lc;

Scrolling margins

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_T;

Scroll up

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_u;

Next line

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessCSI_u_lc;

Save cursor location

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessEscape(EscCmd : Char);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessESC_D;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessESC_E;

Reverse index

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ProcessESC_M;

Index

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Move cursor Up, scroll down if necessary


procedure process_charset_G0(EscCmd : Char);

Scroll down

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure process_charset_G1(EscCmd : Char);

G0 character set

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure process_charset_G2(EscCmd : Char);

G1 character set

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure process_charset_G3(EscCmd : Char);

G2 character set

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


function ReadStr : String;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Read characters from the cursor to end of line


procedure ScrollDown;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ScrollUp;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure SetAttr(Att : Char);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure UnimplementedEscape(EscCmd : Char);

G3 character set

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure WriteChar(Ch : Char);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Write a single character at current cursor location. } { Update cursor position.


procedure WriteLiteralChar(Ch : Char);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure WriteStr(Str : String);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Write characters at current cursor location. Update cursor position.


Properties


Events


event OnCursorVisible : TNotifyEvent


Variables


FAllInvalid : Boolean;


FAttribute : Byte;


FAutoCR : Boolean;


FAutoLF : Boolean;


FAutoWrap : Boolean;


FCarbonMode : Boolean;


FCharSetG0 : Char;


FCharSetG1 : Char;


FCharSetG2 : Char;


FCharSetG3 : Char;


FCKeyMode : Boolean;


FCntLiteral : Integer;


FCol : Integer;


FColCount : Integer;


FColSaved : Integer;


FCursorOff : Boolean;


FEscBuffer : String[80];


FEscFlag : Boolean;


FForceHighBit : Boolean;


FInvRect : TRect;


FLines : array [0..MAX_ROW] of TLine;


FNoXlat : Boolean;


FNoXlatInitial : Boolean;


Focused : Boolean;


FOnCursorVisible : TNotifyEvent;


FReverseVideo : Boolean;


FRow : Integer;


FRowCount : Integer;


FRowSaved : Integer;


FScrollRowBottom : Integer;


FScrollRowTop : Integer;


FUnderLine : Boolean;


FXlatInputTable : PXlatTable;


FXlatOutputTable : PXlatTable;