home *** CD-ROM | disk | FTP | other *** search
- unit SubEdit;
-
- interface
- uses Crt, Def, ColorDef, PrtSDiv, GetKeU, FastWr, LPaU, CPaU,
- RE, Swap, GetForU, StrnU;
- procedure EditSubDivision( var Division: integer; var Change: boolean);
-
- implementation
-
- procedure EditSubDivision;
- var FunctionKey,
- AllowInput,
- Continue: boolean;
- Ch2,
- Ch: char;
- Swap1,
- Swap2,
- OCh,
- RecNumber,
- UseDivision,
- AllowControl,
- N1,
- N2: integer;
- Temp2,
- Temp: s30;
- begin
- Continue := true;
- UseDivision := Division;
- Division := 0;
- while Continue do
- begin
- PrintSubDivision(UseDivision);
- GetKey(Ch,FunctionKey);
- AllowControl := -1;
- AllowInput := true;
- Ch := upcase(Ch);
- N1 := ord(Ch);
- if (N1 = 59) and FunctionKey then
- N1 := -1
- else
- if (N1 = 63) and FunctionKey then
- N1 := -2
- else
- if (N1 > 64) and (N1 < 91) then
- N1 := N1 - 64
- else
- N1 := 0;
- case N1 of
- -2: begin
- FastWrite(LPad('First letter to swap ?',40), 21, 1, Inputs.Attr);
- GetKey(Ch,FunctionKey);
- Ch := upcase(Ch);
- OCh := ord(Ch);
- if (OCh >= 65) and (OCh <= 90) then
- begin
- Swap1 := OCh - 64;
- FastWrite(LPad('Second letter to swap ?',40), 21, 1, Inputs.Attr);
- GetKey(Ch,FunctionKey);
- Ch := upcase(Ch);
- OCh := ord(Ch);
- if (OCh >= 65) and (OCh <= 90) and (OCh <> Swap1+64) then
- begin
- Swap2 := OCh - 64;
- FastWrite( BlankLine, 21, 1, Displays.Attr);
- FastWrite( CPad( 'Swap: "'+AlphaCode[UseDivision,Swap1]+'" & "'+
- AlphaCode[UseDivision,Swap2]+'" (Y/N) ',80),
- 1, 21, Inputs.Attr);
- GetKey(Ch,FunctionKey);
- Ch := upcase(Ch);
- if Ch = 'Y' then
- begin
- Change := true;
- SwapS(AlphaCode[UseDivision,Swap1],AlphaCode[UseDivision,Swap2]);
- FastWrite( BlankLine, 21, 1, Displays.Attr);
- FastWrite( 'Modifying record:', 1, 21, Msgs.Attr);
- for RecNumber := 1 to FileTop do
- begin
- if (RecNumber mod 10) = 0 then
- begin
- str(RecNumber,Temp2);
- FastWrite( Temp2, 21, 21, (Msgs.Attr or $0008));
- end;
- GetRec( HoldEntry, RecNumber);
- if (HoldEntry.SubDivision = chr(Swap1))
- and (HoldEntry.Division = chr(UseDivision)) then
- begin
- HoldEntry.SubDivision := chr(Swap2);
- PutRec(HoldEntry,RecNumber);
- end
- else
- begin
- if (HoldEntry.SubDivision = chr(Swap2))
- and (HoldEntry.Division = chr(UseDivision)) then
- begin
- HoldEntry.SubDivision := chr(Swap1);
- PutRec(HoldEntry,RecNumber);
- end;
- end;
- end;
- end;
- end;
- end;
- end;
- -1: begin
- Change := true;
- FastWrite( BlankLine, 21, 1, Displays.Attr);
- FastWrite( 'Select a letter', 21, 1, Inputs.Attr);
- GetKey(Ch,FunctionKey);
- Ch := upcase(Ch);
- N2 := ord(Ch);
- if N2 = 59 then N2 := -1 else
- if (N2 > 64) and (N2 < 91) then N2 := N2 - 64;
- FastWrite( BlankLine, 21, 1, Displays.Attr);
- FastWrite( 'AlphaCode for subdivision '+chr(N2+64), 21, 1, Inputs.Attr);
- Temp := GetForm( 40, 21, 30, Strng(30,#32),
- AlphaCode[UseDivision,N2], AllowControl,
- AllowInput, Inputs.Attr, [#32..#126]);
- if (N2 >= 1) and (N2 <= SubDivisionTop) then
- begin
- AlphaCode[UseDivision,N2] := Temp;
- end;
- end;
- 1..SubDivisionTop :begin
- Entry.SubDivision := chr(N1);
- Division := N1;
- Continue := false;
- end;
- end; (* case *)
- end; (* while *)
- end;
-
- end.
-