home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HomeWare 14
/
HOMEWARE14.bin
/
prog
/
tvtool2.arj
/
TVVIEWS.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1993-07-20
|
36KB
|
318 lines
{*
*
* Copyright (c) 1992,93 by Richard W. Hansen
*
* This source code will compile.
* Full source code available to registered users.
*
*}
(* This file was mangled by Mangler 1.10 (c) Copyright 1993 by Berend de Boer *)
UNIT TVVIEWS ;{$B+} {$X+} {$V-} {$I TVDEFS.INC} INTERFACE USES TVTYPE , TVCONST , TVMENUS , APP , DRIVERS , MENUS ,
OBJECTS , VIEWS , TEXTVIEW , DOS ;CONST CPOSINDICATOR =#2#3;CMINMAX =#3#2#3;TYPE PBXFRAME =^TBXFRAME ;
TBXFRAME =OBJECT (TFRAME)PROCEDURE HANDLEEVENT (VAR EVENT :TEVENT );VIRTUAL;END ;PBXMINMAXBUTTON =^TBXMINMAXBUTTON ;
TBXMINMAXBUTTON =OBJECT (TVIEW)CONSTRUCTOR INIT (VAR BOUNDS :TRECT );PROCEDURE DRAW ;VIRTUAL;FUNCTION GETPALETTE
:PPALETTE ;VIRTUAL;PROCEDURE HANDLEEVENT (VAR EVENT :TEVENT );VIRTUAL;PROCEDURE SETSTATE (ASTATE :WORD ;
ENABLE :BOOLEAN );VIRTUAL;END ;PBXICON =^TBXICON ;TBXICON =OBJECT (TVIEW)TITLE :PSTRING ;CONSTRUCTOR INIT
(ATITLE :TTITLESTR );CONSTRUCTOR LOAD (VAR S :TSTREAM );DESTRUCTOR DONE ;VIRTUAL;PROCEDURE DRAW ;VIRTUAL;
FUNCTION GETPALETTE :PPALETTE ;VIRTUAL;PROCEDURE HANDLEEVENT (VAR EVENT :TEVENT );VIRTUAL;PROCEDURE SETSTATE
(ASTATE :WORD ;ENABLE :BOOLEAN );VIRTUAL;PROCEDURE SIZELIMITS (VAR MIN ,MAX:TPOINT );VIRTUAL;PROCEDURE STORE
(VAR S :TSTREAM );END ;PBXWINDOWICON =^TBXWINDOWICON ;TBXWINDOWICON =OBJECT (TBXICON)VIEW :PVIEW ;CONSTRUCTOR INIT
(ATITLE :TTITLESTR ;AVIEW :PVIEW );CONSTRUCTOR LOAD (VAR S :TSTREAM );PROCEDURE CONTROLMENU (MOUSE :BOOLEAN );
PROCEDURE HANDLEEVENT (VAR EVENT :TEVENT );VIRTUAL;PROCEDURE SETSTATE (ASTATE :WORD ;ENABLE :BOOLEAN );VIRTUAL;
PROCEDURE STORE (VAR S :TSTREAM );END ;PBXWINDOW =^TBXWINDOW ;TBXWINDOW =OBJECT (TWINDOW)MINMAX :PBXMINMAXBUTTON ;
ICON :PBXWINDOWICON ;CONSTRUCTOR INIT (VAR BOUNDS :TRECT ;ATITLE :TTITLESTR ;ANUMBER :INTEGER );CONSTRUCTOR LOAD
(VAR S :TSTREAM );PROCEDURE CONTROLMENU (MOUSE :BOOLEAN );PROCEDURE HANDLEEVENT (VAR EVENT :TEVENT );VIRTUAL;
PROCEDURE INITFRAME ;VIRTUAL;PROCEDURE INITICON ;VIRTUAL;PROCEDURE SETSTATE (ASTATE :WORD ;ENABLE :BOOLEAN );VIRTUAL;
PROCEDURE STORE (VAR S :TSTREAM );END ;PBXTEXTWINDOW =^TBXTEXTWINDOW ;
TBXTEXTWINDOW =OBJECT (TBXWINDOW)INTERIOR :PTERMINAL ;HSCROLLBAR :PSCROLLBAR ;VSCROLLBAR :PSCROLLBAR ;WIDTH :BYTE ;
HEIGHT :BYTE ;CONSTRUCTOR INIT (BOUNDS :TRECT ;WINTITLE :STRING ;WINNUMBER :WORD ;AOPTIONS :WORD ;AMAXLINES :WORD );
CONSTRUCTOR LOAD (VAR S :TSTREAM );PROCEDURE CLEAR ;PROCEDURE HANDLEEVENT (VAR EVENT :TEVENT );VIRTUAL;PROCEDURE STORE
(VAR S :TSTREAM );PROCEDURE WRITE (ST :STRING );END ;PBXFORMATTEDTEXTSCROLLER =^TBXFORMATTEDTEXTSCROLLER ;
TBXFORMATTEDTEXTSCROLLER =OBJECT (TSCROLLER)BUF :PBXCHARARRAY ;BUFSIZE :WORD ;CONSTRUCTOR INIT (VAR BOUNDS :TRECT ;
AVSCROLLBAR :PSCROLLBAR ;BUFF :PBXCHARARRAY ;BUFFSIZE :WORD );CONSTRUCTOR LOAD (VAR S :TSTREAM );PROCEDURE CHANGEBOUNDS
(VAR BOUNDS :TRECT );VIRTUAL;FUNCTION DATASIZE :WORD ;VIRTUAL;PROCEDURE DRAW ;VIRTUAL;PROCEDURE GETDATA (VAR REC );
VIRTUAL;PROCEDURE SETDATA (VAR REC );VIRTUAL;PRIVATE PROCEDURE COUNTLINES ;PROCEDURE GETNEXTLINE (FIRST :WORD ;
VAR COUNT :WORD ;VAR NEXTCH :WORD );END ;PBXPOSINDICATOR =^TBXPOSINDICATOR ;
TBXPOSINDICATOR =OBJECT (TVIEW)POS :LONGINT ;CONSTRUCTOR INIT (VAR BOUNDS :TRECT );CONSTRUCTOR LOAD (VAR S :TSTREAM );
FUNCTION DATASIZE :WORD ;VIRTUAL;PROCEDURE DRAW ;VIRTUAL;PROCEDURE GETDATA (VAR REC );VIRTUAL;FUNCTION GETPALETTE
:PPALETTE ;VIRTUAL;PROCEDURE SETSTATE (ASTATE :WORD ;ENABLE :BOOLEAN );VIRTUAL;PROCEDURE SETDATA (VAR REC );VIRTUAL;
PROCEDURE STORE (VAR S :TSTREAM );END ;PBXMULTISCROLLBAR =^TBXMULTISCROLLBAR ;
TBXMULTISCROLLBAR =OBJECT (TSCROLLBAR)DESTRUCTOR DONE ;VIRTUAL;PROCEDURE SETSTATE (ASTATE :WORD ;ENABLE :BOOLEAN );
VIRTUAL;END ;PBXEDITBUFF =^TBXEDITBUFF ;TBXEDITBUFF =OBJECT (TSCROLLER)BUF :PBXBYTEARRAY ;BUFSIZE :WORD ;
ITEMSIZE :BYTE ;CONSTRUCTOR INIT (BOUNDS :TRECT ;BUFF :POINTER ;BUFFSIZE :WORD ;ITEMWIDTH :BYTE ;
AVSCROLLBAR :PSCROLLBAR );CONSTRUCTOR LOAD (VAR S :TSTREAM );FUNCTION DATASIZE :WORD ;VIRTUAL;PROCEDURE GETDATA
(VAR REC );VIRTUAL;FUNCTION GETOFFSET :WORD ;PROCEDURE GETXY (VAR POS :TPOINT );PROCEDURE HANDLEEVENT
(VAR EVENT :TEVENT );VIRTUAL;PROCEDURE SETDATA (VAR REC );VIRTUAL;PROCEDURE SETXY (POS :TPOINT );PROCEDURE STORE
(VAR S :TSTREAM );END ;PBXASCIIBUFF =^TBXASCIIBUFF ;TBXASCIIBUFF =OBJECT (TBXEDITBUFF)CONSTRUCTOR INIT (BOUNDS :TRECT ;
BUFF :POINTER ;BUFFSIZE :WORD ;AVSCROLLBAR :PSCROLLBAR );PROCEDURE DRAW ;VIRTUAL;PROCEDURE HANDLEEVENT
(VAR EVENT :TEVENT );VIRTUAL;END ;PBXHEXBUFF =^TBXHEXBUFF ;TBXHEXBUFF =OBJECT (TBXEDITBUFF)CONSTRUCTOR INIT
(BOUNDS :TRECT ;BUFF :POINTER ;BUFFSIZE :WORD ;AVSCROLLBAR :PSCROLLBAR );PROCEDURE DRAW ;VIRTUAL;PROCEDURE HANDLEEVENT
(VAR EVENT :TEVENT );VIRTUAL;END ;PBXASCIIHEXEDITOR =^TBXASCIIHEXEDITOR ;
TBXASCIIHEXEDITOR =OBJECT (TBXWINDOW)MAXPOS :WORD ;LVIEW :PBXEDITBUFF ;RVIEW :PBXEDITBUFF ;
VSCROLLBAR :PBXMULTISCROLLBAR ;INDICATOR :PBXPOSINDICATOR ;MODIFIED :BOOLEAN ;CONSTRUCTOR INIT (BOUNDS :TRECT ;
ATITLE :TTITLESTR ;ANUMBER :INTEGER ;AOPTIONS :WORD ;BUFF :POINTER ;BUFFSIZE :WORD );CONSTRUCTOR LOAD (VAR S :TSTREAM );
FUNCTION DATASIZE :WORD ;VIRTUAL;PROCEDURE GETDATA (VAR REC );VIRTUAL;PROCEDURE HANDLEEVENT (VAR EVENT :TEVENT );
VIRTUAL;PROCEDURE SETDATA (VAR REC );VIRTUAL;PROCEDURE SETSTATE (ASTATE :WORD ;ENABLE :BOOLEAN );VIRTUAL;
PROCEDURE SIZELIMITS (VAR MIN ,MAX:TPOINT );VIRTUAL;PROCEDURE STORE (VAR S :TSTREAM );END ;
WINDATA =RECORD DEVICE :PTEXTDEVICE ;FILLER :ARRAY [ 1 .. 12 ] OF CHAR ;END ;TBXBUFDATA =RECORD DATA :POINTER ;
DATASIZE :WORD ;END ;PROCEDURE ASSIGNOUTPUT (VAR F :TEXT ;AWINDOW :PBXTEXTWINDOW );PROCEDURE REGISTERTVVIEWS ;
CONST RBXFRAME :TSTREAMREC =(OBJTYPE :5100 ;VMTLINK :OFS (TYPEOF (TBXFRAME )^);LOAD :@ TBXFRAME . LOAD ;STORE :@
TBXFRAME . STORE );CONST RBXMINMAXBUTTON :TSTREAMREC =(OBJTYPE :5101 ;VMTLINK :OFS (TYPEOF (TBXMINMAXBUTTON )^);LOAD :@
TBXMINMAXBUTTON . LOAD ;STORE :@ TBXMINMAXBUTTON . STORE );CONST RBXICON :TSTREAMREC =(OBJTYPE :5102 ;
VMTLINK :OFS (TYPEOF (TBXICON )^);LOAD :@ TBXICON . LOAD ;STORE :@ TBXICON . STORE );
CONST RBXWINDOWICON :TSTREAMREC =(OBJTYPE :5103 ;VMTLINK :OFS (TYPEOF (TBXWINDOWICON )^);LOAD :@ TBXWINDOWICON . LOAD ;
STORE :@ TBXWINDOWICON . STORE );CONST RBXWINDOW :TSTREAMREC =(OBJTYPE :5104 ;VMTLINK :OFS (TYPEOF (TBXWINDOW )^);
LOAD :@ TBXWINDOW . LOAD ;STORE :@ TBXWINDOW . STORE );CONST RBXTEXTWINDOW :TSTREAMREC =(OBJTYPE :5105 ;
VMTLINK :OFS (TYPEOF (TBXTEXTWINDOW )^);LOAD :@ TBXTEXTWINDOW . LOAD ;STORE :@ TBXTEXTWINDOW . STORE );
CONST RBXFORMATTEDTEXTSCROLLER :TSTREAMREC =(OBJTYPE :5106 ;VMTLINK :OFS (TYPEOF (TBXFORMATTEDTEXTSCROLLER )^);LOAD :@
TBXFORMATTEDTEXTSCROLLER . LOAD ;STORE :@ TBXFORMATTEDTEXTSCROLLER . STORE );
CONST RBXPOSINDICATOR :TSTREAMREC =(OBJTYPE :5107 ;VMTLINK :OFS (TYPEOF (TBXPOSINDICATOR )^);LOAD :@ TBXPOSINDICATOR .
LOAD ;STORE :@ TBXPOSINDICATOR . STORE );CONST RBXMULTISCROLLBAR :TSTREAMREC =(OBJTYPE :5108 ;
VMTLINK :OFS (TYPEOF (TBXMULTISCROLLBAR )^);LOAD :@ TBXMULTISCROLLBAR . LOAD ;STORE :@ TBXMULTISCROLLBAR . STORE );
CONST RBXEDITBUFF :TSTREAMREC =(OBJTYPE :5109 ;VMTLINK :OFS (TYPEOF (TBXEDITBUFF )^);LOAD :@ TBXEDITBUFF . LOAD ;
STORE :@ TBXEDITBUFF . STORE );CONST RBXASCIIBUFF :TSTREAMREC =(OBJTYPE :5110 ;VMTLINK :OFS (TYPEOF (TBXASCIIBUFF )^);
LOAD :@ TBXASCIIBUFF . LOAD ;STORE :@ TBXASCIIBUFF . STORE );CONST RBXHEXBUFF :TSTREAMREC =(OBJTYPE :5111 ;
VMTLINK :OFS (TYPEOF (TBXHEXBUFF )^);LOAD :@ TBXHEXBUFF . LOAD ;STORE :@ TBXHEXBUFF . STORE );
CONST RBXASCIIHEXEDITOR :TSTREAMREC =(OBJTYPE :5112 ;VMTLINK :OFS (TYPEOF (TBXASCIIHEXEDITOR )^);LOAD :@
TBXASCIIHEXEDITOR . LOAD ;STORE :@ TBXASCIIHEXEDITOR . STORE );IMPLEMENTATION PROCEDURE TBXFRAME.HANDLEEVENT
(VAR EVENT:TEVENT);VAR OI1I1O1lll10:TPOINT;BEGIN IF (EVENT.WHAT =EVMOUSEDOWN )AND (STATE AND SFACTIVE <> 0 )THEN
BEGIN MAKELOCAL (EVENT.WHERE , OI1I1O1lll10 );IF (OI1I1O1lll10.Y =0 )THEN BEGIN IF (PWINDOW (OWNER )^. FLAGS AND WFCLOSE
<> 0 )AND (OI1I1O1lll10.X >= 2 )AND (OI1I1O1lll10.X <= 4 )THEN BEGIN IF (EVENT.BUTTONS =MBRIGHTBUTTON )THEN
BEGIN EVENT.WHAT := EVCOMMAND ;EVENT.COMMAND := CMPOPMENU ;EVENT.INFOPTR := OWNER ;PUTEVENT (EVENT );CLEAREVENT (EVENT );
END ;END ;END ;END ;INHERITED HANDLEEVENT(EVENT );END ;CONSTRUCTOR TBXMINMAXBUTTON.INIT (VAR BOUNDS:TRECT);
BEGIN INHERITED INIT(BOUNDS );GROWMODE := GROWMODE OR GFGROWLOX OR GFGROWHIX ;END ;PROCEDURE TBXMINMAXBUTTON.DRAW ;
VAR OO1I:TRECT;BEGIN OWNER ^. GETEXTENT (OO1I );IF (PBXWINDOW (OWNER )^. FLAGS AND WFZOOM <> 0 )THEN BEGIN OO1I.B.Y :=
OO1I.A.Y + 1 ;OO1I.A.X := OO1I.B.X - 8 ;OO1I.B.X := OO1I.A.X + 3 ;END ELSE BEGIN OO1I.B.Y := OO1I.A.Y + 1 ;OO1I.A.X :=
OO1I.B.X - 5 ;OO1I.B.X := OO1I.A.X + 3 ;END ;SETBOUNDS (OO1I );IF (STATE AND SFDRAGGING <> 0 )THEN WRITESTR (0 , 0 ,
'[]', 3 )ELSE BEGIN WRITECHAR (0 , 0 , '[', 2 , 1 );WRITECHAR (1 , 0 , '', 3 , 1 );WRITECHAR (2 , 0 , ']', 2 , 1 );
END ;END ;FUNCTION TBXMINMAXBUTTON.GETPALETTE :PPALETTE ;CONST OO10:STRING [ LENGTH(CMINMAX)] =CMINMAX;BEGIN GETPALETTE
:= @ OO10 ;END ;PROCEDURE TBXMINMAXBUTTON.HANDLEEVENT (VAR EVENT:TEVENT);BEGIN INHERITED HANDLEEVENT(EVENT );IF
(EVENT.WHAT =EVMOUSEDOWN )AND GETSTATE (SFACTIVE )THEN BEGIN EVENT.COMMAND := CMMINIMIZE ;EVENT.WHAT := EVCOMMAND ;
EVENT.INFOPTR := OWNER ;PUTEVENT (EVENT );CLEAREVENT (EVENT );END ;END ;PROCEDURE TBXMINMAXBUTTON.SETSTATE (ASTATE:WORD;
ENABLE:BOOLEAN);BEGIN INHERITED SETSTATE(ASTATE , ENABLE );IF (ASTATE AND (SFACTIVE OR SFDRAGGING )<> 0 )THEN DRAWVIEW ;
END ;CONSTRUCTOR TBXICON.INIT (ATITLE:TTITLESTR);VAR OO1I:TRECT;OOIO:WORD;OOIl:WORD;OO10:WORD;OO1l:STRING ;BEGIN IF
(ATITLE [ 1 ] =^C )THEN OO1l := COPY (ATITLE , 2 , LENGTH (ATITLE ))ELSE OO1l := ATITLE ;OO10 := POS (^M , OO1l );OOIO :=
0 ;OOIl := 0 ;WHILE (OO10 <> 0 ) DO BEGIN INC (OOIl );IF (OO10 - 1 > OOIO )THEN OOIO := OO10 - 1 ;OO1l := COPY (OO1l ,
OO10 + 1 , LENGTH (OO1l ));OO10 := POS (^M , OO1l );END ;IF (OO1l <> '')THEN BEGIN INC (OOIl );IF (LENGTH (OO1l )> OOIO
)THEN OOIO := LENGTH (OO1l );END ;DESKTOP ^. GETEXTENT (OO1I );INC (OO1I.A.X , 2 );DEC (OO1I.B.Y , 1 );OO1I.A.Y :=
OO1I.B.Y - OOIl ;OO1I.B.X := OO1I.A.X + OOIO ;INHERITED INIT(OO1I );TITLE := NEWSTR (ATITLE );OPTIONS := OPTIONS OR
OFSELECTABLE OR OFTOPSELECT ;END ;CONSTRUCTOR TBXICON.LOAD (VAR S:TSTREAM);BEGIN INHERITED LOAD(S );TITLE := S.READSTR ;
END ;DESTRUCTOR TBXICON.DONE ;BEGIN DISPOSESTR (TITLE );INHERITED DONE;END ;PROCEDURE TBXICON.DRAW ;
VAR OIO1:TDRAWBUFFER;OOllOI000O1l:WORD;OO10:WORD;OOIl:WORD;OOIO:WORD;OOlIll0I1ll1:BOOLEAN;OO1l:STRING ;OO1O:STRING ;
BEGIN IF STATE AND SFDRAGGING <> 0 THEN OOllOI000O1l := 3 ELSE IF STATE AND SFSELECTED =0 THEN OOllOI000O1l := 1 ELSE
OOllOI000O1l := 2 ;OOllOI000O1l := GETCOLOR (OOllOI000O1l );OOlIll0I1ll1 := (TITLE ^[ 1 ] =^C );IF OOlIll0I1ll1 THEN OO1l
:= COPY (TITLE ^, 2 , LENGTH (TITLE ^))ELSE OO1l := TITLE ^;OO10 := POS (^M , OO1l );OOIl := 0 ;WHILE (OO10 <> 0
) DO BEGIN MOVECHAR (OIO1 , ' ', OOllOI000O1l , SIZE.X );OO1O := COPY (OO1l , 1 , OO10 - 1 );IF OOlIll0I1ll1 THEN OOIO :=
((SIZE.X - LENGTH (OO1O ))SHR 1 )ELSE OOIO := 0 ;MOVESTR (OIO1 [ OOIO ] , OO1O , OOllOI000O1l );WRITELINE (0 , OOIl ,
SIZE.X , 1 , OIO1 );INC (OOIl );OO1l := COPY (OO1l , OO10 + 1 , LENGTH (OO1l ));OO10 := POS (^M , OO1l );END ;IF (OO1l <>
'')THEN BEGIN MOVECHAR (OIO1 , ' ', OOllOI000O1l , SIZE.X );IF OOlIll0I1ll1 THEN OOIO := ((SIZE.X - LENGTH (OO1l ))SHR 1
)ELSE OOIO := 0 ;MOVESTR (OIO1 [ OOIO ] , OO1l , OOllOI000O1l );WRITELINE (0 , OOIl , SIZE.X , 1 , OIO1 );END ;END ;
FUNCTION TBXICON.GETPALETTE :PPALETTE ;CONST OOllO111IOI1:STRING [ LENGTH(CGRAYWINDOW)] =CGRAYWINDOW;BEGIN GETPALETTE :=
@ OOllO111IOI1 ;END ;PROCEDURE TBXICON.HANDLEEVENT (VAR EVENT:TEVENT);VAR OIOO00Ol111:TRECT;
BEGIN INHERITED HANDLEEVENT(EVENT );CASE EVENT.WHAT OF EVCOMMAND :CASE EVENT.COMMAND OF CMRESIZE :BEGIN OWNER ^.
GETEXTENT (OIOO00Ol111 );DRAGVIEW (EVENT , DMDRAGMOVE , OIOO00Ol111 , SIZE , SIZE );CLEAREVENT (EVENT );END ;END ;
EVMOUSEDOWN :BEGIN OWNER ^. GETEXTENT (OIOO00Ol111 );DRAGVIEW (EVENT , DMDRAGMOVE , OIOO00Ol111 , SIZE , SIZE );
CLEAREVENT (EVENT );END ;END ;END ;PROCEDURE TBXICON.SETSTATE (ASTATE:WORD;ENABLE:BOOLEAN);
BEGIN INHERITED SETSTATE(ASTATE , ENABLE );IF (ASTATE AND (SFSELECTED OR SFFOCUSED )<> 0 )OR (ASTATE AND (SFACTIVE OR
SFDRAGGING )<> 0 )THEN DRAWVIEW ;END ;PROCEDURE TBXICON.SIZELIMITS (VAR MIN,MAX:TPOINT);BEGIN MIN.X := SIZE.X ;MIN.Y :=
SIZE.Y ;MAX.X := SIZE.X ;MAX.Y := SIZE.Y ;END ;PROCEDURE TBXICON.STORE (VAR S:TSTREAM);BEGIN INHERITED STORE(S );
S.WRITESTR (TITLE );END ;CONSTRUCTOR TBXWINDOWICON.INIT (ATITLE:TTITLESTR;AVIEW:PVIEW);BEGIN INHERITED INIT(ATITLE );
VIEW := AVIEW ;END ;CONSTRUCTOR TBXWINDOWICON.LOAD (VAR S:TSTREAM);BEGIN INHERITED LOAD(S );GETPEERVIEWPTR (S , VIEW );
END ;PROCEDURE TBXWINDOWICON.CONTROLMENU (MOUSE:BOOLEAN);VAR OO1I:TRECT;OO10:PMENUBOX;OIOO0l010lO:TEVENT;BEGIN IF MOUSE
THEN OO1I.ASSIGN (0 , 0 , 14 , 12 )ELSE OO1I.ASSIGN (ORIGIN.X , ORIGIN.Y , ORIGIN.X + 14 , ORIGIN.Y + 11 );OO10 := NEW
(PMENUBOX , INIT (OO1I , NEWMENU (NEWITEM ('~C~lose', '', KBNOKEY , CMCLOSE , HCNOCONTEXT , NEWITEM ('~M~aximize', '',
KBNOKEY , CMMAXIMIZE , HCNOCONTEXT , NEWITEM ('~P~revious', '', KBNOKEY , CMPREV , HCNOCONTEXT , NEWITEM ('~N~ext', '',
KBNOKEY , CMNEXT , HCNOCONTEXT , NEWITEM ('Mo~v~e', '', KBNOKEY , CMRESIZE , HCNOCONTEXT , NIL )))))), NIL ));IF MOUSE
THEN OIOO0l010lO.COMMAND := MOUSEPOPUPMENU (OO10 )ELSE OIOO0l010lO.COMMAND := POPUPMENU (OO10 );DISPOSEMENU (OO10 ^. MENU
);DISPOSE (OO10 );IF (OIOO0l010lO.COMMAND <> 0 )THEN BEGIN OIOO0l010lO.WHAT := EVCOMMAND ;OIOO0l010lO.INFOPTR := @ SELF ;
PUTEVENT (OIOO0l010lO );END ;END ;PROCEDURE TBXWINDOWICON.HANDLEEVENT (VAR EVENT:TEVENT);VAR OO1I:TRECT;
BEGIN CASE EVENT.WHAT OF EVKEYDOWN :CASE EVENT.KEYCODE OF KBALTMINUS :BEGIN CONTROLMENU (FALSE );CLEAREVENT (EVENT );
END ;END ;EVCOMMAND :CASE EVENT.COMMAND OF CMMAXIMIZE :BEGIN VIEW ^. SHOW ;VIEW ^. SELECT ;HIDE ;CLEAREVENT (EVENT );
END ;CMCLOSE :BEGIN IF (EVENT.INFOPTR =NIL )OR (EVENT.INFOPTR =@ SELF )THEN MESSAGE (VIEW , EVCOMMAND , CMCLOSE , @ SELF
);IF (EVENT.INFOPTR =NIL )OR (EVENT.INFOPTR =@ SELF )OR (EVENT.INFOPTR =VIEW )THEN BEGIN FREE ;CLEAREVENT (EVENT );END ;
END ;END ;EVMOUSEDOWN :BEGIN IF EVENT.DOUBLE THEN BEGIN VIEW ^. SHOW ;VIEW ^. SELECT ;HIDE ;CLEAREVENT (EVENT );END ELSE
IF (EVENT.BUTTONS =MBRIGHTBUTTON )THEN BEGIN CONTROLMENU (TRUE );CLEAREVENT (EVENT );END END ;END ;
INHERITED HANDLEEVENT(EVENT );END ;PROCEDURE TBXWINDOWICON.SETSTATE (ASTATE:WORD;ENABLE:BOOLEAN);VAR OIOI:TCOMMANDSET;
BEGIN INHERITED SETSTATE(ASTATE , ENABLE );IF (ASTATE AND SFSELECTED <> 0 )THEN ENABLECOMMANDS ([ CMCLOSE , CMMINIMIZE ,
CMRESIZE , CMNEXT , CMPREV ] );END ;PROCEDURE TBXWINDOWICON.STORE (VAR S:TSTREAM);BEGIN INHERITED STORE(S );
PUTPEERVIEWPTR (S , VIEW );END ;CONSTRUCTOR TBXWINDOW.INIT (VAR BOUNDS:TRECT;ATITLE:TTITLESTR;ANUMBER:INTEGER);
VAR OO1I:TRECT;OIll00l10I0:TPOINT;BEGIN INHERITED INIT(BOUNDS , ATITLE , WNNONUMBER );GETEXTENT (OO1I );OO1I.B.Y :=
OO1I.A.Y + 1 ;OO1I.A.X := OO1I.B.X - 8 ;OO1I.B.X := OO1I.A.X + 3 ;MINMAX := NEW (PBXMINMAXBUTTON , INIT (OO1I ));INSERT
(MINMAX );INITICON ;IF (ICON <> NIL )THEN BEGIN ICON ^. SETSTATE (SFVISIBLE , FALSE );DESKTOP ^. INSERT (ICON );END ;
END ;CONSTRUCTOR TBXWINDOW.LOAD (VAR S:TSTREAM);BEGIN INHERITED LOAD(S );GETSUBVIEWPTR (S , MINMAX );GETPEERVIEWPTR (S ,
ICON );END ;PROCEDURE TBXWINDOW.CONTROLMENU (MOUSE:BOOLEAN);VAR OO1I:TRECT;OO10:PMENUBOX;OIOO0l010lO:TEVENT;BEGIN IF
MOUSE THEN OO1I.ASSIGN (0 , 0 , 14 , 12 )ELSE OO1I.ASSIGN (ORIGIN.X , ORIGIN.Y , ORIGIN.X + 14 , ORIGIN.Y + 11 );OO10 :=
NEW (PMENUBOX , INIT (OO1I , NEWMENU (NEWITEM ('~C~lose', '', KBNOKEY , CMCLOSE , HCNOCONTEXT , NEWITEM ('~Z~oom', '',
KBNOKEY , CMZOOM , HCNOCONTEXT , NEWITEM ('~M~inimize', '', KBNOKEY , CMMINIMIZE , HCNOCONTEXT , NEWITEM ('~P~revious',
'', KBNOKEY , CMPREV , HCNOCONTEXT , NEWITEM ('~N~ext', '', KBNOKEY , CMNEXT , HCNOCONTEXT , NEWITEM ('~R~esize/move',
'', KBNOKEY , CMRESIZE , HCNOCONTEXT , NEWITEM ('~T~ile', '', KBNOKEY , CMTILE , HCNOCONTEXT , NEWITEM ('C~a~scade', '',
KBNOKEY , CMCASCADE , HCNOCONTEXT , NIL ))))))))), NIL ));IF MOUSE THEN OIOO0l010lO.COMMAND := MOUSEPOPUPMENU (OO10 )ELSE
OIOO0l010lO.COMMAND := POPUPMENU (OO10 );DISPOSEMENU (OO10 ^. MENU );DISPOSE (OO10 );IF (OIOO0l010lO.COMMAND <> 0 )THEN
BEGIN OIOO0l010lO.WHAT := EVCOMMAND ;OIOO0l010lO.INFOPTR := @ SELF ;PUTEVENT (OIOO0l010lO );END ;END ;
PROCEDURE TBXWINDOW.HANDLEEVENT (VAR EVENT:TEVENT);VAR OO1I:TRECT;BEGIN CASE EVENT.WHAT OF EVKEYDOWN :CASE EVENT.KEYCODE
OF KBALTMINUS :BEGIN CONTROLMENU (FALSE );CLEAREVENT (EVENT );END ;END ;EVCOMMAND :CASE EVENT.COMMAND OF CMMINIMIZE
:BEGIN IF (ICON <> NIL )THEN BEGIN ICON ^. SHOW ;ICON ^. SELECT ;HIDE ;END ;CLEAREVENT (EVENT );END ;CMCLOSE :BEGIN IF
(ICON <> NIL )THEN BEGIN IF (EVENT.INFOPTR =NIL )OR (EVENT.INFOPTR =@ SELF )THEN MESSAGE (ICON , EVCOMMAND , CMCLOSE , @
SELF )ELSE IF (EVENT.INFOPTR =ICON )THEN EVENT.INFOPTR := @ SELF ;END ;END ;CMPOPMENU :BEGIN CONTROLMENU (TRUE );
CLEAREVENT (EVENT );END ;END ;END ;INHERITED HANDLEEVENT(EVENT );END ;PROCEDURE TBXWINDOW.INITFRAME ;VAR OO1I:TRECT;
BEGIN GETEXTENT (OO1I );FRAME := NEW (PBXFRAME , INIT (OO1I ));END ;PROCEDURE TBXWINDOW.INITICON ;VAR OO1I:TRECT;
BEGIN ICON := NEW (PBXWINDOWICON , INIT (TITLE ^, @ SELF ));END ;PROCEDURE TBXWINDOW.SETSTATE (ASTATE:WORD;
ENABLE:BOOLEAN);BEGIN INHERITED SETSTATE(ASTATE , ENABLE );IF (ASTATE =SFACTIVE )THEN CASE ENABLE OF TRUE :MINMAX ^.
SHOW ;FALSE :MINMAX ^. HIDE ;END ;IF (ASTATE AND SFSELECTED <> 0 )THEN ENABLECOMMANDS ([ CMMINIMIZE ] );END ;
PROCEDURE TBXWINDOW.STORE (VAR S:TSTREAM);BEGIN INHERITED STORE(S );PUTSUBVIEWPTR (S , MINMAX );PUTPEERVIEWPTR (S , ICON
);END ;CONSTRUCTOR TBXTEXTWINDOW.INIT (BOUNDS:TRECT;WINTITLE:STRING ;WINNUMBER:WORD;AOPTIONS:WORD;AMAXLINES:WORD);
VAR OO1I:TRECT;BEGIN TBXWINDOW.INIT (BOUNDS , WINTITLE , WINNUMBER );HSCROLLBAR := NIL ;VSCROLLBAR := NIL ;DESKTOP ^.
GETEXTENT (OO1I );WIDTH := OO1I.B.X ;HEIGHT := AMAXLINES ;IF (HEIGHT =0 )THEN HEIGHT := OO1I.B.Y ;IF ((AOPTIONS AND
OFHSCROLLBAR )<> 0 )THEN BEGIN HSCROLLBAR := STANDARDSCROLLBAR (SBHORIZONTAL + SBHANDLEKEYBOARD );INSERT (HSCROLLBAR );
END ;IF ((AOPTIONS AND OFVSCROLLBAR )<> 0 )THEN BEGIN VSCROLLBAR := STANDARDSCROLLBAR (SBVERTICAL + SBHANDLEKEYBOARD );
INSERT (VSCROLLBAR );END ;GETEXTENT (BOUNDS );BOUNDS.GROW (- 1 , - 1 );INTERIOR := NEW (PTERMINAL , INIT (BOUNDS ,
HSCROLLBAR , VSCROLLBAR , WIDTH * HEIGHT ));INSERT (INTERIOR );END ;CONSTRUCTOR TBXTEXTWINDOW.LOAD (VAR S:TSTREAM);
BEGIN INHERITED LOAD(S );GETSUBVIEWPTR (S , INTERIOR );GETSUBVIEWPTR (S , HSCROLLBAR );GETSUBVIEWPTR (S , VSCROLLBAR );
S.READ (WIDTH , SIZEOF (BYTE ));S.READ (HEIGHT , SIZEOF (BYTE ));END ;PROCEDURE TBXTEXTWINDOW.CLEAR ;BEGIN INTERIOR ^.
QUEFRONT := 0 ;INTERIOR ^. QUEBACK := 0 ;INTERIOR ^. SETLIMIT (0 , 1 );INTERIOR ^. SETCURSOR (0 , 0 );INTERIOR ^.
SHOWCURSOR ;INTERIOR ^. DRAWVIEW ;END ;PROCEDURE TBXTEXTWINDOW.HANDLEEVENT (VAR EVENT:TEVENT);BEGIN IF (EVENT.WHAT
=EVBROADCAST )THEN CASE EVENT.COMMAND OF CMDISPLAYSTR :WRITE (PSTRING (EVENT.INFOPTR )^);CMDISPLAYCLR :CLEAR ;END ;
INHERITED HANDLEEVENT(EVENT );END ;PROCEDURE TBXTEXTWINDOW.STORE (VAR S:TSTREAM);BEGIN INHERITED STORE(S );PUTSUBVIEWPTR
(S , INTERIOR );PUTSUBVIEWPTR (S , HSCROLLBAR );GETSUBVIEWPTR (S , VSCROLLBAR );S.WRITE (WIDTH , SIZEOF (BYTE ));S.WRITE
(HEIGHT , SIZEOF (BYTE ));END ;PROCEDURE TBXTEXTWINDOW.WRITE (ST:STRING );VAR OO1l:TEXTBUF;OOIO:BYTE;OIlO:BYTE;
BEGIN OIlO := 0 ;REPEAT OOIO := 0 ;WHILE (OOIO < SIZEOF (TEXTBUF )- 2 )AND (OOIO < WIDTH )AND (OIlO < BYTE (ST [ 0 ]
)) DO BEGIN INC (OIlO );OO1l [ OOIO ] := ST [ OIlO ] ;INC (OOIO );END ;OO1l [ OOIO ] := #13;INC (OOIO );OO1l [ OOIO ] :=
#10;INC (OOIO );INTERIOR ^. STRWRITE (OO1l , OOIO );UNTIL (OIlO >= BYTE (ST [ 0 ] ));END ;
CONSTRUCTOR TBXFORMATTEDTEXTSCROLLER.INIT (VAR BOUNDS:TRECT;AVSCROLLBAR:PSCROLLBAR;BUFF:PBXCHARARRAY;BUFFSIZE:WORD);
BEGIN INHERITED INIT(BOUNDS , NIL , AVSCROLLBAR );BUF := BUFF ;BUFSIZE := BUFFSIZE ;GROWMODE := GFGROWHIX OR GFGROWHIY ;
COUNTLINES ;END ;CONSTRUCTOR TBXFORMATTEDTEXTSCROLLER.LOAD (VAR S:TSTREAM);BEGIN INHERITED LOAD(S );BUF := NIL ;BUFSIZE
:= 0 ;END ;PROCEDURE TBXFORMATTEDTEXTSCROLLER.CHANGEBOUNDS (VAR BOUNDS:TRECT);BEGIN TSCROLLER.CHANGEBOUNDS (BOUNDS );
COUNTLINES ;END ;PROCEDURE TBXFORMATTEDTEXTSCROLLER.COUNTLINES ;VAR OIlI1lll10I:WORD;OIOO101OlII:WORD;OI1OI00OlOI:WORD;
OOIl:WORD;BEGIN OOIl := 1 ;OIlI1lll10I := 0 ;WHILE (OIlI1lll10I < BUFSIZE ) DO BEGIN GETNEXTLINE (OIlI1lll10I ,
OIOO101OlII , OI1OI00OlOI );OIlI1lll10I := OI1OI00OlOI ;INC (OOIl );END ;IF OOIl <> LIMIT.Y THEN SETLIMIT (SIZE.X , OOIl
);END ;FUNCTION TBXFORMATTEDTEXTSCROLLER.DATASIZE :WORD ;BEGIN DATASIZE := SIZEOF (TBXBUFDATA );END ;
PROCEDURE TBXFORMATTEDTEXTSCROLLER.DRAW ;VAR OIlI1lll10I:WORD;OIOO101OlII:WORD;OI1OI00OlOI:WORD;OOIl:WORD;
OIO1:TDRAWBUFFER;OOllOI000O1l:BYTE;BEGIN OOllOI000O1l := GETCOLOR (1 );OIlI1lll10I := 0 ;OOIl := 0 ;WHILE (OOIl < DELTA.Y
- 1 ) DO BEGIN GETNEXTLINE (OIlI1lll10I , OIOO101OlII , OI1OI00OlOI );OIlI1lll10I := OI1OI00OlOI ;INC (OOIl );END ;OOIl
:= 0 ;WHILE (OOIl < SIZE.Y ) DO BEGIN MOVECHAR (OIO1 , ' ', OOllOI000O1l , SIZE.X );GETNEXTLINE (OIlI1lll10I ,
OIOO101OlII , OI1OI00OlOI );MOVEBUF (OIO1 , BUF ^[ OIlI1lll10I ] , OOllOI000O1l , OIOO101OlII );WRITELINE (0 , OOIl ,
SIZE.X , 1 , OIO1 );OIlI1lll10I := OI1OI00OlOI ;INC (OOIl );END ;END ;PROCEDURE TBXFORMATTEDTEXTSCROLLER.GETDATA
(VAR REC);BEGIN WITH TBXBUFDATA(REC) DO BEGIN DATA := BUF ;DATASIZE := BUFSIZE ;END ;END ;
PROCEDURE TBXFORMATTEDTEXTSCROLLER.GETNEXTLINE (FIRST:WORD;VAR COUNT:WORD;VAR NEXTCH:WORD);VAR OIlO:WORD;BEGIN COUNT := 0
;IF (FIRST >= BUFSIZE )THEN EXIT ;OIlO := FIRST ;IF (FIRST + SIZE.X > BUFSIZE )THEN NEXTCH := BUFSIZE ELSE NEXTCH :=
FIRST + SIZE.X ;WHILE (OIlO < NEXTCH )AND (BUF ^[ OIlO ] <> #13) DO INC (OIlO );IF (BUF ^[ OIlO ] =#13)THEN BEGIN NEXTCH
:= OIlO ;IF (NEXTCH < BUFSIZE )AND (BUF ^[ NEXTCH + 1 ] =#10)THEN INC (NEXTCH );END ELSE BEGIN WHILE (OIlO > FIRST )AND
(BUF ^[ OIlO ] <> ' ') DO DEC (OIlO );IF (OIlO =FIRST )THEN OIlO := NEXTCH ELSE NEXTCH := OIlO ;END ;IF (NEXTCH < BUFSIZE
)THEN INC (NEXTCH );COUNT := OIlO - FIRST ;END ;PROCEDURE TBXFORMATTEDTEXTSCROLLER.SETDATA (VAR REC);
BEGIN WITH TBXBUFDATA(REC) DO BEGIN BUF := DATA ;BUFSIZE := DATASIZE ;END ;SCROLLTO (0 , 0 );COUNTLINES ;END ;
CONSTRUCTOR TBXPOSINDICATOR.INIT (VAR BOUNDS:TRECT);BEGIN INHERITED INIT(BOUNDS );GROWMODE := GFGROWLOY OR GFGROWHIY ;
POS := 1 ;END ;CONSTRUCTOR TBXPOSINDICATOR.LOAD (VAR S:TSTREAM);BEGIN INHERITED LOAD(S );S.READ (POS , SIZEOF (LONGINT
));END ;FUNCTION TBXPOSINDICATOR.DATASIZE :WORD ;BEGIN DATASIZE := SIZEOF (LONGINT );END ;PROCEDURE TBXPOSINDICATOR.DRAW
;VAR OOllOI000O1l:WORD;OI111IlIO1II:CHAR;OIOI1l01I01:STRING [ 12 ] ;OIO1:TDRAWBUFFER;BEGIN IF (STATE AND SFDRAGGING =0
)THEN BEGIN OOllOI000O1l := GETCOLOR (1 );OI111IlIO1II := #205;END ELSE BEGIN OOllOI000O1l := GETCOLOR (2 );OI111IlIO1II
:= #196;END ;STR (POS , OIOI1l01I01 );MOVECHAR (OIO1 , OI111IlIO1II , OOllOI000O1l , SIZE.X );MOVESTR (OIO1 , ' Pos : '+
OIOI1l01I01 + ' ', OOllOI000O1l );WRITEBUF (0 , 0 , SIZE.X , 1 , OIO1 );END ;PROCEDURE TBXPOSINDICATOR.GETDATA (VAR REC);
BEGIN LONGINT (REC ):= POS ;END ;FUNCTION TBXPOSINDICATOR.GETPALETTE :PPALETTE ;CONST OO10:STRING [
LENGTH(CPOSINDICATOR)] =CPOSINDICATOR;BEGIN GETPALETTE := @ OO10 ;END ;PROCEDURE TBXPOSINDICATOR.SETDATA (VAR REC);
BEGIN IF (POS <> LONGINT (REC ))THEN BEGIN POS := LONGINT (REC );DRAWVIEW ;END ;END ;PROCEDURE TBXPOSINDICATOR.SETSTATE
(ASTATE:WORD;ENABLE:BOOLEAN);BEGIN INHERITED SETSTATE(ASTATE , ENABLE );IF (ASTATE =SFDRAGGING )THEN DRAWVIEW ;END ;
PROCEDURE TBXPOSINDICATOR.STORE (VAR S:TSTREAM);BEGIN INHERITED STORE(S );S.WRITE (POS , SIZEOF (LONGINT ));END ;
DESTRUCTOR TBXMULTISCROLLBAR.DONE ;BEGIN INHERITED SETSTATE(SFVISIBLE , FALSE );INHERITED DONE;END ;
PROCEDURE TBXMULTISCROLLBAR.SETSTATE (ASTATE:WORD;ENABLE:BOOLEAN);BEGIN IF (ASTATE =SFVISIBLE )AND NOT ENABLE THEN EXIT ;
INHERITED SETSTATE(ASTATE , ENABLE );END ;CONSTRUCTOR TBXEDITBUFF.INIT (BOUNDS:TRECT;BUFF:POINTER;BUFFSIZE:WORD;
ITEMWIDTH:BYTE;AVSCROLLBAR:PSCROLLBAR);VAR O10OIO0I0111l:WORD;BEGIN INHERITED INIT(BOUNDS , NIL , AVSCROLLBAR );OPTIONS
:= OPTIONS OR OFFRAMED ;BUF := BUFF ;BUFSIZE := BUFFSIZE ;ITEMSIZE := ITEMWIDTH ;SHOWCURSOR ;BLOCKCURSOR ;O10OIO0I0111l
:= (BUFSIZE * ITEMSIZE )DIV SIZE.X ;IF ((BUFSIZE * ITEMSIZE )MOD SIZE.X <> 0 )THEN INC (O10OIO0I0111l );SETLIMIT (SIZE.X
, O10OIO0I0111l );END ;CONSTRUCTOR TBXEDITBUFF.LOAD (VAR S:TSTREAM);BEGIN INHERITED LOAD(S );S.READ (ITEMSIZE , SIZEOF
(BYTE ));BUF := NIL ;BUFSIZE := 0 ;END ;FUNCTION TBXEDITBUFF.DATASIZE :WORD ;BEGIN DATASIZE := SIZEOF (TBXBUFDATA );
END ;PROCEDURE TBXEDITBUFF.GETDATA (VAR REC);BEGIN WITH TBXBUFDATA(REC) DO BEGIN DATA := BUF ;DATASIZE := BUFSIZE ;END ;
END ;FUNCTION TBXEDITBUFF.GETOFFSET :WORD ;BEGIN GETOFFSET := WORD ((LONGINT (DELTA.Y * SIZE.X )+ LONGINT (CURSOR.Y *
SIZE.X )+ CURSOR.X )DIV ITEMSIZE );END ;PROCEDURE TBXEDITBUFF.GETXY (VAR POS:TPOINT);BEGIN POS.X := CURSOR.X DIV ITEMSIZE
;POS.Y := CURSOR.Y ;END ;PROCEDURE TBXEDITBUFF.HANDLEEVENT (VAR EVENT:TEVENT);VAR OIOllI0O1OI:TPOINT;OOIl:INTEGER;
BEGIN CASE EVENT.WHAT OF EVBROADCAST :BEGIN CASE EVENT.COMMAND OF CMSCROLLBARCHANGED :BEGIN IF (VSCROLLBAR ^. VALUE <>
DELTA.Y )THEN BEGIN OIOllI0O1OI := CURSOR ;INHERITED HANDLEEVENT(EVENT );SETCURSOR (OIOllI0O1OI.X , OIOllI0O1OI.Y );
MESSAGE (OWNER , EVBROADCAST , CMCURSORMOVED , @ SELF );END ;END ;END ;END ;EVKEYDOWN :BEGIN CASE EVENT.KEYCODE OF KBUP
:BEGIN OOIl := CURSOR.Y - 1 ;IF (OOIl < 0 )THEN SCROLLTO (0 , DELTA.Y - 1 )ELSE SETCURSOR (CURSOR.X , OOIl );MESSAGE
(OWNER , EVBROADCAST , CMCURSORMOVED , @ SELF );END ;KBPGUP :BEGIN IF (DELTA.Y - SIZE.Y >= 0 )THEN BEGIN SCROLLTO (0 ,
DELTA.Y - SIZE.Y );END ELSE BEGIN SCROLLTO (0 , 0 );SETCURSOR (CURSOR.X , 0 );END ;MESSAGE (OWNER , EVBROADCAST ,
CMCURSORMOVED , @ SELF );END ;KBLEFT :BEGIN IF (CURSOR.X > 0 )THEN BEGIN SETCURSOR (CURSOR.X - 1 , CURSOR.Y );END ELSE IF
(CURSOR.Y > 0 )THEN BEGIN SETCURSOR (SIZE.X - 1 , CURSOR.Y - 1 );END ELSE IF (DELTA.Y > 0 )THEN BEGIN SCROLLTO (0 ,
DELTA.Y - 1 );SETCURSOR (SIZE.X - 1 , 0 );END ;MESSAGE (OWNER , EVBROADCAST , CMCURSORMOVED , @ SELF );END ;KBRIGHT
:BEGIN IF (CURSOR.X + 1 < SIZE.X )THEN BEGIN SETCURSOR (CURSOR.X + 1 , CURSOR.Y );END ELSE IF (CURSOR.Y + 1 < SIZE.Y
)THEN BEGIN SETCURSOR (0 , CURSOR.Y + 1 );END ELSE IF (DELTA.Y + SIZE.Y < LIMIT.Y )THEN BEGIN SCROLLTO (0 , DELTA.Y + 1
);SETCURSOR (0 , SIZE.Y - 1 );END ;MESSAGE (OWNER , EVBROADCAST , CMCURSORMOVED , @ SELF );END ;KBDOWN :BEGIN OOIl :=
CURSOR.Y + 1 ;IF (OOIl =SIZE.Y )THEN SCROLLTO (0 , DELTA.Y + 1 )ELSE SETCURSOR (CURSOR.X , OOIl );MESSAGE (OWNER ,
EVBROADCAST , CMCURSORMOVED , @ SELF );END ;KBPGDN :BEGIN IF (DELTA.Y + SIZE.Y < LIMIT.Y )THEN BEGIN SCROLLTO (0 ,
DELTA.Y + SIZE.Y );END ELSE BEGIN SCROLLTO (0 , LIMIT.Y );SETCURSOR (CURSOR.X , SIZE.Y - 1 );END ;MESSAGE (OWNER ,
EVBROADCAST , CMCURSORMOVED , @ SELF );END ;KBCTRLPGDN :BEGIN SCROLLTO (0 , LIMIT.Y );SETCURSOR (SIZE.X - 1 , SIZE.Y - 1
);MESSAGE (OWNER , EVBROADCAST , CMCURSORMOVED , @ SELF );END ;KBCTRLPGUP :BEGIN SCROLLTO (0 , 0 );SETCURSOR (0 , 0 );
MESSAGE (OWNER , EVBROADCAST , CMCURSORMOVED , @ SELF );END ;END ;END ;EVMOUSEDOWN :BEGIN IF MOUSEINVIEW (EVENT.WHERE
)THEN BEGIN MAKELOCAL (EVENT.WHERE , OIOllI0O1OI );SETCURSOR (OIOllI0O1OI.X , OIOllI0O1OI.Y );MESSAGE (OWNER ,
EVBROADCAST , CMCURSORMOVED , @ SELF );END ;END ;END ;INHERITED HANDLEEVENT(EVENT );END ;PROCEDURE TBXEDITBUFF.SETXY
(POS:TPOINT);BEGIN SETCURSOR (POS.X * ITEMSIZE , POS.Y );END ;PROCEDURE TBXEDITBUFF.SETDATA (VAR REC);
VAR O10OIO0I0111l:WORD;BEGIN WITH TBXBUFDATA(REC) DO BEGIN BUF := DATA ;BUFSIZE := DATASIZE ;O10OIO0I0111l := (BUFSIZE *
ITEMSIZE )DIV SIZE.X ;END ;IF ((BUFSIZE * ITEMSIZE )MOD SIZE.X <> 0 )THEN INC (O10OIO0I0111l );SETLIMIT (SIZE.X ,
O10OIO0I0111l );SCROLLTO (0 , 0 );END ;PROCEDURE TBXEDITBUFF.STORE (VAR S:TSTREAM);BEGIN INHERITED STORE(S );S.WRITE
(ITEMSIZE , SIZEOF (BYTE ));END ;CONSTRUCTOR TBXASCIIBUFF.INIT (BOUNDS:TRECT;BUFF:POINTER;BUFFSIZE:WORD;
AVSCROLLBAR:PSCROLLBAR);BEGIN INHERITED INIT(BOUNDS , BUFF , BUFFSIZE , 1 , AVSCROLLBAR );END ;
PROCEDURE TBXASCIIBUFF.HANDLEEVENT (VAR EVENT:TEVENT);VAR OOIO:WORD;BEGIN INHERITED HANDLEEVENT(EVENT );IF (EVENT.WHAT
=EVKEYDOWN )THEN BEGIN CASE EVENT.CHARCODE OF #1.. #8, #10.. #255:BEGIN OOIO := GETOFFSET ;IF (OOIO < BUFSIZE )THEN
BEGIN BUF ^[ OOIO ] := BYTE (EVENT.CHARCODE );MESSAGE (OWNER , EVBROADCAST , CMUPDATEVIEW , @ SELF );MESSAGE (OWNER ,
EVBROADCAST , CMEDITVIEW , @ SELF );MESSAGE (OWNER , EVKEYDOWN , KBRIGHT , @ SELF );CLEAREVENT (EVENT );END ;END ;END ;
END ;END ;PROCEDURE TBXASCIIBUFF.DRAW ;VAR OOllOI000O1l:BYTE;OIlO:WORD;OIll:WORD;OIlI1lll10I:WORD;OIlI1OIllI1:WORD;
OIO1:ARRAY [ 1 .. 4096 ] OF BYTE;BEGIN OOllOI000O1l := GETCOLOR (1 );OIlI1lll10I := DELTA.Y * SIZE.X ;OIlI1OIllI1 :=
OIlI1lll10I + (SIZE.Y * SIZE.X )- 1 ;IF (OIlI1OIllI1 >= BUFSIZE )THEN OIlI1OIllI1 := BUFSIZE - 1 ;MOVECHAR (OIO1 , '.',
OOllOI000O1l , (SIZE.Y * SIZE.X ));OIll := 1 ;FOR OIlO := OIlI1lll10I TO OIlI1OIllI1 DO BEGIN OIO1 [ OIll ] := BUF ^[
OIlO ] ;INC (OIll );INC (OIll );END ;WRITEBUF (0 , 0 , SIZE.X , SIZE.Y , OIO1 );END ;CONSTRUCTOR TBXHEXBUFF.INIT
(BOUNDS:TRECT;BUFF:POINTER;BUFFSIZE:WORD;AVSCROLLBAR:PSCROLLBAR);BEGIN INHERITED INIT(BOUNDS , BUFF , BUFFSIZE , 2 ,
AVSCROLLBAR );END ;PROCEDURE TBXHEXBUFF.DRAW ;CONST OOIOOOI11OI1:ARRAY [ 0 .. $F ] OF CHAR='0123456789ABCDEF';
VAR OOllOI000O1l:BYTE;OIlO:WORD;OIll:WORD;OIlI1lll10I:WORD;OIlI1OIllI1:WORD;OIO1:ARRAY [ 1 .. 4096 ] OF BYTE;
OIlIl0l11OO:WORD;BEGIN OIlIl0l11OO := SIZE.X DIV 2 ;OOllOI000O1l := GETCOLOR (1 );OIlI1lll10I := DELTA.Y * OIlIl0l11OO ;
OIlI1OIllI1 := OIlI1lll10I + (SIZE.Y * OIlIl0l11OO )- 1 ;IF (OIlI1OIllI1 >= BUFSIZE )THEN OIlI1OIllI1 := BUFSIZE - 1 ;
MOVECHAR (OIO1 , '.', OOllOI000O1l , (SIZE.Y * SIZE.X ));OIll := 1 ;FOR OIlO := OIlI1lll10I TO OIlI1OIllI1 DO BEGIN OIO1
[ OIll ] := BYTE (OOIOOOI11OI1 [ BUF ^[ OIlO ] SHR 4 ] );INC (OIll );INC (OIll );OIO1 [ OIll ] := BYTE (OOIOOOI11OI1 [
BUF ^[ OIlO ] AND $F ] );INC (OIll );INC (OIll );END ;WRITEBUF (0 , 0 , SIZE.X , SIZE.Y , OIO1 );END ;
PROCEDURE TBXHEXBUFF.HANDLEEVENT (VAR EVENT:TEVENT);VAR OIlO:BYTE;OIOI:INTEGER;OOIO:WORD;
BEGIN INHERITED HANDLEEVENT(EVENT );IF (EVENT.WHAT =EVKEYDOWN )THEN BEGIN CASE EVENT.CHARCODE OF '0'.. '9', 'a'.. 'f',
'A'.. 'F':BEGIN OOIO := GETOFFSET ;IF (OOIO < BUFSIZE )THEN BEGIN VAL ('$'+ EVENT.CHARCODE , OIlO , OIOI );IF ((CURSOR.X
MOD 2 )=0 )THEN BUF ^[ OOIO ] := (BUF ^[ OOIO ] AND $0F )OR (OIlO SHL 4 )ELSE BUF ^[ OOIO ] := (BUF ^[ OOIO ] AND $F0 )OR
OIlO ;MESSAGE (OWNER , EVBROADCAST , CMUPDATEVIEW , @ SELF );MESSAGE (OWNER , EVBROADCAST , CMEDITVIEW , @ SELF );
MESSAGE (OWNER , EVKEYDOWN , KBRIGHT , @ SELF );CLEAREVENT (EVENT );END ;END ;END ;END ;END ;
CONSTRUCTOR TBXASCIIHEXEDITOR.INIT (BOUNDS:TRECT;ATITLE:TTITLESTR;ANUMBER:INTEGER;AOPTIONS:WORD;BUFF:POINTER;
BUFFSIZE:WORD);VAR OIlIl0l11OO:WORD;OI1I1O01l1ll:WORD;BEGIN OIlIl0l11OO := BOUNDS.B.X - BOUNDS.A.X - 3 ;OI1I1O01l1ll :=
(OIlIl0l11OO DIV 3 );OIlIl0l11OO := OI1I1O01l1ll * 3 ;BOUNDS.B.X := OIlIl0l11OO + BOUNDS.A.X + 3 ;INHERITED INIT(BOUNDS ,
ATITLE , ANUMBER );MODIFIED := FALSE ;GETEXTENT (BOUNDS );BOUNDS.ASSIGN (BOUNDS.B.X - 1 , BOUNDS.A.Y + 1 , BOUNDS.B.X ,
BOUNDS.B.Y - 1 );VSCROLLBAR := NEW (PBXMULTISCROLLBAR , INIT (BOUNDS ));VSCROLLBAR ^. GROWMODE := GFGROWHIY ;INSERT
(VSCROLLBAR );GETEXTENT (BOUNDS );BOUNDS.GROW (- 1 , - 1 );BOUNDS.B.X := BOUNDS.A.X + (2 * OI1I1O01l1ll );LVIEW := NEW
(PBXHEXBUFF , INIT (BOUNDS , BUFF , BUFFSIZE , VSCROLLBAR ));LVIEW ^. GROWMODE := GFGROWHIY ;INSERT (LVIEW );GETEXTENT
(BOUNDS );BOUNDS.GROW (- 1 , - 1 );BOUNDS.A.X := BOUNDS.B.X - OI1I1O01l1ll ;RVIEW := NEW (PBXASCIIBUFF , INIT (BOUNDS ,
BUFF , BUFFSIZE , VSCROLLBAR ));RVIEW ^. GROWMODE := GFGROWHIY ;INSERT (RVIEW );IF ((AOPTIONS AND OFPOSINDICATOR )<> 0
)THEN BEGIN BOUNDS.ASSIGN (2 , SIZE.Y - 1 , 15 , SIZE.Y );INDICATOR := NEW (PBXPOSINDICATOR , INIT (BOUNDS ));INSERT
(INDICATOR );INDICATOR ^. HIDE ;END ;END ;CONSTRUCTOR TBXASCIIHEXEDITOR.LOAD (VAR S:TSTREAM);BEGIN INHERITED LOAD(S );
GETSUBVIEWPTR (S , LVIEW );GETSUBVIEWPTR (S , RVIEW );GETSUBVIEWPTR (S , VSCROLLBAR );GETSUBVIEWPTR (S , INDICATOR );
MODIFIED := FALSE ;MAXPOS := 0 ;END ;FUNCTION TBXASCIIHEXEDITOR.DATASIZE :WORD ;BEGIN DATASIZE := LVIEW ^. DATASIZE ;
END ;PROCEDURE TBXASCIIHEXEDITOR.GETDATA (VAR REC);BEGIN LVIEW ^. GETDATA (REC );END ;
PROCEDURE TBXASCIIHEXEDITOR.HANDLEEVENT (VAR EVENT:TEVENT);VAR OIOllI0O1OI:TPOINT;OII0I11l101:WORD;BEGIN IF (EVENT.WHAT
=EVBROADCAST )THEN BEGIN CASE EVENT.COMMAND OF CMUPDATEVIEW :BEGIN REDRAW ;CLEAREVENT (EVENT );EXIT ;END ;CMEDITVIEW
:BEGIN IF (EVENT.INFOPTR =LVIEW )THEN OII0I11l101 := LVIEW ^. GETOFFSET ELSE IF (EVENT.INFOPTR =RVIEW )THEN OII0I11l101
:= RVIEW ^. GETOFFSET ;INC (OII0I11l101 );IF (OII0I11l101 > MAXPOS )THEN MAXPOS := OII0I11l101 ;CLEAREVENT (EVENT );
MODIFIED := TRUE ;EXIT ;END ;CMCURSORMOVED :BEGIN IF (EVENT.INFOPTR =LVIEW )THEN BEGIN IF (INDICATOR <> NIL )THEN
BEGIN OII0I11l101 := LVIEW ^. GETOFFSET ;INC (OII0I11l101 );INDICATOR ^. SETDATA (OII0I11l101 );INDICATOR ^. DRAWVIEW ;
END ;LVIEW ^. GETXY (OIOllI0O1OI );RVIEW ^. SETXY (OIOllI0O1OI );CLEAREVENT (EVENT );EXIT ;END ELSE IF (EVENT.INFOPTR
=RVIEW )THEN BEGIN IF (INDICATOR <> NIL )THEN BEGIN OII0I11l101 := RVIEW ^. GETOFFSET ;INC (OII0I11l101 );INDICATOR ^.
SETDATA (OII0I11l101 );INDICATOR ^. DRAWVIEW ;END ;RVIEW ^. GETXY (OIOllI0O1OI );LVIEW ^. SETXY (OIOllI0O1OI );
CLEAREVENT (EVENT );EXIT ;END ;END ;END ;END ;INHERITED HANDLEEVENT(EVENT );END ;PROCEDURE TBXASCIIHEXEDITOR.SETDATA
(VAR REC);VAR OO01:LONGINT;BEGIN LVIEW ^. SETDATA (REC );RVIEW ^. SETDATA (REC );MODIFIED := FALSE ;MAXPOS := 0 ;IF
(INDICATOR <> NIL )THEN BEGIN OO01 := 0 ;INDICATOR ^. SETDATA (OO01 );END ;END ;PROCEDURE TBXASCIIHEXEDITOR.SETSTATE
(ASTATE:WORD;ENABLE:BOOLEAN);BEGIN INHERITED SETSTATE(ASTATE , ENABLE );CASE ASTATE OF SFACTIVE :BEGIN IF (INDICATOR <>
NIL )THEN INDICATOR ^. SETSTATE (SFVISIBLE , ENABLE );END ;END ;END ;PROCEDURE TBXASCIIHEXEDITOR.SIZELIMITS
(VAR MIN,MAX:TPOINT);BEGIN INHERITED SIZELIMITS(MIN , MAX );MIN.X := SIZE.X ;MAX.X := SIZE.X ;END ;
PROCEDURE TBXASCIIHEXEDITOR.STORE (VAR S:TSTREAM);BEGIN INHERITED STORE(S );PUTSUBVIEWPTR (S , LVIEW );PUTSUBVIEWPTR (S ,
RVIEW );PUTSUBVIEWPTR (S , VSCROLLBAR );PUTSUBVIEWPTR (S , INDICATOR );END ;FUNCTION OOlIlOll0O00
(VAR OO1l:TEXTREC):INTEGER ;FAR ;BEGIN WITH OO1l DO BEGIN WINDATA (USERDATA ). DEVICE ^. STRWRITE (BUFPTR ^, BUFPOS );
BUFPOS := 0 ;END ;OOlIlOll0O00 := 0 ;END ;FUNCTION O100l0IlO0II1 (VAR OO1l:TEXTREC):INTEGER ;FAR ;BEGIN O100l0IlO0II1 :=
0 ;END ;FUNCTION O100lll0II0OO (VAR OO1l:TEXTREC):INTEGER ;FAR ;BEGIN WITH OO1l DO BEGIN IF (MODE =FMINPUT )THEN
BEGIN INOUTFUNC := @ O100l0IlO0II1 ;FLUSHFUNC := @ O100l0IlO0II1 ;END ELSE BEGIN INOUTFUNC := @ OOlIlOll0O00 ;FLUSHFUNC
:= @ OOlIlOll0O00 ;END ;CLOSEFUNC := @ O100l0IlO0II1 ;O100lll0II0OO := 0 ;END ;END ;PROCEDURE ASSIGNOUTPUT (VAR F:TEXT;
AWINDOW:PBXTEXTWINDOW);BEGIN WITH TEXTREC(F) DO BEGIN HANDLE := $FFFF ;MODE := FMCLOSED ;BUFSIZE := SIZEOF (BUFFER );
BUFPTR := @ BUFFER ;OPENFUNC := @ O100lll0II0OO ;WINDATA (USERDATA ). DEVICE := AWINDOW ^. INTERIOR ;END ;END ;
PROCEDURE REGISTERTVVIEWS ;BEGIN REGISTERTYPE (RBXFRAME );REGISTERTYPE (RBXMINMAXBUTTON );REGISTERTYPE (RBXICON );
REGISTERTYPE (RBXWINDOWICON );REGISTERTYPE (RBXWINDOW );REGISTERTYPE (RBXTEXTWINDOW );REGISTERTYPE
(RBXFORMATTEDTEXTSCROLLER );REGISTERTYPE (RBXPOSINDICATOR );REGISTERTYPE (RBXMULTISCROLLBAR );REGISTERTYPE (RBXEDITBUFF
);REGISTERTYPE (RBXASCIIBUFF );REGISTERTYPE (RBXHEXBUFF );REGISTERTYPE (RBXASCIIHEXEDITOR );END ;END .