FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/AUITextEntry.c @ 92:c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 08 Nov 2020 06:39:16 +0000 |
parents | 67bfe9f274f6 |
children | 70ea7526b59e |
comparison
equal
deleted
inserted
replaced
91:c3d28a37caad | 92:c0052fe355d3 |
---|---|
25 | 25 |
26 | 26 |
27 ******************************************************************************** | 27 ******************************************************************************** |
28 | 28 |
29 $History: AUITextEntry.c | 29 $History: AUITextEntry.c |
30 | 30 |
31 31/01/02 Original Condat(UK) BMI version. | 31 31/01/02 Original Condat(UK) BMI version. |
32 $End | 32 $End |
33 | 33 |
34 *******************************************************************************/ | 34 *******************************************************************************/ |
35 | 35 |
98 /******************************************************************************* | 98 /******************************************************************************* |
99 | 99 |
100 STATIC DATA | 100 STATIC DATA |
101 | 101 |
102 ********************************************************************************/ | 102 ********************************************************************************/ |
103 /*SPR 2175, increased KEY_PAD_MAX and changed tables to allow entry of some | 103 /*SPR 2175, increased KEY_PAD_MAX and changed tables to allow entry of some |
104 accented characters*/ | 104 accented characters*/ |
105 #define KEY_PAD_MAX 6 | 105 #define KEY_PAD_MAX 6 |
106 | 106 |
107 | 107 |
108 /* API - 01/09/03 - SPR2371 - Move the new character to the end of the multitap sequence */ | 108 /* API - 01/09/03 - SPR2371 - Move the new character to the end of the multitap sequence */ |
109 /* Alpha mode characters for multi-tap - lower case */ | 109 /* Alpha mode characters for multi-tap - lower case */ |
110 | 110 |
111 static UBYTE editAlpha [12][KEY_PAD_MAX] = | 111 static UBYTE editAlpha [12][KEY_PAD_MAX] = |
112 { | 112 { |
113 {'.', ',', '+', '-', '=', '0'}, /*Key 0*/ | 113 {'.', ',', '+', '-', '=', '0'}, /*Key 0*/ |
114 | 114 |
115 {' ' ,'?', '!', ';', ':', '1'}, /*Key 1*/ | 115 {' ' ,'?', '!', ';', ':', '1'}, /*Key 1*/ |
116 /* a grave a umlaut*/ | 116 /* a grave a umlaut*/ |
117 {'a', 'b', 'c', '2', '\x85', '\x84'}, /*Key 2*/ | 117 {'a', 'b', 'c', '2', '\x85', '\x84'}, /*Key 2*/ |
118 /* e-grave e-acute*/ | 118 /* e-grave e-acute*/ |
119 {'d', 'e', 'f', '3', '\x8a', '\x83'}, /*Key 3*/ | 119 {'d', 'e', 'f', '3', '\x8a', '\x83'}, /*Key 3*/ |
120 /* i-grave*/ | 120 /* i-grave*/ |
121 {'g', 'h', 'i', '4', '\x8d', '@'}, /*Key 4*/ | 121 {'g', 'h', 'i', '4', '\x8d', '@'}, /*Key 4*/ |
122 /**/ | 122 /**/ |
123 {'j', 'k', 'l', '5', '&', '*'}, /*Key 5*/ | 123 {'j', 'k', 'l', '5', '&', '*'}, /*Key 5*/ |
124 /* o-grave o-umlaut*/ | 124 /* o-grave o-umlaut*/ |
125 {'m', 'n', 'o', '6', '\x95', '\x94'}, /*Key 6*/ | 125 {'m', 'n', 'o', '6', '\x95', '\x94'}, /*Key 6*/ |
126 /* SS*/ | 126 /* SS*/ |
127 {'p', 'q', 'r', 's', '7', '\xe1'}, /*Key 7*/ | 127 {'p', 'q', 'r', 's', '7', '\xe1'}, /*Key 7*/ |
128 /* u-grave u-umlaut*/ | 128 /* u-grave u-umlaut*/ |
129 {'t', 'u', 'v', '8', '\x97', '\x82'}, /*Key 8*/ | 129 {'t', 'u', 'v', '8', '\x97', '\x82'}, /*Key 8*/ |
130 /**/ | 130 /**/ |
131 {'w', 'x', 'y', 'z', '9', '#'}, /*Key 9*/ | 131 {'w', 'x', 'y', 'z', '9', '#'}, /*Key 9*/ |
132 | 132 |
133 {'*', '*', '*', '*', '*', '*'}, /*Key star, not actually used for multitap*/ | 133 {'*', '*', '*', '*', '*', '*'}, /*Key star, not actually used for multitap*/ |
134 | 134 |
135 {'#', '#', '#', '#', '#', '#'} /*Key hash, not actually used for multitap*/ | 135 {'#', '#', '#', '#', '#', '#'} /*Key hash, not actually used for multitap*/ |
136 }; | 136 }; |
137 | 137 |
138 /* Alpha mode characters for multi-tap - upper case */ | 138 /* Alpha mode characters for multi-tap - upper case */ |
139 | 139 |
140 static UBYTE editAlphaU [12][KEY_PAD_MAX] = | 140 static UBYTE editAlphaU [12][KEY_PAD_MAX] = |
141 { | 141 { |
142 {'.', ',', '+', '-', '=', '0'}, /*Key 0*/ | 142 {'.', ',', '+', '-', '=', '0'}, /*Key 0*/ |
143 | 143 |
144 {' ', '?', '!', ';', ':', '1'}, /*Key 1*/ | 144 {' ', '?', '!', ';', ':', '1'}, /*Key 1*/ |
145 /* A-umlaut cedilla*/ | 145 /* A-umlaut cedilla*/ |
146 {'A', 'B', 'C', '2', '\x8e', '\x81'}, /*Key 2*/ | 146 {'A', 'B', 'C', '2', '\x8e', '\x81'}, /*Key 2*/ |
147 /* E-acute*/ | 147 /* E-acute*/ |
148 {'D', 'E', 'F', '3', '\x90', ' '}, /*Key 3*/ | 148 {'D', 'E', 'F', '3', '\x90', ' '}, /*Key 3*/ |
149 | 149 |
150 {'G', 'H', 'I', '4', '@', ' '}, /*Key 4*/ | 150 {'G', 'H', 'I', '4', '@', ' '}, /*Key 4*/ |
151 | 151 |
152 {'J', 'K', 'L', '5', '&', '*'}, /*Key 5*/ | 152 {'J', 'K', 'L', '5', '&', '*'}, /*Key 5*/ |
153 /* O-umlaut */ | 153 /* O-umlaut */ |
154 {'M', 'N', 'O', '6', '\x99', ' '}, /*Key 6*/ | 154 {'M', 'N', 'O', '6', '\x99', ' '}, /*Key 6*/ |
155 /* SS*/ | 155 /* SS*/ |
156 {'P', 'Q', 'R', 'S', '7', '\xe1'}, /*Key 7*/ | 156 {'P', 'Q', 'R', 'S', '7', '\xe1'}, /*Key 7*/ |
157 /* U-umlaut*/ | 157 /* U-umlaut*/ |
158 {'T', 'U', 'V', '8', '\x9A', ' '}, /*Key 8*/ | 158 {'T', 'U', 'V', '8', '\x9A', ' '}, /*Key 8*/ |
159 | 159 |
160 {'W', 'X', 'Y', 'Z', '9', '#'}, /*Key 9*/ | 160 {'W', 'X', 'Y', 'Z', '9', '#'}, /*Key 9*/ |
161 | 161 |
162 {'*', '*', '*' ,'*', '*', '*'}, /*Key star, not actually used for multitap*/ | 162 {'*', '*', '*' ,'*', '*', '*'}, /*Key star, not actually used for multitap*/ |
163 | 163 |
164 {'#', '#', '#', '#', '#', '#'} /*Key hash, not actually used for multitap*/ | 164 {'#', '#', '#', '#', '#', '#'} /*Key hash, not actually used for multitap*/ |
165 }; | 165 }; |
166 | 166 |
167 /* API - 01/09/03 - SPR2371 - END*/ | 167 /* API - 01/09/03 - SPR2371 - END*/ |
168 | 168 |
177 static int AUI_entry_Timer (MfwEvt event, MfwTim *timer); | 177 static int AUI_entry_Timer (MfwEvt event, MfwTim *timer); |
178 static USHORT AUI_entry_Keypress(T_AUI_ENTRY_DATA *entry_data, MfwEvt event, MfwKbd *key); | 178 static USHORT AUI_entry_Keypress(T_AUI_ENTRY_DATA *entry_data, MfwEvt event, MfwKbd *key); |
179 | 179 |
180 /******************************************************************************* | 180 /******************************************************************************* |
181 | 181 |
182 $Function: AUI_entry_Create | 182 $Function: AUI_entry_Create |
183 | 183 |
184 $Description: Initialises the text entry data. Allocates memory. Creates the timer. | 184 $Description: Initialises the text entry data. Allocates memory. Creates the timer. |
185 | 185 |
186 $Returns: Pointer to the data. | 186 $Returns: Pointer to the data. |
187 | 187 |
188 $Arguments: win - The window in which the editor is displayed | 188 $Arguments: win - The window in which the editor is displayed |
189 editor - The editor | 189 editor - The editor |
190 update - The event to be sent to the window in order to update it | 190 update - The event to be sent to the window in order to update it |
191 | 191 |
192 *******************************************************************************/ | 192 *******************************************************************************/ |
193 | 193 |
194 T_AUI_ENTRY_DATA *AUI_entry_Create(T_MFW_HND win, T_ED_DATA *editor, U32 update) | 194 T_AUI_ENTRY_DATA *AUI_entry_Create(T_MFW_HND win, T_ED_DATA *editor, U32 update) |
195 { | 195 { |
196 T_AUI_ENTRY_DATA *entry_data = (T_AUI_ENTRY_DATA *)mfwAlloc(sizeof(T_AUI_ENTRY_DATA)); | 196 T_AUI_ENTRY_DATA *entry_data = (T_AUI_ENTRY_DATA *)mfwAlloc(sizeof(T_AUI_ENTRY_DATA)); |
197 | 197 |
198 entry_data->win = win; | 198 entry_data->win = win; |
199 entry_data->update = update; | 199 entry_data->update = update; |
200 entry_data->editor = editor; | 200 entry_data->editor = editor; |
201 /* SPR#1597 - SH - Always create this timer */ | 201 /* SPR#1597 - SH - Always create this timer */ |
202 entry_data->editTim = tim_create(win, 1000, (MfwCb) AUI_entry_Timer); | 202 entry_data->editTim = tim_create(win, 1000, (MfwCb) AUI_entry_Timer); |
208 | 208 |
209 | 209 |
210 /******************************************************************************* | 210 /******************************************************************************* |
211 | 211 |
212 $Function: AUI_entry_Destroy | 212 $Function: AUI_entry_Destroy |
213 | 213 |
214 $Description: Frees memory associated with text entry. | 214 $Description: Frees memory associated with text entry. |
215 | 215 |
216 $Returns: none. | 216 $Returns: none. |
217 | 217 |
218 $Arguments: entry_data - The text entry data | 218 $Arguments: entry_data - The text entry data |
219 | 219 |
220 *******************************************************************************/ | 220 *******************************************************************************/ |
221 | 221 |
222 void AUI_entry_Destroy(T_AUI_ENTRY_DATA *entry_data) | 222 void AUI_entry_Destroy(T_AUI_ENTRY_DATA *entry_data) |
223 { | 223 { |
224 if (entry_data->editTim) | 224 if (entry_data->editTim) |
231 return; | 231 return; |
232 } | 232 } |
233 | 233 |
234 /******************************************************************************* | 234 /******************************************************************************* |
235 | 235 |
236 $Function: AUI_entry_EditChar | 236 $Function: AUI_entry_EditChar |
237 | 237 |
238 $Description: Sends a character to the text editor. | 238 $Description: Sends a character to the text editor. |
239 | 239 |
240 $Returns: None. | 240 $Returns: None. |
241 | 241 |
242 $Arguments: data - The editor data | 242 $Arguments: data - The editor data |
243 alphachar - Character to be inserted, or NULL if key tables are to | 243 alphachar - Character to be inserted, or NULL if key tables are to |
244 be used | 244 be used |
245 multitap - TRUE if multitap is in progress | 245 multitap - TRUE if multitap is in progress |
246 | 246 |
247 *******************************************************************************/ | 247 *******************************************************************************/ |
248 | 248 |
249 USHORT AUI_entry_EditChar (T_AUI_ENTRY_DATA *entry_data, USHORT alphachar, BOOL multitap) | 249 USHORT AUI_entry_EditChar (T_AUI_ENTRY_DATA *entry_data, USHORT alphachar, BOOL multitap) |
250 { | 250 { |
251 T_ED_DATA *editor = entry_data->editor; | 251 T_ED_DATA *editor = entry_data->editor; |
276 | 276 |
277 $Returns: None. | 277 $Returns: None. |
278 | 278 |
279 $Arguments: data - The editor data | 279 $Arguments: data - The editor data |
280 code - The key code of the digit to be inserted | 280 code - The key code of the digit to be inserted |
281 | 281 |
282 *******************************************************************************/ | 282 *******************************************************************************/ |
283 | 283 |
284 USHORT AUI_entry_EditDigit (T_AUI_ENTRY_DATA *entry_data, UBYTE code) | 284 USHORT AUI_entry_EditDigit (T_AUI_ENTRY_DATA *entry_data, UBYTE code) |
285 { | 285 { |
286 T_ED_DATA *editor = entry_data->editor; | 286 T_ED_DATA *editor = entry_data->editor; |
287 USHORT alphachar; | 287 USHORT alphachar; |
288 | 288 |
289 TRACE_FUNCTION("AUITextEntry: AUI_entry_EditDigit()"); | 289 TRACE_FUNCTION("AUITextEntry: AUI_entry_EditDigit()"); |
290 | 290 |
291 alphachar = ATB_char_Unicode(editControls[code]); | 291 alphachar = ATB_char_Unicode(editControls[code]); |
292 | 292 |
293 ATB_edit_MultiTap(editor, alphachar, FALSE); | 293 ATB_edit_MultiTap(editor, alphachar, FALSE); |
294 | 294 |
295 return alphachar; | 295 return alphachar; |
296 } | 296 } |
297 | 297 |
298 | 298 |
299 /******************************************************************************* | 299 /******************************************************************************* |
300 | 300 |
301 $Function: AUI_entry_Timer | 301 $Function: AUI_entry_Timer |
302 | 302 |
303 $Description: executes the timer event from the edit component | 303 $Description: executes the timer event from the edit component |
304 | 304 |
305 $Returns: none. | 305 $Returns: none. |
306 | 306 |
307 $Arguments: | 307 $Arguments: |
308 | 308 |
309 *******************************************************************************/ | 309 *******************************************************************************/ |
310 | 310 |
311 static int AUI_entry_Timer (MfwEvt event, MfwTim *timer) | 311 static int AUI_entry_Timer (MfwEvt event, MfwTim *timer) |
312 { | 312 { |
313 T_AUI_ENTRY_DATA *entry_data = (T_AUI_ENTRY_DATA *)MMIdata; | 313 T_AUI_ENTRY_DATA *entry_data = (T_AUI_ENTRY_DATA *)MMIdata; |
319 if (entry_data->editor->multitap) | 319 if (entry_data->editor->multitap) |
320 { | 320 { |
321 if (ATB_edit_Mode(entry_data->editor, ED_MODE_ALPHA)) | 321 if (ATB_edit_Mode(entry_data->editor, ED_MODE_ALPHA)) |
322 { | 322 { |
323 AUI_entry_EditChar(entry_data, NULL, FALSE); | 323 AUI_entry_EditChar(entry_data, NULL, FALSE); |
324 | 324 |
325 entry_data->Level = KEY_PAD_MAX-1; | 325 entry_data->Level = KEY_PAD_MAX-1; |
326 entry_data->Key = KCD_MAX; | 326 entry_data->Key = KCD_MAX; |
327 } | 327 } |
328 | 328 |
329 SEND_EVENT(entry_data->win, entry_data->update,0,0); | 329 SEND_EVENT(entry_data->win, entry_data->update,0,0); |
330 } | 330 } |
331 | 331 |
332 return 1; | 332 return 1; |
333 } | 333 } |
334 | 334 |
335 | 335 |
336 /******************************************************************************* | 336 /******************************************************************************* |
337 | 337 |
338 $Function: AUI_entry_StopMultitap | 338 $Function: AUI_entry_StopMultitap |
339 | 339 |
340 $Description: Stops a multitap operation going on, cancelling the timer | 340 $Description: Stops a multitap operation going on, cancelling the timer |
341 SPR#2174 - SH - Added | 341 SPR#2174 - SH - Added |
342 | 342 |
343 $Returns: none. | 343 $Returns: none. |
344 | 344 |
345 $Arguments: entry_data - The entry data | 345 $Arguments: entry_data - The entry data |
346 | 346 |
347 *******************************************************************************/ | 347 *******************************************************************************/ |
348 | 348 |
349 void AUI_entry_StopMultitap(T_AUI_ENTRY_DATA *entry_data) | 349 void AUI_entry_StopMultitap(T_AUI_ENTRY_DATA *entry_data) |
350 { | 350 { |
351 TRACE_FUNCTION("AUIEditor: AUI_entry_StopMultitap()"); | 351 TRACE_FUNCTION("AUIEditor: AUI_entry_StopMultitap()"); |
352 | 352 |
353 timStop(entry_data->editTim); | 353 timStop(entry_data->editTim); |
354 | 354 |
355 entry_data->editor->multitap = FALSE; | 355 entry_data->editor->multitap = FALSE; |
356 | 356 |
357 entry_data->Level = KEY_PAD_MAX-1; | 357 entry_data->Level = KEY_PAD_MAX-1; |
358 entry_data->Key = KCD_MAX; | 358 entry_data->Key = KCD_MAX; |
359 | 359 |
360 return; | 360 return; |
361 } | 361 } |
362 | 362 |
363 | 363 |
364 /******************************************************************************* | 364 /******************************************************************************* |
365 | 365 |
366 $Function: AUI_entry_EventKey | 366 $Function: AUI_entry_EventKey |
367 | 367 |
368 $Description: Process a keypress event. | 368 $Description: Process a keypress event. |
369 | 369 |
370 $Returns: The character that is entered, or NULL. | 370 $Returns: The character that is entered, or NULL. |
371 | 371 |
372 $Arguments: | 372 $Arguments: |
373 | 373 |
374 *******************************************************************************/ | 374 *******************************************************************************/ |
375 | 375 |
376 USHORT AUI_entry_EventKey (T_AUI_ENTRY_DATA *entry_data, MfwEvt event, MfwKbd *key) | 376 USHORT AUI_entry_EventKey (T_AUI_ENTRY_DATA *entry_data, MfwEvt event, MfwKbd *key) |
377 { | 377 { |
378 T_ED_DATA *editor = entry_data->editor; | 378 T_ED_DATA *editor = entry_data->editor; |
379 USHORT alphachar; // The character entered | 379 USHORT alphachar; // The character entered |
380 | 380 |
381 TRACE_FUNCTION("AUIEditor: AUI_entry_EventKey"); | 381 TRACE_FUNCTION("AUIEditor: AUI_entry_EventKey"); |
382 | 382 |
383 alphachar = AUI_entry_Keypress(entry_data, event, key); | 383 alphachar = AUI_entry_Keypress(entry_data, event, key); |
384 | 384 |
385 ATB_edit_Refresh(editor); | 385 ATB_edit_Refresh(editor); |
386 | 386 |
387 return alphachar; | 387 return alphachar; |
388 } | 388 } |
389 | 389 |
390 | 390 |
391 /******************************************************************************* | 391 /******************************************************************************* |
392 | 392 |
393 $Function: AUI_entry_Keypress | 393 $Function: AUI_entry_Keypress |
394 | 394 |
395 $Description: Process a keypress event | 395 $Description: Process a keypress event |
396 | 396 |
397 $Returns: The character that is entered, or NULL. | 397 $Returns: The character that is entered, or NULL. |
398 | 398 |
399 $Arguments: | 399 $Arguments: |
400 | 400 |
401 *******************************************************************************/ | 401 *******************************************************************************/ |
402 | 402 |
403 static USHORT AUI_entry_Keypress(T_AUI_ENTRY_DATA *entry_data, MfwEvt event, MfwKbd *key) | 403 static USHORT AUI_entry_Keypress(T_AUI_ENTRY_DATA *entry_data, MfwEvt event, MfwKbd *key) |
404 { | 404 { |
405 T_ED_DATA *editor = entry_data->editor; | 405 T_ED_DATA *editor = entry_data->editor; |
406 USHORT alphachar; /* Current multi-tap character */ | 406 USHORT alphachar; /* Current multi-tap character */ |
407 T_ED_CASE_PREF casePref; | 407 T_ED_CASE_PREF casePref; |
408 | 408 |
409 TRACE_FUNCTION("AUIEditor: AUI_entry_KeypressFormat()"); | 409 TRACE_FUNCTION("AUIEditor: AUI_entry_KeypressFormat()"); |
410 | 410 |
411 alphachar = NULL; | 411 alphachar = NULL; |
412 | 412 |
413 if (key->code!=KCD_HUP && editor->cursor.pos<(editor->attr->size-1)) /* SPR#1995 - SH */ | 413 if (key->code!=KCD_HUP && editor->cursor.pos<(editor->attr->size-1)) /* SPR#1995 - SH */ |
414 { | 414 { |
415 /* Multi-tap: The user presses a different key, meaning the previous character must be entered */ | 415 /* Multi-tap: The user presses a different key, meaning the previous character must be entered */ |
416 | 416 |
417 if (entry_data->Key != KCD_MAX && entry_data->Key != key->code) | 417 if (entry_data->Key != KCD_MAX && entry_data->Key != key->code) |
418 { | 418 { |
419 timStop(entry_data->editTim); | 419 timStop(entry_data->editTim); |
422 entry_data->Level = KEY_PAD_MAX-1; | 422 entry_data->Level = KEY_PAD_MAX-1; |
423 entry_data->Key = KCD_MAX; | 423 entry_data->Key = KCD_MAX; |
424 } | 424 } |
425 | 425 |
426 casePref = ATB_edit_GetCasePref(editor); /* Work out the format character that will govern the format of this keypress */ | 426 casePref = ATB_edit_GetCasePref(editor); /* Work out the format character that will govern the format of this keypress */ |
427 | 427 |
428 if (editor->cursor.pos < (editor->attr->size-1) && casePref!=ED_CASEPREF_NONE) /* SPR#1995 - SH */ // Make sure we can still show a character | 428 if (editor->cursor.pos < (editor->attr->size-1) && casePref!=ED_CASEPREF_NONE) /* SPR#1995 - SH */ // Make sure we can still show a character |
429 { | 429 { |
430 if (key->code <= KCD_HASH) /* SPR#1788 - SH - Now accept 0-9, * and # */ | 430 if (key->code <= KCD_HASH) /* SPR#1788 - SH - Now accept 0-9, * and # */ |
431 { | 431 { |
432 entry_data->Key = key->code; // Store the key pressed | 432 entry_data->Key = key->code; // Store the key pressed |
433 | 433 |
434 /* Numeric */ | 434 /* Numeric */ |
435 | 435 |
436 if (casePref==ED_CASEPREF_NUM) // A numeric digit is expected | 436 if (casePref==ED_CASEPREF_NUM) // A numeric digit is expected |
437 { | 437 { |
438 alphachar = AUI_entry_GetKeyChar(entry_data, casePref); | 438 alphachar = AUI_entry_GetKeyChar(entry_data, casePref); |
439 entry_data->Level = KEY_PAD_MAX-1; // Reset multi-tap settings | 439 entry_data->Level = KEY_PAD_MAX-1; // Reset multi-tap settings |
440 entry_data->Key = KCD_MAX; | 440 entry_data->Key = KCD_MAX; |
444 /* Multi-tap alphanumeric */ | 444 /* Multi-tap alphanumeric */ |
445 | 445 |
446 else // Valid format codes | 446 else // Valid format codes |
447 { | 447 { |
448 alphachar = NULL; | 448 alphachar = NULL; |
449 | 449 |
450 entry_data->Level++; // Increment through list of symbols | 450 entry_data->Level++; // Increment through list of symbols |
451 if (entry_data->Level > (KEY_PAD_MAX-1)) // List wraps round | 451 if (entry_data->Level > (KEY_PAD_MAX-1)) // List wraps round |
452 entry_data->Level = 0; | 452 entry_data->Level = 0; |
453 | 453 |
454 alphachar = AUI_entry_GetKeyChar(entry_data, casePref); | 454 alphachar = AUI_entry_GetKeyChar(entry_data, casePref); |
455 | 455 |
456 if (alphachar!=NULL) // If we've found a character, and string isn't max size | 456 if (alphachar!=NULL) // If we've found a character, and string isn't max size |
457 { | 457 { |
458 AUI_entry_EditChar(entry_data, alphachar, TRUE); // Add character, multi-tap | 458 AUI_entry_EditChar(entry_data, alphachar, TRUE); // Add character, multi-tap |
479 | 479 |
480 $Returns: the unicode character to be entered into the text | 480 $Returns: the unicode character to be entered into the text |
481 | 481 |
482 $Arguments: case - the preference for the case of the output | 482 $Arguments: case - the preference for the case of the output |
483 | 483 |
484 | 484 |
485 *******************************************************************************/ | 485 *******************************************************************************/ |
486 | 486 |
487 USHORT AUI_entry_GetKeyChar(T_AUI_ENTRY_DATA *entry_data, T_ED_CASE_PREF casePref) | 487 USHORT AUI_entry_GetKeyChar(T_AUI_ENTRY_DATA *entry_data, T_ED_CASE_PREF casePref) |
488 { | 488 { |
489 T_ED_DATA *editor = entry_data->editor; | 489 T_ED_DATA *editor = entry_data->editor; |
493 USHORT upper; | 493 USHORT upper; |
494 USHORT lower; | 494 USHORT lower; |
495 UBYTE caseSel = ATB_edit_GetCase(editor); /* The case selected by the user */ | 495 UBYTE caseSel = ATB_edit_GetCase(editor); /* The case selected by the user */ |
496 | 496 |
497 TRACE_FUNCTION("AUI_entry_GetKeyChar"); | 497 TRACE_FUNCTION("AUI_entry_GetKeyChar"); |
498 | 498 |
499 if (casePref==ED_CASEPREF_NUM || (casePref==ED_CASEPREF_ALPHANUM && caseSel==ED_CASE_NUM)) | 499 if (casePref==ED_CASEPREF_NUM || (casePref==ED_CASEPREF_ALPHANUM && caseSel==ED_CASE_NUM)) |
500 { | 500 { |
501 alphachar = editControls[entry_data->Key]; | 501 alphachar = editControls[entry_data->Key]; |
502 if (entry_data->Key<=KCD_HASH) | 502 if (entry_data->Key<=KCD_HASH) |
503 alphachar = alphachar << 8; // Gives us the ascii in the upper byte of the unicode | 503 alphachar = alphachar << 8; // Gives us the ascii in the upper byte of the unicode |
505 else | 505 else |
506 { | 506 { |
507 valid = FALSE; | 507 valid = FALSE; |
508 alphachar = NULL; | 508 alphachar = NULL; |
509 safetycounter = 0; | 509 safetycounter = 0; |
510 | 510 |
511 while (!valid && safetycounter<KEY_PAD_MAX) | 511 while (!valid && safetycounter<KEY_PAD_MAX) |
512 { | 512 { |
513 upper = (USHORT)editAlphaU[entry_data->Key][entry_data->Level]; | 513 upper = (USHORT)editAlphaU[entry_data->Key][entry_data->Level]; |
514 lower = (USHORT)editAlpha[entry_data->Key][entry_data->Level]; | 514 lower = (USHORT)editAlpha[entry_data->Key][entry_data->Level]; |
515 | 515 |
520 alphachar = upper; | 520 alphachar = upper; |
521 else | 521 else |
522 alphachar = lower; | 522 alphachar = lower; |
523 valid = TRUE; | 523 valid = TRUE; |
524 break; | 524 break; |
525 | 525 |
526 case ED_CASEPREF_ALPHANUM_UC: | 526 case ED_CASEPREF_ALPHANUM_UC: |
527 alphachar = upper; | 527 alphachar = upper; |
528 valid = TRUE; | 528 valid = TRUE; |
529 break; | 529 break; |
530 | 530 |
535 | 535 |
536 case ED_CASEPREF_ALPHA_UC: | 536 case ED_CASEPREF_ALPHA_UC: |
537 alphachar = upper; | 537 alphachar = upper; |
538 valid = !ATB_char_IsNumeric(alphachar); | 538 valid = !ATB_char_IsNumeric(alphachar); |
539 break; | 539 break; |
540 | 540 |
541 case ED_CASEPREF_ALPHA_LC: | 541 case ED_CASEPREF_ALPHA_LC: |
542 alphachar = lower; | 542 alphachar = lower; |
543 valid = !ATB_char_IsNumeric(alphachar); | 543 valid = !ATB_char_IsNumeric(alphachar); |
544 break; | 544 break; |
545 } | 545 } |
553 entry_data->Level = 0; | 553 entry_data->Level = 0; |
554 } | 554 } |
555 } | 555 } |
556 | 556 |
557 alphachar = ATB_char_Unicode(alphachar); /* SPR#2342 - SH - Convert from unicode properly */ | 557 alphachar = ATB_char_Unicode(alphachar); /* SPR#2342 - SH - Convert from unicode properly */ |
558 } | 558 } |
559 | 559 |
560 TRACE_EVENT_P1(">>> alphachar = %d", alphachar); | 560 TRACE_EVENT_P1(">>> alphachar = %d", alphachar); |
561 | 561 |
562 return alphachar; | 562 return alphachar; |
563 } | 563 } |