瀏覽代碼

+ Removed need for keybutil unit by incorporating it in the keyboard unit

michael 24 年之前
父節點
當前提交
96d51ec257
共有 10 個文件被更改,包括 8 次插入116 次删除
  1. 1 1
      docs/kbdex/Makefile
  2. 0 2
      docs/kbdex/README
  3. 1 1
      docs/kbdex/ex1.pp
  4. 1 1
      docs/kbdex/ex2.pp
  5. 1 1
      docs/kbdex/ex3.pp
  6. 1 1
      docs/kbdex/ex4.pp
  7. 1 1
      docs/kbdex/ex5.pp
  8. 1 1
      docs/kbdex/ex6.pp
  9. 1 1
      docs/kbdex/ex7.pp
  10. 0 106
      docs/kbdex/keybutil.pp

+ 1 - 1
docs/kbdex/Makefile

@@ -46,7 +46,7 @@ onetex : tex
 	$(MAKETEX) $(TEXOBJECTS)
 	$(MAKETEX) $(TEXOBJECTS)
 
 
 clean : 
 clean : 
-	rm -f *.o *.s $(OBJECTS) $(TEXOBJECTS) keybutil.ppu
+	rm -f *.o *.s $(OBJECTS) $(TEXOBJECTS)
  
  
 $(OBJECTS): %: %.pp
 $(OBJECTS): %: %.pp
 	$(PP) $(PPOPTS) $*
 	$(PP) $(PPOPTS) $*

+ 0 - 2
docs/kbdex/README

@@ -1,7 +1,5 @@
 This directory contains the examples for the Keyboard unit
 This directory contains the examples for the Keyboard unit
 
 
-keybutil.pp contains some routines to convert keyevents to readable strings.
-
 ex1.pp contains an example of the GetKeyEvent function.
 ex1.pp contains an example of the GetKeyEvent function.
 ex2.pp contains an example of the GetKeyEventCode function.
 ex2.pp contains an example of the GetKeyEventCode function.
 ex3.pp contains an example of the GetKeyEventShiftState function.
 ex3.pp contains an example of the GetKeyEventShiftState function.

+ 1 - 1
docs/kbdex/ex1.pp

@@ -2,7 +2,7 @@ program example1;
 
 
 { This program demonstrates the GetKeyEvent function }
 { This program demonstrates the GetKeyEvent function }
 
 
-uses keyboard, keybutil;
+uses keyboard;
 
 
 Var
 Var
   K : TKeyEvent;
   K : TKeyEvent;

+ 1 - 1
docs/kbdex/ex2.pp

@@ -2,7 +2,7 @@ Program Example2;
 
 
 { Program to demonstrate the GetKeyEventCode function. }
 { Program to demonstrate the GetKeyEventCode function. }
 
 
-Uses keyboard,KeybUtil;
+Uses keyboard;
 
 
 Var
 Var
   K : TKeyEvent;
   K : TKeyEvent;

+ 1 - 1
docs/kbdex/ex3.pp

@@ -2,7 +2,7 @@ Program Example3;
 
 
 { Program to demonstrate the GetKeyEventShiftState function. }
 { Program to demonstrate the GetKeyEventShiftState function. }
 
 
-Uses keyboard,KeybUtil;
+Uses keyboard;
 
 
 Var
 Var
   K : TKeyEvent;
   K : TKeyEvent;

+ 1 - 1
docs/kbdex/ex4.pp

@@ -2,7 +2,7 @@ program example4;
 
 
 { This program demonstrates the PollKeyEvent function }
 { This program demonstrates the PollKeyEvent function }
 
 
-uses keyboard, keybutil;
+uses keyboard;
 
 
 Var
 Var
   K : TKeyEvent;
   K : TKeyEvent;

+ 1 - 1
docs/kbdex/ex5.pp

@@ -2,7 +2,7 @@ program example5;
 
 
 { This program demonstrates the PutKeyEvent function }
 { This program demonstrates the PutKeyEvent function }
 
 
-uses keyboard, keybutil;
+uses keyboard;
 
 
 Var
 Var
   K,k2 : TKeyEvent;
   K,k2 : TKeyEvent;

+ 1 - 1
docs/kbdex/ex6.pp

@@ -2,7 +2,7 @@ program example6;
 
 
 { This program demonstrates the PollShiftStateEvent function }
 { This program demonstrates the PollShiftStateEvent function }
 
 
