MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / ConvertToKeycode

Method ConvertToKeycode

source/Pravets.cpp:105–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105BYTE Pravets::ConvertToKeycode(WPARAM key, BYTE keycode)
106{
107 if (KeybGetCapsStatus() && (key >= 'a') && (key <='z'))
108 P8Shift = true;
109 else
110 P8Shift = false;
111
112 //The latter line should be applied for Pravtes 8A/C only, but not for Pravets 82/M !!!
113 if ((KeybGetCapsStatus() == false) && (key >= 'A') && (key <='Z'))
114 {
115 P8Shift = true;
116 if (GetApple2Type() == A2TYPE_PRAVETS8A)
117 keycode = (BYTE)(key + 32);
118 }
119
120 //Remap some keys for Pravets82/M
121 if (GetApple2Type() == A2TYPE_PRAVETS82)
122 {
123 if (key == 64)
124 keycode = 96;
125 if (key == '^')
126 keycode = '~';
127
128 if (KeybGetCapsStatus() == false) //cyrillic letters
129 {
130 if (key == '`') keycode = '^';
131 if (key == 92) keycode = '@'; // \ to @
132 if (key == 124) keycode = 92;
133 }
134 else //(g_bCapsLock == true) //latin letters
135 {
136 if (key == 91) keycode = 123;
137 if (key == 93) keycode = 125;
138 if (key == 124) keycode = 92;
139 }
140 }
141
142 if (GetApple2Type() == A2TYPE_PRAVETS8M) //Pravets 8M charset is still uncertain
143 {
144 if (KeybGetCapsStatus() == false) //cyrillic letters
145 {
146 if (key == '[') keycode = '{';
147 if (key == ']') keycode = '}';
148 if (key == '`') keycode = '~'; //96= key `~
149 if (key == 92) keycode = 96;
150 }
151 else //latin letters
152 {
153 if (key == '`')
154 keycode = '^'; //96= key `~
155 }
156 }
157
158 //Remap some keys for Pravets8A/C, which has a different charset for Pravtes82/M, whose keys MUST NOT be remapped.
159 if (GetApple2Type() == A2TYPE_PRAVETS8A) //&& (g_bCapsLock == false))
160 {
161 if (KeybGetCapsStatus() == false) //i.e. cyrillic letters
162 {

Callers 1

KeybQueueKeypressFunction · 0.80

Calls 2

KeybGetCapsStatusFunction · 0.85
GetApple2TypeFunction · 0.85

Tested by

no test coverage detected