comparison src/ui/bmi/AUITextEntry.c @ 135:70ea7526b59e

bmi/AUI*.c: bogotab fixes
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 14 Nov 2020 03:18:11 +0000
parents c0052fe355d3
children
comparison
equal deleted inserted replaced
134:62480f597962 135:70ea7526b59e
9 9
10 ******************************************************************************** 10 ********************************************************************************
11 11
12 $Project name: Basic MMI 12 $Project name: Basic MMI
13 $Project code: BMI (6349) 13 $Project code: BMI (6349)
14 $Module: MMI 14 $Module: MMI
15 $File: AUITextEntry.c 15 $File: AUITextEntry.c
16 $Revision: 1.0 16 $Revision: 1.0
17 17
18 $Author: Condat(UK) 18 $Author: Condat(UK)
19 $Date: 22/02/01 19 $Date: 22/02/01
20 20
21 ******************************************************************************** 21 ********************************************************************************
22 22
23 Description: 23 Description:
24 Multi-tap and other text entry methods for AUI Editor. 24 Multi-tap and other text entry methods for AUI Editor.
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
169 static void *MMIdata; /* Temporary storage for MMI pointer */ 169 static void *MMIdata; /* Temporary storage for MMI pointer */
170 170
171 /******************************************************************************* 171 /*******************************************************************************
172 172
173 LOCAL FUNCTION PROTOTYPES 173 LOCAL FUNCTION PROTOTYPES
174 174
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);
203 entry_data->Level = KEY_PAD_MAX-1; 203 entry_data->Level = KEY_PAD_MAX-1;
204 entry_data->Key = KCD_MAX; 204 entry_data->Key = KCD_MAX;
205 205
206 return entry_data; 206 return entry_data;
207 } 207 }
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 {
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;
252 252
253 TRACE_FUNCTION("AUITextEntry: AUI_entry_EditChar()"); 253 TRACE_FUNCTION("AUITextEntry: AUI_entry_EditChar()");
254 254
255 /* If character is not provided, get it from the key table */ 255 /* If character is not provided, get it from the key table */
256 256
257 if (alphachar==NULL) 257 if (alphachar==NULL)
258 { 258 {
259 alphachar = AUI_entry_GetKeyChar(entry_data, ATB_edit_GetCasePref(editor)); 259 alphachar = AUI_entry_GetKeyChar(entry_data, ATB_edit_GetCasePref(editor));
260 260
261 if (!(ATB_edit_Mode(entry_data->editor, ED_MODE_ALPHA) && entry_data->Key!=KCD_MAX)) 261 if (!(ATB_edit_Mode(entry_data->editor, ED_MODE_ALPHA) && entry_data->Key!=KCD_MAX))
262 alphachar = UNICODE_SPACE; 262 alphachar = UNICODE_SPACE;
263 } 263 }
264 264
265 ATB_edit_MultiTap(editor, alphachar, multitap); 265 ATB_edit_MultiTap(editor, alphachar, multitap);
266 266
267 return alphachar; 267 return alphachar;
268 } 268 }
269 269
270 270
271 /******************************************************************************* 271 /*******************************************************************************
272 272
273 $Function: AUI_entry_EditDigit 273 $Function: AUI_entry_EditDigit
274 274
275 $Description: Sends a numeric digit/symbol to the editor 275 $Description: Sends a numeric digit/symbol to the 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;
314 314
315 TRACE_FUNCTION("AUIEditor: AUI_entry_Timer()"); 315 TRACE_FUNCTION("AUIEditor: AUI_entry_Timer()");
316 316
317 /* SPR#2174 - SH - Only display character if we're still in multi-tap */ 317 /* SPR#2174 - SH - Only display character if we're still in multi-tap */
318 318
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 {
419 timStop(entry_data->editTim);
420
421 AUI_entry_EditChar(entry_data, alphachar, FALSE); // Show character, not multi-tap
422 entry_data->Level = KEY_PAD_MAX-1;
423 entry_data->Key = KCD_MAX;
424 }
425
426 casePref = ATB_edit_GetCasePref(editor); /* Work out the format character that will govern the format of this keypress */
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
429 { 418 {
430 if (key->code <= KCD_HASH) /* SPR#1788 - SH - Now accept 0-9, * and # */ 419 timStop(entry_data->editTim);
431 { 420
432 entry_data->Key = key->code; // Store the key pressed 421 AUI_entry_EditChar(entry_data, alphachar, FALSE); // Show character, not multi-tap
433 422 entry_data->Level = KEY_PAD_MAX-1;
434 /* Numeric */ 423 entry_data->Key = KCD_MAX;
435 424 }
436 if (casePref==ED_CASEPREF_NUM) // A numeric digit is expected 425
437 { 426 casePref = ATB_edit_GetCasePref(editor); /* Work out the format character that will govern the format of this keypress */
438 alphachar = AUI_entry_GetKeyChar(entry_data, casePref); 427
439 entry_data->Level = KEY_PAD_MAX-1; // Reset multi-tap settings 428 if (editor->cursor.pos < (editor->attr->size-1) && casePref!=ED_CASEPREF_NONE) /* SPR#1995 - SH */ // Make sure we can still show a character
440 entry_data->Key = KCD_MAX; 429 {
441 AUI_entry_EditChar(entry_data, alphachar, FALSE); // Show character, not multi-tap# 430 if (key->code <= KCD_HASH) /* SPR#1788 - SH - Now accept 0-9, * and # */
442 } 431 {
443 432 entry_data->Key = key->code; // Store the key pressed
444 /* Multi-tap alphanumeric */ 433
445 434 /* Numeric */
446 else // Valid format codes 435
447 { 436 if (casePref==ED_CASEPREF_NUM) // A numeric digit is expected
448 alphachar = NULL; 437 {
449 438 alphachar = AUI_entry_GetKeyChar(entry_data, casePref);
450 entry_data->Level++; // Increment through list of symbols 439 entry_data->Level = KEY_PAD_MAX-1; // Reset multi-tap settings
451 if (entry_data->Level > (KEY_PAD_MAX-1)) // List wraps round 440 entry_data->Key = KCD_MAX;
452 entry_data->Level = 0; 441 AUI_entry_EditChar(entry_data, alphachar, FALSE); // Show character, not multi-tap#
453 442 }
454 alphachar = AUI_entry_GetKeyChar(entry_data, casePref); 443
455 444 /* Multi-tap alphanumeric */
456 if (alphachar!=NULL) // If we've found a character, and string isn't max size 445
457 { 446 else // Valid format codes
458 AUI_entry_EditChar(entry_data, alphachar, TRUE); // Add character, multi-tap 447 {
459 /* Need to store this handle, so timer can get access to 448 alphachar = NULL;
460 * entry_data on callback */ 449
461 MMIdata = (void *)entry_data; 450 entry_data->Level++; // Increment through list of symbols
462 timStart(entry_data->editTim); 451 if (entry_data->Level > (KEY_PAD_MAX-1)) // List wraps round
463 } 452 entry_data->Level = 0;
464 else 453
465 entry_data->Key = KCD_MAX;/*a0393213 warnings removal-KEY_MAX changed to KCD_MAX*/ 454 alphachar = AUI_entry_GetKeyChar(entry_data, casePref);
466 } 455
467 } 456 if (alphachar!=NULL) // If we've found a character, and string isn't max size
468 } 457 {
469 } 458 AUI_entry_EditChar(entry_data, alphachar, TRUE); // Add character, multi-tap
470 return alphachar; 459 /* Need to store this handle, so timer can get access to
471 } 460 * entry_data on callback */
472 461 MMIdata = (void *)entry_data;
473 462 timStart(entry_data->editTim);
474 /******************************************************************************* 463 }
475 464 else
476 $Function: AUI_entry_GetKeyChar 465 entry_data->Key = KCD_MAX;/*a0393213 warnings removal-KEY_MAX changed to KCD_MAX*/
477 466 }
478 $Description: Return the character to be entered, based on the keypress 467 }
479 468 }
480 $Returns: the unicode character to be entered into the text 469 }
481 470 return alphachar;
482 $Arguments: case - the preference for the case of the output 471 }
472
473
474 /*******************************************************************************
475
476 $Function: AUI_entry_GetKeyChar
477
478 $Description: Return the character to be entered, based on the keypress
479
480 $Returns: the unicode character to be entered into the text
481
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;
490 USHORT alphachar; 490 USHORT alphachar;
491 USHORT safetycounter; /* Stops searching forever to find compatible character */ 491 USHORT safetycounter; /* Stops searching forever to find compatible character */
492 BOOL valid; /* flag to indicate whether character is accepted */ 492 BOOL valid; /* flag to indicate whether character is accepted */
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
504 } 504 }
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
516 switch(casePref) 516 switch(casePref)
517 { 517 {
518 case ED_CASEPREF_ALPHANUM: 518 case ED_CASEPREF_ALPHANUM:
519 if (caseSel==ED_CASE_UPPER || caseSel==ED_CASE_CAPS) 519 if (caseSel==ED_CASE_UPPER || caseSel==ED_CASE_CAPS)
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
531 case ED_CASEPREF_ALPHANUM_LC: 531 case ED_CASEPREF_ALPHANUM_LC:
532 alphachar = lower; 532 alphachar = lower;
533 valid = TRUE; 533 valid = TRUE;
534 break; 534 break;
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 }
546 546
547 if (!valid) 547 if (!valid)
548 { // find the next one that is, 548 { // find the next one that is,
549 alphachar = NULL; 549 alphachar = NULL;
550 safetycounter++; // (but don't search forever) 550 safetycounter++; // (but don't search forever)
551 entry_data->Level++; 551 entry_data->Level++;
552 if (entry_data->Level > (KEY_PAD_MAX-1)) 552 if (entry_data->Level > (KEY_PAD_MAX-1))
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 }