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