home *** CD-ROM | disk | FTP | other *** search
- unit DivEdit;
-
- interface
- uses Crt, Def, ColorDef, PrtDiv, GetKeU, FastWr, LPaU, CPaU, Swap,
- RE, SubEdit, Co, GetForU, StrnU;
- procedure DivisionEdit( var Division, SubDivision: integer);
-
- implementation
-
- procedure DivisionEdit;
- var Continue,
- AllowInput,
- FunctionKey,
- Change: boolean;
- Ch2,
- Ch: char;
- A,
- B: s1;
- Swap1,
- Swap2,
- OCh,
- RecNumber,
- AllowControl,
- N1,
- N2: integer;
- Temp2,
- Temp: s30;
- begin
- Continue := true;
- Change := false;
- while Continue do
- begin
- PrintDivision;
- GetKey(Ch,FunctionKey);
- AllowControl := -1;
- AllowInput := true;
- Ch := upcase(Ch);
- N1 := ord(Ch);
- if N1 = 59 then
- N1 := -1
- else
- if N1 = 27 then
- N1 := 0
- else
- if (N1 = 63) and FunctionKey then
- N1 := -2
- else
- if (N1>64) and (N1<91) then
- N1 := N1 - 64
- else
- N1 := -3;
- 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[0,Swap1]+'" & "'+
- AlphaCode[0,Swap2]+'" (Y/N) ',80),
- 21, 1, Inputs.Attr);
- GetKey(Ch,FunctionKey);
- Ch := upcase(Ch);
- if Ch = 'Y' then
- begin
- Change := true;
- SwapS( AlphaCode[0,Swap1], AlphaCode[0,Swap2]);
- SwapS( AlphaCode[Swap1,0], AlphaCode[Swap2,0]);
- for I := 1 to SubDivisionTop do
- SwapS( AlphaCode[Swap1,I], AlphaCode[Swap2,I]);
- FastWrite( BlankLine, 21, 1, Displays.Attr);
- FastWrite( 'Modifying record:', 21, 1, 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.Division = chr(Swap1) then
- begin
- HoldEntry.Division := chr(Swap2);
- PutRec(HoldEntry,RecNumber);
- end
- else
- begin
- if HoldEntry.Division = chr(Swap2) then
- begin
- HoldEntry.Division := 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 division '+chr(N2+64),
- 21, 1, Inputs.Attr);
- Temp := GetForm( 40, 21, 30, Strng(30,#32), AlphaCode[N2,0],
- AllowControl, AllowInput, Inputs.Attr,
- [#32..#126]);
- if (N2 >= 1) and (N2 <= DivisionTop) then
- begin
- AlphaCode[N2,0] := Temp;
- AlphaCode[0,N2] := Temp;
- end;
- end;
- 0:Continue := false;
- 1..DivisionTop :begin
- Entry.Division := chr(N1);
- Division := N1;
- EditSubDivision(N1,Change);
- if N1 in [1..SubDivisionTop] then SubDivision := N1;
- Continue := false;
- end;
- end; (* case *)
- end; (* while *)
- if Change then
- begin
- clrscr;
- PutAlphaCodes;
- end;
- end;
-
- end.
-