FreeCalypso > hg > fc-magnetite
comparison src/ui3/bmi/mmiDialogs.c @ 421:6a4d9f47793e
src/ui3/bmi: file renames to make the case consistent
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 21 Jan 2018 03:28:53 +0000 |
parents | src/ui3/bmi/MmiDialogs.c@e8ddbb0837ed |
children |
comparison
equal
deleted
inserted
replaced
420:e8ddbb0837ed | 421:6a4d9f47793e |
---|---|
1 | |
2 /******************************************************************************* | |
3 | |
4 CONDAT (UK) | |
5 | |
6 ******************************************************************************** | |
7 | |
8 This software product is the property of Condat (UK) Ltd and may not be | |
9 disclosed to any third party without the express permission of the owner. | |
10 | |
11 ******************************************************************************** | |
12 | |
13 $Project name: Basic MMI | |
14 $Project code: BMI (6349) | |
15 $Module: MmiDialogs | |
16 $File: MmiDialogs.c | |
17 $Revision: 1.0 | |
18 | |
19 $Author: Condat(UK) | |
20 $Date: 25/10/00 | |
21 | |
22 ******************************************************************************** | |
23 | |
24 Description:MMI Information dialogue handling. | |
25 | |
26 | |
27 | |
28 ******************************************************************************** | |
29 | |
30 $History: MmiDialogs.c | |
31 | |
32 May 23, 2007 DR: OMAPS00127483 x0pleela | |
33 Description: Phonelock - Unable to unlock the phone during incoming call with ringer... | |
34 Solution: Made changes in the function dialog_info_win_resize_cb() to restart the ringer set for | |
35 incoming call or alarm after thr phone is unlocked. | |
36 | |
37 Apr 03, 2007 ER: OMAPS00122561 x0pleela | |
38 Description: [ACI] Phone lock feature has to be supported by ACI | |
39 Solution: Phone Lock ER implementation | |
40 | |
41 x0066814 06 Dec 2006, OMAPS00106825 | |
42 The window height calculation related to wrapping should be skipped when no | |
43 string wrapping is done | |
44 | |
45 Mar 11, 2006 REF:DR:OMAPS00061467 x0035544 | |
46 Description: 27.22.4.13.3 SET UP CALL (display of icons) fails. | |
47 Solution: Assigned the default values for icon data for the structure display_info in the function | |
48 dlg_zeroDisplayData(). copied icon data in to the structure data->IconData and provided functionality | |
49 in the function dialog_info_win_resize_cb() to display icon data appropriately on the dialog screen for SAT | |
50 call setup. | |
51 | |
52 Sep 06 2005 REF: MMI-SPR-33548 x0012849 Jagan | |
53 Description : A dialog with long message is not displayed properly. | |
54 Solution : The no of lines in a dialog is increased from 4 to 15. | |
55 | |
56 Feb 24, 2005 REF: CRR MMI-SPR-29102 xnkulkar | |
57 Description: The phone resets when user presses the ''End All' key while the SMSs are being deleted. | |
58 Solution: As the user has already confirmed that all SMS messages are to be deleted, ''End All' key | |
59 press is ignored till the delete operation is over. | |
60 xrashmic 08 Feb, 2005 MMI-SPR-27853 | |
61 Moved the T_dialog_info structure from MmiDialogs.c to MmiDialogs.h | |
62 | |
63 | |
64 xrashmic 08 Feb, 2005 MMI-SPR-27853 | |
65 Moved the T_dialog_info structure from MmiDialogs.c to MmiDialogs.h | |
66 | |
67 Aug 25, 2004 REF: CRR 24904 Deepa M.D | |
68 Bug:cleanup compile switches used for Go-lite | |
69 Fix:COLOURDISPLAY compiler switch has been added to the functions which are | |
70 used only for the normal color build. | |
71 | |
72 Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
73 Bug:Clenup of sprintf used for tracing | |
74 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX | |
75 | |
76 | |
77 Sep 01, 2004 REF: CRR 21380 Deepa M.D | |
78 Bug:Not getting proper display, When Messages Memory is Full. | |
79 Fix:Assigning TextId and TextString will not display both the messages. | |
80 Hence we need to use TextId and TextString2 or TextId2 and TextString | |
81 | |
82 Jun 04,2004 CRR:13601 xpradipg - SASKEN | |
83 Description: CFO interrogation display : Timer to long | |
84 Fix: Timer is enabled for the information dialog. It times out after 5 seconds from the last key | |
85 press. | |
86 25/10/00 Original Condat(UK) BMI version. | |
87 | |
88 $End | |
89 | |
90 *******************************************************************************/ | |
91 | |
92 | |
93 /******************************************************************************* | |
94 | |
95 Include Files | |
96 | |
97 *******************************************************************************/ | |
98 #define ENTITY_MFW | |
99 | |
100 /* includes */ | |
101 #include <string.h> | |
102 #include <stdio.h> | |
103 #include <stdlib.h> | |
104 | |
105 #if defined (NEW_FRAME) | |
106 | |
107 #include "typedefs.h" | |
108 #include "vsi.h" | |
109 #include "pei.h" | |
110 #include "custom.h" | |
111 #include "gsm.h" | |
112 | |
113 #else | |
114 | |
115 #include "STDDEFS.H" | |
116 #include "custom.h" | |
117 #include "gsm.h" | |
118 #include "vsi.h" | |
119 | |
120 #endif | |
121 | |
122 | |
123 #include "mfw_mfw.h" | |
124 #include "mfw_win.h" | |
125 #include "mfw_kbd.h" | |
126 /* SPR#1428 - SH - New Editor changes */ | |
127 #ifndef NEW_EDITOR | |
128 #include "mfw_edt.h" | |
129 #endif | |
130 #include "mfw_tim.h" | |
131 #include "mfw_phb.h" | |
132 #include "mfw_sms.h" | |
133 #include "mfw_icn.h" | |
134 #include "mfw_mnu.h" | |
135 #include "mfw_lng.h" | |
136 #include "mfw_sat.h" | |
137 #include "mfw_kbd.h" | |
138 #include "mfw_nm.h" | |
139 | |
140 //x0pleela 15 May, 2007 DR: OMAPS00127483 | |
141 #ifdef FF_PHONE_LOCK | |
142 #ifdef FF_MIDI_RINGER | |
143 #include "mfw_midi.h" | |
144 #endif //FF_MIDI_RINGER | |
145 #endif /* FF_PHONE_LOCK */ | |
146 #include "dspl.h" | |
147 | |
148 #include "ksd.h" | |
149 #include "psa.h" | |
150 | |
151 #include "MmiMain.h" | |
152 #include "MmiDummy.h" | |
153 //JVJE #include "MmiMsgsEdit.h" | |
154 //#include "MmiLists.h" | |
155 #include "MmiMmi.h" | |
156 | |
157 #include "MmiDialogs.h" | |
158 #include "MmiLists.h" | |
159 #include "MmiMenu.h" | |
160 #include "MmiSoftKeys.h" | |
161 | |
162 /* JF Modified | |
163 */ | |
164 #include "MmiBookController.h" | |
165 #include "cus_aci.h" | |
166 | |
167 #include "prim.h" | |
168 #ifndef PCM_2_FFS | |
169 #include "pcm.h" | |
170 #endif | |
171 | |
172 | |
173 #include "mmiColours.h" | |
174 | |
175 //x0pleela 27 Mar, 2007 ER: OMAPS00122561 | |
176 #ifdef FF_PHONE_LOCK | |
177 #include "MmiPins.h" | |
178 //x0pleela 15 May, 2007 DR: OMAPS00127483 | |
179 #include "MmiSounds.h" | |
180 EXTERN T_call call_data; | |
181 extern T_MFW_HND phlock_win_handle; /* to hold the win handle of phone unlock editor window */ | |
182 extern T_MFW_HND phlock_kbd_handle; /* to hold the kbd handle of phone unlock editor window */ | |
183 extern T_MFW_HND phlock_alarm_win_handle; /* to hold the win handle of alarm window */ | |
184 extern T_MFW_HND phlock_dialog_mtc_win_handle;/* to hold the win handle of MT call dialog window */ | |
185 extern int phlock_alarm; /* flag to check whether alarm event has occured or not */ | |
186 int phlock_mtc_anim_time; /* to hold the display info for MTC while in locked state */ | |
187 | |
188 //x0pleela 15 May, 2007 DR: OMAPS00127483 | |
189 #ifdef FF_MMI_AUDIO_PROFILE | |
190 extern UBYTE mfwAudPlay;//flag for audio | |
191 #endif | |
192 | |
193 static T_MFW_HND phlock_dialog_info_create (T_MFW_HND parent_win); | |
194 static int phlock_dialog_info_win_resize_cb (T_MFW_EVENT event, T_MFW_WIN * win); | |
195 void phlock_dialog_info (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
196 static T_MFW_CB phlock_dialog_info_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc); | |
197 static int phlock_dialog_info_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard); | |
198 static int phlock_dialog_info_kbd_long_cb(T_MFW_EVENT event, T_MFW_KBD *keyboard); | |
199 void phlock_dialog_info_destroy (T_MFW_HND own_window); | |
200 | |
201 #endif //FF_PHONE_LOCK | |
202 | |
203 void dlg_initDisplayData_type( T_DISPLAY_DATA *displayInfo, U32 displayCol, int dlgType, T_BITMAP* dlgBitmap , int dlgSKFormat ); | |
204 | |
205 /* | |
206 * START NEW PART | |
207 */ | |
208 | |
209 static T_MFW_HND dialog_info_create (T_MFW_HND parent_win); | |
210 static void dialog_info (T_MFW_HND win, | |
211 USHORT event, SHORT value, void * parameter); | |
212 | |
213 /* x0039928 - Lint warning fix | |
214 static int dialog_info_win_cb (T_MFW_EVENT event, T_MFW_WIN * win); */ | |
215 static int dialog_info_win_resize_cb (T_MFW_EVENT event, T_MFW_WIN * win); | |
216 | |
217 static T_MFW_CB dialog_info_tim_cb (T_MFW_EVENT event, T_MFW_TIM * tc); | |
218 static int dialog_info_kbd_cb (T_MFW_EVENT event, T_MFW_KBD * keyboard); | |
219 static int dialog_info_kbd_long_cb (T_MFW_EVENT event, T_MFW_KBD * keyboard); | |
220 void mmi_dialogs_insert_animation_CB (T_MFW_EVENT event, T_MFW_TIM *tc); | |
221 void mmi_dialogs_animation_new_CB (T_MFW_EVENT event, T_MFW_TIM *tc); | |
222 | |
223 | |
224 MfwRect calcLayout( int dlgType, int dataSx, int dataSy, int bmpSx, int bmpSy) | |
225 { | |
226 MfwRect area; | |
227 int px,py; | |
228 int sx =0,sy = 0; | |
229 | |
230 TRACE_EVENT_P5("dlgType,= %d, dataSx = %d, dataSy = %d, bmpSx = %d, bmpSy = %d", dlgType, dataSx, dataSy, bmpSx, bmpSy); | |
231 | |
232 /*Adjust area available for drawing by the border */ | |
233 switch (dlgType & DLG_BORDER_VERTICAL) | |
234 { | |
235 case DLG_BORDER_VERTICAL_0: sx =bmpSx; break; | |
236 case DLG_BORDER_VERTICAL_1: sx =bmpSx*6/8; break; | |
237 case DLG_BORDER_VERTICAL_2: sx =bmpSx*4/8; break; | |
238 case DLG_BORDER_VERTICAL_3: sx =bmpSx*3/8; break; | |
239 } | |
240 if (sx < dataSx) | |
241 sx = dataSx; | |
242 px = 0; | |
243 | |
244 switch (dlgType & DLG_BORDER_HORIZONTAL) | |
245 { | |
246 case DLG_BORDER_HORIZONTAL_0: sy =bmpSy; break; | |
247 case DLG_BORDER_HORIZONTAL_1: sy =bmpSy*6/8; break; | |
248 case DLG_BORDER_HORIZONTAL_2: sy =bmpSy*4/8; break; | |
249 case DLG_BORDER_HORIZONTAL_3: sy =bmpSy*3/8; break; | |
250 } | |
251 if (sy < dataSy) | |
252 sy = dataSy; | |
253 py = 0; | |
254 | |
255 switch (dlgType & (DLG_INFO_LAYOUT_LEFT | DLG_INFO_LAYOUT_RIGHT)) | |
256 { | |
257 case DLG_INFO_LAYOUT_CENTRE: //display info in centre of display | |
258 px = px + (sx-dataSx)/2; | |
259 sx = dataSx; | |
260 break; | |
261 case DLG_INFO_LAYOUT_RIGHT: //all info is displayed at the foot of trhe display | |
262 px = px+(sx-dataSx); | |
263 sx = dataSx; | |
264 break; | |
265 case DLG_INFO_LAYOUT_LEFT: //display all info at the top of the bitmap | |
266 sx = dataSx; | |
267 break; | |
268 default: //display info over entire area | |
269 break; | |
270 } | |
271 | |
272 switch (dlgType & (DLG_INFO_LAYOUT_BOTTOM | DLG_INFO_LAYOUT_TOP)) | |
273 { | |
274 case DLG_INFO_LAYOUT_CENTRE: //display info in centre of display | |
275 py = py + (sy-dataSy)/2; | |
276 sy = dataSy; | |
277 break; | |
278 case DLG_INFO_LAYOUT_BOTTOM: //all info is displayed at the foot of trhe display | |
279 py = py+(sy-dataSy); | |
280 sy = dataSy; | |
281 break; | |
282 case DLG_INFO_LAYOUT_TOP: //display all info at the top of the bitmap | |
283 sy = dataSy; | |
284 break; | |
285 default: //display info over entire area | |
286 break; | |
287 } | |
288 area.px = px; area.py = py; | |
289 area.sx = sx; area.sy = sy; //Area sx/sy must be no smaller than dataSx/Sy | |
290 return (area); | |
291 } | |
292 | |
293 | |
294 /******************************************************************************* | |
295 | |
296 $Function: info_dialog | |
297 | |
298 $Description: Common information dialog | |
299 | |
300 $Returns: Dialogue info win | |
301 | |
302 $Arguments: parent win, display info | |
303 | |
304 *******************************************************************************/ | |
305 T_MFW_HND info_dialog (T_MFW_HND parent_win, | |
306 T_DISPLAY_DATA * display_info) | |
307 { | |
308 T_MFW_HND win; | |
309 TRACE_FUNCTION("info_dialog()"); | |
310 display_info->SoftKeyStrings = FALSE; | |
311 | |
312 win = dialog_info_create (parent_win); | |
313 | |
314 if (win NEQ NULL) | |
315 { | |
316 SEND_EVENT (win, DIALOG_INIT, 0, display_info); | |
317 } | |
318 return win; | |
319 } | |
320 | |
321 | |
322 /******************************************************************************* | |
323 | |
324 $Function: info_dialog_softkeystrings | |
325 | |
326 $Description: Common information dialog, sets "softkeystrings" to TRUE | |
327 | |
328 $Returns: Dialogue info win | |
329 | |
330 $Arguments: parent win, display info, leftsoftkey, rightsoftkey | |
331 | |
332 *******************************************************************************/ | |
333 T_MFW_HND info_dialog_softkeystrings (T_MFW_HND parent_win, T_DISPLAY_DATA * display_info) | |
334 { | |
335 T_MFW_HND win; | |
336 | |
337 display_info->SoftKeyStrings = TRUE; | |
338 win = dialog_info_create (parent_win); | |
339 | |
340 if (win NEQ NULL) | |
341 { | |
342 SEND_EVENT (win, DIALOG_INIT, 0, display_info); | |
343 } | |
344 return win; | |
345 } | |
346 | |
347 | |
348 /******************************************************************************* | |
349 | |
350 $Function: dialog_info_create | |
351 | |
352 $Description: Creation of an information dialog | |
353 | |
354 $Returns: Dialogue info win | |
355 | |
356 $Arguments: parent win | |
357 | |
358 *******************************************************************************/ | |
359 static T_MFW_HND dialog_info_create (T_MFW_HND parent_win) | |
360 { | |
361 T_MFW_WIN * win_data; | |
362 T_dialog_info * data = (T_dialog_info *)ALLOC_MEMORY (sizeof (T_dialog_info)); | |
363 TRACE_FUNCTION ("dialog_info_create()"); | |
364 | |
365 data->info_win = win_create (parent_win, 0, E_WIN_VISIBLE | |
366 //x0pleela 06 Apr, 2007 ER: OMAPS00122561 | |
367 #ifdef FF_PHONE_LOCK | |
368 |E_WIN_RESUME | |
369 #endif //FF_PHONE_LOCK | |
370 , (T_MFW_CB)dialog_info_win_resize_cb); | |
371 | |
372 if (data->info_win EQ 0) | |
373 return 0; | |
374 | |
375 /* | |
376 * Create window handler | |
377 */ | |
378 data->mmi_control.dialog = (T_DIALOG_FUNC)dialog_info; | |
379 data->mmi_control.data = data; | |
380 data->parent_win = parent_win; | |
381 win_data = ((T_MFW_HDR *)data->info_win)->data; | |
382 win_data->user = (void *)data; | |
383 | |
384 /* | |
385 * return window handle | |
386 */ | |
387 return data->info_win; | |
388 } | |
389 | |
390 | |
391 /******************************************************************************* | |
392 | |
393 $Function: dialog_info_destroy | |
394 | |
395 $Description: Destruction of an information dialog | |
396 | |
397 $Returns: void | |
398 | |
399 $Arguments: win | |
400 | |
401 *******************************************************************************/ | |
402 void dialog_info_destroy (T_MFW_HND own_window) | |
403 { | |
404 T_MFW_WIN * win = ((T_MFW_HDR *)own_window)->data; | |
405 T_dialog_info * data = (T_dialog_info *)win->user; | |
406 | |
407 TRACE_FUNCTION ("dialog_info_destroy()"); | |
408 | |
409 if (own_window == NULL) | |
410 { | |
411 TRACE_EVENT ("Error :- Called with NULL Pointer"); | |
412 return; | |
413 } | |
414 | |
415 if (data) | |
416 { | |
417 /* | |
418 * Exit TIMER & KEYBOARD Handle | |
419 */ | |
420 kbd_delete (data->info_kbd); | |
421 tim_delete (data->info_tim); | |
422 | |
423 if(data->animation_timer != 0) | |
424 { | |
425 timDelete(data->animation_timer); | |
426 | |
427 if (data->icon != 0) | |
428 icnDelete(data->icon); | |
429 } | |
430 | |
431 /* | |
432 * Delete WIN Handler | |
433 */ | |
434 win_delete (data->info_win); | |
435 /* | |
436 * Free Memory | |
437 */ | |
438 FREE_MEMORY ((void *)data, sizeof (T_dialog_info)); | |
439 } | |
440 //x0pleela 05 Apr, 2007 ER: OMAPS00122561 | |
441 #ifdef FF_PHONE_LOCK | |
442 if( phlock_alarm && phlock_alarm_win_handle ) | |
443 { | |
444 phlock_alarm_win_handle = NULL; | |
445 } | |
446 | |
447 if(( call_data.call_direction == MFW_CM_MTC )&& phlock_dialog_mtc_win_handle ) | |
448 { | |
449 phlock_dialog_mtc_win_handle = NULL; | |
450 } | |
451 #endif //FF_PHONE_LOCK | |
452 | |
453 } | |
454 | |
455 void dlg_zeroDisplayData( T_DISPLAY_DATA *displayInfo) | |
456 { | |
457 | |
458 TRACE_EVENT("dlg_zeroDisplayData()"); | |
459 if (displayInfo == NULL) | |
460 return; | |
461 memset (displayInfo, 0x00, sizeof(T_DISPLAY_DATA)); | |
462 | |
463 displayInfo->LeftSoftKey = 0; | |
464 displayInfo->RightSoftKey = 0; | |
465 displayInfo->LSKString = NULL; | |
466 displayInfo->RSKString = NULL; | |
467 displayInfo->TextString = NULL; | |
468 displayInfo->TextString2 = NULL; | |
469 | |
470 displayInfo->WrapStrings = 0; | |
471 | |
472 displayInfo->TextId = 0; | |
473 displayInfo->TextId2 = 0; | |
474 | |
475 displayInfo->SoftKeyStrings = FALSE; | |
476 | |
477 displayInfo->Identifier = 0; | |
478 displayInfo->anim_time = 0; | |
479 displayInfo->number_of_frames = 0; | |
480 displayInfo->current_frame = 0; | |
481 //x0035544 Feb 07, 2006 DR:OMAPS00061467 | |
482 #ifdef FF_MMI_SAT_ICON | |
483 displayInfo->IconData.width = 0; | |
484 displayInfo->IconData.height = 0; | |
485 displayInfo->IconData.dst = NULL; | |
486 displayInfo->IconData.selfExplanatory = FALSE; | |
487 #endif | |
488 dlg_initDisplayData_events( displayInfo, NULL, 0, 0); | |
489 | |
490 /* GW#2294 COLOUR_STATUS has been used for all popups - change this to default instead of COLOUR_POPUP .*/ | |
491 dlg_initDisplayData_type( displayInfo, COLOUR_STATUS, 0, NULL, 0 ); | |
492 | |
493 /* GW #2294 02/07/03 - The default bitmap is set-up here to allow us to disable it for some dialogs (if required) */ | |
494 displayInfo->bgdBitmap = icon_getBgdBitmap(BGD_CLOUD); | |
495 | |
496 } | |
497 | |
498 void dlg_initDisplayData_TextId( T_DISPLAY_DATA *displayInfo, int lsk, int rsk, int str1, int str2, int colId) | |
499 { | |
500 if (displayInfo == NULL) | |
501 return; | |
502 dlg_zeroDisplayData(displayInfo); | |
503 displayInfo->LeftSoftKey = (USHORT)lsk; | |
504 displayInfo->RightSoftKey = (USHORT)rsk; | |
505 displayInfo->TextId = str1; | |
506 displayInfo->TextId2 = str2; | |
507 displayInfo->displayCol = colId ; | |
508 | |
509 } | |
510 | |
511 void dlg_initDisplayData_TextStr( T_DISPLAY_DATA *displayInfo, int lsk, int rsk,char *str1, char *str2, int colId) | |
512 { | |
513 if (displayInfo == NULL) | |
514 return; | |
515 dlg_zeroDisplayData(displayInfo); | |
516 displayInfo->LeftSoftKey = (USHORT)lsk; | |
517 displayInfo->RightSoftKey = (USHORT)rsk; | |
518 displayInfo->TextString = str1; | |
519 displayInfo->TextString2 = str2; | |
520 displayInfo->displayCol = colId ; | |
521 } | |
522 | |
523 void dlg_initDisplayData_events( T_DISPLAY_DATA *displayInfo, T_VOID_FUNC callback, int timer, T_MFW_EVENT keyEvents) | |
524 { | |
525 displayInfo->Callback = callback; | |
526 displayInfo->Time = timer; | |
527 displayInfo->KeyEvents = keyEvents; | |
528 } | |
529 | |
530 void dlg_initDisplayData_type( T_DISPLAY_DATA *displayInfo, U32 displayCol, int dlgType, T_BITMAP* dlgBitmap, int dlgSkFormat ) | |
531 { | |
532 displayInfo->displayCol = displayCol; | |
533 displayInfo->dlgType = dlgType; | |
534 displayInfo->bgdBitmap = dlgBitmap; | |
535 } | |
536 | |
537 /******************************************************************************* | |
538 | |
539 $Function: dialog_info | |
540 | |
541 $Description: Dialog function for information dialog | |
542 | |
543 $Returns: void | |
544 | |
545 $Arguments: win, window handle event, value, parameter | |
546 | |
547 *******************************************************************************/ | |
548 void dialog_info (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
549 { | |
550 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
551 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
552 T_DISPLAY_DATA * display_info = (T_DISPLAY_DATA *)parameter; | |
553 TRACE_FUNCTION ("dialog_info()"); | |
554 | |
555 switch (event) | |
556 { | |
557 case DIALOG_INIT: | |
558 /* | |
559 * Initialize dialog | |
560 */ | |
561 #if defined (WIN32) | |
562 { | |
563 /***************************Go-lite Optimization changes Start***********************/ | |
564 | |
565 //Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
566 TRACE_EVENT_P1( "Identifier %d", display_info->Identifier); | |
567 /***************************Go-lite Optimization changes end***********************/ | |
568 | |
569 } | |
570 #endif | |
571 /* | |
572 * Create timer and keyboard handler | |
573 */ | |
574 data->info_tim = tim_create (win, display_info->Time, (T_MFW_CB)dialog_info_tim_cb); | |
575 data->info_kbd = kbd_create (win, KEY_ALL, (T_MFW_CB)dialog_info_kbd_cb); | |
576 data->info_kbd_long = kbd_create(win,KEY_ALL|KEY_LONG,(MfwCb)dialog_info_kbd_long_cb); | |
577 | |
578 //x0pleela 05 Apr, 2007 ER: OMAPS00122561 | |
579 #ifdef FF_PHONE_LOCK | |
580 if( phlock_win_handle && | |
581 ( ( phlock_alarm) || ( call_data.call_direction == MFW_CM_MTC ) ) ) | |
582 { | |
583 TRACE_EVENT("dialog_info: Bef deleting kbd_delete(data->info_kbd);"); | |
584 if( phlock_alarm ) | |
585 phlock_alarm_win_handle = win; | |
586 | |
587 if( call_data.call_direction == MFW_CM_MTC ) | |
588 phlock_dialog_mtc_win_handle = win; | |
589 | |
590 kbd_delete(data->info_kbd); | |
591 data->info_kbd = phlock_kbd_handle; //set the kbd handle of unlock screen | |
592 } | |
593 #endif //FF_PHONE_LOCK | |
594 | |
595 /* | |
596 * Store any other data | |
597 */ | |
598 data->KeyEvents = display_info->KeyEvents; | |
599 data->TextString = display_info->TextString; | |
600 data->LeftSoftKey = display_info->LeftSoftKey; | |
601 data->RightSoftKey = display_info->RightSoftKey; | |
602 data->SoftKeyStrings = display_info->SoftKeyStrings; // SH - TRUE if using strings rather than IDs | |
603 data->LSKString = display_info->LSKString; // Text for left soft key | |
604 data->RSKString = display_info->RSKString; // Text for right soft key | |
605 data->TextId = display_info->TextId; | |
606 data->Identifier = display_info->Identifier; | |
607 data->Callback = display_info->Callback; | |
608 data->TextString2 = display_info->TextString2; | |
609 data->TextId2 = display_info->TextId2; | |
610 data->WrapStrings = display_info->WrapStrings; //GW-SPR#762 | |
611 | |
612 data->dlgCol = display_info->displayCol; | |
613 data->dlgType = display_info->dlgType; | |
614 data->dlgBgdBitmap = display_info->bgdBitmap; | |
615 data->dlgSkFormat = 0; | |
616 data->current_frame = display_info->current_frame; | |
617 data->number_of_frames = display_info->number_of_frames; | |
618 data->icon_array = (MfwIcnAttr*)display_info->icon_array; | |
619 data->animation_timer = 0; | |
620 //x0035544 Feb 07, 2006 DR:OMAPS00061467 | |
621 #ifdef FF_MMI_SAT_ICON | |
622 if(display_info->IconData.dst != NULL) | |
623 { | |
624 data->IconData.width = display_info->IconData.width; | |
625 data->IconData.height = display_info->IconData.height; | |
626 data->IconData.dst = display_info->IconData.dst; | |
627 data->IconData.selfExplanatory = display_info->IconData.selfExplanatory; | |
628 } | |
629 else | |
630 { | |
631 data->IconData.dst = NULL; | |
632 data->IconData.selfExplanatory = FALSE; | |
633 data->IconData.width =0; | |
634 data->IconData.height =0; | |
635 } | |
636 #endif | |
637 | |
638 TRACE_EVENT_P1("anim_time = %d", display_info->anim_time); | |
639 TRACE_EVENT_P1("data->anim_time = %d", data->anim_time); | |
640 //x0pleela 27 Mar, 2007 ER: OMAPS00122561 | |
641 #ifdef FF_PHONE_LOCK | |
642 phlock_mtc_anim_time = display_info->anim_time; | |
643 if( ( !phlock_win_handle) || (mmiPinsEmergencyCall()) | |
644 || call_data.emergencyCall ) | |
645 { | |
646 #endif //FF_PHONE_LOCK | |
647 if(display_info->anim_time != 0) | |
648 { | |
649 data->animation_timer = timCreate(win,display_info->anim_time,(MfwCb)mmi_dialogs_animation_new_CB); | |
650 timStart(data->animation_timer); | |
651 } | |
652 | |
653 if (display_info->Time NEQ FOREVER) | |
654 tim_start (data->info_tim); | |
655 win_show (win); | |
656 | |
657 #ifdef FF_PHONE_LOCK | |
658 } | |
659 else | |
660 { | |
661 if (display_info->Time NEQ FOREVER) | |
662 tim_start (data->info_tim); | |
663 | |
664 | |
665 | |
666 winShow(phlock_win_handle ); | |
667 } | |
668 #endif //FF_PHONE_LOCK | |
669 break; | |
670 | |
671 case DIALOG_DESTROY: | |
672 dialog_info_destroy(win); | |
673 break; | |
674 } | |
675 } | |
676 | |
677 #if(0) /* x0039928 - Lint warning fix */ | |
678 /******************************************************************************* | |
679 | |
680 $Function: dialog_info_win_cb | |
681 | |
682 $Description: Callback function for information dialog | |
683 | |
684 $Returns: void | |
685 | |
686 $Arguments: window handle event, win | |
687 *******************************************************************************/ | |
688 //GW-SPR#762-Added code to wraps txtString2 if there is room on the display to allow | |
689 //very long numbers to be displayed. | |
690 #define MAX_LINE_CHAR MAX_LINE | |
691 static int dialog_info_win_cb (T_MFW_EVENT event, T_MFW_WIN * win) | |
692 { | |
693 T_dialog_info * data = (T_dialog_info *)win->user; | |
694 char buffer[MAX_LINE_CHAR+1]; | |
695 int yPos,len,bufPos,nLines; | |
696 | |
697 TRACE_FUNCTION ("dialog_info_win_cb()"); | |
698 | |
699 | |
700 if (data EQ 0) | |
701 return 1; | |
702 | |
703 switch (event) | |
704 { | |
705 case E_WIN_VISIBLE: | |
706 if (win->flags & E_WIN_VISIBLE) | |
707 { | |
708 /* | |
709 * Print the information dialog | |
710 */ | |
711 | |
712 /* | |
713 * Clear Screen | |
714 */ | |
715 dspl_ClearAll(); | |
716 | |
717 /* | |
718 * Print softkeys | |
719 */ | |
720 icnShow(data->icon); | |
721 if (data->SoftKeyStrings) | |
722 displayCustSoftKeys(data->LSKString, data->RSKString); // SH - display text softkeys | |
723 else | |
724 displaySoftKeys(data->LeftSoftKey, data->RightSoftKey); // display ID softkeys | |
725 | |
726 /* | |
727 * Print information | |
728 */ | |
729 /*MC SPR 1257, having to shift everything up 1 line as string wrapping for second | |
730 string causes softkey overwrite when in Chinese*/ | |
731 if (data->TextId NEQ 0) | |
732 { | |
733 ALIGNED_PROMPT(LEFT,0,DSPL_TXTATTR_CURRENT_MODE, data->TextId); | |
734 } | |
735 else if (data->TextString NEQ NULL) | |
736 { | |
737 #ifdef EASY_TEXT_ENABLED | |
738 if (data->TextString[0] == (char)0x80) //MC if this is a unicode string /* x0039928 -lint warning removal */ | |
739 displayAlignedText(LEFT, 0, DSPL_TXTATTR_UNICODE, &data->TextString[2]); | |
740 else | |
741 #endif | |
742 displayAlignedText(LEFT, 0, DSPL_TXTATTR_NORMAL, data->TextString); | |
743 } | |
744 | |
745 if (data->TextId2 NEQ 0) | |
746 { | |
747 ALIGNED_PROMPT(LEFT,Mmi_layout_first_line()/*MC*/,DSPL_TXTATTR_CURRENT_MODE, data->TextId2); | |
748 } | |
749 else if (data->TextString2 NEQ NULL) | |
750 { | |
751 #ifdef EASY_TEXT_ENABLED | |
752 if (data->TextString2[0] == (char)0x80 ) //MC if this is a unicode string /* x0039928 -Lint warning removal */ | |
753 displayAlignedText(LEFT, Mmi_layout_first_line()/*MC*/, DSPL_TXTATTR_UNICODE, &data->TextString2[2]); | |
754 else | |
755 #endif | |
756 { | |
757 if ((data->WrapStrings & WRAP_STRING_2) && (strlen(data->TextString2) > MAX_LINE_CHAR)) | |
758 { //Display text over a number of lines | |
759 yPos = Mmi_layout_first_line();/*MC*/ | |
760 bufPos = 0; | |
761 nLines = Mmi_number_of_lines_without_icons_on_top()-2;//starting on 2nd line | |
762 len = strlen(data->TextString2); | |
763 while ((bufPos < len) && (nLines >=0)) | |
764 { | |
765 memcpy(buffer,&data->TextString2[bufPos],MAX_LINE_CHAR); | |
766 bufPos = bufPos + MAX_LINE_CHAR; | |
767 buffer[MAX_LINE_CHAR] = 0x00; | |
768 displayAlignedText(LEFT, yPos, 0, buffer); | |
769 yPos = yPos + Mmi_layout_line_height(); | |
770 nLines--; | |
771 } | |
772 } | |
773 else | |
774 { | |
775 displayAlignedText(LEFT, Mmi_layout_second_line(),DSPL_TXTATTR_NORMAL, data->TextString2); | |
776 } | |
777 } | |
778 } | |
779 } | |
780 break; | |
781 | |
782 default: | |
783 return 0; | |
784 } | |
785 return 1; | |
786 } | |
787 #endif | |
788 | |
789 /******************************************************************************* | |
790 | |
791 $Function: dialog_info_win_cb | |
792 | |
793 $Description: Callback function for information dialog | |
794 | |
795 $Returns: void | |
796 | |
797 $Arguments: window handle event, win | |
798 | |
799 GW SPR#2294 02/07/03 - Removed Unicode specific code as the 'display' routines called to calculate | |
800 the string length and output the text should correctly handle the 0x80 unicode tag | |
801 at the start. | |
802 Modified the display code to wrap the text in the second text string. | |
803 Modified the window drawing code so that if the text will not fit in the dialog box | |
804 with the background bitmap, a pop-up 'box' will be drawn instead. If this will still | |
805 not be large enough, the entire screen is used. | |
806 For the C-sample, there is no bitmap. | |
807 Modified the code to use an array of values to position the text output. | |
808 GW SPR#2294 08/07/03 - Added code to expand the dialog box to include the animation (if any). | |
809 | |
810 *******************************************************************************/ | |
811 // Allow 4 lines of text (0..3) for dialogs | |
812 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
813 // To display a dialog properly when it contain lengthy message - No of lines increased. | |
814 #define MAX_DLG_LINES (15) | |
815 //Allow up to 40 chars of text on a dialog line | |
816 #define MAX_WRAP_CHAR (42) | |
817 //Allow us to wrap text from line 2 to lines 2,3 and 4 lines | |
818 #define MAX_WRAP_LINES (MAX_DLG_LINES-1) | |
819 | |
820 #define DLG_USE_BITMAP 0x0001 //use bitmap if present | |
821 #define DLG_USE_RECTANGLE 0x0002 //use a rectangle | |
822 #define DLG_USE_FULL_SCREEN 0x0004 //use full-screen | |
823 | |
824 #define DLG_LINE1 0 | |
825 #define DLG_LINE2 1 | |
826 | |
827 static int dialog_info_win_resize_cb (T_MFW_EVENT event, T_MFW_WIN * win) | |
828 { | |
829 T_dialog_info * data = (T_dialog_info *)win->user; | |
830 // T_DISPLAY_DATA * display_info; // RAVI | |
831 int xPos[MAX_DLG_LINES]; | |
832 int yPos[MAX_DLG_LINES]; | |
833 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
834 //The size of array str and strlen are increased by 1, so that the last elements holds data | |
835 // which is used while wrapping the text. | |
836 char* str[MAX_DLG_LINES+1]; | |
837 int strLen[MAX_DLG_LINES+1]; | |
838 int i; | |
839 char* lskStr,*rskStr; | |
840 int wx = 0; //,wy,sx=0,sy=0; // RAVI | |
841 int wy = 0; // RAVI | |
842 int sx = 0; // RAVI | |
843 int sy = 0; // RAVI | |
844 int fullScreen = DLG_USE_RECTANGLE; | |
845 int yOfs; | |
846 int yBmpOfs = 0; | |
847 MfwRect skArea; | |
848 //x0035544 Feb 15, 2006. DR:OMAPS00061467 | |
849 #ifdef FF_MMI_SAT_ICON | |
850 USHORT titleIconWidth = 0; | |
851 #endif | |
852 MfwRect area; | |
853 int scrWidth = 0; //available width for the display // RAVI - Assignment to 0. | |
854 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
855 // temp_ptr is used while wrapping the text. | |
856 // Now str2[][] is not required. | |
857 char *temp_ptr; | |
858 int nChar; | |
859 | |
860 /* t_font_bitmap bmp; */ /* Warning Removal - x0020906 - 24-08-2006 */ | |
861 // t_font_bitmap* bmpPtr = &bmp; // RAVI - Not Referenced. | |
862 | |
863 int drawWinType; | |
864 int nLines; | |
865 | |
866 int linePos=0; | |
867 int lineLen = 0; | |
868 int wrapLine = 0; /*GW #2294*/ // x0066814 06 Dec 2006, OMAPS00106825 | |
869 | |
870 const int charWidth = dspl_GetTextExtent("0",1); | |
871 TRACE_FUNCTION ("dialog_info_win_resize_cb()"); | |
872 | |
873 | |
874 memset(str,'\0',sizeof(str)); /* x0039928 - Lint warning fix */ | |
875 memset(strLen,0,sizeof(strLen)); | |
876 //x0035544 Feb 15, 2006. DR:OMAPS00061467 | |
877 #ifdef FF_MMI_SAT_ICON | |
878 if (data->IconData.dst != NULL) | |
879 { | |
880 if (data->IconData.width > TITLE_ICON_WIDTH) | |
881 { | |
882 titleIconWidth = TITLE_ICON_WIDTH; | |
883 } | |
884 else | |
885 { | |
886 titleIconWidth = data->IconData.width ; | |
887 } | |
888 } | |
889 else | |
890 { | |
891 titleIconWidth = 0; | |
892 } | |
893 | |
894 #endif | |
895 if (data EQ 0) | |
896 return 1; | |
897 | |
898 switch (event) | |
899 { | |
900 //x0pleela 15 May, 2007 DR: OMAPS00127483 | |
901 //Added the following code to handle ringer for incoming call and alarm in phone unlocked state. | |
902 //the ringer for incoming call or alarm is restarted here after unlocking the phone. | |
903 case E_WIN_RESUME: | |
904 | |
905 #ifdef FF_PHONE_LOCK | |
906 | |
907 if( ( ( ( call_data.call_direction == MFW_CM_MTC ) && ( phlock_dialog_mtc_win_handle ) ) || ( phlock_alarm ) ) | |
908 #ifdef FF_MMI_AUDIO_PROFILE | |
909 && ( !mfwAudPlay) | |
910 #endif | |
911 ) | |
912 { | |
913 if( call_data.call_direction == MFW_CM_MTC ) | |
914 { | |
915 #ifdef FF_MIDI_RINGER | |
916 mfw_ringer_start(AS_RINGER_MODE_IC, TRUE, sounds_midi_ringer_start_cb); | |
917 #endif | |
918 } | |
919 else if ( phlock_alarm ) | |
920 { | |
921 #ifdef FF_MIDI_RINGER | |
922 mfw_ringer_start(AS_RINGER_MODE_ALARM, TRUE, sounds_midi_ringer_start_cb); | |
923 #endif | |
924 } | |
925 } | |
926 | |
927 #endif // FF_PHONE_LOCK | |
928 | |
929 break; | |
930 | |
931 case E_WIN_VISIBLE: | |
932 if (win->flags & E_WIN_VISIBLE) | |
933 { | |
934 TRACE_EVENT("dialog_info_win_resize_cb: E_WIN_VISIBLE"); | |
935 | |
936 #ifdef FF_PHONE_LOCK | |
937 if( phlock_alarm && phlock_alarm_win_handle ) | |
938 { | |
939 TRACE_EVENT("dialog_info_win_resize_cb: creating alarm kbd handler"); | |
940 data->info_kbd = kbd_create (phlock_alarm_win_handle, KEY_ALL, (T_MFW_CB)dialog_info_kbd_cb); | |
941 } | |
942 if( ( call_data.call_direction == MFW_CM_MTC ) && ( phlock_dialog_mtc_win_handle ) ) | |
943 { | |
944 TRACE_EVENT("dialog_info_win_resize_cb: creating mtc kbd handler"); | |
945 data->info_kbd = kbd_create (phlock_dialog_mtc_win_handle, KEY_ALL, (T_MFW_CB)dialog_info_kbd_cb); | |
946 if(phlock_mtc_anim_time != 0) | |
947 { | |
948 data->animation_timer = timCreate(phlock_dialog_mtc_win_handle, phlock_mtc_anim_time, | |
949 (MfwCb)mmi_dialogs_animation_new_CB); | |
950 timStart(data->animation_timer); | |
951 } | |
952 } | |
953 #endif //FF_PHONE_LOCK | |
954 | |
955 /* | |
956 * Print the information dialog | |
957 */ | |
958 for (i=0;i<MAX_DLG_LINES;i++) | |
959 { | |
960 xPos[i]=0; | |
961 yPos[i] = Mmi_layout_line_height()*i; | |
962 str[i]=NULL; | |
963 strLen[i]=0; | |
964 } | |
965 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
966 // Assign the values to last elments of the array str and strLen | |
967 str[MAX_DLG_LINES] = NULL; | |
968 strLen[MAX_DLG_LINES] = 0; | |
969 yOfs = Mmi_layout_line_height()/4; | |
970 if (data->TextId != 0) | |
971 str[DLG_LINE1] = MmiRsrcGetText( data->TextId); | |
972 else | |
973 str[DLG_LINE1] = data->TextString; | |
974 | |
975 if (data->TextId2 != 0) | |
976 str[DLG_LINE2] = MmiRsrcGetText( data->TextId2); | |
977 else | |
978 str[DLG_LINE2] = data->TextString2; | |
979 | |
980 if (data->SoftKeyStrings!=0) | |
981 { | |
982 lskStr = data->LSKString; | |
983 rskStr = data->RSKString; | |
984 } | |
985 else | |
986 { | |
987 if (data->LeftSoftKey != TxtNull) | |
988 lskStr = MmiRsrcGetText(data->LeftSoftKey); | |
989 else | |
990 lskStr = NULL; | |
991 | |
992 if (data->RightSoftKey != TxtNull) | |
993 rskStr = MmiRsrcGetText(data->RightSoftKey); | |
994 else | |
995 rskStr = NULL; | |
996 } | |
997 | |
998 if ((str[DLG_LINE1]!= NULL) || (str[DLG_LINE2]!=NULL)) | |
999 { //Draw a window for status info | |
1000 if (str[DLG_LINE2] == NULL) | |
1001 { | |
1002 sy = Mmi_layout_line_height()+yOfs*2; // 18 or 12 | |
1003 | |
1004 } | |
1005 else | |
1006 { | |
1007 sy = Mmi_layout_line_height()*2+yOfs*3; // 33 or 22 | |
1008 } | |
1009 | |
1010 //MC, if (Mmi_getCurrentLanguage() != CHINESE_LANGUAGE) | |
1011 { //calculate longest string - use this to calc width of window | |
1012 sx = 0; | |
1013 if ((lskStr!=NULL) || (rskStr!=NULL)) | |
1014 { | |
1015 sy = sy+Mmi_layout_softkeyHeight()+yOfs*2; | |
1016 sx = sx + 10; | |
1017 if (lskStr != NULL) | |
1018 { | |
1019 sx = sx + dspl_GetTextExtent(lskStr, 0); | |
1020 } | |
1021 if (rskStr != NULL) | |
1022 { | |
1023 sx = sx + dspl_GetTextExtent(rskStr,0); | |
1024 } | |
1025 | |
1026 } | |
1027 for (i=DLG_LINE1;i<=DLG_LINE2;i++) | |
1028 { | |
1029 strLen[i] = dspl_GetTextExtent(str[i],0); | |
1030 } | |
1031 | |
1032 /* Work out the desired width of the dialog. If we can wrap line 2 and it is long, wrap it */ | |
1033 if (data->WrapStrings & WRAP_STRING_2) | |
1034 nLines = MAX_WRAP_LINES; | |
1035 else | |
1036 nLines = 1; | |
1037 #ifdef COLOURDISPLAY | |
1038 if (data->dlgBgdBitmap!=NULL) | |
1039 { | |
1040 //we only have room to split line 2 into 'max_lines_dlg_popup' lines in the pop-up. | |
1041 //NB this should be calculated depending on the height of the popup bitmap. | |
1042 const int max_lines_dlg_popup=2; | |
1043 if (nLines>max_lines_dlg_popup) | |
1044 nLines = max_lines_dlg_popup; | |
1045 scrWidth = (data->dlgBgdBitmap->area.sx * 3)/4; //the max width is about 3/4 of the pop-up | |
1046 if ( (strLen[DLG_LINE2] > (scrWidth-charWidth)*nLines) || | |
1047 (strLen[DLG_LINE1] > scrWidth)) | |
1048 { | |
1049 //recalculate width below. | |
1050 if (data->WrapStrings & WRAP_STRING_2) | |
1051 nLines = MAX_WRAP_LINES; | |
1052 fullScreen = DLG_USE_RECTANGLE; | |
1053 } | |
1054 else | |
1055 { | |
1056 fullScreen = DLG_USE_BITMAP; | |
1057 //Leave width as is | |
1058 } | |
1059 } | |
1060 #else | |
1061 //On a C-sample, limit pop-up lines to 2 extra (any more - use entire screen) | |
1062 { | |
1063 const int max_lines_dlg_popup=2; | |
1064 if (nLines>max_lines_dlg_popup) | |
1065 nLines = max_lines_dlg_popup; | |
1066 } | |
1067 | |
1068 #endif | |
1069 if (fullScreen == DLG_USE_RECTANGLE) | |
1070 { | |
1071 //see if we can display as a pop-up | |
1072 if (SCREEN_SIZE_X < 128) | |
1073 scrWidth = SCREEN_SIZE_X-6; | |
1074 else | |
1075 scrWidth = (SCREEN_SIZE_X*7)/8; | |
1076 if ( strLen[DLG_LINE2] > (scrWidth-charWidth)*nLines) | |
1077 { | |
1078 //Cannot fit in as a pop-up - use full screen | |
1079 fullScreen = DLG_USE_FULL_SCREEN; | |
1080 scrWidth = SCREEN_SIZE_X; | |
1081 } | |
1082 else | |
1083 { | |
1084 //We can fit it in - but we may want to reduce the width for a nicer look. | |
1085 } | |
1086 } | |
1087 | |
1088 /* | |
1089 * Wrap second text line (e.g. for long phone numbers.) | |
1090 */ | |
1091 if (strLen[DLG_LINE2] > scrWidth-charWidth) | |
1092 { | |
1093 //If we can fit the string on 2 lines - do it. | |
1094 if (data->WrapStrings & WRAP_STRING_2) | |
1095 { | |
1096 if (str[DLG_LINE2][0] != (char)0x80) //not unicode /* x0039928 -Lint warning removal */ | |
1097 { | |
1098 wrapLine = 0; | |
1099 lineLen = strlen(str[DLG_LINE2]); | |
1100 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
1101 // memset is not required any more . | |
1102 //Now the last element of the str[] will point to the second string of the dialog | |
1103 str[MAX_DLG_LINES] = str[DLG_LINE2]; // Now move the second line of text to the last element of the arrya | |
1104 strLen[MAX_DLG_LINES] = strLen[DLG_LINE2];// put the right value for the length of the string | |
1105 str[DLG_LINE2] = NULL ; // Assign NULL to the second element of the array. | |
1106 while ((wrapLine < MAX_WRAP_LINES) && (linePos<lineLen)) | |
1107 { | |
1108 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
1109 // Instead of DLG_LINE2 use MAX_DLG_LINES | |
1110 nChar = dspl_GetNcharToFit (&str[MAX_DLG_LINES][linePos], (USHORT)scrWidth); | |
1111 if (nChar > MAX_WRAP_CHAR) | |
1112 nChar = MAX_WRAP_CHAR; | |
1113 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
1114 // Allocate MAX_WRAP_CHAR no of bytes | |
1115 temp_ptr = (char*)mfwAlloc(MAX_WRAP_CHAR); | |
1116 if(NULL == temp_ptr) | |
1117 return 0; | |
1118 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
1119 // Now the destination of memcpy is temp_ptr instead of str2[wrapLine] and the source is str[MAX_DLG_LINES] instead of str[DLG_LINE2] | |
1120 memcpy(temp_ptr,&str[MAX_DLG_LINES][linePos],nChar); // Now the source data is from the last element of the array. | |
1121 linePos = linePos+nChar; | |
1122 ////GW - even if we cannot display the entire string - it is better than what we would have otherwise | |
1123 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
1124 // Assign the value of pointer temp_ptr to str[] | |
1125 str[DLG_LINE2+wrapLine] = temp_ptr; | |
1126 temp_ptr = NULL; | |
1127 strLen[DLG_LINE2 + wrapLine] = dspl_GetTextExtent(str[DLG_LINE2+wrapLine],0); | |
1128 wrapLine++; | |
1129 } | |
1130 | |
1131 } | |
1132 else | |
1133 { | |
1134 //Unicode is more problematic - we need the 0x80 at the front of the string | |
1135 //for the call to 'dspl_GetNcharToFit'. This will involve copying the entire remainder | |
1136 //of 'str2' into a temporary buffer. At the moment, we only wrap numbers so this | |
1137 //code will wait until it is required. | |
1138 // str[3] = "Code not written!!"; //issue warning | |
1139 // strLen[3] = dspl_GetTextExtent(str[3],0); | |
1140 fullScreen = DLG_USE_FULL_SCREEN; //error - use full screen | |
1141 } | |
1142 } | |
1143 } | |
1144 | |
1145 //Calculate longest line of text (including softkeys - sx already set to the softkey width) | |
1146 for (i=0;i< MAX_DLG_LINES;i++) | |
1147 { | |
1148 if (strLen[i]>sx) | |
1149 sx = strLen[i]; | |
1150 } | |
1151 if (sx > SCREEN_SIZE_X-charWidth) | |
1152 sx = SCREEN_SIZE_X; | |
1153 else | |
1154 { | |
1155 if (sx > SCREEN_SIZE_X/2) | |
1156 sx = sx + charWidth; | |
1157 else | |
1158 sx = sx + charWidth*2; | |
1159 } | |
1160 if (sy> sx) | |
1161 sx = sy; | |
1162 wx = (SCREEN_SIZE_X-sx)/2; | |
1163 if (wx<0) | |
1164 wx=0; | |
1165 } | |
1166 | |
1167 if (sy > SCREEN_SIZE_Y) | |
1168 wy = 0; | |
1169 else if (SCREEN_SIZE_Y > 2*sy) | |
1170 wy = (SCREEN_SIZE_Y*2/3-sy)/2; //display in middle of top 2/3 of screen | |
1171 else | |
1172 wy = (SCREEN_SIZE_Y-sy)/2; //display in middle of screen | |
1173 if (wy < 10) | |
1174 wy = wy/2; | |
1175 | |
1176 if ((wx == 0) || (wy==0)) | |
1177 { //not enough room to display as a window - use whole screen | |
1178 fullScreen = DLG_USE_FULL_SCREEN; | |
1179 } | |
1180 | |
1181 #ifdef COLOURDISPLAY | |
1182 if ((data->icon_array != NULL) && (fullScreen != DLG_USE_BITMAP)) | |
1183 { //The dialog has an animation - we must make the pop-up large enough to support this | |
1184 if (sx < data->icon_array[0].area.sx) | |
1185 sx = data->icon_array[0].area.sx; | |
1186 yBmpOfs = data->icon_array[0].area.py + data->icon_array[0].area.sy; | |
1187 wy = data->icon_array[0].area.py; | |
1188 sy = sy + data->icon_array[0].area.sy; | |
1189 } | |
1190 #endif | |
1191 } | |
1192 else | |
1193 { | |
1194 //We have no strings to display - clear entire screen | |
1195 fullScreen = DLG_USE_FULL_SCREEN; | |
1196 } | |
1197 | |
1198 | |
1199 /****************************** | |
1200 * Draw window (full screen/pop-up) | |
1201 *****************************/ | |
1202 if (fullScreen != DLG_USE_FULL_SCREEN) | |
1203 dspl_unfocusDisplay(); | |
1204 area.px = 0; | |
1205 area.py = 0; | |
1206 area.sx = sx; | |
1207 area.sy = sy; | |
1208 resources_setColour(data->dlgCol); | |
1209 drawWinType = DSPL_WIN_CENTRE; | |
1210 | |
1211 if (fullScreen!=DLG_USE_FULL_SCREEN) | |
1212 { | |
1213 t_font_bitmap bmp; | |
1214 t_font_bitmap* bmpPtr = NULL; | |
1215 | |
1216 for (i=0;i<MAX_DLG_LINES;i++) | |
1217 { | |
1218 //centre text | |
1219 xPos[i] = wx+(sx-strLen[i])/2; | |
1220 yPos[i] = wy+yOfs+yBmpOfs+Mmi_layout_line_height()*i; | |
1221 } | |
1222 | |
1223 #ifdef COLOURDISPLAY | |
1224 if ((data->dlgBgdBitmap != NULL) && (fullScreen==DLG_USE_BITMAP)) | |
1225 { | |
1226 bmp.format = data->dlgBgdBitmap->icnType; | |
1227 bmp.height = data->dlgBgdBitmap->area.sy; | |
1228 bmp.width = data->dlgBgdBitmap->area.sx; | |
1229 bmp.bitmap = data->dlgBgdBitmap->icons; | |
1230 bmpPtr = &bmp; | |
1231 area = calcLayout(data->dlgType, sx, sy, bmp.width, bmp.height); | |
1232 | |
1233 //Adjust size of available area depending on bitmap properties/dlgType. | |
1234 //dlgType== 0 =>display info in centre of bitmap | |
1235 if (data->dlgType == 0) | |
1236 { | |
1237 //If the bmp is bigger than the data we will move the bmp to | |
1238 //lie over the centre of the data | |
1239 area.px = area.px - (bmp.width - sx)/2; | |
1240 area.py = area.py - (bmp.height- sy)/2; | |
1241 } | |
1242 for (i=0;i<MAX_DLG_LINES;i++) | |
1243 { | |
1244 xPos[i] = xPos[i] + area.px; | |
1245 yPos[i] = yPos[i] + area.py; | |
1246 } | |
1247 | |
1248 TRACE_EVENT_P3("wy = %d, yOfs = %d, area.py = %d",wy,yOfs,area.py); | |
1249 if( data->dlgBgdBitmap->icnType != ICON_TYPE_1BIT_UNPACKED ) | |
1250 dspl_SetBgdColour( COL_TRANSPARENT ); | |
1251 | |
1252 | |
1253 } | |
1254 else | |
1255 { | |
1256 // x0066814 06 Dec 2006, OMAPS00106825 | |
1257 //The window height calculation related to wrapping should be skipped when no | |
1258 //string wrapping is done | |
1259 if(wrapLine>0) | |
1260 { | |
1261 sy = sy + (wrapLine-1)*Mmi_layout_line_height(); | |
1262 } | |
1263 area.sy = sy; | |
1264 } | |
1265 #else | |
1266 if (wrapLine>1) | |
1267 { | |
1268 sy = sy + (wrapLine-1)*Mmi_layout_line_height(); | |
1269 area.sy = sy; | |
1270 } | |
1271 #endif | |
1272 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
1273 //If length of the dialog is bigger than screen then start the dialog from the top corner. | |
1274 if(sy+wy >= SCREEN_SIZE_Y && sy < SCREEN_SIZE_Y) | |
1275 if(wy>0 && wy < sy) | |
1276 { | |
1277 wy = (SCREEN_SIZE_Y - sy ) /2 ;// centre the dialog | |
1278 if(wy < 0) | |
1279 wy=0; | |
1280 for (i=0;i<MAX_DLG_LINES;i++) | |
1281 yPos[i] = wy+yOfs+yBmpOfs+Mmi_layout_line_height()*i; | |
1282 } | |
1283 dspl_DrawWin( wx,wy,sx,sy, drawWinType , bmpPtr); | |
1284 } | |
1285 else | |
1286 { | |
1287 dspl_ClearAll(); | |
1288 sx = 84; | |
1289 for (i=0;i<MAX_DLG_LINES;i++) | |
1290 { | |
1291 xPos[i] = 0; | |
1292 yPos[i] = Mmi_layout_line(i+1); | |
1293 } | |
1294 } | |
1295 /****************************** | |
1296 * Print softkeys | |
1297 *****************************/ | |
1298 icnShow(data->icon); | |
1299 if ((lskStr != NULL) || (rskStr != NULL)) | |
1300 { | |
1301 if (fullScreen==DLG_USE_FULL_SCREEN) | |
1302 Mmi_layout_softkeyArea( &skArea ); | |
1303 else | |
1304 { | |
1305 skArea.px = area.px+wx; | |
1306 skArea.sx = area.sx; | |
1307 skArea.py = area.py+wy+area.sy-Mmi_layout_softkeyHeight()-1; | |
1308 skArea.sy = Mmi_layout_softkeyHeight(); | |
1309 } | |
1310 softKeys_displayStrXY(lskStr, rskStr, data->dlgSkFormat, data->dlgCol, &skArea); | |
1311 } | |
1312 | |
1313 /****************************** | |
1314 * Print dialog text | |
1315 *****************************/ | |
1316 for (i=0;i<MAX_DLG_LINES;i++) | |
1317 { /* GW#2294 No need to draw zero length strings .*/ | |
1318 if ((str[i] != NULL) && (strLen[i] > 0)) | |
1319 { | |
1320 //x0035544 Feb 15, 2006. DR:OMAPS00061467 | |
1321 #ifdef FF_MMI_SAT_ICON | |
1322 if(data->IconData.selfExplanatory == FALSE) | |
1323 dspl_TextOut(xPos[i] + titleIconWidth, yPos[i], DSPL_TXTATTR_NORMAL, str[i] ); | |
1324 #else | |
1325 dspl_TextOut(xPos[i] , yPos[i], DSPL_TXTATTR_NORMAL, str[i] ); | |
1326 #endif | |
1327 } | |
1328 } | |
1329 //x0035544 Feb 15, 2006. DR:OMAPS00061467 | |
1330 #ifdef FF_MMI_SAT_ICON | |
1331 if(data->IconData.dst != NULL) | |
1332 { | |
1333 if(str[DLG_LINE2] == NULL) | |
1334 { | |
1335 if ((data->IconData.width > TITLE_ICON_WIDTH) || | |
1336 (data->IconData.height > TITLE_ICON_HEIGHT)) | |
1337 { | |
1338 dspl_BitBlt2(xPos[0], yPos[0], 8, | |
1339 10, (void*)SATIconQuestionMark, 0, BMP_FORMAT_256_COLOUR); | |
1340 } | |
1341 | |
1342 else | |
1343 dspl_BitBlt2(xPos[0], yPos[0], data->IconData.width, | |
1344 data->IconData.height, (void*)data->IconData.dst, 0, BMP_FORMAT_256_COLOUR); | |
1345 } | |
1346 else | |
1347 { | |
1348 if ((data->IconData.width > TITLE_ICON_WIDTH) || | |
1349 (data->IconData.height > TITLE_ICON_HEIGHT)) | |
1350 { | |
1351 dspl_BitBlt2(xPos[DLG_LINE2], yPos[DLG_LINE2], 8, | |
1352 10, (void*)SATIconQuestionMark, 0, BMP_FORMAT_256_COLOUR); | |
1353 } | |
1354 else | |
1355 dspl_BitBlt2(xPos[DLG_LINE2], yPos[DLG_LINE2],data->IconData.width, | |
1356 data->IconData.height, (void*)data->IconData.dst, 0, BMP_FORMAT_256_COLOUR); | |
1357 } | |
1358 | |
1359 } | |
1360 #endif | |
1361 | |
1362 | |
1363 resources_restoreColour(); | |
1364 } | |
1365 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
1366 // Now free the allocated memory | |
1367 /* x0039928 - Lint warning removal */ | |
1368 if (strLen[MAX_DLG_LINES] > scrWidth-charWidth) | |
1369 if (data->WrapStrings & WRAP_STRING_2) | |
1370 if (str[MAX_DLG_LINES][0] != (char)0x80) /* x0039928 - lint warning removal */ | |
1371 { | |
1372 for(i=DLG_LINE2;i<MAX_DLG_LINES;i++) | |
1373 { | |
1374 if(NULL != str[i] && strLen[i] > 0) | |
1375 mfwFree((U8*)str[i],MAX_WRAP_CHAR); | |
1376 } | |
1377 str[MAX_DLG_LINES]=NULL; | |
1378 } | |
1379 | |
1380 break; | |
1381 default: | |
1382 return 0; | |
1383 } | |
1384 | |
1385 return 1; | |
1386 } | |
1387 | |
1388 /******************************************************************************* | |
1389 | |
1390 $Function: dialog_info_tim_cb | |
1391 | |
1392 $Description: Callback function for the dialog info timer. | |
1393 | |
1394 | |
1395 $Returns: MFW event handler | |
1396 | |
1397 $Arguments: window handle event, timer control block | |
1398 | |
1399 *******************************************************************************/ | |
1400 static T_MFW_CB dialog_info_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc) | |
1401 { | |
1402 T_MFW_HND win = mfw_parent (mfw_header()); | |
1403 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
1404 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
1405 | |
1406 T_MFW_HND parent_win = data->parent_win; | |
1407 USHORT Identifier = data->Identifier; | |
1408 void (* Callback)() = data->Callback; | |
1409 | |
1410 TRACE_FUNCTION("dialog_info_tim_cb()"); | |
1411 #if defined (WIN32) | |
1412 { | |
1413 /***************************Go-lite Optimization changes Start***********************/ | |
1414 | |
1415 //Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
1416 TRACE_EVENT_P1 ("Identifier %d", data->Identifier); | |
1417 /***************************Go-lite Optimization changes end***********************/ | |
1418 | |
1419 } | |
1420 #endif | |
1421 | |
1422 /* | |
1423 ** SPR#1744 NDH | |
1424 ** Move the dialog destory in front of the Callback to make the processing consistent | |
1425 ** with the Right Keypress and Hangup Processing. Also to ensure that the dialog is | |
1426 ** removed when the screen is redrawn. | |
1427 */ | |
1428 dialog_info_destroy (win); | |
1429 | |
1430 //TISH modified for MSIM | |
1431 // if (Callback) | |
1432 if (Callback && parent_win) | |
1433 (Callback) (parent_win, Identifier, INFO_TIMEOUT); | |
1434 | |
1435 return 0; | |
1436 } | |
1437 | |
1438 | |
1439 /******************************************************************************* | |
1440 | |
1441 $Function: dialog_info_kbd_cb | |
1442 | |
1443 $Description: Keyboard event handler | |
1444 | |
1445 $Returns: status int | |
1446 | |
1447 $Arguments: window handle event, keyboard control block | |
1448 | |
1449 *******************************************************************************/ | |
1450 | |
1451 static int dialog_info_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard) | |
1452 { | |
1453 T_MFW_HND win = mfw_parent (mfw_header()); | |
1454 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
1455 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
1456 T_MFW_HND parent_win = data->parent_win; | |
1457 USHORT Identifier = data->Identifier; | |
1458 void (* Callback)() = data->Callback; | |
1459 | |
1460 TRACE_FUNCTION("dialog_info_kbd_cb"); | |
1461 switch (keyboard->code) | |
1462 { | |
1463 case KCD_LEFT: | |
1464 if (data->KeyEvents & KEY_LEFT ) | |
1465 { | |
1466 TRACE_EVENT("dialog_info_kbd_cb: KEY_LEFT"); | |
1467 | |
1468 dialog_info_destroy (win); | |
1469 if (Callback) | |
1470 (Callback) (parent_win, Identifier, INFO_KCD_LEFT); | |
1471 } | |
1472 break; | |
1473 | |
1474 case KCD_RIGHT: | |
1475 if (data->KeyEvents & KEY_RIGHT) | |
1476 { | |
1477 dialog_info_destroy (win); | |
1478 if (Callback) | |
1479 (Callback) (parent_win, Identifier, INFO_KCD_RIGHT); | |
1480 } | |
1481 break; | |
1482 | |
1483 case KCD_HUP: | |
1484 if (data->KeyEvents & KEY_HUP || data->KeyEvents & INFO_KCD_ALL) | |
1485 { | |
1486 dialog_info_destroy (win); | |
1487 if (Callback) | |
1488 (Callback) (parent_win, Identifier, INFO_KCD_HUP); | |
1489 } | |
1490 break; | |
1491 case KCD_MNUUP: | |
1492 | |
1493 if (data->KeyEvents & KEY_MNUUP) | |
1494 { | |
1495 if (Callback) | |
1496 (Callback) (parent_win, Identifier, INFO_KCD_UP); | |
1497 } | |
1498 | |
1499 break; | |
1500 case KCD_MNUDOWN: | |
1501 | |
1502 if (data->KeyEvents & KEY_MNUDOWN) | |
1503 { | |
1504 if (Callback) | |
1505 (Callback) (parent_win, Identifier, INFO_KCD_DOWN); | |
1506 } | |
1507 | |
1508 break; | |
1509 //MZ 7/3/01 used to start a call. | |
1510 case KCD_CALL: | |
1511 if (data->KeyEvents & KEY_CALL ) | |
1512 { | |
1513 dialog_info_destroy (win); | |
1514 if (Callback) | |
1515 (Callback) (parent_win, Identifier, INFO_KCD_OFFHOOK); | |
1516 } | |
1517 break; | |
1518 default: | |
1519 if (data->KeyEvents & INFO_KCD_ALL) | |
1520 { | |
1521 TRACE_EVENT("dialog_info_kbd_cb: INFO_KCD_ALL"); | |
1522 | |
1523 /* | |
1524 Note: The variable Identifier is overwritten with the | |
1525 keycode of the dialog; | |
1526 we need it only for the Multicall Control !! | |
1527 */ | |
1528 Identifier = keyboard->code; | |
1529 dialog_info_destroy (win); | |
1530 if (Callback) | |
1531 (Callback) (parent_win, Identifier, INFO_KCD_ALL); | |
1532 } | |
1533 break; | |
1534 | |
1535 } | |
1536 return MFW_EVENT_CONSUMED; | |
1537 } | |
1538 | |
1539 static int dialog_info_kbd_long_cb(T_MFW_EVENT event, T_MFW_KBD *keyboard){ | |
1540 return MFW_EVENT_CONSUMED; | |
1541 } | |
1542 | |
1543 | |
1544 | |
1545 /******************************************************************************* | |
1546 | |
1547 $Function: mmi_dialog_information_screen | |
1548 | |
1549 $Description: | |
1550 | |
1551 $Returns: | |
1552 | |
1553 $Arguments: | |
1554 | |
1555 *******************************************************************************/ | |
1556 | |
1557 T_MFW_HND mmi_dialog_information_screen(T_MFW_HND parent_win, int TxtId, char* text, T_VOID_FUNC call_back, USHORT identifier) | |
1558 { | |
1559 T_DISPLAY_DATA display_info; | |
1560 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtId, TxtNull, COLOUR_STATUS); | |
1561 dlg_initDisplayData_events( &display_info, call_back, THREE_SECS, KEY_ALL ); | |
1562 //Sep 01, 2004 REF: CRR 21380 Deepa M.D | |
1563 //Assigning TextId and TextString will not display both the messages. | |
1564 //Hence we need to use TextId and TextString2 or TextId2 and TextString | |
1565 display_info.TextString2 = text; | |
1566 display_info.Identifier = identifier; | |
1567 return info_dialog(parent_win,&display_info); //information screen | |
1568 | |
1569 } | |
1570 | |
1571 T_MFW_HND mmi_dialog_information_screen_forever(MfwHnd win,int TextId, char* TextStr, int colour) | |
1572 { | |
1573 T_DISPLAY_DATA DisplayInfo; | |
1574 dlg_initDisplayData_TextId( &DisplayInfo, TxtNull, TxtNull, TextId, TxtNull, colour); | |
1575 dlg_initDisplayData_events( &DisplayInfo, NULL, FOREVER, KEY_HUP ); | |
1576 DisplayInfo.TextString = TextStr; | |
1577 return info_dialog(win, &DisplayInfo); | |
1578 } | |
1579 | |
1580 /******************************************************************************* | |
1581 | |
1582 $Function: mmi_dialogs_insert_icon | |
1583 | |
1584 $Description: Displays one icon in a dialog | |
1585 | |
1586 $Returns: none | |
1587 | |
1588 $Arguments: win, pointer to an icon | |
1589 | |
1590 *******************************************************************************/ | |
1591 void mmi_dialogs_insert_icon (T_MFW_HND win_dialog ,MfwIcnAttr *icon) | |
1592 { | |
1593 T_MFW_WIN * win_data = ((T_MFW_HDR *)win_dialog)->data; | |
1594 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
1595 | |
1596 | |
1597 data->icon = icnCreate(win_dialog,icon,E_ICN_VISIBLE,NULL); | |
1598 icnUnhide(data->icon); | |
1599 winShow(win_dialog); | |
1600 | |
1601 } | |
1602 | |
1603 /******************************************************************************* | |
1604 | |
1605 $Function: mmi_dialogs_insert_animation | |
1606 | |
1607 $Description: starts an animation in a dialog | |
1608 | |
1609 $Returns: none | |
1610 | |
1611 $Arguments: win, animation time, pointer to an icon, number of frames | |
1612 | |
1613 *******************************************************************************/ | |
1614 void mmi_dialogs_insert_animation (T_MFW_HND win_dialog , S32 anim_time ,MfwIcnAttr *icon ,UBYTE number_of_frames) | |
1615 { | |
1616 T_MFW_WIN * win_data = ((T_MFW_HDR *)win_dialog)->data; | |
1617 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
1618 | |
1619 | |
1620 data->number_of_frames = number_of_frames; | |
1621 data->current_frame = 0; | |
1622 data->icon_array = icon; | |
1623 data->current_icon = data->icon_array; | |
1624 data->icon = icnCreate(win_dialog,data->current_icon,E_ICN_VISIBLE,NULL); | |
1625 icnUnhide(data->icon); | |
1626 | |
1627 data->animation_timer = timCreate(win_dialog,anim_time,(MfwCb)mmi_dialogs_insert_animation_CB); | |
1628 timStart(data->animation_timer); | |
1629 winShow(win_dialog); | |
1630 | |
1631 } | |
1632 | |
1633 /******************************************************************************* | |
1634 | |
1635 $Function: mmi_dialogs_insert_animation_CB | |
1636 | |
1637 $Description: destroys the current icon and starts the next icon | |
1638 | |
1639 $Returns: none | |
1640 | |
1641 $Arguments: timer event, timer control block | |
1642 | |
1643 *******************************************************************************/ | |
1644 void mmi_dialogs_insert_animation_CB (T_MFW_EVENT event, T_MFW_TIM *tc) | |
1645 { | |
1646 T_MFW_HND win = mfw_parent (mfw_header()); | |
1647 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
1648 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
1649 | |
1650 | |
1651 icnDelete(data->icon); | |
1652 if (data->current_frame < (data->number_of_frames-1)) | |
1653 { | |
1654 data->current_frame++; | |
1655 data->current_icon++; | |
1656 } | |
1657 else | |
1658 { | |
1659 data->current_frame = 0; | |
1660 data->current_icon = data->icon_array; | |
1661 } | |
1662 data->icon = icnCreate(win,data->current_icon,E_ICN_VISIBLE,NULL); | |
1663 icnUnhide(data->icon); | |
1664 timStart(data->animation_timer); | |
1665 winShow(win); | |
1666 | |
1667 } | |
1668 /***************************Go-lite Optimization changes Start***********************/ | |
1669 | |
1670 //Aug 25, 2004 REF: CRR 24904 Deepa M.D | |
1671 //This function is used only for the Color build.Hence it is put under the | |
1672 //COLOURDISPLAY compiler switch | |
1673 #ifdef COLOURDISPLAY | |
1674 void mmi_dialogs_insert_animation_new (T_DISPLAY_DATA *animateInfo , S32 anim_time ,MfwIcnAttr* icon ,UBYTE number_of_frames) | |
1675 { | |
1676 TRACE_EVENT("mmi_dialogs_insert_animation_new()"); | |
1677 | |
1678 animateInfo->number_of_frames = number_of_frames; | |
1679 animateInfo->current_frame = 0; | |
1680 animateInfo->icon_array = icon; | |
1681 animateInfo->anim_time = anim_time; | |
1682 | |
1683 } | |
1684 #endif | |
1685 /***************************Go-lite Optimization changes end***********************/ | |
1686 | |
1687 void mmi_dialogs_animation_new_CB (T_MFW_EVENT event, T_MFW_TIM *tc) | |
1688 { | |
1689 T_MFW_HND win = mfw_parent (mfw_header()); | |
1690 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
1691 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
1692 char * idData; | |
1693 int px, py, sx, sy; | |
1694 MfwIcnAttr* icn_array; | |
1695 MfwIcnAttr* icn; | |
1696 | |
1697 TRACE_EVENT("mmi_dialogs_insert_animation_new_CB()"); | |
1698 | |
1699 | |
1700 | |
1701 data->current_frame = (data->current_frame +1) % data->number_of_frames; | |
1702 TRACE_EVENT_P1("data->current_frame = %d", data->current_frame); | |
1703 TRACE_EVENT_P1("number_of_frames = %d", data->number_of_frames); | |
1704 | |
1705 icn_array = (MfwIcnAttr*)data->icon_array; | |
1706 TRACE_EVENT_P1("data->icon_array = %x", (int)data->icon_array); | |
1707 | |
1708 icn = &icn_array[data->current_frame]; | |
1709 | |
1710 px = icn->area.px; | |
1711 py = icn->area.py; | |
1712 sx = icn->area.sx; | |
1713 sy = icn->area.sy; | |
1714 | |
1715 TRACE_EVENT_P4("px = %d, py = %d, sx = %d, sy = %d", icn->area.px,icn->area.py,icn->area.sx,icn->area.sy); | |
1716 | |
1717 idData = icn->icons; | |
1718 | |
1719 dspl_BitBlt2(px,py,sx,sy,(void*)idData,0,0x02); | |
1720 timStart(data->animation_timer); | |
1721 | |
1722 } | |
1723 //Jun 04,2004 CRR:13601 xpradipg - SASKEN | |
1724 /******************************************************************************* | |
1725 | |
1726 $Function: InfoDialogTimRestart | |
1727 | |
1728 $Description: restarts the information dialog timer | |
1729 | |
1730 $Returns: none | |
1731 | |
1732 $Arguments: window handler | |
1733 | |
1734 *******************************************************************************/ | |
1735 | |
1736 void InfoDialogTimRestart(T_MFW_HND win) | |
1737 { | |
1738 T_MFW_WIN * win_data; | |
1739 T_dialog_info * data; | |
1740 | |
1741 win_data = ((T_MFW_HDR *)win)->data; | |
1742 data = (T_dialog_info *)win_data->user; | |
1743 | |
1744 tim_stop(data->info_tim); | |
1745 tim_start(data->info_tim); | |
1746 } | |
1747 | |
1748 // Feb 24, 2005 CRR:29102 xnkulkar - SASKEN | |
1749 // As the user has already confirmed that all SMS messages are to be deleted, KEY_HUP is not | |
1750 // registered. | |
1751 /******************************************************************************* | |
1752 | |
1753 $Function: mmi_dialog_information_screen_delete_all | |
1754 | |
1755 $Description: Displays the information screen during "Delete All" operation | |
1756 | |
1757 $Returns: Handle of information dialog | |
1758 | |
1759 $Arguments: window handle, text id, text string and generic status window | |
1760 | |
1761 *******************************************************************************/ | |
1762 T_MFW_HND mmi_dialog_information_screen_delete_all(MfwHnd win,int TextId, char* TextStr, int colour) | |
1763 { | |
1764 T_DISPLAY_DATA DisplayInfo; | |
1765 | |
1766 dlg_initDisplayData_TextId( &DisplayInfo, TxtNull, TxtNull, TextId, TxtNull, colour); | |
1767 dlg_initDisplayData_events( &DisplayInfo, NULL, FOREVER, NULL ); | |
1768 DisplayInfo.TextString = TextStr; | |
1769 | |
1770 return info_dialog(win, &DisplayInfo); | |
1771 } | |
1772 | |
1773 //x0peela 02 Apr, 2007 ER: OMAPS00122561 | |
1774 #ifdef FF_PHONE_LOCK | |
1775 /******************************************************************************* | |
1776 | |
1777 $Function: phlock_info_dialog | |
1778 | |
1779 $Description: Common information dialog | |
1780 | |
1781 $Returns: Dialogue info win | |
1782 | |
1783 $Arguments: parent win, display info | |
1784 | |
1785 *******************************************************************************/ | |
1786 T_MFW_HND phlock_info_dialog (T_MFW_HND parent_win, | |
1787 T_DISPLAY_DATA * display_info) | |
1788 { | |
1789 T_MFW_HND win; | |
1790 TRACE_FUNCTION("phlock_info_dialog()"); | |
1791 display_info->SoftKeyStrings = FALSE; | |
1792 | |
1793 win = phlock_dialog_info_create (parent_win); | |
1794 | |
1795 if (win NEQ NULL) | |
1796 { | |
1797 SEND_EVENT (win, DIALOG_INIT, 0, display_info); | |
1798 } | |
1799 return win; | |
1800 } | |
1801 | |
1802 /******************************************************************************* | |
1803 | |
1804 $Function: phlock_dialog_info_create | |
1805 | |
1806 $Description: Creation of an information dialog | |
1807 | |
1808 $Returns: Dialogue info win | |
1809 | |
1810 $Arguments: parent win | |
1811 | |
1812 *******************************************************************************/ | |
1813 static T_MFW_HND phlock_dialog_info_create (T_MFW_HND parent_win) | |
1814 { | |
1815 T_MFW_WIN * win_data; | |
1816 T_dialog_info * data = (T_dialog_info *)ALLOC_MEMORY (sizeof (T_dialog_info)); | |
1817 TRACE_FUNCTION ("phlock_dialog_info_create()"); | |
1818 | |
1819 data->info_win = win_create (parent_win, 0, E_WIN_VISIBLE, (T_MFW_CB)phlock_dialog_info_win_resize_cb); | |
1820 | |
1821 if (data->info_win EQ 0) | |
1822 return 0; | |
1823 TRACE_EVENT_P1("phlock_dialog_info_create:data->info_win:%02x", data->info_win); | |
1824 /* | |
1825 * Create window handler | |
1826 */ | |
1827 data->mmi_control.dialog = (T_DIALOG_FUNC)phlock_dialog_info; | |
1828 data->mmi_control.data = data; | |
1829 data->parent_win = parent_win; | |
1830 win_data = ((T_MFW_HDR *)data->info_win)->data; | |
1831 win_data->user = (void *)data; | |
1832 | |
1833 /* | |
1834 * return window handle | |
1835 */ | |
1836 return data->info_win; | |
1837 } | |
1838 | |
1839 /******************************************************************************* | |
1840 | |
1841 $Function: phlock_dialog_info_win_resize_cb | |
1842 | |
1843 $Description: Creation of an information dialog | |
1844 | |
1845 $Returns: Dialogue info win | |
1846 | |
1847 $Arguments: parent win | |
1848 | |
1849 *******************************************************************************/ | |
1850 static int phlock_dialog_info_win_resize_cb (T_MFW_EVENT event, T_MFW_WIN * win) | |
1851 { | |
1852 T_dialog_info * data = (T_dialog_info *)win->user; | |
1853 // T_DISPLAY_DATA * display_info; // RAVI | |
1854 int xPos[MAX_DLG_LINES]; | |
1855 int yPos[MAX_DLG_LINES]; | |
1856 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
1857 //The size of array str and strlen are increased by 1, so that the last elements holds data | |
1858 // which is used while wrapping the text. | |
1859 char* str[MAX_DLG_LINES+1]; | |
1860 int strLen[MAX_DLG_LINES+1]; | |
1861 int i; | |
1862 char* lskStr,*rskStr; | |
1863 int wx = 0; //,wy,sx=0,sy=0; // RAVI | |
1864 int wy = 0; // RAVI | |
1865 int sx = 0; // RAVI | |
1866 int sy = 0; // RAVI | |
1867 int fullScreen = DLG_USE_RECTANGLE; | |
1868 int yOfs; | |
1869 int yBmpOfs = 0; | |
1870 MfwRect skArea; | |
1871 //x0035544 Feb 15, 2006. DR:OMAPS00061467 | |
1872 #ifdef FF_MMI_SAT_ICON | |
1873 USHORT titleIconWidth = 0; | |
1874 #endif | |
1875 MfwRect area; | |
1876 int scrWidth = 0; //available width for the display // RAVI - Assignment to 0. | |
1877 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
1878 // temp_ptr is used while wrapping the text. | |
1879 // Now str2[][] is not required. | |
1880 char *temp_ptr; | |
1881 int nChar; | |
1882 | |
1883 /* t_font_bitmap bmp; */ /* Warning Removal - x0020906 - 24-08-2006 */ | |
1884 // t_font_bitmap* bmpPtr = &bmp; // RAVI - Not Referenced. | |
1885 | |
1886 int drawWinType; | |
1887 int nLines; | |
1888 | |
1889 int linePos=0; | |
1890 int lineLen = 0; | |
1891 int wrapLine = 0; /*GW #2294*/ // x0066814 06 Dec 2006, OMAPS00106825 | |
1892 | |
1893 const int charWidth = dspl_GetTextExtent("0",1); | |
1894 TRACE_FUNCTION ("phlock_dialog_info_win_resize_cb()"); | |
1895 | |
1896 memset(str,'\0',sizeof(str)); /* x0039928 - Lint warning fix */ | |
1897 memset(strLen,0,sizeof(strLen)); | |
1898 //x0035544 Feb 15, 2006. DR:OMAPS00061467 | |
1899 #ifdef FF_MMI_SAT_ICON | |
1900 if (data->IconData.dst != NULL) | |
1901 { | |
1902 if (data->IconData.width > TITLE_ICON_WIDTH) | |
1903 { | |
1904 titleIconWidth = TITLE_ICON_WIDTH; | |
1905 } | |
1906 else | |
1907 { | |
1908 titleIconWidth = data->IconData.width ; | |
1909 } | |
1910 } | |
1911 else | |
1912 { | |
1913 titleIconWidth = 0; | |
1914 } | |
1915 | |
1916 #endif | |
1917 if (data EQ 0) | |
1918 return 1; | |
1919 | |
1920 switch (event) | |
1921 { | |
1922 case E_WIN_VISIBLE: | |
1923 if (win->flags & E_WIN_VISIBLE) | |
1924 { | |
1925 /* | |
1926 * Print the information dialog | |
1927 */ | |
1928 for (i=0;i<MAX_DLG_LINES;i++) | |
1929 { | |
1930 xPos[i]=0; | |
1931 yPos[i] = Mmi_layout_line_height()*i; | |
1932 str[i]=NULL; | |
1933 strLen[i]=0; | |
1934 } | |
1935 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
1936 // Assign the values to last elments of the array str and strLen | |
1937 str[MAX_DLG_LINES] = NULL; | |
1938 strLen[MAX_DLG_LINES] = 0; | |
1939 yOfs = Mmi_layout_line_height()/4; | |
1940 if (data->TextId != 0) | |
1941 str[DLG_LINE1] = MmiRsrcGetText( data->TextId); | |
1942 else | |
1943 str[DLG_LINE1] = data->TextString; | |
1944 | |
1945 if (data->TextId2 != 0) | |
1946 str[DLG_LINE2] = MmiRsrcGetText( data->TextId2); | |
1947 else | |
1948 str[DLG_LINE2] = data->TextString2; | |
1949 | |
1950 if (data->SoftKeyStrings!=0) | |
1951 { | |
1952 lskStr = data->LSKString; | |
1953 rskStr = data->RSKString; | |
1954 } | |
1955 else | |
1956 { | |
1957 if (data->LeftSoftKey != TxtNull) | |
1958 lskStr = MmiRsrcGetText(data->LeftSoftKey); | |
1959 else | |
1960 lskStr = NULL; | |
1961 | |
1962 if (data->RightSoftKey != TxtNull) | |
1963 rskStr = MmiRsrcGetText(data->RightSoftKey); | |
1964 else | |
1965 rskStr = NULL; | |
1966 } | |
1967 | |
1968 if ((str[DLG_LINE1]!= NULL) || (str[DLG_LINE2]!=NULL)) | |
1969 { //Draw a window for status info | |
1970 if (str[DLG_LINE2] == NULL) | |
1971 { | |
1972 sy = Mmi_layout_line_height()+yOfs*2; // 18 or 12 | |
1973 | |
1974 } | |
1975 else | |
1976 { | |
1977 sy = Mmi_layout_line_height()*2+yOfs*3; // 33 or 22 | |
1978 } | |
1979 | |
1980 //MC, if (Mmi_getCurrentLanguage() != CHINESE_LANGUAGE) | |
1981 { //calculate longest string - use this to calc width of window | |
1982 sx = 0; | |
1983 if ((lskStr!=NULL) || (rskStr!=NULL)) | |
1984 { | |
1985 sy = sy+Mmi_layout_softkeyHeight()+yOfs*2; | |
1986 sx = sx + 10; | |
1987 if (lskStr != NULL) | |
1988 { | |
1989 sx = sx + dspl_GetTextExtent(lskStr, 0); | |
1990 } | |
1991 if (rskStr != NULL) | |
1992 { | |
1993 sx = sx + dspl_GetTextExtent(rskStr,0); | |
1994 } | |
1995 | |
1996 } | |
1997 for (i=DLG_LINE1;i<=DLG_LINE2;i++) | |
1998 { | |
1999 strLen[i] = dspl_GetTextExtent(str[i],0); | |
2000 } | |
2001 | |
2002 /* Work out the desired width of the dialog. If we can wrap line 2 and it is long, wrap it */ | |
2003 if (data->WrapStrings & WRAP_STRING_2) | |
2004 nLines = MAX_WRAP_LINES; | |
2005 else | |
2006 nLines = 1; | |
2007 #ifdef COLOURDISPLAY | |
2008 if (data->dlgBgdBitmap!=NULL) | |
2009 { | |
2010 //we only have room to split line 2 into 'max_lines_dlg_popup' lines in the pop-up. | |
2011 //NB this should be calculated depending on the height of the popup bitmap. | |
2012 const int max_lines_dlg_popup=2; | |
2013 if (nLines>max_lines_dlg_popup) | |
2014 nLines = max_lines_dlg_popup; | |
2015 scrWidth = (data->dlgBgdBitmap->area.sx * 3)/4; //the max width is about 3/4 of the pop-up | |
2016 if ( (strLen[DLG_LINE2] > (scrWidth-charWidth)*nLines) || | |
2017 (strLen[DLG_LINE1] > scrWidth)) | |
2018 { | |
2019 //recalculate width below. | |
2020 if (data->WrapStrings & WRAP_STRING_2) | |
2021 nLines = MAX_WRAP_LINES; | |
2022 fullScreen = DLG_USE_RECTANGLE; | |
2023 } | |
2024 else | |
2025 { | |
2026 fullScreen = DLG_USE_BITMAP; | |
2027 //Leave width as is | |
2028 } | |
2029 } | |
2030 #else | |
2031 //On a C-sample, limit pop-up lines to 2 extra (any more - use entire screen) | |
2032 { | |
2033 const int max_lines_dlg_popup=2; | |
2034 if (nLines>max_lines_dlg_popup) | |
2035 nLines = max_lines_dlg_popup; | |
2036 } | |
2037 | |
2038 #endif | |
2039 if (fullScreen == DLG_USE_RECTANGLE) | |
2040 { | |
2041 //see if we can display as a pop-up | |
2042 if (SCREEN_SIZE_X < 128) | |
2043 scrWidth = SCREEN_SIZE_X-6; | |
2044 else | |
2045 scrWidth = (SCREEN_SIZE_X*7)/8; | |
2046 if ( strLen[DLG_LINE2] > (scrWidth-charWidth)*nLines) | |
2047 { | |
2048 //Cannot fit in as a pop-up - use full screen | |
2049 fullScreen = DLG_USE_FULL_SCREEN; | |
2050 scrWidth = SCREEN_SIZE_X; | |
2051 } | |
2052 else | |
2053 { | |
2054 //We can fit it in - but we may want to reduce the width for a nicer look. | |
2055 } | |
2056 } | |
2057 | |
2058 /* | |
2059 * Wrap second text line (e.g. for long phone numbers.) | |
2060 */ | |
2061 if (strLen[DLG_LINE2] > scrWidth-charWidth) | |
2062 { | |
2063 //If we can fit the string on 2 lines - do it. | |
2064 if (data->WrapStrings & WRAP_STRING_2) | |
2065 { | |
2066 if (str[DLG_LINE2][0] != (char)0x80) //not unicode /* x0039928 -Lint warning removal */ | |
2067 { | |
2068 wrapLine = 0; | |
2069 lineLen = strlen(str[DLG_LINE2]); | |
2070 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
2071 // memset is not required any more . | |
2072 //Now the last element of the str[] will point to the second string of the dialog | |
2073 str[MAX_DLG_LINES] = str[DLG_LINE2]; // Now move the second line of text to the last element of the arrya | |
2074 strLen[MAX_DLG_LINES] = strLen[DLG_LINE2];// put the right value for the length of the string | |
2075 str[DLG_LINE2] = NULL ; // Assign NULL to the second element of the array. | |
2076 while ((wrapLine < MAX_WRAP_LINES) && (linePos<lineLen)) | |
2077 { | |
2078 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
2079 // Instead of DLG_LINE2 use MAX_DLG_LINES | |
2080 nChar = dspl_GetNcharToFit (&str[MAX_DLG_LINES][linePos], (USHORT)scrWidth); | |
2081 if (nChar > MAX_WRAP_CHAR) | |
2082 nChar = MAX_WRAP_CHAR; | |
2083 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
2084 // Allocate MAX_WRAP_CHAR no of bytes | |
2085 temp_ptr = (char*)mfwAlloc(MAX_WRAP_CHAR); | |
2086 if(NULL == temp_ptr) | |
2087 return 0; | |
2088 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
2089 // Now the destination of memcpy is temp_ptr instead of str2[wrapLine] and the source is str[MAX_DLG_LINES] instead of str[DLG_LINE2] | |
2090 memcpy(temp_ptr,&str[MAX_DLG_LINES][linePos],nChar); // Now the source data is from the last element of the array. | |
2091 linePos = linePos+nChar; | |
2092 ////GW - even if we cannot display the entire string - it is better than what we would have otherwise | |
2093 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
2094 // Assign the value of pointer temp_ptr to str[] | |
2095 str[DLG_LINE2+wrapLine] = temp_ptr; | |
2096 temp_ptr = NULL; | |
2097 strLen[DLG_LINE2 + wrapLine] = dspl_GetTextExtent(str[DLG_LINE2+wrapLine],0); | |
2098 wrapLine++; | |
2099 } | |
2100 | |
2101 } | |
2102 else | |
2103 { | |
2104 //Unicode is more problematic - we need the 0x80 at the front of the string | |
2105 //for the call to 'dspl_GetNcharToFit'. This will involve copying the entire remainder | |
2106 //of 'str2' into a temporary buffer. At the moment, we only wrap numbers so this | |
2107 //code will wait until it is required. | |
2108 // str[3] = "Code not written!!"; //issue warning | |
2109 // strLen[3] = dspl_GetTextExtent(str[3],0); | |
2110 fullScreen = DLG_USE_FULL_SCREEN; //error - use full screen | |
2111 } | |
2112 } | |
2113 } | |
2114 | |
2115 //Calculate longest line of text (including softkeys - sx already set to the softkey width) | |
2116 for (i=0;i< MAX_DLG_LINES;i++) | |
2117 { | |
2118 if (strLen[i]>sx) | |
2119 sx = strLen[i]; | |
2120 } | |
2121 if (sx > SCREEN_SIZE_X-charWidth) | |
2122 sx = SCREEN_SIZE_X; | |
2123 else | |
2124 { | |
2125 if (sx > SCREEN_SIZE_X/2) | |
2126 sx = sx + charWidth; | |
2127 else | |
2128 sx = sx + charWidth*2; | |
2129 } | |
2130 if (sy> sx) | |
2131 sx = sy; | |
2132 wx = (SCREEN_SIZE_X-sx)/2; | |
2133 if (wx<0) | |
2134 wx=0; | |
2135 } | |
2136 | |
2137 if (sy > SCREEN_SIZE_Y) | |
2138 wy = 0; | |
2139 else if (SCREEN_SIZE_Y > 2*sy) | |
2140 wy = (SCREEN_SIZE_Y*2/3-sy)/2; //display in middle of top 2/3 of screen | |
2141 else | |
2142 wy = (SCREEN_SIZE_Y-sy)/2; //display in middle of screen | |
2143 if (wy < 10) | |
2144 wy = wy/2; | |
2145 | |
2146 if ((wx == 0) || (wy==0)) | |
2147 { //not enough room to display as a window - use whole screen | |
2148 fullScreen = DLG_USE_FULL_SCREEN; | |
2149 } | |
2150 | |
2151 #ifdef COLOURDISPLAY | |
2152 if ((data->icon_array != NULL) && (fullScreen != DLG_USE_BITMAP)) | |
2153 { //The dialog has an animation - we must make the pop-up large enough to support this | |
2154 if (sx < data->icon_array[0].area.sx) | |
2155 sx = data->icon_array[0].area.sx; | |
2156 yBmpOfs = data->icon_array[0].area.py + data->icon_array[0].area.sy; | |
2157 wy = data->icon_array[0].area.py; | |
2158 sy = sy + data->icon_array[0].area.sy; | |
2159 } | |
2160 #endif | |
2161 } | |
2162 else | |
2163 { | |
2164 //We have no strings to display - clear entire screen | |
2165 fullScreen = DLG_USE_FULL_SCREEN; | |
2166 } | |
2167 | |
2168 | |
2169 /****************************** | |
2170 * Draw window (full screen/pop-up) | |
2171 *****************************/ | |
2172 if (fullScreen != DLG_USE_FULL_SCREEN) | |
2173 dspl_unfocusDisplay(); | |
2174 area.px = 0; | |
2175 area.py = 0; | |
2176 area.sx = sx; | |
2177 area.sy = sy; | |
2178 resources_setColour(data->dlgCol); | |
2179 drawWinType = DSPL_WIN_CENTRE; | |
2180 | |
2181 if (fullScreen!=DLG_USE_FULL_SCREEN) | |
2182 { | |
2183 t_font_bitmap bmp; | |
2184 t_font_bitmap* bmpPtr = NULL; | |
2185 | |
2186 for (i=0;i<MAX_DLG_LINES;i++) | |
2187 { | |
2188 //centre text | |
2189 xPos[i] = wx+(sx-strLen[i])/2; | |
2190 yPos[i] = wy+yOfs+yBmpOfs+Mmi_layout_line_height()*i; | |
2191 } | |
2192 | |
2193 #ifdef COLOURDISPLAY | |
2194 if ((data->dlgBgdBitmap != NULL) && (fullScreen==DLG_USE_BITMAP)) | |
2195 { | |
2196 bmp.format = data->dlgBgdBitmap->icnType; | |
2197 bmp.height = data->dlgBgdBitmap->area.sy; | |
2198 bmp.width = data->dlgBgdBitmap->area.sx; | |
2199 bmp.bitmap = data->dlgBgdBitmap->icons; | |
2200 bmpPtr = &bmp; | |
2201 area = calcLayout(data->dlgType, sx, sy, bmp.width, bmp.height); | |
2202 | |
2203 //Adjust size of available area depending on bitmap properties/dlgType. | |
2204 //dlgType== 0 =>display info in centre of bitmap | |
2205 if (data->dlgType == 0) | |
2206 { | |
2207 //If the bmp is bigger than the data we will move the bmp to | |
2208 //lie over the centre of the data | |
2209 area.px = area.px - (bmp.width - sx)/2; | |
2210 area.py = area.py - (bmp.height- sy)/2; | |
2211 } | |
2212 for (i=0;i<MAX_DLG_LINES;i++) | |
2213 { | |
2214 xPos[i] = xPos[i] + area.px; | |
2215 yPos[i] = yPos[i] + area.py; | |
2216 } | |
2217 | |
2218 TRACE_EVENT_P3("wy = %d, yOfs = %d, area.py = %d",wy,yOfs,area.py); | |
2219 if( data->dlgBgdBitmap->icnType != ICON_TYPE_1BIT_UNPACKED ) | |
2220 dspl_SetBgdColour( COL_TRANSPARENT ); | |
2221 | |
2222 | |
2223 } | |
2224 else | |
2225 { | |
2226 // x0066814 06 Dec 2006, OMAPS00106825 | |
2227 //The window height calculation related to wrapping should be skipped when no | |
2228 //string wrapping is done | |
2229 if(wrapLine>0) | |
2230 { | |
2231 sy = sy + (wrapLine-1)*Mmi_layout_line_height(); | |
2232 } | |
2233 area.sy = sy; | |
2234 } | |
2235 #else | |
2236 if (wrapLine>1) | |
2237 { | |
2238 sy = sy + (wrapLine-1)*Mmi_layout_line_height(); | |
2239 area.sy = sy; | |
2240 } | |
2241 #endif | |
2242 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
2243 //If length of the dialog is bigger than screen then start the dialog from the top corner. | |
2244 if(sy+wy >= SCREEN_SIZE_Y && sy < SCREEN_SIZE_Y) | |
2245 if(wy>0 && wy < sy) | |
2246 { | |
2247 wy = (SCREEN_SIZE_Y - sy ) /2 ;// centre the dialog | |
2248 if(wy < 0) | |
2249 wy=0; | |
2250 for (i=0;i<MAX_DLG_LINES;i++) | |
2251 yPos[i] = wy+yOfs+yBmpOfs+Mmi_layout_line_height()*i; | |
2252 } | |
2253 dspl_DrawWin( wx,wy,sx,sy, drawWinType , bmpPtr); | |
2254 } | |
2255 else | |
2256 { | |
2257 dspl_ClearAll(); | |
2258 sx = 84; | |
2259 for (i=0;i<MAX_DLG_LINES;i++) | |
2260 { | |
2261 xPos[i] = 0; | |
2262 yPos[i] = Mmi_layout_line(i+1); | |
2263 } | |
2264 } | |
2265 /****************************** | |
2266 * Print softkeys | |
2267 *****************************/ | |
2268 icnShow(data->icon); | |
2269 if ((lskStr != NULL) || (rskStr != NULL)) | |
2270 { | |
2271 if (fullScreen==DLG_USE_FULL_SCREEN) | |
2272 Mmi_layout_softkeyArea( &skArea ); | |
2273 else | |
2274 { | |
2275 skArea.px = area.px+wx; | |
2276 skArea.sx = area.sx; | |
2277 skArea.py = area.py+wy+area.sy-Mmi_layout_softkeyHeight()-1; | |
2278 skArea.sy = Mmi_layout_softkeyHeight(); | |
2279 } | |
2280 softKeys_displayStrXY(lskStr, rskStr, data->dlgSkFormat, data->dlgCol, &skArea); | |
2281 } | |
2282 | |
2283 /****************************** | |
2284 * Print dialog text | |
2285 *****************************/ | |
2286 for (i=0;i<MAX_DLG_LINES;i++) | |
2287 { /* GW#2294 No need to draw zero length strings .*/ | |
2288 if ((str[i] != NULL) && (strLen[i] > 0)) | |
2289 { | |
2290 //x0035544 Feb 15, 2006. DR:OMAPS00061467 | |
2291 #ifdef FF_MMI_SAT_ICON | |
2292 if(data->IconData.selfExplanatory == FALSE) | |
2293 dspl_TextOut(xPos[i] + titleIconWidth, yPos[i], DSPL_TXTATTR_NORMAL, str[i] ); | |
2294 #else | |
2295 dspl_TextOut(xPos[i] , yPos[i], DSPL_TXTATTR_NORMAL, str[i] ); | |
2296 #endif | |
2297 } | |
2298 } | |
2299 //x0035544 Feb 15, 2006. DR:OMAPS00061467 | |
2300 #ifdef FF_MMI_SAT_ICON | |
2301 if(data->IconData.dst != NULL) | |
2302 { | |
2303 if(str[DLG_LINE2] == NULL) | |
2304 { | |
2305 if ((data->IconData.width > TITLE_ICON_WIDTH) || | |
2306 (data->IconData.height > TITLE_ICON_HEIGHT)) | |
2307 { | |
2308 dspl_BitBlt2(xPos[0], yPos[0], 8, | |
2309 10, (void*)SATIconQuestionMark, 0, BMP_FORMAT_256_COLOUR); | |
2310 } | |
2311 | |
2312 else | |
2313 dspl_BitBlt2(xPos[0], yPos[0], data->IconData.width, | |
2314 data->IconData.height, (void*)data->IconData.dst, 0, BMP_FORMAT_256_COLOUR); | |
2315 } | |
2316 else | |
2317 { | |
2318 if ((data->IconData.width > TITLE_ICON_WIDTH) || | |
2319 (data->IconData.height > TITLE_ICON_HEIGHT)) | |
2320 { | |
2321 dspl_BitBlt2(xPos[DLG_LINE2], yPos[DLG_LINE2], 8, | |
2322 10, (void*)SATIconQuestionMark, 0, BMP_FORMAT_256_COLOUR); | |
2323 } | |
2324 else | |
2325 dspl_BitBlt2(xPos[DLG_LINE2], yPos[DLG_LINE2],data->IconData.width, | |
2326 data->IconData.height, (void*)data->IconData.dst, 0, BMP_FORMAT_256_COLOUR); | |
2327 } | |
2328 | |
2329 } | |
2330 #endif | |
2331 | |
2332 | |
2333 resources_restoreColour(); | |
2334 } | |
2335 | |
2336 // Sep 06 2005 REF: MMI-SPR-33548 x0012849 | |
2337 // Now free the allocated memory | |
2338 /* x0039928 - Lint warning removal */ | |
2339 if (strLen[MAX_DLG_LINES] > scrWidth-charWidth) | |
2340 if (data->WrapStrings & WRAP_STRING_2) | |
2341 if (str[MAX_DLG_LINES][0] != (char)0x80) /* x0039928 - lint warning removal */ | |
2342 { | |
2343 for(i=DLG_LINE2;i<MAX_DLG_LINES;i++) | |
2344 { | |
2345 if(NULL != str[i] && strLen[i] > 0) | |
2346 mfwFree((U8*)str[i],MAX_WRAP_CHAR); | |
2347 } | |
2348 str[MAX_DLG_LINES]=NULL; | |
2349 } | |
2350 | |
2351 break; | |
2352 | |
2353 default: | |
2354 return 0; | |
2355 } | |
2356 | |
2357 return 1; | |
2358 } | |
2359 | |
2360 /******************************************************************************* | |
2361 | |
2362 $Function: phlock_dialog_info | |
2363 | |
2364 $Description: Dialog function for information dialog | |
2365 | |
2366 $Returns: void | |
2367 | |
2368 $Arguments: win, window handle event, value, parameter | |
2369 | |
2370 *******************************************************************************/ | |
2371 void phlock_dialog_info (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
2372 { | |
2373 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
2374 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
2375 T_DISPLAY_DATA * display_info = (T_DISPLAY_DATA *)parameter; | |
2376 TRACE_FUNCTION ("phlock_dialog_info()"); | |
2377 | |
2378 switch (event) | |
2379 { | |
2380 case DIALOG_INIT: | |
2381 /* | |
2382 * Initialize dialog | |
2383 */ | |
2384 #if defined (WIN32) | |
2385 { | |
2386 /***************************Go-lite Optimization changes Start***********************/ | |
2387 | |
2388 //Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
2389 TRACE_EVENT_P1( "Identifier %d", display_info->Identifier); | |
2390 /***************************Go-lite Optimization changes end***********************/ | |
2391 | |
2392 } | |
2393 #endif | |
2394 /* | |
2395 * Create timer and keyboard handler | |
2396 */ | |
2397 data->info_tim = tim_create (win, display_info->Time, (T_MFW_CB)phlock_dialog_info_tim_cb); | |
2398 data->info_kbd = kbd_create (win, KEY_ALL, (T_MFW_CB)phlock_dialog_info_kbd_cb); | |
2399 data->info_kbd_long = kbd_create(win,KEY_ALL|KEY_LONG,(MfwCb)phlock_dialog_info_kbd_long_cb); | |
2400 | |
2401 /* | |
2402 * Store any other data | |
2403 */ | |
2404 data->KeyEvents = display_info->KeyEvents; | |
2405 data->TextString = display_info->TextString; | |
2406 data->LeftSoftKey = display_info->LeftSoftKey; | |
2407 data->RightSoftKey = display_info->RightSoftKey; | |
2408 data->SoftKeyStrings = display_info->SoftKeyStrings; // SH - TRUE if using strings rather than IDs | |
2409 data->LSKString = display_info->LSKString; // Text for left soft key | |
2410 data->RSKString = display_info->RSKString; // Text for right soft key | |
2411 data->TextId = display_info->TextId; | |
2412 data->Identifier = display_info->Identifier; | |
2413 data->Callback = display_info->Callback; | |
2414 data->TextString2 = display_info->TextString2; | |
2415 data->TextId2 = display_info->TextId2; | |
2416 data->WrapStrings = display_info->WrapStrings; //GW-SPR#762 | |
2417 | |
2418 data->dlgCol = display_info->displayCol; | |
2419 data->dlgType = display_info->dlgType; | |
2420 data->dlgBgdBitmap = display_info->bgdBitmap; | |
2421 data->dlgSkFormat = 0; | |
2422 data->current_frame = display_info->current_frame; | |
2423 data->number_of_frames = display_info->number_of_frames; | |
2424 data->icon_array = (MfwIcnAttr*)display_info->icon_array; | |
2425 data->animation_timer = 0; | |
2426 //x0035544 Feb 07, 2006 DR:OMAPS00061467 | |
2427 #ifdef FF_MMI_SAT_ICON | |
2428 if(display_info->IconData.dst != NULL) | |
2429 { | |
2430 data->IconData.width = display_info->IconData.width; | |
2431 data->IconData.height = display_info->IconData.height; | |
2432 data->IconData.dst = display_info->IconData.dst; | |
2433 data->IconData.selfExplanatory = display_info->IconData.selfExplanatory; | |
2434 } | |
2435 else | |
2436 { | |
2437 data->IconData.dst = NULL; | |
2438 data->IconData.selfExplanatory = FALSE; | |
2439 data->IconData.width =0; | |
2440 data->IconData.height =0; | |
2441 } | |
2442 #endif | |
2443 | |
2444 TRACE_EVENT_P1("anim_time = %d", display_info->anim_time); | |
2445 TRACE_EVENT_P1("data->anim_time = %d", data->anim_time); | |
2446 if(display_info->anim_time != 0) | |
2447 { | |
2448 data->animation_timer = timCreate(win,display_info->anim_time,(MfwCb)mmi_dialogs_animation_new_CB); | |
2449 timStart(data->animation_timer); | |
2450 } | |
2451 | |
2452 if (display_info->Time NEQ FOREVER) | |
2453 tim_start (data->info_tim); | |
2454 win_show (win); | |
2455 | |
2456 break; | |
2457 | |
2458 case DIALOG_DESTROY: | |
2459 phlock_dialog_info_destroy(win); | |
2460 break; | |
2461 } | |
2462 } | |
2463 | |
2464 /******************************************************************************* | |
2465 | |
2466 $Function: phlock_dialog_info_tim_cb | |
2467 | |
2468 $Description: Callback function for the dialog info timer. | |
2469 | |
2470 | |
2471 $Returns: MFW event handler | |
2472 | |
2473 $Arguments: window handle event, timer control block | |
2474 | |
2475 *******************************************************************************/ | |
2476 static T_MFW_CB phlock_dialog_info_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc) | |
2477 { | |
2478 T_MFW_HND win = mfw_parent (mfw_header()); | |
2479 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
2480 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
2481 | |
2482 T_MFW_HND parent_win = data->parent_win; | |
2483 USHORT Identifier = data->Identifier; | |
2484 void (* Callback)() = data->Callback; | |
2485 | |
2486 TRACE_FUNCTION("phlock_dialog_info_tim_cb()"); | |
2487 #if defined (WIN32) | |
2488 { | |
2489 /***************************Go-lite Optimization changes Start***********************/ | |
2490 | |
2491 //Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
2492 TRACE_EVENT_P1 ("Identifier %d", data->Identifier);); | |
2493 /***************************Go-lite Optimization changes end***********************/ | |
2494 | |
2495 } | |
2496 #endif | |
2497 | |
2498 #ifdef FF_PHONE_LOCK | |
2499 TRACE_EVENT("Bef. destroy"); | |
2500 TRACE_EVENT_P1("phlock_dialog_info_tim_cb: win: %02x", win); | |
2501 | |
2502 #endif //FF_PHONE_LOCK | |
2503 /* | |
2504 ** SPR#1744 NDH | |
2505 ** Move the dialog destory in front of the Callback to make the processing consistent | |
2506 ** with the Right Keypress and Hangup Processing. Also to ensure that the dialog is | |
2507 ** removed when the screen is redrawn. | |
2508 */ | |
2509 | |
2510 TRACE_EVENT("phlock_dialog_info_tim_cb: Bef dialog_info_destrroy"); | |
2511 phlock_dialog_info_destroy (win); | |
2512 | |
2513 #ifdef FF_PHONE_LOCK | |
2514 TRACE_EVENT("Aft. destroy"); | |
2515 TRACE_EVENT_P1("phlock_dialog_info_tim_cb: win: %02x", win); | |
2516 #endif //FF_PHONE_LOCK | |
2517 | |
2518 if (Callback) | |
2519 (Callback) (parent_win, Identifier, INFO_TIMEOUT); | |
2520 | |
2521 return 0; | |
2522 } | |
2523 | |
2524 /******************************************************************************* | |
2525 | |
2526 $Function: phlock_dialog_info_kbd_cb | |
2527 | |
2528 $Description: Keyboard event handler | |
2529 | |
2530 $Returns: status int | |
2531 | |
2532 $Arguments: window handle event, keyboard control block | |
2533 | |
2534 *******************************************************************************/ | |
2535 | |
2536 static int phlock_dialog_info_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard) | |
2537 { | |
2538 T_MFW_HND win = mfw_parent (mfw_header()); | |
2539 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
2540 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
2541 T_MFW_HND parent_win = data->parent_win; | |
2542 USHORT Identifier = data->Identifier; | |
2543 void (* Callback)() = data->Callback; | |
2544 | |
2545 TRACE_FUNCTION("phlock_dialog_info_kbd_cb"); | |
2546 | |
2547 switch (keyboard->code) | |
2548 { | |
2549 case KCD_LEFT: | |
2550 if (data->KeyEvents & KEY_LEFT ) | |
2551 { | |
2552 phlock_dialog_info_destroy (win); | |
2553 if (Callback) | |
2554 (Callback) (parent_win, Identifier, INFO_KCD_LEFT); | |
2555 } | |
2556 break; | |
2557 | |
2558 case KCD_RIGHT: | |
2559 if (data->KeyEvents & KEY_RIGHT) | |
2560 { | |
2561 phlock_dialog_info_destroy (win); | |
2562 if (Callback) | |
2563 (Callback) (parent_win, Identifier, INFO_KCD_RIGHT); | |
2564 } | |
2565 break; | |
2566 | |
2567 case KCD_HUP: | |
2568 if (data->KeyEvents & KEY_HUP || data->KeyEvents & INFO_KCD_ALL) | |
2569 { | |
2570 phlock_dialog_info_destroy (win); | |
2571 if (Callback) | |
2572 (Callback) (parent_win, Identifier, INFO_KCD_HUP); | |
2573 } | |
2574 break; | |
2575 case KCD_MNUUP: | |
2576 | |
2577 if (data->KeyEvents & KEY_MNUUP) | |
2578 { | |
2579 if (Callback) | |
2580 (Callback) (parent_win, Identifier, INFO_KCD_UP); | |
2581 } | |
2582 | |
2583 break; | |
2584 case KCD_MNUDOWN: | |
2585 | |
2586 if (data->KeyEvents & KEY_MNUDOWN) | |
2587 { | |
2588 if (Callback) | |
2589 (Callback) (parent_win, Identifier, INFO_KCD_DOWN); | |
2590 } | |
2591 | |
2592 break; | |
2593 //MZ 7/3/01 used to start a call. | |
2594 case KCD_CALL: | |
2595 if (data->KeyEvents & KEY_CALL ) | |
2596 { | |
2597 phlock_dialog_info_destroy (win); | |
2598 if (Callback) | |
2599 (Callback) (parent_win, Identifier, INFO_KCD_OFFHOOK); | |
2600 } | |
2601 break; | |
2602 default: | |
2603 if (data->KeyEvents & INFO_KCD_ALL) | |
2604 { | |
2605 /* | |
2606 Note: The variable Identifier is overwritten with the | |
2607 keycode of the dialog; | |
2608 we need it only for the Multicall Control !! | |
2609 */ | |
2610 Identifier = keyboard->code; | |
2611 phlock_dialog_info_destroy (win); | |
2612 if (Callback) | |
2613 (Callback) (parent_win, Identifier, INFO_KCD_ALL); | |
2614 } | |
2615 break; | |
2616 | |
2617 } | |
2618 return MFW_EVENT_CONSUMED; | |
2619 } | |
2620 | |
2621 /******************************************************************************* | |
2622 | |
2623 $Function: phlock_dialog_info_kbd_long_cb | |
2624 | |
2625 $Description: Keyboard event handler | |
2626 | |
2627 $Returns: status int | |
2628 | |
2629 $Arguments: window handle event, keyboard control block | |
2630 | |
2631 *******************************************************************************/ | |
2632 static int phlock_dialog_info_kbd_long_cb(T_MFW_EVENT event, T_MFW_KBD *keyboard) | |
2633 { | |
2634 TRACE_FUNCTION("dialog_info_kbd_long_cb()"); | |
2635 return MFW_EVENT_CONSUMED; | |
2636 } | |
2637 | |
2638 /******************************************************************************* | |
2639 | |
2640 $Function: phlock_dialog_info_destroy | |
2641 | |
2642 $Description: Destruction of an information dialog | |
2643 | |
2644 $Returns: void | |
2645 | |
2646 $Arguments: win | |
2647 | |
2648 *******************************************************************************/ | |
2649 void phlock_dialog_info_destroy (T_MFW_HND own_window) | |
2650 { | |
2651 T_MFW_WIN * win = ((T_MFW_HDR *)own_window)->data; | |
2652 T_dialog_info * data = (T_dialog_info *)win->user; | |
2653 | |
2654 TRACE_FUNCTION ("phlock_dialog_info_destroy()"); | |
2655 | |
2656 if (own_window == NULL) | |
2657 { | |
2658 TRACE_EVENT ("Error :- Called with NULL Pointer"); | |
2659 return; | |
2660 } | |
2661 | |
2662 if (data) | |
2663 { | |
2664 /* | |
2665 * Exit TIMER & KEYBOARD Handle | |
2666 */ | |
2667 kbd_delete (data->info_kbd); | |
2668 tim_delete (data->info_tim); | |
2669 | |
2670 if(data->animation_timer != 0) | |
2671 { | |
2672 timDelete(data->animation_timer); | |
2673 | |
2674 if (data->icon != 0) | |
2675 icnDelete(data->icon); | |
2676 } | |
2677 | |
2678 /* | |
2679 * Delete WIN Handler | |
2680 */ | |
2681 TRACE_EVENT_P1("phlock_dialog_info_destroy: deleting:data->info_win:%02x",data->info_win); | |
2682 | |
2683 win_delete (data->info_win); | |
2684 /* | |
2685 * Free Memory | |
2686 */ | |
2687 FREE_MEMORY ((void *)data, sizeof (T_dialog_info)); | |
2688 } | |
2689 } | |
2690 #endif //FF_PHONE_LOCK | |
2691 |