FreeCalypso > hg > fc-magnetite
comparison src/ui3/bmi/MmiLists.c @ 420:e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 21 Jan 2018 03:09:00 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
419:59143cd42ec7 | 420:e8ddbb0837ed |
---|---|
1 /******************************************************************************* | |
2 | |
3 CONDAT (UK) | |
4 | |
5 ******************************************************************************** | |
6 | |
7 This software product is the property of Condat (UK) Ltd and may not be | |
8 disclosed to any third party without the express permission of the owner. | |
9 | |
10 ******************************************************************************** | |
11 | |
12 $Project name: Basic MMI | |
13 $Project code: BMI (6349) | |
14 $Module: MMI | |
15 $File: MmiLists.c | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: 22/02/01 | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: | |
24 | |
25 | |
26 | |
27 ******************************************************************************** | |
28 | |
29 $History: MmiLists.c | |
30 | |
31 July 10, 2007 REF: DRT OMAPS00135679 x0073106 | |
32 Description:MM: Board freezes while choosing settings menu in File management. | |
33 Solution: Hang-up key is mapped properly while going back from audio list window. | |
34 | |
35 Mar 30, 2007 REF: OMAPS00122691 x0039928 | |
36 Description: COMBO: No melody heard on parsing over different volums in tones menu | |
37 Solution: E_MELODY_START event is sent to play the melody. | |
38 | |
39 xrashmic 8 Sep 2006, OMAPS00091618 | |
40 Removed redundant code introduced during integration | |
41 | |
42 June 19, 2006 REF: DRT OMAPS00076378 x0012849 : Jagannatha | |
43 Description: MIDI files should play while browsing | |
44 Solution: Event will be generated upon press of Menu up and down key. | |
45 | |
46 June 05, 2006 REF:OMAPS00060424 x0045876 | |
47 Description: Header Toggling | |
48 Solution: Implemented the toggling of header when displaying the length text in SELECT ITEM and SET UP MENU | |
49 | |
50 May 18, 2006 REF: DRT OMAPS00076438 xdeepadh | |
51 Description: Scrolling not implemented in Imageviewer | |
52 Solution: The support for scrolling has been provided. | |
53 | |
54 May 03, 2006 REF: DRT OMAPS00076439 xdeepadh | |
55 Description: Image viewer back not working | |
56 Solution: The Preview List will be repopulated, when the list window is | |
57 resumed. | |
58 | |
59 May 03, 2006 REF: DRT OMAPS00076376 xdeepadh | |
60 Description: File Viewer-N5.12 issues (very unstable) | |
61 Solution: The keys are blocked until the view or preview is completed. | |
62 | |
63 Dec 22, 2005 REF: ENH xdeepadh | |
64 Description: Image Viewer Application | |
65 Solution: Implemeted the Image Viewer to view the jpeg images | |
66 | |
67 xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
68 Using the MenuSelect Key for requesting the help info in STK menu. Storing the info that | |
69 MenuSelectKey was pressed in a list view. | |
70 | |
71 May 24, 2005 REF: CRR 29358 x0021334 | |
72 Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response | |
73 Fix: The implementation is now based on timer. After the specified timeout period | |
74 the control comes back to SAT main menu, if there is no selection done by the user. | |
75 | |
76 25/10/00 Original Condat(UK) BMI version. | |
77 | |
78 $End | |
79 | |
80 *******************************************************************************/ | |
81 | |
82 #define ENTITY_MFW | |
83 | |
84 /* includes */ | |
85 #include <string.h> | |
86 #include <stdio.h> | |
87 #include <stdlib.h> | |
88 | |
89 #if defined (NEW_FRAME) | |
90 | |
91 #include "typedefs.h" | |
92 #include "vsi.h" | |
93 #include "pei.h" | |
94 #include "custom.h" | |
95 #include "gsm.h" | |
96 | |
97 #else | |
98 | |
99 #include "STDDEFS.H" | |
100 #include "custom.h" | |
101 #include "gsm.h" | |
102 #include "vsi.h" | |
103 | |
104 #endif | |
105 | |
106 #include "gdi.h" | |
107 #include "audio.h" | |
108 | |
109 #include "pconst.cdg" | |
110 #include "mconst.cdg" | |
111 #include "message.h" | |
112 #include "ccdapi.h" | |
113 #include "prim.h" | |
114 #include "cus_aci.h" | |
115 #include "cnf_aci.h" | |
116 #include "mon_aci.h" | |
117 | |
118 #include "tok.h" | |
119 | |
120 #include "prim.h" | |
121 #ifndef PCM_2_FFS | |
122 #include "pcm.h" | |
123 #endif | |
124 | |
125 | |
126 | |
127 | |
128 #include "mfw_sys.h" | |
129 | |
130 #include "mfw_mfw.h" | |
131 #include "mfw_win.h" | |
132 #include "mfw_kbd.h" | |
133 #include "mfw_lng.h" | |
134 /* SPR#1428 - SH - New Editor changes */ | |
135 #ifndef NEW_EDITOR | |
136 #include "mfw_edt.h" | |
137 #endif | |
138 #include "mfw_icn.h" | |
139 #include "mfw_mnu.h" | |
140 #include "mfw_tim.h" | |
141 | |
142 #include "mfw_sim.h" | |
143 #include "mfw_cm.h" | |
144 #include "mfw_nm.h" | |
145 #include "mfw_phb.h" | |
146 #include "mfw_mme.h" | |
147 #include "mfw_sat.h" | |
148 #include "mfw_sms.h" | |
149 | |
150 #include "dspl.h" | |
151 | |
152 #include "ksd.h" | |
153 #include "psa.h" | |
154 | |
155 #include "MmiMain.h" | |
156 #include "MmiBookController.h" | |
157 #include "MmiDummy.h" | |
158 #include "MmiDialogs.h" | |
159 #include "MmiLists.h" | |
160 | |
161 | |
162 | |
163 #include "MmiMenu.h" | |
164 #include "mmiCall.h" | |
165 #include "Mmiicons.h" | |
166 #include "MmiIdle.h" | |
167 | |
168 #include "MmiSoftKeys.h" | |
169 #include "MmiSounds.h" | |
170 #include "MmiIdle.h" | |
171 #include "MmiNetwork.h" | |
172 #include "mmiSat_i.h" | |
173 #include "MmiAoc.h" | |
174 | |
175 | |
176 #include "cus_aci.h" | |
177 #include "mfw_ffs.h" | |
178 #include "MmiTimers.h" | |
179 | |
180 | |
181 | |
182 #include "mmiColours.h" | |
183 | |
184 | |
185 #ifndef MFW_EVENT_PASSED | |
186 #define MFW_EVENT_PASSED 0 | |
187 #endif | |
188 | |
189 /* START: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
190 MfwHnd g_win; | |
191 | |
192 extern MfwHnd g_title_timer; | |
193 /* END: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
194 | |
195 extern MfwRect menuArea; /* menus display area */ | |
196 extern BOOL getMelodyListStatus(void); | |
197 | |
198 typedef enum | |
199 { | |
200 E_INIT, | |
201 E_BACK, | |
202 E_RETURN, | |
203 E_ABORT, | |
204 E_EXIT | |
205 } e_lists_events; | |
206 | |
207 | |
208 | |
209 /*----------------------------------------------------------------------------- | |
210 * | |
211 * List menu handling functions: | |
212 * | |
213 *-----------------------------------------------------------------------------*/ | |
214 // ADDED BY RAVI - 28-11-2005 | |
215 EXTERN UBYTE mnuDCSType (MfwHnd m, UBYTE listLanguageType); | |
216 EXTERN BOOL getScrollStatus(void); | |
217 // END RAVI - 28-11-2005 | |
218 | |
219 | |
220 static int listsKeyEvent(MfwEvt event, MfwKbd *keyboard); | |
221 static int listsWinEvent(MfwEvt e, MfwWin *w); | |
222 static int listsListCbMenu(MfwEvt EventCode, MfwMnu *MenuHandle); | |
223 static void lists_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
224 static int listsIconsKeyEvent(MfwEvt event, MfwKbd *keyboard); | |
225 static int listsIconsWinEvent(MfwEvt e, MfwWin *w); | |
226 static int listsIconsListCbMenu(MfwEvt EventCode, MfwMnu *MenuHandle); | |
227 static void listsIcons_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
228 | |
229 | |
230 /******************************************************************************* | |
231 | |
232 $Function: listIconsDisplayListMenu | |
233 | |
234 $Description: Creates a list menu from data stored in NVRAM. | |
235 | |
236 $Returns: none. | |
237 | |
238 $Arguments: | |
239 | |
240 *******************************************************************************/ | |
241 MfwHnd winIconsLists; | |
242 T_MFW listIconsDisplayListMenu (MfwHnd Parent, ListMenuData *Data, ListCbFunc cbFunc,int inUnicode) | |
243 { | |
244 // UBYTE i; // RAVI - Not Used. | |
245 MfwWin * win; | |
246 MfwHnd winLists; | |
247 T_MFW Status = LISTS_OK; | |
248 | |
249 TRACE_FUNCTION ("listIconsDisplayListMenu() Start"); | |
250 | |
251 winLists = winCreate(Parent, 0, E_WIN_VISIBLE |E_WIN_RESUME|E_WIN_SUSPEND, (MfwCb)listsIconsWinEvent); | |
252 winIconsLists=winLists; | |
253 if (winLists == NULL) | |
254 { | |
255 Status = LISTS_FAIL; /* Inform caller of failure. */ | |
256 TRACE_EVENT ("win creation fails"); | |
257 } | |
258 else | |
259 { | |
260 ListIconsWinInfo * ListData = (ListIconsWinInfo *)ALLOC_MEMORY (sizeof (ListIconsWinInfo)); | |
261 | |
262 if (!ListData) | |
263 { | |
264 /* cq12719. if insufficient memory for listdata then delete window and Free allocated memory.16-03-04.MZ */ | |
265 if(NULL != winLists) | |
266 winDelete(winLists); | |
267 | |
268 TRACE_EVENT ("(ListIconsWinInfo *)ALLOC_MEMORY fails"); | |
269 return LISTS_FAIL; | |
270 } | |
271 | |
272 ListData->mmi_control.dialog = (T_DIALOG_FUNC)lists_exec_cb; | |
273 ListData->mmi_control.data = ListData; | |
274 win = ((MfwHdr *)winLists)->data; | |
275 win->user = (void *) ListData; | |
276 | |
277 ListData->Parent = Parent; | |
278 ListData->Callback = cbFunc; | |
279 ListData->winLists = winLists; | |
280 ListData->kbdLists = kbdCreate(winLists,Data->KeyEvents|KEY_MAKE,(MfwCb)listsIconsKeyEvent); | |
281 ListData->kbdLists_long = kbdCreate(winLists,Data->KeyEvents|KEY_LONG,(MfwCb)listsIconsKeyEvent); | |
282 | |
283 if ((ListData->kbdLists == NULL) || (ListData->kbdLists_long == NULL)) | |
284 { | |
285 Status = LISTS_FAIL; | |
286 TRACE_EVENT ("ListData->kbdLists fails"); | |
287 } | |
288 else | |
289 { | |
290 /* Create initial list menu for display. */ | |
291 | |
292 /* | |
293 * set menu list from outside | |
294 */ | |
295 ListData->MenuListsAttr = *Data->Attr; /* copy contents */ | |
296 | |
297 /* SPR#2492 - DS - Do not overwrite mode settings unless mode is zero */ | |
298 if (ListData->MenuListsAttr.mode == 0x0000) /* Mode not yet setup */ | |
299 ListData->MenuListsAttr.mode = MNU_LEFT | MNU_LIST | MNU_CUR_LINE; | |
300 else | |
301 ListData->MenuListsAttr.mode |= Data->Attr->mode; | |
302 | |
303 ListData->MenuListsAttr.font = Data->Font; | |
304 ListData->MenuListsAttr.items = Data->List; | |
305 ListData->MenuListsAttr.nItems = Data->ListLength; | |
306 | |
307 /* START: x0045876, 05-June-2006 (OMAPS00060424 - Header Toggle) */ | |
308 ListData->MenuListsAttr.header_toggle = Data->Attr->header_toggle; | |
309 if (ListData->MenuListsAttr.header_toggle) | |
310 g_win = winLists; | |
311 /* END: x0045876, 05-June-2006 (OMAPS00060424 - Header Toggle) */ | |
312 | |
313 | |
314 /* | |
315 * Intialize List Menu Data | |
316 */ | |
317 ListData->MenuData = Data; /* copy contents */ | |
318 ListData->MenuData->listCol = COLOUR_LIST_XX; //Set-up colour | |
319 ListData->MenuData->Attr = &ListData->MenuListsAttr; /* copy data*/ | |
320 ListData->MenuLists = mnuCreate(winLists, &ListData->MenuListsAttr, | |
321 E_MNU_SELECT | E_MNU_ESCAPE| E_MNU_POSTDRAW, | |
322 (MfwCb)listsIconsListCbMenu); | |
323 ListData->MenuData->win = winLists; | |
324 Data->win = winLists; | |
325 mnuScrollMode(ListData->MenuLists,0); | |
326 if (Data->Strings) | |
327 mnuLang (ListData->MenuLists,0); | |
328 else | |
329 mnuLang (ListData->MenuLists,mainMmiLng); | |
330 | |
331 /* SPR#1983 - SH - Set up whether menu is in unicode or not */ | |
332 if (inUnicode != 0) | |
333 { | |
334 mnuDCSType(ListData->MenuLists, inUnicode); /* Unicode display */ | |
335 } | |
336 mnuChooseVisibleItem(ListData->MenuLists, Data->ListPosition-1); | |
337 mnuUnhide(ListData->MenuLists); | |
338 displaySoftKeys(ListData->MenuData->LeftSoftKey,ListData->MenuData->RightSoftKey); | |
339 winShow(winLists); | |
340 | |
341 } | |
342 } | |
343 return Status; | |
344 } | |
345 | |
346 static int listsIconsKeyEvent (MfwEvt e, MfwKbd *k) | |
347 /* list keyboard event handler */ | |
348 { | |
349 T_MFW_HND win = mfwParent(mfw_header()); | |
350 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
351 ListIconsWinInfo * data = (ListIconsWinInfo *)win_data->user; | |
352 MfwMnu *MenuHandle; | |
353 | |
354 /* This trace function was added inside the fflag by vinoj to remove compilation error: 2/6/06*/ | |
355 TRACE_FUNCTION("listsIconsKeyEvent() start"); | |
356 { | |
357 //xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
358 //Initialize selectKey to FALSE here. It will be set to TRUE only when a key event for KCD_MNUSELECT occurs. | |
359 data->MenuData->selectKey = FALSE; | |
360 if (!(e & KEY_MAKE)) | |
361 { | |
362 return MFW_EVENT_CONSUMED; | |
363 } | |
364 if(data->MenuData->block_keys == TRUE) | |
365 { | |
366 return MFW_EVENT_CONSUMED; | |
367 } | |
368 if (e & KEY_LONG) | |
369 { | |
370 switch (k->code) | |
371 { | |
372 case KCD_HUP: /* back to previous menu */ | |
373 mnuEscape(data->MenuLists); | |
374 break; | |
375 case KCD_RIGHT: /* Power Down */ | |
376 return MFW_EVENT_PASSED; /* handled by idle */ | |
377 default: /* no response to all other keys */ | |
378 return MFW_EVENT_CONSUMED; | |
379 } | |
380 } | |
381 else | |
382 { | |
383 switch (k->code) | |
384 { | |
385 case KCD_MNUUP: /* highlight previous entry */ | |
386 mnuUp(data->MenuLists); | |
387 { | |
388 MenuHandle = mfwControl(data->MenuLists); | |
389 data->MenuData->Reason = LISTS_REASON_SCROLL; | |
390 data->MenuData->CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
391 data->MenuData->ListPosition = MenuHandle->lCursor[MenuHandle->level]; | |
392 // Send event to indicate that the user has scrolled list items | |
393 SEND_EVENT(data->Parent, LISTS_REASON_SCROLL, 0, NULL); | |
394 } | |
395 | |
396 break; | |
397 case KCD_MNUDOWN: /* highlight next entry */ | |
398 mnuDown(data->MenuLists); | |
399 { | |
400 MenuHandle = mfwControl(data->MenuLists); | |
401 data->MenuData->Reason = LISTS_REASON_SCROLL; | |
402 data->MenuData->CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
403 data->MenuData->ListPosition = MenuHandle->lCursor[MenuHandle->level]; | |
404 // Send event to indicate that the user has scrolled list items | |
405 SEND_EVENT(data->Parent, LISTS_REASON_SCROLL, 0, NULL); | |
406 } | |
407 break; | |
408 case KCD_MNUSELECT: | |
409 //xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
410 //Menu Select Key was pressed, storing this for future use. | |
411 data->MenuData->selectKey = TRUE; | |
412 //Break is delibrately not used here. The control should pass through the KCD_LEFT case. | |
413 case KCD_LEFT: /* activate this entry */ | |
414 MenuHandle = mfwControl(data->MenuLists); | |
415 data->MenuData->CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
416 mnuSelect(data->MenuLists); | |
417 break; | |
418 case KCD_CALL: /* press send key */ | |
419 data->ExitReason = LISTS_REASON_SEND; | |
420 data->MenuData->Reason = LISTS_REASON_SEND; | |
421 MenuHandle = mfwControl(data->MenuLists); | |
422 data->MenuData->CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
423 data->MenuData->ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
424 | |
425 /* SPR998 - SH - check if callback exists before calling it! */ | |
426 if (data->Callback) | |
427 data->Callback(data->Parent, data->MenuData); | |
428 | |
429 if (data->MenuData->autoDestroy) | |
430 { | |
431 /* START: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
432 if (data->MenuListsAttr.header_toggle) | |
433 { | |
434 if (g_title_timer) | |
435 { | |
436 tim_delete(g_title_timer); | |
437 g_title_timer = NULL; | |
438 } | |
439 } | |
440 /* END: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
441 winDelete (win); | |
442 FREE_MEMORY ((void*)data, sizeof (ListIconsWinInfo)); | |
443 } | |
444 break; | |
445 case KCD_HUP: /* back to previous menu */ | |
446 data->ExitReason = LISTS_REASON_HANGUP; | |
447 data->MenuData->Reason = LISTS_REASON_HANGUP; | |
448 /*NM, p023 */ | |
449 | |
450 MenuHandle = mfwControl(data->MenuLists); | |
451 data->MenuData->CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
452 data->MenuData->ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
453 /*NM, p023 end */ | |
454 data->Callback(data->Parent, data->MenuData); | |
455 //July 10, 2007 REF: DRT OMAPS00135679 x0073106 | |
456 /*if (data->MenuData->autoDestroy) | |
457 {*/ | |
458 /* START: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
459 if (data->MenuListsAttr.header_toggle) | |
460 { | |
461 if (g_title_timer) | |
462 { | |
463 tim_delete(g_title_timer); | |
464 g_title_timer = NULL; | |
465 } | |
466 } | |
467 /* END: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
468 /* winDelete (win); | |
469 FREE_MEMORY ((void*)data, sizeof (ListIconsWinInfo)); | |
470 }*/ | |
471 break; | |
472 case KCD_RIGHT: /* back to previous menu */ | |
473 mnuEscape(data->MenuLists); | |
474 break; | |
475 default: /* no response to all other keys */ | |
476 return MFW_EVENT_CONSUMED; | |
477 } | |
478 } | |
479 } | |
480 return MFW_EVENT_CONSUMED; | |
481 } | |
482 | |
483 /******************************************************************************* | |
484 | |
485 $Function: listsWinEvent | |
486 | |
487 $Description: window event handler | |
488 | |
489 $Returns: none. | |
490 | |
491 $Arguments: | |
492 | |
493 *******************************************************************************/ | |
494 static int listsIconsWinEvent(MfwEvt e, MfwWin *w) | |
495 { | |
496 ListIconsWinInfo * ListData = (ListIconsWinInfo *)w->user; | |
497 | |
498 TRACE_FUNCTION("listsIconsWinEvent() start"); | |
499 TRACE_EVENT_P1("ListData->Parent %x",ListData->Parent); | |
500 switch (e) | |
501 { | |
502 case E_WIN_VISIBLE: | |
503 SEND_EVENT(ListData->Parent,LISTS_REASON_VISIBLE,0,(void*)ListData); | |
504 break; | |
505 case MfwWinResume: | |
506 SEND_EVENT(ListData->Parent,LISTS_REASON_RESUME,0,(void*)ListData); | |
507 break; | |
508 case MfwWinSuspend: | |
509 SEND_EVENT(ListData->Parent,LISTS_REASON_SUSPEND,0,(void*)ListData); | |
510 break; | |
511 } | |
512 return MFW_EVENT_CONSUMED; | |
513 } | |
514 /*a0393213 lint warning removal - This function is not used currently. So it's put under the flag. If it is required just remove the flag.*/ | |
515 #ifdef MMI_LINT_WARNING_REMOVAL | |
516 static void listsIcons_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
517 { | |
518 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
519 ListIconsWinInfo * ListData = (ListIconsWinInfo *)win_data->user; | |
520 T_MFW_HND * l_parent; | |
521 SHORT l_id; | |
522 | |
523 TRACE_FUNCTION ("listsIcons_exec_cb() start"); | |
524 | |
525 switch (event) | |
526 { | |
527 case E_INIT: | |
528 case E_BACK: | |
529 case E_RETURN: | |
530 case E_ABORT: | |
531 case E_EXIT: | |
532 /* defaultreaction */ | |
533 l_parent = ListData->Parent; | |
534 l_id = ListData->id; | |
535 | |
536 /* START: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
537 if (ListData->MenuListsAttr.header_toggle) | |
538 { | |
539 if (g_title_timer) | |
540 { | |
541 tim_delete(g_title_timer); | |
542 g_title_timer = NULL; | |
543 } | |
544 } | |
545 /* END: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
546 winDelete (win); | |
547 FREE_MEMORY ((void*) ListData, sizeof (ListIconsWinInfo)); | |
548 SEND_EVENT (l_parent, event, l_id, NULL); /* forward event to parent */ | |
549 break; | |
550 default: | |
551 return; | |
552 } | |
553 } | |
554 #endif | |
555 | |
556 | |
557 /******************************************************************************* | |
558 | |
559 $Function: listsListCbMenu | |
560 | |
561 $Description: List menu handler. (mfw callback function) | |
562 | |
563 $Returns: none. | |
564 | |
565 $Arguments: | |
566 | |
567 *******************************************************************************/ | |
568 int listsIconsListCbMenu(MfwEvt EventCode, MfwMnu *MenuHandle) | |
569 { | |
570 int Status = LISTS_OK; | |
571 T_MFW_HND win = mfw_parent (mfw_header()); | |
572 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
573 ListIconsWinInfo* ListData = (ListIconsWinInfo *)win_data->user; | |
574 | |
575 TRACE_FUNCTION("listsIconsListCbMenu() "); | |
576 switch (EventCode) | |
577 { | |
578 case E_MNU_SELECT: | |
579 ListData->ExitReason = E_MNU_SELECT; | |
580 ListData->MenuData->Reason = LISTS_REASON_SELECT;// MZ 14/2/01 E_MNU_SELECT; | |
581 ListData->MenuData->CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
582 ListData->MenuData->ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
583 /* SPR998 - SH - check if callback exists before calling it! */ | |
584 if (ListData->Callback) | |
585 ListData->Callback(ListData->Parent, ListData->MenuData); | |
586 break; | |
587 case E_MNU_ESCAPE: | |
588 ListData->ExitReason = LISTS_REASON_BACK; | |
589 ListData->MenuData->Reason = LISTS_REASON_BACK; | |
590 /*NM, p023*/ | |
591 ListData->MenuData->CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
592 ListData->MenuData->ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
593 /*NM, p023*/ | |
594 | |
595 /* SPR998 - SH - check if callback exists before calling it! */ | |
596 if (ListData->Callback) | |
597 ListData->Callback(ListData->Parent, ListData->MenuData); | |
598 | |
599 break; | |
600 case E_MNU_POSTDRAW: | |
601 { | |
602 T_MFW_WIN * winIconsLists_data = ((T_MFW_HDR *)winIconsLists)->data; | |
603 ListIconsWinInfo* winIconsListsData = (ListIconsWinInfo *)winIconsLists_data->user; | |
604 winIconsListsData->ExitReason = LISTS_REASON_DRAWCOMPLETE; | |
605 winIconsListsData->MenuData->Reason = LISTS_REASON_DRAWCOMPLETE; | |
606 winIconsListsData->MenuData->CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
607 winIconsListsData->MenuData->ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
608 winIconsListsData->MenuData->lineHeight= MenuHandle->lineHeight; | |
609 if (winIconsListsData->Callback) | |
610 winIconsListsData->Callback(winIconsListsData->Parent, winIconsListsData->MenuData); | |
611 } | |
612 break; | |
613 default: | |
614 Status = LISTS_FAIL; | |
615 break; | |
616 } | |
617 | |
618 | |
619 return Status; | |
620 } | |
621 | |
622 void listsIconsDestroy(T_MFW_HND win) | |
623 { | |
624 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
625 ListIconsWinInfo * ListData = (ListIconsWinInfo *)win_data->user; | |
626 TRACE_EVENT_P1("listsIconsDestroy %x",win); | |
627 | |
628 /* START: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
629 if (ListData->MenuListsAttr.header_toggle) | |
630 { | |
631 if(g_title_timer) | |
632 { | |
633 tim_delete(g_title_timer); | |
634 g_title_timer = NULL; | |
635 } | |
636 } | |
637 /* END: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
638 | |
639 winDelete (win); | |
640 FREE_MEMORY ((void*) ListData, sizeof (ListIconsWinInfo)); | |
641 | |
642 } | |
643 | |
644 /******************************************************************************* | |
645 | |
646 $Function: listDisplayListMenu | |
647 | |
648 $Description: Creates a list menu from data stored in NVRAM. | |
649 | |
650 $Returns: none. | |
651 | |
652 $Arguments: | |
653 | |
654 *******************************************************************************/ | |
655 T_MFW listDisplayListMenu (MfwHnd Parent, ListMenuData *Data, ListCbFunc cbFunc,int inUnicode) | |
656 { | |
657 // UBYTE i; // RAVI - Not Used. | |
658 MfwWin * win; | |
659 MfwHnd winLists; | |
660 T_MFW Status = LISTS_OK; | |
661 | |
662 TRACE_FUNCTION ("listDisplayListMenu() Start"); | |
663 | |
664 winLists = winCreate(Parent, 0, E_WIN_VISIBLE |E_WIN_RESUME|E_WIN_SUSPEND, (MfwCb)listsWinEvent); | |
665 | |
666 if (winLists == NULL) | |
667 { | |
668 Status = LISTS_FAIL; /* Inform caller of failure. */ | |
669 TRACE_EVENT ("win creation fails"); | |
670 } | |
671 else | |
672 { | |
673 ListWinInfo * ListData = (ListWinInfo *)ALLOC_MEMORY (sizeof (ListWinInfo)); | |
674 | |
675 if (!ListData) | |
676 { | |
677 /* cq12719. if insufficient memory for listdata then delete window and Free allocated memory.16-03-04.MZ */ | |
678 if(NULL != winLists) | |
679 winDelete(winLists); | |
680 | |
681 TRACE_EVENT ("(ListWinInfo *)ALLOC_MEMORY fails"); | |
682 return LISTS_FAIL; | |
683 } | |
684 | |
685 ListData->mmi_control.dialog = (T_DIALOG_FUNC)lists_exec_cb; | |
686 ListData->mmi_control.data = ListData; | |
687 win = ((MfwHdr *)winLists)->data; | |
688 win->user = (void *) ListData; | |
689 | |
690 ListData->Parent = Parent; | |
691 ListData->Callback = cbFunc; | |
692 ListData->winLists = winLists; | |
693 ListData->kbdLists = kbdCreate(winLists,Data->KeyEvents|KEY_MAKE, (MfwCb)listsKeyEvent); | |
694 ListData->kbdLists_long = kbdCreate(winLists,Data->KeyEvents|KEY_LONG,(MfwCb)listsKeyEvent); | |
695 | |
696 if ((ListData->kbdLists == NULL) || (ListData->kbdLists_long == NULL)) | |
697 { | |
698 Status = LISTS_FAIL; | |
699 TRACE_EVENT ("ListData->kbdLists fails"); | |
700 } | |
701 else | |
702 { | |
703 /* Create initial list menu for display. */ | |
704 | |
705 /* | |
706 * set menu list from outside | |
707 */ | |
708 ListData->MenuListsAttr = *Data->Attr; /* copy contents */ | |
709 | |
710 /* SPR#2492 - DS - Do not overwrite mode settings unless mode is zero */ | |
711 if (ListData->MenuListsAttr.mode == 0x0000) /* Mode not yet setup */ | |
712 ListData->MenuListsAttr.mode = MNU_LEFT | MNU_LIST | MNU_CUR_LINE; | |
713 else | |
714 ListData->MenuListsAttr.mode |= Data->Attr->mode; | |
715 | |
716 ListData->MenuListsAttr.font = Data->Font; | |
717 ListData->MenuListsAttr.items = Data->List; | |
718 ListData->MenuListsAttr.nItems = Data->ListLength; | |
719 | |
720 /* START: x0045876, 05-June-2006 (OMAPS00060424 - Header Toggle) */ | |
721 ListData->MenuListsAttr.header_toggle = Data->Attr->header_toggle; | |
722 if (ListData->MenuListsAttr.header_toggle) | |
723 g_win = winLists; | |
724 /* END: x0045876, 05-June-2006 (OMAPS00060424 - Header Toggle) */ | |
725 | |
726 | |
727 /* | |
728 * Intialize List Menu Data | |
729 */ | |
730 ListData->MenuData = *Data; /* copy contents */ | |
731 ListData->MenuData.listCol = COLOUR_LIST_XX; //Set-up colour | |
732 ListData->MenuData.Attr = &ListData->MenuListsAttr; /* copy data*/ | |
733 ListData->MenuLists = mnuCreate(winLists, &ListData->MenuListsAttr, | |
734 E_MNU_SELECT | E_MNU_ESCAPE, | |
735 (MfwCb)listsListCbMenu); | |
736 ListData->MenuData.win = winLists; | |
737 Data->win = winLists; | |
738 mnuScrollMode(ListData->MenuLists,1); | |
739 if (Data->Strings) | |
740 mnuLang (ListData->MenuLists,0); | |
741 else | |
742 mnuLang (ListData->MenuLists,mainMmiLng); | |
743 | |
744 /* SPR#1983 - SH - Set up whether menu is in unicode or not */ | |
745 if (inUnicode != 0) | |
746 { | |
747 mnuDCSType(ListData->MenuLists, inUnicode); /* Unicode display */ | |
748 } | |
749 mnuChooseVisibleItem(ListData->MenuLists, Data->ListPosition-1); | |
750 mnuUnhide(ListData->MenuLists); | |
751 TRACE_EVENT ("mmiList winShow()"); | |
752 winShow(winLists); | |
753 } | |
754 } | |
755 | |
756 return Status; | |
757 } | |
758 | |
759 | |
760 /******************************************************************************* | |
761 | |
762 $Function: listsKeyEvent | |
763 | |
764 $Description: Keyboard event handler | |
765 | |
766 $Returns: none. | |
767 | |
768 $Arguments: | |
769 | |
770 *******************************************************************************/ | |
771 static int listsKeyEvent (MfwEvt e, MfwKbd *k) | |
772 /* list keyboard event handler */ | |
773 { | |
774 T_MFW_HND win = mfwParent(mfw_header()); | |
775 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
776 ListWinInfo * data = (ListWinInfo *)win_data->user; | |
777 MfwMnu *MenuHandle; | |
778 | |
779 /* This trace function was added inside the fflag by vinoj to remove compilation error: 2/6/06*/ | |
780 | |
781 { | |
782 //xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
783 //Initialize selectKey to FALSE here. It will be set to TRUE only when a key event for KCD_MNUSELECT occurs. | |
784 data->MenuData.selectKey = FALSE; | |
785 if (!(e & KEY_MAKE)) | |
786 { | |
787 return MFW_EVENT_CONSUMED; | |
788 } | |
789 | |
790 | |
791 if (e & KEY_LONG) | |
792 { | |
793 switch (k->code) | |
794 { | |
795 case KCD_HUP: /* back to previous menu */ | |
796 mnuEscape(data->MenuLists); | |
797 break; | |
798 case KCD_RIGHT: /* Power Down */ | |
799 return MFW_EVENT_PASSED; /* handled by idle */ | |
800 default: /* no response to all other keys */ | |
801 return MFW_EVENT_CONSUMED; | |
802 } | |
803 } | |
804 else | |
805 { | |
806 switch (k->code) | |
807 { | |
808 case KCD_MNUUP: /* highlight previous entry */ | |
809 mnuUp(data->MenuLists); | |
810 //GW Not needed? winShow(win); | |
811 // Only required in melody list selection. | |
812 /* Mar 30, 2007 REF: OMAPS00122691 x0039928 */ | |
813 /* This event will be used to play the selected file. */ | |
814 | |
815 if(getMelodyListStatus()== TRUE) | |
816 { | |
817 MenuHandle = mfwControl(data->MenuLists); | |
818 | |
819 data->MenuData.Reason = LISTS_REASON_SCROLL; | |
820 data->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
821 data->MenuData.ListPosition = MenuHandle->lCursor[MenuHandle->level]; | |
822 SEND_EVENT(data->Parent,E_START_MELODY,0,(void*)data); | |
823 } | |
824 | |
825 if(getScrollStatus() == TRUE) | |
826 { | |
827 // Send event to indicate that the user has scrolled list items | |
828 SEND_EVENT(data->Parent, LISTS_REASON_SCROLL, 0, NULL); | |
829 } | |
830 break; | |
831 case KCD_MNUDOWN: /* highlight next entry */ | |
832 mnuDown(data->MenuLists); | |
833 //GW Not needed? winShow(win); | |
834 /* Mar 30, 2007 REF: OMAPS00122691 x0039928 */ | |
835 /* This event will be used to play the selected file. */ | |
836 | |
837 if(getMelodyListStatus()== TRUE) | |
838 { | |
839 MenuHandle = mfwControl(data->MenuLists); | |
840 | |
841 data->MenuData.Reason = LISTS_REASON_SCROLL; | |
842 data->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
843 data->MenuData.ListPosition = MenuHandle->lCursor[MenuHandle->level]; | |
844 SEND_EVENT(data->Parent,E_START_MELODY,0,(void*)data); | |
845 } | |
846 | |
847 if(getScrollStatus() == TRUE) | |
848 { | |
849 // Send event to indicate that the user has scrolled list items | |
850 SEND_EVENT(data->Parent, LISTS_REASON_SCROLL, 0, NULL); | |
851 } | |
852 break; | |
853 case KCD_MNUSELECT: | |
854 //xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
855 //Menu Select Key was pressed, storing this for future use. | |
856 data->MenuData.selectKey = TRUE; | |
857 //Break is delibrately not used here. The control should pass through the KCD_LEFT case. | |
858 case KCD_LEFT: /* activate this entry */ | |
859 mnuSelect(data->MenuLists); | |
860 MenuHandle = mfwControl(data->MenuLists); | |
861 if ((MenuHandle != NULL) && // Marcus: Issue 1810: 12/03/2003 | |
862 (MenuHandle->curAttr != NULL) && | |
863 winIsFocussed(win)) | |
864 { | |
865 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, MenuHandle->curAttr->mnuColour); | |
866 } | |
867 break; | |
868 case KCD_CALL: /* press send key */ | |
869 data->ExitReason = LISTS_REASON_SEND; | |
870 data->MenuData.Reason = LISTS_REASON_SEND; | |
871 MenuHandle = mfwControl(data->MenuLists); | |
872 data->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
873 data->MenuData.ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
874 | |
875 /* SPR998 - SH - check if callback exists before calling it! */ | |
876 if (data->Callback) | |
877 data->Callback(data->Parent, &data->MenuData); | |
878 | |
879 if (data->MenuData.autoDestroy) | |
880 { | |
881 /* START: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
882 if (data->MenuListsAttr.header_toggle) | |
883 { | |
884 if (g_title_timer) | |
885 { | |
886 tim_delete(g_title_timer); | |
887 g_title_timer = NULL; | |
888 } | |
889 } | |
890 /* END: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
891 winDelete (win); | |
892 FREE_MEMORY ((void*)data, sizeof (ListWinInfo)); | |
893 } | |
894 break; | |
895 case KCD_HUP: /* back to previous menu */ | |
896 data->ExitReason = LISTS_REASON_HANGUP; | |
897 data->MenuData.Reason = LISTS_REASON_HANGUP; | |
898 /*NM, p023 */ | |
899 MenuHandle = mfwControl(data->MenuLists); | |
900 data->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
901 data->MenuData.ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
902 /*NM, p023 end */ | |
903 data->Callback(data->Parent, &data->MenuData); | |
904 if (data->MenuData.autoDestroy) | |
905 { | |
906 /* START: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
907 if (data->MenuListsAttr.header_toggle) | |
908 { | |
909 if (g_title_timer) | |
910 { | |
911 tim_delete(g_title_timer); | |
912 g_title_timer = NULL; | |
913 } | |
914 } | |
915 /* END: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
916 winDelete (win); | |
917 FREE_MEMORY ((void*)data, sizeof (ListWinInfo)); | |
918 } | |
919 break; | |
920 case KCD_RIGHT: /* back to previous menu */ | |
921 mnuEscape(data->MenuLists); | |
922 break; | |
923 default: /* no response to all other keys */ | |
924 return MFW_EVENT_CONSUMED; | |
925 } | |
926 } | |
927 } | |
928 TRACE_FUNCTION("listsKeyEvent()-end"); | |
929 return MFW_EVENT_CONSUMED; | |
930 } | |
931 | |
932 /******************************************************************************* | |
933 | |
934 $Function: listsWinEvent | |
935 | |
936 $Description: window event handler | |
937 | |
938 $Returns: none. | |
939 | |
940 $Arguments: | |
941 | |
942 *******************************************************************************/ | |
943 static int listsWinEvent(MfwEvt e, MfwWin *w) | |
944 { | |
945 ListWinInfo * ListData = (ListWinInfo *)w->user; | |
946 | |
947 TRACE_FUNCTION("listsWinEvent()"); | |
948 | |
949 switch (e) | |
950 { | |
951 case E_WIN_VISIBLE: | |
952 SEND_EVENT(ListData->Parent,LISTS_REASON_VISIBLE,0,(void*)ListData); | |
953 break; | |
954 case MfwWinResume: | |
955 SEND_EVENT(ListData->Parent,LISTS_REASON_RESUME,0,(void*)ListData); | |
956 break; | |
957 case MfwWinSuspend: | |
958 SEND_EVENT(ListData->Parent,LISTS_REASON_SUSPEND,0,(void*)ListData); | |
959 break; | |
960 } | |
961 return MFW_EVENT_CONSUMED; | |
962 } | |
963 | |
964 static void lists_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
965 { | |
966 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
967 ListWinInfo * ListData = (ListWinInfo *)win_data->user; | |
968 T_MFW_HND * l_parent; | |
969 SHORT l_id; | |
970 | |
971 TRACE_FUNCTION ("lists_exec_cb()"); | |
972 | |
973 switch (event) | |
974 { | |
975 case E_INIT: | |
976 case E_BACK: | |
977 case E_RETURN: | |
978 case E_ABORT: | |
979 case E_EXIT: | |
980 /* defaultreaction */ | |
981 l_parent = ListData->Parent; | |
982 l_id = ListData->id; | |
983 | |
984 /* START: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
985 if (ListData->MenuListsAttr.header_toggle) | |
986 { | |
987 if (g_title_timer) | |
988 { | |
989 tim_delete(g_title_timer); | |
990 g_title_timer = NULL; | |
991 } | |
992 } | |
993 /* END: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
994 winDelete (win); | |
995 FREE_MEMORY ((void*) ListData, sizeof (ListWinInfo)); | |
996 SEND_EVENT (l_parent, event, l_id, NULL); /* forward event to parent */ | |
997 break; | |
998 default: | |
999 return; | |
1000 } | |
1001 } | |
1002 | |
1003 | |
1004 | |
1005 /******************************************************************************* | |
1006 | |
1007 $Function: listsListCbMenu | |
1008 | |
1009 $Description: List menu handler. (mfw callback function) | |
1010 | |
1011 $Returns: none. | |
1012 | |
1013 $Arguments: | |
1014 | |
1015 *******************************************************************************/ | |
1016 int listsListCbMenu(MfwEvt EventCode, MfwMnu *MenuHandle) | |
1017 { | |
1018 int Status = LISTS_OK; | |
1019 T_MFW_HND win = mfw_parent (mfw_header()); | |
1020 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
1021 ListWinInfo* ListData = (ListWinInfo *)win_data->user; | |
1022 | |
1023 TRACE_FUNCTION("listsCbMenu()"); | |
1024 | |
1025 switch (EventCode) | |
1026 { | |
1027 case E_MNU_SELECT: | |
1028 ListData->ExitReason = E_MNU_SELECT; | |
1029 ListData->MenuData.Reason = LISTS_REASON_SELECT;// MZ 14/2/01 E_MNU_SELECT; | |
1030 ListData->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
1031 ListData->MenuData.ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
1032 /* SPR998 - SH - check if callback exists before calling it! */ | |
1033 if (ListData->Callback) | |
1034 ListData->Callback(ListData->Parent, &ListData->MenuData); | |
1035 break; | |
1036 | |
1037 case E_MNU_ESCAPE: | |
1038 ListData->ExitReason = LISTS_REASON_BACK; | |
1039 ListData->MenuData.Reason = LISTS_REASON_BACK; | |
1040 /*NM, p023*/ | |
1041 ListData->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
1042 ListData->MenuData.ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
1043 /*NM, p023*/ | |
1044 | |
1045 /* SPR998 - SH - check if callback exists before calling it! */ | |
1046 if (ListData->Callback) | |
1047 ListData->Callback(ListData->Parent, &ListData->MenuData); | |
1048 break; | |
1049 | |
1050 default: | |
1051 Status = LISTS_FAIL; | |
1052 TRACE_EVENT("Activation 77 error"); | |
1053 break; | |
1054 } | |
1055 | |
1056 /* | |
1057 * Free all allocated memory and handler | |
1058 */ | |
1059 if (ListData->MenuData.autoDestroy) | |
1060 { | |
1061 /* START: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
1062 if (ListData->MenuListsAttr.header_toggle) | |
1063 { | |
1064 if (g_title_timer) | |
1065 { | |
1066 tim_delete(g_title_timer); | |
1067 g_title_timer = NULL; | |
1068 } | |
1069 } | |
1070 /* END: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
1071 winDelete (win); | |
1072 FREE_MEMORY ((void*) ListData, sizeof (ListWinInfo)); | |
1073 } | |
1074 return Status; | |
1075 } | |
1076 | |
1077 void listsDestroy(T_MFW_HND win) | |
1078 { | |
1079 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1080 ListWinInfo * ListData = (ListWinInfo *)win_data->user; | |
1081 | |
1082 /* START: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
1083 if (ListData->MenuListsAttr.header_toggle) | |
1084 { | |
1085 if(g_title_timer) | |
1086 { | |
1087 tim_delete(g_title_timer); | |
1088 g_title_timer = NULL; | |
1089 } | |
1090 } | |
1091 /* END: 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */ | |
1092 | |
1093 winDelete (win); | |
1094 FREE_MEMORY ((void*) ListData, sizeof (ListWinInfo)); | |
1095 | |
1096 } | |
1097 |