Unit
H_aide;
Interface
Procedure
Help_Dans_Index(Reper,Neime:string
);
Implementation
Uses
crt,Dos,Box13,Buffs,Buff_tex,C_Read,Get_Key,NumMouse;
Function
FileMaxSize(F : string
) :Longint
;
var
SR : SearchRec;
begin
FindFirst(F, AnyFile, SR);
if
(DosError=0
) Then
FileMaxSize:=Sr.Size
else
FileMaxSize:=-1
;
end
;
Procedure
Help_Dans_Index(Reper,Neime:string
);
Var
Selec : string
;
Color : byte
;
ColorInverse : byte
;
XX1,YY1 : byte
;
XX2,YY2 : byte
;
Erreur : integer
;
Fictex : Text;
Size : Word
;
Entree : boolean
;
Y,N,X1,X2 : byte
;
Attr : Word
;
Function
Index
:string
;
var
KKey : byte
;
Nom,Sn : string
[4
];
Snn,Syy : string
[6
];
begin
Putxy(14
,21
,'
eeeeeeeee
'
);
Putxy(56
,21
,'
eeeeeee
'
);
Putxy(14
,5
,'
eee
'
);
BoxFill(13
,6
,62
,20
,'
'
);
Putxy(15
,7
,'
INDEX
DE
L
'
'
AIDE
'
);
Putxy(15
,8
, '
----------------------------------------------
'
);
Putxy(15
,9
, '
Menu
File
Touches
rapides
'
);
Putxy(15
,10
,'
Menu
Edit
Editeur
Copier
un
texte
'
);
Putxy(15
,11
,'
Menu
Options
Aide
sujetions
Num
'
);
Putxy(15
,12
,'
Menu
Lang
Imprimante
'
);
Putxy(15
,13
,'
Menu
Graph
trace
Insertion/suppres
'
);
Putxy(15
,14
,'
Menu
Maths
Dictionnaire
Fran-Ang
'
);
Putxy(15
,15
,'
Mouvement
curseur
............
'
);
Putxy(15
,16
,'
Commandes
de
blocs
............
'
);
HighBox(X1,Y+8
,X2,Y+8
,Bx);
MouseXY(13
,6
);
CsOff;
Delay(300
);
KKey:=0
;
Repeat
DisplayMouse;
KKey:=KeyMouse;
MaskMouse;
if
(KKey=1
) and
(not
Key_Code) and
(Mbox(13
,9
,60
,16
)) Then
begin
if
(Mbox(14
,9
,33
,16
)) Then
begin
if
MouseY <> Y Then
begin
HighBox(X1,Y+8
,X2,Y+8
,Bx);
X1:=14
;X2:=33
;
n:=(MouseY-8
);
Y:=(MouseY-8
);
HighBox(X1,Y+8
,X2,Y+8
,Bx);
end
;
end
else
if
(Mbox(38
,9
,60
,16
)) Then
begin
HighBox(X1,Y+8
,X2,Y+8
,Bx);
X1:=38
;X2:=60
;
n:=10
+(MouseY-8
);
Y:=(MouseY-8
);
HighBox(X1,Y+8
,X2,Y+8
,Bx);
end
;
end
else
if
(KKey=2
) and
(not
Key_Code) and
(MouseY-8
= Y) and
(Mbox(X1,Y+8
,X2,Y+8
)) Then
begin
Key_Code:=False
;
KKey:=13
;
end
else
if
(KKey=72
) and
(Y>1
) Then
begin
HighBox(X1,Y+8
,X2,Y+8
,Bx);
dec(Y);
dec(n);
HighBox(X1,Y+8
,X2,Y+8
,Bx);
end
else
if
(KKey=80
) and
(Y<8
) Then
begin
HighBox(X1,Y+8
,X2,Y+8
,Bx);
inc(y);
inc(n);
HighBox(X1,Y+8
,X2,Y+8
,Bx);
end
else
if
(KKey=77
) and
(X1<38
) Then
begin
HighBox(X1,Y+8
,X2,Y+8
,Bx);
X1:=38
;X2:=60
;
inc(n,10
);
HighBox(X1,Y+8
,X2,Y+8
,Bx);
end
else
if
(KKey=75
) and
(X1>14
) Then
begin
HighBox(X1,Y+8
,X2,Y+8
,Bx);
X1:=14
;X2:=33
;
dec(n,10
);
HighBox(X1,Y+8
,X2,Y+8
,Bx);
end
;
if
(KKey=13
) Then
begin
HighBox(X1,Y+8
,X2,Y+8
,Bx);
Str(N,Sn);
if
N in
[1
..9
] Then
Sn:='
0
'
+Sn;
Nom:='
H
'
+Sn+'
:
'
;
Index
:=Nom;
end
;
Until
KKey in
[27
,13
];
if
KKey=27
Then
Index
:='
'
;
end
;
Procedure
Lire_Index(Debut:string
);
LaBel
TX007;
Var
Key,i : byte
;
ST : string
;
Lire : boolean
;
Sn,S : string
[4
];
Block : boolean
;
Page : Word
;
PosePage,PoseDebut : Word
;
begin
key:=0
;
BoxFill(13
,6
,62
,20
,'
'
);
Block:=False
;
TextRec(Fictex).BufPos:=0
;
While
(Not
Eof(FicTex)) and
(Not
Block ) Do
begin
Read
(Fictex,S);
if
(Uppers(S)=Debut) Then
Block:=True
else
Readln(FicTex);
end
;
PoseDebut:=TextRec(Fictex).BufPos;
if
BufTexte^[Posedebut+1
]=#
13
Then
begin
inc(Posedebut,2
);
TextRec(Fictex).BufPos:=PoseDebut;
end
;
PosePage:=PoseDebut;
Page:=1
;
TX007:
gotoxy(1
,1
);
i:=0
;
Lire:=True
;
Key:=0
;
Str(Page:2
,SN);
Putxy(14
,5
,Sn);
While
(Not
Eof(FicTex)) and
(Lire) Do
begin
inc(i);
Readln(Fictex,St);
if
ORD(St[0
])>49
Then
St[0
]:=#
49
;
if
St='
end:
'
Then
Lire:=False
else
begin
if
ST[1
]='
?
'
Then
begin
TextAttr:=ColorInverse;
ST[1
]:='
'
;
if
i>=15
Then
Write
(St)
else
Writeln(ST);
TextAttr:=Help_Color;
end
else
if
i>=15
Then
Write
(St)
else
Writeln(ST);
end
;
if
i>=15
Then
begin
CsOff;
if
page>1
Then
Putxy(54
,21
,'
PgUp/PgDn
'
)
else
Putxy(54
,21
,'
eeeeePgDn
'
);
Repeat
Key:=KeyMouse;
Until
((Key_code) and
(Key=81
)) OR
((Key_Code) and
(Key=73
) and
(Page>1
)) OR
(Key=27
);
if
Key=27
Then
begin
Lire:=False
;
BoxFill(13
,6
,62
,20
,'
'
);
end
else
if
(Key=73
) and
(Page>1
) Then
begin
dec(Page);
Str(Page:2
,SN);
Putxy(14
,5
,Sn);
i:=14
;
While
(PosePage>PoseDebut) and
(i>0
) DO
begin
dec(posePage);
if
BufTexte^[PosePage]=#
10
Then
dec(i);
end
;
BoxFill(13
,6
,62
,20
,'
'
);
TextRec(Fictex).BufPos:=PosePage;
Goto
TX007;
end
else
if
Key=81
THen
begin
inc(Page);
Str(Page:2
,SN);
Putxy(14
,5
,Sn);
i:=0
;
BoxFill(13
,6
,62
,20
,'
'
);
Gotoxy(1
,1
);
PosePage:=TextRec(Fictex).BufPos-1
;
While
BufTexte^[PosePage]<>#
10
Do
dec(PosePage);
TextRec(Fictex).BufPos:=PosePage;
end
;
end
;
end
;
if
Key<>27
Then
begin
CsOff;
if
Page=1
Then
Putxy(54
,21
,'
eeeeeESCe
'
)
else
Putxy(54
,21
,'
PgUp/ESCe
'
);
Repeat
Key:=KeyMouse;
Until
((Key_Code) and
(Key=73
) and
(page>1
)) OR
(Key=27
);
if
(Key_Code) and
(Key=73
) and
(page>1
) Then
begin
dec(Page);
if
i=15
Then
i:=14
else
i:=15
+(i-1
);
PosePage:=TextRec(Fictex).BufPos;
While
(PosePage>PoseDebut) and
(i>0
) DO
begin
dec(posePage);
if
BufTexte^[PosePage]=#
10
Then
dec(i);
end
;
TextRec(Fictex).BufPos:=PosePage;
BoxFill(13
,6
,62
,20
,'
'
);
Goto
TX007;
end
;
end
;
Key:=0
;
end
;
begin
FillChar(BufTexte^,SizeOf(Buf___Ptr),#
32
);
Size:=FileMaxSize(REper+Neime);
Assign(FicTex,Reper+Neime);
SetTextBuf(FicTex,BufTexte^);
Reset(FicTex);
Erreur:=Ioresult;
if
Erreur=0
Then
begin
Read
(Fictex,BufTexte^[1
]);
XX1:=Lo(WindMin)+1
;
YY1:=Hi(WindMin)+1
;
XX2:=Lo(WindMax)+1
;
YY2:=Hi(WindMax)+1
;
Color:=TextAttr;
textAttr:=Help_color;
ColorInverse:=((Help_color and
16
+ Help_Color and
32
+ Help_Color and
64
) Div
16
) Shl
4
+ Char_Color;
ReadBuf(12
,5
,65
,22
,BuffDir^);
BoxColor(14
,6
,65
,22
,(Edit_Color-(((Edit_Color and
$
70
) shr
4
) * 16
)));
BoxFill(12
,5
,63
,21
,'
'
);
Rectangle(12
,5
,63
,21
,Simple);
Putxy(34
,5
,'
HELP
'
);
Window(13
,6
,62
,20
);
Selec:='
'
;
Y:=1
;n:=1
;
X1:=14
;X2:=33
;
Repeat
Selec:=Index
;
if
Selec<>'
'
Then
Lire_Index(Selec);
Until
Selec='
'
;
WriteBuf(12
,5
,65
,22
,BuffDir^);
textAttr:=Color;
Window(XX1,YY1,XX2,YY2);
Close(FicTex);
Assign(FicTex,Reper+Neime);
GetFAttr(FicTex,Attr);
if
(DosError=0
) and
(Attr and
$
01
<> $
01
) Then
begin
Attr:=Attr+$
01
;
SetFAttr(FicTex,Attr);
Erreur:=DosError;
end
;
end
else
Entree:=Erreur_Critique(Erreur,Neime);
end
;
end
.