This repository has been archived by the owner on Nov 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCRTP.PAS
115 lines (108 loc) · 2.46 KB
/
SCRTP.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{$A-,B-,D-,E-,F-,I-,L-,N-,O-,R-,S-,V-}
{$M 16384,0,655360}
unit ScrTp;
interface
uses TpCrt,Strings,WndInit;
type
str=^string;
Keyboard=(Space,Enter,Homekey,PgUp,
Endkey,PgDn,Up,Down,Left,Right,
F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,
Esc,Yes,No,Another);
var
CurrentMode:Workmode;
procedure WriteLine(var s:string);
function GetKey:Keyboard;
procedure WriteMenu(s:string);
procedure WriteMenuBar;
implementation
procedure WriteLine(var s:string);
var l,x, i,len:byte;
ch:char;
begin
len:=length(s);x:=1;i:=1;
WHILE (i<=len) and (x<80) do BEGIN
If s[i]='\' then begin
Inc(i);
case s[i] of
'\':begin
write('\');
Inc(x);
end;
' ':textattr:=Normtext;
'h':textattr:=Hightext;
'i':textattr:=Invtext; {inversed text}
'b':Inc(TextAttr,$80);{blinking}
end;
Inc(i);
end
Else begin
write(s[i]);
Inc(x);Inc(i);
end;
END;{of WHILE ... BEGIN}
textattr:=Normtext;
clreol;
writeln;
end; { Procedure WriteLine }
function Getkey:Keyboard;
var
ch:char;c:byte;
begin
ch:=readkey;
if ch=#0 then begin
c:=ord(readkey);
case c of
59..68:Getkey:=Keyboard(ord(F1)+c-59);
71:Getkey:=Homekey;
73:Getkey:=PgUp;
79:Getkey:=Endkey;
81:Getkey:=PgDn;
72:Getkey:=Up;
80:Getkey:=Down;
75:Getkey:=Left;
77:Getkey:=Right;
else Getkey:=Another;
end;
end
else
case ch of
'y','d','¤':Getkey:=Yes;
'n','':Getkey:=No;
#32:Getkey:=Space;
#13:Getkey:=Enter;
#27:Getkey:=Esc;
else Getkey:=Another;
end;
end;
procedure WriteMenu(s:string);
var
i,len,color:byte;
wminold,wmaxold:word;
xold,yold,oldattr:byte;
begin
wminold:=windmin;wmaxold:=windmax;
xold:=wherex;yold:=wherey;
window(1,25,80,25);
oldattr:=textattr;
textattr:=MenuHigh;
len:=length(s);i:=1;
while i<=len do begin
if s[i]='\' then begin
if textattr=MenuHigh then textattr:=MenuNorm
else textattr:=MenuHigh;
Inc(i);
end;
write(s[i]);
Inc(i);
end;
clreol;
textattr:=oldattr;
window(lo(wminold)+1,hi(wminold)+1,lo(wmaxold)+1,hi(wmaxold)+1);
gotoxy(xold,yold);
end;
procedure WriteMenuBar;
begin
WriteMenu(menu[CurrentMode]);
end;
end.