FreeCalypso > hg > tcs211-fcmodem
comparison g23m/condat/ms/src/bmi/mmiSatMenu.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
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: MMI | |
16 $File: MmiSatMenu.c | |
17 $Revision: 1.0 | |
18 | |
19 $Author: Condat(UK) | |
20 $Date: 25/10/00 | |
21 | |
22 ******************************************************************************** | |
23 | |
24 Description: | |
25 | |
26 Implementation of MMI SIM Application Toolkit (SAT) | |
27 | |
28 ******************************************************************************** | |
29 | |
30 $History: MmiSatMenu.c | |
31 | |
32 Shashi Shekar B.S., a0876501, 16 Mar, 2006, OMAPS00061462 | |
33 Icon support for SetupMenu & Select item. | |
34 | |
35 xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
36 Using the MenuSelect Key for requesting the help info in STK menu. | |
37 | |
38 May 24, 2005 REF: CRR 29358 x0021334 | |
39 Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response | |
40 Fix: The implementation is now based on timer. After the specified timeout period | |
41 the control comes back to SAT main menu, if there is no selection done by the user. | |
42 | |
43 Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
44 Bug:Clenup of sprintf used for tracing | |
45 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX | |
46 | |
47 25/10/00 Original Condat(UK) BMI version. | |
48 | |
49 $End | |
50 | |
51 *******************************************************************************/ | |
52 | |
53 | |
54 | |
55 /******************************************************************************* | |
56 | |
57 Include Files | |
58 | |
59 *******************************************************************************/ | |
60 #define ENTITY_MFW | |
61 | |
62 /* includes */ | |
63 #include <string.h> | |
64 #include <stdio.h> | |
65 #include <stdlib.h> | |
66 | |
67 #if defined (NEW_FRAME) | |
68 | |
69 #include "typedefs.h" | |
70 #include "vsi.h" | |
71 #include "pei.h" | |
72 #include "custom.h" | |
73 #include "gsm.h" | |
74 | |
75 #else | |
76 | |
77 #include "STDDEFS.H" | |
78 #include "custom.h" | |
79 #include "gsm.h" | |
80 #include "vsi.h" | |
81 | |
82 #endif | |
83 #include "mfw_sys.h" | |
84 #include "prim.h" | |
85 | |
86 | |
87 | |
88 #include "mfw_mfw.h" | |
89 #include "mfw_win.h" | |
90 #include "mfw_kbd.h" | |
91 /* SPR#1428 - SH - New Editor changes */ | |
92 #ifndef NEW_EDITOR | |
93 #include "mfw_edt.h" | |
94 #endif | |
95 #include "mfw_lng.h" | |
96 #include "mfw_icn.h" | |
97 #include "mfw_phb.h" | |
98 #include "mfw_sim.h" | |
99 #include "mfw_nm.h" | |
100 #include "mfw_sms.h" | |
101 #include "mfw_mnu.h" | |
102 #include "mfw_sat.h" | |
103 #include "mfw_tim.h" | |
104 | |
105 #include "ksd.h" | |
106 #include "psa.h" | |
107 #include "dspl.h" | |
108 | |
109 | |
110 #include "MmiMmi.h" | |
111 #include "MmiDummy.h" | |
112 #include "MmiDialogs.h" | |
113 #include "MmiLists.h" | |
114 | |
115 #include "MmiMain.h" | |
116 #include "MmiStart.h" | |
117 #include "MmiPins.h" | |
118 #include "MmiMenu.h" | |
119 #include "MmiSoftKeys.h" | |
120 #include "MmiSounds.h" | |
121 #include "mmiCall.h" | |
122 | |
123 #include "mmiSat_i.h" | |
124 | |
125 #include "cus_aci.h" | |
126 | |
127 #include "prim.h" | |
128 #ifndef PCM_2_FFS | |
129 #include "pcm.h" | |
130 #endif | |
131 | |
132 | |
133 #include "mmiColours.h" | |
134 | |
135 BOOL g_SATsession_is_active = FALSE; | |
136 | |
137 // May 24, 2005 REF: CRR 29358 x0021334 | |
138 static BOOL g_sat_scroll_status = FALSE; // to determine if the user has scrolled up/down | |
139 BOOL getScrollStatus(void); // function prototype | |
140 | |
141 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
142 #ifdef FF_MMI_SAT_ICON | |
143 static T_SAT_IconInfo setupMenuItemIconData, setupMenuHeaderIconData; | |
144 static T_SAT_IconInfo selectItemIconData, selectItemHeaderIconData; | |
145 #endif | |
146 | |
147 | |
148 /********************************************************************* | |
149 ********************************************************************** | |
150 | |
151 setup_menu DYNAMIC MENU WINDOW. DECLARATION | |
152 | |
153 ********************************************************************* | |
154 **********************************************************************/ | |
155 typedef struct | |
156 { | |
157 /* administrative data */ | |
158 | |
159 T_MMI_CONTROL mmi_control; | |
160 T_MFW_HND win; | |
161 T_MFW_HND kbd; /* sbh - keyboard handler, so window can be destroyed by user */ | |
162 | |
163 /* associated handlers */ | |
164 | |
165 /* internal data */ | |
166 T_SAT_CMD *sat_command; /* pointer to sat_command in parent */ | |
167 ListMenuData_t list_menu_data; | |
168 } T_sat_setup_menu; | |
169 | |
170 static T_MFW_HND sat_setup_menu_create (T_MFW_HND parent); | |
171 static void sat_setup_menu_destroy (T_MFW_HND window); | |
172 static void sat_setup_menu_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command); | |
173 static void sat_setup_menu_listmnu_cb (T_MFW_HND win, ListMenuData_t * ListData); | |
174 static T_MFW sat_setup_menu_recreate(T_sat_setup_menu *data); | |
175 | |
176 // May 24, 2005 REF: CRR 29358 x0021334 | |
177 // Prototype declaratio for sat_select_TimerCb(). | |
178 static int sat_select_TimerCb (T_MFW_EVENT event, T_MFW_TIM *timer); | |
179 | |
180 static MfwMnuAttr sat_setup_menuAttrib = | |
181 { | |
182 &sat_setup_menuArea, | |
183 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */ | |
184 -1, /* use default font */ | |
185 NULL, /* with these items */ | |
186 0 , /* number of items */ | |
187 COLOUR_LIST_XX, TxtNull, NULL, MNUATTRSPARE | |
188 | |
189 }; | |
190 | |
191 static MfwMnuAttr sat_select_menuAttrib = | |
192 { | |
193 &sat_select_menuArea, | |
194 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */ | |
195 -1, /* use default font */ | |
196 NULL, /* with these items */ | |
197 0, /* number of items */ | |
198 COLOUR_LIST_XX, TxtNull, NULL, MNUATTRSPARE | |
199 }; | |
200 | |
201 /* SPR#2492 - DS - Dynamically allocated string storage for SAT menu header */ | |
202 static char* menuHdr = NULL; | |
203 | |
204 | |
205 /********************************************************************* | |
206 ********************************************************************** | |
207 | |
208 setup_menu DYNAMIC MENU WINDOW. IMPLEMENTATION | |
209 | |
210 ********************************************************************* | |
211 **********************************************************************/ | |
212 | |
213 T_MFW_HND sat_setup_menu_start(T_SAT_CMD * sat_command) | |
214 { | |
215 T_MFW_HND win; | |
216 | |
217 TRACE_FUNCTION ("sat_setup_menu_start()"); | |
218 /***************************Go-lite Optimization changes Start***********************/ | |
219 //Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
220 TRACE_EVENT_P1("MFW Memory Left after starting SAT %d",mfwCheckMemoryLeft()); | |
221 /***************************Go-lite Optimization changes end***********************/ | |
222 | |
223 win = sat_setup_menu_create (NULL); | |
224 | |
225 if (win NEQ NULL) | |
226 { | |
227 SEND_EVENT (win, SAT_SETUP_MENU, 0, sat_command); | |
228 } | |
229 return win; | |
230 } | |
231 | |
232 static T_MFW_HND sat_setup_menu_create(MfwHnd parent_window) | |
233 { | |
234 T_sat_setup_menu * data = (T_sat_setup_menu *)ALLOC_MEMORY (sizeof (T_sat_setup_menu)); | |
235 T_MFW_WIN * win; | |
236 | |
237 TRACE_EVENT ("sat_setup_menu_create()"); | |
238 | |
239 /* | |
240 * Create window handler | |
241 */ | |
242 | |
243 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)sat_win_cb); | |
244 sat_set_setup_menu_win(data->win); // c030 rsa | |
245 | |
246 if (data->win EQ NULL) | |
247 { | |
248 return NULL; | |
249 } | |
250 | |
251 /* | |
252 * connect the dialog data to the MFW-window | |
253 */ | |
254 | |
255 data->mmi_control.dialog = (T_DIALOG_FUNC)sat_setup_menu_exec; | |
256 data->mmi_control.data = data; | |
257 win = ((T_MFW_HDR *)data->win)->data; | |
258 win->user = (MfwUserDataPtr)data; | |
259 | |
260 data->kbd = kbdCreate( data->win, KEY_ALL, (T_MFW_CB) sat_kbd_cb); /* sbh - add keyboard handler */ | |
261 | |
262 /* | |
263 * return window handle | |
264 */ | |
265 | |
266 | |
267 g_SATsession_is_active = TRUE; | |
268 | |
269 win_show(data->win); | |
270 return data->win; | |
271 } | |
272 | |
273 static void sat_setup_menu_destroy(MfwHnd own_window) | |
274 { | |
275 T_MFW_WIN * win_data; | |
276 T_sat_setup_menu * data; | |
277 int i; | |
278 | |
279 TRACE_EVENT ("sat_setup_menu_destroy()"); | |
280 | |
281 g_SATsession_is_active = FALSE; | |
282 | |
283 if (own_window) | |
284 { | |
285 win_data = ((T_MFW_HDR *)own_window)->data; | |
286 data = (T_sat_setup_menu *)win_data->user; | |
287 | |
288 if (data) | |
289 { | |
290 /* | |
291 * Delete WIN handler | |
292 */ | |
293 win_delete (data->win); | |
294 | |
295 /* | |
296 * Free Memory | |
297 */ | |
298 | |
299 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
300 #ifdef FF_MMI_SAT_ICON | |
301 /* Free the memory allocated for Item icon data. */ | |
302 if(setupMenuItemIconData.dst != NULL) | |
303 { | |
304 FREE_MEMORY((U8 *)setupMenuItemIconData.dst, setupMenuItemIconData.width * | |
305 setupMenuItemIconData.height); | |
306 setupMenuItemIconData.dst = NULL; | |
307 } | |
308 | |
309 /* Free the memory allocated for Header icon data. */ | |
310 if(setupMenuHeaderIconData.dst != NULL) | |
311 { | |
312 FREE_MEMORY((U8 *)setupMenuHeaderIconData.dst, setupMenuHeaderIconData.width * | |
313 setupMenuHeaderIconData.height); | |
314 setupMenuHeaderIconData.dst = NULL; | |
315 } | |
316 #endif | |
317 | |
318 for (i=0; i < data->list_menu_data.ListLength; i++) | |
319 { | |
320 sat_destroy_ITEM_ASCIIZ (data->list_menu_data.List[i].str); | |
321 | |
322 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
323 #ifdef FF_MMI_SAT_ICON | |
324 if(data->list_menu_data.List[i].icon != NULL) | |
325 { | |
326 FREE_MEMORY((U8 *)data->list_menu_data.List[i].icon, sizeof (MfwIcnAttr)); | |
327 data->list_menu_data.List[i].icon = NULL; | |
328 } | |
329 #endif | |
330 } | |
331 FREE_MEMORY ((U8 *)data->list_menu_data.List, | |
332 (data->list_menu_data.ListLength * sizeof (MfwMnuItem))); | |
333 data->list_menu_data.List = NULL; | |
334 FREE_MEMORY ((U8 *)data, sizeof (T_sat_setup_menu)); | |
335 | |
336 /* SPR#2492 - DS - Free SAT menu header if it exists */ | |
337 if (menuHdr) | |
338 { | |
339 TRACE_EVENT_P2("Destroy menuHdr %d with size %d", menuHdr, *(menuHdr -(U16)sizeof(U16)) ); | |
340 sat_destroy_TEXT_ASCIIZ(menuHdr); | |
341 menuHdr = NULL; /* dsm 01/12/03 - Added to explicitly set menuHdr to NULL */ | |
342 | |
343 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
344 #ifdef FF_MMI_SAT_ICON | |
345 if(data->list_menu_data.Attr->icon != NULL) | |
346 { | |
347 FREE_MEMORY((U8 *)data->list_menu_data.Attr->icon, sizeof (MfwIcnAttr)); | |
348 data->list_menu_data.Attr->icon = NULL; | |
349 } | |
350 #endif | |
351 } | |
352 | |
353 sat_set_setup_menu_win(NULL); // c030 rsa | |
354 } | |
355 else | |
356 { | |
357 TRACE_EVENT ("sat_setup_menu_destroy() called twice"); | |
358 } | |
359 } | |
360 } | |
361 | |
362 static T_MFW sat_setup_menu_recreate(T_sat_setup_menu *data) | |
363 { | |
364 int i; | |
365 SatMenu * menu = &data->sat_command->c.menu; | |
366 int Unicode_menu = FALSE; /*MC, SPR 940/2flag to lay-out as Unicode*/ | |
367 T_MFW retVal; | |
368 | |
369 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
370 #ifdef FF_MMI_SAT_ICON | |
371 USHORT icon_length; | |
372 USHORT fontHeight, menuHeight = 0, titleHeight; | |
373 #endif | |
374 | |
375 TRACE_EVENT ("sat_setup_menu_recreate()"); | |
376 | |
377 #ifdef __COMPLETE_LIST_SUPPORT__ /* ??? rsa for future extension */ | |
378 if ((&data->sat_command.qual & SAT_M_SETUP_HELP_AVAIL) NEQ 0) | |
379 { | |
380 data->list_menu_data.AlternateLeftSoftKey = TxtHelp; /* help available */ | |
381 } | |
382 else | |
383 { | |
384 data->list_menu_data.AlternateLeftSoftKey = TxtNull; /* no help available */ | |
385 } | |
386 #endif | |
387 | |
388 if (data->list_menu_data.List EQ NULL) | |
389 { | |
390 /* c030 rsa first time creation */ | |
391 /* allocate sufficient memory to hold the list of menu items */ | |
392 data->list_menu_data.ListLength = menu->nItems; /* actual number of entries in list menu. */ | |
393 data->list_menu_data.List = (MfwMnuItem *)ALLOC_MEMORY (data->list_menu_data.ListLength * sizeof (MfwMnuItem)); | |
394 memset(data->list_menu_data.List, 0x00, data->list_menu_data.ListLength * sizeof (MfwMnuItem)); | |
395 | |
396 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
397 #ifdef FF_MMI_SAT_ICON | |
398 if(data->sat_command->c.menu.itemIconQual != 0xFF) | |
399 { | |
400 /* We have icon to be displayed*/ | |
401 /* Copy the icon data to the editor attributes*/ | |
402 setupMenuItemIconData.width = data->sat_command->c.menu.items[1].iconInfo.width; | |
403 setupMenuItemIconData.height = data->sat_command->c.menu.items[1].iconInfo.height; | |
404 | |
405 icon_length = data->sat_command->c.menu.items[1].iconInfo.width * data->sat_command->c.menu.items[1].iconInfo.height; | |
406 | |
407 setupMenuItemIconData.dst = (char *)ALLOC_MEMORY (icon_length); | |
408 | |
409 memcpy(setupMenuItemIconData.dst, data->sat_command->c.menu.items[1].iconInfo.dst, icon_length); | |
410 | |
411 /* Icon is self-explanatory. No need to display text for this case.*/ | |
412 if(data->sat_command->c.menu.itemIconQual == 0x00) | |
413 { | |
414 /* Icon is self-explanatory. Do not display the text*/ | |
415 setupMenuItemIconData.selfExplanatory = TRUE; | |
416 } | |
417 else | |
418 setupMenuItemIconData.selfExplanatory = FALSE; | |
419 | |
420 /* Get the height of Title & Line. This will be used to calculate the icon co-ordinates. */ | |
421 fontHeight = dspl_GetFontHeight(); | |
422 titleHeight = res_getTitleHeight(); | |
423 | |
424 /* Set the initial menu height to the title height*/ | |
425 menuHeight = titleHeight + ((fontHeight - 2) / 2) - (setupMenuItemIconData.height / 2); | |
426 | |
427 /* Free the memory of icon data that we got through the SATK command*/ | |
428 mfwFree((U8 *)data->sat_command->c.menu.items[1].iconInfo.dst, icon_length); | |
429 data->sat_command->c.menu.items[1].iconInfo.dst = NULL; | |
430 } | |
431 else | |
432 { | |
433 setupMenuItemIconData.width = 0; | |
434 setupMenuItemIconData.height = 0; | |
435 setupMenuItemIconData.dst = NULL; | |
436 setupMenuItemIconData.selfExplanatory = FALSE; | |
437 } | |
438 #endif | |
439 | |
440 for (i=0; i < data->list_menu_data.ListLength; i++) /* Fill Menu List */ | |
441 { | |
442 mnuInitDataItem(&data->list_menu_data.List[i]); | |
443 | |
444 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
445 #ifdef FF_MMI_SAT_ICON | |
446 if(data->sat_command->c.menu.itemIconQual != 0xFF) | |
447 { | |
448 /* Populate the Icon attributes. | |
449 We assume that we have the same icon for all elements in the item list. */ | |
450 data->list_menu_data.List[i].icon = (MfwIcnAttr *)ALLOC_MEMORY (sizeof (MfwIcnAttr)); | |
451 | |
452 data->list_menu_data.List[i].icon->icons = setupMenuItemIconData.dst; | |
453 data->list_menu_data.List[i].icon->nIcons = 1; | |
454 data->list_menu_data.List[i].icon->icnType = BMP_FORMAT_256_COLOUR; | |
455 data->list_menu_data.List[i].icon->area.px = 1; | |
456 data->list_menu_data.List[i].icon->area.py = menuHeight + 1; | |
457 data->list_menu_data.List[i].icon->area.sx = setupMenuItemIconData.width; | |
458 data->list_menu_data.List[i].icon->area.sy = setupMenuItemIconData.height; | |
459 data->list_menu_data.List[i].icon->selfExplanatory = setupMenuItemIconData.selfExplanatory; | |
460 | |
461 menuHeight += fontHeight; | |
462 } | |
463 | |
464 /* get the correct entry in list of setup_menuList */ | |
465 data->list_menu_data.List[i].str = sat_create_ITEM_ASCIIZ (&menu->items[i]); | |
466 if (data->list_menu_data.List[i].str[0] == 0x80)/*MC, SPR 940/2 check for unicode tag*/ | |
467 Unicode_menu = TRUE; | |
468 #else | |
469 /* get the correct entry in list of setup_menuList */ | |
470 data->list_menu_data.List[i].str = sat_create_ITEM_ASCIIZ (&menu->items[i]); | |
471 if (data->list_menu_data.List[i].str[0] == 0x80)/*MC, SPR 940/2 check for unicode tag*/ | |
472 Unicode_menu = TRUE; | |
473 #endif | |
474 data->list_menu_data.List[i].flagFunc = (FlagFunc)item_flag_none; | |
475 } | |
476 } | |
477 data->list_menu_data.autoDestroy = TRUE; | |
478 | |
479 TRACE_EVENT_P1("menu->header.len %d", menu->header.len); | |
480 | |
481 /* SPR#2492 - DS - Setup menu header */ | |
482 if (menu->header.len > 0 && menu->header.len != 0xFF) | |
483 { | |
484 if (menuHdr) /* Free previously allocated header */ | |
485 { | |
486 TRACE_EVENT_P2("Destroy menuHdr %d with size %d", menuHdr, *(menuHdr -(U16)sizeof(U16)) ); | |
487 | |
488 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
489 #ifdef FF_MMI_SAT_ICON | |
490 /* Free the memory allocated for Header icon data. */ | |
491 if(setupMenuHeaderIconData.dst != NULL) | |
492 { | |
493 FREE_MEMORY((U8 *)setupMenuHeaderIconData.dst, setupMenuHeaderIconData.width * | |
494 setupMenuHeaderIconData.height); | |
495 setupMenuHeaderIconData.dst = NULL; | |
496 } | |
497 #endif | |
498 sat_destroy_TEXT_ASCIIZ(menuHdr); | |
499 menuHdr = NULL; /* dsm 01/12/03 - Added to explicitly set menuHdr to NULL */ | |
500 } | |
501 | |
502 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
503 #ifdef FF_MMI_SAT_ICON | |
504 if(data->sat_command->c.menu.header.icon.qual != 0xFF) | |
505 { | |
506 /* We have icon to be displayed*/ | |
507 /* Copy the icon data to the editor attributes*/ | |
508 setupMenuHeaderIconData.width = data->sat_command->c.menu.header.iconInfo.width; | |
509 setupMenuHeaderIconData.height = data->sat_command->c.menu.header.iconInfo.height; | |
510 | |
511 icon_length = data->sat_command->c.menu.header.iconInfo.width * data->sat_command->c.menu.header.iconInfo.height; | |
512 | |
513 setupMenuHeaderIconData.dst = (char *)ALLOC_MEMORY (icon_length); | |
514 | |
515 memcpy(setupMenuHeaderIconData.dst, data->sat_command->c.menu.header.iconInfo.dst, icon_length); | |
516 | |
517 /* Icon is self-explanatory. No need to display text for this case.*/ | |
518 if(data->sat_command->c.menu.header.icon.qual == 0x00) | |
519 { | |
520 /* Icon is self-explanatory. Do not display the text*/ | |
521 setupMenuHeaderIconData.selfExplanatory = TRUE; | |
522 } | |
523 else | |
524 setupMenuHeaderIconData.selfExplanatory = FALSE; | |
525 | |
526 /* Free the memory of icon data that we got through the SATK command*/ | |
527 mfwFree((U8 *)data->sat_command->c.menu.header.iconInfo.dst, icon_length); | |
528 data->sat_command->c.menu.header.iconInfo.dst = NULL; | |
529 } | |
530 else | |
531 { | |
532 setupMenuHeaderIconData.width = 0; | |
533 setupMenuHeaderIconData.height = 0; | |
534 setupMenuHeaderIconData.dst = NULL; | |
535 setupMenuHeaderIconData.selfExplanatory = FALSE; | |
536 } | |
537 #endif | |
538 | |
539 menuHdr = sat_create_TEXT_ASCIIZ(&menu->header); | |
540 TRACE_EVENT_P1("SAT menu header: %s", menuHdr); | |
541 | |
542 /* SPR#2492 - DS - Display menu header if one exists */ | |
543 if (menuHdr) | |
544 { | |
545 data->list_menu_data.Attr->hdrId = (int)menuHdr; | |
546 | |
547 TRACE_EVENT_P1("mode map before: %04x", data->list_menu_data.Attr->mode); | |
548 | |
549 /* SPR#2492 - DS - Use strings rather than text Ids */ | |
550 data->list_menu_data.Attr->mode |= MNU_HDRFORMAT_STR; | |
551 | |
552 TRACE_EVENT_P1("mode map after: %04x", data->list_menu_data.Attr->mode); | |
553 | |
554 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
555 #ifdef FF_MMI_SAT_ICON | |
556 /* We allow the Header text to be created. We send the icon data with self-explanatory status.*/ | |
557 if(setupMenuHeaderIconData.dst != NULL) | |
558 { | |
559 data->list_menu_data.Attr->icon = (MfwIcnAttr *)ALLOC_MEMORY (sizeof (MfwIcnAttr)); | |
560 | |
561 data->list_menu_data.Attr->icon->icons = setupMenuHeaderIconData.dst; | |
562 data->list_menu_data.Attr->icon->nIcons = 1; | |
563 data->list_menu_data.Attr->icon->icnType = BMP_FORMAT_256_COLOUR; | |
564 data->list_menu_data.Attr->icon->area.px = 1; | |
565 data->list_menu_data.Attr->icon->area.py = 1; | |
566 data->list_menu_data.Attr->icon->area.sx = setupMenuHeaderIconData.width; | |
567 data->list_menu_data.Attr->icon->area.sy = setupMenuHeaderIconData.height; | |
568 data->list_menu_data.Attr->icon->selfExplanatory = setupMenuHeaderIconData.selfExplanatory; | |
569 } | |
570 #endif | |
571 } | |
572 } | |
573 | |
574 retVal = listDisplayListMenu(data->win, &data->list_menu_data, (ListCbFunc)sat_setup_menu_listmnu_cb,Unicode_menu/*MC*/); | |
575 // xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
576 // Displaying '?' to indicate to the user that help is available for a menu | |
577 if(data->sat_command->qual & SAT_M_SELECT_HELP_AVAIL) | |
578 { | |
579 displayHelpSymbol(); | |
580 } | |
581 if (retVal != LISTS_FAIL) | |
582 sat_set_setup_menu_listmnu_win(data->list_menu_data.win); | |
583 else | |
584 sat_set_setup_menu_listmnu_win(NULL); | |
585 | |
586 return retVal; | |
587 } | |
588 | |
589 static void sat_setup_menu_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command) | |
590 /* callback handler for events sent from parents or childs to to trigger some execution */ | |
591 { | |
592 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
593 T_sat_setup_menu * data = (T_sat_setup_menu *)win_data->user; | |
594 T_SAT_RES sat_res; | |
595 | |
596 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
597 #ifdef FF_MMI_SAT_ICON | |
598 USHORT icon_length; | |
599 #endif | |
600 | |
601 TRACE_FUNCTION ("sat_setup_menu_exec()"); | |
602 | |
603 switch (event) | |
604 { | |
605 case SAT_SETUP_MENU: | |
606 | |
607 TRACE_EVENT("sat_setup_menu_exec() SAT_SETUP_MENU"); | |
608 | |
609 /* initialization of administrative data */ | |
610 | |
611 data->sat_command = sat_command; /* save a pointer to the parameter for later use in callbacks */ | |
612 | |
613 /* initialization of the dialog data */ | |
614 | |
615 data->list_menu_data.ListPosition = 1;/* True cursor position in list menu. */ | |
616 data->list_menu_data.Font = 0; | |
617 data->list_menu_data.LeftSoftKey = TxtSoftSelect; | |
618 data->list_menu_data.RightSoftKey = TxtSoftBack; | |
619 // xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
620 //Adding the support for MenuSelect in this list view | |
621 data->list_menu_data.KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUSELECT| KEY_MNULEFT| KEY_MNUUP | KEY_MNUDOWN |KEY_HUP; | |
622 data->list_menu_data.Reason = 0; | |
623 data->list_menu_data.Strings = TRUE; | |
624 data->list_menu_data.Attr = &sat_setup_menuAttrib; | |
625 data->list_menu_data.List = NULL; /* c030 rsa mark as first time creation */ | |
626 data->list_menu_data.autoDestroy = TRUE; | |
627 | |
628 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
629 #ifdef FF_MMI_SAT_ICON | |
630 /*Initialize the data members of Icon attributes */ | |
631 setupMenuItemIconData.width = 0; | |
632 setupMenuItemIconData.height = 0; | |
633 setupMenuItemIconData.dst = NULL; | |
634 setupMenuItemIconData.selfExplanatory = FALSE; | |
635 setupMenuHeaderIconData.width = 0; | |
636 setupMenuHeaderIconData.height = 0; | |
637 setupMenuHeaderIconData.dst = NULL; | |
638 setupMenuHeaderIconData.selfExplanatory = FALSE; | |
639 #endif | |
640 | |
641 // c030 rsa | |
642 /* NOBREAK */ | |
643 case SAT_RETURN: | |
644 | |
645 if (event == SAT_RETURN) | |
646 TRACE_EVENT("sat_setup_menu_exec() SAT_RETURN"); | |
647 | |
648 // end c030 rsa | |
649 if (sat_get_setup_menu_listmnu_win() == NULL) | |
650 { | |
651 /* (re)create the dialog handler */ | |
652 if (sat_setup_menu_recreate(data) == LISTS_FAIL) | |
653 { | |
654 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE; | |
655 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
656 sat_done (sat_command, sat_res); | |
657 sat_setup_menu_destroy (data->win); | |
658 } | |
659 } | |
660 break; | |
661 | |
662 /* sbh - all window types are being provided with this event to destroy the window */ | |
663 case SAT_DESTROY_WINDOW: | |
664 /* ...sbh */ | |
665 | |
666 case SAT_EXIT: | |
667 sat_setup_menu_destroy (data->win); | |
668 break; | |
669 | |
670 default: | |
671 TRACE_EVENT ("sat_setup_menu_exec() unexpected event"); | |
672 break; | |
673 } | |
674 } | |
675 | |
676 static void sat_setup_menu_listmnu_cb (T_MFW_HND win, ListMenuData_t * ListData) | |
677 /* sat_setup_menu menu event handler */ | |
678 { | |
679 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
680 T_sat_setup_menu * data = (T_sat_setup_menu *)win_data->user; | |
681 SatItem * item; | |
682 int index; | |
683 // T_SAT_RES sat_res; // RAVI | |
684 | |
685 TRACE_FUNCTION ("sat_setup_menu_listmnu_cb()"); | |
686 | |
687 if ((win EQ NULL) || (win_data EQ NULL) || (data EQ NULL)) | |
688 return; | |
689 | |
690 switch (ListData->Reason) | |
691 { | |
692 case E_MNU_SELECT: | |
693 case LISTS_REASON_SELECT: | |
694 | |
695 index = ListData->ListPosition; /* index of selected item */ | |
696 item = &data->sat_command->c.menu.items[index]; /* selected item */ | |
697 // xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
698 // Using the MenuSelect Key for requesting the help info in STK menu. | |
699 if(ListData->selectKey && ((data->sat_command->qual & SAT_M_SELECT_HELP_AVAIL) != 0)) | |
700 { | |
701 satMenuItem(item->id, 1); | |
702 ListData->selectKey = FALSE; | |
703 } | |
704 else | |
705 satMenuItem(item->id, 0); /* issue the answering envelope */ | |
706 | |
707 /* | |
708 ** The SAT Menu is automatically destroyed when an item is selected | |
709 */ | |
710 sat_set_setup_menu_listmnu_win(NULL); | |
711 | |
712 /* sat_setup_menu_destroy(data->win); c030 rsa do not destroy in order to keep the menu on top */ | |
713 break; | |
714 case LISTS_REASON_TIMEOUT: // c015 rsa | |
715 case LISTS_REASON_BACK: /* back to previous menu */ | |
716 case LISTS_REASON_HANGUP: // sbh - added so hangup key exits | |
717 case LISTS_REASON_CLEAR: | |
718 | |
719 /* | |
720 * we don't need to signal <SAT_RES_USER_BACK> here, since the session itself | |
721 * has been finished immediately after sat_setup_menu_proc(). | |
722 * Furthermore the entering of the menu has not been signalled to the SIM... | |
723 */ | |
724 | |
725 /* | |
726 ** The SAT Menu is automatically destroyed and recreated when we move. | |
727 */ | |
728 sat_set_setup_menu_listmnu_win(NULL); | |
729 | |
730 sat_setup_menu_destroy(data->win); | |
731 break; | |
732 default: | |
733 return; | |
734 } | |
735 return; | |
736 } | |
737 | |
738 /********************************************************************* | |
739 ********************************************************************** | |
740 | |
741 select_item DYNAMIC MENU WINDOW. DECLARATION | |
742 | |
743 ********************************************************************* | |
744 **********************************************************************/ | |
745 typedef struct | |
746 { | |
747 /* administrative data */ | |
748 | |
749 T_MMI_CONTROL mmi_control; | |
750 T_MFW_HND win; | |
751 | |
752 /* associated handlers */ | |
753 | |
754 T_MFW_HND kbd; /* sbh - keyboard handler, so window can be destroyed by user */ | |
755 | |
756 /* internal data */ | |
757 T_SAT_CMD *sat_command; /* pointer to sat_command in parent */ | |
758 ListMenuData_t list_menu_data; | |
759 T_MFW_HND sat_timer; // May 24, 2005 REF: CRR 29358 x0021334 | |
760 ULONG sat_timeout; // May 24, 2005 REF: CRR 29358 x0021334 | |
761 } T_sat_select_item; | |
762 | |
763 static void sat_select_item_destroy (T_MFW_HND window); | |
764 static void sat_select_item_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command); | |
765 static void sat_select_item_listmnu_cb (T_MFW_HND win, ListMenuData_t * ListData); | |
766 static T_MFW sat_select_item_recreate(T_sat_select_item *data); | |
767 | |
768 /********************************************************************* | |
769 ********************************************************************** | |
770 | |
771 select_item DYNAMIC MENU WINDOW. IMPLEMENTATION | |
772 | |
773 ********************************************************************* | |
774 **********************************************************************/ | |
775 | |
776 T_MFW_HND sat_select_item_create(MfwHnd parent_window) | |
777 { | |
778 T_sat_select_item * data = (T_sat_select_item *)ALLOC_MEMORY (sizeof (T_sat_select_item)); | |
779 T_MFW_WIN * win; | |
780 | |
781 TRACE_FUNCTION ("sat_select_item_create()"); | |
782 | |
783 /* | |
784 * Create window handler | |
785 */ | |
786 | |
787 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)sat_win_cb); | |
788 if (data->win EQ NULL) | |
789 { | |
790 return NULL; | |
791 } | |
792 | |
793 /* | |
794 * connect the dialog data to the MFW-window | |
795 */ | |
796 | |
797 data->mmi_control.dialog = (T_DIALOG_FUNC)sat_select_item_exec; | |
798 data->mmi_control.data = data; | |
799 win = ((T_MFW_HDR *)data->win)->data; | |
800 win->user = (MfwUserDataPtr)data; | |
801 | |
802 data->kbd = kbdCreate( data->win, KEY_ALL, (T_MFW_CB) sat_kbd_cb); /* sbh - add keyboard handler */ | |
803 | |
804 /* | |
805 * return window handle | |
806 */ | |
807 | |
808 | |
809 win_show(data->win); | |
810 return data->win; | |
811 } | |
812 | |
813 static void sat_select_item_destroy(MfwHnd own_window) | |
814 { | |
815 T_MFW_WIN * win_data; | |
816 T_sat_select_item * data; | |
817 int i; | |
818 | |
819 TRACE_FUNCTION ("sat_select_item_destroy()"); | |
820 | |
821 if (own_window) | |
822 { | |
823 win_data = ((T_MFW_HDR *)own_window)->data; | |
824 data = (T_sat_select_item *)win_data->user; | |
825 | |
826 if (data) | |
827 { | |
828 /* | |
829 * Delete WIN handler | |
830 */ | |
831 win_delete (data->win); | |
832 | |
833 /* | |
834 * Free Memory | |
835 */ | |
836 | |
837 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
838 #ifdef FF_MMI_SAT_ICON | |
839 /* Free the memory allocated for Item icon data. */ | |
840 if(selectItemIconData.dst != NULL) | |
841 { | |
842 FREE_MEMORY((U8 *)selectItemIconData.dst, selectItemIconData.width * | |
843 selectItemIconData.height); | |
844 selectItemIconData.dst = NULL; | |
845 } | |
846 | |
847 /* Free the memory allocated for Header icon data. */ | |
848 if(selectItemHeaderIconData.dst != NULL) | |
849 { | |
850 FREE_MEMORY((U8 *)selectItemHeaderIconData.dst, selectItemHeaderIconData.width * | |
851 selectItemHeaderIconData.height); | |
852 selectItemHeaderIconData.dst = NULL; | |
853 } | |
854 #endif | |
855 | |
856 for (i=0; i < data->list_menu_data.ListLength; i++) | |
857 { | |
858 sat_destroy_ITEM_ASCIIZ (data->list_menu_data.List[i].str); | |
859 | |
860 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
861 #ifdef FF_MMI_SAT_ICON | |
862 if(data->list_menu_data.List[i].icon != NULL) | |
863 { | |
864 FREE_MEMORY((U8 *)data->list_menu_data.List[i].icon, sizeof (MfwIcnAttr)); | |
865 data->list_menu_data.List[i].icon = NULL; | |
866 } | |
867 #endif | |
868 } | |
869 FREE_MEMORY ((U8 *)data->list_menu_data.List, | |
870 (data->list_menu_data.ListLength * sizeof (MfwMnuItem))); | |
871 data->list_menu_data.List = NULL; | |
872 FREE_MEMORY ((U8 *)data, sizeof (T_sat_select_item)); | |
873 | |
874 /* SPR#2492 - DS - Free SAT menu header if it exists */ | |
875 if (menuHdr) | |
876 { | |
877 TRACE_EVENT_P2("Destroy menuHdr %d with size %d", menuHdr, *(menuHdr -(U16)sizeof(U16)) ); | |
878 sat_destroy_TEXT_ASCIIZ(menuHdr); | |
879 menuHdr = NULL; /* dsm 01/12/03 - Added to explicitly set menuHdr to NULL */ | |
880 | |
881 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
882 #ifdef FF_MMI_SAT_ICON | |
883 if(data->list_menu_data.Attr->icon != NULL) | |
884 { | |
885 FREE_MEMORY((U8 *)data->list_menu_data.Attr->icon, sizeof (MfwIcnAttr)); | |
886 data->list_menu_data.Attr->icon = NULL; | |
887 } | |
888 #endif | |
889 } | |
890 } | |
891 else | |
892 { | |
893 TRACE_EVENT ("sat_select_item_destroy() called twice"); | |
894 } | |
895 } | |
896 } | |
897 | |
898 static T_MFW sat_select_item_recreate(T_sat_select_item *data) | |
899 { | |
900 int i; | |
901 int Unicode_menu = FALSE; /*MC, SPR 940/2 flag to lay-out as Unicode*/ | |
902 //May 24, 2005 REF: CRR 29358 x0021334 | |
903 // Added this variable to store return value from listDisplayListMenu | |
904 T_MFW sat_select_item_status; | |
905 | |
906 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
907 #ifdef FF_MMI_SAT_ICON | |
908 USHORT icon_length; | |
909 USHORT fontHeight, menuHeight = 0, titleHeight; | |
910 #endif | |
911 | |
912 SatMenu * menu = &data->sat_command->c.menu; | |
913 TRACE_FUNCTION ("sat_select_item_recreate()"); | |
914 | |
915 #ifdef __COMPLETE_LIST_SUPPORT__ /* ??? rsa for future extension */ | |
916 if ((&data->sat_command.qual & SAT_M_SELECT_HELP_AVAIL) NEQ 0) | |
917 { | |
918 data->list_menu_data.AlternateLeftSoftKey = TxtHelp; /* help available */ | |
919 } | |
920 else | |
921 { | |
922 data->list_menu_data.AlternateLeftSoftKey = TxtNull; /* no help available */ | |
923 } | |
924 #endif | |
925 | |
926 /* allocate sufficient memory to hold the list of menu items */ | |
927 data->list_menu_data.ListLength = menu->nItems; /* actual number of entries in list menu. */ | |
928 data->list_menu_data.List = (MfwMnuItem *)ALLOC_MEMORY (data->list_menu_data.ListLength * sizeof (MfwMnuItem)); | |
929 memset(data->list_menu_data.List, 0x00, data->list_menu_data.ListLength * sizeof (MfwMnuItem)); | |
930 | |
931 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
932 #ifdef FF_MMI_SAT_ICON | |
933 if(menu->itemIconQual != 0xFF) | |
934 { | |
935 /* We have icon to be displayed*/ | |
936 /* Copy the icon data to the editor attributes*/ | |
937 selectItemIconData.width = menu->items[1].iconInfo.width; | |
938 selectItemIconData.height = menu->items[1].iconInfo.height; | |
939 | |
940 icon_length = menu->items[1].iconInfo.width * menu->items[1].iconInfo.height; | |
941 | |
942 selectItemIconData.dst = (char *)ALLOC_MEMORY (icon_length); | |
943 | |
944 memcpy(selectItemIconData.dst, menu->items[1].iconInfo.dst, icon_length); | |
945 | |
946 /* Icon is self-explanatory. No need to display text for this case.*/ | |
947 if(menu->itemIconQual == 0x00) | |
948 { | |
949 /* Icon is self-explanatory. Do not display the text*/ | |
950 selectItemIconData.selfExplanatory = TRUE; | |
951 } | |
952 else | |
953 selectItemIconData.selfExplanatory = FALSE; | |
954 | |
955 /* Get the height of Title & Line. This will be used to calculate the icon co-ordinates. */ | |
956 fontHeight = dspl_GetFontHeight(); | |
957 titleHeight = res_getTitleHeight(); | |
958 | |
959 /* Set the initial menu height to the title height*/ | |
960 menuHeight = titleHeight + ((fontHeight - 2) / 2) - (selectItemIconData.height / 2); | |
961 | |
962 /* Free the memory of icon data that we got through the SATK command*/ | |
963 mfwFree((U8 *)menu->items[1].iconInfo.dst, icon_length); | |
964 menu->items[1].iconInfo.dst = NULL; | |
965 } | |
966 else | |
967 { | |
968 selectItemIconData.width = 0; | |
969 selectItemIconData.height = 0; | |
970 selectItemIconData.dst = NULL; | |
971 selectItemIconData.selfExplanatory = FALSE; | |
972 } | |
973 #endif | |
974 | |
975 for (i=0; i < data->list_menu_data.ListLength; i++) /* Fill Menu List */ | |
976 { | |
977 mnuInitDataItem(&data->list_menu_data.List[i]); | |
978 | |
979 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
980 #ifdef FF_MMI_SAT_ICON | |
981 if(data->sat_command->c.menu.itemIconQual != 0xFF) | |
982 { | |
983 /* Populate the Icon attributes. | |
984 We assume that we have the same icon for all elements in the item list. */ | |
985 data->list_menu_data.List[i].icon = (MfwIcnAttr *)ALLOC_MEMORY (sizeof (MfwIcnAttr)); | |
986 | |
987 data->list_menu_data.List[i].icon->icons = selectItemIconData.dst; | |
988 data->list_menu_data.List[i].icon->nIcons = 1; | |
989 data->list_menu_data.List[i].icon->icnType = BMP_FORMAT_256_COLOUR; | |
990 data->list_menu_data.List[i].icon->area.px = 1; | |
991 data->list_menu_data.List[i].icon->area.py = menuHeight + 1; | |
992 data->list_menu_data.List[i].icon->area.sx = selectItemIconData.width; | |
993 data->list_menu_data.List[i].icon->area.sy = selectItemIconData.height; | |
994 data->list_menu_data.List[i].icon->selfExplanatory = selectItemIconData.selfExplanatory; | |
995 | |
996 menuHeight += fontHeight; | |
997 } | |
998 /* get the correct entry in list of select_itemList */ | |
999 data->list_menu_data.List[i].str = sat_create_ITEM_ASCIIZ (&menu->items[i]); | |
1000 if (data->list_menu_data.List[i].str[0] == 0x80)/*MC, SPR 940/2 check for unicode tag*/ | |
1001 Unicode_menu = TRUE; | |
1002 #else | |
1003 /* get the correct entry in list of select_itemList */ | |
1004 data->list_menu_data.List[i].str = sat_create_ITEM_ASCIIZ (&menu->items[i]); | |
1005 if (data->list_menu_data.List[i].str[0] == 0x80)/*MC, SPR 940/2 check for unicode tag*/ | |
1006 Unicode_menu = TRUE; | |
1007 #endif | |
1008 | |
1009 data->list_menu_data.List[i].flagFunc = (FlagFunc)item_flag_none; | |
1010 | |
1011 } | |
1012 | |
1013 data->list_menu_data.autoDestroy = TRUE; | |
1014 | |
1015 TRACE_EVENT_P1("menu->header.len %d", menu->header.len); | |
1016 | |
1017 /* SPR#2492 - DS - Setup menu header */ | |
1018 if (menu->header.len > 0 && menu->header.len != 0xFF) | |
1019 { | |
1020 if (menuHdr) /* Free previously allocated header */ | |
1021 { | |
1022 TRACE_EVENT_P2("Destroy menuHdr %d with size %d", menuHdr, *(menuHdr -(U16)sizeof(U16)) ); | |
1023 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
1024 #ifdef FF_MMI_SAT_ICON | |
1025 /* Free the memory allocated for Header icon data. */ | |
1026 if(selectItemHeaderIconData.dst != NULL) | |
1027 { | |
1028 FREE_MEMORY((U8 *)selectItemHeaderIconData.dst, selectItemHeaderIconData.width * | |
1029 selectItemHeaderIconData.height); | |
1030 selectItemHeaderIconData.dst = NULL; | |
1031 } | |
1032 #endif | |
1033 sat_destroy_TEXT_ASCIIZ(menuHdr); | |
1034 menuHdr = NULL; /* dsm 01/12/03 - Added to explicitly set menuHdr to NULL */ | |
1035 } | |
1036 | |
1037 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
1038 #ifdef FF_MMI_SAT_ICON | |
1039 if(data->sat_command->c.menu.header.icon.qual != 0xFF) | |
1040 { | |
1041 /* We have icon to be displayed*/ | |
1042 /* Copy the icon data to the editor attributes*/ | |
1043 selectItemHeaderIconData.width = data->sat_command->c.menu.header.iconInfo.width; | |
1044 selectItemHeaderIconData.height = data->sat_command->c.menu.header.iconInfo.height; | |
1045 | |
1046 icon_length = data->sat_command->c.menu.header.iconInfo.width * data->sat_command->c.menu.header.iconInfo.height; | |
1047 | |
1048 selectItemHeaderIconData.dst = (char *)ALLOC_MEMORY (icon_length); | |
1049 | |
1050 memcpy(selectItemHeaderIconData.dst, data->sat_command->c.menu.header.iconInfo.dst, icon_length); | |
1051 | |
1052 /* Icon is self-explanatory. No need to display text for this case.*/ | |
1053 if(data->sat_command->c.menu.header.icon.qual == 0x00) | |
1054 { | |
1055 /* Icon is self-explanatory. Do not display the text*/ | |
1056 selectItemHeaderIconData.selfExplanatory = TRUE; | |
1057 } | |
1058 else | |
1059 selectItemHeaderIconData.selfExplanatory = FALSE; | |
1060 | |
1061 /* Free the memory of icon data that we got through the SATK command*/ | |
1062 mfwFree((U8 *)data->sat_command->c.menu.header.iconInfo.dst, icon_length); | |
1063 data->sat_command->c.menu.header.iconInfo.dst = NULL; | |
1064 } | |
1065 else | |
1066 { | |
1067 selectItemHeaderIconData.width = 0; | |
1068 selectItemHeaderIconData.height = 0; | |
1069 selectItemHeaderIconData.dst = NULL; | |
1070 selectItemHeaderIconData.selfExplanatory = FALSE; | |
1071 } | |
1072 #endif | |
1073 | |
1074 | |
1075 menuHdr = sat_create_TEXT_ASCIIZ(&menu->header); | |
1076 TRACE_EVENT_P1("SAT menu header: %s", menuHdr); | |
1077 | |
1078 /* SPR#2492 - DS - Display menu header if one exists */ | |
1079 if (menuHdr) | |
1080 { | |
1081 data->list_menu_data.Attr->hdrId = (int)menuHdr; | |
1082 | |
1083 TRACE_EVENT_P1("mode map before: %04x", data->list_menu_data.Attr->mode); | |
1084 | |
1085 /* SPR#2492 - DS - Use strings rather than text Ids */ | |
1086 data->list_menu_data.Attr->mode |= MNU_HDRFORMAT_STR; | |
1087 | |
1088 TRACE_EVENT_P1("mode map after: %04x", data->list_menu_data.Attr->mode); | |
1089 | |
1090 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
1091 #ifdef FF_MMI_SAT_ICON | |
1092 /* We allow the Header text to be created. We send the icon data with self-explanatory status.*/ | |
1093 if(selectItemHeaderIconData.dst != NULL) | |
1094 { | |
1095 data->list_menu_data.Attr->icon = (MfwIcnAttr *)ALLOC_MEMORY (sizeof (MfwIcnAttr)); | |
1096 | |
1097 data->list_menu_data.Attr->icon->icons = selectItemHeaderIconData.dst; | |
1098 data->list_menu_data.Attr->icon->nIcons = 1; | |
1099 data->list_menu_data.Attr->icon->icnType = BMP_FORMAT_256_COLOUR; | |
1100 data->list_menu_data.Attr->icon->area.px = 1; | |
1101 data->list_menu_data.Attr->icon->area.py = 1; | |
1102 data->list_menu_data.Attr->icon->area.sx = selectItemHeaderIconData.width; | |
1103 data->list_menu_data.Attr->icon->area.sy = selectItemHeaderIconData.height; | |
1104 data->list_menu_data.Attr->icon->selfExplanatory = selectItemHeaderIconData.selfExplanatory; | |
1105 } | |
1106 #endif | |
1107 } | |
1108 } | |
1109 | |
1110 // May 24, 2005 REF: CRR 29358 x0021334 | |
1111 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response | |
1112 // Now the list will be displayed, so start the timer. | |
1113 sat_select_item_status = listDisplayListMenu(data->win, &data->list_menu_data, (ListCbFunc)sat_select_item_listmnu_cb,Unicode_menu/*MC*/); | |
1114 // xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
1115 // Displaying '?' to indicate to the user that help is available for a menu | |
1116 if(data->sat_command->qual & SAT_M_SELECT_HELP_AVAIL) | |
1117 { | |
1118 displayHelpSymbol(); | |
1119 } | |
1120 tim_start(data->sat_timer); | |
1121 return sat_select_item_status; | |
1122 } | |
1123 | |
1124 static void sat_select_item_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command) | |
1125 /* callback handler for events sent from parents or childs to to trigger some execution */ | |
1126 { | |
1127 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1128 T_sat_select_item * data = (T_sat_select_item *)win_data->user; | |
1129 T_SAT_RES sat_res; | |
1130 | |
1131 TRACE_FUNCTION ("sat_select_item_exec()"); | |
1132 | |
1133 switch (event) | |
1134 { | |
1135 case SAT_SELECT_ITEM: | |
1136 /* initialization of administrative data */ | |
1137 | |
1138 data->sat_command = sat_command; /* save a pointer to the parameter for later use in callbacks */ | |
1139 | |
1140 /* initialization of the dialog data */ | |
1141 data->list_menu_data.ListPosition = 1;/* True cursor position in list menu. */ | |
1142 data->list_menu_data.Font = 0; | |
1143 data->list_menu_data.LeftSoftKey = TxtSoftSelect; | |
1144 data->list_menu_data.RightSoftKey = TxtSoftBack; | |
1145 // xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
1146 //Adding the support for MenuSelect in this list view | |
1147 data->list_menu_data.KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUSELECT| KEY_MNULEFT| KEY_MNUUP | KEY_MNUDOWN|KEY_HUP; | |
1148 data->list_menu_data.Reason = 0; | |
1149 data->list_menu_data.Strings = TRUE; | |
1150 data->list_menu_data.Attr = &sat_select_menuAttrib; | |
1151 data->list_menu_data.autoDestroy = TRUE; | |
1152 | |
1153 // May 24, 2005 REF: CRR 29358 x0021334 | |
1154 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response | |
1155 // Fix: Set Timeout period to 20 seconds and create the timer. | |
1156 data->sat_timeout = TWENTY_SECS; | |
1157 data->sat_timer = tim_create(data->win, data->sat_timeout, (T_MFW_CB)sat_select_TimerCb); | |
1158 g_sat_scroll_status = TRUE; | |
1159 | |
1160 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462 | |
1161 #ifdef FF_MMI_SAT_ICON | |
1162 /*Initialize the data members of Icon attributes */ | |
1163 selectItemIconData.width = 0; | |
1164 selectItemIconData.height = 0; | |
1165 selectItemIconData.dst = NULL; | |
1166 selectItemIconData.selfExplanatory = FALSE; | |
1167 selectItemHeaderIconData.width = 0; | |
1168 selectItemHeaderIconData.height = 0; | |
1169 selectItemHeaderIconData.dst = NULL; | |
1170 selectItemHeaderIconData.selfExplanatory = FALSE; | |
1171 #endif | |
1172 | |
1173 /* (re)create the dialog handler */ | |
1174 if (sat_select_item_recreate(data) == LISTS_FAIL) | |
1175 { | |
1176 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE; | |
1177 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1178 sat_done (sat_command, sat_res); | |
1179 // May 24, 2005 REF: CRR 29358 x0021334 | |
1180 // Delete the timer and set g_sat_scroll_status to FALSE. | |
1181 tim_delete (data->sat_timer); | |
1182 g_sat_scroll_status = FALSE; | |
1183 sat_select_item_destroy (data->win); | |
1184 } | |
1185 break; | |
1186 | |
1187 /* sbh - all window types are being provided with this event to destroy the window */ | |
1188 case SAT_DESTROY_WINDOW: | |
1189 // May 24, 2005 REF: CRR 29358 x0021334 | |
1190 // Delete the timer and set g_sat_scroll_status to FALSE. | |
1191 tim_delete (data->sat_timer); | |
1192 g_sat_scroll_status = FALSE; | |
1193 sat_select_item_destroy (data->win); | |
1194 break; | |
1195 /* ...sbh */ | |
1196 | |
1197 // May 24, 2005 REF: CRR 29358 x0021334 | |
1198 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response | |
1199 // Fix: Timeout has occured. Used existing LISTS_REASON_TIMEOUT event for the same | |
1200 case LISTS_REASON_TIMEOUT: | |
1201 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_NO_RESP; // set no response from user | |
1202 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1203 sat_done (data->sat_command, sat_res); | |
1204 tim_stop(data->sat_timer); // stop the timer | |
1205 tim_delete(data->sat_timer); // delete the timer | |
1206 g_sat_scroll_status = FALSE; // set scrolling status to FALSE | |
1207 sat_select_item_destroy(data->win); | |
1208 break; | |
1209 | |
1210 // May 24, 2005 REF: CRR 29358 x0021334 | |
1211 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response | |
1212 // Fix: User has scrolled up/down. Used existing LISTS_REASON_SCROLL event for the same | |
1213 case LISTS_REASON_SCROLL: | |
1214 tim_stop(data->sat_timer); // stop the timer | |
1215 tim_start(data->sat_timer); // start the timer again for 20 seconds | |
1216 break; | |
1217 default: | |
1218 TRACE_EVENT ("sim_select_item_exec() unexpected event"); | |
1219 break; | |
1220 } | |
1221 } | |
1222 | |
1223 static void sat_select_item_listmnu_cb (T_MFW_HND win, ListMenuData_t * ListData) | |
1224 /* sat_select_item menu event handler */ | |
1225 { | |
1226 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
1227 T_sat_select_item * data = (T_sat_select_item *)win_data->user; | |
1228 SatItem * item; | |
1229 int index; | |
1230 T_SAT_RES sat_res; | |
1231 | |
1232 if ((win EQ NULL) || (win_data EQ NULL) || (data EQ NULL)) | |
1233 return; | |
1234 | |
1235 TRACE_FUNCTION ("sat_select_item_listmnu_cb()"); | |
1236 | |
1237 switch (ListData->Reason) | |
1238 { | |
1239 case E_MNU_SELECT: | |
1240 case LISTS_REASON_SELECT: | |
1241 index = ListData->ListPosition; /* index of selected item */ | |
1242 item = &data->sat_command->c.menu.items[index]; /* selected item */ | |
1243 /* CQ 16307 - Start */ | |
1244 if (data->sat_command->c.menu.itemIconQual == 0xFF) | |
1245 sat_res[SAT_ERR_INDEX] = SatResSuccess; | |
1246 else | |
1247 { | |
1248 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
1249 #ifdef FF_MMI_SAT_ICON | |
1250 sat_res[SAT_ERR_INDEX] = SatResSuccess; | |
1251 #else | |
1252 sat_res[SAT_ERR_INDEX] = SatResNoIcon; | |
1253 /* CQ 16307 - End */ | |
1254 #endif | |
1255 } | |
1256 | |
1257 | |
1258 // xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
1259 // Using the MenuSelect Key for requesting the help info in STK menu. | |
1260 if(ListData->selectKey && ((data->sat_command->qual & SAT_M_SELECT_HELP_AVAIL) != 0)) | |
1261 { | |
1262 sat_res[SAT_ERR_INDEX] = SatResUserHelp; | |
1263 ListData->selectKey = FALSE; | |
1264 } | |
1265 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1266 satItem (data->sat_command, item->id, sat_res, sizeof(T_SAT_RES)); /* issue the answering envelope */ | |
1267 | |
1268 | |
1269 // May 24, 2005 REF: CRR 29358 x0021334 | |
1270 // Stop and delete the timer. Also, set scrolling status to FALSE | |
1271 tim_stop(data->sat_timer); | |
1272 tim_delete(data->sat_timer); | |
1273 g_sat_scroll_status = FALSE; | |
1274 sat_select_item_destroy(data->win); | |
1275 break; | |
1276 // c015 rsa | |
1277 case LISTS_REASON_TIMEOUT: | |
1278 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_NO_RESP; | |
1279 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1280 sat_done (data->sat_command, sat_res); | |
1281 sat_select_item_destroy(data->win); | |
1282 break; | |
1283 // end c015 rsa | |
1284 case LISTS_REASON_CLEAR: /* abort */ | |
1285 case LISTS_REASON_HANGUP: /* abort */ | |
1286 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_ABORT; | |
1287 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1288 sat_done (data->sat_command, sat_res); | |
1289 sat_select_item_destroy(data->win); | |
1290 break; | |
1291 case LISTS_REASON_BACK: /* back to previous menu */ | |
1292 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_BACK; | |
1293 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1294 sat_done (data->sat_command, sat_res); | |
1295 | |
1296 // May 24, 2005 REF: CRR 29358 x0021334 | |
1297 // Stop and delete the timer. Also, set scrolling status to FALSE | |
1298 tim_stop(data->sat_timer); | |
1299 tim_delete(data->sat_timer); | |
1300 g_sat_scroll_status = FALSE; | |
1301 sat_select_item_destroy(data->win); | |
1302 break; | |
1303 default: | |
1304 return; | |
1305 } | |
1306 return; | |
1307 } | |
1308 // end c016 rsa | |
1309 | |
1310 // May 24, 2005 REF: CRR 29358 x0021334 | |
1311 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response | |
1312 // Fix: This is the call back function for sat timer | |
1313 static int sat_select_TimerCb (T_MFW_EVENT event, T_MFW_TIM *timer) | |
1314 { | |
1315 T_MFW_HND win = mfw_parent (mfw_header()); | |
1316 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
1317 T_sat_select_item *data = (T_sat_select_item *)win_data->user; | |
1318 | |
1319 TRACE_FUNCTION("sat_select_TimerCb()"); | |
1320 | |
1321 // Destroy the list before going back to the sat menu | |
1322 listsDestroy(data->list_menu_data.win); | |
1323 // Send timeout event. | |
1324 SEND_EVENT (data->win, LISTS_REASON_TIMEOUT, NULL, NULL); | |
1325 return MFW_EVENT_CONSUMED; | |
1326 } | |
1327 | |
1328 // May 24, 2005 REF: CRR 29358 x0021334 | |
1329 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response | |
1330 // Fix: This function returns the status of scrolling, which is used for restarting the timer | |
1331 BOOL getScrollStatus() | |
1332 { | |
1333 return g_sat_scroll_status; | |
1334 } |