home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug174.arc
/
FILECARD.LBR
/
EDITSCR.LYB
/
EDITSCR.LYB
Wrap
Text File
|
1979-12-31
|
9KB
|
331 lines
Procedure EditScr;
Begin
Quit := false;
Repeat
Flag1 := false;
Y := 1; X := 1;
ReadKey;
Gotoxy((X+12),(Y+12));
Repeat
Flag2 := false;
Read(Kbd,Key);
If Key = chr(27) then {Quit}
Begin
Flag1 := true;
Flag2 := true;
End;
If Key = chr(11) then {Cursor up}
Begin
Flag2 := true;
Y := (Y-1);
If Y < 1 then Y := 1;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(5) then {Cursor up}
Begin
Flag2 := true;
Y := (Y-1);
If Y < 1 then Y := 1;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(10) then {Cursor down}
Begin
Flag2 := true;
Y := (Y+1);
If Y > 10 then Y := 10;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(24) then {Cursor down}
Begin
Flag2 := true;
Y := (Y+1);
If Y > 10 then Y := 10;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(13) then {Carriage return}
Begin
Flag2 := true;
Y := (Y+1);
X :=1;
If Y > 10 then Y := 1;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(8) then {Cursor left}
Begin
Flag2 := true;
X := (X-1);
If X < 1 then
Begin
X := 56;
Y := (Y-1);
If Y < 1 then
Begin
X := 1;
Y := 1;
End;
End;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(19) then {Cursor left}
Begin
Flag2 := true;
X := (X-1);
If X < 1 then
Begin
X := 56;
Y := (Y-1);
If Y < 1 then
Begin
X := 1;
Y := 1;
End;
End;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(12) then {Cursor right}
Begin
Flag2 := true;
X := (X+1);
If X = 47 then Write(chr(7));
If X > 56 then
Begin
X := 1;
Y := (Y+1);
If Y > 10 then
Begin
X := 1;
Y := 1;
End;
End;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(4) then {Cursor right}
Begin
Flag2 := true;
X := (X+1);
If X = 47 then Write(chr(7));
If X > 56 then
Begin
X := 1;
Y := (Y+1);
If Y > 10 then
Begin
X := 1;
Y := 1;
End;
End;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(1) then {Left end}
Begin
Flag2 := true;
X := 1;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(6) then {Right end}
Begin
Flag2 := true;
X := 55;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(18) then {Beginning of field}
Begin
Flag2 := true;
X :=1;
Y := 1;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(3) then {End of field}
Begin
Flag2 := true;
X := 55;
Y := 10;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(26) then {Erase field}
Begin
Flag2 := true;
For Y := 1 to 10 do
Begin
For X := 1 to 55 do
Begin
Ltr[X,Y] := (' ');
Gotoxy((X+12),(Y+12));
Write(Ltr[X,Y]);
End;
End;
X :=1;
Y:= 1;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(9) then {Insert character}
Begin
Flag2 := true;
If X < 55 then
Begin
For I := 55 downto (X+1) do
Begin
Ltr[I,Y] := Ltr[(I-1),Y];
Gotoxy((I+12),(Y+12));
Write(Ltr[I,Y]);
End;
Ltr[X,Y] := (' ');
Gotoxy((X+12),(Y+12));
Write(Ltr[X,Y]);
Gotoxy((X+12),(Y+12));
End;
End;
If Key = chr(127) then {Delete character}
Begin
Flag2 := true;
X := (X-1);
If X <1 then
Begin
X := 56;
Y := (Y-1);
If Y <1 then
Begin
Y := 1;
X := 1;
End;
Gotoxy((X+12),(Y+12));
End;
If X < 55 then
Begin
For I := X to 54 do
Begin
Ltr[I,Y] := Ltr[(I+1),Y];
Gotoxy((I+12),(Y+12));
Write(Ltr[I,Y]);
End;
Ltr[55,Y] := (' ');
Gotoxy(67,(Y+12));
Write(Ltr[55,Y]);
Gotoxy((X+12),(Y+12));
End;
If X = 55 then
Begin
Ltr[X,Y] := (' ');
Gotoxy((X+12),(Y+12));
Write(Ltr[X,Y]);
Gotoxy((X+12),(Y+12));
End;
End;
If Key = chr(17) then {Delete to end of line}
Begin
Flag2 := true;
For Q := X to 55 do
Begin
Ltr[Q,Y] := (' ');
Gotoxy((Q+12),(Y+12));
Write(Ltr[Q,Y]);
End;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(14) then {Insert line}
Begin
Flag2 := true;
If Y < 11 then
Begin
For R := 10 downto (Y+1) do
Begin
For Q := 1 to 55 do
Begin
Ltr[Q,R] := Ltr[Q,(R-1)];
Gotoxy((Q+12),(R+12)); Write(Ltr[Q,R]);
End;
End;
For Q := 1 to 55 do
Begin
Ltr[Q,Y] := (' ');
Gotoxy((Q+12),(Y+12)); Write(Ltr[Q,Y]);
End;
End;
X := 1;
Gotoxy((X+12),(Y+12));
End;
If Key = chr(25) then {Delete line}
Begin
Flag2 := true;
If Y < 10 then
Begin
For R := Y to 9 do
Begin
For Q := 1 to 55 do
Begin
Ltr[Q,R] := Ltr[Q,(R+1)];
Gotoxy((Q+12),(R+12)); Write(Ltr[Q,R]);
End;
End;
For Q := 1 to 55 do
Begin
Ltr[Q,10] := (' ');
Gotoxy((Q+12),22); Write(Ltr[Q,10]);
End;
End;
If Y = 10 then
Begin
Ltr[Q,10] := (' ');
Gotoxy((Q+12),22); Write(Ltr[Q,10]);
End;
X := 1;
Gotoxy((X+12),(Y+12));
End;
If not Flag2 then
Begin
Gotoxy((X+12),(Y+12));
If X < 56 then
Begin
Ltr[X,Y] := Key;
Write(Ltr[X,Y]);
End;
X := (X+1);
If X = 47 then Write(chr(7));
If X > 56 then X := 56;
Gotoxy((X+12),(Y+12));
End;
Until Flag1;
Gotoxy(70,22);
Write('Correct ?');
Gotoxy(70,23);
Write('(Y/N) ');
Read(Kbd,Key);
Key := upcase(Key);
If Key = chr(27) then
Begin
Assign(Disk,'MENU.COM');
Execute(Disk);
End;
If Key = ('Y') then Quit := true;
Gotoxy(70,22);
Write(' ');
Gotoxy(70,23);
Write(' ');
Until Quit;
Clrscr;
End;