FreeCalypso > hg > fc-magnetite
comparison src/aci2/bmi/MmiLists.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 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 xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
32 Using the MenuSelect Key for requesting the help info in STK menu. Storing the info that | |
33 MenuSelectKey was pressed in a list view. | |
34 | |
35 May 24, 2005 REF: CRR 29358 x0021334 | |
36 Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response | |
37 Fix: The implementation is now based on timer. After the specified timeout period | |
38 the control comes back to SAT main menu, if there is no selection done by the user. | |
39 | |
40 25/10/00 Original Condat(UK) BMI version. | |
41 | |
42 $End | |
43 | |
44 *******************************************************************************/ | |
45 | |
46 #define ENTITY_MFW | |
47 | |
48 /* includes */ | |
49 #include <string.h> | |
50 #include <stdio.h> | |
51 #include <stdlib.h> | |
52 | |
53 #if defined (NEW_FRAME) | |
54 | |
55 #include "typedefs.h" | |
56 #include "vsi.h" | |
57 #include "pei.h" | |
58 #include "custom.h" | |
59 #include "gsm.h" | |
60 | |
61 #else | |
62 | |
63 #include "STDDEFS.H" | |
64 #include "custom.h" | |
65 #include "gsm.h" | |
66 #include "vsi.h" | |
67 | |
68 #endif | |
69 | |
70 #include "pconst.cdg" | |
71 #include "mconst.cdg" | |
72 #include "message.h" | |
73 #include "ccdapi.h" | |
74 #include "prim.h" | |
75 #include "cus_aci.h" | |
76 #include "cnf_aci.h" | |
77 #include "mon_aci.h" | |
78 | |
79 #include "tok.h" | |
80 | |
81 #include "prim.h" | |
82 #ifndef PCM_2_FFS | |
83 #include "pcm.h" | |
84 #endif | |
85 | |
86 | |
87 | |
88 | |
89 #include "mfw_sys.h" | |
90 | |
91 #include "mfw_mfw.h" | |
92 #include "mfw_win.h" | |
93 #include "mfw_kbd.h" | |
94 #include "mfw_lng.h" | |
95 /* SPR#1428 - SH - New Editor changes */ | |
96 #ifndef NEW_EDITOR | |
97 #include "mfw_edt.h" | |
98 #endif | |
99 #include "mfw_icn.h" | |
100 #include "mfw_mnu.h" | |
101 #include "mfw_tim.h" | |
102 | |
103 #include "mfw_sim.h" | |
104 #include "mfw_cm.h" | |
105 #include "mfw_nm.h" | |
106 #include "mfw_phb.h" | |
107 #include "mfw_mme.h" | |
108 #include "mfw_sat.h" | |
109 #include "mfw_sms.h" | |
110 | |
111 #include "dspl.h" | |
112 | |
113 #include "ksd.h" | |
114 #include "psa.h" | |
115 | |
116 #include "MmiMain.h" | |
117 #include "MmiBookController.h" | |
118 #include "MmiDummy.h" | |
119 #include "MmiDialogs.h" | |
120 #include "MmiLists.h" | |
121 | |
122 | |
123 | |
124 #include "MmiMenu.h" | |
125 #include "mmiCall.h" | |
126 #include "Mmiicons.h" | |
127 #include "MmiIdle.h" | |
128 | |
129 #include "MmiSoftKeys.h" | |
130 #include "MmiSounds.h" | |
131 #include "MmiIdle.h" | |
132 #include "MmiNetwork.h" | |
133 #include "mmiSat_i.h" | |
134 #include "MmiAoc.h" | |
135 | |
136 #include "gdi.h" | |
137 #include "audio.h" | |
138 | |
139 #include "cus_aci.h" | |
140 #include "mfw_ffs.h" | |
141 #include "MmiTimers.h" | |
142 | |
143 | |
144 | |
145 #include "mmiColours.h" | |
146 | |
147 | |
148 #ifndef MFW_EVENT_PASSED | |
149 #define MFW_EVENT_PASSED 0 | |
150 #endif | |
151 | |
152 extern MfwRect menuArea; /* menus display area */ | |
153 extern BOOL getMelodyListStatus(void); | |
154 | |
155 typedef enum | |
156 { | |
157 E_INIT, | |
158 E_BACK, | |
159 E_RETURN, | |
160 E_ABORT, | |
161 E_EXIT | |
162 } e_lists_events; | |
163 | |
164 | |
165 /*----------------------------------------------------------------------------- | |
166 * | |
167 * List menu handling functions: | |
168 * | |
169 *-----------------------------------------------------------------------------*/ | |
170 // ADDED BY RAVI - 28-11-2005 | |
171 EXTERN UBYTE mnuDCSType (MfwHnd m, UBYTE listLanguageType); | |
172 EXTERN BOOL getScrollStatus(void); | |
173 // END RAVI - 28-11-2005 | |
174 | |
175 | |
176 static int listsKeyEvent(MfwEvt event, MfwKbd *keyboard); | |
177 static int listsWinEvent(MfwEvt e, MfwWin *w); | |
178 static int listsListCbMenu(MfwEvt EventCode, MfwMnu *MenuHandle); | |
179 static void lists_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
180 | |
181 | |
182 /******************************************************************************* | |
183 | |
184 $Function: listDisplayListMenu | |
185 | |
186 $Description: Creates a list menu from data stored in NVRAM. | |
187 | |
188 $Returns: none. | |
189 | |
190 $Arguments: | |
191 | |
192 *******************************************************************************/ | |
193 T_MFW listDisplayListMenu (MfwHnd Parent, ListMenuData *Data, ListCbFunc cbFunc,int inUnicode) | |
194 { | |
195 // UBYTE i; // RAVI - Not Used. | |
196 MfwWin * win; | |
197 MfwHnd winLists; | |
198 T_MFW Status = LISTS_OK; | |
199 | |
200 TRACE_FUNCTION ("listDisplayListMenu()"); | |
201 | |
202 winLists = winCreate(Parent, 0, E_WIN_VISIBLE, (MfwCb)listsWinEvent); | |
203 | |
204 if (winLists == NULL) | |
205 { | |
206 Status = LISTS_FAIL; /* Inform caller of failure. */ | |
207 TRACE_EVENT ("win creation fails"); | |
208 } | |
209 else | |
210 { | |
211 ListWinInfo * ListData = (ListWinInfo *)ALLOC_MEMORY (sizeof (ListWinInfo)); | |
212 | |
213 if (!ListData) | |
214 { | |
215 /* cq12719. if insufficient memory for listdata then delete window and Free allocated memory.16-03-04.MZ */ | |
216 if(NULL != winLists) | |
217 winDelete(winLists); | |
218 | |
219 TRACE_EVENT ("(ListWinInfo *)ALLOC_MEMORY fails"); | |
220 return LISTS_FAIL; | |
221 } | |
222 | |
223 ListData->mmi_control.dialog = (T_DIALOG_FUNC)lists_exec_cb; | |
224 ListData->mmi_control.data = ListData; | |
225 win = ((MfwHdr *)winLists)->data; | |
226 win->user = (void *) ListData; | |
227 | |
228 ListData->Parent = Parent; | |
229 ListData->Callback = cbFunc; | |
230 ListData->winLists = winLists; | |
231 ListData->kbdLists = kbdCreate(winLists,Data->KeyEvents|KEY_MAKE, (MfwCb)listsKeyEvent); | |
232 ListData->kbdLists_long = kbdCreate(winLists,Data->KeyEvents|KEY_LONG,(MfwCb)listsKeyEvent); | |
233 | |
234 if ((ListData->kbdLists == NULL) || (ListData->kbdLists_long == NULL)) | |
235 { | |
236 Status = LISTS_FAIL; | |
237 TRACE_EVENT ("ListData->kbdLists fails"); | |
238 } | |
239 else | |
240 { | |
241 /* Create initial list menu for display. */ | |
242 | |
243 /* | |
244 * set menu list from outside | |
245 */ | |
246 ListData->MenuListsAttr = *Data->Attr; /* copy contents */ | |
247 | |
248 /* SPR#2492 - DS - Do not overwrite mode settings unless mode is zero */ | |
249 if (ListData->MenuListsAttr.mode == 0x0000) /* Mode not yet setup */ | |
250 ListData->MenuListsAttr.mode = MNU_LEFT | MNU_LIST | MNU_CUR_LINE; | |
251 else | |
252 ListData->MenuListsAttr.mode |= Data->Attr->mode; | |
253 | |
254 ListData->MenuListsAttr.font = Data->Font; | |
255 ListData->MenuListsAttr.items = Data->List; | |
256 ListData->MenuListsAttr.nItems = Data->ListLength; | |
257 | |
258 /* | |
259 * Intialize List Menu Data | |
260 */ | |
261 ListData->MenuData = *Data; /* copy contents */ | |
262 ListData->MenuData.listCol = COLOUR_LIST_XX; //Set-up colour | |
263 ListData->MenuData.Attr = &ListData->MenuListsAttr; /* copy data*/ | |
264 ListData->MenuLists = mnuCreate(winLists, &ListData->MenuListsAttr, | |
265 E_MNU_SELECT | E_MNU_ESCAPE, | |
266 (MfwCb)listsListCbMenu); | |
267 ListData->MenuData.win = winLists; | |
268 Data->win = winLists; | |
269 mnuScrollMode(ListData->MenuLists,1); | |
270 if (Data->Strings) | |
271 mnuLang (ListData->MenuLists,0); | |
272 else | |
273 mnuLang (ListData->MenuLists,mainMmiLng); | |
274 | |
275 /* SPR#1983 - SH - Set up whether menu is in unicode or not */ | |
276 if (inUnicode != 0) | |
277 { | |
278 mnuDCSType(ListData->MenuLists, inUnicode); /* Unicode display */ | |
279 } | |
280 mnuChooseVisibleItem(ListData->MenuLists, Data->ListPosition-1); | |
281 mnuUnhide(ListData->MenuLists); | |
282 TRACE_EVENT ("mmiList winShow()"); | |
283 winShow(winLists); | |
284 } | |
285 } | |
286 | |
287 return Status; | |
288 } | |
289 | |
290 | |
291 /******************************************************************************* | |
292 | |
293 $Function: listsKeyEvent | |
294 | |
295 $Description: Keyboard event handler | |
296 | |
297 $Returns: none. | |
298 | |
299 $Arguments: | |
300 | |
301 *******************************************************************************/ | |
302 static int listsKeyEvent (MfwEvt e, MfwKbd *k) | |
303 /* list keyboard event handler */ | |
304 { | |
305 T_MFW_HND win = mfwParent(mfw_header()); | |
306 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
307 ListWinInfo * data = (ListWinInfo *)win_data->user; | |
308 MfwMnu *MenuHandle; | |
309 | |
310 | |
311 TRACE_FUNCTION("listsKeyEvent()"); | |
312 //xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
313 //Initialize selectKey to FALSE here. It will be set to TRUE only when a key event for KCD_MNUSELECT occurs. | |
314 data->MenuData.selectKey = FALSE; | |
315 if (!(e & KEY_MAKE)) | |
316 { | |
317 return MFW_EVENT_CONSUMED; | |
318 } | |
319 | |
320 | |
321 if (e & KEY_LONG) | |
322 { | |
323 switch (k->code) | |
324 { | |
325 case KCD_HUP: /* back to previous menu */ | |
326 mnuEscape(data->MenuLists); | |
327 break; | |
328 case KCD_RIGHT: /* Power Down */ | |
329 return MFW_EVENT_PASSED; /* handled by idle */ | |
330 default: /* no response to all other keys */ | |
331 return MFW_EVENT_CONSUMED; | |
332 } | |
333 } | |
334 else | |
335 { | |
336 switch (k->code) | |
337 { | |
338 case KCD_MNUUP: /* highlight previous entry */ | |
339 mnuUp(data->MenuLists); | |
340 //GW Not needed? winShow(win); | |
341 // Only required in melody list selection. | |
342 if(getMelodyListStatus()== TRUE) | |
343 { | |
344 MenuHandle = mfwControl(data->MenuLists); | |
345 | |
346 data->MenuData.Reason = LISTS_REASON_SCROLL; | |
347 data->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
348 data->MenuData.ListPosition = MenuHandle->lCursor[MenuHandle->level]; | |
349 SEND_EVENT(data->Parent,E_START_MELODY,0,(void*)data); | |
350 } | |
351 | |
352 // May 24, 2005 REF: CRR 29358 x0021334 | |
353 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response | |
354 // Required when user scrolls list items. Depeneding on this, the timer needs | |
355 // to be restarted for another 20 seconds. | |
356 if(getScrollStatus() == TRUE) | |
357 { | |
358 // Send event to indicate that the user has scrolled list items | |
359 SEND_EVENT(data->Parent, LISTS_REASON_SCROLL, 0, NULL); | |
360 } | |
361 break; | |
362 case KCD_MNUDOWN: /* highlight next entry */ | |
363 mnuDown(data->MenuLists); | |
364 //GW Not needed? winShow(win); | |
365 | |
366 if(getMelodyListStatus() == TRUE) | |
367 { | |
368 MenuHandle = mfwControl(data->MenuLists); | |
369 | |
370 data->MenuData.Reason = LISTS_REASON_SCROLL; | |
371 data->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
372 data->MenuData.ListPosition = MenuHandle->lCursor[MenuHandle->level]; | |
373 | |
374 SEND_EVENT(data->Parent,E_START_MELODY,0,(void*)data); | |
375 } | |
376 | |
377 // May 24, 2005 REF: CRR 29358 x0021334 | |
378 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response | |
379 // Required when user scrolls list items. Depeneding on this, the timer needs | |
380 // to be restarted for another 20 seconds. | |
381 if(getScrollStatus() == TRUE) | |
382 { | |
383 // Send event to indicate that the user has scrolled list items | |
384 SEND_EVENT(data->Parent, LISTS_REASON_SCROLL, 0, NULL); | |
385 } | |
386 break; | |
387 case KCD_MNUSELECT: | |
388 //xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357 | |
389 //Menu Select Key was pressed, storing this for future use. | |
390 data->MenuData.selectKey = TRUE; | |
391 //Break is delibrately not used here. The control should pass through the KCD_LEFT case. | |
392 case KCD_LEFT: /* activate this entry */ | |
393 mnuSelect(data->MenuLists); | |
394 MenuHandle = mfwControl(data->MenuLists); | |
395 if ((MenuHandle != NULL) && // Marcus: Issue 1810: 12/03/2003 | |
396 (MenuHandle->curAttr != NULL) && | |
397 winIsFocussed(win)) | |
398 { | |
399 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, MenuHandle->curAttr->mnuColour); | |
400 } | |
401 break; | |
402 case KCD_CALL: /* press send key */ | |
403 data->ExitReason = LISTS_REASON_SEND; | |
404 data->MenuData.Reason = LISTS_REASON_SEND; | |
405 MenuHandle = mfwControl(data->MenuLists); | |
406 data->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
407 data->MenuData.ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
408 | |
409 /* SPR998 - SH - check if callback exists before calling it! */ | |
410 if (data->Callback) | |
411 data->Callback(data->Parent, &data->MenuData); | |
412 | |
413 if (data->MenuData.autoDestroy) | |
414 { | |
415 winDelete (win); | |
416 FREE_MEMORY ((void*)data, sizeof (ListWinInfo)); | |
417 } | |
418 break; | |
419 case KCD_HUP: /* back to previous menu */ | |
420 data->ExitReason = LISTS_REASON_HANGUP; | |
421 data->MenuData.Reason = LISTS_REASON_HANGUP; | |
422 /*NM, p023 */ | |
423 MenuHandle = mfwControl(data->MenuLists); | |
424 data->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
425 data->MenuData.ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
426 /*NM, p023 end */ | |
427 | |
428 data->Callback(data->Parent, &data->MenuData); | |
429 if (data->MenuData.autoDestroy) | |
430 { | |
431 winDelete (win); | |
432 FREE_MEMORY ((void*)data, sizeof (ListWinInfo)); | |
433 } | |
434 break; | |
435 case KCD_RIGHT: /* back to previous menu */ | |
436 mnuEscape(data->MenuLists); | |
437 break; | |
438 default: /* no response to all other keys */ | |
439 return MFW_EVENT_CONSUMED; | |
440 } | |
441 } | |
442 TRACE_FUNCTION("listsKeyEvent()-end"); | |
443 return MFW_EVENT_CONSUMED; | |
444 } | |
445 | |
446 /******************************************************************************* | |
447 | |
448 $Function: listsWinEvent | |
449 | |
450 $Description: window event handler | |
451 | |
452 $Returns: none. | |
453 | |
454 $Arguments: | |
455 | |
456 *******************************************************************************/ | |
457 static int listsWinEvent(MfwEvt e, MfwWin *w) | |
458 { | |
459 ListWinInfo * ListData = (ListWinInfo *)w->user; | |
460 | |
461 TRACE_FUNCTION("listsWinEvent()"); | |
462 | |
463 switch (e) | |
464 { | |
465 case E_WIN_VISIBLE: | |
466 if (w->flags & E_WIN_VISIBLE) | |
467 { | |
468 dspl_ClearAll(); | |
469 softKeys_displayId(ListData->MenuData.LeftSoftKey, ListData->MenuData.RightSoftKey, 0, ListData->MenuListsAttr.mnuColour ); | |
470 } | |
471 #ifdef FF_MMI_RINGTONE | |
472 SEND_EVENT(ListData->Parent,E_VISIBLE_MELODY,0,(void*)ListData); | |
473 #endif | |
474 break; | |
475 #ifdef FF_MMI_RINGTONE | |
476 case MfwWinSuspend: | |
477 SEND_EVENT(ListData->Parent,E_SUSPEND_MELODY,0,(void*)ListData); | |
478 break; | |
479 #endif | |
480 default: | |
481 return MFW_EVENT_PASSED; | |
482 // break; // RAVI | |
483 } | |
484 return MFW_EVENT_CONSUMED; | |
485 } | |
486 | |
487 static void lists_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
488 { | |
489 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
490 ListWinInfo * ListData = (ListWinInfo *)win_data->user; | |
491 T_MFW_HND * l_parent; | |
492 SHORT l_id; | |
493 | |
494 TRACE_FUNCTION ("lists_exec_cb()"); | |
495 | |
496 switch (event) | |
497 { | |
498 case E_INIT: | |
499 case E_BACK: | |
500 case E_RETURN: | |
501 case E_ABORT: | |
502 case E_EXIT: | |
503 /* defaultreaction */ | |
504 l_parent = ListData->Parent; | |
505 l_id = ListData->id; | |
506 winDelete (win); | |
507 FREE_MEMORY ((void*) ListData, sizeof (ListWinInfo)); | |
508 SEND_EVENT (l_parent, event, l_id, NULL); /* forward event to parent */ | |
509 break; | |
510 default: | |
511 return; | |
512 } | |
513 } | |
514 | |
515 | |
516 | |
517 /******************************************************************************* | |
518 | |
519 $Function: listsListCbMenu | |
520 | |
521 $Description: List menu handler. (mfw callback function) | |
522 | |
523 $Returns: none. | |
524 | |
525 $Arguments: | |
526 | |
527 *******************************************************************************/ | |
528 int listsListCbMenu(MfwEvt EventCode, MfwMnu *MenuHandle) | |
529 { | |
530 int Status = LISTS_OK; | |
531 T_MFW_HND win = mfw_parent (mfw_header()); | |
532 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
533 ListWinInfo* ListData = (ListWinInfo *)win_data->user; | |
534 | |
535 TRACE_FUNCTION("listsCbMenu()"); | |
536 | |
537 switch (EventCode) | |
538 { | |
539 case E_MNU_SELECT: | |
540 ListData->ExitReason = E_MNU_SELECT; | |
541 ListData->MenuData.Reason = LISTS_REASON_SELECT;// MZ 14/2/01 E_MNU_SELECT; | |
542 ListData->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
543 ListData->MenuData.ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
544 /* SPR998 - SH - check if callback exists before calling it! */ | |
545 if (ListData->Callback) | |
546 ListData->Callback(ListData->Parent, &ListData->MenuData); | |
547 break; | |
548 | |
549 case E_MNU_ESCAPE: | |
550 ListData->ExitReason = LISTS_REASON_BACK; | |
551 ListData->MenuData.Reason = LISTS_REASON_BACK; | |
552 /*NM, p023*/ | |
553 ListData->MenuData.CursorPosition = MenuHandle->lCursor[MenuHandle->level]; | |
554 ListData->MenuData.ListPosition = MenuHandle->lCursor[MenuHandle->level]; /* True cursor position in list menu. */ | |
555 /*NM, p023*/ | |
556 | |
557 /* SPR998 - SH - check if callback exists before calling it! */ | |
558 if (ListData->Callback) | |
559 ListData->Callback(ListData->Parent, &ListData->MenuData); | |
560 break; | |
561 | |
562 default: | |
563 Status = LISTS_FAIL; | |
564 TRACE_EVENT("Activation 77 error"); | |
565 break; | |
566 } | |
567 | |
568 /* | |
569 * Free all allocated memory and handler | |
570 */ | |
571 if (ListData->MenuData.autoDestroy) | |
572 { | |
573 winDelete (win); | |
574 FREE_MEMORY ((void*) ListData, sizeof (ListWinInfo)); | |
575 } | |
576 return Status; | |
577 } | |
578 | |
579 void listsDestroy(T_MFW_HND win) | |
580 { | |
581 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
582 ListWinInfo * ListData = (ListWinInfo *)win_data->user; | |
583 winDelete (win); | |
584 FREE_MEMORY ((void*) ListData, sizeof (ListWinInfo)); | |
585 | |
586 } | |
587 |