home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
bbs
/
pibterm
/
pibt3sp3
/
reviewca.pas
< prev
Wrap
Pascal/Delphi Source File
|
1985-08-14
|
10KB
|
275 lines
(*----------------------------------------------------------------------*)
(* Review_Captured_Text --- display internal capture buffer *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Review_Captured_Text;
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: Review_Captured_Text *)
(* *)
(* Purpose: Displays contents of internal capture buffer of *)
(* last Max_Review_Length lines received from *)
(* communications port *)
(* *)
(* Calling Sequence: *)
(* *)
(* Review_Captured_Text; *)
(* *)
(* Calls: *)
(* *)
(* Save_Screen *)
(* Restore_Screen *)
(* Update_Lines_Displayed *)
(* Reset_Global_Colors *)
(* *)
(*----------------------------------------------------------------------*)
VAR
I: INTEGER;
J: INTEGER;
L: INTEGER;
Ch: CHAR;
Quit: BOOLEAN;
Bot_Line: INTEGER;
Top_Line: INTEGER;
Review_Len: INTEGER;
Redraw: BOOLEAN;
(*----------------------------------------------------------------------*)
(* Update_Lines_Displayed -- tell which lines currently displayed *)
(*----------------------------------------------------------------------*)
PROCEDURE Update_Lines_Displayed;
BEGIN (* Update_Lines_Displayed *)
Window( 1, 1, 80, 25 );
GoToXY( 67 , 23 );
WRITE( Top_Line, ' --> ', Bot_Line );
ClrEol;
Window( 1, 1, 80, 20 );
END (* Update_Lines_Displayed *);
(*----------------------------------------------------------------------*)
BEGIN (* Review_Captured_Text *)
(* Save current screen contents *)
Save_Screen( Saved_Screen );
(* Whole screen is window *)
Window( 1, 1, 80, 25 );
(* Clear screen *)
ClrScr;
(* Draw split-screen bar *)
TextColor( Menu_Frame_Color );
GoToXY( 1 , 22 );
FOR I := 1 TO 29 DO
WRITE('=');
TextColor( Menu_Text_Color );
WRITE(' Review Captured Text ');
TextColor( Menu_Frame_Color );
FOR I := 1 TO 29 DO
WRITE('=');
(* Display instructions *)
GoToXY( 1 , 23 );
WRITE('Esc');
TextColor( Menu_Text_Color );
WRITE(' to quit');
GoToXY( 52 , 23 );
TextColor( Menu_Frame_Color );
WRITELN('Current lines: ');
WRITE('PgUp/PgDn');
TextColor( Menu_Text_Color );
WRITE(' to page ');
TextColor( Menu_Frame_Color );
WRITE('⑧/⑨ ');
TextColor( Menu_Text_Color );
WRITELN('to scroll');
TextColor( Menu_Frame_Color );
WRITE('Home');
TextColor( Menu_Text_Color );
WRITE(' first screen ');
TextColor( Menu_Frame_Color );
WRITE('End');
TextColor( Menu_Text_Color );
WRITE(' last screen');
(* Scrolling window for viewing *)
Window( 1, 1, 80, 20 );
(* Not done yet *)
Quit := FALSE;
(* First page *)
Top_Line := 1;
Redraw := TRUE;
(* Text color for display *)
TextColor( Menu_Text_Color );
(* Current length of review buf. *)
Review_Len := Review_Head - Review_Tail + 1;
IF ( Review_Len <= 0 ) THEN Review_Len := Review_Len + Max_Review_Length;
(* List buffer contents *)
REPEAT
(* Display current page *)
Bot_Line := MIN( Top_Line + 19 , Review_Len );
L := 0;
IF Redraw THEN
BEGIN
FOR I := Top_Line TO Bot_Line DO
BEGIN
L := L + 1;
GoToXY( 1 , L );
J := Review_Tail + I - 1;
IF ( J > Max_Review_Length ) THEN
J := J - Max_Review_Length
ELSE IF ( J < 1 ) THEN
J := J + Max_Review_Length;
WRITE ( Review_Buffer^[ J ] );
ClrEol;
END;
FOR I := ( L + 1 ) TO 20 DO
BEGIN
GoToXY( 1 , I );
ClrEol;
END;
END;
(* Assume no need to redraw screen *)
Redraw := FALSE;
(* Indicate which lines displayed *)
Update_Lines_Displayed;
(* Read command *)
READ( Kbd , Ch );
IF ( ORD( Ch ) = ESC ) AND ( NOT KeyPressed ) THEN
Quit := TRUE
ELSE
BEGIN
READ( Kbd, Ch );
CASE ORD( Ch ) OF
U_Arrow: BEGIN (* Up Arrow -- scroll up one line *)
IF Top_Line > 1 THEN
BEGIN
(* Make room for new line *)
GoToXY( 1 , 1 );
InsLine;
Top_Line := Top_Line - 1;
Bot_Line := Bot_Line - 1;
J := Review_Tail + Top_Line - 1;
IF ( J > Max_Review_Length ) THEN
J := J - Max_Review_Length
ELSE IF ( J < 1 ) THEN
J := J + Max_Review_Length;
WRITE( Review_Buffer^[ J ] );
ClrEol;
END;
END (* Up Arrow *);
D_Arrow: BEGIN (* Down Arrow -- scroll down one line *)
IF Bot_Line < Review_Len THEN
BEGIN
(* Make room for new line *)
GoToXY( 1 , 1 );
DelLine;
Top_Line := Top_Line + 1;
Bot_Line := Bot_Line + 1;
J := Review_Tail + Bot_Line - 1;
IF ( J > Max_Review_Length ) THEN
J := J - Max_Review_Length
ELSE IF ( J < 1 ) THEN
J := J + Max_Review_Length;
GoToXY( 1 , Bot_Line - Top_Line + 1 );
WRITE( Review_Buffer^[ J ] );
ClrEol;
END;
END (* Down Arrow *);
PgUp: BEGIN (* PgUp -- move up one page *)
IF ( Top_Line > 1 ) THEN
BEGIN
Redraw := TRUE;
Top_Line := MAX( Top_Line - 19 , 1 );
END;
END (* PgUp *);
PgDn: BEGIN (* PgDn -- move down one page *)
IF ( Bot_Line + 1 ) < Review_Len THEN
BEGIN
Redraw := TRUE;
Top_Line := Bot_Line + 1;
END;
END (* PgDn *);
Home: BEGIN (* Home -- move to top of buffer *)
Top_Line := 1;
Redraw := TRUE;
END (* Home *);
End_Key: BEGIN (* End -- move to end of buffer *)
Bot_Line := Review_Len;
Top_Line := MAX( Bot_Line - 19 , 1 );
Redraw := TRUE;
END (* End *);
ELSE (* Sound bell for bad input *)
WRITE( CHR( BELL ) );
END (* CASE *);
END;
UNTIL Quit;
Restore_Screen( Saved_Screen );
Reset_Global_Colors;
END (* Review_Captured_Text *);
ə