FreeCalypso > hg > fc-magnetite
comparison src/aci2/bmi/AUIEditor.c @ 3:93999a60b835
src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 26 Sep 2016 00:29:36 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:c41a534f33c6 | 3:93999a60b835 |
---|---|
1 /******************************************************************************* | |
2 | |
3 CONDAT (UK) | |
4 | |
5 ******************************************************************************** | |
6 | |
7 This software product is the property of Condat (UK) Ltd and may not be | |
8 disclosed to any third party without the express permission of the owner. | |
9 | |
10 ******************************************************************************** | |
11 | |
12 $Project name: Basic MMI | |
13 $Project code: BMI (6349) | |
14 $Module: MMI | |
15 $File: AUIEditor.c | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: 22/02/01 | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: | |
24 Generic MMI Editor. | |
25 | |
26 ******************************************************************************** | |
27 | |
28 $History: AUIEditor.c | |
29 | |
30 Mar 14, 2006 DR: OMAPS00061468 - x0035544. | |
31 Description: SAT 27.22.4.22.2 SET UP IDLE MODE TEXT (Icon support) fails | |
32 Solution : In the function AUI_edit_SetDefault() set the default value for | |
33 display_type to SAT_ICON_NONE. | |
34 | |
35 Jan 16, 2006 DR: OMAPS00061460 - Shashi Shekar B.S. | |
36 Description: SAT Icon support | |
37 Solution : SAT icon support added. | |
38 | |
39 Dec-20-2004 MMI-SPR-27382 xreddymn | |
40 Added NULL window handle check for AUI_edit_Destroy | |
41 | |
42 Sep 2, 2004 REF: CRR 21370 xkundadu | |
43 Description: Giving wrong expected result by long press on "#" key | |
44 Fix: When user presses long on '#' key it will display 'p'. | |
45 Changed the long press of '*' key to display 'w'. | |
46 | |
47 Jul 22,2004 CRR:21605 xrashmic - SASKEN | |
48 Description: After deleting all the characters in the editor the case does not change to | |
49 sentence case. | |
50 Fix: After deleting a character, check if editor is empty and then set the case to | |
51 sentence case only if the user has not modified the case. | |
52 | |
53 | |
54 Jul 29, 2004 REF: CRR:20892 xrashmic - SASKEN | |
55 Description: By Long press on Left/Right key at 'Message Editor' screen, | |
56 cursor not scrolling continuously | |
57 Fix: The Long press of left/right key is now handled in AUI_edit_KbdLongCB. | |
58 The continuous long press of a key was being ignored for all keys. Now | |
59 only for left and right keys this is handled, for rest of the keys the continuos | |
60 long press is ignored. | |
61 | |
62 | |
63 31/01/02 Original Condat(UK) BMI version. | |
64 | |
65 $End | |
66 | |
67 *******************************************************************************/ | |
68 | |
69 #define ENTITY_MFW | |
70 | |
71 /* includes */ | |
72 #include <string.h> | |
73 #include <stdio.h> | |
74 #include <stdlib.h> | |
75 | |
76 #if defined (NEW_FRAME) | |
77 | |
78 #include "typedefs.h" | |
79 #include "vsi.h" | |
80 #include "pei.h" | |
81 #include "custom.h" | |
82 #include "gsm.h" | |
83 | |
84 #else | |
85 | |
86 #include "STDDEFS.H" | |
87 #include "custom.h" | |
88 #include "gsm.h" | |
89 #include "vsi.h" | |
90 | |
91 #endif | |
92 | |
93 #include "mfw_mfw.h" | |
94 #include "mfw_win.h" | |
95 #include "mfw_kbd.h" | |
96 #include "mfw_tim.h" | |
97 #include "mfw_phb.h" | |
98 #include "mfw_sms.h" | |
99 #include "mfw_ss.h" | |
100 #include "mfw_icn.h" | |
101 #include "mfw_mnu.h" | |
102 #include "mfw_lng.h" | |
103 #include "mfw_sat.h" | |
104 #include "mfw_kbd.h" | |
105 #include "mfw_nm.h" | |
106 #include "mfw_cm.h" | |
107 #include "mfw_edt.h" | |
108 | |
109 #include "dspl.h" | |
110 | |
111 #include "ksd.h" | |
112 #include "psa.h" | |
113 | |
114 #include "ATBCommon.h" | |
115 #include "ATBDisplay.h" | |
116 #include "ATBEditor.h" | |
117 #include "AUIEditor.h" | |
118 | |
119 #include "MmiDummy.h" | |
120 #include "MmiMmi.h" | |
121 | |
122 #include "MmiDialogs.h" | |
123 #include "MmiLists.h" | |
124 #include "MmiMenu.h" | |
125 #include "MmiSoftKeys.h" | |
126 #include "MmiIdle.h" | |
127 | |
128 #include "cus_aci.h" | |
129 #include "prim.h" | |
130 #ifndef PCM_2_FFS | |
131 #include "pcm.h" | |
132 #endif | |
133 | |
134 #include "Mmiicons.h" | |
135 #include "MmiBookShared.h" | |
136 #include "mmiSmsMenu.h" | |
137 #include "mfw_ffs.h" | |
138 #ifdef EASY_TEXT_ENABLED | |
139 #include "MmiDictionary.h" | |
140 #endif | |
141 #include "mmiColours.h" | |
142 | |
143 #include "MmiDictionary.h" | |
144 #include "ATBCommon.h" | |
145 #include "ATBDisplay.h" | |
146 #include "ATBEditor.h" | |
147 #include "AUITextEntry.h" | |
148 #include "AUIEditor.h" | |
149 #include "AUIEditor_i.h" | |
150 #include "AUISymbol.h" | |
151 | |
152 /* Mar 08, 2006 REF:ER OMAPS00065168 */ | |
153 #ifdef NEPTUNE_BOARD | |
154 #include "audio.h" | |
155 #endif | |
156 | |
157 | |
158 | |
159 #ifndef MFW_EVENT_PASSED | |
160 #define MFW_EVENT_PASSED 0 | |
161 #endif | |
162 | |
163 #define TRACE_AUIEditor // Def/undef this to show/hide the trace_events for this file | |
164 | |
165 static void AUI_edit_ClearPredText(T_AUI_EDITOR_INFO *data); | |
166 | |
167 /* API - 08/07/03 - CQ10728*/ | |
168 static void AUI_Edit_Display_Only_CB(T_MFW_HND win, USHORT Identifier, SHORT reason); | |
169 static void AUI_Edit_Display_Only_Destroy (T_MFW_HND window); | |
170 /* API - 08/07/03 - CQ10728 END*/ | |
171 | |
172 | |
173 /******************************************************************************* | |
174 | |
175 Static Data | |
176 | |
177 ********************************************************************************/ | |
178 | |
179 /* eZiText icon */ | |
180 | |
181 static const unsigned char TextIconeZiTextSmall[] = | |
182 { | |
183 0x03,0x03,0x18,0x7c,0xcc,0x08,0x10,0x0c | |
184 }; | |
185 | |
186 // Jul 22,2004 CRR:21605 xrashmic - SASKEN | |
187 // This variable would tell us if the user had changed the case explicitly | |
188 UBYTE CaseChanged = FALSE; | |
189 | |
190 #define ED_IND_UPPER "ABC" | |
191 #define ED_IND_LOWER "abc" | |
192 #define ED_IND_CAPS "Abc" | |
193 #define ED_IND_NUM "123" | |
194 #define ED_IND_NONE "---" | |
195 | |
196 | |
197 /******************************************************************************* | |
198 | |
199 $Function: AUI_edit_Start | |
200 | |
201 $Description: Start the editor. | |
202 | |
203 $Returns: None. | |
204 | |
205 $Arguments: None. | |
206 | |
207 *******************************************************************************/ | |
208 | |
209 T_MFW_HND AUI_edit_Start(T_MFW_HND parent, T_AUI_EDITOR_DATA *editor_data) | |
210 { | |
211 T_MFW_HND win; | |
212 | |
213 TRACE_FUNCTION ("AUI_edit_Start()"); | |
214 | |
215 win = AUI_edit_Create(parent, editor_data); | |
216 | |
217 return win; | |
218 } | |
219 | |
220 | |
221 /******************************************************************************* | |
222 | |
223 $Function: AUI_edit_QuickStart | |
224 | |
225 $Description: Start the editor. | |
226 | |
227 $Returns: Dialog handler for the editor. | |
228 | |
229 $Arguments: win - the parent window | |
230 TitleId - the text id of the title (or NULL) | |
231 TitleString - the text string of the title (or NULL) | |
232 buffer - the unicode input buffer | |
233 len - maximum length of the text entered | |
234 editor_info - the T_AUI_EDITOR_DATA structure (allocated but empty) | |
235 | |
236 *******************************************************************************/ | |
237 | |
238 T_MFW_HND AUI_edit_QuickStart(T_MFW_HND win, USHORT TitleId, UBYTE *TitleString, USHORT *buffer, USHORT len, | |
239 T_AUI_EDITOR_DATA *editor_info, T_AUI_EDIT_CB editor_cb) | |
240 { | |
241 | |
242 TRACE_FUNCTION ("AUI_edit_QuickStart()"); | |
243 | |
244 AUI_edit_SetDisplay(editor_info, ZONE_FULL_SK_TITLE, COLOUR_EDITOR, EDITOR_FONT); | |
245 AUI_edit_SetEvents(editor_info, 0, TRUE, FOREVER, editor_cb); | |
246 AUI_edit_SetBuffer(editor_info, ATB_DCS_UNICODE, (UBYTE *)buffer, len); | |
247 AUI_edit_SetTextStr(editor_info, TxtSoftOK, TxtDelete, TitleId, TitleString); | |
248 AUI_edit_SetAltTextStr(editor_info, 0, NULL, TRUE, TxtSoftBack); | |
249 /* create the dialog handler */ | |
250 return AUI_edit_Start(win, editor_info); /* start the common editor */ | |
251 } | |
252 | |
253 | |
254 /******************************************************************************* | |
255 | |
256 $Function: AUI_edit_Create | |
257 | |
258 $Description: Create the editor. | |
259 | |
260 $Returns: Pointer to the editor's window. | |
261 | |
262 $Arguments: parent - The parent window. | |
263 | |
264 *******************************************************************************/ | |
265 | |
266 static T_MFW_HND AUI_edit_Create(T_MFW_HND parent, T_AUI_EDITOR_DATA *editor_data) | |
267 { | |
268 T_AUI_EDITOR_INFO *data = (T_AUI_EDITOR_INFO *)ALLOC_MEMORY (sizeof (T_AUI_EDITOR_INFO)); | |
269 T_MFW_WIN *win_data; | |
270 | |
271 TRACE_FUNCTION ("AUI_edit_Create()"); | |
272 | |
273 /* Create window handler */ | |
274 | |
275 data->win = win_create(parent, 0, E_WIN_VISIBLE, (T_MFW_CB)AUI_edit_WinCb); // Create window | |
276 | |
277 if (data->win==NULL) // Make sure window exists | |
278 { | |
279 return NULL; | |
280 } | |
281 | |
282 /* Connect the dialog data to the MFW-window */ | |
283 | |
284 data->mmi_control.dialog = (T_DIALOG_FUNC)AUI_edit_ExecCb; /* Setup the destination for events */ | |
285 data->mmi_control.data = data; | |
286 data->parent = parent; | |
287 win_data = ((T_MFW_HDR *)data->win)->data; | |
288 win_data->user = (void *)data; | |
289 | |
290 data->kbd = kbd_create(data->win, KEY_ALL,(T_MFW_CB)AUI_edit_KbdCb); | |
291 data->kbd_long = kbd_create(data->win, KEY_ALL|KEY_LONG,(T_MFW_CB)AUI_edit_KbdLongCb); | |
292 data->editor = ATB_edit_Create(&data->editor_data.editor_attr,0); | |
293 | |
294 data->editor_data = *editor_data; | |
295 | |
296 // Jul 22,2004 CRR:21605 xrashmic - SASKEN | |
297 // The initial value of this variable should be false. i.e the user has still not changed the case. | |
298 CaseChanged=FALSE; | |
299 | |
300 AUI_edit_Init(data->win); | |
301 | |
302 SEND_EVENT(data->win, E_ED_INIT, 0, 0); | |
303 | |
304 /* Return window handle */ | |
305 | |
306 return data->win; | |
307 } | |
308 | |
309 | |
310 /******************************************************************************* | |
311 | |
312 $Function: AUI_edit_Init | |
313 | |
314 $Description: Initialise the editor. | |
315 | |
316 $Returns: Pointer to the editor's window. | |
317 | |
318 $Arguments: win - The editor window | |
319 | |
320 *******************************************************************************/ | |
321 | |
322 static void AUI_edit_Init(T_MFW_HND win) | |
323 { | |
324 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
325 T_AUI_EDITOR_INFO *data = (T_AUI_EDITOR_INFO *)win_data->user; | |
326 T_ATB_TEXT text; | |
327 | |
328 TRACE_FUNCTION("AUI_edit_Init()"); | |
329 | |
330 data->editor->update = ED_UPDATE_FULL; | |
331 data->predText.len = 0; /* Blank out predictive text buffer */ | |
332 | |
333 /* Set up title information */ | |
334 | |
335 data->hasTitle = FALSE; | |
336 data->title.len = 0; /* Blank out title buffer */ | |
337 | |
338 if (data->editor_data.TitleId!=NULL) | |
339 { | |
340 data->hasTitle = TRUE; | |
341 text.data = (UBYTE *)GET_TEXT(data->editor_data.TitleId); | |
342 } | |
343 else if (data->editor_data.TitleString!=NULL) | |
344 { | |
345 data->hasTitle = TRUE; | |
346 text.data = data->editor_data.TitleString; | |
347 } | |
348 | |
349 /* If title exists, get its dcs and length */ | |
350 | |
351 if (data->hasTitle) | |
352 { | |
353 if (text.data[0]==0x80) | |
354 { | |
355 text.data += 2; /* Skip over two unicode indicator bytes */ | |
356 text.dcs = ATB_DCS_UNICODE; | |
357 } | |
358 #ifdef EASY_TEXT_ENABLED | |
359 else if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
360 { | |
361 text.dcs = ATB_DCS_UNICODE; | |
362 } | |
363 #endif | |
364 else | |
365 { | |
366 text.dcs = ATB_DCS_ASCII; | |
367 } | |
368 | |
369 text.len = ATB_string_Length(&text); | |
370 | |
371 /* Allocate memory for the title and copy the text there */ | |
372 data->title.data = (UBYTE *)ALLOC_MEMORY((text.len + 1)*ATB_string_Size(&text)); | |
373 | |
374 ATB_string_Copy(&data->title, &text); | |
375 } | |
376 | |
377 /* Set up correct parameters for easytext */ | |
378 | |
379 #ifdef EASY_TEXT_ENABLED | |
380 if (ATB_edit_Mode(data->editor, ED_MODE_ALPHA)) | |
381 { | |
382 /* Allocate word buffer memory */ | |
383 | |
384 data->predText.data = (UBYTE *)ALLOC_MEMORY((ED_PREDTEXT_MAX+1)*sizeof(UBYTE)); | |
385 data->predText.dcs = ATB_DCS_ASCII; | |
386 data->predText.len = 0; | |
387 | |
388 FFS_flashData.PredTextAvailable = TRUE; | |
389 Initialize_Dict(Mmi_getCurrentLanguage()/*SPR1508*/, 0); | |
390 ResetDictSearch(); | |
391 } | |
392 #endif | |
393 | |
394 /* Initialise editor */ | |
395 | |
396 ATB_edit_Init(data->editor); | |
397 | |
398 /* Initialise text entry */ | |
399 | |
400 data->entry_data = AUI_entry_Create(data->win, data->editor, E_ED_UPDATE); | |
401 | |
402 /* If there's a timeout, create the timer */ | |
403 | |
404 if (data->editor_data.timeout && (data->editor_data.timeout != FOREVER)) | |
405 { | |
406 data->timer = tim_create(data->win, data->editor_data.timeout, (T_MFW_CB)AUI_edit_TimerCb); | |
407 tim_start(data->timer); | |
408 } | |
409 else | |
410 { | |
411 data->timer = NULL; | |
412 } | |
413 | |
414 /* Title timer, if required, is set up in WinCb */ | |
415 | |
416 data->title_timer = NULL; | |
417 | |
418 return; | |
419 } | |
420 | |
421 | |
422 /******************************************************************************* | |
423 | |
424 $Function: AUI_edit_Destroy | |
425 | |
426 $Description: Destroy the editor. | |
427 | |
428 $Returns: None. | |
429 | |
430 $Arguments: window - The editor window. | |
431 | |
432 *******************************************************************************/ | |
433 | |
434 void AUI_edit_Destroy(T_MFW_HND win) | |
435 { | |
436 T_MFW_WIN *win_data; | |
437 T_AUI_EDITOR_INFO *data; | |
438 | |
439 #ifdef TRACE_AUIEditor | |
440 TRACE_FUNCTION ("AUI_edit_Destroy()"); | |
441 #endif | |
442 | |
443 if (win == NULL) | |
444 { | |
445 #ifdef TRACE_AUIEditor | |
446 TRACE_EVENT ("Error : Called with NULL Pointer"); | |
447 #endif | |
448 return; | |
449 } | |
450 // xreddymn Dec-21-2004 MMI-SPR-27382: Added NULL window handle check for AUI_edit_Destroy | |
451 win_data = ((T_MFW_HDR *)win)->data; | |
452 if(win_data == NULL) return; | |
453 data = (T_AUI_EDITOR_INFO *)win_data->user; | |
454 if (data) | |
455 { | |
456 /* Free memory allocated for easytext buffer */ | |
457 | |
458 #ifdef EASY_TEXT_ENABLED | |
459 if (ATB_edit_Mode(data->editor, ED_MODE_ALPHA) && data->predText.data ) | |
460 { | |
461 TRACE_EVENT("Freeing predictive text buffer"); | |
462 FREE_MEMORY((void *)data->predText.data, (ED_PREDTEXT_MAX+1)*sizeof(UBYTE)); | |
463 } | |
464 #endif | |
465 | |
466 /* Free memory allocated for title */ | |
467 | |
468 if (data->hasTitle) | |
469 { | |
470 FREE_MEMORY(data->title.data, (data->title.len + 1)*ATB_string_Size(&data->title)); | |
471 } | |
472 | |
473 /* Delete timers */ | |
474 | |
475 if (data->timer) | |
476 { | |
477 tim_delete(data->timer); | |
478 data->timer = NULL; | |
479 } | |
480 if (data->title_timer) | |
481 { | |
482 tim_delete(data->title_timer); | |
483 data->title_timer = NULL; | |
484 } | |
485 | |
486 win_delete (data->win); | |
487 | |
488 /* Free editor memory */ | |
489 | |
490 AUI_entry_Destroy(data->entry_data); | |
491 ATB_edit_Destroy(data->editor); | |
492 FREE_MEMORY ((void *)data, sizeof (T_AUI_EDITOR_INFO)); | |
493 } | |
494 | |
495 return; | |
496 } | |
497 | |
498 | |
499 /******************************************************************************* | |
500 | |
501 $Function: AUI_edit_ExecCb | |
502 | |
503 $Description: Dialog function for editor. | |
504 | |
505 $Returns: None. | |
506 | |
507 $Arguments: None. | |
508 | |
509 *******************************************************************************/ | |
510 | |
511 static void AUI_edit_ExecCb(T_MFW_HND win, USHORT event, USHORT value, void *parameter) | |
512 { | |
513 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
514 T_AUI_EDITOR_INFO *data = (T_AUI_EDITOR_INFO *)win_data->user; | |
515 | |
516 T_MFW_HND parent_win = data->parent; | |
517 USHORT alphachar; | |
518 /* Store these in case editor is destroyed on callback */ | |
519 USHORT Identifier = data->editor_data.Identifier; | |
520 T_AUI_EDIT_CB Callback = data->editor_data.Callback; | |
521 UBYTE destroyEditor = data->editor_data.destroyEditor; | |
522 | |
523 /* Mar 08, 2006 REF:ER OMAPS00065168 */ | |
524 #ifdef NEPTUNE_BOARD | |
525 UBYTE ringer; | |
526 #endif | |
527 | |
528 #ifdef TRACE_AUIEditor | |
529 TRACE_FUNCTION ("AUI_edit_ExecCb()"); | |
530 #endif | |
531 | |
532 switch (event) | |
533 { | |
534 /* Initialise */ | |
535 | |
536 case E_ED_INIT: | |
537 TRACE_EVENT("E_ED_INIT"); | |
538 win_show(data->win); | |
539 break; | |
540 | |
541 /* Destroy the editor */ | |
542 | |
543 case E_ED_DESTROY: | |
544 AUI_edit_Destroy(data->win); | |
545 break; | |
546 | |
547 /* De-initialise editor */ | |
548 case E_ED_DEINIT: | |
549 TRACE_EVENT("E_ED_DEINIT"); | |
550 | |
551 /* Mar 08, 2006 REF:ER OMAPS00065168 */ | |
552 /* Stop playing ring tone on key press */ | |
553 #ifdef NEPTUNE_BOARD | |
554 ringer = getcurrentSMSTone(); | |
555 audio_StopSoundbyID( AUDIO_BUZZER, ringer ); | |
556 | |
557 vsi_t_sleep(0,10); /* small delay */ | |
558 #endif | |
559 | |
560 if (Callback) | |
561 (Callback) (parent_win, Identifier, value); | |
562 | |
563 if(destroyEditor) | |
564 AUI_edit_Destroy(data->win); | |
565 break; | |
566 | |
567 /* Insert a character */ | |
568 | |
569 case E_ED_INSERT: | |
570 alphachar = (USHORT)value; | |
571 /* If value is set, insert character */ | |
572 if (alphachar!=NULL) | |
573 { | |
574 ATB_edit_Char(data->editor, alphachar, TRUE); | |
575 #ifdef EASY_TEXT_ENABLED | |
576 if(FFS_flashData.PredTextAvailable && FFS_flashData.PredTextSelected && ATB_edit_Mode(data->editor, ED_MODE_PREDTEXT)) | |
577 { | |
578 if ((alphachar == UNICODE_FULLSTOP) ||(alphachar == UNICODE_EXCLAMATION) | |
579 || (alphachar == UNICODE_QUESTION)) | |
580 { | |
581 ATB_edit_Char(data->editor, UNICODE_SPACE, TRUE); | |
582 } | |
583 } | |
584 #endif | |
585 } | |
586 else | |
587 /* If parameter is set, insert string */ | |
588 if (parameter!=NULL) | |
589 { | |
590 ATB_edit_InsertString(data->editor, (T_ATB_TEXT *)parameter); | |
591 } | |
592 win_show(data->win); | |
593 break; | |
594 | |
595 /* Update word wrap & redraw editor window */ | |
596 | |
597 case E_ED_UPDATE: | |
598 //ATB_edit_Refresh(data->editor); /* SPR#2342 - SH */ | |
599 win_show(data->win); | |
600 break; | |
601 | |
602 default: | |
603 break; | |
604 } | |
605 return; | |
606 } | |
607 | |
608 | |
609 /******************************************************************************* | |
610 | |
611 $Function: AUI_edit_WinCb | |
612 | |
613 $Description: Editor window event handler. | |
614 | |
615 $Returns: None. | |
616 | |
617 $Arguments: event - the event | |
618 win - the editor window | |
619 | |
620 *******************************************************************************/ | |
621 | |
622 static int AUI_edit_WinCb(T_MFW_EVENT event, T_MFW_WIN *win_data) | |
623 { | |
624 T_AUI_EDITOR_INFO *data = (T_AUI_EDITOR_INFO *)win_data->user; | |
625 T_ED_DATA *editor = data->editor; | |
626 USHORT scrollBarSize; | |
627 USHORT scrollBarPos; | |
628 SHORT editX = editor->attr->win_size.px; | |
629 SHORT editY = editor->attr->win_size.py; | |
630 SHORT editWidth = editor->attr->win_size.sx; | |
631 SHORT editHeight = editor->attr->win_size.sy; | |
632 char lengthIndC[12]; | |
633 | |
634 /* Strings for the header */ | |
635 T_ATB_TEXT string; | |
636 USHORT stringWidth; | |
637 USHORT stringHeight; | |
638 T_ATB_TEXT title; | |
639 USHORT titleWidth; | |
640 USHORT titleHeight; | |
641 | |
642 USHORT textLen; | |
643 static USHORT oldTextLen = 0xFFFF; | |
644 USHORT startPos; | |
645 static USHORT oldStartPos = 0xFFFF; | |
646 | |
647 T_DS_TEXTFORMAT format; | |
648 BOOL showIcons; /* Flag that stores whether icons (e.g. alignment icons) should be shown */ | |
649 T_ED_LINE *line; | |
650 USHORT leftSK; | |
651 USHORT rightSK; | |
652 USHORT textIndex; | |
653 T_ATB_TEXT newTitle; | |
654 USHORT lastSpace; | |
655 USHORT character; | |
656 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
657 #ifdef FF_MMI_SAT_ICON | |
658 SHORT titleIconWidth = 0; | |
659 SHORT iconX; | |
660 SHORT iconY; | |
661 #endif | |
662 | |
663 #ifdef TRACE_AUIEditor | |
664 TRACE_FUNCTION ("AUI_edit_WinCb()"); | |
665 #endif | |
666 | |
667 if (!data) | |
668 return MFW_EVENT_CONSUMED; | |
669 | |
670 switch(event) | |
671 { | |
672 case E_WIN_VISIBLE: /* window is visible */ | |
673 if (win_data->flags & E_WIN_VISIBLE) | |
674 { | |
675 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
676 #ifdef FF_MMI_SAT_ICON | |
677 if (editor->attr->TitleIcon.data != NULL) | |
678 { | |
679 if (editor->attr->TitleIcon.width > TITLE_ICON_WIDTH) | |
680 { | |
681 titleIconWidth = TITLE_ICON_WIDTH; | |
682 } | |
683 else | |
684 { | |
685 titleIconWidth = editor->attr->TitleIcon.width; | |
686 } | |
687 } | |
688 else | |
689 { | |
690 titleIconWidth = 0; | |
691 } | |
692 #endif | |
693 | |
694 textLen = data->editor->attr->text.len; | |
695 line = ATB_edit_LineGet(data->editor, data->editor->winStartLine); | |
696 startPos = line->pos; | |
697 | |
698 if (editor->update==ED_UPDATE_TRIVIAL) | |
699 editor->update = ED_UPDATE_DEFAULT; | |
700 | |
701 TRACE_EVENT("Updating whole screen."); | |
702 | |
703 oldTextLen = textLen; | |
704 oldStartPos = startPos; | |
705 | |
706 /* Show the edited text */ | |
707 /* Don't update editor text if in ED_UPDATE_PARTIAL */ | |
708 | |
709 if (editor->update!=ED_UPDATE_PARTIAL) | |
710 { | |
711 ATB_edit_Show(data->editor); | |
712 } | |
713 | |
714 /* Set the colour for drawing title and scrollbar */ | |
715 | |
716 resources_setTitleColour(COLOUR_EDITOR); | |
717 | |
718 /* TITLE */ | |
719 | |
720 if (data->editor_data.zone_id & ZONE_TITLE) | |
721 { | |
722 dspl_Clear(0,0, SCREEN_SIZE_X-1, editY-1); | |
723 | |
724 /* Display the title, if it exists */ | |
725 | |
726 string.len = 0; | |
727 string.dcs = ATB_DCS_ASCII; | |
728 title.len = 0; | |
729 title.dcs = ATB_DCS_ASCII; | |
730 | |
731 if (data->hasTitle) | |
732 { | |
733 title.data = data->title.data; | |
734 title.len = data->title.len; | |
735 title.dcs = data->title.dcs; | |
736 } | |
737 | |
738 /* Uppercase/lowercase indicator */ | |
739 | |
740 if (!ATB_edit_Mode(editor, ED_MODE_READONLY)) | |
741 { | |
742 switch(ATB_edit_GetCasePref(editor)) | |
743 { | |
744 case ED_CASEPREF_ALPHA_UC: | |
745 case ED_CASEPREF_ALPHANUM_UC: | |
746 string.data = (UBYTE *)ED_IND_UPPER; | |
747 break; | |
748 | |
749 case ED_CASEPREF_ALPHA_LC: | |
750 case ED_CASEPREF_ALPHANUM_LC: | |
751 string.data = (UBYTE *)ED_IND_LOWER; | |
752 break; | |
753 | |
754 case ED_CASEPREF_ALPHANUM: | |
755 if (ATB_edit_GetCase(editor)==ED_CASE_UPPER) | |
756 string.data = (UBYTE *)ED_IND_UPPER; | |
757 else if (ATB_edit_GetCase(editor)==ED_CASE_LOWER) | |
758 string.data = (UBYTE *)ED_IND_LOWER; | |
759 else if (ATB_edit_GetCase(editor)==ED_CASE_CAPS) | |
760 string.data = (UBYTE *)ED_IND_CAPS; | |
761 else | |
762 string.data = (UBYTE *)ED_IND_NUM; | |
763 break; | |
764 | |
765 case ED_CASEPREF_NUM: | |
766 string.data = (UBYTE *)ED_IND_NUM; | |
767 break; | |
768 | |
769 default: | |
770 string.data = (UBYTE *)ED_IND_NONE; | |
771 break; | |
772 } | |
773 | |
774 string.len = ATB_string_Length(&string); | |
775 | |
776 #ifdef EASY_TEXT_ENABLED | |
777 /* Display predicted word in header */ | |
778 | |
779 if(ATB_edit_Mode(editor, ED_MODE_PREDTEXT) && FFS_flashData.PredTextSelected) | |
780 { | |
781 if (ATB_edit_CapitaliseWord(data->editor)) /* Word is capitalised */ | |
782 string.data = (UBYTE *)ED_IND_CAPS; | |
783 else | |
784 string.data = (UBYTE *)ED_IND_LOWER; | |
785 string.len = ATB_string_Length(&string); | |
786 | |
787 if(data->predText.len!=0) | |
788 { | |
789 title.data = data->predText.data; | |
790 title.len = data->predText.len; | |
791 title.dcs = data->predText.dcs; | |
792 } | |
793 } | |
794 #endif | |
795 if (ATB_edit_Mode(editor, ED_MODE_ALPHA) && title.len==0) | |
796 { | |
797 /* SPR#1995 - SH - 'size' includes null terminator, so | |
798 * remaining characters is size-1 */ | |
799 #ifdef LSCREEN | |
800 sprintf(lengthIndC, "%d/%d", textLen, editor->attr->size-1); | |
801 #else | |
802 sprintf(lengthIndC, "%d", editor->attr->size-textLen-1); | |
803 #endif | |
804 | |
805 title.data = (UBYTE *)lengthIndC; | |
806 title.len = ATB_string_Length(&title); | |
807 } | |
808 } | |
809 | |
810 /* Draw the string to the right of the editor - the case/format indicator, and icons (if appropriate) */ | |
811 | |
812 stringWidth = 0; | |
813 stringHeight = 0; | |
814 showIcons = FALSE; | |
815 | |
816 if (string.len) | |
817 { | |
818 TRACE_EVENT("Displaying string on right"); | |
819 ATB_display_SetFormatAttr(&format, 0, FALSE); /* Set format to format at cursor */ | |
820 stringWidth = ATB_display_StringWidth(&string, &format)+2; | |
821 stringHeight = ATB_display_StringHeight(&string, &format); | |
822 ATB_display_Text(SCREEN_SIZE_X-stringWidth+2,0, &format, &string); | |
823 showIcons = TRUE; /* If showing case, show icons */ | |
824 } | |
825 | |
826 #ifdef EASY_TEXT_ENABLED | |
827 /* Display ezitext icon to the left of the case indicator */ | |
828 | |
829 if(ATB_edit_Mode(editor, ED_MODE_PREDTEXT) && FFS_flashData.PredTextSelected == TRUE) | |
830 { | |
831 if (data->predText.len==0) // Show icons only if there's no predicted text entry currently | |
832 showIcons = TRUE; | |
833 else | |
834 showIcons = FALSE; | |
835 } | |
836 #endif | |
837 | |
838 /* Show icons to the left of the case indicator */ | |
839 | |
840 if (showIcons) | |
841 { | |
842 | |
843 #ifdef EASY_TEXT_ENABLED | |
844 /* Display ezitext icon to the left of the case indicator */ | |
845 if(ATB_edit_Mode(editor, ED_MODE_PREDTEXT) && FFS_flashData.PredTextSelected == TRUE) | |
846 { | |
847 stringWidth += 8; | |
848 dspl_BitBlt(SCREEN_SIZE_X-stringWidth+2, | |
849 0,8,8,0,(char*)TextIconeZiTextSmall,0); | |
850 } | |
851 #endif | |
852 | |
853 if (stringHeight<Mmi_layout_line_height()) | |
854 stringHeight = Mmi_layout_line_height(); | |
855 } | |
856 | |
857 | |
858 /* Draw the string to the left of the screen - the editor title, or the number of characters | |
859 * remaining free in the buffer, or the predicted text word. */ | |
860 | |
861 titleWidth = 0; | |
862 titleHeight = 0; | |
863 | |
864 if (title.len) | |
865 { | |
866 ATB_display_SetFormatAttr(&format, 0, FALSE); /* Clear format */ | |
867 | |
868 titleWidth = ATB_display_StringWidth(&title, &format)+2; | |
869 titleHeight = ATB_display_StringHeight(&title, &format); | |
870 | |
871 /* Check to see if title fits into top line - if it doesn't, | |
872 * we will need display a section of it. */ | |
873 | |
874 if (titleWidth>(SCREEN_SIZE_X-stringWidth-2)) | |
875 { | |
876 /* Create timer if it doesn't exist */ | |
877 | |
878 if (!data->title_timer) | |
879 { | |
880 data->title_timer = tim_create(data->win, 3000, (T_MFW_CB)AUI_edit_TitleTimerCb); | |
881 data->title_pos = 0; | |
882 data->title_next_pos = 0; | |
883 tim_start(data->title_timer); | |
884 } | |
885 | |
886 titleWidth = 0; | |
887 textIndex = data->title_pos; | |
888 lastSpace = 0; | |
889 | |
890 while (titleWidth<(SCREEN_SIZE_X-stringWidth-2) && textIndex<title.len) | |
891 { | |
892 character = ATB_string_GetChar(&title, textIndex); | |
893 titleWidth+=ATB_display_GetCharWidth(character, &format); | |
894 textIndex++; | |
895 if (character==UNICODE_SPACE) | |
896 lastSpace = textIndex; | |
897 } | |
898 | |
899 TRACE_EVENT_P1("Characters that fit: %d", textIndex); | |
900 | |
901 /* Calculate next start position */ | |
902 | |
903 if (textIndex==title.len) | |
904 data->title_next_pos = 0; | |
905 else | |
906 { | |
907 /* Word wrap to last space, if there was one */ | |
908 | |
909 if (lastSpace>0) | |
910 textIndex = lastSpace; | |
911 data->title_next_pos = textIndex; | |
912 } | |
913 | |
914 TRACE_EVENT_P1("Next position: %d", data->title_next_pos); | |
915 | |
916 newTitle.len = textIndex-data->title_pos; | |
917 newTitle.data = (UBYTE *)ALLOC_MEMORY((newTitle.len+1)*ATB_string_Size(&title)); | |
918 newTitle.dcs = title.dcs; | |
919 | |
920 for (textIndex=0; textIndex<newTitle.len; textIndex++) | |
921 { | |
922 ATB_string_SetChar(&newTitle, textIndex, ATB_string_GetChar(&title, data->title_pos+textIndex)); | |
923 } | |
924 ATB_string_SetChar(&newTitle, newTitle.len, UNICODE_EOLN); | |
925 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
926 #ifdef FF_MMI_SAT_ICON | |
927 /* Check if the icon is self-explanatory, GSM 11.14, Sec 6.5.4, 12.32. | |
928 If the icon is to displayed, move the text by icon width. */ | |
929 if (editor->attr->TitleIcon.selfExplanatory == FALSE) | |
930 ATB_display_Text(titleIconWidth+1,0,&format, &newTitle); | |
931 #else | |
932 ATB_display_Text(0,0,&format, &newTitle); | |
933 #endif | |
934 FREE_MEMORY((UBYTE *)newTitle.data, (newTitle.len+1)*ATB_string_Size(&title)); | |
935 } | |
936 else | |
937 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
938 #ifdef FF_MMI_SAT_ICON | |
939 { | |
940 /* Check if the icon is self-explanatory, GSM 11.14, Sec 6.5.4, 12.32. | |
941 If the icon is to displayed, move the text by icon width. */ | |
942 if (editor->attr->TitleIcon.selfExplanatory == FALSE) | |
943 ATB_display_Text(titleIconWidth+1,0,&format, &title); | |
944 } | |
945 #else | |
946 ATB_display_Text(0,0,&format, &title); | |
947 #endif | |
948 | |
949 #ifdef EASY_TEXT_ENABLED | |
950 /* Provides a cursor in the predicted word, so the user can tell which of the characters | |
951 * entered are being used to select the word. */ | |
952 | |
953 if(ATB_edit_Mode(editor, ED_MODE_PREDTEXT) && FFS_flashData.PredTextSelected && data->predText.len!=0) | |
954 { | |
955 ATB_display_Cursor(&data->predText, data->predTextChar.pos, ED_CURSOR_BLOCK, | |
956 data->predTextChar.lineWidth, 0, data->predTextChar.width, data->predTextChar.height); | |
957 } | |
958 #endif | |
959 } | |
960 | |
961 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
962 #ifdef FF_MMI_SAT_ICON | |
963 if(editor->attr->TitleIcon.data != NULL) | |
964 { | |
965 | |
966 if (titleHeight == 0) | |
967 titleHeight = TITLE_ICON_HEIGHT; | |
968 | |
969 /* Display '?' icon if the size is bigger, | |
970 else display the icon*/ | |
971 if ((editor->attr->TitleIcon.width > TITLE_ICON_WIDTH) || (editor->attr->TitleIcon.height > TITLE_ICON_HEIGHT)) | |
972 { | |
973 /* iconY calculates place hoilder to place the icon | |
974 at the center of the screen. */ | |
975 iconX = 1; | |
976 iconY = 1+ ((titleHeight-2) / 2) - (10 / 2); | |
977 dspl_BitBlt2(iconX, iconY, 8, | |
978 10, (void*)SATIconQuestionMark, 0, BMP_FORMAT_256_COLOUR); | |
979 } | |
980 else | |
981 { | |
982 /* iconY calculates place hoilder to place the icon | |
983 at the center of the screen. */ | |
984 iconX = 1; | |
985 iconY = 1+ ((titleHeight-2) / 2) - (editor->attr->TitleIcon.height / 2); | |
986 dspl_BitBlt2(iconX, iconY, editor->attr->TitleIcon.width, editor->attr->TitleIcon.height, | |
987 (void*)editor->attr->TitleIcon.data, 0, BMP_FORMAT_256_COLOUR); | |
988 } | |
989 } | |
990 #endif | |
991 | |
992 /* Draw line on top */ | |
993 | |
994 if (stringHeight>titleHeight) | |
995 titleHeight = stringHeight; | |
996 | |
997 /* Non colour display - draw line between title texts*/ | |
998 #ifndef LSCREEN | |
999 if (titleHeight>0) | |
1000 { | |
1001 if (stringWidth==0) | |
1002 stringWidth = 1; /* Make sure end of line is on-screen */ | |
1003 dspl_DrawLine(titleWidth, titleHeight/2, SCREEN_SIZE_X-stringWidth, titleHeight/2); /* Line between title & indicator */ | |
1004 } | |
1005 #endif | |
1006 } | |
1007 | |
1008 /* SCROLLBAR */ | |
1009 | |
1010 if (data->editor_data.zone_id & ZONE_SCROLLBAR) | |
1011 { | |
1012 dspl_Clear(editX+editWidth, editY, editX+editWidth+ED_SCROLLBAR_WIDTH-1, editY+editHeight-1); | |
1013 | |
1014 /* Vertical scrollbar - only show if editor is taller than view size */ | |
1015 | |
1016 if (editor->totalHeight > 0 && editor->viewHeight<editor->totalHeight) | |
1017 { | |
1018 dspl_DrawLine(editX+editWidth, editY, editX+editWidth, editY+editHeight-1); | |
1019 scrollBarSize = editor->viewHeight * editHeight / editor->totalHeight; | |
1020 if (scrollBarSize>editHeight) | |
1021 scrollBarSize = editHeight; | |
1022 scrollBarPos = editor->viewStartPos * editHeight / editor->totalHeight; | |
1023 | |
1024 dspl_DrawLine(editX+editWidth+1, editY+scrollBarPos, editX+editWidth+1, | |
1025 editY+scrollBarPos+scrollBarSize); | |
1026 dspl_DrawLine(editX+editWidth+2, editY+scrollBarPos, editX+editWidth+2, | |
1027 editY+scrollBarPos+scrollBarSize); | |
1028 } | |
1029 } | |
1030 | |
1031 /* SOFTKEYS */ | |
1032 | |
1033 if (data->editor_data.zone_id & ZONE_SOFTKEYS) | |
1034 { | |
1035 #ifdef EASY_TEXT_ENABLED | |
1036 /* If a word is being entered, display OK and Delete */ | |
1037 | |
1038 if (ATB_edit_Mode(data->editor, ED_MODE_PREDTEXT) && data->predText.len!=0 && FFS_flashData.PredTextSelected == TRUE) | |
1039 { | |
1040 leftSK = TxtSoftOK; | |
1041 rightSK = TxtDelete; | |
1042 } | |
1043 else | |
1044 #endif | |
1045 { | |
1046 /* Entered less than the required number of chars: Alternate Left Softkey appears */ | |
1047 if (textLen < data->editor_data.min_enter) | |
1048 { | |
1049 leftSK = data->editor_data.AltLeftSoftKey; | |
1050 } | |
1051 else | |
1052 { | |
1053 leftSK = data->editor_data.LeftSoftKey; | |
1054 } | |
1055 /* Buffer is empty and alternative rsk enabled: alternative rsk appears */ | |
1056 if (textLen==0 && data->editor_data.change_rsk_on_empty) | |
1057 { | |
1058 rightSK = data->editor_data.AltRightSoftKey; | |
1059 } | |
1060 else | |
1061 { | |
1062 rightSK = data->editor_data.RightSoftKey; | |
1063 } | |
1064 } | |
1065 displaySoftKeys(leftSK, rightSK); | |
1066 } | |
1067 | |
1068 /* Finished drawing screen */ | |
1069 } | |
1070 break; | |
1071 | |
1072 default: | |
1073 return MFW_EVENT_PASSED; | |
1074 // break; // RAVI | |
1075 } | |
1076 | |
1077 data->editor->update = ED_UPDATE_DEFAULT; | |
1078 | |
1079 return MFW_EVENT_CONSUMED; | |
1080 } | |
1081 | |
1082 | |
1083 /******************************************************************************* | |
1084 | |
1085 $Function: AUI_edit_KbdCb | |
1086 | |
1087 $Description: Editor keyboard event handler | |
1088 | |
1089 $Returns: None. | |
1090 | |
1091 $Arguments: event - the keyboard event | |
1092 keyboard | |
1093 | |
1094 *******************************************************************************/ | |
1095 | |
1096 static int AUI_edit_KbdCb(T_MFW_EVENT event, T_MFW_KBD *keyboard) | |
1097 { | |
1098 T_MFW_HND win = mfw_parent (mfw_header()); | |
1099 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
1100 T_AUI_EDITOR_INFO *data = (T_AUI_EDITOR_INFO *)win_data->user; | |
1101 #if (BOARD != 61) | |
1102 T_ATB_TEXT *PredText = &data->predText; | |
1103 USHORT character; | |
1104 #endif | |
1105 ED_RES result; | |
1106 | |
1107 TRACE_FUNCTION("AUI_edit_KbdCb()"); | |
1108 | |
1109 /* Suppress unwanted long keypresses */ | |
1110 | |
1111 data->doNextLongPress = TRUE; /* next Key_long event is correct */ | |
1112 | |
1113 /* Restart the timer */ | |
1114 | |
1115 if (data->timer !=NULL) | |
1116 { | |
1117 tim_stop(data->timer); | |
1118 tim_start(data->timer); | |
1119 } | |
1120 | |
1121 #ifdef EASY_TEXT_ENABLED | |
1122 if (FFS_flashData.PredTextSelected==FALSE || !ATB_edit_Mode(data->editor, ED_MODE_PREDTEXT)) | |
1123 { | |
1124 /* Predictive text is off */ | |
1125 #endif | |
1126 | |
1127 switch (keyboard->code) | |
1128 { | |
1129 /* UP key */ | |
1130 | |
1131 case KCD_MNUUP: | |
1132 /* For DSample, up and down move cursor up and down a line in all modes */ | |
1133 #ifdef LSCREEN | |
1134 ATB_edit_MoveCursor(data->editor, ctrlUp, TRUE); | |
1135 | |
1136 /* For other samples, up and down move left and right when not in read only mode */ | |
1137 #else | |
1138 if (ATB_edit_Mode(data->editor, ED_MODE_READONLY)) /* Acts as up key in read-only mode */ | |
1139 { | |
1140 ATB_edit_MoveCursor(data->editor, ctrlUp, TRUE); | |
1141 } | |
1142 else | |
1143 { | |
1144 ATB_edit_MoveCursor(data->editor, ctrlRight, TRUE); | |
1145 } | |
1146 #endif | |
1147 data->editor->update = ED_UPDATE_TRIVIAL; /* This flag speeds up update */ | |
1148 win_show(data->win); | |
1149 break; | |
1150 | |
1151 /* DOWN key */ | |
1152 | |
1153 case KCD_MNUDOWN: | |
1154 /* For DSample, up and down move cursor up and down a line in all modes */ | |
1155 #ifdef LSCREEN | |
1156 ATB_edit_MoveCursor(data->editor, ctrlDown, TRUE); | |
1157 | |
1158 /* For other samples, up and down move left and right when not in read only mode */ | |
1159 #else | |
1160 if (ATB_edit_Mode(data->editor, ED_MODE_READONLY)) /* Act as down key in read-only mode */ | |
1161 { | |
1162 ATB_edit_MoveCursor(data->editor, ctrlDown, TRUE); | |
1163 } | |
1164 else | |
1165 { | |
1166 ATB_edit_MoveCursor(data->editor, ctrlLeft, TRUE); /* Otherwise, move cursor left */ | |
1167 } | |
1168 #endif | |
1169 data->editor->update = ED_UPDATE_TRIVIAL; /* This flag speeds up update - no change to text */ | |
1170 win_show(data->win); | |
1171 break; | |
1172 | |
1173 /* For DSample, left and right keys move cursor left and right */ | |
1174 #ifdef LSCREEN | |
1175 | |
1176 /* MENU LEFT */ | |
1177 | |
1178 case KCD_MNULEFT: | |
1179 ATB_edit_MoveCursor(data->editor, ctrlLeft, TRUE); /* Move cursor left */ | |
1180 data->editor->update = ED_UPDATE_TRIVIAL; /* This flag speeds up update - no change to text */ | |
1181 win_show(data->win); | |
1182 break; | |
1183 | |
1184 /* MENU RIGHT */ | |
1185 | |
1186 case KCD_MNURIGHT: | |
1187 ATB_edit_MoveCursor(data->editor, ctrlRight, TRUE); /* Move cursor right */ | |
1188 data->editor->update = ED_UPDATE_TRIVIAL; /* This flag speeds up update - no change to text */ | |
1189 win_show(data->win); | |
1190 break; | |
1191 #endif | |
1192 | |
1193 /* LEFT SOFT KEY */ | |
1194 | |
1195 case KCD_LEFT: | |
1196 if (data->editor_data.editor_attr.text.len < data->editor_data.min_enter) | |
1197 { | |
1198 /* Entered less than the required number of chars */ | |
1199 if (data->editor_data.AltLeftSoftKey!=TxtNull) | |
1200 { | |
1201 /* an alternate softkey is defined: execute it */ | |
1202 SEND_EVENT (win, E_ED_DEINIT, INFO_KCD_ALTERNATELEFT, NULL); | |
1203 } | |
1204 } | |
1205 else if (data->editor_data.LeftSoftKey!=TxtNull) | |
1206 { | |
1207 /* Left Softkey is enabled (and entered sufficient number of chars): execute it | |
1208 * get the orginal text back into the editor instead of the hide buffer ( only filled with '*') */ | |
1209 if (ATB_edit_Mode(data->editor, ED_MODE_HIDDEN)) | |
1210 { | |
1211 ATB_edit_HiddenExit(data->editor); | |
1212 } | |
1213 SEND_EVENT (win, E_ED_DEINIT, INFO_KCD_LEFT, NULL); | |
1214 } | |
1215 break; | |
1216 | |
1217 /* HANGUP key */ | |
1218 | |
1219 case KCD_HUP: | |
1220 if (data->editor_data.RightSoftKey NEQ TxtNull) /* Right softkey is enabled: execute it */ | |
1221 { | |
1222 SEND_EVENT (win, E_ED_DEINIT, INFO_KCD_HUP, NULL); /* Deinitialise the editor */ | |
1223 } | |
1224 break; | |
1225 | |
1226 /* SEND KEY */ | |
1227 | |
1228 case KCD_CALL: | |
1229 if (data->editor_data.editor_attr.text.len >= data->editor_data.min_enter) | |
1230 { | |
1231 /* Send this event to generate an MO call in SMS editor */ | |
1232 SEND_EVENT (win, E_ED_DEINIT, INFO_KCD_CALL, NULL); | |
1233 } | |
1234 break; | |
1235 | |
1236 /* RIGHT SOFT KEY */ | |
1237 | |
1238 case KCD_RIGHT: | |
1239 TRACE_EVENT("KCD_RIGHT"); | |
1240 if (ATB_edit_Mode(data->editor, ED_MODE_READONLY)) /* in read only mode, */ | |
1241 { | |
1242 TRACE_EVENT("SENDING DEINIT EVENT"); | |
1243 SEND_EVENT (win, E_ED_DEINIT, INFO_KCD_RIGHT, NULL); /* just deinitialise editor */ | |
1244 } | |
1245 else /* otherwise, RSK acts as clear key */ | |
1246 { | |
1247 /* If multitap is in progress, delete current character | |
1248 * rather than previous character */ | |
1249 | |
1250 if (data->editor->multitap) | |
1251 { | |
1252 AUI_entry_StopMultitap(data->entry_data); /* Cancel multitap */ | |
1253 result = ATB_edit_DeleteRight(data->editor, TRUE); /* SPR#2342 - SH */ | |
1254 } | |
1255 else | |
1256 { | |
1257 result = ATB_edit_DeleteLeft(data->editor, TRUE); /* SPR#2342 - SH */ | |
1258 } | |
1259 | |
1260 /* If we delete from first character in the editor, exit editor */ | |
1261 if (result==ED_DONE) | |
1262 { | |
1263 SEND_EVENT (win, E_ED_DEINIT, INFO_KCD_RIGHT, NULL); | |
1264 } | |
1265 else | |
1266 { | |
1267 win_show(data->win); | |
1268 } | |
1269 } | |
1270 break; | |
1271 | |
1272 /* Switch text mode: uppercase, lowercase */ | |
1273 case KCD_HASH: | |
1274 if (ATB_edit_Mode(data->editor, ED_MODE_ALPHA)) | |
1275 { | |
1276 // Jul 22,2004 CRR:21605 xrashmic - SASKEN | |
1277 // The user has explicitly changed the case. When | |
1278 // the editor becomes empty, we should not reset the | |
1279 // case to sentence case | |
1280 CaseChanged=TRUE; | |
1281 switch(ATB_edit_GetCase(data->editor)) | |
1282 { | |
1283 case ED_CASE_LOWER: | |
1284 // Jul 22,2004 CRR:21605 xrashmic - SASKEN | |
1285 // The user has changed the case to sentence case. | |
1286 // when the editor becomes empty, we have to reset | |
1287 // the case to sentence case. | |
1288 CaseChanged=FALSE; | |
1289 ATB_edit_SetCase(data->editor, ED_CASE_CAPS); | |
1290 break; | |
1291 case ED_CASE_CAPS: | |
1292 ATB_edit_SetCase(data->editor, ED_CASE_UPPER); | |
1293 break; | |
1294 case ED_CASE_UPPER: | |
1295 ATB_edit_SetCase(data->editor, ED_CASE_LOWER); | |
1296 | |
1297 /* If easy text selected, switch to it */ | |
1298 #ifdef EASY_TEXT_ENABLED | |
1299 if (ATB_edit_Mode(data->editor, ED_MODE_PREDTEXT) && FFS_flashData.PredTextAvailable) | |
1300 { | |
1301 FFS_flashData.PredTextSelected = TRUE; | |
1302 } | |
1303 #endif | |
1304 break; | |
1305 case ED_CASE_NUM: | |
1306 ATB_edit_SetCase(data->editor, ED_CASE_LOWER); | |
1307 break; | |
1308 } | |
1309 } | |
1310 else | |
1311 { | |
1312 /* SPR#1788 - SH - Forbid '#' entry in read only mode */ | |
1313 if (!ATB_edit_Mode(data->editor, ED_MODE_READONLY)) | |
1314 AUI_entry_EventKey(data->entry_data, event, keyboard); | |
1315 } | |
1316 | |
1317 win_show(data->win); | |
1318 break; | |
1319 | |
1320 case (KCD_STAR): | |
1321 /* If we're in apha mode and not in read-only mode, display the symbol screen */ | |
1322 if (ATB_edit_Mode(data->editor, ED_MODE_ALPHA) && !ATB_edit_Mode(data->editor, ED_MODE_READONLY)) | |
1323 { | |
1324 AUI_symbol_Start (data->win, E_ED_INSERT); | |
1325 } | |
1326 else | |
1327 { | |
1328 /* SPR#1788 - SH - Allow '*' to be entered in numeric mode */ | |
1329 if (!ATB_edit_Mode(data->editor, ED_MODE_READONLY)) | |
1330 AUI_entry_EventKey(data->entry_data, event, keyboard); | |
1331 } | |
1332 | |
1333 win_show(data->win); | |
1334 break; | |
1335 | |
1336 /* KEY ENTRY 0 - 9 */ | |
1337 | |
1338 case KCD_0: | |
1339 case KCD_1: | |
1340 case KCD_2: | |
1341 case KCD_3: | |
1342 case KCD_4: | |
1343 case KCD_5: | |
1344 case KCD_6: | |
1345 case KCD_7: | |
1346 case KCD_8: | |
1347 case KCD_9: | |
1348 if (!ATB_edit_Mode(data->editor, ED_MODE_READONLY)) | |
1349 { | |
1350 AUI_entry_EventKey(data->entry_data, event, keyboard); | |
1351 win_show(data->win); | |
1352 } | |
1353 break; | |
1354 } | |
1355 | |
1356 #ifdef EASY_TEXT_ENABLED | |
1357 } | |
1358 else | |
1359 | |
1360 /* Short key press in EasyText */ | |
1361 | |
1362 { | |
1363 if(FFS_flashData.PredTextAvailable == TRUE) | |
1364 { | |
1365 switch (keyboard->code) | |
1366 { | |
1367 case KCD_MNUUP: | |
1368 if(PredText->len==0) | |
1369 { | |
1370 #ifdef LSCREEN | |
1371 ATB_edit_MoveCursor(data->editor, ctrlUp, TRUE); | |
1372 | |
1373 /* For other samples, up and down move left and right when not in read only mode */ | |
1374 #else | |
1375 ATB_edit_MoveCursor(data->editor,ctrlRight, TRUE); | |
1376 #endif | |
1377 data->editor->update = ED_UPDATE_TRIVIAL; /* This flag speeds up update */ | |
1378 win_show(data->win); | |
1379 } | |
1380 break; | |
1381 | |
1382 case KCD_MNUDOWN: | |
1383 if(PredText->len==0) | |
1384 { | |
1385 #ifdef LSCREEN | |
1386 ATB_edit_MoveCursor(data->editor, ctrlDown, TRUE); | |
1387 | |
1388 /* For other samples, up and down move left and right when not in read only mode */ | |
1389 #else | |
1390 ATB_edit_MoveCursor(data->editor,ctrlLeft, TRUE); | |
1391 #endif | |
1392 data->editor->update = ED_UPDATE_TRIVIAL; /* This flag speeds up update */ | |
1393 win_show(data->win); | |
1394 } | |
1395 break; | |
1396 | |
1397 #ifdef LSCREEN | |
1398 case KCD_MNURIGHT: | |
1399 if(PredText->len==0) | |
1400 { | |
1401 ATB_edit_MoveCursor(data->editor, ctrlRight, TRUE); | |
1402 data->editor->update = ED_UPDATE_TRIVIAL; /* This flag speeds up update */ | |
1403 win_show(data->win); | |
1404 } | |
1405 break; | |
1406 | |
1407 case KCD_MNULEFT: | |
1408 if(PredText->len==0) | |
1409 { | |
1410 ATB_edit_MoveCursor(data->editor,ctrlLeft, TRUE); | |
1411 data->editor->update = ED_UPDATE_TRIVIAL; /* This flag speeds up update */ | |
1412 win_show(data->win); | |
1413 } | |
1414 break; | |
1415 #endif | |
1416 | |
1417 case KCD_LEFT: | |
1418 if(PredText->len==0) | |
1419 { | |
1420 if (data->editor_data.LeftSoftKey NEQ TxtNull) | |
1421 { | |
1422 SEND_EVENT (win, E_ED_DEINIT, INFO_KCD_LEFT, NULL); | |
1423 } | |
1424 } | |
1425 else | |
1426 { | |
1427 if ((data->editor_data.editor_attr.text.len + PredText->len) < data->editor_data.editor_attr.size) | |
1428 { | |
1429 if (ATB_string_GetChar(PredText,0)!=UNICODE_STAR) | |
1430 { | |
1431 /* Capitalise first letter of words and the letter 'I' */ | |
1432 | |
1433 if (ATB_edit_CapitaliseWord(data->editor) || (PredText->len==1 && ATB_string_GetChar(PredText, 0)==ATB_char_Unicode('i'))) | |
1434 { | |
1435 ATB_string_SetChar(PredText, 0, ATB_edit_FindCapital(ATB_string_GetChar(PredText, 0)));/*SPR1508*/ | |
1436 } | |
1437 character = ATB_edit_GetCursorChar(data->editor, -1); | |
1438 | |
1439 if ( character != UNICODE_SPACE && character != UNICODE_EOLN) | |
1440 { | |
1441 ATB_string_MoveRight(PredText,0,1,ED_PREDTEXT_MAX); | |
1442 ATB_string_SetChar(PredText, 0, UNICODE_SPACE); | |
1443 } | |
1444 ATB_edit_InsertString(data->editor,PredText); | |
1445 } | |
1446 } | |
1447 ResetDictSearch(); | |
1448 AUI_edit_ClearPredText(data); | |
1449 ATB_edit_SetCase(data->editor, ED_CASE_LOWER); | |
1450 win_show(data->win); | |
1451 } | |
1452 break; | |
1453 | |
1454 case KCD_HUP: | |
1455 if (data->editor_data.RightSoftKey NEQ TxtNull) /* Right softkey is enabled: execute it */ | |
1456 { | |
1457 SEND_EVENT (win, E_ED_DEINIT, INFO_KCD_HUP, NULL); | |
1458 } | |
1459 break; | |
1460 | |
1461 case KCD_RIGHT: | |
1462 if(PredText->len==0) | |
1463 { | |
1464 if(ATB_string_GetChar(&data->editor_data.editor_attr.text, 0)!=UNICODE_EOLN) | |
1465 { | |
1466 ATB_edit_Char(data->editor,ctrlBack,TRUE); | |
1467 win_show(data->win); | |
1468 } | |
1469 else | |
1470 { | |
1471 /* leave editor if buffer already empty */ | |
1472 SEND_EVENT (win, E_ED_DEINIT, INFO_KCD_RIGHT, NULL); | |
1473 } | |
1474 } | |
1475 else | |
1476 { | |
1477 if (PredText->len==1) | |
1478 { | |
1479 DictBackSpace((char *)data->predText.data); | |
1480 AUI_edit_ClearPredText(data); | |
1481 ATB_edit_SetCase(data->editor, ED_CASE_LOWER); | |
1482 } | |
1483 else | |
1484 { | |
1485 DictBackSpace((char *)data->predText.data); | |
1486 data->predTextChar.pos--; /* char deleted, move cursor pos back */ | |
1487 AUI_edit_CalcPredText(data); | |
1488 } | |
1489 win_show(data->win); | |
1490 } | |
1491 break; | |
1492 | |
1493 case KCD_2: | |
1494 case KCD_3: | |
1495 case KCD_4: | |
1496 case KCD_5: | |
1497 case KCD_6: | |
1498 case KCD_7: | |
1499 case KCD_8: | |
1500 case KCD_9: | |
1501 if (PredText->len==0) | |
1502 { | |
1503 AUI_edit_ClearPredText(data); | |
1504 } | |
1505 if (DictAlphaKeyPress(keyboard->code,(char *)PredText->data)) | |
1506 { | |
1507 PredText->len = ATB_string_Length(PredText); | |
1508 data->predTextChar.pos++; /* The keypress was used to find a word, advance cursor */ | |
1509 AUI_edit_CalcPredText(data); | |
1510 } | |
1511 win_show(data->win); | |
1512 break; | |
1513 | |
1514 case KCD_HASH: | |
1515 switch(ATB_edit_GetCase(data->editor)) | |
1516 { | |
1517 /* Press # once to switch into capitalise mode */ | |
1518 case ED_CASE_CAPS: | |
1519 ATB_edit_SetCase(data->editor, ED_CASE_LOWER); | |
1520 /* Switch out of easy text mode, if we're not entering a word */ | |
1521 if (PredText->len==0) | |
1522 { | |
1523 FFS_flashData.PredTextSelected = FALSE; | |
1524 } | |
1525 break; | |
1526 default: | |
1527 ATB_edit_SetCase(data->editor, ED_CASE_CAPS); | |
1528 break; | |
1529 } | |
1530 win_show(data->win); | |
1531 break; | |
1532 | |
1533 case KCD_STAR: | |
1534 if (PredText->len==0) | |
1535 { | |
1536 AUI_symbol_Start (data->win, E_ED_INSERT); | |
1537 } | |
1538 else | |
1539 { | |
1540 int i; | |
1541 MoreCandidates((char *)PredText->data, &i); | |
1542 AUI_edit_CalcPredText(data); | |
1543 win_show(data->win); | |
1544 } | |
1545 break; | |
1546 | |
1547 case KCD_0: | |
1548 case KCD_1: | |
1549 if (PredText->len!=0) | |
1550 { | |
1551 if ((data->editor_data.editor_attr.text.len + PredText->len) < MAX_MSG_LEN) | |
1552 { | |
1553 /* If char b4 cursor full stop/question/exclamation (or last char space and char b4 full stop) */ | |
1554 if (ATB_edit_CapitaliseWord(data->editor) || (PredText->len==1 && ATB_string_GetChar(PredText,0)==ATB_char_Unicode('i'))) | |
1555 ATB_string_SetChar(PredText, 0, ATB_edit_FindCapital(ATB_string_GetChar(PredText, 0)));/*SPR1508*/ | |
1556 | |
1557 /* Capitalise first letter of char. If char before cursor not space, insert space */ | |
1558 character = ATB_edit_GetCursorChar(data->editor, -1); | |
1559 | |
1560 if (ATB_string_GetChar(PredText, 0) != UNICODE_STAR) | |
1561 { | |
1562 if (keyboard->code == KCD_1) | |
1563 { | |
1564 /* Insert space at end of string */ | |
1565 ATB_string_SetChar(PredText, PredText->len, UNICODE_SPACE); | |
1566 PredText->len++; | |
1567 ATB_string_SetChar(PredText, PredText->len, UNICODE_EOLN); | |
1568 | |
1569 if ( character!=UNICODE_SPACE && character!=UNICODE_EOLN) | |
1570 { | |
1571 /* Insert space at start of string */ | |
1572 ATB_string_MoveRight(PredText, 0, 1, ED_PREDTEXT_MAX); | |
1573 ATB_string_SetChar(PredText, 0, UNICODE_SPACE); | |
1574 } | |
1575 } | |
1576 else | |
1577 { | |
1578 /* Insert space and full stop at end of string */ | |
1579 ATB_string_SetChar(PredText, PredText->len, UNICODE_FULLSTOP); | |
1580 PredText->len++; | |
1581 ATB_string_SetChar(PredText, PredText->len, UNICODE_SPACE); | |
1582 PredText->len++; | |
1583 ATB_string_SetChar(PredText, PredText->len, UNICODE_EOLN); | |
1584 | |
1585 if ( character!=UNICODE_SPACE && character!=UNICODE_EOLN) | |
1586 { | |
1587 /* Insert space at start of string */ | |
1588 ATB_string_MoveRight(PredText, 0, 1, ED_PREDTEXT_MAX); | |
1589 ATB_string_SetChar(PredText, 0, UNICODE_SPACE); | |
1590 } | |
1591 } | |
1592 ATB_edit_InsertString(data->editor, PredText); | |
1593 } | |
1594 } | |
1595 AUI_edit_ClearPredText(data); | |
1596 ResetDictSearch(); | |
1597 ATB_edit_SetCase(data->editor, ED_CASE_LOWER); | |
1598 win_show(data->win); | |
1599 } | |
1600 break; | |
1601 | |
1602 /* Any key */ | |
1603 | |
1604 default: | |
1605 if (!ATB_edit_Mode(data->editor, ED_MODE_READONLY)) /* ignore normal keys if in read-only mode */ | |
1606 { | |
1607 AUI_entry_EventKey(data->entry_data, event, keyboard); | |
1608 ATB_edit_Char(data->editor,ctrlBack,TRUE); | |
1609 win_show(data->win); | |
1610 } | |
1611 break; | |
1612 } | |
1613 } | |
1614 } | |
1615 #endif | |
1616 | |
1617 return MFW_EVENT_CONSUMED; | |
1618 } | |
1619 | |
1620 | |
1621 /******************************************************************************* | |
1622 | |
1623 $Function: AUI_edit_KbdLongCb | |
1624 | |
1625 $Description: Editor keyboard event handler for long keypresses | |
1626 | |
1627 $Returns: None. | |
1628 | |
1629 $Arguments: event - the keyboard event | |
1630 keyboard | |
1631 | |
1632 *******************************************************************************/ | |
1633 | |
1634 static int AUI_edit_KbdLongCb(T_MFW_EVENT event, T_MFW_KBD *keyboard) | |
1635 { | |
1636 T_MFW_HND win = mfw_parent (mfw_header()); | |
1637 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
1638 T_AUI_EDITOR_INFO *data = (T_AUI_EDITOR_INFO *)win_data->user; | |
1639 | |
1640 #if (BOARD != 61) | |
1641 T_ATB_TEXT *PredText = &data->predText; | |
1642 #endif | |
1643 | |
1644 ED_RES result; | |
1645 | |
1646 #ifdef TRACE_AUIEditor | |
1647 TRACE_FUNCTION("AUI_edit_KbdLongCb()"); | |
1648 #endif | |
1649 | |
1650 /* Suppress unwanted long keypresses */ | |
1651 | |
1652 if ( data->doNextLongPress ) | |
1653 data->doNextLongPress = FALSE; /* mark Key_long event as consumed but do current long press */ | |
1654 // Jul 29, 2004 REF: CRR:20892 xrashmic - SASKEN | |
1655 // Description: By Long press on Left/Right key at 'Message Editor' screen, | |
1656 // cursor not scrolling continuously | |
1657 // Fix: The continuous long press of a key was being ignored for all keys. | |
1658 // Now only for left and right keys this is handled. | |
1659 else if(!(keyboard->code==KCD_MNULEFT ||keyboard->code== KCD_MNURIGHT)) | |
1660 { | |
1661 return MFW_EVENT_CONSUMED; /* don't do current long press */ | |
1662 } | |
1663 | |
1664 /* Restart the timer */ | |
1665 | |
1666 if (data->timer !=NULL) | |
1667 { | |
1668 tim_stop(data->timer); | |
1669 tim_start(data->timer); | |
1670 } | |
1671 | |
1672 #ifdef EASY_TEXT_ENABLED | |
1673 if (FFS_flashData.PredTextSelected == FALSE || !ATB_edit_Mode(data->editor, ED_MODE_PREDTEXT)) { | |
1674 /* Predictive text is off */ | |
1675 #endif | |
1676 | |
1677 switch (keyboard->code) | |
1678 { | |
1679 // Jul 29, 2004 REF: CRR:20892 xrashmic - SASKEN | |
1680 // Description: By Long press on Left/Right key at 'Message Editor' screen, | |
1681 // cursor not scrolling continuously | |
1682 // Fix: The Long press of left/right key is now handled in AUI_edit_KbdLongCB. | |
1683 case KCD_MNULEFT: | |
1684 ATB_edit_MoveCursor(data->editor, ctrlLeft, TRUE); /* Move cursor left */ | |
1685 data->editor->update = ED_UPDATE_TRIVIAL; /* This flag speeds up update - no change to text */ | |
1686 win_show(data->win); | |
1687 break; | |
1688 case KCD_MNURIGHT: | |
1689 ATB_edit_MoveCursor(data->editor, ctrlRight, TRUE); /* Move cursor right */ | |
1690 data->editor->update = ED_UPDATE_TRIVIAL; /* This flag speeds up update - no change to text */ | |
1691 win_show(data->win); | |
1692 break; | |
1693 | |
1694 case KCD_RIGHT: | |
1695 result = ATB_edit_ClearAll(data->editor); /* Otherwise, clear the editor */ | |
1696 | |
1697 /* If buffer is empty, right soft key causes exit from editor */ | |
1698 if (result==ED_DONE) | |
1699 { | |
1700 SEND_EVENT (win, E_ED_DEINIT, INFO_KCD_RIGHT, NULL); | |
1701 } | |
1702 else | |
1703 { | |
1704 win_show(data->win); | |
1705 } | |
1706 break; | |
1707 | |
1708 /* KEY ENTRY 0 */ | |
1709 | |
1710 case KCD_0: | |
1711 /* Alpha mode: insert a '0' */ | |
1712 if (ATB_edit_Mode(data->editor, ED_MODE_ALPHA)) | |
1713 { | |
1714 if (keyboard->code<=KCD_HASH) | |
1715 { | |
1716 ATB_edit_DeleteLeft(data->editor, FALSE); /* SPR#2342 - SH */ | |
1717 AUI_entry_EditDigit(data->entry_data, keyboard->code); // enter the character, not multi-tap | |
1718 win_show(data->win); | |
1719 } | |
1720 } | |
1721 | |
1722 /* Number mode: insert a '+'*/ | |
1723 else if (!ATB_edit_Mode(data->editor, ED_MODE_READONLY)) /* ignore normal keys if in read-only mode */ | |
1724 { | |
1725 if (ATB_edit_Mode(data->editor, ED_MODE_HIDDEN)) /* in hidden mode do not allow entering of '+' */ | |
1726 { | |
1727 ATB_edit_DeleteLeft(data->editor, TRUE); /* remove the '0'. SPR#2342 - SH */ | |
1728 } | |
1729 else | |
1730 { | |
1731 ATB_edit_Char(data->editor,ctrlBack,FALSE); /* remove the '0' */ | |
1732 ATB_edit_Char(data->editor,UNICODE_PLUS,TRUE); /* insert the '+' */ | |
1733 } | |
1734 win_show(data->win); | |
1735 } | |
1736 break; | |
1737 case (KCD_STAR): | |
1738 /* MZ cq11414 add Pause Character */ | |
1739 ATB_edit_DeleteLeft(data->editor, FALSE); | |
1740 | |
1741 //Sep 2, 2004 REF: CRR 21370 xkundadu | |
1742 //Changed the long press of '*' key to display 'w' | |
1743 AUI_entry_EditChar(data->entry_data, ATB_char_Unicode('w'), FALSE); | |
1744 win_show(data->win); | |
1745 break; | |
1746 | |
1747 case (KCD_HASH): | |
1748 | |
1749 /* In alphanumeric mode, a long hold of # selects number case */ | |
1750 if (ATB_edit_GetCasePref(data->editor)==ED_CASEPREF_ALPHANUM) | |
1751 ATB_edit_SetCase(data->editor, ED_CASE_NUM); | |
1752 else | |
1753 { | |
1754 /* MZ cq11414 add Wait Character */ | |
1755 ATB_edit_DeleteLeft(data->editor, FALSE); | |
1756 | |
1757 //Sep 2, 2004 REF: CRR 21370 xkundadu | |
1758 //Changed the long press of '#' key to display 'p' | |
1759 AUI_entry_EditChar(data->entry_data, ATB_char_Unicode('p'), FALSE); | |
1760 } | |
1761 win_show(data->win); | |
1762 break; | |
1763 | |
1764 /* KEY ENTRY 1 - 9 */ | |
1765 | |
1766 case KCD_1: | |
1767 case KCD_2: | |
1768 case KCD_3: | |
1769 case KCD_4: | |
1770 case KCD_5: | |
1771 case KCD_6: | |
1772 case KCD_7: | |
1773 case KCD_8: | |
1774 case KCD_9: | |
1775 /* Insert equivalent numeric character, only possible in Alpha modes */ | |
1776 if (ATB_edit_Mode(data->editor, ED_MODE_ALPHA)) | |
1777 { | |
1778 if (keyboard->code<=KCD_HASH) | |
1779 { | |
1780 ATB_edit_DeleteLeft(data->editor, FALSE); /* SPR#2342 - SH */ | |
1781 AUI_entry_EditDigit(data->entry_data, keyboard->code); // enter the character, not multi-tap | |
1782 win_show(data->win); | |
1783 } | |
1784 } | |
1785 break; | |
1786 | |
1787 } | |
1788 | |
1789 #ifdef EASY_TEXT_ENABLED | |
1790 } | |
1791 else | |
1792 { | |
1793 if(FFS_flashData.PredTextAvailable == TRUE) | |
1794 { | |
1795 switch (keyboard->code) | |
1796 { | |
1797 // Jul 29, 2004 REF: CRR:20892 xrashmic - SASKEN | |
1798 // Description: By Long press on Left/Right key at 'Message Editor' | |
1799 // screen, cursor not scrolling continuously | |
1800 // Fix: The Long press of left/right key is now handled in | |
1801 // AUI_edit_KbdLongCB. | |
1802 case KCD_MNULEFT: | |
1803 ATB_edit_MoveCursor(data->editor, ctrlLeft, TRUE); /* Move cursor left */ | |
1804 data->editor->update = ED_UPDATE_TRIVIAL; /* This flag speeds up update - no change to text */ | |
1805 win_show(data->win); | |
1806 break; | |
1807 case KCD_MNURIGHT: | |
1808 ATB_edit_MoveCursor(data->editor, ctrlRight, TRUE); /* Move cursor right */ | |
1809 data->editor->update = ED_UPDATE_TRIVIAL; /* This flag speeds up update - no change to text */ | |
1810 win_show(data->win); | |
1811 break; | |
1812 | |
1813 case KCD_RIGHT: /*empty predictive text string */ | |
1814 if(PredText->len!=0) | |
1815 { | |
1816 PredText->len = 0; | |
1817 ATB_string_SetChar(PredText, 0, UNICODE_EOLN); | |
1818 ResetDictSearch(); | |
1819 win_show(data->win); | |
1820 } | |
1821 else /*empty whole editor */ | |
1822 { | |
1823 if(data->editor_data.editor_attr.text.len > 0 ) | |
1824 { | |
1825 ATB_edit_ClearAll(data->editor); | |
1826 win_show(data->win); | |
1827 } | |
1828 else | |
1829 { | |
1830 /* leave editor if buffer already empty */ | |
1831 SEND_EVENT (win, E_ED_DEINIT, INFO_KCD_RIGHT, NULL); | |
1832 } | |
1833 } | |
1834 break; | |
1835 | |
1836 case(KCD_STAR): | |
1837 AUI_symbol_Start(data->win, E_ED_INSERT); | |
1838 break; | |
1839 | |
1840 case (KCD_HASH): | |
1841 break; | |
1842 | |
1843 /* KEY ENTRY 1 - 9 */ | |
1844 | |
1845 case KCD_0: | |
1846 case KCD_1: | |
1847 case KCD_2: | |
1848 case KCD_3: | |
1849 case KCD_4: | |
1850 case KCD_5: | |
1851 case KCD_6: | |
1852 case KCD_7: | |
1853 case KCD_8: | |
1854 case KCD_9: | |
1855 if(PredText->len==0) | |
1856 { | |
1857 /* Insert equivalent numeric character, only possible in Alpha modes */ | |
1858 if (ATB_edit_Mode(data->editor, ED_MODE_ALPHA)) | |
1859 { | |
1860 if (keyboard->code<=KCD_HASH) | |
1861 { | |
1862 ATB_edit_DeleteLeft(data->editor, FALSE); /* SPR#2342 - SH */ | |
1863 AUI_entry_EditDigit(data->entry_data, keyboard->code); // enter the character, not multi-tap | |
1864 } | |
1865 } | |
1866 win_show(data->win); | |
1867 } | |
1868 break; | |
1869 } | |
1870 } | |
1871 } | |
1872 #endif | |
1873 | |
1874 return MFW_EVENT_CONSUMED; | |
1875 } | |
1876 | |
1877 | |
1878 /******************************************************************************* | |
1879 | |
1880 $Function: AUI_edit_TimerCb | |
1881 | |
1882 $Description: Callback function for the editor info timer. | |
1883 | |
1884 $Returns: None. | |
1885 | |
1886 $Arguments: event - the event type | |
1887 timer - the timer | |
1888 | |
1889 *******************************************************************************/ | |
1890 | |
1891 static int AUI_edit_TimerCb (T_MFW_EVENT event, T_MFW_TIM *timer) | |
1892 { | |
1893 T_MFW_HND win = mfw_parent (mfw_header()); | |
1894 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
1895 T_AUI_EDITOR_INFO *data = (T_AUI_EDITOR_INFO *)win_data->user; | |
1896 | |
1897 // T_MFW_HND parent_win = data->parent; // RAVI | |
1898 // USHORT Identifier = data->editor_data.Identifier; // RAVI | |
1899 // T_AUI_EDIT_CB Callback = data->editor_data.Callback; // RAVI | |
1900 | |
1901 TRACE_FUNCTION("AUI_edit_TimerCb"); | |
1902 | |
1903 #if 0 | |
1904 AUI_edit_Destroy(data->win); | |
1905 | |
1906 if (Callback) | |
1907 (Callback) (parent_win, Identifier, INFO_TIMEOUT); | |
1908 #else | |
1909 SEND_EVENT (win, E_ED_DEINIT, INFO_TIMEOUT, NULL); | |
1910 #endif | |
1911 | |
1912 return MFW_EVENT_CONSUMED; | |
1913 } | |
1914 | |
1915 /******************************************************************************* | |
1916 | |
1917 $Function: AUI_edit_TitleTimerCb | |
1918 | |
1919 $Description: Callback function for the editor title timer. Recalculates title_pos so that | |
1920 the next part of the string is displayed. | |
1921 | |
1922 $Returns: None. | |
1923 | |
1924 $Arguments: event - the event type | |
1925 timer - the timer | |
1926 | |
1927 *******************************************************************************/ | |
1928 | |
1929 static int AUI_edit_TitleTimerCb (T_MFW_EVENT event, T_MFW_TIM *timer) | |
1930 { | |
1931 /* Use the mfwHeader property of the timer to get the window */ | |
1932 T_MFW_HND win = mfw_parent(timer->mfwHeader); | |
1933 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
1934 T_AUI_EDITOR_INFO *data = (T_AUI_EDITOR_INFO *)win_data->user; | |
1935 | |
1936 TRACE_FUNCTION("AUI_edit_TitleTimerCb"); | |
1937 | |
1938 /* SPR#1597 - SH - Since there may be multiple timers running at once, only | |
1939 call win_show if the window is focussed. */ | |
1940 | |
1941 if (winIsFocussed(win)) | |
1942 { | |
1943 if (data->title_next_pos!=data->title_pos) | |
1944 { | |
1945 data->title_pos = data->title_next_pos; | |
1946 } | |
1947 | |
1948 data->editor->update = ED_UPDATE_PARTIAL; /* Don't update editor text */ | |
1949 win_show(data->win); | |
1950 | |
1951 tim_start(data->title_timer); | |
1952 } | |
1953 | |
1954 return MFW_EVENT_CONSUMED; | |
1955 } | |
1956 | |
1957 | |
1958 /******************************************************************************* | |
1959 | |
1960 $Function: AUI_edit_CalcPredText | |
1961 | |
1962 $Description: Calculate properties of predicted text string. | |
1963 | |
1964 $Returns: None. | |
1965 | |
1966 $Arguments: data - The AUI editor data | |
1967 | |
1968 *******************************************************************************/ | |
1969 | |
1970 static void AUI_edit_CalcPredText(T_AUI_EDITOR_INFO *data) | |
1971 { | |
1972 USHORT character; | |
1973 T_ATB_TEXT dummy; | |
1974 | |
1975 data->predText.len = ATB_string_Length(&data->predText); | |
1976 | |
1977 /* Get position of current entry */ | |
1978 dummy.data = data->predText.data; | |
1979 dummy.dcs = data->predText.dcs; | |
1980 dummy.len = data->predTextChar.pos; | |
1981 data->predTextChar.lineWidth = ATB_display_StringWidth(&dummy, &data->predTextChar.format); | |
1982 data->predTextChar.lineHeight = ATB_display_StringHeight(&dummy, &data->predTextChar.format); | |
1983 | |
1984 /* Get width and height of current character */ | |
1985 character = ATB_string_GetChar(&data->predText, data->predTextChar.pos); | |
1986 data->predTextChar.width = ATB_display_GetCharWidth(character, &data->predTextChar.format); | |
1987 data->predTextChar.height = ATB_display_GetCharHeight(character, &data->predTextChar.format); | |
1988 | |
1989 return; | |
1990 } | |
1991 | |
1992 | |
1993 /******************************************************************************* | |
1994 | |
1995 $Function: AUI_edit_ClearPredText | |
1996 | |
1997 $Description: Clear the predictive text buffer | |
1998 | |
1999 $Returns: None. | |
2000 | |
2001 $Arguments: data - The AUI editor data | |
2002 | |
2003 *******************************************************************************/ | |
2004 | |
2005 static void AUI_edit_ClearPredText(T_AUI_EDITOR_INFO *data) | |
2006 { | |
2007 data->predText.len = 0; | |
2008 ATB_string_SetChar(&data->predText,0,UNICODE_EOLN); | |
2009 memset(&data->predTextChar, 0, sizeof(T_ED_CHAR)); | |
2010 return; | |
2011 } | |
2012 | |
2013 | |
2014 /******************************************************************************* | |
2015 | |
2016 $Function: AUI_edit_InsertString | |
2017 | |
2018 $Description: Insert a string into the editor | |
2019 | |
2020 $Returns: Pointer to the editor's window. | |
2021 | |
2022 $Arguments: win - The editor window | |
2023 string - The string to insert | |
2024 dcs - The dcs of the string | |
2025 | |
2026 *******************************************************************************/ | |
2027 | |
2028 void AUI_edit_InsertString(T_MFW_HND win, UBYTE *string, T_ATB_DCS dcs) | |
2029 { | |
2030 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
2031 T_AUI_EDITOR_INFO *data = (T_AUI_EDITOR_INFO *)win_data->user; | |
2032 T_ATB_TEXT text; | |
2033 | |
2034 text.data = string; | |
2035 text.dcs = dcs; | |
2036 text.len = ATB_string_Length(&text); | |
2037 | |
2038 ATB_edit_InsertString(data->editor, &text); | |
2039 | |
2040 return; | |
2041 } | |
2042 | |
2043 | |
2044 /******************************************************************************* | |
2045 | |
2046 $Function: AUI_edit_InsertChar | |
2047 | |
2048 $Description: Insert a character into the editor | |
2049 | |
2050 $Returns: Pointer to the editor's window. | |
2051 | |
2052 $Arguments: win - The editor window | |
2053 character - The character to insert | |
2054 | |
2055 *******************************************************************************/ | |
2056 | |
2057 void AUI_edit_InsertChar(T_MFW_HND win, USHORT character) | |
2058 { | |
2059 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
2060 T_AUI_EDITOR_INFO *data = (T_AUI_EDITOR_INFO *)win_data->user; | |
2061 | |
2062 ATB_edit_Char(data->editor, character, TRUE); | |
2063 | |
2064 return; | |
2065 } | |
2066 | |
2067 | |
2068 /******************************************************************************* | |
2069 | |
2070 $Function: AUI_edit_GetSpecificWindowSIze | |
2071 | |
2072 $Description: Sets up window size | |
2073 | |
2074 $Returns: None. | |
2075 | |
2076 $Arguments: attr - The ATB editor attributes | |
2077 zone_id - Specifies the window size (See ZONE_... in header file) | |
2078 | |
2079 *******************************************************************************/ | |
2080 #ifndef LSCREEN | |
2081 //Sizes defined for CSAMPLE editore | |
2082 #define BOOKDETAILS_EDITOR_SIZE 0, 0, SCREEN_SIZE_X-4, Mmi_layout_line(LAST_LINE_TOP) | |
2083 #define NUMBER_EDITOR_SIZE 0, 12, SCREEN_SIZE_X , MNU3LINE | |
2084 #define PHONEBOOK_DLG_EDITOR_SIZE 4, Mmi_layout_line(3)+2, SCREEN_SIZE_X-4, SCREEN_SIZE_Y-(Mmi_layout_line(3)+2) | |
2085 #define BOOKSDN_EDITOR_SIZE 34, Mmi_layout_line(3)+2, 50, Mmi_layout_line(1)+2 | |
2086 | |
2087 //MMIbooksearchwindow | |
2088 //#define BOOKSEARCH_EDITOR_SIZE 0, Mmi_layout_line(SECOND_LAST_LINE_TOP), SCREEN_SIZE_X, Mmi_layout_line(1) | |
2089 | |
2090 //MMICall | |
2091 #define CALL_EDITOR_SIZE 4,28,SCREEN_SIZE_X-4, 20 | |
2092 #define CALLSCRATCHPAD_EDITOR_SIZE 6, Mmi_layout_line(2),SCREEN_SIZE_X-6, 16 | |
2093 | |
2094 //MMIServices | |
2095 #define SERVICE_CREATE_EDITOR_SIZE 4,Mmi_layout_line(1)+2,SCREEN_SIZE_X-4, MNU3LINE | |
2096 #define PASSWORD_EDITOR_SIZE 0, 12, SCREEN_SIZE_X , 13 | |
2097 #define EM_EDITOR_SIZE 0, 0, SCREEN_SIZE_X-4, Mmi_layout_line(LAST_LINE_TOP) | |
2098 | |
2099 //From MMIIdle | |
2100 //GW Changed window height from 30 (27?) to 24. | |
2101 #define WIN_DIALLING_SIZE 0,Mmi_layout_line_icons(2), SCREEN_SIZE_X,24 | |
2102 #define WIN_DIALLING_C_SIZE 0,Mmi_layout_line_icons(1),SCREEN_SIZE_X,32 | |
2103 | |
2104 //Positions for editor windows in mmismssend | |
2105 #define PHNO_EDITOR_SIZE 0, (Mmi_layout_line(1)+2), SCREEN_SIZE_X, 20 | |
2106 | |
2107 //NB defines below used twice, second time START/SIZE_Y was same as START/SIZE_Y above | |
2108 #define CENTRE_EDITOR_SIZE 0, Mmi_layout_line(1), SCREEN_SIZE_X, MNU3LINE+3 | |
2109 | |
2110 //And for MMIServices - moved here from mmiservices.c | |
2111 #define SAT_EDITOR_SIZE 6,30,SCREEN_SIZE_X-6, 20 | |
2112 | |
2113 #define RPWD_EDITOR_SIZE 0,12,SCREEN_SIZE_X,13 | |
2114 | |
2115 //MMIBookCallDetails | |
2116 #define PHB_EDITOR_SIZE 4,0,SCREEN_SIZE_X-4, ALLBUT2LINE | |
2117 | |
2118 //MMIPins | |
2119 #define PIN_EDIT_RESET_SIZE 12,20,84-12,16 | |
2120 | |
2121 //MMITimeDate | |
2122 #define TIMEDATE_EDITOR_AREA_SIZE 0,10,70,10 | |
2123 #endif | |
2124 /* GW SPR#1840 26/03/03 - Copied from MMieditor.c*/ | |
2125 static void setSize(T_ATB_WIN_SIZE *win, int px, int py, int sx, int sy) | |
2126 { | |
2127 win->px = px; win->py = py; | |
2128 win->sx = sx; win->sy = sy; | |
2129 } | |
2130 | |
2131 void AUI_edit_GetSpecificWindowSize(T_ED_ATTR* attr, int zone_id ) | |
2132 { | |
2133 switch (zone_id) | |
2134 { | |
2135 case ZONE_SMALL_EDITOR: | |
2136 attr->win_size.px = 6; | |
2137 attr->win_size.py = Mmi_layout_IconHeight()*2; | |
2138 attr->win_size.sx = SCREEN_SIZE_X-attr->win_size.px; | |
2139 attr->win_size.sy = Mmi_layout_line_height()*2+4; | |
2140 break; | |
2141 | |
2142 case ZONE_BOTTOM_LINE: | |
2143 attr->win_size.px = 0; | |
2144 attr->win_size.py = SCREEN_SIZE_Y - Mmi_layout_line_height() - Mmi_layout_softkeyHeight(); | |
2145 attr->win_size.sx = SCREEN_SIZE_X-attr->win_size.px; | |
2146 attr->win_size.sy = Mmi_layout_line_height(); | |
2147 break; | |
2148 | |
2149 case ZONE_BOTTOM_LINE_FIND: //used for phonebook search | |
2150 attr->win_size.px = dspl_GetTextExtent(MmiRsrcGetText(TxtFind),0); | |
2151 attr->win_size.py = SCREEN_SIZE_Y - Mmi_layout_line_height() - Mmi_layout_softkeyHeight(); | |
2152 attr->win_size.sx = SCREEN_SIZE_X-attr->win_size.px; | |
2153 attr->win_size.sy = Mmi_layout_line_height(); | |
2154 break; | |
2155 | |
2156 #ifndef LSCREEN | |
2157 case BOOKDETAILS_EDITOR: setSize(&attr->win_size,BOOKDETAILS_EDITOR_SIZE); break; | |
2158 case NUMBER_EDITOR: setSize(&attr->win_size,NUMBER_EDITOR_SIZE); break; | |
2159 case PHONEBOOK_DLG_EDITOR: setSize(&attr->win_size,PHONEBOOK_DLG_EDITOR_SIZE); break; | |
2160 case BOOKSDN_EDITOR: setSize(&attr->win_size,BOOKSDN_EDITOR_SIZE); break; | |
2161 // case BOOKSEARCH_EDITOR: setSize(&attr->win_size,BOOKSEARCH_EDITOR_SIZE); break; | |
2162 case CALL_EDITOR: setSize(&attr->win_size,CALL_EDITOR_SIZE); break; | |
2163 case CALLSCRATCHPAD_EDITOR: setSize(&attr->win_size,CALLSCRATCHPAD_EDITOR_SIZE); break; | |
2164 case SERVICE_CREATE_EDITOR: setSize(&attr->win_size,SERVICE_CREATE_EDITOR_SIZE); break; | |
2165 case PASSWORD_EDITOR: setSize(&attr->win_size,PASSWORD_EDITOR_SIZE); break; | |
2166 case EM_CREATE_EDITOR: setSize(&attr->win_size,EM_EDITOR_SIZE); break;/*SPR#1840*/ | |
2167 | |
2168 case WIN_DIALLING: | |
2169 case WIN_DIALLING_CB: | |
2170 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
2171 setSize(&attr->win_size,WIN_DIALLING_C_SIZE); | |
2172 else | |
2173 setSize(&attr->win_size,WIN_DIALLING_SIZE); | |
2174 break; | |
2175 case WIN_DIALLING_SMS: | |
2176 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
2177 { | |
2178 setSize(&attr->win_size,0,Mmi_layout_line_icons(1),SCREEN_SIZE_X,24);/*SPR#1840*/ | |
2179 } | |
2180 else | |
2181 setSize(&attr->win_size,WIN_DIALLING_SIZE); | |
2182 break; | |
2183 case WIN_DIALLING_SAT: | |
2184 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
2185 setSize(&attr->win_size,WIN_DIALLING_C_SIZE); | |
2186 else | |
2187 setSize(&attr->win_size,WIN_DIALLING_SIZE); | |
2188 break; | |
2189 | |
2190 case PHNO_EDITOR: setSize(&attr->win_size,PHNO_EDITOR_SIZE); break; | |
2191 case CENTRE_EDITOR: setSize(&attr->win_size,CENTRE_EDITOR_SIZE); break; | |
2192 case SAT_EDITOR : setSize(&attr->win_size,SAT_EDITOR_SIZE); break; | |
2193 case RPWD_EDITOR: setSize(&attr->win_size,RPWD_EDITOR_SIZE); break; | |
2194 case PHB_EDITOR: setSize(&attr->win_size,PHB_EDITOR_SIZE); break; | |
2195 case PIN_EDIT_RESET: setSize(&attr->win_size,PIN_EDIT_RESET_SIZE); break; | |
2196 case TIMEDATE_EDITOR_AREA: setSize(&attr->win_size,TIMEDATE_EDITOR_AREA_SIZE); break; | |
2197 #endif | |
2198 default: | |
2199 break; | |
2200 } | |
2201 } | |
2202 | |
2203 /******************************************************************************* | |
2204 | |
2205 $Function: AUI_edit_CalculateWindow | |
2206 | |
2207 $Description: Sets up window size | |
2208 | |
2209 $Returns: None. | |
2210 | |
2211 $Arguments: attr - The ATB editor attributes | |
2212 zone_id - Specifies the window size (See ZONE_... in header file) | |
2213 SPR#1559 - SH - this is now a pointer to the zone_id, allowing | |
2214 the zone_id to be modified by this function | |
2215 | |
2216 *******************************************************************************/ | |
2217 | |
2218 void AUI_edit_CalculateWindow(T_ED_ATTR* attr, int *zone_id_pointer ) | |
2219 { | |
2220 int zone_id = *zone_id_pointer; | |
2221 | |
2222 attr->win_size.px = 0; | |
2223 attr->win_size.py = 0; | |
2224 attr->win_size.sx = SCREEN_SIZE_X; | |
2225 attr->win_size.sy = SCREEN_SIZE_Y; | |
2226 | |
2227 if (zone_id == ZONE_BORDER_EDITOR) | |
2228 { //Leave border on left/right of screen. | |
2229 attr->win_size.px = 4; | |
2230 attr->win_size.sx = attr->win_size.sx - 2*attr->win_size.px; | |
2231 zone_id = ZONE_FULLSOFTKEYS; | |
2232 *zone_id_pointer = zone_id; | |
2233 } | |
2234 else if ((zone_id != 0x0000) && ((zone_id &0xF000)==0xF000))/*SPR#1840*/ | |
2235 { | |
2236 AUI_edit_GetSpecificWindowSize(attr,zone_id); | |
2237 return; | |
2238 } | |
2239 else if (zone_id == 0) | |
2240 { | |
2241 zone_id = ZONE_FULLSOFTKEYS; | |
2242 *zone_id_pointer = zone_id; | |
2243 } | |
2244 | |
2245 if (zone_id & ZONE_ICONS) | |
2246 attr->win_size.py = attr->win_size.py + Mmi_layout_IconHeight(); | |
2247 | |
2248 if (zone_id & ZONE_SOFTKEYS) | |
2249 attr->win_size.sy = attr->win_size.sy - Mmi_layout_softkeyHeight(); | |
2250 | |
2251 if (zone_id & ZONE_TITLE) | |
2252 attr->win_size.py = attr->win_size.py + Mmi_layout_TitleHeight(); | |
2253 | |
2254 if (zone_id & ZONE_CASE_ABC) | |
2255 attr->win_size.sy = attr->win_size.sy - Mmi_layout_line_height(); | |
2256 | |
2257 if (zone_id & ZONE_SCROLLBAR) | |
2258 attr->win_size.sx = attr->win_size.sx - ED_SCROLLBAR_WIDTH; | |
2259 | |
2260 attr->win_size.sy = attr->win_size.sy - attr->win_size.py; | |
2261 | |
2262 if ((zone_id & ZONE_FULLSCREEN) == ZONE_FULLSCREEN) | |
2263 return; | |
2264 | |
2265 /*Else window is not entire screen */ | |
2266 | |
2267 switch (zone_id & ZONE_FULL_HEIGHT) | |
2268 { | |
2269 case ZONE_FULL_HEIGHT: | |
2270 break; | |
2271 case ZONE_TOPHALF_HEIGHT: | |
2272 attr->win_size.sy = attr->win_size.sy/2; | |
2273 break; | |
2274 case ZONE_MIDDLE_HEIGHT: | |
2275 attr->win_size.sy = attr->win_size.sy/2; | |
2276 attr->win_size.py = attr->win_size.py+attr->win_size.sy/2; | |
2277 break; | |
2278 case ZONE_BOTTOMHALF_HEIGHT: | |
2279 attr->win_size.sy = attr->win_size.sy/2; | |
2280 attr->win_size.py = attr->win_size.py+attr->win_size.sy; | |
2281 break; | |
2282 case ZONE_BOTTOMTWOLINES_HEIGHT: | |
2283 attr->win_size.py = attr->win_size.py+attr->win_size.sy-Mmi_layout_line_height()*2; | |
2284 attr->win_size.sy = Mmi_layout_line_height()*2; | |
2285 break; | |
2286 default: | |
2287 //No action | |
2288 break; | |
2289 } | |
2290 | |
2291 switch (zone_id & ZONE_FULL_WIDTH) | |
2292 { | |
2293 case ZONE_FULL_WIDTH: | |
2294 break; | |
2295 case ZONE_LEFTHALF_WIDTH: | |
2296 attr->win_size.sx = attr->win_size.sx/2; | |
2297 break; | |
2298 case ZONE_MIDDLE_WIDTH : | |
2299 attr->win_size.sx = attr->win_size.sx/2; | |
2300 attr->win_size.px = attr->win_size.px+attr->win_size.sx/2; | |
2301 break; | |
2302 case ZONE_RIGHTHALF_WIDTH: | |
2303 attr->win_size.sx = attr->win_size.sx/2; | |
2304 attr->win_size.px = attr->win_size.px+attr->win_size.sx; | |
2305 break; | |
2306 default: | |
2307 //No action | |
2308 break; | |
2309 } | |
2310 } | |
2311 | |
2312 | |
2313 /******************************************************************************* | |
2314 | |
2315 $Function: AUI_edit_SetDefault | |
2316 | |
2317 $Description: Sets up standard editor attributes. | |
2318 | |
2319 $Returns: None. | |
2320 | |
2321 $Arguments: editor_data - The MMI editor data that is to be modified. | |
2322 | |
2323 *******************************************************************************/ | |
2324 | |
2325 void AUI_edit_SetDefault(T_AUI_EDITOR_DATA *editor_data) | |
2326 { | |
2327 /* Set everything to zero... */ | |
2328 /* SPR#1559 - Move CalculateWindow to below */ | |
2329 | |
2330 memset(editor_data, 0, sizeof(T_AUI_EDITOR_DATA)); | |
2331 | |
2332 /* Except these things... */ | |
2333 | |
2334 editor_data->editor_attr.colour = COLOUR_EDITOR; | |
2335 editor_data->editor_attr.font = EDITOR_FONT; | |
2336 editor_data->editor_attr.cursor = ED_CURSOR_BAR; | |
2337 editor_data->editor_attr.mode = ED_MODE_ALPHA; | |
2338 editor_data->editor_attr.text.dcs = ATB_DCS_ASCII; | |
2339 editor_data->timeout = FOREVER; | |
2340 editor_data->destroyEditor = TRUE; | |
2341 editor_data->zone_id = ZONE_FULL_SK_TITLE; | |
2342 | |
2343 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
2344 #ifdef FF_MMI_SAT_ICON | |
2345 editor_data->editor_attr.TitleIcon.data = NULL; | |
2346 editor_data->editor_attr.TitleIcon.width = 0; | |
2347 editor_data->editor_attr.TitleIcon.height = 0; | |
2348 editor_data->editor_attr.TitleIcon.isTitle = FALSE; | |
2349 //x0035544 Mar 14, 2006 DR:OMAPS00061468 | |
2350 //set the default value for display_type to SAT_ICON_NONE | |
2351 editor_data->editor_attr.TitleIcon.display_type = SAT_ICON_NONE; | |
2352 editor_data->editor_attr.TitleIcon.selfExplanatory = FALSE; | |
2353 #endif | |
2354 | |
2355 /* SPR#1559 - SH - CalculateWindow moved here; pointer to zone_id used */ | |
2356 AUI_edit_CalculateWindow(&editor_data->editor_attr, &editor_data->zone_id); | |
2357 | |
2358 ATB_display_ClearFormat(&editor_data->editor_attr.startFormat); | |
2359 return; | |
2360 } | |
2361 | |
2362 | |
2363 /******************************************************************************* | |
2364 | |
2365 $Function: AUI_edit_SetDisplay | |
2366 | |
2367 $Description: Sets up standard editor attributes. | |
2368 | |
2369 $Returns: None. | |
2370 | |
2371 $Arguments: editor_data - The MMI editor data that is to be modified. | |
2372 zone_id - Type of editor screen (see header file for ZONE_...) | |
2373 colour - Colour of the editor | |
2374 | |
2375 *******************************************************************************/ | |
2376 | |
2377 void AUI_edit_SetDisplay(T_AUI_EDITOR_DATA *editor_data, int zone_id, int colour, UBYTE font ) | |
2378 { | |
2379 /* SPR#1559 - SH - Use pointer to zone_id */ | |
2380 AUI_edit_CalculateWindow(&editor_data->editor_attr, &zone_id); | |
2381 editor_data->zone_id = zone_id; | |
2382 editor_data->editor_attr.colour = colour; | |
2383 editor_data->editor_attr.font = font; | |
2384 | |
2385 return; | |
2386 } | |
2387 | |
2388 /******************************************************************************* | |
2389 | |
2390 $Function: AUI_edit_SetEvents | |
2391 | |
2392 $Description: Sets up standard editor attributes. | |
2393 | |
2394 $Returns: None. | |
2395 | |
2396 $Arguments: editor_data - The MMI editor data that is to be modified. | |
2397 | |
2398 *******************************************************************************/ | |
2399 | |
2400 void AUI_edit_SetEvents(T_AUI_EDITOR_DATA *editor_data, USHORT Identifier, BOOL destroyEditor, ULONG timeout, T_AUI_EDIT_CB Callback) | |
2401 { | |
2402 if (editor_data) | |
2403 { | |
2404 editor_data->Identifier = Identifier; | |
2405 editor_data->destroyEditor = destroyEditor; | |
2406 editor_data->timeout = timeout; | |
2407 editor_data->Callback = Callback; | |
2408 } | |
2409 return; | |
2410 } | |
2411 | |
2412 | |
2413 /******************************************************************************* | |
2414 | |
2415 $Function: AUI_edit_SetMode | |
2416 | |
2417 $Description: Sets up standard editor attributes. | |
2418 | |
2419 $Returns: None. | |
2420 | |
2421 $Arguments: editor_data - The MMI editor data that is to be modified. | |
2422 mode - Editor mode (see header file for ED_MODE_...) | |
2423 cursor - Editor cursor (see header file for ED_CURSOR_...) | |
2424 | |
2425 *******************************************************************************/ | |
2426 | |
2427 void AUI_edit_SetMode(T_AUI_EDITOR_DATA *editor_data, USHORT mode, USHORT cursor ) | |
2428 { | |
2429 if (editor_data) | |
2430 { | |
2431 editor_data->editor_attr.mode = mode; | |
2432 editor_data->editor_attr.cursor = cursor; | |
2433 } | |
2434 | |
2435 return; | |
2436 } | |
2437 | |
2438 /******************************************************************************* | |
2439 | |
2440 $Function: AUI_edit_SetBuffer | |
2441 | |
2442 $Description: Sets up standard editor attributes. | |
2443 | |
2444 $Returns: None. | |
2445 | |
2446 $Arguments: editor_data - The MMI editor data that is to be modified. | |
2447 dcs - Data coding scheme of text (see ATB_DCS_...) | |
2448 text - The text in the appropriate coding scheme | |
2449 size - Maximum size of the edit buffer in characters | |
2450 | |
2451 *******************************************************************************/ | |
2452 | |
2453 void AUI_edit_SetBuffer(T_AUI_EDITOR_DATA *editor_data, UBYTE dcs, UBYTE *text, USHORT size) | |
2454 { | |
2455 if (editor_data) | |
2456 { | |
2457 editor_data->editor_attr.text.dcs = dcs; | |
2458 editor_data->editor_attr.text.data = text; | |
2459 editor_data->editor_attr.text.len = ATB_string_Length(&editor_data->editor_attr.text); | |
2460 editor_data->editor_attr.size = size; | |
2461 } | |
2462 | |
2463 return; | |
2464 } | |
2465 | |
2466 /******************************************************************************* | |
2467 | |
2468 $Function: AUI_edit_SetTextStr | |
2469 | |
2470 $Description: Sets up standard editor attributes. | |
2471 | |
2472 $Returns: None. | |
2473 | |
2474 $Arguments: editor_data - The MMI editor data that is to be modified. | |
2475 LeftSoftKey, RightSoftKey - Text IDs of the softkeys | |
2476 TitleId - Text ID for the title | |
2477 TextString - Text string for the title, used if TitleId is 0 | |
2478 | |
2479 *******************************************************************************/ | |
2480 | |
2481 void AUI_edit_SetTextStr(T_AUI_EDITOR_DATA *editor_data, USHORT LeftSoftKey, USHORT RightSoftKey, USHORT TitleId, UBYTE *TitleString) | |
2482 { | |
2483 if (editor_data) | |
2484 { | |
2485 editor_data->LeftSoftKey = LeftSoftKey; | |
2486 editor_data->RightSoftKey = RightSoftKey; | |
2487 editor_data->AltRightSoftKey = RightSoftKey; | |
2488 editor_data->TitleId = TitleId; | |
2489 editor_data->TitleString = TitleString; | |
2490 } | |
2491 | |
2492 return; | |
2493 } | |
2494 | |
2495 /******************************************************************************* | |
2496 | |
2497 $Function: AUI_edit_SetAltTextStr | |
2498 | |
2499 $Description: Sets up standard editor attributes. | |
2500 | |
2501 $Returns: None. | |
2502 | |
2503 $Arguments: editor_data - The MMI editor data that is to be modified. | |
2504 min_enter - No of characters needed to be entered | |
2505 AltLeftSoftKey - Text ID of alternate left softkey | |
2506 change_rsk_on_empty - TRUE if alternative right soft key is used for | |
2507 empty buffer | |
2508 AltRightSoftKey - Text ID of alternative right softkey | |
2509 | |
2510 *******************************************************************************/ | |
2511 | |
2512 void AUI_edit_SetAltTextStr(T_AUI_EDITOR_DATA *editor_data, UBYTE min_enter, USHORT AltLeftSoftKey, BOOL change_rsk_on_empty, USHORT AltRightSoftKey) | |
2513 { | |
2514 if (editor_data) | |
2515 { | |
2516 editor_data->AltLeftSoftKey = AltLeftSoftKey; | |
2517 editor_data->min_enter = min_enter; | |
2518 editor_data->AltRightSoftKey = AltRightSoftKey; | |
2519 editor_data->change_rsk_on_empty = change_rsk_on_empty; | |
2520 } | |
2521 | |
2522 return; | |
2523 } | |
2524 | |
2525 /******************************************************************************* | |
2526 | |
2527 $Function: AUI_edit_SetFormatStr | |
2528 | |
2529 $Description: Sets up standard editor attributes. | |
2530 | |
2531 $Returns: None. | |
2532 | |
2533 $Arguments: editor_data - The MMI editor data that is to be modified. | |
2534 formatstr - The formatted input string | |
2535 preformat - TRUE if format codes are to be inserted into text | |
2536 before editing | |
2537 filler - If preformat is true, this character will be used to | |
2538 pad out the provided string | |
2539 | |
2540 *******************************************************************************/ | |
2541 | |
2542 void AUI_edit_SetFormatStr(T_AUI_EDITOR_DATA *editor_data, char *formatstr, BOOL preformat, char filler) | |
2543 { | |
2544 USHORT textIndex; | |
2545 USHORT formatIndex; | |
2546 // USHORT character; // RAVI | |
2547 | |
2548 TRACE_FUNCTION("AUI_edit_SetFormatStr()"); | |
2549 | |
2550 if (editor_data) | |
2551 { | |
2552 editor_data->editor_attr.FormatString = formatstr; | |
2553 | |
2554 /* SPR#1983 - SH - *m and *M strings are freeform, no preformatting required */ | |
2555 if (preformat && strcmp(formatstr, "*m")!=0 && strcmp(formatstr, "*M")!=0) | |
2556 { | |
2557 formatIndex = 0; | |
2558 textIndex = 0; | |
2559 | |
2560 /* SPR#1983 - SH - Ensure formatting doesn't write over null terminator */ | |
2561 while (formatstr[formatIndex]!=0 && | |
2562 !strchr("123456789*", formatstr[formatIndex]) && /* Exit at delimited field */ | |
2563 textIndex<(editor_data->editor_attr.size-1)) | |
2564 { | |
2565 /* Encountered fixed character */ | |
2566 if (formatstr[formatIndex]=='\\') | |
2567 { | |
2568 formatIndex++; | |
2569 ATB_string_SetChar(&editor_data->editor_attr.text, textIndex, ATB_char_Unicode(formatstr[formatIndex])); | |
2570 } | |
2571 /* If editor text has run out, fill the rest with our filler character */ | |
2572 else if (textIndex>editor_data->editor_attr.text.len) | |
2573 { | |
2574 ATB_string_SetChar(&editor_data->editor_attr.text, textIndex, ATB_char_Unicode(filler)); | |
2575 } | |
2576 | |
2577 formatIndex++; | |
2578 textIndex++; | |
2579 } | |
2580 } | |
2581 } | |
2582 | |
2583 return; | |
2584 } | |
2585 | |
2586 /******************************************************************************* | |
2587 | |
2588 $Function: AUI_edit_SetFormatAttr | |
2589 | |
2590 $Description: Sets up standard editor attributes. | |
2591 | |
2592 $Returns: None. | |
2593 | |
2594 $Arguments: editor_data - The MMI editor data that is to be modified. | |
2595 startFormat - Pointer to text formatting data structure | |
2596 | |
2597 *******************************************************************************/ | |
2598 | |
2599 void AUI_edit_SetFormatAttr(T_AUI_EDITOR_DATA *editor_data, UBYTE attr) | |
2600 { | |
2601 if (editor_data) | |
2602 { | |
2603 editor_data->editor_attr.startFormat.attr = attr; | |
2604 } | |
2605 | |
2606 return; | |
2607 } | |
2608 | |
2609 /******************************************************************************* | |
2610 | |
2611 $Function: AUI_edit_SetAttr | |
2612 | |
2613 $Description: Set some standard editor attributes | |
2614 | |
2615 $Returns: None. | |
2616 | |
2617 $Arguments: attr - The editor attr | |
2618 | |
2619 *******************************************************************************/ | |
2620 void AUI_edit_SetAttr(T_ED_ATTR *attr, int zone_id, ULONG colour, UBYTE font, USHORT mode, USHORT cursor, T_ATB_DCS dcs, UBYTE *text, USHORT size) | |
2621 { | |
2622 /* Populate the structure with the parameters | |
2623 */ | |
2624 /* SPR#1559 - SH - Use pointer to zone_id */ | |
2625 AUI_edit_CalculateWindow(attr, &zone_id ); | |
2626 attr->colour = colour; | |
2627 attr->font = font; | |
2628 attr->mode = mode; | |
2629 attr->cursor = cursor; | |
2630 attr->text.dcs = dcs; | |
2631 attr->text.data = text; | |
2632 attr->text.len = ATB_string_Length(&attr->text); | |
2633 attr->size = size; | |
2634 | |
2635 return; | |
2636 } | |
2637 | |
2638 /* API - 08/07/03 - CQ10728 - Query your own number with a D1 SIM*/ | |
2639 /******************************************************************************* | |
2640 | |
2641 $Function: AUI_Edit_Display_Only | |
2642 | |
2643 $Description: Sets up the display requirements for the Editor & also shows it | |
2644 | |
2645 $Returns: None. | |
2646 | |
2647 $Arguments: win - parent window, LSK - Left Soft Key, RSK - Right Soft Key | |
2648 string1 - String details, string2 - String details, Title - Editor title string | |
2649 | |
2650 *******************************************************************************/ | |
2651 void AUI_Edit_Display_Only(T_MFW_HND win, int LSK, int RSK, char *string1, char *string2, int Title) | |
2652 { | |
2653 | |
2654 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
2655 T_AUI_EDITOR_INFO *data = (T_AUI_EDITOR_INFO *)win_data->user; | |
2656 | |
2657 T_AUI_EDITOR_DATA display_editor_info; | |
2658 | |
2659 int size = MAX_RO_EDITOR_LEN; | |
2660 | |
2661 AUI_edit_SetDefault(&display_editor_info); | |
2662 | |
2663 /* Include title for colour display */ | |
2664 #ifdef COLOURDISPLAY | |
2665 AUI_edit_SetDisplay(&display_editor_info, ZONE_FULL_SK_TITLE_SCROLL, COLOUR_EDITOR, EDITOR_FONT); | |
2666 #else /* COLOURDISPLAY */ | |
2667 AUI_edit_SetDisplay(&display_editor_info, ZONE_FULL_SK_SCROLL, COLOUR_EDITOR, EDITOR_FONT); | |
2668 #endif /* COLOURDISPLAY */ | |
2669 AUI_edit_SetMode(&display_editor_info, ED_MODE_ALPHA | ED_MODE_READONLY, ED_CURSOR_NONE); | |
2670 AUI_edit_SetEvents(&display_editor_info, 0, FALSE, FOREVER, (T_AUI_EDIT_CB) AUI_Edit_Display_Only_CB); | |
2671 AUI_edit_SetTextStr(&display_editor_info, LSK, RSK, Title, NULL); | |
2672 | |
2673 /* SPR#2672 - SH - Allocate buffer dynamically */ | |
2674 | |
2675 data->displayBuffer = (char *)ALLOC_MEMORY(size); | |
2676 | |
2677 strcpy(data->displayBuffer, string1); | |
2678 | |
2679 if(string2 != NULL) | |
2680 { | |
2681 strcat(data->displayBuffer, "\n"); | |
2682 strcat(data->displayBuffer, string2); | |
2683 } | |
2684 | |
2685 if (data->displayBuffer[0]==0x80) | |
2686 { | |
2687 AUI_edit_SetBuffer(&display_editor_info, ATB_DCS_UNICODE, (UBYTE *)&data->displayBuffer[2], size/2); | |
2688 } | |
2689 else | |
2690 { | |
2691 AUI_edit_SetBuffer(&display_editor_info, ATB_DCS_ASCII, (UBYTE *)&data->displayBuffer[0], size); | |
2692 } | |
2693 | |
2694 data->win = AUI_edit_Start(win,&display_editor_info); /* start the editor */ | |
2695 | |
2696 } | |
2697 | |
2698 /******************************************************************************* | |
2699 | |
2700 $Function: AUI_Edit_Display_Only_CB | |
2701 | |
2702 $Description: Handles the key call back from the Read only Editor | |
2703 | |
2704 $Returns: None. | |
2705 | |
2706 $Arguments: | |
2707 | |
2708 *******************************************************************************/ | |
2709 static void AUI_Edit_Display_Only_CB(T_MFW_HND win, USHORT Identifier, SHORT reason) | |
2710 { | |
2711 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
2712 T_AUI_EDITOR_INFO * data = (T_AUI_EDITOR_INFO *)win_data->user; | |
2713 | |
2714 TRACE_EVENT("AUI_Edit_Display_Only_CB"); | |
2715 | |
2716 switch(reason) | |
2717 { | |
2718 case INFO_KCD_RIGHT: | |
2719 case INFO_KCD_HUP: | |
2720 TRACE_EVENT("INFO_KCD_RIGHT/HUP"); | |
2721 AUI_Edit_Display_Only_Destroy(data->win); | |
2722 break; | |
2723 | |
2724 default: | |
2725 TRACE_EVENT("Err: Default"); | |
2726 break; | |
2727 | |
2728 } | |
2729 } | |
2730 | |
2731 /******************************************************************************* | |
2732 | |
2733 $Function: AUI_Edit_Display_Only_Destroy | |
2734 | |
2735 $Description: Destroy the Read only information Editor | |
2736 | |
2737 $Returns: none | |
2738 | |
2739 $Arguments: own_window - current window handler | |
2740 | |
2741 *******************************************************************************/ | |
2742 | |
2743 static void AUI_Edit_Display_Only_Destroy(MfwHnd own_window) | |
2744 { | |
2745 T_MFW_WIN * win_data; | |
2746 T_AUI_EDITOR_INFO * data; | |
2747 | |
2748 // USHORT i; // RAVI | |
2749 | |
2750 TRACE_FUNCTION ("SmsRead_R_TEXTEDT2_destroy()"); | |
2751 | |
2752 if (own_window) | |
2753 { | |
2754 win_data = ((T_MFW_HDR *)own_window)->data; | |
2755 data = (T_AUI_EDITOR_INFO *)win_data->user; | |
2756 | |
2757 if (data) | |
2758 { | |
2759 /* | |
2760 * Delete WIN handler | |
2761 */ | |
2762 | |
2763 /* SPR#2672 - SH - Delete buffer */ | |
2764 | |
2765 if (data->displayBuffer!=NULL) | |
2766 { | |
2767 FREE_MEMORY((void *)data->displayBuffer, MAX_RO_EDITOR_LEN); | |
2768 } | |
2769 | |
2770 /* SPR#1428 - SH - New Editor changes */ | |
2771 #ifdef NEW_EDITOR | |
2772 AUI_edit_Destroy(data->win); | |
2773 #else /* NEW_EDITOR */ | |
2774 editor_destroy(data->win); | |
2775 #endif /* NEW_EDITOR */ | |
2776 | |
2777 win_delete (data->win); | |
2778 | |
2779 FREE_MEMORY ((void *)data, sizeof (T_AUI_EDITOR_INFO)); | |
2780 | |
2781 | |
2782 } | |
2783 else | |
2784 { | |
2785 TRACE_EVENT ("SmsRead_R_TEXTEDT2_destroy() called twice"); | |
2786 } | |
2787 } | |
2788 } | |
2789 /* API - 08/07/03 - CQ10728 END*/ |