ReactOS  0.4.12-dev-714-gfaac916
keytrans.h
Go to the documentation of this file.
1 // //
3 // //
4 // Key translations - I.Ioannou (roryt@hol.gr) //
5 // Athens - Greece December 18, 1996 02:56am //
6 // Reads a .cfg file and keeps the key definitions //
7 // for the WIN32 console telnet //
8 // modified for alternate keymap swiching //
9 // by Andrey V. Smilianets (smile@head.aval.kiev.ua) //
10 // Kiev - Ukraine, December 1997. //
12 // //
13 // class KeyTranslator //
14 // //
15 // Load : loads or replaces the keymap //
16 // TranslateKey : returns a char * to the key def //
17 // AddKeyDef : Changes or adds the key translation //
18 // DeleteKeyDef : Deletes a key def from the list //
20 
21 #pragma once
22 
23 #include "tkeydef.h"
24 #include "tkeymap.h"
25 
26 #define TOKEN_DELIMITERS " +\t" // The word's delimiters
27 
28 // Ioannou 2 June 98: Borland needs them - quick hack
29 #ifdef __BORLANDC__
30 #define bool BOOL
31 #define true TRUE
32 #define false FALSE
33 #endif // __BORLANDC__
34 
35 // Maybe not portable, but this is for application cursor mode
36 // (Paul Brannan 5/27/98)
37 // Updated for correct precedence in tncon.cpp (Paul Brannan 12/9/98)
38 #define APP4_KEY 0x8000
39 #define APP3_KEY 0x4000
40 #define APP2_KEY 0x2000
41 #define APP_KEY 0x1000
42 
44 // class KeyTranslator //
45 // Load : loads or replaces the keymap //
46 // TranslateKey : returns a sz to the key def //
47 // AddKeyDef : Changes or adds the key translation //
48 // DeleteKeyDef : Deletes a key def from the list //
50 
52 friend class TMapLoader; // FIX ME!! This isn't the best solution
53 public:
54  KeyTranslator();
56 
57  int SwitchTo(int); // switch to selected keymap
58  int switchMap(TKeyDef& tk);
59 
60  // Returns a pointer to the string that should be printed.
61  // Should return NULL if there is no translation for the key.
62  const char *TranslateKey(WORD wVirtualKeyCode, DWORD dwControlKeyState);
63 
64  // Changes or adds the key translation associated with
65  // wVirtualScanCode and dwControlKeyState.
66  // Return 1 on success.
67  int AddKeyDef(WORD wVirtualKeyCode, DWORD dwControlKeyState, char *lpzKeyDef);
68  int AddKeyDef(WORD wVirtualKeyCode, DWORD dwControlKeyState, tn_ops op);
69 
70  // Delete a key translation
71  int DeleteKeyDef(WORD wVirtualKeyCode, DWORD dwControlKeyState);
72 
73  // Paul Brannan 8/28/98
76  void clear_ext_mode() {ext_mode = 0;}
78 
79 private:
80  DWORD Fix_ControlKeyState(char *);
81  char* Fix_Tok(char *);
82  DWORD ext_mode; // Paul Brannan 8/28/98
83 
86 
87  void DeleteAllDefs(void);
88  int AddGlobalDef(WORD wVirtualKeyCode, char*lpzKeyDef);
89  int LookOnGlobal(char* vkey);
90  DWORD GetGlobalCode(int i) {return globals[i].GetCodeKey();}
91 
93 
94 };
void clear_ext_mode()
Definition: keytrans.h:76
~KeyTranslator()
Definition: keytrans.h:55
DWORD ext_mode
Definition: keytrans.h:82
void set_ext_mode(DWORD mode)
Definition: keytrans.h:74
int mainKeyMap
Definition: keytrans.h:92
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void DeleteAllDefs(void)
Definition: keytrans.cpp:193
DWORD get_ext_mode()
Definition: keytrans.h:77
tn_ops
Definition: tkeydef.h:19
int currentKeyMap
Definition: keytrans.h:92
int DeleteKeyDef(WORD wVirtualKeyCode, DWORD dwControlKeyState)
Definition: keytrans.cpp:177
char * Fix_Tok(char *)
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
int switchMap(TKeyDef &tk)
Definition: keytrans.cpp:67
TArrayAsVector< KeyMap > mapArray
Definition: keytrans.h:84
DWORD GetGlobalCode(int i)
Definition: keytrans.h:90
GLenum mode
Definition: glext.h:6217
int LookOnGlobal(char *vkey)
Definition: keytrans.cpp:150
void unset_ext_mode(DWORD mode)
Definition: keytrans.h:75
int AddKeyDef(WORD wVirtualKeyCode, DWORD dwControlKeyState, char *lpzKeyDef)
Definition: keytrans.cpp:119
UINT op
Definition: effect.c:223
int AddGlobalDef(WORD wVirtualKeyCode, char *lpzKeyDef)
Definition: keytrans.cpp:160
DWORD Fix_ControlKeyState(char *)
const char * TranslateKey(WORD wVirtualKeyCode, DWORD dwControlKeyState)
Definition: keytrans.cpp:94
TArrayAsVector< TKeyDef > globals
Definition: keytrans.h:85
int SwitchTo(int)
Definition: keytrans.cpp:82