comparison src/aci2/bmi/MmiDialogs.c @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1
2 /*******************************************************************************
3
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 Mar 11, 2006 REF:DR:OMAPS00061467 x0035544
33 Description: 27.22.4.13.3 SET UP CALL (display of icons) fails.
34 Solution: Assigned the default values for icon data for the structure display_info in the function
35 dlg_zeroDisplayData(). copied icon data in to the structure data->IconData and provided functionality
36 in the function dialog_info_win_resize_cb() to display icon data appropriately on the dialog screen for SAT
37 call setup.
38
39 Sep 06 2005 REF: MMI-SPR-33548 x0012849 Jagan
40 Description : A dialog with long message is not displayed properly.
41 Solution : The no of lines in a dialog is increased from 4 to 15.
42
43 Feb 24, 2005 REF: CRR MMI-SPR-29102 xnkulkar
44 Description: The phone resets when user presses the ''End All' key while the SMSs are being deleted.
45 Solution: As the user has already confirmed that all SMS messages are to be deleted, ''End All' key
46 press is ignored till the delete operation is over.
47 xrashmic 08 Feb, 2005 MMI-SPR-27853
48 Moved the T_dialog_info structure from MmiDialogs.c to MmiDialogs.h
49
50
51 xrashmic 08 Feb, 2005 MMI-SPR-27853
52 Moved the T_dialog_info structure from MmiDialogs.c to MmiDialogs.h
53
54 Aug 25, 2004 REF: CRR 24904 Deepa M.D
55 Bug:cleanup compile switches used for Go-lite
56 Fix:COLOURDISPLAY compiler switch has been added to the functions which are
57 used only for the normal color build.
58
59 Aug 16, 2004 REF: CRR 24323 Deepa M.D
60 Bug:Clenup of sprintf used for tracing
61 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX
62
63
64 Sep 01, 2004 REF: CRR 21380 Deepa M.D
65 Bug:Not getting proper display, When Messages Memory is Full.
66 Fix:Assigning TextId and TextString will not display both the messages.
67 Hence we need to use TextId and TextString2 or TextId2 and TextString
68
69 Jun 04,2004 CRR:13601 xpradipg - SASKEN
70 Description: CFO interrogation display : Timer to long
71 Fix: Timer is enabled for the information dialog. It times out after 5 seconds from the last key
72 press.
73 25/10/00 Original Condat(UK) BMI version.
74
75 $End
76
77 *******************************************************************************/
78
79
80 /*******************************************************************************
81
82 Include Files
83
84 *******************************************************************************/
85 #define ENTITY_MFW
86
87 /* includes */
88 #include <string.h>
89 #include <stdio.h>
90 #include <stdlib.h>
91
92 #if defined (NEW_FRAME)
93
94 #include "typedefs.h"
95 #include "vsi.h"
96 #include "pei.h"
97 #include "custom.h"
98 #include "gsm.h"
99
100 #else
101
102 #include "STDDEFS.H"
103 #include "custom.h"
104 #include "gsm.h"
105 #include "vsi.h"
106
107 #endif
108
109
110 #include "mfw_mfw.h"
111 #include "mfw_win.h"
112 #include "mfw_kbd.h"
113 /* SPR#1428 - SH - New Editor changes */
114 #ifndef NEW_EDITOR
115 #include "mfw_edt.h"
116 #endif
117 #include "mfw_tim.h"
118 #include "mfw_phb.h"
119 #include "mfw_sms.h"
120 #include "mfw_icn.h"
121 #include "mfw_mnu.h"
122 #include "mfw_lng.h"
123 #include "mfw_sat.h"
124 #include "mfw_kbd.h"
125 #include "mfw_nm.h"
126
127 #include "dspl.h"
128
129 #include "ksd.h"
130 #include "psa.h"
131
132 #include "MmiMain.h"
133 #include "MmiDummy.h"
134 //JVJE #include "MmiMsgsEdit.h"
135 //#include "MmiLists.h"
136 #include "MmiMmi.h"
137
138 #include "MmiDialogs.h"
139 #include "MmiLists.h"
140 #include "MmiMenu.h"
141 #include "MmiSoftKeys.h"
142
143 /* JF Modified
144 */
145 #include "MmiBookController.h"
146 #include "cus_aci.h"
147
148 #include "prim.h"
149 #ifndef PCM_2_FFS
150 #include "pcm.h"
151 #endif
152
153
154 #include "mmiColours.h"
155
156 void dlg_initDisplayData_type( T_DISPLAY_DATA *displayInfo, U32 displayCol, int dlgType, T_BITMAP* dlgBitmap , int dlgSKFormat );
157
158 /*
159 * START NEW PART
160 */
161
162 static T_MFW_HND dialog_info_create (T_MFW_HND parent_win);
163 static void dialog_info (T_MFW_HND win,
164 USHORT event, SHORT value, void * parameter);
165
166 static int dialog_info_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
167 static int dialog_info_win_resize_cb (T_MFW_EVENT event, T_MFW_WIN * win);
168
169 static T_MFW_CB dialog_info_tim_cb (T_MFW_EVENT event, T_MFW_TIM * tc);
170 static int dialog_info_kbd_cb (T_MFW_EVENT event, T_MFW_KBD * keyboard);
171 static int dialog_info_kbd_long_cb (T_MFW_EVENT event, T_MFW_KBD * keyboard);
172 void mmi_dialogs_insert_animation_CB (T_MFW_EVENT event, T_MFW_TIM *tc);
173 void mmi_dialogs_animation_new_CB (T_MFW_EVENT event, T_MFW_TIM *tc);
174
175
176 MfwRect calcLayout( int dlgType, int dataSx, int dataSy, int bmpSx, int bmpSy)
177 {
178 MfwRect area;
179 int px,py;
180 int sx,sy;
181
182 TRACE_EVENT_P5("dlgType,= %d, dataSx = %d, dataSy = %d, bmpSx = %d, bmpSy = %d", dlgType, dataSx, dataSy, bmpSx, bmpSy);
183
184 /*Adjust area available for drawing by the border */
185 switch (dlgType & DLG_BORDER_VERTICAL)
186 {
187 case DLG_BORDER_VERTICAL_0: sx =bmpSx; break;
188 case DLG_BORDER_VERTICAL_1: sx =bmpSx*6/8; break;
189 case DLG_BORDER_VERTICAL_2: sx =bmpSx*4/8; break;
190 case DLG_BORDER_VERTICAL_3: sx =bmpSx*3/8; break;
191 }
192 if (sx < dataSx)
193 sx = dataSx;
194 px = 0;
195
196 switch (dlgType & DLG_BORDER_HORIZONTAL)
197 {
198 case DLG_BORDER_HORIZONTAL_0: sy =bmpSy; break;
199 case DLG_BORDER_HORIZONTAL_1: sy =bmpSy*6/8; break;
200 case DLG_BORDER_HORIZONTAL_2: sy =bmpSy*4/8; break;
201 case DLG_BORDER_HORIZONTAL_3: sy =bmpSy*3/8; break;
202 }
203 if (sy < dataSy)
204 sy = dataSy;
205 py = 0;
206
207 switch (dlgType & (DLG_INFO_LAYOUT_LEFT | DLG_INFO_LAYOUT_RIGHT))
208 {
209 case DLG_INFO_LAYOUT_CENTRE: //display info in centre of display
210 px = px + (sx-dataSx)/2;
211 sx = dataSx;
212 break;
213 case DLG_INFO_LAYOUT_RIGHT: //all info is displayed at the foot of trhe display
214 px = px+(sx-dataSx);
215 sx = dataSx;
216 break;
217 case DLG_INFO_LAYOUT_LEFT: //display all info at the top of the bitmap
218 sx = dataSx;
219 break;
220 default: //display info over entire area
221 break;
222 }
223
224 switch (dlgType & (DLG_INFO_LAYOUT_BOTTOM | DLG_INFO_LAYOUT_TOP))
225 {
226 case DLG_INFO_LAYOUT_CENTRE: //display info in centre of display
227 py = py + (sy-dataSy)/2;
228 sy = dataSy;
229 break;
230 case DLG_INFO_LAYOUT_BOTTOM: //all info is displayed at the foot of trhe display
231 py = py+(sy-dataSy);
232 sy = dataSy;
233 break;
234 case DLG_INFO_LAYOUT_TOP: //display all info at the top of the bitmap
235 sy = dataSy;
236 break;
237 default: //display info over entire area
238 break;
239 }
240 area.px = px; area.py = py;
241 area.sx = sx; area.sy = sy; //Area sx/sy must be no smaller than dataSx/Sy
242 return (area);
243 }
244
245
246 /*******************************************************************************
247
248 $Function: info_dialog
249
250 $Description: Common information dialog
251
252 $Returns: Dialogue info win
253
254 $Arguments: parent win, display info
255
256 *******************************************************************************/
257 T_MFW_HND info_dialog (T_MFW_HND parent_win,
258 T_DISPLAY_DATA * display_info)
259 {
260 T_MFW_HND win;
261 display_info->SoftKeyStrings = FALSE;
262
263 win = dialog_info_create (parent_win);
264
265 if (win NEQ NULL)
266 {
267 SEND_EVENT (win, DIALOG_INIT, 0, display_info);
268 }
269 return win;
270 }
271
272
273 /*******************************************************************************
274
275 $Function: info_dialog_softkeystrings
276
277 $Description: Common information dialog, sets "softkeystrings" to TRUE
278
279 $Returns: Dialogue info win
280
281 $Arguments: parent win, display info, leftsoftkey, rightsoftkey
282
283 *******************************************************************************/
284 T_MFW_HND info_dialog_softkeystrings (T_MFW_HND parent_win, T_DISPLAY_DATA * display_info)
285 {
286 T_MFW_HND win;
287
288 display_info->SoftKeyStrings = TRUE;
289 win = dialog_info_create (parent_win);
290
291 if (win NEQ NULL)
292 {
293 SEND_EVENT (win, DIALOG_INIT, 0, display_info);
294 }
295 return win;
296 }
297
298
299 /*******************************************************************************
300
301 $Function: dialog_info_create
302
303 $Description: Creation of an information dialog
304
305 $Returns: Dialogue info win
306
307 $Arguments: parent win
308
309 *******************************************************************************/
310 static T_MFW_HND dialog_info_create (T_MFW_HND parent_win)
311 {
312 T_MFW_WIN * win_data;
313 T_dialog_info * data = (T_dialog_info *)ALLOC_MEMORY (sizeof (T_dialog_info));
314 TRACE_FUNCTION ("dialog_info_create()");
315
316 data->info_win = win_create (parent_win, 0, E_WIN_VISIBLE, (T_MFW_CB)dialog_info_win_resize_cb);
317
318 if (data->info_win EQ 0)
319 return 0;
320
321 /*
322 * Create window handler
323 */
324 data->mmi_control.dialog = (T_DIALOG_FUNC)dialog_info;
325 data->mmi_control.data = data;
326 data->parent_win = parent_win;
327 win_data = ((T_MFW_HDR *)data->info_win)->data;
328 win_data->user = (void *)data;
329
330 /*
331 * return window handle
332 */
333 return data->info_win;
334 }
335
336
337 /*******************************************************************************
338
339 $Function: dialog_info_destroy
340
341 $Description: Destruction of an information dialog
342
343 $Returns: void
344
345 $Arguments: win
346
347 *******************************************************************************/
348 void dialog_info_destroy (T_MFW_HND own_window)
349 {
350 T_MFW_WIN * win = ((T_MFW_HDR *)own_window)->data;
351 T_dialog_info * data = (T_dialog_info *)win->user;
352
353 TRACE_FUNCTION ("dialog_info_destroy()");
354
355 if (own_window == NULL)
356 {
357 TRACE_EVENT ("Error :- Called with NULL Pointer");
358 return;
359 }
360
361 if (data)
362 {
363 /*
364 * Exit TIMER & KEYBOARD Handle
365 */
366 kbd_delete (data->info_kbd);
367 tim_delete (data->info_tim);
368
369 if(data->animation_timer != 0)
370 {
371 timDelete(data->animation_timer);
372
373 if (data->icon != 0)
374 icnDelete(data->icon);
375 }
376
377 /*
378 * Delete WIN Handler
379 */
380 win_delete (data->info_win);
381 /*
382 * Free Memory
383 */
384 FREE_MEMORY ((void *)data, sizeof (T_dialog_info));
385 }
386 }
387
388 void dlg_zeroDisplayData( T_DISPLAY_DATA *displayInfo)
389 {
390
391 TRACE_EVENT("dlg_zeroDisplayData()");
392 if (displayInfo == NULL)
393 return;
394 memset (displayInfo, 0x00, sizeof(T_DISPLAY_DATA));
395
396 displayInfo->LeftSoftKey = 0;
397 displayInfo->RightSoftKey = 0;
398 displayInfo->LSKString = NULL;
399 displayInfo->RSKString = NULL;
400 displayInfo->TextString = NULL;
401 displayInfo->TextString2 = NULL;
402
403 displayInfo->WrapStrings = 0;
404
405 displayInfo->TextId = 0;
406 displayInfo->TextId2 = 0;
407
408 displayInfo->SoftKeyStrings = FALSE;
409
410 displayInfo->Identifier = 0;
411 displayInfo->anim_time = 0;
412 displayInfo->number_of_frames = 0;
413 displayInfo->current_frame = 0;
414 //x0035544 Feb 07, 2006 DR:OMAPS00061467
415 #ifdef FF_MMI_SAT_ICON
416 displayInfo->IconData.width = 0;
417 displayInfo->IconData.height = 0;
418 displayInfo->IconData.dst = NULL;
419 displayInfo->IconData.selfExplanatory = FALSE;
420 #endif
421 dlg_initDisplayData_events( displayInfo, NULL, 0, 0);
422
423 /* GW#2294 COLOUR_STATUS has been used for all popups - change this to default instead of COLOUR_POPUP .*/
424 dlg_initDisplayData_type( displayInfo, COLOUR_STATUS, 0, NULL, 0 );
425
426 /* GW #2294 02/07/03 - The default bitmap is set-up here to allow us to disable it for some dialogs (if required) */
427 displayInfo->bgdBitmap = icon_getBgdBitmap(BGD_CLOUD);
428
429 }
430
431 void dlg_initDisplayData_TextId( T_DISPLAY_DATA *displayInfo, int lsk, int rsk, int str1, int str2, int colId)
432 {
433 if (displayInfo == NULL)
434 return;
435 dlg_zeroDisplayData(displayInfo);
436 displayInfo->LeftSoftKey = (USHORT)lsk;
437 displayInfo->RightSoftKey = (USHORT)rsk;
438 displayInfo->TextId = str1;
439 displayInfo->TextId2 = str2;
440 displayInfo->displayCol = colId ;
441
442 }
443
444 void dlg_initDisplayData_TextStr( T_DISPLAY_DATA *displayInfo, int lsk, int rsk,char *str1, char *str2, int colId)
445 {
446 if (displayInfo == NULL)
447 return;
448 dlg_zeroDisplayData(displayInfo);
449 displayInfo->LeftSoftKey = (USHORT)lsk;
450 displayInfo->RightSoftKey = (USHORT)rsk;
451 displayInfo->TextString = str1;
452 displayInfo->TextString2 = str2;
453 displayInfo->displayCol = colId ;
454 }
455
456 void dlg_initDisplayData_events( T_DISPLAY_DATA *displayInfo, T_VOID_FUNC callback, int timer, T_MFW_EVENT keyEvents)
457 {
458 displayInfo->Callback = callback;
459 displayInfo->Time = timer;
460 displayInfo->KeyEvents = keyEvents;
461 }
462
463 void dlg_initDisplayData_type( T_DISPLAY_DATA *displayInfo, U32 displayCol, int dlgType, T_BITMAP* dlgBitmap, int dlgSkFormat )
464 {
465 displayInfo->displayCol = displayCol;
466 displayInfo->dlgType = dlgType;
467 displayInfo->bgdBitmap = dlgBitmap;
468 }
469
470 /*******************************************************************************
471
472 $Function: dialog_info
473
474 $Description: Dialog function for information dialog
475
476 $Returns: void
477
478 $Arguments: win, window handle event, value, parameter
479
480 *******************************************************************************/
481 void dialog_info (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
482 {
483 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
484 T_dialog_info * data = (T_dialog_info *)win_data->user;
485 T_DISPLAY_DATA * display_info = (T_DISPLAY_DATA *)parameter;
486 TRACE_FUNCTION ("dialog_info()");
487
488 switch (event)
489 {
490 case DIALOG_INIT:
491 /*
492 * Initialize dialog
493 */
494 #if defined (WIN32)
495 {
496 /***************************Go-lite Optimization changes Start***********************/
497
498 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
499 TRACE_EVENT_P1( "Identifier %d", display_info->Identifier);
500 /***************************Go-lite Optimization changes end***********************/
501
502 }
503 #endif
504 /*
505 * Create timer and keyboard handler
506 */
507 data->info_tim = tim_create (win, display_info->Time, (T_MFW_CB)dialog_info_tim_cb);
508 data->info_kbd = kbd_create (win, KEY_ALL, (T_MFW_CB)dialog_info_kbd_cb);
509 data->info_kbd_long = kbd_create(win,KEY_ALL|KEY_LONG,(MfwCb)dialog_info_kbd_long_cb);
510
511 /*
512 * Store any other data
513 */
514 data->KeyEvents = display_info->KeyEvents;
515 data->TextString = display_info->TextString;
516 data->LeftSoftKey = display_info->LeftSoftKey;
517 data->RightSoftKey = display_info->RightSoftKey;
518 data->SoftKeyStrings = display_info->SoftKeyStrings; // SH - TRUE if using strings rather than IDs
519 data->LSKString = display_info->LSKString; // Text for left soft key
520 data->RSKString = display_info->RSKString; // Text for right soft key
521 data->TextId = display_info->TextId;
522 data->Identifier = display_info->Identifier;
523 data->Callback = display_info->Callback;
524 data->TextString2 = display_info->TextString2;
525 data->TextId2 = display_info->TextId2;
526 data->WrapStrings = display_info->WrapStrings; //GW-SPR#762
527
528 data->dlgCol = display_info->displayCol;
529 data->dlgType = display_info->dlgType;
530 data->dlgBgdBitmap = display_info->bgdBitmap;
531 data->dlgSkFormat = 0;
532 data->current_frame = display_info->current_frame;
533 data->number_of_frames = display_info->number_of_frames;
534 data->icon_array = (MfwIcnAttr*)display_info->icon_array;
535 data->animation_timer = 0;
536 //x0035544 Feb 07, 2006 DR:OMAPS00061467
537 #ifdef FF_MMI_SAT_ICON
538 if(display_info->IconData.dst != NULL)
539 {
540 data->IconData.width = display_info->IconData.width;
541 data->IconData.height = display_info->IconData.height;
542 data->IconData.dst = display_info->IconData.dst;
543 data->IconData.selfExplanatory = display_info->IconData.selfExplanatory;
544 }
545 else
546 {
547 data->IconData.dst = NULL;
548 data->IconData.selfExplanatory = FALSE;
549 data->IconData.width =0;
550 data->IconData.height =0;
551 }
552 #endif
553
554 TRACE_EVENT_P1("anim_time = %d", display_info->anim_time);
555 TRACE_EVENT_P1("data->anim_time = %d", data->anim_time);
556
557 if(display_info->anim_time != 0)
558 {
559 data->animation_timer = timCreate(win,display_info->anim_time,(MfwCb)mmi_dialogs_animation_new_CB);
560 timStart(data->animation_timer);
561 }
562
563 if (display_info->Time NEQ FOREVER)
564 tim_start (data->info_tim);
565 win_show (win);
566 break;
567 case DIALOG_DESTROY:
568 dialog_info_destroy(win);
569 break;
570 }
571 }
572
573 /*******************************************************************************
574
575 $Function: dialog_info_win_cb
576
577 $Description: Callback function for information dialog
578
579 $Returns: void
580
581 $Arguments: window handle event, win
582 *******************************************************************************/
583 //GW-SPR#762-Added code to wraps txtString2 if there is room on the display to allow
584 //very long numbers to be displayed.
585 #define MAX_LINE_CHAR MAX_LINE
586 static int dialog_info_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
587 {
588 T_dialog_info * data = (T_dialog_info *)win->user;
589 char buffer[MAX_LINE_CHAR+1];
590 int yPos,bufPos,nLines;
591
592 TRACE_FUNCTION ("dialog_info_win_cb()");
593
594
595 if (data EQ 0)
596 return 1;
597
598 switch (event)
599 {
600 case E_WIN_VISIBLE:
601 if (win->flags & E_WIN_VISIBLE)
602 {
603 /*
604 * Print the information dialog
605 */
606
607 /*
608 * Clear Screen
609 */
610 dspl_ClearAll();
611
612 /*
613 * Print softkeys
614 */
615 icnShow(data->icon);
616 if (data->SoftKeyStrings)
617 displayCustSoftKeys(data->LSKString, data->RSKString); // SH - display text softkeys
618 else
619 displaySoftKeys(data->LeftSoftKey, data->RightSoftKey); // display ID softkeys
620
621 /*
622 * Print information
623 */
624 /*MC SPR 1257, having to shift everything up 1 line as string wrapping for second
625 string causes softkey overwrite when in Chinese*/
626 if (data->TextId NEQ 0)
627 {
628 ALIGNED_PROMPT(LEFT,0,DSPL_TXTATTR_CURRENT_MODE, data->TextId);
629 }
630 else if (data->TextString NEQ NULL)
631 {
632 #ifdef EASY_TEXT_ENABLED
633 if (data->TextString[0] == 0x80) //MC if this is a unicode string
634 displayAlignedText(LEFT, 0, DSPL_TXTATTR_UNICODE, &data->TextString[2]);
635 else
636 #endif
637 displayAlignedText(LEFT, 0, DSPL_TXTATTR_NORMAL, data->TextString);
638 }
639
640 if (data->TextId2 NEQ 0)
641 {
642 ALIGNED_PROMPT(LEFT,Mmi_layout_first_line()/*MC*/,DSPL_TXTATTR_CURRENT_MODE, data->TextId2);
643 }
644 else if (data->TextString2 NEQ NULL)
645 {
646 #ifdef EASY_TEXT_ENABLED
647 if (data->TextString2[0] == 0x80 ) //MC if this is a unicode string
648 displayAlignedText(LEFT, Mmi_layout_first_line()/*MC*/, DSPL_TXTATTR_UNICODE, &data->TextString2[2]);
649 else
650 #endif
651 {
652 if ((data->WrapStrings & WRAP_STRING_2) && (strlen(data->TextString2) > MAX_LINE_CHAR))
653 { //Display text over a number of lines
654 yPos = Mmi_layout_first_line();/*MC*/
655 bufPos = 0;
656 nLines = Mmi_number_of_lines_without_icons_on_top()-2;//starting on 2nd line
657 while ((bufPos <strlen(data->TextString2)) && (nLines >=0))
658 {
659 memcpy(buffer,&data->TextString2[bufPos],MAX_LINE_CHAR);
660 bufPos = bufPos + MAX_LINE_CHAR;
661 buffer[MAX_LINE_CHAR] = 0x00;
662 displayAlignedText(LEFT, yPos, 0, buffer);
663 yPos = yPos + Mmi_layout_line_height();
664 nLines--;
665 }
666 }
667 else
668 {
669 displayAlignedText(LEFT, Mmi_layout_second_line(),DSPL_TXTATTR_NORMAL, data->TextString2);
670 }
671 }
672 }
673 }
674 break;
675
676 default:
677 return 0;
678 }
679 return 1;
680 }
681 /*******************************************************************************
682
683 $Function: dialog_info_win_cb
684
685 $Description: Callback function for information dialog
686
687 $Returns: void
688
689 $Arguments: window handle event, win
690
691 GW SPR#2294 02/07/03 - Removed Unicode specific code as the 'display' routines called to calculate
692 the string length and output the text should correctly handle the 0x80 unicode tag
693 at the start.
694 Modified the display code to wrap the text in the second text string.
695 Modified the window drawing code so that if the text will not fit in the dialog box
696 with the background bitmap, a pop-up 'box' will be drawn instead. If this will still
697 not be large enough, the entire screen is used.
698 For the C-sample, there is no bitmap.
699 Modified the code to use an array of values to position the text output.
700 GW SPR#2294 08/07/03 - Added code to expand the dialog box to include the animation (if any).
701
702 *******************************************************************************/
703 // Allow 4 lines of text (0..3) for dialogs
704 // Sep 06 2005 REF: MMI-SPR-33548 x0012849
705 // To display a dialog properly when it contain lengthy message - No of lines increased.
706 #define MAX_DLG_LINES (15)
707 //Allow up to 40 chars of text on a dialog line
708 #define MAX_WRAP_CHAR (42)
709 //Allow us to wrap text from line 2 to lines 2,3 and 4 lines
710 #define MAX_WRAP_LINES (MAX_DLG_LINES-1)
711
712 #define DLG_USE_BITMAP 0x0001 //use bitmap if present
713 #define DLG_USE_RECTANGLE 0x0002 //use a rectangle
714 #define DLG_USE_FULL_SCREEN 0x0004 //use full-screen
715
716 #define DLG_LINE1 0
717 #define DLG_LINE2 1
718 static int dialog_info_win_resize_cb (T_MFW_EVENT event, T_MFW_WIN * win)
719 {
720 T_dialog_info * data = (T_dialog_info *)win->user;
721 // T_DISPLAY_DATA * display_info; // RAVI
722 int xPos[MAX_DLG_LINES];
723 int yPos[MAX_DLG_LINES];
724 // Sep 06 2005 REF: MMI-SPR-33548 x0012849
725 //The size of array str and strlen are increased by 1, so that the last elements holds data
726 // which is used while wrapping the text.
727 char* str[MAX_DLG_LINES+1];
728 int strLen[MAX_DLG_LINES+1];
729 int i;
730 char* lskStr,*rskStr;
731 int wx = 0; //,wy,sx=0,sy=0; // RAVI
732 int wy = 0; // RAVI
733 int sx = 0; // RAVI
734 int sy = 0; // RAVI
735 int fullScreen = DLG_USE_RECTANGLE;
736 int yOfs;
737 int yBmpOfs = 0;
738 MfwRect skArea;
739 //x0035544 Feb 15, 2006. DR:OMAPS00061467
740 #ifdef FF_MMI_SAT_ICON
741 USHORT titleIconWidth = 0;
742 #endif
743 MfwRect area;
744 int scrWidth = 0; //available width for the display // RAVI - Assignment to 0.
745 // Sep 06 2005 REF: MMI-SPR-33548 x0012849
746 // temp_ptr is used while wrapping the text.
747 // Now str2[][] is not required.
748 char *temp_ptr;
749 int nChar;
750
751 t_font_bitmap bmp;
752 // t_font_bitmap* bmpPtr = &bmp; // RAVI - Not Referenced.
753
754 int drawWinType;
755 int nLines;
756
757 int linePos=0;
758 int lineLen = 0;
759 int wrapLine = 1; /*GW #2294*/
760
761 const int charWidth = dspl_GetTextExtent("0",1);
762 TRACE_FUNCTION ("dialog_info_win_cb()");
763 //x0035544 Feb 15, 2006. DR:OMAPS00061467
764 #ifdef FF_MMI_SAT_ICON
765 if (data->IconData.dst != NULL)
766 {
767 if (data->IconData.width > TITLE_ICON_WIDTH)
768 {
769 titleIconWidth = TITLE_ICON_WIDTH;
770 }
771 else
772 {
773 titleIconWidth = data->IconData.width ;
774 }
775 }
776 else
777 {
778 titleIconWidth = 0;
779 }
780
781 #endif
782 if (data EQ 0)
783 return 1;
784
785 switch (event)
786 {
787 case E_WIN_VISIBLE:
788 if (win->flags & E_WIN_VISIBLE)
789 {
790 /*
791 * Print the information dialog
792 */
793 for (i=0;i<MAX_DLG_LINES;i++)
794 {
795 xPos[i]=0;
796 yPos[i] = Mmi_layout_line_height()*i;
797 str[i]=NULL;
798 strLen[i]=0;
799 }
800 // Sep 06 2005 REF: MMI-SPR-33548 x0012849
801 // Assign the values to last elments of the array str and strLen
802 str[MAX_DLG_LINES] = NULL;
803 strLen[MAX_DLG_LINES] = 0;
804 yOfs = Mmi_layout_line_height()/4;
805 if (data->TextId != 0)
806 str[DLG_LINE1] = MmiRsrcGetText( data->TextId);
807 else
808 str[DLG_LINE1] = data->TextString;
809
810 if (data->TextId2 != 0)
811 str[DLG_LINE2] = MmiRsrcGetText( data->TextId2);
812 else
813 str[DLG_LINE2] = data->TextString2;
814
815 if (data->SoftKeyStrings!=0)
816 {
817 lskStr = data->LSKString;
818 rskStr = data->RSKString;
819 }
820 else
821 {
822 if (data->LeftSoftKey != TxtNull)
823 lskStr = MmiRsrcGetText(data->LeftSoftKey);
824 else
825 lskStr = NULL;
826
827 if (data->RightSoftKey != TxtNull)
828 rskStr = MmiRsrcGetText(data->RightSoftKey);
829 else
830 rskStr = NULL;
831 }
832
833 if ((str[DLG_LINE1]!= NULL) || (str[DLG_LINE2]!=NULL))
834 { //Draw a window for status info
835 if (str[DLG_LINE2] == NULL)
836 {
837 sy = Mmi_layout_line_height()+yOfs*2; // 18 or 12
838
839 }
840 else
841 {
842 sy = Mmi_layout_line_height()*2+yOfs*3; // 33 or 22
843 }
844
845 //MC, if (Mmi_getCurrentLanguage() != CHINESE_LANGUAGE)
846 { //calculate longest string - use this to calc width of window
847 sx = 0;
848 if ((lskStr!=NULL) || (rskStr!=NULL))
849 {
850 sy = sy+Mmi_layout_softkeyHeight()+yOfs*2;
851 sx = sx + 10;
852 if (lskStr != NULL)
853 {
854 sx = sx + dspl_GetTextExtent(lskStr, 0);
855 }
856 if (rskStr != NULL)
857 {
858 sx = sx + dspl_GetTextExtent(rskStr,0);
859 }
860
861 }
862 for (i=DLG_LINE1;i<=DLG_LINE2;i++)
863 {
864 strLen[i] = dspl_GetTextExtent(str[i],0);
865 }
866
867 /* Work out the desired width of the dialog. If we can wrap line 2 and it is long, wrap it */
868 if (data->WrapStrings & WRAP_STRING_2)
869 nLines = MAX_WRAP_LINES;
870 else
871 nLines = 1;
872 #ifdef COLOURDISPLAY
873 if (data->dlgBgdBitmap!=NULL)
874 {
875 //we only have room to split line 2 into 'max_lines_dlg_popup' lines in the pop-up.
876 //NB this should be calculated depending on the height of the popup bitmap.
877 const int max_lines_dlg_popup=2;
878 if (nLines>max_lines_dlg_popup)
879 nLines = max_lines_dlg_popup;
880 scrWidth = (data->dlgBgdBitmap->area.sx * 3)/4; //the max width is about 3/4 of the pop-up
881 if ( (strLen[DLG_LINE2] > (scrWidth-charWidth)*nLines) ||
882 (strLen[DLG_LINE1] > scrWidth))
883 {
884 //recalculate width below.
885 if (data->WrapStrings & WRAP_STRING_2)
886 nLines = MAX_WRAP_LINES;
887 fullScreen = DLG_USE_RECTANGLE;
888 }
889 else
890 {
891 fullScreen = DLG_USE_BITMAP;
892 //Leave width as is
893 }
894 }
895 #else
896 //On a C-sample, limit pop-up lines to 2 extra (any more - use entire screen)
897 {
898 const int max_lines_dlg_popup=2;
899 if (nLines>max_lines_dlg_popup)
900 nLines = max_lines_dlg_popup;
901 }
902
903 #endif
904 if (fullScreen == DLG_USE_RECTANGLE)
905 {
906 //see if we can display as a pop-up
907 if (SCREEN_SIZE_X < 128)
908 scrWidth = SCREEN_SIZE_X-6;
909 else
910 scrWidth = (SCREEN_SIZE_X*7)/8;
911 if ( strLen[DLG_LINE2] > (scrWidth-charWidth)*nLines)
912 {
913 //Cannot fit in as a pop-up - use full screen
914 fullScreen = DLG_USE_FULL_SCREEN;
915 scrWidth = SCREEN_SIZE_X;
916 }
917 else
918 {
919 //We can fit it in - but we may want to reduce the width for a nicer look.
920 }
921 }
922
923 /*
924 * Wrap second text line (e.g. for long phone numbers.)
925 */
926 if (strLen[DLG_LINE2] > scrWidth-charWidth)
927 {
928 //If we can fit the string on 2 lines - do it.
929 if (data->WrapStrings & WRAP_STRING_2)
930 {
931 if (str[DLG_LINE2][0] != 0x80) //not unicode
932 {
933 wrapLine = 0;
934 lineLen = strlen(str[DLG_LINE2]);
935 // Sep 06 2005 REF: MMI-SPR-33548 x0012849
936 // memset is not required any more .
937 //Now the last element of the str[] will point to the second string of the dialog
938 str[MAX_DLG_LINES] = str[DLG_LINE2]; // Now move the second line of text to the last element of the arrya
939 strLen[MAX_DLG_LINES] = strLen[DLG_LINE2];// put the right value for the length of the string
940 str[DLG_LINE2] = NULL ; // Assign NULL to the second element of the array.
941 while ((wrapLine < MAX_WRAP_LINES) && (linePos<lineLen))
942 {
943 // Sep 06 2005 REF: MMI-SPR-33548 x0012849
944 // Instead of DLG_LINE2 use MAX_DLG_LINES
945 nChar = dspl_GetNcharToFit (&str[MAX_DLG_LINES][linePos], (USHORT)scrWidth);
946 if (nChar > MAX_WRAP_CHAR)
947 nChar = MAX_WRAP_CHAR;
948 // Sep 06 2005 REF: MMI-SPR-33548 x0012849
949 // Allocate MAX_WRAP_CHAR no of bytes
950 temp_ptr = (char*)mfwAlloc(MAX_WRAP_CHAR);
951 if(NULL == temp_ptr)
952 return 0;
953 // Sep 06 2005 REF: MMI-SPR-33548 x0012849
954 // 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]
955 memcpy(temp_ptr,&str[MAX_DLG_LINES][linePos],nChar); // Now the source data is from the last element of the array.
956 linePos = linePos+nChar;
957 ////GW - even if we cannot display the entire string - it is better than what we would have otherwise
958 // Sep 06 2005 REF: MMI-SPR-33548 x0012849
959 // Assign the value of pointer temp_ptr to str[]
960 str[DLG_LINE2+wrapLine] = temp_ptr;
961 temp_ptr = NULL;
962 strLen[DLG_LINE2 + wrapLine] = dspl_GetTextExtent(str[DLG_LINE2+wrapLine],0);
963 wrapLine++;
964 }
965
966 }
967 else
968 {
969 //Unicode is more problematic - we need the 0x80 at the front of the string
970 //for the call to 'dspl_GetNcharToFit'. This will involve copying the entire remainder
971 //of 'str2' into a temporary buffer. At the moment, we only wrap numbers so this
972 //code will wait until it is required.
973 // str[3] = "Code not written!!"; //issue warning
974 // strLen[3] = dspl_GetTextExtent(str[3],0);
975 fullScreen = DLG_USE_FULL_SCREEN; //error - use full screen
976 }
977 }
978 }
979
980 //Calculate longest line of text (including softkeys - sx already set to the softkey width)
981 for (i=0;i< MAX_DLG_LINES;i++)
982 {
983 if (strLen[i]>sx)
984 sx = strLen[i];
985 }
986 if (sx > SCREEN_SIZE_X-charWidth)
987 sx = SCREEN_SIZE_X;
988 else
989 {
990 if (sx > SCREEN_SIZE_X/2)
991 sx = sx + charWidth;
992 else
993 sx = sx + charWidth*2;
994 }
995 if (sy> sx)
996 sx = sy;
997 wx = (SCREEN_SIZE_X-sx)/2;
998 if (wx<0)
999 wx=0;
1000 }
1001
1002 if (sy > SCREEN_SIZE_Y)
1003 wy = 0;
1004 else if (SCREEN_SIZE_Y > 2*sy)
1005 wy = (SCREEN_SIZE_Y*2/3-sy)/2; //display in middle of top 2/3 of screen
1006 else
1007 wy = (SCREEN_SIZE_Y-sy)/2; //display in middle of screen
1008 if (wy < 10)
1009 wy = wy/2;
1010
1011 if ((wx == 0) || (wy==0))
1012 { //not enough room to display as a window - use whole screen
1013 fullScreen = DLG_USE_FULL_SCREEN;
1014 }
1015
1016 #ifdef COLOURDISPLAY
1017 if ((data->icon_array != NULL) && (fullScreen != DLG_USE_BITMAP))
1018 { //The dialog has an animation - we must make the pop-up large enough to support this
1019 if (sx < data->icon_array[0].area.sx)
1020 sx = data->icon_array[0].area.sx;
1021 yBmpOfs = data->icon_array[0].area.py + data->icon_array[0].area.sy;
1022 wy = data->icon_array[0].area.py;
1023 sy = sy + data->icon_array[0].area.sy;
1024 }
1025 #endif
1026 }
1027 else
1028 {
1029 //We have no strings to display - clear entire screen
1030 fullScreen = DLG_USE_FULL_SCREEN;
1031 }
1032
1033
1034 /******************************
1035 * Draw window (full screen/pop-up)
1036 *****************************/
1037 if (fullScreen != DLG_USE_FULL_SCREEN)
1038 dspl_unfocusDisplay();
1039 area.px = 0;
1040 area.py = 0;
1041 area.sx = sx;
1042 area.sy = sy;
1043 resources_setColour(data->dlgCol);
1044 drawWinType = DSPL_WIN_CENTRE;
1045
1046 if (fullScreen!=DLG_USE_FULL_SCREEN)
1047 {
1048 t_font_bitmap bmp;
1049 t_font_bitmap* bmpPtr = NULL;
1050
1051 for (i=0;i<MAX_DLG_LINES;i++)
1052 {
1053 //centre text
1054 xPos[i] = wx+(sx-strLen[i])/2;
1055 yPos[i] = wy+yOfs+yBmpOfs+Mmi_layout_line_height()*i;
1056 }
1057
1058 #ifdef COLOURDISPLAY
1059 if ((data->dlgBgdBitmap != NULL) && (fullScreen==DLG_USE_BITMAP))
1060 {
1061 bmp.format = data->dlgBgdBitmap->icnType;
1062 bmp.height = data->dlgBgdBitmap->area.sy;
1063 bmp.width = data->dlgBgdBitmap->area.sx;
1064 bmp.bitmap = data->dlgBgdBitmap->icons;
1065 bmpPtr = &bmp;
1066 area = calcLayout(data->dlgType, sx, sy, bmp.width, bmp.height);
1067
1068 //Adjust size of available area depending on bitmap properties/dlgType.
1069 //dlgType== 0 =>display info in centre of bitmap
1070 if (data->dlgType == 0)
1071 {
1072 //If the bmp is bigger than the data we will move the bmp to
1073 //lie over the centre of the data
1074 area.px = area.px - (bmp.width - sx)/2;
1075 area.py = area.py - (bmp.height- sy)/2;
1076 }
1077 for (i=0;i<MAX_DLG_LINES;i++)
1078 {
1079 xPos[i] = xPos[i] + area.px;
1080 yPos[i] = yPos[i] + area.py;
1081 }
1082
1083 TRACE_EVENT_P3("wy = %d, yOfs = %d, area.py = %d",wy,yOfs,area.py);
1084 if( data->dlgBgdBitmap->icnType != ICON_TYPE_1BIT_UNPACKED )
1085 dspl_SetBgdColour( COL_TRANSPARENT );
1086
1087
1088 }
1089 else
1090 {
1091 sy = sy + (wrapLine-2)*Mmi_layout_line_height();
1092 area.sy = sy;
1093 }
1094 #else
1095 if (wrapLine>1)
1096 {
1097 sy = sy + (wrapLine-1)*Mmi_layout_line_height();
1098 area.sy = sy;
1099 }
1100 #endif
1101 // Sep 06 2005 REF: MMI-SPR-33548 x0012849
1102 //If length of the dialog is bigger than screen then start the dialog from the top corner.
1103 if(sy+wy >= SCREEN_SIZE_Y && sy < SCREEN_SIZE_Y)
1104 if(wy>0 && wy < sy)
1105 {
1106 wy = (SCREEN_SIZE_Y - sy ) /2 ;// centre the dialog
1107 if(wy < 0)
1108 wy=0;
1109 for (i=0;i<MAX_DLG_LINES;i++)
1110 yPos[i] = wy+yOfs+yBmpOfs+Mmi_layout_line_height()*i;
1111 }
1112 dspl_DrawWin( wx,wy,sx,sy, drawWinType , bmpPtr);
1113 }
1114 else
1115 {
1116 dspl_ClearAll();
1117 sx = 84;
1118 for (i=0;i<MAX_DLG_LINES;i++)
1119 {
1120 xPos[i] = 0;
1121 yPos[i] = Mmi_layout_line(i+1);
1122 }
1123 }
1124 /******************************
1125 * Print softkeys
1126 *****************************/
1127 icnShow(data->icon);
1128 if ((lskStr != NULL) || (rskStr != NULL))
1129 {
1130 if (fullScreen==DLG_USE_FULL_SCREEN)
1131 Mmi_layout_softkeyArea( &skArea );
1132 else
1133 {
1134 skArea.px = area.px+wx;
1135 skArea.sx = area.sx;
1136 skArea.py = area.py+wy+area.sy-Mmi_layout_softkeyHeight()-1;
1137 skArea.sy = Mmi_layout_softkeyHeight();
1138 }
1139 softKeys_displayStrXY(lskStr, rskStr, data->dlgSkFormat, data->dlgCol, &skArea);
1140 }
1141
1142 /******************************
1143 * Print dialog text
1144 *****************************/
1145 for (i=0;i<MAX_DLG_LINES;i++)
1146 { /* GW#2294 No need to draw zero length strings .*/
1147 if ((str[i] != NULL) && (strLen[i] > 0))
1148 {
1149 //x0035544 Feb 15, 2006. DR:OMAPS00061467
1150 #ifdef FF_MMI_SAT_ICON
1151 if(data->IconData.selfExplanatory == FALSE)
1152 dspl_TextOut(xPos[i] + titleIconWidth, yPos[i], DSPL_TXTATTR_NORMAL, str[i] );
1153 #else
1154 dspl_TextOut(xPos[i] , yPos[i], DSPL_TXTATTR_NORMAL, str[i] );
1155 #endif
1156 }
1157 }
1158 //x0035544 Feb 15, 2006. DR:OMAPS00061467
1159 #ifdef FF_MMI_SAT_ICON
1160 if(data->IconData.dst != NULL)
1161 {
1162 if(str[DLG_LINE2] == NULL)
1163 {
1164 if ((data->IconData.width > TITLE_ICON_WIDTH) ||
1165 (data->IconData.height > TITLE_ICON_HEIGHT))
1166 {
1167 dspl_BitBlt2(xPos[0], yPos[0], 8,
1168 10, (void*)SATIconQuestionMark, 0, BMP_FORMAT_256_COLOUR);
1169 }
1170
1171 else
1172 dspl_BitBlt2(xPos[0], yPos[0], data->IconData.width,
1173 data->IconData.height, (void*)data->IconData.dst, 0, BMP_FORMAT_256_COLOUR);
1174 }
1175 else
1176 {
1177 if ((data->IconData.width > TITLE_ICON_WIDTH) ||
1178 (data->IconData.height > TITLE_ICON_HEIGHT))
1179 {
1180 dspl_BitBlt2(xPos[DLG_LINE2], yPos[DLG_LINE2], 8,
1181 10, (void*)SATIconQuestionMark, 0, BMP_FORMAT_256_COLOUR);
1182 }
1183 else
1184 dspl_BitBlt2(xPos[DLG_LINE2], yPos[DLG_LINE2],data->IconData.width,
1185 data->IconData.height, (void*)data->IconData.dst, 0, BMP_FORMAT_256_COLOUR);
1186 }
1187
1188 }
1189 #endif
1190
1191
1192 resources_restoreColour();
1193 }
1194 break;
1195
1196 default:
1197 return 0;
1198 }
1199 // Sep 06 2005 REF: MMI-SPR-33548 x0012849
1200 // Now free the allocated memory
1201 if (strLen[MAX_DLG_LINES] > scrWidth-charWidth)
1202 if (data->WrapStrings & WRAP_STRING_2)
1203 if (str[MAX_DLG_LINES][0] != 0x80)
1204 {
1205 for(i=DLG_LINE2;i<MAX_DLG_LINES;i++)
1206 {
1207 if(NULL != str[i] && strLen[i] > 0)
1208 mfwFree((U8*)str[i],MAX_WRAP_CHAR);
1209 }
1210 str[MAX_DLG_LINES]=NULL;
1211 }
1212
1213 return 1;
1214 }
1215
1216
1217 /*******************************************************************************
1218
1219 $Function: dialog_info_tim_cb
1220
1221 $Description: Callback function for the dialog info timer.
1222
1223
1224 $Returns: MFW event handler
1225
1226 $Arguments: window handle event, timer control block
1227
1228 *******************************************************************************/
1229 static T_MFW_CB dialog_info_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc)
1230 {
1231 T_MFW_HND win = mfw_parent (mfw_header());
1232 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
1233 T_dialog_info * data = (T_dialog_info *)win_data->user;
1234
1235 T_MFW_HND parent_win = data->parent_win;
1236 USHORT Identifier = data->Identifier;
1237 void (* Callback)() = data->Callback;
1238
1239 #if defined (WIN32)
1240 {
1241 /***************************Go-lite Optimization changes Start***********************/
1242
1243 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1244 TRACE_EVENT_P1 ("Identifier %d", data->Identifier););
1245 /***************************Go-lite Optimization changes end***********************/
1246
1247 }
1248 #endif
1249
1250 /*
1251 ** SPR#1744 NDH
1252 ** Move the dialog destory in front of the Callback to make the processing consistent
1253 ** with the Right Keypress and Hangup Processing. Also to ensure that the dialog is
1254 ** removed when the screen is redrawn.
1255 */
1256 dialog_info_destroy (win);
1257
1258 if (Callback)
1259 (Callback) (parent_win, Identifier, INFO_TIMEOUT);
1260
1261 return 0;
1262 }
1263
1264
1265 /*******************************************************************************
1266
1267 $Function: dialog_info_kbd_cb
1268
1269 $Description: Keyboard event handler
1270
1271 $Returns: status int
1272
1273 $Arguments: window handle event, keyboard control block
1274
1275 *******************************************************************************/
1276
1277 static int dialog_info_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard)
1278 {
1279 T_MFW_HND win = mfw_parent (mfw_header());
1280 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
1281 T_dialog_info * data = (T_dialog_info *)win_data->user;
1282 T_MFW_HND parent_win = data->parent_win;
1283 USHORT Identifier = data->Identifier;
1284 void (* Callback)() = data->Callback;
1285
1286 TRACE_FUNCTION("dialog_info_kbd_cb");
1287
1288 switch (keyboard->code)
1289 {
1290 case KCD_LEFT:
1291 if (data->KeyEvents & KEY_LEFT )
1292 {
1293 dialog_info_destroy (win);
1294 if (Callback)
1295 (Callback) (parent_win, Identifier, INFO_KCD_LEFT);
1296 }
1297 break;
1298
1299 case KCD_RIGHT:
1300 if (data->KeyEvents & KEY_RIGHT)
1301 {
1302 dialog_info_destroy (win);
1303 if (Callback)
1304 (Callback) (parent_win, Identifier, INFO_KCD_RIGHT);
1305 }
1306 break;
1307
1308 case KCD_HUP:
1309 if (data->KeyEvents & KEY_HUP || data->KeyEvents & INFO_KCD_ALL)
1310 {
1311 dialog_info_destroy (win);
1312 if (Callback)
1313 (Callback) (parent_win, Identifier, INFO_KCD_HUP);
1314 }
1315 break;
1316 case KCD_MNUUP:
1317
1318 if (data->KeyEvents & KEY_MNUUP)
1319 {
1320 if (Callback)
1321 (Callback) (parent_win, Identifier, INFO_KCD_UP);
1322 }
1323
1324 break;
1325 case KCD_MNUDOWN:
1326
1327 if (data->KeyEvents & KEY_MNUDOWN)
1328 {
1329 if (Callback)
1330 (Callback) (parent_win, Identifier, INFO_KCD_DOWN);
1331 }
1332
1333 break;
1334 //MZ 7/3/01 used to start a call.
1335 case KCD_CALL:
1336 if (data->KeyEvents & KEY_CALL )
1337 {
1338 dialog_info_destroy (win);
1339 if (Callback)
1340 (Callback) (parent_win, Identifier, INFO_KCD_OFFHOOK);
1341 }
1342 break;
1343 default:
1344 if (data->KeyEvents & INFO_KCD_ALL)
1345 {
1346 /*
1347 Note: The variable Identifier is overwritten with the
1348 keycode of the dialog;
1349 we need it only for the Multicall Control !!
1350 */
1351 Identifier = keyboard->code;
1352 dialog_info_destroy (win);
1353 if (Callback)
1354 (Callback) (parent_win, Identifier, INFO_KCD_ALL);
1355 }
1356 break;
1357
1358 }
1359 return MFW_EVENT_CONSUMED;
1360 }
1361
1362 static int dialog_info_kbd_long_cb(T_MFW_EVENT event, T_MFW_KBD *keyboard){
1363 return MFW_EVENT_CONSUMED;
1364 }
1365
1366
1367
1368 /*******************************************************************************
1369
1370 $Function: mmi_dialog_information_screen
1371
1372 $Description:
1373
1374 $Returns:
1375
1376 $Arguments:
1377
1378 *******************************************************************************/
1379
1380 T_MFW_HND mmi_dialog_information_screen(T_MFW_HND parent_win, int TxtId, char* text, T_VOID_FUNC call_back, USHORT identifier)
1381 {
1382 T_DISPLAY_DATA display_info;
1383 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtId, TxtNull, COLOUR_STATUS);
1384 dlg_initDisplayData_events( &display_info, call_back, THREE_SECS, KEY_ALL );
1385 //Sep 01, 2004 REF: CRR 21380 Deepa M.D
1386 //Assigning TextId and TextString will not display both the messages.
1387 //Hence we need to use TextId and TextString2 or TextId2 and TextString
1388 display_info.TextString2 = text;
1389 display_info.Identifier = identifier;
1390 return info_dialog(parent_win,&display_info); //information screen
1391
1392 }
1393
1394 T_MFW_HND mmi_dialog_information_screen_forever(MfwHnd win,int TextId, char* TextStr, int colour)
1395 {
1396 T_DISPLAY_DATA DisplayInfo;
1397 dlg_initDisplayData_TextId( &DisplayInfo, TxtNull, TxtNull, TextId, TxtNull, colour);
1398 dlg_initDisplayData_events( &DisplayInfo, NULL, FOREVER, KEY_HUP );
1399 DisplayInfo.TextString = TextStr;
1400 return info_dialog(win, &DisplayInfo);
1401 }
1402
1403 /*******************************************************************************
1404
1405 $Function: mmi_dialogs_insert_icon
1406
1407 $Description: Displays one icon in a dialog
1408
1409 $Returns: none
1410
1411 $Arguments: win, pointer to an icon
1412
1413 *******************************************************************************/
1414 void mmi_dialogs_insert_icon (T_MFW_HND win_dialog ,MfwIcnAttr *icon)
1415 {
1416 T_MFW_WIN * win_data = ((T_MFW_HDR *)win_dialog)->data;
1417 T_dialog_info * data = (T_dialog_info *)win_data->user;
1418
1419
1420 data->icon = icnCreate(win_dialog,icon,E_ICN_VISIBLE,NULL);
1421 icnUnhide(data->icon);
1422 winShow(win_dialog);
1423
1424 }
1425
1426 /*******************************************************************************
1427
1428 $Function: mmi_dialogs_insert_animation
1429
1430 $Description: starts an animation in a dialog
1431
1432 $Returns: none
1433
1434 $Arguments: win, animation time, pointer to an icon, number of frames
1435
1436 *******************************************************************************/
1437 void mmi_dialogs_insert_animation (T_MFW_HND win_dialog , S32 anim_time ,MfwIcnAttr *icon ,UBYTE number_of_frames)
1438 {
1439 T_MFW_WIN * win_data = ((T_MFW_HDR *)win_dialog)->data;
1440 T_dialog_info * data = (T_dialog_info *)win_data->user;
1441
1442
1443 data->number_of_frames = number_of_frames;
1444 data->current_frame = 0;
1445 data->icon_array = icon;
1446 data->current_icon = data->icon_array;
1447 data->icon = icnCreate(win_dialog,data->current_icon,E_ICN_VISIBLE,NULL);
1448 icnUnhide(data->icon);
1449
1450 data->animation_timer = timCreate(win_dialog,anim_time,(MfwCb)mmi_dialogs_insert_animation_CB);
1451 timStart(data->animation_timer);
1452 winShow(win_dialog);
1453
1454 }
1455
1456 /*******************************************************************************
1457
1458 $Function: mmi_dialogs_insert_animation_CB
1459
1460 $Description: destroys the current icon and starts the next icon
1461
1462 $Returns: none
1463
1464 $Arguments: timer event, timer control block
1465
1466 *******************************************************************************/
1467 void mmi_dialogs_insert_animation_CB (T_MFW_EVENT event, T_MFW_TIM *tc)
1468 {
1469 T_MFW_HND win = mfw_parent (mfw_header());
1470 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
1471 T_dialog_info * data = (T_dialog_info *)win_data->user;
1472
1473
1474 icnDelete(data->icon);
1475 if (data->current_frame < (data->number_of_frames-1))
1476 {
1477 data->current_frame++;
1478 data->current_icon++;
1479 }
1480 else
1481 {
1482 data->current_frame = 0;
1483 data->current_icon = data->icon_array;
1484 }
1485 data->icon = icnCreate(win,data->current_icon,E_ICN_VISIBLE,NULL);
1486 icnUnhide(data->icon);
1487 timStart(data->animation_timer);
1488 winShow(win);
1489
1490 }
1491 /***************************Go-lite Optimization changes Start***********************/
1492
1493 //Aug 25, 2004 REF: CRR 24904 Deepa M.D
1494 //This function is used only for the Color build.Hence it is put under the
1495 //COLOURDISPLAY compiler switch
1496 #ifdef COLOURDISPLAY
1497 void mmi_dialogs_insert_animation_new (T_DISPLAY_DATA *animateInfo , S32 anim_time ,MfwIcnAttr* icon ,UBYTE number_of_frames)
1498 {
1499 TRACE_EVENT("mmi_dialogs_insert_animation_new()");
1500
1501 animateInfo->number_of_frames = number_of_frames;
1502 animateInfo->current_frame = 0;
1503 animateInfo->icon_array = icon;
1504 animateInfo->anim_time = anim_time;
1505
1506 }
1507 #endif
1508 /***************************Go-lite Optimization changes end***********************/
1509
1510 void mmi_dialogs_animation_new_CB (T_MFW_EVENT event, T_MFW_TIM *tc)
1511 {
1512 T_MFW_HND win = mfw_parent (mfw_header());
1513 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
1514 T_dialog_info * data = (T_dialog_info *)win_data->user;
1515 char * idData;
1516 int px, py, sx, sy;
1517 MfwIcnAttr* icn_array;
1518 MfwIcnAttr* icn;
1519
1520 TRACE_EVENT("mmi_dialogs_insert_animation_new_CB()");
1521
1522
1523
1524 data->current_frame = (data->current_frame +1) % data->number_of_frames;
1525 TRACE_EVENT_P1("data->current_frame = %d", data->current_frame);
1526 TRACE_EVENT_P1("number_of_frames = %d", data->number_of_frames);
1527
1528 icn_array = (MfwIcnAttr*)data->icon_array;
1529 TRACE_EVENT_P1("data->icon_array = %x", (int)data->icon_array);
1530
1531 icn = &icn_array[data->current_frame];
1532
1533 px = icn->area.px;
1534 py = icn->area.py;
1535 sx = icn->area.sx;
1536 sy = icn->area.sy;
1537
1538 TRACE_EVENT_P4("px = %d, py = %d, sx = %d, sy = %d", icn->area.px,icn->area.py,icn->area.sx,icn->area.sy);
1539
1540 idData = icn->icons;
1541
1542 dspl_BitBlt2(px,py,sx,sy,(void*)idData,0,0x02);
1543 timStart(data->animation_timer);
1544
1545 }
1546 //Jun 04,2004 CRR:13601 xpradipg - SASKEN
1547 /*******************************************************************************
1548
1549 $Function: InfoDialogTimRestart
1550
1551 $Description: restarts the information dialog timer
1552
1553 $Returns: none
1554
1555 $Arguments: window handler
1556
1557 *******************************************************************************/
1558
1559 void InfoDialogTimRestart(T_MFW_HND win)
1560 {
1561 T_MFW_WIN * win_data;
1562 T_dialog_info * data;
1563
1564 win_data = ((T_MFW_HDR *)win)->data;
1565 data = (T_dialog_info *)win_data->user;
1566
1567 tim_stop(data->info_tim);
1568 tim_start(data->info_tim);
1569 }
1570
1571 // Feb 24, 2005 CRR:29102 xnkulkar - SASKEN
1572 // As the user has already confirmed that all SMS messages are to be deleted, KEY_HUP is not
1573 // registered.
1574 /*******************************************************************************
1575
1576 $Function: mmi_dialog_information_screen_delete_all
1577
1578 $Description: Displays the information screen during "Delete All" operation
1579
1580 $Returns: Handle of information dialog
1581
1582 $Arguments: window handle, text id, text string and generic status window
1583
1584 *******************************************************************************/
1585 T_MFW_HND mmi_dialog_information_screen_delete_all(MfwHnd win,int TextId, char* TextStr, int colour)
1586 {
1587 T_DISPLAY_DATA DisplayInfo;
1588
1589 dlg_initDisplayData_TextId( &DisplayInfo, TxtNull, TxtNull, TextId, TxtNull, colour);
1590 dlg_initDisplayData_events( &DisplayInfo, NULL, FOREVER, NULL );
1591 DisplayInfo.TextString = TextStr;
1592
1593 return info_dialog(win, &DisplayInfo);
1594 }
1595