-uses keyboard, keybutil;
+uses keyboard;
 
 
 Var
 Var
   K : TKeyEvent;
   K : TKeyEvent;

+ 1 - 1
docs/kbdex/ex7.pp

@@ -2,7 +2,7 @@ program example1;
 
 
 { This program demonstrates the GetKeyEvent function }
 { This program demonstrates the GetKeyEvent function }
 
 
-uses keyboard, keybutil;
+uses keyboard;
 
 
 Var
 Var
   K : TKeyEvent;
   K : TKeyEvent;

+ 0 - 106
docs/kbdex/keybutil.pp

@@ -1,106 +0,0 @@
-unit keybutil;
-
-Interface
-
-Uses keyboard;
-
-Type
-  TKeyRecord = packed record
-    KeyCode : Word;
-    ShiftState, Flags : Byte;
-  end;
- 
-Const 
-  // Only use these strings. Should be used to localize key names.
-  SShift       : Array [1..3] of string[5] = ('SHIFT','CTRL','ALT');
-  SLeftRight   : Array [1..2] of string[5] = ('LEFT','RIGHT');
-  SUnicodeChar : String = 'Unicode character ';
-  SScanCode    : String = 'Key with scancode ';
-  SUnknownFunctionKey : String = 'Unknown function key : ';
-  SAnd         : String = 'AND';
-  SKeyPad      : Array [0..($FF2F-kbdHome)] of string[6] = 
-                 ('Home','Up','PgUp','Left',
-                  'Middle','Right','End','Down',
-                  'PgDn','Insert','Delete','',
-                  '','','','');
-
-Function ShiftStateToString(KeyEvent : TKeyEvent; UseLeftRight : Boolean) : String;
-Function FunctionKeyName (KeyCode : Word) : String;
-Function KeyEventToString(KeyEvent : TKeyEvent) : String;
-
-
-Implementation
-
-Procedure AddToString (Var S : String; Const A : String);
-
-begin
-  If Length(S)=0 then
-    S:=A
-  else
-    S:=S+' '+A;  
-end;
-
-Function IntToStr(Int : Longint) : String;
-
-begin
-  Str(Int,IntToStr);  
-end;
-  
-Function ShiftStateToString(KeyEvent : TKeyEvent; UseLeftRight : Boolean) : String;
-
-Var
-  S : Integer;
-  T : String;
-  
-begin
-  S:=GetKeyEventShiftState(KeyEvent);
-  T:='';
-  If (S and kbShift)<>0 then
-    begin
-    if UseLeftRight then
-      case (S and kbShift) of
-        kbShift      : AddToString(T,SLeftRight[1]+' '+SAnd+' '+SLeftRight[2]);
-        kbLeftShift  : AddToString(T,SLeftRight[1]);
-        kbRightShift : AddToString(T,SLeftRight[2]);
-      end;
-    AddToString(T,SShift[1]);
-    end;
-  If (S and kbCtrl)<>0 Then
-    AddToString(T,SShift[2]);
-  If (S and kbAlt)<>0 Then  
-    AddToString(T,SShift[3]);
-  ShiftStateToString:=T;  
-end;
-
-Function FunctionKeyName (KeyCode : Word) : String;
-
-begin
-  If ((KeyCode-KbdF1)<$1F) Then 
-    FunctionKeyName:='F'+IntToStr((KeyCode-KbdF1+1))
-  else
-    begin
-    If (KeyCode-kbdHome)<($2F-$1F) then
-      FunctionKeyName:=SKeyPad[(KeyCode-kbdHome)]
-    else
-      FunctionKeyName:=SUnknownFunctionKey + IntToStr(KeyCode);
-    end;  
-end;
-
-Function KeyEventToString(KeyEvent : TKeyEvent) : String;
-
-Var
-  T : String;
-
-begin
-  T:=ShiftStateToString(KeyEvent,False);
-  Case GetKeyEventFlags(KeyEvent) of
-    kbASCII   : AddToString(T,GetKeyEventChar(KeyEvent));
-    kbUniCode : AddToString(T,SUniCodeChar+IntToStr(GetKeyEventUniCode(Keyevent)));
-    kbFnKey   : AddToString(T,FunctionKeyName(GetKeyEventCode(KeyEvent)));
-                // Not good, we need a GetKeyEventScanCode function !!
-    kbPhys    : AddToString(T,SScanCode+IntToStr(KeyEvent and $ffff));
-  end;
-  KeyEventToString:=T;
-end;
-  
-end.