home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
tptools.zip
/
BININST.ZIP
/
BIKEY.INC
< prev
next >
Wrap
Text File
|
1987-12-21
|
29KB
|
900 lines
{ BIKEY.INC
INSTALL 4.0
Copyright (c) 1985, 87 by Borland International, Inc. }
procedure KeyInstall;
{-Install keyboard}
type
InstRec = record
Len : Integer;
PCList1 : PackedCommandList;
JunkBytes : array[1..32] of Char;
PCList2 : PackedCommandList;
end;
var
OurInstRec : InstRec;
const
FirstRow = 4;
LastRow = 25;
PrimeCmdCol = 28;
PrimeMinCol = 31;
PrimeMaxCol = 52;
SecndCmdCol = 54;
SecndMinCol = 57;
SecndMaxCol = 79;
MaxDisplay = 61; {Number of editor commands displayed}
EditPrompt : string[70] =
'-backspace C-clear R-restore ┘-accept edit <Scroll Lock> literal';
BrowsePrompt : string[67] =
'--scroll PgUp-PgDn-page ┘-modify R-restore defaults ESC-exit';
OrderMap : array[1..MaxDisplay] of CommandType =
(
CmdLeftChar, {1. Left character}
CmdRightChar, {2. Right character}
CmdLeftWord, {3. Left lexeme}
CmdRightWord, {4. Right lexeme}
CmdUpLine, {5. Up line}
CmdDownLine, {6. Down line}
CmdScrollUp, {7. Scroll up}
CmdScrollDown, {8. Scroll down}
CmdUpPage, {9. Up page}
CmdDownPage, {10. Down page}
CmdNull,
CmdLeftLine, {11. Cursor to left side}
CmdRightLine, {12. Cursor to right side}
CmdTopScreen, {13. Top of screen}
CmdBottomScreen, {14. Bottom of screen}
CmdWindowTopFile, {15. Top of window}
CmdWindowBottomFile, {16. Bottom of window}
CmdJumpTopOfBlock, {21. Top of block}
CmdJumpBottomBlock, {22. Bottom of block}
CmdJumpLastPosition, {23. Previous cursor position}
CmdNull,
CmdNewLine, {0. New line in text buffer}
CmdInsertLine, {29. Inserting line}
CmdToggleInsert, {28. Toggle insert mode}
CmdDeleteLine, {30. Delete line}
CmdDeleteLineRight, {31. Delete line right of cursor}
CmdDeleteRightWord, {32. Delete right lexeme}
CmdDeleteRightChar, {33. Delete current character}
CmdDeleteLeftChar, {34. Delete left character}
CmdNull,
CmdBlockBegin, {35. Begin block}
CmdBlockEnd, {36. End block}
CmdBlockWord, {37. Mark current word as block}
CmdBlockHide, {38. Hide/display toggle block}
CmdBlockCopy, {43. Copy block}
CmdBlockMove, {44. Move block}
CmdBlockDelete, {45. Delete block}
CmdReadBlock, {46. Read file into window}
CmdWriteBlock, {47. Write block to file}
CmdPrintBlock, {49. Print block}
CmdNull,
CmdSetMarker0, {39. Set marker 0}
CmdSetMarker1, {40. Set marker 0}
CmdSetMarker2, {41. Set marker 0}
CmdSetMarker3, {42. Set marker 0}
CmdJumpMarker0, {24. Jump to marker 0}
CmdJumpMarker1, {25. Jump to marker 1}
CmdJumpMarker2, {26. Jump to marker 2}
CmdJumpMarker3, {27. Jump to marker 3}
CmdNull,
CmdFind, {59. Find pattern}
CmdFindReplace, {60. Find and replace}
CmdFindNext, {61. Find next}
CmdNull,
CmdTab, {51. Tab, either fixed or "smart"}
CmdToggleAutoindent, {52. Toggle autoindent mode}
CmdToggleFixedTabs, {53. Toggle fixed tabs}
CmdNull,
CmdSaveQuit, {50. Save file and exit}
CmdRestoreCurrentLine, {58. Restore line as on entry}
CmdInsertCtrlChar {62. Insert control character}
);
var
Title : VarString;
Quitting : Boolean;
Wrote : Boolean;
CmdLen : Integer;
CuPacked, WsPacked : PackedCommandList;
MinCmd, MaxCmd : CommandType;
CH : Char;
KeyOfs : LongInt;
CmdsRead : Integer;
procedure InitializeScreen;
{-Set up for full screen key editor}
begin
ClrScr;
GoToXY(1, 1);
Title := CenterPad(' Installing: '+ProgName+' ', '═', 80);
Center(1, TiColor, Title);
end;
function FindKeys(var IRec : InstRec) : LongInt;
{-Read the command definitions into memory}
var
FO : LongInt;
begin {FindKeys}
{Search the work area}
FO := FindString(KIDstring, IRec, SizeOf(InstRec));
if FO = 0 then
HaltError('Unable to locate keyboard installation area');
{Check the number of bytes in the command list}
if IRec.Len <> CmdListBytes then
HaltError('Command list is wrong size. '+ProgName+' may be corrupted.');
{Return the offset of the command list}
FindKeys := FO;
end; {FindKeys}
procedure InitializeCommands(var Commands : CommandList);
{-Initialize the titles of each command}
var
C : CommandType;
begin {InitializeCommands}
for C := MinCmd to CmdNull do
with Commands[C] do begin
with Main do begin
Keys := '';
Modified := False;
Conflict := False;
MinCol := PrimeMinCol;
MaxCol := PrimeMaxCol;
end;
with Alt do begin
Keys := '';
Modified := False;
Conflict := False;
MinCol := SecndMinCol;
MaxCol := SecndMaxCol;
end;
case C of
CmdLeftChar : Name := 'Character left';
CmdRightChar : Name := 'Character right';
CmdLeftWord : Name := 'Word left';
CmdRightWord : Name := 'Word right';
CmdUpLine : Name := 'Line up';
CmdDownLine : Name := 'Line down';
CmdScrollUp : Name := 'Scroll up';
CmdScrollDown : Name := 'Scroll down';
CmdUpPage : Name := 'Page up';
CmdDownPage : Name := 'Page down';
CmdLeftLine : Name := 'Cursor to left side';
CmdRightLine : Name := 'Cursor to right side';
CmdTopScreen : Name := 'Top of screen';
CmdBottomScreen : Name := 'Bottom of screen';
CmdWindowTopFile : Name := 'Top of window';
CmdWindowBottomFile : Name := 'Bottom of window';
CmdJumpTopOfBlock : Name := 'Top of block';
CmdJumpBottomBlock : Name := 'Bottom of block';
CmdJumpLastPosition : Name := 'Previous cursor position';
CmdNewLine : Name := 'New line';
CmdInsertLine : Name := 'Insert line';
CmdToggleInsert : Name := 'Toggle insert mode';
CmdDeleteLine : Name := 'Delete line';
CmdDeleteLineRight : Name := 'Delete line right';
CmdDeleteRightWord : Name := 'Delete right word';
CmdDeleteRightChar : Name := 'Delete current character';
CmdDeleteLeftChar : Name := 'Delete left character';
CmdBlockBegin : Name := 'Begin block';
CmdBlockEnd : Name := 'End block';
CmdBlockWord : Name := 'Mark current word';
CmdBlockHide : Name := 'Toggle block display';
CmdBlockCopy : Name := 'Copy block';
CmdBlockMove : Name := 'Move block';
CmdBlockDelete : Name := 'Delete block';
CmdReadBlock : Name := 'Read file into window';
CmdWriteBlock : Name := 'Write block to file';
CmdPrintBlock : Name := 'Print marked block';
CmdSetMarker0 : Name := 'Set marker 0';
CmdSetMarker1 : Name := 'Set marker 1';
CmdSetMarker2 : Name := 'Set marker 2';
CmdSetMarker3 : Name := 'Set marker 3';
CmdJumpMarker0 : Name := 'Jump to marker 0';
CmdJumpMarker1 : Name := 'Jump to marker 1';
CmdJumpMarker2 : Name := 'Jump to marker 2';
CmdJumpMarker3 : Name := 'Jump to marker 3';
CmdFind : Name := 'Find pattern';
CmdFindReplace : Name := 'Find and replace';
CmdFindNext : Name := 'Find next';
CmdTab : Name := 'Tab';
CmdToggleAutoindent : Name := 'Toggle autoindent mode';
CmdToggleFixedTabs : Name := 'Toggle fixed tabs';
CmdSaveQuit : Name := 'Exit editor';
CmdRestoreCurrentLine : Name := 'Restore line';
CmdInsertCtrlChar : Name := 'Insert control char';
else
Name := '';
end;
end;
end; {InitializeCommands}
procedure ParsePackedCommands(var CuPacked, WsPacked : PackedCommandList;
var Commands : CommandList);
{-fill in the structured command array from the packed tables}
var
pCu, pWs, Len : Integer;
C : CommandType;
begin {ParsePackedCommands}
pCu := 1;
pWs := 1;
for C := MinCmd to MaxCmd do begin
with Commands[C] do begin
with Alt do begin
Len := Succ(Ord(CuPacked[pCu]));
Move(CuPacked[pCu], Keys[0], Len);
if Keys = #$FF then
Keys := '';
pCu := pCu+Len;
end;
with Main do begin
Len := Succ(Ord(WsPacked[pWs]));
Move(WsPacked[pWs], Keys[0], Len);
if Keys = #$FF then
Keys := '';
pWs := pWs+Len;
end;
end;
end;
end; {ParsePackedCommands}
procedure DisplayKeys(TheColor, R : Byte; K : KeyRec);
{-display the stored keystrokes}
var
Txt, Dis : VarString;
Len : Byte;
TxtLen : Byte absolute Txt;
begin {DisplayKeys}
with K do begin
Len := Succ(MaxCol-MinCol);
Txt := TextRepresentation(K);
Dis := Pad(Copy(Txt, 1, Len), Len);
EdFastWrite(Dis, R, MinCol, TheColor);
if TxtLen > Len then
GoToXY(MinCol+Len, R)
else
GoToXY(MinCol+Length(Txt), R);
end;
end; {DisplayKeys}
procedure DisplayCommand(C : CommandType; R : Byte);
{-display a command and its keys}
begin {DisplayCommand}
if C = CmdNull then
{Draw a separator bar}
Center(R, TiColor, '────────────────────────────────────────────────────────────────────────────────')
else
with Commands[C] do begin
ClrEol(1, R, TiColor);
EdFastWrite(Name, R, 1, TiColor);
{Write WordStar keystrokes}
EdFastWrite('P:', R, PrimeCmdCol, TiColor);
if Main.Conflict then
DisplayKeys(CfColor, R, Main)
else if Main.Modified then
DisplayKeys(ChColor, R, Main)
else
DisplayKeys(LoColor, R, Main);
{Write custom keystrokes}
EdFastWrite('S:', R, SecndCmdCol, TiColor);
if Alt.Conflict then
DisplayKeys(CfColor, R, Alt)
else if Alt.Modified then
DisplayKeys(ChColor, R, Alt)
else
DisplayKeys(LoColor, R, Alt);
end;
end; {DisplayCommand}
function GetKeys(R : Byte; var K : KeyRec; var StopNow : Boolean) : Boolean;
{-edit a key sequence, default keys as input, keys also return result}
{-return true if keys were modified in the process}
const
ScrollMask = $10;
var
Quitting : Boolean;
CH : Char;
Buf : KeyString;
ScrollLock, LastScroll : Byte;
KbFlag : Byte absolute $0040 : $0017;
begin {GetKeys}
StopNow := False;
LastScroll := $FF;
with K do begin
{Buffer the keystrokes so they can be restored}
Buf := Keys;
Quitting := False;
repeat
DisplayKeys(EdColor, R, K);
repeat
{Watch the scroll state while waiting for a keystroke}
ScrollLock := KbFlag and ScrollMask;
if ScrollLock <> LastScroll then begin
if ScrollLock <> 0 then
EdFastWrite('Literal', 1, 70, LoColor)
else
EdFastWrite('Command', 1, 70, LoColor);
LastScroll := ScrollLock;
end;
until KeyPressed;
CH := ReadKey;
if ScrollLock <> 0 then begin
{literal mode}
if CH = #0 then begin
CH := ReadKey;
if Length(Keys) < Pred(KeyLength) then
Keys := Keys+#0+CH;
end else if Length(Keys) < KeyLength then
Keys := Keys+CH;
end else
{command mode}
case Upcase(CH) of
#0 :
begin
CH := ReadKey;
if Length(Keys) < Pred(KeyLength) then
Keys := Keys+#0+CH;
end;
^M :
Quitting := True;
^H : {backspace}
if Length(Keys) > 0 then begin
Delete(Keys, Length(Keys), 1);
if (Length(Keys) > 0) and (Keys[Length(Keys)] = #0) then
Delete(Keys, Length(Keys), 1);
end;
'C' :
Keys := ''; {erase}
'R' :
Keys := Buf; {restore original}
#32..#47,
#58..#126,
#128..#255 : {ignore regular characters} ;
Escape :
begin
StopNow := True;
Quitting := True;
end;
else
if Length(Keys) < KeyLength then
Keys := Keys+CH;
end;
until Quitting;
GetKeys := (Keys <> Buf);
EdFastWrite('═══════', 1, 70, TiColor);
end;
end; {GetKeys}
procedure EditKeys(R : Byte; var K : KeyRec);
{-edit one key record}
var
StopNow : Boolean;
begin {EditKeys}
Center(2, EdColor, EditPrompt);
with K do begin
Modified := GetKeys(R, K, StopNow);
if Modified then begin
DisplayKeys(ChColor, R, K);
Conflict := False;
end else if Conflict then
DisplayKeys(CfColor, R, K)
else
DisplayKeys(LoColor, R, K);
end;
Center(2, TiColor, BrowsePrompt);
end; {Editkeys}
procedure DrawFullPage(CmdStart : Integer);
{-write a full page of commands, starting at cmdstart}
var
R : Byte;
C : Integer;
begin {DrawFullPage}
R := FirstRow;
C := CmdStart;
while (R <= LastRow) and (C <= MaxDisplay) do begin
DisplayCommand(OrderMap[C], R);
Inc(R);
Inc(C);
end;
end; {DrawFullPage}
procedure EditCommands;
{-Allow browsing and changing of command keys in range minc to maxc}
var
Quitting : Boolean;
OldTopC, TopC, CurC : Integer;
R, Curr : Byte;
CurCmd : CommandType;
K : KeyRec;
OnMain : Boolean;
begin {EditCommands}
Center(2, TiColor, BrowsePrompt);
Center(3, TiColor, '════════════════════════════════════════════════════════════════════════════════');
TopC := 1;
CurC := 1;
Curr := FirstRow;
DrawFullPage(TopC);
OnMain := True;
Quitting := False;
repeat
{Handle display mapping}
CurCmd := OrderMap[CurC];
if OnMain then
K := Commands[CurCmd].Main
else
K := Commands[CurCmd].Alt;
GoToXY(K.MinCol, Curr);
case GetCursorCommand of
^M : {Edit key}
if (CurCmd <> CmdNull) then begin
EditKeys(Curr, K);
if OnMain then
Commands[CurCmd].Main := K
else
Commands[CurCmd].Alt := K;
end;
^E, ^W : {Scroll up}
if CurC > 1 then begin
Dec(CurC);
if Curr = FirstRow then begin
TopC := CurC;
InsLine;
DisplayCommand(OrderMap[CurC], FirstRow);
end else
Dec(Curr);
end;
^X, ^Z : {Scroll down}
if CurC < MaxDisplay then begin
Inc(CurC);
if Curr >= LastRow then begin
GoToXY(1, FirstRow);
DelLine;
DisplayCommand(OrderMap[CurC], LastRow);
Inc(TopC);
end else
Inc(Curr);
end;
^S : {Move to secondary}
OnMain := True;
^D : {Move to primary}
OnMain := False;
^R : {Page up}
if CurC > 1 then begin
OldTopC := TopC;
R := FirstRow;
while (CurC > 1) and (R < LastRow) do begin
Dec(CurC);
Dec(Curr);
if Curr < FirstRow then begin
TopC := CurC;
Curr := FirstRow;
end;
Inc(R);
end;
if TopC <> OldTopC then
DrawFullPage(TopC);
end;
^C : {Page down}
if CurC < MaxDisplay then begin
R := FirstRow;
OldTopC := TopC;
while (CurC < MaxDisplay) and (R < LastRow) do begin
Inc(Curr);
Inc(CurC);
if Curr > LastRow then begin
Inc(TopC);
Curr := LastRow;
end;
Inc(R);
end;
if TopC <> OldTopC then
DrawFullPage(TopC);
end;
^T : {Home}
if CurC > 1 then begin
CurC := 1;
TopC := 1;
Curr := FirstRow;
OnMain := True;
DrawFullPage(TopC);
end;
^B : {End}
if CurC < MaxDisplay then begin
Curr := FirstRow;
CurC := MaxDisplay;
while Curr < LastRow do begin
Inc(Curr);
Dec(CurC);
end;
TopC := CurC;
DrawFullPage(TopC);
CurC := MaxDisplay;
OnMain := False;
end;
'R' : {restore all defaults}
begin
Commands := OrigCommands;
DrawFullPage(TopC);
end;
Escape : {done}
Quitting := True;
end;
until Quitting;
end; {EditCommands}
procedure FastInstallCommands;
{-Prompt for commands one by one}
var
C : Integer;
StopNow : Boolean;
CH : Char;
procedure PromptFor(var keyset : KeyRec);
{-get the new keyrec for main or alt}
var
K : KeyRec;
begin {PromptFor}
K.Keys := '';
K.MinCol := WhereX;
K.MaxCol := WhereX+20;
if GetKeys(WhereY, K, StopNow) then
{New keystring returned}
with keyset do begin
Modified := True;
Conflict := False;
Keys := K.Keys;
DisplayKeys(ChColor, WhereY, K);
end
else
{Accepted default}
DisplayKeys(LoColor, WhereY, K);
WriteLn;
end; {PromptFor}
begin {FastInstallCommands}
WriteLn;
WriteLn('Press <Enter> to accept default');
WriteLn('Press keys followed by <Enter> for new key sequence');
WriteLn('Press <Bksp> to back up one keystroke, C to Clear, R to Restore');
WriteLn('Press <Scroll Lock> to toggle literal mode');
WriteLn('Press <Escape> to quit entering commands');
WriteLn('Random access editing is available when you are finished');
WriteLn;
C := 1;
StopNow := False;
while not(StopNow) and (C <= MaxDisplay) do begin
with Commands[OrderMap[C]] do begin
Write(Pad(Name, 26), '( Primary ): ', Pad(TextRepresentation(Main), 18), ' ');
PromptFor(Main);
if not(StopNow) then begin
Write(Pad(Name, 26), '(Secondary): ', Pad(TextRepresentation(Alt), 18), ' ');
PromptFor(Alt);
end;
end;
repeat
Inc(C);
until (C > MaxDisplay) or (OrderMap[C] <> CmdNull);
end;
WriteLn;
Write('Press a key to invoke full screen key editor ');
CH := ReadKey;
end; {FastInstallCommands}
function CheckCommands(var Commands : CommandList) : Boolean;
{-Return true if no duplicate commands are found, else complain}
var
FCmd, TCmd : CommandType;
Ok : Boolean;
Cnt : Integer;
CntStr : VarString;
function Conflicting(FCmd, TCmd : CommandType) : Boolean;
{-return true, and set appropriate flags if any conflict}
var
FMain, Falt, TMain, TAlt : KeyString;
Ok : Boolean;
begin {Conflicting}
Ok := True;
with Commands[FCmd] do begin
FMain := Main.Keys;
Falt := Alt.Keys;
end;
with Commands[TCmd] do begin
TMain := Main.Keys;
TAlt := Alt.Keys;
end;
if FMain <> '' then begin
if Pos(FMain, TMain) = 1 then begin
Ok := False;
Commands[FCmd].Main.Conflict := True;
Commands[TCmd].Main.Conflict := True;
end;
if Pos(FMain, TAlt) = 1 then begin
Ok := False;
Commands[FCmd].Main.Conflict := True;
Commands[TCmd].Alt.Conflict := True;
end;
end;
if TMain <> '' then begin
if Pos(TMain, FMain) = 1 then begin
Ok := False;
Commands[TCmd].Main.Conflict := True;
Commands[FCmd].Main.Conflict := True;
end;
if Pos(TMain, Falt) = 1 then begin
Ok := False;
Commands[TCmd].Main.Conflict := True;
Commands[FCmd].Alt.Conflict := True;
end;
end;
if TAlt <> '' then begin
if Pos(TAlt, FMain) = 1 then begin
Ok := False;
Commands[TCmd].Alt.Conflict := True;
Commands[FCmd].Main.Conflict := True;
end;
if Pos(TAlt, Falt) = 1 then begin
Ok := False;
Commands[TCmd].Alt.Conflict := True;
Commands[FCmd].Alt.Conflict := True;
end;
end;
if Falt <> '' then begin
if Pos(Falt, TMain) = 1 then begin
Ok := False;
Commands[FCmd].Alt.Conflict := True;
Commands[TCmd].Main.Conflict := True;
end;
if Pos(Falt, TAlt) = 1 then begin
Ok := False;
Commands[FCmd].Alt.Conflict := True;
Commands[TCmd].Alt.Conflict := True;
end;
end;
Conflicting := not(Ok);
end; {Conflicting}
begin {CheckCommands}
{Provide some reassurance}
ClrEol(1, 1, LoColor);
EdFastWrite('Checking for conflicts....', 1, 1, LoColor);
{Reset previous conflicts}
for FCmd := MinCmd to MaxCmd do
with Commands[FCmd] do begin
Main.Conflict := False;
Alt.Conflict := False;
end;
Ok := True;
Cnt := 0;
for FCmd := MinCmd to MaxCmd do begin
{Keep status going}
Cnt := Succ(Cnt);
Str(Cnt:4, CntStr);
EdFastWrite(CntStr, 1, 28, LoColor);
{Don't waste space on duplicate commands}
with Commands[FCmd] do
if Main.Keys = Alt.Keys then begin
Alt.Keys := '';
Alt.Conflict := False;
Alt.Modified := False;
end;
if Commands[FCmd].Main.Modified or Commands[FCmd].Alt.Modified then
{Now compare for conflicts}
for TCmd := MinCmd to MaxCmd do
if (TCmd <> FCmd) then
if Conflicting(FCmd, TCmd) then
Ok := False;
end;
ClrEol(1, 1, LoColor);
CheckCommands := Ok;
end; {CheckCommands}
procedure PackCommands(var Commands : CommandList;
var CuPacked, WsPacked : PackedCommandList;
var CmdLen : Integer);
{-Rebuild the packed command structure}
var
C : CommandType;
Len, pNew, pCu, pWs : Integer;
begin {PackCommands}
FillChar(CuPacked, SizeOf(CuPacked), 0);
FillChar(WsPacked, SizeOf(WsPacked), 0);
pCu := 1;
pWs := 1;
for C := MinCmd to MaxCmd do
with Commands[C] do begin
{Repack the custom keystrokes}
with Alt do begin
{Unused entries are represented by character 255}
if Keys = '' then
Keys := #$FF;
Len := Succ(Length(Keys));
pNew := pCu+Len;
{Assure we don't overflow the table}
if pNew <= CmdListBytes then
Move(Keys, CuPacked[pCu], Len);
pCu := pNew;
end;
{Repack the WordStar keystrokes}
with Main do begin
if Keys = '' then
Keys := #$FF;
Len := Succ(Length(Keys));
pNew := pWs+Len;
if pNew <= CmdListBytes then
Move(Keys, WsPacked[pWs], Len);
pWs := pNew;
end;
end;
{Return the maximum of the two command buffer lengths}
CmdLen := pCu;
if pWs > CmdLen then
CmdLen := pWs;
end; {PackCommands}
begin
ClrScr;
{commands with the lowest/highest ordinal values}
MinCmd := CmdNewLine;
MaxCmd := CmdInsertCtrlChar;
InitializeScreen;
GoToXY(1, 3);
KeyOfs := FindKeys(OurInstRec);
CuPacked := OurInstRec.PCList1;
WsPacked := OurInstRec.PCList2;
InitializeCommands(Commands);
ParsePackedCommands(CuPacked, WsPacked, Commands);
OrigCommands := Commands;
if YesNo('Perform fast entry of fully reconfigured keyboard?', 'N') then
{Sequential installation}
FastInstallCommands;
InitializeScreen;
Quitting := False;
repeat
{Random access editing}
EditCommands;
SetColor(LoColor);
ClrEol(1, 1, LoColor);
ClrEol(1, 2, LoColor);
GoToXY(1, 1);
CH := Getkey('W to install keyboard, Q to quit: ', 'WQ');
Write(CH);
GoToXY(1, 1);
case CH of
'W' :
begin
if CheckCommands(Commands) then begin
PackCommands(Commands, CuPacked, WsPacked, CmdLen);
if CmdLen > CmdListBytes then begin
ClrEol(1, 1, EdColor);
EdFastWrite('Command keys exceed available space. Press a key to continue...', 1, 1, EdColor);
end else begin
Wrote := True;
Quitting := True;
end;
end else begin
ClrEol(1, 1, EdColor);
EdFastWrite('Command conflicts found and marked. Press a key to correct...', 1, 1, EdColor);
CH := ReadKey;
Center(1, TiColor, Title);
end;
end;
'Q' :
begin
Wrote := False;
Quitting := True;
end;
end;
until Quitting;
if Wrote then begin
ClrEol(1, 1, LoColor);
EdFastWrite('Updating '+ProgName+'...', 1, 1, LoColor);
OurInstRec.PCList1 := CuPacked;
OurInstRec.PCList2 := WsPacked;
if not ModifyDefaults(KeyOfs, OurInstRec, SizeOf(InstRec)) then
HaltError('Error writing to keyboard installation area');
end;
end; {KeyInstall}